@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,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/widgets/widget-resize-handle.tsx", "../../../../style-runtime/src/index.ts", "../../../src/components/widgets/widget-resize-handle.module.css"],
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\nimport type { ResizeHandleRenderProps } from '@wordpress/grid';\n\n/**\n * Internal dependencies\n */\nimport styles from './widget-resize-handle.module.css';\n\ntype WidgetResizeHandleProps = Omit< ResizeHandleRenderProps, 'ref' >;\n\n/**\n * Rounded L-shaped resize affordance for the widget dashboard. Passed to\n * `DashboardGrid` via `renderResizeHandle` so the grid keeps gesture wiring.\n *\n * Uses `forwardRef` because the grid attaches dnd-kit's merged node ref via\n * the JSX `ref` attribute, not as a regular prop.\n */\nexport const WidgetResizeHandle = forwardRef<\n\tHTMLDivElement,\n\tWidgetResizeHandleProps\n>( function WidgetResizeHandle(\n\t{ listeners, attributes, verticalResizable, isResizing },\n\tref\n) {\n\tif ( ! verticalResizable ) {\n\t\treturn (\n\t\t\t<div\n\t\t\t\tref={ ref }\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\tstyles.handle,\n\t\t\t\t\tstyles.handleHorizontal,\n\t\t\t\t\tisResizing && styles.resizing\n\t\t\t\t) }\n\t\t\t\t{ ...listeners }\n\t\t\t\t{ ...attributes }\n\t\t\t></div>\n\t\t);\n\t}\n\n\treturn (\n\t\t<div\n\t\t\tref={ ref }\n\t\t\tclassName={ clsx(\n\t\t\t\tstyles.handle,\n\t\t\t\tstyles.handleCorner,\n\t\t\t\tisResizing && styles.resizing\n\t\t\t) }\n\t\t\t{ ...listeners }\n\t\t\t{ ...attributes }\n\t\t></div>\n\t);\n} );\n", "type GlobalScopeWithStyleRuntime = typeof globalThis & {\n\t// This global is shared by separately bundled copies of this package.\n\t// Keep its shape backward compatible after release.\n\t__wpStyleRuntime?: {\n\t\tdocuments: Map< Document, number >;\n\t\tstyles: Map< string, string >;\n\t\tinjectedStyles: WeakMap< Document, Set< string > >;\n\t};\n};\n\nconst STYLE_HASH_ATTRIBUTE = 'data-wp-hash';\n\n/**\n * Returns the shared style runtime registry.\n *\n * The registry is stored on `globalThis` so separately bundled copies of this\n * package can coordinate through the same document and style maps.\n *\n * @return The shared runtime registry.\n */\nfunction getRuntime() {\n\tconst globalScope = globalThis as GlobalScopeWithStyleRuntime;\n\n\tif ( globalScope.__wpStyleRuntime ) {\n\t\treturn globalScope.__wpStyleRuntime;\n\t}\n\n\tglobalScope.__wpStyleRuntime = {\n\t\tdocuments: new Map(),\n\t\tstyles: new Map(),\n\t\tinjectedStyles: new WeakMap(),\n\t};\n\n\tif ( typeof document !== 'undefined' ) {\n\t\tregisterDocument( document );\n\t}\n\n\treturn globalScope.__wpStyleRuntime;\n}\n\n/**\n * Checks whether a document already contains a style tag for a hash.\n *\n * @param targetDocument Document to inspect.\n * @param hash Stable hash for the transformed CSS.\n *\n * @return Whether the style hash already exists in the document.\n */\nfunction documentContainsStyleHash(\n\ttargetDocument: Document,\n\thash: string\n): boolean {\n\tif ( ! targetDocument.head ) {\n\t\treturn false;\n\t}\n\n\tfor ( const style of targetDocument.head.querySelectorAll(\n\t\t`style[${ STYLE_HASH_ATTRIBUTE }]`\n\t) ) {\n\t\tif ( style.getAttribute( STYLE_HASH_ATTRIBUTE ) === hash ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}\n\n/**\n * Injects a registered style into a document, unless that document already\n * contains a style tag for the same hash.\n *\n * @param targetDocument Document to inject the style into.\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nfunction injectStyle( targetDocument: Document, hash: string, css: string ) {\n\tif ( ! targetDocument.head ) {\n\t\treturn;\n\t}\n\n\tconst runtime = getRuntime();\n\tlet injectedStyles = runtime.injectedStyles.get( targetDocument );\n\n\tif ( ! injectedStyles ) {\n\t\tinjectedStyles = new Set();\n\t\truntime.injectedStyles.set( targetDocument, injectedStyles );\n\t}\n\n\tif ( injectedStyles.has( hash ) ) {\n\t\treturn;\n\t}\n\n\t// Older generated CSS module output can still inject matching style tags\n\t// after this document's cache is created, so keep the DOM as the fallback\n\t// source of truth on cache misses.\n\tif ( documentContainsStyleHash( targetDocument, hash ) ) {\n\t\tinjectedStyles.add( hash );\n\t\treturn;\n\t}\n\n\tconst style = targetDocument.createElement( 'style' );\n\tstyle.setAttribute( STYLE_HASH_ATTRIBUTE, hash );\n\tstyle.appendChild( targetDocument.createTextNode( css ) );\n\ttargetDocument.head.appendChild( style );\n\tinjectedStyles.add( hash );\n}\n\n/**\n * Registers a document as a style injection target.\n *\n * Existing registered styles are replayed into the document immediately.\n * Documents are reference-counted so multiple providers can safely register the\n * same document without one cleanup removing it while another registration is\n * still active.\n *\n * @param targetDocument Document to receive registered styles.\n * @return Cleanup function that unregisters this document registration.\n */\nexport function registerDocument( targetDocument: Document ) {\n\tconst runtime = getRuntime();\n\n\truntime.documents.set(\n\t\ttargetDocument,\n\t\t( runtime.documents.get( targetDocument ) ?? 0 ) + 1\n\t);\n\n\tfor ( const [ hash, css ] of runtime.styles ) {\n\t\tinjectStyle( targetDocument, hash, css );\n\t}\n\n\treturn () => {\n\t\tconst count = runtime.documents.get( targetDocument );\n\n\t\tif ( count === undefined ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( count <= 1 ) {\n\t\t\truntime.documents.delete( targetDocument );\n\t\t\treturn;\n\t\t}\n\n\t\truntime.documents.set( targetDocument, count - 1 );\n\t};\n}\n\n/**\n * Registers a style and injects it into all registered documents.\n *\n * The hash is used as the deduplication key, so calling this repeatedly with\n * the same hash will not add duplicate style tags to a document.\n * Registered styles are retained for the lifetime of the page so they can be\n * replayed into documents that are registered later.\n *\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nexport function registerStyle( hash: string, css: string ) {\n\tconst runtime = getRuntime();\n\n\truntime.styles.set( hash, css );\n\n\tfor ( const targetDocument of runtime.documents.keys() ) {\n\t\tinjectStyle( targetDocument, hash, css );\n\t}\n}\n", "import { registerStyle } from '@wordpress/style-runtime';\nif (typeof process === 'undefined' || process.env.NODE_ENV !== 'test') {\n\tregisterStyle(\"2e64f95efa\", \".a70c7d5347a2f54b__handle{--widget-resize-handle-visual-inset:var(--wpds-dimension-padding-xs,4px);--widget-resize-handle-hover-scale:1.18;background:transparent;bottom:0;box-sizing:border-box;inset-inline-end:0;padding:0;position:absolute;z-index:1}.a70c7d5347a2f54b__handle:focus-visible{border-radius:var(--wpds-border-radius-sm,2px);outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9));outline-offset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}.aa1d4aafe4d24e03__resizing{opacity:.72}._61d861c3afc33ad5__handleCorner{cursor:nwse-resize;height:var(--wpds-dimension-size-sm,24px);width:var(--wpds-dimension-size-sm,24px)}._61d861c3afc33ad5__handleCorner:after{border-block-end:var(--wpds-border-width-sm,2px) solid var(--wpds-color-foreground-interactive-brand,var(--wp-admin-theme-color,#3858e9));border-block-start:none;border-end-end-radius:var(--wpds-border-radius-md,4px);border-inline-end:var(--wpds-border-width-sm,2px) solid var(--wpds-color-foreground-interactive-brand,var(--wp-admin-theme-color,#3858e9));border-inline-start:none;bottom:var(--widget-resize-handle-visual-inset);box-sizing:border-box;content:\\\"\\\";height:var(--wpds-dimension-size-4xs,8px);inset-inline-end:var(--widget-resize-handle-visual-inset);position:absolute;transform:scale(1);transform-origin:100% 100%;width:var(--wpds-dimension-size-4xs,8px)}[dir=rtl] ._61d861c3afc33ad5__handleCorner:after{transform-origin:0 100%}._61d861c3afc33ad5__handleCorner.aa1d4aafe4d24e03__resizing:after,._61d861c3afc33ad5__handleCorner:focus-visible:after,._61d861c3afc33ad5__handleCorner:hover:after{border-block-end:var(--wpds-border-width-sm,2px) solid var(--wpds-color-foreground-interactive-brand-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 52%,#000));border-inline-end:var(--wpds-border-width-sm,2px) solid var(--wpds-color-foreground-interactive-brand-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 52%,#000));transform:scale(var(--widget-resize-handle-hover-scale))}._86ab3a6eb52bc222__handleHorizontal{align-items:center;border:none;cursor:ew-resize;display:flex;height:var(--wpds-dimension-size-lg,40px);justify-content:center;padding-inline-end:var(--widget-resize-handle-visual-inset);width:var(--wpds-dimension-size-sm,24px)}@media not (prefers-reduced-motion){._61d861c3afc33ad5__handleCorner:after{transition:transform var(--wpds-motion-duration-xs,50ms) var(--wpds-motion-easing-balanced,cubic-bezier(.4,0,.2,1)),border-block-end-color var(--wpds-motion-duration-xs,50ms) var(--wpds-motion-easing-balanced,cubic-bezier(.4,0,.2,1)),border-inline-end-color var(--wpds-motion-duration-xs,50ms) var(--wpds-motion-easing-balanced,cubic-bezier(.4,0,.2,1))}._86ab3a6eb52bc222__handleHorizontal:after{transition:transform var(--wpds-motion-duration-xs,50ms) var(--wpds-motion-easing-balanced,cubic-bezier(.4,0,.2,1)),background-color var(--wpds-motion-duration-xs,50ms) var(--wpds-motion-easing-balanced,cubic-bezier(.4,0,.2,1))}}._86ab3a6eb52bc222__handleHorizontal:after{background-color:var(--wpds-color-foreground-interactive-brand,var(--wp-admin-theme-color,#3858e9));content:\\\"\\\";height:var(--wpds-dimension-size-3xs,12px);transform:scale(1);transform-origin:50% 100%;width:var(--wpds-border-width-sm,2px)}._86ab3a6eb52bc222__handleHorizontal.aa1d4aafe4d24e03__resizing:after,._86ab3a6eb52bc222__handleHorizontal:focus-visible:after,._86ab3a6eb52bc222__handleHorizontal:hover:after{background-color:var(--wpds-color-foreground-interactive-brand-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 52%,#000));transform:scale(var(--widget-resize-handle-hover-scale))}@media (forced-colors:active){._61d861c3afc33ad5__handleCorner.aa1d4aafe4d24e03__resizing:after,._61d861c3afc33ad5__handleCorner:after,._61d861c3afc33ad5__handleCorner:focus-visible:after,._61d861c3afc33ad5__handleCorner:hover:after{border-block-end-color:Highlight;border-inline-end-color:Highlight}._86ab3a6eb52bc222__handleHorizontal.aa1d4aafe4d24e03__resizing:after,._86ab3a6eb52bc222__handleHorizontal:after,._86ab3a6eb52bc222__handleHorizontal:focus-visible:after,._86ab3a6eb52bc222__handleHorizontal:hover:after{background-color:Highlight}}\");\n}\nexport default {\"handle\":\"a70c7d5347a2f54b__handle\",\"resizing\":\"aa1d4aafe4d24e03__resizing\",\"handleCorner\":\"_61d861c3afc33ad5__handleCorner\",\"handleHorizontal\":\"_86ab3a6eb52bc222__handleHorizontal\"};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,qBAA2B;;;ACE3B,IAAM,uBAAuB;AAU7B,SAAS,aAAa;AACrB,QAAM,cAAc;AAEpB,MAAK,YAAY,kBAAmB;AACnC,WAAO,YAAY;AAAA,EACpB;AAEA,cAAY,mBAAmB;AAAA,IAC9B,WAAW,oBAAI,IAAI;AAAA,IACnB,QAAQ,oBAAI,IAAI;AAAA,IAChB,gBAAgB,oBAAI,QAAQ;AAAA,EAC7B;AAEA,MAAK,OAAO,aAAa,aAAc;AACtC,qBAAkB,QAAS;AAAA,EAC5B;AAEA,SAAO,YAAY;AACpB;AAUA,SAAS,0BACR,gBACA,MACU;AACV,MAAK,CAAE,eAAe,MAAO;AAC5B,WAAO;AAAA,EACR;AAEA,aAAY,SAAS,eAAe,KAAK;AAAA,IACxC,SAAU,oBAAqB;AAAA,EAChC,GAAI;AACH,QAAK,MAAM,aAAc,oBAAqB,MAAM,MAAO;AAC1D,aAAO;AAAA,IACR;AAAA,EACD;AAEA,SAAO;AACR;AAUA,SAAS,YAAa,gBAA0B,MAAc,KAAc;AAC3E,MAAK,CAAE,eAAe,MAAO;AAC5B;AAAA,EACD;AAEA,QAAM,UAAU,WAAW;AAC3B,MAAI,iBAAiB,QAAQ,eAAe,IAAK,cAAe;AAEhE,MAAK,CAAE,gBAAiB;AACvB,qBAAiB,oBAAI,IAA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;;AF8BlM;AATI,IAAM,yBAAqB,2BAG/B,SAASA,oBACX,EAAE,WAAW,YAAY,mBAAmB,WAAW,GACvD,KACC;AACD,MAAK,CAAE,mBAAoB;AAC1B,WACC;AAAA,MAAC;AAAA;AAAA,QACA;AAAA,QACA,eAAY,YAAAC;AAAA,UACX,6BAAO;AAAA,UACP,6BAAO;AAAA,UACP,cAAc,6BAAO;AAAA,QACtB;AAAA,QACE,GAAG;AAAA,QACH,GAAG;AAAA;AAAA,IACL;AAAA,EAEH;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA;AAAA,MACA,eAAY,YAAAA;AAAA,QACX,6BAAO;AAAA,QACP,6BAAO;AAAA,QACP,cAAc,6BAAO;AAAA,MACtB;AAAA,MACE,GAAG;AAAA,MACH,GAAG;AAAA;AAAA,EACL;AAEH,CAAE;",
|
|
6
|
+
"names": ["WidgetResizeHandle", "clsx"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// packages/widget-dashboard/src/components/widgets/widgets.tsx
|
|
31
|
+
var widgets_exports = {};
|
|
32
|
+
__export(widgets_exports, {
|
|
33
|
+
Widgets: () => Widgets
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(widgets_exports);
|
|
36
|
+
var import_clsx = __toESM(require("clsx"));
|
|
37
|
+
var import_element = require("@wordpress/element");
|
|
38
|
+
var import_grid = require("@wordpress/grid");
|
|
39
|
+
var import_dashboard_context = require("../../context/dashboard-context.cjs");
|
|
40
|
+
var import_use_dashboard_container_column_count = require("../../hooks/use-dashboard-container-column-count.cjs");
|
|
41
|
+
var import_widget_chrome = require("../widget-chrome/index.cjs");
|
|
42
|
+
var import_widget_settings = require("../widget-settings/index.cjs");
|
|
43
|
+
var import_widget_layout_toolbar = require("./widget-layout-toolbar.cjs");
|
|
44
|
+
var import_widget_resize_handle = require("./widget-resize-handle.cjs");
|
|
45
|
+
|
|
46
|
+
// packages/style-runtime/src/index.ts
|
|
47
|
+
var STYLE_HASH_ATTRIBUTE = "data-wp-hash";
|
|
48
|
+
function getRuntime() {
|
|
49
|
+
const globalScope = globalThis;
|
|
50
|
+
if (globalScope.__wpStyleRuntime) {
|
|
51
|
+
return globalScope.__wpStyleRuntime;
|
|
52
|
+
}
|
|
53
|
+
globalScope.__wpStyleRuntime = {
|
|
54
|
+
documents: /* @__PURE__ */ new Map(),
|
|
55
|
+
styles: /* @__PURE__ */ new Map(),
|
|
56
|
+
injectedStyles: /* @__PURE__ */ new WeakMap()
|
|
57
|
+
};
|
|
58
|
+
if (typeof document !== "undefined") {
|
|
59
|
+
registerDocument(document);
|
|
60
|
+
}
|
|
61
|
+
return globalScope.__wpStyleRuntime;
|
|
62
|
+
}
|
|
63
|
+
function documentContainsStyleHash(targetDocument, hash) {
|
|
64
|
+
if (!targetDocument.head) {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
for (const style of targetDocument.head.querySelectorAll(
|
|
68
|
+
`style[${STYLE_HASH_ATTRIBUTE}]`
|
|
69
|
+
)) {
|
|
70
|
+
if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) {
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
function injectStyle(targetDocument, hash, css) {
|
|
77
|
+
if (!targetDocument.head) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
const runtime = getRuntime();
|
|
81
|
+
let injectedStyles = runtime.injectedStyles.get(targetDocument);
|
|
82
|
+
if (!injectedStyles) {
|
|
83
|
+
injectedStyles = /* @__PURE__ */ new Set();
|
|
84
|
+
runtime.injectedStyles.set(targetDocument, injectedStyles);
|
|
85
|
+
}
|
|
86
|
+
if (injectedStyles.has(hash)) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
if (documentContainsStyleHash(targetDocument, hash)) {
|
|
90
|
+
injectedStyles.add(hash);
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
const style = targetDocument.createElement("style");
|
|
94
|
+
style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);
|
|
95
|
+
style.appendChild(targetDocument.createTextNode(css));
|
|
96
|
+
targetDocument.head.appendChild(style);
|
|
97
|
+
injectedStyles.add(hash);
|
|
98
|
+
}
|
|
99
|
+
function registerDocument(targetDocument) {
|
|
100
|
+
const runtime = getRuntime();
|
|
101
|
+
runtime.documents.set(
|
|
102
|
+
targetDocument,
|
|
103
|
+
(runtime.documents.get(targetDocument) ?? 0) + 1
|
|
104
|
+
);
|
|
105
|
+
for (const [hash, css] of runtime.styles) {
|
|
106
|
+
injectStyle(targetDocument, hash, css);
|
|
107
|
+
}
|
|
108
|
+
return () => {
|
|
109
|
+
const count = runtime.documents.get(targetDocument);
|
|
110
|
+
if (count === void 0) {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
if (count <= 1) {
|
|
114
|
+
runtime.documents.delete(targetDocument);
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
runtime.documents.set(targetDocument, count - 1);
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
function registerStyle(hash, css) {
|
|
121
|
+
const runtime = getRuntime();
|
|
122
|
+
runtime.styles.set(hash, css);
|
|
123
|
+
for (const targetDocument of runtime.documents.keys()) {
|
|
124
|
+
injectStyle(targetDocument, hash, css);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// packages/widget-dashboard/src/components/widgets/widgets.module.css
|
|
129
|
+
if (typeof process === "undefined" || process.env.NODE_ENV !== "test") {
|
|
130
|
+
registerStyle("8516d4e5b3", "._942bbd7b48da810c__grid{--wp-grid-placeholder-radius:var(--wpds-border-radius-lg,8px);--wp-grid-drag-preview-radius:var(--wpds-border-radius-lg,8px);container-name:widget-dashboard;container-type:inline-size;width:100%}.a87790b3d11e7d7d__tile{border-radius:var(--wpds-border-radius-lg,8px);height:100%}._5315dd1c30ef4e77__tileEditMode{box-shadow:var(--wpds-elevation-xs,0 1px 1px 0 #00000008,0 1px 2px 0 #00000005,0 3px 3px 0 #00000005,0 4px 4px 0 #00000003)}._5315dd1c30ef4e77__tileEditMode:focus-visible{outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9));outline-offset:2px}._6b2daa817d860e6e__dragPreview{height:100%}._6b2daa817d860e6e__dragPreview .a87790b3d11e7d7d__tile{box-shadow:none}");
|
|
131
|
+
}
|
|
132
|
+
var widgets_default = { "grid": "_942bbd7b48da810c__grid", "tile": "a87790b3d11e7d7d__tile", "tileEditMode": "_5315dd1c30ef4e77__tileEditMode", "dragPreview": "_6b2daa817d860e6e__dragPreview" };
|
|
133
|
+
|
|
134
|
+
// packages/widget-dashboard/src/components/widgets/widgets.tsx
|
|
135
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
136
|
+
function toGridLayout(widgets) {
|
|
137
|
+
return widgets.map((w) => ({
|
|
138
|
+
key: w.uuid,
|
|
139
|
+
...w.placement
|
|
140
|
+
}));
|
|
141
|
+
}
|
|
142
|
+
function toMasonryLayout(widgets) {
|
|
143
|
+
return widgets.map((w) => ({
|
|
144
|
+
key: w.uuid,
|
|
145
|
+
...w.placement
|
|
146
|
+
}));
|
|
147
|
+
}
|
|
148
|
+
function applyGridChange(widgets, gridLayout) {
|
|
149
|
+
return gridLayout.map(({ key, ...placement }) => {
|
|
150
|
+
const existing = widgets.find((w) => w.uuid === key);
|
|
151
|
+
if (!existing) {
|
|
152
|
+
return {
|
|
153
|
+
uuid: key,
|
|
154
|
+
type: "",
|
|
155
|
+
placement
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
return {
|
|
159
|
+
...existing,
|
|
160
|
+
placement
|
|
161
|
+
};
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
function applyMasonryChange(widgets, masonryLayout) {
|
|
165
|
+
return masonryLayout.map(({ key, ...placement }) => {
|
|
166
|
+
const existing = widgets.find((w) => w.uuid === key);
|
|
167
|
+
if (!existing) {
|
|
168
|
+
return {
|
|
169
|
+
uuid: key,
|
|
170
|
+
type: "",
|
|
171
|
+
placement
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
return {
|
|
175
|
+
...existing,
|
|
176
|
+
placement
|
|
177
|
+
};
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
var Widgets = (0, import_element.forwardRef)(
|
|
181
|
+
function Widgets2({ className }, ref) {
|
|
182
|
+
const { layout, onLayoutChange, editMode, gridSettings, widgetTypes } = (0, import_dashboard_context.useDashboardInternalContext)();
|
|
183
|
+
const { containerRef, columnCount } = (0, import_use_dashboard_container_column_count.useDashboardContainerColumnCount)(ref);
|
|
184
|
+
const isMasonry = gridSettings.model === "masonry";
|
|
185
|
+
const gridLayout = (0, import_element.useMemo)(
|
|
186
|
+
() => isMasonry ? toMasonryLayout(layout) : toGridLayout(layout),
|
|
187
|
+
[layout, isMasonry]
|
|
188
|
+
);
|
|
189
|
+
const handleGridChange = (0, import_element.useCallback)(
|
|
190
|
+
(newGridLayout) => {
|
|
191
|
+
onLayoutChange(applyGridChange(layout, newGridLayout));
|
|
192
|
+
},
|
|
193
|
+
[layout, onLayoutChange]
|
|
194
|
+
);
|
|
195
|
+
const handleMasonryChange = (0, import_element.useCallback)(
|
|
196
|
+
(newMasonryLayout) => {
|
|
197
|
+
onLayoutChange(
|
|
198
|
+
applyMasonryChange(layout, newMasonryLayout)
|
|
199
|
+
);
|
|
200
|
+
},
|
|
201
|
+
[layout, onLayoutChange]
|
|
202
|
+
);
|
|
203
|
+
const children = layout.map((widget, index) => {
|
|
204
|
+
const widgetType = widgetTypes.find(
|
|
205
|
+
(type) => type.name === widget.type
|
|
206
|
+
);
|
|
207
|
+
const hasSettings = !!widgetType?.attributes?.length;
|
|
208
|
+
let actionableArea;
|
|
209
|
+
if (editMode) {
|
|
210
|
+
actionableArea = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_widget_layout_toolbar.WidgetLayoutToolbar, { widget });
|
|
211
|
+
} else if (hasSettings && widgetType) {
|
|
212
|
+
actionableArea = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
213
|
+
import_widget_settings.WidgetSettingsToolbar,
|
|
214
|
+
{
|
|
215
|
+
widget,
|
|
216
|
+
widgetType
|
|
217
|
+
}
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
221
|
+
import_widget_chrome.WidgetChrome,
|
|
222
|
+
{
|
|
223
|
+
widget,
|
|
224
|
+
index,
|
|
225
|
+
className: (0, import_clsx.default)(widgets_default.tile, {
|
|
226
|
+
[widgets_default.tileEditMode]: editMode
|
|
227
|
+
}),
|
|
228
|
+
actionableArea
|
|
229
|
+
},
|
|
230
|
+
widget.uuid
|
|
231
|
+
);
|
|
232
|
+
});
|
|
233
|
+
const renderDragPreview = (0, import_element.useCallback)(
|
|
234
|
+
({ children: clone }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: widgets_default.dragPreview, children: clone }),
|
|
235
|
+
[]
|
|
236
|
+
);
|
|
237
|
+
const sharedRenderProps = {
|
|
238
|
+
editMode,
|
|
239
|
+
renderDragPreview,
|
|
240
|
+
renderResizeHandle: import_widget_resize_handle.WidgetResizeHandle
|
|
241
|
+
};
|
|
242
|
+
const surface = isMasonry ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
243
|
+
import_grid.DashboardLanes,
|
|
244
|
+
{
|
|
245
|
+
layout: gridLayout,
|
|
246
|
+
columns: columnCount,
|
|
247
|
+
flowTolerance: gridSettings.flowTolerance,
|
|
248
|
+
onChangeLayout: handleMasonryChange,
|
|
249
|
+
...sharedRenderProps,
|
|
250
|
+
children
|
|
251
|
+
}
|
|
252
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
253
|
+
import_grid.DashboardGrid,
|
|
254
|
+
{
|
|
255
|
+
layout: gridLayout,
|
|
256
|
+
columns: columnCount,
|
|
257
|
+
rowHeight: gridSettings.rowHeight,
|
|
258
|
+
onChangeLayout: handleGridChange,
|
|
259
|
+
...sharedRenderProps,
|
|
260
|
+
children
|
|
261
|
+
}
|
|
262
|
+
);
|
|
263
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
264
|
+
"div",
|
|
265
|
+
{
|
|
266
|
+
ref: containerRef,
|
|
267
|
+
className: (0, import_clsx.default)(widgets_default.grid, className),
|
|
268
|
+
children: surface
|
|
269
|
+
}
|
|
270
|
+
);
|
|
271
|
+
}
|
|
272
|
+
);
|
|
273
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
274
|
+
0 && (module.exports = {
|
|
275
|
+
Widgets
|
|
276
|
+
});
|
|
277
|
+
//# sourceMappingURL=widgets.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/widgets/widgets.tsx", "../../../../style-runtime/src/index.ts", "../../../src/components/widgets/widgets.module.css"],
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef, useCallback, useMemo } from '@wordpress/element';\nimport { DashboardGrid, DashboardLanes } from '@wordpress/grid';\nimport type {\n\tDashboardGridLayoutItem,\n\tDashboardLanesLayoutItem,\n\tDragPreviewRenderProps,\n\tResizeHandleRenderProps,\n} from '@wordpress/grid';\nimport type { WidgetName } from '@wordpress/widget-primitives';\n\n/**\n * Internal dependencies\n */\nimport { useDashboardInternalContext } from '../../context/dashboard-context';\nimport { useDashboardContainerColumnCount } from '../../hooks/use-dashboard-container-column-count';\nimport { WidgetChrome } from '../widget-chrome';\nimport { WidgetSettingsToolbar } from '../widget-settings';\nimport { WidgetLayoutToolbar } from './widget-layout-toolbar';\nimport { WidgetResizeHandle } from './widget-resize-handle';\nimport styles from './widgets.module.css';\nimport type {\n\tDashboardWidget,\n\tGridTilePlacement,\n\tMasonryTilePlacement,\n} from '../../types';\n\nfunction toGridLayout( widgets: DashboardWidget[] ): DashboardGridLayoutItem[] {\n\treturn widgets.map( ( w ) => ( {\n\t\tkey: w.uuid,\n\t\t...( w.placement as GridTilePlacement | undefined ),\n\t} ) );\n}\n\nfunction toMasonryLayout(\n\twidgets: DashboardWidget[]\n): DashboardLanesLayoutItem[] {\n\treturn widgets.map( ( w ) => ( {\n\t\tkey: w.uuid,\n\t\t...( w.placement as MasonryTilePlacement | undefined ),\n\t} ) );\n}\n\nfunction applyGridChange(\n\twidgets: DashboardWidget[],\n\tgridLayout: DashboardGridLayoutItem[]\n): DashboardWidget[] {\n\treturn gridLayout.map( ( { key, ...placement } ) => {\n\t\tconst existing = widgets.find( ( w ) => w.uuid === key );\n\t\tif ( ! existing ) {\n\t\t\treturn {\n\t\t\t\tuuid: key,\n\t\t\t\ttype: '' as WidgetName,\n\t\t\t\tplacement,\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\t...existing,\n\t\t\tplacement,\n\t\t};\n\t} );\n}\n\nfunction applyMasonryChange(\n\twidgets: DashboardWidget[],\n\tmasonryLayout: DashboardLanesLayoutItem[]\n): DashboardWidget[] {\n\treturn masonryLayout.map( ( { key, ...placement } ) => {\n\t\tconst existing = widgets.find( ( w ) => w.uuid === key );\n\t\tif ( ! existing ) {\n\t\t\treturn {\n\t\t\t\tuuid: key,\n\t\t\t\ttype: '' as WidgetName,\n\t\t\t\tplacement,\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\t...existing,\n\t\t\tplacement,\n\t\t};\n\t} );\n}\n\nexport interface WidgetsProps {\n\tclassName?: string;\n}\n\n/**\n * Iterates `layout`, delegates each entry to `WidgetDashboard.WidgetChrome`, and\n * feeds the resulting tree into the active `@wordpress/grid` surface (2D grid\n * or masonry, picked from `gridSettings.model`).\n */\nexport const Widgets = forwardRef< HTMLDivElement, WidgetsProps >(\n\tfunction Widgets( { className }, ref ) {\n\t\tconst { layout, onLayoutChange, editMode, gridSettings, widgetTypes } =\n\t\t\tuseDashboardInternalContext();\n\t\tconst { containerRef, columnCount } =\n\t\t\tuseDashboardContainerColumnCount( ref );\n\t\tconst isMasonry = gridSettings.model === 'masonry';\n\n\t\tconst gridLayout = useMemo(\n\t\t\t() =>\n\t\t\t\tisMasonry ? toMasonryLayout( layout ) : toGridLayout( layout ),\n\t\t\t[ layout, isMasonry ]\n\t\t);\n\n\t\tconst handleGridChange = useCallback(\n\t\t\t( newGridLayout: DashboardGridLayoutItem[] ) => {\n\t\t\t\tonLayoutChange( applyGridChange( layout, newGridLayout ) );\n\t\t\t},\n\t\t\t[ layout, onLayoutChange ]\n\t\t);\n\n\t\tconst handleMasonryChange = useCallback(\n\t\t\t( newMasonryLayout: DashboardLanesLayoutItem[] ) => {\n\t\t\t\tonLayoutChange(\n\t\t\t\t\tapplyMasonryChange( layout, newMasonryLayout )\n\t\t\t\t);\n\t\t\t},\n\t\t\t[ layout, onLayoutChange ]\n\t\t);\n\n\t\tconst children = layout.map( ( widget, index ) => {\n\t\t\tconst widgetType = widgetTypes.find(\n\t\t\t\t( type ) => type.name === widget.type\n\t\t\t);\n\t\t\tconst hasSettings = !! widgetType?.attributes?.length;\n\n\t\t\t// One slot, chosen by mode: layout toolbar while customizing,\n\t\t\t// settings toolbar otherwise (undefined when nothing to configure).\n\t\t\tlet actionableArea: React.ReactNode;\n\t\t\tif ( editMode ) {\n\t\t\t\tactionableArea = <WidgetLayoutToolbar widget={ widget } />;\n\t\t\t} else if ( hasSettings && widgetType ) {\n\t\t\t\tactionableArea = (\n\t\t\t\t\t<WidgetSettingsToolbar\n\t\t\t\t\t\twidget={ widget }\n\t\t\t\t\t\twidgetType={ widgetType }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn (\n\t\t\t\t<WidgetChrome\n\t\t\t\t\tkey={ widget.uuid }\n\t\t\t\t\twidget={ widget }\n\t\t\t\t\tindex={ index }\n\t\t\t\t\tclassName={ clsx( styles.tile, {\n\t\t\t\t\t\t[ styles.tileEditMode ]: editMode,\n\t\t\t\t\t} ) }\n\t\t\t\t\tactionableArea={ actionableArea }\n\t\t\t\t/>\n\t\t\t);\n\t\t} );\n\n\t\tconst renderDragPreview = useCallback(\n\t\t\t( { children: clone }: DragPreviewRenderProps ) => (\n\t\t\t\t<div className={ styles.dragPreview }>{ clone }</div>\n\t\t\t),\n\t\t\t[]\n\t\t);\n\n\t\tconst sharedRenderProps = {\n\t\t\teditMode,\n\t\t\trenderDragPreview,\n\t\t\trenderResizeHandle:\n\t\t\t\tWidgetResizeHandle as React.ComponentType< ResizeHandleRenderProps >,\n\t\t};\n\n\t\tconst surface: React.ReactNode = isMasonry ? (\n\t\t\t<DashboardLanes\n\t\t\t\tlayout={ gridLayout as DashboardLanesLayoutItem[] }\n\t\t\t\tcolumns={ columnCount }\n\t\t\t\tflowTolerance={ gridSettings.flowTolerance }\n\t\t\t\tonChangeLayout={ handleMasonryChange }\n\t\t\t\t{ ...sharedRenderProps }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</DashboardLanes>\n\t\t) : (\n\t\t\t<DashboardGrid\n\t\t\t\tlayout={ gridLayout as DashboardGridLayoutItem[] }\n\t\t\t\tcolumns={ columnCount }\n\t\t\t\trowHeight={ gridSettings.rowHeight }\n\t\t\t\tonChangeLayout={ handleGridChange }\n\t\t\t\t{ ...sharedRenderProps }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</DashboardGrid>\n\t\t);\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\tref={ containerRef }\n\t\t\t\tclassName={ clsx( styles.grid, className ) }\n\t\t\t>\n\t\t\t\t{ surface }\n\t\t\t</div>\n\t\t);\n\t}\n);\n", "type GlobalScopeWithStyleRuntime = typeof globalThis & {\n\t// This global is shared by separately bundled copies of this package.\n\t// Keep its shape backward compatible after release.\n\t__wpStyleRuntime?: {\n\t\tdocuments: Map< Document, number >;\n\t\tstyles: Map< string, string >;\n\t\tinjectedStyles: WeakMap< Document, Set< string > >;\n\t};\n};\n\nconst STYLE_HASH_ATTRIBUTE = 'data-wp-hash';\n\n/**\n * Returns the shared style runtime registry.\n *\n * The registry is stored on `globalThis` so separately bundled copies of this\n * package can coordinate through the same document and style maps.\n *\n * @return The shared runtime registry.\n */\nfunction getRuntime() {\n\tconst globalScope = globalThis as GlobalScopeWithStyleRuntime;\n\n\tif ( globalScope.__wpStyleRuntime ) {\n\t\treturn globalScope.__wpStyleRuntime;\n\t}\n\n\tglobalScope.__wpStyleRuntime = {\n\t\tdocuments: new Map(),\n\t\tstyles: new Map(),\n\t\tinjectedStyles: new WeakMap(),\n\t};\n\n\tif ( typeof document !== 'undefined' ) {\n\t\tregisterDocument( document );\n\t}\n\n\treturn globalScope.__wpStyleRuntime;\n}\n\n/**\n * Checks whether a document already contains a style tag for a hash.\n *\n * @param targetDocument Document to inspect.\n * @param hash Stable hash for the transformed CSS.\n *\n * @return Whether the style hash already exists in the document.\n */\nfunction documentContainsStyleHash(\n\ttargetDocument: Document,\n\thash: string\n): boolean {\n\tif ( ! targetDocument.head ) {\n\t\treturn false;\n\t}\n\n\tfor ( const style of targetDocument.head.querySelectorAll(\n\t\t`style[${ STYLE_HASH_ATTRIBUTE }]`\n\t) ) {\n\t\tif ( style.getAttribute( STYLE_HASH_ATTRIBUTE ) === hash ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}\n\n/**\n * Injects a registered style into a document, unless that document already\n * contains a style tag for the same hash.\n *\n * @param targetDocument Document to inject the style into.\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nfunction injectStyle( targetDocument: Document, hash: string, css: string ) {\n\tif ( ! targetDocument.head ) {\n\t\treturn;\n\t}\n\n\tconst runtime = getRuntime();\n\tlet injectedStyles = runtime.injectedStyles.get( targetDocument );\n\n\tif ( ! injectedStyles ) {\n\t\tinjectedStyles = new Set();\n\t\truntime.injectedStyles.set( targetDocument, injectedStyles );\n\t}\n\n\tif ( injectedStyles.has( hash ) ) {\n\t\treturn;\n\t}\n\n\t// Older generated CSS module output can still inject matching style tags\n\t// after this document's cache is created, so keep the DOM as the fallback\n\t// source of truth on cache misses.\n\tif ( documentContainsStyleHash( targetDocument, hash ) ) {\n\t\tinjectedStyles.add( hash );\n\t\treturn;\n\t}\n\n\tconst style = targetDocument.createElement( 'style' );\n\tstyle.setAttribute( STYLE_HASH_ATTRIBUTE, hash );\n\tstyle.appendChild( targetDocument.createTextNode( css ) );\n\ttargetDocument.head.appendChild( style );\n\tinjectedStyles.add( hash );\n}\n\n/**\n * Registers a document as a style injection target.\n *\n * Existing registered styles are replayed into the document immediately.\n * Documents are reference-counted so multiple providers can safely register the\n * same document without one cleanup removing it while another registration is\n * still active.\n *\n * @param targetDocument Document to receive registered styles.\n * @return Cleanup function that unregisters this document registration.\n */\nexport function registerDocument( targetDocument: Document ) {\n\tconst runtime = getRuntime();\n\n\truntime.documents.set(\n\t\ttargetDocument,\n\t\t( runtime.documents.get( targetDocument ) ?? 0 ) + 1\n\t);\n\n\tfor ( const [ hash, css ] of runtime.styles ) {\n\t\tinjectStyle( targetDocument, hash, css );\n\t}\n\n\treturn () => {\n\t\tconst count = runtime.documents.get( targetDocument );\n\n\t\tif ( count === undefined ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( count <= 1 ) {\n\t\t\truntime.documents.delete( targetDocument );\n\t\t\treturn;\n\t\t}\n\n\t\truntime.documents.set( targetDocument, count - 1 );\n\t};\n}\n\n/**\n * Registers a style and injects it into all registered documents.\n *\n * The hash is used as the deduplication key, so calling this repeatedly with\n * the same hash will not add duplicate style tags to a document.\n * Registered styles are retained for the lifetime of the page so they can be\n * replayed into documents that are registered later.\n *\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nexport function registerStyle( hash: string, css: string ) {\n\tconst runtime = getRuntime();\n\n\truntime.styles.set( hash, css );\n\n\tfor ( const targetDocument of runtime.documents.keys() ) {\n\t\tinjectStyle( targetDocument, hash, css );\n\t}\n}\n", "import { registerStyle } from '@wordpress/style-runtime';\nif (typeof process === 'undefined' || process.env.NODE_ENV !== 'test') {\n\tregisterStyle(\"8516d4e5b3\", \"._942bbd7b48da810c__grid{--wp-grid-placeholder-radius:var(--wpds-border-radius-lg,8px);--wp-grid-drag-preview-radius:var(--wpds-border-radius-lg,8px);container-name:widget-dashboard;container-type:inline-size;width:100%}.a87790b3d11e7d7d__tile{border-radius:var(--wpds-border-radius-lg,8px);height:100%}._5315dd1c30ef4e77__tileEditMode{box-shadow:var(--wpds-elevation-xs,0 1px 1px 0 #00000008,0 1px 2px 0 #00000005,0 3px 3px 0 #00000005,0 4px 4px 0 #00000003)}._5315dd1c30ef4e77__tileEditMode:focus-visible{outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9));outline-offset:2px}._6b2daa817d860e6e__dragPreview{height:100%}._6b2daa817d860e6e__dragPreview .a87790b3d11e7d7d__tile{box-shadow:none}\");\n}\nexport default {\"grid\":\"_942bbd7b48da810c__grid\",\"tile\":\"a87790b3d11e7d7d__tile\",\"tileEditMode\":\"_5315dd1c30ef4e77__tileEditMode\",\"dragPreview\":\"_6b2daa817d860e6e__dragPreview\"};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,qBAAiD;AACjD,kBAA8C;AAY9C,+BAA4C;AAC5C,kDAAiD;AACjD,2BAA6B;AAC7B,6BAAsC;AACtC,mCAAoC;AACpC,kCAAmC;;;AChBnC,IAAM,uBAAuB;AAU7B,SAAS,aAAa;AACrB,QAAM,cAAc;AAEpB,MAAK,YAAY,kBAAmB;AACnC,WAAO,YAAY;AAAA,EACpB;AAEA,cAAY,mBAAmB;AAAA,IAC9B,WAAW,oBAAI,IAAI;AAAA,IACnB,QAAQ,oBAAI,IAAI;AAAA,IAChB,gBAAgB,oBAAI,QAAQ;AAAA,EAC7B;AAEA,MAAK,OAAO,aAAa,aAAc;AACtC,qBAAkB,QAAS;AAAA,EAC5B;AAEA,SAAO,YAAY;AACpB;AAUA,SAAS,0BACR,gBACA,MACU;A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,YAAa,GAAG;AAAA,UAC1B,CAAE;AAAA,UACF;AAAA;AAAA,QANM,OAAO;AAAA,MAOd;AAAA,IAEF,CAAE;AAEF,UAAM,wBAAoB;AAAA,MACzB,CAAE,EAAE,UAAU,MAAM,MACnB,4CAAC,SAAI,WAAY,gBAAO,aAAgB,iBAAO;AAAA,MAEhD,CAAC;AAAA,IACF;AAEA,UAAM,oBAAoB;AAAA,MACzB;AAAA,MACA;AAAA,MACA,oBACC;AAAA,IACF;AAEA,UAAM,UAA2B,YAChC;AAAA,MAAC;AAAA;AAAA,QACA,QAAS;AAAA,QACT,SAAU;AAAA,QACV,eAAgB,aAAa;AAAA,QAC7B,gBAAiB;AAAA,QACf,GAAG;AAAA,QAEH;AAAA;AAAA,IACH,IAEA;AAAA,MAAC;AAAA;AAAA,QACA,QAAS;AAAA,QACT,SAAU;AAAA,QACV,WAAY,aAAa;AAAA,QACzB,gBAAiB;AAAA,QACf,GAAG;AAAA,QAEH;AAAA;AAAA,IACH;AAGD,WACC;AAAA,MAAC;AAAA;AAAA,QACA,KAAM;AAAA,QACN,eAAY,YAAAA,SAAM,gBAAO,MAAM,SAAU;AAAA,QAEvC;AAAA;AAAA,IACH;AAAA,EAEF;AACD;",
|
|
6
|
+
"names": ["Widgets", "clsx"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// packages/widget-dashboard/src/context/dashboard-context.tsx
|
|
31
|
+
var dashboard_context_exports = {};
|
|
32
|
+
__export(dashboard_context_exports, {
|
|
33
|
+
WidgetDashboardProvider: () => WidgetDashboardProvider,
|
|
34
|
+
useDashboardInternalContext: () => useDashboardInternalContext
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(dashboard_context_exports);
|
|
37
|
+
var import_es6 = __toESM(require("fast-deep-equal/es6/index.js"));
|
|
38
|
+
var import_element = require("@wordpress/element");
|
|
39
|
+
var import_default_grid = require("../utils/default-grid/index.cjs");
|
|
40
|
+
var import_grid_model_change = require("../utils/grid-model-change/index.cjs");
|
|
41
|
+
var import_normalize_grid_settings = require("../utils/normalize-grid-settings/index.cjs");
|
|
42
|
+
var import_row_height_presets = require("../utils/row-height-presets/index.cjs");
|
|
43
|
+
var import_types = require("../types.cjs");
|
|
44
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
45
|
+
function resolveGridSettings(settings) {
|
|
46
|
+
const normalized = (0, import_normalize_grid_settings.normalizeGridSettings)(settings, import_row_height_presets.DEFAULT_ROW_HEIGHT);
|
|
47
|
+
return {
|
|
48
|
+
...normalized,
|
|
49
|
+
columns: import_types.WIDGET_DASHBOARD_COLUMN_COUNT
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
var DEFAULT_RESOLVE_WIDGET_MODULE = (moduleId) => import(
|
|
53
|
+
/* webpackIgnore: true */
|
|
54
|
+
moduleId
|
|
55
|
+
);
|
|
56
|
+
function canonicalize(layout) {
|
|
57
|
+
const indexed = layout.map((widget, index) => ({
|
|
58
|
+
widget,
|
|
59
|
+
order: widget.placement?.order ?? index
|
|
60
|
+
}));
|
|
61
|
+
indexed.sort((a, b) => a.order - b.order);
|
|
62
|
+
return indexed.map(({ widget }) => {
|
|
63
|
+
if (!widget.placement) {
|
|
64
|
+
return widget;
|
|
65
|
+
}
|
|
66
|
+
const { order: _stripped, ...placement } = widget.placement;
|
|
67
|
+
return { ...widget, placement };
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
var Context = (0, import_element.createContext)(null);
|
|
71
|
+
function useDashboardInternalContext() {
|
|
72
|
+
const ctx = (0, import_element.useContext)(Context);
|
|
73
|
+
if (!ctx) {
|
|
74
|
+
throw new Error(
|
|
75
|
+
"Dashboard compound used outside a WidgetDashboard subtree."
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
return ctx;
|
|
79
|
+
}
|
|
80
|
+
function WidgetDashboardProvider({
|
|
81
|
+
widgetTypes,
|
|
82
|
+
isResolvingWidgetTypes = false,
|
|
83
|
+
layout: committedLayout,
|
|
84
|
+
onLayoutChange,
|
|
85
|
+
onLayoutReset,
|
|
86
|
+
editMode = false,
|
|
87
|
+
onEditChange,
|
|
88
|
+
resolveWidgetModule = DEFAULT_RESOLVE_WIDGET_MODULE,
|
|
89
|
+
gridSettings: committedGridSettings = import_default_grid.DEFAULT_GRID,
|
|
90
|
+
onGridSettingsChange,
|
|
91
|
+
children
|
|
92
|
+
}) {
|
|
93
|
+
const [stagingLayout, setStagingLayout] = (0, import_element.useState)(committedLayout);
|
|
94
|
+
(0, import_element.useEffect)(() => {
|
|
95
|
+
setStagingLayout(committedLayout);
|
|
96
|
+
}, [committedLayout]);
|
|
97
|
+
const [stagingGridSettings, setStagingGridSettings] = (0, import_element.useState)(
|
|
98
|
+
() => (0, import_normalize_grid_settings.normalizeGridSettings)(committedGridSettings, import_row_height_presets.DEFAULT_ROW_HEIGHT)
|
|
99
|
+
);
|
|
100
|
+
(0, import_element.useEffect)(() => {
|
|
101
|
+
setStagingGridSettings(
|
|
102
|
+
(0, import_normalize_grid_settings.normalizeGridSettings)(committedGridSettings, import_row_height_presets.DEFAULT_ROW_HEIGHT)
|
|
103
|
+
);
|
|
104
|
+
}, [committedGridSettings]);
|
|
105
|
+
const hasLayoutChanges = (0, import_element.useMemo)(
|
|
106
|
+
() => !(0, import_es6.default)(
|
|
107
|
+
canonicalize(committedLayout),
|
|
108
|
+
canonicalize(stagingLayout)
|
|
109
|
+
),
|
|
110
|
+
[committedLayout, stagingLayout]
|
|
111
|
+
);
|
|
112
|
+
const hasGridSettingsChanges = (0, import_element.useMemo)(
|
|
113
|
+
() => !(0, import_es6.default)(committedGridSettings, stagingGridSettings),
|
|
114
|
+
[committedGridSettings, stagingGridSettings]
|
|
115
|
+
);
|
|
116
|
+
const hasUncommittedChanges = hasLayoutChanges || hasGridSettingsChanges;
|
|
117
|
+
const commit = (0, import_element.useCallback)(
|
|
118
|
+
(options) => {
|
|
119
|
+
if (hasLayoutChanges) {
|
|
120
|
+
onLayoutChange(canonicalize(stagingLayout));
|
|
121
|
+
}
|
|
122
|
+
if (hasGridSettingsChanges) {
|
|
123
|
+
onGridSettingsChange?.(
|
|
124
|
+
(0, import_normalize_grid_settings.normalizeGridSettings)(
|
|
125
|
+
stagingGridSettings,
|
|
126
|
+
import_row_height_presets.DEFAULT_ROW_HEIGHT
|
|
127
|
+
)
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
if (options?.exitEditMode !== false) {
|
|
131
|
+
onEditChange?.(false);
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
[
|
|
135
|
+
hasLayoutChanges,
|
|
136
|
+
hasGridSettingsChanges,
|
|
137
|
+
onLayoutChange,
|
|
138
|
+
onGridSettingsChange,
|
|
139
|
+
stagingLayout,
|
|
140
|
+
stagingGridSettings,
|
|
141
|
+
onEditChange
|
|
142
|
+
]
|
|
143
|
+
);
|
|
144
|
+
const cancel = (0, import_element.useCallback)(
|
|
145
|
+
(options) => {
|
|
146
|
+
if (options?.revertLayout !== false) {
|
|
147
|
+
setStagingLayout(committedLayout);
|
|
148
|
+
}
|
|
149
|
+
setStagingGridSettings(committedGridSettings);
|
|
150
|
+
if (options?.exitEditMode !== false) {
|
|
151
|
+
onEditChange?.(false);
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
[committedLayout, committedGridSettings, onEditChange]
|
|
155
|
+
);
|
|
156
|
+
const commitGridModelChange = (0, import_element.useCallback)(
|
|
157
|
+
(targetModel) => {
|
|
158
|
+
const next = (0, import_grid_model_change.computeGridModelChange)({
|
|
159
|
+
layout: stagingLayout,
|
|
160
|
+
gridSettings: stagingGridSettings,
|
|
161
|
+
targetModel
|
|
162
|
+
});
|
|
163
|
+
if (!next) {
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
setStagingLayout(next.layout);
|
|
167
|
+
setStagingGridSettings(next.gridSettings);
|
|
168
|
+
onLayoutChange(canonicalize(next.layout));
|
|
169
|
+
onGridSettingsChange?.(
|
|
170
|
+
(0, import_normalize_grid_settings.normalizeGridSettings)(next.gridSettings, import_row_height_presets.DEFAULT_ROW_HEIGHT)
|
|
171
|
+
);
|
|
172
|
+
onEditChange?.(false);
|
|
173
|
+
},
|
|
174
|
+
[
|
|
175
|
+
stagingLayout,
|
|
176
|
+
stagingGridSettings,
|
|
177
|
+
onLayoutChange,
|
|
178
|
+
onGridSettingsChange,
|
|
179
|
+
onEditChange
|
|
180
|
+
]
|
|
181
|
+
);
|
|
182
|
+
const resetGridSettings = (0, import_element.useCallback)(() => {
|
|
183
|
+
setStagingGridSettings(import_default_grid.DEFAULT_GRID);
|
|
184
|
+
}, []);
|
|
185
|
+
(0, import_element.useEffect)(() => {
|
|
186
|
+
if (stagingLayout.length === 0) {
|
|
187
|
+
onEditChange?.(true);
|
|
188
|
+
}
|
|
189
|
+
}, [stagingLayout.length === 0]);
|
|
190
|
+
const canEditGridSettings = onGridSettingsChange !== void 0;
|
|
191
|
+
const value = (0, import_element.useMemo)(
|
|
192
|
+
() => ({
|
|
193
|
+
widgetTypes,
|
|
194
|
+
isResolvingWidgetTypes,
|
|
195
|
+
layout: stagingLayout,
|
|
196
|
+
onLayoutChange: setStagingLayout,
|
|
197
|
+
onLayoutReset,
|
|
198
|
+
gridSettings: resolveGridSettings(stagingGridSettings),
|
|
199
|
+
onGridSettingsChange: setStagingGridSettings,
|
|
200
|
+
canEditGridSettings,
|
|
201
|
+
resetGridSettings,
|
|
202
|
+
commit,
|
|
203
|
+
commitGridModelChange,
|
|
204
|
+
cancel,
|
|
205
|
+
hasUncommittedChanges,
|
|
206
|
+
editMode,
|
|
207
|
+
onEditChange,
|
|
208
|
+
resolveWidgetModule
|
|
209
|
+
}),
|
|
210
|
+
[
|
|
211
|
+
widgetTypes,
|
|
212
|
+
isResolvingWidgetTypes,
|
|
213
|
+
stagingLayout,
|
|
214
|
+
onLayoutReset,
|
|
215
|
+
stagingGridSettings,
|
|
216
|
+
canEditGridSettings,
|
|
217
|
+
resetGridSettings,
|
|
218
|
+
commit,
|
|
219
|
+
commitGridModelChange,
|
|
220
|
+
cancel,
|
|
221
|
+
hasUncommittedChanges,
|
|
222
|
+
editMode,
|
|
223
|
+
onEditChange,
|
|
224
|
+
resolveWidgetModule
|
|
225
|
+
]
|
|
226
|
+
);
|
|
227
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Context.Provider, { value, children });
|
|
228
|
+
}
|
|
229
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
230
|
+
0 && (module.exports = {
|
|
231
|
+
WidgetDashboardProvider,
|
|
232
|
+
useDashboardInternalContext
|
|
233
|
+
});
|
|
234
|
+
//# sourceMappingURL=dashboard-context.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/context/dashboard-context.tsx"],
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport fastDeepEqual from 'fast-deep-equal/es6/index.js';\nimport type { ReactNode } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tcreateContext,\n\tuseCallback,\n\tuseContext,\n\tuseEffect,\n\tuseMemo,\n\tuseState,\n} from '@wordpress/element';\nimport type {\n\tResolveWidgetModule,\n\tWidgetType,\n} from '@wordpress/widget-primitives';\n\n/**\n * Internal dependencies\n */\nimport { DEFAULT_GRID } from '../utils/default-grid';\nimport { computeGridModelChange } from '../utils/grid-model-change';\nimport { normalizeGridSettings } from '../utils/normalize-grid-settings';\nimport { DEFAULT_ROW_HEIGHT } from '../utils/row-height-presets';\nimport type {\n\tWidgetGridModel,\n\tWidgetGridSettings,\n\tDashboardWidget,\n} from '../types';\nimport { WIDGET_DASHBOARD_COLUMN_COUNT } from '../types';\n\ntype GridSettingsWithColumns = WidgetGridSettings & { columns: number };\n\nfunction resolveGridSettings(\n\tsettings: WidgetGridSettings\n): GridSettingsWithColumns {\n\tconst normalized = normalizeGridSettings( settings, DEFAULT_ROW_HEIGHT );\n\treturn {\n\t\t...normalized,\n\t\tcolumns: WIDGET_DASHBOARD_COLUMN_COUNT,\n\t};\n}\n\nconst DEFAULT_RESOLVE_WIDGET_MODULE: ResolveWidgetModule = ( moduleId ) =>\n\timport( /* webpackIgnore: true */ moduleId );\n\n/**\n * Canonical form of `layout`: widgets sorted by `placement.order` (falling\n * back to array index), then `order` stripped since position now implies it.\n * Used both as the comparison form for `hasUncommittedChanges` (so a change\n * and its undo compare equal) and as the publish form, keeping persisted\n * payloads free of redundant `order` fields.\n *\n * @param {DashboardWidget[]} layout Layout to canonicalize.\n * @return {DashboardWidget[]} Canonicalized layout.\n */\nfunction canonicalize( layout: DashboardWidget[] ): DashboardWidget[] {\n\tconst indexed = layout.map( ( widget, index ) => ( {\n\t\twidget,\n\t\torder: widget.placement?.order ?? index,\n\t} ) );\n\n\tindexed.sort( ( a, b ) => a.order - b.order );\n\n\treturn indexed.map( ( { widget } ) => {\n\t\tif ( ! widget.placement ) {\n\t\t\treturn widget;\n\t\t}\n\t\tconst { order: _stripped, ...placement } = widget.placement;\n\t\treturn { ...widget, placement };\n\t} );\n}\n\n/**\n * Rich state distributed to every compound component inside `WidgetDashboard`.\n * Internal — compounds reach the full state via `useDashboardInternalContext()`.\n *\n * `layout`/`onLayoutChange` and `gridSettings`/`onGridSettingsChange` here\n * operate on the staging layer, not the committed props. Mutations from\n * compound children stay in staging until `commit` publishes them on the\n * consumer.\n */\ninterface InternalDashboardContextValue {\n\twidgetTypes: WidgetType[];\n\tisResolvingWidgetTypes: boolean;\n\tlayout: DashboardWidget[];\n\tonLayoutChange: ( layout: DashboardWidget[] ) => void;\n\tonLayoutReset?: () => void;\n\tgridSettings: GridSettingsWithColumns;\n\tonGridSettingsChange: ( gridSettings: WidgetGridSettings ) => void;\n\tcanEditGridSettings: boolean;\n\n\t/**\n\t * Restores the staging copy of `gridSettings` to the package's\n\t * built-in defaults. Does not touch the committed slice; the user\n\t * must `commit` to publish the reset, or `cancel` to discard it.\n\t */\n\tresetGridSettings: () => void;\n\n\t/**\n\t * Publishes staged slices that differ from their committed\n\t * counterparts. By default also exits edit mode; pass\n\t * `{ exitEditMode: false }` when committing from the layout\n\t * settings drawer so customize mode stays active.\n\t */\n\tcommit: ( options?: CommitOptions ) => void;\n\n\t/**\n\t * Switches the layout model, updates staging, and publishes\n\t * immediately — equivalent to changing the model in layout\n\t * settings and clicking Save.\n\t */\n\tcommitGridModelChange: ( targetModel: WidgetGridModel ) => void;\n\n\t/**\n\t * Reverts staging slices. By default reverts both layout and grid\n\t * settings and exits edit mode. Pass `{ exitEditMode: false }` when\n\t * dismissing the layout settings drawer. Pass `{ revertLayout: false }`\n\t * to revert only grid settings (preserves in-progress widget layout\n\t * edits while customize mode is active).\n\t */\n\tcancel: ( options?: CancelOptions ) => void;\n\n\thasUncommittedChanges: boolean;\n\teditMode: boolean;\n\tonEditChange?: ( next: boolean ) => void;\n\tresolveWidgetModule: ResolveWidgetModule;\n}\n\ninterface CommitOptions {\n\texitEditMode?: boolean;\n}\n\ninterface CancelOptions {\n\texitEditMode?: boolean;\n\trevertLayout?: boolean;\n}\n\nconst Context = createContext< InternalDashboardContextValue | null >( null );\n\n/**\n * Compound-internal hook — exposes the full provider state.\n * Not part of the public API; lives in the same module\n * so compound components can reach the state directly.\n */\nexport function useDashboardInternalContext(): InternalDashboardContextValue {\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\twidgetTypes: WidgetType[];\n\tisResolvingWidgetTypes?: boolean;\n\tlayout: DashboardWidget[];\n\n\t/**\n\t * Fired on commit when the staged layout differs from `layout`.\n\t */\n\tonLayoutChange: ( layout: DashboardWidget[] ) => void;\n\n\t/**\n\t * Optional reset action surfaced by the bundled `Actions`.\n\t */\n\tonLayoutReset?: () => void;\n\n\teditMode?: boolean;\n\tonEditChange?: ( next: boolean ) => void;\n\n\t/**\n\t * Overrides the default `import()` resolution of\n\t * `WidgetType.renderModule`.\n\t */\n\tresolveWidgetModule?: ResolveWidgetModule;\n\n\tgridSettings?: WidgetGridSettings;\n\n\t/**\n\t * Fired on commit when the staged settings differ from\n\t * `gridSettings`.\n\t */\n\tonGridSettingsChange?: ( gridSettings: WidgetGridSettings ) => void;\n\n\tchildren: ReactNode;\n}\n\n/**\n * Provider for the dashboard's staging layer. Owns staging copies of\n * `layout` and `gridSettings`; `commit` publishes whichever slice\n * differs from its committed prop, `cancel` reverts both.\n *\n * Staging re-syncs from the committed props on prop change. In-flight\n * edits are dropped silently when an external update (cross-tab commit,\n * reset, websocket push) lands. Consumers that cannot tolerate this\n * loss should mediate the prop updates before forwarding them here.\n *\n * @param {ProviderProps} props Component props.\n */\nexport function WidgetDashboardProvider( {\n\twidgetTypes,\n\tisResolvingWidgetTypes = false,\n\tlayout: committedLayout,\n\tonLayoutChange,\n\tonLayoutReset,\n\teditMode = false,\n\tonEditChange,\n\tresolveWidgetModule = DEFAULT_RESOLVE_WIDGET_MODULE,\n\tgridSettings: committedGridSettings = DEFAULT_GRID,\n\tonGridSettingsChange,\n\tchildren,\n}: ProviderProps ): React.ReactNode {\n\tconst [ stagingLayout, setStagingLayout ] =\n\t\tuseState< DashboardWidget[] >( committedLayout );\n\n\t// External change in `layout` (consumer-side reset, cross-tab sync,\n\t// websocket push, etc.) drops any in-flight staging edits without\n\t// surfacing a warning. See the provider JSDoc for the trade-off.\n\tuseEffect( () => {\n\t\tsetStagingLayout( committedLayout );\n\t}, [ committedLayout ] );\n\n\tconst [ stagingGridSettings, setStagingGridSettings ] =\n\t\tuseState< WidgetGridSettings >( () =>\n\t\t\tnormalizeGridSettings( committedGridSettings, DEFAULT_ROW_HEIGHT )\n\t\t);\n\n\t// Same external-resync semantics as `stagingLayout`.\n\tuseEffect( () => {\n\t\tsetStagingGridSettings(\n\t\t\tnormalizeGridSettings( committedGridSettings, DEFAULT_ROW_HEIGHT )\n\t\t);\n\t}, [ committedGridSettings ] );\n\n\tconst hasLayoutChanges = useMemo(\n\t\t() =>\n\t\t\t! fastDeepEqual(\n\t\t\t\tcanonicalize( committedLayout ),\n\t\t\t\tcanonicalize( stagingLayout )\n\t\t\t),\n\t\t[ committedLayout, stagingLayout ]\n\t);\n\n\tconst hasGridSettingsChanges = useMemo(\n\t\t() => ! fastDeepEqual( committedGridSettings, stagingGridSettings ),\n\t\t[ committedGridSettings, stagingGridSettings ]\n\t);\n\n\tconst hasUncommittedChanges = hasLayoutChanges || hasGridSettingsChanges;\n\n\tconst commit = useCallback(\n\t\t( options?: CommitOptions ) => {\n\t\t\tif ( hasLayoutChanges ) {\n\t\t\t\tonLayoutChange( canonicalize( stagingLayout ) );\n\t\t\t}\n\n\t\t\tif ( hasGridSettingsChanges ) {\n\t\t\t\tonGridSettingsChange?.(\n\t\t\t\t\tnormalizeGridSettings(\n\t\t\t\t\t\tstagingGridSettings,\n\t\t\t\t\t\tDEFAULT_ROW_HEIGHT\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif ( options?.exitEditMode !== false ) {\n\t\t\t\tonEditChange?.( false );\n\t\t\t}\n\t\t},\n\t\t[\n\t\t\thasLayoutChanges,\n\t\t\thasGridSettingsChanges,\n\t\t\tonLayoutChange,\n\t\t\tonGridSettingsChange,\n\t\t\tstagingLayout,\n\t\t\tstagingGridSettings,\n\t\t\tonEditChange,\n\t\t]\n\t);\n\n\tconst cancel = useCallback(\n\t\t( options?: CancelOptions ) => {\n\t\t\tif ( options?.revertLayout !== false ) {\n\t\t\t\tsetStagingLayout( committedLayout );\n\t\t\t}\n\t\t\tsetStagingGridSettings( committedGridSettings );\n\t\t\tif ( options?.exitEditMode !== false ) {\n\t\t\t\tonEditChange?.( false );\n\t\t\t}\n\t\t},\n\t\t[ committedLayout, committedGridSettings, onEditChange ]\n\t);\n\n\tconst commitGridModelChange = useCallback(\n\t\t( targetModel: WidgetGridModel ) => {\n\t\t\tconst next = computeGridModelChange( {\n\t\t\t\tlayout: stagingLayout,\n\t\t\t\tgridSettings: stagingGridSettings,\n\t\t\t\ttargetModel,\n\t\t\t} );\n\n\t\t\tif ( ! next ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tsetStagingLayout( next.layout );\n\t\t\tsetStagingGridSettings( next.gridSettings );\n\t\t\tonLayoutChange( canonicalize( next.layout ) );\n\t\t\tonGridSettingsChange?.(\n\t\t\t\tnormalizeGridSettings( next.gridSettings, DEFAULT_ROW_HEIGHT )\n\t\t\t);\n\t\t\tonEditChange?.( false );\n\t\t},\n\t\t[\n\t\t\tstagingLayout,\n\t\t\tstagingGridSettings,\n\t\t\tonLayoutChange,\n\t\t\tonGridSettingsChange,\n\t\t\tonEditChange,\n\t\t]\n\t);\n\n\tconst resetGridSettings = useCallback( () => {\n\t\tsetStagingGridSettings( DEFAULT_GRID );\n\t}, [] );\n\n\tuseEffect( () => {\n\t\tif ( stagingLayout.length === 0 ) {\n\t\t\tonEditChange?.( true );\n\t\t}\n\n\t\t// Only react to the layout count flipping to zero; firing on every\n\t\t// onEditChange identity change would also reopen edit mode after the\n\t\t// user explicitly closed it on a non-empty layout.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ stagingLayout.length === 0 ] );\n\n\tconst canEditGridSettings = onGridSettingsChange !== undefined;\n\n\tconst value = useMemo< InternalDashboardContextValue >(\n\t\t() => ( {\n\t\t\twidgetTypes,\n\t\t\tisResolvingWidgetTypes,\n\t\t\tlayout: stagingLayout,\n\t\t\tonLayoutChange: setStagingLayout,\n\t\t\tonLayoutReset,\n\t\t\tgridSettings: resolveGridSettings( stagingGridSettings ),\n\t\t\tonGridSettingsChange: setStagingGridSettings,\n\t\t\tcanEditGridSettings,\n\t\t\tresetGridSettings,\n\t\t\tcommit,\n\t\t\tcommitGridModelChange,\n\t\t\tcancel,\n\t\t\thasUncommittedChanges,\n\t\t\teditMode,\n\t\t\tonEditChange,\n\t\t\tresolveWidgetModule,\n\t\t} ),\n\t\t[\n\t\t\twidgetTypes,\n\t\t\tisResolvingWidgetTypes,\n\t\t\tstagingLayout,\n\t\t\tonLayoutReset,\n\t\t\tstagingGridSettings,\n\t\t\tcanEditGridSettings,\n\t\t\tresetGridSettings,\n\t\t\tcommit,\n\t\t\tcommitGridModelChange,\n\t\t\tcancel,\n\t\t\thasUncommittedChanges,\n\t\t\teditMode,\n\t\t\tonEditChange,\n\t\t\tresolveWidgetModule,\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;AAGA,iBAA0B;AAM1B,qBAOO;AASP,0BAA6B;AAC7B,+BAAuC;AACvC,qCAAsC;AACtC,gCAAmC;AAMnC,mBAA8C;AA8VtC;AA1VR,SAAS,oBACR,UAC0B;AAC1B,QAAM,iBAAa,sDAAuB,UAAU,4CAAmB;AACvE,SAAO;AAAA,IACN,GAAG;AAAA,IACH,SAAS;AAAA,EACV;AACD;AAEA,IAAM,gCAAqD,CAAE,aAC5D;AAAA;AAAA,EAAkC;AAAA;AAYnC,SAAS,aAAc,QAA+C;AACrE,QAAM,UAAU,OAAO,IAAK,CAAE,QAAQ,WAAa;AAAA,IAClD;AAAA,IACA,OAAO,OAAO,WAAW,SAAS;AAAA,EACnC,EAAI;AAEJ,UAAQ,KAAM,CAAE,GAAG,MAAO,EAAE,QAAQ,EAAE,KAAM;AAE5C,SAAO,QAAQ,IAAK,CAAE,EAAE,OAAO,MAAO;AACrC,QAAK,CAAE,OAAO,WAAY;AACzB,aAAO;AAAA,IACR;AACA,UAAM,EAAE,OAAO,WAAW,GAAG,UAAU,IAAI,OAAO;AAClD,WAAO,EAAE,GAAG,QAAQ,UAAU;AAAA,EAC/B,CAAE;AACH;AAmEA,IAAM,cAAU,8BAAuD,IAAK;AAOrE,SAAS,8BAA6D;AAC5E,QAAM,UAAM,2BAAY,OAAQ;AAChC,MAAK,CAAE,KAAM;AACZ,UAAM,IAAI;AAAA,MACT;AAAA,IACD;AAAA,EACD;AACA,SAAO;AACR;AAiDO,SAAS,wBAAyB;AAAA,EACxC;AAAA,EACA,yBAAyB;AAAA,EACzB,QAAQ;AAAA,EACR;AA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