@bettercms-ai/kit 0.1.1 → 2.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/README.md +22 -16
- package/dist/_virtual/_rolldown/runtime.js +13 -0
- package/dist/adapters/dock-values.d.ts +28 -0
- package/dist/adapters/dock-values.js +41 -0
- package/dist/adapters/dock-values.js.map +1 -0
- package/dist/adapters/icons.d.ts +15 -0
- package/dist/adapters/icons.js +27 -0
- package/dist/adapters/icons.js.map +1 -0
- package/dist/adapters/lossy.d.ts +326 -0
- package/dist/adapters/lossy.js +414 -0
- package/dist/adapters/lossy.js.map +1 -0
- package/dist/adapters/prod-types.d.ts +546 -0
- package/dist/adapters/prod-types.js +714 -0
- package/dist/adapters/prod-types.js.map +1 -0
- package/dist/adapters/schema.d.ts +154 -0
- package/dist/adapters/schema.js +3020 -0
- package/dist/adapters/schema.js.map +1 -0
- package/dist/adapters/values.d.ts +221 -0
- package/dist/adapters/values.js +623 -0
- package/dist/adapters/values.js.map +1 -0
- package/dist/brand/logo.d.ts +17 -0
- package/dist/brand/logo.js +96 -0
- package/dist/brand/logo.js.map +1 -0
- package/dist/context.d.ts +359 -0
- package/dist/context.js +217 -0
- package/dist/context.js.map +1 -0
- package/dist/controls/button.d.ts +72 -0
- package/dist/controls/button.js +578 -0
- package/dist/controls/button.js.map +1 -0
- package/dist/controls/c1.d.ts +11 -0
- package/dist/controls/c1.js +24 -0
- package/dist/controls/c1.js.map +1 -0
- package/dist/controls/c2.d.ts +10 -0
- package/dist/controls/c2.js +19 -0
- package/dist/controls/c2.js.map +1 -0
- package/dist/controls/choice.d.ts +44 -0
- package/dist/controls/choice.js +463 -0
- package/dist/controls/choice.js.map +1 -0
- package/dist/controls/code-register.d.ts +1 -0
- package/dist/controls/code-register.js +8 -0
- package/dist/controls/code-register.js.map +1 -0
- package/dist/controls/code.d.ts +42 -0
- package/dist/controls/code.js +397 -0
- package/dist/controls/code.js.map +1 -0
- package/dist/controls/color.d.ts +5 -0
- package/dist/controls/color.js +130 -0
- package/dist/controls/color.js.map +1 -0
- package/dist/controls/component-services.d.ts +156 -0
- package/dist/controls/component-services.js +7 -0
- package/dist/controls/component-services.js.map +1 -0
- package/dist/controls/date-register.d.ts +1 -0
- package/dist/controls/date-register.js +9 -0
- package/dist/controls/date-register.js.map +1 -0
- package/dist/controls/date-zone.d.ts +104 -0
- package/dist/controls/date-zone.js +278 -0
- package/dist/controls/date-zone.js.map +1 -0
- package/dist/controls/date.d.ts +7 -0
- package/dist/controls/date.js +466 -0
- package/dist/controls/date.js.map +1 -0
- package/dist/controls/form-picker-register.d.ts +1 -0
- package/dist/controls/form-picker-register.js +19 -0
- package/dist/controls/form-picker-register.js.map +1 -0
- package/dist/controls/form-picker.d.ts +43 -0
- package/dist/controls/form-picker.js +85 -0
- package/dist/controls/form-picker.js.map +1 -0
- package/dist/controls/icon-register.d.ts +1 -0
- package/dist/controls/icon-register.js +8 -0
- package/dist/controls/icon-register.js.map +1 -0
- package/dist/controls/icon.d.ts +40 -0
- package/dist/controls/icon.js +360 -0
- package/dist/controls/icon.js.map +1 -0
- package/dist/controls/index.d.ts +5 -0
- package/dist/controls/index.js +38 -0
- package/dist/controls/index.js.map +1 -0
- package/dist/controls/json-register.d.ts +1 -0
- package/dist/controls/json-register.js +8 -0
- package/dist/controls/json-register.js.map +1 -0
- package/dist/controls/json.d.ts +2 -0
- package/dist/controls/json.js +82 -0
- package/dist/controls/json.js.map +1 -0
- package/dist/controls/link.d.ts +260 -0
- package/dist/controls/link.js +1186 -0
- package/dist/controls/link.js.map +1 -0
- package/dist/controls/location-register.d.ts +1 -0
- package/dist/controls/location-register.js +8 -0
- package/dist/controls/location-register.js.map +1 -0
- package/dist/controls/location.d.ts +16 -0
- package/dist/controls/location.js +221 -0
- package/dist/controls/location.js.map +1 -0
- package/dist/controls/media-register.d.ts +1 -0
- package/dist/controls/media-register.js +12 -0
- package/dist/controls/media-register.js.map +1 -0
- package/dist/controls/media-services.d.ts +46 -0
- package/dist/controls/media-services.js +0 -0
- package/dist/controls/media.d.ts +104 -0
- package/dist/controls/media.js +1396 -0
- package/dist/controls/media.js.map +1 -0
- package/dist/controls/number.d.ts +22 -0
- package/dist/controls/number.js +196 -0
- package/dist/controls/number.js.map +1 -0
- package/dist/controls/reference-register.d.ts +1 -0
- package/dist/controls/reference-register.js +10 -0
- package/dist/controls/reference-register.js.map +1 -0
- package/dist/controls/reference-services.d.ts +58 -0
- package/dist/controls/reference-services.js +0 -0
- package/dist/controls/reference.d.ts +23 -0
- package/dist/controls/reference.js +777 -0
- package/dist/controls/reference.js.map +1 -0
- package/dist/controls/rich-text/blocks.d.ts +49 -0
- package/dist/controls/rich-text/blocks.js +1859 -0
- package/dist/controls/rich-text/blocks.js.map +1 -0
- package/dist/controls/rich-text/catalog.d.ts +101 -0
- package/dist/controls/rich-text/catalog.js +623 -0
- package/dist/controls/rich-text/catalog.js.map +1 -0
- package/dist/controls/rich-text/codec.d.ts +64 -0
- package/dist/controls/rich-text/codec.js +34 -0
- package/dist/controls/rich-text/codec.js.map +1 -0
- package/dist/controls/rich-text/component-card.d.ts +14 -0
- package/dist/controls/rich-text/component-card.js +1024 -0
- package/dist/controls/rich-text/component-card.js.map +1 -0
- package/dist/controls/rich-text/component-panel.d.ts +47 -0
- package/dist/controls/rich-text/component-panel.js +141 -0
- package/dist/controls/rich-text/component-panel.js.map +1 -0
- package/dist/controls/rich-text/control.d.ts +20 -0
- package/dist/controls/rich-text/control.js +296 -0
- package/dist/controls/rich-text/control.js.map +1 -0
- package/dist/controls/rich-text/dom.d.ts +233 -0
- package/dist/controls/rich-text/dom.js +1019 -0
- package/dist/controls/rich-text/dom.js.map +1 -0
- package/dist/controls/rich-text/editor.d.ts +57 -0
- package/dist/controls/rich-text/editor.js +1630 -0
- package/dist/controls/rich-text/editor.js.map +1 -0
- package/dist/controls/rich-text/floating.d.ts +28 -0
- package/dist/controls/rich-text/floating.js +154 -0
- package/dist/controls/rich-text/floating.js.map +1 -0
- package/dist/controls/rich-text/index.d.ts +1 -0
- package/dist/controls/rich-text/index.js +12 -0
- package/dist/controls/rich-text/index.js.map +1 -0
- package/dist/controls/rich-text/link-form.d.ts +13 -0
- package/dist/controls/rich-text/link-form.js +147 -0
- package/dist/controls/rich-text/link-form.js.map +1 -0
- package/dist/controls/rich-text/markdown.d.ts +6 -0
- package/dist/controls/rich-text/markdown.js +181 -0
- package/dist/controls/rich-text/markdown.js.map +1 -0
- package/dist/controls/rich-text/ops.d.ts +35 -0
- package/dist/controls/rich-text/ops.js +316 -0
- package/dist/controls/rich-text/ops.js.map +1 -0
- package/dist/controls/rich-text/plain.d.ts +17 -0
- package/dist/controls/rich-text/plain.js +44 -0
- package/dist/controls/rich-text/plain.js.map +1 -0
- package/dist/controls/rich-text/toolbar.d.ts +89 -0
- package/dist/controls/rich-text/toolbar.js +343 -0
- package/dist/controls/rich-text/toolbar.js.map +1 -0
- package/dist/controls/scale.d.ts +56 -0
- package/dist/controls/scale.js +563 -0
- package/dist/controls/scale.js.map +1 -0
- package/dist/controls/slot-register.d.ts +1 -0
- package/dist/controls/slot-register.js +16 -0
- package/dist/controls/slot-register.js.map +1 -0
- package/dist/controls/slot-services.d.ts +122 -0
- package/dist/controls/slot-services.js +155 -0
- package/dist/controls/slot-services.js.map +1 -0
- package/dist/controls/slot.d.ts +33 -0
- package/dist/controls/slot.js +366 -0
- package/dist/controls/slot.js.map +1 -0
- package/dist/controls/table/index.d.ts +1 -0
- package/dist/controls/table/index.js +12 -0
- package/dist/controls/table/index.js.map +1 -0
- package/dist/controls/table/prod.d.ts +21 -0
- package/dist/controls/table/prod.js +79 -0
- package/dist/controls/table/prod.js.map +1 -0
- package/dist/controls/table/refs.d.ts +50 -0
- package/dist/controls/table/refs.js +79 -0
- package/dist/controls/table/refs.js.map +1 -0
- package/dist/controls/table/stored.d.ts +15 -0
- package/dist/controls/table/stored.js +44 -0
- package/dist/controls/table/stored.js.map +1 -0
- package/dist/controls/table/table-editor.d.ts +103 -0
- package/dist/controls/table/table-editor.js +2725 -0
- package/dist/controls/table/table-editor.js.map +1 -0
- package/dist/controls/table/table-link.d.ts +24 -0
- package/dist/controls/table/table-link.js +180 -0
- package/dist/controls/table/table-link.js.map +1 -0
- package/dist/controls/table/table.d.ts +9 -0
- package/dist/controls/table/table.js +103 -0
- package/dist/controls/table/table.js.map +1 -0
- package/dist/controls/text.d.ts +17 -0
- package/dist/controls/text.js +322 -0
- package/dist/controls/text.js.map +1 -0
- package/dist/controls/unknown-value.d.ts +17 -0
- package/dist/controls/unknown-value.js +66 -0
- package/dist/controls/unknown-value.js.map +1 -0
- package/dist/core/core.d.ts +63 -0
- package/dist/core/core.js +171 -0
- package/dist/core/core.js.map +1 -0
- package/dist/core/facets.d.ts +347 -0
- package/dist/core/facets.js +334 -0
- package/dist/core/facets.js.map +1 -0
- package/dist/core/index.d.ts +3 -0
- package/dist/core/index.js +3 -0
- package/dist/engine/array.d.ts +101 -0
- package/dist/engine/array.js +906 -0
- package/dist/engine/array.js.map +1 -0
- package/dist/engine/bits.d.ts +24 -0
- package/dist/engine/bits.js +60 -0
- package/dist/engine/bits.js.map +1 -0
- package/dist/engine/breadcrumb.d.ts +45 -0
- package/dist/engine/breadcrumb.js +63 -0
- package/dist/engine/breadcrumb.js.map +1 -0
- package/dist/engine/expand.d.ts +66 -0
- package/dist/engine/expand.js +153 -0
- package/dist/engine/expand.js.map +1 -0
- package/dist/engine/field-list.d.ts +20 -0
- package/dist/engine/field-list.js +19 -0
- package/dist/engine/field-list.js.map +1 -0
- package/dist/engine/field-shell.d.ts +49 -0
- package/dist/engine/field-shell.js +988 -0
- package/dist/engine/field-shell.js.map +1 -0
- package/dist/engine/frame.d.ts +122 -0
- package/dist/engine/frame.js +601 -0
- package/dist/engine/frame.js.map +1 -0
- package/dist/engine/group-summary.d.ts +5 -0
- package/dist/engine/group-summary.js +70 -0
- package/dist/engine/group-summary.js.map +1 -0
- package/dist/engine/grouping.d.ts +238 -0
- package/dist/engine/grouping.js +996 -0
- package/dist/engine/grouping.js.map +1 -0
- package/dist/engine/item-list.d.ts +99 -0
- package/dist/engine/item-list.js +725 -0
- package/dist/engine/item-list.js.map +1 -0
- package/dist/engine/kit-field.d.ts +72 -0
- package/dist/engine/kit-field.js +558 -0
- package/dist/engine/kit-field.js.map +1 -0
- package/dist/engine/schema-form.d.ts +116 -0
- package/dist/engine/schema-form.js +462 -0
- package/dist/engine/schema-form.js.map +1 -0
- package/dist/engine/slot.d.ts +13 -0
- package/dist/engine/slot.js +216 -0
- package/dist/engine/slot.js.map +1 -0
- package/dist/index.d.ts +45 -3139
- package/dist/index.js +47 -2036
- package/dist/index.js.map +1 -0
- package/dist/kit.css +75 -0
- package/dist/lib/cn.d.ts +4 -0
- package/dist/lib/cn.js +56 -0
- package/dist/lib/cn.js.map +1 -0
- package/dist/lib/columns.d.ts +14 -0
- package/dist/lib/columns.js +30 -0
- package/dist/lib/columns.js.map +1 -0
- package/dist/lib/frames.d.ts +36 -0
- package/dist/lib/frames.js +214 -0
- package/dist/lib/frames.js.map +1 -0
- package/dist/lib/icon-image.d.ts +10 -0
- package/dist/lib/icon-image.js +8 -0
- package/dist/lib/icon-image.js.map +1 -0
- package/dist/lib/icons.d.ts +16 -0
- package/dist/lib/icons.js +173 -0
- package/dist/lib/icons.js.map +1 -0
- package/dist/lib/input-modality.d.ts +11 -0
- package/dist/lib/input-modality.js +47 -0
- package/dist/lib/input-modality.js.map +1 -0
- package/dist/lib/key-event.d.ts +11 -0
- package/dist/lib/key-event.js +16 -0
- package/dist/lib/key-event.js.map +1 -0
- package/dist/lib/path.d.ts +29 -0
- package/dist/lib/path.js +66 -0
- package/dist/lib/path.js.map +1 -0
- package/dist/lib/schema.d.ts +80 -0
- package/dist/lib/schema.js +384 -0
- package/dist/lib/schema.js.map +1 -0
- package/dist/lib/utils.d.ts +7 -0
- package/dist/lib/utils.js +37 -0
- package/dist/lib/utils.js.map +1 -0
- package/dist/lib/validate.d.ts +30 -0
- package/dist/lib/validate.js +224 -0
- package/dist/lib/validate.js.map +1 -0
- package/dist/library/analysis.d.ts +23 -0
- package/dist/library/analysis.js +160 -0
- package/dist/library/analysis.js.map +1 -0
- package/dist/library/catalog.d.ts +57 -0
- package/dist/library/catalog.js +307 -0
- package/dist/library/catalog.js.map +1 -0
- package/dist/library/coreNotes.d.ts +8 -0
- package/dist/library/coreNotes.js +111 -0
- package/dist/library/coreNotes.js.map +1 -0
- package/dist/library/coverage.d.ts +40 -0
- package/dist/library/coverage.js +59 -0
- package/dist/library/coverage.js.map +1 -0
- package/dist/library/entries/advanced.entries.d.ts +2 -0
- package/dist/library/entries/advanced.entries.js +6579 -0
- package/dist/library/entries/advanced.entries.js.map +1 -0
- package/dist/library/entries/commerce.entries.d.ts +2 -0
- package/dist/library/entries/commerce.entries.js +4140 -0
- package/dist/library/entries/commerce.entries.js.map +1 -0
- package/dist/library/entries/company.entries.d.ts +2 -0
- package/dist/library/entries/company.entries.js +2731 -0
- package/dist/library/entries/company.entries.js.map +1 -0
- package/dist/library/entries/conversion.entries.d.ts +2 -0
- package/dist/library/entries/conversion.entries.js +3707 -0
- package/dist/library/entries/conversion.entries.js.map +1 -0
- package/dist/library/entries/data.entries.d.ts +7 -0
- package/dist/library/entries/data.entries.js +4613 -0
- package/dist/library/entries/data.entries.js.map +1 -0
- package/dist/library/entries/events.entries.d.ts +2 -0
- package/dist/library/entries/events.entries.js +3428 -0
- package/dist/library/entries/events.entries.js.map +1 -0
- package/dist/library/entries/features.entries.d.ts +2 -0
- package/dist/library/entries/features.entries.js +3157 -0
- package/dist/library/entries/features.entries.js.map +1 -0
- package/dist/library/entries/heroes.entries.d.ts +2 -0
- package/dist/library/entries/heroes.entries.js +3401 -0
- package/dist/library/entries/heroes.entries.js.map +1 -0
- package/dist/library/entries/index.d.ts +3 -0
- package/dist/library/entries/index.js +35 -0
- package/dist/library/entries/index.js.map +1 -0
- package/dist/library/entries/listings.entries.d.ts +2 -0
- package/dist/library/entries/listings.entries.js +2976 -0
- package/dist/library/entries/listings.entries.js.map +1 -0
- package/dist/library/entries/longform.entries.d.ts +2 -0
- package/dist/library/entries/longform.entries.js +4227 -0
- package/dist/library/entries/longform.entries.js.map +1 -0
- package/dist/library/entries/media.entries.d.ts +2 -0
- package/dist/library/entries/media.entries.js +2781 -0
- package/dist/library/entries/media.entries.js.map +1 -0
- package/dist/library/entries/navigation.entries.d.ts +2 -0
- package/dist/library/entries/navigation.entries.js +4011 -0
- package/dist/library/entries/navigation.entries.js.map +1 -0
- package/dist/library/entries/pricing.entries.d.ts +2 -0
- package/dist/library/entries/pricing.entries.js +2383 -0
- package/dist/library/entries/pricing.entries.js.map +1 -0
- package/dist/library/entries/social-proof.entries.d.ts +2 -0
- package/dist/library/entries/social-proof.entries.js +2297 -0
- package/dist/library/entries/social-proof.entries.js.map +1 -0
- package/dist/library/examples/bento.d.ts +92 -0
- package/dist/library/examples/bento.js +201 -0
- package/dist/library/examples/bento.js.map +1 -0
- package/dist/library/examples/blocks.d.ts +14 -0
- package/dist/library/examples/blocks.js +313 -0
- package/dist/library/examples/blocks.js.map +1 -0
- package/dist/library/examples/faq.d.ts +28 -0
- package/dist/library/examples/faq.js +230 -0
- package/dist/library/examples/faq.js.map +1 -0
- package/dist/library/examples/hero.d.ts +43 -0
- package/dist/library/examples/hero.js +222 -0
- package/dist/library/examples/hero.js.map +1 -0
- package/dist/library/examples/index.d.ts +36 -0
- package/dist/library/examples/index.js +109 -0
- package/dist/library/examples/index.js.map +1 -0
- package/dist/library/examples/journalStory.d.ts +93 -0
- package/dist/library/examples/journalStory.js +338 -0
- package/dist/library/examples/journalStory.js.map +1 -0
- package/dist/library/examples/megaMenu.d.ts +134 -0
- package/dist/library/examples/megaMenu.js +442 -0
- package/dist/library/examples/megaMenu.js.map +1 -0
- package/dist/library/examples/pricing.d.ts +103 -0
- package/dist/library/examples/pricing.js +479 -0
- package/dist/library/examples/pricing.js.map +1 -0
- package/dist/library/examples/tabs.d.ts +87 -0
- package/dist/library/examples/tabs.js +180 -0
- package/dist/library/examples/tabs.js.map +1 -0
- package/dist/library/export.d.ts +42 -0
- package/dist/library/export.js +80 -0
- package/dist/library/export.js.map +1 -0
- package/dist/library/index.d.ts +13 -0
- package/dist/library/index.js +6 -0
- package/dist/library/kit-catalog.json +1510 -0
- package/dist/library/types.d.ts +42 -0
- package/dist/library/types.js +0 -0
- package/dist/schema/adapters.d.ts +28 -0
- package/dist/schema/adapters.js +492 -0
- package/dist/schema/adapters.js.map +1 -0
- package/dist/schema/help.d.ts +27 -0
- package/dist/schema/help.js +56 -0
- package/dist/schema/help.js.map +1 -0
- package/dist/schema/scale.d.ts +69 -0
- package/dist/schema/scale.js +250 -0
- package/dist/schema/scale.js.map +1 -0
- package/dist/schema/sources.d.ts +103 -0
- package/dist/schema/sources.js +65 -0
- package/dist/schema/sources.js.map +1 -0
- package/dist/schema/table.d.ts +319 -0
- package/dist/schema/table.js +1199 -0
- package/dist/schema/table.js.map +1 -0
- package/dist/schema/types.d.ts +297 -0
- package/dist/schema/types.js +14 -0
- package/dist/schema/types.js.map +1 -0
- package/dist/styles.css +2 -0
- package/dist/table/table-view.d.ts +14 -0
- package/dist/table/table-view.js +140 -0
- package/dist/table/table-view.js.map +1 -0
- package/dist/table/table.css +73 -0
- package/dist/testing/corpus.d.ts +63 -0
- package/dist/testing/corpus.js +129 -0
- package/dist/testing/corpus.js.map +1 -0
- package/dist/testing/test-form.d.ts +11 -0
- package/dist/testing/test-form.js +38 -0
- package/dist/testing/test-form.js.map +1 -0
- package/dist/theme.css +345 -0
- package/dist/theme.d.ts +20 -1504
- package/dist/theme.js +43 -4126
- package/dist/theme.js.map +1 -0
- package/dist/tokens.css +542 -0
- package/dist/types.d.ts +17 -0
- package/dist/types.js +0 -0
- package/dist/ui/action-tray.d.ts +54 -0
- package/dist/ui/action-tray.js +154 -0
- package/dist/ui/action-tray.js.map +1 -0
- package/dist/ui/autocomplete.d.ts +30 -0
- package/dist/ui/autocomplete.js +139 -0
- package/dist/ui/autocomplete.js.map +1 -0
- package/dist/ui/button.d.ts +57 -0
- package/dist/ui/button.js +201 -0
- package/dist/ui/button.js.map +1 -0
- package/dist/ui/choice-switch.d.ts +36 -0
- package/dist/ui/choice-switch.js +57 -0
- package/dist/ui/choice-switch.js.map +1 -0
- package/dist/ui/controls.d.ts +83 -0
- package/dist/ui/controls.js +331 -0
- package/dist/ui/controls.js.map +1 -0
- package/dist/ui/display.d.ts +163 -0
- package/dist/ui/display.js +455 -0
- package/dist/ui/display.js.map +1 -0
- package/dist/ui/expanded-editor-modal.d.ts +26 -0
- package/dist/ui/expanded-editor-modal.js +140 -0
- package/dist/ui/expanded-editor-modal.js.map +1 -0
- package/dist/ui/field-context.d.ts +12 -0
- package/dist/ui/field-context.js +23 -0
- package/dist/ui/field-context.js.map +1 -0
- package/dist/ui/floating-panel.d.ts +152 -0
- package/dist/ui/floating-panel.js +928 -0
- package/dist/ui/floating-panel.js.map +1 -0
- package/dist/ui/index.d.ts +16 -0
- package/dist/ui/index.js +18 -0
- package/dist/ui/input.d.ts +78 -0
- package/dist/ui/input.js +250 -0
- package/dist/ui/input.js.map +1 -0
- package/dist/ui/mode-bar.d.ts +31 -0
- package/dist/ui/mode-bar.js +65 -0
- package/dist/ui/mode-bar.js.map +1 -0
- package/dist/ui/overlay.d.ts +195 -0
- package/dist/ui/overlay.js +697 -0
- package/dist/ui/overlay.js.map +1 -0
- package/dist/ui/path-crumbs.d.ts +90 -0
- package/dist/ui/path-crumbs.js +566 -0
- package/dist/ui/path-crumbs.js.map +1 -0
- package/dist/ui/presence.d.ts +16 -0
- package/dist/ui/presence.js +65 -0
- package/dist/ui/presence.js.map +1 -0
- package/dist/ui/select.d.ts +66 -0
- package/dist/ui/select.js +407 -0
- package/dist/ui/select.js.map +1 -0
- package/dist/ui/shortcut-hint.d.ts +14 -0
- package/dist/ui/shortcut-hint.js +35 -0
- package/dist/ui/shortcut-hint.js.map +1 -0
- package/dist/ui/spinner.d.ts +24 -0
- package/dist/ui/spinner.js +42 -0
- package/dist/ui/spinner.js.map +1 -0
- package/dist/ui/split-button.d.ts +32 -0
- package/dist/ui/split-button.js +60 -0
- package/dist/ui/split-button.js.map +1 -0
- package/dist/ui/surfaces.d.ts +23 -0
- package/dist/ui/surfaces.js +26 -0
- package/dist/ui/surfaces.js.map +1 -0
- package/dist/ui/tab.d.ts +38 -0
- package/dist/ui/tab.js +87 -0
- package/dist/ui/tab.js.map +1 -0
- package/dist/ui/toast.d.ts +20 -0
- package/dist/ui/toast.js +115 -0
- package/dist/ui/toast.js.map +1 -0
- package/dist/ui/tooltip-root.d.ts +13 -0
- package/dist/ui/tooltip-root.js +77 -0
- package/dist/ui/tooltip-root.js.map +1 -0
- package/dist/ui/variants.d.ts +15 -0
- package/dist/ui/variants.js +14 -0
- package/dist/ui/variants.js.map +1 -0
- package/package.json +76 -50
- package/LICENSE +0 -21
- 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.mjs +0 -2044
- package/dist/theme.d.mts +0 -1506
- 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,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* <SchemaForm> — the BetterCMS Block Kit form engine (V2 HEAD 9829bf1 kit/engine/schema-form.tsx). One schema in, one
|
|
3
|
+
* value out; renders through the shared field chrome; owns validation visibility, per-field undo + history (coalesced
|
|
4
|
+
* 900ms, 50 steps), the published baseline (changed dots, Reset to published) and the navigation path.
|
|
5
|
+
*
|
|
6
|
+
* <SchemaForm schema={faq} value={v} onChange={setV} variant="panel" />
|
|
7
|
+
*
|
|
8
|
+
* `path` is controllable so a canvas can sync selection <-> breadcrumb both ways. Frames (root, drilled object, array
|
|
9
|
+
* item, slot block, button, history) come from lib/frames `resolveFrames`; the drill-in stage, crumbs and keys
|
|
10
|
+
* (Esc / Alt+Up/Down) from frame.tsx and breadcrumb.tsx; the layout of each frame from grouping.tsx through field-list.
|
|
11
|
+
*
|
|
12
|
+
* The host provides the kit scope (`data-kit-scope`) around the form; the form never declares one of its own, so a
|
|
13
|
+
* dark host scope is never reset to light inside it.
|
|
14
|
+
*/
|
|
15
|
+
import * as React from "react";
|
|
16
|
+
import type { FieldPath, FieldSchema, TypeSchema } from "../schema/types";
|
|
17
|
+
import { type KitEnv, type KitPeer, type Swatch } from "../context";
|
|
18
|
+
import { type KitIssue } from "../lib/validate";
|
|
19
|
+
import { type KitCrumb } from "./breadcrumb";
|
|
20
|
+
export interface SchemaFormProps {
|
|
21
|
+
schema: TypeSchema;
|
|
22
|
+
value: Record<string, unknown>;
|
|
23
|
+
onChange: (value: Record<string, unknown>) => void;
|
|
24
|
+
/** controlled navigation path ([] = root). Omit for uncontrolled. */
|
|
25
|
+
path?: FieldPath;
|
|
26
|
+
defaultPath?: FieldPath;
|
|
27
|
+
onPathChange?: (path: FieldPath) => void;
|
|
28
|
+
/** "panel" = 320–420px inspector; "document" = the wide document editor column */
|
|
29
|
+
variant?: "panel" | "document";
|
|
30
|
+
/** resolve a block type (slot children) to its schema */
|
|
31
|
+
resolveSchema?: (blockType: string) => TypeSchema | undefined;
|
|
32
|
+
/** blocks offered by "+ Add block" (filtered by each slot's allow list) */
|
|
33
|
+
blockLibrary?: TypeSchema[];
|
|
34
|
+
/** the published version: enables changed dots and "Reset to published" */
|
|
35
|
+
published?: Record<string, unknown>;
|
|
36
|
+
/**
|
|
37
|
+
* Component instance (CPO D28): values come from `from` unless a top-level key is in `overridden`. Overridden fields
|
|
38
|
+
* get an accent dot + "Reset"; inherited ones read muted. `onReset(key)` drops one override.
|
|
39
|
+
*/
|
|
40
|
+
inherited?: {
|
|
41
|
+
from: string;
|
|
42
|
+
overridden: string[];
|
|
43
|
+
onReset: (key: string) => void;
|
|
44
|
+
};
|
|
45
|
+
/** pathKey → teammates in that field ("items.1.answer") */
|
|
46
|
+
presence?: Record<string, KitPeer | KitPeer[]>;
|
|
47
|
+
/** pathKey → open comment threads */
|
|
48
|
+
comments?: Record<string, number>;
|
|
49
|
+
/** host comment system. When set, the field comment chip opens the host's popover/panel instead of the kit's. */
|
|
50
|
+
onComment?: KitEnv["onComment"];
|
|
51
|
+
/** "Open {title}" on a reference: the host opens the referenced entry (e.g. a stacked panel) */
|
|
52
|
+
onOpenReference?: KitEnv["onOpenReference"];
|
|
53
|
+
/** D61: the host's Review changes markers (while its History panel is open) */
|
|
54
|
+
review?: KitEnv["review"];
|
|
55
|
+
/** the whole form is read-only for the lens (fields with their own `access.edit` still follow `env.can`) */
|
|
56
|
+
readOnly?: boolean;
|
|
57
|
+
/** validate everything now (after a publish attempt) */
|
|
58
|
+
showErrors?: boolean;
|
|
59
|
+
/** document identity + site context */
|
|
60
|
+
env?: {
|
|
61
|
+
docId?: string;
|
|
62
|
+
docTitle?: string;
|
|
63
|
+
urlPrefix?: string;
|
|
64
|
+
isPublished?: boolean;
|
|
65
|
+
/** the slug is the document's address (KitEnv.slugIsAddress) */
|
|
66
|
+
slugIsAddress?: boolean;
|
|
67
|
+
palette?: Swatch[];
|
|
68
|
+
syncedFrom?: string;
|
|
69
|
+
/** D58: the host's access check (`useCan` at the host). Omitted → allow-all (staff tools, demos). */
|
|
70
|
+
can?: KitEnv["can"];
|
|
71
|
+
/** CPO D39: "tooltip" moves help lines behind the ⓘ (dense hosts) */
|
|
72
|
+
helpDisplay?: KitEnv["helpDisplay"];
|
|
73
|
+
/** "quiet" field chrome for meta-forms (see `KitEnv.fieldChrome`) */
|
|
74
|
+
fieldChrome?: KitEnv["fieldChrome"];
|
|
75
|
+
/** the host's own controls by path key (see `KitEnv.controls`); keep it stable */
|
|
76
|
+
controls?: KitEnv["controls"];
|
|
77
|
+
/** the host's chip summary for collapsed fieldsets (see `KitEnv.sectionSummary`); keep it stable */
|
|
78
|
+
sectionSummary?: KitEnv["sectionSummary"];
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Issues the host computes itself (a live check the schema can't express), merged with the form's own. A host issue on a
|
|
82
|
+
* path the form already flags is dropped; `live` ones show while typing; `fix` adds one action after the message.
|
|
83
|
+
*/
|
|
84
|
+
extraIssues?: KitIssue[];
|
|
85
|
+
/** The host's access check (V2 `KitEnv.can`), the same as `env.can`; `env.can` wins when both are set. */
|
|
86
|
+
can?: KitEnv["can"];
|
|
87
|
+
/**
|
|
88
|
+
* D70 (V2 `KitEnv.hiddenLine`): keep the fields that would leave the form in place as the host's line instead. `why`
|
|
89
|
+
* says what hid it: "rule" (its condition doesn't hold for the current value) or "access" (the lens can't `view` it).
|
|
90
|
+
* The schema preview draws its dashed "Hidden for Editor" / "Hidden: …" lines with it. Absent: hidden fields leave the
|
|
91
|
+
* form, as in every editor. Keep it stable (a new function re-renders the form).
|
|
92
|
+
*/
|
|
93
|
+
hiddenLine?: (field: FieldSchema, path: FieldPath, why: HiddenWhy) => React.ReactNode;
|
|
94
|
+
/** own scroll container (default: panel yes, document no) */
|
|
95
|
+
scroll?: boolean;
|
|
96
|
+
/** rendered above the breadcrumb (e.g. a block header) */
|
|
97
|
+
header?: React.ReactNode;
|
|
98
|
+
/** label of the root crumb (defaults to schema.title) */
|
|
99
|
+
rootLabel?: string;
|
|
100
|
+
/**
|
|
101
|
+
* Host-owned trail (CPO D38): the form stops rendering its own breadcrumb and reports the drill-in crumbs
|
|
102
|
+
* instead, so a host with its own path header shows ONE breadcrumb. Navigate with `onPathChange`. Called in a
|
|
103
|
+
* layout effect, so the host header never lags a frame.
|
|
104
|
+
*/
|
|
105
|
+
onCrumbs?: (crumbs: KitCrumb[]) => void;
|
|
106
|
+
onIssuesChange?: (issues: KitIssue[]) => void;
|
|
107
|
+
/** imperative navigation for hosts (e.g. a dialog's Escape: go up one level before closing) */
|
|
108
|
+
navRef?: React.Ref<{
|
|
109
|
+
back: () => boolean;
|
|
110
|
+
}>;
|
|
111
|
+
className?: string;
|
|
112
|
+
}
|
|
113
|
+
export declare const COALESCE_MS = 900;
|
|
114
|
+
export declare const UNDO_STEPS = 50;
|
|
115
|
+
export type HiddenWhy = "rule" | "access";
|
|
116
|
+
export declare function SchemaForm({ schema: schemaIn, value, onChange, path: controlledPath, defaultPath, onPathChange, variant, resolveSchema: resolveIn, blockLibrary, published, inherited, presence, comments, onComment, onOpenReference, review, readOnly, showErrors, env: envIn, scroll, header, rootLabel, onCrumbs, onIssuesChange, navRef, className, can: canIn, hiddenLine, extraIssues, }: SchemaFormProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,462 @@
|
|
|
1
|
+
import { cn } from "../lib/cn.js";
|
|
2
|
+
import { DEFAULT_ENV, FormProvider, KitEnvProvider, fieldAccessOf, useForm, useKitEnv, visibleSchema } from "../context.js";
|
|
3
|
+
import { getIn, isObj, keyStartsWith, pathEq, pathKey, same, setIn } from "../lib/path.js";
|
|
4
|
+
import { condCtx, isHidden } from "../lib/schema.js";
|
|
5
|
+
import { collectIssues } from "../lib/validate.js";
|
|
6
|
+
import { FieldList, FieldSection } from "./grouping.js";
|
|
7
|
+
import { ButtonScreen } from "../controls/button.js";
|
|
8
|
+
import { FieldList as FieldList$1 } from "./field-list.js";
|
|
9
|
+
import { RowsHostContext } from "./array.js";
|
|
10
|
+
import { resolveFrames } from "../lib/frames.js";
|
|
11
|
+
import { FrameCrumbs, crumbSignature, framesToCrumbs } from "./breadcrumb.js";
|
|
12
|
+
import { FrameSlotsProvider, FrameStage, useFrameNavigation } from "./frame.js";
|
|
13
|
+
import { TableFrame } from "../controls/table/table.js";
|
|
14
|
+
import { KitField, NestedForm } from "./kit-field.js";
|
|
15
|
+
import * as React from "react";
|
|
16
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
17
|
+
//#region src/engine/schema-form.tsx
|
|
18
|
+
/**
|
|
19
|
+
* <SchemaForm> — the BetterCMS Block Kit form engine (V2 HEAD 9829bf1 kit/engine/schema-form.tsx). One schema in, one
|
|
20
|
+
* value out; renders through the shared field chrome; owns validation visibility, per-field undo + history (coalesced
|
|
21
|
+
* 900ms, 50 steps), the published baseline (changed dots, Reset to published) and the navigation path.
|
|
22
|
+
*
|
|
23
|
+
* <SchemaForm schema={faq} value={v} onChange={setV} variant="panel" />
|
|
24
|
+
*
|
|
25
|
+
* `path` is controllable so a canvas can sync selection <-> breadcrumb both ways. Frames (root, drilled object, array
|
|
26
|
+
* item, slot block, button, history) come from lib/frames `resolveFrames`; the drill-in stage, crumbs and keys
|
|
27
|
+
* (Esc / Alt+Up/Down) from frame.tsx and breadcrumb.tsx; the layout of each frame from grouping.tsx through field-list.
|
|
28
|
+
*
|
|
29
|
+
* The host provides the kit scope (`data-kit-scope`) around the form; the form never declares one of its own, so a
|
|
30
|
+
* dark host scope is never reset to light inside it.
|
|
31
|
+
*/
|
|
32
|
+
var COALESCE_MS = 900;
|
|
33
|
+
var UNDO_STEPS = 50;
|
|
34
|
+
var HISTORY_ENTRIES = 30;
|
|
35
|
+
var buttonLabel = (v) => ({ label: isObj(v) && typeof v.label === "string" ? v.label : void 0 });
|
|
36
|
+
var FRAME_SLOTS = {
|
|
37
|
+
get FieldList() {
|
|
38
|
+
return FieldList$1;
|
|
39
|
+
},
|
|
40
|
+
get FieldSection() {
|
|
41
|
+
return FieldSection;
|
|
42
|
+
},
|
|
43
|
+
get TableFrame() {
|
|
44
|
+
return TableFrame;
|
|
45
|
+
},
|
|
46
|
+
get ButtonScreen() {
|
|
47
|
+
return ButtonScreen;
|
|
48
|
+
},
|
|
49
|
+
normLink: buttonLabel
|
|
50
|
+
};
|
|
51
|
+
var ROWS_HOST = { get NestedForm() {
|
|
52
|
+
return NestedForm;
|
|
53
|
+
} };
|
|
54
|
+
/** Drop archived fields at every depth (V2 registry: "What a form renders: archived fields left out (their values stay
|
|
55
|
+
* stored)"). Same object back when nothing is archived, so a form with none renders exactly as before. */
|
|
56
|
+
function liveFields(fields) {
|
|
57
|
+
let changed = false;
|
|
58
|
+
const out = [];
|
|
59
|
+
for (const f of fields) {
|
|
60
|
+
if (f.archived) {
|
|
61
|
+
changed = true;
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
let g = f;
|
|
65
|
+
if (f.fields) {
|
|
66
|
+
const n = liveFields(f.fields);
|
|
67
|
+
if (n !== f.fields) g = {
|
|
68
|
+
...g,
|
|
69
|
+
fields: n
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
if (Array.isArray(f.of)) {
|
|
73
|
+
const n = liveFields(f.of);
|
|
74
|
+
if (n !== f.of) g = {
|
|
75
|
+
...g,
|
|
76
|
+
of: n
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
if (f.slotSettings) {
|
|
80
|
+
const n = liveFields(f.slotSettings);
|
|
81
|
+
if (n !== f.slotSettings) g = {
|
|
82
|
+
...g,
|
|
83
|
+
slotSettings: n
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
if (g !== f) changed = true;
|
|
87
|
+
out.push(g);
|
|
88
|
+
}
|
|
89
|
+
return changed ? out : fields;
|
|
90
|
+
}
|
|
91
|
+
function liveSchema(schema) {
|
|
92
|
+
const fields = liveFields(schema.fields);
|
|
93
|
+
return fields === schema.fields ? schema : {
|
|
94
|
+
...schema,
|
|
95
|
+
fields
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
var GHOST = "__ghost";
|
|
99
|
+
var HiddenLineCtx = React.createContext(void 0);
|
|
100
|
+
/** A stand-in that keeps a hidden field's place: no value rules, no condition, nothing to validate or drill into. */
|
|
101
|
+
function ghostOf(f, why) {
|
|
102
|
+
return {
|
|
103
|
+
name: f.name,
|
|
104
|
+
title: f.title,
|
|
105
|
+
type: f.type === "object" || f.type === "array" || f.type === "slot" ? "string" : f.type,
|
|
106
|
+
fieldset: f.fieldset,
|
|
107
|
+
group: f.group,
|
|
108
|
+
readOnly: true,
|
|
109
|
+
[GHOST]: {
|
|
110
|
+
why,
|
|
111
|
+
field: f
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
/** `visibleSchema`, except that a field the lens can't view stays as a ghost (top level and inside objects). */
|
|
116
|
+
function lensGhosts(schema, can) {
|
|
117
|
+
const walk = (fields) => fields.map((f) => {
|
|
118
|
+
const a = fieldAccessOf(f);
|
|
119
|
+
if (a?.view && !can(a.view)) return ghostOf(f, "access");
|
|
120
|
+
return f.type === "object" && f.fields ? {
|
|
121
|
+
...f,
|
|
122
|
+
fields: walk(f.fields)
|
|
123
|
+
} : f;
|
|
124
|
+
});
|
|
125
|
+
return {
|
|
126
|
+
...schema,
|
|
127
|
+
fields: walk(schema.fields)
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
/** The frame's field list with condition-hidden fields kept as ghosts, every ghost drawn by the host's line. */
|
|
131
|
+
function GhostFieldList(props) {
|
|
132
|
+
const form = useForm();
|
|
133
|
+
const line = React.useContext(HiddenLineCtx);
|
|
134
|
+
const raw = form.getAt(props.basePath);
|
|
135
|
+
const parent = isObj(raw) ? raw : {};
|
|
136
|
+
const cc = condCtx(form, props.basePath);
|
|
137
|
+
const fields = props.fields.map((f) => f[GHOST] || f.hidden === true || !isHidden(f, parent, cc) ? f : ghostOf(f, "rule"));
|
|
138
|
+
return /* @__PURE__ */ jsx(FieldList, {
|
|
139
|
+
...props,
|
|
140
|
+
fields,
|
|
141
|
+
renderField: (f, path, p) => {
|
|
142
|
+
const g = f[GHOST];
|
|
143
|
+
return g ? /* @__PURE__ */ jsx("div", {
|
|
144
|
+
"data-field-key": pathKey(path),
|
|
145
|
+
"data-ghost": g.why,
|
|
146
|
+
children: line(g.field, path, g.why)
|
|
147
|
+
}) : /* @__PURE__ */ jsx(KitField, {
|
|
148
|
+
field: f,
|
|
149
|
+
path,
|
|
150
|
+
parent: p
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
var GHOST_SLOTS = {
|
|
156
|
+
get FieldList() {
|
|
157
|
+
return GhostFieldList;
|
|
158
|
+
},
|
|
159
|
+
get FieldSection() {
|
|
160
|
+
return FieldSection;
|
|
161
|
+
},
|
|
162
|
+
get TableFrame() {
|
|
163
|
+
return TableFrame;
|
|
164
|
+
},
|
|
165
|
+
get ButtonScreen() {
|
|
166
|
+
return ButtonScreen;
|
|
167
|
+
},
|
|
168
|
+
normLink: buttonLabel
|
|
169
|
+
};
|
|
170
|
+
function SchemaForm({ schema: schemaIn, value, onChange, path: controlledPath, defaultPath, onPathChange, variant = "panel", resolveSchema: resolveIn, blockLibrary, published, inherited, presence, comments, onComment, onOpenReference, review, readOnly, showErrors = false, env: envIn, scroll, header, rootLabel, onCrumbs, onIssuesChange, navRef, className, can: canIn, hiddenLine, extraIssues }) {
|
|
171
|
+
const outerCan = useKitEnv().can;
|
|
172
|
+
const can = envIn?.can ?? canIn ?? outerCan;
|
|
173
|
+
const schema = React.useMemo(() => {
|
|
174
|
+
const live = liveSchema(schemaIn);
|
|
175
|
+
return hiddenLine ? lensGhosts(live, can) : visibleSchema(live, can);
|
|
176
|
+
}, [
|
|
177
|
+
schemaIn,
|
|
178
|
+
can,
|
|
179
|
+
hiddenLine
|
|
180
|
+
]);
|
|
181
|
+
const resolveSchema = React.useMemo(() => resolveIn ? (t) => {
|
|
182
|
+
const s = resolveIn(t);
|
|
183
|
+
return s && visibleSchema(liveSchema(s), can);
|
|
184
|
+
} : void 0, [resolveIn, can]);
|
|
185
|
+
const docId = envIn?.docId ?? schema.name;
|
|
186
|
+
const ownScroll = scroll ?? variant === "panel";
|
|
187
|
+
const valueRef = React.useRef(value);
|
|
188
|
+
valueRef.current = value;
|
|
189
|
+
const [baseline, setBaseline] = React.useState(value);
|
|
190
|
+
const stacks = React.useRef(/* @__PURE__ */ new Map());
|
|
191
|
+
const log = React.useRef(/* @__PURE__ */ new Map());
|
|
192
|
+
const memory = React.useRef(/* @__PURE__ */ new Map());
|
|
193
|
+
const [aiKeys, setAiKeys] = React.useState(() => /* @__PURE__ */ new Set());
|
|
194
|
+
const [touched, setTouched] = React.useState(() => /* @__PURE__ */ new Set());
|
|
195
|
+
const editing = React.useRef(/* @__PURE__ */ new Set());
|
|
196
|
+
const [, bump] = React.useReducer((x) => x + 1, 0);
|
|
197
|
+
React.useEffect(() => {
|
|
198
|
+
setBaseline(valueRef.current);
|
|
199
|
+
stacks.current.clear();
|
|
200
|
+
log.current.clear();
|
|
201
|
+
memory.current.clear();
|
|
202
|
+
setTouched(/* @__PURE__ */ new Set());
|
|
203
|
+
setAiKeys(/* @__PURE__ */ new Set());
|
|
204
|
+
}, [docId]);
|
|
205
|
+
const [innerPath, setInnerPath] = React.useState(defaultPath ?? []);
|
|
206
|
+
const rawPath = controlledPath ?? innerPath;
|
|
207
|
+
const { frames, path } = React.useMemo(() => resolveFrames(schema, value, rawPath, resolveSchema), [
|
|
208
|
+
schema,
|
|
209
|
+
value,
|
|
210
|
+
rawPath,
|
|
211
|
+
resolveSchema
|
|
212
|
+
]);
|
|
213
|
+
const navigate = React.useCallback((p) => {
|
|
214
|
+
if (controlledPath === void 0) setInnerPath(p);
|
|
215
|
+
onPathChange?.(p);
|
|
216
|
+
}, [controlledPath, onPathChange]);
|
|
217
|
+
React.useEffect(() => {
|
|
218
|
+
if (!pathEq(path, rawPath)) navigate(path);
|
|
219
|
+
}, [
|
|
220
|
+
path,
|
|
221
|
+
rawPath,
|
|
222
|
+
navigate
|
|
223
|
+
]);
|
|
224
|
+
const lastDoc = React.useRef(docId);
|
|
225
|
+
React.useEffect(() => {
|
|
226
|
+
if (lastDoc.current === docId) return;
|
|
227
|
+
lastDoc.current = docId;
|
|
228
|
+
if (controlledPath === void 0) setInnerPath([]);
|
|
229
|
+
}, [docId]);
|
|
230
|
+
const setAt = React.useCallback((p, v, opts) => {
|
|
231
|
+
const prev = getIn(valueRef.current, p);
|
|
232
|
+
if (same(prev, v)) return;
|
|
233
|
+
const key = pathKey(p);
|
|
234
|
+
if (opts?.record !== false) {
|
|
235
|
+
const now = Date.now();
|
|
236
|
+
const st = stacks.current.get(key) ?? {
|
|
237
|
+
path: p,
|
|
238
|
+
values: [],
|
|
239
|
+
at: 0
|
|
240
|
+
};
|
|
241
|
+
if (!st.values.length || now - st.at > 900) st.values = [...st.values, prev].slice(-50);
|
|
242
|
+
st.at = now;
|
|
243
|
+
stacks.current.set(key, st);
|
|
244
|
+
const h = log.current.get(key) ?? [];
|
|
245
|
+
const entry = {
|
|
246
|
+
value: v,
|
|
247
|
+
at: now,
|
|
248
|
+
by: "You",
|
|
249
|
+
label: opts?.label
|
|
250
|
+
};
|
|
251
|
+
log.current.set(key, h.length && now - h[0].at < 900 && !opts?.label ? [entry, ...h.slice(1)] : [entry, ...h].slice(0, HISTORY_ENTRIES));
|
|
252
|
+
editing.current.add(key);
|
|
253
|
+
}
|
|
254
|
+
const next = setIn(valueRef.current, p, v);
|
|
255
|
+
valueRef.current = next;
|
|
256
|
+
onChange(next);
|
|
257
|
+
}, [onChange]);
|
|
258
|
+
const issueList = React.useMemo(() => {
|
|
259
|
+
const own = collectIssues(schema.fields, value, [], resolveSchema);
|
|
260
|
+
return extraIssues?.length ? [...own, ...extraIssues.filter((x) => !own.some((o) => o.key === x.key))] : own;
|
|
261
|
+
}, [
|
|
262
|
+
schema,
|
|
263
|
+
value,
|
|
264
|
+
resolveSchema,
|
|
265
|
+
extraIssues
|
|
266
|
+
]);
|
|
267
|
+
const issues = React.useMemo(() => new Map(issueList.map((i) => [i.key, i])), [issueList]);
|
|
268
|
+
React.useEffect(() => onIssuesChange?.(issueList), [issueList, onIssuesChange]);
|
|
269
|
+
const isVisible = React.useCallback((i) => showErrors || !!i.live || touched.has(i.key) || i.kind === "rule" && !editing.current.has(i.key), [showErrors, touched]);
|
|
270
|
+
const api = {
|
|
271
|
+
schema,
|
|
272
|
+
value,
|
|
273
|
+
setAt,
|
|
274
|
+
getAt: (p) => getIn(value, p),
|
|
275
|
+
baselineAt: (p) => getIn(baseline, p),
|
|
276
|
+
publishedAt: (p) => getIn(published, p),
|
|
277
|
+
hasPublished: !!published,
|
|
278
|
+
inherited: inherited ? {
|
|
279
|
+
from: inherited.from,
|
|
280
|
+
isOverridden: (k) => inherited.overridden.includes(k),
|
|
281
|
+
reset: inherited.onReset
|
|
282
|
+
} : void 0,
|
|
283
|
+
path,
|
|
284
|
+
navigate,
|
|
285
|
+
canNavigate: true,
|
|
286
|
+
resolveSchema,
|
|
287
|
+
blockLibrary,
|
|
288
|
+
issues,
|
|
289
|
+
visibleIssue: (k) => {
|
|
290
|
+
const i = issues.get(k);
|
|
291
|
+
return i && isVisible(i) ? i : void 0;
|
|
292
|
+
},
|
|
293
|
+
rollup: (prefix) => {
|
|
294
|
+
const pk = pathKey(prefix);
|
|
295
|
+
let errors = 0;
|
|
296
|
+
let warnings = 0;
|
|
297
|
+
for (const i of issueList) if (keyStartsWith(i.key, pk) && isVisible(i)) i.level === "error" ? errors++ : warnings++;
|
|
298
|
+
return {
|
|
299
|
+
errors,
|
|
300
|
+
warnings
|
|
301
|
+
};
|
|
302
|
+
},
|
|
303
|
+
touch: (k) => {
|
|
304
|
+
editing.current.delete(k);
|
|
305
|
+
if (!touched.has(k)) setTouched((s) => new Set(s).add(k));
|
|
306
|
+
},
|
|
307
|
+
showAllErrors: showErrors,
|
|
308
|
+
canUndo: (k) => !!stacks.current.get(k)?.values.length,
|
|
309
|
+
undo: (k) => {
|
|
310
|
+
const st = stacks.current.get(k);
|
|
311
|
+
if (!st?.values.length) return;
|
|
312
|
+
const prev = st.values[st.values.length - 1];
|
|
313
|
+
st.values = st.values.slice(0, -1);
|
|
314
|
+
st.at = 0;
|
|
315
|
+
const next = setIn(valueRef.current, st.path, prev);
|
|
316
|
+
valueRef.current = next;
|
|
317
|
+
onChange(next);
|
|
318
|
+
bump();
|
|
319
|
+
},
|
|
320
|
+
history: (k) => log.current.get(k) ?? [],
|
|
321
|
+
aiKeys,
|
|
322
|
+
markAi: (k, on) => setAiKeys((s) => {
|
|
323
|
+
const n = new Set(s);
|
|
324
|
+
if (on) n.add(k);
|
|
325
|
+
else n.delete(k);
|
|
326
|
+
return n;
|
|
327
|
+
}),
|
|
328
|
+
memory: memory.current
|
|
329
|
+
};
|
|
330
|
+
const normPresence = React.useMemo(() => {
|
|
331
|
+
const out = {};
|
|
332
|
+
for (const [k, v] of Object.entries(presence ?? {})) out[k] = Array.isArray(v) ? v : [v];
|
|
333
|
+
return out;
|
|
334
|
+
}, [presence]);
|
|
335
|
+
const env = React.useMemo(() => ({
|
|
336
|
+
...DEFAULT_ENV,
|
|
337
|
+
variant,
|
|
338
|
+
docId,
|
|
339
|
+
docTitle: envIn?.docTitle,
|
|
340
|
+
urlPrefix: envIn?.urlPrefix,
|
|
341
|
+
isPublished: envIn?.isPublished ?? (published ? true : void 0),
|
|
342
|
+
slugIsAddress: envIn?.slugIsAddress,
|
|
343
|
+
palette: envIn?.palette ?? DEFAULT_ENV.palette,
|
|
344
|
+
readOnly: !!readOnly,
|
|
345
|
+
can,
|
|
346
|
+
presence: normPresence,
|
|
347
|
+
comments: comments ?? {},
|
|
348
|
+
onComment,
|
|
349
|
+
onOpenReference,
|
|
350
|
+
syncedFrom: envIn?.syncedFrom,
|
|
351
|
+
helpDisplay: envIn?.helpDisplay,
|
|
352
|
+
review,
|
|
353
|
+
fieldChrome: envIn?.fieldChrome,
|
|
354
|
+
controls: envIn?.controls,
|
|
355
|
+
sectionSummary: envIn?.sectionSummary
|
|
356
|
+
}), [
|
|
357
|
+
variant,
|
|
358
|
+
docId,
|
|
359
|
+
envIn?.docTitle,
|
|
360
|
+
envIn?.urlPrefix,
|
|
361
|
+
envIn?.isPublished,
|
|
362
|
+
envIn?.slugIsAddress,
|
|
363
|
+
envIn?.palette,
|
|
364
|
+
envIn?.syncedFrom,
|
|
365
|
+
envIn?.helpDisplay,
|
|
366
|
+
envIn?.fieldChrome,
|
|
367
|
+
envIn?.controls,
|
|
368
|
+
envIn?.sectionSummary,
|
|
369
|
+
published,
|
|
370
|
+
readOnly,
|
|
371
|
+
can,
|
|
372
|
+
normPresence,
|
|
373
|
+
comments,
|
|
374
|
+
onComment,
|
|
375
|
+
onOpenReference,
|
|
376
|
+
review
|
|
377
|
+
]);
|
|
378
|
+
React.useImperativeHandle(navRef, () => ({ back: () => {
|
|
379
|
+
if (frames.length < 2) return false;
|
|
380
|
+
navigate(frames[frames.length - 2].path);
|
|
381
|
+
return true;
|
|
382
|
+
} }), [frames, navigate]);
|
|
383
|
+
const root = React.useRef(null);
|
|
384
|
+
const scroller = React.useRef(null);
|
|
385
|
+
const nav = useFrameNavigation({
|
|
386
|
+
frames,
|
|
387
|
+
navigate,
|
|
388
|
+
root,
|
|
389
|
+
scroller
|
|
390
|
+
});
|
|
391
|
+
const crumbs = framesToCrumbs(frames, schema, api.rollup, rootLabel);
|
|
392
|
+
const crumbSig = crumbSignature(crumbs);
|
|
393
|
+
const onCrumbsRef = React.useRef(onCrumbs);
|
|
394
|
+
onCrumbsRef.current = onCrumbs;
|
|
395
|
+
React.useLayoutEffect(() => {
|
|
396
|
+
onCrumbsRef.current?.(crumbs);
|
|
397
|
+
}, [crumbSig]);
|
|
398
|
+
const syncedNote = envIn?.syncedFrom ? /* @__PURE__ */ jsxs("p", {
|
|
399
|
+
className: "mb-5 flex items-start gap-2 rounded-kit-lg bg-kit-info-soft px-3 py-2 text-kit-xs text-kit-info-fg",
|
|
400
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
401
|
+
className: "mt-0.5 size-1.5 shrink-0 rounded-full bg-kit-info",
|
|
402
|
+
"aria-hidden": true
|
|
403
|
+
}), /* @__PURE__ */ jsxs("span", { children: [
|
|
404
|
+
"Synced from ",
|
|
405
|
+
/* @__PURE__ */ jsx("span", {
|
|
406
|
+
className: "font-medium",
|
|
407
|
+
children: envIn.syncedFrom
|
|
408
|
+
}),
|
|
409
|
+
". Changes here apply on every page that uses it."
|
|
410
|
+
] })]
|
|
411
|
+
}) : null;
|
|
412
|
+
const body = /* @__PURE__ */ jsx(FrameStage, {
|
|
413
|
+
review: !!review,
|
|
414
|
+
frames,
|
|
415
|
+
frameKey: nav.frameKey,
|
|
416
|
+
dir: nav.dir,
|
|
417
|
+
rootLabel: rootLabel ?? schema.title,
|
|
418
|
+
variant,
|
|
419
|
+
before: syncedNote
|
|
420
|
+
});
|
|
421
|
+
return /* @__PURE__ */ jsx(KitEnvProvider, {
|
|
422
|
+
value: env,
|
|
423
|
+
children: /* @__PURE__ */ jsx(FormProvider, {
|
|
424
|
+
value: api,
|
|
425
|
+
children: /* @__PURE__ */ jsx(HiddenLineCtx.Provider, {
|
|
426
|
+
value: hiddenLine,
|
|
427
|
+
children: /* @__PURE__ */ jsx(FrameSlotsProvider, {
|
|
428
|
+
value: hiddenLine ? GHOST_SLOTS : FRAME_SLOTS,
|
|
429
|
+
children: /* @__PURE__ */ jsx(RowsHostContext.Provider, {
|
|
430
|
+
value: ROWS_HOST,
|
|
431
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
432
|
+
ref: root,
|
|
433
|
+
onKeyDown: nav.onKeyDown,
|
|
434
|
+
className: cn("flex min-h-0 min-w-0 flex-col", ownScroll && "h-full", className),
|
|
435
|
+
"data-kit-form": schema.name,
|
|
436
|
+
children: [
|
|
437
|
+
header,
|
|
438
|
+
onCrumbs ? null : /* @__PURE__ */ jsx(FrameCrumbs, {
|
|
439
|
+
crumbs,
|
|
440
|
+
onNavigate: navigate,
|
|
441
|
+
variant
|
|
442
|
+
}),
|
|
443
|
+
ownScroll ? /* @__PURE__ */ jsx("div", {
|
|
444
|
+
ref: scroller,
|
|
445
|
+
className: "@container min-h-0 flex-1 overflow-y-auto overscroll-contain",
|
|
446
|
+
children: body
|
|
447
|
+
}) : /* @__PURE__ */ jsx("div", {
|
|
448
|
+
className: "@container",
|
|
449
|
+
children: body
|
|
450
|
+
})
|
|
451
|
+
]
|
|
452
|
+
})
|
|
453
|
+
})
|
|
454
|
+
})
|
|
455
|
+
})
|
|
456
|
+
})
|
|
457
|
+
});
|
|
458
|
+
}
|
|
459
|
+
//#endregion
|
|
460
|
+
export { COALESCE_MS, SchemaForm, UNDO_STEPS };
|
|
461
|
+
|
|
462
|
+
//# sourceMappingURL=schema-form.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-form.js","names":[],"sources":["../../src/engine/schema-form.tsx"],"sourcesContent":["/**\n * <SchemaForm> — the BetterCMS Block Kit form engine (V2 HEAD 9829bf1 kit/engine/schema-form.tsx). One schema in, one\n * value out; renders through the shared field chrome; owns validation visibility, per-field undo + history (coalesced\n * 900ms, 50 steps), the published baseline (changed dots, Reset to published) and the navigation path.\n *\n * <SchemaForm schema={faq} value={v} onChange={setV} variant=\"panel\" />\n *\n * `path` is controllable so a canvas can sync selection <-> breadcrumb both ways. Frames (root, drilled object, array\n * item, slot block, button, history) come from lib/frames `resolveFrames`; the drill-in stage, crumbs and keys\n * (Esc / Alt+Up/Down) from frame.tsx and breadcrumb.tsx; the layout of each frame from grouping.tsx through field-list.\n *\n * The host provides the kit scope (`data-kit-scope`) around the form; the form never declares one of its own, so a\n * dark host scope is never reset to light inside it.\n */\nimport * as React from \"react\";\nimport { cn } from \"../lib/cn\";\nimport type { FieldPath, FieldSchema, TypeSchema } from \"../schema/types\";\nimport { DEFAULT_ENV, fieldAccessOf, FormProvider, KitEnvProvider, useForm, useKitEnv, visibleSchema, type FormApi, type HistoryEntry, type KitEnv, type KitPeer, type Swatch } from \"../context\";\nimport { resolveFrames } from \"../lib/frames\";\nimport { getIn, isObj, keyStartsWith, pathEq, pathKey, same, setIn } from \"../lib/path\";\nimport { condCtx, isHidden } from \"../lib/schema\";\nimport { collectIssues, type KitIssue } from \"../lib/validate\";\nimport { RowsHostContext } from \"./array\";\nimport { crumbSignature, FrameCrumbs, framesToCrumbs, type KitCrumb } from \"./breadcrumb\";\nimport { FieldList, type FieldListProps } from \"./field-list\";\nimport { FrameSlotsProvider, FrameStage, useFrameNavigation, type FrameSlots } from \"./frame\";\nimport { FieldList as GroupedFieldList, FieldSection } from \"./grouping\";\nimport { KitField, NestedForm } from \"./kit-field\";\nimport { TableFrame } from \"../controls/table/table\";\nimport { ButtonScreen } from \"../controls/button\";\n\nexport interface SchemaFormProps {\n schema: TypeSchema;\n value: Record<string, unknown>;\n onChange: (value: Record<string, unknown>) => void;\n /** controlled navigation path ([] = root). Omit for uncontrolled. */\n path?: FieldPath;\n defaultPath?: FieldPath;\n onPathChange?: (path: FieldPath) => void;\n /** \"panel\" = 320–420px inspector; \"document\" = the wide document editor column */\n variant?: \"panel\" | \"document\";\n /** resolve a block type (slot children) to its schema */\n resolveSchema?: (blockType: string) => TypeSchema | undefined;\n /** blocks offered by \"+ Add block\" (filtered by each slot's allow list) */\n blockLibrary?: TypeSchema[];\n /** the published version: enables changed dots and \"Reset to published\" */\n published?: Record<string, unknown>;\n /**\n * Component instance (CPO D28): values come from `from` unless a top-level key is in `overridden`. Overridden fields\n * get an accent dot + \"Reset\"; inherited ones read muted. `onReset(key)` drops one override.\n */\n inherited?: { from: string; overridden: string[]; onReset: (key: string) => void };\n /** pathKey → teammates in that field (\"items.1.answer\") */\n presence?: Record<string, KitPeer | KitPeer[]>;\n /** pathKey → open comment threads */\n comments?: Record<string, number>;\n /** host comment system. When set, the field comment chip opens the host's popover/panel instead of the kit's. */\n onComment?: KitEnv[\"onComment\"];\n /** \"Open {title}\" on a reference: the host opens the referenced entry (e.g. a stacked panel) */\n onOpenReference?: KitEnv[\"onOpenReference\"];\n /** D61: the host's Review changes markers (while its History panel is open) */\n review?: KitEnv[\"review\"];\n /** the whole form is read-only for the lens (fields with their own `access.edit` still follow `env.can`) */\n readOnly?: boolean;\n /** validate everything now (after a publish attempt) */\n showErrors?: boolean;\n /** document identity + site context */\n env?: {\n docId?: string;\n docTitle?: string;\n urlPrefix?: string;\n isPublished?: boolean;\n /** the slug is the document's address (KitEnv.slugIsAddress) */\n slugIsAddress?: boolean;\n palette?: Swatch[];\n syncedFrom?: string;\n /** D58: the host's access check (`useCan` at the host). Omitted → allow-all (staff tools, demos). */\n can?: KitEnv[\"can\"];\n /** CPO D39: \"tooltip\" moves help lines behind the ⓘ (dense hosts) */\n helpDisplay?: KitEnv[\"helpDisplay\"];\n /** \"quiet\" field chrome for meta-forms (see `KitEnv.fieldChrome`) */\n fieldChrome?: KitEnv[\"fieldChrome\"];\n /** the host's own controls by path key (see `KitEnv.controls`); keep it stable */\n controls?: KitEnv[\"controls\"];\n /** the host's chip summary for collapsed fieldsets (see `KitEnv.sectionSummary`); keep it stable */\n sectionSummary?: KitEnv[\"sectionSummary\"];\n };\n /**\n * Issues the host computes itself (a live check the schema can't express), merged with the form's own. A host issue on a\n * path the form already flags is dropped; `live` ones show while typing; `fix` adds one action after the message.\n */\n extraIssues?: KitIssue[];\n /** The host's access check (V2 `KitEnv.can`), the same as `env.can`; `env.can` wins when both are set. */\n can?: KitEnv[\"can\"];\n /**\n * D70 (V2 `KitEnv.hiddenLine`): keep the fields that would leave the form in place as the host's line instead. `why`\n * says what hid it: \"rule\" (its condition doesn't hold for the current value) or \"access\" (the lens can't `view` it).\n * The schema preview draws its dashed \"Hidden for Editor\" / \"Hidden: …\" lines with it. Absent: hidden fields leave the\n * form, as in every editor. Keep it stable (a new function re-renders the form).\n */\n hiddenLine?: (field: FieldSchema, path: FieldPath, why: HiddenWhy) => React.ReactNode;\n /** own scroll container (default: panel yes, document no) */\n scroll?: boolean;\n /** rendered above the breadcrumb (e.g. a block header) */\n header?: React.ReactNode;\n /** label of the root crumb (defaults to schema.title) */\n rootLabel?: string;\n /**\n * Host-owned trail (CPO D38): the form stops rendering its own breadcrumb and reports the drill-in crumbs\n * instead, so a host with its own path header shows ONE breadcrumb. Navigate with `onPathChange`. Called in a\n * layout effect, so the host header never lags a frame.\n */\n onCrumbs?: (crumbs: KitCrumb[]) => void;\n onIssuesChange?: (issues: KitIssue[]) => void;\n /** imperative navigation for hosts (e.g. a dialog's Escape: go up one level before closing) */\n navRef?: React.Ref<{ back: () => boolean }>;\n className?: string;\n}\n\nexport const COALESCE_MS = 900;\nexport const UNDO_STEPS = 50;\nconst HISTORY_ENTRIES = 30;\n\n/* The frame pieces other lanes own, handed to frame.tsx (which never imports them directly). ButtonScreen (link\n control) and TableFrame (table control) arrive with the controls lanes; until then the header title reads the\n button's label the way V2's `normLink(v).label` does.\n The getters read the imports at render, not at module evaluation: kit-field → array / field-list → schema-form →\n kit-field is a cycle, and an eager read would hit the TDZ the day one of them becomes a const or memo(). */\nconst buttonLabel = (v: unknown) => ({ label: isObj(v) && typeof v.label === \"string\" ? v.label : undefined });\nconst FRAME_SLOTS: FrameSlots = {\n get FieldList() {\n return FieldList;\n },\n get FieldSection() {\n return FieldSection;\n },\n get TableFrame() {\n return TableFrame;\n },\n get ButtonScreen() {\n return ButtonScreen;\n },\n normLink: buttonLabel,\n};\nconst ROWS_HOST = {\n get NestedForm() {\n return NestedForm;\n },\n};\n\n/* ── archived fields leave every form ───────────────────────────────── */\n/** Drop archived fields at every depth (V2 registry: \"What a form renders: archived fields left out (their values stay\n * stored)\"). Same object back when nothing is archived, so a form with none renders exactly as before. */\nfunction liveFields(fields: FieldSchema[]): FieldSchema[] {\n let changed = false;\n const out: FieldSchema[] = [];\n for (const f of fields) {\n if (f.archived) {\n changed = true;\n continue;\n }\n let g = f;\n if (f.fields) {\n const n = liveFields(f.fields);\n if (n !== f.fields) g = { ...g, fields: n };\n }\n if (Array.isArray(f.of)) {\n const n = liveFields(f.of);\n if (n !== f.of) g = { ...g, of: n };\n }\n if (f.slotSettings) {\n const n = liveFields(f.slotSettings);\n if (n !== f.slotSettings) g = { ...g, slotSettings: n };\n }\n if (g !== f) changed = true;\n out.push(g);\n }\n return changed ? out : fields;\n}\nfunction liveSchema(schema: TypeSchema): TypeSchema {\n const fields = liveFields(schema.fields);\n return fields === schema.fields ? schema : { ...schema, fields };\n}\n\n/* ── hiddenLine: hidden fields kept in place as the host's line ──────── */\nexport type HiddenWhy = \"rule\" | \"access\";\nconst GHOST = \"__ghost\";\ntype Ghost = { why: HiddenWhy; field: FieldSchema };\ntype GhostField = FieldSchema & { [GHOST]?: Ghost };\nconst HiddenLineCtx = React.createContext<SchemaFormProps[\"hiddenLine\"]>(undefined);\n\n/** A stand-in that keeps a hidden field's place: no value rules, no condition, nothing to validate or drill into. */\nfunction ghostOf(f: FieldSchema, why: HiddenWhy): GhostField {\n return { name: f.name, title: f.title, type: f.type === \"object\" || f.type === \"array\" || f.type === \"slot\" ? \"string\" : f.type, fieldset: f.fieldset, group: f.group, readOnly: true, [GHOST]: { why, field: f } };\n}\n\n/** `visibleSchema`, except that a field the lens can't view stays as a ghost (top level and inside objects). */\nfunction lensGhosts(schema: TypeSchema, can: KitEnv[\"can\"]): TypeSchema {\n const walk = (fields: FieldSchema[]): FieldSchema[] =>\n fields.map((f) => {\n const a = fieldAccessOf(f);\n if (a?.view && !can(a.view)) return ghostOf(f, \"access\");\n return f.type === \"object\" && f.fields ? { ...f, fields: walk(f.fields) } : f;\n });\n return { ...schema, fields: walk(schema.fields) };\n}\n\n/** The frame's field list with condition-hidden fields kept as ghosts, every ghost drawn by the host's line. */\nfunction GhostFieldList(props: FieldListProps) {\n const form = useForm()!;\n const line = React.useContext(HiddenLineCtx)!;\n const raw = form.getAt(props.basePath);\n const parent = isObj(raw) ? raw : {};\n const cc = condCtx(form, props.basePath);\n const fields = props.fields.map((f) => ((f as GhostField)[GHOST] || f.hidden === true || !isHidden(f, parent, cc) ? f : ghostOf(f, \"rule\")));\n return (\n <GroupedFieldList\n {...props}\n fields={fields}\n renderField={(f, path, p) => {\n const g = (f as GhostField)[GHOST];\n return g ? (\n <div data-field-key={pathKey(path)} data-ghost={g.why}>\n {line(g.field, path, g.why)}\n </div>\n ) : (\n <KitField field={f} path={path} parent={p} />\n );\n }}\n />\n );\n}\nconst GHOST_SLOTS: FrameSlots = {\n get FieldList() {\n return GhostFieldList;\n },\n get FieldSection() {\n return FieldSection;\n },\n get TableFrame() {\n return TableFrame;\n },\n get ButtonScreen() {\n return ButtonScreen;\n },\n normLink: buttonLabel,\n};\n\nexport function SchemaForm({\n schema: schemaIn,\n value,\n onChange,\n path: controlledPath,\n defaultPath,\n onPathChange,\n variant = \"panel\",\n resolveSchema: resolveIn,\n blockLibrary,\n published,\n inherited,\n presence,\n comments,\n onComment,\n onOpenReference,\n review,\n readOnly,\n showErrors = false,\n env: envIn,\n scroll,\n header,\n rootLabel,\n onCrumbs,\n onIssuesChange,\n navRef,\n className,\n can: canIn,\n hiddenLine,\n extraIssues,\n}: SchemaFormProps) {\n const outerCan = useKitEnv().can;\n const can = envIn?.can ?? canIn ?? outerCan; // a nested form (dialog object, article block) inherits its host form's check\n /* D58: fields the lens can't view are dropped from the schema here, once: not rendered, not validated (with\n `hiddenLine`, they stay as ghosts: a place and a line, still nothing to validate) */\n const schema = React.useMemo(() => {\n const live = liveSchema(schemaIn);\n return hiddenLine ? lensGhosts(live, can) : visibleSchema(live, can);\n }, [schemaIn, can, hiddenLine]);\n const resolveSchema = React.useMemo(\n () =>\n resolveIn\n ? (t: string) => {\n const s = resolveIn(t);\n return s && visibleSchema(liveSchema(s), can);\n }\n : undefined,\n [resolveIn, can],\n );\n const docId = envIn?.docId ?? schema.name;\n const ownScroll = scroll ?? variant === \"panel\";\n\n /* value + baseline */\n const valueRef = React.useRef(value);\n valueRef.current = value;\n const [baseline, setBaseline] = React.useState(value);\n const stacks = React.useRef(new Map<string, { path: FieldPath; values: unknown[]; at: number }>());\n const log = React.useRef(new Map<string, HistoryEntry[]>());\n const memory = React.useRef(new Map<string, unknown>());\n const [aiKeys, setAiKeys] = React.useState<Set<string>>(() => new Set());\n const [touched, setTouched] = React.useState<Set<string>>(() => new Set());\n const editing = React.useRef(new Set<string>());\n const [, bump] = React.useReducer((x: number) => x + 1, 0);\n React.useEffect(() => {\n setBaseline(valueRef.current);\n stacks.current.clear();\n log.current.clear();\n memory.current.clear();\n setTouched(new Set());\n setAiKeys(new Set());\n }, [docId]);\n\n /* navigation */\n const [innerPath, setInnerPath] = React.useState<FieldPath>(defaultPath ?? []);\n const rawPath = controlledPath ?? innerPath;\n const { frames, path } = React.useMemo(() => resolveFrames(schema, value, rawPath, resolveSchema), [schema, value, rawPath, resolveSchema]);\n const navigate = React.useCallback(\n (p: FieldPath) => {\n if (controlledPath === undefined) setInnerPath(p);\n onPathChange?.(p);\n },\n [controlledPath, onPathChange],\n );\n /* a path that no longer resolves (a removed item, a hidden field) settles on the deepest frame that does */\n React.useEffect(() => {\n if (!pathEq(path, rawPath)) navigate(path);\n }, [path, rawPath, navigate]);\n /* V2: a new document starts at its root (an uncontrolled path never carries the last document's drill or history).\n Skips the mount run so `defaultPath` survives. */\n const lastDoc = React.useRef(docId);\n React.useEffect(() => {\n if (lastDoc.current === docId) return;\n lastDoc.current = docId;\n if (controlledPath === undefined) setInnerPath([]);\n }, [docId]); // eslint-disable-line react-hooks/exhaustive-deps\n\n /* writes */\n const setAt = React.useCallback<FormApi[\"setAt\"]>(\n (p, v, opts) => {\n const prev = getIn(valueRef.current, p);\n if (same(prev, v)) return;\n const key = pathKey(p);\n if (opts?.record !== false) {\n const now = Date.now();\n const st = stacks.current.get(key) ?? { path: p, values: [], at: 0 };\n if (!st.values.length || now - st.at > COALESCE_MS) st.values = [...st.values, prev].slice(-UNDO_STEPS);\n st.at = now;\n stacks.current.set(key, st);\n const h = log.current.get(key) ?? [];\n const entry: HistoryEntry = { value: v, at: now, by: \"You\", label: opts?.label };\n log.current.set(key, h.length && now - h[0].at < COALESCE_MS && !opts?.label ? [entry, ...h.slice(1)] : [entry, ...h].slice(0, HISTORY_ENTRIES));\n editing.current.add(key);\n }\n const next = setIn(valueRef.current, p, v);\n valueRef.current = next;\n onChange(next);\n },\n [onChange],\n );\n\n /* validation */\n const issueList = React.useMemo(() => {\n const own = collectIssues(schema.fields, value, [], resolveSchema);\n return extraIssues?.length ? [...own, ...extraIssues.filter((x) => !own.some((o) => o.key === x.key))] : own;\n }, [schema, value, resolveSchema, extraIssues]);\n const issues = React.useMemo(() => new Map(issueList.map((i) => [i.key, i])), [issueList]);\n React.useEffect(() => onIssuesChange?.(issueList), [issueList, onIssuesChange]);\n const isVisible = React.useCallback(\n (i: KitIssue) => showErrors || !!i.live || touched.has(i.key) || (i.kind === \"rule\" && !editing.current.has(i.key)),\n [showErrors, touched],\n );\n\n const api: FormApi = {\n schema,\n value,\n setAt,\n getAt: (p) => getIn(value, p),\n baselineAt: (p) => getIn(baseline, p),\n publishedAt: (p) => getIn(published, p),\n hasPublished: !!published,\n inherited: inherited ? { from: inherited.from, isOverridden: (k) => inherited.overridden.includes(k), reset: inherited.onReset } : undefined,\n path,\n navigate,\n canNavigate: true,\n resolveSchema,\n blockLibrary,\n issues,\n visibleIssue: (k) => {\n const i = issues.get(k);\n return i && isVisible(i) ? i : undefined;\n },\n rollup: (prefix) => {\n const pk = pathKey(prefix);\n let errors = 0;\n let warnings = 0;\n for (const i of issueList) if (keyStartsWith(i.key, pk) && isVisible(i)) i.level === \"error\" ? errors++ : warnings++;\n return { errors, warnings };\n },\n touch: (k) => {\n editing.current.delete(k);\n if (!touched.has(k)) setTouched((s) => new Set(s).add(k));\n },\n showAllErrors: showErrors,\n canUndo: (k) => !!stacks.current.get(k)?.values.length,\n undo: (k) => {\n const st = stacks.current.get(k);\n if (!st?.values.length) return;\n const prev = st.values[st.values.length - 1];\n st.values = st.values.slice(0, -1);\n st.at = 0;\n const next = setIn(valueRef.current, st.path, prev);\n valueRef.current = next;\n onChange(next);\n bump();\n },\n history: (k) => log.current.get(k) ?? [],\n aiKeys,\n markAi: (k, on) =>\n setAiKeys((s) => {\n const n = new Set(s);\n if (on) n.add(k);\n else n.delete(k);\n return n;\n }),\n memory: memory.current,\n };\n\n const normPresence = React.useMemo(() => {\n const out: Record<string, KitPeer[]> = {};\n for (const [k, v] of Object.entries(presence ?? {})) out[k] = Array.isArray(v) ? v : [v];\n return out;\n }, [presence]);\n const env: KitEnv = React.useMemo(\n () => ({\n ...DEFAULT_ENV,\n variant,\n docId,\n docTitle: envIn?.docTitle,\n urlPrefix: envIn?.urlPrefix,\n /* a published copy proves \"live\"; its absence proves nothing (the dock has none), so it stays unknown */\n isPublished: envIn?.isPublished ?? (published ? true : undefined),\n slugIsAddress: envIn?.slugIsAddress,\n palette: envIn?.palette ?? DEFAULT_ENV.palette,\n readOnly: !!readOnly,\n can,\n presence: normPresence,\n comments: comments ?? {},\n onComment,\n onOpenReference,\n syncedFrom: envIn?.syncedFrom,\n helpDisplay: envIn?.helpDisplay,\n review,\n fieldChrome: envIn?.fieldChrome,\n controls: envIn?.controls,\n sectionSummary: envIn?.sectionSummary,\n }),\n [variant, docId, envIn?.docTitle, envIn?.urlPrefix, envIn?.isPublished, envIn?.slugIsAddress, envIn?.palette, envIn?.syncedFrom, envIn?.helpDisplay, envIn?.fieldChrome, envIn?.controls, envIn?.sectionSummary, published, readOnly, can, normPresence, comments, onComment, onOpenReference, review],\n );\n\n React.useImperativeHandle(\n navRef,\n () => ({\n back: () => {\n if (frames.length < 2) return false;\n navigate(frames[frames.length - 2].path);\n return true;\n },\n }),\n [frames, navigate],\n );\n\n /* drill-in stage: direction-aware slide, scroll memory, focus on the entering frame, Esc / Alt+Up/Down */\n const root = React.useRef<HTMLDivElement>(null);\n const scroller = React.useRef<HTMLDivElement>(null);\n const nav = useFrameNavigation({ frames, navigate, root, scroller });\n\n const crumbs = framesToCrumbs(frames, schema, api.rollup, rootLabel);\n const crumbSig = crumbSignature(crumbs);\n const onCrumbsRef = React.useRef(onCrumbs);\n onCrumbsRef.current = onCrumbs;\n React.useLayoutEffect(() => {\n onCrumbsRef.current?.(crumbs);\n }, [crumbSig]); // eslint-disable-line react-hooks/exhaustive-deps\n\n const syncedNote = envIn?.syncedFrom ? (\n <p className=\"mb-5 flex items-start gap-2 rounded-kit-lg bg-kit-info-soft px-3 py-2 text-kit-xs text-kit-info-fg\">\n <span className=\"mt-0.5 size-1.5 shrink-0 rounded-full bg-kit-info\" aria-hidden />\n <span>\n Synced from <span className=\"font-medium\">{envIn.syncedFrom}</span>. Changes here apply on every page that uses it.\n </span>\n </p>\n ) : null;\n const body = <FrameStage review={!!review} frames={frames} frameKey={nav.frameKey} dir={nav.dir} rootLabel={rootLabel ?? schema.title} variant={variant} before={syncedNote} />;\n\n return (\n <KitEnvProvider value={env}>\n <FormProvider value={api}>\n <HiddenLineCtx.Provider value={hiddenLine}>\n <FrameSlotsProvider value={hiddenLine ? GHOST_SLOTS : FRAME_SLOTS}>\n <RowsHostContext.Provider value={ROWS_HOST}>\n <div ref={root} onKeyDown={nav.onKeyDown} className={cn(\"flex min-h-0 min-w-0 flex-col\", ownScroll && \"h-full\", className)} data-kit-form={schema.name}>\n {header}\n {onCrumbs ? null : <FrameCrumbs crumbs={crumbs} onNavigate={navigate} variant={variant} />}\n {ownScroll ? (\n <div ref={scroller} className=\"@container min-h-0 flex-1 overflow-y-auto overscroll-contain\">\n {body}\n </div>\n ) : (\n <div className=\"@container\">{body}</div>\n )}\n </div>\n </RowsHostContext.Provider>\n </FrameSlotsProvider>\n </HiddenLineCtx.Provider>\n </FormProvider>\n </KitEnvProvider>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuHA,IAAa,cAAc;AAC3B,IAAa,aAAa;AAC1B,IAAM,kBAAkB;AAOxB,IAAM,eAAe,OAAgB,EAAE,OAAO,MAAM,CAAC,KAAK,OAAO,EAAE,UAAU,WAAW,EAAE,QAAQ,KAAA,EAAU;AAC5G,IAAM,cAA0B;CAC9B,IAAI,YAAY;EACd,OAAO;CACT;CACA,IAAI,eAAe;EACjB,OAAO;CACT;CACA,IAAI,aAAa;EACf,OAAO;CACT;CACA,IAAI,eAAe;EACjB,OAAO;CACT;CACA,UAAU;AACZ;AACA,IAAM,YAAY,EAChB,IAAI,aAAa;CACf,OAAO;AACT,EACF;;;AAKA,SAAS,WAAW,QAAsC;CACxD,IAAI,UAAU;CACd,MAAM,MAAqB,CAAC;CAC5B,KAAK,MAAM,KAAK,QAAQ;EACtB,IAAI,EAAE,UAAU;GACd,UAAU;GACV;EACF;EACA,IAAI,IAAI;EACR,IAAI,EAAE,QAAQ;GACZ,MAAM,IAAI,WAAW,EAAE,MAAM;GAC7B,IAAI,MAAM,EAAE,QAAQ,IAAI;IAAE,GAAG;IAAG,QAAQ;GAAE;EAC5C;EACA,IAAI,MAAM,QAAQ,EAAE,EAAE,GAAG;GACvB,MAAM,IAAI,WAAW,EAAE,EAAE;GACzB,IAAI,MAAM,EAAE,IAAI,IAAI;IAAE,GAAG;IAAG,IAAI;GAAE;EACpC;EACA,IAAI,EAAE,cAAc;GAClB,MAAM,IAAI,WAAW,EAAE,YAAY;GACnC,IAAI,MA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B;EAAQ,UAAU,IAAI;EAAU,KAAK,IAAI;EAAK,WAAW,aAAa,OAAO;EAAgB;EAAS,QAAQ;CAAa,CAAA;CAE9K,OACE,oBAAC,gBAAD;EAAgB,OAAO;EACrB,UAAA,oBAAC,cAAD;GAAc,OAAO;GACnB,UAAA,oBAAC,cAAc,UAAf;IAAwB,OAAO;IAC/B,UAAA,oBAAC,oBAAD;KAAoB,OAAO,aAAa,cAAc;KACpD,UAAA,oBAAC,gBAAgB,UAAjB;MAA0B,OAAO;MAC/B,UAAA,qBAAC,OAAD;OAAK,KAAK;OAAM,WAAW,IAAI;OAAW,WAAW,GAAG,iCAAiC,aAAa,UAAU,SAAS;OAAG,iBAAe,OAAO;OAAlJ,UAAA;QACG;QACA,WAAW,OAAO,oBAAC,aAAD;SAAqB;SAAQ,YAAY;SAAmB;QAAU,CAAA;QACxF,YACC,oBAAC,OAAD;SAAK,KAAK;SAAU,WAAU;SAC3B,UAAA;QACE,CAAA,IAEL,oBAAC,OAAD;SAAK,WAAU;SAAc,UAAA;QAAU,CAAA;OAEtC;;KACmB,CAAA;IACR,CAAA;GACI,CAAA;EACZ,CAAA;CACA,CAAA;AAEpB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { FieldPath, FieldSchema, TypeSchema } from "../schema/types";
|
|
2
|
+
export declare function SlotField({ field, path }: {
|
|
3
|
+
field: FieldSchema;
|
|
4
|
+
path: FieldPath;
|
|
5
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
/** Blocks this slot accepts: its allow list resolved through `resolveSchema`, else the whole block library. */
|
|
7
|
+
export declare function useAvailableBlocks(field: FieldSchema): TypeSchema[];
|
|
8
|
+
export declare function BlockPicker({ blocks, onPick, disabled, label }: {
|
|
9
|
+
blocks: TypeSchema[];
|
|
10
|
+
onPick: (b: TypeSchema) => void;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
label?: string;
|
|
13
|
+
}): import("react/jsx-runtime").JSX.Element;
|