@widgetic/design-system 0.5.39 → 0.5.41

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 (143) hide show
  1. package/README.md +73 -0
  2. package/dist/components/ContentRefreshOverlay.svelte +103 -0
  3. package/dist/components/ContentRefreshOverlay.svelte.d.ts +18 -0
  4. package/dist/components/chat/Composer.svelte +381 -20
  5. package/dist/components/chat/Composer.svelte.d.ts +88 -1
  6. package/dist/components/chat/PlanCard.svelte +218 -88
  7. package/dist/components/chat/PlanCard.svelte.d.ts +11 -0
  8. package/dist/components/chat/QuestionCard.svelte +180 -70
  9. package/dist/components/chat/QuestionCard.svelte.d.ts +28 -2
  10. package/dist/components/chat/QuestionCardSummary.svelte +96 -0
  11. package/dist/components/chat/QuestionCardSummary.svelte.d.ts +20 -0
  12. package/dist/components/chat/QueueCard.svelte +185 -0
  13. package/dist/components/chat/QueueCard.svelte.d.ts +40 -0
  14. package/dist/components/chat/composerLogic.d.ts +31 -0
  15. package/dist/components/chat/composerLogic.js +37 -0
  16. package/dist/components/chat/composerReferences.d.ts +28 -0
  17. package/dist/components/chat/composerReferences.js +23 -0
  18. package/dist/components/chat/index.d.ts +8 -3
  19. package/dist/components/chat/index.js +10 -2
  20. package/dist/components/chat/questionCardLogic.d.ts +40 -3
  21. package/dist/components/chat/questionCardLogic.js +54 -3
  22. package/dist/components/chat/queueCardLogic.d.ts +7 -0
  23. package/dist/components/chat/queueCardLogic.js +5 -0
  24. package/dist/components/creator/index.d.ts +1 -2
  25. package/dist/components/creator/index.js +2 -0
  26. package/dist/components/filters/FilterByButton.svelte +2 -1
  27. package/dist/components/index.d.ts +8 -7
  28. package/dist/components/index.js +8 -6
  29. package/dist/components/modals/BaseModal.svelte +14 -4
  30. package/dist/components/navigation/Breadcrumbs.svelte +1 -1
  31. package/dist/components/navigation/breadcrumbSlideIn.d.ts +6 -2
  32. package/dist/components/navigation/breadcrumbSlideIn.js +6 -6
  33. package/dist/components/search-input/SearchInput.svelte +282 -14
  34. package/dist/components/search-input/SearchInput.svelte.d.ts +3 -0
  35. package/dist/components/search-input/index.d.ts +1 -0
  36. package/dist/components/search-input/index.js +1 -0
  37. package/dist/components/search-input/index2.d.ts +4 -0
  38. package/dist/components/search-input/recentSearches.d.ts +12 -0
  39. package/dist/components/search-input/recentSearches.js +124 -0
  40. package/dist/components/toast/ToasterModal.svelte +8 -2
  41. package/dist/components/toast/ToasterModal.svelte.d.ts +2 -0
  42. package/dist/components/ui/chip/chip.svelte +39 -1
  43. package/dist/components/ui/chip/chip.svelte.d.ts +8 -0
  44. package/dist/components/ui/chip/chipProgress.d.ts +14 -0
  45. package/dist/components/ui/chip/chipProgress.js +21 -0
  46. package/dist/components/ui/dropdown-menu/dropdown-menu-content.svelte +1 -1
  47. package/dist/components/ui/dropdown-menu/dropdown-menu-sub-content.svelte +1 -1
  48. package/dist/components/ui/icon-button/icon-button.svelte +2 -0
  49. package/dist/components/ui/icon-button/icon-button.svelte.d.ts +5 -0
  50. package/dist/components/ui/number-controls/index.d.ts +2 -0
  51. package/dist/components/ui/number-controls/index.js +2 -0
  52. package/dist/components/ui/number-controls/number-controls.svelte +530 -0
  53. package/dist/components/ui/number-controls/number-controls.svelte.d.ts +46 -0
  54. package/dist/components/ui/number-controls/numberControlsSteps.d.ts +17 -0
  55. package/dist/components/ui/number-controls/numberControlsSteps.js +23 -0
  56. package/dist/components/ui/number-controls/numberControlsValueArea.d.ts +29 -0
  57. package/dist/components/ui/number-controls/numberControlsValueArea.js +51 -0
  58. package/dist/components/ui/text-flip/index.d.ts +1 -0
  59. package/dist/components/ui/text-flip/index.js +1 -0
  60. package/dist/components/ui/text-flip/text-flip.svelte +103 -0
  61. package/dist/components/ui/text-flip/text-flip.svelte.d.ts +15 -0
  62. package/dist/components/ui/text-flip/textFlipLogic.d.ts +49 -0
  63. package/dist/components/ui/text-flip/textFlipLogic.js +151 -0
  64. package/dist/inline-completion/completionAnswer.d.ts +11 -0
  65. package/dist/inline-completion/completionAnswer.js +49 -0
  66. package/dist/inline-completion/completionCache.d.ts +24 -0
  67. package/dist/inline-completion/completionCache.js +47 -0
  68. package/dist/inline-completion/completionController.d.ts +61 -0
  69. package/dist/inline-completion/completionController.js +280 -0
  70. package/dist/inline-completion/completionKeys.d.ts +21 -0
  71. package/dist/inline-completion/completionKeys.js +19 -0
  72. package/dist/inline-completion/completionText.d.ts +53 -0
  73. package/dist/inline-completion/completionText.js +79 -0
  74. package/dist/inline-completion/completionTypes.d.ts +71 -0
  75. package/dist/inline-completion/completionTypes.js +5 -0
  76. package/dist/inline-completion/gatewayCompletion.d.ts +37 -0
  77. package/dist/inline-completion/gatewayCompletion.js +77 -0
  78. package/dist/inline-completion/ghostTap.d.ts +19 -0
  79. package/dist/inline-completion/ghostTap.js +20 -0
  80. package/dist/inline-completion/hintMemory.d.ts +43 -0
  81. package/dist/inline-completion/hintMemory.js +90 -0
  82. package/dist/inline-completion/httpSource.d.ts +40 -0
  83. package/dist/inline-completion/httpSource.js +149 -0
  84. package/dist/inline-completion/index.d.ts +30 -0
  85. package/dist/inline-completion/index.js +20 -0
  86. package/dist/inline-completion/inlineCompletionAction.d.ts +54 -0
  87. package/dist/inline-completion/inlineCompletionAction.js +310 -0
  88. package/dist/inline-completion/outcomeReporter.d.ts +49 -0
  89. package/dist/inline-completion/outcomeReporter.js +139 -0
  90. package/dist/inline-completion/promiseLike.d.ts +9 -0
  91. package/dist/inline-completion/promiseLike.js +9 -0
  92. package/dist/prompt-references/ReferenceMenu.svelte +344 -0
  93. package/dist/prompt-references/ReferenceMenu.svelte.d.ts +26 -0
  94. package/dist/prompt-references/index.d.ts +27 -0
  95. package/dist/prompt-references/index.js +20 -0
  96. package/dist/prompt-references/neutralizingSource.d.ts +21 -0
  97. package/dist/prompt-references/neutralizingSource.js +29 -0
  98. package/dist/prompt-references/promptReferences.d.ts +28 -0
  99. package/dist/prompt-references/promptReferences.js +766 -0
  100. package/dist/prompt-references/referenceBadge.d.ts +61 -0
  101. package/dist/prompt-references/referenceBadge.js +82 -0
  102. package/dist/prompt-references/referenceBadgePainter.d.ts +31 -0
  103. package/dist/prompt-references/referenceBadgePainter.js +106 -0
  104. package/dist/prompt-references/referenceEditing.d.ts +60 -0
  105. package/dist/prompt-references/referenceEditing.js +135 -0
  106. package/dist/prompt-references/referenceLabels.d.ts +56 -0
  107. package/dist/prompt-references/referenceLabels.js +215 -0
  108. package/dist/prompt-references/referenceMeasure.d.ts +12 -0
  109. package/dist/prompt-references/referenceMeasure.js +63 -0
  110. package/dist/prompt-references/referenceMenuHost.svelte.d.ts +29 -0
  111. package/dist/prompt-references/referenceMenuHost.svelte.js +43 -0
  112. package/dist/prompt-references/referenceMenuKeys.d.ts +26 -0
  113. package/dist/prompt-references/referenceMenuKeys.js +49 -0
  114. package/dist/prompt-references/referenceMenuPlacement.d.ts +63 -0
  115. package/dist/prompt-references/referenceMenuPlacement.js +66 -0
  116. package/dist/prompt-references/referenceTokens.d.ts +175 -0
  117. package/dist/prompt-references/referenceTokens.js +332 -0
  118. package/dist/prompt-references/referenceTrigger.d.ts +52 -0
  119. package/dist/prompt-references/referenceTrigger.js +100 -0
  120. package/dist/prompt-references/referenceTypes.d.ts +38 -0
  121. package/dist/prompt-references/referenceTypes.js +4 -0
  122. package/dist/prompt-references/sentReferences.d.ts +50 -0
  123. package/dist/prompt-references/sentReferences.js +122 -0
  124. package/dist/styles/tokens.css +58 -0
  125. package/dist/textarea-overlay/index.d.ts +9 -0
  126. package/dist/textarea-overlay/index.js +7 -0
  127. package/dist/textarea-overlay/mirrorSegments.d.ts +31 -0
  128. package/dist/textarea-overlay/mirrorSegments.js +47 -0
  129. package/dist/textarea-overlay/mirrorSizing.d.ts +39 -0
  130. package/dist/textarea-overlay/mirrorSizing.js +40 -0
  131. package/dist/textarea-overlay/textareaOverlay.d.ts +25 -0
  132. package/dist/textarea-overlay/textareaOverlay.js +277 -0
  133. package/dist/utils/overlayMotion.d.ts +1 -0
  134. package/dist/utils/overlayMotion.js +3 -3
  135. package/dist/utils/reducedMotion.d.ts +9 -0
  136. package/dist/utils/reducedMotion.js +13 -0
  137. package/package.json +16 -1
  138. package/dist/components/ui/number-stepper/index.d.ts +0 -3
  139. package/dist/components/ui/number-stepper/index.js +0 -3
  140. package/dist/components/ui/number-stepper/number-stepper.svelte +0 -212
  141. package/dist/components/ui/number-stepper/number-stepper.svelte.d.ts +0 -24
  142. package/dist/components/ui/number-stepper/numberStepperSteps.d.ts +0 -26
  143. package/dist/components/ui/number-stepper/numberStepperSteps.js +0 -45
@@ -1,16 +1,15 @@
1
+ export { default as ContentRefreshOverlay } from './ContentRefreshOverlay.svelte';
1
2
  export { default as CopyableHeader } from './CopyableHeader.svelte';
2
3
  export { default as EmptyState } from './EmptyState.svelte';
3
4
  export { default as GenerateLoader } from './GenerateLoader.svelte';
4
5
  export { default as PasswordInput } from './PasswordInput.svelte';
5
6
  export { default as ThumbHashImage } from './ThumbHashImage.svelte';
6
7
  export { default as WScrollArea } from './WScrollArea.svelte';
7
- export { Composer, type ComposerMessages, type ComposerProps, Message, type MessageMessages, type MessageProps, type MessageRole, ActivityRow, type ActivityRowProps, type ActivityRowStatus, OptionRow, type OptionRowProps, type OptionRowSelectionMode, TaskRow, type TaskRowProps, type TaskRowStatus, ScrollToBottom, type ScrollToBottomProps, canSendText, clampTextareaHeight, shouldSendOnKeyDown, ChatHeader, PlanCard, QuestionCard, canSubmitQuestion, formatQuestionStep, isFirstQuestion, isLastQuestion, moveFocusedIndex, optionItemRole, primaryQuestionLabel, selectionRole, toggleOption, SuggestionCard } from './chat';
8
- export { CreatorBar, CanvasBoardStatusChip } from './creator';
9
- export type { CanvasBoardStatusChipVariant } from './creator';
8
+ export { Composer, type ComposerCompletion, type ComposerEditing, type ComposerMessages, type ComposerProps, type ComposerReferenceMessages, type ComposerReferences, type ComposerSendOptions, assignReferenceLabel, genericLabelNumber, isValidReferenceLabel, referenceOccurrences, removeTokensOfLabel, unbadgeTokensWithoutFiles, type CollectedReference, type ReferenceHoverEvent, type ReferenceItem, QueueCard, type QueueCardItem, type QueueCardMessages, type QueueCardProps, queueRowMode, type QueueRowMode, Message, type MessageMessages, type MessageProps, type MessageRole, ChatAlertCard, type ChatAlertCardProps, ActivityRow, type ActivityRowProps, type ActivityRowStatus, OptionRow, type OptionRowProps, type OptionRowSelectionMode, TaskRow, type TaskRowProps, type TaskRowStatus, ScrollToBottom, type ScrollToBottomProps, canSendText, clampTextareaHeight, composerPrimaryAction, enterKeyAction, isQueueableText, shouldSendOnKeyDown, type ComposerPrimaryAction, type ComposerPrimaryState, ChatHeader, PlanCard, QuestionCard, QuestionCardSummary, type QuestionCardSummaryMessages, areAllQuestionsSkipped, canAdvanceQuestion, canStepBack, canStepForward, canSubmitQuestion, collectQuestionSelections, formatQuestionStep, isFirstQuestion, isLastQuestion, isQuestionSkipped, moveFocusedIndex, optionItemRole, primaryQuestionLabel, questionCardTitle, selectionRole, showsQuestionPager, stepQuestionIndex, toggleOption, type QuestionSummaryItem, SuggestionCard, MessageRatingActions, MessageCheckpointRow, shouldShowConsoleButton, shouldShowPinButton, shouldRenderMessageRatingBar, shouldShowCopyAction, shouldShowRatingActions, shouldShowRegenerateAction, thumbIsPressed, type VersionThumb, selectedModelLabel, shouldShowComposerModelMenu, type ComposerModelOption } from './chat';
10
9
  export { ColorPicker, type ColorPickerMessages, type ColorPickerProps, normalizeHex, hexToHsv, hsvToHex, type Hsv } from './color-picker';
11
- export { FilterByButton, SortDirectionButton, type FilterByOption, type SortDirection } from './filters';
12
- export { default as HintTooltip } from './tooltip/HintTooltip.svelte';
10
+ export { CreatorBar, CanvasBoardStatusChip, type CanvasBoardStatusChipVariant } from './creator';
13
11
  export { default as DebugGrid } from './debug-grid/DebugGrid.svelte';
12
+ export { FilterByButton, type FilterByOption, SortDirectionButton, type SortDirection } from './filters';
14
13
  export { FontPicker, type FontPickerMessages, type FontPickerProps, filterFonts, fontFamilyCss, type FontPickerFont } from './font-picker';
15
14
  export { default as BrowserInputController } from './ic/browser/BrowserInputController.svelte';
16
15
  export { default as ActionModal } from './modals/ActionModal.svelte';
@@ -20,10 +19,11 @@ export { default as Portal } from './modals/Portal.svelte';
20
19
  export { default as RenameDialog } from './modals/RenameDialog.svelte';
21
20
  export { Breadcrumbs, type BreadcrumbsProps } from './navigation';
22
21
  export { default as PDFViewer } from './pdf/PDFViewer.svelte';
23
- export { SearchInput } from './search-input';
22
+ export { SearchInput, readRecentSearches, rememberRecentSearch, clearRecentSearches } from './search-input';
24
23
  export { ShadEditor, checkShadEditorMessages, type ShadEditorMessageKey, type TipTapEditor, type TipTapEditorLevel } from './shad-editor';
25
24
  export { NavRow, navRowVariants, NavSectionLabel, ProfileRow, profileRowVariants, Sidebar, WidgetRow, widgetRowVariants, PageHeader, TopBar, NavDrawer, AppShell, ErrorState, defaultErrorStateMessages, type ErrorStateMessages, NotificationRow, type NotificationRowProps, NotificationDetail, type NotificationDetailProps, SettingsNav, type SettingsNavProps, SettingsDialog, type SettingsDialogProps, Stat, type StatProps, statVariants, Banner, type BannerProps, type BannerTone, bannerVariants, Link, type LinkProps, type LinkSize, linkVariants, type SettingsNavGroup, type SettingsNavItem, settingsNavItemIsActive, externalLinkAttributes, statHintClass, type StatTone } from './shell';
26
25
  export { ToasterModal, showToast } from './toast';
26
+ export { default as HintTooltip } from './tooltip/HintTooltip.svelte';
27
27
  export * as Accordion from './ui/accordion';
28
28
  export * as Alert from './ui/alert';
29
29
  export { avatarInitials, avatarVariants, type AvatarSize, Avatar } from './ui/avatar';
@@ -45,6 +45,7 @@ export { IconButton, iconButtonVariants, type IconButtonProps, type IconButtonSi
45
45
  export { Input } from './ui/input';
46
46
  export * as InputOtp from './ui/input-otp';
47
47
  export { Label } from './ui/label';
48
+ export { NumberControls } from './ui/number-controls';
48
49
  export * as Popover from './ui/popover';
49
50
  export { Progress } from './ui/progress';
50
51
  export * as RadioGroup from './ui/radio-group';
@@ -56,11 +57,11 @@ export { Skeleton } from './ui/skeleton';
56
57
  export { Slider, type SliderProps } from './ui/slider';
57
58
  export { Toaster, toast } from './ui/sonner';
58
59
  export { StepperButton } from './ui/stepper-button';
59
- export { NumberStepper } from './ui/number-stepper';
60
60
  export { Switch } from './ui/switch';
61
61
  export * as Table from './ui/table';
62
62
  export * as Tabs from './ui/tabs';
63
63
  export { Tag } from './ui/tag';
64
+ export { TextFlip } from './ui/text-flip';
64
65
  export { Textarea, type TextareaEvents, type FormTextareaEvent } from './ui/textarea';
65
66
  export { toggleVariants, type ToggleSize, type ToggleVariant, type ToggleVariants, Toggle } from './ui/toggle';
66
67
  export * as ToggleGroup from './ui/toggle-group';
@@ -1,16 +1,16 @@
1
1
  // Component exports
2
+ export { default as ContentRefreshOverlay } from './ContentRefreshOverlay.svelte';
2
3
  export { default as CopyableHeader } from './CopyableHeader.svelte';
3
4
  export { default as EmptyState } from './EmptyState.svelte';
4
5
  export { default as GenerateLoader } from './GenerateLoader.svelte';
5
6
  export { default as PasswordInput } from './PasswordInput.svelte';
6
7
  export { default as ThumbHashImage } from './ThumbHashImage.svelte';
7
8
  export { default as WScrollArea } from './WScrollArea.svelte';
8
- export { Composer, Message, ActivityRow, OptionRow, TaskRow, ScrollToBottom, canSendText, clampTextareaHeight, shouldSendOnKeyDown, ChatHeader, PlanCard, QuestionCard, canSubmitQuestion, formatQuestionStep, isFirstQuestion, isLastQuestion, moveFocusedIndex, optionItemRole, primaryQuestionLabel, selectionRole, toggleOption, SuggestionCard } from './chat';
9
- export { CreatorBar, CanvasBoardStatusChip } from './creator';
9
+ export { Composer, assignReferenceLabel, genericLabelNumber, isValidReferenceLabel, referenceOccurrences, removeTokensOfLabel, unbadgeTokensWithoutFiles, QueueCard, queueRowMode, Message, ChatAlertCard, ActivityRow, OptionRow, TaskRow, ScrollToBottom, canSendText, clampTextareaHeight, composerPrimaryAction, enterKeyAction, isQueueableText, shouldSendOnKeyDown, ChatHeader, PlanCard, QuestionCard, QuestionCardSummary, areAllQuestionsSkipped, canAdvanceQuestion, canStepBack, canStepForward, canSubmitQuestion, collectQuestionSelections, formatQuestionStep, isFirstQuestion, isLastQuestion, isQuestionSkipped, moveFocusedIndex, optionItemRole, primaryQuestionLabel, questionCardTitle, selectionRole, showsQuestionPager, stepQuestionIndex, toggleOption, SuggestionCard, MessageRatingActions, MessageCheckpointRow, shouldShowConsoleButton, shouldShowPinButton, shouldRenderMessageRatingBar, shouldShowCopyAction, shouldShowRatingActions, shouldShowRegenerateAction, thumbIsPressed, selectedModelLabel, shouldShowComposerModelMenu } from './chat';
10
10
  export { ColorPicker, normalizeHex, hexToHsv, hsvToHex } from './color-picker';
11
- export { FilterByButton, SortDirectionButton } from './filters';
12
- export { default as HintTooltip } from './tooltip/HintTooltip.svelte';
11
+ export { CreatorBar, CanvasBoardStatusChip } from './creator';
13
12
  export { default as DebugGrid } from './debug-grid/DebugGrid.svelte';
13
+ export { FilterByButton, SortDirectionButton } from './filters';
14
14
  export { FontPicker, filterFonts, fontFamilyCss } from './font-picker';
15
15
  export { default as BrowserInputController } from './ic/browser/BrowserInputController.svelte';
16
16
  export { default as ActionModal } from './modals/ActionModal.svelte';
@@ -20,10 +20,11 @@ export { default as Portal } from './modals/Portal.svelte';
20
20
  export { default as RenameDialog } from './modals/RenameDialog.svelte';
21
21
  export { Breadcrumbs } from './navigation';
22
22
  export { default as PDFViewer } from './pdf/PDFViewer.svelte';
23
- export { SearchInput } from './search-input';
23
+ export { SearchInput, readRecentSearches, rememberRecentSearch, clearRecentSearches } from './search-input';
24
24
  export { ShadEditor, checkShadEditorMessages } from './shad-editor';
25
25
  export { NavRow, navRowVariants, NavSectionLabel, ProfileRow, profileRowVariants, Sidebar, WidgetRow, widgetRowVariants, PageHeader, TopBar, NavDrawer, AppShell, ErrorState, defaultErrorStateMessages, NotificationRow, NotificationDetail, SettingsNav, SettingsDialog, Stat, statVariants, Banner, bannerVariants, Link, linkVariants, settingsNavItemIsActive, externalLinkAttributes, statHintClass } from './shell';
26
26
  export { ToasterModal, showToast } from './toast';
27
+ export { default as HintTooltip } from './tooltip/HintTooltip.svelte';
27
28
  export * as Accordion from './ui/accordion';
28
29
  export * as Alert from './ui/alert';
29
30
  export { avatarInitials, avatarVariants, Avatar } from './ui/avatar';
@@ -45,6 +46,7 @@ export { IconButton, iconButtonVariants } from './ui/icon-button';
45
46
  export { Input } from './ui/input';
46
47
  export * as InputOtp from './ui/input-otp';
47
48
  export { Label } from './ui/label';
49
+ export { NumberControls } from './ui/number-controls';
48
50
  export * as Popover from './ui/popover';
49
51
  export { Progress } from './ui/progress';
50
52
  export * as RadioGroup from './ui/radio-group';
@@ -56,11 +58,11 @@ export { Skeleton } from './ui/skeleton';
56
58
  export { Slider } from './ui/slider';
57
59
  export { Toaster, toast } from './ui/sonner';
58
60
  export { StepperButton } from './ui/stepper-button';
59
- export { NumberStepper } from './ui/number-stepper';
60
61
  export { Switch } from './ui/switch';
61
62
  export * as Table from './ui/table';
62
63
  export * as Tabs from './ui/tabs';
63
64
  export { Tag } from './ui/tag';
65
+ export { TextFlip } from './ui/text-flip';
64
66
  export { Textarea } from './ui/textarea';
65
67
  export { toggleVariants, Toggle } from './ui/toggle';
66
68
  export * as ToggleGroup from './ui/toggle-group';
@@ -103,15 +103,25 @@
103
103
  $: cardChromeHeight = 2 * CARD_BORDER + (bare ? 0 : 2 * CARD_PADDING);
104
104
  // The title row (a bare modal has none) and the gap under it: 8px for a small title padding, 16px for a large one.
105
105
  $: titleRowHeight = bare ? 0 : titleHeight + (titlePadding === 'small' ? 8 : 16);
106
- // The card is exactly as tall as its content, the title row and what the card draws around them.
107
- $: allContentHeight = cardChromeHeight + titleRowHeight + contentHolderHeight;
106
+ /** When callers pass an exact pixel height (Figma-sized action modals), use it instead of measured content (+2px from line metrics). */
107
+ $: fixedOuterHeightPx = (() => {
108
+ if (animateSize) return null;
109
+ const match = /^(\d+(?:\.\d+)?)px\s*$/.exec(height.trim());
110
+ return match ? Number(match[1]) : null;
111
+ })();
112
+ // The card is exactly as tall as its content, the title row and what the card draws around them — unless height is fixed.
113
+ $: measuredOuterHeight = cardChromeHeight + titleRowHeight + contentHolderHeight;
114
+ $: allContentHeight = fixedOuterHeightPx ?? measuredOuterHeight;
108
115
 
109
116
  // Title vars
110
117
  let titleHeight = 0;
111
118
 
112
119
  // Content only vars
113
120
  let contentHolderHeight = 0;
114
- $: contentAvailableHeight = Math.max(0, modalHeight - cardChromeHeight - titleRowHeight);
121
+ $: contentAvailableHeight = Math.max(
122
+ 0,
123
+ (fixedOuterHeightPx ?? modalHeight) - cardChromeHeight - titleRowHeight
124
+ );
115
125
  let updateContentDimInterval: any;
116
126
 
117
127
  /** Stays true until exit transitions finish or the instance is destroyed. */
@@ -447,7 +457,7 @@
447
457
  aria-label={title ? undefined : ariaLabel}
448
458
  tabindex="-1"
449
459
  data-widgetic-overlay="base-modal-panel"
450
- class="modal-content-inner-container bg-background border-border rounded-panel pointer-events-auto relative max-h-[calc(100vh-3rem)] select-text overflow-hidden border outline-none {bare
460
+ class="modal-content-inner-container box-border bg-background border-border rounded-panel pointer-events-auto relative max-h-[calc(100vh-3rem)] select-text overflow-hidden border outline-none {bare
451
461
  ? 'p-0'
452
462
  : 'p-6'}"
453
463
  style="
@@ -347,7 +347,7 @@
347
347
  <DropdownMenu.Trigger class="flex cursor-pointer items-center gap-1">
348
348
  <span class="{crumbTextClass} text-muted-foreground">...</span>
349
349
  </DropdownMenu.Trigger>
350
- <DropdownMenu.Content align="start" class="min-w-[200px]">
350
+ <DropdownMenu.Content align="start">
351
351
  {#each currentPath.slice(0, -itemsToShow + 1) as _, index}
352
352
  <DropdownMenu.Item>
353
353
  <!-- svelte-ignore a11y-click-events-have-key-events -->
@@ -2,6 +2,7 @@
2
2
  * The crumb that appears when a folder is entered slides in a little, from the side the path starts on,
3
3
  * the way a panel slides into a screen. It is the one to click to go back, so it should be noticed.
4
4
  */
5
+ import { prefersReducedMotion } from '../../utils/reducedMotion.ts';
5
6
  /** How far the crumb starts from its place, in px. "Just a bit": it is a nudge, not a ride across the header. */
6
7
  export declare const CRUMB_SLIDE_DISTANCE_PX = 16;
7
8
  /** Long enough to be seen, short enough to stay out of the way (the overlays of the system use 200ms). */
@@ -13,8 +14,11 @@ export type CrumbSlideParams = {
13
14
  /** Called once the slide was started, so the page can forget it (a later redraw must not play it again). */
14
15
  onPlayed?: () => void;
15
16
  };
16
- /** True when the person asked their system for less motion. */
17
- export declare function prefersReducedMotion(): boolean;
17
+ /**
18
+ * True when the person asked their system for less motion. The question is answered in one place, `utils/reducedMotion.ts`; it is
19
+ * still exported from here, where it has always been asked from.
20
+ */
21
+ export { prefersReducedMotion };
18
22
  /** The keyframes of the slide: from the start side of the path (left in English, right in Arabic) to the place. */
19
23
  export declare function crumbSlideKeyframes(direction: 'ltr' | 'rtl'): Keyframe[];
20
24
  /** Svelte action: slide the crumb in when `play` is true and motion is allowed. */
@@ -2,17 +2,17 @@
2
2
  * The crumb that appears when a folder is entered slides in a little, from the side the path starts on,
3
3
  * the way a panel slides into a screen. It is the one to click to go back, so it should be noticed.
4
4
  */
5
+ import { prefersReducedMotion } from "../../utils/reducedMotion.js";
5
6
  /** How far the crumb starts from its place, in px. "Just a bit": it is a nudge, not a ride across the header. */
6
7
  export const CRUMB_SLIDE_DISTANCE_PX = 16;
7
8
  /** Long enough to be seen, short enough to stay out of the way (the overlays of the system use 200ms). */
8
9
  export const CRUMB_SLIDE_DURATION_MS = 280;
9
10
  export const CRUMB_SLIDE_EASING = 'cubic-bezier(0.2, 0.7, 0.2, 1)';
10
- /** True when the person asked their system for less motion. */
11
- export function prefersReducedMotion() {
12
- if (typeof window === 'undefined' || typeof window.matchMedia !== 'function')
13
- return false;
14
- return window.matchMedia('(prefers-reduced-motion: reduce)').matches;
15
- }
11
+ /**
12
+ * True when the person asked their system for less motion. The question is answered in one place, `utils/reducedMotion.ts`; it is
13
+ * still exported from here, where it has always been asked from.
14
+ */
15
+ export { prefersReducedMotion };
16
16
  /** The keyframes of the slide: from the start side of the path (left in English, right in Arabic) to the place. */
17
17
  export function crumbSlideKeyframes(direction) {
18
18
  const startOffset = direction === 'rtl' ? CRUMB_SLIDE_DISTANCE_PX : -CRUMB_SLIDE_DISTANCE_PX;
@@ -2,10 +2,22 @@
2
2
  Figma: Search Field (component set 189:1138, node 189:1138).
3
3
  The same field works as a plain search control and as the textbox of a combobox: pass `inputAttributes` (role, aria-*,
4
4
  autocomplete) from the parent; `type`, `value`, and the input `class` always come from this component so the look stays one.
5
+
6
+ Optional `recentSearchesKey` (a host-built localStorage key) shows up to three recent searches under the field when it is
7
+ focused and empty. With `recentSearchesKey` left at `''` the field matches the original Search Field (no recents panel).
5
8
  -->
6
9
  <script lang="ts">
10
+ import { tick } from 'svelte';
7
11
  import IconSearch from '@tabler/icons-svelte/icons/search';
8
12
  import IconX from '@tabler/icons-svelte/icons/x';
13
+ import IconClock from '@tabler/icons-svelte/icons/clock';
14
+
15
+ import {
16
+ MIN_RECENT_SEARCH_LENGTH,
17
+ clearRecentSearches,
18
+ readRecentSearches,
19
+ rememberRecentSearch
20
+ } from './recentSearches.js';
9
21
 
10
22
  export let placeholder = 'Search…';
11
23
  export let value = '';
@@ -24,9 +36,225 @@
24
36
  export let inputElement: HTMLInputElement | null = null;
25
37
  /** Spread first; this component’s `type`, `value`, and `class` are set after so they override clashing keys from the spread. */
26
38
  export let inputAttributes: Record<string, unknown> = {};
39
+ /** localStorage key for recent searches; `''` keeps the field as today (no recents UI). */
40
+ export let recentSearchesKey = '';
41
+ export let recentSearchesLabel = 'Recent searches';
42
+ export let clearRecentSearchesLabel = 'Clear';
43
+
44
+ const instanceUid =
45
+ typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function'
46
+ ? crypto.randomUUID()
47
+ : `search-input-${Math.random().toString(36).slice(2)}`;
48
+ const recentListboxId = `search-input-recent-listbox-${instanceUid}`;
49
+
50
+ let recentPanelOpen = false;
51
+ let recentItems: string[] = [];
52
+ let activeRecentIndex = -1;
53
+ let recentPanelEl: HTMLDivElement | null = null;
54
+ let pointerHoverEnabled = true;
55
+ let clearButtonPressed = false;
56
+
57
+ function recentOptionId(index: number): string {
58
+ return `${recentListboxId}-opt-${index}`;
59
+ }
60
+
61
+ function openRecentPanelIfApplicable(): void {
62
+ if (!recentSearchesKey || value.trim()) {
63
+ recentPanelOpen = false;
64
+ activeRecentIndex = -1;
65
+ return;
66
+ }
67
+ recentItems = readRecentSearches(recentSearchesKey);
68
+ recentPanelOpen = recentItems.length > 0;
69
+ activeRecentIndex = -1;
70
+ pointerHoverEnabled = true;
71
+ }
72
+
73
+ function closeRecentPanel(): void {
74
+ recentPanelOpen = false;
75
+ activeRecentIndex = -1;
76
+ }
77
+
78
+ function chooseRecentTerm(term: string): void {
79
+ if (!inputElement) return;
80
+ inputElement.value = term;
81
+ value = term;
82
+ inputElement.dispatchEvent(new Event('input', { bubbles: true }));
83
+ rememberRecentSearch(recentSearchesKey, term);
84
+ closeRecentPanel();
85
+ inputElement.focus();
86
+ }
87
+
88
+ function handleRecentPointerMove(event: PointerEvent): void {
89
+ if (!pointerHoverEnabled) return;
90
+ const target = event.target as HTMLElement | null;
91
+ const row = target?.closest?.('[data-recent-index]') as HTMLElement | null;
92
+ if (!row || !recentPanelEl?.contains(row)) return;
93
+ const index = Number(row.dataset.recentIndex);
94
+ if (!Number.isNaN(index)) activeRecentIndex = index;
95
+ }
96
+
97
+ function handleRecentPanelPointerDown(event: PointerEvent): void {
98
+ event.preventDefault();
99
+ }
100
+
101
+ function handleClearRecent(event: MouseEvent): void {
102
+ event.preventDefault();
103
+ event.stopPropagation();
104
+ clearRecentSearches(recentSearchesKey);
105
+ recentItems = [];
106
+ closeRecentPanel();
107
+ inputElement?.focus();
108
+ }
109
+
110
+ function recordSearchIfEligible(term: string): void {
111
+ if (!recentSearchesKey) return;
112
+ const trimmed = term.trim();
113
+ if (trimmed.length < MIN_RECENT_SEARCH_LENGTH) return;
114
+ rememberRecentSearch(recentSearchesKey, trimmed);
115
+ if (recentPanelOpen) {
116
+ recentItems = readRecentSearches(recentSearchesKey);
117
+ }
118
+ }
119
+
120
+ function handleFocusInternal(event: FocusEvent): void {
121
+ openRecentPanelIfApplicable();
122
+ onFocus(event);
123
+ }
124
+
125
+ function handleBlurInternal(event: FocusEvent): void {
126
+ const related = event.relatedTarget as Node | null;
127
+ const focusStayedInRecents =
128
+ recentPanelEl && related != null && recentPanelEl.contains(related);
129
+
130
+ if (!clearButtonPressed && !focusStayedInRecents) {
131
+ recordSearchIfEligible(value);
132
+ }
133
+ if (!focusStayedInRecents) {
134
+ closeRecentPanel();
135
+ }
136
+ clearButtonPressed = false;
137
+ onBlur(event);
138
+ }
139
+
140
+ function handleInputInternal(event: Event): void {
141
+ void onInput(event);
142
+ if (!recentSearchesKey) return;
143
+ if (value.trim()) {
144
+ closeRecentPanel();
145
+ } else if (typeof document !== 'undefined' && document.activeElement === inputElement) {
146
+ openRecentPanelIfApplicable();
147
+ }
148
+ }
149
+
150
+ function moveActiveRecent(delta: number, jump: 'start' | 'end' | null): void {
151
+ if (!recentItems.length) return;
152
+ if (jump === 'start') {
153
+ activeRecentIndex = 0;
154
+ return;
155
+ }
156
+ if (jump === 'end') {
157
+ activeRecentIndex = recentItems.length - 1;
158
+ return;
159
+ }
160
+ if (activeRecentIndex < 0) {
161
+ activeRecentIndex = delta > 0 ? 0 : recentItems.length - 1;
162
+ return;
163
+ }
164
+ const next = activeRecentIndex + delta;
165
+ if (next < 0) activeRecentIndex = recentItems.length - 1;
166
+ else if (next >= recentItems.length) activeRecentIndex = 0;
167
+ else activeRecentIndex = next;
168
+ }
169
+
170
+ function handleKeydownInternal(event: KeyboardEvent): void {
171
+ const trimmed = value.trim();
172
+
173
+ if (recentSearchesKey && recentPanelOpen) {
174
+ if (event.key === 'Escape') {
175
+ event.preventDefault();
176
+ event.stopPropagation();
177
+ closeRecentPanel();
178
+ return;
179
+ }
180
+ if (event.key === 'Tab') {
181
+ closeRecentPanel();
182
+ } else if (event.key === 'ArrowDown') {
183
+ event.preventDefault();
184
+ pointerHoverEnabled = false;
185
+ moveActiveRecent(1, null);
186
+ return;
187
+ } else if (event.key === 'ArrowUp') {
188
+ event.preventDefault();
189
+ pointerHoverEnabled = false;
190
+ moveActiveRecent(-1, null);
191
+ return;
192
+ } else if (event.key === 'Home') {
193
+ event.preventDefault();
194
+ pointerHoverEnabled = false;
195
+ moveActiveRecent(0, 'start');
196
+ return;
197
+ } else if (event.key === 'End') {
198
+ event.preventDefault();
199
+ pointerHoverEnabled = false;
200
+ moveActiveRecent(0, 'end');
201
+ return;
202
+ } else if (event.key === 'Enter' && activeRecentIndex >= 0) {
203
+ event.preventDefault();
204
+ chooseRecentTerm(recentItems[activeRecentIndex]);
205
+ return;
206
+ }
207
+ }
208
+
209
+ if (event.key === 'Backspace' && !value) {
210
+ event.preventDefault();
211
+ return;
212
+ }
213
+
214
+ if (event.key === 'Enter' && recentSearchesKey && trimmed.length >= MIN_RECENT_SEARCH_LENGTH) {
215
+ recordSearchIfEligible(value);
216
+ }
217
+
218
+ onKeydown(event);
219
+ }
220
+
221
+ async function handleClearClick(): Promise<void> {
222
+ onClear();
223
+ try {
224
+ if (!recentSearchesKey) return;
225
+ // The clear button leaves with the words and would take the focus with it: the field takes the focus back, so the keyboard
226
+ // keeps working and the list opens (and later closes) together with the focus. A field without recent searches is left as it was.
227
+ await tick();
228
+ inputElement?.focus();
229
+ openRecentPanelIfApplicable();
230
+ } catch (error) {
231
+ console.warn('[SearchInput] Could not give the field the focus back after clearing it', error);
232
+ } finally {
233
+ // This press is over: the next time the field loses the focus, its words count as a search again
234
+ clearButtonPressed = false;
235
+ }
236
+ }
237
+
238
+ $: effectiveInputAttributes =
239
+ recentSearchesKey && recentPanelOpen
240
+ ? {
241
+ ...inputAttributes,
242
+ role: 'combobox',
243
+ 'aria-expanded': true,
244
+ 'aria-controls': recentListboxId,
245
+ 'aria-autocomplete': 'list',
246
+ ...(activeRecentIndex >= 0
247
+ ? { 'aria-activedescendant': recentOptionId(activeRecentIndex) }
248
+ : {})
249
+ }
250
+ : inputAttributes;
251
+
252
+ $: if (recentSearchesKey && value.trim() && recentPanelOpen) {
253
+ closeRecentPanel();
254
+ }
27
255
  </script>
28
256
 
29
- <div class="w-full {containerClass}">
257
+ <div class="w-full {recentSearchesKey ? 'relative' : ''} {containerClass}">
30
258
  <div
31
259
  class="group bg-accent duration-fast focus-within:bg-accent hover:bg-accent-hover relative flex h-9 w-full items-center gap-2 rounded-lg px-3 transition-colors"
32
260
  >
@@ -37,22 +265,16 @@
37
265
  aria-hidden="true"
38
266
  />
39
267
  <input
40
- {...inputAttributes}
268
+ {...effectiveInputAttributes}
41
269
  type="search"
42
270
  bind:this={inputElement}
43
271
  {placeholder}
44
272
  bind:value
45
- oninput={onInput}
46
- onkeydown={(e) => {
47
- if (e.key === 'Backspace' && !value) {
48
- e.preventDefault();
49
- return;
50
- }
51
- onKeydown(e);
52
- }}
273
+ oninput={handleInputInternal}
274
+ onkeydown={handleKeydownInternal}
53
275
  onpaste={onPaste}
54
- onfocus={onFocus}
55
- onblur={onBlur}
276
+ onfocus={handleFocusInternal}
277
+ onblur={handleBlurInternal}
56
278
  class="text-body text-foreground placeholder:text-muted-foreground min-w-0 flex-1 border-0 bg-transparent focus:outline-hidden [&::-webkit-search-cancel-button]:hidden [&::-webkit-search-decoration]:hidden {inputClass}"
57
279
  />
58
280
  {#if value}
@@ -60,10 +282,56 @@
60
282
  type="button"
61
283
  class="text-muted-foreground duration-fast hover:text-foreground focus-visible:ring-ring focus-visible:ring-offset-background inline-flex size-4 shrink-0 items-center justify-center transition-colors focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-hidden"
62
284
  aria-label={clearLabel}
63
- onclick={onClear}
285
+ onmousedown={() => {
286
+ clearButtonPressed = true;
287
+ }}
288
+ onclick={handleClearClick}
64
289
  >
65
290
  <IconX class="size-4 stroke-2" aria-hidden="true" />
66
291
  </button>
67
292
  {/if}
68
293
  </div>
69
- </div>
294
+
295
+ {#if recentSearchesKey && recentPanelOpen}
296
+ <!-- The card: a title with Clear on top, then the list of terms. Only the list is the listbox (its children are the options);
297
+ the Clear button sits outside it. A press on the card never takes the focus from the field. -->
298
+ <!-- svelte-ignore a11y_no_static_element_interactions -->
299
+ <div
300
+ bind:this={recentPanelEl}
301
+ class="border-border bg-popover text-popover-foreground absolute start-0 top-full z-50 mt-1 w-full overflow-hidden rounded-xl border p-1 shadow-md"
302
+ onpointerdown={handleRecentPanelPointerDown}
303
+ onpointermove={handleRecentPointerMove}
304
+ >
305
+ <div class="flex items-center justify-between gap-2 px-2 py-1.5">
306
+ <span class="text-caption text-muted-foreground" aria-hidden="true">{recentSearchesLabel}</span>
307
+ <button
308
+ type="button"
309
+ class="text-caption text-muted-foreground hover:text-foreground rounded-md px-1.5 py-0.5 transition-colors focus-visible:ring-ring focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-offset-background focus-visible:outline-hidden"
310
+ onclick={handleClearRecent}
311
+ >
312
+ {clearRecentSearchesLabel}
313
+ </button>
314
+ </div>
315
+ <div id={recentListboxId} role="listbox" aria-label={recentSearchesLabel}>
316
+ {#each recentItems as term, index (term.toLowerCase())}
317
+ <button
318
+ type="button"
319
+ role="option"
320
+ id={recentOptionId(index)}
321
+ data-recent-index={index}
322
+ aria-selected={index === activeRecentIndex}
323
+ tabindex="-1"
324
+ class="flex min-h-9 w-full cursor-pointer items-center gap-2 rounded-lg px-2 text-start transition-colors duration-fast focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background {index ===
325
+ activeRecentIndex
326
+ ? 'bg-accent'
327
+ : 'hover:bg-accent'}"
328
+ onclick={() => chooseRecentTerm(term)}
329
+ >
330
+ <IconClock class="text-muted-foreground size-4 shrink-0 stroke-2" aria-hidden="true" />
331
+ <span class="text-body truncate">{term}</span>
332
+ </button>
333
+ {/each}
334
+ </div>
335
+ </div>
336
+ {/if}
337
+ </div>
@@ -25,6 +25,9 @@ declare const SearchInput: $$__sveltets_2_IsomorphicComponent<{
25
25
  clearLabel?: string;
26
26
  /** Bindable ref to the native input (e.g. combobox controllers call focus()). */ inputElement?: HTMLInputElement | null;
27
27
  /** Spread first; this component’s `type`, `value`, and `class` are set after so they override clashing keys from the spread. */ inputAttributes?: Record<string, unknown>;
28
+ /** localStorage key for recent searches; `''` keeps the field as today (no recents UI). */ recentSearchesKey?: string;
29
+ recentSearchesLabel?: string;
30
+ clearRecentSearchesLabel?: string;
28
31
  }, {
29
32
  [evt: string]: CustomEvent<any>;
30
33
  }, {}, {}, string>;
@@ -1,3 +1,4 @@
1
1
  import SearchInput from './SearchInput.svelte';
2
2
  export { SearchInput };
3
+ export { RECENT_SEARCHES_LIMIT, MIN_RECENT_SEARCH_LENGTH, readRecentSearches, rememberRecentSearch, clearRecentSearches } from './recentSearches.js';
3
4
  export default SearchInput;
@@ -1,3 +1,4 @@
1
1
  import SearchInput from './SearchInput.svelte';
2
2
  export { SearchInput };
3
+ export { RECENT_SEARCHES_LIMIT, MIN_RECENT_SEARCH_LENGTH, readRecentSearches, rememberRecentSearch, clearRecentSearches } from './recentSearches.js';
3
4
  export default SearchInput;
@@ -14,6 +14,10 @@ export interface SearchInputProps {
14
14
  clearLabel?: string;
15
15
  inputElement?: HTMLInputElement | null;
16
16
  inputAttributes?: Record<string, unknown>;
17
+ /** localStorage key for recent searches; empty string disables the feature. */
18
+ recentSearchesKey?: string;
19
+ recentSearchesLabel?: string;
20
+ clearRecentSearchesLabel?: string;
17
21
  }
18
22
 
19
23
  export default class SearchInput extends SvelteComponent<SearchInputProps> {}
@@ -0,0 +1,12 @@
1
+ /** How many recent terms we keep per storage key. */
2
+ export declare const RECENT_SEARCHES_LIMIT = 3;
3
+ /** Shorter trimmed terms are not stored or shown. */
4
+ export declare const MIN_RECENT_SEARCH_LENGTH = 2;
5
+ /** Returns the stored list for `key`, newest first. Never throws. */
6
+ export declare function readRecentSearches(key: string): string[];
7
+ /** Adds `term` to the stored list (newest first, case-insensitive dedupe). Returns the new list. Never throws. */
8
+ export declare function rememberRecentSearch(key: string, term: string): string[];
9
+ /** Clears the stored list for `key`. Never throws. */
10
+ export declare function clearRecentSearches(key: string): void;
11
+ /** Test-only: reset in-memory fallback and log latch. */
12
+ export declare function __resetRecentSearchesTestState(): void;