@kywi-software/core 0.11.0 → 0.12.1
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/AGENT-PATTERNS.md +96 -10
- package/dist/admin/content-form.d.ts.map +1 -1
- package/dist/admin/content-form.js +97 -10
- package/dist/admin/content-form.js.map +1 -1
- package/dist/admin/layout-editor/component-actions.d.ts +219 -22
- package/dist/admin/layout-editor/component-actions.d.ts.map +1 -1
- package/dist/admin/layout-editor/component-actions.js +356 -36
- package/dist/admin/layout-editor/component-actions.js.map +1 -1
- package/dist/admin/layout-editor/component-fork.d.ts +224 -0
- package/dist/admin/layout-editor/component-fork.d.ts.map +1 -0
- package/dist/admin/layout-editor/component-fork.js +342 -0
- package/dist/admin/layout-editor/component-fork.js.map +1 -0
- package/dist/admin/layout-editor/editor-canvas.d.ts +12 -0
- package/dist/admin/layout-editor/editor-canvas.d.ts.map +1 -1
- package/dist/admin/layout-editor/editor-canvas.js +76 -12
- package/dist/admin/layout-editor/editor-canvas.js.map +1 -1
- package/dist/admin/layout-editor/editor-dialog.d.ts +164 -0
- package/dist/admin/layout-editor/editor-dialog.d.ts.map +1 -0
- package/dist/admin/layout-editor/editor-dialog.js +195 -0
- package/dist/admin/layout-editor/editor-dialog.js.map +1 -0
- package/dist/admin/layout-editor/editor-state.d.ts +76 -0
- package/dist/admin/layout-editor/editor-state.d.ts.map +1 -1
- package/dist/admin/layout-editor/editor-state.js +47 -1
- package/dist/admin/layout-editor/editor-state.js.map +1 -1
- package/dist/admin/layout-editor/editor.css +279 -2
- package/dist/admin/layout-editor/index.d.ts +10 -1
- package/dist/admin/layout-editor/index.d.ts.map +1 -1
- package/dist/admin/layout-editor/index.js +11 -1
- package/dist/admin/layout-editor/index.js.map +1 -1
- package/dist/admin/layout-editor/layout-editor.d.ts +58 -1
- package/dist/admin/layout-editor/layout-editor.d.ts.map +1 -1
- package/dist/admin/layout-editor/layout-editor.js +161 -190
- package/dist/admin/layout-editor/layout-editor.js.map +1 -1
- package/dist/admin/layout-editor/linked-component.d.ts +38 -0
- package/dist/admin/layout-editor/linked-component.d.ts.map +1 -0
- package/dist/admin/layout-editor/linked-component.js +42 -0
- package/dist/admin/layout-editor/linked-component.js.map +1 -0
- package/dist/admin/layout-editor/module-overlay.d.ts +10 -1
- package/dist/admin/layout-editor/module-overlay.d.ts.map +1 -1
- package/dist/admin/layout-editor/module-overlay.js +33 -4
- package/dist/admin/layout-editor/module-overlay.js.map +1 -1
- package/dist/admin/layout-editor/node-lookup.d.ts +34 -0
- package/dist/admin/layout-editor/node-lookup.d.ts.map +1 -1
- package/dist/admin/layout-editor/node-lookup.js +90 -0
- package/dist/admin/layout-editor/node-lookup.js.map +1 -1
- package/dist/admin/layout-editor/overlay-shell.d.ts.map +1 -1
- package/dist/admin/layout-editor/overlay-shell.js +114 -23
- package/dist/admin/layout-editor/overlay-shell.js.map +1 -1
- package/dist/admin/layout-editor/props-panel.d.ts +55 -1
- package/dist/admin/layout-editor/props-panel.d.ts.map +1 -1
- package/dist/admin/layout-editor/props-panel.js +118 -9
- package/dist/admin/layout-editor/props-panel.js.map +1 -1
- package/dist/admin/layout-editor/section-overlay.d.ts +9 -1
- package/dist/admin/layout-editor/section-overlay.d.ts.map +1 -1
- package/dist/admin/layout-editor/section-overlay.js +14 -4
- package/dist/admin/layout-editor/section-overlay.js.map +1 -1
- package/dist/admin/layout-editor/section-template-picker.d.ts +27 -1
- package/dist/admin/layout-editor/section-template-picker.d.ts.map +1 -1
- package/dist/admin/layout-editor/section-template-picker.js +71 -17
- package/dist/admin/layout-editor/section-template-picker.js.map +1 -1
- package/dist/admin/layout-editor/use-component-connect.d.ts +65 -0
- package/dist/admin/layout-editor/use-component-connect.d.ts.map +1 -0
- package/dist/admin/layout-editor/use-component-connect.js +294 -0
- package/dist/admin/layout-editor/use-component-connect.js.map +1 -0
- package/dist/admin/layout-editor/use-component-fork.d.ts +123 -0
- package/dist/admin/layout-editor/use-component-fork.d.ts.map +1 -0
- package/dist/admin/layout-editor/use-component-fork.js +346 -0
- package/dist/admin/layout-editor/use-component-fork.js.map +1 -0
- package/dist/admin/layout-editor/use-component-library.d.ts +94 -0
- package/dist/admin/layout-editor/use-component-library.d.ts.map +1 -0
- package/dist/admin/layout-editor/use-component-library.js +55 -0
- package/dist/admin/layout-editor/use-component-library.js.map +1 -0
- package/dist/admin/registry.d.ts +11 -2
- package/dist/admin/registry.d.ts.map +1 -1
- package/dist/admin/registry.js +40 -4
- package/dist/admin/registry.js.map +1 -1
- package/dist/admin/server.d.ts +1 -0
- package/dist/admin/server.d.ts.map +1 -1
- package/dist/admin/server.js +5 -0
- package/dist/admin/server.js.map +1 -1
- package/dist/admin/styles/admin.css +43 -0
- package/dist/admin/surfaces/components/component-edit.d.ts +3 -0
- package/dist/admin/surfaces/components/component-edit.d.ts.map +1 -0
- package/dist/admin/surfaces/components/component-edit.js +235 -0
- package/dist/admin/surfaces/components/component-edit.js.map +1 -0
- package/dist/admin/surfaces/components/components-data.d.ts +153 -0
- package/dist/admin/surfaces/components/components-data.d.ts.map +1 -0
- package/dist/admin/surfaces/components/components-data.js +154 -0
- package/dist/admin/surfaces/components/components-data.js.map +1 -0
- package/dist/admin/surfaces/components/components-list.d.ts +3 -0
- package/dist/admin/surfaces/components/components-list.d.ts.map +1 -0
- package/dist/admin/surfaces/components/components-list.js +196 -0
- package/dist/admin/surfaces/components/components-list.js.map +1 -0
- package/dist/admin/surfaces/components/definition-canvas.d.ts +73 -0
- package/dist/admin/surfaces/components/definition-canvas.d.ts.map +1 -0
- package/dist/admin/surfaces/components/definition-canvas.js +207 -0
- package/dist/admin/surfaces/components/definition-canvas.js.map +1 -0
- package/dist/admin/surfaces/layouts/layout-editor-client.d.ts.map +1 -1
- package/dist/admin/surfaces/layouts/layout-editor-client.js +14 -2
- package/dist/admin/surfaces/layouts/layout-editor-client.js.map +1 -1
- package/dist/admin/surfaces/layouts/layouts-data.d.ts +3 -14
- package/dist/admin/surfaces/layouts/layouts-data.d.ts.map +1 -1
- package/dist/admin/surfaces/layouts/layouts-data.js +4 -7
- package/dist/admin/surfaces/layouts/layouts-data.js.map +1 -1
- package/dist/admin/surfaces/layouts/layouts-list.d.ts.map +1 -1
- package/dist/admin/surfaces/layouts/layouts-list.js +16 -22
- package/dist/admin/surfaces/layouts/layouts-list.js.map +1 -1
- package/dist/admin/surfaces/settings/admin-features.d.ts.map +1 -1
- package/dist/admin/surfaces/settings/admin-features.js +1 -0
- package/dist/admin/surfaces/settings/admin-features.js.map +1 -1
- package/dist/api/bulk-routes.d.ts.map +1 -1
- package/dist/api/bulk-routes.js +25 -0
- package/dist/api/bulk-routes.js.map +1 -1
- package/dist/api/changeset-routes.d.ts.map +1 -1
- package/dist/api/changeset-routes.js +17 -3
- package/dist/api/changeset-routes.js.map +1 -1
- package/dist/api/component-routes.d.ts.map +1 -1
- package/dist/api/component-routes.js +228 -8
- package/dist/api/component-routes.js.map +1 -1
- package/dist/api/content-routes.d.ts.map +1 -1
- package/dist/api/content-routes.js +64 -0
- package/dist/api/content-routes.js.map +1 -1
- package/dist/api/feed-routes.d.ts +6 -6
- package/dist/api/graphql/resolvers.d.ts +4 -4
- package/dist/api/layout-routes.d.ts.map +1 -1
- package/dist/api/layout-routes.js +4 -17
- package/dist/api/layout-routes.js.map +1 -1
- package/dist/api/layout-write-guard.d.ts +80 -0
- package/dist/api/layout-write-guard.d.ts.map +1 -0
- package/dist/api/layout-write-guard.js +88 -0
- package/dist/api/layout-write-guard.js.map +1 -0
- package/dist/api/section-template-routes.d.ts.map +1 -1
- package/dist/api/section-template-routes.js +11 -0
- package/dist/api/section-template-routes.js.map +1 -1
- package/dist/api/translation-routes.d.ts.map +1 -1
- package/dist/api/translation-routes.js +8 -0
- package/dist/api/translation-routes.js.map +1 -1
- package/dist/api/version-routes.d.ts.map +1 -1
- package/dist/api/version-routes.js +20 -8
- package/dist/api/version-routes.js.map +1 -1
- package/dist/api/workflow-routes.d.ts.map +1 -1
- package/dist/api/workflow-routes.js +53 -8
- package/dist/api/workflow-routes.js.map +1 -1
- package/dist/db/analytics-queries.d.ts +3 -3
- package/dist/db/apply-snapshot.d.ts +75 -8
- package/dist/db/apply-snapshot.d.ts.map +1 -1
- package/dist/db/apply-snapshot.js +104 -8
- package/dist/db/apply-snapshot.js.map +1 -1
- package/dist/db/audit-queries.d.ts +12 -12
- package/dist/db/category-queries.d.ts +3 -3
- package/dist/db/changeset-audit-queries.d.ts +4 -4
- package/dist/db/changeset-queries.d.ts +7 -7
- package/dist/db/comment-queries.d.ts +8 -8
- package/dist/db/comment-subscription-queries.d.ts +2 -2
- package/dist/db/component-instance-queries.d.ts +197 -0
- package/dist/db/component-instance-queries.d.ts.map +1 -0
- package/dist/db/component-instance-queries.js +405 -0
- package/dist/db/component-instance-queries.js.map +1 -0
- package/dist/db/content-queries.d.ts.map +1 -1
- package/dist/db/content-queries.js +39 -2
- package/dist/db/content-queries.js.map +1 -1
- package/dist/db/extension-queries.d.ts +7 -7
- package/dist/db/feed-queries.d.ts +3 -3
- package/dist/db/index.d.ts +1 -0
- package/dist/db/index.d.ts.map +1 -1
- package/dist/db/index.js +1 -0
- package/dist/db/index.js.map +1 -1
- package/dist/db/layout-queries.d.ts +13 -1
- package/dist/db/layout-queries.d.ts.map +1 -1
- package/dist/db/layout-queries.js +52 -7
- package/dist/db/layout-queries.js.map +1 -1
- package/dist/db/locale-queries.d.ts.map +1 -1
- package/dist/db/locale-queries.js +0 -0
- package/dist/db/locale-queries.js.map +1 -1
- package/dist/db/media-queries.d.ts +12 -12
- package/dist/db/revision-queries.d.ts +3 -3
- package/dist/db/site-admin-queries.d.ts +2 -2
- package/dist/db/site-membership-queries.d.ts +3 -3
- package/dist/db/site-plugin-queries.d.ts +2 -2
- package/dist/db/site-queries.d.ts +6 -6
- package/dist/db/version-queries.d.ts +12 -12
- package/dist/db/webhook-queries.d.ts +11 -11
- package/dist/db/workflow-queries.d.ts +6 -6
- package/dist/db/workflow-queries.d.ts.map +1 -1
- package/dist/db/workflow-queries.js +11 -2
- package/dist/db/workflow-queries.js.map +1 -1
- package/dist/layout/component-refs.d.ts +465 -0
- package/dist/layout/component-refs.d.ts.map +1 -0
- package/dist/layout/component-refs.js +848 -0
- package/dist/layout/component-refs.js.map +1 -0
- package/dist/layout/index.d.ts +2 -1
- package/dist/layout/index.d.ts.map +1 -1
- package/dist/layout/index.js +1 -0
- package/dist/layout/index.js.map +1 -1
- package/dist/layout/module-permissions.d.ts +49 -1
- package/dist/layout/module-permissions.d.ts.map +1 -1
- package/dist/layout/module-permissions.js +117 -6
- package/dist/layout/module-permissions.js.map +1 -1
- package/dist/layout/renderer.d.ts +51 -4
- package/dist/layout/renderer.d.ts.map +1 -1
- package/dist/layout/renderer.js +36 -38
- package/dist/layout/renderer.js.map +1 -1
- package/dist/layout/types.d.ts +42 -0
- package/dist/layout/types.d.ts.map +1 -1
- package/dist/layout/types.js +54 -11
- package/dist/layout/types.js.map +1 -1
- package/dist/schema/base.d.ts +1 -1
- package/dist/schema/components.d.ts +150 -0
- package/dist/schema/components.d.ts.map +1 -1
- package/dist/schema/components.js +50 -4
- package/dist/schema/components.js.map +1 -1
- package/dist/versioning/scheduler.d.ts +8 -0
- package/dist/versioning/scheduler.d.ts.map +1 -1
- package/dist/versioning/scheduler.js +21 -7
- package/dist/versioning/scheduler.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useEffect, useState } from 'react';
|
|
3
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
4
4
|
import { SECTION_TEMPLATES } from './drag-utils.js';
|
|
5
5
|
import { adminFetch } from '../../host-client/index.js';
|
|
6
6
|
import { isLayoutSection } from '../../layout/types.js';
|
|
7
|
-
import { buildConnectedSectionNode } from './component-actions.js';
|
|
7
|
+
import { buildConnectedSectionNode, buildConnectedVariantContainerNode, } from './component-actions.js';
|
|
8
8
|
/** Flatten a saved layout document to its top-level LayoutSections (across every
|
|
9
9
|
* region, in order). VariantContainers are skipped — only plain sections apply. */
|
|
10
10
|
function layoutToSections(def) {
|
|
@@ -12,9 +12,28 @@ function layoutToSections(def) {
|
|
|
12
12
|
return [];
|
|
13
13
|
return Object.values(def.regions).flat().filter(isLayoutSection);
|
|
14
14
|
}
|
|
15
|
-
|
|
15
|
+
/** Component rows → insertable linked sections, dropping anything that isn't one. */
|
|
16
|
+
function toSectionOptions(rows) {
|
|
17
|
+
return rows
|
|
18
|
+
.map(row => {
|
|
19
|
+
const section = buildConnectedSectionNode(row);
|
|
20
|
+
return section ? { id: row.id, name: row.name, section } : null;
|
|
21
|
+
})
|
|
22
|
+
.filter((row) => row !== null);
|
|
23
|
+
}
|
|
24
|
+
/** The container equivalent — a fresh experiment binding per placement. */
|
|
25
|
+
function toContainerOptions(rows) {
|
|
26
|
+
return rows
|
|
27
|
+
.map(row => {
|
|
28
|
+
const container = buildConnectedVariantContainerNode(row);
|
|
29
|
+
return container ? { id: row.id, name: row.name, container } : null;
|
|
30
|
+
})
|
|
31
|
+
.filter((row) => row !== null);
|
|
32
|
+
}
|
|
33
|
+
export function SectionTemplatePicker({ onSelect, onApplyLayout, onInsertComponent, onInsertVariantContainer, componentLibrary, onClose, }) {
|
|
16
34
|
const [savedLayouts, setSavedLayouts] = useState([]);
|
|
17
|
-
const [
|
|
35
|
+
const [fetchedSections, setFetchedSections] = useState([]);
|
|
36
|
+
const [fetchedContainers, setFetchedContainers] = useState([]);
|
|
18
37
|
// Load saved layouts (stored as full LayoutDocuments under /section-templates).
|
|
19
38
|
// Best-effort: a load failure just leaves the saved-layouts group empty, so the
|
|
20
39
|
// 7 built-in presets always remain available.
|
|
@@ -40,11 +59,13 @@ export function SectionTemplatePicker({ onSelect, onApplyLayout, onInsertCompone
|
|
|
40
59
|
.catch(() => { });
|
|
41
60
|
return () => { cancelled = true; };
|
|
42
61
|
}, [onApplyLayout]);
|
|
43
|
-
//
|
|
44
|
-
//
|
|
45
|
-
//
|
|
62
|
+
// Reusable section components (kywi-cms#69). Each becomes an insertable *linked*
|
|
63
|
+
// section (buildConnectedSectionNode stamps its componentId). Fetched ONLY when
|
|
64
|
+
// the caller has no library to hand (see `componentLibrary`) — best-effort
|
|
65
|
+
// either way, so a load failure just leaves the group empty and the 7 presets
|
|
66
|
+
// available.
|
|
46
67
|
useEffect(() => {
|
|
47
|
-
if (!onInsertComponent)
|
|
68
|
+
if (!onInsertComponent || componentLibrary)
|
|
48
69
|
return;
|
|
49
70
|
let cancelled = false;
|
|
50
71
|
adminFetch('/api/v1/components?type=section')
|
|
@@ -52,17 +73,46 @@ export function SectionTemplatePicker({ onSelect, onApplyLayout, onInsertCompone
|
|
|
52
73
|
.then((body) => {
|
|
53
74
|
if (cancelled)
|
|
54
75
|
return;
|
|
55
|
-
|
|
56
|
-
.map(row => {
|
|
57
|
-
const section = buildConnectedSectionNode(row);
|
|
58
|
-
return section ? { id: row.id, name: row.name, section } : null;
|
|
59
|
-
})
|
|
60
|
-
.filter((row) => row !== null);
|
|
61
|
-
setSectionComponents(rows);
|
|
76
|
+
setFetchedSections(toSectionOptions(body.data ?? []));
|
|
62
77
|
})
|
|
63
78
|
.catch(() => { });
|
|
64
79
|
return () => { cancelled = true; };
|
|
65
|
-
}, [onInsertComponent]);
|
|
80
|
+
}, [onInsertComponent, componentLibrary]);
|
|
81
|
+
// Container components (kywi-cms#147), the same shape one level up: each
|
|
82
|
+
// becomes an insertable LINKED container (buildConnectedVariantContainerNode
|
|
83
|
+
// stamps its componentId and mints a fresh experiment binding for an A/B one,
|
|
84
|
+
// so a second placement never reports into the first placement's experiment).
|
|
85
|
+
useEffect(() => {
|
|
86
|
+
if (!onInsertVariantContainer || componentLibrary)
|
|
87
|
+
return;
|
|
88
|
+
let cancelled = false;
|
|
89
|
+
adminFetch('/api/v1/components?type=variantContainer')
|
|
90
|
+
.then(r => (r.ok ? r.json() : Promise.reject(new Error(String(r.status)))))
|
|
91
|
+
.then((body) => {
|
|
92
|
+
if (cancelled)
|
|
93
|
+
return;
|
|
94
|
+
setFetchedContainers(toContainerOptions(body.data ?? []));
|
|
95
|
+
})
|
|
96
|
+
.catch(() => { });
|
|
97
|
+
return () => { cancelled = true; };
|
|
98
|
+
}, [onInsertVariantContainer, componentLibrary]);
|
|
99
|
+
// The rows on offer: the caller's library when there is one, otherwise what was
|
|
100
|
+
// fetched above. Each group stays empty without its insert handler — a row that
|
|
101
|
+
// cannot be inserted is not an offer.
|
|
102
|
+
const sectionComponents = useMemo(() => {
|
|
103
|
+
if (!onInsertComponent)
|
|
104
|
+
return [];
|
|
105
|
+
if (!componentLibrary)
|
|
106
|
+
return fetchedSections;
|
|
107
|
+
return toSectionOptions(componentLibrary.filter(c => c.type === 'section'));
|
|
108
|
+
}, [onInsertComponent, componentLibrary, fetchedSections]);
|
|
109
|
+
const containerComponents = useMemo(() => {
|
|
110
|
+
if (!onInsertVariantContainer)
|
|
111
|
+
return [];
|
|
112
|
+
if (!componentLibrary)
|
|
113
|
+
return fetchedContainers;
|
|
114
|
+
return toContainerOptions(componentLibrary.filter(c => c.type === 'variantContainer'));
|
|
115
|
+
}, [onInsertVariantContainer, componentLibrary, fetchedContainers]);
|
|
66
116
|
function handleOverlayClick(e) {
|
|
67
117
|
// Only close when clicking the backdrop itself, not children
|
|
68
118
|
if (e.target === e.currentTarget) {
|
|
@@ -81,9 +131,13 @@ export function SectionTemplatePicker({ onSelect, onApplyLayout, onInsertCompone
|
|
|
81
131
|
onInsertComponent?.(option.section);
|
|
82
132
|
onClose();
|
|
83
133
|
}
|
|
134
|
+
function handleInsertContainer(option) {
|
|
135
|
+
onInsertVariantContainer?.(option.container);
|
|
136
|
+
onClose();
|
|
137
|
+
}
|
|
84
138
|
return (_jsx("div", { className: "kywi-editor-template-overlay", onClick: handleOverlayClick, children: _jsxs("div", { className: "kywi-editor-template-modal", children: [_jsx("div", { className: "kywi-editor-template-modal-header", children: _jsx("span", { className: "kywi-editor-template-modal-title", children: "Choose Section Layout" }) }), _jsx("div", { className: "kywi-editor-template-grid", children: SECTION_TEMPLATES.map((template) => (
|
|
85
139
|
// kywi-cms#49: rendered inside the page editor's <form> — needs an
|
|
86
140
|
// explicit type="button" or it defaults to type="submit".
|
|
87
|
-
_jsxs("button", { type: "button", className: "kywi-editor-template-option", onClick: () => handleOptionClick(template.columns), children: [_jsx("div", { className: "kywi-editor-template-preview", children: template.columns.map((width, idx) => (_jsx("div", { className: "kywi-editor-template-col", style: { flexGrow: width, flexShrink: 1, flexBasis: 0 } }, idx))) }), _jsx("div", { className: "kywi-editor-template-label", children: template.label })] }, template.label))) }), onApplyLayout && savedLayouts.length > 0 && (_jsxs("div", { className: "kywi-editor-template-saved", children: [_jsx("div", { className: "kywi-editor-template-modal-subtitle", children: "Saved Layouts" }), _jsx("div", { className: "kywi-editor-template-saved-list", children: savedLayouts.map((option) => (_jsxs("button", { type: "button", className: "kywi-editor-template-saved-option", "data-saved-layout-id": option.id, onClick: () => handleApply(option), children: [_jsx("span", { className: "kywi-editor-template-saved-name", children: option.name }), _jsxs("span", { className: "kywi-editor-template-saved-meta", children: [option.category, " \u00B7 ", option.sections.length, " section", option.sections.length === 1 ? '' : 's'] })] }, option.id))) })] })),
|
|
141
|
+
_jsxs("button", { type: "button", className: "kywi-editor-template-option", onClick: () => handleOptionClick(template.columns), children: [_jsx("div", { className: "kywi-editor-template-preview", children: template.columns.map((width, idx) => (_jsx("div", { className: "kywi-editor-template-col", style: { flexGrow: width, flexShrink: 1, flexBasis: 0 } }, idx))) }), _jsx("div", { className: "kywi-editor-template-label", children: template.label })] }, template.label))) }), onApplyLayout && savedLayouts.length > 0 && (_jsxs("div", { className: "kywi-editor-template-saved", children: [_jsx("div", { className: "kywi-editor-template-modal-subtitle", children: "Saved Layouts" }), _jsx("div", { className: "kywi-editor-template-saved-list", children: savedLayouts.map((option) => (_jsxs("button", { type: "button", className: "kywi-editor-template-saved-option", "data-saved-layout-id": option.id, onClick: () => handleApply(option), children: [_jsx("span", { className: "kywi-editor-template-saved-name", children: option.name }), _jsxs("span", { className: "kywi-editor-template-saved-meta", children: [option.category, " \u00B7 ", option.sections.length, " section", option.sections.length === 1 ? '' : 's'] })] }, option.id))) })] })), sectionComponents.length + containerComponents.length > 0 && (_jsxs("div", { className: "kywi-editor-template-saved", children: [_jsx("div", { className: "kywi-editor-template-modal-subtitle", children: "Components" }), _jsxs("div", { className: "kywi-editor-template-saved-list", children: [sectionComponents.map((option) => (_jsxs("button", { type: "button", className: "kywi-editor-template-saved-option kywi-editor-template-component-option", "data-section-component-id": option.id, onClick: () => handleInsertComponent(option), children: [_jsx("span", { className: "kywi-editor-template-saved-name", children: option.name }), _jsx("span", { className: "kywi-editor-template-saved-meta", children: "Linked \u00B7 stays in sync with the source" })] }, option.id))), containerComponents.map((option) => (_jsxs("button", { type: "button", className: "kywi-editor-template-saved-option kywi-editor-template-component-option", "data-container-component-id": option.id, onClick: () => handleInsertContainer(option), children: [_jsx("span", { className: "kywi-editor-template-saved-name", children: option.name }), _jsxs("span", { className: "kywi-editor-template-saved-meta", children: ["Linked \u00B7 ", option.container.mode === 'ab_test' ? 'A/B tested' : 'personalized', " band"] })] }, option.id)))] })] }))] }) }));
|
|
88
142
|
}
|
|
89
143
|
//# sourceMappingURL=section-template-picker.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"section-template-picker.js","sourceRoot":"","sources":["../../../src/admin/layout-editor/section-template-picker.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AACZ,OAAc,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"section-template-picker.js","sourceRoot":"","sources":["../../../src/admin/layout-editor/section-template-picker.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AACZ,OAAc,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC3D,OAAO,EAAE,i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M,GAAG,mBAAmB,CAAC,MAAM,GAAG,CAAC,IAAI,CAC5D,eAAK,SAAS,EAAC,4BAA4B,aACzC,cAAK,SAAS,EAAC,qCAAqC,2BAAiB,EACrE,eAAK,SAAS,EAAC,iCAAiC,aAC7C,iBAAiB,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CACjC,kBAEE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,yEAAyE,+BACxD,MAAM,CAAC,EAAE,EACpC,OAAO,EAAE,GAAG,EAAE,CAAC,qBAAqB,CAAC,MAAM,CAAC,aAE5C,eAAM,SAAS,EAAC,iCAAiC,YAAE,MAAM,CAAC,IAAI,GAAQ,EACtE,eAAM,SAAS,EAAC,iCAAiC,4DAE1C,KATF,MAAM,CAAC,EAAE,CAUP,CACV,CAAC,EACD,mBAAmB,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CACnC,kBAEE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,yEAAyE,iCACtD,MAAM,CAAC,EAAE,EACtC,OAAO,EAAE,GAAG,EAAE,CAAC,qBAAqB,CAAC,MAAM,CAAC,aAE5C,eAAM,SAAS,EAAC,iCAAiC,YAAE,MAAM,CAAC,IAAI,GAAQ,EACtE,gBAAM,SAAS,EAAC,iCAAiC,+BACrC,MAAM,CAAC,SAAS,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,cAAc,aACxE,KATF,MAAM,CAAC,EAAE,CAUP,CACV,CAAC,IACE,IACF,CACP,IACG,GACF,CACP,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { LayoutDocument } from '../../layout/types.js';
|
|
3
|
+
import type { EditorAction } from './editor-state.js';
|
|
4
|
+
import type { ComponentAffordances } from './linked-component.js';
|
|
5
|
+
import type { ComponentLibrary } from './use-component-library.js';
|
|
6
|
+
/**
|
|
7
|
+
* use-component-connect.tsx
|
|
8
|
+
* The save-as-component → POST → connect-in-place flow, and detach, for BOTH
|
|
9
|
+
* editor shells (kywi-cms#147).
|
|
10
|
+
*
|
|
11
|
+
* This is one implementation on purpose. The admin Layout tab already had two
|
|
12
|
+
* near-copies of the flow (one for modules, one for sections), each with its own
|
|
13
|
+
* `window.prompt`, its own fetch and its own error swallowing, and the overlay
|
|
14
|
+
* shell had none — so adding containers would have made six. The shells now
|
|
15
|
+
* differ only in where they render the dialog and which selection they hand in.
|
|
16
|
+
*/
|
|
17
|
+
interface ComponentConnectArgs {
|
|
18
|
+
layout: LayoutDocument;
|
|
19
|
+
dispatch: React.Dispatch<EditorAction>;
|
|
20
|
+
library: ComponentLibrary;
|
|
21
|
+
}
|
|
22
|
+
export interface ComponentConnect {
|
|
23
|
+
/**
|
|
24
|
+
* Linked-instance pill naming for `EditorCanvas` (stable reference — it is
|
|
25
|
+
* memoized). No longer carries chrome save actions (kywi-cms#159) — see
|
|
26
|
+
* `saveModule` / `saveSection` / `saveVariantContainer` below for those.
|
|
27
|
+
*/
|
|
28
|
+
affordances: ComponentAffordances;
|
|
29
|
+
/** The open save dialog, or null. Render anywhere: it portals to the body. */
|
|
30
|
+
dialog: React.ReactNode;
|
|
31
|
+
saveModule: (moduleId: string) => void;
|
|
32
|
+
saveSection: (sectionId: string) => void;
|
|
33
|
+
saveVariantContainer: (containerId: string) => void;
|
|
34
|
+
detachModule: (moduleId: string) => void;
|
|
35
|
+
detachSection: (sectionId: string) => void;
|
|
36
|
+
detachVariantContainer: (containerId: string) => void;
|
|
37
|
+
/** Point an unlinked `component` placeholder node at a saved component. */
|
|
38
|
+
linkModule: (moduleId: string, componentId: string) => void;
|
|
39
|
+
/**
|
|
40
|
+
* Does this node live inside ANOTHER node's linked component instance?
|
|
41
|
+
*
|
|
42
|
+
* Every component action is refused there (the reasoning is at
|
|
43
|
+
* `isInsideLinkedComponent` below, and at `findLinkedAncestor`), and a refusal
|
|
44
|
+
* the owner can click is worse than one they never see — so the
|
|
45
|
+
* surfaces that offer those actions ask this and simply do not offer them. The
|
|
46
|
+
* canvas threads the same fact down its own tree (`linkedAncestor`); the props
|
|
47
|
+
* rail, which addresses whatever is selected, asks here.
|
|
48
|
+
*/
|
|
49
|
+
isInsideLinkedComponent: (nodeId: string) => boolean;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* The server's own words for a refused component write, details included.
|
|
53
|
+
*
|
|
54
|
+
* `readError` (host-client) reports only `error.message`, which for a rejected
|
|
55
|
+
* definition is the generic "Validation failed" — the useful half is in
|
|
56
|
+
* `details[]` ("A component definition may not link to another component…").
|
|
57
|
+
* The owner is looking at a dialog they cannot get past, so they get the reason.
|
|
58
|
+
*
|
|
59
|
+
* Shared with the save fork (`use-component-fork.tsx`), which puts a refused
|
|
60
|
+
* definition PUT in front of the owner for the same reason.
|
|
61
|
+
*/
|
|
62
|
+
export declare function componentErrorMessage(res: Response): Promise<string>;
|
|
63
|
+
export declare function useComponentConnect({ layout, dispatch, library, }: ComponentConnectArgs): ComponentConnect;
|
|
64
|
+
export {};
|
|
65
|
+
//# sourceMappingURL=use-component-connect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-component-connect.d.ts","sourceRoot":"","sources":["../../../src/admin/layout-editor/use-component-connect.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,EAAE,cAAc,EAA+C,MAAM,uBAAuB,CAAA;AAExG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAgBrD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AACjE,OAAO,KAAK,EAAE,gBAAgB,EAAmB,MAAM,4BAA4B,CAAA;AAEnF;;;;;;;;;;GAUG;AAEH,UAAU,oBAAoB;IAC5B,MAAM,EAAE,cAAc,CAAA;IACtB,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAA;IACtC,OAAO,EAAE,gBAAgB,CAAA;CAC1B;AAED,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,WAAW,EAAE,oBAAoB,CAAA;IACjC,8EAA8E;IAC9E,MAAM,EAAE,KAAK,CAAC,SAAS,CAAA;IACvB,UAAU,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAA;IACtC,WAAW,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAA;IACxC,oBAAoB,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAA;IACnD,YAAY,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAA;IACxC,aAAa,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAA;IAC1C,sBAAsB,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAA;IACrD,2EAA2E;IAC3E,UAAU,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,KAAK,IAAI,CAAA;IAC3D;;;;;;;;;OASG;IACH,uBAAuB,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAA;CACrD;AAQD;;;;;;;;;;GAUG;AACH,wBAAsB,qBAAqB,CAAC,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,CAY1E;AAED,wBAAgB,mBAAmB,CAAC,EAClC,MAAM,EACN,QAAQ,EACR,OAAO,GACR,EAAE,oBAAoB,GAAG,gBAAgB,CA2TzC"}
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { adminFetch } from '../../host-client/index.js';
|
|
5
|
+
import { countComponentLinksToFlatten, detachModuleFromComponent, detachSectionFromComponent, detachVariantContainerFromComponent, flattenComponentLinks, saveAsComponent, } from './component-actions.js';
|
|
6
|
+
import { findModuleInDocument, findSectionInDocument, findVariantContainerInDocument, hasLinkedAncestor, } from './node-lookup.js';
|
|
7
|
+
import { ComponentSaveDialog } from './editor-dialog.js';
|
|
8
|
+
/**
|
|
9
|
+
* The server's own words for a refused component write, details included.
|
|
10
|
+
*
|
|
11
|
+
* `readError` (host-client) reports only `error.message`, which for a rejected
|
|
12
|
+
* definition is the generic "Validation failed" — the useful half is in
|
|
13
|
+
* `details[]` ("A component definition may not link to another component…").
|
|
14
|
+
* The owner is looking at a dialog they cannot get past, so they get the reason.
|
|
15
|
+
*
|
|
16
|
+
* Shared with the save fork (`use-component-fork.tsx`), which puts a refused
|
|
17
|
+
* definition PUT in front of the owner for the same reason.
|
|
18
|
+
*/
|
|
19
|
+
export async function componentErrorMessage(res) {
|
|
20
|
+
try {
|
|
21
|
+
const body = (await res.json());
|
|
22
|
+
const detail = body.error?.details?.map(d => d.message).filter(Boolean).join('; ');
|
|
23
|
+
if (detail)
|
|
24
|
+
return detail;
|
|
25
|
+
if (body.error?.message)
|
|
26
|
+
return body.error.message;
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
/* non-JSON body — fall through to the status line */
|
|
30
|
+
}
|
|
31
|
+
return `Could not save the component (${res.status}).`;
|
|
32
|
+
}
|
|
33
|
+
export function useComponentConnect({ layout, dispatch, library, }) {
|
|
34
|
+
const [pending, setPending] = React.useState(null);
|
|
35
|
+
const [busy, setBusy] = React.useState(false);
|
|
36
|
+
const [error, setError] = React.useState(null);
|
|
37
|
+
/**
|
|
38
|
+
* Is `nodeId` inside another node's component instance? (kywi-cms#147 T3
|
|
39
|
+
* review, I1.)
|
|
40
|
+
*
|
|
41
|
+
* THE HOLE THIS CLOSES. Connecting a node that sits inside an already-linked
|
|
42
|
+
* ancestor writes a bare link into what is really the ancestor's inline
|
|
43
|
+
* FALLBACK copy: the content that node used to hold is gone from the stored
|
|
44
|
+
* document, and the new link is invisible to `collectComponentRefs` (it stops
|
|
45
|
+
* at the connected ancestor), so it never reaches the instance index, the usage
|
|
46
|
+
* counts or the delete gate, and the render-side placement pass strips it. The
|
|
47
|
+
* page looks fine right up to the moment the outer component stops resolving —
|
|
48
|
+
* and then that node renders EMPTY with nothing to recover it from.
|
|
49
|
+
*
|
|
50
|
+
* The gate lives HERE, not only in the canvas chrome, because the canvas is
|
|
51
|
+
* not the only caller: the props rail addresses the current selection and would
|
|
52
|
+
* otherwise reach `saveModule` / `saveSection` / `linkModule` directly. The
|
|
53
|
+
* canvas threading (`linkedAncestor`) and the rail's `isInsideLinkedComponent`
|
|
54
|
+
* make the actions invisible; this makes them impossible.
|
|
55
|
+
*/
|
|
56
|
+
const isInsideLinkedComponent = React.useCallback((nodeId) => hasLinkedAncestor(layout, nodeId), [layout]);
|
|
57
|
+
const openSave = React.useCallback((kind, nodeId) => {
|
|
58
|
+
if (hasLinkedAncestor(layout, nodeId))
|
|
59
|
+
return;
|
|
60
|
+
setError(null);
|
|
61
|
+
setBusy(false);
|
|
62
|
+
setPending({ kind, nodeId });
|
|
63
|
+
}, [layout]);
|
|
64
|
+
const closeSave = React.useCallback(() => {
|
|
65
|
+
setPending(null);
|
|
66
|
+
setBusy(false);
|
|
67
|
+
setError(null);
|
|
68
|
+
}, []);
|
|
69
|
+
const saveModule = React.useCallback((moduleId) => openSave('module', moduleId), [openSave]);
|
|
70
|
+
const saveSection = React.useCallback((sectionId) => openSave('section', sectionId), [openSave]);
|
|
71
|
+
const saveVariantContainer = React.useCallback((containerId) => openSave('variantContainer', containerId), [openSave]);
|
|
72
|
+
// ── Connect in place ───────────────────────────────────────────────────────
|
|
73
|
+
//
|
|
74
|
+
// Each of these swaps the source node for a CLEAN linked instance, keeping its
|
|
75
|
+
// id and its position (that is what REPLACE_* exist for). "Clean" means the
|
|
76
|
+
// node carries no local content of its own, which is what makes the link
|
|
77
|
+
// STRICT: `isCleanComponentInstance` reads exactly this shape, and the renderer
|
|
78
|
+
// then draws the definition alone rather than merging the node's props over it.
|
|
79
|
+
//
|
|
80
|
+
// The node handed in is the FLATTENED one — the same tree that was just stored
|
|
81
|
+
// as the definition — so a freshly connected instance's fallback copy holds the
|
|
82
|
+
// same CONTENT the link resolves to. (Not byte-identical: rendering a resolved
|
|
83
|
+
// definition re-keys its ids per placement — `${nodeId}:${storedId}`, see
|
|
84
|
+
// `rekeyResolvedSection` — so the ids differ by construction. What matters is
|
|
85
|
+
// that the props, style and structure agree, which is what makes an
|
|
86
|
+
// unresolvable link degrade to the same page rather than a different one.)
|
|
87
|
+
// Keeping the pre-flatten copy would instead leave a nested link sitting in the
|
|
88
|
+
// page's fallback data: unindexed (`collectComponentRefs` stops at a connected
|
|
89
|
+
// node), unrendered, and able to reappear if the outer component ever became
|
|
90
|
+
// unresolvable.
|
|
91
|
+
const connectModule = React.useCallback((node, componentId) => {
|
|
92
|
+
dispatch({
|
|
93
|
+
type: 'REPLACE_MODULE',
|
|
94
|
+
moduleId: node.id,
|
|
95
|
+
node: { ...node, componentId, props: { componentId }, style: {} },
|
|
96
|
+
});
|
|
97
|
+
}, [dispatch]);
|
|
98
|
+
const connectSection = React.useCallback((section, componentId) => {
|
|
99
|
+
dispatch({
|
|
100
|
+
type: 'REPLACE_SECTION',
|
|
101
|
+
sectionId: section.id,
|
|
102
|
+
section: { ...section, componentId },
|
|
103
|
+
});
|
|
104
|
+
}, [dispatch]);
|
|
105
|
+
const connectVariantContainer = React.useCallback((container, componentId) => {
|
|
106
|
+
// `experimentId` / `winnerId` stay exactly as the page has them: they bind
|
|
107
|
+
// THIS page's container to THIS page's experiment run, and
|
|
108
|
+
// `applyVariantContainerPlacement` gives the placement's binding priority
|
|
109
|
+
// over the definition's for precisely that reason. Connecting must not
|
|
110
|
+
// silently re-point a live experiment at the saved component's.
|
|
111
|
+
dispatch({
|
|
112
|
+
type: 'REPLACE_VARIANT_CONTAINER',
|
|
113
|
+
containerId: container.id,
|
|
114
|
+
container: { ...container, componentId },
|
|
115
|
+
});
|
|
116
|
+
}, [dispatch]);
|
|
117
|
+
const linkModule = React.useCallback((moduleId, componentId) => {
|
|
118
|
+
const node = findModuleInDocument(layout, moduleId);
|
|
119
|
+
if (!node)
|
|
120
|
+
return;
|
|
121
|
+
// Same refusal as saving, for the same reason: this link would live in
|
|
122
|
+
// another component's fallback copy, where nothing can see it.
|
|
123
|
+
if (hasLinkedAncestor(layout, moduleId))
|
|
124
|
+
return;
|
|
125
|
+
connectModule(node, componentId);
|
|
126
|
+
}, [layout, connectModule]);
|
|
127
|
+
// ── The save itself ────────────────────────────────────────────────────────
|
|
128
|
+
const submitSave = React.useCallback(async (name, description) => {
|
|
129
|
+
if (!pending)
|
|
130
|
+
return;
|
|
131
|
+
const { kind, nodeId } = pending;
|
|
132
|
+
const source = kind === 'module'
|
|
133
|
+
? findModuleInDocument(layout, nodeId)
|
|
134
|
+
: kind === 'section'
|
|
135
|
+
? findSectionInDocument(layout, nodeId)
|
|
136
|
+
: findVariantContainerInDocument(layout, nodeId);
|
|
137
|
+
if (!source) {
|
|
138
|
+
setError('That element is no longer on the page.');
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
// Materialise any component link INSIDE the selection before storing it:
|
|
142
|
+
// the API refuses a definition that links to another component, so without
|
|
143
|
+
// this a section holding a connected module would simply 400 (kywi-cms#147,
|
|
144
|
+
// ledger C2b). Flattening is idempotent, so passing the flattened node to
|
|
145
|
+
// `saveAsComponent` below re-walks it and finds nothing left to do.
|
|
146
|
+
const flattened = flattenComponentLinks(source, library.lookup);
|
|
147
|
+
const input = saveAsComponent(flattened, name, {
|
|
148
|
+
...(description ? { description } : {}),
|
|
149
|
+
resolveLink: library.lookup,
|
|
150
|
+
});
|
|
151
|
+
setBusy(true);
|
|
152
|
+
setError(null);
|
|
153
|
+
try {
|
|
154
|
+
const res = await adminFetch('/api/v1/components', {
|
|
155
|
+
method: 'POST',
|
|
156
|
+
body: JSON.stringify(input),
|
|
157
|
+
});
|
|
158
|
+
if (!res.ok) {
|
|
159
|
+
setError(await componentErrorMessage(res));
|
|
160
|
+
setBusy(false);
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
const body = (await res.json());
|
|
164
|
+
const created = body.data;
|
|
165
|
+
if (!created?.id) {
|
|
166
|
+
setError('The server did not return the saved component.');
|
|
167
|
+
setBusy(false);
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
library.add(created);
|
|
171
|
+
if (kind === 'module')
|
|
172
|
+
connectModule(flattened, created.id);
|
|
173
|
+
else if (kind === 'section')
|
|
174
|
+
connectSection(flattened, created.id);
|
|
175
|
+
else
|
|
176
|
+
connectVariantContainer(flattened, created.id);
|
|
177
|
+
closeSave();
|
|
178
|
+
}
|
|
179
|
+
catch {
|
|
180
|
+
// Network-level failure: the node stays exactly as it was, unlinked.
|
|
181
|
+
setError('Could not reach the server. Nothing was changed.');
|
|
182
|
+
setBusy(false);
|
|
183
|
+
}
|
|
184
|
+
}, [pending, layout, library, connectModule, connectSection, connectVariantContainer, closeSave]);
|
|
185
|
+
// ── Detach ────────────────────────────────────────────────────────────────
|
|
186
|
+
//
|
|
187
|
+
// Materialise the component's CURRENT definition into the node and drop the
|
|
188
|
+
// link, through the helpers the server-side detach-all shares — so detaching
|
|
189
|
+
// one instance here and detaching every instance from the API produce
|
|
190
|
+
// byte-identical nodes for the same placement.
|
|
191
|
+
const detachModule = React.useCallback((moduleId) => {
|
|
192
|
+
const node = findModuleInDocument(layout, moduleId);
|
|
193
|
+
if (!node?.componentId)
|
|
194
|
+
return;
|
|
195
|
+
dispatch({
|
|
196
|
+
type: 'REPLACE_MODULE',
|
|
197
|
+
moduleId,
|
|
198
|
+
node: detachModuleFromComponent(node, library.byId(node.componentId)),
|
|
199
|
+
});
|
|
200
|
+
dispatch({ type: 'DESELECT' });
|
|
201
|
+
}, [layout, library, dispatch]);
|
|
202
|
+
const detachSection = React.useCallback((sectionId) => {
|
|
203
|
+
const section = findSectionInDocument(layout, sectionId);
|
|
204
|
+
if (!section?.componentId)
|
|
205
|
+
return;
|
|
206
|
+
dispatch({
|
|
207
|
+
type: 'REPLACE_SECTION',
|
|
208
|
+
sectionId,
|
|
209
|
+
section: detachSectionFromComponent(section, library.byId(section.componentId)),
|
|
210
|
+
});
|
|
211
|
+
dispatch({ type: 'DESELECT' });
|
|
212
|
+
}, [layout, library, dispatch]);
|
|
213
|
+
const detachVariantContainer = React.useCallback((containerId) => {
|
|
214
|
+
const container = findVariantContainerInDocument(layout, containerId);
|
|
215
|
+
if (!container?.componentId)
|
|
216
|
+
return;
|
|
217
|
+
dispatch({
|
|
218
|
+
type: 'REPLACE_VARIANT_CONTAINER',
|
|
219
|
+
containerId,
|
|
220
|
+
container: detachVariantContainerFromComponent(container, library.byId(container.componentId)),
|
|
221
|
+
});
|
|
222
|
+
dispatch({ type: 'DESELECT' });
|
|
223
|
+
}, [layout, library, dispatch]);
|
|
224
|
+
// ── Canvas chrome ─────────────────────────────────────────────────────────
|
|
225
|
+
//
|
|
226
|
+
// The linked-instance pill's name lookup only, since kywi-cms#159: the chrome
|
|
227
|
+
// no longer renders "Save as component" at any granularity, so this no longer
|
|
228
|
+
// carries onSaveModule/onSaveSection/onSaveVariantContainer — the props rail
|
|
229
|
+
// reaches `saveModule` / `saveSection` / `saveVariantContainer` below directly.
|
|
230
|
+
const affordances = React.useMemo(() => ({
|
|
231
|
+
nameOf: library.nameOf,
|
|
232
|
+
}), [library.nameOf]);
|
|
233
|
+
// A container is a "personalized section" or an "A/B tested section" — the
|
|
234
|
+
// dialog cannot know which from the granularity, and the canvas names it that
|
|
235
|
+
// way in its own badge, so tell it.
|
|
236
|
+
const pendingSubject = () => {
|
|
237
|
+
if (!pending || pending.kind !== 'variantContainer')
|
|
238
|
+
return undefined;
|
|
239
|
+
const container = findVariantContainerInDocument(layout, pending.nodeId);
|
|
240
|
+
if (!container)
|
|
241
|
+
return undefined;
|
|
242
|
+
return container.mode === 'ab_test' ? 'A/B tested section' : 'personalized section';
|
|
243
|
+
};
|
|
244
|
+
/**
|
|
245
|
+
* How many component links sit INSIDE the pending selection.
|
|
246
|
+
*
|
|
247
|
+
* Saving materialises them (the API refuses a definition that links out), which
|
|
248
|
+
* means those inner instances stop following their own source — a real change
|
|
249
|
+
* to the page, not a formality, so it is said out loud before the owner commits
|
|
250
|
+
* rather than discovered later when editing the inner component changes nothing
|
|
251
|
+
* here.
|
|
252
|
+
*
|
|
253
|
+
* Counted by RUNNING the flattening (`countComponentLinksToFlatten`), not by
|
|
254
|
+
* asking `collectComponentRefs` (kywi-cms#147 T3 review, M2): that walker stops
|
|
255
|
+
* at a connected node, so a link hidden inside a connected node's inline
|
|
256
|
+
* fallback copy — the case an unresolvable inner link produces — is invisible to
|
|
257
|
+
* it while the flattening rewrites it on the next pass regardless. The disclosure
|
|
258
|
+
* has to match what the save actually does.
|
|
259
|
+
*
|
|
260
|
+
* The selection's own link is subtracted, though it is never present: saving an
|
|
261
|
+
* already-linked node as a new component is not offered anywhere.
|
|
262
|
+
*/
|
|
263
|
+
const pendingNestedLinks = () => {
|
|
264
|
+
if (!pending || pending.kind === 'module')
|
|
265
|
+
return 0;
|
|
266
|
+
const node = pending.kind === 'section'
|
|
267
|
+
? findSectionInDocument(layout, pending.nodeId)
|
|
268
|
+
: findVariantContainerInDocument(layout, pending.nodeId);
|
|
269
|
+
if (!node)
|
|
270
|
+
return 0;
|
|
271
|
+
const total = countComponentLinksToFlatten(node, library.lookup);
|
|
272
|
+
return Math.max(0, total - (node.componentId ? 1 : 0));
|
|
273
|
+
};
|
|
274
|
+
const subject = pendingSubject();
|
|
275
|
+
const nested = pendingNestedLinks();
|
|
276
|
+
const notice = nested > 0
|
|
277
|
+
? `${nested} linked component${nested === 1 ? '' : 's'} inside will be copied into this one, ` +
|
|
278
|
+
`and ${nested === 1 ? 'that instance' : 'those instances'} will stop following ${nested === 1 ? 'its' : 'their'} source.`
|
|
279
|
+
: null;
|
|
280
|
+
const dialog = pending ? (_jsx(ComponentSaveDialog, { kind: pending.kind, ...(subject ? { subject } : {}), ...(notice ? { notice } : {}), busy: busy, error: error, onCancel: closeSave, onSubmit: (name, description) => { void submitSave(name, description); } })) : null;
|
|
281
|
+
return {
|
|
282
|
+
affordances,
|
|
283
|
+
dialog,
|
|
284
|
+
saveModule,
|
|
285
|
+
saveSection,
|
|
286
|
+
saveVariantContainer,
|
|
287
|
+
detachModule,
|
|
288
|
+
detachSection,
|
|
289
|
+
detachVariantContainer,
|
|
290
|
+
linkModule,
|
|
291
|
+
isInsideLinkedComponent,
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
//# sourceMappingURL=use-component-connect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-component-connect.js","sourceRoot":"","sources":["../../../src/admin/layout-editor/use-component-connect.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AACZ,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAA;AAEvD,OAAO,EACL,4BAA4B,EAC5B,yBAAyB,EACzB,0BAA0B,EAC1B,mCAAmC,EACnC,qBAAqB,EACrB,eAAe,GAChB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,8BAA8B,EAC9B,iBAAiB,GAClB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,mBAAmB,EAA0B,MAAM,oBAAoB,CAAA;AA0DhF;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,GAAa;IACvD,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAE7B,CAAA;QACD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAClF,IAAI,MAAM;YAAE,OAAO,MAA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