@adminiumjs/ui 0.2.9 → 0.3.0-rc.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/dist/components/alert/Alert.d.ts +1 -1
- package/dist/components/alert/Alert.js +1 -1
- package/dist/components/auth-layout/AuthLayout.d.ts +6 -6
- package/dist/components/auth-layout/AuthLayout.js +6 -6
- package/dist/components/auth-screens/ForgotPasswordForm.d.ts +5 -6
- package/dist/components/auth-screens/ForgotPasswordForm.d.ts.map +1 -1
- package/dist/components/auth-screens/ForgotPasswordForm.js.map +1 -1
- package/dist/components/autosave-indicator/AutosaveIndicator.d.ts +2 -2
- package/dist/components/autosave-indicator/AutosaveIndicator.js +1 -1
- package/dist/components/avatar/Avatar.d.ts +5 -5
- package/dist/components/avatar/Avatar.js +5 -5
- package/dist/components/avatar-stack/AvatarStack.d.ts +1 -1
- package/dist/components/avatar-stack/AvatarStack.js +1 -1
- package/dist/components/badge/Badge.d.ts +1 -1
- package/dist/components/badge/Badge.js +1 -1
- package/dist/components/badge/index.js +2 -2
- package/dist/components/badge/index.js.map +1 -1
- package/dist/components/banner/Banner.d.ts +1 -1
- package/dist/components/banner/Banner.js +1 -1
- package/dist/components/breadcrumbs/Breadcrumbs.d.ts +1 -1
- package/dist/components/breadcrumbs/Breadcrumbs.js +1 -1
- package/dist/components/bulk-action-bar/BulkActionBar.d.ts +2 -2
- package/dist/components/bulk-action-bar/BulkActionBar.js +2 -2
- package/dist/components/button/Button.d.ts +3 -3
- package/dist/components/button/Button.js +3 -3
- package/dist/components/card/Card.d.ts +1 -1
- package/dist/components/card/Card.js +1 -1
- package/dist/components/check-row/CheckRow.d.ts +34 -0
- package/dist/components/check-row/CheckRow.d.ts.map +1 -0
- package/dist/components/check-row/CheckRow.js +53 -0
- package/dist/components/check-row/CheckRow.js.map +1 -0
- package/dist/components/check-row/index.d.ts +3 -0
- package/dist/components/check-row/index.d.ts.map +1 -0
- package/dist/components/check-row/index.js +3 -0
- package/dist/components/check-row/index.js.map +1 -0
- package/dist/components/checkbox/Checkbox.d.ts +1 -1
- package/dist/components/checkbox/Checkbox.js +1 -1
- package/dist/components/chip-input/ChipInput.d.ts +9 -2
- package/dist/components/chip-input/ChipInput.d.ts.map +1 -1
- package/dist/components/chip-input/ChipInput.js +3 -3
- package/dist/components/chip-input/ChipInput.js.map +1 -1
- package/dist/components/choice-chips/ChoiceChips.d.ts +2 -2
- package/dist/components/choice-chips/ChoiceChips.js +2 -2
- package/dist/components/combobox/Combobox.d.ts +1 -1
- package/dist/components/combobox/Combobox.js +1 -1
- package/dist/components/command-palette/CommandPalette.d.ts +1 -1
- package/dist/components/command-palette/CommandPalette.js +1 -1
- package/dist/components/command-palette/useCommandK.d.ts +4 -3
- package/dist/components/command-palette/useCommandK.d.ts.map +1 -1
- package/dist/components/command-palette/useCommandK.js +4 -3
- package/dist/components/command-palette/useCommandK.js.map +1 -1
- package/dist/components/confirm-modal/ConfirmModal.d.ts +7 -7
- package/dist/components/confirm-modal/ConfirmModal.js +1 -1
- package/dist/components/count-badge/CountBadge.d.ts +1 -1
- package/dist/components/count-badge/CountBadge.js +1 -1
- package/dist/components/date-input/DateInput.d.ts +1 -1
- package/dist/components/date-input/DateInput.js +1 -1
- package/dist/components/delta-pill/DeltaPill.d.ts +1 -1
- package/dist/components/delta-pill/DeltaPill.js +1 -1
- package/dist/components/divider/Divider.d.ts +1 -1
- package/dist/components/divider/Divider.js +1 -1
- package/dist/components/drawer/Drawer.d.ts +3 -3
- package/dist/components/drawer/Drawer.js +2 -2
- package/dist/components/drawer/Drawer.js.map +1 -1
- package/dist/components/dropdown-menu/DropdownMenu.d.ts +1 -1
- package/dist/components/dropdown-menu/DropdownMenu.js +1 -1
- package/dist/components/empty-state/EmptyState.d.ts +1 -1
- package/dist/components/empty-state/EmptyState.js +1 -1
- package/dist/components/filter-chip/FilterChip.d.ts +1 -1
- package/dist/components/filter-chip/FilterChip.js +1 -1
- package/dist/components/form-dialog/FormDialog.d.ts +79 -0
- package/dist/components/form-dialog/FormDialog.d.ts.map +1 -0
- package/dist/components/form-dialog/FormDialog.js +76 -0
- package/dist/components/form-dialog/FormDialog.js.map +1 -0
- package/dist/components/form-dialog/index.d.ts +3 -0
- package/dist/components/form-dialog/index.d.ts.map +1 -0
- package/dist/components/form-dialog/index.js +3 -0
- package/dist/components/form-dialog/index.js.map +1 -0
- package/dist/components/form-field/FormField.d.ts +1 -1
- package/dist/components/form-field/FormField.d.ts.map +1 -1
- package/dist/components/form-field/FormField.js +3 -2
- package/dist/components/form-field/FormField.js.map +1 -1
- package/dist/components/icon/Icon.d.ts +6 -6
- package/dist/components/icon/Icon.d.ts.map +1 -1
- package/dist/components/icon/Icon.js +1 -1
- package/dist/components/icon/Icon.js.map +1 -1
- package/dist/components/icon/icon-names.js +3 -3
- package/dist/components/icon/icon-names.js.map +1 -1
- package/dist/components/icon-button/IconButton.d.ts +2 -2
- package/dist/components/icon-button/IconButton.js +2 -2
- package/dist/components/icon-tile/IconTile.d.ts +1 -1
- package/dist/components/icon-tile/IconTile.js +2 -2
- package/dist/components/icon-tile/IconTile.js.map +1 -1
- package/dist/components/input/Input.d.ts +2 -2
- package/dist/components/input/Input.js +2 -2
- package/dist/components/input-group/InputGroup.d.ts +2 -2
- package/dist/components/input-group/InputGroup.js +2 -2
- package/dist/components/kbd/Kbd.d.ts +1 -1
- package/dist/components/kbd/Kbd.js +1 -1
- package/dist/components/key-value-list/KeyValueList.d.ts +1 -1
- package/dist/components/key-value-list/KeyValueList.js +1 -1
- package/dist/components/label/Label.d.ts +1 -1
- package/dist/components/label/Label.js +1 -1
- package/dist/components/meta-pill/MetaPill.d.ts +23 -0
- package/dist/components/meta-pill/MetaPill.d.ts.map +1 -0
- package/dist/components/meta-pill/MetaPill.js +19 -0
- package/dist/components/meta-pill/MetaPill.js.map +1 -0
- package/dist/components/meta-pill/index.d.ts +2 -0
- package/dist/components/meta-pill/index.d.ts.map +1 -0
- package/dist/components/meta-pill/index.js +3 -0
- package/dist/components/meta-pill/index.js.map +1 -0
- package/dist/components/modal/Modal.d.ts +1 -1
- package/dist/components/modal/Modal.d.ts.map +1 -1
- package/dist/components/modal/Modal.js +3 -2
- package/dist/components/modal/Modal.js.map +1 -1
- package/dist/components/mono-text/MonoText.d.ts +2 -3
- package/dist/components/mono-text/MonoText.d.ts.map +1 -1
- package/dist/components/mono-text/MonoText.js +2 -3
- package/dist/components/mono-text/MonoText.js.map +1 -1
- package/dist/components/month-calendar/MonthCalendar.d.ts +46 -0
- package/dist/components/month-calendar/MonthCalendar.d.ts.map +1 -0
- package/dist/components/month-calendar/MonthCalendar.js +55 -0
- package/dist/components/month-calendar/MonthCalendar.js.map +1 -0
- package/dist/components/month-calendar/index.d.ts +2 -0
- package/dist/components/month-calendar/index.d.ts.map +1 -0
- package/dist/components/month-calendar/index.js +3 -0
- package/dist/components/month-calendar/index.js.map +1 -0
- package/dist/components/number-stepper/NumberStepper.d.ts +16 -2
- package/dist/components/number-stepper/NumberStepper.d.ts.map +1 -1
- package/dist/components/number-stepper/NumberStepper.js +22 -3
- package/dist/components/number-stepper/NumberStepper.js.map +1 -1
- package/dist/components/pagination/Pagination.d.ts +1 -1
- package/dist/components/pagination/Pagination.js +1 -1
- package/dist/components/password-strength/PasswordStrength.d.ts +1 -1
- package/dist/components/password-strength/PasswordStrength.js +1 -1
- package/dist/components/permission-matrix/PermissionMatrix.d.ts +3 -3
- package/dist/components/popover/Popover.d.ts +1 -1
- package/dist/components/popover/Popover.js +1 -1
- package/dist/components/progress-bar/ProgressBar.d.ts +1 -1
- package/dist/components/progress-bar/ProgressBar.js +2 -2
- package/dist/components/progress-bar/ProgressBar.js.map +1 -1
- package/dist/components/radio/Radio.d.ts +2 -2
- package/dist/components/radio/Radio.js +2 -2
- package/dist/components/radio-card/RadioCard.d.ts +18 -8
- package/dist/components/radio-card/RadioCard.d.ts.map +1 -1
- package/dist/components/radio-card/RadioCard.js +4 -4
- package/dist/components/radio-card/RadioCard.js.map +1 -1
- package/dist/components/runtime-chip/RuntimeChip.d.ts +9 -9
- package/dist/components/runtime-chip/RuntimeChip.js +8 -8
- package/dist/components/search-input/SearchInput.d.ts +1 -1
- package/dist/components/search-input/SearchInput.js +1 -1
- package/dist/components/secret-input/SecretInput.d.ts +1 -1
- package/dist/components/secret-input/SecretInput.js +1 -1
- package/dist/components/segmented-control/SegmentedControl.d.ts +1 -1
- package/dist/components/segmented-control/SegmentedControl.js +1 -1
- package/dist/components/select/Select.d.ts +1 -1
- package/dist/components/select/Select.js +1 -1
- package/dist/components/skeleton/Skeleton.d.ts +1 -1
- package/dist/components/skeleton/Skeleton.js +2 -2
- package/dist/components/skeleton/Skeleton.js.map +1 -1
- package/dist/components/slider/Slider.d.ts +1 -1
- package/dist/components/slider/Slider.js +1 -1
- package/dist/components/slot-grid/SlotGrid.d.ts +37 -0
- package/dist/components/slot-grid/SlotGrid.d.ts.map +1 -0
- package/dist/components/slot-grid/SlotGrid.js +47 -0
- package/dist/components/slot-grid/SlotGrid.js.map +1 -0
- package/dist/components/slot-grid/index.d.ts +2 -0
- package/dist/components/slot-grid/index.d.ts.map +1 -0
- package/dist/components/slot-grid/index.js +3 -0
- package/dist/components/slot-grid/index.js.map +1 -0
- package/dist/components/snackbar/Snackbar.d.ts +1 -1
- package/dist/components/snackbar/Snackbar.js +1 -1
- package/dist/components/spinner/Spinner.d.ts +1 -1
- package/dist/components/spinner/Spinner.js +1 -1
- package/dist/components/status-pill/StatusPill.d.ts +1 -1
- package/dist/components/status-pill/StatusPill.js +5 -5
- package/dist/components/status-pill/StatusPill.js.map +1 -1
- package/dist/components/step-rail/StepRail.d.ts +36 -0
- package/dist/components/step-rail/StepRail.d.ts.map +1 -0
- package/dist/components/step-rail/StepRail.js +28 -0
- package/dist/components/step-rail/StepRail.js.map +1 -0
- package/dist/components/step-rail/index.d.ts +2 -0
- package/dist/components/step-rail/index.d.ts.map +1 -0
- package/dist/components/step-rail/index.js +3 -0
- package/dist/components/step-rail/index.js.map +1 -0
- package/dist/components/stepper/Stepper.d.ts +1 -1
- package/dist/components/stepper/Stepper.js +1 -1
- package/dist/components/success-state/SuccessState.d.ts +1 -2
- package/dist/components/success-state/SuccessState.d.ts.map +1 -1
- package/dist/components/success-state/SuccessState.js +1 -2
- package/dist/components/success-state/SuccessState.js.map +1 -1
- package/dist/components/switch/Switch.d.ts +2 -2
- package/dist/components/switch/Switch.js +2 -2
- package/dist/components/tabs/Tabs.d.ts +1 -1
- package/dist/components/tabs/Tabs.js +1 -1
- package/dist/components/tag/Tag.d.ts +1 -1
- package/dist/components/tag/Tag.js +1 -1
- package/dist/components/textarea/Textarea.d.ts +1 -1
- package/dist/components/textarea/Textarea.js +1 -1
- package/dist/components/toast/Toast.d.ts +5 -6
- package/dist/components/toast/Toast.d.ts.map +1 -1
- package/dist/components/toast/Toast.js +5 -6
- package/dist/components/toast/Toast.js.map +1 -1
- package/dist/components/toast/useToastQueue.d.ts +6 -7
- package/dist/components/toast/useToastQueue.d.ts.map +1 -1
- package/dist/components/toast/useToastQueue.js +6 -7
- package/dist/components/toast/useToastQueue.js.map +1 -1
- package/dist/components/toggle-row/ToggleRow.d.ts +33 -0
- package/dist/components/toggle-row/ToggleRow.d.ts.map +1 -0
- package/dist/components/toggle-row/ToggleRow.js +41 -0
- package/dist/components/toggle-row/ToggleRow.js.map +1 -0
- package/dist/components/toggle-row/index.d.ts +3 -0
- package/dist/components/toggle-row/index.d.ts.map +1 -0
- package/dist/components/toggle-row/index.js +3 -0
- package/dist/components/toggle-row/index.js.map +1 -0
- package/dist/components/tooltip/Tooltip.d.ts +1 -1
- package/dist/components/tooltip/Tooltip.js +1 -1
- package/dist/components/two-phase-modal/TwoPhaseModal.d.ts +3 -4
- package/dist/components/two-phase-modal/TwoPhaseModal.d.ts.map +1 -1
- package/dist/components/two-phase-modal/TwoPhaseModal.js +3 -4
- package/dist/components/two-phase-modal/TwoPhaseModal.js.map +1 -1
- package/dist/hooks/useUndoableAction.d.ts +5 -5
- package/dist/hooks/useUndoableAction.js +5 -5
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/cn.d.ts +3 -4
- package/dist/lib/cn.d.ts.map +1 -1
- package/dist/lib/cn.js +3 -4
- package/dist/lib/cn.js.map +1 -1
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +1 -0
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/tones.d.ts +10 -9
- package/dist/lib/tones.d.ts.map +1 -1
- package/dist/lib/tones.js +10 -9
- package/dist/lib/tones.js.map +1 -1
- package/dist/lib/week.d.ts +37 -0
- package/dist/lib/week.d.ts.map +1 -0
- package/dist/lib/week.js +71 -0
- package/dist/lib/week.js.map +1 -0
- package/dist/theme/ThemeProvider.d.ts +4 -5
- package/dist/theme/ThemeProvider.d.ts.map +1 -1
- package/dist/theme/ThemeProvider.js +19 -19
- package/dist/theme/ThemeProvider.js.map +1 -1
- package/dist/theme/context.d.ts +6 -5
- package/dist/theme/context.d.ts.map +1 -1
- package/dist/theme/context.js.map +1 -1
- package/dist/theme/subscribe.d.ts +4 -4
- package/dist/theme/subscribe.js +1 -1
- package/dist/theme/types.d.ts +10 -10
- package/dist/theme/types.d.ts.map +1 -1
- package/dist/theme/types.js +4 -4
- package/dist/theme/types.js.map +1 -1
- package/dist/theme/useTheme.d.ts.map +1 -1
- package/dist/theme/useTheme.js +2 -3
- package/dist/theme/useTheme.js.map +1 -1
- package/package.json +2 -2
package/dist/lib/tones.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* lib/tones.ts — the canonical home of the semantic tone vocabulary and the
|
|
3
|
-
* status→tone registry
|
|
3
|
+
* status→tone registry.
|
|
4
4
|
*
|
|
5
5
|
* The SINGLE source of truth: components/icon-tile, components/badge and
|
|
6
6
|
* components/status-pill re-export from here (their wave-1 local copies are
|
|
@@ -49,20 +49,21 @@ export declare const toneSoftClasses: Record<Tone, string>;
|
|
|
49
49
|
export declare const toneSolidClasses: Record<Tone, string>;
|
|
50
50
|
/**
|
|
51
51
|
* Tone → `color-mix` border utilities used by Alert/Banner callouts
|
|
52
|
-
* (tone-soft bg + 30%-mixed tone border, research/design-system.md
|
|
52
|
+
* (tone-soft bg + 30%-mixed tone border, research/design-system.md
|
|
53
|
+
* Tier 3).
|
|
53
54
|
*/
|
|
54
55
|
export declare const toneMixBorderClasses: Record<Tone, string>;
|
|
55
56
|
/**
|
|
56
|
-
* Sticky translucent bar recipe
|
|
57
|
-
*
|
|
58
|
-
*
|
|
57
|
+
* Sticky translucent bar recipe — used by `Topbar`, `WizardLayout` footer
|
|
58
|
+
* and sticky table headers. Exported from here so the color-mix recipe lives
|
|
59
|
+
* in exactly one place.
|
|
59
60
|
*/
|
|
60
61
|
export declare const glassBar = "sticky top-0 z-40 border-b border-border bg-[color-mix(in_srgb,var(--surface)_82%,transparent)] backdrop-blur-[8px]";
|
|
61
62
|
/**
|
|
62
|
-
* Default status→tone registry
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
63
|
+
* Default status→tone registry. Extended at runtime via
|
|
64
|
+
* `registerStatusTones` (widgets/manifests register domain statuses); tints
|
|
65
|
+
* always derive from the tone — never hardcoded per feature (the "Ticket
|
|
66
|
+
* Queue hardcoded priority tint" defect fix).
|
|
66
67
|
*/
|
|
67
68
|
export declare const DEFAULT_STATUS_TONES: Readonly<Record<string, Tone>>;
|
|
68
69
|
/** Idempotent merge of domain statuses into the status→tone registry. */
|
package/dist/lib/tones.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tones.d.ts","sourceRoot":"","sources":["../../src/lib/tones.ts"],"names":[],"mappings":"AACA;;;;;;;;GAQG;AAEH,0DAA0D;AAC1D,MAAM,MAAM,IAAI,GAAG,SAAS,GAAG,QAAQ,GAAG,KAAK,GAAG,MA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AAE,MAAM,EAAE,QAAQ,GAAE,IAAgB,GAAG,IAAI,CAE3E"}
|
package/dist/lib/tones.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
2
|
/**
|
|
3
3
|
* lib/tones.ts — the canonical home of the semantic tone vocabulary and the
|
|
4
|
-
* status→tone registry
|
|
4
|
+
* status→tone registry.
|
|
5
5
|
*
|
|
6
6
|
* The SINGLE source of truth: components/icon-tile, components/badge and
|
|
7
7
|
* components/status-pill re-export from here (their wave-1 local copies are
|
|
@@ -62,7 +62,8 @@ export const toneSolidClasses = {
|
|
|
62
62
|
};
|
|
63
63
|
/**
|
|
64
64
|
* Tone → `color-mix` border utilities used by Alert/Banner callouts
|
|
65
|
-
* (tone-soft bg + 30%-mixed tone border, research/design-system.md
|
|
65
|
+
* (tone-soft bg + 30%-mixed tone border, research/design-system.md
|
|
66
|
+
* Tier 3).
|
|
66
67
|
*/
|
|
67
68
|
export const toneMixBorderClasses = {
|
|
68
69
|
neutral: 'border-border',
|
|
@@ -73,16 +74,16 @@ export const toneMixBorderClasses = {
|
|
|
73
74
|
info: 'border-[color-mix(in_srgb,var(--info)_30%,transparent)]',
|
|
74
75
|
};
|
|
75
76
|
/**
|
|
76
|
-
* Sticky translucent bar recipe
|
|
77
|
-
*
|
|
78
|
-
*
|
|
77
|
+
* Sticky translucent bar recipe — used by `Topbar`, `WizardLayout` footer
|
|
78
|
+
* and sticky table headers. Exported from here so the color-mix recipe lives
|
|
79
|
+
* in exactly one place.
|
|
79
80
|
*/
|
|
80
81
|
export const glassBar = 'sticky top-0 z-40 border-b border-border bg-[color-mix(in_srgb,var(--surface)_82%,transparent)] backdrop-blur-[8px]';
|
|
81
82
|
/**
|
|
82
|
-
* Default status→tone registry
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
83
|
+
* Default status→tone registry. Extended at runtime via
|
|
84
|
+
* `registerStatusTones` (widgets/manifests register domain statuses); tints
|
|
85
|
+
* always derive from the tone — never hardcoded per feature (the "Ticket
|
|
86
|
+
* Queue hardcoded priority tint" defect fix).
|
|
86
87
|
*/
|
|
87
88
|
export const DEFAULT_STATUS_TONES = Object.freeze({
|
|
88
89
|
paid: 'pos',
|
package/dist/lib/tones.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tones.js","sourceRoot":"","sources":["../../src/lib/tones.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC;;;;;;;;GAQG;AAKH,kEAAkE;AAClE,MAAM,CAAC,MAAM,KAAK,GAAoB,CAAC,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;AAE7F;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,MAAM,eAAe,GAAyB;IACnD,OAAO,EAAE,4BAA4B;IACrC,MAAM,EAAE,kCAAkC;IAC1C,GAAG,EAAE,4BAA4B;IACjC,IAAI,EAAE,8BAA8B;IACpC,MAAM,EAAE,kCAAkC;IAC1C,IAAI,EAAE,8BAA8B;CACrC,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAyB;IACpD,OAAO,EAAE,sBAAsB;IAC/B,MAAM,EAAE,0BAA0B;IAClC,GAAG,EAAE,uBAAuB;IAC5B,IAAI,EAAE,wBAAwB;IAC9B,MAAM,EAAE,0BAA0B;IAClC,IAAI,EAAE,wBAAwB;CAC/B,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"tones.js","sourceRoot":"","sources":["../../src/lib/tones.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC;;;;;;;;GAQG;AAKH,kEAAkE;AAClE,MAAM,CAAC,MAAM,KAAK,GAAoB,CAAC,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;AAE7F;;;;;;;;;;;;;;;;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,EAAE,MAAM;IAChB,OAAO,EAAE,MAAM;IACf,OAAO,EAAE,MAAM;IACf,SAAS,EAAE,MAAM;IACjB,KAAK,EAAE,SAAS;IAChB,QAAQ,EAAE,SAAS;IACnB,QAAQ,EAAE,SAAS;IACnB,QAAQ,EAAE,SAAS;CACpB,CAAC,CAAC;AAEH,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAe,MAAM,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC,CAAC;AAE7E,yEAAyE;AACzE,MAAM,UAAU,mBAAmB,CAAC,GAAyB;IAC3D,KAAK,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QACjD,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,WAAW,EAAE,EAAE,IAAI,CAAC,CAAC;IAC3C,CAAC;AACH,CAAC;AAED,qEAAqE;AACrE,MAAM,UAAU,UAAU,CAAC,MAAc,EAAE,WAAiB,SAAS;IACnE,OAAO,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,IAAI,QAAQ,CAAC;AACxD,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WHERE THE WEEK STARTS, and what the days are called.
|
|
3
|
+
*
|
|
4
|
+
* Two products in this repo need the same answer — the quick-create date pills
|
|
5
|
+
* and the month calendar — and two copies of it is how one screen puts Monday
|
|
6
|
+
* first while the screen beside it puts Sunday there. It lives here, in the
|
|
7
|
+
* package both of them already depend on.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* The reader's first day of the week, as `Date#getDay` counts (Sunday = 0).
|
|
11
|
+
*
|
|
12
|
+
* `Intl.Locale`'s week info answers it where the runtime has it; Monday is the
|
|
13
|
+
* fallback, because it is what the ISO calendar says and what most of the
|
|
14
|
+
* world's locales use.
|
|
15
|
+
*/
|
|
16
|
+
export declare function firstDayOfWeek(locale: string | undefined): number;
|
|
17
|
+
/**
|
|
18
|
+
* The seven weekday initials, starting where this reader's week does.
|
|
19
|
+
*
|
|
20
|
+
* `narrow` is the one-letter form every locale defines — and in several of
|
|
21
|
+
* them two days share a letter (English's T and S, the comp's own `M T W T F S
|
|
22
|
+
* S`), which is correct rather than a bug: the column position is what
|
|
23
|
+
* disambiguates, and inventing a second letter would be inventing a locale.
|
|
24
|
+
*/
|
|
25
|
+
export declare function weekdayInitials(locale: string | undefined): string[];
|
|
26
|
+
/**
|
|
27
|
+
* The cells of a month grid: leading blanks for the days before the 1st, then
|
|
28
|
+
* every day of the month.
|
|
29
|
+
*
|
|
30
|
+
* Returned as `null` for a blank rather than as a Date outside the month,
|
|
31
|
+
* because the comp draws those cells empty (634–652) and a caller that had a
|
|
32
|
+
* date in hand would sooner or later render it.
|
|
33
|
+
*/
|
|
34
|
+
export declare function monthGrid(year: number, month: number, locale: string | undefined): (Date | null)[];
|
|
35
|
+
/** `YYYY-MM-DD` for a Date, in the reader's own zone — never `toISOString`. */
|
|
36
|
+
export declare function dayKey(date: Date): string;
|
|
37
|
+
//# sourceMappingURL=week.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"week.d.ts","sourceRoot":"","sources":["../../src/lib/week.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAajE;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,EAAE,CAQpE;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,EAAE,CAUlG;AAED,+EAA+E;AAC/E,wBAAgB,MAAM,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAGzC"}
|
package/dist/lib/week.js
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
|
+
/**
|
|
3
|
+
* WHERE THE WEEK STARTS, and what the days are called.
|
|
4
|
+
*
|
|
5
|
+
* Two products in this repo need the same answer — the quick-create date pills
|
|
6
|
+
* and the month calendar — and two copies of it is how one screen puts Monday
|
|
7
|
+
* first while the screen beside it puts Sunday there. It lives here, in the
|
|
8
|
+
* package both of them already depend on.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* The reader's first day of the week, as `Date#getDay` counts (Sunday = 0).
|
|
12
|
+
*
|
|
13
|
+
* `Intl.Locale`'s week info answers it where the runtime has it; Monday is the
|
|
14
|
+
* fallback, because it is what the ISO calendar says and what most of the
|
|
15
|
+
* world's locales use.
|
|
16
|
+
*/
|
|
17
|
+
export function firstDayOfWeek(locale) {
|
|
18
|
+
try {
|
|
19
|
+
const info = new Intl.Locale(locale ?? 'en-US');
|
|
20
|
+
const first = info.getWeekInfo?.().firstDay ?? info.weekInfo?.firstDay;
|
|
21
|
+
// `Intl` counts Monday as 1 … Sunday as 7; `Date#getDay` counts Sunday as 0.
|
|
22
|
+
if (typeof first === 'number')
|
|
23
|
+
return first % 7;
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
/* an older runtime, or a locale it does not know */
|
|
27
|
+
}
|
|
28
|
+
return 1;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The seven weekday initials, starting where this reader's week does.
|
|
32
|
+
*
|
|
33
|
+
* `narrow` is the one-letter form every locale defines — and in several of
|
|
34
|
+
* them two days share a letter (English's T and S, the comp's own `M T W T F S
|
|
35
|
+
* S`), which is correct rather than a bug: the column position is what
|
|
36
|
+
* disambiguates, and inventing a second letter would be inventing a locale.
|
|
37
|
+
*/
|
|
38
|
+
export function weekdayInitials(locale) {
|
|
39
|
+
const first = firstDayOfWeek(locale);
|
|
40
|
+
const format = new Intl.DateTimeFormat(locale ?? 'en-US', { weekday: 'narrow' });
|
|
41
|
+
// 2026-02-01 is a Sunday, so `getDay()` and the offset line up with no
|
|
42
|
+
// arithmetic about which epoch day was which.
|
|
43
|
+
return Array.from({ length: 7 }, (_, index) => format.format(new Date(Date.UTC(2026, 1, 1 + ((first + index) % 7)))));
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* The cells of a month grid: leading blanks for the days before the 1st, then
|
|
47
|
+
* every day of the month.
|
|
48
|
+
*
|
|
49
|
+
* Returned as `null` for a blank rather than as a Date outside the month,
|
|
50
|
+
* because the comp draws those cells empty (634–652) and a caller that had a
|
|
51
|
+
* date in hand would sooner or later render it.
|
|
52
|
+
*/
|
|
53
|
+
export function monthGrid(year, month, locale) {
|
|
54
|
+
const first = new Date(year, month, 1);
|
|
55
|
+
const lead = (first.getDay() - firstDayOfWeek(locale) + 7) % 7;
|
|
56
|
+
const days = new Date(year, month + 1, 0).getDate();
|
|
57
|
+
const cells = Array.from({ length: lead }, () => null);
|
|
58
|
+
for (let day = 1; day <= days; day += 1)
|
|
59
|
+
cells.push(new Date(year, month, day));
|
|
60
|
+
// Fill the last row, so the grid is a rectangle and the legend below it does
|
|
61
|
+
// not jump a line between a 28-day month and a 31-day one.
|
|
62
|
+
while (cells.length % 7 !== 0)
|
|
63
|
+
cells.push(null);
|
|
64
|
+
return cells;
|
|
65
|
+
}
|
|
66
|
+
/** `YYYY-MM-DD` for a Date, in the reader's own zone — never `toISOString`. */
|
|
67
|
+
export function dayKey(date) {
|
|
68
|
+
const pad = (n) => String(n).padStart(2, '0');
|
|
69
|
+
return `${String(date.getFullYear()).padStart(4, '0')}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`;
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=week.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"week.js","sourceRoot":"","sources":["../../src/lib/week.ts"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
|
12
12
|
onPrefChange?: ThemePrefChangeHandler;
|
|
13
13
|
/**
|
|
14
|
-
* Direction resolver for locales this package cannot know about
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* locales exist.
|
|
14
|
+
* Direction resolver for locales this package cannot know about. The
|
|
15
|
+
* app injects one backed by `@adminium/i18n`'s runtime registry; return
|
|
16
|
+
* `null` to defer to the compiled table and the cached axis. Absent in
|
|
17
|
+
* Storybook and in tests, where only the eight compiled locales exist.
|
|
19
18
|
*/
|
|
20
19
|
resolveDir?: (locale: Locale) => Dir | null;
|
|
21
20
|
children: ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../../src/theme/ThemeProvider.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../../src/theme/ThemeProvider.tsx"],"names":[],"mappings":"AAiCA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EASL,KAAK,GAAG,EACT,MAAM,kBAAkB,CAAC;AAS1B,OAAO,EAIL,KAAK,MAAM,EAEX,KAAK,UAAU,EAChB,MAAM,YAAY,CAAC;AAIpB,yFAAyF;AACzF,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,SAAS,MAAM,UAAU,EAC9D,GAAG,EAAE,CAAC,EACN,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,EACpB,KAAK,EAAE,UAAU,KACd,IAAI,CAAC;AAEV,MAAM,WAAW,kBAAkB;IACjC,yFAAyF;IACzF,cAAc,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IACrC,2EAA2E;IAC3E,SAAS,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IAChC,+EAA+E;IAC/E,YAAY,CAAC,EAAE,sBAAsB,CAAC;IACtC;;;;;OAKG;IACH,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,GAAG,GAAG,IAAI,CAAC;IAC5C,QAAQ,EAAE,SAAS,CAAC;CACrB;AAqFD,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,SAAS,CAqHlE"}
|
|
@@ -1,22 +1,20 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
3
3
|
/**
|
|
4
|
-
* ThemeProvider — runtime for the four theming axes (theme/accent/density/locale→dir)
|
|
5
|
-
* per 02-design-system.md §4 and 03-component-library.md §3.6.
|
|
4
|
+
* ThemeProvider — runtime for the four theming axes (theme/accent/density/locale→dir).
|
|
6
5
|
*
|
|
7
6
|
* Responsibilities:
|
|
8
|
-
* 1. Resolve effective prefs per-axis
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* in flight and keep winning (§4 behavior 4).
|
|
7
|
+
* 1. Resolve effective prefs per-axis: baseline ← localStorage pre-paint cache
|
|
8
|
+
* ← `globalDefaults` (adminium_settings) ← `userPrefs` (adminium_user_prefs) ←
|
|
9
|
+
* in-session `setPref` calls. localStorage is a cache, not a preference source:
|
|
10
|
+
* it only fills axes the server props do not supply (pre-auth surfaces), and
|
|
11
|
+
* server-resolved values always win. The `setPref` layer (`sessionPrefs`) is
|
|
12
|
+
* optimistic and transient: an entry is reconciled away once the
|
|
13
|
+
* server-resolved props catch up to it (same value), and can be dropped
|
|
14
|
+
* explicitly via `clearSessionPref` when the caller resets an axis server-side
|
|
15
|
+
* (M8 reset-to-default) — otherwise a stale optimistic value would keep masking
|
|
16
|
+
* the refetched default until a reload. Entries whose value still differs from
|
|
17
|
+
* the props are treated as in flight and keep winning (behavior 4).
|
|
20
18
|
* 2. Stamp `THEME_ATTRIBUTES` on `document.documentElement` (`data-theme` with
|
|
21
19
|
* the RESOLVED light/dark, `data-accent`, `data-density`, `dir`, `lang`).
|
|
22
20
|
* This is the only place theming attributes are set after pre-hydration.
|
|
@@ -56,7 +54,7 @@ function readStorageCache() {
|
|
|
56
54
|
if (density !== null && DENSITIES.includes(density)) {
|
|
57
55
|
cache.density = density;
|
|
58
56
|
}
|
|
59
|
-
// SHAPE check, not membership
|
|
57
|
+
// SHAPE check, not membership: a cached preference may name an
|
|
60
58
|
// admin-created locale this build does not compile in, and dropping it
|
|
61
59
|
// would strand that user on en-US on every cold load.
|
|
62
60
|
const locale = window.localStorage.getItem(STORAGE_KEYS.locale);
|
|
@@ -73,7 +71,7 @@ function readStorageCache() {
|
|
|
73
71
|
const LOCALE_ID_SHAPE = /^[a-z]{2,3}(_[A-Za-z0-9]{2,8}){0,2}$/;
|
|
74
72
|
/**
|
|
75
73
|
* The `dir` the last resolved paint cached — an INDEPENDENT axis, not
|
|
76
|
-
* re-derived from the locale
|
|
74
|
+
* re-derived from the locale.
|
|
77
75
|
*
|
|
78
76
|
* Without this, a custom RTL locale paints `rtl` from the pre-hydration
|
|
79
77
|
* script and snaps to `ltr` at hydration on every signed-out screen: this
|
|
@@ -128,7 +126,7 @@ export function ThemeProvider(props) {
|
|
|
128
126
|
const [sessionPrefs, setSessionPrefs] = useState({});
|
|
129
127
|
const [prefersDark, setPrefersDark] = useState(systemPrefersDark);
|
|
130
128
|
// Everything resolvable from the server props (+ pre-paint cache), WITHOUT the
|
|
131
|
-
// optimistic session layer. `sessionPrefs` rides on top of this
|
|
129
|
+
// optimistic session layer. `sessionPrefs` rides on top of this.
|
|
132
130
|
const propsResolved = useMemo(() => ({
|
|
133
131
|
...BASELINE_PREFS,
|
|
134
132
|
...storageCache,
|
|
@@ -146,7 +144,8 @@ export function ThemeProvider(props) {
|
|
|
146
144
|
setSessionPrefs((prev) => reconcileSessionPrefs(prev, propsResolved));
|
|
147
145
|
}
|
|
148
146
|
const prefs = useMemo(() => ({ ...propsResolved, ...sessionPrefs }), [propsResolved, sessionPrefs]);
|
|
149
|
-
// Live system-theme tracking, attached only while the pref is `system`
|
|
147
|
+
// Live system-theme tracking, attached only while the pref is `system`
|
|
148
|
+
// (behavior 2).
|
|
150
149
|
useEffect(() => {
|
|
151
150
|
if (prefs.theme !== 'system')
|
|
152
151
|
return;
|
|
@@ -169,7 +168,8 @@ export function ThemeProvider(props) {
|
|
|
169
168
|
locale: prefs.locale,
|
|
170
169
|
dir: dirForLocale(prefs.locale, { resolve: resolveDir, cached: cachedDir }),
|
|
171
170
|
}), [prefs, prefersDark, resolveDir, cachedDir]);
|
|
172
|
-
// Stamp <html>, write the cache back, then notify listeners (
|
|
171
|
+
// Stamp <html>, write the cache back, then notify listeners (behaviors
|
|
172
|
+
// 1/3/5).
|
|
173
173
|
useLayoutEffect(() => {
|
|
174
174
|
const el = document.documentElement;
|
|
175
175
|
el.setAttribute(THEME_ATTRIBUTES.theme, resolved.theme);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeProvider.js","sourceRoot":"","sources":["../../src/theme/ThemeProvider.tsx"],"names":[],"mappings":";AAAA,yCAAyC;AACzC
|
|
1
|
+
{"version":3,"file":"ThemeProvider.js","sourceRoot":"","sources":["../../src/theme/ThemeProvider.tsx"],"names":[],"mappings":";AAAA,yCAAyC;AACzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE3F,OAAO,EACL,OAAO,EACP,SAAS,EACT,YAAY,EACZ,MAAM,EACN,gBAAgB,GAKjB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,YAAY,GAIb,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,SAAS,EAAE,MAA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C7C,GAAG,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,gBAAgB,EAAE,CAAC,EACtD,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,gBAAgB,CAAC,CAC7C,CAAC;IAEF,OAAO,CACL,KAAC,YAAY,CAAC,QAAQ,IAAC,KAAK,EAAE,YAAY,YACxC,KAAC,iBAAiB,IAAC,GAAG,EAAE,QAAQ,CAAC,GAAG,YAAG,QAAQ,GAAqB,GAC9C,CACzB,CAAC;AACJ,CAAC"}
|
package/dist/theme/context.d.ts
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import type { ResolvedTheme, ThemePrefs } from './types.js';
|
|
2
|
-
/** `setPref` updates one axis optimistically (
|
|
2
|
+
/** `setPref` updates one axis optimistically (behavior 4). */
|
|
3
3
|
export type SetThemePref = <K extends keyof ThemePrefs>(key: K, value: ThemePrefs[K]) => void;
|
|
4
4
|
/**
|
|
5
5
|
* Drop the optimistic session override for one axis so the resolved value falls
|
|
6
|
-
* back through to the server-resolved props
|
|
7
|
-
*
|
|
8
|
-
*
|
|
6
|
+
* back through to the server-resolved props. The Preferences page calls this on
|
|
7
|
+
* "Reset to workspace default" — clearing an axis server-side does not change
|
|
8
|
+
* the in-session `setPref` layer, which would otherwise keep masking the
|
|
9
9
|
* refetched default until a reload.
|
|
10
10
|
*/
|
|
11
11
|
export type ClearSessionPref = (key: keyof ThemePrefs) => void;
|
|
12
12
|
export interface ThemeContextValue {
|
|
13
|
-
/** Effective preferences after the resolution order
|
|
13
|
+
/** Effective preferences after the resolution order; `theme` may be `system`.
|
|
14
|
+
* */
|
|
14
15
|
prefs: ThemePrefs;
|
|
15
16
|
/** Resolved values as stamped on `<html>`. */
|
|
16
17
|
resolved: ResolvedTheme;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/theme/context.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE5D,
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/theme/context.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE5D,8DAA8D;AAC9D,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,SAAS,MAAM,UAAU,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;AAE9F;;;;;;GAMG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,GAAG,EAAE,MAAM,UAAU,KAAK,IAAI,CAAC;AAE/D,MAAM,WAAW,iBAAiB;IAChC;SACK;IACL,KAAK,EAAE,UAAU,CAAC;IAClB,8CAA8C;IAC9C,QAAQ,EAAE,aAAa,CAAC;IACxB,OAAO,EAAE,YAAY,CAAC;IACtB,gBAAgB,EAAE,gBAAgB,CAAC;CACpC;AAED,eAAO,MAAM,YAAY,mDAAgD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/theme/context.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC;;;GAGG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/theme/context.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC;;;GAGG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AA0BtC,MAAM,CAAC,MAAM,YAAY,GAAG,aAAa,CAA2B,IAAI,CAAC,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Non-React theme subscription
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* Non-React theme subscription — for Leaflet tile swaps, chart
|
|
3
|
+
* re-tints, Electron `nativeTheme` mirroring. ThemeProvider emits AFTER
|
|
4
|
+
* the DOM attributes are committed (behavior 5).
|
|
5
5
|
*/
|
|
6
6
|
import type { ResolvedTheme } from './types.js';
|
|
7
7
|
export type ThemeListener = (theme: ResolvedTheme) => void;
|
|
@@ -11,7 +11,7 @@ export declare function subscribeTheme(listener: ThemeListener): () => void;
|
|
|
11
11
|
* @internal Called by ThemeProvider after stamping `<html>`. Not part of the
|
|
12
12
|
* public API.
|
|
13
13
|
*
|
|
14
|
-
* Each listener is isolated
|
|
14
|
+
* Each listener is isolated. This runs inside ThemeProvider's
|
|
15
15
|
* `useLayoutEffect`, so an unguarded throw from ONE subscriber does not just
|
|
16
16
|
* lose that subscriber — it skips every listener after it (the i18n language
|
|
17
17
|
* bridge, the chart-direction bridge, the Electron `nativeTheme` mirror) and
|
package/dist/theme/subscribe.js
CHANGED
|
@@ -10,7 +10,7 @@ export function subscribeTheme(listener) {
|
|
|
10
10
|
* @internal Called by ThemeProvider after stamping `<html>`. Not part of the
|
|
11
11
|
* public API.
|
|
12
12
|
*
|
|
13
|
-
* Each listener is isolated
|
|
13
|
+
* Each listener is isolated. This runs inside ThemeProvider's
|
|
14
14
|
* `useLayoutEffect`, so an unguarded throw from ONE subscriber does not just
|
|
15
15
|
* lose that subscriber — it skips every listener after it (the i18n language
|
|
16
16
|
* bridge, the chart-direction bridge, the Electron `nativeTheme` mirror) and
|
package/dist/theme/types.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Theming axis types for ThemeProvider
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* Theming axis types for ThemeProvider. Axis value unions come from
|
|
3
|
+
* `@adminium/tokens` so the DOM attributes, Storybook toolbar and provider
|
|
4
|
+
* can never drift apart; the locale union and the pref/resolved shapes live
|
|
5
|
+
* here because they are UI-runtime concerns.
|
|
6
6
|
*/
|
|
7
7
|
import type { Accent, Density, Dir, ResolvedTheme as ResolvedThemeMode, ThemePref } from '@adminium/tokens';
|
|
8
|
-
/** The 8 COMPILED locales
|
|
8
|
+
/** The 8 COMPILED locales. */
|
|
9
9
|
export declare const LOCALES: readonly ["en_US", "de_DE", "ar_EG", "zh_CN", "zh_TW", "cs_CZ", "da_DK", "fr_FR"];
|
|
10
10
|
export type BuiltinLocale = (typeof LOCALES)[number];
|
|
11
11
|
/**
|
|
12
12
|
* Any locale the instance may resolve to — the compiled eight plus whatever
|
|
13
|
-
* an admin created at runtime
|
|
14
|
-
*
|
|
13
|
+
* an admin created at runtime. `(string & {})` keeps literal autocomplete for
|
|
14
|
+
* the eight.
|
|
15
15
|
*
|
|
16
16
|
* This package deliberately does NOT depend on `@adminium/i18n`, so it cannot
|
|
17
17
|
* look a custom locale up. Direction therefore arrives one of two ways — an
|
|
@@ -34,7 +34,7 @@ export interface ResolvedTheme {
|
|
|
34
34
|
locale: Locale;
|
|
35
35
|
dir: Dir;
|
|
36
36
|
}
|
|
37
|
-
/** Baseline of the resolution order (BRIEF
|
|
37
|
+
/** Baseline of the resolution order (BRIEF via `@adminium/tokens`). */
|
|
38
38
|
export declare const BASELINE_PREFS: ThemePrefs;
|
|
39
39
|
/** Direction of the COMPILED locales; `null` for anything else. */
|
|
40
40
|
export declare function builtinLocaleDir(locale: string): Dir | null;
|
|
@@ -46,7 +46,7 @@ export declare function builtinLocaleDir(locale: string): Dir | null;
|
|
|
46
46
|
* order is: an injected resolver (the app has the registry) → the compiled
|
|
47
47
|
* table → the cached `dir` axis from the last resolved paint → `ltr`. The
|
|
48
48
|
* cached axis is what keeps a custom RTL locale from flashing on pre-auth
|
|
49
|
-
* screens, where no bootstrap payload exists yet
|
|
49
|
+
* screens, where no bootstrap payload exists yet.
|
|
50
50
|
*/
|
|
51
51
|
export declare function dirForLocale(locale: Locale, opts?: {
|
|
52
52
|
resolve?: ((locale: Locale) => Dir | null) | undefined;
|
|
@@ -55,7 +55,7 @@ export declare function dirForLocale(locale: Locale, opts?: {
|
|
|
55
55
|
/**
|
|
56
56
|
* BCP-47 form of a locale for the `lang` attribute (`ar_EG` → `ar-EG`).
|
|
57
57
|
* Replaces EVERY underscore: a single replacement leaves `zh-Hant_TW`, which
|
|
58
|
-
* is not a valid tag
|
|
58
|
+
* is not a valid tag.
|
|
59
59
|
*/
|
|
60
60
|
export declare function langForLocale(locale: Locale): string;
|
|
61
61
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/theme/types.ts"],"names":[],"mappings":"AACA;;;;;GAKG;AACH,OAAO,KAAK,EACV,MAAM,EACN,OAAO,EACP,GAAG,EACH,aAAa,IAAI,iBAAiB,EAClC,SAAS,EACV,MAAM,kBAAkB,CAAC;AAG1B,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/theme/types.ts"],"names":[],"mappings":"AACA;;;;;GAKG;AACH,OAAO,KAAK,EACV,MAAM,EACN,OAAO,EACP,GAAG,EACH,aAAa,IAAI,iBAAiB,EAClC,SAAS,EACV,MAAM,kBAAkB,CAAC;AAG1B,8BAA8B;AAC9B,eAAO,MAAM,OAAO,mFASV,CAAC;AACX,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC;AAErD;;;;;;;;;GASG;AACH,MAAM,MAAM,MAAM,GAAG,aAAa,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAEnD,sFAAsF;AACtF,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,SAAS,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,qFAAqF;AACrF,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,iBAAiB,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,GAAG,CAAC;CACV;AAED,uEAAuE;AACvE,eAAO,MAAM,cAAc,EAAE,UAAiC,CAAC;AAE/D,mEAAmE;AACnE,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG,GAAG,IAAI,CAG3D;AAED;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,MAAM,EACd,IAAI,GAAE;IAAE,OAAO,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,MAAM,KAAK,GAAG,GAAG,IAAI,CAAC,GAAG,SAAS,CAAC;IAAC,MAAM,CAAC,EAAE,GAAG,GAAG,SAAS,CAAA;CAAO,GAC9F,GAAG,CAEL;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEpD"}
|
package/dist/theme/types.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DEFAULT_PREFS } from '@adminium/tokens';
|
|
2
|
-
/** The 8 COMPILED locales
|
|
2
|
+
/** The 8 COMPILED locales. */
|
|
3
3
|
export const LOCALES = [
|
|
4
4
|
'en_US',
|
|
5
5
|
'de_DE',
|
|
@@ -10,7 +10,7 @@ export const LOCALES = [
|
|
|
10
10
|
'da_DK',
|
|
11
11
|
'fr_FR',
|
|
12
12
|
];
|
|
13
|
-
/** Baseline of the resolution order (BRIEF
|
|
13
|
+
/** Baseline of the resolution order (BRIEF via `@adminium/tokens`). */
|
|
14
14
|
export const BASELINE_PREFS = { ...DEFAULT_PREFS };
|
|
15
15
|
/** Direction of the COMPILED locales; `null` for anything else. */
|
|
16
16
|
export function builtinLocaleDir(locale) {
|
|
@@ -26,7 +26,7 @@ export function builtinLocaleDir(locale) {
|
|
|
26
26
|
* order is: an injected resolver (the app has the registry) → the compiled
|
|
27
27
|
* table → the cached `dir` axis from the last resolved paint → `ltr`. The
|
|
28
28
|
* cached axis is what keeps a custom RTL locale from flashing on pre-auth
|
|
29
|
-
* screens, where no bootstrap payload exists yet
|
|
29
|
+
* screens, where no bootstrap payload exists yet.
|
|
30
30
|
*/
|
|
31
31
|
export function dirForLocale(locale, opts = {}) {
|
|
32
32
|
return opts.resolve?.(locale) ?? builtinLocaleDir(locale) ?? opts.cached ?? 'ltr';
|
|
@@ -34,7 +34,7 @@ export function dirForLocale(locale, opts = {}) {
|
|
|
34
34
|
/**
|
|
35
35
|
* BCP-47 form of a locale for the `lang` attribute (`ar_EG` → `ar-EG`).
|
|
36
36
|
* Replaces EVERY underscore: a single replacement leaves `zh-Hant_TW`, which
|
|
37
|
-
* is not a valid tag
|
|
37
|
+
* is not a valid tag.
|
|
38
38
|
*/
|
|
39
39
|
export function langForLocale(locale) {
|
|
40
40
|
return locale.replaceAll('_', '-');
|
package/dist/theme/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/theme/types.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/theme/types.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,8BAA8B;AAC9B,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;CACC,CAAC;AAgCX,uEAAuE;AACvE,MAAM,CAAC,MAAM,cAAc,GAAe,EAAE,GAAG,aAAa,EAAE,CAAC;AAE/D,mEAAmE;AACnE,MAAM,UAAU,gBAAgB,CAAC,MAAc;IAC7C,IAAI,CAAE,OAA6B,CAAC,QAAQ,CAAC,MAAM,CAAC;QAAE,OAAO,IAAI,CAAC;IAClE,OAAO,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;AAC5C,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,YAAY,CAC1B,MAAc,EACd,OAA6F,EAAE;IAE/F,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC,MAAM,CAAC,IAAI,gBAAgB,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,MAAM,IAAI,KAAK,CAAC;AACpF,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,MAAc;IAC1C,OAAO,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AACrC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTheme.d.ts","sourceRoot":"","sources":["../../src/theme/useTheme.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useTheme.d.ts","sourceRoot":"","sources":["../../src/theme/useTheme.ts"],"names":[],"mappings":"AAOA,OAAO,EAAgB,KAAK,gBAAgB,EAAE,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AACtF,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAU5D,4FAA4F;AAC5F,wBAAgB,QAAQ,IAAI,aAAa,CAExC;AAED;;;GAGG;AACH,wBAAgB,aAAa,IAAI;IAC/B,KAAK,EAAE,UAAU,CAAC;IAClB,OAAO,EAAE,YAAY,CAAC;IACtB,gBAAgB,EAAE,gBAAgB,CAAC;CACpC,CAGA"}
|
package/dist/theme/useTheme.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
2
|
/**
|
|
3
|
-
* Theme hooks
|
|
4
|
-
*
|
|
5
|
-
* `setPref` for the appearance settings UI.
|
|
3
|
+
* Theme hooks. `useTheme` → resolved values for rendering; `useThemePrefs`
|
|
4
|
+
* → raw prefs + `setPref` for the appearance settings UI.
|
|
6
5
|
*/
|
|
7
6
|
import { useContext } from 'react';
|
|
8
7
|
import { ThemeContext } from './context.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTheme.js","sourceRoot":"","sources":["../../src/theme/useTheme.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC
|
|
1
|
+
{"version":3,"file":"useTheme.js","sourceRoot":"","sources":["../../src/theme/useTheme.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC;;;GAGG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,EAAE,YAAY,EAA4C,MAAM,cAAc,CAAC;AAGtF,SAAS,uBAAuB,CAAC,IAAY;IAC3C,MAAM,OAAO,GAAG,UAAU,CAAC,YAAY,CAAC,CAAC;IACzC,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;QACrB,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,sCAAsC,CAAC,CAAC;IACjE,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,4FAA4F;AAC5F,MAAM,UAAU,QAAQ;IACtB,OAAO,uBAAuB,CAAC,YAAY,CAAC,CAAC,QAAQ,CAAC;AACxD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,aAAa;IAK3B,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,gBAAgB,EAAE,GAAG,uBAAuB,CAAC,iBAAiB,CAAC,CAAC;IACxF,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAC9C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adminiumjs/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0-rc.0",
|
|
4
4
|
"license": "AGPL-3.0-only",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@adminium/tokens": "npm:@adminiumjs/tokens@0.
|
|
26
|
+
"@adminium/tokens": "npm:@adminiumjs/tokens@0.3.0-rc.0",
|
|
27
27
|
"@radix-ui/react-checkbox": "^1.3.3",
|
|
28
28
|
"@radix-ui/react-dialog": "^1.1.15",
|
|
29
29
|
"@radix-ui/react-direction": "^1.1.1",
|