@axel669/zephyr 0.2.0-beta.3 → 0.3.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.
Files changed (86) hide show
  1. package/package.json +33 -33
  2. package/readme.md +63 -63
  3. package/src/async/button.md +27 -0
  4. package/src/async/button.svelte +29 -31
  5. package/src/async/load-zone.md +42 -0
  6. package/src/async/load-zone.svelte +22 -20
  7. package/src/composed/data-table/th.md +21 -0
  8. package/src/composed/data-table/th.svelte +61 -61
  9. package/src/composed/data-table.md +86 -85
  10. package/src/composed/data-table.svelte +199 -149
  11. package/src/composed/entry-button.md +44 -34
  12. package/src/composed/entry-button.svelte +31 -31
  13. package/src/composed/table-functions.js +13 -13
  14. package/src/composed/toast/message.svelte +56 -56
  15. package/src/composed/toast.md +45 -36
  16. package/src/composed/toast.svelte +70 -70
  17. package/src/control/button.md +41 -41
  18. package/src/control/button.svelte +27 -27
  19. package/src/control/input.md +87 -0
  20. package/src/control/input.svelte +109 -109
  21. package/src/control/label.md +48 -49
  22. package/src/control/label.svelte +38 -38
  23. package/src/control/link.md +50 -50
  24. package/src/control/link.svelte +32 -30
  25. package/src/control/radio.md +58 -58
  26. package/src/control/radio.svelte +28 -28
  27. package/src/control/select.md +70 -70
  28. package/src/control/select.svelte +64 -64
  29. package/src/control/tabs.md +47 -47
  30. package/src/control/tabs.svelte +43 -41
  31. package/src/control/toggle.md +61 -61
  32. package/src/control/toggle.svelte +49 -49
  33. package/src/data-display/avatar.md +36 -36
  34. package/src/data-display/avatar.svelte +25 -25
  35. package/src/data-display/badge.md +30 -30
  36. package/src/data-display/badge.svelte +14 -14
  37. package/src/data-display/chip.md +36 -36
  38. package/src/data-display/chip.svelte +28 -28
  39. package/src/data-display/details.md +42 -3
  40. package/src/data-display/details.svelte +25 -25
  41. package/src/data-display/popover.md +32 -32
  42. package/src/data-display/popover.svelte +25 -25
  43. package/src/data-display/progress.md +46 -46
  44. package/src/data-display/progress.svelte +27 -27
  45. package/src/data-display/table.md +59 -7
  46. package/src/data-display/table.svelte +38 -38
  47. package/src/data-display/tooltip.md +29 -29
  48. package/src/data-display/tooltip.svelte +17 -17
  49. package/src/dialogs/alert.md +42 -3
  50. package/src/dialogs/alert.svelte +34 -34
  51. package/src/dialogs/confirm.md +56 -3
  52. package/src/dialogs/confirm.svelte +45 -45
  53. package/src/functions.md +108 -83
  54. package/src/handler$.mjs +20 -20
  55. package/src/hash.js +14 -0
  56. package/src/index.mjs +53 -52
  57. package/src/info/icon.md +21 -21
  58. package/src/info/icon.svelte +9 -9
  59. package/src/info/notification.md +36 -36
  60. package/src/info/notification.svelte +16 -16
  61. package/src/info/titlebar.md +75 -75
  62. package/src/info/titlebar.svelte +18 -18
  63. package/src/info/toaster.md +26 -26
  64. package/src/info/toaster.svelte +14 -14
  65. package/src/inline-dialog.svelte +23 -23
  66. package/src/layout/dialog.md +43 -43
  67. package/src/layout/dialog.svelte +26 -26
  68. package/src/layout/drawer.md +70 -70
  69. package/src/layout/drawer.svelte +49 -49
  70. package/src/layout/flex.md +43 -43
  71. package/src/layout/flex.svelte +26 -24
  72. package/src/layout/grid.md +61 -61
  73. package/src/layout/grid.svelte +30 -28
  74. package/src/layout/modal.md +50 -50
  75. package/src/layout/modal.svelte +60 -60
  76. package/src/layout/paper.md +94 -94
  77. package/src/layout/paper.svelte +47 -47
  78. package/src/layout/screen.md +33 -33
  79. package/src/layout/screen.svelte +34 -34
  80. package/src/spinner/circle-spinner.svelte +15 -15
  81. package/src/spinner/hexagon-spinner.svelte +15 -15
  82. package/src/spinner/spinners.md +22 -3
  83. package/src/text.md +34 -34
  84. package/src/text.svelte +22 -22
  85. package/src/variant.mjs +12 -12
  86. package/src/wsx.mjs +24 -24
@@ -1,109 +1,109 @@
1
- <svelte:options immutable />
2
-
3
- <script context="module">
4
- const parseNumeric = (value) => {
5
- if (value === "") {
6
- return null
7
- }
8
- return parseFloat(value)
9
- }
10
-
11
- const diff = (type, value, internal) => {
12
- if ((type !== "number" && type !== "range") || typeof value === "string") {
13
- return value !== internal
14
- }
15
- return parseFloat(internal) !== value
16
- }
17
- </script>
18
-
19
- <script>
20
- import wsx from "../wsx.mjs"
21
-
22
- export let type = "text"
23
-
24
- export let flat = false
25
- export let label
26
- export let color = "default"
27
- export let error = null
28
- export let hint = null
29
- export let disabled
30
-
31
- export let value = ""
32
- export let autocompleteOptions = null
33
-
34
- export let transform = i => i
35
- export let tvalue
36
- export let validate = () => true
37
- export let valid
38
-
39
- let input = null
40
- let internalValue = value
41
- export const focus = () => input.focus()
42
-
43
- const id =
44
- (autocompleteOptions === null)
45
- ? null
46
- : `${Math.random().toString(16)}_${Date.now()}`
47
-
48
- $: isNumeric = (type === "number" || type === "range")
49
- $: if (diff(type, value, internalValue) === true) {
50
- internalValue = value
51
- }
52
-
53
- const update = (evt) => {
54
- internalValue = evt.target.value
55
- value = (isNumeric === true) ? parseNumeric(internalValue) : internalValue
56
- tvalue = transform(value)
57
- valid = validate(tvalue)
58
- }
59
-
60
- $: restKeys = Object.keys($$restProps)
61
- $: props = restKeys.reduce(
62
- (props, key) => {
63
- const [target, name] =
64
- (key.startsWith("i-") === true)
65
- ? [props.input, key.slice(2)]
66
- : [props.wind, key]
67
- target[name] = $$restProps[key]
68
- return props
69
- },
70
- {wind: {}, input: {}}
71
- )
72
-
73
- $: wind = {
74
- "$flat": flat,
75
- "$control": true,
76
- "$color": color,
77
- ...props.wind,
78
- }
79
-
80
- $: tag = (type === "area") ? "textarea" : "input"
81
- </script>
82
-
83
- <label use:wsx={wind} ws-error={error}>
84
- {#if label}
85
- <span ws-x="$text" ws-hint={hint}>{label}</span>
86
- {/if}
87
- <svelte:element
88
- this={tag}
89
- {...props.input}
90
- {disabled}
91
- {type}
92
- value={internalValue}
93
- list={id}
94
- on:focus
95
- on:blur
96
- on:input={update}
97
- bind:this={input}
98
- />
99
-
100
- <slot name="start" />
101
- <slot name="end" />
102
- {#if autocompleteOptions !== null}
103
- <datalist {id}>
104
- {#each autocompleteOptions as value}
105
- <option {value} />
106
- {/each}
107
- </datalist>
108
- {/if}
109
- </label>
1
+ <svelte:options immutable />
2
+
3
+ <script context="module">
4
+ const parseNumeric = (value) => {
5
+ if (value === "") {
6
+ return null
7
+ }
8
+ return parseFloat(value)
9
+ }
10
+
11
+ const diff = (type, value, internal) => {
12
+ if ((type !== "number" && type !== "range") || typeof value === "string") {
13
+ return value !== internal
14
+ }
15
+ return parseFloat(internal) !== value
16
+ }
17
+ </script>
18
+
19
+ <script>
20
+ import wsx from "../wsx.mjs"
21
+
22
+ export let type = "text"
23
+
24
+ export let flat = false
25
+ export let label
26
+ export let color = "@default"
27
+ export let error = null
28
+ export let hint = null
29
+ export let disabled
30
+
31
+ export let value = ""
32
+ export let autocompleteOptions = null
33
+
34
+ export let transform = i => i
35
+ export let tvalue
36
+ export let validate = () => true
37
+ export let valid
38
+
39
+ let input = null
40
+ let internalValue = value
41
+ export const focus = () => input.focus()
42
+
43
+ const id =
44
+ (autocompleteOptions === null)
45
+ ? null
46
+ : `${Math.random().toString(16)}_${Date.now()}`
47
+
48
+ $: isNumeric = (type === "number" || type === "range")
49
+ $: if (diff(type, value, internalValue) === true) {
50
+ internalValue = value
51
+ }
52
+
53
+ const update = (evt) => {
54
+ internalValue = evt.target.value
55
+ value = (isNumeric === true) ? parseNumeric(internalValue) : internalValue
56
+ tvalue = transform(value)
57
+ valid = validate(tvalue)
58
+ }
59
+
60
+ $: restKeys = Object.keys($$restProps)
61
+ $: props = restKeys.reduce(
62
+ (props, key) => {
63
+ const [target, name] =
64
+ (key.startsWith("i-") === true)
65
+ ? [props.input, key.slice(2)]
66
+ : [props.wind, key]
67
+ target[name] = $$restProps[key]
68
+ return props
69
+ },
70
+ {wind: {}, input: {}}
71
+ )
72
+
73
+ $: wind = {
74
+ "$flat": flat,
75
+ "@control": true,
76
+ "$color": color,
77
+ ...props.wind,
78
+ }
79
+
80
+ $: tag = (type === "area") ? "textarea" : "input"
81
+ </script>
82
+
83
+ <label use:wsx={wind} ws-error={error}>
84
+ {#if label}
85
+ <span use:wsx={{ slot: "label-text" }} ws-hint={hint}>{label}</span>
86
+ {/if}
87
+ <svelte:element
88
+ this={tag}
89
+ {...props.input}
90
+ {disabled}
91
+ {type}
92
+ value={internalValue}
93
+ list={id}
94
+ on:focus
95
+ on:blur
96
+ on:input={update}
97
+ bind:this={input}
98
+ />
99
+
100
+ <slot name="start" />
101
+ <slot name="end" />
102
+ {#if autocompleteOptions !== null}
103
+ <datalist {id}>
104
+ {#each autocompleteOptions as value}
105
+ <option {value} />
106
+ {/each}
107
+ </datalist>
108
+ {/if}
109
+ </label>
@@ -1,49 +1,48 @@
1
- # Label
2
-
3
- The label component is a wrapper around a `<label>` element.
4
-
5
- ## Props
6
-
7
- ### button
8
- `bool`
9
-
10
- If true, the label will have the button appearance.
11
-
12
- ### color
13
- `string`
14
-
15
- Sets `$color`
16
-
17
- ### compact
18
- `bool`
19
-
20
- If true, will make the label button be more compact. No effect is `button` is
21
- `false`.
22
-
23
- ### disabled
24
- `bool`
25
-
26
- Disables the label.
27
-
28
- ### fill / outline / flat
29
- `bool`
30
-
31
- Sets the button variant of the label when `button` is `true`.
32
-
33
- ### for
34
- `string`
35
-
36
- [Label for attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/label#for)
37
-
38
- ## Example
39
-
40
- ```svelte
41
- <script>
42
- import { Label } from "@axel669/zephyr"
43
- </script>
44
-
45
- <Label for="checkbox">Toggle Checkbox</Label>
46
- <Label for="checkbox" button color="primary" fill>
47
- Open Menu
48
- </Label>
49
- ```
1
+ # Label
2
+ The label component is a wrapper around a `<label>` element.
3
+
4
+ ## Props
5
+
6
+ ### button
7
+ `bool`
8
+
9
+ If true, the label will have the button appearance.
10
+
11
+ ### color
12
+ `string`
13
+
14
+ Sets `$color`
15
+
16
+ ### compact
17
+ `bool`
18
+
19
+ If true, will make the label button be more compact. No effect is `button` is
20
+ `false`.
21
+
22
+ ### disabled
23
+ `bool`
24
+
25
+ Disables the label.
26
+
27
+ ### fill / outline / flat
28
+ `bool`
29
+
30
+ Sets the button variant of the label when `button` is `true`.
31
+
32
+ ### for
33
+ `string`
34
+
35
+ [Label for attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/label#for)
36
+
37
+ ## Example
38
+
39
+ ```svelte
40
+ <script>
41
+ import { Label } from "@axel669/zephyr"
42
+ </script>
43
+
44
+ <Label for="checkbox">Toggle Checkbox</Label>
45
+ <Label for="checkbox" button color="primary" fill>
46
+ Open Menu
47
+ </Label>
48
+ ```
@@ -1,38 +1,38 @@
1
- <svelte:options immutable />
2
-
3
- <script>
4
- import wsx from "../wsx.mjs"
5
- import variant from "../variant.mjs"
6
-
7
- export let color = false
8
- export let compact = false
9
- export let disabled
10
-
11
- export let fill = false
12
- export let outline = false
13
- export let flat = false
14
-
15
- let _for = ""
16
- export { _for as for }
17
- export let button = false
18
-
19
- $: type = variant({ fill, outline, flat })
20
- $: baseStyles =
21
- (button === true)
22
- ? {
23
- $button: true,
24
- [type]: true,
25
- "$color": color,
26
- $compact: compact,
27
- }
28
- : {}
29
-
30
- $: wind = {
31
- ...baseStyles,
32
- ...$$restProps
33
- }
34
- </script>
35
-
36
- <label use:wsx={wind} {disabled} for={_for}>
37
- <slot />
38
- </label>
1
+ <svelte:options immutable />
2
+
3
+ <script>
4
+ import wsx from "../wsx.mjs"
5
+ import variant from "../variant.mjs"
6
+
7
+ export let color = false
8
+ export let compact = false
9
+ export let disabled
10
+
11
+ export let fill = false
12
+ export let outline = false
13
+ export let flat = false
14
+
15
+ let _for = ""
16
+ export { _for as for }
17
+ export let button = false
18
+
19
+ $: type = variant({ fill, outline, flat })
20
+ $: baseStyles =
21
+ (button === true)
22
+ ? {
23
+ "@button": true,
24
+ [type]: true,
25
+ "$color": color,
26
+ $compact: compact,
27
+ }
28
+ : {}
29
+
30
+ $: wind = {
31
+ ...baseStyles,
32
+ ...$$restProps
33
+ }
34
+ </script>
35
+
36
+ <label use:wsx={wind} {disabled} for={_for}>
37
+ <slot />
38
+ </label>
@@ -1,50 +1,50 @@
1
- # Link
2
-
3
- Themed and customizale `<a>` tag component.
4
-
5
- ## Props
6
-
7
- ### button `string`
8
-
9
- If true, the link will be styled like a button
10
-
11
- ### color
12
- `string`
13
-
14
- Sets the color of the button. Applies to both regular links and button
15
- style links.
16
-
17
- ### href
18
- `string`
19
-
20
- Sets the href attribute.
21
-
22
- ### rel
23
- `string`
24
-
25
- Sets the rel attribute.
26
-
27
- ### target
28
- `string`
29
-
30
- Sets the target attribute.
31
-
32
- ### fill / outline / flat
33
- `bool`
34
-
35
- Sets the link-button type to `$fill` if fill is true, `$outline` if outline
36
- is true, or `$flat` if neither is true.
37
-
38
- ## Example
39
- ```svelte
40
- <script>
41
- import { Link } from "@axel669/zephyr"
42
- </script>
43
-
44
- <Link color="primary" href="test" target="_blank">
45
- Test
46
- </Link>
47
- <Link color="primary" href="logout" button outline>
48
- Logout
49
- </Link>
50
- ```
1
+ # Link
2
+
3
+ Themed and customizale `<a>` tag component.
4
+
5
+ ## Props
6
+
7
+ ### button `string`
8
+
9
+ If true, the link will be styled like a button
10
+
11
+ ### color
12
+ `string`
13
+
14
+ Sets the color of the button. Applies to both regular links and button
15
+ style links.
16
+
17
+ ### href
18
+ `string`
19
+
20
+ Sets the href attribute.
21
+
22
+ ### rel
23
+ `string`
24
+
25
+ Sets the rel attribute.
26
+
27
+ ### target
28
+ `string`
29
+
30
+ Sets the target attribute.
31
+
32
+ ### fill / outline / flat
33
+ `bool`
34
+
35
+ Sets the link-button type to `$fill` if fill is true, `$outline` if outline
36
+ is true, or `$flat` if neither is true.
37
+
38
+ ## Example
39
+ ```svelte
40
+ <script>
41
+ import { Link } from "@axel669/zephyr"
42
+ </script>
43
+
44
+ <Link color="primary" href="test" target="_blank">
45
+ Test
46
+ </Link>
47
+ <Link color="primary" href="logout" button outline>
48
+ Logout
49
+ </Link>
50
+ ```
@@ -1,30 +1,32 @@
1
- <svelte:options immutable />
2
-
3
- <script>
4
- import wsx from "../wsx.mjs"
5
- import variant from "../variant.mjs"
6
-
7
- export let button = false
8
- export let color = false
9
-
10
- export let href = ""
11
- export let rel = "noreferrer"
12
- export let target = null
13
-
14
- export let fill = false
15
- export let outline = false
16
- export let flat = false
17
-
18
- $: type = variant({ fill, outline, flat })
19
-
20
- $: wind = {
21
- "$button": button,
22
- [type]: true,
23
- "$color": color,
24
- ...$$restProps
25
- }
26
- </script>
27
-
28
- <a {href} {target} {rel} use:wsx={wind}>
29
- <slot />
30
- </a>
1
+ <svelte:options immutable />
2
+
3
+ <script>
4
+ import wsx from "../wsx.mjs"
5
+ import variant from "../variant.mjs"
6
+
7
+ export let button = false
8
+ export let color = false
9
+
10
+ export let href = ""
11
+ export let rel = "noreferrer"
12
+ export let target = null
13
+
14
+ export let fill = false
15
+ export let outline = false
16
+ export let flat = false
17
+
18
+ export let disabled = null
19
+
20
+ $: type = variant({ fill, outline, flat })
21
+
22
+ $: wind = {
23
+ "@button": button,
24
+ [type]: true,
25
+ "$color": color,
26
+ ...$$restProps
27
+ }
28
+ </script>
29
+
30
+ <a {href} {target} {rel} disabled={disabled || null} use:wsx={wind} on:click>
31
+ <slot />
32
+ </a>
@@ -1,58 +1,58 @@
1
- # Radio
2
-
3
- The radio component displays a list of radio options and provides an
4
- interface to control which one is selected and react to changes in the
5
- selected value. It also uses a layout component to decide how the options
6
- are presented.
7
-
8
- ## Base
9
- Each radio item rendered is a
10
- [Windstorm Labeled Toggle](https://windstorm.axel669.net/lib/css/component/toggle)
11
- that uses a radio input.
12
-
13
- ## Props
14
-
15
- The wind functions passed as props to the Radio component are passed directly to
16
- the layout specified because the Radio does not have a container element of its
17
- own.
18
-
19
- ### layout
20
- `Component`
21
-
22
- The component to use for layout out the options. Default is
23
- [Flex](../layout/flex.md).
24
-
25
- ### options
26
- `Array[Object]`
27
-
28
- An array of objects that defines the options to show. Details below.
29
-
30
- ### value
31
- `any`
32
-
33
- The value currently selected. Can be bound to react to selections or change the
34
- current selection.
35
-
36
- ## Options
37
- Each object in the options array supplied should have a `value` and `label`
38
- prop specified. Additionally, any wind functions that should be applied to
39
- the option can be passed as additional props.
40
-
41
- Labels should be strings, but values can be any type as long as they are
42
- unique in the list.
43
-
44
- ## Example
45
- ```svelte
46
- <script>
47
- import { Radio, Grid } from "@axel669/zephyr"
48
-
49
- const options = [
50
- { label: "first", value: 1 },
51
- { label: "second", value: [] },
52
- { label: "third", value: "3", "$color": "warning" }
53
- ]
54
- </script>
55
-
56
- <Radio {options} bind:value />
57
- <Radio {options} bind:value={other} layout={Grid} gr.cols="1fr 1fr" />
58
- ```
1
+ # Radio
2
+
3
+ The radio component displays a list of radio options and provides an
4
+ interface to control which one is selected and react to changes in the
5
+ selected value. It also uses a layout component to decide how the options
6
+ are presented.
7
+
8
+ ## Base
9
+ Each radio item rendered is a
10
+ [Windstorm Labeled Toggle](https://windstorm.axel669.net/lib/css/component/toggle)
11
+ that uses a radio input.
12
+
13
+ ## Props
14
+
15
+ The wind functions passed as props to the Radio component are passed directly to
16
+ the layout specified because the Radio does not have a container element of its
17
+ own.
18
+
19
+ ### layout
20
+ `Component`
21
+
22
+ The component to use for layout out the options. Default is
23
+ [Flex](../layout/flex.md).
24
+
25
+ ### options
26
+ `Array[Object]`
27
+
28
+ An array of objects that defines the options to show. Details below.
29
+
30
+ ### value
31
+ `any`
32
+
33
+ The value currently selected. Can be bound to react to selections or change the
34
+ current selection.
35
+
36
+ ## Options
37
+ Each object in the options array supplied should have a `value` and `label`
38
+ prop specified. Additionally, any wind functions that should be applied to
39
+ the option can be passed as additional props.
40
+
41
+ Labels should be strings, but values can be any type as long as they are
42
+ unique in the list.
43
+
44
+ ## Example
45
+ ```svelte
46
+ <script>
47
+ import { Radio, Grid } from "@axel669/zephyr"
48
+
49
+ const options = [
50
+ { label: "first", value: 1 },
51
+ { label: "second", value: [] },
52
+ { label: "third", value: "3", "$color": "warning" }
53
+ ]
54
+ </script>
55
+
56
+ <Radio {options} bind:value />
57
+ <Radio {options} bind:value={other} layout={Grid} gr.cols="1fr 1fr" />
58
+ ```