@once-ui-system/foundations 0.0.0-stage → 3.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -2
- package/dist/css/styles.css +4 -0
- package/dist/css/styles.css.map +1 -0
- package/dist/css/tokens.css +4 -0
- package/dist/css/tokens.css.map +1 -0
- package/package.json +57 -4
- package/scss/styles/background.generated.scss +395 -0
- package/scss/styles/border.generated.scss +528 -0
- package/scss/styles/breakpoints.scss +39 -0
- package/scss/styles/color.generated.scss +175 -0
- package/scss/styles/cursor.generated.scss +88 -0
- package/scss/styles/density.scss +74 -0
- package/scss/styles/display.generated.scss +1496 -0
- package/scss/styles/flex.generated.scss +867 -0
- package/scss/styles/global.scss +57 -0
- package/scss/styles/grid.generated.scss +649 -0
- package/scss/styles/index.scss +15 -0
- package/scss/styles/position.generated.scss +1957 -0
- package/scss/styles/shadow.generated.scss +23 -0
- package/scss/styles/size.generated.scss +69 -0
- package/scss/styles/spacing.generated.scss +9447 -0
- package/scss/styles/touch.scss +29 -0
- package/scss/styles/typography.generated.scss +334 -0
- package/scss/styles/utilities.scss +23 -0
- package/scss/tokens/border.scss +95 -0
- package/scss/tokens/data.scss +107 -0
- package/scss/tokens/function.scss +742 -0
- package/scss/tokens/index.scss +8 -0
- package/scss/tokens/layout.scss +317 -0
- package/scss/tokens/scheme.scss +352 -0
- package/scss/tokens/shadow.scss +7 -0
- package/scss/tokens/theme.scss +779 -0
- package/scss/tokens/typography.scss +118 -0
- package/tokens/README.md +49 -0
- package/tokens/once-ui.tokens.json +2794 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
@use "../styles/breakpoints.scss" as breakpoints;
|
|
2
|
+
|
|
3
|
+
:root {
|
|
4
|
+
/* FONT WEIGHT */
|
|
5
|
+
--font-weight-thin: 100;
|
|
6
|
+
--font-weight-extraLight: 200;
|
|
7
|
+
--font-weight-light: 300;
|
|
8
|
+
--font-weight-normal: 400;
|
|
9
|
+
--font-weight-medium: 500;
|
|
10
|
+
--font-weight-semiBold: 600;
|
|
11
|
+
--font-weight-bold: 700;
|
|
12
|
+
--font-weight-extraBold: 800;
|
|
13
|
+
|
|
14
|
+
--font-weight-body-default: var(--font-weight-normal);
|
|
15
|
+
--font-weight-body-strong: var(--font-weight-bold);
|
|
16
|
+
--font-weight-label-default: var(--font-weight-normal);
|
|
17
|
+
--font-weight-label-strong: var(--font-weight-semiBold);
|
|
18
|
+
--font-weight-code-default: var(--font-weight-normal);
|
|
19
|
+
--font-weight-code-strong: var(--font-weight-bold);
|
|
20
|
+
--font-weight-heading-default: var(--font-weight-normal);
|
|
21
|
+
--font-weight-heading-strong: var(--font-weight-semiBold);
|
|
22
|
+
--font-weight-display-default: var(--font-weight-light);
|
|
23
|
+
--font-weight-display-normal: var(--font-weight-normal);
|
|
24
|
+
--font-weight-display-medium: var(--font-weight-medium);
|
|
25
|
+
--font-weight-display-strong: var(--font-weight-semiBold);
|
|
26
|
+
|
|
27
|
+
/* FONT SIZE */
|
|
28
|
+
--font-size-display-xl: 5rem;
|
|
29
|
+
--font-size-display-l: 4rem;
|
|
30
|
+
--font-size-display-m: 3rem;
|
|
31
|
+
--font-size-display-s: 2.5rem;
|
|
32
|
+
--font-size-display-xs: 2rem;
|
|
33
|
+
|
|
34
|
+
--font-size-heading-xl: 1.5rem;
|
|
35
|
+
--font-size-heading-l: 1.33rem;
|
|
36
|
+
--font-size-heading-m: 1.25rem;
|
|
37
|
+
--font-size-heading-s: 1.125rem;
|
|
38
|
+
--font-size-heading-xs: 1rem;
|
|
39
|
+
|
|
40
|
+
--font-size-body-xl: 1.25rem;
|
|
41
|
+
--font-size-body-l: 1.125rem;
|
|
42
|
+
--font-size-body-m: 1rem;
|
|
43
|
+
--font-size-body-s: 0.875rem;
|
|
44
|
+
--font-size-body-xs: 0.75rem;
|
|
45
|
+
|
|
46
|
+
--font-size-label-xl: 1.125rem;
|
|
47
|
+
--font-size-label-l: 1rem;
|
|
48
|
+
--font-size-label-m: 0.925rem;
|
|
49
|
+
--font-size-label-s: 0.825rem;
|
|
50
|
+
--font-size-label-xs: 0.75rem;
|
|
51
|
+
|
|
52
|
+
/* LINE HEIGHT */
|
|
53
|
+
--line-height-display-xl: 5rem;
|
|
54
|
+
--line-height-display-l: 4.25rem;
|
|
55
|
+
--line-height-display-m: 3.25rem;
|
|
56
|
+
--line-height-display-s: 3rem;
|
|
57
|
+
--line-height-display-xs: 2.5rem;
|
|
58
|
+
|
|
59
|
+
--line-height-heading-xl: 2rem;
|
|
60
|
+
--line-height-heading-l: 1.75rem;
|
|
61
|
+
--line-height-heading-m: 1.5rem;
|
|
62
|
+
--line-height-heading-s: 1.5rem;
|
|
63
|
+
--line-height-heading-xs: 1.25rem;
|
|
64
|
+
|
|
65
|
+
--line-height-body-xl: 1.75rem;
|
|
66
|
+
--line-height-body-l: 1.5rem;
|
|
67
|
+
--line-height-body-m: 1.5rem;
|
|
68
|
+
--line-height-body-s: 1.125rem;
|
|
69
|
+
--line-height-body-xs: 1rem;
|
|
70
|
+
|
|
71
|
+
--line-height-label-xl: 1.5rem;
|
|
72
|
+
--line-height-label-l: 1.25rem;
|
|
73
|
+
--line-height-label-m: 1.25rem;
|
|
74
|
+
--line-height-label-s: 1rem;
|
|
75
|
+
--line-height-label-xs: 0.875rem;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
@include breakpoints.m {
|
|
79
|
+
:root {
|
|
80
|
+
/* FONT SIZE */
|
|
81
|
+
--font-size-display-xl: 3.5rem;
|
|
82
|
+
--font-size-display-l: 3.25rem;
|
|
83
|
+
--font-size-display-m: 2.75rem;
|
|
84
|
+
--font-size-display-s: 2.25rem;
|
|
85
|
+
--font-size-display-xs: 1.75rem;
|
|
86
|
+
|
|
87
|
+
--font-size-heading-xl: 1.33rem;
|
|
88
|
+
--font-size-heading-l: 1.25rem;
|
|
89
|
+
--font-size-heading-m: 1.125rem;
|
|
90
|
+
|
|
91
|
+
/* LINE HEIGHT */
|
|
92
|
+
--line-height-display-xl: 3.75rem;
|
|
93
|
+
--line-height-display-l: 3.5rem;
|
|
94
|
+
--line-height-display-m: 3rem;
|
|
95
|
+
--line-height-display-s: 2.5rem;
|
|
96
|
+
--line-height-display-xs: 2rem;
|
|
97
|
+
|
|
98
|
+
--line-height-heading-xl: 1.75rem;
|
|
99
|
+
--line-height-heading-l: 1.5rem;
|
|
100
|
+
--line-height-heading-m: 1.25rem;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
@include breakpoints.s {
|
|
105
|
+
:root {
|
|
106
|
+
/* FONT SIZE */
|
|
107
|
+
--font-size-display-xl: 2.75rem;
|
|
108
|
+
--font-size-display-l: 2.5rem;
|
|
109
|
+
--font-size-display-m: 2.25rem;
|
|
110
|
+
--font-size-display-s: 2rem;
|
|
111
|
+
|
|
112
|
+
/* LINE HEIGHT */
|
|
113
|
+
--line-height-display-xl: 3rem;
|
|
114
|
+
--line-height-display-l: 2.75rem;
|
|
115
|
+
--line-height-display-m: 2.5rem;
|
|
116
|
+
--line-height-display-s: 2.5rem;
|
|
117
|
+
}
|
|
118
|
+
}
|
package/tokens/README.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Token export
|
|
2
|
+
|
|
3
|
+
`once-ui.tokens.json` is the Once UI token set as JSON, for platforms that
|
|
4
|
+
cannot load `tokens.css`: `@once-ui-system/native` reads it, and Figma, Swift or
|
|
5
|
+
Kotlin tooling can too. It is generated from `scss/tokens/` by
|
|
6
|
+
`scripts/export-tokens.mjs` — run `pnpm export:tokens` after changing a token;
|
|
7
|
+
`pnpm check:tokens` (and the test suite) fails while the file is stale.
|
|
8
|
+
|
|
9
|
+
Core ships the same file as `@once-ui-system/core/tokens.json`.
|
|
10
|
+
|
|
11
|
+
## Format
|
|
12
|
+
|
|
13
|
+
```jsonc
|
|
14
|
+
{
|
|
15
|
+
"format": "once-ui-tokens",
|
|
16
|
+
"version": 1,
|
|
17
|
+
"breakpoints": { "xs": 480, "s": 768, "m": 1024, "l": 1440, "xl": 1441 },
|
|
18
|
+
"layers": [
|
|
19
|
+
{ "when": {}, "tokens": { "scheme-blue-500": "#2d69fa", "function-info-500": "{scheme-gray-500}" } },
|
|
20
|
+
{ "when": { "brand": "blue" }, "tokens": { "function-brand-500": "{scheme-blue-500}" } },
|
|
21
|
+
{ "when": { "theme": "dark" }, "tokens": { "brand-background-strong": "{function-brand-300}" } },
|
|
22
|
+
{ "when": {}, "maxWidth": 768, "tokens": { "responsive-space-m": "{static-space-12}" } }
|
|
23
|
+
]
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Each layer is one CSS rule from `scss/tokens/`:
|
|
28
|
+
|
|
29
|
+
- `when` — the `data-*` attributes its selector needs, camel-cased to match
|
|
30
|
+
`ThemeProvider` props (`data-solid-style` → `solidStyle`). `{}` is `:root`.
|
|
31
|
+
- `maxWidth` — set when the rule sits in a breakpoint's `@media (max-width)`.
|
|
32
|
+
- `tokens` — the custom properties it sets, without the leading `--`.
|
|
33
|
+
|
|
34
|
+
To resolve a theme, take every layer whose `when` entries all equal your
|
|
35
|
+
settings (and whose `maxWidth`, if any, is at least your screen width), apply
|
|
36
|
+
them in order of how many conditions they have (`:root` counts as one), then
|
|
37
|
+
file order — the same order the CSS cascade uses — and follow `{name}`
|
|
38
|
+
references until you reach a value.
|
|
39
|
+
|
|
40
|
+
Values:
|
|
41
|
+
|
|
42
|
+
| Kind | Example | Notes |
|
|
43
|
+
| --- | --- | --- |
|
|
44
|
+
| Colour | `"#2d69fa"`, `"#0000001f"` | sRGB hex, converted from the OKLCH source; 8 digits when translucent. |
|
|
45
|
+
| Reference | `"{function-brand-300}"` | Another token. |
|
|
46
|
+
| Length | `"0.75rem"`, `"1px"` | rem follows the root font size: 16px, 15px on phones (`font-scaling-mobile`). |
|
|
47
|
+
| Number | `500`, `1.1` | Font weights, multipliers. |
|
|
48
|
+
| Shadow | `[{ "x": 0, "y": 1, "blur": 2, "spread": 0, "color": "#00000014" }]` | One entry per layer. |
|
|
49
|
+
| Other | `"ease-in-out"`, `"blur(1rem)"` | Kept as CSS text. |
|