solid-ctrl-flow 3.0.0 → 4.0.0

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
@@ -9,7 +9,7 @@ import { splitProps } from 'solid-js';
9
9
  /** Like a {@link Match} but gets the value from the closest {@link On} ancestor */
10
10
  export declare function Case(props: ParentProps<{
11
11
  value: unknown;
12
- }>): JSX.Element;
12
+ }>): JSX;
13
13
 
14
14
  /**
15
15
  * Eventually wraps its content into a template if a certain condition is met.
@@ -60,19 +60,11 @@ export declare class Extractor {
60
60
  Dest: (props: {
61
61
  children?: JSX.Element;
62
62
  }) => JSX.Element;
63
- Source: (props: {
64
- order?: number | undefined;
65
- } & {
66
- children?: JSX.Element;
67
- } & {
68
- fallback?: JSX.Element;
69
- }) => JSX.Element;
63
+ Source: (props: Info) => JSX.Element;
70
64
  SameContextSource: (props: {
71
65
  order?: number | undefined;
72
66
  } & {
73
67
  children?: JSX.Element;
74
- } & {
75
- fallback?: JSX.Element;
76
68
  }) => JSX.Element;
77
69
  /**
78
70
  * Returns the number of destinations available for the current {@link Extractor}.
@@ -133,7 +125,7 @@ export declare function memoProps<T, K extends readonly (keyof T)[]>(obj: T, key
133
125
  export declare function On<T>(props: ParentProps<{
134
126
  value: T;
135
127
  onCompare?(a: unknown, b: T): boolean;
136
- }>): JSX.Element;
128
+ }>): JSX;
137
129
 
138
130
  /**
139
131
  * Ordered linked list that allows for:
package/dist/index.mjs CHANGED
@@ -123,6 +123,7 @@ class Extractor {
123
123
  name
124
124
  });
125
125
  }
126
+ ctx;
126
127
  Joint = Joint.bind(this);
127
128
  Dest = Dest.bind(this);
128
129
  Source = Source.bind(this);
@@ -165,7 +166,7 @@ function Dest(props) {
165
166
  function Source(props) {
166
167
  const state = useContext(this.ctx);
167
168
  if (!state)
168
- return createMemo(() => props.fallback);
169
+ return [];
169
170
  const {
170
171
  sources
171
172
  } = state;
@@ -187,14 +188,6 @@ function Source(props) {
187
188
  sources.add(node, COMPARATOR);
188
189
  state.force();
189
190
  }));
190
- return createComponent(Show, {
191
- get when() {
192
- return !state.destCount;
193
- },
194
- get children() {
195
- return props.fallback;
196
- }
197
- });
198
191
  }
199
192
  function SameContextSource(props) {
200
193
  const _self$ = this;
package/dist/index.umd.js CHANGED
@@ -126,6 +126,7 @@
126
126
  name
127
127
  });
128
128
  }
129
+ ctx;
129
130
  Joint = Joint.bind(this);
130
131
  Dest = Dest.bind(this);
131
132
  Source = Source.bind(this);
@@ -168,7 +169,7 @@
168
169
  function Source(props) {
169
170
  const state = solidJs.useContext(this.ctx);
170
171
  if (!state)
171
- return solidJs.createMemo(() => props.fallback);
172
+ return [];
172
173
  const {
173
174
  sources
174
175
  } = state;
@@ -190,14 +191,6 @@
190
191
  sources.add(node, COMPARATOR);
191
192
  state.force();
192
193
  }));
193
- return solidJs.createComponent(solidJs.Show, {
194
- get when() {
195
- return !state.destCount;
196
- },
197
- get children() {
198
- return props.fallback;
199
- }
200
- });
201
194
  }
202
195
  function SameContextSource(props) {
203
196
  const _self$ = this;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "solid-ctrl-flow",
3
- "version": "3.0.0",
3
+ "version": "4.0.0",
4
4
  "description": "Control flow components for solid-js",
5
5
  "author": "AFatNiBBa",
6
6
  "license": "ISC",
package/readMe.md CHANGED
@@ -96,8 +96,6 @@ return <>
96
96
  ```
97
97
  If a `Extractor.Dest` has no `Extractor.Source` to render (Or it isn't inside a `Extractor.Joint`), it will render whatever you pass inside the `children` attribute
98
98
  <br />
99
- If a `Extractor.Source` has no available `Extractor.Dest` (Or it isn't inside a `Extractor.Joint`), it will render whatever you pass inside the `fallback` attribute
100
- <br />
101
99
  Componets from different `Extractor`s don't "talk" to each other and there can be more than one source and destinations:
102
100
  ```tsx
103
101
  const a = new Extractor(), b = new Extractor(), c = new Extractor()
@@ -119,7 +117,7 @@ return <>
119
117
  <a.Dest />
120
118
  <b.Joint>
121
119
  {/* No source */}
122
- <b.Dest>fb1</b.Dest>
120
+ <b.Dest>fb</b.Dest>
123
121
  <c.Joint>
124
122
  3
125
123
  {/* Double destination */}
@@ -128,7 +126,7 @@ return <>
128
126
  <a.Source>
129
127
  5
130
128
  </a.Source>
131
- <c.Source fallback="fb2">
129
+ <c.Source>
132
130
  {/* No destination */}
133
131
  6
134
132
  </c.Source>
@@ -147,7 +145,7 @@ return <>
147
145
  </a.Joint>
148
146
  </>
149
147
  ```
150
- The output of this code is ***1***, ***5***, ~~fb1~~, 3, ***1***, ***5***, 4, ~~fb2~~, 0, 2, ***8***, 7, ***8***.
148
+ The output of this code is ***1***, ***5***, ~~fb~~, 3, ***1***, ***5***, 4, 0, 2, ***8***, 7, ***8***.
151
149
  <br />
152
150
  You can detect the number of destinations available for a given extractor through `Extractor.getDestCount()`
153
151
  ```tsx