@yahoo/uds-create-config 4.13.0 → 4.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/capture/capture-to-spec.js +43 -0
- package/dist/configs/CanvasConfig.d.ts +1063 -91
- package/dist/configs/react-native-system.d.ts +696 -48
- package/dist/configs/system.d.ts +696 -48
- package/dist/configs/system.js +2 -0
- package/dist/entities/system/Component.d.ts +467 -32
- package/dist/entities/system/Component.js +22 -3
- package/dist/framework/Config.d.ts +1 -1
- package/dist/framework/Config.js +1 -1
- package/dist/framework/prop-surface.d.ts +1 -24
- package/dist/framework/prop-surface.js +6 -36
- package/dist/framework/render-spec.d.ts +53 -4
- package/dist/framework/render-spec.js +163 -27
- package/dist/framework/schema-version.d.ts +1 -1
- package/dist/framework/schema-version.js +5 -5
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/migrations/2.0.0/v1-artifact.d.ts +348 -24
- package/dist/migrations/20260923112910_computed_values_and_repeated_nodes.d.ts +17 -0
- package/dist/migrations/20260923112910_computed_values_and_repeated_nodes.js +10 -0
- package/dist/renderer/UdsRenderer.js +2 -1
- package/dist/renderer/computed.d.ts +16 -0
- package/dist/renderer/computed.js +21 -0
- package/dist/renderer/index.d.ts +2 -1
- package/dist/renderer/index.js +2 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
|
@@ -234,6 +234,10 @@ var Converter = class {
|
|
|
234
234
|
if (text) props[prop] = text;
|
|
235
235
|
}
|
|
236
236
|
}
|
|
237
|
+
if ("value" in declared && props.value === void 0) {
|
|
238
|
+
const field = fieldValue(el, declared.value);
|
|
239
|
+
if (field !== void 0) props.value = field;
|
|
240
|
+
}
|
|
237
241
|
const loose = [];
|
|
238
242
|
const looseSelector = renders ? ROOT_LAYER : `${ROOT_LAYER}, svg`;
|
|
239
243
|
for (const nested of asArray(el.querySelectorAll(looseSelector))) {
|
|
@@ -411,6 +415,45 @@ function withinAny(el, layers, root) {
|
|
|
411
415
|
function layerOf(root, path, layer) {
|
|
412
416
|
for (const candidate of asArray(root.querySelectorAll(`[data-uds-component="${path}"][data-uds-layer="${layer}"]`))) if (nearestRoot(candidate) === root) return candidate;
|
|
413
417
|
}
|
|
418
|
+
/** Field types whose `value` is a submit token rather than what the field shows. */
|
|
419
|
+
const NON_TEXT_INPUT = new Set([
|
|
420
|
+
"checkbox",
|
|
421
|
+
"radio",
|
|
422
|
+
"hidden",
|
|
423
|
+
"submit",
|
|
424
|
+
"button",
|
|
425
|
+
"reset",
|
|
426
|
+
"image",
|
|
427
|
+
"file"
|
|
428
|
+
]);
|
|
429
|
+
/**
|
|
430
|
+
* What the first form field under `root` shows: an input's `value` attribute, a textarea's text, a
|
|
431
|
+
* select's chosen option. A field inside a nested component belongs to that component. The value is
|
|
432
|
+
* typed by the declaration, so a `number` prop reads `24` rather than `'24'`.
|
|
433
|
+
*/
|
|
434
|
+
function fieldValue(root, declaration) {
|
|
435
|
+
for (const field of asArray(root.querySelectorAll("input, textarea, select"))) {
|
|
436
|
+
if (field.closest(ROOT_LAYER) !== root && nearestRoot(field) !== root) continue;
|
|
437
|
+
if (!visible(field) || hiddenBetween(field, root)) continue;
|
|
438
|
+
let raw = null;
|
|
439
|
+
const tag = field.tagName.toLowerCase();
|
|
440
|
+
if (tag === "input") {
|
|
441
|
+
const type = (field.getAttribute("type") ?? "text").toLowerCase();
|
|
442
|
+
if (NON_TEXT_INPUT.has(type)) continue;
|
|
443
|
+
raw = field.getAttribute("value");
|
|
444
|
+
} else if (tag === "textarea") raw = field.textContent;
|
|
445
|
+
else {
|
|
446
|
+
const chosen = asArray(field.querySelectorAll("option")).find((option) => option.hasAttribute("selected"));
|
|
447
|
+
raw = chosen ? chosen.getAttribute("value") ?? chosen.textContent : null;
|
|
448
|
+
}
|
|
449
|
+
if (raw === null || raw === "") return void 0;
|
|
450
|
+
if (declaration?.type === "number") {
|
|
451
|
+
const number = Number(raw);
|
|
452
|
+
return Number.isFinite(number) ? number : void 0;
|
|
453
|
+
}
|
|
454
|
+
return raw;
|
|
455
|
+
}
|
|
456
|
+
}
|
|
414
457
|
function svgOf(svg) {
|
|
415
458
|
return {
|
|
416
459
|
paths: asArray(svg.querySelectorAll("path")).map((p) => p.getAttribute("d") ?? "").filter(Boolean),
|