@entro314labs/iso-engine 0.5.3 → 0.5.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.
Files changed (2) hide show
  1. package/dist/iso.global.js +45 -68
  2. package/package.json +49 -13
@@ -1,17 +1,16 @@
1
1
  var Iso = (function() {
2
- //#region \0rolldown/runtime.js
2
+ // \0rolldown/runtime.js
3
3
  var __defProp = Object.defineProperty;
4
- var __exportAll = (all, no_symbols) => {
5
- let target = {};
4
+ var __exportAll = (all, flags) => {
5
+ let target = Object.setPrototypeOf({}, null);
6
6
  for (var name in all) __defProp(target, name, {
7
7
  get: all[name],
8
8
  enumerable: true
9
9
  });
10
- if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
11
- return target;
10
+ if (!(flags & 1)) __defProp(target, Symbol.toStringTag, { value: "Module" });
11
+ return flags & 2 ? target : Object.preventExtensions(target);
12
12
  };
13
- //#endregion
14
- //#region src/engine/math.js
13
+ // src/engine/math.js
15
14
  var math_exports = /* @__PURE__ */ __exportAll({
16
15
  DEG: () => DEG,
17
16
  EPS: () => EPS,
@@ -255,7 +254,7 @@ var Iso = (function() {
255
254
  function rng(seed = 1) {
256
255
  let a = seed >>> 0;
257
256
  const next = () => {
258
- a = a + 1831565813 >>> 0;
257
+ a = a + 0x6d2b79f5 >>> 0;
259
258
  let t = a;
260
259
  t = Math.imul(t ^ t >>> 15, t | 1);
261
260
  t ^= t + Math.imul(t ^ t >>> 7, t | 61);
@@ -269,12 +268,12 @@ var Iso = (function() {
269
268
  }
270
269
  var box3 = {
271
270
  empty: () => [
272
- Infinity,
273
- Infinity,
274
- Infinity,
275
- -Infinity,
276
- -Infinity,
277
- -Infinity
271
+ 1e400,
272
+ 1e400,
273
+ 1e400,
274
+ -1e400,
275
+ -1e400,
276
+ -1e400
278
277
  ],
279
278
  addPt(b, x, y, z) {
280
279
  if (x < b[0]) b[0] = x;
@@ -305,8 +304,7 @@ var Iso = (function() {
305
304
  ],
306
305
  valid: (b) => b[0] <= b[3] && b[1] <= b[4] && b[2] <= b[5]
307
306
  };
308
- //#endregion
309
- //#region src/engine/draw.js
307
+ // src/engine/draw.js
310
308
  var IDENTITY = Object.freeze({
311
309
  x: 0,
312
310
  y: 0,
@@ -355,10 +353,10 @@ var Iso = (function() {
355
353
  this.frame = frame;
356
354
  this.ops = [];
357
355
  this.b = [
358
- Infinity,
359
- Infinity,
360
- -Infinity,
361
- -Infinity
356
+ 1e400,
357
+ 1e400,
358
+ -1e400,
359
+ -1e400
362
360
  ];
363
361
  }
364
362
  w(x, y, z = 0) {
@@ -475,8 +473,7 @@ var Iso = (function() {
475
473
  return s;
476
474
  }
477
475
  };
478
- //#endregion
479
- //#region src/engine/sort.js
476
+ // src/engine/sort.js
480
477
  var E = .001;
481
478
  function hexOf(b, zs) {
482
479
  return [
@@ -501,7 +498,7 @@ var Iso = (function() {
501
498
  if (ba && !ab) return 1;
502
499
  if (ab && ba) return a.order <= b.order ? -1 : 1;
503
500
  const A = a.box, B = b.box;
504
- let best = Infinity, res = 0;
501
+ let best = 1e400, res = 0;
505
502
  for (let k = 0; k < 3; k++) {
506
503
  const p1 = A[k + 3] - B[k], p2 = B[k + 3] - A[k];
507
504
  const p = Math.min(p1, p2);
@@ -644,8 +641,7 @@ var Iso = (function() {
644
641
  return lo;
645
642
  }
646
643
  };
647
- //#endregion
648
- //#region src/engine/node.js
644
+ // src/engine/node.js
649
645
  var UID = 0;
650
646
  var TRANSFORM_KEYS = [
651
647
  "x",
@@ -1006,10 +1002,10 @@ var Iso = (function() {
1006
1002
  this.sorted = ordered.map((it) => it.node);
1007
1003
  this.rest = this.aabb();
1008
1004
  const b = [
1009
- Infinity,
1010
- Infinity,
1011
- -Infinity,
1012
- -Infinity
1005
+ 1e400,
1006
+ 1e400,
1007
+ -1e400,
1008
+ -1e400
1013
1009
  ];
1014
1010
  for (const it of ordered) {
1015
1011
  const n = it.node, sb = n.sb;
@@ -1079,8 +1075,7 @@ var Iso = (function() {
1079
1075
  ]
1080
1076
  ].map((p) => view.P(p[0], p[1], p[2])).map((p) => fmt(p[0]) + " " + fmt(p[1])).join("L") + "Z\"/>";
1081
1077
  }
1082
- //#endregion
1083
- //#region src/engine/shapes.js
1078
+ // src/engine/shapes.js
1084
1079
  var Face = class Face {
1085
1080
  constructor(d, o, U, V, w, h) {
1086
1081
  this.d = d;
@@ -2589,8 +2584,7 @@ var Iso = (function() {
2589
2584
  if (this.opts.draw) this.opts.draw(d, this);
2590
2585
  }
2591
2586
  };
2592
- //#endregion
2593
- //#region src/engine/style.js
2587
+ // src/engine/style.js
2594
2588
  var THEMES = {
2595
2589
  dark: {
2596
2590
  bg: "#111214",
@@ -2746,8 +2740,7 @@ var Iso = (function() {
2746
2740
  doc.head.appendChild(el);
2747
2741
  injected = true;
2748
2742
  }
2749
- //#endregion
2750
- //#region src/engine/anim.js
2743
+ // src/engine/anim.js
2751
2744
  function bezier(x1, y1, x2, y2) {
2752
2745
  const cx = 3 * x1, bx = 3 * (x2 - x1) - cx, ax = 1 - cx - bx;
2753
2746
  const cy = 3 * y1, by = 3 * (y2 - y1) - cy, ay = 1 - cy - by;
@@ -2970,7 +2963,7 @@ var Iso = (function() {
2970
2963
  return this;
2971
2964
  }
2972
2965
  get total() {
2973
- return this.repeat < 0 ? Infinity : this.delay + this.duration * (this.repeat + 1) + this.repeatDelay * this.repeat;
2966
+ return this.repeat < 0 ? 1e400 : this.delay + this.duration * (this.repeat + 1) + this.repeatDelay * this.repeat;
2974
2967
  }
2975
2968
  local(time) {
2976
2969
  let t = time - this.start - this.delay;
@@ -3092,7 +3085,7 @@ var Iso = (function() {
3092
3085
  else if (o.from === "center") rank = rank.map((i) => Math.abs(i - (n - 1) / 2));
3093
3086
  else if (o.from === "random") {
3094
3087
  let s = o.seed || 7;
3095
- rank = rank.map(() => (s = s * 16807 % 2147483647) / 2147483647 * (n - 1));
3088
+ rank = rank.map(() => (s = s * 16807 % 0x7fffffff) / 0x7fffffff * (n - 1));
3096
3089
  } else if (o.from === "depth" || o.from === "front") {
3097
3090
  const key = (nd) => {
3098
3091
  const b = nd.sortBox ? nd.sortBox() : null;
@@ -3104,8 +3097,7 @@ var Iso = (function() {
3104
3097
  }
3105
3098
  return (i) => rank[i] * each;
3106
3099
  }
3107
- //#endregion
3108
- //#region src/engine/scene.js
3100
+ // src/engine/scene.js
3109
3101
  var clock = {
3110
3102
  scenes: /* @__PURE__ */ new Set(),
3111
3103
  manual: typeof window !== "undefined" && (!!window.__ISO_MANUAL__ || /[?&]iso-manual\b/.test(window.location ? window.location.search : "")),
@@ -3833,8 +3825,7 @@ var Iso = (function() {
3833
3825
  "\"": "&quot;"
3834
3826
  })[c]);
3835
3827
  }
3836
- //#endregion
3837
- //#region src/engine/paths.js
3828
+ // src/engine/paths.js
3838
3829
  var Path = class Path {
3839
3830
  constructor(points, closed = false) {
3840
3831
  this.points = points.map((p) => [
@@ -3968,8 +3959,7 @@ var Iso = (function() {
3968
3959
  return new Path(paths.flatMap((p, i) => i ? p.points.slice(1) : p.points));
3969
3960
  }
3970
3961
  };
3971
- //#endregion
3972
- //#region src/engine/figure.js
3962
+ // src/engine/figure.js
3973
3963
  function figure(host, o = {}) {
3974
3964
  injectCSS();
3975
3965
  host = typeof host === "string" ? document.querySelector(host) : host;
@@ -4014,8 +4004,7 @@ var Iso = (function() {
4014
4004
  }
4015
4005
  };
4016
4006
  }
4017
- //#endregion
4018
- //#region src/engine/prefabs/basics.js
4007
+ // src/engine/prefabs/basics.js
4019
4008
  function install$3(define) {
4020
4009
  define("platform", (g, o) => {
4021
4010
  const [w, d] = o.size || [240, 180], h = o.h ?? 10, r = o.r ?? 12, inset = o.inset ?? 10;
@@ -4565,8 +4554,7 @@ var Iso = (function() {
4565
4554
  });
4566
4555
  });
4567
4556
  }
4568
- //#endregion
4569
- //#region src/engine/prefabs/icons.js
4557
+ // src/engine/prefabs/icons.js
4570
4558
  var ICONS = {
4571
4559
  database: "M4 6c0-1.7 3.6-3 8-3s8 1.3 8 3-3.6 3-8 3-8-1.3-8-3ZM4 6v12c0 1.7 3.6 3 8 3s8-1.3 8-3V6M4 12c0 1.7 3.6 3 8 3s8-1.3 8-3",
4572
4560
  server: "M4 4h16v6H4zM4 14h16v6H4zM7.5 7h.01M7.5 17h.01M11 7h5M11 17h5",
@@ -4610,8 +4598,7 @@ var Iso = (function() {
4610
4598
  function icon(name, cls = "ln-strong") {
4611
4599
  return "<path class=\"" + cssClass(cls) + "\" d=\"" + iconPath(name) + "\"/>";
4612
4600
  }
4613
- //#endregion
4614
- //#region src/engine/prefabs/devices.js
4601
+ // src/engine/prefabs/devices.js
4615
4602
  function screen(f, mode = "off", o = {}) {
4616
4603
  const pad = o.pad ?? .9, r = o.r ?? 1.6;
4617
4604
  const w = f.w - 2 * pad, h = f.h - 2 * pad;
@@ -5497,8 +5484,7 @@ var Iso = (function() {
5497
5484
  ">": "&gt;"
5498
5485
  })[c]);
5499
5486
  }
5500
- //#endregion
5501
- //#region src/engine/prefabs/architecture.js
5487
+ // src/engine/prefabs/architecture.js
5502
5488
  function install$1(define, Iso) {
5503
5489
  define("building", (g, o) => {
5504
5490
  const w = o.w ?? 40, d = o.d ?? 32, h = o.h ?? 60, floors = o.floors ?? Math.max(2, Math.round(h / 10));
@@ -5980,8 +5966,7 @@ var Iso = (function() {
5980
5966
  });
5981
5967
  });
5982
5968
  }
5983
- //#endregion
5984
- //#region src/engine/prefabs/logistics.js
5969
+ // src/engine/prefabs/logistics.js
5985
5970
  function install(define) {
5986
5971
  define("parcel", (g, o) => {
5987
5972
  const [w, d, h] = o.size || [
@@ -6869,16 +6854,14 @@ var Iso = (function() {
6869
6854
  }
6870
6855
  }, { flat: true });
6871
6856
  }
6872
- //#endregion
6873
- //#region src/engine/prefabs/index.js
6857
+ // src/engine/prefabs/index.js
6874
6858
  function installPrefabs(define, Iso) {
6875
6859
  install$3(define, Iso);
6876
6860
  install$2(define, Iso);
6877
6861
  install$1(define, Iso);
6878
6862
  install(define, Iso);
6879
6863
  }
6880
- //#endregion
6881
- //#region src/engine/diagram.js
6864
+ // src/engine/diagram.js
6882
6865
  function buildDiagram(o, make) {
6883
6866
  const grid = o.grid ?? 80, gz = o.z ?? 0, origin = o.origin || [0, 0];
6884
6867
  const g = new Group({
@@ -7033,8 +7016,7 @@ var Iso = (function() {
7033
7016
  };
7034
7017
  return g;
7035
7018
  }
7036
- //#endregion
7037
- //#region src/engine/spec.js
7019
+ // src/engine/spec.js
7038
7020
  function pathFrom(p) {
7039
7021
  if (!p) return null;
7040
7022
  if (p.points && p.length !== void 0) return p;
@@ -7141,8 +7123,7 @@ var Iso = (function() {
7141
7123
  }
7142
7124
  return s;
7143
7125
  }
7144
- //#endregion
7145
- //#region src/engine/behaviors.js
7126
+ // src/engine/behaviors.js
7146
7127
  var TAU = Math.PI * 2;
7147
7128
  function anchorOf(scene, n) {
7148
7129
  if (!n.rest) scene.measure();
@@ -7271,8 +7252,7 @@ var Iso = (function() {
7271
7252
  return { stop() {} };
7272
7253
  }
7273
7254
  });
7274
- //#endregion
7275
- //#region src/engine/export.js
7255
+ // src/engine/export.js
7276
7256
  var PROPS = [
7277
7257
  "fill",
7278
7258
  "stroke",
@@ -7388,8 +7368,7 @@ var Iso = (function() {
7388
7368
  setTimeout(() => URL.revokeObjectURL(a.href), 2e3);
7389
7369
  }
7390
7370
  });
7391
- //#endregion
7392
- //#region src/engine/index.js
7371
+ // src/engine/index.js
7393
7372
  var VERSION = "0.5.3";
7394
7373
  function wedgeHull(o) {
7395
7374
  const [x, y, z] = o.at || [
@@ -7982,9 +7961,7 @@ var Iso = (function() {
7982
7961
  };
7983
7962
  Scene.path = path;
7984
7963
  installPrefabs(define, Iso);
7985
- //#endregion
7986
- //#region src/engine/global.js
7964
+ // src/engine/global.js
7987
7965
  if (typeof window !== "undefined") window.Iso = Iso;
7988
- //#endregion
7989
7966
  return Iso;
7990
7967
  })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@entro314labs/iso-engine",
3
- "version": "0.5.3",
3
+ "version": "0.5.4",
4
4
  "description": "Interactive isometric figures and autoplaying isometric animations in plain SVG: a projection kernel, interaction patterns, a glow kit and the Iso animation engine. No framework, no canvas, zero dependencies.",
5
5
  "license": "MIT",
6
6
  "author": "Dominikos Pritis",
@@ -11,22 +11,58 @@
11
11
  },
12
12
  "homepage": "https://github.com/entro314-labs/iso-figures/tree/main/packages/iso-engine#readme",
13
13
  "bugs": "https://github.com/entro314-labs/iso-figures/issues",
14
- "keywords": ["isometric", "svg", "illustration", "animation", "diagram", "figure", "explorable"],
14
+ "keywords": [
15
+ "isometric",
16
+ "svg",
17
+ "illustration",
18
+ "animation",
19
+ "diagram",
20
+ "figure",
21
+ "explorable"
22
+ ],
15
23
  "type": "module",
16
- "sideEffects": ["*.css", "**/engine/**", "**/iso.global.js"],
24
+ "sideEffects": [
25
+ "*.css",
26
+ "**/engine/**",
27
+ "**/iso.global.js"
28
+ ],
17
29
  "exports": {
18
- ".": { "source": "./src/index.ts", "types": "./dist/index.d.ts", "default": "./dist/index.js" },
19
- "./engine": { "source": "./src/engine/index.js", "types": "./dist/engine/index.d.ts", "default": "./dist/engine/index.js" },
20
- "./loops": { "source": "./src/loops.ts", "types": "./dist/loops.d.ts", "default": "./dist/loops.js" },
21
- "./theme.css": { "source": "./src/theme.css", "default": "./dist/theme.css" },
22
- "./figure.css": { "source": "./src/figure.css", "default": "./dist/figure.css" },
30
+ ".": {
31
+ "source": "./src/index.ts",
32
+ "types": "./dist/index.d.ts",
33
+ "default": "./dist/index.js"
34
+ },
35
+ "./engine": {
36
+ "source": "./src/engine/index.js",
37
+ "types": "./dist/engine/index.d.ts",
38
+ "default": "./dist/engine/index.js"
39
+ },
40
+ "./loops": {
41
+ "source": "./src/loops.ts",
42
+ "types": "./dist/loops.d.ts",
43
+ "default": "./dist/loops.js"
44
+ },
45
+ "./theme.css": {
46
+ "source": "./src/theme.css",
47
+ "default": "./dist/theme.css"
48
+ },
49
+ "./figure.css": {
50
+ "source": "./src/figure.css",
51
+ "default": "./dist/figure.css"
52
+ },
23
53
  "./engine.css": "./dist/engine.css",
24
54
  "./package.json": "./package.json"
25
55
  },
26
- "publishConfig": { "access": "public" },
56
+ "publishConfig": {
57
+ "access": "public"
58
+ },
27
59
  "unpkg": "./dist/iso.global.js",
28
60
  "jsdelivr": "./dist/iso.global.js",
29
- "files": ["dist", "skills", "THIRD_PARTY_NOTICES.md"],
61
+ "files": [
62
+ "dist",
63
+ "skills",
64
+ "THIRD_PARTY_NOTICES.md"
65
+ ],
30
66
  "scripts": {
31
67
  "build": "node scripts/build.mjs",
32
68
  "typecheck": "tsc --noEmit",
@@ -34,9 +70,9 @@
34
70
  "prepack": "node scripts/build.mjs"
35
71
  },
36
72
  "devDependencies": {
37
- "happy-dom": "^21.0.1",
73
+ "happy-dom": "^21.0.4",
38
74
  "typescript": "^7.0.2",
39
- "vite": "^8.3.4",
40
- "vitest": "^5.0.4"
75
+ "vite": "^8.4.0",
76
+ "vitest": "^5.1.2"
41
77
  }
42
78
  }