@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,56 @@
|
|
|
1
|
+
//#region src/schema/help.ts
|
|
2
|
+
var TEXT = ["string", "text"];
|
|
3
|
+
/** Conventions by field name. Each says something the label and the control cannot. */
|
|
4
|
+
var RULES = [
|
|
5
|
+
{
|
|
6
|
+
names: ["excerpt", "summary"],
|
|
7
|
+
types: TEXT,
|
|
8
|
+
help: "Shown on cards and in search results."
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
names: ["alt"],
|
|
12
|
+
types: TEXT,
|
|
13
|
+
help: "Read by screen readers and search engines, not shown on the page."
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
names: ["anchor"],
|
|
17
|
+
types: TEXT,
|
|
18
|
+
help: "Lowercase with no spaces, so links like /about#team can jump here."
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
names: ["coverImage", "cover"],
|
|
22
|
+
types: ["image"],
|
|
23
|
+
help: "Also used on cards and in link previews."
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
names: [
|
|
27
|
+
"published",
|
|
28
|
+
"publishedAt",
|
|
29
|
+
"publishDate"
|
|
30
|
+
],
|
|
31
|
+
types: ["date", "datetime"],
|
|
32
|
+
help: "Also used to sort lists."
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
names: ["readingTime"],
|
|
36
|
+
types: ["number"],
|
|
37
|
+
help: "In minutes."
|
|
38
|
+
}
|
|
39
|
+
];
|
|
40
|
+
/** Conventions by field TYPE (any name). Only consequences the editor cannot see; no advice, no restating. */
|
|
41
|
+
var BY_TYPE = { slug: "Once live, changing it offers a redirect from the old address." };
|
|
42
|
+
/** The convention for a field, or undefined. Does not look at `description`; callers decide precedence. */
|
|
43
|
+
/** Every help line the kit itself may print — the tone test's seam, not the rule tables. */
|
|
44
|
+
var HELP_STRINGS = [...RULES.map((r) => r.help), ...Object.values(BY_TYPE)];
|
|
45
|
+
function conventionalHelp(field) {
|
|
46
|
+
return RULES.find((r) => r.names.includes(field.name) && (!r.types || r.types.includes(field.type)))?.help ?? BY_TYPE[field.type];
|
|
47
|
+
}
|
|
48
|
+
/** Help for a field following D39 precedence. `computed` is the field's own derived line (slug, number range). */
|
|
49
|
+
function resolveHelp(field, computed) {
|
|
50
|
+
if (field.description !== void 0) return field.description || void 0;
|
|
51
|
+
return computed ?? conventionalHelp(field);
|
|
52
|
+
}
|
|
53
|
+
//#endregion
|
|
54
|
+
export { HELP_STRINGS, conventionalHelp, resolveHelp };
|
|
55
|
+
|
|
56
|
+
//# sourceMappingURL=help.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"help.js","names":[],"sources":["../../src/schema/help.ts"],"sourcesContent":["/**\n * FIELD HELP — CPO D39, narrowed by D51 \"Help text is the exception\". One place for the grey line under a label.\n *\n * Precedence (first match wins):\n * 1. `field.description` written on the schema. `\"\"` opts out on purpose.\n * 2. A computed line from the field's own settings (slug before publish, number ranges).\n * 3. A convention from this file, matched on field NAME + TYPE. Only facts that are true for that field in every\n * block live here, and only facts the editor cannot see from the label and the control.\n *\n * The rule (D51, enforced by scripts/brain/check-help.ts):\n * - Most fields get NO help. Ask: \"Does the editor need this to type the right value?\" If no, no help.\n * - Allowed: a non-obvious format or unit (\"In minutes.\", \"A .vtt file.\"), where it shows when the canvas can't\n * show it (\"Shown in search results.\"), a real constraint or consequence (\"Changing it once live breaks links.\"),\n * a fallback (\"Leave empty to use the page title.\").\n * - Never: restating the label, writing advice (\"Keep it short\", \"Start with a verb\", \"2–4 words\"), marketing\n * theory, internal or design-system notes (\"Label and link are one unit\"), examples that belong in `placeholder`.\n * - Length guidance is a counter (`validation.max` / `recommendedMax`), never a sentence.\n * - One short sentence, under 90 characters, no em dash. Anything longer goes in `helpMore` (the ⓘ), sparingly.\n * - No type-wide defaults: a heading, a button or an image gets nothing just for being one.\n */\nimport type { FieldSchema } from \"./types\";\n\ntype Rule = { names: string[]; types?: FieldSchema[\"type\"][]; help: string };\n\nconst TEXT: FieldSchema[\"type\"][] = [\"string\", \"text\"];\n\n/** Conventions by field name. Each says something the label and the control cannot. */\nconst RULES: Rule[] = [\n { names: [\"excerpt\", \"summary\"], types: TEXT, help: \"Shown on cards and in search results.\" },\n { names: [\"alt\"], types: TEXT, help: \"Read by screen readers and search engines, not shown on the page.\" },\n // No SEO conventions (metaTitle, metaDescription, canonical, noindex, schemaType): SEO is native, never a modelled field.\n { names: [\"anchor\"], types: TEXT, help: \"Lowercase with no spaces, so links like /about#team can jump here.\" },\n { names: [\"coverImage\", \"cover\"], types: [\"image\"], help: \"Also used on cards and in link previews.\" },\n { names: [\"published\", \"publishedAt\", \"publishDate\"], types: [\"date\", \"datetime\"], help: \"Also used to sort lists.\" },\n { names: [\"readingTime\"], types: [\"number\"], help: \"In minutes.\" },\n];\n\n/** Conventions by field TYPE (any name). Only consequences the editor cannot see; no advice, no restating. */\nconst BY_TYPE: Partial<Record<FieldSchema[\"type\"], string>> = {\n slug: \"Once live, changing it offers a redirect from the old address.\",\n};\n\n/** The convention for a field, or undefined. Does not look at `description`; callers decide precedence. */\n/** Every help line the kit itself may print — the tone test's seam, not the rule tables. */\nexport const HELP_STRINGS: readonly string[] = [...RULES.map((r) => r.help), ...Object.values(BY_TYPE)];\n\nexport function conventionalHelp(field: Pick<FieldSchema, \"name\" | \"type\">): string | undefined {\n const rule = RULES.find((r) => r.names.includes(field.name) && (!r.types || r.types.includes(field.type)));\n return rule?.help ?? BY_TYPE[field.type];\n}\n\n/** Help for a field following D39 precedence. `computed` is the field's own derived line (slug, number range). */\nexport function resolveHelp(field: FieldSchema, computed?: string): string | undefined {\n if (field.description !== undefined) return field.description || undefined; // \"\" = deliberately none\n return computed ?? conventionalHelp(field);\n}\n"],"mappings":";AAwBA,IAAM,OAA8B,CAAC,UAAU,MAAM;;AAGrD,IAAM,QAAgB;CACpB;EAAE,OAAO,CAAC,WAAW,SAAS;EAAG,OAAO;EAAM,MAAM;CAAwC;CAC5F;EAAE,OAAO,CAAC,KAAK;EAAG,OAAO;EAAM,MAAM;CAAoE;CAEzG;EAAE,OAAO,CAAC,QAAQ;EAAG,OAAO;EAAM,MAAM;CAAqE;CAC7G;EAAE,OAAO,CAAC,cAAc,OAAO;EAAG,OAAO,CAAC,OAAO;EAAG,MAAM;CAA2C;CACrG;EAAE,OAAO;GAAC;GAAa;GAAe;EAAa;EAAG,OAAO,CAAC,QAAQ,UAAU;EAAG,MAAM;CAA2B;CACpH;EAAE,OAAO,CAAC,aAAa;EAAG,OAAO,CAAC,QAAQ;EAAG,MAAM;CAAc;AACnE;;AAGA,IAAM,UAAwD,EAC5D,MAAM,iEACR;;;AAIA,IAAa,eAAkC,CAAC,GAAG,MAAM,KAAK,MAAM,EAAE,IAAI,GAAG,GAAG,OAAO,OAAO,OAAO,CAAC;AAEtG,SAAgB,iBAAiB,OAA+D;CAE9F,OADa,MAAM,MAAM,MAAM,EAAE,MAAM,SAAS,MAAM,IAAI,MAAM,CAAC,EAAE,SAAS,EAAE,MAAM,SAAS,MAAM,IAAI,EAChG,CAAA,EAAM,QAAQ,QAAQ,MAAM;AACrC;;AAGA,SAAgB,YAAY,OAAoB,UAAuC;CACrF,IAAI,MAAM,gBAAgB,KAAA,GAAW,OAAO,MAAM,eAAe,KAAA;CACjE,OAAO,YAAY,iBAAiB,KAAK;AAC3C"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SCALES (CPO D41) — the logic behind "fixed steps, with an optional custom escape hatch".
|
|
3
|
+
* Pure functions: the Block Kit control, the Visuals Design tab and site renderers all read values through here,
|
|
4
|
+
* so a token, a stepped number and a custom size resolve the same way everywhere.
|
|
5
|
+
*
|
|
6
|
+
* Stored shapes (see `ScaleValue` in ./types):
|
|
7
|
+
* "xl" → token (developers map it to their design system)
|
|
8
|
+
* 15 → number on a stepped range, in the scale's default unit
|
|
9
|
+
* { value: 200, unit: "px" } → custom (only when the field allows custom)
|
|
10
|
+
*/
|
|
11
|
+
import type { FieldSchema, ScaleCustomValue, ScaleRange, ScaleSchema, ScaleStep, ScaleUnit, ScaleValue } from "./types";
|
|
12
|
+
export declare const SCALE_UNITS: ScaleUnit[];
|
|
13
|
+
export declare const UNIT_NAMES: Record<ScaleUnit, string>;
|
|
14
|
+
export declare const isCustomValue: (v: unknown) => v is ScaleCustomValue;
|
|
15
|
+
export declare const isTokenScale: (s: ScaleSchema) => s is ScaleSchema & {
|
|
16
|
+
steps: ScaleStep[];
|
|
17
|
+
};
|
|
18
|
+
export declare const rangeOf: (s: ScaleSchema) => ScaleRange | null;
|
|
19
|
+
/** Back-compat: `layout: "slider"` + `numeric: { min, max, step, unit }` → a fixed-only range scale. */
|
|
20
|
+
export declare function fieldScale(field: Pick<FieldSchema, "scale" | "layout" | "numeric">): ScaleSchema | null;
|
|
21
|
+
export declare const defaultUnit: (s: ScaleSchema) => ScaleUnit | undefined;
|
|
22
|
+
/** The custom rules, or null when the field is fixed only. */
|
|
23
|
+
export declare function customRules(s: ScaleSchema): {
|
|
24
|
+
units: ScaleUnit[];
|
|
25
|
+
step: number;
|
|
26
|
+
min: (u: ScaleUnit) => number | undefined;
|
|
27
|
+
max: (u: ScaleUnit) => number | undefined;
|
|
28
|
+
} | null;
|
|
29
|
+
export declare function roundTo(n: number, step: number): number;
|
|
30
|
+
/** Readable number + unit: "200px", "15%", "1.5rem", "4.9". */
|
|
31
|
+
export declare function formatNumber(n: number, unit?: string): string;
|
|
32
|
+
/** px for a custom value when it can be known without layout (px, rem/em at 16). */
|
|
33
|
+
export declare function customPx(v: ScaleCustomValue): number | undefined;
|
|
34
|
+
export interface ResolvedScale {
|
|
35
|
+
kind: "token" | "number" | "custom" | "empty";
|
|
36
|
+
/** short readout: "XL", "15%", "200px" */
|
|
37
|
+
label: string;
|
|
38
|
+
/** long name: "Extra large", "15%", "Custom" */
|
|
39
|
+
title: string;
|
|
40
|
+
/** CSS to emit ("48px", "15%", "200px", or a step's css) */
|
|
41
|
+
css?: string;
|
|
42
|
+
px?: number;
|
|
43
|
+
/** token index (token scales) */
|
|
44
|
+
index?: number;
|
|
45
|
+
/** spoken value for aria-valuetext: "Extra large, 48 pixels" */
|
|
46
|
+
spoken: string;
|
|
47
|
+
}
|
|
48
|
+
/** Resolve any stored value against its scale. Unknown tokens fall back to "empty" (never throws). */
|
|
49
|
+
export declare function resolveScale(s: ScaleSchema, v: unknown, legacyUnit?: string): ResolvedScale;
|
|
50
|
+
/** CSS for a stored value — what a site renderer emits. */
|
|
51
|
+
export declare const scaleCss: (s: ScaleSchema, v: unknown) => string | undefined;
|
|
52
|
+
/** "XL · 48px" — the hint shown for a token. */
|
|
53
|
+
export declare function scaleHint(r: ResolvedScale): string;
|
|
54
|
+
/** Index of the token nearest to a custom value (by px), or -1 when it can't be placed. */
|
|
55
|
+
export declare function nearestTokenIndex(s: ScaleSchema, v: ScaleCustomValue): number;
|
|
56
|
+
export type ParseResult = {
|
|
57
|
+
ok: true;
|
|
58
|
+
value: ScaleValue;
|
|
59
|
+
} | {
|
|
60
|
+
ok: false;
|
|
61
|
+
error: string;
|
|
62
|
+
};
|
|
63
|
+
/** Validate a custom value against the field's custom rules. Returns a plain-words error or null. */
|
|
64
|
+
export declare function validateCustom(s: ScaleSchema, v: ScaleCustomValue): string | null;
|
|
65
|
+
/**
|
|
66
|
+
* Parse what an editor typed: a token ("xl", "XL", "Extra large"), a number ("240" → default unit) or a number with
|
|
67
|
+
* a unit ("200px", "75 %", "1.5rem"). Exact px matches of a token snap to the token, so the design system wins.
|
|
68
|
+
*/
|
|
69
|
+
export declare function parseScaleInput(s: ScaleSchema, text: string, unitHint?: ScaleUnit): ParseResult;
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
//#region src/schema/scale.ts
|
|
2
|
+
var SCALE_UNITS = [
|
|
3
|
+
"px",
|
|
4
|
+
"%",
|
|
5
|
+
"rem",
|
|
6
|
+
"em",
|
|
7
|
+
"vw",
|
|
8
|
+
"vh"
|
|
9
|
+
];
|
|
10
|
+
var isUnit = (u) => typeof u === "string" && SCALE_UNITS.includes(u);
|
|
11
|
+
/** Spoken unit names for aria-valuetext ("48 pixels"). */
|
|
12
|
+
var UNIT_WORDS = {
|
|
13
|
+
px: ["pixel", "pixels"],
|
|
14
|
+
"%": ["percent", "percent"],
|
|
15
|
+
rem: ["rem", "rem"],
|
|
16
|
+
em: ["em", "em"],
|
|
17
|
+
vw: ["percent of the screen width", "percent of the screen width"],
|
|
18
|
+
vh: ["percent of the screen height", "percent of the screen height"]
|
|
19
|
+
};
|
|
20
|
+
var UNIT_NAMES = {
|
|
21
|
+
px: "Pixels",
|
|
22
|
+
"%": "Percent",
|
|
23
|
+
rem: "Root em",
|
|
24
|
+
em: "Em",
|
|
25
|
+
vw: "Screen width",
|
|
26
|
+
vh: "Screen height"
|
|
27
|
+
};
|
|
28
|
+
var isCustomValue = (v) => !!v && typeof v === "object" && typeof v.value === "number" && isUnit(v.unit);
|
|
29
|
+
var isTokenScale = (s) => Array.isArray(s.steps);
|
|
30
|
+
var rangeOf = (s) => Array.isArray(s.steps) ? null : s.steps;
|
|
31
|
+
/** Back-compat: `layout: "slider"` + `numeric: { min, max, step, unit }` → a fixed-only range scale. */
|
|
32
|
+
function fieldScale(field) {
|
|
33
|
+
if (field.scale) return field.scale;
|
|
34
|
+
const n = field.numeric;
|
|
35
|
+
if (field.layout === "slider" && n?.min != null && n?.max != null) return {
|
|
36
|
+
steps: {
|
|
37
|
+
min: n.min,
|
|
38
|
+
max: n.max,
|
|
39
|
+
step: n.step ?? 1
|
|
40
|
+
},
|
|
41
|
+
units: isUnit(n.unit) ? [n.unit] : void 0
|
|
42
|
+
};
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
var defaultUnit = (s) => s.defaultUnit ?? s.units?.[0];
|
|
46
|
+
/** The custom rules, or null when the field is fixed only. */
|
|
47
|
+
function customRules(s) {
|
|
48
|
+
if (!s.allowCustom) return null;
|
|
49
|
+
const c = s.allowCustom === true ? {} : s.allowCustom;
|
|
50
|
+
const units = c.units ?? s.units ?? ["px"];
|
|
51
|
+
const pick = (b, u) => typeof b === "number" ? b : b?.[u];
|
|
52
|
+
return {
|
|
53
|
+
units,
|
|
54
|
+
step: c.step ?? 1,
|
|
55
|
+
min: (u) => pick(c.min, u),
|
|
56
|
+
max: (u) => pick(c.max, u)
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
var decimals = (n) => (String(n).split(".")[1] ?? "").length;
|
|
60
|
+
function roundTo(n, step) {
|
|
61
|
+
return Number((Math.round(n / step) * step).toFixed(Math.max(decimals(step), 0)));
|
|
62
|
+
}
|
|
63
|
+
/** Readable number + unit: "200px", "15%", "1.5rem", "4.9". */
|
|
64
|
+
function formatNumber(n, unit) {
|
|
65
|
+
const t = Number.isInteger(n) ? String(n) : String(Number(n.toFixed(3)));
|
|
66
|
+
if (!unit) return t;
|
|
67
|
+
return isUnit(unit) ? `${t}${unit}` : `${t} ${unit}`;
|
|
68
|
+
}
|
|
69
|
+
/** px for a custom value when it can be known without layout (px, rem/em at 16). */
|
|
70
|
+
function customPx(v) {
|
|
71
|
+
if (v.unit === "px") return v.value;
|
|
72
|
+
if (v.unit === "rem" || v.unit === "em") return v.value * 16;
|
|
73
|
+
}
|
|
74
|
+
function spokenNumber(n, unit) {
|
|
75
|
+
if (!unit) return String(n);
|
|
76
|
+
if (!isUnit(unit)) return `${n} ${unit}`;
|
|
77
|
+
const [one, many] = UNIT_WORDS[unit];
|
|
78
|
+
return `${n} ${n === 1 ? one : many}`;
|
|
79
|
+
}
|
|
80
|
+
/** Resolve any stored value against its scale. Unknown tokens fall back to "empty" (never throws). */
|
|
81
|
+
function resolveScale(s, v, legacyUnit) {
|
|
82
|
+
if (isCustomValue(v)) {
|
|
83
|
+
const px = customPx(v);
|
|
84
|
+
return {
|
|
85
|
+
kind: "custom",
|
|
86
|
+
label: formatNumber(v.value, v.unit),
|
|
87
|
+
title: "Custom",
|
|
88
|
+
css: `${v.value}${v.unit}`,
|
|
89
|
+
px,
|
|
90
|
+
spoken: `Custom, ${spokenNumber(v.value, v.unit)}`
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
if (isTokenScale(s)) {
|
|
94
|
+
const i = s.steps.findIndex((st) => st.value === v);
|
|
95
|
+
if (i < 0) return {
|
|
96
|
+
kind: "empty",
|
|
97
|
+
label: "—",
|
|
98
|
+
title: "Not set",
|
|
99
|
+
spoken: "Not set"
|
|
100
|
+
};
|
|
101
|
+
const st = s.steps[i];
|
|
102
|
+
const title = st.title ?? st.label;
|
|
103
|
+
const css = st.css ?? (st.px != null ? `${st.px}px` : void 0);
|
|
104
|
+
return {
|
|
105
|
+
kind: "token",
|
|
106
|
+
label: st.label,
|
|
107
|
+
title,
|
|
108
|
+
css,
|
|
109
|
+
px: st.px,
|
|
110
|
+
index: i,
|
|
111
|
+
spoken: st.px != null ? `${title}, ${spokenNumber(st.px, "px")}` : st.css ? `${title}, ${st.css}` : title
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
const unit = defaultUnit(s) ?? legacyUnit;
|
|
115
|
+
const n = typeof v === "number" ? v : typeof v === "string" && v.trim() !== "" && !Number.isNaN(Number(v)) ? Number(v) : null;
|
|
116
|
+
if (n == null) return {
|
|
117
|
+
kind: "empty",
|
|
118
|
+
label: "—",
|
|
119
|
+
title: "Not set",
|
|
120
|
+
spoken: "Not set"
|
|
121
|
+
};
|
|
122
|
+
const css = isUnit(unit) ? `${n}${unit}` : String(n);
|
|
123
|
+
return {
|
|
124
|
+
kind: "number",
|
|
125
|
+
label: formatNumber(n, unit),
|
|
126
|
+
title: formatNumber(n, unit),
|
|
127
|
+
css,
|
|
128
|
+
px: unit === "px" ? n : void 0,
|
|
129
|
+
spoken: spokenNumber(n, unit)
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
/** CSS for a stored value — what a site renderer emits. */
|
|
133
|
+
var scaleCss = (s, v) => resolveScale(s, v).css;
|
|
134
|
+
/** "XL · 48px" — the hint shown for a token. */
|
|
135
|
+
function scaleHint(r) {
|
|
136
|
+
if (r.kind === "token") return r.css ? `${r.title} · ${r.css}` : r.title;
|
|
137
|
+
if (r.kind === "custom") return `Custom · ${r.label}`;
|
|
138
|
+
return r.title;
|
|
139
|
+
}
|
|
140
|
+
/** Index of the token nearest to a custom value (by px), or -1 when it can't be placed. */
|
|
141
|
+
function nearestTokenIndex(s, v) {
|
|
142
|
+
if (!isTokenScale(s)) return -1;
|
|
143
|
+
const px = customPx(v);
|
|
144
|
+
if (px == null) return -1;
|
|
145
|
+
let best = -1;
|
|
146
|
+
let d = Infinity;
|
|
147
|
+
s.steps.forEach((st, i) => {
|
|
148
|
+
if (st.px == null) return;
|
|
149
|
+
const dd = Math.abs(st.px - px);
|
|
150
|
+
if (dd < d) d = dd, best = i;
|
|
151
|
+
});
|
|
152
|
+
return best;
|
|
153
|
+
}
|
|
154
|
+
/** Validate a custom value against the field's custom rules. Returns a plain-words error or null. */
|
|
155
|
+
function validateCustom(s, v) {
|
|
156
|
+
const c = customRules(s);
|
|
157
|
+
if (!c) return "Pick a value on the scale.";
|
|
158
|
+
if (!c.units.includes(v.unit)) return `Use ${listUnits(c.units)}.`;
|
|
159
|
+
const lo = c.min(v.unit);
|
|
160
|
+
const hi = c.max(v.unit);
|
|
161
|
+
if (lo != null && v.value < lo || hi != null && v.value > hi) {
|
|
162
|
+
if (lo != null && hi != null) return `Use ${formatNumber(lo)}–${formatNumber(hi, v.unit)}.`;
|
|
163
|
+
if (lo != null) return `Use ${formatNumber(lo, v.unit)} or more.`;
|
|
164
|
+
return `Use ${formatNumber(hi, v.unit)} or less.`;
|
|
165
|
+
}
|
|
166
|
+
return null;
|
|
167
|
+
}
|
|
168
|
+
var listUnits = (u) => u.length === 1 ? u[0] : `${u.slice(0, -1).join(", ")} or ${u[u.length - 1]}`;
|
|
169
|
+
/**
|
|
170
|
+
* Parse what an editor typed: a token ("xl", "XL", "Extra large"), a number ("240" → default unit) or a number with
|
|
171
|
+
* a unit ("200px", "75 %", "1.5rem"). Exact px matches of a token snap to the token, so the design system wins.
|
|
172
|
+
*/
|
|
173
|
+
function parseScaleInput(s, text, unitHint) {
|
|
174
|
+
const t = text.trim();
|
|
175
|
+
if (!t) return {
|
|
176
|
+
ok: false,
|
|
177
|
+
error: "Type a value, like 240px."
|
|
178
|
+
};
|
|
179
|
+
const low = t.toLowerCase();
|
|
180
|
+
if (isTokenScale(s)) {
|
|
181
|
+
const st = s.steps.find((x) => x.value.toLowerCase() === low || x.label.toLowerCase() === low || x.title?.toLowerCase() === low);
|
|
182
|
+
if (st) return {
|
|
183
|
+
ok: true,
|
|
184
|
+
value: st.value
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
const m = /^(-?(?:\d+(?:\.\d+)?|\.\d+))\s*(px|%|rem|em|vw|vh)?$/i.exec(t);
|
|
188
|
+
if (!m) return {
|
|
189
|
+
ok: false,
|
|
190
|
+
error: `Type a number like 240px${isTokenScale(s) ? ` or a size like ${s.steps[Math.min(2, s.steps.length - 1)].label}` : ""}.`
|
|
191
|
+
};
|
|
192
|
+
const n = Number(m[1]);
|
|
193
|
+
const typedUnit = m[2]?.toLowerCase();
|
|
194
|
+
const c = customRules(s);
|
|
195
|
+
const range = rangeOf(s);
|
|
196
|
+
if (range) {
|
|
197
|
+
const base = defaultUnit(s);
|
|
198
|
+
const sameUnit = !typedUnit || typedUnit === base;
|
|
199
|
+
const step = range.step ?? 1;
|
|
200
|
+
const onGrid = Math.abs((n - range.min) / step - Math.round((n - range.min) / step)) < 1e-9;
|
|
201
|
+
if (sameUnit && n >= range.min && n <= range.max && (onGrid || !c)) return {
|
|
202
|
+
ok: true,
|
|
203
|
+
value: onGrid ? n : roundTo(n, step)
|
|
204
|
+
};
|
|
205
|
+
if (!c) return {
|
|
206
|
+
ok: false,
|
|
207
|
+
error: `Use ${formatNumber(range.min)}–${formatNumber(range.max, base)}.`
|
|
208
|
+
};
|
|
209
|
+
const cv = {
|
|
210
|
+
value: n,
|
|
211
|
+
unit: typedUnit ?? unitHint ?? base ?? c.units[0]
|
|
212
|
+
};
|
|
213
|
+
const err = validateCustom(s, cv);
|
|
214
|
+
return err ? {
|
|
215
|
+
ok: false,
|
|
216
|
+
error: err
|
|
217
|
+
} : {
|
|
218
|
+
ok: true,
|
|
219
|
+
value: cv
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
if (!c) return {
|
|
223
|
+
ok: false,
|
|
224
|
+
error: "Pick a value on the scale."
|
|
225
|
+
};
|
|
226
|
+
const unit = typedUnit ?? unitHint ?? c.units[0];
|
|
227
|
+
const cv = {
|
|
228
|
+
value: n,
|
|
229
|
+
unit
|
|
230
|
+
};
|
|
231
|
+
if (isTokenScale(s) && unit === "px") {
|
|
232
|
+
const exact = s.steps.find((st) => st.px === n && !st.css);
|
|
233
|
+
if (exact) return {
|
|
234
|
+
ok: true,
|
|
235
|
+
value: exact.value
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
const err = validateCustom(s, cv);
|
|
239
|
+
return err ? {
|
|
240
|
+
ok: false,
|
|
241
|
+
error: err
|
|
242
|
+
} : {
|
|
243
|
+
ok: true,
|
|
244
|
+
value: cv
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
//#endregion
|
|
248
|
+
export { SCALE_UNITS, UNIT_NAMES, customPx, customRules, defaultUnit, fieldScale, formatNumber, isCustomValue, isTokenScale, nearestTokenIndex, parseScaleInput, rangeOf, resolveScale, roundTo, scaleCss, scaleHint, validateCustom };
|
|
249
|
+
|
|
250
|
+
//# sourceMappingURL=scale.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scale.js","names":[],"sources":["../../src/schema/scale.ts"],"sourcesContent":["/**\n * SCALES (CPO D41) — the logic behind \"fixed steps, with an optional custom escape hatch\".\n * Pure functions: the Block Kit control, the Visuals Design tab and site renderers all read values through here,\n * so a token, a stepped number and a custom size resolve the same way everywhere.\n *\n * Stored shapes (see `ScaleValue` in ./types):\n * \"xl\" → token (developers map it to their design system)\n * 15 → number on a stepped range, in the scale's default unit\n * { value: 200, unit: \"px\" } → custom (only when the field allows custom)\n */\nimport type { FieldSchema, ScaleCustomValue, ScaleRange, ScaleSchema, ScaleStep, ScaleUnit, ScaleValue } from \"./types\";\n\nexport const SCALE_UNITS: ScaleUnit[] = [\"px\", \"%\", \"rem\", \"em\", \"vw\", \"vh\"];\nconst isUnit = (u: unknown): u is ScaleUnit => typeof u === \"string\" && (SCALE_UNITS as string[]).includes(u);\n\n/** Spoken unit names for aria-valuetext (\"48 pixels\"). */\nconst UNIT_WORDS: Record<ScaleUnit, [one: string, many: string]> = {\n px: [\"pixel\", \"pixels\"],\n \"%\": [\"percent\", \"percent\"],\n rem: [\"rem\", \"rem\"],\n em: [\"em\", \"em\"],\n vw: [\"percent of the screen width\", \"percent of the screen width\"],\n vh: [\"percent of the screen height\", \"percent of the screen height\"],\n};\nexport const UNIT_NAMES: Record<ScaleUnit, string> = { px: \"Pixels\", \"%\": \"Percent\", rem: \"Root em\", em: \"Em\", vw: \"Screen width\", vh: \"Screen height\" };\n\nexport const isCustomValue = (v: unknown): v is ScaleCustomValue =>\n !!v && typeof v === \"object\" && typeof (v as ScaleCustomValue).value === \"number\" && isUnit((v as ScaleCustomValue).unit);\nexport const isTokenScale = (s: ScaleSchema): s is ScaleSchema & { steps: ScaleStep[] } => Array.isArray(s.steps);\nexport const rangeOf = (s: ScaleSchema): ScaleRange | null => (Array.isArray(s.steps) ? null : s.steps);\n\n/** Back-compat: `layout: \"slider\"` + `numeric: { min, max, step, unit }` → a fixed-only range scale. */\nexport function fieldScale(field: Pick<FieldSchema, \"scale\" | \"layout\" | \"numeric\">): ScaleSchema | null {\n if (field.scale) return field.scale;\n const n = field.numeric;\n if (field.layout === \"slider\" && n?.min != null && n?.max != null) {\n return { steps: { min: n.min, max: n.max, step: n.step ?? 1 }, units: isUnit(n.unit) ? [n.unit] : undefined };\n }\n return null;\n}\n\nexport const defaultUnit = (s: ScaleSchema): ScaleUnit | undefined => s.defaultUnit ?? s.units?.[0];\n\n/** The custom rules, or null when the field is fixed only. */\nexport function customRules(s: ScaleSchema) {\n if (!s.allowCustom) return null;\n const c = s.allowCustom === true ? {} : s.allowCustom;\n const units = c.units ?? s.units ?? [\"px\"];\n const pick = (b: typeof c.min, u: ScaleUnit) => (typeof b === \"number\" ? b : b?.[u]);\n return {\n units,\n step: c.step ?? 1,\n min: (u: ScaleUnit) => pick(c.min, u),\n max: (u: ScaleUnit) => pick(c.max, u),\n };\n}\n\nconst decimals = (n: number) => (String(n).split(\".\")[1] ?? \"\").length;\nexport function roundTo(n: number, step: number) {\n return Number((Math.round(n / step) * step).toFixed(Math.max(decimals(step), 0)));\n}\n\n/** Readable number + unit: \"200px\", \"15%\", \"1.5rem\", \"4.9\". */\nexport function formatNumber(n: number, unit?: string) {\n const t = Number.isInteger(n) ? String(n) : String(Number(n.toFixed(3)));\n if (!unit) return t;\n return isUnit(unit) ? `${t}${unit}` : `${t} ${unit}`;\n}\n\n/** px for a custom value when it can be known without layout (px, rem/em at 16). */\nexport function customPx(v: ScaleCustomValue): number | undefined {\n if (v.unit === \"px\") return v.value;\n if (v.unit === \"rem\" || v.unit === \"em\") return v.value * 16;\n return undefined;\n}\n\nexport interface ResolvedScale {\n kind: \"token\" | \"number\" | \"custom\" | \"empty\";\n /** short readout: \"XL\", \"15%\", \"200px\" */\n label: string;\n /** long name: \"Extra large\", \"15%\", \"Custom\" */\n title: string;\n /** CSS to emit (\"48px\", \"15%\", \"200px\", or a step's css) */\n css?: string;\n px?: number;\n /** token index (token scales) */\n index?: number;\n /** spoken value for aria-valuetext: \"Extra large, 48 pixels\" */\n spoken: string;\n}\n\nfunction spokenNumber(n: number, unit?: string) {\n if (!unit) return String(n);\n if (!isUnit(unit)) return `${n} ${unit}`;\n const [one, many] = UNIT_WORDS[unit];\n return `${n} ${n === 1 ? one : many}`;\n}\n\n/** Resolve any stored value against its scale. Unknown tokens fall back to \"empty\" (never throws). */\nexport function resolveScale(s: ScaleSchema, v: unknown, legacyUnit?: string): ResolvedScale {\n if (isCustomValue(v)) {\n const px = customPx(v);\n return { kind: \"custom\", label: formatNumber(v.value, v.unit), title: \"Custom\", css: `${v.value}${v.unit}`, px, spoken: `Custom, ${spokenNumber(v.value, v.unit)}` };\n }\n if (isTokenScale(s)) {\n const i = s.steps.findIndex((st) => st.value === v);\n if (i < 0) return { kind: \"empty\", label: \"—\", title: \"Not set\", spoken: \"Not set\" };\n const st = s.steps[i];\n const title = st.title ?? st.label;\n const css = st.css ?? (st.px != null ? `${st.px}px` : undefined);\n return { kind: \"token\", label: st.label, title, css, px: st.px, index: i, spoken: st.px != null ? `${title}, ${spokenNumber(st.px, \"px\")}` : st.css ? `${title}, ${st.css}` : title };\n }\n const unit = defaultUnit(s) ?? legacyUnit;\n const n = typeof v === \"number\" ? v : typeof v === \"string\" && v.trim() !== \"\" && !Number.isNaN(Number(v)) ? Number(v) : null;\n if (n == null) return { kind: \"empty\", label: \"—\", title: \"Not set\", spoken: \"Not set\" };\n const css = isUnit(unit) ? `${n}${unit}` : String(n);\n return { kind: \"number\", label: formatNumber(n, unit), title: formatNumber(n, unit), css, px: unit === \"px\" ? n : undefined, spoken: spokenNumber(n, unit) };\n}\n\n/** CSS for a stored value — what a site renderer emits. */\nexport const scaleCss = (s: ScaleSchema, v: unknown) => resolveScale(s, v).css;\n\n/** \"XL · 48px\" — the hint shown for a token. */\nexport function scaleHint(r: ResolvedScale) {\n if (r.kind === \"token\") return r.css ? `${r.title} · ${r.css}` : r.title;\n if (r.kind === \"custom\") return `Custom · ${r.label}`;\n return r.title;\n}\n\n/** Index of the token nearest to a custom value (by px), or -1 when it can't be placed. */\nexport function nearestTokenIndex(s: ScaleSchema, v: ScaleCustomValue): number {\n if (!isTokenScale(s)) return -1;\n const px = customPx(v);\n if (px == null) return -1;\n let best = -1;\n let d = Infinity;\n s.steps.forEach((st, i) => {\n if (st.px == null) return;\n const dd = Math.abs(st.px - px);\n if (dd < d) (d = dd), (best = i);\n });\n return best;\n}\n\nexport type ParseResult = { ok: true; value: ScaleValue } | { ok: false; error: string };\n\n/** Validate a custom value against the field's custom rules. Returns a plain-words error or null. */\nexport function validateCustom(s: ScaleSchema, v: ScaleCustomValue): string | null {\n const c = customRules(s);\n if (!c) return \"Pick a value on the scale.\";\n if (!c.units.includes(v.unit)) return `Use ${listUnits(c.units)}.`;\n const lo = c.min(v.unit);\n const hi = c.max(v.unit);\n if ((lo != null && v.value < lo) || (hi != null && v.value > hi)) {\n if (lo != null && hi != null) return `Use ${formatNumber(lo)}–${formatNumber(hi, v.unit)}.`;\n if (lo != null) return `Use ${formatNumber(lo, v.unit)} or more.`;\n return `Use ${formatNumber(hi!, v.unit)} or less.`;\n }\n return null;\n}\n\nconst listUnits = (u: ScaleUnit[]) => (u.length === 1 ? u[0] : `${u.slice(0, -1).join(\", \")} or ${u[u.length - 1]}`);\n\n/**\n * Parse what an editor typed: a token (\"xl\", \"XL\", \"Extra large\"), a number (\"240\" → default unit) or a number with\n * a unit (\"200px\", \"75 %\", \"1.5rem\"). Exact px matches of a token snap to the token, so the design system wins.\n */\nexport function parseScaleInput(s: ScaleSchema, text: string, unitHint?: ScaleUnit): ParseResult {\n const t = text.trim();\n if (!t) return { ok: false, error: \"Type a value, like 240px.\" };\n const low = t.toLowerCase();\n if (isTokenScale(s)) {\n const st = s.steps.find((x) => x.value.toLowerCase() === low || x.label.toLowerCase() === low || x.title?.toLowerCase() === low);\n if (st) return { ok: true, value: st.value };\n }\n const m = /^(-?(?:\\d+(?:\\.\\d+)?|\\.\\d+))\\s*(px|%|rem|em|vw|vh)?$/i.exec(t);\n if (!m) {\n const tokens = isTokenScale(s) ? ` or a size like ${s.steps[Math.min(2, s.steps.length - 1)].label}` : \"\";\n return { ok: false, error: `Type a number like 240px${tokens}.` };\n }\n const n = Number(m[1]);\n const typedUnit = m[2]?.toLowerCase() as ScaleUnit | undefined;\n const c = customRules(s);\n const range = rangeOf(s);\n if (range) {\n const base = defaultUnit(s);\n const sameUnit = !typedUnit || typedUnit === base;\n const step = range.step ?? 1;\n const onGrid = Math.abs((n - range.min) / step - Math.round((n - range.min) / step)) < 1e-9;\n if (sameUnit && n >= range.min && n <= range.max && (onGrid || !c)) return { ok: true, value: onGrid ? n : roundTo(n, step) };\n if (!c) return { ok: false, error: `Use ${formatNumber(range.min)}–${formatNumber(range.max, base)}.` };\n const unit = typedUnit ?? unitHint ?? base ?? c.units[0];\n const cv = { value: n, unit };\n const err = validateCustom(s, cv);\n return err ? { ok: false, error: err } : { ok: true, value: cv };\n }\n if (!c) return { ok: false, error: \"Pick a value on the scale.\" };\n const unit = typedUnit ?? unitHint ?? c.units[0];\n const cv: ScaleCustomValue = { value: n, unit };\n if (isTokenScale(s) && unit === \"px\") {\n const exact = s.steps.find((st) => st.px === n && !st.css);\n if (exact) return { ok: true, value: exact.value };\n }\n const err = validateCustom(s, cv);\n return err ? { ok: false, error: err } : { ok: true, value: cv };\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The V2 shapes the schema layer reads, copied type for type so @/kit owns them and imports nothing from
|
|
3
|
+
* the app. Sources at V2 HEAD 9829bf1:
|
|
4
|
+
* - Cap: src/lib/access/registry.ts (CAP_IDS, the permission keys a field's `access` names)
|
|
5
|
+
* - FieldType, FieldDef: src/data/types.ts (content collection fields)
|
|
6
|
+
* - BlockCategory, PropType, PropDef, BlockFieldset, BlockDef: src/features/visuals/model/catalog.ts
|
|
7
|
+
* The production adapters (src/kit/adapters) map production models onto these; nothing here is wired yet.
|
|
8
|
+
*/
|
|
9
|
+
export declare const CAP_IDS: readonly ["content.view", "content.create", "content.edit", "content.delete", "content.review", "content.publish", "pages.organize", "collections.manage", "schema.view", "schema.manage", "components.use", "components.manage", "media.upload", "media.manage", "seo.edit", "seo.manage", "forms.view", "forms.manage", "forms.submissions", "analytics.view", "visuals.edit", "design.edit", "design.manage", "publish.deploy", "publish.workflow", "branches.create", "branches.merge", "agents.run", "agents.build", "agents.manage", "ai.use", "ai.manage", "comments.create", "comments.moderate", "settings.project", "settings.workspace", "settings.security", "audit.view", "members.view", "members.invite", "members.manage", "members.viewAs", "billing.view", "billing.manage", "domains.manage", "api.view", "api.manage", "integrations.manage", "projects.create", "projects.delete"];
|
|
10
|
+
export type Cap = (typeof CAP_IDS)[number];
|
|
11
|
+
export type FieldType = "text" | "textarea" | "richtext" | "slug" | "number" | "boolean" | "date" | "datetime" | "select" | "multiselect" | "image" | "gallery" | "file" | "video" | "link" | "button" | "reference" | "references" | "color" | "json" | "code" | "repeater" | "group" | "email" | "url" | "location" | "rating" | "tags" | "table";
|
|
12
|
+
export interface FieldDef {
|
|
13
|
+
id: string;
|
|
14
|
+
name: string;
|
|
15
|
+
type: FieldType;
|
|
16
|
+
required?: boolean;
|
|
17
|
+
/** Help under the label (CPO D39). Unset → house convention by id/type; "" = none. */
|
|
18
|
+
help?: string;
|
|
19
|
+
/** Longer explanation behind the ⓘ next to the label. */
|
|
20
|
+
helpMore?: string;
|
|
21
|
+
options?: string[];
|
|
22
|
+
reference?: string;
|
|
23
|
+
max?: number;
|
|
24
|
+
localized?: boolean;
|
|
25
|
+
fields?: FieldDef[];
|
|
26
|
+
}
|
|
27
|
+
export type BlockCategory = "Navigation" | "Hero" | "Content" | "Social proof" | "Commerce" | "Conversion" | "Collection" | "Media" | "Footer" | "Basic" | "Blog";
|
|
28
|
+
/**
|
|
29
|
+
* Prop types: every FieldType, plus two shapes only blocks need — "list" (an array of one-line strings: bullets,
|
|
30
|
+
* features, "what's included"; never tags, D47) and "icon" (a Tabler icon name, picked from the icon picker).
|
|
31
|
+
*/
|
|
32
|
+
export type PropType = FieldType | "list" | "icon";
|
|
33
|
+
export interface PropDef {
|
|
34
|
+
key: string;
|
|
35
|
+
label: string;
|
|
36
|
+
type: PropType;
|
|
37
|
+
/** Help under the label (CPO D39). Unset → house convention by key/type; "" = none. */
|
|
38
|
+
help?: string;
|
|
39
|
+
/** Longer explanation behind the ⓘ next to the label. */
|
|
40
|
+
helpMore?: string;
|
|
41
|
+
options?: string[];
|
|
42
|
+
max?: number;
|
|
43
|
+
item?: PropDef[];
|
|
44
|
+
group?: "Content" | "Media" | "Links" | "Data";
|
|
45
|
+
/** reference props: the collection id the picker lists (e.g. "col_journal"); default = pages */
|
|
46
|
+
reference?: string;
|
|
47
|
+
/** D45: the fieldset (BlockDef.fieldsets) this prop sits in. */
|
|
48
|
+
fieldset?: string;
|
|
49
|
+
/** Show only when a sibling prop equals one of these values (the form hides it otherwise). */
|
|
50
|
+
showIf?: {
|
|
51
|
+
key: string;
|
|
52
|
+
equals: unknown;
|
|
53
|
+
};
|
|
54
|
+
/** Arrays: the noun for "Add {noun}". */
|
|
55
|
+
itemNoun?: string;
|
|
56
|
+
placeholder?: string;
|
|
57
|
+
/** Arrays: the most and fewest items. */
|
|
58
|
+
min?: number;
|
|
59
|
+
}
|
|
60
|
+
/** D45 fieldset: siblings with one purpose ("Buttons", "Newsletter"), optionally collapsed. */
|
|
61
|
+
export interface BlockFieldset {
|
|
62
|
+
name: string;
|
|
63
|
+
title: string;
|
|
64
|
+
collapsed?: boolean;
|
|
65
|
+
columns?: 1 | 2;
|
|
66
|
+
}
|
|
67
|
+
export interface BlockDef {
|
|
68
|
+
type: string;
|
|
69
|
+
name: string;
|
|
70
|
+
category: BlockCategory;
|
|
71
|
+
description: string;
|
|
72
|
+
icon: string;
|
|
73
|
+
variants: {
|
|
74
|
+
id: string;
|
|
75
|
+
name: string;
|
|
76
|
+
description?: string;
|
|
77
|
+
}[];
|
|
78
|
+
content: PropDef[];
|
|
79
|
+
/** D45 fieldsets the content props sit in (PropDef.fieldset). */
|
|
80
|
+
fieldsets?: BlockFieldset[];
|
|
81
|
+
defaults: Record<string, unknown>;
|
|
82
|
+
/** Global blocks (nav, footer, announcement) are synced across every page. */
|
|
83
|
+
global?: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* PLACEMENT (CPO D55): where the block fits. "inline" = it fits a text column, so a rich-text body offers it in the
|
|
86
|
+
* Insert menu's Article group. "section" (the default) = page-width; a body reaches it only through More components.
|
|
87
|
+
* "page" = a whole page or a feed of other content (Blog post, Recipe, Journal grid, Rich text); never inside a body.
|
|
88
|
+
*/
|
|
89
|
+
placement?: "inline" | "section" | "page";
|
|
90
|
+
/** Developer-only lock: marketers can edit content but not swap/remove. */
|
|
91
|
+
tags?: string[];
|
|
92
|
+
/**
|
|
93
|
+
* SLOTS (CPO D8, added by the canvas team) — named areas that hold nested blocks (Tabs panels, Bento cells…).
|
|
94
|
+
* Instances keep them in `BlockInstance.children[slot]`. `accepts` limits which block types can be dropped in.
|
|
95
|
+
*/
|
|
96
|
+
slots?: {
|
|
97
|
+
name: string;
|
|
98
|
+
label: string;
|
|
99
|
+
accepts?: string[];
|
|
100
|
+
}[];
|
|
101
|
+
/** Nested blocks created with a fresh instance: slot → [type, variant?, props override?][] */
|
|
102
|
+
childDefaults?: Record<string, [string, string?, Record<string, unknown>?][]>;
|
|
103
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
//#region src/schema/sources.ts
|
|
2
|
+
/**
|
|
3
|
+
* The V2 shapes the schema layer reads, copied type for type so @/kit owns them and imports nothing from
|
|
4
|
+
* the app. Sources at V2 HEAD 9829bf1:
|
|
5
|
+
* - Cap: src/lib/access/registry.ts (CAP_IDS, the permission keys a field's `access` names)
|
|
6
|
+
* - FieldType, FieldDef: src/data/types.ts (content collection fields)
|
|
7
|
+
* - BlockCategory, PropType, PropDef, BlockFieldset, BlockDef: src/features/visuals/model/catalog.ts
|
|
8
|
+
* The production adapters (src/kit/adapters) map production models onto these; nothing here is wired yet.
|
|
9
|
+
*/
|
|
10
|
+
var CAP_IDS = [
|
|
11
|
+
"content.view",
|
|
12
|
+
"content.create",
|
|
13
|
+
"content.edit",
|
|
14
|
+
"content.delete",
|
|
15
|
+
"content.review",
|
|
16
|
+
"content.publish",
|
|
17
|
+
"pages.organize",
|
|
18
|
+
"collections.manage",
|
|
19
|
+
"schema.view",
|
|
20
|
+
"schema.manage",
|
|
21
|
+
"components.use",
|
|
22
|
+
"components.manage",
|
|
23
|
+
"media.upload",
|
|
24
|
+
"media.manage",
|
|
25
|
+
"seo.edit",
|
|
26
|
+
"seo.manage",
|
|
27
|
+
"forms.view",
|
|
28
|
+
"forms.manage",
|
|
29
|
+
"forms.submissions",
|
|
30
|
+
"analytics.view",
|
|
31
|
+
"visuals.edit",
|
|
32
|
+
"design.edit",
|
|
33
|
+
"design.manage",
|
|
34
|
+
"publish.deploy",
|
|
35
|
+
"publish.workflow",
|
|
36
|
+
"branches.create",
|
|
37
|
+
"branches.merge",
|
|
38
|
+
"agents.run",
|
|
39
|
+
"agents.build",
|
|
40
|
+
"agents.manage",
|
|
41
|
+
"ai.use",
|
|
42
|
+
"ai.manage",
|
|
43
|
+
"comments.create",
|
|
44
|
+
"comments.moderate",
|
|
45
|
+
"settings.project",
|
|
46
|
+
"settings.workspace",
|
|
47
|
+
"settings.security",
|
|
48
|
+
"audit.view",
|
|
49
|
+
"members.view",
|
|
50
|
+
"members.invite",
|
|
51
|
+
"members.manage",
|
|
52
|
+
"members.viewAs",
|
|
53
|
+
"billing.view",
|
|
54
|
+
"billing.manage",
|
|
55
|
+
"domains.manage",
|
|
56
|
+
"api.view",
|
|
57
|
+
"api.manage",
|
|
58
|
+
"integrations.manage",
|
|
59
|
+
"projects.create",
|
|
60
|
+
"projects.delete"
|
|
61
|
+
];
|
|
62
|
+
//#endregion
|
|
63
|
+
export { CAP_IDS };
|
|
64
|
+
|
|
65
|
+
//# sourceMappingURL=sources.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sources.js","names":[],"sources":["../../src/schema/sources.ts"],"sourcesContent":["/**\n * The V2 shapes the schema layer reads, copied type for type so @/kit owns them and imports nothing from\n * the app. Sources at V2 HEAD 9829bf1:\n * - Cap: src/lib/access/registry.ts (CAP_IDS, the permission keys a field's `access` names)\n * - FieldType, FieldDef: src/data/types.ts (content collection fields)\n * - BlockCategory, PropType, PropDef, BlockFieldset, BlockDef: src/features/visuals/model/catalog.ts\n * The production adapters (src/kit/adapters) map production models onto these; nothing here is wired yet.\n */\n\nexport const CAP_IDS = [\n // content\n \"content.view\",\n \"content.create\",\n \"content.edit\",\n \"content.delete\",\n \"content.review\",\n \"content.publish\",\n // pages and collections\n \"pages.organize\",\n \"collections.manage\",\n // schema\n \"schema.view\",\n \"schema.manage\",\n // components\n \"components.use\",\n \"components.manage\",\n // media\n \"media.upload\",\n \"media.manage\",\n // seo\n \"seo.edit\",\n \"seo.manage\",\n // forms\n \"forms.view\",\n \"forms.manage\",\n \"forms.submissions\",\n // analytics\n \"analytics.view\",\n // visuals and design\n \"visuals.edit\",\n \"design.edit\",\n \"design.manage\",\n // publish and branches\n \"publish.deploy\",\n \"publish.workflow\",\n \"branches.create\",\n \"branches.merge\",\n // agents and AI\n \"agents.run\",\n \"agents.build\",\n \"agents.manage\",\n \"ai.use\",\n \"ai.manage\",\n // comments\n \"comments.create\",\n \"comments.moderate\",\n // settings and audit\n \"settings.project\",\n \"settings.workspace\",\n \"settings.security\",\n \"audit.view\",\n // members\n \"members.view\",\n \"members.invite\",\n \"members.manage\",\n \"members.viewAs\",\n // billing and domains\n \"billing.view\",\n \"billing.manage\",\n \"domains.manage\",\n // api, integrations, projects\n \"api.view\",\n \"api.manage\",\n \"integrations.manage\",\n \"projects.create\",\n \"projects.delete\",\n] as const;\n\nexport type Cap = (typeof CAP_IDS)[number];\n\nexport type FieldType =\n | \"text\"\n | \"textarea\"\n | \"richtext\"\n | \"slug\"\n | \"number\"\n | \"boolean\"\n | \"date\"\n | \"datetime\"\n | \"select\"\n | \"multiselect\"\n | \"image\"\n | \"gallery\"\n | \"file\"\n | \"video\"\n | \"link\"\n | \"button\"\n | \"reference\"\n | \"references\"\n | \"color\"\n | \"json\"\n | \"code\"\n | \"repeater\"\n | \"group\"\n | \"email\"\n | \"url\"\n | \"location\"\n | \"rating\"\n | \"tags\"\n | \"table\";\n\nexport interface FieldDef {\n id: string;\n name: string;\n type: FieldType;\n required?: boolean;\n /** Help under the label (CPO D39). Unset → house convention by id/type; \"\" = none. */\n help?: string;\n /** Longer explanation behind the ⓘ next to the label. */\n helpMore?: string;\n options?: string[];\n reference?: string;\n max?: number;\n localized?: boolean;\n fields?: FieldDef[];\n}\n\n\nexport type BlockCategory = \"Navigation\" | \"Hero\" | \"Content\" | \"Social proof\" | \"Commerce\" | \"Conversion\" | \"Collection\" | \"Media\" | \"Footer\" | \"Basic\" | \"Blog\";\n\n/**\n * Prop types: every FieldType, plus two shapes only blocks need — \"list\" (an array of one-line strings: bullets,\n * features, \"what's included\"; never tags, D47) and \"icon\" (a Tabler icon name, picked from the icon picker).\n */\nexport type PropType = FieldType | \"list\" | \"icon\";\n\nexport interface PropDef {\n key: string;\n label: string;\n type: PropType;\n /** Help under the label (CPO D39). Unset → house convention by key/type; \"\" = none. */\n help?: string;\n /** Longer explanation behind the ⓘ next to the label. */\n helpMore?: string;\n options?: string[];\n max?: number;\n item?: PropDef[]; // for repeater\n group?: \"Content\" | \"Media\" | \"Links\" | \"Data\";\n /** reference props: the collection id the picker lists (e.g. \"col_journal\"); default = pages */\n reference?: string;\n /** D45: the fieldset (BlockDef.fieldsets) this prop sits in. */\n fieldset?: string;\n /** Show only when a sibling prop equals one of these values (the form hides it otherwise). */\n showIf?: { key: string; equals: unknown };\n /** Arrays: the noun for \"Add {noun}\". */\n itemNoun?: string;\n placeholder?: string;\n /** Arrays: the most and fewest items. */\n min?: number;\n}\n\n/** D45 fieldset: siblings with one purpose (\"Buttons\", \"Newsletter\"), optionally collapsed. */\nexport interface BlockFieldset {\n name: string;\n title: string;\n collapsed?: boolean;\n columns?: 1 | 2;\n}\n\nexport interface BlockDef {\n type: string;\n name: string;\n category: BlockCategory;\n description: string;\n icon: string; // lucide icon name\n variants: { id: string; name: string; description?: string }[];\n content: PropDef[];\n /** D45 fieldsets the content props sit in (PropDef.fieldset). */\n fieldsets?: BlockFieldset[];\n defaults: Record<string, unknown>;\n /** Global blocks (nav, footer, announcement) are synced across every page. */\n global?: boolean;\n /**\n * PLACEMENT (CPO D55): where the block fits. \"inline\" = it fits a text column, so a rich-text body offers it in the\n * Insert menu's Article group. \"section\" (the default) = page-width; a body reaches it only through More components.\n * \"page\" = a whole page or a feed of other content (Blog post, Recipe, Journal grid, Rich text); never inside a body.\n */\n placement?: \"inline\" | \"section\" | \"page\";\n /** Developer-only lock: marketers can edit content but not swap/remove. */\n tags?: string[];\n /**\n * SLOTS (CPO D8, added by the canvas team) — named areas that hold nested blocks (Tabs panels, Bento cells…).\n * Instances keep them in `BlockInstance.children[slot]`. `accepts` limits which block types can be dropped in.\n */\n slots?: { name: string; label: string; accepts?: string[] }[];\n /** Nested blocks created with a fresh instance: slot → [type, variant?, props override?][] */\n childDefaults?: Record<string, [string, string?, Record<string, unknown>?][]>;\n}\n"],"mappings":";;;;;;;;;AASA,IAAa,UAAU;CAErB;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CAEA;CACA;CAEA;CACA;CAEA;CACA;CAEA;CACA;CAEA;CACA;CACA;CAEA;CAEA;CACA;CACA;CAEA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CAEA;CACA;CAEA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CAEA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;AACF"}
|