@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,77 @@
|
|
|
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/context/ui-context.tsx
|
|
21
|
+
var ui_context_exports = {};
|
|
22
|
+
__export(ui_context_exports, {
|
|
23
|
+
WidgetDashboardUIProvider: () => WidgetDashboardUIProvider,
|
|
24
|
+
useDashboardUIContext: () => useDashboardUIContext
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(ui_context_exports);
|
|
27
|
+
var import_element = require("@wordpress/element");
|
|
28
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
29
|
+
var Context = (0, import_element.createContext)(null);
|
|
30
|
+
function useDashboardUIContext() {
|
|
31
|
+
const ctx = (0, import_element.useContext)(Context);
|
|
32
|
+
if (!ctx) {
|
|
33
|
+
throw new Error(
|
|
34
|
+
"Dashboard compound used outside a WidgetDashboard subtree."
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
return ctx;
|
|
38
|
+
}
|
|
39
|
+
function WidgetDashboardUIProvider({ children }) {
|
|
40
|
+
const [inserterOpen, setInserterOpen] = (0, import_element.useState)(false);
|
|
41
|
+
const [layoutSettingsOpen, setLayoutSettingsOpen] = (0, import_element.useState)(false);
|
|
42
|
+
const [resetDialogOpen, setResetDialogOpen] = (0, import_element.useState)(false);
|
|
43
|
+
const [settingsWidgetUuid, setSettingsWidgetUuid] = (0, import_element.useState)(null);
|
|
44
|
+
const [settingsDrawerSide, setSettingsDrawerSide] = (0, import_element.useState)("right");
|
|
45
|
+
const [settingsDrawerInset, setSettingsDrawerInset] = (0, import_element.useState)(0);
|
|
46
|
+
const value = (0, import_element.useMemo)(
|
|
47
|
+
() => ({
|
|
48
|
+
inserterOpen,
|
|
49
|
+
setInserterOpen,
|
|
50
|
+
layoutSettingsOpen,
|
|
51
|
+
setLayoutSettingsOpen,
|
|
52
|
+
resetDialogOpen,
|
|
53
|
+
setResetDialogOpen,
|
|
54
|
+
settingsWidgetUuid,
|
|
55
|
+
setSettingsWidgetUuid,
|
|
56
|
+
settingsDrawerSide,
|
|
57
|
+
setSettingsDrawerSide,
|
|
58
|
+
settingsDrawerInset,
|
|
59
|
+
setSettingsDrawerInset
|
|
60
|
+
}),
|
|
61
|
+
[
|
|
62
|
+
inserterOpen,
|
|
63
|
+
layoutSettingsOpen,
|
|
64
|
+
resetDialogOpen,
|
|
65
|
+
settingsWidgetUuid,
|
|
66
|
+
settingsDrawerSide,
|
|
67
|
+
settingsDrawerInset
|
|
68
|
+
]
|
|
69
|
+
);
|
|
70
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Context.Provider, { value, children });
|
|
71
|
+
}
|
|
72
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
73
|
+
0 && (module.exports = {
|
|
74
|
+
WidgetDashboardUIProvider,
|
|
75
|
+
useDashboardUIContext
|
|
76
|
+
});
|
|
77
|
+
//# sourceMappingURL=ui-context.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/context/ui-context.tsx"],
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport type { ReactNode } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tcreateContext,\n\tuseContext,\n\tuseMemo,\n\tuseState,\n} from '@wordpress/element';\n\ntype DrawerSide = 'left' | 'right';\n\ninterface DashboardUIContextValue {\n\tinserterOpen: boolean;\n\tsetInserterOpen: ( next: boolean ) => void;\n\n\tlayoutSettingsOpen: boolean;\n\tsetLayoutSettingsOpen: ( next: boolean ) => void;\n\tresetDialogOpen: boolean;\n\tsetResetDialogOpen: ( next: boolean ) => void;\n\n\t/**\n\t * `uuid` of the instance whose settings drawer is open, or `null`\n\t * when no settings drawer is showing. The per-instance gear in the\n\t * chrome sets it; the single `WidgetSettings` at the root reads\n\t * it.\n\t */\n\tsettingsWidgetUuid: string | null;\n\tsetSettingsWidgetUuid: ( next: string | null ) => void;\n\n\t/**\n\t * Edge the settings drawer slides in from. The gear sets it from the\n\t * widget's on-screen position so the drawer opens on the side away\n\t * from the widget, trying not to cover it.\n\t */\n\tsettingsDrawerSide: DrawerSide;\n\tsetSettingsDrawerSide: ( next: DrawerSide ) => void;\n\n\t/**\n\t * Inline-start inset (px) the settings drawer is offset by when it\n\t * opens from the left, so it clears fixed page chrome (the WordPress\n\t * admin menu) instead of sliding over it. `0` when there's nothing to\n\t * clear.\n\t */\n\tsettingsDrawerInset: number;\n\tsetSettingsDrawerInset: ( next: number ) => void;\n}\n\nconst Context = createContext< DashboardUIContextValue | null >( null );\n\n/**\n * Accesses the shared UI state: overlay open flags and the active settings\n * instance with its placement. Throws when called outside `WidgetDashboard`.\n */\nexport function useDashboardUIContext(): DashboardUIContextValue {\n\tconst ctx = useContext( Context );\n\tif ( ! ctx ) {\n\t\tthrow new Error(\n\t\t\t'Dashboard compound used outside a WidgetDashboard subtree.'\n\t\t);\n\t}\n\treturn ctx;\n}\n\ninterface ProviderProps {\n\tchildren: ReactNode;\n}\n\n/**\n * Holds transient UI state shared across compounds (the inserter modal and\n * the per-instance settings drawer). Kept separate from the data context so\n * that data mutations don't churn the UI state and vice-versa.\n *\n * @param {ProviderProps} props Component props.\n */\nexport function WidgetDashboardUIProvider( { children }: ProviderProps ) {\n\tconst [ inserterOpen, setInserterOpen ] = useState( false );\n\tconst [ layoutSettingsOpen, setLayoutSettingsOpen ] = useState( false );\n\tconst [ resetDialogOpen, setResetDialogOpen ] = useState( false );\n\tconst [ settingsWidgetUuid, setSettingsWidgetUuid ] = useState<\n\t\tstring | null\n\t>( null );\n\tconst [ settingsDrawerSide, setSettingsDrawerSide ] =\n\t\tuseState< DrawerSide >( 'right' );\n\tconst [ settingsDrawerInset, setSettingsDrawerInset ] = useState( 0 );\n\n\tconst value = useMemo< DashboardUIContextValue >(\n\t\t() => ( {\n\t\t\tinserterOpen,\n\t\t\tsetInserterOpen,\n\t\t\tlayoutSettingsOpen,\n\t\t\tsetLayoutSettingsOpen,\n\t\t\tresetDialogOpen,\n\t\t\tsetResetDialogOpen,\n\t\t\tsettingsWidgetUuid,\n\t\t\tsetSettingsWidgetUuid,\n\t\t\tsettingsDrawerSide,\n\t\t\tsetSettingsDrawerSide,\n\t\t\tsettingsDrawerInset,\n\t\t\tsetSettingsDrawerInset,\n\t\t} ),\n\t\t[\n\t\t\tinserterOpen,\n\t\t\tlayoutSettingsOpen,\n\t\t\tresetDialogOpen,\n\t\t\tsettingsWidgetUuid,\n\t\t\tsettingsDrawerSide,\n\t\t\tsettingsDrawerInset,\n\t\t]\n\t);\n\n\treturn <Context.Provider value={ value }>{ children }</Context.Provider>;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA,qBAKO;AAuGC;AA/DR,IAAM,cAAU,8BAAiD,IAAK;AAM/D,SAAS,wBAAiD;AAChE,QAAM,UAAM,2BAAY,OAAQ;AAChC,MAAK,CAAE,KAAM;AACZ,UAAM,IAAI;AAAA,MACT;AAAA,IACD;AAAA,EACD;AACA,SAAO;AACR;AAaO,SAAS,0BAA2B,EAAE,SAAS,GAAmB;AACxE,QAAM,CAAE,cAAc,eAAgB,QAAI,yBAAU,KAAM;AAC1D,QAAM,CAAE,oBAAoB,qBAAsB,QAAI,yBAAU,KAAM;AACtE,QAAM,CAAE,iBAAiB,kBAAmB,QAAI,yBAAU,KAAM;AAChE,QAAM,CAAE,oBAAoB,qBAAsB,QAAI,yBAEnD,IAAK;AACR,QAAM,CAAE,oBAAoB,qBAAsB,QACjD,yBAAwB,OAAQ;AACjC,QAAM,CAAE,qBAAqB,sBAAuB,QAAI,yBAAU,CAAE;AAEpE,QAAM,YAAQ;AAAA,IACb,OAAQ;AAAA,MACP;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACD;AAAA,IACA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACD;AAAA,EACD;AAEA,SAAO,4CAAC,QAAQ,UAAR,EAAiB,OAAkB,UAAU;AACtD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
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/context/widget-context.tsx
|
|
21
|
+
var widget_context_exports = {};
|
|
22
|
+
__export(widget_context_exports, {
|
|
23
|
+
WidgetContextProvider: () => WidgetContextProvider,
|
|
24
|
+
useWidgetContext: () => useWidgetContext
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(widget_context_exports);
|
|
27
|
+
var import_element = require("@wordpress/element");
|
|
28
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
29
|
+
var WidgetContext = (0, import_element.createContext)(null);
|
|
30
|
+
function WidgetContextProvider({
|
|
31
|
+
value,
|
|
32
|
+
children
|
|
33
|
+
}) {
|
|
34
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(WidgetContext.Provider, { value, children });
|
|
35
|
+
}
|
|
36
|
+
function useWidgetContext() {
|
|
37
|
+
return (0, import_element.useContext)(WidgetContext);
|
|
38
|
+
}
|
|
39
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
40
|
+
0 && (module.exports = {
|
|
41
|
+
WidgetContextProvider,
|
|
42
|
+
useWidgetContext
|
|
43
|
+
});
|
|
44
|
+
//# sourceMappingURL=widget-context.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/context/widget-context.tsx"],
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport type { ReactNode } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { createContext, useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { WidgetContextValue } from '../types';\n\nconst WidgetContext = createContext< WidgetContextValue | null >( null );\n\ninterface ProviderProps {\n\tvalue: WidgetContextValue;\n\tchildren: ReactNode;\n}\n\n/**\n * Provides the current widget's identity to its render subtree.\n *\n * @param {ProviderProps} props Component props.\n */\nexport function WidgetContextProvider( {\n\tvalue,\n\tchildren,\n}: ProviderProps ): React.ReactNode {\n\treturn (\n\t\t<WidgetContext.Provider value={ value }>\n\t\t\t{ children }\n\t\t</WidgetContext.Provider>\n\t);\n}\n\n/**\n * Returns the current widget's identity (`uuid`, `name`, `index`). Returns\n * `null` when called outside a widget render subtree.\n */\nexport function useWidgetContext(): WidgetContextValue | null {\n\treturn useContext( WidgetContext );\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA,qBAA0C;AAwBxC;AAjBF,IAAM,oBAAgB,8BAA4C,IAAK;AAYhE,SAAS,sBAAuB;AAAA,EACtC;AAAA,EACA;AACD,GAAoC;AACnC,SACC,4CAAC,cAAc,UAAd,EAAuB,OACrB,UACH;AAEF;AAMO,SAAS,mBAA8C;AAC7D,aAAO,2BAAY,aAAc;AAClC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
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/hooks/use-dashboard-container-column-count.ts
|
|
21
|
+
var use_dashboard_container_column_count_exports = {};
|
|
22
|
+
__export(use_dashboard_container_column_count_exports, {
|
|
23
|
+
useDashboardContainerColumnCount: () => useDashboardContainerColumnCount
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(use_dashboard_container_column_count_exports);
|
|
26
|
+
var import_compose = require("@wordpress/compose");
|
|
27
|
+
var import_element = require("@wordpress/element");
|
|
28
|
+
var import_resolve_dashboard_column_count = require("../utils/resolve-dashboard-column-count/resolve-dashboard-column-count.cjs");
|
|
29
|
+
function useDashboardContainerColumnCount(forwardedRef) {
|
|
30
|
+
const [container, setContainer] = (0, import_element.useState)(
|
|
31
|
+
null
|
|
32
|
+
);
|
|
33
|
+
const [containerWidth, setContainerWidth] = (0, import_element.useState)(0);
|
|
34
|
+
const resizeObserverRef = (0, import_compose.useResizeObserver)(([{ contentRect }]) => {
|
|
35
|
+
setContainerWidth(contentRect.width);
|
|
36
|
+
});
|
|
37
|
+
const containerRef = (0, import_compose.useMergeRefs)([
|
|
38
|
+
setContainer,
|
|
39
|
+
resizeObserverRef,
|
|
40
|
+
forwardedRef ?? null
|
|
41
|
+
]);
|
|
42
|
+
(0, import_element.useLayoutEffect)(() => {
|
|
43
|
+
if (!container) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const { width } = container.getBoundingClientRect();
|
|
47
|
+
if (width > 0) {
|
|
48
|
+
setContainerWidth(width);
|
|
49
|
+
}
|
|
50
|
+
}, [container]);
|
|
51
|
+
const columnCount = (0, import_element.useMemo)(
|
|
52
|
+
() => (0, import_resolve_dashboard_column_count.resolveDashboardColumnCount)(containerWidth),
|
|
53
|
+
[containerWidth]
|
|
54
|
+
);
|
|
55
|
+
return { containerRef, columnCount };
|
|
56
|
+
}
|
|
57
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
58
|
+
0 && (module.exports = {
|
|
59
|
+
useDashboardContainerColumnCount
|
|
60
|
+
});
|
|
61
|
+
//# sourceMappingURL=use-dashboard-container-column-count.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/hooks/use-dashboard-container-column-count.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useResizeObserver, useMergeRefs } from '@wordpress/compose';\nimport {\n\tuseLayoutEffect,\n\tuseMemo,\n\tuseState,\n\ttype Ref,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { resolveDashboardColumnCount } from '../utils/resolve-dashboard-column-count/resolve-dashboard-column-count';\n\ninterface UseDashboardContainerColumnCountResult {\n\tcontainerRef: Ref< HTMLDivElement >;\n\tcolumnCount: number;\n}\n\n/**\n * Tracks the dashboard grid container width and maps it to an opinionated\n * column count (4 → 2 → 1). Measurement is container-based via\n * `ResizeObserver`, not viewport media queries.\n *\n * @param {Ref< HTMLDivElement >} [forwardedRef] Ref forwarded from the grid wrapper.\n */\nexport function useDashboardContainerColumnCount(\n\tforwardedRef?: Ref< HTMLDivElement >\n): UseDashboardContainerColumnCountResult {\n\tconst [ container, setContainer ] = useState< HTMLDivElement | null >(\n\t\tnull\n\t);\n\tconst [ containerWidth, setContainerWidth ] = useState( 0 );\n\n\tconst resizeObserverRef = useResizeObserver( ( [ { contentRect } ] ) => {\n\t\tsetContainerWidth( contentRect.width );\n\t} );\n\n\tconst containerRef = useMergeRefs( [\n\t\tsetContainer,\n\t\tresizeObserverRef,\n\t\tforwardedRef ?? null,\n\t] );\n\n\tuseLayoutEffect( () => {\n\t\tif ( ! container ) {\n\t\t\treturn;\n\t\t}\n\t\tconst { width } = container.getBoundingClientRect();\n\t\tif ( width > 0 ) {\n\t\t\tsetContainerWidth( width );\n\t\t}\n\t}, [ container ] );\n\n\tconst columnCount = useMemo(\n\t\t() => resolveDashboardColumnCount( containerWidth ),\n\t\t[ containerWidth ]\n\t);\n\n\treturn { containerRef, columnCount };\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAAgD;AAChD,qBAKO;AAKP,4CAA4C;AAcrC,SAAS,iCACf,cACyC;AACzC,QAAM,CAAE,WAAW,YAAa,QAAI;AAAA,IACnC;AAAA,EACD;AACA,QAAM,CAAE,gBAAgB,iBAAkB,QAAI,yBAAU,CAAE;AAE1D,QAAM,wBAAoB,kCAAmB,CAAE,CAAE,EAAE,YAAY,CAAE,MAAO;AACvE,sBAAmB,YAAY,KAAM;AAAA,EACtC,CAAE;AAEF,QAAM,mBAAe,6BAAc;AAAA,IAClC;AAAA,IACA;AAAA,IACA,gBAAgB;AAAA,EACjB,CAAE;AAEF,sCAAiB,MAAM;AACtB,QAAK,CAAE,WAAY;AAClB;AAAA,IACD;AACA,UAAM,EAAE,MAAM,IAAI,UAAU,sBAAsB;AAClD,QAAK,QAAQ,GAAI;AAChB,wBAAmB,KAAM;AAAA,IAC1B;AAAA,EACD,GAAG,CAAE,SAAU,CAAE;AAEjB,QAAM,kBAAc;AAAA,IACnB,UAAM,mEAA6B,cAAe;AAAA,IAClD,CAAE,cAAe;AAAA,EAClB;AAEA,SAAO,EAAE,cAAc,YAAY;AACpC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/build/index.cjs
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
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/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
DEFAULT_GRID: () => import_default_grid.DEFAULT_GRID,
|
|
24
|
+
DEFAULT_ROW_HEIGHT: () => import_row_height_presets.DEFAULT_ROW_HEIGHT,
|
|
25
|
+
ROW_HEIGHT_PRESETS: () => import_row_height_presets.ROW_HEIGHT_PRESETS,
|
|
26
|
+
WIDGET_DASHBOARD_COLUMN_COUNT: () => import_types.WIDGET_DASHBOARD_COLUMN_COUNT,
|
|
27
|
+
WidgetDashboard: () => import_widget_dashboard.WidgetDashboard,
|
|
28
|
+
normalizeGridSettings: () => import_normalize_grid_settings.normalizeGridSettings
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(index_exports);
|
|
31
|
+
var import_widget_dashboard = require("./widget-dashboard.cjs");
|
|
32
|
+
var import_types = require("./types.cjs");
|
|
33
|
+
var import_default_grid = require("./utils/default-grid/index.cjs");
|
|
34
|
+
var import_normalize_grid_settings = require("./utils/normalize-grid-settings/index.cjs");
|
|
35
|
+
var import_row_height_presets = require("./utils/row-height-presets/index.cjs");
|
|
36
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
37
|
+
0 && (module.exports = {
|
|
38
|
+
DEFAULT_GRID,
|
|
39
|
+
DEFAULT_ROW_HEIGHT,
|
|
40
|
+
ROW_HEIGHT_PRESETS,
|
|
41
|
+
WIDGET_DASHBOARD_COLUMN_COUNT,
|
|
42
|
+
WidgetDashboard,
|
|
43
|
+
normalizeGridSettings
|
|
44
|
+
});
|
|
45
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/index.ts"],
|
|
4
|
+
"sourcesContent": ["export { WidgetDashboard } from './widget-dashboard';\nexport type { DashboardWidget, WidgetGridSettings } from './types';\nexport { WIDGET_DASHBOARD_COLUMN_COUNT } from './types';\nexport { DEFAULT_GRID } from './utils/default-grid';\nexport { normalizeGridSettings } from './utils/normalize-grid-settings';\nexport {\n\tROW_HEIGHT_PRESETS,\n\tDEFAULT_ROW_HEIGHT,\n} from './utils/row-height-presets';\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,8BAAgC;AAEhC,mBAA8C;AAC9C,0BAA6B;AAC7B,qCAAsC;AACtC,gCAGO;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
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/lock-unlock.ts
|
|
21
|
+
var lock_unlock_exports = {};
|
|
22
|
+
__export(lock_unlock_exports, {
|
|
23
|
+
lock: () => lock,
|
|
24
|
+
unlock: () => unlock
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(lock_unlock_exports);
|
|
27
|
+
var import_private_apis = require("@wordpress/private-apis");
|
|
28
|
+
var { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)(
|
|
29
|
+
"I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.",
|
|
30
|
+
"@wordpress/widget-dashboard"
|
|
31
|
+
);
|
|
32
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
33
|
+
0 && (module.exports = {
|
|
34
|
+
lock,
|
|
35
|
+
unlock
|
|
36
|
+
});
|
|
37
|
+
//# sourceMappingURL=lock-unlock.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/lock-unlock.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';\n\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.',\n\t\t'@wordpress/widget-dashboard'\n\t);\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAAiE;AAE1D,IAAM,EAAE,MAAM,OAAO,QAC3B;AAAA,EACC;AAAA,EACA;AACD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/build/types.cjs
ADDED
|
@@ -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/types.ts
|
|
21
|
+
var types_exports = {};
|
|
22
|
+
__export(types_exports, {
|
|
23
|
+
WIDGET_DASHBOARD_COLUMN_COUNT: () => WIDGET_DASHBOARD_COLUMN_COUNT
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(types_exports);
|
|
26
|
+
var WIDGET_DASHBOARD_COLUMN_COUNT = 4;
|
|
27
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
28
|
+
0 && (module.exports = {
|
|
29
|
+
WIDGET_DASHBOARD_COLUMN_COUNT
|
|
30
|
+
});
|
|
31
|
+
//# sourceMappingURL=types.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/types.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Dashboard-specific types: `DashboardWidget`, grid settings, and the\n * `WidgetDashboard` prop bag.\n *\n * The widget contract types (`WidgetName`, `WidgetType`, `WidgetRenderProps`,\n * `ResolveWidgetModule`) live in `@wordpress/widget-primitives` and are\n * imported from there directly; this module does not re-export them.\n */\n\n/**\n * External dependencies\n */\nimport type { ReactNode } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport type {\n\tDashboardGridLayoutItem,\n\tDashboardLanesLayoutItem,\n} from '@wordpress/grid';\nimport type {\n\tWidgetName,\n\tWidgetType,\n\tResolveWidgetModule,\n} from '@wordpress/widget-primitives';\n\nexport type GridTilePlacement = Omit< DashboardGridLayoutItem, 'key' >;\nexport type MasonryTilePlacement = Omit< DashboardLanesLayoutItem, 'key' >;\n\n/**\n * Storage shape for a widget's placement.\n *\n * Structurally a union of every supported per-model shape, but the\n * intended invariant is stronger than the type suggests: every\n * placement in a given layout must match the shape of the currently\n * active `gridSettings.model`. `migrateLayout` is the only correct\n * way to transition placements across model changes; the render\n * layer is allowed to trust the active model and treat each\n * placement as the matching shape.\n *\n * The type system cannot enforce that invariant on its own (there is\n * no discriminator on the placement itself), so consider this union a\n * declaration of which shapes are *valid*, not which shape any given\n * placement happens to be at runtime.\n */\nexport type DashboardTilePlacement = GridTilePlacement | MasonryTilePlacement;\n\n/**\n * A widget placed on the dashboard.\n *\n * A `WidgetType` describes the blueprint. A `DashboardWidget` is a\n * concrete placement of that type on a specific dashboard: its unique\n * id, the type it references, user-configured attributes, and its\n * `placement` in the grid.\n */\nexport interface DashboardWidget< Item = unknown > {\n\t/**\n\t * Unique instance identifier.\n\t */\n\tuuid: string;\n\n\t/**\n\t * Widget type name — must match a `WidgetType.name` in `widgetTypes`.\n\t */\n\ttype: WidgetName;\n\n\t/**\n\t * User-configured attributes for this instance.\n\t */\n\tattributes?: Item;\n\n\t/**\n\t * Grid-model-specific placement (column/row spans, ordering,\n\t * etc.). Must match the shape implied by the dashboard's active\n\t * `gridSettings.model`; see `DashboardTilePlacement` for the\n\t * invariant and `migrateLayout` for the transition mechanism.\n\t */\n\tplacement?: DashboardTilePlacement;\n}\n\n/**\n * Identity of a widget within the rendering tree. Returned by\n * `useWidgetContext()`; `null` when called outside a widget render subtree.\n */\nexport interface WidgetContextValue {\n\t/**\n\t * Widget instance id.\n\t */\n\tuuid: string;\n\n\t/**\n\t * Widget type name.\n\t */\n\tname: WidgetName;\n\n\t/**\n\t * Index of the widget in the `layout` array.\n\t */\n\tindex: number;\n}\n\n/**\n * Identifier for the active grid model. Drives which `@wordpress/grid`\n * surface the dashboard mounts and which per-model settings the\n * `WidgetGridSettings` union admits.\n *\n * Model names describe user-facing concepts. The mapping to the\n * underlying `@wordpress/grid` component is an implementation detail\n * resolved in the render layer; `'masonry'` is rendered today through\n * `DashboardLanes` (skyline placement) but could swap to a future\n * native `display: grid-lanes` path without affecting the model name.\n */\nexport type WidgetGridModel = 'grid' | 'masonry';\n\n/**\n * Maximum column count for the widget dashboard on wide containers.\n * Not exposed in layout settings; container width steps the count down\n * to two and one column at fixed breakpoints.\n */\nexport const WIDGET_DASHBOARD_COLUMN_COUNT = 4;\n\n/**\n * Settings common to every grid model. Column count is resolved from\n * the dashboard container width (see\n * `utils/resolve-dashboard-column-count`). `columns` and `minColumnWidth`\n * on this type remain for persisted payloads and `@wordpress/grid`\n * compatibility; the dashboard ignores user-facing values for both.\n *\n * `spacing` is intentionally absent: the gap between tiles is\n * presentational and lives with the design-system theme/density, not\n * with per-dashboard settings. The grid surface keeps the prop for\n * programmatic overrides, but the dashboard does not propagate it.\n */\ninterface BaseWidgetGridSettings {\n\t/**\n\t * Target column count (cap). The dashboard always uses\n\t * {@link WIDGET_DASHBOARD_COLUMN_COUNT}; persisted values are ignored.\n\t */\n\tcolumns?: number;\n\n\t/**\n\t * Per-tile minimum width in pixels. Unused by the dashboard; column\n\t * count is derived from container width instead.\n\t */\n\tminColumnWidth?: number;\n}\n\n/**\n * 2D packed grid settings. Items declare explicit width and height\n * spans; rows use a uniform track height via `rowHeight`.\n */\nexport interface WidgetGridLayoutSettings extends BaseWidgetGridSettings {\n\tmodel?: 'grid';\n\n\t/**\n\t * Row height in pixels (`200` small, `300` medium, `400` large). Every\n\t * tile in a row fills the row vertically.\n\t */\n\trowHeight?: number;\n}\n\n/**\n * Masonry settings. Heights are content-driven; resize is\n * horizontal-only. `flowTolerance` tunes how aggressively the placer\n * preserves source order vs. minimizing empty regions.\n */\nexport interface WidgetMasonryLayoutSettings extends BaseWidgetGridSettings {\n\tmodel: 'masonry';\n\n\t/**\n\t * Pixel tolerance for source-order tiebreaking when two candidate\n\t * columns have similar baselines.\n\t */\n\tflowTolerance?: number;\n}\n\n/**\n * Discriminated union of supported grid-model configurations.\n *\n * When `model` is omitted the dashboard treats the settings as the\n * 2D packed grid (`'grid'`) for backwards compatibility with the\n * pre-union shape.\n */\nexport type WidgetGridSettings =\n\t| WidgetGridLayoutSettings\n\t| WidgetMasonryLayoutSettings;\n\n/**\n * Props for `WidgetDashboard`.\n *\n * The consumer owns the committed layout state; the dashboard maintains\n * a staging copy internally for in-progress edits, and `onLayoutChange`\n * fires only when the user commits via the Done action.\n */\nexport interface WidgetDashboardProps {\n\t/**\n\t * Widget instances to render. Consumer owns this state.\n\t */\n\tlayout: DashboardWidget[];\n\n\t/**\n\t * Called when the user commits in-progress edits via the Done action.\n\t * Receives the full layout array as it should be persisted. In-progress\n\t * mutations (reorder, resize, add, remove, attribute edits) accumulate\n\t * in the dashboard's internal staging layer and do not fire this\n\t * callback until commit.\n\t */\n\tonLayoutChange: ( layout: DashboardWidget[] ) => void;\n\n\t/**\n\t * Called when the layout is reset to the default.\n\t */\n\tonLayoutReset?: () => void;\n\n\t/**\n\t * Widget types available for rendering. The dashboard never queries a\n\t * store directly — consumers scope and filter via this prop.\n\t */\n\twidgetTypes: WidgetType[];\n\n\t/**\n\t * When true, widget types are still loading. Instances whose type is\n\t * not yet in `widgetTypes` show a loading state instead of missing.\n\t */\n\tisResolvingWidgetTypes?: boolean;\n\n\t/**\n\t * Whether the dashboard is in edit mode (enables drag/resize).\n\t */\n\teditMode?: boolean;\n\n\t/**\n\t * Called when edit mode toggles via `WidgetDashboard.Actions`.\n\t */\n\tonEditChange?: ( next: boolean ) => void;\n\n\t/**\n\t * Overrides the default `import()` resolution of\n\t * `WidgetType.renderModule`. Useful for tests, Storybook, or future\n\t * remote-URL loading.\n\t */\n\tresolveWidgetModule?: ResolveWidgetModule;\n\n\t/**\n\t * Grid model configuration. See `WidgetGridSettings` for the shape.\n\t */\n\tgridSettings?: WidgetGridSettings;\n\n\t/**\n\t * Called when the user commits in-progress grid-settings edits via\n\t * the Done action. The dashboard maintains a staging copy of\n\t * settings internally; mutations stay local until commit. When\n\t * omitted, the `Layout settings` button in the customize toolbar is\n\t * hidden, since there is nowhere to persist the change.\n\t */\n\tonGridSettingsChange?: ( gridSettings: WidgetGridSettings ) => void;\n\n\tchildren?: ReactNode;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAwHO,IAAM,gCAAgC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
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/create-dashboard-widget/create-dashboard-widget.ts
|
|
21
|
+
var create_dashboard_widget_exports = {};
|
|
22
|
+
__export(create_dashboard_widget_exports, {
|
|
23
|
+
createDashboardWidget: () => createDashboardWidget
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(create_dashboard_widget_exports);
|
|
26
|
+
var import_uuid = require("uuid");
|
|
27
|
+
var DEFAULT_PLACEMENT = {
|
|
28
|
+
width: 1,
|
|
29
|
+
height: 2,
|
|
30
|
+
order: 0
|
|
31
|
+
};
|
|
32
|
+
function createDashboardWidget(widgetType, initialAttributes) {
|
|
33
|
+
return {
|
|
34
|
+
uuid: (0, import_uuid.v4)(),
|
|
35
|
+
type: widgetType.name,
|
|
36
|
+
attributes: initialAttributes ?? widgetType.example?.attributes,
|
|
37
|
+
placement: DEFAULT_PLACEMENT
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
41
|
+
0 && (module.exports = {
|
|
42
|
+
createDashboardWidget
|
|
43
|
+
});
|
|
44
|
+
//# sourceMappingURL=create-dashboard-widget.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/utils/create-dashboard-widget/create-dashboard-widget.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport { v4 as uuid } from 'uuid';\n\n/**\n * WordPress dependencies\n */\nimport type { WidgetType } from '@wordpress/widget-primitives';\n\n/**\n * Internal dependencies\n */\nimport type { DashboardWidget, GridTilePlacement } from '../../types';\n\nconst DEFAULT_PLACEMENT: GridTilePlacement = {\n\twidth: 1,\n\theight: 2,\n\torder: 0,\n};\n\n/**\n * Create a new dashboard widget from a widget type.\n *\n * Generates a unique id and applies default placement. If no initial\n * attributes are provided, falls back to the type's `example.attributes`\n * (matching the `widget.json` schema).\n *\n * @param widgetType Source widget type.\n * @param initialAttributes Initial attributes; default to the type's example.\n */\nexport function createDashboardWidget< T >(\n\twidgetType: WidgetType,\n\tinitialAttributes?: T\n): DashboardWidget< T > {\n\treturn {\n\t\tuuid: uuid(),\n\t\ttype: widgetType.name,\n\t\tattributes:\n\t\t\tinitialAttributes ?? ( widgetType.example?.attributes as T ),\n\t\tplacement: DEFAULT_PLACEMENT,\n\t};\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAA2B;AAY3B,IAAM,oBAAuC;AAAA,EAC5C,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,OAAO;AACR;AAYO,SAAS,sBACf,YACA,mBACuB;AACvB,SAAO;AAAA,IACN,UAAM,YAAAA,IAAK;AAAA,IACX,MAAM,WAAW;AAAA,IACjB,YACC,qBAAuB,WAAW,SAAS;AAAA,IAC5C,WAAW;AAAA,EACZ;AACD;",
|
|
6
|
+
"names": ["uuid"]
|
|
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/create-dashboard-widget/index.ts
|
|
21
|
+
var create_dashboard_widget_exports = {};
|
|
22
|
+
__export(create_dashboard_widget_exports, {
|
|
23
|
+
createDashboardWidget: () => import_create_dashboard_widget.createDashboardWidget
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(create_dashboard_widget_exports);
|
|
26
|
+
var import_create_dashboard_widget = require("./create-dashboard-widget.cjs");
|
|
27
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
28
|
+
0 && (module.exports = {
|
|
29
|
+
createDashboardWidget
|
|
30
|
+
});
|
|
31
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/utils/create-dashboard-widget/index.ts"],
|
|
4
|
+
"sourcesContent": ["export { createDashboardWidget } from './create-dashboard-widget';\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qCAAsC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
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/default-grid/default-grid.ts
|
|
21
|
+
var default_grid_exports = {};
|
|
22
|
+
__export(default_grid_exports, {
|
|
23
|
+
DEFAULT_GRID: () => DEFAULT_GRID
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(default_grid_exports);
|
|
26
|
+
var import_types = require("../../types.cjs");
|
|
27
|
+
var import_row_height_presets = require("../row-height-presets/index.cjs");
|
|
28
|
+
var DEFAULT_GRID = {
|
|
29
|
+
model: "grid",
|
|
30
|
+
columns: import_types.WIDGET_DASHBOARD_COLUMN_COUNT,
|
|
31
|
+
rowHeight: import_row_height_presets.DEFAULT_ROW_HEIGHT
|
|
32
|
+
};
|
|
33
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
34
|
+
0 && (module.exports = {
|
|
35
|
+
DEFAULT_GRID
|
|
36
|
+
});
|
|
37
|
+
//# sourceMappingURL=default-grid.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/utils/default-grid/default-grid.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport type { WidgetGridSettings } from '../../types';\nimport { WIDGET_DASHBOARD_COLUMN_COUNT } from '../../types';\nimport { DEFAULT_ROW_HEIGHT } from '../row-height-presets';\n\n/**\n * Canonical default grid settings. Applied by the dashboard when the\n * consumer omits `gridSettings`, and the baseline hosts should treat as\n * the factory default when persisting their own copy.\n */\nexport const DEFAULT_GRID: WidgetGridSettings = {\n\tmodel: 'grid',\n\tcolumns: WIDGET_DASHBOARD_COLUMN_COUNT,\n\trowHeight: DEFAULT_ROW_HEIGHT,\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,mBAA8C;AAC9C,gCAAmC;AAO5B,IAAM,eAAmC;AAAA,EAC/C,OAAO;AAAA,EACP,SAAS;AAAA,EACT,WAAW;AACZ;",
|
|
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/default-grid/index.ts
|
|
21
|
+
var default_grid_exports = {};
|
|
22
|
+
__export(default_grid_exports, {
|
|
23
|
+
DEFAULT_GRID: () => import_default_grid.DEFAULT_GRID
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(default_grid_exports);
|
|
26
|
+
var import_default_grid = require("./default-grid.cjs");
|
|
27
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
28
|
+
0 && (module.exports = {
|
|
29
|
+
DEFAULT_GRID
|
|
30
|
+
});
|
|
31
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1,56 @@
|
|
|
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/grid-model-change.ts
|
|
21
|
+
var grid_model_change_exports = {};
|
|
22
|
+
__export(grid_model_change_exports, {
|
|
23
|
+
computeGridModelChange: () => computeGridModelChange,
|
|
24
|
+
getGridModel: () => getGridModel
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(grid_model_change_exports);
|
|
27
|
+
var import_migrate_layout = require("../migrate-layout/index.cjs");
|
|
28
|
+
var import_types = require("../../types.cjs");
|
|
29
|
+
function getGridModel(settings) {
|
|
30
|
+
return settings.model ?? "grid";
|
|
31
|
+
}
|
|
32
|
+
function computeGridModelChange({
|
|
33
|
+
layout,
|
|
34
|
+
gridSettings,
|
|
35
|
+
targetModel
|
|
36
|
+
}) {
|
|
37
|
+
const currentModel = getGridModel(gridSettings);
|
|
38
|
+
if (currentModel === targetModel) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
layout: (0, import_migrate_layout.migrateLayout)(layout, currentModel, targetModel, {
|
|
43
|
+
columns: import_types.WIDGET_DASHBOARD_COLUMN_COUNT
|
|
44
|
+
}),
|
|
45
|
+
gridSettings: {
|
|
46
|
+
...gridSettings,
|
|
47
|
+
model: targetModel
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
52
|
+
0 && (module.exports = {
|
|
53
|
+
computeGridModelChange,
|
|
54
|
+
getGridModel
|
|
55
|
+
});
|
|
56
|
+
//# sourceMappingURL=grid-model-change.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/utils/grid-model-change/grid-model-change.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport { migrateLayout } from '../migrate-layout';\nimport type {\n\tDashboardWidget,\n\tWidgetGridModel,\n\tWidgetGridSettings,\n} from '../../types';\nimport { WIDGET_DASHBOARD_COLUMN_COUNT } from '../../types';\n\nexport function getGridModel( settings: WidgetGridSettings ): WidgetGridModel {\n\treturn settings.model ?? 'grid';\n}\n\ntype ComputeGridModelChangeProps = {\n\tlayout: DashboardWidget[];\n\tgridSettings: WidgetGridSettings;\n\ttargetModel: WidgetGridModel;\n};\n\ntype ComputeGridModelChangeResult = {\n\tlayout: DashboardWidget[];\n\tgridSettings: WidgetGridSettings;\n} | null;\n\n/**\n * Computes the staged layout and grid settings after a layout-model change.\n *\n * @param {ComputeGridModelChangeProps} params Layout, current settings, and target model.\n * @return {ComputeGridModelChangeResult} Migrated layout and settings, or `null` when the model is unchanged.\n */\nexport function computeGridModelChange( {\n\tlayout,\n\tgridSettings,\n\ttargetModel,\n}: ComputeGridModelChangeProps ): ComputeGridModelChangeResult {\n\tconst currentModel = getGridModel( gridSettings );\n\n\tif ( currentModel === targetModel ) {\n\t\treturn null;\n\t}\n\n\treturn {\n\t\tlayout: migrateLayout( layout, currentModel, targetModel, {\n\t\t\tcolumns: WIDGET_DASHBOARD_COLUMN_COUNT,\n\t\t} ),\n\t\tgridSettings: {\n\t\t\t...gridSettings,\n\t\t\tmodel: targetModel,\n\t\t} as WidgetGridSettings,\n\t};\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,4BAA8B;AAM9B,mBAA8C;AAEvC,SAAS,aAAc,UAAgD;AAC7E,SAAO,SAAS,SAAS;AAC1B;AAmBO,SAAS,uBAAwB;AAAA,EACvC;AAAA,EACA;AAAA,EACA;AACD,GAA+D;AAC9D,QAAM,eAAe,aAAc,YAAa;AAEhD,MAAK,iBAAiB,aAAc;AACnC,WAAO;AAAA,EACR;AAEA,SAAO;AAAA,IACN,YAAQ,qCAAe,QAAQ,cAAc,aAAa;AAAA,MACzD,SAAS;AAAA,IACV,CAAE;AAAA,IACF,cAAc;AAAA,MACb,GAAG;AAAA,MACH,OAAO;AAAA,IACR;AAAA,EACD;AACD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|