@isoloop/runtime 0.1.0-next.7 → 0.1.0-next.9

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/bootstrap.js CHANGED
@@ -1354,12 +1354,12 @@ function createKeepAwake(now = () => performance.now()) {
1354
1354
  };
1355
1355
  }
1356
1356
  var init_keep_awake = __esmMin((() => {}));
1357
- // ../dom/dist/records-wVZrPpqr.js
1357
+ // ../dom/dist/records-qo23ZEsQ.js
1358
1358
  var ISOLOOP_DOM_FMT;
1359
- var init_records_wVZrPpqr = __esmMin((() => {
1359
+ var init_records_qo23ZEsQ = __esmMin((() => {
1360
1360
  ISOLOOP_DOM_FMT = "isoloop-dom@1";
1361
1361
  }));
1362
- // ../dom/dist/dom-yLsf0Z4e.js
1362
+ // ../dom/dist/dom-N7iz67ez.js
1363
1363
  function createStyle(el) {
1364
1364
  const decls = /* @__PURE__ */ new Map();
1365
1365
  const write = () => {
@@ -1462,6 +1462,21 @@ function defineHandlers(proto) {
1462
1462
  }
1463
1463
  });
1464
1464
  }
1465
+ function defineLayoutStubs(proto) {
1466
+ for (const [name, instead] of Object.entries(LAYOUT_METHODS)) Object.defineProperty(proto, name, {
1467
+ configurable: true,
1468
+ writable: true,
1469
+ value() {
1470
+ throw layoutError(`${name}()`, instead);
1471
+ }
1472
+ });
1473
+ for (const [name, instead] of Object.entries(LAYOUT_PROPERTIES)) Object.defineProperty(proto, name, {
1474
+ configurable: true,
1475
+ get() {
1476
+ throw layoutError(name, instead);
1477
+ }
1478
+ });
1479
+ }
1465
1480
  /** The subtree as `insert` sends it. */
1466
1481
  function serialize(n) {
1467
1482
  if (n instanceof WText) return {
@@ -1558,6 +1573,7 @@ function recorder(root, onBatch, schedule) {
1558
1573
  }
1559
1574
  };
1560
1575
  }
1576
+ /** @internal */
1561
1577
  function createDom(opts) {
1562
1578
  const schedule = opts.schedule ?? ((fn) => queueMicrotask(fn));
1563
1579
  const core = {
@@ -1635,8 +1651,8 @@ function toEvent(e) {
1635
1651
  });
1636
1652
  return ev;
1637
1653
  }
1638
- var HTML_NS, SVG_NS, str, domError, emit, WEventTarget, WNode, WCharacterData, WText, WComment, kebab, WDOMTokenList, dataAttr, dataKey, WParentNode, WDocumentFragment, WElement, HANDLER_EVENTS, WHTMLElement, WSVGElement, WHTMLIFrameElement, WHTMLInputElement, WHTMLTextAreaElement, WHTMLSelectElement, WHTMLOptionElement, HTML_CLASSES, WDocument, isControl;
1639
- var init_dom_yLsf0Z4e = __esmMin((() => {
1654
+ var HTML_NS, SVG_NS, str, domError, emit, WEventTarget, WNode, WCharacterData, WText, WComment, kebab, WDOMTokenList, dataAttr, dataKey, WParentNode, WDocumentFragment, WElement, HANDLER_EVENTS, MEASURE, ANIMATE, LAYOUT_METHODS, LAYOUT_PROPERTIES, layoutError, WHTMLElement, WSVGElement, WHTMLIFrameElement, WHTMLInputElement, WHTMLTextAreaElement, WHTMLSelectElement, WHTMLOptionElement, HTML_CLASSES, WDocument, isControl;
1655
+ var init_dom_N7iz67ez = __esmMin((() => {
1640
1656
  HTML_NS = "http://www.w3.org/1999/xhtml";
1641
1657
  SVG_NS = "http://www.w3.org/2000/svg";
1642
1658
  str = (v) => typeof v === "string" ? v : typeof v === "number" || typeof v === "boolean" || typeof v === "bigint" ? String(v) : "";
@@ -2243,6 +2259,29 @@ var init_dom_yLsf0Z4e = __esmMin((() => {
2243
2259
  "wheel"
2244
2260
  ];
2245
2261
  defineHandlers(WElement.prototype);
2262
+ MEASURE = "ask the host with `ctx.host.measure(node)` (`useHost().measure` in React and Preact)";
2263
+ ANIMATE = "animate with CSS transitions or animations, set through classes or `style`";
2264
+ LAYOUT_METHODS = {
2265
+ getBoundingClientRect: MEASURE,
2266
+ getClientRects: MEASURE,
2267
+ animate: ANIMATE,
2268
+ getAnimations: ANIMATE
2269
+ };
2270
+ LAYOUT_PROPERTIES = {
2271
+ offsetWidth: MEASURE,
2272
+ offsetHeight: MEASURE,
2273
+ offsetTop: MEASURE,
2274
+ offsetLeft: MEASURE,
2275
+ offsetParent: MEASURE,
2276
+ clientWidth: MEASURE,
2277
+ clientHeight: MEASURE,
2278
+ clientTop: MEASURE,
2279
+ clientLeft: MEASURE,
2280
+ scrollWidth: MEASURE,
2281
+ scrollHeight: MEASURE
2282
+ };
2283
+ layoutError = (name, instead) => domError("NotSupportedError", `${name} needs layout, which an isolate doesn't have; ${instead}`);
2284
+ defineLayoutStubs(WElement.prototype);
2246
2285
  WHTMLElement = class extends WElement {};
2247
2286
  WSVGElement = class extends WElement {};
2248
2287
  WHTMLIFrameElement = class extends WHTMLElement {};
@@ -2474,11 +2513,13 @@ var init_dom_yLsf0Z4e = __esmMin((() => {
2474
2513
  defineHandlers(WDocument.prototype);
2475
2514
  isControl = (node) => node instanceof WHTMLInputElement || node instanceof WHTMLTextAreaElement || node instanceof WHTMLSelectElement;
2476
2515
  }));
2477
- // ../dom/dist/install-D7m7By8i.js
2516
+ // ../dom/dist/install-B_iVdCC4.js
2478
2517
  /**
2479
2518
  * Exposes `dom` as the worker's `document`, `window` and DOM classes, so
2480
2519
  * frameworks find them where they look. Only for isolates with a surface; a
2481
2520
  * headless isolate never calls this.
2521
+ *
2522
+ * @internal
2482
2523
  */
2483
2524
  function install(dom, scope) {
2484
2525
  const define = (name, value) => {
@@ -2491,11 +2532,14 @@ function install(dom, scope) {
2491
2532
  define("document", dom.document);
2492
2533
  if (!("window" in scope)) define("window", scope);
2493
2534
  for (const [name, value] of Object.entries(DOM_GLOBALS)) define(name, value);
2535
+ if (!("getComputedStyle" in scope)) define("getComputedStyle", () => {
2536
+ throw layoutError("getComputedStyle()", "read the styles the isolate set (`el.style`), or ask the host for sizes with `ctx.host.measure(node)`");
2537
+ });
2494
2538
  dom.document.defaultView = scope;
2495
2539
  }
2496
2540
  var DOM_GLOBALS;
2497
- var init_install_D7m7By8i = __esmMin((() => {
2498
- init_dom_yLsf0Z4e();
2541
+ var init_install_B_iVdCC4 = __esmMin((() => {
2542
+ init_dom_N7iz67ez();
2499
2543
  DOM_GLOBALS = {
2500
2544
  Node: WNode,
2501
2545
  Element: WElement,
@@ -2514,9 +2558,9 @@ var init_install_D7m7By8i = __esmMin((() => {
2514
2558
  }));
2515
2559
  // ../dom/dist/worker.js
2516
2560
  var init_worker = __esmMin((() => {
2517
- init_records_wVZrPpqr();
2518
- init_dom_yLsf0Z4e();
2519
- init_install_D7m7By8i();
2561
+ init_records_qo23ZEsQ();
2562
+ init_dom_N7iz67ez();
2563
+ init_install_B_iVdCC4();
2520
2564
  }));
2521
2565
  // src/render/index.ts
2522
2566
  function sharedDom(scope) {
@@ -2652,7 +2696,7 @@ var init_render = __esmMin((() => {
2652
2696
  headListeners = /* @__PURE__ */ new Set();
2653
2697
  }));
2654
2698
  // package.json
2655
- var version = "0.1.0-next.7";
2699
+ var version = "0.1.0-next.9";
2656
2700
  // src/vanilla.ts
2657
2701
  var vanilla_exports = /* @__PURE__ */ __exportAll({
2658
2702
  REQUIRES: () => REQUIRES,
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import { a as defineIsolate, c as ScrollIntoViewOptionsLike, d as IsolateInspector, i as REQUIRES, l as BusClient, n as IsolateDefinition, o as HostApi, r as IsolateRoot, s as HostCallError, t as IsolateContext, u as SubscribeOptions } from "./vanilla-BB6MHSfu.js";
1
+ import { a as defineIsolate, c as ScrollIntoViewOptionsLike, d as SubscribeOptions, f as IsolateInspector, i as REQUIRES, l as BusClient, n as IsolateDefinition, o as HostApi, r as IsolateRoot, s as HostCallError, t as IsolateContext, u as RequestOptions } from "./vanilla-DVmrnAWd.js";
2
2
  import { BusError } from "@isoloop/protocol";
3
- export { type BusClient, BusError, type HostApi, HostCallError, type IsolateContext, type IsolateDefinition, type IsolateInspector, type IsolateRoot, REQUIRES, type ScrollIntoViewOptionsLike, type SubscribeOptions, defineIsolate };
3
+ export { type BusClient, BusError, type HostApi, HostCallError, type IsolateContext, type IsolateDefinition, type IsolateInspector, type IsolateRoot, REQUIRES, type RequestOptions, type ScrollIntoViewOptionsLike, type SubscribeOptions, defineIsolate };
package/dist/index.js CHANGED
@@ -11,8 +11,12 @@ var HostCallError = class extends Error {
11
11
  }
12
12
  };
13
13
  // src/vanilla.ts
14
- /** This build's stamp: `major.minor` of the package version, inlined when tsdown bundles it. */
15
- const REQUIRES = majorMinor("0.1.0-next.7") ?? "0.0";
14
+ /**
15
+ * This build's stamp: `major.minor` of the package version, inlined when tsdown bundles it.
16
+ *
17
+ * @internal
18
+ */
19
+ const REQUIRES = majorMinor("0.1.0-next.9") ?? "0.0";
16
20
  /**
17
21
  * Types an isolate module's default export and stamps it with the version
18
22
  * it was built against. `Root` defaults to the structural `IsolateRoot`.
package/dist/testing.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { o as HostApi, t as IsolateContext } from "./vanilla-BB6MHSfu.js";
1
+ import { o as HostApi, t as IsolateContext } from "./vanilla-DVmrnAWd.js";
2
2
  import { ShutdownReason } from "@isoloop/protocol";
3
3
  export type TestContextOptions = {
4
4
  id?: string;
@@ -38,7 +38,7 @@ type IsolateInspector = {
38
38
  */
39
39
  restart(id: string): Promise<void>;
40
40
  /**
41
- * Ends an isolate's worker as a crash (`worker-error`), so the supervisor
41
+ * Ends an isolate's worker as a crash (`worker_error`), so the supervisor
42
42
  * restarts it. For a pooled isolate that ends the pool's worker: every
43
43
  * member crashes and restarts, and the feed shows each one. Resolves once
44
44
  * the kill is sent, not when the isolate is back.
@@ -47,6 +47,13 @@ type IsolateInspector = {
47
47
  /** Busy-loops an isolate's worker for `ms`, at most 10 s. */
48
48
  block(id: string, ms: number): Promise<void>;
49
49
  };
50
+ /** `request`'s options. @experimental */
51
+ type RequestOptions = {
52
+ /** The request record's key. */
53
+ key?: string;
54
+ /** Default 30 s: the call rejects with `BusError('timeout')` after it. */
55
+ timeoutMs?: number;
56
+ };
50
57
  type SubscribeOptions = {
51
58
  /**
52
59
  * Default `latest`. With `group`, it applies only while the group has no
@@ -55,9 +62,9 @@ type SubscribeOptions = {
55
62
  * group is (ADR 0016, point 14).
56
63
  */
57
64
  from?: StartPosition;
58
- /** Share the topic with other subscribers of the same group: each record goes to one of them. */
65
+ /** Share the topic with other subscribers of the same group: each record goes to one of them. @experimental */
59
66
  group?: string;
60
- /** Default true: commit each record once its handler settles. */
67
+ /** Default true: commit each record once its handler settles. @experimental */
61
68
  autoCommit?: boolean;
62
69
  /**
63
70
  * A bus restart lost this memory topic (ADR 0007). Clear what was built
@@ -86,16 +93,18 @@ interface BusClient {
86
93
  * `timeoutMs` (default 30 s), or with `dropped` at once when the topic's
87
94
  * retention removed the request before the bus delivered it to any
88
95
  * subscriber.
96
+ * @experimental
97
+ */
98
+ request<In, ROut>(topic: TopicRef<In, any, any, ROut>, value: In, opts?: RequestOptions): Promise<ROut>;
99
+ /**
100
+ * Answers a request record delivered to this isolate; the broker checks `value` against the topic's `reply` schema.
101
+ * @experimental
89
102
  */
90
- request<In, ROut>(topic: TopicRef<In, any, any, ROut>, value: In, opts?: {
91
- key?: string;
92
- timeoutMs?: number;
93
- }): Promise<ROut>;
94
- /** Answers a request record delivered to this isolate; the broker checks `value` against the topic's `reply` schema. */
95
103
  reply(record: TypedRecord<unknown>, value: unknown): Promise<void>;
96
104
  /**
97
105
  * Commits a record by hand, for `autoCommit: false`: that record and every
98
106
  * one delivered before it on its subscription count as settled.
107
+ * @experimental
99
108
  */
100
109
  commit(record: TypedRecord<unknown>): void;
101
110
  }
@@ -210,11 +219,15 @@ type IsolateDefinition<Root = IsolateRoot> = {
210
219
  */
211
220
  requires?: string;
212
221
  };
213
- /** This build's stamp: `major.minor` of the package version, inlined when tsdown bundles it. */
222
+ /**
223
+ * This build's stamp: `major.minor` of the package version, inlined when tsdown bundles it.
224
+ *
225
+ * @internal
226
+ */
214
227
  declare const REQUIRES: string;
215
228
  /**
216
229
  * Types an isolate module's default export and stamps it with the version
217
230
  * it was built against. `Root` defaults to the structural `IsolateRoot`.
218
231
  */
219
232
  declare function defineIsolate<Root = IsolateRoot>(def: IsolateDefinition<Root>): IsolateDefinition<Root>;
220
- export { defineIsolate as a, ScrollIntoViewOptionsLike as c, IsolateInspector as d, REQUIRES as i, BusClient as l, IsolateDefinition as n, HostApi as o, IsolateRoot as r, HostCallError as s, IsolateContext as t, SubscribeOptions as u };
233
+ export { defineIsolate as a, ScrollIntoViewOptionsLike as c, SubscribeOptions as d, IsolateInspector as f, REQUIRES as i, BusClient as l, IsolateDefinition as n, HostApi as o, IsolateRoot as r, HostCallError as s, IsolateContext as t, RequestOptions as u };
package/dist/worker.js CHANGED
@@ -1336,12 +1336,12 @@ function createKeepAwake(now = () => performance.now()) {
1336
1336
  };
1337
1337
  }
1338
1338
  var init_keep_awake = __esmMin((() => {}));
1339
- // ../dom/dist/records-wVZrPpqr.js
1339
+ // ../dom/dist/records-qo23ZEsQ.js
1340
1340
  var ISOLOOP_DOM_FMT;
1341
- var init_records_wVZrPpqr = __esmMin((() => {
1341
+ var init_records_qo23ZEsQ = __esmMin((() => {
1342
1342
  ISOLOOP_DOM_FMT = "isoloop-dom@1";
1343
1343
  }));
1344
- // ../dom/dist/dom-yLsf0Z4e.js
1344
+ // ../dom/dist/dom-N7iz67ez.js
1345
1345
  function createStyle(el) {
1346
1346
  const decls = /* @__PURE__ */ new Map();
1347
1347
  const write = () => {
@@ -1444,6 +1444,21 @@ function defineHandlers(proto) {
1444
1444
  }
1445
1445
  });
1446
1446
  }
1447
+ function defineLayoutStubs(proto) {
1448
+ for (const [name, instead] of Object.entries(LAYOUT_METHODS)) Object.defineProperty(proto, name, {
1449
+ configurable: true,
1450
+ writable: true,
1451
+ value() {
1452
+ throw layoutError(`${name}()`, instead);
1453
+ }
1454
+ });
1455
+ for (const [name, instead] of Object.entries(LAYOUT_PROPERTIES)) Object.defineProperty(proto, name, {
1456
+ configurable: true,
1457
+ get() {
1458
+ throw layoutError(name, instead);
1459
+ }
1460
+ });
1461
+ }
1447
1462
  /** The subtree as `insert` sends it. */
1448
1463
  function serialize(n) {
1449
1464
  if (n instanceof WText) return {
@@ -1540,6 +1555,7 @@ function recorder(root, onBatch, schedule) {
1540
1555
  }
1541
1556
  };
1542
1557
  }
1558
+ /** @internal */
1543
1559
  function createDom(opts) {
1544
1560
  const schedule = opts.schedule ?? ((fn) => queueMicrotask(fn));
1545
1561
  const core = {
@@ -1617,8 +1633,8 @@ function toEvent(e) {
1617
1633
  });
1618
1634
  return ev;
1619
1635
  }
1620
- var HTML_NS, SVG_NS, str, domError, emit, WEventTarget, WNode, WCharacterData, WText, WComment, kebab, WDOMTokenList, dataAttr, dataKey, WParentNode, WDocumentFragment, WElement, HANDLER_EVENTS, WHTMLElement, WSVGElement, WHTMLIFrameElement, WHTMLInputElement, WHTMLTextAreaElement, WHTMLSelectElement, WHTMLOptionElement, HTML_CLASSES, WDocument, isControl;
1621
- var init_dom_yLsf0Z4e = __esmMin((() => {
1636
+ var HTML_NS, SVG_NS, str, domError, emit, WEventTarget, WNode, WCharacterData, WText, WComment, kebab, WDOMTokenList, dataAttr, dataKey, WParentNode, WDocumentFragment, WElement, HANDLER_EVENTS, MEASURE, ANIMATE, LAYOUT_METHODS, LAYOUT_PROPERTIES, layoutError, WHTMLElement, WSVGElement, WHTMLIFrameElement, WHTMLInputElement, WHTMLTextAreaElement, WHTMLSelectElement, WHTMLOptionElement, HTML_CLASSES, WDocument, isControl;
1637
+ var init_dom_N7iz67ez = __esmMin((() => {
1622
1638
  HTML_NS = "http://www.w3.org/1999/xhtml";
1623
1639
  SVG_NS = "http://www.w3.org/2000/svg";
1624
1640
  str = (v) => typeof v === "string" ? v : typeof v === "number" || typeof v === "boolean" || typeof v === "bigint" ? String(v) : "";
@@ -2225,6 +2241,29 @@ var init_dom_yLsf0Z4e = __esmMin((() => {
2225
2241
  "wheel"
2226
2242
  ];
2227
2243
  defineHandlers(WElement.prototype);
2244
+ MEASURE = "ask the host with `ctx.host.measure(node)` (`useHost().measure` in React and Preact)";
2245
+ ANIMATE = "animate with CSS transitions or animations, set through classes or `style`";
2246
+ LAYOUT_METHODS = {
2247
+ getBoundingClientRect: MEASURE,
2248
+ getClientRects: MEASURE,
2249
+ animate: ANIMATE,
2250
+ getAnimations: ANIMATE
2251
+ };
2252
+ LAYOUT_PROPERTIES = {
2253
+ offsetWidth: MEASURE,
2254
+ offsetHeight: MEASURE,
2255
+ offsetTop: MEASURE,
2256
+ offsetLeft: MEASURE,
2257
+ offsetParent: MEASURE,
2258
+ clientWidth: MEASURE,
2259
+ clientHeight: MEASURE,
2260
+ clientTop: MEASURE,
2261
+ clientLeft: MEASURE,
2262
+ scrollWidth: MEASURE,
2263
+ scrollHeight: MEASURE
2264
+ };
2265
+ layoutError = (name, instead) => domError("NotSupportedError", `${name} needs layout, which an isolate doesn't have; ${instead}`);
2266
+ defineLayoutStubs(WElement.prototype);
2228
2267
  WHTMLElement = class extends WElement {};
2229
2268
  WSVGElement = class extends WElement {};
2230
2269
  WHTMLIFrameElement = class extends WHTMLElement {};
@@ -2456,11 +2495,13 @@ var init_dom_yLsf0Z4e = __esmMin((() => {
2456
2495
  defineHandlers(WDocument.prototype);
2457
2496
  isControl = (node) => node instanceof WHTMLInputElement || node instanceof WHTMLTextAreaElement || node instanceof WHTMLSelectElement;
2458
2497
  }));
2459
- // ../dom/dist/install-D7m7By8i.js
2498
+ // ../dom/dist/install-B_iVdCC4.js
2460
2499
  /**
2461
2500
  * Exposes `dom` as the worker's `document`, `window` and DOM classes, so
2462
2501
  * frameworks find them where they look. Only for isolates with a surface; a
2463
2502
  * headless isolate never calls this.
2503
+ *
2504
+ * @internal
2464
2505
  */
2465
2506
  function install(dom, scope) {
2466
2507
  const define = (name, value) => {
@@ -2473,11 +2514,14 @@ function install(dom, scope) {
2473
2514
  define("document", dom.document);
2474
2515
  if (!("window" in scope)) define("window", scope);
2475
2516
  for (const [name, value] of Object.entries(DOM_GLOBALS)) define(name, value);
2517
+ if (!("getComputedStyle" in scope)) define("getComputedStyle", () => {
2518
+ throw layoutError("getComputedStyle()", "read the styles the isolate set (`el.style`), or ask the host for sizes with `ctx.host.measure(node)`");
2519
+ });
2476
2520
  dom.document.defaultView = scope;
2477
2521
  }
2478
2522
  var DOM_GLOBALS;
2479
- var init_install_D7m7By8i = __esmMin((() => {
2480
- init_dom_yLsf0Z4e();
2523
+ var init_install_B_iVdCC4 = __esmMin((() => {
2524
+ init_dom_N7iz67ez();
2481
2525
  DOM_GLOBALS = {
2482
2526
  Node: WNode,
2483
2527
  Element: WElement,
@@ -2496,9 +2540,9 @@ var init_install_D7m7By8i = __esmMin((() => {
2496
2540
  }));
2497
2541
  // ../dom/dist/worker.js
2498
2542
  var init_worker = __esmMin((() => {
2499
- init_records_wVZrPpqr();
2500
- init_dom_yLsf0Z4e();
2501
- init_install_D7m7By8i();
2543
+ init_records_qo23ZEsQ();
2544
+ init_dom_N7iz67ez();
2545
+ init_install_B_iVdCC4();
2502
2546
  }));
2503
2547
  // src/render/index.ts
2504
2548
  function sharedDom(scope) {
@@ -2635,7 +2679,7 @@ var init_render = __esmMin((() => {
2635
2679
  headListeners = /* @__PURE__ */ new Set();
2636
2680
  }));
2637
2681
  // package.json
2638
- var version = "0.1.0-next.7";
2682
+ var version = "0.1.0-next.9";
2639
2683
  // src/vanilla.ts
2640
2684
  var vanilla_exports = /* @__PURE__ */ __exportAll({
2641
2685
  REQUIRES: () => REQUIRES,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@isoloop/runtime",
3
- "version": "0.1.0-next.7",
3
+ "version": "0.1.0-next.9",
4
4
  "description": "Isolate-side runtime that runs inside each worker.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -35,8 +35,8 @@
35
35
  }
36
36
  },
37
37
  "dependencies": {
38
- "@isoloop/dom": "0.1.0-next.7",
39
- "@isoloop/protocol": "0.1.0-next.7"
38
+ "@isoloop/dom": "0.1.0-next.9",
39
+ "@isoloop/protocol": "0.1.0-next.9"
40
40
  },
41
41
  "devDependencies": {
42
42
  "typescript": "7.0.2"