@kywi-software/core 0.11.0 → 0.12.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/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 +8 -0
- package/dist/admin/layout-editor/editor-canvas.d.ts.map +1 -1
- package/dist/admin/layout-editor/editor-canvas.js +120 -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 +160 -190
- package/dist/admin/layout-editor/layout-editor.js.map +1 -1
- package/dist/admin/layout-editor/linked-component.d.ts +39 -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 +35 -0
- package/dist/admin/layout-editor/node-lookup.d.ts.map +1 -1
- package/dist/admin/layout-editor/node-lookup.js +91 -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 +54 -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 +61 -0
- package/dist/admin/layout-editor/use-component-connect.d.ts.map +1 -0
- package/dist/admin/layout-editor/use-component-connect.js +292 -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
|
@@ -115,26 +115,26 @@ export declare function recordApprovalAction(db: KywiDb, data: {
|
|
|
115
115
|
comment?: string;
|
|
116
116
|
}): Promise<{
|
|
117
117
|
id: string;
|
|
118
|
-
createdAt: Date;
|
|
119
118
|
contentId: string;
|
|
120
|
-
userId: string;
|
|
121
119
|
action: string;
|
|
120
|
+
createdAt: Date;
|
|
121
|
+
userId: string;
|
|
122
|
+
comment: string | null;
|
|
122
123
|
chainId: string;
|
|
123
124
|
stepIndex: number;
|
|
124
|
-
comment: string | null;
|
|
125
125
|
}>;
|
|
126
126
|
/**
|
|
127
127
|
* Get all approval actions for a content item in a specific chain.
|
|
128
128
|
*/
|
|
129
129
|
export declare function getApprovalActions(db: KywiDb, chainId: string, contentId: string): Promise<{
|
|
130
130
|
id: string;
|
|
131
|
-
createdAt: Date;
|
|
132
131
|
contentId: string;
|
|
133
|
-
userId: string;
|
|
134
132
|
action: string;
|
|
133
|
+
createdAt: Date;
|
|
134
|
+
userId: string;
|
|
135
|
+
comment: string | null;
|
|
135
136
|
chainId: string;
|
|
136
137
|
stepIndex: number;
|
|
137
|
-
comment: string | null;
|
|
138
138
|
}[]>;
|
|
139
139
|
/**
|
|
140
140
|
* Get the current approval status for a content item in a chain.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-queries.d.ts","sourceRoot":"","sources":["../../src/db/workflow-queries.ts"],"names":[],"mappings":"AAIA,OAAO,EAAoB,KAAK,WAAW,EAAE,MAAM,oBAAoB,CAAA;AACvE,OAAO,EAAkB,KAAK,uBAAuB,EAAE,MAAM,sBAAsB,CAAA;AAEnF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAE7D,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,OAAO,CAAA;IAChB,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAYD;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,GACf,gBAAgB,CAQlB;AAED;;GAEG;AACH,wBAAsB,uBAAuB,CAC3C,EAAE,EAAE,MAAM,EACV,IAAI,EAAE;IACJ,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,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EAAE,EAAE,MAAM,EACV,IAAI,EAAE;IACJ,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,kBAAkB,CAAC,GAAG,CAAC,GAAG,IAAI,CAAA;IAC3C,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAChC,GACA,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,uBAAuB,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAUlF"}
|
|
@@ -4,7 +4,7 @@ import { canTransition } from '../versioning/state-machine.js';
|
|
|
4
4
|
import { createVersion, getLatestVersionNumber, getVersionById } from './version-queries.js';
|
|
5
5
|
import { createAuditEntry } from './audit-queries.js';
|
|
6
6
|
import { getContentById } from './content-queries.js';
|
|
7
|
-
import { extractCustomFieldsFromSnapshot } from './apply-snapshot.js';
|
|
7
|
+
import { extractCustomFieldsFromSnapshot, applySnapshotLayout } from './apply-snapshot.js';
|
|
8
8
|
/** Derive the audit action name from a status transition. */
|
|
9
9
|
function deriveAction(from, to) {
|
|
10
10
|
if (to === 'pending')
|
|
@@ -117,8 +117,13 @@ export async function restoreContentVersion(db, opts) {
|
|
|
117
117
|
// drizzle's `timestamp` columns cannot serialize (they call `.toISOString()`
|
|
118
118
|
// on the value), and (b) custom fields (stored in a side table) are merged
|
|
119
119
|
// in. Restrict to real base columns and coerce `date` columns back to `Date`.
|
|
120
|
+
// `layout` is skipped here and applied below through setContentLayout: it is a
|
|
121
|
+
// validated document with an index behind it, not a column value (kywi-cms#147).
|
|
122
|
+
// A restore used to rewrite it raw, so rolling back to an old version could
|
|
123
|
+
// store a layout no validator had seen and leave kywi_component_instances
|
|
124
|
+
// describing the version that was just replaced.
|
|
120
125
|
const baseColumns = getTableColumns(kywiContent);
|
|
121
|
-
const SKIP = new Set(['id', 'siteId', 'createdAt', 'createdBy', 'deletedAt', 'updatedAt', 'updatedBy']);
|
|
126
|
+
const SKIP = new Set(['id', 'siteId', 'createdAt', 'createdBy', 'deletedAt', 'updatedAt', 'updatedBy', 'layout']);
|
|
122
127
|
const restoreFields = {};
|
|
123
128
|
for (const [key, column] of Object.entries(baseColumns)) {
|
|
124
129
|
if (SKIP.has(key) || !(key in snapshot))
|
|
@@ -140,6 +145,10 @@ export async function restoreContentVersion(db, opts) {
|
|
|
140
145
|
updatedAt: new Date(),
|
|
141
146
|
})
|
|
142
147
|
.where(eq(kywiContent.id, opts.contentId));
|
|
148
|
+
// The restored layout, validated and indexed, in this same transaction. An
|
|
149
|
+
// invalid stored layout throws SnapshotLayoutInvalidError and rolls the whole
|
|
150
|
+
// restore back rather than reviving a page that can no longer be edited.
|
|
151
|
+
await applySnapshotLayout(tx, opts.contentId, snapshot);
|
|
143
152
|
// Restore the content type's custom (side-table) fields too (#63). A
|
|
144
153
|
// snapshot carries them since 0.3.0, but the base-column loop above only
|
|
145
154
|
// rewrites kywi_content — a base-only restore silently dropped custom values.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-queries.js","sourceRoot":"","sources":["../../src/db/workflow-queries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,GAAG,EAAQ,GAAG,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AACjE,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AACxF,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAA;AAC9D,OAAO,EAAE,aAAa,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC5F,OAAO,EAAE,gBAAgB,EAAoB,MAAM,oBAAoB,CAAA;AACvE,OAAO,EAAE,cAAc,EAAgC,MAAM,sBAAsB,CAAA;AACnF,OAAO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QACjC,SAAS,EAAE,IAAI,CAAC,SAAS;QACzB,QAAQ,EAAE,SAAS;QACnB,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,SAAS,EAAE,IAAI,CAAC,SAAS;QACzB,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,UAAU,EAAE,IAAI,CAAC,UAAU;KAC5B,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -0,0 +1,465 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* component-refs.ts
|
|
3
|
+
* The pure layer under linked components (kywi-cms#147): finding the
|
|
4
|
+
* `componentId` links inside a layout document, diffing two documents' links,
|
|
5
|
+
* and materialising a link into an independent copy ("detach").
|
|
6
|
+
*
|
|
7
|
+
* Everything here is a pure function over plain layout data — no database, no
|
|
8
|
+
* React — so the instance index (`db/component-instance-queries.ts`), the
|
|
9
|
+
* detach-all endpoint, and the editor can all share one definition of "where
|
|
10
|
+
* are the links" and "what does detaching produce".
|
|
11
|
+
*
|
|
12
|
+
* Keep this module dependency-free beyond `./types.js`.
|
|
13
|
+
*/
|
|
14
|
+
import type { LayoutDocument, LayoutSection, ModuleNode, VariantContainer } from './types.js';
|
|
15
|
+
export type ComponentRefKind = 'module' | 'section' | 'variantContainer';
|
|
16
|
+
/** One placement of a linked component inside a layout document. */
|
|
17
|
+
export interface ComponentRef {
|
|
18
|
+
componentId: string;
|
|
19
|
+
/** The layout node id carrying the link (module id, section id, container id). */
|
|
20
|
+
nodeId: string;
|
|
21
|
+
kind: ComponentRefKind;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* A placement together with the NODE carrying it, narrowed by kind.
|
|
25
|
+
*
|
|
26
|
+
* {@link collectComponentRefs} answers "where are the links"; this answers
|
|
27
|
+
* "…and what is in them", which is what the editor's save fork needs to tell an
|
|
28
|
+
* edited instance from an untouched one (kywi-cms#147 T4). One traversal serves
|
|
29
|
+
* both so the two can never disagree about what counts as a placement — in
|
|
30
|
+
* particular about the rule that a connected section/container resolves
|
|
31
|
+
* WHOLESALE and nothing inside its inline fallback copy is a placement of this
|
|
32
|
+
* page's.
|
|
33
|
+
*/
|
|
34
|
+
export type ComponentInstance = {
|
|
35
|
+
componentId: string;
|
|
36
|
+
nodeId: string;
|
|
37
|
+
kind: 'module';
|
|
38
|
+
node: ModuleNode;
|
|
39
|
+
} | {
|
|
40
|
+
componentId: string;
|
|
41
|
+
nodeId: string;
|
|
42
|
+
kind: 'section';
|
|
43
|
+
node: LayoutSection;
|
|
44
|
+
} | {
|
|
45
|
+
componentId: string;
|
|
46
|
+
nodeId: string;
|
|
47
|
+
kind: 'variantContainer';
|
|
48
|
+
node: VariantContainer;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Identity of a placement: the same component in the same node is one instance.
|
|
52
|
+
*
|
|
53
|
+
* The separator is US (unit separator, U+001F) — unusable inside a real id, so
|
|
54
|
+
* two different pairs can never collide on one key. It is deliberately NOT NUL:
|
|
55
|
+
* a NUL byte anywhere in the first 8 KiB makes git classify the whole source
|
|
56
|
+
* file as binary, which silently turns every diff and review of this file into
|
|
57
|
+
* "Bin 15229 bytes".
|
|
58
|
+
*/
|
|
59
|
+
export declare function componentRefKey(ref: Pick<ComponentRef, 'componentId' | 'nodeId'>): string;
|
|
60
|
+
/**
|
|
61
|
+
* Every linked-component placement in a layout document, in document order,
|
|
62
|
+
* deduplicated by (componentId, nodeId).
|
|
63
|
+
*
|
|
64
|
+
* Page variants are walked because their regions really do render (the
|
|
65
|
+
* personalization pass swaps them in). A/B experiment variants are walked too,
|
|
66
|
+
* even though today's renderer never renders `abExperiments[]` regions — a link
|
|
67
|
+
* stored there is still a link the delete gate must see and detach-all must
|
|
68
|
+
* rewrite, otherwise deleting the component would leave a dangling id behind in
|
|
69
|
+
* data the renderer may well start honouring. Counting them can only ever
|
|
70
|
+
* over-report, never miss.
|
|
71
|
+
*
|
|
72
|
+
* Deduplication matters in both: a variant is often a near-copy of the default
|
|
73
|
+
* regions and may legitimately repeat a node id.
|
|
74
|
+
*/
|
|
75
|
+
export declare function collectComponentRefs(layout: LayoutDocument | null | undefined): ComponentRef[];
|
|
76
|
+
/**
|
|
77
|
+
* {@link collectComponentRefs}, with the node each link sits on.
|
|
78
|
+
*
|
|
79
|
+
* THE traversal — `collectComponentRefs` is now a projection of this one, so
|
|
80
|
+
* "where are the links" and "what is in them" cannot drift apart. The nodes are
|
|
81
|
+
* the document's own objects, not copies: callers that intend to keep or rewrite
|
|
82
|
+
* one deep-copy it themselves (`detachedCopy` in the editor, jsonb serialisation
|
|
83
|
+
* on the server), exactly as they already did for the refs.
|
|
84
|
+
*/
|
|
85
|
+
export declare function collectComponentInstances(layout: LayoutDocument | null | undefined): ComponentInstance[];
|
|
86
|
+
export interface ComponentRefDiff {
|
|
87
|
+
added: ComponentRef[];
|
|
88
|
+
removed: ComponentRef[];
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Which placements appeared and which disappeared between two documents.
|
|
92
|
+
*
|
|
93
|
+
* Identity is (componentId, nodeId), so moving a linked node to another column,
|
|
94
|
+
* region, or variant is not a change — but re-keying it (paste, duplicate) is a
|
|
95
|
+
* remove plus an add, which is exactly right: it is a different placement.
|
|
96
|
+
*/
|
|
97
|
+
export declare function diffComponentRefs(before: LayoutDocument | null | undefined, after: LayoutDocument | null | undefined): ComponentRefDiff;
|
|
98
|
+
/**
|
|
99
|
+
* Re-derive a resolved definition's ids from the id of the node it is rendered
|
|
100
|
+
* into, so the same component placed twice on a page never emits duplicate ids.
|
|
101
|
+
*
|
|
102
|
+
* This is the canonical implementation of the scheme the public renderer
|
|
103
|
+
* already applies to connected sections (`${localId}:${storedId}`), lifted out
|
|
104
|
+
* of `renderer.tsx` so the server-side detach produces *byte-identical* ids to
|
|
105
|
+
* what the page was already rendering — `renderer.tsx` imports this one.
|
|
106
|
+
*/
|
|
107
|
+
export declare function rekeyResolvedSection(resolved: LayoutSection, localId: string): LayoutSection;
|
|
108
|
+
/**
|
|
109
|
+
* The variant-container equivalent of {@link rekeyResolvedSection}: the local
|
|
110
|
+
* container id is kept (stable keys, `data-*` hooks, style scoping) and every
|
|
111
|
+
* id underneath — variant arms and their sections' columns/modules — is
|
|
112
|
+
* re-derived from it.
|
|
113
|
+
*
|
|
114
|
+
* THE SCOPING SCHEME, and why the arm id is part of it:
|
|
115
|
+
*
|
|
116
|
+
* - a Default-arm section becomes `${containerId}:${sectionId}`;
|
|
117
|
+
* - a variant-arm section becomes `${containerId}:${armId}:${sectionId}`.
|
|
118
|
+
*
|
|
119
|
+
* A container's arms are near-copies of each other by construction — an A/B
|
|
120
|
+
* container is usually "the same section, two headlines" — so the same stored
|
|
121
|
+
* section id in the Default arm and in arm B is the NORMAL case, not a
|
|
122
|
+
* pathological one. Scoping both by the container id alone gave them (and every
|
|
123
|
+
* column/module beneath them) identical ids: duplicate React keys, a
|
|
124
|
+
* `[data-section-id]` responsive-style selector matching two sections, and a
|
|
125
|
+
* `data-instance-id` that no longer identifies one module. Folding the arm id in
|
|
126
|
+
* makes ids unique document-wide.
|
|
127
|
+
*
|
|
128
|
+
* These ids are a COMPATIBILITY SURFACE: detaching persists them into the page's
|
|
129
|
+
* stored layout, so changing the scheme re-keys previously detached containers.
|
|
130
|
+
* That is safe within a document (responsive selectors are re-derived from the
|
|
131
|
+
* same ids in the same save) but not for anything outside it that pinned a
|
|
132
|
+
* section id — analytics selectors, hand-written CSS. Changing it again means a
|
|
133
|
+
* migration, so it changes only for a bug of this class.
|
|
134
|
+
*/
|
|
135
|
+
export declare function rekeyResolvedVariantContainer(resolved: VariantContainer, localId: string): VariantContainer;
|
|
136
|
+
/** A resolved module component, in the shape the renderer's resolver returns. */
|
|
137
|
+
export interface ResolvedModuleDefinition {
|
|
138
|
+
moduleType: string;
|
|
139
|
+
props: Record<string, unknown>;
|
|
140
|
+
style: Record<string, string>;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Is this a *clean* linked instance — one that carries no local content of its
|
|
144
|
+
* own and therefore renders its component's definition strictly (kywi-cms#147)?
|
|
145
|
+
*
|
|
146
|
+
* The connect flows write a node whose only prop is the `componentId` echo (see
|
|
147
|
+
* `buildConnectedModuleNode`) and whose style map is empty. Such a node has
|
|
148
|
+
* nothing to say about how it renders, so the definition speaks for it alone —
|
|
149
|
+
* which is what "strict link" means and what makes "edit the instance → save to
|
|
150
|
+
* all" coherent (there is no per-instance state to lose).
|
|
151
|
+
*
|
|
152
|
+
* A node with ANY other local prop, or any local style, is a LEGACY override
|
|
153
|
+
* node from before strict links (kywi-cms#46 allowed per-instance overrides) and
|
|
154
|
+
* keeps the old merge, so upgrading the engine never silently changes what an
|
|
155
|
+
* existing page renders. The distinction is deliberately structural rather than
|
|
156
|
+
* a stored flag: it needs no migration and it reads the same in the editor, the
|
|
157
|
+
* renderer and the detach path.
|
|
158
|
+
*/
|
|
159
|
+
export declare function isCleanComponentInstance(node: Pick<ModuleNode, 'props' | 'style'>): boolean;
|
|
160
|
+
/**
|
|
161
|
+
* The props/style a connected module node renders with: the definition's alone
|
|
162
|
+
* for a clean instance, definition-then-node for a legacy override node (see
|
|
163
|
+
* {@link isCleanComponentInstance}).
|
|
164
|
+
*
|
|
165
|
+
* Note what the clean case drops: the `componentId` echo that
|
|
166
|
+
* `buildConnectedModuleNode` writes into `props`. It is a link marker, not
|
|
167
|
+
* content, and forwarding it to the module as a prop was only ever an artefact
|
|
168
|
+
* of the merge.
|
|
169
|
+
*/
|
|
170
|
+
export declare function resolveModulePlacement(node: Pick<ModuleNode, 'props' | 'style'>, resolved: Pick<ResolvedModuleDefinition, 'props' | 'style'>): {
|
|
171
|
+
props: Record<string, unknown>;
|
|
172
|
+
style: Record<string, string>;
|
|
173
|
+
};
|
|
174
|
+
/**
|
|
175
|
+
* What a connected section renders: the resolved definition, re-keyed off the
|
|
176
|
+
* placement's own id. The placement's inline `columns`/`style` are only the
|
|
177
|
+
* fallback copy for an unresolvable link, so nothing of the placement survives
|
|
178
|
+
* but its id — v1 sections are an all-or-nothing reference.
|
|
179
|
+
*
|
|
180
|
+
* Every link inside the result is dropped ({@link stripLinksInSection}),
|
|
181
|
+
* including one on the definition's own root. The renderer stamps
|
|
182
|
+
* `data-component-id` from the PLACEMENT, so a definition cannot smuggle a
|
|
183
|
+
* second link in through here.
|
|
184
|
+
*/
|
|
185
|
+
export declare function applySectionPlacement(resolved: LayoutSection, placement: Pick<LayoutSection, 'id'>): LayoutSection;
|
|
186
|
+
/**
|
|
187
|
+
* The variant-container counterpart of {@link applySectionPlacement}, with one
|
|
188
|
+
* addition: the placement's own experiment binding wins over the definition's.
|
|
189
|
+
*
|
|
190
|
+
* `experimentId`/`winnerId` identify THIS page's experiment run — which
|
|
191
|
+
* experiment the arms report to and which arm has been locked in as the winner —
|
|
192
|
+
* not the saved component's. Everything selection-related therefore reads off
|
|
193
|
+
* the returned container: the arms come from the definition, the experiment they
|
|
194
|
+
* belong to comes from the placement. A placement that names neither inherits
|
|
195
|
+
* the definition's, so a component saved with its experiment binding intact
|
|
196
|
+
* keeps working when placed as-is.
|
|
197
|
+
*/
|
|
198
|
+
export declare function applyVariantContainerPlacement(resolved: VariantContainer, placement: Pick<VariantContainer, 'id' | 'experimentId' | 'winnerId'>): VariantContainer;
|
|
199
|
+
/**
|
|
200
|
+
* The inverse of {@link rekeyResolvedSection}: strip the scope that section's own
|
|
201
|
+
* id imposed on its columns and modules, and give the result `rootId`.
|
|
202
|
+
*
|
|
203
|
+
* The scope is read off `resolved.id` rather than passed in, because that is
|
|
204
|
+
* exactly what `rekeyResolvedSection` used as the `localId` — for a top-level
|
|
205
|
+
* placement the placement's id, for a container's arm section the arm-scoped id it
|
|
206
|
+
* was rekeyed to. Ids that do NOT carry the prefix are left alone: a module the
|
|
207
|
+
* author ADDED to a linked instance has a freshly generated id and no scope, and
|
|
208
|
+
* must keep it.
|
|
209
|
+
*/
|
|
210
|
+
export declare function unrekeyResolvedSection(resolved: LayoutSection, rootId: string): LayoutSection;
|
|
211
|
+
/**
|
|
212
|
+
* What this placement would be as a DEFINITION: the inverse of
|
|
213
|
+
* {@link applySectionPlacement}.
|
|
214
|
+
*
|
|
215
|
+
* `definitionId` is the id the stored definition already carries, so a definition
|
|
216
|
+
* rewritten from a placement keeps its own root id rather than adopting the
|
|
217
|
+
* page's. Nothing reads a section definition's root id (the placement's always
|
|
218
|
+
* wins at render — see `applySectionPlacement`), but keeping it stable means two
|
|
219
|
+
* successive update-alls produce byte-identical rows.
|
|
220
|
+
*/
|
|
221
|
+
export declare function unapplySectionPlacement(placement: LayoutSection, definitionId?: string | null | undefined): LayoutSection;
|
|
222
|
+
/**
|
|
223
|
+
* The container counterpart of {@link unapplySectionPlacement}, mirroring
|
|
224
|
+
* {@link rekeyResolvedVariantContainer}'s arm-aware scheme in reverse:
|
|
225
|
+
* `${containerId}:${armId}:${sectionId}` unwinds one level at a time.
|
|
226
|
+
*
|
|
227
|
+
* The placement's `experimentId`/`winnerId` are DROPPED, not inverted: they are
|
|
228
|
+
* this page's experiment run, and `applyVariantContainerPlacement` lets them win
|
|
229
|
+
* over the definition's precisely so a component never carries one page's run.
|
|
230
|
+
* Restoring the definition's own binding is the caller's business (it holds the
|
|
231
|
+
* stored row); this returns a container with no binding at all.
|
|
232
|
+
*/
|
|
233
|
+
export declare function unapplyVariantContainerPlacement(placement: VariantContainer, definitionId?: string | null | undefined): VariantContainer;
|
|
234
|
+
/**
|
|
235
|
+
* A component's stored definition, projected into the shape detaching needs.
|
|
236
|
+
* `unresolvable` covers a component row whose definition doesn't match its
|
|
237
|
+
* declared type — the same case the renderer falls back on, where detaching can
|
|
238
|
+
* only drop the link and keep what the page already renders.
|
|
239
|
+
*/
|
|
240
|
+
export type ComponentDetachSource = {
|
|
241
|
+
kind: 'module';
|
|
242
|
+
moduleType: string;
|
|
243
|
+
props: Record<string, unknown>;
|
|
244
|
+
style: Record<string, string>;
|
|
245
|
+
} | {
|
|
246
|
+
kind: 'section';
|
|
247
|
+
section: LayoutSection;
|
|
248
|
+
} | {
|
|
249
|
+
kind: 'variantContainer';
|
|
250
|
+
container: VariantContainer;
|
|
251
|
+
} | {
|
|
252
|
+
kind: 'unresolvable';
|
|
253
|
+
};
|
|
254
|
+
export type ComponentDefinitionValidation = {
|
|
255
|
+
success: true;
|
|
256
|
+
} | {
|
|
257
|
+
success: false;
|
|
258
|
+
error: string;
|
|
259
|
+
};
|
|
260
|
+
/**
|
|
261
|
+
* Is this stored `definition` a legal one for a component of this type?
|
|
262
|
+
*
|
|
263
|
+
* A component definition is not just a blob: detaching materialises it straight
|
|
264
|
+
* into a page's layout, so a definition that a layout could never hold is a
|
|
265
|
+
* loaded gun. A section definition whose columns don't sum to 12, for instance,
|
|
266
|
+
* gets copied into every page that links the component the moment anyone
|
|
267
|
+
* detaches — and every subsequent layout save of those pages is then rejected by
|
|
268
|
+
* the very same rule, leaving them un-editable with no way back through the UI.
|
|
269
|
+
*
|
|
270
|
+
* So the rules here are deliberately the *same* rules the layout write path
|
|
271
|
+
* applies, reached through the same functions:
|
|
272
|
+
* - `module` → a resolvable `moduleType`, plus `props`/`style` object maps
|
|
273
|
+
* (the shape `ComponentResolver` and `detachModuleNode` read);
|
|
274
|
+
* - `section` → {@link validateLayoutSection};
|
|
275
|
+
* - `variantContainer` → {@link validateVariantContainer}.
|
|
276
|
+
*
|
|
277
|
+
* Called on component create and on every definition-bearing update, which is
|
|
278
|
+
* the only pair of doors a definition can come in through.
|
|
279
|
+
*/
|
|
280
|
+
export declare function validateComponentDefinition(component: {
|
|
281
|
+
type: string;
|
|
282
|
+
moduleType?: string | null | undefined;
|
|
283
|
+
definition: unknown;
|
|
284
|
+
}): ComponentDefinitionValidation;
|
|
285
|
+
/**
|
|
286
|
+
* Project a `kywi_components` row into a {@link ComponentDetachSource}.
|
|
287
|
+
* Takes the structural shape rather than the row type so it stays usable from
|
|
288
|
+
* the editor (which holds the same fields over the wire).
|
|
289
|
+
*/
|
|
290
|
+
export declare function componentDetachSource(component: {
|
|
291
|
+
type: string;
|
|
292
|
+
moduleType?: string | null;
|
|
293
|
+
definition?: unknown;
|
|
294
|
+
} | null | undefined): ComponentDetachSource;
|
|
295
|
+
/**
|
|
296
|
+
* Materialising a placement is ONE operation with two callers that differ in a
|
|
297
|
+
* single bit: does the materialised node keep its link?
|
|
298
|
+
*
|
|
299
|
+
* - `'drop'` — DETACH. The page keeps rendering the same thing, on its own.
|
|
300
|
+
* - `'keep'` — PRE-RESOLUTION. The definition is baked in for RENDERING, but
|
|
301
|
+
* the node stays a linked instance: the editor still shows its affordance,
|
|
302
|
+
* `data-component-id` is still stamped in the public DOM, and the next save
|
|
303
|
+
* still writes a link, not a copy.
|
|
304
|
+
*
|
|
305
|
+
* Sharing the code is what makes "render ≡ detach ≡ pre-resolution" true by
|
|
306
|
+
* construction rather than by three implementations agreeing.
|
|
307
|
+
*/
|
|
308
|
+
type LinkDisposition = 'keep' | 'drop';
|
|
309
|
+
/**
|
|
310
|
+
* Materialise a connected module node: the definition's props/style baked in,
|
|
311
|
+
* the module's `type` set to the component's `moduleType`.
|
|
312
|
+
*
|
|
313
|
+
* What it renders through the link is decided by {@link resolveModulePlacement}
|
|
314
|
+
* — the same call the renderer makes — so what the page rendered before is
|
|
315
|
+
* exactly what it renders after. Ids are preserved: this is the same placement,
|
|
316
|
+
* not a new one.
|
|
317
|
+
*/
|
|
318
|
+
export declare function materializeModuleNode(node: ModuleNode, source: ComponentDetachSource, link?: LinkDisposition): ModuleNode;
|
|
319
|
+
/**
|
|
320
|
+
* Materialise a connected section: exactly what the renderer draws for this
|
|
321
|
+
* placement ({@link applySectionPlacement}). An unresolvable source degrades to
|
|
322
|
+
* keeping the section's own inline fallback copy — again matching what the
|
|
323
|
+
* renderer shows.
|
|
324
|
+
*/
|
|
325
|
+
export declare function materializeSectionNode(section: LayoutSection, source: ComponentDetachSource, link?: LinkDisposition): LayoutSection;
|
|
326
|
+
/** The variant-container equivalent of {@link materializeSectionNode}. */
|
|
327
|
+
export declare function materializeVariantContainerNode(container: VariantContainer, source: ComponentDetachSource, link?: LinkDisposition): VariantContainer;
|
|
328
|
+
/** Materialise a connected module node into an INDEPENDENT one (link dropped). */
|
|
329
|
+
export declare function detachModuleNode(node: ModuleNode, source: ComponentDetachSource): ModuleNode;
|
|
330
|
+
/** Materialise a connected section into an INDEPENDENT one (link dropped). */
|
|
331
|
+
export declare function detachSectionNode(section: LayoutSection, source: ComponentDetachSource): LayoutSection;
|
|
332
|
+
/** Materialise a connected container into an INDEPENDENT one (link dropped). */
|
|
333
|
+
export declare function detachVariantContainerNode(container: VariantContainer, source: ComponentDetachSource): VariantContainer;
|
|
334
|
+
/**
|
|
335
|
+
* Rewrite linked placements anywhere in a document, one kind at a time.
|
|
336
|
+
*
|
|
337
|
+
* The general form of the two whole-document rewrites below, for callers whose
|
|
338
|
+
* decision is per-NODE rather than per-component: the editor's save fork asks a
|
|
339
|
+
* different question of each edited instance ("update the component" vs "keep it
|
|
340
|
+
* on this page"), and the answer may differ for two placements of the same
|
|
341
|
+
* component. A mapper that returns the node it was given changes nothing.
|
|
342
|
+
*
|
|
343
|
+
* It matters that this goes through {@link mapLinkedPlacements} rather than the
|
|
344
|
+
* editor walking the tree itself: a save fork that disagreed with
|
|
345
|
+
* {@link collectComponentInstances} about where the placements are would rewrite
|
|
346
|
+
* a node the index never learns about, or miss one it did — and links live in
|
|
347
|
+
* page variants and A/B regions, not just the default ones.
|
|
348
|
+
*/
|
|
349
|
+
export interface ComponentInstanceRewrite {
|
|
350
|
+
module?: (node: ModuleNode, ref: ComponentRef) => ModuleNode;
|
|
351
|
+
section?: (section: LayoutSection, ref: ComponentRef) => LayoutSection;
|
|
352
|
+
variantContainer?: (container: VariantContainer, ref: ComponentRef) => VariantContainer;
|
|
353
|
+
}
|
|
354
|
+
export declare function rewriteComponentInstances(layout: LayoutDocument, rewrite: ComponentInstanceRewrite): LayoutDocument;
|
|
355
|
+
export interface DetachResult {
|
|
356
|
+
layout: LayoutDocument;
|
|
357
|
+
/** How many placements were materialised. */
|
|
358
|
+
detached: number;
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* Replace every placement of `componentId` in a layout document with an
|
|
362
|
+
* independent copy of the component's definition. Returns a new document; the
|
|
363
|
+
* input is not mutated. `detached` is 0 when the document held no link, in
|
|
364
|
+
* which case `layout` is the input document unchanged.
|
|
365
|
+
*/
|
|
366
|
+
export declare function detachComponentFromLayout(layout: LayoutDocument, componentId: string, source: ComponentDetachSource): DetachResult;
|
|
367
|
+
/**
|
|
368
|
+
* Look up a component's definition, projected into the shape materialisation
|
|
369
|
+
* reads ({@link componentDetachSource}). Returning null/undefined — or an
|
|
370
|
+
* `unresolvable` source — means "this link does not resolve", and the placement
|
|
371
|
+
* is left exactly as it is so the page renders its inline fallback copy.
|
|
372
|
+
*/
|
|
373
|
+
export type ComponentPlacementLookup = (componentId: string) => ComponentDetachSource | null | undefined;
|
|
374
|
+
/**
|
|
375
|
+
* Resolve every connected placement in a layout document AHEAD of rendering,
|
|
376
|
+
* producing a document that already contains what each placement draws.
|
|
377
|
+
*
|
|
378
|
+
* WHY THIS EXISTS. The renderer's resolver props (`componentResolver` and
|
|
379
|
+
* friends) are FUNCTIONS, and `renderer.tsx` is a `'use client'` module. A host
|
|
380
|
+
* that resolves components in an async Server Component — which is every real
|
|
381
|
+
* host, because resolution is a database read — cannot pass them: React's flight
|
|
382
|
+
* serializer rejects a function prop with "Functions cannot be passed directly
|
|
383
|
+
* to Client Components", and the page 500s. That was true of module components
|
|
384
|
+
* (kywi-cms#46) and section components (#69) from the day they shipped; nothing
|
|
385
|
+
* caught it because no database in the wild had a `componentId` in a layout, and
|
|
386
|
+
* every test rendered through `renderToString` with no RSC boundary in sight.
|
|
387
|
+
*
|
|
388
|
+
* So resolution moves to where the data already is: the server, before render.
|
|
389
|
+
* The host fetches the definitions it needs, calls this, and hands `KywiLayout`
|
|
390
|
+
* a plain serializable document. No functions cross the boundary.
|
|
391
|
+
*
|
|
392
|
+
* WHAT IT PRODUCES. Materialisation is the same code detaching uses, with the
|
|
393
|
+
* link KEPT rather than dropped — pre-resolution ≡ detach output ≡ what the
|
|
394
|
+
* renderer was supposed to show. Keeping the link is what preserves everything
|
|
395
|
+
* built on it: `data-component-id` in the public DOM, the editor's
|
|
396
|
+
* linked-instance affordance, and the fact that saving the page writes a link
|
|
397
|
+
* back rather than a baked-in copy.
|
|
398
|
+
*
|
|
399
|
+
* Selection is unaffected and needs no ordering care: a pre-resolved variant
|
|
400
|
+
* container is an ordinary container holding the component's arms, so audience
|
|
401
|
+
* matching and A/B assignment run on it exactly as on an inline one — which is
|
|
402
|
+
* also why a pre-resolved page ships the same bytes to the visitor that a native
|
|
403
|
+
* one does (all arms in the document), no more and no less.
|
|
404
|
+
*
|
|
405
|
+
* The operation is idempotent: every placement is re-materialised from the
|
|
406
|
+
* DEFINITION, not from whatever the node currently holds, so running it twice
|
|
407
|
+
* (or on a document that already came back from the editor) yields the same
|
|
408
|
+
* document.
|
|
409
|
+
*
|
|
410
|
+
* ⚠ A PRE-RESOLVED DOCUMENT IS A RENDER ARTEFACT — NEVER FEED IT TO AN EDITOR.
|
|
411
|
+
* Saving one would write the definition's props into every placement, and a
|
|
412
|
+
* clean instance (props empty but for the `componentId` echo) would come back as
|
|
413
|
+
* a LEGACY override node: still linked, but no longer following its component.
|
|
414
|
+
* Hosts must hand the editor / front-edit overlay the STORED layout, which is
|
|
415
|
+
* what both of Kywi's own hosts do — the same rule feed and nav hydration
|
|
416
|
+
* already live by.
|
|
417
|
+
*/
|
|
418
|
+
export declare function resolveComponentPlacements(layout: LayoutDocument | null | undefined, lookup: ComponentPlacementLookup): LayoutDocument;
|
|
419
|
+
/**
|
|
420
|
+
* Bring a document's linked SECTION and CONTAINER fallback copies back in line
|
|
421
|
+
* with the definitions they point at (kywi-cms#147 T4 review, C1).
|
|
422
|
+
*
|
|
423
|
+
* THE BUG THIS EXISTS FOR. A linked section/container stores an inline copy of its
|
|
424
|
+
* definition, and the editor edits that copy — nothing refreshed it when the
|
|
425
|
+
* definition changed elsewhere. "Save and update all instances" then built the new
|
|
426
|
+
* definition out of the page's subtree, so an update-all from a page whose copy was
|
|
427
|
+
* stale REVERTED every newer edit of that component, everywhere, published pages
|
|
428
|
+
* included, without saying a word. Two placements on one page were enough: update
|
|
429
|
+
* from the first, then from the second, and the first edit was gone.
|
|
430
|
+
*
|
|
431
|
+
* So the copy is refreshed BEFORE it can be edited, which makes the baseline the
|
|
432
|
+
* definition and makes update-all a true inverse by construction (see
|
|
433
|
+
* {@link unapplySectionPlacement}). It is also simply what the editor should be
|
|
434
|
+
* showing: the stale copy was on screen.
|
|
435
|
+
*
|
|
436
|
+
* WHAT IT DELIBERATELY DOES NOT TOUCH. Module placements. A clean module instance
|
|
437
|
+
* carries no copy to refresh (the rail reads what it renders through the library),
|
|
438
|
+
* and materialising one would bake the definition's props onto the node — turning a
|
|
439
|
+
* clean instance into a LEGACY override that no longer follows its component, which
|
|
440
|
+
* is precisely the hazard behind "⚠ a pre-resolved document must never reach an
|
|
441
|
+
* editor" on {@link resolveComponentPlacements}. Nothing here writes a node an
|
|
442
|
+
* editor may not save: refreshing a section/container's fallback copy is the same
|
|
443
|
+
* write the connect flows make.
|
|
444
|
+
*
|
|
445
|
+
* ONE CONSEQUENCE TO KNOW ABOUT: IDS. A refreshed copy is the definition re-keyed
|
|
446
|
+
* off the placement (`${placementId}:${definitionId}` — {@link rekeyResolvedSection}),
|
|
447
|
+
* which is what the RENDERER already emits for that placement, so the editor and the
|
|
448
|
+
* public DOM now agree. But a copy stored before this existed carries the ids its
|
|
449
|
+
* clone was given, so the first save after upgrading re-writes the ids inside every
|
|
450
|
+
* linked section/container placement. Nothing inside Kywi minds — responsive style
|
|
451
|
+
* selectors and `data-*` hooks are all re-derived from the same document in the same
|
|
452
|
+
* pass, and the placement's OWN id (the one the instance index and usage counts are
|
|
453
|
+
* keyed on) never changes — but this is the compatibility surface documented at
|
|
454
|
+
* {@link rekeyResolvedVariantContainer}, so hand-written CSS or an analytics selector
|
|
455
|
+
* pinned to an id INSIDE a linked instance sees a new value. That is the cost of the
|
|
456
|
+
* editor and the renderer finally holding the same document; the alternative, keeping
|
|
457
|
+
* the stored ids by matching two trees positionally, cannot survive an edit that
|
|
458
|
+
* restructured one of them.
|
|
459
|
+
*
|
|
460
|
+
* Returns the INPUT document when nothing changed, so a caller can dispatch only
|
|
461
|
+
* on a real difference and never manufacture dirty state out of a no-op.
|
|
462
|
+
*/
|
|
463
|
+
export declare function refreshComponentCopies(layout: LayoutDocument, lookup: ComponentPlacementLookup): LayoutDocument;
|
|
464
|
+
export {};
|
|
465
|
+
//# sourceMappingURL=component-refs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-refs.d.ts","sourceRoot":"","sources":["../../src/layout/component-refs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAEV,cAAc,EACd,aAAa,EACb,UAAU,EAEV,gBAAgB,EAEjB,MAAM,YAAY,CAAA;AAKnB,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG,SAAS,GAAG,kBAAkB,CAAA;AAExE,oEAAoE;AACpE,MAAM,WAAW,YAAY;IAC3B,WAAW,EAAE,MAAM,CAAA;IACnB,kFAAkF;IAClF,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,gBAAgB,CAAA;CACvB;AAED;;;;;;;;;;GAUG;AACH,MAAM,MAAM,iBAAiB,GACzB;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,UAAU,CAAA;CAAE,GACzE;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,aAAa,CAAA;CAAE,GAC7E;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,M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