@axel669/zephyr 0.1.17 → 0.2.0-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.
- package/LICENSE +21 -21
- package/package.json +11 -7
- package/readme.md +55 -44
- package/src/composed/data-table/th.svelte +60 -0
- package/src/composed/data-table.md +71 -0
- package/src/composed/data-table.svelte +136 -150
- package/src/composed/entry-button.md +34 -0
- package/src/composed/entry-button.svelte +29 -68
- package/src/composed/table-functions.js +13 -0
- package/src/composed/toast/message.svelte +44 -44
- package/src/composed/toast.md +36 -0
- package/src/composed/toast.svelte +68 -108
- package/src/control/button.md +37 -0
- package/src/control/button.svelte +25 -0
- package/src/control/input.svelte +107 -0
- package/src/control/label.md +0 -0
- package/src/control/label.svelte +36 -0
- package/src/control/link.md +37 -0
- package/src/control/link.svelte +28 -0
- package/src/control/radio.md +49 -0
- package/src/control/radio.svelte +28 -0
- package/src/control/select.md +55 -0
- package/src/control/select.svelte +62 -0
- package/src/control/tabs.md +35 -0
- package/src/control/tabs.svelte +39 -0
- package/src/control/toggle.md +38 -0
- package/src/control/toggle.svelte +47 -0
- package/src/data-display/avatar.md +26 -0
- package/src/data-display/avatar.svelte +23 -0
- package/src/data-display/badge.md +24 -0
- package/src/data-display/badge.svelte +12 -0
- package/src/data-display/chip.md +28 -0
- package/src/data-display/chip.svelte +26 -0
- package/src/data-display/details.md +0 -0
- package/src/{details.svelte → data-display/details.svelte} +3 -3
- package/src/data-display/popover.md +32 -0
- package/src/data-display/popover.svelte +23 -0
- package/src/data-display/progress.md +30 -0
- package/src/data-display/progress.svelte +25 -0
- package/src/data-display/table.md +29 -0
- package/src/data-display/table.svelte +36 -0
- package/src/data-display/tooltip.md +25 -0
- package/src/data-display/tooltip.svelte +15 -0
- package/src/dialogs/alert.md +0 -0
- package/src/dialogs/alert.svelte +4 -4
- package/src/dialogs/confirm.md +0 -0
- package/src/dialogs/confirm.svelte +5 -5
- package/src/functions.md +77 -0
- package/src/handler$.mjs +20 -68
- package/src/index.mjs +55 -92
- package/src/info/icon.md +20 -0
- package/src/info/icon.svelte +9 -0
- package/src/info/notification.md +37 -0
- package/src/info/notification.svelte +16 -0
- package/src/info/titlebar.md +46 -0
- package/src/info/titlebar.svelte +18 -0
- package/src/info/toaster.md +23 -0
- package/src/info/toaster.svelte +14 -0
- package/src/inline-dialog.svelte +23 -23
- package/src/layout/dialog.md +33 -0
- package/src/layout/dialog.svelte +24 -0
- package/src/layout/drawer.md +47 -0
- package/src/layout/drawer.svelte +47 -0
- package/src/layout/flex.md +30 -0
- package/src/layout/flex.svelte +22 -0
- package/src/layout/grid.md +36 -0
- package/src/layout/grid.svelte +26 -0
- package/src/layout/modal.md +35 -0
- package/src/layout/modal.svelte +58 -0
- package/src/layout/paper.md +77 -0
- package/src/layout/paper.svelte +45 -0
- package/src/layout/screen.md +31 -0
- package/src/layout/screen.svelte +32 -0
- package/src/{circle-spinner.svelte → spinner/circle-spinner.svelte} +2 -2
- package/src/{hexagon-spinner.svelte → spinner/hexagon-spinner.svelte} +2 -2
- package/src/spinner/spinners.md +0 -0
- package/src/text.md +22 -0
- package/src/text.svelte +20 -49
- package/src/variant.mjs +12 -12
- package/src/wsx.mjs +24 -45
- package/src/avatar.svelte +0 -54
- package/src/badge.svelte +0 -40
- package/src/button.svelte +0 -86
- package/src/chip.svelte +0 -56
- package/src/dialog.svelte +0 -54
- package/src/drawer.svelte +0 -121
- package/src/flex.svelte +0 -57
- package/src/grid.svelte +0 -66
- package/src/icon.svelte +0 -34
- package/src/input/area.svelte +0 -98
- package/src/input/elems.mjs +0 -7
- package/src/input/email.svelte +0 -104
- package/src/input/file.svelte +0 -82
- package/src/input/number.svelte +0 -104
- package/src/input/password.svelte +0 -101
- package/src/input/search.svelte +0 -104
- package/src/input/text.svelte +0 -104
- package/src/link.svelte +0 -67
- package/src/modal.svelte +0 -73
- package/src/notification.svelte +0 -57
- package/src/paper.svelte +0 -127
- package/src/popover.svelte +0 -60
- package/src/progress.svelte +0 -60
- package/src/radio.svelte +0 -82
- package/src/screen.svelte +0 -69
- package/src/select.svelte +0 -122
- package/src/table.svelte +0 -69
- package/src/tabs.svelte +0 -78
- package/src/titlebar.svelte +0 -69
- package/src/toaster.svelte +0 -42
- package/src/toggle.svelte +0 -94
- package/src/tooltip.svelte +0 -45
- package/src/vars.mjs +0 -61
package/src/input/text.svelte
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
/*md
|
|
3
|
-
[@] Components/Input/Text
|
|
4
|
-
|
|
5
|
-
# Input.Text
|
|
6
|
-
|
|
7
|
-
A multiline text input component.
|
|
8
|
-
|
|
9
|
-
## Base
|
|
10
|
-
[Windstorm Labled Control](https://axel669.github.io/lib.windstorm/#components-labeled-control)
|
|
11
|
-
using an input with type="text"
|
|
12
|
-
|
|
13
|
-
## Props
|
|
14
|
-
All [windstorm functions](https://axel669.github.io/lib.windstorm/#css-shorthands)
|
|
15
|
-
are supported.
|
|
16
|
-
|
|
17
|
-
- ### color `string`
|
|
18
|
-
Sets `$color`
|
|
19
|
-
- ### error `string`
|
|
20
|
-
Shows an error message under the input
|
|
21
|
-
- ### flat `bool`
|
|
22
|
-
Sets `@flat`
|
|
23
|
-
- ### hint `string`
|
|
24
|
-
Shows a hint under the label. If no label is provided, the hint will not
|
|
25
|
-
be shown either
|
|
26
|
-
- ### label `string`
|
|
27
|
-
The label for the input
|
|
28
|
-
- ### transform `function`
|
|
29
|
-
If given, it will transform the text value from the input and set the
|
|
30
|
-
`tvalue` to the result
|
|
31
|
-
- ### tvalue
|
|
32
|
-
Value that can be bound to as the output of the transform function.
|
|
33
|
-
Setting has no effect
|
|
34
|
-
- ### validate `function`
|
|
35
|
-
If given, will check the transformed output against a validation
|
|
36
|
-
criteria and store the result in `valid`
|
|
37
|
-
- ### valid `bool`
|
|
38
|
-
Value that can be bound to as the output of the validation function.
|
|
39
|
-
Setting has no effect
|
|
40
|
-
- ### value `string`
|
|
41
|
-
The value of the textarea, can be bound to
|
|
42
|
-
|
|
43
|
-
## Functions
|
|
44
|
-
- focus()\\
|
|
45
|
-
Focuses the input
|
|
46
|
-
|
|
47
|
-
## Usage
|
|
48
|
-
```js
|
|
49
|
-
import { Input } from "@axel669/svelte-wind"
|
|
50
|
-
```svelte
|
|
51
|
-
<Input.Text bind:value />
|
|
52
|
-
<Input.Text bind:value color="primary" />
|
|
53
|
-
<Input.Text bind:value label="Wat" hint="Blep"/>
|
|
54
|
-
<Input.Text bind:value bind:tvalue transform={txt => txt.toLowerCase()} />
|
|
55
|
-
<Input.Text bind:value bind:valid validate={txt => txt.indexOf("a") > 0} />
|
|
56
|
-
```
|
|
57
|
-
*/
|
|
58
|
-
|
|
59
|
-
import wsx from "../wsx.mjs"
|
|
60
|
-
|
|
61
|
-
export let flat = false
|
|
62
|
-
export let label
|
|
63
|
-
export let color = "default"
|
|
64
|
-
export let error = null
|
|
65
|
-
export let hint = null
|
|
66
|
-
export let disabled
|
|
67
|
-
|
|
68
|
-
export let value = ""
|
|
69
|
-
|
|
70
|
-
export let transform = i => i
|
|
71
|
-
export let tvalue
|
|
72
|
-
export let validate = () => true
|
|
73
|
-
export let valid
|
|
74
|
-
|
|
75
|
-
let input = null
|
|
76
|
-
export const focus = () => input.focus()
|
|
77
|
-
|
|
78
|
-
$: wind = {
|
|
79
|
-
"@flat": flat,
|
|
80
|
-
"@control": true,
|
|
81
|
-
$color: color,
|
|
82
|
-
...$$restProps,
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
$: tvalue = transform(value ?? "")
|
|
86
|
-
$: valid = validate(tvalue)
|
|
87
|
-
</script>
|
|
88
|
-
|
|
89
|
-
<label use:wsx={wind} ws-error={error}>
|
|
90
|
-
{#if label}
|
|
91
|
-
<span ws-x="$text" ws-hint={hint}>{label}</span>
|
|
92
|
-
{/if}
|
|
93
|
-
<input {...$$restProps}
|
|
94
|
-
type="text"
|
|
95
|
-
{disabled}
|
|
96
|
-
bind:value
|
|
97
|
-
on:focus
|
|
98
|
-
on:blur
|
|
99
|
-
bind:this={input}
|
|
100
|
-
/>
|
|
101
|
-
|
|
102
|
-
<slot name="start" />
|
|
103
|
-
<slot name="end" />
|
|
104
|
-
</label>
|
package/src/link.svelte
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
/*md
|
|
3
|
-
[@] Components/Link
|
|
4
|
-
|
|
5
|
-
# Link
|
|
6
|
-
|
|
7
|
-
Themed and customizale `<a>` tag component.
|
|
8
|
-
|
|
9
|
-
## Base
|
|
10
|
-
[Windstorm Link](https://axel669.github.io/lib.windstorm/#components-link)
|
|
11
|
-
|
|
12
|
-
## Props
|
|
13
|
-
All [windstorm functions](https://axel669.github.io/lib.windstorm/#css-shorthands)
|
|
14
|
-
are supported.
|
|
15
|
-
|
|
16
|
-
- ### button `string`
|
|
17
|
-
If true, the link will be styled like a button
|
|
18
|
-
- ### color `string`
|
|
19
|
-
Sets the color of the button. Applies to both regular links and button
|
|
20
|
-
style links.
|
|
21
|
-
- ### href `string`
|
|
22
|
-
Sets the href attribute.
|
|
23
|
-
- ### rel `string`
|
|
24
|
-
Sets the rel attribute.
|
|
25
|
-
- ### target `string`
|
|
26
|
-
Sets the target attribute
|
|
27
|
-
- ### fill / outline `bool`
|
|
28
|
-
Sets the link-button type to @fill if fill is true, @outline if outline
|
|
29
|
-
is true, or @flat if neither is true.
|
|
30
|
-
|
|
31
|
-
## Usage
|
|
32
|
-
```svelte
|
|
33
|
-
<Link color="primary" href="test" target="_blank">
|
|
34
|
-
Test
|
|
35
|
-
</Link>
|
|
36
|
-
<Link color="primary" href="logout" button outline>
|
|
37
|
-
Logout
|
|
38
|
-
</Link>
|
|
39
|
-
```
|
|
40
|
-
*/
|
|
41
|
-
|
|
42
|
-
import wsx from "./wsx.mjs"
|
|
43
|
-
import variant from "./variant.mjs"
|
|
44
|
-
|
|
45
|
-
export let button = false
|
|
46
|
-
export let color = false
|
|
47
|
-
|
|
48
|
-
export let href = ""
|
|
49
|
-
export let rel = "noreferrer"
|
|
50
|
-
export let target = null
|
|
51
|
-
|
|
52
|
-
export let fill = false
|
|
53
|
-
export let outline = false
|
|
54
|
-
|
|
55
|
-
$: type = variant({ fill, outline })
|
|
56
|
-
|
|
57
|
-
$: wind = {
|
|
58
|
-
"@button": button,
|
|
59
|
-
[type]: true,
|
|
60
|
-
$color: color,
|
|
61
|
-
...$$restProps
|
|
62
|
-
}
|
|
63
|
-
</script>
|
|
64
|
-
|
|
65
|
-
<a {href} {target} {rel} use:wsx={wind}>
|
|
66
|
-
<slot />
|
|
67
|
-
</a>
|
package/src/modal.svelte
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
/*md
|
|
3
|
-
[@] Components/Modal
|
|
4
|
-
|
|
5
|
-
# Modal
|
|
6
|
-
|
|
7
|
-
The Modal component is used to control when content should be shown that
|
|
8
|
-
sits over the current content and prevents interaction with the content it
|
|
9
|
-
covers. It is primarily used to show drawers, dialogs, and sub screens.
|
|
10
|
-
|
|
11
|
-
The `show` function will display the component specified inside a ws-modal
|
|
12
|
-
element, and can be awaited for an optional return value. The component
|
|
13
|
-
displayed will be passed any props supplied to `show` and a `close` function
|
|
14
|
-
that can be called to hide the component again. `close` can also be given
|
|
15
|
-
an argument that will be used as the promise value from `show`.
|
|
16
|
-
|
|
17
|
-
If a component that a modal displays exports a `cancel` function, then
|
|
18
|
-
clicking the modal area outside the displayed component will call that
|
|
19
|
-
`cancel` function, allowing any modal component to decide when/if it is
|
|
20
|
-
closes in response to that event.
|
|
21
|
-
|
|
22
|
-
## Props
|
|
23
|
-
Because the Modal does not render content of its own, it does not support
|
|
24
|
-
any wind functions.
|
|
25
|
-
|
|
26
|
-
- ### component `Component`
|
|
27
|
-
The component to display when `show` is called
|
|
28
|
-
|
|
29
|
-
## Functions
|
|
30
|
-
- ### `show(props?) -> Promise`
|
|
31
|
-
Shows the given component and passes any props provided.
|
|
32
|
-
|
|
33
|
-
## Usage
|
|
34
|
-
```svelte
|
|
35
|
-
<Modal component={CoolDialog} bind:this={dialog} />
|
|
36
|
-
<Button on:click={() => dialog.show({ a: 10, b: 12 })}>
|
|
37
|
-
Open Dialog
|
|
38
|
-
</Button>
|
|
39
|
-
```
|
|
40
|
-
*/
|
|
41
|
-
|
|
42
|
-
export let component
|
|
43
|
-
|
|
44
|
-
let modalProps = null
|
|
45
|
-
let resolver = null
|
|
46
|
-
let displayed = null
|
|
47
|
-
|
|
48
|
-
const close = (value) => {
|
|
49
|
-
resolver(value)
|
|
50
|
-
resolver = null
|
|
51
|
-
modalProps = null
|
|
52
|
-
}
|
|
53
|
-
const cancel = () => displayed.cancel?.()
|
|
54
|
-
|
|
55
|
-
export const show = (props) => new Promise(
|
|
56
|
-
(resolve) => {
|
|
57
|
-
modalProps = props ?? {}
|
|
58
|
-
resolver = resolve
|
|
59
|
-
}
|
|
60
|
-
)
|
|
61
|
-
</script>
|
|
62
|
-
|
|
63
|
-
{#if resolver !== null}
|
|
64
|
-
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
65
|
-
<ws-modal ws-x="$show" on:click={cancel}>
|
|
66
|
-
<svelte:component
|
|
67
|
-
bind:this={displayed}
|
|
68
|
-
this={component}
|
|
69
|
-
{...modalProps}
|
|
70
|
-
{close}
|
|
71
|
-
/>
|
|
72
|
-
</ws-modal>
|
|
73
|
-
{/if}
|
package/src/notification.svelte
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
/*md
|
|
3
|
-
[@] Components/Notification
|
|
4
|
-
|
|
5
|
-
# Notification
|
|
6
|
-
|
|
7
|
-
Displays a piece of content that stands out from the surrounding content and
|
|
8
|
-
can also be used for toast messages. Optionally has some interactable
|
|
9
|
-
elements embedded.
|
|
10
|
-
|
|
11
|
-
Expects 1-2 child nodes and will display them on the sides of the
|
|
12
|
-
notification with space between them. This means that reversing the order
|
|
13
|
-
of the child nodes will flip which sides they appear on.
|
|
14
|
-
|
|
15
|
-
## Base
|
|
16
|
-
[Windstorm Notification](https://axel669.github.io/lib.windstorm/#components-notification)
|
|
17
|
-
|
|
18
|
-
## Props
|
|
19
|
-
All [windstorm functions](https://axel669.github.io/lib.windstorm/#css-shorthands)
|
|
20
|
-
are supported.
|
|
21
|
-
|
|
22
|
-
- ### color
|
|
23
|
-
Sets `$color` and uses the fill style for coloration.
|
|
24
|
-
|
|
25
|
-
## Usage
|
|
26
|
-
```svelte
|
|
27
|
-
<Notification>
|
|
28
|
-
<Icon name="info-hexagon">
|
|
29
|
-
Some kind of information
|
|
30
|
-
</Icon>
|
|
31
|
-
</Notification>
|
|
32
|
-
<Notification color="danger">
|
|
33
|
-
<Icon name="alert-hexagon">
|
|
34
|
-
Something broke
|
|
35
|
-
</Icon>
|
|
36
|
-
|
|
37
|
-
<Button>
|
|
38
|
-
Cancel
|
|
39
|
-
</Button>
|
|
40
|
-
</Notification>
|
|
41
|
-
```
|
|
42
|
-
*/
|
|
43
|
-
|
|
44
|
-
import wsx from "./wsx.mjs"
|
|
45
|
-
|
|
46
|
-
export let color = false
|
|
47
|
-
|
|
48
|
-
$: wind = {
|
|
49
|
-
$color: color,
|
|
50
|
-
...$$restProps,
|
|
51
|
-
}
|
|
52
|
-
</script>
|
|
53
|
-
|
|
54
|
-
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
55
|
-
<ws-notification use:wsx={wind} on:click>
|
|
56
|
-
<slot />
|
|
57
|
-
</ws-notification>
|
package/src/paper.svelte
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
/*md
|
|
3
|
-
[@] Components/Containers/Paper
|
|
4
|
-
|
|
5
|
-
# Paper
|
|
6
|
-
|
|
7
|
-
The Paper component is a container that has slots for header and footer
|
|
8
|
-
content that is independant from the regular content scrolling. It also uses
|
|
9
|
-
Flex as a default layout for its slotted content, but allows any container
|
|
10
|
-
to be used as a layout without increasing the indentation of all the content
|
|
11
|
-
needlessly.
|
|
12
|
-
|
|
13
|
-
## Base
|
|
14
|
-
[Windstorm Paper](https://axel669.github.io/lib.windstorm/#components-paper)
|
|
15
|
-
|
|
16
|
-
## Props
|
|
17
|
-
All [windstorm functions](https://axel669.github.io/lib.windstorm/#css-shorthands)
|
|
18
|
-
are supported.
|
|
19
|
-
|
|
20
|
-
- ### color `string`
|
|
21
|
-
Sets `$color`
|
|
22
|
-
- ### card `bool`
|
|
23
|
-
Sets `@outline`
|
|
24
|
-
- ### square `bool`
|
|
25
|
-
Sets `r[0px]`
|
|
26
|
-
- ### layout `Component`
|
|
27
|
-
Sets the layout the card will use to display content. Default is Flex.
|
|
28
|
-
- ### scrollable `bool`
|
|
29
|
-
Sets `over[auto]` on the layout component
|
|
30
|
-
- ### l-*
|
|
31
|
-
Any prop that is prefixed with `l-` will be passed to the layout
|
|
32
|
-
component, with the remaining props acting as the normal wind functions
|
|
33
|
-
on the paper itself
|
|
34
|
-
|
|
35
|
-
## Slots
|
|
36
|
-
- ### header
|
|
37
|
-
The header content for the Paper. Header content does not scroll with
|
|
38
|
-
the regular content of the component (acts sticky)
|
|
39
|
-
- ### footer
|
|
40
|
-
The footer content for the Paper. Same scrolling properties as the
|
|
41
|
-
header slot
|
|
42
|
-
- ### content/default
|
|
43
|
-
The default slot (unnamed) for Paper will be rendered in the layout
|
|
44
|
-
component defined in the props. As an alternative, a content slot may
|
|
45
|
-
be used that will be rendered directly in the content slot of the Paper
|
|
46
|
-
without the layout component/props being rendered (useful when nesting
|
|
47
|
-
papers for example)
|
|
48
|
-
|
|
49
|
-
## Usage
|
|
50
|
-
```svelte
|
|
51
|
-
<Paper>
|
|
52
|
-
<Titlebar slot="header">
|
|
53
|
-
<Text slot="title" title>
|
|
54
|
-
Some Title
|
|
55
|
-
</Text>
|
|
56
|
-
</Titlebar>
|
|
57
|
-
|
|
58
|
-
<div>Content 1</div>
|
|
59
|
-
<div>Content 2</div>
|
|
60
|
-
<div>Content 3</div>
|
|
61
|
-
</Paper>
|
|
62
|
-
<Paper l-pad="0px" m="4px">
|
|
63
|
-
<Titlebar slot="header">
|
|
64
|
-
<Text slot="title" title>
|
|
65
|
-
Some Screen
|
|
66
|
-
</Text>
|
|
67
|
-
</Titlebar>
|
|
68
|
-
|
|
69
|
-
<Paper slot="content">
|
|
70
|
-
<Tabs slot="header" {options} bind:value />
|
|
71
|
-
|
|
72
|
-
<div>Content 1</div>
|
|
73
|
-
<div>Content 2</div>
|
|
74
|
-
<div>Content 3</div>
|
|
75
|
-
</Paper>
|
|
76
|
-
|
|
77
|
-
<div slot="footer">
|
|
78
|
-
Wat
|
|
79
|
-
</div>
|
|
80
|
-
</Paper>
|
|
81
|
-
```
|
|
82
|
-
*/
|
|
83
|
-
|
|
84
|
-
import Flex from "./flex.svelte"
|
|
85
|
-
import wsx from "./wsx.mjs"
|
|
86
|
-
|
|
87
|
-
export let color
|
|
88
|
-
export let card = false
|
|
89
|
-
export let square = false
|
|
90
|
-
export let layout = Flex
|
|
91
|
-
export let scrollable = true
|
|
92
|
-
|
|
93
|
-
$: props = Object.entries($$restProps).reduce(
|
|
94
|
-
(p, [key, value]) => {
|
|
95
|
-
const [target, name] =
|
|
96
|
-
(key.startsWith("l-") === true)
|
|
97
|
-
? [ p.layout, key.slice(2) ]
|
|
98
|
-
: [ p.paper, key ]
|
|
99
|
-
target[name] = value
|
|
100
|
-
return p
|
|
101
|
-
},
|
|
102
|
-
{ layout: {}, paper: {} }
|
|
103
|
-
)
|
|
104
|
-
|
|
105
|
-
$: layoutProps = {
|
|
106
|
-
over: scrollable ? "auto" : false,
|
|
107
|
-
...props.layout,
|
|
108
|
-
}
|
|
109
|
-
$: wind = {
|
|
110
|
-
$color: color,
|
|
111
|
-
"@outline": card,
|
|
112
|
-
r: square && "0px",
|
|
113
|
-
...props.paper,
|
|
114
|
-
}
|
|
115
|
-
</script>
|
|
116
|
-
|
|
117
|
-
<ws-paper use:wsx={wind}>
|
|
118
|
-
<slot name="header" />
|
|
119
|
-
{#if $$slots.content}
|
|
120
|
-
<slot name="content" slot="content" />
|
|
121
|
-
{:else}
|
|
122
|
-
<svelte:component this={layout} {...layoutProps} slot="content">
|
|
123
|
-
<slot />
|
|
124
|
-
</svelte:component>
|
|
125
|
-
{/if}
|
|
126
|
-
<slot name="footer" />
|
|
127
|
-
</ws-paper>
|
package/src/popover.svelte
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
/*md
|
|
3
|
-
[@] Components/Containers/Popover
|
|
4
|
-
|
|
5
|
-
# Popover
|
|
6
|
-
|
|
7
|
-
The Popover component is for displaying content over something without it
|
|
8
|
-
being modal (you can interact with things under it still).
|
|
9
|
-
|
|
10
|
-
## Base
|
|
11
|
-
[Windstorm Popover](https://axel669.github.io/lib.windstorm/#components-popover)
|
|
12
|
-
|
|
13
|
-
## Props
|
|
14
|
-
All [windstorm functions](https://axel669.github.io/lib.windstorm/#css-shorthands)
|
|
15
|
-
are supported.
|
|
16
|
-
|
|
17
|
-
## Variables
|
|
18
|
-
- show
|
|
19
|
-
- hide
|
|
20
|
-
The Popover exposes 2 variables for use: `show` and `hide`. These functions
|
|
21
|
-
are given to the content so that it can control when to display the popover
|
|
22
|
-
content without needing to bind to the parent.
|
|
23
|
-
|
|
24
|
-
## Usage
|
|
25
|
-
```svelte
|
|
26
|
-
<Popover let:show let:hide>
|
|
27
|
-
<Button on:click={show}>
|
|
28
|
-
Show
|
|
29
|
-
</Button>
|
|
30
|
-
<div ws-x="inset-x[0px] y[0px] h[100px] bg[teal]" slot="content">
|
|
31
|
-
<Button on:click={hide}>
|
|
32
|
-
Hide
|
|
33
|
-
</Button>
|
|
34
|
-
</div>
|
|
35
|
-
</Popover>
|
|
36
|
-
```
|
|
37
|
-
*/
|
|
38
|
-
|
|
39
|
-
import { fade } from "svelte/transition"
|
|
40
|
-
import wsx from "./wsx.mjs"
|
|
41
|
-
|
|
42
|
-
let visible = false
|
|
43
|
-
const show = () => visible = true
|
|
44
|
-
const hide = () => visible = false
|
|
45
|
-
const anim = { duration: 200 }
|
|
46
|
-
|
|
47
|
-
$: wind = {
|
|
48
|
-
$show: true,
|
|
49
|
-
...$$restProps,
|
|
50
|
-
}
|
|
51
|
-
</script>
|
|
52
|
-
|
|
53
|
-
<ws-popover use:wsx={wind}>
|
|
54
|
-
<slot {show} />
|
|
55
|
-
{#if visible}
|
|
56
|
-
<wind-content ws-x="slot[content] inset[0px]" transition:fade={anim}>
|
|
57
|
-
<slot name="content" {hide} />
|
|
58
|
-
</wind-content>
|
|
59
|
-
{/if}
|
|
60
|
-
</ws-popover>
|
package/src/progress.svelte
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
/*md
|
|
3
|
-
[@] Components/Progress
|
|
4
|
-
|
|
5
|
-
# Progress
|
|
6
|
-
|
|
7
|
-
Displays progress bar with an optional label.
|
|
8
|
-
|
|
9
|
-
## Base
|
|
10
|
-
[Windstorm Progress Bar](https://axel669.github.io/lib.windstorm/#components-progress-bar)
|
|
11
|
-
|
|
12
|
-
## Props
|
|
13
|
-
All [windstorm functions](https://axel669.github.io/lib.windstorm/#css-shorthands)
|
|
14
|
-
are supported.
|
|
15
|
-
|
|
16
|
-
- ### color `string`
|
|
17
|
-
Sets `$color`
|
|
18
|
-
- ### label `string`
|
|
19
|
-
The label for the bar
|
|
20
|
-
- ### max `number`
|
|
21
|
-
Sets the max value for the progress bar. Default is 1
|
|
22
|
-
- ### outline `bool`
|
|
23
|
-
Sets `@outline`
|
|
24
|
-
- ### row `bool`
|
|
25
|
-
Sets `$row`
|
|
26
|
-
- ### value `number`
|
|
27
|
-
Sets the value of the progress bar. Combined with max to determine how
|
|
28
|
-
filled the bar is.
|
|
29
|
-
|
|
30
|
-
## Usage
|
|
31
|
-
```svelte
|
|
32
|
-
<Progress color="primary" value={0.1} />
|
|
33
|
-
<Progress color="primary" value={5} max={10} />
|
|
34
|
-
```
|
|
35
|
-
*/
|
|
36
|
-
|
|
37
|
-
import wsx from "./wsx.mjs"
|
|
38
|
-
|
|
39
|
-
export let value = 0
|
|
40
|
-
export let max = 1
|
|
41
|
-
export let color = "default"
|
|
42
|
-
export let outline = false
|
|
43
|
-
export let row = false
|
|
44
|
-
export let label = null
|
|
45
|
-
|
|
46
|
-
$: wind = {
|
|
47
|
-
"@progress": true,
|
|
48
|
-
"@outline": outline,
|
|
49
|
-
$color: color,
|
|
50
|
-
$row: row,
|
|
51
|
-
...$$restProps,
|
|
52
|
-
}
|
|
53
|
-
</script>
|
|
54
|
-
|
|
55
|
-
<label use:wsx={wind}>
|
|
56
|
-
{#if label}
|
|
57
|
-
<span ws-x="$text t-ws[nowrap]">{label}</span>
|
|
58
|
-
{/if}
|
|
59
|
-
<progress {value} {max} />
|
|
60
|
-
</label>
|
package/src/radio.svelte
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
/*md
|
|
3
|
-
[@] Components/Input/Radio
|
|
4
|
-
|
|
5
|
-
# Radio
|
|
6
|
-
|
|
7
|
-
The radio component displays a list of radio options and provides an
|
|
8
|
-
interface to control which one is selected and react to changes in the
|
|
9
|
-
selected value. It also uses a layout component to decide how the options
|
|
10
|
-
are presented.
|
|
11
|
-
|
|
12
|
-
## Base
|
|
13
|
-
Each radio item rendered is a
|
|
14
|
-
[Windstorm Labeled Toggle](https://axel669.github.io/lib.windstorm/#components-labeled toggle)
|
|
15
|
-
that uses a radio input.
|
|
16
|
-
|
|
17
|
-
## Props
|
|
18
|
-
All [windstorm functions](https://axel669.github.io/lib.windstorm/#css-shorthands)
|
|
19
|
-
are supported.
|
|
20
|
-
|
|
21
|
-
Unlike the Paper, the wind functions passed as props to the Radio component
|
|
22
|
-
are passed directly to the layout specified because the Radio does not have
|
|
23
|
-
a container element of its own.
|
|
24
|
-
|
|
25
|
-
- ### layout `Component`
|
|
26
|
-
The component to use for layout out the options. Default is Flex.
|
|
27
|
-
- ### options `Array[Object]`
|
|
28
|
-
An array of objects that defines the options to show. Details below.
|
|
29
|
-
- ### value `any`
|
|
30
|
-
The value currently selected. Can be bound to react to selections or
|
|
31
|
-
change the current selection.
|
|
32
|
-
|
|
33
|
-
## Options
|
|
34
|
-
Each object in the options array supplied should have a `value` and `label`
|
|
35
|
-
prop specified. Additionally, any wind functions that should be applied to
|
|
36
|
-
the option can be passed as additional props.
|
|
37
|
-
|
|
38
|
-
Labels should be strings, but values can be any type as long as they are
|
|
39
|
-
unique in the list.
|
|
40
|
-
|
|
41
|
-
```js
|
|
42
|
-
const options = [
|
|
43
|
-
{ label: "first", value: 1 },
|
|
44
|
-
{ label: "second", value: [] },
|
|
45
|
-
{ label: "third", value: "3", $color: "warning" }
|
|
46
|
-
]
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
## Usage
|
|
50
|
-
```svelte
|
|
51
|
-
<Radio {options} bind:value />
|
|
52
|
-
<Radio {options} bind:value={other} layout={Grid} gr-col="1fr 1fr" />
|
|
53
|
-
```
|
|
54
|
-
*/
|
|
55
|
-
|
|
56
|
-
import asuid from "@labyrinthos/asuid"
|
|
57
|
-
|
|
58
|
-
import wsx from "./wsx.mjs"
|
|
59
|
-
import { handler$ } from "./handler$.mjs"
|
|
60
|
-
|
|
61
|
-
import Flex from "./flex.svelte"
|
|
62
|
-
|
|
63
|
-
export let options = []
|
|
64
|
-
export let layout = Flex
|
|
65
|
-
export let value
|
|
66
|
-
|
|
67
|
-
$: valueIndex = options.findIndex(item => item.value === value)
|
|
68
|
-
const set = handler$(
|
|
69
|
-
(newValue) => value = newValue
|
|
70
|
-
)
|
|
71
|
-
|
|
72
|
-
const name = asuid()
|
|
73
|
-
</script>
|
|
74
|
-
|
|
75
|
-
<svelte:component this={layout} {...$$restProps}>
|
|
76
|
-
{#each options as {value, label, disabled, ...wind}, index (value)}
|
|
77
|
-
<label use:wsx={{"@toggle": true, ...wind}} {disabled}>
|
|
78
|
-
<span>{label}</span>
|
|
79
|
-
<input type="radio" on:input={set(value)} {name} checked={index === valueIndex} />
|
|
80
|
-
</label>
|
|
81
|
-
{/each}
|
|
82
|
-
</svelte:component>
|
package/src/screen.svelte
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
<script context="module">
|
|
2
|
-
const ctxStack = Symbol("stack context")
|
|
3
|
-
const ctxClose = Symbol("close context")
|
|
4
|
-
</script>
|
|
5
|
-
|
|
6
|
-
<script>
|
|
7
|
-
/*md
|
|
8
|
-
[@] Components/Containers/Screen
|
|
9
|
-
|
|
10
|
-
# Screen
|
|
11
|
-
|
|
12
|
-
The screen is a container component that is used for displaying content
|
|
13
|
-
over its parent and stacks as more screens are displayed. Screens that stack
|
|
14
|
-
on top of a parent screen use the Modal to control when they are shown and
|
|
15
|
-
pass values back from child screens. The stacking effect of the Screen is
|
|
16
|
-
controlled by internally tracked svelte context, so no manual effort is
|
|
17
|
-
required to get stacking screens to have the effect.
|
|
18
|
-
|
|
19
|
-
## Base
|
|
20
|
-
[Windstorm Screen](https://axel669.github.io/lib.windstorm/#components-screen)
|
|
21
|
-
|
|
22
|
-
## Props
|
|
23
|
-
All [windstorm functions](https://axel669.github.io/lib.windstorm/#css-shorthands)
|
|
24
|
-
are supported, but they probably won't help much with this component.
|
|
25
|
-
|
|
26
|
-
- ### width `string`
|
|
27
|
-
The width of the screen before stack-based padding is applied
|
|
28
|
-
|
|
29
|
-
## Usage
|
|
30
|
-
`cool-screen.svelte`
|
|
31
|
-
```svelte
|
|
32
|
-
<Screen width="70%">
|
|
33
|
-
<Paper>
|
|
34
|
-
This screen is pretty cool I swear
|
|
35
|
-
<Button on:click={() => close("hi")}>
|
|
36
|
-
Close
|
|
37
|
-
</Button>
|
|
38
|
-
</Paper>
|
|
39
|
-
</Screen>
|
|
40
|
-
```
|
|
41
|
-
*/
|
|
42
|
-
|
|
43
|
-
import { getContext, setContext } from "svelte"
|
|
44
|
-
import { fly } from "svelte/transition"
|
|
45
|
-
|
|
46
|
-
import wsx from "./wsx.mjs"
|
|
47
|
-
import vars from "./vars.mjs"
|
|
48
|
-
|
|
49
|
-
export let width = false
|
|
50
|
-
|
|
51
|
-
const stack = getContext(ctxStack) ?? 0
|
|
52
|
-
const animation = {
|
|
53
|
-
y: window.innerHeight,
|
|
54
|
-
duration: 350
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
setContext(ctxStack, stack + 1)
|
|
58
|
-
|
|
59
|
-
$: wind = {
|
|
60
|
-
"&stack": stack.toString(),
|
|
61
|
-
"&screen-width": width,
|
|
62
|
-
"bg-c": "transparent",
|
|
63
|
-
...$$restProps
|
|
64
|
-
}
|
|
65
|
-
</script>
|
|
66
|
-
|
|
67
|
-
<ws-screen use:wsx={wind} transition:fly={animation}>
|
|
68
|
-
<slot />
|
|
69
|
-
</ws-screen>
|