@lt-three/love3 0.1.0 → 0.1.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 +40 -40
- package/dist/native/analytics/animation.d.ts +1 -1
- package/dist/native/analytics/animation.js +1 -1
- package/dist/native/analytics/chart.types.d.ts +3 -3
- package/dist/native/analytics/metric-card.d.ts +3 -3
- package/dist/native/analytics/metric-card.js +3 -3
- package/dist/native/analytics/multi-line-chart.d.ts +9 -8
- package/dist/native/analytics/multi-line-chart.js +14 -13
- package/dist/native/analytics/pie-chart.d.ts +7 -7
- package/dist/native/analytics/pie-chart.js +8 -8
- package/dist/native/analytics/single-number.d.ts +4 -4
- package/dist/native/analytics/single-number.js +2 -2
- package/dist/native/atom/avatar.d.ts +6 -6
- package/dist/native/atom/avatar.js +2 -2
- package/dist/native/atom/badge.d.ts +5 -5
- package/dist/native/atom/button.d.ts +12 -12
- package/dist/native/atom/button.js +8 -8
- package/dist/native/atom/checkbox.d.ts +4 -4
- package/dist/native/atom/checkbox.js +2 -2
- package/dist/native/atom/colored-value.d.ts +4 -4
- package/dist/native/atom/colored-value.js +4 -4
- package/dist/native/atom/image.d.ts +7 -7
- package/dist/native/atom/image.js +2 -2
- package/dist/native/atom/label.d.ts +5 -5
- package/dist/native/atom/label.js +2 -2
- package/dist/native/atom/link.d.ts +5 -5
- package/dist/native/atom/link.js +5 -5
- package/dist/native/atom/readout.d.ts +7 -7
- package/dist/native/atom/readout.js +3 -3
- package/dist/native/atom/search-input.d.ts +2 -2
- package/dist/native/atom/search-input.js +2 -2
- package/dist/native/atom/select.d.ts +14 -14
- package/dist/native/atom/select.js +8 -8
- package/dist/native/atom/separator.d.ts +2 -3
- package/dist/native/atom/separator.js +2 -3
- package/dist/native/atom/skeleton.d.ts +3 -3
- package/dist/native/atom/skeleton.js +3 -3
- package/dist/native/atom/slider.d.ts +6 -6
- package/dist/native/atom/slider.js +3 -3
- package/dist/native/atom/spinner.d.ts +4 -4
- package/dist/native/atom/spinner.js +2 -2
- package/dist/native/atom/switch.d.ts +4 -4
- package/dist/native/atom/switch.js +3 -3
- package/dist/native/atom/symbol.d.ts +7 -7
- package/dist/native/atom/symbol.js +7 -7
- package/dist/native/atom/symbol.types.d.ts +8 -8
- package/dist/native/atom/symbol.types.js +7 -7
- package/dist/native/atom/text-field.d.ts +15 -15
- package/dist/native/atom/text-field.js +5 -5
- package/dist/native/atom/theme-toggle.d.ts +7 -7
- package/dist/native/atom/theme-toggle.js +4 -4
- package/dist/native/atom/timezone-select.d.ts +5 -5
- package/dist/native/atom/timezone-select.js +4 -4
- package/dist/native/atom/typography.d.ts +2 -2
- package/dist/native/atom/typography.js +2 -2
- package/dist/native/base/button.d.ts +13 -13
- package/dist/native/base/button.js +4 -4
- package/dist/native/base/form.d.ts +15 -15
- package/dist/native/base/form.js +11 -11
- package/dist/native/base/glass-card.d.ts +3 -3
- package/dist/native/base/glass-card.js +3 -3
- package/dist/native/base/input.d.ts +8 -8
- package/dist/native/base/input.js +7 -7
- package/dist/native/base/sheet.d.ts +27 -27
- package/dist/native/base/sheet.js +15 -15
- package/dist/native/form/checkbox.d.ts +3 -3
- package/dist/native/form/checkbox.js +2 -2
- package/dist/native/form/date-picker.d.ts +9 -9
- package/dist/native/form/date-picker.js +9 -9
- package/dist/native/form/form.d.ts +5 -6
- package/dist/native/form/form.js +4 -5
- package/dist/native/form/radio-group.d.ts +5 -5
- package/dist/native/form/radio-group.js +4 -4
- package/dist/native/form/select.d.ts +2 -2
- package/dist/native/form/select.js +2 -2
- package/dist/native/form/slider.d.ts +2 -2
- package/dist/native/form/slider.js +2 -2
- package/dist/native/form/switch.d.ts +2 -2
- package/dist/native/form/switch.js +2 -2
- package/dist/native/form/text-area.d.ts +2 -2
- package/dist/native/form/text-area.js +1 -1
- package/dist/native/form/text-input.d.ts +5 -5
- package/dist/native/form/text-input.js +8 -8
- package/dist/native/layout/accordion.d.ts +5 -5
- package/dist/native/layout/accordion.js +2 -2
- package/dist/native/layout/card.d.ts +8 -8
- package/dist/native/layout/card.js +3 -3
- package/dist/native/layout/description.d.ts +2 -2
- package/dist/native/layout/description.js +2 -2
- package/dist/native/layout/error.d.ts +5 -5
- package/dist/native/layout/error.js +2 -2
- package/dist/native/layout/information.d.ts +4 -4
- package/dist/native/layout/information.js +3 -3
- package/dist/native/layout/locked.d.ts +15 -15
- package/dist/native/layout/locked.js +7 -7
- package/dist/native/layout/modal.d.ts +8 -8
- package/dist/native/layout/modal.js +5 -5
- package/dist/native/layout/not-found.d.ts +4 -4
- package/dist/native/layout/not-found.js +3 -3
- package/dist/native/layout/page-frame.d.ts +8 -8
- package/dist/native/layout/page-frame.js +3 -3
- package/dist/native/layout/panel.d.ts +5 -5
- package/dist/native/layout/panel.js +5 -5
- package/dist/native/layout/reorderable-list.d.ts +14 -14
- package/dist/native/layout/reorderable-list.js +10 -10
- package/dist/native/layout/sheet.d.ts +10 -10
- package/dist/native/layout/sheet.js +4 -4
- package/dist/native/layout/simple-dialog.d.ts +3 -3
- package/dist/native/layout/simple-dialog.js +2 -2
- package/dist/native/layout/simple-table.d.ts +18 -18
- package/dist/native/layout/simple-table.js +1 -1
- package/dist/native/layout/tab-bar.d.ts +10 -10
- package/dist/native/layout/tab-bar.js +4 -4
- package/dist/native/layout/tabs.d.ts +6 -6
- package/dist/native/layout/tabs.js +4 -4
- package/dist/native/layout/tuning-panel.d.ts +10 -10
- package/dist/native/layout/tuning-panel.js +15 -15
- package/dist/native/lib/autocomplete.d.ts +1 -1
- package/dist/native/lib/autocomplete.js +1 -1
- package/dist/native/lib/breakpoints.d.ts +3 -3
- package/dist/native/lib/breakpoints.js +3 -3
- package/dist/native/lib/chart-palette.d.ts +2 -2
- package/dist/native/lib/chart-palette.js +2 -2
- package/dist/native/lib/confirm.d.ts +15 -16
- package/dist/native/lib/confirm.js +9 -10
- package/dist/native/lib/control.d.ts +9 -9
- package/dist/native/lib/external-store.d.ts +4 -5
- package/dist/native/lib/keyboard.d.ts +7 -7
- package/dist/native/lib/keyboard.js +7 -7
- package/dist/native/lib/labels.d.ts +6 -6
- package/dist/native/lib/labels.js +6 -6
- package/dist/native/lib/loading.d.ts +3 -3
- package/dist/native/lib/loading.js +3 -3
- package/dist/native/lib/network.d.ts +5 -6
- package/dist/native/lib/network.js +5 -6
- package/dist/native/lib/scheme.d.ts +7 -7
- package/dist/native/lib/scheme.js +3 -3
- package/dist/native/lib/snackbar.d.ts +12 -13
- package/dist/native/lib/snackbar.js +7 -8
- package/dist/native/lib/theme.d.ts +15 -15
- package/dist/native/lib/theme.js +15 -15
- package/dist/native/lib/timezone.d.ts +13 -13
- package/dist/native/lib/timezone.js +13 -13
- package/dist/native/lib/token-color.d.ts +1 -1
- package/dist/native/lib/token-color.js +1 -1
- package/dist/native/lib/tuning-context.d.ts +2 -2
- package/dist/native/lib/tuning.d.ts +10 -10
- package/dist/native/lib/tuning.js +8 -8
- package/dist/native/lib/typography.d.ts +3 -3
- package/dist/native/lib/typography.js +3 -3
- package/dist/native/lib/utils.d.ts +3 -3
- package/dist/native/lib/utils.js +3 -3
- package/dist/native/once/confirm.d.ts +2 -2
- package/dist/native/once/confirm.js +2 -2
- package/dist/native/once/error-boundary.d.ts +3 -3
- package/dist/native/once/error-boundary.js +2 -2
- package/dist/native/once/loading-lock.d.ts +3 -3
- package/dist/native/once/loading-lock.js +3 -3
- package/dist/native/once/offline-banner.d.ts +6 -6
- package/dist/native/once/offline-banner.js +5 -5
- package/dist/native/once/snackbar.d.ts +7 -7
- package/dist/native/once/snackbar.js +5 -5
- package/dist/native/styles.css +21 -21
- package/dist/shared/analytics.d.ts +23 -23
- package/dist/shared/button.d.ts +1 -1
- package/dist/shared/form.d.ts +7 -7
- package/dist/shared/form.js +2 -2
- package/dist/tokens/contrast-pairs.d.ts +9 -9
- package/dist/tokens/contrast-pairs.js +10 -10
- package/dist/tokens/index.d.ts +1 -1
- package/dist/tokens/index.js +1 -1
- package/dist/tokens/styles.gen.css +87 -87
- package/dist/tokens/tokens.gen.d.ts +2 -2
- package/dist/tokens/tokens.gen.js +2 -2
- package/dist/tuning/catalog.d.ts +8 -8
- package/dist/tuning/catalog.js +9 -9
- package/dist/tuning/color.d.ts +4 -4
- package/dist/tuning/color.js +5 -5
- package/dist/tuning/css.d.ts +13 -13
- package/dist/tuning/css.js +17 -17
- package/dist/tuning/model.d.ts +11 -11
- package/dist/tuning/model.js +11 -11
- package/dist/tuning/native.d.ts +18 -18
- package/dist/tuning/native.js +18 -18
- package/dist/tuning/schema.d.ts +15 -15
- package/dist/tuning/schema.js +22 -22
- package/dist/tuning/types.d.ts +25 -25
- package/dist/tuning/types.js +6 -6
- package/dist/web/analytics/line-chart.d.ts +6 -6
- package/dist/web/analytics/line-chart.js +3 -3
- package/dist/web/analytics/metric-card.d.ts +6 -6
- package/dist/web/analytics/metric-card.js +5 -5
- package/dist/web/analytics/multi-line-chart.d.ts +23 -23
- package/dist/web/analytics/multi-line-chart.js +33 -33
- package/dist/web/atom/avatar.d.ts +1 -1
- package/dist/web/atom/checkbox.d.ts +6 -6
- package/dist/web/atom/checkbox.js +2 -2
- package/dist/web/atom/colored-value.d.ts +4 -4
- package/dist/web/atom/colored-value.js +4 -4
- package/dist/web/atom/help.d.ts +1 -1
- package/dist/web/atom/segmented-control.d.ts +13 -14
- package/dist/web/atom/segmented-control.js +6 -7
- package/dist/web/atom/select.d.ts +7 -7
- package/dist/web/atom/select.js +5 -5
- package/dist/web/atom/slider.d.ts +3 -3
- package/dist/web/atom/slider.js +2 -2
- package/dist/web/atom/switch.d.ts +3 -3
- package/dist/web/atom/text-area.d.ts +9 -8
- package/dist/web/atom/text-area.js +9 -8
- package/dist/web/atom/text-field.d.ts +5 -4
- package/dist/web/atom/text-field.js +5 -4
- package/dist/web/atom/toggle-chip.d.ts +6 -6
- package/dist/web/atom/toggle-chip.js +4 -4
- package/dist/web/atom/tooltip.d.ts +6 -6
- package/dist/web/atom/tooltip.js +2 -2
- package/dist/web/base/accordion.js +1 -1
- package/dist/web/base/breadcrumb.d.ts +1 -1
- package/dist/web/base/breadcrumb.js +1 -1
- package/dist/web/base/card.d.ts +3 -3
- package/dist/web/base/card.js +2 -2
- package/dist/web/base/dialog.d.ts +1 -1
- package/dist/web/base/dialog.js +1 -1
- package/dist/web/base/form.d.ts +7 -7
- package/dist/web/base/form.js +5 -5
- package/dist/web/base/pagination.d.ts +5 -5
- package/dist/web/base/pagination.js +1 -1
- package/dist/web/base/sheet.d.ts +1 -1
- package/dist/web/base/sheet.js +1 -1
- package/dist/web/base/slider.d.ts +1 -1
- package/dist/web/base/sonner.d.ts +2 -2
- package/dist/web/base/sonner.js +2 -2
- package/dist/web/base/spinner.js +1 -1
- package/dist/web/form/checkbox.d.ts +8 -8
- package/dist/web/form/checkbox.js +3 -3
- package/dist/web/form/radio-group.js +3 -3
- package/dist/web/form/select.js +1 -1
- package/dist/web/form/slider.d.ts +3 -3
- package/dist/web/form/slider.js +3 -3
- package/dist/web/form/switch.d.ts +3 -3
- package/dist/web/form/switch.js +4 -4
- package/dist/web/form/text-area.js +1 -1
- package/dist/web/form/text-input.d.ts +1 -1
- package/dist/web/form/text-input.js +1 -1
- package/dist/web/layout/accordion.d.ts +5 -5
- package/dist/web/layout/accordion.js +2 -2
- package/dist/web/layout/alert-modal.d.ts +11 -11
- package/dist/web/layout/alert-modal.js +7 -7
- package/dist/web/layout/card.d.ts +1 -1
- package/dist/web/layout/information.d.ts +9 -9
- package/dist/web/layout/information.js +7 -7
- package/dist/web/layout/modal.d.ts +1 -1
- package/dist/web/layout/page-frame.d.ts +14 -14
- package/dist/web/layout/page-frame.js +7 -7
- package/dist/web/layout/scroll-area.d.ts +1 -1
- package/dist/web/layout/sheet.d.ts +4 -4
- package/dist/web/layout/simple-table.d.ts +18 -18
- package/dist/web/layout/simple-table.js +2 -2
- package/dist/web/layout/tabs.d.ts +4 -4
- package/dist/web/layout/titled-modal.d.ts +10 -11
- package/dist/web/layout/titled-modal.js +7 -8
- package/dist/web/lib/css-vars.d.ts +6 -6
- package/dist/web/lib/css-vars.js +5 -5
- package/dist/web/lib/dialog.d.ts +4 -4
- package/dist/web/lib/labels.d.ts +8 -8
- package/dist/web/lib/labels.js +8 -8
- package/dist/web/lib/modal-open-focus.d.ts +7 -7
- package/dist/web/lib/modal-open-focus.js +9 -9
- package/dist/web/lib/restore-focus.d.ts +4 -4
- package/dist/web/lib/restore-focus.js +4 -4
- package/dist/web/styles.css +33 -33
- package/package.json +2 -2
|
@@ -1,68 +1,68 @@
|
|
|
1
1
|
/*
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* This file is generated. Do not edit it directly.
|
|
3
|
+
* Source: src/tokens/definition.ts
|
|
4
|
+
* Regenerate: bun run generate
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
@custom-variant dark (&:is(.dark *));
|
|
8
8
|
|
|
9
9
|
:root {
|
|
10
10
|
/*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
11
|
+
* Raw tokens: text ramp and background layers
|
|
12
|
+
* Text has 3 levels (primary = ink-900 / secondary = ink-700 / tertiary = ink-500). Backgrounds come "forward" in the order frame < paper < raised < overlay.
|
|
13
|
+
* Dark is not a separate palette but an inversion of the roles, built as layers of bluish near-black rather than pure black.
|
|
14
14
|
*/
|
|
15
|
-
--ink-1000: #0f1012; /*
|
|
16
|
-
--ink-900: #1b1c20; /*
|
|
17
|
-
--ink-700: #40434a; /*
|
|
18
|
-
--ink-500: #676b74; /*
|
|
19
|
-
--ink-300: #a3a6ad; /*
|
|
20
|
-
--line: #e6e7eb; /* 1px
|
|
21
|
-
--line-strong: #d5d7dd; /*
|
|
22
|
-
--line-control: #80858f; /*
|
|
23
|
-
--frame: #f4f5f7; /*
|
|
24
|
-
--paper: #ffffff; /*
|
|
25
|
-
--raised: #ffffff; /*
|
|
26
|
-
--overlay: #ffffff; /*
|
|
27
|
-
--wash: #f1f2f4; /* hover
|
|
28
|
-
--scrim: rgba(0, 0, 0, 0.32); /*
|
|
29
|
-
--shadow-color: rgba(16, 24, 40, 0.1); /*
|
|
15
|
+
--ink-1000: #0f1012; /* Strongest text */
|
|
16
|
+
--ink-900: #1b1c20; /* Headings and primary text */
|
|
17
|
+
--ink-700: #40434a; /* Body text (secondary) */
|
|
18
|
+
--ink-500: #676b74; /* Tertiary, muted, placeholder */
|
|
19
|
+
--ink-300: #a3a6ad; /* Disabled, faint labels */
|
|
20
|
+
--line: #e6e7eb; /* 1px hairline border and divider */
|
|
21
|
+
--line-strong: #d5d7dd; /* Border of text inputs and stronger borders (a known exception that does not reach 3:1; borders of interactive controls use line-control) */
|
|
22
|
+
--line-control: #80858f; /* Border of unselected Checkbox / Radio / Switch. At least 3:1 on every surface (non-text AA) */
|
|
23
|
+
--frame: #f4f5f7; /* Outer frame, sidebar, page canvas */
|
|
24
|
+
--paper: #ffffff; /* Main content panel (base background) */
|
|
25
|
+
--raised: #ffffff; /* Surface of cards, inputs and secondary buttons */
|
|
26
|
+
--overlay: #ffffff; /* Popovers, dialogs, menus */
|
|
27
|
+
--wash: #f1f2f4; /* Light surface for hover and zebra rows */
|
|
28
|
+
--scrim: rgba(0, 0, 0, 0.32); /* Modal scrim. No blur */
|
|
29
|
+
--shadow-color: rgba(16, 24, 40, 0.1); /* Shadow color. Referenced by shadow-xs to shadow-2xl */
|
|
30
30
|
|
|
31
31
|
/*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
32
|
+
* Primary action color (indigo)
|
|
33
|
+
* A calm indigo for the primary action, focus and selected states. The same value in light and dark.
|
|
34
|
+
* Text on the fill (action) is action-foreground (white). Placing action as "text or link" on a dark surface does not reach AA,
|
|
35
|
+
* so use action-ink for text. Hover deepens the fill slightly (keeping AA for white text).
|
|
36
36
|
*/
|
|
37
|
-
--action: #5e6ad2; /*
|
|
38
|
-
--action-hover: #5059c2; /*
|
|
37
|
+
--action: #5e6ad2; /* Fill of the primary action, and the ring */
|
|
38
|
+
--action-hover: #5059c2; /* Hover of the primary action */
|
|
39
39
|
--action-foreground: #ffffff;
|
|
40
|
-
--action-ink: #4a55c0; /*
|
|
40
|
+
--action-ink: #4a55c0; /* Indigo used as text or a link */
|
|
41
41
|
|
|
42
42
|
/*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
43
|
+
* Brand color (<3 / Less Than Three)
|
|
44
|
+
* A brand color outside the indigo, used only by components that have a `<3` variant.
|
|
45
|
+
* Text on it is black (white is 2.98:1 and misses AA, while black clears it easily). Not inverted in dark.
|
|
46
46
|
*/
|
|
47
47
|
--lt-three: #ff5c76;
|
|
48
48
|
--lt-three-foreground: #000000;
|
|
49
49
|
|
|
50
50
|
/*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
51
|
+
* Semantic states
|
|
52
|
+
* Used for text, borders and small icons; badges and alerts can also use a light fill such as `bg-state-xxx/10`.
|
|
53
|
+
* A solid fill is only for the primary action of a destructive operation (destructive-solid). In dark they are brightened to stay readable on near-black.
|
|
54
54
|
*/
|
|
55
55
|
--state-success: #187548;
|
|
56
56
|
--state-error: #c42b3a;
|
|
57
57
|
--state-warning: #8f5f00;
|
|
58
|
-
--destructive-solid: #c42b3a; /*
|
|
58
|
+
--destructive-solid: #c42b3a; /* Fill (solid) of a destructive action. Text on it is destructive-solid-foreground (white). state-error is for text: it is bright on dark surfaces and not suited to a fill */
|
|
59
59
|
--destructive-solid-foreground: #ffffff;
|
|
60
60
|
|
|
61
61
|
/*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
62
|
+
* Typefaces
|
|
63
|
+
* Geist for Latin text, Geist Mono for numbers, IDs, code and data tables, and the OS-bundled Yu Gothic for Japanese text.
|
|
64
|
+
* Do not put a generic family (sans-serif) in --font-geist: it would appear in the composed stack before the Japanese fallback, and Japanese text would never reach Yu Gothic.
|
|
65
|
+
* Load the font files per platform (woff2 on web, ttf via expo-font on native).
|
|
66
66
|
*/
|
|
67
67
|
--font-geist: "Geist Variable", "Geist";
|
|
68
68
|
--font-geist-mono: "Geist Mono Variable", "Geist Mono", ui-monospace, monospace;
|
|
@@ -70,35 +70,35 @@
|
|
|
70
70
|
--font-mono: var(--font-geist-mono);
|
|
71
71
|
|
|
72
72
|
/*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
73
|
+
* Semantic tokens (shadcn-compatible aliases)
|
|
74
|
+
* They reference the raw tokens with var(), so swapping only the raw tokens moves the whole system (dark included).
|
|
75
75
|
*/
|
|
76
|
-
--background: var(--paper); /*
|
|
76
|
+
--background: var(--paper); /* Main content panel */
|
|
77
77
|
--foreground: var(--ink-900);
|
|
78
|
-
--card: var(--raised); /*
|
|
78
|
+
--card: var(--raised); /* Cards are a raised surface plus a thin border (no shadow) */
|
|
79
79
|
--card-foreground: var(--ink-900);
|
|
80
|
-
--popover: var(--overlay); /*
|
|
80
|
+
--popover: var(--overlay); /* Floating things (popovers, menus, dialogs) */
|
|
81
81
|
--popover-foreground: var(--ink-900);
|
|
82
|
-
--primary: var(--action); /*
|
|
82
|
+
--primary: var(--action); /* Indigo fill of the primary action (shared by web and native) */
|
|
83
83
|
--primary-foreground: var(--action-foreground);
|
|
84
|
-
--secondary: var(--wash); /* secondary
|
|
84
|
+
--secondary: var(--wash); /* secondary, accent and muted are wash */
|
|
85
85
|
--secondary-foreground: var(--ink-900);
|
|
86
86
|
--muted: var(--wash);
|
|
87
87
|
--muted-foreground: var(--ink-500);
|
|
88
88
|
--accent: var(--wash);
|
|
89
89
|
--accent-foreground: var(--ink-900);
|
|
90
|
-
--destructive: var(--state-error); /* native
|
|
90
|
+
--destructive: var(--state-error); /* Used by native (state-error for text and borders). The fill of a destructive action on web is destructive-solid */
|
|
91
91
|
--destructive-foreground: var(--paper);
|
|
92
92
|
--border: var(--line);
|
|
93
93
|
--input: var(--line-strong);
|
|
94
|
-
--ring: var(--action); /*
|
|
95
|
-
--chart-1: #5e6ad2; /*
|
|
94
|
+
--ring: var(--action); /* Focus is an indigo ring */
|
|
95
|
+
--chart-1: #5e6ad2; /* Charts use color. Five colors that stay readable in dark */
|
|
96
96
|
--chart-2: #1f9d6a;
|
|
97
97
|
--chart-3: #bd7100;
|
|
98
98
|
--chart-4: #d6495c;
|
|
99
99
|
--chart-5: #7a8194;
|
|
100
|
-
--section: var(--frame); /*
|
|
101
|
-
--radius: 6px; /* shadcn
|
|
100
|
+
--section: var(--frame); /* Canvas of pages and blocks */
|
|
101
|
+
--radius: 6px; /* The shadcn-compatible base radius. Same value as control (6px) */
|
|
102
102
|
--sidebar: var(--frame);
|
|
103
103
|
--sidebar-foreground: var(--ink-900);
|
|
104
104
|
--sidebar-primary: var(--action);
|
|
@@ -110,27 +110,27 @@
|
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
.dark {
|
|
113
|
-
--ink-1000: #f7f8f8; /*
|
|
114
|
-
--ink-900: #eceef0; /*
|
|
115
|
-
--ink-700: #cfd3da; /*
|
|
116
|
-
--ink-500: #8a8f98; /*
|
|
117
|
-
--ink-300: #5b5f67; /*
|
|
118
|
-
--line: #25272c; /* 1px
|
|
119
|
-
--line-strong: #34363d; /*
|
|
120
|
-
--line-control: #6b707a; /*
|
|
121
|
-
--frame: #0a0b0d; /*
|
|
122
|
-
--paper: #121316; /*
|
|
123
|
-
--raised: #17181c; /*
|
|
124
|
-
--overlay: #1d1e23; /*
|
|
125
|
-
--wash: #1b1c20; /* hover
|
|
126
|
-
--scrim: rgba(0, 0, 0, 0.72); /*
|
|
127
|
-
--shadow-color: rgba(0, 0, 0, 0.7); /*
|
|
128
|
-
--action-ink: #98a2f5; /*
|
|
113
|
+
--ink-1000: #f7f8f8; /* Strongest text */
|
|
114
|
+
--ink-900: #eceef0; /* Headings and primary text */
|
|
115
|
+
--ink-700: #cfd3da; /* Body text (secondary) */
|
|
116
|
+
--ink-500: #8a8f98; /* Tertiary, muted, placeholder */
|
|
117
|
+
--ink-300: #5b5f67; /* Disabled, faint labels */
|
|
118
|
+
--line: #25272c; /* 1px hairline border and divider */
|
|
119
|
+
--line-strong: #34363d; /* Border of text inputs and stronger borders (a known exception that does not reach 3:1; borders of interactive controls use line-control) */
|
|
120
|
+
--line-control: #6b707a; /* Border of unselected Checkbox / Radio / Switch. At least 3:1 on every surface (non-text AA) */
|
|
121
|
+
--frame: #0a0b0d; /* Outer frame, sidebar, page canvas */
|
|
122
|
+
--paper: #121316; /* Main content panel (base background) */
|
|
123
|
+
--raised: #17181c; /* Surface of cards, inputs and secondary buttons */
|
|
124
|
+
--overlay: #1d1e23; /* Popovers, dialogs, menus */
|
|
125
|
+
--wash: #1b1c20; /* Light surface for hover and zebra rows */
|
|
126
|
+
--scrim: rgba(0, 0, 0, 0.72); /* Modal scrim. No blur */
|
|
127
|
+
--shadow-color: rgba(0, 0, 0, 0.7); /* Shadow color. Referenced by shadow-xs to shadow-2xl */
|
|
128
|
+
--action-ink: #98a2f5; /* Indigo used as text or a link */
|
|
129
129
|
--state-success: #4cc38a;
|
|
130
130
|
--state-error: #f2707f;
|
|
131
131
|
--state-warning: #e0a53a;
|
|
132
|
-
--destructive-solid: #cf3345; /*
|
|
133
|
-
--chart-1: #7c86e8; /*
|
|
132
|
+
--destructive-solid: #cf3345; /* Fill (solid) of a destructive action. Text on it is destructive-solid-foreground (white). state-error is for text: it is bright on dark surfaces and not suited to a fill */
|
|
133
|
+
--chart-1: #7c86e8; /* Charts use color. Five colors that stay readable in dark */
|
|
134
134
|
--chart-2: #4cc38a;
|
|
135
135
|
--chart-3: #e5a23f;
|
|
136
136
|
--chart-4: #f2707f;
|
|
@@ -138,27 +138,27 @@
|
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
.theme-light {
|
|
141
|
-
--ink-1000: #0f1012; /*
|
|
142
|
-
--ink-900: #1b1c20; /*
|
|
143
|
-
--ink-700: #40434a; /*
|
|
144
|
-
--ink-500: #676b74; /*
|
|
145
|
-
--ink-300: #a3a6ad; /*
|
|
146
|
-
--line: #e6e7eb; /* 1px
|
|
147
|
-
--line-strong: #d5d7dd; /*
|
|
148
|
-
--line-control: #80858f; /*
|
|
149
|
-
--frame: #f4f5f7; /*
|
|
150
|
-
--paper: #ffffff; /*
|
|
151
|
-
--raised: #ffffff; /*
|
|
152
|
-
--overlay: #ffffff; /*
|
|
153
|
-
--wash: #f1f2f4; /* hover
|
|
154
|
-
--scrim: rgba(0, 0, 0, 0.32); /*
|
|
155
|
-
--shadow-color: rgba(16, 24, 40, 0.1); /*
|
|
156
|
-
--action-ink: #4a55c0; /*
|
|
141
|
+
--ink-1000: #0f1012; /* Strongest text */
|
|
142
|
+
--ink-900: #1b1c20; /* Headings and primary text */
|
|
143
|
+
--ink-700: #40434a; /* Body text (secondary) */
|
|
144
|
+
--ink-500: #676b74; /* Tertiary, muted, placeholder */
|
|
145
|
+
--ink-300: #a3a6ad; /* Disabled, faint labels */
|
|
146
|
+
--line: #e6e7eb; /* 1px hairline border and divider */
|
|
147
|
+
--line-strong: #d5d7dd; /* Border of text inputs and stronger borders (a known exception that does not reach 3:1; borders of interactive controls use line-control) */
|
|
148
|
+
--line-control: #80858f; /* Border of unselected Checkbox / Radio / Switch. At least 3:1 on every surface (non-text AA) */
|
|
149
|
+
--frame: #f4f5f7; /* Outer frame, sidebar, page canvas */
|
|
150
|
+
--paper: #ffffff; /* Main content panel (base background) */
|
|
151
|
+
--raised: #ffffff; /* Surface of cards, inputs and secondary buttons */
|
|
152
|
+
--overlay: #ffffff; /* Popovers, dialogs, menus */
|
|
153
|
+
--wash: #f1f2f4; /* Light surface for hover and zebra rows */
|
|
154
|
+
--scrim: rgba(0, 0, 0, 0.32); /* Modal scrim. No blur */
|
|
155
|
+
--shadow-color: rgba(16, 24, 40, 0.1); /* Shadow color. Referenced by shadow-xs to shadow-2xl */
|
|
156
|
+
--action-ink: #4a55c0; /* Indigo used as text or a link */
|
|
157
157
|
--state-success: #187548;
|
|
158
158
|
--state-error: #c42b3a;
|
|
159
159
|
--state-warning: #8f5f00;
|
|
160
|
-
--destructive-solid: #c42b3a; /*
|
|
161
|
-
--chart-1: #5e6ad2; /*
|
|
160
|
+
--destructive-solid: #c42b3a; /* Fill (solid) of a destructive action. Text on it is destructive-solid-foreground (white). state-error is for text: it is bright on dark surfaces and not suited to a fill */
|
|
161
|
+
--chart-1: #5e6ad2; /* Charts use color. Five colors that stay readable in dark */
|
|
162
162
|
--chart-2: #1f9d6a;
|
|
163
163
|
--chart-3: #bd7100;
|
|
164
164
|
--chart-4: #d6495c;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
//#region src/tokens/tokens.gen.d.ts
|
|
2
|
-
/**
|
|
2
|
+
/** Token names of love3 (the CSS variable names without the leading `--`). */
|
|
3
3
|
export declare const tokenNames: readonly ["ink-1000", "ink-900", "ink-700", "ink-500", "ink-300", "line", "line-strong", "line-control", "frame", "paper", "raised", "overlay", "wash", "scrim", "shadow-color", "action", "action-hover", "action-foreground", "action-ink", "lt-three", "lt-three-foreground", "state-success", "state-error", "state-warning", "destructive-solid", "destructive-solid-foreground", "font-geist", "font-geist-mono", "font-jp", "font-mono", "background", "foreground", "card", "card-foreground", "popover", "popover-foreground", "primary", "primary-foreground", "secondary", "secondary-foreground", "muted", "muted-foreground", "accent", "accent-foreground", "destructive", "destructive-foreground", "border", "input", "ring", "chart-1", "chart-2", "chart-3", "chart-4", "chart-5", "section", "radius", "sidebar", "sidebar-foreground", "sidebar-primary", "sidebar-primary-foreground", "sidebar-accent", "sidebar-accent-foreground", "sidebar-border", "sidebar-ring"];
|
|
4
4
|
export type TokenName = (typeof tokenNames)[number];
|
|
5
5
|
export type TokenValues = Readonly<Record<TokenName, string>>;
|
|
6
|
-
/** `var()`
|
|
6
|
+
/** Values with `var()` resolved. For dark, every token with the dark overrides layered on. */
|
|
7
7
|
export declare const tokens: {
|
|
8
8
|
readonly light: {
|
|
9
9
|
readonly "ink-1000": "#0f1012";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/tokens/tokens.gen.ts
|
|
2
|
-
/**
|
|
2
|
+
/** Token names of love3 (the CSS variable names without the leading `--`). */
|
|
3
3
|
const tokenNames = [
|
|
4
4
|
"ink-1000",
|
|
5
5
|
"ink-900",
|
|
@@ -66,7 +66,7 @@ const tokenNames = [
|
|
|
66
66
|
"sidebar-border",
|
|
67
67
|
"sidebar-ring"
|
|
68
68
|
];
|
|
69
|
-
/** `var()`
|
|
69
|
+
/** Values with `var()` resolved. For dark, every token with the dark overrides layered on. */
|
|
70
70
|
const tokens = {
|
|
71
71
|
light: {
|
|
72
72
|
"ink-1000": "#0f1012",
|
package/dist/tuning/catalog.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { ColorToken, Mode, TuningCatalog } from "./types.js";
|
|
2
2
|
//#region src/tuning/catalog.d.ts
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Builds what can be tuned from the definition.
|
|
5
5
|
*
|
|
6
|
-
* -
|
|
7
|
-
* -
|
|
8
|
-
* `tokens`
|
|
9
|
-
* -
|
|
6
|
+
* - Color tokens: those whose value is a color literal (`#…`, `rgba(…)`). Split into ramp, primary action, brand, state, and chart by name prefix
|
|
7
|
+
* - Default references of semantic tokens: read from **`:root` in the generated CSS** (`--background: var(--paper)`).
|
|
8
|
+
* `tokens` holds actual values with `var()` resolved, so the targets are not preserved. The CSS holds the values that actually run, so it is the source of truth here
|
|
9
|
+
* - Body size: `--text-body` / `--text-body--line-height` in the CSS `@theme`
|
|
10
10
|
*
|
|
11
|
-
*
|
|
11
|
+
* Throws if it cannot be read (so a change in the default shape that makes this reading stale is not silently missed).
|
|
12
12
|
*/
|
|
13
13
|
export declare function buildCatalog({ tokens, tokenNames, css }: {
|
|
14
14
|
tokens: Readonly<Record<Mode, Readonly<Record<string, string>>>>;
|
|
@@ -17,8 +17,8 @@ export declare function buildCatalog({ tokens, tokenNames, css }: {
|
|
|
17
17
|
}): TuningCatalog;
|
|
18
18
|
export declare function findColor(catalog: TuningCatalog, name: string): ColorToken | undefined;
|
|
19
19
|
/**
|
|
20
|
-
* `buildCatalog`
|
|
21
|
-
*
|
|
20
|
+
* Runs `buildCatalog` and returns instead of throwing on failure. When the generated CSS changes shape and the reading goes stale, **only tuning is disabled** and the rest of the screens keep working
|
|
21
|
+
* (the reason is in `error`. An empty catalog is returned, so tuning has no effect). The caller shows and records `error`.
|
|
22
22
|
*/
|
|
23
23
|
export declare function buildCatalogSafe(input: Parameters<typeof buildCatalog>[0]): {
|
|
24
24
|
catalog: TuningCatalog;
|
package/dist/tuning/catalog.js
CHANGED
|
@@ -24,7 +24,7 @@ function groupOf(name) {
|
|
|
24
24
|
if (name.startsWith("chart-")) return "chart";
|
|
25
25
|
return "ramp";
|
|
26
26
|
}
|
|
27
|
-
/**
|
|
27
|
+
/** Whether it is a translucent value (`rgba(…, 0.45)`, `#rrggbbaa`, and so on). Unreadable values are not treated as translucent. */
|
|
28
28
|
function hasAlpha(value) {
|
|
29
29
|
const text = value.trim();
|
|
30
30
|
if (/^#[0-9a-f]{8}$/i.test(text)) return Number.parseInt(text.slice(7), 16) < 255;
|
|
@@ -32,14 +32,14 @@ function hasAlpha(value) {
|
|
|
32
32
|
return alpha !== void 0 && Number(alpha) < 1;
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
|
-
*
|
|
35
|
+
* Builds what can be tuned from the definition.
|
|
36
36
|
*
|
|
37
|
-
* -
|
|
38
|
-
* -
|
|
39
|
-
* `tokens`
|
|
40
|
-
* -
|
|
37
|
+
* - Color tokens: those whose value is a color literal (`#…`, `rgba(…)`). Split into ramp, primary action, brand, state, and chart by name prefix
|
|
38
|
+
* - Default references of semantic tokens: read from **`:root` in the generated CSS** (`--background: var(--paper)`).
|
|
39
|
+
* `tokens` holds actual values with `var()` resolved, so the targets are not preserved. The CSS holds the values that actually run, so it is the source of truth here
|
|
40
|
+
* - Body size: `--text-body` / `--text-body--line-height` in the CSS `@theme`
|
|
41
41
|
*
|
|
42
|
-
*
|
|
42
|
+
* Throws if it cannot be read (so a change in the default shape that makes this reading stale is not silently missed).
|
|
43
43
|
*/
|
|
44
44
|
function buildCatalog({ tokens, tokenNames, css }) {
|
|
45
45
|
const root = /:root\s*\{([\s\S]*?)\n\}/.exec(css)?.[1];
|
|
@@ -94,8 +94,8 @@ function findColor(catalog, name) {
|
|
|
94
94
|
return catalog.colors.find((color) => color.name === name);
|
|
95
95
|
}
|
|
96
96
|
/**
|
|
97
|
-
* `buildCatalog`
|
|
98
|
-
*
|
|
97
|
+
* Runs `buildCatalog` and returns instead of throwing on failure. When the generated CSS changes shape and the reading goes stale, **only tuning is disabled** and the rest of the screens keep working
|
|
98
|
+
* (the reason is in `error`. An empty catalog is returned, so tuning has no effect). The caller shows and records `error`.
|
|
99
99
|
*/
|
|
100
100
|
function buildCatalogSafe(input) {
|
|
101
101
|
try {
|
package/dist/tuning/color.d.ts
CHANGED
|
@@ -7,12 +7,12 @@ export type ColorResult = {
|
|
|
7
7
|
reason: string;
|
|
8
8
|
};
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* Reads a color token input and turns it into the canonical form.
|
|
11
11
|
*
|
|
12
|
-
* -
|
|
13
|
-
* -
|
|
12
|
+
* - Opaque colors (the default): `#rgb` / `#rrggbb` becomes a lowercase `#rrggbb` (the same form as `<input type="color">`)
|
|
13
|
+
* - Colors that allow translucency (scrim; `alpha: true`): additionally `#rrggbbaa` and `rgb()` / `rgba()`, normalized to the `rgba(r, g, b, a)` form
|
|
14
14
|
*
|
|
15
|
-
*
|
|
15
|
+
* Unreadable values and out-of-range values (above 255, or an opacity outside 0 to 1) are rejected with a reason.
|
|
16
16
|
*/
|
|
17
17
|
export declare function parseTokenColor(input: string, options: {
|
|
18
18
|
alpha: boolean;
|
package/dist/tuning/color.js
CHANGED
|
@@ -4,12 +4,12 @@ const HEX3 = /^#([0-9a-f]{3})$/i;
|
|
|
4
4
|
const HEX8 = /^#([0-9a-f]{8})$/i;
|
|
5
5
|
const RGBA = /^rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d*\.?\d+)\s*)?\)$/i;
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* Reads a color token input and turns it into the canonical form.
|
|
8
8
|
*
|
|
9
|
-
* -
|
|
10
|
-
* -
|
|
9
|
+
* - Opaque colors (the default): `#rgb` / `#rrggbb` becomes a lowercase `#rrggbb` (the same form as `<input type="color">`)
|
|
10
|
+
* - Colors that allow translucency (scrim; `alpha: true`): additionally `#rrggbbaa` and `rgb()` / `rgba()`, normalized to the `rgba(r, g, b, a)` form
|
|
11
11
|
*
|
|
12
|
-
*
|
|
12
|
+
* Unreadable values and out-of-range values (above 255, or an opacity outside 0 to 1) are rejected with a reason.
|
|
13
13
|
*/
|
|
14
14
|
function parseTokenColor(input, options) {
|
|
15
15
|
const text = input.trim();
|
|
@@ -71,7 +71,7 @@ function toRgba(rgb, alpha255) {
|
|
|
71
71
|
const channel = (offset) => Number.parseInt(rgb.slice(offset, offset + 2), 16);
|
|
72
72
|
return `rgba(${channel(0)}, ${channel(2)}, ${channel(4)}, ${trimNumber(alpha255 / 255)})`;
|
|
73
73
|
}
|
|
74
|
-
/**
|
|
74
|
+
/** Rounds a decimal and drops trailing zeros (0.45 → `0.45`, 1 → `1`). */
|
|
75
75
|
function trimNumber(value) {
|
|
76
76
|
return String(Math.round(value * 100) / 100);
|
|
77
77
|
}
|
package/dist/tuning/css.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Tuning, TuningCatalog } from "./types.js";
|
|
2
2
|
//#region src/tuning/css.d.ts
|
|
3
|
-
/**
|
|
3
|
+
/** The shadow preset (Tailwind's default shadows). The love3 default is a soft shadow using `--shadow-color` (the `theme` in `definition.ts`). */
|
|
4
4
|
export declare const SHADOW_PRESET: {
|
|
5
5
|
readonly "2xs": "0 1px rgb(0 0 0 / 0.05)";
|
|
6
6
|
readonly xs: "0 1px 2px 0 rgb(0 0 0 / 0.05)";
|
|
@@ -11,25 +11,25 @@ export declare const SHADOW_PRESET: {
|
|
|
11
11
|
readonly "2xl": "0 25px 50px -12px rgb(0 0 0 / 0.25)";
|
|
12
12
|
};
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* **The CSS injected into `<style id="love3-tuning">` at runtime.** An empty string when everything is at the defaults (nothing is injected).
|
|
15
15
|
*
|
|
16
|
-
*
|
|
17
|
-
* -
|
|
18
|
-
*
|
|
19
|
-
* -
|
|
20
|
-
* -
|
|
21
|
-
*
|
|
16
|
+
* It has the same shape as the generated CSS of love3 (`:root` for light, `.dark` for dark), and is loaded later to override it.
|
|
17
|
+
* - For a changed color, **write both light and dark**. In the generated CSS `.dark` comes after `:root`, so if only light were overridden,
|
|
18
|
+
* the `:root` placed later would beat the generated `.dark` and flatten dark mode too. The effective value is also written to `.dark` to protect dark separately
|
|
19
|
+
* - Semantic references, radius, typeface, and body size go only in `:root` (the generated `.dark` redefines only color tokens)
|
|
20
|
+
* - The radius (`--radius-control` / `--radius-surface`) is a variable of Tailwind's `@theme`, but at runtime it takes effect as a `:root` variable.
|
|
21
|
+
* Tailwind folds shadows into classes (`.shadow-md { --tw-shadow: … }`), so `--tw-shadow` is overridden per class
|
|
22
22
|
*/
|
|
23
23
|
export declare function toRuntimeCss(tuning: Tuning, catalog: TuningCatalog): string;
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
26
|
-
* `@theme`
|
|
27
|
-
*
|
|
25
|
+
* **The CSS for copying.** The same format as `styles.gen.css`, with only the difference from the defaults (`:root` / `.dark` / `@theme`).
|
|
26
|
+
* `@theme` holds Tailwind build-time variables (radius, shadow, body size), which `styles.gen.css` emits from the `theme` in `definition.ts`.
|
|
27
|
+
* It is separate from the CSS applied at runtime (`toRuntimeCss`; that one cannot use `@theme`).
|
|
28
28
|
*/
|
|
29
29
|
export declare function toExportCss(tuning: Tuning, catalog: TuningCatalog): string;
|
|
30
30
|
/**
|
|
31
|
-
*
|
|
32
|
-
*
|
|
31
|
+
* **The diff to bring into `definition.ts`.** In the shape of the SSOT token lines (`{ name, value, dark }`) and the `theme` lines,
|
|
32
|
+
* it outputs only the changed items. Names stay the same and only values are swapped (how to edit tokens). Run `bun run generate` after bringing it in.
|
|
33
33
|
*/
|
|
34
34
|
export declare function toDefinitionDiff(tuning: Tuning, catalog: TuningCatalog): string;
|
|
35
35
|
//#endregion
|
package/dist/tuning/css.js
CHANGED
|
@@ -2,7 +2,7 @@ import { FONT_KEYS, FONT_TOKEN, RADIUS_ROLES } from "./types.js";
|
|
|
2
2
|
import { bodyLineHeight, colorValue, normalize } from "./model.js";
|
|
3
3
|
|
|
4
4
|
//#region src/tuning/css.ts
|
|
5
|
-
/**
|
|
5
|
+
/** The shadow preset (Tailwind's default shadows). The love3 default is a soft shadow using `--shadow-color` (the `theme` in `definition.ts`). */
|
|
6
6
|
const SHADOW_PRESET = {
|
|
7
7
|
"2xs": "0 1px rgb(0 0 0 / 0.05)",
|
|
8
8
|
xs: "0 1px 2px 0 rgb(0 0 0 / 0.05)",
|
|
@@ -12,7 +12,7 @@ const SHADOW_PRESET = {
|
|
|
12
12
|
xl: "0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)",
|
|
13
13
|
"2xl": "0 25px 50px -12px rgb(0 0 0 / 0.25)"
|
|
14
14
|
};
|
|
15
|
-
/**
|
|
15
|
+
/** The preset that removes shadows (the same steps as `SHADOW_PRESET`). */
|
|
16
16
|
const SHADOW_NONE = {
|
|
17
17
|
"2xs": "none",
|
|
18
18
|
xs: "none",
|
|
@@ -22,12 +22,12 @@ const SHADOW_NONE = {
|
|
|
22
22
|
xl: "none",
|
|
23
23
|
"2xl": "none"
|
|
24
24
|
};
|
|
25
|
-
/**
|
|
25
|
+
/** The shadow values a tuning swaps in. The default (`default`) is not swapped. */
|
|
26
26
|
function shadowValues(n) {
|
|
27
27
|
if (n.shadow === "default") return [];
|
|
28
28
|
return Object.entries(n.shadow === "none" ? SHADOW_NONE : SHADOW_PRESET);
|
|
29
29
|
}
|
|
30
|
-
/**
|
|
30
|
+
/** The names of the color tokens that were changed (in either light or dark), in definition order. */
|
|
31
31
|
function touchedColors(n, catalog) {
|
|
32
32
|
return catalog.colors.map((color) => color.name).filter((name) => n.tokens.light[name] !== void 0 || n.tokens.dark[name] !== void 0);
|
|
33
33
|
}
|
|
@@ -37,7 +37,7 @@ function decl(name, value) {
|
|
|
37
37
|
function block(selector, lines) {
|
|
38
38
|
return lines.length === 0 ? "" : `${selector} {\n${lines.join("\n")}\n}`;
|
|
39
39
|
}
|
|
40
|
-
/**
|
|
40
|
+
/** The roles that differ from the defaults (already `normalize`d, so what remains in `radius` is the difference). */
|
|
41
41
|
function radiusRoles(n) {
|
|
42
42
|
return RADIUS_ROLES.flatMap((role) => {
|
|
43
43
|
const px = n.radius[role];
|
|
@@ -45,14 +45,14 @@ function radiusRoles(n) {
|
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
47
|
/**
|
|
48
|
-
*
|
|
48
|
+
* **The CSS injected into `<style id="love3-tuning">` at runtime.** An empty string when everything is at the defaults (nothing is injected).
|
|
49
49
|
*
|
|
50
|
-
*
|
|
51
|
-
* -
|
|
52
|
-
*
|
|
53
|
-
* -
|
|
54
|
-
* -
|
|
55
|
-
*
|
|
50
|
+
* It has the same shape as the generated CSS of love3 (`:root` for light, `.dark` for dark), and is loaded later to override it.
|
|
51
|
+
* - For a changed color, **write both light and dark**. In the generated CSS `.dark` comes after `:root`, so if only light were overridden,
|
|
52
|
+
* the `:root` placed later would beat the generated `.dark` and flatten dark mode too. The effective value is also written to `.dark` to protect dark separately
|
|
53
|
+
* - Semantic references, radius, typeface, and body size go only in `:root` (the generated `.dark` redefines only color tokens)
|
|
54
|
+
* - The radius (`--radius-control` / `--radius-surface`) is a variable of Tailwind's `@theme`, but at runtime it takes effect as a `:root` variable.
|
|
55
|
+
* Tailwind folds shadows into classes (`.shadow-md { --tw-shadow: … }`), so `--tw-shadow` is overridden per class
|
|
56
56
|
*/
|
|
57
57
|
function toRuntimeCss(tuning, catalog) {
|
|
58
58
|
const n = normalize(tuning, catalog);
|
|
@@ -78,9 +78,9 @@ function toRuntimeCss(tuning, catalog) {
|
|
|
78
78
|
return parts.filter((part) => part !== "").join("\n");
|
|
79
79
|
}
|
|
80
80
|
/**
|
|
81
|
-
*
|
|
82
|
-
* `@theme`
|
|
83
|
-
*
|
|
81
|
+
* **The CSS for copying.** The same format as `styles.gen.css`, with only the difference from the defaults (`:root` / `.dark` / `@theme`).
|
|
82
|
+
* `@theme` holds Tailwind build-time variables (radius, shadow, body size), which `styles.gen.css` emits from the `theme` in `definition.ts`.
|
|
83
|
+
* It is separate from the CSS applied at runtime (`toRuntimeCss`; that one cannot use `@theme`).
|
|
84
84
|
*/
|
|
85
85
|
function toExportCss(tuning, catalog) {
|
|
86
86
|
const n = normalize(tuning, catalog);
|
|
@@ -110,8 +110,8 @@ function toExportCss(tuning, catalog) {
|
|
|
110
110
|
].filter((part) => part !== "").join("\n\n");
|
|
111
111
|
}
|
|
112
112
|
/**
|
|
113
|
-
*
|
|
114
|
-
*
|
|
113
|
+
* **The diff to bring into `definition.ts`.** In the shape of the SSOT token lines (`{ name, value, dark }`) and the `theme` lines,
|
|
114
|
+
* it outputs only the changed items. Names stay the same and only values are swapped (how to edit tokens). Run `bun run generate` after bringing it in.
|
|
115
115
|
*/
|
|
116
116
|
function toDefinitionDiff(tuning, catalog) {
|
|
117
117
|
const n = normalize(tuning, catalog);
|
package/dist/tuning/model.d.ts
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
import { FontKey, Mode, RadiusRole, ShadowPreset, Tuning, TuningCatalog } from "./types.js";
|
|
2
2
|
//#region src/tuning/model.d.ts
|
|
3
|
-
/**
|
|
3
|
+
/** The mode that actually holds a color token. Brand colors are common to both, so a dark specification is folded into `light`. */
|
|
4
4
|
export declare function modeOf(catalog: TuningCatalog, name: string, mode: Mode): Mode;
|
|
5
|
-
/**
|
|
5
|
+
/** The default font value. */
|
|
6
6
|
export declare function defaultFont(catalog: TuningCatalog, key: FontKey): string;
|
|
7
|
-
/**
|
|
7
|
+
/** The radius (px) per role. Falls back to the default (control 6, surface 10) when unspecified. */
|
|
8
8
|
export declare function radiusPx(tuning: Tuning, catalog: TuningCatalog, role: RadiusRole): number;
|
|
9
|
-
/**
|
|
9
|
+
/** The body line height (px). Proportional to the size (the ratio of the default 14px / 22px). */
|
|
10
10
|
export declare function bodyLineHeight(catalog: TuningCatalog, size: number): number;
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
12
|
+
* Drops items equal to the defaults so that the same content has a single form (run before saving, exporting, and comparing).
|
|
13
|
+
* Colors are aligned to the canonical form (lowercase `#rrggbb`). Unreadable colors are kept as they are (validation is the job of `parseTuning`).
|
|
14
14
|
*/
|
|
15
15
|
export declare function normalize(tuning: Tuning, catalog: TuningCatalog): Tuning;
|
|
16
|
-
/**
|
|
16
|
+
/** Whether it equals the defaults (has no difference). */
|
|
17
17
|
export declare function isEmpty(tuning: Tuning, catalog: TuningCatalog): boolean;
|
|
18
|
-
/**
|
|
18
|
+
/** The number of differences from the defaults (1 per item of color, reference, radius, typeface, and shadow). */
|
|
19
19
|
export declare function countChanges(tuning: Tuning, catalog: TuningCatalog): number;
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
22
|
-
*
|
|
21
|
+
* The actual value of a token. **It follows references (`var()`)**: a semantic token takes the actual value of its target (the override if there is one, the default otherwise).
|
|
22
|
+
* If you tune the ramp it refers to, the semantic tokens pointing at it change too (resolved the same way as the runtime CSS).
|
|
23
23
|
*/
|
|
24
24
|
export declare function colorValue(tuning: Tuning, catalog: TuningCatalog, mode: Mode, name: string): string;
|
|
25
|
-
/**
|
|
25
|
+
/** A table of the actual values of all tokens (color, typeface, tuned radius). The values after the tuning is applied, in the same shape as `tokens`. */
|
|
26
26
|
export declare function effectiveTokens(tuning: Tuning, catalog: TuningCatalog): Record<Mode, Record<string, string>>;
|
|
27
27
|
export declare function withColor(tuning: Tuning, catalog: TuningCatalog, mode: Mode, name: string, value: string | undefined): Tuning;
|
|
28
28
|
export declare function withSemantic(tuning: Tuning, name: string, ref: string | undefined): Tuning;
|