@miadi/stateloom-web 0.1.7 → 0.1.9
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 +8 -0
- package/package.json +1 -1
- package/server/.next/BUILD_ID +1 -1
- package/server/.next/build-manifest.json +2 -2
- package/server/.next/server/app/_global-error.html +2 -2
- package/server/.next/server/app/_global-error.rsc +1 -1
- package/server/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/server/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/server/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/server/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/server/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/server/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/server/.next/server/app/_not-found.html +1 -1
- package/server/.next/server/app/_not-found.rsc +2 -2
- package/server/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
- package/server/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/server/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
- package/server/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/server/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/server/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/server/.next/server/app/api/docs/route.js.nft.json +1 -1
- package/server/.next/server/app/api/file/route.js.nft.json +1 -1
- package/server/.next/server/app/api/rispec/route.js.nft.json +1 -1
- package/server/.next/server/app/api/watch/route.js.nft.json +1 -1
- package/server/.next/server/app/index.html +1 -1
- package/server/.next/server/app/index.rsc +3 -3
- package/server/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/server/.next/server/app/index.segments/_full.segment.rsc +3 -3
- package/server/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/server/.next/server/app/index.segments/_index.segment.rsc +2 -2
- package/server/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/server/.next/server/app/page.js.nft.json +1 -1
- package/server/.next/server/app/page_client-reference-manifest.js +1 -1
- package/server/.next/server/chunks/ssr/{[root-of-the-server]__46d45ef8._.js → [root-of-the-server]__d5879c0c._.js} +1 -1
- package/server/.next/server/chunks/ssr/[root-of-the-server]__edbb995c._.js +3 -3
- package/server/.next/server/pages/404.html +1 -1
- package/server/.next/server/pages/500.html +2 -2
- package/server/.next/static/chunks/636e7eb4aeda72e0.css +2 -0
- package/server/.next/static/chunks/92628504da59dcc8.js +10 -0
- package/server/package-lock.json +2 -2
- package/server/package.json +1 -1
- package/server/src/app/page.tsx +17 -10
- package/server/src/components/IssueIcon.tsx +28 -0
- package/server/src/components/LockIcon.tsx +24 -0
- package/server/src/components/PropertiesPanel.tsx +10 -0
- package/server/src/components/SettingsPanel.tsx +11 -0
- package/server/src/components/erd/ErdWorkspace.tsx +564 -172
- package/server/src/lib/useSheetDrag.ts +95 -0
- package/server/src/types/definition.ts +4 -0
- package/server/stateloom-web.json +2 -2
- package/server/tsconfig.tsbuildinfo +1 -1
- package/server/.next/static/chunks/486bc3bc16e91024.css +0 -2
- package/server/.next/static/chunks/b3f3eb72c25c4c6b.js +0 -10
- /package/server/.next/static/{DPL_H0tteH9tpIBvvsIfq → 6dAVJYqnbe6oEAABQ1yMG}/_buildManifest.js +0 -0
- /package/server/.next/static/{DPL_H0tteH9tpIBvvsIfq → 6dAVJYqnbe6oEAABQ1yMG}/_clientMiddlewareManifest.json +0 -0
- /package/server/.next/static/{DPL_H0tteH9tpIBvvsIfq → 6dAVJYqnbe6oEAABQ1yMG}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The phone sheet's grab handle, made to do what it looks like it does.
|
|
5
|
+
*
|
|
6
|
+
* The handle used to be decoration: it read as "this thing is a sheet" and
|
|
7
|
+
* answered no gesture, so a thumb pulling it down — the one thing a handle
|
|
8
|
+
* invites — got nothing. This hook gives the zone around it three answers:
|
|
9
|
+
*
|
|
10
|
+
* drag down the sheet follows the finger; past a threshold it closes
|
|
11
|
+
* (from the tall size, a short pull returns to the resting size)
|
|
12
|
+
* drag up the sheet grows with the finger; past a threshold it stays tall
|
|
13
|
+
* tap toggles between the resting and the tall size
|
|
14
|
+
*
|
|
15
|
+
* Height is handed to the sheet as the `--sheet-h` custom property rather than
|
|
16
|
+
* an inline `height`, so the desktop rule (`md:h-auto`) still wins where the
|
|
17
|
+
* sheet is a sidebar and none of this applies. A press that starts on a button
|
|
18
|
+
* inside the zone (the ✕) is left to the button.
|
|
19
|
+
*/
|
|
20
|
+
import { useRef, useState, type CSSProperties, type PointerEvent as ReactPointerEvent } from "react";
|
|
21
|
+
|
|
22
|
+
const CLOSE_AFTER = 80;
|
|
23
|
+
const CLOSE_FROM_TALL_AFTER = 260;
|
|
24
|
+
const GROW_AFTER = 50;
|
|
25
|
+
const TAP_SLOP = 6;
|
|
26
|
+
|
|
27
|
+
export interface SheetDrag {
|
|
28
|
+
/** Spread on the element that holds the handle. */
|
|
29
|
+
zoneProps: {
|
|
30
|
+
onPointerDown: (e: ReactPointerEvent<HTMLElement>) => void;
|
|
31
|
+
onPointerMove: (e: ReactPointerEvent<HTMLElement>) => void;
|
|
32
|
+
onPointerUp: (e: ReactPointerEvent<HTMLElement>) => void;
|
|
33
|
+
onPointerCancel: (e: ReactPointerEvent<HTMLElement>) => void;
|
|
34
|
+
style: CSSProperties;
|
|
35
|
+
};
|
|
36
|
+
/** Spread on the sheet itself, which sizes itself with `h-[var(--sheet-h)]`. */
|
|
37
|
+
sheetStyle: CSSProperties;
|
|
38
|
+
/** Close the sheet and return it to its resting size for next time. */
|
|
39
|
+
close: () => void;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function useSheetDrag(opts: { onClose: () => void; restVh: number; tallVh: number }): SheetDrag {
|
|
43
|
+
const { onClose, restVh, tallVh } = opts;
|
|
44
|
+
const [tall, setTall] = useState(false);
|
|
45
|
+
const [dy, setDy] = useState<number | null>(null);
|
|
46
|
+
const press = useRef<{ y: number; id: number } | null>(null);
|
|
47
|
+
|
|
48
|
+
const close = (): void => {
|
|
49
|
+
setTall(false);
|
|
50
|
+
onClose();
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const release = (e: ReactPointerEvent<HTMLElement>): void => {
|
|
54
|
+
const p = press.current;
|
|
55
|
+
if (!p || p.id !== e.pointerId) return;
|
|
56
|
+
press.current = null;
|
|
57
|
+
const d = e.clientY - p.y;
|
|
58
|
+
setDy(null);
|
|
59
|
+
if (Math.abs(d) < TAP_SLOP) return setTall((t) => !t);
|
|
60
|
+
if (d <= -GROW_AFTER) return setTall(true);
|
|
61
|
+
if (d >= CLOSE_AFTER) {
|
|
62
|
+
if (tall && d < CLOSE_FROM_TALL_AFTER) return setTall(false);
|
|
63
|
+
close();
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const vh = tall ? tallVh : restVh;
|
|
68
|
+
const dragging = dy !== null;
|
|
69
|
+
const sheetStyle: CSSProperties & Record<"--sheet-h", string> = {
|
|
70
|
+
"--sheet-h": dragging && dy < 0 ? `min(calc(${vh}dvh + ${-dy}px), ${tallVh}dvh)` : `${vh}dvh`,
|
|
71
|
+
...(dragging ? { transition: "none" } : {}),
|
|
72
|
+
...(dragging && dy > 0 ? { transform: `translateY(${dy}px)` } : {}),
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
return {
|
|
76
|
+
zoneProps: {
|
|
77
|
+
onPointerDown: (e) => {
|
|
78
|
+
if ((e.target as HTMLElement).closest("button")) return;
|
|
79
|
+
press.current = { y: e.clientY, id: e.pointerId };
|
|
80
|
+
e.currentTarget.setPointerCapture(e.pointerId);
|
|
81
|
+
setDy(0);
|
|
82
|
+
},
|
|
83
|
+
onPointerMove: (e) => {
|
|
84
|
+
const p = press.current;
|
|
85
|
+
if (p && p.id === e.pointerId) setDy(e.clientY - p.y);
|
|
86
|
+
},
|
|
87
|
+
onPointerUp: release,
|
|
88
|
+
onPointerCancel: release,
|
|
89
|
+
// The zone is a gesture surface: the browser must not scroll or pan with it.
|
|
90
|
+
style: { touchAction: "none", cursor: "grab" },
|
|
91
|
+
},
|
|
92
|
+
sheetStyle,
|
|
93
|
+
close,
|
|
94
|
+
};
|
|
95
|
+
}
|
|
@@ -21,6 +21,8 @@ export interface SettingsModel {
|
|
|
21
21
|
namespace: string;
|
|
22
22
|
name?: string;
|
|
23
23
|
description?: string;
|
|
24
|
+
/** Working notes about the whole diagram — saved in the document, ignored by engines and codegen. */
|
|
25
|
+
notes?: string;
|
|
24
26
|
asynchronous: boolean;
|
|
25
27
|
/**
|
|
26
28
|
* Objects the generated context is constructed with. `ObjectRef` is what
|
|
@@ -97,6 +99,8 @@ export interface StateDef {
|
|
|
97
99
|
name: string;
|
|
98
100
|
kind?: StateKindType;
|
|
99
101
|
description?: string;
|
|
102
|
+
/** Working notes about this state: the conversation about it, where `description` says what it is. */
|
|
103
|
+
notes?: string;
|
|
100
104
|
onEntry?: { actions: ActionDef[] };
|
|
101
105
|
onExit?: { actions: ActionDef[] };
|
|
102
106
|
transitions?: TransitionDef[];
|