@axel669/zephyr 0.3.8 → 0.4.4-beta.0

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 (77) hide show
  1. package/package.json +40 -33
  2. package/src/async/button.svelte +16 -8
  3. package/src/composed/data-table/th.svelte +2 -2
  4. package/src/composed/data-table.svelte +4 -3
  5. package/src/composed/form.svelte +60 -0
  6. package/src/composed/table-functions.js +3 -1
  7. package/src/composed/toast/message.svelte +15 -38
  8. package/src/control/button.svelte +1 -1
  9. package/src/control/input.svelte +89 -109
  10. package/src/control/label.svelte +1 -1
  11. package/src/control/link.svelte +32 -32
  12. package/src/control/radio-group.svelte +21 -0
  13. package/src/control/select.svelte +5 -5
  14. package/src/control/tabs.svelte +9 -21
  15. package/src/control/toggle.svelte +2 -2
  16. package/src/data-display/avatar.svelte +4 -1
  17. package/src/data-display/badge.svelte +1 -1
  18. package/src/data-display/chip.svelte +1 -1
  19. package/src/data-display/popover.svelte +25 -25
  20. package/src/data-display/progress.svelte +27 -27
  21. package/src/data-display/table.svelte +1 -1
  22. package/src/dialogs/confirm.svelte +3 -3
  23. package/src/hash.js +14 -14
  24. package/src/index.mjs +11 -1
  25. package/src/info/notification.svelte +28 -16
  26. package/src/info/titlebar.svelte +22 -5
  27. package/src/layout/dialog.svelte +1 -1
  28. package/src/layout/drawer.svelte +49 -49
  29. package/src/layout/flex.svelte +0 -4
  30. package/src/layout/grid.svelte +4 -4
  31. package/src/layout/paper.svelte +56 -47
  32. package/src/routing/route.svelte +48 -0
  33. package/src/routing/routing.js +62 -0
  34. package/src/routing/title.svelte +26 -0
  35. package/src/spinner/circle-spinner.svelte +2 -1
  36. package/src/spinner/hexagon-spinner.svelte +2 -1
  37. package/src/text.svelte +2 -4
  38. package/src/wsx.mjs +25 -24
  39. package/src/async/button.md +0 -27
  40. package/src/async/load-zone.md +0 -42
  41. package/src/composed/data-table/th.md +0 -21
  42. package/src/composed/data-table.md +0 -86
  43. package/src/composed/entry-button.md +0 -44
  44. package/src/composed/toast.md +0 -45
  45. package/src/control/button.md +0 -41
  46. package/src/control/input.md +0 -87
  47. package/src/control/label.md +0 -48
  48. package/src/control/link.md +0 -50
  49. package/src/control/radio.md +0 -58
  50. package/src/control/radio.svelte +0 -28
  51. package/src/control/select.md +0 -70
  52. package/src/control/tabs.md +0 -47
  53. package/src/control/toggle.md +0 -61
  54. package/src/data-display/avatar.md +0 -36
  55. package/src/data-display/badge.md +0 -30
  56. package/src/data-display/chip.md +0 -36
  57. package/src/data-display/details.md +0 -42
  58. package/src/data-display/popover.md +0 -32
  59. package/src/data-display/progress.md +0 -46
  60. package/src/data-display/table.md +0 -59
  61. package/src/data-display/tooltip.md +0 -29
  62. package/src/dialogs/alert.md +0 -42
  63. package/src/dialogs/confirm.md +0 -56
  64. package/src/functions.md +0 -108
  65. package/src/info/icon.md +0 -21
  66. package/src/info/notification.md +0 -36
  67. package/src/info/titlebar.md +0 -75
  68. package/src/info/toaster.md +0 -26
  69. package/src/layout/dialog.md +0 -43
  70. package/src/layout/drawer.md +0 -70
  71. package/src/layout/flex.md +0 -43
  72. package/src/layout/grid.md +0 -61
  73. package/src/layout/modal.md +0 -50
  74. package/src/layout/paper.md +0 -94
  75. package/src/layout/screen.md +0 -33
  76. package/src/spinner/spinners.md +0 -22
  77. package/src/text.md +0 -34
@@ -1,56 +0,0 @@
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
- ```
package/src/functions.md DELETED
@@ -1,108 +0,0 @@
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/info/icon.md DELETED
@@ -1,21 +0,0 @@
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,36 +0,0 @@
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,75 +0,0 @@
1
- # Titlebar
2
-
3
- The titlebar is used to set section titles with some style, and provides
4
- slots for buttons on either side of the title text. Works well as a header
5
- for Paper components.
6
-
7
- ## Props
8
-
9
- ### color
10
- `string`
11
-
12
- Sets `$color`
13
-
14
- ### fill
15
- `bool`
16
-
17
- Sets `$fill`
18
-
19
- ## Slots
20
-
21
- ### title
22
- The center of the titlebar, where the text usually goes. Elements can be nested
23
- in different ways within a parent element for different visual effects in this
24
- slot.
25
-
26
- ### menu
27
- The area on the left of the titlebar (where drawer menus tend to open)
28
-
29
- ### action
30
- The area on the right of the titlebar
31
-
32
- ## Example
33
- ```svelte
34
- <script>
35
- import { Titlebar, Button, Paper, Text } from "@axel669/zephyr"
36
- </script>
37
-
38
- <Titlebar color="primary" fill>
39
- <Text title slot="title">
40
- Some Title
41
- </Text>
42
-
43
- <Button slot="menu">
44
- <Icon name="menu" />
45
- </Button>
46
- </Titlebar>
47
-
48
- <Paper>
49
- <Titlebar color="secondary" slot="header">
50
- <Text title slot="title">
51
- Paper Title
52
- <Text subtitle>
53
- Indented Subtitle
54
- </Text>
55
- </Text>
56
- </Titlebar>
57
- </Paper>
58
-
59
- <Paper>
60
- <Titlebar color="secondary" slot="header">
61
- <Flex p="0px" slot="title">
62
- <Text title>
63
- Paper Title
64
- </Text>
65
- <Text subtitle>
66
- Aligned Subtitle
67
- </Text>
68
- </Flex>
69
-
70
- <Button slot="action">
71
- <Icon name="menu" />
72
- </Button>
73
- </Titlebar>
74
- </Paper>
75
- ```
@@ -1,26 +0,0 @@
1
- # Toaster
2
-
3
- The Toaster component is used for building popup notifications along the
4
- edges of the window.
5
-
6
- ## Props
7
-
8
- ### position
9
- Sets position of the toaster. See the
10
- [windstorm base](https://windstorm.axel669.net/lib/css/component/toaster)
11
- for values.
12
-
13
- ## Example
14
- ```svelte
15
- <script>
16
- import { Toaster, Notification, Icon } from "@axel669/zephyr"
17
- </script>
18
-
19
- <Toaster position="$tc">
20
- <Notification>
21
- <Icon name="info">
22
- Some kind of notification of things
23
- </Icon>
24
- </Notification>
25
- </Toaster>
26
- ```
@@ -1,43 +0,0 @@
1
- # Dialog
2
-
3
- A modal container for creating dialogs. The Dialog component is a modal
4
- element that uses a Paper element for the layout of content. All props and
5
- slots for the Dialog are passed to the underlying Paper component.
6
-
7
- The Dialog component is used as a wrapper for content and is used in
8
- conjunction with the Modal component to be controlled on screen.
9
-
10
- ## Props
11
- This component just wraps a [Paper](./paper.md) component with some extra parts,
12
- and passes the props to a `Paper`.
13
-
14
- ## Example
15
- `cool-dialog.svelte`
16
- ```svelte
17
- <script>
18
- import { Dialog, Titlebar, Text } from "@axel669/zephyr"
19
- </script>
20
-
21
- <Dialog>
22
- <Titlebar slot="header">
23
- <Text slot="title" title>
24
- Some Title
25
- </Text>
26
- </Titlebar>
27
-
28
- <span>Content</span>
29
- </Dialog>
30
- ```
31
-
32
- `app.svelte`
33
- ```svelte
34
- <script>
35
- import { Modal, EntryButton } from "@axel669/zephyr"
36
- import CoolDialog from "./cool-dialog.svelte"
37
- </script>
38
-
39
- <Modal component={CoolDialog} />
40
- <EntryButton this={Modal} component={CoolDialog}>
41
- Open Cool Dialog
42
- </EntryButton>
43
- ```
@@ -1,70 +0,0 @@
1
- # Drawer
2
-
3
- A modal container for creating dialogs. The Dialog component is a modal
4
- element that uses a Paper element for the layout of content. All extra props
5
- and slots for the Drawer are passed to the underlying Paper component.
6
-
7
- The Drawer component is used as a wrapper for content and is used in
8
- conjunction with the Modal component to be controlled on screen.
9
-
10
- ## Props
11
-
12
- ### close
13
- `function`
14
-
15
- If passed, this function will be called when the user clicks in the
16
- empty area outside of the drawer contents.
17
-
18
- ### height
19
- `string`
20
-
21
- Sets the height of the select drawer, no effect for menu and action
22
- drawers which default to full height of the window.
23
-
24
- ### type
25
- `string`
26
-
27
- The type of drawer. Default is "menu"
28
- #### "menu"
29
-
30
- Makes a drawer that slides in on the left side of the screen
31
-
32
- #### "action"
33
-
34
- Makes a drawer that slides in on the right side of the screen
35
-
36
- #### "select"
37
-
38
- Makes a drawer that is centered horizontally and slides in from
39
- the top of the screen
40
-
41
- ## Example
42
- `cool-drawer.svelte`
43
- ```svelte
44
- <script>
45
- import { Drawer, Titlebar, Text } from "@axel669/zephyr"
46
- </script>
47
-
48
- <Drawer>
49
- <Titlebar slot="header">
50
- <Text slot="title" title>
51
- Some Title
52
- </Text>
53
- </Titlebar>
54
-
55
- <span>Content</span>
56
- </Drawer>
57
- ```
58
-
59
- `app.svelte`
60
- ```svelte
61
- <script>
62
- import { Modal, EntryButton } from "@axel669/zephyr"
63
- import CoolDrawer from "./cool-drawer.svelte"
64
- </script>
65
-
66
- <Modal component={CoolDrawer} />
67
- <EntryButton this={Modal} component={CoolDrawer}>
68
- Open Cool Dialog
69
- </EntryButton>
70
- ```
@@ -1,43 +0,0 @@
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,61 +0,0 @@
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,50 +0,0 @@
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,94 +0,0 @@
1
- # Paper
2
-
3
- The Paper component is a container that has slots for header and footer
4
- content that is independant from the regular content scrolling. It also uses
5
- Flex as a default layout for its slotted content, but allows any container
6
- to be used as a layout without increasing the indentation of all the content
7
- needlessly.
8
-
9
- ## Props
10
-
11
- ### color
12
- `string`
13
-
14
- Sets `$color`
15
-
16
- ### card
17
- `bool`
18
-
19
- Sets `$outline`
20
-
21
- ### square
22
- `bool`
23
-
24
- Sets `r[0px]`
25
-
26
- ### layout
27
- `Component`
28
-
29
- Sets the layout the card will use to display content. Default is Flex.
30
-
31
- ### scrollable
32
- `bool`
33
-
34
- Sets `over[auto]` on the layout component
35
-
36
- ### l-*
37
- Any prop that is prefixed with `l-` will be passed to the layout
38
- component, with the remaining props acting as the normal wind functions
39
- on the paper itself
40
-
41
- ## Slots
42
-
43
- ### header
44
- The header content for the Paper. Header content does not scroll with
45
- the regular content of the component (acts sticky)
46
-
47
- ### footer
48
- The footer content for the Paper. Same scrolling properties as the
49
- header slot
50
-
51
- ### content/default
52
- The default slot (unnamed) for Paper will be rendered in the layout
53
- component defined in the props. As an alternative, a content slot may
54
- be used that will be rendered directly in the content slot of the Paper
55
- without the layout component/props being rendered (useful when nesting
56
- papers for example)
57
-
58
- ## Example
59
- ```svelte
60
- <script>
61
- import { Paper, Tabs, Text, Titlebar } from "@axel669/zephyr"
62
- </script>
63
-
64
- <Paper>
65
- <Titlebar slot="header">
66
- <Text slot="title" title>
67
- Some Title
68
- </Text>
69
- </Titlebar>
70
-
71
- <div>Content 1</div>
72
- <div>Content 2</div>
73
- <div>Content 3</div>
74
- </Paper>
75
- <Paper l-pad="0px" m="4px">
76
- <Titlebar slot="header">
77
- <Text slot="title" title>
78
- Some Screen
79
- </Text>
80
- </Titlebar>
81
-
82
- <Paper slot="content">
83
- <Tabs slot="header" {options} bind:value />
84
-
85
- <div>Content 1</div>
86
- <div>Content 2</div>
87
- <div>Content 3</div>
88
- </Paper>
89
-
90
- <div slot="footer">
91
- Wat
92
- </div>
93
- </Paper>
94
- ```