@synopackageland/ui 0.13.2 → 0.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,96 @@
1
+ # SplitPane, SizeBar and StorageMeter
2
+
3
+ Three building blocks for storage pages: two panes the user resizes, a size
4
+ bar for a list row, and a "free now → free after" projection. All three are
5
+ styled with classes only and work inside the DSM-embedded theme.
6
+
7
+ ## SplitPane
8
+
9
+ Two panes side by side (`horizontal`) or one above the other (`vertical`),
10
+ with a separator the user drags, moves with the keyboard, or double-clicks to
11
+ reset.
12
+
13
+ ```vue
14
+ <SplitPane storage-key="myapp.explore.split" :default-size="0.56" :min-start="280" :min-end="480">
15
+ <template #start><Treemap /></template>
16
+ <template #end><DataGrid ... /></template>
17
+ </SplitPane>
18
+ ```
19
+
20
+ | Prop | Default | Meaning |
21
+ | --- | --- | --- |
22
+ | `modelValue` | unset | The start pane's share of the room, 0–1. Bind `v-model` to control it; leave it unset and the pane keeps its own state. |
23
+ | `defaultSize` | `0.5` | The share it starts with and returns to on a double click. |
24
+ | `orientation` | `'horizontal'` | `horizontal`: start on the left. `vertical`: start on top. |
25
+ | `minStart` / `minEnd` | `160` | Each pane's minimum in px. The separator stops there; a window too small for both gives the start pane its minimum first. |
26
+ | `gap` | `12` | The separator's thickness in px (the room between the panes). |
27
+ | `storageKey` | unset | Remembers the share in this browser's `localStorage` under `<storageKey>:<orientation>`, so each orientation keeps its own share. Reading and writing are wrapped in `try/catch`; unreadable or invalid storage falls back to `defaultSize`. |
28
+ | `label` | "Resize panes" | The separator's accessible name. |
29
+
30
+ - **Keyboard.** The separator is a Tab stop (`role="separator"`). Left/Right
31
+ (horizontal) or Up/Down (vertical) move it by 2%, with Shift by 10%;
32
+ Home/End go to the minimums. Each change is saved.
33
+ - **ARIA.** `aria-orientation` is perpendicular to the layout, as the ARIA
34
+ pattern asks; `aria-valuenow`/`aria-valuemin`/`aria-valuemax` are whole
35
+ percentages of the start pane; `aria-controls` names the start pane.
36
+ - **Reset.** A double click removes the saved share and returns to
37
+ `defaultSize`. `reset()` is exposed for a menu command.
38
+ - Emits `update:modelValue` on every move. Hooks: `data-ui-split-pane`
39
+ (`data-orientation`, `data-dragging` while dragged),
40
+ `data-ui-split-pane-start`, `data-ui-split-pane-separator`,
41
+ `data-ui-split-pane-end`.
42
+
43
+ Choose the orientation from the measured content width, not a viewport media
44
+ query: a DSM window can be narrower than the browser.
45
+
46
+ ## SizeBar
47
+
48
+ A 4px bar for a table cell or list row: `value` against `max` (pass the
49
+ largest row, so that row fills the track), and `part` of it drawn from the
50
+ same start in the full tone, for example the reclaimable part of a size. The
51
+ numbers stay as text beside it.
52
+
53
+ ```vue
54
+ <template #cell-size="{ row }">
55
+ <CellText :text="formatFileSize(row.size)" />
56
+ <SizeBar :value="row.size" :max="largest" :part="row.reclaimable" />
57
+ </template>
58
+ ```
59
+
60
+ | Prop | Default | Meaning |
61
+ | --- | --- | --- |
62
+ | `value` | required | The row's size. `null`, `undefined` or `0` draws an empty track. |
63
+ | `max` | required | The size that fills the track. |
64
+ | `part` | `null` | The part of `value` to emphasise. |
65
+ | `tone` | `'primary'` | `primary`, `success`, `warning` or `danger`. |
66
+ | `label` | unset | Accessible name. Without it the bar is decorative (`aria-hidden`); give one only when the bar stands for numbers that are not shown. |
67
+
68
+ A non-zero value is at least 2px wide. The track colour is
69
+ `--ui-size-bar-track` (default `--ui-gray-a2`). Hooks: `data-ui-size-bar`
70
+ (`data-tone`), `data-ui-size-bar-value`, `data-ui-size-bar-part`.
71
+
72
+ ## StorageMeter
73
+
74
+ "Free now X → Free after Y" over a bar of the volume: used, the part a cleanup
75
+ frees, and free space.
76
+
77
+ ```vue
78
+ <StorageMeter :total="volume.total" :free="volume.free" :freeing="selection.bytes" :at-least="!selection.exact" :pending="selection.checking" />
79
+ ```
80
+
81
+ | Prop | Default | Meaning |
82
+ | --- | --- | --- |
83
+ | `total` / `free` | required | The volume's bytes. |
84
+ | `freeing` | required | Bytes the action frees; clamped to the used bytes. |
85
+ | `atLeast` | `false` | `freeing` is a lower bound: "Free after" reads "At least Y" and the freed part fades out at its end. |
86
+ | `pending` | `false` | A better number is being worked out: the freed part pulses (not with reduced motion) and the meter is `aria-busy`. |
87
+ | `labels` | built-in | `{ freeNow, freeAfter }`, for an app's own wording. |
88
+ | `format` | `formatFileSize` | Byte formatter (DSM's 1024 base). |
89
+
90
+ The meter is one `role="img"` whose name is "Free now X, free after Y". Its
91
+ text and bar follow the surrounding text colour (`currentColor`), so it reads
92
+ on a light page and on a dark action bar alike; "Free after" and the freed
93
+ part use `--ui-primary`. Hooks: `data-ui-storage-meter`,
94
+ `data-ui-storage-meter-now`, `data-ui-storage-meter-after`,
95
+ `data-ui-storage-meter-used`, `data-ui-storage-meter-freeing`
96
+ (`data-at-least`).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synopackageland/ui",
3
- "version": "0.13.2",
3
+ "version": "0.14.1",
4
4
  "description": "Shared Vue 3 UI component library with a DSM 7 inspired application theme",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -19,6 +19,7 @@
19
19
  "docs/component-defaults-0.5.7.md",
20
20
  "docs/json-ui.md",
21
21
  "docs/layout-rules.md",
22
+ "docs/size-and-split.md",
22
23
  "docs/theme-hooks.md"
23
24
  ],
24
25
  "bin": {