@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,111 @@
|
|
|
1
|
+
import { BOX_SIDES, CORNERS, parseStyleValue, resolveTokenRef, } from '@next-buildr/core';
|
|
2
|
+
const NUMERIC = /^-?\d+(\.\d+)?$/;
|
|
3
|
+
const TOKEN_IN_TEXT = /\$[A-Za-z]+\.[a-z0-9-]+/g;
|
|
4
|
+
/**
|
|
5
|
+
* Turns typed text into the value to store: a number when the text is numeric and the grammar takes
|
|
6
|
+
* one, else the text itself. It is accepted only when `parseStyleValue` accepts it and every token
|
|
7
|
+
* in it exists in the theme, so nothing outside the grammar can be dispatched.
|
|
8
|
+
*/
|
|
9
|
+
export function checkStyleInput(def, text, theme) {
|
|
10
|
+
const typed = text.trim();
|
|
11
|
+
const candidates = NUMERIC.test(typed) ? [Number(typed), typed] : [typed];
|
|
12
|
+
let message = '';
|
|
13
|
+
for (const candidate of candidates) {
|
|
14
|
+
const parsed = parseStyleValue(def.grammar, candidate, { inheritable: def.inheritable });
|
|
15
|
+
if (!parsed.ok) {
|
|
16
|
+
message ||= parsed.error.message;
|
|
17
|
+
continue;
|
|
18
|
+
}
|
|
19
|
+
for (const token of typeof candidate === 'string'
|
|
20
|
+
? (candidate.match(TOKEN_IN_TEXT) ?? [])
|
|
21
|
+
: []) {
|
|
22
|
+
const known = resolveTokenRef(theme, token);
|
|
23
|
+
if (!known.ok)
|
|
24
|
+
return { ok: false, message: known.error.message };
|
|
25
|
+
}
|
|
26
|
+
return { ok: true, value: candidate };
|
|
27
|
+
}
|
|
28
|
+
return { ok: false, message };
|
|
29
|
+
}
|
|
30
|
+
/** The sides or corners of a shaped property, in the order the editor lays them out. */
|
|
31
|
+
export const partsOf = (def) => def.shape === 'box' ? BOX_SIDES : def.shape === 'corners' ? CORNERS : [];
|
|
32
|
+
/** The token references (`$space.4`) a property accepts in this theme, for suggestions. */
|
|
33
|
+
export function tokenSuggestions(def, theme) {
|
|
34
|
+
const out = [];
|
|
35
|
+
for (const scale of def.tokenScale ?? []) {
|
|
36
|
+
for (const name of Object.keys(theme.tokens[scale]))
|
|
37
|
+
out.push(`$${scale}.${name}`);
|
|
38
|
+
}
|
|
39
|
+
return out;
|
|
40
|
+
}
|
|
41
|
+
/** The keywords a property accepts, for suggestions and for the select of a pure enumeration. */
|
|
42
|
+
export function keywordsOf(def) {
|
|
43
|
+
const grammar = def.grammar;
|
|
44
|
+
return grammar.kind === 'composite' || grammar.kind === 'color' ? (grammar.keywords ?? []) : [];
|
|
45
|
+
}
|
|
46
|
+
/** A property that is only a list of keywords is edited with a select. */
|
|
47
|
+
export function isEnumeration(def) {
|
|
48
|
+
const grammar = def.grammar;
|
|
49
|
+
return (grammar.kind === 'composite' &&
|
|
50
|
+
(grammar.keywords?.length ?? 0) > 0 &&
|
|
51
|
+
grammar.tokens === undefined &&
|
|
52
|
+
grammar.length === undefined &&
|
|
53
|
+
grammar.number === undefined);
|
|
54
|
+
}
|
|
55
|
+
/** The layer a breakpoint id edits: desktop is `{}`. */
|
|
56
|
+
export const layerFor = (breakpoint) => breakpoint === undefined || breakpoint === 'base' ? {} : { bp: breakpoint };
|
|
57
|
+
/** The units the property's grammar allows, and nothing else: they are all the unit menu offers. */
|
|
58
|
+
export function unitsOf(def) {
|
|
59
|
+
const grammar = def.grammar;
|
|
60
|
+
return grammar.kind === 'composite' ? (grammar.length?.units ?? []) : [];
|
|
61
|
+
}
|
|
62
|
+
/** Whether the grammar takes a bare number (`opacity`, `lineHeight`) rather than only lengths. */
|
|
63
|
+
export function takesNumber(def) {
|
|
64
|
+
const grammar = def.grammar;
|
|
65
|
+
return grammar.kind === 'composite' && grammar.number !== undefined;
|
|
66
|
+
}
|
|
67
|
+
/** How much an arrow key adds: a fraction where the number is confined to a small range. */
|
|
68
|
+
export function stepOf(def) {
|
|
69
|
+
const grammar = def.grammar;
|
|
70
|
+
if (grammar.kind !== 'composite' || grammar.number === undefined)
|
|
71
|
+
return 1;
|
|
72
|
+
if (grammar.length !== undefined)
|
|
73
|
+
return 1;
|
|
74
|
+
if (grammar.number.integer === true && grammar.number.min >= 100)
|
|
75
|
+
return 100;
|
|
76
|
+
return grammar.number.max - grammar.number.min <= 10 && grammar.number.integer !== true ? 0.1 : 1;
|
|
77
|
+
}
|
|
78
|
+
/** Whether the property is edited as a number (with a unit menu) rather than as free keyword text. */
|
|
79
|
+
export function isNumeric(def) {
|
|
80
|
+
return unitsOf(def).length > 0 || takesNumber(def);
|
|
81
|
+
}
|
|
82
|
+
/** The tokens a property accepts in this theme, with their values, for the picker. */
|
|
83
|
+
export function tokenEntries(def, theme) {
|
|
84
|
+
const out = [];
|
|
85
|
+
for (const scale of def.tokenScale ?? []) {
|
|
86
|
+
for (const [name, value] of Object.entries(theme.tokens[scale])) {
|
|
87
|
+
out.push({ ref: `$${scale}.${name}`, scale, name, value: String(value) });
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return out;
|
|
91
|
+
}
|
|
92
|
+
/** The colour a text stands for, to paint a swatch: a token of the theme or a literal colour. */
|
|
93
|
+
export function colorOf(def, text, theme) {
|
|
94
|
+
if (def.grammar.kind !== 'color')
|
|
95
|
+
return undefined;
|
|
96
|
+
if (text.startsWith('$')) {
|
|
97
|
+
const known = resolveTokenRef(theme, text);
|
|
98
|
+
return known.ok && known.value.scale === 'color' ? known.value.value : undefined;
|
|
99
|
+
}
|
|
100
|
+
return text;
|
|
101
|
+
}
|
|
102
|
+
/** A number confined to a range of at most one (opacity) is also edited with a slider. */
|
|
103
|
+
export function sliderOf(def) {
|
|
104
|
+
const grammar = def.grammar;
|
|
105
|
+
if (grammar.kind !== 'composite' || grammar.number === undefined)
|
|
106
|
+
return undefined;
|
|
107
|
+
if (grammar.length !== undefined)
|
|
108
|
+
return undefined;
|
|
109
|
+
const { min, max } = grammar.number;
|
|
110
|
+
return max - min <= 1 ? { min, max, step: 0.01 } : undefined;
|
|
111
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { IconName } from '../../../ui/index.ts';
|
|
2
|
+
/** One segment: an icon (its name and tooltip are the keyword) or, without an icon, the keyword as text. */
|
|
3
|
+
export interface Segment {
|
|
4
|
+
readonly keyword: string;
|
|
5
|
+
readonly icon?: IconName;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* The properties edited with a row of segments, and the keyword each segment stands for. A
|
|
9
|
+
* keyword of the grammar that has no segment stays reachable through the "other" menu next to
|
|
10
|
+
* the row, so nothing the grammar allows becomes unreachable.
|
|
11
|
+
*/
|
|
12
|
+
export declare const SEGMENTED: Readonly<Record<string, readonly Segment[]>>;
|
|
13
|
+
/**
|
|
14
|
+
* Properties that sit side by side in one row (two columns) instead of one under the other, per
|
|
15
|
+
* group. A pair is only drawn when the component allows both; a missing one is skipped.
|
|
16
|
+
*/
|
|
17
|
+
export declare const PAIRS: Readonly<Record<string, readonly (readonly [string, string])[]>>;
|
|
18
|
+
//# sourceMappingURL=segments.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"segments.d.ts","sourceRoot":"","sources":["../../../../src/panels/inspector/styles/segments.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAErD,4GAA4G;AAC5G,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC;CAC1B;AAED;;;;GAIG;AACH,eAAO,MAAM,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,OAAO,EAAE,CAAC,CAgDlE,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAgBlF,CAAC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The properties edited with a row of segments, and the keyword each segment stands for. A
|
|
3
|
+
* keyword of the grammar that has no segment stays reachable through the "other" menu next to
|
|
4
|
+
* the row, so nothing the grammar allows becomes unreachable.
|
|
5
|
+
*/
|
|
6
|
+
export const SEGMENTED = {
|
|
7
|
+
'layout.display': [
|
|
8
|
+
{ keyword: 'block' },
|
|
9
|
+
{ keyword: 'flex' },
|
|
10
|
+
{ keyword: 'grid' },
|
|
11
|
+
{ keyword: 'none' },
|
|
12
|
+
],
|
|
13
|
+
'layout.direction': [
|
|
14
|
+
{ keyword: 'row', icon: 'arrow-right' },
|
|
15
|
+
{ keyword: 'column', icon: 'arrow-down' },
|
|
16
|
+
{ keyword: 'row-reverse', icon: 'arrow-left' },
|
|
17
|
+
{ keyword: 'column-reverse', icon: 'arrow-up' },
|
|
18
|
+
],
|
|
19
|
+
'layout.wrap': [{ keyword: 'nowrap' }, { keyword: 'wrap' }],
|
|
20
|
+
'layout.align': [
|
|
21
|
+
{ keyword: 'flex-start', icon: 'align-start-vertical' },
|
|
22
|
+
{ keyword: 'center', icon: 'align-center-vertical' },
|
|
23
|
+
{ keyword: 'flex-end', icon: 'align-end-vertical' },
|
|
24
|
+
{ keyword: 'stretch', icon: 'stretch-vertical' },
|
|
25
|
+
],
|
|
26
|
+
'layout.justify': [
|
|
27
|
+
{ keyword: 'flex-start', icon: 'align-horizontal-justify-start' },
|
|
28
|
+
{ keyword: 'center', icon: 'align-horizontal-justify-center' },
|
|
29
|
+
{ keyword: 'flex-end', icon: 'align-horizontal-justify-end' },
|
|
30
|
+
{ keyword: 'space-between', icon: 'align-horizontal-space-between' },
|
|
31
|
+
{ keyword: 'space-around', icon: 'align-horizontal-space-around' },
|
|
32
|
+
],
|
|
33
|
+
'typography.textAlign': [
|
|
34
|
+
{ keyword: 'left', icon: 'text-align-start' },
|
|
35
|
+
{ keyword: 'center', icon: 'text-align-center' },
|
|
36
|
+
{ keyword: 'right', icon: 'text-align-end' },
|
|
37
|
+
{ keyword: 'justify', icon: 'text-align-justify' },
|
|
38
|
+
],
|
|
39
|
+
'typography.textTransform': [
|
|
40
|
+
{ keyword: 'none', icon: 'ban' },
|
|
41
|
+
{ keyword: 'uppercase', icon: 'case-upper' },
|
|
42
|
+
{ keyword: 'lowercase', icon: 'case-lower' },
|
|
43
|
+
{ keyword: 'capitalize', icon: 'case-sensitive' },
|
|
44
|
+
],
|
|
45
|
+
'typography.fontStyle': [
|
|
46
|
+
{ keyword: 'normal', icon: 'type' },
|
|
47
|
+
{ keyword: 'italic', icon: 'italic' },
|
|
48
|
+
],
|
|
49
|
+
'typography.textDecoration': [
|
|
50
|
+
{ keyword: 'none', icon: 'ban' },
|
|
51
|
+
{ keyword: 'underline', icon: 'underline' },
|
|
52
|
+
{ keyword: 'line-through', icon: 'strikethrough' },
|
|
53
|
+
],
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Properties that sit side by side in one row (two columns) instead of one under the other, per
|
|
57
|
+
* group. A pair is only drawn when the component allows both; a missing one is skipped.
|
|
58
|
+
*/
|
|
59
|
+
export const PAIRS = {
|
|
60
|
+
layout: [
|
|
61
|
+
['rowGap', 'columnGap'],
|
|
62
|
+
['columns', 'rows'],
|
|
63
|
+
['order', 'zIndex'],
|
|
64
|
+
],
|
|
65
|
+
size: [
|
|
66
|
+
['width', 'height'],
|
|
67
|
+
['minWidth', 'minHeight'],
|
|
68
|
+
['maxWidth', 'maxHeight'],
|
|
69
|
+
],
|
|
70
|
+
typography: [
|
|
71
|
+
['fontSize', 'fontWeight'],
|
|
72
|
+
['lineHeight', 'letterSpacing'],
|
|
73
|
+
],
|
|
74
|
+
background: [['imagePosition', 'imageSize']],
|
|
75
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { EffectiveStyles, StylePropertyDef, Theme } from '@next-buildr/core';
|
|
2
|
+
import { type ReactNode } from 'react';
|
|
3
|
+
/** One write of a run: a value for a part, or `undefined` to remove that part's value. */
|
|
4
|
+
export interface SideWrite {
|
|
5
|
+
readonly part: string;
|
|
6
|
+
readonly value: string | number | undefined;
|
|
7
|
+
}
|
|
8
|
+
export interface SidesEditorProps {
|
|
9
|
+
readonly def: StylePropertyDef;
|
|
10
|
+
/** The visible name of the property (`Margin`). */
|
|
11
|
+
readonly label: string;
|
|
12
|
+
/** The sides or corners, in the order they are laid out. */
|
|
13
|
+
readonly parts: readonly string[];
|
|
14
|
+
readonly effective: EffectiveStyles;
|
|
15
|
+
readonly layer: string;
|
|
16
|
+
readonly theme: Theme;
|
|
17
|
+
readonly disabled: boolean;
|
|
18
|
+
/** `row`: the fields in a row with labels; `ring`: the fields around a box, which holds `children`. */
|
|
19
|
+
readonly layout: 'row' | 'ring';
|
|
20
|
+
/** Runs several writes as one undo step. */
|
|
21
|
+
readonly apply: (writes: readonly SideWrite[]) => void;
|
|
22
|
+
/** Draws the header of the property; what is passed goes before its origin dot and reset button. */
|
|
23
|
+
readonly renderHead: (extras: ReactNode) => ReactNode;
|
|
24
|
+
readonly children?: ReactNode;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The visual editor of a property that has one value per side or corner (margin, padding, inset,
|
|
28
|
+
* border width, radius). Every side is a field of its own; a link button makes the fields move
|
|
29
|
+
* together (the default while they are equal), one menu picks the unit for all of them, and the
|
|
30
|
+
* token picker fills the linked sides or the one last focused. The `ring` layout draws the fields
|
|
31
|
+
* around a box, so margin and padding can be nested the way the page shows them.
|
|
32
|
+
*/
|
|
33
|
+
export declare function SidesEditor(props: SidesEditorProps): import("react").JSX.Element;
|
|
34
|
+
//# sourceMappingURL=sides-editor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sides-editor.d.ts","sourceRoot":"","sources":["../../../../src/panels/inspector/styles/sides-editor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAClF,OAAO,EAAE,KAAK,SAAS,EAAuB,MAAM,OAAO,CAAC;AAO5D,0FAA0F;AAC1F,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;CAC7C;AA8DD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,GAAG,EAAE,gBAAgB,CAAC;IAC/B,mDAAmD;IACnD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,4DAA4D;IAC5D,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,SAAS,EAAE,eAAe,CAAC;IACpC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,uGAAuG;IACvG,QAAQ,CAAC,MAAM,EAAE,KAAK,GAAG,MAAM,CAAC;IAChC,4CAA4C;IAC5C,QAAQ,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,SAAS,SAAS,EAAE,KAAK,IAAI,CAAC;IACvD,oGAAoG;IACpG,QAAQ,CAAC,UAAU,EAAE,CAAC,MAAM,EAAE,SAAS,KAAK,SAAS,CAAC;IACtD,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC;CAC/B;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,+BAmJlD"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
import { useT } from '../../../messages/index.js';
|
|
4
|
+
import { IconButton, NumberUnitInput } from '../../../ui/index.js';
|
|
5
|
+
import { unitsOf } from './model.js';
|
|
6
|
+
import { TokenPicker } from './token-picker.js';
|
|
7
|
+
import { useStyleValue } from './use-style-value.js';
|
|
8
|
+
const NUMBER_UNIT = /^(-?(?:\d+\.?\d*|\.\d+))([a-z%]*)$/;
|
|
9
|
+
const pathOf = (def, part) => `${def.group}.${def.name}.${part}`;
|
|
10
|
+
/** One side or corner: a small field holding the number; the unit is the row's. */
|
|
11
|
+
function SideField(props) {
|
|
12
|
+
const { def, part, label, onError } = props;
|
|
13
|
+
const path = pathOf(def, part);
|
|
14
|
+
const field = useStyleValue({
|
|
15
|
+
def,
|
|
16
|
+
path,
|
|
17
|
+
effective: props.effective,
|
|
18
|
+
layer: props.layer,
|
|
19
|
+
theme: props.theme,
|
|
20
|
+
onSet: (value) => props.write(part, value),
|
|
21
|
+
onUnset: () => props.clear(part),
|
|
22
|
+
});
|
|
23
|
+
const { error } = field;
|
|
24
|
+
useEffect(() => onError(part, error), [error, part, onError]);
|
|
25
|
+
return (_jsx("div", { className: "bd-side-field", "data-path": path, "data-part": part, "data-source": field.current?.source ?? 'none', children: _jsx(NumberUnitInput, { compact: true, hideUnitMenu: true, value: field.shown, units: unitsOf(def), unit: props.unit, unitLabel: "", ariaLabel: label, disabled: props.disabled, invalid: error !== '', placeholder: "\u2013", onValueChange: field.change, onFocus: props.onFocus, onBlur: field.blur }) }));
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The visual editor of a property that has one value per side or corner (margin, padding, inset,
|
|
29
|
+
* border width, radius). Every side is a field of its own; a link button makes the fields move
|
|
30
|
+
* together (the default while they are equal), one menu picks the unit for all of them, and the
|
|
31
|
+
* token picker fills the linked sides or the one last focused. The `ring` layout draws the fields
|
|
32
|
+
* around a box, so margin and padding can be nested the way the page shows them.
|
|
33
|
+
*/
|
|
34
|
+
export function SidesEditor(props) {
|
|
35
|
+
const t = useT();
|
|
36
|
+
const { def, label, parts, effective, layer, layout } = props;
|
|
37
|
+
const units = unitsOf(def);
|
|
38
|
+
const currentOf = (part) => {
|
|
39
|
+
const entry = effective[pathOf(def, part)];
|
|
40
|
+
return entry === undefined ? undefined : String(entry.value);
|
|
41
|
+
};
|
|
42
|
+
const setHere = (part) => effective[pathOf(def, part)]?.source === layer;
|
|
43
|
+
const values = parts.map(currentOf);
|
|
44
|
+
const [linked, setLinked] = useState(() => values.every((value) => value === values[0]));
|
|
45
|
+
const [focused, setFocused] = useState(parts[0]);
|
|
46
|
+
const [chosenUnit, setChosenUnit] = useState(undefined);
|
|
47
|
+
const [errors, setErrors] = useState({});
|
|
48
|
+
// The unit the row shows: the one picked, else the unit of the first value that has one.
|
|
49
|
+
const inValues = values
|
|
50
|
+
.map((value) => (value === undefined ? undefined : NUMBER_UNIT.exec(value)?.[2]))
|
|
51
|
+
.find((unit) => unit !== undefined && units.includes(unit));
|
|
52
|
+
const unit = chosenUnit ?? inValues ?? units[0] ?? '';
|
|
53
|
+
const targets = (part) => (linked ? parts : [part]);
|
|
54
|
+
const write = (part, value) => props.apply(targets(part).map((target) => ({ part: target, value })));
|
|
55
|
+
const clear = (part) => {
|
|
56
|
+
const writes = targets(part)
|
|
57
|
+
.filter(setHere)
|
|
58
|
+
.map((target) => ({ part: target, value: undefined }));
|
|
59
|
+
if (writes.length > 0)
|
|
60
|
+
props.apply(writes);
|
|
61
|
+
};
|
|
62
|
+
const changeUnit = (next) => {
|
|
63
|
+
setChosenUnit(next);
|
|
64
|
+
const writes = [];
|
|
65
|
+
for (const part of parts) {
|
|
66
|
+
const match = setHere(part) ? NUMBER_UNIT.exec(currentOf(part) ?? '') : null;
|
|
67
|
+
if (match !== null)
|
|
68
|
+
writes.push({ part, value: `${match[1]}${next}` });
|
|
69
|
+
}
|
|
70
|
+
if (writes.length > 0)
|
|
71
|
+
props.apply(writes);
|
|
72
|
+
};
|
|
73
|
+
const reportError = (part, message) => setErrors((current) => (current[part] ?? '') === message ? current : { ...current, [part]: message });
|
|
74
|
+
const error = parts.map((part) => errors[part]).find((message) => (message ?? '') !== '');
|
|
75
|
+
const partLabel = (part) => def.shape === 'corners'
|
|
76
|
+
? t(`style.corner.${part}`)
|
|
77
|
+
: t(`style.side.${part}`);
|
|
78
|
+
const extras = (_jsxs(_Fragment, { children: [_jsx(IconButton, { icon: linked ? 'link-2' : 'unlink-2', className: "bd-sides-link", label: `${label}: ${t(def.shape === 'corners' ? 'style.link.corners' : 'style.link.sides')}`, "aria-pressed": linked, disabled: props.disabled, onClick: () => setLinked(!linked) }), units.length > 0 ? (_jsx("select", { className: "bd-unit-select", "aria-label": `${t('style.unit')}: ${label}`, value: unit, disabled: props.disabled, onChange: (event) => changeUnit(event.target.value), children: units.map((entry) => (_jsx("option", { value: entry, children: entry }, entry))) })) : null, _jsx(TokenPicker, { def: def, theme: props.theme, label: label, current: currentOf(focused), disabled: props.disabled, onPick: (ref) => write(focused, ref) })] }));
|
|
79
|
+
const field = (part) => (_jsx(SideField, { def: def, part: part, label: `${label} ${partLabel(part)}`, effective: effective, layer: layer, theme: props.theme, disabled: props.disabled, unit: unit, onFocus: () => setFocused(part), onError: reportError, write: write, clear: clear }, part));
|
|
80
|
+
const errorLine = error === undefined ? null : (_jsx("p", { role: "alert", className: "bd-style-error", children: error }));
|
|
81
|
+
if (layout === 'ring') {
|
|
82
|
+
const [top, right, bottom, left] = parts;
|
|
83
|
+
return (_jsxs("div", { className: "bd-ring", "data-property": def.name, children: [props.renderHead(extras), _jsxs("div", { className: "bd-ring-grid", children: [_jsx("div", { className: "bd-ring-top", children: field(top) }), _jsx("div", { className: "bd-ring-left", children: field(left) }), _jsx("div", { className: "bd-ring-center", children: props.children ?? _jsx("span", { className: "bd-ring-core", children: t('style.box.content') }) }), _jsx("div", { className: "bd-ring-right", children: field(right) }), _jsx("div", { className: "bd-ring-bottom", children: field(bottom) })] }), errorLine] }));
|
|
84
|
+
}
|
|
85
|
+
return (_jsxs("div", { className: "bd-sides", "data-property": def.name, "data-shape": def.shape, children: [props.renderHead(extras), _jsx("div", { className: "bd-sides-grid", children: parts.map((part) => (_jsxs("div", { className: "bd-sides-cell", children: [field(part), _jsx("span", { className: "bd-sides-label", "aria-hidden": "true", children: partLabel(part) })] }, part))) }), errorLine] }));
|
|
86
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type PageNode, type Theme } from '@next-buildr/core';
|
|
2
|
+
export interface StyleInspectorProps {
|
|
3
|
+
readonly node: PageNode;
|
|
4
|
+
/** The breakpoint being edited: `'base'` (desktop, the default) or a breakpoint id of the theme. */
|
|
5
|
+
readonly breakpoint?: string;
|
|
6
|
+
readonly theme?: Theme;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The Style tab (docs/editor.md#the-style-inspector): the style groups the component allows, each
|
|
10
|
+
* property edited at the breakpoint being edited. Text is checked with the property's grammar and
|
|
11
|
+
* the theme before anything is dispatched, so a value outside the grammar cannot be written; a value
|
|
12
|
+
* that comes from a wider breakpoint is shown as such, and "Reset" removes only this layer's key.
|
|
13
|
+
*/
|
|
14
|
+
export declare function StyleInspector({ node, breakpoint, theme }: StyleInspectorProps): import("react").JSX.Element;
|
|
15
|
+
//# sourceMappingURL=style-inspector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style-inspector.d.ts","sourceRoot":"","sources":["../../../../src/panels/inspector/styles/style-inspector.tsx"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,QAAQ,EAKb,KAAK,KAAK,EACX,MAAM,mBAAmB,CAAC;AA8B3B,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,oGAAoG;IACpG,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC;CACxB;AAyYD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,KAAoB,EAAE,EAAE,mBAAmB,+BAyC7F"}
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { canEdit, createIndex, defaultTheme, effectiveStyles, getStyleProperty, propertiesOfGroup, STYLE_GROUPS, } from '@next-buildr/core';
|
|
3
|
+
import { useId, useState } from 'react';
|
|
4
|
+
import { componentMeta, useManifest } from '../../../app/manifest.js';
|
|
5
|
+
import { useT } from '../../../messages/index.js';
|
|
6
|
+
import { useEditor, useEditorState } from '../../../store/index.js';
|
|
7
|
+
import { ColorInput, IconButton, Input, NumberUnitInput, SegmentedControl, Tooltip, } from '../../../ui/index.js';
|
|
8
|
+
import { colorOf, isEnumeration, isNumeric, keywordsOf, layerFor, partsOf, sliderOf, stepOf, takesNumber, unitsOf, } from './model.js';
|
|
9
|
+
import { PAIRS, SEGMENTED } from './segments.js';
|
|
10
|
+
import { SidesEditor } from './sides-editor.js';
|
|
11
|
+
import { TokenPicker } from './token-picker.js';
|
|
12
|
+
import { useStyleValue } from './use-style-value.js';
|
|
13
|
+
const pathOf = (def, part) => `${def.group}.${def.name}${part !== undefined ? `.${part}` : ''}`;
|
|
14
|
+
const humanize = (name) => name
|
|
15
|
+
.replace(/([a-z0-9])([A-Z])/g, '$1 $2')
|
|
16
|
+
.toLowerCase()
|
|
17
|
+
.replace(/^./, (c) => c.toUpperCase());
|
|
18
|
+
/** The dot beside a property: set on this breakpoint, inherited from a wider one, or the default. */
|
|
19
|
+
function SourceDot(props) {
|
|
20
|
+
const t = useT();
|
|
21
|
+
const text = props.origin === 'set'
|
|
22
|
+
? t('style.origin.set')
|
|
23
|
+
: props.origin === 'inherited'
|
|
24
|
+
? `${t('style.origin.inherited')} ${props.from ?? ''}`.trim()
|
|
25
|
+
: t('style.origin.default');
|
|
26
|
+
return (_jsx(Tooltip, { content: text, children: _jsx("span", { className: "bd-source-dot", "data-origin": props.origin, role: "img", "aria-label": text }) }));
|
|
27
|
+
}
|
|
28
|
+
/** One field for a single value (a whole property). */
|
|
29
|
+
function ValueField(props) {
|
|
30
|
+
const t = useT();
|
|
31
|
+
const ownId = useId();
|
|
32
|
+
const id = props.inputId ?? ownId;
|
|
33
|
+
const { def, path } = props;
|
|
34
|
+
const field = useStyleValue({
|
|
35
|
+
def,
|
|
36
|
+
path,
|
|
37
|
+
effective: props.effective,
|
|
38
|
+
layer: props.layer,
|
|
39
|
+
theme: props.theme,
|
|
40
|
+
onSet: props.onSet,
|
|
41
|
+
onUnset: props.onUnset,
|
|
42
|
+
});
|
|
43
|
+
const { current, shown, error } = field;
|
|
44
|
+
const ariaLabel = props.hideLabel === true && props.inputId === undefined ? props.label : undefined;
|
|
45
|
+
const describedBy = error !== '' ? `${id}-error` : undefined;
|
|
46
|
+
const listId = props.keywords.length > 0 ? `${id}-list` : undefined;
|
|
47
|
+
const swatch = colorOf(def, shown.trim(), props.theme);
|
|
48
|
+
const slider = sliderOf(def);
|
|
49
|
+
return (_jsxs("div", { className: "bd-style-value", "data-path": path, "data-source": current?.source ?? 'none', children: [props.hideLabel === true ? null : (_jsx("label", { htmlFor: id, className: "bd-field-label", children: props.label })), _jsxs("div", { className: "bd-style-input", children: [def.grammar.kind === 'color' ? (_jsx(ColorInput, { color: swatch, label: `${props.label}: ${t('style.colorPicker')}`, disabled: props.disabled, onColorChange: field.change })) : null, isNumeric(def) ? (_jsx(NumberUnitInput, { id: id, value: shown, units: unitsOf(def), unitLabel: `${t('style.unit')}: ${props.label}`, step: stepOf(def), bareNumber: takesNumber(def), disabled: props.disabled, invalid: error !== '', describedBy: describedBy, ariaLabel: ariaLabel, list: listId, onValueChange: field.change, onBlur: field.blur })) : (_jsx(Input, { id: id, value: shown, disabled: props.disabled, list: listId, "aria-invalid": error !== '', "aria-describedby": describedBy, "aria-label": ariaLabel, autoComplete: "off", spellCheck: false, onChange: (event) => field.change(event.target.value), onBlur: field.blur })), _jsx(TokenPicker, { def: def, theme: props.theme, label: props.label, current: current !== undefined ? String(current.value) : undefined, disabled: props.disabled, onPick: field.pick })] }), slider !== undefined ? (_jsx("input", { type: "range", className: "bd-range", "aria-label": `${props.label}: ${t('style.slider')}`, min: slider.min, max: slider.max, step: slider.step, value: Number.isFinite(Number(field.stored)) && field.stored !== ''
|
|
50
|
+
? Number(field.stored)
|
|
51
|
+
: slider.max, disabled: props.disabled, onChange: (event) => field.change(event.target.value) })) : null, listId !== undefined ? (_jsx("datalist", { id: listId, children: props.keywords.map((keyword) => (_jsx("option", { value: keyword }, keyword))) })) : null, field.inherited && current !== undefined ? (_jsx("span", { className: "bd-style-source", children: `${t('style.from')} ${current.source === 'base' ? t('style.desktop') : current.source}` })) : null, error !== '' ? (_jsx("p", { id: `${id}-error`, role: "alert", className: "bd-style-error", children: error })) : null] }));
|
|
52
|
+
}
|
|
53
|
+
function StyleProperty(props) {
|
|
54
|
+
const t = useT();
|
|
55
|
+
const store = useEditor();
|
|
56
|
+
const { def, nodeId, effective, layer } = props;
|
|
57
|
+
const id = useId();
|
|
58
|
+
const label = def.group === 'border' && def.name === 'width' ? 'Border' : humanize(def.name);
|
|
59
|
+
const parts = partsOf(def);
|
|
60
|
+
const layerObject = layerFor(layer);
|
|
61
|
+
const setOne = (value, part) => store.dispatch({
|
|
62
|
+
type: 'node.setStyle',
|
|
63
|
+
payload: {
|
|
64
|
+
id: nodeId,
|
|
65
|
+
layer: layerObject,
|
|
66
|
+
group: def.group,
|
|
67
|
+
property: def.name,
|
|
68
|
+
...(part !== undefined ? { side: part } : {}),
|
|
69
|
+
value,
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
const unsetOne = (part) => store.dispatch({
|
|
73
|
+
type: 'node.unsetStyle',
|
|
74
|
+
payload: {
|
|
75
|
+
id: nodeId,
|
|
76
|
+
layer: layerObject,
|
|
77
|
+
group: def.group,
|
|
78
|
+
property: def.name,
|
|
79
|
+
...(part !== undefined ? { side: part } : {}),
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
const report = (result) => props.onError(result.ok ? '' : (result.error?.message ?? ''));
|
|
83
|
+
/** Several sides at once (linked sides) are one undo step. */
|
|
84
|
+
const apply = (writes) => {
|
|
85
|
+
const run = (write) => write.value === undefined ? unsetOne(write.part) : setOne(write.value, write.part);
|
|
86
|
+
if (writes.length === 1)
|
|
87
|
+
return report(run(writes[0]));
|
|
88
|
+
let failure = '';
|
|
89
|
+
store.transaction(label, () => {
|
|
90
|
+
for (const write of writes) {
|
|
91
|
+
const result = run(write);
|
|
92
|
+
if (!result.ok)
|
|
93
|
+
failure ||= result.error?.message ?? '';
|
|
94
|
+
}
|
|
95
|
+
return failure === '';
|
|
96
|
+
});
|
|
97
|
+
props.onError(failure);
|
|
98
|
+
};
|
|
99
|
+
const set = (value, part) => report(setOne(value, part));
|
|
100
|
+
const unset = (part) => report(unsetOne(part));
|
|
101
|
+
const paths = parts.length > 0 ? parts.map((part) => pathOf(def, part)) : [pathOf(def)];
|
|
102
|
+
const here = paths.some((path) => effective[path]?.source === layer);
|
|
103
|
+
const known = paths.map((path) => effective[path]).filter((entry) => entry !== undefined);
|
|
104
|
+
const origin = here ? 'set' : known.length > 0 ? 'inherited' : 'default';
|
|
105
|
+
const from = known[0]?.source === 'base' ? t('style.desktop') : known[0]?.source;
|
|
106
|
+
const base = { def, effective, layer, theme: props.theme, disabled: props.disabled };
|
|
107
|
+
const keywords = keywordsOf(def);
|
|
108
|
+
const key = pathOf(def);
|
|
109
|
+
const head = (control, extras) => (_jsxs("div", { className: "bd-style-head", children: [control, extras, _jsx(SourceDot, { origin: origin, from: from }), here ? (_jsx(IconButton, { icon: "rotate-ccw", className: "bd-field-reset", disabled: props.disabled, label: `${t('inspector.reset')}: ${label}`, onClick: () => parts.length > 0
|
|
110
|
+
? apply(parts
|
|
111
|
+
.filter((part) => effective[pathOf(def, part)]?.source === layer)
|
|
112
|
+
.map((part) => ({ part, value: undefined })))
|
|
113
|
+
: unset() })) : null] }));
|
|
114
|
+
if (def.grammar.kind === 'boolean') {
|
|
115
|
+
const value = effective[key];
|
|
116
|
+
return (_jsx("div", { className: "bd-field bd-style-field", "data-style-prop": key, "data-origin": origin, children: head(_jsxs("label", { className: "bd-style-check", children: [_jsx("input", { type: "checkbox", checked: value?.value === true, disabled: props.disabled, onChange: (event) => (event.target.checked ? set(true) : unset()) }), label] })) }));
|
|
117
|
+
}
|
|
118
|
+
if (parts.length > 0) {
|
|
119
|
+
return (_jsx("div", { className: props.ring === true ? 'bd-style-field bd-style-ring' : 'bd-field bd-style-field', "data-style-prop": key, "data-origin": origin, children: _jsx(SidesEditor, { ...base, label: label, parts: parts, layout: props.ring === true ? 'ring' : 'row', apply: apply, renderHead: (extras) => head(_jsx("span", { className: "bd-field-label", children: label }), extras), children: props.children }) }));
|
|
120
|
+
}
|
|
121
|
+
let title = _jsx("span", { className: "bd-field-label", children: label });
|
|
122
|
+
let body;
|
|
123
|
+
if (isEnumeration(def)) {
|
|
124
|
+
const current = effective[key];
|
|
125
|
+
const segments = SEGMENTED[key]?.filter((segment) => keywords.includes(segment.keyword));
|
|
126
|
+
const currentText = current !== undefined ? String(current.value) : undefined;
|
|
127
|
+
const currentLabel = current !== undefined
|
|
128
|
+
? `${String(current.value)} (${current.source === 'base' ? t('style.desktop') : current.source})`
|
|
129
|
+
: '—';
|
|
130
|
+
const remaining = segments === undefined
|
|
131
|
+
? keywords
|
|
132
|
+
: keywords.filter((keyword) => !segments.some((segment) => segment.keyword === keyword));
|
|
133
|
+
body = (_jsxs("div", { className: "bd-style-enum", "data-segmented": segments !== undefined ? '' : undefined, children: [segments !== undefined ? (_jsx(SegmentedControl, { label: label, value: currentText, disabled: props.disabled, options: segments.map((segment) => ({
|
|
134
|
+
value: segment.keyword,
|
|
135
|
+
label: segment.keyword,
|
|
136
|
+
...(segment.icon !== undefined ? { icon: segment.icon } : {}),
|
|
137
|
+
iconOnly: segment.icon !== undefined,
|
|
138
|
+
})), onValueChange: (keyword) => current?.source === layer && currentText === keyword ? unset() : set(keyword) })) : null, remaining.length > 0 ? (_jsxs("select", { id: id, className: "bd-input", "aria-label": segments !== undefined ? `${label}: ${t('style.more')}` : undefined, value: current?.source === layer && remaining.includes(String(current.value))
|
|
139
|
+
? String(current.value)
|
|
140
|
+
: '', disabled: props.disabled, onChange: (event) => (event.target.value === '' ? unset() : set(event.target.value)), children: [_jsx("option", { value: "", children: segments !== undefined ? '—' : currentLabel }), remaining.map((keyword) => (_jsx("option", { value: keyword, children: keyword }, keyword)))] })) : null] }));
|
|
141
|
+
if (segments === undefined) {
|
|
142
|
+
title = (_jsx("label", { htmlFor: id, className: "bd-field-label", children: label }));
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
title = (_jsx("label", { htmlFor: id, className: "bd-field-label", children: label }));
|
|
147
|
+
body = (_jsx(ValueField, { ...base, keywords: keywords, inputId: id, path: pathOf(def), label: label, hideLabel: true, onSet: (value) => set(value), onUnset: () => unset() }));
|
|
148
|
+
}
|
|
149
|
+
return (_jsxs("div", { className: `bd-field bd-style-field${props.inline === true ? ' bd-style-inline' : ''}`, "data-style-prop": key, "data-origin": origin, children: [head(title), body] }));
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* The Style tab (docs/editor.md#the-style-inspector): the style groups the component allows, each
|
|
153
|
+
* property edited at the breakpoint being edited. Text is checked with the property's grammar and
|
|
154
|
+
* the theme before anything is dispatched, so a value outside the grammar cannot be written; a value
|
|
155
|
+
* that comes from a wider breakpoint is shown as such, and "Reset" removes only this layer's key.
|
|
156
|
+
*/
|
|
157
|
+
export function StyleInspector({ node, breakpoint, theme = defaultTheme }) {
|
|
158
|
+
const t = useT();
|
|
159
|
+
const manifest = useManifest();
|
|
160
|
+
const doc = useEditorState((state) => state.doc);
|
|
161
|
+
const readOnly = useEditorState((state) => state.readOnly);
|
|
162
|
+
const [notice, setNotice] = useState('');
|
|
163
|
+
const layer = breakpoint ?? 'base';
|
|
164
|
+
const meta = componentMeta(manifest, node.type);
|
|
165
|
+
const disabled = readOnly || !canEdit(doc, createIndex(doc), node.id, 'style').ok;
|
|
166
|
+
const effective = effectiveStyles(node.styles ?? {}, layer, theme.breakpoints);
|
|
167
|
+
const groups = STYLE_GROUPS.filter((group) => meta?.styles.groups.includes(group));
|
|
168
|
+
if (groups.length === 0) {
|
|
169
|
+
return _jsx("p", { className: "bd-inspector-empty", children: t('style.none') });
|
|
170
|
+
}
|
|
171
|
+
const knownLayer = layer === 'base' || theme.breakpoints.some((b) => b.id === layer);
|
|
172
|
+
return (_jsxs("div", { className: "bd-styles", "data-layer": layer, children: [_jsx("p", { className: "bd-styles-layer", children: `${t('style.editing')}: ${layer === 'base' ? t('style.desktop') : layer}` }), !knownLayer ? _jsx("p", { className: "bd-style-error", children: t('style.unknownBreakpoint') }) : null, groups.map((group) => (_jsx(StyleGroupSection, { group: group, nodeId: node.id, effective: effective, layer: layer, theme: theme, disabled: disabled || !knownLayer, onError: setNotice, boxBorder: groups.includes('spacing') && groups.includes('border') }, group))), _jsx("div", { role: "status", className: "bd-inspector-notice", children: notice })] }));
|
|
173
|
+
}
|
|
174
|
+
function StyleGroupSection(props) {
|
|
175
|
+
const t = useT();
|
|
176
|
+
const borderWidth = getStyleProperty('border', 'width');
|
|
177
|
+
const inBox = props.boxBorder && borderWidth !== undefined;
|
|
178
|
+
const defs = propertiesOfGroup(props.group).filter((def) => getStyleProperty(def.group, def.name) !== undefined &&
|
|
179
|
+
!(inBox && def.group === 'border' && def.name === 'width'));
|
|
180
|
+
const used = Object.keys(props.effective).some((path) => path.startsWith(`${props.group}.`));
|
|
181
|
+
const byName = new Map(defs.map((def) => [def.name, def]));
|
|
182
|
+
const common = {
|
|
183
|
+
nodeId: props.nodeId,
|
|
184
|
+
effective: props.effective,
|
|
185
|
+
layer: props.layer,
|
|
186
|
+
theme: props.theme,
|
|
187
|
+
disabled: props.disabled,
|
|
188
|
+
onError: props.onError,
|
|
189
|
+
};
|
|
190
|
+
// Margin wraps padding as a ring (the way the page nests them); pairs share one row.
|
|
191
|
+
const nested = props.group === 'spacing' && byName.has('margin') && byName.has('padding');
|
|
192
|
+
const paired = new Map();
|
|
193
|
+
for (const [first, second] of PAIRS[props.group] ?? []) {
|
|
194
|
+
const a = byName.get(first);
|
|
195
|
+
const b = byName.get(second);
|
|
196
|
+
if (a !== undefined && b !== undefined)
|
|
197
|
+
paired.set(first, b);
|
|
198
|
+
}
|
|
199
|
+
const seconds = new Set([...paired.values()].map((def) => def.name));
|
|
200
|
+
const rows = [];
|
|
201
|
+
for (const def of defs) {
|
|
202
|
+
if (seconds.has(def.name))
|
|
203
|
+
continue;
|
|
204
|
+
if (nested && def.name === 'padding')
|
|
205
|
+
continue;
|
|
206
|
+
if (nested && def.name === 'margin') {
|
|
207
|
+
const padding = (_jsx(StyleProperty, { def: byName.get('padding'), ring: true, ...common }));
|
|
208
|
+
rows.push(_jsx(StyleProperty, { def: def, ring: true, ...common, children: inBox && borderWidth !== undefined ? (_jsx(StyleProperty, { def: borderWidth, ring: true, ...common, children: padding })) : (padding) }, def.name));
|
|
209
|
+
continue;
|
|
210
|
+
}
|
|
211
|
+
const second = paired.get(def.name);
|
|
212
|
+
if (second !== undefined) {
|
|
213
|
+
rows.push(_jsxs("div", { className: "bd-style-pair", children: [_jsx(StyleProperty, { def: def, ...common }), _jsx(StyleProperty, { def: second, ...common })] }, def.name));
|
|
214
|
+
continue;
|
|
215
|
+
}
|
|
216
|
+
rows.push(_jsx(StyleProperty, { def: def, inline: true, ...common }, def.name));
|
|
217
|
+
}
|
|
218
|
+
return (_jsxs("details", { className: "bd-style-group", open: used, "data-group": props.group, children: [_jsx("summary", { children: t(`style.group.${props.group}`) }), rows] }));
|
|
219
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style-inspector.test.d.ts","sourceRoot":"","sources":["../../../../src/panels/inspector/styles/style-inspector.test.tsx"],"names":[],"mappings":""}
|