@solidtv/solid 1.6.4 → 1.7.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/src/core/dom-renderer/domRenderer.d.ts +9 -7
- package/dist/src/core/dom-renderer/domRenderer.js +10 -9
- package/dist/src/core/dom-renderer/domRenderer.js.map +1 -1
- package/dist/src/core/dom-renderer/domRendererTypes.d.ts +8 -9
- package/dist/src/core/dom-renderer/domRendererUtils.d.ts +3 -8
- package/dist/src/core/dom-renderer/domRendererUtils.js +12 -22
- package/dist/src/core/dom-renderer/domRendererUtils.js.map +1 -1
- package/dist/src/core/elementNode.d.ts +4 -4
- package/dist/src/core/elementNode.js +67 -19
- package/dist/src/core/elementNode.js.map +1 -1
- package/dist/src/core/flex.js +2 -1
- package/dist/src/core/flex.js.map +1 -1
- package/dist/src/core/focusManager.js +130 -96
- package/dist/src/core/focusManager.js.map +1 -1
- package/dist/src/core/index.d.ts +3 -0
- package/dist/src/core/index.js +2 -0
- package/dist/src/core/index.js.map +1 -1
- package/dist/src/core/intrinsicTypes.d.ts +5 -2
- package/dist/src/core/lightningInit.d.ts +2 -2
- package/dist/src/core/lightningInit.js +6 -29
- package/dist/src/core/lightningInit.js.map +1 -1
- package/dist/src/core/shaders.d.ts +1 -1
- package/dist/src/core/states.js +20 -4
- package/dist/src/core/states.js.map +1 -1
- package/dist/src/primitives/FPSCounter.jsx +3 -3
- package/dist/src/primitives/FPSCounter.jsx.map +1 -1
- package/dist/src/primitives/Image.jsx +2 -10
- package/dist/src/primitives/Image.jsx.map +1 -1
- package/dist/src/primitives/createFocusStack.d.ts +1 -1
- package/dist/src/primitives/createFocusStack.jsx +6 -2
- package/dist/src/primitives/createFocusStack.jsx.map +1 -1
- package/dist/src/render.d.ts +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +9 -4
- package/src/core/dom-renderer/domRenderer.ts +15 -12
- package/src/core/dom-renderer/domRendererTypes.ts +8 -9
- package/src/core/dom-renderer/domRendererUtils.ts +13 -24
- package/src/core/elementNode.ts +79 -31
- package/src/core/flex.ts +2 -1
- package/src/core/focusManager.ts +162 -132
- package/src/core/index.ts +4 -0
- package/src/core/intrinsicTypes.ts +10 -2
- package/src/core/lightningInit.ts +7 -31
- package/src/core/shaders.ts +1 -1
- package/src/core/states.ts +19 -4
- package/src/primitives/FPSCounter.tsx +4 -4
- package/src/primitives/Image.tsx +2 -9
- package/src/primitives/createFocusStack.tsx +6 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solidtv/solid",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0-0",
|
|
4
4
|
"description": "SolidTV",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
"sideEffects": false,
|
|
49
49
|
"scripts": {
|
|
50
50
|
"start": "pnpm run watch",
|
|
51
|
+
"bench": "node bench/run.mjs",
|
|
51
52
|
"test": "vitest",
|
|
52
53
|
"lint": "pnpm run lint:prettier && pnpm run lint:eslint",
|
|
53
54
|
"lint:fix": "pnpm run lint:fix:prettier && pnpm run lint:fix:eslint",
|
|
@@ -56,12 +57,13 @@
|
|
|
56
57
|
"lint:eslint": "eslint .",
|
|
57
58
|
"lint:fix:eslint": "eslint --fix .",
|
|
58
59
|
"build": "rm -rf dist && pnpm run tsc && cp jsx-runtime.d.ts dist/",
|
|
59
|
-
"tsc": "tsc",
|
|
60
|
+
"tsc": "tsc && tsc -p tests/tsconfig.contract.json",
|
|
60
61
|
"watch": "tsc -w",
|
|
61
62
|
"prepare": "husky",
|
|
62
63
|
"prepack": "pnpm run build",
|
|
63
64
|
"release": "release-it",
|
|
64
|
-
"test:browser": "vitest --config=vitest.browser.config.ts"
|
|
65
|
+
"test:browser": "vitest --config=vitest.browser.config.ts",
|
|
66
|
+
"test:webgl": "vitest run --config=vitest.webgl.config.ts"
|
|
65
67
|
},
|
|
66
68
|
"keywords": [
|
|
67
69
|
"lightning",
|
|
@@ -80,6 +82,7 @@
|
|
|
80
82
|
},
|
|
81
83
|
"devDependencies": {
|
|
82
84
|
"@eslint/js": "^9.39.4",
|
|
85
|
+
"@lightningtv/vite-hex-transform": "^1.1.0",
|
|
83
86
|
"@solid-devtools/debugger": "^0.28.1",
|
|
84
87
|
"@solidjs/testing-library": "^0.8.10",
|
|
85
88
|
"@typescript-eslint/eslint-plugin": "^8.59.2",
|
|
@@ -92,8 +95,10 @@
|
|
|
92
95
|
"husky": "^9.1.7",
|
|
93
96
|
"jsdom": "^26.1.0",
|
|
94
97
|
"lint-staged": "^17.0.4",
|
|
98
|
+
"playwright": "1.56.1",
|
|
95
99
|
"prettier": "^3.8.3",
|
|
96
100
|
"release-it": "^20.0.1",
|
|
101
|
+
"terser": "^5.51.2",
|
|
97
102
|
"typescript": "^6.0.3",
|
|
98
103
|
"typescript-eslint": "^8.59.2",
|
|
99
104
|
"vite": "^8.0.13",
|
|
@@ -109,7 +114,7 @@
|
|
|
109
114
|
},
|
|
110
115
|
"peerDependencies": {
|
|
111
116
|
"@solidjs/router": "^0.16.1",
|
|
112
|
-
"@solidtv/renderer": "^
|
|
117
|
+
"@solidtv/renderer": "^2.0.0-alpha.3",
|
|
113
118
|
"solid-js": "*"
|
|
114
119
|
},
|
|
115
120
|
"peerDependenciesMeta": {},
|
|
@@ -134,7 +134,7 @@ class AnimationController implements lng.IAnimationController {
|
|
|
134
134
|
|
|
135
135
|
constructor(
|
|
136
136
|
public node: DOMNode,
|
|
137
|
-
props: Partial<lng.
|
|
137
|
+
props: Partial<lng.AnimateProps>,
|
|
138
138
|
rawSettings: Partial<lng.AnimationSettings>,
|
|
139
139
|
) {
|
|
140
140
|
this.settings = {
|
|
@@ -143,6 +143,7 @@ class AnimationController implements lng.IAnimationController {
|
|
|
143
143
|
easing: rawSettings.easing ?? 'linear',
|
|
144
144
|
loop: rawSettings.loop ?? false,
|
|
145
145
|
repeat: rawSettings.repeat ?? 1,
|
|
146
|
+
repeatDelay: rawSettings.repeatDelay ?? 0,
|
|
146
147
|
stopMethod: false,
|
|
147
148
|
adaptiveDuration: rawSettings.adaptiveDuration ?? false,
|
|
148
149
|
};
|
|
@@ -214,7 +215,7 @@ class AnimationController implements lng.IAnimationController {
|
|
|
214
215
|
|
|
215
216
|
function animate(
|
|
216
217
|
this: DOMNode,
|
|
217
|
-
props: Partial<lng.
|
|
218
|
+
props: Partial<lng.AnimateProps>,
|
|
218
219
|
settings: Partial<lng.AnimationSettings>,
|
|
219
220
|
): lng.IAnimationController {
|
|
220
221
|
return new AnimationController(this, props, settings);
|
|
@@ -1302,7 +1303,6 @@ function resolveTextNodeDefaults(
|
|
|
1302
1303
|
return {
|
|
1303
1304
|
...resolveNodeDefaults(props),
|
|
1304
1305
|
text: props.text ?? '',
|
|
1305
|
-
textRendererOverride: props.textRendererOverride ?? null,
|
|
1306
1306
|
fontSize: props.fontSize ?? 16,
|
|
1307
1307
|
fontFamily: props.fontFamily ?? 'sans-serif',
|
|
1308
1308
|
fontStyle: props.fontStyle ?? 'normal',
|
|
@@ -1358,6 +1358,8 @@ export class DOMNode extends EventEmitter implements IRendererNode {
|
|
|
1358
1358
|
|
|
1359
1359
|
preventCleanup = true;
|
|
1360
1360
|
|
|
1361
|
+
destroyed = false;
|
|
1362
|
+
|
|
1361
1363
|
constructor(
|
|
1362
1364
|
public stage: IRendererStage,
|
|
1363
1365
|
public props: IRendererNodeProps,
|
|
@@ -1380,6 +1382,7 @@ export class DOMNode extends EventEmitter implements IRendererNode {
|
|
|
1380
1382
|
}
|
|
1381
1383
|
|
|
1382
1384
|
destroy(): void {
|
|
1385
|
+
this.markDestroyed();
|
|
1383
1386
|
elMap.delete(this);
|
|
1384
1387
|
const parent = this.props.parent;
|
|
1385
1388
|
if (parent instanceof DOMNode) {
|
|
@@ -1388,6 +1391,14 @@ export class DOMNode extends EventEmitter implements IRendererNode {
|
|
|
1388
1391
|
this.div.parentNode?.removeChild(this.div);
|
|
1389
1392
|
}
|
|
1390
1393
|
|
|
1394
|
+
// Like CoreNode, destroying a node marks its whole subtree destroyed.
|
|
1395
|
+
private markDestroyed() {
|
|
1396
|
+
this.destroyed = true;
|
|
1397
|
+
for (const child of this.children) {
|
|
1398
|
+
child.markDestroyed();
|
|
1399
|
+
}
|
|
1400
|
+
}
|
|
1401
|
+
|
|
1391
1402
|
get parent() {
|
|
1392
1403
|
return this.props.parent;
|
|
1393
1404
|
}
|
|
@@ -2009,13 +2020,6 @@ class DOMText extends DOMNode {
|
|
|
2009
2020
|
this.props.verticalAlign = v;
|
|
2010
2021
|
updateNodeStyles(this);
|
|
2011
2022
|
}
|
|
2012
|
-
get textRendererOverride() {
|
|
2013
|
-
return this.props.textRendererOverride;
|
|
2014
|
-
}
|
|
2015
|
-
set textRendererOverride(v) {
|
|
2016
|
-
this.props.textRendererOverride = v;
|
|
2017
|
-
updateNodeStyles(this);
|
|
2018
|
-
}
|
|
2019
2023
|
get offsetY() {
|
|
2020
2024
|
return this.props.offsetY;
|
|
2021
2025
|
}
|
|
@@ -2244,11 +2248,10 @@ export class DOMRendererMain implements IRendererMain {
|
|
|
2244
2248
|
): ReturnType<typeof lng.RendererMain.prototype.createShader> {
|
|
2245
2249
|
const [shaderType, props] = args;
|
|
2246
2250
|
return {
|
|
2247
|
-
// @ts-ignore
|
|
2248
2251
|
shaderType,
|
|
2249
2252
|
props,
|
|
2250
2253
|
program: {},
|
|
2251
|
-
}
|
|
2254
|
+
} as unknown as ReturnType<typeof lng.RendererMain.prototype.createShader>;
|
|
2252
2255
|
}
|
|
2253
2256
|
|
|
2254
2257
|
createTexture<Type extends keyof lng.TextureMap>(
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
/** Based on {@link lng.CoreRenderer} */
|
|
13
13
|
export interface IRendererCoreRenderer {
|
|
14
14
|
mode: 'canvas' | 'webgl' | undefined;
|
|
15
|
-
boundsMargin?: number;
|
|
15
|
+
boundsMargin?: number | [number, number, number, number];
|
|
16
16
|
}
|
|
17
17
|
/** Based on {@link lng.TrFontManager} */
|
|
18
18
|
export interface IRendererFontManager {
|
|
@@ -27,7 +27,7 @@ export interface IRendererStage {
|
|
|
27
27
|
registerAnimation: (anim: any) => void;
|
|
28
28
|
unregisterAnimation: (anim: any) => void;
|
|
29
29
|
};
|
|
30
|
-
loadFont: lng.
|
|
30
|
+
loadFont: lng.RendererMain['loadFont'];
|
|
31
31
|
reprocessUpdates?: (callback?: () => void) => void;
|
|
32
32
|
requestRender: () => void;
|
|
33
33
|
cleanup(full: boolean): void;
|
|
@@ -48,8 +48,8 @@ export type IRendererShaderProps = Partial<ShaderBorderPrefixedProps> &
|
|
|
48
48
|
Partial<ShaderRadialGradientProps> &
|
|
49
49
|
Partial<ShaderLinearGradientProps>;
|
|
50
50
|
|
|
51
|
-
/** Based on {@link lng.
|
|
52
|
-
export interface IRendererShader extends Partial<lng.
|
|
51
|
+
/** Based on {@link lng.ShaderNode} */
|
|
52
|
+
export interface IRendererShader extends Partial<lng.ShaderType> {
|
|
53
53
|
shaderType: IRendererShaderType;
|
|
54
54
|
props?: IRendererShaderProps;
|
|
55
55
|
program?: {};
|
|
@@ -75,7 +75,7 @@ export interface IRendererNodeShaded extends EventEmitter {
|
|
|
75
75
|
stage: IRendererStage;
|
|
76
76
|
id: number;
|
|
77
77
|
animate: (
|
|
78
|
-
props: Partial<lng.
|
|
78
|
+
props: Partial<lng.AnimateProps>,
|
|
79
79
|
settings: Partial<lng.AnimationSettings>,
|
|
80
80
|
) => lng.IAnimationController;
|
|
81
81
|
get absX(): number;
|
|
@@ -148,9 +148,8 @@ export interface DomRendererMainSettings {
|
|
|
148
148
|
* Preload margin around the viewport, in logical pixels (default: 200)
|
|
149
149
|
*
|
|
150
150
|
* @remarks
|
|
151
|
-
* A single number applied to all sides
|
|
152
|
-
*
|
|
153
|
-
* (the largest edge wins, with a warning) but should be replaced.
|
|
151
|
+
* A single number applied to all sides, or a per-side
|
|
152
|
+
* `[top, right, bottom, left]` tuple.
|
|
154
153
|
*/
|
|
155
|
-
boundsMargin?: number;
|
|
154
|
+
boundsMargin?: number | [number, number, number, number];
|
|
156
155
|
}
|
|
@@ -222,30 +222,19 @@ export function nodeHasTextureSource(node: DOMNode): boolean {
|
|
|
222
222
|
}
|
|
223
223
|
|
|
224
224
|
/**
|
|
225
|
-
*
|
|
226
|
-
*
|
|
227
|
-
* @remarks
|
|
228
|
-
* The `[top, right, bottom, left]` array form was dropped in renderer 1.8. An
|
|
229
|
-
* untyped app upgrading from 1.7 can still pass it, so mirror the WebGL
|
|
230
|
-
* renderer and take the widest edge rather than letting the margin arithmetic
|
|
231
|
-
* go wrong.
|
|
225
|
+
* Normalize a `boundsMargin` value (scalar or per-side tuple) into a
|
|
226
|
+
* `[top, right, bottom, left]` tuple.
|
|
232
227
|
*/
|
|
233
228
|
export function normalizeBoundsMargin(
|
|
234
229
|
margin: number | number[] | null | undefined,
|
|
235
|
-
): number {
|
|
236
|
-
if (margin == null) return 0;
|
|
237
|
-
if (Array.isArray(margin) === false)
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
for (let i = 0; i < arr.length; i++) {
|
|
241
|
-
if (arr[i]! > max) {
|
|
242
|
-
max = arr[i]!;
|
|
243
|
-
}
|
|
230
|
+
): [number, number, number, number] {
|
|
231
|
+
if (margin == null) return [0, 0, 0, 0];
|
|
232
|
+
if (Array.isArray(margin) === false) {
|
|
233
|
+
const m = (margin as number) || 0;
|
|
234
|
+
return [m, m, m, m];
|
|
244
235
|
}
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
);
|
|
248
|
-
return max;
|
|
236
|
+
const arr = margin as number[];
|
|
237
|
+
return [arr[0] || 0, arr[1] || 0, arr[2] || 0, arr[3] || 0];
|
|
249
238
|
}
|
|
250
239
|
|
|
251
240
|
export function computeRenderStateForNode(
|
|
@@ -273,10 +262,10 @@ export function computeRenderStateForNode(
|
|
|
273
262
|
const right = left + width;
|
|
274
263
|
const bottom = top + height;
|
|
275
264
|
|
|
276
|
-
const expandedLeft = rootLeft - margin;
|
|
277
|
-
const expandedTop = rootTop - margin;
|
|
278
|
-
const expandedRight = rootRight + margin;
|
|
279
|
-
const expandedBottom = rootBottom + margin;
|
|
265
|
+
const expandedLeft = rootLeft - margin[3];
|
|
266
|
+
const expandedTop = rootTop - margin[0];
|
|
267
|
+
const expandedRight = rootRight + margin[1];
|
|
268
|
+
const expandedBottom = rootBottom + margin[2];
|
|
280
269
|
|
|
281
270
|
const intersectsBounds =
|
|
282
271
|
right >= expandedLeft &&
|
package/src/core/elementNode.ts
CHANGED
|
@@ -31,19 +31,17 @@ import {
|
|
|
31
31
|
isElementText,
|
|
32
32
|
logRenderTree,
|
|
33
33
|
isFunction,
|
|
34
|
-
spliceItem,
|
|
35
34
|
} from './utils.js';
|
|
36
35
|
import { isDev, SHADERS_ENABLED } from './env.js';
|
|
37
36
|
import { Config, isDomRendererActive } from './config.js';
|
|
38
37
|
import type {
|
|
39
38
|
RendererMain,
|
|
40
39
|
INode,
|
|
41
|
-
|
|
40
|
+
AnimateProps,
|
|
42
41
|
IAnimationController,
|
|
43
42
|
LinearGradientProps,
|
|
44
43
|
RadialGradientProps,
|
|
45
44
|
ShadowProps,
|
|
46
|
-
CoreShaderNode,
|
|
47
45
|
ITextNodeProps,
|
|
48
46
|
INodeProps,
|
|
49
47
|
} from '@solidtv/renderer';
|
|
@@ -143,6 +141,23 @@ function addToLayoutQueue(node: ElementNode) {
|
|
|
143
141
|
schedulePostMutation();
|
|
144
142
|
}
|
|
145
143
|
|
|
144
|
+
/**
|
|
145
|
+
* Removes the first `item` from `arr` in place, as `splice(index, 1)` did,
|
|
146
|
+
* without the array of removed items splice returns. Returns its index, or
|
|
147
|
+
* -1 when it is not there.
|
|
148
|
+
*/
|
|
149
|
+
function removeItem<T>(arr: T[], item: T): number {
|
|
150
|
+
const index = arr.indexOf(item);
|
|
151
|
+
if (index > -1) {
|
|
152
|
+
const last = arr.length - 1;
|
|
153
|
+
for (let i = index; i < last; i++) {
|
|
154
|
+
arr[i] = arr[i + 1]!;
|
|
155
|
+
}
|
|
156
|
+
arr.pop();
|
|
157
|
+
}
|
|
158
|
+
return index;
|
|
159
|
+
}
|
|
160
|
+
|
|
146
161
|
// Text-default template, built once on first use. Config.fontSettings is
|
|
147
162
|
// expected to be set at app startup and not change afterwards.
|
|
148
163
|
let _fontTemplate: Array<[string, any]> | undefined;
|
|
@@ -173,6 +188,22 @@ const EFFECT_SHADER_KEYS = [
|
|
|
173
188
|
'shadow',
|
|
174
189
|
] as const satisfies ReadonlyArray<keyof StyleEffects>;
|
|
175
190
|
|
|
191
|
+
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
192
|
+
|
|
193
|
+
// Handle individual border sides: transform width/w to bottom/left/right/top
|
|
194
|
+
const borderSideMap: Record<string, string> = {
|
|
195
|
+
borderBottom: 'bottom',
|
|
196
|
+
borderLeft: 'left',
|
|
197
|
+
borderRight: 'right',
|
|
198
|
+
borderTop: 'top',
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
// The shader prop each key of a style object writes, per style prefix
|
|
202
|
+
// (`border` + `width` → `border-w`, `borderTop` + `w` → `border-top`): built
|
|
203
|
+
// at a key's first write, so that a write builds no string.
|
|
204
|
+
const shaderPropNames: Record<string, Record<string, string> | undefined> =
|
|
205
|
+
Object.create(null);
|
|
206
|
+
|
|
176
207
|
const parseAndAssignShaderProps = (
|
|
177
208
|
prefix: string,
|
|
178
209
|
obj: Record<string, unknown>,
|
|
@@ -180,28 +211,33 @@ const parseAndAssignShaderProps = (
|
|
|
180
211
|
) => {
|
|
181
212
|
if (!obj) return;
|
|
182
213
|
|
|
183
|
-
// Handle individual border sides: transform width/w to bottom/left/right/top
|
|
184
|
-
const borderSideMap: Record<string, string> = {
|
|
185
|
-
borderBottom: 'bottom',
|
|
186
|
-
borderLeft: 'left',
|
|
187
|
-
borderRight: 'right',
|
|
188
|
-
borderTop: 'top',
|
|
189
|
-
};
|
|
190
|
-
|
|
191
214
|
const side = borderSideMap[prefix];
|
|
192
215
|
const actualPrefix = side ? 'border' : prefix;
|
|
216
|
+
let names = shaderPropNames[prefix];
|
|
217
|
+
if (names === undefined) {
|
|
218
|
+
names = Object.create(null) as Record<string, string>;
|
|
219
|
+
shaderPropNames[prefix] = names;
|
|
220
|
+
}
|
|
193
221
|
|
|
194
222
|
props[actualPrefix] = obj;
|
|
195
|
-
Object.entries
|
|
196
|
-
|
|
223
|
+
// The object's own enumerable keys in order, as Object.entries gave them,
|
|
224
|
+
// without its arrays and closure.
|
|
225
|
+
for (const key in obj) {
|
|
226
|
+
if (!hasOwnProperty.call(obj, key)) continue;
|
|
227
|
+
let name = names[key];
|
|
228
|
+
if (name === undefined) {
|
|
229
|
+
let transformedKey = key === 'width' ? 'w' : key;
|
|
230
|
+
|
|
231
|
+
// If border side and key is width/w, transform to side (bottom/left/right/top)
|
|
232
|
+
if (side && transformedKey === 'w') {
|
|
233
|
+
transformedKey = side;
|
|
234
|
+
}
|
|
197
235
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
transformedKey = side;
|
|
236
|
+
name = actualPrefix + '-' + transformedKey;
|
|
237
|
+
names[key] = name;
|
|
201
238
|
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
});
|
|
239
|
+
props[name] = obj[key];
|
|
240
|
+
}
|
|
205
241
|
};
|
|
206
242
|
|
|
207
243
|
export function convertToShader(
|
|
@@ -211,7 +247,10 @@ export function convertToShader(
|
|
|
211
247
|
let type = 'rounded';
|
|
212
248
|
if (v.border) type += 'WithBorder';
|
|
213
249
|
if (v.shadow) type += 'WithShadow';
|
|
214
|
-
return renderer.createShader(
|
|
250
|
+
return renderer.createShader(
|
|
251
|
+
type,
|
|
252
|
+
v as Record<string, unknown>,
|
|
253
|
+
) as IRendererShader;
|
|
215
254
|
}
|
|
216
255
|
|
|
217
256
|
function getPropertyAlias(name: string) {
|
|
@@ -322,7 +361,7 @@ export interface ElementNode extends RendererNode, FocusNode {
|
|
|
322
361
|
_queueDelete?: number;
|
|
323
362
|
_animationQueue?:
|
|
324
363
|
| Array<{
|
|
325
|
-
props: Partial<
|
|
364
|
+
props: Partial<AnimateProps>;
|
|
326
365
|
animationSettings?: AnimationSettings;
|
|
327
366
|
}>
|
|
328
367
|
| undefined;
|
|
@@ -955,8 +994,16 @@ export class ElementNode {
|
|
|
955
994
|
if (beforeNode) {
|
|
956
995
|
// SolidJS can move nodes around in the children array.
|
|
957
996
|
// We need to insert following DOM insertBefore which moves elements.
|
|
958
|
-
|
|
959
|
-
|
|
997
|
+
const children = this.children;
|
|
998
|
+
removeItem(children, node as ElementNode);
|
|
999
|
+
const index = children.indexOf(beforeNode as ElementNode);
|
|
1000
|
+
if (index > -1) {
|
|
1001
|
+
// In front of beforeNode, the rest moved up one: splice(index, 0,
|
|
1002
|
+
// node) without its argument list and result array.
|
|
1003
|
+
for (let i = children.length; i > index; i--) {
|
|
1004
|
+
children[i] = children[i - 1]!;
|
|
1005
|
+
}
|
|
1006
|
+
children[index] = node as ElementNode;
|
|
960
1007
|
return;
|
|
961
1008
|
}
|
|
962
1009
|
}
|
|
@@ -965,7 +1012,7 @@ export class ElementNode {
|
|
|
965
1012
|
}
|
|
966
1013
|
|
|
967
1014
|
removeChild(node: ElementNode | ElementText | TextNode) {
|
|
968
|
-
if (
|
|
1015
|
+
if (removeItem(this.children, node as ElementNode) > -1) {
|
|
969
1016
|
if (isElementNode(node) && node.onRemove) {
|
|
970
1017
|
node.onRemove.call(node, node);
|
|
971
1018
|
}
|
|
@@ -1057,7 +1104,7 @@ export class ElementNode {
|
|
|
1057
1104
|
}
|
|
1058
1105
|
|
|
1059
1106
|
animate(
|
|
1060
|
-
props: Partial<
|
|
1107
|
+
props: Partial<AnimateProps>,
|
|
1061
1108
|
animationSettings?: AnimationSettings,
|
|
1062
1109
|
): IAnimationController {
|
|
1063
1110
|
if (!this.rendered) {
|
|
@@ -1070,10 +1117,7 @@ export class ElementNode {
|
|
|
1070
1117
|
);
|
|
1071
1118
|
}
|
|
1072
1119
|
|
|
1073
|
-
chain(
|
|
1074
|
-
props: Partial<INodeAnimateProps<CoreShaderNode>>,
|
|
1075
|
-
animationSettings?: AnimationSettings,
|
|
1076
|
-
) {
|
|
1120
|
+
chain(props: Partial<AnimateProps>, animationSettings?: AnimationSettings) {
|
|
1077
1121
|
if (this._animationRunning) {
|
|
1078
1122
|
this._animationQueue = [];
|
|
1079
1123
|
this._animationRunning = false;
|
|
@@ -1714,7 +1758,7 @@ export class ElementNode {
|
|
|
1714
1758
|
if (isDev) log('Rendering: ', this, props);
|
|
1715
1759
|
|
|
1716
1760
|
node.lng = renderer.createNode(
|
|
1717
|
-
props as Partial<INodeProps
|
|
1761
|
+
props as Partial<INodeProps> & Partial<IRendererNodeProps>,
|
|
1718
1762
|
);
|
|
1719
1763
|
|
|
1720
1764
|
if (node._hasRenderedChildren) {
|
|
@@ -1742,7 +1786,11 @@ export class ElementNode {
|
|
|
1742
1786
|
this.onRender?.(this);
|
|
1743
1787
|
|
|
1744
1788
|
if (node.onEvent) {
|
|
1745
|
-
|
|
1789
|
+
const onEvent = node.onEvent;
|
|
1790
|
+
// Own enumerable keys in order, as Object.entries gave them.
|
|
1791
|
+
for (const name in onEvent) {
|
|
1792
|
+
if (!hasOwnProperty.call(onEvent, name)) continue;
|
|
1793
|
+
const handler = onEvent[name as keyof OnEvent]!;
|
|
1746
1794
|
if (typeof node.lng.on === 'function') {
|
|
1747
1795
|
node.lng.on(name, (_inode, data) => handler.call(node, node, data));
|
|
1748
1796
|
}
|
package/src/core/flex.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type ElementNode } from './elementNode.js';
|
|
2
2
|
import { isTextNode, isElementText } from './utils.js';
|
|
3
|
+
import { isDev } from './env.js';
|
|
3
4
|
|
|
4
5
|
export default function (node: ElementNode): boolean {
|
|
5
6
|
const direction = node.flexDirection || 'row';
|
|
@@ -154,7 +155,7 @@ export default function (node: ElementNode): boolean {
|
|
|
154
155
|
node._containsFlexGrow = node._containsFlexGrow ? null : true;
|
|
155
156
|
} else if (node._containsFlexGrow) {
|
|
156
157
|
node._containsFlexGrow = null;
|
|
157
|
-
} else {
|
|
158
|
+
} else if (isDev) {
|
|
158
159
|
// No positive space available for items to grow, or items overflow.
|
|
159
160
|
// flex-grow has no effect in this case.
|
|
160
161
|
console.warn(
|