@vieo-io/ui 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.
@@ -2,6 +2,13 @@ import { type JSX } from '@solidjs/web';
2
2
  export type AppShellProps = {
3
3
  /** The page: a toolbar, then whatever scrolls. */
4
4
  children: JSX.Element;
5
+ /**
6
+ * Draws the palette's `--wash` on one fixed backdrop behind the sidebar, the toolbar, and the page.
7
+ * Those go transparent over it, dialogs and toasts keep their colour, and the drawer draws the wash over `--raised`.
8
+ * Inside the shell, `--muted` becomes `--muted-on-wash`.
9
+ * Off when the person asks for more contrast or uses forced colours.
10
+ */
11
+ gradient?: boolean;
5
12
  /** Gets the `main` element, which can take focus, such as after a navigation from the drawer. */
6
13
  mainRef?: (element: HTMLElement) => void;
7
14
  sidebar?: JSX.Element;
package/dist/AppShell.jsx CHANGED
@@ -4,7 +4,7 @@ import { Show } from '@solidjs/web';
4
4
  * from the window by `--shell-inset` with `--shell-radius` corners in a design that insets it.
5
5
  */
6
6
  export function AppShell(props) {
7
- return (<div class='vds-app-shell'>
7
+ return (<div class={['vds-app-shell', { 'vds-app-shell--gradient': props.gradient }]}>
8
8
  {props.sidebar}
9
9
  <main ref={props.mainRef} class='vds-app-shell__main' tabindex='-1'>
10
10
  {props.children}
package/dist/Tree.d.ts CHANGED
@@ -2,11 +2,18 @@ import { type JSX } from '@solidjs/web';
2
2
  import { type IconName } from './Icon';
3
3
  export type TreeNode = {
4
4
  children?: TreeNode[];
5
- /** At the row's end in muted text, such as a count. */
5
+ /**
6
+ * At the row's end in muted text, such as a count.
7
+ * Several children stack, end-aligned, such as a time over an icon.
8
+ */
6
9
  end?: JSX.Element;
7
10
  icon?: IconName;
8
11
  id: string;
9
12
  label: string;
13
+ /** A second line under the label, such as where a chat runs. It joins the row's name, after the label. */
14
+ meta?: JSX.Element;
15
+ /** Sets the label, and the end's first child, strong in the text colour, and describes the row as Unread. */
16
+ unread?: boolean;
10
17
  };
11
18
  export type TreeProps = {
12
19
  /** Buttons at the row's end, shown on hover and focus, and always on a touch screen. */
package/dist/Tree.jsx CHANGED
@@ -76,17 +76,23 @@ export function Tree(props) {
76
76
  };
77
77
  /**
78
78
  * A treeitem is the row alone, and owns its children's group through `aria-owns`, so its name and its
79
- * visible text stay the row's own. A count joins the name after a space, which the text has too.
79
+ * visible text stay the row's own.
80
+ * A meta line and a count join the name after a space, which the text has too.
80
81
  */
81
82
  const Row = (rowProps) => {
82
83
  const itemId = () => rowId(rowProps.node.id);
83
84
  const folder = () => Boolean(rowProps.node.children?.length);
85
+ const labelledBy = () => [
86
+ `${itemId()}-label`,
87
+ rowProps.node.meta && `${itemId()}-meta`,
88
+ rowProps.node.end && `${itemId()}-end`,
89
+ ]
90
+ .filter(Boolean)
91
+ .join(' ');
84
92
  return (<>
85
93
  {/* biome-ignore lint/a11y/useFocusableInteractive: tabindex is set below, as the tree's roving tab stop. */}
86
94
  {/* biome-ignore lint/a11y/useKeyWithClickEvents: the tree's own keydown handles Enter and the arrows. */}
87
- <div id={itemId()} class='vds-tree__item' role='treeitem' aria-labelledby={rowProps.node.end
88
- ? `${itemId()}-label ${itemId()}-end`
89
- : `${itemId()}-label`} aria-level={rowProps.level} aria-expanded={folder() ? aria(open(rowProps.node)) : undefined} aria-owns={open(rowProps.node) ? `${itemId()}-group` : undefined} aria-current={rowProps.node.id === props.current ? 'page' : undefined} tabindex={stop() === rowProps.node.id ? '0' : '-1'} style={{ '--vds-tree-depth': rowProps.level - 1 }} onFocus={() => setFocused(rowProps.node.id)} onClick={() => {
95
+ <div id={itemId()} class='vds-tree__item' role='treeitem' aria-labelledby={labelledBy()} aria-describedby={rowProps.node.unread ? `${itemId()}-unread` : undefined} aria-level={rowProps.level} aria-expanded={folder() ? aria(open(rowProps.node)) : undefined} aria-owns={open(rowProps.node) ? `${itemId()}-group` : undefined} aria-current={rowProps.node.id === props.current ? 'page' : undefined} data-unread={rowProps.node.unread ? '' : undefined} tabindex={stop() === rowProps.node.id ? '0' : '-1'} style={{ '--vds-tree-depth': rowProps.level - 1 }} onFocus={() => setFocused(rowProps.node.id)} onClick={() => {
90
96
  focus(rowProps.node.id);
91
97
  props.onOpen(rowProps.node);
92
98
  }}>
@@ -101,9 +107,22 @@ export function Tree(props) {
101
107
  <Show when={rowProps.node.icon}>
102
108
  {(name) => <Icon name={name()} class='vds-tree__icon'/>}
103
109
  </Show>
104
- <span id={`${itemId()}-label`} class='vds-tree__label'>
105
- {rowProps.node.label}
110
+ <span class='vds-tree__text'>
111
+ <span id={`${itemId()}-label`} class='vds-tree__label'>
112
+ {rowProps.node.label}
113
+ </span>
114
+ <Show when={rowProps.node.meta}>
115
+ {' '}
116
+ <span id={`${itemId()}-meta`} class='vds-tree__meta'>
117
+ {rowProps.node.meta}
118
+ </span>
119
+ </Show>
106
120
  </span>
121
+ <Show when={rowProps.node.unread}>
122
+ <span id={`${itemId()}-unread`} hidden>
123
+ Unread
124
+ </span>
125
+ </Show>
107
126
  <Show when={rowProps.node.end}>
108
127
  {' '}
109
128
  <span id={`${itemId()}-end`} class='vds-tree__end'>
@@ -66,6 +66,7 @@
66
66
  }
67
67
 
68
68
  @media (pointer: coarse) {
69
+ .vds-app-switcher,
69
70
  .vds-app-switcher__menu .vds-menu__item {
70
71
  min-height: var(--hit-min);
71
72
  }
package/dist/controls.css CHANGED
@@ -79,6 +79,11 @@
79
79
  }
80
80
 
81
81
  @media (pointer: coarse) {
82
+ /* A native select can't hold a touch area larger than itself. */
83
+ .vds-select__input {
84
+ min-height: var(--hit-min);
85
+ }
86
+
82
87
  .vds-switch::before,
83
88
  .vds-checkbox__input::before {
84
89
  position: absolute;
package/dist/field.css CHANGED
@@ -59,3 +59,10 @@
59
59
  color: var(--danger);
60
60
  font-size: var(--font-sm);
61
61
  }
62
+
63
+ /* An input can't hold a touch area larger than itself. */
64
+ @media (pointer: coarse) {
65
+ .vds-field__input {
66
+ min-height: var(--hit-min);
67
+ }
68
+ }
package/dist/shell.css CHANGED
@@ -40,6 +40,37 @@
40
40
  grid-column: 1 / -1;
41
41
  }
42
42
 
43
+ @media not (prefers-contrast: more) {
44
+ @media (forced-colors: none) {
45
+ .vds-app-shell--gradient {
46
+ --muted: var(--muted-on-wash);
47
+
48
+ isolation: isolate;
49
+ }
50
+
51
+ .vds-app-shell--gradient::before {
52
+ position: fixed;
53
+ inset: 0;
54
+ z-index: -1;
55
+ background: var(--wash), var(--ground);
56
+ content: "";
57
+ pointer-events: none;
58
+ }
59
+
60
+ .vds-app-shell--gradient .vds-app-shell__main,
61
+ .vds-app-shell--gradient .vds-sidebar,
62
+ .vds-app-shell--gradient .vds-toolbar {
63
+ background: transparent;
64
+ }
65
+
66
+ /* The drawer is a sidebar too, so this follows the transparent rule above to keep it opaque. */
67
+ .vds-app-shell--gradient .vds-drawer {
68
+ background: var(--wash), var(--raised);
69
+ background-attachment: fixed;
70
+ }
71
+ }
72
+ }
73
+
43
74
  .vds-sidebar-frame {
44
75
  position: relative;
45
76
  display: flex;
package/dist/toolbar.css CHANGED
@@ -44,3 +44,11 @@
44
44
  color: var(--muted);
45
45
  font-size: var(--font-sm);
46
46
  }
47
+
48
+ /* A design may draw buttons under --hit-min, so neighbours stand far enough apart for each touch area. */
49
+ @media (pointer: coarse) {
50
+ .vds-toolbar__leading,
51
+ .vds-toolbar__actions {
52
+ gap: max(var(--space-1), calc(var(--hit-min) - var(--control-height)));
53
+ }
54
+ }
package/dist/tree.css CHANGED
@@ -46,16 +46,50 @@
46
46
  color: var(--muted);
47
47
  }
48
48
 
49
- .vds-tree__label {
49
+ .vds-tree__text {
50
+ display: flex;
50
51
  flex: 1;
52
+ flex-direction: column;
51
53
  min-width: 0;
54
+ }
55
+
56
+ .vds-tree__label,
57
+ .vds-tree__meta {
52
58
  overflow: hidden;
53
59
  text-overflow: ellipsis;
54
60
  white-space: nowrap;
55
61
  }
56
62
 
63
+ .vds-tree__meta {
64
+ color: var(--muted);
65
+ font-size: var(--font-xs);
66
+ }
67
+
68
+ .vds-tree__meta > .vds-icon {
69
+ margin-right: var(--space-1);
70
+ vertical-align: -0.2em;
71
+ }
72
+
73
+ /* Two lines can outgrow the row height, so they get room above and below. */
74
+ .vds-tree__item:has(.vds-tree__meta) {
75
+ padding-block: var(--space-1);
76
+ }
77
+
78
+ .vds-tree__item[data-unread] .vds-tree__label {
79
+ font-weight: var(--weight-strong);
80
+ }
81
+
82
+ .vds-tree__item[data-unread] .vds-tree__end > :first-child {
83
+ color: var(--text);
84
+ font-weight: var(--weight-strong);
85
+ }
86
+
57
87
  .vds-tree__end {
88
+ display: flex;
58
89
  flex: none;
90
+ flex-direction: column;
91
+ align-items: flex-end;
92
+ gap: var(--space-1);
59
93
  color: var(--muted);
60
94
  font-size: var(--font-xs);
61
95
  font-variant-numeric: tabular-nums;
@@ -82,8 +116,11 @@
82
116
  }
83
117
 
84
118
  @media (pointer: coarse) {
119
+ /* Each button's touch area keeps clear of its neighbour's and of the scrolling sidebar's edge, which clips it. */
85
120
  .vds-tree__actions {
86
121
  display: inline-flex;
122
+ gap: max(var(--space-1), calc(var(--hit-min) - var(--control-height-sm)));
123
+ margin-right: 0;
87
124
  }
88
125
 
89
126
  .vds-tree__item:has(> .vds-tree__actions) > .vds-tree__end {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vieo-io/ui",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Vieo's components in Solid 2.0, styled by @vieo-io/tokens",
5
5
  "license": "MPL-2.0",
6
6
  "type": "module",
@@ -25,7 +25,7 @@
25
25
  },
26
26
  "peerDependencies": {
27
27
  "@solidjs/web": "^2.0.3",
28
- "@vieo-io/tokens": "^0.1.0",
28
+ "@vieo-io/tokens": "^0.2.0",
29
29
  "solid-js": "^2.0.3"
30
30
  },
31
31
  "dependencies": {
@@ -43,7 +43,7 @@
43
43
  "solid-js": "2.0.3",
44
44
  "vite": "8.3.8",
45
45
  "vitest": "5.1.1",
46
- "@vieo-io/tokens": "0.1.0"
46
+ "@vieo-io/tokens": "0.2.0"
47
47
  },
48
48
  "sideEffects": [
49
49
  "**/*.css"