@oasys/oecs 0.5.0 → 0.5.2

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 (80) hide show
  1. package/CHANGELOG.md +108 -1
  2. package/README.md +20 -8
  3. package/dist/core/ecs/archetype.d.cts +3 -3
  4. package/dist/core/ecs/archetype.d.ts +3 -3
  5. package/dist/core/ecs/component.d.cts +25 -0
  6. package/dist/core/ecs/component.d.ts +25 -0
  7. package/dist/core/ecs/component.d.ts.map +1 -1
  8. package/dist/core/ecs/ecs.d.cts +67 -49
  9. package/dist/core/ecs/ecs.d.ts +67 -49
  10. package/dist/core/ecs/ecs.d.ts.map +1 -1
  11. package/dist/core/ecs/entity.d.cts +1 -1
  12. package/dist/core/ecs/entity.d.ts +1 -1
  13. package/dist/core/ecs/facades.d.cts +1 -1
  14. package/dist/core/ecs/facades.d.ts +1 -1
  15. package/dist/core/ecs/host_commands.d.cts +30 -20
  16. package/dist/core/ecs/host_commands.d.ts +30 -20
  17. package/dist/core/ecs/host_commands.d.ts.map +1 -1
  18. package/dist/core/ecs/index.d.cts +3 -3
  19. package/dist/core/ecs/index.d.ts +3 -3
  20. package/dist/core/ecs/index.d.ts.map +1 -1
  21. package/dist/core/ecs/observer.d.cts +1 -1
  22. package/dist/core/ecs/observer.d.ts +1 -1
  23. package/dist/core/ecs/observer.d.ts.map +1 -1
  24. package/dist/core/ecs/query.d.cts +22 -6
  25. package/dist/core/ecs/query.d.ts +22 -6
  26. package/dist/core/ecs/query.d.ts.map +1 -1
  27. package/dist/core/ecs/ref.d.ts.map +1 -1
  28. package/dist/core/ecs/run_condition.d.cts +1 -1
  29. package/dist/core/ecs/run_condition.d.ts +1 -1
  30. package/dist/core/ecs/run_condition.d.ts.map +1 -1
  31. package/dist/core/ecs/store.d.cts +10 -23
  32. package/dist/core/ecs/store.d.ts +10 -23
  33. package/dist/core/ecs/store.d.ts.map +1 -1
  34. package/dist/dev_flag.d.cts +0 -15
  35. package/dist/dev_flag.d.ts +0 -15
  36. package/dist/dev_flag.d.ts.map +1 -1
  37. package/dist/extensions/editor/editor.d.cts +31 -29
  38. package/dist/extensions/editor/editor.d.ts +31 -29
  39. package/dist/extensions/editor/editor.d.ts.map +1 -1
  40. package/dist/extensions/editor/field_handle.d.cts +3 -3
  41. package/dist/extensions/editor/field_handle.d.ts +3 -3
  42. package/dist/extensions/editor/field_handle.d.ts.map +1 -1
  43. package/dist/extensions/editor/index.cjs +1 -1
  44. package/dist/extensions/editor/index.development.cjs +1 -0
  45. package/dist/extensions/editor/index.development.js +239 -0
  46. package/dist/extensions/editor/index.js +53 -51
  47. package/dist/extensions/reactive/index.development.cjs +1 -0
  48. package/dist/extensions/reactive/index.development.js +215 -0
  49. package/dist/extensions/solid/index.development.cjs +1 -0
  50. package/dist/extensions/solid/index.development.js +40 -0
  51. package/dist/{host_commands-i4cAeyL5.js → host_commands-BI8pEmjH.js} +26 -18
  52. package/dist/{host_commands-BF8QMi3c.cjs → host_commands-CxhpzMx9.cjs} +1 -1
  53. package/dist/index.cjs +1 -1
  54. package/dist/index.d.cts +3 -3
  55. package/dist/index.d.ts +3 -3
  56. package/dist/index.d.ts.map +1 -1
  57. package/dist/index.development.cjs +1 -0
  58. package/dist/index.development.js +8116 -0
  59. package/dist/index.js +269 -214
  60. package/dist/internal-BMDgWZbt.js +2485 -0
  61. package/dist/internal-LiTSB_tG.cjs +2 -0
  62. package/dist/internal.cjs +1 -1
  63. package/dist/internal.development.cjs +1 -0
  64. package/dist/internal.development.js +24 -0
  65. package/dist/internal.js +1 -1
  66. package/dist/interop-DqxleBo7.js +18 -0
  67. package/dist/interop-T1HZ-Dpa.cjs +1 -0
  68. package/dist/kernel-Cz2Kxlwl.js +240 -0
  69. package/dist/kernel-sw7ScKWu.cjs +1 -0
  70. package/dist/primitives.development.cjs +1 -0
  71. package/dist/primitives.development.js +45 -0
  72. package/dist/reactive/index.development.cjs +1 -0
  73. package/dist/reactive/index.development.js +18 -0
  74. package/dist/shallow-9S1pY_Iw.js +159 -0
  75. package/dist/shallow-C5YmTbtb.cjs +1 -0
  76. package/dist/shared.development.cjs +1 -0
  77. package/dist/shared.development.js +7 -0
  78. package/dist/version.d.cts +1 -1
  79. package/dist/version.d.ts +1 -1
  80. package/package.json +31 -2
@@ -0,0 +1,159 @@
1
+ import { s as y, b as w, u as O } from "./kernel-Cz2Kxlwl.js";
2
+ function j(p = Object.is) {
3
+ const i = /* @__PURE__ */ new Map(), [t, h] = y(0);
4
+ let l = 0;
5
+ const a = (s, n) => s !== void 0 && n !== void 0 ? p(s, n) : s === n;
6
+ return {
7
+ get(s) {
8
+ const n = i.get(s);
9
+ if (n !== void 0) return n[0]();
10
+ t();
11
+ },
12
+ set(s, n) {
13
+ n === void 0 && console.warn(
14
+ "reactiveMap.set(key, undefined): undefined is the absent sentinel — get(key) cannot distinguish it from an unset key; use delete(key) to remove."
15
+ );
16
+ const o = i.get(s);
17
+ o !== void 0 ? o[1](n) : (i.set(s, y(n, a)), h(++l));
18
+ },
19
+ delete(s) {
20
+ const n = i.get(s);
21
+ return n === void 0 ? !1 : (i.delete(s), w(() => {
22
+ n[1](void 0), h(++l);
23
+ }), !0);
24
+ },
25
+ has(s) {
26
+ return t(), i.has(s);
27
+ },
28
+ size() {
29
+ return t(), i.size;
30
+ },
31
+ keys() {
32
+ return t(), [...i.keys()];
33
+ }
34
+ };
35
+ }
36
+ function x(p, i = {}) {
37
+ const t = {}, h = {}, l = Object.keys(p), a = new Set(l);
38
+ for (const n of l) {
39
+ const [o, m] = y(
40
+ p[n],
41
+ i[n]
42
+ );
43
+ t[n] = o, h[n] = m;
44
+ }
45
+ return [new Proxy({}, {
46
+ // A field read subscribes; a NON-field key must not throw. `JSON.stringify`
47
+ // (`toJSON`), `await proxy` (`then`), `String(proxy)` (`Symbol.toPrimitive`)
48
+ // and `for..of` (`Symbol.iterator`) all probe keys that aren't fields — fall
49
+ // through to the (empty) target so they see the ordinary undefined/inherited
50
+ // value instead of calling `undefined()`. `fieldSet` (not `k in reads`) so
51
+ // inherited `toString`/`constructor` aren't mistaken for fields.
52
+ get: (n, o) => a.has(o) ? t[o]() : Reflect.get(n, o),
53
+ has: (n, o) => a.has(o),
54
+ // Enumerable without subscribing: enumeration calls `ownKeys` +
55
+ // `getOwnPropertyDescriptor`, never `get`, so `Object.keys(proxy)` returns
56
+ // the field set and tracks nothing. The descriptor is an ACCESSOR whose `get`
57
+ // reads the live signal, so `{...proxy}` / `Object.values(proxy)` /
58
+ // `Object.getOwnPropertyDescriptor(proxy, f).value` see the current value
59
+ // (a value-less descriptor would normalize to `value: undefined`). Non-field
60
+ // keys report no own descriptor. The target is the empty (extensible) object,
61
+ // so these configurable own keys satisfy the Proxy invariants.
62
+ ownKeys: () => l,
63
+ getOwnPropertyDescriptor: (n, o) => a.has(o) ? { get: () => t[o](), enumerable: !0, configurable: !0 } : void 0,
64
+ // Writes go through `set.field(v)` — the proxy is a READ surface, and its
65
+ // public type says so (`Readonly<T>`, POLISH_AUDIT #8). The trap backs the
66
+ // type for JS callers / policed casts: without it, a field assignment threw
67
+ // an opaque "Cannot redefine property" (the accessor descriptor above has no
68
+ // setter) and a TYPO'D field silently stuck on the hidden target as a
69
+ // non-reactive value.
70
+ set: (n, o) => {
71
+ throw new TypeError(
72
+ `reactiveStruct proxy is read-only: use set.${String(o)}(value) — the setters tuple returned alongside the proxy`
73
+ );
74
+ }
75
+ }), h];
76
+ }
77
+ const v = Symbol("reactiveArray.absent");
78
+ function M(p = [], i = Object.is) {
79
+ const t = [], [h, l] = y(0);
80
+ let a = 0;
81
+ const s = (e, r) => e !== v && r !== v ? i(e, r) : e === r, n = (e) => y(e, s), o = (e) => O(t[e][0]);
82
+ for (const e of p) t.push(n(e));
83
+ function m(e) {
84
+ w(() => {
85
+ const r = t.length, f = e.length, g = f < r ? f : r;
86
+ for (let c = 0; c < g; c++) t[c][1](e[c]);
87
+ if (f > r) {
88
+ for (let c = r; c < f; c++) t.push(n(e[c]));
89
+ l(++a);
90
+ } else if (f < r) {
91
+ const c = t.splice(f);
92
+ for (let d = 0; d < c.length; d++) c[d][1](v);
93
+ l(++a);
94
+ }
95
+ });
96
+ }
97
+ return {
98
+ get(e) {
99
+ if (e >= 0 && e < t.length) {
100
+ const r = t[e][0]();
101
+ if (r !== v) return r;
102
+ }
103
+ h();
104
+ },
105
+ length() {
106
+ return h(), t.length;
107
+ },
108
+ snapshot() {
109
+ h();
110
+ const e = new Array(t.length);
111
+ for (let r = 0; r < t.length; r++) e[r] = t[r][0]();
112
+ return e;
113
+ },
114
+ set(e, r) {
115
+ e >= 0 && e < t.length ? t[e][1](r) : console.warn(
116
+ `reactiveArray.set(${e}): index out of range [0, ${t.length}); ignored. Use push / splice / reconcile to change length.`
117
+ );
118
+ },
119
+ push(e) {
120
+ t.push(n(e)), l(++a);
121
+ },
122
+ pop() {
123
+ const e = t.length;
124
+ if (e === 0) return;
125
+ const r = o(e - 1), [f] = t.splice(e - 1);
126
+ return w(() => {
127
+ f[1](v), l(++a);
128
+ }), r;
129
+ },
130
+ splice(e, r, ...f) {
131
+ const g = t.length, c = e < 0 ? Math.max(g + e, 0) : Math.min(e, g), d = r === void 0 ? g - c : Math.max(0, Math.min(r, g - c)), k = [];
132
+ for (let u = 0; u < d; u++) k.push(o(c + u));
133
+ const b = [];
134
+ for (let u = 0; u < c; u++) b.push(o(u));
135
+ for (let u = 0; u < f.length; u++) b.push(f[u]);
136
+ for (let u = c + d; u < g; u++) b.push(o(u));
137
+ return m(b), k;
138
+ },
139
+ reconcile(e) {
140
+ m(e);
141
+ }
142
+ };
143
+ }
144
+ function A(p, i) {
145
+ if (Object.is(p, i)) return !0;
146
+ const t = p, h = i, l = Object.keys(t);
147
+ if (l.length !== Object.keys(h).length) return !1;
148
+ for (let a = 0; a < l.length; a++) {
149
+ const s = l[a];
150
+ if (!Object.prototype.hasOwnProperty.call(h, s) || !Object.is(t[s], h[s])) return !1;
151
+ }
152
+ return !0;
153
+ }
154
+ export {
155
+ x as a,
156
+ M as b,
157
+ j as r,
158
+ A as s
159
+ };
@@ -0,0 +1 @@
1
+ "use strict";const p=require("./kernel-sw7ScKWu.cjs");function k(g=Object.is){const i=new Map,[t,h]=p.signal(0);let l=0;const a=(s,n)=>s!==void 0&&n!==void 0?g(s,n):s===n;return{get(s){const n=i.get(s);if(n!==void 0)return n[0]();t()},set(s,n){n===void 0&&console.warn("reactiveMap.set(key, undefined): undefined is the absent sentinel — get(key) cannot distinguish it from an unset key; use delete(key) to remove.");const o=i.get(s);o!==void 0?o[1](n):(i.set(s,p.signal(n,a)),h(++l))},delete(s){const n=i.get(s);return n===void 0?!1:(i.delete(s),p.batch(()=>{n[1](void 0),h(++l)}),!0)},has(s){return t(),i.has(s)},size(){return t(),i.size},keys(){return t(),[...i.keys()]}}}function O(g,i={}){const t={},h={},l=Object.keys(g),a=new Set(l);for(const n of l){const[o,b]=p.signal(g[n],i[n]);t[n]=o,h[n]=b}return[new Proxy({},{get:(n,o)=>a.has(o)?t[o]():Reflect.get(n,o),has:(n,o)=>a.has(o),ownKeys:()=>l,getOwnPropertyDescriptor:(n,o)=>a.has(o)?{get:()=>t[o](),enumerable:!0,configurable:!0}:void 0,set:(n,o)=>{throw new TypeError(`reactiveStruct proxy is read-only: use set.${String(o)}(value) — the setters tuple returned alongside the proxy`)}}),h]}const y=Symbol("reactiveArray.absent");function S(g=[],i=Object.is){const t=[],[h,l]=p.signal(0);let a=0;const s=(e,r)=>e!==y&&r!==y?i(e,r):e===r,n=e=>p.signal(e,s),o=e=>p.untrack(t[e][0]);for(const e of g)t.push(n(e));function b(e){p.batch(()=>{const r=t.length,f=e.length,d=f<r?f:r;for(let c=0;c<d;c++)t[c][1](e[c]);if(f>r){for(let c=r;c<f;c++)t.push(n(e[c]));l(++a)}else if(f<r){const c=t.splice(f);for(let v=0;v<c.length;v++)c[v][1](y);l(++a)}})}return{get(e){if(e>=0&&e<t.length){const r=t[e][0]();if(r!==y)return r}h()},length(){return h(),t.length},snapshot(){h();const e=new Array(t.length);for(let r=0;r<t.length;r++)e[r]=t[r][0]();return e},set(e,r){e>=0&&e<t.length?t[e][1](r):console.warn(`reactiveArray.set(${e}): index out of range [0, ${t.length}); ignored. Use push / splice / reconcile to change length.`)},push(e){t.push(n(e)),l(++a)},pop(){const e=t.length;if(e===0)return;const r=o(e-1),[f]=t.splice(e-1);return p.batch(()=>{f[1](y),l(++a)}),r},splice(e,r,...f){const d=t.length,c=e<0?Math.max(d+e,0):Math.min(e,d),v=r===void 0?d-c:Math.max(0,Math.min(r,d-c)),w=[];for(let u=0;u<v;u++)w.push(o(c+u));const m=[];for(let u=0;u<c;u++)m.push(o(u));for(let u=0;u<f.length;u++)m.push(f[u]);for(let u=c+v;u<d;u++)m.push(o(u));return b(m),w},reconcile(e){b(e)}}}function j(g,i){if(Object.is(g,i))return!0;const t=g,h=i,l=Object.keys(t);if(l.length!==Object.keys(h).length)return!1;for(let a=0;a<l.length;a++){const s=l[a];if(!Object.prototype.hasOwnProperty.call(h,s)||!Object.is(t[s],h[s]))return!1}return!0}exports.reactiveArray=S;exports.reactiveMap=k;exports.reactiveStruct=O;exports.shallow=j;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./shared-BymrGTyR.cjs");exports.DEFAULT_SAB_ALLOCATOR=a.DEFAULT_SAB_ALLOCATOR;exports.SabUnavailableError=a.SabUnavailableError;exports.growableSabAllocator=a.growableSabAllocator;exports.wasmMemoryAllocator=a.wasmMemoryAllocator;
@@ -0,0 +1,7 @@
1
+ import { D as r, a as l, g as A, w as s } from "./shared-BU1Cd40h.js";
2
+ export {
3
+ r as DEFAULT_SAB_ALLOCATOR,
4
+ l as SabUnavailableError,
5
+ A as growableSabAllocator,
6
+ s as wasmMemoryAllocator
7
+ };
@@ -6,5 +6,5 @@
6
6
  * `jsr.json` by `src/__tests__/version_sync.test.ts` — bump all three
7
7
  * together.
8
8
  */
9
- export declare const VERSION = "0.5.0";
9
+ export declare const VERSION = "0.5.2";
10
10
  //# sourceMappingURL=version.d.ts.map
package/dist/version.d.ts CHANGED
@@ -6,5 +6,5 @@
6
6
  * `jsr.json` by `src/__tests__/version_sync.test.ts` — bump all three
7
7
  * together.
8
8
  */
9
- export declare const VERSION = "0.5.0";
9
+ export declare const VERSION = "0.5.2";
10
10
  //# sourceMappingURL=version.d.ts.map
package/package.json CHANGED
@@ -1,86 +1,112 @@
1
1
  {
2
2
  "name": "@oasys/oecs",
3
- "version": "0.5.0",
3
+ "version": "0.5.2",
4
4
  "description": "Archetype-based Entity Component System",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {
8
8
  "import": {
9
9
  "types": "./dist/index.d.ts",
10
+ "development": "./dist/index.development.js",
10
11
  "default": "./dist/index.js"
11
12
  },
12
13
  "require": {
13
14
  "types": "./dist/index.d.cts",
15
+ "development": "./dist/index.development.cjs",
14
16
  "default": "./dist/index.cjs"
15
17
  }
16
18
  },
19
+ "./dev": {
20
+ "import": {
21
+ "types": "./dist/index.d.ts",
22
+ "default": "./dist/index.development.js"
23
+ },
24
+ "require": {
25
+ "types": "./dist/index.d.cts",
26
+ "default": "./dist/index.development.cjs"
27
+ }
28
+ },
17
29
  "./primitives": {
18
30
  "import": {
19
31
  "types": "./dist/primitives.d.ts",
32
+ "development": "./dist/primitives.development.js",
20
33
  "default": "./dist/primitives.js"
21
34
  },
22
35
  "require": {
23
36
  "types": "./dist/primitives.d.cts",
37
+ "development": "./dist/primitives.development.cjs",
24
38
  "default": "./dist/primitives.cjs"
25
39
  }
26
40
  },
27
41
  "./reactive": {
28
42
  "import": {
29
43
  "types": "./dist/reactive/index.d.ts",
44
+ "development": "./dist/reactive/index.development.js",
30
45
  "default": "./dist/reactive/index.js"
31
46
  },
32
47
  "require": {
33
48
  "types": "./dist/reactive/index.d.cts",
49
+ "development": "./dist/reactive/index.development.cjs",
34
50
  "default": "./dist/reactive/index.cjs"
35
51
  }
36
52
  },
37
53
  "./reactive-sync": {
38
54
  "import": {
39
55
  "types": "./dist/extensions/reactive/index.d.ts",
56
+ "development": "./dist/extensions/reactive/index.development.js",
40
57
  "default": "./dist/extensions/reactive/index.js"
41
58
  },
42
59
  "require": {
43
60
  "types": "./dist/extensions/reactive/index.d.cts",
61
+ "development": "./dist/extensions/reactive/index.development.cjs",
44
62
  "default": "./dist/extensions/reactive/index.cjs"
45
63
  }
46
64
  },
47
65
  "./editor": {
48
66
  "import": {
49
67
  "types": "./dist/extensions/editor/index.d.ts",
68
+ "development": "./dist/extensions/editor/index.development.js",
50
69
  "default": "./dist/extensions/editor/index.js"
51
70
  },
52
71
  "require": {
53
72
  "types": "./dist/extensions/editor/index.d.cts",
73
+ "development": "./dist/extensions/editor/index.development.cjs",
54
74
  "default": "./dist/extensions/editor/index.cjs"
55
75
  }
56
76
  },
57
77
  "./solid": {
58
78
  "import": {
59
79
  "types": "./dist/extensions/solid/index.d.ts",
80
+ "development": "./dist/extensions/solid/index.development.js",
60
81
  "default": "./dist/extensions/solid/index.js"
61
82
  },
62
83
  "require": {
63
84
  "types": "./dist/extensions/solid/index.d.cts",
85
+ "development": "./dist/extensions/solid/index.development.cjs",
64
86
  "default": "./dist/extensions/solid/index.cjs"
65
87
  }
66
88
  },
67
89
  "./shared": {
68
90
  "import": {
69
91
  "types": "./dist/shared.d.ts",
92
+ "development": "./dist/shared.development.js",
70
93
  "default": "./dist/shared.js"
71
94
  },
72
95
  "require": {
73
96
  "types": "./dist/shared.d.cts",
97
+ "development": "./dist/shared.development.cjs",
74
98
  "default": "./dist/shared.cjs"
75
99
  }
76
100
  },
77
101
  "./internal": {
78
102
  "import": {
79
103
  "types": "./dist/internal.d.ts",
104
+ "development": "./dist/internal.development.js",
80
105
  "default": "./dist/internal.js"
81
106
  },
82
107
  "require": {
83
108
  "types": "./dist/internal.d.cts",
109
+ "development": "./dist/internal.development.cjs",
84
110
  "default": "./dist/internal.cjs"
85
111
  }
86
112
  },
@@ -96,7 +122,7 @@
96
122
  "sideEffects": false,
97
123
  "scripts": {
98
124
  "dev": "vite",
99
- "build": "vite build && node scripts/postbuild.mjs",
125
+ "build": "node scripts/build.mjs && node scripts/postbuild.mjs",
100
126
  "test": "vitest",
101
127
  "bench": "vitest bench",
102
128
  "prepublishOnly": "pnpm build"
@@ -138,6 +164,9 @@
138
164
  },
139
165
  "typesVersions": {
140
166
  "*": {
167
+ "dev": [
168
+ "./dist/index.d.ts"
169
+ ],
141
170
  "primitives": [
142
171
  "./dist/primitives.d.ts"
143
172
  ],