@axel669/zephyr 0.1.2 → 0.1.16

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,30 +1,30 @@
1
- {
2
- "name": "@axel669/zephyr",
3
- "version": "0.1.2",
4
- "description": "",
5
- "main": "src/index.mjs",
6
- "type": "module",
7
- "scripts": {
8
- "test": "echo \"Error: no test specified\" && exit 1",
9
- "demo": "rollup -c test/rollup.config.mjs"
10
- },
11
- "keywords": [],
12
- "author": "",
13
- "license": "MIT",
14
- "dependencies": {
15
- "@axel669/windstorm": "0.1.12",
16
- "@labyrinthos/asuid": "^0.2.0",
17
- "svelte": "^3.58.0"
18
- },
19
- "devDependencies": {
20
- "@axel669/ipsen": "^0.3.1",
21
- "@axel669/rollup-html-input": "^0.1.2",
22
- "@rollup/plugin-node-resolve": "^15.0.2",
23
- "@rollup/plugin-terser": "^0.4.0",
24
- "rollup": "^3.20.2",
25
- "rollup-plugin-svelte": "^7.1.4"
26
- },
27
- "files": [
28
- "src/"
29
- ]
30
- }
1
+ {
2
+ "name": "@axel669/zephyr",
3
+ "version": "0.1.16",
4
+ "description": "",
5
+ "main": "src/index.mjs",
6
+ "type": "module",
7
+ "scripts": {
8
+ "test": "echo \"Error: no test specified\" && exit 1",
9
+ "demo": "rollup -c test/rollup.config.mjs"
10
+ },
11
+ "keywords": [],
12
+ "author": "",
13
+ "license": "MIT",
14
+ "dependencies": {
15
+ "@axel669/windstorm": "0.1.16",
16
+ "@labyrinthos/asuid": "^0.2.0",
17
+ "svelte": "^3.58.0"
18
+ },
19
+ "devDependencies": {
20
+ "@axel669/ipsen": "^0.3.1",
21
+ "@axel669/rollup-html-input": "^0.1.2",
22
+ "@rollup/plugin-node-resolve": "^15.0.2",
23
+ "@rollup/plugin-terser": "^0.4.0",
24
+ "rollup": "^3.20.2",
25
+ "rollup-plugin-svelte": "^7.1.4"
26
+ },
27
+ "files": [
28
+ "src/"
29
+ ]
30
+ }
package/src/button.svelte CHANGED
@@ -23,9 +23,9 @@
23
23
  - ### label `string`
24
24
  If true, the button will be displayed in the DOM using a `<label>`
25
25
  element instead of a `<button>`.
26
- - ### variant `string`
27
- Sets the button type to `@<variant>` (ex: "flat" -> `@flat`). Default
28
- variant is "flat". Currently supports "flat", "fill", "outline".
26
+ - ### fill / outline `bool`
27
+ Sets the button type to @fill if fill is true, @outline if outline
28
+ is true, or @flat if neither is true.
29
29
 
30
30
  ## Events
31
31
  - click
@@ -35,10 +35,10 @@
35
35
  <Button on:click={action}>
36
36
  Flat Button
37
37
  </Button>
38
- <Button on:click={action} variant="outline">
38
+ <Button on:click={action} outline>
39
39
  Outlined Button
40
40
  </Button>
41
- <Button on:click={action} variant="fill" color="danger">
41
+ <Button on:click={action} fill color="danger">
42
42
  Filled Button
43
43
  </Button>
44
44
 
@@ -50,18 +50,23 @@
50
50
  */
51
51
 
52
52
  import wsx from "./wsx.mjs"
53
+ import variant from "./variant.mjs"
53
54
 
54
- export let color = "default"
55
+ export let color = false
55
56
  export let compact = false
56
- export let variant = "flat"
57
57
  export let disabled
58
58
 
59
+ export let fill = false
60
+ export let outline = false
61
+
59
62
  let _for = ""
60
63
  export { _for as for }
61
64
  export let label = false
62
65
 
66
+ $: type = variant({ fill, outline })
67
+
63
68
  $: wind = {
64
- [`@${variant}`]: true,
69
+ [type]: true,
65
70
  $color: color,
66
71
  $compact: compact,
67
72
  "@button": label,
package/src/chip.svelte CHANGED
@@ -17,9 +17,8 @@
17
17
  Sets `$color`
18
18
  - ### clickable `bool`
19
19
  If true, the chip will have the button ripple effect when clicked.
20
- - ### variant `string`
21
- Sets the chip type to `@<variant>` (ex: "fill" -> `@fill`). Default
22
- variant is "outline". Currently supports "fill", "outline".
20
+ - ### fill `bool`
21
+ If true, sets @fill on the chip. If false @outline is set instead.
23
22
 
24
23
  ## Events
25
24
  - click
@@ -29,18 +28,22 @@
29
28
  Emails:
30
29
  <Chip clickable>admin@site.com</Chip>
31
30
  <Chip clickable color="warning">weirdge@site.com</Chip>
32
- <Chip color="primary">required@site.io</Chip>
31
+ <Chip color="primary" fill>required@site.io</Chip>
33
32
  ```
34
33
  */
35
34
 
36
35
  import wsx from "./wsx.mjs"
36
+ import variant from "./variant.mjs"
37
37
 
38
38
  export let color = "default"
39
39
  export let clickable = false
40
- export let variant = "outline"
40
+
41
+ export let fill = false
42
+
43
+ $: type = variant({ fill }, "@outline")
41
44
 
42
45
  $: wind = {
43
- [`@${variant}`]: true,
46
+ [type]: true,
44
47
  $color: color,
45
48
  $click: clickable,
46
49
  ...$$restProps
@@ -0,0 +1,23 @@
1
+ <script>
2
+ import wsx from "./wsx.mjs"
3
+
4
+ export let label
5
+ export let outline
6
+ export let color = "default"
7
+ export let open = false
8
+
9
+ $: wind = {
10
+ $color: color,
11
+ "@outline": outline,
12
+ ...$$restProps,
13
+ }
14
+ </script>
15
+
16
+ <details use:wsx={wind} bind:open>
17
+ <summary>
18
+ <slot name="label">
19
+ {label}
20
+ </slot>
21
+ </summary>
22
+ <slot />
23
+ </details>
package/src/dialog.svelte CHANGED
@@ -44,7 +44,8 @@
44
44
  import Paper from "./paper.svelte"
45
45
  </script>
46
46
 
47
- <wind-wrapper transition:fade={{ duration: 200 }} ws-x="@dialog grid">
47
+ <!-- svelte-ignore a11y-click-events-have-key-events -->
48
+ <wind-wrapper transition:fade={{ duration: 200 }} ws-x="@dialog grid" on:click|stopPropagation>
48
49
  <Paper {...$$props}>
49
50
  <slot name="header" slot="header" />
50
51
  <slot />
package/src/flex.svelte CHANGED
@@ -20,9 +20,9 @@
20
20
  - ### gap `string`
21
21
  Sets `gap`
22
22
  - ### cross `string`
23
- Sets `fl-cr-a`
23
+ Sets `fl-cr-a`, default is `"stretch"`
24
24
  - ### main `string`
25
- Sets `fl-m-a`
25
+ Sets `fl-m-a`, default is `"start"`
26
26
 
27
27
  ## Usage
28
28
  ```svelte
@@ -39,7 +39,7 @@
39
39
  export let direction = false
40
40
  export let pad = false
41
41
  export let gap = false
42
- export let cross = "start"
42
+ export let cross = "stretch"
43
43
  export let main = "start"
44
44
 
45
45
  $: wind = {
package/src/index.mjs CHANGED
@@ -49,6 +49,7 @@ export { default as Avatar } from "./avatar.svelte"
49
49
  export { default as Badge } from "./badge.svelte"
50
50
  export { default as Button } from "./button.svelte"
51
51
  export { default as Chip } from "./chip.svelte"
52
+ export { default as Details } from "./details.svelte"
52
53
  export { default as Dialog } from "./dialog.svelte"
53
54
  export { default as Drawer } from "./drawer.svelte"
54
55
  export { default as Flex } from "./flex.svelte"
package/src/link.svelte CHANGED
@@ -24,34 +24,39 @@
24
24
  Sets the rel attribute.
25
25
  - ### target `string`
26
26
  Sets the target attribute
27
- - ### variant `string`
28
- Sets the link-button type to `@<variant>` (ex: "flat" -> `@flat`).
29
- Default variant is "flat". Currently supports "flat", "fill", "outline".
27
+ - ### fill / outline `bool`
28
+ Sets the link-button type to @fill if fill is true, @outline if outline
29
+ is true, or @flat if neither is true.
30
30
 
31
31
  ## Usage
32
32
  ```svelte
33
33
  <Link color="primary" href="test" target="_blank">
34
34
  Test
35
35
  </Link>
36
- <Link color="primary" href="logout" button variant="outline">
36
+ <Link color="primary" href="logout" button outline>
37
37
  Logout
38
38
  </Link>
39
39
  ```
40
40
  */
41
41
 
42
42
  import wsx from "./wsx.mjs"
43
+ import variant from "./variant.mjs"
43
44
 
44
45
  export let button = false
45
- export let variant = "flat"
46
- export let color = "default"
46
+ export let color = false
47
47
 
48
48
  export let href = ""
49
49
  export let rel = "noreferrer"
50
50
  export let target = null
51
51
 
52
+ export let fill = false
53
+ export let outline = false
54
+
55
+ $: type = variant({ fill, outline })
56
+
52
57
  $: wind = {
53
58
  "@button": button,
54
- [`@${variant}`]: true,
59
+ [type]: true,
55
60
  $color: color,
56
61
  ...$$restProps
57
62
  }
package/src/paper.svelte CHANGED
@@ -27,8 +27,10 @@
27
27
  Sets the layout the card will use to display content. Default is Flex.
28
28
  - ### scrollable `bool`
29
29
  Sets `over[auto]` on the layout component
30
- - ### lprops `Object`
31
- An object with props to pass to the layout component
30
+ - ### l-*
31
+ Any prop that is prefixed with `l-` will be passed to the layout
32
+ component, with the remaining props acting as the normal wind functions
33
+ on the paper itself
32
34
 
33
35
  ## Slots
34
36
  - ### header
@@ -57,7 +59,7 @@
57
59
  <div>Content 2</div>
58
60
  <div>Content 3</div>
59
61
  </Paper>
60
- <Paper>
62
+ <Paper l-pad="0px" m="4px">
61
63
  <Titlebar slot="header">
62
64
  <Text slot="title" title>
63
65
  Some Screen
@@ -86,18 +88,29 @@
86
88
  export let card = false
87
89
  export let square = false
88
90
  export let layout = Flex
89
- export let scrollable = false
90
- export let lprops = {}
91
+ export let scrollable = true
92
+
93
+ $: props = Object.entries($$restProps).reduce(
94
+ (p, [key, value]) => {
95
+ const [target, name] =
96
+ (key.startsWith("l-") === true)
97
+ ? [ p.layout, key.slice(2) ]
98
+ : [ p.paper, key ]
99
+ target[name] = value
100
+ return p
101
+ },
102
+ { layout: {}, paper: {} }
103
+ )
91
104
 
92
- $: props = {
105
+ $: layoutProps = {
93
106
  over: scrollable ? "auto" : false,
94
- ...lprops,
107
+ ...props.layout,
95
108
  }
96
109
  $: wind = {
97
110
  $color: color,
98
111
  "@outline": card,
99
112
  r: square && "0px",
100
- ...$$restProps
113
+ ...props.paper,
101
114
  }
102
115
  </script>
103
116
 
@@ -106,7 +119,7 @@
106
119
  {#if $$slots.content}
107
120
  <slot name="content" slot="content" />
108
121
  {:else}
109
- <svelte:component this={layout} {...props} slot="content">
122
+ <svelte:component this={layout} {...layoutProps} slot="content">
110
123
  <slot />
111
124
  </svelte:component>
112
125
  {/if}
package/src/tabs.svelte CHANGED
@@ -70,7 +70,8 @@
70
70
  <!-- svelte-ignore a11y-click-events-have-key-events -->
71
71
  <ws-tabs use:wsx={wind}>
72
72
  {#each options as tab, i}
73
- <ws-tab tab-selected={index === i || null} on:click={set(tab.value)}>
73
+ <ws-tab use:wsx={{"$tab-selected": index === i}}
74
+ on:click={set(tab.value)}>
74
75
  {tab.label}
75
76
  </ws-tab>
76
77
  {/each}
package/src/toggle.svelte CHANGED
@@ -25,8 +25,8 @@
25
25
  Used for binding, see the Svelte bind:group for details
26
26
  - ### label `string`
27
27
  The text to use for the label
28
- - ### outline `bool`
29
- Sets `$outline`
28
+ - ### flat `bool`
29
+ Sets `@flat`
30
30
  - ### reverse `bool`
31
31
  If true, the input being toggled will be on the left instead of the
32
32
  right. Default is false (label is on the left)
@@ -38,7 +38,7 @@
38
38
  <Toggle label="Active" bind:checked />
39
39
  <Toggle label="Active" checkbox bind:checked />
40
40
  <Toggle label="Active" checkbox reverse bind:checked />
41
- <Toggle label="Active" checkbox outline color="danger" bind:checked />
41
+ <Toggle label="Active" checkbox flat color="danger" bind:checked />
42
42
  ```
43
43
  */
44
44
 
@@ -47,7 +47,7 @@
47
47
  export let label = ""
48
48
  export let color = "default"
49
49
  export let checked = false
50
- export let outline = false
50
+ export let flat = false
51
51
  export let value
52
52
  export let group = []
53
53
  export let checkbox = false
@@ -55,7 +55,7 @@
55
55
 
56
56
  $: container = {
57
57
  "@toggle": true,
58
- "@outline": outline,
58
+ "@flat": flat,
59
59
  $color: color,
60
60
  ...$$restProps,
61
61
  }
@@ -81,7 +81,11 @@
81
81
 
82
82
  <label use:wsx={container}>
83
83
  {#if reverse !== true}
84
- <span>{label}</span>
84
+ {#if $$slots.default}
85
+ <slot />
86
+ {:else}
87
+ <span>{label}</span>
88
+ {/if}
85
89
  {/if}
86
90
  <input type="checkbox" bind:checked use:wsx={input} />
87
91
  {#if reverse === true}
@@ -0,0 +1,12 @@
1
+ export default ({ flat, fill, outline }, def = "@flat") => {
2
+ if (outline === true) {
3
+ return "@outline"
4
+ }
5
+ if (fill === true) {
6
+ return "@fill"
7
+ }
8
+ if (flat === true) {
9
+ return "@flat"
10
+ }
11
+ return def
12
+ }