ripple 0.2.106 → 0.2.108

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.
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Ripple is an elegant TypeScript UI framework",
4
4
  "license": "MIT",
5
5
  "author": "Dominic Gannaway",
6
- "version": "0.2.106",
6
+ "version": "0.2.108",
7
7
  "type": "module",
8
8
  "module": "src/runtime/index-client.js",
9
9
  "main": "src/runtime/index-client.js",
@@ -147,7 +147,7 @@ function RipplePlugin(config) {
147
147
 
148
148
  if (code === 35) {
149
149
  // # character
150
- // Look ahead to see if this is followed by [ for tuple syntax
150
+ // Look ahead to see if this is followed by [ for tuple syntax or 'server' keyword
151
151
  if (this.pos + 1 < this.input.length) {
152
152
  const nextChar = this.input.charCodeAt(this.pos + 1);
153
153
  if (nextChar === 91 || nextChar === 123) {
@@ -162,9 +162,27 @@ function RipplePlugin(config) {
162
162
  return this.finishToken(tt.bracketL, '#[');
163
163
  }
164
164
  }
165
+
166
+ // Check if this is #server
167
+ if (this.input.slice(this.pos, this.pos + 7) === '#server') {
168
+ // Check that next char after 'server' is whitespace or {
169
+ const charAfter =
170
+ this.pos + 7 < this.input.length ? this.input.charCodeAt(this.pos + 7) : -1;
171
+ if (
172
+ charAfter === 123 ||
173
+ charAfter === 32 ||
174
+ charAfter === 9 ||
175
+ charAfter === 10 ||
176
+ charAfter === 13 ||
177
+ charAfter === -1
178
+ ) {
179
+ // { or whitespace or EOF
180
+ this.pos += 7; // consume '#server'
181
+ return this.finishToken(tt.name, '#server');
182
+ }
183
+ }
165
184
  }
166
185
  }
167
-
168
186
  if (code === 64) {
169
187
  // @ character
170
188
  // Look ahead to see if this is followed by a valid identifier character or opening paren
@@ -398,6 +416,14 @@ function RipplePlugin(config) {
398
416
  return super.checkLValSimple(expr, bindingType, checkClashes);
399
417
  }
400
418
 
419
+ parseServerBlock() {
420
+ const node = this.startNode();
421
+ this.next();
422
+ node.body = this.parseBlock();
423
+ this.awaitPos = 0;
424
+ return this.finishNode(node, 'ServerBlock');
425
+ }
426
+
401
427
  parseTrackedArrayExpression() {
402
428
  const node = this.startNode();
403
429
  this.next(); // consume the '#['
@@ -1250,6 +1276,10 @@ function RipplePlugin(config) {
1250
1276
  return node;
1251
1277
  }
1252
1278
 
1279
+ if (this.value === '#server') {
1280
+ return this.parseServerBlock();
1281
+ }
1282
+
1253
1283
  if (this.value === 'component') {
1254
1284
  const node = this.startNode();
1255
1285
  node.type = 'Component';
@@ -1326,7 +1356,7 @@ function RipplePlugin(config) {
1326
1356
  this.unexpected();
1327
1357
  }
1328
1358
  const node = this.parseElement();
1329
-
1359
+
1330
1360
  if (!node) {
1331
1361
  this.unexpected();
1332
1362
  }
@@ -3,6 +3,7 @@ import { walk } from 'zimmerframe';
3
3
  import { create_scopes, ScopeRoot } from '../../scope.js';
4
4
  import {
5
5
  get_delegated_event,
6
+ get_parent_block_node,
6
7
  is_element_dom_element,
7
8
  is_inside_component,
8
9
  is_ripple_track_call,
@@ -299,7 +300,10 @@ const visitors = {
299
300
  // Validate that each cases ends in a break statement, except for the last case
300
301
  const last = switch_case.consequent?.[switch_case.consequent.length - 1];
301
302
 
302
- if (last.type !== 'BreakStatement' && node.cases.indexOf(switch_case) !== node.cases.length - 1) {
303
+ if (
304
+ last.type !== 'BreakStatement' &&
305
+ node.cases.indexOf(switch_case) !== node.cases.length - 1
306
+ ) {
303
307
  error(
304
308
  'Template switch cases must end with a break statement (with the exception of the last case).',
305
309
  context.state.analysis.module.filename,
@@ -634,6 +638,15 @@ const visitors = {
634
638
  context.state.metadata.await = true;
635
639
  }
636
640
  }
641
+ const parent_block = get_parent_block_node(context);
642
+
643
+ if (parent_block !== null && parent_block.type !== 'Component') {
644
+ error(
645
+ '`await` expressions can only currently be used at the top-level of a component body. Support for using them in control flow statements will be added in the future.',
646
+ context.state.analysis.module.filename,
647
+ node,
648
+ );
649
+ }
637
650
 
638
651
  context.next();
639
652
  },
@@ -159,11 +159,12 @@ const visitors = {
159
159
  }
160
160
  } else {
161
161
  const binding = context.state.scope.get(node.name);
162
- const isRightSideOfAssignment = parent.type === 'AssignmentExpression' && parent.right === node;
162
+ const is_right_side_of_assignment =
163
+ parent.type === 'AssignmentExpression' && parent.right === node;
163
164
  if (
164
165
  (context.state.metadata?.tracking === false ||
165
166
  (parent.type !== 'AssignmentExpression' && parent.type !== 'UpdateExpression') ||
166
- isRightSideOfAssignment) &&
167
+ is_right_side_of_assignment) &&
167
168
  (node.tracked ||
168
169
  binding?.kind === 'prop' ||
169
170
  binding?.kind === 'index' ||
@@ -469,9 +470,10 @@ const visitors = {
469
470
 
470
471
  const handle_static_attr = (name, value) => {
471
472
  const attr_value = b.literal(
472
- ` ${name}${is_boolean_attribute(name) && value === true
473
- ? ''
474
- : `="${value === true ? '' : escape_html(value, true)}"`
473
+ ` ${name}${
474
+ is_boolean_attribute(name) && value === true
475
+ ? ''
476
+ : `="${value === true ? '' : escape_html(value, true)}"`
475
477
  }`,
476
478
  );
477
479
 
@@ -943,10 +945,10 @@ const visitors = {
943
945
  operator === '='
944
946
  ? context.visit(right)
945
947
  : b.binary(
946
- operator === '+=' ? '+' : operator === '-=' ? '-' : operator === '*=' ? '*' : '/',
947
- /** @type {Pattern} */(context.visit(left)),
948
- /** @type {Expression} */(context.visit(right)),
949
- ),
948
+ operator === '+=' ? '+' : operator === '-=' ? '-' : operator === '*=' ? '*' : '/',
949
+ /** @type {Expression} */ (context.visit(left)),
950
+ /** @type {Expression} */ (context.visit(right)),
951
+ ),
950
952
  b.id('__block'),
951
953
  );
952
954
  }
@@ -962,12 +964,12 @@ const visitors = {
962
964
  operator === '='
963
965
  ? context.visit(right)
964
966
  : b.binary(
965
- operator === '+=' ? '+' : operator === '-=' ? '-' : operator === '*=' ? '*' : '/',
966
- /** @type {Pattern} */(
967
- context.visit(left, { ...context.state, metadata: { tracking: false } })
967
+ operator === '+=' ? '+' : operator === '-=' ? '-' : operator === '*=' ? '*' : '/',
968
+ /** @type {Expression} */ (
969
+ context.visit(left, { ...context.state, metadata: { tracking: false } })
970
+ ),
971
+ /** @type {Expression} */ (context.visit(right)),
968
972
  ),
969
- /** @type {Expression} */(context.visit(right)),
970
- ),
971
973
  b.id('__block'),
972
974
  );
973
975
  }
@@ -1090,7 +1092,9 @@ const visitors = {
1090
1092
  for (const switch_case of node.cases) {
1091
1093
  const consequent_scope =
1092
1094
  context.state.scopes.get(switch_case.consequent) || context.state.scope;
1093
- const consequent_id = context.state.scope.generate('switch_case_' + (switch_case.test == null ? 'default' : i));
1095
+ const consequent_id = context.state.scope.generate(
1096
+ 'switch_case_' + (switch_case.test == null ? 'default' : i),
1097
+ );
1094
1098
  const consequent = b.block(
1095
1099
  transform_body(switch_case.consequent, {
1096
1100
  ...context,
@@ -1172,12 +1176,12 @@ const visitors = {
1172
1176
  b.stmt(b.call(b.id('__render'), b.id(consequent_id))),
1173
1177
  alternate_id
1174
1178
  ? b.stmt(
1175
- b.call(
1176
- b.id('__render'),
1177
- b.id(alternate_id),
1178
- node.alternate ? b.literal(false) : undefined,
1179
- ),
1180
- )
1179
+ b.call(
1180
+ b.id('__render'),
1181
+ b.id(alternate_id),
1182
+ node.alternate ? b.literal(false) : undefined,
1183
+ ),
1184
+ )
1181
1185
  : undefined,
1182
1186
  ),
1183
1187
  ]),
@@ -1230,9 +1234,9 @@ const visitors = {
1230
1234
  node.handler === null
1231
1235
  ? b.literal(null)
1232
1236
  : b.arrow(
1233
- [b.id('__anchor'), ...(node.handler.param ? [node.handler.param] : [])],
1234
- b.block(transform_body(node.handler.body.body, context)),
1235
- ),
1237
+ [b.id('__anchor'), ...(node.handler.param ? [node.handler.param] : [])],
1238
+ b.block(transform_body(node.handler.body.body, context)),
1239
+ ),
1236
1240
  node.pending === null
1237
1241
  ? undefined
1238
1242
  : b.arrow([b.id('__anchor')], b.block(transform_body(node.pending.body, context))),
@@ -1278,6 +1282,10 @@ const visitors = {
1278
1282
  return b.block(statements);
1279
1283
  },
1280
1284
 
1285
+ ServerBlock() {
1286
+ return b.empty;
1287
+ },
1288
+
1281
1289
  Program(node, context) {
1282
1290
  const statements = [];
1283
1291
 
@@ -1309,7 +1317,7 @@ function join_template(items) {
1309
1317
  push(e);
1310
1318
  }
1311
1319
 
1312
- const last = /** @type {TemplateElement} */ (expression.quasis.at(-1));
1320
+ const last = /** @type {any} */ (expression.quasis.at(-1));
1313
1321
  quasi.value.cooked += /** @type {string} */ (last.value.cooked);
1314
1322
  } else if (expression.type === 'Literal') {
1315
1323
  /** @type {string} */ (quasi.value.cooked) += expression.value;
@@ -1328,7 +1336,7 @@ function join_template(items) {
1328
1336
  }
1329
1337
 
1330
1338
  for (const quasi of template.quasis) {
1331
- quasi.value.raw = sanitize_template_string(/** @type {string} */(quasi.value.cooked));
1339
+ quasi.value.raw = sanitize_template_string(/** @type {string} */ (quasi.value.cooked));
1332
1340
  }
1333
1341
 
1334
1342
  quasi.tail = true;
@@ -1458,6 +1466,23 @@ function transform_ts_child(node, context) {
1458
1466
  }
1459
1467
 
1460
1468
  state.init.push(b.if(visit(node.test), consequent, alternate));
1469
+ } else if (node.type === 'SwitchStatement') {
1470
+ const cases = [];
1471
+
1472
+ for (const switch_case of node.cases) {
1473
+ const consequent_scope =
1474
+ context.state.scopes.get(switch_case.consequent) || context.state.scope;
1475
+ const consequent_body = transform_body(switch_case.consequent, {
1476
+ ...context,
1477
+ state: { ...context.state, scope: consequent_scope },
1478
+ });
1479
+
1480
+ cases.push(
1481
+ b.switch_case(switch_case.test ? context.visit(switch_case.test) : null, consequent_body),
1482
+ );
1483
+ }
1484
+
1485
+ context.state.init.push(b.switch(context.visit(node.discriminant), cases));
1461
1486
  } else if (node.type === 'ForOfStatement') {
1462
1487
  const body_scope = context.state.scopes.get(node.body);
1463
1488
  const block_body = transform_body(node.body.body, {
@@ -1510,6 +1535,8 @@ function transform_ts_child(node, context) {
1510
1535
  const component = visit(node, state);
1511
1536
 
1512
1537
  state.init.push(component);
1538
+ } else if (node.type === 'BreakStatement') {
1539
+ state.init.push(b.break);
1513
1540
  } else {
1514
1541
  debugger;
1515
1542
  throw new Error('TODO');
@@ -1684,6 +1711,8 @@ function transform_children(children, context) {
1684
1711
  } else if (node.type === 'SwitchStatement') {
1685
1712
  node.is_controlled = is_controlled;
1686
1713
  visit(node, { ...state, flush_node, namespace: state.namespace });
1714
+ } else if (node.type === 'BreakStatement') {
1715
+ // do nothing
1687
1716
  } else {
1688
1717
  debugger;
1689
1718
  }
@@ -1766,7 +1795,7 @@ export function transform_client(filename, source, analysis, to_ts) {
1766
1795
  };
1767
1796
 
1768
1797
  const program = /** @type {Program} */ (
1769
- walk(analysis.ast, { ...state, namespace: 'html' }, visitors)
1798
+ walk(/** @type {Node} */ (analysis.ast), { ...state, namespace: 'html' }, visitors)
1770
1799
  );
1771
1800
 
1772
1801
  for (const hoisted of state.hoisted) {
@@ -96,12 +96,7 @@ const visitors = {
96
96
  context.state.stylesheets.push(node.css);
97
97
  // Register CSS hash during rendering
98
98
  body_statements.unshift(
99
- b.stmt(
100
- b.call(
101
- b.member(b.id('__output'), b.id('register_css')),
102
- b.literal(node.css.hash),
103
- ),
104
- ),
99
+ b.stmt(b.call(b.member(b.id('__output'), b.id('register_css')), b.literal(node.css.hash))),
105
100
  );
106
101
  }
107
102
 
@@ -195,10 +190,11 @@ const visitors = {
195
190
  let class_attribute = null;
196
191
 
197
192
  const handle_static_attr = (name, value) => {
198
- const attr_str = ` ${name}${is_boolean_attribute(name) && value === true
199
- ? ''
200
- : `="${value === true ? '' : escape_html(value, true)}"`
201
- }`;
193
+ const attr_str = ` ${name}${
194
+ is_boolean_attribute(name) && value === true
195
+ ? ''
196
+ : `="${value === true ? '' : escape_html(value, true)}"`
197
+ }`;
202
198
 
203
199
  if (is_spreading) {
204
200
  // For spread attributes, store just the actual value, not the full attribute string
@@ -387,12 +383,13 @@ const visitors = {
387
383
  const conditional_await = b.conditional(
388
384
  b.member(visit(node.id, state), b.id('async')),
389
385
  b.await(component_call),
390
- component_call
386
+ component_call,
391
387
  );
392
388
  state.init.push(b.stmt(conditional_await));
393
389
  }
394
390
  }
395
- }, ForOfStatement(node, context) {
391
+ },
392
+ ForOfStatement(node, context) {
396
393
  if (!is_inside_component(context)) {
397
394
  context.next();
398
395
  return;
@@ -483,22 +480,26 @@ const visitors = {
483
480
 
484
481
  // For SSR with pending block: render the resolved content wrapped in async
485
482
  // In a streaming SSR implementation, we'd render pending first, then stream resolved
486
- const try_statements = node.handler !== null
487
- ? [
488
- b.try(
489
- b.block(body),
490
- b.catch_clause(
491
- node.handler.param || b.id('error'),
492
- b.block(
493
- transform_body(node.handler.body.body, {
494
- ...context,
495
- state: { ...context.state, scope: context.state.scopes.get(node.handler.body) },
496
- }),
483
+ const try_statements =
484
+ node.handler !== null
485
+ ? [
486
+ b.try(
487
+ b.block(body),
488
+ b.catch_clause(
489
+ node.handler.param || b.id('error'),
490
+ b.block(
491
+ transform_body(node.handler.body.body, {
492
+ ...context,
493
+ state: {
494
+ ...context.state,
495
+ scope: context.state.scopes.get(node.handler.body),
496
+ },
497
+ }),
498
+ ),
499
+ ),
497
500
  ),
498
- ),
499
- ),
500
- ]
501
- : body;
501
+ ]
502
+ : body;
502
503
 
503
504
  context.state.init.push(
504
505
  b.stmt(b.await(b.call('_$_.async', b.thunk(b.block(try_statements), true)))),
@@ -514,10 +515,7 @@ const visitors = {
514
515
  context.state.init.push(
515
516
  b.try(
516
517
  b.block(body),
517
- b.catch_clause(
518
- node.handler.param || b.id('error'),
519
- b.block(handler_body),
520
- ),
518
+ b.catch_clause(node.handler.param || b.id('error'), b.block(handler_body)),
521
519
  ),
522
520
  );
523
521
  } else {
@@ -599,6 +597,10 @@ const visitors = {
599
597
  state.init.push(b.stmt(b.call(b.member(b.id('__output'), b.id('push')), expression)));
600
598
  }
601
599
  },
600
+
601
+ ServerBlock(node, context) {
602
+ return context.visit(node.body);
603
+ },
602
604
  };
603
605
 
604
606
  export function transform_server(filename, source, analysis) {
@@ -637,9 +639,7 @@ export function transform_server(filename, source, analysis) {
637
639
  for (const metadata of state.component_metadata) {
638
640
  if (metadata.async) {
639
641
  program.body.push(
640
- b.stmt(
641
- b.assignment('=', b.member(b.id(metadata.id), b.id('async')), b.true),
642
- ),
642
+ b.stmt(b.assignment('=', b.member(b.id(metadata.id), b.id('async')), b.true)),
643
643
  );
644
644
  }
645
645
  }
@@ -284,9 +284,9 @@ export interface TransformContext {
284
284
  /** Compiler state */
285
285
  state: CompilerState;
286
286
  /** AST path */
287
- path?: RippleNode[];
287
+ path: RippleNode[];
288
288
  /** Visit function */
289
- visit?: (node: any, state?: any) => any;
289
+ visit: (node: any, state?: any) => any;
290
290
  /** Transform metadata */
291
291
  metadata?: any;
292
292
  }
@@ -808,7 +808,7 @@ export function normalize_children(children, context) {
808
808
  * @param {TransformContext} context
809
809
  */
810
810
  function normalize_child(node, normalized, context) {
811
- if (node.type === 'EmptyStatement' || node.type === 'BreakStatement') {
811
+ if (node.type === 'EmptyStatement') {
812
812
  return;
813
813
  } else if (
814
814
  node.type === 'Element' &&
@@ -823,6 +823,34 @@ function normalize_child(node, normalized, context) {
823
823
  }
824
824
  }
825
825
 
826
+ /**
827
+ * @param {TransformContext} context
828
+ */
829
+ export function get_parent_block_node(context) {
830
+ const path = context.path;
831
+
832
+ for (let i = path.length - 1; i >= 0; i -= 1) {
833
+ const context_node = path[i];
834
+ if (
835
+ context_node.type === 'IfStatement' ||
836
+ context_node.type === 'ForOfStatement' ||
837
+ context_node.type === 'SwitchStatement' ||
838
+ context_node.type === 'TryStatement' ||
839
+ context_node.type === 'Component'
840
+ ) {
841
+ return context_node;
842
+ }
843
+ if (
844
+ context_node.type === 'FunctionExpression' ||
845
+ context_node.type === 'ArrowFunctionExpression' ||
846
+ context_node.type === 'FunctionDeclaration'
847
+ ) {
848
+ return null;
849
+ }
850
+ }
851
+ return null;
852
+ }
853
+
826
854
  /**
827
855
  * Builds a getter for a tracked identifier
828
856
  * @param {Identifier} node
@@ -323,13 +323,13 @@ export function is_destroyed(target_block) {
323
323
  * @param {Node} end
324
324
  */
325
325
  export function remove_block_dom(node, end) {
326
- while (node !== null) {
327
- /** @type {Node | null} */
328
- var next = node === end ? null : next_sibling(node);
326
+ while (node !== null) {
327
+ /** @type {Node | null} */
328
+ var next = node === end ? null : next_sibling(node);
329
329
 
330
- /** @type {Element | Text | Comment} */ (node).remove();
331
- node = next;
332
- }
330
+ /** @type {Element | Text | Comment} */ (node).remove();
331
+ node = next;
332
+ }
333
333
  }
334
334
 
335
335
  /**
@@ -344,7 +344,7 @@ export function destroy_block(block, remove_dom = true) {
344
344
 
345
345
  if ((remove_dom && (f & (BRANCH_BLOCK | ROOT_BLOCK)) !== 0) || (f & HEAD_BLOCK) !== 0) {
346
346
  var s = block.s;
347
- remove_block_dom(s.start, s.end);
347
+ remove_block_dom(s.start, s.end);
348
348
  removed = true;
349
349
  }
350
350
 
@@ -18,10 +18,10 @@ export function composite(get_component, node, props) {
18
18
  render(() => {
19
19
  var component = get_component();
20
20
 
21
- if (b !== null) {
22
- destroy_block(b);
23
- b = null;
24
- }
21
+ if (b !== null) {
22
+ destroy_block(b);
23
+ b = null;
24
+ }
25
25
 
26
26
  b = branch(() => {
27
27
  var block = active_block;
@@ -6,55 +6,55 @@ import { active_component } from './runtime.js';
6
6
  * @template T
7
7
  */
8
8
  export class Context {
9
- /**
10
- * @param {T} initial_value
11
- */
12
- constructor(initial_value) {
13
- /** @type {T} */
14
- this._v = initial_value;
15
- }
16
-
17
- get() {
18
- const component = active_component;
19
- const context = this;
20
-
21
- if (component === null) {
22
- throw new Error('No active component found, cannot get context');
23
- }
24
- /** @type {Component | null} */
25
- let current_component = component;
26
-
27
- while (current_component !== null) {
28
- const context_map = current_component.c;
29
-
30
- if (context_map?.has(context)) {
31
- return context_map.get(context);
32
- }
33
-
34
- current_component = current_component.p;
35
- }
36
-
37
- return context._v;
38
- }
39
-
40
- /**
41
- * @template T
42
- * @param {T} value
43
- */
44
- set(value) {
45
- const component = active_component;
46
- const context = this;
47
-
48
- if (component === null) {
49
- throw new Error('No active component found, cannot set context');
50
- }
51
-
52
- let current_context = component.c;
53
-
54
- if (current_context === null) {
55
- current_context = component.c = new Map();
56
- }
57
-
58
- current_context.set(context, value);
59
- }
9
+ /**
10
+ * @param {T} initial_value
11
+ */
12
+ constructor(initial_value) {
13
+ /** @type {T} */
14
+ this._v = initial_value;
15
+ }
16
+
17
+ get() {
18
+ const component = active_component;
19
+ const context = this;
20
+
21
+ if (component === null) {
22
+ throw new Error('No active component found, cannot get context');
23
+ }
24
+ /** @type {Component | null} */
25
+ let current_component = component;
26
+
27
+ while (current_component !== null) {
28
+ const context_map = current_component.c;
29
+
30
+ if (context_map?.has(context)) {
31
+ return context_map.get(context);
32
+ }
33
+
34
+ current_component = current_component.p;
35
+ }
36
+
37
+ return context._v;
38
+ }
39
+
40
+ /**
41
+ * @template T
42
+ * @param {T} value
43
+ */
44
+ set(value) {
45
+ const component = active_component;
46
+ const context = this;
47
+
48
+ if (component === null) {
49
+ throw new Error('No active component found, cannot set context');
50
+ }
51
+
52
+ let current_context = component.c;
53
+
54
+ if (current_context === null) {
55
+ current_context = component.c = new Map();
56
+ }
57
+
58
+ current_context.set(context, value);
59
+ }
60
60
  }
@@ -1,7 +1,7 @@
1
1
  import { DEV } from 'esm-env';
2
2
 
3
3
  export function remove_ssr_css() {
4
- if (!document || typeof requestAnimationFrame !== "function") {
4
+ if (!document || typeof requestAnimationFrame !== 'function') {
5
5
  return;
6
6
  }
7
7
 
@@ -22,7 +22,7 @@ function remove_styles() {
22
22
  }
23
23
 
24
24
  function remove() {
25
- document.querySelectorAll("style[data-ripple-ssr]").forEach((el) => el.remove());
25
+ document.querySelectorAll('style[data-ripple-ssr]').forEach((el) => el.remove());
26
26
  }
27
27
 
28
28
  /**
@@ -26,7 +26,7 @@ export function html(node, get_html, svg = false, mathml = false) {
26
26
  else if (mathml) html = `<math>${html}</math>`;
27
27
 
28
28
  if (block.s !== null && block.s.start !== null) {
29
- remove_block_dom(block.s.start, /** @type {Node} */(block.s.end));
29
+ remove_block_dom(block.s.start, /** @type {Node} */ (block.s.end));
30
30
  block.s.start = block.s.end = null;
31
31
  }
32
32
 
@@ -35,14 +35,17 @@ export function html(node, get_html, svg = false, mathml = false) {
35
35
  var node = create_fragment_from_html(html);
36
36
 
37
37
  if (svg || mathml) {
38
- node = /** @type {Element} */(first_child(node));
38
+ node = /** @type {Element} */ (first_child(node));
39
39
  }
40
40
 
41
- assign_nodes(/** @type {Element} */(first_child(node)), /** @type {Element} */(node.lastChild));
41
+ assign_nodes(
42
+ /** @type {Element} */ (first_child(node)),
43
+ /** @type {Element} */ (node.lastChild),
44
+ );
42
45
 
43
46
  if (svg || mathml) {
44
47
  while (first_child(node)) {
45
- anchor.before(/** @type {Element} */(first_child(node)));
48
+ anchor.before(/** @type {Element} */ (first_child(node)));
46
49
  }
47
50
  } else {
48
51
  anchor.before(node);