@contractspec/lib.surface-runtime 0.3.0 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/ai-sdk-stub.js +1 -6
- package/dist/adapters/blocknote-stub.js +3 -8
- package/dist/adapters/dnd-kit-adapter.js +6 -11
- package/dist/adapters/dnd-kit-stub.js +1 -6
- package/dist/adapters/floating-ui-stub.js +4 -9
- package/dist/adapters/index.js +7 -176
- package/dist/adapters/interfaces.js +0 -1
- package/dist/adapters/motion-stub.js +2 -7
- package/dist/adapters/resizable-panels-stub.js +7 -12
- package/dist/browser/adapters/ai-sdk-stub.js +1 -5
- package/dist/browser/adapters/blocknote-stub.js +3 -7
- package/dist/browser/adapters/dnd-kit-adapter.js +6 -10
- package/dist/browser/adapters/dnd-kit-stub.js +1 -5
- package/dist/browser/adapters/floating-ui-stub.js +4 -8
- package/dist/browser/adapters/index.js +7 -175
- package/dist/browser/adapters/motion-stub.js +2 -6
- package/dist/browser/adapters/resizable-panels-stub.js +5 -9
- package/dist/browser/evals/golden-harness.js +4 -825
- package/dist/browser/examples/pm-workbench.bundle.js +2 -316
- package/dist/browser/i18n/catalogs/en.js +1 -5
- package/dist/browser/i18n/catalogs/es.js +1 -5
- package/dist/browser/i18n/catalogs/fr.js +1 -5
- package/dist/browser/i18n/catalogs/index.js +3 -133
- package/dist/browser/i18n/index.js +3 -168
- package/dist/browser/i18n/keys.js +1 -5
- package/dist/browser/i18n/messages.js +6 -137
- package/dist/browser/index.js +4 -2470
- package/dist/browser/react/BundleProvider.js +12 -19
- package/dist/browser/react/BundleRenderer.js +15 -662
- package/dist/browser/react/OverlayConflictResolver.js +12 -180
- package/dist/browser/react/PatchProposalCard.js +9 -177
- package/dist/browser/react/RegionRenderer.js +14 -60
- package/dist/browser/react/SlotRenderer.js +15 -58
- package/dist/browser/react/WidgetPalette.js +6 -10
- package/dist/browser/react/index.js +14 -794
- package/dist/browser/runtime/apply-surface-patch.js +3 -208
- package/dist/browser/runtime/audit-events.js +8 -19
- package/dist/browser/runtime/build-context.js +2 -6
- package/dist/browser/runtime/extension-registry.js +3 -9
- package/dist/browser/runtime/field-renderer-registry.js +5 -11
- package/dist/browser/runtime/index.js +54 -1487
- package/dist/browser/runtime/overlay-alignment.js +8 -19
- package/dist/browser/runtime/overlay-signer.js +2 -7
- package/dist/browser/runtime/override-store.js +3 -9
- package/dist/browser/runtime/planner-prompt.js +2 -6
- package/dist/browser/runtime/planner-tools.js +3 -9
- package/dist/browser/runtime/policy-eval.js +3 -135
- package/dist/browser/runtime/preference-adapter.js +2 -62
- package/dist/browser/runtime/resolve-bundle.js +10 -447
- package/dist/browser/runtime/resolve-preferences.js +3 -7
- package/dist/browser/runtime/rollback.js +2 -325
- package/dist/browser/runtime/widget-registry.js +1 -5
- package/dist/browser/spec/define-module-bundle.js +2 -67
- package/dist/browser/spec/index.js +9 -317
- package/dist/browser/spec/validate-bundle.js +3 -8
- package/dist/browser/spec/validate-surface-patch.js +5 -11
- package/dist/browser/telemetry/index.js +4 -16
- package/dist/browser/telemetry/surface-metrics.js +7 -16
- package/dist/evals/golden-context.js +0 -1
- package/dist/evals/golden-harness.js +4 -826
- package/dist/examples/pm-workbench.bundle.js +2 -317
- package/dist/i18n/catalogs/en.js +1 -6
- package/dist/i18n/catalogs/es.js +1 -6
- package/dist/i18n/catalogs/fr.js +1 -6
- package/dist/i18n/catalogs/index.js +3 -134
- package/dist/i18n/index.js +3 -169
- package/dist/i18n/keys.js +1 -6
- package/dist/i18n/messages.js +6 -138
- package/dist/index.js +4 -2471
- package/dist/node/adapters/ai-sdk-stub.js +1 -5
- package/dist/node/adapters/blocknote-stub.js +3 -7
- package/dist/node/adapters/dnd-kit-adapter.js +6 -10
- package/dist/node/adapters/dnd-kit-stub.js +1 -5
- package/dist/node/adapters/floating-ui-stub.js +4 -8
- package/dist/node/adapters/index.js +7 -175
- package/dist/node/adapters/motion-stub.js +2 -6
- package/dist/node/adapters/resizable-panels-stub.js +5 -9
- package/dist/node/evals/golden-harness.js +4 -825
- package/dist/node/examples/pm-workbench.bundle.js +2 -316
- package/dist/node/i18n/catalogs/en.js +1 -5
- package/dist/node/i18n/catalogs/es.js +1 -5
- package/dist/node/i18n/catalogs/fr.js +1 -5
- package/dist/node/i18n/catalogs/index.js +3 -133
- package/dist/node/i18n/index.js +3 -168
- package/dist/node/i18n/keys.js +1 -5
- package/dist/node/i18n/messages.js +6 -137
- package/dist/node/index.js +4 -2470
- package/dist/node/react/BundleProvider.js +12 -19
- package/dist/node/react/BundleRenderer.js +15 -662
- package/dist/node/react/OverlayConflictResolver.js +12 -180
- package/dist/node/react/PatchProposalCard.js +9 -177
- package/dist/node/react/RegionRenderer.js +14 -60
- package/dist/node/react/SlotRenderer.js +15 -58
- package/dist/node/react/WidgetPalette.js +6 -10
- package/dist/node/react/index.js +14 -794
- package/dist/node/runtime/apply-surface-patch.js +3 -208
- package/dist/node/runtime/audit-events.js +8 -19
- package/dist/node/runtime/build-context.js +2 -6
- package/dist/node/runtime/extension-registry.js +3 -9
- package/dist/node/runtime/field-renderer-registry.js +5 -11
- package/dist/node/runtime/index.js +54 -1487
- package/dist/node/runtime/overlay-alignment.js +8 -19
- package/dist/node/runtime/overlay-signer.js +2 -7
- package/dist/node/runtime/override-store.js +3 -9
- package/dist/node/runtime/planner-prompt.js +2 -6
- package/dist/node/runtime/planner-tools.js +3 -9
- package/dist/node/runtime/policy-eval.js +3 -135
- package/dist/node/runtime/preference-adapter.js +2 -62
- package/dist/node/runtime/resolve-bundle.js +10 -447
- package/dist/node/runtime/resolve-preferences.js +3 -7
- package/dist/node/runtime/rollback.js +2 -325
- package/dist/node/runtime/widget-registry.js +1 -5
- package/dist/node/spec/define-module-bundle.js +2 -67
- package/dist/node/spec/index.js +9 -317
- package/dist/node/spec/validate-bundle.js +3 -8
- package/dist/node/spec/validate-surface-patch.js +5 -11
- package/dist/node/telemetry/index.js +4 -16
- package/dist/node/telemetry/surface-metrics.js +7 -16
- package/dist/react/BundleProvider.js +12 -20
- package/dist/react/BundleRenderer.js +15 -663
- package/dist/react/OverlayConflictResolver.js +12 -181
- package/dist/react/PatchProposalCard.js +9 -178
- package/dist/react/RegionRenderer.js +14 -61
- package/dist/react/SlotRenderer.js +15 -59
- package/dist/react/WidgetPalette.js +6 -11
- package/dist/react/index.js +14 -795
- package/dist/runtime/apply-surface-patch.js +3 -209
- package/dist/runtime/audit-events.js +8 -20
- package/dist/runtime/build-context.js +2 -7
- package/dist/runtime/extension-registry.js +3 -10
- package/dist/runtime/field-renderer-registry.js +9 -16
- package/dist/runtime/index.js +54 -1488
- package/dist/runtime/overlay-alignment.js +8 -20
- package/dist/runtime/overlay-signer.js +2 -8
- package/dist/runtime/override-store.js +3 -10
- package/dist/runtime/planner-prompt.js +11 -9
- package/dist/runtime/planner-tools.js +4 -11
- package/dist/runtime/policy-eval.js +3 -136
- package/dist/runtime/preference-adapter.js +2 -63
- package/dist/runtime/resolve-bundle.js +10 -448
- package/dist/runtime/resolve-preferences.js +3 -8
- package/dist/runtime/rollback.js +2 -326
- package/dist/runtime/widget-registry.js +1 -6
- package/dist/spec/define-module-bundle.js +2 -68
- package/dist/spec/index.js +9 -318
- package/dist/spec/types.js +0 -1
- package/dist/spec/validate-bundle.js +3 -9
- package/dist/spec/validate-surface-patch.js +5 -12
- package/dist/spec/verification-snapshot-types.js +0 -1
- package/dist/telemetry/index.js +4 -17
- package/dist/telemetry/surface-metrics.js +7 -17
- package/package.json +7 -7
|
@@ -1,316 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
"insert-node",
|
|
4
|
-
"replace-node",
|
|
5
|
-
"remove-node",
|
|
6
|
-
"move-node",
|
|
7
|
-
"resize-panel",
|
|
8
|
-
"set-layout",
|
|
9
|
-
"reveal-field",
|
|
10
|
-
"hide-field",
|
|
11
|
-
"promote-action",
|
|
12
|
-
"set-focus"
|
|
13
|
-
];
|
|
14
|
-
var VALID_NODE_KINDS = [
|
|
15
|
-
"metric-strip",
|
|
16
|
-
"data-view",
|
|
17
|
-
"entity-card",
|
|
18
|
-
"entity-header",
|
|
19
|
-
"entity-summary",
|
|
20
|
-
"entity-section",
|
|
21
|
-
"entity-field",
|
|
22
|
-
"entity-activity",
|
|
23
|
-
"entity-relations",
|
|
24
|
-
"entity-timeline",
|
|
25
|
-
"entity-comments",
|
|
26
|
-
"entity-attachments",
|
|
27
|
-
"entity-view-switcher",
|
|
28
|
-
"entity-automation-panel",
|
|
29
|
-
"rich-doc",
|
|
30
|
-
"chat-thread",
|
|
31
|
-
"assistant-panel",
|
|
32
|
-
"action-bar",
|
|
33
|
-
"timeline",
|
|
34
|
-
"board",
|
|
35
|
-
"table",
|
|
36
|
-
"calendar",
|
|
37
|
-
"form",
|
|
38
|
-
"chart",
|
|
39
|
-
"relation-graph",
|
|
40
|
-
"custom-widget"
|
|
41
|
-
];
|
|
42
|
-
function validateSurfaceNode(node, path) {
|
|
43
|
-
if (!node.nodeId || typeof node.nodeId !== "string") {
|
|
44
|
-
throw new Error(`${path}: nodeId must be a non-empty string`);
|
|
45
|
-
}
|
|
46
|
-
if (!node.kind || !VALID_NODE_KINDS.includes(node.kind)) {
|
|
47
|
-
throw new Error(`${path}: kind must be one of ${VALID_NODE_KINDS.join(", ")}`);
|
|
48
|
-
}
|
|
49
|
-
if (node.children) {
|
|
50
|
-
for (let i = 0;i < node.children.length; i++) {
|
|
51
|
-
const child = node.children[i];
|
|
52
|
-
if (child)
|
|
53
|
-
validateSurfaceNode(child, `${path}.children[${i}]`);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
function validateSurfacePatchOp(op, index) {
|
|
58
|
-
const path = `ops[${index}]`;
|
|
59
|
-
if (!op || typeof op !== "object" || !("op" in op)) {
|
|
60
|
-
throw new Error(`${path}: must be an object with op field`);
|
|
61
|
-
}
|
|
62
|
-
const opType = op.op;
|
|
63
|
-
if (!VALID_OPS.includes(opType)) {
|
|
64
|
-
throw new Error(`${path}: op must be one of ${VALID_OPS.join(", ")}`);
|
|
65
|
-
}
|
|
66
|
-
switch (op.op) {
|
|
67
|
-
case "insert-node":
|
|
68
|
-
if (!op.slotId || typeof op.slotId !== "string") {
|
|
69
|
-
throw new Error(`${path}: insert-node requires slotId string`);
|
|
70
|
-
}
|
|
71
|
-
if (!op.node) {
|
|
72
|
-
throw new Error(`${path}: insert-node requires node`);
|
|
73
|
-
}
|
|
74
|
-
validateSurfaceNode(op.node, `${path}.node`);
|
|
75
|
-
if (op.index !== undefined && typeof op.index !== "number") {
|
|
76
|
-
throw new Error(`${path}: insert-node index must be number if present`);
|
|
77
|
-
}
|
|
78
|
-
break;
|
|
79
|
-
case "replace-node":
|
|
80
|
-
if (!op.nodeId || typeof op.nodeId !== "string") {
|
|
81
|
-
throw new Error(`${path}: replace-node requires nodeId string`);
|
|
82
|
-
}
|
|
83
|
-
if (!op.node) {
|
|
84
|
-
throw new Error(`${path}: replace-node requires node`);
|
|
85
|
-
}
|
|
86
|
-
validateSurfaceNode(op.node, `${path}.node`);
|
|
87
|
-
break;
|
|
88
|
-
case "remove-node":
|
|
89
|
-
if (!op.nodeId || typeof op.nodeId !== "string") {
|
|
90
|
-
throw new Error(`${path}: remove-node requires nodeId string`);
|
|
91
|
-
}
|
|
92
|
-
break;
|
|
93
|
-
case "move-node":
|
|
94
|
-
if (!op.nodeId || typeof op.nodeId !== "string") {
|
|
95
|
-
throw new Error(`${path}: move-node requires nodeId string`);
|
|
96
|
-
}
|
|
97
|
-
if (!op.toSlotId || typeof op.toSlotId !== "string") {
|
|
98
|
-
throw new Error(`${path}: move-node requires toSlotId string`);
|
|
99
|
-
}
|
|
100
|
-
if (op.index !== undefined && typeof op.index !== "number") {
|
|
101
|
-
throw new Error(`${path}: move-node index must be number if present`);
|
|
102
|
-
}
|
|
103
|
-
break;
|
|
104
|
-
case "resize-panel":
|
|
105
|
-
if (!op.persistKey || typeof op.persistKey !== "string") {
|
|
106
|
-
throw new Error(`${path}: resize-panel requires persistKey string`);
|
|
107
|
-
}
|
|
108
|
-
if (!Array.isArray(op.sizes) || op.sizes.some((s) => typeof s !== "number")) {
|
|
109
|
-
throw new Error(`${path}: resize-panel requires sizes number[]`);
|
|
110
|
-
}
|
|
111
|
-
break;
|
|
112
|
-
case "set-layout":
|
|
113
|
-
if (!op.layoutId || typeof op.layoutId !== "string") {
|
|
114
|
-
throw new Error(`${path}: set-layout requires layoutId string`);
|
|
115
|
-
}
|
|
116
|
-
break;
|
|
117
|
-
case "reveal-field":
|
|
118
|
-
case "hide-field":
|
|
119
|
-
if (!op.fieldId || typeof op.fieldId !== "string") {
|
|
120
|
-
throw new Error(`${path}: ${op.op} requires fieldId string`);
|
|
121
|
-
}
|
|
122
|
-
break;
|
|
123
|
-
case "promote-action": {
|
|
124
|
-
if (!op.actionId || typeof op.actionId !== "string") {
|
|
125
|
-
throw new Error(`${path}: promote-action requires actionId string`);
|
|
126
|
-
}
|
|
127
|
-
const validPlacements = ["header", "inline", "context", "assistant"];
|
|
128
|
-
if (!op.placement || !validPlacements.includes(op.placement)) {
|
|
129
|
-
throw new Error(`${path}: promote-action placement must be one of ${validPlacements.join(", ")}`);
|
|
130
|
-
}
|
|
131
|
-
break;
|
|
132
|
-
}
|
|
133
|
-
case "set-focus":
|
|
134
|
-
if (!op.targetId || typeof op.targetId !== "string") {
|
|
135
|
-
throw new Error(`${path}: set-focus requires targetId string`);
|
|
136
|
-
}
|
|
137
|
-
break;
|
|
138
|
-
default:
|
|
139
|
-
throw new Error(`${path}: unknown op "${opType}"`);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
function validateSurfacePatch(ops) {
|
|
143
|
-
if (!Array.isArray(ops)) {
|
|
144
|
-
throw new Error("Patch ops must be an array");
|
|
145
|
-
}
|
|
146
|
-
for (let i = 0;i < ops.length; i++) {
|
|
147
|
-
const op = ops[i];
|
|
148
|
-
if (op)
|
|
149
|
-
validateSurfacePatchOp(op, i);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
function validateSurfaceNodeAgainstKinds(node, allowedKinds, path) {
|
|
153
|
-
if (!allowedKinds.includes(node.kind)) {
|
|
154
|
-
throw new Error(`${path}: kind "${node.kind}" not in allowed list [${allowedKinds.join(", ")}]`);
|
|
155
|
-
}
|
|
156
|
-
if (node.children) {
|
|
157
|
-
for (let i = 0;i < node.children.length; i++) {
|
|
158
|
-
const child = node.children[i];
|
|
159
|
-
if (child)
|
|
160
|
-
validateSurfaceNodeAgainstKinds(child, allowedKinds, `${path}.children[${i}]`);
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
function validatePatchProposal(ops, constraints) {
|
|
165
|
-
if (!Array.isArray(ops)) {
|
|
166
|
-
throw new Error("Patch ops must be an array");
|
|
167
|
-
}
|
|
168
|
-
const { allowedOps, allowedSlots, allowedNodeKinds } = constraints;
|
|
169
|
-
for (let i = 0;i < ops.length; i++) {
|
|
170
|
-
const op = ops[i];
|
|
171
|
-
if (!op)
|
|
172
|
-
continue;
|
|
173
|
-
const path = `ops[${i}]`;
|
|
174
|
-
if (!allowedOps.includes(op.op)) {
|
|
175
|
-
throw new Error(`${path}: op "${op.op}" not in allowed list [${allowedOps.join(", ")}]`);
|
|
176
|
-
}
|
|
177
|
-
switch (op.op) {
|
|
178
|
-
case "insert-node":
|
|
179
|
-
if (!allowedSlots.includes(op.slotId)) {
|
|
180
|
-
throw new Error(`${path}: slotId "${op.slotId}" not in allowed slots [${allowedSlots.join(", ")}]`);
|
|
181
|
-
}
|
|
182
|
-
if (op.node) {
|
|
183
|
-
validateSurfaceNodeAgainstKinds(op.node, allowedNodeKinds, `${path}.node`);
|
|
184
|
-
}
|
|
185
|
-
break;
|
|
186
|
-
case "move-node":
|
|
187
|
-
if (!allowedSlots.includes(op.toSlotId)) {
|
|
188
|
-
throw new Error(`${path}: toSlotId "${op.toSlotId}" not in allowed slots [${allowedSlots.join(", ")}]`);
|
|
189
|
-
}
|
|
190
|
-
break;
|
|
191
|
-
case "replace-node":
|
|
192
|
-
if (op.node) {
|
|
193
|
-
validateSurfaceNodeAgainstKinds(op.node, allowedNodeKinds, `${path}.node`);
|
|
194
|
-
}
|
|
195
|
-
break;
|
|
196
|
-
default:
|
|
197
|
-
break;
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
validateSurfacePatch(ops);
|
|
201
|
-
}
|
|
202
|
-
// src/spec/validate-bundle.ts
|
|
203
|
-
var KNOWN_NODE_KIND_RENDERERS = new Set([
|
|
204
|
-
"entity-section",
|
|
205
|
-
"entity-field",
|
|
206
|
-
"action-bar",
|
|
207
|
-
"table",
|
|
208
|
-
"timeline",
|
|
209
|
-
"rich-doc",
|
|
210
|
-
"chat-thread",
|
|
211
|
-
"assistant-panel",
|
|
212
|
-
"entity-card",
|
|
213
|
-
"entity-header",
|
|
214
|
-
"entity-summary",
|
|
215
|
-
"entity-activity",
|
|
216
|
-
"entity-relations",
|
|
217
|
-
"relation-graph",
|
|
218
|
-
"custom-widget"
|
|
219
|
-
]);
|
|
220
|
-
function collectSlotIdsFromRegion(node) {
|
|
221
|
-
const ids = [];
|
|
222
|
-
if (node.type === "slot") {
|
|
223
|
-
ids.push(node.slotId);
|
|
224
|
-
}
|
|
225
|
-
if (node.type === "panel-group" || node.type === "stack") {
|
|
226
|
-
for (const child of node.children) {
|
|
227
|
-
ids.push(...collectSlotIdsFromRegion(child));
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
if (node.type === "tabs") {
|
|
231
|
-
for (const tab of node.tabs) {
|
|
232
|
-
ids.push(...collectSlotIdsFromRegion(tab.child));
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
if (node.type === "floating") {
|
|
236
|
-
ids.push(node.anchorSlotId);
|
|
237
|
-
ids.push(...collectSlotIdsFromRegion(node.child));
|
|
238
|
-
}
|
|
239
|
-
return ids;
|
|
240
|
-
}
|
|
241
|
-
function validateLayoutSlots(surface) {
|
|
242
|
-
const declaredSlotIds = new Set(surface.slots.map((s) => s.slotId));
|
|
243
|
-
for (const layout of surface.layouts) {
|
|
244
|
-
const layoutSlotIds = collectSlotIdsFromRegion(layout.root);
|
|
245
|
-
for (const slotId of layoutSlotIds) {
|
|
246
|
-
if (!declaredSlotIds.has(slotId)) {
|
|
247
|
-
throw new Error(`Surface "${surface.surfaceId}" layout "${layout.layoutId}" references undeclared slot "${slotId}". Declared slots: ${[...declaredSlotIds].join(", ")}`);
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
function validateBundleNodeKinds(surface) {
|
|
253
|
-
const warnings = [];
|
|
254
|
-
for (const slot of surface.slots) {
|
|
255
|
-
for (const kind of slot.accepts) {
|
|
256
|
-
if (!KNOWN_NODE_KIND_RENDERERS.has(kind)) {
|
|
257
|
-
warnings.push(`Surface "${surface.surfaceId}" slot "${slot.slotId}" accepts "${kind}" which has no dedicated renderer (generic fallback used)`);
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
return { warnings };
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
// src/spec/define-module-bundle.ts
|
|
265
|
-
function defineModuleBundle(spec) {
|
|
266
|
-
if (!spec.meta?.key || !spec.meta?.version || !spec.meta?.title) {
|
|
267
|
-
throw new Error("ModuleBundleSpec must have meta.key, meta.version, and meta.title");
|
|
268
|
-
}
|
|
269
|
-
if (!spec.routes?.length) {
|
|
270
|
-
throw new Error("ModuleBundleSpec must have at least one route");
|
|
271
|
-
}
|
|
272
|
-
if (!spec.surfaces || Object.keys(spec.surfaces).length === 0) {
|
|
273
|
-
throw new Error("ModuleBundleSpec must have at least one surface");
|
|
274
|
-
}
|
|
275
|
-
if (spec.entities) {
|
|
276
|
-
if (!spec.entities.entityTypes || typeof spec.entities.entityTypes !== "object") {
|
|
277
|
-
throw new Error("ModuleBundleSpec.entities must have entityTypes object when present");
|
|
278
|
-
}
|
|
279
|
-
if (!spec.entities.fieldKinds || typeof spec.entities.fieldKinds !== "object") {
|
|
280
|
-
throw new Error("ModuleBundleSpec.entities must have fieldKinds object when present");
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
const REQUIRED_DIMENSIONS = [
|
|
284
|
-
"guidance",
|
|
285
|
-
"density",
|
|
286
|
-
"dataDepth",
|
|
287
|
-
"control",
|
|
288
|
-
"media",
|
|
289
|
-
"pace",
|
|
290
|
-
"narrative"
|
|
291
|
-
];
|
|
292
|
-
const MIN_DESCRIPTION_LENGTH = 10;
|
|
293
|
-
for (const surface of Object.values(spec.surfaces)) {
|
|
294
|
-
if (!surface.verification?.dimensions) {
|
|
295
|
-
throw new Error(`Surface "${surface.surfaceId}" must have verification.dimensions for all 7 preference dimensions`);
|
|
296
|
-
}
|
|
297
|
-
const dims = surface.verification.dimensions;
|
|
298
|
-
for (const d of REQUIRED_DIMENSIONS) {
|
|
299
|
-
const val = dims[d];
|
|
300
|
-
if (!val || typeof val !== "string") {
|
|
301
|
-
throw new Error(`Surface "${surface.surfaceId}" verification.dimensions.${d} must be a non-empty string`);
|
|
302
|
-
}
|
|
303
|
-
const trimmed = val.trim();
|
|
304
|
-
if (trimmed.length < MIN_DESCRIPTION_LENGTH) {
|
|
305
|
-
throw new Error(`Surface "${surface.surfaceId}" verification.dimensions.${d} must be at least ${MIN_DESCRIPTION_LENGTH} characters (got ${trimmed.length})`);
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
validateLayoutSlots(surface);
|
|
309
|
-
}
|
|
310
|
-
return spec;
|
|
311
|
-
}
|
|
312
|
-
// src/examples/pm-workbench.bundle.ts
|
|
313
|
-
var PmWorkbenchBundle = defineModuleBundle({
|
|
1
|
+
import { defineModuleBundle } from "../spec/index";
|
|
2
|
+
export const PmWorkbenchBundle = defineModuleBundle({
|
|
314
3
|
meta: {
|
|
315
4
|
key: "pm.workbench",
|
|
316
5
|
version: "0.1.0",
|
|
@@ -471,6 +160,3 @@ var PmWorkbenchBundle = defineModuleBundle({
|
|
|
471
160
|
}
|
|
472
161
|
}
|
|
473
162
|
});
|
|
474
|
-
export {
|
|
475
|
-
PmWorkbenchBundle
|
|
476
|
-
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
// src/i18n/catalogs/en.ts
|
|
2
1
|
import { defineTranslation } from "@contractspec/lib.contracts-spec/translations";
|
|
3
|
-
|
|
2
|
+
export const enMessages = defineTranslation({
|
|
4
3
|
meta: {
|
|
5
4
|
key: "surface-runtime.messages",
|
|
6
5
|
version: "1.0.0",
|
|
@@ -66,6 +65,3 @@ var enMessages = defineTranslation({
|
|
|
66
65
|
}
|
|
67
66
|
}
|
|
68
67
|
});
|
|
69
|
-
export {
|
|
70
|
-
enMessages
|
|
71
|
-
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
// src/i18n/catalogs/es.ts
|
|
2
1
|
import { defineTranslation } from "@contractspec/lib.contracts-spec/translations";
|
|
3
|
-
|
|
2
|
+
export const esMessages = defineTranslation({
|
|
4
3
|
meta: {
|
|
5
4
|
key: "surface-runtime.messages",
|
|
6
5
|
version: "1.0.0",
|
|
@@ -27,6 +26,3 @@ var esMessages = defineTranslation({
|
|
|
27
26
|
"patch.changes": { value: "{count} cambios" }
|
|
28
27
|
}
|
|
29
28
|
});
|
|
30
|
-
export {
|
|
31
|
-
esMessages
|
|
32
|
-
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
// src/i18n/catalogs/fr.ts
|
|
2
1
|
import { defineTranslation } from "@contractspec/lib.contracts-spec/translations";
|
|
3
|
-
|
|
2
|
+
export const frMessages = defineTranslation({
|
|
4
3
|
meta: {
|
|
5
4
|
key: "surface-runtime.messages",
|
|
6
5
|
version: "1.0.0",
|
|
@@ -27,6 +26,3 @@ var frMessages = defineTranslation({
|
|
|
27
26
|
"patch.changes": { value: "{count} modifications" }
|
|
28
27
|
}
|
|
29
28
|
});
|
|
30
|
-
export {
|
|
31
|
-
frMessages
|
|
32
|
-
};
|
|
@@ -1,133 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
meta: {
|
|
5
|
-
key: "surface-runtime.messages",
|
|
6
|
-
version: "1.0.0",
|
|
7
|
-
domain: "surface-runtime",
|
|
8
|
-
description: "User-facing strings for surface-runtime UI components",
|
|
9
|
-
owners: ["platform"],
|
|
10
|
-
stability: "experimental"
|
|
11
|
-
},
|
|
12
|
-
locale: "en",
|
|
13
|
-
fallback: "en",
|
|
14
|
-
messages: {
|
|
15
|
-
"overlay.conflicts.title": {
|
|
16
|
-
value: "Overlay conflicts",
|
|
17
|
-
description: "Title for overlay conflict resolution banner"
|
|
18
|
-
},
|
|
19
|
-
"overlay.conflicts.keepScope": {
|
|
20
|
-
value: "Keep {scope}",
|
|
21
|
-
description: "Button to keep overlay from scope A or B"
|
|
22
|
-
},
|
|
23
|
-
"patch.accept": {
|
|
24
|
-
value: "Accept",
|
|
25
|
-
description: "Accept patch proposal button"
|
|
26
|
-
},
|
|
27
|
-
"patch.reject": {
|
|
28
|
-
value: "Reject",
|
|
29
|
-
description: "Reject patch proposal button"
|
|
30
|
-
},
|
|
31
|
-
"patch.addWidget": {
|
|
32
|
-
value: "Add {title} to {slot}",
|
|
33
|
-
description: "Insert node proposal summary"
|
|
34
|
-
},
|
|
35
|
-
"patch.removeItem": {
|
|
36
|
-
value: "Remove item",
|
|
37
|
-
description: "Remove node proposal summary"
|
|
38
|
-
},
|
|
39
|
-
"patch.switchLayout": {
|
|
40
|
-
value: "Switch to {layoutId} layout",
|
|
41
|
-
description: "Set layout proposal summary"
|
|
42
|
-
},
|
|
43
|
-
"patch.showField": {
|
|
44
|
-
value: "Show field {fieldId}",
|
|
45
|
-
description: "Reveal field proposal summary"
|
|
46
|
-
},
|
|
47
|
-
"patch.hideField": {
|
|
48
|
-
value: "Hide field {fieldId}",
|
|
49
|
-
description: "Hide field proposal summary"
|
|
50
|
-
},
|
|
51
|
-
"patch.moveTo": {
|
|
52
|
-
value: "Move to {slot}",
|
|
53
|
-
description: "Move node proposal summary"
|
|
54
|
-
},
|
|
55
|
-
"patch.replaceItem": {
|
|
56
|
-
value: "Replace item",
|
|
57
|
-
description: "Replace node proposal summary"
|
|
58
|
-
},
|
|
59
|
-
"patch.promote": {
|
|
60
|
-
value: "Promote {actionId}",
|
|
61
|
-
description: "Promote action proposal summary"
|
|
62
|
-
},
|
|
63
|
-
"patch.changes": {
|
|
64
|
-
value: "{count} changes",
|
|
65
|
-
description: "Multiple patch ops summary"
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
// src/i18n/catalogs/es.ts
|
|
71
|
-
import { defineTranslation as defineTranslation2 } from "@contractspec/lib.contracts-spec/translations";
|
|
72
|
-
var esMessages = defineTranslation2({
|
|
73
|
-
meta: {
|
|
74
|
-
key: "surface-runtime.messages",
|
|
75
|
-
version: "1.0.0",
|
|
76
|
-
domain: "surface-runtime",
|
|
77
|
-
description: "User-facing strings for surface-runtime UI components",
|
|
78
|
-
owners: ["platform"],
|
|
79
|
-
stability: "experimental"
|
|
80
|
-
},
|
|
81
|
-
locale: "es",
|
|
82
|
-
fallback: "en",
|
|
83
|
-
messages: {
|
|
84
|
-
"overlay.conflicts.title": { value: "Conflictos de superposición" },
|
|
85
|
-
"overlay.conflicts.keepScope": { value: "Mantener {scope}" },
|
|
86
|
-
"patch.accept": { value: "Aceptar" },
|
|
87
|
-
"patch.reject": { value: "Rechazar" },
|
|
88
|
-
"patch.addWidget": { value: "Añadir {title} a {slot}" },
|
|
89
|
-
"patch.removeItem": { value: "Eliminar elemento" },
|
|
90
|
-
"patch.switchLayout": { value: "Cambiar a disposición {layoutId}" },
|
|
91
|
-
"patch.showField": { value: "Mostrar campo {fieldId}" },
|
|
92
|
-
"patch.hideField": { value: "Ocultar campo {fieldId}" },
|
|
93
|
-
"patch.moveTo": { value: "Mover a {slot}" },
|
|
94
|
-
"patch.replaceItem": { value: "Reemplazar elemento" },
|
|
95
|
-
"patch.promote": { value: "Promover {actionId}" },
|
|
96
|
-
"patch.changes": { value: "{count} cambios" }
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
// src/i18n/catalogs/fr.ts
|
|
101
|
-
import { defineTranslation as defineTranslation3 } from "@contractspec/lib.contracts-spec/translations";
|
|
102
|
-
var frMessages = defineTranslation3({
|
|
103
|
-
meta: {
|
|
104
|
-
key: "surface-runtime.messages",
|
|
105
|
-
version: "1.0.0",
|
|
106
|
-
domain: "surface-runtime",
|
|
107
|
-
description: "User-facing strings for surface-runtime UI components",
|
|
108
|
-
owners: ["platform"],
|
|
109
|
-
stability: "experimental"
|
|
110
|
-
},
|
|
111
|
-
locale: "fr",
|
|
112
|
-
fallback: "en",
|
|
113
|
-
messages: {
|
|
114
|
-
"overlay.conflicts.title": { value: "Conflits de superposition" },
|
|
115
|
-
"overlay.conflicts.keepScope": { value: "Conserver {scope}" },
|
|
116
|
-
"patch.accept": { value: "Accepter" },
|
|
117
|
-
"patch.reject": { value: "Rejeter" },
|
|
118
|
-
"patch.addWidget": { value: "Ajouter {title} à {slot}" },
|
|
119
|
-
"patch.removeItem": { value: "Supprimer l'élément" },
|
|
120
|
-
"patch.switchLayout": { value: "Passer à la disposition {layoutId}" },
|
|
121
|
-
"patch.showField": { value: "Afficher le champ {fieldId}" },
|
|
122
|
-
"patch.hideField": { value: "Masquer le champ {fieldId}" },
|
|
123
|
-
"patch.moveTo": { value: "Déplacer vers {slot}" },
|
|
124
|
-
"patch.replaceItem": { value: "Remplacer l'élément" },
|
|
125
|
-
"patch.promote": { value: "Promouvoir {actionId}" },
|
|
126
|
-
"patch.changes": { value: "{count} modifications" }
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
|
-
export {
|
|
130
|
-
frMessages,
|
|
131
|
-
esMessages,
|
|
132
|
-
enMessages
|
|
133
|
-
};
|
|
1
|
+
export { enMessages } from "./en";
|
|
2
|
+
export { frMessages } from "./fr";
|
|
3
|
+
export { esMessages } from "./es";
|
|
@@ -1,173 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
meta: {
|
|
5
|
-
key: "surface-runtime.messages",
|
|
6
|
-
version: "1.0.0",
|
|
7
|
-
domain: "surface-runtime",
|
|
8
|
-
description: "User-facing strings for surface-runtime UI components",
|
|
9
|
-
owners: ["platform"],
|
|
10
|
-
stability: "experimental"
|
|
11
|
-
},
|
|
12
|
-
locale: "en",
|
|
13
|
-
fallback: "en",
|
|
14
|
-
messages: {
|
|
15
|
-
"overlay.conflicts.title": {
|
|
16
|
-
value: "Overlay conflicts",
|
|
17
|
-
description: "Title for overlay conflict resolution banner"
|
|
18
|
-
},
|
|
19
|
-
"overlay.conflicts.keepScope": {
|
|
20
|
-
value: "Keep {scope}",
|
|
21
|
-
description: "Button to keep overlay from scope A or B"
|
|
22
|
-
},
|
|
23
|
-
"patch.accept": {
|
|
24
|
-
value: "Accept",
|
|
25
|
-
description: "Accept patch proposal button"
|
|
26
|
-
},
|
|
27
|
-
"patch.reject": {
|
|
28
|
-
value: "Reject",
|
|
29
|
-
description: "Reject patch proposal button"
|
|
30
|
-
},
|
|
31
|
-
"patch.addWidget": {
|
|
32
|
-
value: "Add {title} to {slot}",
|
|
33
|
-
description: "Insert node proposal summary"
|
|
34
|
-
},
|
|
35
|
-
"patch.removeItem": {
|
|
36
|
-
value: "Remove item",
|
|
37
|
-
description: "Remove node proposal summary"
|
|
38
|
-
},
|
|
39
|
-
"patch.switchLayout": {
|
|
40
|
-
value: "Switch to {layoutId} layout",
|
|
41
|
-
description: "Set layout proposal summary"
|
|
42
|
-
},
|
|
43
|
-
"patch.showField": {
|
|
44
|
-
value: "Show field {fieldId}",
|
|
45
|
-
description: "Reveal field proposal summary"
|
|
46
|
-
},
|
|
47
|
-
"patch.hideField": {
|
|
48
|
-
value: "Hide field {fieldId}",
|
|
49
|
-
description: "Hide field proposal summary"
|
|
50
|
-
},
|
|
51
|
-
"patch.moveTo": {
|
|
52
|
-
value: "Move to {slot}",
|
|
53
|
-
description: "Move node proposal summary"
|
|
54
|
-
},
|
|
55
|
-
"patch.replaceItem": {
|
|
56
|
-
value: "Replace item",
|
|
57
|
-
description: "Replace node proposal summary"
|
|
58
|
-
},
|
|
59
|
-
"patch.promote": {
|
|
60
|
-
value: "Promote {actionId}",
|
|
61
|
-
description: "Promote action proposal summary"
|
|
62
|
-
},
|
|
63
|
-
"patch.changes": {
|
|
64
|
-
value: "{count} changes",
|
|
65
|
-
description: "Multiple patch ops summary"
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
// src/i18n/catalogs/es.ts
|
|
71
|
-
import { defineTranslation as defineTranslation2 } from "@contractspec/lib.contracts-spec/translations";
|
|
72
|
-
var esMessages = defineTranslation2({
|
|
73
|
-
meta: {
|
|
74
|
-
key: "surface-runtime.messages",
|
|
75
|
-
version: "1.0.0",
|
|
76
|
-
domain: "surface-runtime",
|
|
77
|
-
description: "User-facing strings for surface-runtime UI components",
|
|
78
|
-
owners: ["platform"],
|
|
79
|
-
stability: "experimental"
|
|
80
|
-
},
|
|
81
|
-
locale: "es",
|
|
82
|
-
fallback: "en",
|
|
83
|
-
messages: {
|
|
84
|
-
"overlay.conflicts.title": { value: "Conflictos de superposición" },
|
|
85
|
-
"overlay.conflicts.keepScope": { value: "Mantener {scope}" },
|
|
86
|
-
"patch.accept": { value: "Aceptar" },
|
|
87
|
-
"patch.reject": { value: "Rechazar" },
|
|
88
|
-
"patch.addWidget": { value: "Añadir {title} a {slot}" },
|
|
89
|
-
"patch.removeItem": { value: "Eliminar elemento" },
|
|
90
|
-
"patch.switchLayout": { value: "Cambiar a disposición {layoutId}" },
|
|
91
|
-
"patch.showField": { value: "Mostrar campo {fieldId}" },
|
|
92
|
-
"patch.hideField": { value: "Ocultar campo {fieldId}" },
|
|
93
|
-
"patch.moveTo": { value: "Mover a {slot}" },
|
|
94
|
-
"patch.replaceItem": { value: "Reemplazar elemento" },
|
|
95
|
-
"patch.promote": { value: "Promover {actionId}" },
|
|
96
|
-
"patch.changes": { value: "{count} cambios" }
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
// src/i18n/catalogs/fr.ts
|
|
101
|
-
import { defineTranslation as defineTranslation3 } from "@contractspec/lib.contracts-spec/translations";
|
|
102
|
-
var frMessages = defineTranslation3({
|
|
103
|
-
meta: {
|
|
104
|
-
key: "surface-runtime.messages",
|
|
105
|
-
version: "1.0.0",
|
|
106
|
-
domain: "surface-runtime",
|
|
107
|
-
description: "User-facing strings for surface-runtime UI components",
|
|
108
|
-
owners: ["platform"],
|
|
109
|
-
stability: "experimental"
|
|
110
|
-
},
|
|
111
|
-
locale: "fr",
|
|
112
|
-
fallback: "en",
|
|
113
|
-
messages: {
|
|
114
|
-
"overlay.conflicts.title": { value: "Conflits de superposition" },
|
|
115
|
-
"overlay.conflicts.keepScope": { value: "Conserver {scope}" },
|
|
116
|
-
"patch.accept": { value: "Accepter" },
|
|
117
|
-
"patch.reject": { value: "Rejeter" },
|
|
118
|
-
"patch.addWidget": { value: "Ajouter {title} à {slot}" },
|
|
119
|
-
"patch.removeItem": { value: "Supprimer l'élément" },
|
|
120
|
-
"patch.switchLayout": { value: "Passer à la disposition {layoutId}" },
|
|
121
|
-
"patch.showField": { value: "Afficher le champ {fieldId}" },
|
|
122
|
-
"patch.hideField": { value: "Masquer le champ {fieldId}" },
|
|
123
|
-
"patch.moveTo": { value: "Déplacer vers {slot}" },
|
|
124
|
-
"patch.replaceItem": { value: "Remplacer l'élément" },
|
|
125
|
-
"patch.promote": { value: "Promouvoir {actionId}" },
|
|
126
|
-
"patch.changes": { value: "{count} modifications" }
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
// src/i18n/messages.ts
|
|
131
|
-
import {
|
|
132
|
-
createI18nFactory
|
|
133
|
-
} from "@contractspec/lib.contracts-spec/translations";
|
|
134
|
-
var factory = createI18nFactory({
|
|
135
|
-
specKey: "surface-runtime.messages",
|
|
136
|
-
catalogs: [enMessages, frMessages, esMessages]
|
|
137
|
-
});
|
|
138
|
-
var createSurfaceI18n = factory.create;
|
|
139
|
-
var getDefaultSurfaceI18n = factory.getDefault;
|
|
140
|
-
|
|
141
|
-
// src/i18n/keys.ts
|
|
142
|
-
var SURFACE_KEYS = {
|
|
143
|
-
"overlay.conflicts.title": "overlay.conflicts.title",
|
|
144
|
-
"overlay.conflicts.keepScope": "overlay.conflicts.keepScope",
|
|
145
|
-
"patch.accept": "patch.accept",
|
|
146
|
-
"patch.reject": "patch.reject",
|
|
147
|
-
"patch.addWidget": "patch.addWidget",
|
|
148
|
-
"patch.removeItem": "patch.removeItem",
|
|
149
|
-
"patch.switchLayout": "patch.switchLayout",
|
|
150
|
-
"patch.showField": "patch.showField",
|
|
151
|
-
"patch.hideField": "patch.hideField",
|
|
152
|
-
"patch.moveTo": "patch.moveTo",
|
|
153
|
-
"patch.replaceItem": "patch.replaceItem",
|
|
154
|
-
"patch.promote": "patch.promote",
|
|
155
|
-
"patch.changes": "patch.changes"
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
// src/i18n/index.ts
|
|
159
|
-
import {
|
|
1
|
+
export { createSurfaceI18n, getDefaultSurfaceI18n } from "./messages";
|
|
2
|
+
export { SURFACE_KEYS } from "./keys";
|
|
3
|
+
export {
|
|
160
4
|
resolveLocale,
|
|
161
5
|
isSupportedLocale,
|
|
162
6
|
DEFAULT_LOCALE,
|
|
163
7
|
SUPPORTED_LOCALES
|
|
164
8
|
} from "@contractspec/lib.contracts-spec/translations";
|
|
165
|
-
export {
|
|
166
|
-
resolveLocale,
|
|
167
|
-
isSupportedLocale,
|
|
168
|
-
getDefaultSurfaceI18n,
|
|
169
|
-
createSurfaceI18n,
|
|
170
|
-
SURFACE_KEYS,
|
|
171
|
-
SUPPORTED_LOCALES,
|
|
172
|
-
DEFAULT_LOCALE
|
|
173
|
-
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
var SURFACE_KEYS = {
|
|
1
|
+
export const SURFACE_KEYS = {
|
|
3
2
|
"overlay.conflicts.title": "overlay.conflicts.title",
|
|
4
3
|
"overlay.conflicts.keepScope": "overlay.conflicts.keepScope",
|
|
5
4
|
"patch.accept": "patch.accept",
|
|
@@ -14,6 +13,3 @@ var SURFACE_KEYS = {
|
|
|
14
13
|
"patch.promote": "patch.promote",
|
|
15
14
|
"patch.changes": "patch.changes"
|
|
16
15
|
};
|
|
17
|
-
export {
|
|
18
|
-
SURFACE_KEYS
|
|
19
|
-
};
|