@milesroxas/design-hub 0.12.0 → 0.14.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/README.md +5 -5
- package/core/prototype.test.ts +12 -1
- package/core/prototype.ts +21 -2
- package/core/review/model.ts +71 -6
- package/core/review/service.test.ts +575 -39
- package/core/review/service.ts +452 -25
- package/core/review/store.ts +47 -6
- package/core/review/suite-kv.ts +17 -0
- package/dist/core/prototype.d.ts +20 -2
- package/dist/core/prototype.js +17 -2
- package/dist/core/review/model.d.ts +42 -3
- package/dist/core/review/model.js +52 -3
- package/dist/core/review/service.d.ts +81 -7
- package/dist/core/review/service.js +407 -23
- package/dist/core/review/store.d.ts +29 -2
- package/dist/core/review/store.js +6 -2
- package/dist/core/review/suite-kv.d.ts +7 -0
- package/dist/core/review/suite-kv.js +12 -0
- package/dist/scripts/client.d.ts +1 -1
- package/dist/scripts/client.js +4 -4
- package/dist/scripts/lib/cli.js +5 -0
- package/dist/scripts/lib/dns.d.ts +16 -2
- package/dist/scripts/lib/dns.js +66 -3
- package/dist/scripts/lib/fake-host.d.ts +17 -3
- package/dist/scripts/lib/fake-host.js +56 -10
- package/dist/scripts/lib/host.d.ts +15 -25
- package/dist/scripts/lib/host.js +15 -324
- package/dist/scripts/lib/resend.d.ts +36 -0
- package/dist/scripts/lib/resend.js +66 -0
- package/dist/scripts/lib/studio-deps.d.ts +23 -0
- package/dist/scripts/lib/studio-deps.js +46 -16
- package/dist/scripts/lib/studios.d.ts +16 -6
- package/dist/scripts/lib/studios.js +28 -10
- package/dist/scripts/lib/vercel-host.d.ts +17 -0
- package/dist/scripts/lib/vercel-host.js +416 -0
- package/dist/scripts/people.d.ts +16 -4
- package/dist/scripts/people.js +67 -17
- package/dist/scripts/share.js +3 -2
- package/dist/scripts/studio.d.ts +26 -4
- package/dist/scripts/studio.js +364 -19
- package/dist/server/api.d.ts +20 -7
- package/dist/server/api.js +83 -27
- package/dist/server/dev.js +21 -1
- package/dist/server/gate.d.ts +120 -0
- package/dist/server/gate.js +808 -0
- package/dist/server/mailer.d.ts +60 -0
- package/dist/server/mailer.js +104 -0
- package/dist/server/mailers/fake.d.ts +8 -0
- package/dist/server/mailers/fake.js +16 -0
- package/dist/server/mailers/resend.d.ts +21 -0
- package/dist/server/mailers/resend.js +49 -0
- package/dist/server/mark.d.ts +17 -0
- package/dist/server/mark.js +46 -1
- package/dist/server/session.d.ts +2 -1
- package/dist/server/session.js +6 -3
- package/dist/server/stores/backends.d.ts +22 -0
- package/dist/server/stores/backends.js +96 -0
- package/dist/server/{fake-upstash.js → stores/fake-upstash.js} +1 -1
- package/dist/server/stores/index.d.ts +41 -0
- package/dist/server/stores/index.js +63 -0
- package/dist/server/stores/pglite.d.ts +16 -0
- package/dist/server/stores/pglite.js +98 -0
- package/dist/server/stores/postgres.d.ts +63 -0
- package/dist/server/stores/postgres.js +153 -0
- package/dist/server/{upstash.d.ts → stores/upstash.d.ts} +1 -1
- package/dist/vercel/files.js +1 -1
- package/dist/vercel/proxy.d.ts +6 -82
- package/dist/vercel/proxy.js +24 -524
- package/dist/vite/plugin.js +4 -2
- package/kit/ui/Menu.tsx +29 -18
- package/kit/ui/layer.ts +41 -0
- package/package.json +3 -1
- package/shell/review/Bar.tsx +1 -0
- package/shell/review/Card.tsx +17 -7
- package/shell/review/People.tsx +908 -134
- package/shell/review/Review.tsx +2 -2
- package/shell/review/anchor.ts +6 -1
- package/shell/review/client.ts +41 -7
- package/shell/review/menu-place.test.ts +41 -0
- package/shell/review/place.test.ts +26 -1
- package/shell/review/place.ts +17 -0
- package/shell/review/review.css +97 -11
- package/shell/review/view.test.ts +115 -1
- package/shell/review/view.ts +92 -2
- package/shell/studio/StudioHub.tsx +1 -0
- package/shell/studio/hub.css +99 -13
- package/skills/miles-deploy/SKILL.md +26 -4
- package/templates/studio/.env.example +9 -0
- package/templates/studio/README.md +13 -0
- package/templates/studio/package.json +1 -1
- /package/dist/server/{fake-upstash.d.ts → stores/fake-upstash.d.ts} +0 -0
- /package/dist/server/{upstash.js → stores/upstash.js} +0 -0
package/kit/ui/layer.ts
CHANGED
|
@@ -49,3 +49,44 @@ export function installPressFeedback() {
|
|
|
49
49
|
document.addEventListener('pointercancel', lift);
|
|
50
50
|
document.addEventListener('pointerleave', lift, true);
|
|
51
51
|
}
|
|
52
|
+
|
|
53
|
+
type Box = { top: number; bottom: number; left: number; right: number };
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Where a menu goes for its trigger. Below when it fits, above when it does
|
|
57
|
+
* not, on the trigger's end or start edge and 8px inside the viewport. With
|
|
58
|
+
* `within` (the card or panel the trigger sits in), the side that stays
|
|
59
|
+
* inside it wins, and when neither does, the side that leaves it least. The
|
|
60
|
+
* origin is the trigger's own edge, in the menu's pixels, so the menu grows
|
|
61
|
+
* out of its button even when the viewport pushed it sideways.
|
|
62
|
+
*/
|
|
63
|
+
export function placeMenu(
|
|
64
|
+
trigger: Box,
|
|
65
|
+
menu: { width: number; height: number },
|
|
66
|
+
viewport: { width: number; height: number },
|
|
67
|
+
align: 'start' | 'end',
|
|
68
|
+
within?: Box | null,
|
|
69
|
+
) {
|
|
70
|
+
const GAP = 4;
|
|
71
|
+
const EDGE = 8;
|
|
72
|
+
const below = trigger.bottom + GAP + menu.height;
|
|
73
|
+
const above = trigger.top - GAP - menu.height;
|
|
74
|
+
const fitsBelow = below <= viewport.height - EDGE;
|
|
75
|
+
const fitsAbove = above >= EDGE;
|
|
76
|
+
let down = fitsBelow || !fitsAbove;
|
|
77
|
+
if (within && fitsBelow && fitsAbove) {
|
|
78
|
+
const overBelow = Math.max(0, below - within.bottom);
|
|
79
|
+
const overAbove = Math.max(0, within.top - above);
|
|
80
|
+
down = overBelow <= overAbove;
|
|
81
|
+
}
|
|
82
|
+
const anchor = align === 'end' ? trigger.right : trigger.left;
|
|
83
|
+
const wanted = align === 'end' ? trigger.right - menu.width : trigger.left;
|
|
84
|
+
const left = Math.max(EDGE, Math.min(wanted, viewport.width - menu.width - EDGE));
|
|
85
|
+
const x = Math.max(0, Math.min(anchor - left, menu.width));
|
|
86
|
+
return {
|
|
87
|
+
side: down ? ('below' as const) : ('above' as const),
|
|
88
|
+
top: down ? trigger.bottom + GAP : above,
|
|
89
|
+
left,
|
|
90
|
+
origin: `${x}px ${down ? 'top' : 'bottom'}`,
|
|
91
|
+
};
|
|
92
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@milesroxas/design-hub",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"description": "The Design Hub product: the hub that lists and serves prototypes, the review panel and its API, the sign-in 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": {
|
|
@@ -72,10 +72,12 @@
|
|
|
72
72
|
"marked": "^18.1.2",
|
|
73
73
|
"motion": "^14.6.0",
|
|
74
74
|
"postcss": "^8.5.32",
|
|
75
|
+
"postgres": "3.4.9",
|
|
75
76
|
"typescript": "^7.0.2",
|
|
76
77
|
"vite": "~8.3.5"
|
|
77
78
|
},
|
|
78
79
|
"devDependencies": {
|
|
80
|
+
"@electric-sql/pglite": "0.5.16",
|
|
79
81
|
"react": "^19.3.1",
|
|
80
82
|
"react-dom": "^19.3.1"
|
|
81
83
|
},
|
package/shell/review/Bar.tsx
CHANGED
package/shell/review/Card.tsx
CHANGED
|
@@ -3,14 +3,20 @@
|
|
|
3
3
|
// follows the page as it scrolls.
|
|
4
4
|
import { Button } from '@kit/ui';
|
|
5
5
|
import { type CSSProperties, type ReactNode, useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
6
|
-
import { besideButton, besidePoint, type Placement } from './place';
|
|
6
|
+
import { besideButton, besidePoint, besideTrigger, type Placement } from './place';
|
|
7
7
|
import { useKeyboardInset, useNarrow, useRevealPin, useSheetDrag } from './sheet';
|
|
8
8
|
|
|
9
9
|
const toStyle = (p: Placement): CSSProperties => ({ left: p.left, top: p.top, transformOrigin: p.origin });
|
|
10
10
|
|
|
11
|
-
function place(at: { x: number; y: number } | null, h: number): CSSProperties {
|
|
11
|
+
function place(at: { x: number; y: number } | null, h: number, by?: string): CSSProperties {
|
|
12
12
|
const vp = { width: innerWidth, height: innerHeight };
|
|
13
13
|
if (at) return toStyle(besidePoint(at, h, vp));
|
|
14
|
+
const control = by ? document.querySelector(by) : null;
|
|
15
|
+
if (control) {
|
|
16
|
+
const c = control.getBoundingClientRect();
|
|
17
|
+
const bar = (control.closest('.rv-bar') ?? control).getBoundingClientRect();
|
|
18
|
+
return toStyle(besideTrigger({ left: c.left, right: c.right, top: bar.top, bottom: bar.bottom }, h, vp));
|
|
19
|
+
}
|
|
14
20
|
const b = document.querySelector('.rv-launch')?.getBoundingClientRect();
|
|
15
21
|
return b ? toStyle(besideButton(b, h, vp)) : { right: 16, bottom: 72 };
|
|
16
22
|
}
|
|
@@ -39,12 +45,15 @@ function useFollow() {
|
|
|
39
45
|
|
|
40
46
|
export function Card({
|
|
41
47
|
at,
|
|
48
|
+
by,
|
|
42
49
|
label,
|
|
43
50
|
resolved,
|
|
44
51
|
onDismiss,
|
|
45
52
|
children,
|
|
46
53
|
}: {
|
|
47
54
|
at: { x: number; y: number } | null;
|
|
55
|
+
/** A selector for the control that opened a card with no pin: the card sits by it, and by the Comments button when it is gone. */
|
|
56
|
+
by?: string;
|
|
48
57
|
label: string;
|
|
49
58
|
resolved?: boolean;
|
|
50
59
|
/** Dragging the sheet down on a phone calls this. */
|
|
@@ -65,17 +74,18 @@ export function Card({
|
|
|
65
74
|
ro.observe(el);
|
|
66
75
|
return () => ro.disconnect();
|
|
67
76
|
}, []);
|
|
68
|
-
// A card that closes with focus inside hands it to the button, never to <body>.
|
|
77
|
+
// A card that closes with focus inside hands it to the control that opened it, or the button, never to <body>.
|
|
69
78
|
useEffect(() => {
|
|
70
79
|
const el = ref.current;
|
|
71
80
|
return () => {
|
|
72
81
|
if (!el?.contains(document.activeElement)) return;
|
|
73
82
|
requestAnimationFrame(() => {
|
|
74
|
-
if (document.activeElement
|
|
75
|
-
|
|
83
|
+
if (document.activeElement !== document.body) return;
|
|
84
|
+
const opener = by ? document.querySelector<HTMLElement>(by) : null;
|
|
85
|
+
(opener ?? document.querySelector<HTMLElement>('.rv-launch'))?.focus();
|
|
76
86
|
});
|
|
77
87
|
};
|
|
78
|
-
}, []);
|
|
88
|
+
}, [by]);
|
|
79
89
|
return (
|
|
80
90
|
<section
|
|
81
91
|
ref={ref}
|
|
@@ -83,7 +93,7 @@ export function Card({
|
|
|
83
93
|
aria-label={label}
|
|
84
94
|
data-resolved={resolved ? '' : undefined}
|
|
85
95
|
data-sheet={narrow ? '' : undefined}
|
|
86
|
-
style={narrow ? undefined : place(at, h)}
|
|
96
|
+
style={narrow ? undefined : place(at, h, by)}
|
|
87
97
|
{...drag}
|
|
88
98
|
>
|
|
89
99
|
{narrow && <span className="rv-grab" aria-hidden="true" />}
|