@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,31 +1,31 @@
1
- <svelte:options immutable />
2
-
3
- <script>
4
- import { createEventDispatcher } from "svelte"
5
-
6
- import Button from "../control/button.svelte"
7
- import Modal from "../layout/modal.svelte"
8
- import { handler$ } from "../handler$.mjs"
9
-
10
- export let component
11
- export let props
12
- let wrapper = Modal
13
- export { wrapper as this }
14
-
15
- const send = createEventDispatcher()
16
-
17
- let element = null
18
- const open = handler$(
19
- async (props) => {
20
- const elemProps = (typeof props === "function") ? props() : props
21
- const result = await element.show(elemProps)
22
- send("entry", result)
23
- }
24
- )
25
- </script>
26
-
27
- <Button {...$$restProps} on:click={open(props)}>
28
- <slot />
29
- </Button>
30
-
31
- <svelte:component this={wrapper} {component} bind:this={element} />
1
+ <svelte:options immutable />
2
+
3
+ <script>
4
+ import { createEventDispatcher } from "svelte"
5
+
6
+ import Button from "../control/button.svelte"
7
+ import Modal from "../layout/modal.svelte"
8
+ import { handler$ } from "../handler$.mjs"
9
+
10
+ export let component
11
+ export let props
12
+ let wrapper = Modal
13
+ export { wrapper as this }
14
+
15
+ const send = createEventDispatcher()
16
+
17
+ let element = null
18
+ const open = handler$(
19
+ async (props) => {
20
+ const elemProps = (typeof props === "function") ? props() : props
21
+ const result = await element.show(elemProps)
22
+ send("entry", result)
23
+ }
24
+ )
25
+ </script>
26
+
27
+ <Button {...$$restProps} on:click={open(props)}>
28
+ <slot />
29
+ </Button>
30
+
31
+ <svelte:component this={wrapper} {component} bind:this={element} />
@@ -1,13 +1,13 @@
1
- export const filters = {
2
- text: (propName) =>
3
- (row, text) =>
4
- row[propName]
5
- .toLowerCase()
6
- .includes(text.toLowerCase())
7
- }
8
- export const sorts = {
9
- natural: (propName) => {
10
- const comparitor = new Intl.Collator(undefined, { numeric: true })
11
- return (a, b) => comparitor.compare(a[propName], b[propName])
12
- }
13
- }
1
+ export const filters = {
2
+ text: (propName) =>
3
+ (row, text) =>
4
+ row[propName]
5
+ .toLowerCase()
6
+ .includes(text.toLowerCase())
7
+ }
8
+ export const sorts = {
9
+ natural: (propName) => {
10
+ const comparitor = new Intl.Collator(undefined, { numeric: true })
11
+ return (a, b) => comparitor.compare(a[propName], b[propName])
12
+ }
13
+ }
@@ -1,56 +1,56 @@
1
- <script>
2
- /*md
3
- [@] Components/ToastMessage
4
-
5
- # ToastMessage
6
-
7
- The default component for Toast to show messages with
8
-
9
- ## Props
10
-
11
- ### actionText
12
- `string`
13
-
14
- If given, the message will have a button that can be clicked and will
15
- use this text for the button text
16
-
17
- ### color
18
- `string`
19
-
20
- Sets `$color`
21
-
22
- ### icon
23
- `string`
24
-
25
- An icon to show with the message
26
-
27
- ### message
28
- `string`
29
-
30
- The message to show
31
- */
32
-
33
- import { createEventDispatcher } from "svelte"
34
-
35
- import Button from "../../control/button.svelte"
36
- import Icon from "../../info/icon.svelte"
37
- import Notification from "../../info/notification.svelte"
38
-
39
- export let message = ""
40
- export let icon = ""
41
- export let color = false
42
- export let actionText = null
43
-
44
- const dispatch = createEventDispatcher()
45
- const dismiss = () => dispatch("action", null)
46
- const respond = () => dispatch("action", true)
47
- </script>
48
-
49
- <Notification {color} on:click={dismiss}>
50
- <Icon name={icon}>{message}</Icon>
51
- {#if actionText}
52
- <Button {color} variant="fill" on:click={respond}>
53
- {actionText}
54
- </Button>
55
- {/if}
56
- </Notification>
1
+ <script>
2
+ /*md
3
+ [@] Components/ToastMessage
4
+
5
+ # ToastMessage
6
+
7
+ The default component for Toast to show messages with
8
+
9
+ ## Props
10
+
11
+ ### actionText
12
+ `string`
13
+
14
+ If given, the message will have a button that can be clicked and will
15
+ use this text for the button text
16
+
17
+ ### color
18
+ `string`
19
+
20
+ Sets `$color`
21
+
22
+ ### icon
23
+ `string`
24
+
25
+ An icon to show with the message
26
+
27
+ ### message
28
+ `string`
29
+
30
+ The message to show
31
+ */
32
+
33
+ import { createEventDispatcher } from "svelte"
34
+
35
+ import Button from "../../control/button.svelte"
36
+ import Icon from "../../info/icon.svelte"
37
+ import Notification from "../../info/notification.svelte"
38
+
39
+ export let message = ""
40
+ export let icon = ""
41
+ export let color = false
42
+ export let actionText = null
43
+
44
+ const dispatch = createEventDispatcher()
45
+ const dismiss = () => dispatch("action", null)
46
+ const respond = () => dispatch("action", true)
47
+ </script>
48
+
49
+ <Notification {color} on:click={dismiss}>
50
+ <Icon name={icon}>{message}</Icon>
51
+ {#if actionText}
52
+ <Button {color} variant="fill" on:click={respond}>
53
+ {actionText}
54
+ </Button>
55
+ {/if}
56
+ </Notification>
@@ -1,45 +1,45 @@
1
- # Toast
2
- Displays toast notifications along the edge of the screen. Unlike the Toaster
3
- component, this has functions for interacting with and generating toast
4
- messages, where the Toaster component has the programmer manage the content.
5
-
6
- ## Props
7
- See the Toaster component. The Toast component is wrapper around it that
8
- also controls the children being shown for convenience.
9
-
10
- ### component
11
- The component to use as a wrapper for the messages. Defaults to the
12
- ToastMessage component.
13
-
14
- ### position
15
- The position to show modals in. Uses the same positions as the Windstorm
16
- toaster.
17
-
18
- ## Functions
19
-
20
- ### show(duration, props)
21
- Shows a toast notification that will disappear after the specified
22
- duration (time in milliseconds). The props provided are passed to an
23
- instance of the component specified in the props.
24
-
25
- ## Events
26
-
27
- ### action
28
- Fired when a toast message is clicked. The info argument contains a
29
- value property that is provided by the message component, and a copy
30
- of the props passed to that instace.
31
-
32
- For the default messages, the value will be `null` if no button was
33
- clicked, and `true` if the action button was clicked. This allows
34
- actions to be taken against interactions in the message without having
35
- to bind all kinds of events or callbacks.
36
-
37
- ## Example
38
- ```svelte
39
- <script>
40
- let toast = null
41
- const notify = () => toast.show(5000, { message: "hi" })
42
- </script>
43
-
44
- <Toast bind:this={toast} position="bc" />
45
- ```
1
+ # Toast
2
+ Displays toast notifications along the edge of the screen. Unlike the Toaster
3
+ component, this has functions for interacting with and generating toast
4
+ messages, where the Toaster component has the programmer manage the content.
5
+
6
+ ## Props
7
+ See the Toaster component. The Toast component is wrapper around it that
8
+ also controls the children being shown for convenience.
9
+
10
+ ### component
11
+ The component to use as a wrapper for the messages. Defaults to the
12
+ ToastMessage component.
13
+
14
+ ### position
15
+ The position to show modals in. Uses the same positions as the Windstorm
16
+ toaster.
17
+
18
+ ## Functions
19
+
20
+ ### show(duration, props)
21
+ Shows a toast notification that will disappear after the specified
22
+ duration (time in milliseconds). The props provided are passed to an
23
+ instance of the component specified in the props.
24
+
25
+ ## Events
26
+
27
+ ### action
28
+ Fired when a toast message is clicked. The info argument contains a
29
+ value property that is provided by the message component, and a copy
30
+ of the props passed to that instace.
31
+
32
+ For the default messages, the value will be `null` if no button was
33
+ clicked, and `true` if the action button was clicked. This allows
34
+ actions to be taken against interactions in the message without having
35
+ to bind all kinds of events or callbacks.
36
+
37
+ ## Example
38
+ ```svelte
39
+ <script>
40
+ let toast = null
41
+ const notify = () => toast.show(5000, { message: "hi" })
42
+ </script>
43
+
44
+ <Toast bind:this={toast} position="bc" />
45
+ ```
@@ -1,70 +1,70 @@
1
- <svelte:options immutable />
2
-
3
- <script context="module">
4
- const genID = () => `${Date.now()}:${Math.random().toString(16)}`
5
-
6
- const delays = {}
7
- const delay = ({time, action, id}) => {
8
- const trigger = () => {
9
- const info = delays[id]
10
- clearTimeout(info.id)
11
- action()
12
- delete delays[id]
13
- }
14
- const timeoutID = setTimeout(trigger, time)
15
- delays[id] = { trigger, id: timeoutID }
16
- }
17
- delay.trigger = (id) => delays[id].trigger()
18
- </script>
19
-
20
- <script>
21
- import { createEventDispatcher } from "svelte"
22
- import { fade } from "svelte/transition"
23
-
24
- import { eventHandler$ } from "../handler$.mjs"
25
-
26
- import Toaster from "../info/toaster.svelte"
27
-
28
- import ToastMessage from "./toast/message.svelte"
29
-
30
- export let component = ToastMessage
31
- export let position = "tc"
32
-
33
- let items = []
34
-
35
- const dispatch = createEventDispatcher()
36
- const act = eventHandler$(
37
- (evt, id, props) => {
38
- delay.trigger(id)
39
- dispatch(
40
- "action",
41
- { value: evt.detail, props }
42
- )
43
- }
44
- )
45
-
46
- export const show = (duration, props) => {
47
- const id = genID()
48
- items = [...items, { id, props }]
49
- delay({
50
- action: () => items = items.filter(
51
- item => item.id !== id
52
- ),
53
- time: duration,
54
- id,
55
- })
56
- }
57
- export const clear = () => items = []
58
- </script>
59
-
60
- <Toaster {position} {...$$restProps}>
61
- {#each items as {props, id} (id)}
62
- <zephyr-toast-wrapper ws-x="[grid]" transition:fade={{duration: 200}}>
63
- <svelte:component
64
- this={component}
65
- {...props}
66
- on:action={act(id, props)}
67
- />
68
- </zephyr-toast-wrapper>
69
- {/each}
70
- </Toaster>
1
+ <svelte:options immutable />
2
+
3
+ <script context="module">
4
+ const genID = () => `${Date.now()}:${Math.random().toString(16)}`
5
+
6
+ const delays = {}
7
+ const delay = ({time, action, id}) => {
8
+ const trigger = () => {
9
+ const info = delays[id]
10
+ clearTimeout(info.id)
11
+ action()
12
+ delete delays[id]
13
+ }
14
+ const timeoutID = setTimeout(trigger, time)
15
+ delays[id] = { trigger, id: timeoutID }
16
+ }
17
+ delay.trigger = (id) => delays[id].trigger()
18
+ </script>
19
+
20
+ <script>
21
+ import { createEventDispatcher } from "svelte"
22
+ import { fade } from "svelte/transition"
23
+
24
+ import { eventHandler$ } from "../handler$.mjs"
25
+
26
+ import Toaster from "../info/toaster.svelte"
27
+
28
+ import ToastMessage from "./toast/message.svelte"
29
+
30
+ export let component = ToastMessage
31
+ export let position = "tc"
32
+
33
+ let items = []
34
+
35
+ const dispatch = createEventDispatcher()
36
+ const act = eventHandler$(
37
+ (evt, id, props) => {
38
+ delay.trigger(id)
39
+ dispatch(
40
+ "action",
41
+ { value: evt.detail, props }
42
+ )
43
+ }
44
+ )
45
+
46
+ export const show = (duration, props) => {
47
+ const id = genID()
48
+ items = [...items, { id, props }]
49
+ delay({
50
+ action: () => items = items.filter(
51
+ item => item.id !== id
52
+ ),
53
+ time: duration,
54
+ id,
55
+ })
56
+ }
57
+ export const clear = () => items = []
58
+ </script>
59
+
60
+ <Toaster {position} {...$$restProps}>
61
+ {#each items as {props, id} (id)}
62
+ <zephyr-toast-wrapper ws-x="[grid]" transition:fade={{duration: 200}}>
63
+ <svelte:component
64
+ this={component}
65
+ {...props}
66
+ on:action={act(id, props)}
67
+ />
68
+ </zephyr-toast-wrapper>
69
+ {/each}
70
+ </Toaster>
@@ -1,41 +1,41 @@
1
- # Button
2
-
3
- Basic clickable component for handling user interaction.
4
-
5
- ## Props
6
-
7
- ### color
8
- `string`
9
-
10
- Sets `$color`
11
-
12
- ### compact
13
- `bool`
14
-
15
- Sets `$compact`
16
-
17
- ### fill / outline
18
- `bool`
19
-
20
- Sets the button type to `$fill` if fill is true, `$outline` if outline
21
- is true, or `$flat` if neither is true.
22
-
23
- ## Events
24
- - click
25
-
26
- ## Example
27
- ```svelte
28
- <script>
29
- import { Button } from "@axel669/zephyr"
30
- </script>
31
-
32
- <Button on:click={action}>
33
- Flat Button
34
- </Button>
35
- <Button on:click={action} outline>
36
- Outlined Button
37
- </Button>
38
- <Button on:click={action} fill color="danger">
39
- Filled Button
40
- </Button>
41
- ```
1
+ # Button
2
+
3
+ Basic clickable component for handling user interaction.
4
+
5
+ ## Props
6
+
7
+ ### color
8
+ `string`
9
+
10
+ Sets `$color`
11
+
12
+ ### compact
13
+ `bool`
14
+
15
+ Sets `$compact`
16
+
17
+ ### fill / outline
18
+ `bool`
19
+
20
+ Sets the button type to `$fill` if fill is true, `$outline` if outline
21
+ is true, or `$flat` if neither is true.
22
+
23
+ ## Events
24
+ - click
25
+
26
+ ## Example
27
+ ```svelte
28
+ <script>
29
+ import { Button } from "@axel669/zephyr"
30
+ </script>
31
+
32
+ <Button on:click={action}>
33
+ Flat Button
34
+ </Button>
35
+ <Button on:click={action} outline>
36
+ Outlined Button
37
+ </Button>
38
+ <Button on:click={action} fill color="danger">
39
+ Filled Button
40
+ </Button>
41
+ ```
@@ -1,27 +1,27 @@
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
- $: type = variant({ fill, outline, flat })
16
-
17
- $: wind = {
18
- [type]: true,
19
- "$color": color,
20
- $compact: compact,
21
- ...$$restProps
22
- }
23
- </script>
24
-
25
- <button use:wsx={wind} {disabled} on:click|stopPropagation>
26
- <slot />
27
- </button>
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
+ $: type = variant({ fill, outline, flat })
16
+
17
+ $: wind = {
18
+ [type]: true,
19
+ "$color": color,
20
+ $compact: compact,
21
+ ...$$restProps
22
+ }
23
+ </script>
24
+
25
+ <button use:wsx={wind} {disabled} on:click|stopPropagation>
26
+ <slot />
27
+ </button>