@axel669/zephyr 0.5.5 → 1.0.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/package.json +48 -42
- package/readme.md +0 -44
- package/src/changed.svelte.js +23 -0
- package/src/component/adorn.svelte +9 -0
- package/src/component/alert.svelte +32 -0
- package/src/component/application.svelte +17 -0
- package/src/component/async-button.svelte +53 -0
- package/src/component/avatar.svelte +15 -0
- package/src/component/badge.svelte +7 -0
- package/src/component/button.svelte +7 -0
- package/src/component/chip.svelte +10 -0
- package/src/component/circle-spinner.svelte +6 -0
- package/src/component/confirm.svelte +40 -0
- package/src/component/control-label.svelte +41 -0
- package/src/component/data-table.svelte +227 -0
- package/src/component/details.svelte +22 -0
- package/src/component/dialog-element.svelte +35 -0
- package/src/component/dialog.svelte +43 -0
- package/src/component/drawer.svelte +20 -0
- package/src/component/flex.svelte +7 -0
- package/src/component/grid.svelte +7 -0
- package/src/component/hexagon-spinner.svelte +6 -0
- package/src/component/icon.svelte +7 -0
- package/src/component/link.svelte +11 -0
- package/src/component/modal.svelte +32 -0
- package/src/component/paper.svelte +33 -0
- package/src/component/popover.svelte +19 -0
- package/src/component/progress.svelte +6 -0
- package/src/component/prompt.svelte +58 -0
- package/src/{routing → component}/routing.svelte.js +4 -6
- package/src/component/screen.svelte +30 -0
- package/src/component/select.svelte +40 -0
- package/src/{async → component}/suspend.svelte +14 -8
- package/src/component/table.svelte +49 -0
- package/src/component/tabs.svelte +2 -0
- package/src/component/text.svelte +26 -0
- package/src/component/titlebar.svelte +23 -0
- package/src/component/toast.svelte +7 -0
- package/src/component/toaster.svelte +60 -0
- package/src/component/toggle-label.svelte +11 -0
- package/src/component/tooltip.svelte +11 -0
- package/src/custom-macros.js +11 -9
- package/src/main.js +47 -0
- package/src/ws.js +10 -0
- package/src/async/button.svelte +0 -41
- package/src/changed.js +0 -10
- package/src/composed/data-table/th.svelte +0 -61
- package/src/composed/data-table.svelte +0 -174
- package/src/composed/entry-button.svelte +0 -29
- package/src/composed/form.svelte +0 -60
- package/src/composed/table-functions.js +0 -15
- package/src/control/button.svelte +0 -39
- package/src/control/input.svelte +0 -103
- package/src/control/label.svelte +0 -49
- package/src/control/link.svelte +0 -47
- package/src/control/radio-group.svelte +0 -24
- package/src/control/select.svelte +0 -69
- package/src/control/tabs.svelte +0 -35
- package/src/control/toggle.svelte +0 -60
- package/src/data-display/avatar.svelte +0 -29
- package/src/data-display/badge.svelte +0 -16
- package/src/data-display/chip.svelte +0 -38
- package/src/data-display/details.svelte +0 -33
- package/src/data-display/popover.svelte +0 -28
- package/src/data-display/progress.svelte +0 -25
- package/src/data-display/table.svelte +0 -50
- package/src/data-display/tooltip.svelte +0 -19
- package/src/dialogs/alert.svelte +0 -41
- package/src/dialogs/confirm.svelte +0 -52
- package/src/dialogs/prompt.svelte +0 -67
- package/src/info/element-toaster.svelte +0 -110
- package/src/info/icon.svelte +0 -9
- package/src/info/titlebar.svelte +0 -40
- package/src/info/toast.svelte +0 -35
- package/src/info/toaster/message.svelte +0 -42
- package/src/info/toaster.svelte +0 -72
- package/src/layout/dialog.svelte +0 -25
- package/src/layout/drawer.svelte +0 -70
- package/src/layout/flex.svelte +0 -24
- package/src/layout/grid.svelte +0 -32
- package/src/layout/modal.svelte +0 -71
- package/src/layout/paper.svelte +0 -54
- package/src/layout/screen.svelte +0 -38
- package/src/spinner/circle-spinner.svelte +0 -18
- package/src/spinner/hexagon-spinner.svelte +0 -18
- package/src/text.svelte +0 -16
- package/src/wsx.js +0 -29
- /package/src/{routing → component}/route.svelte +0 -0
- /package/src/{routing → component}/title.svelte +0 -0
package/src/main.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export { ws, wsAttr } from "./ws.js"
|
|
2
|
+
export { hash } from "./hash.js"
|
|
3
|
+
export { resolve, relpath, stackStore } from "./component/routing.svelte.js"
|
|
4
|
+
|
|
5
|
+
window.fdebug = ([name]) =>
|
|
6
|
+
(func) =>
|
|
7
|
+
(...args) => {
|
|
8
|
+
console.log(name)
|
|
9
|
+
func(...args)
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { default as Adorn } from "./component/adorn.svelte"
|
|
13
|
+
export { default as Alert } from "./component/alert.svelte"
|
|
14
|
+
export { default as Application } from "./component/application.svelte"
|
|
15
|
+
export { default as AsyncButton } from "./component/async-button.svelte"
|
|
16
|
+
export { default as Avatar } from "./component/avatar.svelte"
|
|
17
|
+
export { default as Badge } from "./component/badge.svelte"
|
|
18
|
+
export { default as Button } from "./component/button.svelte"
|
|
19
|
+
export { default as Chip } from "./component/chip.svelte"
|
|
20
|
+
export { default as CircleSpinner } from "./component/circle-spinner.svelte"
|
|
21
|
+
export { default as Confirm } from "./component/confirm.svelte"
|
|
22
|
+
export { default as ControlLabel } from "./component/control-label.svelte"
|
|
23
|
+
export { default as DataTable } from "./component/data-table.svelte"
|
|
24
|
+
export { default as Details } from "./component/details.svelte"
|
|
25
|
+
export { default as Dialog, showDialog } from "./component/dialog.svelte"
|
|
26
|
+
export { default as Drawer } from "./component/drawer.svelte"
|
|
27
|
+
export { default as Flex } from "./component/flex.svelte"
|
|
28
|
+
export { default as Grid } from "./component/grid.svelte"
|
|
29
|
+
export { default as HexagonSpinner } from "./component/hexagon-spinner.svelte"
|
|
30
|
+
export { default as Icon } from "./component/icon.svelte"
|
|
31
|
+
export { default as Link } from "./component/link.svelte"
|
|
32
|
+
export { default as Modal } from "./component/modal.svelte"
|
|
33
|
+
export { default as Paper } from "./component/paper.svelte"
|
|
34
|
+
export { default as Popover } from "./component/popover.svelte"
|
|
35
|
+
export { default as Progress } from "./component/progress.svelte"
|
|
36
|
+
export { default as Prompt } from "./component/prompt.svelte"
|
|
37
|
+
export { default as Route } from "./component/route.svelte"
|
|
38
|
+
export { default as Screen } from "./component/screen.svelte"
|
|
39
|
+
export { default as Select } from "./component/select.svelte"
|
|
40
|
+
export { default as Suspend } from "./component/suspend.svelte"
|
|
41
|
+
export { default as Table } from "./component/table.svelte"
|
|
42
|
+
export { default as Text } from "./component/text.svelte"
|
|
43
|
+
export { default as Titlebar } from "./component/titlebar.svelte"
|
|
44
|
+
export { default as Toast } from "./component/toast.svelte"
|
|
45
|
+
export { default as Toaster, showToast } from "./component/toaster.svelte"
|
|
46
|
+
export { default as ToggleLabel } from "./component/toggle-label.svelte"
|
|
47
|
+
export { default as Tooltip } from "./component/tooltip.svelte"
|
package/src/ws.js
ADDED
package/src/async/button.svelte
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import Button from "../control/button.svelte"
|
|
3
|
-
import Spinner from "../spinner/circle-spinner.svelte"
|
|
4
|
-
import { splitProps } from "../props.js"
|
|
5
|
-
|
|
6
|
-
const {
|
|
7
|
-
handler = null,
|
|
8
|
-
disabled,
|
|
9
|
-
...rest
|
|
10
|
-
} = $props()
|
|
11
|
-
|
|
12
|
-
let running = $state(false)
|
|
13
|
-
const onclick = async (evt) => {
|
|
14
|
-
running = true
|
|
15
|
-
await handler(evt)
|
|
16
|
-
running = false
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const inactive = $derived(disabled || running)
|
|
20
|
-
const prop = $derived(
|
|
21
|
-
splitProps(rest, "sp!")
|
|
22
|
-
)
|
|
23
|
-
const buttonProps = $derived({
|
|
24
|
-
...prop.rest,
|
|
25
|
-
disabled: inactive,
|
|
26
|
-
})
|
|
27
|
-
</script>
|
|
28
|
-
|
|
29
|
-
<async-button ws-x="[disp inline-grid] [gr.cols 1fr] [pos relative]">
|
|
30
|
-
<Button {...buttonProps} {onclick} />
|
|
31
|
-
{#if running === true}
|
|
32
|
-
<Spinner
|
|
33
|
-
size="unset"
|
|
34
|
-
pos="absolute"
|
|
35
|
-
x="50%" y="0px"
|
|
36
|
-
tf="translateX(-50%)"
|
|
37
|
-
h="100%"
|
|
38
|
-
{...prop["sp!"]}
|
|
39
|
-
/>
|
|
40
|
-
{/if}
|
|
41
|
-
</async-button>
|
package/src/changed.js
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
<svelte:options immutable />
|
|
2
|
-
|
|
3
|
-
<script context="module">
|
|
4
|
-
const sortIcons = {
|
|
5
|
-
"asc": "arrow-up",
|
|
6
|
-
"desc": "arrow-down",
|
|
7
|
-
}
|
|
8
|
-
</script>
|
|
9
|
-
|
|
10
|
-
<script>
|
|
11
|
-
import { getContext } from "svelte"
|
|
12
|
-
|
|
13
|
-
import Button from "../../control/button.svelte"
|
|
14
|
-
import Grid from "../../layout/grid.svelte"
|
|
15
|
-
import Icon from "../../info/icon.svelte"
|
|
16
|
-
|
|
17
|
-
import wsx from "../../wsx.js"
|
|
18
|
-
import { dtContext } from "../data-table.svelte"
|
|
19
|
-
|
|
20
|
-
export let sort = null
|
|
21
|
-
export let filter = null
|
|
22
|
-
|
|
23
|
-
const context = getContext(dtContext)
|
|
24
|
-
|
|
25
|
-
const setSort = () => $context.updateSort(sort)
|
|
26
|
-
|
|
27
|
-
let value = ""
|
|
28
|
-
$: $context.updateFilter(filter, value)
|
|
29
|
-
|
|
30
|
-
$: wind = {
|
|
31
|
-
...$$restProps,
|
|
32
|
-
p: "0px",
|
|
33
|
-
sel: "none"
|
|
34
|
-
}
|
|
35
|
-
$: sortIcon =
|
|
36
|
-
($context.sorting.base === sort)
|
|
37
|
-
? sortIcons[$context.sorting.direction]
|
|
38
|
-
: "arrow-down-up"
|
|
39
|
-
</script>
|
|
40
|
-
|
|
41
|
-
<th use:wsx={wind} style="vertical-align: top;">
|
|
42
|
-
<Grid rows="40px min-content" p="0px" gap="0px">
|
|
43
|
-
{#if sort === null}
|
|
44
|
-
<div ws-x="[flex] [fl.cross center] [fl.main center]">
|
|
45
|
-
<slot />
|
|
46
|
-
</div>
|
|
47
|
-
{:else}
|
|
48
|
-
<Button compact r="0px" fill={$context.fillHeader}
|
|
49
|
-
t.wt="inherit" on:click={setSort} color={$context.color} ground>
|
|
50
|
-
<slot />
|
|
51
|
-
<Icon name={sortIcon} m.l="4px" t.sz="16px" />
|
|
52
|
-
</Button>
|
|
53
|
-
{/if}
|
|
54
|
-
{#if filter !== null}
|
|
55
|
-
<Grid gap="0px" p="0px" cols="min-content 1fr">
|
|
56
|
-
<Icon name="filter" />
|
|
57
|
-
<input type="text" ws-x="[w.min 20px] [outln:focus none]" bind:value />
|
|
58
|
-
</Grid>
|
|
59
|
-
{/if}
|
|
60
|
-
</Grid>
|
|
61
|
-
</th>
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
<script module>
|
|
2
|
-
const itemRange = (info) => {
|
|
3
|
-
const {
|
|
4
|
-
scrollPos,
|
|
5
|
-
scrollMax,
|
|
6
|
-
rowSize,
|
|
7
|
-
length,
|
|
8
|
-
containerHeight,
|
|
9
|
-
} = info
|
|
10
|
-
if (scrollMax === null) {
|
|
11
|
-
return [0, 0]
|
|
12
|
-
}
|
|
13
|
-
const displayed = Math.ceil(containerHeight / rowSize) - 1
|
|
14
|
-
const itemPos = Math.floor(
|
|
15
|
-
(scrollPos / scrollMax) * (length - displayed)
|
|
16
|
-
)
|
|
17
|
-
return [
|
|
18
|
-
itemPos - 1,
|
|
19
|
-
itemPos + displayed + 1,
|
|
20
|
-
displayed + 2,
|
|
21
|
-
]
|
|
22
|
-
}
|
|
23
|
-
const emptyRow = Symbol("empty row")
|
|
24
|
-
const nullRow = Symbol("null row")
|
|
25
|
-
|
|
26
|
-
const sliceData = (data, range) => {
|
|
27
|
-
const displayed = data.slice(
|
|
28
|
-
Math.max(range[0], 0),
|
|
29
|
-
range[1]
|
|
30
|
-
)
|
|
31
|
-
if (range[0] === -1) {
|
|
32
|
-
return [emptyRow, ...displayed]
|
|
33
|
-
}
|
|
34
|
-
if (displayed.length < range[2]) {
|
|
35
|
-
return [
|
|
36
|
-
...displayed,
|
|
37
|
-
...Array.from(
|
|
38
|
-
{ length: range[2] - displayed.length },
|
|
39
|
-
() => nullRow
|
|
40
|
-
)
|
|
41
|
-
]
|
|
42
|
-
}
|
|
43
|
-
return displayed
|
|
44
|
-
}
|
|
45
|
-
</script>
|
|
46
|
-
|
|
47
|
-
<script>
|
|
48
|
-
import { on } from "svelte/events"
|
|
49
|
-
|
|
50
|
-
import Grid from "../layout/grid.svelte"
|
|
51
|
-
|
|
52
|
-
import wsx from "../wsx.js"
|
|
53
|
-
|
|
54
|
-
const {
|
|
55
|
-
data,
|
|
56
|
-
rowSize = 40,
|
|
57
|
-
headerSize = rowSize,
|
|
58
|
-
cols = "1fr",
|
|
59
|
-
gap = 2,
|
|
60
|
-
colGap = gap,
|
|
61
|
-
rowGap = gap,
|
|
62
|
-
header,
|
|
63
|
-
row,
|
|
64
|
-
color,
|
|
65
|
-
fillHeader = false,
|
|
66
|
-
...rest
|
|
67
|
-
} = $props()
|
|
68
|
-
|
|
69
|
-
const rowPx = rowSize + rowGap
|
|
70
|
-
const height = $derived(
|
|
71
|
-
rowPx * data.length - rowGap
|
|
72
|
-
)
|
|
73
|
-
const tableHeight = $derived(height + rowPx)
|
|
74
|
-
|
|
75
|
-
let scrollPos = $state(0)
|
|
76
|
-
let scrollMax = $state(null)
|
|
77
|
-
let containerHeight = $state(null)
|
|
78
|
-
const scrollHandler = (evt) => {
|
|
79
|
-
scrollPos = container.scrollTop
|
|
80
|
-
}
|
|
81
|
-
const range = $derived(
|
|
82
|
-
itemRange({
|
|
83
|
-
scrollPos,
|
|
84
|
-
scrollMax,
|
|
85
|
-
containerHeight,
|
|
86
|
-
rowSize: rowSize + rowGap,
|
|
87
|
-
length: data.length,
|
|
88
|
-
})
|
|
89
|
-
)
|
|
90
|
-
let container = $state(null)
|
|
91
|
-
|
|
92
|
-
$effect(() => {
|
|
93
|
-
containerHeight = container.clientHeight
|
|
94
|
-
scrollMax = container.scrollHeight - containerHeight
|
|
95
|
-
on(container, "scroll", scrollHandler, { passive: true })
|
|
96
|
-
const observer = new ResizeObserver(
|
|
97
|
-
() => {
|
|
98
|
-
containerHeight = container.clientHeight
|
|
99
|
-
scrollMax = container.scrollHeight - containerHeight
|
|
100
|
-
}
|
|
101
|
-
)
|
|
102
|
-
observer.observe(container)
|
|
103
|
-
return () => observer.unobserve(container)
|
|
104
|
-
})
|
|
105
|
-
|
|
106
|
-
const displayed = $derived(range[2])
|
|
107
|
-
const displayedRows = $derived(
|
|
108
|
-
sliceData(data, range)
|
|
109
|
-
)
|
|
110
|
-
const tbodyHeight = $derived(displayRows.length * rowSize)
|
|
111
|
-
|
|
112
|
-
const tableWSX = $derived({
|
|
113
|
-
"$fill-header": fillHeader,
|
|
114
|
-
$color: color,
|
|
115
|
-
"gr.cols": cols,
|
|
116
|
-
"gap.col": `${colGap}px`,
|
|
117
|
-
"gap.row": `${rowGap}px`,
|
|
118
|
-
"@header-size": `${headerSize}px`,
|
|
119
|
-
"@row-size": `${rowSize}px`,
|
|
120
|
-
"$sticky-header": true,
|
|
121
|
-
w: "100%",
|
|
122
|
-
h: `${tableHeight}px`,
|
|
123
|
-
over: "visible",
|
|
124
|
-
con: "paint",
|
|
125
|
-
})
|
|
126
|
-
const tbodyWSX = $derived({
|
|
127
|
-
disp: "grid",
|
|
128
|
-
"gr.rows": "subgrid",
|
|
129
|
-
"gr.cols": "subgrid",
|
|
130
|
-
row: `span ${displayed}`,
|
|
131
|
-
tf: `translateY(${range[0] * rowPx}px)`,
|
|
132
|
-
})
|
|
133
|
-
const footerWSX = $derived({
|
|
134
|
-
h: "40px",
|
|
135
|
-
bg: "@background-element",
|
|
136
|
-
$color: color,
|
|
137
|
-
"b.y": "2px solid @ripple-base-color",
|
|
138
|
-
disp: "flex",
|
|
139
|
-
"fl-center": true,
|
|
140
|
-
})
|
|
141
|
-
|
|
142
|
-
const show = $derived({
|
|
143
|
-
start: Math.max(1, range[0] + 2),
|
|
144
|
-
end: Math.min(data.length, range[1] - 1),
|
|
145
|
-
total: data.length,
|
|
146
|
-
})
|
|
147
|
-
</script>
|
|
148
|
-
|
|
149
|
-
<Grid cols="1fr" rows="1fr min-content" pos="relative" {...rest} gap="0px">
|
|
150
|
-
<div ws-x="[over auto]" bind:this={container}>
|
|
151
|
-
<table use:wsx={tableWSX}>
|
|
152
|
-
<thead>
|
|
153
|
-
{@render header()}
|
|
154
|
-
</thead>
|
|
155
|
-
<tbody use:wsx={tbodyWSX}>
|
|
156
|
-
{#each displayedRows as dataRow}
|
|
157
|
-
{#if dataRow === nullRow}
|
|
158
|
-
<tr>
|
|
159
|
-
<td ws-x="[col 1 / -1]"></td>
|
|
160
|
-
</tr>
|
|
161
|
-
{:else if dataRow === emptyRow}
|
|
162
|
-
<tr></tr>
|
|
163
|
-
{:else}
|
|
164
|
-
{@render row(dataRow)}
|
|
165
|
-
{/if}
|
|
166
|
-
{/each}
|
|
167
|
-
</tbody>
|
|
168
|
-
</table>
|
|
169
|
-
</div>
|
|
170
|
-
|
|
171
|
-
<div use:wsx={footerWSX}>
|
|
172
|
-
Showing: {show.start} - {show.end} of {show.total}
|
|
173
|
-
</div>
|
|
174
|
-
</Grid>
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import Button from "../control/button.svelte"
|
|
3
|
-
import Modal from "../layout/modal.svelte"
|
|
4
|
-
import { handler$ } from "../handler$.js"
|
|
5
|
-
import { splitProps } from "../props.js"
|
|
6
|
-
|
|
7
|
-
const {
|
|
8
|
-
children,
|
|
9
|
-
modal,
|
|
10
|
-
onentry,
|
|
11
|
-
onopen,
|
|
12
|
-
...rest
|
|
13
|
-
} = $props()
|
|
14
|
-
|
|
15
|
-
const prop = splitProps(rest, "m!")
|
|
16
|
-
|
|
17
|
-
let element = null
|
|
18
|
-
const open = async (props) => {
|
|
19
|
-
onopen?.()
|
|
20
|
-
const result = await element.show()
|
|
21
|
-
onentry?.(result)
|
|
22
|
-
}
|
|
23
|
-
</script>
|
|
24
|
-
|
|
25
|
-
<Button {...prop.rest} onclick={open} {children} />
|
|
26
|
-
|
|
27
|
-
<Modal bind:this={element} {...prop["m!"]}>
|
|
28
|
-
{@render modal()}
|
|
29
|
-
</Modal>
|
package/src/composed/form.svelte
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
<script context="module">
|
|
2
|
-
const identity = i => i
|
|
3
|
-
const alwaysGood = () => true
|
|
4
|
-
</script>
|
|
5
|
-
|
|
6
|
-
<script>
|
|
7
|
-
import Input from "../control/input.svelte"
|
|
8
|
-
|
|
9
|
-
export let fields
|
|
10
|
-
export let values
|
|
11
|
-
export let valid = {}
|
|
12
|
-
|
|
13
|
-
const refs = fields.reduce(
|
|
14
|
-
(refs, field) => {
|
|
15
|
-
refs[field.name] = {
|
|
16
|
-
vt: field.value.transform ?? identity,
|
|
17
|
-
t: field.value.out ?? identity,
|
|
18
|
-
v: field.value.validate ?? alwaysGood,
|
|
19
|
-
e: (value) => {
|
|
20
|
-
if (valid[field.name] !== false) {
|
|
21
|
-
return null
|
|
22
|
-
}
|
|
23
|
-
return field.value.error?.(value) ?? null
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
return refs
|
|
27
|
-
},
|
|
28
|
-
{}
|
|
29
|
-
)
|
|
30
|
-
let internal = fields.reduce(
|
|
31
|
-
(initial, field) => {
|
|
32
|
-
initial[field.name] = field.value.initial ?? ""
|
|
33
|
-
return initial
|
|
34
|
-
},
|
|
35
|
-
{}
|
|
36
|
-
)
|
|
37
|
-
let value = new Proxy(
|
|
38
|
-
{},
|
|
39
|
-
{
|
|
40
|
-
get(_, name) {
|
|
41
|
-
return internal[name]
|
|
42
|
-
},
|
|
43
|
-
set(_, name, value) {
|
|
44
|
-
const ref = refs[name]
|
|
45
|
-
internal[name] = ref.vt(value)
|
|
46
|
-
values = { ...values, [name]: ref.t(internal[name]) }
|
|
47
|
-
valid = { ...valid, [name]: ref.v(values[name]) }
|
|
48
|
-
return true
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
)
|
|
52
|
-
</script>
|
|
53
|
-
|
|
54
|
-
{#each fields as field}
|
|
55
|
-
<Input
|
|
56
|
-
{...field.props}
|
|
57
|
-
bind:value={value[field.name]}
|
|
58
|
-
error={refs[field.name].e(value[field.name])}
|
|
59
|
-
/>
|
|
60
|
-
{/each}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export const filters = {
|
|
2
|
-
text: (propName) =>
|
|
3
|
-
(row, text) =>
|
|
4
|
-
row[propName]
|
|
5
|
-
.toLowerCase()
|
|
6
|
-
.includes(text.toLowerCase())
|
|
7
|
-
}
|
|
8
|
-
export const sorts = {
|
|
9
|
-
natural: (propName) => {
|
|
10
|
-
const comparitor = new Intl.Collator(undefined, { numeric: true })
|
|
11
|
-
return (a, b) => comparitor.compare(a[propName], b[propName])
|
|
12
|
-
},
|
|
13
|
-
number: (propName) =>
|
|
14
|
-
(a, b) => a[propName] - b[propName]
|
|
15
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import wsx from "../wsx.js"
|
|
3
|
-
import variant from "../variant.js"
|
|
4
|
-
|
|
5
|
-
const {
|
|
6
|
-
color = false,
|
|
7
|
-
compact = false,
|
|
8
|
-
ground = false,
|
|
9
|
-
disabled,
|
|
10
|
-
|
|
11
|
-
fill = false,
|
|
12
|
-
outline = false,
|
|
13
|
-
flat = false,
|
|
14
|
-
children,
|
|
15
|
-
onclick,
|
|
16
|
-
...rest
|
|
17
|
-
} = $props()
|
|
18
|
-
|
|
19
|
-
const type = $derived(
|
|
20
|
-
variant(
|
|
21
|
-
"$flat",
|
|
22
|
-
{ fill },
|
|
23
|
-
{ outline },
|
|
24
|
-
{ flat }
|
|
25
|
-
)
|
|
26
|
-
)
|
|
27
|
-
|
|
28
|
-
const wind = $derived({
|
|
29
|
-
[type]: true,
|
|
30
|
-
"$color": color,
|
|
31
|
-
$compact: compact,
|
|
32
|
-
$ground: ground,
|
|
33
|
-
...rest
|
|
34
|
-
})
|
|
35
|
-
</script>
|
|
36
|
-
|
|
37
|
-
<button use:wsx={wind} {disabled} {onclick}>
|
|
38
|
-
{@render children?.()}
|
|
39
|
-
</button>
|
package/src/control/input.svelte
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
<script>
|
|
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,
|
|
16
|
-
|
|
17
|
-
value = $bindable(""),
|
|
18
|
-
autocompleteOptions = null,
|
|
19
|
-
|
|
20
|
-
start,
|
|
21
|
-
end,
|
|
22
|
-
extra,
|
|
23
|
-
|
|
24
|
-
oninput,
|
|
25
|
-
...rest
|
|
26
|
-
} = $props()
|
|
27
|
-
|
|
28
|
-
let input = $state(null)
|
|
29
|
-
export const focus = () => input.focus()
|
|
30
|
-
|
|
31
|
-
const id =
|
|
32
|
-
(autocompleteOptions === null)
|
|
33
|
-
? null
|
|
34
|
-
: `${Math.random().toString(16)}_${Date.now()}`
|
|
35
|
-
|
|
36
|
-
const prop = splitProps(rest, "i!")
|
|
37
|
-
|
|
38
|
-
const variantStyle = $derived(
|
|
39
|
-
variant(
|
|
40
|
-
none,
|
|
41
|
-
{ outline },
|
|
42
|
-
{ linedFill },
|
|
43
|
-
{ lined },
|
|
44
|
-
{ flat }
|
|
45
|
-
)
|
|
46
|
-
)
|
|
47
|
-
|
|
48
|
-
const wind = $derived({
|
|
49
|
-
[variantStyle]: true,
|
|
50
|
-
"@@control": true,
|
|
51
|
-
"$color": color,
|
|
52
|
-
...prop.rest,
|
|
53
|
-
})
|
|
54
|
-
|
|
55
|
-
const tag = $derived(
|
|
56
|
-
(type === "area") ? "textarea" : "input"
|
|
57
|
-
)
|
|
58
|
-
|
|
59
|
-
const update = (evt) => {
|
|
60
|
-
value = evt.target.value
|
|
61
|
-
oninput?.(evt)
|
|
62
|
-
}
|
|
63
|
-
</script>
|
|
64
|
-
|
|
65
|
-
<label use:wsx={wind}>
|
|
66
|
-
{#if label}
|
|
67
|
-
<span use:wsx={{ "$label": true }}>{label}</span>
|
|
68
|
-
{/if}
|
|
69
|
-
<svelte:element
|
|
70
|
-
this={tag}
|
|
71
|
-
{...prop.input}
|
|
72
|
-
{disabled}
|
|
73
|
-
{type}
|
|
74
|
-
{value}
|
|
75
|
-
oninput={update}
|
|
76
|
-
list={id}
|
|
77
|
-
bind:this={input}
|
|
78
|
-
/>
|
|
79
|
-
|
|
80
|
-
{#if start}
|
|
81
|
-
<span use:wsx={{ "$start": true }}>
|
|
82
|
-
{@render start()}
|
|
83
|
-
</span>
|
|
84
|
-
{/if}
|
|
85
|
-
{#if end}
|
|
86
|
-
<span use:wsx={{ "$end": true }}>
|
|
87
|
-
{@render end()}
|
|
88
|
-
</span>
|
|
89
|
-
{/if}
|
|
90
|
-
{#if extra}
|
|
91
|
-
<span use:wsx={{ "$extra": true }}>
|
|
92
|
-
{@render extra()}
|
|
93
|
-
</span>
|
|
94
|
-
{/if}
|
|
95
|
-
|
|
96
|
-
{#if autocompleteOptions !== null}
|
|
97
|
-
<datalist {id}>
|
|
98
|
-
{#each autocompleteOptions as value}
|
|
99
|
-
<option {value}>{value}</option>
|
|
100
|
-
{/each}
|
|
101
|
-
</datalist>
|
|
102
|
-
{/if}
|
|
103
|
-
</label>
|
package/src/control/label.svelte
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import wsx from "../wsx.js"
|
|
3
|
-
import variant from "../variant.js"
|
|
4
|
-
|
|
5
|
-
const {
|
|
6
|
-
color = false,
|
|
7
|
-
compact = false,
|
|
8
|
-
ground = false,
|
|
9
|
-
disabled,
|
|
10
|
-
|
|
11
|
-
button = false,
|
|
12
|
-
fill = false,
|
|
13
|
-
outline = false,
|
|
14
|
-
flat = false,
|
|
15
|
-
for:_for = "",
|
|
16
|
-
|
|
17
|
-
children,
|
|
18
|
-
...rest
|
|
19
|
-
} = $props()
|
|
20
|
-
|
|
21
|
-
const type = $derived(
|
|
22
|
-
variant(
|
|
23
|
-
"$flat",
|
|
24
|
-
{ fill },
|
|
25
|
-
{ outline },
|
|
26
|
-
{ flat }
|
|
27
|
-
)
|
|
28
|
-
)
|
|
29
|
-
const baseStyles = $derived(
|
|
30
|
-
(button === true)
|
|
31
|
-
? {
|
|
32
|
-
"@@button": true,
|
|
33
|
-
[type]: true,
|
|
34
|
-
"$color": color,
|
|
35
|
-
$compact: compact,
|
|
36
|
-
$ground: ground,
|
|
37
|
-
}
|
|
38
|
-
: {}
|
|
39
|
-
)
|
|
40
|
-
|
|
41
|
-
const wind = $derived({
|
|
42
|
-
...baseStyles,
|
|
43
|
-
...rest
|
|
44
|
-
})
|
|
45
|
-
</script>
|
|
46
|
-
|
|
47
|
-
<label use:wsx={wind} {disabled} for={_for}>
|
|
48
|
-
{@render children?.()}
|
|
49
|
-
</label>
|
package/src/control/link.svelte
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
<script>
|
|
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
|
-
)
|
|
33
|
-
)
|
|
34
|
-
|
|
35
|
-
const wind = $derived({
|
|
36
|
-
"@@button": button,
|
|
37
|
-
[type]: true,
|
|
38
|
-
"$color": color,
|
|
39
|
-
$compact: compact,
|
|
40
|
-
$ground: ground,
|
|
41
|
-
...rest
|
|
42
|
-
})
|
|
43
|
-
</script>
|
|
44
|
-
|
|
45
|
-
<a {href} {target} {rel} disabled={disabled || null} use:wsx={wind} {onclick}>
|
|
46
|
-
{@render children?.()}
|
|
47
|
-
</a>
|