@axel669/zephyr 0.3.8 → 0.4.5

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 (76) 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/input.svelte +21 -41
  9. package/src/control/label.svelte +1 -1
  10. package/src/control/link.svelte +1 -1
  11. package/src/control/radio-group.svelte +21 -0
  12. package/src/control/select.svelte +5 -5
  13. package/src/control/tabs.svelte +9 -21
  14. package/src/control/toggle.svelte +2 -2
  15. package/src/data-display/avatar.svelte +4 -1
  16. package/src/data-display/badge.svelte +1 -1
  17. package/src/data-display/chip.svelte +1 -1
  18. package/src/data-display/popover.svelte +1 -1
  19. package/src/data-display/progress.svelte +2 -2
  20. package/src/data-display/table.svelte +1 -1
  21. package/src/dialogs/confirm.svelte +3 -3
  22. package/src/hash.js +3 -3
  23. package/src/index.mjs +11 -1
  24. package/src/info/notification.svelte +13 -1
  25. package/src/info/titlebar.svelte +21 -5
  26. package/src/layout/dialog.svelte +1 -1
  27. package/src/layout/drawer.svelte +4 -4
  28. package/src/layout/flex.svelte +0 -4
  29. package/src/layout/grid.svelte +4 -4
  30. package/src/layout/paper.svelte +13 -4
  31. package/src/routing/route.svelte +48 -0
  32. package/src/routing/routing.js +62 -0
  33. package/src/routing/title.svelte +26 -0
  34. package/src/spinner/circle-spinner.svelte +2 -1
  35. package/src/spinner/hexagon-spinner.svelte +2 -1
  36. package/src/text.svelte +2 -4
  37. package/src/wsx.mjs +9 -8
  38. package/src/async/button.md +0 -27
  39. package/src/async/load-zone.md +0 -42
  40. package/src/composed/data-table/th.md +0 -21
  41. package/src/composed/data-table.md +0 -86
  42. package/src/composed/entry-button.md +0 -44
  43. package/src/composed/toast.md +0 -45
  44. package/src/control/button.md +0 -41
  45. package/src/control/input.md +0 -87
  46. package/src/control/label.md +0 -48
  47. package/src/control/link.md +0 -50
  48. package/src/control/radio.md +0 -58
  49. package/src/control/radio.svelte +0 -28
  50. package/src/control/select.md +0 -70
  51. package/src/control/tabs.md +0 -47
  52. package/src/control/toggle.md +0 -61
  53. package/src/data-display/avatar.md +0 -36
  54. package/src/data-display/badge.md +0 -30
  55. package/src/data-display/chip.md +0 -36
  56. package/src/data-display/details.md +0 -42
  57. package/src/data-display/popover.md +0 -32
  58. package/src/data-display/progress.md +0 -46
  59. package/src/data-display/table.md +0 -59
  60. package/src/data-display/tooltip.md +0 -29
  61. package/src/dialogs/alert.md +0 -42
  62. package/src/dialogs/confirm.md +0 -56
  63. package/src/functions.md +0 -108
  64. package/src/info/icon.md +0 -21
  65. package/src/info/notification.md +0 -36
  66. package/src/info/titlebar.md +0 -75
  67. package/src/info/toaster.md +0 -26
  68. package/src/layout/dialog.md +0 -43
  69. package/src/layout/drawer.md +0 -70
  70. package/src/layout/flex.md +0 -43
  71. package/src/layout/grid.md +0 -61
  72. package/src/layout/modal.md +0 -50
  73. package/src/layout/paper.md +0 -94
  74. package/src/layout/screen.md +0 -33
  75. package/src/spinner/spinners.md +0 -22
  76. package/src/text.md +0 -34
@@ -1,32 +0,0 @@
1
- # Popover
2
-
3
- The Popover component is for displaying content over something without it
4
- being modal (you can interact with things under it still).
5
-
6
- ## Variables
7
- - show
8
- - hide
9
- The Popover exposes 2 variables for use: `show` and `hide`. These functions
10
- are given to the content so that it can control when to display the popover
11
- content without needing to bind to the parent.
12
-
13
- > Beacuse the hide function is given to a named slot, the `let:hide` declaration
14
- > needs to be on the slotted element.
15
-
16
- ## Example
17
- ```svelte
18
- <script>
19
- import { Popover, Button } from "@axel669/zephyr"
20
- </script>
21
-
22
- <Popover let:show>
23
- <Button on:click={show}>
24
- Show
25
- </Button>
26
- <div ws-x="inset-x[0px] y[0px] h[100px] bg[teal]" slot="content" let:hide>
27
- <Button on:click={hide}>
28
- Hide
29
- </Button>
30
- </div>
31
- </Popover>
32
- ```
@@ -1,46 +0,0 @@
1
- # Progress
2
-
3
- Displays progress bar with an optional label.
4
-
5
- ## Props
6
-
7
- ### color
8
- `string`
9
-
10
- Sets `$color`
11
-
12
- ### label
13
- `string`
14
-
15
- The label for the bar
16
-
17
- ### max
18
- `number`
19
-
20
- Sets the max value for the progress bar. Default is 1
21
-
22
- ### outline
23
- `bool`
24
-
25
- Sets `$outline`
26
-
27
- ### row
28
- `bool`
29
-
30
- Sets `$row`
31
-
32
- ### value
33
- `number`
34
-
35
- Sets the value of the progress bar. Combined with max to determine how
36
- filled the bar is.
37
-
38
- ## Example
39
- ```svelte
40
- <script>
41
- import { Progress } from "@axel669/zephyr"
42
- </script>
43
-
44
- <Progress color="primary" value={0.1} />
45
- <Progress color="primary" value={5} max={10} />
46
- ```
@@ -1,59 +0,0 @@
1
- # Table
2
- Wrapper for making tables in a way that is easy to maintain.
3
-
4
- ## Props
5
-
6
- ### color
7
- `string`
8
-
9
- Sets the $color macro.
10
-
11
- ### data
12
- `Array`
13
-
14
- The data to display in the table.
15
-
16
- ### fillHeader
17
- `bool`
18
-
19
- If true, the header row will have the background filled instead of just the
20
- colored border.
21
-
22
- ## Slots
23
-
24
- ### header
25
- Used to render the header for the table. Needs to include the `tr`.
26
-
27
- ### row
28
- Used to render an item that is not `undefined`. Needs to include the `tr`. Uses
29
- `let:row` for the row data, and `let:rowNum` for the row number (0-based).
30
-
31
- ### empty-row
32
- If given, will render when the item in the array is `undefined`. Uses
33
- `let:rowNum` for the row number (0-based).
34
-
35
- ## Example
36
- ```svelte
37
- <script>
38
- import { Table } from "@axel669/zephyr"
39
-
40
- const data = Array.from(
41
- { length: 20 },
42
- (_, i) => [i, i ** 2, i ** 3]
43
- )
44
- </script>
45
-
46
- <Table>
47
- <tr slot="header">
48
- <th>N</th>
49
- <th>Squared</th>
50
- <th>Cubed</th>
51
- </tr>
52
-
53
- <tr slot="row" let:row>
54
- <td>{row[0]}</td>
55
- <td>{row[1]}</td>
56
- <td>{row[2]}</td>
57
- </tr>
58
- </Table>
59
- ```
@@ -1,29 +0,0 @@
1
- # Tooltip
2
-
3
- Displays a tooltip above (or below) some content when it's hovered.
4
-
5
- ## Props
6
-
7
- ### text
8
- `string`
9
-
10
- The text to display in the tooltip.
11
-
12
- ### bottom
13
- `bool`
14
-
15
- If true, the tooltip will be shown under the content instead of over.
16
-
17
- ## Example
18
- ```svelte
19
- <script>
20
- import { Tooltip, Button } from "@axel669/zephyr"
21
- </script>
22
-
23
- <Tooltip text="This is a button">
24
- <Button>Do Thing</Button>
25
- </Tooltip>
26
- <Tooltip text="This shows under" bottom>
27
- Just some text content
28
- </Tooltip>
29
- ```
@@ -1,42 +0,0 @@
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,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
- ```