@milesroxas/design-hub 0.6.0 → 0.6.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/README.md +1 -1
- package/kit/dials.css +9 -8
- package/kit/dials.tsx +39 -20
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -64,7 +64,7 @@ A speculation rule in `shell/index.html` prefetches a prototype's page when its
|
|
|
64
64
|
|
|
65
65
|
## The walkthrough
|
|
66
66
|
|
|
67
|
-
`/guide/<feature>/` is `docs/sprints/<feature>/guide.md`, rendered for reviewers who have the password but not the repo; `/guide/` alone opens the only guide, or lists them. The registry plugin lists the guides, so a new feature's walkthrough appears the moment the file exists (`design-hub guide <feature>` starts one from `templates/guide.md`). The Markdown stays the one source: a Vite plugin (`vite/markdown.ts`, the `?doc` import) compiles it at build time with `marked`, so nothing is parsed in the browser. It turns the first H1 into the title, every H2 and H3 into the contents rail, each image into a figure with its pixel size (no layout shift, lazy below the first), and `> [!NOTE]` quotes into callouts. A paragraph that starts `Controls → …` renders as a click path. Links to other Markdown files lose their href, since nothing serves them. The page reads at 16px on a 680px measure; screenshots and tables take the full 960px column, because a 1440px shot at 680px is unreadable. Two raw values: a screenshot wears a 1px inset outline at 10% (black on light, white on dark) and a callout a 6% ring (8% on dark), alphas rather than tokens because they composite on any surface the page is set on. The slug `guide` is the hub's (`design-hub new guide` refuses it). The page's **Open the prototype** button goes to the feature's sprint prototype, and every prototype of the feature answers with **Open the walkthrough** as the last row of Controls, under every group, in a new tab, so a reviewer reads and clicks side by side. A sheet inside the product was rejected: it would be modal over the thing under review, and testing aids never sit in the product chrome.
|
|
67
|
+
`/guide/<feature>/` is `docs/sprints/<feature>/guide.md`, rendered for reviewers who have the password but not the repo; `/guide/` alone opens the only guide, or lists them. The registry plugin lists the guides, so a new feature's walkthrough appears the moment the file exists (`design-hub guide <feature>` starts one from `templates/guide.md`). The Markdown stays the one source: a Vite plugin (`vite/markdown.ts`, the `?doc` import) compiles it at build time with `marked`, so nothing is parsed in the browser. It turns the first H1 into the title, every H2 and H3 into the contents rail, each image into a figure with its pixel size (no layout shift, lazy below the first), and `> [!NOTE]` quotes into callouts. A paragraph that starts `Controls → …` renders as a click path. Links to other Markdown files lose their href, since nothing serves them. The page reads at 16px on a 680px measure; screenshots and tables take the full 960px column, because a 1440px shot at 680px is unreadable. Two raw values: a screenshot wears a 1px inset outline at 10% (black on light, white on dark) and a callout a 6% ring (8% on dark), alphas rather than tokens because they composite on any surface the page is set on. The slug `guide` is the hub's (`design-hub new guide` refuses it). The page's **Open the prototype** button goes to the feature's sprint prototype, and every prototype of the feature answers with **Open the walkthrough** as the last row of Controls, under every group, in a new tab, so a reviewer reads and clicks side by side. Above it, on every prototype, **All prototypes** goes back to `/` in the same tab. A sheet inside the product was rejected: it would be modal over the thing under review, and testing aids never sit in the product chrome.
|
|
68
68
|
|
|
69
69
|
## Deploying, and the password
|
|
70
70
|
|
package/kit/dials.css
CHANGED
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
.dial-hint:not(.is-on) { transition-duration: 90ms; }
|
|
29
29
|
:root[data-motion="reduce"] .dial-hint { transform: none; transition: opacity 120ms var(--ease-hover); }
|
|
30
30
|
|
|
31
|
-
/* The
|
|
32
|
-
buttons so
|
|
33
|
-
.dial-
|
|
31
|
+
/* The panel's last rows, All prototypes and the walkthrough: drawn as DialKit's
|
|
32
|
+
own buttons so they read as part of the panel. The walkthrough's arrow says new tab. */
|
|
33
|
+
.dial-link {
|
|
34
34
|
display: flex;
|
|
35
35
|
align-items: center;
|
|
36
36
|
justify-content: space-between;
|
|
@@ -47,12 +47,13 @@
|
|
|
47
47
|
text-decoration: none;
|
|
48
48
|
transition: background-color var(--dur-hover) var(--ease-hover), color var(--dur-hover) var(--ease-hover), transform var(--dur-press-out) var(--ease-press);
|
|
49
49
|
}
|
|
50
|
-
.dial-
|
|
51
|
-
.dial-
|
|
52
|
-
.dial-
|
|
53
|
-
|
|
50
|
+
.dial-link + .dial-link { margin-top: 4px; }
|
|
51
|
+
.dial-link:hover { background: var(--dial-surface-hover); color: var(--dial-text-primary); }
|
|
52
|
+
.dial-link:active { transform: scale(0.97); }
|
|
53
|
+
.dial-link:focus-visible { outline: 2px solid var(--dial-focus-ring); outline-offset: -2px; }
|
|
54
|
+
:root[data-motion="reduce"] .dial-link:active { transform: none; }
|
|
54
55
|
/* The panel has no bottom padding, so the last row brings its own. */
|
|
55
|
-
.dialkit-folder-root > .dialkit-folder-content:has(> .dial-
|
|
56
|
+
.dialkit-folder-root > .dialkit-folder-content:has(> .dial-link) { padding-bottom: 12px; }
|
|
56
57
|
|
|
57
58
|
/* DialKit draws Copy parameters and Save version at the top of every group,
|
|
58
59
|
inside its sticky header. Here they close the group instead: the header
|
package/kit/dials.tsx
CHANGED
|
@@ -12,7 +12,7 @@ import 'dialkit/styles.css';
|
|
|
12
12
|
import './dials.css';
|
|
13
13
|
import { type RefObject, useLayoutEffect } from 'react';
|
|
14
14
|
import { createRoot } from 'react-dom/client';
|
|
15
|
-
import { iconMarkup } from './Icon';
|
|
15
|
+
import { type IconName, iconMarkup } from './Icon';
|
|
16
16
|
|
|
17
17
|
// What the panel calls itself. DialKit hard-codes its own name as the root
|
|
18
18
|
// title; the prototypes say what the thing is instead.
|
|
@@ -55,7 +55,7 @@ export function ensureDialRoot() {
|
|
|
55
55
|
// DialKit portals the panel to <body>; it appears once the first panel registers.
|
|
56
56
|
const settle = (root: HTMLElement) => {
|
|
57
57
|
retitle(root);
|
|
58
|
-
|
|
58
|
+
placeLinks(root);
|
|
59
59
|
new MutationObserver((records) => {
|
|
60
60
|
for (const { type, target } of records) {
|
|
61
61
|
// DialKit keeps the panel's scroll offset when it collapses, which pushes the trigger icon off-centre.
|
|
@@ -64,7 +64,7 @@ export function ensureDialRoot() {
|
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
retitle(root);
|
|
67
|
-
|
|
67
|
+
placeLinks(root);
|
|
68
68
|
}).observe(root, { subtree: true, childList: true, attributeFilter: ['data-collapsed'] });
|
|
69
69
|
};
|
|
70
70
|
const found = document.body.querySelector<HTMLElement>('.dialkit-root');
|
|
@@ -92,25 +92,44 @@ function retitle(root: HTMLElement) {
|
|
|
92
92
|
if (title && title.textContent !== DIALS_TITLE) title.textContent = DIALS_TITLE;
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
//
|
|
98
|
-
|
|
99
|
-
|
|
95
|
+
type PanelLink = { key: string; href: string; label: string; icon: IconName; newTab?: boolean };
|
|
96
|
+
|
|
97
|
+
// The panel's last rows, under every group: the hub's list of every prototype,
|
|
98
|
+
// then the feature's walkthrough when it has one, which stays the very last.
|
|
99
|
+
function panelLinks(): PanelLink[] {
|
|
100
|
+
const home: PanelLink = { key: 'home', href: '/', label: 'All prototypes', icon: 'grid-01' };
|
|
101
|
+
if (!guide) return [home];
|
|
102
|
+
return [
|
|
103
|
+
home,
|
|
104
|
+
{ key: 'guide', href: guide, label: 'Open the walkthrough', icon: 'arrow-up-right', newTab: true },
|
|
105
|
+
];
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function makeLink({ key, href, label, icon, newTab }: PanelLink) {
|
|
109
|
+
const link = document.createElement('a');
|
|
110
|
+
link.className = 'dial-link';
|
|
111
|
+
link.dataset.dialLink = key;
|
|
112
|
+
link.href = href;
|
|
113
|
+
if (newTab) {
|
|
114
|
+
link.target = '_blank';
|
|
115
|
+
link.rel = 'noopener';
|
|
116
|
+
}
|
|
117
|
+
link.innerHTML = `<span>${label}</span>${iconMarkup(icon, 16)}`;
|
|
118
|
+
return link;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// DialKit remounts the content on open and adds groups as panels register, so
|
|
122
|
+
// the rows are put back whenever they are missing and moved down whenever a
|
|
123
|
+
// group lands below them.
|
|
124
|
+
function placeLinks(root: HTMLElement) {
|
|
100
125
|
const content = root.querySelector('.dialkit-folder-root > .dialkit-folder-content');
|
|
101
126
|
if (!content) return;
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
link.className = 'dial-guide';
|
|
109
|
-
link.href = guide;
|
|
110
|
-
link.target = '_blank';
|
|
111
|
-
link.rel = 'noopener';
|
|
112
|
-
link.innerHTML = `<span>Open the walkthrough</span>${iconMarkup('arrow-up-right', 16)}`;
|
|
113
|
-
content.append(link);
|
|
127
|
+
const rows = panelLinks().map(
|
|
128
|
+
(l) => content.querySelector<HTMLAnchorElement>(`:scope > [data-dial-link="${l.key}"]`) ?? makeLink(l),
|
|
129
|
+
);
|
|
130
|
+
const tail = Array.from(content.children).slice(-rows.length);
|
|
131
|
+
if (rows.every((row, i) => tail[i] === row)) return;
|
|
132
|
+
content.append(...rows);
|
|
114
133
|
}
|
|
115
134
|
|
|
116
135
|
// Hints: what each dial does, shown on hover or focus.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@milesroxas/design-hub",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"description": "The Design Hub product: the hub that lists and serves prototypes, the review panel and its API, the password gate, the kit, and the design-hub CLI. A project installs it and keeps only its prototypes, kit materials and docs.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|