typebulb 0.55.2 → 0.55.4
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/README.md +2 -2
- package/SKILL.md +4 -4
- package/dist/agents/claude/client.js +222 -139
- package/dist/agents/codex/client.js +229 -146
- package/dist/agents/pi/client.js +222 -139
- package/dist/format/index.d.ts +1 -0
- package/dist/format/index.d.ts.map +1 -1
- package/dist/format/index.js +1 -0
- package/dist/format/index.js.map +1 -1
- package/dist/format/scrollRestore.d.ts +21 -0
- package/dist/format/scrollRestore.d.ts.map +1 -0
- package/dist/format/scrollRestore.js +89 -0
- package/dist/format/scrollRestore.js.map +1 -0
- package/dist/index.js +248 -164
- package/dist/render.js +151 -68
- package/dist/servers.js +36 -36
- package/package.json +1 -1
package/dist/format/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../format/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,aAAa,CAAA;AAC3B,cAAc,WAAW,CAAA;AACzB,cAAc,WAAW,CAAA;AACzB,cAAc,gBAAgB,CAAA;AAC9B,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../format/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,aAAa,CAAA;AAC3B,cAAc,WAAW,CAAA;AACzB,cAAc,WAAW,CAAA;AACzB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,oBAAoB,CAAA;AAClC,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAA"}
|
package/dist/format/index.js
CHANGED
package/dist/format/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../format/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,aAAa,CAAA;AAC3B,cAAc,WAAW,CAAA;AACzB,cAAc,WAAW,CAAA;AACzB,cAAc,gBAAgB,CAAA;AAC9B,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../format/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,aAAa,CAAA;AAC3B,cAAc,WAAW,CAAA;AACzB,cAAc,WAAW,CAAA;AACzB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,oBAAoB,CAAA;AAClC,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The scroll-restoration engine a rendered bulb document ships (specs/Scroll-Restoration.md).
|
|
3
|
+
* ONE copy, beside pageShell.ts and on its argument: both hosts must emit the same behavior or a
|
|
4
|
+
* bulb restores differently local vs published. A script string for the page <head>; the host's
|
|
5
|
+
* own snippet then calls `window.__tbScroll.init({ initialY, save })` to say where the offset
|
|
6
|
+
* comes from and where reports go (the CLI: the page's sessionStorage; the sandbox: a postMessage
|
|
7
|
+
* to the parent).
|
|
8
|
+
*
|
|
9
|
+
* init({ initialY, save }) -> arm the re-apply loop at initialY (0: nothing to do); save(y) is
|
|
10
|
+
* the throttled reporter's sink
|
|
11
|
+
* restore(y) -> re-arm at y (a traversal landed); undefined or 0 scrolls to top
|
|
12
|
+
* top() -> a page-shaped move landed: disarm, scroll to 0, report 0
|
|
13
|
+
* flush() -> report the pending offset now (before a route change goes out)
|
|
14
|
+
*
|
|
15
|
+
* While armed, every frame writes `y` once the document is tall enough, and the loop stands down
|
|
16
|
+
* on the first scroll it did not author (input, the browser's scroll anchoring, a bulb scrolling
|
|
17
|
+
* itself) or TAIL_MS after `load`. A clamp (the document shrank under us) is exempt. Native
|
|
18
|
+
* restoration gives up at `load`; this covers the tail a bulb that renders after load needs.
|
|
19
|
+
*/
|
|
20
|
+
export declare const scrollRestoreEngine = "(function () {\n var W = window, D = document;\n var TAIL_MS = 1500, TOL = 2, THROTTLE_MS = 200;\n var SCROLL_KEYS = { ' ': 1, ArrowUp: 1, ArrowDown: 1, PageUp: 1, PageDown: 1, Home: 1, End: 1 };\n var save = null;\n var target = 0, armed = false, applied = false, lastWritten = -1, raf = 0, deadline = 0;\n var pending, timer = 0;\n\n var maxY = function () { var d = D.documentElement; return Math.max(0, d.scrollHeight - d.clientHeight); };\n var write = function (y) {\n lastWritten = y;\n try { W.scrollTo({ top: y, left: 0, behavior: 'instant' }); } catch (e) { W.scrollTo(0, y); }\n };\n var disarm = function () {\n armed = false;\n if (raf) { cancelAnimationFrame(raf); raf = 0; }\n if (deadline) { clearTimeout(deadline); deadline = 0; }\n };\n var tick = function () {\n if (!armed) return;\n if (target <= maxY()) { applied = true; if (Math.abs(W.scrollY - target) > TOL) write(target); }\n raf = requestAnimationFrame(tick);\n };\n var expire = function () {\n if (!armed) return;\n if (!applied) { var y = Math.min(target, maxY()); if (y > 0) write(y); }\n disarm();\n };\n var arm = function (y) {\n disarm();\n target = y; applied = false;\n if (!(y > 0)) return;\n armed = true;\n raf = requestAnimationFrame(tick);\n var start = function () { if (armed && !deadline) deadline = setTimeout(expire, TAIL_MS); };\n if (D.readyState === 'complete') start(); else W.addEventListener('load', start, { once: true });\n };\n\n var report = function (y) { if (save) { try { save(y); } catch (e) {} } };\n var flush = function () {\n if (timer) { clearTimeout(timer); timer = 0; }\n if (pending !== undefined) { var y = pending; pending = undefined; report(y); }\n };\n\n W.addEventListener('scroll', function () {\n var y = W.scrollY;\n pending = y;\n if (!timer) timer = setTimeout(flush, THROTTLE_MS);\n if (!armed || Math.abs(y - lastWritten) <= TOL) return;\n if (y < target && Math.abs(y - maxY()) <= TOL) return;\n disarm();\n }, { passive: true });\n W.addEventListener('wheel', disarm, { capture: true, passive: true });\n W.addEventListener('touchstart', disarm, { capture: true, passive: true });\n W.addEventListener('keydown', function (e) { if (SCROLL_KEYS[e.key]) disarm(); }, { capture: true });\n\n W.__tbScroll = {\n init: function (o) {\n save = o && typeof o.save === 'function' ? o.save : null;\n arm(o ? Number(o.initialY) : 0);\n },\n restore: function (y) {\n y = Number(y);\n if (y > 0 && isFinite(y)) arm(y); else { disarm(); write(0); }\n },\n top: function () { disarm(); write(0); report(0); },\n flush: flush\n };\n})();";
|
|
21
|
+
//# sourceMappingURL=scrollRestore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scrollRestore.d.ts","sourceRoot":"","sources":["../../format/src/scrollRestore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,mBAAmB,kpFAoE1B,CAAA"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The scroll-restoration engine a rendered bulb document ships (specs/Scroll-Restoration.md).
|
|
3
|
+
* ONE copy, beside pageShell.ts and on its argument: both hosts must emit the same behavior or a
|
|
4
|
+
* bulb restores differently local vs published. A script string for the page <head>; the host's
|
|
5
|
+
* own snippet then calls `window.__tbScroll.init({ initialY, save })` to say where the offset
|
|
6
|
+
* comes from and where reports go (the CLI: the page's sessionStorage; the sandbox: a postMessage
|
|
7
|
+
* to the parent).
|
|
8
|
+
*
|
|
9
|
+
* init({ initialY, save }) -> arm the re-apply loop at initialY (0: nothing to do); save(y) is
|
|
10
|
+
* the throttled reporter's sink
|
|
11
|
+
* restore(y) -> re-arm at y (a traversal landed); undefined or 0 scrolls to top
|
|
12
|
+
* top() -> a page-shaped move landed: disarm, scroll to 0, report 0
|
|
13
|
+
* flush() -> report the pending offset now (before a route change goes out)
|
|
14
|
+
*
|
|
15
|
+
* While armed, every frame writes `y` once the document is tall enough, and the loop stands down
|
|
16
|
+
* on the first scroll it did not author (input, the browser's scroll anchoring, a bulb scrolling
|
|
17
|
+
* itself) or TAIL_MS after `load`. A clamp (the document shrank under us) is exempt. Native
|
|
18
|
+
* restoration gives up at `load`; this covers the tail a bulb that renders after load needs.
|
|
19
|
+
*/
|
|
20
|
+
export const scrollRestoreEngine = `(function () {
|
|
21
|
+
var W = window, D = document;
|
|
22
|
+
var TAIL_MS = 1500, TOL = 2, THROTTLE_MS = 200;
|
|
23
|
+
var SCROLL_KEYS = { ' ': 1, ArrowUp: 1, ArrowDown: 1, PageUp: 1, PageDown: 1, Home: 1, End: 1 };
|
|
24
|
+
var save = null;
|
|
25
|
+
var target = 0, armed = false, applied = false, lastWritten = -1, raf = 0, deadline = 0;
|
|
26
|
+
var pending, timer = 0;
|
|
27
|
+
|
|
28
|
+
var maxY = function () { var d = D.documentElement; return Math.max(0, d.scrollHeight - d.clientHeight); };
|
|
29
|
+
var write = function (y) {
|
|
30
|
+
lastWritten = y;
|
|
31
|
+
try { W.scrollTo({ top: y, left: 0, behavior: 'instant' }); } catch (e) { W.scrollTo(0, y); }
|
|
32
|
+
};
|
|
33
|
+
var disarm = function () {
|
|
34
|
+
armed = false;
|
|
35
|
+
if (raf) { cancelAnimationFrame(raf); raf = 0; }
|
|
36
|
+
if (deadline) { clearTimeout(deadline); deadline = 0; }
|
|
37
|
+
};
|
|
38
|
+
var tick = function () {
|
|
39
|
+
if (!armed) return;
|
|
40
|
+
if (target <= maxY()) { applied = true; if (Math.abs(W.scrollY - target) > TOL) write(target); }
|
|
41
|
+
raf = requestAnimationFrame(tick);
|
|
42
|
+
};
|
|
43
|
+
var expire = function () {
|
|
44
|
+
if (!armed) return;
|
|
45
|
+
if (!applied) { var y = Math.min(target, maxY()); if (y > 0) write(y); }
|
|
46
|
+
disarm();
|
|
47
|
+
};
|
|
48
|
+
var arm = function (y) {
|
|
49
|
+
disarm();
|
|
50
|
+
target = y; applied = false;
|
|
51
|
+
if (!(y > 0)) return;
|
|
52
|
+
armed = true;
|
|
53
|
+
raf = requestAnimationFrame(tick);
|
|
54
|
+
var start = function () { if (armed && !deadline) deadline = setTimeout(expire, TAIL_MS); };
|
|
55
|
+
if (D.readyState === 'complete') start(); else W.addEventListener('load', start, { once: true });
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
var report = function (y) { if (save) { try { save(y); } catch (e) {} } };
|
|
59
|
+
var flush = function () {
|
|
60
|
+
if (timer) { clearTimeout(timer); timer = 0; }
|
|
61
|
+
if (pending !== undefined) { var y = pending; pending = undefined; report(y); }
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
W.addEventListener('scroll', function () {
|
|
65
|
+
var y = W.scrollY;
|
|
66
|
+
pending = y;
|
|
67
|
+
if (!timer) timer = setTimeout(flush, THROTTLE_MS);
|
|
68
|
+
if (!armed || Math.abs(y - lastWritten) <= TOL) return;
|
|
69
|
+
if (y < target && Math.abs(y - maxY()) <= TOL) return;
|
|
70
|
+
disarm();
|
|
71
|
+
}, { passive: true });
|
|
72
|
+
W.addEventListener('wheel', disarm, { capture: true, passive: true });
|
|
73
|
+
W.addEventListener('touchstart', disarm, { capture: true, passive: true });
|
|
74
|
+
W.addEventListener('keydown', function (e) { if (SCROLL_KEYS[e.key]) disarm(); }, { capture: true });
|
|
75
|
+
|
|
76
|
+
W.__tbScroll = {
|
|
77
|
+
init: function (o) {
|
|
78
|
+
save = o && typeof o.save === 'function' ? o.save : null;
|
|
79
|
+
arm(o ? Number(o.initialY) : 0);
|
|
80
|
+
},
|
|
81
|
+
restore: function (y) {
|
|
82
|
+
y = Number(y);
|
|
83
|
+
if (y > 0 && isFinite(y)) arm(y); else { disarm(); write(0); }
|
|
84
|
+
},
|
|
85
|
+
top: function () { disarm(); write(0); report(0); },
|
|
86
|
+
flush: flush
|
|
87
|
+
};
|
|
88
|
+
})();`;
|
|
89
|
+
//# sourceMappingURL=scrollRestore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scrollRestore.js","sourceRoot":"","sources":["../../format/src/scrollRestore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAoE7B,CAAA"}
|