@lightningtv/core
Advanced tools
Comparing version 1.5.0-rc3 to 1.5.0-rc4
@@ -89,4 +89,4 @@ import { createShader } from './lightningInit.js'; | ||
_stateChanged(): void; | ||
render(): void; | ||
render(topNode?: boolean): void; | ||
} | ||
//# sourceMappingURL=elementNode.d.ts.map |
@@ -127,2 +127,4 @@ import { renderer, createShader } from './lightningInit.js'; | ||
node.parent = this; | ||
this._containsTextNodes = | ||
this._containsTextNodes || node._type === NodeType.TextNode; | ||
if (beforeNode) { | ||
@@ -253,3 +255,5 @@ // SolidJS can move nodes around in the children array. | ||
_layoutOnLoad() { | ||
this.lng.on('loaded', () => this.parent.queueLayout()); | ||
this.lng.on('loaded', () => { | ||
this.parent.queueLayout(); | ||
}); | ||
} | ||
@@ -364,3 +368,4 @@ getText() { | ||
queueLayout = false; | ||
queueMicrotask(() => { | ||
// Use setTimeout to allow renderers microtasks to finish | ||
setTimeout(() => { | ||
queueLayout = true; | ||
@@ -370,7 +375,6 @@ const queue = [...layoutQueue]; | ||
for (let i = queue.length - 1; i >= 0; i--) { | ||
queue[i].updateLayout(); | ||
// After initial render we want to updateLayout right away in case nodes are added or destroyed | ||
queue[i]._containsTextNodes = null; | ||
const node = queue[i]; | ||
node.updateLayout(); | ||
} | ||
}); | ||
}, 0); | ||
} | ||
@@ -383,2 +387,3 @@ } | ||
if (isFunc(this.onBeforeLayout)) { | ||
console.warn('onBeforeLayout is deprecated'); | ||
changedLayout = this.onBeforeLayout.call(this, this) || false; | ||
@@ -432,3 +437,3 @@ } | ||
} | ||
render() { | ||
render(topNode) { | ||
// Elements are inserted from the inside out, then rendered from the outside in. | ||
@@ -451,3 +456,3 @@ // Render starts when an element is insertered with a parent that is already renderered. | ||
} | ||
if (parent.requiresLayout() && !parent._containsTextNodes) { | ||
if (topNode && parent.requiresLayout()) { | ||
parent.queueLayout(); | ||
@@ -505,5 +510,9 @@ } | ||
node.lng = renderer.createTextNode(props); | ||
parent._containsTextNodes = true; | ||
if (parent.requiresLayout() && (!props.width || !props.height)) { | ||
node._layoutOnLoad(); | ||
if (parent.requiresLayout()) { | ||
if (!props.width || !props.height) { | ||
node._layoutOnLoad(); | ||
} | ||
else { | ||
parent.queueLayout(); | ||
} | ||
} | ||
@@ -510,0 +519,0 @@ } |
@@ -9,3 +9,5 @@ export * from './elementNode.js'; | ||
export * from '@lightningjs/renderer'; | ||
export type * from '@lightningjs/renderer'; | ||
export * from '@lightningjs/renderer/utils'; | ||
export type * from '@lightningjs/renderer/utils'; | ||
//# sourceMappingURL=index.d.ts.map |
{ | ||
"name": "@lightningtv/core", | ||
"version": "1.5.0-rc3", | ||
"version": "1.5.0-rc4", | ||
"description": "Lightning TV Core for Universal Renderers", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -236,2 +236,5 @@ import { renderer, createShader } from './lightningInit.js'; | ||
node.parent = this; | ||
this._containsTextNodes = | ||
this._containsTextNodes || node._type === NodeType.TextNode; | ||
if (beforeNode) { | ||
@@ -398,3 +401,5 @@ // SolidJS can move nodes around in the children array. | ||
_layoutOnLoad() { | ||
(this.lng as INode).on('loaded', () => this.parent!.queueLayout()); | ||
(this.lng as INode).on('loaded', () => { | ||
this.parent!.queueLayout(); | ||
}); | ||
} | ||
@@ -534,3 +539,4 @@ | ||
queueLayout = false; | ||
queueMicrotask(() => { | ||
// Use setTimeout to allow renderers microtasks to finish | ||
setTimeout(() => { | ||
queueLayout = true; | ||
@@ -540,7 +546,6 @@ const queue = [...layoutQueue]; | ||
for (let i = queue.length - 1; i >= 0; i--) { | ||
queue[i]!.updateLayout(); | ||
// After initial render we want to updateLayout right away in case nodes are added or destroyed | ||
queue[i]!._containsTextNodes = null; | ||
const node = queue[i] as ElementNode; | ||
node.updateLayout(); | ||
} | ||
}); | ||
}, 0); | ||
} | ||
@@ -554,2 +559,3 @@ } | ||
if (isFunc(this.onBeforeLayout)) { | ||
console.warn('onBeforeLayout is deprecated'); | ||
changedLayout = this.onBeforeLayout.call(this, this) || false; | ||
@@ -614,3 +620,3 @@ } | ||
render() { | ||
render(topNode?: boolean) { | ||
// Elements are inserted from the inside out, then rendered from the outside in. | ||
@@ -637,3 +643,3 @@ // Render starts when an element is insertered with a parent that is already renderered. | ||
if (parent.requiresLayout() && !parent._containsTextNodes) { | ||
if (topNode && parent.requiresLayout()) { | ||
parent.queueLayout(); | ||
@@ -702,5 +708,8 @@ } | ||
node.lng = renderer.createTextNode(props as unknown as ITextNodeProps); | ||
parent._containsTextNodes = true; | ||
if (parent.requiresLayout() && (!props.width || !props.height)) { | ||
node._layoutOnLoad(); | ||
if (parent.requiresLayout()) { | ||
if (!props.width || !props.height) { | ||
node._layoutOnLoad(); | ||
} else { | ||
parent.queueLayout(); | ||
} | ||
} | ||
@@ -707,0 +716,0 @@ } else { |
@@ -9,2 +9,4 @@ export * from './elementNode.js'; | ||
export * from '@lightningjs/renderer'; | ||
export type * from '@lightningjs/renderer'; | ||
export * from '@lightningjs/renderer/utils'; | ||
export type * from '@lightningjs/renderer/utils'; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
219952
3232