@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
package/src/functions.md CHANGED
@@ -1,83 +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
- ```
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 ADDED
@@ -0,0 +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
+ }
package/src/index.mjs CHANGED
@@ -1,52 +1,53 @@
1
- export { default as Button } from "./control/button.svelte"
2
- export { default as Input } from "./control/input.svelte"
3
- export { default as Link } from "./control/link.svelte"
4
- export { default as Radio } from "./control/radio.svelte"
5
- export { default as Select } from "./control/select.svelte"
6
- export { default as Tabs } from "./control/tabs.svelte"
7
- export { default as Toggle } from "./control/toggle.svelte"
8
-
9
- export { default as Avatar } from "./data-display/avatar.svelte"
10
- export { default as TheLastAirbender } from "./data-display/avatar.svelte"
11
- export { default as Badge } from "./data-display/badge.svelte"
12
- export { default as Chip } from "./data-display/chip.svelte"
13
- export { default as Details } from "./data-display/details.svelte"
14
- export { default as Popover } from "./data-display/popover.svelte"
15
- export { default as Progress } from "./data-display/progress.svelte"
16
- export { default as Table } from "./data-display/table.svelte"
17
- export { default as Tooltip } from "./data-display/tooltip.svelte"
18
-
19
- export { default as Icon } from "./info/icon.svelte"
20
- export { default as Notification } from "./info/notification.svelte"
21
- export { default as Titlebar } from "./info/titlebar.svelte"
22
- export { default as Toaster } from "./info/toaster.svelte"
23
-
24
- export { default as Dialog } from "./layout/dialog.svelte"
25
- export { default as Drawer } from "./layout/drawer.svelte"
26
- export { default as Flex } from "./layout/flex.svelte"
27
- export { default as Grid } from "./layout/grid.svelte"
28
- export { default as Modal } from "./layout/modal.svelte"
29
- export { default as Paper } from "./layout/paper.svelte"
30
- export { default as Screen } from "./layout/screen.svelte"
31
-
32
- export { default as Text } from "./text.svelte"
33
-
34
- export { default as CircleSpinner } from "./spinner/circle-spinner.svelte"
35
- export { default as HexagonSpinner } from "./spinner/hexagon-spinner.svelte"
36
-
37
- export { default as Alert } from "./dialogs/alert.svelte"
38
- export { default as Confirm } from "./dialogs/confirm.svelte"
39
-
40
- export { default as DataTable } from "./composed/data-table.svelte"
41
- export { default as Th } from "./composed/data-table/th.svelte"
42
- export { default as EntryButton } from "./composed/entry-button.svelte"
43
- export { default as Toast } from "./composed/toast.svelte"
44
-
45
- export { default as AsyncButton } from "./async/button.svelte"
46
- export { default as LoadZone } from "./async/load-zone.svelte"
47
-
48
- export { default as wsx } from "./wsx.mjs"
49
-
50
-
51
- export * from "./handler$.mjs"
52
- export * from "./composed/table-functions.js"
1
+ export { default as Button } from "./control/button.svelte"
2
+ export { default as Input } from "./control/input.svelte"
3
+ export { default as Link } from "./control/link.svelte"
4
+ export { default as Radio } from "./control/radio.svelte"
5
+ export { default as Select } from "./control/select.svelte"
6
+ export { default as Tabs } from "./control/tabs.svelte"
7
+ export { default as Toggle } from "./control/toggle.svelte"
8
+
9
+ export { default as Avatar } from "./data-display/avatar.svelte"
10
+ export { default as TheLastAirbender } from "./data-display/avatar.svelte"
11
+ export { default as Badge } from "./data-display/badge.svelte"
12
+ export { default as Chip } from "./data-display/chip.svelte"
13
+ export { default as Details } from "./data-display/details.svelte"
14
+ export { default as Popover } from "./data-display/popover.svelte"
15
+ export { default as Progress } from "./data-display/progress.svelte"
16
+ export { default as Table } from "./data-display/table.svelte"
17
+ export { default as Tooltip } from "./data-display/tooltip.svelte"
18
+
19
+ export { default as Icon } from "./info/icon.svelte"
20
+ export { default as Notification } from "./info/notification.svelte"
21
+ export { default as Titlebar } from "./info/titlebar.svelte"
22
+ export { default as Toaster } from "./info/toaster.svelte"
23
+
24
+ export { default as Dialog } from "./layout/dialog.svelte"
25
+ export { default as Drawer } from "./layout/drawer.svelte"
26
+ export { default as Flex } from "./layout/flex.svelte"
27
+ export { default as Grid } from "./layout/grid.svelte"
28
+ export { default as Modal } from "./layout/modal.svelte"
29
+ export { default as Paper } from "./layout/paper.svelte"
30
+ export { default as Screen } from "./layout/screen.svelte"
31
+
32
+ export { default as Text } from "./text.svelte"
33
+
34
+ export { default as CircleSpinner } from "./spinner/circle-spinner.svelte"
35
+ export { default as HexagonSpinner } from "./spinner/hexagon-spinner.svelte"
36
+
37
+ export { default as Alert } from "./dialogs/alert.svelte"
38
+ export { default as Confirm } from "./dialogs/confirm.svelte"
39
+
40
+ export { default as DataTable } from "./composed/data-table.svelte"
41
+ export { default as TH } from "./composed/data-table/th.svelte"
42
+ export { default as EntryButton } from "./composed/entry-button.svelte"
43
+ export { default as Toast } from "./composed/toast.svelte"
44
+
45
+ export { default as AsyncButton } from "./async/button.svelte"
46
+ export { default as LoadZone } from "./async/load-zone.svelte"
47
+
48
+ export { default as wsx } from "./wsx.mjs"
49
+
50
+ export { hash } from "./hash.js"
51
+
52
+ export * from "./handler$.mjs"
53
+ export * from "./composed/table-functions.js"
package/src/info/icon.md CHANGED
@@ -1,21 +1,21 @@
1
- # Icon
2
-
3
- Displays a [Tabler Icon](https://tabler-icons.io/) and some optional text.
4
- The icon will appear at the beginning of the text.
5
-
6
- ## Props
7
-
8
- ### name
9
- `string`
10
-
11
- The name of the icon. Use the tabler icon class name without the "ti-".
12
-
13
- ## Example
14
- ```svelte
15
- <script>
16
- import { Icon } from "@axel669/zephyr"
17
- </script>
18
-
19
- <Icon name="hexagon" />
20
- <Icon name="hexagons">Are the bestagons</Icon>
21
- ```
1
+ # Icon
2
+
3
+ Displays a [Tabler Icon](https://tabler-icons.io/) and some optional text.
4
+ The icon will appear at the beginning of the text.
5
+
6
+ ## Props
7
+
8
+ ### name
9
+ `string`
10
+
11
+ The name of the icon. Use the tabler icon class name without the "ti-".
12
+
13
+ ## Example
14
+ ```svelte
15
+ <script>
16
+ import { Icon } from "@axel669/zephyr"
17
+ </script>
18
+
19
+ <Icon name="hexagon" />
20
+ <Icon name="hexagons">Are the bestagons</Icon>
21
+ ```
@@ -1,9 +1,9 @@
1
- <script>
2
- import wsx from "../wsx.mjs"
3
-
4
- export let name
5
- </script>
6
-
7
- <ws-icon class="ti-{name}" use:wsx={$$restProps}>
8
- <slot />
9
- </ws-icon>
1
+ <script>
2
+ import wsx from "../wsx.mjs"
3
+
4
+ export let name
5
+ </script>
6
+
7
+ <ws-icon class="ti-{name}" use:wsx={$$restProps}>
8
+ <slot />
9
+ </ws-icon>
@@ -1,36 +1,36 @@
1
- # Notification
2
-
3
- Displays a piece of content that stands out from the surrounding content and
4
- can also be used for toast messages. Optionally has some interactable
5
- elements embedded.
6
-
7
- Expects 1-2 child nodes and will display them on the sides of the
8
- notification with space between them. This means that reversing the order
9
- of the child nodes will flip which sides they appear on.
10
-
11
- ## Props
12
-
13
- ### color
14
- Sets `$color` and uses the fill style for coloration.
15
-
16
- ## Example
17
- ```svelte
18
- <script>
19
- import { Notification, Button, Icon } from "@axel669/zephyr"
20
- </script>
21
-
22
- <Notification>
23
- <Icon name="info-hexagon">
24
- Some kind of information
25
- </Icon>
26
- </Notification>
27
- <Notification color="danger">
28
- <Icon name="alert-hexagon">
29
- Something broke
30
- </Icon>
31
-
32
- <Button>
33
- Cancel
34
- </Button>
35
- </Notification>
36
- ```
1
+ # Notification
2
+
3
+ Displays a piece of content that stands out from the surrounding content and
4
+ can also be used for toast messages. Optionally has some interactable
5
+ elements embedded.
6
+
7
+ Expects 1-2 child nodes and will display them on the sides of the
8
+ notification with space between them. This means that reversing the order
9
+ of the child nodes will flip which sides they appear on.
10
+
11
+ ## Props
12
+
13
+ ### color
14
+ Sets `$color` and uses the fill style for coloration.
15
+
16
+ ## Example
17
+ ```svelte
18
+ <script>
19
+ import { Notification, Button, Icon } from "@axel669/zephyr"
20
+ </script>
21
+
22
+ <Notification>
23
+ <Icon name="info-hexagon">
24
+ Some kind of information
25
+ </Icon>
26
+ </Notification>
27
+ <Notification color="danger">
28
+ <Icon name="alert-hexagon">
29
+ Something broke
30
+ </Icon>
31
+
32
+ <Button>
33
+ Cancel
34
+ </Button>
35
+ </Notification>
36
+ ```
@@ -1,16 +1,16 @@
1
- <script>
2
- import wsx from "../wsx.mjs"
3
-
4
- export let color = false
5
-
6
- $: wind = {
7
- "$color": color,
8
- ...$$restProps,
9
- }
10
- </script>
11
-
12
- <!-- svelte-ignore a11y-click-events-have-key-events -->
13
- <!-- svelte-ignore a11y-interactive-supports-focus -->
14
- <ws-notification use:wsx={wind} on:click role="button">
15
- <slot />
16
- </ws-notification>
1
+ <script>
2
+ import wsx from "../wsx.mjs"
3
+
4
+ export let color = false
5
+
6
+ $: wind = {
7
+ "$color": color,
8
+ ...$$restProps,
9
+ }
10
+ </script>
11
+
12
+ <!-- svelte-ignore a11y-click-events-have-key-events -->
13
+ <!-- svelte-ignore a11y-interactive-supports-focus -->
14
+ <ws-notification use:wsx={wind} on:click role="button">
15
+ <slot />
16
+ </ws-notification>