@seanyeh77/ui 0.43.1 → 0.45.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +1 -1
- package/dist/bundle.js +20 -20
- package/dist/components/AccentPicker/AccentPicker.d.ts +1 -0
- package/dist/components/AccentPicker/AccentPicker.js +92 -72
- package/dist/components/AccentPicker/AccentPicker.js.map +1 -1
- package/dist/components/ActionBar/ActionBar.d.ts +2 -0
- package/dist/components/ActionBar/ActionBar.js.map +1 -1
- package/dist/components/AiMark/AiMark.d.ts +1 -0
- package/dist/components/AiMark/AiMark.js.map +1 -1
- package/dist/components/Alert/Alert.d.ts +6 -3
- package/dist/components/Alert/Alert.js +18 -14
- package/dist/components/Alert/Alert.js.map +1 -1
- package/dist/components/AppShell/AppShell.d.ts +10 -4
- package/dist/components/AppShell/AppShell.js +30 -19
- package/dist/components/AppShell/AppShell.js.map +1 -1
- package/dist/components/Badge/Badge.d.ts +24 -7
- package/dist/components/Badge/Badge.js +78 -21
- package/dist/components/Badge/Badge.js.map +1 -1
- package/dist/components/BarChart/BarChart.d.ts +14 -1
- package/dist/components/BarChart/BarChart.js +88 -59
- package/dist/components/BarChart/BarChart.js.map +1 -1
- package/dist/components/Breadcrumb/Breadcrumb.d.ts +1 -0
- package/dist/components/Breadcrumb/Breadcrumb.js.map +1 -1
- package/dist/components/Button/Button.d.ts +4 -1
- package/dist/components/Button/Button.js +17 -3
- package/dist/components/Button/Button.js.map +1 -1
- package/dist/components/Calendar/Calendar.d.ts +11 -2
- package/dist/components/Calendar/Calendar.js +16 -5
- package/dist/components/Calendar/Calendar.js.map +1 -1
- package/dist/components/Card/Card.d.ts +1 -0
- package/dist/components/Card/Card.js.map +1 -1
- package/dist/components/Checkbox/Checkbox.d.ts +24 -8
- package/dist/components/Checkbox/Checkbox.js +22 -9
- package/dist/components/Checkbox/Checkbox.js.map +1 -1
- package/dist/components/CodeView/CodeView.d.ts +3 -0
- package/dist/components/CodeView/CodeView.js +6 -6
- package/dist/components/CodeView/CodeView.js.map +1 -1
- package/dist/components/CommandPalette/CommandPalette.d.ts +16 -4
- package/dist/components/CommandPalette/CommandPalette.js +38 -11
- package/dist/components/CommandPalette/CommandPalette.js.map +1 -1
- package/dist/components/ConsoleLayout/ConsoleLayout.d.ts +2 -3
- package/dist/components/ConsoleLayout/ConsoleLayout.js +4 -1
- package/dist/components/ConsoleLayout/ConsoleLayout.js.map +1 -1
- package/dist/components/DangerZone/DangerZone.d.ts +3 -2
- package/dist/components/DangerZone/DangerZone.js +3 -2
- package/dist/components/DangerZone/DangerZone.js.map +1 -1
- package/dist/components/DataTable/DataTable.d.ts +16 -4
- package/dist/components/DataTable/DataTable.js +346 -208
- package/dist/components/DataTable/DataTable.js.map +1 -1
- package/dist/components/DataTable/SortButton.js +48 -5
- package/dist/components/DataTable/SortButton.js.map +1 -1
- package/dist/components/DataTable/filters.js +2 -1
- package/dist/components/DataTable/filters.js.map +1 -1
- package/dist/components/DataTable/parts.js +1 -1
- package/dist/components/DataTable/parts.js.map +1 -1
- package/dist/components/DataTable/types.d.ts +10 -3
- package/dist/components/DatePicker/DatePicker.d.ts +9 -7
- package/dist/components/DatePicker/DatePicker.js +16 -6
- package/dist/components/DatePicker/DatePicker.js.map +1 -1
- package/dist/components/DateRangePicker/DateRangePicker.d.ts +12 -7
- package/dist/components/DateRangePicker/DateRangePicker.js +81 -45
- package/dist/components/DateRangePicker/DateRangePicker.js.map +1 -1
- package/dist/components/DetailList/DetailList.d.ts +2 -0
- package/dist/components/DetailList/DetailList.js.map +1 -1
- package/dist/components/Dialog/Dialog.d.ts +56 -20
- package/dist/components/Dialog/Dialog.js +46 -14
- package/dist/components/Dialog/Dialog.js.map +1 -1
- package/dist/components/Drawer/Drawer.d.ts +18 -5
- package/dist/components/Drawer/Drawer.js +87 -24
- package/dist/components/Drawer/Drawer.js.map +1 -1
- package/dist/components/EmptyState/EmptyState.d.ts +2 -2
- package/dist/components/EmptyState/EmptyState.js +3 -2
- package/dist/components/EmptyState/EmptyState.js.map +1 -1
- package/dist/components/ErrorPage/ErrorPage.d.ts +4 -0
- package/dist/components/ErrorPage/ErrorPage.js +2 -1
- package/dist/components/ErrorPage/ErrorPage.js.map +1 -1
- package/dist/components/EventTimeline/EventTimeline.d.ts +23 -5
- package/dist/components/EventTimeline/EventTimeline.js +64 -20
- package/dist/components/EventTimeline/EventTimeline.js.map +1 -1
- package/dist/components/FileUpload/FileUpload.d.ts +10 -2
- package/dist/components/FileUpload/FileUpload.js +5 -2
- package/dist/components/FileUpload/FileUpload.js.map +1 -1
- package/dist/components/FormGrid/FormGrid.d.ts +3 -1
- package/dist/components/FormGrid/FormGrid.js +5 -2
- package/dist/components/FormGrid/FormGrid.js.map +1 -1
- package/dist/components/Graph/Graph.d.ts +1 -0
- package/dist/components/Graph/Graph.js +8 -4
- package/dist/components/Graph/Graph.js.map +1 -1
- package/dist/components/Grid/Grid.d.ts +11 -4
- package/dist/components/Grid/Grid.js +14 -2
- package/dist/components/Grid/Grid.js.map +1 -1
- package/dist/components/IconButton/IconButton.d.ts +2 -1
- package/dist/components/IconButton/IconButton.js +10 -1
- package/dist/components/IconButton/IconButton.js.map +1 -1
- package/dist/components/InlineCode/InlineCode.d.ts +6 -0
- package/dist/components/InlineCode/InlineCode.js +10 -6
- package/dist/components/InlineCode/InlineCode.js.map +1 -1
- package/dist/components/KpiCard/KpiCard.d.ts +7 -3
- package/dist/components/KpiCard/KpiCard.js +40 -25
- package/dist/components/KpiCard/KpiCard.js.map +1 -1
- package/dist/components/LayerGraph/LayerGraph.d.ts +68 -23
- package/dist/components/LayerGraph/LayerGraph.js +178 -97
- package/dist/components/LayerGraph/LayerGraph.js.map +1 -1
- package/dist/components/LineChart/LineChart.d.ts +10 -3
- package/dist/components/LineChart/LineChart.js +55 -23
- package/dist/components/LineChart/LineChart.js.map +1 -1
- package/dist/components/Link/Link.d.ts +17 -0
- package/dist/components/Link/Link.js +47 -0
- package/dist/components/Link/Link.js.map +1 -0
- package/dist/components/LoadingBar/LoadingBar.d.ts +1 -0
- package/dist/components/LoadingBar/LoadingBar.js.map +1 -1
- package/dist/components/LoginCard/LoginCard.d.ts +9 -3
- package/dist/components/LoginCard/LoginCard.js +99 -78
- package/dist/components/LoginCard/LoginCard.js.map +1 -1
- package/dist/components/Markdown/Markdown.d.ts +1 -0
- package/dist/components/Markdown/Markdown.js +20 -2
- package/dist/components/Markdown/Markdown.js.map +1 -1
- package/dist/components/Menu/Menu.d.ts +4 -2
- package/dist/components/Menu/Menu.js +43 -33
- package/dist/components/Menu/Menu.js.map +1 -1
- package/dist/components/Meter/Meter.d.ts +4 -0
- package/dist/components/Meter/Meter.js.map +1 -1
- package/dist/components/MobileTabBar/MobileTabBar.d.ts +3 -0
- package/dist/components/MobileTabBar/MobileTabBar.js.map +1 -1
- package/dist/components/MultiSelect/MultiSelect.d.ts +7 -6
- package/dist/components/MultiSelect/MultiSelect.js +27 -9
- package/dist/components/MultiSelect/MultiSelect.js.map +1 -1
- package/dist/components/NotificationBell/NotificationBell.d.ts +4 -0
- package/dist/components/NotificationBell/NotificationBell.js +4 -3
- package/dist/components/NotificationBell/NotificationBell.js.map +1 -1
- package/dist/components/PageHeader/PageHeader.d.ts +34 -0
- package/dist/components/PageHeader/PageHeader.js +68 -0
- package/dist/components/PageHeader/PageHeader.js.map +1 -0
- package/dist/components/Popover/Popover.d.ts +11 -4
- package/dist/components/Popover/Popover.js +17 -7
- package/dist/components/Popover/Popover.js.map +1 -1
- package/dist/components/ProgressBar/ProgressBar.d.ts +2 -0
- package/dist/components/ProgressBar/ProgressBar.js.map +1 -1
- package/dist/components/ProgressRing/ProgressRing.d.ts +1 -0
- package/dist/components/ProgressRing/ProgressRing.js.map +1 -1
- package/dist/components/ProjectSwitcher/ProjectSwitcher.d.ts +5 -1
- package/dist/components/ProjectSwitcher/ProjectSwitcher.js +16 -3
- package/dist/components/ProjectSwitcher/ProjectSwitcher.js.map +1 -1
- package/dist/components/RadioGroup/RadioGroup.d.ts +22 -5
- package/dist/components/RadioGroup/RadioGroup.js +48 -47
- package/dist/components/RadioGroup/RadioGroup.js.map +1 -1
- package/dist/components/RelativeTime/RelativeTime.d.ts +10 -0
- package/dist/components/RelativeTime/RelativeTime.js +44 -0
- package/dist/components/RelativeTime/RelativeTime.js.map +1 -0
- package/dist/components/SearchField/SearchField.d.ts +2 -0
- package/dist/components/SearchField/SearchField.js.map +1 -1
- package/dist/components/Section/Section.d.ts +4 -0
- package/dist/components/Section/Section.js +8 -22
- package/dist/components/Section/Section.js.map +1 -1
- package/dist/components/SegmentedControl/SegmentedControl.d.ts +22 -9
- package/dist/components/SegmentedControl/SegmentedControl.js +20 -19
- package/dist/components/SegmentedControl/SegmentedControl.js.map +1 -1
- package/dist/components/Select/Select.d.ts +7 -11
- package/dist/components/Select/Select.js +7 -3
- package/dist/components/Select/Select.js.map +1 -1
- package/dist/components/SettingsLayout/SettingsLayout.d.ts +33 -4
- package/dist/components/SettingsLayout/SettingsLayout.js +62 -14
- package/dist/components/SettingsLayout/SettingsLayout.js.map +1 -1
- package/dist/components/SideNav/SideNav.d.ts +2 -0
- package/dist/components/SideNav/SideNav.js +3 -3
- package/dist/components/SideNav/SideNav.js.map +1 -1
- package/dist/components/SplitPane/SplitPane.d.ts +1 -0
- package/dist/components/SplitPane/SplitPane.js.map +1 -1
- package/dist/components/StatusBand/StatusBand.d.ts +1 -0
- package/dist/components/StatusBand/StatusBand.js.map +1 -1
- package/dist/components/Suggestion/Suggestion.d.ts +6 -0
- package/dist/components/Suggestion/Suggestion.js.map +1 -1
- package/dist/components/Switch/Switch.d.ts +13 -3
- package/dist/components/Switch/Switch.js +16 -7
- package/dist/components/Switch/Switch.js.map +1 -1
- package/dist/components/Tabs/Tabs.d.ts +8 -1
- package/dist/components/Tabs/Tabs.js +6 -3
- package/dist/components/Tabs/Tabs.js.map +1 -1
- package/dist/components/Tag/Tag.d.ts +15 -7
- package/dist/components/Tag/Tag.js +22 -10
- package/dist/components/Tag/Tag.js.map +1 -1
- package/dist/components/Term/Term.d.ts +8 -3
- package/dist/components/Term/Term.js +1 -1
- package/dist/components/Term/Term.js.map +1 -1
- package/dist/components/TextArea/TextArea.d.ts +6 -9
- package/dist/components/TextArea/TextArea.js +25 -12
- package/dist/components/TextArea/TextArea.js.map +1 -1
- package/dist/components/TextField/TextField.d.ts +8 -11
- package/dist/components/TextField/TextField.js +9 -7
- package/dist/components/TextField/TextField.js.map +1 -1
- package/dist/components/ThemePicker/ThemePicker.d.ts +1 -0
- package/dist/components/ThemePicker/ThemePicker.js +35 -34
- package/dist/components/ThemePicker/ThemePicker.js.map +1 -1
- package/dist/components/TimeControl/TimeControl.d.ts +1 -0
- package/dist/components/TimeControl/TimeControl.js.map +1 -1
- package/dist/components/Toast/Toast.d.ts +56 -3
- package/dist/components/Toast/Toast.js +191 -8
- package/dist/components/Toast/Toast.js.map +1 -1
- package/dist/components/TopBar/TopBar.d.ts +6 -2
- package/dist/components/TopBar/TopBar.js +7 -1
- package/dist/components/TopBar/TopBar.js.map +1 -1
- package/dist/components/Tour/Tour.d.ts +14 -3
- package/dist/components/Tour/Tour.js +26 -14
- package/dist/components/Tour/Tour.js.map +1 -1
- package/dist/components/TreeList/TreeList.d.ts +28 -4
- package/dist/components/TreeList/TreeList.js +32 -20
- package/dist/components/TreeList/TreeList.js.map +1 -1
- package/dist/components/Workbench/Workbench.d.ts +1 -0
- package/dist/components/Workbench/Workbench.js +24 -12
- package/dist/components/Workbench/Workbench.js.map +1 -1
- package/dist/components/ZoneMap/ZoneMap.d.ts +12 -2
- package/dist/components/ZoneMap/ZoneMap.js +13 -5
- package/dist/components/ZoneMap/ZoneMap.js.map +1 -1
- package/dist/components/useFormErrors/useFormErrors.d.ts +20 -0
- package/dist/components/useFormErrors/useFormErrors.js +55 -0
- package/dist/components/useFormErrors/useFormErrors.js.map +1 -0
- package/dist/css/AccentPicker.css +1 -0
- package/dist/css/Alert.css +8 -19
- package/dist/css/AppShell.css +1 -0
- package/dist/css/Badge.css +19 -45
- package/dist/css/BarChart.css +21 -3
- package/dist/css/Button.css +6 -1
- package/dist/css/Card.css +8 -8
- package/dist/css/Checkbox.css +20 -0
- package/dist/css/CodeView.css +3 -2
- package/dist/css/DangerZone.css +5 -3
- package/dist/css/DataTable.css +303 -69
- package/dist/css/DatePicker.css +1 -0
- package/dist/css/DateRangePicker.css +24 -2
- package/dist/css/Drawer.css +31 -0
- package/dist/css/EmptyState.css +1 -0
- package/dist/css/ErrorPage.css +4 -1
- package/dist/css/EventTimeline.css +34 -5
- package/dist/css/FileUpload.css +1 -0
- package/dist/css/FormGrid.css +12 -3
- package/dist/css/Graph.css +9 -1
- package/dist/css/Grid.css +8 -0
- package/dist/css/KpiCard.css +13 -1
- package/dist/css/LayerGraph.css +40 -15
- package/dist/css/Link.css +23 -0
- package/dist/css/LoginCard.css +17 -11
- package/dist/css/Markdown.css +31 -2
- package/dist/css/Menu.css +0 -2
- package/dist/css/Meter.css +16 -0
- package/dist/css/MultiSelect.css +1 -0
- package/dist/css/NotificationBell.css +1 -0
- package/dist/css/PageHeader.css +50 -0
- package/dist/css/ProgressBar.css +12 -0
- package/dist/css/ProjectSwitcher.css +25 -23
- package/dist/css/RelativeTime.css +2 -0
- package/dist/css/SegmentedControl.css +38 -10
- package/dist/css/Select.css +1 -0
- package/dist/css/SettingsLayout.css +29 -8
- package/dist/css/SideNav.css +4 -1
- package/dist/css/Skeleton.css +22 -1
- package/dist/css/Suggestion.css +1 -1
- package/dist/css/Switch.css +27 -0
- package/dist/css/Tabs.css +8 -7
- package/dist/css/Tag.css +19 -12
- package/dist/css/Term.css +1 -1
- package/dist/css/TextArea.css +1 -0
- package/dist/css/TextField.css +1 -0
- package/dist/css/Toast.css +101 -4
- package/dist/css/TopBar.css +21 -2
- package/dist/css/Tour.css +1 -1
- package/dist/css/TreeList.css +7 -3
- package/dist/css/Workbench.css +13 -1
- package/dist/css/ZoneMap.css +0 -1
- package/dist/css/base.css +45 -0
- package/dist/css/end.css +119 -5
- package/dist/deprecated.d.ts +3 -0
- package/dist/deprecated.js +13 -0
- package/dist/deprecated.js.map +1 -0
- package/dist/fonts.css +2 -7543
- package/dist/format.d.ts +3 -1
- package/dist/format.js +15 -5
- package/dist/format.js.map +1 -1
- package/dist/generated/themeDefaults.d.ts +8 -0
- package/dist/generated/themeDefaults.js +35 -0
- package/dist/generated/themeDefaults.js.map +1 -0
- package/dist/i18n.d.ts +7 -2
- package/dist/i18n.js +65 -10
- package/dist/i18n.js.map +1 -1
- package/dist/icons/Icon.d.ts +3 -1
- package/dist/icons/Icon.js.map +1 -1
- package/dist/index.d.ts +23 -14
- package/dist/index.js +14 -8
- package/dist/internal/Field.d.ts +19 -0
- package/dist/internal/Field.js +13 -6
- package/dist/internal/Field.js.map +1 -1
- package/dist/internal/FloatingPanel.js +2 -1
- package/dist/internal/FloatingPanel.js.map +1 -1
- package/dist/internal/chart.d.ts +4 -0
- package/dist/internal/chart.js +89 -19
- package/dist/internal/chart.js.map +1 -1
- package/dist/internal/codeSpans.js +20 -0
- package/dist/internal/codeSpans.js.map +1 -0
- package/dist/internal/dev.js +9 -4
- package/dist/internal/dev.js.map +1 -1
- package/dist/internal/focus.js +27 -3
- package/dist/internal/focus.js.map +1 -1
- package/dist/internal/focusMain.js +6 -2
- package/dist/internal/focusMain.js.map +1 -1
- package/dist/internal/open.d.ts +14 -0
- package/dist/internal/open.js +28 -0
- package/dist/internal/open.js.map +1 -0
- package/dist/internal/roving.js +37 -0
- package/dist/internal/roving.js.map +1 -0
- package/dist/internal/shell.js +12 -0
- package/dist/internal/shell.js.map +1 -0
- package/dist/internal/stored.js +89 -0
- package/dist/internal/stored.js.map +1 -0
- package/dist/internal/tableTools.js +46 -4
- package/dist/internal/tableTools.js.map +1 -1
- package/dist/internal/util.js +8 -17
- package/dist/internal/util.js.map +1 -1
- package/dist/locale.d.ts +17 -0
- package/dist/locale.js +29 -0
- package/dist/locale.js.map +1 -0
- package/dist/styles.css +1296 -400
- package/dist/theme.d.ts +23 -5
- package/dist/theme.js +85 -25
- package/dist/theme.js.map +1 -1
- package/dist/tokens.css +3 -0
- package/docs/AccentPicker.md +3 -1
- package/docs/Alert.md +4 -3
- package/docs/AppShell.md +11 -10
- package/docs/Badge.md +26 -16
- package/docs/BarChart.md +7 -4
- package/docs/Button.md +4 -5
- package/docs/Calendar.md +2 -2
- package/docs/Card.md +9 -8
- package/docs/Checkbox.md +4 -1
- package/docs/CodeView.md +30 -43
- package/docs/CommandPalette.md +3 -2
- package/docs/ConsoleLayout.md +5 -5
- package/docs/DangerZone.md +3 -2
- package/docs/DataColors.md +2 -2
- package/docs/DataTable.md +29 -141
- package/docs/DatePicker.md +1 -0
- package/docs/DateRangePicker.md +3 -0
- package/docs/DetailList.md +9 -9
- package/docs/Dialog.md +8 -4
- package/docs/Drawer.md +7 -4
- package/docs/ErrorPage.md +1 -1
- package/docs/EventTimeline.md +23 -12
- package/docs/FileUpload.md +1 -1
- package/docs/FormGrid.md +2 -1
- package/docs/Format.md +5 -3
- package/docs/Graph.md +1 -1
- package/docs/Grid.md +5 -1
- package/docs/KpiCard.md +6 -4
- package/docs/LayerGraph.md +18 -53
- package/docs/LineChart.md +5 -3
- package/docs/Link.md +22 -0
- package/docs/LoginCard.md +7 -3
- package/docs/Markdown.md +3 -13
- package/docs/Menu.md +2 -0
- package/docs/Meter.md +1 -0
- package/docs/MultiSelect.md +2 -1
- package/docs/NotificationBell.md +1 -0
- package/docs/PageHeader.md +34 -0
- package/docs/Popover.md +3 -1
- package/docs/ProgressBar.md +3 -1
- package/docs/ProjectSwitcher.md +14 -14
- package/docs/RadioGroup.md +2 -0
- package/docs/RelativeTime.md +23 -0
- package/docs/Section.md +1 -1
- package/docs/SegmentedControl.md +9 -6
- package/docs/Select.md +2 -1
- package/docs/SettingsLayout.md +19 -4
- package/docs/SideNav.md +1 -1
- package/docs/Skeleton.md +2 -1
- package/docs/Switch.md +3 -1
- package/docs/Tabs.md +4 -3
- package/docs/Tag.md +9 -7
- package/docs/Term.md +3 -3
- package/docs/TextArea.md +2 -1
- package/docs/TextField.md +5 -3
- package/docs/ThemePicker.md +3 -1
- package/docs/Toast.md +17 -5
- package/docs/TopBar.md +8 -5
- package/docs/Tour.md +3 -2
- package/docs/TreeList.md +10 -37
- package/docs/Workbench.md +1 -48
- package/docs/ZoneMap.md +5 -5
- package/docs/agents.md +82 -0
- package/docs/code.md +2 -2
- package/docs/components.json +314 -0
- package/docs/data.md +9 -18
- package/docs/forms.md +6 -5
- package/docs/guidelines.md +39 -31
- package/docs/icons.md +9 -0
- package/docs/layout.md +16 -20
- package/docs/motion.md +31 -56
- package/docs/theme.md +15 -18
- package/docs/useFormErrors.md +35 -0
- package/package.json +8 -7
- package/dist/bundle.js.map +0 -1
- package/dist/fonts/LICENSE-OFL.txt +0 -93
- package/dist/fonts/geist-mono-cyrillic-400-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-cyrillic-500-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-cyrillic-600-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-cyrillic-700-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-cyrillic-ext-400-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-cyrillic-ext-500-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-cyrillic-ext-600-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-cyrillic-ext-700-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-latin-400-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-latin-500-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-latin-600-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-latin-700-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-latin-ext-400-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-latin-ext-500-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-latin-ext-600-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-latin-ext-700-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-symbols2-400-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-symbols2-500-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-symbols2-600-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-symbols2-700-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-vietnamese-400-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-vietnamese-500-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-vietnamese-600-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-vietnamese-700-normal.woff2 +0 -0
- package/dist/fonts/inter-cyrillic-400-normal.woff2 +0 -0
- package/dist/fonts/inter-cyrillic-500-normal.woff2 +0 -0
- package/dist/fonts/inter-cyrillic-600-normal.woff2 +0 -0
- package/dist/fonts/inter-cyrillic-700-normal.woff2 +0 -0
- package/dist/fonts/inter-cyrillic-ext-400-normal.woff2 +0 -0
- package/dist/fonts/inter-cyrillic-ext-500-normal.woff2 +0 -0
- package/dist/fonts/inter-cyrillic-ext-600-normal.woff2 +0 -0
- package/dist/fonts/inter-cyrillic-ext-700-normal.woff2 +0 -0
- package/dist/fonts/inter-greek-400-normal.woff2 +0 -0
- package/dist/fonts/inter-greek-500-normal.woff2 +0 -0
- package/dist/fonts/inter-greek-600-normal.woff2 +0 -0
- package/dist/fonts/inter-greek-700-normal.woff2 +0 -0
- package/dist/fonts/inter-greek-ext-400-normal.woff2 +0 -0
- package/dist/fonts/inter-greek-ext-500-normal.woff2 +0 -0
- package/dist/fonts/inter-greek-ext-600-normal.woff2 +0 -0
- package/dist/fonts/inter-greek-ext-700-normal.woff2 +0 -0
- package/dist/fonts/inter-latin-400-normal.woff2 +0 -0
- package/dist/fonts/inter-latin-500-normal.woff2 +0 -0
- package/dist/fonts/inter-latin-600-normal.woff2 +0 -0
- package/dist/fonts/inter-latin-700-normal.woff2 +0 -0
- package/dist/fonts/inter-latin-ext-400-normal.woff2 +0 -0
- package/dist/fonts/inter-latin-ext-500-normal.woff2 +0 -0
- package/dist/fonts/inter-latin-ext-600-normal.woff2 +0 -0
- package/dist/fonts/inter-latin-ext-700-normal.woff2 +0 -0
- package/dist/fonts/inter-vietnamese-400-normal.woff2 +0 -0
- package/dist/fonts/inter-vietnamese-500-normal.woff2 +0 -0
- package/dist/fonts/inter-vietnamese-600-normal.woff2 +0 -0
- package/dist/fonts/inter-vietnamese-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-0-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-0-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-0-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-0-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-1-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-1-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-1-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-1-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-10-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-10-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-10-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-10-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-101-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-101-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-101-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-101-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-102-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-102-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-102-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-102-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-103-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-103-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-103-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-103-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-104-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-104-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-104-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-104-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-105-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-105-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-105-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-105-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-106-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-106-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-106-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-106-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-107-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-107-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-107-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-107-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-108-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-108-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-108-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-108-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-109-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-109-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-109-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-109-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-11-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-11-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-11-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-11-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-110-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-110-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-110-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-110-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-111-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-111-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-111-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-111-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-112-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-112-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-112-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-112-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-113-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-113-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-113-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-113-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-114-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-114-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-114-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-114-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-115-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-115-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-115-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-115-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-116-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-116-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-116-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-116-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-117-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-117-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-117-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-117-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-118-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-118-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-118-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-118-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-119-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-119-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-119-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-119-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-12-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-12-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-12-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-12-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-120-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-120-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-120-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-120-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-121-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-121-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-121-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-121-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-122-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-122-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-122-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-122-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-123-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-123-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-123-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-123-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-2-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-2-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-2-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-2-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-23-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-23-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-23-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-23-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-24-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-24-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-24-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-24-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-25-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-25-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-25-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-25-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-26-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-26-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-26-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-26-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-27-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-27-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-27-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-27-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-28-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-28-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-28-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-28-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-29-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-29-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-29-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-29-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-30-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-30-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-30-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-30-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-31-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-31-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-31-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-31-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-32-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-32-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-32-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-32-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-33-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-33-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-33-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-33-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-34-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-34-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-34-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-34-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-35-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-35-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-35-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-35-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-36-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-36-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-36-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-36-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-37-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-37-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-37-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-37-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-38-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-38-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-38-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-38-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-39-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-39-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-39-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-39-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-4-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-4-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-4-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-4-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-40-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-40-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-40-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-40-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-41-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-41-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-41-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-41-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-42-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-42-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-42-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-42-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-43-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-43-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-43-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-43-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-44-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-44-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-44-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-44-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-45-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-45-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-45-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-45-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-46-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-46-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-46-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-46-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-47-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-47-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-47-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-47-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-48-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-48-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-48-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-48-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-49-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-49-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-49-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-49-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-50-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-50-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-50-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-50-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-51-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-51-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-51-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-51-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-52-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-52-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-52-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-52-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-53-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-53-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-53-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-53-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-54-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-54-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-54-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-54-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-55-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-55-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-55-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-55-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-56-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-56-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-56-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-56-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-57-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-57-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-57-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-57-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-58-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-58-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-58-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-58-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-59-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-59-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-59-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-59-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-60-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-60-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-60-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-60-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-61-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-61-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-61-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-61-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-62-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-62-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-62-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-62-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-63-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-63-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-63-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-63-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-64-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-64-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-64-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-64-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-65-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-65-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-65-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-65-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-66-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-66-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-66-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-66-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-67-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-67-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-67-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-67-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-68-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-68-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-68-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-68-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-69-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-69-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-69-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-69-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-70-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-70-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-70-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-70-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-71-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-71-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-71-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-71-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-72-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-72-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-72-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-72-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-73-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-73-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-73-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-73-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-74-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-74-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-74-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-74-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-75-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-75-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-75-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-75-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-76-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-76-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-76-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-76-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-77-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-77-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-77-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-77-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-78-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-78-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-78-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-78-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-79-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-79-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-79-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-79-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-80-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-80-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-80-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-80-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-81-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-81-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-81-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-81-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-82-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-82-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-82-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-82-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-83-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-83-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-83-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-83-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-84-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-84-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-84-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-84-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-85-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-85-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-85-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-85-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-86-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-86-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-86-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-86-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-87-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-87-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-87-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-87-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-88-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-88-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-88-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-88-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-89-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-89-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-89-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-89-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-90-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-90-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-90-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-90-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-91-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-91-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-91-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-91-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-92-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-92-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-92-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-92-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-93-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-93-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-93-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-93-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-94-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-94-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-94-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-94-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-95-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-95-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-95-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-95-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-96-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-96-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-96-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-96-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-cyrillic-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-cyrillic-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-cyrillic-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-cyrillic-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-latin-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-latin-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-latin-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-latin-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-latin-ext-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-latin-ext-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-latin-ext-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-latin-ext-700-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-vietnamese-400-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-vietnamese-500-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-vietnamese-600-normal.woff2 +0 -0
- package/dist/fonts/noto-sans-tc-vietnamese-700-normal.woff2 +0 -0
package/dist/internal/dev.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
// src/internal/dev.ts
|
|
3
|
+
/** True in development builds (and in bundle.js). Wrap a check that costs time (loops over rows) in `if (DEV)`, or pass
|
|
4
|
+
* devWarn a function, so production builds skip it. */
|
|
3
5
|
const DEV = typeof __UI_DEV__ === "boolean" ? __UI_DEV__ : (() => {
|
|
4
6
|
try {
|
|
5
7
|
return process.env.NODE_ENV !== "production";
|
|
@@ -8,14 +10,17 @@ const DEV = typeof __UI_DEV__ === "boolean" ? __UI_DEV__ : (() => {
|
|
|
8
10
|
}
|
|
9
11
|
})();
|
|
10
12
|
const seen = /* @__PURE__ */ new Set();
|
|
11
|
-
/** Logs once per message when cond is
|
|
13
|
+
/** Logs once per message when cond is truthy, in development only. cond and message may be functions: they are then
|
|
14
|
+
* called only in development, so a check that loops over data costs nothing in production. Messages are in English,
|
|
15
|
+
* in the form 「cause. Fix.」. */
|
|
12
16
|
function devWarn(cond, component, message) {
|
|
13
|
-
if (!DEV
|
|
14
|
-
|
|
17
|
+
if (!DEV) return;
|
|
18
|
+
if (!(typeof cond === "function" ? cond() : cond)) return;
|
|
19
|
+
const text = `[@seanyeh77/ui] ${component}: ${typeof message === "function" ? message() : message}`;
|
|
15
20
|
if (seen.has(text)) return;
|
|
16
21
|
seen.add(text);
|
|
17
22
|
console.warn(text);
|
|
18
23
|
}
|
|
19
|
-
export { devWarn };
|
|
24
|
+
export { DEV, devWarn };
|
|
20
25
|
|
|
21
26
|
//# sourceMappingURL=dev.js.map
|
package/dist/internal/dev.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev.js","names":[],"sources":["../../src/internal/dev.ts"],"sourcesContent":["/* Development-only warnings for misuse an agent or a person is likely to make. Each message gives the\n cause and the fix. Off in production builds (the bundler replaces NODE_ENV); the single-file build (bundle.js) keeps them on. */\n\ndeclare const process: { env: { NODE_ENV?: string } };\ndeclare const __UI_DEV__: boolean | undefined;\n\n// Bundlers replace process.env.NODE_ENV; without a bundler there is no process, and the warnings stay off.\
|
|
1
|
+
{"version":3,"file":"dev.js","names":[],"sources":["../../src/internal/dev.ts"],"sourcesContent":["/* Development-only warnings for misuse an agent or a person is likely to make. Each message gives the\n cause and the fix. Off in production builds (the bundler replaces NODE_ENV); the single-file build (bundle.js) keeps them on. */\n\ndeclare const process: { env: { NODE_ENV?: string } };\ndeclare const __UI_DEV__: boolean | undefined;\n\n// Bundlers replace process.env.NODE_ENV; without a bundler there is no process, and the warnings stay off.\n/** True in development builds (and in bundle.js). Wrap a check that costs time (loops over rows) in `if (DEV)`, or pass\n * devWarn a function, so production builds skip it. */\nexport const DEV: boolean =\n typeof __UI_DEV__ === 'boolean'\n ? __UI_DEV__\n : (() => {\n try {\n return process.env.NODE_ENV !== 'production';\n } catch {\n return false;\n }\n })();\n\nconst seen = new Set<string>();\n\n/** Logs once per message when cond is truthy, in development only. cond and message may be functions: they are then\n * called only in development, so a check that loops over data costs nothing in production. Messages are in English,\n * in the form 「cause. Fix.」. */\nexport function devWarn(cond: unknown, component: string, message: string | (() => string)): void {\n if (!DEV) return;\n if (!(typeof cond === 'function' ? (cond as () => unknown)() : cond)) return;\n const text = `[@seanyeh77/ui] ${component}: ${typeof message === 'function' ? message() : message}`;\n if (seen.has(text)) return;\n seen.add(text);\n console.warn(text);\n}\n"],"mappings":";;;;AASA,MAAa,MACX,OAAO,eAAe,YAClB,oBACO;CACL,IAAI;EACF,OAAO,QAAQ,IAAI,aAAa;CAClC,QAAQ;EACN,OAAO;CACT;AACF,EAAA,CAAG;AAET,MAAM,uBAAO,IAAI,IAAY;;;;AAK7B,SAAgB,QAAQ,MAAe,WAAmB,SAAwC;CAChG,IAAI,CAAC,KAAK;CACV,IAAI,EAAE,OAAO,SAAS,aAAc,KAAuB,IAAI,OAAO;CACtE,MAAM,OAAO,mBAAmB,UAAU,IAAI,OAAO,YAAY,aAAa,QAAQ,IAAI;CAC1F,IAAI,KAAK,IAAI,IAAI,GAAG;CACpB,KAAK,IAAI,IAAI;CACb,QAAQ,KAAK,IAAI;AACnB"}
|
package/dist/internal/focus.js
CHANGED
|
@@ -37,7 +37,31 @@ function useReturnFocus(open) {
|
|
|
37
37
|
wasOpen.current = open;
|
|
38
38
|
}, [open]);
|
|
39
39
|
}
|
|
40
|
-
const FOCUSABLE = "button:not([disabled]), a[href], [tabindex]:not([tabindex=\"-1\"]), input:not([disabled]), [role=\"tab\"]";
|
|
40
|
+
const FOCUSABLE = "button:not([disabled]), a[href], [tabindex]:not([tabindex=\"-1\"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [role=\"tab\"]";
|
|
41
|
+
/** The focusable controls inside box that a person can reach now: visible and enabled. */
|
|
42
|
+
const reachable = (box) => Array.from(box.querySelectorAll(FOCUSABLE)).filter((e) => e.getClientRects().length > 0 && !e.matches(":disabled"));
|
|
43
|
+
/** The group a control belongs to, for picking a neighbour: its toolbar, group, form, section, card or dialog. */
|
|
44
|
+
const GROUP = "[role=\"toolbar\"], [role=\"group\"], [role=\"radiogroup\"], form, section, fieldset, [role=\"dialog\"], [role=\"alertdialog\"], main";
|
|
45
|
+
/** Moves focus from a control that is about to lose it (disabled or removed) to a sensible neighbour: the control
|
|
46
|
+
* before it in its group, else the one after it, else the main content. Returns the element that got focus. */
|
|
47
|
+
function focusNeighbour(from) {
|
|
48
|
+
const scope = from.parentElement?.closest(GROUP) ?? document.body;
|
|
49
|
+
const all = reachable(scope).filter((e) => e !== from);
|
|
50
|
+
const before = all.filter((e) => e.compareDocumentPosition(from) & Node.DOCUMENT_POSITION_FOLLOWING).pop();
|
|
51
|
+
const after = all.find((e) => e.compareDocumentPosition(from) & Node.DOCUMENT_POSITION_PRECEDING);
|
|
52
|
+
const next = before ?? after ?? null;
|
|
53
|
+
if (next) next.focus();
|
|
54
|
+
else focusMain();
|
|
55
|
+
return next;
|
|
56
|
+
}
|
|
57
|
+
/** For one control that can turn disabled while it has focus (a button that is pressed and then disabled): the
|
|
58
|
+
* browser would drop focus to the body, so it goes to the neighbour before it (focusNeighbour) instead. */
|
|
59
|
+
function useDisabledFocusRescue(ref, disabled) {
|
|
60
|
+
React.useLayoutEffect(() => {
|
|
61
|
+
const el = ref.current;
|
|
62
|
+
if (disabled && el && document.activeElement === el) focusNeighbour(el);
|
|
63
|
+
}, [disabled, ref]);
|
|
64
|
+
}
|
|
41
65
|
/** When the focused control inside the container is removed or replaced (a button that turns into another), focus
|
|
42
66
|
* moves to the control now at its place, else the one before it, else `fallback()`, instead of falling to the body. */
|
|
43
67
|
function useFocusRescue(ref, fallback) {
|
|
@@ -50,7 +74,7 @@ function useFocusRescue(ref, fallback) {
|
|
|
50
74
|
if (!box) return;
|
|
51
75
|
let last = null;
|
|
52
76
|
let index = -1;
|
|
53
|
-
const list = () =>
|
|
77
|
+
const list = () => reachable(box);
|
|
54
78
|
const onIn = (e) => {
|
|
55
79
|
if (!(e.target instanceof HTMLElement)) return;
|
|
56
80
|
last = e.target;
|
|
@@ -89,6 +113,6 @@ function useFocusRescue(ref, fallback) {
|
|
|
89
113
|
};
|
|
90
114
|
}, [ref]);
|
|
91
115
|
}
|
|
92
|
-
export { useFocusRescue, useReturnFocus };
|
|
116
|
+
export { focusNeighbour, useDisabledFocusRescue, useFocusRescue, useReturnFocus };
|
|
93
117
|
|
|
94
118
|
//# sourceMappingURL=focus.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"focus.js","names":[],"sources":["../../src/internal/focus.tsx"],"sourcesContent":["import * as React from 'react';\nimport { focusMain } from './focusMain';\n\n/** True when focus has fallen out of the page's content: nothing focused, or the body. */\nconst lost = () => !document.activeElement || document.activeElement === document.body;\n\n/** For a dialog-like overlay opened by the open prop: remembers what had focus when it opened and gives focus back\n * when it closes. When that element is gone (the app changed page), focus goes to the main content. */\nexport function useReturnFocus(open: boolean): void {\n const opener = React.useRef<HTMLElement | null>(null);\n const wasOpen = React.useRef(false);\n React.useEffect(() => {\n if (open && !wasOpen.current) {\n const a = document.activeElement;\n opener.current = a instanceof HTMLElement && a !== document.body ? a : null;\n }\n if (!open && wasOpen.current) {\n const back = opener.current;\n opener.current = null;\n // The overlay is removed only after its closing animation, and focus falls to the page then, not now: look every\n // frame (for 2 s at most) while focus stays where it was or inside a closing overlay. Fallen to the page: back to\n // the opener, else to the main content. Moved somewhere that stays (the overlay gave it back, or the app moved\n // it): left there.\n const held = document.activeElement;\n const until = performance.now() + 2000;\n let frame = 0;\n const look = () => {\n if (lost()) {\n if (back?.isConnected) back.focus();\n else focusMain();\n return;\n }\n // Still where it was, or on something in an overlay that is closing (both about to go): keep looking.\n const at = document.activeElement;\n const going = at === held || !!at?.closest('[data-ending-style]');\n if (!going || performance.now() > until) return;\n frame = requestAnimationFrame(look);\n };\n frame = requestAnimationFrame(look);\n wasOpen.current = open;\n return () => cancelAnimationFrame(frame);\n }\n wasOpen.current = open;\n }, [open]);\n}\n\nconst FOCUSABLE
|
|
1
|
+
{"version":3,"file":"focus.js","names":[],"sources":["../../src/internal/focus.tsx"],"sourcesContent":["import * as React from 'react';\nimport { focusMain } from './focusMain';\n\n/** True when focus has fallen out of the page's content: nothing focused, or the body. */\nconst lost = () => !document.activeElement || document.activeElement === document.body;\n\n/** For a dialog-like overlay opened by the open prop: remembers what had focus when it opened and gives focus back\n * when it closes. When that element is gone (the app changed page), focus goes to the main content. */\nexport function useReturnFocus(open: boolean): void {\n const opener = React.useRef<HTMLElement | null>(null);\n const wasOpen = React.useRef(false);\n React.useEffect(() => {\n if (open && !wasOpen.current) {\n const a = document.activeElement;\n opener.current = a instanceof HTMLElement && a !== document.body ? a : null;\n }\n if (!open && wasOpen.current) {\n const back = opener.current;\n opener.current = null;\n // The overlay is removed only after its closing animation, and focus falls to the page then, not now: look every\n // frame (for 2 s at most) while focus stays where it was or inside a closing overlay. Fallen to the page: back to\n // the opener, else to the main content. Moved somewhere that stays (the overlay gave it back, or the app moved\n // it): left there.\n const held = document.activeElement;\n const until = performance.now() + 2000;\n let frame = 0;\n const look = () => {\n if (lost()) {\n if (back?.isConnected) back.focus();\n else focusMain();\n return;\n }\n // Still where it was, or on something in an overlay that is closing (both about to go): keep looking.\n const at = document.activeElement;\n const going = at === held || !!at?.closest('[data-ending-style]');\n if (!going || performance.now() > until) return;\n frame = requestAnimationFrame(look);\n };\n frame = requestAnimationFrame(look);\n wasOpen.current = open;\n return () => cancelAnimationFrame(frame);\n }\n wasOpen.current = open;\n }, [open]);\n}\n\nconst FOCUSABLE =\n 'button:not([disabled]), a[href], [tabindex]:not([tabindex=\"-1\"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [role=\"tab\"]';\n\n/** The focusable controls inside box that a person can reach now: visible and enabled. */\nconst reachable = (box: ParentNode) =>\n Array.from(box.querySelectorAll<HTMLElement>(FOCUSABLE)).filter((e) => e.getClientRects().length > 0 && !e.matches(':disabled'));\n\n/** The group a control belongs to, for picking a neighbour: its toolbar, group, form, section, card or dialog. */\nconst GROUP = '[role=\"toolbar\"], [role=\"group\"], [role=\"radiogroup\"], form, section, fieldset, [role=\"dialog\"], [role=\"alertdialog\"], main';\n\n/** Moves focus from a control that is about to lose it (disabled or removed) to a sensible neighbour: the control\n * before it in its group, else the one after it, else the main content. Returns the element that got focus. */\nexport function focusNeighbour(from: HTMLElement): HTMLElement | null {\n const scope = from.parentElement?.closest<HTMLElement>(GROUP) ?? document.body;\n // By document position: the control itself may no longer match (it is disabled now).\n const all = reachable(scope).filter((e) => e !== from);\n const before = all.filter((e) => e.compareDocumentPosition(from) & Node.DOCUMENT_POSITION_FOLLOWING).pop();\n const after = all.find((e) => e.compareDocumentPosition(from) & Node.DOCUMENT_POSITION_PRECEDING);\n const next = before ?? after ?? null;\n if (next) next.focus();\n else focusMain();\n return next;\n}\n\n/** For one control that can turn disabled while it has focus (a button that is pressed and then disabled): the\n * browser would drop focus to the body, so it goes to the neighbour before it (focusNeighbour) instead. */\nexport function useDisabledFocusRescue(ref: React.RefObject<HTMLElement | null>, disabled: boolean | undefined): void {\n React.useLayoutEffect(() => {\n const el = ref.current;\n // The browser drops focus from a disabled control at its next rendering update, not at once: it is still here.\n if (disabled && el && document.activeElement === el) focusNeighbour(el);\n }, [disabled, ref]);\n}\n\n/** When the focused control inside the container is removed or replaced (a button that turns into another), focus\n * moves to the control now at its place, else the one before it, else `fallback()`, instead of falling to the body. */\nexport function useFocusRescue(ref: React.RefObject<HTMLElement | null>, fallback?: () => HTMLElement | null | undefined): void {\n const fb = React.useRef(fallback);\n React.useEffect(() => {\n fb.current = fallback;\n });\n React.useEffect(() => {\n const box = ref.current;\n if (!box) return;\n let last: HTMLElement | null = null;\n let index = -1;\n const list = () => reachable(box);\n const onIn = (e: FocusEvent) => {\n if (!(e.target instanceof HTMLElement)) return;\n last = e.target;\n // The same list rescue() picks from (visible, enabled), so the index means the same place.\n index = list().indexOf(last);\n };\n const rescue = () => {\n const now = list();\n const next = fb.current?.() ?? now[Math.min(index, now.length - 1)] ?? null;\n last = null;\n if (next) next.focus();\n else focusMain();\n };\n let frame = 0;\n const mo = new MutationObserver(() => {\n // Gone, or still there but disabled (a disabled control drops focus too).\n if (!last || (last.isConnected && !last.matches(':disabled'))) return;\n if (lost()) return rescue();\n // The browser moves focus off a control it just disabled at its next rendering update, not at once: look again\n // then. Rescue when focus fell to the page, or still sits on the dead control; not when it went somewhere else.\n const dead = last;\n cancelAnimationFrame(frame);\n frame = requestAnimationFrame(() => {\n frame = requestAnimationFrame(() => {\n if (last === dead && (lost() || document.activeElement === dead)) rescue();\n });\n });\n });\n box.addEventListener('focusin', onIn);\n mo.observe(box, { childList: true, subtree: true, attributes: true, attributeFilter: ['disabled'] });\n return () => {\n box.removeEventListener('focusin', onIn);\n mo.disconnect();\n cancelAnimationFrame(frame);\n };\n }, [ref]);\n}\n"],"mappings":"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"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
// src/internal/focusMain.ts
|
|
3
3
|
let lastInput = "pointer";
|
|
4
|
-
|
|
4
|
+
let installed = false;
|
|
5
|
+
/** Starts following the last kind of input on the document; safe to call more than once. */
|
|
6
|
+
function installFocusMain() {
|
|
7
|
+
if (installed || typeof document === "undefined") return;
|
|
8
|
+
installed = true;
|
|
5
9
|
document.addEventListener("keydown", () => lastInput = "key", true);
|
|
6
10
|
document.addEventListener("pointerdown", () => lastInput = "pointer", true);
|
|
7
11
|
}
|
|
@@ -17,6 +21,6 @@ function focusMain() {
|
|
|
17
21
|
target.setAttribute("data-ui-main-focus", lastInput);
|
|
18
22
|
target.focus({ preventScroll: false });
|
|
19
23
|
}
|
|
20
|
-
export { focusMain };
|
|
24
|
+
export { focusMain, installFocusMain };
|
|
21
25
|
|
|
22
26
|
//# sourceMappingURL=focusMain.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"focusMain.js","names":[],"sources":["../../src/internal/focusMain.ts"],"sourcesContent":["// How the person last acted: a key, or a pointer (mouse, pen, touch). The heading focusMain() moves to shows a bar on\n// its left only after a key: someone who changed page with a mouse sees no change.\nlet lastInput: 'key' | 'pointer' = 'pointer';\
|
|
1
|
+
{"version":3,"file":"focusMain.js","names":[],"sources":["../../src/internal/focusMain.ts"],"sourcesContent":["// How the person last acted: a key, or a pointer (mouse, pen, touch). The heading focusMain() moves to shows a bar on\n// its left only after a key: someone who changed page with a mouse sees no change.\n// Followed only after installFocusMain() (AppShell and initTheme call it): importing the module has no side effect.\nlet lastInput: 'key' | 'pointer' = 'pointer';\nlet installed = false;\n\n/** Starts following the last kind of input on the document; safe to call more than once. */\nexport function installFocusMain(): void {\n if (installed || typeof document === 'undefined') return;\n installed = true;\n document.addEventListener('keydown', () => (lastInput = 'key'), true);\n document.addEventListener('pointerdown', () => (lastInput = 'pointer'), true);\n}\n\n/** Moves keyboard and screen-reader focus to the page's content: its first heading inside main (or the top bar's title),\n * else main itself. Call it after the app changes page, e.g. when a CommandPalette result opens another page. The\n * heading gets no focus ring: a 3 px accent bar on its left after a key press, nothing after a mouse or touch. */\nexport function focusMain(): void {\n if (typeof document === 'undefined') return;\n const main = document.querySelector<HTMLElement>('main');\n const target = main?.querySelector<HTMLElement>('h1, h2') ?? document.querySelector<HTMLElement>('.ui-topbar-title') ?? main;\n if (!target) return;\n if (target.tabIndex < 0 && !target.hasAttribute('tabindex')) target.setAttribute('tabindex', '-1');\n target.setAttribute('data-ui-main-focus', lastInput);\n target.focus({ preventScroll: false });\n}\n"],"mappings":";;AAGA,IAAI,YAA+B;AACnC,IAAI,YAAY;;AAGhB,SAAgB,mBAAyB;CACvC,IAAI,aAAa,OAAO,aAAa,aAAa;CAClD,YAAY;CACZ,SAAS,iBAAiB,iBAAkB,YAAY,OAAQ,IAAI;CACpE,SAAS,iBAAiB,qBAAsB,YAAY,WAAY,IAAI;AAC9E;;;;AAKA,SAAgB,YAAkB;CAChC,IAAI,OAAO,aAAa,aAAa;CACrC,MAAM,OAAO,SAAS,cAA2B,MAAM;CACvD,MAAM,SAAS,MAAM,cAA2B,QAAQ,KAAK,SAAS,cAA2B,kBAAkB,KAAK;CACxH,IAAI,CAAC,QAAQ;CACb,IAAI,OAAO,WAAW,KAAK,CAAC,OAAO,aAAa,UAAU,GAAG,OAAO,aAAa,YAAY,IAAI;CACjG,OAAO,aAAa,sBAAsB,SAAS;CACnD,OAAO,MAAM,EAAE,eAAe,MAAM,CAAC;AACvC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** Why an overlay opened or closed, passed as onOpenChange's second argument.
|
|
2
|
+
* trigger: its button was pressed (or hovered); escape: Esc; outside: a press outside it; close: its × or close
|
|
3
|
+
* button; cancel: its cancel button; confirm: its confirming button; select: an item was chosen; hotkey: a keyboard
|
|
4
|
+
* shortcut (Ctrl K); done / skip: a Tour was finished or skipped; other: anything else (focus moved away, the app). */
|
|
5
|
+
export type OpenChangeReason = 'trigger' | 'escape' | 'outside' | 'close' | 'cancel' | 'confirm' | 'select' | 'hotkey' | 'done' | 'skip' | 'other';
|
|
6
|
+
/** The open-state props every overlay takes: controlled with open, uncontrolled with defaultOpen. */
|
|
7
|
+
export interface OpenStateProps {
|
|
8
|
+
/** Controlled: shown while true. Leave it out (and use defaultOpen) to let the component keep its own state. */
|
|
9
|
+
open?: boolean;
|
|
10
|
+
/** Uncontrolled: whether it starts open. Default false. */
|
|
11
|
+
defaultOpen?: boolean;
|
|
12
|
+
/** Called with the new state and why it changed (Esc, a press outside, the close button…). */
|
|
13
|
+
onOpenChange?: (open: boolean, reason?: OpenChangeReason) => void;
|
|
14
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
// src/internal/open.ts
|
|
4
|
+
/** Maps Base UI's change reasons to OpenChangeReason. */
|
|
5
|
+
function baseReason(reason) {
|
|
6
|
+
switch (reason) {
|
|
7
|
+
case "trigger-press":
|
|
8
|
+
case "trigger-hover":
|
|
9
|
+
case "trigger-focus": return "trigger";
|
|
10
|
+
case "escape-key": return "escape";
|
|
11
|
+
case "outside-press": return "outside";
|
|
12
|
+
case "close-press": return "close";
|
|
13
|
+
case "item-press": return "select";
|
|
14
|
+
default: return "other";
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
/** open / defaultOpen / onOpenChange in one place: returns the current state and the setter to call with a reason. */
|
|
18
|
+
function useOpenState({ open, defaultOpen, onOpenChange }) {
|
|
19
|
+
const [own, setOwn] = React.useState(!!defaultOpen);
|
|
20
|
+
const controlled = open !== void 0;
|
|
21
|
+
return [controlled ? open : own, React.useCallback((next, reason) => {
|
|
22
|
+
if (!controlled) setOwn(next);
|
|
23
|
+
onOpenChange?.(next, reason);
|
|
24
|
+
}, [controlled, onOpenChange])];
|
|
25
|
+
}
|
|
26
|
+
export { baseReason, useOpenState };
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=open.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"open.js","names":[],"sources":["../../src/internal/open.ts"],"sourcesContent":["import * as React from 'react';\n\n/** Why an overlay opened or closed, passed as onOpenChange's second argument.\n * trigger: its button was pressed (or hovered); escape: Esc; outside: a press outside it; close: its × or close\n * button; cancel: its cancel button; confirm: its confirming button; select: an item was chosen; hotkey: a keyboard\n * shortcut (Ctrl K); done / skip: a Tour was finished or skipped; other: anything else (focus moved away, the app). */\nexport type OpenChangeReason = 'trigger' | 'escape' | 'outside' | 'close' | 'cancel' | 'confirm' | 'select' | 'hotkey' | 'done' | 'skip' | 'other';\n\n/** The open-state props every overlay takes: controlled with open, uncontrolled with defaultOpen. */\nexport interface OpenStateProps {\n /** Controlled: shown while true. Leave it out (and use defaultOpen) to let the component keep its own state. */\n open?: boolean;\n /** Uncontrolled: whether it starts open. Default false. */\n defaultOpen?: boolean;\n /** Called with the new state and why it changed (Esc, a press outside, the close button…). */\n onOpenChange?: (open: boolean, reason?: OpenChangeReason) => void;\n}\n\n/** Maps Base UI's change reasons to OpenChangeReason. */\nexport function baseReason(reason: string | undefined): OpenChangeReason {\n switch (reason) {\n case 'trigger-press':\n case 'trigger-hover':\n case 'trigger-focus':\n return 'trigger';\n case 'escape-key':\n return 'escape';\n case 'outside-press':\n return 'outside';\n case 'close-press':\n return 'close';\n case 'item-press':\n return 'select';\n default:\n return 'other';\n }\n}\n\n/** open / defaultOpen / onOpenChange in one place: returns the current state and the setter to call with a reason. */\nexport function useOpenState({ open, defaultOpen, onOpenChange }: OpenStateProps): [boolean, (next: boolean, reason?: OpenChangeReason) => void] {\n const [own, setOwn] = React.useState(!!defaultOpen);\n const controlled = open !== undefined;\n const cur = controlled ? open : own;\n const set = React.useCallback(\n (next: boolean, reason?: OpenChangeReason) => {\n if (!controlled) setOwn(next);\n onOpenChange?.(next, reason);\n },\n [controlled, onOpenChange],\n );\n return [cur, set];\n}\n"],"mappings":";;;;AAmBA,SAAgB,WAAW,QAA8C;CACvE,QAAQ,QAAR;EACE,KAAK;EACL,KAAK;EACL,KAAK,iBACH,OAAO;EACT,KAAK,cACH,OAAO;EACT,KAAK,iBACH,OAAO;EACT,KAAK,eACH,OAAO;EACT,KAAK,cACH,OAAO;EACT,SACE,OAAO;CACX;AACF;;AAGA,SAAgB,aAAa,EAAE,MAAM,aAAa,gBAA+F;CAC/I,MAAM,CAAC,KAAK,UAAU,MAAM,SAAS,CAAC,CAAC,WAAW;CAClD,MAAM,aAAa,SAAS,KAAA;CAS5B,OAAO,CARK,aAAa,OAAO,KACpB,MAAM,aACf,MAAe,WAA8B;EAC5C,IAAI,CAAC,YAAY,OAAO,IAAI;EAC5B,eAAe,MAAM,MAAM;CAC7B,GACA,CAAC,YAAY,YAAY,CAEZ,CAAC;AAClB"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { browserKey } from "./util.js";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
// src/internal/roving.ts
|
|
5
|
+
/** The keyboard of a radio group (RadioGroup, SegmentedControl, ThemePicker, AccentPicker): one Tab stop, the arrow
|
|
6
|
+
* keys move to the next or previous option and pick it, wrapping at the ends and passing over disabled options.
|
|
7
|
+
* Returns a ref setter and a keydown handler per option index. */
|
|
8
|
+
function useRovingRadio(n, onPick, enabled) {
|
|
9
|
+
const refs = React.useRef([]);
|
|
10
|
+
const pick = React.useRef(onPick);
|
|
11
|
+
const ok = React.useRef(enabled);
|
|
12
|
+
React.useEffect(() => {
|
|
13
|
+
pick.current = onPick;
|
|
14
|
+
ok.current = enabled;
|
|
15
|
+
});
|
|
16
|
+
return {
|
|
17
|
+
ref: React.useCallback((i) => (el) => {
|
|
18
|
+
refs.current[i] = el;
|
|
19
|
+
}, []),
|
|
20
|
+
onKeyDown: React.useCallback((i) => (e) => {
|
|
21
|
+
if (browserKey(e)) return;
|
|
22
|
+
const dir = e.key === "ArrowRight" || e.key === "ArrowDown" ? 1 : e.key === "ArrowLeft" || e.key === "ArrowUp" ? -1 : 0;
|
|
23
|
+
if (!dir) return;
|
|
24
|
+
e.preventDefault();
|
|
25
|
+
for (let k = 1; k <= n; k++) {
|
|
26
|
+
const to = (i + dir * k + n * k) % n;
|
|
27
|
+
if (ok.current && !ok.current(to)) continue;
|
|
28
|
+
refs.current[to]?.focus();
|
|
29
|
+
pick.current(to);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
}, [n])
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export { useRovingRadio };
|
|
36
|
+
|
|
37
|
+
//# sourceMappingURL=roving.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"roving.js","names":[],"sources":["../../src/internal/roving.ts"],"sourcesContent":["import * as React from 'react';\nimport { browserKey } from './util';\n\n/** The keyboard of a radio group (RadioGroup, SegmentedControl, ThemePicker, AccentPicker): one Tab stop, the arrow\n * keys move to the next or previous option and pick it, wrapping at the ends and passing over disabled options.\n * Returns a ref setter and a keydown handler per option index. */\nexport function useRovingRadio(n: number, onPick: (index: number) => void, enabled?: (index: number) => boolean) {\n const refs = React.useRef<(HTMLElement | null)[]>([]);\n const pick = React.useRef(onPick);\n const ok = React.useRef(enabled);\n React.useEffect(() => {\n pick.current = onPick;\n ok.current = enabled;\n });\n const ref = React.useCallback(\n (i: number) => (el: HTMLElement | null) => {\n refs.current[i] = el;\n },\n [],\n );\n const onKeyDown = React.useCallback(\n (i: number) => (e: React.KeyboardEvent) => {\n if (browserKey(e)) return;\n const dir = e.key === 'ArrowRight' || e.key === 'ArrowDown' ? 1 : e.key === 'ArrowLeft' || e.key === 'ArrowUp' ? -1 : 0;\n if (!dir) return;\n e.preventDefault();\n for (let k = 1; k <= n; k++) {\n const to = (i + dir * k + n * k) % n;\n if (ok.current && !ok.current(to)) continue;\n refs.current[to]?.focus();\n pick.current(to);\n return;\n }\n },\n [n],\n );\n return { ref, onKeyDown };\n}\n"],"mappings":";;;;;;;AAMA,SAAgB,eAAe,GAAW,QAAiC,SAAsC;CAC/G,MAAM,OAAO,MAAM,OAA+B,CAAC,CAAC;CACpD,MAAM,OAAO,MAAM,OAAO,MAAM;CAChC,MAAM,KAAK,MAAM,OAAO,OAAO;CAC/B,MAAM,gBAAgB;EACpB,KAAK,UAAU;EACf,GAAG,UAAU;CACf,CAAC;CAuBD,OAAO;EAAE,KAtBG,MAAM,aACf,OAAe,OAA2B;GACzC,KAAK,QAAQ,KAAK;EACpB,GACA,CAAC,CAkBQ;EAAG,WAhBI,MAAM,aACrB,OAAe,MAA2B;GACzC,IAAI,WAAW,CAAC,GAAG;GACnB,MAAM,MAAM,EAAE,QAAQ,gBAAgB,EAAE,QAAQ,cAAc,IAAI,EAAE,QAAQ,eAAe,EAAE,QAAQ,YAAY,KAAK;GACtH,IAAI,CAAC,KAAK;GACV,EAAE,eAAe;GACjB,KAAK,IAAI,IAAI,GAAG,KAAK,GAAG,KAAK;IAC3B,MAAM,MAAM,IAAI,MAAM,IAAI,IAAI,KAAK;IACnC,IAAI,GAAG,WAAW,CAAC,GAAG,QAAQ,EAAE,GAAG;IACnC,KAAK,QAAQ,GAAG,EAAE,MAAM;IACxB,KAAK,QAAQ,EAAE;IACf;GACF;EACF,GACA,CAAC,CAAC,CAEkB;CAAE;AAC1B"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
// src/internal/shell.ts
|
|
4
|
+
/** Set by AppShell: whether its top bar shows the page title. A page heading inside (PageHeader, SettingsLayout)
|
|
5
|
+
* warns when it would show a second title. */
|
|
6
|
+
const ShellTitle = React.createContext({
|
|
7
|
+
inShell: false,
|
|
8
|
+
title: false
|
|
9
|
+
});
|
|
10
|
+
export { ShellTitle };
|
|
11
|
+
|
|
12
|
+
//# sourceMappingURL=shell.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shell.js","names":[],"sources":["../../src/internal/shell.ts"],"sourcesContent":["import * as React from 'react';\n\n/** Set by AppShell: whether its top bar shows the page title. A page heading inside (PageHeader, SettingsLayout)\n * warns when it would show a second title. */\nexport const ShellTitle = React.createContext<{ inShell: boolean; title: boolean }>({ inShell: false, title: false });\n"],"mappings":";;;;;AAIA,MAAa,aAAa,MAAM,cAAoD;CAAE,SAAS;CAAO,OAAO;AAAM,CAAC"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
// src/internal/stored.ts
|
|
4
|
+
const listeners = /* @__PURE__ */ new Map();
|
|
5
|
+
const memory = /* @__PURE__ */ new Map();
|
|
6
|
+
let listening = false;
|
|
7
|
+
function notify(key) {
|
|
8
|
+
if (key === null) {
|
|
9
|
+
for (const set of listeners.values()) for (const f of set) f();
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
listeners.get(key)?.forEach((f) => f());
|
|
13
|
+
}
|
|
14
|
+
function subscribe(key, f) {
|
|
15
|
+
let set = listeners.get(key);
|
|
16
|
+
if (!set) listeners.set(key, set = /* @__PURE__ */ new Set());
|
|
17
|
+
set.add(f);
|
|
18
|
+
if (!listening && typeof window !== "undefined") {
|
|
19
|
+
listening = true;
|
|
20
|
+
window.addEventListener("storage", (e) => notify(e.key));
|
|
21
|
+
}
|
|
22
|
+
return () => {
|
|
23
|
+
set.delete(f);
|
|
24
|
+
if (!set.size) listeners.delete(key);
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
/** The stored text for a key, or null; after a write that failed, the value kept in memory for this page. */
|
|
28
|
+
function readStored(key) {
|
|
29
|
+
const kept = memory.get(key);
|
|
30
|
+
let now;
|
|
31
|
+
try {
|
|
32
|
+
now = localStorage.getItem(key);
|
|
33
|
+
} catch {
|
|
34
|
+
return kept ? kept.raw : null;
|
|
35
|
+
}
|
|
36
|
+
if (!kept) return now;
|
|
37
|
+
if (kept.under === now) return kept.raw;
|
|
38
|
+
memory.delete(key);
|
|
39
|
+
return now;
|
|
40
|
+
}
|
|
41
|
+
/** Stores the text (null removes it) and tells every component that reads the key. */
|
|
42
|
+
function writeStored(key, raw) {
|
|
43
|
+
try {
|
|
44
|
+
if (raw === null) localStorage.removeItem(key);
|
|
45
|
+
else localStorage.setItem(key, raw);
|
|
46
|
+
memory.delete(key);
|
|
47
|
+
} catch {
|
|
48
|
+
let under;
|
|
49
|
+
try {
|
|
50
|
+
under = localStorage.getItem(key);
|
|
51
|
+
} catch {
|
|
52
|
+
under = void 0;
|
|
53
|
+
}
|
|
54
|
+
memory.set(key, {
|
|
55
|
+
raw,
|
|
56
|
+
under
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
notify(key);
|
|
60
|
+
}
|
|
61
|
+
const serverNull = () => null;
|
|
62
|
+
/** A value stored in localStorage under key, the same on the server and the first browser render (fallback), then
|
|
63
|
+
* the stored value. parse turns the stored text into the value (throwing gives the fallback); pass a function that
|
|
64
|
+
* stays the same between renders (module level or useCallback). serialize turns a value into text, null to remove
|
|
65
|
+
* it; by default strings as they are, null and undefined removed, anything else as JSON. An undefined key keeps the value in memory only. */
|
|
66
|
+
function useStored(key, parse, fallback, serialize = (v) => v == null ? null : typeof v === "string" ? v : JSON.stringify(v)) {
|
|
67
|
+
const sub = React.useCallback((f) => key ? subscribe(key, f) : () => {}, [key]);
|
|
68
|
+
const snap = React.useCallback(() => key ? readStored(key) : null, [key]);
|
|
69
|
+
const raw = React.useSyncExternalStore(sub, snap, serverNull);
|
|
70
|
+
const [mem, setMem] = React.useState(null);
|
|
71
|
+
const parsed = React.useMemo(() => {
|
|
72
|
+
if (raw === null) return null;
|
|
73
|
+
try {
|
|
74
|
+
return { v: parse(raw) };
|
|
75
|
+
} catch {
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
}, [raw, parse]);
|
|
79
|
+
const set = React.useCallback((v) => {
|
|
80
|
+
if (key) writeStored(key, serialize(v));
|
|
81
|
+
else setMem({ v });
|
|
82
|
+
}, [key]);
|
|
83
|
+
return [key ? parsed ? parsed.v : fallback : mem ? mem.v : fallback, set];
|
|
84
|
+
}
|
|
85
|
+
/** parse for a stored text kept as it is. */
|
|
86
|
+
const asText = (raw) => raw;
|
|
87
|
+
export { asText, readStored, useStored, writeStored };
|
|
88
|
+
|
|
89
|
+
//# sourceMappingURL=stored.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stored.js","names":[],"sources":["../../src/internal/stored.ts"],"sourcesContent":["import * as React from 'react';\n\n/* A value kept in localStorage that renders the same on the server and on the first render in the browser.\n The server snapshot is the fallback; React then re-renders with the stored value right after hydration, so the\n markup never differs. Other tabs and other components with the same key follow through the `storage` event and an\n in-page notification. Where storage is blocked or full the value is kept in memory for this page instead. */\n\ntype Listener = () => void;\nconst listeners = new Map<string, Set<Listener>>();\n// Values that could not be written (storage blocked or full), with what storage held then (undefined: it could not be\n// read): kept so the change still shows on this page, until storage holds something else (changed by other code).\nconst memory = new Map<string, { raw: string | null; under: string | null | undefined }>();\nlet listening = false;\n\nfunction notify(key: string | null): void {\n if (key === null) {\n for (const set of listeners.values()) for (const f of set) f();\n return;\n }\n listeners.get(key)?.forEach((f) => f());\n}\n\nfunction subscribe(key: string, f: Listener): () => void {\n let set = listeners.get(key);\n if (!set) listeners.set(key, (set = new Set()));\n set.add(f);\n if (!listening && typeof window !== 'undefined') {\n listening = true;\n // Another tab changed the value (key null: that tab cleared all storage).\n window.addEventListener('storage', (e) => notify(e.key));\n }\n return () => {\n set.delete(f);\n if (!set.size) listeners.delete(key);\n };\n}\n\n/** The stored text for a key, or null; after a write that failed, the value kept in memory for this page. */\nexport function readStored(key: string): string | null {\n const kept = memory.get(key);\n let now: string | null;\n try {\n now = localStorage.getItem(key);\n } catch {\n return kept ? kept.raw : null;\n }\n if (!kept) return now;\n if (kept.under === now) return kept.raw;\n // Storage changed since the failed write: it wins.\n memory.delete(key);\n return now;\n}\n\n/** Stores the text (null removes it) and tells every component that reads the key. */\nexport function writeStored(key: string, raw: string | null): void {\n try {\n if (raw === null) localStorage.removeItem(key);\n else localStorage.setItem(key, raw);\n memory.delete(key);\n } catch {\n // Storage blocked or full: it works the same for this page, without remembering.\n let under: string | null | undefined;\n try {\n under = localStorage.getItem(key);\n } catch {\n under = undefined;\n }\n memory.set(key, { raw, under });\n }\n notify(key);\n}\n\nconst serverNull = () => null;\n\n/** A value stored in localStorage under key, the same on the server and the first browser render (fallback), then\n * the stored value. parse turns the stored text into the value (throwing gives the fallback); pass a function that\n * stays the same between renders (module level or useCallback). serialize turns a value into text, null to remove\n * it; by default strings as they are, null and undefined removed, anything else as JSON. An undefined key keeps the value in memory only. */\nexport function useStored<T>(\n key: string | undefined,\n parse: (raw: string) => T,\n fallback: T,\n serialize: (v: T) => string | null = (v) => (v == null ? null : typeof v === 'string' ? v : JSON.stringify(v)),\n): [T, (v: T) => void] {\n const sub = React.useCallback((f: Listener) => (key ? subscribe(key, f) : () => {}), [key]);\n const snap = React.useCallback(() => (key ? readStored(key) : null), [key]);\n const raw = React.useSyncExternalStore(sub, snap, serverNull);\n const [mem, setMem] = React.useState<{ v: T } | null>(null);\n const parsed = React.useMemo(() => {\n if (raw === null) return null;\n try {\n return { v: parse(raw) };\n } catch {\n return null;\n }\n }, [raw, parse]);\n const set = React.useCallback(\n (v: T) => {\n if (key) writeStored(key, serialize(v));\n else setMem({ v });\n },\n // serialize is usually inline: what it does does not change between renders.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [key],\n );\n const value = key ? (parsed ? parsed.v : fallback) : mem ? mem.v : fallback;\n return [value, set];\n}\n\n/** parse for a stored text kept as it is. */\nexport const asText = (raw: string): string => raw;\n"],"mappings":";;;AAQA,MAAM,4BAAY,IAAI,IAA2B;AAGjD,MAAM,yBAAS,IAAI,IAAsE;AACzF,IAAI,YAAY;AAEhB,SAAS,OAAO,KAA0B;CACxC,IAAI,QAAQ,MAAM;EAChB,KAAK,MAAM,OAAO,UAAU,OAAO,GAAG,KAAK,MAAM,KAAK,KAAK,EAAE;EAC7D;CACF;CACA,UAAU,IAAI,GAAG,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;AACxC;AAEA,SAAS,UAAU,KAAa,GAAyB;CACvD,IAAI,MAAM,UAAU,IAAI,GAAG;CAC3B,IAAI,CAAC,KAAK,UAAU,IAAI,KAAM,sBAAM,IAAI,IAAI,CAAE;CAC9C,IAAI,IAAI,CAAC;CACT,IAAI,CAAC,aAAa,OAAO,WAAW,aAAa;EAC/C,YAAY;EAEZ,OAAO,iBAAiB,YAAY,MAAM,OAAO,EAAE,GAAG,CAAC;CACzD;CACA,aAAa;EACX,IAAI,OAAO,CAAC;EACZ,IAAI,CAAC,IAAI,MAAM,UAAU,OAAO,GAAG;CACrC;AACF;;AAGA,SAAgB,WAAW,KAA4B;CACrD,MAAM,OAAO,OAAO,IAAI,GAAG;CAC3B,IAAI;CACJ,IAAI;EACF,MAAM,aAAa,QAAQ,GAAG;CAChC,QAAQ;EACN,OAAO,OAAO,KAAK,MAAM;CAC3B;CACA,IAAI,CAAC,MAAM,OAAO;CAClB,IAAI,KAAK,UAAU,KAAK,OAAO,KAAK;CAEpC,OAAO,OAAO,GAAG;CACjB,OAAO;AACT;;AAGA,SAAgB,YAAY,KAAa,KAA0B;CACjE,IAAI;EACF,IAAI,QAAQ,MAAM,aAAa,WAAW,GAAG;OACxC,aAAa,QAAQ,KAAK,GAAG;EAClC,OAAO,OAAO,GAAG;CACnB,QAAQ;EAEN,IAAI;EACJ,IAAI;GACF,QAAQ,aAAa,QAAQ,GAAG;EAClC,QAAQ;GACN,QAAQ,KAAA;EACV;EACA,OAAO,IAAI,KAAK;GAAE;GAAK;EAAM,CAAC;CAChC;CACA,OAAO,GAAG;AACZ;AAEA,MAAM,mBAAmB;;;;;AAMzB,SAAgB,UACd,KACA,OACA,UACA,aAAsC,MAAO,KAAK,OAAO,OAAO,OAAO,MAAM,WAAW,IAAI,KAAK,UAAU,CAAC,GACvF;CACrB,MAAM,MAAM,MAAM,aAAa,MAAiB,MAAM,UAAU,KAAK,CAAC,UAAU,CAAC,GAAI,CAAC,GAAG,CAAC;CAC1F,MAAM,OAAO,MAAM,kBAAmB,MAAM,WAAW,GAAG,IAAI,MAAO,CAAC,GAAG,CAAC;CAC1E,MAAM,MAAM,MAAM,qBAAqB,KAAK,MAAM,UAAU;CAC5D,MAAM,CAAC,KAAK,UAAU,MAAM,SAA0B,IAAI;CAC1D,MAAM,SAAS,MAAM,cAAc;EACjC,IAAI,QAAQ,MAAM,OAAO;EACzB,IAAI;GACF,OAAO,EAAE,GAAG,MAAM,GAAG,EAAE;EACzB,QAAQ;GACN,OAAO;EACT;CACF,GAAG,CAAC,KAAK,KAAK,CAAC;CACf,MAAM,MAAM,MAAM,aACf,MAAS;EACR,IAAI,KAAK,YAAY,KAAK,UAAU,CAAC,CAAC;OACjC,OAAO,EAAE,EAAE,CAAC;CACnB,GAGA,CAAC,GAAG,CACN;CAEA,OAAO,CADO,MAAO,SAAS,OAAO,IAAI,WAAY,MAAM,IAAI,IAAI,UACpD,GAAG;AACpB;;AAGA,MAAa,UAAU,QAAwB"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { tr } from "../i18n.js";
|
|
3
3
|
import { Dialog } from "../components/Dialog/Dialog.js";
|
|
4
4
|
import { IconButton } from "../components/IconButton/IconButton.js";
|
|
5
|
+
import { announce } from "../announce.js";
|
|
5
6
|
import { cx } from "./util.js";
|
|
6
7
|
import { includeIcons } from "../icons/store.js";
|
|
7
8
|
import copy_default from "../icons/ph/copy.js";
|
|
@@ -11,21 +12,49 @@ import { jsx } from "react/jsx-runtime";
|
|
|
11
12
|
// src/internal/tableTools.tsx
|
|
12
13
|
includeIcons(copy_default, corners_out_default);
|
|
13
14
|
/** The right border of a header cell, dragged to set the column's width. ← → 16 px, Enter or a double-click back
|
|
14
|
-
* to the widths by content.
|
|
15
|
+
* to the widths by content. A click without dragging (one pointer, WCAG 2.5.7) steps the width up: 1.5 times, twice,
|
|
16
|
+
* then back to the width by content. Hidden on touch screens (CSS), where 「放大表格」 shows the whole table instead. */
|
|
15
17
|
function ColResize(p) {
|
|
16
18
|
const [on, setOn] = React.useState(false);
|
|
17
19
|
const from = React.useRef(null);
|
|
20
|
+
const steps = React.useRef(null);
|
|
18
21
|
const min = p.min ?? 48;
|
|
19
22
|
const set = (w) => p.onWidth(Math.max(min, Math.round(w)));
|
|
20
23
|
const drag = (v) => {
|
|
21
24
|
setOn(v);
|
|
22
25
|
p.onDragging?.(v);
|
|
23
26
|
};
|
|
27
|
+
const step = () => {
|
|
28
|
+
const cur = steps.current && Math.abs(steps.current.last - p.width) <= 1 ? steps.current : {
|
|
29
|
+
base: p.start(),
|
|
30
|
+
n: 0,
|
|
31
|
+
last: -1
|
|
32
|
+
};
|
|
33
|
+
const n = cur.n + 1;
|
|
34
|
+
if (n >= STEPS.length + 1) {
|
|
35
|
+
steps.current = null;
|
|
36
|
+
p.onReset();
|
|
37
|
+
announce(tr("已還原「{name}」欄寬", { name: p.name }));
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
const w = Math.max(min, Math.round(cur.base * STEPS[n - 1]));
|
|
41
|
+
steps.current = {
|
|
42
|
+
base: cur.base,
|
|
43
|
+
n,
|
|
44
|
+
last: w
|
|
45
|
+
};
|
|
46
|
+
p.onWidth(w);
|
|
47
|
+
announce(tr("「{name}」欄寬 {n} px", {
|
|
48
|
+
name: p.name,
|
|
49
|
+
n: w
|
|
50
|
+
}));
|
|
51
|
+
};
|
|
24
52
|
return /* @__PURE__ */ jsx("span", {
|
|
25
53
|
className: cx("ui-col-resize", on && "is-dragging"),
|
|
26
54
|
role: "separator",
|
|
27
55
|
"aria-orientation": "vertical",
|
|
28
56
|
"aria-label": tr("調整「{name}」欄寬", { name: p.name }),
|
|
57
|
+
"aria-description": tr("拖曳或按 ← → 調整;按一下依序加寬,按 Enter 還原"),
|
|
29
58
|
"aria-valuenow": Math.round(p.width),
|
|
30
59
|
"aria-valuemin": min,
|
|
31
60
|
tabIndex: 0,
|
|
@@ -37,16 +66,24 @@ function ColResize(p) {
|
|
|
37
66
|
e.currentTarget.setPointerCapture?.(e.pointerId);
|
|
38
67
|
from.current = {
|
|
39
68
|
x: e.clientX,
|
|
40
|
-
w: p.start()
|
|
69
|
+
w: p.start(),
|
|
70
|
+
moved: false
|
|
41
71
|
};
|
|
42
72
|
drag(true);
|
|
43
73
|
},
|
|
44
74
|
onPointerMove: (e) => {
|
|
45
|
-
|
|
75
|
+
const f = from.current;
|
|
76
|
+
if (!f) return;
|
|
77
|
+
if (!f.moved && Math.abs(e.clientX - f.x) < DRAG_MIN) return;
|
|
78
|
+
f.moved = true;
|
|
79
|
+
steps.current = null;
|
|
80
|
+
set(f.w + e.clientX - f.x);
|
|
46
81
|
},
|
|
47
82
|
onPointerUp: () => {
|
|
83
|
+
const clicked = from.current && !from.current.moved;
|
|
48
84
|
from.current = null;
|
|
49
85
|
drag(false);
|
|
86
|
+
if (clicked) step();
|
|
50
87
|
},
|
|
51
88
|
onPointerCancel: () => {
|
|
52
89
|
from.current = null;
|
|
@@ -54,6 +91,7 @@ function ColResize(p) {
|
|
|
54
91
|
},
|
|
55
92
|
onDoubleClick: (e) => {
|
|
56
93
|
e.stopPropagation();
|
|
94
|
+
steps.current = null;
|
|
57
95
|
p.onReset();
|
|
58
96
|
},
|
|
59
97
|
onKeyDown: (e) => {
|
|
@@ -61,15 +99,19 @@ function ColResize(p) {
|
|
|
61
99
|
if (e.key === "ArrowLeft" || e.key === "ArrowRight") {
|
|
62
100
|
e.preventDefault();
|
|
63
101
|
e.stopPropagation();
|
|
102
|
+
steps.current = null;
|
|
64
103
|
set(p.start() + (e.key === "ArrowRight" ? 16 : -16));
|
|
65
104
|
} else if (e.key === "Enter") {
|
|
66
105
|
e.preventDefault();
|
|
67
106
|
e.stopPropagation();
|
|
107
|
+
steps.current = null;
|
|
68
108
|
p.onReset();
|
|
69
109
|
}
|
|
70
110
|
}
|
|
71
111
|
});
|
|
72
112
|
}
|
|
113
|
+
const STEPS = [1.5, 2];
|
|
114
|
+
const DRAG_MIN = 4;
|
|
73
115
|
/** The 「放大表格」 icon: 32 px, no border, at a Markdown table's top right; in a DataTable's toolbar (inToolbar) it is a
|
|
74
116
|
* toolbar button like 「複製成 Markdown」. */
|
|
75
117
|
function ZoomButton({ onClick, inToolbar }) {
|
|
@@ -86,7 +128,7 @@ function TableDialog(p) {
|
|
|
86
128
|
if (!p.open) return null;
|
|
87
129
|
return /* @__PURE__ */ jsx(Dialog, {
|
|
88
130
|
open: true,
|
|
89
|
-
|
|
131
|
+
onOpenChange: (o) => !o && p.onClose(),
|
|
90
132
|
title: p.title || tr("表格"),
|
|
91
133
|
className: "ui-table-dialog",
|
|
92
134
|
children: /* @__PURE__ */ jsx("div", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tableTools.js","names":["phCopy","phCornersOut"],"sources":["../../src/internal/tableTools.tsx"],"sourcesContent":["import * as React from 'react';\nimport { tr } from '../i18n';\nimport { CHECK } from '../icons/Icon';\nimport { Dialog } from '../components/Dialog/Dialog';\nimport { IconButton } from '../components/IconButton/IconButton';\nimport { announce } from '../announce';\nimport { copyText, cx } from './util';\nimport { includeIcons } from '../icons/store';\nimport phCopy from '../icons/ph/copy';\nimport phCornersOut from '../icons/ph/corners-out';\n\nincludeIcons(phCopy, phCornersOut);\n\n/* What Markdown tables and DataTable share: the column border that drags, the 「放大表格」 dialog, and the\n 「複製成 Markdown」 icon. One implementation, so both tables behave and look the same. */\n\n/** The narrowest a dragged column gets (px); a DataTable column also never gets narrower than its heading. */\nexport const MIN_COL = 48;\n/** One ← or → on a column border (px). */\nexport const COL_STEP = 16;\n\n/** The right border of a header cell, dragged to set the column's width. ← → 16 px, Enter or a double-click back\n * to the widths by content. Hidden on touch screens (CSS), where 「放大表格」 shows the whole table instead. */\nexport function ColResize(p: {\n /** The column's name: the border is called 「調整「名稱」欄寬」. */\n name: string;\n /** Its width now (px), for aria-valuenow. */\n width: number;\n /** The narrowest it may get (px). */\n min?: number;\n /** The width when a drag or a key starts: the set width, or the drawn one. */\n start: () => number;\n onWidth: (px: number) => void;\n onReset: () => void;\n onDragging?: (on: boolean) => void;\n}) {\n const [on, setOn] = React.useState(false);\n const from = React.useRef<{ x: number; w: number } | null>(null);\n const min = p.min ?? MIN_COL;\n const set = (w: number) => p.onWidth(Math.max(min, Math.round(w)));\n const drag = (v: boolean) => {\n setOn(v);\n p.onDragging?.(v);\n };\n return (\n <span\n className={cx('ui-col-resize', on && 'is-dragging')}\n role=\"separator\"\n aria-orientation=\"vertical\"\n aria-label={tr('調整「{name}」欄寬', { name: p.name })}\n aria-valuenow={Math.round(p.width)}\n aria-valuemin={min}\n tabIndex={0}\n onClick={(e) => e.stopPropagation()}\n onPointerDown={(e) => {\n if (e.button !== 0) return;\n e.preventDefault();\n e.stopPropagation();\n e.currentTarget.setPointerCapture?.(e.pointerId);\n from.current = { x: e.clientX, w: p.start() };\n drag(true);\n }}\n onPointerMove={(e) => {\n if (from.current) set(from.current.w + e.clientX - from.current.x);\n }}\n onPointerUp={() => {\n from.current = null;\n drag(false);\n }}\n onPointerCancel={() => {\n from.current = null;\n drag(false);\n }}\n onDoubleClick={(e) => {\n e.stopPropagation();\n p.onReset();\n }}\n onKeyDown={(e) => {\n if (e.altKey || e.metaKey || e.ctrlKey) return;\n if (e.key === 'ArrowLeft' || e.key === 'ArrowRight') {\n e.preventDefault();\n e.stopPropagation();\n set(p.start() + (e.key === 'ArrowRight' ? COL_STEP : -COL_STEP));\n } else if (e.key === 'Enter') {\n e.preventDefault();\n e.stopPropagation();\n p.onReset();\n }\n }}\n />\n );\n}\n\n/** The 「放大表格」 icon: 32 px, no border, at a Markdown table's top right; in a DataTable's toolbar (inToolbar) it is a\n * toolbar button like 「複製成 Markdown」. */\nexport function ZoomButton({ onClick, inToolbar }: { onClick: () => void; inToolbar?: boolean }) {\n return <IconButton className={inToolbar ? 'ui-dt-zoombtn' : 'ui-table-zoom'} icon=\"corners-out\" label={tr('放大表格')} onClick={onClick} />;\n}\n\n/** The whole table in a wide dialog (at most 1200 px). A plain click on a link inside (a function, a path) closes the\n * dialog after the link has done its job; Ctrl, ⌘, Shift or the middle button open a new tab and keep it open. */\nexport function TableDialog(p: { open: boolean; onClose: () => void; title?: string; children: React.ReactNode }) {\n if (!p.open) return null;\n return (\n <Dialog open onClose={p.onClose} title={p.title || tr('表格')} className=\"ui-table-dialog\">\n <div\n className=\"ui-table-dialog-body\"\n onClick={(e) => {\n if (e.metaKey || e.ctrlKey || e.shiftKey || e.button !== 0) return;\n const link = (e.target as Element).closest('a[href], [role=\"link\"], .ui-code.is-link, .ui-md-link');\n if (link && e.currentTarget.contains(link)) p.onClose();\n }}\n >\n {p.children}\n </div>\n </Dialog>\n );\n}\n\n/** The 「複製成 Markdown」 icon: copies the text, turns into a check for 2 s and says 「已複製」, as CodeView's copy. */\nexport function CopyMarkdownButton(p: { text: () => string; onCopyError?: () => void; className?: string }) {\n const [done, setDone] = React.useState(false);\n const timer = React.useRef<ReturnType<typeof setTimeout>>(undefined);\n React.useEffect(() => () => clearTimeout(timer.current), []);\n return (\n <IconButton\n className={cx('ui-table-copy', done && 'is-copied', p.className)}\n icon={done ? CHECK : 'copy'}\n label={done ? tr('已複製') : tr('複製成 Markdown')}\n onClick={() =>\n copyText(p.text()).then(\n () => {\n setDone(true);\n announce(tr('已複製'));\n clearTimeout(timer.current);\n timer.current = setTimeout(() => setDone(false), 2000);\n },\n () => p.onCopyError?.(),\n )\n }\n />\n );\n}\n\n/** A table as GitHub Markdown: | in a cell is escaped, line breaks become spaces. */\nexport function markdownTable(heads: string[], rows: string[][]): string {\n const cell = (s: string) => s.replace(/\\r?\\n/g, ' ').replace(/\\|/g, '\\\\|').trim();\n return [`| ${heads.map(cell).join(' | ')} |`, `|${heads.map(() => '---').join('|')}|`, ...rows.map((r) => `| ${r.map(cell).join(' | ')} |`)].join('\\n');\n}\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"tableTools.js","names":["phCopy","phCornersOut"],"sources":["../../src/internal/tableTools.tsx"],"sourcesContent":["import * as React from 'react';\nimport { tr } from '../i18n';\nimport { CHECK } from '../icons/Icon';\nimport { Dialog } from '../components/Dialog/Dialog';\nimport { IconButton } from '../components/IconButton/IconButton';\nimport { announce } from '../announce';\nimport { copyText, cx } from './util';\nimport { includeIcons } from '../icons/store';\nimport phCopy from '../icons/ph/copy';\nimport phCornersOut from '../icons/ph/corners-out';\n\nincludeIcons(phCopy, phCornersOut);\n\n/* What Markdown tables and DataTable share: the column border that drags, the 「放大表格」 dialog, and the\n 「複製成 Markdown」 icon. One implementation, so both tables behave and look the same. */\n\n/** The narrowest a dragged column gets (px); a DataTable column also never gets narrower than its heading. */\nexport const MIN_COL = 48;\n/** One ← or → on a column border (px). */\nexport const COL_STEP = 16;\n\n/** The right border of a header cell, dragged to set the column's width. ← → 16 px, Enter or a double-click back\n * to the widths by content. A click without dragging (one pointer, WCAG 2.5.7) steps the width up: 1.5 times, twice,\n * then back to the width by content. Hidden on touch screens (CSS), where 「放大表格」 shows the whole table instead. */\nexport function ColResize(p: {\n /** The column's name: the border is called 「調整「名稱」欄寬」. */\n name: string;\n /** Its width now (px), for aria-valuenow. */\n width: number;\n /** The narrowest it may get (px). */\n min?: number;\n /** The width when a drag or a key starts: the set width, or the drawn one. */\n start: () => number;\n /** A new width (px), from a drag, a key or a click. */\n onWidth: (px: number) => void;\n /** Back to the width by content (Enter, a double-click, the last click step). */\n onReset: () => void;\n /** A drag starts (true) or ends (false). */\n onDragging?: (on: boolean) => void;\n}) {\n const [on, setOn] = React.useState(false);\n const from = React.useRef<{ x: number; w: number; moved: boolean } | null>(null);\n // The click steps: the width they started from and the last one set, so a drag or a key in between starts over.\n const steps = React.useRef<{ base: number; n: number; last: number } | null>(null);\n const min = p.min ?? MIN_COL;\n const set = (w: number) => p.onWidth(Math.max(min, Math.round(w)));\n const drag = (v: boolean) => {\n setOn(v);\n p.onDragging?.(v);\n };\n const step = () => {\n const cur = steps.current && Math.abs(steps.current.last - p.width) <= 1 ? steps.current : { base: p.start(), n: 0, last: -1 };\n const n = cur.n + 1;\n if (n >= STEPS.length + 1) {\n steps.current = null;\n p.onReset();\n announce(tr('已還原「{name}」欄寬', { name: p.name }));\n return;\n }\n const w = Math.max(min, Math.round(cur.base * STEPS[n - 1]));\n steps.current = { base: cur.base, n, last: w };\n p.onWidth(w);\n announce(tr('「{name}」欄寬 {n} px', { name: p.name, n: w }));\n };\n return (\n <span\n className={cx('ui-col-resize', on && 'is-dragging')}\n role=\"separator\"\n aria-orientation=\"vertical\"\n aria-label={tr('調整「{name}」欄寬', { name: p.name })}\n aria-description={tr('拖曳或按 ← → 調整;按一下依序加寬,按 Enter 還原')}\n aria-valuenow={Math.round(p.width)}\n aria-valuemin={min}\n tabIndex={0}\n onClick={(e) => e.stopPropagation()}\n onPointerDown={(e) => {\n if (e.button !== 0) return;\n e.preventDefault();\n e.stopPropagation();\n e.currentTarget.setPointerCapture?.(e.pointerId);\n from.current = { x: e.clientX, w: p.start(), moved: false };\n drag(true);\n }}\n onPointerMove={(e) => {\n const f = from.current;\n if (!f) return;\n // A few px of jitter in a click is not a drag.\n if (!f.moved && Math.abs(e.clientX - f.x) < DRAG_MIN) return;\n f.moved = true;\n steps.current = null;\n set(f.w + e.clientX - f.x);\n }}\n onPointerUp={() => {\n const clicked = from.current && !from.current.moved;\n from.current = null;\n drag(false);\n if (clicked) step();\n }}\n onPointerCancel={() => {\n from.current = null;\n drag(false);\n }}\n onDoubleClick={(e) => {\n e.stopPropagation();\n steps.current = null;\n p.onReset();\n }}\n onKeyDown={(e) => {\n if (e.altKey || e.metaKey || e.ctrlKey) return;\n if (e.key === 'ArrowLeft' || e.key === 'ArrowRight') {\n e.preventDefault();\n e.stopPropagation();\n steps.current = null;\n set(p.start() + (e.key === 'ArrowRight' ? COL_STEP : -COL_STEP));\n } else if (e.key === 'Enter') {\n e.preventDefault();\n e.stopPropagation();\n steps.current = null;\n p.onReset();\n }\n }}\n />\n );\n}\n\n// A click on a column border: the width it started from times these, then back to the width by content.\nconst STEPS = [1.5, 2];\n// A pointer that moves less than this (px) between down and up clicked.\nconst DRAG_MIN = 4;\n\n/** The 「放大表格」 icon: 32 px, no border, at a Markdown table's top right; in a DataTable's toolbar (inToolbar) it is a\n * toolbar button like 「複製成 Markdown」. */\nexport function ZoomButton({ onClick, inToolbar }: { onClick: () => void; inToolbar?: boolean }) {\n return <IconButton className={inToolbar ? 'ui-dt-zoombtn' : 'ui-table-zoom'} icon=\"corners-out\" label={tr('放大表格')} onClick={onClick} />;\n}\n\n/** The whole table in a wide dialog (at most 1200 px). A plain click on a link inside (a function, a path) closes the\n * dialog after the link has done its job; Ctrl, ⌘, Shift or the middle button open a new tab and keep it open. */\nexport function TableDialog(p: { open: boolean; onClose: () => void; title?: string; children: React.ReactNode }) {\n if (!p.open) return null;\n return (\n <Dialog open onOpenChange={(o) => !o && p.onClose()} title={p.title || tr('表格')} className=\"ui-table-dialog\">\n <div\n className=\"ui-table-dialog-body\"\n onClick={(e) => {\n if (e.metaKey || e.ctrlKey || e.shiftKey || e.button !== 0) return;\n const link = (e.target as Element).closest('a[href], [role=\"link\"], .ui-code.is-link, .ui-md-link');\n if (link && e.currentTarget.contains(link)) p.onClose();\n }}\n >\n {p.children}\n </div>\n </Dialog>\n );\n}\n\n/** The 「複製成 Markdown」 icon: copies the text, turns into a check for 2 s and says 「已複製」, as CodeView's copy. */\nexport function CopyMarkdownButton(p: { text: () => string; onCopyError?: () => void; className?: string }) {\n const [done, setDone] = React.useState(false);\n const timer = React.useRef<ReturnType<typeof setTimeout>>(undefined);\n React.useEffect(() => () => clearTimeout(timer.current), []);\n return (\n <IconButton\n className={cx('ui-table-copy', done && 'is-copied', p.className)}\n icon={done ? CHECK : 'copy'}\n label={done ? tr('已複製') : tr('複製成 Markdown')}\n onClick={() =>\n copyText(p.text()).then(\n () => {\n setDone(true);\n announce(tr('已複製'));\n clearTimeout(timer.current);\n timer.current = setTimeout(() => setDone(false), 2000);\n },\n () => p.onCopyError?.(),\n )\n }\n />\n );\n}\n\n/** A table as GitHub Markdown: | in a cell is escaped, line breaks become spaces. */\nexport function markdownTable(heads: string[], rows: string[][]): string {\n const cell = (s: string) => s.replace(/\\r?\\n/g, ' ').replace(/\\|/g, '\\\\|').trim();\n return [`| ${heads.map(cell).join(' | ')} |`, `|${heads.map(() => '---').join('|')}|`, ...rows.map((r) => `| ${r.map(cell).join(' | ')} |`)].join('\\n');\n}\n"],"mappings":"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"}
|
package/dist/internal/util.js
CHANGED
|
@@ -28,14 +28,6 @@ function monoNums(text, nums) {
|
|
|
28
28
|
children: nums[k]
|
|
29
29
|
}, i) : t);
|
|
30
30
|
}
|
|
31
|
-
/** localStorage get (no value) or set; null when storage is blocked. */
|
|
32
|
-
function store(key, value) {
|
|
33
|
-
try {
|
|
34
|
-
if (value === void 0) return localStorage.getItem(key);
|
|
35
|
-
localStorage.setItem(key, value);
|
|
36
|
-
} catch {}
|
|
37
|
-
return null;
|
|
38
|
-
}
|
|
39
31
|
function reduced() {
|
|
40
32
|
return typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
41
33
|
}
|
|
@@ -46,20 +38,19 @@ const IS_MAC = /mac|iphone|ipad/i.test(nav?.userAgentData?.platform || nav?.plat
|
|
|
46
38
|
* turned off and a mouse would then lose its Tooltips. */
|
|
47
39
|
const TOUCH_ONLY = "(pointer: coarse)";
|
|
48
40
|
const SHORTCUT = IS_MAC ? "⌘K" : "Ctrl K";
|
|
49
|
-
/** Matches a media query and follows changes.
|
|
41
|
+
/** Matches a media query and follows changes. false on the server and in the first browser render while hydrating,
|
|
42
|
+
* so the markup matches; then the real match. */
|
|
50
43
|
function useMedia(query) {
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
React.useEffect(() => {
|
|
54
|
-
if (typeof window.matchMedia !== "function") return;
|
|
44
|
+
const sub = React.useCallback((f) => {
|
|
45
|
+
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return () => {};
|
|
55
46
|
const m = window.matchMedia(query);
|
|
56
|
-
const f = () => setMatch(m.matches);
|
|
57
|
-
f();
|
|
58
47
|
m.addEventListener("change", f);
|
|
59
48
|
return () => m.removeEventListener("change", f);
|
|
60
49
|
}, [query]);
|
|
61
|
-
|
|
50
|
+
const get = React.useCallback(() => typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia(query).matches, [query]);
|
|
51
|
+
return React.useSyncExternalStore(sub, get, serverFalse);
|
|
62
52
|
}
|
|
53
|
+
const serverFalse = () => false;
|
|
63
54
|
/** A ResizeObserver, or null where there is none (jsdom, old browsers): the first measure then stays. */
|
|
64
55
|
function resizeObserver(cb) {
|
|
65
56
|
return typeof ResizeObserver === "function" ? new ResizeObserver(cb) : null;
|
|
@@ -106,6 +97,6 @@ function nodeText(node) {
|
|
|
106
97
|
}
|
|
107
98
|
return "";
|
|
108
99
|
}
|
|
109
|
-
export { IS_MAC, SHORTCUT, TOUCH_ONLY, browserKey, copyText, cx, digits, idPart, monoNums, nodeText, reduced, resizeObserver, seenOnly,
|
|
100
|
+
export { IS_MAC, SHORTCUT, TOUCH_ONLY, browserKey, copyText, cx, digits, idPart, monoNums, nodeText, reduced, resizeObserver, seenOnly, useMedia, useNarrow };
|
|
110
101
|
|
|
111
102
|
//# sourceMappingURL=util.js.map
|