@lightningtv/core
Advanced tools
Comparing version 2.2.0-beta.11 to 2.2.0-beta.12
import { createShader } from './lightningInit.js'; | ||
import { type BorderRadius, type BorderStyle, type StyleEffects, type AnimationSettings, type ElementText, type Styles, AddColorString } from './intrinsicTypes.js'; | ||
import { type BorderRadius, type BorderStyle, type StyleEffects, type AnimationSettings, type ElementText, type Styles, AddColorString, TextNode } from './intrinsicTypes.js'; | ||
import States, { type NodeStates } from './states.js'; | ||
@@ -27,3 +27,3 @@ import type { RendererMain, INode, INodeAnimateProps, INodeProps, LinearGradientEffectProps, IAnimationController, RadialGradientEffectProps, RadialProgressEffectProps, NodeFailedPayload, NodeLoadedPayload } from '@lightningjs/renderer'; | ||
bottom?: number; | ||
children: Array<ElementNode | ElementText>; | ||
children: Array<ElementNode | ElementText | TextNode>; | ||
debug?: boolean; | ||
@@ -105,3 +105,3 @@ flexGrow?: number; | ||
get hasChildren(): boolean; | ||
getChildById(id: string): ElementNode | ElementText | undefined; | ||
getChildById(id: string): ElementNode | ElementText | TextNode | undefined; | ||
searchChildrenById(id: string): ElementNode | undefined; | ||
@@ -108,0 +108,0 @@ set states(states: NodeStates); |
@@ -1,2 +0,2 @@ | ||
import { NodeType } from './nodeTypes.js'; | ||
import { isTextNode } from './utils.js'; | ||
export default function (node) { | ||
@@ -9,3 +9,3 @@ const children = []; | ||
// Filter empty text nodes which are place holders for <Show> and elements missing dimensions | ||
if (c._type === NodeType.Text || c.flexItem === false) { | ||
if (isTextNode(c) || c.flexItem === false) { | ||
continue; | ||
@@ -12,0 +12,0 @@ } |
@@ -54,2 +54,10 @@ import { type FadeOutEffectProps, type GlitchEffectProps, type GrayscaleEffectProps, type AnimationSettings as RendererAnimationSettings, type LinearGradientEffectProps, type RadialGradientEffectProps, type RadialProgressEffectProps, type ITextNodeProps } from '@lightningjs/renderer'; | ||
} | ||
export interface TextNode extends Object { | ||
id?: string; | ||
_type: 'textNode'; | ||
parent?: ElementText; | ||
states?: any; | ||
text: string; | ||
[key: string]: any; | ||
} | ||
export interface NodeProps extends RendererNode, Partial<NewOmit<CleanElementNode, 'children' | 'text' | 'lng' | 'rendered' | 'renderer' | 'preFlexwidth' | 'preFlexHeight'>> { | ||
@@ -56,0 +64,0 @@ states?: NodeStates; |
import { INode } from '@lightningjs/renderer'; | ||
import type { Styles, ElementText } from './intrinsicTypes.js'; | ||
import type { Styles, ElementText, TextNode } from './intrinsicTypes.js'; | ||
import { ElementNode } from './elementNode.js'; | ||
@@ -13,4 +13,5 @@ export declare function log(msg: string, node: ElementNode | ElementText, ...args: any[]): void; | ||
export declare function isElementNode(node: unknown): node is ElementNode; | ||
export declare function isTextNode(node: ElementNode | ElementText | TextNode): node is TextNode; | ||
export declare function keyExists(obj: Record<string, unknown>, keys: (string | number | symbol)[]): boolean; | ||
export declare function flattenStyles(obj: Styles | undefined | (Styles | undefined)[], result?: Styles): Styles; | ||
//# sourceMappingURL=utils.d.ts.map |
import { Config, isDev } from './config.js'; | ||
import { ElementNode } from './elementNode.js'; | ||
import { NodeType } from './nodeTypes.js'; | ||
function hasDebug(node) { | ||
@@ -35,2 +36,5 @@ return isObject(node) && node.debug; | ||
} | ||
export function isTextNode(node) { | ||
return node._type === NodeType.Text; | ||
} | ||
export function keyExists(obj, keys) { | ||
@@ -37,0 +41,0 @@ for (const key of keys) { |
{ | ||
"name": "@lightningtv/core", | ||
"version": "2.2.0-beta.11", | ||
"version": "2.2.0-beta.12", | ||
"description": "Lightning TV Core for Universal Renderers", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -11,2 +11,3 @@ import { renderer, createShader } from './lightningInit.js'; | ||
TextProps, | ||
TextNode, | ||
} from './intrinsicTypes.js'; | ||
@@ -197,3 +198,3 @@ import States, { type NodeStates } from './states.js'; | ||
bottom?: number; | ||
children: Array<ElementNode | ElementText>; | ||
children: Array<ElementNode | ElementText | TextNode>; | ||
debug?: boolean; | ||
@@ -200,0 +201,0 @@ flexGrow?: number; |
import { type ElementNode } from './elementNode.js'; | ||
import { NodeType } from './nodeTypes.js'; | ||
import { isTextNode } from './utils.js'; | ||
import { ElementText } from './intrinsicTypes.js'; | ||
export default function (node: ElementNode): boolean { | ||
const children = []; | ||
const children: ElementNode[] = []; | ||
let hasOrder = false; | ||
@@ -11,3 +12,3 @@ let growSize = 0; | ||
// Filter empty text nodes which are place holders for <Show> and elements missing dimensions | ||
if (c._type === NodeType.Text || c.flexItem === false) { | ||
if (isTextNode(c) || c.flexItem === false) { | ||
continue; | ||
@@ -24,3 +25,3 @@ } | ||
children.push(c); | ||
children.push(c as ElementNode); | ||
} | ||
@@ -27,0 +28,0 @@ |
@@ -100,2 +100,11 @@ import { | ||
export interface TextNode extends Object { | ||
id?: string; | ||
_type: 'textNode'; | ||
parent?: ElementText; | ||
states?: any; | ||
text: string; | ||
[key: string]: any; | ||
} | ||
export interface NodeProps | ||
@@ -102,0 +111,0 @@ extends RendererNode, |
import { INode } from '@lightningjs/renderer'; | ||
import { Config, isDev } from './config.js'; | ||
import type { Styles, ElementText } from './intrinsicTypes.js'; | ||
import type { Styles, ElementText, TextNode } from './intrinsicTypes.js'; | ||
import { ElementNode } from './elementNode.js'; | ||
import { NodeType } from './nodeTypes.js'; | ||
@@ -55,2 +56,8 @@ function hasDebug(node: any) { | ||
export function isTextNode( | ||
node: ElementNode | ElementText | TextNode, | ||
): node is TextNode { | ||
return node._type === NodeType.Text; | ||
} | ||
export function keyExists( | ||
@@ -57,0 +64,0 @@ obj: Record<string, unknown>, |
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
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
210021
3156