@urbicon-ui/blocks 6.2.0 → 6.3.1
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.
- package/dist/components/AreaChart/AreaChart.svelte +2 -6
- package/dist/components/BarChart/BarChart.svelte +2 -6
- package/dist/components/Calendar/Calendar.svelte +12 -10
- package/dist/components/Calendar/calendar.variants.d.ts +2 -1
- package/dist/components/Calendar/index.d.ts +2 -2
- package/dist/components/CommandPalette/CommandPalette.svelte +106 -39
- package/dist/components/CommandPalette/commandPalette.variants.d.ts +3 -7
- package/dist/components/CommandPalette/commandPalette.variants.js +0 -1
- package/dist/components/CommandPalette/index.d.ts +2 -2
- package/dist/components/CompositionBar/CompositionBar.svelte +12 -15
- package/dist/components/CompositionBar/composition-bar.variants.d.ts +3 -1
- package/dist/components/CompositionBar/index.d.ts +2 -2
- package/dist/components/DonutChart/DonutChart.svelte +2 -6
- package/dist/components/EmptyState/EmptyState.svelte +8 -9
- package/dist/components/EmptyState/emptyState.variants.d.ts +3 -1
- package/dist/components/EmptyState/index.d.ts +3 -3
- package/dist/components/FileUpload/FileUpload.svelte +17 -17
- package/dist/components/FileUpload/fileUpload.variants.d.ts +3 -11
- package/dist/components/FileUpload/fileUpload.variants.js +0 -5
- package/dist/components/FileUpload/index.d.ts +4 -3
- package/dist/components/Guide/Guide.svelte +5 -8
- package/dist/components/Guide/GuideArticle.svelte +5 -8
- package/dist/components/Guide/GuideBeacon.svelte +5 -8
- package/dist/components/Guide/GuideHint.svelte +5 -8
- package/dist/components/Guide/GuideMarker.svelte +5 -8
- package/dist/components/Guide/GuideMention.svelte +5 -8
- package/dist/components/Guide/GuidePanel.svelte +5 -8
- package/dist/components/Guide/guide.variants.d.ts +9 -1
- package/dist/components/Guide/index.d.ts +12 -9
- package/dist/components/LineChart/LineChart.svelte +2 -6
- package/dist/components/Planner/Planner.svelte +7 -10
- package/dist/components/Planner/index.d.ts +4 -4
- package/dist/components/Planner/planner.variants.d.ts +3 -1
- package/dist/components/Sankey/Sankey.svelte +8 -9
- package/dist/components/Sankey/index.d.ts +2 -2
- package/dist/components/Sankey/sankey.variants.d.ts +3 -1
- package/dist/components/SidebarLayout/SidebarLayout.svelte +17 -17
- package/dist/components/SidebarLayout/index.d.ts +8 -2
- package/dist/components/SidebarLayout/sidebar-layout.variants.d.ts +3 -1
- package/dist/components/ThemeSwitcher/ThemeSwitcher.svelte +30 -38
- package/dist/components/ThemeSwitcher/index.d.ts +6 -4
- package/dist/components/ThemeSwitcher/themeSwitcher.variants.d.ts +3 -1
- package/dist/primitives/Accordion/Accordion.svelte +7 -9
- package/dist/primitives/Accordion/AccordionItem.svelte +8 -20
- package/dist/primitives/Accordion/accordion.variants.d.ts +3 -1
- package/dist/primitives/Accordion/index.d.ts +6 -6
- package/dist/primitives/Alert/Alert.svelte +7 -21
- package/dist/primitives/Alert/alert.variants.d.ts +3 -1
- package/dist/primitives/Alert/index.d.ts +3 -3
- package/dist/primitives/Avatar/Avatar.svelte +17 -20
- package/dist/primitives/Avatar/avatar.variants.d.ts +3 -1
- package/dist/primitives/Avatar/index.d.ts +3 -3
- package/dist/primitives/Badge/Badge.svelte +2 -2
- package/dist/primitives/Badge/badge.variants.d.ts +3 -1
- package/dist/primitives/Badge/index.d.ts +2 -2
- package/dist/primitives/Breadcrumb/Breadcrumb.svelte +30 -32
- package/dist/primitives/Breadcrumb/breadcrumb.variants.d.ts +3 -1
- package/dist/primitives/Breadcrumb/index.d.ts +2 -2
- package/dist/primitives/Button/Button.svelte +21 -21
- package/dist/primitives/Button/button.variants.d.ts +3 -1
- package/dist/primitives/Button/index.d.ts +3 -3
- package/dist/primitives/ButtonGroup/ButtonGroup.svelte +15 -14
- package/dist/primitives/ButtonGroup/buttongroup.variants.d.ts +3 -1
- package/dist/primitives/ButtonGroup/index.d.ts +3 -2
- package/dist/primitives/Card/Card.svelte +15 -18
- package/dist/primitives/Card/card.variants.d.ts +3 -1
- package/dist/primitives/Card/index.d.ts +3 -3
- package/dist/primitives/Checkbox/Checkbox.svelte +20 -20
- package/dist/primitives/Checkbox/checkbox.variants.d.ts +3 -1
- package/dist/primitives/Checkbox/index.d.ts +7 -3
- package/dist/primitives/Collapsible/Collapsible.svelte +30 -30
- package/dist/primitives/Collapsible/collapsible.variants.d.ts +3 -1
- package/dist/primitives/Collapsible/index.d.ts +3 -3
- package/dist/primitives/Combobox/Combobox.svelte +20 -31
- package/dist/primitives/Combobox/combobox.variants.d.ts +3 -1
- package/dist/primitives/Combobox/index.d.ts +5 -3
- package/dist/primitives/Dialog/Dialog.svelte +7 -10
- package/dist/primitives/Dialog/dialog.variants.d.ts +3 -1
- package/dist/primitives/Dialog/index.d.ts +2 -2
- package/dist/primitives/Drawer/Drawer.svelte +7 -10
- package/dist/primitives/Drawer/drawer.variants.d.ts +3 -1
- package/dist/primitives/Drawer/index.d.ts +2 -2
- package/dist/primitives/Input/Input.svelte +54 -30
- package/dist/primitives/Input/index.d.ts +7 -3
- package/dist/primitives/Input/input.variants.d.ts +3 -1
- package/dist/primitives/Menu/Menu.svelte +23 -23
- package/dist/primitives/Menu/index.d.ts +4 -1
- package/dist/primitives/Menu/menu.variants.d.ts +3 -1
- package/dist/primitives/Pagination/Pagination.svelte +18 -16
- package/dist/primitives/Pagination/index.d.ts +2 -2
- package/dist/primitives/Pagination/pagination.variants.d.ts +3 -1
- package/dist/primitives/Popover/Popover.svelte +2 -6
- package/dist/primitives/Progress/Progress.svelte +17 -17
- package/dist/primitives/Progress/index.d.ts +8 -3
- package/dist/primitives/Progress/progress.variants.d.ts +3 -1
- package/dist/primitives/RadioGroup/RadioGroup.svelte +16 -16
- package/dist/primitives/RadioGroup/RadioItem.svelte +19 -19
- package/dist/primitives/RadioGroup/index.d.ts +3 -3
- package/dist/primitives/RadioGroup/radioGroup.variants.d.ts +4 -1
- package/dist/primitives/SegmentGroup/SegmentGroup.svelte +14 -11
- package/dist/primitives/SegmentGroup/SegmentItem.svelte +12 -11
- package/dist/primitives/SegmentGroup/index.d.ts +3 -3
- package/dist/primitives/SegmentGroup/segmentgroup.variants.d.ts +3 -1
- package/dist/primitives/Select/Select.svelte +31 -22
- package/dist/primitives/Select/index.d.ts +8 -3
- package/dist/primitives/Select/select.variants.d.ts +3 -1
- package/dist/primitives/Separator/Separator.svelte +2 -6
- package/dist/primitives/Sidebar/Sidebar.svelte +6 -9
- package/dist/primitives/Sidebar/index.d.ts +2 -2
- package/dist/primitives/Sidebar/sidebar.variants.d.ts +3 -1
- package/dist/primitives/Skeleton/Skeleton.svelte +7 -9
- package/dist/primitives/Skeleton/index.d.ts +3 -3
- package/dist/primitives/Skeleton/skeleton.variants.d.ts +3 -1
- package/dist/primitives/Skeleton/skeleton.variants.js +5 -6
- package/dist/primitives/Slider/Slider.svelte +19 -19
- package/dist/primitives/Slider/index.d.ts +8 -3
- package/dist/primitives/Slider/slider.variants.d.ts +3 -1
- package/dist/primitives/Spinner/Spinner.svelte +7 -9
- package/dist/primitives/Spinner/index.d.ts +5 -3
- package/dist/primitives/Spinner/spinner.variants.d.ts +3 -1
- package/dist/primitives/Stepper/Stepper.svelte +13 -18
- package/dist/primitives/Stepper/StepperStep.svelte +18 -19
- package/dist/primitives/Stepper/index.d.ts +5 -5
- package/dist/primitives/Stepper/stepper.variants.d.ts +3 -1
- package/dist/primitives/Tab/Tab.svelte +14 -17
- package/dist/primitives/Tab/TabItem.svelte +18 -19
- package/dist/primitives/Tab/TabPanel.svelte +10 -13
- package/dist/primitives/Tab/index.d.ts +7 -7
- package/dist/primitives/Tab/tab.variants.d.ts +3 -1
- package/dist/primitives/Textarea/Textarea.svelte +23 -23
- package/dist/primitives/Textarea/index.d.ts +7 -3
- package/dist/primitives/Textarea/textarea.variants.d.ts +3 -1
- package/dist/primitives/Toast/Toaster.svelte +5 -6
- package/dist/primitives/Toast/index.d.ts +2 -2
- package/dist/primitives/Toast/toast.variants.d.ts +3 -1
- package/dist/primitives/Toggle/Toggle.svelte +19 -19
- package/dist/primitives/Toggle/index.d.ts +7 -3
- package/dist/primitives/Toggle/toggle.variants.d.ts +3 -1
- package/dist/primitives/Toolbar/Toolbar.svelte +7 -9
- package/dist/primitives/Toolbar/index.d.ts +4 -3
- package/dist/primitives/Toolbar/toolbar.variants.d.ts +3 -1
- package/dist/primitives/Tooltip/Tooltip.svelte +7 -9
- package/dist/primitives/Tooltip/index.d.ts +2 -2
- package/dist/primitives/Tooltip/tooltip.variants.d.ts +3 -1
- package/dist/style/semantic.css +5 -0
- package/dist/utils/variants.d.ts +17 -0
- package/package.json +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type VariantProps } from '../../utils/variants';
|
|
1
|
+
import { type SlotNames, type VariantProps } from '../../utils/variants';
|
|
2
2
|
export declare const fileUploadVariants: (props?: import("../../utils/variants").TVProps<{
|
|
3
3
|
size: {
|
|
4
4
|
sm: {
|
|
@@ -182,16 +182,6 @@ export declare const fileUploadVariants: (props?: import("../../utils/variants")
|
|
|
182
182
|
class?: string | false | (string | false | (string | false | (string | false | (string | false | (string | false | (string | false | (string | false | (string | false | (string | false | (string | false | (string | false | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
|
|
183
183
|
className?: string | false | (string | false | (string | false | (string | false | (string | false | (string | false | (string | false | (string | false | (string | false | (string | false | (string | false | (string | false | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
|
|
184
184
|
}) | undefined) => string;
|
|
185
|
-
fileItemActions: (props?: ({
|
|
186
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
187
|
-
intent?: "primary" | "neutral" | undefined;
|
|
188
|
-
dragging?: boolean | undefined;
|
|
189
|
-
invalid?: boolean | undefined;
|
|
190
|
-
disabled?: boolean | undefined;
|
|
191
|
-
} & {
|
|
192
|
-
class?: string | false | (string | false | (string | false | (string | false | (string | false | (string | false | (string | false | (string | false | (string | false | (string | false | (string | false | (string | false | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
|
|
193
|
-
className?: string | false | (string | false | (string | false | (string | false | (string | false | (string | false | (string | false | (string | false | (string | false | (string | false | (string | false | (string | false | /*elided*/ any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
|
|
194
|
-
}) | undefined) => string;
|
|
195
185
|
fileItemRemoveButton: (props?: ({
|
|
196
186
|
size?: "sm" | "md" | "lg" | undefined;
|
|
197
187
|
intent?: "primary" | "neutral" | undefined;
|
|
@@ -224,3 +214,5 @@ export declare const fileUploadVariants: (props?: import("../../utils/variants")
|
|
|
224
214
|
}) | undefined) => string;
|
|
225
215
|
};
|
|
226
216
|
export type FileUploadVariants = VariantProps<typeof fileUploadVariants>;
|
|
217
|
+
/** Slot names derived from the `tv()` config above — single source of truth for `slotClasses`. */
|
|
218
|
+
export type FileUploadSlots = SlotNames<typeof fileUploadVariants>;
|
|
@@ -39,11 +39,6 @@ export const fileUploadVariants = tv({
|
|
|
39
39
|
fileItemName: ['truncate text-text-primary font-medium'],
|
|
40
40
|
fileItemSize: ['text-text-tertiary'],
|
|
41
41
|
fileItemProgress: ['w-full'],
|
|
42
|
-
fileItemActions: [
|
|
43
|
-
'flex flex-shrink-0 items-center gap-1',
|
|
44
|
-
'opacity-0 group-hover:opacity-100 group-focus-within:opacity-100',
|
|
45
|
-
'transition-opacity duration-[var(--blocks-duration-fast)]'
|
|
46
|
-
],
|
|
47
42
|
// tier: modify — small destructive sub-button.
|
|
48
43
|
fileItemRemoveButton: [
|
|
49
44
|
'flex items-center justify-center rounded-modify',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
2
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
3
|
import type { MintProp } from '../../mint';
|
|
4
|
-
import type { FileUploadVariants } from './fileUpload.variants';
|
|
4
|
+
import type { FileUploadSlots, FileUploadVariants } from './fileUpload.variants';
|
|
5
5
|
export type FileUploadErrorCode = 'FILE_INVALID_TYPE' | 'FILE_TOO_LARGE' | 'FILE_TOO_SMALL' | 'TOO_MANY_FILES' | 'FILE_EXISTS' | 'CUSTOM';
|
|
6
6
|
export interface FileUploadError {
|
|
7
7
|
/** Machine-readable error code. */
|
|
@@ -40,7 +40,8 @@ export interface FileItemContext {
|
|
|
40
40
|
/** Remove this file from the list. */
|
|
41
41
|
remove: () => void;
|
|
42
42
|
}
|
|
43
|
-
|
|
43
|
+
/** Slot names for `slotClasses` — derived from the `tv()` config (single source of truth). */
|
|
44
|
+
export type FileUploadSlotName = FileUploadSlots;
|
|
44
45
|
/**
|
|
45
46
|
* @description Drag-and-drop file upload with validation, image previews, progress tracking, and animated file list.
|
|
46
47
|
* @tag form
|
|
@@ -142,7 +143,7 @@ export interface FileUploadProps extends Omit<FileUploadVariants, 'dragging' | '
|
|
|
142
143
|
/** Strip all default styles. */
|
|
143
144
|
unstyled?: boolean;
|
|
144
145
|
/** Per-slot class overrides. */
|
|
145
|
-
slotClasses?: Partial<Record<
|
|
146
|
+
slotClasses?: Partial<Record<FileUploadSlots, string>>;
|
|
146
147
|
/**
|
|
147
148
|
* Apply a named preset registered via `<BlocksProvider presets={{ FileUpload: {...} }}>`.
|
|
148
149
|
* Prefer this over `class` overrides when the requested look falls outside the
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { MediaQuery } from 'svelte/reactivity';
|
|
4
4
|
import { useBlocksI18n } from '../../i18n';
|
|
5
5
|
import { Button } from '../../primitives/Button';
|
|
6
|
-
import { getBlocksConfig,
|
|
6
|
+
import { getBlocksConfig, resolveSlotClasses } from '../../provider';
|
|
7
7
|
import {
|
|
8
8
|
computePosition,
|
|
9
9
|
autoUpdate,
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
} from '../../utils/floating';
|
|
15
15
|
import { observeTargetResolution } from '../../utils/observe-target';
|
|
16
16
|
import { getGuideContext } from './guide.context';
|
|
17
|
-
import { guideTourVariants } from './guide.variants';
|
|
17
|
+
import { guideTourVariants, type GuideTourVariants } from './guide.variants';
|
|
18
18
|
import type { GuideProps } from './index';
|
|
19
19
|
|
|
20
20
|
const bt = useBlocksI18n();
|
|
@@ -44,14 +44,11 @@
|
|
|
44
44
|
|
|
45
45
|
const blocksConfig = getBlocksConfig();
|
|
46
46
|
const unstyled = $derived(unstyledProp || blocksConfig?.unstyled || false);
|
|
47
|
+
const variantProps: GuideTourVariants = $derived({});
|
|
48
|
+
const styles = $derived(guideTourVariants(variantProps));
|
|
47
49
|
const slotClasses = $derived(
|
|
48
|
-
|
|
49
|
-
blocksConfig?.defaults?.Guide?.slotClasses,
|
|
50
|
-
resolvePresetSlotClasses(blocksConfig?.presets, 'Guide', preset),
|
|
51
|
-
slotClassesProp
|
|
52
|
-
)
|
|
50
|
+
resolveSlotClasses(blocksConfig, 'Guide', preset, variantProps, slotClassesProp)
|
|
53
51
|
);
|
|
54
|
-
const styles = $derived(guideTourVariants());
|
|
55
52
|
|
|
56
53
|
// ── Controller-driven tour state ───────────────────────────────────────────
|
|
57
54
|
const isTourActive = $derived(guide?.isTourActive ?? false);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { getBlocksConfig,
|
|
2
|
+
import { getBlocksConfig, resolveSlotClasses } from '../../provider';
|
|
3
3
|
import { getGuideContext } from './guide.context';
|
|
4
4
|
import { getGuidePanelContext } from './guide-panel.context';
|
|
5
|
-
import { guideArticleVariants } from './guide.variants';
|
|
5
|
+
import { guideArticleVariants, type GuideArticleVariants } from './guide.variants';
|
|
6
6
|
import type { GuideArticleProps } from './index';
|
|
7
7
|
|
|
8
8
|
let {
|
|
@@ -28,14 +28,11 @@
|
|
|
28
28
|
|
|
29
29
|
const blocksConfig = getBlocksConfig();
|
|
30
30
|
const unstyled = $derived(unstyledProp || blocksConfig?.unstyled || false);
|
|
31
|
+
const variantProps: GuideArticleVariants = $derived({});
|
|
32
|
+
const styles = $derived(guideArticleVariants(variantProps));
|
|
31
33
|
const slotClasses = $derived(
|
|
32
|
-
|
|
33
|
-
blocksConfig?.defaults?.GuideArticle?.slotClasses,
|
|
34
|
-
resolvePresetSlotClasses(blocksConfig?.presets, 'GuideArticle', preset),
|
|
35
|
-
slotClassesProp
|
|
36
|
-
)
|
|
34
|
+
resolveSlotClasses(blocksConfig, 'GuideArticle', preset, variantProps, slotClassesProp)
|
|
37
35
|
);
|
|
38
|
-
const styles = $derived(guideArticleVariants());
|
|
39
36
|
|
|
40
37
|
const isActive = $derived(guide?.activeArticle === id);
|
|
41
38
|
</script>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { useBlocksI18n } from '../../i18n';
|
|
3
|
-
import { getBlocksConfig,
|
|
3
|
+
import { getBlocksConfig, resolveSlotClasses } from '../../provider';
|
|
4
4
|
import { getGuideContext } from './guide.context';
|
|
5
|
-
import { guideBeaconVariants } from './guide.variants';
|
|
5
|
+
import { guideBeaconVariants, type GuideBeaconVariants } from './guide.variants';
|
|
6
6
|
import type { GuideBeaconProps } from './index';
|
|
7
7
|
|
|
8
8
|
const bt = useBlocksI18n();
|
|
@@ -30,14 +30,11 @@
|
|
|
30
30
|
|
|
31
31
|
const blocksConfig = getBlocksConfig();
|
|
32
32
|
const unstyled = $derived(unstyledProp || blocksConfig?.unstyled || false);
|
|
33
|
+
const variantProps: GuideBeaconVariants = $derived({ size });
|
|
34
|
+
const styles = $derived(guideBeaconVariants(variantProps));
|
|
33
35
|
const slotClasses = $derived(
|
|
34
|
-
|
|
35
|
-
blocksConfig?.defaults?.GuideBeacon?.slotClasses,
|
|
36
|
-
resolvePresetSlotClasses(blocksConfig?.presets, 'GuideBeacon', preset),
|
|
37
|
-
slotClassesProp
|
|
38
|
-
)
|
|
36
|
+
resolveSlotClasses(blocksConfig, 'GuideBeacon', preset, variantProps, slotClassesProp)
|
|
39
37
|
);
|
|
40
|
-
const styles = $derived(guideBeaconVariants({ size }));
|
|
41
38
|
|
|
42
39
|
// Hide once the tour has been seen (gentle, never nags) and while it is running (the
|
|
43
40
|
// tour's own scrim takes over). Both reactive: `hasSeen` reads the controller's seen set,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { useBlocksI18n } from '../../i18n';
|
|
3
3
|
import { CloseIcon } from '../../icons';
|
|
4
|
-
import { getBlocksConfig,
|
|
4
|
+
import { getBlocksConfig, resolveSlotClasses } from '../../provider';
|
|
5
5
|
import {
|
|
6
6
|
computePosition,
|
|
7
7
|
autoUpdate,
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
} from '../../utils/floating';
|
|
13
13
|
import { observeTargetResolution } from '../../utils/observe-target';
|
|
14
14
|
import { getGuideContext } from './guide.context';
|
|
15
|
-
import { guideHintVariants } from './guide.variants';
|
|
15
|
+
import { guideHintVariants, type GuideHintVariants } from './guide.variants';
|
|
16
16
|
import type { GuideHintProps } from './index';
|
|
17
17
|
|
|
18
18
|
const bt = useBlocksI18n();
|
|
@@ -45,14 +45,11 @@
|
|
|
45
45
|
|
|
46
46
|
const blocksConfig = getBlocksConfig();
|
|
47
47
|
const unstyled = $derived(unstyledProp || blocksConfig?.unstyled || false);
|
|
48
|
+
const variantProps: GuideHintVariants = $derived({});
|
|
49
|
+
const styles = $derived(guideHintVariants(variantProps));
|
|
48
50
|
const slotClasses = $derived(
|
|
49
|
-
|
|
50
|
-
blocksConfig?.defaults?.GuideHint?.slotClasses,
|
|
51
|
-
resolvePresetSlotClasses(blocksConfig?.presets, 'GuideHint', preset),
|
|
52
|
-
slotClassesProp
|
|
53
|
-
)
|
|
51
|
+
resolveSlotClasses(blocksConfig, 'GuideHint', preset, variantProps, slotClassesProp)
|
|
54
52
|
);
|
|
55
|
-
const styles = $derived(guideHintVariants());
|
|
56
53
|
|
|
57
54
|
const seenId = $derived(seenIdProp ?? topicId);
|
|
58
55
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { useBlocksI18n } from '../../i18n';
|
|
3
3
|
import { InfoCircleIcon } from '../../icons';
|
|
4
|
-
import { getBlocksConfig,
|
|
4
|
+
import { getBlocksConfig, resolveSlotClasses } from '../../provider';
|
|
5
5
|
import { getGuideContext } from './guide.context';
|
|
6
|
-
import { guideMarkerVariants } from './guide.variants';
|
|
6
|
+
import { guideMarkerVariants, type GuideMarkerVariants } from './guide.variants';
|
|
7
7
|
import type { GuideMarkerProps } from './index';
|
|
8
8
|
|
|
9
9
|
const bt = useBlocksI18n();
|
|
@@ -32,14 +32,11 @@
|
|
|
32
32
|
|
|
33
33
|
const blocksConfig = getBlocksConfig();
|
|
34
34
|
const unstyled = $derived(unstyledProp || blocksConfig?.unstyled || false);
|
|
35
|
+
const variantProps: GuideMarkerVariants = $derived({ size });
|
|
36
|
+
const styles = $derived(guideMarkerVariants(variantProps));
|
|
35
37
|
const slotClasses = $derived(
|
|
36
|
-
|
|
37
|
-
blocksConfig?.defaults?.GuideMarker?.slotClasses,
|
|
38
|
-
resolvePresetSlotClasses(blocksConfig?.presets, 'GuideMarker', preset),
|
|
39
|
-
slotClassesProp
|
|
40
|
-
)
|
|
38
|
+
resolveSlotClasses(blocksConfig, 'GuideMarker', preset, variantProps, slotClassesProp)
|
|
41
39
|
);
|
|
42
|
-
const styles = $derived(guideMarkerVariants({ size }));
|
|
43
40
|
|
|
44
41
|
// A Marker is the UI→Guide affordance; it is live unless the resolved direction
|
|
45
42
|
// is 'to-ui' only. With no `for` there is no topic to gate on (the prop wins).
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { getBlocksConfig,
|
|
2
|
+
import { getBlocksConfig, resolveSlotClasses } from '../../provider';
|
|
3
3
|
import { getGuideContext } from './guide.context';
|
|
4
|
-
import { guideMentionVariants } from './guide.variants';
|
|
4
|
+
import { guideMentionVariants, type GuideMentionVariants } from './guide.variants';
|
|
5
5
|
import type { GuideMentionProps } from './index';
|
|
6
6
|
|
|
7
7
|
let {
|
|
@@ -26,14 +26,11 @@
|
|
|
26
26
|
|
|
27
27
|
const blocksConfig = getBlocksConfig();
|
|
28
28
|
const unstyled = $derived(unstyledProp || blocksConfig?.unstyled || false);
|
|
29
|
+
const variantProps: GuideMentionVariants = $derived({});
|
|
30
|
+
const styles = $derived(guideMentionVariants(variantProps));
|
|
29
31
|
const slotClasses = $derived(
|
|
30
|
-
|
|
31
|
-
blocksConfig?.defaults?.GuideMention?.slotClasses,
|
|
32
|
-
resolvePresetSlotClasses(blocksConfig?.presets, 'GuideMention', preset),
|
|
33
|
-
slotClassesProp
|
|
34
|
-
)
|
|
32
|
+
resolveSlotClasses(blocksConfig, 'GuideMention', preset, variantProps, slotClassesProp)
|
|
35
33
|
);
|
|
36
|
-
const styles = $derived(guideMentionVariants());
|
|
37
34
|
|
|
38
35
|
// A Mention is the Guide→UI affordance; it is interactive unless the resolved
|
|
39
36
|
// direction is 'to-guide' only (then it degrades to plain inline text).
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
import { SvelteMap } from 'svelte/reactivity';
|
|
4
4
|
import { useBlocksI18n } from '../../i18n';
|
|
5
5
|
import { CloseIcon, ChevronLeftIcon, ChevronRightIcon } from '../../icons';
|
|
6
|
-
import { getBlocksConfig,
|
|
6
|
+
import { getBlocksConfig, resolveSlotClasses } from '../../provider';
|
|
7
7
|
import { getGuideContext } from './guide.context';
|
|
8
8
|
import { setGuidePanelContext } from './guide-panel.context';
|
|
9
|
-
import { guidePanelVariants } from './guide.variants';
|
|
9
|
+
import { guidePanelVariants, type GuidePanelVariants } from './guide.variants';
|
|
10
10
|
import type { GuidePanelProps } from './index';
|
|
11
11
|
|
|
12
12
|
const bt = useBlocksI18n();
|
|
@@ -54,14 +54,11 @@
|
|
|
54
54
|
|
|
55
55
|
const blocksConfig = getBlocksConfig();
|
|
56
56
|
const unstyled = $derived(unstyledProp || blocksConfig?.unstyled || false);
|
|
57
|
+
const variantProps: GuidePanelVariants = $derived({ placement, size });
|
|
58
|
+
const styles = $derived(guidePanelVariants(variantProps));
|
|
57
59
|
const slotClasses = $derived(
|
|
58
|
-
|
|
59
|
-
blocksConfig?.defaults?.GuidePanel?.slotClasses,
|
|
60
|
-
resolvePresetSlotClasses(blocksConfig?.presets, 'GuidePanel', preset),
|
|
61
|
-
slotClassesProp
|
|
62
|
-
)
|
|
60
|
+
resolveSlotClasses(blocksConfig, 'GuidePanel', preset, variantProps, slotClassesProp)
|
|
63
61
|
);
|
|
64
|
-
const styles = $derived(guidePanelVariants({ placement, size }));
|
|
65
62
|
|
|
66
63
|
const open = $derived(guide?.panelOpen ?? false);
|
|
67
64
|
const activeArticle = $derived(guide?.activeArticle ?? null);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type VariantProps } from '../../utils/variants';
|
|
1
|
+
import { type SlotNames, type VariantProps } from '../../utils/variants';
|
|
2
2
|
/**
|
|
3
3
|
* Styling for the non-modal `GuidePanel` (D1). Mirrors the `Drawer` look
|
|
4
4
|
* (surface-overlay, hairline border, lg shadow) but sits at `--z-sidebar`
|
|
@@ -276,3 +276,11 @@ export type GuideArticleVariants = VariantProps<typeof guideArticleVariants>;
|
|
|
276
276
|
export type GuideMarkerVariants = VariantProps<typeof guideMarkerVariants>;
|
|
277
277
|
export type GuideMentionVariants = VariantProps<typeof guideMentionVariants>;
|
|
278
278
|
export type GuideHintVariants = VariantProps<typeof guideHintVariants>;
|
|
279
|
+
/** Slot names derived from each `tv()` config — single source of truth for `slotClasses`. */
|
|
280
|
+
export type GuidePanelSlots = SlotNames<typeof guidePanelVariants>;
|
|
281
|
+
export type GuideTourSlots = SlotNames<typeof guideTourVariants>;
|
|
282
|
+
export type GuideBeaconSlots = SlotNames<typeof guideBeaconVariants>;
|
|
283
|
+
export type GuideArticleSlots = SlotNames<typeof guideArticleVariants>;
|
|
284
|
+
export type GuideMarkerSlots = SlotNames<typeof guideMarkerVariants>;
|
|
285
|
+
export type GuideMentionSlots = SlotNames<typeof guideMentionVariants>;
|
|
286
|
+
export type GuideHintSlots = SlotNames<typeof guideHintVariants>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
2
|
import type { GuideController, GuideDirection, GuideStorageAdapter, GuideTour, Placement } from '../../utils';
|
|
3
|
-
import type { GuideBeaconVariants, GuideMarkerVariants, GuidePanelVariants } from './guide.variants';
|
|
3
|
+
import type { GuideArticleSlots, GuideBeaconSlots, GuideBeaconVariants, GuideHintSlots, GuideMarkerSlots, GuideMarkerVariants, GuideMentionSlots, GuidePanelSlots, GuidePanelVariants, GuideTourSlots } from './guide.variants';
|
|
4
4
|
/**
|
|
5
5
|
* @description Root provider for the Guide help system. Instantiates a `GuideController`
|
|
6
6
|
* and shares it via context with all Guide surfaces (Panel, Marker, Mention, Hint, Tour).
|
|
@@ -85,7 +85,7 @@ export interface GuidePanelProps {
|
|
|
85
85
|
/** Strip all default styles. @default false */
|
|
86
86
|
unstyled?: boolean;
|
|
87
87
|
/** Per-slot class overrides. */
|
|
88
|
-
slotClasses?: Partial<Record<
|
|
88
|
+
slotClasses?: Partial<Record<GuidePanelSlots, string>>;
|
|
89
89
|
/** Apply a named preset registered via `<BlocksProvider presets={{ GuidePanel: {...} }}>`. */
|
|
90
90
|
preset?: string;
|
|
91
91
|
}
|
|
@@ -118,7 +118,7 @@ export interface GuideArticleProps {
|
|
|
118
118
|
/** Strip all default styles. @default false */
|
|
119
119
|
unstyled?: boolean;
|
|
120
120
|
/** Per-slot class overrides. */
|
|
121
|
-
slotClasses?: Partial<Record<
|
|
121
|
+
slotClasses?: Partial<Record<GuideArticleSlots, string>>;
|
|
122
122
|
/** Apply a named preset registered via `<BlocksProvider presets={{ GuideArticle: {...} }}>`. */
|
|
123
123
|
preset?: string;
|
|
124
124
|
}
|
|
@@ -169,7 +169,7 @@ export interface GuideMarkerProps {
|
|
|
169
169
|
/** Strip all default styles. @default false */
|
|
170
170
|
unstyled?: boolean;
|
|
171
171
|
/** Per-slot class overrides. */
|
|
172
|
-
slotClasses?: Partial<Record<
|
|
172
|
+
slotClasses?: Partial<Record<GuideMarkerSlots, string>>;
|
|
173
173
|
/** Apply a named preset registered via `<BlocksProvider presets={{ GuideMarker: {...} }}>`. */
|
|
174
174
|
preset?: string;
|
|
175
175
|
}
|
|
@@ -212,7 +212,7 @@ export interface GuideMentionProps {
|
|
|
212
212
|
/** Strip all default styles. @default false */
|
|
213
213
|
unstyled?: boolean;
|
|
214
214
|
/** Per-slot class overrides. */
|
|
215
|
-
slotClasses?: Partial<Record<
|
|
215
|
+
slotClasses?: Partial<Record<GuideMentionSlots, string>>;
|
|
216
216
|
/** Apply a named preset registered via `<BlocksProvider presets={{ GuideMention: {...} }}>`. */
|
|
217
217
|
preset?: string;
|
|
218
218
|
}
|
|
@@ -283,7 +283,7 @@ export interface GuideHintProps {
|
|
|
283
283
|
/** Strip all default styles. @default false */
|
|
284
284
|
unstyled?: boolean;
|
|
285
285
|
/** Per-slot class overrides. */
|
|
286
|
-
slotClasses?: Partial<Record<
|
|
286
|
+
slotClasses?: Partial<Record<GuideHintSlots, string>>;
|
|
287
287
|
/** Apply a named preset registered via `<BlocksProvider presets={{ GuideHint: {...} }}>`. */
|
|
288
288
|
preset?: string;
|
|
289
289
|
}
|
|
@@ -342,8 +342,11 @@ export interface GuideProps {
|
|
|
342
342
|
class?: string;
|
|
343
343
|
/** Strip all default styles. @default false */
|
|
344
344
|
unstyled?: boolean;
|
|
345
|
-
/**
|
|
346
|
-
|
|
345
|
+
/**
|
|
346
|
+
* Per-slot class overrides. Beyond the tour's own `tv()` slots, `skip` / `prev` / `next`
|
|
347
|
+
* forward to the footer's nested `<Button>`s (which own their internal markup).
|
|
348
|
+
*/
|
|
349
|
+
slotClasses?: Partial<Record<GuideTourSlots | 'skip' | 'prev' | 'next', string>>;
|
|
347
350
|
/** Apply a named preset registered via `<BlocksProvider presets={{ Guide: {...} }}>`. */
|
|
348
351
|
preset?: string;
|
|
349
352
|
}
|
|
@@ -394,7 +397,7 @@ export interface GuideBeaconProps {
|
|
|
394
397
|
/** Strip all default styles. @default false */
|
|
395
398
|
unstyled?: boolean;
|
|
396
399
|
/** Per-slot class overrides. */
|
|
397
|
-
slotClasses?: Partial<Record<
|
|
400
|
+
slotClasses?: Partial<Record<GuideBeaconSlots, string>>;
|
|
398
401
|
/** Apply a named preset registered via `<BlocksProvider presets={{ GuideBeacon: {...} }}>`. */
|
|
399
402
|
preset?: string;
|
|
400
403
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { getBlocksConfig,
|
|
2
|
+
import { getBlocksConfig, resolveSlotClasses } from '../../provider';
|
|
3
3
|
import type { LineChartProps } from './index';
|
|
4
4
|
import type { ChartSeries } from '../../internal/charts/types';
|
|
5
5
|
import { chartSlotResolver } from '../../internal/charts/variants';
|
|
@@ -37,11 +37,7 @@
|
|
|
37
37
|
const blocksConfig = getBlocksConfig();
|
|
38
38
|
const unstyled = $derived(unstyledProp || blocksConfig?.unstyled || false);
|
|
39
39
|
const slotClasses = $derived(
|
|
40
|
-
|
|
41
|
-
blocksConfig?.defaults?.LineChart?.slotClasses,
|
|
42
|
-
resolvePresetSlotClasses(blocksConfig?.presets, 'LineChart', preset),
|
|
43
|
-
slotClassesProp
|
|
44
|
-
)
|
|
40
|
+
resolveSlotClasses(blocksConfig, 'LineChart', preset, {}, slotClassesProp)
|
|
45
41
|
);
|
|
46
42
|
const slot = $derived(chartSlotResolver(unstyled, slotClasses));
|
|
47
43
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts" generics="T = unknown">
|
|
2
2
|
import { useBlocksI18n } from '../..';
|
|
3
|
-
import { getBlocksConfig,
|
|
3
|
+
import { getBlocksConfig, resolveSlotClasses } from '../../provider';
|
|
4
4
|
import { stripTime } from '../../date';
|
|
5
5
|
import {
|
|
6
6
|
DateGridController,
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
} from '../../internal/date-grid';
|
|
15
15
|
import { bucketItemsByDate } from './planner.bucket';
|
|
16
16
|
import { setPlannerContext } from './planner.context';
|
|
17
|
-
import { plannerVariants } from './planner.variants';
|
|
17
|
+
import { plannerVariants, type PlannerVariants } from './planner.variants';
|
|
18
18
|
import type {
|
|
19
19
|
PlannerCellContext,
|
|
20
20
|
PlannerContext,
|
|
@@ -70,16 +70,13 @@
|
|
|
70
70
|
// --- BlocksConfig integration ---
|
|
71
71
|
const blocksConfig = getBlocksConfig();
|
|
72
72
|
const unstyled = $derived(unstyledProp || blocksConfig?.unstyled || false);
|
|
73
|
-
const slotClasses = $derived(
|
|
74
|
-
mergeSlotClasses(
|
|
75
|
-
blocksConfig?.defaults?.Planner?.slotClasses,
|
|
76
|
-
resolvePresetSlotClasses(blocksConfig?.presets, 'Planner', preset),
|
|
77
|
-
slotClassesProp
|
|
78
|
-
)
|
|
79
|
-
);
|
|
80
73
|
|
|
81
74
|
// --- Styling: one tv() instance, resolved per slot ---
|
|
82
|
-
const
|
|
75
|
+
const variantProps: PlannerVariants = $derived({ view, variant, size });
|
|
76
|
+
const styles = $derived(plannerVariants(variantProps));
|
|
77
|
+
const slotClasses = $derived(
|
|
78
|
+
resolveSlotClasses(blocksConfig, 'Planner', preset, variantProps, slotClassesProp)
|
|
79
|
+
);
|
|
83
80
|
function slot(name: PlannerSlotName, extra?: string): string {
|
|
84
81
|
const overrides = [slotClasses?.[name], extra].filter(Boolean).join(' ');
|
|
85
82
|
if (unstyled) return overrides;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
2
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
-
import type { PlannerCellContext, PlannerDayContext, PlannerHeaderContext, PlannerRange,
|
|
4
|
-
import type { PlannerVariants } from './planner.variants';
|
|
3
|
+
import type { PlannerCellContext, PlannerDayContext, PlannerHeaderContext, PlannerRange, PlannerView } from './planner.types';
|
|
4
|
+
import type { PlannerSlots, PlannerVariants } from './planner.variants';
|
|
5
5
|
/**
|
|
6
6
|
* @description Date-indexed planning board — a week, month or custom-range grid
|
|
7
7
|
* whose cells hold YOUR domain content (meals, shifts, bookings, content slots)
|
|
@@ -98,8 +98,8 @@ export interface PlannerProps<T = unknown> extends Omit<PlannerVariants, 'view'>
|
|
|
98
98
|
class?: string;
|
|
99
99
|
/** Remove all default tv() classes — only user-provided classes apply. @default false */
|
|
100
100
|
unstyled?: boolean;
|
|
101
|
-
/** Per-slot class overrides merged with tv() styles. */
|
|
102
|
-
slotClasses?: Partial<Record<
|
|
101
|
+
/** Per-slot class overrides merged with tv() styles. Slots: base | header | headerTitle | nav | navButton | grid | weekdayHeader | weekday | weekNumber | week | cell | cellHeader | cellWeekday | cellDate | cellItems | empty */
|
|
102
|
+
slotClasses?: Partial<Record<PlannerSlots, string>>;
|
|
103
103
|
/** Apply a named preset registered via `<BlocksProvider presets={{ Planner: {...} }}>`. */
|
|
104
104
|
preset?: string;
|
|
105
105
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type VariantProps } from '../../utils/variants';
|
|
1
|
+
import { type SlotNames, type VariantProps } from '../../utils/variants';
|
|
2
2
|
/**
|
|
3
3
|
* Planner styling — the visible chrome layered over the headless `DateGridScaffold`.
|
|
4
4
|
*
|
|
@@ -199,3 +199,5 @@ export declare const plannerVariants: (props?: import("../../utils/variants").TV
|
|
|
199
199
|
}) | undefined) => string;
|
|
200
200
|
};
|
|
201
201
|
export type PlannerVariants = VariantProps<typeof plannerVariants>;
|
|
202
|
+
/** Slot names derived from the tv() config — single source of truth for slotClasses. */
|
|
203
|
+
export type PlannerSlots = SlotNames<typeof plannerVariants>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { useBlocksI18n } from '../..';
|
|
3
3
|
import { useI18n } from '@urbicon-ui/i18n';
|
|
4
|
-
import { getBlocksConfig,
|
|
4
|
+
import { getBlocksConfig, resolveSlotClasses } from '../../provider';
|
|
5
5
|
import {
|
|
6
6
|
computeSankeyLayout,
|
|
7
7
|
sankeyLinkPath,
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
SankeyLaidOutLinkWithMeta,
|
|
15
15
|
SankeyLaidOutNodeWithMeta
|
|
16
16
|
} from './index';
|
|
17
|
-
import { sankeyVariants } from './sankey.variants';
|
|
17
|
+
import { sankeyVariants, type SankeyVariants } from './sankey.variants';
|
|
18
18
|
|
|
19
19
|
const bt = useBlocksI18n();
|
|
20
20
|
const i18n = useI18n();
|
|
@@ -50,12 +50,13 @@
|
|
|
50
50
|
|
|
51
51
|
const blocksConfig = getBlocksConfig();
|
|
52
52
|
const unstyled = $derived(unstyledProp || blocksConfig?.unstyled || false);
|
|
53
|
+
|
|
54
|
+
const variantProps: SankeyVariants = $derived({ intent });
|
|
55
|
+
|
|
56
|
+
const styles = $derived(sankeyVariants(variantProps));
|
|
57
|
+
|
|
53
58
|
const slotClasses = $derived(
|
|
54
|
-
|
|
55
|
-
blocksConfig?.defaults?.Sankey?.slotClasses,
|
|
56
|
-
resolvePresetSlotClasses(blocksConfig?.presets, 'Sankey', preset),
|
|
57
|
-
slotClassesProp
|
|
58
|
-
)
|
|
59
|
+
resolveSlotClasses(blocksConfig, 'Sankey', preset, variantProps, slotClassesProp)
|
|
59
60
|
);
|
|
60
61
|
|
|
61
62
|
let wrapperRef = $state<HTMLDivElement>();
|
|
@@ -195,8 +196,6 @@
|
|
|
195
196
|
tooltipPos = { ...tooltipPos, visible: false };
|
|
196
197
|
}
|
|
197
198
|
|
|
198
|
-
const styles = $derived(sankeyVariants({ intent }));
|
|
199
|
-
|
|
200
199
|
// Tooltip data based on the hovered state
|
|
201
200
|
const tooltipDatum = $derived.by<
|
|
202
201
|
| { kind: 'node'; node: SankeyLaidOutNodeWithMeta; inputLabel: string }
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
2
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
3
|
import type { SankeyLaidOutLink, SankeyLaidOutNode } from '../../internal/sankey/layout';
|
|
4
|
-
import type { SankeyVariants } from './sankey.variants';
|
|
4
|
+
import type { SankeySlots, SankeyVariants } from './sankey.variants';
|
|
5
5
|
export type SankeyIntent = 'primary' | 'secondary' | 'success' | 'warning' | 'danger' | 'neutral';
|
|
6
6
|
/** Input node of the Sankey component. */
|
|
7
7
|
export interface SankeyNode {
|
|
@@ -124,7 +124,7 @@ export interface SankeyProps extends Omit<SankeyVariants, never>, Omit<HTMLAttri
|
|
|
124
124
|
/** Remove default classes. */
|
|
125
125
|
unstyled?: boolean;
|
|
126
126
|
/** Per-slot class overrides. */
|
|
127
|
-
slotClasses?: Partial<Record<
|
|
127
|
+
slotClasses?: Partial<Record<SankeySlots, string>>;
|
|
128
128
|
/** Preset name. */
|
|
129
129
|
preset?: string;
|
|
130
130
|
/** Custom snippet for node content (inside the SVG, instead of the label). */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type VariantProps } from '../../utils/variants';
|
|
1
|
+
import { type SlotNames, type VariantProps } from '../../utils/variants';
|
|
2
2
|
export declare const sankeyVariants: (props?: import("../../utils/variants").TVProps<{
|
|
3
3
|
intent: {
|
|
4
4
|
primary: {
|
|
@@ -89,3 +89,5 @@ export declare const sankeyVariants: (props?: import("../../utils/variants").TVP
|
|
|
89
89
|
}) | undefined) => string;
|
|
90
90
|
};
|
|
91
91
|
export type SankeyVariants = VariantProps<typeof sankeyVariants>;
|
|
92
|
+
/** Slot names derived from the `tv()` config above — single source of truth for `slotClasses`. */
|
|
93
|
+
export type SankeySlots = SlotNames<typeof sankeyVariants>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { MediaQuery } from 'svelte/reactivity';
|
|
3
3
|
import { Sidebar } from '../../primitives/Sidebar';
|
|
4
|
-
import { getBlocksConfig,
|
|
4
|
+
import { getBlocksConfig, resolveSlotClasses } from '../../provider';
|
|
5
5
|
import type { SidebarLayoutProps } from './index';
|
|
6
|
-
import { sidebarLayoutVariants } from './sidebar-layout.variants';
|
|
6
|
+
import { sidebarLayoutVariants, type SidebarLayoutVariants } from './sidebar-layout.variants';
|
|
7
7
|
|
|
8
8
|
let {
|
|
9
9
|
open = $bindable(false),
|
|
@@ -28,15 +28,6 @@
|
|
|
28
28
|
|
|
29
29
|
const blocksConfig = getBlocksConfig();
|
|
30
30
|
const unstyled = $derived(unstyledProp || blocksConfig?.unstyled || false);
|
|
31
|
-
const slotClasses = $derived(
|
|
32
|
-
mergeSlotClasses(
|
|
33
|
-
blocksConfig?.defaults?.SidebarLayout?.slotClasses,
|
|
34
|
-
resolvePresetSlotClasses(blocksConfig?.presets, 'SidebarLayout', preset),
|
|
35
|
-
slotClassesProp
|
|
36
|
-
)
|
|
37
|
-
);
|
|
38
|
-
|
|
39
|
-
const styles = $derived(sidebarLayoutVariants({ side, contentMaxWidth }));
|
|
40
31
|
|
|
41
32
|
// Mirror the Sidebar's effective-width logic so the layout root can expose
|
|
42
33
|
// the value to the main content (the Sidebar's own --sidebar-effective-width
|
|
@@ -47,6 +38,18 @@
|
|
|
47
38
|
open || (mode === 'responsive' && !isMobile) ? sidebarWidth : '0px'
|
|
48
39
|
);
|
|
49
40
|
|
|
41
|
+
// Variant props feed both the tv() style computation and the slot-class
|
|
42
|
+
// cascade — extracted into one derived so `resolveSlotClasses` can match
|
|
43
|
+
// conditional `overrides` against the layout's active variants. Annotated so
|
|
44
|
+
// the string-literal `side`/`contentMaxWidth` props stay narrowed.
|
|
45
|
+
const variantProps: SidebarLayoutVariants = $derived({ side, contentMaxWidth });
|
|
46
|
+
|
|
47
|
+
const styles = $derived(sidebarLayoutVariants(variantProps));
|
|
48
|
+
|
|
49
|
+
const slotClasses = $derived(
|
|
50
|
+
resolveSlotClasses(blocksConfig, 'SidebarLayout', preset, variantProps, slotClassesProp)
|
|
51
|
+
);
|
|
52
|
+
|
|
50
53
|
// Forward sidebar-related slotClasses to the embedded Sidebar.
|
|
51
54
|
const sidebarSlotClasses = $derived({
|
|
52
55
|
panel: slotClasses?.sidebar,
|
|
@@ -56,11 +59,6 @@
|
|
|
56
59
|
footer: slotClasses?.sidebarFooter
|
|
57
60
|
});
|
|
58
61
|
|
|
59
|
-
function rootClass() {
|
|
60
|
-
if (unstyled) return [slotClasses?.root, className].filter(Boolean).join(' ');
|
|
61
|
-
return styles.root({ class: [slotClasses?.root, className] });
|
|
62
|
-
}
|
|
63
|
-
|
|
64
62
|
function openSidebar() {
|
|
65
63
|
open = true;
|
|
66
64
|
onOpenChange?.(true);
|
|
@@ -74,7 +72,9 @@
|
|
|
74
72
|
|
|
75
73
|
<div
|
|
76
74
|
{...restProps}
|
|
77
|
-
class={
|
|
75
|
+
class={unstyled
|
|
76
|
+
? [slotClasses?.root, className].filter(Boolean).join(' ')
|
|
77
|
+
: styles.root({ class: [slotClasses?.root, className] })}
|
|
78
78
|
style:--sidebar-width={sidebarWidth}
|
|
79
79
|
style:--sidebar-effective-width={effectiveWidth}
|
|
80
80
|
data-side={side}
|