@seanyeh77/ui 0.40.0 → 0.42.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/README.md +32 -0
- package/dist/announce.d.ts +3 -0
- package/dist/announce.js +35 -0
- package/dist/announce.js.map +1 -0
- package/dist/bundle.js +19 -19
- package/dist/bundle.js.map +1 -1
- package/dist/components/AccentPicker/AccentPicker.d.ts +12 -0
- package/dist/components/AccentPicker/AccentPicker.js +96 -0
- package/dist/components/AccentPicker/AccentPicker.js.map +1 -0
- package/dist/components/ActionBar/ActionBar.d.ts +27 -0
- package/dist/components/ActionBar/ActionBar.js +62 -0
- package/dist/components/ActionBar/ActionBar.js.map +1 -0
- package/dist/components/AiMark/AiMark.d.ts +10 -0
- package/dist/components/AiMark/AiMark.js +21 -0
- package/dist/components/AiMark/AiMark.js.map +1 -0
- package/dist/components/Alert/Alert.d.ts +17 -0
- package/dist/components/Alert/Alert.js +56 -0
- package/dist/components/Alert/Alert.js.map +1 -0
- package/dist/components/AppShell/AppShell.d.ts +36 -0
- package/dist/components/AppShell/AppShell.js +195 -0
- package/dist/components/AppShell/AppShell.js.map +1 -0
- package/dist/components/Badge/Badge.d.ts +12 -0
- package/dist/components/Badge/Badge.js +58 -0
- package/dist/components/Badge/Badge.js.map +1 -0
- package/dist/components/BarChart/BarChart.d.ts +19 -0
- package/dist/components/BarChart/BarChart.js +78 -0
- package/dist/components/BarChart/BarChart.js.map +1 -0
- package/dist/components/Breadcrumb/Breadcrumb.d.ts +11 -0
- package/dist/components/Breadcrumb/Breadcrumb.js +29 -0
- package/dist/components/Breadcrumb/Breadcrumb.js.map +1 -0
- package/dist/components/Button/Button.d.ts +39 -0
- package/dist/components/Button/Button.js +54 -0
- package/dist/components/Button/Button.js.map +1 -0
- package/dist/components/Calendar/Calendar.d.ts +18 -0
- package/dist/components/Calendar/Calendar.js +125 -0
- package/dist/components/Calendar/Calendar.js.map +1 -0
- package/dist/components/Card/Card.d.ts +14 -0
- package/dist/components/Card/Card.js +33 -0
- package/dist/components/Card/Card.js.map +1 -0
- package/dist/components/Checkbox/Checkbox.d.ts +14 -0
- package/dist/components/Checkbox/Checkbox.js +27 -0
- package/dist/components/Checkbox/Checkbox.js.map +1 -0
- package/dist/components/CodeView/CodeView.d.ts +111 -0
- package/dist/components/CodeView/CodeView.js +790 -0
- package/dist/components/CodeView/CodeView.js.map +1 -0
- package/dist/components/CodeView/tokens.d.ts +5 -0
- package/dist/components/CodeView/tokens.js +70 -0
- package/dist/components/CodeView/tokens.js.map +1 -0
- package/dist/components/CommandPalette/CommandPalette.d.ts +52 -0
- package/dist/components/CommandPalette/CommandPalette.js +242 -0
- package/dist/components/CommandPalette/CommandPalette.js.map +1 -0
- package/dist/components/ConsoleLayout/ConsoleLayout.d.ts +44 -0
- package/dist/components/ConsoleLayout/ConsoleLayout.js +119 -0
- package/dist/components/ConsoleLayout/ConsoleLayout.js.map +1 -0
- package/dist/components/DangerZone/DangerZone.d.ts +16 -0
- package/dist/components/DangerZone/DangerZone.js +28 -0
- package/dist/components/DangerZone/DangerZone.js.map +1 -0
- package/dist/components/DataTable/DataTable.d.ts +99 -0
- package/dist/components/DataTable/DataTable.js +1267 -0
- package/dist/components/DataTable/DataTable.js.map +1 -0
- package/dist/components/DataTable/SortButton.js +222 -0
- package/dist/components/DataTable/SortButton.js.map +1 -0
- package/dist/components/DataTable/filters.js +147 -0
- package/dist/components/DataTable/filters.js.map +1 -0
- package/dist/components/DataTable/parts.js +373 -0
- package/dist/components/DataTable/parts.js.map +1 -0
- package/dist/components/DataTable/types.d.ts +85 -0
- package/dist/components/DatePicker/DatePicker.d.ts +15 -0
- package/dist/components/DatePicker/DatePicker.js +104 -0
- package/dist/components/DatePicker/DatePicker.js.map +1 -0
- package/dist/components/DateRangePicker/DateRangePicker.d.ts +11 -0
- package/dist/components/DateRangePicker/DateRangePicker.js +88 -0
- package/dist/components/DateRangePicker/DateRangePicker.js.map +1 -0
- package/dist/components/DetailList/DetailList.d.ts +17 -0
- package/dist/components/DetailList/DetailList.js +18 -0
- package/dist/components/DetailList/DetailList.js.map +1 -0
- package/dist/components/Dialog/Dialog.d.ts +30 -0
- package/dist/components/Dialog/Dialog.js +87 -0
- package/dist/components/Dialog/Dialog.js.map +1 -0
- package/dist/components/Drawer/Drawer.d.ts +20 -0
- package/dist/components/Drawer/Drawer.js +64 -0
- package/dist/components/Drawer/Drawer.js.map +1 -0
- package/dist/components/EmptyState/EmptyState.d.ts +15 -0
- package/dist/components/EmptyState/EmptyState.js +34 -0
- package/dist/components/EmptyState/EmptyState.js.map +1 -0
- package/dist/components/ErrorPage/ErrorPage.d.ts +14 -0
- package/dist/components/ErrorPage/ErrorPage.js +47 -0
- package/dist/components/ErrorPage/ErrorPage.js.map +1 -0
- package/dist/components/EventTimeline/EventTimeline.d.ts +19 -0
- package/dist/components/EventTimeline/EventTimeline.js +63 -0
- package/dist/components/EventTimeline/EventTimeline.js.map +1 -0
- package/dist/components/FileUpload/FileUpload.d.ts +27 -0
- package/dist/components/FileUpload/FileUpload.js +121 -0
- package/dist/components/FileUpload/FileUpload.js.map +1 -0
- package/dist/components/FormGrid/FormGrid.d.ts +7 -0
- package/dist/components/FormGrid/FormGrid.js +14 -0
- package/dist/components/FormGrid/FormGrid.js.map +1 -0
- package/dist/components/Graph/Graph.d.ts +18 -0
- package/dist/components/Graph/Graph.js +97 -0
- package/dist/components/Graph/Graph.js.map +1 -0
- package/dist/components/Grid/Grid.d.ts +16 -0
- package/dist/components/Grid/Grid.js +21 -0
- package/dist/components/Grid/Grid.js.map +1 -0
- package/dist/components/IconButton/IconButton.d.ts +32 -0
- package/dist/components/IconButton/IconButton.js +104 -0
- package/dist/components/IconButton/IconButton.js.map +1 -0
- package/dist/components/InlineCode/InlineCode.d.ts +46 -0
- package/dist/components/InlineCode/InlineCode.js +71 -0
- package/dist/components/InlineCode/InlineCode.js.map +1 -0
- package/dist/components/KpiCard/KpiCard.d.ts +38 -0
- package/dist/components/KpiCard/KpiCard.js +116 -0
- package/dist/components/KpiCard/KpiCard.js.map +1 -0
- package/dist/components/LayerGraph/LayerGraph.d.ts +117 -0
- package/dist/components/LayerGraph/LayerGraph.js +1644 -0
- package/dist/components/LayerGraph/LayerGraph.js.map +1 -0
- package/dist/components/LineChart/LineChart.d.ts +73 -0
- package/dist/components/LineChart/LineChart.js +337 -0
- package/dist/components/LineChart/LineChart.js.map +1 -0
- package/dist/components/LoadingBar/LoadingBar.d.ts +7 -0
- package/dist/components/LoadingBar/LoadingBar.js +18 -0
- package/dist/components/LoadingBar/LoadingBar.js.map +1 -0
- package/dist/components/LoginCard/LoginCard.d.ts +23 -0
- package/dist/components/LoginCard/LoginCard.js +113 -0
- package/dist/components/LoginCard/LoginCard.js.map +1 -0
- package/dist/components/Markdown/Markdown.d.ts +38 -0
- package/dist/components/Markdown/Markdown.js +716 -0
- package/dist/components/Markdown/Markdown.js.map +1 -0
- package/dist/components/Menu/Menu.d.ts +33 -0
- package/dist/components/Menu/Menu.js +75 -0
- package/dist/components/Menu/Menu.js.map +1 -0
- package/dist/components/Meter/Meter.d.ts +20 -0
- package/dist/components/Meter/Meter.js +120 -0
- package/dist/components/Meter/Meter.js.map +1 -0
- package/dist/components/MobileTabBar/MobileTabBar.d.ts +21 -0
- package/dist/components/MobileTabBar/MobileTabBar.js +47 -0
- package/dist/components/MobileTabBar/MobileTabBar.js.map +1 -0
- package/dist/components/MultiSelect/MultiSelect.d.ts +25 -0
- package/dist/components/MultiSelect/MultiSelect.js +116 -0
- package/dist/components/MultiSelect/MultiSelect.js.map +1 -0
- package/dist/components/NotificationBell/NotificationBell.d.ts +20 -0
- package/dist/components/NotificationBell/NotificationBell.js +92 -0
- package/dist/components/NotificationBell/NotificationBell.js.map +1 -0
- package/dist/components/Popover/Popover.d.ts +20 -0
- package/dist/components/Popover/Popover.js +48 -0
- package/dist/components/Popover/Popover.js.map +1 -0
- package/dist/components/ProgressBar/ProgressBar.d.ts +10 -0
- package/dist/components/ProgressBar/ProgressBar.js +38 -0
- package/dist/components/ProgressBar/ProgressBar.js.map +1 -0
- package/dist/components/ProgressRing/ProgressRing.d.ts +11 -0
- package/dist/components/ProgressRing/ProgressRing.js +53 -0
- package/dist/components/ProgressRing/ProgressRing.js.map +1 -0
- package/dist/components/ProjectSwitcher/ProjectSwitcher.d.ts +25 -0
- package/dist/components/ProjectSwitcher/ProjectSwitcher.js +97 -0
- package/dist/components/ProjectSwitcher/ProjectSwitcher.js.map +1 -0
- package/dist/components/RadioGroup/RadioGroup.d.ts +18 -0
- package/dist/components/RadioGroup/RadioGroup.js +63 -0
- package/dist/components/RadioGroup/RadioGroup.js.map +1 -0
- package/dist/components/SearchField/SearchField.d.ts +9 -0
- package/dist/components/SearchField/SearchField.js +46 -0
- package/dist/components/SearchField/SearchField.js.map +1 -0
- package/dist/components/Section/Section.d.ts +50 -0
- package/dist/components/Section/Section.js +220 -0
- package/dist/components/Section/Section.js.map +1 -0
- package/dist/components/SegmentedControl/SegmentedControl.d.ts +23 -0
- package/dist/components/SegmentedControl/SegmentedControl.js +86 -0
- package/dist/components/SegmentedControl/SegmentedControl.js.map +1 -0
- package/dist/components/Select/Select.d.ts +31 -0
- package/dist/components/Select/Select.js +138 -0
- package/dist/components/Select/Select.js.map +1 -0
- package/dist/components/SettingsLayout/SettingsLayout.d.ts +27 -0
- package/dist/components/SettingsLayout/SettingsLayout.js +69 -0
- package/dist/components/SettingsLayout/SettingsLayout.js.map +1 -0
- package/dist/components/SideNav/SideNav.d.ts +48 -0
- package/dist/components/SideNav/SideNav.js +220 -0
- package/dist/components/SideNav/SideNav.js.map +1 -0
- package/dist/components/Skeleton/Skeleton.d.ts +8 -0
- package/dist/components/Skeleton/Skeleton.js +17 -0
- package/dist/components/Skeleton/Skeleton.js.map +1 -0
- package/dist/components/SplitPane/SplitPane.d.ts +23 -0
- package/dist/components/SplitPane/SplitPane.js +140 -0
- package/dist/components/SplitPane/SplitPane.js.map +1 -0
- package/dist/components/StatusBand/StatusBand.d.ts +31 -0
- package/dist/components/StatusBand/StatusBand.js +43 -0
- package/dist/components/StatusBand/StatusBand.js.map +1 -0
- package/dist/components/Suggestion/Suggestion.d.ts +22 -0
- package/dist/components/Suggestion/Suggestion.js +72 -0
- package/dist/components/Suggestion/Suggestion.js.map +1 -0
- package/dist/components/Switch/Switch.d.ts +11 -0
- package/dist/components/Switch/Switch.js +56 -0
- package/dist/components/Switch/Switch.js.map +1 -0
- package/dist/components/Tabs/Tabs.d.ts +23 -0
- package/dist/components/Tabs/Tabs.js +117 -0
- package/dist/components/Tabs/Tabs.js.map +1 -0
- package/dist/components/Tag/Tag.d.ts +13 -0
- package/dist/components/Tag/Tag.js +22 -0
- package/dist/components/Tag/Tag.js.map +1 -0
- package/dist/components/Term/Term.d.ts +34 -0
- package/dist/components/Term/Term.js +138 -0
- package/dist/components/Term/Term.js.map +1 -0
- package/dist/components/TextArea/TextArea.d.ts +15 -0
- package/dist/components/TextArea/TextArea.js +75 -0
- package/dist/components/TextArea/TextArea.js.map +1 -0
- package/dist/components/TextField/TextField.d.ts +15 -0
- package/dist/components/TextField/TextField.js +43 -0
- package/dist/components/TextField/TextField.js.map +1 -0
- package/dist/components/ThemePicker/ThemePicker.d.ts +13 -0
- package/dist/components/ThemePicker/ThemePicker.js +66 -0
- package/dist/components/ThemePicker/ThemePicker.js.map +1 -0
- package/dist/components/TimeControl/TimeControl.d.ts +19 -0
- package/dist/components/TimeControl/TimeControl.js +47 -0
- package/dist/components/TimeControl/TimeControl.js.map +1 -0
- package/dist/components/Toast/Toast.d.ts +10 -0
- package/dist/components/Toast/Toast.js +27 -0
- package/dist/components/Toast/Toast.js.map +1 -0
- package/dist/components/Tooltip/Tooltip.d.ts +17 -0
- package/dist/components/Tooltip/Tooltip.js +69 -0
- package/dist/components/Tooltip/Tooltip.js.map +1 -0
- package/dist/components/TopBar/TopBar.d.ts +18 -0
- package/dist/components/TopBar/TopBar.js +55 -0
- package/dist/components/TopBar/TopBar.js.map +1 -0
- package/dist/components/Tour/Tour.d.ts +44 -0
- package/dist/components/Tour/Tour.js +440 -0
- package/dist/components/Tour/Tour.js.map +1 -0
- package/dist/components/TreeList/TreeList.d.ts +90 -0
- package/dist/components/TreeList/TreeList.js +588 -0
- package/dist/components/TreeList/TreeList.js.map +1 -0
- package/dist/components/TreeList/helpers.d.ts +2 -0
- package/dist/components/TreeList/helpers.js +104 -0
- package/dist/components/TreeList/helpers.js.map +1 -0
- package/dist/components/Workbench/Workbench.d.ts +100 -0
- package/dist/components/Workbench/Workbench.js +1137 -0
- package/dist/components/Workbench/Workbench.js.map +1 -0
- package/dist/components/ZoneMap/ZoneMap.d.ts +49 -0
- package/dist/components/ZoneMap/ZoneMap.js +89 -0
- package/dist/components/ZoneMap/ZoneMap.js.map +1 -0
- package/dist/css/AccentPicker.css +49 -0
- package/dist/css/ActionBar.css +36 -0
- package/dist/css/AiMark.css +14 -0
- package/dist/css/Alert.css +80 -0
- package/dist/css/AppShell.css +81 -0
- package/dist/css/Badge.css +68 -0
- package/dist/css/BarChart.css +66 -0
- package/dist/css/Breadcrumb.css +33 -0
- package/dist/css/Button.css +190 -0
- package/dist/css/Calendar.css +96 -0
- package/dist/css/Card.css +70 -0
- package/dist/css/Checkbox.css +38 -0
- package/dist/css/CodeView.css +302 -0
- package/dist/css/CommandPalette.css +232 -0
- package/dist/css/ConsoleLayout.css +131 -0
- package/dist/css/DangerZone.css +32 -0
- package/dist/css/DataTable.css +1195 -0
- package/dist/css/DatePicker.css +38 -0
- package/dist/css/DateRangePicker.css +70 -0
- package/dist/css/DetailList.css +69 -0
- package/dist/css/Dialog.css +3 -0
- package/dist/css/Drawer.css +90 -0
- package/dist/css/EmptyState.css +61 -0
- package/dist/css/ErrorPage.css +40 -0
- package/dist/css/EventTimeline.css +43 -0
- package/dist/css/FileUpload.css +92 -0
- package/dist/css/FormGrid.css +17 -0
- package/dist/css/Graph.css +99 -0
- package/dist/css/Grid.css +48 -0
- package/dist/css/IconButton.css +149 -0
- package/dist/css/InlineCode.css +92 -0
- package/dist/css/KpiCard.css +121 -0
- package/dist/css/LayerGraph.css +575 -0
- package/dist/css/LineChart.css +3 -0
- package/dist/css/LoadingBar.css +45 -0
- package/dist/css/LoginCard.css +65 -0
- package/dist/css/Markdown.css +266 -0
- package/dist/css/Menu.css +88 -0
- package/dist/css/Meter.css +110 -0
- package/dist/css/MobileTabBar.css +63 -0
- package/dist/css/MultiSelect.css +78 -0
- package/dist/css/NotificationBell.css +129 -0
- package/dist/css/Popover.css +57 -0
- package/dist/css/ProgressBar.css +42 -0
- package/dist/css/ProgressRing.css +19 -0
- package/dist/css/ProjectSwitcher.css +153 -0
- package/dist/css/RadioGroup.css +52 -0
- package/dist/css/SearchField.css +79 -0
- package/dist/css/Section.css +115 -0
- package/dist/css/SegmentedControl.css +67 -0
- package/dist/css/Select.css +136 -0
- package/dist/css/SettingsLayout.css +110 -0
- package/dist/css/SideNav.css +281 -0
- package/dist/css/Skeleton.css +19 -0
- package/dist/css/SplitPane.css +108 -0
- package/dist/css/StatusBand.css +23 -0
- package/dist/css/Suggestion.css +82 -0
- package/dist/css/Switch.css +46 -0
- package/dist/css/Tabs.css +91 -0
- package/dist/css/Tag.css +36 -0
- package/dist/css/Term.css +160 -0
- package/dist/css/TextArea.css +22 -0
- package/dist/css/TextField.css +2 -0
- package/dist/css/ThemePicker.css +70 -0
- package/dist/css/TimeControl.css +33 -0
- package/dist/css/Toast.css +47 -0
- package/dist/css/Tooltip.css +58 -0
- package/dist/css/TopBar.css +86 -0
- package/dist/css/Tour.css +90 -0
- package/dist/css/TreeList.css +532 -0
- package/dist/css/Workbench.css +652 -0
- package/dist/css/ZoneMap.css +203 -0
- package/dist/css/base.css +556 -0
- package/dist/css/end.css +273 -0
- package/dist/format-entry.d.ts +3 -0
- package/dist/format-entry.js +3 -0
- package/dist/format.d.ts +68 -2
- package/dist/format.js +237 -1
- package/dist/format.js.map +1 -0
- package/dist/i18n.d.ts +11 -0
- package/dist/{format-entry-C7iBqN3J.js → i18n.js} +10 -225
- package/dist/i18n.js.map +1 -0
- package/dist/icons/Icon.d.ts +23 -0
- package/dist/icons/Icon.js +90 -0
- package/dist/icons/Icon.js.map +1 -0
- package/dist/icons/data.d.ts +150 -0
- package/dist/icons/data.js +256 -0
- package/dist/icons/data.js.map +1 -0
- package/dist/index.d.ts +84 -2258
- package/dist/index.js +79 -12715
- package/dist/internal/Field.js +71 -0
- package/dist/internal/Field.js.map +1 -0
- package/dist/internal/FloatingPanel.js +41 -0
- package/dist/internal/FloatingPanel.js.map +1 -0
- package/dist/internal/chart.js +131 -0
- package/dist/internal/chart.js.map +1 -0
- package/dist/internal/dev.js +21 -0
- package/dist/internal/dev.js.map +1 -0
- package/dist/internal/focus.js +94 -0
- package/dist/internal/focus.js.map +1 -0
- package/dist/internal/focusMain.d.ts +4 -0
- package/dist/internal/focusMain.js +22 -0
- package/dist/internal/focusMain.js.map +1 -0
- package/dist/internal/scrollHint.js +75 -0
- package/dist/internal/scrollHint.js.map +1 -0
- package/dist/internal/tableTools.js +109 -0
- package/dist/internal/tableTools.js.map +1 -0
- package/dist/internal/terms.d.ts +18 -0
- package/dist/internal/terms.js +64 -0
- package/dist/internal/terms.js.map +1 -0
- package/dist/internal/util.js +107 -0
- package/dist/internal/util.js.map +1 -0
- package/dist/motion.d.ts +5 -0
- package/dist/motion.js +29 -0
- package/dist/motion.js.map +1 -0
- package/dist/styles.css +4419 -4195
- package/dist/theme.d.ts +20 -0
- package/dist/theme.js +210 -0
- package/dist/theme.js.map +1 -0
- package/dist/tokens.css +78 -19
- package/docs/AccentPicker.md +17 -2
- package/docs/ActionBar.md +6 -4
- package/docs/AiMark.md +12 -6
- package/docs/Alert.md +17 -5
- package/docs/AppShell.md +20 -11
- package/docs/Badge.md +20 -9
- package/docs/BarChart.md +21 -3
- package/docs/Breadcrumb.md +9 -4
- package/docs/Button.md +18 -8
- package/docs/Calendar.md +10 -5
- package/docs/Card.md +17 -9
- package/docs/Checkbox.md +15 -4
- package/docs/CodeView.md +16 -13
- package/docs/CommandPalette.md +18 -10
- package/docs/ConsoleLayout.md +24 -2
- package/docs/DangerZone.md +9 -3
- package/docs/DataColors.md +11 -4
- package/docs/DataTable.md +77 -28
- package/docs/DatePicker.md +16 -2
- package/docs/DateRangePicker.md +13 -1
- package/docs/DetailList.md +17 -12
- package/docs/Dialog.md +11 -6
- package/docs/Drawer.md +13 -7
- package/docs/EmptyState.md +13 -1
- package/docs/ErrorPage.md +6 -0
- package/docs/EventTimeline.md +11 -5
- package/docs/FileUpload.md +21 -5
- package/docs/FormGrid.md +11 -2
- package/docs/Format.md +19 -1
- package/docs/Graph.md +17 -2
- package/docs/Grid.md +13 -4
- package/docs/IconButton.md +16 -13
- package/docs/InlineCode.md +18 -8
- package/docs/KpiCard.md +21 -7
- package/docs/LayerGraph.md +36 -23
- package/docs/LineChart.md +22 -1
- package/docs/LoadingBar.md +7 -1
- package/docs/LoginCard.md +19 -3
- package/docs/Markdown.md +18 -2
- package/docs/Menu.md +13 -7
- package/docs/Meter.md +12 -5
- package/docs/MobileTabBar.md +18 -2
- package/docs/MultiSelect.md +13 -3
- package/docs/NotificationBell.md +13 -3
- package/docs/Popover.md +12 -2
- package/docs/ProgressBar.md +8 -2
- package/docs/ProgressRing.md +8 -2
- package/docs/ProjectSwitcher.md +15 -9
- package/docs/RadioGroup.md +21 -3
- package/docs/SearchField.md +8 -2
- package/docs/Section.md +16 -4
- package/docs/SegmentedControl.md +21 -19
- package/docs/Select.md +16 -1
- package/docs/SettingsLayout.md +19 -4
- package/docs/SideNav.md +20 -2
- package/docs/Skeleton.md +7 -1
- package/docs/SplitPane.md +7 -1
- package/docs/StatusBand.md +12 -6
- package/docs/Suggestion.md +12 -5
- package/docs/Switch.md +15 -2
- package/docs/Tabs.md +25 -6
- package/docs/Tag.md +16 -12
- package/docs/Term.md +18 -1
- package/docs/TextArea.md +12 -1
- package/docs/TextField.md +15 -5
- package/docs/ThemePicker.md +16 -4
- package/docs/TimeControl.md +10 -5
- package/docs/Toast.md +13 -3
- package/docs/Tooltip.md +17 -5
- package/docs/TopBar.md +16 -3
- package/docs/Tour.md +25 -1
- package/docs/TreeList.md +16 -9
- package/docs/Workbench.md +12 -6
- package/docs/ZoneMap.md +17 -10
- package/docs/code.md +28 -0
- package/docs/data.md +45 -0
- package/docs/forms.md +29 -0
- package/docs/guidelines.md +65 -315
- package/docs/layout.md +24 -4
- package/docs/monitoring.md +30 -0
- package/docs/motion.md +1 -1
- package/docs/theme.md +153 -0
- package/package.json +6 -5
- package/dist/format-entry-BJI8MU2K.d.ts +0 -75
- package/dist/format-entry-C7iBqN3J.js.map +0 -1
- package/dist/index.js.map +0 -1
package/dist/theme.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type ThemeSetting = 'auto' | 'light' | 'dark';
|
|
2
|
+
/** Switches the theme on <html data-theme> and remembers it. */
|
|
3
|
+
export declare function setTheme(t: ThemeSetting): void;
|
|
4
|
+
/** Derives every accent token from one color (自訂強調色的換算 in docs/theme.md).
|
|
5
|
+
* Returns false for anything but #rrggbb. quiet: apply without storing. */
|
|
6
|
+
export declare function setAccent(hex: string, quiet?: boolean): boolean;
|
|
7
|
+
/** Applies the stored theme and accent; call once when the page starts. */
|
|
8
|
+
export declare function initTheme(): void;
|
|
9
|
+
/** The text color for something drawn on a fill (a heat-scale zone, a status band): the near-black ink of the light
|
|
10
|
+
* theme (#171512) or white, whichever contrasts more with the fill. `fill` is a color (#hex, rgb()) or a token name
|
|
11
|
+
* such as 'heat-6', read from el (default: the root) so it follows the theme. Every step of heat-*, diverge-* and
|
|
12
|
+
* chart-* reaches 4.5:1 with its pick. Unreadable colors give the near-black ink. */
|
|
13
|
+
export declare function textOn(fill: string, el?: Element): '#171512' | '#ffffff';
|
|
14
|
+
/** The heat-scale token for a value: min (or below) is heat-1, max (or above) is heat-7, evenly in between. */
|
|
15
|
+
export declare function heatToken(value: number, min: number, max: number): `heat-${1 | 2 | 3 | 4 | 5 | 6 | 7}`;
|
|
16
|
+
/** The diverging-scale token for a difference: within ±zero it is diverge-zero; from ±strong on, the -strong step. */
|
|
17
|
+
export declare function divergeToken(diff: number, limits: {
|
|
18
|
+
zero: number;
|
|
19
|
+
strong: number;
|
|
20
|
+
}): 'diverge-neg-strong' | 'diverge-neg' | 'diverge-zero' | 'diverge-pos' | 'diverge-pos-strong';
|
package/dist/theme.js
ADDED
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { ensureAnnouncer } from "./announce.js";
|
|
3
|
+
import { reduced, store } from "./internal/util.js";
|
|
4
|
+
// src/theme.ts
|
|
5
|
+
const THEME_KEY = "ui-theme";
|
|
6
|
+
const ACCENT_KEY = "ui-accent";
|
|
7
|
+
const DEFAULT_ACCENT = "#2457d6";
|
|
8
|
+
const isSetting = (v) => v === "auto" || v === "light" || v === "dark";
|
|
9
|
+
/** The stored theme setting, 'auto' when there is none. */
|
|
10
|
+
function storedTheme() {
|
|
11
|
+
const v = store(THEME_KEY);
|
|
12
|
+
return isSetting(v) ? v : "auto";
|
|
13
|
+
}
|
|
14
|
+
function resolveTheme(t) {
|
|
15
|
+
if (t !== "auto") return t;
|
|
16
|
+
return typeof window.matchMedia === "function" && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
17
|
+
}
|
|
18
|
+
let fadeTimer;
|
|
19
|
+
/** Switches the theme on <html data-theme> and remembers it. */
|
|
20
|
+
function setTheme(t) {
|
|
21
|
+
const root = document.documentElement;
|
|
22
|
+
if (!reduced()) {
|
|
23
|
+
root.classList.add("ui-theme-fade");
|
|
24
|
+
clearTimeout(fadeTimer);
|
|
25
|
+
fadeTimer = setTimeout(() => root.classList.remove("ui-theme-fade"), 320);
|
|
26
|
+
}
|
|
27
|
+
root.setAttribute("data-theme", resolveTheme(t));
|
|
28
|
+
root.setAttribute("data-theme-setting", t);
|
|
29
|
+
store(THEME_KEY, t);
|
|
30
|
+
setAccent(storedAccent(), true);
|
|
31
|
+
}
|
|
32
|
+
/** Swatches whose color changed so they read as text on every ground: a stored old value moves to the new one. */
|
|
33
|
+
const RENAMED_SWATCHES = {
|
|
34
|
+
"#8a4fd6": "#864ad1",
|
|
35
|
+
"#c2407a": "#ba3873",
|
|
36
|
+
"#cd3a2f": "#c53228",
|
|
37
|
+
"#b85a0e": "#ab5101",
|
|
38
|
+
"#1a844a": "#077b42",
|
|
39
|
+
"#0e827d": "#027874"
|
|
40
|
+
};
|
|
41
|
+
/** The stored accent, with an old swatch value moved to its current one (and stored again). */
|
|
42
|
+
function storedAccent() {
|
|
43
|
+
const v = store(ACCENT_KEY);
|
|
44
|
+
if (!v) return DEFAULT_ACCENT;
|
|
45
|
+
const now = RENAMED_SWATCHES[v.toLowerCase()];
|
|
46
|
+
if (now) store(ACCENT_KEY, now);
|
|
47
|
+
return now ?? v;
|
|
48
|
+
}
|
|
49
|
+
const hexRgb = (x) => [
|
|
50
|
+
1,
|
|
51
|
+
3,
|
|
52
|
+
5
|
|
53
|
+
].map((i) => parseInt(x.slice(i, i + 2), 16));
|
|
54
|
+
/** A CSS color as #rrggbb: #rgb, #rgba, #rrggbb, #rrggbbaa (alpha dropped), rgb() and rgba() with commas or spaces.
|
|
55
|
+
* null for anything else (a name, a var(), an empty value). Bundlers shorten #ffffff to #fff in tokens.css, so the
|
|
56
|
+
* short form must read the same. */
|
|
57
|
+
function toHex(c) {
|
|
58
|
+
const v = c.trim().toLowerCase();
|
|
59
|
+
const short = /^#([0-9a-f])([0-9a-f])([0-9a-f])[0-9a-f]?$/.exec(v);
|
|
60
|
+
if (short) return "#" + short[1] + short[1] + short[2] + short[2] + short[3] + short[3];
|
|
61
|
+
const long = /^#([0-9a-f]{6})(?:[0-9a-f]{2})?$/.exec(v);
|
|
62
|
+
if (long) return "#" + long[1];
|
|
63
|
+
const fn = /^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)(?:\s*[,/]\s*[\d.]+%?)?\s*\)$/.exec(v);
|
|
64
|
+
if (fn) {
|
|
65
|
+
const n = fn.slice(1, 4).map(Number);
|
|
66
|
+
if (n.every((x) => x >= 0 && x <= 255)) return "#" + n.map((x) => Math.round(x).toString(16).padStart(2, "0")).join("");
|
|
67
|
+
}
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
function mixHex(a, b, t) {
|
|
71
|
+
const p = hexRgb(a);
|
|
72
|
+
const q = hexRgb(b);
|
|
73
|
+
return "#" + p.map((v, i) => Math.round(v + (q[i] - v) * t).toString(16).padStart(2, "0")).join("");
|
|
74
|
+
}
|
|
75
|
+
function lum(x) {
|
|
76
|
+
const w = [
|
|
77
|
+
.2126,
|
|
78
|
+
.7152,
|
|
79
|
+
.0722
|
|
80
|
+
];
|
|
81
|
+
return hexRgb(x).map((v) => {
|
|
82
|
+
v /= 255;
|
|
83
|
+
return v <= .03928 ? v / 12.92 : ((v + .055) / 1.055) ** 2.4;
|
|
84
|
+
}).reduce((s, v, i) => s + v * w[i], 0);
|
|
85
|
+
}
|
|
86
|
+
function contrast(a, b) {
|
|
87
|
+
const x = lum(a);
|
|
88
|
+
const y = lum(b);
|
|
89
|
+
return (Math.max(x, y) + .05) / (Math.min(x, y) + .05);
|
|
90
|
+
}
|
|
91
|
+
/** The accent's text color (accent-text, and the focus outline): the accent itself when it reads (4.5:1) on bg,
|
|
92
|
+
* surface and every extra ground passed (setAccent passes surface-sub, surface-chrome and accent-soft); else, in
|
|
93
|
+
* 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. */
|
|
94
|
+
function accentText(hex, dark, bg, surface, ...grounds) {
|
|
95
|
+
const all = [
|
|
96
|
+
bg,
|
|
97
|
+
surface,
|
|
98
|
+
...grounds
|
|
99
|
+
].map(toHex);
|
|
100
|
+
if (all.some((g) => !g)) return hex;
|
|
101
|
+
const reads = (c) => all.every((g) => contrast(c, g) >= 4.5);
|
|
102
|
+
const toward = dark ? "#ffffff" : "#000000";
|
|
103
|
+
const step = dark ? .05 : .04;
|
|
104
|
+
let text = hex;
|
|
105
|
+
for (let k = 1; k * step <= 1 && !reads(text); k++) text = mixHex(hex, toward, k * step);
|
|
106
|
+
return text;
|
|
107
|
+
}
|
|
108
|
+
const INK = "#171512";
|
|
109
|
+
/** The text on an accent fill (on-accent): white or the near-black ink (#171512), whichever contrasts more. */
|
|
110
|
+
function onFill(fill) {
|
|
111
|
+
return contrast("#ffffff", fill) >= contrast(INK, fill) ? "#ffffff" : INK;
|
|
112
|
+
}
|
|
113
|
+
/** The accent's fill color (accent: buttons, switches, progress, selected marks): the accent itself when it reaches
|
|
114
|
+
* 3:1 on bg, surface and every extra ground passed (setAccent passes surface-sub, surface-chrome and accent-soft) and
|
|
115
|
+
* 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
|
|
116
|
+
* white 5 % at a time, until both hold. The preset swatches pass in light as they are. */
|
|
117
|
+
function accentFill(hex, dark, bg, surface, ...grounds) {
|
|
118
|
+
const all = [
|
|
119
|
+
bg,
|
|
120
|
+
surface,
|
|
121
|
+
...grounds
|
|
122
|
+
].map(toHex);
|
|
123
|
+
if (all.some((g) => !g)) return hex;
|
|
124
|
+
const ok = (c) => all.every((g) => contrast(c, g) >= 3) && contrast(onFill(c), c) >= 4.5;
|
|
125
|
+
const toward = dark ? "#ffffff" : "#000000";
|
|
126
|
+
const step = dark ? .05 : .04;
|
|
127
|
+
let fill = hex;
|
|
128
|
+
for (let k = 1; k * step <= 1 && !ok(fill); k++) fill = mixHex(hex, toward, k * step);
|
|
129
|
+
return fill;
|
|
130
|
+
}
|
|
131
|
+
/** The preset swatches of AccentPicker. In light (and the teaching preset) each one reads as text by itself (4.5:1 on
|
|
132
|
+
* bg, surface, surface-sub, surface-chrome and its own accent-soft), so accentText returns it unchanged; white text
|
|
133
|
+
* reads on it (4.5:1). In dark, accentText lightens it. Checked in tokens-contrast.test.tsx. */
|
|
134
|
+
const ACCENT_SWATCHES = [
|
|
135
|
+
["藍", "#2457d6"],
|
|
136
|
+
["靛", "#5b4fd6"],
|
|
137
|
+
["紫", "#864ad1"],
|
|
138
|
+
["桃紅", "#ba3873"],
|
|
139
|
+
["紅", "#c53228"],
|
|
140
|
+
["橘", "#ab5101"],
|
|
141
|
+
["綠", "#077b42"],
|
|
142
|
+
["青", "#027874"]
|
|
143
|
+
];
|
|
144
|
+
/** Derives every accent token from one color (自訂強調色的換算 in docs/theme.md).
|
|
145
|
+
* Returns false for anything but #rrggbb. quiet: apply without storing. */
|
|
146
|
+
function setAccent(hex, quiet = false) {
|
|
147
|
+
if (!/^#[0-9a-fA-F]{6}$/.test(hex)) return false;
|
|
148
|
+
hex = hex.toLowerCase();
|
|
149
|
+
const root = document.documentElement;
|
|
150
|
+
const dark = root.getAttribute("data-theme") === "dark";
|
|
151
|
+
const cs = getComputedStyle(root);
|
|
152
|
+
const surface = toHex(cs.getPropertyValue("--surface")) ?? (dark ? "#393530" : "#ffffff");
|
|
153
|
+
const bg = toHex(cs.getPropertyValue("--bg")) ?? (dark ? "#2f2a25" : "#fcfbfb");
|
|
154
|
+
const sub = toHex(cs.getPropertyValue("--surface-sub")) ?? (dark ? "#443f3b" : "#f6f5f4");
|
|
155
|
+
const chrome = toHex(cs.getPropertyValue("--surface-chrome")) ?? (dark ? "#3d3834" : "#ffffff");
|
|
156
|
+
const soft = dark ? mixHex(surface, hex, .22) : mixHex("#ffffff", hex, .12);
|
|
157
|
+
const text = accentText(hex, dark, bg, surface, sub, chrome, soft);
|
|
158
|
+
const fill = accentFill(hex, dark, bg, surface, sub, chrome, soft);
|
|
159
|
+
const away = dark ? "#ffffff" : "#000000";
|
|
160
|
+
const vars = {
|
|
161
|
+
"--accent": fill,
|
|
162
|
+
"--accent-hover": mixHex(fill, away, .12),
|
|
163
|
+
"--accent-press": mixHex(fill, away, .22),
|
|
164
|
+
"--accent-soft": soft,
|
|
165
|
+
"--accent-text": text,
|
|
166
|
+
"--on-accent": onFill(fill),
|
|
167
|
+
"--focus": text,
|
|
168
|
+
"--focus-ring": text
|
|
169
|
+
};
|
|
170
|
+
for (const [k, v] of Object.entries(vars)) root.style.setProperty(k, v);
|
|
171
|
+
if (!quiet) store(ACCENT_KEY, hex);
|
|
172
|
+
return true;
|
|
173
|
+
}
|
|
174
|
+
let following = false;
|
|
175
|
+
/** Applies the stored theme and accent; call once when the page starts. */
|
|
176
|
+
function initTheme() {
|
|
177
|
+
setTheme(storedTheme());
|
|
178
|
+
ensureAnnouncer();
|
|
179
|
+
if (following || typeof window.matchMedia !== "function") return;
|
|
180
|
+
following = true;
|
|
181
|
+
window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", () => {
|
|
182
|
+
if (storedTheme() === "auto") setTheme("auto");
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
/** The text color for something drawn on a fill (a heat-scale zone, a status band): the near-black ink of the light
|
|
186
|
+
* theme (#171512) or white, whichever contrasts more with the fill. `fill` is a color (#hex, rgb()) or a token name
|
|
187
|
+
* such as 'heat-6', read from el (default: the root) so it follows the theme. Every step of heat-*, diverge-* and
|
|
188
|
+
* chart-* reaches 4.5:1 with its pick. Unreadable colors give the near-black ink. */
|
|
189
|
+
function textOn(fill, el) {
|
|
190
|
+
let c = fill.trim();
|
|
191
|
+
if (/^[a-z][a-z0-9-]*$/.test(c) && typeof document !== "undefined") c = getComputedStyle(el ?? document.documentElement).getPropertyValue("--" + c);
|
|
192
|
+
const hex = toHex(c);
|
|
193
|
+
if (!hex) return "#171512";
|
|
194
|
+
return contrast(hex, "#171512") >= contrast(hex, "#ffffff") ? "#171512" : "#ffffff";
|
|
195
|
+
}
|
|
196
|
+
/** The heat-scale token for a value: min (or below) is heat-1, max (or above) is heat-7, evenly in between. */
|
|
197
|
+
function heatToken(value, min, max) {
|
|
198
|
+
const t = max > min ? (value - min) / (max - min) : 0;
|
|
199
|
+
return `heat-${Math.min(7, Math.max(1, Math.round(t * 6) + 1))}`;
|
|
200
|
+
}
|
|
201
|
+
/** The diverging-scale token for a difference: within ±zero it is diverge-zero; from ±strong on, the -strong step. */
|
|
202
|
+
function divergeToken(diff, limits) {
|
|
203
|
+
const a = Math.abs(diff);
|
|
204
|
+
if (a <= limits.zero) return "diverge-zero";
|
|
205
|
+
const strong = a >= limits.strong;
|
|
206
|
+
return diff < 0 ? strong ? "diverge-neg-strong" : "diverge-neg" : strong ? "diverge-pos-strong" : "diverge-pos";
|
|
207
|
+
}
|
|
208
|
+
export { ACCENT_KEY, ACCENT_SWATCHES, DEFAULT_ACCENT, accentFill, accentText, divergeToken, heatToken, initTheme, onFill, setAccent, setTheme, storedAccent, storedTheme, textOn, toHex };
|
|
209
|
+
|
|
210
|
+
//# sourceMappingURL=theme.js.map
|
|
@@ -0,0 +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.strong;\n return diff < 0 ? (strong ? 'diverge-neg-strong' : 'diverge-neg') : strong ? 'diverge-pos-strong' : 'diverge-pos';\n}\n"],"mappings":";;;;AAQA,MAAM,YAAY;AAClB,MAAa,aAAa;AAC1B,MAAa,iBAAiB;AAE9B,MAAM,aAAa,MAAwC,MAAM,UAAU,MAAM,WAAW,MAAM;;AAGlG,SAAgB,cAA4B;CAC1C,MAAM,IAAI,MAAM,SAAS;CACzB,OAAO,UAAU,CAAC,IAAI,IAAI;AAC5B;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;;AAGJ,SAAgB,SAAS,GAAuB;CAC9C,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,aAAa,CAAC,CAAC;CAC/C,KAAK,aAAa,sBAAsB,CAAC;CACzC,MAAM,WAAW,CAAC;CAElB,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I,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"}
|
package/dist/tokens.css
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
/* Generated from tokens.json by scripts/build.ts. Do not edit by hand. */
|
|
2
|
+
@layer theme, base, ui, components, utilities;
|
|
3
|
+
@layer ui.tokens, ui.components;
|
|
4
|
+
@layer ui.tokens {
|
|
2
5
|
:root {
|
|
3
6
|
--bg: #fcfbfb;
|
|
4
7
|
--surface: #ffffff;
|
|
@@ -19,20 +22,22 @@
|
|
|
19
22
|
--accent-text: #2457d6;
|
|
20
23
|
--accent-soft: #e5ebfa;
|
|
21
24
|
--on-accent: #ffffff;
|
|
22
|
-
--focus
|
|
23
|
-
--
|
|
25
|
+
--focus: #2457d6;
|
|
26
|
+
--focus-ring: #2457d6;
|
|
27
|
+
--success: #1b9f52;
|
|
24
28
|
--success-text: #14743b;
|
|
25
29
|
--success-soft: #e8f6ee;
|
|
26
|
-
--warning: #
|
|
27
|
-
--warning-text: #
|
|
30
|
+
--warning: #bc770e;
|
|
31
|
+
--warning-text: #945d0b;
|
|
28
32
|
--warning-soft: #fbf3e7;
|
|
29
33
|
--danger: #cd2823;
|
|
34
|
+
--on-danger: #ffffff;
|
|
30
35
|
--danger-text: #901c19;
|
|
31
36
|
--danger-soft: #faeae9;
|
|
32
37
|
--info-text: #193d96;
|
|
33
38
|
--info-soft: #e9eefb;
|
|
34
39
|
--on-solid: #ffffff;
|
|
35
|
-
--danger-ring:
|
|
40
|
+
--danger-ring: #901c19;
|
|
36
41
|
--mark: #fde68a;
|
|
37
42
|
--scrim: rgba(0, 0, 0, 0.2);
|
|
38
43
|
--scrim-strong: rgba(0, 0, 0, 0.55);
|
|
@@ -83,6 +88,7 @@
|
|
|
83
88
|
--space-6: 24px;
|
|
84
89
|
--space-8: 32px;
|
|
85
90
|
--space-12: 48px;
|
|
91
|
+
--radius-xs: 4px;
|
|
86
92
|
--radius-sm: 6px;
|
|
87
93
|
--radius-chip: 8px;
|
|
88
94
|
--radius-md: 10px;
|
|
@@ -105,6 +111,45 @@
|
|
|
105
111
|
--bp-tablet: 600px;
|
|
106
112
|
--bp-desktop: 960px;
|
|
107
113
|
--bp-wide: 1280px;
|
|
114
|
+
--text-mini: 12px;
|
|
115
|
+
--text-small: 13px;
|
|
116
|
+
--text-compact: 14px;
|
|
117
|
+
--text-control: 15px;
|
|
118
|
+
--text-body: 16px;
|
|
119
|
+
--text-title: 17px;
|
|
120
|
+
--text-lead: 18px;
|
|
121
|
+
--text-h4: 20px;
|
|
122
|
+
--text-h3: 25px;
|
|
123
|
+
--text-h2: 31px;
|
|
124
|
+
--text-h1: 39px;
|
|
125
|
+
--text-display: 49px;
|
|
126
|
+
--dur-hover: 150ms;
|
|
127
|
+
--dur-menu: 180ms;
|
|
128
|
+
--dur-nav: 200ms;
|
|
129
|
+
--dur-tooltip: 220ms;
|
|
130
|
+
--dur-expand: 260ms;
|
|
131
|
+
--dur-toggle: 300ms;
|
|
132
|
+
--dur-drawer: 450ms;
|
|
133
|
+
--dur-bar: 500ms;
|
|
134
|
+
--dur-chart: 900ms;
|
|
135
|
+
--dur-loop: 1400ms;
|
|
136
|
+
--ease-standard: cubic-bezier(0.2, 0.8, 0.2, 1);
|
|
137
|
+
--ease-glide: cubic-bezier(0.3, 0.7, 0.3, 1);
|
|
138
|
+
--ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);
|
|
139
|
+
--ease-exit: cubic-bezier(0.4, 0, 1, 1);
|
|
140
|
+
--z-base: 0;
|
|
141
|
+
--z-raised: 1;
|
|
142
|
+
--z-sticky: 2;
|
|
143
|
+
--z-float: 5;
|
|
144
|
+
--z-header: 10;
|
|
145
|
+
--z-rail: 20;
|
|
146
|
+
--z-hint: 30;
|
|
147
|
+
--z-drawer: 800;
|
|
148
|
+
--z-modal: 900;
|
|
149
|
+
--z-palette: 950;
|
|
150
|
+
--z-tour: 960;
|
|
151
|
+
--z-popover: 980;
|
|
152
|
+
--z-tooltip: 1000;
|
|
108
153
|
--font-sans: Inter, "Noto Sans TC", system-ui, sans-serif;
|
|
109
154
|
--font-mono: "Geist Mono", "Noto Sans TC", ui-monospace, monospace;
|
|
110
155
|
}
|
|
@@ -112,26 +157,37 @@
|
|
|
112
157
|
--bg: #2f2a25;
|
|
113
158
|
--surface: #393530;
|
|
114
159
|
--surface-sub: #443f3b;
|
|
115
|
-
--surface-chrome: #
|
|
160
|
+
--surface-chrome: #3d3834;
|
|
116
161
|
--surface-input: #26221e;
|
|
117
162
|
--ink: #f6f5f4;
|
|
118
163
|
--ink-muted: #b3aba2;
|
|
119
164
|
--line: #4c4844;
|
|
165
|
+
--line-strong: #988c80;
|
|
120
166
|
--graph-edge: #b3aba2;
|
|
121
167
|
--graph-node: #443f3b;
|
|
122
168
|
--code-keyword: #a3b7ee;
|
|
123
169
|
--code-constant: #3cc4ae;
|
|
124
|
-
--accent
|
|
125
|
-
--accent-
|
|
126
|
-
--
|
|
170
|
+
--accent: #6689e2;
|
|
171
|
+
--accent-hover: #7897e5;
|
|
172
|
+
--accent-press: #88a3e8;
|
|
173
|
+
--accent-text: #92abeb;
|
|
174
|
+
--accent-soft: #343c55;
|
|
175
|
+
--on-accent: #171512;
|
|
176
|
+
--focus: #92abeb;
|
|
177
|
+
--focus-ring: #92abeb;
|
|
178
|
+
--success: #1ca655;
|
|
127
179
|
--success-text: #82cea2;
|
|
128
180
|
--success-soft: #2c3e2d;
|
|
181
|
+
--warning: #d68710;
|
|
129
182
|
--warning-text: #e8bd7c;
|
|
130
183
|
--warning-soft: #4a3922;
|
|
131
|
-
--danger
|
|
184
|
+
--danger: #dc6965;
|
|
185
|
+
--on-danger: #171512;
|
|
186
|
+
--danger-text: #e79593;
|
|
132
187
|
--danger-soft: #482a25;
|
|
133
|
-
--info-text: #
|
|
188
|
+
--info-text: #90aaea;
|
|
134
189
|
--info-soft: #2d3141;
|
|
190
|
+
--danger-ring: #e79593;
|
|
135
191
|
--mark: #7c5d12;
|
|
136
192
|
--chart-1: #819ee7;
|
|
137
193
|
--chart-2: #3cc4ae;
|
|
@@ -151,19 +207,21 @@
|
|
|
151
207
|
--diverge-pos-strong: #f0a35e;
|
|
152
208
|
--forecast-stripe: rgba(246, 245, 244, 0.14);
|
|
153
209
|
--shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
|
|
154
|
-
--shadow-chip: 0 1px
|
|
210
|
+
--shadow-chip: 0 1px 2px rgba(0, 0, 0, 0.45);
|
|
155
211
|
--shadow-card: 0 1px 2px rgba(0, 0, 0, 0.6), 0 8px 24px rgba(0, 0, 0, 0.55);
|
|
156
212
|
--shadow-card-hover: 0 2px 4px rgba(0, 0, 0, 0.6), 0 16px 36px rgba(0, 0, 0, 0.6);
|
|
157
213
|
--shadow-overlay: 0 20px 48px rgba(0, 0, 0, 0.5);
|
|
158
214
|
}
|
|
159
215
|
[data-theme="teaching"] {
|
|
160
|
-
--accent: #
|
|
161
|
-
--accent-hover: #
|
|
162
|
-
--accent-press: #
|
|
163
|
-
--accent-text: #
|
|
164
|
-
--accent-soft: #
|
|
165
|
-
--focus
|
|
166
|
-
--
|
|
216
|
+
--accent: #027874;
|
|
217
|
+
--accent-hover: #026a66;
|
|
218
|
+
--accent-press: #025e5a;
|
|
219
|
+
--accent-text: #027874;
|
|
220
|
+
--accent-soft: #e1efee;
|
|
221
|
+
--focus: #027874;
|
|
222
|
+
--focus-ring: #027874;
|
|
223
|
+
--chart-1: #027874;
|
|
224
|
+
--radius-xs: 0px;
|
|
167
225
|
--radius-sm: 0px;
|
|
168
226
|
--radius-chip: 0px;
|
|
169
227
|
--radius-md: 0px;
|
|
@@ -173,3 +231,4 @@
|
|
|
173
231
|
--shadow-card: none;
|
|
174
232
|
--shadow-card-hover: none;
|
|
175
233
|
}
|
|
234
|
+
}
|
package/docs/AccentPicker.md
CHANGED
|
@@ -1,8 +1,23 @@
|
|
|
1
1
|
# AccentPicker
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## 用法
|
|
4
|
+
|
|
5
|
+
強調色選擇:8 個推薦色票,下方可以輸入任何色碼;放在設定頁的「外觀」,和 ThemePicker 放在一起。
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
<SettingsSection title="外觀">
|
|
9
|
+
<ThemePicker />
|
|
10
|
+
<AccentPicker />
|
|
11
|
+
</SettingsSection>
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
- 不傳 `onChange` 時直接呼叫 `setAccent()`,重新算出所有強調相關 token 並存在 localStorage;頁面載入時呼叫一次 `initTheme()` 套用。
|
|
15
|
+
- 不放在頂部列。
|
|
16
|
+
- 選很淺或很深的顏色時,文字色 `accent-text` 自動加深或調亮;填色仍是選的顏色。
|
|
17
|
+
|
|
18
|
+
## 細節
|
|
4
19
|
|
|
5
20
|
- 色票:藍、靛、紫、桃紅、紅、橘、綠、青;選中的色票外圍一圈同色外框並打勾。
|
|
6
21
|
- 色碼欄位:輸入 # 加 6 碼就立即套用;格式不正確時框變紅並說明。
|
|
7
|
-
-
|
|
22
|
+
- 換算方式見 theme.md 的「自訂強調色的換算」(`ui docs theme`):填色、hover、按下、淺底、文字色與焦點外框(`focus`)都由強調色算出;填色在深色主題會調亮到 3:1。
|
|
8
23
|
- 文字一定讀得清楚:選了很淺(淺色主題)或很深(深色主題)的強調色時,`accent-text` 會自動加深或調亮,直到對 `bg` 與 `surface` 都有 4.5:1,例如淺色主題選 `#ffe066` 時連結、選中的分頁文字變成 `#7a6c31`。按鈕、進度條、選取框這些填色仍是選的顏色;按鈕上的字由 `on-accent` 選白色或深色。
|
package/docs/ActionBar.md
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
# ActionBar
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## 用法
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
- 比較寬時:全部並排,主要按鈕在最前面,其他是次要按鈕,放不下就換行。
|
|
7
|
-
- 每個區塊最多一個主要按鈕。危險操作加 `danger: true` 和 `confirm`,在選單裡會放到最後,確認後才執行。
|
|
5
|
+
卡片底部的一組操作按鈕:窄的時候收成一個主要按鈕加「⋯」選單。只有一個按鈕時直接用 Button。
|
|
8
6
|
|
|
9
7
|
```tsx
|
|
10
8
|
<ActionBar
|
|
@@ -16,6 +14,10 @@
|
|
|
16
14
|
/>
|
|
17
15
|
```
|
|
18
16
|
|
|
17
|
+
- 寬度小於 600 px:最常用的一個(`primary: true`,沒有標示時用第一個)是全寬的主要按鈕,高度 44 px;其他收進右邊的「⋯」選單(外框,44 × 44 px)。
|
|
18
|
+
- 比較寬時:全部並排,主要按鈕在最前面,其他是次要按鈕,放不下就換行。
|
|
19
|
+
- 每個區塊最多一個主要按鈕。危險操作加 `danger: true` 和 `confirm`,在選單裡會放到最後,確認後才執行。
|
|
20
|
+
|
|
19
21
|
## 無障礙
|
|
20
22
|
|
|
21
23
|
- 按了之後按鈕被移除、換成別的按鈕或變成不能按時,焦點移到同一個位置的按鈕,沒有時移到前一個,不會掉回頁面最上方。
|
package/docs/AiMark.md
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
# AiMark
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## 用法
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
- 放在最後,和其他來源標示(例如「推測」)同一個樣子:`text` 可以換字,`<AiMark text="推測" />`。沒有標示的代表來自程式碼或語言規則。
|
|
7
|
-
- 不是連結也不是按鈕,Tab 不會停在上面。
|
|
8
|
-
- 畫面上的字對螢幕閱讀器隱藏,改念「(AI 撰寫)」;`label` 可以另外指定(沒給時跟著 `UI.t()` 的語言)。
|
|
9
|
-
- 在 Markdown 裡寫 `[AI](ai:)`,`UI.Markdown` 會在那一段(段落、清單項目或表格格子)的最後畫這個標示;寫在開頭或結尾都可以。`[推測](ai:)` 顯示「推測」。
|
|
5
|
+
標出 AI 寫的文字:在句子、段落、清單項目或表格格子的最後,用灰色小字寫「AI 撰寫」。沒有標示的代表來自程式碼或語言規則。
|
|
10
6
|
|
|
11
7
|
```tsx
|
|
12
8
|
<p>
|
|
@@ -15,6 +11,16 @@
|
|
|
15
11
|
</p>
|
|
16
12
|
```
|
|
17
13
|
|
|
14
|
+
- 放在最後。其他來源標示(例如「推測」)用同一個元件換字:`<AiMark text="推測" />`。
|
|
15
|
+
- 在 Markdown 裡寫 `[AI](ai:)`,`Markdown` 會在那一段的最後畫這個標示;`[推測](ai:)` 顯示「推測」。
|
|
16
|
+
|
|
17
|
+
## 細節
|
|
18
|
+
|
|
19
|
+
- 13 px、`ink-muted` 灰字,和前面的文字隔 8 px,不換行。
|
|
20
|
+
- 不是連結也不是按鈕,Tab 不會停在上面。
|
|
21
|
+
- 畫面上的字對螢幕閱讀器隱藏,改念「(AI 撰寫)」;`label` 可以另外指定(沒給時跟著 `UI.t()` 的語言)。
|
|
22
|
+
- Markdown 的寫法放在段落、清單項目或表格格子的開頭或結尾都可以。
|
|
23
|
+
|
|
18
24
|
```md
|
|
19
25
|
這個函式在每次路由表變動時重新建立連線。[AI](ai:)
|
|
20
26
|
```
|
package/docs/Alert.md
CHANGED
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
# Alert
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## 用法
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
頁面或區塊內持續顯示的提示:白底卡片,上緣一條 3 px 狀態色條。操作完成的短暫提示用 Toast;要使用者決定的用 Dialog。
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
<Alert tone="warning" title="憑證 3 天後到期" actionLabel="更新" onAction={renew}>
|
|
9
|
+
到期後 api-gateway 會拒絕連線。
|
|
10
|
+
</Alert>
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
- 四種 `tone`:`info`、`success`、`warning`、`danger`。
|
|
14
|
+
- 只有 `info` 與 `success` 能關閉(傳 `onDismiss`);`warning` 與 `danger` 不能關閉。
|
|
15
|
+
- 動作是右側的外框按鈕(`actionLabel`、`onAction`),文字只用動詞。
|
|
16
|
+
- 本身就是卡片:單獨使用時不再包一層 Card;放進 Card 時自動拿掉陰影。
|
|
17
|
+
|
|
18
|
+
## 細節
|
|
19
|
+
|
|
20
|
+
- 外型:`surface` 底色、`shadow-card` 陰影、`radius-md` 圓角;上緣色條高度 `alert-bar` 3 px,圖示與色條同色。`info` 的色條是 `accent`。
|
package/docs/AppShell.md
CHANGED
|
@@ -1,16 +1,8 @@
|
|
|
1
1
|
# AppShell
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## 用法
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
- 滑鼠停在圖示列上 100 ms,展開成 240 px,疊在內容上、帶陰影,內容不移動;滑鼠離開 300 ms 後收回。用 Tab 移進側邊欄時也會展開,焦點離開或按 Esc 時收回;選了頁面後收回。
|
|
7
|
-
- 左下角的圖釘按鈕「釘選側邊欄」:釘選後側邊欄固定在內容旁邊(240 px),旁邊多一個收合按鈕,可以收合成 72 px,和以前一樣。圖釘變成實心強調色,按了「取消釘選」回到自動展開。
|
|
8
|
-
- 釘選和收合都記在瀏覽器。以前存過收合或展開的人,升級後當作已釘選,畫面不變。
|
|
9
|
-
- `defaultPinned`:沒有存過選擇時是否一開始就釘選,預設 false。
|
|
10
|
-
- 平板和窄視窗(600 到 1024 px):沒有側邊欄,內容用滿整個寬度;頂部列左邊有選單按鈕(「開啟導覽」),點了從左邊打開完整導覽的抽屜,選了頁面後關閉。
|
|
11
|
-
- 手機(小於 600 px):沒有側邊欄,最上層有圖示的項目變成底部分頁列,有子頁面的項目開啟第一個子頁面。分頁列到不了的頁面(沒有圖示、第 5 個以後、第二個以後的子頁面)放在最後一格「更多」,開啟完整的導覽。
|
|
12
|
-
- 頂部列:頁面標題(只出現一次,頁面裡不要再寫一次)或麵包屑,右邊放搜尋、NotificationBell、ProjectSwitcher。往下捲時隱藏,往上捲時出現。
|
|
13
|
-
- 內容區自己捲動,四周留 24 px(手機 16 px)。裡面用 `Page` 和 `Grid` 排版。
|
|
5
|
+
Dashboard 類頁面的外框:側邊欄、頂部列和內容區,平板的導覽抽屜和手機的底部分頁列也由它處理。頁面都從這裡開始,不要自己排側邊欄。全螢幕監控畫面用 ConsoleLayout,程式碼工具用 Workbench。
|
|
14
6
|
|
|
15
7
|
```tsx
|
|
16
8
|
<AppShell
|
|
@@ -33,12 +25,29 @@ Dashboard 類頁面的外框:側邊欄、頂部列和內容區。頁面都從
|
|
|
33
25
|
</AppShell>
|
|
34
26
|
```
|
|
35
27
|
|
|
28
|
+
- `title` 是頁面標題,只出現一次:頁面裡不要再寫一次。
|
|
29
|
+
- 內容區裡用 `Page` 和 `Grid` 排版,每個區塊一張 Card。
|
|
30
|
+
- 頂部列右邊放 `onSearch`(接 CommandPalette)和 `actions`(NotificationBell、ProjectSwitcher)。
|
|
31
|
+
- 換頁後呼叫 `focusMain()`;變化用 `announce(text)` 念出(見下方「無障礙」)。
|
|
32
|
+
|
|
33
|
+
## 細節
|
|
34
|
+
|
|
35
|
+
- 電腦(1025 px 以上):側邊欄預設不釘選,平常是 72 px 的圖示列,點圖示就能換頁。
|
|
36
|
+
- 滑鼠停在圖示列上 100 ms,展開成 240 px,疊在內容上、帶陰影,內容不移動;滑鼠離開 300 ms 後收回。用 Tab 移進側邊欄時也會展開,焦點離開或按 Esc 時收回;選了頁面後收回。
|
|
37
|
+
- 左下角的圖釘按鈕「釘選側邊欄」:釘選後側邊欄固定在內容旁邊(240 px),旁邊多一個收合按鈕,可以收合成 72 px,和以前一樣。圖釘變成實心強調色,按了「取消釘選」回到自動展開。
|
|
38
|
+
- 釘選和收合都記在瀏覽器。以前存過收合或展開的人,升級後當作已釘選,畫面不變。
|
|
39
|
+
- `defaultPinned`:沒有存過選擇時是否一開始就釘選,預設 false。
|
|
40
|
+
- 平板和窄視窗(600 到 1024 px):沒有側邊欄,內容用滿整個寬度;頂部列左邊有選單按鈕(「開啟導覽」),點了從左邊打開完整導覽的抽屜,選了頁面後關閉。
|
|
41
|
+
- 手機(小於 600 px):沒有側邊欄,最上層有圖示的項目變成底部分頁列,有子頁面的項目開啟第一個子頁面。分頁列到不了的頁面(沒有圖示、第 5 個以後、第二個以後的子頁面)放在最後一格「更多」,開啟完整的導覽。
|
|
42
|
+
- 頂部列:頁面標題(只出現一次,頁面裡不要再寫一次)或麵包屑,右邊放搜尋、NotificationBell、ProjectSwitcher。往下捲時隱藏,往上捲時出現。
|
|
43
|
+
- 內容區自己捲動,四周留 24 px(手機 16 px)。裡面用 `Page` 和 `Grid` 排版。
|
|
44
|
+
|
|
36
45
|
## 品牌(brand)
|
|
37
46
|
|
|
38
47
|
側邊欄最上方的產品名稱。傳 `{ mark, name, href }`:
|
|
39
48
|
|
|
40
49
|
```tsx
|
|
41
|
-
<AppShell brand={{ mark: <img src="/logo.svg" alt="" width={24} height={24} />, name: '
|
|
50
|
+
<AppShell brand={{ mark: <img src="/logo.svg" alt="" width={24} height={24} />, name: 'app', href: '/' }} …>
|
|
42
51
|
```
|
|
43
52
|
|
|
44
53
|
- 收合(72 px,包括沒釘選時平常的圖示列和釘選後收合):只顯示 `mark`,名稱藏起來。仍是回首頁的連結,Tab 可以停,`aria-label` 是完整的 `name`。
|
package/docs/Badge.md
CHANGED
|
@@ -1,17 +1,28 @@
|
|
|
1
1
|
# Badge
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## 用法
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
項目的狀態標籤(進度或結果):浮起 Chip,左側以進度圓圈表示狀態。說明「這是什麼」的分類用 Tag。
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
<Badge status="doing" />
|
|
9
|
+
<Badge status="fail" variant="dot">部署失敗</Badge>
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
- 5 種 `status`:`draft`、`doing`、`review`、`done`、`fail`,預設文字見下表;`children` 可以換字。
|
|
13
|
+
- 放在 `Card` 或 `DataTable` 裡時,不論寬度都自動變成圓點加文字(等同 `variant="dot"`),沒有底色和陰影,避免看起來像按鈕;不用自己給 `variant`。其他地方要圓點樣式時才給 `variant="dot"`。
|
|
14
|
+
- 狀態不只靠顏色:一定有文字。
|
|
15
|
+
|
|
16
|
+
## 細節
|
|
6
17
|
|
|
7
18
|
- 外型:`surface` 底色、`shadow-chip` 陰影、`radius-chip` 8 px 圓角、高度 `chip-height` 32 px。
|
|
8
|
-
-
|
|
9
|
-
-
|
|
19
|
+
- Chip 的文字用主要文字色 `ink`,顏色只出現在進度圓圈上。圓圈用各狀態的文字色,在任何底色(含表格滑過、斑馬紋與選中的列)上都至少 3:1。
|
|
20
|
+
- 圓點樣式(`Card`、`DataTable` 裡,或 `variant="dot"`):只有要注意的狀態用該狀態的文字色:`fail` 用 `danger-text`、`review` 用 `warning-text`、`doing` 用 `accent-text`;`done` 和 `draft` 用 `ink-muted`,讓需要處理的項目先被看到。字級和旁邊的文字相同(表格裡和其他格子一樣大);需要注意的三種加粗,`done`、`draft` 用一般粗細。進度圓圈保留各自的顏色和形狀。
|
|
10
21
|
|
|
11
22
|
| status | 文字 | 進度圓圈 | 顏色 |
|
|
12
23
|
| -------- | ------ | -------- | ------------- |
|
|
13
|
-
| `draft` | 草稿 | 空心 | `
|
|
14
|
-
| `doing` | 進行中 | 半滿 | `accent`
|
|
15
|
-
| `review` | 審核中 | 四分之一 | `warning`
|
|
16
|
-
| `done` | 完成 | 全滿 | `success`
|
|
17
|
-
| `fail` | 失敗 | 全滿 | `danger`
|
|
24
|
+
| `draft` | 草稿 | 空心 | `ink-muted` |
|
|
25
|
+
| `doing` | 進行中 | 半滿 | `accent-text` |
|
|
26
|
+
| `review` | 審核中 | 四分之一 | `warning-text` |
|
|
27
|
+
| `done` | 完成 | 全滿 | `success-text` |
|
|
28
|
+
| `fail` | 失敗 | 全滿 | `danger-text` |
|