ripple 0.3.71 → 0.3.74

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 (165) hide show
  1. package/CHANGELOG.md +75 -0
  2. package/package.json +3 -3
  3. package/src/jsx-runtime.d.ts +2 -8
  4. package/src/runtime/index-client.js +3 -13
  5. package/src/runtime/internal/client/blocks.js +3 -25
  6. package/src/runtime/internal/client/for.js +80 -5
  7. package/src/runtime/internal/client/index.js +0 -2
  8. package/src/runtime/internal/client/types.d.ts +0 -10
  9. package/tests/client/__snapshots__/computed-properties.test.tsrx.snap +8 -0
  10. package/tests/client/__snapshots__/for.test.tsrx.snap +22 -0
  11. package/tests/client/__snapshots__/html.test.tsrx.snap +4 -0
  12. package/tests/client/array/array.copy-within.test.tsrx +19 -19
  13. package/tests/client/array/array.derived.test.tsrx +97 -109
  14. package/tests/client/array/array.iteration.test.tsrx +28 -28
  15. package/tests/client/array/array.mutations.test.tsrx +68 -68
  16. package/tests/client/array/array.static.test.tsrx +82 -92
  17. package/tests/client/array/array.to-methods.test.tsrx +15 -15
  18. package/tests/client/async-suspend.test.tsrx +180 -179
  19. package/tests/client/basic/__snapshots__/basic.attributes.test.tsrx.snap +2 -0
  20. package/tests/client/basic/__snapshots__/basic.rendering.test.tsrx.snap +4 -0
  21. package/tests/client/basic/basic.attributes.test.tsrx +273 -317
  22. package/tests/client/basic/basic.collections.test.tsrx +59 -71
  23. package/tests/client/basic/basic.components.test.tsrx +196 -222
  24. package/tests/client/basic/basic.errors.test.tsrx +72 -78
  25. package/tests/client/basic/basic.events.test.tsrx +80 -85
  26. package/tests/client/basic/basic.get-set.test.tsrx +54 -64
  27. package/tests/client/basic/basic.hmr.test.tsrx +15 -19
  28. package/tests/client/basic/basic.reactivity.test.tsrx +121 -135
  29. package/tests/client/basic/basic.rendering.test.tsrx +273 -178
  30. package/tests/client/basic/basic.utilities.test.tsrx +8 -10
  31. package/tests/client/boundaries.test.tsrx +18 -18
  32. package/tests/client/compiler/compiler.assignments.test.tsrx +77 -76
  33. package/tests/client/compiler/compiler.attributes.test.tsrx +18 -14
  34. package/tests/client/compiler/compiler.basic.test.tsrx +364 -296
  35. package/tests/client/compiler/compiler.regex.test.tsrx +40 -44
  36. package/tests/client/compiler/compiler.tracked-access.test.tsrx +57 -38
  37. package/tests/client/compiler/compiler.try-in-function.test.tsrx +16 -16
  38. package/tests/client/compiler/compiler.typescript.test.tsrx +4 -3
  39. package/tests/client/composite/composite.dynamic-components.test.tsrx +41 -44
  40. package/tests/client/composite/composite.generics.test.tsrx +165 -167
  41. package/tests/client/composite/composite.props.test.tsrx +66 -74
  42. package/tests/client/composite/composite.reactivity.test.tsrx +132 -166
  43. package/tests/client/composite/composite.render.test.tsrx +92 -101
  44. package/tests/client/computed-properties.test.tsrx +14 -18
  45. package/tests/client/context.test.tsrx +14 -18
  46. package/tests/client/css/global-additional-cases.test.tsrx +491 -437
  47. package/tests/client/css/global-advanced-selectors.test.tsrx +169 -153
  48. package/tests/client/css/global-at-rules.test.tsrx +71 -66
  49. package/tests/client/css/global-basic.test.tsrx +105 -98
  50. package/tests/client/css/global-classes-ids.test.tsrx +128 -114
  51. package/tests/client/css/global-combinators.test.tsrx +83 -78
  52. package/tests/client/css/global-complex-nesting.test.tsrx +134 -120
  53. package/tests/client/css/global-edge-cases.test.tsrx +138 -120
  54. package/tests/client/css/global-keyframes.test.tsrx +108 -96
  55. package/tests/client/css/global-nested.test.tsrx +88 -78
  56. package/tests/client/css/global-pseudo.test.tsrx +104 -98
  57. package/tests/client/css/global-scoping.test.tsrx +145 -125
  58. package/tests/client/css/style-identifier.test.tsrx +62 -69
  59. package/tests/client/date.test.tsrx +83 -83
  60. package/tests/client/dynamic-elements.test.tsrx +227 -283
  61. package/tests/client/events.test.tsrx +252 -266
  62. package/tests/client/for.test.tsrx +120 -127
  63. package/tests/client/head.test.tsrx +40 -48
  64. package/tests/client/html.test.tsrx +37 -49
  65. package/tests/client/input-value.test.tsrx +1125 -1354
  66. package/tests/client/lazy-array.test.tsrx +10 -16
  67. package/tests/client/lazy-destructuring.test.tsrx +169 -221
  68. package/tests/client/map.test.tsrx +39 -41
  69. package/tests/client/media-query.test.tsrx +15 -19
  70. package/tests/client/object.test.tsrx +46 -56
  71. package/tests/client/portal.test.tsrx +31 -37
  72. package/tests/client/ref.test.tsrx +173 -193
  73. package/tests/client/return.test.tsrx +62 -37
  74. package/tests/client/set.test.tsrx +33 -33
  75. package/tests/client/svg.test.tsrx +195 -215
  76. package/tests/client/switch.test.tsrx +201 -191
  77. package/tests/client/track-async-hydration.test.tsrx +14 -18
  78. package/tests/client/tracked-index-access.test.tsrx +18 -28
  79. package/tests/client/try.test.tsrx +494 -619
  80. package/tests/client/tsx.test.tsrx +290 -371
  81. package/tests/client/typescript-generics.test.tsrx +121 -129
  82. package/tests/client/url/url.derived.test.tsrx +21 -25
  83. package/tests/client/url/url.parsing.test.tsrx +35 -35
  84. package/tests/client/url/url.partial-removal.test.tsrx +32 -32
  85. package/tests/client/url/url.reactivity.test.tsrx +68 -72
  86. package/tests/client/url/url.serialization.test.tsrx +8 -8
  87. package/tests/client/url-search-params/url-search-params.derived.test.tsrx +21 -27
  88. package/tests/client/url-search-params/url-search-params.initialization.test.tsrx +16 -16
  89. package/tests/client/url-search-params/url-search-params.iteration.test.tsrx +37 -37
  90. package/tests/client/url-search-params/url-search-params.mutation.test.tsrx +56 -60
  91. package/tests/client/url-search-params/url-search-params.retrieval.test.tsrx +32 -34
  92. package/tests/client/url-search-params/url-search-params.serialization.test.tsrx +9 -9
  93. package/tests/client/url-search-params/url-search-params.tracked-url.test.tsrx +10 -10
  94. package/tests/hydration/compiled/client/basic.js +396 -325
  95. package/tests/hydration/compiled/client/composite.js +52 -44
  96. package/tests/hydration/compiled/client/for.js +734 -604
  97. package/tests/hydration/compiled/client/head.js +183 -103
  98. package/tests/hydration/compiled/client/html.js +93 -86
  99. package/tests/hydration/compiled/client/if-children.js +95 -71
  100. package/tests/hydration/compiled/client/if.js +113 -89
  101. package/tests/hydration/compiled/client/mixed-control-flow.js +225 -209
  102. package/tests/hydration/compiled/client/nested-control-flow.js +94 -98
  103. package/tests/hydration/compiled/client/reactivity.js +26 -24
  104. package/tests/hydration/compiled/client/return.js +8 -42
  105. package/tests/hydration/compiled/client/switch.js +208 -173
  106. package/tests/hydration/compiled/client/track-async-serialization.js +176 -128
  107. package/tests/hydration/compiled/client/try.js +29 -21
  108. package/tests/hydration/compiled/server/basic.js +210 -221
  109. package/tests/hydration/compiled/server/composite.js +13 -14
  110. package/tests/hydration/compiled/server/for.js +427 -444
  111. package/tests/hydration/compiled/server/head.js +199 -189
  112. package/tests/hydration/compiled/server/html.js +33 -41
  113. package/tests/hydration/compiled/server/if-children.js +114 -117
  114. package/tests/hydration/compiled/server/if.js +77 -83
  115. package/tests/hydration/compiled/server/mixed-control-flow.js +145 -150
  116. package/tests/hydration/compiled/server/nested-control-flow.js +10 -0
  117. package/tests/hydration/compiled/server/reactivity.js +24 -22
  118. package/tests/hydration/compiled/server/return.js +6 -18
  119. package/tests/hydration/compiled/server/switch.js +179 -176
  120. package/tests/hydration/compiled/server/track-async-serialization.js +88 -70
  121. package/tests/hydration/compiled/server/try.js +31 -35
  122. package/tests/hydration/components/basic.tsrx +216 -286
  123. package/tests/hydration/components/composite.tsrx +32 -42
  124. package/tests/hydration/components/events.tsrx +81 -101
  125. package/tests/hydration/components/for.tsrx +270 -336
  126. package/tests/hydration/components/head.tsrx +43 -39
  127. package/tests/hydration/components/hmr.tsrx +16 -22
  128. package/tests/hydration/components/html-in-template.tsrx +15 -21
  129. package/tests/hydration/components/html.tsrx +442 -526
  130. package/tests/hydration/components/if-children.tsrx +107 -125
  131. package/tests/hydration/components/if.tsrx +68 -90
  132. package/tests/hydration/components/mixed-control-flow.tsrx +65 -72
  133. package/tests/hydration/components/nested-control-flow.tsrx +202 -216
  134. package/tests/hydration/components/portal.tsrx +33 -41
  135. package/tests/hydration/components/reactivity.tsrx +26 -34
  136. package/tests/hydration/components/return.tsrx +4 -6
  137. package/tests/hydration/components/switch.tsrx +73 -78
  138. package/tests/hydration/components/track-async-serialization.tsrx +83 -93
  139. package/tests/hydration/components/try.tsrx +37 -51
  140. package/tests/hydration/switch.test.js +8 -8
  141. package/tests/server/await.test.tsrx +3 -3
  142. package/tests/server/basic.attributes.test.tsrx +120 -167
  143. package/tests/server/basic.components.test.tsrx +163 -197
  144. package/tests/server/basic.test.tsrx +298 -220
  145. package/tests/server/compiler.test.tsrx +142 -72
  146. package/tests/server/composite.props.test.tsrx +54 -58
  147. package/tests/server/composite.test.tsrx +165 -167
  148. package/tests/server/context.test.tsrx +13 -17
  149. package/tests/server/dynamic-elements.test.tsrx +103 -135
  150. package/tests/server/for.test.tsrx +115 -84
  151. package/tests/server/head.test.tsrx +31 -31
  152. package/tests/server/html-nesting-validation.test.tsrx +16 -8
  153. package/tests/server/if.test.tsrx +49 -59
  154. package/tests/server/lazy-destructuring.test.tsrx +288 -366
  155. package/tests/server/return.test.tsrx +58 -36
  156. package/tests/server/streaming-ssr.test.tsrx +4 -4
  157. package/tests/server/style-identifier.test.tsrx +58 -66
  158. package/tests/server/switch.test.tsrx +89 -97
  159. package/tests/server/track-async-serialization.test.tsrx +85 -103
  160. package/tests/server/try.test.tsrx +275 -360
  161. package/tests/utils/ref-types.test.js +72 -0
  162. package/tests/utils/vite-plugin-config.test.js +41 -74
  163. package/types/index.d.ts +1 -0
  164. package/src/runtime/internal/client/compat.js +0 -40
  165. package/tests/utils/compiler-compat-config.test.js +0 -38
package/CHANGELOG.md CHANGED
@@ -1,5 +1,80 @@
1
1
  # ripple
2
2
 
3
+ ## 0.3.74
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1199](https://github.com/Ripple-TS/ripple/pull/1199)
8
+ [`5d33325`](https://github.com/Ripple-TS/ripple/commit/5d3332564109d228af5e02c0f68ca4a318766649)
9
+ Thanks [@trueadm](https://github.com/trueadm)! - Expose Ripple's `RefValue` type
10
+ from the shared TSRX ref runtime declarations.
11
+
12
+ - [#1199](https://github.com/Ripple-TS/ripple/pull/1199)
13
+ [`5d33325`](https://github.com/Ripple-TS/ripple/commit/5d3332564109d228af5e02c0f68ca4a318766649)
14
+ Thanks [@trueadm](https://github.com/trueadm)! - Add `@empty { ... }` fallbacks
15
+ for TSRX `@for` loops, require prefixed template continuation clauses such as
16
+ `@else`, `@empty`, `@pending`, `@catch`, `@case`, and `@default`, and reject
17
+ direct `continue`, `break`, and `return` statements inside `@for` loop bodies
18
+ and `@if` template branches.
19
+
20
+ - [#1199](https://github.com/Ripple-TS/ripple/pull/1199)
21
+ [`5d33325`](https://github.com/Ripple-TS/ripple/commit/5d3332564109d228af5e02c0f68ca4a318766649)
22
+ Thanks [@trueadm](https://github.com/trueadm)! - Allow JSX and shared ref helper
23
+ types to accept arrays of ref functions.
24
+
25
+ - Updated dependencies
26
+ [[`5d33325`](https://github.com/Ripple-TS/ripple/commit/5d3332564109d228af5e02c0f68ca4a318766649),
27
+ [`5d33325`](https://github.com/Ripple-TS/ripple/commit/5d3332564109d228af5e02c0f68ca4a318766649),
28
+ [`5d33325`](https://github.com/Ripple-TS/ripple/commit/5d3332564109d228af5e02c0f68ca4a318766649),
29
+ [`5d33325`](https://github.com/Ripple-TS/ripple/commit/5d3332564109d228af5e02c0f68ca4a318766649),
30
+ [`5d33325`](https://github.com/Ripple-TS/ripple/commit/5d3332564109d228af5e02c0f68ca4a318766649),
31
+ [`5d33325`](https://github.com/Ripple-TS/ripple/commit/5d3332564109d228af5e02c0f68ca4a318766649),
32
+ [`5d33325`](https://github.com/Ripple-TS/ripple/commit/5d3332564109d228af5e02c0f68ca4a318766649),
33
+ [`5d33325`](https://github.com/Ripple-TS/ripple/commit/5d3332564109d228af5e02c0f68ca4a318766649),
34
+ [`5d33325`](https://github.com/Ripple-TS/ripple/commit/5d3332564109d228af5e02c0f68ca4a318766649),
35
+ [`5d33325`](https://github.com/Ripple-TS/ripple/commit/5d3332564109d228af5e02c0f68ca4a318766649),
36
+ [`5d33325`](https://github.com/Ripple-TS/ripple/commit/5d3332564109d228af5e02c0f68ca4a318766649),
37
+ [`5d33325`](https://github.com/Ripple-TS/ripple/commit/5d3332564109d228af5e02c0f68ca4a318766649),
38
+ [`5d33325`](https://github.com/Ripple-TS/ripple/commit/5d3332564109d228af5e02c0f68ca4a318766649),
39
+ [`5d33325`](https://github.com/Ripple-TS/ripple/commit/5d3332564109d228af5e02c0f68ca4a318766649),
40
+ [`5d33325`](https://github.com/Ripple-TS/ripple/commit/5d3332564109d228af5e02c0f68ca4a318766649),
41
+ [`5d33325`](https://github.com/Ripple-TS/ripple/commit/5d3332564109d228af5e02c0f68ca4a318766649),
42
+ [`5d33325`](https://github.com/Ripple-TS/ripple/commit/5d3332564109d228af5e02c0f68ca4a318766649),
43
+ [`5d33325`](https://github.com/Ripple-TS/ripple/commit/5d3332564109d228af5e02c0f68ca4a318766649),
44
+ [`5d33325`](https://github.com/Ripple-TS/ripple/commit/5d3332564109d228af5e02c0f68ca4a318766649),
45
+ [`5d33325`](https://github.com/Ripple-TS/ripple/commit/5d3332564109d228af5e02c0f68ca4a318766649),
46
+ [`5d33325`](https://github.com/Ripple-TS/ripple/commit/5d3332564109d228af5e02c0f68ca4a318766649),
47
+ [`5d33325`](https://github.com/Ripple-TS/ripple/commit/5d3332564109d228af5e02c0f68ca4a318766649),
48
+ [`5d33325`](https://github.com/Ripple-TS/ripple/commit/5d3332564109d228af5e02c0f68ca4a318766649),
49
+ [`5d33325`](https://github.com/Ripple-TS/ripple/commit/5d3332564109d228af5e02c0f68ca4a318766649)]:
50
+ - @tsrx/ripple@0.1.22
51
+ - @tsrx/core@0.1.22
52
+
53
+ ## 0.3.73
54
+
55
+ ### Patch Changes
56
+
57
+ - [#1198](https://github.com/Ripple-TS/ripple/pull/1198)
58
+ [`1de66b8`](https://github.com/Ripple-TS/ripple/commit/1de66b8f851849597b6078dab7af2699e49b0e21)
59
+ Thanks [@trueadm](https://github.com/trueadm)! - Remove the unused namespaced
60
+ TSX island feature and React bridge package.
61
+
62
+ - Updated dependencies
63
+ [[`e738e11`](https://github.com/Ripple-TS/ripple/commit/e738e1153694f56f35cfcab8982d897d7199d85a),
64
+ [`1de66b8`](https://github.com/Ripple-TS/ripple/commit/1de66b8f851849597b6078dab7af2699e49b0e21),
65
+ [`e00f596`](https://github.com/Ripple-TS/ripple/commit/e00f5961d5668c054435c8a366ef2a6da6e4a381)]:
66
+ - @tsrx/ripple@0.1.21
67
+ - @tsrx/core@0.1.21
68
+
69
+ ## 0.3.72
70
+
71
+ ### Patch Changes
72
+
73
+ - Updated dependencies
74
+ [[`0ea87fb`](https://github.com/Ripple-TS/ripple/commit/0ea87fb3cbef21c3c00d63cc2a1f3c9f34d01c24)]:
75
+ - @tsrx/core@0.1.20
76
+ - @tsrx/ripple@0.1.20
77
+
3
78
  ## 0.3.71
4
79
 
5
80
  ### Patch Changes
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.3.71",
6
+ "version": "0.3.74",
7
7
  "type": "module",
8
8
  "module": "src/runtime/index-client.js",
9
9
  "main": "src/runtime/index-client.js",
@@ -74,8 +74,8 @@
74
74
  "clsx": "^2.1.1",
75
75
  "devalue": "^5.8.1",
76
76
  "esm-env": "^1.2.2",
77
- "@tsrx/core": "0.1.19",
78
- "@tsrx/ripple": "0.1.19"
77
+ "@tsrx/core": "0.1.22",
78
+ "@tsrx/ripple": "0.1.22"
79
79
  },
80
80
  "devDependencies": {
81
81
  "@types/estree": "^1.0.8",
@@ -1,5 +1,6 @@
1
- import type { AddEventObject, FragmentProps, RefKey, TSRXElement } from '#public';
1
+ import type { AddEventObject, FragmentProps, RefKey, RefValue, TSRXElement } from '#public';
2
2
  import type { Nullable } from '#helpers';
3
+ export type { RefValue } from '#public';
3
4
 
4
5
  /**
5
6
  * Ripple JSX Runtime Type Definitions
@@ -67,13 +68,6 @@ type EventHandlerValue<Target extends globalThis.EventTarget, EventType extends
67
68
  | EventHandler<Target, EventType>
68
69
  | EventHandlerObject<Target, EventType>;
69
70
 
70
- type RefValue<Target extends globalThis.Element> =
71
- | ((node: Target) => void | (() => void))
72
- | { value: Target | null }
73
- | Target
74
- | null
75
- | undefined;
76
-
77
71
  type RefAttribute<Target extends globalThis.Element> = {
78
72
  [Key in RefKey]?: RefValue<Target>;
79
73
  };
@@ -1,4 +1,4 @@
1
- /** @import { CompatOptions, RootBoundaryOptions } from '#client' */
1
+ /** @import { RootBoundaryOptions } from '#client' */
2
2
 
3
3
  import { destroy_block, root } from './internal/client/blocks.js';
4
4
  import { handle_root_events } from './internal/client/events.js';
@@ -29,14 +29,6 @@ export {
29
29
  SUSPENSE_REJECTED,
30
30
  } from './internal/client/constants.js';
31
31
 
32
- /**
33
- * @returns {CompatOptions | undefined}
34
- */
35
- function get_default_compat() {
36
- return /** @type {typeof globalThis & { __RIPPLE_COMPAT__?: CompatOptions }} */ (globalThis)
37
- .__RIPPLE_COMPAT__;
38
- }
39
-
40
32
  /**
41
33
  * @param {Node} anchor
42
34
  * @param {(anchor: Node) => void} render_content
@@ -74,7 +66,6 @@ export function mount(component, options) {
74
66
  init_operations();
75
67
  remove_ssr_css();
76
68
 
77
- const compat = get_default_compat();
78
69
  const props = options.props || {};
79
70
  const target = options.target;
80
71
  const anchor = create_anchor();
@@ -96,7 +87,7 @@ export function mount(component, options) {
96
87
  },
97
88
  options.rootBoundary,
98
89
  );
99
- }, compat);
90
+ });
100
91
 
101
92
  return () => {
102
93
  cleanup_events();
@@ -113,7 +104,6 @@ export function hydrate(component, options) {
113
104
  init_operations();
114
105
  remove_ssr_css();
115
106
 
116
- const compat = get_default_compat();
117
107
  const props = options.props || {};
118
108
  const target = options.target;
119
109
  const was_hydrating = hydrating;
@@ -142,7 +132,7 @@ export function hydrate(component, options) {
142
132
  },
143
133
  options.rootBoundary,
144
134
  );
145
- }, compat);
135
+ });
146
136
  } catch (e) {
147
137
  throw e;
148
138
  } finally {
@@ -1,4 +1,4 @@
1
- /** @import { Block, Derived, CompatOptions, Component } from '#client' */
1
+ /** @import { Block, Derived, Component } from '#client' */
2
2
 
3
3
  import {
4
4
  BLOCK_HAS_RUN,
@@ -172,32 +172,10 @@ export function ref(element, get_fn, set_fn) {
172
172
 
173
173
  /**
174
174
  * @param {() => (void | (() => void))} fn
175
- * @param {CompatOptions} [compat]
176
175
  * @returns {Block}
177
176
  */
178
- export function root(fn, compat) {
179
- var target_fn = fn;
180
-
181
- if (compat != null) {
182
- /** @type {Array<void | (() => void)>} */
183
- var unmounts = [];
184
- for (var key in compat) {
185
- var api = compat[key];
186
- unmounts.push(api.createRoot());
187
- }
188
- target_fn = () => {
189
- var component_unmount = fn();
190
-
191
- return () => {
192
- component_unmount?.();
193
- for (var unmount of unmounts) {
194
- unmount?.();
195
- }
196
- };
197
- };
198
- }
199
-
200
- return block(ROOT_BLOCK, target_fn, { compat, start: null, end: null }, create_component_ctx());
177
+ export function root(fn) {
178
+ return block(ROOT_BLOCK, fn, { start: null, end: null }, create_component_ctx());
201
179
  }
202
180
 
203
181
  /**
@@ -57,6 +57,17 @@ function create_item(anchor, value, index, render_fn, is_indexed, is_keyed) {
57
57
  return b;
58
58
  }
59
59
 
60
+ /**
61
+ * @param {Node} anchor
62
+ * @param {(anchor: Node) => void} render_empty
63
+ * @returns {Block}
64
+ */
65
+ function create_empty(anchor, render_empty) {
66
+ return branch(() => {
67
+ render_empty(anchor);
68
+ });
69
+ }
70
+
60
71
  /**
61
72
  * @param {Block} block
62
73
  * @param {Element} anchor
@@ -104,9 +115,10 @@ function collection_to_array(collection) {
104
115
  * @param {() => V[] | Iterable<V>} get_collection
105
116
  * @param {(anchor: Node, value: V | Tracked, index?: any) => Block} render_fn
106
117
  * @param {number} flags
118
+ * @param {(anchor: Node) => void} [render_empty]
107
119
  * @returns {void}
108
120
  */
109
- export function for_block(node, get_collection, render_fn, flags) {
121
+ export function for_block(node, get_collection, render_fn, flags, render_empty) {
110
122
  var is_controlled = (flags & IS_CONTROLLED) !== 0;
111
123
  var is_indexed = (flags & IS_INDEXED) !== 0;
112
124
  var anchor = /** @type {Element | Text} */ (node);
@@ -131,7 +143,7 @@ export function for_block(node, get_collection, render_fn, flags) {
131
143
  var array = collection_to_array(collection);
132
144
 
133
145
  untrack(() => {
134
- reconcile_by_ref(anchor, block, array, render_fn, is_controlled, is_indexed);
146
+ reconcile_by_ref(anchor, block, array, render_fn, is_controlled, is_indexed, render_empty);
135
147
  });
136
148
 
137
149
  if (hydrating) {
@@ -151,9 +163,10 @@ export function for_block(node, get_collection, render_fn, flags) {
151
163
  * @param {(anchor: Node, value: V | Tracked, index?: any) => Block} render_fn
152
164
  * @param {number} flags
153
165
  * @param {(item: V) => K} [get_key]
166
+ * @param {(anchor: Node) => void} [render_empty]
154
167
  * @returns {void}
155
168
  */
156
- export function for_block_keyed(node, get_collection, render_fn, flags, get_key) {
169
+ export function for_block_keyed(node, get_collection, render_fn, flags, get_key, render_empty) {
157
170
  var is_controlled = (flags & IS_CONTROLLED) !== 0;
158
171
  var is_indexed = (flags & IS_INDEXED) !== 0;
159
172
  var anchor = /** @type {Element | Text} */ (node);
@@ -188,6 +201,7 @@ export function for_block_keyed(node, get_collection, render_fn, flags, get_key)
188
201
  is_controlled,
189
202
  is_indexed,
190
203
  /** @type {(item: V) => K} */ (get_key),
204
+ render_empty,
191
205
  );
192
206
  });
193
207
  },
@@ -211,6 +225,7 @@ function reconcile_fast_clear(anchor, block, array) {
211
225
  parent_node.append(anchor);
212
226
  state.array = array;
213
227
  state.blocks = [];
228
+ state.empty = null;
214
229
  }
215
230
 
216
231
  /**
@@ -241,9 +256,19 @@ function update_value(block, value) {
241
256
  * @param {boolean} is_controlled
242
257
  * @param {boolean} is_indexed
243
258
  * @param {(item: V) => K} get_key
259
+ * @param {(anchor: Node) => void} [render_empty]
244
260
  * @returns {void}
245
261
  */
246
- function reconcile_by_key(anchor, block, b, render_fn, is_controlled, is_indexed, get_key) {
262
+ function reconcile_by_key(
263
+ anchor,
264
+ block,
265
+ b,
266
+ render_fn,
267
+ is_controlled,
268
+ is_indexed,
269
+ get_key,
270
+ render_empty,
271
+ ) {
247
272
  var state = block.s;
248
273
 
249
274
  // Variables used in conditional branches - declare with initial values
@@ -271,6 +296,7 @@ function reconcile_by_key(anchor, block, b, render_fn, is_controlled, is_indexed
271
296
  array: [],
272
297
  blocks: [],
273
298
  keys: null,
299
+ empty: null,
274
300
  };
275
301
  }
276
302
 
@@ -279,6 +305,30 @@ function reconcile_by_key(anchor, block, b, render_fn, is_controlled, is_indexed
279
305
  var b_length = b.length;
280
306
  var j = 0;
281
307
 
308
+ if (b_length === 0) {
309
+ if (a_length > 0) {
310
+ if (is_controlled) {
311
+ reconcile_fast_clear(anchor, block, b);
312
+ } else {
313
+ for (; j < a_length; j++) {
314
+ destroy_block(state.blocks[j]);
315
+ }
316
+ state.array = b;
317
+ state.blocks = [];
318
+ state.keys = [];
319
+ }
320
+ }
321
+ if (render_empty && state.empty === null) {
322
+ state.empty = create_empty(anchor, render_empty);
323
+ }
324
+ return;
325
+ }
326
+
327
+ if (state.empty !== null) {
328
+ destroy_block(state.empty);
329
+ state.empty = null;
330
+ }
331
+
282
332
  // Fast-path for clear
283
333
  if (is_controlled && b_length === 0) {
284
334
  if (a_length > 0) {
@@ -516,9 +566,10 @@ function reconcile_by_key(anchor, block, b, render_fn, is_controlled, is_indexed
516
566
  * @param {(anchor: Node, value: V | Tracked, index?: any) => Block} render_fn
517
567
  * @param {boolean} is_controlled
518
568
  * @param {boolean} is_indexed
569
+ * @param {(anchor: Node) => void} [render_empty]
519
570
  * @returns {void}
520
571
  */
521
- function reconcile_by_ref(anchor, block, b, render_fn, is_controlled, is_indexed) {
572
+ function reconcile_by_ref(anchor, block, b, render_fn, is_controlled, is_indexed, render_empty) {
522
573
  var state = block.s;
523
574
 
524
575
  // Variables used in conditional branches - declare with initial values
@@ -546,6 +597,7 @@ function reconcile_by_ref(anchor, block, b, render_fn, is_controlled, is_indexed
546
597
  array: [],
547
598
  blocks: [],
548
599
  keys: null,
600
+ empty: null,
549
601
  };
550
602
  }
551
603
 
@@ -554,6 +606,29 @@ function reconcile_by_ref(anchor, block, b, render_fn, is_controlled, is_indexed
554
606
  var b_length = b.length;
555
607
  var j = 0;
556
608
 
609
+ if (b_length === 0) {
610
+ if (a_length > 0) {
611
+ if (is_controlled) {
612
+ reconcile_fast_clear(anchor, block, b);
613
+ } else {
614
+ for (; j < a_length; j++) {
615
+ destroy_block(state.blocks[j]);
616
+ }
617
+ state.array = b;
618
+ state.blocks = [];
619
+ }
620
+ }
621
+ if (render_empty && state.empty === null) {
622
+ state.empty = create_empty(anchor, render_empty);
623
+ }
624
+ return;
625
+ }
626
+
627
+ if (state.empty !== null) {
628
+ destroy_block(state.empty);
629
+ state.empty = null;
630
+ }
631
+
557
632
  // Fast-path for clear
558
633
  if (is_controlled && b_length === 0) {
559
634
  if (a_length > 0) {
@@ -127,8 +127,6 @@ export { expression } from './expression.js';
127
127
 
128
128
  export { rpc } from './rpc.js';
129
129
 
130
- export { tsx_compat } from './compat.js';
131
-
132
130
  export { render_tsrx_element } from './component.js';
133
131
 
134
132
  export { TRY_BLOCK, HMR } from './constants.js';
@@ -59,16 +59,6 @@ export type BlockWithTryBoundaryAndCatch = Omit<BlockWithTryBoundary, 's'> & {
59
59
  s: TryBoundaryState & { c: NonNullable<TryBoundaryState['c']> };
60
60
  };
61
61
 
62
- export type CompatApi = {
63
- createRoot: () => void;
64
- createComponent: (node: any, children_fn: () => any) => void;
65
- jsx: (type: any, props: any) => any;
66
- };
67
-
68
- export type CompatOptions = {
69
- [key: string]: CompatApi;
70
- };
71
-
72
62
  export type RootBoundaryOptions = {
73
63
  pending?: (anchor: Node, props: Record<string, never>, block: Block | null) => void;
74
64
  catch?: (anchor: Node, props: { error: unknown; reset: () => void }, block: Block | null) => void;
@@ -2,48 +2,56 @@
2
2
 
3
3
  exports[`computed tracked properties > should update a property using assignment 1`] = `
4
4
  <div>
5
+ <!---->
5
6
  <div>
6
7
  0
7
8
  </div>
8
9
  <button>
9
10
  Increment
10
11
  </button>
12
+ <!---->
11
13
 
12
14
  </div>
13
15
  `;
14
16
 
15
17
  exports[`computed tracked properties > should update a property using assignment 2`] = `
16
18
  <div>
19
+ <!---->
17
20
  <div>
18
21
  1
19
22
  </div>
20
23
  <button>
21
24
  Increment
22
25
  </button>
26
+ <!---->
23
27
 
24
28
  </div>
25
29
  `;
26
30
 
27
31
  exports[`computed tracked properties > should update a property using update expressions 1`] = `
28
32
  <div>
33
+ <!---->
29
34
  <div>
30
35
  0
31
36
  </div>
32
37
  <button>
33
38
  Increment
34
39
  </button>
40
+ <!---->
35
41
 
36
42
  </div>
37
43
  `;
38
44
 
39
45
  exports[`computed tracked properties > should update a property using update expressions 2`] = `
40
46
  <div>
47
+ <!---->
41
48
  <div>
42
49
  1
43
50
  </div>
44
51
  <button>
45
52
  Increment
46
53
  </button>
54
+ <!---->
47
55
 
48
56
  </div>
49
57
  `;
@@ -2,6 +2,7 @@
2
2
 
3
3
  exports[`for statements > correctly handles intermediate statements in for block 1`] = `
4
4
  <div>
5
+ <!---->
5
6
  <div>
6
7
  <div>
7
8
  <div>
@@ -32,12 +33,14 @@ exports[`for statements > correctly handles intermediate statements in for block
32
33
  <button>
33
34
  Add Item
34
35
  </button>
36
+ <!---->
35
37
 
36
38
  </div>
37
39
  `;
38
40
 
39
41
  exports[`for statements > correctly handles intermediate statements in for block 2`] = `
40
42
  <div>
43
+ <!---->
41
44
  <div>
42
45
  <div>
43
46
  <div>
@@ -76,12 +79,14 @@ exports[`for statements > correctly handles intermediate statements in for block
76
79
  <button>
77
80
  Add Item
78
81
  </button>
82
+ <!---->
79
83
 
80
84
  </div>
81
85
  `;
82
86
 
83
87
  exports[`for statements > correctly handles keyed for...of loops 1`] = `
84
88
  <div>
89
+ <!---->
85
90
  <!---->
86
91
  <div>
87
92
  0:Item 1
@@ -96,12 +101,14 @@ exports[`for statements > correctly handles keyed for...of loops 1`] = `
96
101
  <button>
97
102
  Reverse
98
103
  </button>
104
+ <!---->
99
105
 
100
106
  </div>
101
107
  `;
102
108
 
103
109
  exports[`for statements > correctly handles keyed for...of loops 2`] = `
104
110
  <div>
111
+ <!---->
105
112
  <!---->
106
113
  <div>
107
114
  0:Item 3
@@ -116,12 +123,14 @@ exports[`for statements > correctly handles keyed for...of loops 2`] = `
116
123
  <button>
117
124
  Reverse
118
125
  </button>
126
+ <!---->
119
127
 
120
128
  </div>
121
129
  `;
122
130
 
123
131
  exports[`for statements > correctly handles the index in a for...of loop 1`] = `
124
132
  <div>
133
+ <!---->
125
134
  <div>
126
135
  <div>
127
136
  0 : a
@@ -140,12 +149,14 @@ exports[`for statements > correctly handles the index in a for...of loop 1`] = `
140
149
  <button>
141
150
  Reverse
142
151
  </button>
152
+ <!---->
143
153
 
144
154
  </div>
145
155
  `;
146
156
 
147
157
  exports[`for statements > correctly handles the index in a for...of loop 2`] = `
148
158
  <div>
159
+ <!---->
149
160
  <div>
150
161
  <div>
151
162
  0 : a
@@ -167,12 +178,14 @@ exports[`for statements > correctly handles the index in a for...of loop 2`] = `
167
178
  <button>
168
179
  Reverse
169
180
  </button>
181
+ <!---->
170
182
 
171
183
  </div>
172
184
  `;
173
185
 
174
186
  exports[`for statements > correctly handles the index in a for...of loop 3`] = `
175
187
  <div>
188
+ <!---->
176
189
  <div>
177
190
  <div>
178
191
  0 : d
@@ -194,12 +207,14 @@ exports[`for statements > correctly handles the index in a for...of loop 3`] = `
194
207
  <button>
195
208
  Reverse
196
209
  </button>
210
+ <!---->
197
211
 
198
212
  </div>
199
213
  `;
200
214
 
201
215
  exports[`for statements > handles updating with new objects with same key 1`] = `
202
216
  <div>
217
+ <!---->
203
218
  <!---->
204
219
  <div>
205
220
  0:Item 1
@@ -214,12 +229,14 @@ exports[`for statements > handles updating with new objects with same key 1`] =
214
229
  <button>
215
230
  Reverse
216
231
  </button>
232
+ <!---->
217
233
 
218
234
  </div>
219
235
  `;
220
236
 
221
237
  exports[`for statements > handles updating with new objects with same key 2`] = `
222
238
  <div>
239
+ <!---->
223
240
  <!---->
224
241
  <div>
225
242
  0:Item 1!
@@ -234,12 +251,14 @@ exports[`for statements > handles updating with new objects with same key 2`] =
234
251
  <button>
235
252
  Reverse
236
253
  </button>
254
+ <!---->
237
255
 
238
256
  </div>
239
257
  `;
240
258
 
241
259
  exports[`for statements > renders a simple dynamic array 1`] = `
242
260
  <div>
261
+ <!---->
243
262
  <!---->
244
263
  <div
245
264
  class="Item 1"
@@ -260,12 +279,14 @@ exports[`for statements > renders a simple dynamic array 1`] = `
260
279
  <button>
261
280
  Add Item
262
281
  </button>
282
+ <!---->
263
283
 
264
284
  </div>
265
285
  `;
266
286
 
267
287
  exports[`for statements > renders a simple dynamic array 2`] = `
268
288
  <div>
289
+ <!---->
269
290
  <!---->
270
291
  <div
271
292
  class="Item 1"
@@ -291,6 +312,7 @@ exports[`for statements > renders a simple dynamic array 2`] = `
291
312
  <button>
292
313
  Add Item
293
314
  </button>
315
+ <!---->
294
316
 
295
317
  </div>
296
318
  `;
@@ -2,6 +2,7 @@
2
2
 
3
3
  exports[`Fragment innerHTML > renders dynamic innerHTML fragments 1`] = `
4
4
  <div>
5
+ <!---->
5
6
  <!---->
6
7
  <div>
7
8
  Test
@@ -10,12 +11,14 @@ exports[`Fragment innerHTML > renders dynamic innerHTML fragments 1`] = `
10
11
  <button>
11
12
  Update
12
13
  </button>
14
+ <!---->
13
15
 
14
16
  </div>
15
17
  `;
16
18
 
17
19
  exports[`Fragment innerHTML > renders dynamic innerHTML fragments 2`] = `
18
20
  <div>
21
+ <!---->
19
22
  <!---->
20
23
  <div>
21
24
  Updated
@@ -24,6 +27,7 @@ exports[`Fragment innerHTML > renders dynamic innerHTML fragments 2`] = `
24
27
  <button>
25
28
  Update
26
29
  </button>
30
+ <!---->
27
31
 
28
32
  </div>
29
33
  `;