@contractspec/lib.surface-runtime 0.2.3 → 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 -2466
- package/dist/browser/react/BundleProvider.js +12 -19
- package/dist/browser/react/BundleRenderer.js +19 -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 -790
- 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 -2467
- 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 -2466
- package/dist/node/react/BundleProvider.js +12 -19
- package/dist/node/react/BundleRenderer.js +19 -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 -790
- 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.d.ts +3 -1
- package/dist/react/BundleRenderer.js +19 -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 -791
- 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,792 +1,16 @@
|
|
|
1
|
-
// src/adapters/blocknote-stub.tsx
|
|
2
|
-
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
3
|
-
var blocknoteAdapterStub = {
|
|
4
|
-
supportsNode(_kind) {
|
|
5
|
-
return false;
|
|
6
|
-
},
|
|
7
|
-
createSchema(_registry) {
|
|
8
|
-
return {};
|
|
9
|
-
},
|
|
10
|
-
renderNode(node, _ctx) {
|
|
11
|
-
return /* @__PURE__ */ jsxDEV("div", {
|
|
12
|
-
"data-blocknote-stub": true,
|
|
13
|
-
"data-node-id": node.nodeId,
|
|
14
|
-
children: node.title ?? node.kind
|
|
15
|
-
}, undefined, false, undefined, this);
|
|
16
|
-
},
|
|
17
|
-
async serialize(node) {
|
|
18
|
-
return { nodeId: node.nodeId, kind: node.kind };
|
|
19
|
-
},
|
|
20
|
-
async deserialize(input) {
|
|
21
|
-
const o = input;
|
|
22
|
-
return {
|
|
23
|
-
nodeId: o?.nodeId ?? "stub",
|
|
24
|
-
kind: o?.kind ?? "custom-widget"
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
// src/adapters/motion-stub.ts
|
|
30
|
-
var PACE_TOKENS = {
|
|
31
|
-
deliberate: {
|
|
32
|
-
durationMs: 300,
|
|
33
|
-
enableEntrance: true,
|
|
34
|
-
layout: true
|
|
35
|
-
},
|
|
36
|
-
balanced: {
|
|
37
|
-
durationMs: 150,
|
|
38
|
-
enableEntrance: true,
|
|
39
|
-
layout: true
|
|
40
|
-
},
|
|
41
|
-
rapid: {
|
|
42
|
-
durationMs: 50,
|
|
43
|
-
enableEntrance: false,
|
|
44
|
-
layout: false
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
var motionAdapterStub = {
|
|
48
|
-
getTokens(pace) {
|
|
49
|
-
return PACE_TOKENS[pace] ?? PACE_TOKENS.balanced;
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
// src/adapters/resizable-panels-stub.tsx
|
|
54
|
-
import { jsxDEV as jsxDEV2 } from "react/jsx-dev-runtime";
|
|
55
|
-
var LAYOUT_STORAGE_KEY = "surface-runtime:panel-layout:";
|
|
56
|
-
var resizablePanelsAdapterStub = {
|
|
57
|
-
renderPanelGroup(region, ctx, renderChild) {
|
|
58
|
-
const direction = region.direction === "horizontal" ? "row" : "column";
|
|
59
|
-
return /* @__PURE__ */ jsxDEV2("div", {
|
|
60
|
-
"data-panel-group": true,
|
|
61
|
-
"data-persist-key": region.persistKey,
|
|
62
|
-
style: {
|
|
63
|
-
display: "flex",
|
|
64
|
-
flexDirection: direction,
|
|
65
|
-
flex: 1,
|
|
66
|
-
minHeight: 0
|
|
67
|
-
},
|
|
68
|
-
children: region.children.map((child, i) => /* @__PURE__ */ jsxDEV2("div", {
|
|
69
|
-
style: { flex: 1, minWidth: 0, minHeight: 0 },
|
|
70
|
-
children: renderChild(child, ctx)
|
|
71
|
-
}, i, false, undefined, this))
|
|
72
|
-
}, undefined, false, undefined, this);
|
|
73
|
-
},
|
|
74
|
-
async restoreLayout(persistKey) {
|
|
75
|
-
if (typeof localStorage === "undefined")
|
|
76
|
-
return null;
|
|
77
|
-
try {
|
|
78
|
-
const raw = localStorage.getItem(LAYOUT_STORAGE_KEY + persistKey);
|
|
79
|
-
if (!raw)
|
|
80
|
-
return null;
|
|
81
|
-
const parsed = JSON.parse(raw);
|
|
82
|
-
return Array.isArray(parsed) ? parsed : null;
|
|
83
|
-
} catch {
|
|
84
|
-
return null;
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
async saveLayout(persistKey, sizes) {
|
|
88
|
-
if (typeof localStorage === "undefined")
|
|
89
|
-
return;
|
|
90
|
-
try {
|
|
91
|
-
localStorage.setItem(LAYOUT_STORAGE_KEY + persistKey, JSON.stringify(sizes));
|
|
92
|
-
} catch {}
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
// src/telemetry/surface-metrics.ts
|
|
97
|
-
import {
|
|
98
|
-
createCounter,
|
|
99
|
-
createHistogram
|
|
100
|
-
} from "@contractspec/lib.observability/metrics";
|
|
101
|
-
var METER_NAME = "@contractspec/lib.surface-runtime";
|
|
102
|
-
var resolutionDurationMs = createHistogram("bundle_surface_resolution_duration_ms", "Time to resolve bundle spec to surface plan in milliseconds", METER_NAME);
|
|
103
|
-
var patchAcceptanceCounter = createCounter("bundle_surface_patch_acceptance_total", "Total AI patch proposals accepted by user", METER_NAME);
|
|
104
|
-
var patchRejectionCounter = createCounter("bundle_surface_patch_rejection_total", "Total AI patch proposals rejected by user", METER_NAME);
|
|
105
|
-
var policyDenialCounter = createCounter("bundle_surface_policy_denial_total", "Total policy denials (actions denied by policy)", METER_NAME);
|
|
106
|
-
var surfaceFallbackCounter = createCounter("bundle_surface_fallback_total", "Total surface or layout fallbacks during resolution", METER_NAME);
|
|
107
|
-
var missingRendererCounter = createCounter("bundle_surface_renderer_missing_total", "Total slots with no renderer for requested node kind", METER_NAME);
|
|
108
|
-
|
|
109
|
-
// src/i18n/catalogs/en.ts
|
|
110
|
-
import { defineTranslation } from "@contractspec/lib.contracts-spec/translations";
|
|
111
|
-
var enMessages = defineTranslation({
|
|
112
|
-
meta: {
|
|
113
|
-
key: "surface-runtime.messages",
|
|
114
|
-
version: "1.0.0",
|
|
115
|
-
domain: "surface-runtime",
|
|
116
|
-
description: "User-facing strings for surface-runtime UI components",
|
|
117
|
-
owners: ["platform"],
|
|
118
|
-
stability: "experimental"
|
|
119
|
-
},
|
|
120
|
-
locale: "en",
|
|
121
|
-
fallback: "en",
|
|
122
|
-
messages: {
|
|
123
|
-
"overlay.conflicts.title": {
|
|
124
|
-
value: "Overlay conflicts",
|
|
125
|
-
description: "Title for overlay conflict resolution banner"
|
|
126
|
-
},
|
|
127
|
-
"overlay.conflicts.keepScope": {
|
|
128
|
-
value: "Keep {scope}",
|
|
129
|
-
description: "Button to keep overlay from scope A or B"
|
|
130
|
-
},
|
|
131
|
-
"patch.accept": {
|
|
132
|
-
value: "Accept",
|
|
133
|
-
description: "Accept patch proposal button"
|
|
134
|
-
},
|
|
135
|
-
"patch.reject": {
|
|
136
|
-
value: "Reject",
|
|
137
|
-
description: "Reject patch proposal button"
|
|
138
|
-
},
|
|
139
|
-
"patch.addWidget": {
|
|
140
|
-
value: "Add {title} to {slot}",
|
|
141
|
-
description: "Insert node proposal summary"
|
|
142
|
-
},
|
|
143
|
-
"patch.removeItem": {
|
|
144
|
-
value: "Remove item",
|
|
145
|
-
description: "Remove node proposal summary"
|
|
146
|
-
},
|
|
147
|
-
"patch.switchLayout": {
|
|
148
|
-
value: "Switch to {layoutId} layout",
|
|
149
|
-
description: "Set layout proposal summary"
|
|
150
|
-
},
|
|
151
|
-
"patch.showField": {
|
|
152
|
-
value: "Show field {fieldId}",
|
|
153
|
-
description: "Reveal field proposal summary"
|
|
154
|
-
},
|
|
155
|
-
"patch.hideField": {
|
|
156
|
-
value: "Hide field {fieldId}",
|
|
157
|
-
description: "Hide field proposal summary"
|
|
158
|
-
},
|
|
159
|
-
"patch.moveTo": {
|
|
160
|
-
value: "Move to {slot}",
|
|
161
|
-
description: "Move node proposal summary"
|
|
162
|
-
},
|
|
163
|
-
"patch.replaceItem": {
|
|
164
|
-
value: "Replace item",
|
|
165
|
-
description: "Replace node proposal summary"
|
|
166
|
-
},
|
|
167
|
-
"patch.promote": {
|
|
168
|
-
value: "Promote {actionId}",
|
|
169
|
-
description: "Promote action proposal summary"
|
|
170
|
-
},
|
|
171
|
-
"patch.changes": {
|
|
172
|
-
value: "{count} changes",
|
|
173
|
-
description: "Multiple patch ops summary"
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
});
|
|
177
|
-
|
|
178
|
-
// src/i18n/catalogs/es.ts
|
|
179
|
-
import { defineTranslation as defineTranslation2 } from "@contractspec/lib.contracts-spec/translations";
|
|
180
|
-
var esMessages = defineTranslation2({
|
|
181
|
-
meta: {
|
|
182
|
-
key: "surface-runtime.messages",
|
|
183
|
-
version: "1.0.0",
|
|
184
|
-
domain: "surface-runtime",
|
|
185
|
-
description: "User-facing strings for surface-runtime UI components",
|
|
186
|
-
owners: ["platform"],
|
|
187
|
-
stability: "experimental"
|
|
188
|
-
},
|
|
189
|
-
locale: "es",
|
|
190
|
-
fallback: "en",
|
|
191
|
-
messages: {
|
|
192
|
-
"overlay.conflicts.title": { value: "Conflictos de superposición" },
|
|
193
|
-
"overlay.conflicts.keepScope": { value: "Mantener {scope}" },
|
|
194
|
-
"patch.accept": { value: "Aceptar" },
|
|
195
|
-
"patch.reject": { value: "Rechazar" },
|
|
196
|
-
"patch.addWidget": { value: "Añadir {title} a {slot}" },
|
|
197
|
-
"patch.removeItem": { value: "Eliminar elemento" },
|
|
198
|
-
"patch.switchLayout": { value: "Cambiar a disposición {layoutId}" },
|
|
199
|
-
"patch.showField": { value: "Mostrar campo {fieldId}" },
|
|
200
|
-
"patch.hideField": { value: "Ocultar campo {fieldId}" },
|
|
201
|
-
"patch.moveTo": { value: "Mover a {slot}" },
|
|
202
|
-
"patch.replaceItem": { value: "Reemplazar elemento" },
|
|
203
|
-
"patch.promote": { value: "Promover {actionId}" },
|
|
204
|
-
"patch.changes": { value: "{count} cambios" }
|
|
205
|
-
}
|
|
206
|
-
});
|
|
207
|
-
|
|
208
|
-
// src/i18n/catalogs/fr.ts
|
|
209
|
-
import { defineTranslation as defineTranslation3 } from "@contractspec/lib.contracts-spec/translations";
|
|
210
|
-
var frMessages = defineTranslation3({
|
|
211
|
-
meta: {
|
|
212
|
-
key: "surface-runtime.messages",
|
|
213
|
-
version: "1.0.0",
|
|
214
|
-
domain: "surface-runtime",
|
|
215
|
-
description: "User-facing strings for surface-runtime UI components",
|
|
216
|
-
owners: ["platform"],
|
|
217
|
-
stability: "experimental"
|
|
218
|
-
},
|
|
219
|
-
locale: "fr",
|
|
220
|
-
fallback: "en",
|
|
221
|
-
messages: {
|
|
222
|
-
"overlay.conflicts.title": { value: "Conflits de superposition" },
|
|
223
|
-
"overlay.conflicts.keepScope": { value: "Conserver {scope}" },
|
|
224
|
-
"patch.accept": { value: "Accepter" },
|
|
225
|
-
"patch.reject": { value: "Rejeter" },
|
|
226
|
-
"patch.addWidget": { value: "Ajouter {title} à {slot}" },
|
|
227
|
-
"patch.removeItem": { value: "Supprimer l'élément" },
|
|
228
|
-
"patch.switchLayout": { value: "Passer à la disposition {layoutId}" },
|
|
229
|
-
"patch.showField": { value: "Afficher le champ {fieldId}" },
|
|
230
|
-
"patch.hideField": { value: "Masquer le champ {fieldId}" },
|
|
231
|
-
"patch.moveTo": { value: "Déplacer vers {slot}" },
|
|
232
|
-
"patch.replaceItem": { value: "Remplacer l'élément" },
|
|
233
|
-
"patch.promote": { value: "Promouvoir {actionId}" },
|
|
234
|
-
"patch.changes": { value: "{count} modifications" }
|
|
235
|
-
}
|
|
236
|
-
});
|
|
237
|
-
|
|
238
|
-
// src/i18n/messages.ts
|
|
239
|
-
import {
|
|
240
|
-
createI18nFactory
|
|
241
|
-
} from "@contractspec/lib.contracts-spec/translations";
|
|
242
|
-
var factory = createI18nFactory({
|
|
243
|
-
specKey: "surface-runtime.messages",
|
|
244
|
-
catalogs: [enMessages, frMessages, esMessages]
|
|
245
|
-
});
|
|
246
|
-
var createSurfaceI18n = factory.create;
|
|
247
|
-
var getDefaultSurfaceI18n = factory.getDefault;
|
|
248
|
-
|
|
249
|
-
// src/i18n/keys.ts
|
|
250
|
-
var SURFACE_KEYS = {
|
|
251
|
-
"overlay.conflicts.title": "overlay.conflicts.title",
|
|
252
|
-
"overlay.conflicts.keepScope": "overlay.conflicts.keepScope",
|
|
253
|
-
"patch.accept": "patch.accept",
|
|
254
|
-
"patch.reject": "patch.reject",
|
|
255
|
-
"patch.addWidget": "patch.addWidget",
|
|
256
|
-
"patch.removeItem": "patch.removeItem",
|
|
257
|
-
"patch.switchLayout": "patch.switchLayout",
|
|
258
|
-
"patch.showField": "patch.showField",
|
|
259
|
-
"patch.hideField": "patch.hideField",
|
|
260
|
-
"patch.moveTo": "patch.moveTo",
|
|
261
|
-
"patch.replaceItem": "patch.replaceItem",
|
|
262
|
-
"patch.promote": "patch.promote",
|
|
263
|
-
"patch.changes": "patch.changes"
|
|
264
|
-
};
|
|
265
|
-
|
|
266
|
-
// src/i18n/index.ts
|
|
267
|
-
import {
|
|
268
|
-
resolveLocale,
|
|
269
|
-
isSupportedLocale,
|
|
270
|
-
DEFAULT_LOCALE,
|
|
271
|
-
SUPPORTED_LOCALES
|
|
272
|
-
} from "@contractspec/lib.contracts-spec/translations";
|
|
273
|
-
|
|
274
|
-
// src/react/BundleProvider.tsx
|
|
275
|
-
import { createContext, useContext } from "react";
|
|
276
|
-
import { jsxDEV as jsxDEV3 } from "react/jsx-dev-runtime";
|
|
277
|
-
"use client";
|
|
278
|
-
var BundlePlanContext = createContext(null);
|
|
279
|
-
var PreferencesContext = createContext(null);
|
|
280
|
-
var EditingContext = createContext(false);
|
|
281
|
-
function BundleProvider({
|
|
282
|
-
plan,
|
|
283
|
-
children,
|
|
284
|
-
isEditing = false
|
|
285
|
-
}) {
|
|
286
|
-
const preferences = plan.adaptation.appliedDimensions;
|
|
287
|
-
return /* @__PURE__ */ jsxDEV3(BundlePlanContext.Provider, {
|
|
288
|
-
value: plan,
|
|
289
|
-
children: /* @__PURE__ */ jsxDEV3(PreferencesContext.Provider, {
|
|
290
|
-
value: preferences,
|
|
291
|
-
children: /* @__PURE__ */ jsxDEV3(EditingContext.Provider, {
|
|
292
|
-
value: isEditing,
|
|
293
|
-
children
|
|
294
|
-
}, undefined, false, undefined, this)
|
|
295
|
-
}, undefined, false, undefined, this)
|
|
296
|
-
}, undefined, false, undefined, this);
|
|
297
|
-
}
|
|
298
|
-
function useIsEditing() {
|
|
299
|
-
return useContext(EditingContext);
|
|
300
|
-
}
|
|
301
|
-
function useBundlePlan() {
|
|
302
|
-
const value = useContext(BundlePlanContext);
|
|
303
|
-
if (!value) {
|
|
304
|
-
throw new Error("useBundlePlan must be used inside BundleProvider.");
|
|
305
|
-
}
|
|
306
|
-
return value;
|
|
307
|
-
}
|
|
308
|
-
function useBundlePreferences() {
|
|
309
|
-
const value = useContext(PreferencesContext);
|
|
310
|
-
if (!value) {
|
|
311
|
-
throw new Error("useBundlePreferences must be used inside BundleProvider.");
|
|
312
|
-
}
|
|
313
|
-
return value;
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
// src/react/RegionRenderer.tsx
|
|
317
|
-
import { jsxDEV as jsxDEV4 } from "react/jsx-dev-runtime";
|
|
318
|
-
function RegionRenderer({
|
|
319
|
-
region,
|
|
320
|
-
ctx,
|
|
321
|
-
renderSlot
|
|
322
|
-
}) {
|
|
323
|
-
const renderChild = (child, childCtx) => /* @__PURE__ */ jsxDEV4(RegionRenderer, {
|
|
324
|
-
region: child,
|
|
325
|
-
ctx: childCtx,
|
|
326
|
-
renderSlot
|
|
327
|
-
}, undefined, false, undefined, this);
|
|
328
|
-
switch (region.type) {
|
|
329
|
-
case "panel-group":
|
|
330
|
-
return resizablePanelsAdapterStub.renderPanelGroup(region, ctx, renderChild);
|
|
331
|
-
case "stack": {
|
|
332
|
-
const direction = region.direction === "horizontal" ? "row" : "column";
|
|
333
|
-
const gapMap = {
|
|
334
|
-
none: 0,
|
|
335
|
-
xs: 4,
|
|
336
|
-
sm: 8,
|
|
337
|
-
md: 16,
|
|
338
|
-
lg: 24
|
|
339
|
-
};
|
|
340
|
-
const gap = gapMap[region.gap ?? "md"];
|
|
341
|
-
return /* @__PURE__ */ jsxDEV4("div", {
|
|
342
|
-
"data-region": "stack",
|
|
343
|
-
style: {
|
|
344
|
-
display: "flex",
|
|
345
|
-
flexDirection: direction,
|
|
346
|
-
gap,
|
|
347
|
-
flex: 1,
|
|
348
|
-
minHeight: 0
|
|
349
|
-
},
|
|
350
|
-
children: region.children.map((child, i) => /* @__PURE__ */ jsxDEV4("div", {
|
|
351
|
-
style: { flex: 1, minWidth: 0, minHeight: 0 },
|
|
352
|
-
children: /* @__PURE__ */ jsxDEV4(RegionRenderer, {
|
|
353
|
-
region: child,
|
|
354
|
-
ctx,
|
|
355
|
-
renderSlot
|
|
356
|
-
}, undefined, false, undefined, this)
|
|
357
|
-
}, i, false, undefined, this))
|
|
358
|
-
}, undefined, false, undefined, this);
|
|
359
|
-
}
|
|
360
|
-
case "tabs":
|
|
361
|
-
return /* @__PURE__ */ jsxDEV4("div", {
|
|
362
|
-
"data-region": "tabs",
|
|
363
|
-
children: [
|
|
364
|
-
/* @__PURE__ */ jsxDEV4("div", {
|
|
365
|
-
role: "tablist",
|
|
366
|
-
children: region.tabs.map((t) => /* @__PURE__ */ jsxDEV4("button", {
|
|
367
|
-
type: "button",
|
|
368
|
-
role: "tab",
|
|
369
|
-
children: t.title
|
|
370
|
-
}, t.key, false, undefined, this))
|
|
371
|
-
}, undefined, false, undefined, this),
|
|
372
|
-
region.tabs[0] && /* @__PURE__ */ jsxDEV4(RegionRenderer, {
|
|
373
|
-
region: region.tabs[0].child,
|
|
374
|
-
ctx,
|
|
375
|
-
renderSlot
|
|
376
|
-
}, undefined, false, undefined, this)
|
|
377
|
-
]
|
|
378
|
-
}, undefined, true, undefined, this);
|
|
379
|
-
case "slot":
|
|
380
|
-
return /* @__PURE__ */ jsxDEV4("div", {
|
|
381
|
-
"data-slot": region.slotId,
|
|
382
|
-
children: renderSlot(region.slotId, ctx)
|
|
383
|
-
}, undefined, false, undefined, this);
|
|
384
|
-
case "floating":
|
|
385
|
-
return /* @__PURE__ */ jsxDEV4("div", {
|
|
386
|
-
"data-floating": true,
|
|
387
|
-
"data-anchor": region.anchorSlotId,
|
|
388
|
-
children: /* @__PURE__ */ jsxDEV4(RegionRenderer, {
|
|
389
|
-
region: region.child,
|
|
390
|
-
ctx,
|
|
391
|
-
renderSlot
|
|
392
|
-
}, undefined, false, undefined, this)
|
|
393
|
-
}, undefined, false, undefined, this);
|
|
394
|
-
default:
|
|
395
|
-
return null;
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
// src/react/SlotRenderer.tsx
|
|
400
|
-
import { jsxDEV as jsxDEV5 } from "react/jsx-dev-runtime";
|
|
401
|
-
function SlotRenderer({ slotId, ctx, nodes }) {
|
|
402
|
-
if (nodes.length === 0) {
|
|
403
|
-
return /* @__PURE__ */ jsxDEV5("div", {
|
|
404
|
-
"data-slot-placeholder": true,
|
|
405
|
-
"data-slot-id": slotId
|
|
406
|
-
}, undefined, false, undefined, this);
|
|
407
|
-
}
|
|
408
|
-
return /* @__PURE__ */ jsxDEV5("div", {
|
|
409
|
-
"data-slot": slotId,
|
|
410
|
-
children: nodes.map((node) => /* @__PURE__ */ jsxDEV5(SlotNodeRenderer, {
|
|
411
|
-
node,
|
|
412
|
-
ctx,
|
|
413
|
-
slotId
|
|
414
|
-
}, node.nodeId, false, undefined, this))
|
|
415
|
-
}, undefined, false, undefined, this);
|
|
416
|
-
}
|
|
417
|
-
function SlotNodeRenderer({
|
|
418
|
-
node,
|
|
419
|
-
ctx,
|
|
420
|
-
slotId
|
|
421
|
-
}) {
|
|
422
|
-
if (blocknoteAdapterStub.supportsNode(node.kind)) {
|
|
423
|
-
return blocknoteAdapterStub.renderNode(node, ctx);
|
|
424
|
-
}
|
|
425
|
-
if (node.kind === "entity-section") {
|
|
426
|
-
return /* @__PURE__ */ jsxDEV5("section", {
|
|
427
|
-
"data-node-id": node.nodeId,
|
|
428
|
-
"data-kind": "entity-section",
|
|
429
|
-
children: [
|
|
430
|
-
/* @__PURE__ */ jsxDEV5("header", {
|
|
431
|
-
"data-entity-section-header": true,
|
|
432
|
-
children: node.title ?? "Section"
|
|
433
|
-
}, undefined, false, undefined, this),
|
|
434
|
-
/* @__PURE__ */ jsxDEV5("div", {
|
|
435
|
-
"data-entity-section-content": true,
|
|
436
|
-
children: node.children?.map((child) => child ? /* @__PURE__ */ jsxDEV5(SlotNodeRenderer, {
|
|
437
|
-
node: child,
|
|
438
|
-
ctx,
|
|
439
|
-
slotId
|
|
440
|
-
}, child.nodeId, false, undefined, this) : null)
|
|
441
|
-
}, undefined, false, undefined, this)
|
|
442
|
-
]
|
|
443
|
-
}, undefined, true, undefined, this);
|
|
444
|
-
}
|
|
445
|
-
if (node.kind === "entity-field") {
|
|
446
|
-
const fieldId = node.sourceBinding?.fieldId;
|
|
447
|
-
return /* @__PURE__ */ jsxDEV5("div", {
|
|
448
|
-
"data-node-id": node.nodeId,
|
|
449
|
-
"data-kind": "entity-field",
|
|
450
|
-
"data-field-id": fieldId,
|
|
451
|
-
children: [
|
|
452
|
-
/* @__PURE__ */ jsxDEV5("span", {
|
|
453
|
-
"data-entity-field-label": true,
|
|
454
|
-
children: node.title ?? fieldId ?? "Field"
|
|
455
|
-
}, undefined, false, undefined, this),
|
|
456
|
-
/* @__PURE__ */ jsxDEV5("span", {
|
|
457
|
-
"data-entity-field-value": true
|
|
458
|
-
}, undefined, false, undefined, this)
|
|
459
|
-
]
|
|
460
|
-
}, undefined, true, undefined, this);
|
|
461
|
-
}
|
|
462
|
-
missingRendererCounter.add(1, {
|
|
463
|
-
nodeKind: node.kind,
|
|
464
|
-
slotId
|
|
465
|
-
});
|
|
466
|
-
return /* @__PURE__ */ jsxDEV5("div", {
|
|
467
|
-
"data-node-id": node.nodeId,
|
|
468
|
-
"data-kind": node.kind,
|
|
469
|
-
"data-renderer-missing": true,
|
|
470
|
-
children: node.title ?? node.kind
|
|
471
|
-
}, undefined, false, undefined, this);
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
// src/react/PatchProposalCard.tsx
|
|
475
|
-
import { useMemo } from "react";
|
|
476
|
-
import { jsxDEV as jsxDEV6 } from "react/jsx-dev-runtime";
|
|
477
|
-
"use client";
|
|
478
|
-
function PatchProposalCard({
|
|
479
|
-
proposal,
|
|
480
|
-
onAccept,
|
|
481
|
-
onReject,
|
|
482
|
-
locale
|
|
483
|
-
}) {
|
|
484
|
-
const i18n = useMemo(() => createSurfaceI18n(locale), [locale]);
|
|
485
|
-
const firstOp = proposal.ops[0];
|
|
486
|
-
const summary = proposal.ops.length === 1 && firstOp ? describeOp(firstOp, i18n) : i18n.t("patch.changes", { count: proposal.ops.length });
|
|
487
|
-
return /* @__PURE__ */ jsxDEV6("div", {
|
|
488
|
-
"data-proposal-id": proposal.proposalId,
|
|
489
|
-
style: {
|
|
490
|
-
padding: "12px",
|
|
491
|
-
border: "1px solid var(--border, #e5e7eb)",
|
|
492
|
-
borderRadius: "8px",
|
|
493
|
-
marginBottom: "8px",
|
|
494
|
-
backgroundColor: "var(--muted, #f9fafb)"
|
|
495
|
-
},
|
|
496
|
-
children: [
|
|
497
|
-
/* @__PURE__ */ jsxDEV6("div", {
|
|
498
|
-
style: { marginBottom: "8px", fontSize: "14px" },
|
|
499
|
-
children: summary
|
|
500
|
-
}, undefined, false, undefined, this),
|
|
501
|
-
/* @__PURE__ */ jsxDEV6("div", {
|
|
502
|
-
style: { display: "flex", gap: "8px" },
|
|
503
|
-
children: [
|
|
504
|
-
/* @__PURE__ */ jsxDEV6("button", {
|
|
505
|
-
type: "button",
|
|
506
|
-
onClick: () => onAccept(proposal.proposalId),
|
|
507
|
-
style: {
|
|
508
|
-
padding: "4px 12px",
|
|
509
|
-
fontSize: "13px",
|
|
510
|
-
borderRadius: "4px",
|
|
511
|
-
border: "none",
|
|
512
|
-
backgroundColor: "var(--primary, #3b82f6)",
|
|
513
|
-
color: "white",
|
|
514
|
-
cursor: "pointer"
|
|
515
|
-
},
|
|
516
|
-
children: i18n.t("patch.accept")
|
|
517
|
-
}, undefined, false, undefined, this),
|
|
518
|
-
/* @__PURE__ */ jsxDEV6("button", {
|
|
519
|
-
type: "button",
|
|
520
|
-
onClick: () => onReject(proposal.proposalId),
|
|
521
|
-
style: {
|
|
522
|
-
padding: "4px 12px",
|
|
523
|
-
fontSize: "13px",
|
|
524
|
-
borderRadius: "4px",
|
|
525
|
-
border: "1px solid var(--border, #e5e7eb)",
|
|
526
|
-
backgroundColor: "transparent",
|
|
527
|
-
cursor: "pointer"
|
|
528
|
-
},
|
|
529
|
-
children: i18n.t("patch.reject")
|
|
530
|
-
}, undefined, false, undefined, this)
|
|
531
|
-
]
|
|
532
|
-
}, undefined, true, undefined, this)
|
|
533
|
-
]
|
|
534
|
-
}, undefined, true, undefined, this);
|
|
535
|
-
}
|
|
536
|
-
function describeOp(op, i18n) {
|
|
537
|
-
switch (op.op) {
|
|
538
|
-
case "insert-node":
|
|
539
|
-
return i18n.t("patch.addWidget", {
|
|
540
|
-
title: op.node?.title ?? op.node?.kind ?? "widget",
|
|
541
|
-
slot: op.slotId ?? "slot"
|
|
542
|
-
});
|
|
543
|
-
case "remove-node":
|
|
544
|
-
return i18n.t("patch.removeItem");
|
|
545
|
-
case "set-layout":
|
|
546
|
-
return i18n.t("patch.switchLayout", { layoutId: op.layoutId });
|
|
547
|
-
case "reveal-field":
|
|
548
|
-
return i18n.t("patch.showField", { fieldId: op.fieldId });
|
|
549
|
-
case "hide-field":
|
|
550
|
-
return i18n.t("patch.hideField", { fieldId: op.fieldId });
|
|
551
|
-
case "move-node":
|
|
552
|
-
return i18n.t("patch.moveTo", { slot: op.toSlotId ?? "slot" });
|
|
553
|
-
case "replace-node":
|
|
554
|
-
return i18n.t("patch.replaceItem");
|
|
555
|
-
case "promote-action":
|
|
556
|
-
return i18n.t("patch.promote", { actionId: op.actionId });
|
|
557
|
-
default:
|
|
558
|
-
return `${op.op}`;
|
|
559
|
-
}
|
|
560
|
-
}
|
|
561
|
-
|
|
562
|
-
// src/react/OverlayConflictResolver.tsx
|
|
563
|
-
import { useMemo as useMemo2 } from "react";
|
|
564
|
-
import { jsxDEV as jsxDEV7 } from "react/jsx-dev-runtime";
|
|
565
|
-
"use client";
|
|
566
|
-
function OverlayConflictResolver({
|
|
567
|
-
conflicts,
|
|
568
|
-
onResolve,
|
|
569
|
-
locale
|
|
570
|
-
}) {
|
|
571
|
-
const i18n = useMemo2(() => createSurfaceI18n(locale), [locale]);
|
|
572
|
-
return /* @__PURE__ */ jsxDEV7("div", {
|
|
573
|
-
"data-overlay-conflicts": true,
|
|
574
|
-
style: {
|
|
575
|
-
padding: "12px",
|
|
576
|
-
marginBottom: "12px",
|
|
577
|
-
border: "1px solid var(--destructive, #ef4444)",
|
|
578
|
-
borderRadius: "8px",
|
|
579
|
-
backgroundColor: "var(--destructive/10, #fef2f2)"
|
|
580
|
-
},
|
|
581
|
-
children: [
|
|
582
|
-
/* @__PURE__ */ jsxDEV7("div", {
|
|
583
|
-
style: {
|
|
584
|
-
fontSize: "14px",
|
|
585
|
-
fontWeight: 600,
|
|
586
|
-
marginBottom: "8px",
|
|
587
|
-
color: "var(--destructive, #ef4444)"
|
|
588
|
-
},
|
|
589
|
-
children: i18n.t("overlay.conflicts.title")
|
|
590
|
-
}, undefined, false, undefined, this),
|
|
591
|
-
conflicts.map((c) => /* @__PURE__ */ jsxDEV7("div", {
|
|
592
|
-
style: {
|
|
593
|
-
padding: "8px",
|
|
594
|
-
marginBottom: "8px",
|
|
595
|
-
backgroundColor: "white",
|
|
596
|
-
borderRadius: "4px",
|
|
597
|
-
fontSize: "13px"
|
|
598
|
-
},
|
|
599
|
-
children: [
|
|
600
|
-
/* @__PURE__ */ jsxDEV7("span", {
|
|
601
|
-
children: c.targetKey
|
|
602
|
-
}, undefined, false, undefined, this),
|
|
603
|
-
/* @__PURE__ */ jsxDEV7("span", {
|
|
604
|
-
style: { margin: "0 8px", color: "#9ca3af" },
|
|
605
|
-
children: [
|
|
606
|
-
"(",
|
|
607
|
-
c.scopeA,
|
|
608
|
-
" vs ",
|
|
609
|
-
c.scopeB,
|
|
610
|
-
")"
|
|
611
|
-
]
|
|
612
|
-
}, undefined, true, undefined, this),
|
|
613
|
-
/* @__PURE__ */ jsxDEV7("div", {
|
|
614
|
-
style: { marginTop: "8px", display: "flex", gap: "8px" },
|
|
615
|
-
children: [
|
|
616
|
-
/* @__PURE__ */ jsxDEV7("button", {
|
|
617
|
-
type: "button",
|
|
618
|
-
onClick: () => onResolve({ targetKey: c.targetKey, chosenScope: "A" }),
|
|
619
|
-
style: {
|
|
620
|
-
padding: "4px 12px",
|
|
621
|
-
fontSize: "12px",
|
|
622
|
-
borderRadius: "4px",
|
|
623
|
-
border: "1px solid #e5e7eb",
|
|
624
|
-
backgroundColor: "white",
|
|
625
|
-
cursor: "pointer"
|
|
626
|
-
},
|
|
627
|
-
children: i18n.t("overlay.conflicts.keepScope", { scope: c.scopeA })
|
|
628
|
-
}, undefined, false, undefined, this),
|
|
629
|
-
/* @__PURE__ */ jsxDEV7("button", {
|
|
630
|
-
type: "button",
|
|
631
|
-
onClick: () => onResolve({ targetKey: c.targetKey, chosenScope: "B" }),
|
|
632
|
-
style: {
|
|
633
|
-
padding: "4px 12px",
|
|
634
|
-
fontSize: "12px",
|
|
635
|
-
borderRadius: "4px",
|
|
636
|
-
border: "1px solid #e5e7eb",
|
|
637
|
-
backgroundColor: "white",
|
|
638
|
-
cursor: "pointer"
|
|
639
|
-
},
|
|
640
|
-
children: i18n.t("overlay.conflicts.keepScope", { scope: c.scopeB })
|
|
641
|
-
}, undefined, false, undefined, this)
|
|
642
|
-
]
|
|
643
|
-
}, undefined, true, undefined, this)
|
|
644
|
-
]
|
|
645
|
-
}, `${c.targetKey}-${c.overlayIdA}-${c.overlayIdB}`, true, undefined, this))
|
|
646
|
-
]
|
|
647
|
-
}, undefined, true, undefined, this);
|
|
648
|
-
}
|
|
649
|
-
|
|
650
|
-
// src/react/BundleRenderer.tsx
|
|
651
|
-
import { jsxDEV as jsxDEV8, Fragment } from "react/jsx-dev-runtime";
|
|
652
|
-
"use client";
|
|
653
|
-
function BundleRenderer({
|
|
654
|
-
assistantSlotId,
|
|
655
|
-
assistantSlotContent,
|
|
656
|
-
onPatchAccept,
|
|
657
|
-
onPatchReject,
|
|
658
|
-
onOverlayConflictResolve
|
|
659
|
-
} = {}) {
|
|
660
|
-
const plan = useBundlePlan();
|
|
661
|
-
const motionTokens = motionAdapterStub.getTokens(plan.adaptation.appliedDimensions.pace);
|
|
662
|
-
const ctx = {
|
|
663
|
-
plan,
|
|
664
|
-
bindings: plan.bindings,
|
|
665
|
-
preferences: plan.adaptation.appliedDimensions
|
|
666
|
-
};
|
|
667
|
-
const proposals = plan.ai?.proposals?.filter((p) => p.approvalState === "proposed");
|
|
668
|
-
const locale = plan.locale;
|
|
669
|
-
const renderSlot = (slotId, slotCtx) => {
|
|
670
|
-
if (assistantSlotId && slotId === assistantSlotId) {
|
|
671
|
-
return /* @__PURE__ */ jsxDEV8(Fragment, {
|
|
672
|
-
children: [
|
|
673
|
-
proposals && proposals.length > 0 && onPatchAccept && onPatchReject && /* @__PURE__ */ jsxDEV8("div", {
|
|
674
|
-
style: { marginBottom: "12px" },
|
|
675
|
-
children: proposals.map((p) => /* @__PURE__ */ jsxDEV8(PatchProposalCard, {
|
|
676
|
-
proposal: p,
|
|
677
|
-
onAccept: onPatchAccept,
|
|
678
|
-
onReject: onPatchReject,
|
|
679
|
-
locale
|
|
680
|
-
}, p.proposalId, false, undefined, this))
|
|
681
|
-
}, undefined, false, undefined, this),
|
|
682
|
-
assistantSlotContent
|
|
683
|
-
]
|
|
684
|
-
}, undefined, true, undefined, this);
|
|
685
|
-
}
|
|
686
|
-
const nodes = getNodesForSlot(plan.nodes, slotId);
|
|
687
|
-
return /* @__PURE__ */ jsxDEV8(SlotRenderer, {
|
|
688
|
-
slotId,
|
|
689
|
-
ctx: slotCtx,
|
|
690
|
-
nodes
|
|
691
|
-
}, undefined, false, undefined, this);
|
|
692
|
-
};
|
|
693
|
-
const conflicts = plan.overlayConflicts ?? [];
|
|
694
|
-
return /* @__PURE__ */ jsxDEV8("div", {
|
|
695
|
-
"data-bundle-key": plan.bundleKey,
|
|
696
|
-
"data-surface-id": plan.surfaceId,
|
|
697
|
-
"data-layout-id": plan.layoutId,
|
|
698
|
-
style: {
|
|
699
|
-
display: "flex",
|
|
700
|
-
flexDirection: "column",
|
|
701
|
-
height: "100%",
|
|
702
|
-
minHeight: 0,
|
|
703
|
-
transition: motionTokens.layout ? `all ${motionTokens.durationMs}ms ease` : undefined
|
|
704
|
-
},
|
|
705
|
-
children: [
|
|
706
|
-
conflicts.length > 0 && onOverlayConflictResolve && /* @__PURE__ */ jsxDEV8(OverlayConflictResolver, {
|
|
707
|
-
conflicts,
|
|
708
|
-
onResolve: onOverlayConflictResolve,
|
|
709
|
-
locale
|
|
710
|
-
}, undefined, false, undefined, this),
|
|
711
|
-
/* @__PURE__ */ jsxDEV8(RegionRenderer, {
|
|
712
|
-
region: plan.layoutRoot,
|
|
713
|
-
ctx,
|
|
714
|
-
renderSlot
|
|
715
|
-
}, undefined, false, undefined, this)
|
|
716
|
-
]
|
|
717
|
-
}, undefined, true, undefined, this);
|
|
718
|
-
}
|
|
719
|
-
function getNodesForSlot(nodes, slotId) {
|
|
720
|
-
if (slotId === "primary")
|
|
721
|
-
return nodes;
|
|
722
|
-
return [];
|
|
723
|
-
}
|
|
724
|
-
|
|
725
|
-
// src/react/WidgetPalette.tsx
|
|
726
|
-
import { jsxDEV as jsxDEV9 } from "react/jsx-dev-runtime";
|
|
727
|
-
"use client";
|
|
728
|
-
function WidgetPalette({
|
|
729
|
-
registry,
|
|
730
|
-
allowedNodeKinds,
|
|
731
|
-
onInsert
|
|
732
|
-
}) {
|
|
733
|
-
const widgets = registry.listByTrust("core");
|
|
734
|
-
const filtered = !allowedNodeKinds || allowedNodeKinds.includes("custom-widget") ? widgets : [];
|
|
735
|
-
return /* @__PURE__ */ jsxDEV9("div", {
|
|
736
|
-
"data-widget-palette": true,
|
|
737
|
-
style: {
|
|
738
|
-
padding: "12px",
|
|
739
|
-
minWidth: "180px",
|
|
740
|
-
borderRight: "1px solid var(--border, #e5e7eb)",
|
|
741
|
-
backgroundColor: "var(--muted, #f9fafb)"
|
|
742
|
-
},
|
|
743
|
-
children: [
|
|
744
|
-
/* @__PURE__ */ jsxDEV9("div", {
|
|
745
|
-
style: {
|
|
746
|
-
fontSize: "12px",
|
|
747
|
-
fontWeight: 600,
|
|
748
|
-
marginBottom: "8px",
|
|
749
|
-
textTransform: "uppercase",
|
|
750
|
-
color: "var(--muted-foreground, #6b7280)"
|
|
751
|
-
},
|
|
752
|
-
children: "Widgets"
|
|
753
|
-
}, undefined, false, undefined, this),
|
|
754
|
-
/* @__PURE__ */ jsxDEV9("ul", {
|
|
755
|
-
style: { listStyle: "none", margin: 0, padding: 0 },
|
|
756
|
-
children: filtered.map((w) => /* @__PURE__ */ jsxDEV9("li", {
|
|
757
|
-
"data-widget-key": w.widgetKey,
|
|
758
|
-
role: onInsert ? "button" : undefined,
|
|
759
|
-
tabIndex: onInsert ? 0 : undefined,
|
|
760
|
-
style: {
|
|
761
|
-
padding: "8px 12px",
|
|
762
|
-
marginBottom: "4px",
|
|
763
|
-
borderRadius: "6px",
|
|
764
|
-
cursor: onInsert ? "grab" : "default",
|
|
765
|
-
backgroundColor: "white",
|
|
766
|
-
border: "1px solid var(--border, #e5e7eb)"
|
|
767
|
-
},
|
|
768
|
-
onClick: onInsert ? () => onInsert(w.widgetKey, "primary") : undefined,
|
|
769
|
-
onKeyDown: onInsert ? (e) => {
|
|
770
|
-
if (e.key === "Enter" || e.key === " ") {
|
|
771
|
-
e.preventDefault();
|
|
772
|
-
onInsert(w.widgetKey, "primary");
|
|
773
|
-
}
|
|
774
|
-
} : undefined,
|
|
775
|
-
children: w.title
|
|
776
|
-
}, w.widgetKey, false, undefined, this))
|
|
777
|
-
}, undefined, false, undefined, this)
|
|
778
|
-
]
|
|
779
|
-
}, undefined, true, undefined, this);
|
|
780
|
-
}
|
|
781
1
|
export {
|
|
782
|
-
|
|
783
|
-
useBundlePreferences,
|
|
2
|
+
BundleProvider,
|
|
784
3
|
useBundlePlan,
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
};
|
|
4
|
+
useBundlePreferences,
|
|
5
|
+
useIsEditing
|
|
6
|
+
} from "./BundleProvider";
|
|
7
|
+
export { BundleRenderer } from "./BundleRenderer";
|
|
8
|
+
export {
|
|
9
|
+
PatchProposalCard
|
|
10
|
+
} from "./PatchProposalCard";
|
|
11
|
+
export { WidgetPalette } from "./WidgetPalette";
|
|
12
|
+
export {
|
|
13
|
+
OverlayConflictResolver
|
|
14
|
+
} from "./OverlayConflictResolver";
|
|
15
|
+
export { RegionRenderer } from "./RegionRenderer";
|
|
16
|
+
export { SlotRenderer } from "./SlotRenderer";
|