drab 2.8.3 → 2.8.5

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/package.json CHANGED
@@ -1,82 +1,82 @@
1
- {
2
- "name": "drab",
3
- "version": "2.8.3",
4
- "description": "An unstyled Svelte component library",
5
- "keywords": [
6
- "components",
7
- "Svelte",
8
- "SvelteKit",
9
- "Accordion",
10
- "Breakpoint",
11
- "Chord",
12
- "ContextMenu",
13
- "Copy",
14
- "DataTable",
15
- "Editor",
16
- "Fullscreen",
17
- "Popover",
18
- "Share",
19
- "Sheet",
20
- "Tabs",
21
- "YouTube"
22
- ],
23
- "homepage": "https://drab.robino.dev",
24
- "license": "MIT",
25
- "author": {
26
- "name": "Ross Robino",
27
- "url": "https://robino.dev"
28
- },
29
- "repository": "github:rossrobino/drab",
30
- "scripts": {
31
- "dev": "vite dev",
32
- "build": "vite build && npm run package",
33
- "preview": "vite preview",
34
- "package": "svelte-kit sync && svelte-package && publint",
35
- "prepublishOnly": "npm run package",
36
- "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
37
- "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
38
- "lint": "prettier --check . && eslint .",
39
- "format": "prettier --write . --plugin=prettier-plugin-svelte --plugin=prettier-plugin-tailwindcss",
40
- "pub": "npm publish --access public",
41
- "doc": "node src/scripts/documentProps.js && node src/scripts/documentExamples.js && node src/scripts/copyReadMe.js"
42
- },
43
- "exports": {
44
- ".": {
45
- "types": "./dist/index.d.ts",
46
- "svelte": "./dist/index.js"
47
- }
48
- },
49
- "files": [
50
- "dist"
51
- ],
52
- "dependencies": {
53
- "svelte": "^4.2.0"
54
- },
55
- "devDependencies": {
56
- "@sveltejs/adapter-vercel": "^3.0.3",
57
- "@sveltejs/kit": "^1.22.6",
58
- "@sveltejs/package": "^2.2.1",
59
- "@tailwindcss/typography": "^0.5.9",
60
- "@types/node": "^20.5.1",
61
- "@typescript-eslint/eslint-plugin": "^6.4.0",
62
- "@typescript-eslint/parser": "^6.4.0",
63
- "autoprefixer": "^10.4.15",
64
- "eslint": "^8.47.0",
65
- "eslint-config-prettier": "^9.0.0",
66
- "eslint-plugin-svelte": "^2.32.4",
67
- "marked": "^7.0.4",
68
- "postcss": "^8.4.28",
69
- "prettier": "^3.0.2",
70
- "prettier-plugin-svelte": "^3.0.3",
71
- "prettier-plugin-tailwindcss": "^0.5.3",
72
- "publint": "^0.2.1",
73
- "svelte-check": "^3.5.0",
74
- "tailwindcss": "^3.3.3",
75
- "tslib": "^2.6.2",
76
- "typescript": "^5.1.6",
77
- "vite": "^4.4.9"
78
- },
79
- "svelte": "./dist/index.js",
80
- "types": "./dist/index.d.ts",
81
- "type": "module"
82
- }
1
+ {
2
+ "name": "drab",
3
+ "version": "2.8.5",
4
+ "description": "An unstyled Svelte component library",
5
+ "keywords": [
6
+ "components",
7
+ "Svelte",
8
+ "SvelteKit",
9
+ "Breakpoint",
10
+ "Chord",
11
+ "ContextMenu",
12
+ "Copy",
13
+ "DataTable",
14
+ "Details",
15
+ "Editor",
16
+ "Fullscreen",
17
+ "Popover",
18
+ "Share",
19
+ "Sheet",
20
+ "Tabs",
21
+ "YouTube"
22
+ ],
23
+ "homepage": "https://drab.robino.dev",
24
+ "license": "MIT",
25
+ "author": {
26
+ "name": "Ross Robino",
27
+ "url": "https://robino.dev"
28
+ },
29
+ "repository": "github:rossrobino/drab",
30
+ "scripts": {
31
+ "dev": "vite dev",
32
+ "build": "vite build && npm run package",
33
+ "preview": "vite preview",
34
+ "package": "svelte-kit sync && svelte-package && publint",
35
+ "prepublishOnly": "npm run package",
36
+ "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
37
+ "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
38
+ "lint": "prettier --check . && eslint .",
39
+ "format": "prettier --write . --plugin=prettier-plugin-svelte --plugin=prettier-plugin-tailwindcss",
40
+ "pub": "npm publish --access public",
41
+ "doc": "node src/scripts/documentProps.js && node src/scripts/documentExamples.js && node src/scripts/copyReadMe.js"
42
+ },
43
+ "exports": {
44
+ ".": {
45
+ "types": "./dist/index.d.ts",
46
+ "svelte": "./dist/index.js"
47
+ }
48
+ },
49
+ "files": [
50
+ "dist"
51
+ ],
52
+ "dependencies": {
53
+ "svelte": "^4.2.0"
54
+ },
55
+ "devDependencies": {
56
+ "@sveltejs/adapter-vercel": "^3.0.3",
57
+ "@sveltejs/kit": "^1.22.6",
58
+ "@sveltejs/package": "^2.2.1",
59
+ "@tailwindcss/typography": "^0.5.9",
60
+ "@types/node": "^20.5.1",
61
+ "@typescript-eslint/eslint-plugin": "^6.4.0",
62
+ "@typescript-eslint/parser": "^6.4.0",
63
+ "autoprefixer": "^10.4.15",
64
+ "eslint": "^8.47.0",
65
+ "eslint-config-prettier": "^9.0.0",
66
+ "eslint-plugin-svelte": "^2.32.4",
67
+ "marked": "^7.0.4",
68
+ "postcss": "^8.4.28",
69
+ "prettier": "^3.0.2",
70
+ "prettier-plugin-svelte": "^3.0.3",
71
+ "prettier-plugin-tailwindcss": "^0.5.3",
72
+ "publint": "^0.2.1",
73
+ "svelte-check": "^3.5.0",
74
+ "tailwindcss": "^3.3.3",
75
+ "tslib": "^2.6.2",
76
+ "typescript": "^5.1.6",
77
+ "vite": "^4.4.9"
78
+ },
79
+ "svelte": "./dist/index.js",
80
+ "types": "./dist/index.d.ts",
81
+ "type": "module"
82
+ }
@@ -1,189 +0,0 @@
1
- <!--
2
- @component
3
-
4
- ### Accordion
5
-
6
- Displays a list of `details` elements with helpful defaults and transitions.
7
-
8
- @props
9
-
10
- - `autoClose` - if `true`, other items close when a new one is opened
11
- - `classContent` - class of all the `div`s that wrap the `content` slot
12
- - `classDetails` - class of the `div` around each `details` element
13
- - `classIcon` - class of the `div` that wraps the icon if displayed
14
- - `classSummary` - class of all the `summary` elements
15
- - `class`
16
- - `data` - data to display in the accordion
17
- - `icon`
18
- - `id`
19
- - `transition` - rotates the icon, slides the content, set to `false` to remove
20
-
21
- @slots
22
-
23
- | name | purpose | default value | slot props |
24
- | --------- | ----------------------------- | -------------- | --------------- |
25
- | `summary` | summary element | `item.summary` | `item`, `index` |
26
- | `icon` | icon element | `icon` prop | `item`, `index` |
27
- | `content` | content of the accordion item | `item.content` | `item`, `index` |
28
-
29
- @example
30
-
31
- ```svelte
32
- <script lang="ts">
33
- import { Accordion, type AccordionItem, FullscreenButton } from "drab";
34
- import Chevron from "../../site/svg/Chevron.svelte";
35
-
36
- const data: AccordionItem[] = [
37
- { summary: "Is it accessible?", content: "Yes." },
38
- {
39
- summary: "Is it styled?",
40
- content: "Nope, style with global styles.",
41
- },
42
- {
43
- summary: "Is it animated?",
44
- content: "Yes, with the transition prop.",
45
- },
46
- {
47
- summary: "Is it customizable?",
48
- content: "Yes, customize with slots.",
49
- class: "uppercase",
50
- component: FullscreenButton,
51
- },
52
- { summary: "Does it work without JavaScript?", content: "Yes." },
53
- ];
54
- </script>
55
-
56
- <Accordion
57
- {data}
58
- icon={Chevron}
59
- class="mb-12"
60
- classDetails="border-b"
61
- classSummary="flex gap-8 cursor-pointer items-center justify-between p-4 font-bold underline hover:decoration-dotted"
62
- classContent="pb-4 px-4"
63
- />
64
-
65
- <Accordion
66
- {data}
67
- icon={Chevron}
68
- classDetails="border-b"
69
- classSummary="flex gap-8 cursor-pointer items-center justify-between p-4 font-bold underline hover:decoration-dotted"
70
- classContent="pb-4 px-4"
71
- autoClose={false}
72
- >
73
- <svelte:fragment slot="summary" let:item let:index>
74
- <span class={item.class ? item.class : ""}>
75
- {index + 1}.
76
- {item.summary}
77
- </span>
78
- </svelte:fragment>
79
- <svelte:fragment slot="content" let:item>
80
- <span>{item.content}</span>
81
- {#if item.component === FullscreenButton}
82
- <div><svelte:component this={FullscreenButton} class="btn mt-4" /></div>
83
- {/if}
84
- </svelte:fragment>
85
- </Accordion>
86
- ```
87
- -->
88
-
89
- <script context="module"></script>
90
-
91
- <script>import { onMount } from "svelte";
92
- import { slide } from "svelte/transition";
93
- import { prefersReducedMotion } from "../util/accessibility";
94
- import { duration } from "../util/transition";
95
- let className = "";
96
- export { className as class };
97
- export let id = "";
98
- export let data;
99
- export let icon = "";
100
- export let classDetails = "";
101
- export let classSummary = "";
102
- export let classContent = "";
103
- export let classIcon = "";
104
- export let transition = { duration };
105
- export let autoClose = true;
106
- let clientJs = false;
107
- const toggleOpen = (i) => {
108
- data[i].open = !data[i].open;
109
- if (autoClose) {
110
- for (let j = 0; j < data.length; j++) {
111
- if (j !== i)
112
- data[j].open = false;
113
- }
114
- }
115
- };
116
- onMount(() => {
117
- clientJs = true;
118
- if (prefersReducedMotion())
119
- transition = false;
120
- });
121
- </script>
122
-
123
- <div class={className} {id}>
124
- {#each data as item, index}
125
- <div class={classDetails}>
126
- <details bind:open={item.open}>
127
- <!-- svelte-ignore a11y-no-redundant-roles -->
128
- <summary
129
- role="button"
130
- tabindex="0"
131
- class={classSummary}
132
- on:click|preventDefault={() => toggleOpen(index)}
133
- on:keydown={(e) => {
134
- if (e.key === "Enter") {
135
- e.preventDefault();
136
- toggleOpen(index);
137
- }
138
- }}
139
- >
140
- <slot name="summary" {item} {index}>{item.summary}</slot>
141
- <slot name="icon" {item} {index}>
142
- {#if icon}
143
- <div
144
- class={classIcon}
145
- class:d-rotate-180={item.open}
146
- class:d-transition={transition}
147
- style="--duration: {transition ? transition.duration : 0}ms;"
148
- >
149
- {#if typeof icon !== "string"}
150
- <svelte:component this={icon} />
151
- {:else}
152
- <span>{icon}</span>
153
- {/if}
154
- </div>
155
- {/if}
156
- </slot>
157
- </summary>
158
- {#if !clientJs || !transition}
159
- <div class={classContent}>
160
- <slot name="content" {item} {index}>{item.content}</slot>
161
- </div>
162
- {/if}
163
- </details>
164
- {#if clientJs && item.open && transition}
165
- <!-- outside the details for the transition -->
166
- <div class={classContent} transition:slide={transition}>
167
- <slot name="content" {item} {index}>{item.content}</slot>
168
- </div>
169
- {/if}
170
- </div>
171
- {/each}
172
- </div>
173
-
174
- <style>
175
- summary {
176
- list-style: none;
177
- }
178
- summary::-webkit-details-marker {
179
- display: none;
180
- }
181
- .d-rotate-180 {
182
- transform: rotate(180deg);
183
- }
184
- .d-transition {
185
- transition-property: transform;
186
- transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
187
- transition-duration: var(--duration);
188
- }
189
- </style>
@@ -1,135 +0,0 @@
1
- import { SvelteComponent } from "svelte";
2
- export type AccordionItem = {
3
- /** text summary of the item */
4
- summary?: string;
5
- /** text content of the item */
6
- content?: string;
7
- /** controls whether the content is displayed */
8
- open?: boolean;
9
- /** any data to pass back to the parent */
10
- [key: string | number]: any;
11
- };
12
- import { type ComponentType } from "svelte";
13
- import { type SlideParams } from "svelte/transition";
14
- declare const __propDef: {
15
- props: {
16
- class?: string | undefined;
17
- id?: string | undefined;
18
- /** data to display in the accordion */ data: AccordionItem[];
19
- icon?: string | ComponentType | undefined;
20
- /** class of the `div` around each `details` element */ classDetails?: string | undefined;
21
- /** class of all the `summary` elements */ classSummary?: string | undefined;
22
- /** class of all the `div`s that wrap the `content` slot */ classContent?: string | undefined;
23
- /** class of the `div` that wraps the icon if displayed */ classIcon?: string | undefined;
24
- /** rotates the icon, slides the content, set to `false` to remove */ transition?: false | SlideParams | undefined;
25
- /** if `true`, other items close when a new one is opened */ autoClose?: boolean | undefined;
26
- };
27
- events: {
28
- [evt: string]: CustomEvent<any>;
29
- };
30
- slots: {
31
- summary: {
32
- item: AccordionItem;
33
- index: any;
34
- };
35
- icon: {
36
- item: AccordionItem;
37
- index: any;
38
- };
39
- content: {
40
- item: AccordionItem;
41
- index: any;
42
- };
43
- };
44
- };
45
- export type AccordionProps = typeof __propDef.props;
46
- export type AccordionEvents = typeof __propDef.events;
47
- export type AccordionSlots = typeof __propDef.slots;
48
- /**
49
- * ### Accordion
50
- *
51
- * Displays a list of `details` elements with helpful defaults and transitions.
52
- *
53
- * @props
54
- *
55
- * - `autoClose` - if `true`, other items close when a new one is opened
56
- * - `classContent` - class of all the `div`s that wrap the `content` slot
57
- * - `classDetails` - class of the `div` around each `details` element
58
- * - `classIcon` - class of the `div` that wraps the icon if displayed
59
- * - `classSummary` - class of all the `summary` elements
60
- * - `class`
61
- * - `data` - data to display in the accordion
62
- * - `icon`
63
- * - `id`
64
- * - `transition` - rotates the icon, slides the content, set to `false` to remove
65
- *
66
- * @slots
67
- *
68
- * | name | purpose | default value | slot props |
69
- * | --------- | ----------------------------- | -------------- | --------------- |
70
- * | `summary` | summary element | `item.summary` | `item`, `index` |
71
- * | `icon` | icon element | `icon` prop | `item`, `index` |
72
- * | `content` | content of the accordion item | `item.content` | `item`, `index` |
73
- *
74
- * @example
75
- *
76
- * ```svelte
77
- * <script lang="ts">
78
- * import { Accordion, type AccordionItem, FullscreenButton } from "drab";
79
- * import Chevron from "../../site/svg/Chevron.svelte";
80
- *
81
- * const data: AccordionItem[] = [
82
- * { summary: "Is it accessible?", content: "Yes." },
83
- * {
84
- * summary: "Is it styled?",
85
- * content: "Nope, style with global styles.",
86
- * },
87
- * {
88
- * summary: "Is it animated?",
89
- * content: "Yes, with the transition prop.",
90
- * },
91
- * {
92
- * summary: "Is it customizable?",
93
- * content: "Yes, customize with slots.",
94
- * class: "uppercase",
95
- * component: FullscreenButton,
96
- * },
97
- * { summary: "Does it work without JavaScript?", content: "Yes." },
98
- * ];
99
- * </script>
100
- *
101
- * <Accordion
102
- * {data}
103
- * icon={Chevron}
104
- * class="mb-12"
105
- * classDetails="border-b"
106
- * classSummary="flex gap-8 cursor-pointer items-center justify-between p-4 font-bold underline hover:decoration-dotted"
107
- * classContent="pb-4 px-4"
108
- * />
109
- *
110
- * <Accordion
111
- * {data}
112
- * icon={Chevron}
113
- * classDetails="border-b"
114
- * classSummary="flex gap-8 cursor-pointer items-center justify-between p-4 font-bold underline hover:decoration-dotted"
115
- * classContent="pb-4 px-4"
116
- * autoClose={false}
117
- * >
118
- * <svelte:fragment slot="summary" let:item let:index>
119
- * <span class={item.class ? item.class : ""}>
120
- * {index + 1}.
121
- * {item.summary}
122
- * </span>
123
- * </svelte:fragment>
124
- * <svelte:fragment slot="content" let:item>
125
- * <span>{item.content}</span>
126
- * {#if item.component === FullscreenButton}
127
- * <div><svelte:component this={FullscreenButton} class="btn mt-4" /></div>
128
- * {/if}
129
- * </svelte:fragment>
130
- * </Accordion>
131
- * ```
132
- */
133
- export default class Accordion extends SvelteComponent<AccordionProps, AccordionEvents, AccordionSlots> {
134
- }
135
- export {};
@@ -1 +0,0 @@
1
- export declare const messageNoScript = "JavaScript is disabled on your device. This feature requires JavaScript for full functionality.";
@@ -1 +0,0 @@
1
- export const messageNoScript = "JavaScript is disabled on your device. This feature requires JavaScript for full functionality.";