drab 4.1.1 → 4.1.3

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/README.md CHANGED
@@ -114,18 +114,18 @@ Since this is an unstyled library, simple components like a badge that can be ea
114
114
 
115
115
  ### Local Development
116
116
 
117
- Contribute to the project, or use **drab** as a template for another component library. This library is built with SvelteKit, TypeScript, and npm. The package contents are located in `src/lib`, the site is contained within `src/routes` and `src/site`. If you are using this project as a template, be sure to [update the adapter](https://kit.svelte.dev/docs/adapters) based on how you deploy.
117
+ Contribute to the project, or use **drab** as a template for another component library. This library is built with SvelteKit, and TypeScript. The package contents are located in `src/lib`, the site is contained within `src/routes` and `src/site`. If you are using this project as a template, be sure to [update the adapter](https://kit.svelte.dev/docs/adapters) based on how you deploy.
118
118
 
119
119
  #### Make changes
120
120
 
121
121
  1. Clone the [repository](https://github.com/rossrobino/drab)
122
- 2. `npm install`
123
- 3. `npm run dev -- --open`
122
+ 2. `bun i`
123
+ 3. `bun run dev`
124
124
 
125
125
  #### Add or edit a component
126
126
 
127
127
  1. Add or edit the component in `src/lib/components/Component.svelte` - if you're adding a new one, copy and paste an existing one to get started with the conventions
128
128
  2. Add or edit the example in `src/routes/docs/Component/+page.svelte`
129
- 3. Document the component with an `@component` comment, include a description, and the `@slots` available. Add a placeholder `@props` and `@example` to the comment. These sections will be generated based on the JSDoc comment above each prop and the example route upon running `npm run doc`
129
+ 3. Document the component with an `@component` comment, include a description, and the `@slots` available. Add a placeholder `@props` and `@example` to the comment. These sections will be generated based on the JSDoc comment above each prop and the example route upon running `bun doc`
130
130
  4. If new, add the link to `src/site/components/NavItems.svelte`
131
- 5. Run `npm run build` to verify your build
131
+ 5. Run `bun package` to verify your build
@@ -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="mb-8 flex justify-center rounded border bg-muted p-12">
31
+ <div class="bg-muted mb-8 flex justify-center rounded border 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="mb-8 flex justify-center rounded border bg-muted p-12">
49
+ * <div class="bg-muted mb-8 flex justify-center rounded border 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">
@@ -37,7 +37,7 @@
37
37
  <Editor
38
38
  classButton="button button-primary"
39
39
  classControls="flex gap-2"
40
- classTextarea="input w-full h-36 mb-2"
40
+ classTextarea="input h-36 mb-2"
41
41
  placeholderTextarea="asterisk: ctrl+i, anchor: ctrl+["
42
42
  contentElements={[
43
43
  {
@@ -227,6 +227,24 @@ ${repeat}`,
227
227
  });
228
228
  }, 0);
229
229
  }
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
+ }
230
248
  } else {
231
249
  const nextCharIsClosing = Object.values(keyPairs).includes(nextChar);
232
250
  const highlighted = textArea.selectionStart !== textArea.selectionEnd;
@@ -76,7 +76,7 @@ export type EditorSlots = typeof __propDef.slots;
76
76
  * <Editor
77
77
  * classButton="button button-primary"
78
78
  * classControls="flex gap-2"
79
- * classTextarea="input w-full h-36 mb-2"
79
+ * classTextarea="input h-36 mb-2"
80
80
  * placeholderTextarea="asterisk: ctrl+i, anchor: ctrl+["
81
81
  * contentElements={[
82
82
  * {
@@ -24,7 +24,7 @@ Try it out and generate code: [FrettedChord Creator](https://svelte.dev/repl/577
24
24
  </script>
25
25
 
26
26
  <FrettedChord
27
- class="font-mono text-foreground"
27
+ class="font-mono"
28
28
  name="D"
29
29
  notes={[
30
30
  {
@@ -47,7 +47,7 @@ export type FrettedChordSlots = typeof __propDef.slots;
47
47
  * </script>
48
48
  *
49
49
  * <FrettedChord
50
- * class="font-mono text-foreground"
50
+ * class="font-mono"
51
51
  * name="D"
52
52
  * notes={[
53
53
  * {
@@ -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 mt-8 bg-muted">
34
+ <div bind:this={target} class="card bg-muted mt-8">
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 mt-8 bg-muted">
52
+ * <div bind:this={target} class="card bg-muted mt-8">
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.1",
3
+ "version": "4.1.3",
4
4
  "description": "An Unstyled Svelte Component Library",
5
5
  "keywords": [
6
6
  "components",
@@ -27,20 +27,10 @@
27
27
  "url": "https://robino.dev"
28
28
  },
29
29
  "repository": "github:rossrobino/drab",
30
- "scripts": {
31
- "dev": "vite dev",
32
- "host": "vite dev --host",
33
- "build": "npm run doc && vite build && npm run package",
34
- "preview": "vite preview",
35
- "package": "svelte-kit sync && svelte-package && publint",
36
- "prepublishOnly": "npm run package",
37
- "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
38
- "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
39
- "lint": "prettier --check . && eslint .",
40
- "format": "prettier --write . --plugin=prettier-plugin-svelte --plugin=prettier-plugin-tailwindcss",
41
- "pub": "npm i && npm run doc && npm publish --access public",
42
- "doc": "npm run format && node src/scripts/documentProps.js && node src/scripts/documentExamples.js && node src/scripts/copyReadMe.js"
43
- },
30
+ "type": "module",
31
+ "sideEffects": false,
32
+ "svelte": "./dist/index.js",
33
+ "types": "./dist/index.d.ts",
44
34
  "exports": {
45
35
  ".": {
46
36
  "types": "./dist/index.d.ts",
@@ -50,39 +40,45 @@
50
40
  "files": [
51
41
  "dist"
52
42
  ],
53
- "sideEffects": false,
43
+ "scripts": {
44
+ "dev": "vite dev",
45
+ "host": "vite dev --host",
46
+ "build": "vite build",
47
+ "preview": "vite preview",
48
+ "package": "svelte-kit sync && svelte-package && publint",
49
+ "prepublishOnly": "bun package",
50
+ "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
51
+ "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
52
+ "lint": "prettier --check . && eslint .",
53
+ "format": "prettier --write .",
54
+ "pub": "bun i && bun doc && bun package && npm publish --access public",
55
+ "doc": "bun format && node src/scripts/documentProps.js && node src/scripts/documentExamples.js && node src/scripts/copyReadMe.js"
56
+ },
54
57
  "dependencies": {
55
- "svelte": "^4.2.0"
58
+ "svelte": "^4.2.1"
56
59
  },
57
60
  "devDependencies": {
58
61
  "@sveltejs/adapter-vercel": "^3.0.3",
59
- "@sveltejs/kit": "^1.25.0",
62
+ "@sveltejs/kit": "^1.25.1",
60
63
  "@sveltejs/package": "^2.2.2",
61
64
  "@tailwindcss/typography": "^0.5.10",
62
- "@types/node": "^20.6.0",
63
- "@typescript-eslint/eslint-plugin": "^6.7.0",
64
- "@typescript-eslint/parser": "^6.7.0",
65
- "autoprefixer": "^10.4.15",
66
- "eslint": "^8.49.0",
65
+ "@types/node": "^20.8.2",
66
+ "@typescript-eslint/eslint-plugin": "^6.7.4",
67
+ "@typescript-eslint/parser": "^6.7.4",
68
+ "autoprefixer": "^10.4.16",
69
+ "eslint": "^8.50.0",
67
70
  "eslint-config-prettier": "^9.0.0",
68
- "eslint-plugin-svelte": "^2.33.1",
69
- "highlight.js": "^11.8.0",
70
- "marked": "^9.0.0",
71
- "marked-highlight": "^2.0.6",
72
- "marked-smartypants": "^1.1.3",
73
- "postcss": "^8.4.29",
71
+ "eslint-plugin-svelte": "^2.34.0",
74
72
  "prettier": "^3.0.3",
75
73
  "prettier-plugin-svelte": "^3.0.3",
76
- "prettier-plugin-tailwindcss": "^0.5.4",
77
- "publint": "^0.2.2",
78
- "svelte-check": "^3.5.1",
74
+ "prettier-plugin-tailwindcss": "^0.5.5",
75
+ "publint": "^0.2.3",
76
+ "robino": "^0.0.39",
77
+ "svelte-check": "^3.5.2",
79
78
  "tailwindcss": "^3.3.3",
80
79
  "tslib": "^2.6.2",
81
80
  "typescript": "^5.2.2",
82
- "uico": "^0.1.3",
83
- "vite": "^4.4.9"
84
- },
85
- "svelte": "./dist/index.js",
86
- "types": "./dist/index.d.ts",
87
- "type": "module"
81
+ "uico": "^0.1.5",
82
+ "vite": "^4.4.11"
83
+ }
88
84
  }