@axel669/zephyr 0.4.6 → 0.5.0-alpha.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/package.json +41 -40
- package/src/async/button.svelte +17 -13
- package/src/async/suspend.svelte +38 -0
- package/src/changed.js +10 -0
- package/src/composed/data-table/th.svelte +2 -2
- package/src/composed/data-table.svelte +7 -7
- package/src/composed/entry-button.svelte +13 -16
- package/src/control/button.svelte +26 -22
- package/src/control/input.svelte +52 -50
- package/src/control/label.svelte +28 -24
- package/src/control/link.svelte +36 -30
- package/src/control/radio-group.svelte +13 -10
- package/src/control/select.svelte +21 -16
- package/src/control/tabs.svelte +18 -14
- package/src/control/toggle.svelte +33 -22
- package/src/data-display/avatar.svelte +12 -11
- package/src/data-display/badge.svelte +9 -7
- package/src/data-display/chip.svelte +27 -17
- package/src/data-display/details.svelte +22 -14
- package/src/data-display/popover.svelte +12 -9
- package/src/data-display/progress.svelte +17 -13
- package/src/data-display/table.svelte +24 -16
- package/src/data-display/tooltip.svelte +11 -9
- package/src/dialogs/alert.svelte +19 -12
- package/src/dialogs/confirm.svelte +22 -16
- package/src/{hash.js → hash.svelte.js} +9 -0
- package/src/{index.mjs → index.js} +12 -11
- package/src/{composed/element-toast.svelte → info/element-toaster.svelte} +41 -27
- package/src/info/icon.svelte +4 -4
- package/src/info/titlebar.svelte +20 -14
- package/src/info/toast.svelte +35 -0
- package/src/info/toaster/message.svelte +42 -0
- package/src/info/toaster.svelte +64 -6
- package/src/layout/dialog.svelte +10 -12
- package/src/layout/drawer.svelte +47 -18
- package/src/layout/flex.svelte +13 -11
- package/src/layout/grid.svelte +17 -15
- package/src/layout/modal.svelte +36 -26
- package/src/layout/paper.svelte +42 -33
- package/src/layout/screen.svelte +13 -9
- package/src/props.js +24 -0
- package/src/routing/route.svelte +34 -17
- package/src/routing/{routing.js → routing.svelte.js} +10 -1
- package/src/routing/title.svelte +8 -6
- package/src/spinner/circle-spinner.svelte +10 -8
- package/src/spinner/hexagon-spinner.svelte +10 -8
- package/src/text.svelte +6 -10
- package/src/composed/toast/message.svelte +0 -33
- package/src/composed/toast.svelte +0 -70
- package/src/info/notification.svelte +0 -28
- package/src/inline-dialog.svelte +0 -23
- /package/src/{handler$.mjs → handler$.js} +0 -0
- /package/src/{variant.mjs → variant.js} +0 -0
- /package/src/{wsx.mjs → wsx.js} +0 -0
package/package.json
CHANGED
|
@@ -1,40 +1,41 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@axel669/zephyr",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "",
|
|
5
|
-
"main": "src/index.
|
|
6
|
-
"type": "module",
|
|
7
|
-
"scripts": {
|
|
8
|
-
"site/start": "wrangler pages dev site --port 45067",
|
|
9
|
-
"site/build": "rollup -c docsite/rollup.config.
|
|
10
|
-
"site/watch": "rollup -c docsite/rollup.config.
|
|
11
|
-
},
|
|
12
|
-
"keywords": [],
|
|
13
|
-
"author": "",
|
|
14
|
-
"license": "MIT",
|
|
15
|
-
"dependencies": {
|
|
16
|
-
"@axel669/
|
|
17
|
-
"
|
|
18
|
-
},
|
|
19
|
-
"devDependencies": {
|
|
20
|
-
"@axel669/asuid": "^0.2.1",
|
|
21
|
-
"@axel669/ipsen": "0.4.0-beta.7",
|
|
22
|
-
"@axel669/rollup-
|
|
23
|
-
"@rollup
|
|
24
|
-
"@rollup/plugin-
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"rollup
|
|
30
|
-
"rollup-plugin-
|
|
31
|
-
"svelte": "^
|
|
32
|
-
},
|
|
33
|
-
"files": [
|
|
34
|
-
"src/"
|
|
35
|
-
],
|
|
36
|
-
"imports": {
|
|
37
|
-
"#lib": "./src/index.
|
|
38
|
-
"#comp/*": "./docsite/comp/*.svelte"
|
|
39
|
-
|
|
40
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@axel669/zephyr",
|
|
3
|
+
"version": "0.5.0-alpha.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "src/index.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"site/start": "wrangler pages dev site --port 45067",
|
|
9
|
+
"site/build": "rollup -c docsite/rollup.config.js",
|
|
10
|
+
"site/watch": "rollup -c docsite/rollup.config.js --watch"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [],
|
|
13
|
+
"author": "",
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@axel669/windstorm": "0.5.0",
|
|
17
|
+
"svelte": "^5.9.0"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"@axel669/asuid": "^0.2.1",
|
|
21
|
+
"@axel669/ipsen": "0.4.0-beta.7",
|
|
22
|
+
"@axel669/rollup-copy-static": "^0.2.0",
|
|
23
|
+
"@axel669/rollup-html-input": "^0.1.2",
|
|
24
|
+
"@rollup/plugin-node-resolve": "^15.0.2",
|
|
25
|
+
"@rollup/plugin-terser": "^0.4.0",
|
|
26
|
+
"marked": "^12.0.2",
|
|
27
|
+
"prism-svelte": "^0.5.0",
|
|
28
|
+
"prismjs": "^1.29.0",
|
|
29
|
+
"rollup": "^3.20.2",
|
|
30
|
+
"rollup-plugin-delete": "^2.0.0",
|
|
31
|
+
"rollup-plugin-svelte": "^7.2.2"
|
|
32
|
+
},
|
|
33
|
+
"files": [
|
|
34
|
+
"src/"
|
|
35
|
+
],
|
|
36
|
+
"imports": {
|
|
37
|
+
"#lib": "./src/index.js",
|
|
38
|
+
"#comp/*": "./docsite/comp/*.svelte",
|
|
39
|
+
"#state/*": "./docsite/state/*.js"
|
|
40
|
+
}
|
|
41
|
+
}
|
package/src/async/button.svelte
CHANGED
|
@@ -1,29 +1,33 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import Button from "../control/button.svelte"
|
|
3
3
|
import Spinner from "../spinner/circle-spinner.svelte"
|
|
4
|
+
import { splitProps } from "../props.js"
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
const {
|
|
7
|
+
handler = null,
|
|
8
|
+
disabled,
|
|
9
|
+
...rest
|
|
10
|
+
} = $props()
|
|
8
11
|
|
|
9
|
-
let running = false
|
|
10
|
-
const
|
|
12
|
+
let running = $state(false)
|
|
13
|
+
const onclick = async (evt) => {
|
|
11
14
|
running = true
|
|
12
15
|
await handler(evt)
|
|
13
16
|
running = false
|
|
14
17
|
}
|
|
15
18
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
+
const inactive = $derived(disabled || running)
|
|
20
|
+
const prop = $derived(
|
|
21
|
+
splitProps(rest, "sp!")
|
|
22
|
+
)
|
|
23
|
+
const buttonProps = $derived({
|
|
24
|
+
...prop.rest,
|
|
19
25
|
disabled: inactive,
|
|
20
|
-
}
|
|
26
|
+
})
|
|
21
27
|
</script>
|
|
22
28
|
|
|
23
29
|
<async-button ws-x="[disp inline-grid] [gr.cols 1fr] [pos relative]">
|
|
24
|
-
<Button {...
|
|
25
|
-
<slot />
|
|
26
|
-
</Button>
|
|
30
|
+
<Button {...buttonProps} {onclick} />
|
|
27
31
|
{#if running === true}
|
|
28
32
|
<Spinner
|
|
29
33
|
size="unset"
|
|
@@ -31,7 +35,7 @@
|
|
|
31
35
|
x="50%" y="0px"
|
|
32
36
|
tf="translateX(-50%)"
|
|
33
37
|
h="100%"
|
|
34
|
-
|
|
38
|
+
{...prop["sp!"]}
|
|
35
39
|
/>
|
|
36
40
|
{/if}
|
|
37
41
|
</async-button>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import CircleSpinner from "../spinner/circle-spinner.svelte"
|
|
3
|
+
|
|
4
|
+
const {
|
|
5
|
+
"!component": Component,
|
|
6
|
+
loading,
|
|
7
|
+
error,
|
|
8
|
+
...rest
|
|
9
|
+
} = $props()
|
|
10
|
+
const wait = $derived(
|
|
11
|
+
Promise.all(
|
|
12
|
+
Object.entries(rest).map(
|
|
13
|
+
async (pair) => [pair[0], await pair[1]]
|
|
14
|
+
)
|
|
15
|
+
)
|
|
16
|
+
)
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
{#await wait}
|
|
20
|
+
{#if loading}
|
|
21
|
+
{@render loading()}
|
|
22
|
+
{:else}
|
|
23
|
+
<div ws-x="[flex] [fl-center] [p 4px]">
|
|
24
|
+
<CircleSpinner size="56px" />
|
|
25
|
+
<span>Loading</span>
|
|
26
|
+
</div>
|
|
27
|
+
{/if}
|
|
28
|
+
{:then entries}
|
|
29
|
+
<Component {...Object.fromEntries(entries)} />
|
|
30
|
+
{:catch loadError}
|
|
31
|
+
{#if error}
|
|
32
|
+
{@render error(loadError)}
|
|
33
|
+
{:else}
|
|
34
|
+
<div ws-x="[b 1px solid red] [p 8px]">
|
|
35
|
+
{loadError}
|
|
36
|
+
</div>
|
|
37
|
+
{/if}
|
|
38
|
+
{/await}
|
package/src/changed.js
ADDED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
import Grid from "../../layout/grid.svelte"
|
|
15
15
|
import Icon from "../../info/icon.svelte"
|
|
16
16
|
|
|
17
|
-
import wsx from "../../wsx.
|
|
17
|
+
import wsx from "../../wsx.js"
|
|
18
18
|
import { dtContext } from "../data-table.svelte"
|
|
19
19
|
|
|
20
20
|
export let sort = null
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
</div>
|
|
47
47
|
{:else}
|
|
48
48
|
<Button compact r="0px" fill={$context.fillHeader}
|
|
49
|
-
t.wt="inherit" on:click={setSort} color={$context.color}>
|
|
49
|
+
t.wt="inherit" on:click={setSort} color={$context.color} ground>
|
|
50
50
|
<slot />
|
|
51
51
|
<Icon name={sortIcon} m.l="4px" t.sz="16px" />
|
|
52
52
|
</Button>
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
|
|
49
49
|
import Grid from "../layout/grid.svelte"
|
|
50
50
|
|
|
51
|
-
import wsx from "../wsx.
|
|
52
|
-
import { handler$, eventHandler$ } from "../handler$.
|
|
51
|
+
import wsx from "../wsx.js"
|
|
52
|
+
import { handler$, eventHandler$ } from "../handler$.js"
|
|
53
53
|
|
|
54
54
|
export let color = "@primary"
|
|
55
55
|
export let fillHeader = true
|
|
@@ -157,9 +157,9 @@
|
|
|
157
157
|
}
|
|
158
158
|
</script>
|
|
159
159
|
|
|
160
|
-
<Paper
|
|
160
|
+
<Paper h={height} r="0px">
|
|
161
161
|
<ws-flex use:wsx={content} slot="content" bind:this={scroller}>
|
|
162
|
-
<Table data={rows} {color} {fillHeader}
|
|
162
|
+
<Table data={rows} {color} {fillHeader} b.t.w="2px" {...$$restProps}>
|
|
163
163
|
<tr use:wsx={header} slot="header">
|
|
164
164
|
<slot name="header">
|
|
165
165
|
<th>No Header Defined</th>
|
|
@@ -174,12 +174,12 @@
|
|
|
174
174
|
</Table>
|
|
175
175
|
</ws-flex>
|
|
176
176
|
<Grid slot="footer" gr.cols="min-content min-content min-content 1fr"
|
|
177
|
-
rows="32px" b="1px solid
|
|
177
|
+
rows="32px" b="1px solid {color}" b.b.w="2px">
|
|
178
178
|
{#if pageCount > 0}
|
|
179
|
-
<Button on:click={prev} disabled={page === 0}>
|
|
179
|
+
<Button on:click={prev} disabled={page === 0} ground>
|
|
180
180
|
<Icon name="caret-left" />
|
|
181
181
|
</Button>
|
|
182
|
-
<Button on:click={next} disabled={page === maxPage}>
|
|
182
|
+
<Button on:click={next} disabled={page === maxPage} ground>
|
|
183
183
|
<Icon name="caret-right" />
|
|
184
184
|
</Button>
|
|
185
185
|
<Text adorn t.ws="nowrap">
|
|
@@ -1,31 +1,28 @@
|
|
|
1
|
-
<svelte:options immutable />
|
|
2
|
-
|
|
3
1
|
<script>
|
|
4
|
-
import { createEventDispatcher } from "svelte"
|
|
5
|
-
|
|
6
2
|
import Button from "../control/button.svelte"
|
|
7
3
|
import Modal from "../layout/modal.svelte"
|
|
8
|
-
import { handler$ } from "../handler$.
|
|
9
|
-
|
|
10
|
-
export let component
|
|
11
|
-
export let props
|
|
12
|
-
let wrapper = Modal
|
|
13
|
-
export { wrapper as this }
|
|
4
|
+
import { handler$ } from "../handler$.js"
|
|
14
5
|
|
|
15
|
-
const
|
|
6
|
+
const {
|
|
7
|
+
component,
|
|
8
|
+
props,
|
|
9
|
+
this:Wrapper = Modal,
|
|
10
|
+
"w!props":wrapperProps = {},
|
|
11
|
+
children,
|
|
12
|
+
onentry,
|
|
13
|
+
...rest
|
|
14
|
+
} = $props()
|
|
16
15
|
|
|
17
16
|
let element = null
|
|
18
17
|
const open = handler$(
|
|
19
18
|
async (props) => {
|
|
20
19
|
const elemProps = (typeof props === "function") ? props() : props
|
|
21
20
|
const result = await element.show(elemProps)
|
|
22
|
-
|
|
21
|
+
onentry?.(result)
|
|
23
22
|
}
|
|
24
23
|
)
|
|
25
24
|
</script>
|
|
26
25
|
|
|
27
|
-
<Button {
|
|
28
|
-
<slot />
|
|
29
|
-
</Button>
|
|
26
|
+
<Button {...rest} onclick={open(props)} {children} />
|
|
30
27
|
|
|
31
|
-
<
|
|
28
|
+
<Wrapper bind:this={element} {...rest} {component} />
|
|
@@ -1,35 +1,39 @@
|
|
|
1
|
-
<svelte:options immutable />
|
|
2
|
-
|
|
3
1
|
<script>
|
|
4
|
-
import wsx from "../wsx.
|
|
5
|
-
import variant from "../variant.
|
|
2
|
+
import wsx from "../wsx.js"
|
|
3
|
+
import variant from "../variant.js"
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
const {
|
|
6
|
+
color = false,
|
|
7
|
+
compact = false,
|
|
8
|
+
ground = false,
|
|
9
|
+
disabled,
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
fill = false,
|
|
12
|
+
outline = false,
|
|
13
|
+
flat = false,
|
|
14
|
+
children,
|
|
15
|
+
onclick,
|
|
16
|
+
...rest
|
|
17
|
+
} = $props()
|
|
15
18
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
const type = $derived(
|
|
20
|
+
variant(
|
|
21
|
+
"$flat",
|
|
22
|
+
{ fill },
|
|
23
|
+
{ outline },
|
|
24
|
+
{ flat }
|
|
25
|
+
)
|
|
22
26
|
)
|
|
23
27
|
|
|
24
|
-
|
|
28
|
+
const wind = $derived({
|
|
25
29
|
[type]: true,
|
|
26
30
|
"$color": color,
|
|
27
31
|
$compact: compact,
|
|
28
32
|
$ground: ground,
|
|
29
|
-
|
|
30
|
-
}
|
|
33
|
+
...rest
|
|
34
|
+
})
|
|
31
35
|
</script>
|
|
32
36
|
|
|
33
|
-
<button use:wsx={wind} {disabled}
|
|
34
|
-
|
|
37
|
+
<button use:wsx={wind} {disabled} {onclick}>
|
|
38
|
+
{@render children?.()}
|
|
35
39
|
</button>
|
package/src/control/input.svelte
CHANGED
|
@@ -1,23 +1,31 @@
|
|
|
1
|
-
<svelte:options immutable />
|
|
2
|
-
|
|
3
1
|
<script>
|
|
4
|
-
import wsx, { none } from "../wsx.
|
|
5
|
-
import variant from "../variant.
|
|
2
|
+
import wsx, { none } from "../wsx.js"
|
|
3
|
+
import variant from "../variant.js"
|
|
4
|
+
import { splitProps } from "../props.js"
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
type = "text",
|
|
8
|
+
|
|
9
|
+
flat = false,
|
|
10
|
+
lined = false,
|
|
11
|
+
linedFill = false,
|
|
12
|
+
outline = false,
|
|
13
|
+
label,
|
|
14
|
+
color = "@default",
|
|
15
|
+
disabled,
|
|
6
16
|
|
|
7
|
-
|
|
17
|
+
value = $bindable(""),
|
|
18
|
+
autocompleteOptions = null,
|
|
8
19
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
export let outline = false
|
|
13
|
-
export let label
|
|
14
|
-
export let color = "@default"
|
|
15
|
-
export let disabled
|
|
20
|
+
start,
|
|
21
|
+
end,
|
|
22
|
+
extra,
|
|
16
23
|
|
|
17
|
-
|
|
18
|
-
|
|
24
|
+
oninput,
|
|
25
|
+
...rest
|
|
26
|
+
} = $props()
|
|
19
27
|
|
|
20
|
-
let input = null
|
|
28
|
+
let input = $state(null)
|
|
21
29
|
export const focus = () => input.focus()
|
|
22
30
|
|
|
23
31
|
const id =
|
|
@@ -25,37 +33,33 @@
|
|
|
25
33
|
? null
|
|
26
34
|
: `${Math.random().toString(16)}_${Date.now()}`
|
|
27
35
|
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
$: restKeys = Object.keys($$restProps)
|
|
31
|
-
$: props = restKeys.reduce(
|
|
32
|
-
(props, key) => {
|
|
33
|
-
const [target, name] =
|
|
34
|
-
(key.startsWith("i-") === true)
|
|
35
|
-
? [props.input, key.slice(2)]
|
|
36
|
-
: [props.wind, key]
|
|
37
|
-
target[name] = $$restProps[key]
|
|
38
|
-
return props
|
|
39
|
-
},
|
|
40
|
-
{wind: {}, input: {}}
|
|
41
|
-
)
|
|
36
|
+
const prop = splitProps(rest, "i!")
|
|
42
37
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
38
|
+
const variantStyle = $derived(
|
|
39
|
+
variant(
|
|
40
|
+
none,
|
|
41
|
+
{ outline },
|
|
42
|
+
{ linedFill },
|
|
43
|
+
{ lined },
|
|
44
|
+
{ flat }
|
|
45
|
+
)
|
|
49
46
|
)
|
|
50
47
|
|
|
51
|
-
|
|
48
|
+
const wind = $derived({
|
|
52
49
|
[variantStyle]: true,
|
|
53
50
|
"@@control": true,
|
|
54
51
|
"$color": color,
|
|
55
|
-
...
|
|
56
|
-
}
|
|
52
|
+
...prop.rest,
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
const tag = $derived(
|
|
56
|
+
(type === "area") ? "textarea" : "input"
|
|
57
|
+
)
|
|
57
58
|
|
|
58
|
-
|
|
59
|
+
const update = (evt) => {
|
|
60
|
+
value = evt.target.value
|
|
61
|
+
oninput?.(evt)
|
|
62
|
+
}
|
|
59
63
|
</script>
|
|
60
64
|
|
|
61
65
|
<label use:wsx={wind}>
|
|
@@ -64,37 +68,35 @@
|
|
|
64
68
|
{/if}
|
|
65
69
|
<svelte:element
|
|
66
70
|
this={tag}
|
|
67
|
-
{...
|
|
71
|
+
{...prop.input}
|
|
68
72
|
{disabled}
|
|
69
73
|
{type}
|
|
70
74
|
{value}
|
|
75
|
+
oninput={update}
|
|
71
76
|
list={id}
|
|
72
|
-
on:focus
|
|
73
|
-
on:blur
|
|
74
|
-
on:input={update}
|
|
75
77
|
bind:this={input}
|
|
76
78
|
/>
|
|
77
79
|
|
|
78
|
-
{#if
|
|
80
|
+
{#if start}
|
|
79
81
|
<span use:wsx={{ "$start": true }}>
|
|
80
|
-
|
|
82
|
+
{@render start()}
|
|
81
83
|
</span>
|
|
82
84
|
{/if}
|
|
83
|
-
{#if
|
|
85
|
+
{#if end}
|
|
84
86
|
<span use:wsx={{ "$end": true }}>
|
|
85
|
-
|
|
87
|
+
{@render end()}
|
|
86
88
|
</span>
|
|
87
89
|
{/if}
|
|
88
|
-
{#if
|
|
90
|
+
{#if extra}
|
|
89
91
|
<span use:wsx={{ "$extra": true }}>
|
|
90
|
-
|
|
92
|
+
{@render extra()}
|
|
91
93
|
</span>
|
|
92
94
|
{/if}
|
|
93
95
|
|
|
94
96
|
{#if autocompleteOptions !== null}
|
|
95
97
|
<datalist {id}>
|
|
96
98
|
{#each autocompleteOptions as value}
|
|
97
|
-
<option {value}
|
|
99
|
+
<option {value}>{value}</option>
|
|
98
100
|
{/each}
|
|
99
101
|
</datalist>
|
|
100
102
|
{/if}
|
package/src/control/label.svelte
CHANGED
|
@@ -1,29 +1,32 @@
|
|
|
1
|
-
<svelte:options immutable />
|
|
2
|
-
|
|
3
1
|
<script>
|
|
4
|
-
import wsx from "../wsx.
|
|
5
|
-
import variant from "../variant.
|
|
2
|
+
import wsx from "../wsx.js"
|
|
3
|
+
import variant from "../variant.js"
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
const {
|
|
6
|
+
color = false,
|
|
7
|
+
compact = false,
|
|
8
|
+
ground = false,
|
|
9
|
+
disabled,
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
button = false,
|
|
12
|
+
fill = false,
|
|
13
|
+
outline = false,
|
|
14
|
+
flat = false,
|
|
15
|
+
for:_for = "",
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
children,
|
|
18
|
+
...rest
|
|
19
|
+
} = $props()
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
const type = $derived(
|
|
22
|
+
variant(
|
|
23
|
+
"$flat",
|
|
24
|
+
{ fill },
|
|
25
|
+
{ outline },
|
|
26
|
+
{ flat }
|
|
27
|
+
)
|
|
25
28
|
)
|
|
26
|
-
|
|
29
|
+
const baseStyles = $derived(
|
|
27
30
|
(button === true)
|
|
28
31
|
? {
|
|
29
32
|
"@@button": true,
|
|
@@ -33,13 +36,14 @@
|
|
|
33
36
|
$ground: ground,
|
|
34
37
|
}
|
|
35
38
|
: {}
|
|
39
|
+
)
|
|
36
40
|
|
|
37
|
-
|
|
41
|
+
const wind = $derived({
|
|
38
42
|
...baseStyles,
|
|
39
|
-
|
|
40
|
-
}
|
|
43
|
+
...rest
|
|
44
|
+
})
|
|
41
45
|
</script>
|
|
42
46
|
|
|
43
47
|
<label use:wsx={wind} {disabled} for={_for}>
|
|
44
|
-
|
|
48
|
+
{@render children?.()}
|
|
45
49
|
</label>
|
package/src/control/link.svelte
CHANGED
|
@@ -1,41 +1,47 @@
|
|
|
1
|
-
<svelte:options immutable />
|
|
2
|
-
|
|
3
1
|
<script>
|
|
4
|
-
import wsx from "../wsx.
|
|
5
|
-
import variant from "../variant.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
2
|
+
import wsx from "../wsx.js"
|
|
3
|
+
import variant from "../variant.js"
|
|
4
|
+
|
|
5
|
+
const {
|
|
6
|
+
button = false,
|
|
7
|
+
color = false,
|
|
8
|
+
compact = false,
|
|
9
|
+
ground = false,
|
|
10
|
+
|
|
11
|
+
href = "",
|
|
12
|
+
rel = "noreferrer",
|
|
13
|
+
target = null,
|
|
14
|
+
|
|
15
|
+
fill = false,
|
|
16
|
+
outline = false,
|
|
17
|
+
flat = false,
|
|
18
|
+
|
|
19
|
+
disabled = null,
|
|
20
|
+
|
|
21
|
+
onclick,
|
|
22
|
+
children,
|
|
23
|
+
...rest
|
|
24
|
+
} = $props()
|
|
25
|
+
|
|
26
|
+
const type = $derived(
|
|
27
|
+
variant(
|
|
28
|
+
"$flat",
|
|
29
|
+
{ fill },
|
|
30
|
+
{ outline },
|
|
31
|
+
{ flat }
|
|
32
|
+
)
|
|
27
33
|
)
|
|
28
34
|
|
|
29
|
-
|
|
35
|
+
const wind = $derived({
|
|
30
36
|
"@@button": button,
|
|
31
37
|
[type]: true,
|
|
32
38
|
"$color": color,
|
|
33
39
|
$compact: compact,
|
|
34
40
|
$ground: ground,
|
|
35
|
-
|
|
36
|
-
}
|
|
41
|
+
...rest
|
|
42
|
+
})
|
|
37
43
|
</script>
|
|
38
44
|
|
|
39
|
-
<a {href} {target} {rel} disabled={disabled || null} use:wsx={wind}
|
|
40
|
-
|
|
45
|
+
<a {href} {target} {rel} disabled={disabled || null} use:wsx={wind} {onclick}>
|
|
46
|
+
{@render children?.()}
|
|
41
47
|
</a>
|