entasis 0.4.1 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (180) hide show
  1. package/README.md +1 -0
  2. package/dist/attachments/spinnerOverlay.theme.d.ts +2 -36
  3. package/dist/components/AIAskUserQuestion/aiAskUserQuestion.theme.d.ts +2 -30
  4. package/dist/components/AIChat/aiChat.theme.d.ts +2 -14
  5. package/dist/components/AIComposer/aiComposer.theme.d.ts +2 -50
  6. package/dist/components/AIContext/aiContext.theme.d.ts +2 -37
  7. package/dist/components/AIConversation/aiConversation.theme.d.ts +2 -4
  8. package/dist/components/AIFilePreview/aiFilePreview.theme.d.ts +2 -17
  9. package/dist/components/AIMarker/aiMarker.theme.d.ts +2 -18
  10. package/dist/components/AIMessage/aiMessage.theme.d.ts +2 -72
  11. package/dist/components/AIMessageActions/aiMessageActions.theme.d.ts +2 -29
  12. package/dist/components/AIModelSelector/aiModelSelector.theme.d.ts +2 -25
  13. package/dist/components/AIReasoning/aiReasoning.theme.d.ts +2 -9
  14. package/dist/components/AISuggestion/aiSuggestion.theme.d.ts +2 -6
  15. package/dist/components/AIThread/aiThread.theme.d.ts +2 -35
  16. package/dist/components/AIThreadToc/aiThreadToc.theme.d.ts +2 -44
  17. package/dist/components/AITool/aiTool.mcp.d.ts +1 -1
  18. package/dist/components/AITool/aiTool.mcp.js +1 -1
  19. package/dist/components/AITool/aiTool.theme.d.ts +2 -170
  20. package/dist/components/AITool/aiTool.theme.js +14 -12
  21. package/dist/components/Accordion/accordion.theme.d.ts +2 -135
  22. package/dist/components/Alert/alert.theme.d.ts +2 -88
  23. package/dist/components/AppShell/appShell.theme.d.ts +2 -34
  24. package/dist/components/AspectRatio/aspectRatio.theme.d.ts +2 -5
  25. package/dist/components/AudioPlayer/audioPlayer.theme.d.ts +2 -179
  26. package/dist/components/Avatar/avatar.theme.d.ts +2 -38
  27. package/dist/components/Avatar/avatarGroup.theme.d.ts +2 -17
  28. package/dist/components/Breadcrumbs/breadcrumbs.theme.d.ts +2 -33
  29. package/dist/components/Button/Button.svelte +15 -13
  30. package/dist/components/Button/button.theme.d.ts +2 -55
  31. package/dist/components/ButtonGroup/buttonGroup.theme.d.ts +2 -4
  32. package/dist/components/Card/card.theme.d.ts +2 -119
  33. package/dist/components/Carousel/carousel.theme.d.ts +2 -73
  34. package/dist/components/Chart/chart.theme.d.ts +2 -24
  35. package/dist/components/Chip/chip.theme.d.ts +2 -56
  36. package/dist/components/Code/code.theme.d.ts +2 -9
  37. package/dist/components/Collapsible/collapsible.theme.d.ts +2 -44
  38. package/dist/components/Command/command.theme.d.ts +2 -103
  39. package/dist/components/Confirmation/confirmation.theme.d.ts +2 -10
  40. package/dist/components/ContextMenu/contextMenu.theme.d.ts +2 -10
  41. package/dist/components/DataTable/dataTable.theme.d.ts +2 -160
  42. package/dist/components/Dialog/Dialog.svelte +16 -0
  43. package/dist/components/Dialog/dialog.mcp.d.ts +1 -1
  44. package/dist/components/Dialog/dialog.mcp.js +2 -1
  45. package/dist/components/Dialog/dialog.props.d.ts +5 -0
  46. package/dist/components/Dialog/dialog.theme.d.ts +2 -137
  47. package/dist/components/Dialog/dialog.theme.js +12 -8
  48. package/dist/components/Diff/diff.theme.d.ts +2 -6
  49. package/dist/components/DocumentViewer/documentViewer.theme.d.ts +2 -87
  50. package/dist/components/Empty/empty.theme.d.ts +2 -71
  51. package/dist/components/EventCalendar/eventCalendar.theme.d.ts +2 -3171
  52. package/dist/components/FloatingWindow/floatingWindow.theme.d.ts +2 -96
  53. package/dist/components/Form/Calendar/CalendarPrimitive.svelte.d.ts +2 -63
  54. package/dist/components/Form/Calendar/calendar.theme.d.ts +2 -63
  55. package/dist/components/Form/CheckboxesInput/checkboxesInput.theme.d.ts +2 -100
  56. package/dist/components/Form/ColorInput/colorInput.theme.d.ts +2 -32
  57. package/dist/components/Form/ColorPicker/colorPicker.theme.d.ts +2 -127
  58. package/dist/components/Form/Combobox/combobox.theme.d.ts +2 -50
  59. package/dist/components/Form/DateInput/dateInput.theme.d.ts +2 -26
  60. package/dist/components/Form/DateSelector/dateSelector.theme.d.ts +2 -17
  61. package/dist/components/Form/Field/field.theme.d.ts +2 -146
  62. package/dist/components/Form/File/fileInput.theme.d.ts +2 -41
  63. package/dist/components/Form/Form/form.state.svelte.d.ts +4 -4
  64. package/dist/components/Form/Form/form.theme.d.ts +2 -129
  65. package/dist/components/Form/Form/visibility.d.ts +54 -54
  66. package/dist/components/Form/KeyValueInput/keyValueInput.theme.d.ts +2 -50
  67. package/dist/components/Form/MultiStepForm/multiStepForm.state.svelte.d.ts +4 -4
  68. package/dist/components/Form/MultiStepForm/multiStepForm.theme.d.ts +2 -25
  69. package/dist/components/Form/NumberInput/numberInput.theme.d.ts +2 -25
  70. package/dist/components/Form/PasswordInput/passwordInput.theme.d.ts +2 -25
  71. package/dist/components/Form/PhoneInput/phoneInput.theme.d.ts +2 -112
  72. package/dist/components/Form/PinInput/pinInput.theme.d.ts +2 -38
  73. package/dist/components/Form/RadioInput/radioInput.theme.d.ts +2 -94
  74. package/dist/components/Form/Select/select.theme.d.ts +2 -71
  75. package/dist/components/Form/Slider/slider.theme.d.ts +2 -266
  76. package/dist/components/Form/Switch/switch.theme.d.ts +2 -40
  77. package/dist/components/Form/TagGroup/tagGroup.theme.d.ts +2 -19
  78. package/dist/components/Form/TagsInput/tagsInput.theme.d.ts +2 -53
  79. package/dist/components/Form/TextArea/textArea.theme.d.ts +2 -25
  80. package/dist/components/Form/TextInput/textInput.theme.d.ts +2 -25
  81. package/dist/components/Form/TimeInput/timeInput.theme.d.ts +2 -47
  82. package/dist/components/Form/VoiceInput/voiceInput.theme.d.ts +2 -155
  83. package/dist/components/GanttChart/ganttChart.theme.d.ts +2 -2478
  84. package/dist/components/Globe/globe.theme.d.ts +2 -13
  85. package/dist/components/Grid/grid.theme.d.ts +2 -18
  86. package/dist/components/Grid/gridSpan.theme.d.ts +2 -4
  87. package/dist/components/Heading/heading.theme.d.ts +2 -41
  88. package/dist/components/Hitbox/hitbox.theme.d.ts +2 -10
  89. package/dist/components/HoverCard/hoverCard.theme.d.ts +11 -27
  90. package/dist/components/HoverCard/hoverCard.theme.js +9 -4
  91. package/dist/components/ImageGallery/imageGallery.theme.d.ts +2 -6
  92. package/dist/components/ImageZoom/imageZoom.theme.d.ts +2 -16
  93. package/dist/components/Kanban/kanban.theme.d.ts +2 -60
  94. package/dist/components/Kbd/kbd.theme.d.ts +2 -33
  95. package/dist/components/Layout/layoutSpacing.d.ts +1 -1
  96. package/dist/components/LinkPreview/linkPreview.theme.d.ts +2 -58
  97. package/dist/components/Map/map.theme.d.ts +2 -14
  98. package/dist/components/Markdown/markdown.theme.d.ts +2 -10
  99. package/dist/components/Marquee/marquee.theme.d.ts +2 -37
  100. package/dist/components/MediaVolume/mediaVolumeControl.theme.d.ts +2 -22
  101. package/dist/components/Menu/menu.theme.d.ts +2 -12
  102. package/dist/components/MenuBar/menuBar.theme.d.ts +2 -16
  103. package/dist/components/MenuOption/menuOption.theme.d.ts +2 -75
  104. package/dist/components/Mermaid/mermaid.theme.d.ts +2 -15
  105. package/dist/components/MetadataList/metadataList.theme.d.ts +2 -97
  106. package/dist/components/Meter/meter.theme.d.ts +2 -111
  107. package/dist/components/MiniCalendar/miniCalendar.theme.d.ts +2 -71
  108. package/dist/components/NetworkIndicator/networkIndicator.theme.d.ts +2 -41
  109. package/dist/components/Overlay/overlay.theme.d.ts +2 -92
  110. package/dist/components/PageShell/pageShell.theme.d.ts +2 -36
  111. package/dist/components/Pagination/pagination.theme.d.ts +2 -108
  112. package/dist/components/Popover/popover.theme.d.ts +2 -40
  113. package/dist/components/PopupMenu/popupMenu.theme.d.ts +2 -4
  114. package/dist/components/ProgressCircle/progressCircle.theme.d.ts +2 -22
  115. package/dist/components/QRCode/qrCode.theme.d.ts +2 -19
  116. package/dist/components/Rating/rating.theme.d.ts +2 -37
  117. package/dist/components/Resizable/resizable.theme.d.ts +2 -65
  118. package/dist/components/RichTextInput/richTextInput.theme.d.ts +2 -167
  119. package/dist/components/ScrollArea/scrollArea.theme.d.ts +2 -15
  120. package/dist/components/SegmentedControl/segmentedControl.theme.d.ts +2 -76
  121. package/dist/components/SelectionMenu/selectionMenu.theme.d.ts +2 -5
  122. package/dist/components/Separator/separator.theme.d.ts +2 -33
  123. package/dist/components/Sidebar/Sidebar.svelte +8 -2
  124. package/dist/components/Sidebar/SidebarAction.svelte +2 -2
  125. package/dist/components/Sidebar/SidebarActivityBar.svelte +3 -3
  126. package/dist/components/Sidebar/SidebarDesktopShell.svelte +3 -0
  127. package/dist/components/Sidebar/SidebarDesktopShell.svelte.d.ts +1 -0
  128. package/dist/components/Sidebar/SidebarGroup.svelte +6 -6
  129. package/dist/components/Sidebar/SidebarMenuButton.svelte +15 -18
  130. package/dist/components/Sidebar/SidebarMenuItem.svelte +15 -21
  131. package/dist/components/Sidebar/SidebarMenuSubItem.svelte +5 -6
  132. package/dist/components/Sidebar/SidebarMobileDrawer.svelte +3 -1
  133. package/dist/components/Sidebar/SidebarMobileDrawer.svelte.d.ts +1 -0
  134. package/dist/components/Sidebar/SidebarPanel.svelte +3 -6
  135. package/dist/components/Sidebar/SidebarTreeNode.svelte +2 -2
  136. package/dist/components/Sidebar/sidebar.mcp.d.ts +1 -1
  137. package/dist/components/Sidebar/sidebar.mcp.js +1 -0
  138. package/dist/components/Sidebar/sidebar.props.d.ts +2 -0
  139. package/dist/components/Sidebar/sidebar.theme.d.ts +116 -540
  140. package/dist/components/Sidebar/sidebar.theme.js +73 -67
  141. package/dist/components/Skeleton/skeleton.theme.d.ts +2 -14
  142. package/dist/components/SortableList/sortableList.theme.d.ts +2 -43
  143. package/dist/components/Spinner/spinner.theme.d.ts +2 -41
  144. package/dist/components/SpinnerText/spinnerText.theme.d.ts +2 -49
  145. package/dist/components/Stack/stack.theme.d.ts +2 -12
  146. package/dist/components/Stat/stat.theme.d.ts +2 -132
  147. package/dist/components/Stepper/stepper.theme.d.ts +2 -22
  148. package/dist/components/Tabbar/tabbar.theme.d.ts +2 -110
  149. package/dist/components/Table/table.theme.d.ts +2 -42
  150. package/dist/components/TableOfContents/tableOfContents.theme.d.ts +2 -28
  151. package/dist/components/Tabs/tabs.theme.d.ts +2 -20
  152. package/dist/components/Theme/Theme.svelte +4 -4
  153. package/dist/components/Theme/theme.designTokens.d.ts +10 -0
  154. package/dist/components/Theme/theme.designTokens.js +14 -1
  155. package/dist/components/Theme/theme.state.svelte.js +3 -3
  156. package/dist/components/Timeline/timeline.theme.d.ts +2 -226
  157. package/dist/components/Toast/toast.theme.d.ts +2 -236
  158. package/dist/components/ToggleButton/toggleButton.theme.d.ts +2 -57
  159. package/dist/components/ToggleButtonGroup/toggleButtonGroup.theme.d.ts +2 -9
  160. package/dist/components/ToggleMenu/toggleMenu.theme.d.ts +2 -7
  161. package/dist/components/Tooltip/tooltip.theme.d.ts +2 -25
  162. package/dist/components/Tree/tree.theme.d.ts +2 -7
  163. package/dist/components/VideoPlayer/videoPlayer.theme.d.ts +2 -145
  164. package/dist/generated/componentContract.d.ts +1 -1
  165. package/dist/generated/componentContract.js +2 -0
  166. package/dist/generated/componentMcpRegistry.d.ts +5 -5
  167. package/dist/tailwind/colors.js +7 -1
  168. package/dist/tailwind/global.js +4 -1
  169. package/dist/tailwind/spacing.d.ts +13 -0
  170. package/dist/tailwind/spacing.js +5 -2
  171. package/dist/tailwind/theme.mcp.d.ts +1 -1
  172. package/dist/tailwind/theme.mcp.js +1 -1
  173. package/dist/utils/cva/cva.mcp.d.ts +1 -1
  174. package/dist/utils/cva/cva.mcp.js +1 -1
  175. package/dist/utils/cva/index.d.ts +1 -1
  176. package/dist/utils/cva/merge.d.ts +108 -0
  177. package/dist/utils/cva/merge.js +6 -2
  178. package/dist/utils/cva/theme.d.ts +36 -1
  179. package/dist/utils/cva/theme.js +25 -2
  180. package/package.json +1 -1
@@ -214,7 +214,10 @@ export const applyGlobalEngine = (api, options) => {
214
214
  'background-color': 'var(--color-pressed, var(--color-hover, currentColor))',
215
215
  opacity: 'var(--state-pressed-opacity)'
216
216
  }
217
- }
217
+ },
218
+ // The off switch for one element: the tint lives on the ::before, so a `hover:bg-*` on the
219
+ // element itself can never reach it.
220
+ '.state-layer-none': { '&::before': { display: 'none' } }
218
221
  });
219
222
  addShimmerUtilities(api);
220
223
  addScrollFadeUtilities(api);
@@ -1,2 +1,15 @@
1
1
  import type { PluginAPI } from 'tailwindcss/plugin';
2
+ export declare const spacingValues: {
3
+ micro: string;
4
+ xs: string;
5
+ sm: string;
6
+ md: string;
7
+ lg: string;
8
+ xl: string;
9
+ 'layout-sm': string;
10
+ 'layout-md': string;
11
+ 'layout-lg': string;
12
+ 'layout-xl': string;
13
+ };
14
+ export type SpacingStep = keyof typeof spacingValues;
2
15
  export declare const applySpacingEngine: ({ addBase, matchUtilities }: PluginAPI) => void;
@@ -8,9 +8,12 @@ const spacingVariables = {
8
8
  '--layout-space-sm': 'calc(var(--spacing) * 5)',
9
9
  '--layout-space-md': 'calc(var(--spacing) * 6)',
10
10
  '--layout-space-lg': 'calc(var(--spacing) * 8)',
11
- '--layout-space-xl': 'calc(var(--spacing) * 12)'
11
+ '--layout-space-xl': 'calc(var(--spacing) * 12)',
12
+ // How far a drawer Dialog stands off the screen edge. A spacing step or `0px`, overridden by
13
+ // `designTokens.drawerInset`; the drawer's edge corners round only when this is not zero.
14
+ '--drawer-inset': 'var(--layout-space-md)'
12
15
  };
13
- const spacingValues = {
16
+ export const spacingValues = {
14
17
  micro: 'var(--space-micro)',
15
18
  xs: 'var(--space-xs)',
16
19
  sm: 'var(--space-sm)',
@@ -1 +1 @@
1
- export declare const themePluginDescription = "\n# Theme Tailwind plugin\n\n`@plugin 'entasis/tailwind-plugin/theme'` generates color variables for each named theme. The declaration\nmarked `default: true` also registers the shared utility vocabulary, variants, spinner styles,\nand keyframes.\n\n```css\n@import 'tailwindcss';\n\n@plugin 'entasis/tailwind-plugin/theme' {\n\tname: light;\n\tdefault: true;\n\tcolorscheme: light;\n\tprimary: #5f62ef;\n\tsecondary: #e4e4e7;\n\tsurface: #fafafa;\n\tneutral: #18181b;\n}\n\n@plugin 'entasis/tailwind-plugin/theme' {\n\tname: dark;\n\tcolorscheme: dark;\n\tprimary: #5f62ef;\n\tsecondary: #27272a;\n\tsurface: #09090b;\n\tneutral: #fafafa;\n}\n```\n\n## Identity\n\n- `name: string` scopes variables to `html[data-theme=\"<name>\"]` and `.<name>`.\n- `default: boolean` also applies the palette to bare `html` and installs the shared engine.\n- `colorscheme: 'light' | 'dark'` controls mode-aware color defaults.\n- `prefersDark: boolean` also emits the palette under the dark system media query.\n\n## Palette inputs\n\nBase semantic colors are `primary`, `secondary`, `danger`, `success`, `warning`, `info`,\nand `neutral`. `surface` seeds the elevation ladder: `surface-recessed`,\n`surface-canvas`, `surface`, `surface-raised`, and `surface-floating`.\n\nEach semantic color supports explicit `-light`, `-lighter`, `-dark`, `-muted`,\n`-contrast`, `-readable`, and `-muted-readable` overrides. Missing variants are generated.\n`luminance` and `saturation` adjust the generated palette.\n\n`state-hover-opacity` and `state-pressed-opacity` calibrate the CSS variables consumed by\n`.state-layer`. They default to 0.05/0.10 in light mode and 0.16/0.32 in dark mode.\n`state-selected-opacity` (0.07 light, 0.10 dark) is the alpha `bg-selected-muted` composites the\nselected role at: the soft selection fill is a translucent tint, not an opaque colour, so it reads\nthe same on `surface`, `surface-raised` and `surface-floating`.\n\n## Runtime boundary\n\nSpacing, radius, typography scale, raised borders, `defaultColor` and the four state roles\n(`focusColor`, `selectedColor`, `hoverColor`, `pressedColor`) are not plugin options.\nConfigure them with the `designTokens` prop on `Theme`. Tailwind still discovers and compiles\nthe finite utility names; runtime theming changes the CSS variables those utilities consume.\n\nThe public spacing vocabulary is `xs | sm | md | lg | xl`, available through named gap, padding,\nand margin utilities such as `gap-md` and `px-lg`. The `micro` and `layout-*` values are\ninternal component-recipe tokens. Generated interfaces should prefer Stack/Grid gaps and must not\nemit arbitrary spacing or unsupported radius utilities.\n\nColor variables can also be overridden directly at runtime:\n\n```css\nhtml[data-theme='light'] {\n\t--color-primary: oklab(0.21 0.01 -0.03);\n}\n```\n";
1
+ export declare const themePluginDescription = "\n# Theme Tailwind plugin\n\n`@plugin 'entasis/tailwind-plugin/theme'` generates color variables for each named theme. The declaration\nmarked `default: true` also registers the shared utility vocabulary, variants, spinner styles,\nand keyframes.\n\n```css\n@import 'tailwindcss';\n\n@plugin 'entasis/tailwind-plugin/theme' {\n\tname: light;\n\tdefault: true;\n\tcolorscheme: light;\n\tprimary: #5f62ef;\n\tsecondary: #e4e4e7;\n\tsurface: #fafafa;\n\tneutral: #18181b;\n}\n\n@plugin 'entasis/tailwind-plugin/theme' {\n\tname: dark;\n\tcolorscheme: dark;\n\tprimary: #5f62ef;\n\tsecondary: #27272a;\n\tsurface: #09090b;\n\tneutral: #fafafa;\n}\n```\n\n## Identity\n\n- `name: string` scopes variables to `html[data-theme=\"<name>\"]` and `.<name>`.\n- `default: boolean` also applies the palette to bare `html` and installs the shared engine.\n- `colorscheme: 'light' | 'dark'` controls mode-aware color defaults.\n- `prefersDark: boolean` also emits the palette under the dark system media query.\n\n## Palette inputs\n\nBase semantic colors are `primary`, `secondary`, `danger`, `success`, `warning`, `info`,\nand `neutral`. `surface` seeds the elevation ladder: `surface-recessed`,\n`surface-canvas`, `surface`, `surface-raised`, and `surface-floating`.\n\nEach semantic color supports explicit `-light`, `-lighter`, `-dark`, `-muted`,\n`-contrast`, `-readable`, and `-muted-readable` overrides. Missing variants are generated.\n`luminance` and `saturation` adjust the generated palette.\n\n`state-hover-opacity` and `state-pressed-opacity` calibrate the CSS variables consumed by\n`.state-layer`. They default to 0.05/0.10 in light mode and 0.16/0.32 in dark mode. `state-layer-none` switches that overlay off on one element.\n`state-selected-opacity` (0.07 light, 0.10 dark) is the alpha `bg-selected-muted` composites the\nselected role at: the soft selection fill is a translucent tint, not an opaque colour, so it reads\nthe same on `surface`, `surface-raised` and `surface-floating`.\n\n## Runtime boundary\n\nSpacing, radius, typography scale, raised borders, `defaultColor` and the four state roles\n(`focusColor`, `selectedColor`, `hoverColor`, `pressedColor`) are not plugin options.\nConfigure them with the `designTokens` prop on `Theme`. Tailwind still discovers and compiles\nthe finite utility names; runtime theming changes the CSS variables those utilities consume.\n\nThe public spacing vocabulary is `xs | sm | md | lg | xl`, available through named gap, padding,\nand margin utilities such as `gap-md` and `px-lg`. The `micro` and `layout-*` values are\ninternal component-recipe tokens. Generated interfaces should prefer Stack/Grid gaps and must not\nemit arbitrary spacing or unsupported radius utilities.\n\nColor variables can also be overridden directly at runtime:\n\n```css\nhtml[data-theme='light'] {\n\t--color-primary: oklab(0.21 0.01 -0.03);\n}\n```\n";
@@ -46,7 +46,7 @@ Each semantic color supports explicit \`-light\`, \`-lighter\`, \`-dark\`, \`-mu
46
46
  \`luminance\` and \`saturation\` adjust the generated palette.
47
47
 
48
48
  \`state-hover-opacity\` and \`state-pressed-opacity\` calibrate the CSS variables consumed by
49
- \`.state-layer\`. They default to 0.05/0.10 in light mode and 0.16/0.32 in dark mode.
49
+ \`.state-layer\`. They default to 0.05/0.10 in light mode and 0.16/0.32 in dark mode. \`state-layer-none\` switches that overlay off on one element.
50
50
  \`state-selected-opacity\` (0.07 light, 0.10 dark) is the alpha \`bg-selected-muted\` composites the
51
51
  selected role at: the soft selection fill is a translucent tint, not an opaque colour, so it reads
52
52
  the same on \`surface\`, \`surface-raised\` and \`surface-floating\`.
@@ -1 +1 @@
1
- export declare const cvaDescription = "\n# Component variants\n\nImport from `entasis/cva`.\n\ncva defines class variants and defaults. cx joins class values; compose composes variants. setComponentTheme and useComponentTheme connect component theme definitions to the Svelte theme context. VariantProps and InferComponentTheme derive the corresponding public types. Keep component CVA definitions beside their owner in a .theme.ts file.\n";
1
+ export declare const cvaDescription = "\n# Component variants\n\nImport from `entasis/cva`.\n\ncva defines class variants and defaults. cx joins class values; compose composes variants. setComponentTheme and useComponentTheme connect component theme definitions to the Svelte theme context. A resolver takes an optional second argument, the shared variant values, and then returns every class slot already bound to them, so a template calls `slots.root()` instead of passing the same props to each slot. VariantProps and InferComponentTheme derive the corresponding public types. Keep component CVA definitions beside their owner in a .theme.ts file.\n";
@@ -3,5 +3,5 @@ export const cvaDescription = `
3
3
 
4
4
  Import from \`entasis/cva\`.
5
5
 
6
- cva defines class variants and defaults. cx joins class values; compose composes variants. setComponentTheme and useComponentTheme connect component theme definitions to the Svelte theme context. VariantProps and InferComponentTheme derive the corresponding public types. Keep component CVA definitions beside their owner in a .theme.ts file.
6
+ cva defines class variants and defaults. cx joins class values; compose composes variants. setComponentTheme and useComponentTheme connect component theme definitions to the Svelte theme context. A resolver takes an optional second argument, the shared variant values, and then returns every class slot already bound to them, so a template calls \`slots.root()\` instead of passing the same props to each slot. VariantProps and InferComponentTheme derive the corresponding public types. Keep component CVA definitions beside their owner in a .theme.ts file.
7
7
  `;
@@ -1,4 +1,4 @@
1
1
  export { cva, cx, compose } from './engine.js';
2
2
  export { setComponentTheme, useComponentTheme } from './theme.js';
3
- export type { ComponentVariant, InferComponentTheme } from './theme.js';
3
+ export type { ComponentVariant, InferComponentTheme, SharedThemeProps, BoundTheme } from './theme.js';
4
4
  export type { VariantProps, ClassValue, ClassArray, ClassDictionary } from './types.js';
@@ -16,6 +16,7 @@
16
16
  * earlier edge forms; edge forms combine; `static` is a modifier)
17
17
  * - `shimmer*` (`shimmer` / `shimmer-none` exclude each other; `once` and
18
18
  * `reverse` are modifiers; `shimmer-color|duration|spread|angle-*` are scales)
19
+ * - `state-layer` / `state-layer-none` exclude each other
19
20
  * - `rounded-<step>-concentric` / `rounded-t|b-<step>-concentric` (join the core corner groups), the container side
20
21
  * needing nothing here — a `rounded-<step>` publishes its radius to its children by itself
21
22
  * - `duration-*` / `ease-*` motion tokens
@@ -30,4 +31,111 @@
30
31
  * falsy values, so no separate clsx pass is needed.
31
32
  */
32
33
  import type { ClassValue } from './types.js';
34
+ export declare const mergeConfig: {
35
+ extend: {
36
+ theme: {
37
+ spacing: string[];
38
+ };
39
+ classGroups: {
40
+ raised: (string | {
41
+ raised: string[];
42
+ })[];
43
+ lift: (string | {
44
+ lift: string[];
45
+ })[];
46
+ 'h-control': {
47
+ 'h-control': string[];
48
+ }[];
49
+ 'h-row': {
50
+ 'h-row': string[];
51
+ }[];
52
+ 'min-h-row': {
53
+ 'min-h-row': string[];
54
+ }[];
55
+ 'size-icon': {
56
+ 'size-icon': string[];
57
+ }[];
58
+ 'min-size-hit': {
59
+ 'min-size-hit': string[];
60
+ }[];
61
+ 'ps-indent': {
62
+ 'ps-indent': string[];
63
+ }[];
64
+ duration: {
65
+ duration: string[];
66
+ }[];
67
+ ease: {
68
+ ease: string[];
69
+ }[];
70
+ h: {
71
+ h: string[];
72
+ }[];
73
+ w: {
74
+ w: string[];
75
+ }[];
76
+ 'scroll-fade': (string | {
77
+ 'scroll-fade': string[];
78
+ })[];
79
+ 'scroll-fade-t': string[];
80
+ 'scroll-fade-b': string[];
81
+ 'scroll-fade-start': {
82
+ 'scroll-fade': string[];
83
+ }[];
84
+ 'scroll-fade-end': {
85
+ 'scroll-fade': string[];
86
+ }[];
87
+ shimmer: string[];
88
+ 'state-layer': string[];
89
+ 'shimmer-color': {
90
+ 'shimmer-color': {
91
+ readonly $v: "isAny";
92
+ }[];
93
+ }[];
94
+ 'shimmer-duration': {
95
+ 'shimmer-duration': {
96
+ readonly $v: "isAny";
97
+ }[];
98
+ }[];
99
+ 'shimmer-spread': {
100
+ 'shimmer-spread': {
101
+ readonly $v: "isAny";
102
+ }[];
103
+ }[];
104
+ 'shimmer-angle': {
105
+ 'shimmer-angle': {
106
+ readonly $v: "isAny";
107
+ }[];
108
+ }[];
109
+ rounded: {
110
+ rounded: ((value: string) => boolean)[];
111
+ }[];
112
+ 'rounded-t': {
113
+ 'rounded-t': ((value: string) => boolean)[];
114
+ }[];
115
+ 'rounded-b': {
116
+ 'rounded-b': ((value: string) => boolean)[];
117
+ }[];
118
+ };
119
+ conflictingClassGroups: {
120
+ raised: string[];
121
+ lift: string[];
122
+ shadow: string[];
123
+ 'h-control': string[];
124
+ 'h-row': string[];
125
+ h: string[];
126
+ 'size-icon': string[];
127
+ w: string[];
128
+ size: string[];
129
+ 'min-size-hit': string[];
130
+ 'min-h-row': string[];
131
+ 'min-w': string[];
132
+ 'min-h': string[];
133
+ 'ps-indent': string[];
134
+ ps: string[];
135
+ px: string[];
136
+ p: string[];
137
+ 'scroll-fade': string[];
138
+ };
139
+ };
140
+ };
33
141
  export declare const cn: (...inputs: ClassValue[]) => string;
@@ -16,6 +16,7 @@
16
16
  * earlier edge forms; edge forms combine; `static` is a modifier)
17
17
  * - `shimmer*` (`shimmer` / `shimmer-none` exclude each other; `once` and
18
18
  * `reverse` are modifiers; `shimmer-color|duration|spread|angle-*` are scales)
19
+ * - `state-layer` / `state-layer-none` exclude each other
19
20
  * - `rounded-<step>-concentric` / `rounded-t|b-<step>-concentric` (join the core corner groups), the container side
20
21
  * needing nothing here — a `rounded-<step>` publishes its radius to its children by itself
21
22
  * - `duration-*` / `ease-*` motion tokens
@@ -44,7 +45,7 @@ const SEMANTIC_SPACING = [
44
45
  'layout-lg',
45
46
  'layout-xl'
46
47
  ];
47
- const merge = createCn({
48
+ export const mergeConfig = {
48
49
  extend: {
49
50
  theme: {
50
51
  spacing: SEMANTIC_SPACING
@@ -74,6 +75,8 @@ const merge = createCn({
74
75
  'scroll-fade-start': [{ 'scroll-fade': ['s', 'l'] }],
75
76
  'scroll-fade-end': [{ 'scroll-fade': ['e', 'r'] }],
76
77
  shimmer: ['shimmer', 'shimmer-none'],
78
+ // The overlay is a ::before, so only its own off switch can remove it.
79
+ 'state-layer': ['state-layer', 'state-layer-none'],
77
80
  'shimmer-color': [{ 'shimmer-color': [validators.isAny] }],
78
81
  'shimmer-duration': [{ 'shimmer-duration': [validators.isAny] }],
79
82
  'shimmer-spread': [{ 'shimmer-spread': [validators.isAny] }],
@@ -110,5 +113,6 @@ const merge = createCn({
110
113
  'scroll-fade': ['scroll-fade-t', 'scroll-fade-b', 'scroll-fade-start', 'scroll-fade-end']
111
114
  }
112
115
  }
113
- });
116
+ };
117
+ const merge = createCn(mergeConfig);
114
118
  export const cn = (...inputs) => merge(...inputs);
@@ -27,13 +27,20 @@ export type InferComponentTheme<T extends ComponentTheme> = Partial<{
27
27
  override?: boolean;
28
28
  };
29
29
  export declare const setComponentTheme: <T extends ComponentTheme>(component: string) => (theme: InferComponentTheme<T>) => void;
30
+ /** The resolver `useComponentTheme` returns: the theme's class slots, optionally pre-bound. */
31
+ export type UseComponentTheme<T extends ComponentTheme> = {
32
+ /** With shared variant values: every class slot already carrying them (`slots.root()`). */
33
+ (theme: InferComponentTheme<T> | undefined, shared: SharedThemeProps<T>): BoundTheme<T>;
34
+ /** The resolved theme, one class function per slot. Last, so `ReturnType` reads this one. */
35
+ (theme?: InferComponentTheme<T>): T;
36
+ };
30
37
  /**
31
38
  * Resolves a component's class slots through the same ladder `useComponentMotion` walks,
32
39
  * lowest first: the component's own theme, the `<Theme components>` registry, a
33
40
  * `set<Component>Theme` subtree, then the instance `theme` prop. Each rung layers on the
34
41
  * one below it — a subtree that restyles one slot must not drop the registry's others.
35
42
  */
36
- export declare const useComponentTheme: <T extends ComponentTheme>(component: string, defaultTheme: T) => ((theme?: InferComponentTheme<T>) => T);
43
+ export declare const useComponentTheme: <T extends ComponentTheme>(component: string, defaultTheme: T) => UseComponentTheme<T>;
37
44
  /**
38
45
  * One component's entry in the `<Theme components>` registry: the same object a
39
46
  * `set<Component>Theme` call takes — class slots plus the reserved `motion` slot.
@@ -51,4 +58,32 @@ export type ComponentThemeOverride = {
51
58
  };
52
59
  /** App-wide component theme defaults, keyed by the component's theme context name. */
53
60
  export type ComponentThemeRegistry = Record<string, ComponentThemeOverride>;
61
+ type SlotProps<S> = S extends (props?: infer P) => string ? NonNullable<P> : never;
62
+ type KeysOfUnion<U> = U extends unknown ? keyof U : never;
63
+ type ValueIn<U, K> = U extends unknown ? (K extends keyof U ? U[K] : never) : never;
64
+ type ClassSlots<T> = {
65
+ [K in keyof T as T[K] extends (props?: never) => string ? K : never]: T[K];
66
+ };
67
+ type AnySlotProps<T> = SlotProps<ClassSlots<T>[keyof ClassSlots<T>]>;
68
+ /** Every variant any class slot of the theme accepts, each valued as the union the slots take. */
69
+ export type SharedThemeProps<T extends ComponentTheme> = {
70
+ [K in Exclude<KeysOfUnion<AnySlotProps<T>>, 'class' | 'className'>]?: ValueIn<AnySlotProps<T>, K>;
71
+ };
72
+ /** The theme's class slots, each already carrying the shared props. */
73
+ export type BoundTheme<T extends ComponentTheme> = {
74
+ [K in keyof ClassSlots<T>]: (props?: SlotProps<ClassSlots<T>[K]>) => string;
75
+ };
76
+ /**
77
+ * The primitive behind a `use{Component}Theme(theme, shared)` resolver's second argument.
78
+ *
79
+ * Binds a component's variant values to every class slot at once, so a template reads
80
+ * `slots.root()` instead of threading the same props into each call. A slot can still add its
81
+ * own on top — `slots.panel({ placement: 'static' })`, `slots.root({ className })` — and a
82
+ * slot ignores any shared variant it does not declare, exactly as `cva` always has.
83
+ *
84
+ * Every slot now sees every prop, so a theme override keyed on a variant the component used
85
+ * to pass only to its root (`prefix: { color: { primary } }`) reaches the slot it names.
86
+ * Each slot still resolves and merges its own classes; what this removes is the threading.
87
+ */
88
+ export declare const bindTheme: <T extends ComponentTheme>(theme: T, shared: SharedThemeProps<T>) => BoundTheme<T>;
54
89
  export {};
@@ -17,7 +17,7 @@ const pick = (o, props) => o && [
17
17
  ];
18
18
  // `<Theme components>` is the registry every subtree inherits. Read through the Theme
19
19
  // context key so this module stays free of Theme imports.
20
- const registryTheme = (component) => getContext('sveltaiTheme')
20
+ const registryTheme = (component) => getContext('entasisTheme')
21
21
  ?.componentThemes?.[component];
22
22
  /**
23
23
  * Resolves a component's class slots through the same ladder `useComponentMotion` walks,
@@ -26,7 +26,7 @@ const registryTheme = (component) => getContext('sveltaiTheme')
26
26
  * one below it — a subtree that restyles one slot must not drop the registry's others.
27
27
  */
28
28
  export const useComponentTheme = (component, defaultTheme) => {
29
- return (rawTheme) => {
29
+ const resolve = (rawTheme) => {
30
30
  const ctx = getContext(`${component}Theme`);
31
31
  const registry = registryTheme(component);
32
32
  const { override: localOverride, ...local } = rawTheme ?? {};
@@ -56,4 +56,27 @@ export const useComponentTheme = (component, defaultTheme) => {
56
56
  }
57
57
  return changed ? theme : defaultTheme;
58
58
  };
59
+ return ((rawTheme, shared) => shared ? bindTheme(resolve(rawTheme), shared) : resolve(rawTheme));
60
+ };
61
+ /**
62
+ * The primitive behind a `use{Component}Theme(theme, shared)` resolver's second argument.
63
+ *
64
+ * Binds a component's variant values to every class slot at once, so a template reads
65
+ * `slots.root()` instead of threading the same props into each call. A slot can still add its
66
+ * own on top — `slots.panel({ placement: 'static' })`, `slots.root({ className })` — and a
67
+ * slot ignores any shared variant it does not declare, exactly as `cva` always has.
68
+ *
69
+ * Every slot now sees every prop, so a theme override keyed on a variant the component used
70
+ * to pass only to its root (`prefix: { color: { primary } }`) reaches the slot it names.
71
+ * Each slot still resolves and merges its own classes; what this removes is the threading.
72
+ */
73
+ export const bindTheme = (theme, shared) => {
74
+ const bound = {};
75
+ for (const slot in theme) {
76
+ if (slot === 'motion')
77
+ continue;
78
+ const resolve = theme[slot];
79
+ bound[slot] = (props) => resolve(props ? { ...shared, ...props } : shared);
80
+ }
81
+ return bound;
59
82
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "entasis",
3
- "version": "0.4.1",
3
+ "version": "0.6.0",
4
4
  "license": "MIT",
5
5
  "scripts": {
6
6
  "dev": "vite dev",