ripple 0.2.167 → 0.2.168

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.167",
6
+ "version": "0.2.168",
7
7
  "type": "module",
8
8
  "module": "src/runtime/index-client.js",
9
9
  "main": "src/runtime/index-client.js",
@@ -81,6 +81,6 @@
81
81
  "typescript": "^5.9.2"
82
82
  },
83
83
  "peerDependencies": {
84
- "ripple": "0.2.167"
84
+ "ripple": "0.2.168"
85
85
  }
86
86
  }
@@ -1,4 +1,4 @@
1
- /** @import { Block, Derived, CompatOptions } from '#client' */
1
+ /** @import { Block, Derived, CompatOptions, Component } from '#client' */
2
2
 
3
3
  import {
4
4
  BLOCK_HAS_RUN,
@@ -19,6 +19,7 @@ import {
19
19
  active_block,
20
20
  active_component,
21
21
  active_reaction,
22
+ create_component_ctx,
22
23
  is_block_dirty,
23
24
  run_block,
24
25
  run_teardown,
@@ -151,7 +152,7 @@ export function root(fn, compat) {
151
152
  };
152
153
  }
153
154
 
154
- return block(ROOT_BLOCK, fn, { compat });
155
+ return block(ROOT_BLOCK, target_fn, { compat }, create_component_ctx());
155
156
  }
156
157
 
157
158
  /**
@@ -181,13 +182,14 @@ function push_block(block, parent_block) {
181
182
  /**
182
183
  * @param {number} flags
183
184
  * @param {Function} fn
184
- * @param {any} state
185
+ * @param {any} [state]
186
+ * @param {Component} [co]
185
187
  * @returns {Block}
186
188
  */
187
- export function block(flags, fn, state = null) {
189
+ export function block(flags, fn, state = null, co) {
188
190
  /** @type {Block} */
189
191
  var block = {
190
- co: active_component,
192
+ co: co || active_component,
191
193
  d: null,
192
194
  first: null,
193
195
  f: flags,
@@ -4,6 +4,7 @@ export {
4
4
  next_sibling as sibling,
5
5
  document,
6
6
  create_text,
7
+ init_operations,
7
8
  } from './operations.js';
8
9
 
9
10
  export {
@@ -16,7 +17,7 @@ export {
16
17
  set_selected,
17
18
  } from './render.js';
18
19
 
19
- export { render, render_spread, async, ref, branch, destroy_block } from './blocks.js';
20
+ export { render, render_spread, async, ref, branch, destroy_block, root } from './blocks.js';
20
21
 
21
22
  export { event, delegate } from './events.js';
22
23
 
@@ -1197,16 +1197,20 @@ export function safe_scope(err = 'Cannot access outside of a component context')
1197
1197
  return /** @type {Block} */ (active_scope);
1198
1198
  }
1199
1199
 
1200
- /**
1201
- * @returns {void}
1202
- */
1203
- export function push_component() {
1204
- var component = {
1200
+ export function create_component_ctx() {
1201
+ return {
1205
1202
  c: null,
1206
1203
  e: null,
1207
1204
  m: false,
1208
1205
  p: active_component,
1209
1206
  };
1207
+ }
1208
+
1209
+ /**
1210
+ * @returns {void}
1211
+ */
1212
+ export function push_component() {
1213
+ var component = create_component_ctx();
1210
1214
  active_component = component;
1211
1215
  }
1212
1216