@diegopluna/narvi 0.1.0 → 0.2.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 +102 -41
- package/dist/base.css +2 -2
- package/dist/color.d.ts +1 -1
- package/dist/color.js +1 -1
- package/dist/components/activity/ActivityContent.svelte +3 -15
- package/dist/components/activity/ActivityStep.svelte +12 -12
- package/dist/components/activity/ActivityThought.svelte +4 -4
- package/dist/components/activity/ActivityTrigger.svelte +3 -3
- package/dist/components/app-shell/AppShellBar.svelte +89 -0
- package/dist/components/app-shell/AppShellBar.svelte.d.ts +20 -0
- package/dist/components/app-shell/AppShellHeader.svelte +17 -16
- package/dist/components/app-shell/AppShellHeader.svelte.d.ts +2 -2
- package/dist/components/app-shell/AppShellMain.svelte +4 -20
- package/dist/components/app-shell/AppShellPanel.svelte +21 -19
- package/dist/components/app-shell/AppShellPanes.svelte +58 -0
- package/dist/components/app-shell/AppShellPanes.svelte.d.ts +11 -0
- package/dist/components/app-shell/AppShellRail.svelte +85 -0
- package/dist/components/app-shell/AppShellRail.svelte.d.ts +11 -0
- package/dist/components/app-shell/AppShellRoot.svelte +50 -24
- package/dist/components/app-shell/AppShellRoot.svelte.d.ts +8 -6
- package/dist/components/app-shell/AppShellSheet.svelte +95 -0
- package/dist/components/app-shell/AppShellSheet.svelte.d.ts +17 -0
- package/dist/components/app-shell/AppShellSidebar.svelte +37 -61
- package/dist/components/app-shell/AppShellSidebar.svelte.d.ts +1 -5
- package/dist/components/app-shell/AppShellToggle.svelte +62 -23
- package/dist/components/app-shell/AppShellToggle.svelte.d.ts +2 -0
- package/dist/components/app-shell/context.d.ts +6 -0
- package/dist/components/app-shell/index.d.ts +9 -1
- package/dist/components/app-shell/index.js +5 -1
- package/dist/components/approval/Approval.svelte +91 -19
- package/dist/components/approval/Approval.svelte.d.ts +7 -0
- package/dist/components/avatar/AvatarFallback.svelte +1 -2
- package/dist/components/avatar/AvatarRoot.svelte +2 -2
- package/dist/components/badge/Badge.svelte +5 -5
- package/dist/components/button/Button.svelte +219 -40
- package/dist/components/button/Button.svelte.d.ts +38 -2
- package/dist/components/card/Card.svelte +15 -26
- package/dist/components/change-stats/ChangeStats.svelte +1 -2
- package/dist/components/changes-summary/ChangesSummary.svelte +14 -15
- package/dist/components/checkbox/Checkbox.svelte +18 -15
- package/dist/components/checkbox/Checkbox.svelte.d.ts +5 -0
- package/dist/components/code/Code.svelte +1 -2
- package/dist/components/collapsible/CollapsibleTrigger.svelte +2 -2
- package/dist/components/command/CommandItem.svelte +1 -1
- package/dist/components/command/styles.d.ts +3 -2
- package/dist/components/command/styles.js +13 -10
- package/dist/components/composer/ComposerAttachButton.svelte +1 -1
- package/dist/components/composer/ComposerAttachment.svelte +9 -12
- package/dist/components/composer/ComposerModelPicker.svelte +18 -20
- package/dist/components/composer/ComposerRoot.svelte +8 -7
- package/dist/components/composer/ComposerSubmit.svelte +8 -15
- package/dist/components/composer/ComposerTextarea.svelte +1 -1
- package/dist/components/composer/ComposerToggle.svelte +9 -11
- package/dist/components/composer/ComposerTray.svelte +78 -0
- package/dist/components/composer/ComposerTray.svelte.d.ts +15 -0
- package/dist/components/composer/index.d.ts +3 -1
- package/dist/components/composer/index.js +3 -2
- package/dist/components/conversation/ConversationContent.svelte +3 -2
- package/dist/components/conversation/ConversationEmpty.svelte +1 -1
- package/dist/components/conversation/ConversationScrollButton.svelte +3 -3
- package/dist/components/dialog/ConfirmDialog.svelte +1 -1
- package/dist/components/dialog/styles.d.ts +2 -3
- package/dist/components/dialog/styles.js +5 -6
- package/dist/components/divider/Divider.svelte +3 -3
- package/dist/components/empty-state/EmptyState.svelte +4 -5
- package/dist/components/field/Field.svelte +4 -4
- package/dist/components/frame/Frame.svelte +6 -7
- package/dist/components/frame/Frame.svelte.d.ts +1 -1
- package/dist/components/heading/Heading.svelte +2 -2
- package/dist/components/kbd/Kbd.svelte +12 -7
- package/dist/components/link/Link.svelte +7 -3
- package/dist/components/link/Link.svelte.d.ts +4 -1
- package/dist/components/markdown/Markdown.svelte +714 -0
- package/dist/components/markdown/Markdown.svelte.d.ts +80 -0
- package/dist/components/markdown/MarkdownBlock.svelte +231 -0
- package/dist/components/markdown/MarkdownBlock.svelte.d.ts +11 -0
- package/dist/components/markdown/MarkdownBlocks.svelte +115 -0
- package/dist/components/markdown/MarkdownBlocks.svelte.d.ts +15 -0
- package/dist/components/markdown/MarkdownCode.svelte +583 -0
- package/dist/components/markdown/MarkdownCode.svelte.d.ts +23 -0
- package/dist/components/markdown/MarkdownDiagram.svelte +310 -0
- package/dist/components/markdown/MarkdownDiagram.svelte.d.ts +6 -0
- package/dist/components/markdown/MarkdownFile.svelte +134 -0
- package/dist/components/markdown/MarkdownFile.svelte.d.ts +19 -0
- package/dist/components/markdown/MarkdownFootnotes.svelte +61 -0
- package/dist/components/markdown/MarkdownFootnotes.svelte.d.ts +8 -0
- package/dist/components/markdown/MarkdownFresh.svelte +69 -0
- package/dist/components/markdown/MarkdownFresh.svelte.d.ts +6 -0
- package/dist/components/markdown/MarkdownHtml.svelte +72 -0
- package/dist/components/markdown/MarkdownHtml.svelte.d.ts +7 -0
- package/dist/components/markdown/MarkdownImage.svelte +150 -0
- package/dist/components/markdown/MarkdownImage.svelte.d.ts +8 -0
- package/dist/components/markdown/MarkdownInlines.svelte +225 -0
- package/dist/components/markdown/MarkdownInlines.svelte.d.ts +7 -0
- package/dist/components/markdown/MarkdownLink.svelte +120 -0
- package/dist/components/markdown/MarkdownLink.svelte.d.ts +25 -0
- package/dist/components/markdown/MarkdownMath.svelte +138 -0
- package/dist/components/markdown/MarkdownMath.svelte.d.ts +7 -0
- package/dist/components/markdown/MarkdownTable.svelte +265 -0
- package/dist/components/markdown/MarkdownTable.svelte.d.ts +17 -0
- package/dist/components/markdown/caret.d.ts +14 -0
- package/dist/components/markdown/caret.js +67 -0
- package/dist/components/markdown/context.d.ts +93 -0
- package/dist/components/markdown/context.js +128 -0
- package/dist/components/markdown/copy.d.ts +13 -0
- package/dist/components/markdown/copy.js +74 -0
- package/dist/components/markdown/hidden.d.ts +12 -0
- package/dist/components/markdown/hidden.js +31 -0
- package/dist/components/markdown/kept.d.ts +32 -0
- package/dist/components/markdown/kept.js +71 -0
- package/dist/components/markdown/labels.d.ts +46 -0
- package/dist/components/markdown/labels.js +35 -0
- package/dist/components/markdown/save.d.ts +11 -0
- package/dist/components/markdown/save.js +58 -0
- package/dist/components/markdown/scrollable.d.ts +24 -0
- package/dist/components/markdown/scrollable.js +152 -0
- package/dist/components/markdown/static.d.ts +37 -0
- package/dist/components/markdown/static.js +233 -0
- package/dist/components/markdown/styles.d.ts +328 -0
- package/dist/components/markdown/styles.js +302 -0
- package/dist/components/menu/MenuRadioItem.svelte +3 -3
- package/dist/components/menu/index.d.ts +23 -0
- package/dist/components/menu/index.js +3 -1
- package/dist/components/message/MessageAction.svelte +22 -2
- package/dist/components/message/MessageAction.svelte.d.ts +9 -0
- package/dist/components/message/MessageContent.svelte +2 -3
- package/dist/components/message/MessageCopy.svelte +62 -3
- package/dist/components/message/MessageCopy.svelte.d.ts +17 -1
- package/dist/components/message/MessageHeader.svelte +3 -3
- package/dist/components/message/MessagePending.svelte +1 -1
- package/dist/components/message/MessageTime.svelte +1 -1
- package/dist/components/notice/Notice.svelte +14 -10
- package/dist/components/plan/Plan.svelte +22 -17
- package/dist/components/progress/Progress.svelte +31 -33
- package/dist/components/questionnaire/Questionnaire.svelte +19 -22
- package/dist/components/queued-message/QueuedMessage.svelte +14 -7
- package/dist/components/rail/RailItem.svelte +37 -34
- package/dist/components/rail/RailItem.svelte.d.ts +3 -1
- package/dist/components/rail/RailRoot.svelte +18 -4
- package/dist/components/rail/RailRoot.svelte.d.ts +1 -1
- package/dist/components/rail/RailSeparator.svelte +17 -0
- package/dist/components/rail/RailSeparator.svelte.d.ts +18 -0
- package/dist/components/rail/index.d.ts +2 -1
- package/dist/components/rail/index.js +2 -1
- package/dist/components/reasoning/ReasoningContent.svelte +4 -8
- package/dist/components/reasoning/ReasoningTrigger.svelte +2 -2
- package/dist/components/resize-handle/ResizeHandle.svelte +2 -3
- package/dist/components/segmented/SegmentedControl.svelte +7 -8
- package/dist/components/select/Select.svelte +1 -1
- package/dist/components/separator/Separator.svelte +1 -1
- package/dist/components/settings-row/SettingsRow.svelte +5 -5
- package/dist/components/shimmer/Shimmer.svelte +34 -21
- package/dist/components/sidebar/SidebarContent.svelte +1 -1
- package/dist/components/sidebar/SidebarFolder.svelte +142 -0
- package/dist/components/sidebar/SidebarFolder.svelte.d.ts +19 -0
- package/dist/components/sidebar/SidebarFooter.svelte +1 -1
- package/dist/components/sidebar/SidebarGroup.svelte +36 -32
- package/dist/components/sidebar/SidebarGroup.svelte.d.ts +3 -3
- package/dist/components/sidebar/SidebarHeader.svelte +12 -6
- package/dist/components/sidebar/SidebarHeader.svelte.d.ts +4 -1
- package/dist/components/sidebar/SidebarItem.svelte +26 -32
- package/dist/components/sidebar/SidebarRoot.svelte +62 -0
- package/dist/components/sidebar/SidebarRoot.svelte.d.ts +14 -0
- package/dist/components/sidebar/index.d.ts +5 -1
- package/dist/components/sidebar/index.js +3 -1
- package/dist/components/skeleton/Skeleton.svelte +26 -15
- package/dist/components/slider/Slider.svelte +11 -10
- package/dist/components/spinner/Spinner.svelte +4 -11
- package/dist/components/status-indicator/StatusIndicator.svelte +1 -1
- package/dist/components/suggestions/SuggestionsItem.svelte +5 -5
- package/dist/components/switch/Switch.svelte +9 -14
- package/dist/components/tab-strip/TabStrip.svelte +340 -0
- package/dist/components/tab-strip/TabStrip.svelte.d.ts +31 -0
- package/dist/components/tabs/Tabs.svelte +13 -9
- package/dist/components/tabs/Tabs.svelte.d.ts +4 -0
- package/dist/components/text/Text.svelte +31 -23
- package/dist/components/text/Text.svelte.d.ts +8 -4
- package/dist/components/toast/Toaster.svelte +5 -5
- package/dist/components/tool/ToolContent.svelte +3 -8
- package/dist/components/tool/ToolSection.svelte +4 -5
- package/dist/components/tool/ToolTrigger.svelte +10 -9
- package/dist/components/tooltip/TooltipContent.svelte +3 -3
- package/dist/components/work-fold/WorkFold.svelte +5 -9
- package/dist/index.d.ts +16 -8
- package/dist/index.js +17 -10
- package/dist/internal/Code.svelte +3 -4
- package/dist/internal/Glyph.svelte +16 -0
- package/dist/internal/Glyph.svelte.d.ts +6 -0
- package/dist/internal/Tile.svelte +17 -37
- package/dist/internal/control.d.ts +4 -4
- package/dist/internal/control.js +20 -17
- package/dist/internal/layer.d.ts +3 -5
- package/dist/internal/layer.js +10 -12
- package/dist/internal/markers.stylex.d.ts +8 -0
- package/dist/internal/markers.stylex.js +4 -0
- package/dist/internal/plugin-order.d.ts +8 -0
- package/dist/internal/plugin-order.js +16 -0
- package/dist/internal/roving.js +5 -2
- package/dist/internal/shared.d.ts +8 -1
- package/dist/internal/shared.js +21 -5
- package/dist/internal/sx.d.ts +1 -1
- package/dist/internal/toggle.d.ts +1 -2
- package/dist/internal/toggle.js +8 -12
- package/dist/internal/visible.d.ts +32 -0
- package/dist/internal/visible.js +44 -0
- package/dist/markdown/ast.d.ts +209 -0
- package/dist/markdown/ast.js +10 -0
- package/dist/markdown/blocks.d.ts +177 -0
- package/dist/markdown/blocks.js +1489 -0
- package/dist/markdown/code-info.d.ts +10 -0
- package/dist/markdown/code-info.js +16 -0
- package/dist/markdown/common.d.ts +25 -0
- package/dist/markdown/common.js +107 -0
- package/dist/markdown/diagrams.d.ts +2 -0
- package/dist/markdown/diagrams.js +18 -0
- package/dist/markdown/file-paths.d.ts +29 -0
- package/dist/markdown/file-paths.js +80 -0
- package/dist/markdown/files.d.ts +16 -0
- package/dist/markdown/files.js +133 -0
- package/dist/markdown/highlight.d.ts +30 -0
- package/dist/markdown/highlight.js +127 -0
- package/dist/markdown/html.d.ts +23 -0
- package/dist/markdown/html.js +289 -0
- package/dist/markdown/images.d.ts +15 -0
- package/dist/markdown/images.js +45 -0
- package/dist/markdown/index.d.ts +12 -0
- package/dist/markdown/index.js +5 -0
- package/dist/markdown/inlines.d.ts +48 -0
- package/dist/markdown/inlines.js +1714 -0
- package/dist/markdown/math.d.ts +2 -0
- package/dist/markdown/math.js +22 -0
- package/dist/markdown/parse.d.ts +81 -0
- package/dist/markdown/parse.js +204 -0
- package/dist/markdown/plugin.d.ts +178 -0
- package/dist/markdown/plugin.js +160 -0
- package/dist/markdown/sanitize.d.ts +78 -0
- package/dist/markdown/sanitize.js +522 -0
- package/dist/markdown/share.d.ts +12 -0
- package/dist/markdown/share.js +59 -0
- package/dist/markdown/table.d.ts +13 -0
- package/dist/markdown/table.js +60 -0
- package/dist/preset.d.ts +40 -16
- package/dist/preset.js +169 -51
- package/dist/tokens.stylex.d.ts +55 -37
- package/dist/tokens.stylex.js +107 -62
- package/dist/typography.d.ts +48 -0
- package/dist/typography.js +55 -0
- package/dist/vite.d.ts +7 -1
- package/dist/vite.js +27 -2
- package/package.json +53 -6
- package/skills/building-ui/SKILL.md +242 -0
- package/skills/building-ui/references/components.md +207 -0
- package/skills/markdown/SKILL.md +452 -0
- package/skills/markdown/references/plugins.md +103 -0
- package/skills/setup/SKILL.md +191 -0
- package/skills/styling/SKILL.md +269 -0
- package/skills/theming/SKILL.md +184 -0
- package/dist/internal/loop.d.ts +0 -35
- package/dist/internal/loop.js +0 -72
package/dist/tokens.stylex.js
CHANGED
|
@@ -4,65 +4,85 @@ import * as stylex from '@stylexjs/stylex';
|
|
|
4
4
|
* `color-scheme`. Set `color-scheme: light dark` on `:root` to follow the
|
|
5
5
|
* system, or force a scheme on any subtree with the `Theme` component.
|
|
6
6
|
*
|
|
7
|
-
* The palette is
|
|
8
|
-
* and one
|
|
7
|
+
* The palette is a grey with a trace of blue in it, a dark grey by night and white on
|
|
8
|
+
* grey by day, and one blue, the accent, that is used only for state. A preset swaps the
|
|
9
|
+
* grey for a warm one or a pure one, and the blue for another hue or for none.
|
|
10
|
+
*
|
|
11
|
+
* A token is named for its job, family first: `bg…` an opaque background, `fill…` a
|
|
12
|
+
* translucent fill over any background, `border…`, `text…`, `accent…`, `primary…` (the
|
|
13
|
+
* primary button), a status and its `…Soft` and `…Text`, `code…` and `tone…`. `on…` is
|
|
14
|
+
* what is written on a solid. No name says what a colour looks like, so a theme can
|
|
15
|
+
* change every value and no name turns false.
|
|
9
16
|
*/
|
|
10
17
|
export const colors = stylex.defineVars({
|
|
11
|
-
//
|
|
12
|
-
bg: 'light-dark(#
|
|
13
|
-
bgRaised: 'light-dark(#
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
//
|
|
18
|
-
|
|
19
|
-
//
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
//
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
//
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
//
|
|
39
|
-
|
|
40
|
-
//
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
//
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
18
|
+
// Backgrounds are opaque: the page, and what is raised over it (cards, popovers, a sheet)
|
|
19
|
+
bg: 'light-dark(#f3f4f5, #151618)',
|
|
20
|
+
bgRaised: 'light-dark(#fdfdfe, #1e1f21)',
|
|
21
|
+
// The window behind an app shell's sheet: the page's colour, a shade deeper
|
|
22
|
+
bgWindow: 'light-dark(#e1e3e6, #0f1012)',
|
|
23
|
+
// Fills are translucent and go over any background. Each says one thing: the pointer is
|
|
24
|
+
// here, this is chosen, this is a flat block, this is a well.
|
|
25
|
+
fillHover: 'light-dark(rgb(22 24 28 / 0.05), rgb(255 255 255 / 0.07))',
|
|
26
|
+
// What is chosen or open now: the current row, a pressed toggle. A step past a hover,
|
|
27
|
+
// so the open row still reads as open while the pointer is on another.
|
|
28
|
+
fillSelected: 'light-dark(rgb(22 24 28 / 0.075), rgb(255 255 255 / 0.1))',
|
|
29
|
+
// A flat block: a skeleton, a blank region of a diagram, the person's own message
|
|
30
|
+
fillMuted: 'light-dark(rgb(22 24 28 / 0.05), rgb(255 255 255 / 0.07))',
|
|
31
|
+
// A well: code, a track, a tray
|
|
32
|
+
fillSunken: 'light-dark(rgb(22 24 28 / 0.04), rgb(0 0 0 / 0.26))',
|
|
33
|
+
// Borders. `border` divides and outlines quietly; `borderStrong` outlines a button or a
|
|
34
|
+
// dialog. `borderControl` is the boundary of an input and holds 3:1 against its surface,
|
|
35
|
+
// down to the hardest one it can stand on: a hovered row of the page.
|
|
36
|
+
border: 'light-dark(rgb(22 24 28 / 0.1), rgb(255 255 255 / 0.09))',
|
|
37
|
+
borderStrong: 'light-dark(rgb(22 24 28 / 0.2), rgb(255 255 255 / 0.16))',
|
|
38
|
+
borderControl: 'light-dark(#818489, #76797e)',
|
|
39
|
+
borderControlHover: 'light-dark(#727579, #86898d)',
|
|
40
|
+
// The one shadow: the drop under what floats over the page (a menu, a dialog, a drawer).
|
|
41
|
+
// Nothing that rests on the page casts one.
|
|
42
|
+
shadow: 'light-dark(rgb(22 24 28 / 0.16), rgb(0 0 0 / 0.5))',
|
|
43
|
+
// What dims the page behind a dialog or a drawer
|
|
44
|
+
scrim: 'light-dark(rgb(22 24 28 / 0.32), rgb(0 0 0 / 0.56))',
|
|
45
|
+
// The thumb of a switch or a slider
|
|
46
|
+
thumb: 'light-dark(#ffffff, #ffffff)',
|
|
47
|
+
// Text. The two quieter ones hold 4.5:1 where reading is hardest: on the open row of
|
|
48
|
+
// the page, and on the window itself.
|
|
49
|
+
text: 'light-dark(#16181c, #eaedf2)',
|
|
50
|
+
textMuted: 'light-dark(#5e6065, #adb0b5)',
|
|
51
|
+
textSubtle: 'light-dark(#616468, #9da0a5)',
|
|
52
|
+
// The accent: focus, selection, progress, something live. Nothing else. One definite
|
|
53
|
+
// hue: a solid that white text stands on by day, a bright one that dark text stands on
|
|
54
|
+
// by night. Both hold 4.5:1 on a hovered row of the page.
|
|
55
|
+
accent: 'light-dark(#0164cf, #72acfe)',
|
|
56
|
+
accentVivid: 'light-dark(#1b76e7, #4694ff)',
|
|
57
|
+
onAccent: 'light-dark(#ffffff, #0a1018)',
|
|
58
|
+
accentSoft: 'light-dark(rgb(1 100 207 / 0.1), rgb(114 172 254 / 0.14))',
|
|
59
|
+
focusRing: 'light-dark(#0164cf, #72acfe)',
|
|
60
|
+
focusHalo: 'light-dark(rgb(1 100 207 / 0.2), rgb(114 172 254 / 0.26))',
|
|
61
|
+
// The primary button: the one solid, flat, in the text's own colour
|
|
62
|
+
primary: 'light-dark(#1c1e21, #eceff4)',
|
|
63
|
+
onPrimary: 'light-dark(#fafafa, #0b0d11)',
|
|
64
|
+
// Status: definite colours, each holding 4.5:1 as small text on a hovered row of the
|
|
65
|
+
// page, on every stone a preset offers
|
|
66
|
+
success: 'light-dark(#007835, #37d16c)',
|
|
67
|
+
warning: 'light-dark(#8b6001, #f5af20)',
|
|
68
|
+
danger: 'light-dark(#c92228, #ff7a70)',
|
|
50
69
|
// Behind a status: a wash of its colour, stronger at night so it still reads
|
|
51
|
-
successSoft: 'light-dark(rgb(
|
|
52
|
-
warningSoft: 'light-dark(rgb(
|
|
53
|
-
dangerSoft: 'light-dark(rgb(
|
|
70
|
+
successSoft: 'light-dark(rgb(0 120 53 / 0.12), rgb(55 209 108 / 0.16))',
|
|
71
|
+
warningSoft: 'light-dark(rgb(139 96 1 / 0.12), rgb(245 175 32 / 0.16))',
|
|
72
|
+
dangerSoft: 'light-dark(rgb(201 34 40 / 0.12), rgb(255 122 112 / 0.16))',
|
|
54
73
|
// Small text in a status colour: mixed toward the text colour, so a 12px label
|
|
55
74
|
// on its soft wash still holds 4.5:1
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
// Code
|
|
60
|
-
//
|
|
75
|
+
successText: 'light-dark(#195c2e, #a0dcac)',
|
|
76
|
+
warningText: 'light-dark(#674600, #f2ca8d)',
|
|
77
|
+
dangerText: 'light-dark(#7a342f, #ffb9b1)',
|
|
78
|
+
// Code: keys in slate blue, strings in green, numbers in copper, literals in magenta, and
|
|
79
|
+
// punctuation in a grey that stands back. Each holds 4.5:1 on `fillSunken` in both
|
|
80
|
+
// schemes, punctuation too: a brace is text.
|
|
61
81
|
codeKey: 'light-dark(#4a5794, #aebcf0)',
|
|
62
82
|
codeString: 'light-dark(#3b6e4c, #9fd2ac)',
|
|
63
83
|
codeNumber: 'light-dark(#985616, #ecb47c)',
|
|
64
84
|
codeLiteral: 'light-dark(#87397a, #e2a6d3)',
|
|
65
|
-
codePunct: 'light-dark(#
|
|
85
|
+
codePunct: 'light-dark(#626872, #929baa)'
|
|
66
86
|
});
|
|
67
87
|
/**
|
|
68
88
|
* 4px spacing scale, in rem. Narvi is sized in rem throughout, so an app that
|
|
@@ -81,15 +101,23 @@ export const space = stylex.defineVars({
|
|
|
81
101
|
x12: '3rem',
|
|
82
102
|
x16: '4rem'
|
|
83
103
|
});
|
|
84
|
-
/**
|
|
104
|
+
/**
|
|
105
|
+
* Radii, named for what takes them, so two things of one kind agree without a number.
|
|
106
|
+
* A frame is always its inner radius plus its padding: `frame` = `card` + 5px (0.3125rem).
|
|
107
|
+
*/
|
|
85
108
|
export const radius = stylex.defineVars({
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
109
|
+
// A key cap, a checkbox, inline code, a small mark
|
|
110
|
+
chip: '0.3125rem',
|
|
111
|
+
// A small control, a segment, a thumbnail
|
|
112
|
+
item: '0.375rem',
|
|
113
|
+
// A control and a row: a button, a field, a menu item, a block of code
|
|
114
|
+
control: '0.5rem',
|
|
115
|
+
// A large control and a panel: a notice, a sheet, a rail item
|
|
116
|
+
panel: '0.625rem',
|
|
117
|
+
// What holds other things: a card, a popover, the composer
|
|
118
|
+
card: '0.75rem',
|
|
91
119
|
frame: '1.0625rem',
|
|
92
|
-
|
|
120
|
+
pill: '9999px'
|
|
93
121
|
});
|
|
94
122
|
export const font = stylex.defineVars({
|
|
95
123
|
// Interface text takes the font of the page it is placed on.
|
|
@@ -99,11 +127,19 @@ export const font = stylex.defineVars({
|
|
|
99
127
|
// build, so either package works without a theme override.
|
|
100
128
|
display: '"Cormorant Garamond", "Cormorant Garamond Variable", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif',
|
|
101
129
|
mono: '"Geist Mono", "Geist Mono Variable", ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace',
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
130
|
+
// Sizes, named for what they set. `typography` binds each to a weight and a line height.
|
|
131
|
+
// A counter or a count inside tight chrome
|
|
132
|
+
sizeMicro: '0.6875rem',
|
|
133
|
+
// A caption, a key hint, a small label over a part
|
|
134
|
+
sizeCaption: '0.75rem',
|
|
135
|
+
// A dense row and a small control
|
|
136
|
+
sizeMeta: '0.8125rem',
|
|
137
|
+
// A label and running interface copy
|
|
138
|
+
sizeBody: '0.875rem',
|
|
139
|
+
// What is read or typed at length: a reply, the prompt
|
|
140
|
+
sizeReading: '1rem',
|
|
141
|
+
// A title in the text's own face: a dialog's, a section's
|
|
142
|
+
sizeTitle: '1.0625rem',
|
|
107
143
|
weightRegular: '400',
|
|
108
144
|
weightMedium: '500',
|
|
109
145
|
weightSemibold: '600',
|
|
@@ -125,6 +161,15 @@ export const motion = stylex.defineVars({
|
|
|
125
161
|
// For something that travels across the screen, such as a sliding thumb
|
|
126
162
|
easeInOut: 'cubic-bezier(0.77, 0, 0.175, 1)'
|
|
127
163
|
});
|
|
164
|
+
/**
|
|
165
|
+
* For an animation that never ends. Set `animationPlayState: play.whileVisible` on it and
|
|
166
|
+
* attach `whileVisible` to its element: it then runs only while it can be seen. Without the
|
|
167
|
+
* attachment it runs as any animation does. A constant, not a variable, so it is read on the
|
|
168
|
+
* element it is used on.
|
|
169
|
+
*/
|
|
170
|
+
export const play = stylex.defineConsts({
|
|
171
|
+
whileVisible: 'var(--narvi-play, running)'
|
|
172
|
+
});
|
|
128
173
|
/**
|
|
129
174
|
* Motion for pages, not interfaces. An interface is used again and again, so nothing in it
|
|
130
175
|
* takes longer than `motion.slow`. A page is read once, as it is scrolled, and its motion is
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The type roles: what a piece of text is, not how big it is. Each role is one size, one
|
|
3
|
+
* weight and one line height, so two labels cannot drift apart. Colour is separate: pick a
|
|
4
|
+
* tone (`colors.text`, `textMuted`, `textSubtle`).
|
|
5
|
+
*
|
|
6
|
+
* `Text` renders them with its `variant`. Use these on an element of your own:
|
|
7
|
+
*
|
|
8
|
+
* <span {...stylex.attrs(typography.caption, styles.count)}>
|
|
9
|
+
*/
|
|
10
|
+
import * as stylex from '@stylexjs/stylex';
|
|
11
|
+
export declare const typography: Readonly<{
|
|
12
|
+
readonly title: Readonly<{
|
|
13
|
+
readonly fontSize: stylex.StyleXClassNameFor<"fontSize", string>;
|
|
14
|
+
readonly fontWeight: stylex.StyleXClassNameFor<"fontWeight", string>;
|
|
15
|
+
readonly lineHeight: stylex.StyleXClassNameFor<"lineHeight", 1.3>;
|
|
16
|
+
}>;
|
|
17
|
+
readonly reading: Readonly<{
|
|
18
|
+
readonly fontSize: stylex.StyleXClassNameFor<"fontSize", string>;
|
|
19
|
+
readonly fontWeight: stylex.StyleXClassNameFor<"fontWeight", string>;
|
|
20
|
+
readonly lineHeight: stylex.StyleXClassNameFor<"lineHeight", string>;
|
|
21
|
+
}>;
|
|
22
|
+
readonly label: Readonly<{
|
|
23
|
+
readonly fontSize: stylex.StyleXClassNameFor<"fontSize", string>;
|
|
24
|
+
readonly fontWeight: stylex.StyleXClassNameFor<"fontWeight", string>;
|
|
25
|
+
readonly lineHeight: stylex.StyleXClassNameFor<"lineHeight", string>;
|
|
26
|
+
}>;
|
|
27
|
+
readonly body: Readonly<{
|
|
28
|
+
readonly fontSize: stylex.StyleXClassNameFor<"fontSize", string>;
|
|
29
|
+
readonly fontWeight: stylex.StyleXClassNameFor<"fontWeight", string>;
|
|
30
|
+
readonly lineHeight: stylex.StyleXClassNameFor<"lineHeight", string>;
|
|
31
|
+
}>;
|
|
32
|
+
readonly meta: Readonly<{
|
|
33
|
+
readonly fontSize: stylex.StyleXClassNameFor<"fontSize", string>;
|
|
34
|
+
readonly fontWeight: stylex.StyleXClassNameFor<"fontWeight", string>;
|
|
35
|
+
readonly lineHeight: stylex.StyleXClassNameFor<"lineHeight", 1.5>;
|
|
36
|
+
}>;
|
|
37
|
+
readonly caption: Readonly<{
|
|
38
|
+
readonly fontSize: stylex.StyleXClassNameFor<"fontSize", string>;
|
|
39
|
+
readonly fontWeight: stylex.StyleXClassNameFor<"fontWeight", string>;
|
|
40
|
+
readonly lineHeight: stylex.StyleXClassNameFor<"lineHeight", 1.45>;
|
|
41
|
+
}>;
|
|
42
|
+
readonly micro: Readonly<{
|
|
43
|
+
readonly fontSize: stylex.StyleXClassNameFor<"fontSize", string>;
|
|
44
|
+
readonly fontWeight: stylex.StyleXClassNameFor<"fontWeight", string>;
|
|
45
|
+
readonly lineHeight: stylex.StyleXClassNameFor<"lineHeight", 1.3>;
|
|
46
|
+
}>;
|
|
47
|
+
}>;
|
|
48
|
+
export type TypeRole = keyof typeof typography;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The type roles: what a piece of text is, not how big it is. Each role is one size, one
|
|
3
|
+
* weight and one line height, so two labels cannot drift apart. Colour is separate: pick a
|
|
4
|
+
* tone (`colors.text`, `textMuted`, `textSubtle`).
|
|
5
|
+
*
|
|
6
|
+
* `Text` renders them with its `variant`. Use these on an element of your own:
|
|
7
|
+
*
|
|
8
|
+
* <span {...stylex.attrs(typography.caption, styles.count)}>
|
|
9
|
+
*/
|
|
10
|
+
import * as stylex from '@stylexjs/stylex';
|
|
11
|
+
import { font } from './tokens.stylex.js';
|
|
12
|
+
export const typography = stylex.create({
|
|
13
|
+
// A title in the text's own face: a dialog's, a section's
|
|
14
|
+
title: {
|
|
15
|
+
fontSize: font.sizeTitle,
|
|
16
|
+
fontWeight: font.weightSemibold,
|
|
17
|
+
lineHeight: 1.3
|
|
18
|
+
},
|
|
19
|
+
// What is read or typed at length: a reply, the prompt
|
|
20
|
+
reading: {
|
|
21
|
+
fontSize: font.sizeReading,
|
|
22
|
+
fontWeight: font.weightRegular,
|
|
23
|
+
lineHeight: font.leadingNormal
|
|
24
|
+
},
|
|
25
|
+
// What names a thing: a row's title, a button, a menu item, a field's label
|
|
26
|
+
label: {
|
|
27
|
+
fontSize: font.sizeBody,
|
|
28
|
+
fontWeight: font.weightMedium,
|
|
29
|
+
lineHeight: font.leadingSnug
|
|
30
|
+
},
|
|
31
|
+
// Running interface copy: a description, a paragraph in a dialog
|
|
32
|
+
body: {
|
|
33
|
+
fontSize: font.sizeBody,
|
|
34
|
+
fontWeight: font.weightRegular,
|
|
35
|
+
lineHeight: font.leadingNormal
|
|
36
|
+
},
|
|
37
|
+
// A dense row and what sits beside a label: a time, a path, a count
|
|
38
|
+
meta: {
|
|
39
|
+
fontSize: font.sizeMeta,
|
|
40
|
+
fontWeight: font.weightRegular,
|
|
41
|
+
lineHeight: 1.5
|
|
42
|
+
},
|
|
43
|
+
// A caption, a hint under a field, a small label over a part
|
|
44
|
+
caption: {
|
|
45
|
+
fontSize: font.sizeCaption,
|
|
46
|
+
fontWeight: font.weightRegular,
|
|
47
|
+
lineHeight: 1.45
|
|
48
|
+
},
|
|
49
|
+
// A counter or a status inside tight chrome
|
|
50
|
+
micro: {
|
|
51
|
+
fontSize: font.sizeMicro,
|
|
52
|
+
fontWeight: font.weightMedium,
|
|
53
|
+
lineHeight: 1.3
|
|
54
|
+
}
|
|
55
|
+
});
|
package/dist/vite.d.ts
CHANGED
|
@@ -21,6 +21,11 @@ export type NarviOptions = StylexOptions & {
|
|
|
21
21
|
*/
|
|
22
22
|
tailwind?: boolean;
|
|
23
23
|
};
|
|
24
|
+
/**
|
|
25
|
+
* The oldest browsers with `light-dark()`, which Narvi's colours are written in. The plugin
|
|
26
|
+
* makes them the build's CSS target unless the app sets `build.cssTarget` itself.
|
|
27
|
+
*/
|
|
28
|
+
export declare const CSS_TARGET: string[];
|
|
24
29
|
/** The cascade layer that holds all of Narvi's styles, and any StyleX of your own. */
|
|
25
30
|
export declare const NARVI_LAYER = "narvi";
|
|
26
31
|
/** The layer inside it that holds `@diegopluna/narvi/base.css`, below every component. */
|
|
@@ -32,7 +37,8 @@ export declare const BASE_LAYER = "narvi.base";
|
|
|
32
37
|
* - runs after the Svelte compiler, so `.svelte` files are handled
|
|
33
38
|
* - emits one cascade layer, `narvi`, so your own unlayered CSS always wins over
|
|
34
39
|
* Narvi's, and a layered framework can be ordered around it
|
|
35
|
-
* - leaves `light-dark()` and `:dir()` alone, which the tokens and components rely on
|
|
40
|
+
* - leaves `light-dark()` and `:dir()` alone, which the tokens and components rely on, and
|
|
41
|
+
* targets browsers that have `light-dark()`, so Vite leaves it alone in your stylesheet too
|
|
36
42
|
*
|
|
37
43
|
* Add it after `sveltekit()` (or `svelte()`) in `vite.config.ts`.
|
|
38
44
|
*/
|
package/dist/vite.js
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import stylex from '@stylexjs/unplugin';
|
|
2
2
|
import { Features } from 'lightningcss';
|
|
3
|
+
import { assertAfterSvelte } from './internal/plugin-order.js';
|
|
3
4
|
const PACKAGE = '@diegopluna/narvi';
|
|
5
|
+
/**
|
|
6
|
+
* The oldest browsers with `light-dark()`, which Narvi's colours are written in. The plugin
|
|
7
|
+
* makes them the build's CSS target unless the app sets `build.cssTarget` itself.
|
|
8
|
+
*/
|
|
9
|
+
export const CSS_TARGET = ['chrome123', 'edge123', 'firefox120', 'safari17.5'];
|
|
4
10
|
/** The cascade layer that holds all of Narvi's styles, and any StyleX of your own. */
|
|
5
11
|
export const NARVI_LAYER = 'narvi';
|
|
6
12
|
/** The layer inside it that holds `@diegopluna/narvi/base.css`, below every component. */
|
|
@@ -12,7 +18,8 @@ export const BASE_LAYER = `${NARVI_LAYER}.base`;
|
|
|
12
18
|
* - runs after the Svelte compiler, so `.svelte` files are handled
|
|
13
19
|
* - emits one cascade layer, `narvi`, so your own unlayered CSS always wins over
|
|
14
20
|
* Narvi's, and a layered framework can be ordered around it
|
|
15
|
-
* - leaves `light-dark()` and `:dir()` alone, which the tokens and components rely on
|
|
21
|
+
* - leaves `light-dark()` and `:dir()` alone, which the tokens and components rely on, and
|
|
22
|
+
* targets browsers that have `light-dark()`, so Vite leaves it alone in your stylesheet too
|
|
16
23
|
*
|
|
17
24
|
* Add it after `sveltekit()` (or `svelte()`) in `vite.config.ts`.
|
|
18
25
|
*/
|
|
@@ -46,8 +53,25 @@ export function narvi({ tailwind = false, ...options } = {}) {
|
|
|
46
53
|
}
|
|
47
54
|
});
|
|
48
55
|
const configureServer = plugin.configureServer;
|
|
49
|
-
|
|
56
|
+
const config = plugin.config;
|
|
57
|
+
const configResolved = plugin.configResolved;
|
|
58
|
+
const self = {
|
|
50
59
|
...plugin,
|
|
60
|
+
// Vite lowers the CSS it bundles for its default targets, which are older than
|
|
61
|
+
// `light-dark()`. That rewrites `base.css` into custom properties that follow only a
|
|
62
|
+
// `color-scheme` written in a stylesheet: one set from script would darken the
|
|
63
|
+
// components and leave the page light. An app that sets its own target keeps it.
|
|
64
|
+
config(user, env) {
|
|
65
|
+
const result = config?.call(this, user, env) ?? {};
|
|
66
|
+
if (user.build?.cssTarget !== undefined)
|
|
67
|
+
return result;
|
|
68
|
+
return { ...result, build: { ...result.build, cssTarget: CSS_TARGET } };
|
|
69
|
+
},
|
|
70
|
+
// A wrong order is the one mistake that stops the build, so it is named here
|
|
71
|
+
configResolved(config) {
|
|
72
|
+
assertAfterSvelte(config.plugins, self);
|
|
73
|
+
return configResolved?.call(this, config);
|
|
74
|
+
},
|
|
51
75
|
// The StyleX plugin defaults to `enforce: 'pre'`, which would hand it raw
|
|
52
76
|
// `.svelte` source. Dropping `enforce` lets the Svelte compiler go first.
|
|
53
77
|
enforce: undefined,
|
|
@@ -76,5 +100,6 @@ export function narvi({ tailwind = false, ...options } = {}) {
|
|
|
76
100
|
timer.unref?.();
|
|
77
101
|
}
|
|
78
102
|
};
|
|
103
|
+
return self;
|
|
79
104
|
}
|
|
80
105
|
export default narvi;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@diegopluna/narvi",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"packageManager": "pnpm@12.18.0",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -11,12 +11,18 @@
|
|
|
11
11
|
"components",
|
|
12
12
|
"design-system",
|
|
13
13
|
"ui",
|
|
14
|
-
"stylex"
|
|
14
|
+
"stylex",
|
|
15
|
+
"tanstack-intent"
|
|
15
16
|
],
|
|
16
17
|
"files": [
|
|
17
18
|
"dist",
|
|
18
19
|
"!dist/**/*.test.*",
|
|
19
|
-
"!dist/**/*.spec.*"
|
|
20
|
+
"!dist/**/*.spec.*",
|
|
21
|
+
"skills/setup",
|
|
22
|
+
"skills/styling",
|
|
23
|
+
"skills/theming",
|
|
24
|
+
"skills/building-ui",
|
|
25
|
+
"skills/markdown"
|
|
20
26
|
],
|
|
21
27
|
"type": "module",
|
|
22
28
|
"sideEffects": [
|
|
@@ -43,6 +49,34 @@
|
|
|
43
49
|
"types": "./dist/media.stylex.d.ts",
|
|
44
50
|
"default": "./dist/media.stylex.js"
|
|
45
51
|
},
|
|
52
|
+
"./markdown": {
|
|
53
|
+
"types": "./dist/markdown/index.d.ts",
|
|
54
|
+
"default": "./dist/markdown/index.js"
|
|
55
|
+
},
|
|
56
|
+
"./markdown/highlight": {
|
|
57
|
+
"types": "./dist/markdown/highlight.d.ts",
|
|
58
|
+
"default": "./dist/markdown/highlight.js"
|
|
59
|
+
},
|
|
60
|
+
"./markdown/math": {
|
|
61
|
+
"types": "./dist/markdown/math.d.ts",
|
|
62
|
+
"svelte": "./dist/markdown/math.js",
|
|
63
|
+
"default": "./dist/markdown/math.js"
|
|
64
|
+
},
|
|
65
|
+
"./markdown/diagrams": {
|
|
66
|
+
"types": "./dist/markdown/diagrams.d.ts",
|
|
67
|
+
"svelte": "./dist/markdown/diagrams.js",
|
|
68
|
+
"default": "./dist/markdown/diagrams.js"
|
|
69
|
+
},
|
|
70
|
+
"./markdown/files": {
|
|
71
|
+
"types": "./dist/markdown/files.d.ts",
|
|
72
|
+
"svelte": "./dist/markdown/files.js",
|
|
73
|
+
"default": "./dist/markdown/files.js"
|
|
74
|
+
},
|
|
75
|
+
"./markdown/images": {
|
|
76
|
+
"types": "./dist/markdown/images.d.ts",
|
|
77
|
+
"svelte": "./dist/markdown/images.js",
|
|
78
|
+
"default": "./dist/markdown/images.js"
|
|
79
|
+
},
|
|
46
80
|
"./base.css": "./dist/base.css",
|
|
47
81
|
"./vite": {
|
|
48
82
|
"types": "./dist/vite.d.ts",
|
|
@@ -57,7 +91,7 @@
|
|
|
57
91
|
"scripts": {
|
|
58
92
|
"dev": "vite dev",
|
|
59
93
|
"build": "pnpm run build:lib && pnpm run build:docs",
|
|
60
|
-
"build:lib": "node scripts/base-css.js && svelte-kit sync && svelte-package && publint",
|
|
94
|
+
"build:lib": "node scripts/base-css.js && svelte-kit sync && svelte-package && node scripts/check-types.js && publint",
|
|
61
95
|
"build:docs": "vite build",
|
|
62
96
|
"preview": "vite preview",
|
|
63
97
|
"prepare": "svelte-kit sync || echo ''",
|
|
@@ -68,6 +102,7 @@
|
|
|
68
102
|
"format": "prettier --write .",
|
|
69
103
|
"test:unit": "vitest",
|
|
70
104
|
"test": "npm run test:unit -- --run",
|
|
105
|
+
"test:browsers": "NARVI_BROWSERS=firefox,webkit vitest --run --project client src/tests/markdown",
|
|
71
106
|
"deploy": "pnpm build:docs && wrangler deploy"
|
|
72
107
|
},
|
|
73
108
|
"devDependencies": {
|
|
@@ -98,8 +133,10 @@
|
|
|
98
133
|
"@sveltejs/kit": "^3.0.0",
|
|
99
134
|
"@sveltejs/package": "^2.5.8",
|
|
100
135
|
"@sveltejs/vite-plugin-svelte": "^7.2.0",
|
|
136
|
+
"@tanstack/intent": "0.5.6",
|
|
101
137
|
"@types/node": "^24",
|
|
102
138
|
"@vitest/browser-playwright": "^4.1.8",
|
|
139
|
+
"axe-core": "^4.14.0",
|
|
103
140
|
"eslint": "^10.4.1",
|
|
104
141
|
"eslint-config-prettier": "^10.1.8",
|
|
105
142
|
"eslint-plugin-svelte": "^3.19.0",
|
|
@@ -123,11 +160,21 @@
|
|
|
123
160
|
"vite": ">=6"
|
|
124
161
|
},
|
|
125
162
|
"dependencies": {
|
|
163
|
+
"@pierre/highlights": "0.5.0",
|
|
126
164
|
"@stylexjs/stylex": "0.19.1",
|
|
127
165
|
"@stylexjs/unplugin": "0.19.1",
|
|
128
166
|
"bits-ui": "^2.20.6",
|
|
167
|
+
"decode-named-character-reference": "1.3.0",
|
|
168
|
+
"dompurify": "3.4.17",
|
|
129
169
|
"esm-env": "^1.2.2",
|
|
130
|
-
"
|
|
170
|
+
"katex": "0.19.1",
|
|
171
|
+
"lightningcss": "^1.33.0",
|
|
172
|
+
"pele": "1.13.0"
|
|
131
173
|
},
|
|
132
|
-
"description": "A Svelte 5 component library styled with StyleX."
|
|
174
|
+
"description": "A Svelte 5 component library styled with StyleX.",
|
|
175
|
+
"intent": {
|
|
176
|
+
"version": 1,
|
|
177
|
+
"repo": "diegopluna/narvi",
|
|
178
|
+
"docs": "https://narvi.dpeter.dev"
|
|
179
|
+
}
|
|
133
180
|
}
|