tutuca 0.9.68 → 0.9.69

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.
@@ -5833,16 +5833,16 @@ function parseXOpVal(opName, value, px, parserFn) {
5833
5833
  return val;
5834
5834
  }
5835
5835
  function processXExtras(node, attrs, opName, startIdx, px) {
5836
- const consumed = X_OP_CONSUMED[opName];
5837
- const wrappable = X_OP_WRAPPABLE.has(opName);
5836
+ const { consumed, wrappable } = X_OPS[opName];
5838
5837
  const wrappers = [];
5839
5838
  for (let i = startIdx;i < attrs.length; i++) {
5840
5839
  const a = attrs[i];
5841
5840
  const aName = a.name;
5842
5841
  if (consumed.has(aName))
5843
5842
  continue;
5844
- if (wrappable && X_ATTR_WRAPPERS[aName]) {
5845
- wrappers.push([X_ATTR_WRAPPERS[aName], vp.parseBool(a.value, px)]);
5843
+ const wrapper = wrappable ? X_OPS[aName]?.wrapper : null;
5844
+ if (wrapper) {
5845
+ wrappers.push([wrapper, vp.parseBool(a.value, px)]);
5846
5846
  continue;
5847
5847
  }
5848
5848
  const issueInfo = { op: opName, name: aName, value: a.value };
@@ -5878,6 +5878,12 @@ function makeWrapperNode(data, px) {
5878
5878
  }
5879
5879
  return node;
5880
5880
  }
5881
+ function dynRenderStep(comp, name, key) {
5882
+ const p = resolveDynProducer(comp, name);
5883
+ if (!p)
5884
+ return null;
5885
+ return key === undefined ? new DynStep(p.producerCompId, p.producerSteps) : new DynEachStep(p.producerCompId, p.producerSteps, key);
5886
+ }
5881
5887
 
5882
5888
  class IterInfo {
5883
5889
  constructor(val, whenVal, loopWithVal, enrichWithVal) {
@@ -5894,6 +5900,9 @@ class IterInfo {
5894
5900
  return { seq, filter, loopWith, enricher };
5895
5901
  }
5896
5902
  }
5903
+ function xOp(consumed = [], { wrappable = false, wrapper = null } = {}) {
5904
+ return { consumed: new Set(consumed), wrappable, wrapper };
5905
+ }
5897
5906
 
5898
5907
  class ParseContext {
5899
5908
  constructor(document2, Text, Comment, nodes, events, macroNodes, frame, parent) {
@@ -5967,29 +5976,29 @@ class ParseContext {
5967
5976
  console.warn(`tutuca parse issue [${kind}]`, info);
5968
5977
  }
5969
5978
  }
5979
+ function trimEdgeWhite(node) {
5980
+ if (!node.isWhiteSpace?.())
5981
+ return false;
5982
+ node.condenseWhiteSpace();
5983
+ return true;
5984
+ }
5970
5985
  function condenseChildsWhites(childs) {
5971
5986
  if (childs.length === 0)
5972
5987
  return childs;
5973
- let changed = false;
5974
- if (childs[0].isWhiteSpace?.()) {
5975
- childs[0].condenseWhiteSpace();
5976
- changed = true;
5977
- }
5978
5988
  const last = childs.length - 1;
5979
- if (last > 0 && childs[last].isWhiteSpace?.()) {
5980
- childs[last].condenseWhiteSpace();
5981
- changed = true;
5982
- }
5989
+ let emptied = trimEdgeWhite(childs[0]);
5990
+ if (last > 0 && trimEdgeWhite(childs[last]))
5991
+ emptied = true;
5983
5992
  for (let i = 1;i < last; i++) {
5984
5993
  const cur = childs[i];
5985
- if (cur.isWhiteSpace?.() && cur.hasNewLine()) {
5986
- const bothBlock = isBlockDomNode(childs[i - 1]) && isBlockDomNode(childs[i + 1]);
5987
- cur.condenseWhiteSpace(bothBlock ? "" : " ");
5988
- if (bothBlock)
5989
- changed = true;
5990
- }
5994
+ if (!(cur.isWhiteSpace?.() && cur.hasNewLine()))
5995
+ continue;
5996
+ const bothBlock = isBlockDomNode(childs[i - 1]) && isBlockDomNode(childs[i + 1]);
5997
+ cur.condenseWhiteSpace(bothBlock ? "" : " ");
5998
+ if (bothBlock)
5999
+ emptied = true;
5991
6000
  }
5992
- return changed ? childs.filter((c) => !(c instanceof TextNode && c.val === "")) : childs;
6001
+ return emptied ? childs.filter((c) => !isEmptyText(c)) : childs;
5993
6002
  }
5994
6003
 
5995
6004
  class NodeEvents {
@@ -6045,10 +6054,10 @@ function compileModifiers(eventName, names) {
6045
6054
  return w(this, f, args, ctx);
6046
6055
  };
6047
6056
  }
6048
- var TextNode, CommentNode, ChildsNode, DomNode, FragmentNode, maybeFragment = (xs) => xs.length === 1 ? xs[0] : new FragmentNode(xs), VALID_NODE_RE, ANode, MacroNode, RenderViewId, RenderNode, RenderItNode, RenderEachNode, RenderTextNode, RenderOnceNode, WrapperNode, ShowNode, HideNode, PushViewNameNode, SlotNode, ScopeNode, EachNode, filterAlwaysTrue = (_v, _k, _seq) => true, nullLoopWith = (seq) => ({ iterData: { seq } }), X_OP_CONSUMED, X_OP_WRAPPABLE, X_ATTR_WRAPPERS, WRAPPER_NODES, _htmlBlockTags = "ADDRESS,ARTICLE,ASIDE,BLOCKQUOTE,CAPTION,COL,COLGROUP,DETAILS,DIALOG,DIV,DD,DL,DT,FIELDSET,FIGCAPTION,FIGURE,FOOTER,FORM,H1,H2,H3,H4,H5,H6,HEADER,HGROUP,HR,LEGEND,LI,MAIN,MENU,NAV,OL,P,PRE,SECTION,SUMMARY,TABLE,TBODY,TD,TFOOT,TH,THEAD,TR,UL", HTML_BLOCK_TAGS, isBlockDomNode = (n) => {
6057
+ var TextNode, CommentNode, ChildsNode, DomNode, FragmentNode, maybeFragment = (xs) => xs.length === 1 ? xs[0] : new FragmentNode(xs), VALID_NODE_RE, ANode, MacroNode, RenderViewId, RenderNode, RenderItNode, RenderEachNode, RenderTextNode, RenderOnceNode, WrapperNode, ShowNode, HideNode, PushViewNameNode, SlotNode, ScopeNode, EachNode, filterAlwaysTrue = (_v, _k, _seq) => true, nullLoopWith = (seq) => ({ iterData: { seq } }), X_OPS, WRAPPER_NODES, _htmlBlockTags = "ADDRESS,ARTICLE,ASIDE,BLOCKQUOTE,CAPTION,COL,COLGROUP,DETAILS,DIALOG,DIV,DD,DL,DT,FIELDSET,FIGCAPTION,FIGURE,FOOTER,FORM,H1,H2,H3,H4,H5,H6,HEADER,HGROUP,HR,LEGEND,LI,MAIN,MENU,NAV,OL,P,PRE,SECTION,SUMMARY,TABLE,TBODY,TD,TFOOT,TH,THEAD,TR,UL", HTML_BLOCK_TAGS, isBlockDomNode = (n) => {
6049
6058
  const node = n instanceof FragmentNode ? n.childs[0] : n;
6050
6059
  return node instanceof DomNode && HTML_BLOCK_TAGS.has(node.tagName);
6051
- }, isMac, fwdIfCtxPred = (pred) => (w) => (that, f, args, ctx) => pred(ctx) ? w(that, f, args, ctx) : that, fwdIfKey = (keyName) => fwdIfCtxPred((ctx) => ctx.e.key === keyName), fwdCtrl, fwdMeta, fwdAlt, metaWraps, MOD_WRAPPERS_BY_EVENT, identityModifierWrapper = (f, _ctx) => f;
6060
+ }, isEmptyText = (c) => c instanceof TextNode && c.val === "", isMac, fwdIfCtxPred = (pred) => (w) => (that, f, args, ctx) => pred(ctx) ? w(that, f, args, ctx) : that, fwdIfKey = (keyName) => fwdIfCtxPred((ctx) => ctx.e.key === keyName), fwdCtrl, fwdMeta, fwdAlt, metaWraps, MOD_WRAPPERS_BY_EVENT, identityModifierWrapper = (f, _ctx) => f;
6052
6061
  var init_anode = __esm(() => {
6053
6062
  init_attribute();
6054
6063
  init_path();
@@ -6252,10 +6261,8 @@ var init_anode = __esm(() => {
6252
6261
  return rx.renderIt(newStack, this, "", this.viewId);
6253
6262
  }
6254
6263
  toPathStep(ctx) {
6255
- if (this.val instanceof DynVal) {
6256
- const p = resolveDynProducer(ctx.comp, this.val.name);
6257
- return p ? new DynStep(p.producerCompId, p.producerSteps) : null;
6258
- }
6264
+ if (this.val instanceof DynVal)
6265
+ return dynRenderStep(ctx.comp, this.val.name);
6259
6266
  return super.toPathStep(ctx);
6260
6267
  }
6261
6268
  };
@@ -6270,10 +6277,8 @@ var init_anode = __esm(() => {
6270
6277
  return null;
6271
6278
  const nextNode = next.resolveNode();
6272
6279
  if (nextNode instanceof EachNode && next.hasKey) {
6273
- if (nextNode.val instanceof DynVal) {
6274
- const p = resolveDynProducer(ctx.comp, nextNode.val.name);
6275
- return p ? new DynEachStep(p.producerCompId, p.producerSteps, next.key) : null;
6276
- }
6280
+ if (nextNode.val instanceof DynVal)
6281
+ return dynRenderStep(ctx.comp, nextNode.val.name, next.key);
6277
6282
  return new EachRenderItStep(nextNode.val.name, next.key);
6278
6283
  }
6279
6284
  return null;
@@ -6288,12 +6293,8 @@ var init_anode = __esm(() => {
6288
6293
  return rx.renderEach(stack, this.iterInfo, this, this.viewId);
6289
6294
  }
6290
6295
  toPathStep(ctx) {
6291
- if (this.val instanceof DynVal) {
6292
- if (!ctx.hasKey)
6293
- return null;
6294
- const p = resolveDynProducer(ctx.comp, this.val.name);
6295
- return p ? new DynEachStep(p.producerCompId, p.producerSteps, ctx.key) : null;
6296
- }
6296
+ if (this.val instanceof DynVal)
6297
+ return ctx.hasKey ? dynRenderStep(ctx.comp, this.val.name, ctx.key) : null;
6297
6298
  return super.toPathStep(ctx);
6298
6299
  }
6299
6300
  static parse(px, vp2, s, as, attrs) {
@@ -6396,17 +6397,15 @@ var init_anode = __esm(() => {
6396
6397
  }
6397
6398
  static register = true;
6398
6399
  };
6399
- X_OP_CONSUMED = {
6400
- slot: new Set,
6401
- text: new Set,
6402
- render: new Set(["as"]),
6403
- "render-it": new Set(["as"]),
6404
- "render-each": new Set(["as", "when", "loop-with"]),
6405
- show: new Set,
6406
- hide: new Set
6407
- };
6408
- X_OP_WRAPPABLE = new Set(["text", "render", "render-it", "render-each"]);
6409
- X_ATTR_WRAPPERS = { show: ShowNode, hide: HideNode };
6400
+ X_OPS = {
6401
+ slot: xOp(),
6402
+ text: xOp([], { wrappable: true }),
6403
+ render: xOp(["as"], { wrappable: true }),
6404
+ "render-it": xOp(["as"], { wrappable: true }),
6405
+ "render-each": xOp(["as", "when", "loop-with"], { wrappable: true }),
6406
+ show: xOp([], { wrapper: ShowNode }),
6407
+ hide: xOp([], { wrapper: HideNode })
6408
+ };
6410
6409
  WRAPPER_NODES = {
6411
6410
  slot: SlotNode,
6412
6411
  show: ShowNode,
@@ -5264,16 +5264,16 @@ function parseXOpVal(opName, value, px, parserFn) {
5264
5264
  return val;
5265
5265
  }
5266
5266
  function processXExtras(node, attrs, opName, startIdx, px) {
5267
- const consumed = X_OP_CONSUMED[opName];
5268
- const wrappable = X_OP_WRAPPABLE.has(opName);
5267
+ const { consumed, wrappable } = X_OPS[opName];
5269
5268
  const wrappers = [];
5270
5269
  for (let i = startIdx;i < attrs.length; i++) {
5271
5270
  const a = attrs[i];
5272
5271
  const aName = a.name;
5273
5272
  if (consumed.has(aName))
5274
5273
  continue;
5275
- if (wrappable && X_ATTR_WRAPPERS[aName]) {
5276
- wrappers.push([X_ATTR_WRAPPERS[aName], vp.parseBool(a.value, px)]);
5274
+ const wrapper = wrappable ? X_OPS[aName]?.wrapper : null;
5275
+ if (wrapper) {
5276
+ wrappers.push([wrapper, vp.parseBool(a.value, px)]);
5277
5277
  continue;
5278
5278
  }
5279
5279
  const issueInfo = { op: opName, name: aName, value: a.value };
@@ -5365,6 +5365,12 @@ class RenderViewId extends ANode {
5365
5365
  }
5366
5366
  setDataAttr(_key, _val) {}
5367
5367
  }
5368
+ function dynRenderStep(comp, name, key) {
5369
+ const p = resolveDynProducer(comp, name);
5370
+ if (!p)
5371
+ return null;
5372
+ return key === undefined ? new DynStep(p.producerCompId, p.producerSteps) : new DynEachStep(p.producerCompId, p.producerSteps, key);
5373
+ }
5368
5374
 
5369
5375
  class RenderNode extends RenderViewId {
5370
5376
  render(stack, rx) {
@@ -5372,10 +5378,8 @@ class RenderNode extends RenderViewId {
5372
5378
  return rx.renderIt(newStack, this, "", this.viewId);
5373
5379
  }
5374
5380
  toPathStep(ctx) {
5375
- if (this.val instanceof DynVal) {
5376
- const p = resolveDynProducer(ctx.comp, this.val.name);
5377
- return p ? new DynStep(p.producerCompId, p.producerSteps) : null;
5378
- }
5381
+ if (this.val instanceof DynVal)
5382
+ return dynRenderStep(ctx.comp, this.val.name);
5379
5383
  return super.toPathStep(ctx);
5380
5384
  }
5381
5385
  }
@@ -5391,10 +5395,8 @@ class RenderItNode extends RenderViewId {
5391
5395
  return null;
5392
5396
  const nextNode = next.resolveNode();
5393
5397
  if (nextNode instanceof EachNode && next.hasKey) {
5394
- if (nextNode.val instanceof DynVal) {
5395
- const p = resolveDynProducer(ctx.comp, nextNode.val.name);
5396
- return p ? new DynEachStep(p.producerCompId, p.producerSteps, next.key) : null;
5397
- }
5398
+ if (nextNode.val instanceof DynVal)
5399
+ return dynRenderStep(ctx.comp, nextNode.val.name, next.key);
5398
5400
  return new EachRenderItStep(nextNode.val.name, next.key);
5399
5401
  }
5400
5402
  return null;
@@ -5410,12 +5412,8 @@ class RenderEachNode extends RenderViewId {
5410
5412
  return rx.renderEach(stack, this.iterInfo, this, this.viewId);
5411
5413
  }
5412
5414
  toPathStep(ctx) {
5413
- if (this.val instanceof DynVal) {
5414
- if (!ctx.hasKey)
5415
- return null;
5416
- const p = resolveDynProducer(ctx.comp, this.val.name);
5417
- return p ? new DynEachStep(p.producerCompId, p.producerSteps, ctx.key) : null;
5418
- }
5415
+ if (this.val instanceof DynVal)
5416
+ return ctx.hasKey ? dynRenderStep(ctx.comp, this.val.name, ctx.key) : null;
5419
5417
  return super.toPathStep(ctx);
5420
5418
  }
5421
5419
  static parse(px, vp2, s, as, attrs) {
@@ -5545,17 +5543,18 @@ class IterInfo {
5545
5543
  }
5546
5544
  var filterAlwaysTrue = (_v, _k, _seq) => true;
5547
5545
  var nullLoopWith = (seq) => ({ iterData: { seq } });
5548
- var X_OP_CONSUMED = {
5549
- slot: new Set,
5550
- text: new Set,
5551
- render: new Set(["as"]),
5552
- "render-it": new Set(["as"]),
5553
- "render-each": new Set(["as", "when", "loop-with"]),
5554
- show: new Set,
5555
- hide: new Set
5556
- };
5557
- var X_OP_WRAPPABLE = new Set(["text", "render", "render-it", "render-each"]);
5558
- var X_ATTR_WRAPPERS = { show: ShowNode, hide: HideNode };
5546
+ function xOp(consumed = [], { wrappable = false, wrapper = null } = {}) {
5547
+ return { consumed: new Set(consumed), wrappable, wrapper };
5548
+ }
5549
+ var X_OPS = {
5550
+ slot: xOp(),
5551
+ text: xOp([], { wrappable: true }),
5552
+ render: xOp(["as"], { wrappable: true }),
5553
+ "render-it": xOp(["as"], { wrappable: true }),
5554
+ "render-each": xOp(["as", "when", "loop-with"], { wrappable: true }),
5555
+ show: xOp([], { wrapper: ShowNode }),
5556
+ hide: xOp([], { wrapper: HideNode })
5557
+ };
5559
5558
  var WRAPPER_NODES = {
5560
5559
  slot: SlotNode,
5561
5560
  show: ShowNode,
@@ -5643,29 +5642,30 @@ var isBlockDomNode = (n) => {
5643
5642
  const node = n instanceof FragmentNode ? n.childs[0] : n;
5644
5643
  return node instanceof DomNode && HTML_BLOCK_TAGS.has(node.tagName);
5645
5644
  };
5645
+ var isEmptyText = (c) => c instanceof TextNode && c.val === "";
5646
+ function trimEdgeWhite(node) {
5647
+ if (!node.isWhiteSpace?.())
5648
+ return false;
5649
+ node.condenseWhiteSpace();
5650
+ return true;
5651
+ }
5646
5652
  function condenseChildsWhites(childs) {
5647
5653
  if (childs.length === 0)
5648
5654
  return childs;
5649
- let changed = false;
5650
- if (childs[0].isWhiteSpace?.()) {
5651
- childs[0].condenseWhiteSpace();
5652
- changed = true;
5653
- }
5654
5655
  const last = childs.length - 1;
5655
- if (last > 0 && childs[last].isWhiteSpace?.()) {
5656
- childs[last].condenseWhiteSpace();
5657
- changed = true;
5658
- }
5656
+ let emptied = trimEdgeWhite(childs[0]);
5657
+ if (last > 0 && trimEdgeWhite(childs[last]))
5658
+ emptied = true;
5659
5659
  for (let i = 1;i < last; i++) {
5660
5660
  const cur = childs[i];
5661
- if (cur.isWhiteSpace?.() && cur.hasNewLine()) {
5662
- const bothBlock = isBlockDomNode(childs[i - 1]) && isBlockDomNode(childs[i + 1]);
5663
- cur.condenseWhiteSpace(bothBlock ? "" : " ");
5664
- if (bothBlock)
5665
- changed = true;
5666
- }
5661
+ if (!(cur.isWhiteSpace?.() && cur.hasNewLine()))
5662
+ continue;
5663
+ const bothBlock = isBlockDomNode(childs[i - 1]) && isBlockDomNode(childs[i + 1]);
5664
+ cur.condenseWhiteSpace(bothBlock ? "" : " ");
5665
+ if (bothBlock)
5666
+ emptied = true;
5667
5667
  }
5668
- return changed ? childs.filter((c) => !(c instanceof TextNode && c.val === "")) : childs;
5668
+ return emptied ? childs.filter((c) => !isEmptyText(c)) : childs;
5669
5669
  }
5670
5670
 
5671
5671
  class View {
@@ -9470,16 +9470,16 @@ function parseXOpVal(opName, value, px, parserFn) {
9470
9470
  return val;
9471
9471
  }
9472
9472
  function processXExtras(node, attrs, opName, startIdx, px) {
9473
- const consumed = X_OP_CONSUMED[opName];
9474
- const wrappable = X_OP_WRAPPABLE.has(opName);
9473
+ const { consumed, wrappable } = X_OPS[opName];
9475
9474
  const wrappers = [];
9476
9475
  for (let i = startIdx;i < attrs.length; i++) {
9477
9476
  const a = attrs[i];
9478
9477
  const aName = a.name;
9479
9478
  if (consumed.has(aName))
9480
9479
  continue;
9481
- if (wrappable && X_ATTR_WRAPPERS[aName]) {
9482
- wrappers.push([X_ATTR_WRAPPERS[aName], vp.parseBool(a.value, px)]);
9480
+ const wrapper = wrappable ? X_OPS[aName]?.wrapper : null;
9481
+ if (wrapper) {
9482
+ wrappers.push([wrapper, vp.parseBool(a.value, px)]);
9483
9483
  continue;
9484
9484
  }
9485
9485
  const issueInfo = { op: opName, name: aName, value: a.value };
@@ -9571,6 +9571,12 @@ class RenderViewId extends ANode {
9571
9571
  }
9572
9572
  setDataAttr(_key, _val) {}
9573
9573
  }
9574
+ function dynRenderStep(comp, name, key) {
9575
+ const p = resolveDynProducer(comp, name);
9576
+ if (!p)
9577
+ return null;
9578
+ return key === undefined ? new DynStep(p.producerCompId, p.producerSteps) : new DynEachStep(p.producerCompId, p.producerSteps, key);
9579
+ }
9574
9580
 
9575
9581
  class RenderNode extends RenderViewId {
9576
9582
  render(stack, rx) {
@@ -9578,10 +9584,8 @@ class RenderNode extends RenderViewId {
9578
9584
  return rx.renderIt(newStack, this, "", this.viewId);
9579
9585
  }
9580
9586
  toPathStep(ctx) {
9581
- if (this.val instanceof DynVal) {
9582
- const p = resolveDynProducer(ctx.comp, this.val.name);
9583
- return p ? new DynStep(p.producerCompId, p.producerSteps) : null;
9584
- }
9587
+ if (this.val instanceof DynVal)
9588
+ return dynRenderStep(ctx.comp, this.val.name);
9585
9589
  return super.toPathStep(ctx);
9586
9590
  }
9587
9591
  }
@@ -9597,10 +9601,8 @@ class RenderItNode extends RenderViewId {
9597
9601
  return null;
9598
9602
  const nextNode = next.resolveNode();
9599
9603
  if (nextNode instanceof EachNode && next.hasKey) {
9600
- if (nextNode.val instanceof DynVal) {
9601
- const p = resolveDynProducer(ctx.comp, nextNode.val.name);
9602
- return p ? new DynEachStep(p.producerCompId, p.producerSteps, next.key) : null;
9603
- }
9604
+ if (nextNode.val instanceof DynVal)
9605
+ return dynRenderStep(ctx.comp, nextNode.val.name, next.key);
9604
9606
  return new EachRenderItStep(nextNode.val.name, next.key);
9605
9607
  }
9606
9608
  return null;
@@ -9616,12 +9618,8 @@ class RenderEachNode extends RenderViewId {
9616
9618
  return rx.renderEach(stack, this.iterInfo, this, this.viewId);
9617
9619
  }
9618
9620
  toPathStep(ctx) {
9619
- if (this.val instanceof DynVal) {
9620
- if (!ctx.hasKey)
9621
- return null;
9622
- const p = resolveDynProducer(ctx.comp, this.val.name);
9623
- return p ? new DynEachStep(p.producerCompId, p.producerSteps, ctx.key) : null;
9624
- }
9621
+ if (this.val instanceof DynVal)
9622
+ return ctx.hasKey ? dynRenderStep(ctx.comp, this.val.name, ctx.key) : null;
9625
9623
  return super.toPathStep(ctx);
9626
9624
  }
9627
9625
  static parse(px, vp2, s, as, attrs) {
@@ -9751,17 +9749,18 @@ class IterInfo {
9751
9749
  }
9752
9750
  var filterAlwaysTrue = (_v, _k, _seq) => true;
9753
9751
  var nullLoopWith = (seq) => ({ iterData: { seq } });
9754
- var X_OP_CONSUMED = {
9755
- slot: new Set,
9756
- text: new Set,
9757
- render: new Set(["as"]),
9758
- "render-it": new Set(["as"]),
9759
- "render-each": new Set(["as", "when", "loop-with"]),
9760
- show: new Set,
9761
- hide: new Set
9762
- };
9763
- var X_OP_WRAPPABLE = new Set(["text", "render", "render-it", "render-each"]);
9764
- var X_ATTR_WRAPPERS = { show: ShowNode, hide: HideNode };
9752
+ function xOp(consumed = [], { wrappable = false, wrapper = null } = {}) {
9753
+ return { consumed: new Set(consumed), wrappable, wrapper };
9754
+ }
9755
+ var X_OPS = {
9756
+ slot: xOp(),
9757
+ text: xOp([], { wrappable: true }),
9758
+ render: xOp(["as"], { wrappable: true }),
9759
+ "render-it": xOp(["as"], { wrappable: true }),
9760
+ "render-each": xOp(["as", "when", "loop-with"], { wrappable: true }),
9761
+ show: xOp([], { wrapper: ShowNode }),
9762
+ hide: xOp([], { wrapper: HideNode })
9763
+ };
9765
9764
  var WRAPPER_NODES = {
9766
9765
  slot: SlotNode,
9767
9766
  show: ShowNode,
@@ -9849,29 +9848,30 @@ var isBlockDomNode = (n) => {
9849
9848
  const node = n instanceof FragmentNode ? n.childs[0] : n;
9850
9849
  return node instanceof DomNode && HTML_BLOCK_TAGS.has(node.tagName);
9851
9850
  };
9851
+ var isEmptyText = (c) => c instanceof TextNode && c.val === "";
9852
+ function trimEdgeWhite(node) {
9853
+ if (!node.isWhiteSpace?.())
9854
+ return false;
9855
+ node.condenseWhiteSpace();
9856
+ return true;
9857
+ }
9852
9858
  function condenseChildsWhites(childs) {
9853
9859
  if (childs.length === 0)
9854
9860
  return childs;
9855
- let changed = false;
9856
- if (childs[0].isWhiteSpace?.()) {
9857
- childs[0].condenseWhiteSpace();
9858
- changed = true;
9859
- }
9860
9861
  const last = childs.length - 1;
9861
- if (last > 0 && childs[last].isWhiteSpace?.()) {
9862
- childs[last].condenseWhiteSpace();
9863
- changed = true;
9864
- }
9862
+ let emptied = trimEdgeWhite(childs[0]);
9863
+ if (last > 0 && trimEdgeWhite(childs[last]))
9864
+ emptied = true;
9865
9865
  for (let i = 1;i < last; i++) {
9866
9866
  const cur = childs[i];
9867
- if (cur.isWhiteSpace?.() && cur.hasNewLine()) {
9868
- const bothBlock = isBlockDomNode(childs[i - 1]) && isBlockDomNode(childs[i + 1]);
9869
- cur.condenseWhiteSpace(bothBlock ? "" : " ");
9870
- if (bothBlock)
9871
- changed = true;
9872
- }
9867
+ if (!(cur.isWhiteSpace?.() && cur.hasNewLine()))
9868
+ continue;
9869
+ const bothBlock = isBlockDomNode(childs[i - 1]) && isBlockDomNode(childs[i + 1]);
9870
+ cur.condenseWhiteSpace(bothBlock ? "" : " ");
9871
+ if (bothBlock)
9872
+ emptied = true;
9873
9873
  }
9874
- return changed ? childs.filter((c) => !(c instanceof TextNode && c.val === "")) : childs;
9874
+ return emptied ? childs.filter((c) => !isEmptyText(c)) : childs;
9875
9875
  }
9876
9876
 
9877
9877
  class View {