@isoloop/runtime 0.1.0-next.7 → 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
@@ -1359,7 +1359,7 @@ var ISOLOOP_DOM_FMT;
1359
1359
  var init_records_wVZrPpqr = __esmMin((() => {
1360
1360
  ISOLOOP_DOM_FMT = "isoloop-dom@1";
1361
1361
  }));
1362
- // ../dom/dist/dom-yLsf0Z4e.js
1362
+ // ../dom/dist/dom-BHxfO_GX.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 {
@@ -1635,8 +1650,8 @@ function toEvent(e) {
1635
1650
  });
1636
1651
  return ev;
1637
1652
  }
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((() => {
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((() => {
1640
1655
  HTML_NS = "http://www.w3.org/1999/xhtml";
1641
1656
  SVG_NS = "http://www.w3.org/2000/svg";
1642
1657
  str = (v) => typeof v === "string" ? v : typeof v === "number" || typeof v === "boolean" || typeof v === "bigint" ? String(v) : "";
@@ -2243,6 +2258,29 @@ var init_dom_yLsf0Z4e = __esmMin((() => {
2243
2258
  "wheel"
2244
2259
  ];
2245
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);
2246
2284
  WHTMLElement = class extends WElement {};
2247
2285
  WSVGElement = class extends WElement {};
2248
2286
  WHTMLIFrameElement = class extends WHTMLElement {};
@@ -2474,7 +2512,7 @@ var init_dom_yLsf0Z4e = __esmMin((() => {
2474
2512
  defineHandlers(WDocument.prototype);
2475
2513
  isControl = (node) => node instanceof WHTMLInputElement || node instanceof WHTMLTextAreaElement || node instanceof WHTMLSelectElement;
2476
2514
  }));
2477
- // ../dom/dist/install-D7m7By8i.js
2515
+ // ../dom/dist/install-MjRUtHp6.js
2478
2516
  /**
2479
2517
  * Exposes `dom` as the worker's `document`, `window` and DOM classes, so
2480
2518
  * frameworks find them where they look. Only for isolates with a surface; a
@@ -2491,11 +2529,14 @@ function install(dom, scope) {
2491
2529
  define("document", dom.document);
2492
2530
  if (!("window" in scope)) define("window", scope);
2493
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
+ });
2494
2535
  dom.document.defaultView = scope;
2495
2536
  }
2496
2537
  var DOM_GLOBALS;
2497
- var init_install_D7m7By8i = __esmMin((() => {
2498
- init_dom_yLsf0Z4e();
2538
+ var init_install_MjRUtHp6 = __esmMin((() => {
2539
+ init_dom_BHxfO_GX();
2499
2540
  DOM_GLOBALS = {
2500
2541
  Node: WNode,
2501
2542
  Element: WElement,
@@ -2515,8 +2556,8 @@ var init_install_D7m7By8i = __esmMin((() => {
2515
2556
  // ../dom/dist/worker.js
2516
2557
  var init_worker = __esmMin((() => {
2517
2558
  init_records_wVZrPpqr();
2518
- init_dom_yLsf0Z4e();
2519
- init_install_D7m7By8i();
2559
+ init_dom_BHxfO_GX();
2560
+ init_install_MjRUtHp6();
2520
2561
  }));
2521
2562
  // src/render/index.ts
2522
2563
  function sharedDom(scope) {
@@ -2652,7 +2693,7 @@ var init_render = __esmMin((() => {
2652
2693
  headListeners = /* @__PURE__ */ new Set();
2653
2694
  }));
2654
2695
  // package.json
2655
- var version = "0.1.0-next.7";
2696
+ var version = "0.1.0-next.8";
2656
2697
  // src/vanilla.ts
2657
2698
  var vanilla_exports = /* @__PURE__ */ __exportAll({
2658
2699
  REQUIRES: () => REQUIRES,
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.7") ?? "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/worker.js CHANGED
@@ -1341,7 +1341,7 @@ var ISOLOOP_DOM_FMT;
1341
1341
  var init_records_wVZrPpqr = __esmMin((() => {
1342
1342
  ISOLOOP_DOM_FMT = "isoloop-dom@1";
1343
1343
  }));
1344
- // ../dom/dist/dom-yLsf0Z4e.js
1344
+ // ../dom/dist/dom-BHxfO_GX.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 {
@@ -1617,8 +1632,8 @@ function toEvent(e) {
1617
1632
  });
1618
1633
  return ev;
1619
1634
  }
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((() => {
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((() => {
1622
1637
  HTML_NS = "http://www.w3.org/1999/xhtml";
1623
1638
  SVG_NS = "http://www.w3.org/2000/svg";
1624
1639
  str = (v) => typeof v === "string" ? v : typeof v === "number" || typeof v === "boolean" || typeof v === "bigint" ? String(v) : "";
@@ -2225,6 +2240,29 @@ var init_dom_yLsf0Z4e = __esmMin((() => {
2225
2240
  "wheel"
2226
2241
  ];
2227
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);
2228
2266
  WHTMLElement = class extends WElement {};
2229
2267
  WSVGElement = class extends WElement {};
2230
2268
  WHTMLIFrameElement = class extends WHTMLElement {};
@@ -2456,7 +2494,7 @@ var init_dom_yLsf0Z4e = __esmMin((() => {
2456
2494
  defineHandlers(WDocument.prototype);
2457
2495
  isControl = (node) => node instanceof WHTMLInputElement || node instanceof WHTMLTextAreaElement || node instanceof WHTMLSelectElement;
2458
2496
  }));
2459
- // ../dom/dist/install-D7m7By8i.js
2497
+ // ../dom/dist/install-MjRUtHp6.js
2460
2498
  /**
2461
2499
  * Exposes `dom` as the worker's `document`, `window` and DOM classes, so
2462
2500
  * frameworks find them where they look. Only for isolates with a surface; a
@@ -2473,11 +2511,14 @@ function install(dom, scope) {
2473
2511
  define("document", dom.document);
2474
2512
  if (!("window" in scope)) define("window", scope);
2475
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
+ });
2476
2517
  dom.document.defaultView = scope;
2477
2518
  }
2478
2519
  var DOM_GLOBALS;
2479
- var init_install_D7m7By8i = __esmMin((() => {
2480
- init_dom_yLsf0Z4e();
2520
+ var init_install_MjRUtHp6 = __esmMin((() => {
2521
+ init_dom_BHxfO_GX();
2481
2522
  DOM_GLOBALS = {
2482
2523
  Node: WNode,
2483
2524
  Element: WElement,
@@ -2497,8 +2538,8 @@ var init_install_D7m7By8i = __esmMin((() => {
2497
2538
  // ../dom/dist/worker.js
2498
2539
  var init_worker = __esmMin((() => {
2499
2540
  init_records_wVZrPpqr();
2500
- init_dom_yLsf0Z4e();
2501
- init_install_D7m7By8i();
2541
+ init_dom_BHxfO_GX();
2542
+ init_install_MjRUtHp6();
2502
2543
  }));
2503
2544
  // src/render/index.ts
2504
2545
  function sharedDom(scope) {
@@ -2635,7 +2676,7 @@ var init_render = __esmMin((() => {
2635
2676
  headListeners = /* @__PURE__ */ new Set();
2636
2677
  }));
2637
2678
  // package.json
2638
- var version = "0.1.0-next.7";
2679
+ var version = "0.1.0-next.8";
2639
2680
  // src/vanilla.ts
2640
2681
  var vanilla_exports = /* @__PURE__ */ __exportAll({
2641
2682
  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.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.7",
39
- "@isoloop/protocol": "0.1.0-next.7"
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"