@ghostvue/mcp 0.1.0 → 0.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.
Files changed (152) hide show
  1. package/dist/assets/bundle.json +2 -2
  2. package/dist/assets/component-exports.json +1 -0
  3. package/dist/assets/docs/pages.json +1 -1
  4. package/dist/assets/examples/catalog.json +1 -1
  5. package/dist/assets/examples/sources/accordion/billing-faq.vue +123 -0
  6. package/dist/assets/examples/sources/avatar/team-roster.vue +69 -5
  7. package/dist/assets/examples/sources/badge/release-channels.vue +1 -1
  8. package/dist/assets/examples/sources/breadcrumb/basic.vue +60 -15
  9. package/dist/assets/examples/sources/button/refresh-status.vue +95 -0
  10. package/dist/assets/examples/sources/calendar/availability.vue +235 -0
  11. package/dist/assets/examples/sources/calendar/office-locale.vue +197 -0
  12. package/dist/assets/examples/sources/card/project-summary.vue +38 -3
  13. package/dist/assets/examples/sources/checkbox-group/basic.vue +56 -0
  14. package/dist/assets/examples/sources/checkbox-group/field.vue +73 -0
  15. package/dist/assets/examples/sources/checkbox-group/form.vue +100 -0
  16. package/dist/assets/examples/sources/checkbox-group/headless.vue +68 -0
  17. package/dist/assets/examples/sources/checkbox-group/notification-preferences.vue +380 -0
  18. package/dist/assets/examples/sources/collapsible/shipment-history.vue +135 -0
  19. package/dist/assets/examples/sources/combobox/review-request-form.vue +415 -0
  20. package/dist/assets/examples/sources/command-palette/async.vue +60 -12
  21. package/dist/assets/examples/sources/command-palette/basic.vue +123 -2
  22. package/dist/assets/examples/sources/command-palette/shortcut.vue +132 -5
  23. package/dist/assets/examples/sources/command-palette/themed.vue +44 -4
  24. package/dist/assets/examples/sources/command-palette/virtualized.vue +124 -3
  25. package/dist/assets/examples/sources/context-menu/themed.vue +81 -26
  26. package/dist/assets/examples/sources/data-table/themed-invoices.vue +219 -44
  27. package/dist/assets/examples/sources/date-picker/controlled.vue +8 -293
  28. package/dist/assets/examples/sources/date-picker/custom-format.vue +6 -295
  29. package/dist/assets/examples/sources/date-picker/nested-dialog.vue +28 -350
  30. package/dist/assets/examples/sources/date-picker/rtl.vue +5 -294
  31. package/dist/assets/examples/sources/date-picker/themed.vue +2 -2
  32. package/dist/assets/examples/sources/date-picker/validation.vue +8 -294
  33. package/dist/assets/examples/sources/dropdown-menu/nested-export.vue +56 -0
  34. package/dist/assets/examples/sources/empty-state/search-results.vue +26 -1
  35. package/dist/assets/examples/sources/field/billing-address-headless.vue +93 -0
  36. package/dist/assets/examples/sources/field/billing-address.vue +192 -0
  37. package/dist/assets/examples/sources/field/checkbox.vue +10 -2
  38. package/dist/assets/examples/sources/field/themed.vue +12 -11
  39. package/dist/assets/examples/sources/file-upload/asset-submission.vue +96 -36
  40. package/dist/assets/examples/sources/form/async-validation.vue +180 -0
  41. package/dist/assets/examples/sources/form/composable.vue +146 -0
  42. package/dist/assets/examples/sources/form/nested-webhooks.vue +233 -0
  43. package/dist/assets/examples/sources/form/profile-schema.vue +376 -0
  44. package/dist/assets/examples/sources/inline-alert/billing-notices.vue +26 -5
  45. package/dist/assets/examples/sources/inline-alert/feed-status.vue +229 -0
  46. package/dist/assets/examples/sources/input/clearable-search-headless.vue +162 -0
  47. package/dist/assets/examples/sources/input/clearable-search.vue +225 -0
  48. package/dist/assets/examples/sources/input/unit-suffix.vue +109 -0
  49. package/dist/assets/examples/sources/interactive-surface/basic.vue +20 -8
  50. package/dist/assets/examples/sources/interactive-surface/feature-tiles.vue +42 -8
  51. package/dist/assets/examples/sources/kbd/command-shortcuts.vue +0 -1
  52. package/dist/assets/examples/sources/link/documentation-footer.vue +11 -4
  53. package/dist/assets/examples/sources/link/router.vue +9 -5
  54. package/dist/assets/examples/sources/menubar/themed.vue +46 -10
  55. package/dist/assets/examples/sources/number-input/order-limits.vue +5 -0
  56. package/dist/assets/examples/sources/number-input/themed.vue +12 -6
  57. package/dist/assets/examples/sources/number-input/workshop-booking.vue +207 -0
  58. package/dist/assets/examples/sources/pagination/controlled.vue +83 -18
  59. package/dist/assets/examples/sources/pagination/ellipsis.vue +44 -14
  60. package/dist/assets/examples/sources/pagination/themed.vue +161 -21
  61. package/dist/assets/examples/sources/presence/basic.vue +81 -0
  62. package/dist/assets/examples/sources/presence/portal.vue +92 -0
  63. package/dist/assets/examples/sources/progress/report-export.vue +160 -0
  64. package/dist/assets/examples/sources/scroll-area/activity-feed.vue +0 -1
  65. package/dist/assets/examples/sources/scroll-area/horizontal.vue +169 -14
  66. package/dist/assets/examples/sources/scroll-area/themed.vue +42 -3
  67. package/dist/assets/examples/sources/scroll-spy/themed.vue +180 -31
  68. package/dist/assets/examples/sources/select/alert-routing-form.vue +356 -0
  69. package/dist/assets/examples/sources/select/multiple-form.vue +201 -0
  70. package/dist/assets/examples/sources/select/multiple-labels.vue +142 -0
  71. package/dist/assets/examples/sources/skeleton/profile-loading.vue +28 -4
  72. package/dist/assets/examples/sources/slider/audio-mixer.vue +8 -2
  73. package/dist/assets/examples/sources/slider/price-filter.vue +162 -0
  74. package/dist/assets/examples/sources/slider/vertical.vue +3 -2
  75. package/dist/assets/examples/sources/spinner/sync-status.vue +13 -10
  76. package/dist/assets/examples/sources/switch/form.vue +43 -11
  77. package/dist/assets/examples/sources/table/contain-horizontal.vue +24 -12
  78. package/dist/assets/examples/sources/table/row-headers.vue +118 -19
  79. package/dist/assets/examples/sources/tabs/review-sections.vue +43 -0
  80. package/dist/assets/examples/sources/tags-input/headless-field.vue +31 -0
  81. package/dist/assets/examples/sources/tags-input/project-labels.vue +64 -0
  82. package/dist/assets/examples/sources/tags-input/read-only.vue +12 -0
  83. package/dist/assets/examples/sources/toast/themed.vue +42 -19
  84. package/dist/assets/examples/sources/toolbar/themed.vue +22 -4
  85. package/dist/assets/examples/sources/tooltip/themed.vue +12 -1
  86. package/dist/assets/examples/sources/tree/themed.vue +70 -17
  87. package/dist/assets/manifests/themes/ghost-accordion.manifest.json +1 -0
  88. package/dist/assets/manifests/themes/ghost-button.manifest.json +1 -0
  89. package/dist/assets/manifests/themes/ghost-calendar.manifest.json +3 -1
  90. package/dist/assets/manifests/themes/ghost-checkbox-group.manifest.json +90 -0
  91. package/dist/assets/manifests/themes/ghost-collapsible.manifest.json +1 -0
  92. package/dist/assets/manifests/themes/ghost-combobox.manifest.json +1 -0
  93. package/dist/assets/manifests/themes/ghost-command-palette.manifest.json +2 -1
  94. package/dist/assets/manifests/themes/ghost-date-picker.manifest.json +5 -0
  95. package/dist/assets/manifests/themes/ghost-dropdown-menu.manifest.json +9 -0
  96. package/dist/assets/manifests/themes/ghost-field.manifest.json +10 -2
  97. package/dist/assets/manifests/themes/ghost-inline-alert.manifest.json +1 -0
  98. package/dist/assets/manifests/themes/ghost-input.manifest.json +3 -1
  99. package/dist/assets/manifests/themes/ghost-link.manifest.json +2 -1
  100. package/dist/assets/manifests/themes/ghost-number-input.manifest.json +1 -0
  101. package/dist/assets/manifests/themes/ghost-pagination.manifest.json +6 -2
  102. package/dist/assets/manifests/themes/ghost-progress.manifest.json +1 -0
  103. package/dist/assets/manifests/themes/ghost-radio-group-item.manifest.json +63 -0
  104. package/dist/assets/manifests/themes/ghost-scroll-area.manifest.json +12 -2
  105. package/dist/assets/manifests/themes/ghost-select.manifest.json +3 -0
  106. package/dist/assets/manifests/themes/ghost-slider.manifest.json +1 -0
  107. package/dist/assets/manifests/themes/ghost-table.manifest.json +2 -1
  108. package/dist/assets/manifests/themes/ghost-tags-input.manifest.json +255 -0
  109. package/dist/assets/manifests/vue/ghost-checkbox-group.manifest.json +173 -0
  110. package/dist/assets/manifests/vue/ghost-command-palette-content.manifest.json +6 -2
  111. package/dist/assets/manifests/vue/ghost-command-palette-overlay.manifest.json +6 -2
  112. package/dist/assets/manifests/vue/ghost-command-palette.manifest.json +0 -1
  113. package/dist/assets/manifests/vue/ghost-context-menu-content.manifest.json +3 -3
  114. package/dist/assets/manifests/vue/ghost-context-menu.manifest.json +1 -1
  115. package/dist/assets/manifests/vue/ghost-data-table-preset.manifest.json +1 -1
  116. package/dist/assets/manifests/vue/ghost-data-table-table.manifest.json +1 -1
  117. package/dist/assets/manifests/vue/ghost-data-table.manifest.json +99 -2
  118. package/dist/assets/manifests/vue/ghost-date-picker-content.manifest.json +12 -3
  119. package/dist/assets/manifests/vue/ghost-date-picker.manifest.json +1 -6
  120. package/dist/assets/manifests/vue/ghost-dialog-content.manifest.json +6 -2
  121. package/dist/assets/manifests/vue/ghost-dialog-overlay.manifest.json +6 -2
  122. package/dist/assets/manifests/vue/ghost-drawer-content.manifest.json +6 -2
  123. package/dist/assets/manifests/vue/ghost-drawer-overlay.manifest.json +6 -2
  124. package/dist/assets/manifests/vue/ghost-field-error.manifest.json +12 -1
  125. package/dist/assets/manifests/vue/ghost-field.manifest.json +35 -3
  126. package/dist/assets/manifests/vue/ghost-form.manifest.json +221 -0
  127. package/dist/assets/manifests/vue/ghost-hover-card-content.manifest.json +12 -3
  128. package/dist/assets/manifests/vue/ghost-input.manifest.json +2 -1
  129. package/dist/assets/manifests/vue/ghost-link.manifest.json +1 -2
  130. package/dist/assets/manifests/vue/ghost-menubar-content.manifest.json +3 -3
  131. package/dist/assets/manifests/vue/ghost-menubar.manifest.json +4 -4
  132. package/dist/assets/manifests/vue/ghost-pagination.manifest.json +0 -2
  133. package/dist/assets/manifests/vue/ghost-popover-content.manifest.json +6 -2
  134. package/dist/assets/manifests/vue/ghost-presence.manifest.json +96 -0
  135. package/dist/assets/manifests/vue/ghost-scroll-area.manifest.json +0 -1
  136. package/dist/assets/manifests/vue/ghost-select-content.manifest.json +6 -1
  137. package/dist/assets/manifests/vue/ghost-select-group.manifest.json +6 -1
  138. package/dist/assets/manifests/vue/ghost-select-label.manifest.json +6 -1
  139. package/dist/assets/manifests/vue/ghost-select-option.manifest.json +6 -1
  140. package/dist/assets/manifests/vue/ghost-select-trigger.manifest.json +6 -1
  141. package/dist/assets/manifests/vue/ghost-select-value.manifest.json +18 -2
  142. package/dist/assets/manifests/vue/ghost-select.manifest.json +18 -6
  143. package/dist/assets/manifests/vue/ghost-submenu-content.manifest.json +168 -0
  144. package/dist/assets/manifests/vue/ghost-submenu-trigger.manifest.json +102 -0
  145. package/dist/assets/manifests/vue/ghost-submenu.manifest.json +59 -0
  146. package/dist/assets/manifests/vue/ghost-table.manifest.json +0 -2
  147. package/dist/assets/manifests/vue/ghost-tabs.manifest.json +2 -1
  148. package/dist/assets/manifests/vue/ghost-tags-input.manifest.json +260 -0
  149. package/dist/assets/tokens.json +15 -0
  150. package/dist/components.d.ts +5 -0
  151. package/dist/components.js +80 -11
  152. package/package.json +1 -1
@@ -1,25 +1,180 @@
1
1
  <script setup lang="ts">
2
- import { GhostScrollArea } from '@ghostvue/vue'
2
+ import { GhostBadge, GhostCard, GhostScrollArea } from '@ghostvue/themes'
3
+
4
+ /*
5
+ * Six environments never fit a phone-width card, so the strip scrolls on the
6
+ * inline axis instead of wrapping into an uneven grid. The tiles hold no
7
+ * links or buttons: the scroll root itself becomes the keyboard stop, which
8
+ * is why `label` names the region.
9
+ */
10
+ const environments = [
11
+ {
12
+ name: 'Production',
13
+ region: 'us-east-1',
14
+ version: 'v2.14.0',
15
+ status: 'Healthy',
16
+ tone: 'neutral' as const,
17
+ },
18
+ {
19
+ name: 'Canary',
20
+ region: 'us-east-1',
21
+ version: 'v2.15.0-rc.2',
22
+ status: 'Rolling out',
23
+ tone: 'accent' as const,
24
+ },
25
+ {
26
+ name: 'Staging',
27
+ region: 'us-west-2',
28
+ version: 'v2.15.0-rc.2',
29
+ status: 'Healthy',
30
+ tone: 'neutral' as const,
31
+ },
32
+ {
33
+ name: 'EU mirror',
34
+ region: 'eu-central-1',
35
+ version: 'v2.13.4',
36
+ status: 'Degraded',
37
+ tone: 'danger' as const,
38
+ },
39
+ {
40
+ name: 'QA',
41
+ region: 'us-west-2',
42
+ version: 'v2.15.0-rc.3',
43
+ status: 'Deploying',
44
+ tone: 'accent' as const,
45
+ },
46
+ {
47
+ name: 'Preview 482',
48
+ region: 'us-west-2',
49
+ version: 'pr-482',
50
+ status: 'Idle',
51
+ tone: 'neutral' as const,
52
+ },
53
+ ] as const
3
54
  </script>
4
55
 
5
56
  <template>
6
- <GhostScrollArea
7
- label="Column preview"
8
- orientation="horizontal"
9
- style="max-inline-size: 16rem"
10
- data-testid="scroll-area-horizontal"
11
- >
12
- <div class="scroll-area-wide-table" role="presentation">
13
- <span v-for="column in 12" :key="column">Column {{ column }}</span>
14
- </div>
15
- </GhostScrollArea>
57
+ <div class="environment-strip">
58
+ <GhostCard>
59
+ <template #header>
60
+ <div class="environment-strip__header">
61
+ <span class="environment-strip__title">Deployment environments</span>
62
+ <GhostBadge tone="neutral" variant="outline" size="sm">
63
+ {{ environments.length }} environments
64
+ </GhostBadge>
65
+ </div>
66
+ </template>
67
+
68
+ <GhostScrollArea
69
+ label="Deployment environments"
70
+ orientation="horizontal"
71
+ class="environment-strip__scroll"
72
+ >
73
+ <ul class="environment-strip__list">
74
+ <li
75
+ v-for="environment in environments"
76
+ :key="environment.name"
77
+ class="environment-strip__tile"
78
+ >
79
+ <span class="environment-strip__name">{{ environment.name }}</span>
80
+ <span class="environment-strip__region">
81
+ {{ environment.region }}
82
+ </span>
83
+ <span class="environment-strip__meta">
84
+ <span class="environment-strip__version">
85
+ {{ environment.version }}
86
+ </span>
87
+ <GhostBadge :tone="environment.tone" variant="soft" size="sm">
88
+ {{ environment.status }}
89
+ </GhostBadge>
90
+ </span>
91
+ </li>
92
+ </ul>
93
+ </GhostScrollArea>
94
+ </GhostCard>
95
+ </div>
16
96
  </template>
17
97
 
18
98
  <style scoped>
19
- .scroll-area-wide-table {
99
+ /*
100
+ * `minmax(0, 1fr)` stops the max-content tile row from widening the card:
101
+ * an `auto` track would grow to the row's width, leaving nothing to scroll.
102
+ */
103
+ .environment-strip {
104
+ display: grid;
105
+ grid-template-columns: minmax(0, 1fr);
106
+ }
107
+
108
+ .environment-strip__header {
109
+ align-items: center;
110
+ display: flex;
111
+ flex-wrap: wrap;
112
+ gap: var(--ghost-space-gap-sm);
113
+ justify-content: space-between;
114
+ }
115
+
116
+ .environment-strip__title {
117
+ color: var(--ghost-text-default);
118
+ font-size: var(--ghost-type-size-md);
119
+ font-weight: var(--ghost-type-weight-semibold);
120
+ line-height: var(--ghost-type-line-snug);
121
+ }
122
+
123
+ /*
124
+ * The region is a size container so tiles can be sized from its width. The
125
+ * themed recipe already keeps the tiles clear of the scrollbar below them.
126
+ */
127
+ .environment-strip__scroll {
128
+ container-type: inline-size;
129
+ }
130
+
131
+ .environment-strip__list {
20
132
  display: flex;
21
- gap: 1.5rem;
133
+ gap: var(--ghost-space-gap-sm);
22
134
  inline-size: max-content;
23
- padding-block: 0.25rem;
135
+ list-style: none;
136
+ margin: 0;
137
+ padding: 0;
138
+ }
139
+
140
+ /*
141
+ * At most 85% of the region, so a whole tile (the last one included) always
142
+ * fits once scrolled into view, and the next tile peeks in to show there is
143
+ * more to scroll.
144
+ */
145
+ .environment-strip__tile {
146
+ border: var(--ghost-border-hairline-width) solid var(--ghost-border-default);
147
+ border-radius: var(--ghost-radius-md);
148
+ box-sizing: border-box;
149
+ display: grid;
150
+ gap: var(--ghost-space-gap-2xs);
151
+ inline-size: min(11rem, 85cqi);
152
+ padding: var(--ghost-space-inset-sm);
153
+ }
154
+
155
+ .environment-strip__name {
156
+ color: var(--ghost-text-default);
157
+ font-size: var(--ghost-type-size-sm);
158
+ font-weight: var(--ghost-type-weight-medium);
159
+ line-height: var(--ghost-type-line-snug);
160
+ }
161
+
162
+ .environment-strip__region,
163
+ .environment-strip__version {
164
+ color: var(--ghost-text-muted);
165
+ font-size: var(--ghost-type-size-xs);
166
+ line-height: var(--ghost-type-line-normal);
167
+ }
168
+
169
+ .environment-strip__version {
170
+ font-variant-numeric: tabular-nums;
171
+ }
172
+
173
+ .environment-strip__meta {
174
+ align-items: center;
175
+ display: flex;
176
+ flex-wrap: wrap;
177
+ gap: var(--ghost-space-gap-xs);
178
+ justify-content: space-between;
24
179
  }
25
180
  </style>
@@ -1,16 +1,40 @@
1
1
  <script setup lang="ts">
2
2
  import { GhostScrollArea } from '@ghostvue/themes'
3
+
4
+ const messages = [
5
+ { from: 'Billing', subject: 'Invoice INV-2048 is ready' },
6
+ { from: 'Ada Lovelace', subject: 'Review requested on the tokens PR' },
7
+ { from: 'Status', subject: 'Scheduled maintenance on Saturday' },
8
+ { from: 'Grace Hopper', subject: 'Release notes draft for v2.15' },
9
+ { from: 'Security', subject: 'New sign-in from Berlin' },
10
+ { from: 'Alan Turing', subject: 'Visual baselines updated' },
11
+ { from: 'Support', subject: 'Ticket 3141 was resolved' },
12
+ { from: 'Margaret Hamilton', subject: 'Canary rollback guard enabled' },
13
+ ] as const
3
14
  </script>
4
15
 
5
16
  <template>
6
17
  <div class="scroll-area-themed-example">
18
+ <!-- The layout owns the size: the themed recipe only adds containment,
19
+ scrollbar clearance, and token-colored native scrollbars. -->
7
20
  <GhostScrollArea
8
21
  label="Inbox"
9
22
  class="scroll-area-themed-example__box"
10
23
  data-testid="scroll-area-themed"
11
24
  >
12
25
  <ul class="scroll-area-themed-example__list">
13
- <li v-for="index in 10" :key="index">Message {{ index }}</li>
26
+ <li
27
+ v-for="message in messages"
28
+ :key="message.subject"
29
+ class="scroll-area-themed-example__message"
30
+ >
31
+ <span class="scroll-area-themed-example__from">
32
+ {{ message.from }}
33
+ </span>
34
+ <span class="scroll-area-themed-example__subject">
35
+ {{ message.subject }}
36
+ </span>
37
+ </li>
14
38
  </ul>
15
39
  </GhostScrollArea>
16
40
  </div>
@@ -27,12 +51,27 @@ import { GhostScrollArea } from '@ghostvue/themes'
27
51
  }
28
52
 
29
53
  .scroll-area-themed-example__list {
30
- color: var(--ghost-text-default);
31
54
  display: grid;
32
- font-size: var(--ghost-type-size-sm);
33
55
  gap: var(--ghost-space-gap-xs);
34
56
  list-style: none;
35
57
  margin: 0;
36
58
  padding: 0;
37
59
  }
60
+
61
+ .scroll-area-themed-example__message {
62
+ display: grid;
63
+ }
64
+
65
+ .scroll-area-themed-example__from {
66
+ color: var(--ghost-text-default);
67
+ font-size: var(--ghost-type-size-sm);
68
+ font-weight: var(--ghost-type-weight-medium);
69
+ line-height: var(--ghost-type-line-snug);
70
+ }
71
+
72
+ .scroll-area-themed-example__subject {
73
+ color: var(--ghost-text-muted);
74
+ font-size: var(--ghost-type-size-xs);
75
+ line-height: var(--ghost-type-line-normal);
76
+ }
38
77
  </style>
@@ -1,59 +1,208 @@
1
1
  <script setup lang="ts">
2
+ import { ref } from 'vue'
3
+
2
4
  import {
3
5
  GhostScrollSpy,
4
6
  GhostScrollSpyItem,
5
7
  GhostScrollSpyLink,
6
8
  GhostScrollSpyList,
7
9
  } from '@ghostvue/themes'
10
+
11
+ interface ArticleSection {
12
+ id: string
13
+ title: string
14
+ paragraphs: string[]
15
+ }
16
+
17
+ const sections: ArticleSection[] = [
18
+ {
19
+ id: 'rollout-plan',
20
+ title: 'Plan the rollout',
21
+ paragraphs: [
22
+ 'Write down who gets the feature first, which metric proves it works, and the number that would make you roll back.',
23
+ 'Agree on an owner for each stage so nobody waits for a sign-off that was never assigned.',
24
+ ],
25
+ },
26
+ {
27
+ id: 'rollout-flag',
28
+ title: 'Ship behind a flag',
29
+ paragraphs: [
30
+ 'Merge the code with the flag off. The release goes out like any other deploy, and nothing changes for customers yet.',
31
+ 'Turn the flag on for your own team first and use the feature for a day.',
32
+ ],
33
+ },
34
+ {
35
+ id: 'rollout-ramp',
36
+ title: 'Ramp up traffic',
37
+ paragraphs: [
38
+ 'Raise exposure in steps: 1%, 10%, 50%, then everyone. Hold each step long enough to see a full day of traffic.',
39
+ 'Pause the ramp, rather than pushing through, when a step looks worse than the one before it.',
40
+ ],
41
+ },
42
+ {
43
+ id: 'rollout-metrics',
44
+ title: 'Watch the metrics',
45
+ paragraphs: [
46
+ 'Compare error rates and latency between the flagged and unflagged groups, not against last week.',
47
+ 'If the rollback number from your plan is crossed, turn the flag off first and investigate second.',
48
+ ],
49
+ },
50
+ {
51
+ id: 'rollout-cleanup',
52
+ title: 'Clean up the flag',
53
+ paragraphs: [
54
+ 'Once everyone has had the feature for a full release cycle, delete the flag and the old code path in one change.',
55
+ ],
56
+ },
57
+ ]
58
+
59
+ // The article scrolls inside its own panel, so the rail tracks this element
60
+ // instead of the window. Until the ref resolves the spy falls back to the
61
+ // window, then follows the panel once it mounts.
62
+ const article = ref<HTMLElement | null>(null)
8
63
  </script>
9
64
 
10
65
  <template>
11
- <div
12
- class="ghost-theme scroll-spy-themed"
13
- data-testid="scroll-spy-themed-page"
14
- >
66
+ <div class="article-reader">
67
+ <!--
68
+ A pixel probe offset (values above 1) puts the reading line 64px below
69
+ the top of the panel, just under the heading a link jump lands on.
70
+ `vp-raw` keeps the VitePress router from handling the fragment links.
71
+ -->
15
72
  <GhostScrollSpy
16
- label="Sections"
17
- class="scroll-spy-themed__nav vp-raw"
18
- data-testid="scroll-spy-themed"
73
+ label="Article sections"
74
+ :container="article"
75
+ :probe-offset="64"
76
+ class="article-reader__rail vp-raw"
19
77
  >
20
78
  <GhostScrollSpyList>
21
- <GhostScrollSpyItem>
22
- <GhostScrollSpyLink target="themed-one">One</GhostScrollSpyLink>
23
- </GhostScrollSpyItem>
24
- <GhostScrollSpyItem>
25
- <GhostScrollSpyLink target="themed-two">Two</GhostScrollSpyLink>
79
+ <GhostScrollSpyItem v-for="section in sections" :key="section.id">
80
+ <GhostScrollSpyLink :target="section.id">
81
+ {{ section.title }}
82
+ </GhostScrollSpyLink>
26
83
  </GhostScrollSpyItem>
27
84
  </GhostScrollSpyList>
28
85
  </GhostScrollSpy>
29
- <div class="scroll-spy-themed__main">
30
- <section id="themed-one" tabindex="-1" class="scroll-spy-themed__section">
31
- <h2>Section one</h2>
32
- <p v-for="index in 10" :key="index">Themed demo content {{ index }}.</p>
33
- </section>
34
- <section id="themed-two" tabindex="-1" class="scroll-spy-themed__section">
35
- <h2>Section two</h2>
36
- <p v-for="index in 10" :key="index">
37
- More themed demo content {{ index }}.
38
- </p>
39
- </section>
86
+
87
+ <!--
88
+ A scrollable region needs a name and a Tab stop so keyboard users can
89
+ scroll it with the arrow keys.
90
+ -->
91
+ <div
92
+ ref="article"
93
+ class="article-reader__scroller"
94
+ role="region"
95
+ aria-label="Roll out a feature flag"
96
+ tabindex="0"
97
+ >
98
+ <article class="article-reader__article">
99
+ <h2 class="article-reader__title">Roll out a feature flag</h2>
100
+ <!-- tabindex="-1" lets link activation move focus into the section. -->
101
+ <section
102
+ v-for="section in sections"
103
+ :id="section.id"
104
+ :key="section.id"
105
+ tabindex="-1"
106
+ class="article-reader__section"
107
+ >
108
+ <h3 class="article-reader__heading">{{ section.title }}</h3>
109
+ <p
110
+ v-for="paragraph in section.paragraphs"
111
+ :key="paragraph"
112
+ class="article-reader__copy"
113
+ >
114
+ {{ paragraph }}
115
+ </p>
116
+ </section>
117
+ </article>
40
118
  </div>
41
119
  </div>
42
120
  </template>
43
121
 
44
122
  <style scoped>
45
- .scroll-spy-themed {
123
+ /* Phones stack the rail above the article, so every link stays on screen. */
124
+ .article-reader {
125
+ --article-reader-panel-size: 20rem;
126
+
127
+ display: grid;
128
+ gap: var(--ghost-space-stack-md);
129
+ }
130
+
131
+ .article-reader__rail {
132
+ align-self: start;
133
+ }
134
+
135
+ .article-reader__scroller {
136
+ box-sizing: border-box;
137
+ block-size: var(--article-reader-panel-size);
138
+ overflow-y: auto;
139
+ padding: var(--ghost-space-inset-sm);
140
+ border: var(--ghost-border-hairline-width) solid var(--ghost-border-default);
141
+ border-radius: var(--ghost-radius-md);
142
+ /* Land section headings a little below the panel edge after a jump. */
143
+ scroll-padding-block-start: var(--ghost-space-inset-sm);
144
+ }
145
+
146
+ .article-reader__scroller:focus-visible,
147
+ .article-reader__section:focus-visible {
148
+ outline: var(--ghost-focus-ring-width) solid var(--ghost-focus-ring-color);
149
+ outline-offset: 2px;
150
+ }
151
+
152
+ .article-reader__article {
153
+ display: grid;
154
+ gap: var(--ghost-space-stack-lg);
155
+ }
156
+
157
+ .article-reader__title {
158
+ margin: 0;
159
+ color: var(--ghost-text-default);
160
+ font-size: var(--ghost-type-size-lg);
161
+ font-weight: var(--ghost-type-weight-semibold);
162
+ line-height: var(--ghost-type-line-snug);
163
+ }
164
+
165
+ .article-reader__section {
46
166
  display: grid;
47
- gap: 1.5rem;
48
- grid-template-columns: 10rem minmax(0, 1fr);
167
+ gap: var(--ghost-space-gap-sm);
168
+ border-radius: var(--ghost-radius-sm);
169
+ }
170
+
171
+ /*
172
+ * Give the last section a full panel of height, so a link jump can bring any
173
+ * section to the top of the panel. Without it, the panel stops at its end
174
+ * before the later sections reach the reading line, and the rail would mark
175
+ * the last section instead of the one the reader chose.
176
+ */
177
+ .article-reader__section:last-child {
178
+ min-block-size: calc(
179
+ var(--article-reader-panel-size) - 2 * var(--ghost-space-inset-sm) - 2 *
180
+ var(--ghost-border-hairline-width)
181
+ );
182
+ align-content: start;
49
183
  }
50
184
 
51
- .scroll-spy-themed__nav {
52
- inset-block-start: 1rem;
53
- position: sticky;
185
+ .article-reader__heading {
186
+ margin: 0;
187
+ color: var(--ghost-text-default);
188
+ font-size: var(--ghost-type-size-md);
189
+ font-weight: var(--ghost-type-weight-semibold);
190
+ line-height: var(--ghost-type-line-snug);
54
191
  }
55
192
 
56
- .scroll-spy-themed__section {
57
- min-block-size: 75vh;
193
+ .article-reader__copy {
194
+ margin: 0;
195
+ color: var(--ghost-text-muted);
196
+ font-size: var(--ghost-type-size-sm);
197
+ line-height: var(--ghost-type-line-normal);
198
+ }
199
+
200
+ /* Wider previews put the rail beside the article, sized to its longest link. */
201
+ @container ghost-demo (min-width: 34rem) {
202
+ .article-reader {
203
+ --article-reader-panel-size: 22rem;
204
+
205
+ grid-template-columns: max-content minmax(0, 1fr);
206
+ }
58
207
  }
59
208
  </style>