@bettercms-ai/kit 0.1.0 → 1.0.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/_virtual/_rolldown/runtime.js +13 -0
- package/adapters/icons.d.ts +15 -0
- package/adapters/icons.js +27 -0
- package/adapters/icons.js.map +1 -0
- package/adapters/lossy.d.ts +267 -0
- package/adapters/lossy.js +233 -0
- package/adapters/lossy.js.map +1 -0
- package/adapters/prod-types.d.ts +468 -0
- package/adapters/prod-types.js +646 -0
- package/adapters/prod-types.js.map +1 -0
- package/adapters/schema.d.ts +115 -0
- package/adapters/schema.js +2203 -0
- package/adapters/schema.js.map +1 -0
- package/adapters/values.d.ts +200 -0
- package/adapters/values.js +553 -0
- package/adapters/values.js.map +1 -0
- package/brand/logo.d.ts +17 -0
- package/brand/logo.js +9 -0
- package/brand/logo.js.map +1 -0
- package/context.d.ts +269 -0
- package/context.js +214 -0
- package/context.js.map +1 -0
- package/controls/button.d.ts +58 -0
- package/controls/button.js +507 -0
- package/controls/button.js.map +1 -0
- package/controls/c1.d.ts +11 -0
- package/controls/c1.js +24 -0
- package/controls/c1.js.map +1 -0
- package/controls/c2.d.ts +10 -0
- package/controls/c2.js +19 -0
- package/controls/c2.js.map +1 -0
- package/controls/choice.d.ts +39 -0
- package/controls/choice.js +410 -0
- package/controls/choice.js.map +1 -0
- package/controls/code-register.d.ts +1 -0
- package/controls/code-register.js +8 -0
- package/controls/code-register.js.map +1 -0
- package/controls/code.d.ts +42 -0
- package/controls/code.js +396 -0
- package/controls/code.js.map +1 -0
- package/controls/color.d.ts +5 -0
- package/controls/color.js +130 -0
- package/controls/color.js.map +1 -0
- package/controls/component-services.d.ts +114 -0
- package/controls/date-register.d.ts +1 -0
- package/controls/date-register.js +9 -0
- package/controls/date-register.js.map +1 -0
- package/controls/date-zone.d.ts +104 -0
- package/controls/date-zone.js +272 -0
- package/controls/date-zone.js.map +1 -0
- package/controls/date.d.ts +7 -0
- package/controls/date.js +458 -0
- package/controls/date.js.map +1 -0
- package/controls/form-picker-register.d.ts +1 -0
- package/controls/form-picker-register.js +19 -0
- package/controls/form-picker-register.js.map +1 -0
- package/controls/form-picker.d.ts +43 -0
- package/controls/form-picker.js +83 -0
- package/controls/form-picker.js.map +1 -0
- package/controls/icon-register.d.ts +1 -0
- package/controls/icon-register.js +8 -0
- package/controls/icon-register.js.map +1 -0
- package/controls/icon.d.ts +38 -0
- package/controls/icon.js +355 -0
- package/controls/icon.js.map +1 -0
- package/controls/index.d.ts +5 -0
- package/controls/index.js +37 -0
- package/controls/index.js.map +1 -0
- package/controls/json-register.d.ts +1 -0
- package/controls/json-register.js +8 -0
- package/controls/json-register.js.map +1 -0
- package/controls/json.d.ts +2 -0
- package/controls/json.js +72 -0
- package/controls/json.js.map +1 -0
- package/controls/link.d.ts +260 -0
- package/controls/link.js +1186 -0
- package/controls/link.js.map +1 -0
- package/controls/location-register.d.ts +1 -0
- package/controls/location-register.js +8 -0
- package/controls/location-register.js.map +1 -0
- package/controls/location.d.ts +16 -0
- package/controls/location.js +197 -0
- package/controls/location.js.map +1 -0
- package/controls/media-register.d.ts +1 -0
- package/controls/media-register.js +12 -0
- package/controls/media-register.js.map +1 -0
- package/controls/media-services.d.ts +40 -0
- package/controls/media.d.ts +73 -0
- package/controls/media.js +1076 -0
- package/controls/media.js.map +1 -0
- package/controls/number.d.ts +22 -0
- package/controls/number.js +195 -0
- package/controls/number.js.map +1 -0
- package/controls/reference-register.d.ts +1 -0
- package/controls/reference-register.js +10 -0
- package/controls/reference-register.js.map +1 -0
- package/controls/reference-services.d.ts +54 -0
- package/controls/reference.d.ts +23 -0
- package/controls/reference.js +761 -0
- package/controls/reference.js.map +1 -0
- package/controls/rich-text/blocks.d.ts +28 -0
- package/controls/rich-text/blocks.js +1532 -0
- package/controls/rich-text/blocks.js.map +1 -0
- package/controls/rich-text/catalog.d.ts +98 -0
- package/controls/rich-text/catalog.js +613 -0
- package/controls/rich-text/catalog.js.map +1 -0
- package/controls/rich-text/codec.d.ts +56 -0
- package/controls/rich-text/codec.js +32 -0
- package/controls/rich-text/codec.js.map +1 -0
- package/controls/rich-text/component-card.d.ts +14 -0
- package/controls/rich-text/component-card.js +706 -0
- package/controls/rich-text/component-card.js.map +1 -0
- package/controls/rich-text/control.d.ts +21 -0
- package/controls/rich-text/control.js +254 -0
- package/controls/rich-text/control.js.map +1 -0
- package/controls/rich-text/dom.d.ts +190 -0
- package/controls/rich-text/dom.js +690 -0
- package/controls/rich-text/dom.js.map +1 -0
- package/controls/rich-text/editor.d.ts +50 -0
- package/controls/rich-text/editor.js +1530 -0
- package/controls/rich-text/editor.js.map +1 -0
- package/controls/rich-text/floating.d.ts +23 -0
- package/controls/rich-text/floating.js +137 -0
- package/controls/rich-text/floating.js.map +1 -0
- package/controls/rich-text/index.d.ts +1 -0
- package/controls/rich-text/index.js +12 -0
- package/controls/rich-text/index.js.map +1 -0
- package/controls/rich-text/link-form.d.ts +13 -0
- package/controls/rich-text/link-form.js +111 -0
- package/controls/rich-text/link-form.js.map +1 -0
- package/controls/rich-text/markdown.d.ts +6 -0
- package/controls/rich-text/markdown.js +179 -0
- package/controls/rich-text/markdown.js.map +1 -0
- package/controls/rich-text/ops.d.ts +35 -0
- package/controls/rich-text/ops.js +314 -0
- package/controls/rich-text/ops.js.map +1 -0
- package/controls/rich-text/toolbar.d.ts +85 -0
- package/controls/rich-text/toolbar.js +338 -0
- package/controls/rich-text/toolbar.js.map +1 -0
- package/controls/scale.d.ts +56 -0
- package/controls/scale.js +563 -0
- package/controls/scale.js.map +1 -0
- package/controls/slot-register.d.ts +1 -0
- package/controls/slot-register.js +16 -0
- package/controls/slot-register.js.map +1 -0
- package/controls/slot-services.d.ts +97 -0
- package/controls/slot-services.js +38 -0
- package/controls/slot-services.js.map +1 -0
- package/controls/slot.d.ts +33 -0
- package/controls/slot.js +348 -0
- package/controls/slot.js.map +1 -0
- package/controls/table/index.d.ts +1 -0
- package/controls/table/index.js +12 -0
- package/controls/table/index.js.map +1 -0
- package/controls/table/prod.d.ts +21 -0
- package/controls/table/prod.js +79 -0
- package/controls/table/prod.js.map +1 -0
- package/controls/table/refs.d.ts +50 -0
- package/controls/table/refs.js +68 -0
- package/controls/table/refs.js.map +1 -0
- package/controls/table/stored.d.ts +15 -0
- package/controls/table/stored.js +44 -0
- package/controls/table/stored.js.map +1 -0
- package/controls/table/table-editor.d.ts +103 -0
- package/controls/table/table-editor.js +2722 -0
- package/controls/table/table-editor.js.map +1 -0
- package/controls/table/table-link.d.ts +24 -0
- package/controls/table/table-link.js +180 -0
- package/controls/table/table-link.js.map +1 -0
- package/controls/table/table.d.ts +9 -0
- package/controls/table/table.js +103 -0
- package/controls/table/table.js.map +1 -0
- package/controls/text.d.ts +17 -0
- package/controls/text.js +287 -0
- package/controls/text.js.map +1 -0
- package/engine/array.d.ts +101 -0
- package/engine/array.js +893 -0
- package/engine/array.js.map +1 -0
- package/engine/bits.d.ts +24 -0
- package/engine/bits.js +60 -0
- package/engine/bits.js.map +1 -0
- package/engine/breadcrumb.d.ts +45 -0
- package/engine/breadcrumb.js +87 -0
- package/engine/breadcrumb.js.map +1 -0
- package/engine/expand.d.ts +68 -0
- package/engine/expand.js +170 -0
- package/engine/expand.js.map +1 -0
- package/engine/field-list.d.ts +20 -0
- package/engine/field-list.js +19 -0
- package/engine/field-list.js.map +1 -0
- package/engine/field-shell.d.ts +49 -0
- package/engine/field-shell.js +860 -0
- package/engine/field-shell.js.map +1 -0
- package/engine/frame.d.ts +120 -0
- package/engine/frame.js +599 -0
- package/engine/frame.js.map +1 -0
- package/engine/group-summary.d.ts +4 -0
- package/engine/group-summary.js +66 -0
- package/engine/group-summary.js.map +1 -0
- package/engine/grouping.d.ts +224 -0
- package/engine/grouping.js +824 -0
- package/engine/grouping.js.map +1 -0
- package/engine/item-list.d.ts +89 -0
- package/engine/item-list.js +703 -0
- package/engine/item-list.js.map +1 -0
- package/engine/kit-field.d.ts +72 -0
- package/engine/kit-field.js +523 -0
- package/engine/kit-field.js.map +1 -0
- package/engine/schema-form.d.ts +91 -0
- package/engine/schema-form.js +320 -0
- package/engine/schema-form.js.map +1 -0
- package/engine/slot.d.ts +13 -0
- package/engine/slot.js +226 -0
- package/engine/slot.js.map +1 -0
- package/index.d.ts +46 -0
- package/index.js +55 -0
- package/index.js.map +1 -0
- package/kit.css +56 -0
- package/lib/cn.d.ts +4 -0
- package/lib/cn.js +53 -0
- package/lib/cn.js.map +1 -0
- package/lib/columns.d.ts +14 -0
- package/lib/columns.js +27 -0
- package/lib/columns.js.map +1 -0
- package/lib/frames.d.ts +36 -0
- package/lib/frames.js +214 -0
- package/lib/frames.js.map +1 -0
- package/lib/icons.d.ts +16 -0
- package/lib/icons.js +172 -0
- package/lib/icons.js.map +1 -0
- package/lib/path.d.ts +29 -0
- package/lib/path.js +64 -0
- package/lib/path.js.map +1 -0
- package/lib/schema.d.ts +49 -0
- package/lib/schema.js +287 -0
- package/lib/schema.js.map +1 -0
- package/lib/utils.d.ts +7 -0
- package/lib/utils.js +37 -0
- package/lib/utils.js.map +1 -0
- package/lib/validate.d.ts +20 -0
- package/lib/validate.js +150 -0
- package/lib/validate.js.map +1 -0
- package/package.json +31 -59
- package/schema/adapters.d.ts +28 -0
- package/schema/adapters.js +493 -0
- package/schema/adapters.js.map +1 -0
- package/schema/help.d.ts +25 -0
- package/schema/help.js +54 -0
- package/schema/help.js.map +1 -0
- package/schema/scale.d.ts +69 -0
- package/schema/scale.js +250 -0
- package/schema/scale.js.map +1 -0
- package/schema/sources.d.ts +103 -0
- package/schema/sources.js +65 -0
- package/schema/sources.js.map +1 -0
- package/schema/table.d.ts +319 -0
- package/schema/table.js +1198 -0
- package/schema/table.js.map +1 -0
- package/schema/types.d.ts +269 -0
- package/schema/types.js +14 -0
- package/schema/types.js.map +1 -0
- package/types.d.ts +17 -0
- package/ui/action-tray.d.ts +54 -0
- package/ui/action-tray.js +153 -0
- package/ui/action-tray.js.map +1 -0
- package/ui/button.d.ts +57 -0
- package/ui/button.js +202 -0
- package/ui/button.js.map +1 -0
- package/ui/choice-switch.d.ts +36 -0
- package/ui/choice-switch.js +57 -0
- package/ui/choice-switch.js.map +1 -0
- package/ui/controls.d.ts +83 -0
- package/ui/controls.js +319 -0
- package/ui/controls.js.map +1 -0
- package/ui/display.d.ts +156 -0
- package/ui/display.js +444 -0
- package/ui/display.js.map +1 -0
- package/ui/expanded-editor-modal.d.ts +26 -0
- package/ui/expanded-editor-modal.js +140 -0
- package/ui/expanded-editor-modal.js.map +1 -0
- package/ui/field-context.d.ts +12 -0
- package/ui/field-context.js +23 -0
- package/ui/field-context.js.map +1 -0
- package/ui/floating-panel.d.ts +152 -0
- package/ui/floating-panel.js +912 -0
- package/ui/floating-panel.js.map +1 -0
- package/ui/index.d.ts +12 -0
- package/ui/index.js +13 -0
- package/ui/input.d.ts +78 -0
- package/ui/input.js +250 -0
- package/ui/input.js.map +1 -0
- package/ui/mode-bar.d.ts +31 -0
- package/ui/mode-bar.js +65 -0
- package/ui/mode-bar.js.map +1 -0
- package/ui/overlay.d.ts +123 -0
- package/ui/overlay.js +378 -0
- package/ui/overlay.js.map +1 -0
- package/ui/path-crumbs.d.ts +90 -0
- package/ui/path-crumbs.js +532 -0
- package/ui/path-crumbs.js.map +1 -0
- package/ui/presence.d.ts +16 -0
- package/ui/presence.js +65 -0
- package/ui/presence.js.map +1 -0
- package/ui/select.d.ts +66 -0
- package/ui/select.js +405 -0
- package/ui/select.js.map +1 -0
- package/ui/shortcut-hint.d.ts +14 -0
- package/ui/shortcut-hint.js +35 -0
- package/ui/shortcut-hint.js.map +1 -0
- package/ui/surfaces.d.ts +23 -0
- package/ui/surfaces.js +26 -0
- package/ui/surfaces.js.map +1 -0
- package/ui/tooltip-root.d.ts +12 -0
- package/ui/tooltip-root.js +76 -0
- package/ui/tooltip-root.js.map +1 -0
- package/ui/variants.d.ts +15 -0
- package/ui/variants.js +14 -0
- package/ui/variants.js.map +1 -0
- package/LICENSE +0 -21
- package/README.md +0 -27
- package/dist/_chunks-cjs/_visual-editing.js +0 -5898
- package/dist/_chunks-cjs/refractor.js +0 -22
- package/dist/_chunks-es/_visual-editing.mjs +0 -5904
- package/dist/_chunks-es/refractor.mjs +0 -25
- package/dist/_color.d.mts +0 -119
- package/dist/_color.d.ts +0 -119
- package/dist/_color.js +0 -1412
- package/dist/_color.mjs +0 -1411
- package/dist/_visual-editing.d.mts +0 -1126
- package/dist/_visual-editing.d.ts +0 -1126
- package/dist/_visual-editing.js +0 -30
- package/dist/_visual-editing.mjs +0 -30
- package/dist/index.d.mts +0 -3140
- package/dist/index.d.ts +0 -3140
- package/dist/index.js +0 -2036
- package/dist/index.mjs +0 -2044
- package/dist/theme.d.mts +0 -1506
- package/dist/theme.d.ts +0 -1506
- package/dist/theme.js +0 -4126
- package/dist/theme.mjs +0 -4126
- package/exports/_visual-editing.ts +0 -31
- package/exports/index.ts +0 -1
- package/exports/theme.ts +0 -1
- package/src/color/index.d.mts +0 -119
- package/src/color/index.mjs +0 -1411
- package/src/core/__workshop__/constants.ts +0 -293
- package/src/core/_compat.ts +0 -264
- package/src/core/components/autocomplete/__mocks__/apiStore.ts +0 -49
- package/src/core/components/autocomplete/__mocks__/countries.ts +0 -245
- package/src/core/components/autocomplete/__workshop__/async.tsx +0 -156
- package/src/core/components/autocomplete/__workshop__/constrainedHeight.tsx +0 -137
- package/src/core/components/autocomplete/__workshop__/custom.tsx +0 -89
- package/src/core/components/autocomplete/__workshop__/example.tsx +0 -79
- package/src/core/components/autocomplete/__workshop__/focusAndBlur.tsx +0 -36
- package/src/core/components/autocomplete/__workshop__/fullscreen.tsx +0 -294
- package/src/core/components/autocomplete/__workshop__/index.ts +0 -39
- package/src/core/components/autocomplete/__workshop__/types.ts +0 -4
- package/src/core/components/autocomplete/autocomplete.styles.tsx +0 -39
- package/src/core/components/autocomplete/autocomplete.tsx +0 -767
- package/src/core/components/autocomplete/autocompleteOption.tsx +0 -45
- package/src/core/components/autocomplete/autocompleteReducer.ts +0 -47
- package/src/core/components/autocomplete/constants.ts +0 -28
- package/src/core/components/autocomplete/index.ts +0 -2
- package/src/core/components/autocomplete/types.ts +0 -108
- package/src/core/components/breadcrumbs/__workshop__/example.tsx +0 -62
- package/src/core/components/breadcrumbs/__workshop__/index.ts +0 -14
- package/src/core/components/breadcrumbs/breadcrumbs.styles.ts +0 -18
- package/src/core/components/breadcrumbs/breadcrumbs.test.tsx +0 -51
- package/src/core/components/breadcrumbs/breadcrumbs.tsx +0 -133
- package/src/core/components/breadcrumbs/index.ts +0 -1
- package/src/core/components/dialog/__workshop__/activate.tsx +0 -134
- package/src/core/components/dialog/__workshop__/autoFocus.tsx +0 -29
- package/src/core/components/dialog/__workshop__/index.ts +0 -19
- package/src/core/components/dialog/__workshop__/layering.tsx +0 -41
- package/src/core/components/dialog/__workshop__/nested.tsx +0 -72
- package/src/core/components/dialog/__workshop__/onScroll.tsx +0 -39
- package/src/core/components/dialog/__workshop__/panes.tsx +0 -82
- package/src/core/components/dialog/__workshop__/position.tsx +0 -30
- package/src/core/components/dialog/__workshop__/props.tsx +0 -75
- package/src/core/components/dialog/__workshop__/provider.tsx +0 -11
- package/src/core/components/dialog/__workshop__/wrapped.tsx +0 -76
- package/src/core/components/dialog/dialog.tsx +0 -430
- package/src/core/components/dialog/dialogContext.ts +0 -20
- package/src/core/components/dialog/dialogProvider.tsx +0 -35
- package/src/core/components/dialog/index.ts +0 -4
- package/src/core/components/dialog/styles.ts +0 -77
- package/src/core/components/dialog/useDialog.ts +0 -11
- package/src/core/components/hotkeys/__workshop__/index.ts +0 -14
- package/src/core/components/hotkeys/__workshop__/plain.tsx +0 -9
- package/src/core/components/hotkeys/hotkeys.test.tsx +0 -42
- package/src/core/components/hotkeys/hotkeys.tsx +0 -66
- package/src/core/components/hotkeys/index.ts +0 -1
- package/src/core/components/index.ts +0 -9
- package/src/core/components/menu/__workshop__/asComponent.tsx +0 -45
- package/src/core/components/menu/__workshop__/avatarMenu.tsx +0 -51
- package/src/core/components/menu/__workshop__/closableMenuButton.tsx +0 -46
- package/src/core/components/menu/__workshop__/constrainedInBoundary.tsx +0 -134
- package/src/core/components/menu/__workshop__/customMenuItem.tsx +0 -45
- package/src/core/components/menu/__workshop__/customSelectedState.tsx +0 -39
- package/src/core/components/menu/__workshop__/disableFocusOnClose.tsx +0 -40
- package/src/core/components/menu/__workshop__/groups.tsx +0 -156
- package/src/core/components/menu/__workshop__/index.ts +0 -89
- package/src/core/components/menu/__workshop__/menuButton.tsx +0 -80
- package/src/core/components/menu/__workshop__/menuGroupRight.tsx +0 -58
- package/src/core/components/menu/__workshop__/nestedMenu.tsx +0 -22
- package/src/core/components/menu/__workshop__/onCloseMenuButton.tsx +0 -41
- package/src/core/components/menu/__workshop__/selectedItem.tsx +0 -69
- package/src/core/components/menu/__workshop__/shouldFocus.tsx +0 -47
- package/src/core/components/menu/__workshop__/tones.tsx +0 -25
- package/src/core/components/menu/__workshop__/withoutArrow.tsx +0 -32
- package/src/core/components/menu/helpers.ts +0 -82
- package/src/core/components/menu/index.ts +0 -5
- package/src/core/components/menu/menu.spacing.test.tsx +0 -63
- package/src/core/components/menu/menu.test.tsx +0 -125
- package/src/core/components/menu/menu.tsx +0 -178
- package/src/core/components/menu/menuButton.tsx +0 -268
- package/src/core/components/menu/menuContext.ts +0 -18
- package/src/core/components/menu/menuDivider.ts +0 -23
- package/src/core/components/menu/menuGroup.spacing.test.tsx +0 -63
- package/src/core/components/menu/menuGroup.tsx +0 -233
- package/src/core/components/menu/menuItem.spacing.test.tsx +0 -59
- package/src/core/components/menu/menuItem.tsx +0 -197
- package/src/core/components/menu/useMenu.ts +0 -21
- package/src/core/components/menu/useMenuController.ts +0 -231
- package/src/core/components/skeleton/__workshop__/delay.tsx +0 -70
- package/src/core/components/skeleton/__workshop__/index.ts +0 -11
- package/src/core/components/skeleton/__workshop__/skeleton.tsx +0 -64
- package/src/core/components/skeleton/index.ts +0 -2
- package/src/core/components/skeleton/skeleton.tsx +0 -57
- package/src/core/components/skeleton/styles.ts +0 -50
- package/src/core/components/skeleton/textSkeleton.tsx +0 -122
- package/src/core/components/tab/__workshop__/example.tsx +0 -79
- package/src/core/components/tab/__workshop__/index.ts +0 -14
- package/src/core/components/tab/index.ts +0 -3
- package/src/core/components/tab/tab.tsx +0 -101
- package/src/core/components/tab/tabList.test.tsx +0 -48
- package/src/core/components/tab/tabList.tsx +0 -70
- package/src/core/components/tab/tabPanel.tsx +0 -39
- package/src/core/components/toast/__workshop__/hook.tsx +0 -71
- package/src/core/components/toast/__workshop__/index.ts +0 -19
- package/src/core/components/toast/__workshop__/toast.tsx +0 -26
- package/src/core/components/toast/index.ts +0 -4
- package/src/core/components/toast/styles.ts +0 -77
- package/src/core/components/toast/toast.test.tsx +0 -101
- package/src/core/components/toast/toast.tsx +0 -198
- package/src/core/components/toast/toastContext.ts +0 -7
- package/src/core/components/toast/toastLayer.tsx +0 -51
- package/src/core/components/toast/toastProvider.tsx +0 -113
- package/src/core/components/toast/toastState.ts +0 -6
- package/src/core/components/toast/types.ts +0 -26
- package/src/core/components/toast/useToast.ts +0 -25
- package/src/core/components/tree/__workshop__/basic.perf.ts +0 -19
- package/src/core/components/tree/__workshop__/basic.tsx +0 -105
- package/src/core/components/tree/__workshop__/index.ts +0 -21
- package/src/core/components/tree/__workshop__/tabFromElement.tsx +0 -84
- package/src/core/components/tree/helpers.ts +0 -105
- package/src/core/components/tree/index.ts +0 -4
- package/src/core/components/tree/style.ts +0 -105
- package/src/core/components/tree/tree.test.tsx +0 -55
- package/src/core/components/tree/tree.tsx +0 -240
- package/src/core/components/tree/treeContext.ts +0 -10
- package/src/core/components/tree/treeGroup.tsx +0 -28
- package/src/core/components/tree/treeItem.test.tsx +0 -65
- package/src/core/components/tree/treeItem.tsx +0 -224
- package/src/core/components/tree/types.ts +0 -25
- package/src/core/components/tree/useTree.ts +0 -17
- package/src/core/constants.ts +0 -79
- package/src/core/helpers/animation.ts +0 -27
- package/src/core/helpers/element.ts +0 -55
- package/src/core/helpers/focus.ts +0 -100
- package/src/core/helpers/index.ts +0 -4
- package/src/core/helpers/scroll.ts +0 -15
- package/src/core/hooks/index.ts +0 -12
- package/src/core/hooks/useArrayProp.ts +0 -17
- package/src/core/hooks/useClickOutside.test.tsx +0 -482
- package/src/core/hooks/useClickOutside.ts +0 -118
- package/src/core/hooks/useClickOutsideEvent.test.tsx +0 -115
- package/src/core/hooks/useClickOutsideEvent.ts +0 -73
- package/src/core/hooks/useCustomValidity.ts +0 -13
- package/src/core/hooks/useDelayed.test.ts +0 -88
- package/src/core/hooks/useDelayedState.ts +0 -36
- package/src/core/hooks/useElementRect/__workshop__/example.tsx +0 -32
- package/src/core/hooks/useElementRect/__workshop__/index.ts +0 -14
- package/src/core/hooks/useElementRect/index.ts +0 -1
- package/src/core/hooks/useElementRect/useElementRect.ts +0 -13
- package/src/core/hooks/useElementSize.ts +0 -19
- package/src/core/hooks/useForwardedRef.ts +0 -19
- package/src/core/hooks/useGlobalKeyDown.ts +0 -24
- package/src/core/hooks/useIsomorphicEffect.ts +0 -7
- package/src/core/hooks/useMatchMedia.ts +0 -28
- package/src/core/hooks/useMediaIndex/__workshop__/index.ts +0 -14
- package/src/core/hooks/useMediaIndex/__workshop__/test.tsx +0 -14
- package/src/core/hooks/useMediaIndex/index.ts +0 -1
- package/src/core/hooks/useMediaIndex/useMediaIndex.test.tsx +0 -36
- package/src/core/hooks/useMediaIndex/useMediaIndex.ts +0 -102
- package/src/core/hooks/useMounted.ts +0 -15
- package/src/core/hooks/usePrefersDark.hydration.test.tsx +0 -56
- package/src/core/hooks/usePrefersDark.test.tsx +0 -19
- package/src/core/hooks/usePrefersDark.ts +0 -16
- package/src/core/hooks/usePrefersReducedMotion.hydration.test.tsx +0 -56
- package/src/core/hooks/usePrefersReducedMotion.test.tsx +0 -19
- package/src/core/hooks/usePrefersReducedMotion.ts +0 -16
- package/src/core/index.ts +0 -10
- package/src/core/lib/createGlobalScopedContext.ts +0 -36
- package/src/core/lib/globalScope.ts +0 -19
- package/src/core/lib/isRecord.ts +0 -3
- package/src/core/middleware/origin.ts +0 -47
- package/src/core/observers/elementSizeObserver.ts +0 -116
- package/src/core/observers/index.ts +0 -2
- package/src/core/observers/resizeObserver.ts +0 -9
- package/src/core/primitives/_selectable/index.ts +0 -1
- package/src/core/primitives/_selectable/selectable.tsx +0 -15
- package/src/core/primitives/_selectable/style.ts +0 -115
- package/src/core/primitives/avatar/__workshop__/asButton.tsx +0 -14
- package/src/core/primitives/avatar/__workshop__/index.ts +0 -29
- package/src/core/primitives/avatar/__workshop__/stack.tsx +0 -25
- package/src/core/primitives/avatar/__workshop__/withinButton.tsx +0 -63
- package/src/core/primitives/avatar/__workshop__/withinMenuItem.tsx +0 -70
- package/src/core/primitives/avatar/avatar.tsx +0 -200
- package/src/core/primitives/avatar/avatarCounter.tsx +0 -91
- package/src/core/primitives/avatar/avatarStack.tsx +0 -100
- package/src/core/primitives/avatar/index.ts +0 -4
- package/src/core/primitives/avatar/styles.ts +0 -167
- package/src/core/primitives/avatar/types.ts +0 -17
- package/src/core/primitives/badge/__workshop__/index.ts +0 -19
- package/src/core/primitives/badge/__workshop__/props.tsx +0 -30
- package/src/core/primitives/badge/__workshop__/tones.tsx +0 -21
- package/src/core/primitives/badge/badge.test.tsx +0 -16
- package/src/core/primitives/badge/badge.tsx +0 -70
- package/src/core/primitives/badge/index.ts +0 -1
- package/src/core/primitives/badge/styles.ts +0 -20
- package/src/core/primitives/badge/types.ts +0 -8
- package/src/core/primitives/box/__workshop__/asComponent.tsx +0 -31
- package/src/core/primitives/box/__workshop__/index.ts +0 -24
- package/src/core/primitives/box/__workshop__/props.tsx +0 -20
- package/src/core/primitives/box/__workshop__/responsive.tsx +0 -20
- package/src/core/primitives/box/box.test.tsx +0 -142
- package/src/core/primitives/box/box.tsx +0 -154
- package/src/core/primitives/box/index.ts +0 -1
- package/src/core/primitives/button/__workshop__/custom.tsx +0 -51
- package/src/core/primitives/button/__workshop__/customIcons.tsx +0 -30
- package/src/core/primitives/button/__workshop__/disabled.tsx +0 -74
- package/src/core/primitives/button/__workshop__/index.ts +0 -59
- package/src/core/primitives/button/__workshop__/labelUploadButton.tsx +0 -36
- package/src/core/primitives/button/__workshop__/mixedChildren.tsx +0 -12
- package/src/core/primitives/button/__workshop__/props.tsx +0 -55
- package/src/core/primitives/button/__workshop__/stacked.tsx +0 -58
- package/src/core/primitives/button/__workshop__/styled1.tsx +0 -17
- package/src/core/primitives/button/__workshop__/styled2.tsx +0 -19
- package/src/core/primitives/button/__workshop__/uploadButton.tsx +0 -28
- package/src/core/primitives/button/button.test.tsx +0 -82
- package/src/core/primitives/button/button.tsx +0 -210
- package/src/core/primitives/button/index.ts +0 -1
- package/src/core/primitives/button/styles.ts +0 -117
- package/src/core/primitives/card/__workshop__/allTones.tsx +0 -25
- package/src/core/primitives/card/__workshop__/asButton.tsx +0 -107
- package/src/core/primitives/card/__workshop__/asComponent.tsx +0 -27
- package/src/core/primitives/card/__workshop__/checkered.tsx +0 -26
- package/src/core/primitives/card/__workshop__/index.ts +0 -18
- package/src/core/primitives/card/__workshop__/interactive.tsx +0 -30
- package/src/core/primitives/card/__workshop__/listNavigation.tsx +0 -80
- package/src/core/primitives/card/__workshop__/props.tsx +0 -53
- package/src/core/primitives/card/__workshop__/selected.tsx +0 -94
- package/src/core/primitives/card/__workshop__/styled.tsx +0 -14
- package/src/core/primitives/card/card.tsx +0 -128
- package/src/core/primitives/card/index.ts +0 -2
- package/src/core/primitives/card/styles.ts +0 -147
- package/src/core/primitives/card/types.ts +0 -11
- package/src/core/primitives/checkbox/__workshop__/example.tsx +0 -25
- package/src/core/primitives/checkbox/__workshop__/index.ts +0 -13
- package/src/core/primitives/checkbox/__workshop__/props.tsx +0 -33
- package/src/core/primitives/checkbox/__workshop__/readOnly.tsx +0 -16
- package/src/core/primitives/checkbox/__workshop__/tones.tsx +0 -28
- package/src/core/primitives/checkbox/checkbox.tsx +0 -73
- package/src/core/primitives/checkbox/index.ts +0 -1
- package/src/core/primitives/checkbox/styles.ts +0 -128
- package/src/core/primitives/code/__workshop__/index.ts +0 -19
- package/src/core/primitives/code/__workshop__/opticalAlignment.tsx +0 -48
- package/src/core/primitives/code/__workshop__/props.tsx +0 -21
- package/src/core/primitives/code/code.tsx +0 -55
- package/src/core/primitives/code/index.ts +0 -1
- package/src/core/primitives/code/refractor.tsx +0 -20
- package/src/core/primitives/code/styles.ts +0 -77
- package/src/core/primitives/container/__workshop__/example.tsx +0 -20
- package/src/core/primitives/container/__workshop__/index.ts +0 -8
- package/src/core/primitives/container/container.tsx +0 -54
- package/src/core/primitives/container/index.ts +0 -2
- package/src/core/primitives/container/styles.ts +0 -23
- package/src/core/primitives/container/types.ts +0 -6
- package/src/core/primitives/flex/__workshop__/example.tsx +0 -34
- package/src/core/primitives/flex/__workshop__/gap.tsx +0 -25
- package/src/core/primitives/flex/__workshop__/index.ts +0 -11
- package/src/core/primitives/flex/flex.tsx +0 -64
- package/src/core/primitives/flex/index.ts +0 -1
- package/src/core/primitives/grid/__workshop__/index.ts +0 -10
- package/src/core/primitives/grid/__workshop__/responsive.tsx +0 -54
- package/src/core/primitives/grid/grid.test.tsx +0 -80
- package/src/core/primitives/grid/grid.tsx +0 -74
- package/src/core/primitives/grid/index.ts +0 -1
- package/src/core/primitives/heading/__workshop__/index.ts +0 -19
- package/src/core/primitives/heading/__workshop__/opticalAlignment.tsx +0 -54
- package/src/core/primitives/heading/__workshop__/plain.tsx +0 -32
- package/src/core/primitives/heading/heading.tsx +0 -88
- package/src/core/primitives/heading/index.ts +0 -1
- package/src/core/primitives/heading/styles.ts +0 -64
- package/src/core/primitives/heading/types.ts +0 -7
- package/src/core/primitives/index.ts +0 -27
- package/src/core/primitives/inline/__workshop__/index.ts +0 -8
- package/src/core/primitives/inline/__workshop__/plain.tsx +0 -27
- package/src/core/primitives/inline/index.ts +0 -1
- package/src/core/primitives/inline/inline.test.tsx +0 -51
- package/src/core/primitives/inline/inline.tsx +0 -63
- package/src/core/primitives/inline/styles.ts +0 -32
- package/src/core/primitives/inline/types.ts +0 -6
- package/src/core/primitives/kbd/__workshop__/index.ts +0 -8
- package/src/core/primitives/kbd/__workshop__/plain.tsx +0 -9
- package/src/core/primitives/kbd/index.ts +0 -1
- package/src/core/primitives/kbd/kbd.tsx +0 -69
- package/src/core/primitives/label/__workshop__/index.ts +0 -19
- package/src/core/primitives/label/__workshop__/opticalAlignment.tsx +0 -48
- package/src/core/primitives/label/__workshop__/plain.tsx +0 -24
- package/src/core/primitives/label/index.ts +0 -1
- package/src/core/primitives/label/label.tsx +0 -87
- package/src/core/primitives/label/styles.ts +0 -45
- package/src/core/primitives/popover/__workshop__/AlignedStory.tsx +0 -77
- package/src/core/primitives/popover/__workshop__/MarginsStory.tsx +0 -31
- package/src/core/primitives/popover/__workshop__/MatchReferenceWidthStory.tsx +0 -32
- package/src/core/primitives/popover/__workshop__/OpenOnMountStory.tsx +0 -11
- package/src/core/primitives/popover/__workshop__/PlainStory.tsx +0 -71
- package/src/core/primitives/popover/__workshop__/RecursiveStory.tsx +0 -71
- package/src/core/primitives/popover/__workshop__/SidePanelStory.tsx +0 -89
- package/src/core/primitives/popover/__workshop__/TestStory.tsx +0 -97
- package/src/core/primitives/popover/__workshop__/index.ts +0 -49
- package/src/core/primitives/popover/constants.ts +0 -22
- package/src/core/primitives/popover/floating-ui/size.ts +0 -99
- package/src/core/primitives/popover/helpers.ts +0 -31
- package/src/core/primitives/popover/index.ts +0 -2
- package/src/core/primitives/popover/popover.tsx +0 -511
- package/src/core/primitives/popover/popoverCard.tsx +0 -166
- package/src/core/primitives/popover/types.ts +0 -7
- package/src/core/primitives/radio/__workshop__/example.tsx +0 -63
- package/src/core/primitives/radio/__workshop__/index.ts +0 -11
- package/src/core/primitives/radio/__workshop__/plain.tsx +0 -28
- package/src/core/primitives/radio/index.ts +0 -1
- package/src/core/primitives/radio/radio.tsx +0 -51
- package/src/core/primitives/radio/styles.ts +0 -117
- package/src/core/primitives/select/__workshop__/index.ts +0 -11
- package/src/core/primitives/select/__workshop__/plain.tsx +0 -27
- package/src/core/primitives/select/__workshop__/readOnly.tsx +0 -23
- package/src/core/primitives/select/index.ts +0 -1
- package/src/core/primitives/select/select.test.tsx +0 -52
- package/src/core/primitives/select/select.tsx +0 -94
- package/src/core/primitives/select/styles.ts +0 -166
- package/src/core/primitives/spinner/__workshop__/Props.tsx +0 -15
- package/src/core/primitives/spinner/__workshop__/index.ts +0 -14
- package/src/core/primitives/spinner/index.ts +0 -1
- package/src/core/primitives/spinner/spinner.tsx +0 -46
- package/src/core/primitives/stack/__workshop__/index.ts +0 -14
- package/src/core/primitives/stack/__workshop__/plain.tsx +0 -32
- package/src/core/primitives/stack/index.ts +0 -1
- package/src/core/primitives/stack/stack.test.tsx +0 -57
- package/src/core/primitives/stack/stack.tsx +0 -57
- package/src/core/primitives/stack/styles.ts +0 -32
- package/src/core/primitives/switch/__workshop__/example.tsx +0 -23
- package/src/core/primitives/switch/__workshop__/index.ts +0 -11
- package/src/core/primitives/switch/__workshop__/props.tsx +0 -21
- package/src/core/primitives/switch/index.ts +0 -1
- package/src/core/primitives/switch/styles.ts +0 -173
- package/src/core/primitives/switch/switch.tsx +0 -68
- package/src/core/primitives/text/__workshop__/colored.tsx +0 -30
- package/src/core/primitives/text/__workshop__/example.tsx +0 -39
- package/src/core/primitives/text/__workshop__/index.ts +0 -24
- package/src/core/primitives/text/__workshop__/opticalAlignment.tsx +0 -48
- package/src/core/primitives/text/index.ts +0 -1
- package/src/core/primitives/text/styles.ts +0 -74
- package/src/core/primitives/text/text.tsx +0 -89
- package/src/core/primitives/textArea/__workshop__/index.ts +0 -14
- package/src/core/primitives/textArea/__workshop__/plain.tsx +0 -50
- package/src/core/primitives/textArea/index.ts +0 -1
- package/src/core/primitives/textArea/textArea.tsx +0 -120
- package/src/core/primitives/textInput/__workshop__/clearButton.tsx +0 -30
- package/src/core/primitives/textInput/__workshop__/customValidity.tsx +0 -17
- package/src/core/primitives/textInput/__workshop__/index.ts +0 -44
- package/src/core/primitives/textInput/__workshop__/plain.tsx +0 -98
- package/src/core/primitives/textInput/__workshop__/readOnly.tsx +0 -9
- package/src/core/primitives/textInput/__workshop__/states.tsx +0 -53
- package/src/core/primitives/textInput/__workshop__/tones.tsx +0 -277
- package/src/core/primitives/textInput/__workshop__/typed.tsx +0 -23
- package/src/core/primitives/textInput/index.ts +0 -1
- package/src/core/primitives/textInput/textInput.test.tsx +0 -48
- package/src/core/primitives/textInput/textInput.tsx +0 -395
- package/src/core/primitives/tooltip/__workshop__/customPortal.tsx +0 -102
- package/src/core/primitives/tooltip/__workshop__/index.ts +0 -29
- package/src/core/primitives/tooltip/__workshop__/overflowingBoundary.tsx +0 -74
- package/src/core/primitives/tooltip/__workshop__/props.tsx +0 -107
- package/src/core/primitives/tooltip/__workshop__/resizableBoundary.tsx +0 -86
- package/src/core/primitives/tooltip/constants.ts +0 -23
- package/src/core/primitives/tooltip/index.ts +0 -2
- package/src/core/primitives/tooltip/tooltip.test.tsx +0 -452
- package/src/core/primitives/tooltip/tooltip.tsx +0 -495
- package/src/core/primitives/tooltip/tooltipCard.tsx +0 -109
- package/src/core/primitives/tooltip/tooltipDelayGroup/index.ts +0 -4
- package/src/core/primitives/tooltip/tooltipDelayGroup/tooltipDelayGroupContext.tsx +0 -11
- package/src/core/primitives/tooltip/tooltipDelayGroup/tooltipDelayGroupProvider.tsx +0 -57
- package/src/core/primitives/tooltip/tooltipDelayGroup/types.ts +0 -10
- package/src/core/primitives/tooltip/tooltipDelayGroup/useTooltipDelayGroup.ts +0 -13
- package/src/core/primitives/types.ts +0 -179
- package/src/core/styles/border/borderStyle.ts +0 -56
- package/src/core/styles/border/index.ts +0 -2
- package/src/core/styles/border/types.ts +0 -10
- package/src/core/styles/box/boxStyle.ts +0 -69
- package/src/core/styles/box/index.ts +0 -2
- package/src/core/styles/box/types.ts +0 -11
- package/src/core/styles/card/_cardColorStyle.ts +0 -108
- package/src/core/styles/card/index.ts +0 -1
- package/src/core/styles/flex/flexItemStyle.ts +0 -27
- package/src/core/styles/flex/flexStyle.ts +0 -70
- package/src/core/styles/flex/index.ts +0 -3
- package/src/core/styles/flex/types.ts +0 -25
- package/src/core/styles/focusRing/index.ts +0 -25
- package/src/core/styles/font/codeFontStyle.ts +0 -13
- package/src/core/styles/font/headingFontStyle.ts +0 -13
- package/src/core/styles/font/index.ts +0 -6
- package/src/core/styles/font/labelFontStyle.ts +0 -13
- package/src/core/styles/font/responsiveFont.ts +0 -103
- package/src/core/styles/font/textAlignStyle.ts +0 -19
- package/src/core/styles/font/textFontStyle.ts +0 -13
- package/src/core/styles/font/types.ts +0 -35
- package/src/core/styles/grid/gridItemStyle.ts +0 -82
- package/src/core/styles/grid/gridStyle.ts +0 -108
- package/src/core/styles/grid/index.ts +0 -3
- package/src/core/styles/grid/types.ts +0 -37
- package/src/core/styles/helpers.ts +0 -72
- package/src/core/styles/index.ts +0 -5
- package/src/core/styles/input/index.ts +0 -2
- package/src/core/styles/input/responsiveInputPaddingStyle.ts +0 -78
- package/src/core/styles/input/textInputStyle.ts +0 -263
- package/src/core/styles/internal.ts +0 -12
- package/src/core/styles/margin/index.ts +0 -2
- package/src/core/styles/margin/marginStyle.ts +0 -21
- package/src/core/styles/margin/marginsStyle.test.ts +0 -33
- package/src/core/styles/margin/types.ts +0 -9
- package/src/core/styles/padding/index.ts +0 -2
- package/src/core/styles/padding/paddingStyle.test.ts +0 -33
- package/src/core/styles/padding/paddingStyle.ts +0 -21
- package/src/core/styles/padding/types.ts +0 -12
- package/src/core/styles/radius/index.ts +0 -2
- package/src/core/styles/radius/radiusStyle.ts +0 -23
- package/src/core/styles/radius/types.ts +0 -8
- package/src/core/styles/shadow/index.ts +0 -2
- package/src/core/styles/shadow/shadowStyle.ts +0 -29
- package/src/core/styles/shadow/types.ts +0 -6
- package/src/core/styles/types.ts +0 -8
- package/src/core/theme/__workshop__/build/Root.tsx +0 -367
- package/src/core/theme/__workshop__/build/helpers.ts +0 -46
- package/src/core/theme/__workshop__/build/story.tsx +0 -465
- package/src/core/theme/__workshop__/canvas.tsx +0 -352
- package/src/core/theme/__workshop__/color.tsx +0 -62
- package/src/core/theme/__workshop__/debug/story.tsx +0 -408
- package/src/core/theme/__workshop__/index.ts +0 -39
- package/src/core/theme/__workshop__/layer.tsx +0 -78
- package/src/core/theme/__workshop__/nestedProvider.tsx +0 -15
- package/src/core/theme/index.ts +0 -5
- package/src/core/theme/theme.test.tsx +0 -73
- package/src/core/theme/themeColorProvider.tsx +0 -29
- package/src/core/theme/themeContext.ts +0 -10
- package/src/core/theme/themeProvider.tsx +0 -62
- package/src/core/theme/types.ts +0 -12
- package/src/core/theme/useRootTheme.ts +0 -17
- package/src/core/theme/useTheme.ts +0 -16
- package/src/core/types/avatar.ts +0 -14
- package/src/core/types/badge.ts +0 -12
- package/src/core/types/box.ts +0 -19
- package/src/core/types/button.ts +0 -21
- package/src/core/types/card.ts +0 -6
- package/src/core/types/component.ts +0 -32
- package/src/core/types/dialog.ts +0 -4
- package/src/core/types/flex.ts +0 -30
- package/src/core/types/grid.ts +0 -14
- package/src/core/types/gridItem.ts +0 -29
- package/src/core/types/index.ts +0 -15
- package/src/core/types/placement.ts +0 -18
- package/src/core/types/popover.ts +0 -4
- package/src/core/types/radius.ts +0 -4
- package/src/core/types/selectable.ts +0 -6
- package/src/core/types/text.ts +0 -4
- package/src/core/utils/arrow/arrow.tsx +0 -123
- package/src/core/utils/arrow/cmds.ts +0 -91
- package/src/core/utils/arrow/index.ts +0 -1
- package/src/core/utils/boundaryElement/__workshop__/index.ts +0 -14
- package/src/core/utils/boundaryElement/__workshop__/plain.tsx +0 -19
- package/src/core/utils/boundaryElement/boundaryElement.test.tsx +0 -100
- package/src/core/utils/boundaryElement/boundaryElementContext.ts +0 -7
- package/src/core/utils/boundaryElement/boundaryElementProvider.tsx +0 -24
- package/src/core/utils/boundaryElement/index.ts +0 -3
- package/src/core/utils/boundaryElement/types.ts +0 -7
- package/src/core/utils/boundaryElement/useBoundaryElement.ts +0 -26
- package/src/core/utils/conditionalWrapper/conditionalWrapper.tsx +0 -21
- package/src/core/utils/conditionalWrapper/index.ts +0 -1
- package/src/core/utils/elementQuery/__workshop__/customMedia.tsx +0 -30
- package/src/core/utils/elementQuery/__workshop__/index.ts +0 -14
- package/src/core/utils/elementQuery/elementQuery.tsx +0 -53
- package/src/core/utils/elementQuery/helpers.ts +0 -27
- package/src/core/utils/elementQuery/index.ts +0 -1
- package/src/core/utils/errorBoundary.tsx +0 -48
- package/src/core/utils/getElementRef.ts +0 -26
- package/src/core/utils/index.ts +0 -9
- package/src/core/utils/layer/__workshop__/_debug.tsx +0 -17
- package/src/core/utils/layer/__workshop__/index.ts +0 -24
- package/src/core/utils/layer/__workshop__/multipleRoots.tsx +0 -49
- package/src/core/utils/layer/__workshop__/nested.tsx +0 -98
- package/src/core/utils/layer/__workshop__/responsiveZOffset.tsx +0 -13
- package/src/core/utils/layer/getLayerContext.test.ts +0 -30
- package/src/core/utils/layer/getLayerContext.ts +0 -21
- package/src/core/utils/layer/index.ts +0 -4
- package/src/core/utils/layer/layer.test.tsx +0 -108
- package/src/core/utils/layer/layer.tsx +0 -98
- package/src/core/utils/layer/layerContext.ts +0 -7
- package/src/core/utils/layer/layerProvider.tsx +0 -111
- package/src/core/utils/layer/types.ts +0 -9
- package/src/core/utils/layer/useLayer.ts +0 -26
- package/src/core/utils/portal/__workshop__/index.ts +0 -14
- package/src/core/utils/portal/__workshop__/named.tsx +0 -63
- package/src/core/utils/portal/index.ts +0 -4
- package/src/core/utils/portal/portal.test.tsx +0 -103
- package/src/core/utils/portal/portal.ts +0 -32
- package/src/core/utils/portal/portalContext.ts +0 -31
- package/src/core/utils/portal/portalProvider.tsx +0 -47
- package/src/core/utils/portal/types.ts +0 -9
- package/src/core/utils/portal/usePortal.ts +0 -25
- package/src/core/utils/spanWithTextOverflow.tsx +0 -10
- package/src/core/utils/srOnly/index.ts +0 -1
- package/src/core/utils/srOnly/srOnly.tsx +0 -36
- package/src/core/utils/virtualList/__workshop__/changingProps.tsx +0 -36
- package/src/core/utils/virtualList/__workshop__/elementScroll.tsx +0 -24
- package/src/core/utils/virtualList/__workshop__/index.ts +0 -29
- package/src/core/utils/virtualList/__workshop__/infiniteList.tsx +0 -48
- package/src/core/utils/virtualList/__workshop__/windowScrolll.tsx +0 -22
- package/src/core/utils/virtualList/index.ts +0 -1
- package/src/core/utils/virtualList/virtualList.tsx +0 -200
- package/src/theme/build/_deprecated/color/_selectable/createSelectableTones.ts +0 -76
- package/src/theme/build/_deprecated/color/_solid/createSolidTones.ts +0 -54
- package/src/theme/build/_deprecated/color/button/createButtonModes.ts +0 -22
- package/src/theme/build/_deprecated/color/button/createButtonTones.ts +0 -55
- package/src/theme/build/_deprecated/color/card/createCardStates.ts +0 -60
- package/src/theme/build/_deprecated/color/color.test.ts +0 -63
- package/src/theme/build/_deprecated/color/defaults.ts +0 -390
- package/src/theme/build/_deprecated/color/factory.ts +0 -142
- package/src/theme/build/_deprecated/color/index.ts +0 -1
- package/src/theme/build/_deprecated/color/input/createInputModes.ts +0 -81
- package/src/theme/build/_deprecated/color/muted/createMuted.ts +0 -54
- package/src/theme/build/_deprecated/color/spot/createSpot.ts +0 -20
- package/src/theme/build/buildColorTheme.test.ts +0 -183
- package/src/theme/build/buildColorTheme.ts +0 -499
- package/src/theme/build/buildTheme.test.ts +0 -87
- package/src/theme/build/buildTheme.ts +0 -36
- package/src/theme/build/colorToken/colorToken.ts +0 -19
- package/src/theme/build/colorToken/compileColorToken.ts +0 -21
- package/src/theme/build/colorToken/index.ts +0 -2
- package/src/theme/build/colorToken/types.ts +0 -6
- package/src/theme/build/index.ts +0 -3
- package/src/theme/build/lib/color-fns/blend/index.ts +0 -3
- package/src/theme/build/lib/color-fns/blend/mix.ts +0 -21
- package/src/theme/build/lib/color-fns/blend/multiply.ts +0 -18
- package/src/theme/build/lib/color-fns/blend/screen.ts +0 -18
- package/src/theme/build/lib/color-fns/color-fns.test.ts +0 -68
- package/src/theme/build/lib/color-fns/contrastRatio.ts +0 -31
- package/src/theme/build/lib/color-fns/convert.ts +0 -150
- package/src/theme/build/lib/color-fns/index.ts +0 -6
- package/src/theme/build/lib/color-fns/parse.ts +0 -60
- package/src/theme/build/lib/color-fns/rgba.ts +0 -10
- package/src/theme/build/lib/color-fns/types.ts +0 -28
- package/src/theme/build/lib/isRecord.ts +0 -3
- package/src/theme/build/lib/lazy.ts +0 -30
- package/src/theme/build/lib/utils.ts +0 -19
- package/src/theme/build/merge.ts +0 -26
- package/src/theme/build/mixThemeColor.test.ts +0 -21
- package/src/theme/build/mixThemeColor.ts +0 -53
- package/src/theme/build/renderColorTheme.ts +0 -532
- package/src/theme/build/renderColorValue.ts +0 -85
- package/src/theme/build/resolveColorTokens.ts +0 -268
- package/src/theme/build/theme.test.ts +0 -27
- package/src/theme/config/helpers.ts +0 -55
- package/src/theme/config/index.ts +0 -4
- package/src/theme/config/system.ts +0 -115
- package/src/theme/config/tokens/color/index.ts +0 -1
- package/src/theme/config/tokens/color/types.ts +0 -133
- package/src/theme/config/tokens/index.ts +0 -4
- package/src/theme/config/tokens/parseTokenKey.test.ts +0 -64
- package/src/theme/config/tokens/parseTokenKey.ts +0 -67
- package/src/theme/config/tokens/parseTokenValue.test.ts +0 -42
- package/src/theme/config/tokens/parseTokenValue.ts +0 -133
- package/src/theme/config/tokens/types.ts +0 -53
- package/src/theme/config/types.ts +0 -46
- package/src/theme/defaults/colorPalette.ts +0 -5
- package/src/theme/defaults/colorTokens.ts +0 -648
- package/src/theme/defaults/config.ts +0 -84
- package/src/theme/defaults/fonts.ts +0 -227
- package/src/theme/getScopedTheme.ts +0 -98
- package/src/theme/index.ts +0 -5
- package/src/theme/system/avatar.ts +0 -14
- package/src/theme/system/color/_constants.ts +0 -45
- package/src/theme/system/color/_helpers.ts +0 -24
- package/src/theme/system/color/_system.ts +0 -40
- package/src/theme/system/color/avatar.ts +0 -15
- package/src/theme/system/color/badge.ts +0 -16
- package/src/theme/system/color/button.ts +0 -17
- package/src/theme/system/color/color.ts +0 -34
- package/src/theme/system/color/index.ts +0 -13
- package/src/theme/system/color/input.ts +0 -25
- package/src/theme/system/color/kbd.ts +0 -8
- package/src/theme/system/color/selectable.ts +0 -12
- package/src/theme/system/color/shadow.ts +0 -7
- package/src/theme/system/color/state.ts +0 -43
- package/src/theme/system/color/syntax.ts +0 -41
- package/src/theme/system/css.ts +0 -14
- package/src/theme/system/focusRing.ts +0 -7
- package/src/theme/system/font.ts +0 -52
- package/src/theme/system/index.ts +0 -11
- package/src/theme/system/input.ts +0 -33
- package/src/theme/system/layer.ts +0 -8
- package/src/theme/system/shadow.ts +0 -19
- package/src/theme/system/styles.ts +0 -13
- package/src/theme/system/theme.ts +0 -138
- package/src/theme/system/v0/avatar.ts +0 -10
- package/src/theme/system/v0/color/_generic.ts +0 -35
- package/src/theme/system/v0/color/_system.ts +0 -17
- package/src/theme/system/v0/color/base.ts +0 -21
- package/src/theme/system/v0/color/button.ts +0 -42
- package/src/theme/system/v0/color/card.ts +0 -19
- package/src/theme/system/v0/color/color.ts +0 -40
- package/src/theme/system/v0/color/index.ts +0 -11
- package/src/theme/system/v0/color/input.ts +0 -34
- package/src/theme/system/v0/color/muted.ts +0 -26
- package/src/theme/system/v0/color/selectable.ts +0 -31
- package/src/theme/system/v0/color/solid.ts +0 -26
- package/src/theme/system/v0/color/spot.ts +0 -13
- package/src/theme/system/v0/index.ts +0 -3
- package/src/theme/system/v0/input.ts +0 -23
- package/src/theme/versioning/getTheme_v2.ts +0 -57
- package/src/theme/versioning/index.ts +0 -5
- package/src/theme/versioning/is_v0.ts +0 -6
- package/src/theme/versioning/is_v2.ts +0 -6
- package/src/theme/versioning/themeColor_v0_v2.ts +0 -243
- package/src/theme/versioning/themeColor_v2_v2_9.ts +0 -49
- package/src/theme/versioning/v0_v2.ts +0 -94
- package/src/theme/versioning/v2_v0.ts +0 -135
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The component lookup a rich-text body's embedded component card reads (V2 instance-card.tsx), declared as an
|
|
3
|
+
* augmentation of KitServices. The host answers from its own components library:
|
|
4
|
+
*
|
|
5
|
+
* the dock → the project's components (GET /components) and its usage map (GET /projects/:id/component-usage)
|
|
6
|
+
* the sandbox → V2's demo component library (/style-guide/kit fixtures)
|
|
7
|
+
*
|
|
8
|
+
* Absent → the card stays the compact "Linked component" row: no state, no count, no preview is ever made up.
|
|
9
|
+
*/
|
|
10
|
+
import type { RichTextAt } from "./rich-text/codec";
|
|
11
|
+
export interface KitComponentField {
|
|
12
|
+
key: string;
|
|
13
|
+
label: string;
|
|
14
|
+
/** the component's own value for it (its default), before this place's overrides */
|
|
15
|
+
value?: unknown;
|
|
16
|
+
}
|
|
17
|
+
export interface KitComponentInfo {
|
|
18
|
+
/** the component's current name */
|
|
19
|
+
name: string;
|
|
20
|
+
/** true: the library has no component with this id (it was deleted) */
|
|
21
|
+
missing?: boolean;
|
|
22
|
+
/** how many places link to it; absent → not measured, and the card says "Shared" without a number */
|
|
23
|
+
places?: number;
|
|
24
|
+
/** its content fields in order; an override counts as "Edited here" only when its key is one of these */
|
|
25
|
+
fields?: KitComponentField[];
|
|
26
|
+
/** a picture of the component as readers see it (the host's snapshot of it) */
|
|
27
|
+
image?: string | null;
|
|
28
|
+
/**
|
|
29
|
+
* the version readers see now (the component's last publish); a separate copy taken from an older one shows
|
|
30
|
+
* "Shared version changed". Absent → not known, and no copy is ever called out of date.
|
|
31
|
+
*/
|
|
32
|
+
publishedAt?: string | null;
|
|
33
|
+
}
|
|
34
|
+
/** A separate copy of a component (V2 instances.ts `detach`): what this place keeps when it stops following it. */
|
|
35
|
+
export interface KitComponentCopy {
|
|
36
|
+
/** the values readers see, now this place's own (V2 `props`) */
|
|
37
|
+
props: Record<string, unknown>;
|
|
38
|
+
/** whatever the host stores beside them to draw the copy (production: the frozen block tree, as JSON) */
|
|
39
|
+
blocks?: string;
|
|
40
|
+
/** the version of the component it was taken from */
|
|
41
|
+
sourcePublishedAt?: string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* The component drawn live in its card (V2 instance card), with THIS place's values: a linked place's defaults with its
|
|
45
|
+
* overrides, a separate copy's own values. Read-only, the card's width. `fallback(reason)` is what the card shows when
|
|
46
|
+
* the host cannot draw it (not validated, no runtime here, an error), with the reason in words.
|
|
47
|
+
*/
|
|
48
|
+
export interface KitComponentPreviewProps {
|
|
49
|
+
componentId: string;
|
|
50
|
+
title: string;
|
|
51
|
+
props: Record<string, unknown>;
|
|
52
|
+
fallback: (reason: string) => import("react").ReactNode;
|
|
53
|
+
}
|
|
54
|
+
/** A component a rich-text body can embed (the "/" menu's More components). */
|
|
55
|
+
export interface KitInsertableComponent {
|
|
56
|
+
id: string;
|
|
57
|
+
name: string;
|
|
58
|
+
description?: string;
|
|
59
|
+
}
|
|
60
|
+
declare module "../context" {
|
|
61
|
+
interface KitServices {
|
|
62
|
+
/**
|
|
63
|
+
* A React HOOK (called on every render of a component card, so the host passes one function for the life of the
|
|
64
|
+
* form): what the library knows about the component an embedded instance links to. `info` undefined while it
|
|
65
|
+
* loads; `error` is a whole sentence ("Components couldn't be loaded: …").
|
|
66
|
+
*/
|
|
67
|
+
useComponentInfo?: (ref: string) => {
|
|
68
|
+
info?: KitComponentInfo;
|
|
69
|
+
loading?: boolean;
|
|
70
|
+
error?: string;
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Make this place a separate copy (V2 "Keep as a separate copy" / "Make a separate copy"): what readers see now,
|
|
74
|
+
* with this place's overrides. Rejects with a whole sentence the card shows ("“Card” has never been published…").
|
|
75
|
+
* Absent → the card offers no separate copy.
|
|
76
|
+
*/
|
|
77
|
+
copyComponent?: (ref: string, input: {
|
|
78
|
+
overrides: Record<string, unknown>;
|
|
79
|
+
variant?: string;
|
|
80
|
+
}) => Promise<KitComponentCopy>;
|
|
81
|
+
/**
|
|
82
|
+
* A React HOOK (one identity for the life of the form): the components the rich-text field at `at` may embed,
|
|
83
|
+
* already narrowed to the ones its config accepts. `error` is a whole sentence. Absent → the "/" menu offers no
|
|
84
|
+
* components.
|
|
85
|
+
*/
|
|
86
|
+
useInsertableComponents?: (at: RichTextAt) => {
|
|
87
|
+
components: KitInsertableComponent[];
|
|
88
|
+
loading?: boolean;
|
|
89
|
+
error?: string;
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* The host's own undo history (the dock: the Visual Editor's toolbar Undo). Runs `write` (synchronously) as ONE
|
|
93
|
+
* step of it and answers that step (KitHistoryStep). Null: the host recorded no step (it keeps no history here),
|
|
94
|
+
* so the editor's own history takes the step.
|
|
95
|
+
*/
|
|
96
|
+
historyStep?: (write: () => void) => KitHistoryStep | null;
|
|
97
|
+
/**
|
|
98
|
+
* Draws an embedded component live in its card (KitComponentPreviewProps). Mounted only once the card is on screen.
|
|
99
|
+
* Absent → the card shows the host's snapshot where the place shows exactly the component, else its values.
|
|
100
|
+
*/
|
|
101
|
+
ComponentPreview?: import("react").ComponentType<KitComponentPreviewProps>;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* One step of the host's history (KitServices.historyStep). The host's toolbar can undo and redo it too, so `next`
|
|
106
|
+
* says where it stands NOW: the host's next undo, its next redo, or neither (other changes come first, or it is gone).
|
|
107
|
+
* `undo` / `redo` answer true or the sentence saying why nothing changed.
|
|
108
|
+
*/
|
|
109
|
+
export interface KitHistoryStep {
|
|
110
|
+
undo: () => true | string;
|
|
111
|
+
redo: () => true | string;
|
|
112
|
+
next: () => "undo" | "redo" | null;
|
|
113
|
+
}
|
|
114
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CONTROLS } from "../engine/kit-field.js";
|
|
2
|
+
import { DateControl } from "./date.js";
|
|
3
|
+
//#region src/kit/controls/date-register.ts
|
|
4
|
+
/** Lane C3: date and datetime in the engine's dispatch table (one line per type; merge with other lanes by line). */
|
|
5
|
+
CONTROLS.date = DateControl;
|
|
6
|
+
CONTROLS.datetime = DateControl;
|
|
7
|
+
//#endregion
|
|
8
|
+
|
|
9
|
+
//# sourceMappingURL=date-register.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-register.js","names":[],"sources":["../../src/kit/controls/date-register.ts"],"sourcesContent":["/** Lane C3: date and datetime in the engine's dispatch table (one line per type; merge with other lanes by line). */\nimport { CONTROLS } from \"../engine/kit-field\";\nimport { DateControl } from \"./date\";\n\nCONTROLS.date = DateControl;\nCONTROLS.datetime = DateControl;\n"],"mappings":";;;;AAIA,SAAS,OAAO;AAChB,SAAS,WAAW"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import type { FieldSchema } from "../schema/types";
|
|
2
|
+
declare module "../context" {
|
|
3
|
+
interface KitServices {
|
|
4
|
+
/**
|
|
5
|
+
* The site's IANA zone (Project.localeConfig.timeZone, Settings › General): where a new date/time value starts and
|
|
6
|
+
* what timezone "site" locks to. The dock passes `useSiteTimeZone().zone` when its source is "site". Absent or not
|
|
7
|
+
* a zone → the viewer's browser zone, which the picker names "Your time zone".
|
|
8
|
+
*/
|
|
9
|
+
siteTimeZone?: string;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export type ZoneSource = "site" | "browser";
|
|
13
|
+
export declare function validZone(z: unknown): z is string;
|
|
14
|
+
export declare const modernZone: (z: string) => string;
|
|
15
|
+
export declare function browserZone(): string;
|
|
16
|
+
/** The zone a new value starts in: the site's, else the browser's. `source` names which one. */
|
|
17
|
+
export declare function useDefaultZone(): {
|
|
18
|
+
zone: string;
|
|
19
|
+
source: ZoneSource;
|
|
20
|
+
};
|
|
21
|
+
export type ZoneMode = "pick" | "site" | "fixed" | "none";
|
|
22
|
+
/**
|
|
23
|
+
* What the schema allows. A `date` never carries a zone here: prod stores a date as "YYYY-MM-DD" and refuses a time on
|
|
24
|
+
* a date field without includeTime, so a zoned date (V2 allowed one) would be refused at save.
|
|
25
|
+
*/
|
|
26
|
+
export declare function zonePolicy(field: Pick<FieldSchema, "type" | "timezone">): {
|
|
27
|
+
mode: ZoneMode;
|
|
28
|
+
zone?: string;
|
|
29
|
+
};
|
|
30
|
+
/** The zone's UTC offset in minutes at an instant (+330 for Kolkata). */
|
|
31
|
+
export declare function offsetMinutes(zone: string, at: Date): number;
|
|
32
|
+
/** +330 → "+05:30"; 0 → "+00:00". */
|
|
33
|
+
export declare const offsetIso: (min: number) => string;
|
|
34
|
+
/** "GMT+5:30", "GMT−7", "GMT" — the short form people read (with a true minus sign). */
|
|
35
|
+
export declare function zoneShortOffset(zone: string, at?: Date): string;
|
|
36
|
+
export declare const zoneCity: (z: string) => string;
|
|
37
|
+
/** "GMT+5:30 · Kolkata" */
|
|
38
|
+
export declare const zoneLabel: (zone: string, at?: Date) => string;
|
|
39
|
+
export interface Wall {
|
|
40
|
+
/** "YYYY-MM-DD" */
|
|
41
|
+
ymd: string;
|
|
42
|
+
/** "HH:mm" */
|
|
43
|
+
time: string;
|
|
44
|
+
}
|
|
45
|
+
/** The wall clock an instant shows in a zone. */
|
|
46
|
+
export declare function instantToWall(instant: Date, zone: string): Wall;
|
|
47
|
+
/**
|
|
48
|
+
* The offset of a wall time in a zone, or null when a clock change skips that wall time (it names no instant there).
|
|
49
|
+
* Two passes: the offset at the naive instant, then at the instant that offset gives.
|
|
50
|
+
*/
|
|
51
|
+
export declare function wallOffset(zone: string, wall: Wall): number | null;
|
|
52
|
+
/** The instant a wall time names in a zone (the earlier one when a clock change skips it). */
|
|
53
|
+
export declare const wallInstant: (zone: string, wall: Wall) => Date;
|
|
54
|
+
export interface ParsedValue {
|
|
55
|
+
/** the day as stored (wall clock), or null when empty */
|
|
56
|
+
wall: Wall | null;
|
|
57
|
+
hasTime: boolean;
|
|
58
|
+
/** the stated offset in minutes ("Z" → 0); undefined for a floating time */
|
|
59
|
+
offset?: number;
|
|
60
|
+
/** an RFC 9557 [Zone] suffix, when valid */
|
|
61
|
+
zone?: string;
|
|
62
|
+
/** false: a value this control cannot read (an object, a word); it is shown and never overwritten by accident */
|
|
63
|
+
readable: boolean;
|
|
64
|
+
}
|
|
65
|
+
export declare function parseStored(v: unknown): ParsedValue;
|
|
66
|
+
/** A stored value as a JS Date (drops the [Zone] annotation, which `new Date()` can't read). */
|
|
67
|
+
export declare function storedToDate(v: unknown): Date | null;
|
|
68
|
+
/** Every IANA zone this runtime knows, UTC included. */
|
|
69
|
+
export declare const ALL_ZONES: readonly string[];
|
|
70
|
+
/** The first zone (in order) whose offset at the instant is `offset`; undefined when none is. */
|
|
71
|
+
export declare function zoneWithOffset(offset: number, instant: Date, candidates: readonly (string | undefined)[]): string | undefined;
|
|
72
|
+
/**
|
|
73
|
+
* What the control shows for a stored value: the wall time and the zone it lives in.
|
|
74
|
+
*
|
|
75
|
+
* - none: the stored wall time, as typed.
|
|
76
|
+
* - site / fixed: that zone. A stored instant with another offset is shown as THAT instant's wall time in the zone,
|
|
77
|
+
* so the shown and the saved time never disagree.
|
|
78
|
+
* - pick: the stored [Zone]; else the zone the editor picked this session, the default, the browser's, then any
|
|
79
|
+
* zone whose offset matches the stored one (a "+05:30" reads back as Kolkata). A floating time reads in the default.
|
|
80
|
+
*/
|
|
81
|
+
export declare function resolveShown(parsed: ParsedValue, mode: ZoneMode, zones: {
|
|
82
|
+
fixed?: string;
|
|
83
|
+
def: string;
|
|
84
|
+
picked?: string;
|
|
85
|
+
}): {
|
|
86
|
+
wall: Wall | null;
|
|
87
|
+
zone: string;
|
|
88
|
+
};
|
|
89
|
+
export type WriteResult = {
|
|
90
|
+
ok: true;
|
|
91
|
+
value: string;
|
|
92
|
+
} | {
|
|
93
|
+
ok: false;
|
|
94
|
+
reason: string;
|
|
95
|
+
};
|
|
96
|
+
/** The stored string for a wall time under the field's policy (file header). */
|
|
97
|
+
export declare function writeValue(o: {
|
|
98
|
+
withTime: boolean;
|
|
99
|
+
mode: ZoneMode;
|
|
100
|
+
wall: Wall;
|
|
101
|
+
zone: string;
|
|
102
|
+
}): WriteResult;
|
|
103
|
+
/** Today in a zone (the browser's local day for a floating field). */
|
|
104
|
+
export declare function todayIn(zone: string | undefined, now?: Date): string;
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
import { useKitServices } from "../context.js";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
//#region src/kit/controls/date-zone.ts
|
|
4
|
+
/**
|
|
5
|
+
* DATE / DATETIME values and time zones (DESIGN 6.4, D43), ported from V2 controls/date.tsx and fitted to what the
|
|
6
|
+
* backend and the value adapters keep (adapters/values.ts datetimeToProd / datetimeFromProd, backend
|
|
7
|
+
* parseDateField / parseDatetimeField).
|
|
8
|
+
*
|
|
9
|
+
* What the control writes, per field (`zonePolicy`):
|
|
10
|
+
*
|
|
11
|
+
* date (any timezone) "2026-10-14" a prod `date` without includeTime refuses a "T"
|
|
12
|
+
* datetime, timezone false "2026-10-14T09:00:00" floating wall time
|
|
13
|
+
* datetime, true / unset "2026-10-14T09:00:00+05:30" the zone the editor picked lives in the offset:
|
|
14
|
+
* datetime, "site" "2026-10-14T09:00:00-07:00" prod keeps no [Zone] (the adapter names a kept
|
|
15
|
+
* one as lost and the dock refuses the write)
|
|
16
|
+
* datetime, "fixed:<IANA>" "2026-10-14T09:00:00-04:00[America/New_York]" the adapter checks the zone against
|
|
17
|
+
* config.timezone, stores the instant, and
|
|
18
|
+
* reads it back with the same [Zone]
|
|
19
|
+
*
|
|
20
|
+
* Seconds are always written (prod refuses a seconds-less datetime; the adapter names it "format"). The offset is the
|
|
21
|
+
* zone's offset AT the wall time the author typed (two passes, so it is right on both sides of a clock change), and a
|
|
22
|
+
* wall time that a clock change skips is refused with a named reason, never shifted silently.
|
|
23
|
+
*/
|
|
24
|
+
function validZone(z) {
|
|
25
|
+
if (typeof z !== "string" || !z) return false;
|
|
26
|
+
try {
|
|
27
|
+
new Intl.DateTimeFormat("en-US", { timeZone: z });
|
|
28
|
+
return true;
|
|
29
|
+
} catch {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/** ICU still lists some zones under their old names; people read the current ones (Kolkata, not Calcutta). */
|
|
34
|
+
var MODERN = {
|
|
35
|
+
"Asia/Calcutta": "Asia/Kolkata",
|
|
36
|
+
"Asia/Katmandu": "Asia/Kathmandu",
|
|
37
|
+
"Asia/Saigon": "Asia/Ho_Chi_Minh",
|
|
38
|
+
"Asia/Rangoon": "Asia/Yangon",
|
|
39
|
+
"Europe/Kiev": "Europe/Kyiv",
|
|
40
|
+
"America/Godthab": "America/Nuuk",
|
|
41
|
+
"Atlantic/Faeroe": "Atlantic/Faroe",
|
|
42
|
+
"America/Buenos_Aires": "America/Argentina/Buenos_Aires"
|
|
43
|
+
};
|
|
44
|
+
var modernZone = (z) => MODERN[z] && validZone(MODERN[z]) ? MODERN[z] : z;
|
|
45
|
+
function browserZone() {
|
|
46
|
+
try {
|
|
47
|
+
return modernZone(Intl.DateTimeFormat().resolvedOptions().timeZone || "UTC");
|
|
48
|
+
} catch {
|
|
49
|
+
return "UTC";
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/** The zone a new value starts in: the site's, else the browser's. `source` names which one. */
|
|
53
|
+
function useDefaultZone() {
|
|
54
|
+
const site = useKitServices().siteTimeZone;
|
|
55
|
+
return React.useMemo(() => validZone(site) ? {
|
|
56
|
+
zone: site,
|
|
57
|
+
source: "site"
|
|
58
|
+
} : {
|
|
59
|
+
zone: browserZone(),
|
|
60
|
+
source: "browser"
|
|
61
|
+
}, [site]);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* What the schema allows. A `date` never carries a zone here: prod stores a date as "YYYY-MM-DD" and refuses a time on
|
|
65
|
+
* a date field without includeTime, so a zoned date (V2 allowed one) would be refused at save.
|
|
66
|
+
*/
|
|
67
|
+
function zonePolicy(field) {
|
|
68
|
+
if (field.type !== "datetime") return { mode: "none" };
|
|
69
|
+
const t = field.timezone ?? true;
|
|
70
|
+
if (t === false) return { mode: "none" };
|
|
71
|
+
if (t === "site") return { mode: "site" };
|
|
72
|
+
if (typeof t === "string" && t.startsWith("fixed:")) {
|
|
73
|
+
const z = t.slice(6);
|
|
74
|
+
return validZone(z) ? {
|
|
75
|
+
mode: "fixed",
|
|
76
|
+
zone: z
|
|
77
|
+
} : { mode: "site" };
|
|
78
|
+
}
|
|
79
|
+
return { mode: "pick" };
|
|
80
|
+
}
|
|
81
|
+
var pad = (n) => String(Math.abs(Math.trunc(n))).padStart(2, "0");
|
|
82
|
+
/** The zone's UTC offset in minutes at an instant (+330 for Kolkata). */
|
|
83
|
+
function offsetMinutes(zone, at) {
|
|
84
|
+
try {
|
|
85
|
+
const name = new Intl.DateTimeFormat("en-US", {
|
|
86
|
+
timeZone: zone,
|
|
87
|
+
timeZoneName: "longOffset"
|
|
88
|
+
}).formatToParts(at).find((p) => p.type === "timeZoneName")?.value ?? "GMT";
|
|
89
|
+
const m = /GMT([+\-−])(\d{1,2})(?::?(\d{2}))?/.exec(name);
|
|
90
|
+
if (!m) return 0;
|
|
91
|
+
return (m[1] === "+" ? 1 : -1) * (Number(m[2]) * 60 + Number(m[3] ?? 0));
|
|
92
|
+
} catch {
|
|
93
|
+
return 0;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
/** +330 → "+05:30"; 0 → "+00:00". */
|
|
97
|
+
var offsetIso = (min) => `${min < 0 ? "-" : "+"}${pad(Math.floor(Math.abs(min) / 60))}:${pad(Math.abs(min) % 60)}`;
|
|
98
|
+
/** "GMT+5:30", "GMT−7", "GMT" — the short form people read (with a true minus sign). */
|
|
99
|
+
function zoneShortOffset(zone, at = /* @__PURE__ */ new Date()) {
|
|
100
|
+
const min = offsetMinutes(zone, at);
|
|
101
|
+
if (min === 0) return "GMT";
|
|
102
|
+
const h = Math.floor(Math.abs(min) / 60);
|
|
103
|
+
const m = Math.abs(min) % 60;
|
|
104
|
+
return `GMT${min < 0 ? "−" : "+"}${h}${m ? `:${pad(m)}` : ""}`;
|
|
105
|
+
}
|
|
106
|
+
var zoneCity = (z) => z === "UTC" || z === "Etc/UTC" ? "UTC" : (z.split("/").pop() ?? z).replace(/_/g, " ");
|
|
107
|
+
/** "GMT+5:30 · Kolkata" */
|
|
108
|
+
var zoneLabel = (zone, at) => `${zoneShortOffset(zone, at)} · ${zoneCity(zone)}`;
|
|
109
|
+
var ymdParts = (ymd) => ymd.split("-").map(Number);
|
|
110
|
+
var hmParts = (time) => time.split(":").map(Number);
|
|
111
|
+
var wallUtc = ({ ymd, time }) => {
|
|
112
|
+
const [y, mo, d] = ymdParts(ymd);
|
|
113
|
+
const [h, mi] = hmParts(time);
|
|
114
|
+
return Date.UTC(y, mo - 1, d, h, mi);
|
|
115
|
+
};
|
|
116
|
+
/** The wall clock an instant shows in a zone. */
|
|
117
|
+
function instantToWall(instant, zone) {
|
|
118
|
+
const parts = new Intl.DateTimeFormat("en-CA", {
|
|
119
|
+
timeZone: zone,
|
|
120
|
+
year: "numeric",
|
|
121
|
+
month: "2-digit",
|
|
122
|
+
day: "2-digit",
|
|
123
|
+
hour: "2-digit",
|
|
124
|
+
minute: "2-digit",
|
|
125
|
+
hourCycle: "h23"
|
|
126
|
+
}).formatToParts(instant);
|
|
127
|
+
const get = (t) => parts.find((p) => p.type === t)?.value ?? "00";
|
|
128
|
+
return {
|
|
129
|
+
ymd: `${get("year")}-${get("month")}-${get("day")}`,
|
|
130
|
+
time: `${get("hour")}:${get("minute")}`
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* The offset of a wall time in a zone, or null when a clock change skips that wall time (it names no instant there).
|
|
135
|
+
* Two passes: the offset at the naive instant, then at the instant that offset gives.
|
|
136
|
+
*/
|
|
137
|
+
function wallOffset(zone, wall) {
|
|
138
|
+
const naive = wallUtc(wall);
|
|
139
|
+
const first = offsetMinutes(zone, new Date(naive));
|
|
140
|
+
const second = offsetMinutes(zone, /* @__PURE__ */ new Date(naive - first * 6e4));
|
|
141
|
+
for (const off of second === first ? [first] : [second, first]) {
|
|
142
|
+
const back = instantToWall(/* @__PURE__ */ new Date(naive - off * 6e4), zone);
|
|
143
|
+
if (back.ymd === wall.ymd && back.time === wall.time) return off;
|
|
144
|
+
}
|
|
145
|
+
return null;
|
|
146
|
+
}
|
|
147
|
+
/** The instant a wall time names in a zone (the earlier one when a clock change skips it). */
|
|
148
|
+
var wallInstant = (zone, wall) => /* @__PURE__ */ new Date(wallUtc(wall) - (wallOffset(zone, wall) ?? offsetMinutes(zone, new Date(wallUtc(wall)))) * 6e4);
|
|
149
|
+
var STORED = /^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::\d{2}(?:\.\d+)?)?(Z|[+-]\d{2}:?\d{2})?)?(?:\[([^\]]+)\])?$/;
|
|
150
|
+
var EMPTY = {
|
|
151
|
+
wall: null,
|
|
152
|
+
hasTime: false,
|
|
153
|
+
readable: true
|
|
154
|
+
};
|
|
155
|
+
function parseStored(v) {
|
|
156
|
+
if (v == null || v === "") return EMPTY;
|
|
157
|
+
if (typeof v !== "string") return {
|
|
158
|
+
...EMPTY,
|
|
159
|
+
readable: false
|
|
160
|
+
};
|
|
161
|
+
const m = STORED.exec(v.trim());
|
|
162
|
+
if (!m) return {
|
|
163
|
+
...EMPTY,
|
|
164
|
+
readable: false
|
|
165
|
+
};
|
|
166
|
+
const [, y, mo, d, h, mi, off, zone] = m;
|
|
167
|
+
const date = new Date(Date.UTC(Number(y), Number(mo) - 1, Number(d)));
|
|
168
|
+
if (date.getUTCMonth() !== Number(mo) - 1 || date.getUTCDate() !== Number(d)) return {
|
|
169
|
+
...EMPTY,
|
|
170
|
+
readable: false
|
|
171
|
+
};
|
|
172
|
+
let offset;
|
|
173
|
+
if (off === "Z") offset = 0;
|
|
174
|
+
else if (off) {
|
|
175
|
+
const om = /([+-])(\d{2}):?(\d{2})/.exec(off);
|
|
176
|
+
offset = (om[1] === "-" ? -1 : 1) * (Number(om[2]) * 60 + Number(om[3]));
|
|
177
|
+
}
|
|
178
|
+
return {
|
|
179
|
+
wall: {
|
|
180
|
+
ymd: `${y}-${mo}-${d}`,
|
|
181
|
+
time: h ? `${h}:${mi}` : "09:00"
|
|
182
|
+
},
|
|
183
|
+
hasTime: !!h,
|
|
184
|
+
offset,
|
|
185
|
+
zone: validZone(zone) ? zone : void 0,
|
|
186
|
+
readable: true
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
/** Every IANA zone this runtime knows, UTC included. */
|
|
190
|
+
var ALL_ZONES = (() => {
|
|
191
|
+
const list = typeof Intl.supportedValuesOf === "function" ? Intl.supportedValuesOf("timeZone").map(modernZone) : [];
|
|
192
|
+
return Array.from(new Set(list.includes("UTC") ? list : [...list, "UTC"]));
|
|
193
|
+
})();
|
|
194
|
+
/** The first zone (in order) whose offset at the instant is `offset`; undefined when none is. */
|
|
195
|
+
function zoneWithOffset(offset, instant, candidates) {
|
|
196
|
+
for (const z of candidates) if (z && validZone(z) && offsetMinutes(z, instant) === offset) return z;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* What the control shows for a stored value: the wall time and the zone it lives in.
|
|
200
|
+
*
|
|
201
|
+
* - none: the stored wall time, as typed.
|
|
202
|
+
* - site / fixed: that zone. A stored instant with another offset is shown as THAT instant's wall time in the zone,
|
|
203
|
+
* so the shown and the saved time never disagree.
|
|
204
|
+
* - pick: the stored [Zone]; else the zone the editor picked this session, the default, the browser's, then any
|
|
205
|
+
* zone whose offset matches the stored one (a "+05:30" reads back as Kolkata). A floating time reads in the default.
|
|
206
|
+
*/
|
|
207
|
+
function resolveShown(parsed, mode, zones) {
|
|
208
|
+
const lockedZone = mode === "fixed" ? zones.fixed : zones.def;
|
|
209
|
+
if (!parsed.wall) return {
|
|
210
|
+
wall: null,
|
|
211
|
+
zone: mode === "pick" ? zones.picked ?? zones.def : lockedZone
|
|
212
|
+
};
|
|
213
|
+
if (mode === "none" || parsed.offset === void 0) {
|
|
214
|
+
const zone = mode === "pick" ? parsed.zone ?? zones.picked ?? zones.def : lockedZone;
|
|
215
|
+
return {
|
|
216
|
+
wall: parsed.wall,
|
|
217
|
+
zone
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
const instant = /* @__PURE__ */ new Date(wallUtc(parsed.wall) - parsed.offset * 6e4);
|
|
221
|
+
if (mode === "pick") {
|
|
222
|
+
const zone = (parsed.zone && offsetMinutes(parsed.zone, instant) === parsed.offset ? parsed.zone : void 0) ?? zoneWithOffset(parsed.offset, instant, [
|
|
223
|
+
zones.picked,
|
|
224
|
+
zones.def,
|
|
225
|
+
browserZone(),
|
|
226
|
+
...ALL_ZONES
|
|
227
|
+
]);
|
|
228
|
+
if (zone) return {
|
|
229
|
+
wall: parsed.wall,
|
|
230
|
+
zone
|
|
231
|
+
};
|
|
232
|
+
return {
|
|
233
|
+
wall: instantToWall(instant, zones.def),
|
|
234
|
+
zone: zones.def
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
return {
|
|
238
|
+
wall: offsetMinutes(lockedZone, instant) === parsed.offset ? parsed.wall : instantToWall(instant, lockedZone),
|
|
239
|
+
zone: lockedZone
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
/** The stored string for a wall time under the field's policy (file header). */
|
|
243
|
+
function writeValue(o) {
|
|
244
|
+
const { withTime, mode, wall, zone } = o;
|
|
245
|
+
if (!withTime) return {
|
|
246
|
+
ok: true,
|
|
247
|
+
value: wall.ymd
|
|
248
|
+
};
|
|
249
|
+
const local = `${wall.ymd}T${wall.time}:00`;
|
|
250
|
+
if (mode === "none") return {
|
|
251
|
+
ok: true,
|
|
252
|
+
value: local
|
|
253
|
+
};
|
|
254
|
+
const off = wallOffset(zone, wall);
|
|
255
|
+
if (off === null) return {
|
|
256
|
+
ok: false,
|
|
257
|
+
reason: `That local time doesn't exist in ${zoneCity(zone)} (clocks change). Pick another time.`
|
|
258
|
+
};
|
|
259
|
+
return {
|
|
260
|
+
ok: true,
|
|
261
|
+
value: `${local}${offsetIso(off)}${mode === "fixed" ? `[${zone}]` : ""}`
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
/** Today in a zone (the browser's local day for a floating field). */
|
|
265
|
+
function todayIn(zone, now = /* @__PURE__ */ new Date()) {
|
|
266
|
+
if (zone) return instantToWall(now, zone).ymd;
|
|
267
|
+
return `${now.getFullYear()}-${pad(now.getMonth() + 1)}-${pad(now.getDate())}`;
|
|
268
|
+
}
|
|
269
|
+
//#endregion
|
|
270
|
+
export { ALL_ZONES, browserZone, parseStored, resolveShown, todayIn, useDefaultZone, validZone, wallInstant, writeValue, zoneCity, zoneLabel, zonePolicy, zoneShortOffset };
|
|
271
|
+
|
|
272
|
+
//# sourceMappingURL=date-zone.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-zone.js","names":[],"sources":["../../src/kit/controls/date-zone.ts"],"sourcesContent":["/**\n * DATE / DATETIME values and time zones (DESIGN 6.4, D43), ported from V2 controls/date.tsx and fitted to what the\n * backend and the value adapters keep (adapters/values.ts datetimeToProd / datetimeFromProd, backend\n * parseDateField / parseDatetimeField).\n *\n * What the control writes, per field (`zonePolicy`):\n *\n * date (any timezone) \"2026-10-14\" a prod `date` without includeTime refuses a \"T\"\n * datetime, timezone false \"2026-10-14T09:00:00\" floating wall time\n * datetime, true / unset \"2026-10-14T09:00:00+05:30\" the zone the editor picked lives in the offset:\n * datetime, \"site\" \"2026-10-14T09:00:00-07:00\" prod keeps no [Zone] (the adapter names a kept\n * one as lost and the dock refuses the write)\n * datetime, \"fixed:<IANA>\" \"2026-10-14T09:00:00-04:00[America/New_York]\" the adapter checks the zone against\n * config.timezone, stores the instant, and\n * reads it back with the same [Zone]\n *\n * Seconds are always written (prod refuses a seconds-less datetime; the adapter names it \"format\"). The offset is the\n * zone's offset AT the wall time the author typed (two passes, so it is right on both sides of a clock change), and a\n * wall time that a clock change skips is refused with a named reason, never shifted silently.\n */\nimport * as React from \"react\";\nimport { useKitServices } from \"../context\";\nimport type { FieldSchema } from \"../schema/types\";\n\n/* ── The site zone (a host service) ───────────────────────────────────── */\ndeclare module \"../context\" {\n interface KitServices {\n /**\n * The site's IANA zone (Project.localeConfig.timeZone, Settings › General): where a new date/time value starts and\n * what timezone \"site\" locks to. The dock passes `useSiteTimeZone().zone` when its source is \"site\". Absent or not\n * a zone → the viewer's browser zone, which the picker names \"Your time zone\".\n */\n siteTimeZone?: string;\n }\n}\n\nexport type ZoneSource = \"site\" | \"browser\";\n\nexport function validZone(z: unknown): z is string {\n if (typeof z !== \"string\" || !z) return false;\n try {\n new Intl.DateTimeFormat(\"en-US\", { timeZone: z });\n return true;\n } catch {\n return false;\n }\n}\n\n/** ICU still lists some zones under their old names; people read the current ones (Kolkata, not Calcutta). */\nconst MODERN: Readonly<Record<string, string>> = {\n \"Asia/Calcutta\": \"Asia/Kolkata\",\n \"Asia/Katmandu\": \"Asia/Kathmandu\",\n \"Asia/Saigon\": \"Asia/Ho_Chi_Minh\",\n \"Asia/Rangoon\": \"Asia/Yangon\",\n \"Europe/Kiev\": \"Europe/Kyiv\",\n \"America/Godthab\": \"America/Nuuk\",\n \"Atlantic/Faeroe\": \"Atlantic/Faroe\",\n \"America/Buenos_Aires\": \"America/Argentina/Buenos_Aires\",\n};\nexport const modernZone = (z: string) => (MODERN[z] && validZone(MODERN[z]) ? MODERN[z] : z);\n\nexport function browserZone(): string {\n try {\n return modernZone(Intl.DateTimeFormat().resolvedOptions().timeZone || \"UTC\");\n } catch {\n return \"UTC\";\n }\n}\n\n/** The zone a new value starts in: the site's, else the browser's. `source` names which one. */\nexport function useDefaultZone(): { zone: string; source: ZoneSource } {\n const site = useKitServices().siteTimeZone;\n return React.useMemo(() => (validZone(site) ? { zone: site, source: \"site\" as const } : { zone: browserZone(), source: \"browser\" as const }), [site]);\n}\n\n/* ── Policy ───────────────────────────────────────────────────────────── */\nexport type ZoneMode = \"pick\" | \"site\" | \"fixed\" | \"none\";\n/**\n * What the schema allows. A `date` never carries a zone here: prod stores a date as \"YYYY-MM-DD\" and refuses a time on\n * a date field without includeTime, so a zoned date (V2 allowed one) would be refused at save.\n */\nexport function zonePolicy(field: Pick<FieldSchema, \"type\" | \"timezone\">): { mode: ZoneMode; zone?: string } {\n if (field.type !== \"datetime\") return { mode: \"none\" };\n const t = field.timezone ?? true;\n if (t === false) return { mode: \"none\" };\n if (t === \"site\") return { mode: \"site\" };\n if (typeof t === \"string\" && t.startsWith(\"fixed:\")) {\n const z = t.slice(6);\n return validZone(z) ? { mode: \"fixed\", zone: z } : { mode: \"site\" };\n }\n return { mode: \"pick\" };\n}\n\n/* ── Offsets ──────────────────────────────────────────────────────────── */\nconst pad = (n: number) => String(Math.abs(Math.trunc(n))).padStart(2, \"0\");\n\n/** The zone's UTC offset in minutes at an instant (+330 for Kolkata). */\nexport function offsetMinutes(zone: string, at: Date): number {\n try {\n const name = new Intl.DateTimeFormat(\"en-US\", { timeZone: zone, timeZoneName: \"longOffset\" }).formatToParts(at).find((p) => p.type === \"timeZoneName\")?.value ?? \"GMT\";\n const m = /GMT([+\\-−])(\\d{1,2})(?::?(\\d{2}))?/.exec(name);\n if (!m) return 0;\n const sign = m[1] === \"+\" ? 1 : -1;\n return sign * (Number(m[2]) * 60 + Number(m[3] ?? 0));\n } catch {\n return 0;\n }\n}\n\n/** +330 → \"+05:30\"; 0 → \"+00:00\". */\nexport const offsetIso = (min: number) => `${min < 0 ? \"-\" : \"+\"}${pad(Math.floor(Math.abs(min) / 60))}:${pad(Math.abs(min) % 60)}`;\n\n/** \"GMT+5:30\", \"GMT−7\", \"GMT\" — the short form people read (with a true minus sign). */\nexport function zoneShortOffset(zone: string, at = new Date()): string {\n const min = offsetMinutes(zone, at);\n if (min === 0) return \"GMT\";\n const h = Math.floor(Math.abs(min) / 60);\n const m = Math.abs(min) % 60;\n return `GMT${min < 0 ? \"−\" : \"+\"}${h}${m ? `:${pad(m)}` : \"\"}`;\n}\n\nexport const zoneCity = (z: string) => (z === \"UTC\" || z === \"Etc/UTC\" ? \"UTC\" : (z.split(\"/\").pop() ?? z).replace(/_/g, \" \"));\n/** \"GMT+5:30 · Kolkata\" */\nexport const zoneLabel = (zone: string, at?: Date) => `${zoneShortOffset(zone, at)} · ${zoneCity(zone)}`;\n\n/* ── Wall time ↔ instant ──────────────────────────────────────────────── */\nexport interface Wall {\n /** \"YYYY-MM-DD\" */\n ymd: string;\n /** \"HH:mm\" */\n time: string;\n}\nconst ymdParts = (ymd: string) => ymd.split(\"-\").map(Number) as [number, number, number];\nconst hmParts = (time: string) => time.split(\":\").map(Number) as [number, number];\nconst wallUtc = ({ ymd, time }: Wall) => {\n const [y, mo, d] = ymdParts(ymd);\n const [h, mi] = hmParts(time);\n return Date.UTC(y, mo - 1, d, h, mi);\n};\n\n/** The wall clock an instant shows in a zone. */\nexport function instantToWall(instant: Date, zone: string): Wall {\n const parts = new Intl.DateTimeFormat(\"en-CA\", { timeZone: zone, year: \"numeric\", month: \"2-digit\", day: \"2-digit\", hour: \"2-digit\", minute: \"2-digit\", hourCycle: \"h23\" }).formatToParts(instant);\n const get = (t: string) => parts.find((p) => p.type === t)?.value ?? \"00\";\n return { ymd: `${get(\"year\")}-${get(\"month\")}-${get(\"day\")}`, time: `${get(\"hour\")}:${get(\"minute\")}` };\n}\n\n/**\n * The offset of a wall time in a zone, or null when a clock change skips that wall time (it names no instant there).\n * Two passes: the offset at the naive instant, then at the instant that offset gives.\n */\nexport function wallOffset(zone: string, wall: Wall): number | null {\n const naive = wallUtc(wall);\n const first = offsetMinutes(zone, new Date(naive));\n const second = offsetMinutes(zone, new Date(naive - first * 60_000));\n for (const off of second === first ? [first] : [second, first]) {\n const back = instantToWall(new Date(naive - off * 60_000), zone);\n if (back.ymd === wall.ymd && back.time === wall.time) return off;\n }\n return null;\n}\n\n/** The instant a wall time names in a zone (the earlier one when a clock change skips it). */\nexport const wallInstant = (zone: string, wall: Wall) => new Date(wallUtc(wall) - (wallOffset(zone, wall) ?? offsetMinutes(zone, new Date(wallUtc(wall)))) * 60_000);\n\n/* ── Stored value → parts ─────────────────────────────────────────────── */\nexport interface ParsedValue {\n /** the day as stored (wall clock), or null when empty */\n wall: Wall | null;\n hasTime: boolean;\n /** the stated offset in minutes (\"Z\" → 0); undefined for a floating time */\n offset?: number;\n /** an RFC 9557 [Zone] suffix, when valid */\n zone?: string;\n /** false: a value this control cannot read (an object, a word); it is shown and never overwritten by accident */\n readable: boolean;\n}\n\nconst STORED = /^(\\d{4})-(\\d{2})-(\\d{2})(?:[T ](\\d{2}):(\\d{2})(?::\\d{2}(?:\\.\\d+)?)?(Z|[+-]\\d{2}:?\\d{2})?)?(?:\\[([^\\]]+)\\])?$/;\nconst EMPTY: ParsedValue = { wall: null, hasTime: false, readable: true };\n\nexport function parseStored(v: unknown): ParsedValue {\n if (v == null || v === \"\") return EMPTY;\n if (typeof v !== \"string\") return { ...EMPTY, readable: false };\n const m = STORED.exec(v.trim());\n if (!m) return { ...EMPTY, readable: false };\n const [, y, mo, d, h, mi, off, zone] = m;\n const date = new Date(Date.UTC(Number(y), Number(mo) - 1, Number(d)));\n if (date.getUTCMonth() !== Number(mo) - 1 || date.getUTCDate() !== Number(d)) return { ...EMPTY, readable: false };\n let offset: number | undefined;\n if (off === \"Z\") offset = 0;\n else if (off) {\n const om = /([+-])(\\d{2}):?(\\d{2})/.exec(off)!;\n offset = (om[1] === \"-\" ? -1 : 1) * (Number(om[2]) * 60 + Number(om[3]));\n }\n return { wall: { ymd: `${y}-${mo}-${d}`, time: h ? `${h}:${mi}` : \"09:00\" }, hasTime: !!h, offset, zone: validZone(zone) ? zone : undefined, readable: true };\n}\n\n/** A stored value as a JS Date (drops the [Zone] annotation, which `new Date()` can't read). */\nexport function storedToDate(v: unknown): Date | null {\n if (typeof v !== \"string\" || !v) return null;\n const d = new Date(v.replace(/\\[[^\\]]*\\]$/, \"\"));\n return Number.isNaN(d.getTime()) ? null : d;\n}\n\n/* ── Zones ────────────────────────────────────────────────────────────── */\n/** Every IANA zone this runtime knows, UTC included. */\nexport const ALL_ZONES: readonly string[] = (() => {\n const list = typeof Intl.supportedValuesOf === \"function\" ? Intl.supportedValuesOf(\"timeZone\").map(modernZone) : [];\n return Array.from(new Set(list.includes(\"UTC\") ? list : [...list, \"UTC\"]));\n})();\n\n/** The first zone (in order) whose offset at the instant is `offset`; undefined when none is. */\nexport function zoneWithOffset(offset: number, instant: Date, candidates: readonly (string | undefined)[]): string | undefined {\n for (const z of candidates) if (z && validZone(z) && offsetMinutes(z, instant) === offset) return z;\n return undefined;\n}\n\n/**\n * What the control shows for a stored value: the wall time and the zone it lives in.\n *\n * - none: the stored wall time, as typed.\n * - site / fixed: that zone. A stored instant with another offset is shown as THAT instant's wall time in the zone,\n * so the shown and the saved time never disagree.\n * - pick: the stored [Zone]; else the zone the editor picked this session, the default, the browser's, then any\n * zone whose offset matches the stored one (a \"+05:30\" reads back as Kolkata). A floating time reads in the default.\n */\nexport function resolveShown(parsed: ParsedValue, mode: ZoneMode, zones: { fixed?: string; def: string; picked?: string }): { wall: Wall | null; zone: string } {\n const lockedZone = mode === \"fixed\" ? zones.fixed! : zones.def;\n if (!parsed.wall) return { wall: null, zone: mode === \"pick\" ? (zones.picked ?? zones.def) : lockedZone };\n if (mode === \"none\" || parsed.offset === undefined) {\n const zone = mode === \"pick\" ? (parsed.zone ?? zones.picked ?? zones.def) : lockedZone;\n return { wall: parsed.wall, zone };\n }\n const instant = new Date(wallUtc(parsed.wall) - parsed.offset * 60_000);\n if (mode === \"pick\") {\n const zone = (parsed.zone && offsetMinutes(parsed.zone, instant) === parsed.offset ? parsed.zone : undefined) ?? zoneWithOffset(parsed.offset, instant, [zones.picked, zones.def, browserZone(), ...ALL_ZONES]);\n if (zone) return { wall: parsed.wall, zone };\n return { wall: instantToWall(instant, zones.def), zone: zones.def };\n }\n return { wall: offsetMinutes(lockedZone, instant) === parsed.offset ? parsed.wall : instantToWall(instant, lockedZone), zone: lockedZone };\n}\n\n/* ── Parts → stored value ─────────────────────────────────────────────── */\nexport type WriteResult = { ok: true; value: string } | { ok: false; reason: string };\n\n/** The stored string for a wall time under the field's policy (file header). */\nexport function writeValue(o: { withTime: boolean; mode: ZoneMode; wall: Wall; zone: string }): WriteResult {\n const { withTime, mode, wall, zone } = o;\n if (!withTime) return { ok: true, value: wall.ymd };\n const local = `${wall.ymd}T${wall.time}:00`;\n if (mode === \"none\") return { ok: true, value: local };\n const off = wallOffset(zone, wall);\n if (off === null) return { ok: false, reason: `That local time doesn't exist in ${zoneCity(zone)} (clocks change). Pick another time.` };\n return { ok: true, value: `${local}${offsetIso(off)}${mode === \"fixed\" ? `[${zone}]` : \"\"}` };\n}\n\n/** Today in a zone (the browser's local day for a floating field). */\nexport function todayIn(zone: string | undefined, now = new Date()): string {\n if (zone) return instantToWall(now, zone).ymd;\n return `${now.getFullYear()}-${pad(now.getMonth() + 1)}-${pad(now.getDate())}`;\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ControlProps } from "../types";
|
|
2
|
+
export declare function MiniCalendar({ value, today, onSelect }: {
|
|
3
|
+
value: string | null;
|
|
4
|
+
today: string;
|
|
5
|
+
onSelect: (ymd: string) => void;
|
|
6
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare function DateControl({ field, value, onChange, readOnly, id, invalid }: ControlProps): import("react/jsx-runtime").JSX.Element;
|