sinwan 1.1.0 → 1.1.2

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 (43) hide show
  1. package/README.md +34 -3
  2. package/dist/cjs/index.development.js +357 -221
  3. package/dist/cjs/index.development.js.map +12 -11
  4. package/dist/cjs/index.production.min.js +2 -2
  5. package/dist/cjs/index.production.min.js.map +12 -11
  6. package/dist/cjs/renderer/index.development.js +300 -116
  7. package/dist/cjs/renderer/index.development.js.map +11 -10
  8. package/dist/cjs/renderer/index.production.min.js +2 -2
  9. package/dist/cjs/renderer/index.production.min.js.map +11 -10
  10. package/dist/cjs/server/index.development.js +146 -68
  11. package/dist/cjs/server/index.development.js.map +8 -7
  12. package/dist/cjs/server/index.production.min.js +2 -2
  13. package/dist/cjs/server/index.production.min.js.map +8 -7
  14. package/dist/component/control-flow.d.ts +6 -1
  15. package/dist/component/control-flow.d.ts.map +1 -1
  16. package/dist/component/instance.d.ts.map +1 -1
  17. package/dist/esm/index.development.js +357 -221
  18. package/dist/esm/index.development.js.map +12 -11
  19. package/dist/esm/index.production.min.js +2 -2
  20. package/dist/esm/index.production.min.js.map +12 -11
  21. package/dist/esm/renderer/index.development.js +300 -116
  22. package/dist/esm/renderer/index.development.js.map +11 -10
  23. package/dist/esm/renderer/index.production.min.js +2 -2
  24. package/dist/esm/renderer/index.production.min.js.map +11 -10
  25. package/dist/esm/server/index.development.js +146 -68
  26. package/dist/esm/server/index.development.js.map +8 -7
  27. package/dist/esm/server/index.production.min.js +2 -2
  28. package/dist/esm/server/index.production.min.js.map +8 -7
  29. package/dist/reactivity/index.d.ts +2 -1
  30. package/dist/reactivity/index.d.ts.map +1 -1
  31. package/dist/reactivity/normalization.d.ts +19 -0
  32. package/dist/reactivity/normalization.d.ts.map +1 -0
  33. package/dist/renderer/attributes.d.ts.map +1 -1
  34. package/dist/renderer/events.d.ts.map +1 -1
  35. package/dist/renderer/render-children.d.ts.map +1 -1
  36. package/dist/renderer/render-control-flow.d.ts.map +1 -1
  37. package/dist/renderer/render-element.d.ts.map +1 -1
  38. package/dist/renderer/types.d.ts +2 -0
  39. package/dist/renderer/types.d.ts.map +1 -1
  40. package/dist/server/renderer.d.ts.map +1 -1
  41. package/dist/types.d.ts +2 -2
  42. package/dist/types.d.ts.map +1 -1
  43. package/package.json +6 -3
@@ -383,7 +383,6 @@ function signal(initial) {
383
383
  function isSignal(value) {
384
384
  return value != null && typeof value === "object" && SIGNAL_BRAND in value;
385
385
  }
386
-
387
386
  // src/reactivity/computed.ts
388
387
  var COMPUTED_BRAND = Symbol("Sinwan:computed");
389
388
 
@@ -435,10 +434,35 @@ function computed(getter) {
435
434
  function isComputed(value) {
436
435
  return value != null && typeof value === "object" && COMPUTED_BRAND in value;
437
436
  }
438
-
437
+ // src/reactivity/batch.ts
438
+ var batchDepth = 0;
439
+ function batch(fn) {
440
+ batchDepth++;
441
+ try {
442
+ fn();
443
+ } finally {
444
+ batchDepth--;
445
+ if (batchDepth === 0) {
446
+ flushSync();
447
+ }
448
+ }
449
+ }
450
+ // src/reactivity/normalization.ts
451
+ function isReactive(value) {
452
+ return isSignal(value) || isComputed(value) || typeof value === "function";
453
+ }
454
+ function resolve(value) {
455
+ if (isSignal(value) || isComputed(value)) {
456
+ return value.value;
457
+ }
458
+ if (typeof value === "function") {
459
+ return value();
460
+ }
461
+ return value;
462
+ }
439
463
  // src/renderer/events.ts
440
464
  function isEventProp(key) {
441
- return key.length > 2 && key[0] === "o" && key[1] === "n" && key[2] >= "A" && key[2] <= "Z";
465
+ return key.length > 2 && key.startsWith("on");
442
466
  }
443
467
  function toEventName(key) {
444
468
  return key.slice(2).toLowerCase();
@@ -515,19 +539,28 @@ function fireMountedHooks(instance) {
515
539
  }
516
540
  }
517
541
  function fireUnmountedHooks(instance) {
518
- for (const child of instance.children) {
542
+ const children = [...instance.children];
543
+ for (const child of children) {
519
544
  fireUnmountedHooks(child);
520
545
  }
521
- if (instance.isMounted && !instance.isUnmounted) {
546
+ if (!instance.isUnmounted) {
522
547
  instance.isUnmounted = true;
523
- instance.isMounted = false;
524
- for (const hook of instance._unmountedHooks) {
525
- hook();
548
+ if (instance.isMounted) {
549
+ instance.isMounted = false;
550
+ for (const hook of instance._unmountedHooks) {
551
+ hook();
552
+ }
526
553
  }
527
554
  for (const dispose of instance.effects) {
528
555
  dispose();
529
556
  }
530
557
  instance.effects.length = 0;
558
+ if (instance.parent) {
559
+ const idx = instance.parent.children.indexOf(instance);
560
+ if (idx !== -1) {
561
+ instance.parent.children.splice(idx, 1);
562
+ }
563
+ }
531
564
  }
532
565
  }
533
566
  function fireUpdatedHooks(instance) {
@@ -577,11 +610,13 @@ function applyAttributes(el, props) {
577
610
  for (const [key, value] of Object.entries(props)) {
578
611
  if (SKIP_PROPS.has(key) || isEventProp(key))
579
612
  continue;
580
- if (isSignal(value) || isComputed(value)) {
613
+ const attrName = resolveAttributeName(key);
614
+ const isComplex = attrName === "class" || attrName === "style";
615
+ if (isReactive(value) || isComplex && containsReactive(value)) {
581
616
  const state = { previousStyleProps: new Set };
582
617
  let initialized = false;
583
618
  const dispose = effect(() => {
584
- setSingleAttribute(el, key, value.value, state);
619
+ setSingleAttribute(el, key, resolve(value), state);
585
620
  if (initialized) {
586
621
  queueUpdatedHooks(owner);
587
622
  }
@@ -639,19 +674,17 @@ function setSingleAttribute(el, key, value, state) {
639
674
  function resolveAttributeName(key) {
640
675
  return PROP_ALIASES[key] ?? key;
641
676
  }
642
- function applyStyle(el, styles, state) {
677
+ function applyStyle(el, value, state) {
678
+ const styleObj = normalizeStyle(value);
643
679
  const nextProps = new Set;
644
- for (const [prop, val] of Object.entries(styles)) {
680
+ for (const [prop, val] of Object.entries(styleObj)) {
645
681
  nextProps.add(prop);
646
682
  if (val == null) {
647
683
  removeStyleProperty(el, prop);
648
684
  continue;
649
685
  }
650
- if (prop.includes("-")) {
651
- el.style.setProperty(prop, String(val));
652
- } else {
653
- el.style[prop] = val;
654
- }
686
+ const kebabProp = prop.startsWith("--") ? prop : camelToKebab(prop);
687
+ el.style.setProperty(kebabProp, String(val));
655
688
  }
656
689
  if (!state) {
657
690
  return;
@@ -663,37 +696,77 @@ function applyStyle(el, styles, state) {
663
696
  }
664
697
  state.previousStyleProps = nextProps;
665
698
  }
699
+ function normalizeStyle(value) {
700
+ const resolved = resolve(value);
701
+ if (!resolved)
702
+ return {};
703
+ if (typeof resolved === "string") {
704
+ return parseStyleString(resolved);
705
+ }
706
+ if (Array.isArray(resolved)) {
707
+ return resolved.reduce((acc, item) => {
708
+ const normalized = normalizeStyle(item);
709
+ return Object.assign(acc, normalized);
710
+ }, {});
711
+ }
712
+ if (typeof resolved === "object") {
713
+ const result = {};
714
+ for (const [k, v] of Object.entries(resolved)) {
715
+ result[k] = resolve(v);
716
+ }
717
+ return result;
718
+ }
719
+ return {};
720
+ }
721
+ function parseStyleString(style) {
722
+ const result = {};
723
+ style.split(";").forEach((rule) => {
724
+ const i = rule.indexOf(":");
725
+ if (i > 0) {
726
+ const prop = rule.slice(0, i).trim();
727
+ const val = rule.slice(i + 1).trim();
728
+ if (prop && val) {
729
+ result[prop] = val;
730
+ }
731
+ }
732
+ });
733
+ return result;
734
+ }
666
735
  function removeStyleProperty(el, prop) {
667
- if (prop.includes("-")) {
668
- el.style.removeProperty(prop);
669
- } else {
670
- el.style[prop] = "";
671
- }
736
+ const kebabProp = prop.startsWith("--") ? prop : camelToKebab(prop);
737
+ el.style.removeProperty(kebabProp);
672
738
  }
673
739
  function applyClass(el, value) {
674
- let classStr;
675
- if (Array.isArray(value)) {
676
- classStr = value.filter(Boolean).join(" ");
677
- } else if (typeof value === "object" && value !== null) {
678
- classStr = Object.entries(value).filter(([, v]) => Boolean(v)).map(([k]) => k).join(" ");
679
- } else {
680
- classStr = String(value);
740
+ domOps.setAttribute(el, "class", normalizeClass(value));
741
+ }
742
+ function normalizeClass(value) {
743
+ const resolved = resolve(value);
744
+ if (!resolved)
745
+ return "";
746
+ if (typeof resolved === "string")
747
+ return resolved;
748
+ if (Array.isArray(resolved)) {
749
+ return resolved.map(normalizeClass).filter(Boolean).join(" ");
750
+ }
751
+ if (typeof resolved === "object") {
752
+ return Object.entries(resolved).filter(([, v]) => Boolean(resolve(v))).map(([k]) => k).join(" ");
681
753
  }
682
- domOps.setAttribute(el, "class", classStr);
754
+ return String(resolved);
683
755
  }
684
- // src/reactivity/batch.ts
685
- var batchDepth = 0;
686
- function batch(fn) {
687
- batchDepth++;
688
- try {
689
- fn();
690
- } finally {
691
- batchDepth--;
692
- if (batchDepth === 0) {
693
- flushSync();
694
- }
756
+ function containsReactive(value) {
757
+ if (isReactive(value))
758
+ return true;
759
+ if (Array.isArray(value))
760
+ return value.some(containsReactive);
761
+ if (typeof value === "object" && value !== null) {
762
+ return Object.values(value).some(containsReactive);
695
763
  }
764
+ return false;
765
+ }
766
+ function camelToKebab(str) {
767
+ return str.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`);
696
768
  }
769
+
697
770
  // src/component/control-flow.ts
698
771
  var SHOW_TYPE = Symbol.for("Sinwan.Show");
699
772
  var FOR_TYPE = Symbol.for("Sinwan.For");
@@ -787,6 +860,9 @@ function Portal(props) {
787
860
  children: []
788
861
  };
789
862
  }
863
+ function isElementLike(value) {
864
+ return value != null && typeof value === "object" && "tag" in value;
865
+ }
790
866
  function isShowElement(element) {
791
867
  return element.tag === SHOW_TYPE;
792
868
  }
@@ -811,6 +887,107 @@ function isDynamicElement(element) {
811
887
  function isPortalElement(element) {
812
888
  return element.tag === PORTAL_TYPE;
813
889
  }
890
+ function resolveSwitchContent(element) {
891
+ const props = element.props;
892
+ const children = normalizeContent(props.children ?? element.children);
893
+ const match = findTruthyMatch(children);
894
+ return match !== undefined ? match : props.fallback;
895
+ }
896
+ function findTruthyMatch(nodes) {
897
+ for (const node of nodes) {
898
+ if (node == null || typeof node === "boolean")
899
+ continue;
900
+ if (Array.isArray(node)) {
901
+ const match = findTruthyMatch(node);
902
+ if (match !== undefined)
903
+ return match;
904
+ continue;
905
+ }
906
+ if (isElementLike(node)) {
907
+ let element = node;
908
+ if (typeof element.tag === "function") {
909
+ const tag = element.tag;
910
+ if (tag === Match || tag === Show || tag === For || tag === Index || tag === Key || tag === Switch) {
911
+ element = tag(element.props);
912
+ }
913
+ }
914
+ if (isMatchElement(element)) {
915
+ const when = readReactive(element.props.when);
916
+ if (when) {
917
+ return resolveMatchChildren(element, when);
918
+ }
919
+ } else if (isShowElement(element)) {
920
+ const when = readReactive(element.props.when);
921
+ if (when) {
922
+ const content = resolveShowChildren(element, when);
923
+ const match = findTruthyMatch(normalizeContent(content));
924
+ if (match !== undefined)
925
+ return match;
926
+ } else if (element.props.fallback) {
927
+ const match = findTruthyMatch(normalizeContent(element.props.fallback));
928
+ if (match !== undefined)
929
+ return match;
930
+ }
931
+ } else if (isForElement(element)) {
932
+ const props = element.props;
933
+ const items = readReactive(props.each);
934
+ if (Array.isArray(items)) {
935
+ for (let i = 0;i < items.length; i++) {
936
+ const child = props.children(items[i], () => i);
937
+ const match = findTruthyMatch(normalizeContent(child));
938
+ if (match !== undefined)
939
+ return match;
940
+ }
941
+ }
942
+ } else if (isIndexElement(element)) {
943
+ const props = element.props;
944
+ const items = readReactive(props.each);
945
+ if (Array.isArray(items)) {
946
+ for (let i = 0;i < items.length; i++) {
947
+ const child = props.children(() => items[i], i);
948
+ const match = findTruthyMatch(normalizeContent(child));
949
+ if (match !== undefined)
950
+ return match;
951
+ }
952
+ }
953
+ } else if (isKeyElement(element)) {
954
+ const key = readReactive(element.props.when);
955
+ const child = resolveKeyChildren(element, key);
956
+ const match = findTruthyMatch(normalizeContent(child));
957
+ if (match !== undefined)
958
+ return match;
959
+ }
960
+ }
961
+ }
962
+ return;
963
+ }
964
+ function resolveMatchChildren(element, value) {
965
+ const children = element.props.children ?? element.children;
966
+ if (typeof children === "function") {
967
+ return children(value);
968
+ }
969
+ return children;
970
+ }
971
+ function resolveShowChildren(element, value) {
972
+ const children = element.props.children ?? element.children;
973
+ if (typeof children === "function") {
974
+ return children(value);
975
+ }
976
+ return children;
977
+ }
978
+ function resolveKeyChildren(element, value) {
979
+ const children = element.props.children ?? element.children;
980
+ if (typeof children === "function") {
981
+ return children(value);
982
+ }
983
+ return children;
984
+ }
985
+ function normalizeContent(content) {
986
+ if (content == null || typeof content === "boolean") {
987
+ return [];
988
+ }
989
+ return Array.isArray(content) ? content : [content];
990
+ }
814
991
  function normalizeChildren2(children) {
815
992
  if (children == null || typeof children === "boolean") {
816
993
  return [];
@@ -818,7 +995,7 @@ function normalizeChildren2(children) {
818
995
  return Array.isArray(children) ? children : [children];
819
996
  }
820
997
  function readReactive(value) {
821
- return isSignal(value) || isComputed(value) ? value.value : value;
998
+ return resolve(value);
822
999
  }
823
1000
  function appendHiddenDisplay(style) {
824
1001
  const trimmed = style.trim();
@@ -950,8 +1127,10 @@ function renderShowBlock(element, block, parent, namespace, owner) {
950
1127
  return effect(() => {
951
1128
  clearChildren(block);
952
1129
  const when = readReactive2(element.props.when);
953
- const content = withOptionalInstance(owner, () => when ? resolveShowChildren(element, when) : element.props.fallback);
954
- block.children = renderBlockContent(content, parent, block.endAnchor, namespace, owner);
1130
+ block.children = withOptionalInstance(owner, () => {
1131
+ const content = when ? resolveShowChildren(element, when) : element.props.fallback;
1132
+ return renderBlockContent(content, parent, block.endAnchor, namespace, owner);
1133
+ });
955
1134
  if (initialized) {
956
1135
  fireMountedAndQueueUpdated(owner);
957
1136
  }
@@ -1138,18 +1317,31 @@ function renderPortal(element, parent, anchor, namespace) {
1138
1317
  insertNode(parent, placeholder, anchor);
1139
1318
  const owner = getCurrentInstance();
1140
1319
  let disposeEffect = () => {};
1320
+ const targetAnchor = domOps.createComment("Sinwan-pa");
1321
+ let lastTarget = null;
1141
1322
  const portal = {
1142
1323
  type: "portal",
1143
1324
  anchor: placeholder,
1144
1325
  children: [],
1145
- dispose: () => disposeEffect()
1326
+ dispose: () => disposeEffect(),
1327
+ targetAnchor
1146
1328
  };
1147
1329
  let initialized = false;
1148
1330
  disposeEffect = effect(() => {
1149
- clearPortalChildren(portal);
1150
1331
  const target = resolvePortalTarget(element.props.mount);
1332
+ if (target !== lastTarget) {
1333
+ if (lastTarget) {
1334
+ domOps.remove(targetAnchor);
1335
+ }
1336
+ if (target) {
1337
+ domOps.appendChild(target, targetAnchor);
1338
+ }
1339
+ lastTarget = target;
1340
+ portal.target = target;
1341
+ }
1342
+ clearPortalChildren(portal);
1151
1343
  if (target) {
1152
- portal.children = renderBlockContent(element.props.children ?? element.children, target, null, namespace, owner);
1344
+ portal.children = renderBlockContent(element.props.children ?? element.children, target, targetAnchor, namespace, owner);
1153
1345
  }
1154
1346
  if (initialized) {
1155
1347
  fireMountedAndQueueUpdated(owner);
@@ -1158,48 +1350,12 @@ function renderPortal(element, parent, anchor, namespace) {
1158
1350
  });
1159
1351
  return portal;
1160
1352
  }
1161
- function resolveShowChildren(element, value) {
1162
- const children = element.props.children ?? element.children;
1163
- if (typeof children === "function") {
1164
- return children(value);
1165
- }
1166
- return children;
1167
- }
1168
- function resolveSwitchContent(element) {
1169
- const props = element.props;
1170
- const children = normalizeContent(props.children ?? element.children);
1171
- for (const child of children) {
1172
- const match = getMatchElement(child);
1173
- if (!match) {
1174
- continue;
1175
- }
1176
- const when = readReactive2(match.props.when);
1177
- if (when) {
1178
- return resolveMatchChildren(match, when);
1179
- }
1180
- }
1181
- return props.fallback;
1182
- }
1183
- function resolveMatchChildren(element, value) {
1184
- const children = element.props.children ?? element.children;
1185
- if (typeof children === "function") {
1186
- return children(value);
1187
- }
1188
- return children;
1189
- }
1190
- function resolveKeyChildren(element, value) {
1191
- const children = element.props.children ?? element.children;
1192
- if (typeof children === "function") {
1193
- return children(value);
1194
- }
1195
- return children;
1196
- }
1197
1353
  function createDynamicElement(element, tag) {
1198
1354
  if (typeof tag !== "string" && typeof tag !== "function") {
1199
1355
  return null;
1200
1356
  }
1201
1357
  const { component, ...props } = element.props;
1202
- const children = normalizeContent(props.children ?? element.children);
1358
+ const children = normalizeContent2(props.children ?? element.children);
1203
1359
  return {
1204
1360
  tag,
1205
1361
  props,
@@ -1207,11 +1363,14 @@ function createDynamicElement(element, tag) {
1207
1363
  };
1208
1364
  }
1209
1365
  function renderBlockContent(content, parent, anchor, namespace, owner) {
1210
- if (content == null || typeof content === "boolean") {
1366
+ if (content == null || typeof content === "boolean")
1211
1367
  return [];
1212
- }
1213
- const nodes = Array.isArray(content) ? content : [content];
1214
- return nodes.map((node) => withOptionalInstance(owner, () => renderNodeToDOM(node, parent, anchor, namespace)));
1368
+ return withOptionalInstance(owner, () => {
1369
+ if (Array.isArray(content)) {
1370
+ return content.map((child) => renderNodeToDOM(child, parent, anchor, namespace));
1371
+ }
1372
+ return [renderNodeToDOM(content, parent, anchor, namespace)];
1373
+ });
1215
1374
  }
1216
1375
  function clearChildren(block) {
1217
1376
  for (const child of block.children) {
@@ -1229,6 +1388,23 @@ function moveBeforeEnd(parent, mounted, endAnchor) {
1229
1388
  for (const node of getMountedDomNodes(mounted)) {
1230
1389
  domOps.insertBefore(parent, node, endAnchor);
1231
1390
  }
1391
+ syncPortalOrder(mounted);
1392
+ }
1393
+ function syncPortalOrder(mounted) {
1394
+ if (mounted.type === "portal") {
1395
+ if (mounted.target && mounted.targetAnchor) {
1396
+ for (const child of mounted.children) {
1397
+ for (const node of getMountedDomNodes(child)) {
1398
+ domOps.appendChild(mounted.target, node);
1399
+ }
1400
+ }
1401
+ domOps.appendChild(mounted.target, mounted.targetAnchor);
1402
+ }
1403
+ } else if ("children" in mounted && Array.isArray(mounted.children)) {
1404
+ for (const child of mounted.children) {
1405
+ syncPortalOrder(child);
1406
+ }
1407
+ }
1232
1408
  }
1233
1409
  function fireMountedAndQueueUpdated(owner) {
1234
1410
  if (owner) {
@@ -1240,26 +1416,14 @@ function withOptionalInstance(owner, fn) {
1240
1416
  return owner ? withInstance(owner, fn) : fn();
1241
1417
  }
1242
1418
  function readReactive2(value) {
1243
- return isSignal(value) || isComputed(value) ? value.value : value;
1419
+ return resolve(value);
1244
1420
  }
1245
- function normalizeContent(content) {
1421
+ function normalizeContent2(content) {
1246
1422
  if (content == null || typeof content === "boolean") {
1247
1423
  return [];
1248
1424
  }
1249
1425
  return Array.isArray(content) ? content : [content];
1250
1426
  }
1251
- function isElementLike(value) {
1252
- return value != null && typeof value === "object" && "tag" in value;
1253
- }
1254
- function getMatchElement(value) {
1255
- if (!isElementLike(value)) {
1256
- return null;
1257
- }
1258
- if (isMatchElement(value)) {
1259
- return value;
1260
- }
1261
- return value.tag === Match ? Match(value.props) : null;
1262
- }
1263
1427
  function resolvePortalTarget(value) {
1264
1428
  const target = readReactive2(value);
1265
1429
  if (target == null) {
@@ -1461,19 +1625,8 @@ function renderNodeToDOM(node, parent, anchor = null, namespace = null) {
1461
1625
  insertNode2(parent, text2, anchor);
1462
1626
  return { type: "text", node: text2 };
1463
1627
  }
1464
- if (isSignal(node) || isComputed(node)) {
1465
- const text2 = domOps.createTextNode(String(node.value));
1466
- insertNode2(parent, text2, anchor);
1467
- const owner = getCurrentInstance();
1468
- let initialized = false;
1469
- const dispose = effect(() => {
1470
- domOps.setTextContent(text2, String(node.value));
1471
- if (initialized) {
1472
- queueUpdatedHooks(owner);
1473
- }
1474
- initialized = true;
1475
- });
1476
- return { type: "reactive-text", node: text2, dispose };
1628
+ if (isReactive(node)) {
1629
+ return renderReactiveNodeToDOM(node, parent, anchor, namespace);
1477
1630
  }
1478
1631
  if (Array.isArray(node)) {
1479
1632
  return renderArrayToDOM(node, parent, anchor, namespace);
@@ -1510,6 +1663,37 @@ function renderChildrenToDOM(children, parent, namespace = null) {
1510
1663
  }
1511
1664
  return mounted;
1512
1665
  }
1666
+ function renderReactiveNodeToDOM(reactive, parent, anchor, namespace) {
1667
+ const startAnchor = domOps.createComment("Sinwan-r");
1668
+ const endAnchor = domOps.createComment("/Sinwan-r");
1669
+ insertNode2(parent, startAnchor, anchor);
1670
+ insertNode2(parent, endAnchor, anchor);
1671
+ const owner = getCurrentInstance();
1672
+ let mountedContent = null;
1673
+ let initialized = false;
1674
+ const block = {
1675
+ type: "reactive-block",
1676
+ startAnchor,
1677
+ endAnchor,
1678
+ children: [],
1679
+ dispose: () => {}
1680
+ };
1681
+ block.dispose = effect(() => {
1682
+ if (mountedContent) {
1683
+ removeMountedNode(mountedContent);
1684
+ }
1685
+ const value = resolve(reactive);
1686
+ mountedContent = renderNodeToDOM(value, parent, endAnchor, namespace);
1687
+ block.children = [mountedContent];
1688
+ if (initialized) {
1689
+ if (owner)
1690
+ fireMountedHooks(owner);
1691
+ queueUpdatedHooks(owner);
1692
+ }
1693
+ initialized = true;
1694
+ });
1695
+ return block;
1696
+ }
1513
1697
  function insertNode2(parent, child, anchor) {
1514
1698
  if (anchor) {
1515
1699
  domOps.insertBefore(parent, child, anchor);
@@ -1577,5 +1761,5 @@ function render(node, container) {
1577
1761
  };
1578
1762
  }
1579
1763
 
1580
- //# debugId=15A128AFFDA0548D64756E2164756E21
1764
+ //# debugId=74A1711C6AA3EA8F64756E2164756E21
1581
1765
  //# sourceMappingURL=index.development.js.map