@seanyeh77/ui 0.43.1 → 0.45.0
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/LICENSE +21 -0
- package/README.md +1 -1
- package/dist/bundle.js +20 -20
- package/dist/components/AccentPicker/AccentPicker.d.ts +1 -0
- package/dist/components/AccentPicker/AccentPicker.js +92 -72
- package/dist/components/AccentPicker/AccentPicker.js.map +1 -1
- package/dist/components/ActionBar/ActionBar.d.ts +2 -0
- package/dist/components/ActionBar/ActionBar.js.map +1 -1
- package/dist/components/AiMark/AiMark.d.ts +1 -0
- package/dist/components/AiMark/AiMark.js.map +1 -1
- package/dist/components/Alert/Alert.d.ts +6 -3
- package/dist/components/Alert/Alert.js +18 -14
- package/dist/components/Alert/Alert.js.map +1 -1
- package/dist/components/AppShell/AppShell.d.ts +10 -4
- package/dist/components/AppShell/AppShell.js +30 -19
- package/dist/components/AppShell/AppShell.js.map +1 -1
- package/dist/components/Badge/Badge.d.ts +24 -7
- package/dist/components/Badge/Badge.js +78 -21
- package/dist/components/Badge/Badge.js.map +1 -1
- package/dist/components/BarChart/BarChart.d.ts +14 -1
- package/dist/components/BarChart/BarChart.js +88 -59
- package/dist/components/BarChart/BarChart.js.map +1 -1
- package/dist/components/Breadcrumb/Breadcrumb.d.ts +1 -0
- package/dist/components/Breadcrumb/Breadcrumb.js.map +1 -1
- package/dist/components/Button/Button.d.ts +4 -1
- package/dist/components/Button/Button.js +17 -3
- package/dist/components/Button/Button.js.map +1 -1
- package/dist/components/Calendar/Calendar.d.ts +11 -2
- package/dist/components/Calendar/Calendar.js +16 -5
- package/dist/components/Calendar/Calendar.js.map +1 -1
- package/dist/components/Card/Card.d.ts +1 -0
- package/dist/components/Card/Card.js.map +1 -1
- package/dist/components/Checkbox/Checkbox.d.ts +24 -8
- package/dist/components/Checkbox/Checkbox.js +22 -9
- package/dist/components/Checkbox/Checkbox.js.map +1 -1
- package/dist/components/CodeView/CodeView.d.ts +3 -0
- package/dist/components/CodeView/CodeView.js +6 -6
- package/dist/components/CodeView/CodeView.js.map +1 -1
- package/dist/components/CommandPalette/CommandPalette.d.ts +16 -4
- package/dist/components/CommandPalette/CommandPalette.js +38 -11
- package/dist/components/CommandPalette/CommandPalette.js.map +1 -1
- package/dist/components/ConsoleLayout/ConsoleLayout.d.ts +2 -3
- package/dist/components/ConsoleLayout/ConsoleLayout.js +4 -1
- package/dist/components/ConsoleLayout/ConsoleLayout.js.map +1 -1
- package/dist/components/DangerZone/DangerZone.d.ts +3 -2
- package/dist/components/DangerZone/DangerZone.js +3 -2
- package/dist/components/DangerZone/DangerZone.js.map +1 -1
- package/dist/components/DataTable/DataTable.d.ts +16 -4
- package/dist/components/DataTable/DataTable.js +346 -208
- package/dist/components/DataTable/DataTable.js.map +1 -1
- package/dist/components/DataTable/SortButton.js +48 -5
- package/dist/components/DataTable/SortButton.js.map +1 -1
- package/dist/components/DataTable/filters.js +2 -1
- package/dist/components/DataTable/filters.js.map +1 -1
- package/dist/components/DataTable/parts.js +1 -1
- package/dist/components/DataTable/parts.js.map +1 -1
- package/dist/components/DataTable/types.d.ts +10 -3
- package/dist/components/DatePicker/DatePicker.d.ts +9 -7
- package/dist/components/DatePicker/DatePicker.js +16 -6
- package/dist/components/DatePicker/DatePicker.js.map +1 -1
- package/dist/components/DateRangePicker/DateRangePicker.d.ts +12 -7
- package/dist/components/DateRangePicker/DateRangePicker.js +81 -45
- package/dist/components/DateRangePicker/DateRangePicker.js.map +1 -1
- package/dist/components/DetailList/DetailList.d.ts +2 -0
- package/dist/components/DetailList/DetailList.js.map +1 -1
- package/dist/components/Dialog/Dialog.d.ts +56 -20
- package/dist/components/Dialog/Dialog.js +46 -14
- package/dist/components/Dialog/Dialog.js.map +1 -1
- package/dist/components/Drawer/Drawer.d.ts +18 -5
- package/dist/components/Drawer/Drawer.js +87 -24
- package/dist/components/Drawer/Drawer.js.map +1 -1
- package/dist/components/EmptyState/EmptyState.d.ts +2 -2
- package/dist/components/EmptyState/EmptyState.js +3 -2
- package/dist/components/EmptyState/EmptyState.js.map +1 -1
- package/dist/components/ErrorPage/ErrorPage.d.ts +4 -0
- package/dist/components/ErrorPage/ErrorPage.js +2 -1
- package/dist/components/ErrorPage/ErrorPage.js.map +1 -1
- package/dist/components/EventTimeline/EventTimeline.d.ts +23 -5
- package/dist/components/EventTimeline/EventTimeline.js +64 -20
- package/dist/components/EventTimeline/EventTimeline.js.map +1 -1
- package/dist/components/FileUpload/FileUpload.d.ts +10 -2
- package/dist/components/FileUpload/FileUpload.js +5 -2
- package/dist/components/FileUpload/FileUpload.js.map +1 -1
- package/dist/components/FormGrid/FormGrid.d.ts +3 -1
- package/dist/components/FormGrid/FormGrid.js +5 -2
- package/dist/components/FormGrid/FormGrid.js.map +1 -1
- package/dist/components/Graph/Graph.d.ts +1 -0
- package/dist/components/Graph/Graph.js +8 -4
- package/dist/components/Graph/Graph.js.map +1 -1
- package/dist/components/Grid/Grid.d.ts +11 -4
- package/dist/components/Grid/Grid.js +14 -2
- package/dist/components/Grid/Grid.js.map +1 -1
- package/dist/components/IconButton/IconButton.d.ts +2 -1
- package/dist/components/IconButton/IconButton.js +10 -1
- package/dist/components/IconButton/IconButton.js.map +1 -1
- package/dist/components/InlineCode/InlineCode.d.ts +6 -0
- package/dist/components/InlineCode/InlineCode.js +10 -6
- package/dist/components/InlineCode/InlineCode.js.map +1 -1
- package/dist/components/KpiCard/KpiCard.d.ts +7 -3
- package/dist/components/KpiCard/KpiCard.js +40 -25
- package/dist/components/KpiCard/KpiCard.js.map +1 -1
- package/dist/components/LayerGraph/LayerGraph.d.ts +68 -23
- package/dist/components/LayerGraph/LayerGraph.js +178 -97
- package/dist/components/LayerGraph/LayerGraph.js.map +1 -1
- package/dist/components/LineChart/LineChart.d.ts +10 -3
- package/dist/components/LineChart/LineChart.js +55 -23
- package/dist/components/LineChart/LineChart.js.map +1 -1
- package/dist/components/Link/Link.d.ts +17 -0
- package/dist/components/Link/Link.js +47 -0
- package/dist/components/Link/Link.js.map +1 -0
- package/dist/components/LoadingBar/LoadingBar.d.ts +1 -0
- package/dist/components/LoadingBar/LoadingBar.js.map +1 -1
- package/dist/components/LoginCard/LoginCard.d.ts +9 -3
- package/dist/components/LoginCard/LoginCard.js +99 -78
- package/dist/components/LoginCard/LoginCard.js.map +1 -1
- package/dist/components/Markdown/Markdown.d.ts +1 -0
- package/dist/components/Markdown/Markdown.js +20 -2
- package/dist/components/Markdown/Markdown.js.map +1 -1
- package/dist/components/Menu/Menu.d.ts +4 -2
- package/dist/components/Menu/Menu.js +43 -33
- package/dist/components/Menu/Menu.js.map +1 -1
- package/dist/components/Meter/Meter.d.ts +4 -0
- package/dist/components/Meter/Meter.js.map +1 -1
- package/dist/components/MobileTabBar/MobileTabBar.d.ts +3 -0
- package/dist/components/MobileTabBar/MobileTabBar.js.map +1 -1
- package/dist/components/MultiSelect/MultiSelect.d.ts +7 -6
- package/dist/components/MultiSelect/MultiSelect.js +27 -9
- package/dist/components/MultiSelect/MultiSelect.js.map +1 -1
- package/dist/components/NotificationBell/NotificationBell.d.ts +4 -0
- package/dist/components/NotificationBell/NotificationBell.js +4 -3
- package/dist/components/NotificationBell/NotificationBell.js.map +1 -1
- package/dist/components/PageHeader/PageHeader.d.ts +34 -0
- package/dist/components/PageHeader/PageHeader.js +68 -0
- package/dist/components/PageHeader/PageHeader.js.map +1 -0
- package/dist/components/Popover/Popover.d.ts +11 -4
- package/dist/components/Popover/Popover.js +17 -7
- package/dist/components/Popover/Popover.js.map +1 -1
- package/dist/components/ProgressBar/ProgressBar.d.ts +2 -0
- package/dist/components/ProgressBar/ProgressBar.js.map +1 -1
- package/dist/components/ProgressRing/ProgressRing.d.ts +1 -0
- package/dist/components/ProgressRing/ProgressRing.js.map +1 -1
- package/dist/components/ProjectSwitcher/ProjectSwitcher.d.ts +5 -1
- package/dist/components/ProjectSwitcher/ProjectSwitcher.js +16 -3
- package/dist/components/ProjectSwitcher/ProjectSwitcher.js.map +1 -1
- package/dist/components/RadioGroup/RadioGroup.d.ts +22 -5
- package/dist/components/RadioGroup/RadioGroup.js +48 -47
- package/dist/components/RadioGroup/RadioGroup.js.map +1 -1
- package/dist/components/RelativeTime/RelativeTime.d.ts +10 -0
- package/dist/components/RelativeTime/RelativeTime.js +44 -0
- package/dist/components/RelativeTime/RelativeTime.js.map +1 -0
- package/dist/components/SearchField/SearchField.d.ts +2 -0
- package/dist/components/SearchField/SearchField.js.map +1 -1
- package/dist/components/Section/Section.d.ts +4 -0
- package/dist/components/Section/Section.js +8 -22
- package/dist/components/Section/Section.js.map +1 -1
- package/dist/components/SegmentedControl/SegmentedControl.d.ts +22 -9
- package/dist/components/SegmentedControl/SegmentedControl.js +20 -19
- package/dist/components/SegmentedControl/SegmentedControl.js.map +1 -1
- package/dist/components/Select/Select.d.ts +7 -11
- package/dist/components/Select/Select.js +7 -3
- package/dist/components/Select/Select.js.map +1 -1
- package/dist/components/SettingsLayout/SettingsLayout.d.ts +33 -4
- package/dist/components/SettingsLayout/SettingsLayout.js +62 -14
- package/dist/components/SettingsLayout/SettingsLayout.js.map +1 -1
- package/dist/components/SideNav/SideNav.d.ts +2 -0
- package/dist/components/SideNav/SideNav.js +3 -3
- package/dist/components/SideNav/SideNav.js.map +1 -1
- package/dist/components/SplitPane/SplitPane.d.ts +1 -0
- package/dist/components/SplitPane/SplitPane.js.map +1 -1
- package/dist/components/StatusBand/StatusBand.d.ts +1 -0
- package/dist/components/StatusBand/StatusBand.js.map +1 -1
- package/dist/components/Suggestion/Suggestion.d.ts +6 -0
- package/dist/components/Suggestion/Suggestion.js.map +1 -1
- package/dist/components/Switch/Switch.d.ts +13 -3
- package/dist/components/Switch/Switch.js +16 -7
- package/dist/components/Switch/Switch.js.map +1 -1
- package/dist/components/Tabs/Tabs.d.ts +8 -1
- package/dist/components/Tabs/Tabs.js +6 -3
- package/dist/components/Tabs/Tabs.js.map +1 -1
- package/dist/components/Tag/Tag.d.ts +15 -7
- package/dist/components/Tag/Tag.js +22 -10
- package/dist/components/Tag/Tag.js.map +1 -1
- package/dist/components/Term/Term.d.ts +8 -3
- package/dist/components/Term/Term.js +1 -1
- package/dist/components/Term/Term.js.map +1 -1
- package/dist/components/TextArea/TextArea.d.ts +6 -9
- package/dist/components/TextArea/TextArea.js +25 -12
- package/dist/components/TextArea/TextArea.js.map +1 -1
- package/dist/components/TextField/TextField.d.ts +8 -11
- package/dist/components/TextField/TextField.js +9 -7
- package/dist/components/TextField/TextField.js.map +1 -1
- package/dist/components/ThemePicker/ThemePicker.d.ts +1 -0
- package/dist/components/ThemePicker/ThemePicker.js +35 -34
- package/dist/components/ThemePicker/ThemePicker.js.map +1 -1
- package/dist/components/TimeControl/TimeControl.d.ts +1 -0
- package/dist/components/TimeControl/TimeControl.js.map +1 -1
- package/dist/components/Toast/Toast.d.ts +56 -3
- package/dist/components/Toast/Toast.js +191 -8
- package/dist/components/Toast/Toast.js.map +1 -1
- package/dist/components/TopBar/TopBar.d.ts +6 -2
- package/dist/components/TopBar/TopBar.js +7 -1
- package/dist/components/TopBar/TopBar.js.map +1 -1
- package/dist/components/Tour/Tour.d.ts +14 -3
- package/dist/components/Tour/Tour.js +26 -14
- package/dist/components/Tour/Tour.js.map +1 -1
- package/dist/components/TreeList/TreeList.d.ts +28 -4
- package/dist/components/TreeList/TreeList.js +32 -20
- package/dist/components/TreeList/TreeList.js.map +1 -1
- package/dist/components/Workbench/Workbench.d.ts +1 -0
- package/dist/components/Workbench/Workbench.js +24 -12
- package/dist/components/Workbench/Workbench.js.map +1 -1
- package/dist/components/ZoneMap/ZoneMap.d.ts +12 -2
- package/dist/components/ZoneMap/ZoneMap.js +13 -5
- package/dist/components/ZoneMap/ZoneMap.js.map +1 -1
- package/dist/components/useFormErrors/useFormErrors.d.ts +20 -0
- package/dist/components/useFormErrors/useFormErrors.js +55 -0
- package/dist/components/useFormErrors/useFormErrors.js.map +1 -0
- package/dist/css/AccentPicker.css +1 -0
- package/dist/css/Alert.css +8 -19
- package/dist/css/AppShell.css +1 -0
- package/dist/css/Badge.css +19 -45
- package/dist/css/BarChart.css +21 -3
- package/dist/css/Button.css +6 -1
- package/dist/css/Card.css +8 -8
- package/dist/css/Checkbox.css +20 -0
- package/dist/css/CodeView.css +3 -2
- package/dist/css/DangerZone.css +5 -3
- package/dist/css/DataTable.css +303 -69
- package/dist/css/DatePicker.css +1 -0
- package/dist/css/DateRangePicker.css +24 -2
- package/dist/css/Drawer.css +31 -0
- package/dist/css/EmptyState.css +1 -0
- package/dist/css/ErrorPage.css +4 -1
- package/dist/css/EventTimeline.css +34 -5
- package/dist/css/FileUpload.css +1 -0
- package/dist/css/FormGrid.css +12 -3
- package/dist/css/Graph.css +9 -1
- package/dist/css/Grid.css +8 -0
- package/dist/css/KpiCard.css +13 -1
- package/dist/css/LayerGraph.css +40 -15
- package/dist/css/Link.css +23 -0
- package/dist/css/LoginCard.css +17 -11
- package/dist/css/Markdown.css +31 -2
- package/dist/css/Menu.css +0 -2
- package/dist/css/Meter.css +16 -0
- package/dist/css/MultiSelect.css +1 -0
- package/dist/css/NotificationBell.css +1 -0
- package/dist/css/PageHeader.css +50 -0
- package/dist/css/ProgressBar.css +12 -0
- package/dist/css/ProjectSwitcher.css +25 -23
- package/dist/css/RelativeTime.css +2 -0
- package/dist/css/SegmentedControl.css +38 -10
- package/dist/css/Select.css +1 -0
- package/dist/css/SettingsLayout.css +29 -8
- package/dist/css/SideNav.css +4 -1
- package/dist/css/Skeleton.css +22 -1
- package/dist/css/Suggestion.css +1 -1
- package/dist/css/Switch.css +27 -0
- package/dist/css/Tabs.css +8 -7
- package/dist/css/Tag.css +19 -12
- package/dist/css/Term.css +1 -1
- package/dist/css/TextArea.css +1 -0
- package/dist/css/TextField.css +1 -0
- package/dist/css/Toast.css +101 -4
- package/dist/css/TopBar.css +21 -2
- package/dist/css/Tour.css +1 -1
- package/dist/css/TreeList.css +7 -3
- package/dist/css/Workbench.css +13 -1
- package/dist/css/ZoneMap.css +0 -1
- package/dist/css/base.css +45 -0
- package/dist/css/end.css +119 -5
- package/dist/deprecated.d.ts +3 -0
- package/dist/deprecated.js +13 -0
- package/dist/deprecated.js.map +1 -0
- package/dist/fonts.css +2 -7543
- package/dist/format.d.ts +3 -1
- package/dist/format.js +15 -5
- package/dist/format.js.map +1 -1
- package/dist/generated/themeDefaults.d.ts +8 -0
- package/dist/generated/themeDefaults.js +35 -0
- package/dist/generated/themeDefaults.js.map +1 -0
- package/dist/i18n.d.ts +7 -2
- package/dist/i18n.js +65 -10
- package/dist/i18n.js.map +1 -1
- package/dist/icons/Icon.d.ts +3 -1
- package/dist/icons/Icon.js.map +1 -1
- package/dist/index.d.ts +23 -14
- package/dist/index.js +14 -8
- package/dist/internal/Field.d.ts +19 -0
- package/dist/internal/Field.js +13 -6
- package/dist/internal/Field.js.map +1 -1
- package/dist/internal/FloatingPanel.js +2 -1
- package/dist/internal/FloatingPanel.js.map +1 -1
- package/dist/internal/chart.d.ts +4 -0
- package/dist/internal/chart.js +89 -19
- package/dist/internal/chart.js.map +1 -1
- package/dist/internal/codeSpans.js +20 -0
- package/dist/internal/codeSpans.js.map +1 -0
- package/dist/internal/dev.js +9 -4
- package/dist/internal/dev.js.map +1 -1
- package/dist/internal/focus.js +27 -3
- package/dist/internal/focus.js.map +1 -1
- package/dist/internal/focusMain.js +6 -2
- package/dist/internal/focusMain.js.map +1 -1
- package/dist/internal/open.d.ts +14 -0
- package/dist/internal/open.js +28 -0
- package/dist/internal/open.js.map +1 -0
- package/dist/internal/roving.js +37 -0
- package/dist/internal/roving.js.map +1 -0
- package/dist/internal/shell.js +12 -0
- package/dist/internal/shell.js.map +1 -0
- package/dist/internal/stored.js +89 -0
- package/dist/internal/stored.js.map +1 -0
- package/dist/internal/tableTools.js +46 -4
- package/dist/internal/tableTools.js.map +1 -1
- package/dist/internal/util.js +8 -17
- package/dist/internal/util.js.map +1 -1
- package/dist/locale.d.ts +17 -0
- package/dist/locale.js +29 -0
- package/dist/locale.js.map +1 -0
- package/dist/styles.css +1296 -400
- package/dist/theme.d.ts +23 -5
- package/dist/theme.js +85 -25
- package/dist/theme.js.map +1 -1
- package/dist/tokens.css +3 -0
- package/docs/AccentPicker.md +3 -1
- package/docs/Alert.md +4 -3
- package/docs/AppShell.md +11 -10
- package/docs/Badge.md +26 -16
- package/docs/BarChart.md +7 -4
- package/docs/Button.md +4 -5
- package/docs/Calendar.md +2 -2
- package/docs/Card.md +9 -8
- package/docs/Checkbox.md +4 -1
- package/docs/CodeView.md +30 -43
- package/docs/CommandPalette.md +3 -2
- package/docs/ConsoleLayout.md +5 -5
- package/docs/DangerZone.md +3 -2
- package/docs/DataColors.md +2 -2
- package/docs/DataTable.md +29 -141
- package/docs/DatePicker.md +1 -0
- package/docs/DateRangePicker.md +3 -0
- package/docs/DetailList.md +9 -9
- package/docs/Dialog.md +8 -4
- package/docs/Drawer.md +7 -4
- package/docs/ErrorPage.md +1 -1
- package/docs/EventTimeline.md +23 -12
- package/docs/FileUpload.md +1 -1
- package/docs/FormGrid.md +2 -1
- package/docs/Format.md +5 -3
- package/docs/Graph.md +1 -1
- package/docs/Grid.md +5 -1
- package/docs/KpiCard.md +6 -4
- package/docs/LayerGraph.md +18 -53
- package/docs/LineChart.md +5 -3
- package/docs/Link.md +22 -0
- package/docs/LoginCard.md +7 -3
- package/docs/Markdown.md +3 -13
- package/docs/Menu.md +2 -0
- package/docs/Meter.md +1 -0
- package/docs/MultiSelect.md +2 -1
- package/docs/NotificationBell.md +1 -0
- package/docs/PageHeader.md +34 -0
- package/docs/Popover.md +3 -1
- package/docs/ProgressBar.md +3 -1
- package/docs/ProjectSwitcher.md +14 -14
- package/docs/RadioGroup.md +2 -0
- package/docs/RelativeTime.md +23 -0
- package/docs/Section.md +1 -1
- package/docs/SegmentedControl.md +9 -6
- package/docs/Select.md +2 -1
- package/docs/SettingsLayout.md +19 -4
- package/docs/SideNav.md +1 -1
- package/docs/Skeleton.md +2 -1
- package/docs/Switch.md +3 -1
- package/docs/Tabs.md +4 -3
- package/docs/Tag.md +9 -7
- package/docs/Term.md +3 -3
- package/docs/TextArea.md +2 -1
- package/docs/TextField.md +5 -3
- package/docs/ThemePicker.md +3 -1
- package/docs/Toast.md +17 -5
- package/docs/TopBar.md +8 -5
- package/docs/Tour.md +3 -2
- package/docs/TreeList.md +10 -37
- package/docs/Workbench.md +1 -48
- package/docs/ZoneMap.md +5 -5
- package/docs/agents.md +82 -0
- package/docs/code.md +2 -2
- package/docs/components.json +314 -0
- package/docs/data.md +9 -18
- package/docs/forms.md +6 -5
- package/docs/guidelines.md +39 -31
- package/docs/icons.md +9 -0
- package/docs/layout.md +16 -20
- package/docs/motion.md +31 -56
- package/docs/theme.md +15 -18
- package/docs/useFormErrors.md +35 -0
- package/package.json +8 -7
- package/dist/bundle.js.map +0 -1
- package/dist/fonts/LICENSE-OFL.txt +0 -93
- package/dist/fonts/geist-mono-cyrillic-400-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-cyrillic-500-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-cyrillic-600-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-cyrillic-700-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-cyrillic-ext-400-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-cyrillic-ext-500-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-cyrillic-ext-600-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-cyrillic-ext-700-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-latin-400-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-latin-500-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-latin-600-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-latin-700-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-latin-ext-400-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-latin-ext-500-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-latin-ext-600-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-latin-ext-700-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-symbols2-400-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-symbols2-500-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-symbols2-600-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-symbols2-700-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-vietnamese-400-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-vietnamese-500-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-vietnamese-600-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-vietnamese-700-normal.woff2 +0 -0
- package/dist/fonts/inter-cyrillic-400-normal.woff2 +0 -0
- package/dist/fonts/inter-cyrillic-500-normal.woff2 +0 -0
- package/dist/fonts/inter-cyrillic-600-normal.woff2 +0 -0
- package/dist/fonts/inter-cyrillic-700-normal.woff2 +0 -0
- package/dist/fonts/inter-cyrillic-ext-400-normal.woff2 +0 -0
- package/dist/fonts/inter-cyrillic-ext-500-normal.woff2 +0 -0
- package/dist/fonts/inter-cyrillic-ext-600-normal.woff2 +0 -0
- package/dist/fonts/inter-cyrillic-ext-700-normal.woff2 +0 -0
- package/dist/fonts/inter-greek-400-normal.woff2 +0 -0
- package/dist/fonts/inter-greek-500-normal.woff2 +0 -0
- package/dist/fonts/inter-greek-600-normal.woff2 +0 -0
- package/dist/fonts/inter-greek-700-normal.woff2 +0 -0
- package/dist/fonts/inter-greek-ext-400-normal.woff2 +0 -0
- package/dist/fonts/inter-greek-ext-500-normal.woff2 +0 -0
- package/dist/fonts/inter-greek-ext-600-normal.woff2 +0 -0
- package/dist/fonts/inter-greek-ext-700-normal.woff2 +0 -0
- package/dist/fonts/inter-latin-400-normal.woff2 +0 -0
- package/dist/fonts/inter-latin-500-normal.woff2 +0 -0
- package/dist/fonts/inter-latin-600-normal.woff2 +0 -0
- package/dist/fonts/inter-latin-700-normal.woff2 +0 -0
- package/dist/fonts/inter-latin-ext-400-normal.woff2 +0 -0
- package/dist/fonts/inter-latin-ext-500-normal.woff2 +0 -0
- package/dist/fonts/inter-latin-ext-600-normal.woff2 +0 -0
- package/dist/fonts/inter-latin-ext-700-normal.woff2 +0 -0
- package/dist/fonts/inter-vietnamese-400-normal.woff2 +0 -0
- package/dist/fonts/inter-vietnamese-500-normal.woff2 +0 -0
- package/dist/fonts/inter-vietnamese-600-normal.woff2 +0 -0
- package/dist/fonts/inter-vietnamese-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-0-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-0-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-0-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-0-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-1-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-1-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-1-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-1-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-10-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-10-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-10-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-10-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-101-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-101-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-101-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-101-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-102-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-102-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-102-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-102-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-103-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-103-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-103-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-103-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-104-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-104-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-104-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-104-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-105-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-105-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-105-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-105-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-106-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-106-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-106-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-106-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-107-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-107-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-107-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-107-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-108-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-108-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-108-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-108-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-109-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-109-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-109-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-109-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-11-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-11-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-11-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-11-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-110-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-110-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-110-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-110-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-111-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-111-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-111-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-111-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-112-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-112-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-112-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-112-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-113-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-113-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-113-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-113-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-114-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-114-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-114-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-114-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-115-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-115-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-115-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-115-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-116-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-116-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-116-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-116-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-117-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-117-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-117-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-117-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-118-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-118-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-118-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-118-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-119-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-119-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-119-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-119-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-12-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-12-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-12-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-12-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-120-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-120-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-120-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-120-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-121-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-121-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-121-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-121-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-122-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-122-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-122-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-122-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-123-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-123-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-123-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-123-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-2-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-2-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-2-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-2-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-23-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-23-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-23-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-23-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-24-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-24-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-24-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-24-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-25-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-25-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-25-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-25-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-26-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-26-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-26-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-26-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-27-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-27-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-27-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-27-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-28-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-28-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-28-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-28-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-29-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-29-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-29-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-29-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-30-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-30-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-30-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-30-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-31-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-31-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-31-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-31-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-32-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-32-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-32-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-32-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-33-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-33-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-33-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-33-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-34-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-34-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-34-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-34-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-35-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-35-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-35-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-35-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-36-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-36-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-36-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-36-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-37-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-37-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-37-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-37-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-38-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-38-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-38-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-38-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-39-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-39-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-39-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-39-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-4-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-4-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-4-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-4-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-40-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-40-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-40-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-40-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-41-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-41-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-41-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-41-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-42-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-42-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-42-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-42-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-43-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-43-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-43-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-43-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-44-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-44-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-44-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-44-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-45-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-45-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-45-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-45-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-46-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-46-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-46-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-46-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-47-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-47-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-47-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-47-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-48-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-48-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-48-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-48-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-49-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-49-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-49-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-49-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-50-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-50-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-50-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-50-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-51-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-51-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-51-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-51-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-52-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-52-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-52-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-52-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-53-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-53-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-53-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-53-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-54-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-54-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-54-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-54-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-55-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-55-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-55-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-55-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-56-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-56-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-56-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-56-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-57-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-57-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-57-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-57-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-58-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-58-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-58-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-58-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-59-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-59-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-59-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-59-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-60-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-60-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-60-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-60-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-61-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-61-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-61-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-61-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-62-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-62-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-62-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-62-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-63-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-63-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-63-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-63-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-64-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-64-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-64-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-64-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-65-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-65-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-65-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-65-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-66-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-66-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-66-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-66-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-67-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-67-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-67-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-67-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-68-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-68-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-68-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-68-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-69-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-69-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-69-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-69-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-70-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-70-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-70-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-70-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-71-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-71-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-71-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-71-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-72-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-72-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-72-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-72-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-73-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-73-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-73-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-73-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-74-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-74-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-74-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-74-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-75-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-75-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-75-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-75-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-76-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-76-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-76-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-76-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-77-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-77-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-77-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-77-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-78-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-78-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-78-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-78-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-79-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-79-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-79-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-79-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-80-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-80-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-80-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-80-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-81-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-81-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-81-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-81-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-82-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-82-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-82-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-82-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-83-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-83-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-83-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-83-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-84-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-84-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-84-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-84-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-85-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-85-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-85-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-85-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-86-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-86-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-86-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-86-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-87-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-87-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-87-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-87-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-88-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-88-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-88-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-88-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-89-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-89-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-89-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-89-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-90-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-90-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-90-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-90-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-91-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-91-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-91-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-91-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-92-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-92-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-92-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-92-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-93-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-93-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-93-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-93-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-94-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-94-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-94-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-94-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-95-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-95-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-95-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-95-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-96-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-96-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-96-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-96-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-cyrillic-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-cyrillic-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-cyrillic-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-cyrillic-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-latin-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-latin-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-latin-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-latin-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-latin-ext-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-latin-ext-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-latin-ext-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-latin-ext-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-vietnamese-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-vietnamese-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-vietnamese-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-vietnamese-700-normal.woff2 +0 -0
package/dist/theme.d.ts
CHANGED
|
@@ -1,11 +1,28 @@
|
|
|
1
|
+
import { ThemePreset } from "./generated/themeDefaults.js";
|
|
1
2
|
export type ThemeSetting = 'auto' | 'light' | 'dark';
|
|
2
|
-
/**
|
|
3
|
+
/** The stored theme setting, 'auto' when there is none (and on the server). */
|
|
4
|
+
export declare function storedTheme(): ThemeSetting;
|
|
5
|
+
/** The preset on <html data-theme-preset>, or null (the light and dark themes). */
|
|
6
|
+
export declare function themePreset(): ThemePreset | null;
|
|
7
|
+
/** Switches the theme on <html data-theme> and remembers it. Under a preset the setting is remembered but the
|
|
8
|
+
* preset stays (the teaching preset is light only). */
|
|
3
9
|
export declare function setTheme(t: ThemeSetting): void;
|
|
4
|
-
/**
|
|
10
|
+
/** The accent the person picked (stored), with an old swatch value moved to its current one (and stored again);
|
|
11
|
+
* null when they picked none, so tokens.css decides. */
|
|
12
|
+
export declare function pickedAccent(): string | null;
|
|
13
|
+
/** The accent in use: the picked one, else the preset's accent, else the default (DEFAULT_ACCENT). */
|
|
14
|
+
export declare function storedAccent(): string;
|
|
15
|
+
/** Derives every accent token from one color (自訂強調色的換算 in docs/theme.md) and writes them on <html>.
|
|
5
16
|
* Returns false for anything but #rrggbb. quiet: apply without storing. */
|
|
6
17
|
export declare function setAccent(hex: string, quiet?: boolean): boolean;
|
|
7
|
-
/**
|
|
8
|
-
export declare function
|
|
18
|
+
/** Forgets the picked accent and removes the inline accent variables, so tokens.css (the theme or preset) decides. */
|
|
19
|
+
export declare function resetAccent(): void;
|
|
20
|
+
/** Applies the stored theme and accent; call once when the page starts. preset: a preset of tokens.json (such as
|
|
21
|
+
* 'teaching') that replaces light and dark, kept on <html data-theme-preset>; null removes it; without the option a
|
|
22
|
+
* data-theme-preset already on <html> is kept. Pages do not set data-theme themselves. */
|
|
23
|
+
export declare function initTheme(options?: {
|
|
24
|
+
preset?: ThemePreset | null;
|
|
25
|
+
}): void;
|
|
9
26
|
/** The text color for something drawn on a fill (a heat-scale zone, a status band): the near-black ink of the light
|
|
10
27
|
* theme (#171512) or white, whichever contrasts more with the fill. `fill` is a color (#hex, rgb()) or a token name
|
|
11
28
|
* such as 'heat-6', read from el (default: the root) so it follows the theme. Every step of heat-*, diverge-* and
|
|
@@ -17,4 +34,5 @@ export declare function heatToken(value: number, min: number, max: number): `hea
|
|
|
17
34
|
export declare function divergeToken(diff: number, limits: {
|
|
18
35
|
zero: number;
|
|
19
36
|
strong: number;
|
|
20
|
-
}): 'diverge-neg-strong' | 'diverge-neg' | 'diverge-zero' | 'diverge-pos' | 'diverge-pos-strong';
|
|
37
|
+
}): 'diverge-neg-strong' | 'diverge-neg' | 'diverge-zero' | 'diverge-pos' | 'diverge-pos-strong';
|
|
38
|
+
export type { ThemePreset };
|
package/dist/theme.js
CHANGED
|
@@ -1,33 +1,46 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { ensureAnnouncer } from "./announce.js";
|
|
3
|
-
import {
|
|
3
|
+
import { DEFAULT_ACCENT, GROUNDS, PRESETS } from "./generated/themeDefaults.js";
|
|
4
|
+
import { installFocusMain } from "./internal/focusMain.js";
|
|
5
|
+
import { readStored, writeStored } from "./internal/stored.js";
|
|
6
|
+
import { reduced } from "./internal/util.js";
|
|
4
7
|
// src/theme.ts
|
|
5
8
|
const THEME_KEY = "ui-theme";
|
|
6
9
|
const ACCENT_KEY = "ui-accent";
|
|
7
|
-
const
|
|
10
|
+
const PRESET_ATTR = "data-theme-preset";
|
|
8
11
|
const isSetting = (v) => v === "auto" || v === "light" || v === "dark";
|
|
9
|
-
|
|
12
|
+
const hasDom = () => typeof window !== "undefined" && typeof document !== "undefined";
|
|
13
|
+
/** A stored theme setting as text to the setting, 'auto' for anything else. */
|
|
14
|
+
const parseTheme = (raw) => isSetting(raw) ? raw : "auto";
|
|
15
|
+
/** The stored theme setting, 'auto' when there is none (and on the server). */
|
|
10
16
|
function storedTheme() {
|
|
11
|
-
|
|
12
|
-
|
|
17
|
+
return hasDom() ? parseTheme(readStored("ui-theme") ?? "") : "auto";
|
|
18
|
+
}
|
|
19
|
+
/** The preset on <html data-theme-preset>, or null (the light and dark themes). */
|
|
20
|
+
function themePreset() {
|
|
21
|
+
if (typeof document === "undefined") return null;
|
|
22
|
+
const v = document.documentElement.getAttribute(PRESET_ATTR);
|
|
23
|
+
return v && Object.hasOwn(PRESETS, v) ? v : null;
|
|
13
24
|
}
|
|
14
25
|
function resolveTheme(t) {
|
|
15
26
|
if (t !== "auto") return t;
|
|
16
27
|
return typeof window.matchMedia === "function" && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
17
28
|
}
|
|
18
29
|
let fadeTimer;
|
|
19
|
-
/** Switches the theme on <html data-theme> and remembers it.
|
|
30
|
+
/** Switches the theme on <html data-theme> and remembers it. Under a preset the setting is remembered but the
|
|
31
|
+
* preset stays (the teaching preset is light only). */
|
|
20
32
|
function setTheme(t) {
|
|
33
|
+
if (!hasDom()) return;
|
|
21
34
|
const root = document.documentElement;
|
|
22
35
|
if (!reduced()) {
|
|
23
36
|
root.classList.add("ui-theme-fade");
|
|
24
37
|
clearTimeout(fadeTimer);
|
|
25
38
|
fadeTimer = setTimeout(() => root.classList.remove("ui-theme-fade"), 320);
|
|
26
39
|
}
|
|
27
|
-
root.setAttribute("data-theme", resolveTheme(t));
|
|
40
|
+
root.setAttribute("data-theme", themePreset() ?? resolveTheme(t));
|
|
28
41
|
root.setAttribute("data-theme-setting", t);
|
|
29
|
-
|
|
30
|
-
|
|
42
|
+
writeStored(THEME_KEY, t);
|
|
43
|
+
applyAccent();
|
|
31
44
|
}
|
|
32
45
|
/** Swatches whose color changed so they read as text on every ground: a stored old value moves to the new one. */
|
|
33
46
|
const RENAMED_SWATCHES = {
|
|
@@ -38,13 +51,29 @@ const RENAMED_SWATCHES = {
|
|
|
38
51
|
"#1a844a": "#077b42",
|
|
39
52
|
"#0e827d": "#027874"
|
|
40
53
|
};
|
|
41
|
-
/**
|
|
54
|
+
/** A stored accent as text to #rrggbb, an old swatch value moved to its current one; null for anything else. */
|
|
55
|
+
function parseAccent(raw) {
|
|
56
|
+
const v = raw.trim().toLowerCase();
|
|
57
|
+
if (!/^#[0-9a-f]{6}$/.test(v)) return null;
|
|
58
|
+
return RENAMED_SWATCHES[v] ?? v;
|
|
59
|
+
}
|
|
60
|
+
/** The accent the person picked (stored), with an old swatch value moved to its current one (and stored again);
|
|
61
|
+
* null when they picked none, so tokens.css decides. */
|
|
62
|
+
function pickedAccent() {
|
|
63
|
+
if (!hasDom()) return null;
|
|
64
|
+
const raw = readStored(ACCENT_KEY);
|
|
65
|
+
const v = raw ? parseAccent(raw) : null;
|
|
66
|
+
if (v && v !== raw) writeStored(ACCENT_KEY, v);
|
|
67
|
+
return v;
|
|
68
|
+
}
|
|
69
|
+
/** The accent in use: the picked one, else the preset's accent, else the default (DEFAULT_ACCENT). */
|
|
42
70
|
function storedAccent() {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
71
|
+
return pickedAccent() ?? defaultAccent();
|
|
72
|
+
}
|
|
73
|
+
/** The accent tokens.css gives when nothing is picked: the preset's, else DEFAULT_ACCENT. */
|
|
74
|
+
function defaultAccent() {
|
|
75
|
+
const p = themePreset();
|
|
76
|
+
return p ? PRESETS[p].accent : DEFAULT_ACCENT;
|
|
48
77
|
}
|
|
49
78
|
const hexRgb = (x) => [
|
|
50
79
|
1,
|
|
@@ -105,7 +134,7 @@ function accentText(hex, dark, bg, surface, ...grounds) {
|
|
|
105
134
|
for (let k = 1; k * step <= 1 && !reads(text); k++) text = mixHex(hex, toward, k * step);
|
|
106
135
|
return text;
|
|
107
136
|
}
|
|
108
|
-
const INK =
|
|
137
|
+
const INK = GROUNDS.ink.light;
|
|
109
138
|
/** The text on an accent fill (on-accent): white or the near-black ink (#171512), whichever contrasts more. */
|
|
110
139
|
function onFill(fill) {
|
|
111
140
|
return contrast("#ffffff", fill) >= contrast(INK, fill) ? "#ffffff" : INK;
|
|
@@ -141,18 +170,30 @@ const ACCENT_SWATCHES = [
|
|
|
141
170
|
["綠", "#077b42"],
|
|
142
171
|
["青", "#027874"]
|
|
143
172
|
];
|
|
144
|
-
|
|
173
|
+
const ACCENT_VARS = [
|
|
174
|
+
"--accent",
|
|
175
|
+
"--accent-hover",
|
|
176
|
+
"--accent-press",
|
|
177
|
+
"--accent-soft",
|
|
178
|
+
"--accent-text",
|
|
179
|
+
"--on-accent",
|
|
180
|
+
"--focus",
|
|
181
|
+
"--focus-ring"
|
|
182
|
+
];
|
|
183
|
+
/** Derives every accent token from one color (自訂強調色的換算 in docs/theme.md) and writes them on <html>.
|
|
145
184
|
* Returns false for anything but #rrggbb. quiet: apply without storing. */
|
|
146
185
|
function setAccent(hex, quiet = false) {
|
|
147
186
|
if (!/^#[0-9a-fA-F]{6}$/.test(hex)) return false;
|
|
187
|
+
if (!hasDom()) return true;
|
|
148
188
|
hex = hex.toLowerCase();
|
|
149
189
|
const root = document.documentElement;
|
|
150
190
|
const dark = root.getAttribute("data-theme") === "dark";
|
|
191
|
+
const mode = dark ? "dark" : "light";
|
|
151
192
|
const cs = getComputedStyle(root);
|
|
152
|
-
const surface = toHex(cs.getPropertyValue("--surface")) ??
|
|
153
|
-
const bg = toHex(cs.getPropertyValue("--bg")) ??
|
|
154
|
-
const sub = toHex(cs.getPropertyValue("--surface-sub")) ??
|
|
155
|
-
const chrome = toHex(cs.getPropertyValue("--surface-chrome")) ??
|
|
193
|
+
const surface = toHex(cs.getPropertyValue("--surface")) ?? GROUNDS.surface[mode];
|
|
194
|
+
const bg = toHex(cs.getPropertyValue("--bg")) ?? GROUNDS.bg[mode];
|
|
195
|
+
const sub = toHex(cs.getPropertyValue("--surface-sub")) ?? GROUNDS["surface-sub"][mode];
|
|
196
|
+
const chrome = toHex(cs.getPropertyValue("--surface-chrome")) ?? GROUNDS["surface-chrome"][mode];
|
|
156
197
|
const soft = dark ? mixHex(surface, hex, .22) : mixHex("#ffffff", hex, .12);
|
|
157
198
|
const text = accentText(hex, dark, bg, surface, sub, chrome, soft);
|
|
158
199
|
const fill = accentFill(hex, dark, bg, surface, sub, chrome, soft);
|
|
@@ -168,14 +209,33 @@ function setAccent(hex, quiet = false) {
|
|
|
168
209
|
"--focus-ring": text
|
|
169
210
|
};
|
|
170
211
|
for (const [k, v] of Object.entries(vars)) root.style.setProperty(k, v);
|
|
171
|
-
if (!quiet)
|
|
212
|
+
if (!quiet) writeStored(ACCENT_KEY, hex);
|
|
172
213
|
return true;
|
|
173
214
|
}
|
|
215
|
+
/** Forgets the picked accent and removes the inline accent variables, so tokens.css (the theme or preset) decides. */
|
|
216
|
+
function resetAccent() {
|
|
217
|
+
if (!hasDom()) return;
|
|
218
|
+
for (const k of ACCENT_VARS) document.documentElement.style.removeProperty(k);
|
|
219
|
+
writeStored(ACCENT_KEY, null);
|
|
220
|
+
}
|
|
221
|
+
/** Applies the picked accent for the current theme, or removes the inline variables when none is picked. */
|
|
222
|
+
function applyAccent() {
|
|
223
|
+
const picked = pickedAccent();
|
|
224
|
+
if (picked) setAccent(picked, true);
|
|
225
|
+
else for (const k of ACCENT_VARS) document.documentElement.style.removeProperty(k);
|
|
226
|
+
}
|
|
174
227
|
let following = false;
|
|
175
|
-
/** Applies the stored theme and accent; call once when the page starts.
|
|
176
|
-
|
|
228
|
+
/** Applies the stored theme and accent; call once when the page starts. preset: a preset of tokens.json (such as
|
|
229
|
+
* 'teaching') that replaces light and dark, kept on <html data-theme-preset>; null removes it; without the option a
|
|
230
|
+
* data-theme-preset already on <html> is kept. Pages do not set data-theme themselves. */
|
|
231
|
+
function initTheme(options = {}) {
|
|
232
|
+
if (!hasDom()) return;
|
|
233
|
+
const root = document.documentElement;
|
|
234
|
+
if (options.preset === null) root.removeAttribute(PRESET_ATTR);
|
|
235
|
+
else if (options.preset) root.setAttribute(PRESET_ATTR, options.preset);
|
|
177
236
|
setTheme(storedTheme());
|
|
178
237
|
ensureAnnouncer();
|
|
238
|
+
installFocusMain();
|
|
179
239
|
if (following || typeof window.matchMedia !== "function") return;
|
|
180
240
|
following = true;
|
|
181
241
|
window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", () => {
|
|
@@ -205,6 +265,6 @@ function divergeToken(diff, limits) {
|
|
|
205
265
|
const strong = a >= limits.strong;
|
|
206
266
|
return diff < 0 ? strong ? "diverge-neg-strong" : "diverge-neg" : strong ? "diverge-pos-strong" : "diverge-pos";
|
|
207
267
|
}
|
|
208
|
-
export { ACCENT_KEY, ACCENT_SWATCHES, DEFAULT_ACCENT, accentFill, accentText, divergeToken, heatToken, initTheme, onFill, setAccent, setTheme, storedAccent, storedTheme, textOn, toHex };
|
|
268
|
+
export { ACCENT_KEY, ACCENT_SWATCHES, DEFAULT_ACCENT, THEME_KEY, accentFill, accentText, defaultAccent, divergeToken, heatToken, initTheme, onFill, parseAccent, parseTheme, pickedAccent, resetAccent, setAccent, setTheme, storedAccent, storedTheme, textOn, themePreset, toHex };
|
|
209
269
|
|
|
210
270
|
//# sourceMappingURL=theme.js.map
|
package/dist/theme.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.js","names":[],"sources":["../src/theme.ts"],"sourcesContent":["import { ensureAnnouncer } from './announce';\nimport { reduced, store } from './internal/util';\n\n/* Theme and accent color. 'auto' follows prefers-color-scheme; colors cross-fade for 300 ms on a change.\n The choice is kept in localStorage, so initTheme() on the next visit restores it. */\n\nexport type ThemeSetting = 'auto' | 'light' | 'dark';\n\nconst THEME_KEY = 'ui-theme';\nexport const ACCENT_KEY = 'ui-accent';\nexport const DEFAULT_ACCENT = '#2457d6';\n\nconst isSetting = (v: string | null): v is ThemeSetting => v === 'auto' || v === 'light' || v === 'dark';\n\n/** The stored theme setting, 'auto' when there is none. */\nexport function storedTheme(): ThemeSetting {\n const v = store(THEME_KEY);\n return isSetting(v) ? v : 'auto';\n}\n\nfunction resolveTheme(t: ThemeSetting): 'light' | 'dark' {\n if (t !== 'auto') return t;\n return typeof window.matchMedia === 'function' && window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';\n}\n\nlet fadeTimer: ReturnType<typeof setTimeout> | undefined;\n\n/** Switches the theme on <html data-theme> and remembers it. */\nexport function setTheme(t: ThemeSetting): void {\n const root = document.documentElement;\n if (!reduced()) {\n root.classList.add('ui-theme-fade');\n clearTimeout(fadeTimer);\n fadeTimer = setTimeout(() => root.classList.remove('ui-theme-fade'), 320);\n }\n root.setAttribute('data-theme', resolveTheme(t));\n root.setAttribute('data-theme-setting', t);\n store(THEME_KEY, t);\n // The accent's text and soft colors depend on the theme.\n setAccent(storedAccent(), true);\n}\n\n/** Swatches whose color changed so they read as text on every ground: a stored old value moves to the new one. */\nconst RENAMED_SWATCHES: Record<string, string> = {\n '#8a4fd6': '#864ad1',\n '#c2407a': '#ba3873',\n '#cd3a2f': '#c53228',\n '#b85a0e': '#ab5101',\n '#1a844a': '#077b42',\n '#0e827d': '#027874',\n};\n\n/** The stored accent, with an old swatch value moved to its current one (and stored again). */\nexport function storedAccent(): string {\n const v = store(ACCENT_KEY);\n if (!v) return DEFAULT_ACCENT;\n const now = RENAMED_SWATCHES[v.toLowerCase()];\n if (now) store(ACCENT_KEY, now);\n return now ?? v;\n}\n\nconst hexRgb = (x: string): number[] => [1, 3, 5].map((i) => parseInt(x.slice(i, i + 2), 16));\n\n/** A CSS color as #rrggbb: #rgb, #rgba, #rrggbb, #rrggbbaa (alpha dropped), rgb() and rgba() with commas or spaces.\n * null for anything else (a name, a var(), an empty value). Bundlers shorten #ffffff to #fff in tokens.css, so the\n * short form must read the same. */\nexport function toHex(c: string): string | null {\n const v = c.trim().toLowerCase();\n const short = /^#([0-9a-f])([0-9a-f])([0-9a-f])[0-9a-f]?$/.exec(v);\n if (short) return '#' + short[1] + short[1] + short[2] + short[2] + short[3] + short[3];\n const long = /^#([0-9a-f]{6})(?:[0-9a-f]{2})?$/.exec(v);\n if (long) return '#' + long[1];\n const fn = /^rgba?\\(\\s*([\\d.]+)[\\s,]+([\\d.]+)[\\s,]+([\\d.]+)(?:\\s*[,/]\\s*[\\d.]+%?)?\\s*\\)$/.exec(v);\n if (fn) {\n const n = fn.slice(1, 4).map(Number);\n if (n.every((x) => x >= 0 && x <= 255)) return '#' + n.map((x) => Math.round(x).toString(16).padStart(2, '0')).join('');\n }\n return null;\n}\n\nfunction mixHex(a: string, b: string, t: number): string {\n const p = hexRgb(a);\n const q = hexRgb(b);\n return (\n '#' +\n p\n .map((v, i) =>\n Math.round(v + (q[i] - v) * t)\n .toString(16)\n .padStart(2, '0'),\n )\n .join('')\n );\n}\n\nfunction lum(x: string): number {\n const w = [0.2126, 0.7152, 0.0722];\n return hexRgb(x)\n .map((v) => {\n v /= 255;\n return v <= 0.03928 ? v / 12.92 : ((v + 0.055) / 1.055) ** 2.4;\n })\n .reduce((s, v, i) => s + v * w[i], 0);\n}\n\nfunction contrast(a: string, b: string): number {\n const x = lum(a);\n const y = lum(b);\n return (Math.max(x, y) + 0.05) / (Math.min(x, y) + 0.05);\n}\n\n/** The accent's text color (accent-text, and the focus outline): the accent itself when it reads (4.5:1) on bg,\n * surface and every extra ground passed (setAccent passes surface-sub, surface-chrome and accent-soft); else, in\n * light, the accent mixed with black 4 % at a time, in dark with white 5 % at a time, until it reads on all of them. */\nexport function accentText(hex: string, dark: boolean, bg: string, surface: string, ...grounds: string[]): string {\n const all = [bg, surface, ...grounds].map(toHex);\n // A background that cannot be read: keep the accent itself rather than mixing it toward black or white blindly.\n if (all.some((g) => !g)) return hex;\n const reads = (c: string) => all.every((g) => contrast(c, g as string) >= 4.5);\n const toward = dark ? '#ffffff' : '#000000';\n const step = dark ? 0.05 : 0.04;\n let text = hex;\n for (let k = 1; k * step <= 1 && !reads(text); k++) text = mixHex(hex, toward, k * step);\n return text;\n}\n\nconst INK = '#171512';\n\n/** The text on an accent fill (on-accent): white or the near-black ink (#171512), whichever contrasts more. */\nexport function onFill(fill: string): '#ffffff' | '#171512' {\n return contrast('#ffffff', fill) >= contrast(INK, fill) ? '#ffffff' : INK;\n}\n\n/** The accent's fill color (accent: buttons, switches, progress, selected marks): the accent itself when it reaches\n * 3:1 on bg, surface and every extra ground passed (setAccent passes surface-sub, surface-chrome and accent-soft) and\n * its on-accent text reaches 4.5:1 on it; else, in light, the accent mixed with black 4 % at a time, in dark with\n * white 5 % at a time, until both hold. The preset swatches pass in light as they are. */\nexport function accentFill(hex: string, dark: boolean, bg: string, surface: string, ...grounds: string[]): string {\n const all = [bg, surface, ...grounds].map(toHex);\n if (all.some((g) => !g)) return hex;\n const ok = (c: string) => all.every((g) => contrast(c, g as string) >= 3) && contrast(onFill(c), c) >= 4.5;\n const toward = dark ? '#ffffff' : '#000000';\n const step = dark ? 0.05 : 0.04;\n let fill = hex;\n for (let k = 1; k * step <= 1 && !ok(fill); k++) fill = mixHex(hex, toward, k * step);\n return fill;\n}\n\n/** The preset swatches of AccentPicker. In light (and the teaching preset) each one reads as text by itself (4.5:1 on\n * bg, surface, surface-sub, surface-chrome and its own accent-soft), so accentText returns it unchanged; white text\n * reads on it (4.5:1). In dark, accentText lightens it. Checked in tokens-contrast.test.tsx. */\nexport const ACCENT_SWATCHES: readonly (readonly [name: string, hex: string])[] = [\n ['藍', '#2457d6'],\n ['靛', '#5b4fd6'],\n ['紫', '#864ad1'],\n ['桃紅', '#ba3873'],\n ['紅', '#c53228'],\n ['橘', '#ab5101'],\n ['綠', '#077b42'],\n ['青', '#027874'],\n];\n\n/** Derives every accent token from one color (自訂強調色的換算 in docs/theme.md).\n * Returns false for anything but #rrggbb. quiet: apply without storing. */\nexport function setAccent(hex: string, quiet = false): boolean {\n if (!/^#[0-9a-fA-F]{6}$/.test(hex)) return false;\n hex = hex.toLowerCase();\n const root = document.documentElement;\n const dark = root.getAttribute('data-theme') === 'dark';\n const cs = getComputedStyle(root);\n // Read the theme's colors as #rrggbb (bundlers may have shortened #ffffff to #fff); the theme's defaults when unset.\n const surface = toHex(cs.getPropertyValue('--surface')) ?? (dark ? '#393530' : '#ffffff');\n const bg = toHex(cs.getPropertyValue('--bg')) ?? (dark ? '#2f2a25' : '#fcfbfb');\n const sub = toHex(cs.getPropertyValue('--surface-sub')) ?? (dark ? '#443f3b' : '#f6f5f4');\n const chrome = toHex(cs.getPropertyValue('--surface-chrome')) ?? (dark ? '#3d3834' : '#ffffff');\n const soft = dark ? mixHex(surface, hex, 0.22) : mixHex('#ffffff', hex, 0.12);\n // Text in the accent also sits on zebra rows, code blocks, the top bar and its own soft fill (a selected row).\n const text = accentText(hex, dark, bg, surface, sub, chrome, soft);\n // The fill reaches 3:1 on the same grounds (a checked box in a selected row); hover and press go away from the page:\n // darker in light, lighter in dark, so they keep 3:1 and their text.\n const fill = accentFill(hex, dark, bg, surface, sub, chrome, soft);\n const away = dark ? '#ffffff' : '#000000';\n const vars: Record<string, string> = {\n '--accent': fill,\n '--accent-hover': mixHex(fill, away, 0.12),\n '--accent-press': mixHex(fill, away, 0.22),\n '--accent-soft': soft,\n '--accent-text': text,\n '--on-accent': onFill(fill),\n // One focus style everywhere: a 2 px outline in the accent's text color, 3:1 or more on every ground.\n '--focus': text,\n // Old name of --focus, kept for pages written before it.\n '--focus-ring': text,\n };\n for (const [k, v] of Object.entries(vars)) root.style.setProperty(k, v);\n if (!quiet) store(ACCENT_KEY, hex);\n return true;\n}\n\nlet following = false;\n\n/** Applies the stored theme and accent; call once when the page starts. */\nexport function initTheme(): void {\n setTheme(storedTheme());\n ensureAnnouncer();\n if (following || typeof window.matchMedia !== 'function') return;\n following = true;\n window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', () => {\n if (storedTheme() === 'auto') setTheme('auto');\n });\n}\n\n/** The text color for something drawn on a fill (a heat-scale zone, a status band): the near-black ink of the light\n * theme (#171512) or white, whichever contrasts more with the fill. `fill` is a color (#hex, rgb()) or a token name\n * such as 'heat-6', read from el (default: the root) so it follows the theme. Every step of heat-*, diverge-* and\n * chart-* reaches 4.5:1 with its pick. Unreadable colors give the near-black ink. */\nexport function textOn(fill: string, el?: Element): '#171512' | '#ffffff' {\n let c = fill.trim();\n if (/^[a-z][a-z0-9-]*$/.test(c) && typeof document !== 'undefined') c = getComputedStyle(el ?? document.documentElement).getPropertyValue('--' + c);\n const hex = toHex(c);\n if (!hex) return '#171512';\n return contrast(hex, '#171512') >= contrast(hex, '#ffffff') ? '#171512' : '#ffffff';\n}\n\n/** The heat-scale token for a value: min (or below) is heat-1, max (or above) is heat-7, evenly in between. */\nexport function heatToken(value: number, min: number, max: number): `heat-${1 | 2 | 3 | 4 | 5 | 6 | 7}` {\n const t = max > min ? (value - min) / (max - min) : 0;\n const step = Math.min(7, Math.max(1, Math.round(t * 6) + 1)) as 1 | 2 | 3 | 4 | 5 | 6 | 7;\n return `heat-${step}`;\n}\n\n/** The diverging-scale token for a difference: within ±zero it is diverge-zero; from ±strong on, the -strong step. */\nexport function divergeToken(\n diff: number,\n limits: { zero: number; strong: number },\n): 'diverge-neg-strong' | 'diverge-neg' | 'diverge-zero' | 'diverge-pos' | 'diverge-pos-strong' {\n const a = Math.abs(diff);\n if (a <= limits.zero) return 'diverge-zero';\n const strong = a >= limits.str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AY,GAAG;CACjC,OAAO;AACT;AAEA,IAAI,YAAY;;AAGhB,SAAgB,YAAkB;CAChC,SAAS,YAAY,CAAC;CACtB,gBAAgB;CAChB,IAAI,aAAa,OAAO,OAAO,eAAe,YAAY;CAC1D,YAAY;CACZ,OAAO,WAAW,8BAA8B,CAAC,CAAC,iBAAiB,gBAAgB;EACjF,IAAI,YAAY,MAAM,QAAQ,SAAS,MAAM;CAC/C,CAAC;AACH;;;;;AAMA,SAAgB,OAAO,MAAc,IAAqC;CACxE,IAAI,IAAI,KAAK,KAAK;CAClB,IAAI,oBAAoB,KAAK,CAAC,KAAK,OAAO,aAAa,aAAa,IAAI,iBAAiB,MAAM,SAAS,eAAe,CAAC,CAAC,iBAAiB,OAAO,CAAC;CAClJ,MAAM,MAAM,MAAM,CAAC;CACnB,IAAI,CAAC,KAAK,OAAO;CACjB,OAAO,SAAS,KAAK,SAAS,KAAK,SAAS,KAAK,SAAS,IAAI,YAAY;AAC5E;;AAGA,SAAgB,UAAU,OAAe,KAAa,KAAkD;CACtG,MAAM,IAAI,MAAM,OAAO,QAAQ,QAAQ,MAAM,OAAO;CAEpD,OAAO,QADM,KAAK,IAAI,GAAG,KAAK,IAAI,GAAG,KAAK,MAAM,IAAI,CAAC,IAAI,CAAC,CACxC;AACpB;;AAGA,SAAgB,aACd,MACA,QAC8F;CAC9F,MAAM,IAAI,KAAK,IAAI,IAAI;CACvB,IAAI,KAAK,OAAO,MAAM,OAAO;CAC7B,MAAM,SAAS,KAAK,OAAO;CAC3B,OAAO,OAAO,IAAK,SAAS,uBAAuB,gBAAiB,SAAS,uBAAuB;AACtG"}
|
|
1
|
+
{"version":3,"file":"theme.js","names":[],"sources":["../src/theme.ts"],"sourcesContent":["import { ensureAnnouncer } from './announce';\nimport { DEFAULT_ACCENT, GROUNDS, PRESETS, type ThemePreset } from './generated/themeDefaults';\nimport { installFocusMain } from './internal/focusMain';\nimport { readStored, writeStored } from './internal/stored';\nimport { reduced } from './internal/util';\n\n/* Theme and accent color. 'auto' follows prefers-color-scheme; colors cross-fade for 300 ms on a change.\n The choice is kept in localStorage, so initTheme() on the next visit restores it. A preset (data-theme-preset on\n <html>, or initTheme({ preset })) replaces light and dark: the teaching preset is light only. The accent comes from\n tokens.css until the person picks one (setAccent); only then are inline --accent variables written. */\n\nexport type ThemeSetting = 'auto' | 'light' | 'dark';\nexport type { ThemePreset };\nexport { DEFAULT_ACCENT };\n\nexport const THEME_KEY = 'ui-theme';\nexport const ACCENT_KEY = 'ui-accent';\nconst PRESET_ATTR = 'data-theme-preset';\n\nconst isSetting = (v: string | null): v is ThemeSetting => v === 'auto' || v === 'light' || v === 'dark';\nconst hasDom = () => typeof window !== 'undefined' && typeof document !== 'undefined';\n\n/** A stored theme setting as text to the setting, 'auto' for anything else. */\nexport const parseTheme = (raw: string): ThemeSetting => (isSetting(raw) ? raw : 'auto');\n\n/** The stored theme setting, 'auto' when there is none (and on the server). */\nexport function storedTheme(): ThemeSetting {\n return hasDom() ? parseTheme(readStored(THEME_KEY) ?? '') : 'auto';\n}\n\n/** The preset on <html data-theme-preset>, or null (the light and dark themes). */\nexport function themePreset(): ThemePreset | null {\n if (typeof document === 'undefined') return null;\n const v = document.documentElement.getAttribute(PRESET_ATTR);\n return v && Object.hasOwn(PRESETS, v) ? (v as ThemePreset) : null;\n}\n\nfunction resolveTheme(t: ThemeSetting): 'light' | 'dark' {\n if (t !== 'auto') return t;\n return typeof window.matchMedia === 'function' && window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';\n}\n\nlet fadeTimer: ReturnType<typeof setTimeout> | undefined;\n\n/** Switches the theme on <html data-theme> and remembers it. Under a preset the setting is remembered but the\n * preset stays (the teaching preset is light only). */\nexport function setTheme(t: ThemeSetting): void {\n if (!hasDom()) return;\n const root = document.documentElement;\n if (!reduced()) {\n root.classList.add('ui-theme-fade');\n clearTimeout(fadeTimer);\n fadeTimer = setTimeout(() => root.classList.remove('ui-theme-fade'), 320);\n }\n root.setAttribute('data-theme', themePreset() ?? resolveTheme(t));\n root.setAttribute('data-theme-setting', t);\n writeStored(THEME_KEY, t);\n // The accent's text and soft colors depend on the theme.\n applyAccent();\n}\n\n/** Swatches whose color changed so they read as text on every ground: a stored old value moves to the new one. */\nconst RENAMED_SWATCHES: Record<string, string> = {\n '#8a4fd6': '#864ad1',\n '#c2407a': '#ba3873',\n '#cd3a2f': '#c53228',\n '#b85a0e': '#ab5101',\n '#1a844a': '#077b42',\n '#0e827d': '#027874',\n};\n\n/** A stored accent as text to #rrggbb, an old swatch value moved to its current one; null for anything else. */\nexport function parseAccent(raw: string): string | null {\n const v = raw.trim().toLowerCase();\n if (!/^#[0-9a-f]{6}$/.test(v)) return null;\n return RENAMED_SWATCHES[v] ?? v;\n}\n\n/** The accent the person picked (stored), with an old swatch value moved to its current one (and stored again);\n * null when they picked none, so tokens.css decides. */\nexport function pickedAccent(): string | null {\n if (!hasDom()) return null;\n const raw = readStored(ACCENT_KEY);\n const v = raw ? parseAccent(raw) : null;\n if (v && v !== raw) writeStored(ACCENT_KEY, v);\n return v;\n}\n\n/** The accent in use: the picked one, else the preset's accent, else the default (DEFAULT_ACCENT). */\nexport function storedAccent(): string {\n return pickedAccent() ?? defaultAccent();\n}\n\n/** The accent tokens.css gives when nothing is picked: the preset's, else DEFAULT_ACCENT. */\nexport function defaultAccent(): string {\n const p = themePreset();\n return p ? PRESETS[p].accent : DEFAULT_ACCENT;\n}\n\nconst hexRgb = (x: string): number[] => [1, 3, 5].map((i) => parseInt(x.slice(i, i + 2), 16));\n\n/** A CSS color as #rrggbb: #rgb, #rgba, #rrggbb, #rrggbbaa (alpha dropped), rgb() and rgba() with commas or spaces.\n * null for anything else (a name, a var(), an empty value). Bundlers shorten #ffffff to #fff in tokens.css, so the\n * short form must read the same. */\nexport function toHex(c: string): string | null {\n const v = c.trim().toLowerCase();\n const short = /^#([0-9a-f])([0-9a-f])([0-9a-f])[0-9a-f]?$/.exec(v);\n if (short) return '#' + short[1] + short[1] + short[2] + short[2] + short[3] + short[3];\n const long = /^#([0-9a-f]{6})(?:[0-9a-f]{2})?$/.exec(v);\n if (long) return '#' + long[1];\n const fn = /^rgba?\\(\\s*([\\d.]+)[\\s,]+([\\d.]+)[\\s,]+([\\d.]+)(?:\\s*[,/]\\s*[\\d.]+%?)?\\s*\\)$/.exec(v);\n if (fn) {\n const n = fn.slice(1, 4).map(Number);\n if (n.every((x) => x >= 0 && x <= 255)) return '#' + n.map((x) => Math.round(x).toString(16).padStart(2, '0')).join('');\n }\n return null;\n}\n\nfunction mixHex(a: string, b: string, t: number): string {\n const p = hexRgb(a);\n const q = hexRgb(b);\n return (\n '#' +\n p\n .map((v, i) =>\n Math.round(v + (q[i] - v) * t)\n .toString(16)\n .padStart(2, '0'),\n )\n .join('')\n );\n}\n\nfunction lum(x: string): number {\n const w = [0.2126, 0.7152, 0.0722];\n return hexRgb(x)\n .map((v) => {\n v /= 255;\n return v <= 0.03928 ? v / 12.92 : ((v + 0.055) / 1.055) ** 2.4;\n })\n .reduce((s, v, i) => s + v * w[i], 0);\n}\n\nfunction contrast(a: string, b: string): number {\n const x = lum(a);\n const y = lum(b);\n return (Math.max(x, y) + 0.05) / (Math.min(x, y) + 0.05);\n}\n\n/** The accent's text color (accent-text, and the focus outline): the accent itself when it reads (4.5:1) on bg,\n * surface and every extra ground passed (setAccent passes surface-sub, surface-chrome and accent-soft); else, in\n * light, the accent mixed with black 4 % at a time, in dark with white 5 % at a time, until it reads on all of them. */\nexport function accentText(hex: string, dark: boolean, bg: string, surface: string, ...grounds: string[]): string {\n const all = [bg, surface, ...grounds].map(toHex);\n // A background that cannot be read: keep the accent itself rather than mixing it toward black or white blindly.\n if (all.some((g) => !g)) return hex;\n const reads = (c: string) => all.every((g) => contrast(c, g as string) >= 4.5);\n const toward = dark ? '#ffffff' : '#000000';\n const step = dark ? 0.05 : 0.04;\n let text = hex;\n for (let k = 1; k * step <= 1 && !reads(text); k++) text = mixHex(hex, toward, k * step);\n return text;\n}\n\nconst INK = GROUNDS.ink.light;\n\n/** The text on an accent fill (on-accent): white or the near-black ink (#171512), whichever contrasts more. */\nexport function onFill(fill: string): '#ffffff' | '#171512' {\n return contrast('#ffffff', fill) >= contrast(INK, fill) ? '#ffffff' : INK;\n}\n\n/** The accent's fill color (accent: buttons, switches, progress, selected marks): the accent itself when it reaches\n * 3:1 on bg, surface and every extra ground passed (setAccent passes surface-sub, surface-chrome and accent-soft) and\n * its on-accent text reaches 4.5:1 on it; else, in light, the accent mixed with black 4 % at a time, in dark with\n * white 5 % at a time, until both hold. The preset swatches pass in light as they are. */\nexport function accentFill(hex: string, dark: boolean, bg: string, surface: string, ...grounds: string[]): string {\n const all = [bg, surface, ...grounds].map(toHex);\n if (all.some((g) => !g)) return hex;\n const ok = (c: string) => all.every((g) => contrast(c, g as string) >= 3) && contrast(onFill(c), c) >= 4.5;\n const toward = dark ? '#ffffff' : '#000000';\n const step = dark ? 0.05 : 0.04;\n let fill = hex;\n for (let k = 1; k * step <= 1 && !ok(fill); k++) fill = mixHex(hex, toward, k * step);\n return fill;\n}\n\n/** The preset swatches of AccentPicker. In light (and the teaching preset) each one reads as text by itself (4.5:1 on\n * bg, surface, surface-sub, surface-chrome and its own accent-soft), so accentText returns it unchanged; white text\n * reads on it (4.5:1). In dark, accentText lightens it. Checked in tokens-contrast.test.tsx. */\nexport const ACCENT_SWATCHES: readonly (readonly [name: string, hex: string])[] = [\n ['藍', '#2457d6'],\n ['靛', '#5b4fd6'],\n ['紫', '#864ad1'],\n ['桃紅', '#ba3873'],\n ['紅', '#c53228'],\n ['橘', '#ab5101'],\n ['綠', '#077b42'],\n ['青', '#027874'],\n];\n\nconst ACCENT_VARS = ['--accent', '--accent-hover', '--accent-press', '--accent-soft', '--accent-text', '--on-accent', '--focus', '--focus-ring'];\n\n/** Derives every accent token from one color (自訂強調色的換算 in docs/theme.md) and writes them on <html>.\n * Returns false for anything but #rrggbb. quiet: apply without storing. */\nexport function setAccent(hex: string, quiet = false): boolean {\n if (!/^#[0-9a-fA-F]{6}$/.test(hex)) return false;\n if (!hasDom()) return true;\n hex = hex.toLowerCase();\n const root = document.documentElement;\n const dark = root.getAttribute('data-theme') === 'dark';\n const mode = dark ? 'dark' : 'light';\n const cs = getComputedStyle(root);\n // Read the theme's colors as #rrggbb (bundlers may have shortened #ffffff to #fff); the theme's defaults when unset.\n const surface = toHex(cs.getPropertyValue('--surface')) ?? GROUNDS.surface[mode];\n const bg = toHex(cs.getPropertyValue('--bg')) ?? GROUNDS.bg[mode];\n const sub = toHex(cs.getPropertyValue('--surface-sub')) ?? GROUNDS['surface-sub'][mode];\n const chrome = toHex(cs.getPropertyValue('--surface-chrome')) ?? GROUNDS['surface-chrome'][mode];\n const soft = dark ? mixHex(surface, hex, 0.22) : mixHex('#ffffff', hex, 0.12);\n // Text in the accent also sits on zebra rows, code blocks, the top bar and its own soft fill (a selected row).\n const text = accentText(hex, dark, bg, surface, sub, chrome, soft);\n // The fill reaches 3:1 on the same grounds (a checked box in a selected row); hover and press go away from the page:\n // darker in light, lighter in dark, so they keep 3:1 and their text.\n const fill = accentFill(hex, dark, bg, surface, sub, chrome, soft);\n const away = dark ? '#ffffff' : '#000000';\n const vars: Record<string, string> = {\n '--accent': fill,\n '--accent-hover': mixHex(fill, away, 0.12),\n '--accent-press': mixHex(fill, away, 0.22),\n '--accent-soft': soft,\n '--accent-text': text,\n '--on-accent': onFill(fill),\n // One focus style everywhere: a 2 px outline in the accent's text color, 3:1 or more on every ground.\n '--focus': text,\n // Old name of --focus, kept for pages written before it.\n '--focus-ring': text,\n };\n for (const [k, v] of Object.entries(vars)) root.style.setProperty(k, v);\n if (!quiet) writeStored(ACCENT_KEY, hex);\n return true;\n}\n\n/** Forgets the picked accent and removes the inline accent variables, so tokens.css (the theme or preset) decides. */\nexport function resetAccent(): void {\n if (!hasDom()) return;\n for (const k of ACCENT_VARS) document.documentElement.style.removeProperty(k);\n writeStored(ACCENT_KEY, null);\n}\n\n/** Applies the picked accent for the current theme, or removes the inline variables when none is picked. */\nfunction applyAccent(): void {\n const picked = pickedAccent();\n if (picked) setAccent(picked, true);\n else for (const k of ACCENT_VARS) document.documentElement.style.removeProperty(k);\n}\n\nlet following = false;\n\n/** Applies the stored theme and accent; call once when the page starts. preset: a preset of tokens.json (such as\n * 'teaching') that replaces light and dark, kept on <html data-theme-preset>; null removes it; without the option a\n * data-theme-preset already on <html> is kept. Pages do not set data-theme themselves. */\nexport function initTheme(options: { preset?: ThemePreset | null } = {}): void {\n if (!hasDom()) return;\n const root = document.documentElement;\n if (options.preset === null) root.removeAttribute(PRESET_ATTR);\n else if (options.preset) root.setAttribute(PRESET_ATTR, options.preset);\n setTheme(storedTheme());\n ensureAnnouncer();\n installFocusMain();\n if (following || typeof window.matchMedia !== 'function') return;\n following = true;\n window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', () => {\n if (storedTheme() === 'auto') setTheme('auto');\n });\n}\n\n/** The text color for something drawn on a fill (a heat-scale zone, a status band): the near-black ink of the light\n * theme (#171512) or white, whichever contrasts more with the fill. `fill` is a color (#hex, rgb()) or a token name\n * such as 'heat-6', read from el (default: the root) so it follows the theme. Every step of heat-*, diverge-* and\n * chart-* reaches 4.5:1 with its pick. Unreadable colors give the near-black ink. */\nexport function textOn(fill: string, el?: Element): '#171512' | '#ffffff' {\n let c = fill.trim();\n if (/^[a-z][a-z0-9-]*$/.test(c) && typeof document !== 'undefined') c = getComputedStyle(el ?? document.documentElement).getPropertyValue('--' + c);\n const hex = toHex(c);\n if (!hex) return '#171512';\n return contrast(hex, '#171512') >= contrast(hex, '#ffffff') ? '#171512' : '#ffffff';\n}\n\n/** The heat-scale token for a value: min (or below) is heat-1, max (or above) is heat-7, evenly in between. */\nexport function heatToken(value: number, min: number, max: number): `heat-${1 | 2 | 3 | 4 | 5 | 6 | 7}` {\n const t = max > min ? (value - min) / (max - min) : 0;\n const step = Math.min(7, Math.max(1, Math.round(t * 6) + 1)) as 1 | 2 | 3 | 4 | 5 | 6 | 7;\n return `heat-${step}`;\n}\n\n/** The diverging-scale token for a difference: within ±zero it is diverge-zero; from ±strong on, the -strong step. */\nexport function divergeToken(\n diff: number,\n limits: { zero: number; strong: number },\n): 'diverge-neg-strong' | 'diverge-neg' | 'diverge-zero' | 'diverge-pos' | 'diverge-pos-strong' {\n const a = Math.abs(diff);\n if (a <= limits.zero) return 'diverge-zero';\n const strong = a >= limits.strong;\n return diff < 0 ? (strong ? 'diverge-neg-strong' : 'diverge-neg') : strong ? 'diverge-pos-strong' : 'diverge-pos';\n}\n"],"mappings":";;;;;;;AAeA,MAAa,YAAY;AACzB,MAAa,aAAa;AAC1B,MAAM,cAAc;AAEpB,MAAM,aAAa,MAAwC,MAAM,UAAU,MAAM,WAAW,MAAM;AAClG,MAAM,eAAe,OAAO,WAAW,eAAe,OAAO,aAAa;;AAG1E,MAAa,cAAc,QAA+B,UAAU,GAAG,IAAI,MAAM;;AAGjF,SAAgB,cAA4B;CAC1C,OAAO,OAAO,IAAI,WAAW,WAAA,UAAoB,KAAK,EAAE,IAAI;AAC9D;;AAGA,SAAgB,cAAkC;CAChD,IAAI,OAAO,aAAa,aAAa,OAAO;CAC5C,MAAM,IAAI,SAAS,gBAAgB,aAAa,WAAW;CAC3D,OAAO,KAAK,OAAO,OAAO,SAAS,CAAC,IAAK,IAAoB;AAC/D;AAEA,SAAS,aAAa,GAAmC;CACvD,IAAI,MAAM,QAAQ,OAAO;CACzB,OAAO,OAAO,OAAO,eAAe,cAAc,OAAO,WAAW,8BAA8B,CAAC,CAAC,UAAU,SAAS;AACzH;AAEA,IAAI;;;AAIJ,SAAgB,SAAS,GAAuB;CAC9C,IAAI,CAAC,OAAO,GAAG;CACf,MAAM,OAAO,SAAS;CACtB,IAAI,CAAC,QAAQ,GAAG;EACd,KAAK,UAAU,IAAI,eAAe;EAClC,aAAa,SAAS;EACtB,YAAY,iBAAiB,KAAK,UAAU,OAAO,eAAe,GAAG,GAAG;CAC1E;CACA,KAAK,aAAa,cAAc,YAAY,K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AAK,OAAO;CAC3B,OAAO,OAAO,IAAK,SAAS,uBAAuB,gBAAiB,SAAS,uBAAuB;AACtG"}
|
package/dist/tokens.css
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
@layer ui.tokens, ui.components;
|
|
4
4
|
@layer ui.tokens {
|
|
5
5
|
:root {
|
|
6
|
+
color-scheme: light;
|
|
6
7
|
--bg: #fcfbfb;
|
|
7
8
|
--surface: #ffffff;
|
|
8
9
|
--surface-sub: #f6f5f4;
|
|
@@ -154,6 +155,7 @@
|
|
|
154
155
|
--font-mono: "Geist Mono", "Noto Sans TC", ui-monospace, monospace;
|
|
155
156
|
}
|
|
156
157
|
[data-theme="dark"] {
|
|
158
|
+
color-scheme: dark;
|
|
157
159
|
--bg: #2f2a25;
|
|
158
160
|
--surface: #393530;
|
|
159
161
|
--surface-sub: #443f3b;
|
|
@@ -213,6 +215,7 @@
|
|
|
213
215
|
--shadow-overlay: 0 20px 48px rgba(0, 0, 0, 0.5);
|
|
214
216
|
}
|
|
215
217
|
[data-theme="teaching"] {
|
|
218
|
+
color-scheme: light;
|
|
216
219
|
--accent: #027874;
|
|
217
220
|
--accent-hover: #026a66;
|
|
218
221
|
--accent-press: #025e5a;
|
package/docs/AccentPicker.md
CHANGED
|
@@ -12,12 +12,14 @@
|
|
|
12
12
|
```
|
|
13
13
|
|
|
14
14
|
- 不傳 `onChange` 時直接呼叫 `setAccent()`,重新算出所有強調相關 token 並存在 localStorage;頁面載入時呼叫一次 `initTheme()` 套用。
|
|
15
|
+
- 使用者沒選過時,勾選的是目前主題或 preset 的預設強調色(teaching 是青),而且不寫任何 inline 變數;要回到預設用 `resetAccent()`。
|
|
15
16
|
- 不放在頂部列。
|
|
17
|
+
- 上方有看得見的標籤「強調色」(`label` 可改),也是色票整組的名稱。
|
|
16
18
|
- 選很淺或很深的顏色時,文字色 `accent-text` 自動加深或調亮;填色仍是選的顏色。
|
|
17
19
|
|
|
18
20
|
## 細節
|
|
19
21
|
|
|
20
22
|
- 色票:藍、靛、紫、桃紅、紅、橘、綠、青;選中的色票外圍一圈同色外框並打勾。
|
|
21
|
-
- 色碼欄位:輸入 # 加 6
|
|
23
|
+
- 色碼欄位:輸入 # 加 6 碼就立即套用;打字途中(「#2」)不算錯,離開欄位或按 Enter 時才檢查,格式不正確時框變紅、出現警告圖示,下方寫「色碼格式不正確,請輸入 # 加 6 碼,例如 #2457d6」。提示和錯誤都連到欄位的 `aria-describedby`。
|
|
22
24
|
- 換算方式見 theme.md 的「自訂強調色的換算」(`ui docs theme`):填色、hover、按下、淺底、文字色與焦點外框(`focus`)都由強調色算出;填色在深色主題會調亮到 3:1。
|
|
23
25
|
- 文字一定讀得清楚:選了很淺(淺色主題)或很深(深色主題)的強調色時,`accent-text` 會自動加深或調亮,直到對 `bg` 與 `surface` 都有 4.5:1,例如淺色主題選 `#ffe066` 時連結、選中的分頁文字變成 `#7a6c31`。按鈕、進度條、選取框這些填色仍是選的顏色;按鈕上的字由 `on-accent` 選白色或深色。
|
package/docs/Alert.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## 用法
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
頁面或區塊內持續顯示的提示:白底卡片,左邊狀態圖示。操作完成的短暫提示用 Toast;要使用者決定的用 Dialog。
|
|
6
6
|
|
|
7
7
|
```tsx
|
|
8
8
|
<Alert tone="warning" title="憑證 3 天後到期" actionLabel="更新" onAction={renew}>
|
|
@@ -12,9 +12,10 @@
|
|
|
12
12
|
|
|
13
13
|
- 四種 `tone`:`info`、`success`、`warning`、`danger`。
|
|
14
14
|
- 只有 `info` 與 `success` 能關閉(傳 `onDismiss`);`warning` 與 `danger` 不能關閉。
|
|
15
|
-
-
|
|
15
|
+
- 動作是內文下方的 40 px 外框按鈕(`actionLabel`、`onAction`),文字只用動詞;有沒有「✕」都從同一個位置開始。
|
|
16
16
|
- 本身就是卡片:單獨使用時不再包一層 Card;放進 Card 時自動拿掉陰影。
|
|
17
17
|
|
|
18
18
|
## 細節
|
|
19
19
|
|
|
20
|
-
- 外型:`surface` 底色、`shadow-card` 陰影、`radius-md`
|
|
20
|
+
- 外型:`surface` 底色、`shadow-card` 陰影、`radius-md` 圓角,沒有色條;狀態只靠圖示(形狀不同)和它的顏色,`info` 的圖示是 `accent-text`。
|
|
21
|
+
- 「✕」40 px,在右上角。
|
package/docs/AppShell.md
CHANGED
|
@@ -25,22 +25,23 @@ Dashboard 類頁面的外框:側邊欄、頂部列和內容區,平板的導
|
|
|
25
25
|
</AppShell>
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
-
- `title`
|
|
29
|
-
-
|
|
28
|
+
- `title` 是頁面標題(清單頁、Dashboard、設定頁);詳細頁不給,名稱寫在 `PageHeader`。和 PageHeader 或 SettingsLayout 的 `title` 重複時開發模式會提醒。
|
|
29
|
+
- 麵包屑是內容最上方的 `<Breadcrumb>`;`breadcrumb` prop 已停用。
|
|
30
|
+
- `tags`:頂部列標題旁的標記,例如整頁都是示範值時的 `<Tag icon="info">示範資料</Tag>`。
|
|
30
31
|
- 頂部列右邊放 `onSearch`(接 CommandPalette)和 `actions`(NotificationBell、ProjectSwitcher)。
|
|
31
32
|
- 換頁後呼叫 `focusMain()`;變化用 `announce(text)` 念出(見下方「無障礙」)。
|
|
32
33
|
|
|
33
34
|
## 細節
|
|
34
35
|
|
|
35
|
-
-
|
|
36
|
+
- 1024 px 以上:側邊欄預設不釘選,平常是 72 px 的圖示列,點圖示就能換頁。
|
|
36
37
|
- 滑鼠停在圖示列上 100 ms,展開成 240 px,疊在內容上、帶陰影,內容不移動;滑鼠離開 300 ms 後收回。用 Tab 移進側邊欄時也會展開,焦點離開或按 Esc 時收回;選了頁面後收回。
|
|
37
|
-
- 左下角的圖釘按鈕「釘選側邊欄」:釘選後側邊欄固定在內容旁邊(240 px),旁邊多一個收合按鈕,可以收合成 72 px
|
|
38
|
-
-
|
|
38
|
+
- 左下角的圖釘按鈕「釘選側邊欄」:釘選後側邊欄固定在內容旁邊(240 px),旁邊多一個收合按鈕,可以收合成 72 px。圖釘變成實心強調色,按了「取消釘選」回到自動展開。
|
|
39
|
+
- 釘選和收合都記在瀏覽器。
|
|
39
40
|
- `defaultPinned`:沒有存過選擇時是否一開始就釘選,預設 false。
|
|
40
|
-
- 平板和窄視窗(600 到 1024 px
|
|
41
|
+
- 平板和窄視窗(600 到 1023 px):沒有側邊欄,內容用滿整個寬度;頂部列左邊有選單按鈕(「開啟導覽」),點了從左邊打開完整導覽的抽屜,選了頁面後關閉。1024 px 是導覽自己的邊界,頁面排版的斷點(600、960、1280 px)不受影響。
|
|
41
42
|
- 手機(小於 600 px):沒有側邊欄,最上層有圖示的項目變成底部分頁列,有子頁面的項目開啟第一個子頁面。分頁列到不了的頁面(沒有圖示、第 5 個以後、第二個以後的子頁面)放在最後一格「更多」,開啟完整的導覽。
|
|
42
|
-
-
|
|
43
|
-
- 內容區自己捲動,四周留 24 px(手機 16 px
|
|
43
|
+
- 頂部列:頁面標題和 `tags`,右邊放搜尋、NotificationBell、ProjectSwitcher、帳號選單(`<Menu icon="user" label="帳號" items={…} />`)。往下捲時隱藏,往上捲時出現。
|
|
44
|
+
- 內容區自己捲動,四周留 24 px(手機 16 px)。
|
|
44
45
|
|
|
45
46
|
## 品牌(brand)
|
|
46
47
|
|
|
@@ -55,12 +56,12 @@ Dashboard 類頁面的外框:側邊欄、頂部列和內容區,平板的導
|
|
|
55
56
|
- `mark` 的位置在每個狀態都一樣:中心對齊下面項目的圖示(離左邊 31 px),展開時不移動。`mark` 最大 24 × 24 px。
|
|
56
57
|
- 只傳文字(`brand="專案中心"`)或沒給 `mark`:用名稱的第一個字放在 24 px 的強調色方塊裡當 `mark`(「專」)。沒有 `href` 時不是連結,螢幕閱讀器念完整名稱。
|
|
57
58
|
- `onClick` 可以代替 `href`(例如 app 自己切換頁面)。
|
|
58
|
-
-
|
|
59
|
+
- 傳一個元素(`brand={<a href="/">…</a>}`)時元件分不出哪部分是 logo,收合時整塊藏起來;開發模式會提醒改用 `{ mark, name, href }`。
|
|
59
60
|
- 平板抽屜和手機的「更多」導覽不受影響。
|
|
60
61
|
|
|
61
62
|
## 無障礙
|
|
62
63
|
|
|
63
64
|
- 第一個可以 Tab 到的是「跳到主要內容」連結,平常看不到,聚焦時出現在左上角;按了把焦點移到內容。
|
|
64
|
-
- 內容區是 `main` landmark
|
|
65
|
+
- 內容區是 `main` landmark(`id="main"`,「跳到主要內容」連到這裡)。
|
|
65
66
|
- `focusMain()`:把焦點移到內容的第一個標題(`main` 裡的 `h1`/`h2`,沒有時用頂部列的標題),再沒有時移到 `main`。app 換頁後呼叫,例如從 CommandPalette 選了結果打開另一頁。標題沒有焦點框:最近一次是用鍵盤操作(Tab、Enter、方向鍵)時,標題左邊出現 3 px 強調色條;用滑鼠或觸控換頁時不顯示任何樣式,焦點仍在標題上,螢幕閱讀器照樣從新頁開始念。
|
|
66
67
|
- `announce(text)`:用頁面上唯一的 polite live region 告訴螢幕閱讀器發生了什麼,不移動焦點,例如 `announce('已儲存')`。元件自己會播報:TreeList 展開、DataTable 篩選或搜尋後的筆數、CommandPalette 的結果數、Tabs 和 SideNav 換頁。
|
package/docs/Badge.md
CHANGED
|
@@ -2,27 +2,37 @@
|
|
|
2
2
|
|
|
3
3
|
## 用法
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
項目的狀態(進度、結果、連線):狀態圓圈加文字,沒有底色和陰影。說明「這是什麼」的分類用 Tag。
|
|
6
6
|
|
|
7
7
|
```tsx
|
|
8
8
|
<Badge status="doing" />
|
|
9
|
-
<Badge status="fail"
|
|
9
|
+
<Badge status="fail">部署失敗</Badge>
|
|
10
|
+
<Badge tone="success">已付款</Badge>
|
|
10
11
|
```
|
|
11
12
|
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
13
|
+
- 常用狀態用 `status` 預設(名稱、顏色、圓圈形狀都定好);其他狀態給 `tone` 加文字:`neutral`、`info`、`success`、`warning`、`danger`。
|
|
14
|
+
- 只有要處理的狀態醒目:`warning`、`danger` 的文字上色加粗,其他文字是 `ink-muted` 一般粗細,顏色只在圓圈上。
|
|
15
|
+
- 狀態不只靠顏色:一定有文字,圓圈的形狀也不同(`fail` 是 ×,不是和 `done` 一樣的實心圓)。
|
|
16
|
+
- 字級跟著旁邊的文字(表格裡和其他格子一樣大,頁首和頁首的文字一樣大),不必另外設定。
|
|
17
|
+
- 常見狀態:已啟用 `<Badge tone="success">已啟用</Badge>`;已停用、已取消用 `status="closed"` 加文字(「已停用」「已取消」);連線用 `online`、`offline`。
|
|
18
|
+
|
|
19
|
+
## 預設狀態
|
|
20
|
+
|
|
21
|
+
| status | 文字 | tone | 圓圈 |
|
|
22
|
+
| --------- | ------ | --------- | -------------- |
|
|
23
|
+
| `draft` | 草稿 | `neutral` | 空心 |
|
|
24
|
+
| `doing` | 進行中 | `info` | 半滿 |
|
|
25
|
+
| `review` | 審核中 | `warning` | 四分之一 |
|
|
26
|
+
| `done` | 完成 | `success` | 全滿 |
|
|
27
|
+
| `fail` | 失敗 | `danger` | 空心加 × |
|
|
28
|
+
| `closed` | 已關閉 | `neutral` | 空心加橫線 |
|
|
29
|
+
| `online` | 在線 | `success` | 全滿 |
|
|
30
|
+
| `offline` | 離線 | `neutral` | 空心加斜線 |
|
|
31
|
+
|
|
32
|
+
- `children` 換文字(「已取消」、「已停用」用 `closed`);`tone` 換顏色,圓圈形狀照 `status`。
|
|
33
|
+
- 只給 `tone` 時的圓圈:`neutral` 空心、`info` 半滿、`success` 全滿、`warning` 空心加 !、`danger` 空心加 ×。
|
|
15
34
|
|
|
16
35
|
## 細節
|
|
17
36
|
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
- 圓點樣式(`Card`、`DataTable` 裡,或 `variant="dot"`):只有要注意的狀態用該狀態的文字色:`fail` 用 `danger-text`、`review` 用 `warning-text`、`doing` 用 `accent-text`;`done` 和 `draft` 用 `ink-muted`,讓需要處理的項目先被看到。字級和旁邊的文字相同(表格裡和其他格子一樣大);需要注意的三種加粗,`done`、`draft` 用一般粗細。進度圓圈保留各自的顏色和形狀。
|
|
21
|
-
|
|
22
|
-
| status | 文字 | 進度圓圈 | 顏色 |
|
|
23
|
-
| -------- | ------ | -------- | ------------- |
|
|
24
|
-
| `draft` | 草稿 | 空心 | `ink-muted` |
|
|
25
|
-
| `doing` | 進行中 | 半滿 | `accent-text` |
|
|
26
|
-
| `review` | 審核中 | 四分之一 | `warning-text` |
|
|
27
|
-
| `done` | 完成 | 全滿 | `success-text` |
|
|
28
|
-
| `fail` | 失敗 | 全滿 | `danger-text` |
|
|
37
|
+
- 圓圈 15 px,顏色:`neutral` 用 `ink-muted`、`info` 用 `accent-text`、`success` 用 `success-text`、`warning` 用 `warning-text`、`danger` 用 `danger-text`。這些文字色在任何底色(含表格滑過、斑馬紋與選中的列)上都至少 3:1。
|
|
38
|
+
- 強制色彩模式(Windows 高對比)下圓圈用系統文字色,形狀仍分得出狀態。
|
package/docs/BarChart.md
CHANGED
|
@@ -15,12 +15,15 @@
|
|
|
15
15
|
/>
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
-
- `label` 必填,是圖表的無障礙名稱;`unit`
|
|
19
|
-
-
|
|
20
|
-
-
|
|
18
|
+
- `label` 必填,是圖表的無障礙名稱;`unit` 寫在數值後面,也寫在 y 軸上方(13 px 以下的 `ink-muted` 小字)。
|
|
19
|
+
- 數值上萬時給 `format="compact"`:軸和數值卡片寫「50 萬」「1.5 億」(英文 1.5M),不寫「1,500,000」。不給時 y 軸的寬度也會依標籤量,不會畫到卡片外。
|
|
20
|
+
- 和旁邊較高的卡片並排時給 `height="fill"`:長條區填滿 Card 剩下的高度(最矮 160 px),不留空白;預設 200 px,也可以給數字(px)。
|
|
21
|
+
- 顏色 `chart-1`,柱子頂部 4 px 圓角,間距 8 px。滑過或用鍵盤移到柱子時,上方浮起卡片顯示數值。
|
|
21
22
|
|
|
22
23
|
## 細節
|
|
23
24
|
|
|
24
25
|
- 格線為淡色虛線;滑過時其他柱子變淡。
|
|
25
|
-
-
|
|
26
|
+
- y 軸刻度是 1、2 或 5 乘 10 的次方(不會出現 12.5、37.5),3 到 5 格,最上面一格是第一個大於等於最大值的刻度(最大 128 萬時軸到 150 萬,不到 200 萬)。數值有小數(`decimals`)或範圍小於 3 時才有小數刻度。給 `max` 時軸的上限是 `max`,整除不了時平分 4 格。
|
|
27
|
+
- y 軸的寬度量的是實際畫出的刻度文字(字型晚載入、讀者加大字距時重新量)。
|
|
28
|
+
- 鍵盤:圖可以用 Tab 移到(有 2 px `focus` 外框),← → 在柱子之間移動、Home/End 到第一根/最後一根,和滑過一樣顯示數值卡片,螢幕閱讀器念「名稱:數值 單位」。圖是 `role="application"`(`aria-roledescription`「長條圖」),讓螢幕閱讀器把方向鍵交給圖;同樣的數值也在圖後面一個只給螢幕閱讀器的表格裡(第一欄項目、第二欄數值),用一般的表格瀏覽方式就能讀。
|
|
26
29
|
- 進場時一根接一根長高,間隔 40 ms。
|
package/docs/Button.md
CHANGED
|
@@ -13,16 +13,15 @@
|
|
|
13
13
|
</Button>
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
- `
|
|
17
|
-
- `secondary`(預設):外框 `line-strong`,其他一般動作。
|
|
18
|
-
- `quiet`:沒有外框和底色,`ink-muted` 文字,滑過時 `surface-sub` 底色;用在次要的動作和工具列。
|
|
16
|
+
- 層級:`primary` 實心,每個區塊(一張卡片、一個表單)最多一個;`secondary`(預設)外框;`quiet` 無框,給次要的動作和工具列。
|
|
19
17
|
- `danger`:實心 `danger`,用在刪除等無法復原的動作。一定要確認:給 `confirm={{ title, body }}`,按下時先跳出 Dialog,按 Dialog 裡的紅色按鈕才執行 `onClick`;放在確認框裡的那顆按鈕本身改給 `confirmed`。兩者都沒給時型別檢查不會過。
|
|
20
18
|
- 按鈕文字只用動詞,例如「儲存」、「刪除」,不寫「確定」。
|
|
21
|
-
- `loading`
|
|
19
|
+
- `loading` 顯示轉圈,按了不執行(`aria-disabled` 加 `aria-busy`,不設 `disabled`),焦點留在按鈕上;文字改成進行式(「儲存中」)。
|
|
22
20
|
|
|
23
21
|
## 細節
|
|
24
22
|
|
|
25
|
-
-
|
|
23
|
+
- 按鈕在有焦點時被停用(例如按下後變成不能再按),焦點會移到同一組裡前一個控制項,不會掉到頁面最上面。
|
|
24
|
+
- 狀態:滑過變深(`accent-hover`)、按下下移 1 px(`accent-press`)、停用為 `surface-sub` 灰底加 `ink-muted` 灰字(`quiet` 也一樣);停用的 `primary` 保留淡淡的 `accent-soft` 底色,看得出它是主要動作,字一樣是 `ink-muted`(4.5:1)。
|
|
26
25
|
- 四種樣式高度、圓角與焦點外框(2 px `focus`,離按鈕 2 px)都相同。
|
|
27
26
|
- 高度 `control-height` 40 px;觸控點擊範圍 `touch-target` 48 px(按鈕外觀不變,外圍擴大可點範圍)。
|
|
28
27
|
- `icon`:Phosphor 圖示名稱(例如 `'plus'`,拼錯時型別檢查不會過),或自訂圖示的 24 px path(`'M4 12h16'`)。
|
package/docs/Calendar.md
CHANGED
|
@@ -8,12 +8,12 @@
|
|
|
8
8
|
const [day, setDay] = useState<Date | null>(null);
|
|
9
9
|
|
|
10
10
|
<Card>
|
|
11
|
-
<Calendar
|
|
11
|
+
<Calendar month={day} onPick={setDay} dayState={(d) => ({ selected: d.toDateString() === day?.toDateString() })} />
|
|
12
12
|
</Card>;
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
- 每一天的樣子由 `dayState` 決定:`selected`、`inRange`、`start`、`end`、`disabled`。
|
|
16
|
-
- 點日期呼叫 `onPick
|
|
16
|
+
- 點日期呼叫 `onPick`。`month` 是要顯示的月份:值改變時月曆跟著換頁(例如外面選了別的日期);只要決定一開始的月份用 `defaultMonth`。用箭頭換月時呼叫 `onMonthChange`。舊的 `focus` 仍可用,開發模式會提醒改名。
|
|
17
17
|
|
|
18
18
|
## 細節
|
|
19
19
|
|
package/docs/Card.md
CHANGED
|
@@ -10,19 +10,20 @@
|
|
|
10
10
|
</Card>
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
-
|
|
13
|
+
- 卡片裡不放卡片。TreeList、KpiCard、Alert、SettingsSection、DangerZone 本身就有卡片樣式:單獨使用時直接當成區塊,不要再包一層;放進 Card 時會自動拿掉自己的陰影,TreeList 也拿掉底色。
|
|
14
14
|
- 自己寫的區塊不要另外加陰影,改用 Card;卡片裡要再分區時用 `surface-sub` 底色或分隔線。
|
|
15
|
-
-
|
|
15
|
+
- 卡片裡放表格時,DataTable 不給 `caption`,給 `label`;Card 什麼時候給 `title` 見 guidelines 的「常見頁面」。
|
|
16
16
|
- `padding={false}`:沒有內距,給整張卡片放表格或樹狀清單時用。
|
|
17
17
|
|
|
18
18
|
## 細節
|
|
19
19
|
|
|
20
|
-
- `title` 和 `actions`:標題列,左邊標題,右邊按鈕。沒有 `title`
|
|
21
|
-
- `padding: false` 時,標題列、DataTable
|
|
20
|
+
- `title` 和 `actions`:標題列,左邊標題,右邊按鈕。沒有 `title` 時按鈕一樣靠右,左邊不留空位。標題至少保留 8 個字:按鈕放不下時換到標題下一列、靠右,標題不會被截成「訂..」。
|
|
21
|
+
- `padding: false` 時,標題列、DataTable 的工具列(含摘要)、頁碼和「向右捲動」提示仍留 16 px 左右內距,表格本身貼齊卡片左右兩邊(拿掉表格自己的左右框線與圓角)。表格下方沒有頁碼和提示時,最後一列直接到卡片底邊,不留空白,也不多一條底線。
|
|
22
22
|
- DataTable 的 `label` 讓螢幕閱讀器念表格名稱,放大表格的對話框也用它當標題。`caption` 留給沒有包在 Card 裡、直接放在頁面上的表格。
|
|
23
23
|
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
```tsx
|
|
25
|
+
<Card title="流程" actions={<Button icon="funnel">篩選</Button>}>
|
|
26
|
+
<Tabs … />
|
|
27
|
+
<TreeList kind="plain" items={items} height={640} /> {/* 沒有自己的陰影 */}
|
|
28
|
+
</Card>
|
|
28
29
|
```
|
package/docs/Checkbox.md
CHANGED
|
@@ -8,7 +8,9 @@
|
|
|
8
8
|
<Checkbox checked={agree} onChange={setAgree} label="同意服務條款" />
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
-
|
|
11
|
+
- `label` 或 `aria-label` 一定要有一個(型別檢查)。
|
|
12
|
+
- 受控用 `checked` 加 `onChange(checked, event)`;只要預設值、讓它自己記住時用 `defaultChecked`。給 `name` 時勾選後隨表單送出。
|
|
13
|
+
- 整列(框加文字)都可以點,高度 40 px,文字 15 px(`text-control`),和輸入框、選單選項同一個大小。
|
|
12
14
|
- `checked="mixed"` 顯示橫線,給「只勾了一部分」的上層項目。
|
|
13
15
|
- 所有勾選框(包括表格的欄位選單、篩選和多選的選項)都用同一個勾。
|
|
14
16
|
|
|
@@ -16,4 +18,5 @@
|
|
|
16
18
|
|
|
17
19
|
- 方框 22 px,小圓角(`radius-sm`),未勾選時 2 px `line-strong` 邊框。
|
|
18
20
|
- 勾選後強調色實心,白色勾號以描繪動畫(200 ms)畫出。
|
|
21
|
+
- 強制色彩模式(Windows 高對比):勾選與「部分」的橫線改用系統的 Highlight 色,不會消失。
|
|
19
22
|
- 鍵盤 focus 時整列(框加文字)外圍出現 2 px `focus` 外框,和其他控制項相同。
|