typebulb 0.58.0 → 0.58.2

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.
@@ -8,11 +8,13 @@
8
8
  * init({ applyData, applyInsight, send })
9
9
  * applyData(chunks) -> put the chunks in this host's data global
10
10
  * applyInsight(json) -> put the serialized insight in this host's insight global
11
- * send(pair) -> hand { data?, insight? } to this host's transport; resolve the
12
- * shareable URL, or undefined when there is none. Must never reject:
13
- * every failure reads to a bulb as "no link".
11
+ * send(pair) -> hand { data?, insight? } to this host's transport; resolve once the
12
+ * write has landed. Must never reject: a transport failure costs the
13
+ * fragment, never the swap.
14
14
  *
15
- * setData(chunks) / setInsight(value) -> the two tb.* writers, resolving send's URL
15
+ * setData(chunks) / setInsight(value) -> the two tb.* writers, resolving once the address bar
16
+ * reflects the write. Neither hands back a link: the fragment is
17
+ * already in the URL, which a bulb reads with tb.url() like any other.
16
18
  * seed(pair) -> apply and record what a decoded `#tb=` fragment carried, without sending it back
17
19
  * pair() -> the wire pair, for a host that files it (the CLI modal's Save). Empty when
18
20
  * nothing has been set, which is also how a host asks whether anything has.
@@ -24,10 +26,9 @@
24
26
  * which stays exact for a null insight and needs no companion flag.
25
27
  *
26
28
  * Coalescing keys on whether the in-flight write has read the pair yet, not on whether one is
27
- * outstanding. Writes landing before that ride it and share its URL, one round trip for the pair;
28
- * a write landing after it queues one re-send, because the write on the wire carries a state the
29
- * page has moved past. Answering it with that URL would address a run the page no longer shows,
30
- * and skipping the re-send would leave the address bar doing so (Invariant 6).
29
+ * outstanding. Writes landing before that ride it, one round trip for the pair; a write landing
30
+ * after it queues one re-send, because the write on the wire carries a state the page has moved
31
+ * past, and skipping the re-send would leave the address bar addressing it (Invariant 6).
31
32
  */
32
33
  export declare const runtimeStateEngine = "(function () {\n var W = window;\n var rtData, rtInsight, rtHasInsight = false;\n var applyData, applyInsight, send;\n var pending = null, sent = false, queued = null;\n\n var pair = function () {\n var p = {};\n if (rtData !== undefined) p.data = rtData;\n if (rtHasInsight) p.insight = rtInsight;\n return p;\n };\n\n var start = function () {\n sent = false;\n return Promise.resolve()\n .then(function () { sent = true; return send(pair()); })\n .catch(function () { return undefined; })\n .finally(function () { pending = null; });\n };\n var publish = function () {\n if (!pending) { pending = start(); return pending; }\n if (!sent) return pending;\n if (!queued) queued = pending.then(function () { queued = null; return publish(); });\n return queued;\n };\n\n W.__tbState = {\n init: function (o) { applyData = o.applyData; applyInsight = o.applyInsight; send = o.send; },\n pair: pair,\n // Applied but not sent: the fragment already holds this, so sending it back would re-encode\n // the state the page just booted from.\n seed: function (p) {\n if (p.data !== undefined) { rtData = p.data; applyData(p.data); }\n if ('insight' in p) { rtInsight = p.insight; rtHasInsight = true; applyInsight(JSON.stringify(p.insight, null, 2)); }\n },\n // The globals move before the round trip, so a synchronous tb.data() right after the await is\n // never stale.\n setData: function (chunks) {\n var arr = Array.isArray(chunks) ? chunks : [chunks];\n rtData = arr;\n applyData(arr);\n return publish();\n },\n setInsight: function (value) {\n // Serialize before recording: a value JSON.stringify rejects (a cycle, a BigInt) must leave\n // the slot untouched, or every later setter carries a pair that can never be encoded or sent.\n var json = JSON.stringify(value, null, 2);\n rtInsight = value;\n rtHasInsight = true;\n applyInsight(json);\n return publish();\n }\n };\n})();";
33
34
  //# sourceMappingURL=runtimeState.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"runtimeState.d.ts","sourceRoot":"","sources":["../../format/src/runtimeState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,eAAO,MAAM,kBAAkB,4/DAsDzB,CAAA"}
1
+ {"version":3,"file":"runtimeState.d.ts","sourceRoot":"","sources":["../../format/src/runtimeState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,kBAAkB,4/DAsDzB,CAAA"}
@@ -8,11 +8,13 @@
8
8
  * init({ applyData, applyInsight, send })
9
9
  * applyData(chunks) -> put the chunks in this host's data global
10
10
  * applyInsight(json) -> put the serialized insight in this host's insight global
11
- * send(pair) -> hand { data?, insight? } to this host's transport; resolve the
12
- * shareable URL, or undefined when there is none. Must never reject:
13
- * every failure reads to a bulb as "no link".
11
+ * send(pair) -> hand { data?, insight? } to this host's transport; resolve once the
12
+ * write has landed. Must never reject: a transport failure costs the
13
+ * fragment, never the swap.
14
14
  *
15
- * setData(chunks) / setInsight(value) -> the two tb.* writers, resolving send's URL
15
+ * setData(chunks) / setInsight(value) -> the two tb.* writers, resolving once the address bar
16
+ * reflects the write. Neither hands back a link: the fragment is
17
+ * already in the URL, which a bulb reads with tb.url() like any other.
16
18
  * seed(pair) -> apply and record what a decoded `#tb=` fragment carried, without sending it back
17
19
  * pair() -> the wire pair, for a host that files it (the CLI modal's Save). Empty when
18
20
  * nothing has been set, which is also how a host asks whether anything has.
@@ -24,64 +26,63 @@
24
26
  * which stays exact for a null insight and needs no companion flag.
25
27
  *
26
28
  * Coalescing keys on whether the in-flight write has read the pair yet, not on whether one is
27
- * outstanding. Writes landing before that ride it and share its URL, one round trip for the pair;
28
- * a write landing after it queues one re-send, because the write on the wire carries a state the
29
- * page has moved past. Answering it with that URL would address a run the page no longer shows,
30
- * and skipping the re-send would leave the address bar doing so (Invariant 6).
29
+ * outstanding. Writes landing before that ride it, one round trip for the pair; a write landing
30
+ * after it queues one re-send, because the write on the wire carries a state the page has moved
31
+ * past, and skipping the re-send would leave the address bar addressing it (Invariant 6).
31
32
  */
32
- export const runtimeStateEngine = `(function () {
33
- var W = window;
34
- var rtData, rtInsight, rtHasInsight = false;
35
- var applyData, applyInsight, send;
36
- var pending = null, sent = false, queued = null;
37
-
38
- var pair = function () {
39
- var p = {};
40
- if (rtData !== undefined) p.data = rtData;
41
- if (rtHasInsight) p.insight = rtInsight;
42
- return p;
43
- };
44
-
45
- var start = function () {
46
- sent = false;
47
- return Promise.resolve()
48
- .then(function () { sent = true; return send(pair()); })
49
- .catch(function () { return undefined; })
50
- .finally(function () { pending = null; });
51
- };
52
- var publish = function () {
53
- if (!pending) { pending = start(); return pending; }
54
- if (!sent) return pending;
55
- if (!queued) queued = pending.then(function () { queued = null; return publish(); });
56
- return queued;
57
- };
58
-
59
- W.__tbState = {
60
- init: function (o) { applyData = o.applyData; applyInsight = o.applyInsight; send = o.send; },
61
- pair: pair,
62
- // Applied but not sent: the fragment already holds this, so sending it back would re-encode
63
- // the state the page just booted from.
64
- seed: function (p) {
65
- if (p.data !== undefined) { rtData = p.data; applyData(p.data); }
66
- if ('insight' in p) { rtInsight = p.insight; rtHasInsight = true; applyInsight(JSON.stringify(p.insight, null, 2)); }
67
- },
68
- // The globals move before the round trip, so a synchronous tb.data() right after the await is
69
- // never stale.
70
- setData: function (chunks) {
71
- var arr = Array.isArray(chunks) ? chunks : [chunks];
72
- rtData = arr;
73
- applyData(arr);
74
- return publish();
75
- },
76
- setInsight: function (value) {
77
- // Serialize before recording: a value JSON.stringify rejects (a cycle, a BigInt) must leave
78
- // the slot untouched, or every later setter carries a pair that can never be encoded or sent.
79
- var json = JSON.stringify(value, null, 2);
80
- rtInsight = value;
81
- rtHasInsight = true;
82
- applyInsight(json);
83
- return publish();
84
- }
85
- };
33
+ export const runtimeStateEngine = `(function () {
34
+ var W = window;
35
+ var rtData, rtInsight, rtHasInsight = false;
36
+ var applyData, applyInsight, send;
37
+ var pending = null, sent = false, queued = null;
38
+
39
+ var pair = function () {
40
+ var p = {};
41
+ if (rtData !== undefined) p.data = rtData;
42
+ if (rtHasInsight) p.insight = rtInsight;
43
+ return p;
44
+ };
45
+
46
+ var start = function () {
47
+ sent = false;
48
+ return Promise.resolve()
49
+ .then(function () { sent = true; return send(pair()); })
50
+ .catch(function () { return undefined; })
51
+ .finally(function () { pending = null; });
52
+ };
53
+ var publish = function () {
54
+ if (!pending) { pending = start(); return pending; }
55
+ if (!sent) return pending;
56
+ if (!queued) queued = pending.then(function () { queued = null; return publish(); });
57
+ return queued;
58
+ };
59
+
60
+ W.__tbState = {
61
+ init: function (o) { applyData = o.applyData; applyInsight = o.applyInsight; send = o.send; },
62
+ pair: pair,
63
+ // Applied but not sent: the fragment already holds this, so sending it back would re-encode
64
+ // the state the page just booted from.
65
+ seed: function (p) {
66
+ if (p.data !== undefined) { rtData = p.data; applyData(p.data); }
67
+ if ('insight' in p) { rtInsight = p.insight; rtHasInsight = true; applyInsight(JSON.stringify(p.insight, null, 2)); }
68
+ },
69
+ // The globals move before the round trip, so a synchronous tb.data() right after the await is
70
+ // never stale.
71
+ setData: function (chunks) {
72
+ var arr = Array.isArray(chunks) ? chunks : [chunks];
73
+ rtData = arr;
74
+ applyData(arr);
75
+ return publish();
76
+ },
77
+ setInsight: function (value) {
78
+ // Serialize before recording: a value JSON.stringify rejects (a cycle, a BigInt) must leave
79
+ // the slot untouched, or every later setter carries a pair that can never be encoded or sent.
80
+ var json = JSON.stringify(value, null, 2);
81
+ rtInsight = value;
82
+ rtHasInsight = true;
83
+ applyInsight(json);
84
+ return publish();
85
+ }
86
+ };
86
87
  })();`;
87
88
  //# sourceMappingURL=runtimeState.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"runtimeState.js","sourceRoot":"","sources":["../../format/src/runtimeState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAsD5B,CAAA"}
1
+ {"version":3,"file":"runtimeState.js","sourceRoot":"","sources":["../../format/src/runtimeState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAsD5B,CAAA"}