@filipgutica/ui 1.5.0 → 1.6.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 CHANGED
@@ -135,6 +135,70 @@ the operating system and other tabs, and is safe during server rendering and
135
135
  when storage is blocked. To avoid a flash of the wrong appearance, inline
136
136
  `siteThemeBootScript` in the document head.
137
137
 
138
+ ### Page components
139
+
140
+ The `site` entry also gives the project pages their section navigation,
141
+ terminal captures, and command tables. They use the styles from
142
+ `components.css` and `site.css`, and work without JavaScript.
143
+
144
+ ```vue
145
+ <script setup lang="ts">
146
+ import { UiCapture, UiCommandList, UiSiteNav } from '@filipgutica/ui/site'
147
+ import read from './captures/read.html?raw'
148
+ </script>
149
+
150
+ <template>
151
+ <UiSiteNav
152
+ label="On this page"
153
+ :groups="[{ items: [{ label: 'Install', href: '#install' }, { label: 'Commands', href: '#commands' }] }]"
154
+ />
155
+ <UiCapture
156
+ label="Steps"
157
+ :items="[{ id: 'read', label: 'Read', command: 'annoterm notes.md', html: read }]"
158
+ >
159
+ <template #caption="{ item }">
160
+ <p>What the {{ item.label }} capture shows.</p>
161
+ </template>
162
+ </UiCapture>
163
+ <UiCommandList :items="[{ command: 'wtree ui', description: 'Browse worktrees.' }]" />
164
+ </template>
165
+ ```
166
+
167
+ `UiSiteNav` renders a labelled list of route rows in optional `groups`. Links to
168
+ `#id` sections track the reader's position with `useActiveSection` and get
169
+ `aria-current="location"`, a text-only marker. An item with `current: true` gets
170
+ `aria-current="page"`, the selected fill and accent bar; `code: true` shows the
171
+ label in the monospace font. The page grid places the rail, which stays in view
172
+ on desktop. At 800px and below it is a native Menu disclosure until the page is
173
+ interactive, then a drawer. The drawer closes on navigation and focuses the
174
+ destination section, and focus follows the visible control across the
175
+ breakpoint.
176
+
177
+ `UiCapture` shows one panel: tabs in the header, the capture scaled to the panel
178
+ width, and the `command` and `caption` slot below. `html` is trusted, checked-in
179
+ terminal markup with a single root element. The expand button opens the capture
180
+ at full size in a dialog and returns focus to the button on close. `v-model`
181
+ holds the active ID and defaults to the first item. Each capture has the ID
182
+ `idPrefix` + `id` (`frame-` by default), so a deep link such as `#frame-read`
183
+ selects its tab on load and on hash change. Without JavaScript every capture is
184
+ listed under its own heading and scrolls at full size. The site owns terminal
185
+ colors: set `--site-capture-bg` on `:root`, because the dialog renders outside
186
+ the panel.
187
+
188
+ `UiCommandList` renders a table of monospace commands and descriptions. Use the
189
+ `description` slot for `<kbd>` or `<code>`, and `commandHeader` and
190
+ `descriptionHeader` to rename the columns. Each row gets a copy button named
191
+ "Copy <command>" once the page is interactive; set `copyable` to `false` to
192
+ remove them. A status message announces each copy and shows a fallback when
193
+ the clipboard is unavailable. At 640px and below each command stacks above its
194
+ description and wraps.
195
+
196
+ `site.css` also includes page helpers: `.fg-site-steps` for an ordered list with
197
+ numbered circles, `.fg-site-facts` for an inline `dl` of short label and value
198
+ pairs, `.fg-site-definitions` for a two-column `dl` of `dt` and `dd` that stacks
199
+ on phones, `.fg-site-sr-only` for visually hidden text, and `.fg-site-skip` for
200
+ a skip link that appears on focus.
201
+
138
202
  ## Development
139
203
 
140
204
  ```sh