@lightningtv/solid 3.0.0-2 → 3.0.0-20

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.
Files changed (126) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +6 -0
  3. package/dist/src/jsx-runtime.d.ts +1 -3
  4. package/dist/src/primitives/Column.jsx +9 -10
  5. package/dist/src/primitives/Column.jsx.map +1 -1
  6. package/dist/src/primitives/Grid.d.ts +15 -6
  7. package/dist/src/primitives/Grid.jsx +35 -22
  8. package/dist/src/primitives/Grid.jsx.map +1 -1
  9. package/dist/src/primitives/Image.d.ts +8 -0
  10. package/dist/src/primitives/Image.jsx +24 -0
  11. package/dist/src/primitives/Image.jsx.map +1 -0
  12. package/dist/src/primitives/KeepAlive.d.ts +30 -0
  13. package/dist/src/primitives/KeepAlive.jsx +77 -0
  14. package/dist/src/primitives/KeepAlive.jsx.map +1 -0
  15. package/dist/src/primitives/Lazy.d.ts +8 -7
  16. package/dist/src/primitives/Lazy.jsx +49 -23
  17. package/dist/src/primitives/Lazy.jsx.map +1 -1
  18. package/dist/src/primitives/Marquee.d.ts +64 -0
  19. package/dist/src/primitives/Marquee.jsx +86 -0
  20. package/dist/src/primitives/Marquee.jsx.map +1 -0
  21. package/dist/src/primitives/Preserve.d.ts +4 -0
  22. package/dist/src/primitives/Preserve.jsx +11 -0
  23. package/dist/src/primitives/Preserve.jsx.map +1 -0
  24. package/dist/src/primitives/Row.jsx +9 -10
  25. package/dist/src/primitives/Row.jsx.map +1 -1
  26. package/dist/src/primitives/Suspense.d.ts +22 -0
  27. package/dist/src/primitives/Suspense.jsx +33 -0
  28. package/dist/src/primitives/Suspense.jsx.map +1 -0
  29. package/dist/src/primitives/Virtual.d.ts +18 -0
  30. package/dist/src/primitives/Virtual.jsx +434 -0
  31. package/dist/src/primitives/Virtual.jsx.map +1 -0
  32. package/dist/src/primitives/VirtualGrid.d.ts +13 -0
  33. package/dist/src/primitives/VirtualGrid.jsx +139 -0
  34. package/dist/src/primitives/VirtualGrid.jsx.map +1 -0
  35. package/dist/src/primitives/VirtualList.d.ts +11 -0
  36. package/dist/src/primitives/VirtualList.jsx +96 -0
  37. package/dist/src/primitives/VirtualList.jsx.map +1 -0
  38. package/dist/src/primitives/VirtualRow.d.ts +13 -0
  39. package/dist/src/primitives/VirtualRow.jsx +97 -0
  40. package/dist/src/primitives/VirtualRow.jsx.map +1 -0
  41. package/dist/src/primitives/Visible.d.ts +0 -1
  42. package/dist/src/primitives/Visible.jsx +1 -1
  43. package/dist/src/primitives/Visible.jsx.map +1 -1
  44. package/dist/src/primitives/announcer/announcer.d.ts +2 -0
  45. package/dist/src/primitives/announcer/announcer.js +7 -5
  46. package/dist/src/primitives/announcer/announcer.js.map +1 -1
  47. package/dist/src/primitives/announcer/index.d.ts +5 -1
  48. package/dist/src/primitives/announcer/index.js +8 -2
  49. package/dist/src/primitives/announcer/index.js.map +1 -1
  50. package/dist/src/primitives/announcer/speech.d.ts +2 -2
  51. package/dist/src/primitives/announcer/speech.js +157 -28
  52. package/dist/src/primitives/announcer/speech.js.map +1 -1
  53. package/dist/src/primitives/createFocusStack.d.ts +4 -4
  54. package/dist/src/primitives/createFocusStack.jsx +15 -6
  55. package/dist/src/primitives/createFocusStack.jsx.map +1 -1
  56. package/dist/src/primitives/createTag.d.ts +8 -0
  57. package/dist/src/primitives/createTag.jsx +20 -0
  58. package/dist/src/primitives/createTag.jsx.map +1 -0
  59. package/dist/src/primitives/index.d.ts +13 -3
  60. package/dist/src/primitives/index.js +13 -3
  61. package/dist/src/primitives/index.js.map +1 -1
  62. package/dist/src/primitives/types.d.ts +3 -0
  63. package/dist/src/primitives/useHold.d.ts +27 -0
  64. package/dist/src/primitives/useHold.js +54 -0
  65. package/dist/src/primitives/useHold.js.map +1 -0
  66. package/dist/src/primitives/useMouse.d.ts +24 -1
  67. package/dist/src/primitives/useMouse.js +153 -47
  68. package/dist/src/primitives/useMouse.js.map +1 -1
  69. package/dist/src/primitives/utils/chainFunctions.d.ts +30 -4
  70. package/dist/src/primitives/utils/chainFunctions.js +14 -3
  71. package/dist/src/primitives/utils/chainFunctions.js.map +1 -1
  72. package/dist/src/primitives/utils/createBlurredImage.d.ts +56 -0
  73. package/dist/src/primitives/utils/createBlurredImage.js +223 -0
  74. package/dist/src/primitives/utils/createBlurredImage.js.map +1 -0
  75. package/dist/src/primitives/utils/createSpriteMap.d.ts +2 -2
  76. package/dist/src/primitives/utils/createSpriteMap.js.map +1 -1
  77. package/dist/src/primitives/utils/handleNavigation.d.ts +85 -5
  78. package/dist/src/primitives/utils/handleNavigation.js +242 -69
  79. package/dist/src/primitives/utils/handleNavigation.js.map +1 -1
  80. package/dist/src/primitives/utils/withScrolling.d.ts +8 -1
  81. package/dist/src/primitives/utils/withScrolling.js +25 -6
  82. package/dist/src/primitives/utils/withScrolling.js.map +1 -1
  83. package/dist/src/render.d.ts +6 -5
  84. package/dist/src/render.js +4 -0
  85. package/dist/src/render.js.map +1 -1
  86. package/dist/src/solidOpts.d.ts +3 -2
  87. package/dist/src/solidOpts.js +31 -15
  88. package/dist/src/solidOpts.js.map +1 -1
  89. package/dist/src/universal.d.ts +25 -0
  90. package/dist/src/universal.js +232 -0
  91. package/dist/src/universal.js.map +1 -0
  92. package/dist/src/utils.d.ts +2 -0
  93. package/dist/src/utils.js +8 -0
  94. package/dist/src/utils.js.map +1 -1
  95. package/dist/tsconfig.tsbuildinfo +1 -1
  96. package/jsx-runtime.d.ts +2 -4
  97. package/package.json +19 -10
  98. package/src/primitives/Column.tsx +10 -12
  99. package/src/primitives/Grid.tsx +57 -33
  100. package/src/primitives/Image.tsx +36 -0
  101. package/src/primitives/KeepAlive.tsx +124 -0
  102. package/src/primitives/Lazy.tsx +60 -37
  103. package/src/primitives/Marquee.tsx +149 -0
  104. package/src/primitives/Preserve.tsx +18 -0
  105. package/src/primitives/Row.tsx +11 -12
  106. package/src/primitives/Suspense.tsx +39 -0
  107. package/src/primitives/Virtual.tsx +478 -0
  108. package/src/primitives/VirtualGrid.tsx +199 -0
  109. package/src/primitives/Visible.tsx +1 -2
  110. package/src/primitives/announcer/announcer.ts +16 -10
  111. package/src/primitives/announcer/index.ts +12 -2
  112. package/src/primitives/announcer/speech.ts +188 -27
  113. package/src/primitives/createFocusStack.tsx +18 -7
  114. package/src/primitives/createTag.tsx +31 -0
  115. package/src/primitives/index.ts +17 -3
  116. package/src/primitives/types.ts +10 -0
  117. package/src/primitives/useHold.ts +69 -0
  118. package/src/primitives/useMouse.ts +283 -66
  119. package/src/primitives/utils/chainFunctions.ts +40 -9
  120. package/src/primitives/utils/createBlurredImage.ts +366 -0
  121. package/src/primitives/utils/createSpriteMap.ts +6 -4
  122. package/src/primitives/utils/handleNavigation.ts +307 -84
  123. package/src/primitives/utils/withScrolling.ts +47 -16
  124. package/src/render.ts +9 -7
  125. package/src/solidOpts.ts +34 -19
  126. package/src/utils.ts +10 -0
@@ -1,4 +1,30 @@
1
- type ChainableFunction = (...args: unknown[]) => unknown;
2
- export declare function chainFunctions(...args: ChainableFunction[]): ChainableFunction;
3
- export declare function chainFunctions<T>(...args: (ChainableFunction | T)[]): T;
4
- export {};
1
+ import * as s from 'solid-js';
2
+ export type AnyFunction = (this: any, ...args: any[]) => any;
3
+ /**
4
+ * take an array of functions and if you return `true` from a function, it will stop the chain
5
+ * @param fns list of functions to chain together, can be `undefined`, `null`, or `false` to skip them
6
+ * @returns a function that will call each function in the list until one returns `true` or all functions are called.
7
+ * If no functions are provided, it will return `undefined`.
8
+ *
9
+ * @example
10
+ * ```tsx
11
+ * function Button (props: NodeProps) {
12
+ * function onEnter (el: ElementNode) {...}
13
+ * return <view onEnter={chainFunctions(props.onEnter, onEnter)} />
14
+ * }
15
+ * ```
16
+ */
17
+ export declare function chainFunctions<T extends AnyFunction>(...fns: T[]): T;
18
+ export declare function chainFunctions<T extends AnyFunction>(...fns: (T | undefined | null | false)[]): T | undefined;
19
+ /**
20
+ * Utility for chaining multiple `ref` assignments with `props.ref` forwarding.
21
+ * @param refs list of ref setters. Can be a `props.ref` prop for ref forwarding or a setter to a local variable (`el => ref = el`).
22
+ * @example
23
+ * ```tsx
24
+ * function Button (props: NodeProps) {
25
+ * let localRef: ElementNode | undefined
26
+ * return <view ref={chainRefs(props.ref, el => localRef = el)} />
27
+ * }
28
+ * ```
29
+ */
30
+ export declare const chainRefs: <T>(...refs: (s.Ref<T> | undefined)[]) => (el: T) => void;
@@ -1,6 +1,5 @@
1
- // take an array of functions and if you return true from a function, it will stop the chain
2
- export function chainFunctions(...args) {
3
- const onlyFunctions = args.filter((func) => typeof func === 'function');
1
+ export function chainFunctions(...fns) {
2
+ const onlyFunctions = fns.filter((func) => typeof func === 'function');
4
3
  if (onlyFunctions.length === 0) {
5
4
  return undefined;
6
5
  }
@@ -18,4 +17,16 @@ export function chainFunctions(...args) {
18
17
  return result;
19
18
  };
20
19
  }
20
+ /**
21
+ * Utility for chaining multiple `ref` assignments with `props.ref` forwarding.
22
+ * @param refs list of ref setters. Can be a `props.ref` prop for ref forwarding or a setter to a local variable (`el => ref = el`).
23
+ * @example
24
+ * ```tsx
25
+ * function Button (props: NodeProps) {
26
+ * let localRef: ElementNode | undefined
27
+ * return <view ref={chainRefs(props.ref, el => localRef = el)} />
28
+ * }
29
+ * ```
30
+ */
31
+ export const chainRefs = chainFunctions;
21
32
  //# sourceMappingURL=chainFunctions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"chainFunctions.js","sourceRoot":"","sources":["../../../../src/primitives/utils/chainFunctions.ts"],"names":[],"mappings":"AAKA,4FAA4F;AAC5F,MAAM,UAAU,cAAc,CAC5B,GAAG,IAA+B;IAElC,MAAM,aAAa,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,IAAI,KAAK,UAAU,CAAC,CAAC;IACxE,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC/B,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,IAAI,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GAAG,cAEL,CAAC"}
@@ -0,0 +1,56 @@
1
+ import { type Accessor, type Resource } from 'solid-js';
2
+ /**
3
+ * Represents a valid image source that can be used for blurring
4
+ */
5
+ type ImageSource = string | URL;
6
+ /**
7
+ * Represents a valid image source or null/undefined
8
+ */
9
+ type NullableImageSource = ImageSource | null | undefined;
10
+ /**
11
+ * Configuration options for Gaussian blur operation
12
+ */
13
+ interface BlurOptions {
14
+ /**
15
+ * The blur radius in pixels
16
+ * @default 10
17
+ */
18
+ readonly radius?: number;
19
+ /**
20
+ * CORS setting for image loading
21
+ * @default 'anonymous'
22
+ */
23
+ readonly crossOrigin?: 'anonymous' | 'use-credentials' | '';
24
+ /**
25
+ * The resolution of the output image in pixels
26
+ * @default 1
27
+ */
28
+ readonly resolution?: number;
29
+ }
30
+ /**
31
+ * Type for the resource return value from createBlurredImage
32
+ */
33
+ type BlurredImageResource<T extends NullableImageSource> = Resource<T extends null | undefined ? null : string>;
34
+ /**
35
+ * Applies Gaussian blur to an image URL
36
+ * @param imageUrl - Image source (string or URL)
37
+ * @param options - Blur configuration options
38
+ * @returns Promise resolving to data URL of blurred image
39
+ * @throws {Error} If image fails to load or blur operation fails
40
+ */
41
+ export declare function applyGaussianBlur<TSource extends ImageSource>(imageUrl: TSource, options?: Readonly<BlurOptions>): Promise<string>;
42
+ /**
43
+ * Hook to create a blurred image resource
44
+ * @param imageUrl - Accessor function returning image source or null/undefined
45
+ * @param options - Blur configuration options
46
+ * @returns Resource containing blurred image data URL or null
47
+ * @template TSource - Type of image source (string, URL, or null/undefined)
48
+ *
49
+ * @example
50
+ * ```ts
51
+ * const imageUrl = () => 'https://example.com/image.jpg';
52
+ * const blurred = createBlurredImage(imageUrl, { radius: 15 });
53
+ * ```
54
+ */
55
+ export declare function createBlurredImage<TSource extends NullableImageSource>(imageUrl: Accessor<TSource>, options?: Readonly<BlurOptions>): BlurredImageResource<TSource>;
56
+ export {};
@@ -0,0 +1,223 @@
1
+ import { createResource } from 'solid-js';
2
+ /**
3
+ * Default blur options
4
+ */
5
+ const DEFAULT_BLUR_OPTIONS = {
6
+ radius: 10,
7
+ crossOrigin: 'anonymous',
8
+ resolution: 1,
9
+ };
10
+ /**
11
+ * Validates that radius is a positive number
12
+ */
13
+ function isValidRadius(radius) {
14
+ return radius > 0 && Number.isFinite(radius);
15
+ }
16
+ /**
17
+ * Ensures a resolution is a positive number
18
+ */
19
+ function isValidResolution(resolution) {
20
+ return resolution > 0 && resolution <= 1 && Number.isFinite(resolution);
21
+ }
22
+ /**
23
+ * Applies vertical Gaussian blur to image data
24
+ * @param input - Input pixel data
25
+ * @param output - Output pixel data buffer
26
+ * @param width - Image width
27
+ * @param height - Image height
28
+ * @param kernel - Gaussian kernel weights
29
+ * @param half - Half of kernel size
30
+ */
31
+ function applyVerticalBlur(input, output, width, height, kernel, half) {
32
+ for (let y = 0; y < height; y++) {
33
+ for (let x = 0; x < width; x++) {
34
+ let r = 0, g = 0, b = 0, a = 0;
35
+ let weightSum = 0;
36
+ for (let ky = -half; ky <= half; ky++) {
37
+ const py = y + ky;
38
+ if (py >= 0 && py < height) {
39
+ const pixelIndex = (py * width + x) * 4;
40
+ const weight = kernel[ky + half];
41
+ r += input[pixelIndex] * weight;
42
+ g += input[pixelIndex + 1] * weight;
43
+ b += input[pixelIndex + 2] * weight;
44
+ a += input[pixelIndex + 3] * weight;
45
+ weightSum += weight;
46
+ }
47
+ }
48
+ const outputIndex = (y * width + x) * 4;
49
+ output[outputIndex] = r / weightSum;
50
+ output[outputIndex + 1] = g / weightSum;
51
+ output[outputIndex + 2] = b / weightSum;
52
+ output[outputIndex + 3] = a / weightSum;
53
+ }
54
+ }
55
+ }
56
+ /**
57
+ * Applies horizontal Gaussian blur to image data
58
+ * @param input - Input pixel data
59
+ * @param output - Output pixel data buffer
60
+ * @param width - Image width
61
+ * @param height - Image height
62
+ * @param kernel - Gaussian kernel weights
63
+ * @param half - Half of kernel size
64
+ */
65
+ function applyHorizontalBlur(input, output, width, height, kernel, half) {
66
+ for (let y = 0; y < height; y++) {
67
+ for (let x = 0; x < width; x++) {
68
+ let r = 0, g = 0, b = 0, a = 0;
69
+ let weightSum = 0;
70
+ for (let kx = -half; kx <= half; kx++) {
71
+ const px = x + kx;
72
+ if (px >= 0 && px < width) {
73
+ const pixelIndex = (y * width + px) * 4;
74
+ const weight = kernel[kx + half];
75
+ r += input[pixelIndex] * weight;
76
+ g += input[pixelIndex + 1] * weight;
77
+ b += input[pixelIndex + 2] * weight;
78
+ a += input[pixelIndex + 3] * weight;
79
+ weightSum += weight;
80
+ }
81
+ }
82
+ const outputIndex = (y * width + x) * 4;
83
+ output[outputIndex] = r / weightSum;
84
+ output[outputIndex + 1] = g / weightSum;
85
+ output[outputIndex + 2] = b / weightSum;
86
+ output[outputIndex + 3] = a / weightSum;
87
+ }
88
+ }
89
+ }
90
+ /**
91
+ * Generates a normalized Gaussian kernel
92
+ * @param size - Kernel size (must be odd)
93
+ * @param sigma - Standard deviation
94
+ * @returns Normalized Gaussian kernel
95
+ */
96
+ function generateGaussianKernel(size, sigma) {
97
+ const kernel = [];
98
+ const half = Math.floor(size / 2);
99
+ let sum = 0;
100
+ for (let i = -half; i <= half; i++) {
101
+ const value = Math.exp(-(i * i) / (2 * sigma * sigma));
102
+ kernel.push(value);
103
+ sum += value;
104
+ }
105
+ return Object.freeze(kernel.map((value) => value / sum));
106
+ }
107
+ /**
108
+ * Applies Gaussian blur convolution to image data
109
+ * @param imageData - Source image data
110
+ * @param dimensions - Image dimensions
111
+ * @param radius - Blur radius
112
+ * @returns Blurred image data
113
+ */
114
+ function gaussianBlurConvolution(imageData, dimensions, radius) {
115
+ const { data } = imageData;
116
+ const { width, height } = dimensions;
117
+ const output = new Uint8ClampedArray(data.length);
118
+ const kernelSize = Math.ceil(radius * 2) * 2 + 1;
119
+ const kernel = generateGaussianKernel(kernelSize, radius);
120
+ const half = Math.floor(kernelSize / 2);
121
+ applyHorizontalBlur(data, output, width, height, kernel, half);
122
+ const tempData = new Uint8ClampedArray(output);
123
+ applyVerticalBlur(tempData, output, width, height, kernel, half);
124
+ return new ImageData(output, width, height);
125
+ }
126
+ /**
127
+ * Applies Gaussian blur to an image URL
128
+ * @param imageUrl - Image source (string or URL)
129
+ * @param options - Blur configuration options
130
+ * @returns Promise resolving to data URL of blurred image
131
+ * @throws {Error} If image fails to load or blur operation fails
132
+ */
133
+ export async function applyGaussianBlur(imageUrl, options) {
134
+ const opts = { ...DEFAULT_BLUR_OPTIONS, ...options };
135
+ const radius = opts.radius;
136
+ const resolution = opts.resolution;
137
+ if (!isValidRadius(radius)) {
138
+ throw new Error(`Invalid blur radius: ${radius}. Must be a positive number.`);
139
+ }
140
+ if (!isValidResolution(resolution)) {
141
+ throw new Error(`Invalid resolution: ${resolution}. Must be a number between 0 and 1.`);
142
+ }
143
+ return new Promise((resolve, reject) => {
144
+ const img = new Image();
145
+ img.crossOrigin = opts.crossOrigin;
146
+ img.onload = () => {
147
+ try {
148
+ const canvas = document.createElement('canvas');
149
+ const ctx = canvas.getContext('2d', {
150
+ willReadFrequently: true,
151
+ });
152
+ if (ctx === null) {
153
+ reject(new Error('Failed to get canvas context'));
154
+ return;
155
+ }
156
+ const scaledWidth = Math.max(1, Math.round(img.width * resolution));
157
+ const scaledHeight = Math.max(1, Math.round(img.height * resolution));
158
+ const dimensions = {
159
+ width: scaledWidth,
160
+ height: scaledHeight,
161
+ };
162
+ canvas.width = dimensions.width;
163
+ canvas.height = dimensions.height;
164
+ const hasFilterSupport = ctx.filter !== undefined;
165
+ if (hasFilterSupport) {
166
+ ctx.filter = `blur(${radius}px)`;
167
+ ctx.drawImage(img, 0, 0, scaledWidth, scaledHeight);
168
+ ctx.filter = 'none';
169
+ }
170
+ else {
171
+ ctx.drawImage(img, 0, 0, scaledWidth, scaledHeight);
172
+ const imageData = ctx.getImageData(0, 0, dimensions.width, dimensions.height);
173
+ const blurredData = gaussianBlurConvolution(imageData, dimensions, radius);
174
+ ctx.putImageData(blurredData, 0, 0);
175
+ }
176
+ const dataUrl = canvas.toDataURL();
177
+ if (dataUrl) {
178
+ resolve(dataUrl);
179
+ }
180
+ else {
181
+ reject(new Error('Failed to create image data URL'));
182
+ }
183
+ }
184
+ catch (error) {
185
+ reject(error instanceof Error
186
+ ? error
187
+ : new Error('Unknown error during blur operation'));
188
+ }
189
+ };
190
+ img.onerror = () => {
191
+ reject(new Error('Failed to load image'));
192
+ };
193
+ const srcString = typeof imageUrl === 'string' ? imageUrl : imageUrl.toString();
194
+ img.src = srcString;
195
+ });
196
+ }
197
+ /**
198
+ * Hook to create a blurred image resource
199
+ * @param imageUrl - Accessor function returning image source or null/undefined
200
+ * @param options - Blur configuration options
201
+ * @returns Resource containing blurred image data URL or null
202
+ * @template TSource - Type of image source (string, URL, or null/undefined)
203
+ *
204
+ * @example
205
+ * ```ts
206
+ * const imageUrl = () => 'https://example.com/image.jpg';
207
+ * const blurred = createBlurredImage(imageUrl, { radius: 15 });
208
+ * ```
209
+ */
210
+ export function createBlurredImage(imageUrl, options) {
211
+ const imageUrlString = () => {
212
+ const url = imageUrl();
213
+ if (url === null || url === undefined) {
214
+ return url;
215
+ }
216
+ return typeof url === 'string' ? url : url.toString();
217
+ };
218
+ const [blurredImage] = createResource(imageUrlString, async (url) => {
219
+ return await applyGaussianBlur(url, options);
220
+ });
221
+ return blurredImage;
222
+ }
223
+ //# sourceMappingURL=createBlurredImage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createBlurredImage.js","sourceRoot":"","sources":["../../../../src/primitives/utils/createBlurredImage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgC,cAAc,EAAE,MAAM,UAAU,CAAC;AAiCxE;;GAEG;AACH,MAAM,oBAAoB,GAEtB;IACF,MAAM,EAAE,EAAE;IACV,WAAW,EAAE,WAAW;IACxB,UAAU,EAAE,CAAC;CACL,CAAC;AA4BX;;GAEG;AACH,SAAS,aAAa,CAAC,MAAc;IACnC,OAAO,MAAM,GAAG,CAAC,IAAI,MAAM,CAAC,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AAC,IAAI,KAAK,CAAC,qCAAqC,CAAC,CACrD,CAAC;YACJ,CAAC;QACH,CAAC,CAAC;QAEF,GAAG,CAAC,OAAO,GAAG,GAAS,EAAE;YACvB,MAAM,CAAC,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC,CAAC;QAC5C,CAAC,CAAC;QAEF,MAAM,SAAS,GACb,OAAO,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC;QAChE,GAAG,CAAC,GAAG,GAAG,SAAS,CAAC;IACtB,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,kBAAkB,CAChC,QAA2B,EAC3B,OAA+B;IAE/B,MAAM,cAAc,GAAwC,GAAG,EAAE;QAC/D,MAAM,GAAG,GAAG,QAAQ,EAAE,CAAC;QACvB,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;YACtC,OAAO,GAAG,CAAC;QACb,CAAC;QACD,OAAO,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;IACxD,CAAC,CAAC;IAEF,MAAM,CAAC,YAAY,CAAC,GAAG,cAAc,CACnC,cAAc,EACd,KAAK,EAAE,GAAW,EAAmB,EAAE;QACrC,OAAO,MAAM,iBAAiB,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IAC/C,CAAC,CACF,CAAC;IAEF,OAAO,YAA6C,CAAC;AACvD,CAAC"}
@@ -1,4 +1,4 @@
1
- import { type IRendererTexture } from '@lightningtv/core';
1
+ import { type TextureMap } from '@lightningtv/core';
2
2
  export interface SpriteDef {
3
3
  name: string | number;
4
4
  x: number;
@@ -6,4 +6,4 @@ export interface SpriteDef {
6
6
  width: number;
7
7
  height: number;
8
8
  }
9
- export declare function createSpriteMap(src: string, subTextures: SpriteDef[]): Record<string, IRendererTexture>;
9
+ export declare function createSpriteMap(src: string, subTextures: SpriteDef[]): Record<string, InstanceType<TextureMap['SubTexture']>>;
@@ -1 +1 @@
1
- {"version":3,"file":"createSpriteMap.js","sourceRoot":"","sources":["../../../../src/primitives/utils/createSpriteMap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAUpE,MAAM,UAAU,eAAe,CAC7B,GAAW,EACX,WAAwB;IAExB,MAAM,gBAAgB,GAAG,QAAQ,CAAC,aAAa,CAAC,cAAc,EAAE;QAC9D,GAAG;KACJ,CAAC,CAAC;IAEH,OAAO,WAAW,CAAC,MAAM,CAAmC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE;QACrE,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC;QAClC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,aAAa,CAAC,YAAY,EAAE;YACjD,OAAO,EAAE,gBAAgB;YACzB,CAAC;YACD,CAAC;YACD,KAAK;YACL,MAAM;SACP,CAAC,CAAC;QACH,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC"}
1
+ {"version":3,"file":"createSpriteMap.js","sourceRoot":"","sources":["../../../../src/primitives/utils/createSpriteMap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAU9D,MAAM,UAAU,eAAe,CAC7B,GAAW,EACX,WAAwB;IAExB,MAAM,gBAAgB,GAAG,QAAQ,CAAC,aAAa,CAAC,cAAc,EAAE;QAC9D,GAAG;KACJ,CAAC,CAAC;IAEH,OAAO,WAAW,CAAC,MAAM,CAEvB,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE;QACX,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC;QAClC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,aAAa,CAAC,YAAY,EAAE;YACjD,OAAO,EAAE,gBAAgB;YACzB,CAAC;YACD,CAAC;YACD,KAAK;YACL,MAAM;SACP,CAA2C,CAAC;QAC7C,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC"}
@@ -1,5 +1,85 @@
1
- import { ElementNode } from '@lightningtv/core';
2
- import { type KeyHandler } from '@lightningtv/core/focusManager';
3
- import type { OnSelectedChanged } from '../types.js';
4
- export declare function onGridFocus(onSelectedChanged: OnSelectedChanged | undefined): (this: ElementNode) => boolean;
5
- export declare function handleNavigation(direction: 'up' | 'right' | 'down' | 'left'): KeyHandler;
1
+ import * as lng from '@lightningtv/solid';
2
+ import * as lngp from '@lightningtv/solid/primitives';
3
+ declare module '@lightningtv/core' {
4
+ interface ElementNode {
5
+ /** For children of {@link lngp.NavigableElement}, set to `true` to prevent being selected */
6
+ skipFocus?: boolean;
7
+ }
8
+ }
9
+ /** @deprecated Use {@link navigableForwardFocus} instead */
10
+ export declare function onGridFocus(_?: lngp.OnSelectedChanged): lng.ForwardFocusHandler;
11
+ /**
12
+ * Forwards focus to the first focusable child of a {@link lngp.NavigableElement} and
13
+ * selects it.
14
+ *
15
+ * @example
16
+ * ```tsx
17
+ * <view
18
+ * selected={0}
19
+ * forwardFocus={navigableForwardFocus}
20
+ * onSelectedChanged={(idx, el, child, lastIdx) => {...}}
21
+ * >
22
+ * ```
23
+ */
24
+ export declare const navigableForwardFocus: lng.ForwardFocusHandler;
25
+ export declare function handleNavigation(direction: 'up' | 'right' | 'down' | 'left'): lng.KeyHandler;
26
+ /**
27
+ * Handles navigation key events for navigable elements, \
28
+ * such as {@link lngp.Row} and {@link lngp.Column}.
29
+ *
30
+ * Uses {@link moveSelection} to select the next or previous child based on the key pressed.
31
+ *
32
+ * @example
33
+ * ```tsx
34
+ * <view
35
+ * selected={0}
36
+ * onUp={navigableHandleNavigation}
37
+ * onDown={navigableHandleNavigation}
38
+ * onSelectedChanged={(idx, el, child, lastIdx) => {...}}
39
+ * >
40
+ * ```
41
+ */
42
+ export declare const navigableHandleNavigation: lng.KeyHandler;
43
+ /**
44
+ * Moves the selection within a {@link lngp.NavigableElement}.
45
+ */
46
+ export declare function moveSelection(el: lngp.NavigableElement, delta: number): boolean;
47
+ /**
48
+ * Forwards focus to the closest or first focusable child of a {@link lngp.NavigableElement} and
49
+ * selects it.
50
+ *
51
+ * To determine the closest child, it uses the distance between the center of the previous focused element
52
+ * and the center of each child element.
53
+ *
54
+ * @example
55
+ * ```tsx
56
+ * <view
57
+ * selected={0}
58
+ * forwardFocus={spatialForwardFocus}
59
+ * onSelectedChanged={(idx, el, child, lastIdx) => {...}}
60
+ * >
61
+ * ```
62
+ */
63
+ export declare const spatialForwardFocus: lng.ForwardFocusHandler;
64
+ /**
65
+ * Handles spatial navigation within a {@link lngp.NavigableElement} by moving focus
66
+ * based on the arrow keys pressed.
67
+ *
68
+ * This function allows for navigation in a grid-like manner for flex-wrap containers, \
69
+ * where pressing the arrow keys will either:
70
+ * - move focus to the next/prev child in the same row/column
71
+ * - or find the closest child in the next/prev row/column.
72
+ *
73
+ * @example
74
+ * ```tsx
75
+ * <view
76
+ * selected={0}
77
+ * display="flex"
78
+ * flexWrap="wrap"
79
+ * onUp={spatialHandleNavigation}
80
+ * onDown={spatialHandleNavigation}
81
+ * onSelectedChanged={(idx, el, child, lastIdx) => {...}}
82
+ * >
83
+ * ```
84
+ */
85
+ export declare const spatialHandleNavigation: lng.KeyHandler;