@wordpress/widget-dashboard 0.2.0 → 0.3.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 +30 -0
- package/README.md +29 -16
- package/build/components/actions/actions.cjs +6 -23
- package/build/components/actions/actions.cjs.map +3 -3
- package/build/components/commands/commands.cjs +1 -60
- package/build/components/commands/commands.cjs.map +2 -2
- package/build/{utils/grid-model-change → components/widget-attribute-controls}/index.cjs +7 -9
- package/build/components/widget-attribute-controls/index.cjs.map +7 -0
- package/build/components/widget-attribute-controls/widget-attribute-controls.cjs +93 -0
- package/build/components/widget-attribute-controls/widget-attribute-controls.cjs.map +7 -0
- package/build/components/widget-chrome/widget-chrome.cjs +28 -69
- package/build/components/widget-chrome/widget-chrome.cjs.map +2 -2
- package/build/components/{layout-settings → widget-frame}/index.cjs +9 -7
- package/build/components/widget-frame/index.cjs.map +7 -0
- package/build/components/widget-frame/widget-frame.cjs +193 -0
- package/build/components/widget-frame/widget-frame.cjs.map +7 -0
- package/build/{utils/migrate-layout → components/widget-header}/index.cjs +7 -7
- package/build/components/widget-header/index.cjs.map +7 -0
- package/build/components/widget-header/widget-header-infotip.cjs +166 -0
- package/build/components/widget-header/widget-header-infotip.cjs.map +7 -0
- package/build/components/widget-header/widget-header.cjs +176 -0
- package/build/components/widget-header/widget-header.cjs.map +7 -0
- package/build/components/{widget-settings/utils/get-admin-menu-inset.cjs → widget-layout-controls/index.cjs} +8 -18
- package/build/components/widget-layout-controls/index.cjs.map +7 -0
- package/build/components/{widgets/widget-layout-toolbar.cjs → widget-layout-controls/widget-layout-controls.cjs} +9 -100
- package/build/components/widget-layout-controls/widget-layout-controls.cjs.map +7 -0
- package/build/components/widget-picker/widget-picker.cjs +5 -93
- package/build/components/widget-picker/widget-picker.cjs.map +3 -3
- package/build/components/widget-preview-chrome/index.cjs +31 -0
- package/build/components/widget-preview-chrome/index.cjs.map +7 -0
- package/build/components/{widget-settings/widget-settings-toolbar.cjs → widget-preview-chrome/widget-preview-chrome.cjs} +41 -23
- package/build/components/widget-preview-chrome/widget-preview-chrome.cjs.map +7 -0
- package/build/components/widget-settings/index.cjs +3 -3
- package/build/components/widget-settings/index.cjs.map +1 -1
- package/build/components/widget-settings/utils/index.cjs +0 -3
- package/build/components/widget-settings/utils/index.cjs.map +2 -2
- package/build/components/widget-settings/widget-settings-trigger.cjs +22 -28
- package/build/components/widget-settings/widget-settings-trigger.cjs.map +2 -2
- package/build/components/widget-settings/widget-settings.cjs +40 -57
- package/build/components/widget-settings/widget-settings.cjs.map +2 -2
- package/build/components/widget-toolbar/widget-toolbar.cjs +7 -4
- package/build/components/widget-toolbar/widget-toolbar.cjs.map +2 -2
- package/build/components/widgets/widget-resize-handle.cjs +4 -4
- package/build/components/widgets/widget-resize-handle.cjs.map +2 -2
- package/build/components/widgets/widgets.cjs +18 -11
- package/build/components/widgets/widgets.cjs.map +2 -2
- package/build/context/dashboard-context.cjs +31 -80
- package/build/context/dashboard-context.cjs.map +2 -2
- package/build/context/ui-context.cjs +2 -18
- package/build/context/ui-context.cjs.map +2 -2
- package/build/types.cjs.map +1 -1
- package/build/utils/index.cjs +2 -5
- package/build/utils/index.cjs.map +2 -2
- package/build/widget-dashboard.cjs +0 -4
- package/build/widget-dashboard.cjs.map +2 -2
- package/build-module/components/actions/actions.mjs +7 -24
- package/build-module/components/actions/actions.mjs.map +2 -2
- package/build-module/components/commands/commands.mjs +2 -67
- package/build-module/components/commands/commands.mjs.map +2 -2
- package/build-module/components/widget-attribute-controls/index.mjs +6 -0
- package/build-module/components/widget-attribute-controls/index.mjs.map +7 -0
- package/build-module/components/widget-attribute-controls/widget-attribute-controls.mjs +68 -0
- package/build-module/components/widget-attribute-controls/widget-attribute-controls.mjs.map +7 -0
- package/build-module/components/widget-chrome/widget-chrome.mjs +29 -76
- package/build-module/components/widget-chrome/widget-chrome.mjs.map +2 -2
- package/build-module/components/widget-frame/index.mjs +7 -0
- package/build-module/components/widget-frame/index.mjs.map +7 -0
- package/build-module/components/widget-frame/widget-frame.mjs +157 -0
- package/build-module/components/widget-frame/widget-frame.mjs.map +7 -0
- package/build-module/components/widget-header/index.mjs +6 -0
- package/build-module/components/widget-header/index.mjs.map +7 -0
- package/build-module/components/widget-header/widget-header-infotip.mjs +141 -0
- package/build-module/components/widget-header/widget-header-infotip.mjs.map +7 -0
- package/build-module/components/widget-header/widget-header.mjs +141 -0
- package/build-module/components/widget-header/widget-header.mjs.map +7 -0
- package/build-module/components/widget-layout-controls/index.mjs +6 -0
- package/build-module/components/widget-layout-controls/index.mjs.map +7 -0
- package/build-module/components/widget-layout-controls/widget-layout-controls.mjs +90 -0
- package/build-module/components/widget-layout-controls/widget-layout-controls.mjs.map +7 -0
- package/build-module/components/widget-picker/widget-picker.mjs +6 -94
- package/build-module/components/widget-picker/widget-picker.mjs.map +3 -3
- package/build-module/components/widget-preview-chrome/index.mjs +6 -0
- package/build-module/components/widget-preview-chrome/index.mjs.map +7 -0
- package/build-module/components/{widget-settings/widget-settings-toolbar.mjs → widget-preview-chrome/widget-preview-chrome.mjs} +37 -19
- package/build-module/components/widget-preview-chrome/widget-preview-chrome.mjs.map +7 -0
- package/build-module/components/widget-settings/index.mjs +2 -2
- package/build-module/components/widget-settings/index.mjs.map +1 -1
- package/build-module/components/widget-settings/utils/index.mjs +0 -2
- package/build-module/components/widget-settings/utils/index.mjs.map +2 -2
- package/build-module/components/widget-settings/widget-settings-trigger.mjs +23 -29
- package/build-module/components/widget-settings/widget-settings-trigger.mjs.map +2 -2
- package/build-module/components/widget-settings/widget-settings.mjs +40 -57
- package/build-module/components/widget-settings/widget-settings.mjs.map +2 -2
- package/build-module/components/widget-toolbar/widget-toolbar.mjs +7 -4
- package/build-module/components/widget-toolbar/widget-toolbar.mjs.map +2 -2
- package/build-module/components/widgets/widget-resize-handle.mjs +4 -4
- package/build-module/components/widgets/widget-resize-handle.mjs.map +2 -2
- package/build-module/components/widgets/widgets.mjs +18 -11
- package/build-module/components/widgets/widgets.mjs.map +2 -2
- package/build-module/context/dashboard-context.mjs +31 -80
- package/build-module/context/dashboard-context.mjs.map +2 -2
- package/build-module/context/ui-context.mjs +2 -18
- package/build-module/context/ui-context.mjs.map +2 -2
- package/build-module/types.mjs.map +1 -1
- package/build-module/utils/index.mjs +1 -3
- package/build-module/utils/index.mjs.map +2 -2
- package/build-module/widget-dashboard.mjs +0 -4
- package/build-module/widget-dashboard.mjs.map +2 -2
- package/build-types/components/actions/actions.d.ts.map +1 -1
- package/build-types/components/commands/commands.d.ts.map +1 -1
- package/build-types/components/commands/use-pending-when-edit-mode.d.ts +1 -1
- package/build-types/components/commands/use-pending-when-edit-mode.d.ts.map +1 -1
- package/build-types/components/no-widgets-state/no-widgets-state.d.ts +1 -1
- package/build-types/components/no-widgets-state/no-widgets-state.d.ts.map +1 -1
- package/build-types/components/widget-attribute-controls/index.d.ts +2 -0
- package/build-types/components/widget-attribute-controls/index.d.ts.map +1 -0
- package/build-types/components/widget-attribute-controls/widget-attribute-controls.d.ts +23 -0
- package/build-types/components/widget-attribute-controls/widget-attribute-controls.d.ts.map +1 -0
- package/build-types/components/widget-chrome/widget-chrome.d.ts +8 -8
- package/build-types/components/widget-chrome/widget-chrome.d.ts.map +1 -1
- package/build-types/components/widget-frame/index.d.ts +3 -0
- package/build-types/components/widget-frame/index.d.ts.map +1 -0
- package/build-types/components/widget-frame/widget-frame.d.ts +25 -0
- package/build-types/components/widget-frame/widget-frame.d.ts.map +1 -0
- package/build-types/components/widget-header/index.d.ts +3 -0
- package/build-types/components/widget-header/index.d.ts.map +1 -0
- package/build-types/components/widget-header/widget-header-infotip.d.ts +20 -0
- package/build-types/components/widget-header/widget-header-infotip.d.ts.map +1 -0
- package/build-types/components/widget-header/widget-header.d.ts +38 -0
- package/build-types/components/widget-header/widget-header.d.ts.map +1 -0
- package/build-types/components/widget-layout-controls/index.d.ts +3 -0
- package/build-types/components/widget-layout-controls/index.d.ts.map +1 -0
- package/build-types/components/widget-layout-controls/widget-layout-controls.d.ts +14 -0
- package/build-types/components/widget-layout-controls/widget-layout-controls.d.ts.map +1 -0
- package/build-types/components/widget-picker/widget-picker.d.ts +1 -1
- package/build-types/components/widget-picker/widget-picker.d.ts.map +1 -1
- package/build-types/components/widget-preview-chrome/index.d.ts +3 -0
- package/build-types/components/widget-preview-chrome/index.d.ts.map +1 -0
- package/build-types/components/widget-preview-chrome/widget-preview-chrome.d.ts +15 -0
- package/build-types/components/widget-preview-chrome/widget-preview-chrome.d.ts.map +1 -0
- package/build-types/components/widget-settings/index.d.ts +2 -2
- package/build-types/components/widget-settings/utils/index.d.ts +0 -1
- package/build-types/components/widget-settings/utils/index.d.ts.map +1 -1
- package/build-types/components/widget-settings/widget-settings-trigger.d.ts +7 -5
- package/build-types/components/widget-settings/widget-settings-trigger.d.ts.map +1 -1
- package/build-types/components/widget-settings/widget-settings.d.ts +5 -4
- package/build-types/components/widget-settings/widget-settings.d.ts.map +1 -1
- package/build-types/components/widget-toolbar/widget-toolbar.d.ts +10 -7
- package/build-types/components/widget-toolbar/widget-toolbar.d.ts.map +1 -1
- package/build-types/components/widgets/widgets.d.ts.map +1 -1
- package/build-types/context/dashboard-context.d.ts +23 -40
- package/build-types/context/dashboard-context.d.ts.map +1 -1
- package/build-types/context/ui-context.d.ts +0 -18
- package/build-types/context/ui-context.d.ts.map +1 -1
- package/build-types/context/widget-context.d.ts +1 -1
- package/build-types/context/widget-context.d.ts.map +1 -1
- package/build-types/types.d.ts +9 -15
- package/build-types/types.d.ts.map +1 -1
- package/build-types/utils/index.d.ts +0 -1
- package/build-types/utils/index.d.ts.map +1 -1
- package/build-types/widget-dashboard.d.ts +5 -5
- package/build-types/widget-dashboard.d.ts.map +1 -1
- package/package.json +20 -20
- package/src/components/actions/actions.module.css +7 -7
- package/src/components/actions/actions.tsx +5 -25
- package/src/components/commands/commands.tsx +3 -70
- package/src/components/widget-attribute-controls/index.ts +1 -0
- package/src/components/widget-attribute-controls/widget-attribute-controls.tsx +108 -0
- package/src/components/widget-chrome/widget-chrome.module.css +6 -71
- package/src/components/widget-chrome/widget-chrome.tsx +31 -136
- package/src/components/widget-frame/index.ts +2 -0
- package/src/components/widget-frame/widget-frame.module.css +17 -0
- package/src/components/widget-frame/widget-frame.tsx +138 -0
- package/src/components/widget-header/index.ts +2 -0
- package/src/components/widget-header/widget-header-infotip.tsx +82 -0
- package/src/components/widget-header/widget-header.module.css +59 -0
- package/src/components/widget-header/widget-header.tsx +104 -0
- package/src/components/widget-layout-controls/index.ts +2 -0
- package/src/components/{widgets/widget-layout-toolbar.tsx → widget-layout-controls/widget-layout-controls.tsx} +12 -13
- package/src/components/widget-picker/widget-picker.tsx +5 -10
- package/src/components/widget-preview-chrome/index.ts +2 -0
- package/src/components/widget-preview-chrome/widget-preview-chrome.module.css +22 -0
- package/src/components/widget-preview-chrome/widget-preview-chrome.tsx +65 -0
- package/src/components/widget-settings/index.ts +2 -2
- package/src/components/widget-settings/utils/index.ts +0 -1
- package/src/components/widget-settings/widget-settings-trigger.tsx +39 -44
- package/src/components/widget-settings/widget-settings.tsx +10 -28
- package/src/components/widget-toolbar/widget-toolbar.module.css +13 -10
- package/src/components/widget-toolbar/widget-toolbar.tsx +14 -8
- package/src/components/widgets/widget-resize-handle.module.css +21 -21
- package/src/components/widgets/widget-resize-handle.tsx +2 -2
- package/src/components/widgets/widgets.module.css +20 -11
- package/src/components/widgets/widgets.tsx +33 -10
- package/src/context/dashboard-context.tsx +70 -133
- package/src/context/ui-context.tsx +1 -39
- package/src/test/actions.test.tsx +7 -77
- package/src/test/commands.test.tsx +6 -45
- package/src/test/staging.test.tsx +82 -144
- package/src/test/widget-dashboard.test.tsx +24 -0
- package/src/types.ts +9 -16
- package/src/utils/index.ts +0 -1
- package/src/widget-dashboard.tsx +4 -8
- package/build/components/layout-settings/index.cjs.map +0 -7
- package/build/components/layout-settings/layout-model-edit-field/index.cjs +0 -186
- package/build/components/layout-settings/layout-model-edit-field/index.cjs.map +0 -7
- package/build/components/layout-settings/layout-model-edit-field/thumbnail-grid.cjs +0 -53
- package/build/components/layout-settings/layout-model-edit-field/thumbnail-grid.cjs.map +0 -7
- package/build/components/layout-settings/layout-model-edit-field/thumbnail-masonry.cjs +0 -53
- package/build/components/layout-settings/layout-model-edit-field/thumbnail-masonry.cjs.map +0 -7
- package/build/components/layout-settings/layout-settings.cjs +0 -207
- package/build/components/layout-settings/layout-settings.cjs.map +0 -7
- package/build/components/widget-settings/utils/get-admin-menu-inset.cjs.map +0 -7
- package/build/components/widget-settings/widget-settings-toolbar.cjs.map +0 -7
- package/build/components/widgets/widget-layout-toolbar.cjs.map +0 -7
- package/build/utils/grid-model-change/grid-model-change.cjs +0 -56
- package/build/utils/grid-model-change/grid-model-change.cjs.map +0 -7
- package/build/utils/grid-model-change/index.cjs.map +0 -7
- package/build/utils/migrate-layout/index.cjs.map +0 -7
- package/build/utils/migrate-layout/migrate-layout.cjs +0 -94
- package/build/utils/migrate-layout/migrate-layout.cjs.map +0 -7
- package/build-module/components/layout-settings/index.mjs +0 -6
- package/build-module/components/layout-settings/index.mjs.map +0 -7
- package/build-module/components/layout-settings/layout-model-edit-field/index.mjs +0 -151
- package/build-module/components/layout-settings/layout-model-edit-field/index.mjs.map +0 -7
- package/build-module/components/layout-settings/layout-model-edit-field/thumbnail-grid.mjs +0 -28
- package/build-module/components/layout-settings/layout-model-edit-field/thumbnail-grid.mjs.map +0 -7
- package/build-module/components/layout-settings/layout-model-edit-field/thumbnail-masonry.mjs +0 -28
- package/build-module/components/layout-settings/layout-model-edit-field/thumbnail-masonry.mjs.map +0 -7
- package/build-module/components/layout-settings/layout-settings.mjs +0 -187
- package/build-module/components/layout-settings/layout-settings.mjs.map +0 -7
- package/build-module/components/widget-settings/utils/get-admin-menu-inset.mjs +0 -16
- package/build-module/components/widget-settings/utils/get-admin-menu-inset.mjs.map +0 -7
- package/build-module/components/widget-settings/widget-settings-toolbar.mjs.map +0 -7
- package/build-module/components/widgets/widget-layout-toolbar.mjs +0 -181
- package/build-module/components/widgets/widget-layout-toolbar.mjs.map +0 -7
- package/build-module/utils/grid-model-change/grid-model-change.mjs +0 -30
- package/build-module/utils/grid-model-change/grid-model-change.mjs.map +0 -7
- package/build-module/utils/grid-model-change/index.mjs +0 -7
- package/build-module/utils/grid-model-change/index.mjs.map +0 -7
- package/build-module/utils/migrate-layout/index.mjs +0 -6
- package/build-module/utils/migrate-layout/index.mjs.map +0 -7
- package/build-module/utils/migrate-layout/migrate-layout.mjs +0 -69
- package/build-module/utils/migrate-layout/migrate-layout.mjs.map +0 -7
- package/build-types/components/layout-settings/index.d.ts +0 -2
- package/build-types/components/layout-settings/index.d.ts.map +0 -1
- package/build-types/components/layout-settings/layout-model-edit-field/index.d.ts +0 -17
- package/build-types/components/layout-settings/layout-model-edit-field/index.d.ts.map +0 -1
- package/build-types/components/layout-settings/layout-model-edit-field/thumbnail-grid.d.ts +0 -6
- package/build-types/components/layout-settings/layout-model-edit-field/thumbnail-grid.d.ts.map +0 -1
- package/build-types/components/layout-settings/layout-model-edit-field/thumbnail-masonry.d.ts +0 -6
- package/build-types/components/layout-settings/layout-model-edit-field/thumbnail-masonry.d.ts.map +0 -1
- package/build-types/components/layout-settings/layout-settings.d.ts +0 -14
- package/build-types/components/layout-settings/layout-settings.d.ts.map +0 -1
- package/build-types/components/widget-settings/utils/get-admin-menu-inset.d.ts +0 -17
- package/build-types/components/widget-settings/utils/get-admin-menu-inset.d.ts.map +0 -1
- package/build-types/components/widget-settings/widget-settings-toolbar.d.ts +0 -20
- package/build-types/components/widget-settings/widget-settings-toolbar.d.ts.map +0 -1
- package/build-types/components/widgets/widget-layout-toolbar.d.ts +0 -14
- package/build-types/components/widgets/widget-layout-toolbar.d.ts.map +0 -1
- package/build-types/utils/grid-model-change/grid-model-change.d.ts +0 -20
- package/build-types/utils/grid-model-change/grid-model-change.d.ts.map +0 -1
- package/build-types/utils/grid-model-change/index.d.ts +0 -2
- package/build-types/utils/grid-model-change/index.d.ts.map +0 -1
- package/build-types/utils/migrate-layout/index.d.ts +0 -2
- package/build-types/utils/migrate-layout/index.d.ts.map +0 -1
- package/build-types/utils/migrate-layout/migrate-layout.d.ts +0 -36
- package/build-types/utils/migrate-layout/migrate-layout.d.ts.map +0 -1
- package/src/components/layout-settings/index.ts +0 -1
- package/src/components/layout-settings/layout-model-edit-field/index.tsx +0 -98
- package/src/components/layout-settings/layout-model-edit-field/style.module.css +0 -34
- package/src/components/layout-settings/layout-model-edit-field/thumbnail-grid.tsx +0 -28
- package/src/components/layout-settings/layout-model-edit-field/thumbnail-masonry.tsx +0 -28
- package/src/components/layout-settings/layout-settings.tsx +0 -217
- package/src/components/widget-picker/widget-picker.module.css +0 -11
- package/src/components/widget-settings/utils/get-admin-menu-inset.ts +0 -30
- package/src/components/widget-settings/widget-settings-toolbar.module.css +0 -25
- package/src/components/widget-settings/widget-settings-toolbar.tsx +0 -45
- package/src/components/widgets/widget-layout-toolbar.module.css +0 -6
- package/src/utils/grid-model-change/grid-model-change.ts +0 -53
- package/src/utils/grid-model-change/index.ts +0 -1
- package/src/utils/migrate-layout/index.ts +0 -1
- package/src/utils/migrate-layout/migrate-layout.ts +0 -156
- package/src/utils/migrate-layout/test/migrate-layout.test.ts +0 -114
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// packages/widget-dashboard/src/utils/migrate-layout/migrate-layout.ts
|
|
21
|
-
var migrate_layout_exports = {};
|
|
22
|
-
__export(migrate_layout_exports, {
|
|
23
|
-
migrateLayout: () => migrateLayout
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(migrate_layout_exports);
|
|
26
|
-
var FALLBACK_COLUMNS = 6;
|
|
27
|
-
function gridWidthToMasonryWidth(width, targetColumns) {
|
|
28
|
-
if (width === "full") {
|
|
29
|
-
return targetColumns;
|
|
30
|
-
}
|
|
31
|
-
if (width === "fill" || width === void 0) {
|
|
32
|
-
return 1;
|
|
33
|
-
}
|
|
34
|
-
return width;
|
|
35
|
-
}
|
|
36
|
-
function migratePlacementGridToMasonry(placement, context) {
|
|
37
|
-
if (!placement) {
|
|
38
|
-
return {};
|
|
39
|
-
}
|
|
40
|
-
const next = {};
|
|
41
|
-
const width = gridWidthToMasonryWidth(placement.width, context.columns);
|
|
42
|
-
if (width !== 1) {
|
|
43
|
-
next.width = width;
|
|
44
|
-
}
|
|
45
|
-
if (placement.order !== void 0) {
|
|
46
|
-
next.order = placement.order;
|
|
47
|
-
}
|
|
48
|
-
return next;
|
|
49
|
-
}
|
|
50
|
-
function migratePlacementMasonryToGrid(placement) {
|
|
51
|
-
if (!placement) {
|
|
52
|
-
return { height: 1 };
|
|
53
|
-
}
|
|
54
|
-
const next = { height: 1 };
|
|
55
|
-
if (placement.width !== void 0) {
|
|
56
|
-
next.width = placement.width;
|
|
57
|
-
}
|
|
58
|
-
if (placement.order !== void 0) {
|
|
59
|
-
next.order = placement.order;
|
|
60
|
-
}
|
|
61
|
-
return next;
|
|
62
|
-
}
|
|
63
|
-
function migrateLayout(widgets, from, to, context = {}) {
|
|
64
|
-
const resolvedFrom = from ?? "grid";
|
|
65
|
-
if (resolvedFrom === to) {
|
|
66
|
-
return widgets;
|
|
67
|
-
}
|
|
68
|
-
const resolvedContext = {
|
|
69
|
-
columns: context.columns ?? FALLBACK_COLUMNS
|
|
70
|
-
};
|
|
71
|
-
if (resolvedFrom === "grid" && to === "masonry") {
|
|
72
|
-
return widgets.map((widget) => ({
|
|
73
|
-
...widget,
|
|
74
|
-
placement: migratePlacementGridToMasonry(
|
|
75
|
-
widget.placement,
|
|
76
|
-
resolvedContext
|
|
77
|
-
)
|
|
78
|
-
}));
|
|
79
|
-
}
|
|
80
|
-
if (resolvedFrom === "masonry" && to === "grid") {
|
|
81
|
-
return widgets.map((widget) => ({
|
|
82
|
-
...widget,
|
|
83
|
-
placement: migratePlacementMasonryToGrid(
|
|
84
|
-
widget.placement
|
|
85
|
-
)
|
|
86
|
-
}));
|
|
87
|
-
}
|
|
88
|
-
return widgets;
|
|
89
|
-
}
|
|
90
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
91
|
-
0 && (module.exports = {
|
|
92
|
-
migrateLayout
|
|
93
|
-
});
|
|
94
|
-
//# sourceMappingURL=migrate-layout.cjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/utils/migrate-layout/migrate-layout.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport type {\n\tDashboardWidget,\n\tGridTilePlacement,\n\tMasonryTilePlacement,\n\tWidgetGridModel,\n} from '../../types';\n\ninterface MigrationContext {\n\t/**\n\t * Column count of the currently-mounted grid surface. Used to\n\t * resolve `'full'` widths to a concrete numeric span when going\n\t * from the 2D grid model to masonry. When the surface is in\n\t * responsive mode and the runtime column count is unknown,\n\t * callers should pass a sensible fallback (e.g., the default of\n\t * 6 used by `@wordpress/grid`).\n\t */\n\tcolumns: number;\n}\n\nconst FALLBACK_COLUMNS = 6;\n\n/**\n * Coerces a `'fill'`/`'full'`/numeric width into a concrete numeric\n * span when migrating from `'grid'` to `'masonry'`. `'fill'` collapses\n * to a single column; resolving it against per-row remainder would\n * require either DOM measurement or replicating CSS-Grid's auto-flow\n * placement, both of which were judged not worth the complexity for\n * a one-shot migration the user can correct visually in staging.\n *\n * @param width Source width from a grid placement.\n * @param targetColumns Column count to use for `'full'` widths.\n */\nfunction gridWidthToMasonryWidth(\n\twidth: GridTilePlacement[ 'width' ],\n\ttargetColumns: number\n): number {\n\tif ( width === 'full' ) {\n\t\treturn targetColumns;\n\t}\n\tif ( width === 'fill' || width === undefined ) {\n\t\treturn 1;\n\t}\n\treturn width;\n}\n\n/**\n * Transforms a single placement from the 2D grid shape to the masonry\n * shape. Drops `height` (masonry derives heights from content),\n * preserves `order`, leaves `lane` unset so the auto-flow placer\n * arranges items by source order.\n *\n * @param placement Source grid placement.\n * @param context Migration context (column count).\n */\nfunction migratePlacementGridToMasonry(\n\tplacement: GridTilePlacement | undefined,\n\tcontext: MigrationContext\n): MasonryTilePlacement {\n\tif ( ! placement ) {\n\t\treturn {};\n\t}\n\n\tconst next: MasonryTilePlacement = {};\n\tconst width = gridWidthToMasonryWidth( placement.width, context.columns );\n\tif ( width !== 1 ) {\n\t\tnext.width = width;\n\t}\n\tif ( placement.order !== undefined ) {\n\t\tnext.order = placement.order;\n\t}\n\treturn next;\n}\n\n/**\n * Transforms a single placement from the masonry shape to the 2D grid\n * shape. Preserves the numeric width, drops `lane` (the 2D grid\n * auto-packs and has no pin-to-column concept), and seeds `height: 1`\n * since masonry never persisted a height. The user is expected to\n * resize tiles vertically after the migration.\n *\n * @param placement Source masonry placement.\n */\nfunction migratePlacementMasonryToGrid(\n\tplacement: MasonryTilePlacement | undefined\n): GridTilePlacement {\n\tif ( ! placement ) {\n\t\treturn { height: 1 };\n\t}\n\n\tconst next: GridTilePlacement = { height: 1 };\n\tif ( placement.width !== undefined ) {\n\t\tnext.width = placement.width;\n\t}\n\tif ( placement.order !== undefined ) {\n\t\tnext.order = placement.order;\n\t}\n\treturn next;\n}\n\n/**\n * Migrates every widget's `placement` between grid models.\n *\n * The two storage shapes overlap on `width` and `order` but diverge\n * on the rest: 2D grid carries `height` and discriminated string\n * widths (`'fill'`/`'full'`), lanes carries `lane` and only numeric\n * widths. Each conversion loses information that the target model\n * cannot represent. The caller is responsible for surfacing the\n * result to the user in a way that lets them correct visually.\n *\n * When `from === to`, the input is returned unchanged.\n *\n * @param widgets Widgets to migrate.\n * @param from Source model. `undefined` is treated as `'grid'`.\n * @param to Target model.\n * @param context Information that depends on the live render (today\n * only `columns`).\n */\nexport function migrateLayout(\n\twidgets: DashboardWidget[],\n\tfrom: WidgetGridModel | undefined,\n\tto: WidgetGridModel,\n\tcontext: Partial< MigrationContext > = {}\n): DashboardWidget[] {\n\tconst resolvedFrom: WidgetGridModel = from ?? 'grid';\n\tif ( resolvedFrom === to ) {\n\t\treturn widgets;\n\t}\n\n\tconst resolvedContext: MigrationContext = {\n\t\tcolumns: context.columns ?? FALLBACK_COLUMNS,\n\t};\n\n\tif ( resolvedFrom === 'grid' && to === 'masonry' ) {\n\t\treturn widgets.map( ( widget ) => ( {\n\t\t\t...widget,\n\t\t\tplacement: migratePlacementGridToMasonry(\n\t\t\t\twidget.placement as GridTilePlacement | undefined,\n\t\t\t\tresolvedContext\n\t\t\t),\n\t\t} ) );\n\t}\n\n\tif ( resolvedFrom === 'masonry' && to === 'grid' ) {\n\t\treturn widgets.map( ( widget ) => ( {\n\t\t\t...widget,\n\t\t\tplacement: migratePlacementMasonryToGrid(\n\t\t\t\twidget.placement as MasonryTilePlacement | undefined\n\t\t\t),\n\t\t} ) );\n\t}\n\n\treturn widgets;\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAsBA,IAAM,mBAAmB;AAazB,SAAS,wBACR,OACA,eACS;AACT,MAAK,U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AO;AACR;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
// packages/widget-dashboard/src/components/layout-settings/layout-model-edit-field/index.tsx
|
|
2
|
-
import clsx from "clsx";
|
|
3
|
-
import { useCallback } from "@wordpress/element";
|
|
4
|
-
import { Button, Fieldset, Stack, Text } from "@wordpress/ui";
|
|
5
|
-
import { GridThumbnail } from "./thumbnail-grid.mjs";
|
|
6
|
-
import { MasonryThumbnail } from "./thumbnail-masonry.mjs";
|
|
7
|
-
|
|
8
|
-
// packages/style-runtime/src/index.ts
|
|
9
|
-
var STYLE_HASH_ATTRIBUTE = "data-wp-hash";
|
|
10
|
-
function getRuntime() {
|
|
11
|
-
const globalScope = globalThis;
|
|
12
|
-
if (globalScope.__wpStyleRuntime) {
|
|
13
|
-
return globalScope.__wpStyleRuntime;
|
|
14
|
-
}
|
|
15
|
-
globalScope.__wpStyleRuntime = {
|
|
16
|
-
documents: /* @__PURE__ */ new Map(),
|
|
17
|
-
styles: /* @__PURE__ */ new Map(),
|
|
18
|
-
injectedStyles: /* @__PURE__ */ new WeakMap()
|
|
19
|
-
};
|
|
20
|
-
if (typeof document !== "undefined") {
|
|
21
|
-
registerDocument(document);
|
|
22
|
-
}
|
|
23
|
-
return globalScope.__wpStyleRuntime;
|
|
24
|
-
}
|
|
25
|
-
function documentContainsStyleHash(targetDocument, hash) {
|
|
26
|
-
if (!targetDocument.head) {
|
|
27
|
-
return false;
|
|
28
|
-
}
|
|
29
|
-
for (const style of targetDocument.head.querySelectorAll(
|
|
30
|
-
`style[${STYLE_HASH_ATTRIBUTE}]`
|
|
31
|
-
)) {
|
|
32
|
-
if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) {
|
|
33
|
-
return true;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
return false;
|
|
37
|
-
}
|
|
38
|
-
function injectStyle(targetDocument, hash, css) {
|
|
39
|
-
if (!targetDocument.head) {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
const runtime = getRuntime();
|
|
43
|
-
let injectedStyles = runtime.injectedStyles.get(targetDocument);
|
|
44
|
-
if (!injectedStyles) {
|
|
45
|
-
injectedStyles = /* @__PURE__ */ new Set();
|
|
46
|
-
runtime.injectedStyles.set(targetDocument, injectedStyles);
|
|
47
|
-
}
|
|
48
|
-
if (injectedStyles.has(hash)) {
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
if (documentContainsStyleHash(targetDocument, hash)) {
|
|
52
|
-
injectedStyles.add(hash);
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
const style = targetDocument.createElement("style");
|
|
56
|
-
style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);
|
|
57
|
-
style.appendChild(targetDocument.createTextNode(css));
|
|
58
|
-
targetDocument.head.appendChild(style);
|
|
59
|
-
injectedStyles.add(hash);
|
|
60
|
-
}
|
|
61
|
-
function registerDocument(targetDocument) {
|
|
62
|
-
const runtime = getRuntime();
|
|
63
|
-
runtime.documents.set(
|
|
64
|
-
targetDocument,
|
|
65
|
-
(runtime.documents.get(targetDocument) ?? 0) + 1
|
|
66
|
-
);
|
|
67
|
-
for (const [hash, css] of runtime.styles) {
|
|
68
|
-
injectStyle(targetDocument, hash, css);
|
|
69
|
-
}
|
|
70
|
-
return () => {
|
|
71
|
-
const count = runtime.documents.get(targetDocument);
|
|
72
|
-
if (count === void 0) {
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
if (count <= 1) {
|
|
76
|
-
runtime.documents.delete(targetDocument);
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
runtime.documents.set(targetDocument, count - 1);
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
function registerStyle(hash, css) {
|
|
83
|
-
const runtime = getRuntime();
|
|
84
|
-
runtime.styles.set(hash, css);
|
|
85
|
-
for (const targetDocument of runtime.documents.keys()) {
|
|
86
|
-
injectStyle(targetDocument, hash, css);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
// packages/widget-dashboard/src/components/layout-settings/layout-model-edit-field/style.module.css
|
|
91
|
-
if (typeof process === "undefined" || process.env.NODE_ENV !== "test") {
|
|
92
|
-
registerStyle("1e741045ea", ".a197e5fadbd013d8__option{background:transparent;border:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);border-radius:var(--wpds-border-radius-md,4px);color:inherit;cursor:var(--wpds-cursor-control,pointer);flex:1;padding:var(--wpds-dimension-padding-md,12px);text-align:center;transition:border-color var(--wpds-motion-duration-sm,.1s) var(--wpds-motion-easing-subtle,cubic-bezier(.15,0,.15,1)),background-color var(--wpds-motion-duration-sm,.1s) var(--wpds-motion-easing-subtle,cubic-bezier(.15,0,.15,1))}.a197e5fadbd013d8__option:hover{border-color:var(--wpds-color-stroke-surface-neutral-strong,#8d8d8d)}._90dfb85f4fe1f83c__optionSelected,._90dfb85f4fe1f83c__optionSelected:hover{background-color:color-mix(in srgb,var(--wpds-color-background-surface-brand,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 9%,#fff)) 6%,transparent);border-color:var(--wpds-color-stroke-interactive-brand,var(--wp-admin-theme-color,#3858e9))}._8dc1e0008b2c61a8__thumbnail{block-size:auto;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:block;inline-size:100%}._90dfb85f4fe1f83c__optionSelected ._8dc1e0008b2c61a8__thumbnail{color:var(--wpds-color-foreground-interactive-brand,var(--wp-admin-theme-color,#3858e9))}");
|
|
93
|
-
}
|
|
94
|
-
var style_default = { "option": "a197e5fadbd013d8__option", "optionSelected": "_90dfb85f4fe1f83c__optionSelected", "thumbnail": "_8dc1e0008b2c61a8__thumbnail" };
|
|
95
|
-
|
|
96
|
-
// packages/widget-dashboard/src/components/layout-settings/layout-model-edit-field/index.tsx
|
|
97
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
98
|
-
function ModelThumbnail({
|
|
99
|
-
model,
|
|
100
|
-
className
|
|
101
|
-
}) {
|
|
102
|
-
return model === "masonry" ? /* @__PURE__ */ jsx(MasonryThumbnail, { className }) : /* @__PURE__ */ jsx(GridThumbnail, { className });
|
|
103
|
-
}
|
|
104
|
-
function LayoutModelEditField({
|
|
105
|
-
data,
|
|
106
|
-
field,
|
|
107
|
-
onChange
|
|
108
|
-
}) {
|
|
109
|
-
const { getValue, setValue, elements = [] } = field;
|
|
110
|
-
const value = getValue({ item: data });
|
|
111
|
-
const disabled = field.isDisabled({ item: data, field });
|
|
112
|
-
const onSelect = useCallback(
|
|
113
|
-
(nextValue) => onChange(setValue({ item: data, value: nextValue })),
|
|
114
|
-
[data, onChange, setValue]
|
|
115
|
-
);
|
|
116
|
-
return /* @__PURE__ */ jsxs(Fieldset.Root, { children: [
|
|
117
|
-
/* @__PURE__ */ jsx(Fieldset.Legend, { children: field.label }),
|
|
118
|
-
/* @__PURE__ */ jsx(Stack, { direction: "row", gap: "md", role: "radiogroup", children: elements.map((option) => {
|
|
119
|
-
const isSelected = value === option.value;
|
|
120
|
-
return /* @__PURE__ */ jsx(
|
|
121
|
-
Button,
|
|
122
|
-
{
|
|
123
|
-
variant: "unstyled",
|
|
124
|
-
role: "radio",
|
|
125
|
-
"aria-checked": isSelected,
|
|
126
|
-
disabled,
|
|
127
|
-
className: clsx(style_default.option, {
|
|
128
|
-
[style_default.optionSelected]: isSelected
|
|
129
|
-
}),
|
|
130
|
-
onClick: () => onSelect(option.value),
|
|
131
|
-
children: /* @__PURE__ */ jsxs(Stack, { direction: "column", gap: "sm", align: "stretch", children: [
|
|
132
|
-
/* @__PURE__ */ jsx(
|
|
133
|
-
ModelThumbnail,
|
|
134
|
-
{
|
|
135
|
-
model: String(option.value),
|
|
136
|
-
className: style_default.thumbnail
|
|
137
|
-
}
|
|
138
|
-
),
|
|
139
|
-
/* @__PURE__ */ jsx(Text, { children: option.label })
|
|
140
|
-
] })
|
|
141
|
-
},
|
|
142
|
-
String(option.value)
|
|
143
|
-
);
|
|
144
|
-
}) }),
|
|
145
|
-
typeof field.description === "string" && /* @__PURE__ */ jsx(Fieldset.Description, { children: field.description })
|
|
146
|
-
] });
|
|
147
|
-
}
|
|
148
|
-
export {
|
|
149
|
-
LayoutModelEditField
|
|
150
|
-
};
|
|
151
|
-
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/components/layout-settings/layout-model-edit-field/index.tsx", "../../../../../style-runtime/src/index.ts", "../../../../src/components/layout-settings/layout-model-edit-field/style.module.css"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport type { DataFormControlProps } from '@wordpress/dataviews';\nimport { useCallback } from '@wordpress/element';\n/* eslint-disable @wordpress/use-recommended-components */\nimport { Button, Fieldset, Stack, Text } from '@wordpress/ui';\n/* eslint-enable @wordpress/use-recommended-components */\n\n/**\n * Internal dependencies\n */\nimport type { WidgetGridSettings } from '../../../types';\nimport { GridThumbnail } from './thumbnail-grid';\nimport { MasonryThumbnail } from './thumbnail-masonry';\nimport styles from './style.module.css';\n\ninterface ModelThumbnailProps {\n\tmodel: string;\n\tclassName?: string;\n}\n\nfunction ModelThumbnail( {\n\tmodel,\n\tclassName,\n}: ModelThumbnailProps ): React.ReactNode {\n\treturn model === 'masonry' ? (\n\t\t<MasonryThumbnail className={ className } />\n\t) : (\n\t\t<GridThumbnail className={ className } />\n\t);\n}\n\n/**\n * Card-style picker for the layout model: each option (`grid`, `masonry`)\n * renders as a thumbnail card in a radio group. Wired as the `Edit` control\n * for the `model` field of the layout settings DataForm.\n *\n * @param {DataFormControlProps< WidgetGridSettings >} props DataForm control props.\n */\nexport function LayoutModelEditField( {\n\tdata,\n\tfield,\n\tonChange,\n}: DataFormControlProps< WidgetGridSettings > ): React.ReactNode {\n\tconst { getValue, setValue, elements = [] } = field;\n\tconst value = getValue( { item: data } );\n\tconst disabled = field.isDisabled( { item: data, field } );\n\n\tconst onSelect = useCallback(\n\t\t( nextValue: string | number | undefined ) =>\n\t\t\tonChange( setValue( { item: data, value: nextValue } ) ),\n\t\t[ data, onChange, setValue ]\n\t);\n\n\treturn (\n\t\t<Fieldset.Root>\n\t\t\t<Fieldset.Legend>{ field.label }</Fieldset.Legend>\n\t\t\t<Stack direction=\"row\" gap=\"md\" role=\"radiogroup\">\n\t\t\t\t{ elements.map( ( option ) => {\n\t\t\t\t\tconst isSelected = value === option.value;\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tkey={ String( option.value ) }\n\t\t\t\t\t\t\tvariant=\"unstyled\"\n\t\t\t\t\t\t\trole=\"radio\"\n\t\t\t\t\t\t\taria-checked={ isSelected }\n\t\t\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\t\t\tclassName={ clsx( styles.option, {\n\t\t\t\t\t\t\t\t[ styles.optionSelected ]: isSelected,\n\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\tonClick={ () => onSelect( option.value ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Stack direction=\"column\" gap=\"sm\" align=\"stretch\">\n\t\t\t\t\t\t\t\t<ModelThumbnail\n\t\t\t\t\t\t\t\t\tmodel={ String( option.value ) }\n\t\t\t\t\t\t\t\t\tclassName={ styles.thumbnail }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<Text>{ option.label }</Text>\n\t\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t</Stack>\n\t\t\t{ typeof field.description === 'string' && (\n\t\t\t\t<Fieldset.Description>\n\t\t\t\t\t{ field.description }\n\t\t\t\t</Fieldset.Description>\n\t\t\t) }\n\t\t</Fieldset.Root>\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(\"1e741045ea\", \".a197e5fadbd013d8__option{background:transparent;border:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);border-radius:var(--wpds-border-radius-md,4px);color:inherit;cursor:var(--wpds-cursor-control,pointer);flex:1;padding:var(--wpds-dimension-padding-md,12px);text-align:center;transition:border-color var(--wpds-motion-duration-sm,.1s) var(--wpds-motion-easing-subtle,cubic-bezier(.15,0,.15,1)),background-color var(--wpds-motion-duration-sm,.1s) var(--wpds-motion-easing-subtle,cubic-bezier(.15,0,.15,1))}.a197e5fadbd013d8__option:hover{border-color:var(--wpds-color-stroke-surface-neutral-strong,#8d8d8d)}._90dfb85f4fe1f83c__optionSelected,._90dfb85f4fe1f83c__optionSelected:hover{background-color:color-mix(in srgb,var(--wpds-color-background-surface-brand,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 9%,#fff)) 6%,transparent);border-color:var(--wpds-color-stroke-interactive-brand,var(--wp-admin-theme-color,#3858e9))}._8dc1e0008b2c61a8__thumbnail{block-size:auto;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:block;inline-size:100%}._90dfb85f4fe1f83c__optionSelected ._8dc1e0008b2c61a8__thumbnail{color:var(--wpds-color-foreground-interactive-brand,var(--wp-admin-theme-color,#3858e9))}\");\n}\nexport default {\"option\":\"a197e5fadbd013d8__option\",\"optionSelected\":\"_90dfb85f4fe1f83c__optionSelected\",\"thumbnail\":\"_8dc1e0008b2c61a8__thumbnail\"};\n"],
|
|
5
|
-
"mappings": ";AAGA,OAAO,UAAU;AAMjB,SAAS,mBAAmB;AAE5B,SAAS,QAAQ,UAAU,OAAO,YAAY;AAO9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AAW;AAAA,IAChB,CAAE,cACD,SAAU,SAAU,EAAE,MAAM,MAAM,OAAO,UAAU,CAAE,CAAE;AAAA,IACxD,CAAE,MAAM,UAAU,QAAS;AAAA,EAC5B;AAEA,SACC,qBAAC,SAAS,MAAT,EACA;AAAA,wBAAC,SAAS,QAAT,EAAkB,gBAAM,OAAO;AAAA,IAChC,oBAAC,SAAM,WAAU,OAAM,KAAI,MAAK,MAAK,cAClC,mBAAS,IAAK,CAAE,WAAY;AAC7B,YAAM,aAAa,UAAU,OAAO;AAEpC,aACC;AAAA,QAAC;AAAA;AAAA,UAEA,SAAQ;AAAA,UACR,MAAK;AAAA,UACL,gBAAe;AAAA,UACf;AAAA,UACA,WAAY,KAAM,cAAO,QAAQ;AAAA,YAChC,CAAE,cAAO,cAAe,GAAG;AAAA,UAC5B,CAAE;AAAA,UACF,SAAU,MAAM,SAAU,OAAO,KAAM;AAAA,UAEvC,+BAAC,SAAM,WAAU,UAAS,KAAI,MAAK,OAAM,WACxC;AAAA;AAAA,cAAC;AAAA;AAAA,gBACA,OAAQ,OAAQ,OAAO,KAAM;AAAA,gBAC7B,WAAY,cAAO;AAAA;AAAA,YACpB;AAAA,YACA,oBAAC,QAAO,iBAAO,OAAO;AAAA,aACvB;AAAA;AAAA,QAhBM,OAAQ,OAAO,KAAM;AAAA,MAiB5B;AAAA,IAEF,CAAE,GACH;AAAA,IACE,OAAO,MAAM,gBAAgB,YAC9B,oBAAC,SAAS,aAAT,EACE,gBAAM,aACT;AAAA,KAEF;AAEF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
// packages/widget-dashboard/src/components/layout-settings/layout-model-edit-field/thumbnail-grid.tsx
|
|
2
|
-
import { SVG, Rect } from "@wordpress/primitives";
|
|
3
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
-
function GridThumbnail({
|
|
5
|
-
className
|
|
6
|
-
}) {
|
|
7
|
-
return /* @__PURE__ */ jsxs(
|
|
8
|
-
SVG,
|
|
9
|
-
{
|
|
10
|
-
className,
|
|
11
|
-
viewBox: "0 0 40 24",
|
|
12
|
-
fill: "currentColor",
|
|
13
|
-
"aria-hidden": "true",
|
|
14
|
-
children: [
|
|
15
|
-
/* @__PURE__ */ jsx(Rect, { x: "2", y: "1.25", width: "11", height: "10", rx: "1.5" }),
|
|
16
|
-
/* @__PURE__ */ jsx(Rect, { x: "14.5", y: "1.25", width: "11", height: "10", rx: "1.5" }),
|
|
17
|
-
/* @__PURE__ */ jsx(Rect, { x: "27", y: "1.25", width: "11", height: "10", rx: "1.5" }),
|
|
18
|
-
/* @__PURE__ */ jsx(Rect, { x: "2", y: "12.75", width: "11", height: "10", rx: "1.5" }),
|
|
19
|
-
/* @__PURE__ */ jsx(Rect, { x: "14.5", y: "12.75", width: "11", height: "10", rx: "1.5" }),
|
|
20
|
-
/* @__PURE__ */ jsx(Rect, { x: "27", y: "12.75", width: "11", height: "10", rx: "1.5" })
|
|
21
|
-
]
|
|
22
|
-
}
|
|
23
|
-
);
|
|
24
|
-
}
|
|
25
|
-
export {
|
|
26
|
-
GridThumbnail
|
|
27
|
-
};
|
|
28
|
-
//# sourceMappingURL=thumbnail-grid.mjs.map
|
package/build-module/components/layout-settings/layout-model-edit-field/thumbnail-grid.mjs.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/components/layout-settings/layout-model-edit-field/thumbnail-grid.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { SVG, Rect } from '@wordpress/primitives';\n\ninterface GridThumbnailProps {\n\tclassName?: string;\n}\n\nexport function GridThumbnail( {\n\tclassName,\n}: GridThumbnailProps ): React.ReactNode {\n\treturn (\n\t\t<SVG\n\t\t\tclassName={ className }\n\t\t\tviewBox=\"0 0 40 24\"\n\t\t\tfill=\"currentColor\"\n\t\t\taria-hidden=\"true\"\n\t\t>\n\t\t\t<Rect x=\"2\" y=\"1.25\" width=\"11\" height=\"10\" rx=\"1.5\" />\n\t\t\t<Rect x=\"14.5\" y=\"1.25\" width=\"11\" height=\"10\" rx=\"1.5\" />\n\t\t\t<Rect x=\"27\" y=\"1.25\" width=\"11\" height=\"10\" rx=\"1.5\" />\n\t\t\t<Rect x=\"2\" y=\"12.75\" width=\"11\" height=\"10\" rx=\"1.5\" />\n\t\t\t<Rect x=\"14.5\" y=\"12.75\" width=\"11\" height=\"10\" rx=\"1.5\" />\n\t\t\t<Rect x=\"27\" y=\"12.75\" width=\"11\" height=\"10\" rx=\"1.5\" />\n\t\t</SVG>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";AAGA,SAAS,KAAK,YAAY;AAUxB,SAMC,KAND;AAJK,SAAS,cAAe;AAAA,EAC9B;AACD,GAAyC;AACxC,SACC;AAAA,IAAC;AAAA;AAAA,MACA;AAAA,MACA,SAAQ;AAAA,MACR,MAAK;AAAA,MACL,eAAY;AAAA,MAEZ;AAAA,4BAAC,QAAK,GAAE,KAAI,GAAE,QAAO,OAAM,MAAK,QAAO,MAAK,IAAG,OAAM;AAAA,QACrD,oBAAC,QAAK,GAAE,QAAO,GAAE,QAAO,OAAM,MAAK,QAAO,MAAK,IAAG,OAAM;AAAA,QACxD,oBAAC,QAAK,GAAE,MAAK,GAAE,QAAO,OAAM,MAAK,QAAO,MAAK,IAAG,OAAM;AAAA,QACtD,oBAAC,QAAK,GAAE,KAAI,GAAE,SAAQ,OAAM,MAAK,QAAO,MAAK,IAAG,OAAM;AAAA,QACtD,oBAAC,QAAK,GAAE,QAAO,GAAE,SAAQ,OAAM,MAAK,QAAO,MAAK,IAAG,OAAM;AAAA,QACzD,oBAAC,QAAK,GAAE,MAAK,GAAE,SAAQ,OAAM,MAAK,QAAO,MAAK,IAAG,OAAM;AAAA;AAAA;AAAA,EACxD;AAEF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/build-module/components/layout-settings/layout-model-edit-field/thumbnail-masonry.mjs
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
// packages/widget-dashboard/src/components/layout-settings/layout-model-edit-field/thumbnail-masonry.tsx
|
|
2
|
-
import { SVG, Rect } from "@wordpress/primitives";
|
|
3
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
-
function MasonryThumbnail({
|
|
5
|
-
className
|
|
6
|
-
}) {
|
|
7
|
-
return /* @__PURE__ */ jsxs(
|
|
8
|
-
SVG,
|
|
9
|
-
{
|
|
10
|
-
className,
|
|
11
|
-
viewBox: "0 0 40 24",
|
|
12
|
-
fill: "currentColor",
|
|
13
|
-
"aria-hidden": "true",
|
|
14
|
-
children: [
|
|
15
|
-
/* @__PURE__ */ jsx(Rect, { x: "2", y: "0.75", width: "11", height: "13", rx: "1.5" }),
|
|
16
|
-
/* @__PURE__ */ jsx(Rect, { x: "2", y: "15.25", width: "11", height: "8", rx: "1.5" }),
|
|
17
|
-
/* @__PURE__ */ jsx(Rect, { x: "14.5", y: "0.75", width: "11", height: "8", rx: "1.5" }),
|
|
18
|
-
/* @__PURE__ */ jsx(Rect, { x: "14.5", y: "10.25", width: "11", height: "13", rx: "1.5" }),
|
|
19
|
-
/* @__PURE__ */ jsx(Rect, { x: "27", y: "0.75", width: "11", height: "10", rx: "1.5" }),
|
|
20
|
-
/* @__PURE__ */ jsx(Rect, { x: "27", y: "12.25", width: "11", height: "11", rx: "1.5" })
|
|
21
|
-
]
|
|
22
|
-
}
|
|
23
|
-
);
|
|
24
|
-
}
|
|
25
|
-
export {
|
|
26
|
-
MasonryThumbnail
|
|
27
|
-
};
|
|
28
|
-
//# sourceMappingURL=thumbnail-masonry.mjs.map
|
package/build-module/components/layout-settings/layout-model-edit-field/thumbnail-masonry.mjs.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/components/layout-settings/layout-model-edit-field/thumbnail-masonry.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { SVG, Rect } from '@wordpress/primitives';\n\ninterface MasonryThumbnailProps {\n\tclassName?: string;\n}\n\nexport function MasonryThumbnail( {\n\tclassName,\n}: MasonryThumbnailProps ): React.ReactNode {\n\treturn (\n\t\t<SVG\n\t\t\tclassName={ className }\n\t\t\tviewBox=\"0 0 40 24\"\n\t\t\tfill=\"currentColor\"\n\t\t\taria-hidden=\"true\"\n\t\t>\n\t\t\t<Rect x=\"2\" y=\"0.75\" width=\"11\" height=\"13\" rx=\"1.5\" />\n\t\t\t<Rect x=\"2\" y=\"15.25\" width=\"11\" height=\"8\" rx=\"1.5\" />\n\t\t\t<Rect x=\"14.5\" y=\"0.75\" width=\"11\" height=\"8\" rx=\"1.5\" />\n\t\t\t<Rect x=\"14.5\" y=\"10.25\" width=\"11\" height=\"13\" rx=\"1.5\" />\n\t\t\t<Rect x=\"27\" y=\"0.75\" width=\"11\" height=\"10\" rx=\"1.5\" />\n\t\t\t<Rect x=\"27\" y=\"12.25\" width=\"11\" height=\"11\" rx=\"1.5\" />\n\t\t</SVG>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";AAGA,SAAS,KAAK,YAAY;AAUxB,SAMC,KAND;AAJK,SAAS,iBAAkB;AAAA,EACjC;AACD,GAA4C;AAC3C,SACC;AAAA,IAAC;AAAA;AAAA,MACA;AAAA,MACA,SAAQ;AAAA,MACR,MAAK;AAAA,MACL,eAAY;AAAA,MAEZ;AAAA,4BAAC,QAAK,GAAE,KAAI,GAAE,QAAO,OAAM,MAAK,QAAO,MAAK,IAAG,OAAM;AAAA,QACrD,oBAAC,QAAK,GAAE,KAAI,GAAE,SAAQ,OAAM,MAAK,QAAO,KAAI,IAAG,OAAM;AAAA,QACrD,oBAAC,QAAK,GAAE,QAAO,GAAE,QAAO,OAAM,MAAK,QAAO,KAAI,IAAG,OAAM;AAAA,QACvD,oBAAC,QAAK,GAAE,QAAO,GAAE,SAAQ,OAAM,MAAK,QAAO,MAAK,IAAG,OAAM;AAAA,QACzD,oBAAC,QAAK,GAAE,MAAK,GAAE,QAAO,OAAM,MAAK,QAAO,MAAK,IAAG,OAAM;AAAA,QACtD,oBAAC,QAAK,GAAE,MAAK,GAAE,SAAQ,OAAM,MAAK,QAAO,MAAK,IAAG,OAAM;AAAA;AAAA;AAAA,EACxD;AAEF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
// packages/widget-dashboard/src/components/layout-settings/layout-settings.tsx
|
|
2
|
-
import { DataForm } from "@wordpress/dataviews";
|
|
3
|
-
import { useCallback, useEffect } from "@wordpress/element";
|
|
4
|
-
import { __ } from "@wordpress/i18n";
|
|
5
|
-
import { Button, Drawer } from "@wordpress/ui";
|
|
6
|
-
import { useDashboardInternalContext } from "../../context/dashboard-context.mjs";
|
|
7
|
-
import { useDashboardUIContext } from "../../context/ui-context.mjs";
|
|
8
|
-
import { migrateLayout } from "../../utils/migrate-layout/index.mjs";
|
|
9
|
-
import {
|
|
10
|
-
presetToRowHeight,
|
|
11
|
-
rowHeightToPreset
|
|
12
|
-
} from "../../utils/row-height-presets/index.mjs";
|
|
13
|
-
import {
|
|
14
|
-
WIDGET_DASHBOARD_COLUMN_COUNT
|
|
15
|
-
} from "../../types.mjs";
|
|
16
|
-
import { LayoutModelEditField } from "./layout-model-edit-field/index.mjs";
|
|
17
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
18
|
-
function getModel(item) {
|
|
19
|
-
return item.model ?? "grid";
|
|
20
|
-
}
|
|
21
|
-
function isMasonry(item) {
|
|
22
|
-
return getModel(item) === "masonry";
|
|
23
|
-
}
|
|
24
|
-
var fields = [
|
|
25
|
-
{
|
|
26
|
-
id: "model",
|
|
27
|
-
type: "text",
|
|
28
|
-
Edit: LayoutModelEditField,
|
|
29
|
-
label: __("Layout model"),
|
|
30
|
-
description: __(
|
|
31
|
-
"Grid keeps every tile the same height. Masonry lets tiles flow at their own height."
|
|
32
|
-
),
|
|
33
|
-
elements: [
|
|
34
|
-
{ value: "grid", label: __("Standard grid") },
|
|
35
|
-
{ value: "masonry", label: __("Masonry") }
|
|
36
|
-
],
|
|
37
|
-
getValue: ({ item }) => getModel(item)
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
id: "rowHeight",
|
|
41
|
-
type: "text",
|
|
42
|
-
Edit: "toggleGroup",
|
|
43
|
-
label: __("Row height"),
|
|
44
|
-
description: __("Height of each grid row."),
|
|
45
|
-
elements: [
|
|
46
|
-
{ value: "small", label: __("Small") },
|
|
47
|
-
{ value: "medium", label: __("Medium") },
|
|
48
|
-
{ value: "large", label: __("Large") }
|
|
49
|
-
],
|
|
50
|
-
getValue: ({ item }) => {
|
|
51
|
-
const rowHeight = item.rowHeight;
|
|
52
|
-
if (typeof rowHeight !== "number") {
|
|
53
|
-
return "medium";
|
|
54
|
-
}
|
|
55
|
-
return rowHeightToPreset(rowHeight);
|
|
56
|
-
},
|
|
57
|
-
setValue: ({ value }) => ({
|
|
58
|
-
rowHeight: presetToRowHeight(value)
|
|
59
|
-
}),
|
|
60
|
-
isVisible: (item) => !isMasonry(item)
|
|
61
|
-
}
|
|
62
|
-
];
|
|
63
|
-
var form = {
|
|
64
|
-
layout: { type: "regular", labelPosition: "top" },
|
|
65
|
-
fields: ["model", "rowHeight"]
|
|
66
|
-
};
|
|
67
|
-
function LayoutSettings() {
|
|
68
|
-
const {
|
|
69
|
-
gridSettings,
|
|
70
|
-
onGridSettingsChange,
|
|
71
|
-
layout,
|
|
72
|
-
onLayoutChange,
|
|
73
|
-
commit,
|
|
74
|
-
cancel: cancelStaging,
|
|
75
|
-
resetGridSettings,
|
|
76
|
-
hasUncommittedChanges,
|
|
77
|
-
canEditGridSettings,
|
|
78
|
-
editMode
|
|
79
|
-
} = useDashboardInternalContext();
|
|
80
|
-
const { layoutSettingsOpen: open, setLayoutSettingsOpen: onOpenChange } = useDashboardUIContext();
|
|
81
|
-
useEffect(() => {
|
|
82
|
-
if (!editMode && open) {
|
|
83
|
-
onOpenChange(false);
|
|
84
|
-
}
|
|
85
|
-
}, [editMode, open, onOpenChange]);
|
|
86
|
-
const handleChange = useCallback(
|
|
87
|
-
(edits) => {
|
|
88
|
-
const nextModel = edits.model;
|
|
89
|
-
const currentModel = getModel(gridSettings);
|
|
90
|
-
if (nextModel && nextModel !== currentModel) {
|
|
91
|
-
const migrated = migrateLayout(
|
|
92
|
-
layout,
|
|
93
|
-
currentModel,
|
|
94
|
-
nextModel,
|
|
95
|
-
{ columns: WIDGET_DASHBOARD_COLUMN_COUNT }
|
|
96
|
-
);
|
|
97
|
-
onLayoutChange(migrated);
|
|
98
|
-
}
|
|
99
|
-
onGridSettingsChange({
|
|
100
|
-
...gridSettings,
|
|
101
|
-
...edits
|
|
102
|
-
});
|
|
103
|
-
},
|
|
104
|
-
[gridSettings, layout, onGridSettingsChange, onLayoutChange]
|
|
105
|
-
);
|
|
106
|
-
const handleCancel = useCallback(() => {
|
|
107
|
-
cancelStaging({ exitEditMode: false, revertLayout: false });
|
|
108
|
-
onOpenChange(false);
|
|
109
|
-
}, [cancelStaging, onOpenChange]);
|
|
110
|
-
const handleSave = useCallback(() => {
|
|
111
|
-
commit({ exitEditMode: false });
|
|
112
|
-
onOpenChange(false);
|
|
113
|
-
}, [commit, onOpenChange]);
|
|
114
|
-
const handleOpenChange = useCallback(
|
|
115
|
-
(nextOpen) => {
|
|
116
|
-
if (!nextOpen && open) {
|
|
117
|
-
cancelStaging({ exitEditMode: false, revertLayout: false });
|
|
118
|
-
}
|
|
119
|
-
onOpenChange(nextOpen);
|
|
120
|
-
},
|
|
121
|
-
[open, cancelStaging, onOpenChange]
|
|
122
|
-
);
|
|
123
|
-
if (!canEditGridSettings) {
|
|
124
|
-
return null;
|
|
125
|
-
}
|
|
126
|
-
return /* @__PURE__ */ jsx(
|
|
127
|
-
Drawer.Root,
|
|
128
|
-
{
|
|
129
|
-
open,
|
|
130
|
-
onOpenChange: handleOpenChange,
|
|
131
|
-
swipeDirection: "right",
|
|
132
|
-
children: /* @__PURE__ */ jsxs(Drawer.Popup, { size: "medium", style: { marginTop: "32px" }, children: [
|
|
133
|
-
/* @__PURE__ */ jsxs(Drawer.Header, { children: [
|
|
134
|
-
/* @__PURE__ */ jsx(Drawer.Title, { children: __("Layout settings") }),
|
|
135
|
-
/* @__PURE__ */ jsx(Drawer.CloseIcon, {})
|
|
136
|
-
] }),
|
|
137
|
-
/* @__PURE__ */ jsx(Drawer.Content, { children: /* @__PURE__ */ jsx(
|
|
138
|
-
DataForm,
|
|
139
|
-
{
|
|
140
|
-
data: gridSettings,
|
|
141
|
-
fields,
|
|
142
|
-
form,
|
|
143
|
-
onChange: handleChange
|
|
144
|
-
}
|
|
145
|
-
) }),
|
|
146
|
-
/* @__PURE__ */ jsxs(Drawer.Footer, { children: [
|
|
147
|
-
/* @__PURE__ */ jsx(
|
|
148
|
-
Button,
|
|
149
|
-
{
|
|
150
|
-
variant: "minimal",
|
|
151
|
-
tone: "neutral",
|
|
152
|
-
size: "compact",
|
|
153
|
-
onClick: resetGridSettings,
|
|
154
|
-
style: { marginInlineEnd: "auto" },
|
|
155
|
-
children: __("Reset")
|
|
156
|
-
}
|
|
157
|
-
),
|
|
158
|
-
/* @__PURE__ */ jsx(
|
|
159
|
-
Button,
|
|
160
|
-
{
|
|
161
|
-
variant: "minimal",
|
|
162
|
-
tone: "brand",
|
|
163
|
-
size: "compact",
|
|
164
|
-
onClick: handleCancel,
|
|
165
|
-
children: __("Cancel")
|
|
166
|
-
}
|
|
167
|
-
),
|
|
168
|
-
/* @__PURE__ */ jsx(
|
|
169
|
-
Button,
|
|
170
|
-
{
|
|
171
|
-
variant: "solid",
|
|
172
|
-
tone: "brand",
|
|
173
|
-
size: "compact",
|
|
174
|
-
onClick: handleSave,
|
|
175
|
-
disabled: !hasUncommittedChanges,
|
|
176
|
-
children: __("Save")
|
|
177
|
-
}
|
|
178
|
-
)
|
|
179
|
-
] })
|
|
180
|
-
] })
|
|
181
|
-
}
|
|
182
|
-
);
|
|
183
|
-
}
|
|
184
|
-
export {
|
|
185
|
-
LayoutSettings
|
|
186
|
-
};
|
|
187
|
-
//# sourceMappingURL=layout-settings.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/layout-settings/layout-settings.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { DataForm } from '@wordpress/dataviews';\nimport type { Field, Form } from '@wordpress/dataviews';\nimport { useCallback, useEffect } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { Button, Drawer } from '@wordpress/ui'; // eslint-disable-line @wordpress/use-recommended-components\n\n/**\n * Internal dependencies\n */\nimport { useDashboardInternalContext } from '../../context/dashboard-context';\nimport { useDashboardUIContext } from '../../context/ui-context';\nimport { migrateLayout } from '../../utils/migrate-layout';\nimport {\n\tpresetToRowHeight,\n\trowHeightToPreset,\n\ttype RowHeightPreset,\n} from '../../utils/row-height-presets';\nimport {\n\tWIDGET_DASHBOARD_COLUMN_COUNT,\n\ttype WidgetGridLayoutSettings,\n\ttype WidgetGridModel,\n\ttype WidgetGridSettings,\n} from '../../types';\nimport { LayoutModelEditField } from './layout-model-edit-field';\n\nfunction getModel( item: WidgetGridSettings ): WidgetGridModel {\n\treturn item.model ?? 'grid';\n}\n\nfunction isMasonry( item: WidgetGridSettings ): boolean {\n\treturn getModel( item ) === 'masonry';\n}\n\nconst fields: Field< WidgetGridSettings >[] = [\n\t{\n\t\tid: 'model',\n\t\ttype: 'text',\n\t\tEdit: LayoutModelEditField,\n\t\tlabel: __( 'Layout model' ),\n\t\tdescription: __(\n\t\t\t'Grid keeps every tile the same height. Masonry lets tiles flow at their own height.'\n\t\t),\n\t\telements: [\n\t\t\t{ value: 'grid', label: __( 'Standard grid' ) },\n\t\t\t{ value: 'masonry', label: __( 'Masonry' ) },\n\t\t],\n\t\tgetValue: ( { item } ) => getModel( item ),\n\t},\n\t{\n\t\tid: 'rowHeight',\n\t\ttype: 'text',\n\t\tEdit: 'toggleGroup',\n\t\tlabel: __( 'Row height' ),\n\t\tdescription: __( 'Height of each grid row.' ),\n\t\telements: [\n\t\t\t{ value: 'small', label: __( 'Small' ) },\n\t\t\t{ value: 'medium', label: __( 'Medium' ) },\n\t\t\t{ value: 'large', label: __( 'Large' ) },\n\t\t],\n\t\tgetValue: ( { item } ) => {\n\t\t\tconst rowHeight = ( item as WidgetGridLayoutSettings ).rowHeight;\n\t\t\tif ( typeof rowHeight !== 'number' ) {\n\t\t\t\treturn 'medium';\n\t\t\t}\n\t\t\treturn rowHeightToPreset( rowHeight );\n\t\t},\n\t\tsetValue: ( { value } ) => ( {\n\t\t\trowHeight: presetToRowHeight( value as RowHeightPreset ),\n\t\t} ),\n\t\tisVisible: ( item ) => ! isMasonry( item ),\n\t},\n];\n\nconst form: Form = {\n\tlayout: { type: 'regular', labelPosition: 'top' },\n\tfields: [ 'model', 'rowHeight' ],\n};\n\n/**\n * Modal side drawer for grid-level settings (layout model and row height),\n * mounted by the engine and shown while `layoutSettingsOpen` is set in the\n * shared UI context. Renders nothing when grid settings are not editable.\n *\n * Edits, including Reset, apply to the staging copy and preview live behind\n * the drawer. Save commits them; Cancel and any other dismissal (X, Escape)\n * revert them. Either way only grid settings change, so in-progress widget\n * layout edits survive and customize mode stays active.\n *\n * Tile gap is deliberately not exposed; spacing stays a design-system concern.\n */\nexport function LayoutSettings(): React.ReactNode {\n\tconst {\n\t\tgridSettings,\n\t\tonGridSettingsChange,\n\t\tlayout,\n\t\tonLayoutChange,\n\t\tcommit,\n\t\tcancel: cancelStaging,\n\t\tresetGridSettings,\n\t\thasUncommittedChanges,\n\t\tcanEditGridSettings,\n\t\teditMode,\n\t} = useDashboardInternalContext();\n\n\tconst { layoutSettingsOpen: open, setLayoutSettingsOpen: onOpenChange } =\n\t\tuseDashboardUIContext();\n\n\t// Close when customize mode exits, whatever the exit path.\n\tuseEffect( () => {\n\t\tif ( ! editMode && open ) {\n\t\t\tonOpenChange( false );\n\t\t}\n\t}, [ editMode, open, onOpenChange ] );\n\n\tconst handleChange = useCallback(\n\t\t( edits: Record< string, unknown > ) => {\n\t\t\tconst nextModel = edits.model as WidgetGridModel | undefined;\n\t\t\tconst currentModel = getModel( gridSettings );\n\n\t\t\tif ( nextModel && nextModel !== currentModel ) {\n\t\t\t\tconst migrated = migrateLayout(\n\t\t\t\t\tlayout,\n\t\t\t\t\tcurrentModel,\n\t\t\t\t\tnextModel,\n\t\t\t\t\t{ columns: WIDGET_DASHBOARD_COLUMN_COUNT }\n\t\t\t\t);\n\t\t\t\tonLayoutChange( migrated );\n\t\t\t}\n\n\t\t\tonGridSettingsChange( {\n\t\t\t\t...gridSettings,\n\t\t\t\t...edits,\n\t\t\t} as WidgetGridSettings );\n\t\t},\n\t\t[ gridSettings, layout, onGridSettingsChange, onLayoutChange ]\n\t);\n\n\tconst handleCancel = useCallback( () => {\n\t\tcancelStaging( { exitEditMode: false, revertLayout: false } );\n\t\tonOpenChange( false );\n\t}, [ cancelStaging, onOpenChange ] );\n\n\tconst handleSave = useCallback( () => {\n\t\tcommit( { exitEditMode: false } );\n\t\tonOpenChange( false );\n\t}, [ commit, onOpenChange ] );\n\n\tconst handleOpenChange = useCallback(\n\t\t( nextOpen: boolean ) => {\n\t\t\tif ( ! nextOpen && open ) {\n\t\t\t\tcancelStaging( { exitEditMode: false, revertLayout: false } );\n\t\t\t}\n\t\t\tonOpenChange( nextOpen );\n\t\t},\n\t\t[ open, cancelStaging, onOpenChange ]\n\t);\n\n\tif ( ! canEditGridSettings ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Drawer.Root\n\t\t\topen={ open }\n\t\t\tonOpenChange={ handleOpenChange }\n\t\t\tswipeDirection=\"right\"\n\t\t>\n\t\t\t<Drawer.Popup size=\"medium\" style={ { marginTop: '32px' } }>\n\t\t\t\t<Drawer.Header>\n\t\t\t\t\t<Drawer.Title>{ __( 'Layout settings' ) }</Drawer.Title>\n\t\t\t\t\t<Drawer.CloseIcon />\n\t\t\t\t</Drawer.Header>\n\n\t\t\t\t<Drawer.Content>\n\t\t\t\t\t<DataForm\n\t\t\t\t\t\tdata={ gridSettings }\n\t\t\t\t\t\tfields={ fields }\n\t\t\t\t\t\tform={ form }\n\t\t\t\t\t\tonChange={ handleChange }\n\t\t\t\t\t/>\n\t\t\t\t</Drawer.Content>\n\n\t\t\t\t<Drawer.Footer>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"minimal\"\n\t\t\t\t\t\ttone=\"neutral\"\n\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\tonClick={ resetGridSettings }\n\t\t\t\t\t\tstyle={ { marginInlineEnd: 'auto' } }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Reset' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"minimal\"\n\t\t\t\t\t\ttone=\"brand\"\n\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\tonClick={ handleCancel }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"solid\"\n\t\t\t\t\t\ttone=\"brand\"\n\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\tonClick={ handleSave }\n\t\t\t\t\t\tdisabled={ ! hasUncommittedChanges }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Save' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</Drawer.Footer>\n\t\t\t</Drawer.Popup>\n\t\t</Drawer.Root>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";AAGA,SAAS,gBAAgB;AAEzB,SAAS,aAAa,iBAAiB;AACvC,SAAS,UAAU;AACnB,SAAS,QAAQ,cAAc;AAK/B,SAAS,mCAAmC;AAC5C,SAAS,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0,0 @@
|
|
|
1
|
-
// packages/widget-dashboard/src/components/widget-settings/utils/get-admin-menu-inset.ts
|
|
2
|
-
var ADMIN_MENU_ID = "adminmenuback";
|
|
3
|
-
function getAdminMenuInset() {
|
|
4
|
-
if (typeof document === "undefined") {
|
|
5
|
-
return 0;
|
|
6
|
-
}
|
|
7
|
-
const adminMenu = document.getElementById(ADMIN_MENU_ID);
|
|
8
|
-
if (!adminMenu) {
|
|
9
|
-
return 0;
|
|
10
|
-
}
|
|
11
|
-
return Math.max(0, adminMenu.getBoundingClientRect().right);
|
|
12
|
-
}
|
|
13
|
-
export {
|
|
14
|
-
getAdminMenuInset
|
|
15
|
-
};
|
|
16
|
-
//# sourceMappingURL=get-admin-menu-inset.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/components/widget-settings/utils/get-admin-menu-inset.ts"],
|
|
4
|
-
"sourcesContent": ["// cspell:ignore adminmenuback\nconst ADMIN_MENU_ID = 'adminmenuback';\n\n/**\n * Width, in pixels, taken up by the WordPress admin menu\n * (`#adminmenuback`) on the inline-start edge of the viewport.\n *\n * The settings drawer portals to the document body and anchors to a\n * viewport edge, so a left-anchored drawer would slide over the fixed\n * admin menu. Offsetting the drawer by this value keeps the menu\n * uncovered (and reachable) instead of raising the drawer's z-index over\n * it.\n *\n * Defensive: returns `0` when the element is absent (outside wp-admin, or\n * in tests/Storybook), so the drawer just anchors to the viewport edge.\n *\n * @return {number} The admin menu's right edge in px, or `0`.\n */\nexport function getAdminMenuInset(): number {\n\tif ( typeof document === 'undefined' ) {\n\t\treturn 0;\n\t}\n\n\tconst adminMenu = document.getElementById( ADMIN_MENU_ID );\n\tif ( ! adminMenu ) {\n\t\treturn 0;\n\t}\n\n\treturn Math.max( 0, adminMenu.getBoundingClientRect().right );\n}\n"],
|
|
5
|
-
"mappings": ";AACA,IAAM,gBAAgB;AAiBf,SAAS,oBAA4B;AAC3C,MAAK,OAAO,aAAa,aAAc;AACtC,WAAO;AAAA,EACR;AAEA,QAAM,YAAY,SAAS,eAAgB,aAAc;AACzD,MAAK,CAAE,WAAY;AAClB,WAAO;AAAA,EACR;AAEA,SAAO,KAAK,IAAK,GAAG,UAAU,sBAAsB,EAAE,KAAM;AAC7D;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|