@lightningjs/solid
Advanced tools
Comparing version 0.15.14 to 0.15.15
@@ -1310,24 +1310,22 @@ import { createSignal, mergeProps as mergeProps$1, createRoot, createRenderEffect, createMemo, createComponent as createComponent$1, untrack, splitProps } from 'solid-js'; | ||
let renderer; | ||
let rendererStarted = false; | ||
async function startLightning(options, rootId) { | ||
renderer = startLightningRenderer(options || config.rendererOptions, rootId || 'app'); | ||
rendererStarted = true; | ||
return await renderer.init(); | ||
} | ||
const render = async function (code, node) { | ||
const rootNode = nodeOpts.createElement('App'); | ||
await startLightning(undefined, node); | ||
rootNode.lng = renderer.root; | ||
// @ts-expect-error - code is jsx element and not SolidElement yet | ||
const dispose = solidRenderer.render(code, rootNode); | ||
return { | ||
dispose, | ||
rootNode, | ||
renderer | ||
}; | ||
}; | ||
// Keep render from being Async so playground will work. | ||
const render = function (code, node) { | ||
// used for playground - must be sync so user must await startLightning | ||
const renderSync = function (code) { | ||
const rootNode = nodeOpts.createElement('App'); | ||
if (!rendererStarted) { | ||
return startLightning(undefined, node).then(() => { | ||
rootNode.lng = renderer.root; | ||
// @ts-expect-error - code is jsx element and not SolidElement yet | ||
const dispose = solidRenderer.render(code, rootNode); | ||
return { | ||
dispose, | ||
rootNode, | ||
renderer | ||
}; | ||
}); | ||
} | ||
rootNode.lng = renderer.root; | ||
@@ -1425,3 +1423,3 @@ // @ts-expect-error - code is jsx element and not SolidElement yet | ||
export { config as Config, Dynamic, ElementNode, Text, intrinsicTypes as Types, View, activeElement, createComponent, createElement, createShader, createTextNode, deg2rad, effect, hexColor, insert, insertNode, memo, mergeProps, render, renderer$1 as renderer, setActiveElement, setProp, spread, startLightning, startLightningRenderer, use }; | ||
export { config as Config, Dynamic, ElementNode, Text, intrinsicTypes as Types, View, activeElement, createComponent, createElement, createShader, createTextNode, deg2rad, effect, hexColor, insert, insertNode, memo, mergeProps, render, renderSync, renderer$1 as renderer, setActiveElement, setProp, spread, startLightning, startLightningRenderer, use }; | ||
//# sourceMappingURL=index.js.map |
@@ -25,25 +25,23 @@ /* eslint-disable @typescript-eslint/unbound-method */ | ||
let renderer; | ||
let rendererStarted = false; | ||
export async function startLightning(options, rootId) { | ||
renderer = startLightningRenderer(options || config.rendererOptions, rootId || 'app'); | ||
rendererStarted = true; | ||
return await renderer.init(); | ||
} | ||
// Keep render from being Async so playground will work. | ||
export const render = function (code, node) { | ||
export const render = async function (code, node) { | ||
const rootNode = nodeOpts.createElement('App'); | ||
if (!rendererStarted) { | ||
return startLightning(undefined, node).then(() => { | ||
rootNode.lng = renderer.root; | ||
// @ts-expect-error - code is jsx element and not SolidElement yet | ||
const dispose = solidRenderer.render(code, rootNode); | ||
return { | ||
dispose, | ||
rootNode, | ||
renderer, | ||
}; | ||
}); | ||
} | ||
await startLightning(undefined, node); | ||
rootNode.lng = renderer.root; | ||
// @ts-expect-error - code is jsx element and not SolidElement yet | ||
const dispose = solidRenderer.render(code, rootNode); | ||
return { | ||
dispose, | ||
rootNode, | ||
renderer, | ||
}; | ||
}; | ||
// used for playground - must be sync so user must await startLightning | ||
export const renderSync = function (code) { | ||
const rootNode = nodeOpts.createElement('App'); | ||
rootNode.lng = renderer.root; | ||
// @ts-expect-error - code is jsx element and not SolidElement yet | ||
return solidRenderer.render(code, rootNode); | ||
@@ -50,0 +48,0 @@ }; |
@@ -5,3 +5,3 @@ import { type SolidNode } from './node/elementNode.js'; | ||
export declare function startLightning(options?: Partial<RendererMainSettings>, rootId?: string | HTMLElement): Promise<any>; | ||
export declare const render: (code: () => JSX.Element, node?: HTMLElement | string) => (() => void) | Promise<{ | ||
export declare const render: (code: () => JSX.Element, node?: HTMLElement | string) => Promise<{ | ||
dispose: () => void; | ||
@@ -11,2 +11,3 @@ rootNode: import("./node/elementNode.js").ElementNode; | ||
}>; | ||
export declare const renderSync: (code: () => JSX.Element) => () => void; | ||
export declare const effect: <T>(fn: (prev?: T) => T, init?: T) => void, memo: <T>(fn: () => T, equal: boolean) => () => T, createComponent: <T>(Comp: (props: T) => SolidNode, props: T) => SolidNode, createElement: (tag: string) => SolidNode, createTextNode: (value: string) => SolidNode, insertNode: (parent: SolidNode, node: SolidNode, anchor?: SolidNode) => void, insert: <T>(parent: any, accessor: T | (() => T), marker?: any) => SolidNode, spread: <T>(node: any, accessor: T | (() => T), skipChildren?: Boolean) => void, setProp: <T>(node: SolidNode, name: string, value: T, prev?: T) => T, mergeProps: (...sources: unknown[]) => unknown, use: <A, T>(fn: (element: SolidNode, arg: A) => T, element: SolidNode, arg: A) => T; | ||
@@ -13,0 +14,0 @@ /** |
@@ -29,3 +29,3 @@ import { type AnimationSettings, type Dimensions, type FadeOutEffectProps, type GlitchEffectProps, type GrayscaleEffectProps, type INode, type INodeWritableProps, type ITextNodeWritableProps, type LinearGradientEffectProps, type NodeFailedPayload, type NodeLoadedPayload, type RadialGradientEffectProps, type RadialProgressEffectProps } from '@lightningjs/renderer'; | ||
onFail?: (target: INode, nodeFailedPayload: NodeFailedPayload) => void; | ||
onBeforeLayout?: (this: ElementNode, target: ElementNode, child?: ElementNode, dimensions?: Dimensions) => boolean; | ||
onBeforeLayout?: (this: ElementNode, target: ElementNode, child?: ElementNode, dimensions?: Dimensions) => boolean | undefined; | ||
onLayout?: (this: ElementNode, target: ElementNode, child?: ElementNode, dimensions?: Dimensions) => unknown; | ||
@@ -32,0 +32,0 @@ forwardFocus?: number | ((this: ElementNode, elm: ElementNode) => boolean | void); |
{ | ||
"name": "@lightningjs/solid", | ||
"version": "0.15.14", | ||
"version": "0.15.15", | ||
"description": "Lightning renderer for solid universal", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -30,3 +30,2 @@ /* eslint-disable @typescript-eslint/unbound-method */ | ||
let renderer: RendererMain; | ||
let rendererStarted = false; | ||
export async function startLightning( | ||
@@ -40,8 +39,6 @@ options?: Partial<RendererMainSettings>, | ||
); | ||
rendererStarted = true; | ||
return await renderer.init(); | ||
} | ||
// Keep render from being Async so playground will work. | ||
export const render = function ( | ||
export const render = async function ( | ||
code: () => JSX.Element, | ||
@@ -52,15 +49,16 @@ node?: HTMLElement | string, | ||
if (!rendererStarted) { | ||
return startLightning(undefined, node).then(() => { | ||
rootNode.lng = renderer.root!; | ||
// @ts-expect-error - code is jsx element and not SolidElement yet | ||
const dispose = solidRenderer.render(code, rootNode); | ||
return { | ||
dispose, | ||
rootNode, | ||
renderer, | ||
}; | ||
}); | ||
} | ||
await startLightning(undefined, node); | ||
rootNode.lng = renderer.root!; | ||
// @ts-expect-error - code is jsx element and not SolidElement yet | ||
const dispose = solidRenderer.render(code, rootNode); | ||
return { | ||
dispose, | ||
rootNode, | ||
renderer, | ||
}; | ||
}; | ||
// used for playground - must be sync so user must await startLightning | ||
export const renderSync = function (code: () => JSX.Element) { | ||
const rootNode = nodeOpts.createElement('App'); | ||
rootNode.lng = renderer.root!; | ||
@@ -67,0 +65,0 @@ // @ts-expect-error - code is jsx element and not SolidElement yet |
@@ -70,3 +70,3 @@ /* | ||
dimensions?: Dimensions, | ||
) => boolean; | ||
) => boolean | undefined; | ||
onLayout?: ( | ||
@@ -73,0 +73,0 @@ this: ElementNode, |
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
275030
4513