@wordpress/widget-dashboard 0.1.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 +228 -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,111 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { ResolveWidgetModule, WidgetType } from '@wordpress/widget-primitives';
|
|
3
|
+
import type { WidgetGridModel, WidgetGridSettings, DashboardWidget } from '../types';
|
|
4
|
+
type GridSettingsWithColumns = WidgetGridSettings & {
|
|
5
|
+
columns: number;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Rich state distributed to every compound component inside `WidgetDashboard`.
|
|
9
|
+
* Internal — compounds reach the full state via `useDashboardInternalContext()`.
|
|
10
|
+
*
|
|
11
|
+
* `layout`/`onLayoutChange` and `gridSettings`/`onGridSettingsChange` here
|
|
12
|
+
* operate on the staging layer, not the committed props. Mutations from
|
|
13
|
+
* compound children stay in staging until `commit` publishes them on the
|
|
14
|
+
* consumer.
|
|
15
|
+
*/
|
|
16
|
+
interface InternalDashboardContextValue {
|
|
17
|
+
widgetTypes: WidgetType[];
|
|
18
|
+
isResolvingWidgetTypes: boolean;
|
|
19
|
+
layout: DashboardWidget[];
|
|
20
|
+
onLayoutChange: (layout: DashboardWidget[]) => void;
|
|
21
|
+
onLayoutReset?: () => void;
|
|
22
|
+
gridSettings: GridSettingsWithColumns;
|
|
23
|
+
onGridSettingsChange: (gridSettings: WidgetGridSettings) => void;
|
|
24
|
+
canEditGridSettings: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Restores the staging copy of `gridSettings` to the package's
|
|
27
|
+
* built-in defaults. Does not touch the committed slice; the user
|
|
28
|
+
* must `commit` to publish the reset, or `cancel` to discard it.
|
|
29
|
+
*/
|
|
30
|
+
resetGridSettings: () => void;
|
|
31
|
+
/**
|
|
32
|
+
* Publishes staged slices that differ from their committed
|
|
33
|
+
* counterparts. By default also exits edit mode; pass
|
|
34
|
+
* `{ exitEditMode: false }` when committing from the layout
|
|
35
|
+
* settings drawer so customize mode stays active.
|
|
36
|
+
*/
|
|
37
|
+
commit: (options?: CommitOptions) => void;
|
|
38
|
+
/**
|
|
39
|
+
* Switches the layout model, updates staging, and publishes
|
|
40
|
+
* immediately — equivalent to changing the model in layout
|
|
41
|
+
* settings and clicking Save.
|
|
42
|
+
*/
|
|
43
|
+
commitGridModelChange: (targetModel: WidgetGridModel) => void;
|
|
44
|
+
/**
|
|
45
|
+
* Reverts staging slices. By default reverts both layout and grid
|
|
46
|
+
* settings and exits edit mode. Pass `{ exitEditMode: false }` when
|
|
47
|
+
* dismissing the layout settings drawer. Pass `{ revertLayout: false }`
|
|
48
|
+
* to revert only grid settings (preserves in-progress widget layout
|
|
49
|
+
* edits while customize mode is active).
|
|
50
|
+
*/
|
|
51
|
+
cancel: (options?: CancelOptions) => void;
|
|
52
|
+
hasUncommittedChanges: boolean;
|
|
53
|
+
editMode: boolean;
|
|
54
|
+
onEditChange?: (next: boolean) => void;
|
|
55
|
+
resolveWidgetModule: ResolveWidgetModule;
|
|
56
|
+
}
|
|
57
|
+
interface CommitOptions {
|
|
58
|
+
exitEditMode?: boolean;
|
|
59
|
+
}
|
|
60
|
+
interface CancelOptions {
|
|
61
|
+
exitEditMode?: boolean;
|
|
62
|
+
revertLayout?: boolean;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Compound-internal hook — exposes the full provider state.
|
|
66
|
+
* Not part of the public API; lives in the same module
|
|
67
|
+
* so compound components can reach the state directly.
|
|
68
|
+
*/
|
|
69
|
+
export declare function useDashboardInternalContext(): InternalDashboardContextValue;
|
|
70
|
+
interface ProviderProps {
|
|
71
|
+
widgetTypes: WidgetType[];
|
|
72
|
+
isResolvingWidgetTypes?: boolean;
|
|
73
|
+
layout: DashboardWidget[];
|
|
74
|
+
/**
|
|
75
|
+
* Fired on commit when the staged layout differs from `layout`.
|
|
76
|
+
*/
|
|
77
|
+
onLayoutChange: (layout: DashboardWidget[]) => void;
|
|
78
|
+
/**
|
|
79
|
+
* Optional reset action surfaced by the bundled `Actions`.
|
|
80
|
+
*/
|
|
81
|
+
onLayoutReset?: () => void;
|
|
82
|
+
editMode?: boolean;
|
|
83
|
+
onEditChange?: (next: boolean) => void;
|
|
84
|
+
/**
|
|
85
|
+
* Overrides the default `import()` resolution of
|
|
86
|
+
* `WidgetType.renderModule`.
|
|
87
|
+
*/
|
|
88
|
+
resolveWidgetModule?: ResolveWidgetModule;
|
|
89
|
+
gridSettings?: WidgetGridSettings;
|
|
90
|
+
/**
|
|
91
|
+
* Fired on commit when the staged settings differ from
|
|
92
|
+
* `gridSettings`.
|
|
93
|
+
*/
|
|
94
|
+
onGridSettingsChange?: (gridSettings: WidgetGridSettings) => void;
|
|
95
|
+
children: ReactNode;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Provider for the dashboard's staging layer. Owns staging copies of
|
|
99
|
+
* `layout` and `gridSettings`; `commit` publishes whichever slice
|
|
100
|
+
* differs from its committed prop, `cancel` reverts both.
|
|
101
|
+
*
|
|
102
|
+
* Staging re-syncs from the committed props on prop change. In-flight
|
|
103
|
+
* edits are dropped silently when an external update (cross-tab commit,
|
|
104
|
+
* reset, websocket push) lands. Consumers that cannot tolerate this
|
|
105
|
+
* loss should mediate the prop updates before forwarding them here.
|
|
106
|
+
*
|
|
107
|
+
* @param {ProviderProps} props Component props.
|
|
108
|
+
*/
|
|
109
|
+
export declare function WidgetDashboardProvider({ widgetTypes, isResolvingWidgetTypes, layout: committedLayout, onLayoutChange, onLayoutReset, editMode, onEditChange, resolveWidgetModule, gridSettings: committedGridSettings, onGridSettingsChange, children }: ProviderProps): React.ReactNode;
|
|
110
|
+
export {};
|
|
111
|
+
//# sourceMappingURL=dashboard-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dashboard-context.d.ts","sourceRoot":"","sources":["../../src/context/dashboard-context.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAavC,OAAO,KAAK,EACX,mBAAmB,EACnB,UAAU,EACV,MAAM,8BAA8B,CAAC;AAStC,OAAO,KAAK,EACX,eAAe,EACf,kBAAkB,EAClB,eAAe,EACf,MAAM,UAAU,CAAC;AAGlB,KAAK,uBAAuB,GAAG,kBAAkB,GAAG;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AA0CxE;;;;;;;;GAQG;AACH,UAAU,6BAA6B;IACtC,WAAW,EAAE,UAAU,EAAE,CAAC;IAC1B,sBAAsB,EAAE,OAAO,CAAC;IAChC,MAAM,EAAE,eAAe,EAAE,CAAC;IAC1B,cAAc,EAAE,CAAE,MAAM,EAAE,eAAe,EAAE,KAAM,IAAI,CAAC;IACtD,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B,YAAY,EAAE,uBAAuB,CAAC;IACtC,oBAAoB,EAAE,CAAE,YAAY,EAAE,kBAAkB,KAAM,IAAI,CAAC;IACnE,mBAAmB,EAAE,OAAO,CAAC;IAE7B;;;;OAIG;IACH,iBAAiB,EAAE,MAAM,IAAI,CAAC;IAE9B;;;;;OAKG;IACH,MAAM,EAAE,CAAE,OAAO,CAAC,EAAE,aAAa,KAAM,IAAI,CAAC;IAE5C;;;;OAIG;IACH,qBAAqB,EAAE,CAAE,WAAW,EAAE,eAAe,KAAM,IAAI,CAAC;IAEhE;;;;;;OAMG;IACH,MAAM,EAAE,CAAE,OAAO,CAAC,EAAE,aAAa,KAAM,IAAI,CAAC;IAE5C,qBAAqB,EAAE,OAAO,CAAC;IAC/B,QAAQ,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,CAAE,IAAI,EAAE,OAAO,KAAM,IAAI,CAAC;IACzC,mBAAmB,EAAE,mBAAmB,CAAC;CACzC;AAED,UAAU,aAAa;IACtB,YAAY,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,UAAU,aAAa;IACtB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,YAAY,CAAC,EAAE,OAAO,CAAC;CACvB;AAID;;;;GAIG;AACH,wBAAgB,2BAA2B,IAAI,6BAA6B,CAQ3E;AAED,UAAU,aAAa;IACtB,WAAW,EAAE,UAAU,EAAE,CAAC;IAC1B,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,MAAM,EAAE,eAAe,EAAE,CAAC;IAE1B;;OAEG;IACH,cAAc,EAAE,CAAE,MAAM,EAAE,eAAe,EAAE,KAAM,IAAI,CAAC;IAEtD;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAE3B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,CAAE,IAAI,EAAE,OAAO,KAAM,IAAI,CAAC;IAEzC;;;OAGG;IACH,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAE1C,YAAY,CAAC,EAAE,kBAAkB,CAAC;IAElC;;;OAGG;IACH,oBAAoB,CAAC,EAAE,CAAE,YAAY,EAAE,kBAAkB,KAAM,IAAI,CAAC;IAEpE,QAAQ,EAAE,SAAS,CAAC;CACpB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,uBAAuB,CAAE,EACxC,WAAW,EACX,sBAA8B,EAC9B,MAAM,EAAE,eAAe,EACvB,cAAc,EACd,aAAa,EACb,QAAgB,EAChB,YAAY,EACZ,mBAAmD,EACnD,YAAY,EAAE,qBAAoC,EAClD,oBAAoB,EACpB,QAAQ,EACR,EAAE,aAAa,GAAI,KAAK,CAAC,SAAS,CAsKlC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import type { ReactNode } from 'react';
|
|
5
|
+
type DrawerSide = 'left' | 'right';
|
|
6
|
+
interface DashboardUIContextValue {
|
|
7
|
+
inserterOpen: boolean;
|
|
8
|
+
setInserterOpen: (next: boolean) => void;
|
|
9
|
+
layoutSettingsOpen: boolean;
|
|
10
|
+
setLayoutSettingsOpen: (next: boolean) => void;
|
|
11
|
+
resetDialogOpen: boolean;
|
|
12
|
+
setResetDialogOpen: (next: boolean) => void;
|
|
13
|
+
/**
|
|
14
|
+
* `uuid` of the instance whose settings drawer is open, or `null`
|
|
15
|
+
* when no settings drawer is showing. The per-instance gear in the
|
|
16
|
+
* chrome sets it; the single `WidgetSettings` at the root reads
|
|
17
|
+
* it.
|
|
18
|
+
*/
|
|
19
|
+
settingsWidgetUuid: string | null;
|
|
20
|
+
setSettingsWidgetUuid: (next: string | null) => void;
|
|
21
|
+
/**
|
|
22
|
+
* Edge the settings drawer slides in from. The gear sets it from the
|
|
23
|
+
* widget's on-screen position so the drawer opens on the side away
|
|
24
|
+
* from the widget, trying not to cover it.
|
|
25
|
+
*/
|
|
26
|
+
settingsDrawerSide: DrawerSide;
|
|
27
|
+
setSettingsDrawerSide: (next: DrawerSide) => void;
|
|
28
|
+
/**
|
|
29
|
+
* Inline-start inset (px) the settings drawer is offset by when it
|
|
30
|
+
* opens from the left, so it clears fixed page chrome (the WordPress
|
|
31
|
+
* admin menu) instead of sliding over it. `0` when there's nothing to
|
|
32
|
+
* clear.
|
|
33
|
+
*/
|
|
34
|
+
settingsDrawerInset: number;
|
|
35
|
+
setSettingsDrawerInset: (next: number) => void;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Accesses the shared UI state: overlay open flags and the active settings
|
|
39
|
+
* instance with its placement. Throws when called outside `WidgetDashboard`.
|
|
40
|
+
*/
|
|
41
|
+
export declare function useDashboardUIContext(): DashboardUIContextValue;
|
|
42
|
+
interface ProviderProps {
|
|
43
|
+
children: ReactNode;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Holds transient UI state shared across compounds (the inserter modal and
|
|
47
|
+
* the per-instance settings drawer). Kept separate from the data context so
|
|
48
|
+
* that data mutations don't churn the UI state and vice-versa.
|
|
49
|
+
*
|
|
50
|
+
* @param {ProviderProps} props Component props.
|
|
51
|
+
*/
|
|
52
|
+
export declare function WidgetDashboardUIProvider({ children }: ProviderProps): import("react").JSX.Element;
|
|
53
|
+
export {};
|
|
54
|
+
//# sourceMappingURL=ui-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui-context.d.ts","sourceRoot":"","sources":["../../src/context/ui-context.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAYvC,KAAK,UAAU,GAAG,MAAM,GAAG,OAAO,CAAC;AAEnC,UAAU,uBAAuB;IAChC,YAAY,EAAE,OAAO,CAAC;IACtB,eAAe,EAAE,CAAE,IAAI,EAAE,OAAO,KAAM,IAAI,CAAC;IAE3C,kBAAkB,EAAE,OAAO,CAAC;IAC5B,qBAAqB,EAAE,CAAE,IAAI,EAAE,OAAO,KAAM,IAAI,CAAC;IACjD,eAAe,EAAE,OAAO,CAAC;IACzB,kBAAkB,EAAE,CAAE,IAAI,EAAE,OAAO,KAAM,IAAI,CAAC;IAE9C;;;;;OAKG;IACH,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,qBAAqB,EAAE,CAAE,IAAI,EAAE,MAAM,GAAG,IAAI,KAAM,IAAI,CAAC;IAEvD;;;;OAIG;IACH,kBAAkB,EAAE,UAAU,CAAC;IAC/B,qBAAqB,EAAE,CAAE,IAAI,EAAE,UAAU,KAAM,IAAI,CAAC;IAEpD;;;;;OAKG;IACH,mBAAmB,EAAE,MAAM,CAAC;IAC5B,sBAAsB,EAAE,CAAE,IAAI,EAAE,MAAM,KAAM,IAAI,CAAC;CACjD;AAID;;;GAGG;AACH,wBAAgB,qBAAqB,IAAI,uBAAuB,CAQ/D;AAED,UAAU,aAAa;IACtB,QAAQ,EAAE,SAAS,CAAC;CACpB;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAE,EAAE,QAAQ,EAAE,EAAE,aAAa,+BAqCrE"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import type { ReactNode } from 'react';
|
|
5
|
+
/**
|
|
6
|
+
* Internal dependencies
|
|
7
|
+
*/
|
|
8
|
+
import type { WidgetContextValue } from '../types';
|
|
9
|
+
interface ProviderProps {
|
|
10
|
+
value: WidgetContextValue;
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Provides the current widget's identity to its render subtree.
|
|
15
|
+
*
|
|
16
|
+
* @param {ProviderProps} props Component props.
|
|
17
|
+
*/
|
|
18
|
+
export declare function WidgetContextProvider({ value, children }: ProviderProps): React.ReactNode;
|
|
19
|
+
/**
|
|
20
|
+
* Returns the current widget's identity (`uuid`, `name`, `index`). Returns
|
|
21
|
+
* `null` when called outside a widget render subtree.
|
|
22
|
+
*/
|
|
23
|
+
export declare function useWidgetContext(): WidgetContextValue | null;
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=widget-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"widget-context.d.ts","sourceRoot":"","sources":["../../src/context/widget-context.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAOvC;;GAEG;AACH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAInD,UAAU,aAAa;IACtB,KAAK,EAAE,kBAAkB,CAAC;IAC1B,QAAQ,EAAE,SAAS,CAAC;CACpB;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAE,EACtC,KAAK,EACL,QAAQ,EACR,EAAE,aAAa,GAAI,KAAK,CAAC,SAAS,CAMlC;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,kBAAkB,GAAG,IAAI,CAE5D"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type Ref } from '@wordpress/element';
|
|
2
|
+
interface UseDashboardContainerColumnCountResult {
|
|
3
|
+
containerRef: Ref<HTMLDivElement>;
|
|
4
|
+
columnCount: number;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Tracks the dashboard grid container width and maps it to an opinionated
|
|
8
|
+
* column count (4 → 2 → 1). Measurement is container-based via
|
|
9
|
+
* `ResizeObserver`, not viewport media queries.
|
|
10
|
+
*
|
|
11
|
+
* @param {Ref< HTMLDivElement >} [forwardedRef] Ref forwarded from the grid wrapper.
|
|
12
|
+
*/
|
|
13
|
+
export declare function useDashboardContainerColumnCount(forwardedRef?: Ref<HTMLDivElement>): UseDashboardContainerColumnCountResult;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=use-dashboard-container-column-count.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-dashboard-container-column-count.d.ts","sourceRoot":"","sources":["../../src/hooks/use-dashboard-container-column-count.ts"],"names":[],"mappings":"AAIA,OAAO,EAIN,KAAK,GAAG,EACR,MAAM,oBAAoB,CAAC;AAO5B,UAAU,sCAAsC;IAC/C,YAAY,EAAE,GAAG,CAAE,cAAc,CAAE,CAAC;IACpC,WAAW,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;GAMG;AACH,wBAAgB,gCAAgC,CAC/C,YAAY,CAAC,EAAE,GAAG,CAAE,cAAc,CAAE,GAClC,sCAAsC,CAgCxC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { WidgetDashboard } from './widget-dashboard';
|
|
2
|
+
export type { DashboardWidget, WidgetGridSettings } from './types';
|
|
3
|
+
export { WIDGET_DASHBOARD_COLUMN_COUNT } from './types';
|
|
4
|
+
export { DEFAULT_GRID } from './utils/default-grid';
|
|
5
|
+
export { normalizeGridSettings } from './utils/normalize-grid-settings';
|
|
6
|
+
export { ROW_HEIGHT_PRESETS, DEFAULT_ROW_HEIGHT, } from './utils/row-height-presets';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,YAAY,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AACnE,OAAO,EAAE,6BAA6B,EAAE,MAAM,SAAS,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EACN,kBAAkB,EAClB,kBAAkB,GAClB,MAAM,4BAA4B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lock-unlock.d.ts","sourceRoot":"","sources":["../src/lock-unlock.ts"],"names":[],"mappings":"AAKA,eAAO,MAAQ,IAAI,mDAAE,MAAM,iCAIzB,CAAC"}
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dashboard-specific types: `DashboardWidget`, grid settings, and the
|
|
3
|
+
* `WidgetDashboard` prop bag.
|
|
4
|
+
*
|
|
5
|
+
* The widget contract types (`WidgetName`, `WidgetType`, `WidgetRenderProps`,
|
|
6
|
+
* `ResolveWidgetModule`) live in `@wordpress/widget-primitives` and are
|
|
7
|
+
* imported from there directly; this module does not re-export them.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* External dependencies
|
|
11
|
+
*/
|
|
12
|
+
import type { ReactNode } from 'react';
|
|
13
|
+
/**
|
|
14
|
+
* WordPress dependencies
|
|
15
|
+
*/
|
|
16
|
+
import type { DashboardGridLayoutItem, DashboardLanesLayoutItem } from '@wordpress/grid';
|
|
17
|
+
import type { WidgetName, WidgetType, ResolveWidgetModule } from '@wordpress/widget-primitives';
|
|
18
|
+
export type GridTilePlacement = Omit<DashboardGridLayoutItem, 'key'>;
|
|
19
|
+
export type MasonryTilePlacement = Omit<DashboardLanesLayoutItem, 'key'>;
|
|
20
|
+
/**
|
|
21
|
+
* Storage shape for a widget's placement.
|
|
22
|
+
*
|
|
23
|
+
* Structurally a union of every supported per-model shape, but the
|
|
24
|
+
* intended invariant is stronger than the type suggests: every
|
|
25
|
+
* placement in a given layout must match the shape of the currently
|
|
26
|
+
* active `gridSettings.model`. `migrateLayout` is the only correct
|
|
27
|
+
* way to transition placements across model changes; the render
|
|
28
|
+
* layer is allowed to trust the active model and treat each
|
|
29
|
+
* placement as the matching shape.
|
|
30
|
+
*
|
|
31
|
+
* The type system cannot enforce that invariant on its own (there is
|
|
32
|
+
* no discriminator on the placement itself), so consider this union a
|
|
33
|
+
* declaration of which shapes are *valid*, not which shape any given
|
|
34
|
+
* placement happens to be at runtime.
|
|
35
|
+
*/
|
|
36
|
+
export type DashboardTilePlacement = GridTilePlacement | MasonryTilePlacement;
|
|
37
|
+
/**
|
|
38
|
+
* A widget placed on the dashboard.
|
|
39
|
+
*
|
|
40
|
+
* A `WidgetType` describes the blueprint. A `DashboardWidget` is a
|
|
41
|
+
* concrete placement of that type on a specific dashboard: its unique
|
|
42
|
+
* id, the type it references, user-configured attributes, and its
|
|
43
|
+
* `placement` in the grid.
|
|
44
|
+
*/
|
|
45
|
+
export interface DashboardWidget<Item = unknown> {
|
|
46
|
+
/**
|
|
47
|
+
* Unique instance identifier.
|
|
48
|
+
*/
|
|
49
|
+
uuid: string;
|
|
50
|
+
/**
|
|
51
|
+
* Widget type name — must match a `WidgetType.name` in `widgetTypes`.
|
|
52
|
+
*/
|
|
53
|
+
type: WidgetName;
|
|
54
|
+
/**
|
|
55
|
+
* User-configured attributes for this instance.
|
|
56
|
+
*/
|
|
57
|
+
attributes?: Item;
|
|
58
|
+
/**
|
|
59
|
+
* Grid-model-specific placement (column/row spans, ordering,
|
|
60
|
+
* etc.). Must match the shape implied by the dashboard's active
|
|
61
|
+
* `gridSettings.model`; see `DashboardTilePlacement` for the
|
|
62
|
+
* invariant and `migrateLayout` for the transition mechanism.
|
|
63
|
+
*/
|
|
64
|
+
placement?: DashboardTilePlacement;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Identity of a widget within the rendering tree. Returned by
|
|
68
|
+
* `useWidgetContext()`; `null` when called outside a widget render subtree.
|
|
69
|
+
*/
|
|
70
|
+
export interface WidgetContextValue {
|
|
71
|
+
/**
|
|
72
|
+
* Widget instance id.
|
|
73
|
+
*/
|
|
74
|
+
uuid: string;
|
|
75
|
+
/**
|
|
76
|
+
* Widget type name.
|
|
77
|
+
*/
|
|
78
|
+
name: WidgetName;
|
|
79
|
+
/**
|
|
80
|
+
* Index of the widget in the `layout` array.
|
|
81
|
+
*/
|
|
82
|
+
index: number;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Identifier for the active grid model. Drives which `@wordpress/grid`
|
|
86
|
+
* surface the dashboard mounts and which per-model settings the
|
|
87
|
+
* `WidgetGridSettings` union admits.
|
|
88
|
+
*
|
|
89
|
+
* Model names describe user-facing concepts. The mapping to the
|
|
90
|
+
* underlying `@wordpress/grid` component is an implementation detail
|
|
91
|
+
* resolved in the render layer; `'masonry'` is rendered today through
|
|
92
|
+
* `DashboardLanes` (skyline placement) but could swap to a future
|
|
93
|
+
* native `display: grid-lanes` path without affecting the model name.
|
|
94
|
+
*/
|
|
95
|
+
export type WidgetGridModel = 'grid' | 'masonry';
|
|
96
|
+
/**
|
|
97
|
+
* Maximum column count for the widget dashboard on wide containers.
|
|
98
|
+
* Not exposed in layout settings; container width steps the count down
|
|
99
|
+
* to two and one column at fixed breakpoints.
|
|
100
|
+
*/
|
|
101
|
+
export declare const WIDGET_DASHBOARD_COLUMN_COUNT = 4;
|
|
102
|
+
/**
|
|
103
|
+
* Settings common to every grid model. Column count is resolved from
|
|
104
|
+
* the dashboard container width (see
|
|
105
|
+
* `utils/resolve-dashboard-column-count`). `columns` and `minColumnWidth`
|
|
106
|
+
* on this type remain for persisted payloads and `@wordpress/grid`
|
|
107
|
+
* compatibility; the dashboard ignores user-facing values for both.
|
|
108
|
+
*
|
|
109
|
+
* `spacing` is intentionally absent: the gap between tiles is
|
|
110
|
+
* presentational and lives with the design-system theme/density, not
|
|
111
|
+
* with per-dashboard settings. The grid surface keeps the prop for
|
|
112
|
+
* programmatic overrides, but the dashboard does not propagate it.
|
|
113
|
+
*/
|
|
114
|
+
interface BaseWidgetGridSettings {
|
|
115
|
+
/**
|
|
116
|
+
* Target column count (cap). The dashboard always uses
|
|
117
|
+
* {@link WIDGET_DASHBOARD_COLUMN_COUNT}; persisted values are ignored.
|
|
118
|
+
*/
|
|
119
|
+
columns?: number;
|
|
120
|
+
/**
|
|
121
|
+
* Per-tile minimum width in pixels. Unused by the dashboard; column
|
|
122
|
+
* count is derived from container width instead.
|
|
123
|
+
*/
|
|
124
|
+
minColumnWidth?: number;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* 2D packed grid settings. Items declare explicit width and height
|
|
128
|
+
* spans; rows use a uniform track height via `rowHeight`.
|
|
129
|
+
*/
|
|
130
|
+
export interface WidgetGridLayoutSettings extends BaseWidgetGridSettings {
|
|
131
|
+
model?: 'grid';
|
|
132
|
+
/**
|
|
133
|
+
* Row height in pixels (`200` small, `300` medium, `400` large). Every
|
|
134
|
+
* tile in a row fills the row vertically.
|
|
135
|
+
*/
|
|
136
|
+
rowHeight?: number;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Masonry settings. Heights are content-driven; resize is
|
|
140
|
+
* horizontal-only. `flowTolerance` tunes how aggressively the placer
|
|
141
|
+
* preserves source order vs. minimizing empty regions.
|
|
142
|
+
*/
|
|
143
|
+
export interface WidgetMasonryLayoutSettings extends BaseWidgetGridSettings {
|
|
144
|
+
model: 'masonry';
|
|
145
|
+
/**
|
|
146
|
+
* Pixel tolerance for source-order tiebreaking when two candidate
|
|
147
|
+
* columns have similar baselines.
|
|
148
|
+
*/
|
|
149
|
+
flowTolerance?: number;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Discriminated union of supported grid-model configurations.
|
|
153
|
+
*
|
|
154
|
+
* When `model` is omitted the dashboard treats the settings as the
|
|
155
|
+
* 2D packed grid (`'grid'`) for backwards compatibility with the
|
|
156
|
+
* pre-union shape.
|
|
157
|
+
*/
|
|
158
|
+
export type WidgetGridSettings = WidgetGridLayoutSettings | WidgetMasonryLayoutSettings;
|
|
159
|
+
/**
|
|
160
|
+
* Props for `WidgetDashboard`.
|
|
161
|
+
*
|
|
162
|
+
* The consumer owns the committed layout state; the dashboard maintains
|
|
163
|
+
* a staging copy internally for in-progress edits, and `onLayoutChange`
|
|
164
|
+
* fires only when the user commits via the Done action.
|
|
165
|
+
*/
|
|
166
|
+
export interface WidgetDashboardProps {
|
|
167
|
+
/**
|
|
168
|
+
* Widget instances to render. Consumer owns this state.
|
|
169
|
+
*/
|
|
170
|
+
layout: DashboardWidget[];
|
|
171
|
+
/**
|
|
172
|
+
* Called when the user commits in-progress edits via the Done action.
|
|
173
|
+
* Receives the full layout array as it should be persisted. In-progress
|
|
174
|
+
* mutations (reorder, resize, add, remove, attribute edits) accumulate
|
|
175
|
+
* in the dashboard's internal staging layer and do not fire this
|
|
176
|
+
* callback until commit.
|
|
177
|
+
*/
|
|
178
|
+
onLayoutChange: (layout: DashboardWidget[]) => void;
|
|
179
|
+
/**
|
|
180
|
+
* Called when the layout is reset to the default.
|
|
181
|
+
*/
|
|
182
|
+
onLayoutReset?: () => void;
|
|
183
|
+
/**
|
|
184
|
+
* Widget types available for rendering. The dashboard never queries a
|
|
185
|
+
* store directly — consumers scope and filter via this prop.
|
|
186
|
+
*/
|
|
187
|
+
widgetTypes: WidgetType[];
|
|
188
|
+
/**
|
|
189
|
+
* When true, widget types are still loading. Instances whose type is
|
|
190
|
+
* not yet in `widgetTypes` show a loading state instead of missing.
|
|
191
|
+
*/
|
|
192
|
+
isResolvingWidgetTypes?: boolean;
|
|
193
|
+
/**
|
|
194
|
+
* Whether the dashboard is in edit mode (enables drag/resize).
|
|
195
|
+
*/
|
|
196
|
+
editMode?: boolean;
|
|
197
|
+
/**
|
|
198
|
+
* Called when edit mode toggles via `WidgetDashboard.Actions`.
|
|
199
|
+
*/
|
|
200
|
+
onEditChange?: (next: boolean) => void;
|
|
201
|
+
/**
|
|
202
|
+
* Overrides the default `import()` resolution of
|
|
203
|
+
* `WidgetType.renderModule`. Useful for tests, Storybook, or future
|
|
204
|
+
* remote-URL loading.
|
|
205
|
+
*/
|
|
206
|
+
resolveWidgetModule?: ResolveWidgetModule;
|
|
207
|
+
/**
|
|
208
|
+
* Grid model configuration. See `WidgetGridSettings` for the shape.
|
|
209
|
+
*/
|
|
210
|
+
gridSettings?: WidgetGridSettings;
|
|
211
|
+
/**
|
|
212
|
+
* Called when the user commits in-progress grid-settings edits via
|
|
213
|
+
* the Done action. The dashboard maintains a staging copy of
|
|
214
|
+
* settings internally; mutations stay local until commit. When
|
|
215
|
+
* omitted, the `Layout settings` button in the customize toolbar is
|
|
216
|
+
* hidden, since there is nowhere to persist the change.
|
|
217
|
+
*/
|
|
218
|
+
onGridSettingsChange?: (gridSettings: WidgetGridSettings) => void;
|
|
219
|
+
children?: ReactNode;
|
|
220
|
+
}
|
|
221
|
+
export {};
|
|
222
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;GAEG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC;;GAEG;AACH,OAAO,KAAK,EACX,uBAAuB,EACvB,wBAAwB,EACxB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EACX,UAAU,EACV,UAAU,EACV,mBAAmB,EACnB,MAAM,8BAA8B,CAAC;AAEtC,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAE,uBAAuB,EAAE,KAAK,CAAE,CAAC;AACvE,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAE,wBAAwB,EAAE,KAAK,CAAE,CAAC;AAE3E;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,sBAAsB,GAAG,iBAAiB,GAAG,oBAAoB,CAAC;AAE9E;;;;;;;GAOG;AACH,MAAM,WAAW,eAAe,CAAE,IAAI,GAAG,OAAO;IAC/C;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,IAAI,EAAE,UAAU,CAAC;IAEjB;;OAEG;IACH,UAAU,CAAC,EAAE,IAAI,CAAC;IAElB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,sBAAsB,CAAC;CACnC;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IAClC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,IAAI,EAAE,UAAU,CAAC;IAEjB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;;;;GAUG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,SAAS,CAAC;AAEjD;;;;GAIG;AACH,eAAO,MAAM,6BAA6B,IAAI,CAAC;AAE/C;;;;;;;;;;;GAWG;AACH,UAAU,sBAAsB;IAC/B;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;GAGG;AACH,MAAM,WAAW,wBAAyB,SAAQ,sBAAsB;IACvE,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;GAIG;AACH,MAAM,WAAW,2BAA4B,SAAQ,sBAAsB;IAC1E,KAAK,EAAE,SAAS,CAAC;IAEjB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;GAMG;AACH,MAAM,MAAM,kBAAkB,GAC3B,wBAAwB,GACxB,2BAA2B,CAAC;AAE/B;;;;;;GAMG;AACH,MAAM,WAAW,oBAAoB;IACpC;;OAEG;IACH,MAAM,EAAE,eAAe,EAAE,CAAC;IAE1B;;;;;;OAMG;IACH,cAAc,EAAE,CAAE,MAAM,EAAE,eAAe,EAAE,KAAM,IAAI,CAAC;IAEtD;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAE3B;;;OAGG;IACH,WAAW,EAAE,UAAU,EAAE,CAAC;IAE1B;;;OAGG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;IAEjC;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,YAAY,CAAC,EAAE,CAAE,IAAI,EAAE,OAAO,KAAM,IAAI,CAAC;IAEzC;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAE1C;;OAEG;IACH,YAAY,CAAC,EAAE,kBAAkB,CAAC;IAElC;;;;;;OAMG;IACH,oBAAoB,CAAC,EAAE,CAAE,YAAY,EAAE,kBAAkB,KAAM,IAAI,CAAC;IAEpE,QAAQ,CAAC,EAAE,SAAS,CAAC;CACrB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import type { WidgetType } from '@wordpress/widget-primitives';
|
|
5
|
+
/**
|
|
6
|
+
* Internal dependencies
|
|
7
|
+
*/
|
|
8
|
+
import type { DashboardWidget } from '../../types';
|
|
9
|
+
/**
|
|
10
|
+
* Create a new dashboard widget from a widget type.
|
|
11
|
+
*
|
|
12
|
+
* Generates a unique id and applies default placement. If no initial
|
|
13
|
+
* attributes are provided, falls back to the type's `example.attributes`
|
|
14
|
+
* (matching the `widget.json` schema).
|
|
15
|
+
*
|
|
16
|
+
* @param widgetType Source widget type.
|
|
17
|
+
* @param initialAttributes Initial attributes; default to the type's example.
|
|
18
|
+
*/
|
|
19
|
+
export declare function createDashboardWidget<T>(widgetType: WidgetType, initialAttributes?: T): DashboardWidget<T>;
|
|
20
|
+
//# sourceMappingURL=create-dashboard-widget.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-dashboard-widget.d.ts","sourceRoot":"","sources":["../../../src/utils/create-dashboard-widget/create-dashboard-widget.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAE/D;;GAEG;AACH,OAAO,KAAK,EAAE,eAAe,EAAqB,MAAM,aAAa,CAAC;AAQtE;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAE,CAAC,EACvC,UAAU,EAAE,UAAU,EACtB,iBAAiB,CAAC,EAAE,CAAC,GACnB,eAAe,CAAE,CAAC,CAAE,CAQtB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/create-dashboard-widget/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal dependencies
|
|
3
|
+
*/
|
|
4
|
+
import type { WidgetGridSettings } from '../../types';
|
|
5
|
+
/**
|
|
6
|
+
* Canonical default grid settings. Applied by the dashboard when the
|
|
7
|
+
* consumer omits `gridSettings`, and the baseline hosts should treat as
|
|
8
|
+
* the factory default when persisting their own copy.
|
|
9
|
+
*/
|
|
10
|
+
export declare const DEFAULT_GRID: WidgetGridSettings;
|
|
11
|
+
//# sourceMappingURL=default-grid.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default-grid.d.ts","sourceRoot":"","sources":["../../../src/utils/default-grid/default-grid.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAItD;;;;GAIG;AACH,eAAO,MAAM,YAAY,EAAE,kBAI1B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/default-grid/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { DashboardWidget, WidgetGridModel, WidgetGridSettings } from '../../types';
|
|
2
|
+
export declare function getGridModel(settings: WidgetGridSettings): WidgetGridModel;
|
|
3
|
+
type ComputeGridModelChangeProps = {
|
|
4
|
+
layout: DashboardWidget[];
|
|
5
|
+
gridSettings: WidgetGridSettings;
|
|
6
|
+
targetModel: WidgetGridModel;
|
|
7
|
+
};
|
|
8
|
+
type ComputeGridModelChangeResult = {
|
|
9
|
+
layout: DashboardWidget[];
|
|
10
|
+
gridSettings: WidgetGridSettings;
|
|
11
|
+
} | null;
|
|
12
|
+
/**
|
|
13
|
+
* Computes the staged layout and grid settings after a layout-model change.
|
|
14
|
+
*
|
|
15
|
+
* @param {ComputeGridModelChangeProps} params Layout, current settings, and target model.
|
|
16
|
+
* @return {ComputeGridModelChangeResult} Migrated layout and settings, or `null` when the model is unchanged.
|
|
17
|
+
*/
|
|
18
|
+
export declare function computeGridModelChange({ layout, gridSettings, targetModel }: ComputeGridModelChangeProps): ComputeGridModelChangeResult;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=grid-model-change.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grid-model-change.d.ts","sourceRoot":"","sources":["../../../src/utils/grid-model-change/grid-model-change.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACX,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,MAAM,aAAa,CAAC;AAGrB,wBAAgB,YAAY,CAAE,QAAQ,EAAE,kBAAkB,GAAI,eAAe,CAE5E;AAED,KAAK,2BAA2B,GAAG;IAClC,MAAM,EAAE,eAAe,EAAE,CAAC;IAC1B,YAAY,EAAE,kBAAkB,CAAC;IACjC,WAAW,EAAE,eAAe,CAAC;CAC7B,CAAC;AAEF,KAAK,4BAA4B,GAAG;IACnC,MAAM,EAAE,eAAe,EAAE,CAAC;IAC1B,YAAY,EAAE,kBAAkB,CAAC;CACjC,GAAG,IAAI,CAAC;AAET;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAE,EACvC,MAAM,EACN,YAAY,EACZ,WAAW,EACX,EAAE,2BAA2B,GAAI,4BAA4B,CAgB7D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/grid-model-change/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/migrate-layout/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal dependencies
|
|
3
|
+
*/
|
|
4
|
+
import type { DashboardWidget, WidgetGridModel } from '../../types';
|
|
5
|
+
interface MigrationContext {
|
|
6
|
+
/**
|
|
7
|
+
* Column count of the currently-mounted grid surface. Used to
|
|
8
|
+
* resolve `'full'` widths to a concrete numeric span when going
|
|
9
|
+
* from the 2D grid model to masonry. When the surface is in
|
|
10
|
+
* responsive mode and the runtime column count is unknown,
|
|
11
|
+
* callers should pass a sensible fallback (e.g., the default of
|
|
12
|
+
* 6 used by `@wordpress/grid`).
|
|
13
|
+
*/
|
|
14
|
+
columns: number;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Migrates every widget's `placement` between grid models.
|
|
18
|
+
*
|
|
19
|
+
* The two storage shapes overlap on `width` and `order` but diverge
|
|
20
|
+
* on the rest: 2D grid carries `height` and discriminated string
|
|
21
|
+
* widths (`'fill'`/`'full'`), lanes carries `lane` and only numeric
|
|
22
|
+
* widths. Each conversion loses information that the target model
|
|
23
|
+
* cannot represent. The caller is responsible for surfacing the
|
|
24
|
+
* result to the user in a way that lets them correct visually.
|
|
25
|
+
*
|
|
26
|
+
* When `from === to`, the input is returned unchanged.
|
|
27
|
+
*
|
|
28
|
+
* @param widgets Widgets to migrate.
|
|
29
|
+
* @param from Source model. `undefined` is treated as `'grid'`.
|
|
30
|
+
* @param to Target model.
|
|
31
|
+
* @param context Information that depends on the live render (today
|
|
32
|
+
* only `columns`).
|
|
33
|
+
*/
|
|
34
|
+
export declare function migrateLayout(widgets: DashboardWidget[], from: WidgetGridModel | undefined, to: WidgetGridModel, context?: Partial<MigrationContext>): DashboardWidget[];
|
|
35
|
+
export {};
|
|
36
|
+
//# sourceMappingURL=migrate-layout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrate-layout.d.ts","sourceRoot":"","sources":["../../../src/utils/migrate-layout/migrate-layout.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EACX,eAAe,EAGf,eAAe,EACf,MAAM,aAAa,CAAC;AAErB,UAAU,gBAAgB;IACzB;;;;;;;OAOG;IACH,OAAO,EAAE,MAAM,CAAC;CAChB;AAkFD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,aAAa,CAC5B,OAAO,EAAE,eAAe,EAAE,EAC1B,IAAI,EAAE,eAAe,GAAG,SAAS,EACjC,EAAE,EAAE,eAAe,EACnB,OAAO,GAAE,OAAO,CAAE,gBAAgB,CAAO,GACvC,eAAe,EAAE,CA8BnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/normalize-grid-settings/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { WidgetGridSettings } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Coerces legacy grid row heights to a dashboard preset. Standard grid
|
|
4
|
+
* rows always use uniform track sizing so tiles align with the masonry
|
|
5
|
+
* model boundary.
|
|
6
|
+
*
|
|
7
|
+
* @param settings Grid settings to normalize.
|
|
8
|
+
* @param defaultRowHeight Fallback row height when none is set.
|
|
9
|
+
*/
|
|
10
|
+
export declare function normalizeGridSettings(settings: WidgetGridSettings, defaultRowHeight: number): WidgetGridSettings;
|
|
11
|
+
//# sourceMappingURL=normalize-grid-settings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize-grid-settings.d.ts","sourceRoot":"","sources":["../../../src/utils/normalize-grid-settings/normalize-grid-settings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA4B,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAGhF;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACpC,QAAQ,EAAE,kBAAkB,EAC5B,gBAAgB,EAAE,MAAM,GACtB,kBAAkB,CAuBpB"}
|