@isoloop/runtime 0.1.0-next.6 → 0.1.0-next.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/dist/bootstrap.js CHANGED
@@ -199,6 +199,7 @@ var init_dist = __esmMin((() => {
199
199
  "reply_invalid",
200
200
  "aborted",
201
201
  "no_responder",
202
+ "dropped",
202
203
  "contracts_failed",
203
204
  "contracts_invalid",
204
205
  "contracts_mismatch",
@@ -1358,7 +1359,7 @@ var ISOLOOP_DOM_FMT;
1358
1359
  var init_records_wVZrPpqr = __esmMin((() => {
1359
1360
  ISOLOOP_DOM_FMT = "isoloop-dom@1";
1360
1361
  }));
1361
- // ../dom/dist/dom-yLsf0Z4e.js
1362
+ // ../dom/dist/dom-BHxfO_GX.js
1362
1363
  function createStyle(el) {
1363
1364
  const decls = /* @__PURE__ */ new Map();
1364
1365
  const write = () => {
@@ -1461,6 +1462,21 @@ function defineHandlers(proto) {
1461
1462
  }
1462
1463
  });
1463
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
+ }
1464
1480
  /** The subtree as `insert` sends it. */
1465
1481
  function serialize(n) {
1466
1482
  if (n instanceof WText) return {
@@ -1634,8 +1650,8 @@ function toEvent(e) {
1634
1650
  });
1635
1651
  return ev;
1636
1652
  }
1637
- 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;
1638
- var init_dom_yLsf0Z4e = __esmMin((() => {
1653
+ 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;
1654
+ var init_dom_BHxfO_GX = __esmMin((() => {
1639
1655
  HTML_NS = "http://www.w3.org/1999/xhtml";
1640
1656
  SVG_NS = "http://www.w3.org/2000/svg";
1641
1657
  str = (v) => typeof v === "string" ? v : typeof v === "number" || typeof v === "boolean" || typeof v === "bigint" ? String(v) : "";
@@ -2242,6 +2258,29 @@ var init_dom_yLsf0Z4e = __esmMin((() => {
2242
2258
  "wheel"
2243
2259
  ];
2244
2260
  defineHandlers(WElement.prototype);
2261
+ MEASURE = "ask the host with `ctx.host.measure(node)` (`useHost().measure` in React and Preact)";
2262
+ ANIMATE = "animate with CSS transitions or animations, set through classes or `style`";
2263
+ LAYOUT_METHODS = {
2264
+ getBoundingClientRect: MEASURE,
2265
+ getClientRects: MEASURE,
2266
+ animate: ANIMATE,
2267
+ getAnimations: ANIMATE
2268
+ };
2269
+ LAYOUT_PROPERTIES = {
2270
+ offsetWidth: MEASURE,
2271
+ offsetHeight: MEASURE,
2272
+ offsetTop: MEASURE,
2273
+ offsetLeft: MEASURE,
2274
+ offsetParent: MEASURE,
2275
+ clientWidth: MEASURE,
2276
+ clientHeight: MEASURE,
2277
+ clientTop: MEASURE,
2278
+ clientLeft: MEASURE,
2279
+ scrollWidth: MEASURE,
2280
+ scrollHeight: MEASURE
2281
+ };
2282
+ layoutError = (name, instead) => domError("NotSupportedError", `${name} needs layout, which an isolate doesn't have; ${instead}`);
2283
+ defineLayoutStubs(WElement.prototype);
2245
2284
  WHTMLElement = class extends WElement {};
2246
2285
  WSVGElement = class extends WElement {};
2247
2286
  WHTMLIFrameElement = class extends WHTMLElement {};
@@ -2473,7 +2512,7 @@ var init_dom_yLsf0Z4e = __esmMin((() => {
2473
2512
  defineHandlers(WDocument.prototype);
2474
2513
  isControl = (node) => node instanceof WHTMLInputElement || node instanceof WHTMLTextAreaElement || node instanceof WHTMLSelectElement;
2475
2514
  }));
2476
- // ../dom/dist/install-D7m7By8i.js
2515
+ // ../dom/dist/install-MjRUtHp6.js
2477
2516
  /**
2478
2517
  * Exposes `dom` as the worker's `document`, `window` and DOM classes, so
2479
2518
  * frameworks find them where they look. Only for isolates with a surface; a
@@ -2490,11 +2529,14 @@ function install(dom, scope) {
2490
2529
  define("document", dom.document);
2491
2530
  if (!("window" in scope)) define("window", scope);
2492
2531
  for (const [name, value] of Object.entries(DOM_GLOBALS)) define(name, value);
2532
+ if (!("getComputedStyle" in scope)) define("getComputedStyle", () => {
2533
+ throw layoutError("getComputedStyle()", "read the styles the isolate set (`el.style`), or ask the host for sizes with `ctx.host.measure(node)`");
2534
+ });
2493
2535
  dom.document.defaultView = scope;
2494
2536
  }
2495
2537
  var DOM_GLOBALS;
2496
- var init_install_D7m7By8i = __esmMin((() => {
2497
- init_dom_yLsf0Z4e();
2538
+ var init_install_MjRUtHp6 = __esmMin((() => {
2539
+ init_dom_BHxfO_GX();
2498
2540
  DOM_GLOBALS = {
2499
2541
  Node: WNode,
2500
2542
  Element: WElement,
@@ -2514,8 +2556,8 @@ var init_install_D7m7By8i = __esmMin((() => {
2514
2556
  // ../dom/dist/worker.js
2515
2557
  var init_worker = __esmMin((() => {
2516
2558
  init_records_wVZrPpqr();
2517
- init_dom_yLsf0Z4e();
2518
- init_install_D7m7By8i();
2559
+ init_dom_BHxfO_GX();
2560
+ init_install_MjRUtHp6();
2519
2561
  }));
2520
2562
  // src/render/index.ts
2521
2563
  function sharedDom(scope) {
@@ -2651,7 +2693,7 @@ var init_render = __esmMin((() => {
2651
2693
  headListeners = /* @__PURE__ */ new Set();
2652
2694
  }));
2653
2695
  // package.json
2654
- var version = "0.1.0-next.6";
2696
+ var version = "0.1.0-next.8";
2655
2697
  // src/vanilla.ts
2656
2698
  var vanilla_exports = /* @__PURE__ */ __exportAll({
2657
2699
  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-BUilQ_Hz.js";
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";
2
2
  import { BusError } from "@isoloop/protocol";
3
3
  export { type BusClient, BusError, type HostApi, HostCallError, type IsolateContext, type IsolateDefinition, type IsolateInspector, type IsolateRoot, REQUIRES, type ScrollIntoViewOptionsLike, type SubscribeOptions, defineIsolate };
package/dist/index.js CHANGED
@@ -12,7 +12,7 @@ var HostCallError = class extends Error {
12
12
  };
13
13
  // src/vanilla.ts
14
14
  /** This build's stamp: `major.minor` of the package version, inlined when tsdown bundles it. */
15
- const REQUIRES = majorMinor("0.1.0-next.6") ?? "0.0";
15
+ const REQUIRES = majorMinor("0.1.0-next.8") ?? "0.0";
16
16
  /**
17
17
  * Types an isolate module's default export and stamps it with the version
18
18
  * 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-BUilQ_Hz.js";
1
+ import { o as HostApi, t as IsolateContext } from "./vanilla-BB6MHSfu.js";
2
2
  import { ShutdownReason } from "@isoloop/protocol";
3
3
  export type TestContextOptions = {
4
4
  id?: string;
@@ -81,7 +81,12 @@ interface BusClient {
81
81
  }): Promise<void>;
82
82
  /** Returns the unsubscribe function. */
83
83
  subscribe<Out>(topic: TopicRef<any, Out, any, any>, fn: (r: TypedRecord<Out>) => void | Promise<void>, opts?: SubscribeOptions): () => void;
84
- /** Topics with a `reply` schema only. Rejects with `timeout` after `timeoutMs` (default 30 s). */
84
+ /**
85
+ * Topics with a `reply` schema only. Rejects with `timeout` after
86
+ * `timeoutMs` (default 30 s), or with `dropped` at once when the topic's
87
+ * retention removed the request before the bus delivered it to any
88
+ * subscriber.
89
+ */
85
90
  request<In, ROut>(topic: TopicRef<In, any, any, ROut>, value: In, opts?: {
86
91
  key?: string;
87
92
  timeoutMs?: number;
package/dist/worker.js CHANGED
@@ -199,6 +199,7 @@ var init_dist = __esmMin((() => {
199
199
  "reply_invalid",
200
200
  "aborted",
201
201
  "no_responder",
202
+ "dropped",
202
203
  "contracts_failed",
203
204
  "contracts_invalid",
204
205
  "contracts_mismatch",
@@ -1340,7 +1341,7 @@ var ISOLOOP_DOM_FMT;
1340
1341
  var init_records_wVZrPpqr = __esmMin((() => {
1341
1342
  ISOLOOP_DOM_FMT = "isoloop-dom@1";
1342
1343
  }));
1343
- // ../dom/dist/dom-yLsf0Z4e.js
1344
+ // ../dom/dist/dom-BHxfO_GX.js
1344
1345
  function createStyle(el) {
1345
1346
  const decls = /* @__PURE__ */ new Map();
1346
1347
  const write = () => {
@@ -1443,6 +1444,21 @@ function defineHandlers(proto) {
1443
1444
  }
1444
1445
  });
1445
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
+ }
1446
1462
  /** The subtree as `insert` sends it. */
1447
1463
  function serialize(n) {
1448
1464
  if (n instanceof WText) return {
@@ -1616,8 +1632,8 @@ function toEvent(e) {
1616
1632
  });
1617
1633
  return ev;
1618
1634
  }
1619
- 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;
1620
- var init_dom_yLsf0Z4e = __esmMin((() => {
1635
+ 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;
1636
+ var init_dom_BHxfO_GX = __esmMin((() => {
1621
1637
  HTML_NS = "http://www.w3.org/1999/xhtml";
1622
1638
  SVG_NS = "http://www.w3.org/2000/svg";
1623
1639
  str = (v) => typeof v === "string" ? v : typeof v === "number" || typeof v === "boolean" || typeof v === "bigint" ? String(v) : "";
@@ -2224,6 +2240,29 @@ var init_dom_yLsf0Z4e = __esmMin((() => {
2224
2240
  "wheel"
2225
2241
  ];
2226
2242
  defineHandlers(WElement.prototype);
2243
+ MEASURE = "ask the host with `ctx.host.measure(node)` (`useHost().measure` in React and Preact)";
2244
+ ANIMATE = "animate with CSS transitions or animations, set through classes or `style`";
2245
+ LAYOUT_METHODS = {
2246
+ getBoundingClientRect: MEASURE,
2247
+ getClientRects: MEASURE,
2248
+ animate: ANIMATE,
2249
+ getAnimations: ANIMATE
2250
+ };
2251
+ LAYOUT_PROPERTIES = {
2252
+ offsetWidth: MEASURE,
2253
+ offsetHeight: MEASURE,
2254
+ offsetTop: MEASURE,
2255
+ offsetLeft: MEASURE,
2256
+ offsetParent: MEASURE,
2257
+ clientWidth: MEASURE,
2258
+ clientHeight: MEASURE,
2259
+ clientTop: MEASURE,
2260
+ clientLeft: MEASURE,
2261
+ scrollWidth: MEASURE,
2262
+ scrollHeight: MEASURE
2263
+ };
2264
+ layoutError = (name, instead) => domError("NotSupportedError", `${name} needs layout, which an isolate doesn't have; ${instead}`);
2265
+ defineLayoutStubs(WElement.prototype);
2227
2266
  WHTMLElement = class extends WElement {};
2228
2267
  WSVGElement = class extends WElement {};
2229
2268
  WHTMLIFrameElement = class extends WHTMLElement {};
@@ -2455,7 +2494,7 @@ var init_dom_yLsf0Z4e = __esmMin((() => {
2455
2494
  defineHandlers(WDocument.prototype);
2456
2495
  isControl = (node) => node instanceof WHTMLInputElement || node instanceof WHTMLTextAreaElement || node instanceof WHTMLSelectElement;
2457
2496
  }));
2458
- // ../dom/dist/install-D7m7By8i.js
2497
+ // ../dom/dist/install-MjRUtHp6.js
2459
2498
  /**
2460
2499
  * Exposes `dom` as the worker's `document`, `window` and DOM classes, so
2461
2500
  * frameworks find them where they look. Only for isolates with a surface; a
@@ -2472,11 +2511,14 @@ function install(dom, scope) {
2472
2511
  define("document", dom.document);
2473
2512
  if (!("window" in scope)) define("window", scope);
2474
2513
  for (const [name, value] of Object.entries(DOM_GLOBALS)) define(name, value);
2514
+ if (!("getComputedStyle" in scope)) define("getComputedStyle", () => {
2515
+ throw layoutError("getComputedStyle()", "read the styles the isolate set (`el.style`), or ask the host for sizes with `ctx.host.measure(node)`");
2516
+ });
2475
2517
  dom.document.defaultView = scope;
2476
2518
  }
2477
2519
  var DOM_GLOBALS;
2478
- var init_install_D7m7By8i = __esmMin((() => {
2479
- init_dom_yLsf0Z4e();
2520
+ var init_install_MjRUtHp6 = __esmMin((() => {
2521
+ init_dom_BHxfO_GX();
2480
2522
  DOM_GLOBALS = {
2481
2523
  Node: WNode,
2482
2524
  Element: WElement,
@@ -2496,8 +2538,8 @@ var init_install_D7m7By8i = __esmMin((() => {
2496
2538
  // ../dom/dist/worker.js
2497
2539
  var init_worker = __esmMin((() => {
2498
2540
  init_records_wVZrPpqr();
2499
- init_dom_yLsf0Z4e();
2500
- init_install_D7m7By8i();
2541
+ init_dom_BHxfO_GX();
2542
+ init_install_MjRUtHp6();
2501
2543
  }));
2502
2544
  // src/render/index.ts
2503
2545
  function sharedDom(scope) {
@@ -2634,7 +2676,7 @@ var init_render = __esmMin((() => {
2634
2676
  headListeners = /* @__PURE__ */ new Set();
2635
2677
  }));
2636
2678
  // package.json
2637
- var version = "0.1.0-next.6";
2679
+ var version = "0.1.0-next.8";
2638
2680
  // src/vanilla.ts
2639
2681
  var vanilla_exports = /* @__PURE__ */ __exportAll({
2640
2682
  REQUIRES: () => REQUIRES,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@isoloop/runtime",
3
- "version": "0.1.0-next.6",
3
+ "version": "0.1.0-next.8",
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.6",
39
- "@isoloop/protocol": "0.1.0-next.6"
38
+ "@isoloop/dom": "0.1.0-next.8",
39
+ "@isoloop/protocol": "0.1.0-next.8"
40
40
  },
41
41
  "devDependencies": {
42
42
  "typescript": "7.0.2"