@axel669/zephyr 0.1.17 → 0.2.0-beta.1
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 +10 -7
- package/readme.md +55 -44
- package/src/async/button.svelte +31 -0
- package/src/async/load-zone.svelte +17 -0
- package/src/composed/data-table/th.svelte +60 -0
- package/src/composed/data-table.md +83 -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 +56 -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 +45 -0
- package/src/control/label.svelte +36 -0
- package/src/control/link.md +46 -0
- package/src/control/link.svelte +28 -0
- package/src/control/radio.md +56 -0
- package/src/control/radio.svelte +26 -0
- package/src/control/select.md +68 -0
- package/src/control/select.svelte +62 -0
- package/src/control/tabs.md +45 -0
- package/src/control/tabs.svelte +39 -0
- package/src/control/toggle.md +55 -0
- package/src/control/toggle.svelte +47 -0
- package/src/data-display/avatar.md +32 -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 +32 -0
- package/src/data-display/chip.svelte +26 -0
- package/src/data-display/details.md +3 -0
- package/src/{details.svelte → data-display/details.svelte} +3 -3
- package/src/data-display/popover.md +28 -0
- package/src/data-display/popover.svelte +23 -0
- package/src/data-display/progress.md +42 -0
- package/src/data-display/progress.svelte +25 -0
- package/src/data-display/table.md +7 -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 +3 -0
- package/src/dialogs/alert.svelte +4 -4
- package/src/dialogs/confirm.md +3 -0
- package/src/dialogs/confirm.svelte +5 -5
- package/src/functions.md +77 -0
- package/src/handler$.mjs +20 -68
- package/src/index.mjs +58 -92
- package/src/info/icon.md +17 -0
- package/src/info/icon.svelte +9 -0
- package/src/info/notification.md +32 -0
- package/src/info/notification.svelte +16 -0
- package/src/info/titlebar.md +49 -0
- package/src/info/titlebar.svelte +18 -0
- package/src/info/toaster.md +22 -0
- package/src/info/toaster.svelte +14 -0
- package/src/inline-dialog.svelte +23 -23
- package/src/layout/dialog.md +34 -0
- package/src/layout/dialog.svelte +24 -0
- package/src/layout/drawer.md +61 -0
- package/src/layout/drawer.svelte +47 -0
- package/src/layout/flex.md +39 -0
- package/src/layout/flex.svelte +22 -0
- package/src/layout/grid.md +57 -0
- package/src/layout/grid.svelte +26 -0
- package/src/layout/modal.md +47 -0
- package/src/layout/modal.svelte +58 -0
- package/src/layout/paper.md +90 -0
- package/src/layout/paper.svelte +45 -0
- package/src/layout/screen.md +28 -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 +3 -0
- package/src/text.md +34 -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
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<script context="module">
|
|
2
|
+
const defs = {
|
|
3
|
+
select: {
|
|
4
|
+
"$select": true,
|
|
5
|
+
"w.min": "35vw",
|
|
6
|
+
grid: true,
|
|
7
|
+
over: "hidden"
|
|
8
|
+
},
|
|
9
|
+
menu: {
|
|
10
|
+
"$menu": true,
|
|
11
|
+
},
|
|
12
|
+
action: {
|
|
13
|
+
"$action": true,
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<script>
|
|
19
|
+
import wsx from "../wsx.mjs"
|
|
20
|
+
|
|
21
|
+
import Paper from "./paper.svelte"
|
|
22
|
+
|
|
23
|
+
export let height
|
|
24
|
+
export let type = "menu"
|
|
25
|
+
|
|
26
|
+
const trick = (node, options) => ({
|
|
27
|
+
delay: 0,
|
|
28
|
+
duration: 250,
|
|
29
|
+
css: () => "",
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
$: container = {
|
|
33
|
+
...defs[type],
|
|
34
|
+
h: (type === "select") ? height : "100%",
|
|
35
|
+
grid: true,
|
|
36
|
+
}
|
|
37
|
+
</script>
|
|
38
|
+
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
39
|
+
<!-- svelte-ignore a11y-interactive-supports-focus -->
|
|
40
|
+
<wind-drawer-container use:wsx={container} on:click|stopPropagation
|
|
41
|
+
role="menubar" transition:trick>
|
|
42
|
+
<Paper {...$$restProps}>
|
|
43
|
+
<slot name="header" slot="header" />
|
|
44
|
+
<slot />
|
|
45
|
+
<slot name="footer" slot="footer" />
|
|
46
|
+
</Paper>
|
|
47
|
+
</wind-drawer-container>
|
|
@@ -0,0 +1,39 @@
|
|
|
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
|
+
<Flex cross="stretch">
|
|
35
|
+
<Text>Content</Text>
|
|
36
|
+
<Text>More content</Text>
|
|
37
|
+
<Text>Event more content</Text>
|
|
38
|
+
<Flex>
|
|
39
|
+
```
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import wsx from "../wsx.mjs"
|
|
3
|
+
|
|
4
|
+
export let direction = false
|
|
5
|
+
export let pad = false
|
|
6
|
+
export let gap = false
|
|
7
|
+
export let cross = "stretch"
|
|
8
|
+
export let main = "start"
|
|
9
|
+
|
|
10
|
+
$: wind = {
|
|
11
|
+
"fl.dir": direction,
|
|
12
|
+
"fl.cross": cross,
|
|
13
|
+
"fl.main": main,
|
|
14
|
+
p: pad,
|
|
15
|
+
gap: gap,
|
|
16
|
+
...$$restProps
|
|
17
|
+
}
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<ws-flex use:wsx={wind}>
|
|
21
|
+
<slot />
|
|
22
|
+
</ws-flex>
|
|
@@ -0,0 +1,57 @@
|
|
|
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
|
+
<Grid cross="stretch">
|
|
53
|
+
<Text>Content</Text>
|
|
54
|
+
<Text>More content</Text>
|
|
55
|
+
<Text>Event more content</Text>
|
|
56
|
+
<Grid>
|
|
57
|
+
```
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import wsx from "../wsx.mjs"
|
|
3
|
+
|
|
4
|
+
export let direction = false
|
|
5
|
+
export let pad = false
|
|
6
|
+
export let gap = false
|
|
7
|
+
export let cols = null
|
|
8
|
+
export let rows = null
|
|
9
|
+
export let autoCol = false
|
|
10
|
+
export let autoRow = false
|
|
11
|
+
|
|
12
|
+
$: wind = {
|
|
13
|
+
"gr.flow": direction,
|
|
14
|
+
"gr.cols": cols?.join?.(" ") ?? cols ?? false,
|
|
15
|
+
"gr.rows": rows?.join?.(" ") ?? rows ?? false,
|
|
16
|
+
"gr.cols.a": autoCol,
|
|
17
|
+
"gr.rows.a": autoRow,
|
|
18
|
+
p: pad,
|
|
19
|
+
gap: gap,
|
|
20
|
+
...$$restProps
|
|
21
|
+
}
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<ws-grid use:wsx={wind}>
|
|
25
|
+
<slot />
|
|
26
|
+
</ws-grid>
|
|
@@ -0,0 +1,47 @@
|
|
|
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
|
+
let dialog = null
|
|
37
|
+
const dialogThing = async () => {
|
|
38
|
+
const value = await dialog.show({ a: 10, b: 12 })
|
|
39
|
+
console.log(value)
|
|
40
|
+
}
|
|
41
|
+
</script>
|
|
42
|
+
|
|
43
|
+
<Modal component={CoolDialog} bind:this={dialog} />
|
|
44
|
+
<Button on:click={dialogThing}>
|
|
45
|
+
Open Dialog
|
|
46
|
+
</Button>
|
|
47
|
+
```
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<script context="module">
|
|
2
|
+
let topClose = null
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<script>
|
|
6
|
+
import { tick } from "svelte"
|
|
7
|
+
|
|
8
|
+
export let component
|
|
9
|
+
|
|
10
|
+
let modalProps = null
|
|
11
|
+
let resolver = null
|
|
12
|
+
let displayed = null
|
|
13
|
+
|
|
14
|
+
const close = (value) => {
|
|
15
|
+
resolver(value)
|
|
16
|
+
resolver = null
|
|
17
|
+
modalProps = null
|
|
18
|
+
visible.checked = false
|
|
19
|
+
if (topClose !== close) {
|
|
20
|
+
return
|
|
21
|
+
}
|
|
22
|
+
topClose = null
|
|
23
|
+
}
|
|
24
|
+
const closeToTop = (value) => {
|
|
25
|
+
topClose(value)
|
|
26
|
+
}
|
|
27
|
+
const cancel = () => displayed.cancel?.()
|
|
28
|
+
|
|
29
|
+
export const show = (props) => new Promise(
|
|
30
|
+
async (resolve) => {
|
|
31
|
+
modalProps = props ?? {}
|
|
32
|
+
resolver = resolve
|
|
33
|
+
topClose = topClose ?? close
|
|
34
|
+
await tick()
|
|
35
|
+
setTimeout(
|
|
36
|
+
() => visible.checked = true,
|
|
37
|
+
0
|
|
38
|
+
)
|
|
39
|
+
}
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
let visible = null
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
<input type="checkbox" bind:this={visible} ws-x="disp[none]" />
|
|
46
|
+
{#if resolver !== null}
|
|
47
|
+
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
48
|
+
<!-- svelte-ignore a11y-no-noninteractive-element-interactions -->
|
|
49
|
+
<ws-modal on:click={cancel} role="dialog">
|
|
50
|
+
<svelte:component
|
|
51
|
+
bind:this={displayed}
|
|
52
|
+
this={component}
|
|
53
|
+
{...modalProps}
|
|
54
|
+
{close}
|
|
55
|
+
{closeToTop}
|
|
56
|
+
/>
|
|
57
|
+
</ws-modal>
|
|
58
|
+
{/if}
|
|
@@ -0,0 +1,90 @@
|
|
|
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
|
+
<Paper>
|
|
61
|
+
<Titlebar slot="header">
|
|
62
|
+
<Text slot="title" title>
|
|
63
|
+
Some Title
|
|
64
|
+
</Text>
|
|
65
|
+
</Titlebar>
|
|
66
|
+
|
|
67
|
+
<div>Content 1</div>
|
|
68
|
+
<div>Content 2</div>
|
|
69
|
+
<div>Content 3</div>
|
|
70
|
+
</Paper>
|
|
71
|
+
<Paper l-pad="0px" m="4px">
|
|
72
|
+
<Titlebar slot="header">
|
|
73
|
+
<Text slot="title" title>
|
|
74
|
+
Some Screen
|
|
75
|
+
</Text>
|
|
76
|
+
</Titlebar>
|
|
77
|
+
|
|
78
|
+
<Paper slot="content">
|
|
79
|
+
<Tabs slot="header" {options} bind:value />
|
|
80
|
+
|
|
81
|
+
<div>Content 1</div>
|
|
82
|
+
<div>Content 2</div>
|
|
83
|
+
<div>Content 3</div>
|
|
84
|
+
</Paper>
|
|
85
|
+
|
|
86
|
+
<div slot="footer">
|
|
87
|
+
Wat
|
|
88
|
+
</div>
|
|
89
|
+
</Paper>
|
|
90
|
+
```
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import Flex from "./flex.svelte"
|
|
3
|
+
import wsx from "../wsx.mjs"
|
|
4
|
+
|
|
5
|
+
export let color
|
|
6
|
+
export let card = false
|
|
7
|
+
export let square = false
|
|
8
|
+
export let layout = Flex
|
|
9
|
+
export let scrollable = true
|
|
10
|
+
|
|
11
|
+
$: props = Object.entries($$restProps).reduce(
|
|
12
|
+
(p, [key, value]) => {
|
|
13
|
+
const [target, name] =
|
|
14
|
+
(key.startsWith("l-") === true)
|
|
15
|
+
? [ p.layout, key.slice(2) ]
|
|
16
|
+
: [ p.paper, key ]
|
|
17
|
+
target[name] = value
|
|
18
|
+
return p
|
|
19
|
+
},
|
|
20
|
+
{ layout: {}, paper: {} }
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
$: layoutProps = {
|
|
24
|
+
over: scrollable ? "auto" : false,
|
|
25
|
+
...props.layout,
|
|
26
|
+
}
|
|
27
|
+
$: wind = {
|
|
28
|
+
"$color": color,
|
|
29
|
+
"$outline": card,
|
|
30
|
+
r: square && "0px",
|
|
31
|
+
...props.paper,
|
|
32
|
+
}
|
|
33
|
+
</script>
|
|
34
|
+
|
|
35
|
+
<ws-paper use:wsx={wind}>
|
|
36
|
+
<slot name="header" />
|
|
37
|
+
{#if $$slots.content}
|
|
38
|
+
<slot name="content" slot="content" />
|
|
39
|
+
{:else}
|
|
40
|
+
<svelte:component this={layout} {...layoutProps} slot="content">
|
|
41
|
+
<slot />
|
|
42
|
+
</svelte:component>
|
|
43
|
+
{/if}
|
|
44
|
+
<slot name="footer" />
|
|
45
|
+
</ws-paper>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Screen
|
|
2
|
+
|
|
3
|
+
The screen is a container component that is used for displaying content
|
|
4
|
+
over its parent and stacks as more screens are displayed. Screens that stack
|
|
5
|
+
on top of a parent screen use the Modal to control when they are shown and
|
|
6
|
+
pass values back from child screens. The stacking effect of the Screen is
|
|
7
|
+
controlled by internally tracked svelte context, so no manual effort is
|
|
8
|
+
required to get stacking screens to have the effect.
|
|
9
|
+
|
|
10
|
+
## Props
|
|
11
|
+
|
|
12
|
+
### width
|
|
13
|
+
`string`
|
|
14
|
+
|
|
15
|
+
The width of the screen before stack-based padding is applied
|
|
16
|
+
|
|
17
|
+
## Example
|
|
18
|
+
`cool-screen.svelte`
|
|
19
|
+
```svelte
|
|
20
|
+
<Screen width="70%">
|
|
21
|
+
<Paper>
|
|
22
|
+
This screen is pretty cool I swear
|
|
23
|
+
<Button on:click={() => close("hi")}>
|
|
24
|
+
Close
|
|
25
|
+
</Button>
|
|
26
|
+
</Paper>
|
|
27
|
+
</Screen>
|
|
28
|
+
```
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<script context="module">
|
|
2
|
+
const ctxStack = Symbol("stack context")
|
|
3
|
+
const ctxClose = Symbol("close context")
|
|
4
|
+
</script>
|
|
5
|
+
|
|
6
|
+
<script>
|
|
7
|
+
import { getContext, setContext } from "svelte"
|
|
8
|
+
import { fly } from "svelte/transition"
|
|
9
|
+
|
|
10
|
+
import wsx from "../wsx.mjs"
|
|
11
|
+
|
|
12
|
+
export let width = false
|
|
13
|
+
|
|
14
|
+
const stack = getContext(ctxStack) ?? 0
|
|
15
|
+
const animation = {
|
|
16
|
+
y: window.innerHeight,
|
|
17
|
+
duration: 350
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
setContext(ctxStack, stack + 1)
|
|
21
|
+
|
|
22
|
+
$: wind = {
|
|
23
|
+
"&stack": stack.toString(),
|
|
24
|
+
"&screen-width": width,
|
|
25
|
+
"bg.c": "transparent",
|
|
26
|
+
...$$restProps
|
|
27
|
+
}
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<ws-screen use:wsx={wind} transition:fly={animation}>
|
|
31
|
+
<slot />
|
|
32
|
+
</ws-screen>
|
package/src/text.md
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Text
|
|
2
|
+
|
|
3
|
+
Simple component with some common props for types of text.
|
|
4
|
+
|
|
5
|
+
## Props
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### adorn
|
|
9
|
+
`bool`
|
|
10
|
+
|
|
11
|
+
Sets `$adorn`
|
|
12
|
+
|
|
13
|
+
### block
|
|
14
|
+
`bool`
|
|
15
|
+
|
|
16
|
+
Sets `block`
|
|
17
|
+
|
|
18
|
+
### subtitle
|
|
19
|
+
`bool`
|
|
20
|
+
|
|
21
|
+
Sets `$subtitle`
|
|
22
|
+
|
|
23
|
+
### title
|
|
24
|
+
`bool`
|
|
25
|
+
|
|
26
|
+
Sets `$title`
|
|
27
|
+
|
|
28
|
+
## Example
|
|
29
|
+
```svelte
|
|
30
|
+
<Text>Some text</Text>
|
|
31
|
+
<Text title>Bigger text</Text>
|
|
32
|
+
<Text subtitle>Smaller text</Text>
|
|
33
|
+
<Text block>Text on its own line</Text>
|
|
34
|
+
```
|
package/src/text.svelte
CHANGED
|
@@ -1,49 +1,20 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
## Usage
|
|
23
|
-
```svelte
|
|
24
|
-
<Text>Some text</Text>
|
|
25
|
-
<Text title>Bigger text</Text>
|
|
26
|
-
<Text subtitle>Smaller text</Text>
|
|
27
|
-
<Text block>Text on its own line</Text>
|
|
28
|
-
```
|
|
29
|
-
*/
|
|
30
|
-
|
|
31
|
-
import wsx from "./wsx.mjs"
|
|
32
|
-
|
|
33
|
-
export let title = false
|
|
34
|
-
export let subtitle = false
|
|
35
|
-
export let block = false
|
|
36
|
-
export let adorn = false
|
|
37
|
-
|
|
38
|
-
$: wind = {
|
|
39
|
-
"$title": title,
|
|
40
|
-
"$subtitle": subtitle,
|
|
41
|
-
"$adorn": adorn,
|
|
42
|
-
block,
|
|
43
|
-
...$$restProps
|
|
44
|
-
}
|
|
45
|
-
</script>
|
|
46
|
-
|
|
47
|
-
<span use:wsx={wind}>
|
|
48
|
-
<slot />
|
|
49
|
-
</span>
|
|
1
|
+
<script>
|
|
2
|
+
import wsx from "./wsx.mjs"
|
|
3
|
+
|
|
4
|
+
export let title = false
|
|
5
|
+
export let subtitle = false
|
|
6
|
+
export let block = false
|
|
7
|
+
export let adorn = false
|
|
8
|
+
|
|
9
|
+
$: wind = {
|
|
10
|
+
"$title": title,
|
|
11
|
+
"$subtitle": subtitle,
|
|
12
|
+
"$adorn": adorn,
|
|
13
|
+
block,
|
|
14
|
+
...$$restProps
|
|
15
|
+
}
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<span use:wsx={wind}>
|
|
19
|
+
<slot />
|
|
20
|
+
</span>
|
package/src/variant.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export default ({ flat, fill, outline }, def = "
|
|
2
|
-
if (outline === true) {
|
|
3
|
-
return "
|
|
4
|
-
}
|
|
5
|
-
if (fill === true) {
|
|
6
|
-
return "
|
|
7
|
-
}
|
|
8
|
-
if (flat === true) {
|
|
9
|
-
return "
|
|
10
|
-
}
|
|
11
|
-
return def
|
|
12
|
-
}
|
|
1
|
+
export default ({ flat, fill, outline }, def = "$flat") => {
|
|
2
|
+
if (outline === true) {
|
|
3
|
+
return "$outline"
|
|
4
|
+
}
|
|
5
|
+
if (fill === true) {
|
|
6
|
+
return "$fill"
|
|
7
|
+
}
|
|
8
|
+
if (flat === true) {
|
|
9
|
+
return "$flat"
|
|
10
|
+
}
|
|
11
|
+
return def
|
|
12
|
+
}
|