juxscript 1.1.271 → 1.1.273

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,12 +1,13 @@
1
1
  declare class PageState {
2
2
  private _registry;
3
3
  private _proxy;
4
- static readonly WIRE_EVENTS: readonly ["blur", "focus", "click", "dblclick", "change", "input", "keydown", "keyup", "keypress", "mouseenter", "mouseleave", "submit"];
4
+ static readonly WIRE_EVENTS: readonly ["blur", "focus", "click", "dblclick", "change", "input", "keydown", "keyup", "keypress", "mouseenter", "mouseleave", "mousedown", "mouseup", "submit"];
5
5
  constructor();
6
6
  private _createComponentProxy;
7
7
  private _register;
8
8
  private _wireEvent;
9
9
  private _findElement;
10
+ private _wireStateFlag;
10
11
  private _unregister;
11
12
  private _notify;
12
13
  private _watch;
@@ -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,2IAOhB;;IA2BX,OAAO,CAAC,qBAAqB;IAoF7B,OAAO,CAAC,SAAS;IA0DjB,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
+ {"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;IAoF7B,OAAO,CAAC,SAAS;IA+DjB,OAAO,CAAC,UAAU;IAwBlB,OAAO,CAAC,YAAY;IAkBpB,OAAO,CAAC,cAAc;IAuBtB,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"}
@@ -165,6 +165,10 @@ class PageState {
165
165
  for (const eventName of PageState.WIRE_EVENTS) {
166
166
  this._wireEvent(id, entry, eventName);
167
167
  }
168
+ // Wire composite state flags: hover, active, focused
169
+ this._wireStateFlag(id, entry, 'hover', 'mouseenter', 'mouseleave');
170
+ this._wireStateFlag(id, entry, 'active', 'mousedown', 'mouseup');
171
+ this._wireStateFlag(id, entry, 'focused', 'focus', 'blur');
168
172
  }
169
173
  _wireEvent(id, entry, eventName) {
170
174
  entry.events[eventName] = false;
@@ -206,6 +210,20 @@ class PageState {
206
210
  }
207
211
  return null;
208
212
  }
213
+ _wireStateFlag(id, entry, flagName, onEvent, offEvent) {
214
+ entry.events[flagName] = false;
215
+ const el = this._findElement(entry.component);
216
+ if (!el)
217
+ return;
218
+ el.addEventListener(onEvent, () => {
219
+ entry.events[flagName] = true;
220
+ this._notify(`${id}.${flagName}`);
221
+ });
222
+ el.addEventListener(offEvent, () => {
223
+ entry.events[flagName] = false;
224
+ this._notify(`${id}.${flagName}`);
225
+ });
226
+ }
209
227
  _unregister(id) {
210
228
  this._registry.delete(id);
211
229
  }
@@ -252,6 +270,7 @@ PageState.WIRE_EVENTS = [
252
270
  'change', 'input',
253
271
  'keydown', 'keyup', 'keypress',
254
272
  'mouseenter', 'mouseleave',
273
+ 'mousedown', 'mouseup',
255
274
  'submit'
256
275
  ];
257
276
  // Singleton
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "juxscript",
3
- "version": "1.1.271",
3
+ "version": "1.1.273",
4
4
  "type": "module",
5
5
  "description": "A JavaScript UX authorship platform",
6
6
  "main": "./dist/lib/index.js",