drab 4.1.4 → 4.1.6
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/components/ContextMenu.svelte +1 -1
- package/dist/components/ContextMenu.svelte.d.ts +1 -1
- package/dist/components/Editor.svelte +23 -19
- package/dist/components/Editor.svelte.d.ts +3 -1
- package/dist/components/FullscreenButton.svelte +1 -1
- package/dist/components/FullscreenButton.svelte.d.ts +1 -1
- package/package.json +20 -20
@@ -28,7 +28,7 @@ Displays when the `target` element is right clicked, or long pressed on mobile.
|
|
28
28
|
let target: HTMLButtonElement;
|
29
29
|
</script>
|
30
30
|
|
31
|
-
<div class="
|
31
|
+
<div class="mb-8 flex justify-center rounded border bg-muted p-12">
|
32
32
|
<div>Parent right click</div>
|
33
33
|
<ContextMenu class="z-10">
|
34
34
|
<div class="card flex w-48 flex-col gap-2 p-2 shadow-md">
|
@@ -46,7 +46,7 @@ export type ContextMenuSlots = typeof __propDef.slots;
|
|
46
46
|
* let target: HTMLButtonElement;
|
47
47
|
* </script>
|
48
48
|
*
|
49
|
-
* <div class="
|
49
|
+
* <div class="mb-8 flex justify-center rounded border bg-muted p-12">
|
50
50
|
* <div>Parent right click</div>
|
51
51
|
* <ContextMenu class="z-10">
|
52
52
|
* <div class="card flex w-48 flex-col gap-2 p-2 shadow-md">
|
@@ -19,6 +19,7 @@
|
|
19
19
|
- `nameTextarea` - `name` of the `textarea` element
|
20
20
|
- `placeholderTextarea` - `placeholder` of the `textarea` element
|
21
21
|
- `selectionStartTextarea` - `selectionStart` value of the `textarea`
|
22
|
+
- `spellcheckTextarea` - `spellcheck` of the `textarea` element
|
22
23
|
- `valueTextarea` - `value` of the `textarea` element
|
23
24
|
|
24
25
|
@Events
|
@@ -70,6 +71,7 @@
|
|
70
71
|
export let contentElements = [];
|
71
72
|
export let valueTextarea = "";
|
72
73
|
export let placeholderTextarea = "";
|
74
|
+
export let spellcheckTextarea = true;
|
73
75
|
export let classTextarea = "";
|
74
76
|
export let idTextarea = "";
|
75
77
|
export let nameTextarea = "";
|
@@ -227,28 +229,29 @@ ${repeat}`,
|
|
227
229
|
});
|
228
230
|
}, 0);
|
229
231
|
}
|
230
|
-
} else if (e.ctrlKey || e.metaKey) {
|
231
|
-
if (textArea.selectionStart === textArea.selectionEnd) {
|
232
|
-
if (e.key === "c" || e.key === "x") {
|
233
|
-
e.preventDefault();
|
234
|
-
const { lines, lineNumber, columnNumber } = getLineInfo();
|
235
|
-
await navigator.clipboard.writeText(
|
236
|
-
`${lineNumber === 0 && e.key === "x" ? "" : "\n"}${lines[lineNumber]}`
|
237
|
-
);
|
238
|
-
if (e.key === "x") {
|
239
|
-
const newPos = textArea.selectionStart - columnNumber;
|
240
|
-
lines.splice(lineNumber, 1);
|
241
|
-
valueTextarea = lines.join("\n");
|
242
|
-
setTimeout(() => {
|
243
|
-
textArea.setSelectionRange(newPos, newPos);
|
244
|
-
}, 0);
|
245
|
-
}
|
246
|
-
}
|
247
|
-
}
|
248
232
|
} else {
|
249
233
|
const nextCharIsClosing = Object.values(keyPairs).includes(nextChar);
|
250
234
|
const highlighted = textArea.selectionStart !== textArea.selectionEnd;
|
251
|
-
if (e.ctrlKey
|
235
|
+
if (e.ctrlKey || e.metaKey) {
|
236
|
+
if (textArea.selectionStart === textArea.selectionEnd) {
|
237
|
+
if (e.key === "c" || e.key === "x") {
|
238
|
+
e.preventDefault();
|
239
|
+
const { lines, lineNumber, columnNumber } = getLineInfo();
|
240
|
+
await navigator.clipboard.writeText(
|
241
|
+
`${lineNumber === 0 && e.key === "x" ? "" : "\n"}${lines[lineNumber]}`
|
242
|
+
);
|
243
|
+
if (e.key === "x") {
|
244
|
+
const newPos = textArea.selectionStart - columnNumber;
|
245
|
+
lines.splice(lineNumber, 1);
|
246
|
+
valueTextarea = lines.join("\n");
|
247
|
+
setTimeout(() => {
|
248
|
+
textArea.setSelectionRange(newPos, newPos);
|
249
|
+
}, 0);
|
250
|
+
}
|
251
|
+
}
|
252
|
+
}
|
253
|
+
}
|
254
|
+
if ((e.ctrlKey || e.metaKey) && e.key) {
|
252
255
|
const matchedEl = contentElements.find((el) => el.key === e.key);
|
253
256
|
if (matchedEl)
|
254
257
|
addContent(matchedEl);
|
@@ -369,6 +372,7 @@ onMount(() => clientJs = true);
|
|
369
372
|
class={classTextarea}
|
370
373
|
name={nameTextarea}
|
371
374
|
placeholder={placeholderTextarea}
|
375
|
+
spellcheck={spellcheckTextarea}
|
372
376
|
on:keydown={onKeyDown}
|
373
377
|
on:keyup={updateSelectionStart}
|
374
378
|
on:dblclick={trimSelection}
|
@@ -10,7 +10,7 @@ declare const __propDef: {
|
|
10
10
|
/** controls how the text is added */
|
11
11
|
display: "inline" | "block" | "wrap";
|
12
12
|
/** contents of the `button` */
|
13
|
-
icon: string | ComponentType
|
13
|
+
icon: string | ComponentType<any>;
|
14
14
|
/** keyboard shortcut */
|
15
15
|
key?: string | undefined;
|
16
16
|
/** class to apply to the specific `button` */
|
@@ -18,6 +18,7 @@ declare const __propDef: {
|
|
18
18
|
}[] | undefined;
|
19
19
|
/** `value` of the `textarea` element */ valueTextarea?: string | undefined;
|
20
20
|
/** `placeholder` of the `textarea` element */ placeholderTextarea?: string | undefined;
|
21
|
+
/** `spellcheck` of the `textarea` element */ spellcheckTextarea?: boolean | undefined;
|
21
22
|
/** `class` of the `textarea` element */ classTextarea?: string | undefined;
|
22
23
|
/** `id` of the `textarea` element */ idTextarea?: string | undefined;
|
23
24
|
/** `name` of the `textarea` element */ nameTextarea?: string | undefined;
|
@@ -58,6 +59,7 @@ export type EditorSlots = typeof __propDef.slots;
|
|
58
59
|
* - `nameTextarea` - `name` of the `textarea` element
|
59
60
|
* - `placeholderTextarea` - `placeholder` of the `textarea` element
|
60
61
|
* - `selectionStartTextarea` - `selectionStart` value of the `textarea`
|
62
|
+
* - `spellcheckTextarea` - `spellcheck` of the `textarea` element
|
61
63
|
* - `valueTextarea` - `value` of the `textarea` element
|
62
64
|
*
|
63
65
|
* @Events
|
@@ -31,7 +31,7 @@ Make the document or a `target` element fullscreen.
|
|
31
31
|
|
32
32
|
<FullscreenButton class="button button-primary" />
|
33
33
|
|
34
|
-
<div bind:this={target} class="card bg-muted
|
34
|
+
<div bind:this={target} class="card mt-8 bg-muted">
|
35
35
|
<div class="mb-2">Target element</div>
|
36
36
|
<FullscreenButton {target} class="button button-primary">
|
37
37
|
Enable Element Fullscreen
|
@@ -49,7 +49,7 @@ export type FullscreenButtonSlots = typeof __propDef.slots;
|
|
49
49
|
*
|
50
50
|
* <FullscreenButton class="button button-primary" />
|
51
51
|
*
|
52
|
-
* <div bind:this={target} class="card bg-muted
|
52
|
+
* <div bind:this={target} class="card mt-8 bg-muted">
|
53
53
|
* <div class="mb-2">Target element</div>
|
54
54
|
* <FullscreenButton {target} class="button button-primary">
|
55
55
|
* Enable Element Fullscreen
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "drab",
|
3
|
-
"version": "4.1.
|
3
|
+
"version": "4.1.6",
|
4
4
|
"description": "An Unstyled Svelte Component Library",
|
5
5
|
"keywords": [
|
6
6
|
"components",
|
@@ -55,30 +55,30 @@
|
|
55
55
|
"doc": "bun format && node src/scripts/documentProps.js && node src/scripts/documentExamples.js && node src/scripts/copyReadMe.js"
|
56
56
|
},
|
57
57
|
"dependencies": {
|
58
|
-
"svelte": "^4.2.
|
58
|
+
"svelte": "^4.2.8"
|
59
59
|
},
|
60
60
|
"devDependencies": {
|
61
|
-
"@sveltejs/adapter-vercel": "^3.0
|
62
|
-
"@sveltejs/kit": "^1.
|
63
|
-
"@sveltejs/package": "^2.2.
|
61
|
+
"@sveltejs/adapter-vercel": "^3.1.0",
|
62
|
+
"@sveltejs/kit": "^1.29.1",
|
63
|
+
"@sveltejs/package": "^2.2.3",
|
64
64
|
"@tailwindcss/typography": "^0.5.10",
|
65
|
-
"@types/node": "^20.
|
66
|
-
"@typescript-eslint/eslint-plugin": "^6.
|
67
|
-
"@typescript-eslint/parser": "^6.
|
65
|
+
"@types/node": "^20.10.4",
|
66
|
+
"@typescript-eslint/eslint-plugin": "^6.14.0",
|
67
|
+
"@typescript-eslint/parser": "^6.14.0",
|
68
68
|
"autoprefixer": "^10.4.16",
|
69
|
-
"eslint": "^8.
|
70
|
-
"eslint-config-prettier": "^9.
|
71
|
-
"eslint-plugin-svelte": "^2.
|
72
|
-
"prettier": "^3.
|
73
|
-
"prettier-plugin-svelte": "^3.
|
74
|
-
"prettier-plugin-tailwindcss": "^0.5.
|
75
|
-
"publint": "^0.2.
|
69
|
+
"eslint": "^8.55.0",
|
70
|
+
"eslint-config-prettier": "^9.1.0",
|
71
|
+
"eslint-plugin-svelte": "^2.35.1",
|
72
|
+
"prettier": "^3.1.1",
|
73
|
+
"prettier-plugin-svelte": "^3.1.2",
|
74
|
+
"prettier-plugin-tailwindcss": "^0.5.9",
|
75
|
+
"publint": "^0.2.6",
|
76
76
|
"robino": "^0.0.39",
|
77
|
-
"svelte-check": "^3.
|
78
|
-
"tailwindcss": "^3.3.
|
77
|
+
"svelte-check": "^3.6.2",
|
78
|
+
"tailwindcss": "^3.3.6",
|
79
79
|
"tslib": "^2.6.2",
|
80
|
-
"typescript": "^5.
|
81
|
-
"uico": "^0.1.
|
82
|
-
"vite": "^4.
|
80
|
+
"typescript": "^5.3.3",
|
81
|
+
"uico": "^0.1.6",
|
82
|
+
"vite": "^4.5.0"
|
83
83
|
}
|
84
84
|
}
|