@lightningtv/solid 0.0.12 → 0.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -0
- package/dist/src/primitives/useMouse.d.ts +1 -1
- package/dist/src/primitives/useMouse.js +12 -14
- package/dist/src/primitives/useMouse.js.map +1 -1
- package/dist/src/render.js +6 -6
- package/dist/src/render.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/primitives/useMouse.ts +16 -15
- package/src/render.ts +6 -6
- package/dist/esm/index.js +0 -460
- package/dist/esm/index.js.map +0 -1
- package/dist/source/Text.jsx +0 -1
- package/dist/source/View.jsx +0 -1
- package/dist/source/activeElement.js +0 -4
- package/dist/source/index.js +0 -8
- package/dist/source/jsx-runtime.js +0 -1
- package/dist/source/render.js +0 -56
- package/dist/source/solidOpts.js +0 -61
- package/dist/source/utils.js +0 -26
- package/dist/types/Text.d.ts +0 -3
- package/dist/types/View.d.ts +0 -3
- package/dist/types/activeElement.d.ts +0 -2
- package/dist/types/index.d.ts +0 -8
- package/dist/types/jsx-runtime.d.ts +0 -10
- package/dist/types/render.d.ts +0 -22
- package/dist/types/solidOpts.d.ts +0 -22
- package/dist/types/utils.d.ts +0 -8
package/dist/source/solidOpts.js
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { assertTruthy } from '@lightningjs/renderer/utils';
|
|
2
|
-
import { ElementNode, NodeType, log } from '@lightningtv/core';
|
|
3
|
-
export default {
|
|
4
|
-
createElement(name) {
|
|
5
|
-
return new ElementNode(name);
|
|
6
|
-
},
|
|
7
|
-
createTextNode(text) {
|
|
8
|
-
// A text node is just a string - not the <text> node
|
|
9
|
-
return { type: NodeType.Text, text, parent: undefined };
|
|
10
|
-
},
|
|
11
|
-
replaceText(node, value) {
|
|
12
|
-
log('Replace Text: ', node, value);
|
|
13
|
-
node.text = value;
|
|
14
|
-
const parent = node.parent;
|
|
15
|
-
assertTruthy(parent);
|
|
16
|
-
parent.text = parent.getText();
|
|
17
|
-
},
|
|
18
|
-
setProperty(node, name, value = true) {
|
|
19
|
-
node[name] = value;
|
|
20
|
-
},
|
|
21
|
-
insertNode(parent, node, anchor) {
|
|
22
|
-
log('INSERT: ', parent, node, anchor);
|
|
23
|
-
parent.children.insert(node, anchor);
|
|
24
|
-
node._queueDelete = false;
|
|
25
|
-
if (node instanceof ElementNode) {
|
|
26
|
-
parent.rendered && node.render();
|
|
27
|
-
}
|
|
28
|
-
else if (parent.isTextNode()) {
|
|
29
|
-
// TextNodes can be placed outside of <text> nodes when <Show> is used as placeholder
|
|
30
|
-
parent.text = parent.getText();
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
isTextNode(node) {
|
|
34
|
-
return node.isTextNode();
|
|
35
|
-
},
|
|
36
|
-
removeNode(parent, node) {
|
|
37
|
-
log('REMOVE: ', parent, node);
|
|
38
|
-
parent.children.remove(node);
|
|
39
|
-
node._queueDelete = true;
|
|
40
|
-
if (node instanceof ElementNode) {
|
|
41
|
-
// Solid replacesNodes to move them (via insert and remove),
|
|
42
|
-
// so we need to wait for the next microtask to destroy the node
|
|
43
|
-
// in the event it gets a new parent.
|
|
44
|
-
queueMicrotask(() => node.destroy());
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
getParentNode(node) {
|
|
48
|
-
return node.parent;
|
|
49
|
-
},
|
|
50
|
-
getFirstChild(node) {
|
|
51
|
-
return node.children[0];
|
|
52
|
-
},
|
|
53
|
-
getNextSibling(node) {
|
|
54
|
-
const children = node.parent.children || [];
|
|
55
|
-
const index = children.indexOf(node) + 1;
|
|
56
|
-
if (index < children.length) {
|
|
57
|
-
return children[index];
|
|
58
|
-
}
|
|
59
|
-
return undefined;
|
|
60
|
-
},
|
|
61
|
-
};
|
package/dist/source/utils.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { isInteger } from '@lightningtv/core';
|
|
2
|
-
/**
|
|
3
|
-
* Converts a color string to a color number value.
|
|
4
|
-
*/
|
|
5
|
-
export function hexColor(color = '') {
|
|
6
|
-
if (isInteger(color)) {
|
|
7
|
-
return color;
|
|
8
|
-
}
|
|
9
|
-
if (typeof color === 'string') {
|
|
10
|
-
// Renderer expects RGBA values
|
|
11
|
-
if (color.startsWith('#')) {
|
|
12
|
-
return Number(color.replace('#', '0x') + (color.length === 7 ? 'ff' : ''));
|
|
13
|
-
}
|
|
14
|
-
if (color.startsWith('0x')) {
|
|
15
|
-
return Number(color);
|
|
16
|
-
}
|
|
17
|
-
return Number('0x' + (color.length === 6 ? color + 'ff' : color));
|
|
18
|
-
}
|
|
19
|
-
return 0x00000000;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Converts degrees to radians
|
|
23
|
-
*/
|
|
24
|
-
export function deg2rad(deg) {
|
|
25
|
-
return (deg * Math.PI) / 180;
|
|
26
|
-
}
|
package/dist/types/Text.d.ts
DELETED
package/dist/types/View.d.ts
DELETED
package/dist/types/index.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import './jsx-runtime.js';
|
|
2
|
-
export { View } from './View.jsx';
|
|
3
|
-
export { Text } from './Text.jsx';
|
|
4
|
-
export * from '@lightningtv/core';
|
|
5
|
-
export * from './activeElement.js';
|
|
6
|
-
export * from './utils.js';
|
|
7
|
-
export * from './render.js';
|
|
8
|
-
export { For, Show, Suspense, SuspenseList, Switch, Match, Index, ErrorBoundary, } from 'solid-js';
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { IntrinsicNodeProps, IntrinsicTextProps } from '@lightningtv/core';
|
|
2
|
-
declare module 'solid-js' {
|
|
3
|
-
namespace JSX {
|
|
4
|
-
interface IntrinsicElements {
|
|
5
|
-
node: Partial<IntrinsicNodeProps>;
|
|
6
|
-
view: Partial<IntrinsicNodeProps>;
|
|
7
|
-
text: Partial<IntrinsicTextProps>;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
}
|
package/dist/types/render.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { type SolidNode } from './solidOpts.js';
|
|
2
|
-
import { type JSXElement, type ValidComponent } from 'solid-js';
|
|
3
|
-
import type { RendererMainSettings } from '@lightningjs/renderer';
|
|
4
|
-
export declare const rootNode: import("@lightningtv/core").ElementNode;
|
|
5
|
-
export declare function startLightning(options?: Partial<RendererMainSettings>, rootId?: string | HTMLElement): Promise<any>;
|
|
6
|
-
export declare const render: (code: () => JSXElement, node?: HTMLElement | string) => Promise<{
|
|
7
|
-
dispose: () => void;
|
|
8
|
-
rootNode: import("@lightningtv/core").ElementNode;
|
|
9
|
-
renderer: RendererMain;
|
|
10
|
-
}>;
|
|
11
|
-
export declare const renderSync: (code: () => JSXElement) => () => void;
|
|
12
|
-
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
|
-
/**
|
|
14
|
-
* renders an arbitrary custom or native component and passes the other props
|
|
15
|
-
* ```typescript
|
|
16
|
-
* <Dynamic component={multiline() ? 'textarea' : 'input'} value={value()} />
|
|
17
|
-
* ```
|
|
18
|
-
* @description https://www.solidjs.com/docs/latest/api#dynamic
|
|
19
|
-
*/
|
|
20
|
-
export declare function Dynamic<T>(props: T & {
|
|
21
|
-
component?: ValidComponent;
|
|
22
|
-
}): JSXElement;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { ElementNode, type TextNode } from '@lightningtv/core';
|
|
2
|
-
import type { createRenderer } from 'solid-js/universal';
|
|
3
|
-
export type SolidRendererOptions = Parameters<typeof createRenderer<SolidNode>>[0];
|
|
4
|
-
export type SolidNode = ElementNode | TextNode;
|
|
5
|
-
declare module '@lightningtv/core' {
|
|
6
|
-
interface TextNode {
|
|
7
|
-
_queueDelete?: boolean;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
declare const _default: {
|
|
11
|
-
createElement(name: string): ElementNode;
|
|
12
|
-
createTextNode(text: string): TextNode;
|
|
13
|
-
replaceText(node: TextNode, value: string): void;
|
|
14
|
-
setProperty<T>(node: ElementNode, name: string, value?: any): void;
|
|
15
|
-
insertNode(parent: ElementNode, node: SolidNode, anchor: SolidNode): void;
|
|
16
|
-
isTextNode(node: ElementNode): boolean;
|
|
17
|
-
removeNode(parent: ElementNode, node: SolidNode): void;
|
|
18
|
-
getParentNode(node: SolidNode): ElementNode | undefined;
|
|
19
|
-
getFirstChild(node: ElementNode): SolidNode | undefined;
|
|
20
|
-
getNextSibling(node: SolidNode): SolidNode | undefined;
|
|
21
|
-
};
|
|
22
|
-
export default _default;
|
package/dist/types/utils.d.ts
DELETED