intelliwaketssveltekitv25 0.3.66 → 0.3.68
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 +0 -3
- package/dist/Functions.js +0 -19
- package/dist/TextArea.svelte +12 -0
- package/dist/TextArea.svelte.d.ts +2 -0
- package/package.json +1 -1
package/dist/Functions.d.ts
CHANGED
|
@@ -146,9 +146,6 @@ export declare function textAreaAltEnter(el: HTMLTextAreaElement): {
|
|
|
146
146
|
*
|
|
147
147
|
* @param el
|
|
148
148
|
*/
|
|
149
|
-
export declare function textAreaEnterStopPropagation(el: HTMLTextAreaElement): {
|
|
150
|
-
destroy(): void;
|
|
151
|
-
};
|
|
152
149
|
export type TErrorMessageStack = {
|
|
153
150
|
message: string;
|
|
154
151
|
stack: string;
|
package/dist/Functions.js
CHANGED
|
@@ -493,25 +493,6 @@ export function textAreaAltEnter(el) {
|
|
|
493
493
|
}
|
|
494
494
|
};
|
|
495
495
|
}
|
|
496
|
-
/**
|
|
497
|
-
* A Svelte "Use Action" for a <textarea> object that stops propagation of the Enter key
|
|
498
|
-
* Usage <textarea use:textAreaEnterStopPropagation />
|
|
499
|
-
*
|
|
500
|
-
* @param el
|
|
501
|
-
*/
|
|
502
|
-
export function textAreaEnterStopPropagation(el) {
|
|
503
|
-
const handleKeyDown = (e) => {
|
|
504
|
-
if (!!e.target && e.key === 'Enter') {
|
|
505
|
-
e.stopPropagation();
|
|
506
|
-
}
|
|
507
|
-
};
|
|
508
|
-
el.addEventListener('keydown', handleKeyDown);
|
|
509
|
-
return {
|
|
510
|
-
destroy() {
|
|
511
|
-
el.removeEventListener('keydown', handleKeyDown);
|
|
512
|
-
}
|
|
513
|
-
};
|
|
514
|
-
}
|
|
515
496
|
export const ErrorMessageStack = (e) => ({
|
|
516
497
|
message: e?.message ?? e?.error?.message ?? e?.reason?.message ?? 'Unknown message',
|
|
517
498
|
stack: e?.stack ?? e?.error?.stack ?? e?.reason?.stack ?? 'Unknown stack'
|
package/dist/TextArea.svelte
CHANGED
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
// thisRef = $bindable<HTMLTextAreaElement>(),
|
|
10
10
|
readonly,
|
|
11
11
|
use = [],
|
|
12
|
+
onkeydown,
|
|
13
|
+
propagateEnter = false,
|
|
12
14
|
...otherProps
|
|
13
15
|
}: Omit<
|
|
14
16
|
HTMLTextareaAttributes,
|
|
@@ -16,9 +18,18 @@
|
|
|
16
18
|
> & {
|
|
17
19
|
value: string | null
|
|
18
20
|
// thisRef?: HTMLTextAreaElement
|
|
21
|
+
onkeydown?: (e: KeyboardEvent) => void
|
|
22
|
+
propagateEnter?: boolean
|
|
19
23
|
use?: ActionArray
|
|
20
24
|
} = $props()
|
|
21
25
|
|
|
26
|
+
function handleKeyDown(e: any) {
|
|
27
|
+
if (onkeydown) onkeydown(e)
|
|
28
|
+
|
|
29
|
+
if (!propagateEnter && !!e.target && e.key === 'Enter') {
|
|
30
|
+
e.stopPropagation()
|
|
31
|
+
}
|
|
32
|
+
}
|
|
22
33
|
</script>
|
|
23
34
|
|
|
24
35
|
{#if readonly || otherProps.hidden}
|
|
@@ -27,6 +38,7 @@
|
|
|
27
38
|
</div>
|
|
28
39
|
{:else}
|
|
29
40
|
<textarea {...otherProps}
|
|
41
|
+
onkeydown={handleKeyDown}
|
|
30
42
|
bind:value={value}
|
|
31
43
|
use:useActions={use}
|
|
32
44
|
use:autoGrow={value}></textarea>
|
|
@@ -2,6 +2,8 @@ import type { HTMLTextareaAttributes } from 'svelte/elements';
|
|
|
2
2
|
import { type ActionArray } from './useActions';
|
|
3
3
|
type $$ComponentProps = Omit<HTMLTextareaAttributes, 'value' | 'this' | 'use'> & {
|
|
4
4
|
value: string | null;
|
|
5
|
+
onkeydown?: (e: KeyboardEvent) => void;
|
|
6
|
+
propagateEnter?: boolean;
|
|
5
7
|
use?: ActionArray;
|
|
6
8
|
};
|
|
7
9
|
declare const TextArea: import("svelte").Component<$$ComponentProps, {}, "value">;
|