@maltjoy/mcp-server 0.4.0 → 0.6.0-beta.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/LICENSE +21 -0
- package/README.md +30 -3
- package/dist/doc/VJoyAdminBanner/guideline.md +284 -0
- package/dist/doc/VJoyAvailability/guideline.md +352 -0
- package/dist/doc/VJoyAvatar/guideline.md +192 -0
- package/dist/doc/VJoyAvatarsList/guideline.md +328 -0
- package/dist/doc/VJoyBadge/guideline.md +169 -0
- package/dist/doc/VJoyBadgeLevel/guideline.md +166 -0
- package/dist/doc/VJoyBlockSkeleton/guideline.md +150 -0
- package/dist/doc/VJoyBottomSheet/guideline.md +345 -0
- package/dist/doc/VJoyBottomSheetTrigger/guideline.md +156 -0
- package/dist/doc/VJoyButton/guideline.md +371 -0
- package/dist/doc/VJoyButton/metadata.json +0 -16
- package/dist/doc/VJoyButtonCard/guideline.md +384 -0
- package/dist/doc/VJoyCheckbox/guideline.md +317 -0
- package/dist/doc/VJoyCheckboxCard/guideline.md +381 -0
- package/dist/doc/VJoyCheckboxGroup/guideline.md +363 -0
- package/dist/doc/VJoyCheckboxGroup/metadata.json +7 -7
- package/dist/doc/VJoyCollapse/guideline.md +362 -0
- package/dist/doc/VJoyCollapseItem/guideline.md +394 -0
- package/dist/doc/VJoyCompanyAvatar/guideline.md +162 -0
- package/dist/doc/VJoyDialog/guideline.md +425 -0
- package/dist/doc/VJoyDialogTrigger/guideline.md +186 -0
- package/dist/doc/VJoyDot/guideline.md +177 -0
- package/dist/doc/VJoyDrawer/guideline.md +392 -0
- package/dist/doc/VJoyDrawerTrigger/guideline.md +145 -0
- package/dist/doc/VJoyDropdown/guideline.md +393 -0
- package/dist/doc/VJoyDropdown/metadata.json +6 -6
- package/dist/doc/VJoyDropdownList/guideline.md +396 -0
- package/dist/doc/VJoyDropdownList/metadata.json +7 -7
- package/dist/doc/VJoyDropzone/guideline.md +390 -0
- package/dist/doc/VJoyDropzone/metadata.json +36 -1
- package/dist/doc/VJoyFilterBar/guideline.md +419 -0
- package/dist/doc/VJoyFilterBarButton/guideline.md +359 -0
- package/dist/doc/VJoyFloatingActionsBar/guideline.md +372 -0
- package/dist/doc/VJoyFormError/guideline.md +325 -0
- package/dist/doc/VJoyFormError/metadata.json +0 -14
- package/dist/doc/VJoyFormFieldSkeleton/guideline.md +159 -0
- package/dist/doc/VJoyFormGroup/guideline.md +285 -0
- package/dist/doc/VJoyFunnel/guideline.md +349 -0
- package/dist/doc/VJoyFunnelFooter/guideline.md +178 -0
- package/dist/doc/VJoyFunnelHeader/guideline.md +204 -0
- package/dist/doc/VJoyHighlight/guideline.md +169 -0
- package/dist/doc/VJoyIcon/JoyIcon.types.ts +1 -1
- package/dist/doc/VJoyIcon/guideline.md +168 -0
- package/dist/doc/VJoyIcon/metadata.json +0 -1
- package/dist/doc/VJoyIconButton/guideline.md +169 -0
- package/dist/doc/VJoyIconButton/metadata.json +1 -1
- package/dist/doc/VJoyIndicator/guideline.md +168 -0
- package/dist/doc/VJoyIndicators/guideline.md +183 -0
- package/dist/doc/VJoyInput/JoyInput.types.ts +1 -6
- package/dist/doc/VJoyInput/guideline.md +401 -0
- package/dist/doc/VJoyInput/metadata.json +5 -14
- package/dist/doc/VJoyInputDigit/guideline.md +381 -0
- package/dist/doc/VJoyInputNumber/guideline.md +414 -0
- package/dist/doc/VJoyInputNumber/metadata.json +22 -17
- package/dist/doc/VJoyInputPassword/guideline.md +379 -0
- package/dist/doc/VJoyInputPassword/metadata.json +0 -14
- package/dist/doc/VJoyLabel/guideline.md +200 -0
- package/dist/doc/VJoyLink/guideline.md +360 -0
- package/dist/doc/VJoyListItem/guideline.md +335 -0
- package/dist/doc/VJoyMenu/guideline.md +304 -0
- package/dist/doc/VJoyMenu/metadata.json +21 -21
- package/dist/doc/VJoyMenuItem/guideline.md +352 -0
- package/dist/doc/VJoyPagination/guideline.md +355 -0
- package/dist/doc/VJoyPanel/guideline.md +238 -0
- package/dist/doc/VJoyPanelSection/guideline.md +160 -0
- package/dist/doc/VJoyPasswordRequirement/guideline.md +336 -0
- package/dist/doc/VJoyPasswordRequirement/metadata.json +1 -1
- package/dist/doc/VJoyProductTour/JoyProductTour.types.ts +0 -1
- package/dist/doc/VJoyProductTour/guideline.md +455 -0
- package/dist/doc/VJoyProductTour/metadata.json +1 -1
- package/dist/doc/VJoyProductTourTrigger/guideline.md +167 -0
- package/dist/doc/VJoyProgressBar/guideline.md +348 -0
- package/dist/doc/VJoyRadio/guideline.md +346 -0
- package/dist/doc/VJoyRadioGroup/guideline.md +331 -0
- package/dist/doc/VJoyRatingStars/guideline.md +306 -0
- package/dist/doc/VJoyScreenLoader/guideline.md +172 -0
- package/dist/doc/VJoySelect/guideline.md +396 -0
- package/dist/doc/VJoySelectableItem/guideline.md +351 -0
- package/dist/doc/VJoySelectableItemGroup/guideline.md +370 -0
- package/dist/doc/VJoySeparator/guideline.md +161 -0
- package/dist/doc/VJoySnackbar/guideline.md +402 -0
- package/dist/doc/VJoySpinner/guideline.md +168 -0
- package/dist/doc/VJoyStep/guideline.md +182 -0
- package/dist/doc/VJoyStepper/guideline.md +390 -0
- package/dist/doc/VJoyTab/guideline.md +298 -0
- package/dist/doc/VJoyTabs/guideline.md +353 -0
- package/dist/doc/VJoyTag/guideline.md +226 -0
- package/dist/doc/VJoyTagsInput/guideline.md +387 -0
- package/dist/doc/VJoyTagsList/guideline.md +311 -0
- package/dist/doc/VJoyTagsList/metadata.json +27 -27
- package/dist/doc/VJoyTemplate/guideline.md +366 -0
- package/dist/doc/VJoyText/guideline.md +175 -0
- package/dist/doc/VJoyText/metadata.json +1 -1
- package/dist/doc/VJoyTextarea/guideline.md +378 -0
- package/dist/doc/VJoyTitleBrand/guideline.md +155 -0
- package/dist/doc/VJoyToggle/guideline.md +327 -0
- package/dist/doc/VJoyTooltip/guideline.md +322 -0
- package/dist/doc/VJoyUserCard/guideline.md +268 -0
- package/dist/doc/VJoyUserCard/metadata.json +3 -17
- package/dist/doc/VJoyWalkthrough/guideline.md +351 -0
- package/dist/doc/VJoyWalkthroughTrigger/guideline.md +171 -0
- package/dist/doc/VJoyWrapper/guideline.md +173 -0
- package/dist/doc/css-classes.json +1 -15
- package/dist/doc/design-tokens.json +1 -0
- package/dist/doc/index.json +20 -30
- package/dist/index.js +22 -2
- package/dist/index.js.map +1 -1
- package/dist/tools/get-component-guideline.d.ts +30 -0
- package/dist/tools/get-component-guideline.d.ts.map +1 -0
- package/dist/tools/get-component-guideline.js +51 -0
- package/dist/tools/get-component-guideline.js.map +1 -0
- package/dist/tools/get-documentation-page.d.ts +22 -0
- package/dist/tools/get-documentation-page.d.ts.map +1 -0
- package/dist/tools/get-documentation-page.js +21 -0
- package/dist/tools/get-documentation-page.js.map +1 -0
- package/dist/tools/list-documentation-pages.d.ts +22 -0
- package/dist/tools/list-documentation-pages.d.ts.map +1 -0
- package/dist/tools/list-documentation-pages.js +17 -0
- package/dist/tools/list-documentation-pages.js.map +1 -0
- package/dist/tools/search-documentation.d.ts +41 -0
- package/dist/tools/search-documentation.d.ts.map +1 -0
- package/dist/tools/search-documentation.js +25 -0
- package/dist/tools/search-documentation.js.map +1 -0
- package/dist/zeroheight-parser.d.ts +27 -0
- package/dist/zeroheight-parser.d.ts.map +1 -0
- package/dist/zeroheight-parser.js +77 -0
- package/dist/zeroheight-parser.js.map +1 -0
- package/package.json +10 -10
- package/dist/doc/VJoyMultiCheckbox/metadata.json +0 -332
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 maltcommunity / apps
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -6,6 +6,7 @@ MCP (Model Context Protocol) server for the Joy Design System. This server expos
|
|
|
6
6
|
|
|
7
7
|
- 🔍 List all available Joy Vue3 components with descriptions
|
|
8
8
|
- 📚 Access component documentation (props, events, slots, exposed members)
|
|
9
|
+
- 🧭 Retrieve DSDS usage guidelines (when to use, best practices, a11y, agent rules)
|
|
9
10
|
- 🏷️ Retrieve TypeScript types definitions for component props (variants, sizes, etc.)
|
|
10
11
|
- 🎨 List 132 design tokens (colors, spacing, typography, etc.)
|
|
11
12
|
- 💅 List 272 CSS utility classes
|
|
@@ -111,7 +112,31 @@ Retrieves detailed information about a specific Joy Vue3 component including pro
|
|
|
111
112
|
}
|
|
112
113
|
```
|
|
113
114
|
|
|
114
|
-
### 3. `
|
|
115
|
+
### 3. `joy_get_component_guideline`
|
|
116
|
+
|
|
117
|
+
Retrieves the DSDS usage guideline Markdown for a Joy Vue3 component (when to use / not use, anatomy, variants, best practices, accessibility, examples, agent rules).
|
|
118
|
+
|
|
119
|
+
**Parameters:**
|
|
120
|
+
- `componentName` (string, required): The exact name of the component (e.g., "VJoyButton", "VJoyInput")
|
|
121
|
+
|
|
122
|
+
**Returns:**
|
|
123
|
+
```json
|
|
124
|
+
{
|
|
125
|
+
"componentName": "VJoyButton",
|
|
126
|
+
"format": "markdown",
|
|
127
|
+
"source": "DSDS.guideline.md",
|
|
128
|
+
"content": "---\ncomponent: VJoyButton\n..."
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
**Error Response:**
|
|
133
|
+
```json
|
|
134
|
+
{
|
|
135
|
+
"error": "No DSDS guideline found for component \"VJoyNonExistent\". Use joy_list_components to get a list of available components, or joy_get_component_info for the API surface."
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### 4. `joy_get_component_types`
|
|
115
140
|
|
|
116
141
|
Retrieves the TypeScript types definition files associated with a specific Joy Vue3 component. These types define the allowed values for props (variants, sizes, etc.).
|
|
117
142
|
|
|
@@ -138,7 +163,7 @@ Retrieves the TypeScript types definition files associated with a specific Joy V
|
|
|
138
163
|
}
|
|
139
164
|
```
|
|
140
165
|
|
|
141
|
-
###
|
|
166
|
+
### 5. `joy_list_design_tokens`
|
|
142
167
|
|
|
143
168
|
|
|
144
169
|
Lists all available Joy design tokens (CSS custom properties) organized by domain.
|
|
@@ -159,7 +184,7 @@ Lists all available Joy design tokens (CSS custom properties) organized by domai
|
|
|
159
184
|
}
|
|
160
185
|
```
|
|
161
186
|
|
|
162
|
-
###
|
|
187
|
+
### 6. `joy_list_css_classes`
|
|
163
188
|
|
|
164
189
|
Lists all available Joy CSS utility classes organized by domain.
|
|
165
190
|
|
|
@@ -222,6 +247,7 @@ joy-mcp-server/
|
|
|
222
247
|
│ └── tools/
|
|
223
248
|
│ ├── list-components.ts # Component listing tool
|
|
224
249
|
│ ├── get-component-info.ts # Component info retrieval tool
|
|
250
|
+
│ ├── get-component-guideline.ts # DSDS guideline markdown tool
|
|
225
251
|
│ ├── get-component-types.ts # Component types retrieval tool
|
|
226
252
|
│ ├── list-design-tokens.ts # Design tokens tool
|
|
227
253
|
│ └── list-css-classes.ts # CSS classes tool
|
|
@@ -232,6 +258,7 @@ joy-mcp-server/
|
|
|
232
258
|
│ ├── css-classes.json # All CSS classes
|
|
233
259
|
│ └── VJoy*/ # Component directories
|
|
234
260
|
│ ├── metadata.json # Component metadata
|
|
261
|
+
│ ├── guideline.md # DSDS usage guideline (when present)
|
|
235
262
|
│ └── *.types.ts # Component TypeScript types
|
|
236
263
|
├── package.json
|
|
237
264
|
├── tsconfig.json
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
---
|
|
2
|
+
component: VJoyAdminBanner
|
|
3
|
+
status: draft
|
|
4
|
+
language: en
|
|
5
|
+
dsds: JoyAdminBanner.dsds.json
|
|
6
|
+
dsdsVersion: "0.15.2"
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Admin banner
|
|
10
|
+
|
|
11
|
+
Use **`VJoyAdminBanner`** when an internal admin or support user is viewing the product **as another user** — to make that elevated context unmistakable at the top of the interface.
|
|
12
|
+
|
|
13
|
+
The banner is a sticky, non-interactive strip with a fixed eye icon and a short label (default **Admin view**). Customize copy with the `label` prop for locale or more specific context (for example impersonation target).
|
|
14
|
+
|
|
15
|
+
| | |
|
|
16
|
+
| --- | --- |
|
|
17
|
+
| **Code** | `VJoyAdminBanner` from `@maltjoy/core-vue` |
|
|
18
|
+
| **Design** | [ZeroHeight — Admin banner](https://zeroheight.com/6bf479565/) (page id `6968477`) |
|
|
19
|
+
| **Storybook** | [VJoyAdminBanner docs](https://doc.malt.tech/joy-storybook/?path=/docs/components-admin-vjoyadminbanner--docs) |
|
|
20
|
+
| **DSDS (machine)** | [`JoyAdminBanner.dsds.json`](./JoyAdminBanner.dsds.json) |
|
|
21
|
+
| **Live API** | `joy_get_component_info("VJoyAdminBanner")` |
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## When to use this component
|
|
26
|
+
|
|
27
|
+
Show the admin banner whenever someone with elevated privileges is browsing **on behalf of** or **in the context of** another account — impersonation flows, internal support consoles, or admin previews of a user’s workspace.
|
|
28
|
+
|
|
29
|
+
Place it at the **top of the viewport** (first meaningful content in the layout shell) so it stays visible while scrolling. The component uses `position: sticky` and `top: 0` — parent layouts should not clip overflow in a way that hides the strip.
|
|
30
|
+
|
|
31
|
+
### When not to use this component
|
|
32
|
+
|
|
33
|
+
| Need | Use instead |
|
|
34
|
+
| --- | --- |
|
|
35
|
+
| A customer-facing status or alert | `VJoyHighlight` |
|
|
36
|
+
| Transient feedback after an action | `pushVJoySnackbar` |
|
|
37
|
+
| A dismissible warning the user must acknowledge | `VJoyDialog` or `VJoyHighlight` |
|
|
38
|
+
| An actionable admin CTA (exit impersonation, switch user) | `VJoyButton` (`variant="admin"`) in the page header or toolbar — not inside the banner |
|
|
39
|
+
| A binary admin on/off control in a form | `VJoyToggle` (`variant="admin"`) |
|
|
40
|
+
| Custom top-of-page markup with ad-hoc colors | Still use `VJoyAdminBanner` + Joy tokens — don't reinvent admin chrome |
|
|
41
|
+
|
|
42
|
+
> **Internal only:** like `VJoyButton` `variant="admin"` and `VJoyToggle` `variant="admin"`, this component is for **admin / internal tooling**. Do not ship it on customer-facing product surfaces.
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## How it works
|
|
47
|
+
|
|
48
|
+
### Anatomy
|
|
49
|
+
|
|
50
|
+
| Part | Required? | What it is |
|
|
51
|
+
| --- | --- | --- |
|
|
52
|
+
| Banner container | Yes | Root `.joy-admin-banner` — full-width sticky host |
|
|
53
|
+
| Top accent bar | Yes | 5px `border-top` in `--joy-color-quaternary-50` |
|
|
54
|
+
| Label chip | Yes | Centered `.joy-admin-banner__label` with quaternary background and bottom rounded corners |
|
|
55
|
+
| Eye icon | Yes | `VJoyIcon` with `name="eye"` — fixed; not configurable |
|
|
56
|
+
| Label text | Yes | `label` prop (default slot not supported) |
|
|
57
|
+
|
|
58
|
+
The banner is **presentational**: no click handlers, no slots, no events. Actions (exit admin mode, open support tools) belong elsewhere in the layout.
|
|
59
|
+
|
|
60
|
+
### Default values
|
|
61
|
+
|
|
62
|
+
- `label` defaults to **`Admin view`**
|
|
63
|
+
|
|
64
|
+
Props: use Joy MCP or Storybook — this page focuses on **when** and **how**, not a full API dump.
|
|
65
|
+
|
|
66
|
+
### Layout and tokens
|
|
67
|
+
|
|
68
|
+
There is **no `variant` or `size` prop**. Visual treatment is fixed:
|
|
69
|
+
|
|
70
|
+
| Constraint | Value (implementation) |
|
|
71
|
+
| --- | --- |
|
|
72
|
+
| Position | `sticky`, `top: 0`, centered text |
|
|
73
|
+
| Z-index | `var(--joy-core-z-index-dropdown)` |
|
|
74
|
+
| Label typography | `joy-font-primary-350` |
|
|
75
|
+
| Label colors | Text `--joy-color-text-body`; background/border `--joy-color-quaternary-50` |
|
|
76
|
+
| Label shape | Bottom corners `var(--joy-core-radius-3)` |
|
|
77
|
+
| Icon gap | `var(--joy-core-spacing-1)` |
|
|
78
|
+
| Label padding | `0 var(--joy-core-spacing-2) var(--joy-core-spacing-1)` |
|
|
79
|
+
|
|
80
|
+
**Do not** hardcode quaternary hex values or pixel heights in product CSS — the component owns admin banner chrome.
|
|
81
|
+
|
|
82
|
+
### Not in the API
|
|
83
|
+
|
|
84
|
+
- **Custom icon** — always `eye`. Do not swap icons via slots or CSS.
|
|
85
|
+
- **`variant` / `size`** — single visual treatment only.
|
|
86
|
+
- **Slots or events** — label is the only configurable copy surface.
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## States
|
|
91
|
+
|
|
92
|
+
| State | What the user sees / can do |
|
|
93
|
+
| --- | --- |
|
|
94
|
+
| Visible (default) | Centered label chip with eye icon; full-width quaternary top border |
|
|
95
|
+
| Scrolling | Banner remains pinned to the top of the viewport (`sticky`) |
|
|
96
|
+
| Custom label | Same layout; `label` text updates only |
|
|
97
|
+
|
|
98
|
+
There are no hover, focus, disabled, or loading states — the control is not interactive.
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## Best practices
|
|
103
|
+
|
|
104
|
+
Rules use RFC 2119 strength (**MUST** / **SHOULD** / **MUST NOT** / **SHOULD NOT**).
|
|
105
|
+
|
|
106
|
+
### Placement and scope
|
|
107
|
+
|
|
108
|
+
- **MUST** render the banner only in **admin / internal** contexts (impersonation, support tools, internal previews).
|
|
109
|
+
- **MUST NOT** show the banner on standard customer journeys.
|
|
110
|
+
- **SHOULD** place it as the first visible element in the app shell when admin mode is active.
|
|
111
|
+
- **SHOULD** keep admin actions (exit impersonation, return to admin home) in the header or toolbar — not inside the banner.
|
|
112
|
+
|
|
113
|
+
### Implementation
|
|
114
|
+
|
|
115
|
+
- **MUST** use `VJoyAdminBanner` — no custom admin strips with quaternary styling.
|
|
116
|
+
- **MUST** use only the documented `label` prop from MCP / `AdminBannerProps`.
|
|
117
|
+
- **MUST** use Joy tokens — no custom `.joy-admin-banner` chrome CSS.
|
|
118
|
+
- **MUST NOT** invent props (`variant`, `icon`, `sticky`, `color`, …).
|
|
119
|
+
- **MUST NOT** wrap the banner in another sticky container that fights `top: 0`.
|
|
120
|
+
- **SHOULD** conditionally mount the banner when admin mode is detected (v-if), rather than hiding it with CSS only.
|
|
121
|
+
|
|
122
|
+
### Do / don't
|
|
123
|
+
|
|
124
|
+
| Do | Don't |
|
|
125
|
+
| --- | --- |
|
|
126
|
+
| `label="Admin view"` or localized equivalent | Long paragraphs inside `label` |
|
|
127
|
+
| Mount at layout root when impersonating | Banner buried mid-page |
|
|
128
|
+
| Pair with clear exit-admin affordances elsewhere | Clickable banner pretending to be a button |
|
|
129
|
+
| Quaternary admin chrome from Joy | Custom purple/orange “admin” colors |
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## Content
|
|
134
|
+
|
|
135
|
+
The banner carries a single line of status copy. It should name the **viewing context**, not explain policy.
|
|
136
|
+
|
|
137
|
+
### Label formula
|
|
138
|
+
|
|
139
|
+
**Context + mode** — short and scannable:
|
|
140
|
+
|
|
141
|
+
- ✅ Admin view
|
|
142
|
+
- ✅ Viewing as Jane Doe
|
|
143
|
+
- ✅ Support preview
|
|
144
|
+
- ❌ You are currently in admin mode. Please be careful.
|
|
145
|
+
- ❌ Impersonation active — all actions are logged
|
|
146
|
+
|
|
147
|
+
### Writing rules
|
|
148
|
+
|
|
149
|
+
| Strength | Rule |
|
|
150
|
+
| --- | --- |
|
|
151
|
+
| **MUST** | Keep `label` to a few words (ideally ≤ 25 characters) |
|
|
152
|
+
| **MUST** | State the mode or impersonation target — not instructions |
|
|
153
|
+
| **MUST NOT** | Use the banner for legal disclaimers or multi-sentence warnings |
|
|
154
|
+
| **SHOULD** | Use sentence case |
|
|
155
|
+
| **SHOULD** | Localize via the `label` prop (default English string is `Admin view`) |
|
|
156
|
+
| **SHOULD** | Match terminology used in admin entry flows (“Admin view”, “Viewing as …”) |
|
|
157
|
+
|
|
158
|
+
### Patterns
|
|
159
|
+
|
|
160
|
+
**Default impersonation** — omit `label` or pass `label="Admin view"`.
|
|
161
|
+
|
|
162
|
+
**Named impersonation** — `label="Viewing as {displayName}"` when the support agent needs to see whose account is open.
|
|
163
|
+
|
|
164
|
+
**Internal preview** — `label="Support preview"` when the session is read-only preview rather than full impersonation.
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## Accessibility
|
|
169
|
+
|
|
170
|
+
Behaviors (what must happen), not slogans.
|
|
171
|
+
|
|
172
|
+
| Behavior | Expectation |
|
|
173
|
+
| --- | --- |
|
|
174
|
+
| Role | Static text in a `div` — not a button or link |
|
|
175
|
+
| Name | Meaning comes from visible `label` text |
|
|
176
|
+
| Icon | Eye icon is decorative; meaning must not rely on the icon alone |
|
|
177
|
+
| Keyboard | No focusable elements inside the banner |
|
|
178
|
+
| Motion | No enter/exit animation — appears with the admin shell |
|
|
179
|
+
| Sticky | Pinning must not obscure focusable page content without scroll margin; ensure the main landmark still receives focus in logical order |
|
|
180
|
+
|
|
181
|
+
When admin mode activates, **SHOULD** announce the context change at the page level (for example a page title update or a single `aria-live` region in the layout) — the banner alone does not emit live-region events.
|
|
182
|
+
|
|
183
|
+
Target: **WCAG 2.2 AA** where the product requires it.
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
## Examples
|
|
188
|
+
|
|
189
|
+
```vue
|
|
190
|
+
<script setup lang="ts">
|
|
191
|
+
import { VJoyAdminBanner } from '@maltjoy/core-vue'
|
|
192
|
+
|
|
193
|
+
const isAdminView = true
|
|
194
|
+
const impersonatedUser = 'Jane Doe'
|
|
195
|
+
</script>
|
|
196
|
+
|
|
197
|
+
<template>
|
|
198
|
+
<!-- Default label -->
|
|
199
|
+
<VJoyAdminBanner v-if="isAdminView" />
|
|
200
|
+
|
|
201
|
+
<!-- Named impersonation -->
|
|
202
|
+
<VJoyAdminBanner
|
|
203
|
+
v-if="isAdminView && impersonatedUser"
|
|
204
|
+
:label="`Viewing as ${impersonatedUser}`"
|
|
205
|
+
/>
|
|
206
|
+
</template>
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
Typical layout shell:
|
|
210
|
+
|
|
211
|
+
```vue
|
|
212
|
+
<template>
|
|
213
|
+
<div class="app-shell">
|
|
214
|
+
<VJoyAdminBanner v-if="session.isImpersonating" :label="adminBannerLabel" />
|
|
215
|
+
</div>
|
|
216
|
+
</template>
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
In Nuxt (or apps with auto-import), omit the import if `VJoyAdminBanner` is already global.
|
|
220
|
+
|
|
221
|
+
---
|
|
222
|
+
|
|
223
|
+
## Related
|
|
224
|
+
|
|
225
|
+
| Component | Use when |
|
|
226
|
+
| --- | --- |
|
|
227
|
+
| `VJoyButton` (`variant="admin"`) | Admin-styled actions in toolbars or forms |
|
|
228
|
+
| `VJoyToggle` (`variant="admin"`) | Binary admin preference with eye icon affordance |
|
|
229
|
+
| `VJoyHighlight` | Persistent inline warnings or info on the page body |
|
|
230
|
+
| `VJoyTemplate` | Page shell where the banner is mounted at the top |
|
|
231
|
+
| `VJoyIcon` | Standalone eye icon — not a substitute for this banner |
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
## For agents
|
|
236
|
+
|
|
237
|
+
Optional for readers; **required** for vibe-coding quality. Maps to `agentDocumentBlocks` in [`JoyAdminBanner.dsds.json`](./JoyAdminBanner.dsds.json).
|
|
238
|
+
|
|
239
|
+
### Pick the right component
|
|
240
|
+
|
|
241
|
+
| If the intent is… | Emit… | Do not emit… |
|
|
242
|
+
| --- | --- | --- |
|
|
243
|
+
| Sticky admin / impersonation context at top | `<VJoyAdminBanner />` | Custom `div` with quaternary styling |
|
|
244
|
+
| Customer-facing alert | `VJoyHighlight` | `VJoyAdminBanner` |
|
|
245
|
+
| Toast after save | `pushVJoySnackbar` | `VJoyAdminBanner` |
|
|
246
|
+
| Exit impersonation button | `VJoyButton variant="admin"` | Clickable banner |
|
|
247
|
+
| Admin toggle in settings | `VJoyToggle variant="admin"` | `VJoyAdminBanner` |
|
|
248
|
+
|
|
249
|
+
### Hard rules
|
|
250
|
+
|
|
251
|
+
1. **MUST** call MCP (or read `AdminBannerProps`) before generating props.
|
|
252
|
+
2. **MUST** use `VJoyAdminBanner` only in admin / internal impersonation UIs.
|
|
253
|
+
3. **MUST NOT** invent props (`variant`, `icon`, `size`, slots, events).
|
|
254
|
+
4. **MUST NOT** override `.joy-admin-banner` colors, padding, radius, or sticky behavior in app CSS.
|
|
255
|
+
5. **MUST NOT** place on customer-facing routes.
|
|
256
|
+
6. **SHOULD** mount once at the layout root when admin mode is active.
|
|
257
|
+
7. **SHOULD** keep `label` short; localize via the prop.
|
|
258
|
+
|
|
259
|
+
### Checklist
|
|
260
|
+
|
|
261
|
+
- [ ] Correct component (`VJoyAdminBanner` or named alternative)
|
|
262
|
+
- [ ] Admin / internal context only
|
|
263
|
+
- [ ] `label` from prop only (no slots)
|
|
264
|
+
- [ ] No invented props / no custom banner chrome CSS
|
|
265
|
+
- [ ] Banner at top of shell; not mid-page
|
|
266
|
+
- [ ] Exit / admin actions live outside the banner
|
|
267
|
+
- [ ] Label ≤ ~25 characters; names viewing context
|
|
268
|
+
|
|
269
|
+
---
|
|
270
|
+
|
|
271
|
+
## DSDS mapping
|
|
272
|
+
|
|
273
|
+
This Markdown mirrors [`JoyAdminBanner.dsds.json`](./JoyAdminBanner.dsds.json) (DSDS **0.15.2**).
|
|
274
|
+
|
|
275
|
+
| Section here | DSDS block |
|
|
276
|
+
| --- | --- |
|
|
277
|
+
| When to use / not | `use-cases` |
|
|
278
|
+
| Anatomy / layout tokens | `anatomy` + `design-specifications` |
|
|
279
|
+
| States | `states` |
|
|
280
|
+
| Best practices / content rules | `guidelines` (+ `content`) |
|
|
281
|
+
| Accessibility | `accessibility` |
|
|
282
|
+
| Examples | `sections` |
|
|
283
|
+
| For agents | `agentDocumentBlocks` |
|
|
284
|
+
| Props detail | `api` in JSON + Joy MCP |
|