intelliwaketssveltekitv25 1.0.46 → 1.0.47
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/Functions.d.ts +12 -4
- package/dist/Functions.js +41 -9
- package/package.json +2 -2
package/dist/Functions.d.ts
CHANGED
|
@@ -25,13 +25,20 @@ export declare const DownloadBase64Data: (fileName: string, base64: string) => v
|
|
|
25
25
|
export declare function CopyRefToClipboard(ref: HTMLElement | null | undefined, tryFormatted?: boolean): boolean;
|
|
26
26
|
export declare const TableIDToExcel: (tableID: string, fileName?: string, appendDateTime?: boolean) => void;
|
|
27
27
|
export declare const DoIDsMatch: (a: any, b: any) => boolean;
|
|
28
|
+
type Focusable = HTMLElement | HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement;
|
|
28
29
|
/**
|
|
29
|
-
*
|
|
30
|
-
* Usage: <input use:autoFocus />
|
|
30
|
+
* Manages automatic focusing of an element, with the ability to enable or disable the functionality dynamically.
|
|
31
31
|
*
|
|
32
|
-
* @param el
|
|
32
|
+
* @param {Focusable} el - The element to auto-focus. The element should implement the `focus()` method and be connected to the DOM.
|
|
33
|
+
* @param {boolean} [enabled=true] - A flag indicating whether auto-focus should be initially enabled.
|
|
34
|
+
* @return {Object} An object with methods to update the enabled state or destroy the auto-focus behavior:
|
|
35
|
+
* - `update(nextEnabled: boolean)`: Updates the enabled state.
|
|
36
|
+
* - `destroy()`: Cancels the auto-focus behavior and cleans up resources.
|
|
33
37
|
*/
|
|
34
|
-
export declare function autoFocus(el:
|
|
38
|
+
export declare function autoFocus(el: Focusable, enabled?: boolean): {
|
|
39
|
+
update(nextEnabled: boolean): void;
|
|
40
|
+
destroy(): void;
|
|
41
|
+
};
|
|
35
42
|
export declare function autoGrow(node: HTMLTextAreaElement, _value?: string | null): {
|
|
36
43
|
update(): void;
|
|
37
44
|
destroy(): void;
|
|
@@ -214,3 +221,4 @@ export type TInputNumberAttributes = Omit<HTMLInputAttributes, 'value' | 'this'
|
|
|
214
221
|
thisRef?: HTMLInputElement;
|
|
215
222
|
} & TNumberStringOptions;
|
|
216
223
|
export declare function PageAdvanceSize(pageCount: number): number | null;
|
|
224
|
+
export {};
|
package/dist/Functions.js
CHANGED
|
@@ -176,18 +176,50 @@ export const TableIDToExcel = (tableID, fileName, appendDateTime = true) => {
|
|
|
176
176
|
};
|
|
177
177
|
export const DoIDsMatch = (a, b) => IsEqual(a, b) || IsEqual(a?.id, b?.id);
|
|
178
178
|
/**
|
|
179
|
-
*
|
|
180
|
-
* Usage: <input use:autoFocus />
|
|
179
|
+
* Manages automatic focusing of an element, with the ability to enable or disable the functionality dynamically.
|
|
181
180
|
*
|
|
182
|
-
* @param el
|
|
181
|
+
* @param {Focusable} el - The element to auto-focus. The element should implement the `focus()` method and be connected to the DOM.
|
|
182
|
+
* @param {boolean} [enabled=true] - A flag indicating whether auto-focus should be initially enabled.
|
|
183
|
+
* @return {Object} An object with methods to update the enabled state or destroy the auto-focus behavior:
|
|
184
|
+
* - `update(nextEnabled: boolean)`: Updates the enabled state.
|
|
185
|
+
* - `destroy()`: Cancels the auto-focus behavior and cleans up resources.
|
|
183
186
|
*/
|
|
184
|
-
export function autoFocus(el) {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
187
|
+
export function autoFocus(el, enabled = true) {
|
|
188
|
+
let cancelled = false;
|
|
189
|
+
async function run() {
|
|
190
|
+
if (!enabled)
|
|
191
|
+
return;
|
|
192
|
+
await tick();
|
|
193
|
+
if (cancelled)
|
|
194
|
+
return;
|
|
195
|
+
// Avoid focusing detached nodes
|
|
196
|
+
if (!el.isConnected)
|
|
197
|
+
return;
|
|
198
|
+
// Sometimes modals need the next frame (transitions/portals)
|
|
199
|
+
requestAnimationFrame(() => {
|
|
200
|
+
if (!cancelled)
|
|
201
|
+
el.focus();
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
void run();
|
|
205
|
+
return {
|
|
206
|
+
update(nextEnabled) {
|
|
207
|
+
enabled = nextEnabled;
|
|
208
|
+
void run();
|
|
209
|
+
},
|
|
210
|
+
destroy() {
|
|
211
|
+
cancelled = true;
|
|
212
|
+
}
|
|
213
|
+
};
|
|
190
214
|
}
|
|
215
|
+
// export function autoFocus(
|
|
216
|
+
// el: HTMLElement | HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement | never
|
|
217
|
+
// ) {
|
|
218
|
+
// tick().then(() => {
|
|
219
|
+
// if (!el) console.error('autoFocus el not available')
|
|
220
|
+
// el?.focus()
|
|
221
|
+
// })
|
|
222
|
+
// }
|
|
191
223
|
export function autoGrow(node, _value) {
|
|
192
224
|
let userResized = false;
|
|
193
225
|
let pointerDown = false;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "intelliwaketssveltekitv25",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.47",
|
|
4
4
|
"exports": {
|
|
5
5
|
".": {
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"lint": "prettier --check . && eslint .",
|
|
84
84
|
"format": "prettier --write .",
|
|
85
85
|
"Install-IntelliWake": "pnpm install && pnpm update -P @solidbasisventures/intelliwaketsfoundation",
|
|
86
|
-
"Publish": "pnpm version patch && git push --tags && git push &&
|
|
86
|
+
"Publish": "pnpm version patch && git push --tags && git push && pnpm publish",
|
|
87
87
|
"Version-Minor-Advance": "pnpm version minor"
|
|
88
88
|
}
|
|
89
89
|
}
|