defuss 3.4.7 → 3.4.9

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.
@@ -271,6 +271,20 @@ function unregisterComponent(el) {
271
271
  componentRegistry.delete(el);
272
272
  }
273
273
 
274
+ function reactive(config, target) {
275
+ const stores = Array.isArray(config.store) ? config.store : [config.store];
276
+ const ref = target instanceof HTMLElement ? { current: target } : target;
277
+ const update = () => {
278
+ dequery(ref).jsx(config.render());
279
+ };
280
+ update();
281
+ const unsubscribes = stores.map((s) => s.subscribe(update));
282
+ return () => {
283
+ unsubscribes.forEach((unsub) => unsub());
284
+ config.cleanup?.();
285
+ };
286
+ }
287
+
274
288
  const emptyImpl = (nodes) => {
275
289
  nodes.forEach((el) => {
276
290
  const element = el;
@@ -1040,6 +1054,15 @@ class CallChainImpl {
1040
1054
  }
1041
1055
  return this;
1042
1056
  }
1057
+ // --- Reactive ---
1058
+ reactive(config) {
1059
+ this._nodes.forEach((el) => {
1060
+ if (el instanceof HTMLElement) {
1061
+ reactive(config, el);
1062
+ }
1063
+ });
1064
+ return this;
1065
+ }
1043
1066
  }
1044
1067
  function dequery(selectorRefOrEl, options = getDefaultDequeryOptions()) {
1045
1068
  if (typeof selectorRefOrEl === "function") {
@@ -2598,6 +2621,7 @@ exports.parseEventPropName = parseEventPropName;
2598
2621
  exports.performTransition = performTransition;
2599
2622
  exports.processAllFormElements = processAllFormElements;
2600
2623
  exports.queueCallback = queueCallback;
2624
+ exports.reactive = reactive;
2601
2625
  exports.registerComponent = registerComponent;
2602
2626
  exports.registerDelegatedEvent = registerDelegatedEvent;
2603
2627
  exports.removeDelegatedEvent = removeDelegatedEvent;
@@ -269,6 +269,20 @@ function unregisterComponent(el) {
269
269
  componentRegistry.delete(el);
270
270
  }
271
271
 
272
+ function reactive(config, target) {
273
+ const stores = Array.isArray(config.store) ? config.store : [config.store];
274
+ const ref = target instanceof HTMLElement ? { current: target } : target;
275
+ const update = () => {
276
+ dequery(ref).jsx(config.render());
277
+ };
278
+ update();
279
+ const unsubscribes = stores.map((s) => s.subscribe(update));
280
+ return () => {
281
+ unsubscribes.forEach((unsub) => unsub());
282
+ config.cleanup?.();
283
+ };
284
+ }
285
+
272
286
  const emptyImpl = (nodes) => {
273
287
  nodes.forEach((el) => {
274
288
  const element = el;
@@ -1038,6 +1052,15 @@ class CallChainImpl {
1038
1052
  }
1039
1053
  return this;
1040
1054
  }
1055
+ // --- Reactive ---
1056
+ reactive(config) {
1057
+ this._nodes.forEach((el) => {
1058
+ if (el instanceof HTMLElement) {
1059
+ reactive(config, el);
1060
+ }
1061
+ });
1062
+ return this;
1063
+ }
1041
1064
  }
1042
1065
  function dequery(selectorRefOrEl, options = getDefaultDequeryOptions()) {
1043
1066
  if (typeof selectorRefOrEl === "function") {
@@ -2542,4 +2565,4 @@ function htmlStringToVNodes(html, Parser) {
2542
2565
  return vNodes;
2543
2566
  }
2544
2567
 
2545
- export { $, registerDelegatedEvent as A, removeDelegatedEvent as B, CAPTURE_ONLY_EVENTS as C, DANGEROUSLY_SET_INNER_HTML_ATTRIBUTE as D, removeDelegatedEventByKey as E, Fragment as F, render as G, renderInto as H, renderIsomorphicAsync as I, renderIsomorphicSync as J, unregisterComponent as K, updateDom as L, createStore as M, CallChainImpl as N, addElementEvent as O, areDomNodesEqual as P, checkElementVisibility as Q, REF_ATTRIBUTE_NAME as R, clearElementEvents as S, deepEquals as T, dequery as U, domNodeToVNode as V, emptyImpl as W, XLINK_ATTRIBUTE_NAME as X, getAllFormValues as Y, getDefaultDequeryOptions as Z, getEventMap as _, CLASS_ATTRIBUTE_NAME as a, getMimeType as a0, htmlStringToVNodes as a1, isDequery as a2, isDequeryOptionsObject as a3, isHTML as a4, isMarkup as a5, isSVG as a6, parseDOM as a7, processAllFormElements as a8, queueCallback as a9, removeElementEvent as aa, renderMarkup as ab, replaceDomWithVdom as ac, scrollHelper as ad, shallowEquals as ae, updateDomWithVdom as af, waitForDOM as ag, webstorage as ah, DEFAULT_TRANSITION_CONFIG as b, XMLNS_ATTRIBUTE_NAME as c, applyStyles as d, clearDelegatedEvents as e, clearDelegatedEventsDeep as f, createInPlaceErrorMessageVNode as g, createRef as h, getComponentInstance as i, getRegisteredEventKeys as j, getRegisteredEventTypes as k, getRenderer as l, getTransitionStyles as m, globalScopeDomApis as n, handleLifecycleEventsForOnMount as o, isComponentRoot as p, isJSX as q, isRef as r, jsx as s, jsxDEV as t, jsxs as u, nsMap as v, observeUnmount as w, parseEventPropName as x, performTransition as y, registerComponent as z };
2568
+ export { $, getTransitionStyles as A, globalScopeDomApis as B, CAPTURE_ONLY_EVENTS as C, DANGEROUSLY_SET_INNER_HTML_ATTRIBUTE as D, handleLifecycleEventsForOnMount as E, Fragment as F, htmlStringToVNodes as G, isComponentRoot as H, isDequery as I, isDequeryOptionsObject as J, isHTML as K, isJSX as L, isMarkup as M, isRef as N, isSVG as O, jsx as P, jsxDEV as Q, REF_ATTRIBUTE_NAME as R, jsxs as S, nsMap as T, observeUnmount as U, parseDOM as V, parseEventPropName as W, XLINK_ATTRIBUTE_NAME as X, performTransition as Y, processAllFormElements as Z, queueCallback as _, CLASS_ATTRIBUTE_NAME as a, reactive as a0, registerComponent as a1, registerDelegatedEvent as a2, removeDelegatedEvent as a3, removeDelegatedEventByKey as a4, removeElementEvent as a5, render as a6, renderInto as a7, renderIsomorphicAsync as a8, renderIsomorphicSync as a9, renderMarkup as aa, replaceDomWithVdom as ab, scrollHelper as ac, shallowEquals as ad, unregisterComponent as ae, updateDom as af, updateDomWithVdom as ag, waitForDOM as ah, webstorage as ai, CallChainImpl as b, DEFAULT_TRANSITION_CONFIG as c, XMLNS_ATTRIBUTE_NAME as d, addElementEvent as e, applyStyles as f, areDomNodesEqual as g, checkElementVisibility as h, clearDelegatedEvents as i, clearDelegatedEventsDeep as j, clearElementEvents as k, createInPlaceErrorMessageVNode as l, createRef as m, createStore as n, deepEquals as o, dequery as p, domNodeToVNode as q, emptyImpl as r, getAllFormValues as s, getComponentInstance as t, getDefaultDequeryOptions as u, getEventMap as v, getMimeType as w, getRegisteredEventKeys as x, getRegisteredEventTypes as y, getRenderer as z };