@lt-three/love3 0.0.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 +85 -1
- package/dist/native/analytics/animation.d.ts +4 -0
- package/dist/native/analytics/animation.js +6 -0
- package/dist/native/analytics/chart.types.d.ts +25 -0
- package/dist/native/analytics/chart.types.js +0 -0
- package/dist/native/analytics/line-chart.d.ts +4 -0
- package/dist/native/analytics/line-chart.ios.d.ts +4 -0
- package/dist/native/analytics/line-chart.ios.js +24 -0
- package/dist/native/analytics/line-chart.js +33 -0
- package/dist/native/analytics/metric-card.d.ts +10 -0
- package/dist/native/analytics/metric-card.js +29 -0
- package/dist/native/analytics/multi-line-chart.d.ts +18 -0
- package/dist/native/analytics/multi-line-chart.js +216 -0
- package/dist/native/analytics/pie-chart.d.ts +15 -0
- package/dist/native/analytics/pie-chart.ios.d.ts +4 -0
- package/dist/native/analytics/pie-chart.ios.js +24 -0
- package/dist/native/analytics/pie-chart.js +92 -0
- package/dist/native/analytics/single-number.d.ts +19 -0
- package/dist/native/analytics/single-number.js +101 -0
- package/dist/native/atom/avatar.d.ts +21 -0
- package/dist/native/atom/avatar.js +46 -0
- package/dist/native/atom/badge.d.ts +28 -0
- package/dist/native/atom/badge.js +51 -0
- package/dist/native/atom/button.d.ts +46 -0
- package/dist/native/atom/button.js +109 -0
- package/dist/native/atom/checkbox.d.ts +21 -0
- package/dist/native/atom/checkbox.js +47 -0
- package/dist/native/atom/colored-value.d.ts +12 -0
- package/dist/native/atom/colored-value.js +24 -0
- package/dist/native/atom/image.d.ts +21 -0
- package/dist/native/atom/image.js +72 -0
- package/dist/native/atom/label.d.ts +18 -0
- package/dist/native/atom/label.js +33 -0
- package/dist/native/atom/link.d.ts +18 -0
- package/dist/native/atom/link.js +25 -0
- package/dist/native/atom/readout.d.ts +22 -0
- package/dist/native/atom/readout.js +39 -0
- package/dist/native/atom/search-input.d.ts +12 -0
- package/dist/native/atom/search-input.js +36 -0
- package/dist/native/atom/select.d.ts +54 -0
- package/dist/native/atom/select.js +200 -0
- package/dist/native/atom/separator.d.ts +12 -0
- package/dist/native/atom/separator.js +16 -0
- package/dist/native/atom/skeleton.d.ts +12 -0
- package/dist/native/atom/skeleton.js +39 -0
- package/dist/native/atom/slider.d.ts +32 -0
- package/dist/native/atom/slider.js +75 -0
- package/dist/native/atom/spinner.d.ts +15 -0
- package/dist/native/atom/spinner.js +25 -0
- package/dist/native/atom/switch.d.ts +18 -0
- package/dist/native/atom/switch.js +52 -0
- package/dist/native/atom/symbol.d.ts +16 -0
- package/dist/native/atom/symbol.js +38 -0
- package/dist/native/atom/symbol.types.d.ts +25 -0
- package/dist/native/atom/symbol.types.js +49 -0
- package/dist/native/atom/text-field.d.ts +49 -0
- package/dist/native/atom/text-field.js +56 -0
- package/dist/native/atom/text.d.ts +2 -0
- package/dist/native/atom/text.js +3 -0
- package/dist/native/atom/theme-toggle.d.ts +21 -0
- package/dist/native/atom/theme-toggle.js +36 -0
- package/dist/native/atom/timezone-select.d.ts +16 -0
- package/dist/native/atom/timezone-select.js +28 -0
- package/dist/native/atom/typography.d.ts +13 -0
- package/dist/native/atom/typography.js +28 -0
- package/dist/native/base/button.d.ts +61 -0
- package/dist/native/base/button.js +92 -0
- package/dist/native/base/form.d.ts +72 -0
- package/dist/native/base/form.js +113 -0
- package/dist/native/base/glass-card.d.ts +15 -0
- package/dist/native/base/glass-card.js +38 -0
- package/dist/native/base/input.d.ts +29 -0
- package/dist/native/base/input.js +27 -0
- package/dist/native/base/sheet.d.ts +71 -0
- package/dist/native/base/sheet.js +187 -0
- package/dist/native/base/text.d.ts +14 -0
- package/dist/native/base/text.js +53 -0
- package/dist/native/form/checkbox.d.ts +13 -0
- package/dist/native/form/checkbox.js +55 -0
- package/dist/native/form/date-picker.d.ts +23 -0
- package/dist/native/form/date-picker.js +119 -0
- package/dist/native/form/form.d.ts +22 -0
- package/dist/native/form/form.js +44 -0
- package/dist/native/form/radio-group.d.ts +23 -0
- package/dist/native/form/radio-group.js +88 -0
- package/dist/native/form/select.d.ts +13 -0
- package/dist/native/form/select.js +45 -0
- package/dist/native/form/slider.d.ts +14 -0
- package/dist/native/form/slider.js +42 -0
- package/dist/native/form/switch.d.ts +9 -0
- package/dist/native/form/switch.js +59 -0
- package/dist/native/form/text-area.d.ts +11 -0
- package/dist/native/form/text-area.js +50 -0
- package/dist/native/form/text-input.d.ts +18 -0
- package/dist/native/form/text-input.js +90 -0
- package/dist/native/index.d.ts +1 -0
- package/dist/native/index.js +0 -0
- package/dist/native/layout/accordion.d.ts +25 -0
- package/dist/native/layout/accordion.js +54 -0
- package/dist/native/layout/card.d.ts +47 -0
- package/dist/native/layout/card.js +57 -0
- package/dist/native/layout/description.d.ts +16 -0
- package/dist/native/layout/description.js +32 -0
- package/dist/native/layout/error.d.ts +21 -0
- package/dist/native/layout/error.js +44 -0
- package/dist/native/layout/information.d.ts +25 -0
- package/dist/native/layout/information.js +35 -0
- package/dist/native/layout/locked.d.ts +38 -0
- package/dist/native/layout/locked.js +94 -0
- package/dist/native/layout/modal.d.ts +25 -0
- package/dist/native/layout/modal.js +93 -0
- package/dist/native/layout/not-found.d.ts +17 -0
- package/dist/native/layout/not-found.js +30 -0
- package/dist/native/layout/page-frame.d.ts +23 -0
- package/dist/native/layout/page-frame.js +46 -0
- package/dist/native/layout/panel.d.ts +18 -0
- package/dist/native/layout/panel.js +23 -0
- package/dist/native/layout/reorderable-list.d.ts +42 -0
- package/dist/native/layout/reorderable-list.js +52 -0
- package/dist/native/layout/sheet.d.ts +30 -0
- package/dist/native/layout/sheet.js +46 -0
- package/dist/native/layout/simple-dialog.d.ts +16 -0
- package/dist/native/layout/simple-dialog.js +20 -0
- package/dist/native/layout/simple-table.d.ts +50 -0
- package/dist/native/layout/simple-table.js +75 -0
- package/dist/native/layout/tab-bar.d.ts +33 -0
- package/dist/native/layout/tab-bar.js +48 -0
- package/dist/native/layout/tabs.d.ts +28 -0
- package/dist/native/layout/tabs.js +54 -0
- package/dist/native/layout/tuning-panel.d.ts +24 -0
- package/dist/native/layout/tuning-panel.js +246 -0
- package/dist/native/lib/autocomplete.d.ts +7 -0
- package/dist/native/lib/autocomplete.js +34 -0
- package/dist/native/lib/breakpoints.d.ts +14 -0
- package/dist/native/lib/breakpoints.js +17 -0
- package/dist/native/lib/chart-palette.d.ts +8 -0
- package/dist/native/lib/chart-palette.js +20 -0
- package/dist/native/lib/confirm.d.ts +48 -0
- package/dist/native/lib/confirm.js +69 -0
- package/dist/native/lib/control.d.ts +24 -0
- package/dist/native/lib/control.js +0 -0
- package/dist/native/lib/external-store.d.ts +16 -0
- package/dist/native/lib/external-store.js +30 -0
- package/dist/native/lib/keyboard.d.ts +15 -0
- package/dist/native/lib/keyboard.js +24 -0
- package/dist/native/lib/labels.d.ts +15 -0
- package/dist/native/lib/labels.js +17 -0
- package/dist/native/lib/loading.d.ts +10 -0
- package/dist/native/lib/loading.js +15 -0
- package/dist/native/lib/network.d.ts +11 -0
- package/dist/native/lib/network.js +20 -0
- package/dist/native/lib/scheme.d.ts +18 -0
- package/dist/native/lib/scheme.js +22 -0
- package/dist/native/lib/snackbar.d.ts +45 -0
- package/dist/native/lib/snackbar.js +59 -0
- package/dist/native/lib/theme.d.ts +34 -0
- package/dist/native/lib/theme.js +53 -0
- package/dist/native/lib/timezone.d.ts +26 -0
- package/dist/native/lib/timezone.js +95 -0
- package/dist/native/lib/token-color.d.ts +5 -0
- package/dist/native/lib/token-color.js +13 -0
- package/dist/native/lib/token-color.web.d.ts +4 -0
- package/dist/native/lib/token-color.web.js +7 -0
- package/dist/native/lib/tuning-context.d.ts +9 -0
- package/dist/native/lib/tuning-context.js +7 -0
- package/dist/native/lib/tuning.d.ts +24 -0
- package/dist/native/lib/tuning.js +42 -0
- package/dist/native/lib/typography.d.ts +10 -0
- package/dist/native/lib/typography.js +11 -0
- package/dist/native/lib/utils.d.ts +11 -0
- package/dist/native/lib/utils.js +21 -0
- package/dist/native/once/confirm.d.ts +7 -0
- package/dist/native/once/confirm.js +60 -0
- package/dist/native/once/error-boundary.d.ts +28 -0
- package/dist/native/once/error-boundary.js +55 -0
- package/dist/native/once/loading-lock.d.ts +8 -0
- package/dist/native/once/loading-lock.js +28 -0
- package/dist/native/once/offline-banner.d.ts +15 -0
- package/dist/native/once/offline-banner.js +35 -0
- package/dist/native/once/snackbar.d.ts +17 -0
- package/dist/native/once/snackbar.js +106 -0
- package/dist/native/styles.css +46 -0
- package/dist/shared/analytics.d.ts +71 -0
- package/dist/shared/analytics.js +0 -0
- package/dist/shared/button.d.ts +7 -0
- package/dist/shared/button.js +23 -0
- package/dist/shared/form.d.ts +45 -0
- package/dist/shared/form.js +46 -0
- package/dist/shared/index.d.ts +3 -0
- package/dist/shared/index.js +3 -0
- package/dist/tokens/contrast-pairs.d.ts +30 -0
- package/dist/tokens/contrast-pairs.js +404 -0
- package/dist/tokens/index.d.ts +6 -0
- package/dist/tokens/index.js +10 -0
- package/dist/tokens/styles.gen.css +250 -0
- package/dist/tokens/tokens.gen.d.ts +141 -0
- package/dist/tokens/tokens.gen.js +206 -0
- package/dist/tuning/catalog.d.ts +27 -0
- package/dist/tuning/catalog.gen.d.ts +4 -0
- package/dist/tuning/catalog.gen.js +397 -0
- package/dist/tuning/catalog.js +128 -0
- package/dist/tuning/color.d.ts +20 -0
- package/dist/tuning/color.js +80 -0
- package/dist/tuning/css.d.ts +35 -0
- package/dist/tuning/css.js +147 -0
- package/dist/tuning/index.d.ts +8 -0
- package/dist/tuning/index.js +9 -0
- package/dist/tuning/model.d.ts +33 -0
- package/dist/tuning/model.js +154 -0
- package/dist/tuning/native.d.ts +35 -0
- package/dist/tuning/native.js +80 -0
- package/dist/tuning/schema.d.ts +69 -0
- package/dist/tuning/schema.js +247 -0
- package/dist/tuning/types.d.ts +75 -0
- package/dist/tuning/types.js +39 -0
- package/dist/web/analytics/line-chart.d.ts +20 -0
- package/dist/web/analytics/line-chart.js +28 -0
- package/dist/web/analytics/metric-card.d.ts +18 -0
- package/dist/web/analytics/metric-card.js +40 -0
- package/dist/web/analytics/multi-line-chart.d.ts +39 -0
- package/dist/web/analytics/multi-line-chart.js +345 -0
- package/dist/web/atom/avatar.d.ts +11 -0
- package/dist/web/atom/avatar.js +24 -0
- package/dist/web/atom/badge.d.ts +2 -0
- package/dist/web/atom/badge.js +3 -0
- package/dist/web/atom/button.d.ts +23 -0
- package/dist/web/atom/button.js +35 -0
- package/dist/web/atom/checkbox.d.ts +19 -0
- package/dist/web/atom/checkbox.js +33 -0
- package/dist/web/atom/colored-value.d.ts +13 -0
- package/dist/web/atom/colored-value.js +24 -0
- package/dist/web/atom/help.d.ts +10 -0
- package/dist/web/atom/help.js +18 -0
- package/dist/web/atom/label.d.ts +2 -0
- package/dist/web/atom/label.js +3 -0
- package/dist/web/atom/segmented-control.d.ts +39 -0
- package/dist/web/atom/segmented-control.js +42 -0
- package/dist/web/atom/select.d.ts +43 -0
- package/dist/web/atom/select.js +93 -0
- package/dist/web/atom/separator.d.ts +2 -0
- package/dist/web/atom/separator.js +3 -0
- package/dist/web/atom/skeleton.d.ts +2 -0
- package/dist/web/atom/skeleton.js +3 -0
- package/dist/web/atom/slider.d.ts +33 -0
- package/dist/web/atom/slider.js +70 -0
- package/dist/web/atom/spinner.d.ts +8 -0
- package/dist/web/atom/spinner.js +14 -0
- package/dist/web/atom/switch.d.ts +11 -0
- package/dist/web/atom/switch.js +10 -0
- package/dist/web/atom/text-area.d.ts +23 -0
- package/dist/web/atom/text-area.js +27 -0
- package/dist/web/atom/text-field.d.ts +18 -0
- package/dist/web/atom/text-field.js +22 -0
- package/dist/web/atom/toggle-chip.d.ts +22 -0
- package/dist/web/atom/toggle-chip.js +28 -0
- package/dist/web/atom/tooltip.d.ts +23 -0
- package/dist/web/atom/tooltip.js +26 -0
- package/dist/web/atom/typography.d.ts +6 -0
- package/dist/web/atom/typography.js +23 -0
- package/dist/web/base/accordion.d.ts +9 -0
- package/dist/web/base/accordion.js +44 -0
- package/dist/web/base/alert.d.ts +11 -0
- package/dist/web/base/alert.js +37 -0
- package/dist/web/base/avatar.d.ts +8 -0
- package/dist/web/base/avatar.js +29 -0
- package/dist/web/base/badge.d.ts +12 -0
- package/dist/web/base/badge.js +26 -0
- package/dist/web/base/breadcrumb.d.ts +16 -0
- package/dist/web/base/breadcrumb.js +72 -0
- package/dist/web/base/button.d.ts +12 -0
- package/dist/web/base/button.js +47 -0
- package/dist/web/base/card.d.ts +19 -0
- package/dist/web/base/card.js +74 -0
- package/dist/web/base/checkbox.d.ts +6 -0
- package/dist/web/base/checkbox.js +21 -0
- package/dist/web/base/dialog.d.ts +20 -0
- package/dist/web/base/dialog.js +92 -0
- package/dist/web/base/dropdown-menu.d.ts +29 -0
- package/dist/web/base/dropdown-menu.js +125 -0
- package/dist/web/base/field.d.ts +27 -0
- package/dist/web/base/field.js +118 -0
- package/dist/web/base/form.d.ts +38 -0
- package/dist/web/base/form.js +110 -0
- package/dist/web/base/input.d.ts +9 -0
- package/dist/web/base/input.js +23 -0
- package/dist/web/base/label.d.ts +6 -0
- package/dist/web/base/label.js +15 -0
- package/dist/web/base/pagination.d.ts +34 -0
- package/dist/web/base/pagination.js +90 -0
- package/dist/web/base/popover.d.ts +11 -0
- package/dist/web/base/popover.js +37 -0
- package/dist/web/base/radio-group.d.ts +7 -0
- package/dist/web/base/radio-group.js +27 -0
- package/dist/web/base/scroll-area.d.ts +10 -0
- package/dist/web/base/scroll-area.js +41 -0
- package/dist/web/base/select.d.ts +17 -0
- package/dist/web/base/select.js +96 -0
- package/dist/web/base/separator.d.ts +6 -0
- package/dist/web/base/separator.js +17 -0
- package/dist/web/base/sheet.d.ts +19 -0
- package/dist/web/base/sheet.js +88 -0
- package/dist/web/base/skeleton.d.ts +5 -0
- package/dist/web/base/skeleton.js +14 -0
- package/dist/web/base/slider.d.ts +9 -0
- package/dist/web/base/slider.js +39 -0
- package/dist/web/base/sonner.d.ts +9 -0
- package/dist/web/base/sonner.js +25 -0
- package/dist/web/base/spinner.d.ts +5 -0
- package/dist/web/base/spinner.js +17 -0
- package/dist/web/base/switch.d.ts +6 -0
- package/dist/web/base/switch.js +19 -0
- package/dist/web/base/table.d.ts +14 -0
- package/dist/web/base/table.js +68 -0
- package/dist/web/base/tabs.d.ts +9 -0
- package/dist/web/base/tabs.js +36 -0
- package/dist/web/base/textarea.d.ts +9 -0
- package/dist/web/base/textarea.js +23 -0
- package/dist/web/base/tooltip.d.ts +9 -0
- package/dist/web/base/tooltip.js +36 -0
- package/dist/web/form/checkbox.d.ts +35 -0
- package/dist/web/form/checkbox.js +91 -0
- package/dist/web/form/radio-group.d.ts +24 -0
- package/dist/web/form/radio-group.js +75 -0
- package/dist/web/form/select.d.ts +16 -0
- package/dist/web/form/select.js +44 -0
- package/dist/web/form/slider.d.ts +19 -0
- package/dist/web/form/slider.js +51 -0
- package/dist/web/form/switch.d.ts +11 -0
- package/dist/web/form/switch.js +50 -0
- package/dist/web/form/text-area.d.ts +10 -0
- package/dist/web/form/text-area.js +31 -0
- package/dist/web/form/text-input.d.ts +10 -0
- package/dist/web/form/text-input.js +42 -0
- package/dist/web/index.d.ts +1 -0
- package/dist/web/index.js +0 -0
- package/dist/web/layout/accordion.d.ts +26 -0
- package/dist/web/layout/accordion.js +29 -0
- package/dist/web/layout/alert-modal.d.ts +41 -0
- package/dist/web/layout/alert-modal.js +71 -0
- package/dist/web/layout/card.d.ts +17 -0
- package/dist/web/layout/card.js +35 -0
- package/dist/web/layout/description.d.ts +12 -0
- package/dist/web/layout/description.js +20 -0
- package/dist/web/layout/information.d.ts +36 -0
- package/dist/web/layout/information.js +53 -0
- package/dist/web/layout/modal.d.ts +16 -0
- package/dist/web/layout/modal.js +37 -0
- package/dist/web/layout/page-frame.d.ts +37 -0
- package/dist/web/layout/page-frame.js +79 -0
- package/dist/web/layout/scroll-area.d.ts +10 -0
- package/dist/web/layout/scroll-area.js +13 -0
- package/dist/web/layout/sheet.d.ts +32 -0
- package/dist/web/layout/sheet.js +68 -0
- package/dist/web/layout/simple-dialog.d.ts +11 -0
- package/dist/web/layout/simple-dialog.js +24 -0
- package/dist/web/layout/simple-table.d.ts +49 -0
- package/dist/web/layout/simple-table.js +58 -0
- package/dist/web/layout/tabs.d.ts +26 -0
- package/dist/web/layout/tabs.js +42 -0
- package/dist/web/layout/titled-modal.d.ts +32 -0
- package/dist/web/layout/titled-modal.js +58 -0
- package/dist/web/lib/css-vars.d.ts +14 -0
- package/dist/web/lib/css-vars.js +18 -0
- package/dist/web/lib/dialog.d.ts +13 -0
- package/dist/web/lib/dialog.js +0 -0
- package/dist/web/lib/form.d.ts +2 -0
- package/dist/web/lib/form.js +3 -0
- package/dist/web/lib/labels.d.ts +27 -0
- package/dist/web/lib/labels.js +29 -0
- package/dist/web/lib/modal-open-focus.d.ts +17 -0
- package/dist/web/lib/modal-open-focus.js +44 -0
- package/dist/web/lib/restore-focus.d.ts +12 -0
- package/dist/web/lib/restore-focus.js +32 -0
- package/dist/web/lib/utils.d.ts +4 -0
- package/dist/web/lib/utils.js +10 -0
- package/dist/web/styles.css +162 -0
- package/package.json +203 -4
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
//#region src/tuning/catalog.gen.ts
|
|
2
|
+
const catalog = {
|
|
3
|
+
"defaults": {
|
|
4
|
+
"light": {
|
|
5
|
+
"ink-1000": "#0f1012",
|
|
6
|
+
"ink-900": "#1b1c20",
|
|
7
|
+
"ink-700": "#40434a",
|
|
8
|
+
"ink-500": "#676b74",
|
|
9
|
+
"ink-300": "#a3a6ad",
|
|
10
|
+
"line": "#e6e7eb",
|
|
11
|
+
"line-strong": "#d5d7dd",
|
|
12
|
+
"line-control": "#80858f",
|
|
13
|
+
"frame": "#f4f5f7",
|
|
14
|
+
"paper": "#ffffff",
|
|
15
|
+
"raised": "#ffffff",
|
|
16
|
+
"overlay": "#ffffff",
|
|
17
|
+
"wash": "#f1f2f4",
|
|
18
|
+
"scrim": "rgba(0, 0, 0, 0.32)",
|
|
19
|
+
"shadow-color": "rgba(16, 24, 40, 0.1)",
|
|
20
|
+
"action": "#5e6ad2",
|
|
21
|
+
"action-hover": "#5059c2",
|
|
22
|
+
"action-foreground": "#ffffff",
|
|
23
|
+
"action-ink": "#4a55c0",
|
|
24
|
+
"lt-three": "#ff5c76",
|
|
25
|
+
"lt-three-foreground": "#000000",
|
|
26
|
+
"state-success": "#187548",
|
|
27
|
+
"state-error": "#c42b3a",
|
|
28
|
+
"state-warning": "#8f5f00",
|
|
29
|
+
"destructive-solid": "#c42b3a",
|
|
30
|
+
"destructive-solid-foreground": "#ffffff",
|
|
31
|
+
"font-geist": "\"Geist Variable\", \"Geist\"",
|
|
32
|
+
"font-geist-mono": "\"Geist Mono Variable\", \"Geist Mono\", ui-monospace, monospace",
|
|
33
|
+
"font-jp": "\"Yu Gothic Medium\", \"游ゴシック Medium\", YuGothic, \"游ゴシック体\", \"游ゴシック\", \"Yu Gothic\", sans-serif",
|
|
34
|
+
"font-mono": "\"Geist Mono Variable\", \"Geist Mono\", ui-monospace, monospace",
|
|
35
|
+
"background": "#ffffff",
|
|
36
|
+
"foreground": "#1b1c20",
|
|
37
|
+
"card": "#ffffff",
|
|
38
|
+
"card-foreground": "#1b1c20",
|
|
39
|
+
"popover": "#ffffff",
|
|
40
|
+
"popover-foreground": "#1b1c20",
|
|
41
|
+
"primary": "#5e6ad2",
|
|
42
|
+
"primary-foreground": "#ffffff",
|
|
43
|
+
"secondary": "#f1f2f4",
|
|
44
|
+
"secondary-foreground": "#1b1c20",
|
|
45
|
+
"muted": "#f1f2f4",
|
|
46
|
+
"muted-foreground": "#676b74",
|
|
47
|
+
"accent": "#f1f2f4",
|
|
48
|
+
"accent-foreground": "#1b1c20",
|
|
49
|
+
"destructive": "#c42b3a",
|
|
50
|
+
"destructive-foreground": "#ffffff",
|
|
51
|
+
"border": "#e6e7eb",
|
|
52
|
+
"input": "#d5d7dd",
|
|
53
|
+
"ring": "#5e6ad2",
|
|
54
|
+
"chart-1": "#5e6ad2",
|
|
55
|
+
"chart-2": "#1f9d6a",
|
|
56
|
+
"chart-3": "#bd7100",
|
|
57
|
+
"chart-4": "#d6495c",
|
|
58
|
+
"chart-5": "#7a8194",
|
|
59
|
+
"section": "#f4f5f7",
|
|
60
|
+
"radius": "6px",
|
|
61
|
+
"sidebar": "#f4f5f7",
|
|
62
|
+
"sidebar-foreground": "#1b1c20",
|
|
63
|
+
"sidebar-primary": "#5e6ad2",
|
|
64
|
+
"sidebar-primary-foreground": "#ffffff",
|
|
65
|
+
"sidebar-accent": "#f1f2f4",
|
|
66
|
+
"sidebar-accent-foreground": "#1b1c20",
|
|
67
|
+
"sidebar-border": "#e6e7eb",
|
|
68
|
+
"sidebar-ring": "#5e6ad2"
|
|
69
|
+
},
|
|
70
|
+
"dark": {
|
|
71
|
+
"ink-1000": "#f7f8f8",
|
|
72
|
+
"ink-900": "#eceef0",
|
|
73
|
+
"ink-700": "#cfd3da",
|
|
74
|
+
"ink-500": "#8a8f98",
|
|
75
|
+
"ink-300": "#5b5f67",
|
|
76
|
+
"line": "#25272c",
|
|
77
|
+
"line-strong": "#34363d",
|
|
78
|
+
"line-control": "#6b707a",
|
|
79
|
+
"frame": "#0a0b0d",
|
|
80
|
+
"paper": "#121316",
|
|
81
|
+
"raised": "#17181c",
|
|
82
|
+
"overlay": "#1d1e23",
|
|
83
|
+
"wash": "#1b1c20",
|
|
84
|
+
"scrim": "rgba(0, 0, 0, 0.72)",
|
|
85
|
+
"shadow-color": "rgba(0, 0, 0, 0.7)",
|
|
86
|
+
"action": "#5e6ad2",
|
|
87
|
+
"action-hover": "#5059c2",
|
|
88
|
+
"action-foreground": "#ffffff",
|
|
89
|
+
"action-ink": "#98a2f5",
|
|
90
|
+
"lt-three": "#ff5c76",
|
|
91
|
+
"lt-three-foreground": "#000000",
|
|
92
|
+
"state-success": "#4cc38a",
|
|
93
|
+
"state-error": "#f2707f",
|
|
94
|
+
"state-warning": "#e0a53a",
|
|
95
|
+
"destructive-solid": "#cf3345",
|
|
96
|
+
"destructive-solid-foreground": "#ffffff",
|
|
97
|
+
"font-geist": "\"Geist Variable\", \"Geist\"",
|
|
98
|
+
"font-geist-mono": "\"Geist Mono Variable\", \"Geist Mono\", ui-monospace, monospace",
|
|
99
|
+
"font-jp": "\"Yu Gothic Medium\", \"游ゴシック Medium\", YuGothic, \"游ゴシック体\", \"游ゴシック\", \"Yu Gothic\", sans-serif",
|
|
100
|
+
"font-mono": "\"Geist Mono Variable\", \"Geist Mono\", ui-monospace, monospace",
|
|
101
|
+
"background": "#121316",
|
|
102
|
+
"foreground": "#eceef0",
|
|
103
|
+
"card": "#17181c",
|
|
104
|
+
"card-foreground": "#eceef0",
|
|
105
|
+
"popover": "#1d1e23",
|
|
106
|
+
"popover-foreground": "#eceef0",
|
|
107
|
+
"primary": "#5e6ad2",
|
|
108
|
+
"primary-foreground": "#ffffff",
|
|
109
|
+
"secondary": "#1b1c20",
|
|
110
|
+
"secondary-foreground": "#eceef0",
|
|
111
|
+
"muted": "#1b1c20",
|
|
112
|
+
"muted-foreground": "#8a8f98",
|
|
113
|
+
"accent": "#1b1c20",
|
|
114
|
+
"accent-foreground": "#eceef0",
|
|
115
|
+
"destructive": "#f2707f",
|
|
116
|
+
"destructive-foreground": "#121316",
|
|
117
|
+
"border": "#25272c",
|
|
118
|
+
"input": "#34363d",
|
|
119
|
+
"ring": "#5e6ad2",
|
|
120
|
+
"chart-1": "#7c86e8",
|
|
121
|
+
"chart-2": "#4cc38a",
|
|
122
|
+
"chart-3": "#e5a23f",
|
|
123
|
+
"chart-4": "#f2707f",
|
|
124
|
+
"chart-5": "#9aa1b3",
|
|
125
|
+
"section": "#0a0b0d",
|
|
126
|
+
"radius": "6px",
|
|
127
|
+
"sidebar": "#0a0b0d",
|
|
128
|
+
"sidebar-foreground": "#eceef0",
|
|
129
|
+
"sidebar-primary": "#5e6ad2",
|
|
130
|
+
"sidebar-primary-foreground": "#ffffff",
|
|
131
|
+
"sidebar-accent": "#1b1c20",
|
|
132
|
+
"sidebar-accent-foreground": "#eceef0",
|
|
133
|
+
"sidebar-border": "#25272c",
|
|
134
|
+
"sidebar-ring": "#5e6ad2"
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
"colors": [
|
|
138
|
+
{
|
|
139
|
+
"name": "ink-1000",
|
|
140
|
+
"group": "ramp",
|
|
141
|
+
"hasDark": true,
|
|
142
|
+
"alpha": false
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
"name": "ink-900",
|
|
146
|
+
"group": "ramp",
|
|
147
|
+
"hasDark": true,
|
|
148
|
+
"alpha": false
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
"name": "ink-700",
|
|
152
|
+
"group": "ramp",
|
|
153
|
+
"hasDark": true,
|
|
154
|
+
"alpha": false
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
"name": "ink-500",
|
|
158
|
+
"group": "ramp",
|
|
159
|
+
"hasDark": true,
|
|
160
|
+
"alpha": false
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
"name": "ink-300",
|
|
164
|
+
"group": "ramp",
|
|
165
|
+
"hasDark": true,
|
|
166
|
+
"alpha": false
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
"name": "line",
|
|
170
|
+
"group": "ramp",
|
|
171
|
+
"hasDark": true,
|
|
172
|
+
"alpha": false
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
"name": "line-strong",
|
|
176
|
+
"group": "ramp",
|
|
177
|
+
"hasDark": true,
|
|
178
|
+
"alpha": false
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
"name": "line-control",
|
|
182
|
+
"group": "ramp",
|
|
183
|
+
"hasDark": true,
|
|
184
|
+
"alpha": false
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
"name": "frame",
|
|
188
|
+
"group": "ramp",
|
|
189
|
+
"hasDark": true,
|
|
190
|
+
"alpha": false
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
"name": "paper",
|
|
194
|
+
"group": "ramp",
|
|
195
|
+
"hasDark": true,
|
|
196
|
+
"alpha": false
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
"name": "raised",
|
|
200
|
+
"group": "ramp",
|
|
201
|
+
"hasDark": true,
|
|
202
|
+
"alpha": false
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
"name": "overlay",
|
|
206
|
+
"group": "ramp",
|
|
207
|
+
"hasDark": true,
|
|
208
|
+
"alpha": false
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
"name": "wash",
|
|
212
|
+
"group": "ramp",
|
|
213
|
+
"hasDark": true,
|
|
214
|
+
"alpha": false
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
"name": "scrim",
|
|
218
|
+
"group": "ramp",
|
|
219
|
+
"hasDark": true,
|
|
220
|
+
"alpha": true
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
"name": "shadow-color",
|
|
224
|
+
"group": "ramp",
|
|
225
|
+
"hasDark": true,
|
|
226
|
+
"alpha": true
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
"name": "action",
|
|
230
|
+
"group": "action",
|
|
231
|
+
"hasDark": true,
|
|
232
|
+
"alpha": false
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
"name": "action-hover",
|
|
236
|
+
"group": "action",
|
|
237
|
+
"hasDark": true,
|
|
238
|
+
"alpha": false
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
"name": "action-foreground",
|
|
242
|
+
"group": "action",
|
|
243
|
+
"hasDark": true,
|
|
244
|
+
"alpha": false
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
"name": "action-ink",
|
|
248
|
+
"group": "action",
|
|
249
|
+
"hasDark": true,
|
|
250
|
+
"alpha": false
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
"name": "lt-three",
|
|
254
|
+
"group": "brand",
|
|
255
|
+
"hasDark": false,
|
|
256
|
+
"alpha": false
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
"name": "lt-three-foreground",
|
|
260
|
+
"group": "brand",
|
|
261
|
+
"hasDark": false,
|
|
262
|
+
"alpha": false
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
"name": "state-success",
|
|
266
|
+
"group": "state",
|
|
267
|
+
"hasDark": true,
|
|
268
|
+
"alpha": false
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
"name": "state-error",
|
|
272
|
+
"group": "state",
|
|
273
|
+
"hasDark": true,
|
|
274
|
+
"alpha": false
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
"name": "state-warning",
|
|
278
|
+
"group": "state",
|
|
279
|
+
"hasDark": true,
|
|
280
|
+
"alpha": false
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
"name": "destructive-solid",
|
|
284
|
+
"group": "state",
|
|
285
|
+
"hasDark": true,
|
|
286
|
+
"alpha": false
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
"name": "destructive-solid-foreground",
|
|
290
|
+
"group": "state",
|
|
291
|
+
"hasDark": true,
|
|
292
|
+
"alpha": false
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
"name": "chart-1",
|
|
296
|
+
"group": "chart",
|
|
297
|
+
"hasDark": true,
|
|
298
|
+
"alpha": false
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
"name": "chart-2",
|
|
302
|
+
"group": "chart",
|
|
303
|
+
"hasDark": true,
|
|
304
|
+
"alpha": false
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
"name": "chart-3",
|
|
308
|
+
"group": "chart",
|
|
309
|
+
"hasDark": true,
|
|
310
|
+
"alpha": false
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
"name": "chart-4",
|
|
314
|
+
"group": "chart",
|
|
315
|
+
"hasDark": true,
|
|
316
|
+
"alpha": false
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
"name": "chart-5",
|
|
320
|
+
"group": "chart",
|
|
321
|
+
"hasDark": true,
|
|
322
|
+
"alpha": false
|
|
323
|
+
}
|
|
324
|
+
],
|
|
325
|
+
"semantic": {
|
|
326
|
+
"background": "paper",
|
|
327
|
+
"foreground": "ink-900",
|
|
328
|
+
"card": "raised",
|
|
329
|
+
"card-foreground": "ink-900",
|
|
330
|
+
"popover": "overlay",
|
|
331
|
+
"popover-foreground": "ink-900",
|
|
332
|
+
"primary": "action",
|
|
333
|
+
"primary-foreground": "action-foreground",
|
|
334
|
+
"secondary": "wash",
|
|
335
|
+
"secondary-foreground": "ink-900",
|
|
336
|
+
"muted": "wash",
|
|
337
|
+
"muted-foreground": "ink-500",
|
|
338
|
+
"accent": "wash",
|
|
339
|
+
"accent-foreground": "ink-900",
|
|
340
|
+
"destructive": "state-error",
|
|
341
|
+
"destructive-foreground": "paper",
|
|
342
|
+
"border": "line",
|
|
343
|
+
"input": "line-strong",
|
|
344
|
+
"ring": "action",
|
|
345
|
+
"section": "frame",
|
|
346
|
+
"sidebar": "frame",
|
|
347
|
+
"sidebar-foreground": "ink-900",
|
|
348
|
+
"sidebar-primary": "action",
|
|
349
|
+
"sidebar-primary-foreground": "action-foreground",
|
|
350
|
+
"sidebar-accent": "wash",
|
|
351
|
+
"sidebar-accent-foreground": "ink-900",
|
|
352
|
+
"sidebar-border": "line",
|
|
353
|
+
"sidebar-ring": "action"
|
|
354
|
+
},
|
|
355
|
+
"refOptions": [
|
|
356
|
+
"ink-1000",
|
|
357
|
+
"ink-900",
|
|
358
|
+
"ink-700",
|
|
359
|
+
"ink-500",
|
|
360
|
+
"ink-300",
|
|
361
|
+
"line",
|
|
362
|
+
"line-strong",
|
|
363
|
+
"line-control",
|
|
364
|
+
"frame",
|
|
365
|
+
"paper",
|
|
366
|
+
"raised",
|
|
367
|
+
"overlay",
|
|
368
|
+
"wash",
|
|
369
|
+
"action",
|
|
370
|
+
"action-hover",
|
|
371
|
+
"action-foreground",
|
|
372
|
+
"action-ink",
|
|
373
|
+
"lt-three",
|
|
374
|
+
"lt-three-foreground",
|
|
375
|
+
"state-success",
|
|
376
|
+
"state-error",
|
|
377
|
+
"state-warning",
|
|
378
|
+
"destructive-solid",
|
|
379
|
+
"destructive-solid-foreground",
|
|
380
|
+
"chart-1",
|
|
381
|
+
"chart-2",
|
|
382
|
+
"chart-3",
|
|
383
|
+
"chart-4",
|
|
384
|
+
"chart-5"
|
|
385
|
+
],
|
|
386
|
+
"radius": {
|
|
387
|
+
"control": 6,
|
|
388
|
+
"surface": 10
|
|
389
|
+
},
|
|
390
|
+
"body": {
|
|
391
|
+
"size": 14,
|
|
392
|
+
"lineHeight": 22
|
|
393
|
+
}
|
|
394
|
+
};
|
|
395
|
+
|
|
396
|
+
//#endregion
|
|
397
|
+
export { catalog };
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
//#region src/tuning/catalog.ts
|
|
2
|
+
const COLOR_LITERAL = /^(#[0-9a-f]{3,8}|rgba?\(.*\))$/i;
|
|
3
|
+
const RAMP_NAMES = /* @__PURE__ */ new Set([
|
|
4
|
+
"ink-1000",
|
|
5
|
+
"ink-900",
|
|
6
|
+
"ink-700",
|
|
7
|
+
"ink-500",
|
|
8
|
+
"ink-300",
|
|
9
|
+
"line",
|
|
10
|
+
"line-strong",
|
|
11
|
+
"line-control",
|
|
12
|
+
"frame",
|
|
13
|
+
"paper",
|
|
14
|
+
"raised",
|
|
15
|
+
"overlay",
|
|
16
|
+
"wash",
|
|
17
|
+
"scrim",
|
|
18
|
+
"action"
|
|
19
|
+
]);
|
|
20
|
+
function groupOf(name) {
|
|
21
|
+
if (name.startsWith("lt-three")) return "brand";
|
|
22
|
+
if (name.startsWith("state-") || name.startsWith("destructive-solid")) return "state";
|
|
23
|
+
if (name.startsWith("action")) return "action";
|
|
24
|
+
if (name.startsWith("chart-")) return "chart";
|
|
25
|
+
return "ramp";
|
|
26
|
+
}
|
|
27
|
+
/** Whether it is a translucent value (`rgba(…, 0.45)`, `#rrggbbaa`, and so on). Unreadable values are not treated as translucent. */
|
|
28
|
+
function hasAlpha(value) {
|
|
29
|
+
const text = value.trim();
|
|
30
|
+
if (/^#[0-9a-f]{8}$/i.test(text)) return Number.parseInt(text.slice(7), 16) < 255;
|
|
31
|
+
const alpha = /^rgba\(\s*[\d.]+\s*,\s*[\d.]+\s*,\s*[\d.]+\s*,\s*([\d.]+)\s*\)$/i.exec(text)?.[1];
|
|
32
|
+
return alpha !== void 0 && Number(alpha) < 1;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Builds what can be tuned from the definition.
|
|
36
|
+
*
|
|
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
|
+
*
|
|
42
|
+
* Throws if it cannot be read (so a change in the default shape that makes this reading stale is not silently missed).
|
|
43
|
+
*/
|
|
44
|
+
function buildCatalog({ tokens, tokenNames, css }) {
|
|
45
|
+
const root = /:root\s*\{([\s\S]*?)\n\}/.exec(css)?.[1];
|
|
46
|
+
if (root === void 0) throw new Error("生成された CSS に :root が見つからない");
|
|
47
|
+
const declared = /* @__PURE__ */ new Map();
|
|
48
|
+
for (const match of root.matchAll(/^\s*--([\w-]+):\s*([^;]+);/gm)) {
|
|
49
|
+
const [, name, value] = match;
|
|
50
|
+
if (name !== void 0 && value !== void 0) declared.set(name, value.trim());
|
|
51
|
+
}
|
|
52
|
+
const colors = tokenNames.filter((name) => COLOR_LITERAL.test(declared.get(name) ?? "")).map((name) => {
|
|
53
|
+
const group = groupOf(name);
|
|
54
|
+
return {
|
|
55
|
+
name,
|
|
56
|
+
group,
|
|
57
|
+
hasDark: group !== "brand",
|
|
58
|
+
alpha: hasAlpha(tokens.light[name] ?? "")
|
|
59
|
+
};
|
|
60
|
+
});
|
|
61
|
+
const colorNames = new Set(colors.map((color) => color.name));
|
|
62
|
+
for (const name of RAMP_NAMES) if (!colorNames.has(name)) throw new Error(`ランプのトークン --${name} が定義に無い`);
|
|
63
|
+
const semantic = {};
|
|
64
|
+
for (const name of tokenNames) {
|
|
65
|
+
const ref = /^var\(--([\w-]+)\)$/.exec(declared.get(name) ?? "")?.[1];
|
|
66
|
+
if (ref !== void 0 && colorNames.has(ref)) semantic[name] = ref;
|
|
67
|
+
}
|
|
68
|
+
if (Object.keys(semantic).length === 0) throw new Error("セマンティックトークンの参照先が CSS から読めない");
|
|
69
|
+
const size = /--text-body:\s*([\d.]+)px/.exec(css)?.[1];
|
|
70
|
+
const lineHeight = /--text-body--line-height:\s*([\d.]+)px/.exec(css)?.[1];
|
|
71
|
+
if (size === void 0 || lineHeight === void 0) throw new Error("--text-body が CSS から読めない");
|
|
72
|
+
const radiusOf = (role) => {
|
|
73
|
+
const px = new RegExp(`--radius-${role}:\\s*([\\d.]+)px`).exec(css)?.[1];
|
|
74
|
+
if (px === void 0) throw new Error(`--radius-${role} が CSS から読めない`);
|
|
75
|
+
return Number(px);
|
|
76
|
+
};
|
|
77
|
+
const radius = {
|
|
78
|
+
control: radiusOf("control"),
|
|
79
|
+
surface: radiusOf("surface")
|
|
80
|
+
};
|
|
81
|
+
return {
|
|
82
|
+
defaults: tokens,
|
|
83
|
+
colors,
|
|
84
|
+
semantic,
|
|
85
|
+
refOptions: colors.filter((color) => !color.alpha).map((color) => color.name),
|
|
86
|
+
radius,
|
|
87
|
+
body: {
|
|
88
|
+
size: Number(size),
|
|
89
|
+
lineHeight: Number(lineHeight)
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
function findColor(catalog, name) {
|
|
94
|
+
return catalog.colors.find((color) => color.name === name);
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
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
|
+
*/
|
|
100
|
+
function buildCatalogSafe(input) {
|
|
101
|
+
try {
|
|
102
|
+
return {
|
|
103
|
+
catalog: buildCatalog(input),
|
|
104
|
+
error: null
|
|
105
|
+
};
|
|
106
|
+
} catch (error) {
|
|
107
|
+
return {
|
|
108
|
+
catalog: {
|
|
109
|
+
defaults: input.tokens,
|
|
110
|
+
colors: [],
|
|
111
|
+
semantic: {},
|
|
112
|
+
refOptions: [],
|
|
113
|
+
radius: {
|
|
114
|
+
control: 6,
|
|
115
|
+
surface: 10
|
|
116
|
+
},
|
|
117
|
+
body: {
|
|
118
|
+
size: 14,
|
|
119
|
+
lineHeight: 22
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
error: error instanceof Error ? error.message : String(error)
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
//#endregion
|
|
128
|
+
export { buildCatalog, buildCatalogSafe, findColor };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//#region src/tuning/color.d.ts
|
|
2
|
+
export type ColorResult = {
|
|
3
|
+
ok: true;
|
|
4
|
+
value: string;
|
|
5
|
+
} | {
|
|
6
|
+
ok: false;
|
|
7
|
+
reason: string;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Reads a color token input and turns it into the canonical form.
|
|
11
|
+
*
|
|
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
|
+
*
|
|
15
|
+
* Unreadable values and out-of-range values (above 255, or an opacity outside 0 to 1) are rejected with a reason.
|
|
16
|
+
*/
|
|
17
|
+
export declare function parseTokenColor(input: string, options: {
|
|
18
|
+
alpha: boolean;
|
|
19
|
+
}): ColorResult;
|
|
20
|
+
//#endregion
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
//#region src/tuning/color.ts
|
|
2
|
+
const HEX6 = /^#([0-9a-f]{6})$/i;
|
|
3
|
+
const HEX3 = /^#([0-9a-f]{3})$/i;
|
|
4
|
+
const HEX8 = /^#([0-9a-f]{8})$/i;
|
|
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
|
+
/**
|
|
7
|
+
* Reads a color token input and turns it into the canonical form.
|
|
8
|
+
*
|
|
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
|
+
*
|
|
12
|
+
* Unreadable values and out-of-range values (above 255, or an opacity outside 0 to 1) are rejected with a reason.
|
|
13
|
+
*/
|
|
14
|
+
function parseTokenColor(input, options) {
|
|
15
|
+
const text = input.trim();
|
|
16
|
+
const hex6 = HEX6.exec(text);
|
|
17
|
+
if (hex6?.[1] !== void 0) return options.alpha ? {
|
|
18
|
+
ok: true,
|
|
19
|
+
value: toRgba(hex6[1], 255)
|
|
20
|
+
} : hex(hex6[1]);
|
|
21
|
+
const hex3 = HEX3.exec(text);
|
|
22
|
+
if (hex3?.[1] !== void 0) {
|
|
23
|
+
const expanded = hex3[1].replace(/./g, (c) => c + c);
|
|
24
|
+
return options.alpha ? {
|
|
25
|
+
ok: true,
|
|
26
|
+
value: toRgba(expanded, 255)
|
|
27
|
+
} : hex(expanded);
|
|
28
|
+
}
|
|
29
|
+
if (!options.alpha) return {
|
|
30
|
+
ok: false,
|
|
31
|
+
reason: `「${input}」は色として読めません。不透明な色は #rrggbb(または #rgb)で書きます(半透明は scrim だけ)`
|
|
32
|
+
};
|
|
33
|
+
const hex8 = HEX8.exec(text);
|
|
34
|
+
if (hex8?.[1] !== void 0) return {
|
|
35
|
+
ok: true,
|
|
36
|
+
value: toRgba(hex8[1].slice(0, 6), Number.parseInt(hex8[1].slice(6), 16))
|
|
37
|
+
};
|
|
38
|
+
const rgba = RGBA.exec(text);
|
|
39
|
+
if (rgba?.[1] !== void 0 && rgba[2] !== void 0 && rgba[3] !== void 0) {
|
|
40
|
+
const channels = [
|
|
41
|
+
rgba[1],
|
|
42
|
+
rgba[2],
|
|
43
|
+
rgba[3]
|
|
44
|
+
].map(Number);
|
|
45
|
+
if (channels.some((channel) => channel > 255)) return {
|
|
46
|
+
ok: false,
|
|
47
|
+
reason: `「${input}」の色の成分が 255 を超えています`
|
|
48
|
+
};
|
|
49
|
+
const alpha = rgba[4] === void 0 ? 1 : Number(rgba[4]);
|
|
50
|
+
if (alpha > 1) return {
|
|
51
|
+
ok: false,
|
|
52
|
+
reason: `「${input}」の不透明度が 1 を超えています(0〜1)`
|
|
53
|
+
};
|
|
54
|
+
return {
|
|
55
|
+
ok: true,
|
|
56
|
+
value: `rgba(${channels.join(", ")}, ${trimNumber(alpha)})`
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
ok: false,
|
|
61
|
+
reason: `「${input}」は色として読めません。#rrggbb・#rrggbbaa・rgba(r, g, b, a) のどれかで書きます`
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
function hex(digits) {
|
|
65
|
+
return {
|
|
66
|
+
ok: true,
|
|
67
|
+
value: `#${digits.toLowerCase()}`
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
function toRgba(rgb, alpha255) {
|
|
71
|
+
const channel = (offset) => Number.parseInt(rgb.slice(offset, offset + 2), 16);
|
|
72
|
+
return `rgba(${channel(0)}, ${channel(2)}, ${channel(4)}, ${trimNumber(alpha255 / 255)})`;
|
|
73
|
+
}
|
|
74
|
+
/** Rounds a decimal and drops trailing zeros (0.45 → `0.45`, 1 → `1`). */
|
|
75
|
+
function trimNumber(value) {
|
|
76
|
+
return String(Math.round(value * 100) / 100);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
//#endregion
|
|
80
|
+
export { parseTokenColor };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Tuning, TuningCatalog } from "./types.js";
|
|
2
|
+
//#region src/tuning/css.d.ts
|
|
3
|
+
/** The shadow preset (Tailwind's default shadows). The love3 default is a soft shadow using `--shadow-color` (the `theme` in `definition.ts`). */
|
|
4
|
+
export declare const SHADOW_PRESET: {
|
|
5
|
+
readonly "2xs": "0 1px rgb(0 0 0 / 0.05)";
|
|
6
|
+
readonly xs: "0 1px 2px 0 rgb(0 0 0 / 0.05)";
|
|
7
|
+
readonly sm: "0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)";
|
|
8
|
+
readonly md: "0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)";
|
|
9
|
+
readonly lg: "0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)";
|
|
10
|
+
readonly xl: "0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)";
|
|
11
|
+
readonly "2xl": "0 25px 50px -12px rgb(0 0 0 / 0.25)";
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* **The CSS injected into `<style id="love3-tuning">` at runtime.** An empty string when everything is at the defaults (nothing is injected).
|
|
15
|
+
*
|
|
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
|
+
*/
|
|
23
|
+
export declare function toRuntimeCss(tuning: Tuning, catalog: TuningCatalog): string;
|
|
24
|
+
/**
|
|
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
|
+
*/
|
|
29
|
+
export declare function toExportCss(tuning: Tuning, catalog: TuningCatalog): string;
|
|
30
|
+
/**
|
|
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
|
+
*/
|
|
34
|
+
export declare function toDefinitionDiff(tuning: Tuning, catalog: TuningCatalog): string;
|
|
35
|
+
//#endregion
|