juxscript 1.1.290 → 1.1.292

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":"store.d.ts","sourceRoot":"","sources":["../../../lib/components/store.ts"],"names":[],"mappings":"AAGA,UAAU,YAAY;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,OAAO,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;QAAC,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IAChF,IAAI,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,cAAM,KAAK;IACP,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,YAAY,CAAC;IACtB,OAAO,CAAC,GAAG,CAA4B;IACvC,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,CAAC,QAAQ,CAAkB;IAClC,OAAO,CAAC,MAAM,CAAuB;IACrC,OAAO,CAAC,SAAS,CAAyC;IAC1D,OAAO,CAAC,MAAM,CAAgB;gBAElB,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY;IAgB7C,OAAO,CAAC,KAAK;IAgCb,OAAO,CAAC,GAAG;IAOX,OAAO,CAAC,aAAa;IAUrB,QAAQ,CAAC,EAAE,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,IAAI,GAAG,IAAI;IAK1C,QAAQ,IAAI,GAAG,EAAE;IACjB,UAAU,IAAI,OAAO;IACrB,QAAQ,IAAI,MAAM,GAAG,IAAI;IACzB,QAAQ,IAAI,MAAM;IAElB,QAAQ,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,IA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OAAO,CAAC,GAAG,EAAE,CAAC;CAGlC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAsB,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,KAAK,CAAC,CAU7E;AAED,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC"}
@@ -126,8 +126,7 @@ class Store {
126
126
  return new Promise((resolve, reject) => {
127
127
  const req = this._tx('readwrite').put(record);
128
128
  req.onsuccess = () => {
129
- this.getAll(); // refresh cached value
130
- resolve(req.result);
129
+ this.getAll().then(() => resolve(req.result));
131
130
  };
132
131
  req.onerror = () => reject(new Error(req.error?.message ?? 'put failed'));
133
132
  });
@@ -137,8 +136,7 @@ class Store {
137
136
  return new Promise((resolve, reject) => {
138
137
  const req = this._tx('readwrite').add(record);
139
138
  req.onsuccess = () => {
140
- this.getAll();
141
- resolve(req.result);
139
+ this.getAll().then(() => resolve(req.result));
142
140
  };
143
141
  req.onerror = () => reject(new Error(req.error?.message ?? 'add failed'));
144
142
  });
@@ -152,8 +150,7 @@ class Store {
152
150
  store.put(record);
153
151
  }
154
152
  tx.oncomplete = () => {
155
- this.getAll();
156
- resolve();
153
+ this.getAll().then(() => resolve());
157
154
  };
158
155
  tx.onerror = () => reject(new Error(tx.error?.message ?? 'putMany failed'));
159
156
  });
@@ -166,8 +163,7 @@ class Store {
166
163
  return new Promise((resolve, reject) => {
167
164
  const req = this._tx('readwrite').delete(key);
168
165
  req.onsuccess = () => {
169
- this.getAll();
170
- resolve();
166
+ this.getAll().then(() => resolve());
171
167
  };
172
168
  req.onerror = () => reject(new Error(req.error?.message ?? 'delete failed'));
173
169
  });
@@ -189,16 +189,18 @@ export function autowrap(source, filename = '') {
189
189
 
190
190
  // VariableDeclaration reading pageState — group with subsequent stmts that use declared vars
191
191
  if (stmt.type === 'VariableDeclaration' && containsPageStateRef(stmt)) {
192
- const varNames = getDeclaredVarNames(stmt);
192
+ const varNames = [...getDeclaredVarNames(stmt)];
193
193
  const groupStmts = [stmt];
194
194
  let j = i + 1;
195
195
 
196
196
  // Greedily consume following statements that use any of the declared variable names
197
197
  while (j < ast.body.length) {
198
198
  const next = ast.body[j];
199
- if (isAlreadyWrapped(next) || isSetupStatement(next)) break;
199
+ // Check variable dependency FIRST — if it uses our vars, consume it
200
200
  if (varNames.some(v => usesIdentifier(next, v))) {
201
201
  groupStmts.push(next);
202
+ // Track any new variable declarations in the consumed statement
203
+ getDeclaredVarNames(next).forEach(v => varNames.push(v));
202
204
  j++;
203
205
  } else {
204
206
  break;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "juxscript",
3
- "version": "1.1.290",
3
+ "version": "1.1.292",
4
4
  "type": "module",
5
5
  "description": "A JavaScript UX authorship platform",
6
6
  "main": "./dist/lib/index.js",