@solidjs/universal 2.0.0-experimental.0 → 2.0.0-experimental.1
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/dev.js +27 -54
- package/dist/universal.js +27 -54
- package/package.json +3 -3
package/dist/dev.js
CHANGED
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createRoot,
|
|
3
|
-
merge,
|
|
4
|
-
createRenderEffect,
|
|
5
|
-
createMemo,
|
|
6
|
-
createComponent,
|
|
7
|
-
untrack,
|
|
8
|
-
flatten
|
|
9
|
-
} from "solid-js";
|
|
1
|
+
import { createRoot, merge, createRenderEffect, createMemo, createComponent, untrack, flatten } from 'solid-js';
|
|
10
2
|
|
|
11
3
|
function createRenderer({
|
|
12
4
|
createElement,
|
|
@@ -25,14 +17,9 @@ function createRenderer({
|
|
|
25
17
|
if (multi && !initial) initial = [];
|
|
26
18
|
if (typeof accessor !== "function") {
|
|
27
19
|
accessor = normalize(accessor, multi, true);
|
|
28
|
-
if (typeof accessor !== "function")
|
|
29
|
-
return insertExpression(parent, accessor, initial, marker);
|
|
20
|
+
if (typeof accessor !== "function") return insertExpression(parent, accessor, initial, marker);
|
|
30
21
|
}
|
|
31
|
-
createRenderEffect(
|
|
32
|
-
() => normalize(accessor, multi),
|
|
33
|
-
(value, current) => insertExpression(parent, value, current, marker),
|
|
34
|
-
initial
|
|
35
|
-
);
|
|
22
|
+
createRenderEffect(() => normalize(accessor, multi), (value, current) => insertExpression(parent, value, current, marker), initial);
|
|
36
23
|
}
|
|
37
24
|
function insertExpression(parent, value, current, marker) {
|
|
38
25
|
if (value === current) return;
|
|
@@ -58,7 +45,7 @@ function createRenderer({
|
|
|
58
45
|
} else if (current == null) {
|
|
59
46
|
appendNodes(parent, value);
|
|
60
47
|
} else {
|
|
61
|
-
reconcileArrays(parent,
|
|
48
|
+
reconcileArrays(parent, multi && current || [getFirstChild(parent)], value);
|
|
62
49
|
}
|
|
63
50
|
}
|
|
64
51
|
} else {
|
|
@@ -104,8 +91,7 @@ function createRenderer({
|
|
|
104
91
|
bEnd--;
|
|
105
92
|
}
|
|
106
93
|
if (aEnd === aStart) {
|
|
107
|
-
const node =
|
|
108
|
-
bEnd < bLength ? (bStart ? getNextSibling(b[bStart - 1]) : b[bEnd - bStart]) : after;
|
|
94
|
+
const node = bEnd < bLength ? bStart ? getNextSibling(b[bStart - 1]) : b[bEnd - bStart] : after;
|
|
109
95
|
while (bStart < bEnd) insertNode(parentNode, b[bStart++], node);
|
|
110
96
|
} else if (bEnd === bStart) {
|
|
111
97
|
while (aStart < aEnd) {
|
|
@@ -145,7 +131,7 @@ function createRenderer({
|
|
|
145
131
|
function cleanChildren(parent, current, marker, replacement) {
|
|
146
132
|
if (marker === undefined) {
|
|
147
133
|
let removed;
|
|
148
|
-
while (
|
|
134
|
+
while (removed = getFirstChild(parent)) removeNode(parent, removed);
|
|
149
135
|
replacement && insertNode(parent, replacement);
|
|
150
136
|
return "";
|
|
151
137
|
}
|
|
@@ -155,11 +141,7 @@ function createRenderer({
|
|
|
155
141
|
const el = current[i];
|
|
156
142
|
if (replacement !== el) {
|
|
157
143
|
const isParent = getParentNode(el) === parent;
|
|
158
|
-
if (replacement && !inserted && !i)
|
|
159
|
-
isParent
|
|
160
|
-
? replaceNode(parent, replacement, el)
|
|
161
|
-
: insertNode(parent, replacement, marker);
|
|
162
|
-
else isParent && removeNode(parent, el);
|
|
144
|
+
if (replacement && !inserted && !i) isParent ? replaceNode(parent, replacement, el) : insertNode(parent, replacement, marker);else isParent && removeNode(parent, el);
|
|
163
145
|
} else inserted = true;
|
|
164
146
|
}
|
|
165
147
|
} else if (replacement) insertNode(parent, replacement, marker);
|
|
@@ -175,37 +157,28 @@ function createRenderer({
|
|
|
175
157
|
const prevProps = {};
|
|
176
158
|
props || (props = {});
|
|
177
159
|
if (!skipChildren) {
|
|
178
|
-
createRenderEffect(
|
|
179
|
-
(
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
prevProps.children = value;
|
|
183
|
-
}
|
|
184
|
-
);
|
|
160
|
+
createRenderEffect(() => normalize(props.children), value => {
|
|
161
|
+
insertExpression(node, value, prevProps.children);
|
|
162
|
+
prevProps.children = value;
|
|
163
|
+
});
|
|
185
164
|
}
|
|
186
|
-
createRenderEffect(
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
props => {
|
|
202
|
-
for (const prop in props) {
|
|
203
|
-
const value = props[prop];
|
|
204
|
-
setProperty(node, prop, value, prevProps[prop]);
|
|
205
|
-
prevProps[prop] = value;
|
|
206
|
-
}
|
|
165
|
+
createRenderEffect(() => props.ref && props.ref(node), () => ({}));
|
|
166
|
+
createRenderEffect(() => {
|
|
167
|
+
const newProps = {};
|
|
168
|
+
for (const prop in props) {
|
|
169
|
+
if (prop === "children" || prop === "ref") continue;
|
|
170
|
+
const value = props[prop];
|
|
171
|
+
if (value === prevProps[prop]) continue;
|
|
172
|
+
newProps[prop] = value;
|
|
173
|
+
}
|
|
174
|
+
return newProps;
|
|
175
|
+
}, props => {
|
|
176
|
+
for (const prop in props) {
|
|
177
|
+
const value = props[prop];
|
|
178
|
+
setProperty(node, prop, value, prevProps[prop]);
|
|
179
|
+
prevProps[prop] = value;
|
|
207
180
|
}
|
|
208
|
-
);
|
|
181
|
+
});
|
|
209
182
|
return prevProps;
|
|
210
183
|
}
|
|
211
184
|
return {
|
package/dist/universal.js
CHANGED
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createRoot,
|
|
3
|
-
merge,
|
|
4
|
-
createRenderEffect,
|
|
5
|
-
createMemo,
|
|
6
|
-
createComponent,
|
|
7
|
-
untrack,
|
|
8
|
-
flatten
|
|
9
|
-
} from "solid-js";
|
|
1
|
+
import { createRoot, merge, createRenderEffect, createMemo, createComponent, untrack, flatten } from 'solid-js';
|
|
10
2
|
|
|
11
3
|
function createRenderer({
|
|
12
4
|
createElement,
|
|
@@ -25,14 +17,9 @@ function createRenderer({
|
|
|
25
17
|
if (multi && !initial) initial = [];
|
|
26
18
|
if (typeof accessor !== "function") {
|
|
27
19
|
accessor = normalize(accessor, multi, true);
|
|
28
|
-
if (typeof accessor !== "function")
|
|
29
|
-
return insertExpression(parent, accessor, initial, marker);
|
|
20
|
+
if (typeof accessor !== "function") return insertExpression(parent, accessor, initial, marker);
|
|
30
21
|
}
|
|
31
|
-
createRenderEffect(
|
|
32
|
-
() => normalize(accessor, multi),
|
|
33
|
-
(value, current) => insertExpression(parent, value, current, marker),
|
|
34
|
-
initial
|
|
35
|
-
);
|
|
22
|
+
createRenderEffect(() => normalize(accessor, multi), (value, current) => insertExpression(parent, value, current, marker), initial);
|
|
36
23
|
}
|
|
37
24
|
function insertExpression(parent, value, current, marker) {
|
|
38
25
|
if (value === current) return;
|
|
@@ -58,7 +45,7 @@ function createRenderer({
|
|
|
58
45
|
} else if (current == null) {
|
|
59
46
|
appendNodes(parent, value);
|
|
60
47
|
} else {
|
|
61
|
-
reconcileArrays(parent,
|
|
48
|
+
reconcileArrays(parent, multi && current || [getFirstChild(parent)], value);
|
|
62
49
|
}
|
|
63
50
|
}
|
|
64
51
|
} else {
|
|
@@ -104,8 +91,7 @@ function createRenderer({
|
|
|
104
91
|
bEnd--;
|
|
105
92
|
}
|
|
106
93
|
if (aEnd === aStart) {
|
|
107
|
-
const node =
|
|
108
|
-
bEnd < bLength ? (bStart ? getNextSibling(b[bStart - 1]) : b[bEnd - bStart]) : after;
|
|
94
|
+
const node = bEnd < bLength ? bStart ? getNextSibling(b[bStart - 1]) : b[bEnd - bStart] : after;
|
|
109
95
|
while (bStart < bEnd) insertNode(parentNode, b[bStart++], node);
|
|
110
96
|
} else if (bEnd === bStart) {
|
|
111
97
|
while (aStart < aEnd) {
|
|
@@ -145,7 +131,7 @@ function createRenderer({
|
|
|
145
131
|
function cleanChildren(parent, current, marker, replacement) {
|
|
146
132
|
if (marker === undefined) {
|
|
147
133
|
let removed;
|
|
148
|
-
while (
|
|
134
|
+
while (removed = getFirstChild(parent)) removeNode(parent, removed);
|
|
149
135
|
replacement && insertNode(parent, replacement);
|
|
150
136
|
return "";
|
|
151
137
|
}
|
|
@@ -155,11 +141,7 @@ function createRenderer({
|
|
|
155
141
|
const el = current[i];
|
|
156
142
|
if (replacement !== el) {
|
|
157
143
|
const isParent = getParentNode(el) === parent;
|
|
158
|
-
if (replacement && !inserted && !i)
|
|
159
|
-
isParent
|
|
160
|
-
? replaceNode(parent, replacement, el)
|
|
161
|
-
: insertNode(parent, replacement, marker);
|
|
162
|
-
else isParent && removeNode(parent, el);
|
|
144
|
+
if (replacement && !inserted && !i) isParent ? replaceNode(parent, replacement, el) : insertNode(parent, replacement, marker);else isParent && removeNode(parent, el);
|
|
163
145
|
} else inserted = true;
|
|
164
146
|
}
|
|
165
147
|
} else if (replacement) insertNode(parent, replacement, marker);
|
|
@@ -175,37 +157,28 @@ function createRenderer({
|
|
|
175
157
|
const prevProps = {};
|
|
176
158
|
props || (props = {});
|
|
177
159
|
if (!skipChildren) {
|
|
178
|
-
createRenderEffect(
|
|
179
|
-
(
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
prevProps.children = value;
|
|
183
|
-
}
|
|
184
|
-
);
|
|
160
|
+
createRenderEffect(() => normalize(props.children), value => {
|
|
161
|
+
insertExpression(node, value, prevProps.children);
|
|
162
|
+
prevProps.children = value;
|
|
163
|
+
});
|
|
185
164
|
}
|
|
186
|
-
createRenderEffect(
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
props => {
|
|
202
|
-
for (const prop in props) {
|
|
203
|
-
const value = props[prop];
|
|
204
|
-
setProperty(node, prop, value, prevProps[prop]);
|
|
205
|
-
prevProps[prop] = value;
|
|
206
|
-
}
|
|
165
|
+
createRenderEffect(() => props.ref && props.ref(node), () => ({}));
|
|
166
|
+
createRenderEffect(() => {
|
|
167
|
+
const newProps = {};
|
|
168
|
+
for (const prop in props) {
|
|
169
|
+
if (prop === "children" || prop === "ref") continue;
|
|
170
|
+
const value = props[prop];
|
|
171
|
+
if (value === prevProps[prop]) continue;
|
|
172
|
+
newProps[prop] = value;
|
|
173
|
+
}
|
|
174
|
+
return newProps;
|
|
175
|
+
}, props => {
|
|
176
|
+
for (const prop in props) {
|
|
177
|
+
const value = props[prop];
|
|
178
|
+
setProperty(node, prop, value, prevProps[prop]);
|
|
179
|
+
prevProps[prop] = value;
|
|
207
180
|
}
|
|
208
|
-
);
|
|
181
|
+
});
|
|
209
182
|
return prevProps;
|
|
210
183
|
}
|
|
211
184
|
return {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solidjs/universal",
|
|
3
3
|
"description": "Solid's universal runtime for creating custom renderers",
|
|
4
|
-
"version": "2.0.0-experimental.
|
|
4
|
+
"version": "2.0.0-experimental.1",
|
|
5
5
|
"author": "Ryan Carniato",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://solidjs.com",
|
|
@@ -37,10 +37,10 @@
|
|
|
37
37
|
"./types/*": "./types/*"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
|
-
"solid-js": "^2.0.0-experimental.
|
|
40
|
+
"solid-js": "^2.0.0-experimental.1"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"solid-js": "2.0.0-experimental.
|
|
43
|
+
"solid-js": "2.0.0-experimental.1"
|
|
44
44
|
},
|
|
45
45
|
"scripts": {
|
|
46
46
|
"build": "npm-run-all -nl build:*",
|