solid-ctrl-flow 1.0.44 → 1.0.46

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/dist/index.d.ts CHANGED
@@ -3,6 +3,8 @@ import { Context } from 'solid-js';
3
3
  import { EffectFunction } from 'solid-js';
4
4
  import { JSX } from 'solid-js';
5
5
  import { MemoOptions } from 'solid-js';
6
+ import { Owner } from 'solid-js';
7
+ import { ParentProps } from 'solid-js';
6
8
  import { Resource } from 'solid-js';
7
9
  import { Setter } from 'solid-js';
8
10
  import { Signal } from 'solid-js';
@@ -38,40 +40,26 @@ export declare function bindTwoWay<S>(source: Signal<S>, dest: Signal<S>): () =>
38
40
 
39
41
  export declare function bindTwoWay<S, D>(source: Signal<S>, dest: Signal<D>, to: Convert<S, D>, from: Convert<D, S>): () => void;
40
42
 
41
- /**
42
- * Allows the use of {@link When}s inside of {@link Switch}es.
43
- * Example:
44
- * ```tsx
45
- * return <>
46
- * <Switch>
47
- * <Match when={SOMETHING}>
48
- * RANDOM_CONDITION
49
- * </Match>
50
- * <Case value={1}>
51
- * <When value={1}>
52
- * TRUE
53
- * </When>
54
- * <When pred={x => x === 2}>
55
- * FALSE_WITH_PREDICATE
56
- * </When>
57
- * <When pred={x => x.innerValue}>
58
- * {x => <>THRUTHY VALUE {x()}</>}
59
- * </When>
60
- * <When keyed pred={x => x.innerValue}>
61
- * {x => <>THRUTHY KEYED VALUE {x}</>}
62
- * </When>
63
- * </Case>
64
- * <Match when>
65
- * DEFAULT
66
- * </Match>
67
- * </Switch>
68
- * <>
69
- * ```
70
- */
71
- export declare const Case: (props: {
72
- value: any;
73
- children: JSX.Element;
74
- }) => JSX.Element;
43
+ /** Like a {@link Match} but gets the value from the closest {@link On} ancestor */
44
+ export declare function Case(props: ParentProps<{
45
+ value: unknown;
46
+ }>): JSX.Element;
47
+
48
+ export declare function Case(props: ParentProps<{
49
+ pred: (x: any) => unknown;
50
+ }>): JSX.Element;
51
+
52
+ export declare function Case<T>(props: {
53
+ pred: (x: any) => T;
54
+ keyed?: false;
55
+ children: (x: Accessor<NonNullable<T>>) => JSX.Element;
56
+ }): JSX.Element;
57
+
58
+ export declare function Case<T>(props: {
59
+ pred: (x: any) => T;
60
+ keyed: true;
61
+ children: (x: NonNullable<T>) => JSX.Element;
62
+ }): JSX.Element;
75
63
 
76
64
  /**
77
65
  * Returns a {@link Signal} that applies the `??=` operator to the input one.
@@ -110,10 +98,16 @@ export declare function createExtractor(name?: string): {
110
98
  /** Shows the content of the closest {@link Source} child of the closest {@link Joint} ancestor of this component */
111
99
  Dest: () => JSX.Element;
112
100
  /** Puts its content inside of a {@link Dest} if it is available; There is no need to include this component on the DOM tree */
113
- Source: (props: Info) => JSX.Element;
101
+ Source: (props: Slot & {
102
+ order?: number | undefined;
103
+ } & {
104
+ children?: JSX.Element;
105
+ } & {
106
+ sameContext?: boolean | undefined;
107
+ }) => JSX.Element;
114
108
  /** Allows {@link Dest} and {@link Source} childrens to communicate with each other */
115
109
  Joint: (props: {
116
- children: JSX.Element;
110
+ children?: JSX.Element;
117
111
  }) => JSX.Element;
118
112
  /**
119
113
  * Gets an {@link Accessor} that tells if the context in which THIS getter has been executed has been extracted (Is inside of a {@link Dest})
@@ -148,13 +142,6 @@ export declare function Enfold<T>(props: Unkeyed<T>): JSX.Element;
148
142
  /** Handy type alias */
149
143
  declare type Equals = MemoOptions<unknown>["equals"];
150
144
 
151
- /** Informations about a {@link Source} component */
152
- declare type Info = Slot & {
153
- /** Order of the current source if there are many */
154
- order?: number;
155
- children: JSX.Element;
156
- };
157
-
158
145
  /** Parameters to pass to a keyed {@link Enfold} */
159
146
  declare type Keyed<T> = Standard<T> & {
160
147
  keyed: true;
@@ -181,17 +168,50 @@ export declare function memoProps<T, K extends readonly (keyof T)[]>(obj: T, key
181
168
  * ```tsx
182
169
  * return <>
183
170
  * <Nest each={[ 1, 2, 3 ]} template={(c, x) => <>({x}, {c()}, -{x})</>}>
184
- * content
171
+ * CONTENT
185
172
  * </Nest>
186
173
  * </>
187
174
  * ```
188
- * Will output "(1, (2, (3, content, -3), -2), -1)"
175
+ * Will output "(1, (2, (3, CONTENT, -3), -2), -1)"
189
176
  */
190
- export declare function Nest<T>(props: {
177
+ export declare function Nest<T>(props: ParentProps<{
191
178
  each: readonly T[] | undefined;
192
179
  template: (c: Accessor<JSX.Element>, x: T, i: Accessor<number>) => JSX.Element;
193
- children: JSX.Element;
194
- }): JSX.Element;
180
+ }>): JSX.Element;
181
+
182
+ /**
183
+ * Allows the use of {@link Case}s inside of {@link Switch}es.
184
+ * Example:
185
+ * ```tsx
186
+ * return <>
187
+ * <Switch>
188
+ * <Match when={SOMETHING}>
189
+ * RANDOM_CONDITION
190
+ * </Match>
191
+ * <On value={1}>
192
+ * <Case value={1}>
193
+ * TRUE
194
+ * </Case>
195
+ * <Case pred={x => x === 2}>
196
+ * FALSE_WITH_PREDICATE
197
+ * </Case>
198
+ * <Case pred={x => x.innerValue}>
199
+ * {x => <>THRUTHY VALUE {x()}</>}
200
+ * </Case>
201
+ * <Case keyed pred={x => x.innerValue}>
202
+ * {x => <>THRUTHY KEYED VALUE {x}</>}
203
+ * </Case>
204
+ * </On>
205
+ * <Match when>
206
+ * DEFAULT
207
+ * </Match>
208
+ * </Switch>
209
+ * <>
210
+ * ```
211
+ */
212
+ export declare const On: (props: ParentProps<{
213
+ value: any;
214
+ }>) => JSX.Element;
195
215
 
196
216
  /**
197
217
  * Reactive {@link Context} with some additional built-in functionalities.
@@ -211,18 +231,16 @@ export declare abstract class ReactiveContext<T> extends BASE_CTOR<T> {
211
231
  * The function is binded for the way solid compiles components inside other objects.
212
232
  * (The value is memoized)
213
233
  */
214
- get Provider(): (props: {
234
+ get Provider(): (props: ParentProps<{
215
235
  value?: T;
216
- children: JSX.Element;
217
- }) => JSX.Element;
236
+ }>) => JSX.Element;
218
237
  /**
219
238
  * Executes {@link runWithContext} on the current context
220
239
  * @param value The value for the context
221
240
  * @param f The function to run
222
241
  * @returns The same thing {@link f} returned
223
242
  */
224
- runWith<V extends T, R>(value: V, f: (x: V) => R): R;
225
- runWith<R>(value: T | undefined, f: (x: T) => R): R;
243
+ runWith<V extends T, R>(value: V | undefined, f: (x: V) => R): R;
226
244
  /**
227
245
  * Creates a {@link ReactiveContext}
228
246
  * @param defaultValue Initial value for the context
@@ -241,9 +259,12 @@ export declare abstract class ReactiveContext<T> extends BASE_CTOR<T> {
241
259
  * @param f The function to run
242
260
  * @returns The same thing {@link f} returned
243
261
  */
244
- export declare function runWithContext<T, V extends T, R>(ctx: Context<T>, value: V, f: (x: V) => R): R;
262
+ export declare function runWithContext<T, V extends T, R>(ctx: Context<T>, value: V | undefined, f: (x: V) => R): R;
245
263
 
246
- export declare function runWithContext<T, R>(ctx: Context<T>, value: T | undefined, f: (x: T) => R): R;
264
+ /** Makes its children inherit the {@link Context}s of the provided {@link Owner} */
265
+ export declare function SameContext(props: ParentProps<{
266
+ owner: Owner;
267
+ }>): JSX.Element;
247
268
 
248
269
  /** Element which tracks its index in its containing array */
249
270
  export declare interface Slot {
@@ -284,11 +305,10 @@ export declare namespace Slot {
284
305
  export declare function splitAndMemoProps<T extends Record<any, any>, K extends readonly (keyof T)[]>(obj: T, keys: K, equals?: Equals): [Pick<T, Extract<K, readonly (keyof T)[]>[number]>, Omit<T, K[number]>];
285
306
 
286
307
  /** Standard parameters to pass to an {@link Enfold} */
287
- declare type Standard<T> = {
308
+ declare type Standard<T> = ParentProps<{
288
309
  when: T;
289
- children: JSX.Element;
290
310
  unrecycled?: boolean;
291
- };
311
+ }>;
292
312
 
293
313
  /** Type of an element wrapping call-back which accepts an additional parameter */
294
314
  declare type Template<T> = (c: Accessor<JSX.Element>, x: T) => JSX.Element;
@@ -345,27 +365,4 @@ export declare const unwrap: <T extends object>(f: Accessor<T>) => T;
345
365
  */
346
366
  export declare function unwrapSignal<T>(f: Accessor<Signal<T>>): Signal<T>;
347
367
 
348
- /** Like a {@link Match} but gets the value from the closest {@link Case} ancestor */
349
- export declare function When(props: {
350
- value: unknown;
351
- children: JSX.Element;
352
- }): JSX.Element;
353
-
354
- export declare function When(props: {
355
- pred: (x: any) => unknown;
356
- children: JSX.Element;
357
- }): JSX.Element;
358
-
359
- export declare function When<T>(props: {
360
- pred: (x: any) => T;
361
- keyed?: false;
362
- children: (x: Accessor<NonNullable<T>>) => JSX.Element;
363
- }): JSX.Element;
364
-
365
- export declare function When<T>(props: {
366
- pred: (x: any) => T;
367
- keyed: true;
368
- children: (x: NonNullable<T>) => JSX.Element;
369
- }): JSX.Element;
370
-
371
368
  export { }
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { useContext, createMemo, createComponent, createContext, createRoot, getOwner, Match, mergeProps, splitProps, createEffect, on, createResource, untrack, Show, onCleanup, For, mapArray, createSignal, onMount, createRenderEffect, getListener } from "solid-js";
1
+ import { useContext, createMemo, createComponent, createContext, createRoot, getOwner, splitProps, createEffect, on, createResource, untrack, Show, onCleanup, For, mapArray, createSignal, onMount, Match, mergeProps, createRenderEffect, getListener } from "solid-js";
2
2
  import { createMutable } from "solid-js/store";
3
3
  const BASE_CTOR = Function;
4
4
  class ReactiveContext extends BASE_CTOR {
@@ -64,20 +64,6 @@ function runWithContext(ctx2, value, f) {
64
64
  }
65
65
  });
66
66
  }
67
- const ctx = ReactiveContext.create(void 0, "case-when");
68
- const Case = ctx.Provider;
69
- function When(props) {
70
- const [mine, other] = splitAndMemoProps(props, ["value", "pred"]);
71
- const {
72
- read
73
- } = ctx;
74
- const pred = (x) => mine.pred ? mine.pred(x) : x === mine.value;
75
- return createComponent(Match, mergeProps({
76
- get when() {
77
- return pred(read());
78
- }
79
- }, other));
80
- }
81
67
  function memoProps(obj, keys = Object.keys(obj), equals = false) {
82
68
  const out = {};
83
69
  for (const elm of keys)
@@ -169,7 +155,7 @@ function Dest() {
169
155
  onCleanup(() => obj.attached--);
170
156
  return createComponent(For, {
171
157
  get each() {
172
- return obj.source.toSorted((a, b) => a.order - b.order);
158
+ return obj.source.toSorted((a, b) => (a.order ?? 0) - (b.order ?? 0));
173
159
  },
174
160
  children: (x) => createMemo(() => x.children)
175
161
  });
@@ -178,15 +164,7 @@ function Source(props) {
178
164
  const obj = useContext(this);
179
165
  if (!obj)
180
166
  return createMemo(() => props.children);
181
- const order = createMemo(() => props.order || 0);
182
- const info = {
183
- get order() {
184
- return order();
185
- },
186
- get children() {
187
- return props.children;
188
- }
189
- };
167
+ const info = createInfo(props);
190
168
  Slot.push(obj.source, info);
191
169
  onCleanup(() => Slot.remove(obj.source, info));
192
170
  return createComponent(Show, {
@@ -213,6 +191,32 @@ function Joint(props) {
213
191
  }
214
192
  });
215
193
  }
194
+ function createInfo(props) {
195
+ const owner = getOwner(), memo = createMemo(() => props.order);
196
+ return {
197
+ get order() {
198
+ return memo();
199
+ },
200
+ get children() {
201
+ return createComponent(Show, {
202
+ get when() {
203
+ return props.sameContext;
204
+ },
205
+ get fallback() {
206
+ return props.children;
207
+ },
208
+ get children() {
209
+ return createComponent(SameContext, {
210
+ owner,
211
+ get children() {
212
+ return props.children;
213
+ }
214
+ });
215
+ }
216
+ });
217
+ }
218
+ };
219
+ }
216
220
  function Nest(props) {
217
221
  const memo = memoProps(props, ["template", "children"]);
218
222
  const content = mapArray(() => props.each, (x, i) => {
@@ -226,6 +230,20 @@ function Nest(props) {
226
230
  });
227
231
  return createMemo(() => content().reduceRight((a, b) => b(a), memo.children));
228
232
  }
233
+ const ctx = ReactiveContext.create(void 0, "on-case");
234
+ const On = ctx.Provider;
235
+ function Case(props) {
236
+ const [mine, other] = splitAndMemoProps(props, ["value", "pred"]);
237
+ const {
238
+ read
239
+ } = ctx;
240
+ const pred = (x) => mine.pred ? mine.pred(x) : x === mine.value;
241
+ return createComponent(Match, mergeProps({
242
+ get when() {
243
+ return pred(read());
244
+ }
245
+ }, other));
246
+ }
229
247
  const IDENTITY = (x) => x;
230
248
  function bind(source, dest, to = IDENTITY, skip = false) {
231
249
  const d = createRoot((d2) => (createRenderEffect(on(source, (x) => skip ? skip = false : dest((prev) => to(x, prev)))), d2));
@@ -264,13 +282,20 @@ function coalesceSignal([get, set], f) {
264
282
  }
265
283
  }
266
284
  const debug = ReactiveContext.create(false, "debug-scope");
285
+ function SameContext(props) {
286
+ return createMemo(() => {
287
+ getOwner().context = props.owner.context;
288
+ return props.children;
289
+ });
290
+ }
267
291
  export {
268
292
  Case,
269
293
  Enfold,
270
294
  Nest,
295
+ On,
271
296
  ReactiveContext,
297
+ SameContext,
272
298
  Slot,
273
- When,
274
299
  bind,
275
300
  bindTwoWay,
276
301
  coalesceSignal,
package/dist/index.umd.js CHANGED
@@ -66,20 +66,6 @@
66
66
  }
67
67
  });
68
68
  }
69
- const ctx = ReactiveContext.create(void 0, "case-when");
70
- const Case = ctx.Provider;
71
- function When(props) {
72
- const [mine, other] = splitAndMemoProps(props, ["value", "pred"]);
73
- const {
74
- read
75
- } = ctx;
76
- const pred = (x) => mine.pred ? mine.pred(x) : x === mine.value;
77
- return solidJs.createComponent(solidJs.Match, solidJs.mergeProps({
78
- get when() {
79
- return pred(read());
80
- }
81
- }, other));
82
- }
83
69
  function memoProps(obj, keys = Object.keys(obj), equals = false) {
84
70
  const out = {};
85
71
  for (const elm of keys)
@@ -171,7 +157,7 @@
171
157
  solidJs.onCleanup(() => obj.attached--);
172
158
  return solidJs.createComponent(solidJs.For, {
173
159
  get each() {
174
- return obj.source.toSorted((a, b) => a.order - b.order);
160
+ return obj.source.toSorted((a, b) => (a.order ?? 0) - (b.order ?? 0));
175
161
  },
176
162
  children: (x) => solidJs.createMemo(() => x.children)
177
163
  });
@@ -180,15 +166,7 @@
180
166
  const obj = solidJs.useContext(this);
181
167
  if (!obj)
182
168
  return solidJs.createMemo(() => props.children);
183
- const order = solidJs.createMemo(() => props.order || 0);
184
- const info = {
185
- get order() {
186
- return order();
187
- },
188
- get children() {
189
- return props.children;
190
- }
191
- };
169
+ const info = createInfo(props);
192
170
  exports2.Slot.push(obj.source, info);
193
171
  solidJs.onCleanup(() => exports2.Slot.remove(obj.source, info));
194
172
  return solidJs.createComponent(solidJs.Show, {
@@ -215,6 +193,32 @@
215
193
  }
216
194
  });
217
195
  }
196
+ function createInfo(props) {
197
+ const owner = solidJs.getOwner(), memo = solidJs.createMemo(() => props.order);
198
+ return {
199
+ get order() {
200
+ return memo();
201
+ },
202
+ get children() {
203
+ return solidJs.createComponent(solidJs.Show, {
204
+ get when() {
205
+ return props.sameContext;
206
+ },
207
+ get fallback() {
208
+ return props.children;
209
+ },
210
+ get children() {
211
+ return solidJs.createComponent(SameContext, {
212
+ owner,
213
+ get children() {
214
+ return props.children;
215
+ }
216
+ });
217
+ }
218
+ });
219
+ }
220
+ };
221
+ }
218
222
  function Nest(props) {
219
223
  const memo = memoProps(props, ["template", "children"]);
220
224
  const content = solidJs.mapArray(() => props.each, (x, i) => {
@@ -228,6 +232,20 @@
228
232
  });
229
233
  return solidJs.createMemo(() => content().reduceRight((a, b) => b(a), memo.children));
230
234
  }
235
+ const ctx = ReactiveContext.create(void 0, "on-case");
236
+ const On = ctx.Provider;
237
+ function Case(props) {
238
+ const [mine, other] = splitAndMemoProps(props, ["value", "pred"]);
239
+ const {
240
+ read
241
+ } = ctx;
242
+ const pred = (x) => mine.pred ? mine.pred(x) : x === mine.value;
243
+ return solidJs.createComponent(solidJs.Match, solidJs.mergeProps({
244
+ get when() {
245
+ return pred(read());
246
+ }
247
+ }, other));
248
+ }
231
249
  const IDENTITY = (x) => x;
232
250
  function bind(source, dest, to = IDENTITY, skip = false) {
233
251
  const d = solidJs.createRoot((d2) => (solidJs.createRenderEffect(solidJs.on(source, (x) => skip ? skip = false : dest((prev) => to(x, prev)))), d2));
@@ -266,11 +284,18 @@
266
284
  }
267
285
  }
268
286
  const debug = ReactiveContext.create(false, "debug-scope");
287
+ function SameContext(props) {
288
+ return solidJs.createMemo(() => {
289
+ solidJs.getOwner().context = props.owner.context;
290
+ return props.children;
291
+ });
292
+ }
269
293
  exports2.Case = Case;
270
294
  exports2.Enfold = Enfold;
271
295
  exports2.Nest = Nest;
296
+ exports2.On = On;
272
297
  exports2.ReactiveContext = ReactiveContext;
273
- exports2.When = When;
298
+ exports2.SameContext = SameContext;
274
299
  exports2.bind = bind;
275
300
  exports2.bindTwoWay = bindTwoWay;
276
301
  exports2.coalesceSignal = coalesceSignal;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "solid-ctrl-flow",
3
- "version": "1.0.44",
3
+ "version": "1.0.46",
4
4
  "description": "Control flow components for solid-js",
5
5
  "author": "AFatNiBBa",
6
6
  "license": "ISC",
@@ -16,6 +16,7 @@
16
16
  },
17
17
  "devDependencies": {
18
18
  "@types/node": "^20.6.0",
19
+ "logic-types": "^1.3.2",
19
20
  "vite": "^4.4.9",
20
21
  "vite-plugin-dts": "^3.5.3",
21
22
  "vite-plugin-solid": "^2.7.0"
package/readMe.md CHANGED
@@ -5,32 +5,14 @@ It's always under hard development
5
5
 
6
6
  ## Components
7
7
 
8
- ### `Case` - `When`
9
- Allows you to not repeat the same condition across many `Match` components.
10
- The following code
8
+ ### `SameContext`
9
+ Makes its children inherit the `Context`s of the provided `Owner`
11
10
  ```tsx
12
- const value = 1;
11
+ const owner = ...;
13
12
  return <>
14
- <Switch>
15
- <Case value={value}>
16
- <When value={1}>One</When>
17
- <When value={2}>Two</When>
18
- <When pred={(x) => `${x}`.length === 3}>Long</When>
19
- </Case>
20
- <Match when>Default</Match>
21
- </Switch>
22
- </>
23
- ```
24
- Is equivalent to this
25
- ```tsx
26
- const value = 1;
27
- return <>
28
- <Switch>
29
- <Match when={value === 1}>One</Match>
30
- <Match when={value === 2}>Two</Match>
31
- <Match when={`${value}`.length === 3}>Long</Match>
32
- <Match when>Default</Match>
33
- </Switch>
13
+ <SameContext owner={owner}>
14
+ ...
15
+ </SameContext>
34
16
  </>
35
17
  ```
36
18
 
@@ -41,7 +23,7 @@ The following code
41
23
  const value = true;
42
24
  return <>
43
25
  <Enfold when={value} template={c => <div style={{ background: "red" }}>{c()}</div>}>
44
- content
26
+ CONTENT
45
27
  </Enfold>
46
28
  </>
47
29
  ```
@@ -49,13 +31,13 @@ Is equivalent to this
49
31
  ```tsx
50
32
  return <>
51
33
  <div style={{ background: "red" }}>
52
- content
34
+ CONTENT
53
35
  </div>
54
36
  </>
55
37
  ```
56
38
  And if `value` was falsish, it would have been equivalent to this
57
39
  ```tsx
58
- return <>content</>
40
+ return <>CONTENT</>
59
41
  ```
60
42
  If you are wrapping the content with a context provider you need to set the `unrecycled` attribute to `true` to run again the whole content, otherwise the `Owner` of the content won't be child of the template one
61
43
  ```tsx
@@ -72,7 +54,7 @@ The following code
72
54
  ```tsx
73
55
  return <>
74
56
  <Nest each={[ "red", "green", "blue" ]} template={(c, x) => <div style={{ background: x, padding: "1ch" }}>{c()}</div>}>
75
- content
57
+ CONTENT
76
58
  </Nest>
77
59
  </>
78
60
  ```
@@ -82,13 +64,42 @@ return <>
82
64
  <div style={{ background: "red", padding: "1ch" }}>
83
65
  <div style={{ background: "green", padding: "1ch" }}>
84
66
  <div style={{ background: "blue", padding: "1ch" }}>
85
- content
67
+ CONTENT
86
68
  </div>
87
69
  </div>
88
70
  </div>
89
71
  </>
90
72
  ```
91
73
 
74
+ ### `On` - `Case`
75
+ Allows you to not repeat the same condition across many `Match` components.
76
+ The following code
77
+ ```tsx
78
+ const value = 1;
79
+ return <>
80
+ <Switch>
81
+ <On value={value}>
82
+ <Case value={1}>One</Case>
83
+ <Case value={2}>Two</Case>
84
+ <Case pred={x => `${x}`.length === 3}>Long</Case>
85
+ </On>
86
+ <Match when>Default</Match>
87
+ </Switch>
88
+ </>
89
+ ```
90
+ Is equivalent to this
91
+ ```tsx
92
+ const value = 1;
93
+ return <>
94
+ <Switch>
95
+ <Match when={value === 1}>One</Match>
96
+ <Match when={value === 2}>Two</Match>
97
+ <Match when={`${value}`.length === 3}>Long</Match>
98
+ <Match when>Default</Match>
99
+ </Switch>
100
+ </>
101
+ ```
102
+
92
103
  ### `createExtractor()`
93
104
  Creates a context for components that may need to be out of their parent in certain conditions.
94
105
  If you have this component
@@ -162,6 +173,14 @@ Notice that you can use a `Source` component without adding it to the DOM:
162
173
  </myCustomExtractor.Source>
163
174
  return <>Something else</>
164
175
  ```
176
+ When something gets moved from a `Source` to a `Dest`, it will inherit contexts from its destination, UNLESS you use the `sameContext` attribute
177
+ ```tsx
178
+ return <>
179
+ <myCustomExtractor.Source sameContext>
180
+ ...
181
+ </myCustomExtractor.Source>
182
+ </>
183
+ ```
165
184
 
166
185
  ## Utility
167
186