@lightningjs/solid
Advanced tools
Comparing version 0.7.6 to 0.8.0
@@ -42,9 +42,7 @@ import { createSignal, createEffect, mergeProps as mergeProps$1, createRoot, createRenderEffect, createMemo, createComponent as createComponent$1, untrack } from 'solid-js'; | ||
function Text(props) { | ||
return (() => { | ||
const _el$ = createElement$1("text"); | ||
spread$1(_el$, props, false); | ||
return _el$; | ||
})(); | ||
} | ||
const Text = props => (() => { | ||
const _el$ = createElement$1("text"); | ||
spread$1(_el$, props, false); | ||
return _el$; | ||
})(); | ||
@@ -196,27 +194,2 @@ /* | ||
} | ||
// Commented out because it's not used anywhere and implementation seems wrong | ||
// get previousSibling() { | ||
// if (this._parent) { | ||
// const children = this._parent.children; | ||
// const index = children.indexOf(this) - 1; | ||
// if (index >= 0) { | ||
// return children[index]; | ||
// } | ||
// } | ||
// return null; | ||
// } | ||
// get nextSibling() { | ||
// if (this._parent) { | ||
// const children = this._parent.children; | ||
// const index = children.indexOf(this) + 1; | ||
// if (index < children.length) { | ||
// return children[index]; | ||
// } | ||
// } | ||
// return null; | ||
// } | ||
insert(node, beforeNode) { | ||
@@ -687,3 +660,3 @@ if (beforeNode) { | ||
assertTruthy(this.lng); | ||
this.lng.once('textLoaded', (_node, size) => { | ||
this.lng.once('loaded', (_node, size) => { | ||
this.width = size.width; | ||
@@ -838,3 +811,3 @@ this.height = size.height; | ||
if (isFunc(node.onLoad)) { | ||
node.lng.once('textLoaded', node.onLoad); | ||
node.lng.once('loaded', node.onLoad); | ||
} | ||
@@ -868,6 +841,6 @@ if (!node.width || !node.height) { | ||
if (node.onFail) { | ||
node.lng.once('txFailed', node.onFail); | ||
node.lng.once('failed', node.onFail); | ||
} | ||
if (node.onLoad) { | ||
node.lng.once('txLoaded', node.onLoad); | ||
node.lng.once('loaded', node.onLoad); | ||
} | ||
@@ -874,0 +847,0 @@ } |
@@ -17,4 +17,2 @@ /* | ||
*/ | ||
export function Text(props) { | ||
return <text {...props}></text>; | ||
} | ||
export const Text = (props) => <text {...props}></text>; |
@@ -33,23 +33,2 @@ /* | ||
} | ||
// Commented out because it's not used anywhere and implementation seems wrong | ||
// get previousSibling() { | ||
// if (this._parent) { | ||
// const children = this._parent.children; | ||
// const index = children.indexOf(this) - 1; | ||
// if (index >= 0) { | ||
// return children[index]; | ||
// } | ||
// } | ||
// return null; | ||
// } | ||
// get nextSibling() { | ||
// if (this._parent) { | ||
// const children = this._parent.children; | ||
// const index = children.indexOf(this) + 1; | ||
// if (index < children.length) { | ||
// return children[index]; | ||
// } | ||
// } | ||
// return null; | ||
// } | ||
insert(node, beforeNode) { | ||
@@ -56,0 +35,0 @@ if (beforeNode) { |
@@ -257,3 +257,3 @@ /* | ||
assertTruthy(this.lng); | ||
this.lng.once('textLoaded', (_node, size) => { | ||
this.lng.once('loaded', (_node, size) => { | ||
this.width = size.width; | ||
@@ -403,3 +403,3 @@ this.height = size.height; | ||
if (isFunc(node.onLoad)) { | ||
node.lng.once('textLoaded', node.onLoad); | ||
node.lng.once('loaded', node.onLoad); | ||
} | ||
@@ -434,6 +434,6 @@ if (!node.width || !node.height) { | ||
if (node.onFail) { | ||
node.lng.once('txFailed', node.onFail); | ||
node.lng.once('failed', node.onFail); | ||
} | ||
if (node.onLoad) { | ||
node.lng.once('txLoaded', node.onLoad); | ||
node.lng.once('loaded', node.onLoad); | ||
} | ||
@@ -440,0 +440,0 @@ } |
@@ -0,1 +1,2 @@ | ||
import { type JSX } from "solid-js"; | ||
import { type SolidRendererOptions } from '../core/renderer/index.js'; | ||
@@ -10,5 +11,5 @@ import { ElementNode } from "../core/node/index.js"; | ||
onFirstRender?: (callback: () => void) => void; | ||
children?: any; | ||
children?: JSX.Element; | ||
ref?: (el: ElementNode) => void; | ||
} | ||
export declare const Canvas: (props: CanvasProps) => import("solid-js").JSX.Element; | ||
export declare const Canvas: (props: CanvasProps) => JSX.Element; |
@@ -0,2 +1,3 @@ | ||
import { type Component } from "solid-js"; | ||
import type { IntrinsicTextProps } from "../intrinsicTypes.js"; | ||
export declare function Text(props: IntrinsicTextProps): import("solid-js").JSX.Element; | ||
export declare const Text: Component<IntrinsicTextProps>; |
import { createShader } from '../renderer/index.js'; | ||
import { type IntrinsicTextProps } from '../../index.js'; | ||
import { type IntrinsicNodeProps } from '../../index.js'; | ||
import Children from './children.js'; | ||
@@ -26,3 +26,3 @@ import States from './states.js'; | ||
export type SolidNode = ElementNode | TextNode; | ||
export interface ElementNode extends IntrinsicTextProps { | ||
export interface ElementNode extends Omit<IntrinsicNodeProps, 'children'> { | ||
} | ||
@@ -29,0 +29,0 @@ export declare class ElementNode extends Object { |
import { type AnimationSettings, type Dimensions, type INode, type INodeWritableProps, type ITextNodeWritableProps } from '@lightningjs/renderer'; | ||
import { type JSX } from 'solid-js'; | ||
import { type ElementNode } from './core/node/index.js'; | ||
@@ -20,3 +21,2 @@ import type States from './core/node/states.js'; | ||
borderTop?: BorderStyle; | ||
children?: any; | ||
display?: 'flex'; | ||
@@ -39,2 +39,3 @@ flexDirection?: 'row' | 'column'; | ||
states?: States; | ||
text?: string; | ||
} | ||
@@ -47,5 +48,7 @@ export interface IntrinsicNodeStyleProps extends Partial<Omit<INodeWritableProps, 'parent' | 'shader'>>, IntrinsicCommonProps { | ||
style?: IntrinsicNodeStyleProps; | ||
children?: JSX.Element; | ||
} | ||
export interface IntrinsicTextProps extends IntrinsicTextNodeStyleProps { | ||
style?: IntrinsicTextNodeStyleProps; | ||
children: string; | ||
} |
{ | ||
"name": "@lightningjs/solid", | ||
"version": "0.7.6", | ||
"version": "0.8.0", | ||
"description": "Lightning renderer for solid universal", | ||
@@ -68,3 +68,3 @@ "type": "module", | ||
"dependencies": { | ||
"@lightningjs/renderer": "^0.4.0", | ||
"@lightningjs/renderer": "^0.5.0", | ||
"@lightningjs/solid": "file:./" | ||
@@ -71,0 +71,0 @@ }, |
@@ -303,2 +303,15 @@ <p> | ||
#### stateMapperHook | ||
For further customization of styles using states, you can change the states before styles are applied globally using Config.stateMapperHook. For instance, if you wanted to change your styles based on another property like tone you could do: | ||
```js | ||
Config.stateMapperHook = (node, states) => { | ||
const tone = node.tone || ''; // node.tone is 'brand' | ||
return states.map((state) => state + tone); | ||
}; | ||
``` | ||
Then it would apply `focusbrand` from the styles object. | ||
### forwardStates | ||
@@ -305,0 +318,0 @@ |
@@ -40,26 +40,2 @@ /* | ||
// Commented out because it's not used anywhere and implementation seems wrong | ||
// get previousSibling() { | ||
// if (this._parent) { | ||
// const children = this._parent.children; | ||
// const index = children.indexOf(this) - 1; | ||
// if (index >= 0) { | ||
// return children[index]; | ||
// } | ||
// } | ||
// return null; | ||
// } | ||
// get nextSibling() { | ||
// if (this._parent) { | ||
// const children = this._parent.children; | ||
// const index = children.indexOf(this) + 1; | ||
// if (index < children.length) { | ||
// return children[index]; | ||
// } | ||
// } | ||
// return null; | ||
// } | ||
insert(node: SolidNode, beforeNode: SolidNode) { | ||
@@ -66,0 +42,0 @@ if (beforeNode) { |
@@ -21,3 +21,3 @@ /* | ||
type BorderStyleObject, | ||
type IntrinsicTextProps, | ||
type IntrinsicNodeProps, | ||
} from '../../index.js'; | ||
@@ -138,3 +138,3 @@ import Children from './children.js'; | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging | ||
export interface ElementNode extends IntrinsicTextProps {} | ||
export interface ElementNode extends Omit<IntrinsicNodeProps, 'children'> {} | ||
@@ -333,3 +333,3 @@ // eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging | ||
assertTruthy(this.lng); | ||
this.lng.once('textLoaded', (_node, size: Dimensions) => { | ||
this.lng.once('loaded', (_node, size: Dimensions) => { | ||
this.width = size.width; | ||
@@ -513,3 +513,3 @@ this.height = size.height; | ||
if (isFunc(node.onLoad)) { | ||
node.lng.once('textLoaded', node.onLoad); | ||
node.lng.once('loaded', node.onLoad); | ||
} | ||
@@ -548,7 +548,7 @@ | ||
if (node.onFail) { | ||
node.lng.once('txFailed', node.onFail); | ||
node.lng.once('failed', node.onFail); | ||
} | ||
if (node.onLoad) { | ||
node.lng.once('txLoaded', node.onLoad); | ||
node.lng.once('loaded', node.onLoad); | ||
} | ||
@@ -555,0 +555,0 @@ } |
@@ -25,3 +25,4 @@ /* | ||
} from '@lightningjs/renderer'; | ||
import { type ElementNode, type TextNode } from './core/node/index.js'; | ||
import { type JSX } from 'solid-js'; | ||
import { type ElementNode } from './core/node/index.js'; | ||
import type States from './core/node/states.js'; | ||
@@ -47,3 +48,2 @@ | ||
borderTop?: BorderStyle; | ||
children?: any; | ||
display?: 'flex'; | ||
@@ -71,2 +71,3 @@ flexDirection?: 'row' | 'column'; | ||
states?: States; | ||
text?: string; | ||
} | ||
@@ -92,2 +93,3 @@ | ||
style?: IntrinsicNodeStyleProps; | ||
children?: JSX.Element; | ||
} | ||
@@ -97,2 +99,3 @@ | ||
style?: IntrinsicTextNodeStyleProps; | ||
children: string; | ||
} |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
418
282082
4406
+ Added@lightningjs/renderer@0.5.0(transitive)
- Removed@lightningjs/renderer@0.4.2(transitive)
Updated@lightningjs/renderer@^0.5.0