@fuaran-ui/ops 0.19.0 → 0.21.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/index.cjs +519 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +29 -6
- package/dist/index.d.ts +29 -6
- package/dist/index.js +519 -26
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -484,7 +484,9 @@ var action = (a) => {
|
|
|
484
484
|
case "CommitLocal":
|
|
485
485
|
return caseObj("CommitLocal", [["nodeId", str(a.nodeId)]]);
|
|
486
486
|
case "WriteToClipboard":
|
|
487
|
-
return caseObj("WriteToClipboard", [["text",
|
|
487
|
+
return caseObj("WriteToClipboard", [["text", textSource(a.text)]]);
|
|
488
|
+
case "Print":
|
|
489
|
+
return caseObj("Print", []);
|
|
488
490
|
case "ReadFileBody":
|
|
489
491
|
return caseObj("ReadFileBody", [
|
|
490
492
|
["encoding", str(a.encoding)],
|
|
@@ -693,6 +695,42 @@ var mediaSpec = (s) => {
|
|
|
693
695
|
fields.push(["label", textSource(s.label)]);
|
|
694
696
|
if (s.loop) fields.push(["loop", bool(true)]);
|
|
695
697
|
fields.push(["src", binding(s.src)]);
|
|
698
|
+
if (s.tracks.length > 0) fields.push(["tracks", jArray(s.tracks.map(trackEntry))]);
|
|
699
|
+
if (s.transcript !== void 0) fields.push(["transcript", textSource(s.transcript)]);
|
|
700
|
+
return jObject(fields);
|
|
701
|
+
};
|
|
702
|
+
var trackEntry = (t) => {
|
|
703
|
+
const fields = [];
|
|
704
|
+
if (t.default) fields.push(["default", bool(true)]);
|
|
705
|
+
fields.push(["kind", str(t.kind)]);
|
|
706
|
+
fields.push(["label", textSource(t.label)]);
|
|
707
|
+
fields.push(["src", binding(t.src)]);
|
|
708
|
+
fields.push(["srcLang", str(t.srcLang)]);
|
|
709
|
+
return jObject(fields);
|
|
710
|
+
};
|
|
711
|
+
var treeSpec = (s) => {
|
|
712
|
+
const fields = [["items", jArray(s.items.map(treeItem))]];
|
|
713
|
+
if (s.expandedStateKey !== void 0) fields.push(["expandedStateKey", str(s.expandedStateKey)]);
|
|
714
|
+
if (s.onSelect !== void 0) fields.push(["onSelect", CLOSURE]);
|
|
715
|
+
if (s.selectionStateKey !== void 0)
|
|
716
|
+
fields.push(["selectionStateKey", str(s.selectionStateKey)]);
|
|
717
|
+
return jObject(fields);
|
|
718
|
+
};
|
|
719
|
+
var treeItem = (t) => {
|
|
720
|
+
const fields = [];
|
|
721
|
+
if (t.children.length > 0) fields.push(["children", jArray(t.children.map(treeItem))]);
|
|
722
|
+
if (t.icon !== void 0) fields.push(["icon", str(t.icon)]);
|
|
723
|
+
fields.push(["id", str(t.id)]);
|
|
724
|
+
fields.push(["label", textSource(t.label)]);
|
|
725
|
+
return jObject(fields);
|
|
726
|
+
};
|
|
727
|
+
var embedSpec = (s) => {
|
|
728
|
+
const fields = [];
|
|
729
|
+
if (s.aspectRatio !== "Natural") fields.push(["aspectRatio", str(s.aspectRatio)]);
|
|
730
|
+
if (s.permissions.length > 0)
|
|
731
|
+
fields.push(["permissions", jArray(s.permissions.map((p) => str(p)))]);
|
|
732
|
+
fields.push(["src", binding(s.src)]);
|
|
733
|
+
fields.push(["title", textSource(s.title)]);
|
|
696
734
|
return jObject(fields);
|
|
697
735
|
};
|
|
698
736
|
var listSpec = (s) => jObject([
|
|
@@ -905,6 +943,10 @@ var displayKind = (d) => {
|
|
|
905
943
|
return hoistSpec("Image", imageSpec(d.spec));
|
|
906
944
|
case "Media":
|
|
907
945
|
return hoistSpec("Media", mediaSpec(d.spec));
|
|
946
|
+
case "Tree":
|
|
947
|
+
return hoistSpec("Tree", treeSpec(d.spec));
|
|
948
|
+
case "Embed":
|
|
949
|
+
return hoistSpec("Embed", embedSpec(d.spec));
|
|
908
950
|
case "List":
|
|
909
951
|
return hoistSpec("List", listSpec(d.spec));
|
|
910
952
|
case "Toast":
|
|
@@ -992,6 +1034,40 @@ var formFieldKind = (autoBind, k) => {
|
|
|
992
1034
|
["orientation", str(k.orientation)],
|
|
993
1035
|
...valueField(k.value, schema.controlValueDefaults.choice, (v) => binding(v, staticStringOpt))
|
|
994
1036
|
]);
|
|
1037
|
+
case "Combobox": {
|
|
1038
|
+
const fields = [];
|
|
1039
|
+
if (k.allowFreeText) fields.push(["allowFreeText", bool(true)]);
|
|
1040
|
+
fields.push(...handlerField("onChange", k.onChange));
|
|
1041
|
+
fields.push(["options", binding(k.options, staticSelectOptions)]);
|
|
1042
|
+
fields.push(
|
|
1043
|
+
...valueField(k.value, schema.controlValueDefaults.choice, (v) => binding(v, staticStringOpt))
|
|
1044
|
+
);
|
|
1045
|
+
return caseObj("Combobox", fields);
|
|
1046
|
+
}
|
|
1047
|
+
case "Tokens": {
|
|
1048
|
+
const fields = [];
|
|
1049
|
+
if (!k.allowFreeText) fields.push(["allowFreeText", bool(false)]);
|
|
1050
|
+
fields.push(...handlerField("onChange", k.onChange));
|
|
1051
|
+
if (k.suggestions !== void 0)
|
|
1052
|
+
fields.push(["suggestions", binding(k.suggestions, staticSelectOptions)]);
|
|
1053
|
+
fields.push(
|
|
1054
|
+
...valueField(k.value, schema.controlValueDefaults.tokens, (v) => binding(v, staticStringList))
|
|
1055
|
+
);
|
|
1056
|
+
return caseObj("Tokens", fields);
|
|
1057
|
+
}
|
|
1058
|
+
case "Rating": {
|
|
1059
|
+
const fields = [];
|
|
1060
|
+
if (k.allowHalf) fields.push(["allowHalf", bool(true)]);
|
|
1061
|
+
fields.push(["max", num(k.max)]);
|
|
1062
|
+
fields.push(...handlerField("onChange", k.onChange));
|
|
1063
|
+
fields.push(...valueField(k.value, schema.controlValueDefaults.number, (v) => binding(v)));
|
|
1064
|
+
return caseObj("Rating", fields);
|
|
1065
|
+
}
|
|
1066
|
+
case "Color":
|
|
1067
|
+
return caseObj("Color", [
|
|
1068
|
+
...handlerField("onChange", k.onChange),
|
|
1069
|
+
...valueField(k.value, schema.controlValueDefaults.color, (v) => binding(v))
|
|
1070
|
+
]);
|
|
995
1071
|
case "TextArea":
|
|
996
1072
|
return caseObj("TextArea", [
|
|
997
1073
|
...handlerField("onChange", k.onChange),
|
|
@@ -1108,6 +1184,10 @@ var fileUploadSpec = (s) => {
|
|
|
1108
1184
|
["onSelect", CLOSURE]
|
|
1109
1185
|
];
|
|
1110
1186
|
if (s.disabled !== void 0) fields.push(["disabled", binding(s.disabled)]);
|
|
1187
|
+
if (s.acceptPaste) fields.push(["acceptPaste", bool(true)]);
|
|
1188
|
+
if (s.dropTarget) fields.push(["dropTarget", bool(true)]);
|
|
1189
|
+
if (s.capture !== void 0) fields.push(["capture", str(s.capture)]);
|
|
1190
|
+
if (s.destination !== void 0) fields.push(["destination", str(s.destination)]);
|
|
1111
1191
|
return jObject(fields);
|
|
1112
1192
|
};
|
|
1113
1193
|
var inputKind = (i) => {
|
|
@@ -1245,6 +1325,11 @@ var gridSpec = (s) => {
|
|
|
1245
1325
|
if (s.pageStateKey !== void 0) fields.push(["pageStateKey", str(s.pageStateKey)]);
|
|
1246
1326
|
if (s.defaultSort !== void 0) fields.push(["defaultSort", defaultSortJson(s.defaultSort)]);
|
|
1247
1327
|
if (s.editStateKey !== void 0) fields.push(["editStateKey", str(s.editStateKey)]);
|
|
1328
|
+
if (s.transferOutKey !== void 0) fields.push(["transferOutKey", str(s.transferOutKey)]);
|
|
1329
|
+
if (s.transferInKey !== void 0) fields.push(["transferInKey", str(s.transferInKey)]);
|
|
1330
|
+
if (s.exportable) fields.push(["exportable", bool(true)]);
|
|
1331
|
+
if (s.keepRowsTogether) fields.push(["keepRowsTogether", bool(true)]);
|
|
1332
|
+
if (s.repeatHeader) fields.push(["repeatHeader", bool(true)]);
|
|
1248
1333
|
if (s.staticRows !== void 0) {
|
|
1249
1334
|
const sr = s.staticRows;
|
|
1250
1335
|
const srFields = [
|
|
@@ -1338,6 +1423,8 @@ var boxSpec = (s) => {
|
|
|
1338
1423
|
if (s.heading !== void 0) fields.push(["heading", textSource(s.heading)]);
|
|
1339
1424
|
fields.push(["layout", boxLayout(s.layout)]);
|
|
1340
1425
|
fields.push(["role", str(s.role)]);
|
|
1426
|
+
if (s.keepTogether) fields.push(["keepTogether", bool(true)]);
|
|
1427
|
+
if (s.breakBefore) fields.push(["breakBefore", bool(true)]);
|
|
1341
1428
|
return jObject(fields);
|
|
1342
1429
|
};
|
|
1343
1430
|
var splitPanelSpec = (s) => jObject([
|
|
@@ -1392,6 +1479,8 @@ var modalSpec = (s) => {
|
|
|
1392
1479
|
];
|
|
1393
1480
|
if (s.onDismiss !== void 0) fields.push(["onDismiss", action(s.onDismiss)]);
|
|
1394
1481
|
if (s.heading !== void 0) fields.push(["heading", textSource(s.heading)]);
|
|
1482
|
+
if (s.modality !== "Modal") fields.push(["modality", str(s.modality)]);
|
|
1483
|
+
if (s.anchor !== void 0) fields.push(["anchor", str(s.anchor)]);
|
|
1395
1484
|
return jObject(fields);
|
|
1396
1485
|
};
|
|
1397
1486
|
var scrollAreaSpec = (s) => {
|
|
@@ -1547,6 +1636,9 @@ var nodeKind = (k) => {
|
|
|
1547
1636
|
]);
|
|
1548
1637
|
case "Switch":
|
|
1549
1638
|
return caseObj("Switch", [
|
|
1639
|
+
// Phase 1122 — omitted when absent, so every pre-1122 switch stays
|
|
1640
|
+
// byte-identical.
|
|
1641
|
+
...k.spec.autoAdvanceMs !== void 0 ? [["autoAdvanceMs", num(k.spec.autoAdvanceMs)]] : [],
|
|
1550
1642
|
[
|
|
1551
1643
|
"cases",
|
|
1552
1644
|
jArray(
|
|
@@ -1621,6 +1713,8 @@ var semanticStyle = (s) => {
|
|
|
1621
1713
|
if (s.weight !== void 0 && s.weight !== "Standard") fields.push(["weight", str(s.weight)]);
|
|
1622
1714
|
if (s.role !== void 0 && s.role !== "None") fields.push(["role", str(s.role)]);
|
|
1623
1715
|
if (s.voice !== void 0 && s.voice !== "Default") fields.push(["voice", str(s.voice)]);
|
|
1716
|
+
if (s.direction !== void 0 && s.direction !== "auto")
|
|
1717
|
+
fields.push(["direction", str(s.direction)]);
|
|
1624
1718
|
return jObject(fields);
|
|
1625
1719
|
};
|
|
1626
1720
|
var accessibility = (a) => {
|
|
@@ -1634,7 +1728,9 @@ var accessibility = (a) => {
|
|
|
1634
1728
|
return jObject(fields);
|
|
1635
1729
|
};
|
|
1636
1730
|
var isEmptyState = (s) => s.onLoading === void 0 && s.onEmpty === void 0 && s.onError === void 0;
|
|
1637
|
-
var isDefaultStyle = (s) => (s.emphasis === void 0 || s.emphasis === "Normal") && (s.tone === void 0 || s.tone === "Default") && (s.weight === void 0 || s.weight === "Standard") && (s.role === void 0 || s.role === "None") && (s.voice === void 0 || s.voice === "Default")
|
|
1731
|
+
var isDefaultStyle = (s) => (s.emphasis === void 0 || s.emphasis === "Normal") && (s.tone === void 0 || s.tone === "Default") && (s.weight === void 0 || s.weight === "Standard") && (s.role === void 0 || s.role === "None") && (s.voice === void 0 || s.voice === "Default") && // Phase 1472 — `auto` is this member's identity, so a style that declares only
|
|
1732
|
+
// a direction is NOT all-default and the envelope must carry it.
|
|
1733
|
+
(s.direction === void 0 || s.direction === "auto");
|
|
1638
1734
|
var node = (n) => {
|
|
1639
1735
|
const fields = [
|
|
1640
1736
|
["id", str(n.id)],
|
|
@@ -1643,6 +1739,7 @@ var node = (n) => {
|
|
|
1643
1739
|
if (!isEmptyState(n.state)) fields.push(["state", stateBehaviour(n.state)]);
|
|
1644
1740
|
if (!isDefaultStyle(n.style)) fields.push(["style", semanticStyle(n.style)]);
|
|
1645
1741
|
if (n.accessibility !== void 0) fields.push(["accessibility", accessibility(n.accessibility)]);
|
|
1742
|
+
if (n.tooltip !== void 0) fields.push(["tooltip", textSource(n.tooltip)]);
|
|
1646
1743
|
return jObject(fields);
|
|
1647
1744
|
};
|
|
1648
1745
|
var treeOp = (op) => {
|
|
@@ -2739,6 +2836,65 @@ var stepParams = (t) => {
|
|
|
2739
2836
|
var pipelineParams = (pipeline) => [
|
|
2740
2837
|
...new Set(pipeline.flatMap((t) => stepParams(t)))
|
|
2741
2838
|
];
|
|
2839
|
+
var substituteListParamsExpr = (listEnv, e) => {
|
|
2840
|
+
switch (e.kind) {
|
|
2841
|
+
case "col":
|
|
2842
|
+
case "lit":
|
|
2843
|
+
case "param":
|
|
2844
|
+
return e;
|
|
2845
|
+
case "binary":
|
|
2846
|
+
return {
|
|
2847
|
+
kind: "binary",
|
|
2848
|
+
op: e.op,
|
|
2849
|
+
left: substituteListParamsExpr(listEnv, e.left),
|
|
2850
|
+
right: substituteListParamsExpr(listEnv, e.right)
|
|
2851
|
+
};
|
|
2852
|
+
case "not":
|
|
2853
|
+
return { kind: "not", expr: substituteListParamsExpr(listEnv, e.expr) };
|
|
2854
|
+
case "coalesce":
|
|
2855
|
+
return { kind: "coalesce", exprs: e.exprs.map((x) => substituteListParamsExpr(listEnv, x)) };
|
|
2856
|
+
case "case":
|
|
2857
|
+
return {
|
|
2858
|
+
kind: "case",
|
|
2859
|
+
cases: e.cases.map((br) => ({
|
|
2860
|
+
when: substituteListParamsExpr(listEnv, br.when),
|
|
2861
|
+
then: substituteListParamsExpr(listEnv, br.then)
|
|
2862
|
+
})),
|
|
2863
|
+
else: substituteListParamsExpr(listEnv, e.else)
|
|
2864
|
+
};
|
|
2865
|
+
case "cast":
|
|
2866
|
+
return { kind: "cast", type: e.type, expr: substituteListParamsExpr(listEnv, e.expr) };
|
|
2867
|
+
case "apply":
|
|
2868
|
+
return {
|
|
2869
|
+
kind: "apply",
|
|
2870
|
+
fn: e.fn,
|
|
2871
|
+
args: e.args.map((x) => substituteListParamsExpr(listEnv, x))
|
|
2872
|
+
};
|
|
2873
|
+
case "in":
|
|
2874
|
+
return {
|
|
2875
|
+
kind: "in",
|
|
2876
|
+
expr: substituteListParamsExpr(listEnv, e.expr),
|
|
2877
|
+
items: e.items.map((x) => substituteListParamsExpr(listEnv, x))
|
|
2878
|
+
};
|
|
2879
|
+
case "isNull":
|
|
2880
|
+
return { kind: "isNull", expr: substituteListParamsExpr(listEnv, e.expr) };
|
|
2881
|
+
case "inParam": {
|
|
2882
|
+
const expr = substituteListParamsExpr(listEnv, e.expr);
|
|
2883
|
+
const items = Object.prototype.hasOwnProperty.call(listEnv, e.param) ? listEnv[e.param] : void 0;
|
|
2884
|
+
return items === void 0 ? { kind: "inParam", expr, param: e.param } : { kind: "in", expr, items: items.map((c) => ({ kind: "lit", cell: c })) };
|
|
2885
|
+
}
|
|
2886
|
+
}
|
|
2887
|
+
};
|
|
2888
|
+
var substituteListParams = (listEnv, pipeline) => pipeline.map((t) => {
|
|
2889
|
+
switch (t.kind) {
|
|
2890
|
+
case "filter":
|
|
2891
|
+
return { kind: "filter", pred: substituteListParamsExpr(listEnv, t.pred) };
|
|
2892
|
+
case "derive":
|
|
2893
|
+
return { kind: "derive", name: t.name, expr: substituteListParamsExpr(listEnv, t.expr) };
|
|
2894
|
+
default:
|
|
2895
|
+
return t;
|
|
2896
|
+
}
|
|
2897
|
+
});
|
|
2742
2898
|
var peek = (s) => s.pos < s.text.length ? s.text[s.pos] : " ";
|
|
2743
2899
|
var advance = (s) => {
|
|
2744
2900
|
s.pos += 1;
|
|
@@ -3198,6 +3354,7 @@ var decodeHeadingVariant = (p, j) => {
|
|
|
3198
3354
|
};
|
|
3199
3355
|
var decodeImageVariant = (p, j) => bareEnum(p, j, ["Default", "Avatar", "Rounded"], "ImageVariant");
|
|
3200
3356
|
var decodeImageFit = (p, j) => bareEnum(p, j, ["Natural", "Cover", "Contain"], "ImageFit");
|
|
3357
|
+
var decodeModalityKind = (p, j) => bareEnum(p, j, ["Modal", "Popover"], "ModalityKind");
|
|
3201
3358
|
var decodeImageAspect = (p, j) => bareEnum(
|
|
3202
3359
|
p,
|
|
3203
3360
|
j,
|
|
@@ -3205,7 +3362,16 @@ var decodeImageAspect = (p, j) => bareEnum(
|
|
|
3205
3362
|
"ImageAspect"
|
|
3206
3363
|
);
|
|
3207
3364
|
var decodeImageLoading = (p, j) => bareEnum(p, j, ["Eager", "Lazy"], "ImageLoading");
|
|
3365
|
+
var decodeEmbedPermission = (p, j) => bareEnum(
|
|
3366
|
+
p,
|
|
3367
|
+
j,
|
|
3368
|
+
["AllowScripts", "AllowSameOrigin", "AllowForms", "AllowFullscreen"],
|
|
3369
|
+
"EmbedPermission"
|
|
3370
|
+
);
|
|
3208
3371
|
var decodeScrollOrientation = (p, j) => bareEnum(p, j, ["Vertical", "Horizontal", "Both"], "ScrollOrientation");
|
|
3372
|
+
var decodeTrackKind = (p, j) => bareEnum(p, j, ["Subtitles", "Captions", "Descriptions", "Chapters"], "TrackKind");
|
|
3373
|
+
var decodeCaptureSource = (p, j) => bareEnum(p, j, ["Camera", "Microphone"], "CaptureSource");
|
|
3374
|
+
var decodeTextDirection = (p, j) => bareEnum(p, j, ["auto", "ltr", "rtl"], "TextDirection");
|
|
3209
3375
|
var decodeDateVariant = (p, j) => bareEnum(p, j, ["Date", "Time", "DateTime"], "DateVariant");
|
|
3210
3376
|
var decodeMathDisplay = (p, j) => bareEnum(p, j, ["Inline", "Block"], "MathDisplay");
|
|
3211
3377
|
var TONE_ALIASES = {
|
|
@@ -4361,12 +4527,11 @@ var decodeBinding = (path, j, parseStatic = (_p, v) => ok(decodeAstValue(v)), pl
|
|
|
4361
4527
|
case "State": {
|
|
4362
4528
|
const key = reqField(path, f, "key", "state key string", requireString);
|
|
4363
4529
|
if (!key.ok) return key;
|
|
4364
|
-
const
|
|
4365
|
-
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
}
|
|
4530
|
+
const dvRaw = fieldAliased(f, "defaultValue", ["initialValue", "default"]);
|
|
4531
|
+
const dv = dvRaw ?? { kind: "JNull" };
|
|
4532
|
+
let defaultValue = dvRaw === void 0 ? void 0 : placeholder;
|
|
4533
|
+
const parsed = parseStatic(`${path}.defaultValue`, dv);
|
|
4534
|
+
if (parsed.ok) defaultValue = parsed.value;
|
|
4370
4535
|
return ok({ kind: "State", key: key.value, defaultValue });
|
|
4371
4536
|
}
|
|
4372
4537
|
case "Computed":
|
|
@@ -4820,7 +4985,7 @@ var decodeAction = (path, j) => {
|
|
|
4820
4985
|
const s = j.value.length > 24 ? j.value.slice(0, 24) + "\u2026" : j.value;
|
|
4821
4986
|
return wrongType(
|
|
4822
4987
|
path,
|
|
4823
|
-
`JSON object, got the string '${s}' \u2014 an action is a $type-discriminated object (SetState | Navigate | Call | Notify | Chain | AiTool | WriteToClipboard | Invoke); "<closure>" is not authorable. Pick a real action, e.g. {"$type":"SetState","key":\u2026,"value":\u2026}`
|
|
4988
|
+
`JSON object, got the string '${s}' \u2014 an action is a $type-discriminated object (SetState | Navigate | Call | Notify | Chain | AiTool | WriteToClipboard | Print | Invoke); "<closure>" is not authorable. Pick a real action, e.g. {"$type":"SetState","key":\u2026,"value":\u2026}`
|
|
4824
4989
|
);
|
|
4825
4990
|
}
|
|
4826
4991
|
const fo = requireObject(path, j);
|
|
@@ -4940,9 +5105,19 @@ var decodeAction = (path, j) => {
|
|
|
4940
5105
|
return r.ok ? ok({ kind: "CommitLocal", nodeId: r.value }) : r;
|
|
4941
5106
|
}
|
|
4942
5107
|
case "WriteToClipboard": {
|
|
4943
|
-
const r = reqField(path, f, "text", "clipboard payload
|
|
5108
|
+
const r = reqField(path, f, "text", "clipboard payload TextSource", decodeTextSource);
|
|
4944
5109
|
return r.ok ? ok({ kind: "WriteToClipboard", text: r.value }) : r;
|
|
4945
5110
|
}
|
|
5111
|
+
case "Print": {
|
|
5112
|
+
for (const key of f.keys()) {
|
|
5113
|
+
if (key !== "$type")
|
|
5114
|
+
return wrongType(
|
|
5115
|
+
`${path}.${key}`,
|
|
5116
|
+
"no member beside $type \u2014 Print takes no payload (WIRE_FORMAT.md \xA73.6.14)"
|
|
5117
|
+
);
|
|
5118
|
+
}
|
|
5119
|
+
return ok({ kind: "Print" });
|
|
5120
|
+
}
|
|
4946
5121
|
case "ReadFileBody": {
|
|
4947
5122
|
const fileId = reqField(path, f, "fileRef", "FileRef id string", requireString);
|
|
4948
5123
|
if (!fileId.ok) return fileId;
|
|
@@ -4967,7 +5142,7 @@ var decodeAction = (path, j) => {
|
|
|
4967
5142
|
return unknownDuCase(
|
|
4968
5143
|
path,
|
|
4969
5144
|
d.value,
|
|
4970
|
-
"Dispatch | Call | Notify | Navigate | SetState | AiTool | Chain | CommitLocal | WriteToClipboard | ReadFileBody | Invoke"
|
|
5145
|
+
"Dispatch | Call | Notify | Navigate | SetState | AiTool | Chain | CommitLocal | WriteToClipboard | Print | ReadFileBody | Invoke"
|
|
4971
5146
|
);
|
|
4972
5147
|
}
|
|
4973
5148
|
};
|
|
@@ -5248,12 +5423,139 @@ var decodeMediaSpec = (path, j) => {
|
|
|
5248
5423
|
const loopJ = tryField(f, "loop");
|
|
5249
5424
|
const loop = loopJ === void 0 ? ok(false) : requireBool(`${path}.loop`, loopJ);
|
|
5250
5425
|
if (!loop.ok) return loop;
|
|
5426
|
+
const tracksJ = tryField(f, "tracks");
|
|
5427
|
+
const tracks = tracksJ === void 0 ? ok([]) : (() => {
|
|
5428
|
+
const arr = requireArray(`${path}.tracks`, tracksJ);
|
|
5429
|
+
if (!arr.ok) return arr;
|
|
5430
|
+
return traverseIndexed(
|
|
5431
|
+
arr.value,
|
|
5432
|
+
(i, el) => decodeTrackEntry(`${path}.tracks[${i}]`, el)
|
|
5433
|
+
);
|
|
5434
|
+
})();
|
|
5435
|
+
if (!tracks.ok) return tracks;
|
|
5436
|
+
const transcript = optField(path, f, "transcript", decodeTextSource);
|
|
5437
|
+
if (!transcript.ok) return transcript;
|
|
5251
5438
|
return ok({
|
|
5252
5439
|
src: src.value,
|
|
5253
5440
|
label: label.value,
|
|
5254
5441
|
controls: controls.value,
|
|
5255
5442
|
loop: loop.value,
|
|
5256
|
-
kind: kind.value
|
|
5443
|
+
kind: kind.value,
|
|
5444
|
+
tracks: tracks.value,
|
|
5445
|
+
...transcript.value !== void 0 ? { transcript: transcript.value } : {}
|
|
5446
|
+
});
|
|
5447
|
+
};
|
|
5448
|
+
var decodeTrackEntry = (path, j) => {
|
|
5449
|
+
const fo = requireObject(path, j);
|
|
5450
|
+
if (!fo.ok) return fo;
|
|
5451
|
+
const f = fo.value;
|
|
5452
|
+
const kind = reqField(path, f, "kind", "TrackKind", decodeTrackKind);
|
|
5453
|
+
if (!kind.ok) return kind;
|
|
5454
|
+
const src = reqField(path, f, "src", "track Binding<string> Src", decodeBindingString);
|
|
5455
|
+
if (!src.ok) return src;
|
|
5456
|
+
const srcLang = reqField(path, f, "srcLang", "track srcLang string", requireString);
|
|
5457
|
+
if (!srcLang.ok) return srcLang;
|
|
5458
|
+
const label = reqField(path, f, "label", "track label TextSource", decodeTextSource);
|
|
5459
|
+
if (!label.ok) return label;
|
|
5460
|
+
const defaultJ = tryField(f, "default");
|
|
5461
|
+
const dflt = defaultJ === void 0 ? ok(false) : requireBool(`${path}.default`, defaultJ);
|
|
5462
|
+
if (!dflt.ok) return dflt;
|
|
5463
|
+
return ok({
|
|
5464
|
+
kind: kind.value,
|
|
5465
|
+
src: src.value,
|
|
5466
|
+
srcLang: srcLang.value,
|
|
5467
|
+
label: label.value,
|
|
5468
|
+
default: dflt.value
|
|
5469
|
+
});
|
|
5470
|
+
};
|
|
5471
|
+
var decodeTreeSpec = (path, j) => {
|
|
5472
|
+
const fo = requireObject(path, j);
|
|
5473
|
+
if (!fo.ok) return fo;
|
|
5474
|
+
const f = fo.value;
|
|
5475
|
+
const itemsJ = requireField(path, f, "items", "Tree items list");
|
|
5476
|
+
if (!itemsJ.ok) return itemsJ;
|
|
5477
|
+
const arr = requireArray(`${path}.items`, itemsJ.value);
|
|
5478
|
+
if (!arr.ok) return arr;
|
|
5479
|
+
const items = traverseIndexed(arr.value, (i, el) => decodeTreeItem(`${path}.items[${i}]`, el));
|
|
5480
|
+
if (!items.ok) return items;
|
|
5481
|
+
const expandedStateKey = optField(path, f, "expandedStateKey", requireString);
|
|
5482
|
+
if (!expandedStateKey.ok) return expandedStateKey;
|
|
5483
|
+
const selectionStateKey = optField(path, f, "selectionStateKey", requireString);
|
|
5484
|
+
if (!selectionStateKey.ok) return selectionStateKey;
|
|
5485
|
+
return ok({
|
|
5486
|
+
items: items.value,
|
|
5487
|
+
...expandedStateKey.value !== void 0 ? { expandedStateKey: expandedStateKey.value } : {},
|
|
5488
|
+
...selectionStateKey.value !== void 0 ? { selectionStateKey: selectionStateKey.value } : {},
|
|
5489
|
+
// Emitted only when present (rule 4); the value is the closure sentinel.
|
|
5490
|
+
...tryField(f, "onSelect") !== void 0 ? { onSelect: () => placeholderAction } : {}
|
|
5491
|
+
});
|
|
5492
|
+
};
|
|
5493
|
+
var decodeTreeItem = (path, j) => {
|
|
5494
|
+
if (itemDepth >= schema.MAX_NODE_DEPTH) {
|
|
5495
|
+
return limitError(
|
|
5496
|
+
path,
|
|
5497
|
+
`tree-item nesting deeper than the wire limit MAX_NODE_DEPTH = ${schema.MAX_NODE_DEPTH}`,
|
|
5498
|
+
`a tree nesting items no more than ${schema.MAX_NODE_DEPTH} levels deep`
|
|
5499
|
+
);
|
|
5500
|
+
}
|
|
5501
|
+
itemDepth += 1;
|
|
5502
|
+
const r = decodeTreeItemInner(path, j);
|
|
5503
|
+
itemDepth -= 1;
|
|
5504
|
+
return r;
|
|
5505
|
+
};
|
|
5506
|
+
var decodeTreeItemInner = (path, j) => {
|
|
5507
|
+
const fo = requireObject(path, j);
|
|
5508
|
+
if (!fo.ok) return fo;
|
|
5509
|
+
const f = fo.value;
|
|
5510
|
+
const id = reqField(path, f, "id", "TreeItem id string", requireString);
|
|
5511
|
+
if (!id.ok) return id;
|
|
5512
|
+
const label = reqField(path, f, "label", "TreeItem label TextSource", decodeTextSource);
|
|
5513
|
+
if (!label.ok) return label;
|
|
5514
|
+
const childrenJ = tryField(f, "children");
|
|
5515
|
+
const children = childrenJ === void 0 ? ok([]) : (() => {
|
|
5516
|
+
const carr = requireArray(`${path}.children`, childrenJ);
|
|
5517
|
+
if (!carr.ok) return carr;
|
|
5518
|
+
return traverseIndexed(
|
|
5519
|
+
carr.value,
|
|
5520
|
+
(i, el) => decodeTreeItem(`${path}.children[${i}]`, el)
|
|
5521
|
+
);
|
|
5522
|
+
})();
|
|
5523
|
+
if (!children.ok) return children;
|
|
5524
|
+
const icon = optField(path, f, "icon", requireString);
|
|
5525
|
+
if (!icon.ok) return icon;
|
|
5526
|
+
return ok({
|
|
5527
|
+
id: id.value,
|
|
5528
|
+
label: label.value,
|
|
5529
|
+
children: children.value,
|
|
5530
|
+
...icon.value !== void 0 ? { icon: icon.value } : {}
|
|
5531
|
+
});
|
|
5532
|
+
};
|
|
5533
|
+
var decodeEmbedSpec = (path, j) => {
|
|
5534
|
+
const fo = requireObject(path, j);
|
|
5535
|
+
if (!fo.ok) return fo;
|
|
5536
|
+
const f = fo.value;
|
|
5537
|
+
const src = reqField(path, f, "src", "Embed Binding<string> Src", decodeBindingString);
|
|
5538
|
+
if (!src.ok) return src;
|
|
5539
|
+
const title = reqField(path, f, "title", "Embed accessible title TextSource", decodeTextSource);
|
|
5540
|
+
if (!title.ok) return title;
|
|
5541
|
+
const aspectJ = tryField(f, "aspectRatio");
|
|
5542
|
+
const aspectRatio = aspectJ === void 0 ? ok("Natural") : decodeImageAspect(`${path}.aspectRatio`, aspectJ);
|
|
5543
|
+
if (!aspectRatio.ok) return aspectRatio;
|
|
5544
|
+
const permissionsJ = tryField(f, "permissions");
|
|
5545
|
+
const permissions = permissionsJ === void 0 ? ok([]) : (() => {
|
|
5546
|
+
const arr = requireArray(`${path}.permissions`, permissionsJ);
|
|
5547
|
+
if (!arr.ok) return arr;
|
|
5548
|
+
return traverseIndexed(
|
|
5549
|
+
arr.value,
|
|
5550
|
+
(i, el) => decodeEmbedPermission(`${path}.permissions[${i}]`, el)
|
|
5551
|
+
);
|
|
5552
|
+
})();
|
|
5553
|
+
if (!permissions.ok) return permissions;
|
|
5554
|
+
return ok({
|
|
5555
|
+
src: src.value,
|
|
5556
|
+
title: title.value,
|
|
5557
|
+
aspectRatio: aspectRatio.value,
|
|
5558
|
+
permissions: permissions.value
|
|
5257
5559
|
});
|
|
5258
5560
|
};
|
|
5259
5561
|
var decodeListSpec = (path, j) => {
|
|
@@ -5729,10 +6031,18 @@ var decodeDisplayKind = (path, j) => {
|
|
|
5729
6031
|
const r = decodeImageSpec(path, j);
|
|
5730
6032
|
return r.ok ? ok({ kind: "Image", spec: r.value }) : r;
|
|
5731
6033
|
}
|
|
6034
|
+
case "Embed": {
|
|
6035
|
+
const r = decodeEmbedSpec(path, j);
|
|
6036
|
+
return r.ok ? ok({ kind: "Embed", spec: r.value }) : r;
|
|
6037
|
+
}
|
|
5732
6038
|
case "Media": {
|
|
5733
6039
|
const r = decodeMediaSpec(path, j);
|
|
5734
6040
|
return r.ok ? ok({ kind: "Media", spec: r.value }) : r;
|
|
5735
6041
|
}
|
|
6042
|
+
case "Tree": {
|
|
6043
|
+
const r = decodeTreeSpec(path, j);
|
|
6044
|
+
return r.ok ? ok({ kind: "Tree", spec: r.value }) : r;
|
|
6045
|
+
}
|
|
5736
6046
|
case "List": {
|
|
5737
6047
|
const r = decodeListSpec(path, j);
|
|
5738
6048
|
return r.ok ? ok({ kind: "List", spec: r.value }) : r;
|
|
@@ -5757,7 +6067,7 @@ var decodeDisplayKind = (path, j) => {
|
|
|
5757
6067
|
return unknownDuCase(
|
|
5758
6068
|
path,
|
|
5759
6069
|
d.value,
|
|
5760
|
-
"Heading | Markdown | Metric | Badge | Link | Image | List | Toast | CodeBlock | Math | Drawing | Sparkline | Callout | Progress | Skeleton | LabelValueRow"
|
|
6070
|
+
"Heading | Markdown | Metric | Badge | Link | Image | Media | Embed | Tree | List | Toast | CodeBlock | Math | Drawing | Sparkline | Callout | Progress | Skeleton | LabelValueRow | Fact"
|
|
5761
6071
|
);
|
|
5762
6072
|
}
|
|
5763
6073
|
};
|
|
@@ -5888,6 +6198,95 @@ var decodeFormFieldKind = (autoBind, path, j) => {
|
|
|
5888
6198
|
orientation: orientation.value
|
|
5889
6199
|
});
|
|
5890
6200
|
}
|
|
6201
|
+
case "Combobox": {
|
|
6202
|
+
const options = reqField(
|
|
6203
|
+
path,
|
|
6204
|
+
f,
|
|
6205
|
+
"options",
|
|
6206
|
+
"Combobox options binding",
|
|
6207
|
+
decodeBindingSelectOptions
|
|
6208
|
+
);
|
|
6209
|
+
if (!options.ok) return options;
|
|
6210
|
+
const allowFreeTextJ = tryField(f, "allowFreeText");
|
|
6211
|
+
const allowFreeText = allowFreeTextJ === void 0 ? ok(false) : requireBool(`${path}.allowFreeText`, allowFreeTextJ);
|
|
6212
|
+
if (!allowFreeText.ok) return allowFreeText;
|
|
6213
|
+
const value = valueOr(
|
|
6214
|
+
decodeBindingStringOpt,
|
|
6215
|
+
schema.controlValueDefaults.choice,
|
|
6216
|
+
"Combobox value binding"
|
|
6217
|
+
);
|
|
6218
|
+
if (!value.ok) return value;
|
|
6219
|
+
return ok({
|
|
6220
|
+
kind: "Combobox",
|
|
6221
|
+
allowFreeText: allowFreeText.value,
|
|
6222
|
+
options: options.value,
|
|
6223
|
+
value: value.value,
|
|
6224
|
+
...onChangeField
|
|
6225
|
+
});
|
|
6226
|
+
}
|
|
6227
|
+
case "Tokens": {
|
|
6228
|
+
const allowFreeTextJ = tryField(f, "allowFreeText");
|
|
6229
|
+
const allowFreeText = allowFreeTextJ === void 0 ? ok(true) : requireBool(`${path}.allowFreeText`, allowFreeTextJ);
|
|
6230
|
+
if (!allowFreeText.ok) return allowFreeText;
|
|
6231
|
+
const suggestions = optField(path, f, "suggestions", decodeBindingSelectOptions);
|
|
6232
|
+
if (!suggestions.ok) return suggestions;
|
|
6233
|
+
if (!allowFreeText.value && suggestions.value === void 0)
|
|
6234
|
+
return wrongType(
|
|
6235
|
+
`${path}.allowFreeText`,
|
|
6236
|
+
"a suggestion source alongside allowFreeText:false \u2014 a closed token field with nothing to pick from admits no token at all (WIRE_FORMAT.md \xA73.6.19)"
|
|
6237
|
+
);
|
|
6238
|
+
const value = valueOr(
|
|
6239
|
+
decodeBindingStringList,
|
|
6240
|
+
schema.controlValueDefaults.tokens,
|
|
6241
|
+
"Tokens Binding<string list> value"
|
|
6242
|
+
);
|
|
6243
|
+
if (!value.ok) return value;
|
|
6244
|
+
return ok({
|
|
6245
|
+
kind: "Tokens",
|
|
6246
|
+
allowFreeText: allowFreeText.value,
|
|
6247
|
+
value: value.value,
|
|
6248
|
+
...suggestions.value !== void 0 ? { suggestions: suggestions.value } : {},
|
|
6249
|
+
...onChangeField
|
|
6250
|
+
});
|
|
6251
|
+
}
|
|
6252
|
+
case "Rating": {
|
|
6253
|
+
const maxJ = requireField(path, f, "max", "Rating max integer of 1 or more");
|
|
6254
|
+
if (!maxJ.ok) return maxJ;
|
|
6255
|
+
if (maxJ.value.kind !== "JNumber" || maxJ.value.value < 1 || !Number.isInteger(maxJ.value.value))
|
|
6256
|
+
return wrongType(`${path}.max`, "JSON number (an integer scale of 1 or more)");
|
|
6257
|
+
const max = maxJ.value.value;
|
|
6258
|
+
const allowHalfJ = tryField(f, "allowHalf");
|
|
6259
|
+
const allowHalf = allowHalfJ === void 0 ? ok(false) : requireBool(`${path}.allowHalf`, allowHalfJ);
|
|
6260
|
+
if (!allowHalf.ok) return allowHalf;
|
|
6261
|
+
const value = valueOr(
|
|
6262
|
+
decodeBindingFloat,
|
|
6263
|
+
schema.controlValueDefaults.number,
|
|
6264
|
+
"Rating value binding"
|
|
6265
|
+
);
|
|
6266
|
+
if (!value.ok) return value;
|
|
6267
|
+
return ok({
|
|
6268
|
+
kind: "Rating",
|
|
6269
|
+
max,
|
|
6270
|
+
allowHalf: allowHalf.value,
|
|
6271
|
+
value: value.value,
|
|
6272
|
+
...onChangeField
|
|
6273
|
+
});
|
|
6274
|
+
}
|
|
6275
|
+
case "Color": {
|
|
6276
|
+
const value = valueOr(
|
|
6277
|
+
decodeBinding,
|
|
6278
|
+
schema.controlValueDefaults.color,
|
|
6279
|
+
"Color value binding"
|
|
6280
|
+
);
|
|
6281
|
+
if (!value.ok) return value;
|
|
6282
|
+
const bound = value.value;
|
|
6283
|
+
if (bound.kind === "Static" && !(typeof bound.value === "string" && /^#[0-9a-fA-F]{6}$/.test(bound.value)))
|
|
6284
|
+
return wrongType(
|
|
6285
|
+
`${path}.value`,
|
|
6286
|
+
"a #rrggbb colour literal \u2014 six hexadecimal digits after a #, the one form a native colour input can hold (WIRE_FORMAT.md \xA73.6.17)"
|
|
6287
|
+
);
|
|
6288
|
+
return ok({ kind: "Color", value: value.value, ...onChangeField });
|
|
6289
|
+
}
|
|
5891
6290
|
case "TextArea": {
|
|
5892
6291
|
const rows = reqField(path, f, "rows", "textarea row count integer", requireInt);
|
|
5893
6292
|
if (!rows.ok) return rows;
|
|
@@ -6184,12 +6583,31 @@ var decodeFileUploadSpec = (path, j) => {
|
|
|
6184
6583
|
if (!multiple.ok) return multiple;
|
|
6185
6584
|
const disabled = optField(path, f, "disabled", decodeBindingBool);
|
|
6186
6585
|
if (!disabled.ok) return disabled;
|
|
6586
|
+
const dropTargetJ = tryField(f, "dropTarget");
|
|
6587
|
+
const dropTarget = dropTargetJ === void 0 ? ok(false) : requireBool(`${path}.dropTarget`, dropTargetJ);
|
|
6588
|
+
if (!dropTarget.ok) return dropTarget;
|
|
6589
|
+
const acceptPasteJ = tryField(f, "acceptPaste");
|
|
6590
|
+
const acceptPaste = acceptPasteJ === void 0 ? ok(false) : requireBool(`${path}.acceptPaste`, acceptPasteJ);
|
|
6591
|
+
if (!acceptPaste.ok) return acceptPaste;
|
|
6592
|
+
const capture = optField(path, f, "capture", decodeCaptureSource);
|
|
6593
|
+
if (!capture.ok) return capture;
|
|
6594
|
+
const destinationJ = tryField(f, "destination");
|
|
6595
|
+
const destination = destinationJ === void 0 ? ok(void 0) : (() => {
|
|
6596
|
+
const str3 = requireString(`${path}.destination`, destinationJ);
|
|
6597
|
+
if (!str3.ok) return str3;
|
|
6598
|
+
return str3.value === "" ? wrongType(`${path}.destination`, "a non-empty host-registered destination id") : ok(str3.value);
|
|
6599
|
+
})();
|
|
6600
|
+
if (!destination.ok) return destination;
|
|
6187
6601
|
return ok({
|
|
6188
6602
|
accept: accept.value,
|
|
6189
6603
|
label: label.value,
|
|
6190
6604
|
multiple: multiple.value,
|
|
6191
6605
|
onSelect: () => placeholderAction,
|
|
6192
|
-
...disabled.value !== void 0 ? { disabled: disabled.value } : {}
|
|
6606
|
+
...disabled.value !== void 0 ? { disabled: disabled.value } : {},
|
|
6607
|
+
dropTarget: dropTarget.value,
|
|
6608
|
+
acceptPaste: acceptPaste.value,
|
|
6609
|
+
...capture.value !== void 0 ? { capture: capture.value } : {},
|
|
6610
|
+
...destination.value !== void 0 ? { destination: destination.value } : {}
|
|
6193
6611
|
});
|
|
6194
6612
|
};
|
|
6195
6613
|
var decodeInputKind = (path, j) => {
|
|
@@ -6607,6 +7025,16 @@ var decodeGridSpec = (path, j) => {
|
|
|
6607
7025
|
if (!pk.ok) return pk;
|
|
6608
7026
|
pageStateKey = pk.value;
|
|
6609
7027
|
}
|
|
7028
|
+
const transferOutKey = optField(path, f, "transferOutKey", requireString);
|
|
7029
|
+
if (!transferOutKey.ok) return transferOutKey;
|
|
7030
|
+
const transferInKey = optField(path, f, "transferInKey", requireString);
|
|
7031
|
+
if (!transferInKey.ok) return transferInKey;
|
|
7032
|
+
const exportable = optField(path, f, "exportable", requireBool);
|
|
7033
|
+
if (!exportable.ok) return exportable;
|
|
7034
|
+
const keepRowsTogether = optField(path, f, "keepRowsTogether", requireBool);
|
|
7035
|
+
if (!keepRowsTogether.ok) return keepRowsTogether;
|
|
7036
|
+
const repeatHeader = optField(path, f, "repeatHeader", requireBool);
|
|
7037
|
+
if (!repeatHeader.ok) return repeatHeader;
|
|
6610
7038
|
const staticRowsJ = tryField(f, "staticRows");
|
|
6611
7039
|
let staticRows;
|
|
6612
7040
|
if (staticRowsJ !== void 0) {
|
|
@@ -6627,6 +7055,11 @@ var decodeGridSpec = (path, j) => {
|
|
|
6627
7055
|
...pageStateKey !== void 0 ? { pageStateKey } : {},
|
|
6628
7056
|
...defaultSort !== void 0 ? { defaultSort } : {},
|
|
6629
7057
|
...editStateKey !== void 0 ? { editStateKey } : {},
|
|
7058
|
+
...transferOutKey.value !== void 0 ? { transferOutKey: transferOutKey.value } : {},
|
|
7059
|
+
...transferInKey.value !== void 0 ? { transferInKey: transferInKey.value } : {},
|
|
7060
|
+
exportable: exportable.value ?? false,
|
|
7061
|
+
keepRowsTogether: keepRowsTogether.value ?? false,
|
|
7062
|
+
repeatHeader: repeatHeader.value ?? false,
|
|
6630
7063
|
...staticRows !== void 0 ? { staticRows } : {}
|
|
6631
7064
|
});
|
|
6632
7065
|
};
|
|
@@ -6839,11 +7272,17 @@ var decodeBox = (path, j) => {
|
|
|
6839
7272
|
if (!layout.ok) return layout;
|
|
6840
7273
|
const role = reqField(path, f, "role", "role string", decodeBoxRole);
|
|
6841
7274
|
if (!role.ok) return role;
|
|
7275
|
+
const keepTogether = optField(path, f, "keepTogether", requireBool);
|
|
7276
|
+
if (!keepTogether.ok) return keepTogether;
|
|
7277
|
+
const breakBefore = optField(path, f, "breakBefore", requireBool);
|
|
7278
|
+
if (!breakBefore.ok) return breakBefore;
|
|
6842
7279
|
return ok({
|
|
6843
7280
|
children: children.value,
|
|
6844
7281
|
...heading.value !== void 0 ? { heading: heading.value } : {},
|
|
6845
7282
|
layout: layout.value,
|
|
6846
|
-
role: role.value
|
|
7283
|
+
role: role.value,
|
|
7284
|
+
keepTogether: keepTogether.value ?? false,
|
|
7285
|
+
breakBefore: breakBefore.value ?? false
|
|
6847
7286
|
});
|
|
6848
7287
|
};
|
|
6849
7288
|
var decodeSplitPanelSpec = (path, j) => {
|
|
@@ -6990,12 +7429,19 @@ var decodeModalSpec = (path, j) => {
|
|
|
6990
7429
|
if (!open.ok) return open;
|
|
6991
7430
|
const heading = optFieldAliased(path, f, "heading", ["title"], decodeTextSource);
|
|
6992
7431
|
if (!heading.ok) return heading;
|
|
7432
|
+
const modalityJ = tryField(f, "modality");
|
|
7433
|
+
const modality = modalityJ === void 0 ? ok("Modal") : decodeModalityKind(`${path}.modality`, modalityJ);
|
|
7434
|
+
if (!modality.ok) return modality;
|
|
7435
|
+
const anchor = optField(path, f, "anchor", requireString);
|
|
7436
|
+
if (!anchor.ok) return anchor;
|
|
6993
7437
|
return ok({
|
|
6994
7438
|
children: children.value,
|
|
6995
7439
|
dismissable: dismissable.value,
|
|
6996
7440
|
...onDismiss.value !== void 0 ? { onDismiss: onDismiss.value } : {},
|
|
6997
7441
|
open: open.value,
|
|
6998
|
-
...heading.value !== void 0 ? { heading: heading.value } : {}
|
|
7442
|
+
...heading.value !== void 0 ? { heading: heading.value } : {},
|
|
7443
|
+
modality: modality.value,
|
|
7444
|
+
...anchor.value !== void 0 ? { anchor: anchor.value } : {}
|
|
6999
7445
|
});
|
|
7000
7446
|
};
|
|
7001
7447
|
var decodeScrollAreaSpec = (path, j) => {
|
|
@@ -7282,6 +7728,8 @@ var decodeNodeKind = (path, j) => {
|
|
|
7282
7728
|
case "Link":
|
|
7283
7729
|
case "Image":
|
|
7284
7730
|
case "Media":
|
|
7731
|
+
case "Embed":
|
|
7732
|
+
case "Tree":
|
|
7285
7733
|
case "List":
|
|
7286
7734
|
case "Toast":
|
|
7287
7735
|
case "CodeBlock":
|
|
@@ -7381,9 +7829,24 @@ var decodeNodeKind = (path, j) => {
|
|
|
7381
7829
|
if (!cases.ok) return cases;
|
|
7382
7830
|
const def = reqField(path, f, "default", "Switch default Node", decodeNodeAst);
|
|
7383
7831
|
if (!def.ok) return def;
|
|
7832
|
+
const autoAdvanceMsJ = tryField(f, "autoAdvanceMs");
|
|
7833
|
+
let autoAdvanceMs;
|
|
7834
|
+
if (autoAdvanceMsJ !== void 0) {
|
|
7835
|
+
if (autoAdvanceMsJ.kind !== "JNumber" || autoAdvanceMsJ.value < 1 || !Number.isInteger(autoAdvanceMsJ.value))
|
|
7836
|
+
return wrongType(
|
|
7837
|
+
`${path}.autoAdvanceMs`,
|
|
7838
|
+
"JSON number (a positive whole number of milliseconds)"
|
|
7839
|
+
);
|
|
7840
|
+
autoAdvanceMs = autoAdvanceMsJ.value;
|
|
7841
|
+
}
|
|
7384
7842
|
return ok({
|
|
7385
7843
|
kind: "Switch",
|
|
7386
|
-
spec: {
|
|
7844
|
+
spec: {
|
|
7845
|
+
on: on.value,
|
|
7846
|
+
cases: cases.value,
|
|
7847
|
+
default: def.value,
|
|
7848
|
+
...autoAdvanceMs !== void 0 ? { autoAdvanceMs } : {}
|
|
7849
|
+
}
|
|
7387
7850
|
});
|
|
7388
7851
|
}
|
|
7389
7852
|
case "FragmentDecl": {
|
|
@@ -7549,12 +8012,15 @@ var decodeSemanticStyle = (path, j) => {
|
|
|
7549
8012
|
if (!role.ok) return role;
|
|
7550
8013
|
const voice = optField(path, f, "voice", decodeFontVoice);
|
|
7551
8014
|
if (!voice.ok) return voice;
|
|
8015
|
+
const direction = optField(path, f, "direction", decodeTextDirection);
|
|
8016
|
+
if (!direction.ok) return direction;
|
|
7552
8017
|
return ok({
|
|
7553
8018
|
tone: tone.value ?? "Default",
|
|
7554
8019
|
weight: weight.value ?? "Standard",
|
|
7555
8020
|
emphasis: emphasis.value ?? "Normal",
|
|
7556
8021
|
role: role.value ?? "None",
|
|
7557
|
-
voice: voice.value ?? "Default"
|
|
8022
|
+
voice: voice.value ?? "Default",
|
|
8023
|
+
direction: direction.value ?? "auto"
|
|
7558
8024
|
});
|
|
7559
8025
|
};
|
|
7560
8026
|
var A11Y_NEAR_MISSES = [
|
|
@@ -7652,11 +8118,13 @@ var placeholderClosureNode = {
|
|
|
7652
8118
|
var walkDepth = 0;
|
|
7653
8119
|
var walkNodes = 0;
|
|
7654
8120
|
var opDepth = 0;
|
|
8121
|
+
var itemDepth = 0;
|
|
7655
8122
|
var walkPolicy = schema.admitAll;
|
|
7656
8123
|
var resetWalk = (policy = schema.admitAll) => {
|
|
7657
8124
|
walkDepth = 0;
|
|
7658
8125
|
walkNodes = 0;
|
|
7659
8126
|
opDepth = 0;
|
|
8127
|
+
itemDepth = 0;
|
|
7660
8128
|
walkPolicy = policy;
|
|
7661
8129
|
};
|
|
7662
8130
|
var limitError = (path, message, expected) => makeError("LIMIT_EXCEEDED", path, message, expected);
|
|
@@ -7700,12 +8168,15 @@ var decodeNodeAstInner = (path, j) => {
|
|
|
7700
8168
|
if (!style.ok) return style;
|
|
7701
8169
|
const accessibility2 = optField(path, f, "accessibility", decodeAccessibility);
|
|
7702
8170
|
if (!accessibility2.ok) return accessibility2;
|
|
8171
|
+
const tooltip = optField(path, f, "tooltip", decodeTextSource);
|
|
8172
|
+
if (!tooltip.ok) return tooltip;
|
|
7703
8173
|
return ok({
|
|
7704
8174
|
id: idStr.value,
|
|
7705
8175
|
kind: kind.value,
|
|
7706
8176
|
state: state.value,
|
|
7707
8177
|
style: style.value,
|
|
7708
|
-
...accessibility2.value !== void 0 ? { accessibility: accessibility2.value } : {}
|
|
8178
|
+
...accessibility2.value !== void 0 ? { accessibility: accessibility2.value } : {},
|
|
8179
|
+
...tooltip.value !== void 0 ? { tooltip: tooltip.value } : {}
|
|
7709
8180
|
});
|
|
7710
8181
|
};
|
|
7711
8182
|
var decodeTreeOpAst = (path, j) => {
|
|
@@ -9160,10 +9631,12 @@ var str2 = (s) => {
|
|
|
9160
9631
|
}
|
|
9161
9632
|
return out + '"';
|
|
9162
9633
|
};
|
|
9634
|
+
var encodeActorValue = (a) => a.kind === "human" ? `{"kind":"human","id":${str2(a.id)}}` : `{"kind":"agent","model":${str2(a.model)},"version":${str2(a.version)},"id":${str2(a.id)}}`;
|
|
9163
9635
|
var encodeEnvelope = (e) => e.$type === "Success" ? '{"$type":"Success"}' : `{"$type":"Failure","code":${str2(e.code)},"message":${str2(e.message)}}`;
|
|
9164
9636
|
var encodeDagRecord = (record) => {
|
|
9165
9637
|
let out = "{";
|
|
9166
|
-
out += `"
|
|
9638
|
+
out += `"actor":${encodeActorValue(record.actor)}`;
|
|
9639
|
+
out += `,"hash":${str2(record.hash)}`;
|
|
9167
9640
|
out += `,"op":${encodeOp(record.op)}`;
|
|
9168
9641
|
if (record.outcomeHash !== void 0) out += `,"outcomeHash":${str2(record.outcomeHash)}`;
|
|
9169
9642
|
out += `,"parents":[${record.parents.map(str2).join(",")}]`;
|
|
@@ -9172,7 +9645,6 @@ var encodeDagRecord = (record) => {
|
|
|
9172
9645
|
out += `,"streamId":${str2(record.streamId)}`;
|
|
9173
9646
|
out += `,"timestamp":${record.timestamp}`;
|
|
9174
9647
|
out += `,"tombstoned":${record.tombstoned ? "true" : "false"}`;
|
|
9175
|
-
out += `,"userId":${str2(record.userId)}`;
|
|
9176
9648
|
return out + "}";
|
|
9177
9649
|
};
|
|
9178
9650
|
var astToJson = (ast) => {
|
|
@@ -9195,6 +9667,20 @@ var astToJson = (ast) => {
|
|
|
9195
9667
|
}
|
|
9196
9668
|
};
|
|
9197
9669
|
var asString = (ast) => ast !== void 0 && ast.kind === "JString" ? ast.value : void 0;
|
|
9670
|
+
var decodeActor = (ast) => {
|
|
9671
|
+
if (ast === void 0 || ast.kind !== "JObject") return void 0;
|
|
9672
|
+
const kind = asString(field(ast.fields, "kind"));
|
|
9673
|
+
const id = asString(field(ast.fields, "id"));
|
|
9674
|
+
if (id === void 0) return void 0;
|
|
9675
|
+
if (kind === "human") return { kind: "human", id };
|
|
9676
|
+
if (kind === "agent") {
|
|
9677
|
+
const model = asString(field(ast.fields, "model"));
|
|
9678
|
+
const version = asString(field(ast.fields, "version"));
|
|
9679
|
+
if (model === void 0 || version === void 0) return void 0;
|
|
9680
|
+
return { kind: "agent", model, version, id };
|
|
9681
|
+
}
|
|
9682
|
+
return void 0;
|
|
9683
|
+
};
|
|
9198
9684
|
var decodeDagRecord = (json) => {
|
|
9199
9685
|
const parsed = parse(json);
|
|
9200
9686
|
if (!parsed.ok) return { ok: false, error: `dag envelope parse: ${parsed.error.message}` };
|
|
@@ -9203,12 +9689,19 @@ var decodeDagRecord = (json) => {
|
|
|
9203
9689
|
const f = root.fields;
|
|
9204
9690
|
const hash = asString(field(f, "hash"));
|
|
9205
9691
|
const streamId = asString(field(f, "streamId"));
|
|
9206
|
-
const
|
|
9692
|
+
const actorAst = field(f, "actor");
|
|
9207
9693
|
const opAst = field(f, "op");
|
|
9208
9694
|
const parentsAst = field(f, "parents");
|
|
9209
9695
|
const tsAst = field(f, "timestamp");
|
|
9210
|
-
if (
|
|
9211
|
-
return {
|
|
9696
|
+
if (actorAst === void 0 && field(f, "userId") !== void 0)
|
|
9697
|
+
return {
|
|
9698
|
+
ok: false,
|
|
9699
|
+
error: "dag envelope: pre-1144 record \u2014 'userId' was replaced by the typed 'actor', and DAG content addresses do not carry forward"
|
|
9700
|
+
};
|
|
9701
|
+
if (hash === void 0 || streamId === void 0)
|
|
9702
|
+
return { ok: false, error: "dag envelope: missing hash/streamId" };
|
|
9703
|
+
const actor = decodeActor(actorAst);
|
|
9704
|
+
if (actor === void 0) return { ok: false, error: "dag envelope: missing/malformed 'actor'" };
|
|
9212
9705
|
if (opAst === void 0) return { ok: false, error: "dag envelope: missing op" };
|
|
9213
9706
|
if (parentsAst === void 0 || parentsAst.kind !== "JArray")
|
|
9214
9707
|
return { ok: false, error: "dag envelope: missing/!array parents" };
|
|
@@ -9244,7 +9737,7 @@ var decodeDagRecord = (json) => {
|
|
|
9244
9737
|
op: opResult.value,
|
|
9245
9738
|
...outcomeHash !== void 0 ? { outcomeHash } : {},
|
|
9246
9739
|
...promptId !== void 0 ? { promptId } : {},
|
|
9247
|
-
|
|
9740
|
+
actor,
|
|
9248
9741
|
timestamp: tsAst.value,
|
|
9249
9742
|
resultEnvelope,
|
|
9250
9743
|
tombstoned: tombAst !== void 0 && tombAst.kind === "JBool" && tombAst.value
|
|
@@ -10350,6 +10843,7 @@ exports.renderAstCanonical = renderAstCanonical;
|
|
|
10350
10843
|
exports.renderProfile = renderProfile;
|
|
10351
10844
|
exports.sequentialFreshIds = sequentialFreshIds;
|
|
10352
10845
|
exports.stepParams = stepParams;
|
|
10846
|
+
exports.substituteListParams = substituteListParams;
|
|
10353
10847
|
exports.tryParseProfile = tryParseProfile;
|
|
10354
10848
|
exports.validateAnswer = validateAnswer;
|
|
10355
10849
|
exports.validateAnswerAt = validateAnswerAt;
|