@diegopluna/narvi 0.3.13 → 0.4.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/dist/components/app-shell/AppShellHeader.svelte +15 -2
- package/dist/components/app-shell/AppShellStrip.svelte +41 -0
- package/dist/components/app-shell/AppShellStrip.svelte.d.ts +10 -0
- package/dist/components/app-shell/index.d.ts +3 -1
- package/dist/components/app-shell/index.js +2 -1
- package/dist/components/approval/Approval.svelte +147 -13
- package/dist/components/approval/Approval.svelte.d.ts +22 -0
- package/dist/components/avatar/AvatarFallback.svelte +2 -1
- package/dist/components/avatar/AvatarRoot.svelte +9 -6
- package/dist/components/composer/ComposerTray.svelte +150 -10
- package/dist/components/composer/ComposerTray.svelte.d.ts +15 -3
- package/dist/components/heading/Heading.svelte +2 -1
- package/dist/components/markdown/MarkdownHtml.svelte +7 -3
- package/dist/components/markdown/MarkdownTable.svelte +19 -5
- package/dist/components/markdown/styles.d.ts +0 -17
- package/dist/components/markdown/styles.js +4 -20
- package/dist/components/plan/Plan.svelte +146 -28
- package/dist/components/plan/Plan.svelte.d.ts +17 -2
- package/dist/components/queued-message/QueuedMessage.svelte +178 -49
- package/dist/components/queued-message/QueuedMessage.svelte.d.ts +25 -4
- package/dist/components/tab-strip/TabStrip.svelte +120 -12
- package/dist/components/tab-strip/TabStrip.svelte.d.ts +17 -0
- package/dist/components/table/TableBody.svelte +27 -0
- package/dist/components/table/TableBody.svelte.d.ts +10 -0
- package/dist/components/table/TableCell.svelte +54 -0
- package/dist/components/table/TableCell.svelte.d.ts +17 -0
- package/dist/components/table/TableFoot.svelte +39 -0
- package/dist/components/table/TableFoot.svelte.d.ts +10 -0
- package/dist/components/table/TableHead.svelte +33 -0
- package/dist/components/table/TableHead.svelte.d.ts +10 -0
- package/dist/components/table/TableHeaderCell.svelte +61 -0
- package/dist/components/table/TableHeaderCell.svelte.d.ts +17 -0
- package/dist/components/table/TableRoot.svelte +144 -0
- package/dist/components/table/TableRoot.svelte.d.ts +22 -0
- package/dist/components/table/TableRow.svelte +59 -0
- package/dist/components/table/TableRow.svelte.d.ts +12 -0
- package/dist/components/table/context.d.ts +14 -0
- package/dist/components/table/context.js +15 -0
- package/dist/components/table/index.d.ts +16 -0
- package/dist/components/table/index.js +8 -0
- package/dist/components/table/styles.d.ts +56 -0
- package/dist/components/table/styles.js +44 -0
- package/dist/components/text/Text.svelte +19 -4
- package/dist/components/text/Text.svelte.d.ts +4 -2
- package/dist/components/work-fold/WorkFold.svelte +26 -1
- package/dist/components/work-fold/WorkFold.svelte.d.ts +5 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.js +7 -1
- package/dist/internal/markers.stylex.d.ts +4 -0
- package/dist/internal/markers.stylex.js +2 -0
- package/dist/internal/table.d.ts +29 -0
- package/dist/internal/table.js +34 -0
- package/dist/tokens.stylex.d.ts +2 -0
- package/dist/tokens.stylex.js +9 -3
- package/dist/typography.d.ts +40 -1
- package/dist/typography.js +42 -2
- package/package.json +1 -1
- package/skills/building-ui/SKILL.md +22 -22
- package/skills/building-ui/references/components.md +196 -42
- package/skills/markdown/SKILL.md +1 -1
- package/skills/setup/SKILL.md +1 -1
- package/skills/styling/SKILL.md +21 -5
- package/skills/theming/SKILL.md +1 -1
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The cells of a Table, over the look it shares with Markdown's (`internal/table.ts`): their
|
|
3
|
+
* room, from the spacing scale, how they line up, and the column of row numbers.
|
|
4
|
+
*/
|
|
5
|
+
import * as stylex from '@stylexjs/stylex';
|
|
6
|
+
import { colors, font, space } from '../../tokens.stylex.js';
|
|
7
|
+
export const cellStyles = stylex.create({
|
|
8
|
+
cell: {
|
|
9
|
+
paddingBlock: space.x1_5,
|
|
10
|
+
paddingInline: space.x3
|
|
11
|
+
},
|
|
12
|
+
// A header cell in the body or the foot, which names its row: Narvi's weight, not the browser's bold
|
|
13
|
+
header: { fontWeight: font.weightMedium },
|
|
14
|
+
start: { textAlign: 'start' },
|
|
15
|
+
center: { textAlign: 'center' },
|
|
16
|
+
end: { textAlign: 'end' },
|
|
17
|
+
// A number is never broken across lines
|
|
18
|
+
numeric: { whiteSpace: 'nowrap' },
|
|
19
|
+
// One line, cut short. The whole of it goes in a `title` or a tooltip of the app's own
|
|
20
|
+
truncate: {
|
|
21
|
+
overflow: 'hidden',
|
|
22
|
+
textOverflow: 'ellipsis',
|
|
23
|
+
whiteSpace: 'nowrap'
|
|
24
|
+
},
|
|
25
|
+
// The row's number: as narrow as it can be, quieter than what is in the row, and left out
|
|
26
|
+
// when the rows are selected and copied
|
|
27
|
+
rowNumber: {
|
|
28
|
+
width: '1%',
|
|
29
|
+
paddingInlineEnd: space.x1,
|
|
30
|
+
color: colors.textSubtle,
|
|
31
|
+
textAlign: 'end',
|
|
32
|
+
whiteSpace: 'nowrap',
|
|
33
|
+
userSelect: 'none'
|
|
34
|
+
},
|
|
35
|
+
counted: {
|
|
36
|
+
'::before': { content: 'counter(narvi-table-row)' }
|
|
37
|
+
},
|
|
38
|
+
counter: { counterIncrement: 'narvi-table-row' }
|
|
39
|
+
});
|
|
40
|
+
/** The style for a cell's alignment: `align` if given, otherwise the end for a number. */
|
|
41
|
+
export function alignOf(align, numeric) {
|
|
42
|
+
const side = align ?? (numeric ? 'end' : undefined);
|
|
43
|
+
return side ? cellStyles[side] : null;
|
|
44
|
+
}
|
|
@@ -9,10 +9,22 @@
|
|
|
9
9
|
/**
|
|
10
10
|
* What the text is. Each role is one size, weight and line height: `title`, `reading`
|
|
11
11
|
* (a reply, the prompt), `label` (what names a thing), `body` (running copy), `meta`,
|
|
12
|
-
* `caption` and `micro`.
|
|
12
|
+
* `caption` and `micro`. The figures are a number that is the point of its place:
|
|
13
|
+
* `figureTile` (one among several), `figure` (a card's) and `figurePage` (a page's).
|
|
14
|
+
* `lead` is a lede: the line under a page's title.
|
|
13
15
|
*/
|
|
14
16
|
export type TextVariant =
|
|
15
|
-
|
|
17
|
+
| 'figurePage'
|
|
18
|
+
| 'figure'
|
|
19
|
+
| 'figureTile'
|
|
20
|
+
| 'title'
|
|
21
|
+
| 'reading'
|
|
22
|
+
| 'label'
|
|
23
|
+
| 'body'
|
|
24
|
+
| 'meta'
|
|
25
|
+
| 'caption'
|
|
26
|
+
| 'micro'
|
|
27
|
+
| 'lead';
|
|
16
28
|
export type TextTone = 'default' | 'muted' | 'subtle' | 'accent' | 'danger' | 'success';
|
|
17
29
|
export type TextWeight = 'regular' | 'medium' | 'semibold';
|
|
18
30
|
/** `body` is the page's own face; `display` is the serif that large headings are set in. */
|
|
@@ -76,7 +88,7 @@
|
|
|
76
88
|
}
|
|
77
89
|
});
|
|
78
90
|
|
|
79
|
-
// A lede has no role among the
|
|
91
|
+
// A lede has no role among the others: it is a page's, set fluid between two sizes
|
|
80
92
|
const lead = stylex.create({
|
|
81
93
|
body: {
|
|
82
94
|
fontSize: 'clamp(1.125rem, 1rem + 0.5vw, 1.25rem)',
|
|
@@ -136,6 +148,9 @@
|
|
|
136
148
|
}: TextProps = $props();
|
|
137
149
|
|
|
138
150
|
const display = $derived(face === 'display');
|
|
151
|
+
const figure = $derived(
|
|
152
|
+
variant === 'figure' || variant === 'figureTile' || variant === 'figurePage'
|
|
153
|
+
);
|
|
139
154
|
</script>
|
|
140
155
|
|
|
141
156
|
<svelte:element
|
|
@@ -147,7 +162,7 @@
|
|
|
147
162
|
styles.base,
|
|
148
163
|
variant === 'lead' ? lead.body : typography[variant],
|
|
149
164
|
// A figure keeps its own size in the serif too
|
|
150
|
-
display && [styles.display,
|
|
165
|
+
display && [styles.display, !figure && displaySizes[variant as keyof typeof displaySizes]],
|
|
151
166
|
tones[tone],
|
|
152
167
|
weight && weights[weight],
|
|
153
168
|
italic && styles.italic,
|
|
@@ -4,9 +4,11 @@ import { type Sx } from '../../internal/sx.js';
|
|
|
4
4
|
/**
|
|
5
5
|
* What the text is. Each role is one size, weight and line height: `title`, `reading`
|
|
6
6
|
* (a reply, the prompt), `label` (what names a thing), `body` (running copy), `meta`,
|
|
7
|
-
* `caption` and `micro`.
|
|
7
|
+
* `caption` and `micro`. The figures are a number that is the point of its place:
|
|
8
|
+
* `figureTile` (one among several), `figure` (a card's) and `figurePage` (a page's).
|
|
9
|
+
* `lead` is a lede: the line under a page's title.
|
|
8
10
|
*/
|
|
9
|
-
export type TextVariant = 'figure' | 'title' | 'reading' | 'label' | 'body' | 'meta' | 'caption' | 'micro' | 'lead';
|
|
11
|
+
export type TextVariant = 'figurePage' | 'figure' | 'figureTile' | 'title' | 'reading' | 'label' | 'body' | 'meta' | 'caption' | 'micro' | 'lead';
|
|
10
12
|
export type TextTone = 'default' | 'muted' | 'subtle' | 'accent' | 'danger' | 'success';
|
|
11
13
|
export type TextWeight = 'regular' | 'medium' | 'semibold';
|
|
12
14
|
/** `body` is the page's own face; `display` is the serif that large headings are set in. */
|
|
@@ -21,6 +21,11 @@
|
|
|
21
21
|
label: string;
|
|
22
22
|
/** Whether the work shows. Bindable. */
|
|
23
23
|
open?: boolean | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* What sits on the line after the fold's button, outside it: the turn's totals, such
|
|
26
|
+
* as a ChangeStats. It is not part of the button's name or the region's.
|
|
27
|
+
*/
|
|
28
|
+
trailing?: Snippet | undefined;
|
|
24
29
|
sx?: Sx | undefined;
|
|
25
30
|
class?: string | undefined;
|
|
26
31
|
/** The turn's working: Reasoning, Activity rows, notes. */
|
|
@@ -55,6 +60,14 @@
|
|
|
55
60
|
transitionTimingFunction: 'ease'
|
|
56
61
|
},
|
|
57
62
|
label: { display: 'inline-flex', alignItems: 'center', gap: '0.25rem' },
|
|
63
|
+
// The button and what follows it, on one line
|
|
64
|
+
line: {
|
|
65
|
+
display: 'flex',
|
|
66
|
+
alignItems: 'center',
|
|
67
|
+
alignSelf: 'flex-start',
|
|
68
|
+
gap: '0.625rem',
|
|
69
|
+
minWidth: 0
|
|
70
|
+
},
|
|
58
71
|
chevron: { display: 'grid', color: colors.textSubtle },
|
|
59
72
|
// The work is set in under the icon, its rows in line with the label
|
|
60
73
|
work: {
|
|
@@ -73,6 +86,7 @@
|
|
|
73
86
|
let {
|
|
74
87
|
label,
|
|
75
88
|
open = $bindable(false),
|
|
89
|
+
trailing,
|
|
76
90
|
sx,
|
|
77
91
|
class: className,
|
|
78
92
|
children,
|
|
@@ -82,13 +96,24 @@
|
|
|
82
96
|
const uid = $props.id();
|
|
83
97
|
</script>
|
|
84
98
|
|
|
85
|
-
|
|
99
|
+
{#snippet trigger()}
|
|
86
100
|
<Collapsible.Trigger id="{uid}-trigger" {...stylex.attrs(styles.trigger)}>
|
|
87
101
|
<Tile glyph="layers" />
|
|
88
102
|
<span {...stylex.attrs(styles.label)}
|
|
89
103
|
>{label}<span {...stylex.attrs(styles.chevron)}><Chevron {open} size={12} /></span></span
|
|
90
104
|
>
|
|
91
105
|
</Collapsible.Trigger>
|
|
106
|
+
{/snippet}
|
|
107
|
+
|
|
108
|
+
<CollapsibleRoot bind:open data-slot="work-fold" {...rest} {sx} class={className}>
|
|
109
|
+
{#if trailing}
|
|
110
|
+
<div data-slot="work-fold-line" {...stylex.attrs(styles.line)}>
|
|
111
|
+
{@render trigger()}
|
|
112
|
+
{@render trailing()}
|
|
113
|
+
</div>
|
|
114
|
+
{:else}
|
|
115
|
+
{@render trigger()}
|
|
116
|
+
{/if}
|
|
92
117
|
<CollapsibleContent role="region" aria-labelledby="{uid}-trigger" sx={styles.work}>
|
|
93
118
|
{@render children?.()}
|
|
94
119
|
</CollapsibleContent>
|
|
@@ -6,6 +6,11 @@ export type WorkFoldProps = Omit<CollapsibleRootProps, 'children' | 'open' | 'sx
|
|
|
6
6
|
label: string;
|
|
7
7
|
/** Whether the work shows. Bindable. */
|
|
8
8
|
open?: boolean | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* What sits on the line after the fold's button, outside it: the turn's totals, such
|
|
11
|
+
* as a ChangeStats. It is not part of the button's name or the region's.
|
|
12
|
+
*/
|
|
13
|
+
trailing?: Snippet | undefined;
|
|
9
14
|
sx?: Sx | undefined;
|
|
10
15
|
class?: string | undefined;
|
|
11
16
|
/** The turn's working: Reasoning, Activity rows, notes. */
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export { default as Approval } from './components/approval/Approval.svelte';
|
|
|
2
2
|
export type { ApprovalAnswer, ApprovalChoice, ApprovalProps, ApprovalShortcut } from './components/approval/Approval.svelte';
|
|
3
3
|
export * as AppShell from './components/app-shell/index.js';
|
|
4
4
|
export { getAppShellContext } from './components/app-shell/index.js';
|
|
5
|
-
export type { AppShellBarProps, AppShellContext, AppShellHeaderProps, AppShellMainProps, AppShellPanelProps, AppShellPanesProps, AppShellRailProps, AppShellRootProps, AppShellSheetProps, AppShellSidebarProps, AppShellToggleProps } from './components/app-shell/index.js';
|
|
5
|
+
export type { AppShellBarProps, AppShellContext, AppShellHeaderProps, AppShellMainProps, AppShellPanelProps, AppShellPanesProps, AppShellRailProps, AppShellRootProps, AppShellSheetProps, AppShellSidebarProps, AppShellStripProps, AppShellToggleProps } from './components/app-shell/index.js';
|
|
6
6
|
export * as Activity from './components/activity/index.js';
|
|
7
7
|
export type { ActivityContentProps, ActivityIconProps, ActivityIconTone, ActivityRootProps, ActivityStepKind, ActivityStepOutputLabels, ActivityStepProps, ActivityStepStatus, ActivityThoughtProps, ActivityTriggerProps } from './components/activity/index.js';
|
|
8
8
|
export { default as Announcer } from './components/announcer/Announcer.svelte';
|
|
@@ -136,6 +136,8 @@ export type { StatusDotProps, StatusDotShape, StatusDotTone } from './components
|
|
|
136
136
|
export type { Status, StatusIndicatorProps } from './components/status-indicator/StatusIndicator.svelte';
|
|
137
137
|
export { default as Switch } from './components/switch/Switch.svelte';
|
|
138
138
|
export type { SwitchProps } from './components/switch/Switch.svelte';
|
|
139
|
+
export * as Table from './components/table/index.js';
|
|
140
|
+
export type { TableAlign, TableBodyProps, TableCellProps, TableFootProps, TableHeadProps, TableHeaderCellProps, TableRootProps, TableRowProps } from './components/table/index.js';
|
|
139
141
|
export { default as TabStrip } from './components/tab-strip/TabStrip.svelte';
|
|
140
142
|
export type { TabStripProps, TabStripTab } from './components/tab-strip/TabStrip.svelte';
|
|
141
143
|
export { default as Tabs } from './components/tabs/Tabs.svelte';
|
|
@@ -144,6 +146,7 @@ export { default as Text } from './components/text/Text.svelte';
|
|
|
144
146
|
export type { TextFace, TextProps, TextTone, TextVariant, TextWeight } from './components/text/Text.svelte';
|
|
145
147
|
export { typography } from './typography.js';
|
|
146
148
|
export type { TypeRole } from './typography.js';
|
|
149
|
+
export { monogram } from './typography.js';
|
|
147
150
|
export { visuallyHidden } from './visually-hidden.js';
|
|
148
151
|
export { focusRing } from './focus-ring.js';
|
|
149
152
|
export type { IconComponent } from './internal/icon.js';
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// Components
|
|
2
2
|
export { default as Approval } from './components/approval/Approval.svelte';
|
|
3
3
|
// Compound: <AppShell.Root>, <AppShell.Bar>, <AppShell.Rail>, <AppShell.Panes>, <AppShell.Sheet>,
|
|
4
|
-
// <AppShell.Sidebar>, <AppShell.Main>, <AppShell.Header>, <AppShell.
|
|
4
|
+
// <AppShell.Sidebar>, <AppShell.Main>, <AppShell.Header>, <AppShell.Strip>, <AppShell.Panel>,
|
|
5
|
+
// <AppShell.Toggle>
|
|
5
6
|
export * as AppShell from './components/app-shell/index.js';
|
|
6
7
|
export { getAppShellContext } from './components/app-shell/index.js';
|
|
7
8
|
// Compound: <Activity.Root>, <Activity.Trigger>, <Activity.Content>, <Activity.Step>, <Activity.Thought>,
|
|
@@ -100,11 +101,16 @@ export * as Suggestions from './components/suggestions/index.js';
|
|
|
100
101
|
export { default as StatusIndicator } from './components/status-indicator/StatusIndicator.svelte';
|
|
101
102
|
export { default as StatusDot } from './components/status-indicator/StatusDot.svelte';
|
|
102
103
|
export { default as Switch } from './components/switch/Switch.svelte';
|
|
104
|
+
// Compound: <Table.Root>, <Table.Head>, <Table.Body>, <Table.Foot>, <Table.Row>,
|
|
105
|
+
// <Table.HeaderCell>, <Table.Cell>
|
|
106
|
+
export * as Table from './components/table/index.js';
|
|
103
107
|
export { default as TabStrip } from './components/tab-strip/TabStrip.svelte';
|
|
104
108
|
export { default as Tabs } from './components/tabs/Tabs.svelte';
|
|
105
109
|
export { default as Text } from './components/text/Text.svelte';
|
|
106
110
|
// The type roles as styles, for an element of your own: `stylex.attrs(typography.caption, …)`
|
|
107
111
|
export { typography } from './typography.js';
|
|
112
|
+
// A letter inside a small mark, sized from the mark: `monogram.mark` on it, `monogram.letter` inside
|
|
113
|
+
export { monogram } from './typography.js';
|
|
108
114
|
// Hidden from sight, kept for assistive technology: `stylex.attrs(visuallyHidden)`
|
|
109
115
|
export { visuallyHidden } from './visually-hidden.js';
|
|
110
116
|
// Focus as Narvi's parts show it: `focusRing.ring` for a control of your own, `focusRing.frame`
|
|
@@ -24,3 +24,7 @@ export declare const tabStripTabMarker: Readonly<{
|
|
|
24
24
|
export declare const segmentedInputMarker: Readonly<{
|
|
25
25
|
readonly marker: stylex.StyleXClassNameFor<"marker", symbol>;
|
|
26
26
|
}>;
|
|
27
|
+
/** Placed on AppShell.Strip, so the header that holds it takes a band's colour and no line. */
|
|
28
|
+
export declare const appShellStripMarker: Readonly<{
|
|
29
|
+
readonly marker: stylex.StyleXClassNameFor<"marker", symbol>;
|
|
30
|
+
}>;
|
|
@@ -14,3 +14,5 @@ export const sidebarItemMarker = stylex.defineMarker();
|
|
|
14
14
|
export const tabStripTabMarker = stylex.defineMarker();
|
|
15
15
|
/** A SegmentedControl's radio, so the label after it follows its state. */
|
|
16
16
|
export const segmentedInputMarker = stylex.defineMarker();
|
|
17
|
+
/** Placed on AppShell.Strip, so the header that holds it takes a band's colour and no line. */
|
|
18
|
+
export const appShellStripMarker = stylex.defineMarker();
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a table of Narvi's looks like, whoever draws it: Markdown's, from a document, and
|
|
3
|
+
* `Table`'s, from data. Each adds only its own room and size: Markdown's in `em`, to take the
|
|
4
|
+
* size of the document, and Table's from the spacing scale.
|
|
5
|
+
*/
|
|
6
|
+
import * as stylex from '@stylexjs/stylex';
|
|
7
|
+
export declare const tableStyles: Readonly<{
|
|
8
|
+
readonly table: Readonly<{
|
|
9
|
+
readonly width: stylex.StyleXClassNameFor<"width", "max-content">;
|
|
10
|
+
readonly minWidth: stylex.StyleXClassNameFor<"minWidth", "100%">;
|
|
11
|
+
readonly fontVariantNumeric: stylex.StyleXClassNameFor<"fontVariantNumeric", "tabular-nums">;
|
|
12
|
+
}>;
|
|
13
|
+
readonly cell: Readonly<{
|
|
14
|
+
readonly textAlign: stylex.StyleXClassNameFor<"textAlign", "start">;
|
|
15
|
+
readonly verticalAlign: stylex.StyleXClassNameFor<"verticalAlign", "top">;
|
|
16
|
+
readonly maxWidth: stylex.StyleXClassNameFor<"maxWidth", "24rem">;
|
|
17
|
+
readonly overflowWrap: stylex.StyleXClassNameFor<"overflowWrap", "break-word">;
|
|
18
|
+
readonly borderBlockStartWidth: stylex.StyleXClassNameFor<"borderBlockStartWidth", "1px">;
|
|
19
|
+
readonly borderBlockStartStyle: stylex.StyleXClassNameFor<"borderBlockStartStyle", "solid">;
|
|
20
|
+
readonly borderBlockStartColor: stylex.StyleXClassNameFor<"borderBlockStartColor", string>;
|
|
21
|
+
}>;
|
|
22
|
+
readonly headCell: Readonly<{
|
|
23
|
+
readonly borderBlockStartWidth: stylex.StyleXClassNameFor<"borderBlockStartWidth", 0>;
|
|
24
|
+
readonly backgroundColor: stylex.StyleXClassNameFor<"backgroundColor", string>;
|
|
25
|
+
readonly color: stylex.StyleXClassNameFor<"color", string>;
|
|
26
|
+
readonly fontWeight: stylex.StyleXClassNameFor<"fontWeight", string>;
|
|
27
|
+
readonly whiteSpace: stylex.StyleXClassNameFor<"whiteSpace", "nowrap">;
|
|
28
|
+
}>;
|
|
29
|
+
}>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a table of Narvi's looks like, whoever draws it: Markdown's, from a document, and
|
|
3
|
+
* `Table`'s, from data. Each adds only its own room and size: Markdown's in `em`, to take the
|
|
4
|
+
* size of the document, and Table's from the spacing scale.
|
|
5
|
+
*/
|
|
6
|
+
import * as stylex from '@stylexjs/stylex';
|
|
7
|
+
import { colors, font } from '../tokens.stylex.js';
|
|
8
|
+
export const tableStyles = stylex.create({
|
|
9
|
+
// As wide as its columns, and never narrower than its frame. Digits line up down a column.
|
|
10
|
+
table: {
|
|
11
|
+
width: 'max-content',
|
|
12
|
+
minWidth: '100%',
|
|
13
|
+
fontVariantNumeric: 'tabular-nums'
|
|
14
|
+
},
|
|
15
|
+
// A hairline over each row. A cell of prose wraps at 24rem; a table of short cells stays as
|
|
16
|
+
// narrow as its content
|
|
17
|
+
cell: {
|
|
18
|
+
textAlign: 'start',
|
|
19
|
+
verticalAlign: 'top',
|
|
20
|
+
maxWidth: '24rem',
|
|
21
|
+
overflowWrap: 'break-word',
|
|
22
|
+
borderBlockStartWidth: { default: '1px', ':first-child': '1px' },
|
|
23
|
+
borderBlockStartStyle: 'solid',
|
|
24
|
+
borderBlockStartColor: colors.border
|
|
25
|
+
},
|
|
26
|
+
// The head is a well: a fill, and no line of its own over it, which is the frame's edge
|
|
27
|
+
headCell: {
|
|
28
|
+
borderBlockStartWidth: 0,
|
|
29
|
+
backgroundColor: colors.fillSunken,
|
|
30
|
+
color: colors.text,
|
|
31
|
+
fontWeight: font.weightMedium,
|
|
32
|
+
whiteSpace: 'nowrap'
|
|
33
|
+
}
|
|
34
|
+
});
|
package/dist/tokens.stylex.d.ts
CHANGED
|
@@ -109,7 +109,9 @@ export declare const font: stylex.VarGroup<Readonly<{
|
|
|
109
109
|
sizeBody: string;
|
|
110
110
|
sizeReading: string;
|
|
111
111
|
sizeTitle: string;
|
|
112
|
+
sizeFigureTile: string;
|
|
112
113
|
sizeFigure: string;
|
|
114
|
+
sizeFigurePage: string;
|
|
113
115
|
weightRegular: string;
|
|
114
116
|
weightMedium: string;
|
|
115
117
|
weightSemibold: string;
|
package/dist/tokens.stylex.js
CHANGED
|
@@ -157,10 +157,16 @@ export const font = stylex.defineVars({
|
|
|
157
157
|
sizeBody: '0.875rem',
|
|
158
158
|
// What is read or typed at length: a reply, the prompt
|
|
159
159
|
sizeReading: '1rem',
|
|
160
|
-
// A title in the text's own face: a dialog's, a section's
|
|
160
|
+
// A title in the text's own face: a dialog's, a section's, a detail page's
|
|
161
161
|
sizeTitle: '1.0625rem',
|
|
162
|
-
//
|
|
163
|
-
|
|
162
|
+
// Figures, a number that is the point of its place, in three steps named for where they
|
|
163
|
+
// stand. Each is half again the one before or more, so no two read as the same size.
|
|
164
|
+
// A figure among several: a stat tile, a group's total in a grid
|
|
165
|
+
sizeFigureTile: '1.5rem',
|
|
166
|
+
// The figure a card is about: a usage figure, a count on a card
|
|
167
|
+
sizeFigure: '2.25rem',
|
|
168
|
+
// The one figure a page or a view is about: a period's total
|
|
169
|
+
sizeFigurePage: '3rem',
|
|
164
170
|
weightRegular: '400',
|
|
165
171
|
weightMedium: '500',
|
|
166
172
|
weightSemibold: '600',
|
package/dist/typography.d.ts
CHANGED
|
@@ -39,11 +39,25 @@ export declare const typography: Readonly<{
|
|
|
39
39
|
readonly fontWeight: stylex.StyleXClassNameFor<"fontWeight", string>;
|
|
40
40
|
readonly lineHeight: stylex.StyleXClassNameFor<"lineHeight", 1.45>;
|
|
41
41
|
}>;
|
|
42
|
+
readonly figureTile: Readonly<{
|
|
43
|
+
readonly fontSize: stylex.StyleXClassNameFor<"fontSize", string>;
|
|
44
|
+
readonly fontWeight: stylex.StyleXClassNameFor<"fontWeight", string>;
|
|
45
|
+
readonly lineHeight: stylex.StyleXClassNameFor<"lineHeight", 1.15>;
|
|
46
|
+
readonly letterSpacing: stylex.StyleXClassNameFor<"letterSpacing", "-0.015em">;
|
|
47
|
+
readonly fontVariantNumeric: stylex.StyleXClassNameFor<"fontVariantNumeric", "tabular-nums">;
|
|
48
|
+
}>;
|
|
42
49
|
readonly figure: Readonly<{
|
|
43
50
|
readonly fontSize: stylex.StyleXClassNameFor<"fontSize", string>;
|
|
44
51
|
readonly fontWeight: stylex.StyleXClassNameFor<"fontWeight", string>;
|
|
45
52
|
readonly lineHeight: stylex.StyleXClassNameFor<"lineHeight", 1.1>;
|
|
46
|
-
readonly letterSpacing: stylex.StyleXClassNameFor<"letterSpacing", "-0.
|
|
53
|
+
readonly letterSpacing: stylex.StyleXClassNameFor<"letterSpacing", "-0.02em">;
|
|
54
|
+
readonly fontVariantNumeric: stylex.StyleXClassNameFor<"fontVariantNumeric", "tabular-nums">;
|
|
55
|
+
}>;
|
|
56
|
+
readonly figurePage: Readonly<{
|
|
57
|
+
readonly fontSize: stylex.StyleXClassNameFor<"fontSize", string>;
|
|
58
|
+
readonly fontWeight: stylex.StyleXClassNameFor<"fontWeight", string>;
|
|
59
|
+
readonly lineHeight: stylex.StyleXClassNameFor<"lineHeight", 1>;
|
|
60
|
+
readonly letterSpacing: stylex.StyleXClassNameFor<"letterSpacing", "-0.025em">;
|
|
47
61
|
readonly fontVariantNumeric: stylex.StyleXClassNameFor<"fontVariantNumeric", "tabular-nums">;
|
|
48
62
|
}>;
|
|
49
63
|
readonly micro: Readonly<{
|
|
@@ -53,3 +67,28 @@ export declare const typography: Readonly<{
|
|
|
53
67
|
}>;
|
|
54
68
|
}>;
|
|
55
69
|
export type TypeRole = keyof typeof typography;
|
|
70
|
+
/**
|
|
71
|
+
* A letter inside a small mark: an avatar's initials, a monogram, the badge on a provider's
|
|
72
|
+
* mark. It is not a role. It is part of the mark, so it is sized from the mark's own box, not
|
|
73
|
+
* from the scale: a quarter of the mark's shorter side, plus 4px so a small mark's letter stays
|
|
74
|
+
* legible. A 16px mark takes 8px, a 20px one 9px, a 28px one 11px, a 56px one 18px.
|
|
75
|
+
*
|
|
76
|
+
* Put `monogram.mark` on the mark, the box that has a width and a height, and
|
|
77
|
+
* `monogram.letter` on the letter inside it (or on a badge inside it, which is then sized from
|
|
78
|
+
* the mark it sits on). Without `monogram.mark` on an ancestor the letter is sized from the
|
|
79
|
+
* window, so never use `letter` alone.
|
|
80
|
+
*
|
|
81
|
+
* <span {...stylex.attrs(monogram.mark, styles.mark)}>
|
|
82
|
+
* <span {...stylex.attrs(monogram.letter)}>AL</span>
|
|
83
|
+
* </span>
|
|
84
|
+
*/
|
|
85
|
+
export declare const monogram: Readonly<{
|
|
86
|
+
readonly mark: Readonly<{
|
|
87
|
+
readonly containerType: stylex.StyleXClassNameFor<"containerType", "size">;
|
|
88
|
+
}>;
|
|
89
|
+
readonly letter: Readonly<{
|
|
90
|
+
readonly fontSize: stylex.StyleXClassNameFor<"fontSize", "calc(25cqmin + 0.25rem)">;
|
|
91
|
+
readonly fontWeight: stylex.StyleXClassNameFor<"fontWeight", string>;
|
|
92
|
+
readonly lineHeight: stylex.StyleXClassNameFor<"lineHeight", 1>;
|
|
93
|
+
}>;
|
|
94
|
+
}>;
|
package/dist/typography.js
CHANGED
|
@@ -46,12 +46,29 @@ export const typography = stylex.create({
|
|
|
46
46
|
fontWeight: font.weightRegular,
|
|
47
47
|
lineHeight: 1.45
|
|
48
48
|
},
|
|
49
|
-
//
|
|
49
|
+
// Figures: a number that is the point of its place, its digits lined up. The larger the
|
|
50
|
+
// figure, the tighter it is set. One among several, in a tile or a grid of totals: 24px
|
|
51
|
+
figureTile: {
|
|
52
|
+
fontSize: font.sizeFigureTile,
|
|
53
|
+
fontWeight: font.weightSemibold,
|
|
54
|
+
lineHeight: 1.15,
|
|
55
|
+
letterSpacing: '-0.015em',
|
|
56
|
+
fontVariantNumeric: 'tabular-nums'
|
|
57
|
+
},
|
|
58
|
+
// The figure a card is about: a usage figure, a count: 36px
|
|
50
59
|
figure: {
|
|
51
60
|
fontSize: font.sizeFigure,
|
|
52
61
|
fontWeight: font.weightSemibold,
|
|
53
62
|
lineHeight: 1.1,
|
|
54
|
-
letterSpacing: '-0.
|
|
63
|
+
letterSpacing: '-0.02em',
|
|
64
|
+
fontVariantNumeric: 'tabular-nums'
|
|
65
|
+
},
|
|
66
|
+
// The one figure a page or a view is about: a period's total: 48px
|
|
67
|
+
figurePage: {
|
|
68
|
+
fontSize: font.sizeFigurePage,
|
|
69
|
+
fontWeight: font.weightSemibold,
|
|
70
|
+
lineHeight: 1,
|
|
71
|
+
letterSpacing: '-0.025em',
|
|
55
72
|
fontVariantNumeric: 'tabular-nums'
|
|
56
73
|
},
|
|
57
74
|
// A counter or a status inside tight chrome
|
|
@@ -61,3 +78,26 @@ export const typography = stylex.create({
|
|
|
61
78
|
lineHeight: 1.3
|
|
62
79
|
}
|
|
63
80
|
});
|
|
81
|
+
/**
|
|
82
|
+
* A letter inside a small mark: an avatar's initials, a monogram, the badge on a provider's
|
|
83
|
+
* mark. It is not a role. It is part of the mark, so it is sized from the mark's own box, not
|
|
84
|
+
* from the scale: a quarter of the mark's shorter side, plus 4px so a small mark's letter stays
|
|
85
|
+
* legible. A 16px mark takes 8px, a 20px one 9px, a 28px one 11px, a 56px one 18px.
|
|
86
|
+
*
|
|
87
|
+
* Put `monogram.mark` on the mark, the box that has a width and a height, and
|
|
88
|
+
* `monogram.letter` on the letter inside it (or on a badge inside it, which is then sized from
|
|
89
|
+
* the mark it sits on). Without `monogram.mark` on an ancestor the letter is sized from the
|
|
90
|
+
* window, so never use `letter` alone.
|
|
91
|
+
*
|
|
92
|
+
* <span {...stylex.attrs(monogram.mark, styles.mark)}>
|
|
93
|
+
* <span {...stylex.attrs(monogram.letter)}>AL</span>
|
|
94
|
+
* </span>
|
|
95
|
+
*/
|
|
96
|
+
export const monogram = stylex.create({
|
|
97
|
+
mark: { containerType: 'size' },
|
|
98
|
+
letter: {
|
|
99
|
+
fontSize: 'calc(25cqmin + 0.25rem)',
|
|
100
|
+
fontWeight: font.weightSemibold,
|
|
101
|
+
lineHeight: 1
|
|
102
|
+
}
|
|
103
|
+
});
|
package/package.json
CHANGED
|
@@ -12,7 +12,7 @@ metadata:
|
|
|
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.4.0'
|
|
16
16
|
requires:
|
|
17
17
|
- setup
|
|
18
18
|
sources:
|
|
@@ -30,6 +30,7 @@ sources:
|
|
|
30
30
|
- src/lib/components/notice/Notice.svelte
|
|
31
31
|
- src/lib/components/field/Field.svelte
|
|
32
32
|
- src/lib/components/list/ListRoot.svelte
|
|
33
|
+
- src/lib/components/table/*
|
|
33
34
|
- src/lib/components/choice-cards/ChoiceCards.svelte
|
|
34
35
|
- src/lib/components/dialog/DialogContent.svelte
|
|
35
36
|
- src/lib/components/tab-strip/TabStrip.svelte
|
|
@@ -37,6 +38,10 @@ sources:
|
|
|
37
38
|
- src/lib/components/app-shell/*.svelte
|
|
38
39
|
- src/lib/components/composer/ComposerModelPicker.svelte
|
|
39
40
|
- src/lib/components/questionnaire/Questionnaire.svelte
|
|
41
|
+
- src/lib/components/approval/Approval.svelte
|
|
42
|
+
- src/lib/components/plan/Plan.svelte
|
|
43
|
+
- src/lib/components/queued-message/QueuedMessage.svelte
|
|
44
|
+
- src/lib/components/composer/ComposerTray.svelte
|
|
40
45
|
- src/lib/components/button/Button.svelte
|
|
41
46
|
- src/lib/components/tooltip/TooltipProvider.svelte
|
|
42
47
|
- src/lib/components/command/*.svelte
|
|
@@ -274,13 +279,13 @@ flex or grid style of your own. For anything they can't express, see the `stylin
|
|
|
274
279
|
### Text
|
|
275
280
|
|
|
276
281
|
Use `Heading` (`level` 1–6 for the outline, `size` from `sm` to `4xl` for the look, and
|
|
277
|
-
`truncate
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
`
|
|
283
|
-
`Card href`
|
|
282
|
+
`truncate`; a detail page's title is `size="lg"`, the title role's 17px) and `Text` (`variant`
|
|
283
|
+
is what the text is: a number that is the point of its place is `figureTile` 24px among
|
|
284
|
+
several, `figure` 36px on a card or `figurePage` 48px for a page's one; else `title`,
|
|
285
|
+
`reading`, `label`, `body`, `meta`, `caption`, `micro` or `lead`; `tone` default, muted, subtle,
|
|
286
|
+
accent, danger or success; `weight`; `face="display"`; `truncate`, or `lines={2}`). Use `Code`
|
|
287
|
+
and `Kbd` inline, `Link` inside text, `Button href` for a link that looks like a button, and
|
|
288
|
+
`Card href` for a card that is a link.
|
|
284
289
|
|
|
285
290
|
### Feedback
|
|
286
291
|
|
|
@@ -394,8 +399,8 @@ Parts of the shell that are easy to redraw by hand, and shouldn't be:
|
|
|
394
399
|
- **A mark with a badge** in a row's `meta` may overhang it; the line clips only far past its end.
|
|
395
400
|
- `AppShell.Main` is not focusable, so a press on text in the page leaves focus where it was.
|
|
396
401
|
- **TabStrip** tabs narrow to an ellipsis before the strip scrolls; with a `leading` icon, a
|
|
397
|
-
tab's close button takes the icon's place.
|
|
398
|
-
|
|
402
|
+
tab's close button takes the icon's place. Menus, dragging, renaming, preview tabs, middle-click
|
|
403
|
+
close and the header's notch are built in: see the [catalogue](references/components.md#tab-strips).
|
|
399
404
|
- **AppShell.Panel** goes narrow by its row, not the window; `maximized` lays it over the page,
|
|
400
405
|
kept inert, so give it an `AppShell.Header` with `AppShell.Toggle when="closed"`. Beside a
|
|
401
406
|
thread, put it in a flex row of yours (`position: relative`) inside `AppShell.Main`; for
|
|
@@ -406,7 +411,7 @@ Parts of the shell that are easy to redraw by hand, and shouldn't be:
|
|
|
406
411
|
shows no focus ring until the keys move in. Pass `focusOnOpen="first"` for a sheet that
|
|
407
412
|
holds a form.
|
|
408
413
|
- `AppShell.Header` draws a line under itself; `divider={false}` leaves it out where the page
|
|
409
|
-
runs on under the header,
|
|
414
|
+
runs on under the header; an `AppShell.Strip` in it runs its height, for a notch TabStrip.
|
|
410
415
|
|
|
411
416
|
Parts of a thread that are easy to redraw by hand, and shouldn't be:
|
|
412
417
|
|
|
@@ -421,19 +426,15 @@ Parts of a thread that are easy to redraw by hand, and shouldn't be:
|
|
|
421
426
|
several, `providers` (a `provider` on each model) for a rail of agents beside the list,
|
|
422
427
|
`searchable` for a field that searches them all, and `bind:starred` (values; keep them where
|
|
423
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.
|
|
424
|
-
- **Composer.Tray**
|
|
425
|
-
`waiting`
|
|
429
|
+
- **Composer.Tray** opens its shelf only for a child with height (measured), so an empty wrapper
|
|
430
|
+
opens none; `waiting` overrides. Its `queue` scrolls; read [the tray](references/components.md#the-composers-tray).
|
|
426
431
|
- **A user's message with attachments:** `<Message.Content bubble={false}>` is a column at the
|
|
427
432
|
end of the line; put the attachments in it, then the words in a `Message.Bubble`, then any
|
|
428
433
|
cards. Its actions then sit under it. `textSize="body"` on `Message.Root` (and on
|
|
429
434
|
`QueuedMessage`) sets the words at the interface's 14px instead of 16.
|
|
430
435
|
- **QueuedMessage** takes `attachments` (a snippet over the bubble), draws no bubble without
|
|
431
436
|
words, and `disabled` holds its actions back (`true`, or the ones to hold by name).
|
|
432
|
-
- **A timeline row of your own** starts with `Activity.Icon
|
|
433
|
-
your own icon as children), as the others' do. `Activity.Thought` takes a snippet, such as
|
|
434
|
-
Markdown, in place of `text`. `Activity.Step` takes `wrap` for a label that runs on, and
|
|
435
|
-
`status="neutral"` for a step that settled without going through or failing ("Skipped",
|
|
436
|
-
`statusLabels.neutral`); it and `WorkFold` pass `data-*` attributes on.
|
|
437
|
+
- **A timeline row of your own** starts with `Activity.Icon`; read the [catalogue](references/components.md#agent-timeline).
|
|
437
438
|
- **A divider with more than words:** `Divider` takes children (a link, a time) and `role="status"`.
|
|
438
439
|
- **Answers on their way:** `Approval` and `Questionnaire` take `busy`, which spins the button
|
|
439
440
|
pressed and holds the rest. A `Question` takes a `description`, and `secret` for an answer
|
|
@@ -459,8 +460,8 @@ Parts of a thread that are easy to redraw by hand, and shouldn't be:
|
|
|
459
460
|
a class or a style, or set `--narvi-icon-size` on the button.
|
|
460
461
|
- **One short label.** Don't join details with a dot ("Queued · sends later"). Put the rest in
|
|
461
462
|
an element of its own, or a tooltip.
|
|
462
|
-
- **What waits on the person goes over the composer
|
|
463
|
-
`
|
|
463
|
+
- **What waits on the person goes over the composer**, in `Composer.Tray`: the request in
|
|
464
|
+
`pending`, the folded `Plan` and compact `QueuedMessage`s in `queue`. Not up the conversation.
|
|
464
465
|
- **Labels are sentence case.** Small labels and eyebrows are never uppercase or mono.
|
|
465
466
|
- **Buttons name their action**: "Rename", "Delete thread", never "OK" or "Submit". A
|
|
466
467
|
confirmation's cancel button can name the way out: "Keep it".
|
|
@@ -477,8 +478,7 @@ Parts of a thread that are easy to redraw by hand, and shouldn't be:
|
|
|
477
478
|
- **MEDIUM: a raw `<label>` beside an Input.** It misses Field's description and error wiring.
|
|
478
479
|
- **HIGH: `Dialog.Content size="lg"` written for 44rem.** Since the sizes gained `lg` 36rem,
|
|
479
480
|
`xl` 44 and `2xl` 56, the old `lg` is `xl`.
|
|
480
|
-
- **MEDIUM: an Input's icon
|
|
481
|
-
sized to the field and the text starts after it.
|
|
481
|
+
- **MEDIUM: an Input's icon placed by hand.** Pass it as `icon`; the text starts after it.
|
|
482
482
|
- **MEDIUM: a toast's `onDismiss` alone for "Undo, or else forget".** A toast that runs out of
|
|
483
483
|
time calls `onAutoClose`, not `onDismiss`, so the forgetting never happens. Pass both.
|
|
484
484
|
- **MEDIUM: a SettingsRow's `<label for>` on a group.** A `SegmentedControl` or a set of radios
|