@fuaran-ui/ops 0.4.0 → 0.6.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 +71 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +71 -8
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -385,6 +385,9 @@ var binding = (b, staticEnc = objValue) => {
|
|
|
385
385
|
}
|
|
386
386
|
case "Computed":
|
|
387
387
|
return caseObj("Computed", [["fn", CLOSURE]]);
|
|
388
|
+
// No wire fields: the instant is host-furnished at resolve time.
|
|
389
|
+
case "Now":
|
|
390
|
+
return caseObj("Now", []);
|
|
388
391
|
case "I18n": {
|
|
389
392
|
const fields = [];
|
|
390
393
|
if (b.args !== void 0) {
|
|
@@ -879,6 +882,11 @@ var formFieldKind = (autoBind, k) => {
|
|
|
879
882
|
...handlerField("onToggle", k.onToggle),
|
|
880
883
|
...valueField(k.value, schema.controlValueDefaults.checkbox, (v) => binding(v))
|
|
881
884
|
]);
|
|
885
|
+
case "Toggle":
|
|
886
|
+
return caseObj("Toggle", [
|
|
887
|
+
...handlerField("onToggle", k.onToggle),
|
|
888
|
+
...valueField(k.value, schema.controlValueDefaults.checkbox, (v) => binding(v))
|
|
889
|
+
]);
|
|
882
890
|
case "Choice":
|
|
883
891
|
return caseObj("Choice", [
|
|
884
892
|
...handlerField("onChange", k.onChange),
|
|
@@ -1048,6 +1056,16 @@ var staticStringOpt = (v) => v === void 0 ? "null" : str(v);
|
|
|
1048
1056
|
var staticStringList = (v) => jArray(v.map(str));
|
|
1049
1057
|
var staticFloatSeq = (v) => jArray(v.map(num));
|
|
1050
1058
|
var staticMarkerSeq = (v) => jArray(v.map(mapMarker));
|
|
1059
|
+
var rowValue = (row) => {
|
|
1060
|
+
if (row === null || typeof row !== "object") return "{}";
|
|
1061
|
+
const fields = [];
|
|
1062
|
+
for (const [k, v] of Object.entries(row)) {
|
|
1063
|
+
if (v === null || v === void 0) continue;
|
|
1064
|
+
fields.push([k, objValue(v)]);
|
|
1065
|
+
}
|
|
1066
|
+
return jObject(fields);
|
|
1067
|
+
};
|
|
1068
|
+
var staticRowSeq = (v) => jArray(v.map(rowValue));
|
|
1051
1069
|
var cellKindErased = (k) => {
|
|
1052
1070
|
switch (k.kind) {
|
|
1053
1071
|
case "Text":
|
|
@@ -1129,7 +1147,8 @@ var gridSpec = (s) => {
|
|
|
1129
1147
|
["columns", jArray(s.columns.map(columnErased))],
|
|
1130
1148
|
// 0.2.0 omitted-when-false.
|
|
1131
1149
|
...s.editable ? [["editable", bool(true)]] : [],
|
|
1132
|
-
|
|
1150
|
+
// fuaran#665 — rows are a typed Static payload now, not the opaque residual.
|
|
1151
|
+
["source", binding(s.source, staticRowSeq)]
|
|
1133
1152
|
];
|
|
1134
1153
|
if (s.onRowClick !== void 0) fields.push(["onRowClick", CLOSURE]);
|
|
1135
1154
|
if (s.rowKey !== void 0) fields.push(["rowKey", CLOSURE]);
|
|
@@ -1147,7 +1166,8 @@ var gridSpec = (s) => {
|
|
|
1147
1166
|
var chartSpec = (s) => {
|
|
1148
1167
|
const fields = [
|
|
1149
1168
|
["kind", str(s.kind)],
|
|
1150
|
-
|
|
1169
|
+
// fuaran#665 — rows are a typed Static payload now, not the opaque residual.
|
|
1170
|
+
["source", binding(s.source, staticRowSeq)],
|
|
1151
1171
|
["stacked", bool(s.stacked)],
|
|
1152
1172
|
["xField", str(s.xField)],
|
|
1153
1173
|
["yFields", jArray(s.yFields.map(str))]
|
|
@@ -1432,7 +1452,10 @@ var nodeKind = (k) => {
|
|
|
1432
1452
|
)
|
|
1433
1453
|
],
|
|
1434
1454
|
["default", node(k.spec.default)],
|
|
1435
|
-
|
|
1455
|
+
// Phase 768 collapse rule — State(key, no default) keeps the compact
|
|
1456
|
+
// canonical `stateKey` spelling (existing fixtures stay byte-identical);
|
|
1457
|
+
// any other selector encodes as `on`.
|
|
1458
|
+
k.spec.on.kind === "State" && k.spec.on.defaultValue === void 0 ? ["stateKey", str(k.spec.on.key)] : ["on", binding(k.spec.on, str)]
|
|
1436
1459
|
]);
|
|
1437
1460
|
case "FragmentDecl": {
|
|
1438
1461
|
const fields = [
|
|
@@ -4154,6 +4177,13 @@ var decodeBinding = (path, j, parseStatic = (_p, v) => ok(decodeAstValue(v)), pl
|
|
|
4154
4177
|
}
|
|
4155
4178
|
case "Computed":
|
|
4156
4179
|
return ok({ kind: "Computed", compute: () => void 0 });
|
|
4180
|
+
// The projection decodes to the IDENTITY (the Phase 427 Selection fix
|
|
4181
|
+
// replayed): the host-furnished instant is already the wire-shaped string,
|
|
4182
|
+
// so a decoded reader receives it as-is. A value-discarding placeholder
|
|
4183
|
+
// here would make every decoded `Now` resolve to nothing even when the
|
|
4184
|
+
// host furnishes the instant.
|
|
4185
|
+
case "Now":
|
|
4186
|
+
return ok({ kind: "Now", project: (iso) => iso });
|
|
4157
4187
|
case "I18n": {
|
|
4158
4188
|
const key = reqField(path, f, "key", "i18n key string", requireString);
|
|
4159
4189
|
if (!key.ok) return key;
|
|
@@ -4423,6 +4453,17 @@ var parseStaticFloatSeq = (p, v) => {
|
|
|
4423
4453
|
return traverseIndexed(arr.value, (i, el) => requireFloat(`${p}[${i}]`, el));
|
|
4424
4454
|
};
|
|
4425
4455
|
var decodeBindingFloatSeq = (p, j) => decodeBinding(p, j, parseStaticFloatSeq, []);
|
|
4456
|
+
var parseStaticRows = (p, v) => {
|
|
4457
|
+
if (v.kind === "JNull") return ok([]);
|
|
4458
|
+
if (v.kind === "JString" && v.value === OPAQUE2) return ok([]);
|
|
4459
|
+
const arr = requireArray(p, v);
|
|
4460
|
+
if (!arr.ok) return arr;
|
|
4461
|
+
return traverseIndexed(
|
|
4462
|
+
arr.value,
|
|
4463
|
+
(i, el) => el.kind === "JObject" ? ok(decodeAstValue(el)) : wrongType(`${p}[${i}]`, "row object")
|
|
4464
|
+
);
|
|
4465
|
+
};
|
|
4466
|
+
var decodeBindingRows = (p, j) => decodeBinding(p, j, parseStaticRows, []);
|
|
4426
4467
|
var decodeMapMarker = (path, j) => {
|
|
4427
4468
|
const fo = requireObject(path, j);
|
|
4428
4469
|
if (!fo.ok) return fo;
|
|
@@ -5288,6 +5329,14 @@ var decodeFormFieldKind = (autoBind, path, j) => {
|
|
|
5288
5329
|
...onToggleField
|
|
5289
5330
|
}) : v;
|
|
5290
5331
|
}
|
|
5332
|
+
case "Toggle": {
|
|
5333
|
+
const v = valueOr(decodeBinding, schema.controlValueDefaults.checkbox, "Toggle value binding");
|
|
5334
|
+
return v.ok ? ok({
|
|
5335
|
+
kind: "Toggle",
|
|
5336
|
+
value: v.value,
|
|
5337
|
+
...onToggleField
|
|
5338
|
+
}) : v;
|
|
5339
|
+
}
|
|
5291
5340
|
case "Choice": {
|
|
5292
5341
|
const options = reqField(
|
|
5293
5342
|
path,
|
|
@@ -5852,7 +5901,7 @@ var decodeGridSpec = (path, j) => {
|
|
|
5852
5901
|
"source",
|
|
5853
5902
|
["data", "rows"],
|
|
5854
5903
|
"Grid source binding",
|
|
5855
|
-
|
|
5904
|
+
decodeBindingRows
|
|
5856
5905
|
);
|
|
5857
5906
|
if (!source.ok) return source;
|
|
5858
5907
|
const hasRowClick = tryField(f, "onRowClick") !== void 0;
|
|
@@ -5893,7 +5942,7 @@ var decodeChartSpec = (path, j) => {
|
|
|
5893
5942
|
"source",
|
|
5894
5943
|
["data"],
|
|
5895
5944
|
"Chart source binding",
|
|
5896
|
-
|
|
5945
|
+
decodeBindingRows
|
|
5897
5946
|
);
|
|
5898
5947
|
if (!source.ok) return source;
|
|
5899
5948
|
const xField = reqField(path, f, "xField", "xField string", requireString);
|
|
@@ -6557,8 +6606,22 @@ var decodeNodeKind = (path, j) => {
|
|
|
6557
6606
|
return ok({ kind: "ErrorBoundary", spec: { child: child.value, fallback: fallback.value } });
|
|
6558
6607
|
}
|
|
6559
6608
|
case "Switch": {
|
|
6560
|
-
const
|
|
6561
|
-
|
|
6609
|
+
const onJ = tryField(f, "on");
|
|
6610
|
+
const on = onJ !== void 0 ? decodeBinding(`${path}.on`, onJ) : (() => {
|
|
6611
|
+
const stateKey = reqField(
|
|
6612
|
+
path,
|
|
6613
|
+
f,
|
|
6614
|
+
"stateKey",
|
|
6615
|
+
"Switch stateKey string",
|
|
6616
|
+
requireString
|
|
6617
|
+
);
|
|
6618
|
+
return stateKey.ok ? ok({
|
|
6619
|
+
kind: "State",
|
|
6620
|
+
key: stateKey.value,
|
|
6621
|
+
defaultValue: void 0
|
|
6622
|
+
}) : stateKey;
|
|
6623
|
+
})();
|
|
6624
|
+
if (!on.ok) return on;
|
|
6562
6625
|
const casesArr = reqField(path, f, "cases", "Switch cases array", requireArray);
|
|
6563
6626
|
if (!casesArr.ok) return casesArr;
|
|
6564
6627
|
const cases = traverseIndexed(casesArr.value, (i, item) => {
|
|
@@ -6576,7 +6639,7 @@ var decodeNodeKind = (path, j) => {
|
|
|
6576
6639
|
if (!def.ok) return def;
|
|
6577
6640
|
return ok({
|
|
6578
6641
|
kind: "Switch",
|
|
6579
|
-
spec: {
|
|
6642
|
+
spec: { on: on.value, cases: cases.value, default: def.value }
|
|
6580
6643
|
});
|
|
6581
6644
|
}
|
|
6582
6645
|
case "FragmentDecl": {
|