juxscript 1.1.268 → 1.1.270

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.
@@ -1 +1 @@
1
- {"version":3,"file":"pageState.d.ts","sourceRoot":"","sources":["../../../lib/state/pageState.ts"],"names":[],"mappings":"AAaA,cAAM,SAAS;IACX,OAAO,CAAC,SAAS,CAA0C;IAC3D,OAAO,CAAC,MAAM,CAAsB;IAEpC,MAAM,CAAC,QAAQ,CAAC,WAAW,2IAOhB;;IA2BX,OAAO,CAAC,qBAAqB;IAyD7B,OAAO,CAAC,SAAS;IA6CjB,OAAO,CAAC,UAAU;IAwBlB,OAAO,CAAC,YAAY;IAkBpB,OAAO,CAAC,WAAW;IAInB,OAAO,CAAC,OAAO;IAQf,OAAO,CAAC,MAAM;IAcd,QAAQ,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAGlC;AAID,eAAO,MAAM,SAAS,qBAAuB,CAAC;AAE9C,OAAO,EAAE,SAAS,EAAE,CAAC"}
1
+ {"version":3,"file":"pageState.d.ts","sourceRoot":"","sources":["../../../lib/state/pageState.ts"],"names":[],"mappings":"AAeA,cAAM,SAAS;IACX,OAAO,CAAC,SAAS,CAA0C;IAC3D,OAAO,CAAC,MAAM,CAAsB;IAEpC,MAAM,CAAC,QAAQ,CAAC,WAAW,2IAOhB;;IA2BX,OAAO,CAAC,qBAAqB;IAyD7B,OAAO,CAAC,SAAS;IA6CjB,OAAO,CAAC,UAAU;IAwBlB,OAAO,CAAC,YAAY;IAkBpB,OAAO,CAAC,WAAW;IAInB,OAAO,CAAC,OAAO;IAqBf,OAAO,CAAC,MAAM;IAcd,QAAQ,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAGlC;AAID,eAAO,MAAM,SAAS,qBAAuB,CAAC;AAE9C,OAAO,EAAE,SAAS,EAAE,CAAC"}
@@ -1,6 +1,8 @@
1
1
  // Tracks which reactive block is currently running so we can record dependencies
2
2
  let activeReaction = null;
3
3
  const reactionDeps = new Map();
4
+ let notifyQueue = [];
5
+ let isNotifying = false;
4
6
  class PageState {
5
7
  constructor() {
6
8
  this._registry = new Map();
@@ -167,11 +169,24 @@ class PageState {
167
169
  this._registry.delete(id);
168
170
  }
169
171
  _notify(depKey) {
170
- for (const [reaction, deps] of reactionDeps.entries()) {
171
- if (deps.has(depKey)) {
172
- reaction();
172
+ notifyQueue.push(depKey);
173
+ // Prevent re-entrant notification loops
174
+ if (isNotifying)
175
+ return;
176
+ isNotifying = true;
177
+ try {
178
+ while (notifyQueue.length > 0) {
179
+ const key = notifyQueue.shift();
180
+ for (const [reaction, deps] of reactionDeps.entries()) {
181
+ if (deps.has(key)) {
182
+ reaction();
183
+ }
184
+ }
173
185
  }
174
186
  }
187
+ finally {
188
+ isNotifying = false;
189
+ }
175
190
  }
176
191
  _watch(fn) {
177
192
  const reaction = () => {
@@ -109,12 +109,11 @@ app.get('/favicon.png', (req, res) => res.status(204).end());
109
109
  // ═══════════════════════════════════════════════════════════════
110
110
  // API ROUTES — BEFORE static and catch-all
111
111
  // ═══════════════════════════════════════════════════════════════
112
- app.get('/api/test', (_req, res) => {
113
- const fruits = ['apple', 'banana', 'orange', 'mango', 'strawberry', 'grape', 'watermelon', 'pineapple', 'kiwi', 'peach'];
114
- const randomFruit = fruits[Math.floor(Math.random() * fruits.length)];
112
+ const FRUITS = ['mango', 'blueberry', 'raspberry', 'kiwi', 'pineapple', 'strawberry', 'banana', 'papaya', 'guava', 'dragonfruit'];
115
113
 
114
+ app.get('/api/test', (req, res) => {
116
115
  res.json({
117
- randomFruit,
116
+ randomFruit: FRUITS[Math.floor(Math.random() * FRUITS.length)],
118
117
  users: [
119
118
  { id: 1, name: 'Alice', email: 'alice@example.com' },
120
119
  { id: 2, name: 'Bob', email: 'bob@example.com' },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "juxscript",
3
- "version": "1.1.268",
3
+ "version": "1.1.270",
4
4
  "type": "module",
5
5
  "description": "A JavaScript UX authorship platform",
6
6
  "main": "./dist/lib/index.js",