juxscript 1.1.291 → 1.1.293
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;
|
|
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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C,OAAO,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAuBtC,MAAM,CAAC,GAAG,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAcvC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAoBtB,OAAO,IAAI,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"}
|
|
@@ -60,6 +60,8 @@ class Store {
|
|
|
60
60
|
this._onChange(this._value);
|
|
61
61
|
pageState.__notify?.(`${this.id}.value`);
|
|
62
62
|
pageState.__notify?.(`${this.id}.loading`);
|
|
63
|
+
// Fire change event so pageState['id'].change watchers trigger
|
|
64
|
+
pageState.__notify?.(`${this.id}.change`);
|
|
63
65
|
}
|
|
64
66
|
// ═══════════════════════════════════════════════════════════
|
|
65
67
|
// PAGESTATE INTEGRATION
|
|
@@ -126,8 +128,7 @@ class Store {
|
|
|
126
128
|
return new Promise((resolve, reject) => {
|
|
127
129
|
const req = this._tx('readwrite').put(record);
|
|
128
130
|
req.onsuccess = () => {
|
|
129
|
-
this.getAll()
|
|
130
|
-
resolve(req.result);
|
|
131
|
+
this.getAll().then(() => resolve(req.result));
|
|
131
132
|
};
|
|
132
133
|
req.onerror = () => reject(new Error(req.error?.message ?? 'put failed'));
|
|
133
134
|
});
|
|
@@ -137,8 +138,7 @@ class Store {
|
|
|
137
138
|
return new Promise((resolve, reject) => {
|
|
138
139
|
const req = this._tx('readwrite').add(record);
|
|
139
140
|
req.onsuccess = () => {
|
|
140
|
-
this.getAll();
|
|
141
|
-
resolve(req.result);
|
|
141
|
+
this.getAll().then(() => resolve(req.result));
|
|
142
142
|
};
|
|
143
143
|
req.onerror = () => reject(new Error(req.error?.message ?? 'add failed'));
|
|
144
144
|
});
|
|
@@ -152,8 +152,7 @@ class Store {
|
|
|
152
152
|
store.put(record);
|
|
153
153
|
}
|
|
154
154
|
tx.oncomplete = () => {
|
|
155
|
-
this.getAll();
|
|
156
|
-
resolve();
|
|
155
|
+
this.getAll().then(() => resolve());
|
|
157
156
|
};
|
|
158
157
|
tx.onerror = () => reject(new Error(tx.error?.message ?? 'putMany failed'));
|
|
159
158
|
});
|
|
@@ -166,8 +165,7 @@ class Store {
|
|
|
166
165
|
return new Promise((resolve, reject) => {
|
|
167
166
|
const req = this._tx('readwrite').delete(key);
|
|
168
167
|
req.onsuccess = () => {
|
|
169
|
-
this.getAll();
|
|
170
|
-
resolve();
|
|
168
|
+
this.getAll().then(() => resolve());
|
|
171
169
|
};
|
|
172
170
|
req.onerror = () => reject(new Error(req.error?.message ?? 'delete failed'));
|
|
173
171
|
});
|
|
@@ -1 +1 @@
|
|
|
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,mKAQhB;;IA2BX,OAAO,CAAC,qBAAqB;IAsG7B,OAAO,CAAC,SAAS;
|
|
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,mKAQhB;;IA2BX,OAAO,CAAC,qBAAqB;IAsG7B,OAAO,CAAC,SAAS;IAsEjB,OAAO,CAAC,UAAU;IAwBlB,OAAO,CAAC,YAAY;IAkBpB,OAAO,CAAC,cAAc;IAuBtB,OAAO,CAAC,WAAW;IAInB,OAAO,CAAC,OAAO;IA2Cf,OAAO,CAAC,MAAM;IAmBd,QAAQ,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAGlC;AAID,eAAO,MAAM,SAAS,qBAAuB,CAAC;AAE9C,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -163,6 +163,12 @@ class PageState {
|
|
|
163
163
|
entry.props.type = opts.type;
|
|
164
164
|
}
|
|
165
165
|
entry.props.id = id;
|
|
166
|
+
// For non-DOM components (Store, Data), seed a change event flag
|
|
167
|
+
// so pageState['id'].change works even without a DOM element
|
|
168
|
+
const el = this._findElement(component);
|
|
169
|
+
if (!el) {
|
|
170
|
+
entry.events['change'] = false;
|
|
171
|
+
}
|
|
166
172
|
this._registry.set(id, entry);
|
|
167
173
|
// Wire onChange — use internal callback pattern, don't replace
|
|
168
174
|
if (typeof component.onChange === 'function') {
|
|
@@ -248,6 +254,16 @@ class PageState {
|
|
|
248
254
|
this._registry.delete(id);
|
|
249
255
|
}
|
|
250
256
|
_notify(depKey) {
|
|
257
|
+
// For event-style keys, set the flag before notifying
|
|
258
|
+
const dotIdx = depKey.indexOf('.');
|
|
259
|
+
const eventId = dotIdx > -1 ? depKey.substring(0, dotIdx) : null;
|
|
260
|
+
const eventProp = dotIdx > -1 ? depKey.substring(dotIdx + 1) : null;
|
|
261
|
+
if (eventId && eventProp) {
|
|
262
|
+
const entry = this._registry.get(eventId);
|
|
263
|
+
if (entry && eventProp in entry.events) {
|
|
264
|
+
entry.events[eventProp] = true;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
251
267
|
notifyQueue.push(depKey);
|
|
252
268
|
// Prevent re-entrant notification loops
|
|
253
269
|
if (isNotifying)
|
|
@@ -265,6 +281,15 @@ class PageState {
|
|
|
265
281
|
}
|
|
266
282
|
finally {
|
|
267
283
|
isNotifying = false;
|
|
284
|
+
// Reset event flag after reactions
|
|
285
|
+
if (eventId && eventProp) {
|
|
286
|
+
const entry = this._registry.get(eventId);
|
|
287
|
+
if (entry && eventProp in entry.events) {
|
|
288
|
+
queueMicrotask(() => {
|
|
289
|
+
entry.events[eventProp] = false;
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
}
|
|
268
293
|
}
|
|
269
294
|
}
|
|
270
295
|
_watch(fn) {
|