@valbuild/shared 0.150.3 → 0.150.10
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/CHANGELOG.md +20 -0
- package/client/dist/valbuild-shared-client.cjs.dev.js +8 -2
- package/client/dist/valbuild-shared-client.cjs.prod.js +8 -2
- package/client/dist/valbuild-shared-client.esm.js +2 -2
- package/dist/{acquireTypes-50960f2c.esm.js → acquireTypes-6e2f7961.esm.js} +2 -2
- package/dist/{acquireTypes-de10005d.cjs.dev.js → acquireTypes-84a4077a.cjs.dev.js} +6 -6
- package/dist/{acquireTypes-e9467a2a.cjs.prod.js → acquireTypes-dd976839.cjs.prod.js} +6 -6
- package/dist/{createForOfIteratorHelper-3db5d737.esm.js → createForOfIteratorHelper-666a6d17.esm.js} +31 -15
- package/dist/{createForOfIteratorHelper-90e6a8b6.cjs.prod.js → createForOfIteratorHelper-87a33eff.cjs.dev.js} +31 -15
- package/dist/{createForOfIteratorHelper-d86bb352.cjs.dev.js → createForOfIteratorHelper-fef4fa7d.cjs.prod.js} +31 -15
- package/dist/declarations/src/client/index.d.ts +1 -0
- package/dist/declarations/src/internal/ApiRoutes.d.ts +30 -0
- package/dist/declarations/src/internal/elementPicker.d.ts +96 -0
- package/dist/declarations/src/internal/index.d.ts +1 -0
- package/dist/declarations/src/internal/valCanvasProtocol.d.ts +36 -0
- package/dist/{getSitemapTree-667bcb3c.cjs.prod.js → getSitemapTree-873f7266.cjs.prod.js} +333 -2
- package/dist/{getSitemapTree-5afbc3ac.esm.js → getSitemapTree-b6161fd8.esm.js} +328 -3
- package/dist/{getSitemapTree-0fa0569c.cjs.dev.js → getSitemapTree-be70d9fc.cjs.dev.js} +333 -2
- package/dist/{proposalProject-a3d3ad76.esm.js → proposalProject-689c24cc.esm.js} +2 -2
- package/dist/{proposalProject-cdc53711.cjs.dev.js → proposalProject-926f2c68.cjs.dev.js} +2 -2
- package/dist/{proposalProject-28550146.cjs.prod.js → proposalProject-fab0c026.cjs.prod.js} +2 -2
- package/dist/{protocol-1c13de0d.cjs.prod.js → protocol-4e2a455b.cjs.prod.js} +1 -1
- package/dist/{protocol-3b9ef786.esm.js → protocol-7ddc1a71.esm.js} +1 -1
- package/dist/{protocol-d8a6efda.cjs.dev.js → protocol-ac1c3ec7.cjs.dev.js} +1 -1
- package/dist/{slicedToArray-6cd80315.esm.js → slicedToArray-22567815.esm.js} +2 -18
- package/dist/{slicedToArray-62e428df.cjs.dev.js → slicedToArray-c8a29f6b.cjs.dev.js} +1 -18
- package/dist/{slicedToArray-af50e684.cjs.prod.js → slicedToArray-d99b4e2e.cjs.prod.js} +1 -18
- package/internal/dist/valbuild-shared-internal.cjs.dev.js +44 -9
- package/internal/dist/valbuild-shared-internal.cjs.prod.js +44 -9
- package/internal/dist/valbuild-shared-internal.esm.js +36 -8
- package/package.json +2 -2
- package/publish/dist/valbuild-shared-publish.cjs.dev.js +6 -6
- package/publish/dist/valbuild-shared-publish.cjs.prod.js +6 -6
- package/publish/dist/valbuild-shared-publish.esm.js +4 -4
- package/typecheck/dist/valbuild-shared-typecheck.cjs.dev.js +7 -7
- package/typecheck/dist/valbuild-shared-typecheck.cjs.prod.js +7 -7
- package/typecheck/dist/valbuild-shared-typecheck.esm.js +5 -5
- package/typecheck/testing/dist/valbuild-shared-typecheck-testing.cjs.dev.js +4 -4
- package/typecheck/testing/dist/valbuild-shared-typecheck-testing.cjs.prod.js +4 -4
- package/typecheck/testing/dist/valbuild-shared-typecheck-testing.esm.js +3 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var createForOfIteratorHelper = require('./createForOfIteratorHelper-
|
|
3
|
+
var createForOfIteratorHelper = require('./createForOfIteratorHelper-87a33eff.cjs.dev.js');
|
|
4
4
|
var core = require('@valbuild/core');
|
|
5
5
|
|
|
6
6
|
var VAL_CONFIG_SESSION_STORAGE_KEY = "val-config";
|
|
@@ -75,8 +75,16 @@ function isValCanvasPageMessage(data) {
|
|
|
75
75
|
if (createForOfIteratorHelper._typeof(data) !== "object" || data === null) return false;
|
|
76
76
|
var message = data;
|
|
77
77
|
if (message.val !== VAL_CANVAS_MESSAGE) return false;
|
|
78
|
-
return message.type === "ready" || message.type === "elements" || message.type === "clicked" || message.type === "pinch" || message.type === "zoom" || message.type === "refreshing";
|
|
78
|
+
return message.type === "ready" || message.type === "elements" || message.type === "clicked" || message.type === "pinch" || message.type === "zoom" || message.type === "refreshing" || message.type === "elementPickingStopped" || message.type === "elementPicked" && isPickedElement(data.element);
|
|
79
79
|
}
|
|
80
|
+
function isPickedElement(value) {
|
|
81
|
+
if (createForOfIteratorHelper._typeof(value) !== "object" || value === null) return false;
|
|
82
|
+
var element = value;
|
|
83
|
+
return typeof element.tag === "string" && typeof element.text === "string" && typeof element.selector === "string" && Array.isArray(element.classes) && element.classes.every(function (item) {
|
|
84
|
+
return typeof item === "string";
|
|
85
|
+
}) && (element.valPath === undefined || typeof element.valPath === "string");
|
|
86
|
+
}
|
|
87
|
+
var PICK_MODIFIERS = ["alt", "meta", "shift", "ctrl"];
|
|
80
88
|
|
|
81
89
|
/**
|
|
82
90
|
* Whether a value is a colour a `theme` message may carry.
|
|
@@ -108,6 +116,10 @@ function isValCanvasStudioMessage(data) {
|
|
|
108
116
|
// at all, and there is one guard rather than one per framework binding.
|
|
109
117
|
return isCanvasSelectionColor(message.selection) && isCanvasSelectionColor(message.selectionSoft);
|
|
110
118
|
}
|
|
119
|
+
if (message.type === "pickElements") {
|
|
120
|
+
var pick = data;
|
|
121
|
+
return typeof pick.enabled === "boolean" && typeof pick.active === "boolean" && typeof pick.keepPicked === "boolean" && PICK_MODIFIERS.includes(pick.modifier);
|
|
122
|
+
}
|
|
111
123
|
return message.type === "rescan" || message.type === "highlight" || message.type === "setPicking" || message.type === "sourceUpdate" || message.type === "sourcesSynced";
|
|
112
124
|
}
|
|
113
125
|
|
|
@@ -150,6 +162,319 @@ function withValCanvasParam(url) {
|
|
|
150
162
|
return "".concat(url).concat(separator).concat(VAL_CANVAS_PARAM, "=1");
|
|
151
163
|
}
|
|
152
164
|
|
|
165
|
+
/**
|
|
166
|
+
* Pointing at anything on a page, as Lovable's picker does: hover outlines
|
|
167
|
+
* the element under the pointer, a click picks it, and the assistant is told
|
|
168
|
+
* which (valbuild/home `docs/design-tab.md`).
|
|
169
|
+
*
|
|
170
|
+
* ANY element, not only what Val marks. The design tab changes code, and the
|
|
171
|
+
* thing a person wants changed is as often a wrapper, a gap or a button as a
|
|
172
|
+
* field -- so a field's path is extra information when there is one
|
|
173
|
+
* (`valPath`), never the condition for picking.
|
|
174
|
+
*
|
|
175
|
+
* Picking is on while a MODIFIER is held, so the page stays a page: links
|
|
176
|
+
* follow, menus open, and nothing has to be switched back off. `active`
|
|
177
|
+
* turns it on without one, for a Select button or a touch screen.
|
|
178
|
+
*
|
|
179
|
+
* Plain DOM, nothing of React's or the Studio's, and in `shared` because
|
|
180
|
+
* both halves need it: the canvas bridge (`@valbuild/next`,
|
|
181
|
+
* `@valbuild/tanstack`) runs it inside the proposal's page, which is another
|
|
182
|
+
* origin than the design tab and the only place the page's elements can be
|
|
183
|
+
* reached; the Studio's stories run it on a page of their own. Only the
|
|
184
|
+
* `PickedElement` crosses the frame (`valCanvasProtocol.ts`).
|
|
185
|
+
*/
|
|
186
|
+
|
|
187
|
+
var TEXT_LENGTH = 80;
|
|
188
|
+
var CLASSES = 6;
|
|
189
|
+
function describeElement(element, root) {
|
|
190
|
+
var _element$textContent, _element$closest$getA, _element$closest;
|
|
191
|
+
var text = ((_element$textContent = element.textContent) !== null && _element$textContent !== void 0 ? _element$textContent : "").replace(/\s+/g, " ").trim();
|
|
192
|
+
var valPath = (_element$closest$getA = (_element$closest = element.closest("[data-val-path]")) === null || _element$closest === void 0 ? void 0 : _element$closest.getAttribute("data-val-path")) !== null && _element$closest$getA !== void 0 ? _element$closest$getA : undefined;
|
|
193
|
+
return createForOfIteratorHelper._objectSpread2({
|
|
194
|
+
tag: element.tagName.toLowerCase(),
|
|
195
|
+
text: text.length > TEXT_LENGTH ? "".concat(text.slice(0, TEXT_LENGTH - 1), "\u2026") : text,
|
|
196
|
+
classes: Array.from(element.classList).slice(0, CLASSES),
|
|
197
|
+
selector: selectorOf(element, root)
|
|
198
|
+
}, valPath !== undefined ? {
|
|
199
|
+
valPath: valPath
|
|
200
|
+
} : {});
|
|
201
|
+
}
|
|
202
|
+
function selectorOf(element, root) {
|
|
203
|
+
var parts = [];
|
|
204
|
+
var at = element;
|
|
205
|
+
while (at !== null && at !== root) {
|
|
206
|
+
var tag = at.tagName.toLowerCase();
|
|
207
|
+
if (at.id !== "") {
|
|
208
|
+
parts.unshift("".concat(tag, "#").concat(at.id));
|
|
209
|
+
break;
|
|
210
|
+
}
|
|
211
|
+
var parent = at.parentElement;
|
|
212
|
+
var same = parent === null ? [] : Array.from(parent.children).filter(function (sibling) {
|
|
213
|
+
var _at;
|
|
214
|
+
return sibling.tagName === ((_at = at) === null || _at === void 0 ? void 0 : _at.tagName);
|
|
215
|
+
});
|
|
216
|
+
parts.unshift(same.length > 1 ? "".concat(tag, ":nth-of-type(").concat(same.indexOf(at) + 1, ")") : tag);
|
|
217
|
+
at = parent;
|
|
218
|
+
}
|
|
219
|
+
return parts.join(" > ");
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/** What a person is told to hold, on their own keyboard. */
|
|
223
|
+
function modifierLabel(modifier, mac) {
|
|
224
|
+
switch (modifier) {
|
|
225
|
+
case "alt":
|
|
226
|
+
return mac ? "⌥" : "Alt";
|
|
227
|
+
case "meta":
|
|
228
|
+
return mac ? "⌘" : "Win";
|
|
229
|
+
case "shift":
|
|
230
|
+
return mac ? "⇧" : "Shift";
|
|
231
|
+
case "ctrl":
|
|
232
|
+
return mac ? "⌃" : "Ctrl";
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
function held(event, modifier) {
|
|
236
|
+
switch (modifier) {
|
|
237
|
+
case "alt":
|
|
238
|
+
return event.altKey;
|
|
239
|
+
case "meta":
|
|
240
|
+
return event.metaKey;
|
|
241
|
+
case "shift":
|
|
242
|
+
return event.shiftKey;
|
|
243
|
+
case "ctrl":
|
|
244
|
+
return event.ctrlKey;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Listens on `root` (capturing, so the page's own handlers never see a pick)
|
|
249
|
+
* and returns what stops it.
|
|
250
|
+
*/
|
|
251
|
+
function attachElementPicker(root, options) {
|
|
252
|
+
var win = root.ownerDocument.defaultView;
|
|
253
|
+
var last = null;
|
|
254
|
+
var picking = function picking(event) {
|
|
255
|
+
return options.active() || held(event, options.modifier);
|
|
256
|
+
};
|
|
257
|
+
var target = function target(event) {
|
|
258
|
+
return event.target instanceof Element && root.contains(event.target) ? event.target : null;
|
|
259
|
+
};
|
|
260
|
+
var onMove = function onMove(event) {
|
|
261
|
+
last = {
|
|
262
|
+
x: event.clientX,
|
|
263
|
+
y: event.clientY
|
|
264
|
+
};
|
|
265
|
+
options.onHover(picking(event) ? target(event) : null);
|
|
266
|
+
};
|
|
267
|
+
var onClick = function onClick(event) {
|
|
268
|
+
if (!picking(event)) return;
|
|
269
|
+
var element = target(event);
|
|
270
|
+
if (element === null) return;
|
|
271
|
+
event.preventDefault();
|
|
272
|
+
event.stopPropagation();
|
|
273
|
+
options.onPick(element);
|
|
274
|
+
};
|
|
275
|
+
// Pressing the modifier with the pointer still: outline what is under it
|
|
276
|
+
// now, rather than after the next move.
|
|
277
|
+
var onKey = function onKey(event) {
|
|
278
|
+
if (!picking(event)) {
|
|
279
|
+
options.onHover(null);
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
if (last === null) return;
|
|
283
|
+
var under = root.ownerDocument.elementFromPoint(last.x, last.y);
|
|
284
|
+
options.onHover(under !== null && root.contains(under) ? under : null);
|
|
285
|
+
};
|
|
286
|
+
var onLeave = function onLeave() {
|
|
287
|
+
last = null;
|
|
288
|
+
options.onHover(null);
|
|
289
|
+
};
|
|
290
|
+
root.addEventListener("mousemove", onMove, true);
|
|
291
|
+
root.addEventListener("click", onClick, true);
|
|
292
|
+
root.addEventListener("mouseleave", onLeave);
|
|
293
|
+
win === null || win === void 0 || win.addEventListener("keydown", onKey, true);
|
|
294
|
+
win === null || win === void 0 || win.addEventListener("keyup", onKey, true);
|
|
295
|
+
return function () {
|
|
296
|
+
root.removeEventListener("mousemove", onMove, true);
|
|
297
|
+
root.removeEventListener("click", onClick, true);
|
|
298
|
+
root.removeEventListener("mouseleave", onLeave);
|
|
299
|
+
win === null || win === void 0 || win.removeEventListener("keydown", onKey, true);
|
|
300
|
+
win === null || win === void 0 || win.removeEventListener("keyup", onKey, true);
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* The outlines over the page while picking: the element under the pointer,
|
|
306
|
+
* named, and the one picked.
|
|
307
|
+
*
|
|
308
|
+
* Boxes `position: fixed` on top of everything, with `pointer-events: none`,
|
|
309
|
+
* appended to the page's body -- not outlines on the elements themselves.
|
|
310
|
+
* The canvas's field outlines are a stylesheet so they cannot disturb the
|
|
311
|
+
* page's layout (`ValCanvasBridge`); a fixed box is out of the flow, so it
|
|
312
|
+
* cannot either, and it is the one way to put a NAME beside any element, which
|
|
313
|
+
* a selector cannot reach.
|
|
314
|
+
*
|
|
315
|
+
* In a shadow root of one host element: the bridge re-measures the page on
|
|
316
|
+
* every `style` change under `body`, and a box that follows the pointer
|
|
317
|
+
* changes its style every frame. Inside a shadow root those changes are not
|
|
318
|
+
* the page's, so the host's one insertion is all the bridge sees.
|
|
319
|
+
*/
|
|
320
|
+
|
|
321
|
+
var TOP = "2147483647";
|
|
322
|
+
function createPickerOverlay(doc, initialColor) {
|
|
323
|
+
var color = initialColor;
|
|
324
|
+
var shown = {
|
|
325
|
+
hover: null,
|
|
326
|
+
picked: null
|
|
327
|
+
};
|
|
328
|
+
var host = doc.createElement("div");
|
|
329
|
+
host.setAttribute("data-val-picker", "");
|
|
330
|
+
var shadow = host.attachShadow({
|
|
331
|
+
mode: "open"
|
|
332
|
+
});
|
|
333
|
+
doc.body.appendChild(host);
|
|
334
|
+
var box = function box(kind) {
|
|
335
|
+
var el = doc.createElement("div");
|
|
336
|
+
el.setAttribute("data-kind", kind);
|
|
337
|
+
Object.assign(el.style, {
|
|
338
|
+
position: "fixed",
|
|
339
|
+
pointerEvents: "none",
|
|
340
|
+
zIndex: TOP,
|
|
341
|
+
boxSizing: "border-box",
|
|
342
|
+
display: "none"
|
|
343
|
+
});
|
|
344
|
+
shadow.appendChild(el);
|
|
345
|
+
return el;
|
|
346
|
+
};
|
|
347
|
+
var boxes = {
|
|
348
|
+
hover: box("hover"),
|
|
349
|
+
picked: box("picked")
|
|
350
|
+
};
|
|
351
|
+
var label = doc.createElement("span");
|
|
352
|
+
Object.assign(label.style, {
|
|
353
|
+
position: "absolute",
|
|
354
|
+
left: "-2px",
|
|
355
|
+
padding: "1px 4px",
|
|
356
|
+
borderRadius: "2px",
|
|
357
|
+
font: "500 10px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace",
|
|
358
|
+
color: "#fff",
|
|
359
|
+
whiteSpace: "nowrap"
|
|
360
|
+
});
|
|
361
|
+
boxes.hover.appendChild(label);
|
|
362
|
+
// The pointer says it is picking, and a link under it is not a link.
|
|
363
|
+
var cursor = doc.createElement("style");
|
|
364
|
+
cursor.textContent = "[data-val-picking] * { cursor: crosshair !important; }";
|
|
365
|
+
doc.head.appendChild(cursor);
|
|
366
|
+
var place = function place(kind) {
|
|
367
|
+
var element = shown[kind];
|
|
368
|
+
var el = boxes[kind];
|
|
369
|
+
if (element === null || !element.isConnected) {
|
|
370
|
+
el.style.display = "none";
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
373
|
+
var rect = element.getBoundingClientRect();
|
|
374
|
+
Object.assign(el.style, {
|
|
375
|
+
display: "block",
|
|
376
|
+
top: "".concat(rect.top - 2, "px"),
|
|
377
|
+
left: "".concat(rect.left - 2, "px"),
|
|
378
|
+
width: "".concat(rect.width + 4, "px"),
|
|
379
|
+
height: "".concat(rect.height + 4, "px"),
|
|
380
|
+
border: "2px ".concat(kind === "hover" ? "solid" : "dashed", " ").concat(color)
|
|
381
|
+
});
|
|
382
|
+
if (kind === "hover") {
|
|
383
|
+
label.textContent = elementLabel(element);
|
|
384
|
+
label.style.background = color;
|
|
385
|
+
// Above the box, unless that is off the top of the window.
|
|
386
|
+
if (rect.top >= 18) {
|
|
387
|
+
label.style.top = "";
|
|
388
|
+
label.style.bottom = "100%";
|
|
389
|
+
} else {
|
|
390
|
+
label.style.bottom = "";
|
|
391
|
+
label.style.top = "100%";
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
};
|
|
395
|
+
var frame = null;
|
|
396
|
+
var win = doc.defaultView;
|
|
397
|
+
var reposition = function reposition() {
|
|
398
|
+
if (frame !== null || win === null) return;
|
|
399
|
+
frame = win.requestAnimationFrame(function () {
|
|
400
|
+
frame = null;
|
|
401
|
+
place("hover");
|
|
402
|
+
place("picked");
|
|
403
|
+
});
|
|
404
|
+
};
|
|
405
|
+
win === null || win === void 0 || win.addEventListener("scroll", reposition, true);
|
|
406
|
+
win === null || win === void 0 || win.addEventListener("resize", reposition);
|
|
407
|
+
return {
|
|
408
|
+
show: function show(kind, element) {
|
|
409
|
+
shown[kind] = element;
|
|
410
|
+
if (kind === "hover") {
|
|
411
|
+
if (element !== null) {
|
|
412
|
+
doc.documentElement.setAttribute("data-val-picking", "");
|
|
413
|
+
} else {
|
|
414
|
+
doc.documentElement.removeAttribute("data-val-picking");
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
place(kind);
|
|
418
|
+
},
|
|
419
|
+
setColor: function setColor(next) {
|
|
420
|
+
color = next;
|
|
421
|
+
place("hover");
|
|
422
|
+
place("picked");
|
|
423
|
+
},
|
|
424
|
+
destroy: function destroy() {
|
|
425
|
+
if (frame !== null) win === null || win === void 0 || win.cancelAnimationFrame(frame);
|
|
426
|
+
win === null || win === void 0 || win.removeEventListener("scroll", reposition, true);
|
|
427
|
+
win === null || win === void 0 || win.removeEventListener("resize", reposition);
|
|
428
|
+
host.remove();
|
|
429
|
+
cursor.remove();
|
|
430
|
+
doc.documentElement.removeAttribute("data-val-picking");
|
|
431
|
+
}
|
|
432
|
+
};
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
/** `h2.mb-6.text-2xl`: what the hover box is named. */
|
|
436
|
+
function elementLabel(element) {
|
|
437
|
+
var classes = Array.from(element.classList).slice(0, 2);
|
|
438
|
+
return [element.tagName.toLowerCase()].concat(createForOfIteratorHelper._toConsumableArray(classes)).join(".");
|
|
439
|
+
}
|
|
440
|
+
/**
|
|
441
|
+
* Picking on a page, whole: the listeners, the outlines, and Esc to stop
|
|
442
|
+
* picking without the modifier. What a canvas bridge mounts.
|
|
443
|
+
*/
|
|
444
|
+
function startElementPicking(root, options) {
|
|
445
|
+
var _doc$defaultView;
|
|
446
|
+
var doc = root.ownerDocument;
|
|
447
|
+
var overlay = createPickerOverlay(doc, options.color);
|
|
448
|
+
var detach = attachElementPicker(root, {
|
|
449
|
+
modifier: options.modifier,
|
|
450
|
+
active: options.active,
|
|
451
|
+
onHover: function onHover(element) {
|
|
452
|
+
return overlay.show("hover", element);
|
|
453
|
+
},
|
|
454
|
+
onPick: function onPick(element) {
|
|
455
|
+
overlay.show("hover", null);
|
|
456
|
+
overlay.show("picked", element);
|
|
457
|
+
options.onPick(describeElement(element, root));
|
|
458
|
+
}
|
|
459
|
+
});
|
|
460
|
+
var onKey = function onKey(event) {
|
|
461
|
+
if (event.key === "Escape" && options.active()) options.onStop();
|
|
462
|
+
};
|
|
463
|
+
(_doc$defaultView = doc.defaultView) === null || _doc$defaultView === void 0 || _doc$defaultView.addEventListener("keydown", onKey);
|
|
464
|
+
return {
|
|
465
|
+
clearPicked: function clearPicked() {
|
|
466
|
+
return overlay.show("picked", null);
|
|
467
|
+
},
|
|
468
|
+
setColor: overlay.setColor,
|
|
469
|
+
stop: function stop() {
|
|
470
|
+
var _doc$defaultView2;
|
|
471
|
+
(_doc$defaultView2 = doc.defaultView) === null || _doc$defaultView2 === void 0 || _doc$defaultView2.removeEventListener("keydown", onKey);
|
|
472
|
+
detach();
|
|
473
|
+
overlay.destroy();
|
|
474
|
+
}
|
|
475
|
+
};
|
|
476
|
+
}
|
|
477
|
+
|
|
153
478
|
function parseRoutePattern(pattern) {
|
|
154
479
|
if (pattern === "" || pattern === "/") {
|
|
155
480
|
return [];
|
|
@@ -398,6 +723,10 @@ exports.VAL_CANVAS_MESSAGE = VAL_CANVAS_MESSAGE;
|
|
|
398
723
|
exports.VAL_CANVAS_PARAM = VAL_CANVAS_PARAM;
|
|
399
724
|
exports.VAL_CONFIG_SESSION_STORAGE_KEY = VAL_CONFIG_SESSION_STORAGE_KEY;
|
|
400
725
|
exports.VAL_THEME_SESSION_STORAGE_KEY = VAL_THEME_SESSION_STORAGE_KEY;
|
|
726
|
+
exports.attachElementPicker = attachElementPicker;
|
|
727
|
+
exports.createPickerOverlay = createPickerOverlay;
|
|
728
|
+
exports.describeElement = describeElement;
|
|
729
|
+
exports.elementLabel = elementLabel;
|
|
401
730
|
exports.formatRoutePattern = formatRoutePattern;
|
|
402
731
|
exports.getNextAppRouterSourceFolder = getNextAppRouterSourceFolder;
|
|
403
732
|
exports.getPageRouterSitemapTree = getPageRouterSitemapTree;
|
|
@@ -408,5 +737,7 @@ exports.isTanStackRoutesFolder = isTanStackRoutesFolder;
|
|
|
408
737
|
exports.isValCanvasFrame = isValCanvasFrame;
|
|
409
738
|
exports.isValCanvasPageMessage = isValCanvasPageMessage;
|
|
410
739
|
exports.isValCanvasStudioMessage = isValCanvasStudioMessage;
|
|
740
|
+
exports.modifierLabel = modifierLabel;
|
|
411
741
|
exports.parseRoutePattern = parseRoutePattern;
|
|
742
|
+
exports.startElementPicking = startElementPicking;
|
|
412
743
|
exports.withValCanvasParam = withValCanvasParam;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { g as _slicedToArray } from './slicedToArray-
|
|
2
|
-
import {
|
|
1
|
+
import { g as _slicedToArray } from './slicedToArray-22567815.esm.js';
|
|
2
|
+
import { a as _objectSpread2 } from './createForOfIteratorHelper-666a6d17.esm.js';
|
|
3
3
|
|
|
4
4
|
/** The proposal's project: the site's source, with what the proposal changed laid over it. */
|
|
5
5
|
function proposalProject(site, own) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var slicedToArray = require('./slicedToArray-
|
|
4
|
-
var createForOfIteratorHelper = require('./createForOfIteratorHelper-
|
|
3
|
+
var slicedToArray = require('./slicedToArray-c8a29f6b.cjs.dev.js');
|
|
4
|
+
var createForOfIteratorHelper = require('./createForOfIteratorHelper-87a33eff.cjs.dev.js');
|
|
5
5
|
|
|
6
6
|
/** The proposal's project: the site's source, with what the proposal changed laid over it. */
|
|
7
7
|
function proposalProject(site, own) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var slicedToArray = require('./slicedToArray-
|
|
4
|
-
var createForOfIteratorHelper = require('./createForOfIteratorHelper-
|
|
3
|
+
var slicedToArray = require('./slicedToArray-d99b4e2e.cjs.prod.js');
|
|
4
|
+
var createForOfIteratorHelper = require('./createForOfIteratorHelper-fef4fa7d.cjs.prod.js');
|
|
5
5
|
|
|
6
6
|
/** The proposal's project: the site's source, with what the proposal changed laid over it. */
|
|
7
7
|
function proposalProject(site, own) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as _inherits, a as _createClass, c as _wrapNativeSuper, e as _classCallCheck, f as _callSuper } from './slicedToArray-
|
|
1
|
+
import { _ as _inherits, a as _createClass, c as _wrapNativeSuper, e as _classCallCheck, f as _callSuper } from './slicedToArray-22567815.esm.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { fromError } from 'zod-validation-error';
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { e as _toPropertyKey, f as _unsupportedIterableToArray } from './createForOfIteratorHelper-666a6d17.esm.js';
|
|
2
2
|
|
|
3
3
|
function _regeneratorDefine(e, r, n, t) {
|
|
4
4
|
var i = Object.defineProperty;
|
|
@@ -240,22 +240,6 @@ function _wrapNativeSuper(t) {
|
|
|
240
240
|
}, _wrapNativeSuper(t);
|
|
241
241
|
}
|
|
242
242
|
|
|
243
|
-
function _arrayWithoutHoles(r) {
|
|
244
|
-
if (Array.isArray(r)) return _arrayLikeToArray(r);
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
function _iterableToArray(r) {
|
|
248
|
-
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
function _nonIterableSpread() {
|
|
252
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
function _toConsumableArray(r) {
|
|
256
|
-
return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
|
|
257
|
-
}
|
|
258
|
-
|
|
259
243
|
function _arrayWithHoles(r) {
|
|
260
244
|
if (Array.isArray(r)) return r;
|
|
261
245
|
}
|
|
@@ -296,4 +280,4 @@ function _slicedToArray(r, e) {
|
|
|
296
280
|
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
297
281
|
}
|
|
298
282
|
|
|
299
|
-
export { _inherits as _, _createClass as a, _asyncToGenerator as b, _wrapNativeSuper as c, _regenerator as d, _classCallCheck as e, _callSuper as f, _slicedToArray as g
|
|
283
|
+
export { _inherits as _, _createClass as a, _asyncToGenerator as b, _wrapNativeSuper as c, _regenerator as d, _classCallCheck as e, _callSuper as f, _slicedToArray as g };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var createForOfIteratorHelper = require('./createForOfIteratorHelper-
|
|
3
|
+
var createForOfIteratorHelper = require('./createForOfIteratorHelper-87a33eff.cjs.dev.js');
|
|
4
4
|
|
|
5
5
|
function _regeneratorDefine(e, r, n, t) {
|
|
6
6
|
var i = Object.defineProperty;
|
|
@@ -242,22 +242,6 @@ function _wrapNativeSuper(t) {
|
|
|
242
242
|
}, _wrapNativeSuper(t);
|
|
243
243
|
}
|
|
244
244
|
|
|
245
|
-
function _arrayWithoutHoles(r) {
|
|
246
|
-
if (Array.isArray(r)) return createForOfIteratorHelper._arrayLikeToArray(r);
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
function _iterableToArray(r) {
|
|
250
|
-
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
function _nonIterableSpread() {
|
|
254
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
function _toConsumableArray(r) {
|
|
258
|
-
return _arrayWithoutHoles(r) || _iterableToArray(r) || createForOfIteratorHelper._unsupportedIterableToArray(r) || _nonIterableSpread();
|
|
259
|
-
}
|
|
260
|
-
|
|
261
245
|
function _arrayWithHoles(r) {
|
|
262
246
|
if (Array.isArray(r)) return r;
|
|
263
247
|
}
|
|
@@ -305,5 +289,4 @@ exports._createClass = _createClass;
|
|
|
305
289
|
exports._inherits = _inherits;
|
|
306
290
|
exports._regenerator = _regenerator;
|
|
307
291
|
exports._slicedToArray = _slicedToArray;
|
|
308
|
-
exports._toConsumableArray = _toConsumableArray;
|
|
309
292
|
exports._wrapNativeSuper = _wrapNativeSuper;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var createForOfIteratorHelper = require('./createForOfIteratorHelper-
|
|
3
|
+
var createForOfIteratorHelper = require('./createForOfIteratorHelper-fef4fa7d.cjs.prod.js');
|
|
4
4
|
|
|
5
5
|
function _regeneratorDefine(e, r, n, t) {
|
|
6
6
|
var i = Object.defineProperty;
|
|
@@ -242,22 +242,6 @@ function _wrapNativeSuper(t) {
|
|
|
242
242
|
}, _wrapNativeSuper(t);
|
|
243
243
|
}
|
|
244
244
|
|
|
245
|
-
function _arrayWithoutHoles(r) {
|
|
246
|
-
if (Array.isArray(r)) return createForOfIteratorHelper._arrayLikeToArray(r);
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
function _iterableToArray(r) {
|
|
250
|
-
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
function _nonIterableSpread() {
|
|
254
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
function _toConsumableArray(r) {
|
|
258
|
-
return _arrayWithoutHoles(r) || _iterableToArray(r) || createForOfIteratorHelper._unsupportedIterableToArray(r) || _nonIterableSpread();
|
|
259
|
-
}
|
|
260
|
-
|
|
261
245
|
function _arrayWithHoles(r) {
|
|
262
246
|
if (Array.isArray(r)) return r;
|
|
263
247
|
}
|
|
@@ -305,5 +289,4 @@ exports._createClass = _createClass;
|
|
|
305
289
|
exports._inherits = _inherits;
|
|
306
290
|
exports._regenerator = _regenerator;
|
|
307
291
|
exports._slicedToArray = _slicedToArray;
|
|
308
|
-
exports._toConsumableArray = _toConsumableArray;
|
|
309
292
|
exports._wrapNativeSuper = _wrapNativeSuper;
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var createForOfIteratorHelper = require('../../dist/createForOfIteratorHelper-
|
|
5
|
+
var createForOfIteratorHelper = require('../../dist/createForOfIteratorHelper-87a33eff.cjs.dev.js');
|
|
6
6
|
var core = require('@valbuild/core');
|
|
7
|
-
var slicedToArray = require('../../dist/slicedToArray-
|
|
7
|
+
var slicedToArray = require('../../dist/slicedToArray-c8a29f6b.cjs.dev.js');
|
|
8
8
|
var zod = require('zod');
|
|
9
|
-
var protocol = require('../../dist/protocol-
|
|
9
|
+
var protocol = require('../../dist/protocol-ac1c3ec7.cjs.dev.js');
|
|
10
10
|
var zodValidationError = require('zod-validation-error');
|
|
11
|
-
var getSitemapTree = require('../../dist/getSitemapTree-
|
|
11
|
+
var getSitemapTree = require('../../dist/getSitemapTree-be70d9fc.cjs.dev.js');
|
|
12
12
|
var FlexSearch = require('flexsearch');
|
|
13
13
|
var utils = require('../../dist/utils-d3d8b4b5.cjs.dev.js');
|
|
14
14
|
|
|
@@ -619,7 +619,7 @@ function convertListItemToRemirrorParagraph(rtChildren) {
|
|
|
619
619
|
var newChild = convertParagraphToRemirror(child.children);
|
|
620
620
|
if (lastChild.type === "paragraph" && newChild.type === "paragraph") {
|
|
621
621
|
if (newChild.content) {
|
|
622
|
-
lastChildContent.push.apply(lastChildContent,
|
|
622
|
+
lastChildContent.push.apply(lastChildContent, createForOfIteratorHelper._toConsumableArray(newChild.content));
|
|
623
623
|
} else {
|
|
624
624
|
// no content - skip
|
|
625
625
|
}
|
|
@@ -1495,6 +1495,23 @@ var PlanRefusalError = zod.z.object({
|
|
|
1495
1495
|
*/
|
|
1496
1496
|
var VAL_STUDIO_HEADER = "x-val-studio";
|
|
1497
1497
|
|
|
1498
|
+
/**
|
|
1499
|
+
* On a user message in an AI chat: the tools called in the turn it asked for,
|
|
1500
|
+
* as the content server keeps them (valbuild/home `docs/proposals.md`,
|
|
1501
|
+
* Flow H) - what each tool row shows, never what the tool read or wrote.
|
|
1502
|
+
*
|
|
1503
|
+
* A chat with a summary this cannot read loads without its tool rows rather
|
|
1504
|
+
* than not at all, hence the `catch`.
|
|
1505
|
+
*/
|
|
1506
|
+
var AIToolCallSummaries = zod.z.array(zod.z.object({
|
|
1507
|
+
toolCallId: zod.z.string(),
|
|
1508
|
+
name: zod.z.string(),
|
|
1509
|
+
isError: zod.z["boolean"](),
|
|
1510
|
+
/** `ask_user_question`: what was asked, and what was answered. */
|
|
1511
|
+
questions: zod.z.array(zod.z.unknown()).optional(),
|
|
1512
|
+
answers: zod.z.array(zod.z.unknown()).optional()
|
|
1513
|
+
})).optional()["catch"](undefined);
|
|
1514
|
+
|
|
1498
1515
|
/**
|
|
1499
1516
|
* What Val Build answered, mapped onto the statuses this server speaks: a
|
|
1500
1517
|
* `code` in the JSON is what the web components act on, so it is passed
|
|
@@ -3479,7 +3496,13 @@ var Api = {
|
|
|
3479
3496
|
query: {
|
|
3480
3497
|
limit: onlyOneStringQueryParam.optional(),
|
|
3481
3498
|
cursor_updatedAt: onlyOneStringQueryParam.optional(),
|
|
3482
|
-
cursor_id: onlyOneStringQueryParam.optional()
|
|
3499
|
+
cursor_id: onlyOneStringQueryParam.optional(),
|
|
3500
|
+
/**
|
|
3501
|
+
* The proposal the Studio is in, by name: lists that proposal's
|
|
3502
|
+
* chats, everyone's, instead of your own (valbuild/home
|
|
3503
|
+
* `docs/proposals.md`, Flow H).
|
|
3504
|
+
*/
|
|
3505
|
+
proposal: onlyOneStringQueryParam.optional()
|
|
3483
3506
|
},
|
|
3484
3507
|
cookies: createForOfIteratorHelper._defineProperty({}, VAL_SESSION_COOKIE, zod.z.string().optional())
|
|
3485
3508
|
},
|
|
@@ -3490,7 +3513,9 @@ var Api = {
|
|
|
3490
3513
|
id: zod.z.string(),
|
|
3491
3514
|
name: zod.z.string().nullable(),
|
|
3492
3515
|
createdAt: zod.z.string(),
|
|
3493
|
-
updatedAt: zod.z.string()
|
|
3516
|
+
updatedAt: zod.z.string(),
|
|
3517
|
+
/** Who is in a proposal's chat, starter first. */
|
|
3518
|
+
authorIds: zod.z.array(zod.z.string()).optional()
|
|
3494
3519
|
})),
|
|
3495
3520
|
nextCursor: zod.z.object({
|
|
3496
3521
|
updatedAt: zod.z.string(),
|
|
@@ -3534,6 +3559,9 @@ var Api = {
|
|
|
3534
3559
|
status: zod.z.literal(200),
|
|
3535
3560
|
json: zod.z.object({
|
|
3536
3561
|
messages: zod.z.array(zod.z.object({
|
|
3562
|
+
/** Who asked, on a user message in a proposal's chat. */
|
|
3563
|
+
authorId: zod.z.string().nullable().optional(),
|
|
3564
|
+
toolCalls: AIToolCallSummaries,
|
|
3537
3565
|
role: zod.z.string(),
|
|
3538
3566
|
content: zod.z.union([zod.z.string(), zod.z.array(zod.z.union([zod.z.object({
|
|
3539
3567
|
type: zod.z.literal("text"),
|
|
@@ -8314,7 +8342,7 @@ function selectionClosure(patchSets, selected, patchIds) {
|
|
|
8314
8342
|
try {
|
|
8315
8343
|
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
8316
8344
|
var group = _step4.value;
|
|
8317
|
-
if (
|
|
8345
|
+
if (createForOfIteratorHelper._toConsumableArray(group).some(function (id) {
|
|
8318
8346
|
return wanted.has(id);
|
|
8319
8347
|
})) {
|
|
8320
8348
|
var _iterator6 = createForOfIteratorHelper._createForOfIteratorHelper(group),
|
|
@@ -8597,7 +8625,7 @@ function _selfCheck() {
|
|
|
8597
8625
|
case 15:
|
|
8598
8626
|
for (_i2 = 0, _Object$entries2 = Object.entries(result); _i2 < _Object$entries2.length; _i2++) {
|
|
8599
8627
|
_Object$entries2$_i = slicedToArray._slicedToArray(_Object$entries2[_i2], 2), _sourcePath = _Object$entries2$_i[0], _list = _Object$entries2$_i[1];
|
|
8600
|
-
(_found = (_found$_ref = found[_ref = _sourcePath]) !== null && _found$_ref !== void 0 ? _found$_ref : found[_ref] = []).push.apply(_found,
|
|
8628
|
+
(_found = (_found$_ref = found[_ref = _sourcePath]) !== null && _found$_ref !== void 0 ? _found$_ref : found[_ref] = []).push.apply(_found, createForOfIteratorHelper._toConsumableArray(_list));
|
|
8601
8629
|
}
|
|
8602
8630
|
case 16:
|
|
8603
8631
|
_context.n = 2;
|
|
@@ -8684,6 +8712,10 @@ exports.VAL_CANVAS_MESSAGE = getSitemapTree.VAL_CANVAS_MESSAGE;
|
|
|
8684
8712
|
exports.VAL_CANVAS_PARAM = getSitemapTree.VAL_CANVAS_PARAM;
|
|
8685
8713
|
exports.VAL_CONFIG_SESSION_STORAGE_KEY = getSitemapTree.VAL_CONFIG_SESSION_STORAGE_KEY;
|
|
8686
8714
|
exports.VAL_THEME_SESSION_STORAGE_KEY = getSitemapTree.VAL_THEME_SESSION_STORAGE_KEY;
|
|
8715
|
+
exports.attachElementPicker = getSitemapTree.attachElementPicker;
|
|
8716
|
+
exports.createPickerOverlay = getSitemapTree.createPickerOverlay;
|
|
8717
|
+
exports.describeElement = getSitemapTree.describeElement;
|
|
8718
|
+
exports.elementLabel = getSitemapTree.elementLabel;
|
|
8687
8719
|
exports.formatRoutePattern = getSitemapTree.formatRoutePattern;
|
|
8688
8720
|
exports.getNextAppRouterSourceFolder = getSitemapTree.getNextAppRouterSourceFolder;
|
|
8689
8721
|
exports.getPageRouterSitemapTree = getSitemapTree.getPageRouterSitemapTree;
|
|
@@ -8694,10 +8726,13 @@ exports.isTanStackRoutesFolder = getSitemapTree.isTanStackRoutesFolder;
|
|
|
8694
8726
|
exports.isValCanvasFrame = getSitemapTree.isValCanvasFrame;
|
|
8695
8727
|
exports.isValCanvasPageMessage = getSitemapTree.isValCanvasPageMessage;
|
|
8696
8728
|
exports.isValCanvasStudioMessage = getSitemapTree.isValCanvasStudioMessage;
|
|
8729
|
+
exports.modifierLabel = getSitemapTree.modifierLabel;
|
|
8697
8730
|
exports.parseRoutePattern = getSitemapTree.parseRoutePattern;
|
|
8731
|
+
exports.startElementPicking = getSitemapTree.startElementPicking;
|
|
8698
8732
|
exports.withValCanvasParam = getSitemapTree.withValCanvasParam;
|
|
8699
8733
|
exports.AA_LARGE = AA_LARGE;
|
|
8700
8734
|
exports.AA_TEXT = AA_TEXT;
|
|
8735
|
+
exports.AIToolCallSummaries = AIToolCallSummaries;
|
|
8701
8736
|
exports.AnalyticsBeacon = AnalyticsBeacon;
|
|
8702
8737
|
exports.Api = Api;
|
|
8703
8738
|
exports.BRAND_CONTRAST_PAIRS = BRAND_CONTRAST_PAIRS;
|