@x33025/sveltely 0.1.23 → 0.1.24

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 (65) hide show
  1. package/dist/components/Library/AnimatedNumber/AnimatedNumber.demo.svelte +3 -2
  2. package/dist/components/Library/ArticleEditor/Blocks/Table.svelte +133 -172
  3. package/dist/components/Library/Checkbox/Checkbox.demo.svelte +5 -4
  4. package/dist/components/Library/Checkbox/Checkbox.svelte +6 -5
  5. package/dist/components/Library/Checkbox/Checkbox.svelte.d.ts +2 -1
  6. package/dist/components/Library/ChipInput/ChipInput.demo.svelte +3 -2
  7. package/dist/components/Library/Dropdown/Dropdown.demo.svelte +17 -14
  8. package/dist/components/Library/Floating/Floating.svelte +5 -6
  9. package/dist/components/Library/Grid/Grid.svelte +13 -4
  10. package/dist/components/Library/Grid/Grid.svelte.d.ts +2 -1
  11. package/dist/components/Library/Grid/GridItem.svelte +12 -3
  12. package/dist/components/Library/Grid/GridItem.svelte.d.ts +2 -1
  13. package/dist/components/Library/HStack/HStack.svelte +4 -4
  14. package/dist/components/Library/HStack/HStack.svelte.d.ts +2 -1
  15. package/dist/components/Library/Image/Image.demo.svelte +3 -1
  16. package/dist/components/Library/Image/Image.demo.svelte.d.ts +2 -0
  17. package/dist/components/Library/ImageMask/ImageMask.demo.svelte +8 -6
  18. package/dist/components/Library/Label/Label.demo.svelte +4 -4
  19. package/dist/components/Library/Label/Label.svelte +5 -13
  20. package/dist/components/Library/NavigationStack/Link.svelte +1 -4
  21. package/dist/components/Library/Pagination/Pagination.demo.svelte +3 -2
  22. package/dist/components/Library/Popover/PopoverDebugOverlay.svelte +3 -3
  23. package/dist/components/Library/Portal/Content.svelte +20 -0
  24. package/dist/components/Library/Portal/Content.svelte.d.ts +10 -0
  25. package/dist/components/Library/Portal/Portal.svelte +4 -0
  26. package/dist/components/Library/Portal/Portal.svelte.d.ts +1 -0
  27. package/dist/components/Library/Portal/index.d.ts +1 -0
  28. package/dist/components/Library/Portal/index.js +1 -0
  29. package/dist/components/Library/ScrollView/ScrollView.svelte +12 -5
  30. package/dist/components/Library/SearchField/SearchField.demo.svelte +3 -2
  31. package/dist/components/Library/SearchField/SearchField.svelte +5 -5
  32. package/dist/components/Library/SearchField/SearchField.svelte.d.ts +2 -1
  33. package/dist/components/Library/SegmentedPicker/SegmentedPicker.demo.svelte +3 -2
  34. package/dist/components/Library/Sheet/Sheet.demo.svelte +3 -2
  35. package/dist/components/Library/Sheet/Sheet.svelte +3 -3
  36. package/dist/components/Library/Slider/Slider.demo.svelte +3 -2
  37. package/dist/components/Library/Spinner/Spinner.demo.svelte +3 -2
  38. package/dist/components/Library/Switch/Switch.demo.svelte +5 -4
  39. package/dist/components/Library/Switch/Switch.svelte +6 -5
  40. package/dist/components/Library/Switch/Switch.svelte.d.ts +2 -1
  41. package/dist/components/Library/Table/Column.svelte +3 -0
  42. package/dist/components/Library/Table/Column.svelte.d.ts +1 -0
  43. package/dist/components/Library/Table/Table.demo.svelte +222 -17
  44. package/dist/components/Library/Table/Table.svelte +98 -57
  45. package/dist/components/Library/Table/Table.svelte.d.ts +1 -2
  46. package/dist/components/Library/Table/types.d.ts +1 -0
  47. package/dist/components/Library/TextShimmer/TextShimmer.demo.svelte +3 -2
  48. package/dist/components/Library/TimePicker/TimePicker.demo.svelte +3 -10
  49. package/dist/components/Library/TokenSearchField/TokenSearchField.demo.svelte +3 -2
  50. package/dist/components/Library/VStack/VStack.svelte +4 -4
  51. package/dist/components/Library/VStack/VStack.svelte.d.ts +2 -1
  52. package/dist/components/Local/ColorStyleControls.svelte +0 -8
  53. package/dist/components/Local/ComponentGrid.svelte +3 -12
  54. package/dist/components/Local/HeroCard.svelte +1 -2
  55. package/dist/components/Local/LayoutStyleControls.svelte +33 -25
  56. package/dist/components/Local/StyleControls.svelte +1 -1
  57. package/dist/index.d.ts +2 -2
  58. package/dist/index.js +1 -1
  59. package/dist/style/index.css +2 -2
  60. package/dist/style/layout.d.ts +14 -20
  61. package/dist/style/layout.js +14 -40
  62. package/dist/style/surface.d.ts +1 -0
  63. package/dist/style/surface.js +10 -0
  64. package/dist/style.css +2 -53
  65. package/package.json +1 -1
@@ -16,7 +16,15 @@
16
16
  StyleProps &
17
17
  LoaderProps;
18
18
 
19
- let { children, column, row, columnSpan, rowSpan, area, ...restProps }: Props = $props();
19
+ let {
20
+ children,
21
+ column,
22
+ row,
23
+ columnSpan,
24
+ rowSpan,
25
+ area,
26
+ ...restProps
27
+ }: Props & Record<string, unknown> = $props();
20
28
 
21
29
  const extractedLoaderProps = $derived.by(() => extractLoaderProps(restProps));
22
30
  const loaderProps = $derived(extractedLoaderProps.loaderProps);
@@ -27,7 +35,7 @@
27
35
  const afterLayoutProps = $derived(extractedLayoutProps.restProps);
28
36
  const extractedStyleProps = $derived.by(() => extractStyleProps(afterLayoutProps));
29
37
  const styleProps = $derived(extractedStyleProps.styleProps);
30
- const props = $derived(extractedStyleProps.restProps);
38
+ const forwardedProps = $derived(extractedStyleProps.restProps);
31
39
  const rootStyle = $derived.by(() =>
32
40
  [
33
41
  column !== undefined ? `grid-column: ${column};` : '',
@@ -47,7 +55,7 @@
47
55
  );
48
56
  </script>
49
57
 
50
- <div class="grid-item" style={rootStyle} {...props} use:loaderAction={loaderOptions}>
58
+ <div class="grid-item" style={rootStyle} {...forwardedProps} use:loaderAction={loaderOptions}>
51
59
  {#if children}
52
60
  {@render children()}
53
61
  {/if}
@@ -55,6 +63,7 @@
55
63
 
56
64
  <style>
57
65
  .grid-item {
66
+ width: 100%;
58
67
  min-width: 0;
59
68
  min-height: 0;
60
69
  height: 100%;
@@ -10,6 +10,7 @@ type Props = {
10
10
  rowSpan?: number;
11
11
  area?: string;
12
12
  } & LayoutProps & StyleProps & LoaderProps;
13
- declare const GridItem: import("svelte").Component<Props, {}, "">;
13
+ type $$ComponentProps = Props & Record<string, unknown>;
14
+ declare const GridItem: import("svelte").Component<$$ComponentProps, {}, "">;
14
15
  type GridItem = ReturnType<typeof GridItem>;
15
16
  export default GridItem;
@@ -11,7 +11,7 @@
11
11
  StyleProps &
12
12
  LoaderProps;
13
13
 
14
- let { children, ...restProps }: Props = $props();
14
+ let { children, ...restProps }: Props & Record<string, unknown> = $props();
15
15
 
16
16
  const extractedLoaderProps = $derived.by(() => extractLoaderProps(restProps));
17
17
  const loaderProps = $derived(extractedLoaderProps.loaderProps);
@@ -22,13 +22,13 @@
22
22
  const afterLayoutProps = $derived(extractedLayoutProps.restProps);
23
23
  const extractedStyleProps = $derived.by(() => extractStyleProps(afterLayoutProps));
24
24
  const styleProps = $derived(extractedStyleProps.styleProps);
25
- const props = $derived(extractedStyleProps.restProps);
25
+ const forwardedProps = $derived(extractedStyleProps.restProps);
26
26
  const rootStyle = $derived.by(() =>
27
27
  [layoutStyle(layoutProps), surfaceStyle(styleProps, 'hstack')].filter(Boolean).join(' ')
28
28
  );
29
29
  </script>
30
30
 
31
- <div class="hstack" style={rootStyle} {...props} use:loaderAction={loaderOptions}>
31
+ <div class="hstack" style={rootStyle} {...forwardedProps} use:loaderAction={loaderOptions}>
32
32
  {#if children}
33
33
  {@render children()}
34
34
  {/if}
@@ -41,7 +41,7 @@
41
41
  --hstack-padding-x: 0px;
42
42
  --hstack-padding-y: 0px;
43
43
  --hstack-font-size: inherit;
44
- display: flex;
44
+ display: inline-flex;
45
45
  min-width: 0;
46
46
  min-height: 0;
47
47
  flex-direction: row;
@@ -5,6 +5,7 @@ import { type StyleProps } from '../../../style/surface';
5
5
  type Props = {
6
6
  children?: Snippet;
7
7
  } & LayoutProps & StyleProps & LoaderProps;
8
- declare const HStack: import("svelte").Component<Props, {}, "">;
8
+ type $$ComponentProps = Props & Record<string, unknown>;
9
+ declare const HStack: import("svelte").Component<$$ComponentProps, {}, "">;
9
10
  type HStack = ReturnType<typeof HStack>;
10
11
  export default HStack;
@@ -1,7 +1,9 @@
1
1
  <script module lang="ts">
2
2
  export const demo = {
3
3
  name: 'Image',
4
- description: 'Responsive image display with icon placeholder and busy states.'
4
+ description: 'Responsive image display with icon placeholder and busy states.',
5
+ columnSpan: 3,
6
+ rowSpan: 2
5
7
  };
6
8
  </script>
7
9
 
@@ -1,6 +1,8 @@
1
1
  export declare const demo: {
2
2
  name: string;
3
3
  description: string;
4
+ columnSpan: number;
5
+ rowSpan: number;
4
6
  };
5
7
  import Image from './Image.svelte';
6
8
  interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
@@ -9,7 +9,9 @@
9
9
 
10
10
  <script lang="ts">
11
11
  import { Brush, Eraser, X } from '@lucide/svelte';
12
+ import Grid from '../Grid';
12
13
  import Slider from '../Slider';
14
+ import VStack from '../VStack';
13
15
  import ImageMask from './ImageMask.svelte';
14
16
  import type { ImageMaskValue, MaskTool } from './types';
15
17
 
@@ -19,7 +21,7 @@
19
21
  let clearRevision = $state(0);
20
22
  </script>
21
23
 
22
- <div class="grid items-start gap-3 md:grid-cols-[minmax(0,18rem)_minmax(8rem,1fr)]">
24
+ <Grid columns="repeat(auto-fit, minmax(min(100%, 18rem), 1fr))" align="start" gap={7.5}>
23
25
  <ImageMask
24
26
  src="https://images.unsplash.com/photo-1542291026-7eec264c27ff?auto=format&fit=crop&w=700&q=80"
25
27
  alt="Red sneaker"
@@ -30,14 +32,14 @@
30
32
  fit="cover"
31
33
  aspectRatio="1 / 1"
32
34
  />
33
- <div class="vstack gap-2 text-sm text-[var(--sveltely-text-secondary-color)]">
35
+ <VStack gap={5} fontSize={8.75} color="var(--sveltely-text-secondary-color)">
34
36
  <div class="font-medium text-[var(--sveltely-text-primary-color)]">Mask</div>
35
37
  <div class="aspect-square overflow-hidden rounded-md border border-zinc-200 bg-black">
36
38
  {#if mask}
37
39
  <img src={mask.dataUrl} alt="Exported mask" class="size-full object-contain" />
38
40
  {/if}
39
41
  </div>
40
- <label class="vstack gap-2 bg-white p-3">
42
+ <VStack gap={5} background="white" paddingX={7.5} paddingY={7.5}>
41
43
  <span class="font-medium text-[var(--sveltely-text-primary-color)]"
42
44
  >Brush size {brushSize}px</span
43
45
  >
@@ -78,9 +80,9 @@
78
80
  <X size={16} />
79
81
  </button>
80
82
  </div>
81
- </label>
82
- </div>
83
- </div>
83
+ </VStack>
84
+ </VStack>
85
+ </Grid>
84
86
 
85
87
  <style>
86
88
  .image-mask-controls {
@@ -20,19 +20,19 @@
20
20
  </script>
21
21
 
22
22
  <HStack gap={10} align="center">
23
- <Label label="Name" icon={UserIcon} orientation="top" width="fit">
23
+ <Label label="Name" icon={UserIcon} orientation="top">
24
24
  <TextField bind:value={name} placeholder="Sveltely" />
25
25
  </Label>
26
26
 
27
- <Label label="Amount" icon={HashIcon} orientation="leading" width="fit">
27
+ <Label label="Amount" icon={HashIcon} orientation="leading">
28
28
  <NumberField bind:value={amount} min={0} max={100} />
29
29
  </Label>
30
30
 
31
- <Label label="Enabled" orientation="trailing" width="fit">
31
+ <Label label="Enabled" orientation="trailing">
32
32
  <Switch bind:checked={enabled} />
33
33
  </Label>
34
34
 
35
- <Label orientation="leading" width="fit">
35
+ <Label orientation="leading">
36
36
  {#snippet labelContent()}
37
37
  <span>Name <span class="text-[var(--sveltely-text-tertiary-color)]">optional</span></span>
38
38
  {/snippet}
@@ -23,17 +23,12 @@
23
23
  iconSize,
24
24
  iconColor,
25
25
  orientation = 'top',
26
- size,
27
26
  width,
28
27
  height,
29
28
  minWidth,
30
29
  minHeight,
31
30
  maxWidth,
32
31
  maxHeight,
33
- grow,
34
- shrink,
35
- basis,
36
- border,
37
32
  align,
38
33
  justify,
39
34
  fontSize,
@@ -42,23 +37,19 @@
42
37
  gap,
43
38
  borderRadius,
44
39
  inset,
40
+ border,
45
41
  background,
46
42
  borderColor,
47
43
  color
48
44
  }: Props = $props();
49
45
 
50
46
  const layoutProps = $derived({
51
- size,
52
47
  width,
53
48
  height,
54
49
  minWidth,
55
50
  minHeight,
56
51
  maxWidth,
57
52
  maxHeight,
58
- grow,
59
- shrink,
60
- basis,
61
- border,
62
53
  align,
63
54
  justify
64
55
  });
@@ -69,6 +60,7 @@
69
60
  gap,
70
61
  borderRadius,
71
62
  inset,
63
+ border,
72
64
  background,
73
65
  borderColor,
74
66
  color
@@ -126,9 +118,9 @@
126
118
  --label-font-size: var(--sveltely-font-size);
127
119
  --label-icon-size: calc(var(--label-font-size) * 1.143);
128
120
  display: inline-flex;
129
- width: 100%;
130
- min-width: min-content;
131
- min-height: min-content;
121
+ width: fit-content;
122
+ min-width: 0;
123
+ min-height: 0;
132
124
  gap: var(--label-gap, calc(var(--sveltely-gap) * 0.75));
133
125
  border-radius: var(--label-border-radius, 0px);
134
126
  color: var(--label-color, var(--sveltely-text-primary-color));
@@ -48,12 +48,9 @@
48
48
  calc(var(--sveltely-padding-x) * var(--navigation-link-scale))
49
49
  );
50
50
  text-decoration: none;
51
- transition:
52
- color 150ms,
53
- background-color 150ms;
51
+ transition: color 150ms;
54
52
  }
55
53
 
56
- .navigation-link:hover,
57
54
  .navigation-link-active {
58
55
  background: var(
59
56
  --navigation-link-active-background,
@@ -7,6 +7,7 @@
7
7
  </script>
8
8
 
9
9
  <script lang="ts">
10
+ import HStack from '../HStack';
10
11
  import Pagination from './Pagination.svelte';
11
12
 
12
13
  let data = $state({
@@ -21,6 +22,6 @@
21
22
  };
22
23
  </script>
23
24
 
24
- <div class="w-fit">
25
+ <HStack>
25
26
  <Pagination {data} showFirstLast={true} onPageChange={(page) => onPageChange(page)} />
26
- </div>
27
+ </HStack>
@@ -1,5 +1,5 @@
1
1
  <script lang="ts">
2
- import { portalContent } from '../../../actions/portal';
2
+ import { Content as PortalContent } from '../Portal';
3
3
  import { getOpenPopoverIds, getParentId } from './registry.svelte';
4
4
 
5
5
  type Point = { x: number; y: number };
@@ -96,7 +96,7 @@
96
96
  </script>
97
97
 
98
98
  {#if geometries.length > 0}
99
- <div use:portalContent class="pointer-events-none fixed inset-0 z-[9999]">
99
+ <PortalContent class="pointer-events-none fixed inset-0 z-[9999]">
100
100
  <svg width="100%" height="100%" aria-hidden="true">
101
101
  {#each geometries as geo (geo.id)}
102
102
  <!-- Safe polygon (rendered first so rects draw over it) -->
@@ -159,5 +159,5 @@
159
159
  </text>
160
160
  {/each}
161
161
  </svg>
162
- </div>
162
+ </PortalContent>
163
163
  {/if}
@@ -0,0 +1,20 @@
1
+ <script lang="ts">
2
+ import type { Snippet } from 'svelte';
3
+ import type { HTMLAttributes } from 'svelte/elements';
4
+ import { portalContent } from '../../../actions/portal';
5
+
6
+ type Props = {
7
+ id?: string;
8
+ children?: Snippet;
9
+ element?: HTMLElement | null;
10
+ } & Omit<HTMLAttributes<HTMLDivElement>, 'children'>;
11
+
12
+ let { id = 'default', children, element = $bindable<HTMLElement | null>(null), ...props }: Props =
13
+ $props();
14
+ </script>
15
+
16
+ <div bind:this={element} use:portalContent={id} {...props}>
17
+ {#if children}
18
+ {@render children()}
19
+ {/if}
20
+ </div>
@@ -0,0 +1,10 @@
1
+ import type { Snippet } from 'svelte';
2
+ import type { HTMLAttributes } from 'svelte/elements';
3
+ type Props = {
4
+ id?: string;
5
+ children?: Snippet;
6
+ element?: HTMLElement | null;
7
+ } & Omit<HTMLAttributes<HTMLDivElement>, 'children'>;
8
+ declare const Content: import("svelte").Component<Props, {}, "element">;
9
+ type Content = ReturnType<typeof Content>;
10
+ export default Content;
@@ -1,3 +1,7 @@
1
+ <script module lang="ts">
2
+ export { default as Content } from './Content.svelte';
3
+ </script>
4
+
1
5
  <script lang="ts">
2
6
  import { portalHost } from '../../../actions/portal';
3
7
 
@@ -1,3 +1,4 @@
1
+ export { default as Content } from './Content.svelte';
1
2
  type Props = {
2
3
  id?: string;
3
4
  };
@@ -1 +1,2 @@
1
1
  export { default } from './Portal.svelte';
2
+ export { default as Content } from './Content.svelte';
@@ -1 +1,2 @@
1
1
  export { default } from './Portal.svelte';
2
+ export { default as Content } from './Content.svelte';
@@ -117,7 +117,11 @@
117
117
 
118
118
  const contentRect = contentElement.getBoundingClientRect();
119
119
  let width = Math.max(contentElement.scrollWidth, contentElement.offsetWidth, contentRect.width);
120
- let height = Math.max(contentElement.scrollHeight, contentElement.offsetHeight, contentRect.height);
120
+ let height = Math.max(
121
+ contentElement.scrollHeight,
122
+ contentElement.offsetHeight,
123
+ contentRect.height
124
+ );
121
125
 
122
126
  for (const child of Array.from(contentElement.children)) {
123
127
  const childElement = child as HTMLElement;
@@ -275,8 +279,11 @@
275
279
  };
276
280
 
277
281
  function handleWheel(event: WheelEvent) {
278
- const wheelX = axis === 'horizontal' && event.deltaX === 0 ? event.deltaY : event.deltaX;
279
- const consumed = scrollTo(offsetX + wheelX, offsetY + event.deltaY);
282
+ const shouldMapWheelYToX =
283
+ event.deltaX === 0 && (axis === 'horizontal' || (axis === 'both' && event.shiftKey));
284
+ const wheelX = shouldMapWheelYToX ? event.deltaY : event.deltaX;
285
+ const wheelY = axis === 'both' && event.shiftKey ? 0 : event.deltaY;
286
+ const consumed = scrollTo(offsetX + wheelX, offsetY + wheelY);
280
287
 
281
288
  if (consumed || shouldContainOverscroll(consumed)) {
282
289
  event.preventDefault();
@@ -363,7 +370,8 @@
363
370
  const thumbSize = orientation === 'horizontal' ? thumbXSize : thumbYSize;
364
371
  const maxScroll = Math.max(0, contentSize - viewportSize);
365
372
  const maxThumbOffset = Math.max(1, viewportSize - thumbSize);
366
- const delta = (orientation === 'horizontal' ? moveEvent.clientX : moveEvent.clientY) - startPointer;
373
+ const delta =
374
+ (orientation === 'horizontal' ? moveEvent.clientX : moveEvent.clientY) - startPointer;
367
375
  const nextScroll = startScroll + (delta / maxThumbOffset) * maxScroll;
368
376
 
369
377
  if (orientation === 'horizontal') {
@@ -383,7 +391,6 @@
383
391
  window.addEventListener('pointerup', up);
384
392
  window.addEventListener('pointercancel', up);
385
393
  }
386
-
387
394
  </script>
388
395
 
389
396
  <div
@@ -6,12 +6,13 @@
6
6
  </script>
7
7
 
8
8
  <script lang="ts">
9
+ import VStack from '../VStack';
9
10
  import SearchField from './SearchField.svelte';
10
11
 
11
12
  let value = $state('');
12
13
  </script>
13
14
 
14
- <div class="vstack w-full max-w-sm gap-2">
15
+ <VStack width="100%" maxWidth="24rem" gap={5}>
15
16
  <SearchField bind:value placeholder="Search components..." />
16
17
  <p class="text-xs text-[var(--sveltely-text-secondary-color)]">Value: {value || 'empty'}</p>
17
- </div>
18
+ </VStack>
@@ -19,15 +19,15 @@
19
19
  disabled = false,
20
20
  placeholder = 'Search',
21
21
  ...restProps
22
- }: Props = $props();
22
+ }: Props & Record<string, unknown> = $props();
23
23
 
24
24
  const extractedStyleProps = $derived.by(() => extractStyleProps(restProps));
25
25
  const styleProps = $derived(extractedStyleProps.styleProps);
26
- const props = $derived(extractedStyleProps.restProps);
26
+ const forwardedProps = $derived(extractedStyleProps.restProps);
27
27
  const rootStyle = $derived.by(() => surfaceStyle(styleProps, 'search-field'));
28
28
  </script>
29
29
 
30
- <label
30
+ <div
31
31
  class="search-field"
32
32
  style={rootStyle}
33
33
  data-disabled={disabled ? 'true' : 'false'}
@@ -37,8 +37,8 @@
37
37
  <span class="search-field-icon" aria-hidden="true">
38
38
  <SearchIcon class="size-4" />
39
39
  </span>
40
- <input type="search" bind:value {disabled} {placeholder} class="search-field-input" {...props} />
41
- </label>
40
+ <input type="search" bind:value {disabled} {placeholder} class="search-field-input" {...forwardedProps} />
41
+ </div>
42
42
 
43
43
  <style>
44
44
  .search-field {
@@ -5,6 +5,7 @@ type Props = {
5
5
  value?: string;
6
6
  radiusSource?: boolean;
7
7
  } & StyleProps & TooltipProps & Omit<HTMLInputAttributes, 'children' | 'type' | 'value' | 'class' | 'style'>;
8
- declare const SearchField: import("svelte").Component<Props, {}, "value">;
8
+ type $$ComponentProps = Props & Record<string, unknown>;
9
+ declare const SearchField: import("svelte").Component<$$ComponentProps, {}, "value">;
9
10
  type SearchField = ReturnType<typeof SearchField>;
10
11
  export default SearchField;
@@ -6,6 +6,7 @@
6
6
  </script>
7
7
 
8
8
  <script lang="ts">
9
+ import VStack from '../VStack';
9
10
  import SegmentedPicker from './SegmentedPicker.svelte';
10
11
 
11
12
  const options = [
@@ -17,7 +18,7 @@
17
18
  let value = $state('day');
18
19
  </script>
19
20
 
20
- <div class="vstack center gap-2">
21
+ <VStack align="center" justify="center" gap={5}>
21
22
  <SegmentedPicker {options} bind:value />
22
23
  <p class="text-xs text-[var(--sveltely-text-secondary-color)]">Selected: {value}</p>
23
- </div>
24
+ </VStack>
@@ -6,6 +6,7 @@
6
6
  </script>
7
7
 
8
8
  <script lang="ts">
9
+ import VStack from '../VStack';
9
10
  import Sheet from './Sheet.svelte';
10
11
  </script>
11
12
 
@@ -14,12 +15,12 @@
14
15
  <span>Open sheet</span>
15
16
  {/snippet}
16
17
 
17
- <div class="vstack gap-3">
18
+ <VStack gap={7.5}>
18
19
  <p class="text-sm text-[var(--sveltely-text-primary-color)]">This is a simple sheet example.</p>
19
20
  <div class="rounded border border-gray-200/70 p-3 text-sm text-gray-700">
20
21
  <div>Panel one content.</div>
21
22
  <div class="mt-2">Panel two content.</div>
22
23
  <div class="mt-2">Panel three content.</div>
23
24
  </div>
24
- </div>
25
+ </VStack>
25
26
  </Sheet>
@@ -1,6 +1,6 @@
1
1
  <script lang="ts">
2
2
  import type { Snippet } from 'svelte';
3
- import { portalContent } from '../../../actions/portal';
3
+ import { Content as PortalContent } from '../Portal';
4
4
  import { extractStyleProps, surfaceStyle, type StyleProps } from '../../../style/surface';
5
5
  interface Props {
6
6
  trigger?: Snippet;
@@ -58,7 +58,7 @@
58
58
  {/if}
59
59
 
60
60
  {#if open}
61
- <div class="center fixed inset-0 z-50 flex" use:portalContent>
61
+ <PortalContent class="center fixed inset-0 z-50 flex">
62
62
  <button
63
63
  type="button"
64
64
  aria-label="Close dialog"
@@ -78,7 +78,7 @@
78
78
  {/if}
79
79
  </div>
80
80
  </div>
81
- </div>
81
+ </PortalContent>
82
82
  {/if}
83
83
 
84
84
  <style>
@@ -6,12 +6,13 @@
6
6
  </script>
7
7
 
8
8
  <script lang="ts">
9
+ import VStack from '../VStack';
9
10
  import Slider from './Slider.svelte';
10
11
 
11
12
  let value = $state(35);
12
13
  </script>
13
14
 
14
- <div class="vstack w-full max-w-sm gap-2">
15
+ <VStack width="100%" maxWidth="24rem" gap={5}>
15
16
  <Slider bind:value min={0} max={100} />
16
17
  <p class="text-xs text-[var(--sveltely-text-secondary-color)]">Value: {value}</p>
17
- </div>
18
+ </VStack>
@@ -6,9 +6,10 @@
6
6
  </script>
7
7
 
8
8
  <script lang="ts">
9
+ import HStack from '../HStack';
9
10
  import Spinner from './Spinner.svelte';
10
11
  </script>
11
12
 
12
- <div class="text-[var(--sveltely-text-primary-color)]">
13
+ <HStack color="var(--sveltely-text-primary-color)">
13
14
  <Spinner />
14
- </div>
15
+ </HStack>
@@ -8,16 +8,17 @@
8
8
  <script lang="ts">
9
9
  import Switch from './Switch.svelte';
10
10
  import Label from '../Label';
11
+ import VStack from '../VStack';
11
12
 
12
13
  let notificationsEnabled = $state(true);
13
14
  let weeklySummaryEnabled = $state(false);
14
15
  </script>
15
16
 
16
- <div class="vstack gap-3">
17
- <Label label="Enable notifications" orientation="leading" width="fit">
17
+ <VStack gap={7.5}>
18
+ <Label label="Enable notifications" orientation="leading">
18
19
  <Switch bind:checked={notificationsEnabled} />
19
20
  </Label>
20
- <Label label="Send weekly summary" orientation="leading" width="fit">
21
+ <Label label="Send weekly summary" orientation="leading">
21
22
  <Switch bind:checked={weeklySummaryEnabled} />
22
23
  </Label>
23
- </div>
24
+ </VStack>
@@ -10,25 +10,26 @@
10
10
  TooltipProps &
11
11
  Omit<HTMLInputAttributes, 'type' | 'class' | 'style' | 'checked'>;
12
12
 
13
- let { checked = $bindable(false), tooltip, disabled = false, ...restProps }: Props = $props();
13
+ let { checked = $bindable(false), tooltip, disabled = false, ...restProps }: Props &
14
+ Record<string, unknown> = $props();
14
15
 
15
16
  const extractedStyleProps = $derived.by(() => extractStyleProps(restProps));
16
17
  const styleProps = $derived(extractedStyleProps.styleProps);
17
- const props = $derived(extractedStyleProps.restProps);
18
+ const forwardedProps = $derived(extractedStyleProps.restProps);
18
19
  const rootStyle = $derived.by(() => surfaceStyle(styleProps, 'switch'));
19
20
  </script>
20
21
 
21
- <label
22
+ <span
22
23
  class="switch"
23
24
  style={rootStyle}
24
25
  data-disabled={disabled ? 'true' : 'false'}
25
26
  use:tooltipAction={tooltip}
26
27
  >
27
- <input bind:checked type="checkbox" {disabled} {...props} />
28
+ <input bind:checked type="checkbox" {disabled} {...forwardedProps} />
28
29
  <span class="switch-track" aria-hidden="true">
29
30
  <span class="switch-thumb"></span>
30
31
  </span>
31
- </label>
32
+ </span>
32
33
 
33
34
  <style>
34
35
  .switch {
@@ -4,6 +4,7 @@ import type { TooltipProps } from '../../../style/tooltip';
4
4
  type Props = {
5
5
  checked?: boolean;
6
6
  } & StyleProps & TooltipProps & Omit<HTMLInputAttributes, 'type' | 'class' | 'style' | 'checked'>;
7
- declare const Switch: import("svelte").Component<Props, {}, "checked">;
7
+ type $$ComponentProps = Props & Record<string, unknown>;
8
+ declare const Switch: import("svelte").Component<$$ComponentProps, {}, "checked">;
8
9
  type Switch = ReturnType<typeof Switch>;
9
10
  export default Switch;