drab 3.0.2 → 3.0.4

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.
@@ -1,70 +1,78 @@
1
- <!--
2
- @component
3
-
4
- ### Sheet
5
-
6
- Creates a sheet element based on the `position` provided. `maxSize` is set to width or height of the sheet depending on the `position` provided. The `transition` is calculated based on the `position` and `maxSize` of the sheet.
7
-
8
- @props
9
-
10
- - `classSheet` - sheet class - not the backdrop
11
- - `class`
12
- - `display` - controls whether the sheet is displayed
13
- - `id`
14
- - `maxSize` - max width/height of sheet based on the `side` - can also use css instead
15
- - `position` - determines the position of sheet
16
- - `transitionSheet` - flies the sheet, set to `false` to remove
17
- - `transition` - blurs the entire component, set to `false` to remove
18
-
19
- @slots
20
-
21
- | name | purpose | default value |
22
- | ---------- | ------------------------------- | ------------- |
23
- | `default` | content | `Content` |
24
-
25
- @events
26
-
27
- | name | event |
28
- | --------- | ------------------ |
29
- | `mount` | sheet is mounted |
30
- | `destroy` | sheet is destroyed |
31
-
32
- @example
33
-
34
- ```svelte
35
- <script lang="ts">
36
- import { Sheet } from "drab";
37
-
38
- let display = false;
39
- </script>
40
-
41
- <button type="button" class="btn" on:click={() => (display = true)}>
42
- Open
43
- </button>
44
-
45
- <Sheet
46
- bind:display
47
- class="backdrop-blur"
48
- classSheet="p-4 shadow bg-white"
49
- position="r"
50
- >
51
- <div class="mb-4 flex items-center justify-between">
52
- <h2 class="my-0">Sheet</h2>
53
- <button type="button" class="btn btn-s" on:click={() => (display = false)}>
54
- Close
55
- </button>
56
- </div>
57
- <div>
58
- Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
59
- tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
60
- quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
61
- consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
62
- cillum dolore eu fugiat nulla pariatur.
63
- </div>
64
- </Sheet>
65
- ```
66
- -->
67
-
1
+ <!--
2
+ @component
3
+
4
+ ### Sheet
5
+
6
+ Creates a sheet element based on the `position` provided. `maxSize` is set to width or height of the sheet depending on the `position` provided. The `transition` is calculated based on the `position` and `maxSize` of the sheet.
7
+
8
+ @props
9
+
10
+ - `classSheet` - sheet class - not the backdrop
11
+ - `class`
12
+ - `display` - controls whether the sheet is displayed
13
+ - `id`
14
+ - `maxSize` - max width/height of sheet based on the `side` - can also use css instead
15
+ - `position` - determines the position of sheet
16
+ - `transitionSheet` - flies the sheet, set to `false` to remove
17
+ - `transition` - blurs the entire component, set to `false` to remove
18
+
19
+ @slots
20
+
21
+ | name | purpose | default value |
22
+ | ---------- | ------------------------------- | ------------- |
23
+ | `default` | content | `Content` |
24
+
25
+ @events
26
+
27
+ | name | event |
28
+ | --------- | ------------------ |
29
+ | `mount` | sheet is mounted |
30
+ | `destroy` | sheet is destroyed |
31
+
32
+ @example
33
+
34
+ ```svelte
35
+ <script lang="ts">
36
+ import { Sheet } from "drab";
37
+
38
+ let display = false;
39
+ </script>
40
+
41
+ <button
42
+ type="button"
43
+ class="button button-primary"
44
+ on:click={() => (display = true)}
45
+ >
46
+ Open
47
+ </button>
48
+
49
+ <Sheet
50
+ bind:display
51
+ class="z-40 backdrop-blur"
52
+ classSheet="p-4 shadow bg-background"
53
+ position="r"
54
+ >
55
+ <div class="mb-4 flex items-center justify-between">
56
+ <h2 class="my-0">Sheet</h2>
57
+ <button
58
+ type="button"
59
+ class="button button-ghost"
60
+ on:click={() => (display = false)}
61
+ >
62
+ Close
63
+ </button>
64
+ </div>
65
+ <div>
66
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
67
+ tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
68
+ quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
69
+ consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
70
+ cillum dolore eu fugiat nulla pariatur.
71
+ </div>
72
+ </Sheet>
73
+ ```
74
+ -->
75
+
68
76
  <script>import { createEventDispatcher, onMount } from "svelte";
69
77
  import {
70
78
  blur,
@@ -111,56 +119,56 @@ onMount(() => {
111
119
  transitionSheet = false;
112
120
  }
113
121
  });
114
- </script>
115
-
116
- <svelte:body on:keydown={onKeyDown} />
117
-
118
- {#if display}
119
- <div
120
- transition:blur={transition ? transition : { duration: 0 }}
121
- class="d-backdrop {className}"
122
- class:d-backdrop-bottom={position === "b"}
123
- class:d-backdrop-top={position === "t"}
124
- class:d-backdrop-right={position === "r"}
125
- {id}
126
- >
127
- <div
128
- bind:this={sheet}
129
- transition:fly={transitionSheet ? transitionSheet : { duration: 0 }}
130
- use:lifecycle
131
- role="dialog"
132
- tabindex="-1"
133
- style={position === "t" || position === "b"
134
- ? `max-height: ${maxSize}px;`
135
- : `max-width: ${maxSize}px`}
136
- class={classSheet}
137
- >
138
- <slot>Content</slot>
139
- </div>
140
- <button title="Close" on:click={close}></button>
141
- </div>
142
- {/if}
143
-
144
- <style>
145
- button {
146
- flex-grow: 1;
147
- }
148
- .d-backdrop {
149
- position: fixed;
150
- display: flex;
151
- top: 0;
152
- bottom: 0;
153
- left: 0;
154
- right: 0;
155
- overflow: hidden;
156
- }
157
- .d-backdrop-bottom {
158
- flex-direction: column-reverse;
159
- }
160
- .d-backdrop-top {
161
- flex-direction: column;
162
- }
163
- .d-backdrop-right {
164
- flex-direction: row-reverse;
165
- }
166
- </style>
122
+ </script>
123
+
124
+ <svelte:body on:keydown={onKeyDown} />
125
+
126
+ {#if display}
127
+ <div
128
+ transition:blur={transition ? transition : { duration: 0 }}
129
+ class="d-backdrop {className}"
130
+ class:d-backdrop-bottom={position === "b"}
131
+ class:d-backdrop-top={position === "t"}
132
+ class:d-backdrop-right={position === "r"}
133
+ {id}
134
+ >
135
+ <div
136
+ bind:this={sheet}
137
+ transition:fly={transitionSheet ? transitionSheet : { duration: 0 }}
138
+ use:lifecycle
139
+ role="dialog"
140
+ tabindex="-1"
141
+ style={position === "t" || position === "b"
142
+ ? `max-height: ${maxSize}px;`
143
+ : `max-width: ${maxSize}px`}
144
+ class={classSheet}
145
+ >
146
+ <slot>Content</slot>
147
+ </div>
148
+ <button title="Close" on:click={close}></button>
149
+ </div>
150
+ {/if}
151
+
152
+ <style>
153
+ button {
154
+ flex-grow: 1;
155
+ }
156
+ .d-backdrop {
157
+ display: flex;
158
+ position: fixed;
159
+ top: 0;
160
+ right: 0;
161
+ bottom: 0;
162
+ left: 0;
163
+ overflow: hidden;
164
+ }
165
+ .d-backdrop-bottom {
166
+ flex-direction: column-reverse;
167
+ }
168
+ .d-backdrop-top {
169
+ flex-direction: column;
170
+ }
171
+ .d-backdrop-right {
172
+ flex-direction: row-reverse;
173
+ }
174
+ </style>
@@ -7,7 +7,7 @@ declare const __propDef: {
7
7
  /** sheet class - not the backdrop */ classSheet?: string | undefined;
8
8
  /** controls whether the sheet is displayed*/ display?: boolean | undefined;
9
9
  /** blurs the entire component, set to `false` to remove */ transition?: false | BlurParams | undefined;
10
- /** determines the position of sheet */ position?: "t" | "b" | "l" | "r" | undefined;
10
+ /** determines the position of sheet */ position?: "t" | "r" | "b" | "l" | undefined;
11
11
  /** max width/height of sheet based on the `side` - can also use css instead */ maxSize?: number | undefined;
12
12
  /** flies the sheet, set to `false` to remove */ transitionSheet?: false | FlyParams | undefined;
13
13
  };
@@ -62,19 +62,27 @@ export type SheetSlots = typeof __propDef.slots;
62
62
  * let display = false;
63
63
  * </script>
64
64
  *
65
- * <button type="button" class="btn" on:click={() => (display = true)}>
65
+ * <button
66
+ * type="button"
67
+ * class="button button-primary"
68
+ * on:click={() => (display = true)}
69
+ * >
66
70
  * Open
67
71
  * </button>
68
72
  *
69
73
  * <Sheet
70
74
  * bind:display
71
- * class="backdrop-blur"
72
- * classSheet="p-4 shadow bg-white"
75
+ * class="z-40 backdrop-blur"
76
+ * classSheet="p-4 shadow bg-background"
73
77
  * position="r"
74
78
  * >
75
79
  * <div class="mb-4 flex items-center justify-between">
76
80
  * <h2 class="my-0">Sheet</h2>
77
- * <button type="button" class="btn btn-s" on:click={() => (display = false)}>
81
+ * <button
82
+ * type="button"
83
+ * class="button button-ghost"
84
+ * on:click={() => (display = false)}
85
+ * >
78
86
  * Close
79
87
  * </button>
80
88
  * </div>
@@ -1,11 +1,11 @@
1
- <!--
2
- @component
3
-
4
- ### YouTube
5
-
6
- Embeds a YouTube video `iframe` into a website with the video `uid`, using [www.youtube-nocookie.com](https://support.google.com/youtube/answer/171780?hl=en#zippy=%2Cturn-on-privacy-enhanced-mode).
7
-
8
- @props
1
+ <!--
2
+ @component
3
+
4
+ ### YouTube
5
+
6
+ Embeds a YouTube video `iframe` into a website with the video `uid`, using [www.youtube-nocookie.com](https://support.google.com/youtube/answer/171780?hl=en#zippy=%2Cturn-on-privacy-enhanced-mode).
7
+
8
+ @props
9
9
 
10
10
  - `autoplay` - auto-plays the video
11
11
  - `class`
@@ -14,21 +14,21 @@ Embeds a YouTube video `iframe` into a website with the video `uid`, using [www.
14
14
  - `title`
15
15
  - `uid` - unique YouTube id
16
16
 
17
- @example
17
+ @example
18
18
 
19
19
  ```svelte
20
- <script lang="ts">
21
- import { YouTube } from "drab";
22
- </script>
23
-
24
- <YouTube
25
- class="aspect-video w-full rounded"
26
- title="Renegade - Kevin Olusola"
27
- uid="gouiY85kD2o"
28
- />
20
+ <script lang="ts">
21
+ import { YouTube } from "drab";
22
+ </script>
23
+
24
+ <YouTube
25
+ class="aspect-video w-full rounded"
26
+ title="Renegade - Kevin Olusola"
27
+ uid="gouiY85kD2o"
28
+ />
29
29
  ```
30
- -->
31
-
30
+ -->
31
+
32
32
  <script>let className = "";
33
33
  export { className as class };
34
34
  export let id = "";
@@ -36,16 +36,16 @@ export let uid;
36
36
  export let title = "";
37
37
  export let autoplay = false;
38
38
  export let start = 0;
39
- </script>
40
-
41
- <iframe
42
- class={className}
43
- {id}
44
- src="https://www.youtube-nocookie.com/embed/{uid}?start={start}{autoplay
45
- ? '&autoplay=1'
46
- : ''}"
47
- {title}
48
- frameborder="0"
49
- allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
50
- allowfullscreen
51
- />
39
+ </script>
40
+
41
+ <iframe
42
+ class={className}
43
+ {id}
44
+ src="https://www.youtube-nocookie.com/embed/{uid}?start={start}{autoplay
45
+ ? '&autoplay=1'
46
+ : ''}"
47
+ {title}
48
+ frameborder="0"
49
+ allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
50
+ allowfullscreen
51
+ />
package/package.json CHANGED
@@ -1,81 +1,83 @@
1
- {
2
- "name": "drab",
3
- "version": "3.0.2",
4
- "description": "An Unstyled Svelte Component Library",
5
- "keywords": [
6
- "components",
7
- "Svelte",
8
- "SvelteKit",
9
- "Breakpoint",
10
- "ContextMenu",
11
- "Copy",
12
- "DataTable",
13
- "Details",
14
- "Editor",
15
- "FrettedChord",
16
- "Fullscreen",
17
- "Popover",
18
- "Share",
19
- "Sheet",
20
- "YouTube"
21
- ],
22
- "homepage": "https://drab.robino.dev",
23
- "license": "MIT",
24
- "author": {
25
- "name": "Ross Robino",
26
- "url": "https://robino.dev"
27
- },
28
- "repository": "github:rossrobino/drab",
29
- "scripts": {
30
- "dev": "vite dev",
31
- "build": "vite build && npm run package",
32
- "preview": "vite preview",
33
- "package": "svelte-kit sync && svelte-package && publint",
34
- "prepublishOnly": "npm run package",
35
- "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
36
- "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
37
- "lint": "prettier --check . && eslint .",
38
- "format": "prettier --write . --plugin=prettier-plugin-svelte --plugin=prettier-plugin-tailwindcss",
39
- "pub": "npm publish --access public",
40
- "doc": "node src/scripts/documentProps.js && node src/scripts/documentExamples.js && node src/scripts/copyReadMe.js"
41
- },
42
- "exports": {
43
- ".": {
44
- "types": "./dist/index.d.ts",
45
- "svelte": "./dist/index.js"
46
- }
47
- },
48
- "files": [
49
- "dist"
50
- ],
51
- "dependencies": {
52
- "svelte": "^4.2.0"
53
- },
54
- "devDependencies": {
55
- "@sveltejs/adapter-vercel": "^3.0.3",
56
- "@sveltejs/kit": "^1.22.6",
57
- "@sveltejs/package": "^2.2.1",
58
- "@tailwindcss/typography": "^0.5.9",
59
- "@types/node": "^20.5.3",
60
- "@typescript-eslint/eslint-plugin": "^6.4.1",
61
- "@typescript-eslint/parser": "^6.4.1",
62
- "autoprefixer": "^10.4.15",
63
- "eslint": "^8.47.0",
64
- "eslint-config-prettier": "^9.0.0",
65
- "eslint-plugin-svelte": "^2.33.0",
66
- "marked": "^7.0.4",
67
- "postcss": "^8.4.28",
68
- "prettier": "^3.0.2",
69
- "prettier-plugin-svelte": "^3.0.3",
70
- "prettier-plugin-tailwindcss": "^0.5.3",
71
- "publint": "^0.2.2",
72
- "svelte-check": "^3.5.0",
73
- "tailwindcss": "^3.3.3",
74
- "tslib": "^2.6.2",
75
- "typescript": "^5.1.6",
76
- "vite": "^4.4.9"
77
- },
78
- "svelte": "./dist/index.js",
79
- "types": "./dist/index.d.ts",
80
- "type": "module"
81
- }
1
+ {
2
+ "name": "drab",
3
+ "version": "3.0.4",
4
+ "description": "An Unstyled Svelte Component Library",
5
+ "keywords": [
6
+ "components",
7
+ "Svelte",
8
+ "SvelteKit",
9
+ "Breakpoint",
10
+ "ContextMenu",
11
+ "Copy",
12
+ "DataTable",
13
+ "Details",
14
+ "Editor",
15
+ "FrettedChord",
16
+ "Fullscreen",
17
+ "Popover",
18
+ "Share",
19
+ "Sheet",
20
+ "YouTube"
21
+ ],
22
+ "homepage": "https://drab.robino.dev",
23
+ "license": "MIT",
24
+ "author": {
25
+ "name": "Ross Robino",
26
+ "url": "https://robino.dev"
27
+ },
28
+ "repository": "github:rossrobino/drab",
29
+ "scripts": {
30
+ "dev": "vite dev",
31
+ "build": "vite build && npm run package",
32
+ "preview": "vite preview",
33
+ "package": "svelte-kit sync && svelte-package && publint",
34
+ "prepublishOnly": "npm run package",
35
+ "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
36
+ "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
37
+ "lint": "prettier --check . && eslint .",
38
+ "format": "prettier --write . --plugin=prettier-plugin-svelte --plugin=prettier-plugin-tailwindcss --plugin=prettier-plugin-css-order",
39
+ "pub": "npm publish --access public",
40
+ "doc": "node src/scripts/documentProps.js && node src/scripts/documentExamples.js && node src/scripts/copyReadMe.js"
41
+ },
42
+ "exports": {
43
+ ".": {
44
+ "types": "./dist/index.d.ts",
45
+ "svelte": "./dist/index.js"
46
+ }
47
+ },
48
+ "files": [
49
+ "dist"
50
+ ],
51
+ "dependencies": {
52
+ "svelte": "^4.2.0"
53
+ },
54
+ "devDependencies": {
55
+ "@sveltejs/adapter-vercel": "^3.0.3",
56
+ "@sveltejs/kit": "^1.24.0",
57
+ "@sveltejs/package": "^2.2.2",
58
+ "@tailwindcss/typography": "^0.5.9",
59
+ "@types/node": "^20.5.7",
60
+ "@typescript-eslint/eslint-plugin": "^6.5.0",
61
+ "@typescript-eslint/parser": "^6.5.0",
62
+ "autoprefixer": "^10.4.15",
63
+ "eslint": "^8.48.0",
64
+ "eslint-config-prettier": "^9.0.0",
65
+ "eslint-plugin-svelte": "^2.33.0",
66
+ "layercomp": "^0.0.2",
67
+ "marked": "^7.0.5",
68
+ "postcss": "^8.4.29",
69
+ "prettier": "^3.0.3",
70
+ "prettier-plugin-css-order": "^2.0.0",
71
+ "prettier-plugin-svelte": "^3.0.3",
72
+ "prettier-plugin-tailwindcss": "^0.5.3",
73
+ "publint": "^0.2.2",
74
+ "svelte-check": "^3.5.1",
75
+ "tailwindcss": "^3.3.3",
76
+ "tslib": "^2.6.2",
77
+ "typescript": "^5.2.2",
78
+ "vite": "^4.4.9"
79
+ },
80
+ "svelte": "./dist/index.js",
81
+ "types": "./dist/index.d.ts",
82
+ "type": "module"
83
+ }