@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
|
@@ -31,7 +31,7 @@ const I18N = {
|
|
|
31
31
|
"已選 {n} 筆": "{n} selected",
|
|
32
32
|
帳號: "Username",
|
|
33
33
|
強調色: "Accent color",
|
|
34
|
-
|
|
34
|
+
忘記密碼: "Forgot password",
|
|
35
35
|
找不到符合的選項: "No matching options",
|
|
36
36
|
"拖放檔案,或 ": "Drop files here, or ",
|
|
37
37
|
搜尋: "Search",
|
|
@@ -54,6 +54,13 @@ const I18N = {
|
|
|
54
54
|
全螢幕: "Full screen",
|
|
55
55
|
離開全螢幕: "Exit full screen",
|
|
56
56
|
側欄: "Side panel",
|
|
57
|
+
更多表格操作: "More table actions",
|
|
58
|
+
還原預設: "Restore defaults",
|
|
59
|
+
已還原預設的欄位與欄寬: "Columns and widths restored to defaults",
|
|
60
|
+
套用的篩選: "Applied filters",
|
|
61
|
+
"移除篩選:{name}": "Remove filter: {name}",
|
|
62
|
+
"篩選,已套用 {n} 個條件": "Filter, {n} conditions applied",
|
|
63
|
+
"{name}:{value}": "{name}: {value}",
|
|
57
64
|
時間控制: "Time control",
|
|
58
65
|
沒有事件: "No events",
|
|
59
66
|
人工: "Manual",
|
|
@@ -347,228 +354,6 @@ function addMessages(locale, dict) {
|
|
|
347
354
|
};
|
|
348
355
|
}
|
|
349
356
|
const isZhTW = () => /^zh-(TW|Hant)/i.test(I18N.locale);
|
|
350
|
-
|
|
351
|
-
const DECIMALS = {
|
|
352
|
-
money: 0,
|
|
353
|
-
percent: 1,
|
|
354
|
-
size: 1,
|
|
355
|
-
count: 0
|
|
356
|
-
};
|
|
357
|
-
const pad2 = (n) => String(n).padStart(2, "0");
|
|
358
|
-
function locale() {
|
|
359
|
-
return I18N.locale;
|
|
360
|
-
}
|
|
361
|
-
/** zh-TW: 2026/11/04(三). Other locales: their short date with weekday. */
|
|
362
|
-
function date(d, o = {}) {
|
|
363
|
-
if (!d) return "";
|
|
364
|
-
const wd = o.weekday !== false;
|
|
365
|
-
if (o.long) return new Intl.DateTimeFormat(I18N.locale, {
|
|
366
|
-
year: "numeric",
|
|
367
|
-
month: "long",
|
|
368
|
-
day: "numeric",
|
|
369
|
-
weekday: wd ? "long" : void 0
|
|
370
|
-
}).format(d);
|
|
371
|
-
if (isZhTW()) return fmtDate(d) + (wd ? `(${new Intl.DateTimeFormat("zh-TW", { weekday: "narrow" }).format(d)})` : "");
|
|
372
|
-
return new Intl.DateTimeFormat(I18N.locale, {
|
|
373
|
-
year: "numeric",
|
|
374
|
-
month: "2-digit",
|
|
375
|
-
day: "2-digit",
|
|
376
|
-
weekday: wd ? "short" : void 0
|
|
377
|
-
}).format(d);
|
|
378
|
-
}
|
|
379
|
-
/** zh-TW: 24-hour 15:57. Other locales: their own clock. */
|
|
380
|
-
function time(d) {
|
|
381
|
-
if (!d) return "";
|
|
382
|
-
return new Intl.DateTimeFormat(I18N.locale, isZhTW() ? {
|
|
383
|
-
hour: "2-digit",
|
|
384
|
-
minute: "2-digit",
|
|
385
|
-
hourCycle: "h23"
|
|
386
|
-
} : {
|
|
387
|
-
hour: "numeric",
|
|
388
|
-
minute: "2-digit"
|
|
389
|
-
}).format(d);
|
|
390
|
-
}
|
|
391
|
-
function dateTime(d, o) {
|
|
392
|
-
return d ? `${date(d, o)} ${time(d)}` : "";
|
|
393
|
-
}
|
|
394
|
-
/** Within 7 days: 「2 小時前」、「昨天」. Older: full date and time. Pass now to test. */
|
|
395
|
-
function relative(d, now = /* @__PURE__ */ new Date()) {
|
|
396
|
-
if (!d) return "";
|
|
397
|
-
const s = (now.getTime() - d.getTime()) / 1e3;
|
|
398
|
-
if (s < 0 || s >= 604800) return dateTime(d);
|
|
399
|
-
const rt = new Intl.RelativeTimeFormat(I18N.locale, { numeric: "auto" });
|
|
400
|
-
if (s < 60) return rt.format(0, "second");
|
|
401
|
-
if (s < 3600) return rt.format(-Math.floor(s / 60), "minute");
|
|
402
|
-
if (s < 86400) return rt.format(-Math.floor(s / 3600), "hour");
|
|
403
|
-
return rt.format(-Math.floor(s / 86400), "day");
|
|
404
|
-
}
|
|
405
|
-
function month(d) {
|
|
406
|
-
return new Intl.DateTimeFormat(I18N.locale, {
|
|
407
|
-
year: "numeric",
|
|
408
|
-
month: "long"
|
|
409
|
-
}).format(d);
|
|
410
|
-
}
|
|
411
|
-
/** Week starts on Sunday for zh-TW; other locales use Intl's week info when the browser has it. */
|
|
412
|
-
function firstDay() {
|
|
413
|
-
if (isZhTW()) return 0;
|
|
414
|
-
try {
|
|
415
|
-
const l = new Intl.Locale(I18N.locale);
|
|
416
|
-
const w = l.getWeekInfo ? l.getWeekInfo() : l.weekInfo;
|
|
417
|
-
if (w?.firstDay) return w.firstDay % 7;
|
|
418
|
-
} catch {}
|
|
419
|
-
return 0;
|
|
420
|
-
}
|
|
421
|
-
/** Narrow weekday names, starting from firstDay(). */
|
|
422
|
-
function weekdays() {
|
|
423
|
-
const fd = firstDay();
|
|
424
|
-
const f = new Intl.DateTimeFormat(I18N.locale, { weekday: "narrow" });
|
|
425
|
-
return Array.from({ length: 7 }, (_, i) => f.format(new Date(2026, 10, 1 + (fd + i) % 7)));
|
|
426
|
-
}
|
|
427
|
-
/** Decimals by unit: money 0, percent 1, size 1, count 0; pass a number to force it. */
|
|
428
|
-
function number(v, dec) {
|
|
429
|
-
const dd = typeof dec === "number" ? dec : dec ? DECIMALS[dec] : 0;
|
|
430
|
-
return new Intl.NumberFormat(I18N.locale, {
|
|
431
|
-
minimumFractionDigits: dd,
|
|
432
|
-
maximumFractionDigits: dd
|
|
433
|
-
}).format(v);
|
|
434
|
-
}
|
|
435
|
-
function percent(v, dec = 1) {
|
|
436
|
-
return new Intl.NumberFormat(I18N.locale, {
|
|
437
|
-
style: "percent",
|
|
438
|
-
minimumFractionDigits: dec,
|
|
439
|
-
maximumFractionDigits: dec
|
|
440
|
-
}).format(v / 100);
|
|
441
|
-
}
|
|
442
|
-
/** Only KPI cards abbreviate: 1,284 萬 in zh-TW (萬、億), 12.8M in English.
|
|
443
|
-
* like: format v with the unit and decimals that `like` gets, so a counting KPI keeps its width. */
|
|
444
|
-
function compact(v, like) {
|
|
445
|
-
const ref = like ?? v;
|
|
446
|
-
if (Math.abs(ref) < 1e4) return number(v);
|
|
447
|
-
if (/^zh/i.test(I18N.locale)) {
|
|
448
|
-
const a = Math.abs(ref);
|
|
449
|
-
const [unit, div, maxDec] = a >= 1e8 ? [
|
|
450
|
-
"億",
|
|
451
|
-
1e8,
|
|
452
|
-
2
|
|
453
|
-
] : [
|
|
454
|
-
"萬",
|
|
455
|
-
1e4,
|
|
456
|
-
1
|
|
457
|
-
];
|
|
458
|
-
const finalStr = new Intl.NumberFormat(I18N.locale, { maximumFractionDigits: maxDec }).format(a / div);
|
|
459
|
-
const sign = v < 0 ? "-" : "";
|
|
460
|
-
if (like === void 0) return `${sign}${finalStr} ${unit}`;
|
|
461
|
-
const digits = (finalStr.split(".")[1] || "").length;
|
|
462
|
-
return `${sign}${new Intl.NumberFormat(I18N.locale, {
|
|
463
|
-
minimumFractionDigits: digits,
|
|
464
|
-
maximumFractionDigits: digits
|
|
465
|
-
}).format(Math.abs(v) / div)} ${unit}`;
|
|
466
|
-
}
|
|
467
|
-
const nf = new Intl.NumberFormat(I18N.locale, {
|
|
468
|
-
notation: "compact",
|
|
469
|
-
maximumFractionDigits: 1
|
|
470
|
-
});
|
|
471
|
-
if (like === void 0) return nf.format(v);
|
|
472
|
-
const parts = nf.formatToParts(ref);
|
|
473
|
-
let num = "";
|
|
474
|
-
let dec = "";
|
|
475
|
-
for (const pt of parts) {
|
|
476
|
-
if (pt.type === "integer") num += pt.value;
|
|
477
|
-
if (pt.type === "fraction") {
|
|
478
|
-
num += "." + pt.value;
|
|
479
|
-
dec = pt.value;
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
const scale = 10 ** Math.round(Math.log10(Math.abs(ref) / (parseFloat(num) || 1)));
|
|
483
|
-
const inner = new Intl.NumberFormat(I18N.locale, {
|
|
484
|
-
minimumFractionDigits: dec.length,
|
|
485
|
-
maximumFractionDigits: dec.length
|
|
486
|
-
}).format(Math.abs(v) / scale);
|
|
487
|
-
let done = false;
|
|
488
|
-
const body = parts.map((pt) => {
|
|
489
|
-
if (pt.type === "integer" || pt.type === "group" || pt.type === "decimal" || pt.type === "fraction") {
|
|
490
|
-
if (done) return "";
|
|
491
|
-
done = true;
|
|
492
|
-
return inner;
|
|
493
|
-
}
|
|
494
|
-
return pt.value;
|
|
495
|
-
}).join("");
|
|
496
|
-
return (v < 0 && ref >= 0 ? "-" : "") + body;
|
|
497
|
-
}
|
|
498
|
-
/** zh-TW with TWD: NT$ 1,280, negatives -NT$ 1,280. Other locales and currencies: Intl's own symbol and order. */
|
|
499
|
-
function money(v, o = {}) {
|
|
500
|
-
const cur = o.currency || I18N.currency;
|
|
501
|
-
const body = o.compact ? compact(Math.abs(v), o.like !== void 0 ? Math.abs(o.like) : void 0) : number(Math.abs(v), "money");
|
|
502
|
-
if (isZhTW() && cur === "TWD") return `${v < 0 ? "-" : ""}NT$ ${body}`;
|
|
503
|
-
if (o.compact) return `${v < 0 ? "-" : ""}${body} ${cur}`;
|
|
504
|
-
return new Intl.NumberFormat(I18N.locale, {
|
|
505
|
-
style: "currency",
|
|
506
|
-
currency: cur,
|
|
507
|
-
currencyDisplay: "narrowSymbol",
|
|
508
|
-
minimumFractionDigits: 0,
|
|
509
|
-
maximumFractionDigits: cur === "TWD" || cur === "JPY" ? 0 : 2
|
|
510
|
-
}).format(v);
|
|
511
|
-
}
|
|
512
|
-
/** Bytes to 「186 KB」「54.9 MB」「1.2 GB」. */
|
|
513
|
-
function fileSize(b) {
|
|
514
|
-
if (b == null || Number.isNaN(b)) return "";
|
|
515
|
-
if (b < 1048576) return number(b === 0 ? 0 : Math.max(1, Math.round(b / 1024))) + " KB";
|
|
516
|
-
if (b < 1073741824) return number(b / 1048576, 1) + " MB";
|
|
517
|
-
return number(b / 1073741824, 1) + " GB";
|
|
518
|
-
}
|
|
519
|
-
/** Shortens a path: keeps the first segment and the last two, 「src/…/hooks/ops.c:58」. */
|
|
520
|
-
function path(p, o = {}) {
|
|
521
|
-
const head = o.head ?? 1;
|
|
522
|
-
const tail = o.tail ?? 2;
|
|
523
|
-
const parts = String(p ?? "").split("/");
|
|
524
|
-
return parts.length > head + tail ? `${parts.slice(0, head).join("/")}/…/${parts.slice(-tail).join("/")}` : String(p ?? "");
|
|
525
|
-
}
|
|
526
|
-
/** A part of a whole, as shown: 「1 / 1 個」「6 / 6 筆」, or 「1 / 5」 without a unit. Give screen readers
|
|
527
|
-
* `fractionLabel` with it: they read the slash as 「斜線」. */
|
|
528
|
-
function fraction(n, total, unit) {
|
|
529
|
-
return tr(unit ? "{n} / {total} {unit}" : "{n} / {total}", {
|
|
530
|
-
n: number(n),
|
|
531
|
-
total: number(total),
|
|
532
|
-
unit: unit ?? ""
|
|
533
|
-
});
|
|
534
|
-
}
|
|
535
|
-
/** The same fraction as read aloud: 「1 個中的 1 個」「6 筆中的 6 筆」, or 「5 中的 1」 without a unit (English:
|
|
536
|
-
* 「1 of 1」). For `aria-label`, or for visually hidden text beside the shown fraction. */
|
|
537
|
-
function fractionLabel(n, total, unit) {
|
|
538
|
-
return tr(unit ? "{total} {unit}中的 {n} {unit}" : "{total} 中的 {n}", {
|
|
539
|
-
n: number(n),
|
|
540
|
-
total: number(total),
|
|
541
|
-
unit: unit ?? ""
|
|
542
|
-
});
|
|
543
|
-
}
|
|
544
|
-
/** Every date, number, amount, size and path shown in the UI goes through these. */
|
|
545
|
-
const format = {
|
|
546
|
-
locale,
|
|
547
|
-
date,
|
|
548
|
-
time,
|
|
549
|
-
dateTime,
|
|
550
|
-
relative,
|
|
551
|
-
month,
|
|
552
|
-
weekdays,
|
|
553
|
-
firstDay,
|
|
554
|
-
number,
|
|
555
|
-
percent,
|
|
556
|
-
compact,
|
|
557
|
-
money,
|
|
558
|
-
fileSize,
|
|
559
|
-
path,
|
|
560
|
-
fraction,
|
|
561
|
-
fractionLabel
|
|
562
|
-
};
|
|
563
|
-
const fmtDate = (d) => d ? `${d.getFullYear()}/${pad2(d.getMonth() + 1)}/${pad2(d.getDate())}` : "";
|
|
564
|
-
function parseDate(s) {
|
|
565
|
-
const m = /^(\d{4})\/(\d{1,2})\/(\d{1,2})$/.exec(s || "");
|
|
566
|
-
if (!m) return null;
|
|
567
|
-
const d = new Date(+m[1], +m[2] - 1, +m[3]);
|
|
568
|
-
return d.getMonth() === +m[2] - 1 ? d : null;
|
|
569
|
-
}
|
|
570
|
-
const sameDay = (a, b) => !!a && !!b && a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
|
|
571
|
-
const dayAdd = (d, n) => new Date(d.getFullYear(), d.getMonth(), d.getDate() + n);
|
|
572
|
-
export { parseDate as a, addMessages as c, unitFor as d, format as i, setLocale as l, fileSize as n, sameDay as o, fmtDate as r, I18N as s, dayAdd as t, tr as u };
|
|
357
|
+
export { I18N, addMessages, isZhTW, setLocale, tr, unitFor };
|
|
573
358
|
|
|
574
|
-
//# sourceMappingURL=
|
|
359
|
+
//# sourceMappingURL=i18n.js.map
|
package/dist/i18n.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"i18n.js","names":[],"sources":["../src/i18n.ts"],"sourcesContent":["/* ---------- i18n and formats ----------\n Every built-in string is the zh-TW text passed through tr(); other languages come from UI.addMessages().\n Dates and numbers go through UI.format, which uses Intl for the current locale. The zh-TW rules are the\n ones the design system chose; other locales use their own conventions from Intl. */\ninterface I18nState {\n locale: string;\n currency: string;\n messages: Record<string, Record<string, string>>;\n}\n\nexport const I18N: I18nState = {\n locale: 'zh-TW',\n currency: 'TWD',\n messages: {\n en: {\n 'Email 或帳號': 'Email or username',\n '{label}:{a} 到 {b}': '{label}: {a} to {b}',\n '{n} 個百分點': '{n} pts',\n 上一頁: 'Previous page',\n 上個月: 'Previous month',\n '上傳失敗,請再試一次。': 'Upload failed. Try again.',\n 下一頁: 'Next page',\n 下個月: 'Next month',\n 主要導覽: 'Main navigation',\n 主題: 'Theme',\n 今天: 'Today',\n 全選: 'Select all',\n 全部: 'All',\n 全部標為已讀: 'Mark all as read',\n '共 {n} 筆': '{n} items',\n 分頁: 'Pagination',\n 刪除: 'Delete',\n 危險操作: 'Danger zone',\n 取消選取: 'Clear selection',\n '可以直接輸入,例如 2026/11/14': 'Type a date, e.g. 2026/11/14',\n 回上一頁: 'Go back',\n 回首頁: 'Go home',\n '完成 ✓': 'Done ✓',\n 密碼: 'Password',\n 展開側邊欄: 'Expand sidebar',\n '已選 {n} 筆': '{n} selected',\n 帳號: 'Username',\n 強調色: 'Accent color',\n 忘記密碼: 'Forgot password',\n 找不到符合的選項: 'No matching options',\n '拖放檔案,或 ': 'Drop files here, or ',\n 搜尋: 'Search',\n 操作: 'Actions',\n 收合側邊欄: 'Collapse sidebar',\n 釘選側邊欄: 'Pin sidebar',\n 取消釘選: 'Unpin sidebar',\n 放棄: 'Discard',\n '放棄未儲存的變更?': 'Discard unsaved changes?',\n '{label}?': '{label}?',\n '{name} 上傳進度': 'Upload progress of {name}',\n 左右方向鍵查看每一項的數值: 'Use ← and → to read each value',\n 左右方向鍵查看每一個時間點的數值: 'Use ← and → to read each point',\n 左右方向鍵移動播放頭: 'Use ← and → to move the playhead',\n 現在: 'Now',\n 預測: 'Forecast',\n 回到現在: 'Back to now',\n 回放: 'Replay',\n 停止回放: 'Stop replay',\n 全螢幕: 'Full screen',\n 離開全螢幕: 'Exit full screen',\n 側欄: 'Side panel',\n 更多表格操作: 'More table actions',\n 還原預設: 'Restore defaults',\n 已還原預設的欄位與欄寬: 'Columns and widths restored to defaults',\n 套用的篩選: 'Applied filters',\n '移除篩選:{name}': 'Remove filter: {name}',\n '篩選,已套用 {n} 個條件': 'Filter, {n} conditions applied',\n '{name}:{value}': '{name}: {value}',\n 時間控制: 'Time control',\n 沒有事件: 'No events',\n 人工: 'Manual',\n 切換: 'Switch',\n 告警: 'Alert',\n '{v}({t})': '{v} ({t})',\n 這段時間沒有資料: 'No data for this period',\n 沒有資料: 'No data',\n 差: 'Difference',\n 正常: 'Normal',\n '⚠ 注意': '⚠ Watch',\n '⚠ 超過上限': '⚠ Over limit',\n '注意 {v}': 'Watch {v}',\n '上限 {v}': 'Limit {v}',\n '新增「{q}」': 'Add “{q}”',\n '日期格式不正確,請寫成 2026/11/14': 'Invalid date. Use 2026/11/14.',\n 更多操作: 'More actions',\n 更多: 'More',\n 左右滑動: 'Scroll sideways',\n 跳到主要內容: 'Skip to main content',\n 說明: 'Explain',\n 開啟導覽: 'Open navigation',\n 顯示方式: 'View',\n 顯示線上文字: 'Show line labels',\n 線上文字: 'Line labels',\n 圖: 'Diagram',\n 清單: 'List',\n 項目: 'Items',\n 關係: 'Relations',\n 已展開: 'Expanded',\n 已收合: 'Collapsed',\n '已展開,{n} 個子項目': 'Expanded, {n} items',\n '顯示 {n} 筆': 'Showing {n} rows',\n 排序: 'Sort',\n '排序:{list}': 'Sort: {list}',\n 由小到大: 'ascending',\n 由大到小: 'descending',\n '依 {list} 排序': 'Sorted by {list}',\n ',再依 ': ', then by ',\n '、': ', ',\n 已還原原本的順序: 'Back to the original order',\n '{name},第 {n} 排序,{dir}': '{name}, sort level {n}, {dir}',\n '「{name}」第 {n} 排序;按 Alt+↑ ↓ 調整順序': '{name}, sort level {n}. Alt+Up or Down moves it',\n '「{name}」的方向': 'Direction of {name}',\n '移除「{name}」排序': 'Remove the sort by {name}',\n '照資料原本的順序。': 'In the original order.',\n '再依…': 'Then by…',\n '排序依據…': 'Sort by…',\n 再依哪一欄: 'Then by which column',\n 依哪一欄排序: 'Sort by which column',\n '最多 {n} 層排序。': 'Up to {n} sort levels.',\n '找到 {n} 筆結果': '{n} results',\n '第 {a} 步,共 {b} 步': 'Step {a} of {b}',\n '說明 {name}': 'Explain {name}',\n 程式碼: 'Code',\n '第 {n} 行': 'Line {n}',\n '第 {n} 層': 'Level {n}',\n 第一行: 'First line',\n 最後一行: 'Last line',\n '上 20 行': '20 lines up',\n '下 20 行': '20 lines down',\n 上一段: 'Previous section',\n 下一段: 'Next section',\n '上一行/下一行': 'Previous / next line',\n '上一個/下一個連結': 'Previous / next link',\n '上一個/下一個名詞': 'Previous / next term',\n '上一個/下一個連結或名詞': 'Previous / next link or term',\n 回到這一行: 'Back to the line',\n 開啟: 'Open',\n '{name},第 {n} 行': '{name}, line {n}',\n '顯示 {n} 筆,另有 {m} 筆,請輸入更長的字': 'Showing {n}, {m} more: type more to narrow it down',\n '縮排 {n} 格': 'indented {n} spaces',\n '縮排 {n} 個 tab': 'indented {n} tabs',\n '縮排 {a} 個 tab、{b} 格': 'indented {a} tabs and {b} spaces',\n 向右捲動: 'Scroll right',\n 筆: 'rows',\n '1 筆': '1 row',\n // Separators: full-width in Chinese, ASCII and a space in English.\n ',': ', ',\n ':': ': ',\n '。': '. ',\n '來自 {from},{label}': 'From {from}, {label}',\n '{from} 到 {to},{what}': '{from} to {to}, {what}',\n 到: 'to',\n '{label}({inferred})': '{label} ({inferred})',\n 調整面板寬度: 'Resize the panel',\n 調整架構圖高度: 'Resize the diagram height',\n '調整「{name}」欄寬': 'Resize the column {name}',\n 放大表格: 'Enlarge the table',\n 表格: 'Table',\n '{n} px': '{n} px',\n '主要區域 {a} px,面板 {b} px': 'Main area {a} px, panel {b} px',\n 'repo 外': 'outside the repo',\n 詳細: 'Details',\n '展開 {name}': 'Expand {name}',\n '收合 {name}': 'Collapse {name}',\n 字: 'characters',\n 'C 語言': 'C',\n 程式語言: 'Language',\n 全部頁面: 'All pages',\n '最近 30 天': 'Last 30 days',\n '最近 7 天': 'Last 7 days',\n 期間: 'Period',\n 未讀: 'Unread',\n 本月: 'This month',\n 沒有符合的資料: 'No matching data',\n 沒有通知: 'No notifications',\n 清除: 'Clear',\n 清除搜尋: 'Clear search',\n 登入: 'Sign in',\n 發生錯誤: 'Something went wrong',\n '移除 {name}': 'Remove {name}',\n '第 {a}–{b} 筆,共 {n} 筆': '{a}–{b} of {n}',\n 繼續編輯: 'Keep editing',\n '自訂強調色(色碼)': 'Custom accent color (hex)',\n '色碼格式不正確,例如 #2457d6': 'Invalid hex, e.g. #2457d6',\n 設定分類: 'Settings sections',\n 請輸入密碼: 'Enter your password',\n 請輸入帳號: 'Enter your username',\n 請選擇: 'Select',\n 路徑: 'Breadcrumb',\n 較上週: 'vs last week',\n 載入中: 'Loading',\n '輸入 # 加 6 碼': 'Enter # and 6 digits',\n 通知: 'Notifications',\n '通知,{n} 則未讀': 'Notifications, {n} unread',\n '選取第 {n} 筆': 'Select row {n}',\n 選擇日期: 'Choose date',\n 選擇期間: 'Choose period',\n 選擇檔案: 'choose files',\n 重試: 'Retry',\n 開啟日曆: 'Open calendar',\n 關閉: 'Close',\n '關閉後,剛才的修改不會保留。': 'If you close now, your changes will be lost.',\n 關閉提示: 'Dismiss',\n 鍵盤操作: 'Keyboard',\n 顯示或關閉這份說明: 'Show or hide this list',\n 檔案總管: 'Explorer',\n 右側欄: 'Side bar',\n 下方面板: 'Panel',\n 有新內容: 'New content',\n '更多分頁({n} 個)': 'More tabs ({n})',\n '更多 {n}': '{n} more',\n 位置不變: 'Same place',\n 放開以排在這裡: 'Drop to place it here',\n '放開以移到{region}': 'Drop to move to the {region}',\n '把目前分頁移到{region}': 'Move this tab to the {region}',\n '收合{region}': 'Hide the {region}',\n '關閉{region}': 'Close the {region}',\n '{region}寬度': '{region} width',\n '{region}高度': '{region} height',\n 面板高度: 'Panel height',\n 面板分頁: 'Panel tabs',\n 目前分頁往左移: 'Move this tab left',\n 目前分頁往右移: 'Move this tab right',\n 收起面板: 'Hide the panel',\n 編輯器: 'Editor',\n 開始: 'Start',\n 'AI 說明': 'AI note',\n 'AI 撰寫': 'AI-written',\n '({v})': ' ({v})',\n 隱藏密碼: 'Hide password',\n 顯示密碼: 'Show password',\n '(今天)': ' (today)',\n 伺服器暫時無法回應: 'The server is not responding',\n 找不到這個頁面: 'Page not found',\n 沒有權限查看這個頁面: 'You do not have access to this page',\n '網址可能打錯了,或這個頁面已經移除。': 'The address may be wrong, or the page has been removed.',\n '這個問題已經記錄下來,請稍後重新整理再試。': 'The problem has been logged. Refresh the page later.',\n '請向管理員申請權限,或切換成有權限的帳號。': 'Ask an admin for access, or switch to an account that has it.',\n 自動: 'Auto',\n 淺色: 'Light',\n 深色: 'Dark',\n 藍: 'Blue',\n 靛: 'Indigo',\n 紫: 'Purple',\n 桃紅: 'Pink',\n 紅: 'Red',\n 橘: 'Orange',\n 綠: 'Green',\n 青: 'Teal',\n 草稿: 'Draft',\n 進行中: 'In progress',\n 審核中: 'In review',\n 完成: 'Done',\n 失敗: 'Failed',\n 檢視: 'Views',\n '{n} / {total} 筆': '{n} / {total}',\n '{n} / {total} {unit}': '{n} / {total} {unit}',\n '{n} / {total}': '{n} / {total}',\n '{total} {unit}中的 {n} {unit}': '{n} of {total} {unit}',\n '{total} 中的 {n}': '{n} of {total}',\n 欄位: 'Columns',\n 顯示的欄位: 'Visible columns',\n 清除篩選: 'Clear filters',\n 清除全部: 'Clear all',\n 篩選: 'Filter',\n 最低: 'Min',\n 最高: 'Max',\n '合計 {n} 筆': 'Total: {n}',\n 平均: 'Avg',\n '選取 {name}': 'Select {name}',\n '{n} 個新': '{n} new',\n '{n} 個檔案': '{n} files',\n '下載 {name}': 'Download {name}',\n '已選 {n} 個檔案': '{n} files selected',\n '共 {size}': '{size} total',\n 清除選取: 'Clear selection',\n 下載: 'Download',\n 全部展開: 'Expand all',\n 全部收合: 'Collapse all',\n 這裡還沒有檔案: 'No files here yet',\n 顯示全部: 'Show all',\n 收合: 'Show less',\n 依狀態篩選: 'Filter by status',\n 展開: 'Expand',\n 沒有項目: 'Nothing here',\n 即時: 'Live',\n 已過期: 'Stale',\n 離線: 'Offline',\n 切換專案: 'Switch project',\n '切換專案,目前是 {name}': 'Switch project, now {name}',\n 推測: 'Inferred',\n '{n} 個項目': '{n} items',\n '1 個項目': '1 item',\n '{a} 個項目使用,共 {b} 次': 'Used {b} times by {a} items',\n 共用項目: 'Shared',\n 次數越多線越粗: 'Thicker lines mean more often',\n 架構圖: 'Architecture',\n '{n} 次': '{n} calls',\n '1 次': '1 call',\n 原始碼: 'Source',\n '顯示全部 {n} 行': 'Show all {n} lines',\n '只顯示第 {n} 行前後': 'Show only around line {n}',\n '無法載入 {name} 的子項目': 'Could not load the children of {name}',\n '找不到符合「{q}」的結果': 'No results for “{q}”',\n 輸入名稱開始搜尋: 'Type a name to search',\n 搜尋中: 'Searching',\n 搜尋結果: 'Search results',\n 最近開啟: 'Recently opened',\n 選擇: 'Select',\n 打開: 'Open',\n 取消: 'Cancel',\n 略過: 'Skip',\n 上一步: 'Back',\n 下一步: 'Next',\n 建議修正: 'Suggested fix',\n 複製修正: 'Copy fix',\n 已複製: 'Copied',\n 複製程式碼: 'Copy code',\n '原本:': 'Before: ',\n '改成:': 'After: ',\n 關閉說明: 'Close explanation',\n ',有說明': ', has an explanation',\n '(說明)': ' (explain)',\n '搜尋({k})': 'Search ({k})',\n 確定的關係: 'Confirmed',\n 推測的關係: 'Inferred',\n 專案宣告的關係: 'Declared by the project',\n 宣告: 'Declared',\n 外部項目: 'External',\n },\n },\n};\n\nfunction msgsFor(loc: string): Record<string, string> | null {\n return I18N.messages[loc] || I18N.messages[loc.split('-')[0]] || null;\n}\n\n/** Translates a built-in zh-TW string into the current locale; {name} placeholders take vars. */\nexport function tr(key: string, vars?: Record<string, string | number>): string {\n // zh-TW (and zh-Hant) is the source text; other Chinese locales (zh-CN) use the messages an app adds for them.\n const m = isZhTW() ? null : msgsFor(I18N.locale);\n const out = m?.[key] ?? key;\n return vars ? out.replace(/\\{(\\w+)\\}/g, (a, k: string) => (vars[k] !== undefined ? String(vars[k]) : a)) : out;\n}\n\n/** A count's unit: a function gets the count (for plurals, 「1 row」「2 rows」); a string goes through tr(), and for 1\n * the message 「1 <unit>」 is used when the locale has one (「1 筆」 → 「1 row」), without the number. */\nexport type CountUnit = string | ((n: number) => string);\nexport function unitFor(unit: CountUnit | undefined, n: number): string {\n if (!unit) return '';\n if (typeof unit === 'function') return unit(n);\n if (n === 1) {\n const one = tr('1 ' + unit);\n if (one !== '1 ' + unit) return one.replace(/^1\\s*/, '');\n }\n return tr(unit);\n}\n\n/** Switches the interface language and, optionally, the currency used by format.money. */\nexport function setLocale(locale: string, opts?: { currency?: string }): void {\n I18N.locale = locale || 'zh-TW';\n if (opts?.currency) I18N.currency = opts.currency;\n if (typeof document !== 'undefined') document.documentElement.setAttribute('lang', I18N.locale);\n}\n\n/** Adds or overrides translations for a locale. Keys are the zh-TW strings. */\nexport function addMessages(locale: string, dict: Record<string, string>): void {\n I18N.messages[locale] = { ...I18N.messages[locale], ...dict };\n}\n\nexport const isZhTW = (): boolean => /^zh-(TW|Hant)/i.test(I18N.locale);\n"],"mappings":";AAUA,MAAa,OAAkB;CAC7B,QAAQ;CACR,UAAU;CACV,UAAU,EACR,IAAI;EACF,aAAa;EACb,qBAAqB;EACrB,YAAY;EACZ,KAAK;EACL,KAAK;EACL,eAAe;EACf,KAAK;EACL,KAAK;EACL,MAAM;EACN,IAAI;EACJ,IAAI;EACJ,IAAI;EACJ,IAAI;EACJ,QAAQ;EACR,WAAW;EACX,IAAI;EACJ,IAAI;EACJ,MAAM;EACN,MAAM;EACN,wBAAwB;EACxB,MAAM;EACN,KAAK;EACL,QAAQ;EACR,IAAI;EACJ,OAAO;EACP,YAAY;EACZ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OAAO,KAAK,EAAE,IAAI,CAAE,IAAI;AAC7G;AAKA,SAAgB,QAAQ,MAA6B,GAAmB;CACtE,IAAI,CAAC,MAAM,OAAO;CAClB,IAAI,OAAO,SAAS,YAAY,OAAO,KAAK,CAAC;CAC7C,IAAI,MAAM,GAAG;EACX,MAAM,MAAM,GAAG,OAAO,IAAI;EAC1B,IAAI,QAAQ,OAAO,MAAM,OAAO,IAAI,QAAQ,SAAS,EAAE;CACzD;CACA,OAAO,GAAG,IAAI;AAChB;;AAGA,SAAgB,UAAU,QAAgB,MAAoC;CAC5E,KAAK,SAAS,UAAU;CACxB,IAAI,MAAM,UAAU,KAAK,WAAW,KAAK;CACzC,IAAI,OAAO,aAAa,aAAa,SAAS,gBAAgB,aAAa,QAAQ,KAAK,MAAM;AAChG;;AAGA,SAAgB,YAAY,QAAgB,MAAoC;CAC9E,KAAK,SAAS,UAAU;EAAE,GAAG,KAAK,SAAS;EAAS,GAAG;CAAK;AAC9D;AAEA,MAAa,eAAwB,iBAAiB,KAAK,KAAK,MAAM"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { IconName } from "./data.js";
|
|
2
|
+
/** Path data for a custom 24 x 24 stroke icon ('M4 12h16'), or SVG markup on a 256 x 256 viewBox. */
|
|
3
|
+
export type CustomIcon = `M${string}` | `m${string}` | `<${string}`;
|
|
4
|
+
/** What an `icon` prop takes: a built-in name (checked by TypeScript) or a custom icon. */
|
|
5
|
+
export type IconSource = IconName | CustomIcon;
|
|
6
|
+
export interface IconProps {
|
|
7
|
+
/** Built-in Phosphor name, e.g. 'house', 'trash' (Lucide names work as aliases). */
|
|
8
|
+
name?: IconName;
|
|
9
|
+
/** A custom icon when it is not built in: 24 px path data, or SVG markup. */
|
|
10
|
+
d?: CustomIcon;
|
|
11
|
+
/** Default 20. */
|
|
12
|
+
size?: number;
|
|
13
|
+
/** Stroke width of a custom path icon. Default 2. */
|
|
14
|
+
strokeWidth?: number;
|
|
15
|
+
/** The Fill version, for a selected item. */
|
|
16
|
+
filled?: boolean;
|
|
17
|
+
className?: string;
|
|
18
|
+
}
|
|
19
|
+
/** Phosphor icon, 20 px, inherits the text color. Decorative: label the control that holds it. */
|
|
20
|
+
export declare function Icon({ name, d, size, strokeWidth, filled, className }: IconProps): import("react").JSX.Element;
|
|
21
|
+
/** Markup of every built-in icon by name, aliases included. */
|
|
22
|
+
export declare const icons: Readonly<Record<IconName, string>>;
|
|
23
|
+
export type { IconName };
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { PH, PH_ALIAS, PH_FILL } from "./data.js";
|
|
3
|
+
import { cx } from "../internal/util.js";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
// src/icons/Icon.tsx
|
|
6
|
+
const BY_MARKUP = /* @__PURE__ */ new Map();
|
|
7
|
+
for (const k of Object.keys(PH)) {
|
|
8
|
+
BY_MARKUP.set(PH[k], k);
|
|
9
|
+
BY_MARKUP.set(PH_FILL[k], k);
|
|
10
|
+
}
|
|
11
|
+
const isName = (s) => s in PH || s in PH_ALIAS;
|
|
12
|
+
/** The Phosphor name behind a name, an alias or the markup of a built-in icon. */
|
|
13
|
+
function iconKey(source) {
|
|
14
|
+
if (!source) return void 0;
|
|
15
|
+
if (isName(source)) return source in PH ? source : PH_ALIAS[source];
|
|
16
|
+
return BY_MARKUP.get(source);
|
|
17
|
+
}
|
|
18
|
+
/** Phosphor icon, 20 px, inherits the text color. Decorative: label the control that holds it. */
|
|
19
|
+
function Icon({ name, d, size = 20, strokeWidth = 2, filled, className }) {
|
|
20
|
+
const key = iconKey(name ?? d);
|
|
21
|
+
const base = {
|
|
22
|
+
className: cx("ui-icon", className),
|
|
23
|
+
width: size,
|
|
24
|
+
height: size,
|
|
25
|
+
"aria-hidden": true
|
|
26
|
+
};
|
|
27
|
+
if (key) return /* @__PURE__ */ jsx("svg", {
|
|
28
|
+
...base,
|
|
29
|
+
viewBox: "0 0 256 256",
|
|
30
|
+
fill: "currentColor",
|
|
31
|
+
dangerouslySetInnerHTML: { __html: filled ? PH_FILL[key] : PH[key] }
|
|
32
|
+
});
|
|
33
|
+
if (d?.startsWith("<")) return /* @__PURE__ */ jsx("svg", {
|
|
34
|
+
...base,
|
|
35
|
+
viewBox: "0 0 256 256",
|
|
36
|
+
fill: "currentColor",
|
|
37
|
+
dangerouslySetInnerHTML: { __html: d }
|
|
38
|
+
});
|
|
39
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
40
|
+
...base,
|
|
41
|
+
viewBox: "0 0 24 24",
|
|
42
|
+
fill: "none",
|
|
43
|
+
stroke: "currentColor",
|
|
44
|
+
strokeWidth,
|
|
45
|
+
strokeLinecap: "round",
|
|
46
|
+
strokeLinejoin: "round",
|
|
47
|
+
children: /* @__PURE__ */ jsx("path", { d })
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
/** Renders an `icon` prop value: a name or a custom icon. */
|
|
51
|
+
function IconOf({ icon, ...rest }) {
|
|
52
|
+
return isName(icon) ? /* @__PURE__ */ jsx(Icon, {
|
|
53
|
+
name: icon,
|
|
54
|
+
...rest
|
|
55
|
+
}) : /* @__PURE__ */ jsx(Icon, {
|
|
56
|
+
d: icon,
|
|
57
|
+
...rest
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
/** Markup of every built-in icon by name, aliases included. */
|
|
61
|
+
const icons = Object.freeze({
|
|
62
|
+
...Object.fromEntries(Object.entries({
|
|
63
|
+
close: "x",
|
|
64
|
+
edit: "pencil-simple",
|
|
65
|
+
more: "dots-three",
|
|
66
|
+
spinner: "circle-notch",
|
|
67
|
+
alert: "warning-circle",
|
|
68
|
+
warn: "warning",
|
|
69
|
+
chevronRight: "caret-right",
|
|
70
|
+
chevronDown: "caret-down",
|
|
71
|
+
panelClose: "sidebar-simple",
|
|
72
|
+
panelOpen: "sidebar-simple",
|
|
73
|
+
filter: "funnel",
|
|
74
|
+
refresh: "arrows-clockwise"
|
|
75
|
+
}).map(([alias, target]) => [alias, PH[target]])),
|
|
76
|
+
...PH,
|
|
77
|
+
...Object.fromEntries(Object.entries(PH_ALIAS).map(([alias, target]) => [alias, PH[target]]))
|
|
78
|
+
});
|
|
79
|
+
function Spinner() {
|
|
80
|
+
return /* @__PURE__ */ jsx(Icon, {
|
|
81
|
+
name: "circle-notch",
|
|
82
|
+
className: "ui-spin",
|
|
83
|
+
size: 16
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
/** The check mark of Checkbox and selected options, 24 px path. */
|
|
87
|
+
const CHECK = "M4 12.5l5 5L20 6.5";
|
|
88
|
+
export { CHECK, Icon, IconOf, Spinner, icons };
|
|
89
|
+
|
|
90
|
+
//# sourceMappingURL=Icon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Icon.js","names":[],"sources":["../../src/icons/Icon.tsx"],"sourcesContent":["import { PH, PH_ALIAS, PH_FILL, type IconName, type PhosphorName } from './data';\nimport { cx } from '../internal/util';\n\nexport type { IconName } from './data';\n\n/** Path data for a custom 24 x 24 stroke icon ('M4 12h16'), or SVG markup on a 256 x 256 viewBox. */\nexport type CustomIcon = `M${string}` | `m${string}` | `<${string}`;\n/** What an `icon` prop takes: a built-in name (checked by TypeScript) or a custom icon. */\nexport type IconSource = IconName | CustomIcon;\n\nconst BY_MARKUP = new Map<string, PhosphorName>();\nfor (const k of Object.keys(PH) as PhosphorName[]) {\n BY_MARKUP.set(PH[k], k);\n BY_MARKUP.set(PH_FILL[k], k);\n}\n\nconst isName = (s: string): s is IconName => s in PH || s in PH_ALIAS;\n\n/** The Phosphor name behind a name, an alias or the markup of a built-in icon. */\nfunction iconKey(source: string | undefined): PhosphorName | undefined {\n if (!source) return undefined;\n if (isName(source)) return source in PH ? (source as PhosphorName) : PH_ALIAS[source as keyof typeof PH_ALIAS];\n return BY_MARKUP.get(source);\n}\n\nexport interface IconProps {\n /** Built-in Phosphor name, e.g. 'house', 'trash' (Lucide names work as aliases). */\n name?: IconName;\n /** A custom icon when it is not built in: 24 px path data, or SVG markup. */\n d?: CustomIcon;\n /** Default 20. */\n size?: number;\n /** Stroke width of a custom path icon. Default 2. */\n strokeWidth?: number;\n /** The Fill version, for a selected item. */\n filled?: boolean;\n className?: string;\n}\n\n/** Phosphor icon, 20 px, inherits the text color. Decorative: label the control that holds it. */\nexport function Icon({ name, d, size = 20, strokeWidth = 2, filled, className }: IconProps) {\n const key = iconKey(name ?? d);\n const base = { className: cx('ui-icon', className), width: size, height: size, 'aria-hidden': true } as const;\n if (key) return <svg {...base} viewBox=\"0 0 256 256\" fill=\"currentColor\" dangerouslySetInnerHTML={{ __html: filled ? PH_FILL[key] : PH[key] }} />;\n if (d?.startsWith('<')) return <svg {...base} viewBox=\"0 0 256 256\" fill=\"currentColor\" dangerouslySetInnerHTML={{ __html: d }} />;\n return (\n <svg {...base} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={strokeWidth} strokeLinecap=\"round\" strokeLinejoin=\"round\">\n <path d={d} />\n </svg>\n );\n}\n\n/** Renders an `icon` prop value: a name or a custom icon. */\nexport function IconOf({ icon, ...rest }: Omit<IconProps, 'name' | 'd'> & { icon: IconSource }) {\n return isName(icon) ? <Icon name={icon} {...rest} /> : <Icon d={icon} {...rest} />;\n}\n\n/** Names the first bundle used for a few icons; kept so old pages keep working. Pass the Phosphor name instead. */\nconst LEGACY: Record<string, PhosphorName> = {\n close: 'x',\n edit: 'pencil-simple',\n more: 'dots-three',\n spinner: 'circle-notch',\n alert: 'warning-circle',\n warn: 'warning',\n chevronRight: 'caret-right',\n chevronDown: 'caret-down',\n panelClose: 'sidebar-simple',\n panelOpen: 'sidebar-simple',\n filter: 'funnel',\n refresh: 'arrows-clockwise',\n};\n\n/** Markup of every built-in icon by name, aliases included. */\nexport const icons: Readonly<Record<IconName, string>> = Object.freeze({\n ...Object.fromEntries(Object.entries(LEGACY).map(([alias, target]) => [alias, PH[target]])),\n ...PH,\n ...Object.fromEntries(Object.entries(PH_ALIAS).map(([alias, target]) => [alias, PH[target as PhosphorName]])),\n} as Record<IconName, string>);\n\nexport function Spinner() {\n return <Icon name=\"circle-notch\" className=\"ui-spin\" size={16} />;\n}\n\n/** The check mark of Checkbox and selected options, 24 px path. */\nexport const CHECK: CustomIcon = 'M4 12.5l5 5L20 6.5';\n"],"mappings":";;;;;AAUA,MAAM,4BAAY,IAAI,IAA0B;AAChD,KAAK,MAAM,KAAK,OAAO,KAAK,EAAE,GAAqB;CACjD,UAAU,IAAI,GAAG,IAAI,CAAC;CACtB,UAAU,IAAI,QAAQ,IAAI,CAAC;AAC7B;AAEA,MAAM,UAAU,MAA6B,KAAK,MAAM,KAAK;;AAG7D,SAAS,QAAQ,QAAsD;CACrE,IAAI,CAAC,QAAQ,OAAO,KAAA;CACpB,IAAI,OAAO,MAAM,GAAG,OAAO,UAAU,KAAM,SAA0B,SAAS;CAC9E,OAAO,UAAU,IAAI,MAAM;AAC7B;;AAiBA,SAAgB,KAAK,EAAE,MAAM,GAAG,OAAO,IAAI,cAAc,GAAG,QAAQ,aAAwB;CAC1F,MAAM,MAAM,QAAQ,QAAQ,CAAC;CAC7B,MAAM,OAAO;EAAE,WAAW,GAAG,WAAW,SAAS;EAAG,OAAO;EAAM,QAAQ;EAAM,eAAe;CAAK;CACnG,IAAI,KAAK,OAAO,oBAAC,OAAD;EAAK,GAAI;EAAM,SAAQ;EAAc,MAAK;EAAe,yBAAyB,EAAE,QAAQ,SAAS,QAAQ,OAAO,GAAG,KAAK;CAAI,CAAA;CAChJ,IAAI,GAAG,WAAW,GAAG,GAAG,OAAO,oBAAC,OAAD;EAAK,GAAI;EAAM,SAAQ;EAAc,MAAK;EAAe,yBAAyB,EAAE,QAAQ,EAAE;CAAI,CAAA;CACjI,OACE,oBAAC,OAAD;EAAK,GAAI;EAAM,SAAQ;EAAY,MAAK;EAAO,QAAO;EAA4B;EAAa,eAAc;EAAQ,gBAAe;EAClI,UAAA,oBAAC,QAAD,EAAS,EAAI,CAAA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