@ikonai/sdk-ui 0.0.6 → 0.0.8
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/index.js +40 -40
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -451,7 +451,7 @@ class m {
|
|
|
451
451
|
throw new Error("Teleport payload too short");
|
|
452
452
|
if (n[0] !== ot || n[n.length - 1] !== tt)
|
|
453
453
|
throw new Error("Teleport object missing markers");
|
|
454
|
-
const i = { offset: 1 }, s =
|
|
454
|
+
const i = { offset: 1 }, s = J(n, i, "InvalidLength");
|
|
455
455
|
return new m(n, s, i.offset);
|
|
456
456
|
}
|
|
457
457
|
next() {
|
|
@@ -469,7 +469,7 @@ class m {
|
|
|
469
469
|
if (s >= 0)
|
|
470
470
|
H(this.buffer, this.offset, s), a = this.buffer.subarray(this.offset, this.offset + s), this.offset += s;
|
|
471
471
|
else {
|
|
472
|
-
const u = { offset: this.offset }, f =
|
|
472
|
+
const u = { offset: this.offset }, f = J(this.buffer, u, "InvalidLength");
|
|
473
473
|
H(this.buffer, u.offset, f), a = this.buffer.subarray(u.offset, u.offset + f), this.offset = u.offset + f;
|
|
474
474
|
}
|
|
475
475
|
return new ct(d, i, a);
|
|
@@ -589,7 +589,7 @@ class he {
|
|
|
589
589
|
if (this.elementType = n >> 4 & 15, (n & 15) !== 0)
|
|
590
590
|
throw new Error("Array flags must be zero");
|
|
591
591
|
const i = { offset: 1 };
|
|
592
|
-
this.count =
|
|
592
|
+
this.count = J(d, i, "ArrayMalformed"), this.offset = i.offset;
|
|
593
593
|
}
|
|
594
594
|
static create(d) {
|
|
595
595
|
return new he(le(d));
|
|
@@ -620,13 +620,13 @@ class he {
|
|
|
620
620
|
}
|
|
621
621
|
case 12:
|
|
622
622
|
case 13: {
|
|
623
|
-
const d = { offset: this.offset }, n =
|
|
623
|
+
const d = { offset: this.offset }, n = J(this.payload, d, "ArrayMalformed");
|
|
624
624
|
H(this.payload, d.offset, n);
|
|
625
625
|
const i = this.payload.subarray(d.offset, d.offset + n);
|
|
626
626
|
return this.offset = d.offset + n, new B(this.elementType, i);
|
|
627
627
|
}
|
|
628
628
|
case 11: {
|
|
629
|
-
const d = { offset: this.offset }, n =
|
|
629
|
+
const d = { offset: this.offset }, n = J(this.payload, d, "ArrayMalformed");
|
|
630
630
|
H(this.payload, d.offset, n);
|
|
631
631
|
const i = this.payload.subarray(d.offset, d.offset + n);
|
|
632
632
|
return this.offset = d.offset + n, new B(11, i);
|
|
@@ -663,7 +663,7 @@ class be {
|
|
|
663
663
|
throw new Error("Dictionary key/value flags must be zero");
|
|
664
664
|
ye(this.keyType);
|
|
665
665
|
const n = { offset: 2 };
|
|
666
|
-
this.count =
|
|
666
|
+
this.count = J(d, n, "DictMalformed"), this.offset = n.offset;
|
|
667
667
|
}
|
|
668
668
|
static create(d) {
|
|
669
669
|
return new be(le(d));
|
|
@@ -685,7 +685,7 @@ class be {
|
|
|
685
685
|
return this.offset += d, new G(this.keyType, n);
|
|
686
686
|
}
|
|
687
687
|
if (this.keyType === 12 || this.keyType === 13) {
|
|
688
|
-
const n = { offset: this.offset }, i =
|
|
688
|
+
const n = { offset: this.offset }, i = J(this.payload, n, "DictMalformed");
|
|
689
689
|
H(this.payload, n.offset, i);
|
|
690
690
|
const s = this.payload.subarray(n.offset, n.offset + i);
|
|
691
691
|
return this.offset = n.offset + i, new G(this.keyType, s);
|
|
@@ -696,13 +696,13 @@ class be {
|
|
|
696
696
|
switch (this.valueType) {
|
|
697
697
|
case 12:
|
|
698
698
|
case 13: {
|
|
699
|
-
const d = { offset: this.offset }, n =
|
|
699
|
+
const d = { offset: this.offset }, n = J(this.payload, d, "DictMalformed");
|
|
700
700
|
H(this.payload, d.offset, n);
|
|
701
701
|
const i = this.payload.subarray(d.offset, d.offset + n);
|
|
702
702
|
return this.offset = d.offset + n, new G(this.valueType, i);
|
|
703
703
|
}
|
|
704
704
|
case 11: {
|
|
705
|
-
const d = { offset: this.offset }, n =
|
|
705
|
+
const d = { offset: this.offset }, n = J(this.payload, d, "DictMalformed");
|
|
706
706
|
H(this.payload, d.offset, n);
|
|
707
707
|
const i = this.payload.subarray(d.offset, d.offset + n);
|
|
708
708
|
return this.offset = d.offset + n, new G(11, i);
|
|
@@ -850,7 +850,7 @@ class oe {
|
|
|
850
850
|
return Uint8Array.from(this.bytes);
|
|
851
851
|
}
|
|
852
852
|
}
|
|
853
|
-
function
|
|
853
|
+
function J(e, d, n) {
|
|
854
854
|
if (d.offset >= e.length)
|
|
855
855
|
throw new Error(n);
|
|
856
856
|
let i = 0, s = 0, a = 0;
|
|
@@ -914,7 +914,7 @@ function me(e, d) {
|
|
|
914
914
|
const n = e[d], i = n >> 4 & 15;
|
|
915
915
|
if ((n & 15) !== 0)
|
|
916
916
|
throw new Error("Array flags must be zero");
|
|
917
|
-
const s = { offset: d + 1 }, a =
|
|
917
|
+
const s = { offset: d + 1 }, a = J(e, s, "ArrayMalformed"), u = R(i);
|
|
918
918
|
if (u >= 0) {
|
|
919
919
|
const w = u * a;
|
|
920
920
|
return H(e, s.offset, w), s.offset + w - d;
|
|
@@ -931,7 +931,7 @@ function Ne(e, d) {
|
|
|
931
931
|
if ((e[d] & 15) !== 0 || (e[d + 1] & 15) !== 0)
|
|
932
932
|
throw new Error("Dictionary key/value flags must be zero");
|
|
933
933
|
ye(n);
|
|
934
|
-
const s = { offset: d + 2 }, a =
|
|
934
|
+
const s = { offset: d + 2 }, a = J(e, s, "DictMalformed");
|
|
935
935
|
let u = s.offset;
|
|
936
936
|
for (let f = 0; f < a; f++)
|
|
937
937
|
u = ae(n, e, u, "DictMalformed"), u = ae(i, e, u, "DictMalformed");
|
|
@@ -944,11 +944,11 @@ function ae(e, d, n, i) {
|
|
|
944
944
|
switch (e) {
|
|
945
945
|
case 12:
|
|
946
946
|
case 13: {
|
|
947
|
-
const a = { offset: n }, u =
|
|
947
|
+
const a = { offset: n }, u = J(d, a, i);
|
|
948
948
|
return H(d, a.offset, u), a.offset + u;
|
|
949
949
|
}
|
|
950
950
|
case 11: {
|
|
951
|
-
const a = { offset: n }, u =
|
|
951
|
+
const a = { offset: n }, u = J(d, a, i);
|
|
952
952
|
return H(d, a.offset, u), a.offset + u;
|
|
953
953
|
}
|
|
954
954
|
case 9:
|
|
@@ -1849,7 +1849,7 @@ var xe;
|
|
|
1849
1849
|
}
|
|
1850
1850
|
e.fromProtocolMessage = I;
|
|
1851
1851
|
})(xe || (xe = {}));
|
|
1852
|
-
var
|
|
1852
|
+
var Je;
|
|
1853
1853
|
((e) => {
|
|
1854
1854
|
e.TeleportVersion = 1, e.TeleportOpcode = 1048586, e.TeleportLayoutHash = 1094216080, e.FileNameFieldId = 330663152, e.HashFieldId = 377324326, e.ActionIdFieldId = 727023925, e.CheckHashFieldId = 2495084284, e.MimeFieldId = 2697635005, e.ByteCountFieldId = 3499993226;
|
|
1855
1855
|
function d(t) {
|
|
@@ -1932,8 +1932,8 @@ var ve;
|
|
|
1932
1932
|
return a(o, r);
|
|
1933
1933
|
}
|
|
1934
1934
|
e.fromProtocolMessage = I;
|
|
1935
|
-
})(
|
|
1936
|
-
var
|
|
1935
|
+
})(Je || (Je = {}));
|
|
1936
|
+
var ve;
|
|
1937
1937
|
((e) => {
|
|
1938
1938
|
e.TeleportVersion = 1, e.TeleportOpcode = 1048587, e.TeleportLayoutHash = 1742535460, e.ActionIdFieldId = 727023925, e.DataFieldId = 2986785889, e.SequenceIdFieldId = 3442222250;
|
|
1939
1939
|
function d(t) {
|
|
@@ -1998,7 +1998,7 @@ var Je;
|
|
|
1998
1998
|
return a(o, r);
|
|
1999
1999
|
}
|
|
2000
2000
|
e.fromProtocolMessage = I;
|
|
2001
|
-
})(
|
|
2001
|
+
})(ve || (ve = {}));
|
|
2002
2002
|
var Ge;
|
|
2003
2003
|
((e) => {
|
|
2004
2004
|
e.TeleportVersion = 1, e.TeleportOpcode = 1048589, e.TeleportLayoutHash = 2447300043, e.ActionIdFieldId = 727023925;
|
|
@@ -6212,7 +6212,7 @@ var xr;
|
|
|
6212
6212
|
}
|
|
6213
6213
|
e.fromProtocolMessage = I;
|
|
6214
6214
|
})(xr || (xr = {}));
|
|
6215
|
-
var
|
|
6215
|
+
var Jr;
|
|
6216
6216
|
((e) => {
|
|
6217
6217
|
e.TeleportVersion = 1, e.TeleportOpcode = 1048601, e.TeleportLayoutHash = 2341098938, e.FunctionNameFieldId = 814454131, e.FunctionIdFieldId = 976255570, e.ClientBackendTokenFieldId = 1123310456, e.ParametersFieldId = 2885165957, e.CallIdFieldId = 3748161056, e.InstanceIdFieldId = 4289118421;
|
|
6218
6218
|
function d(r) {
|
|
@@ -6307,8 +6307,8 @@ var vr;
|
|
|
6307
6307
|
o.push(K.readFromTeleport(l.asObject()));
|
|
6308
6308
|
return o;
|
|
6309
6309
|
}
|
|
6310
|
-
})(
|
|
6311
|
-
var
|
|
6310
|
+
})(Jr || (Jr = {}));
|
|
6311
|
+
var vr;
|
|
6312
6312
|
((e) => {
|
|
6313
6313
|
e.TeleportVersion = 1, e.TeleportOpcode = 1048629, e.TeleportLayoutHash = 1508754766, e.CallIdFieldId = 3748161056, e.InstanceIdFieldId = 4289118421;
|
|
6314
6314
|
function d(t) {
|
|
@@ -6367,7 +6367,7 @@ var Jr;
|
|
|
6367
6367
|
return a(o, r);
|
|
6368
6368
|
}
|
|
6369
6369
|
e.fromProtocolMessage = I;
|
|
6370
|
-
})(
|
|
6370
|
+
})(vr || (vr = {}));
|
|
6371
6371
|
var Gr;
|
|
6372
6372
|
((e) => {
|
|
6373
6373
|
e.TeleportVersion = 1, e.TeleportOpcode = 1048630, e.TeleportLayoutHash = 1508754766, e.CallIdFieldId = 3748161056, e.InstanceIdFieldId = 4289118421;
|
|
@@ -12127,7 +12127,7 @@ var xo;
|
|
|
12127
12127
|
return o;
|
|
12128
12128
|
}
|
|
12129
12129
|
})(xo || (xo = {}));
|
|
12130
|
-
var
|
|
12130
|
+
var Jo;
|
|
12131
12131
|
((e) => {
|
|
12132
12132
|
e.TeleportVersion = 1, e.TeleportOpcode = 2097158, e.TeleportLayoutHash = 4089149075;
|
|
12133
12133
|
function d(t) {
|
|
@@ -12171,8 +12171,8 @@ var vo;
|
|
|
12171
12171
|
return a(o, r);
|
|
12172
12172
|
}
|
|
12173
12173
|
e.fromProtocolMessage = I;
|
|
12174
|
-
})(
|
|
12175
|
-
var
|
|
12174
|
+
})(Jo || (Jo = {}));
|
|
12175
|
+
var vo;
|
|
12176
12176
|
((e) => {
|
|
12177
12177
|
e.TeleportVersion = 1, e.TeleportOpcode = 2097164, e.TeleportLayoutHash = 3636719430, e.StyleIdFieldId = 979822885, e.ElementIdFieldId = 1753055760, e.LabelsFieldId = 2329079073;
|
|
12178
12178
|
function d(r) {
|
|
@@ -12247,7 +12247,7 @@ var Jo;
|
|
|
12247
12247
|
o.push(l.asString());
|
|
12248
12248
|
return o;
|
|
12249
12249
|
}
|
|
12250
|
-
})(
|
|
12250
|
+
})(vo || (vo = {}));
|
|
12251
12251
|
var Go;
|
|
12252
12252
|
((e) => {
|
|
12253
12253
|
e.TeleportVersion = 1, e.TeleportOpcode = 2097189, e.TeleportLayoutHash = 3225070243, e.StyleIdFieldId = 979822885, e.SvgFieldId = 1032553508, e.ElementIdFieldId = 1753055760, e.LabelsFieldId = 2329079073;
|
|
@@ -13849,10 +13849,10 @@ function ht(e) {
|
|
|
13849
13849
|
}
|
|
13850
13850
|
function bt(e, d, n) {
|
|
13851
13851
|
if (!e || typeof e != "object")
|
|
13852
|
-
throw new
|
|
13852
|
+
throw new v("UI update graph is missing");
|
|
13853
13853
|
const i = Ee(e, "graph");
|
|
13854
13854
|
if (i.type !== "root")
|
|
13855
|
-
throw new
|
|
13855
|
+
throw new v('UI update root element must have type "root"');
|
|
13856
13856
|
const s = mt(i.props, d);
|
|
13857
13857
|
return {
|
|
13858
13858
|
type: "full",
|
|
@@ -13863,12 +13863,12 @@ function bt(e, d, n) {
|
|
|
13863
13863
|
}
|
|
13864
13864
|
function yt(e, d, n) {
|
|
13865
13865
|
if (!e || typeof e != "object")
|
|
13866
|
-
throw new
|
|
13866
|
+
throw new v("UI diff payload is missing");
|
|
13867
13867
|
if (!x(d))
|
|
13868
|
-
throw new
|
|
13868
|
+
throw new v("UI diff metadata must be an object");
|
|
13869
13869
|
const i = d.containerId;
|
|
13870
13870
|
if (typeof i != "string" || i.length === 0)
|
|
13871
|
-
throw new
|
|
13871
|
+
throw new v("UI diff metadata is missing containerId");
|
|
13872
13872
|
const s = lt(e, "diff"), a = d.optimisticActionId === null || typeof d.optimisticActionId == "string" ? d.optimisticActionId : void 0, u = typeof d.isOptimistic == "boolean" ? d.isOptimistic : void 0, f = typeof d.isUpdate == "boolean" ? d.isUpdate : void 0, w = Ie(d.optimisticPatch), I = Fe(d.optimisticReconcile), t = {
|
|
13873
13873
|
containerId: i,
|
|
13874
13874
|
...a !== void 0 ? { optimisticActionId: a } : {},
|
|
@@ -13887,7 +13887,7 @@ function yt(e, d, n) {
|
|
|
13887
13887
|
function mt(e, d) {
|
|
13888
13888
|
const n = e.containerId;
|
|
13889
13889
|
if (typeof n != "string" || n.length === 0)
|
|
13890
|
-
throw new
|
|
13890
|
+
throw new v("UI update root is missing containerId");
|
|
13891
13891
|
let i = n, s = e.optimisticActionId === null || typeof e.optimisticActionId == "string" ? e.optimisticActionId : void 0, a = typeof e.isOptimistic == "boolean" ? e.isOptimistic : void 0, u = typeof e.isUpdate == "boolean" ? e.isUpdate : void 0, f = Ie(e.optimisticPatch), w = Fe(e.optimisticReconcile);
|
|
13892
13892
|
return x(d) && (typeof d.containerId == "string" && d.containerId.length > 0 && (i = d.containerId), (d.optimisticActionId === null || typeof d.optimisticActionId == "string") && (s = d.optimisticActionId), typeof d.isOptimistic == "boolean" && (a = d.isOptimistic), typeof d.isUpdate == "boolean" && (u = d.isUpdate), d.optimisticPatch !== void 0 && (f = Ie(d.optimisticPatch)), d.optimisticReconcile !== void 0 && (w = Fe(d.optimisticReconcile))), {
|
|
13893
13893
|
containerId: i,
|
|
@@ -13937,7 +13937,7 @@ function Fe(e) {
|
|
|
13937
13937
|
...s && s.length > 0 ? { drop: s } : {}
|
|
13938
13938
|
};
|
|
13939
13939
|
}
|
|
13940
|
-
class
|
|
13940
|
+
class v extends Error {
|
|
13941
13941
|
constructor(d, n) {
|
|
13942
13942
|
super(d), this.causeError = n, this.name = "UiUpdateParseError", n instanceof Error && (this.stack = n.stack);
|
|
13943
13943
|
}
|
|
@@ -13947,15 +13947,15 @@ function Nt(e) {
|
|
|
13947
13947
|
try {
|
|
13948
13948
|
d = JSON.parse(e.Json);
|
|
13949
13949
|
} catch (u) {
|
|
13950
|
-
throw new
|
|
13950
|
+
throw new v("Failed to parse UIUpdate.Json payload", u);
|
|
13951
13951
|
}
|
|
13952
13952
|
if (!d || typeof d != "object")
|
|
13953
|
-
throw new
|
|
13953
|
+
throw new v("UI update snapshot must be an object");
|
|
13954
13954
|
const { type: n, version: i } = d;
|
|
13955
13955
|
if (n !== "full" && n !== "diff")
|
|
13956
|
-
throw new
|
|
13956
|
+
throw new v(`Unknown UI update type: ${String(n)}`);
|
|
13957
13957
|
if (typeof i != "number")
|
|
13958
|
-
throw new
|
|
13958
|
+
throw new v("UI update version must be a number");
|
|
13959
13959
|
const s = n === "full" ? bt(d.graph, d.metadata, i) : yt(d.diff, d.metadata, i), a = e.Payloads ? ht(e.Payloads) : /* @__PURE__ */ new Map();
|
|
13960
13960
|
return {
|
|
13961
13961
|
snapshot: s,
|
|
@@ -14353,13 +14353,13 @@ class _t {
|
|
|
14353
14353
|
const s = fe.fromProtocolMessage(d), a = Nt(s);
|
|
14354
14354
|
this.notifyUiUpdate(i, a), this.uiStore.apply(i, a);
|
|
14355
14355
|
} catch (s) {
|
|
14356
|
-
s instanceof
|
|
14356
|
+
s instanceof v ? $.warn("Failed to parse UI update", s.causeError ?? s) : $.error("Failed to apply UI update", s);
|
|
14357
14357
|
}
|
|
14358
14358
|
}
|
|
14359
14359
|
handleUiStyles(d) {
|
|
14360
14360
|
try {
|
|
14361
14361
|
const n = ce.fromProtocolMessage(d);
|
|
14362
|
-
if (
|
|
14362
|
+
if (!n.StyleId) return;
|
|
14363
14363
|
const i = {
|
|
14364
14364
|
styleId: n.StyleId,
|
|
14365
14365
|
css: n.Style?.css,
|
|
@@ -14391,6 +14391,6 @@ export {
|
|
|
14391
14391
|
_t as IkonUICore,
|
|
14392
14392
|
Mt as UiStore,
|
|
14393
14393
|
Et as UiStreamStore,
|
|
14394
|
-
|
|
14394
|
+
v as UiUpdateParseError,
|
|
14395
14395
|
Nt as parseUiUpdate
|
|
14396
14396
|
};
|