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
@@ -316,7 +316,6 @@ function signal(initial) {
316
316
  function isSignal(value) {
317
317
  return value != null && typeof value === "object" && SIGNAL_BRAND in value;
318
318
  }
319
-
320
319
  // src/reactivity/computed.ts
321
320
  var COMPUTED_BRAND = Symbol("Sinwan:computed");
322
321
 
@@ -368,10 +367,35 @@ function computed(getter) {
368
367
  function isComputed(value) {
369
368
  return value != null && typeof value === "object" && COMPUTED_BRAND in value;
370
369
  }
371
-
370
+ // src/reactivity/batch.ts
371
+ var batchDepth = 0;
372
+ function batch(fn) {
373
+ batchDepth++;
374
+ try {
375
+ fn();
376
+ } finally {
377
+ batchDepth--;
378
+ if (batchDepth === 0) {
379
+ flushSync();
380
+ }
381
+ }
382
+ }
383
+ // src/reactivity/normalization.ts
384
+ function isReactive(value) {
385
+ return isSignal(value) || isComputed(value) || typeof value === "function";
386
+ }
387
+ function resolve(value) {
388
+ if (isSignal(value) || isComputed(value)) {
389
+ return value.value;
390
+ }
391
+ if (typeof value === "function") {
392
+ return value();
393
+ }
394
+ return value;
395
+ }
372
396
  // src/renderer/events.ts
373
397
  function isEventProp(key) {
374
- return key.length > 2 && key[0] === "o" && key[1] === "n" && key[2] >= "A" && key[2] <= "Z";
398
+ return key.length > 2 && key.startsWith("on");
375
399
  }
376
400
  function toEventName(key) {
377
401
  return key.slice(2).toLowerCase();
@@ -448,19 +472,28 @@ function fireMountedHooks(instance) {
448
472
  }
449
473
  }
450
474
  function fireUnmountedHooks(instance) {
451
- for (const child of instance.children) {
475
+ const children = [...instance.children];
476
+ for (const child of children) {
452
477
  fireUnmountedHooks(child);
453
478
  }
454
- if (instance.isMounted && !instance.isUnmounted) {
479
+ if (!instance.isUnmounted) {
455
480
  instance.isUnmounted = true;
456
- instance.isMounted = false;
457
- for (const hook of instance._unmountedHooks) {
458
- hook();
481
+ if (instance.isMounted) {
482
+ instance.isMounted = false;
483
+ for (const hook of instance._unmountedHooks) {
484
+ hook();
485
+ }
459
486
  }
460
487
  for (const dispose of instance.effects) {
461
488
  dispose();
462
489
  }
463
490
  instance.effects.length = 0;
491
+ if (instance.parent) {
492
+ const idx = instance.parent.children.indexOf(instance);
493
+ if (idx !== -1) {
494
+ instance.parent.children.splice(idx, 1);
495
+ }
496
+ }
464
497
  }
465
498
  }
466
499
  function fireUpdatedHooks(instance) {
@@ -510,11 +543,13 @@ function applyAttributes(el, props) {
510
543
  for (const [key, value] of Object.entries(props)) {
511
544
  if (SKIP_PROPS.has(key) || isEventProp(key))
512
545
  continue;
513
- if (isSignal(value) || isComputed(value)) {
546
+ const attrName = resolveAttributeName(key);
547
+ const isComplex = attrName === "class" || attrName === "style";
548
+ if (isReactive(value) || isComplex && containsReactive(value)) {
514
549
  const state = { previousStyleProps: new Set };
515
550
  let initialized = false;
516
551
  const dispose = effect(() => {
517
- setSingleAttribute(el, key, value.value, state);
552
+ setSingleAttribute(el, key, resolve(value), state);
518
553
  if (initialized) {
519
554
  queueUpdatedHooks(owner);
520
555
  }
@@ -572,19 +607,17 @@ function setSingleAttribute(el, key, value, state) {
572
607
  function resolveAttributeName(key) {
573
608
  return PROP_ALIASES[key] ?? key;
574
609
  }
575
- function applyStyle(el, styles, state) {
610
+ function applyStyle(el, value, state) {
611
+ const styleObj = normalizeStyle(value);
576
612
  const nextProps = new Set;
577
- for (const [prop, val] of Object.entries(styles)) {
613
+ for (const [prop, val] of Object.entries(styleObj)) {
578
614
  nextProps.add(prop);
579
615
  if (val == null) {
580
616
  removeStyleProperty(el, prop);
581
617
  continue;
582
618
  }
583
- if (prop.includes("-")) {
584
- el.style.setProperty(prop, String(val));
585
- } else {
586
- el.style[prop] = val;
587
- }
619
+ const kebabProp = prop.startsWith("--") ? prop : camelToKebab(prop);
620
+ el.style.setProperty(kebabProp, String(val));
588
621
  }
589
622
  if (!state) {
590
623
  return;
@@ -596,37 +629,77 @@ function applyStyle(el, styles, state) {
596
629
  }
597
630
  state.previousStyleProps = nextProps;
598
631
  }
632
+ function normalizeStyle(value) {
633
+ const resolved = resolve(value);
634
+ if (!resolved)
635
+ return {};
636
+ if (typeof resolved === "string") {
637
+ return parseStyleString(resolved);
638
+ }
639
+ if (Array.isArray(resolved)) {
640
+ return resolved.reduce((acc, item) => {
641
+ const normalized = normalizeStyle(item);
642
+ return Object.assign(acc, normalized);
643
+ }, {});
644
+ }
645
+ if (typeof resolved === "object") {
646
+ const result = {};
647
+ for (const [k, v] of Object.entries(resolved)) {
648
+ result[k] = resolve(v);
649
+ }
650
+ return result;
651
+ }
652
+ return {};
653
+ }
654
+ function parseStyleString(style) {
655
+ const result = {};
656
+ style.split(";").forEach((rule) => {
657
+ const i = rule.indexOf(":");
658
+ if (i > 0) {
659
+ const prop = rule.slice(0, i).trim();
660
+ const val = rule.slice(i + 1).trim();
661
+ if (prop && val) {
662
+ result[prop] = val;
663
+ }
664
+ }
665
+ });
666
+ return result;
667
+ }
599
668
  function removeStyleProperty(el, prop) {
600
- if (prop.includes("-")) {
601
- el.style.removeProperty(prop);
602
- } else {
603
- el.style[prop] = "";
604
- }
669
+ const kebabProp = prop.startsWith("--") ? prop : camelToKebab(prop);
670
+ el.style.removeProperty(kebabProp);
605
671
  }
606
672
  function applyClass(el, value) {
607
- let classStr;
608
- if (Array.isArray(value)) {
609
- classStr = value.filter(Boolean).join(" ");
610
- } else if (typeof value === "object" && value !== null) {
611
- classStr = Object.entries(value).filter(([, v]) => Boolean(v)).map(([k]) => k).join(" ");
612
- } else {
613
- classStr = String(value);
673
+ domOps.setAttribute(el, "class", normalizeClass(value));
674
+ }
675
+ function normalizeClass(value) {
676
+ const resolved = resolve(value);
677
+ if (!resolved)
678
+ return "";
679
+ if (typeof resolved === "string")
680
+ return resolved;
681
+ if (Array.isArray(resolved)) {
682
+ return resolved.map(normalizeClass).filter(Boolean).join(" ");
683
+ }
684
+ if (typeof resolved === "object") {
685
+ return Object.entries(resolved).filter(([, v]) => Boolean(resolve(v))).map(([k]) => k).join(" ");
614
686
  }
615
- domOps.setAttribute(el, "class", classStr);
687
+ return String(resolved);
616
688
  }
617
- // src/reactivity/batch.ts
618
- var batchDepth = 0;
619
- function batch(fn) {
620
- batchDepth++;
621
- try {
622
- fn();
623
- } finally {
624
- batchDepth--;
625
- if (batchDepth === 0) {
626
- flushSync();
627
- }
689
+ function containsReactive(value) {
690
+ if (isReactive(value))
691
+ return true;
692
+ if (Array.isArray(value))
693
+ return value.some(containsReactive);
694
+ if (typeof value === "object" && value !== null) {
695
+ return Object.values(value).some(containsReactive);
628
696
  }
697
+ return false;
698
+ }
699
+ function camelToKebab(str) {
700
+ return str.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`);
629
701
  }
702
+
630
703
  // src/component/control-flow.ts
631
704
  var SHOW_TYPE = Symbol.for("Sinwan.Show");
632
705
  var FOR_TYPE = Symbol.for("Sinwan.For");
@@ -720,6 +793,9 @@ function Portal(props) {
720
793
  children: []
721
794
  };
722
795
  }
796
+ function isElementLike(value) {
797
+ return value != null && typeof value === "object" && "tag" in value;
798
+ }
723
799
  function isShowElement(element) {
724
800
  return element.tag === SHOW_TYPE;
725
801
  }
@@ -744,6 +820,107 @@ function isDynamicElement(element) {
744
820
  function isPortalElement(element) {
745
821
  return element.tag === PORTAL_TYPE;
746
822
  }
823
+ function resolveSwitchContent(element) {
824
+ const props = element.props;
825
+ const children = normalizeContent(props.children ?? element.children);
826
+ const match = findTruthyMatch(children);
827
+ return match !== undefined ? match : props.fallback;
828
+ }
829
+ function findTruthyMatch(nodes) {
830
+ for (const node of nodes) {
831
+ if (node == null || typeof node === "boolean")
832
+ continue;
833
+ if (Array.isArray(node)) {
834
+ const match = findTruthyMatch(node);
835
+ if (match !== undefined)
836
+ return match;
837
+ continue;
838
+ }
839
+ if (isElementLike(node)) {
840
+ let element = node;
841
+ if (typeof element.tag === "function") {
842
+ const tag = element.tag;
843
+ if (tag === Match || tag === Show || tag === For || tag === Index || tag === Key || tag === Switch) {
844
+ element = tag(element.props);
845
+ }
846
+ }
847
+ if (isMatchElement(element)) {
848
+ const when = readReactive(element.props.when);
849
+ if (when) {
850
+ return resolveMatchChildren(element, when);
851
+ }
852
+ } else if (isShowElement(element)) {
853
+ const when = readReactive(element.props.when);
854
+ if (when) {
855
+ const content = resolveShowChildren(element, when);
856
+ const match = findTruthyMatch(normalizeContent(content));
857
+ if (match !== undefined)
858
+ return match;
859
+ } else if (element.props.fallback) {
860
+ const match = findTruthyMatch(normalizeContent(element.props.fallback));
861
+ if (match !== undefined)
862
+ return match;
863
+ }
864
+ } else if (isForElement(element)) {
865
+ const props = element.props;
866
+ const items = readReactive(props.each);
867
+ if (Array.isArray(items)) {
868
+ for (let i = 0;i < items.length; i++) {
869
+ const child = props.children(items[i], () => i);
870
+ const match = findTruthyMatch(normalizeContent(child));
871
+ if (match !== undefined)
872
+ return match;
873
+ }
874
+ }
875
+ } else if (isIndexElement(element)) {
876
+ const props = element.props;
877
+ const items = readReactive(props.each);
878
+ if (Array.isArray(items)) {
879
+ for (let i = 0;i < items.length; i++) {
880
+ const child = props.children(() => items[i], i);
881
+ const match = findTruthyMatch(normalizeContent(child));
882
+ if (match !== undefined)
883
+ return match;
884
+ }
885
+ }
886
+ } else if (isKeyElement(element)) {
887
+ const key = readReactive(element.props.when);
888
+ const child = resolveKeyChildren(element, key);
889
+ const match = findTruthyMatch(normalizeContent(child));
890
+ if (match !== undefined)
891
+ return match;
892
+ }
893
+ }
894
+ }
895
+ return;
896
+ }
897
+ function resolveMatchChildren(element, value) {
898
+ const children = element.props.children ?? element.children;
899
+ if (typeof children === "function") {
900
+ return children(value);
901
+ }
902
+ return children;
903
+ }
904
+ function resolveShowChildren(element, value) {
905
+ const children = element.props.children ?? element.children;
906
+ if (typeof children === "function") {
907
+ return children(value);
908
+ }
909
+ return children;
910
+ }
911
+ function resolveKeyChildren(element, value) {
912
+ const children = element.props.children ?? element.children;
913
+ if (typeof children === "function") {
914
+ return children(value);
915
+ }
916
+ return children;
917
+ }
918
+ function normalizeContent(content) {
919
+ if (content == null || typeof content === "boolean") {
920
+ return [];
921
+ }
922
+ return Array.isArray(content) ? content : [content];
923
+ }
747
924
  function normalizeChildren2(children) {
748
925
  if (children == null || typeof children === "boolean") {
749
926
  return [];
@@ -751,7 +928,7 @@ function normalizeChildren2(children) {
751
928
  return Array.isArray(children) ? children : [children];
752
929
  }
753
930
  function readReactive(value) {
754
- return isSignal(value) || isComputed(value) ? value.value : value;
931
+ return resolve(value);
755
932
  }
756
933
  function appendHiddenDisplay(style) {
757
934
  const trimmed = style.trim();
@@ -883,8 +1060,10 @@ function renderShowBlock(element, block, parent, namespace, owner) {
883
1060
  return effect(() => {
884
1061
  clearChildren(block);
885
1062
  const when = readReactive2(element.props.when);
886
- const content = withOptionalInstance(owner, () => when ? resolveShowChildren(element, when) : element.props.fallback);
887
- block.children = renderBlockContent(content, parent, block.endAnchor, namespace, owner);
1063
+ block.children = withOptionalInstance(owner, () => {
1064
+ const content = when ? resolveShowChildren(element, when) : element.props.fallback;
1065
+ return renderBlockContent(content, parent, block.endAnchor, namespace, owner);
1066
+ });
888
1067
  if (initialized) {
889
1068
  fireMountedAndQueueUpdated(owner);
890
1069
  }
@@ -1071,18 +1250,31 @@ function renderPortal(element, parent, anchor, namespace) {
1071
1250
  insertNode(parent, placeholder, anchor);
1072
1251
  const owner = getCurrentInstance();
1073
1252
  let disposeEffect = () => {};
1253
+ const targetAnchor = domOps.createComment("Sinwan-pa");
1254
+ let lastTarget = null;
1074
1255
  const portal = {
1075
1256
  type: "portal",
1076
1257
  anchor: placeholder,
1077
1258
  children: [],
1078
- dispose: () => disposeEffect()
1259
+ dispose: () => disposeEffect(),
1260
+ targetAnchor
1079
1261
  };
1080
1262
  let initialized = false;
1081
1263
  disposeEffect = effect(() => {
1082
- clearPortalChildren(portal);
1083
1264
  const target = resolvePortalTarget(element.props.mount);
1265
+ if (target !== lastTarget) {
1266
+ if (lastTarget) {
1267
+ domOps.remove(targetAnchor);
1268
+ }
1269
+ if (target) {
1270
+ domOps.appendChild(target, targetAnchor);
1271
+ }
1272
+ lastTarget = target;
1273
+ portal.target = target;
1274
+ }
1275
+ clearPortalChildren(portal);
1084
1276
  if (target) {
1085
- portal.children = renderBlockContent(element.props.children ?? element.children, target, null, namespace, owner);
1277
+ portal.children = renderBlockContent(element.props.children ?? element.children, target, targetAnchor, namespace, owner);
1086
1278
  }
1087
1279
  if (initialized) {
1088
1280
  fireMountedAndQueueUpdated(owner);
@@ -1091,48 +1283,12 @@ function renderPortal(element, parent, anchor, namespace) {
1091
1283
  });
1092
1284
  return portal;
1093
1285
  }
1094
- function resolveShowChildren(element, value) {
1095
- const children = element.props.children ?? element.children;
1096
- if (typeof children === "function") {
1097
- return children(value);
1098
- }
1099
- return children;
1100
- }
1101
- function resolveSwitchContent(element) {
1102
- const props = element.props;
1103
- const children = normalizeContent(props.children ?? element.children);
1104
- for (const child of children) {
1105
- const match = getMatchElement(child);
1106
- if (!match) {
1107
- continue;
1108
- }
1109
- const when = readReactive2(match.props.when);
1110
- if (when) {
1111
- return resolveMatchChildren(match, when);
1112
- }
1113
- }
1114
- return props.fallback;
1115
- }
1116
- function resolveMatchChildren(element, value) {
1117
- const children = element.props.children ?? element.children;
1118
- if (typeof children === "function") {
1119
- return children(value);
1120
- }
1121
- return children;
1122
- }
1123
- function resolveKeyChildren(element, value) {
1124
- const children = element.props.children ?? element.children;
1125
- if (typeof children === "function") {
1126
- return children(value);
1127
- }
1128
- return children;
1129
- }
1130
1286
  function createDynamicElement(element, tag) {
1131
1287
  if (typeof tag !== "string" && typeof tag !== "function") {
1132
1288
  return null;
1133
1289
  }
1134
1290
  const { component, ...props } = element.props;
1135
- const children = normalizeContent(props.children ?? element.children);
1291
+ const children = normalizeContent2(props.children ?? element.children);
1136
1292
  return {
1137
1293
  tag,
1138
1294
  props,
@@ -1140,11 +1296,14 @@ function createDynamicElement(element, tag) {
1140
1296
  };
1141
1297
  }
1142
1298
  function renderBlockContent(content, parent, anchor, namespace, owner) {
1143
- if (content == null || typeof content === "boolean") {
1299
+ if (content == null || typeof content === "boolean")
1144
1300
  return [];
1145
- }
1146
- const nodes = Array.isArray(content) ? content : [content];
1147
- return nodes.map((node) => withOptionalInstance(owner, () => renderNodeToDOM(node, parent, anchor, namespace)));
1301
+ return withOptionalInstance(owner, () => {
1302
+ if (Array.isArray(content)) {
1303
+ return content.map((child) => renderNodeToDOM(child, parent, anchor, namespace));
1304
+ }
1305
+ return [renderNodeToDOM(content, parent, anchor, namespace)];
1306
+ });
1148
1307
  }
1149
1308
  function clearChildren(block) {
1150
1309
  for (const child of block.children) {
@@ -1162,6 +1321,23 @@ function moveBeforeEnd(parent, mounted, endAnchor) {
1162
1321
  for (const node of getMountedDomNodes(mounted)) {
1163
1322
  domOps.insertBefore(parent, node, endAnchor);
1164
1323
  }
1324
+ syncPortalOrder(mounted);
1325
+ }
1326
+ function syncPortalOrder(mounted) {
1327
+ if (mounted.type === "portal") {
1328
+ if (mounted.target && mounted.targetAnchor) {
1329
+ for (const child of mounted.children) {
1330
+ for (const node of getMountedDomNodes(child)) {
1331
+ domOps.appendChild(mounted.target, node);
1332
+ }
1333
+ }
1334
+ domOps.appendChild(mounted.target, mounted.targetAnchor);
1335
+ }
1336
+ } else if ("children" in mounted && Array.isArray(mounted.children)) {
1337
+ for (const child of mounted.children) {
1338
+ syncPortalOrder(child);
1339
+ }
1340
+ }
1165
1341
  }
1166
1342
  function fireMountedAndQueueUpdated(owner) {
1167
1343
  if (owner) {
@@ -1173,26 +1349,14 @@ function withOptionalInstance(owner, fn) {
1173
1349
  return owner ? withInstance(owner, fn) : fn();
1174
1350
  }
1175
1351
  function readReactive2(value) {
1176
- return isSignal(value) || isComputed(value) ? value.value : value;
1352
+ return resolve(value);
1177
1353
  }
1178
- function normalizeContent(content) {
1354
+ function normalizeContent2(content) {
1179
1355
  if (content == null || typeof content === "boolean") {
1180
1356
  return [];
1181
1357
  }
1182
1358
  return Array.isArray(content) ? content : [content];
1183
1359
  }
1184
- function isElementLike(value) {
1185
- return value != null && typeof value === "object" && "tag" in value;
1186
- }
1187
- function getMatchElement(value) {
1188
- if (!isElementLike(value)) {
1189
- return null;
1190
- }
1191
- if (isMatchElement(value)) {
1192
- return value;
1193
- }
1194
- return value.tag === Match ? Match(value.props) : null;
1195
- }
1196
1360
  function resolvePortalTarget(value) {
1197
1361
  const target = readReactive2(value);
1198
1362
  if (target == null) {
@@ -1394,19 +1558,8 @@ function renderNodeToDOM(node, parent, anchor = null, namespace = null) {
1394
1558
  insertNode2(parent, text2, anchor);
1395
1559
  return { type: "text", node: text2 };
1396
1560
  }
1397
- if (isSignal(node) || isComputed(node)) {
1398
- const text2 = domOps.createTextNode(String(node.value));
1399
- insertNode2(parent, text2, anchor);
1400
- const owner = getCurrentInstance();
1401
- let initialized = false;
1402
- const dispose = effect(() => {
1403
- domOps.setTextContent(text2, String(node.value));
1404
- if (initialized) {
1405
- queueUpdatedHooks(owner);
1406
- }
1407
- initialized = true;
1408
- });
1409
- return { type: "reactive-text", node: text2, dispose };
1561
+ if (isReactive(node)) {
1562
+ return renderReactiveNodeToDOM(node, parent, anchor, namespace);
1410
1563
  }
1411
1564
  if (Array.isArray(node)) {
1412
1565
  return renderArrayToDOM(node, parent, anchor, namespace);
@@ -1443,6 +1596,37 @@ function renderChildrenToDOM(children, parent, namespace = null) {
1443
1596
  }
1444
1597
  return mounted;
1445
1598
  }
1599
+ function renderReactiveNodeToDOM(reactive, parent, anchor, namespace) {
1600
+ const startAnchor = domOps.createComment("Sinwan-r");
1601
+ const endAnchor = domOps.createComment("/Sinwan-r");
1602
+ insertNode2(parent, startAnchor, anchor);
1603
+ insertNode2(parent, endAnchor, anchor);
1604
+ const owner = getCurrentInstance();
1605
+ let mountedContent = null;
1606
+ let initialized = false;
1607
+ const block = {
1608
+ type: "reactive-block",
1609
+ startAnchor,
1610
+ endAnchor,
1611
+ children: [],
1612
+ dispose: () => {}
1613
+ };
1614
+ block.dispose = effect(() => {
1615
+ if (mountedContent) {
1616
+ removeMountedNode(mountedContent);
1617
+ }
1618
+ const value = resolve(reactive);
1619
+ mountedContent = renderNodeToDOM(value, parent, endAnchor, namespace);
1620
+ block.children = [mountedContent];
1621
+ if (initialized) {
1622
+ if (owner)
1623
+ fireMountedHooks(owner);
1624
+ queueUpdatedHooks(owner);
1625
+ }
1626
+ initialized = true;
1627
+ });
1628
+ return block;
1629
+ }
1446
1630
  function insertNode2(parent, child, anchor) {
1447
1631
  if (anchor) {
1448
1632
  domOps.insertBefore(parent, child, anchor);
@@ -1526,5 +1710,5 @@ export {
1526
1710
  applyAttributes
1527
1711
  };
1528
1712
 
1529
- //# debugId=5F0DDB77CC3157EE64756E2164756E21
1713
+ //# debugId=EBE55516E78B698564756E2164756E21
1530
1714
  //# sourceMappingURL=index.development.js.map