@solidtv/solid 1.1.2 → 1.2.0
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/src/core/clickInspector.d.ts +1 -0
- package/dist/src/core/clickInspector.js +69 -0
- package/dist/src/core/clickInspector.js.map +1 -0
- package/dist/src/core/config.d.ts +8 -14
- package/dist/src/core/config.js +17 -3
- package/dist/src/core/config.js.map +1 -1
- package/dist/src/core/dom-renderer/domRenderer.d.ts +6 -1
- package/dist/src/core/dom-renderer/domRenderer.js +255 -67
- package/dist/src/core/dom-renderer/domRenderer.js.map +1 -1
- package/dist/src/core/dom-renderer/domRendererUtils.js +2 -2
- package/dist/src/core/dom-renderer/domRendererUtils.js.map +1 -1
- package/dist/src/core/elementNode.d.ts +30 -11
- package/dist/src/core/elementNode.js +113 -58
- package/dist/src/core/elementNode.js.map +1 -1
- package/dist/src/core/focusManager.d.ts +3 -9
- package/dist/src/core/focusManager.js +111 -101
- package/dist/src/core/focusManager.js.map +1 -1
- package/dist/src/core/intrinsicTypes.d.ts +2 -0
- package/dist/src/core/lightningInit.d.ts +1 -1
- package/dist/src/core/lightningInit.js +9 -9
- package/dist/src/core/lightningInit.js.map +1 -1
- package/dist/src/core/shaders.js +10 -10
- package/dist/src/core/shaders.js.map +1 -1
- package/dist/src/core/utils.d.ts +0 -1
- package/dist/src/core/utils.js +4 -5
- package/dist/src/core/utils.js.map +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/primitives/FPSCounter.jsx +5 -5
- package/dist/src/primitives/FPSCounter.jsx.map +1 -1
- package/dist/src/primitives/Image.jsx +6 -1
- package/dist/src/primitives/Image.jsx.map +1 -1
- package/dist/src/primitives/KeepAlive.jsx +13 -3
- package/dist/src/primitives/KeepAlive.jsx.map +1 -1
- package/dist/src/primitives/LazyImport.js +4 -2
- package/dist/src/primitives/LazyImport.js.map +1 -1
- package/dist/src/primitives/Preserve.jsx +10 -4
- package/dist/src/primitives/Preserve.jsx.map +1 -1
- package/dist/src/primitives/Suspense.jsx +7 -7
- package/dist/src/primitives/Suspense.jsx.map +1 -1
- package/dist/src/primitives/Virtual.jsx.map +1 -1
- package/dist/src/primitives/announcer/announcer.js +3 -2
- package/dist/src/primitives/announcer/announcer.js.map +1 -1
- package/dist/src/primitives/announcer/speech.js +2 -2
- package/dist/src/primitives/announcer/speech.js.map +1 -1
- package/dist/src/primitives/borderBox.jsx +2 -1
- package/dist/src/primitives/borderBox.jsx.map +1 -1
- package/dist/src/primitives/createTag.jsx +3 -3
- package/dist/src/primitives/createTag.jsx.map +1 -1
- package/dist/src/primitives/portal.jsx +4 -3
- package/dist/src/primitives/portal.jsx.map +1 -1
- package/dist/src/primitives/useFocusManager.d.ts +1 -5
- package/dist/src/primitives/useFocusManager.js +1 -20
- package/dist/src/primitives/useFocusManager.js.map +1 -1
- package/dist/src/primitives/useMouse.js +4 -4
- package/dist/src/primitives/useMouse.js.map +1 -1
- package/dist/src/primitives/utils/chainFunctions.js +35 -9
- package/dist/src/primitives/utils/chainFunctions.js.map +1 -1
- package/dist/src/primitives/utils/createBlurredImage.js +57 -37
- package/dist/src/primitives/utils/createBlurredImage.js.map +1 -1
- package/dist/src/primitives/utils/handleNavigation.js +8 -6
- package/dist/src/primitives/utils/handleNavigation.js.map +1 -1
- package/dist/src/primitives/utils/withScrolling.js +1 -3
- package/dist/src/primitives/utils/withScrolling.js.map +1 -1
- package/dist/src/render.d.ts +1 -1
- package/dist/src/render.js +3 -4
- package/dist/src/render.js.map +1 -1
- package/dist/src/solidOpts.d.ts +1 -1
- package/dist/src/solidOpts.js +8 -25
- package/dist/src/solidOpts.js.map +1 -1
- package/dist/src/utils.js +10 -5
- package/dist/src/utils.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/docs/README.md +2 -2
- package/package.json +28 -29
- package/src/core/clickInspector.ts +77 -0
- package/src/core/config.ts +15 -22
- package/src/core/dom-renderer/domRenderer.ts +308 -89
- package/src/core/dom-renderer/domRendererTypes.ts +9 -6
- package/src/core/dom-renderer/domRendererUtils.ts +2 -2
- package/src/core/elementNode.ts +145 -66
- package/src/core/focusManager.ts +171 -145
- package/src/core/intrinsicTypes.ts +19 -7
- package/src/core/lightningInit.ts +23 -21
- package/src/core/shaders.ts +10 -10
- package/src/core/utils.ts +4 -7
- package/src/index.ts +1 -1
- package/src/primitives/FPSCounter.tsx +14 -10
- package/src/primitives/Image.tsx +18 -9
- package/src/primitives/KeepAlive.tsx +18 -10
- package/src/primitives/LazyImport.ts +8 -6
- package/src/primitives/Preserve.tsx +13 -8
- package/src/primitives/Suspense.tsx +10 -9
- package/src/primitives/Virtual.tsx +1 -8
- package/src/primitives/announcer/announcer.ts +3 -2
- package/src/primitives/announcer/speech.ts +2 -2
- package/src/primitives/borderBox.tsx +7 -3
- package/src/primitives/createTag.tsx +23 -17
- package/src/primitives/portal.tsx +20 -10
- package/src/primitives/useFocusManager.ts +5 -44
- package/src/primitives/useMouse.ts +4 -4
- package/src/primitives/utils/chainFunctions.ts +31 -11
- package/src/primitives/utils/createBlurredImage.ts +58 -40
- package/src/primitives/utils/handleNavigation.ts +9 -7
- package/src/primitives/utils/withScrolling.ts +3 -5
- package/src/render.ts +5 -7
- package/src/solidOpts.ts +11 -30
- package/src/types.ts +0 -1
- package/src/utils.ts +12 -10
- package/dist/src/activeElement.d.ts +0 -2
- package/dist/src/activeElement.js +0 -3
- package/dist/src/activeElement.js.map +0 -1
- package/src/activeElement.ts +0 -5
|
@@ -100,32 +100,38 @@ function applyVerticalBlur(
|
|
|
100
100
|
half: number,
|
|
101
101
|
): void {
|
|
102
102
|
for (let y = 0; y < height; y++) {
|
|
103
|
+
const kStart = -y < -half ? -half : -y;
|
|
104
|
+
const kEnd = height - 1 - y < half ? height - 1 - y : half;
|
|
105
|
+
|
|
106
|
+
// Kernel sums to 1; only edge rows need a renormalization factor.
|
|
107
|
+
let invWeight = 1;
|
|
108
|
+
if (kStart !== -half || kEnd !== half) {
|
|
109
|
+
let weightSum = 0;
|
|
110
|
+
for (let k = kStart; k <= kEnd; k++) weightSum += kernel[k + half]!;
|
|
111
|
+
invWeight = 1 / weightSum;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const rowBase = y * width;
|
|
103
115
|
for (let x = 0; x < width; x++) {
|
|
104
116
|
let r = 0,
|
|
105
117
|
g = 0,
|
|
106
118
|
b = 0,
|
|
107
119
|
a = 0;
|
|
108
|
-
let weightSum = 0;
|
|
109
120
|
|
|
110
|
-
for (let ky =
|
|
111
|
-
const
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
g += input[pixelIndex + 1]! * weight;
|
|
118
|
-
b += input[pixelIndex + 2]! * weight;
|
|
119
|
-
a += input[pixelIndex + 3]! * weight;
|
|
120
|
-
weightSum += weight;
|
|
121
|
-
}
|
|
121
|
+
for (let ky = kStart; ky <= kEnd; ky++) {
|
|
122
|
+
const pixelIndex = ((y + ky) * width + x) * 4;
|
|
123
|
+
const weight = kernel[ky + half]!;
|
|
124
|
+
r += input[pixelIndex]! * weight;
|
|
125
|
+
g += input[pixelIndex + 1]! * weight;
|
|
126
|
+
b += input[pixelIndex + 2]! * weight;
|
|
127
|
+
a += input[pixelIndex + 3]! * weight;
|
|
122
128
|
}
|
|
123
129
|
|
|
124
|
-
const outputIndex = (
|
|
125
|
-
output[outputIndex] = r
|
|
126
|
-
output[outputIndex + 1] = g
|
|
127
|
-
output[outputIndex + 2] = b
|
|
128
|
-
output[outputIndex + 3] = a
|
|
130
|
+
const outputIndex = (rowBase + x) * 4;
|
|
131
|
+
output[outputIndex] = r * invWeight;
|
|
132
|
+
output[outputIndex + 1] = g * invWeight;
|
|
133
|
+
output[outputIndex + 2] = b * invWeight;
|
|
134
|
+
output[outputIndex + 3] = a * invWeight;
|
|
129
135
|
}
|
|
130
136
|
}
|
|
131
137
|
}
|
|
@@ -147,33 +153,46 @@ function applyHorizontalBlur(
|
|
|
147
153
|
kernel: Readonly<GaussianKernel>,
|
|
148
154
|
half: number,
|
|
149
155
|
): void {
|
|
156
|
+
// Precompute per-column inverse weight sums; kernel sums to 1 in the interior.
|
|
157
|
+
const invWeights = new Float64Array(width);
|
|
158
|
+
for (let x = 0; x < width; x++) {
|
|
159
|
+
const kStart = -x < -half ? -half : -x;
|
|
160
|
+
const kEnd = width - 1 - x < half ? width - 1 - x : half;
|
|
161
|
+
if (kStart === -half && kEnd === half) {
|
|
162
|
+
invWeights[x] = 1;
|
|
163
|
+
} else {
|
|
164
|
+
let weightSum = 0;
|
|
165
|
+
for (let k = kStart; k <= kEnd; k++) weightSum += kernel[k + half]!;
|
|
166
|
+
invWeights[x] = 1 / weightSum;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
150
170
|
for (let y = 0; y < height; y++) {
|
|
171
|
+
const rowBase = y * width;
|
|
151
172
|
for (let x = 0; x < width; x++) {
|
|
173
|
+
const kStart = -x < -half ? -half : -x;
|
|
174
|
+
const kEnd = width - 1 - x < half ? width - 1 - x : half;
|
|
175
|
+
|
|
152
176
|
let r = 0,
|
|
153
177
|
g = 0,
|
|
154
178
|
b = 0,
|
|
155
179
|
a = 0;
|
|
156
|
-
let weightSum = 0;
|
|
157
180
|
|
|
158
|
-
for (let kx =
|
|
159
|
-
const
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
g += input[pixelIndex + 1]! * weight;
|
|
166
|
-
b += input[pixelIndex + 2]! * weight;
|
|
167
|
-
a += input[pixelIndex + 3]! * weight;
|
|
168
|
-
weightSum += weight;
|
|
169
|
-
}
|
|
181
|
+
for (let kx = kStart; kx <= kEnd; kx++) {
|
|
182
|
+
const pixelIndex = (rowBase + x + kx) * 4;
|
|
183
|
+
const weight = kernel[kx + half]!;
|
|
184
|
+
r += input[pixelIndex]! * weight;
|
|
185
|
+
g += input[pixelIndex + 1]! * weight;
|
|
186
|
+
b += input[pixelIndex + 2]! * weight;
|
|
187
|
+
a += input[pixelIndex + 3]! * weight;
|
|
170
188
|
}
|
|
171
189
|
|
|
172
|
-
const
|
|
173
|
-
|
|
174
|
-
output[outputIndex
|
|
175
|
-
output[outputIndex +
|
|
176
|
-
output[outputIndex +
|
|
190
|
+
const invWeight = invWeights[x]!;
|
|
191
|
+
const outputIndex = (rowBase + x) * 4;
|
|
192
|
+
output[outputIndex] = r * invWeight;
|
|
193
|
+
output[outputIndex + 1] = g * invWeight;
|
|
194
|
+
output[outputIndex + 2] = b * invWeight;
|
|
195
|
+
output[outputIndex + 3] = a * invWeight;
|
|
177
196
|
}
|
|
178
197
|
}
|
|
179
198
|
}
|
|
@@ -215,15 +234,14 @@ function gaussianBlurConvolution(
|
|
|
215
234
|
): ImageData {
|
|
216
235
|
const { data } = imageData;
|
|
217
236
|
const { width, height } = dimensions;
|
|
237
|
+
const tempData = new Uint8ClampedArray(data.length);
|
|
218
238
|
const output = new Uint8ClampedArray(data.length);
|
|
219
239
|
|
|
220
240
|
const kernelSize = Math.ceil(radius * 2) * 2 + 1;
|
|
221
241
|
const kernel = generateGaussianKernel(kernelSize, radius);
|
|
222
|
-
const half =
|
|
223
|
-
|
|
224
|
-
applyHorizontalBlur(data, output, width, height, kernel, half);
|
|
242
|
+
const half = (kernelSize - 1) >> 1;
|
|
225
243
|
|
|
226
|
-
|
|
244
|
+
applyHorizontalBlur(data, tempData, width, height, kernel, half);
|
|
227
245
|
applyVerticalBlur(tempData, output, width, height, kernel, half);
|
|
228
246
|
|
|
229
247
|
return new ImageData(output, width, height);
|
|
@@ -30,7 +30,7 @@ export const defaultTransitionUp = {
|
|
|
30
30
|
},
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
-
function idxInArray(idx: number, arr: readonly
|
|
33
|
+
function idxInArray(idx: number, arr: readonly unknown[]): boolean {
|
|
34
34
|
return idx >= 0 && idx < arr.length;
|
|
35
35
|
}
|
|
36
36
|
|
|
@@ -220,10 +220,10 @@ export function moveSelection(
|
|
|
220
220
|
return selectChild(el, selected);
|
|
221
221
|
}
|
|
222
222
|
|
|
223
|
-
function
|
|
224
|
-
const dx =
|
|
225
|
-
const dy =
|
|
226
|
-
return
|
|
223
|
+
function squaredDistanceBetweenRectCenters(a: lng.Rect, b: lng.Rect): number {
|
|
224
|
+
const dx = a.x + a.width / 2 - (b.x + b.width / 2);
|
|
225
|
+
const dy = a.y + a.height / 2 - (b.y + b.height / 2);
|
|
226
|
+
return dx * dx + dy * dy;
|
|
227
227
|
}
|
|
228
228
|
|
|
229
229
|
function findClosestFocusableChildIdx(
|
|
@@ -238,12 +238,14 @@ function findClosestFocusableChildIdx(
|
|
|
238
238
|
let closestIdx = -1;
|
|
239
239
|
let closestDist = Infinity;
|
|
240
240
|
|
|
241
|
-
|
|
241
|
+
const children = el.children;
|
|
242
|
+
for (let idx = 0; idx < children.length; idx++) {
|
|
243
|
+
const child = children[idx]!;
|
|
242
244
|
if (!child.skipFocus) {
|
|
243
245
|
lng.getElementScreenRect(child, el, childRect);
|
|
244
246
|
childRect.x += elRect.x;
|
|
245
247
|
childRect.y += elRect.y;
|
|
246
|
-
const distance =
|
|
248
|
+
const distance = squaredDistanceBetweenRectCenters(prevRect, childRect);
|
|
247
249
|
if (distance < closestDist) {
|
|
248
250
|
closestDist = distance;
|
|
249
251
|
closestIdx = idx;
|
|
@@ -31,9 +31,9 @@ export interface ScrollableElement extends ElementNode {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
// From the renderer, not exported
|
|
34
|
-
const InViewPort = 8;
|
|
34
|
+
const InViewPort = 8 as const;
|
|
35
35
|
const isNotShown = (node: ElementNode | ElementText) => {
|
|
36
|
-
return node.lng.renderState !== InViewPort;
|
|
36
|
+
return (node.lng.renderState as number) !== InViewPort;
|
|
37
37
|
};
|
|
38
38
|
/*
|
|
39
39
|
Auto Scrolling starts scrolling right away until the last item is shown. Keeping a full view of the list.
|
|
@@ -114,9 +114,7 @@ export function withScrolling(isRow: boolean): Scroller {
|
|
|
114
114
|
: Math.max(targetPosition, componentRef[axis]);
|
|
115
115
|
componentRef.offset = componentRef.offset ?? rootPosition;
|
|
116
116
|
const offset = componentRef.offset;
|
|
117
|
-
selectedElement =
|
|
118
|
-
selectedElement ||
|
|
119
|
-
(componentRef.children[selected] as ElementNode | undefined);
|
|
117
|
+
selectedElement = selectedElement || componentRef.children[selected];
|
|
120
118
|
|
|
121
119
|
if (!selectedElement) {
|
|
122
120
|
return;
|
package/src/render.ts
CHANGED
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
type Component,
|
|
19
19
|
} from 'solid-js';
|
|
20
20
|
import type { SolidNode } from './types.js';
|
|
21
|
-
import { activeElement
|
|
21
|
+
import { activeElement } from './core/focusManager.js';
|
|
22
22
|
|
|
23
23
|
const solidRenderer = solidCreateRenderer<SolidNode>(nodeOpts);
|
|
24
24
|
|
|
@@ -34,12 +34,9 @@ export function createRenderer(
|
|
|
34
34
|
rendererOptions?: RendererMainSettings | DomRendererMainSettings,
|
|
35
35
|
node?: HTMLElement | string,
|
|
36
36
|
) {
|
|
37
|
-
const options =
|
|
38
|
-
rendererOptions || (Config.rendererOptions as RendererMainSettings);
|
|
37
|
+
const options = rendererOptions || Config.rendererOptions;
|
|
39
38
|
|
|
40
|
-
renderer = startLightningRenderer(options
|
|
41
|
-
//Prevent this from happening automatically
|
|
42
|
-
Config.setActiveElement = setActiveElement;
|
|
39
|
+
renderer = startLightningRenderer(options!, node || 'app');
|
|
43
40
|
rootNode.lng = renderer.root!;
|
|
44
41
|
rootNode.rendered = true;
|
|
45
42
|
renderer.on('idle', () => {
|
|
@@ -135,6 +132,7 @@ export function Dynamic<T extends Record<string, any>>(
|
|
|
135
132
|
|
|
136
133
|
case 'string': {
|
|
137
134
|
const el = createElement(component);
|
|
135
|
+
(el as { componentName?: string }).componentName = component;
|
|
138
136
|
spread(el, others);
|
|
139
137
|
return el;
|
|
140
138
|
}
|
|
@@ -158,7 +156,7 @@ export const Text = (props: TextProps) => {
|
|
|
158
156
|
return el as unknown as JSXElement;
|
|
159
157
|
};
|
|
160
158
|
|
|
161
|
-
export function registerDefaultShader(
|
|
159
|
+
export function registerDefaultShader(_name: string, _shader: any) {
|
|
162
160
|
// noop for v2
|
|
163
161
|
// renderer.stage.shManager.registerShaderType('rounded', Rounded);
|
|
164
162
|
}
|
package/src/solidOpts.ts
CHANGED
|
@@ -5,31 +5,10 @@ import {
|
|
|
5
5
|
TextNode,
|
|
6
6
|
log,
|
|
7
7
|
type ElementText,
|
|
8
|
-
|
|
9
|
-
schedulePostMutation,
|
|
8
|
+
enqueueDelete,
|
|
10
9
|
} from './core/index.js';
|
|
11
10
|
import type { SolidNode, SolidRendererOptions } from './types.js';
|
|
12
11
|
|
|
13
|
-
Object.defineProperty(ElementNode.prototype, 'preserve', {
|
|
14
|
-
get(): boolean | undefined {
|
|
15
|
-
return this._queueDelete === 0;
|
|
16
|
-
},
|
|
17
|
-
set(v: boolean) {
|
|
18
|
-
this._queueDelete = v ? 0 : undefined;
|
|
19
|
-
},
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
function pushDeleteQueue(node: ElementNode, n: number): void {
|
|
23
|
-
if (node._queueDelete === undefined) {
|
|
24
|
-
node._queueDelete = n;
|
|
25
|
-
if (elementDeleteQueue.push(node) === 1) {
|
|
26
|
-
schedulePostMutation();
|
|
27
|
-
}
|
|
28
|
-
} else {
|
|
29
|
-
node._queueDelete += n;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
12
|
export default {
|
|
34
13
|
createElement(name: string): ElementNode {
|
|
35
14
|
return new ElementNode(name);
|
|
@@ -45,7 +24,7 @@ export default {
|
|
|
45
24
|
assertTruthy(parent);
|
|
46
25
|
parent.text = parent.getText();
|
|
47
26
|
},
|
|
48
|
-
setProperty(node: ElementNode, name: string, value: any
|
|
27
|
+
setProperty(node: ElementNode, name: string, value: any): void {
|
|
49
28
|
node[name] = value;
|
|
50
29
|
},
|
|
51
30
|
insertNode(parent: ElementNode, node: SolidNode, anchor: SolidNode): void {
|
|
@@ -55,9 +34,11 @@ export default {
|
|
|
55
34
|
parent.insertChild(node, anchor);
|
|
56
35
|
|
|
57
36
|
if (node instanceof ElementNode) {
|
|
58
|
-
node.parent!.rendered
|
|
37
|
+
if (node.parent!.rendered) {
|
|
38
|
+
node.render(true);
|
|
39
|
+
}
|
|
59
40
|
if (prevParent !== undefined) {
|
|
60
|
-
|
|
41
|
+
enqueueDelete(node, 1);
|
|
61
42
|
}
|
|
62
43
|
} else if (isElementText(parent)) {
|
|
63
44
|
// TextNodes can be placed outside of <text> nodes when <Show> is used as placeholder
|
|
@@ -73,7 +54,7 @@ export default {
|
|
|
73
54
|
parent.removeChild(node);
|
|
74
55
|
|
|
75
56
|
if (node instanceof ElementNode) {
|
|
76
|
-
|
|
57
|
+
enqueueDelete(node, -1);
|
|
77
58
|
} else if (isElementText(parent)) {
|
|
78
59
|
// TextNodes can be placed outside of <text> nodes when <Show> is used as placeholder
|
|
79
60
|
parent.text = parent.getText();
|
|
@@ -83,13 +64,13 @@ export default {
|
|
|
83
64
|
return node.parent;
|
|
84
65
|
},
|
|
85
66
|
getFirstChild(node: ElementNode): SolidNode | undefined {
|
|
86
|
-
return node.children[0]
|
|
67
|
+
return node.children[0];
|
|
87
68
|
},
|
|
88
69
|
getNextSibling(node: SolidNode): SolidNode | undefined {
|
|
89
|
-
const children = node.parent!.children || [];
|
|
90
|
-
const index = children.indexOf(node
|
|
70
|
+
const children = (node.parent!.children || []) as SolidNode[];
|
|
71
|
+
const index = children.indexOf(node) + 1;
|
|
91
72
|
if (index < children.length) {
|
|
92
|
-
return children[index]
|
|
73
|
+
return children[index];
|
|
93
74
|
}
|
|
94
75
|
return undefined;
|
|
95
76
|
},
|
package/src/types.ts
CHANGED
package/src/utils.ts
CHANGED
|
@@ -19,16 +19,18 @@ export function hexColor(color: string | number = ''): number {
|
|
|
19
19
|
|
|
20
20
|
if (typeof color === 'string') {
|
|
21
21
|
// Renderer expects RGBA values
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
22
|
+
let hex: string;
|
|
23
|
+
if (color.charCodeAt(0) === 35 /* '#' */) {
|
|
24
|
+
hex = color.length === 7 ? color.slice(1) + 'ff' : color.slice(1);
|
|
25
|
+
} else if (
|
|
26
|
+
color.charCodeAt(0) === 48 &&
|
|
27
|
+
color.charCodeAt(1) === 120 /* '0x' */
|
|
28
|
+
) {
|
|
29
|
+
hex = color.slice(2);
|
|
30
|
+
} else {
|
|
31
|
+
hex = color.length === 6 ? color + 'ff' : color;
|
|
30
32
|
}
|
|
31
|
-
return
|
|
33
|
+
return parseInt(hex, 16);
|
|
32
34
|
}
|
|
33
35
|
|
|
34
36
|
return 0x00000000;
|
|
@@ -101,7 +103,7 @@ export function getWebglSupportedVersions(
|
|
|
101
103
|
(context instanceof WebGLRenderingContext ||
|
|
102
104
|
context instanceof WebGL2RenderingContext ||
|
|
103
105
|
('getParameter' in context &&
|
|
104
|
-
typeof
|
|
106
|
+
typeof context.getParameter === 'function'))
|
|
105
107
|
);
|
|
106
108
|
} catch {
|
|
107
109
|
return false;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"activeElement.js","sourceRoot":"","sources":["../../src/activeElement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,MAAM,CAAC,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,YAAY,CAE3D,SAAS,CAAC,CAAC"}
|