@solidtv/solid 1.1.2 → 1.2.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.
Files changed (114) hide show
  1. package/dist/src/core/clickInspector.d.ts +1 -0
  2. package/dist/src/core/clickInspector.js +69 -0
  3. package/dist/src/core/clickInspector.js.map +1 -0
  4. package/dist/src/core/config.d.ts +8 -14
  5. package/dist/src/core/config.js +17 -3
  6. package/dist/src/core/config.js.map +1 -1
  7. package/dist/src/core/dom-renderer/domRenderer.d.ts +6 -1
  8. package/dist/src/core/dom-renderer/domRenderer.js +255 -67
  9. package/dist/src/core/dom-renderer/domRenderer.js.map +1 -1
  10. package/dist/src/core/dom-renderer/domRendererUtils.js +2 -2
  11. package/dist/src/core/dom-renderer/domRendererUtils.js.map +1 -1
  12. package/dist/src/core/elementNode.d.ts +30 -11
  13. package/dist/src/core/elementNode.js +113 -58
  14. package/dist/src/core/elementNode.js.map +1 -1
  15. package/dist/src/core/focusManager.d.ts +3 -9
  16. package/dist/src/core/focusManager.js +111 -101
  17. package/dist/src/core/focusManager.js.map +1 -1
  18. package/dist/src/core/intrinsicTypes.d.ts +2 -0
  19. package/dist/src/core/lightningInit.d.ts +1 -1
  20. package/dist/src/core/lightningInit.js +9 -9
  21. package/dist/src/core/lightningInit.js.map +1 -1
  22. package/dist/src/core/shaders.js +10 -10
  23. package/dist/src/core/shaders.js.map +1 -1
  24. package/dist/src/core/utils.d.ts +0 -1
  25. package/dist/src/core/utils.js +4 -5
  26. package/dist/src/core/utils.js.map +1 -1
  27. package/dist/src/index.d.ts +1 -1
  28. package/dist/src/index.js +1 -1
  29. package/dist/src/index.js.map +1 -1
  30. package/dist/src/primitives/FPSCounter.jsx +5 -5
  31. package/dist/src/primitives/FPSCounter.jsx.map +1 -1
  32. package/dist/src/primitives/Image.jsx +6 -1
  33. package/dist/src/primitives/Image.jsx.map +1 -1
  34. package/dist/src/primitives/KeepAlive.jsx +13 -3
  35. package/dist/src/primitives/KeepAlive.jsx.map +1 -1
  36. package/dist/src/primitives/LazyImport.js +4 -2
  37. package/dist/src/primitives/LazyImport.js.map +1 -1
  38. package/dist/src/primitives/Preserve.jsx +10 -4
  39. package/dist/src/primitives/Preserve.jsx.map +1 -1
  40. package/dist/src/primitives/Suspense.jsx +7 -7
  41. package/dist/src/primitives/Suspense.jsx.map +1 -1
  42. package/dist/src/primitives/Virtual.jsx.map +1 -1
  43. package/dist/src/primitives/announcer/announcer.js +3 -2
  44. package/dist/src/primitives/announcer/announcer.js.map +1 -1
  45. package/dist/src/primitives/announcer/speech.js +2 -2
  46. package/dist/src/primitives/announcer/speech.js.map +1 -1
  47. package/dist/src/primitives/borderBox.jsx +2 -1
  48. package/dist/src/primitives/borderBox.jsx.map +1 -1
  49. package/dist/src/primitives/createTag.jsx +3 -3
  50. package/dist/src/primitives/createTag.jsx.map +1 -1
  51. package/dist/src/primitives/portal.jsx +4 -3
  52. package/dist/src/primitives/portal.jsx.map +1 -1
  53. package/dist/src/primitives/useFocusManager.d.ts +1 -5
  54. package/dist/src/primitives/useFocusManager.js +1 -20
  55. package/dist/src/primitives/useFocusManager.js.map +1 -1
  56. package/dist/src/primitives/useMouse.js +4 -4
  57. package/dist/src/primitives/useMouse.js.map +1 -1
  58. package/dist/src/primitives/utils/chainFunctions.js +35 -9
  59. package/dist/src/primitives/utils/chainFunctions.js.map +1 -1
  60. package/dist/src/primitives/utils/createBlurredImage.js +57 -37
  61. package/dist/src/primitives/utils/createBlurredImage.js.map +1 -1
  62. package/dist/src/primitives/utils/handleNavigation.js +8 -6
  63. package/dist/src/primitives/utils/handleNavigation.js.map +1 -1
  64. package/dist/src/primitives/utils/withScrolling.js +1 -3
  65. package/dist/src/primitives/utils/withScrolling.js.map +1 -1
  66. package/dist/src/render.d.ts +1 -1
  67. package/dist/src/render.js +3 -4
  68. package/dist/src/render.js.map +1 -1
  69. package/dist/src/solidOpts.d.ts +1 -1
  70. package/dist/src/solidOpts.js +8 -25
  71. package/dist/src/solidOpts.js.map +1 -1
  72. package/dist/src/utils.js +10 -5
  73. package/dist/src/utils.js.map +1 -1
  74. package/dist/tsconfig.tsbuildinfo +1 -1
  75. package/docs/README.md +2 -2
  76. package/package.json +28 -29
  77. package/src/core/clickInspector.ts +77 -0
  78. package/src/core/config.ts +15 -22
  79. package/src/core/dom-renderer/domRenderer.ts +308 -89
  80. package/src/core/dom-renderer/domRendererTypes.ts +9 -6
  81. package/src/core/dom-renderer/domRendererUtils.ts +2 -2
  82. package/src/core/elementNode.ts +145 -66
  83. package/src/core/focusManager.ts +171 -145
  84. package/src/core/intrinsicTypes.ts +19 -7
  85. package/src/core/lightningInit.ts +23 -21
  86. package/src/core/shaders.ts +10 -10
  87. package/src/core/utils.ts +4 -7
  88. package/src/index.ts +1 -1
  89. package/src/primitives/FPSCounter.tsx +14 -10
  90. package/src/primitives/Image.tsx +18 -9
  91. package/src/primitives/KeepAlive.tsx +18 -10
  92. package/src/primitives/LazyImport.ts +8 -6
  93. package/src/primitives/Preserve.tsx +13 -8
  94. package/src/primitives/Suspense.tsx +10 -9
  95. package/src/primitives/Virtual.tsx +1 -8
  96. package/src/primitives/announcer/announcer.ts +3 -2
  97. package/src/primitives/announcer/speech.ts +2 -2
  98. package/src/primitives/borderBox.tsx +7 -3
  99. package/src/primitives/createTag.tsx +23 -17
  100. package/src/primitives/portal.tsx +20 -10
  101. package/src/primitives/useFocusManager.ts +5 -44
  102. package/src/primitives/useMouse.ts +4 -4
  103. package/src/primitives/utils/chainFunctions.ts +31 -11
  104. package/src/primitives/utils/createBlurredImage.ts +58 -40
  105. package/src/primitives/utils/handleNavigation.ts +9 -7
  106. package/src/primitives/utils/withScrolling.ts +3 -5
  107. package/src/render.ts +5 -7
  108. package/src/solidOpts.ts +11 -30
  109. package/src/types.ts +0 -1
  110. package/src/utils.ts +12 -10
  111. package/dist/src/activeElement.d.ts +0 -2
  112. package/dist/src/activeElement.js +0 -3
  113. package/dist/src/activeElement.js.map +0 -1
  114. package/src/activeElement.ts +0 -5
@@ -6,6 +6,8 @@ import {
6
6
  type AnimationSettings,
7
7
  type ElementText,
8
8
  type Styles,
9
+ type AnimationEvents,
10
+ type AnimationEventHandler,
9
11
  AddColorString,
10
12
  TextProps,
11
13
  type OnEvent,
@@ -17,13 +19,12 @@ import States, { type NodeStates } from './states.js';
17
19
  import calculateFlexOld from './flex.js';
18
20
  import calculateFlexNew from './flexLayout.js';
19
21
 
20
- const calculateFlex = (import.meta as any).env?.VITE_USE_NEW_FLEX
22
+ const calculateFlex = import.meta.env?.VITE_USE_NEW_FLEX
21
23
  ? calculateFlexNew
22
24
  : calculateFlexOld;
23
25
  import {
24
26
  log,
25
27
  isArray,
26
- isFunc,
27
28
  keyExists,
28
29
  isINode,
29
30
  isElementNode,
@@ -32,7 +33,12 @@ import {
32
33
  isFunction,
33
34
  spliceItem,
34
35
  } from './utils.js';
35
- import { Config, DOM_RENDERING, isDev, SHADERS_ENABLED } from './config.js';
36
+ import {
37
+ Config,
38
+ isDev,
39
+ SHADERS_ENABLED,
40
+ isDomRendererActive,
41
+ } from './config.js';
36
42
  import type {
37
43
  RendererMain,
38
44
  INode,
@@ -52,6 +58,7 @@ import {
52
58
  setActiveElement,
53
59
  FocusNode,
54
60
  } from './focusManager.js';
61
+ import { initClickInspector } from './clickInspector.js';
55
62
 
56
63
  import {
57
64
  IRendererNode,
@@ -75,9 +82,20 @@ let postMutationQueued = false;
75
82
  let nextActiveElement: ElementNode | null = null;
76
83
  let deferredFocusElement: ElementNode | null = null;
77
84
  const layoutQueue = new Set<ElementNode>();
78
- export const elementDeleteQueue: ElementNode[] = [];
85
+ const elementDeleteQueue: ElementNode[] = [];
86
+
87
+ export function enqueueDelete(node: ElementNode, n: number): void {
88
+ if (node._queueDelete === undefined) {
89
+ node._queueDelete = n;
90
+ if (elementDeleteQueue.push(node) === 1) {
91
+ schedulePostMutation();
92
+ }
93
+ } else {
94
+ node._queueDelete += n;
95
+ }
96
+ }
79
97
 
80
- export function schedulePostMutation() {
98
+ function schedulePostMutation() {
81
99
  if (postMutationQueued) return;
82
100
  postMutationQueued = true;
83
101
  if ('reprocessUpdates' in renderer.stage && renderer.stage.reprocessUpdates) {
@@ -92,7 +110,7 @@ function runPostMutation() {
92
110
  // Phase 1: delete-flush
93
111
  if (elementDeleteQueue.length > 0) {
94
112
  for (const el of elementDeleteQueue) {
95
- if (Number(el._queueDelete) < 0) {
113
+ if ((el._queueDelete ?? 0) < 0) {
96
114
  el.destroy();
97
115
  }
98
116
  el._queueDelete = undefined;
@@ -144,16 +162,25 @@ function buildFontTemplate() {
144
162
  _fontFamilyIdx = tpl.length;
145
163
  _fontFamilyWithWeight = `${fs.fontFamily}${fs.fontWeight || ''}`;
146
164
  }
147
- tpl.push([key, (fs as any)[key]]);
165
+ tpl.push([key, fs[key]]);
148
166
  }
149
167
  }
150
168
  _fontTemplate = tpl;
151
169
  }
152
170
 
171
+ const EFFECT_SHADER_KEYS = [
172
+ 'border',
173
+ 'borderTop',
174
+ 'borderRight',
175
+ 'borderBottom',
176
+ 'borderLeft',
177
+ 'shadow',
178
+ ] as const satisfies ReadonlyArray<keyof StyleEffects>;
179
+
153
180
  const parseAndAssignShaderProps = (
154
181
  prefix: string,
155
- obj: Record<string, any>,
156
- props: Record<string, any> = {},
182
+ obj: Record<string, unknown>,
183
+ props: Record<string, unknown> = {},
157
184
  ) => {
158
185
  if (!obj) return;
159
186
 
@@ -197,7 +224,7 @@ function getPropertyAlias(name: string) {
197
224
  return name;
198
225
  }
199
226
 
200
- export const LightningRendererNumberProps = [
227
+ const LightningRendererNumberProps = [
201
228
  'alpha',
202
229
  'color',
203
230
  'colorTop',
@@ -279,6 +306,8 @@ declare global {
279
306
  }
280
307
  }
281
308
 
309
+ initClickInspector();
310
+
282
311
  export type RendererNode = AddColorString<
283
312
  Partial<
284
313
  NewOmit<
@@ -287,13 +316,13 @@ export type RendererNode = AddColorString<
287
316
  >
288
317
  >
289
318
  >;
319
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
290
320
  export interface ElementNode extends RendererNode, FocusNode {
291
321
  [key: string]: unknown;
292
322
 
293
323
  // Properties
294
324
  /** @internal for managing series of insertions and deletions */
295
325
  _queueDelete?: number;
296
- preserve?: boolean;
297
326
  _animationQueue?:
298
327
  | Array<{
299
328
  props: Partial<INodeAnimateProps<CoreShaderNode>>;
@@ -672,7 +701,18 @@ export interface ElementNode extends RendererNode, FocusNode {
672
701
  | Record<string, AnimationSettings | undefined | true | false>
673
702
  | true
674
703
  | false;
675
-
704
+ /**
705
+ * Optional handlers for animation events.
706
+ *
707
+ * Available animation events:
708
+ * - 'animating': Fired when the animation starts.
709
+ * - 'stopped': Fired (via setTimeout for the animation duration) when the animation completes.
710
+ *
711
+ * Each event handler is optional and maps to a corresponding event.
712
+ *
713
+ * @see https://lightning-tv.github.io/solid/#/essentials/transitions?id=animation-callbacks
714
+ */
715
+ onAnimation?: Partial<Record<AnimationEvents, AnimationEventHandler>>;
676
716
  /** Optional handler for when the element is created and rendered.
677
717
  *
678
718
  * @see https://lightning-tv.github.io/solid/#/flow/ondestroy
@@ -684,7 +724,7 @@ export interface ElementNode extends RendererNode, FocusNode {
684
724
  *
685
725
  * @see https://lightning-tv.github.io/solid/#/flow/ondestroy
686
726
  */
687
- onDestroy?: (this: ElementNode, el: ElementNode) => Promise<any> | void;
727
+ onDestroy?: (this: ElementNode, el: ElementNode) => Promise<void> | void;
688
728
  /**
689
729
  * Optional handlers for when the element is rendered—after creation and when switching parents.
690
730
  *
@@ -737,6 +777,7 @@ export interface ElementNode extends RendererNode, FocusNode {
737
777
  stateOrder?: DollarString[];
738
778
  }
739
779
 
780
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
740
781
  export class ElementNode {
741
782
  constructor(name: string) {
742
783
  this._type = name === 'text' ? NodeType.TextNode : NodeType.Element;
@@ -788,6 +829,25 @@ export class ElementNode {
788
829
  return this.lng.shader;
789
830
  }
790
831
 
832
+ /**
833
+ * Commit a built shader-props target back to `this.lng.shader`. When the
834
+ * node is already rendered we either convert the props into a real shader
835
+ * (first time) or self-assign so the DOM renderer's setter reapplies style;
836
+ * pre-render we just attach the bag for the upcoming `render()`.
837
+ */
838
+ _writeShaderTarget(target: unknown) {
839
+ if (this.rendered) {
840
+ if (!this.lng.shader) {
841
+ this.lng.shader = Config.convertToShader(this, target as StyleEffects);
842
+ } else if (isDomRendererActive()) {
843
+ // eslint-disable-next-line no-self-assign -- lng.shader is a setter, force style update
844
+ this.lng.shader = this.lng.shader;
845
+ }
846
+ } else {
847
+ this.lng.shader = target;
848
+ }
849
+ }
850
+
791
851
  set effects(v: StyleEffects) {
792
852
  if (!SHADERS_ENABLED) return;
793
853
  let target = this.lng.shader || {};
@@ -796,27 +856,11 @@ export class ElementNode {
796
856
  }
797
857
  if (v.rounded) target.radius = v.rounded.radius;
798
858
  if (v.borderRadius) target.radius = v.borderRadius;
799
- if (v.border) parseAndAssignShaderProps('border', v.border, target);
800
- if (v.borderTop)
801
- parseAndAssignShaderProps('borderTop', v.borderTop, target);
802
- if (v.borderRight)
803
- parseAndAssignShaderProps('borderRight', v.borderRight, target);
804
- if (v.borderBottom)
805
- parseAndAssignShaderProps('borderBottom', v.borderBottom, target);
806
- if (v.borderLeft)
807
- parseAndAssignShaderProps('borderLeft', v.borderLeft, target);
808
- if (v.shadow) parseAndAssignShaderProps('shadow', v.shadow, target);
809
-
810
- if (this.rendered) {
811
- if (!this.lng.shader) {
812
- this.lng.shader = Config.convertToShader(this, target);
813
- } else if (DOM_RENDERING && Config.domRendererEnabled) {
814
- // eslint-disable-next-line no-self-assign -- lng.shader is a setter, force style update
815
- this.lng.shader = this.lng.shader;
816
- }
817
- } else {
818
- this.lng.shader = target;
859
+ for (const k of EFFECT_SHADER_KEYS) {
860
+ if (v[k]) parseAndAssignShaderProps(k, v[k], target);
819
861
  }
862
+
863
+ this._writeShaderTarget(target);
820
864
  }
821
865
 
822
866
  set id(id: string) {
@@ -871,7 +915,7 @@ export class ElementNode {
871
915
  (Config.fontWeightAlias &&
872
916
  (Config.fontWeightAlias[v as string] as number | string)) ??
873
917
  v;
874
- (this.lng as any).fontFamily =
918
+ (this.lng as ElementNode).fontFamily =
875
919
  `${this.fontFamily || Config.fontSettings?.fontFamily}${weight}`;
876
920
  }
877
921
 
@@ -881,7 +925,7 @@ export class ElementNode {
881
925
 
882
926
  set fontFamily(v) {
883
927
  this._fontFamily = v;
884
- (this.lng as any).fontFamily = v;
928
+ (this.lng as ElementNode).fontFamily = v;
885
929
  }
886
930
 
887
931
  get fontFamily() {
@@ -975,26 +1019,47 @@ export class ElementNode {
975
1019
  { [name]: value },
976
1020
  animationSettings,
977
1021
  );
1022
+ this._fireAnimationEvents(name, value, animationSettings);
978
1023
  return animationController.start();
979
1024
  }
980
1025
 
981
- return (this.lng as any).animateProp(
1026
+ const result = (this.lng as INode).animateProp(
982
1027
  name,
983
1028
  value,
984
1029
  animationSettings || this.animationSettings || {},
985
1030
  );
1031
+ this._fireAnimationEvents(name, value, animationSettings);
1032
+ return result;
986
1033
  }
987
1034
 
988
1035
  (this.lng[name as keyof (IRendererNode | INode)] as number | string) =
989
1036
  value;
990
1037
  }
991
1038
 
1039
+ _fireAnimationEvents(
1040
+ name: string,
1041
+ value: number,
1042
+ animationSettings?: AnimationSettings,
1043
+ ) {
1044
+ if (!this.onAnimation) return;
1045
+ const settings = animationSettings || this.animationSettings;
1046
+ const { animating, stopped } = this.onAnimation;
1047
+ if (animating) {
1048
+ animating.call(this, name, value);
1049
+ }
1050
+ if (stopped) {
1051
+ const total = (settings?.duration ?? 0) + (settings?.delay ?? 0);
1052
+ setTimeout(() => stopped.call(this, name, value), total);
1053
+ }
1054
+ }
1055
+
992
1056
  animate(
993
1057
  props: Partial<INodeAnimateProps<CoreShaderNode>>,
994
1058
  animationSettings?: AnimationSettings,
995
1059
  ): IAnimationController {
996
- isDev &&
1060
+ if (isDev) {
997
1061
  assertTruthy(this.rendered, 'Node must be rendered before animating');
1062
+ }
998
1063
  return (this.lng as IRendererNode).animate(
999
1064
  props,
1000
1065
  animationSettings || this.animationSettings || {},
@@ -1055,7 +1120,7 @@ export class ElementNode {
1055
1120
  if (this.rendered) {
1056
1121
  // can be 0
1057
1122
  if (this.forwardFocus !== undefined) {
1058
- if (isFunc(this.forwardFocus)) {
1123
+ if (isFunction(this.forwardFocus)) {
1059
1124
  if (this.forwardFocus.call(this, this) !== false) {
1060
1125
  return;
1061
1126
  }
@@ -1104,7 +1169,7 @@ export class ElementNode {
1104
1169
  // If onDestroy returns a promise, wait for it to resolve before destroying
1105
1170
  // Useful with animations waitUntilStopped method which returns promise
1106
1171
  if (destroyPromise instanceof Promise) {
1107
- destroyPromise.then(() => this._destroy());
1172
+ void destroyPromise.then(() => this._destroy());
1108
1173
  } else {
1109
1174
  this._destroy();
1110
1175
  }
@@ -1235,6 +1300,14 @@ export class ElementNode {
1235
1300
  return this.alpha === 0;
1236
1301
  }
1237
1302
 
1303
+ get preserve(): boolean {
1304
+ return this._queueDelete === 0;
1305
+ }
1306
+
1307
+ set preserve(v: boolean) {
1308
+ this._queueDelete = v ? 0 : undefined;
1309
+ }
1310
+
1238
1311
  /**
1239
1312
  * Sets the autofocus state of the element.
1240
1313
  * When set to a truthy value, the element will automatically gain focus.
@@ -1243,7 +1316,7 @@ export class ElementNode {
1243
1316
  * @param val - A value to determine if the element should autofocus.
1244
1317
  * A truthy value enables autofocus, otherwise disables it.
1245
1318
  */
1246
- set autofocus(val: any) {
1319
+ set autofocus(val: boolean | undefined) {
1247
1320
  this._autofocus = val;
1248
1321
  // Defer setFocus so children render first (forwardFocus needs them).
1249
1322
  // The post-mutation focus phase calls setFocus on this element.
@@ -1294,7 +1367,7 @@ export class ElementNode {
1294
1367
  return this._requiresLayout;
1295
1368
  }
1296
1369
 
1297
- set updateLayoutOn(v: any) {
1370
+ set updateLayoutOn(_v: unknown) {
1298
1371
  this.updateLayout();
1299
1372
  }
1300
1373
 
@@ -1304,7 +1377,7 @@ export class ElementNode {
1304
1377
 
1305
1378
  updateLayout() {
1306
1379
  if (this.hasChildren) {
1307
- isDev && log('Layout: ', this);
1380
+ if (isDev) log('Layout: ', this);
1308
1381
 
1309
1382
  if (this.display === 'flex' && this.flexGrow && this.width === 0) {
1310
1383
  return;
@@ -1313,7 +1386,7 @@ export class ElementNode {
1313
1386
  const flexChanged = this.display === 'flex' && calculateFlex(this);
1314
1387
  layoutQueue.delete(this);
1315
1388
  const onLayoutChanged =
1316
- isFunc(this.onLayout) && this.onLayout.call(this, this);
1389
+ isFunction(this.onLayout) && this.onLayout.call(this, this);
1317
1390
 
1318
1391
  if ((flexChanged || onLayoutChanged) && this.parent) {
1319
1392
  addToLayoutQueue(this.parent);
@@ -1325,7 +1398,7 @@ export class ElementNode {
1325
1398
  if (c.display === 'flex' && isElementNode(c)) {
1326
1399
  // calculating directly to prevent infinite loops recalculating parents
1327
1400
  calculateFlex(c);
1328
- isFunc(c.onLayout) && c.onLayout.call(c, c);
1401
+ isFunction(c.onLayout) && c.onLayout.call(c, c);
1329
1402
  addToLayoutQueue(this);
1330
1403
  }
1331
1404
  });
@@ -1334,7 +1407,18 @@ export class ElementNode {
1334
1407
  }
1335
1408
 
1336
1409
  _stateChanged() {
1337
- isDev && log('State Changed: ', this, this.states);
1410
+ if (isDev) log('State Changed: ', this, this.states);
1411
+
1412
+ if (isDev) {
1413
+ const div = (this.lng as IRendererNode)?.div;
1414
+ if (div) {
1415
+ if (this.states.length > 0) {
1416
+ div.dataset.states = this.states.join(' ');
1417
+ } else {
1418
+ delete div.dataset.states;
1419
+ }
1420
+ }
1421
+ }
1338
1422
 
1339
1423
  if (this.forwardStates) {
1340
1424
  // apply states to children first
@@ -1406,7 +1490,7 @@ export class ElementNode {
1406
1490
  this._undoStyles = Object.keys(newStyles);
1407
1491
  // Apply transition first
1408
1492
  if (newStyles.transition !== undefined) {
1409
- this.transition = newStyles.transition as Styles['transition'];
1493
+ this.transition = newStyles.transition;
1410
1494
  }
1411
1495
 
1412
1496
  // Apply the styles
@@ -1529,9 +1613,8 @@ export class ElementNode {
1529
1613
  textProps.maxHeight =
1530
1614
  parentHeight - textProps.y! - (textProps.marginBottom || 0);
1531
1615
  } else if (textProps.maxLines === 1) {
1532
- textProps.maxHeight = (textProps.maxHeight ||
1533
- textProps.lineHeight ||
1534
- textProps.fontSize) as number;
1616
+ textProps.maxHeight =
1617
+ textProps.maxHeight || textProps.lineHeight || textProps.fontSize;
1535
1618
  }
1536
1619
  // textProps.w = textProps.h = 0;
1537
1620
  }
@@ -1541,7 +1624,7 @@ export class ElementNode {
1541
1624
  props.shader = Config.convertToShader(node, props.shader);
1542
1625
  }
1543
1626
 
1544
- isDev && log('Rendering: ', this, props);
1627
+ if (isDev) log('Rendering: ', this, props);
1545
1628
 
1546
1629
  node.lng = renderer.createTextNode(
1547
1630
  props as Partial<ITextNodeProps> & Partial<IRendererTextNodeProps>,
@@ -1581,7 +1664,7 @@ export class ElementNode {
1581
1664
  props.shader = Config.convertToShader(node, props.shader);
1582
1665
  }
1583
1666
 
1584
- isDev && log('Rendering: ', this, props);
1667
+ if (isDev) log('Rendering: ', this, props);
1585
1668
 
1586
1669
  node.lng = renderer.createNode(
1587
1670
  props as Partial<INodeProps<any>> & Partial<IRendererNodeProps>,
@@ -1592,7 +1675,7 @@ export class ElementNode {
1592
1675
 
1593
1676
  for (const child of node.children) {
1594
1677
  if (isElementNode(child) && isINode(child.lng)) {
1595
- child.lng.parent = node.lng as any;
1678
+ child.lng.parent = node.lng as INode;
1596
1679
  }
1597
1680
  }
1598
1681
  }
@@ -1620,15 +1703,20 @@ export class ElementNode {
1620
1703
  }
1621
1704
 
1622
1705
  // L3 Inspector adds div to the lng object
1623
- const div: HTMLElement | undefined = (node.lng as any)?.div;
1624
- if (div) div.element = node;
1706
+ const div: HTMLElement | undefined = (node.lng as IRendererNode)?.div;
1707
+ if (isDev && div) {
1708
+ div.element = node;
1709
+ if (node._states && node._states.length > 0) {
1710
+ div.dataset.states = node._states.join(' ');
1711
+ }
1712
+ }
1625
1713
 
1626
1714
  if (node._type === NodeType.Element) {
1627
1715
  // only element nodes will have children that need rendering
1628
1716
  const numChildren = node.children.length;
1629
1717
  for (let i = 0; i < numChildren; i++) {
1630
1718
  const c = node.children[i];
1631
- isDev && assertTruthy(c, 'Child is undefined');
1719
+ if (isDev) assertTruthy(c, 'Child is undefined');
1632
1720
  // Text elements sneak in from Solid creating tracked nodes
1633
1721
  if (isElementNode(c)) {
1634
1722
  c.render();
@@ -1641,7 +1729,7 @@ export class ElementNode {
1641
1729
  schedulePostMutation();
1642
1730
  }
1643
1731
 
1644
- node._autofocus && node.setFocus();
1732
+ if (node._autofocus) node.setFocus();
1645
1733
  }
1646
1734
  }
1647
1735
 
@@ -1720,16 +1808,7 @@ export function shaderAccessor<T extends Record<string, any> | number>(
1720
1808
  parseAndAssignShaderProps(key, value, target);
1721
1809
  }
1722
1810
 
1723
- if (this.rendered) {
1724
- if (!this.lng.shader) {
1725
- this.lng.shader = Config.convertToShader(this, target);
1726
- } else if (DOM_RENDERING && Config.domRendererEnabled) {
1727
- // eslint-disable-next-line no-self-assign -- lng.shader is a setter, force style update
1728
- this.lng.shader = this.lng.shader;
1729
- }
1730
- } else {
1731
- this.lng.shader = target;
1732
- }
1811
+ this._writeShaderTarget(target);
1733
1812
 
1734
1813
  if (animationSettings) {
1735
1814
  this.animate({ shaderProps: target }, animationSettings).start();