@novely/solid-renderer 0.36.0-experemental → 0.36.1

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.
Files changed (2) hide show
  1. package/dist/index.jsx +265 -352
  2. package/package.json +3 -3
package/dist/index.jsx CHANGED
@@ -1,15 +1,25 @@
1
- // ../../node_modules/.pnpm/solid-js@1.8.18/node_modules/solid-js/dist/solid.js
1
+ // ../../node_modules/.pnpm/solid-js@1.8.19/node_modules/solid-js/dist/solid.js
2
2
  var sharedConfig = {
3
3
  context: void 0,
4
- registry: void 0
4
+ registry: void 0,
5
+ getContextId() {
6
+ return getContextId(this.context.count);
7
+ },
8
+ getNextContextId() {
9
+ return getContextId(this.context.count++);
10
+ }
5
11
  };
12
+ function getContextId(count) {
13
+ const num = String(count), len = num.length - 1;
14
+ return sharedConfig.context.id + (len ? String.fromCharCode(96 + len) : "") + num;
15
+ }
6
16
  function setHydrateContext(context) {
7
17
  sharedConfig.context = context;
8
18
  }
9
19
  function nextHydrateContext() {
10
20
  return {
11
21
  ...sharedConfig.context,
12
- id: `${sharedConfig.context.id}${sharedConfig.context.count++}-`,
22
+ id: sharedConfig.getNextContextId(),
13
23
  count: 0
14
24
  };
15
25
  }
@@ -216,7 +226,8 @@ function createContext(defaultValue, options) {
216
226
  };
217
227
  }
218
228
  function useContext(context) {
219
- return Owner && Owner.context && Owner.context[context.id] !== void 0 ? Owner.context[context.id] : context.defaultValue;
229
+ let value;
230
+ return Owner && Owner.context && (value = Owner.context[context.id]) !== void 0 ? value : context.defaultValue;
220
231
  }
221
232
  function children(fn) {
222
233
  const children2 = createMemo(fn);
@@ -310,11 +321,7 @@ function updateComputation(node) {
310
321
  return;
311
322
  cleanNode(node);
312
323
  const time = ExecCount;
313
- runComputation(
314
- node,
315
- Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value,
316
- time
317
- );
324
+ runComputation(node, Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value, time);
318
325
  if (Transition && !Transition.running && Transition.sources.has(node)) {
319
326
  queueMicrotask(() => {
320
327
  runUpdates(() => {
@@ -692,16 +699,13 @@ function resolveChildren(children2) {
692
699
  function createProvider(id, options) {
693
700
  return function provider(props) {
694
701
  let res;
695
- createRenderEffect(
696
- () => res = untrack(() => {
697
- Owner.context = {
698
- ...Owner.context,
699
- [id]: props.value
700
- };
701
- return children(() => props.children);
702
- }),
703
- void 0
704
- );
702
+ createRenderEffect(() => res = untrack(() => {
703
+ Owner.context = {
704
+ ...Owner.context,
705
+ [id]: props.value
706
+ };
707
+ return children(() => props.children);
708
+ }), void 0);
705
709
  return res;
706
710
  };
707
711
  }
@@ -727,10 +731,10 @@ function mapArray(list, mapFn, options = {}) {
727
731
  let items = [], mapped = [], disposers = [], len = 0, indexes = mapFn.length > 1 ? [] : null;
728
732
  onCleanup(() => dispose(disposers));
729
733
  return () => {
730
- let newItems = list() || [], i, j;
734
+ let newItems = list() || [], newLen = newItems.length, i, j;
731
735
  newItems[$TRACK];
732
736
  return untrack(() => {
733
- let newLen = newItems.length, newIndices, newIndicesNext, temp, tempdisposers, tempIndexes, start, end, newEnd, item;
737
+ let newIndices, newIndicesNext, temp, tempdisposers, tempIndexes, start, end, newEnd, item;
734
738
  if (newLen === 0) {
735
739
  if (len !== 0) {
736
740
  dispose(disposers);
@@ -875,31 +879,28 @@ function mergeProps(...sources) {
875
879
  sources[i] = typeof s === "function" ? (proxy = true, createMemo(s)) : s;
876
880
  }
877
881
  if (proxy) {
878
- return new Proxy(
879
- {
880
- get(property) {
881
- for (let i = sources.length - 1; i >= 0; i--) {
882
- const v = resolveSource(sources[i])[property];
883
- if (v !== void 0)
884
- return v;
885
- }
886
- },
887
- has(property) {
888
- for (let i = sources.length - 1; i >= 0; i--) {
889
- if (property in resolveSource(sources[i]))
890
- return true;
891
- }
892
- return false;
893
- },
894
- keys() {
895
- const keys2 = [];
896
- for (let i = 0; i < sources.length; i++)
897
- keys2.push(...Object.keys(resolveSource(sources[i])));
898
- return [...new Set(keys2)];
882
+ return new Proxy({
883
+ get(property) {
884
+ for (let i = sources.length - 1; i >= 0; i--) {
885
+ const v = resolveSource(sources[i])[property];
886
+ if (v !== void 0)
887
+ return v;
899
888
  }
900
889
  },
901
- propTraps
902
- );
890
+ has(property) {
891
+ for (let i = sources.length - 1; i >= 0; i--) {
892
+ if (property in resolveSource(sources[i]))
893
+ return true;
894
+ }
895
+ return false;
896
+ },
897
+ keys() {
898
+ const keys2 = [];
899
+ for (let i = 0; i < sources.length; i++)
900
+ keys2.push(...Object.keys(resolveSource(sources[i])));
901
+ return [...new Set(keys2)];
902
+ }
903
+ }, propTraps);
903
904
  }
904
905
  const sourcesMap = {};
905
906
  const defined = /* @__PURE__ */ Object.create(null);
@@ -945,37 +946,29 @@ function splitProps(props, ...keys2) {
945
946
  if ($PROXY in props) {
946
947
  const blocked = new Set(keys2.length > 1 ? keys2.flat() : keys2[0]);
947
948
  const res = keys2.map((k) => {
948
- return new Proxy(
949
- {
950
- get(property) {
951
- return k.includes(property) ? props[property] : void 0;
952
- },
953
- has(property) {
954
- return k.includes(property) && property in props;
955
- },
956
- keys() {
957
- return k.filter((property) => property in props);
958
- }
949
+ return new Proxy({
950
+ get(property) {
951
+ return k.includes(property) ? props[property] : void 0;
959
952
  },
960
- propTraps
961
- );
962
- });
963
- res.push(
964
- new Proxy(
965
- {
966
- get(property) {
967
- return blocked.has(property) ? void 0 : props[property];
968
- },
969
- has(property) {
970
- return blocked.has(property) ? false : property in props;
971
- },
972
- keys() {
973
- return Object.keys(props).filter((k) => !blocked.has(k));
974
- }
953
+ has(property) {
954
+ return k.includes(property) && property in props;
975
955
  },
976
- propTraps
977
- )
978
- );
956
+ keys() {
957
+ return k.filter((property) => property in props);
958
+ }
959
+ }, propTraps);
960
+ });
961
+ res.push(new Proxy({
962
+ get(property) {
963
+ return blocked.has(property) ? void 0 : props[property];
964
+ },
965
+ has(property) {
966
+ return blocked.has(property) ? false : property in props;
967
+ },
968
+ keys() {
969
+ return Object.keys(props).filter((k) => !blocked.has(k));
970
+ }
971
+ }, propTraps));
979
972
  return res;
980
973
  }
981
974
  const otherObject = {};
@@ -1001,7 +994,7 @@ function splitProps(props, ...keys2) {
1001
994
  var counter = 0;
1002
995
  function createUniqueId() {
1003
996
  const ctx = sharedConfig.context;
1004
- return ctx ? `${ctx.id}${ctx.count++}` : `cl-${counter++}`;
997
+ return ctx ? sharedConfig.getNextContextId() : `cl-${counter++}`;
1005
998
  }
1006
999
  var narrowedError = (name) => `Stale read from <${name}>.`;
1007
1000
  function For(props) {
@@ -1015,120 +1008,59 @@ function Show(props) {
1015
1008
  const condition = createMemo(() => props.when, void 0, {
1016
1009
  equals: (a, b) => keyed ? a === b : !a === !b
1017
1010
  });
1018
- return createMemo(
1019
- () => {
1020
- const c = condition();
1021
- if (c) {
1022
- const child = props.children;
1023
- const fn = typeof child === "function" && child.length > 0;
1024
- return fn ? untrack(
1025
- () => child(
1026
- keyed ? c : () => {
1027
- if (!untrack(condition))
1028
- throw narrowedError("Show");
1029
- return props.when;
1030
- }
1031
- )
1032
- ) : child;
1033
- }
1034
- return props.fallback;
1035
- },
1036
- void 0,
1037
- void 0
1038
- );
1011
+ return createMemo(() => {
1012
+ const c = condition();
1013
+ if (c) {
1014
+ const child = props.children;
1015
+ const fn = typeof child === "function" && child.length > 0;
1016
+ return fn ? untrack(() => child(keyed ? c : () => {
1017
+ if (!untrack(condition))
1018
+ throw narrowedError("Show");
1019
+ return props.when;
1020
+ })) : child;
1021
+ }
1022
+ return props.fallback;
1023
+ }, void 0, void 0);
1039
1024
  }
1040
1025
  function Switch(props) {
1041
1026
  let keyed = false;
1042
1027
  const equals = (a, b) => (keyed ? a[1] === b[1] : !a[1] === !b[1]) && a[2] === b[2];
1043
- const conditions = children(() => props.children), evalConditions = createMemo(
1044
- () => {
1045
- let conds = conditions();
1046
- if (!Array.isArray(conds))
1047
- conds = [conds];
1048
- for (let i = 0; i < conds.length; i++) {
1049
- const c = conds[i].when;
1050
- if (c) {
1051
- keyed = !!conds[i].keyed;
1052
- return [i, c, conds[i]];
1053
- }
1028
+ const conditions = children(() => props.children), evalConditions = createMemo(() => {
1029
+ let conds = conditions();
1030
+ if (!Array.isArray(conds))
1031
+ conds = [conds];
1032
+ for (let i = 0; i < conds.length; i++) {
1033
+ const c = conds[i].when;
1034
+ if (c) {
1035
+ keyed = !!conds[i].keyed;
1036
+ return [i, c, conds[i]];
1054
1037
  }
1055
- return [-1];
1056
- },
1057
- void 0,
1058
- {
1059
- equals
1060
1038
  }
1061
- );
1062
- return createMemo(
1063
- () => {
1064
- const [index, when, cond] = evalConditions();
1065
- if (index < 0)
1066
- return props.fallback;
1067
- const c = cond.children;
1068
- const fn = typeof c === "function" && c.length > 0;
1069
- return fn ? untrack(
1070
- () => c(
1071
- keyed ? when : () => {
1072
- if (untrack(evalConditions)[0] !== index)
1073
- throw narrowedError("Match");
1074
- return cond.when;
1075
- }
1076
- )
1077
- ) : c;
1078
- },
1079
- void 0,
1080
- void 0
1081
- );
1039
+ return [-1];
1040
+ }, void 0, {
1041
+ equals
1042
+ });
1043
+ return createMemo(() => {
1044
+ const [index, when, cond] = evalConditions();
1045
+ if (index < 0)
1046
+ return props.fallback;
1047
+ const c = cond.children;
1048
+ const fn = typeof c === "function" && c.length > 0;
1049
+ return fn ? untrack(() => c(keyed ? when : () => {
1050
+ if (untrack(evalConditions)[0] !== index)
1051
+ throw narrowedError("Match");
1052
+ return cond.when;
1053
+ })) : c;
1054
+ }, void 0, void 0);
1082
1055
  }
1083
1056
  function Match(props) {
1084
1057
  return props;
1085
1058
  }
1086
- var SuspenseListContext = createContext();
1087
1059
 
1088
- // ../../node_modules/.pnpm/solid-js@1.8.18/node_modules/solid-js/web/dist/web.js
1089
- var booleans = [
1090
- "allowfullscreen",
1091
- "async",
1092
- "autofocus",
1093
- "autoplay",
1094
- "checked",
1095
- "controls",
1096
- "default",
1097
- "disabled",
1098
- "formnovalidate",
1099
- "hidden",
1100
- "indeterminate",
1101
- "inert",
1102
- "ismap",
1103
- "loop",
1104
- "multiple",
1105
- "muted",
1106
- "nomodule",
1107
- "novalidate",
1108
- "open",
1109
- "playsinline",
1110
- "readonly",
1111
- "required",
1112
- "reversed",
1113
- "seamless",
1114
- "selected"
1115
- ];
1116
- var Properties = /* @__PURE__ */ new Set([
1117
- "className",
1118
- "value",
1119
- "readOnly",
1120
- "formNoValidate",
1121
- "isMap",
1122
- "noModule",
1123
- "playsInline",
1124
- ...booleans
1125
- ]);
1126
- var ChildProperties = /* @__PURE__ */ new Set([
1127
- "innerHTML",
1128
- "textContent",
1129
- "innerText",
1130
- "children"
1131
- ]);
1060
+ // ../../node_modules/.pnpm/solid-js@1.8.19/node_modules/solid-js/web/dist/web.js
1061
+ var booleans = ["allowfullscreen", "async", "autofocus", "autoplay", "checked", "controls", "default", "disabled", "formnovalidate", "hidden", "indeterminate", "inert", "ismap", "loop", "multiple", "muted", "nomodule", "novalidate", "open", "playsinline", "readonly", "required", "reversed", "seamless", "selected"];
1062
+ var Properties = /* @__PURE__ */ new Set(["className", "value", "readOnly", "formNoValidate", "isMap", "noModule", "playsInline", ...booleans]);
1063
+ var ChildProperties = /* @__PURE__ */ new Set(["innerHTML", "textContent", "innerText", "children"]);
1132
1064
  var Aliases = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(null), {
1133
1065
  className: "class",
1134
1066
  htmlFor: "for"
@@ -1162,30 +1094,7 @@ function getPropAlias(prop, tagName) {
1162
1094
  const a = PropAliases[prop];
1163
1095
  return typeof a === "object" ? a[tagName] ? a["$"] : void 0 : a;
1164
1096
  }
1165
- var DelegatedEvents = /* @__PURE__ */ new Set([
1166
- "beforeinput",
1167
- "click",
1168
- "dblclick",
1169
- "contextmenu",
1170
- "focusin",
1171
- "focusout",
1172
- "input",
1173
- "keydown",
1174
- "keyup",
1175
- "mousedown",
1176
- "mousemove",
1177
- "mouseout",
1178
- "mouseover",
1179
- "mouseup",
1180
- "pointerdown",
1181
- "pointermove",
1182
- "pointerout",
1183
- "pointerover",
1184
- "pointerup",
1185
- "touchend",
1186
- "touchmove",
1187
- "touchstart"
1188
- ]);
1097
+ var DelegatedEvents = /* @__PURE__ */ new Set(["beforeinput", "click", "dblclick", "contextmenu", "focusin", "focusout", "input", "keydown", "keyup", "mousedown", "mousemove", "mouseout", "mouseover", "mouseup", "pointerdown", "pointermove", "pointerout", "pointerover", "pointerup", "touchend", "touchmove", "touchstart"]);
1189
1098
  var SVGNamespace = {
1190
1099
  xlink: "http://www.w3.org/1999/xlink",
1191
1100
  xml: "http://www.w3.org/XML/1998/namespace"
@@ -1361,13 +1270,9 @@ function style(node, value, prev) {
1361
1270
  function spread(node, props = {}, isSVG, skipChildren) {
1362
1271
  const prevProps = {};
1363
1272
  if (!skipChildren) {
1364
- createRenderEffect(
1365
- () => prevProps.children = insertExpression(node, props.children, prevProps.children)
1366
- );
1273
+ createRenderEffect(() => prevProps.children = insertExpression(node, props.children, prevProps.children));
1367
1274
  }
1368
- createRenderEffect(
1369
- () => typeof props.ref === "function" ? use(props.ref, node) : props.ref = node
1370
- );
1275
+ createRenderEffect(() => typeof props.ref === "function" && use(props.ref, node));
1371
1276
  createRenderEffect(() => assign(node, props, isSVG, true, prevProps, true));
1372
1277
  return prevProps;
1373
1278
  }
@@ -1604,11 +1509,7 @@ function normalizeIncomingArray(normalized, array, current, unwrap) {
1604
1509
  if (unwrap) {
1605
1510
  while (typeof item === "function")
1606
1511
  item = item();
1607
- dynamic = normalizeIncomingArray(
1608
- normalized,
1609
- Array.isArray(item) ? item : [item],
1610
- Array.isArray(prev) ? prev : [prev]
1611
- ) || dynamic;
1512
+ dynamic = normalizeIncomingArray(normalized, Array.isArray(item) ? item : [item], Array.isArray(prev) ? prev : [prev]) || dynamic;
1612
1513
  } else {
1613
1514
  normalized.push(item);
1614
1515
  dynamic = true;
@@ -1655,51 +1556,49 @@ function createElement(tagName, isSVG = false) {
1655
1556
  return isSVG ? document.createElementNS(SVG_NAMESPACE, tagName) : document.createElement(tagName);
1656
1557
  }
1657
1558
  function Portal(props) {
1658
- const { useShadow } = props, marker = document.createTextNode(""), mount = () => props.mount || document.body, owner = getOwner();
1559
+ const {
1560
+ useShadow
1561
+ } = props, marker = document.createTextNode(""), mount = () => props.mount || document.body, owner = getOwner();
1659
1562
  let content;
1660
1563
  let hydrating = !!sharedConfig.context;
1661
- createEffect(
1662
- () => {
1663
- if (hydrating)
1664
- getOwner().user = hydrating = false;
1665
- content || (content = runWithOwner(owner, () => createMemo(() => props.children)));
1666
- const el = mount();
1667
- if (el instanceof HTMLHeadElement) {
1668
- const [clean2, setClean] = createSignal(false);
1669
- const cleanup = () => setClean(true);
1670
- createRoot((dispose2) => insert(el, () => !clean2() ? content() : dispose2(), null));
1671
- onCleanup(cleanup);
1672
- } else {
1673
- const container = createElement(props.isSVG ? "g" : "div", props.isSVG), renderRoot = useShadow && container.attachShadow ? container.attachShadow({
1674
- mode: "open"
1675
- }) : container;
1676
- Object.defineProperty(container, "_$host", {
1677
- get() {
1678
- return marker.parentNode;
1679
- },
1680
- configurable: true
1681
- });
1682
- insert(renderRoot, content);
1683
- el.appendChild(container);
1684
- props.ref && props.ref(container);
1685
- onCleanup(() => el.removeChild(container));
1686
- }
1687
- },
1688
- void 0,
1689
- {
1690
- render: !hydrating
1564
+ createEffect(() => {
1565
+ if (hydrating)
1566
+ getOwner().user = hydrating = false;
1567
+ content || (content = runWithOwner(owner, () => createMemo(() => props.children)));
1568
+ const el = mount();
1569
+ if (el instanceof HTMLHeadElement) {
1570
+ const [clean2, setClean] = createSignal(false);
1571
+ const cleanup = () => setClean(true);
1572
+ createRoot((dispose2) => insert(el, () => !clean2() ? content() : dispose2(), null));
1573
+ onCleanup(cleanup);
1574
+ } else {
1575
+ const container = createElement(props.isSVG ? "g" : "div", props.isSVG), renderRoot = useShadow && container.attachShadow ? container.attachShadow({
1576
+ mode: "open"
1577
+ }) : container;
1578
+ Object.defineProperty(container, "_$host", {
1579
+ get() {
1580
+ return marker.parentNode;
1581
+ },
1582
+ configurable: true
1583
+ });
1584
+ insert(renderRoot, content);
1585
+ el.appendChild(container);
1586
+ props.ref && props.ref(container);
1587
+ onCleanup(() => el.removeChild(container));
1691
1588
  }
1692
- );
1589
+ }, void 0, {
1590
+ render: !hydrating
1591
+ });
1693
1592
  return marker;
1694
1593
  }
1695
1594
 
1696
- // ../../node_modules/.pnpm/nanostores@0.10.3/node_modules/nanostores/task/index.js
1595
+ // ../../node_modules/.pnpm/nanostores@0.11.2/node_modules/nanostores/task/index.js
1697
1596
  var tasks = 0;
1698
1597
  function cleanTasks() {
1699
1598
  tasks = 0;
1700
1599
  }
1701
1600
 
1702
- // ../../node_modules/.pnpm/nanostores@0.10.3/node_modules/nanostores/clean-stores/index.js
1601
+ // ../../node_modules/.pnpm/nanostores@0.11.2/node_modules/nanostores/clean-stores/index.js
1703
1602
  var clean = Symbol("clean");
1704
1603
  var cleanStores = (...stores) => {
1705
1604
  if (false) {
@@ -1718,9 +1617,12 @@ var cleanStores = (...stores) => {
1718
1617
  }
1719
1618
  };
1720
1619
 
1721
- // ../../node_modules/.pnpm/nanostores@0.10.3/node_modules/nanostores/atom/index.js
1620
+ // ../../node_modules/.pnpm/nanostores@0.11.2/node_modules/nanostores/atom/index.js
1722
1621
  var listenerQueue = [];
1723
- var atom = (initialValue, level) => {
1622
+ var lqIndex = 0;
1623
+ var QUEUE_ITEMS_PER_LISTENER = 4;
1624
+ var epoch = 0;
1625
+ var atom = (initialValue) => {
1724
1626
  let listeners = [];
1725
1627
  let $atom = {
1726
1628
  get() {
@@ -1730,51 +1632,43 @@ var atom = (initialValue, level) => {
1730
1632
  }
1731
1633
  return $atom.value;
1732
1634
  },
1733
- l: level || 0,
1734
1635
  lc: 0,
1735
- listen(listener, listenerLevel) {
1736
- $atom.lc = listeners.push(listener, listenerLevel || $atom.l) / 2;
1636
+ listen(listener) {
1637
+ $atom.lc = listeners.push(listener);
1737
1638
  return () => {
1639
+ for (let i = lqIndex + QUEUE_ITEMS_PER_LISTENER; i < listenerQueue.length; ) {
1640
+ if (listenerQueue[i] === listener) {
1641
+ listenerQueue.splice(i, QUEUE_ITEMS_PER_LISTENER);
1642
+ } else {
1643
+ i += QUEUE_ITEMS_PER_LISTENER;
1644
+ }
1645
+ }
1738
1646
  let index = listeners.indexOf(listener);
1739
1647
  if (~index) {
1740
- listeners.splice(index, 2);
1648
+ listeners.splice(index, 1);
1741
1649
  if (!--$atom.lc)
1742
1650
  $atom.off();
1743
1651
  }
1744
1652
  };
1745
1653
  },
1746
1654
  notify(oldValue, changedKey) {
1655
+ epoch++;
1747
1656
  let runListenerQueue = !listenerQueue.length;
1748
- for (let i = 0; i < listeners.length; i += 2) {
1657
+ for (let listener of listeners) {
1749
1658
  listenerQueue.push(
1750
- listeners[i],
1751
- listeners[i + 1],
1659
+ listener,
1752
1660
  $atom.value,
1753
1661
  oldValue,
1754
1662
  changedKey
1755
1663
  );
1756
1664
  }
1757
1665
  if (runListenerQueue) {
1758
- for (let i = 0; i < listenerQueue.length; i += 5) {
1759
- let skip;
1760
- for (let j = i + 1; !skip && (j += 5) < listenerQueue.length; ) {
1761
- if (listenerQueue[j] < listenerQueue[i + 1]) {
1762
- skip = listenerQueue.push(
1763
- listenerQueue[i],
1764
- listenerQueue[i + 1],
1765
- listenerQueue[i + 2],
1766
- listenerQueue[i + 3],
1767
- listenerQueue[i + 4]
1768
- );
1769
- }
1770
- }
1771
- if (!skip) {
1772
- listenerQueue[i](
1773
- listenerQueue[i + 2],
1774
- listenerQueue[i + 3],
1775
- listenerQueue[i + 4]
1776
- );
1777
- }
1666
+ for (lqIndex = 0; lqIndex < listenerQueue.length; lqIndex += QUEUE_ITEMS_PER_LISTENER) {
1667
+ listenerQueue[lqIndex](
1668
+ listenerQueue[lqIndex + 1],
1669
+ listenerQueue[lqIndex + 2],
1670
+ listenerQueue[lqIndex + 3]
1671
+ );
1778
1672
  }
1779
1673
  listenerQueue.length = 0;
1780
1674
  }
@@ -1790,8 +1684,8 @@ var atom = (initialValue, level) => {
1790
1684
  $atom.notify(oldValue);
1791
1685
  }
1792
1686
  },
1793
- subscribe(listener, listenerLevel) {
1794
- let unbind = $atom.listen(listener, listenerLevel);
1687
+ subscribe(listener) {
1688
+ let unbind = $atom.listen(listener);
1795
1689
  listener($atom.value);
1796
1690
  return unbind;
1797
1691
  },
@@ -1807,7 +1701,7 @@ var atom = (initialValue, level) => {
1807
1701
  return $atom;
1808
1702
  };
1809
1703
 
1810
- // ../../node_modules/.pnpm/nanostores@0.10.3/node_modules/nanostores/lifecycle/index.js
1704
+ // ../../node_modules/.pnpm/nanostores@0.11.2/node_modules/nanostores/lifecycle/index.js
1811
1705
  var MOUNT = 5;
1812
1706
  var UNMOUNT = 6;
1813
1707
  var REVERT_MUTATION = 10;
@@ -1880,7 +1774,7 @@ var onMount2 = ($store, initialize) => {
1880
1774
  });
1881
1775
  };
1882
1776
 
1883
- // ../../node_modules/.pnpm/nanostores@0.10.3/node_modules/nanostores/deep-map/path.js
1777
+ // ../../node_modules/.pnpm/nanostores@0.11.2/node_modules/nanostores/deep-map/path.js
1884
1778
  function getPath(obj, path) {
1885
1779
  let allKeys = getAllKeysFromPath(path);
1886
1780
  let res = obj;
@@ -1897,11 +1791,10 @@ function setPath(obj, path, value) {
1897
1791
  }
1898
1792
  function setByKey(obj, splittedKeys, value) {
1899
1793
  let key = splittedKeys[0];
1900
- ensureKey(obj, key, splittedKeys[1]);
1901
1794
  let copy = Array.isArray(obj) ? [...obj] : { ...obj };
1902
1795
  if (splittedKeys.length === 1) {
1903
1796
  if (value === void 0) {
1904
- if (Array.isArray(obj)) {
1797
+ if (Array.isArray(copy)) {
1905
1798
  copy.splice(key, 1);
1906
1799
  } else {
1907
1800
  delete copy[key];
@@ -1911,9 +1804,9 @@ function setByKey(obj, splittedKeys, value) {
1911
1804
  }
1912
1805
  return copy;
1913
1806
  }
1914
- let newVal = setByKey(obj[key], splittedKeys.slice(1), value);
1915
- obj[key] = newVal;
1916
- return obj;
1807
+ ensureKey(copy, key, splittedKeys[1]);
1808
+ copy[key] = setByKey(copy[key], splittedKeys.slice(1), value);
1809
+ return copy;
1917
1810
  }
1918
1811
  var ARRAY_INDEX = /(.*)\[(\d+)\]/;
1919
1812
  function getAllKeysFromPath(path) {
@@ -1933,24 +1826,19 @@ function ensureKey(obj, key, nextKey) {
1933
1826
  }
1934
1827
  let isNum = IS_NUMBER.test(nextKey);
1935
1828
  if (isNum) {
1936
- obj[key] = Array(parseInt(nextKey, 10) + 1).fill(void 0);
1829
+ obj[key] = Array(parseInt(nextKey, 10) + 1);
1937
1830
  } else {
1938
1831
  obj[key] = {};
1939
1832
  }
1940
1833
  }
1941
1834
 
1942
- // ../../node_modules/.pnpm/nanostores@0.10.3/node_modules/nanostores/deep-map/index.js
1835
+ // ../../node_modules/.pnpm/nanostores@0.11.2/node_modules/nanostores/deep-map/index.js
1943
1836
  function deepMap(initial = {}) {
1944
1837
  let $deepMap = atom(initial);
1945
1838
  $deepMap.setKey = (key, value) => {
1946
- let oldValue;
1947
- try {
1948
- oldValue = structuredClone($deepMap.value);
1949
- } catch {
1950
- oldValue = { ...$deepMap.value };
1951
- }
1952
1839
  if (getPath($deepMap.value, key) !== value) {
1953
- $deepMap.value = { ...setPath($deepMap.value, key, value) };
1840
+ let oldValue = $deepMap.value;
1841
+ $deepMap.value = setPath($deepMap.value, key, value);
1954
1842
  $deepMap.notify(oldValue, key);
1955
1843
  }
1956
1844
  };
@@ -2176,7 +2064,7 @@ function validateConcurrency(concurrency) {
2176
2064
  }
2177
2065
  }
2178
2066
 
2179
- // ../../node_modules/.pnpm/simple-web-audio@0.6.0_postcss@8.4.32/node_modules/simple-web-audio/dist/index.mjs
2067
+ // ../../node_modules/.pnpm/simple-web-audio@0.7.0_postcss@8.4.32/node_modules/simple-web-audio/dist/index.mjs
2180
2068
  var waitForInteraction = (() => {
2181
2069
  const { promise, resolve } = Promise.withResolvers();
2182
2070
  const onUserInteraction = () => {
@@ -2216,14 +2104,22 @@ addEventListener("blur", function(event) {
2216
2104
  }
2217
2105
  }
2218
2106
  });
2219
- var createQueue = (queue) => {
2107
+ var createQueue = (queue, stopped = false) => {
2220
2108
  const limit = pLimit(1);
2221
2109
  const run = async () => {
2222
2110
  const items = queue.slice();
2223
2111
  for await (const item of items) {
2224
- await item();
2112
+ if (stopped)
2113
+ break;
2114
+ try {
2115
+ await item();
2116
+ } catch (error) {
2117
+ console.error(error);
2118
+ stopped = true;
2119
+ }
2225
2120
  }
2226
2121
  queue = queue.filter((item) => !items.includes(item));
2122
+ stopped = false;
2227
2123
  };
2228
2124
  return {
2229
2125
  get queue() {
@@ -2232,6 +2128,9 @@ var createQueue = (queue) => {
2232
2128
  set queue(value) {
2233
2129
  queue = value;
2234
2130
  },
2131
+ stop() {
2132
+ stopped = true;
2133
+ },
2235
2134
  execute: () => {
2236
2135
  return limit(run);
2237
2136
  }
@@ -2259,14 +2158,17 @@ var createAudio = (options) => {
2259
2158
  let bufferSource;
2260
2159
  let arrayBuffer;
2261
2160
  let audioBuffer;
2161
+ let pendingVolume = options.volume || 1;
2162
+ let pendingLoop = options.loop || false;
2262
2163
  const createAudioContext = () => {
2263
2164
  audioContext = new AudioContext();
2264
2165
  };
2166
+ const getGainNode = () => {
2167
+ return gainNode;
2168
+ };
2265
2169
  const createGainNode = () => {
2266
2170
  gainNode = audioContext.createGain();
2267
- gainNode.gain.value = options.volume || 1;
2268
- const extendAudioGraph = options.extendAudioGraph || (() => gainNode);
2269
- const node = extendAudioGraph({
2171
+ const node = (options.extendAudioGraph || getGainNode)({
2270
2172
  context: audioContext,
2271
2173
  node: gainNode
2272
2174
  });
@@ -2274,31 +2176,51 @@ var createAudio = (options) => {
2274
2176
  };
2275
2177
  const createBufferSource = () => {
2276
2178
  bufferSource = audioContext.createBufferSource();
2277
- bufferSource.loop = options.loop || false;
2278
2179
  };
2279
- const fetchArrayBuffer = fetcherMemo(options.src, () => {
2280
- return fetch(options.src).then((res) => res.arrayBuffer());
2180
+ const interruptQueueThenDestroy = (cause) => {
2181
+ queue.stop();
2182
+ instance.destroy();
2183
+ return new Error("", { cause });
2184
+ };
2185
+ const fetchArrayBuffer = fetcherMemo(options.src, async () => {
2186
+ try {
2187
+ return await fetch(options.src).then((response) => response.arrayBuffer());
2188
+ } catch (error) {
2189
+ throw interruptQueueThenDestroy(error);
2190
+ }
2281
2191
  });
2282
2192
  const setArrayBuffer = async () => {
2283
2193
  arrayBuffer = await fetchArrayBuffer();
2284
2194
  };
2285
- const decodeAudioData = decoderMemo(options.src, () => {
2286
- return audioContext.decodeAudioData(arrayBuffer);
2195
+ const decodeAudioData = decoderMemo(options.src, async () => {
2196
+ try {
2197
+ return await audioContext.decodeAudioData(arrayBuffer);
2198
+ } catch (error) {
2199
+ throw interruptQueueThenDestroy(error);
2200
+ }
2287
2201
  });
2288
2202
  const setAudioData = async () => {
2289
2203
  audioBuffer = await decodeAudioData();
2290
2204
  };
2291
2205
  const connectSources = () => {
2292
- if (bufferSource.buffer === null) {
2206
+ if (bufferSource && bufferSource.buffer === null) {
2293
2207
  bufferSource.buffer = audioBuffer;
2294
2208
  bufferSource.connect(gainNode);
2295
2209
  }
2296
2210
  };
2211
+ const setVolume = () => {
2212
+ gainNode.gain.value = pendingVolume;
2213
+ };
2214
+ const setLoop = () => {
2215
+ bufferSource.loop = pendingLoop;
2216
+ };
2297
2217
  const queue = createQueue([
2298
2218
  waitForInteraction,
2299
2219
  createAudioContext,
2300
2220
  createGainNode,
2221
+ setVolume,
2301
2222
  createBufferSource,
2223
+ setLoop,
2302
2224
  fetchArrayBuffer,
2303
2225
  setArrayBuffer,
2304
2226
  decodeAudioData,
@@ -2308,14 +2230,14 @@ var createAudio = (options) => {
2308
2230
  let resume = false;
2309
2231
  const unregister = registerEventListeners({
2310
2232
  focus: () => {
2311
- if (!options.pauseOnBlur || !resume)
2233
+ if (!options.pauseOnBlur || !resume || state.destroyed)
2312
2234
  return;
2313
2235
  resume = false;
2314
2236
  queue.queue.push(playAudio);
2315
2237
  queue.execute();
2316
2238
  },
2317
2239
  blur: () => {
2318
- if (!options.pauseOnBlur || !state.playing)
2240
+ if (!options.pauseOnBlur || !state.playing || state.destroyed)
2319
2241
  return;
2320
2242
  resume = true;
2321
2243
  queue.queue.push(pauseAudio);
@@ -2328,6 +2250,8 @@ var createAudio = (options) => {
2328
2250
  destroyed: false
2329
2251
  };
2330
2252
  const playAudio = async () => {
2253
+ if (state.destroyed)
2254
+ return;
2331
2255
  if (audioContext.state === "suspended") {
2332
2256
  await audioContext.resume();
2333
2257
  if (state.started) {
@@ -2341,6 +2265,8 @@ var createAudio = (options) => {
2341
2265
  }
2342
2266
  };
2343
2267
  const pauseAudio = async () => {
2268
+ if (state.destroyed)
2269
+ return;
2344
2270
  if (audioContext.state === "suspended" && queue.queue.at(-1) === playAudio) {
2345
2271
  queue.queue.pop();
2346
2272
  }
@@ -2350,35 +2276,22 @@ var createAudio = (options) => {
2350
2276
  }
2351
2277
  };
2352
2278
  const disconnectAudio = async () => {
2353
- bufferSource.disconnect();
2279
+ bufferSource && bufferSource.disconnect();
2354
2280
  state.started = false;
2355
2281
  };
2356
- if (options.autoplay) {
2357
- queue.queue.push(playAudio);
2358
- queue.execute();
2359
- }
2360
- return {
2361
- /**
2362
- * Play
2363
- */
2282
+ const instance = {
2364
2283
  async play() {
2365
2284
  if (state.destroyed)
2366
2285
  return;
2367
2286
  queue.queue.push(playAudio);
2368
2287
  return queue.execute();
2369
2288
  },
2370
- /**
2371
- * Pause
2372
- */
2373
2289
  async pause() {
2374
2290
  if (state.destroyed)
2375
2291
  return;
2376
2292
  queue.queue.push(pauseAudio);
2377
2293
  return queue.execute();
2378
2294
  },
2379
- /**
2380
- * Reset
2381
- */
2382
2295
  async reset() {
2383
2296
  if (state.destroyed)
2384
2297
  return;
@@ -2388,6 +2301,7 @@ var createAudio = (options) => {
2388
2301
  queue.queue.push(
2389
2302
  disconnectAudio,
2390
2303
  createBufferSource,
2304
+ setLoop,
2391
2305
  connectSources
2392
2306
  );
2393
2307
  if (state.playing) {
@@ -2395,9 +2309,6 @@ var createAudio = (options) => {
2395
2309
  }
2396
2310
  return queue.execute();
2397
2311
  },
2398
- /**
2399
- * Stop
2400
- */
2401
2312
  async stop() {
2402
2313
  if (state.destroyed)
2403
2314
  return;
@@ -2405,21 +2316,19 @@ var createAudio = (options) => {
2405
2316
  pauseAudio,
2406
2317
  disconnectAudio,
2407
2318
  createBufferSource,
2319
+ setLoop,
2408
2320
  connectSources
2409
2321
  );
2410
2322
  return queue.execute();
2411
2323
  },
2412
- /**
2413
- * Destroy
2414
- */
2415
2324
  async destroy() {
2416
2325
  if (state.destroyed)
2417
2326
  return;
2418
2327
  unregister();
2419
- queue.queue.push(
2328
+ queue.queue = [
2420
2329
  pauseAudio,
2421
2330
  disconnectAudio
2422
- );
2331
+ ];
2423
2332
  await queue.execute();
2424
2333
  state.destroyed = true;
2425
2334
  audioContext = null;
@@ -2433,25 +2342,38 @@ var createAudio = (options) => {
2433
2342
  return;
2434
2343
  await fetchArrayBuffer();
2435
2344
  },
2436
- /**
2437
- * Is currently playing
2438
- */
2439
2345
  get playing() {
2440
2346
  return state.playing;
2441
2347
  },
2348
+ get destroyed() {
2349
+ return state.destroyed;
2350
+ },
2442
2351
  get volume() {
2443
- return gainNode.gain.value;
2352
+ return pendingVolume;
2444
2353
  },
2445
2354
  set volume(value) {
2446
- gainNode.gain.value = value;
2355
+ if (state.destroyed)
2356
+ return;
2357
+ pendingVolume = value;
2358
+ queue.queue.push(setVolume);
2359
+ queue.execute();
2447
2360
  },
2448
2361
  get loop() {
2449
- return bufferSource.loop;
2362
+ return pendingLoop;
2450
2363
  },
2451
2364
  set loop(value) {
2452
- bufferSource.loop = value;
2365
+ if (state.destroyed)
2366
+ return;
2367
+ pendingLoop = value;
2368
+ queue.queue.push(setLoop);
2369
+ queue.execute();
2453
2370
  }
2454
2371
  };
2372
+ if (options.autoplay) {
2373
+ queue.queue.push(playAudio);
2374
+ queue.execute();
2375
+ }
2376
+ return instance;
2455
2377
  };
2456
2378
  var prefetchAudio = (src) => {
2457
2379
  const fetcher = fetcherMemo(src, () => fetch(src).then((res) => res.arrayBuffer()));
@@ -2512,16 +2434,7 @@ var deepAtom = (init) => {
2512
2434
  return newValue;
2513
2435
  }
2514
2436
  const oldValue = $atom.value;
2515
- const fakedPath = {
2516
- split: () => {
2517
- return {
2518
- flatMap: () => {
2519
- return path;
2520
- }
2521
- };
2522
- }
2523
- };
2524
- $atom.value = setPath($atom.value, fakedPath, newValue);
2437
+ $atom.value = setByKey($atom.value, path, newValue);
2525
2438
  $atom.notify(oldValue, path.join("."));
2526
2439
  return newValue;
2527
2440
  };
@@ -3647,7 +3560,7 @@ var Modal = (props) => {
3647
3560
  });
3648
3561
  };
3649
3562
 
3650
- // ../../node_modules/.pnpm/@solid-primitives+transition-group@1.0.5_solid-js@1.8.18/node_modules/@solid-primitives/transition-group/dist/index.js
3563
+ // ../../node_modules/.pnpm/@solid-primitives+transition-group@1.0.5_solid-js@1.8.19/node_modules/@solid-primitives/transition-group/dist/index.js
3651
3564
  var noop2 = () => {
3652
3565
  };
3653
3566
  var noopTransition = (el, done) => done();
@@ -3715,10 +3628,10 @@ function createSwitchTransition(source, options) {
3715
3628
  return returned;
3716
3629
  }
3717
3630
 
3718
- // ../../node_modules/.pnpm/@solid-primitives+utils@6.2.3_solid-js@1.8.18/node_modules/@solid-primitives/utils/dist/chunk/R5675YMU.js
3631
+ // ../../node_modules/.pnpm/@solid-primitives+utils@6.2.3_solid-js@1.8.19/node_modules/@solid-primitives/utils/dist/chunk/R5675YMU.js
3719
3632
  var access = (v) => typeof v === "function" && !v.length ? v() : v;
3720
3633
 
3721
- // ../../node_modules/.pnpm/@solid-primitives+refs@1.0.8_solid-js@1.8.18/node_modules/@solid-primitives/refs/dist/index.js
3634
+ // ../../node_modules/.pnpm/@solid-primitives+refs@1.0.8_solid-js@1.8.19/node_modules/@solid-primitives/refs/dist/index.js
3722
3635
  var defaultElementPredicate = isServer ? (item) => item != null && typeof item === "object" && "t" in item : (item) => item instanceof Element;
3723
3636
  function getFirstChild(value, predicate) {
3724
3637
  if (predicate(value))
@@ -3739,7 +3652,7 @@ function resolveFirst(fn, predicate = defaultElementPredicate, serverPredicate =
3739
3652
  return createMemo(() => getFirstChild(children2(), isServer ? serverPredicate : predicate));
3740
3653
  }
3741
3654
 
3742
- // ../../node_modules/.pnpm/solid-transition-group@0.2.3_solid-js@1.8.18/node_modules/solid-transition-group/dist/index.js
3655
+ // ../../node_modules/.pnpm/solid-transition-group@0.2.3_solid-js@1.8.19/node_modules/solid-transition-group/dist/index.js
3743
3656
  function createClassnames(props) {
3744
3657
  return createMemo(() => {
3745
3658
  const name = props.name || "s";
@@ -4342,7 +4255,7 @@ var Range = (props) => {
4342
4255
  })();
4343
4256
  };
4344
4257
 
4345
- // ../../node_modules/.pnpm/@solid-primitives+destructure@0.1.17_solid-js@1.8.18/node_modules/@solid-primitives/destructure/dist/index.js
4258
+ // ../../node_modules/.pnpm/@solid-primitives+destructure@0.1.17_solid-js@1.8.19/node_modules/@solid-primitives/destructure/dist/index.js
4346
4259
  var isReactiveObject = (value) => typeof value === "object" && value !== null;
4347
4260
  function createProxyCache(obj, get) {
4348
4261
  return new Proxy(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@novely/solid-renderer",
3
- "version": "0.36.0-experemental",
3
+ "version": "0.36.1",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -17,10 +17,10 @@
17
17
  "dependencies": {
18
18
  "@solid-primitives/destructure": "^0.1.17",
19
19
  "retrieved": "^0.1.0",
20
- "solid-js": "1.8.18",
20
+ "solid-js": "1.8.19",
21
21
  "solid-transition-group": "^0.2.3",
22
22
  "@novely/core": "0.38.2",
23
- "@novely/renderer-toolkit": "0.8.0-experemental",
23
+ "@novely/renderer-toolkit": "0.8.1",
24
24
  "@novely/typewriter": "0.5.1"
25
25
  },
26
26
  "peerDependencies": {