@tanstack/query-devtools 5.59.20 → 5.61.4

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,7 +1,9 @@
1
- // ../../node_modules/.pnpm/solid-js@1.8.19/node_modules/solid-js/dist/solid.js
1
+ // ../../node_modules/.pnpm/solid-js@1.9.3/node_modules/solid-js/dist/solid.js
2
2
  var sharedConfig = {
3
3
  context: void 0,
4
4
  registry: void 0,
5
+ effects: void 0,
6
+ done: false,
5
7
  getContextId() {
6
8
  return getContextId(this.context.count);
7
9
  },
@@ -25,6 +27,7 @@ function nextHydrateContext() {
25
27
  }
26
28
  var equalFn = (a, b) => a === b;
27
29
  var $PROXY = Symbol("solid-proxy");
30
+ var SUPPORTS_PROXY = typeof Proxy === "function";
28
31
  var $TRACK = Symbol("solid-track");
29
32
  var signalOptions = {
30
33
  equals: equalFn
@@ -141,20 +144,21 @@ function createResource(pSource, pFetcher, pOptions) {
141
144
  }), [state, setState] = createSignal(resolved ? "ready" : "unresolved");
142
145
  if (sharedConfig.context) {
143
146
  id = sharedConfig.getNextContextId();
144
- let v;
145
147
  if (options.ssrLoadFrom === "initial")
146
148
  initP = options.initialValue;
147
- else if (sharedConfig.load && (v = sharedConfig.load(id)))
148
- initP = v;
149
+ else if (sharedConfig.load && sharedConfig.has(id))
150
+ initP = sharedConfig.load(id);
149
151
  }
150
152
  function loadEnd(p, v, error2, key) {
151
153
  if (pr === p) {
152
154
  pr = null;
153
155
  key !== void 0 && (resolved = true);
154
156
  if ((p === initP || v === initP) && options.onHydrated)
155
- queueMicrotask(() => options.onHydrated(key, {
156
- value: v
157
- }));
157
+ queueMicrotask(
158
+ () => options.onHydrated(key, {
159
+ value: v
160
+ })
161
+ );
158
162
  initP = NO_INIT;
159
163
  if (Transition && p && loadedUnderTransition) {
160
164
  Transition.promises.delete(p);
@@ -210,10 +214,12 @@ function createResource(pSource, pFetcher, pOptions) {
210
214
  }
211
215
  if (Transition && pr)
212
216
  Transition.promises.delete(pr);
213
- const p = initP !== NO_INIT ? initP : untrack(() => fetcher(lookup, {
214
- value: value(),
215
- refetching
216
- }));
217
+ const p = initP !== NO_INIT ? initP : untrack(
218
+ () => fetcher(lookup, {
219
+ value: value(),
220
+ refetching
221
+ })
222
+ );
217
223
  if (!isPromise(p)) {
218
224
  loadEnd(pr, p, void 0, lookup);
219
225
  return p;
@@ -232,7 +238,10 @@ function createResource(pSource, pFetcher, pOptions) {
232
238
  setState(resolved ? "refreshing" : "pending");
233
239
  trigger();
234
240
  }, false);
235
- return p.then((v) => loadEnd(p, v, void 0, lookup), (e) => loadEnd(p, void 0, castError(e), lookup));
241
+ return p.then(
242
+ (v) => loadEnd(p, v, void 0, lookup),
243
+ (e) => loadEnd(p, void 0, castError(e), lookup)
244
+ );
236
245
  }
237
246
  Object.defineProperties(read, {
238
247
  state: {
@@ -262,10 +271,13 @@ function createResource(pSource, pFetcher, pOptions) {
262
271
  createComputed(() => load(false));
263
272
  else
264
273
  load(false);
265
- return [read, {
266
- refetch: load,
267
- mutate: setValue
268
- }];
274
+ return [
275
+ read,
276
+ {
277
+ refetch: load,
278
+ mutate: setValue
279
+ }
280
+ ];
269
281
  }
270
282
  function batch(fn) {
271
283
  return runUpdates(fn, false);
@@ -469,7 +481,11 @@ function updateComputation(node) {
469
481
  return;
470
482
  cleanNode(node);
471
483
  const time = ExecCount;
472
- runComputation(node, Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value, time);
484
+ runComputation(
485
+ node,
486
+ Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value,
487
+ time
488
+ );
473
489
  if (Transition && !Transition.running && Transition.sources.has(node)) {
474
490
  queueMicrotask(() => {
475
491
  runUpdates(() => {
@@ -709,13 +725,14 @@ function runUserEffects(queue) {
709
725
  sharedConfig.effects || (sharedConfig.effects = []);
710
726
  sharedConfig.effects.push(...queue.slice(0, userLength));
711
727
  return;
712
- } else if (sharedConfig.effects) {
713
- queue = [...sharedConfig.effects, ...queue];
714
- userLength += sharedConfig.effects.length;
715
- delete sharedConfig.effects;
716
728
  }
717
729
  setHydrateContext();
718
730
  }
731
+ if (sharedConfig.effects && (sharedConfig.done || !sharedConfig.count)) {
732
+ queue = [...sharedConfig.effects, ...queue];
733
+ userLength += sharedConfig.effects.length;
734
+ delete sharedConfig.effects;
735
+ }
719
736
  for (i = 0; i < userLength; i++)
720
737
  runTop(queue[i]);
721
738
  }
@@ -769,12 +786,12 @@ function cleanNode(node) {
769
786
  }
770
787
  }
771
788
  }
789
+ if (node.tOwned) {
790
+ for (i = node.tOwned.length - 1; i >= 0; i--)
791
+ cleanNode(node.tOwned[i]);
792
+ delete node.tOwned;
793
+ }
772
794
  if (Transition && Transition.running && node.pure) {
773
- if (node.tOwned) {
774
- for (i = node.tOwned.length - 1; i >= 0; i--)
775
- cleanNode(node.tOwned[i]);
776
- delete node.tOwned;
777
- }
778
795
  reset(node, true);
779
796
  } else if (node.owned) {
780
797
  for (i = node.owned.length - 1; i >= 0; i--)
@@ -847,13 +864,16 @@ function resolveChildren(children2) {
847
864
  function createProvider(id, options) {
848
865
  return function provider(props) {
849
866
  let res;
850
- createRenderEffect(() => res = untrack(() => {
851
- Owner.context = {
852
- ...Owner.context,
853
- [id]: props.value
854
- };
855
- return children(() => props.children);
856
- }), void 0);
867
+ createRenderEffect(
868
+ () => res = untrack(() => {
869
+ Owner.context = {
870
+ ...Owner.context,
871
+ [id]: props.value
872
+ };
873
+ return children(() => props.children);
874
+ }),
875
+ void 0
876
+ );
857
877
  return res;
858
878
  };
859
879
  }
@@ -1068,29 +1088,32 @@ function mergeProps(...sources) {
1068
1088
  proxy = proxy || !!s && $PROXY in s;
1069
1089
  sources[i] = typeof s === "function" ? (proxy = true, createMemo(s)) : s;
1070
1090
  }
1071
- if (proxy) {
1072
- return new Proxy({
1073
- get(property) {
1074
- for (let i = sources.length - 1; i >= 0; i--) {
1075
- const v = resolveSource(sources[i])[property];
1076
- if (v !== void 0)
1077
- return v;
1078
- }
1079
- },
1080
- has(property) {
1081
- for (let i = sources.length - 1; i >= 0; i--) {
1082
- if (property in resolveSource(sources[i]))
1083
- return true;
1091
+ if (SUPPORTS_PROXY && proxy) {
1092
+ return new Proxy(
1093
+ {
1094
+ get(property) {
1095
+ for (let i = sources.length - 1; i >= 0; i--) {
1096
+ const v = resolveSource(sources[i])[property];
1097
+ if (v !== void 0)
1098
+ return v;
1099
+ }
1100
+ },
1101
+ has(property) {
1102
+ for (let i = sources.length - 1; i >= 0; i--) {
1103
+ if (property in resolveSource(sources[i]))
1104
+ return true;
1105
+ }
1106
+ return false;
1107
+ },
1108
+ keys() {
1109
+ const keys = [];
1110
+ for (let i = 0; i < sources.length; i++)
1111
+ keys.push(...Object.keys(resolveSource(sources[i])));
1112
+ return [...new Set(keys)];
1084
1113
  }
1085
- return false;
1086
1114
  },
1087
- keys() {
1088
- const keys = [];
1089
- for (let i = 0; i < sources.length; i++)
1090
- keys.push(...Object.keys(resolveSource(sources[i])));
1091
- return [...new Set(keys)];
1092
- }
1093
- }, propTraps);
1115
+ propTraps
1116
+ );
1094
1117
  }
1095
1118
  const sourcesMap = {};
1096
1119
  const defined = /* @__PURE__ */ Object.create(null);
@@ -1133,32 +1156,40 @@ function mergeProps(...sources) {
1133
1156
  return target;
1134
1157
  }
1135
1158
  function splitProps(props, ...keys) {
1136
- if ($PROXY in props) {
1159
+ if (SUPPORTS_PROXY && $PROXY in props) {
1137
1160
  const blocked = new Set(keys.length > 1 ? keys.flat() : keys[0]);
1138
1161
  const res = keys.map((k) => {
1139
- return new Proxy({
1140
- get(property) {
1141
- return k.includes(property) ? props[property] : void 0;
1142
- },
1143
- has(property) {
1144
- return k.includes(property) && property in props;
1162
+ return new Proxy(
1163
+ {
1164
+ get(property) {
1165
+ return k.includes(property) ? props[property] : void 0;
1166
+ },
1167
+ has(property) {
1168
+ return k.includes(property) && property in props;
1169
+ },
1170
+ keys() {
1171
+ return k.filter((property) => property in props);
1172
+ }
1145
1173
  },
1146
- keys() {
1147
- return k.filter((property) => property in props);
1148
- }
1149
- }, propTraps);
1174
+ propTraps
1175
+ );
1150
1176
  });
1151
- res.push(new Proxy({
1152
- get(property) {
1153
- return blocked.has(property) ? void 0 : props[property];
1154
- },
1155
- has(property) {
1156
- return blocked.has(property) ? false : property in props;
1157
- },
1158
- keys() {
1159
- return Object.keys(props).filter((k) => !blocked.has(k));
1160
- }
1161
- }, propTraps));
1177
+ res.push(
1178
+ new Proxy(
1179
+ {
1180
+ get(property) {
1181
+ return blocked.has(property) ? void 0 : props[property];
1182
+ },
1183
+ has(property) {
1184
+ return blocked.has(property) ? false : property in props;
1185
+ },
1186
+ keys() {
1187
+ return Object.keys(props).filter((k) => !blocked.has(k));
1188
+ }
1189
+ },
1190
+ propTraps
1191
+ )
1192
+ );
1162
1193
  return res;
1163
1194
  }
1164
1195
  const otherObject = {};
@@ -1191,7 +1222,7 @@ function lazy(fn) {
1191
1222
  sharedConfig.count || (sharedConfig.count = 0);
1192
1223
  sharedConfig.count++;
1193
1224
  (p || (p = fn())).then((mod) => {
1194
- setHydrateContext(ctx);
1225
+ !sharedConfig.done && setHydrateContext(ctx);
1195
1226
  sharedConfig.count--;
1196
1227
  set(() => mod.default);
1197
1228
  setHydrateContext();
@@ -1202,17 +1233,19 @@ function lazy(fn) {
1202
1233
  comp = s;
1203
1234
  }
1204
1235
  let Comp;
1205
- return createMemo(() => (Comp = comp()) && untrack(() => {
1206
- if (false)
1207
- ;
1208
- if (!ctx)
1209
- return Comp(props);
1210
- const c = sharedConfig.context;
1211
- setHydrateContext(ctx);
1212
- const r = Comp(props);
1213
- setHydrateContext(c);
1214
- return r;
1215
- }));
1236
+ return createMemo(
1237
+ () => (Comp = comp()) ? untrack(() => {
1238
+ if (false)
1239
+ ;
1240
+ if (!ctx || sharedConfig.done)
1241
+ return Comp(props);
1242
+ const c = sharedConfig.context;
1243
+ setHydrateContext(ctx);
1244
+ const r = Comp(props);
1245
+ setHydrateContext(c);
1246
+ return r;
1247
+ }) : ""
1248
+ );
1216
1249
  };
1217
1250
  wrap.preload = () => p || ((p = fn()).then((mod) => comp = () => mod.default), p);
1218
1251
  return wrap;
@@ -1240,60 +1273,120 @@ function Show(props) {
1240
1273
  const condition = createMemo(() => props.when, void 0, {
1241
1274
  equals: (a, b) => keyed ? a === b : !a === !b
1242
1275
  });
1243
- return createMemo(() => {
1244
- const c = condition();
1245
- if (c) {
1246
- const child = props.children;
1247
- const fn = typeof child === "function" && child.length > 0;
1248
- return fn ? untrack(() => child(keyed ? c : () => {
1249
- if (!untrack(condition))
1250
- throw narrowedError("Show");
1251
- return props.when;
1252
- })) : child;
1253
- }
1254
- return props.fallback;
1255
- }, void 0, void 0);
1276
+ return createMemo(
1277
+ () => {
1278
+ const c = condition();
1279
+ if (c) {
1280
+ const child = props.children;
1281
+ const fn = typeof child === "function" && child.length > 0;
1282
+ return fn ? untrack(
1283
+ () => child(
1284
+ keyed ? c : () => {
1285
+ if (!untrack(condition))
1286
+ throw narrowedError("Show");
1287
+ return props.when;
1288
+ }
1289
+ )
1290
+ ) : child;
1291
+ }
1292
+ return props.fallback;
1293
+ },
1294
+ void 0,
1295
+ void 0
1296
+ );
1256
1297
  }
1257
1298
  function Switch(props) {
1258
1299
  let keyed = false;
1259
1300
  const equals = (a, b) => (keyed ? a[1] === b[1] : !a[1] === !b[1]) && a[2] === b[2];
1260
- const conditions = children(() => props.children), evalConditions = createMemo(() => {
1261
- let conds = conditions();
1262
- if (!Array.isArray(conds))
1263
- conds = [conds];
1264
- for (let i = 0; i < conds.length; i++) {
1265
- const c = conds[i].when;
1266
- if (c) {
1267
- keyed = !!conds[i].keyed;
1268
- return [i, c, conds[i]];
1301
+ const conditions = children(() => props.children), evalConditions = createMemo(
1302
+ () => {
1303
+ let conds = conditions();
1304
+ if (!Array.isArray(conds))
1305
+ conds = [conds];
1306
+ for (let i = 0; i < conds.length; i++) {
1307
+ const c = conds[i].when;
1308
+ if (c) {
1309
+ keyed = !!conds[i].keyed;
1310
+ return [i, c, conds[i]];
1311
+ }
1269
1312
  }
1270
- }
1271
- return [-1];
1272
- }, void 0, {
1273
- equals
1274
- });
1275
- return createMemo(() => {
1276
- const [index, when, cond] = evalConditions();
1277
- if (index < 0)
1278
- return props.fallback;
1279
- const c = cond.children;
1280
- const fn = typeof c === "function" && c.length > 0;
1281
- return fn ? untrack(() => c(keyed ? when : () => {
1282
- if (untrack(evalConditions)[0] !== index)
1283
- throw narrowedError("Match");
1284
- return cond.when;
1285
- })) : c;
1286
- }, void 0, void 0);
1313
+ return [-1];
1314
+ },
1315
+ void 0,
1316
+ {
1317
+ equals
1318
+ }
1319
+ );
1320
+ return createMemo(
1321
+ () => {
1322
+ const [index, when, cond] = evalConditions();
1323
+ if (index < 0)
1324
+ return props.fallback;
1325
+ const c = cond.children;
1326
+ const fn = typeof c === "function" && c.length > 0;
1327
+ return fn ? untrack(
1328
+ () => c(
1329
+ keyed ? when : () => {
1330
+ if (untrack(evalConditions)[0] !== index)
1331
+ throw narrowedError("Match");
1332
+ return cond.when;
1333
+ }
1334
+ )
1335
+ ) : c;
1336
+ },
1337
+ void 0,
1338
+ void 0
1339
+ );
1287
1340
  }
1288
1341
  function Match(props) {
1289
1342
  return props;
1290
1343
  }
1291
1344
  var DEV = void 0;
1292
1345
 
1293
- // ../../node_modules/.pnpm/solid-js@1.8.19/node_modules/solid-js/web/dist/web.js
1294
- 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"];
1295
- var Properties = /* @__PURE__ */ new Set(["className", "value", "readOnly", "formNoValidate", "isMap", "noModule", "playsInline", ...booleans]);
1296
- var ChildProperties = /* @__PURE__ */ new Set(["innerHTML", "textContent", "innerText", "children"]);
1346
+ // ../../node_modules/.pnpm/solid-js@1.9.3/node_modules/solid-js/web/dist/web.js
1347
+ var booleans = [
1348
+ "allowfullscreen",
1349
+ "async",
1350
+ "autofocus",
1351
+ "autoplay",
1352
+ "checked",
1353
+ "controls",
1354
+ "default",
1355
+ "disabled",
1356
+ "formnovalidate",
1357
+ "hidden",
1358
+ "indeterminate",
1359
+ "inert",
1360
+ "ismap",
1361
+ "loop",
1362
+ "multiple",
1363
+ "muted",
1364
+ "nomodule",
1365
+ "novalidate",
1366
+ "open",
1367
+ "playsinline",
1368
+ "readonly",
1369
+ "required",
1370
+ "reversed",
1371
+ "seamless",
1372
+ "selected"
1373
+ ];
1374
+ var Properties = /* @__PURE__ */ new Set([
1375
+ "className",
1376
+ "value",
1377
+ "readOnly",
1378
+ "formNoValidate",
1379
+ "isMap",
1380
+ "noModule",
1381
+ "playsInline",
1382
+ ...booleans
1383
+ ]);
1384
+ var ChildProperties = /* @__PURE__ */ new Set([
1385
+ "innerHTML",
1386
+ "textContent",
1387
+ "innerText",
1388
+ "children"
1389
+ ]);
1297
1390
  var Aliases = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(null), {
1298
1391
  className: "class",
1299
1392
  htmlFor: "for"
@@ -1327,7 +1420,30 @@ function getPropAlias(prop, tagName) {
1327
1420
  const a = PropAliases[prop];
1328
1421
  return typeof a === "object" ? a[tagName] ? a["$"] : void 0 : a;
1329
1422
  }
1330
- 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"]);
1423
+ var DelegatedEvents = /* @__PURE__ */ new Set([
1424
+ "beforeinput",
1425
+ "click",
1426
+ "dblclick",
1427
+ "contextmenu",
1428
+ "focusin",
1429
+ "focusout",
1430
+ "input",
1431
+ "keydown",
1432
+ "keyup",
1433
+ "mousedown",
1434
+ "mousemove",
1435
+ "mouseout",
1436
+ "mouseover",
1437
+ "mouseup",
1438
+ "pointerdown",
1439
+ "pointermove",
1440
+ "pointerout",
1441
+ "pointerover",
1442
+ "pointerup",
1443
+ "touchend",
1444
+ "touchmove",
1445
+ "touchstart"
1446
+ ]);
1331
1447
  var SVGElements = /* @__PURE__ */ new Set([
1332
1448
  "altGlyph",
1333
1449
  "altGlyphDef",
@@ -1479,14 +1595,14 @@ function render(code, element, init, options = {}) {
1479
1595
  element.textContent = "";
1480
1596
  };
1481
1597
  }
1482
- function template(html, isCE, isSVG) {
1598
+ function template(html, isImportNode, isSVG) {
1483
1599
  let node;
1484
1600
  const create = () => {
1485
1601
  const t = document.createElement("template");
1486
1602
  t.innerHTML = html;
1487
1603
  return isSVG ? t.content.firstChild.firstChild : t.content.firstChild;
1488
1604
  };
1489
- const fn = isCE ? () => untrack(() => document.importNode(node || (node = create()), true)) : () => (node || (node = create())).cloneNode(true);
1605
+ const fn = isImportNode ? () => untrack(() => document.importNode(node || (node = create()), true)) : () => (node || (node = create())).cloneNode(true);
1490
1606
  fn.cloneNode = fn;
1491
1607
  return fn;
1492
1608
  }
@@ -1508,7 +1624,7 @@ function clearDelegatedEvents(document2 = window.document) {
1508
1624
  }
1509
1625
  }
1510
1626
  function setAttribute(node, name, value) {
1511
- if (!!sharedConfig.context && node.isConnected)
1627
+ if (isHydrating(node))
1512
1628
  return;
1513
1629
  if (value == null)
1514
1630
  node.removeAttribute(name);
@@ -1516,15 +1632,20 @@ function setAttribute(node, name, value) {
1516
1632
  node.setAttribute(name, value);
1517
1633
  }
1518
1634
  function setAttributeNS(node, namespace, name, value) {
1519
- if (!!sharedConfig.context && node.isConnected)
1635
+ if (isHydrating(node))
1520
1636
  return;
1521
1637
  if (value == null)
1522
1638
  node.removeAttributeNS(namespace, name);
1523
1639
  else
1524
1640
  node.setAttributeNS(namespace, name, value);
1525
1641
  }
1642
+ function setBoolAttribute(node, name, value) {
1643
+ if (isHydrating(node))
1644
+ return;
1645
+ value ? node.setAttribute(name, "") : node.removeAttribute(name);
1646
+ }
1526
1647
  function className(node, value) {
1527
- if (!!sharedConfig.context && node.isConnected)
1648
+ if (isHydrating(node))
1528
1649
  return;
1529
1650
  if (value == null)
1530
1651
  node.removeAttribute("class");
@@ -1542,7 +1663,7 @@ function addEventListener(node, name, handler, delegate) {
1542
1663
  const handlerFn = handler[0];
1543
1664
  node.addEventListener(name, handler[0] = (e) => handlerFn.call(node, handler[1], e));
1544
1665
  } else
1545
- node.addEventListener(name, handler);
1666
+ node.addEventListener(name, handler, typeof handler !== "function" && handler);
1546
1667
  }
1547
1668
  function classList(node, value, prev = {}) {
1548
1669
  const classKeys = Object.keys(value || {}), prevKeys = Object.keys(prev);
@@ -1589,7 +1710,9 @@ function style(node, value, prev) {
1589
1710
  function spread(node, props = {}, isSVG, skipChildren) {
1590
1711
  const prevProps = {};
1591
1712
  if (!skipChildren) {
1592
- createRenderEffect(() => prevProps.children = insertExpression(node, props.children, prevProps.children));
1713
+ createRenderEffect(
1714
+ () => prevProps.children = insertExpression(node, props.children, prevProps.children)
1715
+ );
1593
1716
  }
1594
1717
  createRenderEffect(() => typeof props.ref === "function" && use(props.ref, node));
1595
1718
  createRenderEffect(() => assign(node, props, isSVG, true, prevProps, true));
@@ -1611,7 +1734,7 @@ function assign(node, props, isSVG, skipChildren, prevProps = {}, skipRef = fals
1611
1734
  if (!(prop in props)) {
1612
1735
  if (prop === "children")
1613
1736
  continue;
1614
- prevProps[prop] = assignProp(node, prop, null, prevProps[prop], isSVG, skipRef);
1737
+ prevProps[prop] = assignProp(node, prop, null, prevProps[prop], isSVG, skipRef, props);
1615
1738
  }
1616
1739
  }
1617
1740
  for (const prop in props) {
@@ -1619,12 +1742,12 @@ function assign(node, props, isSVG, skipChildren, prevProps = {}, skipRef = fals
1619
1742
  continue;
1620
1743
  }
1621
1744
  const value = props[prop];
1622
- prevProps[prop] = assignProp(node, prop, value, prevProps[prop], isSVG, skipRef);
1745
+ prevProps[prop] = assignProp(node, prop, value, prevProps[prop], isSVG, skipRef, props);
1623
1746
  }
1624
1747
  }
1625
1748
  function getNextElement(template2) {
1626
- let node, key;
1627
- if (!sharedConfig.context || !(node = sharedConfig.registry.get(key = getHydrationKey()))) {
1749
+ let node, key, hydrating = isHydrating();
1750
+ if (!hydrating || !(node = sharedConfig.registry.get(key = getHydrationKey()))) {
1628
1751
  return template2();
1629
1752
  }
1630
1753
  if (sharedConfig.completed)
@@ -1632,6 +1755,9 @@ function getNextElement(template2) {
1632
1755
  sharedConfig.registry.delete(key);
1633
1756
  return node;
1634
1757
  }
1758
+ function isHydrating(node) {
1759
+ return !!sharedConfig.context && !sharedConfig.done && (!node || node.isConnected);
1760
+ }
1635
1761
  function toPropertyName(name) {
1636
1762
  return name.toLowerCase().replace(/-([a-z])/g, (_, w) => w.toUpperCase());
1637
1763
  }
@@ -1640,7 +1766,7 @@ function toggleClassKey(node, key, value) {
1640
1766
  for (let i = 0, nameLen = classNames.length; i < nameLen; i++)
1641
1767
  node.classList.toggle(classNames[i], value);
1642
1768
  }
1643
- function assignProp(node, prop, value, prev, isSVG, skipRef) {
1769
+ function assignProp(node, prop, value, prev, isSVG, skipRef, props) {
1644
1770
  let isCE, isProp, isChildProp, propAlias, forceProp;
1645
1771
  if (prop === "style")
1646
1772
  return style(node, value, prev);
@@ -1653,8 +1779,8 @@ function assignProp(node, prop, value, prev, isSVG, skipRef) {
1653
1779
  value(node);
1654
1780
  } else if (prop.slice(0, 3) === "on:") {
1655
1781
  const e = prop.slice(3);
1656
- prev && node.removeEventListener(e, prev);
1657
- value && node.addEventListener(e, value);
1782
+ prev && node.removeEventListener(e, prev, typeof prev !== "function" && prev);
1783
+ value && node.addEventListener(e, value, typeof value !== "function" && value);
1658
1784
  } else if (prop.slice(0, 10) === "oncapture:") {
1659
1785
  const e = prop.slice(10);
1660
1786
  prev && node.removeEventListener(e, prev, true);
@@ -1672,11 +1798,13 @@ function assignProp(node, prop, value, prev, isSVG, skipRef) {
1672
1798
  }
1673
1799
  } else if (prop.slice(0, 5) === "attr:") {
1674
1800
  setAttribute(node, prop.slice(5), value);
1675
- } else if ((forceProp = prop.slice(0, 5) === "prop:") || (isChildProp = ChildProperties.has(prop)) || !isSVG && ((propAlias = getPropAlias(prop, node.tagName)) || (isProp = Properties.has(prop))) || (isCE = node.nodeName.includes("-"))) {
1801
+ } else if (prop.slice(0, 5) === "bool:") {
1802
+ setBoolAttribute(node, prop.slice(5), value);
1803
+ } else if ((forceProp = prop.slice(0, 5) === "prop:") || (isChildProp = ChildProperties.has(prop)) || !isSVG && ((propAlias = getPropAlias(prop, node.tagName)) || (isProp = Properties.has(prop))) || (isCE = node.nodeName.includes("-") || "is" in props)) {
1676
1804
  if (forceProp) {
1677
1805
  prop = prop.slice(5);
1678
1806
  isProp = true;
1679
- } else if (!!sharedConfig.context && node.isConnected)
1807
+ } else if (isHydrating(node))
1680
1808
  return value;
1681
1809
  if (prop === "class" || prop === "className")
1682
1810
  className(node, value);
@@ -1694,23 +1822,19 @@ function assignProp(node, prop, value, prev, isSVG, skipRef) {
1694
1822
  return value;
1695
1823
  }
1696
1824
  function eventHandler(e) {
1697
- const key = `$$${e.type}`;
1698
- let node = e.composedPath && e.composedPath()[0] || e.target;
1699
- if (e.target !== node) {
1700
- Object.defineProperty(e, "target", {
1701
- configurable: true,
1702
- value: node
1703
- });
1825
+ if (sharedConfig.registry && sharedConfig.events) {
1826
+ if (sharedConfig.events.find(([el, ev]) => ev === e))
1827
+ return;
1704
1828
  }
1705
- Object.defineProperty(e, "currentTarget", {
1829
+ let node = e.target;
1830
+ const key = `$$${e.type}`;
1831
+ const oriTarget = e.target;
1832
+ const oriCurrentTarget = e.currentTarget;
1833
+ const retarget = (value) => Object.defineProperty(e, "target", {
1706
1834
  configurable: true,
1707
- get() {
1708
- return node || document;
1709
- }
1835
+ value
1710
1836
  });
1711
- if (sharedConfig.registry && !sharedConfig.done)
1712
- sharedConfig.done = _$HY.done = true;
1713
- while (node) {
1837
+ const handleNode = () => {
1714
1838
  const handler = node[key];
1715
1839
  if (handler && !node.disabled) {
1716
1840
  const data = node[`${key}Data`];
@@ -1718,11 +1842,43 @@ function eventHandler(e) {
1718
1842
  if (e.cancelBubble)
1719
1843
  return;
1720
1844
  }
1721
- node = node._$host || node.parentNode || node.host;
1722
- }
1845
+ node.host && typeof node.host !== "string" && !node.host._$host && node.contains(e.target) && retarget(node.host);
1846
+ return true;
1847
+ };
1848
+ const walkUpTree = () => {
1849
+ while (handleNode() && (node = node._$host || node.parentNode || node.host))
1850
+ ;
1851
+ };
1852
+ Object.defineProperty(e, "currentTarget", {
1853
+ configurable: true,
1854
+ get() {
1855
+ return node || document;
1856
+ }
1857
+ });
1858
+ if (sharedConfig.registry && !sharedConfig.done)
1859
+ sharedConfig.done = _$HY.done = true;
1860
+ if (e.composedPath) {
1861
+ const path = e.composedPath();
1862
+ retarget(path[0]);
1863
+ for (let i = 0; i < path.length - 2; i++) {
1864
+ node = path[i];
1865
+ if (!handleNode())
1866
+ break;
1867
+ if (node._$host) {
1868
+ node = node._$host;
1869
+ walkUpTree();
1870
+ break;
1871
+ }
1872
+ if (node.parentNode === oriCurrentTarget) {
1873
+ break;
1874
+ }
1875
+ }
1876
+ } else
1877
+ walkUpTree();
1878
+ retarget(oriTarget);
1723
1879
  }
1724
1880
  function insertExpression(parent, value, current, marker, unwrapArray) {
1725
- const hydrating = !!sharedConfig.context && parent.isConnected;
1881
+ const hydrating = isHydrating(parent);
1726
1882
  if (hydrating) {
1727
1883
  !current && (current = [...parent.childNodes]);
1728
1884
  let cleaned = [];
@@ -1785,9 +1941,11 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
1785
1941
  if (!array.length)
1786
1942
  return current;
1787
1943
  if (marker === void 0)
1788
- return [...parent.childNodes];
1944
+ return current = [...parent.childNodes];
1789
1945
  let node = array[0];
1790
- let nodes = [node];
1946
+ if (node.parentNode !== parent)
1947
+ return current;
1948
+ const nodes = [node];
1791
1949
  while ((node = node.nextSibling) !== marker)
1792
1950
  nodes.push(node);
1793
1951
  return current = nodes;
@@ -1836,7 +1994,11 @@ function normalizeIncomingArray(normalized, array, current, unwrap) {
1836
1994
  if (unwrap) {
1837
1995
  while (typeof item === "function")
1838
1996
  item = item();
1839
- dynamic = normalizeIncomingArray(normalized, Array.isArray(item) ? item : [item], Array.isArray(prev) ? prev : [prev]) || dynamic;
1997
+ dynamic = normalizeIncomingArray(
1998
+ normalized,
1999
+ Array.isArray(item) ? item : [item],
2000
+ Array.isArray(prev) ? prev : [prev]
2001
+ ) || dynamic;
1840
2002
  } else {
1841
2003
  normalized.push(item);
1842
2004
  dynamic = true;
@@ -1885,39 +2047,41 @@ function createElement(tagName, isSVG = false) {
1885
2047
  return isSVG ? document.createElementNS(SVG_NAMESPACE, tagName) : document.createElement(tagName);
1886
2048
  }
1887
2049
  function Portal(props) {
1888
- const {
1889
- useShadow
1890
- } = props, marker = document.createTextNode(""), mount = () => props.mount || document.body, owner = getOwner();
2050
+ const { useShadow } = props, marker = document.createTextNode(""), mount = () => props.mount || document.body, owner = getOwner();
1891
2051
  let content;
1892
2052
  let hydrating = !!sharedConfig.context;
1893
- createEffect(() => {
1894
- if (hydrating)
1895
- getOwner().user = hydrating = false;
1896
- content || (content = runWithOwner(owner, () => createMemo(() => props.children)));
1897
- const el = mount();
1898
- if (el instanceof HTMLHeadElement) {
1899
- const [clean, setClean] = createSignal(false);
1900
- const cleanup = () => setClean(true);
1901
- createRoot((dispose2) => insert(el, () => !clean() ? content() : dispose2(), null));
1902
- onCleanup(cleanup);
1903
- } else {
1904
- const container = createElement(props.isSVG ? "g" : "div", props.isSVG), renderRoot = useShadow && container.attachShadow ? container.attachShadow({
1905
- mode: "open"
1906
- }) : container;
1907
- Object.defineProperty(container, "_$host", {
1908
- get() {
1909
- return marker.parentNode;
1910
- },
1911
- configurable: true
1912
- });
1913
- insert(renderRoot, content);
1914
- el.appendChild(container);
1915
- props.ref && props.ref(container);
1916
- onCleanup(() => el.removeChild(container));
2053
+ createEffect(
2054
+ () => {
2055
+ if (hydrating)
2056
+ getOwner().user = hydrating = false;
2057
+ content || (content = runWithOwner(owner, () => createMemo(() => props.children)));
2058
+ const el = mount();
2059
+ if (el instanceof HTMLHeadElement) {
2060
+ const [clean, setClean] = createSignal(false);
2061
+ const cleanup = () => setClean(true);
2062
+ createRoot((dispose2) => insert(el, () => !clean() ? content() : dispose2(), null));
2063
+ onCleanup(cleanup);
2064
+ } else {
2065
+ const container = createElement(props.isSVG ? "g" : "div", props.isSVG), renderRoot = useShadow && container.attachShadow ? container.attachShadow({
2066
+ mode: "open"
2067
+ }) : container;
2068
+ Object.defineProperty(container, "_$host", {
2069
+ get() {
2070
+ return marker.parentNode;
2071
+ },
2072
+ configurable: true
2073
+ });
2074
+ insert(renderRoot, content);
2075
+ el.appendChild(container);
2076
+ props.ref && props.ref(container);
2077
+ onCleanup(() => el.removeChild(container));
2078
+ }
2079
+ },
2080
+ void 0,
2081
+ {
2082
+ render: !hydrating
1917
2083
  }
1918
- }, void 0, {
1919
- render: !hydrating
1920
- });
2084
+ );
1921
2085
  return marker;
1922
2086
  }
1923
2087
  function Dynamic(props) {