@diegopluna/narvi 0.4.0 → 0.5.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.
- package/README.md +3 -1
- package/dist/base.css +3 -0
- package/dist/components/button/Button.svelte +29 -17
- package/dist/components/checkbox/Checkbox.svelte +106 -54
- package/dist/components/checkbox/Checkbox.svelte.d.ts +22 -8
- package/dist/components/choice-cards/ChoiceCards.svelte +68 -39
- package/dist/components/choice-cards/ChoiceCards.svelte.d.ts +12 -8
- package/dist/components/collapsible/CollapsibleContent.svelte +71 -17
- package/dist/components/collapsible/CollapsibleContent.svelte.d.ts +14 -10
- package/dist/components/collapsible/CollapsibleRoot.svelte +13 -9
- package/dist/components/collapsible/CollapsibleRoot.svelte.d.ts +8 -9
- package/dist/components/collapsible/CollapsibleTrigger.svelte +24 -15
- package/dist/components/collapsible/CollapsibleTrigger.svelte.d.ts +10 -14
- package/dist/components/color-field/ColorField.svelte +13 -7
- package/dist/components/command/CommandDialog.svelte +30 -20
- package/dist/components/command/CommandDialog.svelte.d.ts +4 -3
- package/dist/components/command/CommandEmpty.svelte +11 -9
- package/dist/components/command/CommandEmpty.svelte.d.ts +6 -17
- package/dist/components/command/CommandGroup.svelte +32 -11
- package/dist/components/command/CommandGroup.svelte.d.ts +7 -11
- package/dist/components/command/CommandInput.svelte +25 -10
- package/dist/components/command/CommandInput.svelte.d.ts +8 -12
- package/dist/components/command/CommandItem.svelte +67 -29
- package/dist/components/command/CommandItem.svelte.d.ts +6 -32
- package/dist/components/command/CommandList.svelte +8 -10
- package/dist/components/command/CommandList.svelte.d.ts +6 -8
- package/dist/components/command/CommandRoot.svelte +247 -57
- package/dist/components/command/CommandRoot.svelte.d.ts +14 -28
- package/dist/components/command/CommandSeparator.svelte +18 -0
- package/dist/components/command/CommandSeparator.svelte.d.ts +7 -0
- package/dist/components/command/context.d.ts +27 -0
- package/dist/components/command/context.js +16 -0
- package/dist/components/command/index.d.ts +6 -4
- package/dist/components/command/index.js +5 -4
- package/dist/components/command/score.d.ts +27 -0
- package/dist/components/command/score.js +77 -0
- package/dist/components/command/styles.d.ts +32 -9
- package/dist/components/command/styles.js +42 -14
- package/dist/components/composer/ComposerModelPicker.svelte +365 -347
- package/dist/components/composer/ComposerModelPicker.svelte.d.ts +6 -3
- package/dist/components/composer/ComposerRoot.svelte.d.ts +1 -1
- package/dist/components/dialog/ConfirmDialog.svelte +73 -53
- package/dist/components/dialog/DialogClose.svelte +17 -0
- package/dist/components/dialog/DialogClose.svelte.d.ts +10 -0
- package/dist/components/dialog/DialogContent.svelte +35 -33
- package/dist/components/dialog/DialogContent.svelte.d.ts +6 -20
- package/dist/components/dialog/DialogDescription.svelte +9 -12
- package/dist/components/dialog/DialogDescription.svelte.d.ts +6 -8
- package/dist/components/dialog/DialogRoot.svelte +20 -0
- package/dist/components/dialog/DialogRoot.svelte.d.ts +7 -0
- package/dist/components/dialog/DialogTitle.svelte +12 -8
- package/dist/components/dialog/DialogTitle.svelte.d.ts +8 -8
- package/dist/components/dialog/DialogTrigger.svelte +17 -0
- package/dist/components/dialog/DialogTrigger.svelte.d.ts +10 -0
- package/dist/components/dialog/index.d.ts +6 -5
- package/dist/components/dialog/index.js +3 -6
- package/dist/components/dialog/styles.d.ts +1 -2
- package/dist/components/dialog/styles.js +11 -8
- package/dist/components/hover-card/HoverCardContent.svelte +35 -29
- package/dist/components/hover-card/HoverCardContent.svelte.d.ts +8 -12
- package/dist/components/hover-card/HoverCardRoot.svelte +7 -7
- package/dist/components/hover-card/HoverCardRoot.svelte.d.ts +5 -4
- package/dist/components/hover-card/HoverCardTrigger.svelte +18 -0
- package/dist/components/hover-card/HoverCardTrigger.svelte.d.ts +10 -0
- package/dist/components/hover-card/index.d.ts +2 -3
- package/dist/components/hover-card/index.js +1 -5
- package/dist/components/input/Input.svelte.d.ts +1 -1
- package/dist/components/markdown/MarkdownBlock.svelte +6 -3
- package/dist/components/markdown/MarkdownTable.svelte +15 -7
- package/dist/components/menu/ContextMenuContent.svelte +15 -15
- package/dist/components/menu/ContextMenuContent.svelte.d.ts +6 -9
- package/dist/components/menu/ContextMenuTrigger.svelte +14 -16
- package/dist/components/menu/ContextMenuTrigger.svelte.d.ts +8 -14
- package/dist/components/menu/MenuCheckboxItem.svelte +22 -11
- package/dist/components/menu/MenuCheckboxItem.svelte.d.ts +8 -22
- package/dist/components/menu/MenuContent.svelte +16 -18
- package/dist/components/menu/MenuContent.svelte.d.ts +6 -18
- package/dist/components/menu/MenuGroup.svelte +4 -4
- package/dist/components/menu/MenuGroup.svelte.d.ts +5 -4
- package/dist/components/menu/MenuItem.svelte +25 -12
- package/dist/components/menu/MenuItem.svelte.d.ts +6 -21
- package/dist/components/menu/MenuLabel.svelte +7 -11
- package/dist/components/menu/MenuLabel.svelte.d.ts +6 -8
- package/dist/components/menu/MenuRadioGroup.svelte +4 -4
- package/dist/components/menu/MenuRadioGroup.svelte.d.ts +5 -4
- package/dist/components/menu/MenuRadioItem.svelte +16 -14
- package/dist/components/menu/MenuRadioItem.svelte.d.ts +6 -19
- package/dist/components/menu/MenuSeparator.svelte +6 -10
- package/dist/components/menu/MenuSeparator.svelte.d.ts +6 -7
- package/dist/components/menu/MenuSubContent.svelte +22 -19
- package/dist/components/menu/MenuSubContent.svelte.d.ts +8 -15
- package/dist/components/menu/MenuSubTrigger.svelte +7 -11
- package/dist/components/menu/MenuSubTrigger.svelte.d.ts +6 -15
- package/dist/components/menu/MenuTrigger.svelte +17 -0
- package/dist/components/menu/MenuTrigger.svelte.d.ts +10 -0
- package/dist/components/menu/context-menu.d.ts +2 -2
- package/dist/components/menu/context-menu.js +3 -2
- package/dist/components/menu/group.js +1 -1
- package/dist/components/menu/index.d.ts +5 -4
- package/dist/components/menu/index.js +5 -5
- package/dist/components/menu/row.d.ts +20 -0
- package/dist/components/menu/row.js +12 -0
- package/dist/components/popover/PopoverClose.svelte +17 -0
- package/dist/components/popover/PopoverClose.svelte.d.ts +10 -0
- package/dist/components/popover/PopoverContent.svelte +30 -29
- package/dist/components/popover/PopoverContent.svelte.d.ts +6 -17
- package/dist/components/popover/PopoverTrigger.svelte +17 -0
- package/dist/components/popover/PopoverTrigger.svelte.d.ts +10 -0
- package/dist/components/popover/index.d.ts +6 -4
- package/dist/components/popover/index.js +6 -5
- package/dist/components/progress/Progress.svelte +16 -22
- package/dist/components/progress/Progress.svelte.d.ts +6 -5
- package/dist/components/queued-message/QueuedMessage.svelte +10 -3
- package/dist/components/queued-message/QueuedMessage.svelte.d.ts +2 -1
- package/dist/components/rail/RailItem.svelte +20 -6
- package/dist/components/reasoning/ReasoningRoot.svelte.d.ts +1 -1
- package/dist/components/segmented/SegmentedControl.svelte +100 -91
- package/dist/components/segmented/SegmentedControl.svelte.d.ts +6 -4
- package/dist/components/select/Select.svelte +97 -59
- package/dist/components/select/Select.svelte.d.ts +3 -2
- package/dist/components/sheet/SheetContent.svelte +31 -38
- package/dist/components/sheet/SheetContent.svelte.d.ts +7 -22
- package/dist/components/sheet/index.d.ts +3 -5
- package/dist/components/sheet/index.js +3 -5
- package/dist/components/sheet/styles.js +26 -5
- package/dist/components/sidebar/SidebarItem.svelte +10 -6
- package/dist/components/slider/Slider.svelte +86 -65
- package/dist/components/slider/Slider.svelte.d.ts +9 -8
- package/dist/components/split-button/SplitButton.svelte +20 -3
- package/dist/components/split-button/SplitButton.svelte.d.ts +1 -1
- package/dist/components/switch/Switch.svelte +77 -49
- package/dist/components/switch/Switch.svelte.d.ts +15 -8
- package/dist/components/tab-strip/TabStrip.svelte +110 -76
- package/dist/components/tab-strip/TabStrip.svelte.d.ts +7 -2
- package/dist/components/tabs/Tabs.svelte +129 -99
- package/dist/components/tabs/Tabs.svelte.d.ts +6 -4
- package/dist/components/textarea/Textarea.svelte.d.ts +1 -1
- package/dist/components/toast/Toaster.svelte +132 -115
- package/dist/components/toast/Toaster.svelte.d.ts +5 -0
- package/dist/components/toast/toasts.svelte.d.ts +10 -23
- package/dist/components/toast/toasts.svelte.js +62 -40
- package/dist/components/toggle/Toggle.svelte +15 -9
- package/dist/components/toggle/Toggle.svelte.d.ts +8 -17
- package/dist/components/toggle-group/ToggleGroupItem.svelte +20 -9
- package/dist/components/toggle-group/ToggleGroupItem.svelte.d.ts +10 -10
- package/dist/components/toggle-group/ToggleGroupRoot.svelte +33 -18
- package/dist/components/toggle-group/ToggleGroupRoot.svelte.d.ts +4 -4
- package/dist/components/tool/ToolRoot.svelte.d.ts +1 -1
- package/dist/components/tooltip/TooltipContent.svelte +38 -28
- package/dist/components/tooltip/TooltipContent.svelte.d.ts +6 -15
- package/dist/components/tooltip/TooltipProvider.svelte +34 -10
- package/dist/components/tooltip/TooltipProvider.svelte.d.ts +18 -4
- package/dist/components/tooltip/TooltipRoot.svelte +52 -23
- package/dist/components/tooltip/TooltipRoot.svelte.d.ts +10 -10
- package/dist/components/tooltip/TooltipTrigger.svelte +14 -17
- package/dist/components/tooltip/TooltipTrigger.svelte.d.ts +10 -4
- package/dist/components/tooltip/index.d.ts +1 -1
- package/dist/components/tooltip/index.js +1 -1
- package/dist/components/work-fold/WorkFold.svelte +14 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +1 -1
- package/dist/internal/TooltipScope.svelte +4 -4
- package/dist/internal/layer.d.ts +11 -9
- package/dist/internal/layer.js +21 -15
- package/dist/internal/loose.d.ts +30 -5
- package/dist/internal/loose.js +1 -1
- package/dist/internal/markers.stylex.d.ts +0 -4
- package/dist/internal/markers.stylex.js +0 -2
- package/dist/internal/toggle.d.ts +3 -0
- package/dist/internal/toggle.js +6 -2
- package/dist/internal/tooltip-trigger.d.ts +7 -6
- package/dist/internal/tooltip-trigger.js +9 -12
- package/dist/typography.d.ts +5 -0
- package/dist/typography.js +5 -0
- package/dist/vite.d.ts +7 -1
- package/dist/vite.js +20 -5
- package/package.json +3 -2
- package/skills/building-ui/SKILL.md +21 -21
- package/skills/building-ui/references/components.md +22 -7
- package/skills/markdown/SKILL.md +1 -1
- package/skills/setup/SKILL.md +4 -8
- package/skills/styling/SKILL.md +4 -2
- package/skills/theming/SKILL.md +3 -7
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* the fill of what is chosen.
|
|
6
6
|
*/
|
|
7
7
|
import * as stylex from '@stylexjs/stylex';
|
|
8
|
+
import './icons.css';
|
|
8
9
|
export declare const toggle: Readonly<{
|
|
9
10
|
readonly base: Readonly<{
|
|
10
11
|
readonly position: stylex.StyleXClassNameFor<"position", "relative">;
|
|
@@ -37,6 +38,7 @@ export declare const toggle: Readonly<{
|
|
|
37
38
|
readonly transitionTimingFunction: stylex.StyleXClassNameFor<"transitionTimingFunction", "ease" | `${stylex.StyleXVar<string>}, ease, ease, ease`>;
|
|
38
39
|
}>;
|
|
39
40
|
readonly sm: Readonly<{
|
|
41
|
+
readonly '--narvi-icon-size': stylex.StyleXClassNameFor<"--narvi-icon-size", "0.875rem">;
|
|
40
42
|
readonly minHeight: stylex.StyleXClassNameFor<"minHeight", string>;
|
|
41
43
|
readonly paddingInline: stylex.StyleXClassNameFor<"paddingInline", string>;
|
|
42
44
|
readonly gap: stylex.StyleXClassNameFor<"gap", "0.375rem">;
|
|
@@ -50,6 +52,7 @@ export declare const toggle: Readonly<{
|
|
|
50
52
|
}>;
|
|
51
53
|
}>;
|
|
52
54
|
readonly md: Readonly<{
|
|
55
|
+
readonly '--narvi-icon-size': stylex.StyleXClassNameFor<"--narvi-icon-size", "1rem">;
|
|
53
56
|
readonly minHeight: stylex.StyleXClassNameFor<"minHeight", string>;
|
|
54
57
|
readonly paddingInline: stylex.StyleXClassNameFor<"paddingInline", string>;
|
|
55
58
|
readonly gap: stylex.StyleXClassNameFor<"gap", "0.4375rem">;
|
package/dist/internal/toggle.js
CHANGED
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
import * as stylex from '@stylexjs/stylex';
|
|
8
8
|
import { colors, density, font, motion, radius } from '../tokens.stylex.js';
|
|
9
9
|
import { media } from '../media.stylex.js';
|
|
10
|
-
|
|
10
|
+
import './icons.css';
|
|
11
|
+
const ON = ':is([data-pressed])';
|
|
11
12
|
const DISABLED = ':is([data-disabled])';
|
|
12
13
|
/** A length at the window's density (`density` in the tokens). */
|
|
13
14
|
const d = (rem) => `calc(${rem} * ${density.factor})`;
|
|
@@ -64,8 +65,10 @@ export const toggle = stylex.create({
|
|
|
64
65
|
[media.motion]: `${motion.easeOut}, ease, ease, ease`
|
|
65
66
|
}
|
|
66
67
|
},
|
|
67
|
-
// The same heights as Button's, and the same 40px reach for a finger, at any density
|
|
68
|
+
// The same heights as Button's, and the same 40px reach for a finger, at any density. Each sets
|
|
69
|
+
// the size of an icon put inside it, as Button's do (`icons.css`): 14 and 16px.
|
|
68
70
|
sm: {
|
|
71
|
+
'--narvi-icon-size': '0.875rem',
|
|
69
72
|
minHeight: d('1.75rem'),
|
|
70
73
|
paddingInline: d('0.625rem'),
|
|
71
74
|
gap: '0.375rem',
|
|
@@ -79,6 +82,7 @@ export const toggle = stylex.create({
|
|
|
79
82
|
}
|
|
80
83
|
},
|
|
81
84
|
md: {
|
|
85
|
+
'--narvi-icon-size': '1rem',
|
|
82
86
|
minHeight: d('2rem'),
|
|
83
87
|
paddingInline: d('0.75rem'),
|
|
84
88
|
gap: '0.4375rem',
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* A
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* keys
|
|
7
|
-
* keyed by
|
|
2
|
+
* A tooltip trigger's props, for an element in a group that moves its own focus (the radios of a
|
|
3
|
+
* SegmentedControl, the tabs of Tabs). Left off: a `tabindex` or `disabled`, which would make
|
|
4
|
+
* every item a tab stop or shut one, and the trigger's `type`, which the group's own part sets
|
|
5
|
+
* as it needs. The mark it adds tells the Tooltip.Root that a click the keyboard makes (`detail`
|
|
6
|
+
* 0, as when the arrow keys choose a radio) should not shut the tooltip, so it shows as the keys
|
|
7
|
+
* reach an item. A spread keeps the attachment ui-sdk binds the trigger with, which is keyed by
|
|
8
|
+
* a symbol.
|
|
8
9
|
*/
|
|
9
10
|
export declare function groupTrigger(props: Record<string, unknown>): Record<string, unknown>;
|
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* A
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* keys
|
|
7
|
-
* keyed by
|
|
2
|
+
* A tooltip trigger's props, for an element in a group that moves its own focus (the radios of a
|
|
3
|
+
* SegmentedControl, the tabs of Tabs). Left off: a `tabindex` or `disabled`, which would make
|
|
4
|
+
* every item a tab stop or shut one, and the trigger's `type`, which the group's own part sets
|
|
5
|
+
* as it needs. The mark it adds tells the Tooltip.Root that a click the keyboard makes (`detail`
|
|
6
|
+
* 0, as when the arrow keys choose a radio) should not shut the tooltip, so it shows as the keys
|
|
7
|
+
* reach an item. A spread keeps the attachment ui-sdk binds the trigger with, which is keyed by
|
|
8
|
+
* a symbol.
|
|
8
9
|
*/
|
|
9
10
|
export function groupTrigger(props) {
|
|
10
|
-
const rest = { ...props };
|
|
11
|
+
const rest = { ...props, 'data-tooltip-group': '' };
|
|
12
|
+
delete rest.type;
|
|
11
13
|
delete rest.tabindex;
|
|
12
14
|
delete rest.disabled;
|
|
13
|
-
const click = rest.onclick;
|
|
14
|
-
rest.onclick = (event) => {
|
|
15
|
-
if (event.detail !== 0)
|
|
16
|
-
click?.(event);
|
|
17
|
-
};
|
|
18
15
|
return rest;
|
|
19
16
|
}
|
package/dist/typography.d.ts
CHANGED
|
@@ -78,6 +78,11 @@ export type TypeRole = keyof typeof typography;
|
|
|
78
78
|
* the mark it sits on). Without `monogram.mark` on an ancestor the letter is sized from the
|
|
79
79
|
* window, so never use `letter` alone.
|
|
80
80
|
*
|
|
81
|
+
* `mark` makes the mark a size container, so what is inside it no longer sizes it: a mark with
|
|
82
|
+
* no width and height of its own collapses to nothing, letter and all: give it both. It is
|
|
83
|
+
* `size`, not `inline-size`, because the letter is sized from the shorter side, which may be
|
|
84
|
+
* the height.
|
|
85
|
+
*
|
|
81
86
|
* <span {...stylex.attrs(monogram.mark, styles.mark)}>
|
|
82
87
|
* <span {...stylex.attrs(monogram.letter)}>AL</span>
|
|
83
88
|
* </span>
|
package/dist/typography.js
CHANGED
|
@@ -89,6 +89,11 @@ export const typography = stylex.create({
|
|
|
89
89
|
* the mark it sits on). Without `monogram.mark` on an ancestor the letter is sized from the
|
|
90
90
|
* window, so never use `letter` alone.
|
|
91
91
|
*
|
|
92
|
+
* `mark` makes the mark a size container, so what is inside it no longer sizes it: a mark with
|
|
93
|
+
* no width and height of its own collapses to nothing, letter and all: give it both. It is
|
|
94
|
+
* `size`, not `inline-size`, because the letter is sized from the shorter side, which may be
|
|
95
|
+
* the height.
|
|
96
|
+
*
|
|
92
97
|
* <span {...stylex.attrs(monogram.mark, styles.mark)}>
|
|
93
98
|
* <span {...stylex.attrs(monogram.letter)}>AL</span>
|
|
94
99
|
* </span>
|
package/dist/vite.d.ts
CHANGED
|
@@ -26,11 +26,17 @@ export declare const CSS_TARGET: string[];
|
|
|
26
26
|
export declare const NARVI_LAYER = "narvi";
|
|
27
27
|
/** The layer inside it that holds `@diegopluna/narvi/base.css`, below every component. */
|
|
28
28
|
export declare const BASE_LAYER = "narvi.base";
|
|
29
|
+
/**
|
|
30
|
+
* The layer ui-sdk, which Narvi's popups and controls are built on, writes its few rules into at
|
|
31
|
+
* runtime (a closed popup hidden, the popover's own box reset). It is named before Narvi's, so a
|
|
32
|
+
* component's padding and position beat the reset whichever is read first.
|
|
33
|
+
*/
|
|
34
|
+
export declare const UI_SDK_LAYER = "ui-sdk";
|
|
29
35
|
/**
|
|
30
36
|
* The order of Narvi's layer among Tailwind's, as the first rule of a stylesheet. With
|
|
31
37
|
* `narvi({ tailwind: true })` the plugin writes it at the top of each one that names a layer.
|
|
32
38
|
*/
|
|
33
|
-
export declare const TAILWIND_ORDER = "@layer theme, base, narvi.base, components, utilities;";
|
|
39
|
+
export declare const TAILWIND_ORDER = "@layer theme, base, ui-sdk, narvi.base, components, utilities;";
|
|
34
40
|
/**
|
|
35
41
|
* Puts Tailwind's layer order, with Narvi's in it, at the top of a stylesheet that names one of
|
|
36
42
|
* those layers. The browser orders layers as it first meets their names, and the first stylesheet
|
package/dist/vite.js
CHANGED
|
@@ -2,6 +2,7 @@ import stylex from '@stylexjs/unplugin';
|
|
|
2
2
|
import { Features } from 'lightningcss';
|
|
3
3
|
import { assertAfterSvelte } from './internal/plugin-order.js';
|
|
4
4
|
const PACKAGE = '@diegopluna/narvi';
|
|
5
|
+
const UI_SDK_CORE = '@ui-sdk/core';
|
|
5
6
|
/**
|
|
6
7
|
* The oldest browsers with `light-dark()`, which Narvi's colours are written in. The plugin
|
|
7
8
|
* makes them the build's CSS target unless the app sets `build.cssTarget` itself.
|
|
@@ -11,11 +12,17 @@ export const CSS_TARGET = ['chrome123', 'edge123', 'firefox120', 'safari17.5'];
|
|
|
11
12
|
export const NARVI_LAYER = 'narvi';
|
|
12
13
|
/** The layer inside it that holds `@diegopluna/narvi/base.css`, below every component. */
|
|
13
14
|
export const BASE_LAYER = `${NARVI_LAYER}.base`;
|
|
15
|
+
/**
|
|
16
|
+
* The layer ui-sdk, which Narvi's popups and controls are built on, writes its few rules into at
|
|
17
|
+
* runtime (a closed popup hidden, the popover's own box reset). It is named before Narvi's, so a
|
|
18
|
+
* component's padding and position beat the reset whichever is read first.
|
|
19
|
+
*/
|
|
20
|
+
export const UI_SDK_LAYER = 'ui-sdk';
|
|
14
21
|
/**
|
|
15
22
|
* The order of Narvi's layer among Tailwind's, as the first rule of a stylesheet. With
|
|
16
23
|
* `narvi({ tailwind: true })` the plugin writes it at the top of each one that names a layer.
|
|
17
24
|
*/
|
|
18
|
-
export const TAILWIND_ORDER = `@layer theme, base, ${BASE_LAYER}, components, utilities;`;
|
|
25
|
+
export const TAILWIND_ORDER = `@layer theme, base, ${UI_SDK_LAYER}, ${BASE_LAYER}, components, utilities;`;
|
|
19
26
|
// A stylesheet Vite compiles, including a Svelte component's (`?svelte&type=style&lang.css`),
|
|
20
27
|
// and not one imported as a URL or as text.
|
|
21
28
|
const CSS_RE = /\.(?:css|less|sass|scss|styl|stylus|pcss|postcss|sss)(?:$|\?)/;
|
|
@@ -56,11 +63,11 @@ export function narvi({ tailwind = false, ...options } = {}) {
|
|
|
56
63
|
// below every component whichever stylesheet the browser reads first.
|
|
57
64
|
useCSSLayers: tailwind
|
|
58
65
|
? {
|
|
59
|
-
before: ['theme', 'base', BASE_LAYER],
|
|
66
|
+
before: ['theme', 'base', UI_SDK_LAYER, BASE_LAYER],
|
|
60
67
|
prefix: NARVI_LAYER,
|
|
61
68
|
after: ['components', 'utilities']
|
|
62
69
|
}
|
|
63
|
-
: { before: [BASE_LAYER], prefix: NARVI_LAYER },
|
|
70
|
+
: { before: [UI_SDK_LAYER, BASE_LAYER], prefix: NARVI_LAYER },
|
|
64
71
|
// The style applied last wins, a shorthand over a longhand too: a caller's `padding` in
|
|
65
72
|
// `sx` sets a part's padding, which StyleX's default would leave to the part's own
|
|
66
73
|
// `paddingInline`, whatever the order
|
|
@@ -94,9 +101,17 @@ export function narvi({ tailwind = false, ...options } = {}) {
|
|
|
94
101
|
// components and leave the page light. An app that sets its own target keeps it.
|
|
95
102
|
config(user, env) {
|
|
96
103
|
const result = config?.call(this, user, env) ?? {};
|
|
104
|
+
// ui-sdk's core is plain ESM with no dependencies of its own, imported by subpath
|
|
105
|
+
// (`@ui-sdk/core/menu`, `/dialog`…) from ui-sdk's Svelte parts. Left to the dependency
|
|
106
|
+
// optimizer, each subpath is found only when a page first opens a part that uses it, and
|
|
107
|
+
// Vite reloads the page (a test, in Vitest) to bundle it. Served as it is, it never is.
|
|
108
|
+
const optimizeDeps = {
|
|
109
|
+
...result.optimizeDeps,
|
|
110
|
+
exclude: [...(result.optimizeDeps?.exclude ?? []), UI_SDK_CORE]
|
|
111
|
+
};
|
|
97
112
|
if (user.build?.cssTarget !== undefined)
|
|
98
|
-
return result;
|
|
99
|
-
return { ...result, build: { ...result.build, cssTarget: CSS_TARGET } };
|
|
113
|
+
return { ...result, optimizeDeps };
|
|
114
|
+
return { ...result, optimizeDeps, build: { ...result.build, cssTarget: CSS_TARGET } };
|
|
100
115
|
},
|
|
101
116
|
// A wrong order is the one mistake that stops the build, so it is named here
|
|
102
117
|
configResolved(config) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@diegopluna/narvi",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"packageManager": "pnpm@12.18.0",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -186,7 +186,8 @@
|
|
|
186
186
|
"@pierre/highlights": "0.5.0",
|
|
187
187
|
"@stylexjs/stylex": "0.19.1",
|
|
188
188
|
"@stylexjs/unplugin": "0.19.1",
|
|
189
|
-
"
|
|
189
|
+
"@ui-sdk/core": "0.1.0-beta.5",
|
|
190
|
+
"@ui-sdk/svelte": "0.1.0-beta.5",
|
|
190
191
|
"decode-named-character-reference": "1.3.0",
|
|
191
192
|
"dompurify": "3.4.17",
|
|
192
193
|
"esm-env": "^1.2.2",
|
|
@@ -8,11 +8,11 @@ description: >
|
|
|
8
8
|
metadata:
|
|
9
9
|
purpose: >
|
|
10
10
|
Build interfaces from Narvi's components and compound parts instead of hand-written markup
|
|
11
|
-
and CSS, with correct composition of
|
|
11
|
+
and CSS, with correct composition of ui-sdk based popups, responsive layout through Stack and
|
|
12
12
|
Grid, and Narvi's conventions for colour, labels and copy.
|
|
13
13
|
type: core
|
|
14
14
|
library: '@diegopluna/narvi'
|
|
15
|
-
library_version: '0.
|
|
15
|
+
library_version: '0.5.0'
|
|
16
16
|
requires:
|
|
17
17
|
- setup
|
|
18
18
|
sources:
|
|
@@ -91,8 +91,8 @@ them. The Root holds the state, and most of them take `bind:open` or `bind:value
|
|
|
91
91
|
|
|
92
92
|
### Render a Narvi Button as a trigger
|
|
93
93
|
|
|
94
|
-
Popups are built on
|
|
95
|
-
`child` snippet. To use a Narvi Button, spread the `props` the snippet receives onto it, so it
|
|
94
|
+
Popups are built on ui-sdk. A `Trigger` or `Close` renders its own `<button>` unless you give it a
|
|
95
|
+
`child` snippet (ui-sdk's `render`, under Narvi's name). To use a Narvi Button, spread the `props` the snippet receives onto it, so it
|
|
96
96
|
gets the ARIA attributes, the handlers and the ref:
|
|
97
97
|
|
|
98
98
|
```svelte
|
|
@@ -154,8 +154,8 @@ Children that render nothing (an `{#if}` that is false) leave no empty body.
|
|
|
154
154
|
|
|
155
155
|
### Forms
|
|
156
156
|
|
|
157
|
-
Wrap a text control (`Input`, `Textarea` or `Select`)
|
|
158
|
-
context, so it gives them a label, help text (`description`) and an error message (`error`), and
|
|
157
|
+
Wrap a text control (`Input`, `Textarea` or `Select`), a `Checkbox` or a `Switch` in `Field`.
|
|
158
|
+
They read Field's context, so it gives them a label, help text (`description`) and an error message (`error`), and
|
|
159
159
|
wires up `id`, `aria-describedby` and `aria-invalid`. Don't hand-write a `<label>` or the ARIA
|
|
160
160
|
wiring for them.
|
|
161
161
|
|
|
@@ -179,11 +179,12 @@ wiring for them.
|
|
|
179
179
|
- For one choice among a few that each need a line of detail, use `ChoiceCards`
|
|
180
180
|
(`options: { value, label, detail?, icon?, disabled? }[]`, `bind:value`, `aria-label`).
|
|
181
181
|
|
|
182
|
-
|
|
182
|
+
`Checkbox` and `Switch` can also take their label as children, without a Field. The other
|
|
183
|
+
controls don't read Field, so label them directly:
|
|
183
184
|
|
|
184
|
-
- `Checkbox` and `Switch`
|
|
185
|
-
|
|
186
|
-
native `onchange` gets the event. `Select`'s and `SegmentedControl`'s `onchange` get the new
|
|
185
|
+
- `Checkbox` and `Switch` with children: `<Switch bind:checked>Night shift</Switch>`. To act on
|
|
186
|
+
a change, `onCheckedChange={(checked) => save(checked)}` gets the new value (then `details`);
|
|
187
|
+
the native `onchange` gets the event. `Select`'s and `SegmentedControl`'s `onchange` get the new
|
|
187
188
|
value, as the person picks it: narrow it to your type there rather than in a `bind:value` setter.
|
|
188
189
|
- `SegmentedControl`, `ToggleGroup.Root` and `Slider` need an `aria-label` (or
|
|
189
190
|
`aria-labelledby`), for example `<SegmentedControl aria-label="Theme" … />`.
|
|
@@ -290,7 +291,8 @@ and `Kbd` inline, `Link` inside text, `Button href` for a link that looks like a
|
|
|
290
291
|
### Feedback
|
|
291
292
|
|
|
292
293
|
- Toasts: mount one `<Toaster />` near the root, then call `toast('Copied the link')` from
|
|
293
|
-
anywhere; `toast.info`, `.success`, `.warning`, `.error` and `.loading` set the tone.
|
|
294
|
+
anywhere; `toast.info`, `.success`, `.warning`, `.error` and `.loading` set the tone. The
|
|
295
|
+
newest is on top; F6 moves focus there (`<Toaster shortcut={null} />` if the app uses F6).
|
|
294
296
|
- A toast can take an `action` (`{ label: 'Undo', onclick(event) }`), which closes it unless
|
|
295
297
|
it calls `event.preventDefault()`.
|
|
296
298
|
- Give work a key of your own with `id`: another toast with that id replaces it where it
|
|
@@ -333,7 +335,7 @@ and `Kbd` inline, `Link` inside text, `Button href` for a link that looks like a
|
|
|
333
335
|
`SplitButton` (`menuTooltip` for its chevron; `onopenchange`): don't wrap one in `Tooltip`
|
|
334
336
|
parts. `justify="start"` starts its contents, for a full-width row, and a margin of `auto`
|
|
335
337
|
sends the last to the end. `variant="link"` sits in a sentence. An open ghost, bare, secondary
|
|
336
|
-
or floating trigger holds an open look by
|
|
338
|
+
or floating trigger holds an open look by the trigger's `aria-expanded`, and `pressed` makes a
|
|
337
339
|
toggle button (`aria-pressed`) in that look: style neither.
|
|
338
340
|
- A main action with a menu of how to do it (Merge, Sign in) is a `SplitButton`; don't join two
|
|
339
341
|
Buttons by hand, or retheme its tokens to restyle a half. Its props are in the
|
|
@@ -348,8 +350,8 @@ and `Kbd` inline, `Link` inside text, `Button href` for a link that looks like a
|
|
|
348
350
|
- `Popover.Content` takes `padding="none"`, `layout="column"` and a `width`;
|
|
349
351
|
`HoverCard.Content` takes `layout="column"` and `padding`; `Tooltip.Content` takes
|
|
350
352
|
`layout="column"` for a title over a line that says more.
|
|
351
|
-
- `Select` takes `optionIcon
|
|
352
|
-
|
|
353
|
+
- `Select` takes `optionIcon`, `prefix` (muted words before the choice: "Text size") and
|
|
354
|
+
`bind:open` (shut with no options). An option's `detail` (`detailMono` for code) is muted at
|
|
353
355
|
the end of its row, off the trigger. Groups get a hairline between them.
|
|
354
356
|
- `EmptyState`'s title is a heading (`level`, 2 by default). `Heading` takes a `weight`.
|
|
355
357
|
|
|
@@ -425,7 +427,7 @@ Parts of a thread that are easy to redraw by hand, and shouldn't be:
|
|
|
425
427
|
- **Composer.ModelPicker** takes `bind:open`, and `multiple` with `value: string[]` to pick
|
|
426
428
|
several, `providers` (a `provider` on each model) for a rail of agents beside the list,
|
|
427
429
|
`searchable` for a field that searches them all, and `bind:starred` (values; keep them where
|
|
428
|
-
they last) for stars, ⌘D included, and a Starred place in the rail. A model's `older` folds it into one row; `bind:also` adds models beside the chosen one with Shift or ⌘. `Composer.Toggle` works outside a `Composer.Root` too.
|
|
430
|
+
they last) for stars, ⌘D included, and a Starred place in the rail; a starred option is named "Ithil 2, Starred". A model's `older` folds it into one row; `bind:also` adds models beside the chosen one with Shift or ⌘. `Composer.Toggle` works outside a `Composer.Root` too.
|
|
429
431
|
- **Composer.Tray** opens its shelf only for a child with height (measured), so an empty wrapper
|
|
430
432
|
opens none; `waiting` overrides. Its `queue` scrolls; read [the tray](references/components.md#the-composers-tray).
|
|
431
433
|
- **A user's message with attachments:** `<Message.Content bubble={false}>` is a column at the
|
|
@@ -469,8 +471,8 @@ Parts of a thread that are easy to redraw by hand, and shouldn't be:
|
|
|
469
471
|
|
|
470
472
|
## Common mistakes
|
|
471
473
|
|
|
472
|
-
- **HIGH:
|
|
473
|
-
|
|
474
|
+
- **HIGH: bits-ui's popup props** (`onCloseAutoFocus`, `onInteractOutside`, `forceMount`…). Use
|
|
475
|
+
`initialFocus`/`finalFocus`, `dismissible`/`onDismissAttempt` and `keepMounted` (`references/components.md`).
|
|
474
476
|
- **HIGH: nesting a Button inside a Trigger without `child`.** `<Dialog.Trigger><Button/></Dialog.Trigger>`
|
|
475
477
|
renders a button inside a button: invalid HTML, with two focus stops. Use the `child` snippet.
|
|
476
478
|
- **HIGH: an icon-only Button without `aria-label`.** `iconOnly` makes it square, but it has
|
|
@@ -484,12 +486,10 @@ Parts of a thread that are easy to redraw by hand, and shouldn't be:
|
|
|
484
486
|
- **MEDIUM: a SettingsRow's `<label for>` on a group.** A `SegmentedControl` or a set of radios
|
|
485
487
|
has no one element for the label to name. Set `labelFor={false}` and pass `labelId` as
|
|
486
488
|
`aria-labelledby`.
|
|
487
|
-
- **MEDIUM: wrapping a
|
|
488
|
-
|
|
489
|
+
- **MEDIUM: wrapping a SegmentedControl in `Field`.** It doesn't read Field's context, so the
|
|
490
|
+
label names nothing. Use `aria-label`, as above.
|
|
489
491
|
- **MEDIUM: a flex `<div>` with margins between children.** Use Stack or Grid. Their gaps follow
|
|
490
492
|
the spacing scale and change by breakpoint without media queries.
|
|
491
|
-
- **MEDIUM: styling inside a `<Theme>` and expecting popups to follow.** They render at the end
|
|
492
|
-
of the body. See the `theming` skill.
|
|
493
493
|
|
|
494
494
|
## Completion
|
|
495
495
|
|
|
@@ -84,7 +84,7 @@ Markdown's table styles: Markdown's tables and this one share their look.
|
|
|
84
84
|
| `ToggleGroup.Root`, `.Item` | Toggles that belong together: one pressed, or any number | `toggle-group` |
|
|
85
85
|
| `SettingsGroup` | A titled group of settings: a heading, an action, the rows on one card | `settings-group` |
|
|
86
86
|
| `SettingsRow` | One setting: what it is, beside its control (`leading`, `dimmed`, `mono`) | `settings-row` |
|
|
87
|
-
| `Tabs` | Views that share one place (`
|
|
87
|
+
| `Tabs` | Views that share one place (`tabs: TabItem[]`, `label`, `bind:value`; `activation="manual"` for a slow panel) | `tabs` |
|
|
88
88
|
| `SearchButton` | Looks like a search field and opens search (`label`, `shortcut`): for a window's bar | `search-button` |
|
|
89
89
|
| `TabStrip` | Tabs for what is open in a pane: closable, addable, scrolling (`tabs`, `bind:value`, `onclose`, `onadd`); `menu`, `onmove`, `onrename`, `onkeep`, `trailing`, `variant`. The panels are yours | `tab-strip` |
|
|
90
90
|
|
|
@@ -99,7 +99,10 @@ for a tab's own buttons, `beside` for the tab shown in a split, and per tab `tab
|
|
|
99
99
|
a menu. A middle click anywhere on a tab calls `onclose` (and neither scrolls nor pastes).
|
|
100
100
|
|
|
101
101
|
A preview tab, which the next one opened replaces, is `temporary: true`: in italics and said as
|
|
102
|
-
"preview". A
|
|
102
|
+
"preview". A tab's name is its label, then "preview" and "working" or "unsaved" (from `mark`),
|
|
103
|
+
joined with commas: `getByRole('tab', { name: 'Fix the parser, preview' })`. `leading` is not
|
|
104
|
+
part of it. The italics are on `[data-slot="tab-strip-label"]` inside the tab, so a test of
|
|
105
|
+
`font-style` on `role=tab` sees `normal`. A double-click on it calls `onkeep(id)` instead of renaming; set its `temporary` to
|
|
103
106
|
false there, and offer "Keep open" in its `menu` for the keyboard. Don't mark tabs with a
|
|
104
107
|
`MutationObserver`, or listen for `dblclick` or `auxclick` around the strip: the strip does it.
|
|
105
108
|
|
|
@@ -148,7 +151,14 @@ short line between the halves (give it a fill of its own with `sx`); `shape="pil
|
|
|
148
151
|
outer ends; `mainSx` and `menuSx` style each half after its own styles; `menuWidth` and
|
|
149
152
|
`menuMinWidth` size the menu, as `Menu.Content`'s `width` and `minWidth` do.
|
|
150
153
|
|
|
151
|
-
## Overlays (
|
|
154
|
+
## Overlays (ui-sdk, in the top layer; use `child` snippets on triggers)
|
|
155
|
+
|
|
156
|
+
Popups open in place, in the browser's top layer, stacked in the order they open. Focus and
|
|
157
|
+
dismissal: `initialFocus` and `finalFocus` on the Content (a selector, an element, a function
|
|
158
|
+
returning one, or `'none'`), `dismissible` and `onDismissAttempt` on the Root, `keepMounted` to keep
|
|
159
|
+
a closed one in the page. Change callbacks get `(value, details)`: `details.reason` says why and
|
|
160
|
+
`details.cancel()` refuses it. A popup's room is `--available-height`, `--available-width` and
|
|
161
|
+
`--anchor-width`.
|
|
152
162
|
|
|
153
163
|
| Component | Use it for | Docs slug |
|
|
154
164
|
| --------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- |
|
|
@@ -160,7 +170,7 @@ outer ends; `mainSx` and `menuSx` style each half after its own styles; `menuWid
|
|
|
160
170
|
| `Menu.Root`, `.Trigger`, `.Content`, `.Item`, `.CheckboxItem`, `.RadioGroup`, `.RadioItem`, `.Group`, `.Label`, `.Separator`, `.Sub` | Actions and choices from a button; items take `description` (text or a snippet) and `trailing` | `menu` |
|
|
161
171
|
| `ContextMenu.Root`, `.Trigger`, `.Content`, filled with `Menu` items | The same, from a right-click | `menu` |
|
|
162
172
|
| `Command.Dialog`, `.Root`, `.Input`, `.List`, `.Group`, `.Item`, `.Empty`, `.Separator`, `.Footer` | A search field over everything the app can do (⌘K); drive it from outside with `Input` `bind:value`, `Root` `shouldFilter={false}` and `bind:value` (the highlighted item), and `Dialog` `onescape`, `restoreFocus`, `sx`; `Input` an `end` snippet; items a snippet `detail`, `wrapDetail`, `badge` and a `hint`; `Empty` a `status` (`loading`, `error`) | `command` |
|
|
163
|
-
| `Tooltip.Provider`, `.Root`, `.Trigger`, `.Content` (`shortcut`, `layout`) | A control's name and its keys.
|
|
173
|
+
| `Tooltip.Provider`, `.Root`, `.Trigger`, `.Content` (`shortcut`, `layout`) | A control's name and its keys. A Provider sets `delay` for those inside it | `tooltip` |
|
|
164
174
|
| `Collapsible.Root`, `.Trigger`, `.Content` | A region the person can fold away | `collapsible` |
|
|
165
175
|
|
|
166
176
|
### Palettes
|
|
@@ -172,7 +182,7 @@ highlighted item is removed, the highlight goes back to the first. `Command.Inpu
|
|
|
172
182
|
snippet after the field; `Command.Item` a `badge` after the label and `wrapDetail` for a path
|
|
173
183
|
whose end matters; `Command.Empty` a `status` of `loading` (a spinner) or `error` (the danger
|
|
174
184
|
colour); `Command.Dialog` an `sx` for its place and width. `Command.Footer` is read out: pass
|
|
175
|
-
`aria-hidden="true"` only for hints alone. Command.Empty is
|
|
185
|
+
`aria-hidden="true"` only for hints alone. Command.Empty is announced (`role="status"`). Escape clears the search before it reaches `onescape`; the highlighted item carries `data-highlighted`. Say loading and
|
|
176
186
|
errors with an `Announcer` too.
|
|
177
187
|
|
|
178
188
|
## Feedback and status
|
|
@@ -207,6 +217,10 @@ sidebar, the page and the panel go inside the sheet. The bar is where macOS's tr
|
|
|
207
217
|
in a desktop window with a hidden title bar: set `windowInset` on the root to the room they take
|
|
208
218
|
(about `5.25rem` since macOS 26, `4.5rem` before, `0px` in full screen and off macOS).
|
|
209
219
|
|
|
220
|
+
A `Rail.Item` is named whole, its `label` and then its badge in words, joined with a comma:
|
|
221
|
+
`getByRole('button', { name: 'Eregion, 2 new' })`, or `', new'` and `', online'` for a dot.
|
|
222
|
+
What it shows inside, such as initials, is not read.
|
|
223
|
+
|
|
210
224
|
```svelte
|
|
211
225
|
<AppShell.Root bind:sidebarOpen windowInset="5.25rem">
|
|
212
226
|
<AppShell.Bar>
|
|
@@ -439,8 +453,9 @@ the request nearest the composer, and what waits behind it in a region that scro
|
|
|
439
453
|
- **`QueuedMessage`**: `compact` is one line, cut with an ellipsis, so give it words, not
|
|
440
454
|
blocks. `handle` is a snippet at its start: put your drag-and-drop library's attachment on
|
|
441
455
|
the Button (Narvi's Button passes `{@attach}` on). `status` and `statusText` are one word;
|
|
442
|
-
what it means goes in `detail`, shown in a tooltip and
|
|
443
|
-
|
|
456
|
+
what it means goes in `detail`, shown in a tooltip and given as the status's description
|
|
457
|
+
(`toHaveAccessibleDescription`), so the status's text is the word alone and an exact
|
|
458
|
+
`getByText('Queued')` finds it. Never join them with a dot. `attachments` sits after the words in the row: keep it to a count.
|
|
444
459
|
|
|
445
460
|
## Utilities
|
|
446
461
|
|
package/skills/markdown/SKILL.md
CHANGED
package/skills/setup/SKILL.md
CHANGED
|
@@ -11,7 +11,7 @@ metadata:
|
|
|
11
11
|
4 when the app uses it.
|
|
12
12
|
type: lifecycle
|
|
13
13
|
library: '@diegopluna/narvi'
|
|
14
|
-
library_version: '0.
|
|
14
|
+
library_version: '0.5.0'
|
|
15
15
|
sources:
|
|
16
16
|
- src/lib/vite.ts
|
|
17
17
|
- src/lib/base.css
|
|
@@ -85,8 +85,8 @@ Narvi is below 1.0, so a minor release can change an API. Pin the version you bu
|
|
|
85
85
|
@import '@diegopluna/narvi/base.css';
|
|
86
86
|
|
|
87
87
|
:root {
|
|
88
|
-
/* Narvi's interface text inherits the page's face. Set it on the root,
|
|
89
|
-
|
|
88
|
+
/* Narvi's interface text inherits the page's face. Set it on the root, so every part
|
|
89
|
+
takes it, menus and dialogs among them. */
|
|
90
90
|
font-family:
|
|
91
91
|
ui-sans-serif,
|
|
92
92
|
system-ui,
|
|
@@ -129,7 +129,7 @@ Narvi lists both naming styles, so neither needs a theme override.
|
|
|
129
129
|
|
|
130
130
|
Narvi's types work with `exactOptionalPropertyTypes`. Every optional prop takes `undefined`, so
|
|
131
131
|
`<Notice detail={maybe}>` and `<Tooltip.Content side={maybe}>` type-check as they are, with no
|
|
132
|
-
need to spread a prop only when it is set. That holds for the parts Narvi takes from
|
|
132
|
+
need to spread a prop only when it is set. That holds for the parts Narvi takes from ui-sdk too.
|
|
133
133
|
|
|
134
134
|
## With Tailwind CSS 4
|
|
135
135
|
|
|
@@ -179,8 +179,6 @@ properties: `p-0` on a Card removes its padding, not a part of it.
|
|
|
179
179
|
a stylesheet. One set from script (`document.documentElement.style.colorScheme = 'dark'`)
|
|
180
180
|
darkens the components and leaves the page light, in production only. Leave the target to the
|
|
181
181
|
plugin, or switch schemes with a rule such as `:root[data-theme='dark'] { color-scheme: dark }`.
|
|
182
|
-
- **MEDIUM: putting the font on a layout `<div>`.** Popups are placed at the end of `<body>`,
|
|
183
|
-
outside that div, and fall back to the system font. Set `font-family` on `:root`.
|
|
184
182
|
- **MEDIUM: `scrollbar-width` or `scrollbar-color` on an element.** In Chromium 121 and later
|
|
185
183
|
(Electron too) either one turns off `::-webkit-scrollbar` for that element, and it shows the
|
|
186
184
|
system's scrollbar instead of Narvi's. Leave both off; `scrollbar-width: none` is fine where a
|
|
@@ -195,8 +193,6 @@ properties: `p-0` on a Card removes its padding, not a part of it.
|
|
|
195
193
|
- `pnpm build`: the built CSS contains Narvi's layer. In a SvelteKit app, run
|
|
196
194
|
`grep -rl "@layer narvi" .svelte-kit/output/client` (in a plain Vite app,
|
|
197
195
|
`grep -rl "@layer narvi" dist`) and confirm it lists a file. If it doesn't, check step 3.
|
|
198
|
-
- pnpm may warn of an unmet peer, `@sveltejs/kit`, wanted by `runed` (a dependency of bits-ui) in
|
|
199
|
-
a SvelteKit 3 app. It can be ignored.
|
|
200
196
|
- With Tailwind, `<Button class="hidden">` disappears.
|
|
201
197
|
|
|
202
198
|
Next: to restyle components or write your own StyleX, load the `styling` skill. For dark mode and
|
package/skills/styling/SKILL.md
CHANGED
|
@@ -12,7 +12,7 @@ metadata:
|
|
|
12
12
|
hover, motion and forced-colour preferences.
|
|
13
13
|
type: core
|
|
14
14
|
library: '@diegopluna/narvi'
|
|
15
|
-
library_version: '0.
|
|
15
|
+
library_version: '0.5.0'
|
|
16
16
|
requires:
|
|
17
17
|
- setup
|
|
18
18
|
sources:
|
|
@@ -111,7 +111,9 @@ package root) breaks them.
|
|
|
111
111
|
`monogram.letter` on the letter, or on a badge inside the mark. The letter is a quarter of
|
|
112
112
|
the mark's shorter side plus 4px (a 16px mark gives 8px, 24px gives 10px) and follows the
|
|
113
113
|
mark when it is resized. Without `monogram.mark` on an ancestor the letter is sized from the
|
|
114
|
-
window, so never use `monogram.letter` alone. `Avatar` already does this.
|
|
114
|
+
window, so never use `monogram.letter` alone. `Avatar` already does this. `monogram.mark` is
|
|
115
|
+
`container-type: size`, so the mark's contents no longer size it: give the mark a width and a
|
|
116
|
+
height of its own, or it collapses to nothing.
|
|
115
117
|
- `visuallyHidden` (from the package root) hides an element from sight and keeps it for
|
|
116
118
|
assistive technology: `stylex.attrs(visuallyHidden)`. Don't write your own.
|
|
117
119
|
- `focusRing` (from the package root) is focus as Narvi's parts show it. `focusRing.ring` goes on
|
package/skills/theming/SKILL.md
CHANGED
|
@@ -12,7 +12,7 @@ metadata:
|
|
|
12
12
|
menus and dialogs, and resolve token colours for drawing code that cannot read CSS variables.
|
|
13
13
|
type: core
|
|
14
14
|
library: '@diegopluna/narvi'
|
|
15
|
-
library_version: '0.
|
|
15
|
+
library_version: '0.5.0'
|
|
16
16
|
requires:
|
|
17
17
|
- setup
|
|
18
18
|
sources:
|
|
@@ -131,7 +131,8 @@ The class is added once the page hydrates. With server rendering or prerendering
|
|
|
131
131
|
paint shows the default accent for a moment. There's no verified way yet to put the class into the
|
|
132
132
|
server-rendered `<html>`. In a client-only app (`ssr = false`, as in Electron), there is no flash.
|
|
133
133
|
|
|
134
|
-
For
|
|
134
|
+
For one section, `<Theme theme={ember}>…</Theme>` is enough: popups opened inside it render in
|
|
135
|
+
place and take it too. It also takes an
|
|
135
136
|
array of themes. The same `createTheme` works for `space`, `radius`, `font` and `motion`;
|
|
136
137
|
overriding `font.display` changes the heading serif.
|
|
137
138
|
|
|
@@ -282,11 +283,6 @@ scheme changes (`matchMedia('(prefers-color-scheme: dark)')`, or your toggle).
|
|
|
282
283
|
|
|
283
284
|
## Common mistakes
|
|
284
285
|
|
|
285
|
-
- **HIGH: popups inside a `<Theme>` lose it.** Menus, popovers, selects, tooltips, dialogs and
|
|
286
|
-
sheets render at the end of `<body>`, outside the Theme's element, so they take the root's
|
|
287
|
-
scheme and tokens. This was checked in Chromium against 0.1.0: a Popover opened inside
|
|
288
|
-
`<Theme theme={…} scheme="dark">` painted the default accent in the `normal` scheme, while text
|
|
289
|
-
in normal flow took the theme. For an app-wide theme or scheme, set it on `<html>` as shown above.
|
|
290
286
|
- **HIGH: hex values in a theme.** A theme value without `light-dark()` loses the other scheme.
|
|
291
287
|
- **MEDIUM: overriding `accent` alone.** Focus rings and soft fills use `focusRing`, `accentSoft`
|
|
292
288
|
and `focusHalo`, so override the whole set or the accent looks patched.
|