Skip to content

Commit 51a366c

Browse files
authored
Tool to import parts of dart-lang/site-shared into third_party/site-shared (#8233)
1 parent 59843d1 commit 51a366c

File tree

6 files changed

+148
-0
lines changed

6 files changed

+148
-0
lines changed

third_party/site-shared/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Content and infrastructure shared across Dart and Flutter websites.
2+
3+
Vendoring resource files from:
4+
- https://github.com/dart-lang/site-shared/tree/main/pkgs/dash_design
5+
6+
Vendored files can be updated by running:
7+
`./update-site-shared.sh`
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Copyright 2024, the Dart project authors.
2+
3+
Redistribution and use in source and binary forms, with or without
4+
modification, are permitted provided that the following conditions are
5+
met:
6+
7+
* Redistributions of source code must retain the above copyright
8+
notice, this list of conditions and the following disclaimer.
9+
* Redistributions in binary form must reproduce the above
10+
copyright notice, this list of conditions and the following
11+
disclaimer in the documentation and/or other materials provided
12+
with the distribution.
13+
* Neither the name of Google LLC nor the names of its
14+
contributors may be used to endorse or promote products derived
15+
from this software without specific prior written permission.
16+
17+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
/// styles.scss:
6+
///
7+
/// Incorporates all styles and CSS custom properties (variables)
8+
/// from the dash_design package.
9+
///
10+
/// Most variables are added at the `:root` (the `html` element),
11+
/// but dark mode variable overrides are added to the `body` element if
12+
/// the class `dark-theme` is added to it.
13+
14+
@use 'styles/variables';
15+
16+
$google-site: false !default;
17+
18+
:root {
19+
@include variables.typography;
20+
@include variables.shared-colors;
21+
22+
@include variables.light-theme;
23+
24+
@if $google-site {
25+
@include variables.google-overrides;
26+
}
27+
}
28+
29+
body {
30+
&.dark-theme {
31+
@include variables.dark-theme;
32+
}
33+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
/// styles/variables.scss:
6+
///
7+
/// Mixins that can be included to load CSS custom properties (variables)
8+
/// into any desired scope.
9+
10+
/// Shared typography CSS variables.
11+
@mixin typography {
12+
/// Used for body text and smaller UI elements, like labels.
13+
--dash-default-fontFamily: 'Roboto', sans-serif;
14+
15+
/// Used for headlines, titles, and larger UI elements.
16+
--dash-display-fontFamily: 'Roboto', sans-serif;
17+
18+
/// Used for monospace text, such as code blocks.
19+
--dash-mono-fontFamily: 'Roboto Mono', 'Source Code Pro', 'Cascadia Mono', 'JetBrains Mono', monospace;
20+
21+
/// Used for icons, such as the magnifying glass for search.
22+
--dash-symbol-fontFamily: 'Material Symbols', 'Material Symbols Outlined';
23+
}
24+
25+
/// Color-related, theme-agnostic CSS variables.
26+
@mixin shared-colors {
27+
28+
}
29+
30+
/// Light-theme specific CSS variables.
31+
@mixin light-theme {
32+
/// The default text color, used for body text.
33+
--dash-surface-fgColor: #4a4a4a;
34+
}
35+
36+
/// Dark-theme specific CSS variables.
37+
@mixin dark-theme {
38+
--dash-surface-fgColor: #dcdcdc;
39+
}
40+
41+
/// CSS variables that specify values that can only be used by Google sites,
42+
/// such as enabling the Google Sans font families.
43+
///
44+
/// These overrides should be included after all other variables are defined.
45+
@mixin google-overrides {
46+
// Non-Google sites, such as self-hosted API docs,
47+
// can't use Google Sans or Google Symbols.
48+
--dash-default-fontFamily: 'Google Sans Text', 'Google Sans', 'Roboto', sans-serif;
49+
--dash-display-fontFamily: 'Google Sans', 'Google Sans Text', 'Roboto', sans-serif;
50+
--dash-mono-fontFamily: 'Google Sans Mono', 'Roboto Mono', 'Source Code Pro', 'Cascadia Mono', 'JetBrains Mono', monospace;
51+
--dash-symbol-fontFamily: 'Google Symbols', 'Material Symbols', 'Material Symbols Outlined';
52+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
commit c30707803572c7c7c2fd3650d8c6e2a2e61731f4
2+
2024-11-06T15:44+01:00
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/bash
2+
set -e
3+
4+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
5+
6+
TEMP_DIR=$(mktemp -d)
7+
8+
# Clone site-shared repository
9+
git clone https://github.com/dart-lang/site-shared "$TEMP_DIR"
10+
11+
# Delete the previous version
12+
rm -rf "$SCRIPT_DIR/dash_design"
13+
14+
# Copy css, js, png files to dash_design/
15+
mkdir "$SCRIPT_DIR/dash_design"
16+
cp -r "$TEMP_DIR"/pkgs/dash_design/lib/ "$SCRIPT_DIR/dash_design/"
17+
18+
# Copy license
19+
cp "$TEMP_DIR/pkgs/dash_design/LICENSE" "$SCRIPT_DIR/dash_design/LICENSE"
20+
21+
# Update the last updated file:
22+
cd "$TEMP_DIR"/pkgs/dash_design/ && git show --summary | grep commit | head -1 >"$SCRIPT_DIR/last-updated.txt"
23+
date -Iminutes >>"$SCRIPT_DIR/last-updated.txt"
24+
25+
# Cleanup
26+
cd "$SCRIPT_DIR"
27+
rm -rf "$TEMP_DIR"

0 commit comments

Comments
 (0)