@x33025/sveltely 0.1.18 → 0.1.21

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 (138) hide show
  1. package/dist/actions/LoaderOverlay.svelte +33 -8
  2. package/dist/actions/LoaderOverlay.svelte.d.ts +3 -0
  3. package/dist/actions/loader.d.ts +3 -0
  4. package/dist/actions/loader.js +20 -7
  5. package/dist/components/Library/AnimatedNumber/AnimatedNumber.demo.svelte +3 -9
  6. package/dist/components/Library/ArticleEditor/ArticleEditor.svelte +1 -1
  7. package/dist/components/Library/ArticleEditor/ArticleEditorHeader.svelte +20 -30
  8. package/dist/components/Library/ArticleEditor/Blocks/Code.svelte +0 -1
  9. package/dist/components/Library/ArticleEditor/Blocks/FAQ.svelte +1 -1
  10. package/dist/components/Library/ArticleEditor/Blocks/Heading.svelte +7 -7
  11. package/dist/components/Library/ArticleEditor/Blocks/Image.svelte +20 -36
  12. package/dist/components/Library/ArticleEditor/Blocks/Image.svelte.d.ts +1 -0
  13. package/dist/components/Library/ArticleEditor/Blocks/List.svelte +2 -2
  14. package/dist/components/Library/ArticleEditor/Blocks/Paragraph.svelte +1 -1
  15. package/dist/components/Library/ArticleEditor/Blocks/index.d.ts +0 -1
  16. package/dist/components/Library/ArticleEditor/Blocks/index.js +0 -1
  17. package/dist/components/Library/AsyncButton/AsyncButton.demo.svelte +2 -6
  18. package/dist/components/Library/AsyncButton/AsyncButton.svelte +9 -5
  19. package/dist/components/Library/AsyncButton/AsyncButton.svelte.d.ts +2 -1
  20. package/dist/components/Library/Button/Button.demo.svelte +2 -17
  21. package/dist/components/Library/Button/Button.demo.svelte.d.ts +0 -1
  22. package/dist/components/Library/Button/Button.svelte +15 -16
  23. package/dist/components/Library/Button/Button.svelte.d.ts +2 -1
  24. package/dist/components/Library/Calendar/Calendar.svelte +17 -27
  25. package/dist/components/Library/Checkbox/Checkbox.demo.svelte +7 -4
  26. package/dist/components/Library/Checkbox/Checkbox.svelte +24 -61
  27. package/dist/components/Library/Checkbox/Checkbox.svelte.d.ts +2 -4
  28. package/dist/components/Library/ChipInput/ChipInput.demo.svelte +2 -2
  29. package/dist/components/Library/ChipInput/ChipInput.svelte +7 -11
  30. package/dist/components/Library/ChipInput/ChipInput.svelte.d.ts +3 -2
  31. package/dist/components/Library/Dropdown/Action.svelte +1 -1
  32. package/dist/components/Library/Dropdown/Dropdown.demo.svelte +10 -10
  33. package/dist/components/Library/Dropdown/Dropdown.svelte +2 -6
  34. package/dist/components/Library/Dropdown/Item.svelte +2 -2
  35. package/dist/components/Library/Dropdown/Section.svelte +1 -1
  36. package/dist/components/Library/Dropdown/Trigger.svelte +3 -7
  37. package/dist/components/Library/Image/Image.demo.svelte +3 -3
  38. package/dist/components/Library/Image/Image.svelte +57 -12
  39. package/dist/components/Library/Image/Image.svelte.d.ts +1 -2
  40. package/dist/components/Library/Image/ImagePlaceholder.demo.svelte +12 -0
  41. package/dist/components/Library/Image/ImagePlaceholder.demo.svelte.d.ts +23 -0
  42. package/dist/components/Library/Image/ImagePlaceholder.svelte +28 -4
  43. package/dist/components/Library/Image/ImagePlaceholder.svelte.d.ts +1 -1
  44. package/dist/components/Library/Image/index.d.ts +1 -0
  45. package/dist/components/Library/Image/index.js +1 -0
  46. package/dist/components/Library/ImageMask/BrushPreview.svelte +6 -6
  47. package/dist/components/Library/ImageMask/ImageMask.demo.svelte +10 -8
  48. package/dist/components/Library/ImageMask/ImageMask.svelte +14 -6
  49. package/dist/components/Library/ImageMask/ImageMask.svelte.d.ts +1 -2
  50. package/dist/components/Library/ImageMask/MaskLayer.svelte +12 -6
  51. package/dist/components/Library/Label/Label.demo.svelte +16 -3
  52. package/dist/components/Library/Label/Label.svelte +15 -3
  53. package/dist/components/Library/Label/Label.svelte.d.ts +1 -0
  54. package/dist/components/Library/Link/Link.svelte +10 -22
  55. package/dist/components/Library/Link/Link.svelte.d.ts +2 -3
  56. package/dist/components/Library/Loader/Loader.demo.svelte +9 -3
  57. package/dist/components/Library/NavigationStack/Link.svelte +8 -12
  58. package/dist/components/Library/NavigationStack/Link.svelte.d.ts +1 -3
  59. package/dist/components/Library/NavigationStack/SidebarToggle.svelte +8 -2
  60. package/dist/components/Library/NumberField/NumberField.svelte +21 -17
  61. package/dist/components/Library/NumberField/NumberField.svelte.d.ts +4 -2
  62. package/dist/components/Library/Pagination/Pagination.svelte +3 -3
  63. package/dist/components/Library/Popover/Popover.svelte +2 -7
  64. package/dist/components/Library/ScrollView/ScrollView.demo.svelte +50 -0
  65. package/dist/components/Library/ScrollView/ScrollView.demo.svelte.d.ts +10 -0
  66. package/dist/components/Library/ScrollView/ScrollView.svelte +414 -67
  67. package/dist/components/Library/ScrollView/ScrollView.svelte.d.ts +17 -1
  68. package/dist/components/Library/ScrollView/index.d.ts +1 -1
  69. package/dist/components/Library/SearchField/SearchField.demo.svelte +2 -2
  70. package/dist/components/Library/SearchField/SearchField.svelte +9 -4
  71. package/dist/components/Library/SearchField/SearchField.svelte.d.ts +2 -1
  72. package/dist/components/Library/SegmentedPicker/SegmentedPicker.demo.svelte +2 -2
  73. package/dist/components/Library/SegmentedPicker/SegmentedPicker.svelte +7 -7
  74. package/dist/components/Library/Sheet/Sheet.demo.svelte +1 -1
  75. package/dist/components/Library/Sheet/Sheet.svelte +2 -7
  76. package/dist/components/Library/Slider/Slider.demo.svelte +1 -1
  77. package/dist/components/Library/Slider/Slider.svelte +11 -7
  78. package/dist/components/Library/Slider/Slider.svelte.d.ts +2 -1
  79. package/dist/components/Library/Spinner/Spinner.demo.svelte +1 -1
  80. package/dist/components/Library/Switch/Switch.demo.svelte +7 -4
  81. package/dist/components/Library/Switch/Switch.svelte +28 -68
  82. package/dist/components/Library/Switch/Switch.svelte.d.ts +2 -4
  83. package/dist/components/Library/Table/Column.svelte +81 -0
  84. package/dist/components/Library/Table/Column.svelte.d.ts +39 -0
  85. package/dist/components/Library/Table/Table.demo.svelte +148 -0
  86. package/dist/components/Library/Table/Table.demo.svelte.d.ts +10 -0
  87. package/dist/components/Library/Table/Table.svelte +624 -0
  88. package/dist/components/Library/Table/Table.svelte.d.ts +42 -0
  89. package/dist/components/Library/Table/context.d.ts +5 -0
  90. package/dist/components/Library/Table/context.js +2 -0
  91. package/dist/components/Library/Table/index.js +5 -0
  92. package/dist/components/Library/Table/types.d.ts +37 -0
  93. package/dist/components/Library/Table/types.js +1 -0
  94. package/dist/components/Library/Text/Text.demo.svelte +21 -0
  95. package/dist/components/Library/Text/Text.demo.svelte.d.ts +24 -0
  96. package/dist/components/Library/Text/Text.svelte +41 -0
  97. package/dist/components/Library/Text/Text.svelte.d.ts +9 -0
  98. package/dist/components/Library/Text/index.d.ts +1 -0
  99. package/dist/components/Library/Text/index.js +1 -0
  100. package/dist/components/Library/TextEditor/TextEditor.svelte +15 -9
  101. package/dist/components/Library/TextEditor/TextEditor.svelte.d.ts +2 -4
  102. package/dist/components/Library/TextField/TextField.demo.svelte +1 -1
  103. package/dist/components/Library/TextField/TextField.svelte +21 -18
  104. package/dist/components/Library/TextField/TextField.svelte.d.ts +4 -2
  105. package/dist/components/Library/TextShimmer/TextShimmer.demo.svelte +1 -1
  106. package/dist/components/Library/TimePicker/TimePicker.demo.svelte +10 -2
  107. package/dist/components/Library/TimePicker/TimePicker.svelte +10 -5
  108. package/dist/components/Library/TokenSearchField/TokenSearchField.demo.svelte +4 -2
  109. package/dist/components/Library/TokenSearchField/TokenSearchField.svelte +11 -11
  110. package/dist/components/Library/TokenSearchField/TokenSearchField.svelte.d.ts +2 -1
  111. package/dist/components/Library/WheelPicker/WheelColumn.svelte +183 -126
  112. package/dist/components/Library/WheelPicker/WheelPicker.svelte +4 -4
  113. package/dist/components/Library/WheelPicker/WheelPicker.svelte.d.ts +2 -2
  114. package/dist/components/Library/WheelPicker/index.d.ts +1 -1
  115. package/dist/components/Library/WheelPicker/types.d.ts +6 -0
  116. package/dist/components/Local/ColorStyleControls.svelte +201 -0
  117. package/dist/components/Local/ColorStyleControls.svelte.d.ts +13 -0
  118. package/dist/components/Local/HeroCard.svelte +3 -3
  119. package/dist/components/Local/LayoutStyleControls.svelte +67 -0
  120. package/dist/components/Local/LayoutStyleControls.svelte.d.ts +11 -0
  121. package/dist/components/Local/StyleControls.svelte +48 -124
  122. package/dist/components/Local/StyleControls.svelte.d.ts +7 -5
  123. package/dist/index.d.ts +9 -2
  124. package/dist/index.js +5 -1
  125. package/dist/style/index.css +7 -12
  126. package/dist/style/label.d.ts +2 -1
  127. package/dist/style/label.js +2 -1
  128. package/dist/style/surface.js +4 -0
  129. package/dist/style/text-editor.d.ts +2 -13
  130. package/dist/style/text-editor.js +1 -12
  131. package/dist/style/text.d.ts +26 -0
  132. package/dist/style/text.js +69 -0
  133. package/dist/style/tooltip.d.ts +4 -0
  134. package/dist/style/tooltip.js +1 -0
  135. package/dist/style.css +44 -111
  136. package/package.json +1 -1
  137. package/dist/components/Library/ArticleEditor/Blocks/ImagePreview.svelte +0 -71
  138. package/dist/components/Library/ArticleEditor/Blocks/ImagePreview.svelte.d.ts +0 -8
@@ -4,15 +4,39 @@
4
4
 
5
5
  type Props = {
6
6
  text: string;
7
+ background?: string;
8
+ color?: string;
9
+ fontSize?: number;
7
10
  };
8
11
 
9
- let { text }: Props = $props();
12
+ let { text, background, color, fontSize }: Props = $props();
13
+
14
+ const toRem = (value: number | undefined) =>
15
+ value === undefined ? undefined : `${value / 10}rem`;
16
+
17
+ const overlayStyle = $derived.by(() =>
18
+ [
19
+ background ? `--sveltely-loader-background: ${background};` : '',
20
+ color ? `--sveltely-loader-color: ${color};` : '',
21
+ fontSize !== undefined ? `--sveltely-loader-font-size: ${toRem(fontSize)};` : ''
22
+ ]
23
+ .filter(Boolean)
24
+ .join(' ')
25
+ );
10
26
  </script>
11
27
 
12
- <div class="sveltely-loader-overlay" role="status" aria-live="polite" aria-label={text}>
28
+ <div
29
+ class="sveltely-loader-overlay"
30
+ role="status"
31
+ aria-live="polite"
32
+ aria-label={text || 'Loading'}
33
+ style={overlayStyle}
34
+ >
13
35
  <VStack align="center" justify="center" gap={5}>
14
- <Spinner />
15
- <span class="sveltely-loader-text">{text}</span>
36
+ <Spinner size="calc(var(--sveltely-loader-font-size) * 1.143)" />
37
+ {#if text}
38
+ <span class="sveltely-loader-text">{text}</span>
39
+ {/if}
16
40
  </VStack>
17
41
  </div>
18
42
 
@@ -25,8 +49,9 @@
25
49
  align-items: center;
26
50
  justify-content: center;
27
51
  border-radius: inherit;
28
- background: var(--sveltely-background-color, white);
29
- color: var(--sveltely-primary-color, black);
52
+ background: var(--sveltely-loader-background, var(--sveltely-background-color, white));
53
+ color: var(--sveltely-loader-color, var(--sveltely-text-primary-color, black));
54
+ font-size: var(--sveltely-loader-font-size, var(--sveltely-font-size, 1rem));
30
55
  padding: var(--sveltely-padding-y, 0.75rem) var(--sveltely-padding-x, 0.75rem);
31
56
  pointer-events: auto;
32
57
  text-align: center;
@@ -35,8 +60,8 @@
35
60
  .sveltely-loader-text {
36
61
  max-width: 100%;
37
62
  overflow: hidden;
38
- color: var(--sveltely-secondary-color, currentColor);
39
- font-size: calc(var(--sveltely-font-size, 1rem) * 0.875);
63
+ color: var(--sveltely-loader-text-color, currentColor);
64
+ font-size: var(--sveltely-loader-font-size, var(--sveltely-font-size, 1rem));
40
65
  line-height: 1.25;
41
66
  text-overflow: ellipsis;
42
67
  white-space: nowrap;
@@ -1,5 +1,8 @@
1
1
  type Props = {
2
2
  text: string;
3
+ background?: string;
4
+ color?: string;
5
+ fontSize?: number;
3
6
  };
4
7
  declare const LoaderOverlay: import("svelte").Component<Props, {}, "">;
5
8
  type LoaderOverlay = ReturnType<typeof LoaderOverlay>;
@@ -5,6 +5,9 @@ export type LoaderOptions = LoaderTrigger | [text: string, loading: LoaderTrigge
5
5
  loading?: LoaderTrigger;
6
6
  active?: LoaderTrigger;
7
7
  promise?: PromiseLike<unknown> | null;
8
+ background?: string;
9
+ color?: string;
10
+ fontSize?: number;
8
11
  disabled?: boolean;
9
12
  };
10
13
  export declare const loader: Action<HTMLElement, LoaderOptions>;
@@ -8,21 +8,30 @@ const isPromiseLike = (value) => typeof value === 'object' &&
8
8
  const parseOptions = (value = false) => {
9
9
  if (Array.isArray(value)) {
10
10
  return {
11
- text: value[0] || DEFAULT_TEXT,
11
+ text: value[0] ?? DEFAULT_TEXT,
12
12
  loading: value[1],
13
+ background: undefined,
14
+ color: undefined,
15
+ fontSize: undefined,
13
16
  disabled: false
14
17
  };
15
18
  }
16
19
  if (typeof value === 'object' && value !== null && !isPromiseLike(value)) {
17
20
  return {
18
- text: value.text || DEFAULT_TEXT,
21
+ text: value.text ?? '',
19
22
  loading: value.loading ?? value.active ?? value.promise ?? false,
23
+ background: value.background,
24
+ color: value.color,
25
+ fontSize: value.fontSize,
20
26
  disabled: value.disabled ?? false
21
27
  };
22
28
  }
23
29
  return {
24
30
  text: DEFAULT_TEXT,
25
31
  loading: value,
32
+ background: undefined,
33
+ color: undefined,
34
+ fontSize: undefined,
26
35
  disabled: false
27
36
  };
28
37
  };
@@ -37,7 +46,7 @@ export const loader = (node, initialOptions = false) => {
37
46
  const originalAriaBusy = node.getAttribute('aria-busy');
38
47
  let options = parseOptions(initialOptions);
39
48
  let overlay = null;
40
- let overlayText = '';
49
+ let overlayKey = '';
41
50
  let promiseVersion = 0;
42
51
  let appliedPosition = false;
43
52
  const ensureHostPosition = () => {
@@ -57,17 +66,21 @@ export const loader = (node, initialOptions = false) => {
57
66
  const show = () => {
58
67
  ensureHostPosition();
59
68
  node.setAttribute('aria-busy', 'true');
60
- if (overlay && overlayText === options.text) {
69
+ const nextOverlayKey = [options.text, options.background, options.color, options.fontSize].join('\0');
70
+ if (overlay && overlayKey === nextOverlayKey) {
61
71
  return;
62
72
  }
63
73
  if (overlay) {
64
74
  void unmount(overlay);
65
75
  }
66
- overlayText = options.text;
76
+ overlayKey = nextOverlayKey;
67
77
  overlay = mount(LoaderOverlay, {
68
78
  target: node,
69
79
  props: {
70
- text: options.text
80
+ text: options.text,
81
+ background: options.background,
82
+ color: options.color,
83
+ fontSize: options.fontSize
71
84
  }
72
85
  });
73
86
  };
@@ -75,7 +88,7 @@ export const loader = (node, initialOptions = false) => {
75
88
  if (overlay) {
76
89
  void unmount(overlay);
77
90
  overlay = null;
78
- overlayText = '';
91
+ overlayKey = '';
79
92
  }
80
93
  if (originalAriaBusy === null) {
81
94
  node.removeAttribute('aria-busy');
@@ -1,6 +1,6 @@
1
1
  <script module lang="ts">
2
2
  export const demo = {
3
- name: 'AnimatedNumber',
3
+ name: 'Animated Number',
4
4
  description: 'Spring-driven numeric transitions.'
5
5
  };
6
6
  </script>
@@ -17,14 +17,8 @@
17
17
  </script>
18
18
 
19
19
  <div class="vstack center gap-3">
20
- <div class="text-3xl font-semibold text-[var(--sveltely-primary-color)]">
20
+ <div class="text-3xl font-semibold text-[var(--sveltely-text-primary-color)]">
21
21
  <AnimatedNumber {value} />
22
22
  </div>
23
- <Button
24
- label="Change number"
25
- background="var(--sveltely-active-color)"
26
- borderColor="var(--sveltely-active-color)"
27
- color="var(--sveltely-background-color)"
28
- onclick={bump}
29
- />
23
+ <Button label="Change number" onclick={bump} />
30
24
  </div>
@@ -162,6 +162,7 @@
162
162
  <VStack gap={12.5}>
163
163
  {#each faqBlocks as block (block.id)}
164
164
  <TextEditor
165
+ as="h2"
165
166
  autosize
166
167
  value={block.text ?? 'Frequently asked questions'}
167
168
  rows={1}
@@ -169,7 +170,6 @@
169
170
  onUpdateBlock(block.id, {
170
171
  text: (event.currentTarget as HTMLTextAreaElement).value
171
172
  })}
172
- className="text-2xl leading-tight font-semibold tracking-[-0.025em] text-zinc-950 placeholder:text-zinc-300"
173
173
  placeholder="FAQ title"
174
174
  />
175
175
  <FAQ {block} onUpdateItem={onUpdateFAQItem} />
@@ -1,8 +1,8 @@
1
1
  <script lang="ts">
2
2
  import VStack from '../VStack';
3
3
  import TextEditor from '../TextEditor';
4
- import ImagePreview from './Blocks/ImagePreview.svelte';
5
- import type { ArticleEditorArticle } from './types.js';
4
+ import Image from './Blocks/Image.svelte';
5
+ import type { ArticleEditorArticle, BlockDraft } from './types.js';
6
6
 
7
7
  let { article, draftTitle, draftImageAltText, onTitleChange, onImageAltTextChange } = $props<{
8
8
  article: ArticleEditorArticle;
@@ -11,47 +11,37 @@
11
11
  onTitleChange: (value: string) => void;
12
12
  onImageAltTextChange: (value: string) => void;
13
13
  }>();
14
+
15
+ const heroImageBlock = $derived<BlockDraft>({
16
+ id: article.id ? `${article.id}:hero-image` : 'article-hero-image',
17
+ order: -1,
18
+ type: 'image',
19
+ imageURL: article.imageURL,
20
+ imageAlt: draftImageAltText
21
+ });
22
+
23
+ const onHeroImageUpdate = (_id: string, patch: Partial<BlockDraft>) => {
24
+ if (patch.imageAlt === undefined) return;
25
+ onImageAltTextChange(patch.imageAlt ?? '');
26
+ };
14
27
  </script>
15
28
 
16
29
  <VStack gap={10}>
17
30
  <TextEditor
31
+ as="h1"
18
32
  autosize
19
33
  value={draftTitle}
20
34
  rows={1}
21
35
  spellcheck={true}
22
36
  onInput={(event) => onTitleChange((event.currentTarget as HTMLTextAreaElement).value)}
23
- className="text-4xl leading-tight font-semibold tracking-[-0.03em] text-zinc-950 placeholder:text-zinc-300"
24
37
  placeholder="Untitled article"
25
38
  />
26
39
 
27
40
  {#if article.imageURL}
28
- <ImagePreview
29
- src={article.imageURL}
30
- alt={draftImageAltText || article.title}
31
- aspectRatio="4 / 3"
32
- />
33
- <TextEditor
34
- autosize
35
- value={draftImageAltText}
36
- rows={1}
37
- onInput={(event) => onImageAltTextChange((event.currentTarget as HTMLTextAreaElement).value)}
38
- className="article-editor-hero-description"
39
- placeholder="Image description"
41
+ <Image
42
+ block={heroImageBlock}
43
+ titleFallback={draftTitle || article.title}
44
+ onUpdate={onHeroImageUpdate}
40
45
  />
41
46
  {/if}
42
47
  </VStack>
43
-
44
- <style>
45
- :global(.article-editor-hero-description) {
46
- border: 0;
47
- background: transparent;
48
- padding: 0;
49
- color: #3f3f46;
50
- font-size: 0.875rem;
51
- line-height: 1.5rem;
52
- }
53
-
54
- :global(.article-editor-hero-description::placeholder) {
55
- color: #d4d4d8;
56
- }
57
- </style>
@@ -16,6 +16,5 @@
16
16
  onUpdate(block.id, {
17
17
  code: (event.currentTarget as HTMLTextAreaElement).value
18
18
  })}
19
- className="bg-zinc-950 px-4 py-4 font-mono text-sm leading-6 text-zinc-100"
20
19
  placeholder="Code block"
21
20
  />
@@ -29,9 +29,9 @@
29
29
  placeholder="Question"
30
30
  />
31
31
  <TextEditor
32
+ as="paragraph"
32
33
  autosize
33
34
  rows={1}
34
- className="text-[15px] leading-7 text-zinc-700 placeholder:text-zinc-300"
35
35
  value={item.answer}
36
36
  onInput={(event) =>
37
37
  onUpdateItem(
@@ -1,5 +1,6 @@
1
1
  <script lang="ts">
2
2
  import TextEditor from '../../TextEditor';
3
+ import type { TextAs } from '../../../../style/text';
3
4
  import type { BlockDraft } from '../types.js';
4
5
 
5
6
  let {
@@ -21,9 +22,15 @@
21
22
  focusPosition?: number | null;
22
23
  onFocused?: () => void;
23
24
  }>();
25
+
26
+ const headingAs = $derived.by<TextAs>(() => {
27
+ const level = Math.min(6, Math.max(1, block.level ?? 2));
28
+ return `h${level}` as TextAs;
29
+ });
24
30
  </script>
25
31
 
26
32
  <TextEditor
33
+ as={headingAs}
27
34
  autosize
28
35
  rows={1}
29
36
  value={block.text ?? ''}
@@ -62,12 +69,5 @@
62
69
  {shouldFocus}
63
70
  {focusPosition}
64
71
  {onFocused}
65
- className={`placeholder:text-zinc-300 ${
66
- Number(block.level ?? 2) <= 1
67
- ? 'text-3xl font-semibold tracking-[-0.03em]'
68
- : Number(block.level ?? 2) === 2
69
- ? 'text-2xl font-semibold tracking-[-0.025em]'
70
- : 'text-xl font-semibold'
71
- }`}
72
72
  placeholder="Heading"
73
73
  />
@@ -1,6 +1,7 @@
1
1
  <script lang="ts">
2
+ import Image from '../../Image';
2
3
  import TextEditor from '../../TextEditor';
3
- import ImagePreview from './ImagePreview.svelte';
4
+ import VStack from '../../VStack';
4
5
  import type { BlockDraft } from '../types.js';
5
6
 
6
7
  let { block, titleFallback, onUpdate } = $props<{
@@ -10,39 +11,22 @@
10
11
  }>();
11
12
  </script>
12
13
 
13
- <div class="article-block-image">
14
- <ImagePreview src={block.imageURL} alt={block.imageAlt ?? titleFallback} />
15
- <div>
16
- <TextEditor
17
- autosize
18
- rows={1}
19
- className="article-block-image-description"
20
- value={block.imageAlt ?? ''}
21
- onInput={(event) =>
22
- onUpdate(block.id, {
23
- imageAlt: (event.currentTarget as HTMLTextAreaElement).value
24
- })}
25
- placeholder="Alt text"
26
- />
27
- </div>
28
- </div>
14
+ <VStack gap={10}>
15
+ <Image
16
+ src={block.imageURL}
17
+ alt={block.imageAlt ?? titleFallback}
18
+ fit="cover"
19
+ aspectRatio="4 / 3"
20
+ />
29
21
 
30
- <style>
31
- .article-block-image {
32
- display: grid;
33
- gap: 1rem;
34
- }
35
-
36
- :global(.article-block-image-description) {
37
- border: 0;
38
- background: transparent;
39
- padding: 0;
40
- color: #3f3f46;
41
- font-size: 0.875rem;
42
- line-height: 1.5rem;
43
- }
44
-
45
- :global(.article-block-image-description::placeholder) {
46
- color: #d4d4d8;
47
- }
48
- </style>
22
+ <TextEditor
23
+ as="paragraph"
24
+ autosize
25
+ rows={1}
26
+ value={block.imageAlt ?? ''}
27
+ onInput={(event) =>
28
+ onUpdate(block.id, {
29
+ imageAlt: (event.currentTarget as HTMLTextAreaElement).value
30
+ })}
31
+ />
32
+ </VStack>
@@ -1,3 +1,4 @@
1
+ import Image from '../../Image';
1
2
  import type { BlockDraft } from '../types.js';
2
3
  type $$ComponentProps = {
3
4
  block: BlockDraft;
@@ -66,6 +66,7 @@
66
66
  {#each block.items ?? [] as item, index}
67
67
  <li class="article-editor-list-item pl-2">
68
68
  <TextEditor
69
+ as="paragraph"
69
70
  autosize
70
71
  rows={1}
71
72
  value={item}
@@ -75,7 +76,6 @@
75
76
  shouldFocus={focusItemIndex === index}
76
77
  focusPosition={focusItemIndex === index ? focusPosition : null}
77
78
  {onFocused}
78
- className="text-[17px] leading-7 text-zinc-700 placeholder:text-zinc-300"
79
79
  placeholder="List item"
80
80
  />
81
81
  </li>
@@ -88,6 +88,7 @@
88
88
  {#each block.items ?? [] as item, index}
89
89
  <li class="article-editor-list-item pl-2">
90
90
  <TextEditor
91
+ as="paragraph"
91
92
  autosize
92
93
  rows={1}
93
94
  value={item}
@@ -97,7 +98,6 @@
97
98
  shouldFocus={focusItemIndex === index}
98
99
  focusPosition={focusItemIndex === index ? focusPosition : null}
99
100
  {onFocused}
100
- className="text-[17px] leading-7 text-zinc-700 placeholder:text-zinc-300"
101
101
  placeholder="List item"
102
102
  />
103
103
  </li>
@@ -26,6 +26,7 @@
26
26
  </script>
27
27
 
28
28
  <TextEditor
29
+ as="paragraph"
29
30
  autosize
30
31
  rows={1}
31
32
  value={block.text ?? ''}
@@ -74,6 +75,5 @@
74
75
  {shouldFocus}
75
76
  {focusPosition}
76
77
  {onFocused}
77
- className="text-[17px] leading-8 text-zinc-700 placeholder:text-zinc-300"
78
78
  placeholder="Type something thoughtful..."
79
79
  />
@@ -2,7 +2,6 @@ export { default as Code } from './Code.svelte';
2
2
  export { default as FAQ } from './FAQ.svelte';
3
3
  export { default as Heading } from './Heading.svelte';
4
4
  export { default as Image } from './Image.svelte';
5
- export { default as ImagePreview } from './ImagePreview.svelte';
6
5
  export { default as List } from './List.svelte';
7
6
  export { default as Paragraph } from './Paragraph.svelte';
8
7
  export { default as Table } from './Table.svelte';
@@ -2,7 +2,6 @@ export { default as Code } from './Code.svelte';
2
2
  export { default as FAQ } from './FAQ.svelte';
3
3
  export { default as Heading } from './Heading.svelte';
4
4
  export { default as Image } from './Image.svelte';
5
- export { default as ImagePreview } from './ImagePreview.svelte';
6
5
  export { default as List } from './List.svelte';
7
6
  export { default as Paragraph } from './Paragraph.svelte';
8
7
  export { default as Table } from './Table.svelte';
@@ -1,6 +1,6 @@
1
1
  <script module lang="ts">
2
2
  export const demo = {
3
- name: 'AsyncButton',
3
+ name: 'Async Button',
4
4
  description: 'Async action button with loading and error states.'
5
5
  };
6
6
  </script>
@@ -16,8 +16,4 @@
16
16
  };
17
17
  </script>
18
18
 
19
- <AsyncButton
20
- icon={SaveIcon}
21
- label="Run async action"
22
- action={runDemo}
23
- />
19
+ <AsyncButton icon={SaveIcon} label="Run async action" action={runDemo} />
@@ -2,10 +2,10 @@
2
2
  import { CircleAlertIcon } from '@lucide/svelte';
3
3
  import type { Component } from 'svelte';
4
4
  import type { HTMLButtonAttributes } from 'svelte/elements';
5
- import { tooltip } from '../../../actions/tooltip';
6
5
  import Button from '../Button';
7
6
  import Spinner from '../Spinner';
8
7
  import { extractStyleProps, type StyleProps } from '../../../style/surface';
8
+ import type { TooltipProps } from '../../../style/tooltip';
9
9
 
10
10
  type Props = {
11
11
  icon?: Component<{ class?: string; size?: number | string }>;
@@ -19,6 +19,7 @@
19
19
  iconSize?: number | string;
20
20
  labelColor?: string;
21
21
  } & StyleProps &
22
+ TooltipProps &
22
23
  Omit<HTMLButtonAttributes, 'children' | 'onclick' | 'class' | 'style'>;
23
24
 
24
25
  let {
@@ -32,6 +33,7 @@
32
33
  iconColor,
33
34
  iconSize,
34
35
  labelColor,
36
+ tooltip,
35
37
  disabled = false,
36
38
  type = 'button',
37
39
  ...restProps
@@ -48,9 +50,9 @@
48
50
  const effectiveDisabled = $derived(disabled || (disableWhileLoading && effectiveLoading));
49
51
  const buttonStyleProps = $derived({
50
52
  ...styleProps,
51
- background: styleProps.background ?? 'var(--sveltely-active-color)',
52
- borderColor: styleProps.borderColor ?? 'var(--sveltely-active-color)',
53
- color: styleProps.color ?? 'var(--sveltely-background-color)'
53
+ background: styleProps.background ?? 'var(--sveltely-control-active-color)',
54
+ borderColor: styleProps.borderColor ?? 'var(--sveltely-control-active-color)',
55
+ color: styleProps.color ?? 'var(--sveltely-control-background-color)'
54
56
  });
55
57
 
56
58
  const handleClick = async () => {
@@ -81,6 +83,7 @@
81
83
  if (error instanceof Error && error.message.trim().length > 0) return error.message;
82
84
  return 'Something went wrong';
83
85
  });
86
+ const resolvedTooltip = $derived(errorLabel ? { label: errorLabel } : tooltip);
84
87
 
85
88
  const toRem = (value: number | string | undefined) =>
86
89
  value === undefined ? undefined : typeof value === 'number' ? `${value}rem` : value;
@@ -106,10 +109,11 @@
106
109
  });
107
110
  </script>
108
111
 
109
- <span use:tooltip={{ label: errorLabel ?? '', disabled: !errorLabel }} class="async-button">
112
+ <span class="async-button">
110
113
  <Button
111
114
  {type}
112
115
  {...buttonStyleProps}
116
+ tooltip={resolvedTooltip}
113
117
  disabled={effectiveDisabled}
114
118
  aria-busy={effectiveLoading}
115
119
  aria-label={variant === 'iconOnly' ? label : undefined}
@@ -1,6 +1,7 @@
1
1
  import type { Component } from 'svelte';
2
2
  import type { HTMLButtonAttributes } from 'svelte/elements';
3
3
  import { type StyleProps } from '../../../style/surface';
4
+ import type { TooltipProps } from '../../../style/tooltip';
4
5
  type Props = {
5
6
  icon?: Component<{
6
7
  class?: string;
@@ -15,7 +16,7 @@ type Props = {
15
16
  iconColor?: string;
16
17
  iconSize?: number | string;
17
18
  labelColor?: string;
18
- } & StyleProps & Omit<HTMLButtonAttributes, 'children' | 'onclick' | 'class' | 'style'>;
19
+ } & StyleProps & TooltipProps & Omit<HTMLButtonAttributes, 'children' | 'onclick' | 'class' | 'style'>;
19
20
  declare const AsyncButton: Component<Props, {}, "error">;
20
21
  type AsyncButton = ReturnType<typeof AsyncButton>;
21
22
  export default AsyncButton;
@@ -1,27 +1,12 @@
1
1
  <script module lang="ts">
2
2
  export const demo = {
3
3
  name: 'Button',
4
- description: 'Token-aware button primitive with composable content.',
5
- columnSpan: 2
4
+ description: 'Basic button component.'
6
5
  };
7
6
  </script>
8
7
 
9
8
  <script lang="ts">
10
- import { SaveIcon } from '@lucide/svelte';
11
9
  import Button from './Button.svelte';
12
- import HStack from '../HStack';
13
10
  </script>
14
11
 
15
- <HStack align="center" gap={7.5}>
16
- <Button label="Default" />
17
- <Button
18
- label="Solid"
19
- background="var(--sveltely-active-color)"
20
- borderColor="var(--sveltely-active-color)"
21
- color="var(--sveltely-background-color)"
22
- />
23
- <Button>
24
- <SaveIcon />
25
- <span>With icon</span>
26
- </Button>
27
- </HStack>
12
+ <Button label="Button" />
@@ -1,7 +1,6 @@
1
1
  export declare const demo: {
2
2
  name: string;
3
3
  description: string;
4
- columnSpan: number;
5
4
  };
6
5
  import Button from './Button.svelte';
7
6
  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> {