@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/dist/esm/index.js DELETED
@@ -1,460 +0,0 @@
1
- import { createSignal, mergeProps as mergeProps$1, createRoot, createRenderEffect, createMemo, createComponent as createComponent$1, untrack, splitProps } from 'solid-js';
2
- export { ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch } from 'solid-js';
3
- import { Config, isInteger, ElementNode, NodeType, log, startLightningRenderer } from '@lightningtv/core';
4
- export * from '@lightningtv/core';
5
-
6
- const View = props => (() => {
7
- var _el$ = createElement("node");
8
- spread(_el$, props, false);
9
- return _el$;
10
- })();
11
-
12
- const Text = props => (() => {
13
- var _el$ = createElement("text");
14
- spread(_el$, props, false);
15
- return _el$;
16
- })();
17
-
18
- const [activeElement, setActiveElement] = createSignal(undefined);
19
- Config.setActiveElement = setActiveElement;
20
-
21
- /**
22
- * Converts a color string to a color number value.
23
- */
24
- function hexColor(color = '') {
25
- if (isInteger(color)) {
26
- return color;
27
- }
28
- if (typeof color === 'string') {
29
- // Renderer expects RGBA values
30
- if (color.startsWith('#')) {
31
- return Number(color.replace('#', '0x') + (color.length === 7 ? 'ff' : ''));
32
- }
33
- if (color.startsWith('0x')) {
34
- return Number(color);
35
- }
36
- return Number('0x' + (color.length === 6 ? color + 'ff' : color));
37
- }
38
- return 0x00000000;
39
- }
40
-
41
- /**
42
- * Converts degrees to radians
43
- */
44
- function deg2rad(deg) {
45
- return deg * Math.PI / 180;
46
- }
47
-
48
- function createRenderer$1({
49
- createElement,
50
- createTextNode,
51
- isTextNode,
52
- replaceText,
53
- insertNode,
54
- removeNode,
55
- setProperty,
56
- getParentNode,
57
- getFirstChild,
58
- getNextSibling
59
- }) {
60
- function insert(parent, accessor, marker, initial) {
61
- if (marker !== undefined && !initial) initial = [];
62
- if (typeof accessor !== "function") return insertExpression(parent, accessor, initial, marker);
63
- createRenderEffect(current => insertExpression(parent, accessor(), current, marker), initial);
64
- }
65
- function insertExpression(parent, value, current, marker, unwrapArray) {
66
- while (typeof current === "function") current = current();
67
- if (value === current) return current;
68
- const t = typeof value,
69
- multi = marker !== undefined;
70
- if (t === "string" || t === "number") {
71
- if (t === "number") value = value.toString();
72
- if (multi) {
73
- let node = current[0];
74
- if (node && isTextNode(node)) {
75
- replaceText(node, value);
76
- } else node = createTextNode(value);
77
- current = cleanChildren(parent, current, marker, node);
78
- } else {
79
- if (current !== "" && typeof current === "string") {
80
- replaceText(getFirstChild(parent), current = value);
81
- } else {
82
- cleanChildren(parent, current, marker, createTextNode(value));
83
- current = value;
84
- }
85
- }
86
- } else if (value == null || t === "boolean") {
87
- current = cleanChildren(parent, current, marker);
88
- } else if (t === "function") {
89
- createRenderEffect(() => {
90
- let v = value();
91
- while (typeof v === "function") v = v();
92
- current = insertExpression(parent, v, current, marker);
93
- });
94
- return () => current;
95
- } else if (Array.isArray(value)) {
96
- const array = [];
97
- if (normalizeIncomingArray(array, value, unwrapArray)) {
98
- createRenderEffect(() => current = insertExpression(parent, array, current, marker, true));
99
- return () => current;
100
- }
101
- if (array.length === 0) {
102
- const replacement = cleanChildren(parent, current, marker);
103
- if (multi) return current = replacement;
104
- } else {
105
- if (Array.isArray(current)) {
106
- if (current.length === 0) {
107
- appendNodes(parent, array, marker);
108
- } else reconcileArrays(parent, current, array);
109
- } else if (current == null || current === "") {
110
- appendNodes(parent, array);
111
- } else {
112
- reconcileArrays(parent, multi && current || [getFirstChild(parent)], array);
113
- }
114
- }
115
- current = array;
116
- } else {
117
- if (Array.isArray(current)) {
118
- if (multi) return current = cleanChildren(parent, current, marker, value);
119
- cleanChildren(parent, current, null, value);
120
- } else if (current == null || current === "" || !getFirstChild(parent)) {
121
- insertNode(parent, value);
122
- } else replaceNode(parent, value, getFirstChild(parent));
123
- current = value;
124
- }
125
- return current;
126
- }
127
- function normalizeIncomingArray(normalized, array, unwrap) {
128
- let dynamic = false;
129
- for (let i = 0, len = array.length; i < len; i++) {
130
- let item = array[i],
131
- t;
132
- if (item == null || item === true || item === false) ;else if (Array.isArray(item)) {
133
- dynamic = normalizeIncomingArray(normalized, item) || dynamic;
134
- } else if ((t = typeof item) === "string" || t === "number") {
135
- normalized.push(createTextNode(item));
136
- } else if (t === "function") {
137
- if (unwrap) {
138
- while (typeof item === "function") item = item();
139
- dynamic = normalizeIncomingArray(normalized, Array.isArray(item) ? item : [item]) || dynamic;
140
- } else {
141
- normalized.push(item);
142
- dynamic = true;
143
- }
144
- } else normalized.push(item);
145
- }
146
- return dynamic;
147
- }
148
- function reconcileArrays(parentNode, a, b) {
149
- let bLength = b.length,
150
- aEnd = a.length,
151
- bEnd = bLength,
152
- aStart = 0,
153
- bStart = 0,
154
- after = getNextSibling(a[aEnd - 1]),
155
- map = null;
156
- while (aStart < aEnd || bStart < bEnd) {
157
- if (a[aStart] === b[bStart]) {
158
- aStart++;
159
- bStart++;
160
- continue;
161
- }
162
- while (a[aEnd - 1] === b[bEnd - 1]) {
163
- aEnd--;
164
- bEnd--;
165
- }
166
- if (aEnd === aStart) {
167
- const node = bEnd < bLength ? bStart ? getNextSibling(b[bStart - 1]) : b[bEnd - bStart] : after;
168
- while (bStart < bEnd) insertNode(parentNode, b[bStart++], node);
169
- } else if (bEnd === bStart) {
170
- while (aStart < aEnd) {
171
- if (!map || !map.has(a[aStart])) removeNode(parentNode, a[aStart]);
172
- aStart++;
173
- }
174
- } else if (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]) {
175
- const node = getNextSibling(a[--aEnd]);
176
- insertNode(parentNode, b[bStart++], getNextSibling(a[aStart++]));
177
- insertNode(parentNode, b[--bEnd], node);
178
- a[aEnd] = b[bEnd];
179
- } else {
180
- if (!map) {
181
- map = new Map();
182
- let i = bStart;
183
- while (i < bEnd) map.set(b[i], i++);
184
- }
185
- const index = map.get(a[aStart]);
186
- if (index != null) {
187
- if (bStart < index && index < bEnd) {
188
- let i = aStart,
189
- sequence = 1,
190
- t;
191
- while (++i < aEnd && i < bEnd) {
192
- if ((t = map.get(a[i])) == null || t !== index + sequence) break;
193
- sequence++;
194
- }
195
- if (sequence > index - bStart) {
196
- const node = a[aStart];
197
- while (bStart < index) insertNode(parentNode, b[bStart++], node);
198
- } else replaceNode(parentNode, b[bStart++], a[aStart++]);
199
- } else aStart++;
200
- } else removeNode(parentNode, a[aStart++]);
201
- }
202
- }
203
- }
204
- function cleanChildren(parent, current, marker, replacement) {
205
- if (marker === undefined) {
206
- let removed;
207
- while (removed = getFirstChild(parent)) removeNode(parent, removed);
208
- replacement && insertNode(parent, replacement);
209
- return "";
210
- }
211
- const node = replacement || createTextNode("");
212
- if (current.length) {
213
- let inserted = false;
214
- for (let i = current.length - 1; i >= 0; i--) {
215
- const el = current[i];
216
- if (node !== el) {
217
- const isParent = getParentNode(el) === parent;
218
- if (!inserted && !i) isParent ? replaceNode(parent, node, el) : insertNode(parent, node, marker);else isParent && removeNode(parent, el);
219
- } else inserted = true;
220
- }
221
- } else insertNode(parent, node, marker);
222
- return [node];
223
- }
224
- function appendNodes(parent, array, marker) {
225
- for (let i = 0, len = array.length; i < len; i++) insertNode(parent, array[i], marker);
226
- }
227
- function replaceNode(parent, newNode, oldNode) {
228
- insertNode(parent, newNode, oldNode);
229
- removeNode(parent, oldNode);
230
- }
231
- function spreadExpression(node, props, prevProps = {}, skipChildren) {
232
- props || (props = {});
233
- if (!skipChildren) {
234
- createRenderEffect(() => prevProps.children = insertExpression(node, props.children, prevProps.children));
235
- }
236
- createRenderEffect(() => props.ref && props.ref(node));
237
- createRenderEffect(() => {
238
- for (const prop in props) {
239
- if (prop === "children" || prop === "ref") continue;
240
- const value = props[prop];
241
- if (value === prevProps[prop]) continue;
242
- setProperty(node, prop, value, prevProps[prop]);
243
- prevProps[prop] = value;
244
- }
245
- });
246
- return prevProps;
247
- }
248
- return {
249
- render(code, element) {
250
- let disposer;
251
- createRoot(dispose => {
252
- disposer = dispose;
253
- insert(element, code());
254
- });
255
- return disposer;
256
- },
257
- insert,
258
- spread(node, accessor, skipChildren) {
259
- if (typeof accessor === "function") {
260
- createRenderEffect(current => spreadExpression(node, accessor(), current, skipChildren));
261
- } else spreadExpression(node, accessor, undefined, skipChildren);
262
- },
263
- createElement,
264
- createTextNode,
265
- insertNode,
266
- setProp(node, name, value, prev) {
267
- setProperty(node, name, value, prev);
268
- return value;
269
- },
270
- mergeProps: mergeProps$1,
271
- effect: createRenderEffect,
272
- memo: createMemo,
273
- createComponent: createComponent$1,
274
- use(fn, element, arg) {
275
- return untrack(() => fn(element, arg));
276
- }
277
- };
278
- }
279
- function createRenderer(options) {
280
- const renderer = createRenderer$1(options);
281
- renderer.mergeProps = mergeProps$1;
282
- return renderer;
283
- }
284
-
285
- /*
286
- * If not stated otherwise in this file or this component's LICENSE file the
287
- * following copyright and licenses apply:
288
- *
289
- * Copyright 2023 Comcast Cable Communications Management, LLC.
290
- *
291
- * Licensed under the Apache License, Version 2.0 (the License);
292
- * you may not use this file except in compliance with the License.
293
- * You may obtain a copy of the License at
294
- *
295
- * http://www.apache.org/licenses/LICENSE-2.0
296
- *
297
- * Unless required by applicable law or agreed to in writing, software
298
- * distributed under the License is distributed on an "AS IS" BASIS,
299
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
300
- * See the License for the specific language governing permissions and
301
- * limitations under the License.
302
- */
303
- /**
304
- * Asserts a condition is truthy, otherwise throws an error
305
- *
306
- * @remarks
307
- * Useful at the top of functions to ensure certain conditions, arguments and
308
- * properties are set/met before continuing. When using this function,
309
- * TypeScript will narrow away falsy types from the condition.
310
- *
311
- * @param condition
312
- * @param message
313
- * @returns
314
- */
315
- function assertTruthy(condition, message) {
316
- if (isProductionEnvironment()) return;
317
- if (!condition) {
318
- throw new Error('Assertion failed');
319
- }
320
- }
321
- /**
322
- * Checks import.meta if env is production
323
- *
324
- * @returns
325
- */
326
- function isProductionEnvironment() {
327
- return import.meta.env && import.meta.env.PROD;
328
- }
329
-
330
- var nodeOpts = {
331
- createElement(name) {
332
- return new ElementNode(name);
333
- },
334
- createTextNode(text) {
335
- // A text node is just a string - not the <text> node
336
- return {
337
- type: NodeType.Text,
338
- text,
339
- parent: undefined
340
- };
341
- },
342
- replaceText(node, value) {
343
- log('Replace Text: ', node, value);
344
- node.text = value;
345
- const parent = node.parent;
346
- assertTruthy(parent);
347
- parent.text = parent.getText();
348
- },
349
- setProperty(node, name, value = true) {
350
- node[name] = value;
351
- },
352
- insertNode(parent, node, anchor) {
353
- log('INSERT: ', parent, node, anchor);
354
- parent.children.insert(node, anchor);
355
- node._queueDelete = false;
356
- if (node instanceof ElementNode) {
357
- parent.rendered && node.render();
358
- } else if (parent.isTextNode()) {
359
- // TextNodes can be placed outside of <text> nodes when <Show> is used as placeholder
360
- parent.text = parent.getText();
361
- }
362
- },
363
- isTextNode(node) {
364
- return node.isTextNode();
365
- },
366
- removeNode(parent, node) {
367
- log('REMOVE: ', parent, node);
368
- parent.children.remove(node);
369
- node._queueDelete = true;
370
- if (node instanceof ElementNode) {
371
- // Solid replacesNodes to move them (via insert and remove),
372
- // so we need to wait for the next microtask to destroy the node
373
- // in the event it gets a new parent.
374
- queueMicrotask(() => node.destroy());
375
- }
376
- },
377
- getParentNode(node) {
378
- return node.parent;
379
- },
380
- getFirstChild(node) {
381
- return node.children[0];
382
- },
383
- getNextSibling(node) {
384
- const children = node.parent.children || [];
385
- const index = children.indexOf(node) + 1;
386
- if (index < children.length) {
387
- return children[index];
388
- }
389
- return undefined;
390
- }
391
- };
392
-
393
- /* eslint-disable @typescript-eslint/unbound-method */
394
- const solidRenderer = createRenderer(nodeOpts);
395
- let renderer;
396
- const rootNode = nodeOpts.createElement('App');
397
- async function startLightning(options, rootId) {
398
- renderer = startLightningRenderer(options || Config.rendererOptions, rootId || 'app');
399
- return await renderer.init();
400
- }
401
- const render = async function (code, node) {
402
- await startLightning(undefined, node);
403
- rootNode.lng = renderer.root;
404
- rootNode.rendered = true;
405
- // @ts-expect-error - code is jsx element and not SolidElement yet
406
- const dispose = solidRenderer.render(code, rootNode);
407
- return {
408
- dispose,
409
- rootNode,
410
- renderer
411
- };
412
- };
413
-
414
- // used for playground - must be sync so user must await startLightning
415
- const renderSync = function (code) {
416
- rootNode.lng = renderer.root;
417
- // @ts-expect-error - code is jsx element and not SolidElement yet
418
- return solidRenderer.render(code, rootNode);
419
- };
420
- const {
421
- effect,
422
- memo,
423
- createComponent,
424
- createElement,
425
- createTextNode,
426
- insertNode,
427
- insert,
428
- spread,
429
- setProp,
430
- mergeProps,
431
- use
432
- } = solidRenderer;
433
-
434
- /**
435
- * renders an arbitrary custom or native component and passes the other props
436
- * ```typescript
437
- * <Dynamic component={multiline() ? 'textarea' : 'input'} value={value()} />
438
- * ```
439
- * @description https://www.solidjs.com/docs/latest/api#dynamic
440
- */
441
- function Dynamic(props) {
442
- const [p, others] = splitProps(props, ['component']);
443
- const cached = createMemo(() => p.component);
444
- return createMemo(() => {
445
- const component = cached();
446
- switch (typeof component) {
447
- case 'function':
448
- return untrack(() => component(others));
449
- case 'string':
450
- {
451
- const el = createElement(component);
452
- spread(el, others);
453
- return el;
454
- }
455
- }
456
- });
457
- }
458
-
459
- export { Dynamic, Text, View, activeElement, createComponent, createElement, createTextNode, deg2rad, effect, hexColor, insert, insertNode, memo, mergeProps, render, renderSync, rootNode, setActiveElement, setProp, spread, startLightning, use };
460
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":["../../src/View.tsx","../../src/Text.tsx","../../src/activeElement.ts","../../src/utils.ts","../../node_modules/.pnpm/solid-js@1.8.17/node_modules/solid-js/universal/dist/universal.js","../../node_modules/.pnpm/@lightningjs+renderer@0.9.1/node_modules/@lightningjs/renderer/dist/src/utils.js","../../src/solidOpts.ts","../../src/render.ts"],"sourcesContent":["import type { Component } from 'solid-js';\nimport type { IntrinsicNodeProps } from '@lightningtv/core';\n\nexport const View: Component<IntrinsicNodeProps> = (props) => (\n <node {...props}></node>\n);\n","import { type Component } from 'solid-js';\nimport { type IntrinsicTextProps } from '@lightningtv/core';\n\nexport const Text: Component<IntrinsicTextProps> = (props) => (\n <text {...props}></text>\n);\n","import { createSignal } from 'solid-js';\nimport { Config, type ElementNode } from '@lightningtv/core';\nexport const [activeElement, setActiveElement] = createSignal<\n ElementNode | undefined\n>(undefined);\n\nConfig.setActiveElement = setActiveElement;\n","import { isInteger } from '@lightningtv/core';\n\n/**\n * Converts a color string to a color number value.\n */\nexport function hexColor(color: string | number = ''): number {\n if (isInteger(color)) {\n return color;\n }\n\n if (typeof color === 'string') {\n // Renderer expects RGBA values\n if (color.startsWith('#')) {\n return Number(\n color.replace('#', '0x') + (color.length === 7 ? 'ff' : ''),\n );\n }\n\n if (color.startsWith('0x')) {\n return Number(color);\n }\n return Number('0x' + (color.length === 6 ? color + 'ff' : color));\n }\n\n return 0x00000000;\n}\n\n/**\n * Converts degrees to radians\n */\nexport function deg2rad(deg: number) {\n return (deg * Math.PI) / 180;\n}\n","import {\n createRoot,\n createRenderEffect,\n mergeProps,\n createMemo,\n createComponent,\n untrack\n} from \"solid-js\";\n\nfunction createRenderer$1({\n createElement,\n createTextNode,\n isTextNode,\n replaceText,\n insertNode,\n removeNode,\n setProperty,\n getParentNode,\n getFirstChild,\n getNextSibling\n}) {\n function insert(parent, accessor, marker, initial) {\n if (marker !== undefined && !initial) initial = [];\n if (typeof accessor !== \"function\") return insertExpression(parent, accessor, initial, marker);\n createRenderEffect(current => insertExpression(parent, accessor(), current, marker), initial);\n }\n function insertExpression(parent, value, current, marker, unwrapArray) {\n while (typeof current === \"function\") current = current();\n if (value === current) return current;\n const t = typeof value,\n multi = marker !== undefined;\n if (t === \"string\" || t === \"number\") {\n if (t === \"number\") value = value.toString();\n if (multi) {\n let node = current[0];\n if (node && isTextNode(node)) {\n replaceText(node, value);\n } else node = createTextNode(value);\n current = cleanChildren(parent, current, marker, node);\n } else {\n if (current !== \"\" && typeof current === \"string\") {\n replaceText(getFirstChild(parent), (current = value));\n } else {\n cleanChildren(parent, current, marker, createTextNode(value));\n current = value;\n }\n }\n } else if (value == null || t === \"boolean\") {\n current = cleanChildren(parent, current, marker);\n } else if (t === \"function\") {\n createRenderEffect(() => {\n let v = value();\n while (typeof v === \"function\") v = v();\n current = insertExpression(parent, v, current, marker);\n });\n return () => current;\n } else if (Array.isArray(value)) {\n const array = [];\n if (normalizeIncomingArray(array, value, unwrapArray)) {\n createRenderEffect(\n () => (current = insertExpression(parent, array, current, marker, true))\n );\n return () => current;\n }\n if (array.length === 0) {\n const replacement = cleanChildren(parent, current, marker);\n if (multi) return (current = replacement);\n } else {\n if (Array.isArray(current)) {\n if (current.length === 0) {\n appendNodes(parent, array, marker);\n } else reconcileArrays(parent, current, array);\n } else if (current == null || current === \"\") {\n appendNodes(parent, array);\n } else {\n reconcileArrays(parent, (multi && current) || [getFirstChild(parent)], array);\n }\n }\n current = array;\n } else {\n if (Array.isArray(current)) {\n if (multi) return (current = cleanChildren(parent, current, marker, value));\n cleanChildren(parent, current, null, value);\n } else if (current == null || current === \"\" || !getFirstChild(parent)) {\n insertNode(parent, value);\n } else replaceNode(parent, value, getFirstChild(parent));\n current = value;\n }\n return current;\n }\n function normalizeIncomingArray(normalized, array, unwrap) {\n let dynamic = false;\n for (let i = 0, len = array.length; i < len; i++) {\n let item = array[i],\n t;\n if (item == null || item === true || item === false);\n else if (Array.isArray(item)) {\n dynamic = normalizeIncomingArray(normalized, item) || dynamic;\n } else if ((t = typeof item) === \"string\" || t === \"number\") {\n normalized.push(createTextNode(item));\n } else if (t === \"function\") {\n if (unwrap) {\n while (typeof item === \"function\") item = item();\n dynamic =\n normalizeIncomingArray(normalized, Array.isArray(item) ? item : [item]) || dynamic;\n } else {\n normalized.push(item);\n dynamic = true;\n }\n } else normalized.push(item);\n }\n return dynamic;\n }\n function reconcileArrays(parentNode, a, b) {\n let bLength = b.length,\n aEnd = a.length,\n bEnd = bLength,\n aStart = 0,\n bStart = 0,\n after = getNextSibling(a[aEnd - 1]),\n map = null;\n while (aStart < aEnd || bStart < bEnd) {\n if (a[aStart] === b[bStart]) {\n aStart++;\n bStart++;\n continue;\n }\n while (a[aEnd - 1] === b[bEnd - 1]) {\n aEnd--;\n bEnd--;\n }\n if (aEnd === aStart) {\n const node =\n bEnd < bLength ? (bStart ? getNextSibling(b[bStart - 1]) : b[bEnd - bStart]) : after;\n while (bStart < bEnd) insertNode(parentNode, b[bStart++], node);\n } else if (bEnd === bStart) {\n while (aStart < aEnd) {\n if (!map || !map.has(a[aStart])) removeNode(parentNode, a[aStart]);\n aStart++;\n }\n } else if (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]) {\n const node = getNextSibling(a[--aEnd]);\n insertNode(parentNode, b[bStart++], getNextSibling(a[aStart++]));\n insertNode(parentNode, b[--bEnd], node);\n a[aEnd] = b[bEnd];\n } else {\n if (!map) {\n map = new Map();\n let i = bStart;\n while (i < bEnd) map.set(b[i], i++);\n }\n const index = map.get(a[aStart]);\n if (index != null) {\n if (bStart < index && index < bEnd) {\n let i = aStart,\n sequence = 1,\n t;\n while (++i < aEnd && i < bEnd) {\n if ((t = map.get(a[i])) == null || t !== index + sequence) break;\n sequence++;\n }\n if (sequence > index - bStart) {\n const node = a[aStart];\n while (bStart < index) insertNode(parentNode, b[bStart++], node);\n } else replaceNode(parentNode, b[bStart++], a[aStart++]);\n } else aStart++;\n } else removeNode(parentNode, a[aStart++]);\n }\n }\n }\n function cleanChildren(parent, current, marker, replacement) {\n if (marker === undefined) {\n let removed;\n while ((removed = getFirstChild(parent))) removeNode(parent, removed);\n replacement && insertNode(parent, replacement);\n return \"\";\n }\n const node = replacement || createTextNode(\"\");\n if (current.length) {\n let inserted = false;\n for (let i = current.length - 1; i >= 0; i--) {\n const el = current[i];\n if (node !== el) {\n const isParent = getParentNode(el) === parent;\n if (!inserted && !i)\n isParent ? replaceNode(parent, node, el) : insertNode(parent, node, marker);\n else isParent && removeNode(parent, el);\n } else inserted = true;\n }\n } else insertNode(parent, node, marker);\n return [node];\n }\n function appendNodes(parent, array, marker) {\n for (let i = 0, len = array.length; i < len; i++) insertNode(parent, array[i], marker);\n }\n function replaceNode(parent, newNode, oldNode) {\n insertNode(parent, newNode, oldNode);\n removeNode(parent, oldNode);\n }\n function spreadExpression(node, props, prevProps = {}, skipChildren) {\n props || (props = {});\n if (!skipChildren) {\n createRenderEffect(\n () => (prevProps.children = insertExpression(node, props.children, prevProps.children))\n );\n }\n createRenderEffect(() => props.ref && props.ref(node));\n createRenderEffect(() => {\n for (const prop in props) {\n if (prop === \"children\" || prop === \"ref\") continue;\n const value = props[prop];\n if (value === prevProps[prop]) continue;\n setProperty(node, prop, value, prevProps[prop]);\n prevProps[prop] = value;\n }\n });\n return prevProps;\n }\n return {\n render(code, element) {\n let disposer;\n createRoot(dispose => {\n disposer = dispose;\n insert(element, code());\n });\n return disposer;\n },\n insert,\n spread(node, accessor, skipChildren) {\n if (typeof accessor === \"function\") {\n createRenderEffect(current => spreadExpression(node, accessor(), current, skipChildren));\n } else spreadExpression(node, accessor, undefined, skipChildren);\n },\n createElement,\n createTextNode,\n insertNode,\n setProp(node, name, value, prev) {\n setProperty(node, name, value, prev);\n return value;\n },\n mergeProps,\n effect: createRenderEffect,\n memo: createMemo,\n createComponent,\n use(fn, element, arg) {\n return untrack(() => fn(element, arg));\n }\n };\n}\n\nfunction createRenderer(options) {\n const renderer = createRenderer$1(options);\n renderer.mergeProps = mergeProps;\n return renderer;\n}\n\nexport { createRenderer };\n","/*\n * If not stated otherwise in this file or this component's LICENSE file the\n * following copyright and licenses apply:\n *\n * Copyright 2023 Comcast Cable Communications Management, LLC.\n *\n * Licensed under the Apache License, Version 2.0 (the License);\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nexport function createWebGLContext(canvas, contextSpy) {\n const config = {\n alpha: true,\n antialias: false,\n depth: false,\n stencil: true,\n desynchronized: false,\n // Disabled because it prevents Visual Regression Tests from working\n // failIfMajorPerformanceCaveat: true,\n powerPreference: 'high-performance',\n premultipliedAlpha: true,\n preserveDrawingBuffer: false,\n };\n const gl = \n // TODO: Remove this assertion once this issue is fixed in TypeScript\n // https://github.com/microsoft/TypeScript/issues/53614\n (canvas.getContext('webgl', config) ||\n canvas.getContext('experimental-webgl', config));\n if (!gl) {\n throw new Error('Unable to create WebGL context');\n }\n if (contextSpy) {\n // Proxy the GL context to log all GL calls\n return new Proxy(gl, {\n get(target, prop) {\n const value = target[prop];\n if (typeof value === 'function') {\n contextSpy.increment(String(prop));\n return value.bind(target);\n }\n return value;\n },\n });\n }\n return gl;\n}\n/**\n * Asserts a condition is truthy, otherwise throws an error\n *\n * @remarks\n * Useful at the top of functions to ensure certain conditions, arguments and\n * properties are set/met before continuing. When using this function,\n * TypeScript will narrow away falsy types from the condition.\n *\n * @param condition\n * @param message\n * @returns\n */\nexport function assertTruthy(condition, message) {\n if (isProductionEnvironment())\n return;\n if (!condition) {\n throw new Error(message || 'Assertion failed');\n }\n}\n/**\n * Merges two colors based on a given progress value.\n *\n * This function takes two colors (c1 and c2) represented as 32-bit integers\n * in RGBA format and blends them based on the provided progress value (p).\n * The result is a new color that is a weighted combination of the input colors,\n * where the weight is determined by the progress value.\n *\n * @param {number} c1 - The first color in RGBA format (32-bit integer).\n * @param {number} c2 - The second color in RGBA format (32-bit integer).\n * @param {number} p - The progress value between 0 and 1.\n * @returns {number} The merged color as a 32-bit integer in RGBA format.\n */\nexport function mergeColorProgress(rgba1, rgba2, p) {\n const r1 = Math.trunc(rgba1 >>> 24);\n const g1 = Math.trunc((rgba1 >>> 16) & 0xff);\n const b1 = Math.trunc((rgba1 >>> 8) & 0xff);\n const a1 = Math.trunc(rgba1 & 0xff);\n const r2 = Math.trunc(rgba2 >>> 24);\n const g2 = Math.trunc((rgba2 >>> 16) & 0xff);\n const b2 = Math.trunc((rgba2 >>> 8) & 0xff);\n const a2 = Math.trunc(rgba2 & 0xff);\n const r = Math.round(r2 * p + r1 * (1 - p));\n const g = Math.round(g2 * p + g1 * (1 - p));\n const b = Math.round(b2 * p + b1 * (1 - p));\n const a = Math.round(a2 * p + a1 * (1 - p));\n return ((r << 24) | (g << 16) | (b << 8) | a) >>> 0;\n}\n/**\n * Given an RGBA encoded number, returns back the RGBA number with it's alpha\n * component multiplied by the passed `alpha` parameter.\n *\n * @internalRemarks\n * This method does NOT premultiply the alpha into the color channels. If that\n * is required (for internal use only) use {@link mergeColorAlphaPremultiplied}\n * instead.\n *\n * @param rgba RGBA encoded number\n * @param alpha Normalized alpha value (Range: 0.0 - 1.0)\n * @returns\n */\nexport function mergeColorAlpha(rgba, alpha) {\n const r = rgba >>> 24;\n const g = (rgba >>> 16) & 0xff;\n const b = (rgba >>> 8) & 0xff;\n const a = Math.trunc((rgba & 0xff) * alpha);\n return ((r << 24) | (g << 16) | (b << 8) | a) >>> 0;\n}\nlet premultiplyRGB = true;\n/**\n * RGB components should not be premultiplied when using Canvas renderer\n * @param mode Renderer mode\n */\nexport function setPremultiplyMode(mode) {\n premultiplyRGB = mode === 'webgl';\n}\n/**\n * Given an RGBA encoded number, returns back the RGBA number with it's alpha\n * component multiplied by the passed `alpha` parameter.\n *\n * For the webGl renderer, each color channel is premultiplied by the final alpha value.\n *\n * @remarks\n * If `flipEndianess` is set to true, the function will returned an ABGR encoded number\n * which is useful when the color value needs to be passed into a shader attribute.\n *\n * NOTE: Depending on the mode set by {@link setPremultiplyMode}, this method returns\n * a PREMULTIPLIED alpha color which is generally only useful in the context of the\n * internal rendering process. Use {@link mergeColorAlpha} if you need to blend an alpha\n * value into a color in the context of the Renderer's main API.\n *\n * @internalRemarks\n * Do not expose this method in the main API because Renderer users should instead use\n * {@link mergeColorAlpha} to manipulate the alpha value of a color.\n *\n * @internal\n * @param rgba RGBA encoded number\n * @param alpha Normalized alpha value (Range: 0.0 - 1.0)\n * @param flipEndianess Flip the endianess. RGBA becomes encoded as ABGR (for inserting colors into shader attributes)\n * @returns\n */\nexport function mergeColorAlphaPremultiplied(rgba, alpha, flipEndianess = false) {\n const newAlpha = ((rgba & 0xff) / 255) * alpha;\n const rgbAlpha = premultiplyRGB ? newAlpha : 1;\n const r = Math.trunc((rgba >>> 24) * rgbAlpha);\n const g = Math.trunc(((rgba >>> 16) & 0xff) * rgbAlpha);\n const b = Math.trunc(((rgba >>> 8) & 0xff) * rgbAlpha);\n const a = Math.trunc(newAlpha * 255);\n if (flipEndianess) {\n return ((a << 24) | (b << 16) | (g << 8) | r) >>> 0;\n }\n return ((r << 24) | (g << 16) | (b << 8) | a) >>> 0;\n}\n/**\n * Returns true if the given object has the given \"own\" property.\n *\n * @param obj\n * @param prop\n * @returns\n */\nexport function hasOwn(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n/**\n * Converts degrees to radians\n *\n * @param degrees\n * @returns\n */\nexport function deg2Rad(degrees) {\n return (degrees * Math.PI) / 180;\n}\n/**\n * Returns image aspect ratio\n *\n * @param width\n * @param height\n * @returns\n */\nexport function getImageAspectRatio(width, height) {\n return width / height;\n}\n/**\n * Checks import.meta if env is production\n *\n * @returns\n */\nexport function isProductionEnvironment() {\n return import.meta.env && import.meta.env.PROD;\n}\n//# sourceMappingURL=utils.js.map","import { assertTruthy } from '@lightningjs/renderer/utils';\nimport { ElementNode, NodeType, log, type TextNode } from '@lightningtv/core';\nimport type { createRenderer } from 'solid-js/universal';\n\nexport type SolidRendererOptions = Parameters<\n typeof createRenderer<SolidNode>\n>[0];\n\nexport type SolidNode = ElementNode | TextNode;\n\ndeclare module '@lightningtv/core' {\n interface TextNode {\n _queueDelete?: boolean;\n }\n}\n\nexport default {\n createElement(name: string): ElementNode {\n return new ElementNode(name);\n },\n createTextNode(text: string): TextNode {\n // A text node is just a string - not the <text> node\n return { type: NodeType.Text, text, parent: undefined };\n },\n replaceText(node: TextNode, value: string): void {\n log('Replace Text: ', node, value);\n node.text = value;\n const parent = node.parent;\n assertTruthy(parent);\n parent.text = parent.getText();\n },\n setProperty(node: ElementNode, name: string, value: any = true): void {\n node[name] = value;\n },\n insertNode(parent: ElementNode, node: SolidNode, anchor: SolidNode): void {\n log('INSERT: ', parent, node, anchor);\n\n parent.children.insert(node, anchor);\n node._queueDelete = false;\n\n if (node instanceof ElementNode) {\n parent.rendered && node.render();\n } else if (parent.isTextNode()) {\n // TextNodes can be placed outside of <text> nodes when <Show> is used as placeholder\n parent.text = parent.getText();\n }\n },\n isTextNode(node: ElementNode): boolean {\n return node.isTextNode();\n },\n removeNode(parent: ElementNode, node: SolidNode): void {\n log('REMOVE: ', parent, node);\n parent.children.remove(node);\n node._queueDelete = true;\n if (node instanceof ElementNode) {\n // Solid replacesNodes to move them (via insert and remove),\n // so we need to wait for the next microtask to destroy the node\n // in the event it gets a new parent.\n queueMicrotask(() => node.destroy());\n }\n },\n getParentNode(node: SolidNode): ElementNode | undefined {\n return node.parent;\n },\n getFirstChild(node: ElementNode): SolidNode | undefined {\n return node.children[0];\n },\n getNextSibling(node: SolidNode): SolidNode | undefined {\n const children = node.parent!.children || [];\n const index = children.indexOf(node) + 1;\n if (index < children.length) {\n return children[index];\n }\n return undefined;\n },\n} satisfies SolidRendererOptions;\n","/* eslint-disable @typescript-eslint/unbound-method */\nimport { createRenderer } from 'solid-js/universal';\nimport { Config, startLightningRenderer } from '@lightningtv/core';\nimport nodeOpts, { type SolidNode } from './solidOpts.js';\nimport {\n splitProps,\n createMemo,\n untrack,\n type JSXElement,\n type ValidComponent,\n} from 'solid-js';\nimport type { RendererMain, RendererMainSettings } from '@lightningjs/renderer';\n\nconst solidRenderer = createRenderer<SolidNode>(nodeOpts);\n\nlet renderer: RendererMain;\nexport const rootNode = nodeOpts.createElement('App');\n\nexport async function startLightning(\n options?: Partial<RendererMainSettings>,\n rootId?: string | HTMLElement,\n) {\n renderer = startLightningRenderer(\n options || Config.rendererOptions,\n rootId || 'app',\n );\n return await renderer.init();\n}\n\nexport const render = async function (\n code: () => JSXElement,\n node?: HTMLElement | string,\n) {\n await startLightning(undefined, node);\n rootNode.lng = renderer.root!;\n rootNode.rendered = true;\n // @ts-expect-error - code is jsx element and not SolidElement yet\n const dispose = solidRenderer.render(code, rootNode);\n return {\n dispose,\n rootNode,\n renderer,\n };\n};\n\n// used for playground - must be sync so user must await startLightning\nexport const renderSync = function (code: () => JSXElement) {\n rootNode.lng = renderer.root!;\n // @ts-expect-error - code is jsx element and not SolidElement yet\n return solidRenderer.render(code, rootNode);\n};\n\nexport const {\n effect,\n memo,\n createComponent,\n createElement,\n createTextNode,\n insertNode,\n insert,\n spread,\n setProp,\n mergeProps,\n use,\n} = solidRenderer;\n\n/**\n * renders an arbitrary custom or native component and passes the other props\n * ```typescript\n * <Dynamic component={multiline() ? 'textarea' : 'input'} value={value()} />\n * ```\n * @description https://www.solidjs.com/docs/latest/api#dynamic\n */\nexport function Dynamic<T>(\n props: T & {\n component?: ValidComponent;\n },\n): JSXElement {\n const [p, others] = splitProps(props, ['component']);\n\n const cached = createMemo(() => p.component);\n\n return createMemo(() => {\n const component = cached();\n switch (typeof component) {\n case 'function':\n return untrack(() => component(others));\n\n case 'string': {\n const el = createElement(component);\n spread(el, others);\n return el;\n }\n\n default:\n break;\n }\n }) as unknown as JSXElement;\n}\n"],"names":["View","props","_el$","_$createElement","_$spread","Text","activeElement","setActiveElement","createSignal","undefined","Config","hexColor","color","isInteger","startsWith","Number","replace","length","deg2rad","deg","Math","PI","createRenderer$1","createElement","createTextNode","isTextNode","replaceText","insertNode","removeNode","setProperty","getParentNode","getFirstChild","getNextSibling","insert","parent","accessor","marker","initial","insertExpression","createRenderEffect","current","value","unwrapArray","t","multi","toString","node","cleanChildren","v","Array","isArray","array","normalizeIncomingArray","replacement","appendNodes","reconcileArrays","replaceNode","normalized","unwrap","dynamic","i","len","item","push","parentNode","a","b","bLength","aEnd","bEnd","aStart","bStart","after","map","has","Map","set","index","get","sequence","removed","inserted","el","isParent","newNode","oldNode","spreadExpression","prevProps","skipChildren","children","ref","prop","render","code","element","disposer","createRoot","dispose","spread","setProp","name","prev","mergeProps","effect","memo","createMemo","createComponent","use","fn","arg","untrack","createRenderer","options","renderer","assertTruthy","condition","message","isProductionEnvironment","Error","import","meta","env","PROD","ElementNode","text","type","NodeType","log","getText","anchor","_queueDelete","rendered","remove","queueMicrotask","destroy","indexOf","solidRenderer","nodeOpts","rootNode","startLightning","rootId","startLightningRenderer","rendererOptions","init","lng","root","renderSync","Dynamic","p","others","splitProps","cached","component"],"mappings":";;;;;AAGO,MAAMA,IAAmC,GAAIC,KAAK,IAAA,CAAA,MAAA;EAAA,IAAAC,IAAA,GAAAC,aAAA,CAAA,MAAA,CAAA,CAAA;EAAAC,MAAA,CAAAF,IAAA,EAC7CD,KAAK,EAAA,KAAA,CAAA,CAAA;AAAA,EAAA,OAAAC,IAAA,CAAA;AAAA,CAChB;;ACFM,MAAMG,IAAmC,GAAIJ,KAAK,IAAA,CAAA,MAAA;EAAA,IAAAC,IAAA,GAAAC,aAAA,CAAA,MAAA,CAAA,CAAA;EAAAC,MAAA,CAAAF,IAAA,EAC7CD,KAAK,EAAA,KAAA,CAAA,CAAA;AAAA,EAAA,OAAAC,IAAA,CAAA;AAAA,CAChB;;ACHM,MAAM,CAACI,aAAa,EAAEC,gBAAgB,CAAC,GAAGC,YAAY,CAE3DC,SAAS,EAAC;AAEZC,MAAM,CAACH,gBAAgB,GAAGA,gBAAgB;;ACJ1C;AACA;AACA;AACO,SAASI,QAAQA,CAACC,KAAsB,GAAG,EAAE,EAAU;AAC5D,EAAA,IAAIC,SAAS,CAACD,KAAK,CAAC,EAAE;AACpB,IAAA,OAAOA,KAAK,CAAA;AACd,GAAA;AAEA,EAAA,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;AAC7B;AACA,IAAA,IAAIA,KAA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1
- export const View = (props) => (<node {...props}></node>);
@@ -1,4 +0,0 @@
1
- import { createSignal } from 'solid-js';
2
- import { Config } from '@lightningtv/core';
3
- export const [activeElement, setActiveElement] = createSignal(undefined);
4
- Config.setActiveElement = setActiveElement;
@@ -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 +0,0 @@
1
- export {};
@@ -1,56 +0,0 @@
1
- /* eslint-disable @typescript-eslint/unbound-method */
2
- import { createRenderer } from 'solid-js/universal';
3
- import { Config, startLightningRenderer } from '@lightningtv/core';
4
- import nodeOpts from './solidOpts.js';
5
- import { splitProps, createMemo, untrack, } from 'solid-js';
6
- const solidRenderer = createRenderer(nodeOpts);
7
- let renderer;
8
- export const rootNode = nodeOpts.createElement('App');
9
- export async function startLightning(options, rootId) {
10
- renderer = startLightningRenderer(options || Config.rendererOptions, rootId || 'app');
11
- return await renderer.init();
12
- }
13
- export const render = async function (code, node) {
14
- await startLightning(undefined, node);
15
- rootNode.lng = renderer.root;
16
- rootNode.rendered = true;
17
- // @ts-expect-error - code is jsx element and not SolidElement yet
18
- const dispose = solidRenderer.render(code, rootNode);
19
- return {
20
- dispose,
21
- rootNode,
22
- renderer,
23
- };
24
- };
25
- // used for playground - must be sync so user must await startLightning
26
- export const renderSync = function (code) {
27
- rootNode.lng = renderer.root;
28
- // @ts-expect-error - code is jsx element and not SolidElement yet
29
- return solidRenderer.render(code, rootNode);
30
- };
31
- export const { effect, memo, createComponent, createElement, createTextNode, insertNode, insert, spread, setProp, mergeProps, use, } = solidRenderer;
32
- /**
33
- * renders an arbitrary custom or native component and passes the other props
34
- * ```typescript
35
- * <Dynamic component={multiline() ? 'textarea' : 'input'} value={value()} />
36
- * ```
37
- * @description https://www.solidjs.com/docs/latest/api#dynamic
38
- */
39
- export function Dynamic(props) {
40
- const [p, others] = splitProps(props, ['component']);
41
- const cached = createMemo(() => p.component);
42
- return createMemo(() => {
43
- const component = cached();
44
- switch (typeof component) {
45
- case 'function':
46
- return untrack(() => component(others));
47
- case 'string': {
48
- const el = createElement(component);
49
- spread(el, others);
50
- return el;
51
- }
52
- default:
53
- break;
54
- }
55
- });
56
- }