@next-buildr/editor 0.0.0-stage → 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/LICENSE +21 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/app/builder-editor.d.ts +8 -0
- package/dist/app/builder-editor.d.ts.map +1 -0
- package/dist/app/builder-editor.js +14 -0
- package/dist/app/builder-editor.test.d.ts +2 -0
- package/dist/app/builder-editor.test.d.ts.map +1 -0
- package/dist/app/builder-editor.test.js +199 -0
- package/dist/app/config.d.ts +59 -0
- package/dist/app/config.d.ts.map +1 -0
- package/dist/app/config.js +18 -0
- package/dist/app/content-language.test.d.ts +2 -0
- package/dist/app/content-language.test.d.ts.map +1 -0
- package/dist/app/content-language.test.js +157 -0
- package/dist/app/editor-app.d.ts +17 -0
- package/dist/app/editor-app.d.ts.map +1 -0
- package/dist/app/editor-app.js +206 -0
- package/dist/app/editor-app.test.d.ts +2 -0
- package/dist/app/editor-app.test.d.ts.map +1 -0
- package/dist/app/editor-app.test.js +135 -0
- package/dist/app/layout.d.ts +32 -0
- package/dist/app/layout.d.ts.map +1 -0
- package/dist/app/layout.js +82 -0
- package/dist/app/manifest.d.ts +12 -0
- package/dist/app/manifest.d.ts.map +1 -0
- package/dist/app/manifest.js +17 -0
- package/dist/app/shell-panels.d.ts +15 -0
- package/dist/app/shell-panels.d.ts.map +1 -0
- package/dist/app/shell-panels.js +5 -0
- package/dist/app/small-screen.d.ts +12 -0
- package/dist/app/small-screen.d.ts.map +1 -0
- package/dist/app/small-screen.js +33 -0
- package/dist/app/small-screen.test.d.ts +2 -0
- package/dist/app/small-screen.test.d.ts.map +1 -0
- package/dist/app/small-screen.test.js +108 -0
- package/dist/app/status-info.d.ts +14 -0
- package/dist/app/status-info.d.ts.map +1 -0
- package/dist/app/status-info.js +34 -0
- package/dist/app/use-resizable.d.ts +34 -0
- package/dist/app/use-resizable.d.ts.map +1 -0
- package/dist/app/use-resizable.js +84 -0
- package/dist/canvas-host/canvas-frame.d.ts +53 -0
- package/dist/canvas-host/canvas-frame.d.ts.map +1 -0
- package/dist/canvas-host/canvas-frame.js +146 -0
- package/dist/canvas-host/canvas-frame.test.d.ts +2 -0
- package/dist/canvas-host/canvas-frame.test.d.ts.map +1 -0
- package/dist/canvas-host/canvas-frame.test.js +91 -0
- package/dist/canvas-host/host.d.ts +109 -0
- package/dist/canvas-host/host.d.ts.map +1 -0
- package/dist/canvas-host/host.js +293 -0
- package/dist/canvas-host/host.test.d.ts +2 -0
- package/dist/canvas-host/host.test.d.ts.map +1 -0
- package/dist/canvas-host/host.test.js +398 -0
- package/dist/canvas-host/index.d.ts +5 -0
- package/dist/canvas-host/index.d.ts.map +1 -0
- package/dist/canvas-host/index.js +2 -0
- package/dist/clipboard/clipboard.d.ts +38 -0
- package/dist/clipboard/clipboard.d.ts.map +1 -0
- package/dist/clipboard/clipboard.js +160 -0
- package/dist/clipboard/clipboard.test.d.ts +2 -0
- package/dist/clipboard/clipboard.test.d.ts.map +1 -0
- package/dist/clipboard/clipboard.test.js +457 -0
- package/dist/clipboard/format.d.ts +27 -0
- package/dist/clipboard/format.d.ts.map +1 -0
- package/dist/clipboard/format.js +37 -0
- package/dist/clipboard/index.d.ts +6 -0
- package/dist/clipboard/index.d.ts.map +1 -0
- package/dist/clipboard/index.js +3 -0
- package/dist/clipboard/react.d.ts +20 -0
- package/dist/clipboard/react.d.ts.map +1 -0
- package/dist/clipboard/react.js +71 -0
- package/dist/dialogs/index.d.ts +2 -0
- package/dist/dialogs/index.d.ts.map +1 -0
- package/dist/dialogs/index.js +1 -0
- package/dist/dialogs/media-picker/index.d.ts +7 -0
- package/dist/dialogs/media-picker/index.d.ts.map +1 -0
- package/dist/dialogs/media-picker/index.js +3 -0
- package/dist/dialogs/media-picker/library.d.ts +17 -0
- package/dist/dialogs/media-picker/library.d.ts.map +1 -0
- package/dist/dialogs/media-picker/library.js +9 -0
- package/dist/dialogs/media-picker/media-picker.d.ts +18 -0
- package/dist/dialogs/media-picker/media-picker.d.ts.map +1 -0
- package/dist/dialogs/media-picker/media-picker.js +99 -0
- package/dist/dialogs/media-picker/media-picker.test.d.ts +2 -0
- package/dist/dialogs/media-picker/media-picker.test.d.ts.map +1 -0
- package/dist/dialogs/media-picker/media-picker.test.js +161 -0
- package/dist/dialogs/media-picker/media-ref.d.ts +28 -0
- package/dist/dialogs/media-picker/media-ref.d.ts.map +1 -0
- package/dist/dialogs/media-picker/media-ref.js +52 -0
- package/dist/dnd/check.d.ts +8 -0
- package/dist/dnd/check.d.ts.map +1 -0
- package/dist/dnd/check.js +12 -0
- package/dist/dnd/destinations.d.ts +15 -0
- package/dist/dnd/destinations.d.ts.map +1 -0
- package/dist/dnd/destinations.js +43 -0
- package/dist/dnd/dnd-react.test.d.ts +2 -0
- package/dist/dnd/dnd-react.test.d.ts.map +1 -0
- package/dist/dnd/dnd-react.test.js +93 -0
- package/dist/dnd/dnd.test.d.ts +2 -0
- package/dist/dnd/dnd.test.d.ts.map +1 -0
- package/dist/dnd/dnd.test.js +327 -0
- package/dist/dnd/engine.d.ts +85 -0
- package/dist/dnd/engine.d.ts.map +1 -0
- package/dist/dnd/engine.js +185 -0
- package/dist/dnd/fragment.d.ts +6 -0
- package/dist/dnd/fragment.d.ts.map +1 -0
- package/dist/dnd/fragment.js +18 -0
- package/dist/dnd/geometry.d.ts +30 -0
- package/dist/dnd/geometry.d.ts.map +1 -0
- package/dist/dnd/geometry.js +31 -0
- package/dist/dnd/index.d.ts +14 -0
- package/dist/dnd/index.d.ts.map +1 -0
- package/dist/dnd/index.js +7 -0
- package/dist/dnd/move-to-dialog.d.ts +13 -0
- package/dist/dnd/move-to-dialog.d.ts.map +1 -0
- package/dist/dnd/move-to-dialog.js +30 -0
- package/dist/dnd/react.d.ts +43 -0
- package/dist/dnd/react.d.ts.map +1 -0
- package/dist/dnd/react.js +185 -0
- package/dist/dnd/tree-target.d.ts +29 -0
- package/dist/dnd/tree-target.d.ts.map +1 -0
- package/dist/dnd/tree-target.js +97 -0
- package/dist/fonts/LICENSE-inter.txt +93 -0
- package/dist/fonts/inter-latin-400-normal.woff2 +0 -0
- package/dist/fonts/inter-latin-500-normal.woff2 +0 -0
- package/dist/fonts/inter-latin-600-normal.woff2 +0 -0
- package/dist/fonts/inter-latin-ext-400-normal.woff2 +0 -0
- package/dist/fonts/inter-latin-ext-500-normal.woff2 +0 -0
- package/dist/fonts/inter-latin-ext-600-normal.woff2 +0 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -0
- package/dist/messages/en.d.ts +335 -0
- package/dist/messages/en.d.ts.map +1 -0
- package/dist/messages/en.js +332 -0
- package/dist/messages/index.d.ts +16 -0
- package/dist/messages/index.d.ts.map +1 -0
- package/dist/messages/index.js +22 -0
- package/dist/messages/pl.d.ts +3 -0
- package/dist/messages/pl.d.ts.map +1 -0
- package/dist/messages/pl.js +327 -0
- package/dist/panels/breadcrumbs/breadcrumbs.d.ts +6 -0
- package/dist/panels/breadcrumbs/breadcrumbs.d.ts.map +1 -0
- package/dist/panels/breadcrumbs/breadcrumbs.js +24 -0
- package/dist/panels/breadcrumbs/breadcrumbs.test.d.ts +2 -0
- package/dist/panels/breadcrumbs/breadcrumbs.test.d.ts.map +1 -0
- package/dist/panels/breadcrumbs/breadcrumbs.test.js +56 -0
- package/dist/panels/index.d.ts +9 -0
- package/dist/panels/index.d.ts.map +1 -0
- package/dist/panels/index.js +6 -0
- package/dist/panels/insert/catalog.d.ts +30 -0
- package/dist/panels/insert/catalog.d.ts.map +1 -0
- package/dist/panels/insert/catalog.js +76 -0
- package/dist/panels/insert/catalog.order.test.d.ts +2 -0
- package/dist/panels/insert/catalog.order.test.d.ts.map +1 -0
- package/dist/panels/insert/catalog.order.test.js +17 -0
- package/dist/panels/insert/category-name.d.ts +4 -0
- package/dist/panels/insert/category-name.d.ts.map +1 -0
- package/dist/panels/insert/category-name.js +8 -0
- package/dist/panels/insert/index.d.ts +3 -0
- package/dist/panels/insert/index.d.ts.map +1 -0
- package/dist/panels/insert/index.js +2 -0
- package/dist/panels/insert/insert-panel.d.ts +7 -0
- package/dist/panels/insert/insert-panel.d.ts.map +1 -0
- package/dist/panels/insert/insert-panel.js +155 -0
- package/dist/panels/insert/insert-panel.test.d.ts +2 -0
- package/dist/panels/insert/insert-panel.test.d.ts.map +1 -0
- package/dist/panels/insert/insert-panel.test.js +323 -0
- package/dist/panels/insert/target.d.ts +17 -0
- package/dist/panels/insert/target.d.ts.map +1 -0
- package/dist/panels/insert/target.js +48 -0
- package/dist/panels/inspector/controls/boolean.d.ts +4 -0
- package/dist/panels/inspector/controls/boolean.d.ts.map +1 -0
- package/dist/panels/inspector/controls/boolean.js +4 -0
- package/dist/panels/inspector/controls/compound.d.ts +15 -0
- package/dist/panels/inspector/controls/compound.d.ts.map +1 -0
- package/dist/panels/inspector/controls/compound.js +99 -0
- package/dist/panels/inspector/controls/compound.test.d.ts +2 -0
- package/dist/panels/inspector/controls/compound.test.d.ts.map +1 -0
- package/dist/panels/inspector/controls/compound.test.js +195 -0
- package/dist/panels/inspector/controls/icon.d.ts +5 -0
- package/dist/panels/inspector/controls/icon.d.ts.map +1 -0
- package/dist/panels/inspector/controls/icon.js +6 -0
- package/dist/panels/inspector/controls/index.d.ts +13 -0
- package/dist/panels/inspector/controls/index.d.ts.map +1 -0
- package/dist/panels/inspector/controls/index.js +11 -0
- package/dist/panels/inspector/controls/label.d.ts +4 -0
- package/dist/panels/inspector/controls/label.d.ts.map +1 -0
- package/dist/panels/inspector/controls/label.js +8 -0
- package/dist/panels/inspector/controls/link.d.ts +5 -0
- package/dist/panels/inspector/controls/link.d.ts.map +1 -0
- package/dist/panels/inspector/controls/link.js +6 -0
- package/dist/panels/inspector/controls/media.d.ts +9 -0
- package/dist/panels/inspector/controls/media.d.ts.map +1 -0
- package/dist/panels/inspector/controls/media.js +21 -0
- package/dist/panels/inspector/controls/number.d.ts +10 -0
- package/dist/panels/inspector/controls/number.d.ts.map +1 -0
- package/dist/panels/inspector/controls/number.js +33 -0
- package/dist/panels/inspector/controls/rich-text-model.d.ts +20 -0
- package/dist/panels/inspector/controls/rich-text-model.d.ts.map +1 -0
- package/dist/panels/inspector/controls/rich-text-model.js +91 -0
- package/dist/panels/inspector/controls/rich-text.d.ts +10 -0
- package/dist/panels/inspector/controls/rich-text.d.ts.map +1 -0
- package/dist/panels/inspector/controls/rich-text.js +159 -0
- package/dist/panels/inspector/controls/select.d.ts +5 -0
- package/dist/panels/inspector/controls/select.d.ts.map +1 -0
- package/dist/panels/inspector/controls/select.js +16 -0
- package/dist/panels/inspector/controls/select.test.d.ts +2 -0
- package/dist/panels/inspector/controls/select.test.d.ts.map +1 -0
- package/dist/panels/inspector/controls/select.test.js +43 -0
- package/dist/panels/inspector/controls/text.d.ts +4 -0
- package/dist/panels/inspector/controls/text.d.ts.map +1 -0
- package/dist/panels/inspector/controls/text.js +5 -0
- package/dist/panels/inspector/controls/textarea.d.ts +4 -0
- package/dist/panels/inspector/controls/textarea.d.ts.map +1 -0
- package/dist/panels/inspector/controls/textarea.js +4 -0
- package/dist/panels/inspector/controls/types.d.ts +16 -0
- package/dist/panels/inspector/controls/types.d.ts.map +1 -0
- package/dist/panels/inspector/controls/types.js +1 -0
- package/dist/panels/inspector/index.d.ts +17 -0
- package/dist/panels/inspector/index.d.ts.map +1 -0
- package/dist/panels/inspector/index.js +9 -0
- package/dist/panels/inspector/inspector.d.ts +16 -0
- package/dist/panels/inspector/inspector.d.ts.map +1 -0
- package/dist/panels/inspector/inspector.js +116 -0
- package/dist/panels/inspector/inspector.test.d.ts +2 -0
- package/dist/panels/inspector/inspector.test.d.ts.map +1 -0
- package/dist/panels/inspector/inspector.test.js +328 -0
- package/dist/panels/inspector/props-panel.d.ts +26 -0
- package/dist/panels/inspector/props-panel.d.ts.map +1 -0
- package/dist/panels/inspector/props-panel.js +117 -0
- package/dist/panels/inspector/styles/box-model.d.ts +20 -0
- package/dist/panels/inspector/styles/box-model.d.ts.map +1 -0
- package/dist/panels/inspector/styles/box-model.js +31 -0
- package/dist/panels/inspector/styles/index.d.ts +5 -0
- package/dist/panels/inspector/styles/index.d.ts.map +1 -0
- package/dist/panels/inspector/styles/index.js +2 -0
- package/dist/panels/inspector/styles/model.d.ts +55 -0
- package/dist/panels/inspector/styles/model.d.ts.map +1 -0
- package/dist/panels/inspector/styles/model.js +111 -0
- package/dist/panels/inspector/styles/segments.d.ts +18 -0
- package/dist/panels/inspector/styles/segments.d.ts.map +1 -0
- package/dist/panels/inspector/styles/segments.js +75 -0
- package/dist/panels/inspector/styles/sides-editor.d.ts +34 -0
- package/dist/panels/inspector/styles/sides-editor.d.ts.map +1 -0
- package/dist/panels/inspector/styles/sides-editor.js +86 -0
- package/dist/panels/inspector/styles/style-inspector.d.ts +15 -0
- package/dist/panels/inspector/styles/style-inspector.d.ts.map +1 -0
- package/dist/panels/inspector/styles/style-inspector.js +219 -0
- package/dist/panels/inspector/styles/style-inspector.test.d.ts +2 -0
- package/dist/panels/inspector/styles/style-inspector.test.d.ts.map +1 -0
- package/dist/panels/inspector/styles/style-inspector.test.js +265 -0
- package/dist/panels/inspector/styles/token-picker.d.ts +15 -0
- package/dist/panels/inspector/styles/token-picker.d.ts.map +1 -0
- package/dist/panels/inspector/styles/token-picker.js +23 -0
- package/dist/panels/inspector/styles/use-style-value.d.ts +28 -0
- package/dist/panels/inspector/styles/use-style-value.d.ts.map +1 -0
- package/dist/panels/inspector/styles/use-style-value.js +51 -0
- package/dist/panels/inspector/value.d.ts +20 -0
- package/dist/panels/inspector/value.d.ts.map +1 -0
- package/dist/panels/inspector/value.js +32 -0
- package/dist/panels/inspector/values/analyze.d.ts +49 -0
- package/dist/panels/inspector/values/analyze.d.ts.map +1 -0
- package/dist/panels/inspector/values/analyze.js +115 -0
- package/dist/panels/inspector/values/data.d.ts +18 -0
- package/dist/panels/inspector/values/data.d.ts.map +1 -0
- package/dist/panels/inspector/values/data.js +10 -0
- package/dist/panels/inspector/values/translation.d.ts +20 -0
- package/dist/panels/inspector/values/translation.d.ts.map +1 -0
- package/dist/panels/inspector/values/translation.js +25 -0
- package/dist/panels/inspector/values/value-editor.d.ts +30 -0
- package/dist/panels/inspector/values/value-editor.d.ts.map +1 -0
- package/dist/panels/inspector/values/value-editor.js +191 -0
- package/dist/panels/inspector/values/values.test.d.ts +2 -0
- package/dist/panels/inspector/values/values.test.d.ts.map +1 -0
- package/dist/panels/inspector/values/values.test.js +173 -0
- package/dist/panels/issues/collect.d.ts +70 -0
- package/dist/panels/issues/collect.d.ts.map +1 -0
- package/dist/panels/issues/collect.js +96 -0
- package/dist/panels/issues/index.d.ts +5 -0
- package/dist/panels/issues/index.d.ts.map +1 -0
- package/dist/panels/issues/index.js +2 -0
- package/dist/panels/issues/issues-panel.d.ts +17 -0
- package/dist/panels/issues/issues-panel.d.ts.map +1 -0
- package/dist/panels/issues/issues-panel.js +77 -0
- package/dist/panels/layers/flatten.d.ts +28 -0
- package/dist/panels/layers/flatten.d.ts.map +1 -0
- package/dist/panels/layers/flatten.js +61 -0
- package/dist/panels/layers/layers-panel.d.ts +14 -0
- package/dist/panels/layers/layers-panel.d.ts.map +1 -0
- package/dist/panels/layers/layers-panel.js +428 -0
- package/dist/panels/layers/layers-panel.test.d.ts +2 -0
- package/dist/panels/layers/layers-panel.test.d.ts.map +1 -0
- package/dist/panels/layers/layers-panel.test.js +315 -0
- package/dist/persistence/controller.d.ts +55 -0
- package/dist/persistence/controller.d.ts.map +1 -0
- package/dist/persistence/controller.js +341 -0
- package/dist/persistence/index.d.ts +6 -0
- package/dist/persistence/index.d.ts.map +1 -0
- package/dist/persistence/index.js +3 -0
- package/dist/persistence/load.d.ts +35 -0
- package/dist/persistence/load.d.ts.map +1 -0
- package/dist/persistence/load.js +67 -0
- package/dist/persistence/persistence.test.d.ts +2 -0
- package/dist/persistence/persistence.test.d.ts.map +1 -0
- package/dist/persistence/persistence.test.js +483 -0
- package/dist/persistence/react.d.ts +18 -0
- package/dist/persistence/react.d.ts.map +1 -0
- package/dist/persistence/react.js +105 -0
- package/dist/persistence/types.d.ts +182 -0
- package/dist/persistence/types.d.ts.map +1 -0
- package/dist/persistence/types.js +1 -0
- package/dist/preview/index.d.ts +3 -0
- package/dist/preview/index.d.ts.map +1 -0
- package/dist/preview/index.js +2 -0
- package/dist/preview/prepare.d.ts +16 -0
- package/dist/preview/prepare.d.ts.map +1 -0
- package/dist/preview/prepare.js +21 -0
- package/dist/preview/preview.d.ts +27 -0
- package/dist/preview/preview.d.ts.map +1 -0
- package/dist/preview/preview.js +51 -0
- package/dist/preview/preview.test.d.ts +2 -0
- package/dist/preview/preview.test.d.ts.map +1 -0
- package/dist/preview/preview.test.js +129 -0
- package/dist/shortcuts/actions.d.ts +17 -0
- package/dist/shortcuts/actions.d.ts.map +1 -0
- package/dist/shortcuts/actions.js +85 -0
- package/dist/shortcuts/index.d.ts +11 -0
- package/dist/shortcuts/index.d.ts.map +1 -0
- package/dist/shortcuts/index.js +5 -0
- package/dist/shortcuts/keys.d.ts +29 -0
- package/dist/shortcuts/keys.d.ts.map +1 -0
- package/dist/shortcuts/keys.js +100 -0
- package/dist/shortcuts/map.d.ts +17 -0
- package/dist/shortcuts/map.d.ts.map +1 -0
- package/dist/shortcuts/map.js +31 -0
- package/dist/shortcuts/registry.d.ts +32 -0
- package/dist/shortcuts/registry.d.ts.map +1 -0
- package/dist/shortcuts/registry.js +53 -0
- package/dist/shortcuts/shortcuts.d.ts +32 -0
- package/dist/shortcuts/shortcuts.d.ts.map +1 -0
- package/dist/shortcuts/shortcuts.js +95 -0
- package/dist/shortcuts/shortcuts.test.d.ts +2 -0
- package/dist/shortcuts/shortcuts.test.d.ts.map +1 -0
- package/dist/shortcuts/shortcuts.test.js +263 -0
- package/dist/store/create-store.d.ts +13 -0
- package/dist/store/create-store.d.ts.map +1 -0
- package/dist/store/create-store.js +248 -0
- package/dist/store/index.d.ts +9 -0
- package/dist/store/index.d.ts.map +1 -0
- package/dist/store/index.js +5 -0
- package/dist/store/locale.d.ts +23 -0
- package/dist/store/locale.d.ts.map +1 -0
- package/dist/store/locale.js +31 -0
- package/dist/store/react.d.ts +17 -0
- package/dist/store/react.d.ts.map +1 -0
- package/dist/store/react.js +32 -0
- package/dist/store/selection.d.ts +32 -0
- package/dist/store/selection.d.ts.map +1 -0
- package/dist/store/selection.js +84 -0
- package/dist/store/selection.test.d.ts +2 -0
- package/dist/store/selection.test.d.ts.map +1 -0
- package/dist/store/selection.test.js +95 -0
- package/dist/store/selectors.d.ts +18 -0
- package/dist/store/selectors.d.ts.map +1 -0
- package/dist/store/selectors.js +39 -0
- package/dist/store/store.test.d.ts +2 -0
- package/dist/store/store.test.d.ts.map +1 -0
- package/dist/store/store.test.js +331 -0
- package/dist/store/types.d.ts +114 -0
- package/dist/store/types.d.ts.map +1 -0
- package/dist/store/types.js +1 -0
- package/dist/styles/tokens.test.d.ts +2 -0
- package/dist/styles/tokens.test.d.ts.map +1 -0
- package/dist/styles/tokens.test.js +199 -0
- package/dist/styles.css +2885 -0
- package/dist/toolbar/brand.d.ts +7 -0
- package/dist/toolbar/brand.d.ts.map +1 -0
- package/dist/toolbar/brand.js +11 -0
- package/dist/toolbar/breakpoint-control.d.ts +9 -0
- package/dist/toolbar/breakpoint-control.d.ts.map +1 -0
- package/dist/toolbar/breakpoint-control.js +23 -0
- package/dist/toolbar/editable-title.d.ts +14 -0
- package/dist/toolbar/editable-title.d.ts.map +1 -0
- package/dist/toolbar/editable-title.js +46 -0
- package/dist/toolbar/editable-title.test.d.ts +2 -0
- package/dist/toolbar/editable-title.test.d.ts.map +1 -0
- package/dist/toolbar/editable-title.test.js +53 -0
- package/dist/toolbar/index.d.ts +12 -0
- package/dist/toolbar/index.d.ts.map +1 -0
- package/dist/toolbar/index.js +5 -0
- package/dist/toolbar/locale-switcher.d.ts +10 -0
- package/dist/toolbar/locale-switcher.d.ts.map +1 -0
- package/dist/toolbar/locale-switcher.js +20 -0
- package/dist/toolbar/more-menu.d.ts +12 -0
- package/dist/toolbar/more-menu.d.ts.map +1 -0
- package/dist/toolbar/more-menu.js +47 -0
- package/dist/toolbar/panel-toggles.d.ts +9 -0
- package/dist/toolbar/panel-toggles.d.ts.map +1 -0
- package/dist/toolbar/panel-toggles.js +19 -0
- package/dist/toolbar/publish-dialog.d.ts +18 -0
- package/dist/toolbar/publish-dialog.d.ts.map +1 -0
- package/dist/toolbar/publish-dialog.js +49 -0
- package/dist/toolbar/publish.test.d.ts +2 -0
- package/dist/toolbar/publish.test.d.ts.map +1 -0
- package/dist/toolbar/publish.test.js +258 -0
- package/dist/toolbar/sample-picker.d.ts +18 -0
- package/dist/toolbar/sample-picker.d.ts.map +1 -0
- package/dist/toolbar/sample-picker.js +72 -0
- package/dist/toolbar/sample-picker.test.d.ts +2 -0
- package/dist/toolbar/sample-picker.test.d.ts.map +1 -0
- package/dist/toolbar/sample-picker.test.js +78 -0
- package/dist/toolbar/save-indicator.d.ts +8 -0
- package/dist/toolbar/save-indicator.d.ts.map +1 -0
- package/dist/toolbar/save-indicator.js +30 -0
- package/dist/toolbar/theme.d.ts +22 -0
- package/dist/toolbar/theme.d.ts.map +1 -0
- package/dist/toolbar/theme.js +46 -0
- package/dist/toolbar/theme.test.d.ts +2 -0
- package/dist/toolbar/theme.test.d.ts.map +1 -0
- package/dist/toolbar/theme.test.js +49 -0
- package/dist/toolbar/toolbar-centre.d.ts +13 -0
- package/dist/toolbar/toolbar-centre.d.ts.map +1 -0
- package/dist/toolbar/toolbar-centre.js +7 -0
- package/dist/toolbar/toolbar-left.d.ts +12 -0
- package/dist/toolbar/toolbar-left.d.ts.map +1 -0
- package/dist/toolbar/toolbar-left.js +16 -0
- package/dist/toolbar/toolbar-right.d.ts +19 -0
- package/dist/toolbar/toolbar-right.d.ts.map +1 -0
- package/dist/toolbar/toolbar-right.js +21 -0
- package/dist/toolbar/toolbar.d.ts +38 -0
- package/dist/toolbar/toolbar.d.ts.map +1 -0
- package/dist/toolbar/toolbar.js +27 -0
- package/dist/toolbar/toolbar.test.d.ts +2 -0
- package/dist/toolbar/toolbar.test.d.ts.map +1 -0
- package/dist/toolbar/toolbar.test.js +289 -0
- package/dist/toolbar/use-overflow-level.d.ts +9 -0
- package/dist/toolbar/use-overflow-level.d.ts.map +1 -0
- package/dist/toolbar/use-overflow-level.js +40 -0
- package/dist/toolbar/zoom-menu.d.ts +10 -0
- package/dist/toolbar/zoom-menu.d.ts.map +1 -0
- package/dist/toolbar/zoom-menu.js +17 -0
- package/dist/ui/icon.d.ts +102 -0
- package/dist/ui/icon.d.ts.map +1 -0
- package/dist/ui/icon.js +182 -0
- package/dist/ui/icon.test.d.ts +2 -0
- package/dist/ui/icon.test.d.ts.map +1 -0
- package/dist/ui/icon.test.js +115 -0
- package/dist/ui/index.d.ts +11 -0
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +5 -0
- package/dist/ui/panel.d.ts +18 -0
- package/dist/ui/panel.d.ts.map +1 -0
- package/dist/ui/panel.js +21 -0
- package/dist/ui/portal.d.ts +14 -0
- package/dist/ui/portal.d.ts.map +1 -0
- package/dist/ui/portal.js +14 -0
- package/dist/ui/primitives.d.ts +190 -0
- package/dist/ui/primitives.d.ts.map +1 -0
- package/dist/ui/primitives.js +164 -0
- package/dist/ui/primitives.test.d.ts +2 -0
- package/dist/ui/primitives.test.d.ts.map +1 -0
- package/dist/ui/primitives.test.js +215 -0
- package/dist/ui/toast.d.ts +39 -0
- package/dist/ui/toast.d.ts.map +1 -0
- package/dist/ui/toast.js +76 -0
- package/dist/ui/toast.test.d.ts +2 -0
- package/dist/ui/toast.test.d.ts.map +1 -0
- package/dist/ui/toast.test.js +95 -0
- package/package.json +66 -3
- package/README.md +0 -3
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// @vitest-environment jsdom
|
|
3
|
+
import { createRegistryMeta, createSeededIdGenerator, p, s, toManifest, } from '@next-buildr/core';
|
|
4
|
+
import { act } from 'react';
|
|
5
|
+
import { createRoot } from 'react-dom/client';
|
|
6
|
+
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
|
7
|
+
import { axe } from 'vitest-axe';
|
|
8
|
+
import * as matchers from 'vitest-axe/matchers';
|
|
9
|
+
import { ManifestProvider } from '../../app/manifest.js';
|
|
10
|
+
import { MessagesProvider } from '../../messages/index.js';
|
|
11
|
+
import { createEditorStore, EditorStoreProvider } from '../../store/index.js';
|
|
12
|
+
import { parseNumber } from './controls/index.js';
|
|
13
|
+
import { Inspector } from './inspector.js';
|
|
14
|
+
import { isAdvancedProp, propLabel } from './props-panel.js';
|
|
15
|
+
import { readProp } from './value.js';
|
|
16
|
+
expect.extend(matchers);
|
|
17
|
+
globalThis.IS_REACT_ACT_ENVIRONMENT = true;
|
|
18
|
+
const widget = {
|
|
19
|
+
type: 'buildr/widget',
|
|
20
|
+
version: 1,
|
|
21
|
+
label: 'Widget',
|
|
22
|
+
category: 'content',
|
|
23
|
+
props: {
|
|
24
|
+
title: p.text({ label: 'Title', maxLength: 10, default: 'Hello', group: 'content' }),
|
|
25
|
+
body: p.textarea({ default: '' }),
|
|
26
|
+
count: p.number({ default: 5, min: 0, max: 10 }),
|
|
27
|
+
visible: p.boolean({ default: true }),
|
|
28
|
+
size: p.select({ options: ['sm', 'md', 'lg'], default: 'md' }),
|
|
29
|
+
href: p.link({}),
|
|
30
|
+
symbol: p.icon({}),
|
|
31
|
+
ariaLabel: p.text({ group: 'accessibility' }),
|
|
32
|
+
fixed: p.number({ default: 1, localizable: false }),
|
|
33
|
+
},
|
|
34
|
+
contentCategories: ['flow'],
|
|
35
|
+
styles: { groups: [] },
|
|
36
|
+
runtime: 'shared',
|
|
37
|
+
slots: { default: {} },
|
|
38
|
+
};
|
|
39
|
+
const page = {
|
|
40
|
+
...widget,
|
|
41
|
+
type: 'buildr/page',
|
|
42
|
+
label: 'Page',
|
|
43
|
+
props: {},
|
|
44
|
+
capabilities: { root: true },
|
|
45
|
+
};
|
|
46
|
+
const registry = createRegistryMeta({ components: [page, widget] });
|
|
47
|
+
const manifest = toManifest(registry);
|
|
48
|
+
const fixture = () => ({
|
|
49
|
+
schemaVersion: 1,
|
|
50
|
+
root: 'root',
|
|
51
|
+
nodes: {
|
|
52
|
+
root: { id: 'root', type: 'buildr/page', slots: { default: ['widget0001', 'locked0001'] } },
|
|
53
|
+
widget0001: { id: 'widget0001', type: 'buildr/widget' },
|
|
54
|
+
locked0001: {
|
|
55
|
+
id: 'locked0001',
|
|
56
|
+
type: 'buildr/widget',
|
|
57
|
+
lock: { content: true },
|
|
58
|
+
props: { title: s('Locked') },
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
components: {},
|
|
62
|
+
});
|
|
63
|
+
let container;
|
|
64
|
+
let root;
|
|
65
|
+
beforeEach(() => {
|
|
66
|
+
container = document.createElement('div');
|
|
67
|
+
document.body.append(container);
|
|
68
|
+
root = createRoot(container);
|
|
69
|
+
Element.prototype.scrollIntoView ??= () => { };
|
|
70
|
+
Element.prototype.hasPointerCapture ??= () => false;
|
|
71
|
+
Element.prototype.setPointerCapture ??= () => { };
|
|
72
|
+
Element.prototype.releasePointerCapture ??= () => { };
|
|
73
|
+
});
|
|
74
|
+
afterEach(() => {
|
|
75
|
+
act(() => root.unmount());
|
|
76
|
+
document.body.innerHTML = '';
|
|
77
|
+
});
|
|
78
|
+
async function mount(select, extra = {}, doc = fixture()) {
|
|
79
|
+
const store = createEditorStore({
|
|
80
|
+
doc,
|
|
81
|
+
registry,
|
|
82
|
+
generateId: createSeededIdGenerator(3),
|
|
83
|
+
validationDelayMs: null,
|
|
84
|
+
});
|
|
85
|
+
if (select !== null)
|
|
86
|
+
store.select(select);
|
|
87
|
+
await act(async () => root.render(_jsx(MessagesProvider, { locale: "en", children: _jsx(ManifestProvider, { manifest: manifest, children: _jsx(EditorStoreProvider, { store: store, children: _jsx(Inspector, { ...extra }) }) }) })));
|
|
88
|
+
return store;
|
|
89
|
+
}
|
|
90
|
+
const field = (prop) => container.querySelector(`[data-prop=${prop}]`);
|
|
91
|
+
const input = (prop) => field(prop).querySelector('input, textarea, button[role=combobox]');
|
|
92
|
+
const typeInto = (element, value) => act(async () => {
|
|
93
|
+
const proto = element instanceof HTMLTextAreaElement
|
|
94
|
+
? HTMLTextAreaElement.prototype
|
|
95
|
+
: HTMLInputElement.prototype;
|
|
96
|
+
Object.getOwnPropertyDescriptor(proto, 'value')?.set?.call(element, value);
|
|
97
|
+
element.dispatchEvent(new Event('input', { bubbles: true }));
|
|
98
|
+
});
|
|
99
|
+
const propOf = (store, id, prop) => store.getState().doc.nodes[id]?.props?.[prop];
|
|
100
|
+
const openTab = (name) => act(async () => {
|
|
101
|
+
const tab = [...container.querySelectorAll('[role=tab]')].find((t) => t.textContent === name);
|
|
102
|
+
tab?.dispatchEvent(new MouseEvent('mousedown', { bubbles: true, button: 0 }));
|
|
103
|
+
});
|
|
104
|
+
const notice = () => container.querySelector('[role=status]')?.textContent;
|
|
105
|
+
describe('helpers', () => {
|
|
106
|
+
it('labels a prop by its label, else by its name in words', () => {
|
|
107
|
+
expect(propLabel('title', widget.props['title'])).toBe('Title');
|
|
108
|
+
expect(propLabel('ariaLabel', widget.props['ariaLabel'])).toBe('Aria label');
|
|
109
|
+
expect(isAdvancedProp(widget.props['ariaLabel'])).toBe(true);
|
|
110
|
+
expect(isAdvancedProp(widget.props['title'])).toBe(false);
|
|
111
|
+
});
|
|
112
|
+
it('parses only numbers a prop accepts', () => {
|
|
113
|
+
const def = widget.props['count'];
|
|
114
|
+
expect(parseNumber('7', def)).toBe(7);
|
|
115
|
+
expect(parseNumber('', def)).toBeUndefined();
|
|
116
|
+
expect(parseNumber('abc', def)).toBeUndefined();
|
|
117
|
+
expect(parseNumber('11', def)).toBeUndefined();
|
|
118
|
+
expect(parseNumber('-1', def)).toBeUndefined();
|
|
119
|
+
});
|
|
120
|
+
it('reads static, translated, and bound values', () => {
|
|
121
|
+
const def = widget.props['title'];
|
|
122
|
+
const node = {
|
|
123
|
+
id: 'x',
|
|
124
|
+
type: 'buildr/widget',
|
|
125
|
+
props: { title: { kind: 'static', value: 'Hi', l10n: { pl: 'Cześć' } } },
|
|
126
|
+
};
|
|
127
|
+
expect(readProp(node, 'title', def, 'en', 'en')).toMatchObject({ value: 'Hi', isSet: true });
|
|
128
|
+
expect(readProp(node, 'title', def, 'pl', 'en')).toMatchObject({ value: 'Cześć', isSet: true });
|
|
129
|
+
expect(readProp(node, 'title', def, 'de', 'en')).toMatchObject({ value: 'Hi', isSet: false });
|
|
130
|
+
expect(readProp({ ...node, props: {} }, 'title', def, 'en', 'en')).toMatchObject({
|
|
131
|
+
value: 'Hello',
|
|
132
|
+
isSet: false,
|
|
133
|
+
});
|
|
134
|
+
const bound = { ...node, props: { title: { kind: 'binding', path: 'post.title' } } };
|
|
135
|
+
expect(readProp(bound, 'title', def, 'en', 'en')).toMatchObject({
|
|
136
|
+
mode: 'binding',
|
|
137
|
+
source: 'post.title',
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
describe('Inspector', () => {
|
|
142
|
+
it('asks for a selection when there is none', async () => {
|
|
143
|
+
await mount(null);
|
|
144
|
+
expect(container.textContent).toContain('Select an element to edit it.');
|
|
145
|
+
});
|
|
146
|
+
it('collapses a prop group and remembers it per component type', async () => {
|
|
147
|
+
window.localStorage.clear();
|
|
148
|
+
await mount('widget0001');
|
|
149
|
+
const toggle = () => container.querySelector('.bd-props-group[data-group=content] .bd-props-toggle');
|
|
150
|
+
expect(toggle().getAttribute('aria-expanded')).toBe('true');
|
|
151
|
+
await act(async () => toggle().click());
|
|
152
|
+
expect(toggle().getAttribute('aria-expanded')).toBe('false');
|
|
153
|
+
expect(window.localStorage.getItem('buildr.editor.inspector.groups.buildr/widget')).toBe('["content"]');
|
|
154
|
+
await act(async () => root.unmount());
|
|
155
|
+
root = createRoot(container);
|
|
156
|
+
await mount('widget0001');
|
|
157
|
+
expect(toggle().getAttribute('aria-expanded')).toBe('false');
|
|
158
|
+
window.localStorage.clear();
|
|
159
|
+
});
|
|
160
|
+
it('duplicates and deletes from the header with the same commands as the layers', async () => {
|
|
161
|
+
const store = await mount('widget0001');
|
|
162
|
+
const named = (label) => container.querySelector(`button[aria-label="${label}"]`);
|
|
163
|
+
await act(async () => named('Duplicate element').click());
|
|
164
|
+
expect(Object.keys(store.getState().doc.nodes)).toHaveLength(4);
|
|
165
|
+
await act(async () => named('Delete element').click());
|
|
166
|
+
expect(Object.keys(store.getState().doc.nodes)).toHaveLength(3);
|
|
167
|
+
});
|
|
168
|
+
it('gives every control an accessible name and passes axe', async () => {
|
|
169
|
+
await mount('widget0001');
|
|
170
|
+
expect(container.querySelector('h3')?.textContent).toBe('Widget');
|
|
171
|
+
expect(input('title').getAttribute('aria-label')).toBe('Title');
|
|
172
|
+
expect(container.querySelector('label[for]')?.textContent).toBeTruthy();
|
|
173
|
+
// the hint is what the control is described by
|
|
174
|
+
const described = input('title').getAttribute('aria-describedby');
|
|
175
|
+
expect(container.querySelector(`[id="${described}"]`)?.textContent).toContain('Maximum length: 10');
|
|
176
|
+
expect(await axe(container)).toHaveNoViolations();
|
|
177
|
+
});
|
|
178
|
+
it('writes text with node.setProp, and typing is one undo step', async () => {
|
|
179
|
+
const store = await mount('widget0001');
|
|
180
|
+
expect(input('title').value).toBe('Hello');
|
|
181
|
+
await typeInto(input('title'), 'Hi');
|
|
182
|
+
await typeInto(input('title'), 'Hi t');
|
|
183
|
+
expect(propOf(store, 'widget0001', 'title')).toEqual({ kind: 'static', value: 'Hi t' });
|
|
184
|
+
expect(store.getState().undoLabel).toBe('node.setProp');
|
|
185
|
+
await act(async () => store.undo());
|
|
186
|
+
expect(propOf(store, 'widget0001', 'title')).toBeUndefined();
|
|
187
|
+
expect(store.getState().canUndo).toBe(false);
|
|
188
|
+
});
|
|
189
|
+
it('writes a textarea, a link and an icon', async () => {
|
|
190
|
+
const store = await mount('widget0001');
|
|
191
|
+
await typeInto(input('body'), 'Line');
|
|
192
|
+
await typeInto(input('href'), '/about');
|
|
193
|
+
await typeInto(input('symbol'), 'arrow-right');
|
|
194
|
+
expect(propOf(store, 'widget0001', 'body')).toEqual({ kind: 'static', value: 'Line' });
|
|
195
|
+
expect(propOf(store, 'widget0001', 'href')).toEqual({ kind: 'static', value: '/about' });
|
|
196
|
+
expect(propOf(store, 'widget0001', 'symbol')).toEqual({ kind: 'static', value: 'arrow-right' });
|
|
197
|
+
});
|
|
198
|
+
it('writes a number only when it is valid, and shows the stored one again on blur', async () => {
|
|
199
|
+
const store = await mount('widget0001');
|
|
200
|
+
await typeInto(input('count'), '8');
|
|
201
|
+
expect(propOf(store, 'widget0001', 'count')).toEqual({ kind: 'static', value: 8 });
|
|
202
|
+
await typeInto(input('count'), '99');
|
|
203
|
+
await typeInto(input('count'), '');
|
|
204
|
+
expect(propOf(store, 'widget0001', 'count')).toEqual({ kind: 'static', value: 8 });
|
|
205
|
+
await act(async () => {
|
|
206
|
+
input('count').dispatchEvent(new FocusEvent('focusout', { bubbles: true }));
|
|
207
|
+
});
|
|
208
|
+
expect(input('count').value).toBe('8');
|
|
209
|
+
});
|
|
210
|
+
it('toggles a boolean', async () => {
|
|
211
|
+
const store = await mount('widget0001');
|
|
212
|
+
expect(input('visible').checked).toBe(true);
|
|
213
|
+
await act(async () => input('visible').click());
|
|
214
|
+
expect(propOf(store, 'widget0001', 'visible')).toEqual({ kind: 'static', value: false });
|
|
215
|
+
});
|
|
216
|
+
it('chooses from a select', async () => {
|
|
217
|
+
const store = await mount('widget0001');
|
|
218
|
+
const trigger = input('size');
|
|
219
|
+
expect(trigger.textContent).toContain('md');
|
|
220
|
+
await act(async () => {
|
|
221
|
+
trigger.dispatchEvent(new PointerEvent('pointerdown', { bubbles: true, button: 0, pointerType: 'mouse' }));
|
|
222
|
+
});
|
|
223
|
+
const option = [...document.querySelectorAll('[role=option]')].find((o) => o.textContent === 'lg');
|
|
224
|
+
await act(async () => {
|
|
225
|
+
option?.dispatchEvent(new PointerEvent('pointerup', { bubbles: true, pointerType: 'mouse' }));
|
|
226
|
+
option?.click();
|
|
227
|
+
});
|
|
228
|
+
expect(propOf(store, 'widget0001', 'size')).toEqual({ kind: 'static', value: 'lg' });
|
|
229
|
+
});
|
|
230
|
+
it('resets a value with node.unsetProp, and offers reset only when one is set', async () => {
|
|
231
|
+
const store = await mount('widget0001');
|
|
232
|
+
expect(field('title').querySelector('.bd-field-reset')).toBeNull();
|
|
233
|
+
await typeInto(input('title'), 'Hi');
|
|
234
|
+
const reset = field('title').querySelector('.bd-field-reset');
|
|
235
|
+
expect(reset.getAttribute('aria-label')).toBe('Reset: Title');
|
|
236
|
+
await act(async () => reset.click());
|
|
237
|
+
expect(propOf(store, 'widget0001', 'title')).toBeUndefined();
|
|
238
|
+
expect(input('title').value).toBe('Hello');
|
|
239
|
+
expect(field('title').querySelector('.bd-field-reset')).toBeNull();
|
|
240
|
+
});
|
|
241
|
+
it('shows a bound prop in the data mode, with its path', async () => {
|
|
242
|
+
const doc = fixture();
|
|
243
|
+
const bound = {
|
|
244
|
+
...doc,
|
|
245
|
+
nodes: {
|
|
246
|
+
...doc.nodes,
|
|
247
|
+
widget0001: {
|
|
248
|
+
id: 'widget0001',
|
|
249
|
+
type: 'buildr/widget',
|
|
250
|
+
props: {
|
|
251
|
+
title: { kind: 'binding', path: 'post.title' },
|
|
252
|
+
href: { kind: 'expression', expr: 'post.slug' },
|
|
253
|
+
},
|
|
254
|
+
},
|
|
255
|
+
},
|
|
256
|
+
};
|
|
257
|
+
await mount('widget0001', {}, bound);
|
|
258
|
+
expect(field('title').querySelector('input').value).toBe('post.title');
|
|
259
|
+
expect(field('title').querySelector('[aria-pressed=true]')?.textContent).toBe('Data');
|
|
260
|
+
expect(field('href').querySelector('[aria-pressed=true]')?.textContent).toBe('Formula');
|
|
261
|
+
expect(field('href').querySelector('textarea').value).toBe('post.slug');
|
|
262
|
+
});
|
|
263
|
+
it('writes a translation to the language being edited, only for translatable props', async () => {
|
|
264
|
+
const store = await mount('widget0001', { locale: 'pl', defaultLocale: 'en' });
|
|
265
|
+
await typeInto(input('title'), 'Cześć');
|
|
266
|
+
expect(propOf(store, 'widget0001', 'title')).toEqual({
|
|
267
|
+
kind: 'static',
|
|
268
|
+
value: 'Hello',
|
|
269
|
+
l10n: { pl: 'Cześć' },
|
|
270
|
+
});
|
|
271
|
+
await typeInto(input('fixed'), '4');
|
|
272
|
+
expect(propOf(store, 'widget0001', 'fixed')).toEqual({ kind: 'static', value: 4 });
|
|
273
|
+
// reset removes the translation, not the value
|
|
274
|
+
await act(async () => field('title').querySelector('.bd-field-reset').click());
|
|
275
|
+
expect(propOf(store, 'widget0001', 'title')).toEqual({ kind: 'static', value: 'Hello' });
|
|
276
|
+
});
|
|
277
|
+
it('disables everything on locked content', async () => {
|
|
278
|
+
const store = await mount('locked0001');
|
|
279
|
+
expect(container.textContent).toContain('This content is locked.');
|
|
280
|
+
expect(input('title').disabled).toBe(true);
|
|
281
|
+
expect(input('visible').disabled).toBe(true);
|
|
282
|
+
expect(store.getState().canUndo).toBe(false);
|
|
283
|
+
});
|
|
284
|
+
it('puts accessibility props, the name and the anchor on the Advanced tab', async () => {
|
|
285
|
+
const store = await mount('widget0001');
|
|
286
|
+
expect(field('ariaLabel')).toBeNull();
|
|
287
|
+
await openTab('Advanced');
|
|
288
|
+
await typeInto(input('ariaLabel'), 'Close');
|
|
289
|
+
expect(propOf(store, 'widget0001', 'ariaLabel')).toEqual({ kind: 'static', value: 'Close' });
|
|
290
|
+
const name = container.querySelector('[data-attr=name] input');
|
|
291
|
+
await typeInto(name, 'Header');
|
|
292
|
+
expect(store.getState().doc.nodes['widget0001']?.name).toBe('Header');
|
|
293
|
+
await typeInto(name, '');
|
|
294
|
+
expect(store.getState().doc.nodes['widget0001']?.name).toBeUndefined();
|
|
295
|
+
const anchor = container.querySelector('[data-attr=anchor] input');
|
|
296
|
+
await typeInto(anchor, 'Bad Anchor');
|
|
297
|
+
expect(store.getState().doc.nodes['widget0001']?.anchor).toBeUndefined();
|
|
298
|
+
expect(notice()).not.toBe('');
|
|
299
|
+
expect(anchor.value).toBe('Bad Anchor');
|
|
300
|
+
await typeInto(anchor, 'intro');
|
|
301
|
+
expect(store.getState().doc.nodes['widget0001']?.anchor).toBe('intro');
|
|
302
|
+
expect(notice()).toBe('');
|
|
303
|
+
});
|
|
304
|
+
it('removes a display condition', async () => {
|
|
305
|
+
const doc = fixture();
|
|
306
|
+
const conditional = {
|
|
307
|
+
...doc,
|
|
308
|
+
nodes: {
|
|
309
|
+
...doc.nodes,
|
|
310
|
+
widget0001: {
|
|
311
|
+
id: 'widget0001',
|
|
312
|
+
type: 'buildr/widget',
|
|
313
|
+
visibleIf: { kind: 'binding', path: 'user.loggedIn' },
|
|
314
|
+
},
|
|
315
|
+
},
|
|
316
|
+
};
|
|
317
|
+
const store = await mount('widget0001', {}, conditional);
|
|
318
|
+
await openTab('Advanced');
|
|
319
|
+
const remove = [...container.querySelectorAll('button')].find((b) => b.textContent === 'Remove the condition');
|
|
320
|
+
await act(async () => remove?.click());
|
|
321
|
+
expect(store.getState().doc.nodes['widget0001']?.visibleIf).toBeUndefined();
|
|
322
|
+
});
|
|
323
|
+
it('leaves the Style tab to the style inspector', async () => {
|
|
324
|
+
await mount('widget0001', { renderStyle: (node) => _jsxs("p", { children: ["styles of ", node.id] }) });
|
|
325
|
+
await openTab('Style');
|
|
326
|
+
expect(container.textContent).toContain('styles of widget0001');
|
|
327
|
+
});
|
|
328
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ComponentMeta, PageNode, PropDef, Value } from '@next-buildr/core';
|
|
2
|
+
import { propLabel } from './controls/index.ts';
|
|
3
|
+
export declare const isAdvancedProp: (def: PropDef) => boolean;
|
|
4
|
+
export { propLabel };
|
|
5
|
+
export interface PropsPanelProps {
|
|
6
|
+
readonly node: PageNode;
|
|
7
|
+
readonly meta: ComponentMeta;
|
|
8
|
+
/** Which props to show: the content ones or the advanced ones. */
|
|
9
|
+
readonly scope: 'content' | 'advanced';
|
|
10
|
+
readonly locale: string | undefined;
|
|
11
|
+
readonly defaultLocale: string | undefined;
|
|
12
|
+
readonly disabled: boolean;
|
|
13
|
+
readonly onChange: (prop: string, def: PropDef, value: unknown) => void;
|
|
14
|
+
readonly onReset: (prop: string, def: PropDef) => void;
|
|
15
|
+
/** Writes a binding or a formula (PB-081). */
|
|
16
|
+
readonly onSetValue?: (prop: string, def: PropDef, value: Value) => void;
|
|
17
|
+
/** Back from a binding or a formula to a fixed value. */
|
|
18
|
+
readonly onFixed?: (prop: string, def: PropDef) => void;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The props of a component as controls, grouped by their `group` (docs/editor.md#inspector). A
|
|
22
|
+
* control writes with `node.setProp` (typing coalesces into one undo step through the command's
|
|
23
|
+
* merge key) and "Reset" removes the value (`node.unsetProp`), which shows the default again.
|
|
24
|
+
*/
|
|
25
|
+
export declare function PropsPanel(props: PropsPanelProps): import("react").JSX.Element | null;
|
|
26
|
+
//# sourceMappingURL=props-panel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"props-panel.d.ts","sourceRoot":"","sources":["../../../src/panels/inspector/props-panel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAIjF,OAAO,EAAE,SAAS,EAAiB,MAAM,qBAAqB,CAAC;AAQ/D,eAAO,MAAM,cAAc,QAAS,OAAO,YACgB,CAAC;AAI5D,OAAO,EAAE,SAAS,EAAE,CAAC;AA2CrB,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAC7B,kEAAkE;IAClE,QAAQ,CAAC,KAAK,EAAE,SAAS,GAAG,UAAU,CAAC;IACvC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3C,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACxE,QAAQ,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,KAAK,IAAI,CAAC;IACvD,8CAA8C;IAC9C,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACzE,yDAAyD;IACzD,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,KAAK,IAAI,CAAC;CACzD;AA8GD;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,sCAkEhD"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useId, useState } from 'react';
|
|
3
|
+
import { useT } from '../../messages/index.js';
|
|
4
|
+
import { Icon, IconButton } from '../../ui/index.js';
|
|
5
|
+
import { propLabel, renderControl } from './controls/index.js';
|
|
6
|
+
import { readProp, translationLocale } from './value.js';
|
|
7
|
+
import { TranslationHint } from './values/translation.js';
|
|
8
|
+
import { ValueEditor } from './values/value-editor.js';
|
|
9
|
+
/** Groups that live on the Advanced tab; everything else is content. */
|
|
10
|
+
const ADVANCED_GROUPS = new Set(['advanced', 'accessibility']);
|
|
11
|
+
export const isAdvancedProp = (def) => def.group !== undefined && ADVANCED_GROUPS.has(def.group);
|
|
12
|
+
const titleCase = (text) => text.charAt(0).toUpperCase() + text.slice(1);
|
|
13
|
+
export { propLabel };
|
|
14
|
+
/** Short controls sit on one row with their label; long ones are stacked under it. */
|
|
15
|
+
const ROW_KINDS = new Set(['boolean', 'select', 'number', 'icon']);
|
|
16
|
+
const storageKey = (type) => `buildr.editor.inspector.groups.${type}`;
|
|
17
|
+
/** The groups the user closed for a component type (localStorage, best effort). */
|
|
18
|
+
function loadClosed(type) {
|
|
19
|
+
try {
|
|
20
|
+
const raw = window.localStorage.getItem(storageKey(type));
|
|
21
|
+
const parsed = raw === null ? [] : JSON.parse(raw);
|
|
22
|
+
return new Set(Array.isArray(parsed) ? parsed.filter((x) => typeof x === 'string') : []);
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
return new Set();
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function saveClosed(type, closed) {
|
|
29
|
+
try {
|
|
30
|
+
window.localStorage.setItem(storageKey(type), JSON.stringify([...closed]));
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
// storage is unavailable: the state just is not remembered
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/** Which prop groups are collapsed, remembered per component type. */
|
|
37
|
+
function useClosedGroups(type) {
|
|
38
|
+
const [state, setState] = useState(() => ({ type, closed: loadClosed(type) }));
|
|
39
|
+
let closed = state.closed;
|
|
40
|
+
if (state.type !== type) {
|
|
41
|
+
closed = loadClosed(type);
|
|
42
|
+
setState({ type, closed });
|
|
43
|
+
}
|
|
44
|
+
const toggle = (group) => {
|
|
45
|
+
const next = new Set(closed);
|
|
46
|
+
if (!next.delete(group))
|
|
47
|
+
next.add(group);
|
|
48
|
+
saveClosed(type, next);
|
|
49
|
+
setState({ type, closed: next });
|
|
50
|
+
};
|
|
51
|
+
return { closed, toggle };
|
|
52
|
+
}
|
|
53
|
+
/** A hint shown under a control: what the default is, and the limits a value must keep. */
|
|
54
|
+
function hintFor(def, t) {
|
|
55
|
+
const parts = [];
|
|
56
|
+
const shown = String(def.default);
|
|
57
|
+
if (def.kind !== 'list' && def.kind !== 'object' && def.kind !== 'richText' && shown !== '') {
|
|
58
|
+
parts.push(`${t('inspector.default')}: ${shown}`);
|
|
59
|
+
}
|
|
60
|
+
if ((def.kind === 'text' || def.kind === 'textarea') && def.maxLength !== undefined) {
|
|
61
|
+
parts.push(`${t('inspector.maxLength')}: ${def.maxLength}`);
|
|
62
|
+
}
|
|
63
|
+
if (def.kind === 'number') {
|
|
64
|
+
if (def.min !== undefined)
|
|
65
|
+
parts.push(`${t('inspector.min')}: ${def.min}`);
|
|
66
|
+
if (def.max !== undefined)
|
|
67
|
+
parts.push(`${t('inspector.max')}: ${def.max}`);
|
|
68
|
+
}
|
|
69
|
+
return parts.join(' · ');
|
|
70
|
+
}
|
|
71
|
+
function Field(props) {
|
|
72
|
+
const { name, def, reading, disabled, translating } = props;
|
|
73
|
+
const t = useT();
|
|
74
|
+
const id = useId();
|
|
75
|
+
const hintId = `${id}-hint`;
|
|
76
|
+
const label = propLabel(name, def);
|
|
77
|
+
const hint = hintFor(def, t);
|
|
78
|
+
const editable = reading.mode === 'static';
|
|
79
|
+
const control = renderControl(def, {
|
|
80
|
+
id,
|
|
81
|
+
def,
|
|
82
|
+
label,
|
|
83
|
+
describedBy: hint === '' ? undefined : hintId,
|
|
84
|
+
value: reading.value,
|
|
85
|
+
disabled,
|
|
86
|
+
onChange: (value) => props.onChange(name, def, value),
|
|
87
|
+
});
|
|
88
|
+
const layout = ROW_KINDS.has(def.kind) ? 'row' : 'stack';
|
|
89
|
+
return (_jsxs("div", { className: "bd-field", "data-prop": name, "data-kind": def.kind, "data-layout": layout, "data-untranslated": translating && !reading.isSet ? true : undefined, children: [_jsxs("div", { className: "bd-field-head", children: [control !== null && editable ? (_jsxs("label", { htmlFor: id, className: "bd-field-label", children: [label, translating ? (_jsxs("span", { className: "bd-field-locale", children: [" (", t('inspector.translation'), ")"] })) : null] })) : (_jsx("span", { className: "bd-field-label", children: label })), reading.isSet ? (_jsx(IconButton, { variant: "ghost", icon: "rotate-ccw", className: "bd-field-reset", disabled: disabled, label: `${t(translating ? 'translation.remove' : 'inspector.reset')}: ${label}`, onClick: () => props.onReset(name, def) })) : null] }), _jsx("div", { className: "bd-field-body", children: _jsx(ValueEditor, { def: def, label: label, raw: props.raw, disabled: disabled, staticControl: control, onSet: (value) => props.onSetValue?.(name, def, value), onFixed: () => props.onFixed?.(name, def) }) }), translating && editable ? (_jsx(TranslationHint, { translated: reading.isSet, disabled: disabled, label: label, onTranslate: () => props.onChange(name, def, reading.value) })) : null, editable && control === null ? (_jsx("p", { className: "bd-field-unsupported", children: t('inspector.unsupported') })) : null, hint !== '' ? (_jsx("p", { className: "bd-field-hint", id: hintId, children: hint })) : null] }));
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* The props of a component as controls, grouped by their `group` (docs/editor.md#inspector). A
|
|
93
|
+
* control writes with `node.setProp` (typing coalesces into one undo step through the command's
|
|
94
|
+
* merge key) and "Reset" removes the value (`node.unsetProp`), which shows the default again.
|
|
95
|
+
*/
|
|
96
|
+
export function PropsPanel(props) {
|
|
97
|
+
const t = useT();
|
|
98
|
+
const { node, meta, scope, locale, defaultLocale } = props;
|
|
99
|
+
const { closed, toggle } = useClosedGroups(node.type);
|
|
100
|
+
const panelId = useId();
|
|
101
|
+
const entries = Object.entries(meta.props).filter(([, def]) => isAdvancedProp(def) === (scope === 'advanced'));
|
|
102
|
+
if (entries.length === 0) {
|
|
103
|
+
return scope === 'content' ? (_jsxs("div", { className: "bd-inspector-empty", "data-state": "no-props", children: [_jsx(Icon, { name: "box", size: "md" }), _jsx("p", { className: "bd-inspector-empty-title", children: t('inspector.noProps') })] })) : null;
|
|
104
|
+
}
|
|
105
|
+
const groups = new Map();
|
|
106
|
+
for (const entry of entries) {
|
|
107
|
+
const group = entry[1].group ?? '';
|
|
108
|
+
const list = groups.get(group);
|
|
109
|
+
if (list === undefined)
|
|
110
|
+
groups.set(group, [entry]);
|
|
111
|
+
else
|
|
112
|
+
list.push(entry);
|
|
113
|
+
}
|
|
114
|
+
return (_jsx("div", { className: "bd-props", children: [...groups].map(([group, list]) => (_jsxs("section", { className: "bd-props-group", "data-group": group, children: [group !== '' ? (_jsx("h4", { className: "bd-props-heading", children: _jsxs("button", { type: "button", className: "bd-props-toggle", "aria-expanded": !closed.has(group), "aria-controls": `${panelId}-${group}`, onClick: () => toggle(group), children: [_jsx(Icon, { name: closed.has(group) ? 'chevron-right' : 'chevron-down' }), titleCase(group)] }) })) : null, _jsx("div", { id: `${panelId}-${group}`, className: "bd-props-fields", hidden: closed.has(group), children: list.map(([name, def]) => (_jsx(Field, { name: name, def: def, reading: readProp(node, name, def, locale, defaultLocale), raw: node.props !== undefined && Object.hasOwn(node.props, name)
|
|
115
|
+
? node.props[name]
|
|
116
|
+
: undefined, disabled: props.disabled, translating: translationLocale(def, locale, defaultLocale) !== undefined, onChange: props.onChange, onReset: props.onReset, onSetValue: props.onSetValue, onFixed: props.onFixed }, name))) })] }, group))) }));
|
|
117
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { BOX_SIDES, type EffectiveStyles, type StylePropertyDef } from '@next-buildr/core';
|
|
2
|
+
type Side = (typeof BOX_SIDES)[number];
|
|
3
|
+
export interface BoxModelProps {
|
|
4
|
+
readonly def: StylePropertyDef;
|
|
5
|
+
/** The visible name of the property (`Margin`). */
|
|
6
|
+
readonly label: string;
|
|
7
|
+
readonly effective: EffectiveStyles;
|
|
8
|
+
readonly layer: string;
|
|
9
|
+
readonly disabled: boolean;
|
|
10
|
+
/** Draws the edit field of the chosen side(s); it writes to every side in `sides`. */
|
|
11
|
+
readonly renderEditor: (sides: readonly Side[]) => React.ReactNode;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The box-model widget for margin and padding: the four sides around a box, each showing its
|
|
15
|
+
* value. Clicking a side chooses it for editing; Alt-click chooses both sides of its axis, and the
|
|
16
|
+
* one field below then writes to both.
|
|
17
|
+
*/
|
|
18
|
+
export declare function BoxModel({ def, label, effective, layer, disabled, renderEditor }: BoxModelProps): import("react").JSX.Element;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=box-model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"box-model.d.ts","sourceRoot":"","sources":["../../../../src/panels/inspector/styles/box-model.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,eAAe,EAAE,KAAK,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAI3F,KAAK,IAAI,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;AAgBvC,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,GAAG,EAAE,gBAAgB,CAAC;IAC/B,mDAAmD;IACnD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,SAAS,EAAE,eAAe,CAAC;IACpC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,sFAAsF;IACtF,QAAQ,CAAC,YAAY,EAAE,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,KAAK,KAAK,CAAC,SAAS,CAAC;CACpE;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,EAAE,aAAa,+BAoC/F"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { BOX_SIDES } from '@next-buildr/core';
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import { useT } from '../../../messages/index.js';
|
|
5
|
+
const OPPOSITE = {
|
|
6
|
+
top: 'bottom',
|
|
7
|
+
bottom: 'top',
|
|
8
|
+
left: 'right',
|
|
9
|
+
right: 'left',
|
|
10
|
+
};
|
|
11
|
+
const shortOf = (value) => {
|
|
12
|
+
if (value === undefined)
|
|
13
|
+
return '–';
|
|
14
|
+
const text = String(value);
|
|
15
|
+
const token = /^\$[A-Za-z]+\.(.+)$/.exec(text);
|
|
16
|
+
return token?.[1] ?? text.replace(/px$/, '');
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* The box-model widget for margin and padding: the four sides around a box, each showing its
|
|
20
|
+
* value. Clicking a side chooses it for editing; Alt-click chooses both sides of its axis, and the
|
|
21
|
+
* one field below then writes to both.
|
|
22
|
+
*/
|
|
23
|
+
export function BoxModel({ def, label, effective, layer, disabled, renderEditor }) {
|
|
24
|
+
const t = useT();
|
|
25
|
+
const [sides, setSides] = useState(['top']);
|
|
26
|
+
const choose = (side, both) => setSides(both ? [side, OPPOSITE[side]].sort() : [side]);
|
|
27
|
+
return (_jsxs("div", { className: "bd-box-model", "data-property": def.name, children: [_jsxs("div", { className: "bd-box-diagram", "data-kind": def.name, children: [BOX_SIDES.map((side) => {
|
|
28
|
+
const current = effective[`${def.group}.${def.name}.${side}`];
|
|
29
|
+
return (_jsx("button", { type: "button", className: "bd-box-side", "data-side": side, "data-source": current === undefined ? 'none' : current.source === layer ? 'set' : 'inherited', "aria-pressed": sides.includes(side), disabled: disabled, "aria-label": `${label} ${t(`style.side.${side}`)}`, onClick: (event) => choose(side, event.altKey), children: shortOf(current?.value) }, side));
|
|
30
|
+
}), _jsx("span", { className: "bd-box-inner", "aria-hidden": "true" })] }), _jsx("p", { className: "bd-field-hint", children: t('style.box.hint') }), _jsx("div", { className: "bd-box-editor", children: renderEditor(sides) }, sides.join())] }));
|
|
31
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/panels/inspector/styles/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACvD,YAAY,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { type StylePropertyDef, type Theme } from '@next-buildr/core';
|
|
2
|
+
/** What an author typed, checked against the property's grammar and the theme. */
|
|
3
|
+
export type StyleInput = {
|
|
4
|
+
readonly ok: true;
|
|
5
|
+
readonly value: string | number;
|
|
6
|
+
} | {
|
|
7
|
+
readonly ok: false;
|
|
8
|
+
readonly message: string;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Turns typed text into the value to store: a number when the text is numeric and the grammar takes
|
|
12
|
+
* one, else the text itself. It is accepted only when `parseStyleValue` accepts it and every token
|
|
13
|
+
* in it exists in the theme, so nothing outside the grammar can be dispatched.
|
|
14
|
+
*/
|
|
15
|
+
export declare function checkStyleInput(def: StylePropertyDef, text: string, theme: Theme): StyleInput;
|
|
16
|
+
/** The sides or corners of a shaped property, in the order the editor lays them out. */
|
|
17
|
+
export declare const partsOf: (def: StylePropertyDef) => readonly string[];
|
|
18
|
+
/** The token references (`$space.4`) a property accepts in this theme, for suggestions. */
|
|
19
|
+
export declare function tokenSuggestions(def: StylePropertyDef, theme: Theme): string[];
|
|
20
|
+
/** The keywords a property accepts, for suggestions and for the select of a pure enumeration. */
|
|
21
|
+
export declare function keywordsOf(def: StylePropertyDef): readonly string[];
|
|
22
|
+
/** A property that is only a list of keywords is edited with a select. */
|
|
23
|
+
export declare function isEnumeration(def: StylePropertyDef): boolean;
|
|
24
|
+
/** The layer a breakpoint id edits: desktop is `{}`. */
|
|
25
|
+
export declare const layerFor: (breakpoint: string | undefined) => {
|
|
26
|
+
bp?: never;
|
|
27
|
+
} | {
|
|
28
|
+
bp: string;
|
|
29
|
+
};
|
|
30
|
+
/** The units the property's grammar allows, and nothing else: they are all the unit menu offers. */
|
|
31
|
+
export declare function unitsOf(def: StylePropertyDef): readonly string[];
|
|
32
|
+
/** Whether the grammar takes a bare number (`opacity`, `lineHeight`) rather than only lengths. */
|
|
33
|
+
export declare function takesNumber(def: StylePropertyDef): boolean;
|
|
34
|
+
/** How much an arrow key adds: a fraction where the number is confined to a small range. */
|
|
35
|
+
export declare function stepOf(def: StylePropertyDef): number;
|
|
36
|
+
/** Whether the property is edited as a number (with a unit menu) rather than as free keyword text. */
|
|
37
|
+
export declare function isNumeric(def: StylePropertyDef): boolean;
|
|
38
|
+
export interface TokenEntry {
|
|
39
|
+
readonly ref: string;
|
|
40
|
+
readonly scale: string;
|
|
41
|
+
readonly name: string;
|
|
42
|
+
/** What the token stands for in this theme: a colour, a length, a font stack. */
|
|
43
|
+
readonly value: string;
|
|
44
|
+
}
|
|
45
|
+
/** The tokens a property accepts in this theme, with their values, for the picker. */
|
|
46
|
+
export declare function tokenEntries(def: StylePropertyDef, theme: Theme): TokenEntry[];
|
|
47
|
+
/** The colour a text stands for, to paint a swatch: a token of the theme or a literal colour. */
|
|
48
|
+
export declare function colorOf(def: StylePropertyDef, text: string, theme: Theme): string | undefined;
|
|
49
|
+
/** A number confined to a range of at most one (opacity) is also edited with a slider. */
|
|
50
|
+
export declare function sliderOf(def: StylePropertyDef): {
|
|
51
|
+
readonly min: number;
|
|
52
|
+
readonly max: number;
|
|
53
|
+
readonly step: number;
|
|
54
|
+
} | undefined;
|
|
55
|
+
//# sourceMappingURL=model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../../src/panels/inspector/styles/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,gBAAgB,EACrB,KAAK,KAAK,EACX,MAAM,mBAAmB,CAAC;AAE3B,kFAAkF;AAClF,MAAM,MAAM,UAAU,GAClB;IAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,GACtD;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAKrD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,UAAU,CAmB7F;AAED,wFAAwF;AACxF,eAAO,MAAM,OAAO,QAAS,gBAAgB,KAAG,SAAS,MAAM,EACW,CAAC;AAE3E,2FAA2F;AAC3F,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,gBAAgB,EAAE,KAAK,EAAE,KAAK,GAAG,MAAM,EAAE,CAM9E;AAED,iGAAiG;AACjG,wBAAgB,UAAU,CAAC,GAAG,EAAE,gBAAgB,GAAG,SAAS,MAAM,EAAE,CAGnE;AAED,0EAA0E;AAC1E,wBAAgB,aAAa,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAS5D;AAED,wDAAwD;AACxD,eAAO,MAAM,QAAQ,eAAgB,MAAM,GAAG,SAAS;;;;CACsB,CAAC;AAE9E,oGAAoG;AACpG,wBAAgB,OAAO,CAAC,GAAG,EAAE,gBAAgB,GAAG,SAAS,MAAM,EAAE,CAGhE;AAED,kGAAkG;AAClG,wBAAgB,WAAW,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAG1D;AAED,4FAA4F;AAC5F,wBAAgB,MAAM,CAAC,GAAG,EAAE,gBAAgB,GAAG,MAAM,CAMpD;AAED,sGAAsG;AACtG,wBAAgB,SAAS,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAExD;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,iFAAiF;IACjF,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,sFAAsF;AACtF,wBAAgB,YAAY,CAAC,GAAG,EAAE,gBAAgB,EAAE,KAAK,EAAE,KAAK,GAAG,UAAU,EAAE,CAQ9E;AAED,iGAAiG;AACjG,wBAAgB,OAAO,CAAC,GAAG,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,MAAM,GAAG,SAAS,CAO7F;AAED,0FAA0F;AAC1F,wBAAgB,QAAQ,CACtB,GAAG,EAAE,gBAAgB,GACpB;IAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAMnF"}
|