@pantheon-systems/puck-css 0.4.4 → 0.5.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/dist/auth/P1AuthProvider.d.ts +1 -0
- package/dist/auth/P1AuthProvider.d.ts.map +1 -1
- package/dist/auth/P1AuthProvider.js +9 -0
- package/dist/auth/P1AuthProvider.js.map +1 -1
- package/dist/auth/index.d.ts +1 -1
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/index.js +1 -1
- package/dist/auth/index.js.map +1 -1
- package/dist/core/types.d.ts +31 -4
- package/dist/core/types.d.ts.map +1 -1
- package/dist/data/dal/init.d.ts +7 -0
- package/dist/data/dal/init.d.ts.map +1 -1
- package/dist/data/dal/init.js +32 -0
- package/dist/data/dal/init.js.map +1 -1
- package/dist/data/dal/p1-store.d.ts +2 -0
- package/dist/data/dal/p1-store.d.ts.map +1 -1
- package/dist/data/dal/p1-store.js +14 -10
- package/dist/data/dal/p1-store.js.map +1 -1
- package/dist/data/page-store.d.ts +4 -3
- package/dist/data/page-store.d.ts.map +1 -1
- package/dist/data/page-store.js +6 -6
- package/dist/data/page-store.js.map +1 -1
- package/dist/data/paths.js +1 -1
- package/dist/data/paths.js.map +1 -1
- package/dist/editor/P1PuckProvider.d.ts.map +1 -1
- package/dist/editor/P1PuckProvider.js +102 -17
- package/dist/editor/P1PuckProvider.js.map +1 -1
- package/dist/editor/plugin/P1Plugin.d.ts +12 -2
- package/dist/editor/plugin/P1Plugin.d.ts.map +1 -1
- package/dist/editor/plugin/P1Plugin.js +30 -9
- package/dist/editor/plugin/P1Plugin.js.map +1 -1
- package/dist/editor/plugin/createP1Overrides.d.ts +7 -0
- package/dist/editor/plugin/createP1Overrides.d.ts.map +1 -1
- package/dist/editor/plugin/createP1Overrides.js +72 -2
- package/dist/editor/plugin/createP1Overrides.js.map +1 -1
- package/dist/editor/useDocuments.d.ts +1 -0
- package/dist/editor/useDocuments.d.ts.map +1 -1
- package/dist/editor/useDocuments.js +15 -2
- package/dist/editor/useDocuments.js.map +1 -1
- package/dist/editor/useP1Editor.d.ts.map +1 -1
- package/dist/editor/useP1Editor.js +41 -23
- package/dist/editor/useP1Editor.js.map +1 -1
- package/dist/editor/useP1Plugin.d.ts +3 -1
- package/dist/editor/useP1Plugin.d.ts.map +1 -1
- package/dist/editor/useP1Plugin.js +2 -0
- package/dist/editor/useP1Plugin.js.map +1 -1
- package/dist/features/content-type-templates/editor/useTemplateScaffold.d.ts +3 -7
- package/dist/features/content-type-templates/editor/useTemplateScaffold.d.ts.map +1 -1
- package/dist/features/content-type-templates/editor/useTemplateScaffold.js +6 -14
- package/dist/features/content-type-templates/editor/useTemplateScaffold.js.map +1 -1
- package/dist/features/content-type-templates/hooks/useTemplateList.d.ts +3 -3
- package/dist/features/content-type-templates/hooks/useTemplateList.d.ts.map +1 -1
- package/dist/features/content-type-templates/hooks/useTemplateList.js +5 -3
- package/dist/features/content-type-templates/hooks/useTemplateList.js.map +1 -1
- package/dist/features/content-type-templates/index.d.ts +1 -1
- package/dist/features/content-type-templates/index.d.ts.map +1 -1
- package/dist/features/content-type-templates/index.js.map +1 -1
- package/dist/features/content-type-templates/permissions/createPuckPermissions.d.ts +8 -3
- package/dist/features/content-type-templates/permissions/createPuckPermissions.d.ts.map +1 -1
- package/dist/features/content-type-templates/permissions/createPuckPermissions.js +18 -27
- package/dist/features/content-type-templates/permissions/createPuckPermissions.js.map +1 -1
- package/dist/features/content-type-templates/stores/template-store.d.ts +4 -4
- package/dist/features/content-type-templates/stores/template-store.d.ts.map +1 -1
- package/dist/features/content-type-templates/stores/template-store.js +33 -10
- package/dist/features/content-type-templates/stores/template-store.js.map +1 -1
- package/dist/features/content-type-templates/types.d.ts +1 -88
- package/dist/features/content-type-templates/types.d.ts.map +1 -1
- package/dist/features/content-type-templates/ui/ActionBarPinButton.d.ts.map +1 -1
- package/dist/features/content-type-templates/ui/ActionBarPinButton.js +16 -34
- package/dist/features/content-type-templates/ui/ActionBarPinButton.js.map +1 -1
- package/dist/features/content-type-templates/ui/TemplateDetailsPanel.d.ts +24 -0
- package/dist/features/content-type-templates/ui/TemplateDetailsPanel.d.ts.map +1 -0
- package/dist/features/content-type-templates/ui/TemplateDetailsPanel.js +124 -0
- package/dist/features/content-type-templates/ui/TemplateDetailsPanel.js.map +1 -0
- package/dist/features/content-type-templates/ui/TemplateSelector.d.ts +2 -2
- package/dist/features/content-type-templates/ui/TemplateSelector.d.ts.map +1 -1
- package/dist/features/content-type-templates/validation/structural-validation.d.ts.map +1 -1
- package/dist/features/content-type-templates/validation/structural-validation.js +7 -4
- package/dist/features/content-type-templates/validation/structural-validation.js.map +1 -1
- package/dist/index.d.ts +3 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -3
- package/dist/index.js.map +1 -1
- package/dist/p1/editor/connect/connect-field-modal.d.ts.map +1 -1
- package/dist/p1/editor/connect/connect-field-modal.js +1 -1
- package/dist/p1/editor/connect/connect-field-modal.js.map +1 -1
- package/dist/p1/editor/remote-datasources/remote-datasource-explorer-plugin.d.ts.map +1 -1
- package/dist/p1/editor/remote-datasources/remote-datasource-explorer-plugin.js +91 -29
- package/dist/p1/editor/remote-datasources/remote-datasource-explorer-plugin.js.map +1 -1
- package/dist/p1/pages/index.d.ts +0 -10
- package/dist/p1/pages/index.d.ts.map +1 -1
- package/dist/p1/pages/index.js +0 -10
- package/dist/p1/pages/index.js.map +1 -1
- package/dist/pds/components/CreatePageModal.d.ts +109 -0
- package/dist/pds/components/CreatePageModal.d.ts.map +1 -0
- package/dist/pds/components/CreatePageModal.js +527 -0
- package/dist/pds/components/CreatePageModal.js.map +1 -0
- package/dist/pds/components/CreatePageModal.module.css +745 -0
- package/dist/pds/components/DocStateBadge.js +1 -1
- package/dist/pds/components/DocStateBadge.js.map +1 -1
- package/dist/pds/components/P1EditorHeader.d.ts +17 -5
- package/dist/pds/components/P1EditorHeader.d.ts.map +1 -1
- package/dist/pds/components/P1EditorHeader.js +32 -6
- package/dist/pds/components/P1EditorHeader.js.map +1 -1
- package/dist/pds/components/P1EditorSubheader.d.ts +7 -1
- package/dist/pds/components/P1EditorSubheader.d.ts.map +1 -1
- package/dist/pds/components/P1EditorSubheader.js +2 -2
- package/dist/pds/components/P1EditorSubheader.js.map +1 -1
- package/dist/pds/components/PageNavigator.d.ts +15 -4
- package/dist/pds/components/PageNavigator.d.ts.map +1 -1
- package/dist/pds/components/PageNavigator.js +23 -5
- package/dist/pds/components/PageNavigator.js.map +1 -1
- package/dist/pds/components/PageNavigator.module.css +29 -0
- package/dist/pds/components/WizardQuestion.d.ts +29 -0
- package/dist/pds/components/WizardQuestion.d.ts.map +1 -0
- package/dist/pds/components/WizardQuestion.js +57 -0
- package/dist/pds/components/WizardQuestion.js.map +1 -0
- package/dist/pds/utils/deriveLiveDocState.d.ts +18 -0
- package/dist/pds/utils/deriveLiveDocState.d.ts.map +1 -0
- package/dist/pds/utils/deriveLiveDocState.js +20 -0
- package/dist/pds/utils/deriveLiveDocState.js.map +1 -0
- package/dist/server.d.ts +1 -2
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +1 -3
- package/dist/server.js.map +1 -1
- package/package.json +4 -2
- package/src/pds/theme/PuckEditorTheme.css +3 -1
- package/src/pds/theme/PuckEditorTheme.test.ts +4 -3
- package/dist/features/content-type-templates/editor/useTemplateEditor.d.ts +0 -20
- package/dist/features/content-type-templates/editor/useTemplateEditor.d.ts.map +0 -1
- package/dist/features/content-type-templates/editor/useTemplateEditor.js +0 -62
- package/dist/features/content-type-templates/editor/useTemplateEditor.js.map +0 -1
- package/dist/features/content-type-templates/ui/TemplateManagerOverlay.d.ts +0 -18
- package/dist/features/content-type-templates/ui/TemplateManagerOverlay.d.ts.map +0 -1
- package/dist/features/content-type-templates/ui/TemplateManagerOverlay.js +0 -167
- package/dist/features/content-type-templates/ui/TemplateManagerOverlay.js.map +0 -1
- package/dist/features/content-type-templates/ui/TemplatePinPanel.d.ts +0 -18
- package/dist/features/content-type-templates/ui/TemplatePinPanel.d.ts.map +0 -1
- package/dist/features/content-type-templates/ui/TemplatePinPanel.js +0 -11
- package/dist/features/content-type-templates/ui/TemplatePinPanel.js.map +0 -1
- package/dist/features/content-type-templates/ui/dataToTemplate.d.ts +0 -25
- package/dist/features/content-type-templates/ui/dataToTemplate.d.ts.map +0 -1
- package/dist/features/content-type-templates/ui/dataToTemplate.js +0 -37
- package/dist/features/content-type-templates/ui/dataToTemplate.js.map +0 -1
- package/dist/p1/editor/json-tree.d.ts +0 -6
- package/dist/p1/editor/json-tree.d.ts.map +0 -1
- package/dist/p1/editor/json-tree.js +0 -64
- package/dist/p1/editor/json-tree.js.map +0 -1
- package/dist/p1/pages/add-override-for-template.d.ts +0 -4
- package/dist/p1/pages/add-override-for-template.d.ts.map +0 -1
- package/dist/p1/pages/add-override-for-template.js +0 -47
- package/dist/p1/pages/add-override-for-template.js.map +0 -1
- package/dist/p1/pages/conflict-resolution-panel.d.ts +0 -17
- package/dist/p1/pages/conflict-resolution-panel.d.ts.map +0 -1
- package/dist/p1/pages/conflict-resolution-panel.js +0 -74
- package/dist/p1/pages/conflict-resolution-panel.js.map +0 -1
- package/dist/p1/pages/content-type-template-list.d.ts +0 -7
- package/dist/p1/pages/content-type-template-list.d.ts.map +0 -1
- package/dist/p1/pages/content-type-template-list.js +0 -108
- package/dist/p1/pages/content-type-template-list.js.map +0 -1
- package/dist/p1/pages/create-content-type-form.d.ts +0 -7
- package/dist/p1/pages/create-content-type-form.d.ts.map +0 -1
- package/dist/p1/pages/create-content-type-form.js +0 -102
- package/dist/p1/pages/create-content-type-form.js.map +0 -1
- package/dist/p1/pages/create-page-form.d.ts +0 -9
- package/dist/p1/pages/create-page-form.d.ts.map +0 -1
- package/dist/p1/pages/create-page-form.js +0 -87
- package/dist/p1/pages/create-page-form.js.map +0 -1
- package/dist/p1/pages/create-template-form.d.ts +0 -7
- package/dist/p1/pages/create-template-form.d.ts.map +0 -1
- package/dist/p1/pages/create-template-form.js +0 -82
- package/dist/p1/pages/create-template-form.js.map +0 -1
- package/dist/p1/pages/delete-row-button.d.ts +0 -7
- package/dist/p1/pages/delete-row-button.d.ts.map +0 -1
- package/dist/p1/pages/delete-row-button.js +0 -23
- package/dist/p1/pages/delete-row-button.js.map +0 -1
- package/dist/p1/pages/hooks.d.ts +0 -10
- package/dist/p1/pages/hooks.d.ts.map +0 -1
- package/dist/p1/pages/hooks.js +0 -66
- package/dist/p1/pages/hooks.js.map +0 -1
- package/dist/p1/pages/migration-conflict-queue.d.ts +0 -8
- package/dist/p1/pages/migration-conflict-queue.d.ts.map +0 -1
- package/dist/p1/pages/migration-conflict-queue.js +0 -62
- package/dist/p1/pages/migration-conflict-queue.js.map +0 -1
- package/dist/p1/pages/migration-preview-panel.d.ts +0 -12
- package/dist/p1/pages/migration-preview-panel.d.ts.map +0 -1
- package/dist/p1/pages/migration-preview-panel.js +0 -157
- package/dist/p1/pages/migration-preview-panel.js.map +0 -1
- package/dist/p1/pages/migration-status-panel.d.ts +0 -7
- package/dist/p1/pages/migration-status-panel.d.ts.map +0 -1
- package/dist/p1/pages/migration-status-panel.js +0 -198
- package/dist/p1/pages/migration-status-panel.js.map +0 -1
- package/dist/p1/pages/structure-page.d.ts +0 -2
- package/dist/p1/pages/structure-page.d.ts.map +0 -1
- package/dist/p1/pages/structure-page.js +0 -103
- package/dist/p1/pages/structure-page.js.map +0 -1
- package/dist/p1/pages/structure-tabs.d.ts +0 -11
- package/dist/p1/pages/structure-tabs.d.ts.map +0 -1
- package/dist/p1/pages/structure-tabs.js +0 -45
- package/dist/p1/pages/structure-tabs.js.map +0 -1
|
@@ -2,24 +2,45 @@
|
|
|
2
2
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useMemo } from "react";
|
|
4
4
|
import { isCanonicalTemplatePath } from "../../../data/route-templates";
|
|
5
|
-
import { JsonTree } from "../json-tree";
|
|
6
5
|
import { card, mono, muted, sectionLabel, } from "../../../data/styles";
|
|
7
6
|
import { RemoteDatasourceManager } from "./remote-datasource-manager";
|
|
8
7
|
import { TemplatePreviewParamsToolbar } from "./template-preview-params-toolbar";
|
|
9
|
-
const
|
|
8
|
+
const panelStyles = `
|
|
9
|
+
@keyframes p1-ds-pulse {
|
|
10
10
|
0%, 100% { opacity: 0.4; }
|
|
11
11
|
50% { opacity: 0.8; }
|
|
12
|
-
}
|
|
12
|
+
}
|
|
13
|
+
[data-p1-ds] > summary::marker,
|
|
14
|
+
[data-p1-ds] > summary::-webkit-details-marker { display: none; }
|
|
15
|
+
`;
|
|
16
|
+
/** Render a datasource value for the compact preview without ever producing
|
|
17
|
+
* "[object Object]": scalars print directly, objects/arrays serialize to JSON. */
|
|
18
|
+
function formatPreviewValue(value) {
|
|
19
|
+
if (value === null || value === undefined)
|
|
20
|
+
return "";
|
|
21
|
+
if (typeof value === "string" ||
|
|
22
|
+
typeof value === "number" ||
|
|
23
|
+
typeof value === "boolean") {
|
|
24
|
+
return String(value);
|
|
25
|
+
}
|
|
26
|
+
try {
|
|
27
|
+
return JSON.stringify(value) ?? "";
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
return Array.isArray(value) ? `[${value.length} items]` : "{…}";
|
|
31
|
+
}
|
|
32
|
+
}
|
|
13
33
|
function DatasourceSkeleton() {
|
|
14
|
-
return (
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
34
|
+
return (_jsx(_Fragment, { children: _jsx("div", { style: { display: "flex", flexDirection: "column", gap: 8, padding: "8px 0" }, children: [100, 80, 90, 60, 70].map((width, i) => (_jsx("div", { style: {
|
|
35
|
+
height: 12,
|
|
36
|
+
width: `${width}%`,
|
|
37
|
+
borderRadius: 4,
|
|
38
|
+
background: "var(--puck-color-grey-09, #d1d5db)",
|
|
39
|
+
animation: "p1-ds-pulse 1.5s ease-in-out infinite",
|
|
40
|
+
animationDelay: `${i * 0.15}s`,
|
|
41
|
+
} }, i))) }) }));
|
|
22
42
|
}
|
|
43
|
+
const dbIconSvg = (_jsxs("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [_jsx("path", { d: "M12 4c4.4 0 8 1.3 8 3s-3.6 3-8 3-8-1.3-8-3 3.6-3 8-3z" }), _jsx("path", { d: "M4 7v10c0 1.7 3.6 3 8 3s8-1.3 8-3V7" }), _jsx("path", { d: "M20 12c0 1.7-3.6 3-8 3s-8-1.3-8-3" })] }));
|
|
23
44
|
function RemoteDatasourceExplorerPanel({ snapshot, editorPath, routeTemplateKeys, savedPreviewParams, remoteDatasourceRegistry, loadingIds, }) {
|
|
24
45
|
const registry = useMemo(() => remoteDatasourceRegistry, [remoteDatasourceRegistry]);
|
|
25
46
|
return (_jsxs("div", { style: {
|
|
@@ -31,31 +52,72 @@ function RemoteDatasourceExplorerPanel({ snapshot, editorPath, routeTemplateKeys
|
|
|
31
52
|
lineHeight: 1.45,
|
|
32
53
|
maxHeight: "100%",
|
|
33
54
|
overflow: "auto",
|
|
34
|
-
}, children: [_jsx(TemplatePreviewParamsToolbar, { editorPath: editorPath, routeTemplateKeys: routeTemplateKeys, savedPreviewParams: savedPreviewParams }), _jsx(RemoteDatasourceManager, { editorPath: editorPath }), _jsxs("p", { style: { ...muted, margin: 0 }, children: ["Use ", _jsx("code", { style: mono, children: `{{ source.field }}` }), " in text fields; after ", _jsx("code", { style: mono, children: `{{` }), ", matching datasource paths are suggested automatically. Nested keys use dots, e.g.", " ", _jsx("code", { style: mono, children: `{{ source.nested.key }}` }), ". You can also call allowlisted helpers, e.g.", " ", _jsx("code", { style: mono, children: `{{ toUpperCase(source.field) }}` }), ",", " ", _jsx("code", { style: mono, children: `{{ replace(source.field, " ", "-") }}` }), ", or", " ", _jsx("code", { style: mono, children: `{{ default(source.field, "fallback") }}` }), ". Bare", " ", _jsx("code", { style: mono, children: `{{ source }}` }), " does not print the object (only strings, numbers, and booleans resolve to text). For list datasources, use", " ", _jsx("code", { style: mono, children: `{{ my_list.markdownLinks "/path/{id}" }}` }), " ", "in a ", _jsx("strong", { children: "List" }), " block's items field \u2014 each line becomes a markdown link. For Puck", " ", _jsx("code", { style: mono, children: "array" }), " fields, use", " ", _jsx("code", { style: mono, children: `{{ my_list.items }}` }), " to map list rows directly, then reference per-item values like", " ", _jsx("code", { style: mono, children: `{{ item.name }}` }), " and", " ", _jsx("code", { style: mono, children: `{{ item.id }}` }), " in item templates."] }), registry.map((def, index) => {
|
|
55
|
+
}, children: [_jsx("style", { children: panelStyles }), _jsx("p", { style: { ...muted, margin: 0 }, children: "Data sources enable you to organize your connected artifacts and integrate them into your page." }), _jsx(TemplatePreviewParamsToolbar, { editorPath: editorPath, routeTemplateKeys: routeTemplateKeys, savedPreviewParams: savedPreviewParams }), _jsx(RemoteDatasourceManager, { editorPath: editorPath }), _jsxs("p", { style: { ...muted, margin: 0 }, children: ["Use ", _jsx("code", { style: mono, children: `{{ source.field }}` }), " in text fields; after ", _jsx("code", { style: mono, children: `{{` }), ", matching datasource paths are suggested automatically. Nested keys use dots, e.g.", " ", _jsx("code", { style: mono, children: `{{ source.nested.key }}` }), ". You can also call allowlisted helpers, e.g.", " ", _jsx("code", { style: mono, children: `{{ toUpperCase(source.field) }}` }), ",", " ", _jsx("code", { style: mono, children: `{{ replace(source.field, " ", "-") }}` }), ", or", " ", _jsx("code", { style: mono, children: `{{ default(source.field, "fallback") }}` }), ". Bare", " ", _jsx("code", { style: mono, children: `{{ source }}` }), " does not print the object (only strings, numbers, and booleans resolve to text). For list datasources, use", " ", _jsx("code", { style: mono, children: `{{ my_list.markdownLinks "/path/{id}" }}` }), " ", "in a ", _jsx("strong", { children: "List" }), " block's items field \u2014 each line becomes a markdown link. For Puck", " ", _jsx("code", { style: mono, children: "array" }), " fields, use", " ", _jsx("code", { style: mono, children: `{{ my_list.items }}` }), " to map list rows directly, then reference per-item values like", " ", _jsx("code", { style: mono, children: `{{ item.name }}` }), " and", " ", _jsx("code", { style: mono, children: `{{ item.id }}` }), " in item templates."] }), registry.length > 0 && (_jsx("div", { style: { ...sectionLabel, padding: "4px 2px 6px" }, children: "Connected sources" })), registry.map((def, index) => {
|
|
35
56
|
const isLoading = loadingIds?.has(def.id) ?? false;
|
|
36
|
-
const live = snapshot[def.id] ?? {};
|
|
37
|
-
const
|
|
38
|
-
const empty =
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
57
|
+
const live = (snapshot[def.id] ?? {});
|
|
58
|
+
const liveKeys = Object.keys(live);
|
|
59
|
+
const empty = liveKeys.length === 0;
|
|
60
|
+
const firstField = def.fields[0]?.path ?? liveKeys[0] ?? "field";
|
|
61
|
+
return (_jsxs("details", { open: index === 0, "data-p1-ds": "", style: { ...card, background: "var(--puck-color-white, #fff)", borderRadius: 12, marginBottom: 8 }, children: [_jsx("summary", { style: { cursor: "pointer", listStyle: "none", display: "block" }, children: _jsxs("div", { style: {
|
|
62
|
+
padding: "10px 12px",
|
|
63
|
+
fontWeight: 600,
|
|
64
|
+
display: "flex",
|
|
65
|
+
flexDirection: "row",
|
|
66
|
+
alignItems: "center",
|
|
67
|
+
gap: 10,
|
|
68
|
+
}, children: [_jsx("span", { style: {
|
|
69
|
+
width: 34,
|
|
70
|
+
height: 34,
|
|
71
|
+
borderRadius: 9,
|
|
72
|
+
background: "var(--puck-color-azure-11, #eff6ff)",
|
|
73
|
+
display: "grid",
|
|
74
|
+
placeItems: "center",
|
|
75
|
+
color: "var(--puck-color-azure-04, #2563eb)",
|
|
76
|
+
flexShrink: 0,
|
|
77
|
+
}, children: dbIconSvg }), _jsxs("div", { style: { flex: 1, minWidth: 0 }, children: [_jsx("span", { style: { display: "block" }, children: def.label }), _jsxs("span", { style: {
|
|
78
|
+
...mono,
|
|
79
|
+
display: "block",
|
|
80
|
+
fontSize: 11,
|
|
81
|
+
fontWeight: 400,
|
|
82
|
+
color: "var(--puck-color-grey-04, #6b7280)",
|
|
83
|
+
}, children: [def.id, !empty && ` · ${liveKeys.length} keys`] })] })] }) }), _jsxs("div", { style: { padding: "4px 12px 12px" }, children: [def.fields.length > 0 && (_jsx("div", { style: { display: "flex", flexWrap: "wrap", gap: 5, marginBottom: 10 }, children: def.fields.map((f) => (_jsx("code", { title: f.description, style: {
|
|
84
|
+
...mono,
|
|
85
|
+
fontSize: 11,
|
|
86
|
+
fontWeight: 600,
|
|
87
|
+
color: "var(--puck-color-azure-04, #2563eb)",
|
|
88
|
+
background: "var(--puck-color-azure-11, #eff6ff)",
|
|
89
|
+
border: "1px solid var(--puck-color-grey-09, #bfdbfe)",
|
|
90
|
+
borderRadius: 6,
|
|
91
|
+
padding: "2px 7px",
|
|
92
|
+
cursor: "default",
|
|
93
|
+
}, children: f.path }, f.path))) })), isLoading ? (_jsx(DatasourceSkeleton, {})) : empty ? (_jsxs("p", { style: { margin: "0 0 10px", ...muted }, children: ["No data loaded. Open a concrete page instance or", " ", isCanonicalTemplatePath(editorPath, routeTemplateKeys) ? (_jsx(_Fragment, { children: "set preview values above." })) : (_jsx(_Fragment, { children: "edit a collection template row to set preview params." }))] })) : (_jsxs("div", { style: {
|
|
94
|
+
background: "var(--puck-color-grey-11, #f9fafb)",
|
|
95
|
+
border: "1px solid var(--puck-color-grey-09, #e5e7eb)",
|
|
96
|
+
borderRadius: 9,
|
|
97
|
+
padding: "6px 10px",
|
|
98
|
+
marginBottom: 10,
|
|
99
|
+
}, children: [liveKeys.slice(0, 3).map((key, i) => (_jsxs("div", { style: {
|
|
100
|
+
...mono,
|
|
101
|
+
fontSize: 11.5,
|
|
102
|
+
color: "var(--pds-color-fg-default-secondary, #4a4a4a)",
|
|
103
|
+
padding: "4px 0",
|
|
104
|
+
borderTop: i > 0 ? "1px solid var(--puck-color-grey-10, #f0f0f0)" : "none",
|
|
105
|
+
whiteSpace: "nowrap",
|
|
106
|
+
overflow: "hidden",
|
|
107
|
+
textOverflow: "ellipsis",
|
|
108
|
+
}, children: [_jsxs("span", { style: { ...muted, fontSize: 11 }, children: [key, ":"] }), " ", formatPreviewValue(live[key])] }, key))), liveKeys.length > 3 && (_jsxs("div", { style: {
|
|
109
|
+
...muted,
|
|
110
|
+
fontSize: 11,
|
|
111
|
+
padding: "4px 0 0",
|
|
112
|
+
borderTop: "1px solid var(--puck-color-grey-10, #f0f0f0)",
|
|
113
|
+
}, children: ["+", liveKeys.length - 3, " more"] }))] })), _jsx("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 8 }, children: _jsxs("span", { style: { ...muted, fontSize: 11 }, children: ["Reference as", " ", _jsx("code", { style: { ...mono, fontWeight: 600, color: "var(--puck-color-azure-04, #2563eb)", fontSize: 11 }, children: `{{ ${def.id}.${firstField} }}` })] }) }), _jsxs("details", { style: { marginTop: 10 }, children: [_jsx("summary", { style: { ...sectionLabel, cursor: "pointer", fontSize: 10 }, children: "More info" }), _jsx("p", { style: { margin: "6px 0 4px", ...muted }, children: def.description }), _jsxs("p", { style: { margin: "0 0 6px", ...muted }, children: [_jsx("strong", { style: { color: "inherit" }, children: "Loads when:" }), " ", def.resolution] }), _jsx("ul", { style: { margin: 0, paddingLeft: 16, ...muted }, children: def.fields.map((f) => (_jsxs("li", { style: { marginBottom: 4 }, children: [_jsx("code", { style: mono, children: `${def.id}.${f.path}` }), " \u2014 ", f.description] }, f.path))) })] })] })] }, def.id));
|
|
53
114
|
})] }));
|
|
54
115
|
}
|
|
55
116
|
export function createRemoteDatasourceExplorerPlugin(snapshot, options) {
|
|
56
117
|
return {
|
|
57
118
|
name: "datasource-explorer",
|
|
58
119
|
label: "Data sources",
|
|
120
|
+
icon: (_jsxs("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [_jsx("path", { d: "M12 4c4.4 0 8 1.3 8 3s-3.6 3-8 3-8-1.3-8-3 3.6-3 8-3z" }), _jsx("path", { d: "M4 7v10c0 1.7 3.6 3 8 3s8-1.3 8-3V7" }), _jsx("path", { d: "M20 12c0 1.7-3.6 3-8 3s-8-1.3-8-3" })] })),
|
|
59
121
|
render: () => (_jsx(RemoteDatasourceExplorerPanel, { snapshot: snapshot, editorPath: options.editorPath, routeTemplateKeys: options.routeTemplateKeys, savedPreviewParams: options.savedPreviewParams, remoteDatasourceRegistry: options.remoteDatasourceRegistry, loadingIds: options.loadingIds })),
|
|
60
122
|
};
|
|
61
123
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remote-datasource-explorer-plugin.js","sourceRoot":"","sources":["../../../../src/p1/editor/remote-datasources/remote-datasource-explorer-plugin.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAIhC,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,
|
|
1
|
+
{"version":3,"file":"remote-datasource-explorer-plugin.js","sourceRoot":"","sources":["../../../../src/p1/editor/remote-datasources/remote-datasource-explorer-plugin.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAIhC,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,EACL,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,YAAY,GACb,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AAEjF,MAAM,WAAW,GAAG;;;;;;;CAOnB,CAAC;AAEF;mFACmF;AACnF,SAAS,kBAAkB,CAAC,K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Q,EAClB,UAAU,EAAE,OAAO,CAAC,UAAU,EAC9B,iBAAiB,EAAE,OAAO,CAAC,iBAAiB,EAC5C,kBAAkB,EAAE,OAAO,CAAC,kBAAkB,EAC9C,wBAAwB,EAAE,OAAO,CAAC,wBAAwB,EAC1D,UAAU,EAAE,OAAO,CAAC,UAAU,GAC9B,CACH;KACF,CAAC;AACJ,CAAC"}
|
package/dist/p1/pages/index.d.ts
CHANGED
|
@@ -1,12 +1,2 @@
|
|
|
1
1
|
export { RenderClient } from "./render-client";
|
|
2
|
-
export { CreatePageForm } from "./create-page-form";
|
|
3
|
-
export { CreateTemplateForm } from "./create-template-form";
|
|
4
|
-
export { CreateContentTypeForm } from "./create-content-type-form";
|
|
5
|
-
export { AddOverrideForTemplate } from "./add-override-for-template";
|
|
6
|
-
export { DeleteStructureRowButton } from "./delete-row-button";
|
|
7
|
-
export { MigrationStatusPanel } from "./migration-status-panel";
|
|
8
|
-
export { MigrationConflictQueue } from "./migration-conflict-queue";
|
|
9
|
-
export { ConflictResolutionPanel } from "./conflict-resolution-panel";
|
|
10
|
-
export { MigrationPreviewPanel } from "./migration-preview-panel";
|
|
11
|
-
export { useCreateStructure, useDeleteStructurePage } from "./hooks";
|
|
12
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/p1/pages/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/p1/pages/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC"}
|
package/dist/p1/pages/index.js
CHANGED
|
@@ -1,12 +1,2 @@
|
|
|
1
1
|
export { RenderClient } from "./render-client";
|
|
2
|
-
export { CreatePageForm } from "./create-page-form";
|
|
3
|
-
export { CreateTemplateForm } from "./create-template-form";
|
|
4
|
-
export { CreateContentTypeForm } from "./create-content-type-form";
|
|
5
|
-
export { AddOverrideForTemplate } from "./add-override-for-template";
|
|
6
|
-
export { DeleteStructureRowButton } from "./delete-row-button";
|
|
7
|
-
export { MigrationStatusPanel } from "./migration-status-panel";
|
|
8
|
-
export { MigrationConflictQueue } from "./migration-conflict-queue";
|
|
9
|
-
export { ConflictResolutionPanel } from "./conflict-resolution-panel";
|
|
10
|
-
export { MigrationPreviewPanel } from "./migration-preview-panel";
|
|
11
|
-
export { useCreateStructure, useDeleteStructurePage } from "./hooks";
|
|
12
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/p1/pages/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/p1/pages/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CreatePageModal
|
|
3
|
+
*
|
|
4
|
+
* The "Create a new page" modal, opened from the PageNavigator's "+ New page".
|
|
5
|
+
* Single-screen design: pick a starting point, name the page (which derives the
|
|
6
|
+
* URL slug), optionally open an Advanced panel, then "Create page".
|
|
7
|
+
*
|
|
8
|
+
* NOTE: This uses a lightweight custom modal shell (backdrop + panel) rather
|
|
9
|
+
* than the PDS `Modal`. The PDS v2 `Modal` (through alpha.16) calls
|
|
10
|
+
* `useOverlayContext()` on every render, which throws unless an
|
|
11
|
+
* `OverlayContextProvider` is an ancestor — but that provider is not exported
|
|
12
|
+
* from the package, making `Modal` unusable here. Interactive fields use native
|
|
13
|
+
* inputs (the PDS TextInput/Textarea are not usable in this context either) and
|
|
14
|
+
* are styled with PDS design tokens.
|
|
15
|
+
*
|
|
16
|
+
* Phase 1 scope:
|
|
17
|
+
* - Starting points: "Blank page" is active; "Content type template" and
|
|
18
|
+
* "Generate with AI" are disabled; "New page template" is admin-only and
|
|
19
|
+
* disabled. Later phases enable the rest.
|
|
20
|
+
* - Page title auto-derives the slug until the slug is edited manually.
|
|
21
|
+
* - Slug is sanitized (lowercase, no spaces, no special characters).
|
|
22
|
+
* - The Advanced panel is rendered as designed but fully disabled.
|
|
23
|
+
* - "Create page" creates the page via onCreateDocument(slug, title); the
|
|
24
|
+
* title is persisted into the new page's root.props.title (see useDocuments).
|
|
25
|
+
*/
|
|
26
|
+
import React from 'react';
|
|
27
|
+
/**
|
|
28
|
+
* A content-type template as the modal consumes it. Intentionally a minimal,
|
|
29
|
+
* local shape (not the feature's full `Template` type) to keep this PDS
|
|
30
|
+
* component decoupled — the editor maps real templates into this on the way in.
|
|
31
|
+
*/
|
|
32
|
+
export interface CreatePageModalTemplate {
|
|
33
|
+
id: string;
|
|
34
|
+
/** Kebab identifier; shown when the template has no label. */
|
|
35
|
+
name: string;
|
|
36
|
+
label: string;
|
|
37
|
+
description?: string;
|
|
38
|
+
/** Route pattern whose `:params` become user-filled route inputs. */
|
|
39
|
+
defaultUrlPattern?: string;
|
|
40
|
+
version: number;
|
|
41
|
+
}
|
|
42
|
+
export interface CreatePageModalProps {
|
|
43
|
+
/** Whether the modal is open. */
|
|
44
|
+
open: boolean;
|
|
45
|
+
/** Called when the modal should close (close button, Cancel, backdrop, Escape, or success). */
|
|
46
|
+
onClose: () => void;
|
|
47
|
+
/**
|
|
48
|
+
* Called with the new page path and the entered page title when the user
|
|
49
|
+
* creates a page. When created from a content-type template, the template id
|
|
50
|
+
* is passed so the page is scaffolded from it and bound to it. Should resolve
|
|
51
|
+
* on success and reject with an Error whose message is shown on failure.
|
|
52
|
+
*/
|
|
53
|
+
onCreateDocument: (path: string, title: string, templateId?: string) => Promise<void>;
|
|
54
|
+
/**
|
|
55
|
+
* Whether the current user is an administrator. Reserved for gating admin-only
|
|
56
|
+
* options (e.g. "New page template") once permission checks are added — not
|
|
57
|
+
* enforced yet; admin-only tiles are currently shown to everyone.
|
|
58
|
+
*/
|
|
59
|
+
isAdmin?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Host shown as the URL-slug prefix and in the full-path preview (e.g. "example.com").
|
|
62
|
+
* TODO: source this from the site's domain once the css-client `Site` type / API
|
|
63
|
+
* exposes it (it currently does not). For now it defaults to the current window host.
|
|
64
|
+
*/
|
|
65
|
+
siteHost?: string;
|
|
66
|
+
/**
|
|
67
|
+
* Available data sources for the (exploratory) Dynamic route / collection builder
|
|
68
|
+
* dropdown — both user-defined and built-in. `inputs` are the param names the
|
|
69
|
+
* source expects (mocked for now); one input auto-generates the route param.
|
|
70
|
+
*/
|
|
71
|
+
datasources?: {
|
|
72
|
+
id: string;
|
|
73
|
+
label: string;
|
|
74
|
+
inputs?: string[];
|
|
75
|
+
}[];
|
|
76
|
+
/**
|
|
77
|
+
* Real content-type templates from the backend. The modal has NO built-in/fake
|
|
78
|
+
* list: when there are none (undefined or empty), the "Page type template"
|
|
79
|
+
* section shows an empty message — a customer running P1 with zero templates
|
|
80
|
+
* is a normal state. The "New template" action is always available.
|
|
81
|
+
*/
|
|
82
|
+
templates?: CreatePageModalTemplate[];
|
|
83
|
+
/**
|
|
84
|
+
* Create a new template from the "New template" screen. Receives the kebab
|
|
85
|
+
* `name`, `label`, and optional `description` / `defaultUrlPattern`. Should
|
|
86
|
+
* resolve with the created template (its `name` is used to open its editor).
|
|
87
|
+
*/
|
|
88
|
+
onCreateTemplate?: (params: {
|
|
89
|
+
name: string;
|
|
90
|
+
label: string;
|
|
91
|
+
description?: string;
|
|
92
|
+
defaultUrlPattern?: string;
|
|
93
|
+
}) => Promise<{
|
|
94
|
+
name: string;
|
|
95
|
+
} | undefined>;
|
|
96
|
+
/**
|
|
97
|
+
* Navigate the editor to an existing page path (no creation). Used by the
|
|
98
|
+
* collection recap's "Edit index page" / "Edit dynamic page" buttons.
|
|
99
|
+
*/
|
|
100
|
+
onNavigate?: (path: string) => void;
|
|
101
|
+
/**
|
|
102
|
+
* Initial screen when the modal opens. `'new-template'` lands directly on the
|
|
103
|
+
* New-template definition form (equivalent to choosing "From page template" →
|
|
104
|
+
* "+ New template"). `'page'` (default) shows the starting-point grid.
|
|
105
|
+
*/
|
|
106
|
+
initialMode?: 'page' | 'new-template';
|
|
107
|
+
}
|
|
108
|
+
export declare function CreatePageModal({ open, onClose, onCreateDocument, siteHost, datasources, templates, onCreateTemplate, onNavigate, initialMode, }: CreatePageModalProps): React.JSX.Element | null;
|
|
109
|
+
//# sourceMappingURL=CreatePageModal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CreatePageModal.d.ts","sourceRoot":"","sources":["../../../src/pds/components/CreatePageModal.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,KAA2C,MAAM,OAAO,CAAC;AAUhE;;;;GAIG;AACH,MAAM,WAAW,uBAAuB;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,8DAA8D;IAC9D,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qEAAqE;IACrE,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,oBAAoB;IACnC,iCAAiC;IACjC,IAAI,EAAE,OAAO,CAAC;IACd,+FAA+F;IAC/F,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB;;;;;OAKG;IACH,gBAAgB,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACtF;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM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