@axel669/zephyr 0.4.7 → 0.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/package.json +12 -10
  2. package/readme.md +8 -1
  3. package/src/async/button.svelte +17 -13
  4. package/src/async/suspend.svelte +38 -0
  5. package/src/changed.js +10 -0
  6. package/src/composed/data-table/th.svelte +2 -2
  7. package/src/composed/data-table.svelte +154 -180
  8. package/src/composed/entry-button.svelte +13 -16
  9. package/src/control/button.svelte +26 -22
  10. package/src/control/input.svelte +52 -50
  11. package/src/control/label.svelte +28 -24
  12. package/src/control/link.svelte +36 -30
  13. package/src/control/radio-group.svelte +13 -10
  14. package/src/control/select.svelte +21 -16
  15. package/src/control/tabs.svelte +18 -14
  16. package/src/control/toggle.svelte +33 -22
  17. package/src/custom-macros.js +9 -0
  18. package/src/data-display/avatar.svelte +12 -11
  19. package/src/data-display/badge.svelte +9 -7
  20. package/src/data-display/chip.svelte +27 -17
  21. package/src/data-display/details.svelte +22 -14
  22. package/src/data-display/popover.svelte +12 -9
  23. package/src/data-display/progress.svelte +17 -13
  24. package/src/data-display/table.svelte +29 -17
  25. package/src/data-display/tooltip.svelte +11 -9
  26. package/src/dialogs/alert.svelte +18 -12
  27. package/src/dialogs/confirm.svelte +22 -16
  28. package/src/{hash.js → hash.svelte.js} +9 -0
  29. package/src/{index.mjs → index.js} +10 -10
  30. package/src/{composed/element-toast.svelte → info/element-toaster.svelte} +41 -27
  31. package/src/info/icon.svelte +4 -4
  32. package/src/info/titlebar.svelte +20 -14
  33. package/src/info/toast.svelte +35 -0
  34. package/src/info/toaster/message.svelte +42 -0
  35. package/src/info/toaster.svelte +64 -6
  36. package/src/layout/dialog.svelte +10 -12
  37. package/src/layout/drawer.svelte +45 -18
  38. package/src/layout/flex.svelte +13 -11
  39. package/src/layout/grid.svelte +17 -15
  40. package/src/layout/modal.svelte +34 -26
  41. package/src/layout/paper.svelte +31 -33
  42. package/src/layout/screen.svelte +13 -9
  43. package/src/props.js +24 -0
  44. package/src/routing/route.svelte +29 -16
  45. package/src/routing/{routing.js → routing.svelte.js} +10 -1
  46. package/src/routing/title.svelte +8 -6
  47. package/src/spinner/circle-spinner.svelte +10 -8
  48. package/src/spinner/hexagon-spinner.svelte +10 -8
  49. package/src/text.svelte +6 -10
  50. package/src/wind.js +4 -0
  51. package/src/{wsx.mjs → wsx.js} +1 -1
  52. package/src/async/load-zone.svelte +0 -22
  53. package/src/composed/toast/message.svelte +0 -33
  54. package/src/composed/toast.svelte +0 -70
  55. package/src/info/notification.svelte +0 -28
  56. package/src/inline-dialog.svelte +0 -23
  57. /package/src/{handler$.mjs → handler$.js} +0 -0
  58. /package/src/{variant.mjs → variant.js} +0 -0
@@ -1,16 +1,18 @@
1
- <svelte:options immutable />
2
-
3
1
  <script>
4
- import wsx from "../wsx.mjs"
2
+ import wsx from "../wsx.js"
5
3
 
6
- export let size = "100px"
7
- export let color = "@primary"
4
+ const {
5
+ size = "100px",
6
+ color = "@primary",
7
+ ...rest
8
+ } = $props()
8
9
 
9
- $: wind = {
10
- ...$$restProps,
10
+ const wind = $derived({
11
+ ...rest,
11
12
  "@size": size,
12
13
  "$color": color,
13
- }
14
+ })
14
15
  </script>
15
16
 
17
+ <!-- svelte-ignore element_invalid_self_closing_tag -->
16
18
  <ws-circle-spinner use:wsx={wind} style="aspect-ratio: 1 / 1;" />
@@ -1,16 +1,18 @@
1
- <svelte:options immutable />
2
-
3
1
  <script>
4
- import wsx from "../wsx.mjs"
2
+ import wsx from "../wsx.js"
5
3
 
6
- export let size = "100px"
7
- export let color = "@primary"
4
+ const {
5
+ size = "100px",
6
+ color = "@primary",
7
+ ...rest
8
+ } = $props()
8
9
 
9
- $: wind = {
10
- ...$$restProps,
10
+ const wind = $derived({
11
+ ...rest,
11
12
  "@size": size,
12
13
  "$color": color,
13
- }
14
+ })
14
15
  </script>
15
16
 
17
+ <!-- svelte-ignore element_invalid_self_closing_tag -->
16
18
  <ws-hexagon-spinner use:wsx={wind} style="aspect-ratio: 1 / 1;" />
package/src/text.svelte CHANGED
@@ -1,20 +1,16 @@
1
- <svelte:options immutable />
2
-
3
1
  <script>
4
- import wsx from "./wsx.mjs"
2
+ import wsx from "./wsx.js"
5
3
 
6
- export let title = false
7
- export let subtitle = false
8
- export let adorn = false
4
+ const { adorn, subtitle, title, children, ...rest } = $props()
9
5
 
10
- $: wind = {
6
+ const wind = $derived({
11
7
  "$title-text": title,
12
8
  "$subtitle-text": subtitle,
13
9
  "$adorn": adorn,
14
- ...$$restProps
15
- }
10
+ ...rest
11
+ })
16
12
  </script>
17
13
 
18
14
  <span use:wsx={wind}>
19
- <slot />
15
+ {@render children?.()}
20
16
  </span>
package/src/wind.js ADDED
@@ -0,0 +1,4 @@
1
+ import "./custom-macros.js"
2
+ import ws from "@axel669/windstorm"
3
+
4
+ export default ws
@@ -1,4 +1,4 @@
1
- import ws from "@axel669/windstorm"
1
+ import ws from "./wind.js"
2
2
 
3
3
  export const none = Symbol("none")
4
4
  export default (node, props) => {
@@ -1,22 +0,0 @@
1
- <svelte:options immutable />
2
-
3
- <script>
4
- import Spinner from "../spinner/hexagon-spinner.svelte"
5
- export let source = null
6
- export let message = "Loading"
7
- </script>
8
-
9
- {#if source !== null}
10
- {#await source}
11
- <slot name="loading">
12
- <ws-flex ws-x="[fl-center]">
13
- <span>{message}</span>
14
- <Spinner size="100px" />
15
- </ws-flex>
16
- </slot>
17
- {:then result}
18
- <slot {result} />
19
- {:catch error}
20
- <slot name="error" {error} />
21
- {/await}
22
- {/if}
@@ -1,33 +0,0 @@
1
- <script>
2
- import { createEventDispatcher } from "svelte"
3
-
4
- import Button from "../../control/button.svelte"
5
- import Icon from "../../info/icon.svelte"
6
- import Notification from "../../info/notification.svelte"
7
- import Text from "../../text.svelte"
8
-
9
- export let message = ""
10
- export let icon = false
11
- export let color = false
12
- export let actionText = null
13
-
14
- const dispatch = createEventDispatcher()
15
- const dismiss = () => dispatch("action", null)
16
- const respond = () => dispatch("action", true)
17
- </script>
18
-
19
- <Notification {color} on:click={dismiss}>
20
- <Text slot="start" -adorn>
21
- {#if icon !== false}
22
- <Icon name={icon} />
23
- {/if}
24
- </Text>
25
- <span>{message}</span>
26
- <div slot="end" ws-x="[grid]">
27
- {#if actionText}
28
- <Button on:click={respond} r.l="0px">
29
- {actionText}
30
- </Button>
31
- {/if}
32
- </div>
33
- </Notification>
@@ -1,70 +0,0 @@
1
- <svelte:options immutable />
2
-
3
- <script context="module">
4
- const genID = () => `${Date.now()}:${Math.random().toString(16)}`
5
-
6
- const delays = {}
7
- const delay = ({time, action, id}) => {
8
- const trigger = () => {
9
- const info = delays[id]
10
- clearTimeout(info.id)
11
- action()
12
- delete delays[id]
13
- }
14
- const timeoutID = setTimeout(trigger, time)
15
- delays[id] = { trigger, id: timeoutID }
16
- }
17
- delay.trigger = (id) => delays[id].trigger()
18
- </script>
19
-
20
- <script>
21
- import { createEventDispatcher } from "svelte"
22
- import { fade } from "svelte/transition"
23
-
24
- import { eventHandler$ } from "../handler$.mjs"
25
-
26
- import Toaster from "../info/toaster.svelte"
27
-
28
- import ToastMessage from "./toast/message.svelte"
29
-
30
- export let component = ToastMessage
31
- export let position = "tc"
32
-
33
- let items = []
34
-
35
- const dispatch = createEventDispatcher()
36
- const act = eventHandler$(
37
- (evt, id, props) => {
38
- delay.trigger(id)
39
- dispatch(
40
- "action",
41
- { value: evt.detail, props }
42
- )
43
- }
44
- )
45
-
46
- export const show = (duration, props) => {
47
- const id = genID()
48
- items = [...items, { id, props }]
49
- delay({
50
- action: () => items = items.filter(
51
- item => item.id !== id
52
- ),
53
- time: duration,
54
- id,
55
- })
56
- }
57
- export const clear = () => items = []
58
- </script>
59
-
60
- <Toaster {position} {...$$restProps}>
61
- {#each items as {props, id} (id)}
62
- <zephyr-toast-wrapper ws-x="[grid]" transition:fade={{duration: 200}}>
63
- <svelte:component
64
- this={component}
65
- {...props}
66
- on:action={act(id, props)}
67
- />
68
- </zephyr-toast-wrapper>
69
- {/each}
70
- </Toaster>
@@ -1,28 +0,0 @@
1
- <script>
2
- import wsx from "../wsx.mjs"
3
-
4
- export let color = false
5
-
6
- $: wind = {
7
- "$color": color,
8
- ...$$restProps,
9
- }
10
- </script>
11
-
12
- <!-- svelte-ignore a11y-click-events-have-key-events -->
13
- <!-- svelte-ignore a11y-interactive-supports-focus -->
14
- <ws-notification use:wsx={wind} on:click role="button">
15
- {#if $$slots.start}
16
- <div ws-x="[$start] [grid]">
17
- <slot name="start" />
18
- </div>
19
- {/if}
20
- <div ws-x="[$notif-text]">
21
- <slot />
22
- </div>
23
- {#if $$slots.end}
24
- <div ws-x="[$end] [grid]">
25
- <slot name="end" />
26
- </div>
27
- {/if}
28
- </ws-notification>
@@ -1,23 +0,0 @@
1
- <script>
2
- import wsx from "../wsx.mjs"
3
-
4
- import Paper from "./paper.svelte"
5
-
6
- const id = Math.random().toString(16)
7
-
8
- $: paper = {
9
- "@dialog": true,
10
- "$outline": true,
11
- ...$$restProps
12
- }
13
- </script>
14
-
15
- <slot name="toggle" {id} />
16
- <input type="checkbox" ws-x="hide" {id} />
17
- <ws-modal>
18
- <ws-paper use:wsx={paper}>
19
- <slot name="header" {id} />
20
- <slot name="content" {id} />
21
- <slot name="footer" {id} />
22
- </ws-paper>
23
- </ws-modal>
File without changes
File without changes