@wordpress/widget-dashboard 0.1.1-next.v.202606191442.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/CHANGELOG.md +19 -0
- package/LICENSE.md +788 -0
- package/README.md +241 -0
- package/build/components/actions/actions.cjs +265 -0
- package/build/components/actions/actions.cjs.map +7 -0
- package/build/components/actions/index.cjs +31 -0
- package/build/components/actions/index.cjs.map +7 -0
- package/build/components/actions-menu/actions-menu.cjs +92 -0
- package/build/components/actions-menu/actions-menu.cjs.map +7 -0
- package/build/components/actions-menu/index.cjs +31 -0
- package/build/components/actions-menu/index.cjs.map +7 -0
- package/build/components/commands/commands.cjs +177 -0
- package/build/components/commands/commands.cjs.map +7 -0
- package/build/components/commands/index.cjs +33 -0
- package/build/components/commands/index.cjs.map +7 -0
- package/build/components/commands/use-pending-when-edit-mode.cjs +57 -0
- package/build/components/commands/use-pending-when-edit-mode.cjs.map +7 -0
- package/build/components/layout-settings/index.cjs +31 -0
- package/build/components/layout-settings/index.cjs.map +7 -0
- package/build/components/layout-settings/layout-model-edit-field/index.cjs +186 -0
- package/build/components/layout-settings/layout-model-edit-field/index.cjs.map +7 -0
- package/build/components/layout-settings/layout-model-edit-field/thumbnail-grid.cjs +53 -0
- package/build/components/layout-settings/layout-model-edit-field/thumbnail-grid.cjs.map +7 -0
- package/build/components/layout-settings/layout-model-edit-field/thumbnail-masonry.cjs +53 -0
- package/build/components/layout-settings/layout-model-edit-field/thumbnail-masonry.cjs.map +7 -0
- package/build/components/layout-settings/layout-settings.cjs +207 -0
- package/build/components/layout-settings/layout-settings.cjs.map +7 -0
- package/build/components/no-widgets-state/index.cjs +31 -0
- package/build/components/no-widgets-state/index.cjs.map +7 -0
- package/build/components/no-widgets-state/no-widgets-state.cjs +140 -0
- package/build/components/no-widgets-state/no-widgets-state.cjs.map +7 -0
- package/build/components/reset-confirmation/index.cjs +31 -0
- package/build/components/reset-confirmation/index.cjs.map +7 -0
- package/build/components/reset-confirmation/reset-confirmation.cjs +62 -0
- package/build/components/reset-confirmation/reset-confirmation.cjs.map +7 -0
- package/build/components/widget-chrome/index.cjs +31 -0
- package/build/components/widget-chrome/index.cjs.map +7 -0
- package/build/components/widget-chrome/widget-chrome.cjs +277 -0
- package/build/components/widget-chrome/widget-chrome.cjs.map +7 -0
- package/build/components/widget-inserter/index.cjs +31 -0
- package/build/components/widget-inserter/index.cjs.map +7 -0
- package/build/components/widget-inserter/widget-inserter.cjs +78 -0
- package/build/components/widget-inserter/widget-inserter.cjs.map +7 -0
- package/build/components/widget-picker/index.cjs +31 -0
- package/build/components/widget-picker/index.cjs.map +7 -0
- package/build/components/widget-picker/widget-picker.cjs +209 -0
- package/build/components/widget-picker/widget-picker.cjs.map +7 -0
- package/build/components/widget-render/index.cjs +31 -0
- package/build/components/widget-render/index.cjs.map +7 -0
- package/build/components/widget-render/widget-render.cjs +62 -0
- package/build/components/widget-render/widget-render.cjs.map +7 -0
- package/build/components/widget-settings/index.cjs +37 -0
- package/build/components/widget-settings/index.cjs.map +7 -0
- package/build/components/widget-settings/utils/get-admin-menu-inset.cjs +41 -0
- package/build/components/widget-settings/utils/get-admin-menu-inset.cjs.map +7 -0
- package/build/components/widget-settings/utils/get-widget-settings.cjs +38 -0
- package/build/components/widget-settings/utils/get-widget-settings.cjs.map +7 -0
- package/build/components/widget-settings/utils/index.cjs +34 -0
- package/build/components/widget-settings/utils/index.cjs.map +7 -0
- package/build/components/widget-settings/widget-settings-toolbar.cjs +138 -0
- package/build/components/widget-settings/widget-settings-toolbar.cjs.map +7 -0
- package/build/components/widget-settings/widget-settings-trigger.cjs +82 -0
- package/build/components/widget-settings/widget-settings-trigger.cjs.map +7 -0
- package/build/components/widget-settings/widget-settings.cjs +269 -0
- package/build/components/widget-settings/widget-settings.cjs.map +7 -0
- package/build/components/widget-toolbar/index.cjs +31 -0
- package/build/components/widget-toolbar/index.cjs.map +7 -0
- package/build/components/widget-toolbar/widget-toolbar.cjs +148 -0
- package/build/components/widget-toolbar/widget-toolbar.cjs.map +7 -0
- package/build/components/widgets/index.cjs +31 -0
- package/build/components/widgets/index.cjs.map +7 -0
- package/build/components/widgets/widget-layout-toolbar.cjs +206 -0
- package/build/components/widgets/widget-layout-toolbar.cjs.map +7 -0
- package/build/components/widgets/widget-resize-handle.cjs +163 -0
- package/build/components/widgets/widget-resize-handle.cjs.map +7 -0
- package/build/components/widgets/widgets.cjs +277 -0
- package/build/components/widgets/widgets.cjs.map +7 -0
- package/build/context/dashboard-context.cjs +234 -0
- package/build/context/dashboard-context.cjs.map +7 -0
- package/build/context/ui-context.cjs +77 -0
- package/build/context/ui-context.cjs.map +7 -0
- package/build/context/widget-context.cjs +44 -0
- package/build/context/widget-context.cjs.map +7 -0
- package/build/hooks/use-dashboard-container-column-count.cjs +61 -0
- package/build/hooks/use-dashboard-container-column-count.cjs.map +7 -0
- package/build/index.cjs +45 -0
- package/build/index.cjs.map +7 -0
- package/build/lock-unlock.cjs +37 -0
- package/build/lock-unlock.cjs.map +7 -0
- package/build/types.cjs +31 -0
- package/build/types.cjs.map +7 -0
- package/build/utils/create-dashboard-widget/create-dashboard-widget.cjs +44 -0
- package/build/utils/create-dashboard-widget/create-dashboard-widget.cjs.map +7 -0
- package/build/utils/create-dashboard-widget/index.cjs +31 -0
- package/build/utils/create-dashboard-widget/index.cjs.map +7 -0
- package/build/utils/default-grid/default-grid.cjs +37 -0
- package/build/utils/default-grid/default-grid.cjs.map +7 -0
- package/build/utils/default-grid/index.cjs +31 -0
- package/build/utils/default-grid/index.cjs.map +7 -0
- package/build/utils/grid-model-change/grid-model-change.cjs +56 -0
- package/build/utils/grid-model-change/grid-model-change.cjs.map +7 -0
- package/build/utils/grid-model-change/index.cjs +33 -0
- package/build/utils/grid-model-change/index.cjs.map +7 -0
- package/build/utils/index.cjs +34 -0
- package/build/utils/index.cjs.map +7 -0
- package/build/utils/migrate-layout/index.cjs +31 -0
- package/build/utils/migrate-layout/index.cjs.map +7 -0
- package/build/utils/migrate-layout/migrate-layout.cjs +94 -0
- package/build/utils/migrate-layout/migrate-layout.cjs.map +7 -0
- package/build/utils/normalize-grid-settings/index.cjs +31 -0
- package/build/utils/normalize-grid-settings/index.cjs.map +7 -0
- package/build/utils/normalize-grid-settings/normalize-grid-settings.cjs +46 -0
- package/build/utils/normalize-grid-settings/normalize-grid-settings.cjs.map +7 -0
- package/build/utils/resolve-dashboard-column-count/resolve-dashboard-column-count.cjs +49 -0
- package/build/utils/resolve-dashboard-column-count/resolve-dashboard-column-count.cjs.map +7 -0
- package/build/utils/row-height-presets/index.cjs +39 -0
- package/build/utils/row-height-presets/index.cjs.map +7 -0
- package/build/utils/row-height-presets/row-height-presets.cjs +63 -0
- package/build/utils/row-height-presets/row-height-presets.cjs.map +7 -0
- package/build/widget-dashboard.cjs +86 -0
- package/build/widget-dashboard.cjs.map +7 -0
- package/build/wordpress-commands.d.cjs +2 -0
- package/build/wordpress-commands.d.cjs.map +7 -0
- package/build-module/components/actions/actions.mjs +240 -0
- package/build-module/components/actions/actions.mjs.map +7 -0
- package/build-module/components/actions/index.mjs +6 -0
- package/build-module/components/actions/index.mjs.map +7 -0
- package/build-module/components/actions-menu/actions-menu.mjs +67 -0
- package/build-module/components/actions-menu/actions-menu.mjs.map +7 -0
- package/build-module/components/actions-menu/index.mjs +6 -0
- package/build-module/components/actions-menu/index.mjs.map +7 -0
- package/build-module/components/commands/commands.mjs +160 -0
- package/build-module/components/commands/commands.mjs.map +7 -0
- package/build-module/components/commands/index.mjs +7 -0
- package/build-module/components/commands/index.mjs.map +7 -0
- package/build-module/components/commands/use-pending-when-edit-mode.mjs +32 -0
- package/build-module/components/commands/use-pending-when-edit-mode.mjs.map +7 -0
- package/build-module/components/layout-settings/index.mjs +6 -0
- package/build-module/components/layout-settings/index.mjs.map +7 -0
- package/build-module/components/layout-settings/layout-model-edit-field/index.mjs +151 -0
- package/build-module/components/layout-settings/layout-model-edit-field/index.mjs.map +7 -0
- package/build-module/components/layout-settings/layout-model-edit-field/thumbnail-grid.mjs +28 -0
- package/build-module/components/layout-settings/layout-model-edit-field/thumbnail-grid.mjs.map +7 -0
- package/build-module/components/layout-settings/layout-model-edit-field/thumbnail-masonry.mjs +28 -0
- package/build-module/components/layout-settings/layout-model-edit-field/thumbnail-masonry.mjs.map +7 -0
- package/build-module/components/layout-settings/layout-settings.mjs +187 -0
- package/build-module/components/layout-settings/layout-settings.mjs.map +7 -0
- package/build-module/components/no-widgets-state/index.mjs +6 -0
- package/build-module/components/no-widgets-state/index.mjs.map +7 -0
- package/build-module/components/no-widgets-state/no-widgets-state.mjs +115 -0
- package/build-module/components/no-widgets-state/no-widgets-state.mjs.map +7 -0
- package/build-module/components/reset-confirmation/index.mjs +6 -0
- package/build-module/components/reset-confirmation/index.mjs.map +7 -0
- package/build-module/components/reset-confirmation/reset-confirmation.mjs +37 -0
- package/build-module/components/reset-confirmation/reset-confirmation.mjs.map +7 -0
- package/build-module/components/widget-chrome/index.mjs +6 -0
- package/build-module/components/widget-chrome/index.mjs.map +7 -0
- package/build-module/components/widget-chrome/widget-chrome.mjs +248 -0
- package/build-module/components/widget-chrome/widget-chrome.mjs.map +7 -0
- package/build-module/components/widget-inserter/index.mjs +6 -0
- package/build-module/components/widget-inserter/index.mjs.map +7 -0
- package/build-module/components/widget-inserter/widget-inserter.mjs +53 -0
- package/build-module/components/widget-inserter/widget-inserter.mjs.map +7 -0
- package/build-module/components/widget-picker/index.mjs +6 -0
- package/build-module/components/widget-picker/index.mjs.map +7 -0
- package/build-module/components/widget-picker/widget-picker.mjs +184 -0
- package/build-module/components/widget-picker/widget-picker.mjs.map +7 -0
- package/build-module/components/widget-render/index.mjs +6 -0
- package/build-module/components/widget-render/index.mjs.map +7 -0
- package/build-module/components/widget-render/widget-render.mjs +37 -0
- package/build-module/components/widget-render/widget-render.mjs.map +7 -0
- package/build-module/components/widget-settings/index.mjs +10 -0
- package/build-module/components/widget-settings/index.mjs.map +7 -0
- package/build-module/components/widget-settings/utils/get-admin-menu-inset.mjs +16 -0
- package/build-module/components/widget-settings/utils/get-admin-menu-inset.mjs.map +7 -0
- package/build-module/components/widget-settings/utils/get-widget-settings.mjs +13 -0
- package/build-module/components/widget-settings/utils/get-widget-settings.mjs.map +7 -0
- package/build-module/components/widget-settings/utils/index.mjs +8 -0
- package/build-module/components/widget-settings/utils/index.mjs.map +7 -0
- package/build-module/components/widget-settings/widget-settings-toolbar.mjs +113 -0
- package/build-module/components/widget-settings/widget-settings-toolbar.mjs.map +7 -0
- package/build-module/components/widget-settings/widget-settings-trigger.mjs +57 -0
- package/build-module/components/widget-settings/widget-settings-trigger.mjs.map +7 -0
- package/build-module/components/widget-settings/widget-settings.mjs +244 -0
- package/build-module/components/widget-settings/widget-settings.mjs.map +7 -0
- package/build-module/components/widget-toolbar/index.mjs +6 -0
- package/build-module/components/widget-toolbar/index.mjs.map +7 -0
- package/build-module/components/widget-toolbar/widget-toolbar.mjs +113 -0
- package/build-module/components/widget-toolbar/widget-toolbar.mjs.map +7 -0
- package/build-module/components/widgets/index.mjs +6 -0
- package/build-module/components/widgets/index.mjs.map +7 -0
- package/build-module/components/widgets/widget-layout-toolbar.mjs +181 -0
- package/build-module/components/widgets/widget-layout-toolbar.mjs.map +7 -0
- package/build-module/components/widgets/widget-resize-handle.mjs +128 -0
- package/build-module/components/widgets/widget-resize-handle.mjs.map +7 -0
- package/build-module/components/widgets/widgets.mjs +242 -0
- package/build-module/components/widgets/widgets.mjs.map +7 -0
- package/build-module/context/dashboard-context.mjs +205 -0
- package/build-module/context/dashboard-context.mjs.map +7 -0
- package/build-module/context/ui-context.mjs +56 -0
- package/build-module/context/ui-context.mjs.map +7 -0
- package/build-module/context/widget-context.mjs +18 -0
- package/build-module/context/widget-context.mjs.map +7 -0
- package/build-module/hooks/use-dashboard-container-column-count.mjs +40 -0
- package/build-module/hooks/use-dashboard-container-column-count.mjs.map +7 -0
- package/build-module/index.mjs +18 -0
- package/build-module/index.mjs.map +7 -0
- package/build-module/lock-unlock.mjs +11 -0
- package/build-module/lock-unlock.mjs.map +7 -0
- package/build-module/types.mjs +6 -0
- package/build-module/types.mjs.map +7 -0
- package/build-module/utils/create-dashboard-widget/create-dashboard-widget.mjs +19 -0
- package/build-module/utils/create-dashboard-widget/create-dashboard-widget.mjs.map +7 -0
- package/build-module/utils/create-dashboard-widget/index.mjs +6 -0
- package/build-module/utils/create-dashboard-widget/index.mjs.map +7 -0
- package/build-module/utils/default-grid/default-grid.mjs +12 -0
- package/build-module/utils/default-grid/default-grid.mjs.map +7 -0
- package/build-module/utils/default-grid/index.mjs +6 -0
- package/build-module/utils/default-grid/index.mjs.map +7 -0
- package/build-module/utils/grid-model-change/grid-model-change.mjs +30 -0
- package/build-module/utils/grid-model-change/grid-model-change.mjs.map +7 -0
- package/build-module/utils/grid-model-change/index.mjs +7 -0
- package/build-module/utils/grid-model-change/index.mjs.map +7 -0
- package/build-module/utils/index.mjs +8 -0
- package/build-module/utils/index.mjs.map +7 -0
- package/build-module/utils/migrate-layout/index.mjs +6 -0
- package/build-module/utils/migrate-layout/index.mjs.map +7 -0
- package/build-module/utils/migrate-layout/migrate-layout.mjs +69 -0
- package/build-module/utils/migrate-layout/migrate-layout.mjs.map +7 -0
- package/build-module/utils/normalize-grid-settings/index.mjs +6 -0
- package/build-module/utils/normalize-grid-settings/index.mjs.map +7 -0
- package/build-module/utils/normalize-grid-settings/normalize-grid-settings.mjs +21 -0
- package/build-module/utils/normalize-grid-settings/normalize-grid-settings.mjs.map +7 -0
- package/build-module/utils/resolve-dashboard-column-count/resolve-dashboard-column-count.mjs +22 -0
- package/build-module/utils/resolve-dashboard-column-count/resolve-dashboard-column-count.mjs.map +7 -0
- package/build-module/utils/row-height-presets/index.mjs +16 -0
- package/build-module/utils/row-height-presets/index.mjs.map +7 -0
- package/build-module/utils/row-height-presets/row-height-presets.mjs +34 -0
- package/build-module/utils/row-height-presets/row-height-presets.mjs.map +7 -0
- package/build-module/widget-dashboard.mjs +61 -0
- package/build-module/widget-dashboard.mjs.map +7 -0
- package/build-module/wordpress-commands.d.mjs +1 -0
- package/build-module/wordpress-commands.d.mjs.map +7 -0
- package/build-types/components/actions/actions.d.ts +11 -0
- package/build-types/components/actions/actions.d.ts.map +1 -0
- package/build-types/components/actions/index.d.ts +2 -0
- package/build-types/components/actions/index.d.ts.map +1 -0
- package/build-types/components/actions-menu/actions-menu.d.ts +22 -0
- package/build-types/components/actions-menu/actions-menu.d.ts.map +1 -0
- package/build-types/components/actions-menu/index.d.ts +3 -0
- package/build-types/components/actions-menu/index.d.ts.map +1 -0
- package/build-types/components/commands/commands.d.ts +7 -0
- package/build-types/components/commands/commands.d.ts.map +1 -0
- package/build-types/components/commands/index.d.ts +2 -0
- package/build-types/components/commands/index.d.ts.map +1 -0
- package/build-types/components/commands/use-pending-when-edit-mode.d.ts +15 -0
- package/build-types/components/commands/use-pending-when-edit-mode.d.ts.map +1 -0
- package/build-types/components/layout-settings/index.d.ts +2 -0
- package/build-types/components/layout-settings/index.d.ts.map +1 -0
- package/build-types/components/layout-settings/layout-model-edit-field/index.d.ts +17 -0
- package/build-types/components/layout-settings/layout-model-edit-field/index.d.ts.map +1 -0
- package/build-types/components/layout-settings/layout-model-edit-field/thumbnail-grid.d.ts +6 -0
- package/build-types/components/layout-settings/layout-model-edit-field/thumbnail-grid.d.ts.map +1 -0
- package/build-types/components/layout-settings/layout-model-edit-field/thumbnail-masonry.d.ts +6 -0
- package/build-types/components/layout-settings/layout-model-edit-field/thumbnail-masonry.d.ts.map +1 -0
- package/build-types/components/layout-settings/layout-settings.d.ts +14 -0
- package/build-types/components/layout-settings/layout-settings.d.ts.map +1 -0
- package/build-types/components/no-widgets-state/index.d.ts +2 -0
- package/build-types/components/no-widgets-state/index.d.ts.map +1 -0
- package/build-types/components/no-widgets-state/no-widgets-state.d.ts +17 -0
- package/build-types/components/no-widgets-state/no-widgets-state.d.ts.map +1 -0
- package/build-types/components/reset-confirmation/index.d.ts +2 -0
- package/build-types/components/reset-confirmation/index.d.ts.map +1 -0
- package/build-types/components/reset-confirmation/reset-confirmation.d.ts +8 -0
- package/build-types/components/reset-confirmation/reset-confirmation.d.ts.map +1 -0
- package/build-types/components/widget-chrome/index.d.ts +2 -0
- package/build-types/components/widget-chrome/index.d.ts.map +1 -0
- package/build-types/components/widget-chrome/widget-chrome.d.ts +22 -0
- package/build-types/components/widget-chrome/widget-chrome.d.ts.map +1 -0
- package/build-types/components/widget-inserter/index.d.ts +2 -0
- package/build-types/components/widget-inserter/index.d.ts.map +1 -0
- package/build-types/components/widget-inserter/widget-inserter.d.ts +7 -0
- package/build-types/components/widget-inserter/widget-inserter.d.ts.map +1 -0
- package/build-types/components/widget-picker/index.d.ts +2 -0
- package/build-types/components/widget-picker/index.d.ts.map +1 -0
- package/build-types/components/widget-picker/widget-picker.d.ts +26 -0
- package/build-types/components/widget-picker/widget-picker.d.ts.map +1 -0
- package/build-types/components/widget-render/index.d.ts +2 -0
- package/build-types/components/widget-render/index.d.ts.map +1 -0
- package/build-types/components/widget-render/widget-render.d.ts +17 -0
- package/build-types/components/widget-render/widget-render.d.ts.map +1 -0
- package/build-types/components/widget-settings/index.d.ts +5 -0
- package/build-types/components/widget-settings/index.d.ts.map +1 -0
- package/build-types/components/widget-settings/utils/get-admin-menu-inset.d.ts +17 -0
- package/build-types/components/widget-settings/utils/get-admin-menu-inset.d.ts.map +1 -0
- package/build-types/components/widget-settings/utils/get-widget-settings.d.ts +10 -0
- package/build-types/components/widget-settings/utils/get-widget-settings.d.ts.map +1 -0
- package/build-types/components/widget-settings/utils/index.d.ts +3 -0
- package/build-types/components/widget-settings/utils/index.d.ts.map +1 -0
- package/build-types/components/widget-settings/widget-settings-toolbar.d.ts +20 -0
- package/build-types/components/widget-settings/widget-settings-toolbar.d.ts.map +1 -0
- package/build-types/components/widget-settings/widget-settings-trigger.d.ts +23 -0
- package/build-types/components/widget-settings/widget-settings-trigger.d.ts.map +1 -0
- package/build-types/components/widget-settings/widget-settings.d.ts +13 -0
- package/build-types/components/widget-settings/widget-settings.d.ts.map +1 -0
- package/build-types/components/widget-toolbar/index.d.ts +3 -0
- package/build-types/components/widget-toolbar/index.d.ts.map +1 -0
- package/build-types/components/widget-toolbar/widget-toolbar.d.ts +16 -0
- package/build-types/components/widget-toolbar/widget-toolbar.d.ts.map +1 -0
- package/build-types/components/widgets/index.d.ts +2 -0
- package/build-types/components/widgets/index.d.ts.map +1 -0
- package/build-types/components/widgets/widget-layout-toolbar.d.ts +14 -0
- package/build-types/components/widgets/widget-layout-toolbar.d.ts.map +1 -0
- package/build-types/components/widgets/widget-resize-handle.d.ts +12 -0
- package/build-types/components/widgets/widget-resize-handle.d.ts.map +1 -0
- package/build-types/components/widgets/widgets.d.ts +10 -0
- package/build-types/components/widgets/widgets.d.ts.map +1 -0
- package/build-types/context/dashboard-context.d.ts +111 -0
- package/build-types/context/dashboard-context.d.ts.map +1 -0
- package/build-types/context/ui-context.d.ts +54 -0
- package/build-types/context/ui-context.d.ts.map +1 -0
- package/build-types/context/widget-context.d.ts +25 -0
- package/build-types/context/widget-context.d.ts.map +1 -0
- package/build-types/hooks/use-dashboard-container-column-count.d.ts +15 -0
- package/build-types/hooks/use-dashboard-container-column-count.d.ts.map +1 -0
- package/build-types/index.d.ts +7 -0
- package/build-types/index.d.ts.map +1 -0
- package/build-types/lock-unlock.d.ts +2 -0
- package/build-types/lock-unlock.d.ts.map +1 -0
- package/build-types/types.d.ts +222 -0
- package/build-types/types.d.ts.map +1 -0
- package/build-types/utils/create-dashboard-widget/create-dashboard-widget.d.ts +20 -0
- package/build-types/utils/create-dashboard-widget/create-dashboard-widget.d.ts.map +1 -0
- package/build-types/utils/create-dashboard-widget/index.d.ts +2 -0
- package/build-types/utils/create-dashboard-widget/index.d.ts.map +1 -0
- package/build-types/utils/default-grid/default-grid.d.ts +11 -0
- package/build-types/utils/default-grid/default-grid.d.ts.map +1 -0
- package/build-types/utils/default-grid/index.d.ts +2 -0
- package/build-types/utils/default-grid/index.d.ts.map +1 -0
- package/build-types/utils/grid-model-change/grid-model-change.d.ts +20 -0
- package/build-types/utils/grid-model-change/grid-model-change.d.ts.map +1 -0
- package/build-types/utils/grid-model-change/index.d.ts +2 -0
- package/build-types/utils/grid-model-change/index.d.ts.map +1 -0
- package/build-types/utils/index.d.ts +3 -0
- package/build-types/utils/index.d.ts.map +1 -0
- package/build-types/utils/migrate-layout/index.d.ts +2 -0
- package/build-types/utils/migrate-layout/index.d.ts.map +1 -0
- package/build-types/utils/migrate-layout/migrate-layout.d.ts +36 -0
- package/build-types/utils/migrate-layout/migrate-layout.d.ts.map +1 -0
- package/build-types/utils/normalize-grid-settings/index.d.ts +2 -0
- package/build-types/utils/normalize-grid-settings/index.d.ts.map +1 -0
- package/build-types/utils/normalize-grid-settings/normalize-grid-settings.d.ts +11 -0
- package/build-types/utils/normalize-grid-settings/normalize-grid-settings.d.ts.map +1 -0
- package/build-types/utils/resolve-dashboard-column-count/resolve-dashboard-column-count.d.ts +21 -0
- package/build-types/utils/resolve-dashboard-column-count/resolve-dashboard-column-count.d.ts.map +1 -0
- package/build-types/utils/row-height-presets/index.d.ts +3 -0
- package/build-types/utils/row-height-presets/index.d.ts.map +1 -0
- package/build-types/utils/row-height-presets/row-height-presets.d.ts +17 -0
- package/build-types/utils/row-height-presets/row-height-presets.d.ts.map +1 -0
- package/build-types/widget-dashboard.d.ts +51 -0
- package/build-types/widget-dashboard.d.ts.map +1 -0
- package/package.json +90 -0
- package/src/components/actions/actions.module.css +54 -0
- package/src/components/actions/actions.tsx +180 -0
- package/src/components/actions/index.ts +1 -0
- package/src/components/actions-menu/actions-menu.tsx +104 -0
- package/src/components/actions-menu/index.ts +2 -0
- package/src/components/commands/commands.tsx +182 -0
- package/src/components/commands/index.ts +1 -0
- package/src/components/commands/use-pending-when-edit-mode.ts +48 -0
- package/src/components/layout-settings/index.ts +1 -0
- package/src/components/layout-settings/layout-model-edit-field/index.tsx +98 -0
- package/src/components/layout-settings/layout-model-edit-field/style.module.css +34 -0
- package/src/components/layout-settings/layout-model-edit-field/thumbnail-grid.tsx +28 -0
- package/src/components/layout-settings/layout-model-edit-field/thumbnail-masonry.tsx +28 -0
- package/src/components/layout-settings/layout-settings.tsx +217 -0
- package/src/components/no-widgets-state/index.ts +1 -0
- package/src/components/no-widgets-state/no-widgets-state.module.css +3 -0
- package/src/components/no-widgets-state/no-widgets-state.tsx +56 -0
- package/src/components/reset-confirmation/index.ts +1 -0
- package/src/components/reset-confirmation/reset-confirmation.tsx +44 -0
- package/src/components/widget-chrome/index.ts +1 -0
- package/src/components/widget-chrome/widget-chrome.module.css +87 -0
- package/src/components/widget-chrome/widget-chrome.tsx +255 -0
- package/src/components/widget-inserter/index.ts +1 -0
- package/src/components/widget-inserter/widget-inserter.tsx +70 -0
- package/src/components/widget-picker/index.ts +1 -0
- package/src/components/widget-picker/widget-picker.module.css +11 -0
- package/src/components/widget-picker/widget-picker.tsx +137 -0
- package/src/components/widget-render/index.ts +1 -0
- package/src/components/widget-render/widget-render.tsx +58 -0
- package/src/components/widget-settings/index.ts +4 -0
- package/src/components/widget-settings/utils/get-admin-menu-inset.ts +30 -0
- package/src/components/widget-settings/utils/get-widget-settings.ts +22 -0
- package/src/components/widget-settings/utils/index.ts +2 -0
- package/src/components/widget-settings/widget-settings-toolbar.module.css +25 -0
- package/src/components/widget-settings/widget-settings-toolbar.tsx +45 -0
- package/src/components/widget-settings/widget-settings-trigger.tsx +96 -0
- package/src/components/widget-settings/widget-settings.module.css +8 -0
- package/src/components/widget-settings/widget-settings.tsx +200 -0
- package/src/components/widget-toolbar/index.ts +2 -0
- package/src/components/widget-toolbar/widget-toolbar.module.css +12 -0
- package/src/components/widget-toolbar/widget-toolbar.tsx +46 -0
- package/src/components/widgets/index.ts +1 -0
- package/src/components/widgets/widget-layout-toolbar.module.css +6 -0
- package/src/components/widgets/widget-layout-toolbar.tsx +118 -0
- package/src/components/widgets/widget-resize-handle.module.css +135 -0
- package/src/components/widgets/widget-resize-handle.tsx +60 -0
- package/src/components/widgets/widgets.module.css +43 -0
- package/src/components/widgets/widgets.tsx +208 -0
- package/src/context/dashboard-context.tsx +386 -0
- package/src/context/ui-context.tsx +118 -0
- package/src/context/widget-context.tsx +45 -0
- package/src/hooks/use-dashboard-container-column-count.ts +63 -0
- package/src/index.ts +9 -0
- package/src/lock-unlock.ts +10 -0
- package/src/test/actions.test.tsx +226 -0
- package/src/test/commands.test.tsx +176 -0
- package/src/test/create-dashboard-widget.test.ts +59 -0
- package/src/test/dashboard-context.test.tsx +26 -0
- package/src/test/staging.test.tsx +476 -0
- package/src/test/widget-dashboard.test.tsx +204 -0
- package/src/test/widget-inserter.test.tsx +210 -0
- package/src/test/widget-settings.test.tsx +199 -0
- package/src/types.ts +260 -0
- package/src/utils/create-dashboard-widget/create-dashboard-widget.ts +43 -0
- package/src/utils/create-dashboard-widget/index.ts +1 -0
- package/src/utils/default-grid/default-grid.ts +17 -0
- package/src/utils/default-grid/index.ts +1 -0
- package/src/utils/grid-model-change/grid-model-change.ts +53 -0
- package/src/utils/grid-model-change/index.ts +1 -0
- package/src/utils/index.ts +2 -0
- package/src/utils/migrate-layout/index.ts +1 -0
- package/src/utils/migrate-layout/migrate-layout.ts +156 -0
- package/src/utils/migrate-layout/test/migrate-layout.test.ts +114 -0
- package/src/utils/normalize-grid-settings/index.ts +1 -0
- package/src/utils/normalize-grid-settings/normalize-grid-settings.ts +38 -0
- package/src/utils/resolve-dashboard-column-count/resolve-dashboard-column-count.ts +41 -0
- package/src/utils/resolve-dashboard-column-count/test/resolve-dashboard-column-count.test.ts +44 -0
- package/src/utils/row-height-presets/index.ts +8 -0
- package/src/utils/row-height-presets/row-height-presets.ts +43 -0
- package/src/widget-dashboard.tsx +102 -0
- package/src/wordpress-commands.d.ts +12 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// packages/widget-dashboard/src/utils/grid-model-change/index.ts
|
|
21
|
+
var grid_model_change_exports = {};
|
|
22
|
+
__export(grid_model_change_exports, {
|
|
23
|
+
computeGridModelChange: () => import_grid_model_change.computeGridModelChange,
|
|
24
|
+
getGridModel: () => import_grid_model_change.getGridModel
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(grid_model_change_exports);
|
|
27
|
+
var import_grid_model_change = require("./grid-model-change.cjs");
|
|
28
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
29
|
+
0 && (module.exports = {
|
|
30
|
+
computeGridModelChange,
|
|
31
|
+
getGridModel
|
|
32
|
+
});
|
|
33
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/utils/grid-model-change/index.ts"],
|
|
4
|
+
"sourcesContent": ["export { computeGridModelChange, getGridModel } from './grid-model-change';\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,+BAAqD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// packages/widget-dashboard/src/utils/index.ts
|
|
21
|
+
var utils_exports = {};
|
|
22
|
+
__export(utils_exports, {
|
|
23
|
+
createDashboardWidget: () => import_create_dashboard_widget.createDashboardWidget,
|
|
24
|
+
migrateLayout: () => import_migrate_layout.migrateLayout
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(utils_exports);
|
|
27
|
+
var import_create_dashboard_widget = require("./create-dashboard-widget/index.cjs");
|
|
28
|
+
var import_migrate_layout = require("./migrate-layout/index.cjs");
|
|
29
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
30
|
+
0 && (module.exports = {
|
|
31
|
+
createDashboardWidget,
|
|
32
|
+
migrateLayout
|
|
33
|
+
});
|
|
34
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/utils/index.ts"],
|
|
4
|
+
"sourcesContent": ["export { createDashboardWidget } from './create-dashboard-widget';\nexport { migrateLayout } from './migrate-layout';\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qCAAsC;AACtC,4BAA8B;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// packages/widget-dashboard/src/utils/migrate-layout/index.ts
|
|
21
|
+
var migrate_layout_exports = {};
|
|
22
|
+
__export(migrate_layout_exports, {
|
|
23
|
+
migrateLayout: () => import_migrate_layout.migrateLayout
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(migrate_layout_exports);
|
|
26
|
+
var import_migrate_layout = require("./migrate-layout.cjs");
|
|
27
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
28
|
+
0 && (module.exports = {
|
|
29
|
+
migrateLayout
|
|
30
|
+
});
|
|
31
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// packages/widget-dashboard/src/utils/migrate-layout/migrate-layout.ts
|
|
21
|
+
var migrate_layout_exports = {};
|
|
22
|
+
__export(migrate_layout_exports, {
|
|
23
|
+
migrateLayout: () => migrateLayout
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(migrate_layout_exports);
|
|
26
|
+
var FALLBACK_COLUMNS = 6;
|
|
27
|
+
function gridWidthToMasonryWidth(width, targetColumns) {
|
|
28
|
+
if (width === "full") {
|
|
29
|
+
return targetColumns;
|
|
30
|
+
}
|
|
31
|
+
if (width === "fill" || width === void 0) {
|
|
32
|
+
return 1;
|
|
33
|
+
}
|
|
34
|
+
return width;
|
|
35
|
+
}
|
|
36
|
+
function migratePlacementGridToMasonry(placement, context) {
|
|
37
|
+
if (!placement) {
|
|
38
|
+
return {};
|
|
39
|
+
}
|
|
40
|
+
const next = {};
|
|
41
|
+
const width = gridWidthToMasonryWidth(placement.width, context.columns);
|
|
42
|
+
if (width !== 1) {
|
|
43
|
+
next.width = width;
|
|
44
|
+
}
|
|
45
|
+
if (placement.order !== void 0) {
|
|
46
|
+
next.order = placement.order;
|
|
47
|
+
}
|
|
48
|
+
return next;
|
|
49
|
+
}
|
|
50
|
+
function migratePlacementMasonryToGrid(placement) {
|
|
51
|
+
if (!placement) {
|
|
52
|
+
return { height: 1 };
|
|
53
|
+
}
|
|
54
|
+
const next = { height: 1 };
|
|
55
|
+
if (placement.width !== void 0) {
|
|
56
|
+
next.width = placement.width;
|
|
57
|
+
}
|
|
58
|
+
if (placement.order !== void 0) {
|
|
59
|
+
next.order = placement.order;
|
|
60
|
+
}
|
|
61
|
+
return next;
|
|
62
|
+
}
|
|
63
|
+
function migrateLayout(widgets, from, to, context = {}) {
|
|
64
|
+
const resolvedFrom = from ?? "grid";
|
|
65
|
+
if (resolvedFrom === to) {
|
|
66
|
+
return widgets;
|
|
67
|
+
}
|
|
68
|
+
const resolvedContext = {
|
|
69
|
+
columns: context.columns ?? FALLBACK_COLUMNS
|
|
70
|
+
};
|
|
71
|
+
if (resolvedFrom === "grid" && to === "masonry") {
|
|
72
|
+
return widgets.map((widget) => ({
|
|
73
|
+
...widget,
|
|
74
|
+
placement: migratePlacementGridToMasonry(
|
|
75
|
+
widget.placement,
|
|
76
|
+
resolvedContext
|
|
77
|
+
)
|
|
78
|
+
}));
|
|
79
|
+
}
|
|
80
|
+
if (resolvedFrom === "masonry" && to === "grid") {
|
|
81
|
+
return widgets.map((widget) => ({
|
|
82
|
+
...widget,
|
|
83
|
+
placement: migratePlacementMasonryToGrid(
|
|
84
|
+
widget.placement
|
|
85
|
+
)
|
|
86
|
+
}));
|
|
87
|
+
}
|
|
88
|
+
return widgets;
|
|
89
|
+
}
|
|
90
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
91
|
+
0 && (module.exports = {
|
|
92
|
+
migrateLayout
|
|
93
|
+
});
|
|
94
|
+
//# sourceMappingURL=migrate-layout.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/utils/migrate-layout/migrate-layout.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport type {\n\tDashboardWidget,\n\tGridTilePlacement,\n\tMasonryTilePlacement,\n\tWidgetGridModel,\n} from '../../types';\n\ninterface MigrationContext {\n\t/**\n\t * Column count of the currently-mounted grid surface. Used to\n\t * resolve `'full'` widths to a concrete numeric span when going\n\t * from the 2D grid model to masonry. When the surface is in\n\t * responsive mode and the runtime column count is unknown,\n\t * callers should pass a sensible fallback (e.g., the default of\n\t * 6 used by `@wordpress/grid`).\n\t */\n\tcolumns: number;\n}\n\nconst FALLBACK_COLUMNS = 6;\n\n/**\n * Coerces a `'fill'`/`'full'`/numeric width into a concrete numeric\n * span when migrating from `'grid'` to `'masonry'`. `'fill'` collapses\n * to a single column; resolving it against per-row remainder would\n * require either DOM measurement or replicating CSS-Grid's auto-flow\n * placement, both of which were judged not worth the complexity for\n * a one-shot migration the user can correct visually in staging.\n *\n * @param width Source width from a grid placement.\n * @param targetColumns Column count to use for `'full'` widths.\n */\nfunction gridWidthToMasonryWidth(\n\twidth: GridTilePlacement[ 'width' ],\n\ttargetColumns: number\n): number {\n\tif ( width === 'full' ) {\n\t\treturn targetColumns;\n\t}\n\tif ( width === 'fill' || width === undefined ) {\n\t\treturn 1;\n\t}\n\treturn width;\n}\n\n/**\n * Transforms a single placement from the 2D grid shape to the masonry\n * shape. Drops `height` (masonry derives heights from content),\n * preserves `order`, leaves `lane` unset so the auto-flow placer\n * arranges items by source order.\n *\n * @param placement Source grid placement.\n * @param context Migration context (column count).\n */\nfunction migratePlacementGridToMasonry(\n\tplacement: GridTilePlacement | undefined,\n\tcontext: MigrationContext\n): MasonryTilePlacement {\n\tif ( ! placement ) {\n\t\treturn {};\n\t}\n\n\tconst next: MasonryTilePlacement = {};\n\tconst width = gridWidthToMasonryWidth( placement.width, context.columns );\n\tif ( width !== 1 ) {\n\t\tnext.width = width;\n\t}\n\tif ( placement.order !== undefined ) {\n\t\tnext.order = placement.order;\n\t}\n\treturn next;\n}\n\n/**\n * Transforms a single placement from the masonry shape to the 2D grid\n * shape. Preserves the numeric width, drops `lane` (the 2D grid\n * auto-packs and has no pin-to-column concept), and seeds `height: 1`\n * since masonry never persisted a height. The user is expected to\n * resize tiles vertically after the migration.\n *\n * @param placement Source masonry placement.\n */\nfunction migratePlacementMasonryToGrid(\n\tplacement: MasonryTilePlacement | undefined\n): GridTilePlacement {\n\tif ( ! placement ) {\n\t\treturn { height: 1 };\n\t}\n\n\tconst next: GridTilePlacement = { height: 1 };\n\tif ( placement.width !== undefined ) {\n\t\tnext.width = placement.width;\n\t}\n\tif ( placement.order !== undefined ) {\n\t\tnext.order = placement.order;\n\t}\n\treturn next;\n}\n\n/**\n * Migrates every widget's `placement` between grid models.\n *\n * The two storage shapes overlap on `width` and `order` but diverge\n * on the rest: 2D grid carries `height` and discriminated string\n * widths (`'fill'`/`'full'`), lanes carries `lane` and only numeric\n * widths. Each conversion loses information that the target model\n * cannot represent. The caller is responsible for surfacing the\n * result to the user in a way that lets them correct visually.\n *\n * When `from === to`, the input is returned unchanged.\n *\n * @param widgets Widgets to migrate.\n * @param from Source model. `undefined` is treated as `'grid'`.\n * @param to Target model.\n * @param context Information that depends on the live render (today\n * only `columns`).\n */\nexport function migrateLayout(\n\twidgets: DashboardWidget[],\n\tfrom: WidgetGridModel | undefined,\n\tto: WidgetGridModel,\n\tcontext: Partial< MigrationContext > = {}\n): DashboardWidget[] {\n\tconst resolvedFrom: WidgetGridModel = from ?? 'grid';\n\tif ( resolvedFrom === to ) {\n\t\treturn widgets;\n\t}\n\n\tconst resolvedContext: MigrationContext = {\n\t\tcolumns: context.columns ?? FALLBACK_COLUMNS,\n\t};\n\n\tif ( resolvedFrom === 'grid' && to === 'masonry' ) {\n\t\treturn widgets.map( ( widget ) => ( {\n\t\t\t...widget,\n\t\t\tplacement: migratePlacementGridToMasonry(\n\t\t\t\twidget.placement as GridTilePlacement | undefined,\n\t\t\t\tresolvedContext\n\t\t\t),\n\t\t} ) );\n\t}\n\n\tif ( resolvedFrom === 'masonry' && to === 'grid' ) {\n\t\treturn widgets.map( ( widget ) => ( {\n\t\t\t...widget,\n\t\t\tplacement: migratePlacementMasonryToGrid(\n\t\t\t\twidget.placement as MasonryTilePlacement | undefined\n\t\t\t),\n\t\t} ) );\n\t}\n\n\treturn widgets;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAsBA,IAAM,mBAAmB;AAazB,SAAS,wBACR,OACA,eACS;AACT,MAAK,UAAU,QAAS;AACvB,WAAO;AAAA,EACR;AACA,MAAK,UAAU,UAAU,UAAU,QAAY;AAC9C,WAAO;AAAA,EACR;AACA,SAAO;AACR;AAWA,SAAS,8BACR,WACA,SACuB;AACvB,MAAK,CAAE,WAAY;AAClB,WAAO,CAAC;AAAA,EACT;AAEA,QAAM,OAA6B,CAAC;AACpC,QAAM,QAAQ,wBAAyB,UAAU,OAAO,QAAQ,OAAQ;AACxE,MAAK,UAAU,GAAI;AAClB,SAAK,QAAQ;AAAA,EACd;AACA,MAAK,UAAU,UAAU,QAAY;AACpC,SAAK,QAAQ,UAAU;AAAA,EACxB;AACA,SAAO;AACR;AAWA,SAAS,8BACR,WACoB;AACpB,MAAK,CAAE,WAAY;AAClB,WAAO,EAAE,QAAQ,EAAE;AAAA,EACpB;AAEA,QAAM,OAA0B,EAAE,QAAQ,EAAE;AAC5C,MAAK,UAAU,UAAU,QAAY;AACpC,SAAK,QAAQ,UAAU;AAAA,EACxB;AACA,MAAK,UAAU,UAAU,QAAY;AACpC,SAAK,QAAQ,UAAU;AAAA,EACxB;AACA,SAAO;AACR;AAoBO,SAAS,cACf,SACA,MACA,IACA,UAAuC,CAAC,GACpB;AACpB,QAAM,eAAgC,QAAQ;AAC9C,MAAK,iBAAiB,IAAK;AAC1B,WAAO;AAAA,EACR;AAEA,QAAM,kBAAoC;AAAA,IACzC,SAAS,QAAQ,WAAW;AAAA,EAC7B;AAEA,MAAK,iBAAiB,UAAU,OAAO,WAAY;AAClD,WAAO,QAAQ,IAAK,CAAE,YAAc;AAAA,MACnC,GAAG;AAAA,MACH,WAAW;AAAA,QACV,OAAO;AAAA,QACP;AAAA,MACD;AAAA,IACD,EAAI;AAAA,EACL;AAEA,MAAK,iBAAiB,aAAa,OAAO,QAAS;AAClD,WAAO,QAAQ,IAAK,CAAE,YAAc;AAAA,MACnC,GAAG;AAAA,MACH,WAAW;AAAA,QACV,OAAO;AAAA,MACR;AAAA,IACD,EAAI;AAAA,EACL;AAEA,SAAO;AACR;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// packages/widget-dashboard/src/utils/normalize-grid-settings/index.ts
|
|
21
|
+
var normalize_grid_settings_exports = {};
|
|
22
|
+
__export(normalize_grid_settings_exports, {
|
|
23
|
+
normalizeGridSettings: () => import_normalize_grid_settings.normalizeGridSettings
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(normalize_grid_settings_exports);
|
|
26
|
+
var import_normalize_grid_settings = require("./normalize-grid-settings.cjs");
|
|
27
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
28
|
+
0 && (module.exports = {
|
|
29
|
+
normalizeGridSettings
|
|
30
|
+
});
|
|
31
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/utils/normalize-grid-settings/index.ts"],
|
|
4
|
+
"sourcesContent": ["export { normalizeGridSettings } from './normalize-grid-settings';\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qCAAsC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// packages/widget-dashboard/src/utils/normalize-grid-settings/normalize-grid-settings.ts
|
|
21
|
+
var normalize_grid_settings_exports = {};
|
|
22
|
+
__export(normalize_grid_settings_exports, {
|
|
23
|
+
normalizeGridSettings: () => normalizeGridSettings
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(normalize_grid_settings_exports);
|
|
26
|
+
var import_row_height_presets = require("../row-height-presets/index.cjs");
|
|
27
|
+
function normalizeGridSettings(settings, defaultRowHeight) {
|
|
28
|
+
if ((settings.model ?? "grid") === "masonry") {
|
|
29
|
+
return settings;
|
|
30
|
+
}
|
|
31
|
+
const gridSettings = settings;
|
|
32
|
+
const rowHeight = gridSettings.rowHeight;
|
|
33
|
+
const resolved = typeof rowHeight === "number" ? (0, import_row_height_presets.snapRowHeight)(rowHeight) : defaultRowHeight;
|
|
34
|
+
if (rowHeight === resolved) {
|
|
35
|
+
return settings;
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
...gridSettings,
|
|
39
|
+
rowHeight: resolved
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
43
|
+
0 && (module.exports = {
|
|
44
|
+
normalizeGridSettings
|
|
45
|
+
});
|
|
46
|
+
//# sourceMappingURL=normalize-grid-settings.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/utils/normalize-grid-settings/normalize-grid-settings.ts"],
|
|
4
|
+
"sourcesContent": ["import type { WidgetGridLayoutSettings, WidgetGridSettings } from '../../types';\nimport { snapRowHeight } from '../row-height-presets';\n\n/**\n * Coerces legacy grid row heights to a dashboard preset. Standard grid\n * rows always use uniform track sizing so tiles align with the masonry\n * model boundary.\n *\n * @param settings Grid settings to normalize.\n * @param defaultRowHeight Fallback row height when none is set.\n */\nexport function normalizeGridSettings(\n\tsettings: WidgetGridSettings,\n\tdefaultRowHeight: number\n): WidgetGridSettings {\n\tif ( ( settings.model ?? 'grid' ) === 'masonry' ) {\n\t\treturn settings;\n\t}\n\n\t// The guard above cannot narrow the union for TypeScript: `model` is\n\t// optional and the check goes through `??`.\n\tconst gridSettings = settings as WidgetGridLayoutSettings;\n\n\tconst rowHeight = gridSettings.rowHeight;\n\tconst resolved =\n\t\ttypeof rowHeight === 'number'\n\t\t\t? snapRowHeight( rowHeight )\n\t\t\t: defaultRowHeight;\n\n\tif ( rowHeight === resolved ) {\n\t\treturn settings;\n\t}\n\n\treturn {\n\t\t...gridSettings,\n\t\trowHeight: resolved,\n\t};\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,gCAA8B;AAUvB,SAAS,sBACf,UACA,kBACqB;AACrB,OAAO,SAAS,SAAS,YAAa,WAAY;AACjD,WAAO;AAAA,EACR;AAIA,QAAM,eAAe;AAErB,QAAM,YAAY,aAAa;AAC/B,QAAM,WACL,OAAO,cAAc,eAClB,yCAAe,SAAU,IACzB;AAEJ,MAAK,cAAc,UAAW;AAC7B,WAAO;AAAA,EACR;AAEA,SAAO;AAAA,IACN,GAAG;AAAA,IACH,WAAW;AAAA,EACZ;AACD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// packages/widget-dashboard/src/utils/resolve-dashboard-column-count/resolve-dashboard-column-count.ts
|
|
21
|
+
var resolve_dashboard_column_count_exports = {};
|
|
22
|
+
__export(resolve_dashboard_column_count_exports, {
|
|
23
|
+
WIDGET_DASHBOARD_CONTAINER_BREAKPOINT_ONE_COLUMN: () => WIDGET_DASHBOARD_CONTAINER_BREAKPOINT_ONE_COLUMN,
|
|
24
|
+
WIDGET_DASHBOARD_CONTAINER_BREAKPOINT_TWO_COLUMNS: () => WIDGET_DASHBOARD_CONTAINER_BREAKPOINT_TWO_COLUMNS,
|
|
25
|
+
resolveDashboardColumnCount: () => resolveDashboardColumnCount
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(resolve_dashboard_column_count_exports);
|
|
28
|
+
var import_types = require("../../types.cjs");
|
|
29
|
+
var WIDGET_DASHBOARD_CONTAINER_BREAKPOINT_ONE_COLUMN = 600;
|
|
30
|
+
var WIDGET_DASHBOARD_CONTAINER_BREAKPOINT_TWO_COLUMNS = 960;
|
|
31
|
+
function resolveDashboardColumnCount(containerWidth) {
|
|
32
|
+
if (containerWidth <= 0) {
|
|
33
|
+
return import_types.WIDGET_DASHBOARD_COLUMN_COUNT;
|
|
34
|
+
}
|
|
35
|
+
if (containerWidth < WIDGET_DASHBOARD_CONTAINER_BREAKPOINT_ONE_COLUMN) {
|
|
36
|
+
return 1;
|
|
37
|
+
}
|
|
38
|
+
if (containerWidth < WIDGET_DASHBOARD_CONTAINER_BREAKPOINT_TWO_COLUMNS) {
|
|
39
|
+
return 2;
|
|
40
|
+
}
|
|
41
|
+
return import_types.WIDGET_DASHBOARD_COLUMN_COUNT;
|
|
42
|
+
}
|
|
43
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
44
|
+
0 && (module.exports = {
|
|
45
|
+
WIDGET_DASHBOARD_CONTAINER_BREAKPOINT_ONE_COLUMN,
|
|
46
|
+
WIDGET_DASHBOARD_CONTAINER_BREAKPOINT_TWO_COLUMNS,
|
|
47
|
+
resolveDashboardColumnCount
|
|
48
|
+
});
|
|
49
|
+
//# sourceMappingURL=resolve-dashboard-column-count.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/utils/resolve-dashboard-column-count/resolve-dashboard-column-count.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport { WIDGET_DASHBOARD_COLUMN_COUNT } from '../../types';\n\n/**\n * Container width (px) below which the dashboard uses a single column.\n * Matches `@container widget-dashboard (max-width: …)` in widgets CSS.\n */\nexport const WIDGET_DASHBOARD_CONTAINER_BREAKPOINT_ONE_COLUMN = 600;\n\n/**\n * Container width (px) below which the dashboard drops from four columns\n * to two. Above this threshold (and below the four-column cap) the\n * grid uses {@link WIDGET_DASHBOARD_COLUMN_COUNT}.\n */\nexport const WIDGET_DASHBOARD_CONTAINER_BREAKPOINT_TWO_COLUMNS = 960;\n\n/**\n * Resolves the dashboard grid column count from the widget surface\n * container width. Uses discrete steps (4 → 2 → 1), not viewport\n * media queries.\n *\n * @param containerWidth Measured inline size of the dashboard grid container.\n * @return Column count for {@link @wordpress/grid} surfaces.\n */\nexport function resolveDashboardColumnCount( containerWidth: number ): number {\n\tif ( containerWidth <= 0 ) {\n\t\treturn WIDGET_DASHBOARD_COLUMN_COUNT;\n\t}\n\n\tif ( containerWidth < WIDGET_DASHBOARD_CONTAINER_BREAKPOINT_ONE_COLUMN ) {\n\t\treturn 1;\n\t}\n\n\tif ( containerWidth < WIDGET_DASHBOARD_CONTAINER_BREAKPOINT_TWO_COLUMNS ) {\n\t\treturn 2;\n\t}\n\n\treturn WIDGET_DASHBOARD_COLUMN_COUNT;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,mBAA8C;AAMvC,IAAM,mDAAmD;AAOzD,IAAM,oDAAoD;AAU1D,SAAS,4BAA6B,gBAAiC;AAC7E,MAAK,kBAAkB,GAAI;AAC1B,WAAO;AAAA,EACR;AAEA,MAAK,iBAAiB,kDAAmD;AACxE,WAAO;AAAA,EACR;AAEA,MAAK,iBAAiB,mDAAoD;AACzE,WAAO;AAAA,EACR;AAEA,SAAO;AACR;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// packages/widget-dashboard/src/utils/row-height-presets/index.ts
|
|
21
|
+
var row_height_presets_exports = {};
|
|
22
|
+
__export(row_height_presets_exports, {
|
|
23
|
+
DEFAULT_ROW_HEIGHT: () => import_row_height_presets.DEFAULT_ROW_HEIGHT,
|
|
24
|
+
ROW_HEIGHT_PRESETS: () => import_row_height_presets.ROW_HEIGHT_PRESETS,
|
|
25
|
+
presetToRowHeight: () => import_row_height_presets.presetToRowHeight,
|
|
26
|
+
rowHeightToPreset: () => import_row_height_presets.rowHeightToPreset,
|
|
27
|
+
snapRowHeight: () => import_row_height_presets.snapRowHeight
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(row_height_presets_exports);
|
|
30
|
+
var import_row_height_presets = require("./row-height-presets.cjs");
|
|
31
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
32
|
+
0 && (module.exports = {
|
|
33
|
+
DEFAULT_ROW_HEIGHT,
|
|
34
|
+
ROW_HEIGHT_PRESETS,
|
|
35
|
+
presetToRowHeight,
|
|
36
|
+
rowHeightToPreset,
|
|
37
|
+
snapRowHeight
|
|
38
|
+
});
|
|
39
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/utils/row-height-presets/index.ts"],
|
|
4
|
+
"sourcesContent": ["export {\n\tDEFAULT_ROW_HEIGHT,\n\tROW_HEIGHT_PRESETS,\n\tpresetToRowHeight,\n\trowHeightToPreset,\n\tsnapRowHeight,\n} from './row-height-presets';\nexport type { RowHeightPreset } from './row-height-presets';\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gCAMO;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// packages/widget-dashboard/src/utils/row-height-presets/row-height-presets.ts
|
|
21
|
+
var row_height_presets_exports = {};
|
|
22
|
+
__export(row_height_presets_exports, {
|
|
23
|
+
DEFAULT_ROW_HEIGHT: () => DEFAULT_ROW_HEIGHT,
|
|
24
|
+
ROW_HEIGHT_PRESETS: () => ROW_HEIGHT_PRESETS,
|
|
25
|
+
presetToRowHeight: () => presetToRowHeight,
|
|
26
|
+
rowHeightToPreset: () => rowHeightToPreset,
|
|
27
|
+
snapRowHeight: () => snapRowHeight
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(row_height_presets_exports);
|
|
30
|
+
var ROW_HEIGHT_PRESETS = {
|
|
31
|
+
small: 200,
|
|
32
|
+
medium: 300,
|
|
33
|
+
large: 400
|
|
34
|
+
};
|
|
35
|
+
var DEFAULT_ROW_HEIGHT = ROW_HEIGHT_PRESETS.medium;
|
|
36
|
+
var PRESET_ENTRIES = Object.entries(ROW_HEIGHT_PRESETS);
|
|
37
|
+
function rowHeightToPreset(rowHeight) {
|
|
38
|
+
let closest = "medium";
|
|
39
|
+
let minDistance = Infinity;
|
|
40
|
+
for (const [preset, value] of PRESET_ENTRIES) {
|
|
41
|
+
const distance = Math.abs(rowHeight - value);
|
|
42
|
+
if (distance < minDistance) {
|
|
43
|
+
minDistance = distance;
|
|
44
|
+
closest = preset;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return closest;
|
|
48
|
+
}
|
|
49
|
+
function presetToRowHeight(preset) {
|
|
50
|
+
return ROW_HEIGHT_PRESETS[preset];
|
|
51
|
+
}
|
|
52
|
+
function snapRowHeight(rowHeight) {
|
|
53
|
+
return presetToRowHeight(rowHeightToPreset(rowHeight));
|
|
54
|
+
}
|
|
55
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
56
|
+
0 && (module.exports = {
|
|
57
|
+
DEFAULT_ROW_HEIGHT,
|
|
58
|
+
ROW_HEIGHT_PRESETS,
|
|
59
|
+
presetToRowHeight,
|
|
60
|
+
rowHeightToPreset,
|
|
61
|
+
snapRowHeight
|
|
62
|
+
});
|
|
63
|
+
//# sourceMappingURL=row-height-presets.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/utils/row-height-presets/row-height-presets.ts"],
|
|
4
|
+
"sourcesContent": ["export const ROW_HEIGHT_PRESETS = {\n\tsmall: 200,\n\tmedium: 300,\n\tlarge: 400,\n} as const;\n\nexport type RowHeightPreset = keyof typeof ROW_HEIGHT_PRESETS;\n\nexport const DEFAULT_ROW_HEIGHT = ROW_HEIGHT_PRESETS.medium;\n\nconst PRESET_ENTRIES = Object.entries( ROW_HEIGHT_PRESETS ) as [\n\tRowHeightPreset,\n\tnumber,\n][];\n\n/**\n * Maps a stored pixel height to the nearest preset so legacy freeform\n * values still resolve to a valid toggle option.\n *\n * @param rowHeight Row height in pixels.\n */\nexport function rowHeightToPreset( rowHeight: number ): RowHeightPreset {\n\tlet closest: RowHeightPreset = 'medium';\n\tlet minDistance = Infinity;\n\n\tfor ( const [ preset, value ] of PRESET_ENTRIES ) {\n\t\tconst distance = Math.abs( rowHeight - value );\n\t\tif ( distance < minDistance ) {\n\t\t\tminDistance = distance;\n\t\t\tclosest = preset;\n\t\t}\n\t}\n\n\treturn closest;\n}\n\nexport function presetToRowHeight( preset: RowHeightPreset ): number {\n\treturn ROW_HEIGHT_PRESETS[ preset ];\n}\n\nexport function snapRowHeight( rowHeight: number ): number {\n\treturn presetToRowHeight( rowHeightToPreset( rowHeight ) );\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,IAAM,qBAAqB;AAAA,EACjC,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,OAAO;AACR;AAIO,IAAM,qBAAqB,mBAAmB;AAErD,IAAM,iBAAiB,OAAO,QAAS,kBAAmB;AAWnD,SAAS,kBAAmB,WAAqC;AACvE,MAAI,UAA2B;AAC/B,MAAI,cAAc;AAElB,aAAY,CAAE,QAAQ,KAAM,KAAK,gBAAiB;AACjD,UAAM,WAAW,KAAK,IAAK,YAAY,KAAM;AAC7C,QAAK,WAAW,aAAc;AAC7B,oBAAc;AACd,gBAAU;AAAA,IACX;AAAA,EACD;AAEA,SAAO;AACR;AAEO,SAAS,kBAAmB,QAAkC;AACpE,SAAO,mBAAoB,MAAO;AACnC;AAEO,SAAS,cAAe,WAA4B;AAC1D,SAAO,kBAAmB,kBAAmB,SAAU,CAAE;AAC1D;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// packages/widget-dashboard/src/widget-dashboard.tsx
|
|
21
|
+
var widget_dashboard_exports = {};
|
|
22
|
+
__export(widget_dashboard_exports, {
|
|
23
|
+
WidgetDashboard: () => WidgetDashboard
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(widget_dashboard_exports);
|
|
26
|
+
var import_dashboard_context = require("./context/dashboard-context.cjs");
|
|
27
|
+
var import_ui_context = require("./context/ui-context.cjs");
|
|
28
|
+
var import_actions = require("./components/actions/index.cjs");
|
|
29
|
+
var import_commands = require("./components/commands/index.cjs");
|
|
30
|
+
var import_layout_settings = require("./components/layout-settings/index.cjs");
|
|
31
|
+
var import_no_widgets_state = require("./components/no-widgets-state/index.cjs");
|
|
32
|
+
var import_reset_confirmation = require("./components/reset-confirmation/index.cjs");
|
|
33
|
+
var import_widget_chrome = require("./components/widget-chrome/index.cjs");
|
|
34
|
+
var import_widget_inserter = require("./components/widget-inserter/index.cjs");
|
|
35
|
+
var import_widget_settings = require("./components/widget-settings/index.cjs");
|
|
36
|
+
var import_widgets = require("./components/widgets/index.cjs");
|
|
37
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
38
|
+
var WidgetDashboard = Object.assign(
|
|
39
|
+
function WidgetDashboard2({
|
|
40
|
+
layout,
|
|
41
|
+
onLayoutChange,
|
|
42
|
+
onLayoutReset,
|
|
43
|
+
widgetTypes,
|
|
44
|
+
isResolvingWidgetTypes,
|
|
45
|
+
editMode,
|
|
46
|
+
onEditChange,
|
|
47
|
+
resolveWidgetModule,
|
|
48
|
+
gridSettings,
|
|
49
|
+
onGridSettingsChange,
|
|
50
|
+
children
|
|
51
|
+
}) {
|
|
52
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
53
|
+
import_dashboard_context.WidgetDashboardProvider,
|
|
54
|
+
{
|
|
55
|
+
layout,
|
|
56
|
+
onLayoutChange,
|
|
57
|
+
onLayoutReset,
|
|
58
|
+
widgetTypes,
|
|
59
|
+
isResolvingWidgetTypes,
|
|
60
|
+
editMode,
|
|
61
|
+
onEditChange,
|
|
62
|
+
resolveWidgetModule,
|
|
63
|
+
gridSettings,
|
|
64
|
+
onGridSettingsChange,
|
|
65
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ui_context.WidgetDashboardUIProvider, { children: [
|
|
66
|
+
children ?? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
67
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_no_widgets_state.NoWidgetsState, {}),
|
|
68
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_actions.Actions, {}),
|
|
69
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_widgets.Widgets, {}),
|
|
70
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_commands.Commands, {})
|
|
71
|
+
] }),
|
|
72
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_widget_inserter.WidgetInserter, {}),
|
|
73
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_layout_settings.LayoutSettings, {}),
|
|
74
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_widget_settings.WidgetSettings, {}),
|
|
75
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_reset_confirmation.ResetConfirmation, {})
|
|
76
|
+
] })
|
|
77
|
+
}
|
|
78
|
+
);
|
|
79
|
+
},
|
|
80
|
+
{ Actions: import_actions.Actions, Widgets: import_widgets.Widgets, WidgetChrome: import_widget_chrome.WidgetChrome, NoWidgetsState: import_no_widgets_state.NoWidgetsState, Commands: import_commands.Commands }
|
|
81
|
+
);
|
|
82
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
83
|
+
0 && (module.exports = {
|
|
84
|
+
WidgetDashboard
|
|
85
|
+
});
|
|
86
|
+
//# sourceMappingURL=widget-dashboard.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/widget-dashboard.tsx"],
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport { WidgetDashboardProvider } from './context/dashboard-context';\nimport { WidgetDashboardUIProvider } from './context/ui-context';\nimport { Actions } from './components/actions';\nimport { Commands } from './components/commands';\nimport { LayoutSettings } from './components/layout-settings';\nimport { NoWidgetsState } from './components/no-widgets-state';\nimport { ResetConfirmation } from './components/reset-confirmation';\nimport { WidgetChrome } from './components/widget-chrome';\nimport { WidgetInserter } from './components/widget-inserter';\nimport { WidgetSettings } from './components/widget-settings';\nimport { Widgets } from './components/widgets';\nimport type { WidgetDashboardProps } from './types';\n\n/**\n * Stateless rendering engine for widget dashboards.\n *\n * The consumer owns `layout` and `editMode` state; every mutation fires\n * `onLayoutChange` with the fully updated array. The engine never queries a\n * widget store; types flow in via the `widgetTypes` prop.\n *\n * ```tsx\n * import { WidgetDashboard } from '@wordpress/widget-dashboard';\n *\n * function MyDashboard() {\n * \tconst [ layout, setLayout ] = useState( defaultLayout );\n * \tconst [ editMode, setEditMode ] = useState( false );\n * \treturn (\n * \t\t<WidgetDashboard\n * \t\t\tlayout={ layout }\n * \t\t\tonLayoutChange={ setLayout }\n * \t\t\twidgetTypes={ widgetTypes }\n * \t\t\teditMode={ editMode }\n * \t\t\tonEditChange={ setEditMode }\n * \t\t>\n * \t\t\t<WidgetDashboard.NoWidgetsState>\n * \t\t\t\t<p>No widgets yet.</p>\n * \t\t\t</WidgetDashboard.NoWidgetsState>\n * \t\t\t<WidgetDashboard.Actions />\n * \t\t\t<WidgetDashboard.Widgets />\n * \t\t\t<WidgetDashboard.Commands />\n * \t\t</WidgetDashboard>\n * \t);\n * }\n * ```\n *\n * Children compose the dashboard's triggers and chrome: `Actions`,\n * `Widgets`, `Commands`, `NoWidgetsState`. The targets they open (the\n * widget inserter, the layout and widget settings editors, the reset\n * confirmation) are mounted by the engine and driven by shared UI state, so\n * a trigger works wherever it is composed without a matching target in the\n * tree. Omitting `children` renders the default arrangement.\n */\nexport const WidgetDashboard = Object.assign(\n\tfunction WidgetDashboard( {\n\t\tlayout,\n\t\tonLayoutChange,\n\t\tonLayoutReset,\n\t\twidgetTypes,\n\t\tisResolvingWidgetTypes,\n\t\teditMode,\n\t\tonEditChange,\n\t\tresolveWidgetModule,\n\t\tgridSettings,\n\t\tonGridSettingsChange,\n\t\tchildren,\n\t}: WidgetDashboardProps ) {\n\t\treturn (\n\t\t\t<WidgetDashboardProvider\n\t\t\t\tlayout={ layout }\n\t\t\t\tonLayoutChange={ onLayoutChange }\n\t\t\t\tonLayoutReset={ onLayoutReset }\n\t\t\t\twidgetTypes={ widgetTypes }\n\t\t\t\tisResolvingWidgetTypes={ isResolvingWidgetTypes }\n\t\t\t\teditMode={ editMode }\n\t\t\t\tonEditChange={ onEditChange }\n\t\t\t\tresolveWidgetModule={ resolveWidgetModule }\n\t\t\t\tgridSettings={ gridSettings }\n\t\t\t\tonGridSettingsChange={ onGridSettingsChange }\n\t\t\t>\n\t\t\t\t<WidgetDashboardUIProvider>\n\t\t\t\t\t{ children ?? (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<NoWidgetsState />\n\t\t\t\t\t\t\t<Actions />\n\t\t\t\t\t\t\t<Widgets />\n\t\t\t\t\t\t\t<Commands />\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\n\t\t\t\t\t<WidgetInserter />\n\t\t\t\t\t<LayoutSettings />\n\t\t\t\t\t<WidgetSettings />\n\t\t\t\t\t<ResetConfirmation />\n\t\t\t\t</WidgetDashboardUIProvider>\n\t\t\t</WidgetDashboardProvider>\n\t\t);\n\t},\n\t{ Actions, Widgets, WidgetChrome, NoWidgetsState, Commands }\n);\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,+BAAwC;AACxC,wBAA0C;AAC1C,qBAAwB;AACxB,sBAAyB;AACzB,6BAA+B;AAC/B,8BAA+B;AAC/B,gCAAkC;AAClC,2BAA6B;AAC7B,6BAA+B;AAC/B,6BAA+B;AAC/B,qBAAwB;AAuElB;AA7BC,IAAM,kBAAkB,OAAO;AAAA,EACrC,SAASA,iBAAiB;AAAA,IACzB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,GAA0B;AACzB,WACC;AAAA,MAAC;AAAA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QAEA,uDAAC,+CACE;AAAA,sBACD,4EACC;AAAA,wDAAC,0CAAe;AAAA,YAChB,4CAAC,0BAAQ;AAAA,YACT,4CAAC,0BAAQ;AAAA,YACT,4CAAC,4BAAS;AAAA,aACX;AAAA,UAGD,4CAAC,yCAAe;AAAA,UAChB,4CAAC,yCAAe;AAAA,UAChB,4CAAC,yCAAe;AAAA,UAChB,4CAAC,+CAAkB;AAAA,WACpB;AAAA;AAAA,IACD;AAAA,EAEF;AAAA,EACA,EAAE,iCAAS,iCAAS,iDAAc,wDAAgB,mCAAS;AAC5D;",
|
|
6
|
+
"names": ["WidgetDashboard"]
|
|
7
|
+
}
|