@filipgutica/ui 1.5.0 → 1.7.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,71 @@ 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 Full size button at the end of
180
+ the tab row, or a click on the capture, opens it at full size in a dialog, and
181
+ focus returns to the button on close. Phones show the button as an icon. `v-model`
182
+ holds the active ID and defaults to the first item. Each capture has the ID
183
+ `idPrefix` + `id` (`frame-` by default), so a deep link such as `#frame-read`
184
+ selects its tab on load and on hash change. Without JavaScript every capture is
185
+ listed under its own heading and scrolls at full size. The site owns terminal
186
+ colors: set `--site-capture-bg` on `:root`, because the dialog renders outside
187
+ the panel.
188
+
189
+ `UiCommandList` renders a table of monospace commands and descriptions. Use the
190
+ `command` slot to show a key as `<kbd>`, the `description` slot for `<kbd>` or
191
+ `<code>`, and `commandHeader` and `descriptionHeader` to rename the columns. Each row gets a copy button named
192
+ "Copy <command>" once the page is interactive; set `copyable` to `false` to
193
+ remove them. A status message announces each copy and shows a fallback when
194
+ the clipboard is unavailable. At 640px and below each command stacks above its
195
+ description and wraps.
196
+
197
+ `site.css` also includes page helpers: `.fg-site-steps` for an ordered list with
198
+ numbered circles, `.fg-site-facts` for an inline `dl` of short label and value
199
+ pairs, `.fg-site-definitions` for a two-column `dl` of `dt` and `dd` that stacks
200
+ on phones, `.fg-site-sr-only` for visually hidden text, and `.fg-site-skip` for
201
+ a skip link that appears on focus.
202
+
138
203
  ## Development
139
204
 
140
205
  ```sh