@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,706 @@
|
|
|
1
|
+
import { cn } from "../../lib/cn.js";
|
|
2
|
+
import { useKitServices } from "../../context.js";
|
|
3
|
+
import { Button, IconButton } from "../../ui/button.js";
|
|
4
|
+
import { Menu, MenuContent, MenuItem, MenuSeparator, MenuTrigger, Modal, ModalBody, ModalContent, ModalFooter, ModalHeader, Tooltip } from "../../ui/overlay.js";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { IconAlertTriangle, IconArrowDown, IconArrowUp, IconComponents, IconCopy, IconDots, IconLayoutNavbarCollapse, IconLayoutNavbarExpand, IconLink, IconRefresh, IconTrash, IconUnlink } from "@tabler/icons-react";
|
|
7
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
//#region src/kit/controls/rich-text/component-card.tsx
|
|
9
|
+
/**
|
|
10
|
+
* The embedded component card (V2 features/blocks/instance-card.tsx + instance-ui.tsx StateChip / MissingNote / dialogs),
|
|
11
|
+
* drawn when the host can look the component up (KitServices.useComponentInfo, component-services.ts):
|
|
12
|
+
*
|
|
13
|
+
* ┌ [icon] Inline CTA 🔗 2 places · ● Edited here ⋯ ┐ 36px strip
|
|
14
|
+
* ├ ⚠ The original "Product card" was deleted. … [Keep as a separate copy] [Remove] ┤ missing only
|
|
15
|
+
* │ the component itself, drawn live with this place's values (KitServices.ComponentPreview), else │
|
|
16
|
+
* │ its snapshot where this place shows exactly that, else its fields; at most 240px, faded │
|
|
17
|
+
* └──────────────────────────────────────────────────────────────────────────────┘
|
|
18
|
+
*
|
|
19
|
+
* Every state comes from the lookup or the stored copy: "Missing component" only when the library says there is no
|
|
20
|
+
* such component, the count only when the host measured it, "Edited here" only for overrides of fields the component
|
|
21
|
+
* has, "Detached" for a separate copy (V2 instances.ts `detached`), and "Shared version changed" only when the
|
|
22
|
+
* component's current version (`info.publishedAt`) differs from the one the copy was taken from.
|
|
23
|
+
*
|
|
24
|
+
* A separate copy is made through the host (`copyComponent`, which answers what readers see now) and written as ONE
|
|
25
|
+
* undo step (V2 detachNow: "Make a separate copy"); "Use shared version again" (V2 RelinkDialog) keeps this place's
|
|
26
|
+
* edits as overrides or drops them, also one step. A host without `copyComponent` offers neither.
|
|
27
|
+
*
|
|
28
|
+
* Deviation from V2: V2 shows "Shared version changed" on a LINKED instance after a breaking release (instances.ts
|
|
29
|
+
* `pending`). A linked instance here follows every publish of its component, so there is nothing to review; the
|
|
30
|
+
* notice is drawn on a separate copy instead, whose source moved on, and it opens "Use shared version again".
|
|
31
|
+
*/
|
|
32
|
+
/** V2 NARROW: at or under this card width the scope chip shows its icon only. */
|
|
33
|
+
var NARROW = 480;
|
|
34
|
+
/** V2 PREVIEW_CAP: the preview at rest is at most this tall, faded when its content is taller. */
|
|
35
|
+
var PREVIEW_H = 240;
|
|
36
|
+
var placesShort = (n) => `${n} ${n === 1 ? "place" : "places"}`;
|
|
37
|
+
function useWidth(ref) {
|
|
38
|
+
const [w, setW] = React.useState(0);
|
|
39
|
+
React.useLayoutEffect(() => {
|
|
40
|
+
const el = ref.current;
|
|
41
|
+
if (!el) return;
|
|
42
|
+
setW(el.clientWidth);
|
|
43
|
+
if (typeof ResizeObserver === "undefined") return;
|
|
44
|
+
const ro = new ResizeObserver(() => setW(el.clientWidth));
|
|
45
|
+
ro.observe(el);
|
|
46
|
+
return () => ro.disconnect();
|
|
47
|
+
}, [ref]);
|
|
48
|
+
return w;
|
|
49
|
+
}
|
|
50
|
+
/** A stored value as one line of reading text, or null when it has none (lists, empty values, flags). */
|
|
51
|
+
function readable(v) {
|
|
52
|
+
if (typeof v === "number") return String(v);
|
|
53
|
+
if (typeof v === "string") return v.replace(/<[^>]+>/g, " ").replace(/ /g, " ").replace(/\s+/g, " ").trim() || null;
|
|
54
|
+
if (v && typeof v === "object" && !Array.isArray(v)) {
|
|
55
|
+
const o = v;
|
|
56
|
+
return readable(o.label ?? o.text ?? o.title ?? o.href);
|
|
57
|
+
}
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
var parseObj = (s) => {
|
|
61
|
+
try {
|
|
62
|
+
const v = s ? JSON.parse(s) : {};
|
|
63
|
+
return v && typeof v === "object" && !Array.isArray(v) ? v : {};
|
|
64
|
+
} catch {
|
|
65
|
+
return {};
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
/** True when `a` is a later instant than `b`; false when either is absent or unreadable (never a made-up "changed"). */
|
|
69
|
+
var laterThan = (a, b) => {
|
|
70
|
+
const x = a ? Date.parse(a) : NaN;
|
|
71
|
+
const y = b ? Date.parse(b) : NaN;
|
|
72
|
+
return Number.isFinite(x) && Number.isFinite(y) && x > y;
|
|
73
|
+
};
|
|
74
|
+
var same = (a, b) => a === b || JSON.stringify(a) === JSON.stringify(b);
|
|
75
|
+
function ComponentCard({ m, el, ctx, use, overrides, set }) {
|
|
76
|
+
const { copyComponent, toast, ComponentPreview } = useKitServices();
|
|
77
|
+
const { info, loading, error } = use(m.ref ?? "");
|
|
78
|
+
const card = React.useRef(null);
|
|
79
|
+
const width = useWidth(card);
|
|
80
|
+
const narrow = !!width && width <= NARROW;
|
|
81
|
+
const [collapsed, setCollapsed] = React.useState(false);
|
|
82
|
+
const [dialog, setDialog] = React.useState(null);
|
|
83
|
+
const [busy, setBusy] = React.useState(false);
|
|
84
|
+
const detached = !!m.detached;
|
|
85
|
+
const own = React.useMemo(() => parseObj(m.props), [m.props]);
|
|
86
|
+
const missing = !m.ref || !!info?.missing;
|
|
87
|
+
const name = info && !info.missing ? info.name : m.name || info?.name || "Component";
|
|
88
|
+
const fieldKeys = new Set((info?.fields ?? []).map((f) => f.key));
|
|
89
|
+
const edited = missing || detached ? 0 : Object.keys(overrides).filter((k) => fieldKeys.has(k)).length;
|
|
90
|
+
const places = info?.places;
|
|
91
|
+
const known = !!info || missing;
|
|
92
|
+
const changed = detached && !missing && laterThan(info?.publishedAt, m.sourcePublishedAt);
|
|
93
|
+
const label = `${name} component${known ? `, ${detached ? `Detached${changed ? ", Shared version changed" : ""}` : missing ? "Missing component" : edited ? "Edited here" : "Shared"}` : ""}${known && !missing && !detached && places != null ? `, ${placesShort(places)}` : ""}`;
|
|
94
|
+
const rows = detached ? copyRows(own, info?.fields, m.variant) : previewRows(missing, info?.fields, overrides, m.variant);
|
|
95
|
+
const image = missing || detached || edited || m.variant ? null : info?.image || null;
|
|
96
|
+
const liveProps = React.useMemo(() => detached ? own : {
|
|
97
|
+
...Object.fromEntries((info?.fields ?? []).flatMap((f) => f.value !== void 0 ? [[f.key, f.value]] : [])),
|
|
98
|
+
...overrides
|
|
99
|
+
}, [
|
|
100
|
+
detached,
|
|
101
|
+
own,
|
|
102
|
+
info?.fields,
|
|
103
|
+
overrides
|
|
104
|
+
]);
|
|
105
|
+
const live = ComponentPreview && m.ref && info && !missing && !m.variant ? {
|
|
106
|
+
Preview: ComponentPreview,
|
|
107
|
+
ref: m.ref
|
|
108
|
+
} : null;
|
|
109
|
+
const preview = live ? /* @__PURE__ */ jsx(LivePreview, {
|
|
110
|
+
Preview: live.Preview,
|
|
111
|
+
componentId: live.ref,
|
|
112
|
+
title: name,
|
|
113
|
+
props: liveProps,
|
|
114
|
+
rows
|
|
115
|
+
}) : image || rows.length ? /* @__PURE__ */ jsx(PreviewWindow, {
|
|
116
|
+
image,
|
|
117
|
+
rows
|
|
118
|
+
}) : null;
|
|
119
|
+
const canCopy = !!copyComponent && !!m.ref && !ctx.readOnly;
|
|
120
|
+
/**
|
|
121
|
+
* The change as ONE undo step (IslandCtx.step: the dock's toolbar Undo, this toast's Undo and ⌘Z in the body are one
|
|
122
|
+
* undo), and the toast that offers it back.
|
|
123
|
+
*/
|
|
124
|
+
const commit = (patch, label, title, description) => {
|
|
125
|
+
const before = el.__rt;
|
|
126
|
+
const undo = ctx.step ? ctx.step(label, () => (set(patch, label, false), el), before) : (set(patch, label), () => ctx.undo?.() ? true : "Changes made after it come first. Press ⌘Z to undo them.");
|
|
127
|
+
toast?.(title, {
|
|
128
|
+
description,
|
|
129
|
+
action: {
|
|
130
|
+
label: "Undo",
|
|
131
|
+
onClick: () => {
|
|
132
|
+
const r = undo();
|
|
133
|
+
if (r !== true) ctx.notify("Nothing was undone", r);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
};
|
|
138
|
+
/** V2 detachNow: this place keeps what readers see now and stops following the component, as one undo step. */
|
|
139
|
+
const detach = async (title) => {
|
|
140
|
+
if (!copyComponent || !m.ref || busy) return;
|
|
141
|
+
setBusy(true);
|
|
142
|
+
try {
|
|
143
|
+
const copy = await copyComponent(m.ref, {
|
|
144
|
+
overrides,
|
|
145
|
+
...m.variant ? { variant: m.variant } : {}
|
|
146
|
+
});
|
|
147
|
+
commit((cur) => ({
|
|
148
|
+
id: cur.id,
|
|
149
|
+
ref: cur.ref,
|
|
150
|
+
...cur.name !== void 0 || info?.name ? { name: cur.name ?? info?.name } : {},
|
|
151
|
+
...cur.variant !== void 0 ? { variant: cur.variant } : {},
|
|
152
|
+
detached: true,
|
|
153
|
+
props: JSON.stringify(copy.props),
|
|
154
|
+
...copy.blocks !== void 0 ? { blocks: copy.blocks } : {},
|
|
155
|
+
...copy.sourcePublishedAt ? { sourcePublishedAt: copy.sourcePublishedAt } : {},
|
|
156
|
+
...cur.extra !== void 0 ? { extra: cur.extra } : {}
|
|
157
|
+
}), "Make a separate copy", title, "It keeps its content and no longer follows the shared component.");
|
|
158
|
+
} catch (e) {
|
|
159
|
+
ctx.notify("This place couldn't keep its own copy", e instanceof Error ? e.message : String(e));
|
|
160
|
+
} finally {
|
|
161
|
+
setBusy(false);
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
/** V2 instanceOps.relink: keep = what differs from the component becomes overrides; reset = the component's content. */
|
|
165
|
+
const relink = (mode) => {
|
|
166
|
+
const kept = copyEdits(m, own, info?.fields);
|
|
167
|
+
const n = Object.keys(kept).length;
|
|
168
|
+
commit((cur) => ({
|
|
169
|
+
id: cur.id,
|
|
170
|
+
ref: cur.ref,
|
|
171
|
+
...cur.name !== void 0 ? { name: info?.name ?? cur.name } : {},
|
|
172
|
+
...mode === "keep" && Object.keys(kept).length ? { overrides: JSON.stringify(kept) } : {},
|
|
173
|
+
...mode === "keep" && cur.variant !== void 0 ? { variant: cur.variant } : {},
|
|
174
|
+
...cur.extra !== void 0 ? { extra: cur.extra } : {}
|
|
175
|
+
}), "Use shared version again", `${name} is shared again`, mode === "keep" && n ? `${n} ${n === 1 ? "edit" : "edits"} kept here.` : "It shows the component's content.");
|
|
176
|
+
};
|
|
177
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
178
|
+
ref: card,
|
|
179
|
+
role: "group",
|
|
180
|
+
"aria-label": label,
|
|
181
|
+
"aria-roledescription": "component",
|
|
182
|
+
"aria-busy": busy || void 0,
|
|
183
|
+
"data-instance-card": "",
|
|
184
|
+
"data-rt-isolate": "",
|
|
185
|
+
"data-state": detached ? "detached" : missing ? "missing" : known ? "linked" : void 0,
|
|
186
|
+
className: cn("group/inst relative rounded-kit-lg border bg-kit-control-bg text-left transition-colors duration-150 motion-reduce:transition-none", missing && !detached ? "border-kit-warning-line" : "border-kit-line hover:border-kit-line-strong"),
|
|
187
|
+
children: [
|
|
188
|
+
/* @__PURE__ */ jsxs("div", {
|
|
189
|
+
className: "flex h-9 select-none items-center gap-1.5 pl-1 pr-1",
|
|
190
|
+
children: [
|
|
191
|
+
/* @__PURE__ */ jsx("span", { className: "w-1" }),
|
|
192
|
+
/* @__PURE__ */ jsx(IconComponents, {
|
|
193
|
+
size: 15,
|
|
194
|
+
stroke: 1.5,
|
|
195
|
+
className: "shrink-0 text-kit-fg-2",
|
|
196
|
+
"aria-hidden": true
|
|
197
|
+
}),
|
|
198
|
+
/* @__PURE__ */ jsx("span", {
|
|
199
|
+
className: "min-w-0 shrink truncate text-kit-sm font-medium text-kit-fg",
|
|
200
|
+
children: name
|
|
201
|
+
}),
|
|
202
|
+
detached ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(DetachedChip, {
|
|
203
|
+
name,
|
|
204
|
+
compact: narrow
|
|
205
|
+
}), changed ? /* @__PURE__ */ jsx(ChangedChip, {
|
|
206
|
+
name,
|
|
207
|
+
compact: narrow,
|
|
208
|
+
onReview: canCopy ? () => setDialog("relink") : void 0
|
|
209
|
+
}) : null] }) : known ? /* @__PURE__ */ jsx(StateChip, {
|
|
210
|
+
missing,
|
|
211
|
+
places,
|
|
212
|
+
edited,
|
|
213
|
+
compact: narrow
|
|
214
|
+
}) : null,
|
|
215
|
+
/* @__PURE__ */ jsx("span", { className: "flex-1" }),
|
|
216
|
+
ctx.readOnly ? null : /* @__PURE__ */ jsxs(Menu, { children: [/* @__PURE__ */ jsx(MenuTrigger, { render: /* @__PURE__ */ jsx(IconButton, {
|
|
217
|
+
size: "sm",
|
|
218
|
+
className: "shrink-0",
|
|
219
|
+
label: `${name} actions`,
|
|
220
|
+
children: /* @__PURE__ */ jsx(IconDots, { stroke: 1.5 })
|
|
221
|
+
}) }), /* @__PURE__ */ jsxs(MenuContent, {
|
|
222
|
+
align: "end",
|
|
223
|
+
className: "w-56",
|
|
224
|
+
children: [
|
|
225
|
+
preview ? /* @__PURE__ */ jsx(MenuItem, {
|
|
226
|
+
icon: collapsed ? /* @__PURE__ */ jsx(IconLayoutNavbarExpand, { stroke: 1.5 }) : /* @__PURE__ */ jsx(IconLayoutNavbarCollapse, { stroke: 1.5 }),
|
|
227
|
+
onClick: () => setCollapsed(!collapsed),
|
|
228
|
+
children: collapsed ? "Show preview" : "Collapse preview"
|
|
229
|
+
}) : null,
|
|
230
|
+
canCopy && info && !missing && !detached ? /* @__PURE__ */ jsx(MenuItem, {
|
|
231
|
+
icon: /* @__PURE__ */ jsx(IconUnlink, { stroke: 1.5 }),
|
|
232
|
+
disabled: busy,
|
|
233
|
+
onClick: () => setDialog("detach"),
|
|
234
|
+
children: "Make a separate copy"
|
|
235
|
+
}) : null,
|
|
236
|
+
canCopy && missing && !detached ? /* @__PURE__ */ jsx(MenuItem, {
|
|
237
|
+
icon: /* @__PURE__ */ jsx(IconUnlink, { stroke: 1.5 }),
|
|
238
|
+
disabled: busy,
|
|
239
|
+
onClick: () => void detach("Kept as a separate copy"),
|
|
240
|
+
children: "Keep as a separate copy"
|
|
241
|
+
}) : null,
|
|
242
|
+
canCopy && info && !missing && detached ? /* @__PURE__ */ jsx(MenuItem, {
|
|
243
|
+
icon: /* @__PURE__ */ jsx(IconLink, { stroke: 1.5 }),
|
|
244
|
+
onClick: () => setDialog("relink"),
|
|
245
|
+
children: "Use shared version again"
|
|
246
|
+
}) : null,
|
|
247
|
+
ctx.duplicate ? /* @__PURE__ */ jsx(MenuItem, {
|
|
248
|
+
icon: /* @__PURE__ */ jsx(IconCopy, { stroke: 1.5 }),
|
|
249
|
+
onClick: () => ctx.duplicate?.(el),
|
|
250
|
+
children: "Duplicate"
|
|
251
|
+
}) : null,
|
|
252
|
+
ctx.move ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(MenuItem, {
|
|
253
|
+
icon: /* @__PURE__ */ jsx(IconArrowUp, { stroke: 1.5 }),
|
|
254
|
+
disabled: !el.previousElementSibling,
|
|
255
|
+
onClick: () => ctx.move?.(el, -1),
|
|
256
|
+
children: "Move up"
|
|
257
|
+
}), /* @__PURE__ */ jsx(MenuItem, {
|
|
258
|
+
icon: /* @__PURE__ */ jsx(IconArrowDown, { stroke: 1.5 }),
|
|
259
|
+
disabled: !el.nextElementSibling,
|
|
260
|
+
onClick: () => ctx.move?.(el, 1),
|
|
261
|
+
children: "Move down"
|
|
262
|
+
})] }) : null,
|
|
263
|
+
/* @__PURE__ */ jsx(MenuSeparator, {}),
|
|
264
|
+
/* @__PURE__ */ jsx(MenuItem, {
|
|
265
|
+
danger: true,
|
|
266
|
+
icon: /* @__PURE__ */ jsx(IconTrash, { stroke: 1.5 }),
|
|
267
|
+
onClick: () => ctx.remove(el),
|
|
268
|
+
children: "Remove"
|
|
269
|
+
})
|
|
270
|
+
]
|
|
271
|
+
})] })
|
|
272
|
+
]
|
|
273
|
+
}),
|
|
274
|
+
error ? /* @__PURE__ */ jsxs("div", {
|
|
275
|
+
role: "alert",
|
|
276
|
+
className: "flex items-center gap-2 border-t border-kit-line-subtle px-3 py-2.5 text-kit-sm text-kit-fg-2",
|
|
277
|
+
children: [/* @__PURE__ */ jsx(IconAlertTriangle, {
|
|
278
|
+
className: "size-4 shrink-0 text-kit-warning-fg",
|
|
279
|
+
stroke: 1.5,
|
|
280
|
+
"aria-hidden": true
|
|
281
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
282
|
+
className: "min-w-0 flex-1",
|
|
283
|
+
children: error
|
|
284
|
+
})]
|
|
285
|
+
}) : null,
|
|
286
|
+
missing && !detached && !loading ? /* @__PURE__ */ jsxs("div", {
|
|
287
|
+
className: "flex flex-wrap items-center gap-2 border-t border-kit-line-subtle px-3 py-2.5 text-kit-sm",
|
|
288
|
+
role: "note",
|
|
289
|
+
children: [
|
|
290
|
+
/* @__PURE__ */ jsx(IconAlertTriangle, {
|
|
291
|
+
className: "size-4 shrink-0 text-kit-warning-fg",
|
|
292
|
+
stroke: 1.5,
|
|
293
|
+
"aria-hidden": true
|
|
294
|
+
}),
|
|
295
|
+
/* @__PURE__ */ jsxs("span", {
|
|
296
|
+
className: "min-w-0 flex-1 text-kit-fg-2",
|
|
297
|
+
children: [
|
|
298
|
+
"The original “",
|
|
299
|
+
name,
|
|
300
|
+
"” was deleted. Readers see nothing in this place."
|
|
301
|
+
]
|
|
302
|
+
}),
|
|
303
|
+
ctx.readOnly ? null : /* @__PURE__ */ jsxs("span", {
|
|
304
|
+
className: "flex shrink-0 items-center gap-1.5",
|
|
305
|
+
children: [canCopy ? /* @__PURE__ */ jsx(Button, {
|
|
306
|
+
size: "xs",
|
|
307
|
+
variant: "secondary",
|
|
308
|
+
loading: busy,
|
|
309
|
+
onClick: () => void detach("Kept as a separate copy"),
|
|
310
|
+
children: "Keep as a separate copy"
|
|
311
|
+
}) : null, /* @__PURE__ */ jsx(Button, {
|
|
312
|
+
size: "xs",
|
|
313
|
+
variant: "danger-ghost",
|
|
314
|
+
onClick: () => ctx.remove(el),
|
|
315
|
+
children: "Remove"
|
|
316
|
+
})]
|
|
317
|
+
})
|
|
318
|
+
]
|
|
319
|
+
}) : null,
|
|
320
|
+
collapsed ? null : preview,
|
|
321
|
+
canCopy ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(DetachDialog, {
|
|
322
|
+
open: dialog === "detach",
|
|
323
|
+
name,
|
|
324
|
+
places,
|
|
325
|
+
onClose: () => setDialog(null),
|
|
326
|
+
onConfirm: () => {
|
|
327
|
+
setDialog(null);
|
|
328
|
+
detach(`Separate copy of ${name}`);
|
|
329
|
+
}
|
|
330
|
+
}), /* @__PURE__ */ jsx(RelinkDialog, {
|
|
331
|
+
open: dialog === "relink",
|
|
332
|
+
name,
|
|
333
|
+
kept: Object.keys(copyEdits(m, own, info?.fields)).length,
|
|
334
|
+
onClose: () => setDialog(null),
|
|
335
|
+
onConfirm: (mode) => {
|
|
336
|
+
setDialog(null);
|
|
337
|
+
relink(mode);
|
|
338
|
+
}
|
|
339
|
+
})] }) : null
|
|
340
|
+
]
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* A separate copy's EDITS, which it keeps as overrides when it follows the component again: its values that differ from
|
|
345
|
+
* the snapshot taken when the copy was made, never from the component as it is now (a republish since is not an edit
|
|
346
|
+
* of this place; the owner saw "2 fields stay as they are" with nothing edited).
|
|
347
|
+
*
|
|
348
|
+
* A copy made here stores that snapshot: its values (`props`) with the blocks drawn from them (`blocks`), and no
|
|
349
|
+
* surface edits a copy's values afterwards, so it has no edits. Copy markup from V2 stores no snapshot (no `blocks`):
|
|
350
|
+
* its values that differ from the component's, on fields the component has (V2 instanceOps.relink).
|
|
351
|
+
*/
|
|
352
|
+
function copyEdits(m, own, fields) {
|
|
353
|
+
const out = {};
|
|
354
|
+
if (m.blocks !== void 0) return out;
|
|
355
|
+
for (const f of fields ?? []) if (f.key in own && !same(own[f.key], f.value)) out[f.key] = own[f.key];
|
|
356
|
+
return out;
|
|
357
|
+
}
|
|
358
|
+
/** V2 StateChip: 13px, neutral, not a pill; the missing chip is the one tinted state. */
|
|
359
|
+
function StateChip({ missing, places, edited, compact }) {
|
|
360
|
+
const base = CHIP;
|
|
361
|
+
if (missing) return /* @__PURE__ */ jsx(Tooltip, {
|
|
362
|
+
content: "The component was deleted. Readers see nothing in this place.",
|
|
363
|
+
children: /* @__PURE__ */ jsxs("span", {
|
|
364
|
+
className: cn(base, "bg-kit-warning-soft px-1.5 text-kit-warning-fg"),
|
|
365
|
+
children: [/* @__PURE__ */ jsx(IconAlertTriangle, {
|
|
366
|
+
className: "size-3.5 shrink-0",
|
|
367
|
+
stroke: 1.5,
|
|
368
|
+
"aria-hidden": true
|
|
369
|
+
}), compact ? /* @__PURE__ */ jsx("span", {
|
|
370
|
+
className: "sr-only",
|
|
371
|
+
children: "Missing component"
|
|
372
|
+
}) : "Missing component"]
|
|
373
|
+
})
|
|
374
|
+
});
|
|
375
|
+
const count = places ? placesShort(places) : null;
|
|
376
|
+
return /* @__PURE__ */ jsx(Tooltip, {
|
|
377
|
+
content: `Changes here apply only to this place. Edit the component to change ${places && places > 1 ? `all ${places}` : "it everywhere"}.${edited ? ` ${edited} ${edited === 1 ? "field" : "fields"} edited here.` : ""}`,
|
|
378
|
+
children: /* @__PURE__ */ jsxs("span", {
|
|
379
|
+
className: cn(base, "px-1 text-kit-fg-2"),
|
|
380
|
+
tabIndex: -1,
|
|
381
|
+
children: [
|
|
382
|
+
/* @__PURE__ */ jsx(IconLink, {
|
|
383
|
+
className: "size-3.5 shrink-0",
|
|
384
|
+
stroke: 1.5,
|
|
385
|
+
"aria-hidden": true
|
|
386
|
+
}),
|
|
387
|
+
compact ? /* @__PURE__ */ jsxs("span", {
|
|
388
|
+
className: "sr-only",
|
|
389
|
+
children: ["Shared", count ? `, ${count}` : ""]
|
|
390
|
+
}) : count ?? "Shared",
|
|
391
|
+
!compact && count ? /* @__PURE__ */ jsx("span", {
|
|
392
|
+
className: "sr-only",
|
|
393
|
+
children: ", shared"
|
|
394
|
+
}) : null,
|
|
395
|
+
edited ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
|
|
396
|
+
className: "ml-1 size-1.5 shrink-0 rounded-full bg-kit-accent",
|
|
397
|
+
"aria-hidden": true
|
|
398
|
+
}), compact ? /* @__PURE__ */ jsx("span", {
|
|
399
|
+
className: "sr-only",
|
|
400
|
+
children: ", edited here"
|
|
401
|
+
}) : /* @__PURE__ */ jsx("span", { children: "Edited here" })] }) : null
|
|
402
|
+
]
|
|
403
|
+
})
|
|
404
|
+
});
|
|
405
|
+
}
|
|
406
|
+
var CHIP = "inline-flex h-6 shrink-0 items-center gap-1 rounded-kit-md text-[13px] leading-none whitespace-nowrap";
|
|
407
|
+
/** V2 StateChip, detached: fg-3, the unlink glyph. */
|
|
408
|
+
function DetachedChip({ name, compact }) {
|
|
409
|
+
return /* @__PURE__ */ jsx(Tooltip, {
|
|
410
|
+
content: `A separate copy. Changes to ${name} don't reach it.`,
|
|
411
|
+
children: /* @__PURE__ */ jsxs("span", {
|
|
412
|
+
className: cn(CHIP, "px-1 text-kit-fg-3"),
|
|
413
|
+
tabIndex: -1,
|
|
414
|
+
children: [/* @__PURE__ */ jsx(IconUnlink, {
|
|
415
|
+
className: "size-3.5 shrink-0",
|
|
416
|
+
stroke: 1.5,
|
|
417
|
+
"aria-hidden": true
|
|
418
|
+
}), compact ? /* @__PURE__ */ jsx("span", {
|
|
419
|
+
className: "sr-only",
|
|
420
|
+
children: "Detached"
|
|
421
|
+
}) : "Detached"]
|
|
422
|
+
})
|
|
423
|
+
});
|
|
424
|
+
}
|
|
425
|
+
/** V2 StateChip, update: a quiet button that opens the way back to the shared version. */
|
|
426
|
+
function ChangedChip({ name, compact, onReview }) {
|
|
427
|
+
return /* @__PURE__ */ jsx(Tooltip, {
|
|
428
|
+
content: `${name} changed since this copy was made.`,
|
|
429
|
+
children: /* @__PURE__ */ jsxs("button", {
|
|
430
|
+
type: "button",
|
|
431
|
+
onClick: onReview,
|
|
432
|
+
disabled: !onReview,
|
|
433
|
+
className: cn(CHIP, "px-1 text-kit-fg-2 hover:bg-kit-hover hover:text-kit-fg disabled:hover:bg-transparent"),
|
|
434
|
+
children: [/* @__PURE__ */ jsx(IconRefresh, {
|
|
435
|
+
className: "size-3.5 shrink-0",
|
|
436
|
+
stroke: 1.5,
|
|
437
|
+
"aria-hidden": true
|
|
438
|
+
}), compact ? /* @__PURE__ */ jsx("span", {
|
|
439
|
+
className: "sr-only",
|
|
440
|
+
children: "Shared version changed"
|
|
441
|
+
}) : "Shared version changed"]
|
|
442
|
+
})
|
|
443
|
+
});
|
|
444
|
+
}
|
|
445
|
+
/** V2 useInstanceDialogs "detach": confirm before this place stops following the component. */
|
|
446
|
+
function DetachDialog({ open, name, places, onClose, onConfirm }) {
|
|
447
|
+
const others = places != null ? places - 1 : null;
|
|
448
|
+
return /* @__PURE__ */ jsx(Modal, {
|
|
449
|
+
open,
|
|
450
|
+
onOpenChange: (o) => !o && onClose(),
|
|
451
|
+
children: /* @__PURE__ */ jsxs(ModalContent, {
|
|
452
|
+
size: "sm",
|
|
453
|
+
children: [
|
|
454
|
+
/* @__PURE__ */ jsx(ModalHeader, {
|
|
455
|
+
title: `Make a separate copy of ${name}?`,
|
|
456
|
+
description: "This place keeps its current content and stops following the shared component."
|
|
457
|
+
}),
|
|
458
|
+
others != null ? /* @__PURE__ */ jsx(ModalBody, {
|
|
459
|
+
className: "pt-2 text-kit-sm text-kit-fg-2",
|
|
460
|
+
children: others > 0 ? `The other ${others === 1 ? "place stays" : `${others} places stay`} shared.` : "No other place uses it."
|
|
461
|
+
}) : null,
|
|
462
|
+
/* @__PURE__ */ jsxs(ModalFooter, { children: [/* @__PURE__ */ jsx(Button, {
|
|
463
|
+
variant: "ghost",
|
|
464
|
+
onClick: onClose,
|
|
465
|
+
children: "Cancel"
|
|
466
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
467
|
+
variant: "primary",
|
|
468
|
+
autoFocus: true,
|
|
469
|
+
onClick: onConfirm,
|
|
470
|
+
children: "Make a copy"
|
|
471
|
+
})] })
|
|
472
|
+
]
|
|
473
|
+
})
|
|
474
|
+
});
|
|
475
|
+
}
|
|
476
|
+
/** V2 RelinkDialog: keep this place's edits as overrides, or take the component's content. */
|
|
477
|
+
function RelinkDialog({ open, name, kept, onClose, onConfirm }) {
|
|
478
|
+
const [mode, setMode] = React.useState("keep");
|
|
479
|
+
React.useEffect(() => {
|
|
480
|
+
if (open) setMode("keep");
|
|
481
|
+
}, [open]);
|
|
482
|
+
const rows = [{
|
|
483
|
+
v: "keep",
|
|
484
|
+
title: "Keep my edits here",
|
|
485
|
+
line: kept ? `${kept} ${kept === 1 ? "field stays" : "fields stay"} as ${kept === 1 ? "it is" : "they are"}; everything else follows ${name} again.` : `Nothing differs, so it simply follows ${name} again.`
|
|
486
|
+
}, {
|
|
487
|
+
v: "reset",
|
|
488
|
+
title: `Use ${name}'s content`,
|
|
489
|
+
line: "Drops the edits made here. Undo is one click away."
|
|
490
|
+
}];
|
|
491
|
+
return /* @__PURE__ */ jsx(Modal, {
|
|
492
|
+
open,
|
|
493
|
+
onOpenChange: (o) => !o && onClose(),
|
|
494
|
+
children: /* @__PURE__ */ jsxs(ModalContent, {
|
|
495
|
+
size: "sm",
|
|
496
|
+
children: [
|
|
497
|
+
/* @__PURE__ */ jsx(ModalHeader, {
|
|
498
|
+
title: `Use the shared ${name} again?`,
|
|
499
|
+
description: "This place follows the shared component again."
|
|
500
|
+
}),
|
|
501
|
+
/* @__PURE__ */ jsx(ModalBody, {
|
|
502
|
+
className: "pt-3",
|
|
503
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
504
|
+
role: "radiogroup",
|
|
505
|
+
"aria-label": "Use shared version again",
|
|
506
|
+
className: "flex flex-col divide-y divide-kit-line overflow-hidden rounded-kit-lg border border-kit-line",
|
|
507
|
+
onKeyDown: (e) => {
|
|
508
|
+
if (![
|
|
509
|
+
"ArrowUp",
|
|
510
|
+
"ArrowDown",
|
|
511
|
+
"ArrowLeft",
|
|
512
|
+
"ArrowRight"
|
|
513
|
+
].includes(e.key)) return;
|
|
514
|
+
e.preventDefault();
|
|
515
|
+
const next = mode === "keep" ? "reset" : "keep";
|
|
516
|
+
setMode(next);
|
|
517
|
+
e.currentTarget.querySelector(`[data-mode="${next}"]`)?.focus();
|
|
518
|
+
},
|
|
519
|
+
children: rows.map((row) => /* @__PURE__ */ jsxs("button", {
|
|
520
|
+
type: "button",
|
|
521
|
+
role: "radio",
|
|
522
|
+
"data-mode": row.v,
|
|
523
|
+
tabIndex: mode === row.v ? 0 : -1,
|
|
524
|
+
"aria-checked": mode === row.v,
|
|
525
|
+
onClick: () => setMode(row.v),
|
|
526
|
+
className: cn("flex min-h-14 items-start gap-3 px-3 py-2.5 text-left transition-colors hover:bg-kit-hover", mode === row.v && "bg-kit-subtle"),
|
|
527
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
528
|
+
className: cn("mt-0.5 flex size-4 shrink-0 items-center justify-center rounded-full border", mode === row.v ? "border-kit-control-checked" : "border-kit-line-strong"),
|
|
529
|
+
children: mode === row.v ? /* @__PURE__ */ jsx("span", { className: "size-2 rounded-full bg-kit-fg" }) : null
|
|
530
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
531
|
+
className: "min-w-0",
|
|
532
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
533
|
+
className: "block text-kit-sm font-medium text-kit-fg",
|
|
534
|
+
children: row.title
|
|
535
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
536
|
+
className: "block text-kit-xs text-kit-fg-3",
|
|
537
|
+
children: row.line
|
|
538
|
+
})]
|
|
539
|
+
})]
|
|
540
|
+
}, row.v))
|
|
541
|
+
})
|
|
542
|
+
}),
|
|
543
|
+
/* @__PURE__ */ jsxs(ModalFooter, { children: [/* @__PURE__ */ jsx(Button, {
|
|
544
|
+
variant: "ghost",
|
|
545
|
+
onClick: onClose,
|
|
546
|
+
children: "Cancel"
|
|
547
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
548
|
+
variant: "primary",
|
|
549
|
+
onClick: () => onConfirm(mode),
|
|
550
|
+
children: "Use shared version"
|
|
551
|
+
})] })
|
|
552
|
+
]
|
|
553
|
+
})
|
|
554
|
+
});
|
|
555
|
+
}
|
|
556
|
+
/**
|
|
557
|
+
* What the window lists when there is no picture: each field's value as this place shows it (its override, else the
|
|
558
|
+
* component's own), then the layout this place draws it in. A missing component has only what this place stored: its
|
|
559
|
+
* overrides, named by their keys, and its layout.
|
|
560
|
+
*/
|
|
561
|
+
function previewRows(missing, fields, overrides, variant) {
|
|
562
|
+
const out = [];
|
|
563
|
+
if (missing || !fields) for (const [key, v] of Object.entries(overrides)) {
|
|
564
|
+
const text = readable(v);
|
|
565
|
+
if (text) out.push({
|
|
566
|
+
key,
|
|
567
|
+
label: key,
|
|
568
|
+
text
|
|
569
|
+
});
|
|
570
|
+
}
|
|
571
|
+
else for (const f of fields) {
|
|
572
|
+
const text = readable(f.key in overrides ? overrides[f.key] : f.value);
|
|
573
|
+
if (text) out.push({
|
|
574
|
+
key: f.key,
|
|
575
|
+
label: f.label,
|
|
576
|
+
text
|
|
577
|
+
});
|
|
578
|
+
}
|
|
579
|
+
if (variant) out.push({
|
|
580
|
+
key: "__variant",
|
|
581
|
+
label: "Layout",
|
|
582
|
+
text: variant
|
|
583
|
+
});
|
|
584
|
+
return out;
|
|
585
|
+
}
|
|
586
|
+
/**
|
|
587
|
+
* A separate copy's values (V2 `props`) in the component's field order. A field the copy doesn't hold draws the
|
|
588
|
+
* component's value for it, as V2's renderer does for a copy (it draws the def with `props`, defaults for the rest);
|
|
589
|
+
* a value the component no longer has a field for follows, under its key. Then its layout.
|
|
590
|
+
*/
|
|
591
|
+
function copyRows(own, fields, variant) {
|
|
592
|
+
const out = [];
|
|
593
|
+
const push = (key, label, v) => {
|
|
594
|
+
const text = readable(v);
|
|
595
|
+
if (text) out.push({
|
|
596
|
+
key,
|
|
597
|
+
label,
|
|
598
|
+
text
|
|
599
|
+
});
|
|
600
|
+
};
|
|
601
|
+
for (const f of fields ?? []) push(f.key, f.label, f.key in own ? own[f.key] : f.value);
|
|
602
|
+
for (const [key, v] of Object.entries(own)) if (!fields?.some((f) => f.key === key)) push(key, key, v);
|
|
603
|
+
if (variant) out.push({
|
|
604
|
+
key: "__variant",
|
|
605
|
+
label: "Layout",
|
|
606
|
+
text: variant
|
|
607
|
+
});
|
|
608
|
+
return out;
|
|
609
|
+
}
|
|
610
|
+
/** The preview's frame: under the card's header, at most PREVIEW_H tall. */
|
|
611
|
+
var PREVIEW_CHROME = "relative overflow-hidden rounded-b-kit-lg border-t border-kit-line-subtle bg-kit-subtle";
|
|
612
|
+
function PreviewWindow({ image, rows }) {
|
|
613
|
+
return /* @__PURE__ */ jsx("div", {
|
|
614
|
+
"data-instance-preview": "",
|
|
615
|
+
className: PREVIEW_CHROME,
|
|
616
|
+
style: { maxHeight: PREVIEW_H },
|
|
617
|
+
children: /* @__PURE__ */ jsx(PreviewBody, {
|
|
618
|
+
image,
|
|
619
|
+
rows
|
|
620
|
+
})
|
|
621
|
+
});
|
|
622
|
+
}
|
|
623
|
+
/**
|
|
624
|
+
* The component drawn live by the host (KitServices.ComponentPreview), mounted once the card is on screen. Its height is
|
|
625
|
+
* reserved from the start (PREVIEW_H), so the card never moves while it loads; where the host cannot draw it, the values
|
|
626
|
+
* are listed under the reason.
|
|
627
|
+
*/
|
|
628
|
+
function LivePreview({ Preview, componentId, title, props, rows }) {
|
|
629
|
+
const box = React.useRef(null);
|
|
630
|
+
const [seen, setSeen] = React.useState(() => typeof IntersectionObserver === "undefined");
|
|
631
|
+
React.useEffect(() => {
|
|
632
|
+
const el = box.current;
|
|
633
|
+
if (seen || !el) return;
|
|
634
|
+
const io = new IntersectionObserver((entries) => {
|
|
635
|
+
if (entries.some((e) => e.isIntersecting)) setSeen(true);
|
|
636
|
+
});
|
|
637
|
+
io.observe(el);
|
|
638
|
+
return () => io.disconnect();
|
|
639
|
+
}, [seen]);
|
|
640
|
+
return /* @__PURE__ */ jsx("div", {
|
|
641
|
+
ref: box,
|
|
642
|
+
"data-instance-preview": "",
|
|
643
|
+
"data-live": "",
|
|
644
|
+
className: PREVIEW_CHROME,
|
|
645
|
+
children: seen ? /* @__PURE__ */ jsx(Preview, {
|
|
646
|
+
componentId,
|
|
647
|
+
title,
|
|
648
|
+
props,
|
|
649
|
+
fallback: (reason) => /* @__PURE__ */ jsx(PreviewBody, {
|
|
650
|
+
image: null,
|
|
651
|
+
rows,
|
|
652
|
+
note: reason
|
|
653
|
+
})
|
|
654
|
+
}) : /* @__PURE__ */ jsx("div", {
|
|
655
|
+
"aria-hidden": true,
|
|
656
|
+
style: { height: PREVIEW_H }
|
|
657
|
+
})
|
|
658
|
+
});
|
|
659
|
+
}
|
|
660
|
+
function PreviewBody({ image, rows, note }) {
|
|
661
|
+
const inner = React.useRef(null);
|
|
662
|
+
const [tall, setTall] = React.useState(false);
|
|
663
|
+
const [loaded, setLoaded] = React.useState(!image);
|
|
664
|
+
React.useLayoutEffect(() => {
|
|
665
|
+
const el = inner.current;
|
|
666
|
+
if (!el) return;
|
|
667
|
+
const on = () => setTall(el.scrollHeight > PREVIEW_H + 1);
|
|
668
|
+
on();
|
|
669
|
+
if (typeof ResizeObserver === "undefined") return;
|
|
670
|
+
const ro = new ResizeObserver(on);
|
|
671
|
+
ro.observe(el);
|
|
672
|
+
return () => ro.disconnect();
|
|
673
|
+
}, []);
|
|
674
|
+
return /* @__PURE__ */ jsx("div", {
|
|
675
|
+
ref: inner,
|
|
676
|
+
className: cn(tall && "[mask-image:linear-gradient(to_bottom,black_calc(100%-24px),transparent)]"),
|
|
677
|
+
style: tall || !loaded ? { height: PREVIEW_H } : void 0,
|
|
678
|
+
children: image ? /* @__PURE__ */ jsx("img", {
|
|
679
|
+
src: image,
|
|
680
|
+
alt: "",
|
|
681
|
+
className: "block h-auto w-full",
|
|
682
|
+
draggable: false,
|
|
683
|
+
onLoad: () => setLoaded(true),
|
|
684
|
+
onError: () => setLoaded(true)
|
|
685
|
+
}) : /* @__PURE__ */ jsxs(Fragment, { children: [note ? /* @__PURE__ */ jsx("p", {
|
|
686
|
+
className: "px-4 pt-3 text-kit-xs text-kit-fg-3",
|
|
687
|
+
children: note
|
|
688
|
+
}) : null, /* @__PURE__ */ jsx("dl", {
|
|
689
|
+
className: "flex flex-col gap-3 px-4 py-3.5",
|
|
690
|
+
children: rows.map((r) => /* @__PURE__ */ jsxs("div", {
|
|
691
|
+
className: "min-w-0",
|
|
692
|
+
children: [/* @__PURE__ */ jsx("dt", {
|
|
693
|
+
className: "truncate text-kit-xs text-kit-fg-3",
|
|
694
|
+
children: r.label
|
|
695
|
+
}), /* @__PURE__ */ jsx("dd", {
|
|
696
|
+
className: "mt-0.5 line-clamp-3 text-kit-sm text-kit-fg",
|
|
697
|
+
children: r.text
|
|
698
|
+
})]
|
|
699
|
+
}, r.key))
|
|
700
|
+
})] })
|
|
701
|
+
});
|
|
702
|
+
}
|
|
703
|
+
//#endregion
|
|
704
|
+
export { ComponentCard };
|
|
705
|
+
|
|
706
|
+
//# sourceMappingURL=component-card.js.map
|