@sewadah/selaras-docs 1.1.0 โ 1.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.
- package/CHANGELOG.md +25 -0
- package/README.md +53 -0
- package/app/components/content/DocsViewportPreview.vue +67 -0
- package/package.json +2 -2
- package/types.d.ts +8 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## v1.2.0
|
|
4
|
+
|
|
5
|
+
[compare changes](https://github.com/sewadahapp/selaras/compare/selaras-docs-v1.1.0...selaras-docs-v1.2.0)
|
|
6
|
+
|
|
7
|
+
### ๐ Enhancements
|
|
8
|
+
|
|
9
|
+
- **feat(docs):** provide reusable viewport preview component ([ccead99](https://github.com/sewadahapp/selaras/commit/ccead99a5c07c1eb11e573285ad362d23ee3263a))
|
|
10
|
+
- **feat(docs):** add device previews for adaptive interfaces ([dcd620f](https://github.com/sewadahapp/selaras/commit/dcd620fb331fbe7df1d443ce5d5219be665cf714))
|
|
11
|
+
- **feat(docs):** replace logo and favicon ([0ba8a12](https://github.com/sewadahapp/selaras/commit/0ba8a1234c5395682261d7170c18aeca60ee7dc5))
|
|
12
|
+
- **feat(agent):** add Selaras skill and local MCP server ([b15bc01](https://github.com/sewadahapp/selaras/commit/b15bc0181e86981d902640d7608554072bf095f0))
|
|
13
|
+
|
|
14
|
+
### ๐ฉน Fixes
|
|
15
|
+
|
|
16
|
+
- **fix(autocomplete):** use a modal for adaptive mobile editing ([330540f](https://github.com/sewadahapp/selaras/commit/330540f8073cd9b28782f01492f93e990b2d9ed1))
|
|
17
|
+
|
|
18
|
+
### ๐ Documentation
|
|
19
|
+
|
|
20
|
+
- **docs:** organize overview guides and add agent documentation exports ([3f5537b](https://github.com/sewadahapp/selaras/commit/3f5537b3138c5bc345da0d88dabb620f73dcd176))
|
|
21
|
+
|
|
22
|
+
### ๐ค Other changes
|
|
23
|
+
|
|
24
|
+
- **build(docs):** install local icon collections ([5f4fcaa](https://github.com/sewadahapp/selaras/commit/5f4fcaa9ccb403b4fccdf6debbe11ca78c1a739d))
|
|
25
|
+
|
|
26
|
+
Published against `@sewadah/selaras` ^0.4.0.
|
|
27
|
+
|
|
3
28
|
## v1.1.0
|
|
4
29
|
|
|
5
30
|
[compare changes](https://github.com/sewadahapp/selaras/compare/selaras-docs-v1.0.1...selaras-docs-v1.1.0)
|
package/README.md
CHANGED
|
@@ -122,3 +122,56 @@ the logo to the footer while leaving the header as configured.
|
|
|
122
122
|
For a host that owns Tailwind compilation or uses a class prefix, set
|
|
123
123
|
`selarasDocs: { css: false }` in `nuxt.config.ts` and import Selaras and the
|
|
124
124
|
docs stylesheet from the host CSS entry.
|
|
125
|
+
|
|
126
|
+
## Viewport previews
|
|
127
|
+
|
|
128
|
+
`DocsViewportPreview` embeds an example page in a real iframe viewport. Device
|
|
129
|
+
buttons change its width, so media queries and Selaras' `adaptive` controls
|
|
130
|
+
respond without resizing the documentation browser. It is available in Vue
|
|
131
|
+
components and Markdown:
|
|
132
|
+
|
|
133
|
+
```md
|
|
134
|
+
::docs-viewport-preview{src="/examples/team-picker" title="Team picker" :height="540"}
|
|
135
|
+
::
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Create the example route in your application's `pages/` directory (or
|
|
139
|
+
`app/pages/` with Nuxt's default directory structure). Use `layout: false` to
|
|
140
|
+
render only the example:
|
|
141
|
+
|
|
142
|
+
```vue
|
|
143
|
+
<script setup lang="ts">
|
|
144
|
+
definePageMeta({ layout: false })
|
|
145
|
+
const team = ref<string>()
|
|
146
|
+
</script>
|
|
147
|
+
|
|
148
|
+
<template>
|
|
149
|
+
<main class="p-6">
|
|
150
|
+
<SSelect v-model="team" :items="['Design', 'Engineering']" adaptive />
|
|
151
|
+
</main>
|
|
152
|
+
</template>
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Root-relative `src` paths automatically include the application's `baseURL`.
|
|
156
|
+
When generating a static site, add example routes to `nitro.prerender.routes`;
|
|
157
|
+
iframe URLs are not ordinary navigation links for the prerender crawler.
|
|
158
|
+
|
|
159
|
+
| Prop / model | Default | Purpose |
|
|
160
|
+
| --- | --- | --- |
|
|
161
|
+
| `src` | Required | URL of the example page. |
|
|
162
|
+
| `title` | `Responsive example` | Accessible preview label and iframe title. |
|
|
163
|
+
| `devices` | Desktop 1024px, tablet 768px, mobile 390px | Entries with `value`, `label`, `width`, and optional `icon`. Widths are CSS pixels. |
|
|
164
|
+
| `defaultDevice` | `mobile` | Initial selection; an unknown value falls back to the first device. |
|
|
165
|
+
| `v-model:device` | Uncontrolled | Read or control the selected device value. |
|
|
166
|
+
| `height` | `540` | Iframe height in CSS pixels. |
|
|
167
|
+
| `reloadKey` | Unset | Change this to reload the embedded page, for example after a theme change. |
|
|
168
|
+
|
|
169
|
+
The frame scrolls horizontally when the chosen viewport is wider than its
|
|
170
|
+
container. Changing devices preserves the embedded page's state; changing
|
|
171
|
+
`reloadKey` remounts it. The example page controls its own theme and providers.
|
|
172
|
+
An empty `devices` array uses the default devices.
|
|
173
|
+
|
|
174
|
+
`toolbar-start` and `toolbar-end` accept additional toolbar content and receive
|
|
175
|
+
`{ device }`. The `toolbar` slot replaces the entire toolbar and receives
|
|
176
|
+
`{ device, devices, selectDevice }`. Custom device entries can use the exported
|
|
177
|
+
`SelarasDocsViewportDevice` type from `@sewadah/selaras-docs`.
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { SelarasDocsViewportDevice } from '../../../types'
|
|
3
|
+
|
|
4
|
+
const props = withDefaults(defineProps<{
|
|
5
|
+
src: string
|
|
6
|
+
title?: string
|
|
7
|
+
devices?: readonly SelarasDocsViewportDevice[]
|
|
8
|
+
defaultDevice?: string
|
|
9
|
+
height?: number
|
|
10
|
+
reloadKey?: string | number
|
|
11
|
+
}>(), {
|
|
12
|
+
title: 'Responsive example',
|
|
13
|
+
defaultDevice: 'mobile',
|
|
14
|
+
height: 540,
|
|
15
|
+
})
|
|
16
|
+
const selected = defineModel<string>('device')
|
|
17
|
+
const defaultDevices: readonly SelarasDocsViewportDevice[] = [
|
|
18
|
+
{ value: 'desktop', label: 'Desktop', icon: 'hugeicons:computer', width: 1024 },
|
|
19
|
+
{ value: 'tablet', label: 'Tablet', icon: 'hugeicons:tablet-01', width: 768 },
|
|
20
|
+
{ value: 'mobile', label: 'Mobile', icon: 'hugeicons:smart-phone-01', width: 390 },
|
|
21
|
+
]
|
|
22
|
+
const devices = computed(() => props.devices?.length ? props.devices : defaultDevices)
|
|
23
|
+
const device = computed(() => devices.value.find(device => device.value === (selected.value ?? props.defaultDevice)) ?? devices.value[0]!)
|
|
24
|
+
function selectDevice(value: string) {
|
|
25
|
+
selected.value = value
|
|
26
|
+
}
|
|
27
|
+
const assetUrl = useDocsAssetUrl()
|
|
28
|
+
const previewUrl = computed(() => assetUrl(props.src))
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<template>
|
|
32
|
+
<section class="not-prose min-w-0" :aria-label="title">
|
|
33
|
+
<slot name="toolbar" :device="device" :devices="devices" :select-device="selectDevice">
|
|
34
|
+
<div class="mb-3 flex flex-wrap items-center justify-between gap-3">
|
|
35
|
+
<slot name="toolbar-start" :device="device">
|
|
36
|
+
<p class="text-sm text-[var(--selaras-resolved-text-muted)]" aria-live="polite">
|
|
37
|
+
{{ device.label }} ยท {{ device.width }}px
|
|
38
|
+
</p>
|
|
39
|
+
</slot>
|
|
40
|
+
<div class="flex items-center gap-2">
|
|
41
|
+
<div class="inline-flex gap-1 rounded-[var(--selaras-resolved-radius-md)] border border-[var(--selaras-resolved-border-default)] p-1" role="group" aria-label="Preview viewport">
|
|
42
|
+
<SButton
|
|
43
|
+
v-for="option in devices" :key="option.value"
|
|
44
|
+
:icon="option.icon" :aria-label="option.label" :aria-pressed="device.value === option.value"
|
|
45
|
+
:variant="device.value === option.value ? 'solid' : 'ghost'"
|
|
46
|
+
:color="device.value === option.value ? 'primary' : 'neutral'"
|
|
47
|
+
size="sm" :square="!!option.icon" @click="selectDevice(option.value)"
|
|
48
|
+
>
|
|
49
|
+
<template v-if="!option.icon">
|
|
50
|
+
{{ option.label }}
|
|
51
|
+
</template>
|
|
52
|
+
</SButton>
|
|
53
|
+
</div>
|
|
54
|
+
<slot name="toolbar-end" :device="device" />
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
</slot>
|
|
58
|
+
<div class="overflow-x-auto rounded-[var(--selaras-resolved-radius-md)] border border-[var(--selaras-resolved-border-default)] bg-[var(--selaras-resolved-surface-elevated)] p-3 sm:p-4">
|
|
59
|
+
<iframe
|
|
60
|
+
:key="reloadKey" :src="previewUrl"
|
|
61
|
+
:title="`${title} โ ${device.label}`"
|
|
62
|
+
:style="{ width: `${device.width}px`, height: `${height}px`, boxSizing: 'content-box' }"
|
|
63
|
+
class="mx-auto block max-w-none rounded-[var(--selaras-resolved-radius-md)] border border-[var(--selaras-resolved-border-default)] bg-[var(--selaras-resolved-surface-default)]"
|
|
64
|
+
/>
|
|
65
|
+
</div>
|
|
66
|
+
</section>
|
|
67
|
+
</template>
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sewadah/selaras-docs",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.2.0",
|
|
5
5
|
"description": "Nuxt Content documentation layer for Selaras",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@nuxt/content": "^3.16.0",
|
|
35
35
|
"@nuxt/kit": "^4.5.2",
|
|
36
|
-
"@sewadah/selaras": "^0.
|
|
36
|
+
"@sewadah/selaras": "^0.4.0",
|
|
37
37
|
"tailwindcss": "^4.3.0"
|
|
38
38
|
}
|
|
39
39
|
}
|
package/types.d.ts
CHANGED
|
@@ -128,3 +128,11 @@ declare module 'nuxt/schema' {
|
|
|
128
128
|
selarasDocs: SelarasDocsModuleOptions
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
|
+
|
|
132
|
+
/** A viewport offered by DocsViewportPreview. Width is measured in CSS pixels. */
|
|
133
|
+
export interface SelarasDocsViewportDevice {
|
|
134
|
+
value: string
|
|
135
|
+
label: string
|
|
136
|
+
width: number
|
|
137
|
+
icon?: string
|
|
138
|
+
}
|