@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,1859 @@
|
|
|
1
|
+
import { cn } from "../../lib/cn.js";
|
|
2
|
+
import { useKitServices } from "../../context.js";
|
|
3
|
+
import { Button, IconButton } from "../../ui/button.js";
|
|
4
|
+
import { Menu, MenuContent, MenuItem, MenuSeparator, MenuTrigger, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, Tooltip } from "../../ui/overlay.js";
|
|
5
|
+
import { Input, Textarea } from "../../ui/input.js";
|
|
6
|
+
import { TableEditor } from "../table/table-editor.js";
|
|
7
|
+
import { SchemaForm } from "../../engine/schema-form.js";
|
|
8
|
+
import { eventKey } from "../../lib/key-event.js";
|
|
9
|
+
import { FloatingPanel } from "../../ui/floating-panel.js";
|
|
10
|
+
import { CALLOUT_TONES, detectEmbed, placeCaret } from "./dom.js";
|
|
11
|
+
import { LinkForm } from "./link-form.js";
|
|
12
|
+
import { ComponentCard } from "./component-card.js";
|
|
13
|
+
import * as React from "react";
|
|
14
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
15
|
+
import { IconAlertTriangle, IconAlt, IconArrowsHorizontal, IconArrowsMove, IconBrandCodepen, IconBrandFigma, IconBrandSpotify, IconBrandVimeo, IconBrandX, IconBrandYoutube, IconBulb, IconCheck, IconChevronDown, IconChevronRight, IconComponents, IconCopy, IconDimensions, IconDots, IconFileText, IconFileUpload, IconHeadphones, IconInfoCircle, IconLayoutAlignCenter, IconLayoutAlignLeft, IconLayoutAlignRight, IconLayoutSidebar, IconLayoutSidebarRight, IconLibraryPhoto, IconLink, IconMap, IconMicrophone, IconPhoto, IconPlayerPlayFilled, IconQuote, IconReplace, IconSettings, IconTrash, IconWorld, IconX } from "@tabler/icons-react";
|
|
16
|
+
//#region src/controls/rich-text/blocks.tsx
|
|
17
|
+
/**
|
|
18
|
+
* RICH TEXT · rich blocks ("islands", V2 HEAD controls/rich-text/blocks.tsx). Each renders through a portal into a
|
|
19
|
+
* contenteditable=false element inside the editor surface; its model lives on that element (`el.__rt`) so serialize()
|
|
20
|
+
* can write it back as static HTML.
|
|
21
|
+
*
|
|
22
|
+
* The image block is V2's: the toolbar (Replace · Align · Size S/M/L/Full · Link · Alt text · Remove) and the caption
|
|
23
|
+
* under it, each stored on production's image block (see dom.ts). The callout (tone · title · message), toggle, video,
|
|
24
|
+
* file and embedded component blocks are V2's too, limited to what their stored blocks keep: a callout's message and a
|
|
25
|
+
* toggle's body are plain text (production stores them as text), a component is a linked card (its fields are edited
|
|
26
|
+
* on the component itself).
|
|
27
|
+
*
|
|
28
|
+
* The table block is V2's TableBlock: the kit's table editor on the island's table value. The pull quote is V2's article
|
|
29
|
+
* block (article-blocks.tsx ArticleBlock + PullQuotePreview): drawn as the reader sees it, edited in the floating
|
|
30
|
+
* properties panel (4 settings → panel, CPO D54) through the kit SchemaForm. Key takeaways are V2's article block too,
|
|
31
|
+
* written in the text itself (article-blocks.tsx TakeawaysEditor, surface "inline"): a title line and a line per point.
|
|
32
|
+
* The embed is V2's article block too (ArticleBlock surface "popover" + EmbedPreview): a placeholder card of the link's
|
|
33
|
+
* provider, edited in a popover beside it (Link, Title; V2's Shape has no stored key, see dom.ts).
|
|
34
|
+
*/
|
|
35
|
+
function Island({ el, ctx }) {
|
|
36
|
+
const kind = el.getAttribute("data-rt-island");
|
|
37
|
+
const [model, setModel] = React.useState(() => el.__rt);
|
|
38
|
+
const [autoFocus] = React.useState(() => !!el.__rtFocus);
|
|
39
|
+
React.useEffect(() => {
|
|
40
|
+
el.__rtFocus = false;
|
|
41
|
+
}, [el]);
|
|
42
|
+
const set = React.useCallback((patch, label = "Edit block", record = true) => {
|
|
43
|
+
const prev = el.__rt;
|
|
44
|
+
const next = typeof patch === "function" ? patch(prev) : {
|
|
45
|
+
...prev,
|
|
46
|
+
...patch
|
|
47
|
+
};
|
|
48
|
+
if (record) ctx.record?.(el, prev, label, typeof patch !== "function");
|
|
49
|
+
el.__rt = next;
|
|
50
|
+
setModel(next);
|
|
51
|
+
ctx.emit();
|
|
52
|
+
}, [el, ctx]);
|
|
53
|
+
React.useEffect(() => {
|
|
54
|
+
el.__rtSet = (m) => {
|
|
55
|
+
el.__rt = m;
|
|
56
|
+
setModel(m);
|
|
57
|
+
ctx.emit();
|
|
58
|
+
};
|
|
59
|
+
return () => {
|
|
60
|
+
if (el.__rtSet) delete el.__rtSet;
|
|
61
|
+
};
|
|
62
|
+
}, [el, ctx]);
|
|
63
|
+
const onKeyDown = (e) => {
|
|
64
|
+
if (!e.currentTarget.contains(e.target)) return;
|
|
65
|
+
if (e.key === "Escape" && e.target.isContentEditable) {
|
|
66
|
+
e.preventDefault();
|
|
67
|
+
e.stopPropagation();
|
|
68
|
+
ctx.exit(el);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
return /* @__PURE__ */ jsx("div", {
|
|
72
|
+
className: "relative select-text",
|
|
73
|
+
onKeyDown,
|
|
74
|
+
"data-island-kind": kind,
|
|
75
|
+
children: kind === "image" ? /* @__PURE__ */ jsx(ImageBlock, {
|
|
76
|
+
el,
|
|
77
|
+
ctx,
|
|
78
|
+
autoFocus,
|
|
79
|
+
m: model,
|
|
80
|
+
set
|
|
81
|
+
}) : kind === "table" ? /* @__PURE__ */ jsx(TableBlock, {
|
|
82
|
+
el,
|
|
83
|
+
ctx,
|
|
84
|
+
autoFocus,
|
|
85
|
+
m: model,
|
|
86
|
+
set
|
|
87
|
+
}) : kind === "pullquote" ? /* @__PURE__ */ jsx(PullQuoteBlock, {
|
|
88
|
+
el,
|
|
89
|
+
ctx,
|
|
90
|
+
autoFocus,
|
|
91
|
+
m: model,
|
|
92
|
+
set
|
|
93
|
+
}) : kind === "takeaways" ? /* @__PURE__ */ jsx(TakeawaysBlock, {
|
|
94
|
+
el,
|
|
95
|
+
ctx,
|
|
96
|
+
autoFocus,
|
|
97
|
+
m: model,
|
|
98
|
+
set
|
|
99
|
+
}) : kind === "callout" ? /* @__PURE__ */ jsx(CalloutBlock, {
|
|
100
|
+
el,
|
|
101
|
+
ctx,
|
|
102
|
+
autoFocus,
|
|
103
|
+
m: model,
|
|
104
|
+
set
|
|
105
|
+
}) : kind === "toggle" ? /* @__PURE__ */ jsx(ToggleBlock, {
|
|
106
|
+
el,
|
|
107
|
+
ctx,
|
|
108
|
+
autoFocus,
|
|
109
|
+
m: model,
|
|
110
|
+
set
|
|
111
|
+
}) : kind === "video" ? /* @__PURE__ */ jsx(VideoBlock, {
|
|
112
|
+
el,
|
|
113
|
+
ctx,
|
|
114
|
+
autoFocus,
|
|
115
|
+
m: model,
|
|
116
|
+
set
|
|
117
|
+
}) : kind === "embed" ? /* @__PURE__ */ jsx(EmbedBlock, {
|
|
118
|
+
el,
|
|
119
|
+
ctx,
|
|
120
|
+
autoFocus,
|
|
121
|
+
m: model,
|
|
122
|
+
set
|
|
123
|
+
}) : kind === "file" ? /* @__PURE__ */ jsx(FileBlock, {
|
|
124
|
+
el,
|
|
125
|
+
ctx,
|
|
126
|
+
autoFocus,
|
|
127
|
+
m: model,
|
|
128
|
+
set
|
|
129
|
+
}) : kind === "component" ? /* @__PURE__ */ jsx(ComponentBlock, {
|
|
130
|
+
el,
|
|
131
|
+
ctx,
|
|
132
|
+
autoFocus,
|
|
133
|
+
m: model,
|
|
134
|
+
set
|
|
135
|
+
}) : null
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
var Sep = () => /* @__PURE__ */ jsx("span", {
|
|
139
|
+
"aria-hidden": true,
|
|
140
|
+
className: "mx-0.5 h-4 w-px shrink-0 bg-kit-line"
|
|
141
|
+
});
|
|
142
|
+
/** An address an image can be shown from: http(s) or a site path. */
|
|
143
|
+
var imageUrlOk = (u) => /^(https?:)?\/\/[^\s]+$/i.test(u) || /^\/(?!\/)\S*$/.test(u);
|
|
144
|
+
function PlainEditable({ value, onChange, label, placeholder, readOnly, autoFocus, multiline, onEnter, onBackspaceEmpty, className }) {
|
|
145
|
+
const ref = React.useRef(null);
|
|
146
|
+
React.useLayoutEffect(() => {
|
|
147
|
+
const el = ref.current;
|
|
148
|
+
if (!el || document.activeElement === el) return;
|
|
149
|
+
if (el.textContent !== value) el.textContent = value;
|
|
150
|
+
}, [value]);
|
|
151
|
+
React.useEffect(() => {
|
|
152
|
+
if (!autoFocus || !ref.current || readOnly) return;
|
|
153
|
+
ref.current.focus({ preventScroll: false });
|
|
154
|
+
placeCaret(ref.current);
|
|
155
|
+
}, []);
|
|
156
|
+
return /* @__PURE__ */ jsx("div", {
|
|
157
|
+
ref,
|
|
158
|
+
role: "textbox",
|
|
159
|
+
"aria-label": label,
|
|
160
|
+
"aria-multiline": multiline || void 0,
|
|
161
|
+
"aria-readonly": readOnly || void 0,
|
|
162
|
+
tabIndex: readOnly ? -1 : 0,
|
|
163
|
+
contentEditable: readOnly ? false : "plaintext-only",
|
|
164
|
+
suppressContentEditableWarning: true,
|
|
165
|
+
spellCheck: true,
|
|
166
|
+
"data-placeholder": placeholder,
|
|
167
|
+
onInput: (e) => onChange((e.currentTarget.textContent ?? "").replace(/\u200b/g, "")),
|
|
168
|
+
onPaste: (e) => {
|
|
169
|
+
e.preventDefault();
|
|
170
|
+
const t = e.clipboardData.getData("text/plain");
|
|
171
|
+
document.execCommand("insertText", false, multiline ? t : t.replace(/\s*\n\s*/g, " "));
|
|
172
|
+
},
|
|
173
|
+
onKeyDown: (e) => {
|
|
174
|
+
if (e.key === "Backspace" && onBackspaceEmpty && !(e.currentTarget.textContent ?? "").replace(/\u200b/g, "")) {
|
|
175
|
+
e.preventDefault();
|
|
176
|
+
onBackspaceEmpty();
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
if (e.key !== "Enter") return;
|
|
180
|
+
if (multiline && !(e.metaKey || e.ctrlKey)) return;
|
|
181
|
+
e.preventDefault();
|
|
182
|
+
onEnter?.();
|
|
183
|
+
},
|
|
184
|
+
className: cn("min-w-0 cursor-text whitespace-pre-wrap break-words outline-none focus-visible:shadow-none empty:before:pointer-events-none empty:before:text-kit-fg-4 empty:before:content-[attr(data-placeholder)]", className)
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
var RemoveBtn = ({ onClick, label = "Remove block" }) => /* @__PURE__ */ jsx(IconButton, {
|
|
188
|
+
size: "xs",
|
|
189
|
+
label,
|
|
190
|
+
onClick,
|
|
191
|
+
className: "hover:text-kit-danger-fg",
|
|
192
|
+
children: /* @__PURE__ */ jsx(IconTrash, { stroke: 1.5 })
|
|
193
|
+
});
|
|
194
|
+
/** Production's image layout (lib/richtext/imageLayout.ts): a size sets the column share; with none, the alignment does. */
|
|
195
|
+
var SIZES = [
|
|
196
|
+
{
|
|
197
|
+
v: "s",
|
|
198
|
+
label: "S",
|
|
199
|
+
w: "33%"
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
v: "m",
|
|
203
|
+
label: "M",
|
|
204
|
+
w: "50%"
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
v: "l",
|
|
208
|
+
label: "L",
|
|
209
|
+
w: "75%"
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
v: "full",
|
|
213
|
+
label: "Full",
|
|
214
|
+
w: "100%"
|
|
215
|
+
}
|
|
216
|
+
];
|
|
217
|
+
var ALIGN_WIDTH = {
|
|
218
|
+
full: "100%",
|
|
219
|
+
center: "78%",
|
|
220
|
+
left: "62%",
|
|
221
|
+
right: "62%"
|
|
222
|
+
};
|
|
223
|
+
var ALIGNS = [
|
|
224
|
+
{
|
|
225
|
+
v: "full",
|
|
226
|
+
label: "Full width",
|
|
227
|
+
icon: /* @__PURE__ */ jsx(IconArrowsHorizontal, { stroke: 1.5 })
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
v: "center",
|
|
231
|
+
label: "Center",
|
|
232
|
+
icon: /* @__PURE__ */ jsx(IconLayoutAlignCenter, { stroke: 1.5 })
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
v: "left",
|
|
236
|
+
label: "Left",
|
|
237
|
+
icon: /* @__PURE__ */ jsx(IconLayoutAlignLeft, { stroke: 1.5 })
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
v: "right",
|
|
241
|
+
label: "Right",
|
|
242
|
+
icon: /* @__PURE__ */ jsx(IconLayoutAlignRight, { stroke: 1.5 })
|
|
243
|
+
}
|
|
244
|
+
];
|
|
245
|
+
function ImageBlock({ m, set, el, ctx }) {
|
|
246
|
+
const { MediaPicker } = useKitServices();
|
|
247
|
+
const [picker, setPicker] = React.useState(false);
|
|
248
|
+
const [urlMode, setUrlMode] = React.useState(false);
|
|
249
|
+
const [url, setUrl] = React.useState("");
|
|
250
|
+
const [busy, setBusy] = React.useState(false);
|
|
251
|
+
const [linkOpen, setLinkOpen] = React.useState(false);
|
|
252
|
+
const ro = ctx.readOnly;
|
|
253
|
+
const pickerEl = MediaPicker ? /* @__PURE__ */ jsx(MediaPicker, {
|
|
254
|
+
open: picker,
|
|
255
|
+
onOpenChange: setPicker,
|
|
256
|
+
accept: ["image", "svg"],
|
|
257
|
+
onPick: (a) => a[0] && set({
|
|
258
|
+
src: a[0].url,
|
|
259
|
+
alt: a[0].alt || m.alt || ""
|
|
260
|
+
}, "Replace image")
|
|
261
|
+
}) : null;
|
|
262
|
+
if (!m.src) return /* @__PURE__ */ jsxs("div", {
|
|
263
|
+
className: "group/blk rounded-kit-lg border border-dashed border-kit-line-strong bg-kit-subtle px-4 py-4",
|
|
264
|
+
children: [
|
|
265
|
+
/* @__PURE__ */ jsxs("div", {
|
|
266
|
+
className: "flex items-start gap-3",
|
|
267
|
+
children: [
|
|
268
|
+
/* @__PURE__ */ jsx("span", {
|
|
269
|
+
className: "flex size-8 shrink-0 items-center justify-center rounded-kit-md border border-kit-line bg-kit-control-bg text-kit-fg-2",
|
|
270
|
+
children: /* @__PURE__ */ jsx(IconPhoto, {
|
|
271
|
+
className: "size-4",
|
|
272
|
+
stroke: 1.5,
|
|
273
|
+
"aria-hidden": true
|
|
274
|
+
})
|
|
275
|
+
}),
|
|
276
|
+
/* @__PURE__ */ jsxs("div", {
|
|
277
|
+
className: "min-w-0 flex-1",
|
|
278
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
279
|
+
className: "text-kit-sm font-medium text-kit-fg",
|
|
280
|
+
children: "Add an image"
|
|
281
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
282
|
+
className: "text-kit-xs text-kit-fg-3",
|
|
283
|
+
children: MediaPicker ? "Pick one from the media library or paste a link." : "Paste a link to the image."
|
|
284
|
+
})]
|
|
285
|
+
}),
|
|
286
|
+
ro ? null : /* @__PURE__ */ jsx(RemoveBtn, {
|
|
287
|
+
onClick: () => ctx.remove(el),
|
|
288
|
+
label: "Remove image"
|
|
289
|
+
})
|
|
290
|
+
]
|
|
291
|
+
}),
|
|
292
|
+
ro ? null : urlMode || !MediaPicker ? /* @__PURE__ */ jsxs("form", {
|
|
293
|
+
className: "mt-3 flex items-center gap-2",
|
|
294
|
+
onSubmit: (e) => {
|
|
295
|
+
e.preventDefault();
|
|
296
|
+
const u = url.trim();
|
|
297
|
+
if (!imageUrlOk(u)) return ctx.notify("Paste a full image link that starts with https://", "Or a path on this site, like /images/hero.jpg.");
|
|
298
|
+
set({
|
|
299
|
+
src: u,
|
|
300
|
+
alt: m.alt ?? ""
|
|
301
|
+
}, "Add image");
|
|
302
|
+
ctx.exit(el);
|
|
303
|
+
},
|
|
304
|
+
children: [
|
|
305
|
+
/* @__PURE__ */ jsx(Input, {
|
|
306
|
+
autoFocus: true,
|
|
307
|
+
size: "sm",
|
|
308
|
+
value: url,
|
|
309
|
+
onChange: (e) => setUrl(e.target.value),
|
|
310
|
+
placeholder: "https://…",
|
|
311
|
+
"aria-label": "Image URL",
|
|
312
|
+
leading: /* @__PURE__ */ jsx(IconLink, { stroke: 1.5 }),
|
|
313
|
+
className: "flex-1"
|
|
314
|
+
}),
|
|
315
|
+
/* @__PURE__ */ jsx(Button, {
|
|
316
|
+
size: "sm",
|
|
317
|
+
variant: "primary",
|
|
318
|
+
type: "submit",
|
|
319
|
+
disabled: !url.trim(),
|
|
320
|
+
children: "Add"
|
|
321
|
+
}),
|
|
322
|
+
MediaPicker ? /* @__PURE__ */ jsx(Button, {
|
|
323
|
+
size: "sm",
|
|
324
|
+
variant: "ghost",
|
|
325
|
+
onClick: () => setUrlMode(false),
|
|
326
|
+
children: "Cancel"
|
|
327
|
+
}) : null
|
|
328
|
+
]
|
|
329
|
+
}) : /* @__PURE__ */ jsxs("div", {
|
|
330
|
+
className: "mt-3 flex flex-wrap gap-2",
|
|
331
|
+
children: [/* @__PURE__ */ jsx(Button, {
|
|
332
|
+
size: "sm",
|
|
333
|
+
leftIcon: /* @__PURE__ */ jsx(IconLibraryPhoto, { stroke: 1.5 }),
|
|
334
|
+
onClick: () => setPicker(true),
|
|
335
|
+
children: "Media library"
|
|
336
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
337
|
+
size: "sm",
|
|
338
|
+
variant: "ghost",
|
|
339
|
+
leftIcon: /* @__PURE__ */ jsx(IconLink, { stroke: 1.5 }),
|
|
340
|
+
onClick: () => setUrlMode(true),
|
|
341
|
+
children: "Paste URL"
|
|
342
|
+
})]
|
|
343
|
+
}),
|
|
344
|
+
pickerEl
|
|
345
|
+
]
|
|
346
|
+
});
|
|
347
|
+
const align = m.align ?? "full";
|
|
348
|
+
const size = m.size;
|
|
349
|
+
const width = size ? SIZES.find((x) => x.v === size)?.w ?? "100%" : ALIGN_WIDTH[align];
|
|
350
|
+
const justify = align === "left" ? "justify-start" : align === "right" ? "justify-end" : "justify-center";
|
|
351
|
+
const alignItem = ALIGNS.find((a) => a.v === align);
|
|
352
|
+
const toolBtn = "flex h-7 shrink-0 items-center gap-1 rounded-kit-md px-1.5 text-kit-xs text-kit-fg-2 hover:bg-kit-hover hover:text-kit-fg data-[popup-open]:bg-kit-hover data-[popup-open]:text-kit-fg [&_svg]:size-3.5";
|
|
353
|
+
return /* @__PURE__ */ jsxs("figure", {
|
|
354
|
+
className: "group/blk relative m-0",
|
|
355
|
+
children: [
|
|
356
|
+
ro ? null : /* @__PURE__ */ jsxs("div", {
|
|
357
|
+
role: "toolbar",
|
|
358
|
+
"aria-label": "Image tools",
|
|
359
|
+
className: cn("glass-strong absolute left-1/2 top-2 z-[3] flex h-8 -translate-x-1/2 items-center gap-0.5 rounded-kit-lg border border-kit-line px-1 opacity-0 transition-opacity duration-150", "group-hover/blk:opacity-100 group-focus-within/blk:opacity-100 pointer-coarse:opacity-100", busy && "opacity-100"),
|
|
360
|
+
children: [
|
|
361
|
+
MediaPicker ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Tooltip, {
|
|
362
|
+
content: "Replace image",
|
|
363
|
+
children: /* @__PURE__ */ jsxs("button", {
|
|
364
|
+
type: "button",
|
|
365
|
+
"aria-label": "Replace image",
|
|
366
|
+
className: toolBtn,
|
|
367
|
+
onClick: () => setPicker(true),
|
|
368
|
+
children: [/* @__PURE__ */ jsx(IconReplace, {
|
|
369
|
+
stroke: 1.5,
|
|
370
|
+
"aria-hidden": true
|
|
371
|
+
}), ctx.dense ? null : "Replace"]
|
|
372
|
+
})
|
|
373
|
+
}), /* @__PURE__ */ jsx(Sep, {})] }) : null,
|
|
374
|
+
/* @__PURE__ */ jsxs(Menu, {
|
|
375
|
+
onOpenChange: setBusy,
|
|
376
|
+
children: [/* @__PURE__ */ jsx(MenuTrigger, { render: /* @__PURE__ */ jsxs("button", {
|
|
377
|
+
type: "button",
|
|
378
|
+
"aria-label": `Align: ${alignItem.label}`,
|
|
379
|
+
className: toolBtn,
|
|
380
|
+
children: [alignItem.icon, /* @__PURE__ */ jsx(IconChevronDown, {
|
|
381
|
+
className: "!size-3 text-kit-fg-3",
|
|
382
|
+
stroke: 1.5,
|
|
383
|
+
"aria-hidden": true
|
|
384
|
+
})]
|
|
385
|
+
}) }), /* @__PURE__ */ jsx(MenuContent, {
|
|
386
|
+
className: "w-40",
|
|
387
|
+
children: ALIGNS.map((a) => /* @__PURE__ */ jsx(MenuItem, {
|
|
388
|
+
icon: a.icon,
|
|
389
|
+
onClick: () => set({
|
|
390
|
+
align: a.v,
|
|
391
|
+
...a.v === "full" ? { size: "full" } : size === "full" || !size ? { size: "l" } : {}
|
|
392
|
+
}, "Align image"),
|
|
393
|
+
children: /* @__PURE__ */ jsxs("span", {
|
|
394
|
+
className: "flex w-full items-center justify-between",
|
|
395
|
+
children: [a.label, align === a.v ? /* @__PURE__ */ jsx(IconCheck, {
|
|
396
|
+
className: "size-3.5 text-kit-fg-2",
|
|
397
|
+
stroke: 2,
|
|
398
|
+
"aria-hidden": true
|
|
399
|
+
}) : null]
|
|
400
|
+
})
|
|
401
|
+
}, a.v))
|
|
402
|
+
})]
|
|
403
|
+
}),
|
|
404
|
+
/* @__PURE__ */ jsx("div", {
|
|
405
|
+
role: "group",
|
|
406
|
+
"aria-label": "Size",
|
|
407
|
+
className: "flex items-center",
|
|
408
|
+
children: SIZES.map((x) => {
|
|
409
|
+
const on = (size ?? (align === "full" ? "full" : null)) === x.v;
|
|
410
|
+
return /* @__PURE__ */ jsx("button", {
|
|
411
|
+
type: "button",
|
|
412
|
+
"aria-pressed": on,
|
|
413
|
+
"aria-label": `Size ${x.label}`,
|
|
414
|
+
onClick: () => set({
|
|
415
|
+
size: x.v,
|
|
416
|
+
...x.v === "full" ? { align: "full" } : align === "full" ? { align: "center" } : {}
|
|
417
|
+
}, "Resize image"),
|
|
418
|
+
className: cn("h-7 min-w-6 rounded-kit-md px-1 text-kit-xs text-kit-fg-3 hover:bg-kit-hover hover:text-kit-fg", on && "bg-kit-selected font-medium text-kit-fg"),
|
|
419
|
+
children: x.label
|
|
420
|
+
}, x.v);
|
|
421
|
+
})
|
|
422
|
+
}),
|
|
423
|
+
/* @__PURE__ */ jsx(Sep, {}),
|
|
424
|
+
/* @__PURE__ */ jsxs(Popover, {
|
|
425
|
+
open: linkOpen,
|
|
426
|
+
onOpenChange: (o) => {
|
|
427
|
+
setLinkOpen(o);
|
|
428
|
+
setBusy(o);
|
|
429
|
+
},
|
|
430
|
+
children: [/* @__PURE__ */ jsx(Tooltip, {
|
|
431
|
+
content: m.href ? `Links to ${m.href}` : "Link the image",
|
|
432
|
+
children: /* @__PURE__ */ jsx(PopoverTrigger, {
|
|
433
|
+
"aria-label": "Link the image",
|
|
434
|
+
className: cn(toolBtn, m.href && "text-kit-accent-fg"),
|
|
435
|
+
children: /* @__PURE__ */ jsx(IconLink, {
|
|
436
|
+
stroke: 1.5,
|
|
437
|
+
"aria-hidden": true
|
|
438
|
+
})
|
|
439
|
+
})
|
|
440
|
+
}), /* @__PURE__ */ jsxs(PopoverContent, {
|
|
441
|
+
className: "w-[340px] rounded-kit-lg p-3",
|
|
442
|
+
finalFocus: false,
|
|
443
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
444
|
+
className: "mb-2 text-kit-xs font-medium text-kit-fg-2",
|
|
445
|
+
children: "Link the image to"
|
|
446
|
+
}), /* @__PURE__ */ jsx(LinkForm, {
|
|
447
|
+
initial: { href: m.href ?? "" },
|
|
448
|
+
allowNewTab: false,
|
|
449
|
+
onSave: (v) => {
|
|
450
|
+
set({ href: v.href }, "Link image");
|
|
451
|
+
setLinkOpen(false);
|
|
452
|
+
setBusy(false);
|
|
453
|
+
},
|
|
454
|
+
onCancel: () => {
|
|
455
|
+
setLinkOpen(false);
|
|
456
|
+
setBusy(false);
|
|
457
|
+
},
|
|
458
|
+
onDetach: m.href ? () => {
|
|
459
|
+
set((x) => {
|
|
460
|
+
const { href: _gone, ...rest } = x;
|
|
461
|
+
return rest;
|
|
462
|
+
}, "Unlink image");
|
|
463
|
+
setLinkOpen(false);
|
|
464
|
+
setBusy(false);
|
|
465
|
+
} : void 0
|
|
466
|
+
})]
|
|
467
|
+
})]
|
|
468
|
+
}),
|
|
469
|
+
/* @__PURE__ */ jsx(AltPopover, {
|
|
470
|
+
alt: m.alt ?? "",
|
|
471
|
+
onSave: (alt) => set({ alt }, "Edit alt text"),
|
|
472
|
+
onOpen: setBusy,
|
|
473
|
+
btnClass: toolBtn
|
|
474
|
+
}),
|
|
475
|
+
/* @__PURE__ */ jsx(Sep, {}),
|
|
476
|
+
/* @__PURE__ */ jsx(Tooltip, {
|
|
477
|
+
content: "Remove image",
|
|
478
|
+
children: /* @__PURE__ */ jsx("button", {
|
|
479
|
+
type: "button",
|
|
480
|
+
"aria-label": "Remove image",
|
|
481
|
+
className: cn(toolBtn, "hover:text-kit-danger-fg"),
|
|
482
|
+
onClick: () => ctx.remove(el),
|
|
483
|
+
children: /* @__PURE__ */ jsx(IconTrash, {
|
|
484
|
+
stroke: 1.5,
|
|
485
|
+
"aria-hidden": true
|
|
486
|
+
})
|
|
487
|
+
})
|
|
488
|
+
})
|
|
489
|
+
]
|
|
490
|
+
}),
|
|
491
|
+
/* @__PURE__ */ jsx("div", {
|
|
492
|
+
className: cn("flex", justify),
|
|
493
|
+
children: /* @__PURE__ */ jsx("img", {
|
|
494
|
+
src: m.src,
|
|
495
|
+
alt: m.alt ?? "",
|
|
496
|
+
style: { width },
|
|
497
|
+
className: "block h-auto max-w-full rounded-kit-lg border border-kit-line",
|
|
498
|
+
draggable: false
|
|
499
|
+
})
|
|
500
|
+
}),
|
|
501
|
+
ro && !m.caption ? null : /* @__PURE__ */ jsx(PlainEditable, {
|
|
502
|
+
value: m.caption ?? "",
|
|
503
|
+
label: "Image caption",
|
|
504
|
+
readOnly: ro,
|
|
505
|
+
placeholder: ro ? "" : "Add a caption…",
|
|
506
|
+
onChange: (caption) => set({ caption }, "Edit caption"),
|
|
507
|
+
onEnter: () => ctx.exit(el),
|
|
508
|
+
className: "mt-1.5 text-center text-kit-sm text-kit-fg-3 empty:before:text-kit-fg-4"
|
|
509
|
+
}),
|
|
510
|
+
pickerEl
|
|
511
|
+
]
|
|
512
|
+
});
|
|
513
|
+
}
|
|
514
|
+
function AltPopover({ alt, onSave, onOpen, btnClass }) {
|
|
515
|
+
const [open, setOpen] = React.useState(false);
|
|
516
|
+
const [v, setV] = React.useState(alt);
|
|
517
|
+
const id = React.useId();
|
|
518
|
+
return /* @__PURE__ */ jsxs(Popover, {
|
|
519
|
+
open,
|
|
520
|
+
onOpenChange: (o) => {
|
|
521
|
+
setOpen(o);
|
|
522
|
+
onOpen(o);
|
|
523
|
+
if (o) setV(alt);
|
|
524
|
+
},
|
|
525
|
+
children: [/* @__PURE__ */ jsx(Tooltip, {
|
|
526
|
+
content: alt ? "Alt text" : "Add alt text",
|
|
527
|
+
children: /* @__PURE__ */ jsx(PopoverTrigger, {
|
|
528
|
+
"aria-label": "Alt text",
|
|
529
|
+
className: cn(btnClass, !alt && "text-kit-warning-fg"),
|
|
530
|
+
children: /* @__PURE__ */ jsx(IconAlt, {
|
|
531
|
+
stroke: 1.5,
|
|
532
|
+
"aria-hidden": true
|
|
533
|
+
})
|
|
534
|
+
})
|
|
535
|
+
}), /* @__PURE__ */ jsx(PopoverContent, {
|
|
536
|
+
className: "w-72",
|
|
537
|
+
finalFocus: false,
|
|
538
|
+
children: /* @__PURE__ */ jsxs("form", {
|
|
539
|
+
onSubmit: (e) => {
|
|
540
|
+
e.preventDefault();
|
|
541
|
+
onSave(v.trim());
|
|
542
|
+
setOpen(false);
|
|
543
|
+
onOpen(false);
|
|
544
|
+
},
|
|
545
|
+
className: "flex flex-col gap-2",
|
|
546
|
+
children: [
|
|
547
|
+
/* @__PURE__ */ jsx("label", {
|
|
548
|
+
className: "text-kit-xs font-medium text-kit-fg-2",
|
|
549
|
+
htmlFor: id,
|
|
550
|
+
children: "Alt text"
|
|
551
|
+
}),
|
|
552
|
+
/* @__PURE__ */ jsx(Textarea, {
|
|
553
|
+
id,
|
|
554
|
+
autoFocus: true,
|
|
555
|
+
value: v,
|
|
556
|
+
onChange: (e) => setV(e.target.value),
|
|
557
|
+
placeholder: "Describe the image",
|
|
558
|
+
rows: 2
|
|
559
|
+
}),
|
|
560
|
+
/* @__PURE__ */ jsx("p", {
|
|
561
|
+
className: "text-kit-2xs text-kit-fg-3",
|
|
562
|
+
children: "Read aloud by screen readers and used by search engines."
|
|
563
|
+
}),
|
|
564
|
+
/* @__PURE__ */ jsx("div", {
|
|
565
|
+
className: "flex justify-end",
|
|
566
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
567
|
+
size: "xs",
|
|
568
|
+
variant: "primary",
|
|
569
|
+
type: "submit",
|
|
570
|
+
children: "Done"
|
|
571
|
+
})
|
|
572
|
+
})
|
|
573
|
+
]
|
|
574
|
+
})
|
|
575
|
+
})]
|
|
576
|
+
});
|
|
577
|
+
}
|
|
578
|
+
var TONES = {
|
|
579
|
+
info: {
|
|
580
|
+
label: "Info",
|
|
581
|
+
icon: /* @__PURE__ */ jsx(IconInfoCircle, { stroke: 1.5 }),
|
|
582
|
+
box: "border-kit-info-line bg-kit-info-soft",
|
|
583
|
+
chip: "text-kit-info-fg"
|
|
584
|
+
},
|
|
585
|
+
tip: {
|
|
586
|
+
label: "Tip",
|
|
587
|
+
icon: /* @__PURE__ */ jsx(IconBulb, { stroke: 1.5 }),
|
|
588
|
+
box: "border-kit-success-line bg-kit-success-soft",
|
|
589
|
+
chip: "text-kit-success-fg"
|
|
590
|
+
},
|
|
591
|
+
warning: {
|
|
592
|
+
label: "Warning",
|
|
593
|
+
icon: /* @__PURE__ */ jsx(IconAlertTriangle, { stroke: 1.5 }),
|
|
594
|
+
box: "border-kit-warning-line bg-kit-warning-soft",
|
|
595
|
+
chip: "text-kit-warning-fg"
|
|
596
|
+
}
|
|
597
|
+
};
|
|
598
|
+
function CalloutBlock({ m, set, el, ctx, autoFocus }) {
|
|
599
|
+
const tone = CALLOUT_TONES.includes(m.tone ?? "") ? m.tone : "info";
|
|
600
|
+
const t = TONES[tone];
|
|
601
|
+
const body = React.useRef(null);
|
|
602
|
+
const ro = ctx.readOnly;
|
|
603
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
604
|
+
className: cn("group/blk relative rounded-kit-lg border px-3.5 py-3", t.box),
|
|
605
|
+
"data-rt-isolate": "",
|
|
606
|
+
children: [
|
|
607
|
+
/* @__PURE__ */ jsxs("div", {
|
|
608
|
+
className: "flex items-center gap-1",
|
|
609
|
+
children: [
|
|
610
|
+
/* @__PURE__ */ jsxs(Menu, { children: [/* @__PURE__ */ jsx(MenuTrigger, {
|
|
611
|
+
disabled: ro,
|
|
612
|
+
render: /* @__PURE__ */ jsxs("button", {
|
|
613
|
+
type: "button",
|
|
614
|
+
"aria-label": `Callout tone: ${t.label}`,
|
|
615
|
+
className: cn("-ml-1 flex h-6 items-center gap-1 rounded-kit-md px-1.5 text-kit-xs font-medium hover:bg-kit-hover data-[popup-open]:bg-kit-hover [&_svg]:size-3.5", t.chip),
|
|
616
|
+
children: [
|
|
617
|
+
t.icon,
|
|
618
|
+
t.label,
|
|
619
|
+
ro ? null : /* @__PURE__ */ jsx(IconChevronDown, {
|
|
620
|
+
className: "!size-3 opacity-70",
|
|
621
|
+
stroke: 1.5,
|
|
622
|
+
"aria-hidden": true
|
|
623
|
+
})
|
|
624
|
+
]
|
|
625
|
+
})
|
|
626
|
+
}), /* @__PURE__ */ jsx(MenuContent, {
|
|
627
|
+
className: "w-36",
|
|
628
|
+
children: CALLOUT_TONES.map((k) => /* @__PURE__ */ jsx(MenuItem, {
|
|
629
|
+
icon: TONES[k].icon,
|
|
630
|
+
onClick: () => set({ tone: k }, "Change callout tone"),
|
|
631
|
+
children: /* @__PURE__ */ jsxs("span", {
|
|
632
|
+
className: "flex w-full items-center justify-between",
|
|
633
|
+
children: [TONES[k].label, tone === k ? /* @__PURE__ */ jsx(IconCheck, {
|
|
634
|
+
className: "size-3.5 text-kit-fg-2",
|
|
635
|
+
stroke: 2,
|
|
636
|
+
"aria-hidden": true
|
|
637
|
+
}) : null]
|
|
638
|
+
})
|
|
639
|
+
}, k))
|
|
640
|
+
})] }),
|
|
641
|
+
/* @__PURE__ */ jsx("span", { className: "flex-1" }),
|
|
642
|
+
ro ? null : /* @__PURE__ */ jsx("div", {
|
|
643
|
+
className: "opacity-0 transition-opacity group-hover/blk:opacity-100 group-focus-within/blk:opacity-100 pointer-coarse:opacity-100",
|
|
644
|
+
children: /* @__PURE__ */ jsx(RemoveBtn, {
|
|
645
|
+
onClick: () => ctx.remove(el),
|
|
646
|
+
label: "Remove callout"
|
|
647
|
+
})
|
|
648
|
+
})
|
|
649
|
+
]
|
|
650
|
+
}),
|
|
651
|
+
/* @__PURE__ */ jsx(PlainEditable, {
|
|
652
|
+
value: m.title ?? "",
|
|
653
|
+
label: "Callout title",
|
|
654
|
+
readOnly: ro,
|
|
655
|
+
autoFocus,
|
|
656
|
+
placeholder: "Title",
|
|
657
|
+
onChange: (title) => set({ title }, "Edit callout title"),
|
|
658
|
+
onEnter: () => {
|
|
659
|
+
const b = body.current?.querySelector("[role=textbox]");
|
|
660
|
+
b?.focus();
|
|
661
|
+
if (b) placeCaret(b, false);
|
|
662
|
+
},
|
|
663
|
+
className: "mt-1 font-medium text-kit-fg"
|
|
664
|
+
}),
|
|
665
|
+
/* @__PURE__ */ jsx("div", {
|
|
666
|
+
ref: body,
|
|
667
|
+
children: /* @__PURE__ */ jsx(PlainEditable, {
|
|
668
|
+
multiline: true,
|
|
669
|
+
value: m.body ?? "",
|
|
670
|
+
label: "Callout message",
|
|
671
|
+
readOnly: ro,
|
|
672
|
+
placeholder: "Write a message…",
|
|
673
|
+
onChange: (b) => set({ body: b }, "Edit callout message"),
|
|
674
|
+
className: "mt-0.5 text-kit-fg-2 [&_p+p]:mt-2"
|
|
675
|
+
})
|
|
676
|
+
})
|
|
677
|
+
]
|
|
678
|
+
});
|
|
679
|
+
}
|
|
680
|
+
function ToggleBlock({ m, set, el, ctx, autoFocus }) {
|
|
681
|
+
const [open, setOpen] = React.useState(!!autoFocus);
|
|
682
|
+
const body = React.useRef(null);
|
|
683
|
+
const bodyId = React.useId();
|
|
684
|
+
const ro = ctx.readOnly;
|
|
685
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
686
|
+
className: "group/blk relative rounded-kit-md",
|
|
687
|
+
"data-rt-isolate": "",
|
|
688
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
689
|
+
className: "flex items-start gap-1",
|
|
690
|
+
children: [
|
|
691
|
+
/* @__PURE__ */ jsx("button", {
|
|
692
|
+
type: "button",
|
|
693
|
+
"aria-expanded": open,
|
|
694
|
+
"aria-controls": bodyId,
|
|
695
|
+
"aria-label": open ? "Collapse toggle" : "Expand toggle",
|
|
696
|
+
onClick: () => setOpen((o) => !o),
|
|
697
|
+
className: "mt-0.5 flex size-6 shrink-0 items-center justify-center rounded-kit-md text-kit-fg-2 hover:bg-kit-hover hover:text-kit-fg",
|
|
698
|
+
children: /* @__PURE__ */ jsx(IconChevronRight, {
|
|
699
|
+
className: cn("size-4 transition-transform duration-150", open && "rotate-90"),
|
|
700
|
+
stroke: 1.5,
|
|
701
|
+
"aria-hidden": true
|
|
702
|
+
})
|
|
703
|
+
}),
|
|
704
|
+
/* @__PURE__ */ jsx(PlainEditable, {
|
|
705
|
+
value: m.title ?? "",
|
|
706
|
+
label: "Toggle title",
|
|
707
|
+
readOnly: ro,
|
|
708
|
+
autoFocus,
|
|
709
|
+
placeholder: "Toggle title",
|
|
710
|
+
onChange: (title) => set({ title }, "Edit toggle title"),
|
|
711
|
+
onEnter: () => {
|
|
712
|
+
setOpen(true);
|
|
713
|
+
requestAnimationFrame(() => {
|
|
714
|
+
const b = body.current?.querySelector("[role=textbox]");
|
|
715
|
+
b?.focus();
|
|
716
|
+
if (b) placeCaret(b, false);
|
|
717
|
+
});
|
|
718
|
+
},
|
|
719
|
+
className: "flex-1 py-0.5 font-medium text-kit-fg"
|
|
720
|
+
}),
|
|
721
|
+
ro ? null : /* @__PURE__ */ jsx("div", {
|
|
722
|
+
className: "opacity-0 transition-opacity group-hover/blk:opacity-100 group-focus-within/blk:opacity-100 pointer-coarse:opacity-100",
|
|
723
|
+
children: /* @__PURE__ */ jsx(RemoveBtn, {
|
|
724
|
+
onClick: () => ctx.remove(el),
|
|
725
|
+
label: "Remove toggle"
|
|
726
|
+
})
|
|
727
|
+
})
|
|
728
|
+
]
|
|
729
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
730
|
+
ref: body,
|
|
731
|
+
id: bodyId,
|
|
732
|
+
hidden: !open,
|
|
733
|
+
className: "ml-3 mt-1 border-l border-kit-line pl-4",
|
|
734
|
+
children: /* @__PURE__ */ jsx(PlainEditable, {
|
|
735
|
+
multiline: true,
|
|
736
|
+
value: m.body ?? "",
|
|
737
|
+
label: "Toggle body",
|
|
738
|
+
readOnly: ro,
|
|
739
|
+
placeholder: "Hidden content. Click to write…",
|
|
740
|
+
onChange: (b) => set({ body: b }, "Edit toggle body"),
|
|
741
|
+
className: "py-0.5 text-kit-fg-2 [&_p+p]:mt-2"
|
|
742
|
+
})
|
|
743
|
+
})]
|
|
744
|
+
});
|
|
745
|
+
}
|
|
746
|
+
var videoUrlOk = (u) => /^https?:\/\/\S+$/i.test(u) || /^\/(?!\/)\S*$/.test(u);
|
|
747
|
+
function videoEmbedSrc(url) {
|
|
748
|
+
const yt = /(?:youtube\.com\/(?:watch\?(?:.*&)?v=|embed\/|shorts\/|live\/)|youtu\.be\/)([\w-]{6,})/i.exec(url);
|
|
749
|
+
if (yt) return `https://www.youtube-nocookie.com/embed/${yt[1]}`;
|
|
750
|
+
const vimeo = /vimeo\.com\/(?:video\/)?(\d+)/i.exec(url);
|
|
751
|
+
if (vimeo) return `https://player.vimeo.com/video/${vimeo[1]}`;
|
|
752
|
+
return null;
|
|
753
|
+
}
|
|
754
|
+
function VideoBlock({ m, set, el, ctx, autoFocus }) {
|
|
755
|
+
const [draft, setDraft] = React.useState(m.url ?? "");
|
|
756
|
+
React.useEffect(() => setDraft(m.url ?? ""), [m.url]);
|
|
757
|
+
const [error, setError] = React.useState(null);
|
|
758
|
+
const errId = React.useId();
|
|
759
|
+
const commit = () => {
|
|
760
|
+
const u = draft.trim();
|
|
761
|
+
if (u === (m.url ?? "")) return setError(null);
|
|
762
|
+
if (u && !videoUrlOk(u)) return setError("Paste a full link that starts with https://, or a path on this site.");
|
|
763
|
+
setError(null);
|
|
764
|
+
set({ url: u }, "Set video link");
|
|
765
|
+
};
|
|
766
|
+
const ro = ctx.readOnly;
|
|
767
|
+
const frame = m.url ? videoEmbedSrc(m.url) : null;
|
|
768
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
769
|
+
className: "group/blk rounded-kit-lg border border-kit-line bg-kit-subtle p-2.5",
|
|
770
|
+
"data-rt-isolate": "",
|
|
771
|
+
children: [
|
|
772
|
+
ro ? null : /* @__PURE__ */ jsxs("div", {
|
|
773
|
+
className: "mb-2 flex items-center gap-1.5",
|
|
774
|
+
children: [/* @__PURE__ */ jsx(Input, {
|
|
775
|
+
size: "sm",
|
|
776
|
+
autoFocus,
|
|
777
|
+
value: draft,
|
|
778
|
+
onChange: (e) => setDraft(e.target.value),
|
|
779
|
+
onBlur: commit,
|
|
780
|
+
onKeyDown: (e) => {
|
|
781
|
+
if (e.key === "Enter") {
|
|
782
|
+
e.preventDefault();
|
|
783
|
+
commit();
|
|
784
|
+
}
|
|
785
|
+
},
|
|
786
|
+
placeholder: "Paste a YouTube, Vimeo or video file link",
|
|
787
|
+
"aria-label": "Video URL",
|
|
788
|
+
"aria-invalid": !!error || void 0,
|
|
789
|
+
"aria-describedby": error ? errId : void 0,
|
|
790
|
+
spellCheck: false,
|
|
791
|
+
autoComplete: "off",
|
|
792
|
+
leading: /* @__PURE__ */ jsx(IconWorld, { stroke: 1.5 }),
|
|
793
|
+
className: "min-w-0 flex-1"
|
|
794
|
+
}), /* @__PURE__ */ jsx(RemoveBtn, {
|
|
795
|
+
onClick: () => ctx.remove(el),
|
|
796
|
+
label: "Remove video"
|
|
797
|
+
})]
|
|
798
|
+
}),
|
|
799
|
+
error ? /* @__PURE__ */ jsx("p", {
|
|
800
|
+
id: errId,
|
|
801
|
+
role: "alert",
|
|
802
|
+
className: "mb-2 px-1 text-kit-xs text-kit-danger-fg",
|
|
803
|
+
children: error
|
|
804
|
+
}) : null,
|
|
805
|
+
frame ? /* @__PURE__ */ jsx("iframe", {
|
|
806
|
+
src: frame,
|
|
807
|
+
title: m.title || "Video preview",
|
|
808
|
+
loading: "lazy",
|
|
809
|
+
tabIndex: -1,
|
|
810
|
+
sandbox: "allow-scripts allow-same-origin allow-presentation",
|
|
811
|
+
referrerPolicy: "strict-origin-when-cross-origin",
|
|
812
|
+
className: "pointer-events-none aspect-video w-full rounded-kit-md border-0 bg-kit-muted"
|
|
813
|
+
}) : m.url ? /* @__PURE__ */ jsx("video", {
|
|
814
|
+
src: m.url,
|
|
815
|
+
title: m.title || "Video preview",
|
|
816
|
+
controls: true,
|
|
817
|
+
preload: "metadata",
|
|
818
|
+
className: "aspect-video w-full rounded-kit-md bg-kit-muted"
|
|
819
|
+
}) : /* @__PURE__ */ jsx("p", {
|
|
820
|
+
className: "px-1 pb-0.5 text-kit-xs text-kit-fg-3",
|
|
821
|
+
children: "No video yet."
|
|
822
|
+
})
|
|
823
|
+
]
|
|
824
|
+
});
|
|
825
|
+
}
|
|
826
|
+
var formatBytes = (n) => n < 1024 ? `${n} B` : n < 1048576 ? `${(n / 1024).toFixed(0)} KB` : `${(n / 1024 / 1024).toFixed(1)} MB`;
|
|
827
|
+
function FileBlock({ m, set, el, ctx, autoFocus }) {
|
|
828
|
+
const { MediaPicker } = useKitServices();
|
|
829
|
+
const [picker, setPicker] = React.useState(false);
|
|
830
|
+
const [url, setUrl] = React.useState("");
|
|
831
|
+
const [name, setName] = React.useState("");
|
|
832
|
+
const ro = ctx.readOnly;
|
|
833
|
+
const has = !!(m.url && m.name);
|
|
834
|
+
const pickerEl = MediaPicker ? /* @__PURE__ */ jsx(MediaPicker, {
|
|
835
|
+
open: picker,
|
|
836
|
+
onOpenChange: setPicker,
|
|
837
|
+
accept: ["file"],
|
|
838
|
+
onPick: (a) => a[0] && set({
|
|
839
|
+
url: a[0].url,
|
|
840
|
+
name: a[0].name ?? a[0].url.split("/").pop() ?? "Download",
|
|
841
|
+
...a[0].size ? { size: a[0].size } : {}
|
|
842
|
+
}, "Choose file")
|
|
843
|
+
}) : null;
|
|
844
|
+
if (has) return /* @__PURE__ */ jsxs("div", {
|
|
845
|
+
className: "group/blk",
|
|
846
|
+
"data-rt-isolate": "",
|
|
847
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
848
|
+
className: "flex items-center gap-3 rounded-kit-lg border border-kit-line bg-kit-surface px-3 py-2.5",
|
|
849
|
+
children: [
|
|
850
|
+
/* @__PURE__ */ jsx("span", {
|
|
851
|
+
className: "flex size-9 shrink-0 items-center justify-center rounded-kit-md bg-kit-muted text-kit-fg-2",
|
|
852
|
+
children: /* @__PURE__ */ jsx(IconFileText, {
|
|
853
|
+
className: "size-[18px]",
|
|
854
|
+
stroke: 1.5,
|
|
855
|
+
"aria-hidden": true
|
|
856
|
+
})
|
|
857
|
+
}),
|
|
858
|
+
/* @__PURE__ */ jsxs("div", {
|
|
859
|
+
className: "min-w-0 flex-1",
|
|
860
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
861
|
+
className: "truncate text-kit-sm font-medium text-kit-fg",
|
|
862
|
+
children: m.name
|
|
863
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
864
|
+
className: "truncate text-kit-xs text-kit-fg-3",
|
|
865
|
+
children: [m.size ? `${formatBytes(m.size)} · ` : "", (m.name.includes(".") ? m.name.split(".").pop() : "file").toUpperCase()]
|
|
866
|
+
})]
|
|
867
|
+
}),
|
|
868
|
+
ro ? null : /* @__PURE__ */ jsxs(Fragment, { children: [MediaPicker ? /* @__PURE__ */ jsx(Button, {
|
|
869
|
+
size: "xs",
|
|
870
|
+
variant: "ghost",
|
|
871
|
+
onClick: () => setPicker(true),
|
|
872
|
+
children: "Replace"
|
|
873
|
+
}) : null, /* @__PURE__ */ jsx(RemoveBtn, {
|
|
874
|
+
onClick: () => ctx.remove(el),
|
|
875
|
+
label: "Remove file"
|
|
876
|
+
})] })
|
|
877
|
+
]
|
|
878
|
+
}), pickerEl]
|
|
879
|
+
});
|
|
880
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
881
|
+
className: "group/blk",
|
|
882
|
+
"data-rt-isolate": "",
|
|
883
|
+
children: [
|
|
884
|
+
/* @__PURE__ */ jsxs("div", {
|
|
885
|
+
className: "flex items-center gap-3 rounded-kit-lg border border-dashed border-kit-line-strong bg-kit-subtle px-3 py-2.5",
|
|
886
|
+
children: [
|
|
887
|
+
/* @__PURE__ */ jsx("span", {
|
|
888
|
+
className: "flex size-9 shrink-0 items-center justify-center rounded-kit-md border border-kit-line bg-kit-control-bg text-kit-fg-3",
|
|
889
|
+
children: /* @__PURE__ */ jsx(IconFileText, {
|
|
890
|
+
className: "size-[18px]",
|
|
891
|
+
stroke: 1.5,
|
|
892
|
+
"aria-hidden": true
|
|
893
|
+
})
|
|
894
|
+
}),
|
|
895
|
+
/* @__PURE__ */ jsxs("div", {
|
|
896
|
+
className: "min-w-0 flex-1",
|
|
897
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
898
|
+
className: "text-kit-sm font-medium text-kit-fg",
|
|
899
|
+
children: "File"
|
|
900
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
901
|
+
className: "text-kit-xs text-kit-fg-3",
|
|
902
|
+
children: "No file yet."
|
|
903
|
+
})]
|
|
904
|
+
}),
|
|
905
|
+
ro ? null : /* @__PURE__ */ jsxs(Fragment, { children: [MediaPicker ? /* @__PURE__ */ jsx(Button, {
|
|
906
|
+
size: "sm",
|
|
907
|
+
leftIcon: /* @__PURE__ */ jsx(IconFileUpload, { stroke: 1.5 }),
|
|
908
|
+
onClick: () => setPicker(true),
|
|
909
|
+
children: "Choose file"
|
|
910
|
+
}) : null, /* @__PURE__ */ jsx(RemoveBtn, {
|
|
911
|
+
onClick: () => ctx.remove(el),
|
|
912
|
+
label: "Remove file"
|
|
913
|
+
})] })
|
|
914
|
+
]
|
|
915
|
+
}),
|
|
916
|
+
ro ? null : /* @__PURE__ */ jsxs("form", {
|
|
917
|
+
className: "mt-2.5 flex flex-wrap items-center gap-2",
|
|
918
|
+
onSubmit: (e) => {
|
|
919
|
+
e.preventDefault();
|
|
920
|
+
const u = url.trim();
|
|
921
|
+
if (!/^https?:\/\/\S+$/i.test(u) && !/^\/(?!\/)\S*$/.test(u)) return ctx.notify("Paste a full file link that starts with https://", "Or a path on this site, like /files/spec.pdf.");
|
|
922
|
+
set({
|
|
923
|
+
url: u,
|
|
924
|
+
name: name.trim() || u.split("/").pop() || "Download"
|
|
925
|
+
}, "Add file");
|
|
926
|
+
ctx.exit(el);
|
|
927
|
+
},
|
|
928
|
+
children: [
|
|
929
|
+
/* @__PURE__ */ jsx(Input, {
|
|
930
|
+
autoFocus: autoFocus && !MediaPicker,
|
|
931
|
+
size: "sm",
|
|
932
|
+
value: url,
|
|
933
|
+
onChange: (e) => setUrl(e.target.value),
|
|
934
|
+
placeholder: "https://…/guide.pdf",
|
|
935
|
+
"aria-label": "File URL",
|
|
936
|
+
spellCheck: false,
|
|
937
|
+
autoComplete: "off",
|
|
938
|
+
leading: /* @__PURE__ */ jsx(IconLink, { stroke: 1.5 }),
|
|
939
|
+
className: "min-w-40 flex-1"
|
|
940
|
+
}),
|
|
941
|
+
/* @__PURE__ */ jsx(Input, {
|
|
942
|
+
size: "sm",
|
|
943
|
+
value: name,
|
|
944
|
+
onChange: (e) => setName(e.target.value),
|
|
945
|
+
placeholder: "Link text",
|
|
946
|
+
"aria-label": "File name shown to readers",
|
|
947
|
+
className: "min-w-28 flex-1"
|
|
948
|
+
}),
|
|
949
|
+
/* @__PURE__ */ jsx(Button, {
|
|
950
|
+
size: "sm",
|
|
951
|
+
variant: "primary",
|
|
952
|
+
type: "submit",
|
|
953
|
+
disabled: !url.trim(),
|
|
954
|
+
children: "Add"
|
|
955
|
+
})
|
|
956
|
+
]
|
|
957
|
+
}),
|
|
958
|
+
pickerEl
|
|
959
|
+
]
|
|
960
|
+
});
|
|
961
|
+
}
|
|
962
|
+
function ComponentBlock({ m, el, ctx, set }) {
|
|
963
|
+
const { useComponentInfo } = useKitServices();
|
|
964
|
+
const overrides = React.useMemo(() => {
|
|
965
|
+
try {
|
|
966
|
+
const v = m.overrides ? JSON.parse(m.overrides) : {};
|
|
967
|
+
return v && typeof v === "object" && !Array.isArray(v) ? v : {};
|
|
968
|
+
} catch {
|
|
969
|
+
return {};
|
|
970
|
+
}
|
|
971
|
+
}, [m.overrides]);
|
|
972
|
+
if (useComponentInfo) return /* @__PURE__ */ jsx(ComponentCard, {
|
|
973
|
+
m,
|
|
974
|
+
el,
|
|
975
|
+
ctx,
|
|
976
|
+
use: useComponentInfo,
|
|
977
|
+
overrides,
|
|
978
|
+
set
|
|
979
|
+
});
|
|
980
|
+
const count = Object.keys(overrides).length;
|
|
981
|
+
const name = m.name || "Block";
|
|
982
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
983
|
+
role: "group",
|
|
984
|
+
"aria-label": `${name}, ${m.detached ? "separate copy" : "linked block"}`,
|
|
985
|
+
className: "group/blk flex items-center gap-3 rounded-kit-lg border border-kit-line bg-kit-surface px-3 py-2.5",
|
|
986
|
+
"data-rt-isolate": "",
|
|
987
|
+
children: [
|
|
988
|
+
/* @__PURE__ */ jsx("span", {
|
|
989
|
+
className: "flex size-9 shrink-0 items-center justify-center rounded-kit-md bg-kit-muted text-kit-fg-2",
|
|
990
|
+
children: /* @__PURE__ */ jsx(IconComponents, {
|
|
991
|
+
className: "size-[18px]",
|
|
992
|
+
stroke: 1.5,
|
|
993
|
+
"aria-hidden": true
|
|
994
|
+
})
|
|
995
|
+
}),
|
|
996
|
+
/* @__PURE__ */ jsxs("div", {
|
|
997
|
+
className: "min-w-0 flex-1",
|
|
998
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
999
|
+
className: "truncate text-kit-sm font-medium text-kit-fg",
|
|
1000
|
+
children: name
|
|
1001
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
1002
|
+
className: "truncate text-kit-xs text-kit-fg-3",
|
|
1003
|
+
children: m.detached ? "Separate copy · edits to the block don't reach it" : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1004
|
+
m.ref ? "Linked block" : "Block with no source",
|
|
1005
|
+
count ? ` · ${count} ${count === 1 ? "override" : "overrides"}` : "",
|
|
1006
|
+
" · edits to the component show here too"
|
|
1007
|
+
] })
|
|
1008
|
+
})]
|
|
1009
|
+
}),
|
|
1010
|
+
ctx.readOnly ? null : /* @__PURE__ */ jsxs("div", {
|
|
1011
|
+
className: "flex items-center gap-0.5 opacity-0 transition-opacity motion-reduce:transition-none group-hover/blk:opacity-100 group-focus-within/blk:opacity-100 pointer-coarse:opacity-100",
|
|
1012
|
+
children: [ctx.duplicate ? /* @__PURE__ */ jsx(IconButton, {
|
|
1013
|
+
size: "xs",
|
|
1014
|
+
label: `Duplicate ${name}`,
|
|
1015
|
+
onClick: () => ctx.duplicate?.(el),
|
|
1016
|
+
children: /* @__PURE__ */ jsx(IconCopy, { stroke: 1.5 })
|
|
1017
|
+
}) : null, /* @__PURE__ */ jsx(RemoveBtn, {
|
|
1018
|
+
onClick: () => ctx.remove(el),
|
|
1019
|
+
label: `Remove ${name}`
|
|
1020
|
+
})]
|
|
1021
|
+
})
|
|
1022
|
+
]
|
|
1023
|
+
});
|
|
1024
|
+
}
|
|
1025
|
+
/**
|
|
1026
|
+
* What production's rich-text table keeps: typed columns (V2's Text, Number, Price, Yes / No, Link and Rating with their unit,
|
|
1027
|
+
* currency, decimals, alignment, yes / no words, scale and description; a row's and a cell's type and a cell's value: a
|
|
1028
|
+
* first-row cell's `column`, a row's / cell's `type`, a cell's `value`), the header row and row headers, an optional caption,
|
|
1029
|
+
* the note under the table, row groups, the totals row and the row and column highlights (`caption`, `notes`,
|
|
1030
|
+
* `rowGroups`, a row's `footer` / `highlight`, a first-row cell's `highlight` / `sortable`, the table's `filterable`).
|
|
1031
|
+
* the table's `jsonLd` and `design` (On phones, Keep column names in view)). Footnotes are stored as the table's `footnotes` and a cell's `note` (V2's default, allowFootnotes on). No setting is
|
|
1032
|
+
* pinned: V2's island passes no options, so its editor offers GENERAL_TABLE (sort, search and the JSON-LD choice on,
|
|
1033
|
+
* everything else at its default), and so does this.
|
|
1034
|
+
*/
|
|
1035
|
+
var STORED_TABLE = {
|
|
1036
|
+
requireCaption: false,
|
|
1037
|
+
allowGroups: true,
|
|
1038
|
+
allowNote: true,
|
|
1039
|
+
settings: {
|
|
1040
|
+
sort: true,
|
|
1041
|
+
search: true
|
|
1042
|
+
},
|
|
1043
|
+
jsonLd: [
|
|
1044
|
+
"ItemList",
|
|
1045
|
+
"Dataset",
|
|
1046
|
+
"Offers"
|
|
1047
|
+
]
|
|
1048
|
+
};
|
|
1049
|
+
function TableBlock({ m, set, el, ctx }) {
|
|
1050
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1051
|
+
className: "group/blk",
|
|
1052
|
+
"data-rt-isolate": "",
|
|
1053
|
+
children: /* @__PURE__ */ jsx(TableEditor, {
|
|
1054
|
+
value: m,
|
|
1055
|
+
onChange: (next) => set(() => next, "Edit table"),
|
|
1056
|
+
readOnly: ctx.readOnly,
|
|
1057
|
+
options: STORED_TABLE,
|
|
1058
|
+
label: "Table",
|
|
1059
|
+
actions: ctx.readOnly ? null : /* @__PURE__ */ jsx(RemoveBtn, {
|
|
1060
|
+
onClick: () => ctx.remove(el),
|
|
1061
|
+
label: "Remove table"
|
|
1062
|
+
})
|
|
1063
|
+
})
|
|
1064
|
+
});
|
|
1065
|
+
}
|
|
1066
|
+
var PULL_QUOTE_LABEL = "Pull quote";
|
|
1067
|
+
/** V2 article.ts ARTICLE_SCHEMAS.pullquote: the properties panel is built from it. */
|
|
1068
|
+
var PULL_QUOTE_SCHEMA = {
|
|
1069
|
+
name: "pullQuote",
|
|
1070
|
+
title: PULL_QUOTE_LABEL,
|
|
1071
|
+
kind: "object",
|
|
1072
|
+
icon: "quote",
|
|
1073
|
+
fields: [
|
|
1074
|
+
{
|
|
1075
|
+
name: "quote",
|
|
1076
|
+
title: "Quote",
|
|
1077
|
+
type: "text",
|
|
1078
|
+
rows: 3,
|
|
1079
|
+
validation: {
|
|
1080
|
+
required: true,
|
|
1081
|
+
recommendedMax: 200
|
|
1082
|
+
}
|
|
1083
|
+
},
|
|
1084
|
+
{
|
|
1085
|
+
name: "name",
|
|
1086
|
+
title: "Name",
|
|
1087
|
+
type: "string",
|
|
1088
|
+
validation: { max: 60 }
|
|
1089
|
+
},
|
|
1090
|
+
{
|
|
1091
|
+
name: "role",
|
|
1092
|
+
title: "Role or source",
|
|
1093
|
+
type: "string",
|
|
1094
|
+
validation: { max: 80 }
|
|
1095
|
+
},
|
|
1096
|
+
{
|
|
1097
|
+
name: "link",
|
|
1098
|
+
title: "Source link",
|
|
1099
|
+
type: "url",
|
|
1100
|
+
description: "The name links here."
|
|
1101
|
+
}
|
|
1102
|
+
]
|
|
1103
|
+
};
|
|
1104
|
+
var openArticle = null;
|
|
1105
|
+
var articleSubs = /* @__PURE__ */ new Set();
|
|
1106
|
+
var setOpenArticle = (next) => {
|
|
1107
|
+
openArticle = next;
|
|
1108
|
+
articleSubs.forEach((f) => f());
|
|
1109
|
+
};
|
|
1110
|
+
function useOpenArticle() {
|
|
1111
|
+
return React.useSyncExternalStore((cb) => (articleSubs.add(cb), () => void articleSubs.delete(cb)), () => openArticle, () => openArticle);
|
|
1112
|
+
}
|
|
1113
|
+
var controlOf = (el) => Array.from(el.querySelectorAll("textarea, input:not([type=hidden]), [contenteditable=true], [role=combobox]")).find((n) => n.getClientRects().length) ?? Array.from(el.querySelectorAll(":scope > :not(:first-child) button")).find((n) => n.getClientRects().length);
|
|
1114
|
+
function focusField(root, key) {
|
|
1115
|
+
if (!root) return;
|
|
1116
|
+
const rows = Array.from(root.querySelectorAll("[data-field-key]"));
|
|
1117
|
+
const row = key && rows.find((r) => r.getAttribute("data-field-key") === key) || rows[0];
|
|
1118
|
+
if (!row) return;
|
|
1119
|
+
row.scrollIntoView({ block: "nearest" });
|
|
1120
|
+
controlOf(row)?.focus({ preventScroll: true });
|
|
1121
|
+
}
|
|
1122
|
+
function PullQuoteBlock({ m, set, el, ctx, autoFocus }) {
|
|
1123
|
+
const label = PULL_QUOTE_LABEL;
|
|
1124
|
+
const uid = React.useId();
|
|
1125
|
+
const card = React.useRef(null);
|
|
1126
|
+
const [cardEl, setCardEl] = React.useState(null);
|
|
1127
|
+
const open = useOpenArticle();
|
|
1128
|
+
const editing = open?.id === uid;
|
|
1129
|
+
const cardRef = React.useCallback((n) => {
|
|
1130
|
+
card.current = n;
|
|
1131
|
+
if (n) setCardEl(n);
|
|
1132
|
+
}, []);
|
|
1133
|
+
const ro = !!ctx.readOnly;
|
|
1134
|
+
const modelRef = React.useRef(m);
|
|
1135
|
+
modelRef.current = m;
|
|
1136
|
+
const openPanel = React.useCallback((k) => {
|
|
1137
|
+
if (!ro) setOpenArticle({
|
|
1138
|
+
id: uid,
|
|
1139
|
+
focusKey: k ?? null,
|
|
1140
|
+
nonce: (openArticle?.nonce ?? 0) + 1
|
|
1141
|
+
});
|
|
1142
|
+
}, [uid, ro]);
|
|
1143
|
+
const close = React.useCallback(() => {
|
|
1144
|
+
if (openArticle?.id === uid) setOpenArticle(null);
|
|
1145
|
+
}, [uid]);
|
|
1146
|
+
const focusCard = React.useCallback(() => requestAnimationFrame(() => card.current?.focus({ preventScroll: true })), []);
|
|
1147
|
+
React.useEffect(() => () => {
|
|
1148
|
+
if (openArticle?.id === uid) setOpenArticle(null);
|
|
1149
|
+
}, [uid]);
|
|
1150
|
+
React.useEffect(() => {
|
|
1151
|
+
if (autoFocus && !ro) openPanel();
|
|
1152
|
+
}, []);
|
|
1153
|
+
/** a form edit joins the body's one undo history (D54); typing coalesces per field */
|
|
1154
|
+
const commit = (next) => {
|
|
1155
|
+
const prev = modelRef.current;
|
|
1156
|
+
const field = Object.keys(next).find((k) => next[k] !== prev[k]) ?? "";
|
|
1157
|
+
set(() => next, `Edit ${label.toLowerCase()} ${field}`);
|
|
1158
|
+
};
|
|
1159
|
+
const onKeyDown = (e) => {
|
|
1160
|
+
if (e.defaultPrevented || e.target !== card.current) return;
|
|
1161
|
+
const mod = e.metaKey || e.ctrlKey;
|
|
1162
|
+
const k = eventKey(e);
|
|
1163
|
+
if (mod && k === "z") {
|
|
1164
|
+
e.preventDefault();
|
|
1165
|
+
e.stopPropagation();
|
|
1166
|
+
if (e.shiftKey) ctx.redo?.();
|
|
1167
|
+
else ctx.undo?.();
|
|
1168
|
+
return;
|
|
1169
|
+
}
|
|
1170
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
1171
|
+
e.preventDefault();
|
|
1172
|
+
openPanel();
|
|
1173
|
+
return;
|
|
1174
|
+
}
|
|
1175
|
+
if (e.key === "Escape") {
|
|
1176
|
+
e.preventDefault();
|
|
1177
|
+
e.stopPropagation();
|
|
1178
|
+
if (editing) close();
|
|
1179
|
+
else ctx.exit(el);
|
|
1180
|
+
return;
|
|
1181
|
+
}
|
|
1182
|
+
if (ro) return;
|
|
1183
|
+
if (mod && k === "d" && ctx.duplicate) {
|
|
1184
|
+
e.preventDefault();
|
|
1185
|
+
e.stopPropagation();
|
|
1186
|
+
ctx.duplicate(el);
|
|
1187
|
+
} else if (e.altKey && (e.key === "ArrowUp" || e.key === "ArrowDown") && ctx.move) {
|
|
1188
|
+
e.preventDefault();
|
|
1189
|
+
ctx.move(el, e.key === "ArrowUp" ? -1 : 1);
|
|
1190
|
+
focusCard();
|
|
1191
|
+
} else if (e.key === "Backspace" || e.key === "Delete") {
|
|
1192
|
+
e.preventDefault();
|
|
1193
|
+
ctx.remove(el);
|
|
1194
|
+
}
|
|
1195
|
+
};
|
|
1196
|
+
const actions = ro ? null : /* @__PURE__ */ jsxs("div", {
|
|
1197
|
+
className: cn("absolute -top-3.5 right-2 z-[2] flex items-center gap-0.5 rounded-kit-md border border-kit-line bg-kit-surface-raised p-0.5 opacity-0 shadow-kit-sm transition-opacity", "group-hover/art:opacity-100 group-focus-within/art:opacity-100 pointer-coarse:opacity-100", editing && "opacity-100"),
|
|
1198
|
+
children: [/* @__PURE__ */ jsx(IconButton, {
|
|
1199
|
+
size: "xs",
|
|
1200
|
+
label: `Edit ${label.toLowerCase()}`,
|
|
1201
|
+
onClick: () => editing ? close() : openPanel(),
|
|
1202
|
+
children: /* @__PURE__ */ jsx(IconSettings, { stroke: 1.5 })
|
|
1203
|
+
}), /* @__PURE__ */ jsx(IconButton, {
|
|
1204
|
+
size: "xs",
|
|
1205
|
+
label: `Remove ${label.toLowerCase()}`,
|
|
1206
|
+
onClick: () => ctx.remove(el),
|
|
1207
|
+
className: "hover:text-kit-danger-fg",
|
|
1208
|
+
children: /* @__PURE__ */ jsx(IconTrash, { stroke: 1.5 })
|
|
1209
|
+
})]
|
|
1210
|
+
});
|
|
1211
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
|
|
1212
|
+
ref: cardRef,
|
|
1213
|
+
role: "group",
|
|
1214
|
+
tabIndex: 0,
|
|
1215
|
+
"aria-label": `${label}${editing ? ", editing" : ""}`,
|
|
1216
|
+
"aria-roledescription": "block",
|
|
1217
|
+
"aria-haspopup": "dialog",
|
|
1218
|
+
"aria-expanded": editing,
|
|
1219
|
+
"data-rt-isolate": "",
|
|
1220
|
+
"data-article-block": "pullquote",
|
|
1221
|
+
onKeyDown,
|
|
1222
|
+
onClick: (e) => {
|
|
1223
|
+
if (ro || !e.currentTarget.contains(e.target)) return;
|
|
1224
|
+
const t = e.target;
|
|
1225
|
+
if (t.closest("button,a,[role=menuitem]")) return;
|
|
1226
|
+
openPanel(t.closest("[data-field]")?.getAttribute("data-field") ?? null);
|
|
1227
|
+
},
|
|
1228
|
+
className: cn("group/art relative rounded-kit-lg outline-none transition-shadow duration-150", !ro && "cursor-pointer", "focus-visible:shadow-[0_0_0_1px_var(--kit-line-strong)]", editing ? "shadow-[0_0_0_2px_var(--kit-accent)] focus-visible:shadow-[0_0_0_2px_var(--kit-accent)]" : !ro && "hover:shadow-[0_0_0_1px_var(--kit-line)]"),
|
|
1229
|
+
children: [/* @__PURE__ */ jsx(PullQuotePreview, { m }), actions]
|
|
1230
|
+
}), editing ? /* @__PURE__ */ jsx(ArticlePanel, {
|
|
1231
|
+
label,
|
|
1232
|
+
anchor: cardEl,
|
|
1233
|
+
nonce: open.nonce,
|
|
1234
|
+
focusKey: open.focusKey,
|
|
1235
|
+
onClose: close,
|
|
1236
|
+
focusBack: focusCard,
|
|
1237
|
+
ctx,
|
|
1238
|
+
el,
|
|
1239
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
1240
|
+
"data-article-form": "",
|
|
1241
|
+
className: "min-w-0",
|
|
1242
|
+
children: [/* @__PURE__ */ jsx(SchemaForm, {
|
|
1243
|
+
schema: PULL_QUOTE_SCHEMA,
|
|
1244
|
+
value: m,
|
|
1245
|
+
onChange: (v) => commit(v),
|
|
1246
|
+
variant: "panel",
|
|
1247
|
+
scroll: false,
|
|
1248
|
+
readOnly: ro,
|
|
1249
|
+
rootLabel: label,
|
|
1250
|
+
env: {
|
|
1251
|
+
docId: `article:${PULL_QUOTE_SCHEMA.name}`,
|
|
1252
|
+
docTitle: label
|
|
1253
|
+
}
|
|
1254
|
+
}), /* @__PURE__ */ jsx("style", { children: `[data-article-form] [data-kit-form] section:first-of-type { border-top-width: 0; margin-top: 0; padding-top: 0; }` })]
|
|
1255
|
+
})
|
|
1256
|
+
}) : null] });
|
|
1257
|
+
}
|
|
1258
|
+
var TAKEAWAYS_LABEL = "Key takeaways";
|
|
1259
|
+
/** V2 article.ts ARTICLE_SCHEMAS.takeaways `points` max (the stored block's limit, key_takeaways_limit_exceeded) */
|
|
1260
|
+
var MAX_POINTS = 8;
|
|
1261
|
+
/** V2 article.ts ARTICLE_SCHEMAS.takeaways `title` max */
|
|
1262
|
+
var MAX_TITLE = 40;
|
|
1263
|
+
function TakeawaysBlock({ m, set, el, ctx, autoFocus }) {
|
|
1264
|
+
const label = TAKEAWAYS_LABEL;
|
|
1265
|
+
const card = React.useRef(null);
|
|
1266
|
+
const box = React.useRef(null);
|
|
1267
|
+
const ro = !!ctx.readOnly;
|
|
1268
|
+
const focusCard = () => requestAnimationFrame(() => card.current?.focus({ preventScroll: true }));
|
|
1269
|
+
const focusPoint = (i, atEnd = true) => requestAnimationFrame(() => {
|
|
1270
|
+
const t = box.current?.querySelectorAll("[role=textbox]")[i];
|
|
1271
|
+
if (!t) return;
|
|
1272
|
+
t.focus();
|
|
1273
|
+
placeCaret(t, atEnd);
|
|
1274
|
+
});
|
|
1275
|
+
const setPoint = (i, v) => set({ points: m.points.map((p, j) => j === i ? v : p) }, `Edit key takeaways point ${i + 1}`);
|
|
1276
|
+
/** V2 ArticleBlock onKeyDown, on the block itself (its lines handle their own keys) */
|
|
1277
|
+
const onKeyDown = (e) => {
|
|
1278
|
+
if (e.defaultPrevented || e.target !== card.current) return;
|
|
1279
|
+
const mod = e.metaKey || e.ctrlKey;
|
|
1280
|
+
const k = eventKey(e);
|
|
1281
|
+
if (mod && k === "z") {
|
|
1282
|
+
e.preventDefault();
|
|
1283
|
+
e.stopPropagation();
|
|
1284
|
+
if (e.shiftKey) ctx.redo?.();
|
|
1285
|
+
else ctx.undo?.();
|
|
1286
|
+
return;
|
|
1287
|
+
}
|
|
1288
|
+
if (e.key === "Escape") {
|
|
1289
|
+
e.preventDefault();
|
|
1290
|
+
e.stopPropagation();
|
|
1291
|
+
ctx.exit(el);
|
|
1292
|
+
return;
|
|
1293
|
+
}
|
|
1294
|
+
if (ro) return;
|
|
1295
|
+
if (mod && k === "d" && ctx.duplicate) {
|
|
1296
|
+
e.preventDefault();
|
|
1297
|
+
e.stopPropagation();
|
|
1298
|
+
ctx.duplicate(el);
|
|
1299
|
+
} else if (e.altKey && (e.key === "ArrowUp" || e.key === "ArrowDown") && ctx.move) {
|
|
1300
|
+
e.preventDefault();
|
|
1301
|
+
ctx.move(el, e.key === "ArrowUp" ? -1 : 1);
|
|
1302
|
+
focusCard();
|
|
1303
|
+
} else if (e.key === "Backspace" || e.key === "Delete") {
|
|
1304
|
+
e.preventDefault();
|
|
1305
|
+
ctx.remove(el);
|
|
1306
|
+
}
|
|
1307
|
+
};
|
|
1308
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1309
|
+
ref: card,
|
|
1310
|
+
role: "group",
|
|
1311
|
+
tabIndex: 0,
|
|
1312
|
+
"aria-label": label,
|
|
1313
|
+
"aria-roledescription": "block",
|
|
1314
|
+
"data-rt-isolate": "",
|
|
1315
|
+
"data-article-block": "takeaways",
|
|
1316
|
+
onKeyDown,
|
|
1317
|
+
className: "group/art relative rounded-kit-lg outline-none transition-shadow duration-150 focus-visible:shadow-[0_0_0_1px_var(--kit-line-strong)]",
|
|
1318
|
+
children: [/* @__PURE__ */ jsxs("aside", {
|
|
1319
|
+
className: "rounded-kit-lg border border-kit-line bg-kit-subtle px-4 py-3",
|
|
1320
|
+
"aria-label": m.title || label,
|
|
1321
|
+
children: [/* @__PURE__ */ jsx(PlainEditable, {
|
|
1322
|
+
label: "Key takeaways title",
|
|
1323
|
+
value: m.title,
|
|
1324
|
+
placeholder: "Key takeaways",
|
|
1325
|
+
readOnly: ro,
|
|
1326
|
+
onChange: (title) => {
|
|
1327
|
+
if (title.length > MAX_TITLE && m.title.length <= MAX_TITLE) ctx.notify(`A key takeaways title holds at most ${MAX_TITLE} characters.`, "Shorten it, or the change will not save.");
|
|
1328
|
+
set({ title }, "Edit key takeaways title");
|
|
1329
|
+
},
|
|
1330
|
+
onEnter: () => focusPoint(0, false),
|
|
1331
|
+
className: "text-kit-sm font-semibold text-kit-fg"
|
|
1332
|
+
}), /* @__PURE__ */ jsx("ul", {
|
|
1333
|
+
ref: box,
|
|
1334
|
+
className: "m-0 mt-1.5 flex flex-col gap-1 p-0",
|
|
1335
|
+
children: m.points.map((p, i) => /* @__PURE__ */ jsxs("li", {
|
|
1336
|
+
className: "flex list-none items-baseline gap-2 text-[15px] leading-relaxed text-kit-fg",
|
|
1337
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
1338
|
+
"aria-hidden": true,
|
|
1339
|
+
className: "mt-[0.55em] size-1.5 shrink-0 self-start rounded-full bg-kit-accent"
|
|
1340
|
+
}), /* @__PURE__ */ jsx(PlainEditable, {
|
|
1341
|
+
label: `Point ${i + 1}`,
|
|
1342
|
+
value: p,
|
|
1343
|
+
placeholder: i === 0 ? "The first thing to remember" : "Another point",
|
|
1344
|
+
readOnly: ro,
|
|
1345
|
+
autoFocus: autoFocus && i === 0,
|
|
1346
|
+
onChange: (v) => setPoint(i, v),
|
|
1347
|
+
onEnter: () => {
|
|
1348
|
+
if (m.points.length >= MAX_POINTS) {
|
|
1349
|
+
ctx.notify(`Key takeaways hold at most ${MAX_POINTS} points.`, "Merge two points, or move this one into the text.");
|
|
1350
|
+
return;
|
|
1351
|
+
}
|
|
1352
|
+
set((x) => ({
|
|
1353
|
+
...x,
|
|
1354
|
+
points: [
|
|
1355
|
+
...x.points.slice(0, i + 1),
|
|
1356
|
+
"",
|
|
1357
|
+
...x.points.slice(i + 1)
|
|
1358
|
+
]
|
|
1359
|
+
}), "Add a key takeaways point");
|
|
1360
|
+
focusPoint(i + 1);
|
|
1361
|
+
},
|
|
1362
|
+
onBackspaceEmpty: m.points.length > 1 ? () => {
|
|
1363
|
+
set((x) => ({
|
|
1364
|
+
...x,
|
|
1365
|
+
points: x.points.filter((_, j) => j !== i)
|
|
1366
|
+
}), "Remove a key takeaways point");
|
|
1367
|
+
focusPoint(Math.max(0, i - 1));
|
|
1368
|
+
} : void 0,
|
|
1369
|
+
className: "flex-1"
|
|
1370
|
+
})]
|
|
1371
|
+
}, i))
|
|
1372
|
+
})]
|
|
1373
|
+
}), ro ? null : /* @__PURE__ */ jsx("div", {
|
|
1374
|
+
className: cn("absolute -top-3.5 right-2 z-[2] flex items-center gap-0.5 rounded-kit-md border border-kit-line bg-kit-surface-raised p-0.5 opacity-0 shadow-kit-sm transition-opacity", "group-hover/art:opacity-100 group-focus-within/art:opacity-100 pointer-coarse:opacity-100"),
|
|
1375
|
+
children: /* @__PURE__ */ jsx(IconButton, {
|
|
1376
|
+
size: "xs",
|
|
1377
|
+
label: `Remove ${label.toLowerCase()}`,
|
|
1378
|
+
onClick: () => ctx.remove(el),
|
|
1379
|
+
className: "hover:text-kit-danger-fg",
|
|
1380
|
+
children: /* @__PURE__ */ jsx(IconTrash, { stroke: 1.5 })
|
|
1381
|
+
})
|
|
1382
|
+
})]
|
|
1383
|
+
});
|
|
1384
|
+
}
|
|
1385
|
+
var EMBED_LABEL = "Embed";
|
|
1386
|
+
/** V2 article.ts ARTICLE_SCHEMAS.embed without `aspect` (the stored block keeps no shape): the popover is built from it. */
|
|
1387
|
+
var EMBED_SCHEMA = {
|
|
1388
|
+
name: "embed",
|
|
1389
|
+
title: EMBED_LABEL,
|
|
1390
|
+
kind: "object",
|
|
1391
|
+
icon: "code",
|
|
1392
|
+
fields: [{
|
|
1393
|
+
name: "url",
|
|
1394
|
+
title: "Link",
|
|
1395
|
+
type: "url",
|
|
1396
|
+
placeholder: "Paste a YouTube, X, CodePen, Figma or map link",
|
|
1397
|
+
validation: { required: true }
|
|
1398
|
+
}, {
|
|
1399
|
+
name: "title",
|
|
1400
|
+
title: "Title",
|
|
1401
|
+
type: "string",
|
|
1402
|
+
validation: {
|
|
1403
|
+
required: true,
|
|
1404
|
+
max: 120
|
|
1405
|
+
},
|
|
1406
|
+
description: "Not shown. Read by screen readers."
|
|
1407
|
+
}]
|
|
1408
|
+
};
|
|
1409
|
+
function EmbedBlock({ m, set, el, ctx, autoFocus }) {
|
|
1410
|
+
const label = EMBED_LABEL;
|
|
1411
|
+
const uid = React.useId();
|
|
1412
|
+
const card = React.useRef(null);
|
|
1413
|
+
const form = React.useRef(null);
|
|
1414
|
+
const open = useOpenArticle();
|
|
1415
|
+
const editing = open?.id === uid;
|
|
1416
|
+
const ro = !!ctx.readOnly;
|
|
1417
|
+
const modelRef = React.useRef(m);
|
|
1418
|
+
modelRef.current = m;
|
|
1419
|
+
const openPopover = React.useCallback((k) => {
|
|
1420
|
+
if (!ro) setOpenArticle({
|
|
1421
|
+
id: uid,
|
|
1422
|
+
focusKey: k ?? null,
|
|
1423
|
+
nonce: (openArticle?.nonce ?? 0) + 1
|
|
1424
|
+
});
|
|
1425
|
+
}, [uid, ro]);
|
|
1426
|
+
const close = React.useCallback(() => {
|
|
1427
|
+
if (openArticle?.id === uid) setOpenArticle(null);
|
|
1428
|
+
}, [uid]);
|
|
1429
|
+
const focusCard = React.useCallback(() => requestAnimationFrame(() => card.current?.focus({ preventScroll: true })), []);
|
|
1430
|
+
React.useEffect(() => () => {
|
|
1431
|
+
if (openArticle?.id === uid) setOpenArticle(null);
|
|
1432
|
+
}, [uid]);
|
|
1433
|
+
React.useEffect(() => {
|
|
1434
|
+
if (autoFocus && !ro) openPopover();
|
|
1435
|
+
}, []);
|
|
1436
|
+
const nonce = editing ? open.nonce : 0;
|
|
1437
|
+
React.useEffect(() => {
|
|
1438
|
+
if (!nonce) return;
|
|
1439
|
+
const id = requestAnimationFrame(() => focusField(form.current, openArticle?.focusKey ?? null));
|
|
1440
|
+
return () => cancelAnimationFrame(id);
|
|
1441
|
+
}, [nonce]);
|
|
1442
|
+
/** a form edit joins the body's one undo history (D54); typing coalesces per field */
|
|
1443
|
+
const commit = (next) => {
|
|
1444
|
+
const prev = modelRef.current;
|
|
1445
|
+
const field = ["url", "title"].find((k) => (next[k] ?? "") !== (prev[k] ?? "")) ?? "";
|
|
1446
|
+
set(() => next, `Edit ${label.toLowerCase()} ${field}`);
|
|
1447
|
+
};
|
|
1448
|
+
const onKeyDown = (e) => {
|
|
1449
|
+
if (e.defaultPrevented || e.target !== card.current) return;
|
|
1450
|
+
const mod = e.metaKey || e.ctrlKey;
|
|
1451
|
+
const k = eventKey(e);
|
|
1452
|
+
if (mod && k === "z") {
|
|
1453
|
+
e.preventDefault();
|
|
1454
|
+
e.stopPropagation();
|
|
1455
|
+
if (e.shiftKey) ctx.redo?.();
|
|
1456
|
+
else ctx.undo?.();
|
|
1457
|
+
return;
|
|
1458
|
+
}
|
|
1459
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
1460
|
+
e.preventDefault();
|
|
1461
|
+
openPopover();
|
|
1462
|
+
return;
|
|
1463
|
+
}
|
|
1464
|
+
if (e.key === "Escape") {
|
|
1465
|
+
e.preventDefault();
|
|
1466
|
+
e.stopPropagation();
|
|
1467
|
+
if (editing) close();
|
|
1468
|
+
else ctx.exit(el);
|
|
1469
|
+
return;
|
|
1470
|
+
}
|
|
1471
|
+
if (ro) return;
|
|
1472
|
+
if (mod && k === "d" && ctx.duplicate) {
|
|
1473
|
+
e.preventDefault();
|
|
1474
|
+
e.stopPropagation();
|
|
1475
|
+
ctx.duplicate(el);
|
|
1476
|
+
} else if (e.altKey && (e.key === "ArrowUp" || e.key === "ArrowDown") && ctx.move) {
|
|
1477
|
+
e.preventDefault();
|
|
1478
|
+
ctx.move(el, e.key === "ArrowUp" ? -1 : 1);
|
|
1479
|
+
focusCard();
|
|
1480
|
+
} else if (e.key === "Backspace" || e.key === "Delete") {
|
|
1481
|
+
e.preventDefault();
|
|
1482
|
+
ctx.remove(el);
|
|
1483
|
+
}
|
|
1484
|
+
};
|
|
1485
|
+
const actions = ro ? null : /* @__PURE__ */ jsxs("div", {
|
|
1486
|
+
className: cn("absolute -top-3.5 right-2 z-[2] flex items-center gap-0.5 rounded-kit-md border border-kit-line bg-kit-surface-raised p-0.5 opacity-0 shadow-kit-sm transition-opacity", "group-hover/art:opacity-100 group-focus-within/art:opacity-100 pointer-coarse:opacity-100", editing && "opacity-100"),
|
|
1487
|
+
children: [/* @__PURE__ */ jsx(Tooltip, {
|
|
1488
|
+
content: `Edit ${label.toLowerCase()}`,
|
|
1489
|
+
children: /* @__PURE__ */ jsx(IconButton, {
|
|
1490
|
+
size: "xs",
|
|
1491
|
+
label: `Edit ${label.toLowerCase()}`,
|
|
1492
|
+
onClick: () => editing ? close() : openPopover(),
|
|
1493
|
+
children: /* @__PURE__ */ jsx(IconSettings, { stroke: 1.5 })
|
|
1494
|
+
})
|
|
1495
|
+
}), /* @__PURE__ */ jsx(Tooltip, {
|
|
1496
|
+
content: `Remove ${label.toLowerCase()}`,
|
|
1497
|
+
children: /* @__PURE__ */ jsx(IconButton, {
|
|
1498
|
+
size: "xs",
|
|
1499
|
+
label: `Remove ${label.toLowerCase()}`,
|
|
1500
|
+
onClick: () => ctx.remove(el),
|
|
1501
|
+
className: "hover:text-kit-danger-fg",
|
|
1502
|
+
children: /* @__PURE__ */ jsx(IconTrash, { stroke: 1.5 })
|
|
1503
|
+
})
|
|
1504
|
+
})]
|
|
1505
|
+
});
|
|
1506
|
+
return /* @__PURE__ */ jsxs(Popover, {
|
|
1507
|
+
open: editing,
|
|
1508
|
+
onOpenChange: (o, d) => {
|
|
1509
|
+
if (o) return;
|
|
1510
|
+
close();
|
|
1511
|
+
if (d?.reason !== "outside-press") focusCard();
|
|
1512
|
+
},
|
|
1513
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
1514
|
+
ref: card,
|
|
1515
|
+
role: "group",
|
|
1516
|
+
tabIndex: 0,
|
|
1517
|
+
"aria-label": `${label}${editing ? ", editing" : ""}`,
|
|
1518
|
+
"aria-roledescription": "block",
|
|
1519
|
+
"aria-haspopup": "dialog",
|
|
1520
|
+
"aria-expanded": editing,
|
|
1521
|
+
"data-rt-isolate": "",
|
|
1522
|
+
"data-article-block": "embed",
|
|
1523
|
+
onKeyDown,
|
|
1524
|
+
onClick: (e) => {
|
|
1525
|
+
if (ro || !e.currentTarget.contains(e.target)) return;
|
|
1526
|
+
const t = e.target;
|
|
1527
|
+
if (t.closest("button,a,[role=menuitem]")) return;
|
|
1528
|
+
openPopover(t.closest("[data-field]")?.getAttribute("data-field") ?? null);
|
|
1529
|
+
},
|
|
1530
|
+
className: cn("group/art relative rounded-kit-lg outline-none transition-shadow duration-150", !ro && "cursor-pointer", "focus-visible:shadow-[0_0_0_1px_var(--kit-line-strong)]", editing ? "shadow-[0_0_0_2px_var(--kit-accent)] focus-visible:shadow-[0_0_0_2px_var(--kit-accent)]" : !ro && "hover:shadow-[0_0_0_1px_var(--kit-line)]"),
|
|
1531
|
+
children: [
|
|
1532
|
+
/* @__PURE__ */ jsx(EmbedPreview, {
|
|
1533
|
+
m,
|
|
1534
|
+
onAdd: () => openPopover("url"),
|
|
1535
|
+
ro
|
|
1536
|
+
}),
|
|
1537
|
+
actions,
|
|
1538
|
+
/* @__PURE__ */ jsx(PopoverAnchor, { render: /* @__PURE__ */ jsx("span", {
|
|
1539
|
+
"aria-hidden": true,
|
|
1540
|
+
className: "pointer-events-none absolute right-2 top-2 size-px"
|
|
1541
|
+
}) })
|
|
1542
|
+
]
|
|
1543
|
+
}), editing ? /* @__PURE__ */ jsxs(PopoverContent, {
|
|
1544
|
+
align: "end",
|
|
1545
|
+
side: "bottom",
|
|
1546
|
+
className: "w-[340px] p-0",
|
|
1547
|
+
initialFocus: false,
|
|
1548
|
+
finalFocus: false,
|
|
1549
|
+
onKeyDown: (e) => {
|
|
1550
|
+
if ((e.metaKey || e.ctrlKey) && !e.altKey && eventKey(e) === "z" && !e.defaultPrevented) {
|
|
1551
|
+
e.preventDefault();
|
|
1552
|
+
if (e.shiftKey) ctx.redo?.();
|
|
1553
|
+
else ctx.undo?.();
|
|
1554
|
+
}
|
|
1555
|
+
},
|
|
1556
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
1557
|
+
className: "flex h-10 items-center gap-2 border-b border-kit-line-subtle pl-4 pr-1.5",
|
|
1558
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
1559
|
+
className: "flex-1 truncate text-kit-sm font-medium text-kit-fg",
|
|
1560
|
+
children: label
|
|
1561
|
+
}), /* @__PURE__ */ jsx(IconButton, {
|
|
1562
|
+
size: "sm",
|
|
1563
|
+
label: "Close",
|
|
1564
|
+
onClick: () => (close(), focusCard()),
|
|
1565
|
+
children: /* @__PURE__ */ jsx(IconX, { stroke: 1.5 })
|
|
1566
|
+
})]
|
|
1567
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
1568
|
+
ref: form,
|
|
1569
|
+
className: "max-h-[min(480px,70vh)] overflow-y-auto pb-2",
|
|
1570
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
1571
|
+
"data-article-form": "",
|
|
1572
|
+
className: "min-w-0",
|
|
1573
|
+
children: [/* @__PURE__ */ jsx(SchemaForm, {
|
|
1574
|
+
schema: EMBED_SCHEMA,
|
|
1575
|
+
value: {
|
|
1576
|
+
url: m.url ?? "",
|
|
1577
|
+
title: m.title ?? ""
|
|
1578
|
+
},
|
|
1579
|
+
onChange: (v) => commit({
|
|
1580
|
+
...modelRef.current,
|
|
1581
|
+
url: String(v.url ?? ""),
|
|
1582
|
+
title: String(v.title ?? "")
|
|
1583
|
+
}),
|
|
1584
|
+
variant: "panel",
|
|
1585
|
+
scroll: false,
|
|
1586
|
+
readOnly: ro,
|
|
1587
|
+
rootLabel: label,
|
|
1588
|
+
env: {
|
|
1589
|
+
docId: `article:${EMBED_SCHEMA.name}`,
|
|
1590
|
+
docTitle: label
|
|
1591
|
+
}
|
|
1592
|
+
}), /* @__PURE__ */ jsx("style", { children: `[data-article-form] [data-kit-form] section:first-of-type { border-top-width: 0; margin-top: 0; padding-top: 0; }` })]
|
|
1593
|
+
})
|
|
1594
|
+
})]
|
|
1595
|
+
}) : null]
|
|
1596
|
+
});
|
|
1597
|
+
}
|
|
1598
|
+
/** V2 article-blocks.tsx Empty: a block with nothing to show yet. */
|
|
1599
|
+
var ArticleEmpty = ({ icon, title, action, onAction, ro }) => /* @__PURE__ */ jsxs("div", {
|
|
1600
|
+
className: "flex items-center gap-3 rounded-kit-lg border border-dashed border-kit-line-strong bg-kit-subtle px-4 py-3.5",
|
|
1601
|
+
children: [
|
|
1602
|
+
/* @__PURE__ */ jsx("span", {
|
|
1603
|
+
className: "flex size-8 shrink-0 items-center justify-center rounded-kit-md border border-kit-line bg-kit-control-bg text-kit-fg-2 [&_svg]:size-4",
|
|
1604
|
+
children: icon
|
|
1605
|
+
}),
|
|
1606
|
+
/* @__PURE__ */ jsx("span", {
|
|
1607
|
+
className: "min-w-0 flex-1 text-kit-sm font-medium text-kit-fg",
|
|
1608
|
+
children: title
|
|
1609
|
+
}),
|
|
1610
|
+
ro ? null : /* @__PURE__ */ jsx(Button, {
|
|
1611
|
+
size: "sm",
|
|
1612
|
+
onClick: onAction,
|
|
1613
|
+
children: action
|
|
1614
|
+
})
|
|
1615
|
+
]
|
|
1616
|
+
});
|
|
1617
|
+
var PROVIDER_ICON = {
|
|
1618
|
+
youtube: /* @__PURE__ */ jsx(IconBrandYoutube, { stroke: 1.5 }),
|
|
1619
|
+
vimeo: /* @__PURE__ */ jsx(IconBrandVimeo, { stroke: 1.5 }),
|
|
1620
|
+
x: /* @__PURE__ */ jsx(IconBrandX, { stroke: 1.5 }),
|
|
1621
|
+
codepen: /* @__PURE__ */ jsx(IconBrandCodepen, { stroke: 1.5 }),
|
|
1622
|
+
figma: /* @__PURE__ */ jsx(IconBrandFigma, { stroke: 1.5 }),
|
|
1623
|
+
maps: /* @__PURE__ */ jsx(IconMap, { stroke: 1.5 }),
|
|
1624
|
+
spotify: /* @__PURE__ */ jsx(IconBrandSpotify, { stroke: 1.5 }),
|
|
1625
|
+
podcast: /* @__PURE__ */ jsx(IconMicrophone, { stroke: 1.5 }),
|
|
1626
|
+
audio: /* @__PURE__ */ jsx(IconHeadphones, { stroke: 1.5 }),
|
|
1627
|
+
link: /* @__PURE__ */ jsx(IconWorld, { stroke: 1.5 })
|
|
1628
|
+
};
|
|
1629
|
+
/** V2 EmbedPreview: a faithful placeholder (provider, title and shape), no third-party frame in the editor. Drawn 16:9. */
|
|
1630
|
+
function EmbedPreview({ m, onAdd, ro }) {
|
|
1631
|
+
if (!m.url) return /* @__PURE__ */ jsx(ArticleEmpty, {
|
|
1632
|
+
icon: /* @__PURE__ */ jsx(IconLink, { stroke: 1.5 }),
|
|
1633
|
+
title: "Embed",
|
|
1634
|
+
action: "Paste a link",
|
|
1635
|
+
onAction: onAdd,
|
|
1636
|
+
ro
|
|
1637
|
+
});
|
|
1638
|
+
const info = detectEmbed(m.url);
|
|
1639
|
+
const icon = PROVIDER_ICON[info.provider];
|
|
1640
|
+
const title = m.title || /* @__PURE__ */ jsx("span", {
|
|
1641
|
+
className: "text-kit-warning-fg",
|
|
1642
|
+
children: "Add a title"
|
|
1643
|
+
});
|
|
1644
|
+
if (info.shape === "frame") return /* @__PURE__ */ jsx("figure", {
|
|
1645
|
+
className: "m-0",
|
|
1646
|
+
"data-field": "url",
|
|
1647
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
1648
|
+
className: "relative mx-auto flex w-full flex-col items-center justify-center gap-2 overflow-hidden rounded-kit-lg border border-kit-line bg-kit-subtle text-center",
|
|
1649
|
+
style: { aspectRatio: "16 / 9" },
|
|
1650
|
+
children: [
|
|
1651
|
+
/* @__PURE__ */ jsx("span", {
|
|
1652
|
+
className: "flex size-11 items-center justify-center rounded-full bg-kit-inverse text-kit-fg-inverse [&_svg]:size-5",
|
|
1653
|
+
children: info.provider === "youtube" || info.provider === "vimeo" ? /* @__PURE__ */ jsx(IconPlayerPlayFilled, {}) : icon
|
|
1654
|
+
}),
|
|
1655
|
+
/* @__PURE__ */ jsx("span", {
|
|
1656
|
+
"data-field": "title",
|
|
1657
|
+
className: "max-w-[80%] truncate text-kit-sm font-medium text-kit-fg",
|
|
1658
|
+
children: title
|
|
1659
|
+
}),
|
|
1660
|
+
/* @__PURE__ */ jsxs("span", {
|
|
1661
|
+
className: "absolute left-3 top-2.5 flex items-center gap-1.5 text-kit-xs text-kit-fg-2 [&_svg]:size-3.5",
|
|
1662
|
+
children: [icon, info.label]
|
|
1663
|
+
})
|
|
1664
|
+
]
|
|
1665
|
+
})
|
|
1666
|
+
});
|
|
1667
|
+
if (info.shape === "audio") return /* @__PURE__ */ jsxs("figure", {
|
|
1668
|
+
className: "m-0 flex items-center gap-3 rounded-kit-lg border border-kit-line bg-kit-subtle px-3 py-2.5",
|
|
1669
|
+
"data-field": "url",
|
|
1670
|
+
children: [
|
|
1671
|
+
/* @__PURE__ */ jsx("span", {
|
|
1672
|
+
className: "flex size-9 shrink-0 items-center justify-center rounded-full bg-kit-inverse text-kit-fg-inverse [&_svg]:size-4",
|
|
1673
|
+
children: /* @__PURE__ */ jsx(IconPlayerPlayFilled, {})
|
|
1674
|
+
}),
|
|
1675
|
+
/* @__PURE__ */ jsxs("span", {
|
|
1676
|
+
className: "min-w-0 flex-1",
|
|
1677
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
1678
|
+
"data-field": "title",
|
|
1679
|
+
className: "block truncate text-kit-sm font-medium text-kit-fg",
|
|
1680
|
+
children: title
|
|
1681
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
1682
|
+
className: "flex items-center gap-1 text-kit-xs text-kit-fg-3 [&_svg]:size-3",
|
|
1683
|
+
children: [icon, info.label]
|
|
1684
|
+
})]
|
|
1685
|
+
}),
|
|
1686
|
+
/* @__PURE__ */ jsx("span", {
|
|
1687
|
+
"aria-hidden": true,
|
|
1688
|
+
className: "hidden h-1 w-28 rounded-full bg-kit-line-strong sm:block"
|
|
1689
|
+
})
|
|
1690
|
+
]
|
|
1691
|
+
});
|
|
1692
|
+
return /* @__PURE__ */ jsxs("figure", {
|
|
1693
|
+
className: "m-0 flex items-center gap-3 rounded-kit-lg border border-kit-line bg-kit-surface px-3 py-2.5",
|
|
1694
|
+
"data-field": "url",
|
|
1695
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
1696
|
+
className: "flex size-9 shrink-0 items-center justify-center rounded-kit-md bg-kit-muted text-kit-fg-2 [&_svg]:size-4",
|
|
1697
|
+
children: icon
|
|
1698
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
1699
|
+
className: "min-w-0 flex-1",
|
|
1700
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
1701
|
+
"data-field": "title",
|
|
1702
|
+
className: "block truncate text-kit-sm font-medium text-kit-fg",
|
|
1703
|
+
children: title
|
|
1704
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
1705
|
+
className: "block truncate text-kit-xs text-kit-fg-3",
|
|
1706
|
+
children: info.shape === "post" ? `${info.label} · ${m.url.replace(/^https?:\/\/(www\.)?/, "")}` : m.url.replace(/^https?:\/\/(www\.)?/, "")
|
|
1707
|
+
})]
|
|
1708
|
+
})]
|
|
1709
|
+
});
|
|
1710
|
+
}
|
|
1711
|
+
function ArticlePanel({ label, anchor, nonce, focusKey, onClose, focusBack, ctx, el, children }) {
|
|
1712
|
+
const panel = React.useRef(null);
|
|
1713
|
+
const titleId = React.useId();
|
|
1714
|
+
const container = anchor?.closest("[data-expanded-editor]") ?? null;
|
|
1715
|
+
React.useEffect(() => {
|
|
1716
|
+
const timers = [];
|
|
1717
|
+
let landed = false;
|
|
1718
|
+
for (const ms of [
|
|
1719
|
+
40,
|
|
1720
|
+
90,
|
|
1721
|
+
160,
|
|
1722
|
+
260,
|
|
1723
|
+
420,
|
|
1724
|
+
640
|
|
1725
|
+
]) timers.push(window.setTimeout(() => {
|
|
1726
|
+
const root = panel.current?.el() ?? null;
|
|
1727
|
+
if (!root?.querySelector("[data-field-key]")) return;
|
|
1728
|
+
const a = document.activeElement;
|
|
1729
|
+
const lost = !a || a === document.body || a.hasAttribute("data-expanded-editor") || a.hasAttribute("data-article-block");
|
|
1730
|
+
if (root.contains(a)) return void (landed = true);
|
|
1731
|
+
if (!landed || lost) focusField(root, focusKey);
|
|
1732
|
+
if (root.contains(document.activeElement)) landed = true;
|
|
1733
|
+
}, ms));
|
|
1734
|
+
return () => timers.forEach((t) => window.clearTimeout(t));
|
|
1735
|
+
}, [nonce]);
|
|
1736
|
+
React.useEffect(() => panel.current?.announce(`${label} properties.`), [label]);
|
|
1737
|
+
const header = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1738
|
+
/* @__PURE__ */ jsx("span", {
|
|
1739
|
+
id: titleId,
|
|
1740
|
+
className: "min-w-0 flex-1 truncate text-kit-sm font-medium text-kit-fg",
|
|
1741
|
+
children: label
|
|
1742
|
+
}),
|
|
1743
|
+
/* @__PURE__ */ jsxs(Menu, { children: [/* @__PURE__ */ jsx(MenuTrigger, { render: /* @__PURE__ */ jsx(IconButton, {
|
|
1744
|
+
size: "sm",
|
|
1745
|
+
label: `${label} actions`,
|
|
1746
|
+
children: /* @__PURE__ */ jsx(IconDots, { stroke: 1.5 })
|
|
1747
|
+
}) }), /* @__PURE__ */ jsxs(MenuContent, {
|
|
1748
|
+
align: "end",
|
|
1749
|
+
className: "w-52",
|
|
1750
|
+
children: [
|
|
1751
|
+
ctx.readOnly || !ctx.duplicate ? null : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(MenuItem, {
|
|
1752
|
+
icon: /* @__PURE__ */ jsx(IconCopy, { stroke: 1.5 }),
|
|
1753
|
+
onClick: () => ctx.duplicate?.(el),
|
|
1754
|
+
children: "Duplicate"
|
|
1755
|
+
}), /* @__PURE__ */ jsx(MenuSeparator, {})] }),
|
|
1756
|
+
/* @__PURE__ */ jsx(MenuItem, {
|
|
1757
|
+
icon: /* @__PURE__ */ jsx(IconArrowsMove, { stroke: 1.5 }),
|
|
1758
|
+
onClick: () => panel.current?.keyboard("move"),
|
|
1759
|
+
children: "Move panel"
|
|
1760
|
+
}),
|
|
1761
|
+
/* @__PURE__ */ jsx(MenuItem, {
|
|
1762
|
+
icon: /* @__PURE__ */ jsx(IconDimensions, { stroke: 1.5 }),
|
|
1763
|
+
onClick: () => panel.current?.keyboard("resize"),
|
|
1764
|
+
children: "Resize panel"
|
|
1765
|
+
}),
|
|
1766
|
+
/* @__PURE__ */ jsx(MenuItem, {
|
|
1767
|
+
icon: /* @__PURE__ */ jsx(IconLayoutSidebar, { stroke: 1.5 }),
|
|
1768
|
+
onClick: () => panel.current?.dock("left"),
|
|
1769
|
+
children: "Dock left"
|
|
1770
|
+
}),
|
|
1771
|
+
/* @__PURE__ */ jsx(MenuItem, {
|
|
1772
|
+
icon: /* @__PURE__ */ jsx(IconLayoutSidebarRight, { stroke: 1.5 }),
|
|
1773
|
+
onClick: () => panel.current?.dock("right"),
|
|
1774
|
+
children: "Dock right"
|
|
1775
|
+
}),
|
|
1776
|
+
ctx.readOnly ? null : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(MenuSeparator, {}), /* @__PURE__ */ jsx(MenuItem, {
|
|
1777
|
+
danger: true,
|
|
1778
|
+
icon: /* @__PURE__ */ jsx(IconTrash, { stroke: 1.5 }),
|
|
1779
|
+
onClick: () => ctx.remove(el),
|
|
1780
|
+
children: "Remove"
|
|
1781
|
+
})] })
|
|
1782
|
+
]
|
|
1783
|
+
})] }),
|
|
1784
|
+
/* @__PURE__ */ jsx(IconButton, {
|
|
1785
|
+
size: "sm",
|
|
1786
|
+
label: "Close properties",
|
|
1787
|
+
tooltip: "Close",
|
|
1788
|
+
onClick: () => (onClose(), focusBack()),
|
|
1789
|
+
children: /* @__PURE__ */ jsx(IconX, { stroke: 1.5 })
|
|
1790
|
+
})
|
|
1791
|
+
] });
|
|
1792
|
+
return /* @__PURE__ */ jsx(FloatingPanel, {
|
|
1793
|
+
ref: panel,
|
|
1794
|
+
id: "article-properties",
|
|
1795
|
+
labelledBy: titleId,
|
|
1796
|
+
anchor,
|
|
1797
|
+
container,
|
|
1798
|
+
header,
|
|
1799
|
+
onClose,
|
|
1800
|
+
focusBack,
|
|
1801
|
+
onPanelKeyDown: (e) => {
|
|
1802
|
+
if ((e.metaKey || e.ctrlKey) && !e.altKey && eventKey(e) === "z" && !e.defaultPrevented) {
|
|
1803
|
+
e.preventDefault();
|
|
1804
|
+
if (e.shiftKey) ctx.redo?.();
|
|
1805
|
+
else ctx.undo?.();
|
|
1806
|
+
}
|
|
1807
|
+
},
|
|
1808
|
+
sheetFooter: /* @__PURE__ */ jsx(Button, {
|
|
1809
|
+
size: "sm",
|
|
1810
|
+
variant: "primary",
|
|
1811
|
+
onClick: () => (onClose(), focusBack()),
|
|
1812
|
+
children: "Done"
|
|
1813
|
+
}),
|
|
1814
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
1815
|
+
className: "pb-3 pt-1",
|
|
1816
|
+
children
|
|
1817
|
+
})
|
|
1818
|
+
});
|
|
1819
|
+
}
|
|
1820
|
+
function PullQuotePreview({ m }) {
|
|
1821
|
+
return /* @__PURE__ */ jsxs("figure", {
|
|
1822
|
+
className: "m-0 py-2 pl-5 pr-10",
|
|
1823
|
+
children: [
|
|
1824
|
+
/* @__PURE__ */ jsx(IconQuote, {
|
|
1825
|
+
className: "mb-1 size-6 text-kit-accent-fg",
|
|
1826
|
+
stroke: 1.5,
|
|
1827
|
+
"aria-hidden": true
|
|
1828
|
+
}),
|
|
1829
|
+
/* @__PURE__ */ jsx("blockquote", {
|
|
1830
|
+
"data-field": "quote",
|
|
1831
|
+
className: cn("m-0 text-[22px] font-medium leading-snug tracking-[-0.01em]", m.quote ? "text-kit-fg" : "text-kit-fg-4"),
|
|
1832
|
+
children: m.quote || "Write the quote"
|
|
1833
|
+
}),
|
|
1834
|
+
m.name || m.role ? /* @__PURE__ */ jsxs("figcaption", {
|
|
1835
|
+
className: "mt-3 text-kit-sm text-kit-fg-2",
|
|
1836
|
+
children: [
|
|
1837
|
+
m.name ? /* @__PURE__ */ jsx("span", {
|
|
1838
|
+
"data-field": "name",
|
|
1839
|
+
className: cn("font-medium text-kit-fg", m.link && "underline decoration-kit-line-strong underline-offset-2"),
|
|
1840
|
+
children: m.name
|
|
1841
|
+
}) : null,
|
|
1842
|
+
m.name && m.role ? ", " : null,
|
|
1843
|
+
m.role ? /* @__PURE__ */ jsx("span", {
|
|
1844
|
+
"data-field": "role",
|
|
1845
|
+
children: m.role
|
|
1846
|
+
}) : null
|
|
1847
|
+
]
|
|
1848
|
+
}) : /* @__PURE__ */ jsx("figcaption", {
|
|
1849
|
+
"data-field": "name",
|
|
1850
|
+
className: "mt-3 text-kit-sm text-kit-fg-4",
|
|
1851
|
+
children: "Who said it"
|
|
1852
|
+
})
|
|
1853
|
+
]
|
|
1854
|
+
});
|
|
1855
|
+
}
|
|
1856
|
+
//#endregion
|
|
1857
|
+
export { Island };
|
|
1858
|
+
|
|
1859
|
+
//# sourceMappingURL=blocks.js.map
|