nuxtseo-layer-devtools 0.4.5 → 0.5.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.
- package/components/DevtoolsChecklistBadge.vue +65 -0
- package/components/DevtoolsChecklistItem.vue +171 -0
- package/components/DevtoolsLayout.vue +91 -7
- package/components/DevtoolsModuleSplash.vue +270 -51
- package/components/DevtoolsPlaygrounds.vue +99 -0
- package/components/DevtoolsSetupChecklist.vue +60 -0
- package/components/DevtoolsTroubleshooting.vue +332 -0
- package/composables/checklist.ts +486 -0
- package/composables/modules.ts +48 -13
- package/composables/package-manager.ts +41 -0
- package/composables/update-check.ts +39 -0
- package/error.vue +1 -0
- package/package.json +3 -2
- package/skills/devtools-layer-skilld/SKILL.md +17 -8
- package/skills/devtools-layer-skilld/reference.md +70 -7
|
@@ -9,6 +9,14 @@ Shared Nuxt layer providing components, composables, and a design system for all
|
|
|
9
9
|
|
|
10
10
|
**Source:** `packages/devtools-layer/` (published as `nuxtseo-layer-devtools`)
|
|
11
11
|
|
|
12
|
+
## Available Libraries
|
|
13
|
+
|
|
14
|
+
The layer registers these Nuxt modules, so all consumers have them available without extra config:
|
|
15
|
+
|
|
16
|
+
- **`@nuxt/ui`** (v4): Full component library. Use `UButton`, `UBadge`, `UIcon`, `UInput`, `UTooltip`, `UApp`, etc. freely in devtools clients. Default variants configured via `app.config.ts` (primary: green, buttons: ghost/neutral/sm, badges: subtle/neutral/xs, tooltips: zero delay).
|
|
17
|
+
- **`@vueuse/nuxt`**: All VueUse composables auto imported.
|
|
18
|
+
- **Shiki**: Syntax highlighting via the layer's `loadShiki` / `useRenderCodeHighlight` composables.
|
|
19
|
+
|
|
12
20
|
## Architecture
|
|
13
21
|
|
|
14
22
|
1. **nuxtseo-shared/devtools** (`packages/shared/src/devtools.ts`): `setupDevToolsUI()` registers iframe tab, handles dev proxy + production sirv
|
|
@@ -20,13 +28,14 @@ Shared Nuxt layer providing components, composables, and a design system for all
|
|
|
20
28
|
1. ALWAYS extend `nuxtseo-layer-devtools` in client/nuxt.config.ts
|
|
21
29
|
2. ALWAYS create `client/composables/rpc.ts` that calls `useDevtoolsConnection()`
|
|
22
30
|
3. ALWAYS use layer components over custom HTML: `DevtoolsSection` not custom details, `DevtoolsKeyValue` not custom tables, `DevtoolsSnippet` not custom code blocks. Use `KeyValueItem.code` for inline code rendering instead of separate snippets
|
|
23
|
-
4.
|
|
24
|
-
5. NEVER
|
|
25
|
-
6.
|
|
26
|
-
7. ALWAYS
|
|
27
|
-
8. ALWAYS
|
|
28
|
-
9.
|
|
29
|
-
10.
|
|
31
|
+
4. ALWAYS use `@nuxt/ui` components (`UButton`, `UInput`, `UBadge`, `UIcon`, `UTooltip`, etc.) for interactive elements. Never add a custom button, input, badge, or tooltip when a Nuxt UI component exists.
|
|
32
|
+
5. NEVER add custom CSS that duplicates what the layer or Nuxt UI provides
|
|
33
|
+
6. NEVER enable SSR in the client (it runs in an iframe)
|
|
34
|
+
7. ALWAYS disable the module itself in the client nuxt config (e.g. `robots: false`)
|
|
35
|
+
8. ALWAYS guard devtools setup with `if (nuxt.options.dev)` in module.ts
|
|
36
|
+
9. ALWAYS use `useAsyncData` with `watch: [refreshTime]` for reactive data fetching
|
|
37
|
+
10. Use Carbon icons consistently (prefix: `carbon:`)
|
|
38
|
+
11. Debug server routes ONLY registered in dev mode
|
|
30
39
|
|
|
31
40
|
## Required File Structure
|
|
32
41
|
|
|
@@ -99,7 +108,7 @@ watch(data, () => {
|
|
|
99
108
|
</script>
|
|
100
109
|
|
|
101
110
|
<template>
|
|
102
|
-
<DevtoolsLayout v-model:active-tab="activeTab" title="Name" icon="carbon:icon" :nav-items="navItems" github-url="..." :loading @refresh="refreshSources">
|
|
111
|
+
<DevtoolsLayout v-model:active-tab="activeTab" title="Name" icon="carbon:icon" module-name="nuxt-<module>" :nav-items="navItems" github-url="..." :loading @refresh="refreshSources">
|
|
103
112
|
<DevtoolsLoading v-if="loading" />
|
|
104
113
|
<template v-else-if="activeTab === 'overview'">
|
|
105
114
|
<!-- content -->
|
|
@@ -1,16 +1,41 @@
|
|
|
1
1
|
# Devtools Layer API Reference
|
|
2
2
|
|
|
3
|
+
## Nuxt UI (available to all consumers)
|
|
4
|
+
|
|
5
|
+
The layer registers `@nuxt/ui` v4, so all Nuxt UI components are auto imported. Use them freely:
|
|
6
|
+
|
|
7
|
+
- `UButton`, `UInput`, `UTextarea`, `USelect`, `UCheckbox`, `UToggle`, `URadio`
|
|
8
|
+
- `UBadge`, `UIcon`, `UTooltip`, `UPopover`, `UModal`, `UDrawer`
|
|
9
|
+
- `UApp` (wraps the root, already used by `DevtoolsLayout`)
|
|
10
|
+
- `UCard`, `UAccordion`, `UTabs`, `UDropdownMenu`
|
|
11
|
+
|
|
12
|
+
Default variants via `app.config.ts`: primary green, neutral neutral. Buttons: ghost/neutral/sm. Badges: subtle/neutral/xs. Tooltips: zero delay.
|
|
13
|
+
|
|
14
|
+
Icons use the Iconify format. Convention: `carbon:*` prefix for consistency.
|
|
15
|
+
|
|
3
16
|
## Components (auto imported)
|
|
4
17
|
|
|
5
18
|
### Layout & Structure
|
|
6
19
|
|
|
7
20
|
| Component | Props | Key Slots | Purpose |
|
|
8
21
|
|---|---|---|---|
|
|
9
|
-
| `DevtoolsLayout` | `title`, `icon`, `version?`, `navItems`, `githubUrl`, `loading?` | `actions`, default | Main shell with header, tabs, refresh |
|
|
10
|
-
| `DevtoolsPanel` | `title?` | `header`, `actions`, default | Card container
|
|
22
|
+
| `DevtoolsLayout` | `title`, `icon`, `version?`, `moduleName?`, `npmPackage?`, `navItems: DevtoolsNavItem[]`, `githubUrl`, `loading?` | `actions`, default | Main shell with header, tabs, refresh, module splash, standalone mode, production mode. Pass `npmPackage` to enable update check indicator on version badge. |
|
|
23
|
+
| `DevtoolsPanel` | `title?`, `icon?`, `closable?` (false), `padding?` (true) | `header`, `actions`, default | Card container. Emits `close` when closable button clicked. |
|
|
11
24
|
| `DevtoolsToolbar` | `variant` ('default'\|'minimal') | default | Horizontal toolbar strip |
|
|
12
25
|
| `DevtoolsSection` | `icon?`, `text?`, `description?`, `collapse?`, `open?`, `padding?` | `text`, `description`, `actions`, `details`, default, `footer` | Collapsible details/summary block |
|
|
13
26
|
|
|
27
|
+
### DevtoolsNavItem Interface
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
interface DevtoolsNavItem {
|
|
31
|
+
value: string
|
|
32
|
+
to?: string // If set, renders as NuxtLink (route navigation)
|
|
33
|
+
icon: string
|
|
34
|
+
label: string
|
|
35
|
+
devOnly?: boolean // Hidden in production mode
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
14
39
|
### Feedback & States
|
|
15
40
|
|
|
16
41
|
| Component | Props | Key Slots | Purpose |
|
|
@@ -31,6 +56,16 @@
|
|
|
31
56
|
| `DevtoolsSnippet` | `label?`, `code`, `lang` ('js'\|'json'\|'xml') | `header` | Code block with header, copy, max 300px scroll |
|
|
32
57
|
| `OCodeBlock` | `code`, `lang`, `lines?`, `transformRendered?` | none | Shiki syntax highlighted pre |
|
|
33
58
|
| `DevtoolsDocs` | `url` | none | Full height iframe |
|
|
59
|
+
| `DevtoolsPlaygrounds` | `moduleName` | none | StackBlitz playground links with UTabs for variant selection. Reusable standalone or inside other components. Shows nothing if module has no playgrounds. |
|
|
60
|
+
| `DevtoolsTroubleshooting` | `moduleName`, `version?` | none | Guided troubleshooting section: clear .nuxt, debug mode, create repro (with playgrounds), report issue. Shows all installed module versions with copy for GitHub issues. |
|
|
61
|
+
|
|
62
|
+
### Module Navigation
|
|
63
|
+
|
|
64
|
+
| Component | Props | Key Slots | Purpose |
|
|
65
|
+
|---|---|---|---|
|
|
66
|
+
| `DevtoolsModuleSplash` | `currentModule?` | none | Modal overlay showing all Nuxt SEO modules with install status, switch between modules, Pro section |
|
|
67
|
+
| `DevtoolsStandaloneConnect` | none | none | Connection form for standalone mode (outside devtools iframe) |
|
|
68
|
+
| `NuxtSeoLogo` | none | none | Nuxt SEO brand logo SVG |
|
|
34
69
|
|
|
35
70
|
### KeyValueItem Interface
|
|
36
71
|
|
|
@@ -73,6 +108,11 @@ const host: ComputedRef<string>
|
|
|
73
108
|
const refreshSources: () => void // Debounced 200ms
|
|
74
109
|
const slowRefreshSources: () => void // Debounced 1000ms
|
|
75
110
|
|
|
111
|
+
// Standalone mode (running outside devtools iframe)
|
|
112
|
+
const standaloneUrl: Ref<string> // localStorage persisted
|
|
113
|
+
const isConnected: Ref<boolean>
|
|
114
|
+
const isStandalone: ComputedRef<boolean> // true when not connected but has standaloneUrl
|
|
115
|
+
|
|
76
116
|
// Production preview mode
|
|
77
117
|
const previewSource: Ref<'local' | 'production'> // localStorage persisted
|
|
78
118
|
const productionUrl: Ref<string>
|
|
@@ -80,6 +120,21 @@ const hasProductionUrl: ComputedRef<boolean>
|
|
|
80
120
|
const isProductionMode: ComputedRef<boolean>
|
|
81
121
|
```
|
|
82
122
|
|
|
123
|
+
### Modules (`composables/modules.ts`)
|
|
124
|
+
|
|
125
|
+
```ts
|
|
126
|
+
interface SeoModuleInfo { name: string, title: string, icon: string, route: string }
|
|
127
|
+
interface SeoModuleCatalogEntry extends SeoModuleInfo { description: string, installed: boolean, npm: string, pro?: boolean, playgrounds?: Record<string, string> }
|
|
128
|
+
|
|
129
|
+
const installedModules: Ref<SeoModuleInfo[]>
|
|
130
|
+
const showModuleSplash: Ref<boolean>
|
|
131
|
+
const moduleCatalog: ComputedRef<SeoModuleCatalogEntry[]>
|
|
132
|
+
|
|
133
|
+
function fetchInstalledModules(): void // Called by DevtoolsLayout automatically
|
|
134
|
+
function findModuleByName(moduleName: string): SeoModuleCatalogEntry | undefined // Look up module info by name
|
|
135
|
+
function switchToModule(moduleName: string): void // Navigate devtools iframe to another module
|
|
136
|
+
```
|
|
137
|
+
|
|
83
138
|
### Shiki (`composables/shiki.ts`)
|
|
84
139
|
|
|
85
140
|
```ts
|
|
@@ -93,9 +148,21 @@ function useRenderCodeHighlight(code: MaybeRef<string>, lang: string): ComputedR
|
|
|
93
148
|
function useCopy(timeout?: number): { copy: (text: string) => Promise<void>, copied: Ref<boolean> }
|
|
94
149
|
```
|
|
95
150
|
|
|
151
|
+
### Update Check (`composables/update-check.ts`)
|
|
152
|
+
|
|
153
|
+
```ts
|
|
154
|
+
function useModuleUpdate(npmPackage: string | undefined, currentVersion: string | undefined): {
|
|
155
|
+
hasUpdate: ComputedRef<boolean>
|
|
156
|
+
latestVersion: ComputedRef<string | undefined>
|
|
157
|
+
info: ComputedRef<ModuleUpdateInfo | undefined>
|
|
158
|
+
}
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
Fetches latest version from npm registry. Results are cached per package name. Already integrated into `DevtoolsLayout` when `npmPackage` prop is provided.
|
|
162
|
+
|
|
96
163
|
## CSS Design System
|
|
97
164
|
|
|
98
|
-
Do NOT add custom CSS unless layer components are insufficient.
|
|
165
|
+
Do NOT add custom CSS unless layer components or Nuxt UI are insufficient.
|
|
99
166
|
|
|
100
167
|
### Semantic Variables
|
|
101
168
|
|
|
@@ -105,10 +172,6 @@ Do NOT add custom CSS unless layer components are insufficient.
|
|
|
105
172
|
|
|
106
173
|
`.glass` (backdrop blur), `.gradient-bg` (green/blue radials), `.card` (elevated hover), `.code-block`, `.status-enabled/.status-disabled`, `.link-external` (with arrow), `.hint-callout`, `.panel-grids`, `.animate-fade-up/.scale-in/.spin`, `.stagger-children`, `.devtools-main-content` (max-width 80rem centered container)
|
|
107
174
|
|
|
108
|
-
### Nuxt UI Defaults (app.config.ts)
|
|
109
|
-
|
|
110
|
-
Primary: green, Neutral: neutral. Buttons: ghost/neutral/sm. Badges: subtle/neutral/xs. Tooltips: zero delay.
|
|
111
|
-
|
|
112
175
|
## Common Patterns
|
|
113
176
|
|
|
114
177
|
### Production Mode Data Fetching
|