@axel669/zephyr 0.3.4-beta.0 → 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 -27
  4. package/src/async/button.svelte +29 -29
  5. package/src/async/load-zone.md +42 -42
  6. package/src/async/load-zone.svelte +22 -22
  7. package/src/composed/data-table/th.md +21 -21
  8. package/src/composed/data-table/th.svelte +61 -61
  9. package/src/composed/data-table.md +86 -86
  10. package/src/composed/data-table.svelte +199 -199
  11. package/src/composed/entry-button.md +44 -44
  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 -45
  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 -87
  20. package/src/control/input.svelte +109 -109
  21. package/src/control/label.md +48 -48
  22. package/src/control/label.svelte +38 -38
  23. package/src/control/link.md +50 -50
  24. package/src/control/link.svelte +32 -32
  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 -43
  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 -42
  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 -59
  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 -42
  50. package/src/dialogs/alert.svelte +34 -34
  51. package/src/dialogs/confirm.md +56 -56
  52. package/src/dialogs/confirm.svelte +45 -45
  53. package/src/functions.md +108 -108
  54. package/src/handler$.mjs +20 -20
  55. package/src/hash.js +14 -14
  56. package/src/index.mjs +53 -53
  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 -26
  72. package/src/layout/grid.md +61 -61
  73. package/src/layout/grid.svelte +30 -30
  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 -22
  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,17 +1,17 @@
1
- <svelte:options immutable />
2
-
3
- <script>
4
- import wsx from "../wsx.mjs"
5
-
6
- export let text = ""
7
- export let bottom = false
8
-
9
- $: wind = {
10
- $bottom: bottom,
11
- ...$$restProps,
12
- }
13
- </script>
14
-
15
- <ws-tooltip ws-text={text} use:wsx={wind}>
16
- <slot />
17
- </ws-tooltip>
1
+ <svelte:options immutable />
2
+
3
+ <script>
4
+ import wsx from "../wsx.mjs"
5
+
6
+ export let text = ""
7
+ export let bottom = false
8
+
9
+ $: wind = {
10
+ $bottom: bottom,
11
+ ...$$restProps,
12
+ }
13
+ </script>
14
+
15
+ <ws-tooltip ws-text={text} use:wsx={wind}>
16
+ <slot />
17
+ </ws-tooltip>
@@ -1,42 +1,42 @@
1
- # Alert Dialog
2
- A nicer alert dialog to use with [Modal](../layout/dialog.md).
3
-
4
- ## Props
5
-
6
- ### color
7
- Sets the $color macro.
8
-
9
- ### icon
10
- The name of an icon to show with the title of the alert.
11
-
12
- ### message
13
- The message to shwo in the alert.
14
-
15
- ### okText
16
- The text for the button that closes the alert.
17
-
18
- ### title
19
- The title for the alert.
20
-
21
- ## Example
22
- ```svelte
23
- <script>
24
- import { Alert, Button, EntryButton, Modal } from "@axel669/zephyr"
25
-
26
- let alertModal = null
27
- const alertProps = {
28
- title: "Alert Example",
29
- message: "This is an alert!"
30
- }
31
- const show = () => alertModal.show(alertProps)
32
- </script>
33
-
34
- <Modal component={Alert} bind:this={alertModal} />
35
- <Button on:click={show}>
36
- Show Alert
37
- </Button>
38
-
39
- <EntryButton props={alertProps}>
40
- Show Alert
41
- </EntryButton>
42
- ```
1
+ # Alert Dialog
2
+ A nicer alert dialog to use with [Modal](../layout/dialog.md).
3
+
4
+ ## Props
5
+
6
+ ### color
7
+ Sets the $color macro.
8
+
9
+ ### icon
10
+ The name of an icon to show with the title of the alert.
11
+
12
+ ### message
13
+ The message to shwo in the alert.
14
+
15
+ ### okText
16
+ The text for the button that closes the alert.
17
+
18
+ ### title
19
+ The title for the alert.
20
+
21
+ ## Example
22
+ ```svelte
23
+ <script>
24
+ import { Alert, Button, EntryButton, Modal } from "@axel669/zephyr"
25
+
26
+ let alertModal = null
27
+ const alertProps = {
28
+ title: "Alert Example",
29
+ message: "This is an alert!"
30
+ }
31
+ const show = () => alertModal.show(alertProps)
32
+ </script>
33
+
34
+ <Modal component={Alert} bind:this={alertModal} />
35
+ <Button on:click={show}>
36
+ Show Alert
37
+ </Button>
38
+
39
+ <EntryButton props={alertProps}>
40
+ Show Alert
41
+ </EntryButton>
42
+ ```
@@ -1,34 +1,34 @@
1
- <svelte:options immutable />
2
-
3
- <script>
4
- import Button from "../control/button.svelte"
5
- import Dialog from "../layout/dialog.svelte"
6
- import Icon from "../info/icon.svelte"
7
- import Text from "../text.svelte"
8
- import Titlebar from "../info/titlebar.svelte"
9
-
10
- export let close
11
- export let title = "Alert"
12
- export let icon
13
- export let message
14
- export let okText = "OK"
15
- export let color = "@primary"
16
- </script>
17
-
18
- <Dialog card {color}>
19
- <Titlebar slot="header" {color}>
20
- <Text title slot="title">
21
- <Icon name={icon}>
22
- {title}
23
- </Icon>
24
- </Text>
25
- </Titlebar>
26
-
27
- <Text>
28
- {message}
29
- </Text>
30
-
31
- <Button slot="footer" on:click={close} {color}>
32
- {okText}
33
- </Button>
34
- </Dialog>
1
+ <svelte:options immutable />
2
+
3
+ <script>
4
+ import Button from "../control/button.svelte"
5
+ import Dialog from "../layout/dialog.svelte"
6
+ import Icon from "../info/icon.svelte"
7
+ import Text from "../text.svelte"
8
+ import Titlebar from "../info/titlebar.svelte"
9
+
10
+ export let close
11
+ export let title = "Alert"
12
+ export let icon
13
+ export let message
14
+ export let okText = "OK"
15
+ export let color = "@primary"
16
+ </script>
17
+
18
+ <Dialog card {color}>
19
+ <Titlebar slot="header" {color}>
20
+ <Text title slot="title">
21
+ <Icon name={icon}>
22
+ {title}
23
+ </Icon>
24
+ </Text>
25
+ </Titlebar>
26
+
27
+ <Text>
28
+ {message}
29
+ </Text>
30
+
31
+ <Button slot="footer" on:click={close} {color}>
32
+ {okText}
33
+ </Button>
34
+ </Dialog>
@@ -1,56 +1,56 @@
1
- # Confirm Dialog
2
- A nicer confirm dialog to use with [Modal](../layout/dialog.md).
3
-
4
- ## Props
5
-
6
- ### color
7
- Sets the $color macro.
8
-
9
- ### icon
10
- The name of an icon to show with the title of the dialog.
11
-
12
- ### message
13
- The message to shwo in the confirm.
14
-
15
- ### cancelText
16
- The text for the button that cancels the dialog.
17
-
18
- ### okText
19
- The text for the button that confirms the dialog.
20
-
21
- ### title
22
- The title for the dialog.
23
-
24
- ## Return Values
25
- The Confirm component will return `true` from the `Modal.show` function if the
26
- OK button is clicked, and false if the Cancel button is clicked.
27
-
28
- ## Example
29
- ```svelte
30
- <script>
31
- import { Confirm, Button, EntryButton, Modal } from "@axel669/zephyr"
32
-
33
- let confirmModal = null
34
- const confirmProps = {
35
- title: "Confirm Example",
36
- message: "This is an confirm!"
37
- }
38
- const show = async () => {
39
- const result = await confirmModal.show(confirmProps)
40
- if (result === true) {
41
- console.log("confirmed!")
42
- return
43
- }
44
- console.log("cancelled :(")
45
- }
46
- </script>
47
-
48
- <Modal component={Confirm} bind:this={confirmModal} />
49
- <Button on:click={show}>
50
- Show Confirm
51
- </Button>
52
-
53
- <EntryButton props={confirmProps}>
54
- Show Confirm
55
- </EntryButton>
56
- ```
1
+ # Confirm Dialog
2
+ A nicer confirm dialog to use with [Modal](../layout/dialog.md).
3
+
4
+ ## Props
5
+
6
+ ### color
7
+ Sets the $color macro.
8
+
9
+ ### icon
10
+ The name of an icon to show with the title of the dialog.
11
+
12
+ ### message
13
+ The message to shwo in the confirm.
14
+
15
+ ### cancelText
16
+ The text for the button that cancels the dialog.
17
+
18
+ ### okText
19
+ The text for the button that confirms the dialog.
20
+
21
+ ### title
22
+ The title for the dialog.
23
+
24
+ ## Return Values
25
+ The Confirm component will return `true` from the `Modal.show` function if the
26
+ OK button is clicked, and false if the Cancel button is clicked.
27
+
28
+ ## Example
29
+ ```svelte
30
+ <script>
31
+ import { Confirm, Button, EntryButton, Modal } from "@axel669/zephyr"
32
+
33
+ let confirmModal = null
34
+ const confirmProps = {
35
+ title: "Confirm Example",
36
+ message: "This is an confirm!"
37
+ }
38
+ const show = async () => {
39
+ const result = await confirmModal.show(confirmProps)
40
+ if (result === true) {
41
+ console.log("confirmed!")
42
+ return
43
+ }
44
+ console.log("cancelled :(")
45
+ }
46
+ </script>
47
+
48
+ <Modal component={Confirm} bind:this={confirmModal} />
49
+ <Button on:click={show}>
50
+ Show Confirm
51
+ </Button>
52
+
53
+ <EntryButton props={confirmProps}>
54
+ Show Confirm
55
+ </EntryButton>
56
+ ```
@@ -1,45 +1,45 @@
1
- <svelte:options immutable />
2
-
3
- <script>
4
- import Button from "../control/button.svelte"
5
- import Dialog from "../layout/dialog.svelte"
6
- import Grid from "../layout/grid.svelte"
7
- import Icon from "../info/icon.svelte"
8
- import Text from "../text.svelte"
9
- import Titlebar from "../info/titlebar.svelte"
10
-
11
- import { handler$ } from "../handler$.mjs"
12
-
13
- export let close
14
- export let title = "Confirm"
15
- export let icon
16
- export let message
17
- export let okText = "OK"
18
- export let cancelText = "Cancel"
19
- export let color = "@primary"
20
-
21
- const cls = handler$(close)
22
- </script>
23
-
24
- <Dialog card {color}>
25
- <Titlebar slot="header" {color}>
26
- <Text title slot="title">
27
- <Icon name={icon}>
28
- {title}
29
- </Icon>
30
- </Text>
31
- </Titlebar>
32
-
33
- <Text>
34
- {message}
35
- </Text>
36
-
37
- <Grid cols="1fr 1fr" slot="footer" pad="0px">
38
- <Button on:click={cls(false)} color="danger">
39
- {cancelText}
40
- </Button>
41
- <Button on:click={cls(true)} color="secondary">
42
- {okText}
43
- </Button>
44
- </Grid>
45
- </Dialog>
1
+ <svelte:options immutable />
2
+
3
+ <script>
4
+ import Button from "../control/button.svelte"
5
+ import Dialog from "../layout/dialog.svelte"
6
+ import Grid from "../layout/grid.svelte"
7
+ import Icon from "../info/icon.svelte"
8
+ import Text from "../text.svelte"
9
+ import Titlebar from "../info/titlebar.svelte"
10
+
11
+ import { handler$ } from "../handler$.mjs"
12
+
13
+ export let close
14
+ export let title = "Confirm"
15
+ export let icon
16
+ export let message
17
+ export let okText = "OK"
18
+ export let cancelText = "Cancel"
19
+ export let color = "@primary"
20
+
21
+ const cls = handler$(close)
22
+ </script>
23
+
24
+ <Dialog card {color}>
25
+ <Titlebar slot="header" {color}>
26
+ <Text title slot="title">
27
+ <Icon name={icon}>
28
+ {title}
29
+ </Icon>
30
+ </Text>
31
+ </Titlebar>
32
+
33
+ <Text>
34
+ {message}
35
+ </Text>
36
+
37
+ <Grid cols="1fr 1fr" slot="footer" pad="0px">
38
+ <Button on:click={cls(false)} color="danger">
39
+ {cancelText}
40
+ </Button>
41
+ <Button on:click={cls(true)} color="secondary">
42
+ {okText}
43
+ </Button>
44
+ </Grid>
45
+ </Dialog>
package/src/functions.md CHANGED
@@ -1,108 +1,108 @@
1
- # Library Functions/Actions
2
-
3
- Zephyr has a few functions to make some tasks easier for working with the
4
- library.
5
-
6
- ## handler$
7
-
8
- Wraps a function for currying as an event handler. The curried function does
9
- not pass the event into final function call.
10
-
11
- ### Example
12
- ```svelte
13
- <script>
14
- import { handler$ } from "@axel669/zephyr"
15
-
16
- const clicked = handler$(
17
- (buttonName) => console.log(buttonName)
18
- )
19
- </script>
20
-
21
- <!-- logs "first" when clicked -->
22
- <Button on:click={clicked("first")}>
23
- First
24
- </Button>
25
- <!-- logs "second" when clicked -->
26
- <Button on:click={clicked("second")}>
27
- Second
28
- </Button>
29
- ```
30
-
31
- ## eventHandler$
32
-
33
- Wraps a function for currying as an event handler. Unlike the `handler$`
34
- function, the event is passed to the curried function.
35
-
36
- ### Example
37
-
38
- ```svelte
39
- <script>
40
- import { eventHandler$ } from "@axel669/zephyr"
41
-
42
- const clicked = eventHandler$(
43
- (event, buttonName) => console.log(event, buttonName)
44
- )
45
- </script>
46
-
47
- <!-- logs the event and "first" when clicked -->
48
- <Button on:click={clicked("first")}>
49
- First
50
- </Button>
51
- <!-- logs the event and "second" when clicked -->
52
- <Button on:click={clicked("second")}>
53
- Second
54
- </Button>
55
- ```
56
-
57
- ## wsx Action
58
-
59
- The wsx action can be used to set the `ws-x` attribute on a DOM element by using
60
- an object as the source rather than trying to do the string manipulation
61
- directly.
62
- - `null`, `undefined`, and `false` will not insert the wind function
63
- - `true` will insert the wind function with no args
64
- - any string value will insert the wind function with the arguments formatted
65
- for the parser (replace spaces and underscores as needed).
66
-
67
- ### Example
68
- ```svelte
69
- <script>
70
- import { wsx } from "@axel669/zephyr"
71
-
72
- // will generate ws-x="grid gr-col[1fr 1fr]"
73
- const wsxProps = {
74
- grid: true,
75
- "gr.cols": "1fr 1fr",
76
- bg: null
77
- }
78
- </script>
79
-
80
- <div use:wsx={wsxProps}>
81
- <span>Content</span>
82
- </div>
83
- ```
84
-
85
- ## hash store
86
- A svelte store that has the current value of the browser page hash. It uses
87
- polling to check the value several times a second (it's a cheap check) so the
88
- weird browser issues around hash change events don't affect it. Can also be used
89
- to set the browser hash.
90
-
91
- ### Example
92
- ```svelte
93
- <script>
94
- import { hash } from "@axel669/zephyr"
95
- </script>
96
-
97
- <div>
98
- Browser hash: {$hash}
99
- </div>
100
- ```
101
-
102
- ## sorts
103
- A collection fo sorting functions for use with the DataTable. Currently only
104
- has natural sort as `sorts.natural(colProp)`.
105
-
106
- ## filters
107
- A collection of filter functions for use with the DataTable. Currently only has
108
- a text filter function as `filter.text(colProp)`.
1
+ # Library Functions/Actions
2
+
3
+ Zephyr has a few functions to make some tasks easier for working with the
4
+ library.
5
+
6
+ ## handler$
7
+
8
+ Wraps a function for currying as an event handler. The curried function does
9
+ not pass the event into final function call.
10
+
11
+ ### Example
12
+ ```svelte
13
+ <script>
14
+ import { handler$ } from "@axel669/zephyr"
15
+
16
+ const clicked = handler$(
17
+ (buttonName) => console.log(buttonName)
18
+ )
19
+ </script>
20
+
21
+ <!-- logs "first" when clicked -->
22
+ <Button on:click={clicked("first")}>
23
+ First
24
+ </Button>
25
+ <!-- logs "second" when clicked -->
26
+ <Button on:click={clicked("second")}>
27
+ Second
28
+ </Button>
29
+ ```
30
+
31
+ ## eventHandler$
32
+
33
+ Wraps a function for currying as an event handler. Unlike the `handler$`
34
+ function, the event is passed to the curried function.
35
+
36
+ ### Example
37
+
38
+ ```svelte
39
+ <script>
40
+ import { eventHandler$ } from "@axel669/zephyr"
41
+
42
+ const clicked = eventHandler$(
43
+ (event, buttonName) => console.log(event, buttonName)
44
+ )
45
+ </script>
46
+
47
+ <!-- logs the event and "first" when clicked -->
48
+ <Button on:click={clicked("first")}>
49
+ First
50
+ </Button>
51
+ <!-- logs the event and "second" when clicked -->
52
+ <Button on:click={clicked("second")}>
53
+ Second
54
+ </Button>
55
+ ```
56
+
57
+ ## wsx Action
58
+
59
+ The wsx action can be used to set the `ws-x` attribute on a DOM element by using
60
+ an object as the source rather than trying to do the string manipulation
61
+ directly.
62
+ - `null`, `undefined`, and `false` will not insert the wind function
63
+ - `true` will insert the wind function with no args
64
+ - any string value will insert the wind function with the arguments formatted
65
+ for the parser (replace spaces and underscores as needed).
66
+
67
+ ### Example
68
+ ```svelte
69
+ <script>
70
+ import { wsx } from "@axel669/zephyr"
71
+
72
+ // will generate ws-x="grid gr-col[1fr 1fr]"
73
+ const wsxProps = {
74
+ grid: true,
75
+ "gr.cols": "1fr 1fr",
76
+ bg: null
77
+ }
78
+ </script>
79
+
80
+ <div use:wsx={wsxProps}>
81
+ <span>Content</span>
82
+ </div>
83
+ ```
84
+
85
+ ## hash store
86
+ A svelte store that has the current value of the browser page hash. It uses
87
+ polling to check the value several times a second (it's a cheap check) so the
88
+ weird browser issues around hash change events don't affect it. Can also be used
89
+ to set the browser hash.
90
+
91
+ ### Example
92
+ ```svelte
93
+ <script>
94
+ import { hash } from "@axel669/zephyr"
95
+ </script>
96
+
97
+ <div>
98
+ Browser hash: {$hash}
99
+ </div>
100
+ ```
101
+
102
+ ## sorts
103
+ A collection fo sorting functions for use with the DataTable. Currently only
104
+ has natural sort as `sorts.natural(colProp)`.
105
+
106
+ ## filters
107
+ A collection of filter functions for use with the DataTable. Currently only has
108
+ a text filter function as `filter.text(colProp)`.
package/src/handler$.mjs CHANGED
@@ -1,20 +1,20 @@
1
- /**
2
- Wraps a handler function for easy reuse.
3
-
4
- @param {Function} func The handler function to wrap
5
- */
6
- const handler$ = (func) =>
7
- (...args) =>
8
- (_, ...extra) => func(...args, ...extra)
9
-
10
- /**
11
- Wraps a handler function for easy reuse, and doesn't throw away the event arg
12
- passed by events firing.
13
-
14
- @param {Function} func The handler function to wrap
15
- */
16
- const eventHandler$ = (func) =>
17
- (...args) =>
18
- (...extra) => func(...extra, ...args)
19
-
20
- export { handler$, eventHandler$ }
1
+ /**
2
+ Wraps a handler function for easy reuse.
3
+
4
+ @param {Function} func The handler function to wrap
5
+ */
6
+ const handler$ = (func) =>
7
+ (...args) =>
8
+ (_, ...extra) => func(...args, ...extra)
9
+
10
+ /**
11
+ Wraps a handler function for easy reuse, and doesn't throw away the event arg
12
+ passed by events firing.
13
+
14
+ @param {Function} func The handler function to wrap
15
+ */
16
+ const eventHandler$ = (func) =>
17
+ (...args) =>
18
+ (...extra) => func(...extra, ...args)
19
+
20
+ export { handler$, eventHandler$ }
package/src/hash.js CHANGED
@@ -1,14 +1,14 @@
1
- import { readable } from "svelte/store"
2
-
3
- export const hash = readable(
4
- location.hash.slice(1),
5
- (set) => {
6
- setInterval(
7
- () => set(location.hash.slice(1)),
8
- 50
9
- )
10
- }
11
- )
12
- hash.set = (value) => {
13
- location.hash = value
14
- }
1
+ import { readable } from "svelte/store"
2
+
3
+ export const hash = readable(
4
+ location.hash.slice(1),
5
+ (set) => {
6
+ setInterval(
7
+ () => set(location.hash.slice(1)),
8
+ 50
9
+ )
10
+ }
11
+ )
12
+ hash.set = (value) => {
13
+ location.hash = value
14
+ }