@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,49 +1,49 @@
1
- <svelte:options immutable />
2
-
3
- <script context="module">
4
- const defs = {
5
- select: {
6
- "$select": true,
7
- "w.min": "35vw",
8
- grid: true,
9
- over: "hidden"
10
- },
11
- menu: {
12
- "$menu": true,
13
- },
14
- action: {
15
- "$action": true,
16
- }
17
- }
18
- </script>
19
-
20
- <script>
21
- import wsx from "../wsx.mjs"
22
-
23
- import Paper from "./paper.svelte"
24
-
25
- export let height
26
- export let type = "menu"
27
-
28
- const trick = (node, options) => ({
29
- delay: 0,
30
- duration: 250,
31
- css: () => "",
32
- })
33
-
34
- $: container = {
35
- ...defs[type],
36
- h: (type === "select") ? height : "100%",
37
- grid: true,
38
- }
39
- </script>
40
- <!-- svelte-ignore a11y-click-events-have-key-events -->
41
- <!-- svelte-ignore a11y-interactive-supports-focus -->
42
- <wind-drawer-container use:wsx={container} on:click|stopPropagation
43
- role="menubar" transition:trick>
44
- <Paper {...$$restProps}>
45
- <slot name="header" slot="header" />
46
- <slot />
47
- <slot name="footer" slot="footer" />
48
- </Paper>
49
- </wind-drawer-container>
1
+ <svelte:options immutable />
2
+
3
+ <script context="module">
4
+ const defs = {
5
+ select: {
6
+ "@select": true,
7
+ "w.min": "35vw",
8
+ grid: true,
9
+ over: "hidden"
10
+ },
11
+ menu: {
12
+ "@menu": true,
13
+ },
14
+ action: {
15
+ "@action": true,
16
+ }
17
+ }
18
+ </script>
19
+
20
+ <script>
21
+ import wsx from "../wsx.mjs"
22
+
23
+ import Paper from "./paper.svelte"
24
+
25
+ export let height
26
+ export let type = "menu"
27
+
28
+ const trick = (node, options) => ({
29
+ delay: 0,
30
+ duration: 250,
31
+ css: () => "",
32
+ })
33
+
34
+ $: container = {
35
+ ...defs[type],
36
+ h: (type === "select") ? height : "100%",
37
+ grid: true,
38
+ }
39
+ </script>
40
+ <!-- svelte-ignore a11y-click-events-have-key-events -->
41
+ <!-- svelte-ignore a11y-interactive-supports-focus -->
42
+ <wind-drawer-container use:wsx={container} on:click|stopPropagation
43
+ role="menubar" transition:trick>
44
+ <Paper {...$$restProps}>
45
+ <slot name="header" slot="header" />
46
+ <slot />
47
+ <slot name="footer" slot="footer" />
48
+ </Paper>
49
+ </wind-drawer-container>
@@ -1,43 +1,43 @@
1
- # Flex
2
-
3
- Container that uses flex layout by default with some nice default values.
4
-
5
- ## Props
6
-
7
- ### direction
8
- `string`
9
-
10
- Sets `fl.dir`
11
-
12
- ### pad
13
- `string`
14
-
15
- Sets `p`
16
-
17
- ### gap
18
- `string`
19
-
20
- Sets `gap`
21
-
22
- ### cross
23
- `string`
24
-
25
- Sets `fl.cross`, default is `"stretch"`
26
-
27
- ### main
28
- `string`
29
-
30
- Sets `fl.main`, default is `"start"`
31
-
32
- ## Example
33
- ```svelte
34
- <script>
35
- import { Flex, Text } from "@axel669/zephyr"
36
- </script>
37
-
38
- <Flex cross="stretch">
39
- <Text>Content</Text>
40
- <Text>More content</Text>
41
- <Text>Event more content</Text>
42
- <Flex>
43
- ```
1
+ # Flex
2
+
3
+ Container that uses flex layout by default with some nice default values.
4
+
5
+ ## Props
6
+
7
+ ### direction
8
+ `string`
9
+
10
+ Sets `fl.dir`
11
+
12
+ ### pad
13
+ `string`
14
+
15
+ Sets `p`
16
+
17
+ ### gap
18
+ `string`
19
+
20
+ Sets `gap`
21
+
22
+ ### cross
23
+ `string`
24
+
25
+ Sets `fl.cross`, default is `"stretch"`
26
+
27
+ ### main
28
+ `string`
29
+
30
+ Sets `fl.main`, default is `"start"`
31
+
32
+ ## Example
33
+ ```svelte
34
+ <script>
35
+ import { Flex, Text } from "@axel669/zephyr"
36
+ </script>
37
+
38
+ <Flex cross="stretch">
39
+ <Text>Content</Text>
40
+ <Text>More content</Text>
41
+ <Text>Event more content</Text>
42
+ <Flex>
43
+ ```
@@ -1,24 +1,26 @@
1
- <svelte:options immutable />
2
-
3
- <script>
4
- import wsx from "../wsx.mjs"
5
-
6
- export let direction = false
7
- export let pad = false
8
- export let gap = false
9
- export let cross = "stretch"
10
- export let main = "start"
11
-
12
- $: wind = {
13
- "fl.dir": direction,
14
- "fl.cross": cross,
15
- "fl.main": main,
16
- p: pad,
17
- gap: gap,
18
- ...$$restProps
19
- }
20
- </script>
21
-
22
- <ws-flex use:wsx={wind}>
23
- <slot />
24
- </ws-flex>
1
+ <svelte:options immutable />
2
+
3
+ <script>
4
+ import wsx from "../wsx.mjs"
5
+
6
+ export let direction = false
7
+ export let pad = false
8
+ export let gap = false
9
+ export let cross = "stretch"
10
+ export let main = "start"
11
+ export let scrollable = false
12
+
13
+ $: wind = {
14
+ "fl.dir": direction,
15
+ "fl.cross": cross,
16
+ "fl.main": main,
17
+ p: pad,
18
+ gap: gap,
19
+ over: (scrollable === true) ? "auto" : null,
20
+ ...$$restProps
21
+ }
22
+ </script>
23
+
24
+ <ws-flex use:wsx={wind}>
25
+ <slot />
26
+ </ws-flex>
@@ -1,61 +1,61 @@
1
- # Grid
2
-
3
- Container that uses grid layout by default with some nice default values.
4
-
5
- ## Base
6
- [Windstorm Grid](https://axel669.github.io/lib.windstorm/#components-grid)
7
-
8
- ## Props
9
- All [windstorm functions](https://axel669.github.io/lib.windstorm/#css-shorthands)
10
- are supported.
11
-
12
-
13
- ### direction
14
- `string`
15
-
16
- Sets `gr.flow`
17
-
18
- ### pad
19
- `string`
20
-
21
- Sets `p`
22
-
23
- ### gap
24
- `string`
25
-
26
- Sets `gap`
27
-
28
- ### cols
29
- `string|Array`
30
-
31
- Sets `gr.cols`. Accepts either an array of values that are joined by " "
32
- or a regular string value.
33
-
34
- ### rows
35
- `string|Array`
36
-
37
- Sets `gr.rows`. Accepts either an array of values that are joined by " "
38
- or a regular string value.
39
-
40
- ### autoCol
41
- `string`
42
-
43
- Sets `gr.cols.a`
44
-
45
- ### autoRow
46
- `string`
47
-
48
- Sets `gr.rows.a`
49
-
50
- ## Example
51
- ```svelte
52
- <script>
53
- import { Grid, Text } from "@axel669/zephyr"
54
- </script>
55
-
56
- <Grid cols="1fr 1fr">
57
- <Text>Content</Text>
58
- <Text>More content</Text>
59
- <Text>Event more content</Text>
60
- <Grid>
61
- ```
1
+ # Grid
2
+
3
+ Container that uses grid layout by default with some nice default values.
4
+
5
+ ## Base
6
+ [Windstorm Grid](https://axel669.github.io/lib.windstorm/#components-grid)
7
+
8
+ ## Props
9
+ All [windstorm functions](https://axel669.github.io/lib.windstorm/#css-shorthands)
10
+ are supported.
11
+
12
+
13
+ ### direction
14
+ `string`
15
+
16
+ Sets `gr.flow`
17
+
18
+ ### pad
19
+ `string`
20
+
21
+ Sets `p`
22
+
23
+ ### gap
24
+ `string`
25
+
26
+ Sets `gap`
27
+
28
+ ### cols
29
+ `string|Array`
30
+
31
+ Sets `gr.cols`. Accepts either an array of values that are joined by " "
32
+ or a regular string value.
33
+
34
+ ### rows
35
+ `string|Array`
36
+
37
+ Sets `gr.rows`. Accepts either an array of values that are joined by " "
38
+ or a regular string value.
39
+
40
+ ### autoCol
41
+ `string`
42
+
43
+ Sets `gr.cols.a`
44
+
45
+ ### autoRow
46
+ `string`
47
+
48
+ Sets `gr.rows.a`
49
+
50
+ ## Example
51
+ ```svelte
52
+ <script>
53
+ import { Grid, Text } from "@axel669/zephyr"
54
+ </script>
55
+
56
+ <Grid cols="1fr 1fr">
57
+ <Text>Content</Text>
58
+ <Text>More content</Text>
59
+ <Text>Event more content</Text>
60
+ <Grid>
61
+ ```
@@ -1,28 +1,30 @@
1
- <svelte:options immutable />
2
-
3
- <script>
4
- import wsx from "../wsx.mjs"
5
-
6
- export let direction = false
7
- export let pad = false
8
- export let gap = false
9
- export let cols = null
10
- export let rows = null
11
- export let autoCol = false
12
- export let autoRow = false
13
-
14
- $: wind = {
15
- "gr.flow": direction,
16
- "gr.cols": cols?.join?.(" ") ?? cols ?? false,
17
- "gr.rows": rows?.join?.(" ") ?? rows ?? false,
18
- "gr.cols.a": autoCol,
19
- "gr.rows.a": autoRow,
20
- p: pad,
21
- gap: gap,
22
- ...$$restProps
23
- }
24
- </script>
25
-
26
- <ws-grid use:wsx={wind}>
27
- <slot />
28
- </ws-grid>
1
+ <svelte:options immutable />
2
+
3
+ <script>
4
+ import wsx from "../wsx.mjs"
5
+
6
+ export let direction = false
7
+ export let pad = false
8
+ export let gap = false
9
+ export let cols = null
10
+ export let rows = null
11
+ export let autoCol = false
12
+ export let autoRow = false
13
+ export let scrollable = false
14
+
15
+ $: wind = {
16
+ "gr.flow": direction,
17
+ "gr.cols": cols?.join?.(" ") ?? cols ?? false,
18
+ "gr.rows": rows?.join?.(" ") ?? rows ?? false,
19
+ "gr.cols.a": autoCol,
20
+ "gr.rows.a": autoRow,
21
+ p: pad,
22
+ gap: gap,
23
+ over: (scrollable === true) ? "auto" : null,
24
+ ...$$restProps
25
+ }
26
+ </script>
27
+
28
+ <ws-grid use:wsx={wind}>
29
+ <slot />
30
+ </ws-grid>
@@ -1,50 +1,50 @@
1
- # Modal
2
-
3
- The Modal component is used to control when content should be shown that
4
- sits over the current content and prevents interaction with the content it
5
- covers. It is primarily used to show drawers, dialogs, and sub screens.
6
-
7
- The `show` function will display the component specified inside a ws-modal
8
- element, and can be awaited for an optional return value. The component
9
- displayed will be passed any props supplied to `show` and a `close` function
10
- that can be called to hide the component again. `close` can also be given
11
- an argument that will be used as the promise value from `show`.
12
-
13
- If a component that a modal displays exports a `cancel` function, then
14
- clicking the modal area outside the displayed component will call that
15
- `cancel` function, allowing any modal component to decide when/if it is
16
- closes in response to that event.
17
-
18
- ## Props
19
- Because the Modal does not render content of its own, it does not support
20
- any wind functions.
21
-
22
-
23
- ### component
24
- `Component`
25
-
26
- The component to display when `show` is called
27
-
28
- ## Functions
29
-
30
- ### `show(props?) -> Promise`
31
- Shows the given component and passes any props provided.
32
-
33
- ## Example
34
- ```svelte
35
- <script>
36
- import { Modal, Button } from "@axel669/zephyr"
37
- import CoolDialog from "./cool-dialog.svelte"
38
-
39
- let dialog = null
40
- const dialogThing = async () => {
41
- const value = await dialog.show({ a: 10, b: 12 })
42
- console.log(value)
43
- }
44
- </script>
45
-
46
- <Modal component={CoolDialog} bind:this={dialog} />
47
- <Button on:click={dialogThing}>
48
- Open Dialog
49
- </Button>
50
- ```
1
+ # Modal
2
+
3
+ The Modal component is used to control when content should be shown that
4
+ sits over the current content and prevents interaction with the content it
5
+ covers. It is primarily used to show drawers, dialogs, and sub screens.
6
+
7
+ The `show` function will display the component specified inside a ws-modal
8
+ element, and can be awaited for an optional return value. The component
9
+ displayed will be passed any props supplied to `show` and a `close` function
10
+ that can be called to hide the component again. `close` can also be given
11
+ an argument that will be used as the promise value from `show`.
12
+
13
+ If a component that a modal displays exports a `cancel` function, then
14
+ clicking the modal area outside the displayed component will call that
15
+ `cancel` function, allowing any modal component to decide when/if it is
16
+ closes in response to that event.
17
+
18
+ ## Props
19
+ Because the Modal does not render content of its own, it does not support
20
+ any wind functions.
21
+
22
+
23
+ ### component
24
+ `Component`
25
+
26
+ The component to display when `show` is called
27
+
28
+ ## Functions
29
+
30
+ ### `show(props?) -> Promise`
31
+ Shows the given component and passes any props provided.
32
+
33
+ ## Example
34
+ ```svelte
35
+ <script>
36
+ import { Modal, Button } from "@axel669/zephyr"
37
+ import CoolDialog from "./cool-dialog.svelte"
38
+
39
+ let dialog = null
40
+ const dialogThing = async () => {
41
+ const value = await dialog.show({ a: 10, b: 12 })
42
+ console.log(value)
43
+ }
44
+ </script>
45
+
46
+ <Modal component={CoolDialog} bind:this={dialog} />
47
+ <Button on:click={dialogThing}>
48
+ Open Dialog
49
+ </Button>
50
+ ```
@@ -1,60 +1,60 @@
1
- <svelte:options immutable />
2
-
3
- <script context="module">
4
- let topClose = null
5
- </script>
6
-
7
- <script>
8
- import { tick } from "svelte"
9
-
10
- export let component
11
-
12
- let modalProps = null
13
- let resolver = null
14
- let displayed = null
15
-
16
- const close = (value) => {
17
- resolver(value)
18
- resolver = null
19
- modalProps = null
20
- visible.checked = false
21
- if (topClose !== close) {
22
- return
23
- }
24
- topClose = null
25
- }
26
- const closeToTop = (value) => {
27
- topClose(value)
28
- }
29
- const cancel = () => displayed.cancel?.()
30
-
31
- export const show = (props) => new Promise(
32
- async (resolve) => {
33
- modalProps = props ?? {}
34
- resolver = resolve
35
- topClose = topClose ?? close
36
- await tick()
37
- setTimeout(
38
- () => visible.checked = true,
39
- 0
40
- )
41
- }
42
- )
43
-
44
- let visible = null
45
- </script>
46
-
47
- <input type="checkbox" bind:this={visible} ws-x="disp[none]" />
48
- {#if resolver !== null}
49
- <!-- svelte-ignore a11y-click-events-have-key-events -->
50
- <!-- svelte-ignore a11y-no-noninteractive-element-interactions -->
51
- <ws-modal on:click={cancel} role="dialog">
52
- <svelte:component
53
- bind:this={displayed}
54
- this={component}
55
- {...modalProps}
56
- {close}
57
- {closeToTop}
58
- />
59
- </ws-modal>
60
- {/if}
1
+ <svelte:options immutable />
2
+
3
+ <script context="module">
4
+ let topClose = null
5
+ </script>
6
+
7
+ <script>
8
+ import { tick } from "svelte"
9
+
10
+ export let component
11
+
12
+ let modalProps = null
13
+ let resolver = null
14
+ let displayed = null
15
+
16
+ const close = (value) => {
17
+ resolver(value)
18
+ resolver = null
19
+ modalProps = null
20
+ visible.checked = false
21
+ if (topClose !== close) {
22
+ return
23
+ }
24
+ topClose = null
25
+ }
26
+ const closeToTop = (value) => {
27
+ topClose(value)
28
+ }
29
+ const cancel = () => displayed.cancel?.()
30
+
31
+ export const show = (props) => new Promise(
32
+ async (resolve) => {
33
+ modalProps = props ?? {}
34
+ resolver = resolve
35
+ topClose = topClose ?? close
36
+ await tick()
37
+ setTimeout(
38
+ () => visible.checked = true,
39
+ 0
40
+ )
41
+ }
42
+ )
43
+
44
+ let visible = null
45
+ </script>
46
+
47
+ <input type="checkbox" bind:this={visible} ws-x="[disp none]" />
48
+ {#if resolver !== null}
49
+ <!-- svelte-ignore a11y-click-events-have-key-events -->
50
+ <!-- svelte-ignore a11y-no-noninteractive-element-interactions -->
51
+ <ws-modal on:click={cancel} role="dialog">
52
+ <svelte:component
53
+ bind:this={displayed}
54
+ this={component}
55
+ {...modalProps}
56
+ {close}
57
+ {closeToTop}
58
+ />
59
+ </ws-modal>
60
+ {/if}