Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@lightningjs/solid

Package Overview
Dependencies
Maintainers
7
Versions
101
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lightningjs/solid - npm Package Compare versions

Comparing version 0.9.0 to 0.9.1

34

dist/esm/index.js

@@ -299,4 +299,16 @@ import { createSignal, createEffect, mergeProps as mergeProps$1, createRoot, createRenderEffect, createMemo, createComponent as createComponent$1, untrack } from 'solid-js';

function calculateFlex (node) {
// Filter empty text nodes which are place holders for <Show>
const children = node.children.filter(c => c.name !== 'TextNode');
const children = [];
for (let i = 0; i < node.children.length; i++) {
const c = node.children[i];
// Filter empty text nodes which are place holders for <Show> and elements missing dimensions
if (c.name === 'TextNode') {
continue;
}
// text node hasnt loaded yet - skip layout
if (c.name === 'text' && !(c.width || c.height)) {
return;
}
children.push(c);
}
const numChildren = children.length;
const direction = node.flexDirection || 'row';

@@ -313,3 +325,2 @@ const dimension = direction === 'row' ? 'width' : 'height';

const gap = node.gap || 0;
const numChildren = children.length;
const justify = node.justifyContent || 'flexStart';

@@ -590,3 +601,2 @@ const align = node.alignItems;

_resizeOnTextLoad() {
assertTruthy(this.lng);
this.lng.once('loaded', (_node, loadedPayload) => {

@@ -599,3 +609,2 @@ if (loadedPayload.type === 'text') {

this.height = dimensions.height;
assertTruthy(this.parent);
this.parent.updateLayout(this, dimensions);

@@ -645,12 +654,4 @@ }

}
get updateLayoutOn() {
return this._updateLayoutOn;
}
set updateLayoutOn(v) {
this._updateLayoutOn = v;
queueMicrotask(() => this.updateLayout());
}
_applyZIndexToChildren() {
const zIndex = this.zIndex;
assertTruthy(zIndex);
const zIndexIsInteger = zIndex >= 1 && parseInt('' + zIndex) === zIndex;

@@ -706,3 +707,2 @@ const decimalSeparator = zIndexIsInteger ? '.' : '';

Object.keys(styles).forEach(key => {
assertTruthy(this._undoStates);
this._undoStates[state][key] = this[key];

@@ -728,3 +728,3 @@ });

// Parent is dirty whenever a node is inserted after initial render
if (parent?._isDirty) {
if (parent._isDirty) {
parent.updateLayout();

@@ -739,3 +739,3 @@ parent._applyZIndexToChildren();

let props = node._renderProps;
if (parent?.lng) {
if (parent.lng) {
props.parent = parent.lng;

@@ -762,3 +762,2 @@ }

if (!(props.src || props.texture)) {
assertTruthy(parent);
// Set width and height to parent less offset

@@ -1153,3 +1152,2 @@ if (isNaN(props.width)) {

}
// @ts-expect-error Assignment type is difficult to do here. Fix later.
node[name] = value;

@@ -1156,0 +1154,0 @@ },

@@ -19,4 +19,16 @@ /*

export default function (node) {
// Filter empty text nodes which are place holders for <Show>
const children = node.children.filter((c) => c.name !== 'TextNode');
const children = [];
for (let i = 0; i < node.children.length; i++) {
const c = node.children[i];
// Filter empty text nodes which are place holders for <Show> and elements missing dimensions
if (c.name === 'TextNode') {
continue;
}
// text node hasnt loaded yet - skip layout
if (c.name === 'text' && !(c.width || c.height)) {
return;
}
children.push(c);
}
const numChildren = children.length;
const direction = node.flexDirection || 'row';

@@ -33,3 +45,2 @@ const dimension = direction === 'row' ? 'width' : 'height';

const gap = node.gap || 0;
const numChildren = children.length;
const justify = node.justifyContent || 'flexStart';

@@ -36,0 +47,0 @@ const align = node.alignItems;

@@ -105,3 +105,2 @@ /*

_animationSettings;
_updateLayoutOn;
_width;

@@ -258,3 +257,2 @@ _height;

_resizeOnTextLoad() {
assertTruthy(this.lng);
this.lng.once('loaded', (_node, loadedPayload) => {

@@ -265,3 +263,2 @@ if (loadedPayload.type === 'text') {

this.height = dimensions.height;
assertTruthy(this.parent);
this.parent.updateLayout(this, dimensions);

@@ -311,12 +308,4 @@ }

}
get updateLayoutOn() {
return this._updateLayoutOn;
}
set updateLayoutOn(v) {
this._updateLayoutOn = v;
queueMicrotask(() => this.updateLayout());
}
_applyZIndexToChildren() {
const zIndex = this.zIndex;
assertTruthy(zIndex);
const zIndexIsInteger = zIndex >= 1 && parseInt('' + zIndex) === zIndex;

@@ -372,3 +361,2 @@ const decimalSeparator = zIndexIsInteger ? '.' : '';

Object.keys(styles).forEach((key) => {
assertTruthy(this._undoStates);
this._undoStates[state][key] = this[key];

@@ -389,3 +377,3 @@ });

// Parent is dirty whenever a node is inserted after initial render
if (parent?._isDirty) {
if (parent._isDirty) {
parent.updateLayout();

@@ -400,3 +388,3 @@ parent._applyZIndexToChildren();

let props = node._renderProps;
if (parent?.lng) {
if (parent.lng) {
props.parent = parent.lng;

@@ -424,3 +412,2 @@ }

if (!(props.src || props.texture)) {
assertTruthy(parent);
// Set width and height to parent less offset

@@ -427,0 +414,0 @@ if (isNaN(props.width)) {

@@ -45,3 +45,2 @@ /*

}
// @ts-expect-error Assignment type is difficult to do here. Fix later.
node[name] = value;

@@ -48,0 +47,0 @@ },

import { createShader } from '../renderer/index.js';
import { type AnimatableNumberProp, type IntrinsicCommonProps } from '../../index.js';
import { type AnimatableNumberProp, type IntrinsicCommonProps, type NodeStyles, type TextStyles } from '../../index.js';
import Children from './children.js';

@@ -26,3 +26,5 @@ import States, { type NodeStates } from './states.js';

export type SolidNode = ElementNode | TextNode;
export type SolidStyles = NodeStyles | TextStyles;
export interface ElementNode extends Partial<Omit<INodeWritableProps, 'parent' | 'shader'>>, IntrinsicCommonProps {
[key: string]: unknown;
}

@@ -43,3 +45,2 @@ export declare class ElementNode extends Object {

private _animationSettings?;
private _updateLayoutOn?;
private _width?;

@@ -77,4 +78,4 @@ private _height?;

destroy(): void;
set style(value: any);
get style(): any;
set style(value: SolidStyles);
get style(): SolidStyles;
get hasChildren(): boolean;

@@ -85,4 +86,2 @@ set states(states: NodeStates);

set animationSettings(animationSettings: Partial<AnimationSettings>);
get updateLayoutOn(): any;
set updateLayoutOn(v: any);
_applyZIndexToChildren(): void;

@@ -89,0 +88,0 @@ updateLayout(child?: ElementNode, dimensions?: Dimensions): void;

@@ -1,2 +0,2 @@

export type NodeStates = string[] | string | Record<string, boolean>;
export type NodeStates = string[] | string | Record<string, boolean | undefined>;
export default class States extends Array<string> {

@@ -3,0 +3,0 @@ private onChange;

@@ -10,3 +10,3 @@ import type { AnimatableNumberProp } from '../index.js';

export declare function isInteger(item: unknown): item is number;
export declare function keyExists(obj: Record<string | number | symbol, unknown>, keys: (string | number | symbol)[]): boolean;
export declare function keyExists(obj: Record<string, unknown>, keys: (string | number | symbol)[]): boolean;
export declare function getAnimatableValue(value: number | AnimatableNumberProp | undefined): number | undefined;

@@ -64,4 +64,6 @@ import { type AnimationSettings, type Dimensions, type INode, type INodeAnimatableProps, type INodeWritableProps, type ITextNodeWritableProps, type NodeFailedPayload, type NodeLoadedPayload } from '@lightningjs/renderer';

export interface IntrinsicNodeStyleProps extends Partial<Omit<INodeWritableProps, 'parent' | 'shader' | keyof TransformableNodeWritableProps>>, TransformableNodeWritableProps, IntrinsicNodeStyleCommonProps {
[key: string]: unknown;
}
export interface IntrinsicTextNodeStyleProps extends Partial<Omit<ITextNodeWritableProps, 'parent' | 'shader'>>, IntrinsicTextStyleCommonProps {
[key: string]: unknown;
}

@@ -68,0 +70,0 @@ export interface IntrinsicNodeProps extends AddUndefined<IntrinsicNodeCommonProps & IntrinsicNodeStyleProps> {

{
"name": "@lightningjs/solid",
"version": "0.9.0",
"version": "0.9.1",
"description": "Lightning renderer for solid universal",

@@ -5,0 +5,0 @@ "type": "module",

@@ -21,4 +21,18 @@ /*

export default function (node: ElementNode) {
// Filter empty text nodes which are place holders for <Show>
const children = node.children.filter((c) => c.name !== 'TextNode');
const children = [];
for (let i = 0; i < node.children.length; i++) {
const c = node.children[i]!;
// Filter empty text nodes which are place holders for <Show> and elements missing dimensions
if (c.name === 'TextNode') {
continue;
}
// text node hasnt loaded yet - skip layout
if (c.name === 'text' && !(c.width || c.height)) {
return;
}
children.push(c);
}
const numChildren = children.length;
const direction = node.flexDirection || 'row';

@@ -35,3 +49,2 @@ const dimension = direction === 'row' ? 'width' : 'height';

const gap = node.gap || 0;
const numChildren = children.length;
const justify = node.justifyContent || 'flexStart';

@@ -38,0 +51,0 @@ const align = node.alignItems;

@@ -23,3 +23,4 @@ /*

type IntrinsicCommonProps,
type IntrinsicNodeStyleProps,
type NodeStyles,
type TextStyles,
} from '../../index.js';

@@ -146,2 +147,3 @@ import Children from './children.js';

export type SolidNode = ElementNode | TextNode;
export type SolidStyles = NodeStyles | TextStyles;

@@ -151,3 +153,5 @@ // eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging

extends Partial<Omit<INodeWritableProps, 'parent' | 'shader'>>,
IntrinsicCommonProps {}
IntrinsicCommonProps {
[key: string]: unknown;
}

@@ -167,6 +171,5 @@ // eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging

private _shader?: ShaderRef;
private _style?: any;
private _style?: SolidStyles;
private _states?: States;
private _animationSettings?: Partial<AnimationSettings>;
private _updateLayoutOn?: any;
private _width?: number;

@@ -344,4 +347,3 @@ private _height?: number;

_resizeOnTextLoad() {
assertTruthy(this.lng);
this.lng.once(
this.lng!.once(
'loaded',

@@ -354,4 +356,3 @@ (_node: INode, loadedPayload: NodeLoadedPayload) => {

this.height = dimensions.height;
assertTruthy(this.parent);
this.parent.updateLayout(this, dimensions);
this.parent!.updateLayout(this, dimensions);
}

@@ -370,3 +371,3 @@ },

set style(value: any) {
set style(value: SolidStyles) {
// Keys set in JSX are more important

@@ -378,4 +379,4 @@ for (let key in value) {

if (!this[key as keyof this]) {
this[key as keyof this] = value[key as keyof IntrinsicNodeStyleProps];
if (!this[key as keyof SolidStyles]) {
this[key as keyof SolidStyles] = value[key as keyof SolidStyles];
}

@@ -387,4 +388,4 @@ }

get style(): any {
return this._style;
get style(): SolidStyles {
return this._style!;
}

@@ -416,14 +417,4 @@

get updateLayoutOn() {
return this._updateLayoutOn;
}
set updateLayoutOn(v) {
this._updateLayoutOn = v;
queueMicrotask(() => this.updateLayout());
}
_applyZIndexToChildren() {
const zIndex = this.zIndex;
assertTruthy(zIndex);
const zIndex = this.zIndex!;
const zIndexIsInteger = zIndex >= 1 && parseInt('' + zIndex) === zIndex;

@@ -490,4 +481,3 @@ const decimalSeparator = zIndexIsInteger ? '.' : '';

Object.keys(styles).forEach((key) => {
assertTruthy(this._undoStates);
this._undoStates[state][key] = this[key as keyof this];
this._undoStates![state][key] = this[key as keyof this];
});

@@ -507,6 +497,6 @@ }

const node = this;
const parent = this.parent;
const parent = this.parent!;
// Parent is dirty whenever a node is inserted after initial render
if (parent?._isDirty) {
if (parent._isDirty) {
parent.updateLayout();

@@ -525,3 +515,3 @@ parent._applyZIndexToChildren();

if (parent?.lng) {
if (parent.lng) {
props.parent = parent.lng;

@@ -552,3 +542,2 @@ }

if (!(props.src || props.texture)) {
assertTruthy(parent);
// Set width and height to parent less offset

@@ -555,0 +544,0 @@ if (isNaN(props.width)) {

@@ -20,3 +20,6 @@ /*

export type NodeStates = string[] | string | Record<string, boolean>;
export type NodeStates =
| string[]
| string
| Record<string, boolean | undefined>;

@@ -23,0 +26,0 @@ export default class States extends Array<string> {

@@ -51,3 +51,3 @@ /*

}
// @ts-expect-error Assignment type is difficult to do here. Fix later.
node[name] = value;

@@ -54,0 +54,0 @@ },

@@ -58,3 +58,3 @@ /* eslint-disable @typescript-eslint/no-explicit-any */

export function keyExists(
obj: Record<string | number | symbol, unknown>,
obj: Record<string, unknown>,
keys: (string | number | symbol)[],

@@ -61,0 +61,0 @@ ) {

@@ -118,7 +118,11 @@ /*

TransformableNodeWritableProps,
IntrinsicNodeStyleCommonProps {}
IntrinsicNodeStyleCommonProps {
[key: string]: unknown;
}
export interface IntrinsicTextNodeStyleProps
extends Partial<Omit<ITextNodeWritableProps, 'parent' | 'shader'>>,
IntrinsicTextStyleCommonProps {}
IntrinsicTextStyleCommonProps {
[key: string]: unknown;
}

@@ -125,0 +129,0 @@ export interface IntrinsicNodeProps

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc