@zerospin/studio 0.0.0-stage → 1.0.0-alpha.11
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 +63 -2
- package/dist/components/ui/button.d.ts +10 -0
- package/dist/components/ui/button.d.ts.map +1 -0
- package/dist/components/ui/button.js +41 -0
- package/dist/components/ui/button.js.map +1 -0
- package/dist/components/ui/combobox.d.ts +17 -0
- package/dist/components/ui/combobox.d.ts.map +1 -0
- package/dist/components/ui/combobox.js +32 -0
- package/dist/components/ui/combobox.js.map +1 -0
- package/dist/components/ui/table.d.ts +9 -0
- package/dist/components/ui/table.d.ts.map +1 -0
- package/dist/components/ui/table.js +23 -0
- package/dist/components/ui/table.js.map +1 -0
- package/dist/entry.rsc.d.ts +4 -0
- package/dist/entry.rsc.d.ts.map +1 -0
- package/dist/entry.rsc.js +77 -0
- package/dist/entry.rsc.js.map +1 -0
- package/dist/entry.ssr.d.ts +2 -0
- package/dist/entry.ssr.d.ts.map +1 -0
- package/dist/entry.ssr.js +19 -0
- package/dist/entry.ssr.js.map +1 -0
- package/dist/fixtures/agents.d.ts +65605 -0
- package/dist/fixtures/agents.d.ts.map +1 -0
- package/dist/fixtures/agents.js +195 -0
- package/dist/fixtures/agents.js.map +1 -0
- package/dist/lib/cn.d.ts +3 -0
- package/dist/lib/cn.d.ts.map +1 -0
- package/dist/lib/cn.js +6 -0
- package/dist/lib/cn.js.map +1 -0
- package/dist/main.d.ts +2 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +14 -0
- package/dist/main.js.map +1 -0
- package/dist/server/makeStudioViteConfig.d.ts +11 -0
- package/dist/server/makeStudioViteConfig.d.ts.map +1 -0
- package/dist/server/makeStudioViteConfig.js +75 -0
- package/dist/server/makeStudioViteConfig.js.map +1 -0
- package/dist/server/openStudioServer.d.ts +14 -0
- package/dist/server/openStudioServer.d.ts.map +1 -0
- package/dist/server/openStudioServer.js +42 -0
- package/dist/server/openStudioServer.js.map +1 -0
- package/dist/startStudio.d.ts +15 -0
- package/dist/startStudio.d.ts.map +1 -0
- package/dist/startStudio.js +16 -0
- package/dist/startStudio.js.map +1 -0
- package/package.json +71 -3
- package/src/components/ui/button.tsx +75 -0
- package/src/components/ui/combobox.tsx +135 -0
- package/src/components/ui/table.tsx +81 -0
- package/src/entry.rsc.tsx +106 -0
- package/src/entry.ssr.tsx +19 -0
- package/src/fixtures/agents.ts +219 -0
- package/src/lib/cn.ts +6 -0
- package/src/main.tsx +17 -0
- package/src/rsc-env.d.ts +6 -0
- package/src/server/makeStudioViteConfig.ts +90 -0
- package/src/server/openStudioServer.ts +54 -0
- package/src/startStudio.ts +26 -0
- package/src/styles.css +79 -0
- package/vite.config.ts +7 -0
package/README.md
CHANGED
|
@@ -1,3 +1,64 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Zerospin Studio
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`zerospin studio` loads the current project's `zerospin.config.ts` and opens its
|
|
4
|
+
Declaration Board. Select its listening port with `--port <number>`, then `PORT`;
|
|
5
|
+
the default is `5555`. Both port forms accept integers from 1 to 65535. `.env.local` and `.env` retain their
|
|
6
|
+
existing precedence. The command does not require a running backend or a
|
|
7
|
+
Zerospin secret key, and it does not execute seeds.
|
|
8
|
+
|
|
9
|
+
## Server Component metadata
|
|
10
|
+
|
|
11
|
+
The CLI calls `makeSystemSpec({ system: config.system })` in Node. The Vite RSC
|
|
12
|
+
host supplies this startup snapshot to a React Server Component, which passes
|
|
13
|
+
serialized, JSON-compatible metadata to the existing client component exported
|
|
14
|
+
by [`@zerospin/system-diagrams`](../system-diagrams/README.md). Studio serves a
|
|
15
|
+
minimal HTML shell and mounts the board in the browser with `createRoot` after
|
|
16
|
+
fetching the route's RSC payload. Board SSR and hydration are disabled; client
|
|
17
|
+
components and their hooks execute only in the browser. The Vite `ssr` entry
|
|
18
|
+
provides the shell's client entry URL without rendering React components.
|
|
19
|
+
Executable project declarations and environment values remain outside the
|
|
20
|
+
browser bundle.
|
|
21
|
+
|
|
22
|
+
The shared board provides an Aggregate/Service outline, separate
|
|
23
|
+
declaration columns per Aggregate or Service, field disclosures, and full field
|
|
24
|
+
dialogs. Owners have direct page URLs at `/aggregates/:name` and `/services/:name`.
|
|
25
|
+
The root redirects to the first Aggregate, or the first Service when there are no
|
|
26
|
+
Aggregates. Unknown owners return 404; an empty System renders its empty board
|
|
27
|
+
at the root. Names are URL-encoded. Each page renders one owner inside a
|
|
28
|
+
viewport-sized board with independently scrolling columns and fixed column
|
|
29
|
+
headings. Browser history and direct reloads use normal page navigation.
|
|
30
|
+
Studio selects the package's `source` export condition so the component
|
|
31
|
+
and stylesheet use the same source revision. The RSC document emits its CSS
|
|
32
|
+
resources with `import.meta.viteRsc.loadCss()`.
|
|
33
|
+
|
|
34
|
+
Restart the command after changing declarations. The caller's
|
|
35
|
+
`AbortSignal` owns acquisition and memoized disposal of the local server.
|
|
36
|
+
|
|
37
|
+
`startStudio` accepts `projectRoot`, `port`, `open`, `systemSpec`, `signal`, and
|
|
38
|
+
optional `publicUrl`,
|
|
39
|
+
and returns `{ url, dispose }`. It has no deployment-authentication inputs or
|
|
40
|
+
local Repo HTTP broker.
|
|
41
|
+
|
|
42
|
+
## Cloud inspection
|
|
43
|
+
|
|
44
|
+
The local declaration board uses owner-page routing. Zerospin Cloud's Instance
|
|
45
|
+
Studio is the live Repo/table inspector; its deprecated board panel has been
|
|
46
|
+
removed. Its authenticated CloudApi resolves the active deployment's artifact
|
|
47
|
+
and private credentials for live Repo/table reads.
|
|
48
|
+
Historical deployment definitions remain separate from active-instance data.
|
|
49
|
+
Trace pages and external provider navigation are deferred.
|
|
50
|
+
|
|
51
|
+
## Storybook
|
|
52
|
+
|
|
53
|
+
Existing Storybook configuration and supporting fixtures remain in this
|
|
54
|
+
package. They are independent of the local RSC launcher.
|
|
55
|
+
|
|
56
|
+
## Portless
|
|
57
|
+
|
|
58
|
+
Studio binds to loopback HTTP with a strict port. When the CLI receives
|
|
59
|
+
`PORTLESS_URL`, it supplies that URL to `startStudio` for browser opening and
|
|
60
|
+
display; the HTTPS proxy owns the public origin.
|
|
61
|
+
|
|
62
|
+
Shopping's `pnpm studio` uses `studio.shopping.localhost` on internal port
|
|
63
|
+
12030; Tic-tac-toe uses `studio.tic-tac-toe.localhost` on 12031. Their explicit
|
|
64
|
+
Portless commands do not use or modify `dev:app`.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Button as ButtonPrimitive } from '@base-ui/react/button';
|
|
3
|
+
import { type VariantProps } from 'class-variance-authority';
|
|
4
|
+
declare const buttonVariants: (props?: ({
|
|
5
|
+
size?: "default" | "icon" | "icon-lg" | "icon-sm" | "icon-xs" | "lg" | "sm" | "xs" | null | undefined;
|
|
6
|
+
variant?: "default" | "destructive" | "ghost" | "link" | "outline" | "secondary" | null | undefined;
|
|
7
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
8
|
+
declare function Button(props: React.ComponentProps<typeof ButtonPrimitive> & VariantProps<typeof buttonVariants>): React.JSX.Element;
|
|
9
|
+
export { Button };
|
|
10
|
+
//# sourceMappingURL=button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../src/components/ui/button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAIlE,QAAA,MAAM,cAAc;;;8EAgCnB,CAAC;AAEF,iBAAS,MAAM,CACb,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,GACjD,YAAY,CAAC,OAAO,cAAc,CAAC,qBA6BtC;AAED,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Button as ButtonPrimitive } from '@base-ui/react/button';
|
|
3
|
+
import { cva } from 'class-variance-authority';
|
|
4
|
+
import { clsx } from 'clsx';
|
|
5
|
+
import { twMerge } from 'tailwind-merge';
|
|
6
|
+
const buttonVariants = cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive", {
|
|
7
|
+
defaultVariants: {
|
|
8
|
+
size: 'default',
|
|
9
|
+
variant: 'default',
|
|
10
|
+
},
|
|
11
|
+
variants: {
|
|
12
|
+
size: {
|
|
13
|
+
default: 'h-9 px-4 py-2 has-[>svg]:px-3',
|
|
14
|
+
xs: "h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3",
|
|
15
|
+
sm: 'h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5',
|
|
16
|
+
lg: 'h-10 rounded-md px-6 has-[>svg]:px-4',
|
|
17
|
+
icon: 'size-9',
|
|
18
|
+
'icon-xs': "size-6 rounded-md [&_svg:not([class*='size-'])]:size-3",
|
|
19
|
+
'icon-sm': 'size-8',
|
|
20
|
+
'icon-lg': 'size-10',
|
|
21
|
+
},
|
|
22
|
+
variant: {
|
|
23
|
+
default: 'bg-primary text-primary-foreground hover:bg-primary/90',
|
|
24
|
+
destructive: 'bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60',
|
|
25
|
+
outline: 'border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50',
|
|
26
|
+
secondary: 'bg-secondary text-secondary-foreground hover:bg-secondary/80',
|
|
27
|
+
ghost: 'hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50',
|
|
28
|
+
link: 'text-primary underline-offset-[0.25em] hover:underline',
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
function Button(props) {
|
|
33
|
+
const { className, variant = 'default', size = 'default', ...buttonProps } = props;
|
|
34
|
+
return (_jsx(ButtonPrimitive, { className: state => twMerge(clsx(buttonVariants({
|
|
35
|
+
className: typeof className === 'function' ? className(state) : className,
|
|
36
|
+
size,
|
|
37
|
+
variant,
|
|
38
|
+
}))), "data-size": size, "data-slot": "button", "data-variant": variant, ...buttonProps }));
|
|
39
|
+
}
|
|
40
|
+
export { Button };
|
|
41
|
+
//# sourceMappingURL=button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button.js","sourceRoot":"","sources":["../../../src/components/ui/button.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,GAAG,EAAqB,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC,MAAM,cAAc,GAAG,GAAG,CACxB,6bAA6b,EAC7b;IACE,eAAe,EAAE;QACf,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,SAAS;KACnB;IACD,QAAQ,EAAE;QACR,IAAI,EAAE;YACJ,OAAO,EAAE,+BAA+B;YACxC,EAAE,EAAE,0FAA0F;YAC9F,EAAE,EAAE,+CAA+C;YACnD,EAAE,EAAE,sCAAsC;YAC1C,IAAI,EAAE,QAAQ;YACd,SAAS,EAAE,wDAAwD;YACnE,SAAS,EAAE,QAAQ;YACnB,SAAS,EAAE,SAAS;SACrB;QACD,OAAO,EAAE;YACP,OAAO,EAAE,wDAAwD;YACjE,WAAW,EACT,mJAAmJ;YACrJ,OAAO,EACL,uIAAuI;YACzI,SAAS,EACP,8DAA8D;YAChE,KAAK,EACH,sEAAsE;YACxE,IAAI,EAAE,wDAAwD;SAC/D;KACF;CACF,CACF,CAAC;AAEF,SAAS,MAAM,CACb,KACqC;IAErC,MAAM,EACJ,SAAS,EACT,OAAO,GAAG,SAAS,EACnB,IAAI,GAAG,SAAS,EAChB,GAAG,WAAW,EACf,GAAG,KAAK,CAAC;IAEV,OAAO,CACL,KAAC,eAAe,IACd,SAAS,EAAE,KAAK,CAAC,EAAE,CACjB,OAAO,CACL,IAAI,CACF,cAAc,CAAC;YACb,SAAS,EACP,OAAO,SAAS,KAAK,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS;YAChE,IAAI;YACJ,OAAO;SACR,CAAC,CACH,CACF,eAEQ,IAAI,eACL,QAAQ,kBACJ,OAAO,KACjB,WAAW,GACf,CACH,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,MAAM,EAAE,CAAC","sourcesContent":["import * as React from 'react';\n\nimport { Button as ButtonPrimitive } from '@base-ui/react/button';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { clsx } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\nconst buttonVariants = cva(\n \"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive\",\n {\n defaultVariants: {\n size: 'default',\n variant: 'default',\n },\n variants: {\n size: {\n default: 'h-9 px-4 py-2 has-[>svg]:px-3',\n xs: \"h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3\",\n sm: 'h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5',\n lg: 'h-10 rounded-md px-6 has-[>svg]:px-4',\n icon: 'size-9',\n 'icon-xs': \"size-6 rounded-md [&_svg:not([class*='size-'])]:size-3\",\n 'icon-sm': 'size-8',\n 'icon-lg': 'size-10',\n },\n variant: {\n default: 'bg-primary text-primary-foreground hover:bg-primary/90',\n destructive:\n 'bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60',\n outline:\n 'border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50',\n secondary:\n 'bg-secondary text-secondary-foreground hover:bg-secondary/80',\n ghost:\n 'hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50',\n link: 'text-primary underline-offset-[0.25em] hover:underline',\n },\n },\n },\n);\n\nfunction Button(\n props: React.ComponentProps<typeof ButtonPrimitive> &\n VariantProps<typeof buttonVariants>,\n) {\n const {\n className,\n variant = 'default',\n size = 'default',\n ...buttonProps\n } = props;\n\n return (\n <ButtonPrimitive\n className={state =>\n twMerge(\n clsx(\n buttonVariants({\n className:\n typeof className === 'function' ? className(state) : className,\n size,\n variant,\n }),\n ),\n )\n }\n data-size={size}\n data-slot=\"button\"\n data-variant={variant}\n {...buttonProps}\n />\n );\n}\n\nexport { Button };\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Combobox as ComboboxPrimitive } from '@base-ui/react';
|
|
3
|
+
declare const Combobox: typeof ComboboxPrimitive.Root;
|
|
4
|
+
declare function ComboboxInput({ triggerLabel, ...props }: ComboboxPrimitive.Input.Props & {
|
|
5
|
+
triggerLabel: string;
|
|
6
|
+
}): React.JSX.Element;
|
|
7
|
+
declare function ComboboxContent({ className, portalContainer, ...props }: ComboboxPrimitive.Popup.Props & {
|
|
8
|
+
portalContainer?: ComboboxPrimitive.Portal.Props['container'];
|
|
9
|
+
}): React.JSX.Element;
|
|
10
|
+
declare function ComboboxList(props: ComboboxPrimitive.List.Props): React.JSX.Element;
|
|
11
|
+
declare function ComboboxItem({ className, children, ...props }: ComboboxPrimitive.Item.Props): React.JSX.Element;
|
|
12
|
+
declare function ComboboxGroup(props: ComboboxPrimitive.Group.Props): React.JSX.Element;
|
|
13
|
+
declare function ComboboxLabel(props: ComboboxPrimitive.GroupLabel.Props): React.JSX.Element;
|
|
14
|
+
declare function ComboboxCollection(props: ComboboxPrimitive.Collection.Props): React.JSX.Element;
|
|
15
|
+
declare function ComboboxEmpty(props: ComboboxPrimitive.Empty.Props): React.JSX.Element;
|
|
16
|
+
export { Combobox, ComboboxCollection, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxInput, ComboboxItem, ComboboxLabel, ComboboxList, };
|
|
17
|
+
//# sourceMappingURL=combobox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"combobox.d.ts","sourceRoot":"","sources":["../../../src/components/ui/combobox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,QAAQ,IAAI,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAK/D,QAAA,MAAM,QAAQ,+BAAyB,CAAC;AAExC,iBAAS,aAAa,CAAC,EACrB,YAAY,EACZ,GAAG,KAAK,EACT,EAAE,iBAAiB,CAAC,KAAK,CAAC,KAAK,GAAG;IAAE,YAAY,EAAE,MAAM,CAAA;CAAE,qBAmB1D;AAED,iBAAS,eAAe,CAAC,EACvB,SAAS,EACT,eAAe,EACf,GAAG,KAAK,EACT,EAAE,iBAAiB,CAAC,KAAK,CAAC,KAAK,GAAG;IACjC,eAAe,CAAC,EAAE,iBAAiB,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;CAC/D,qBAsBA;AAED,iBAAS,YAAY,CAAC,KAAK,EAAE,iBAAiB,CAAC,IAAI,CAAC,KAAK,qBAQxD;AAED,iBAAS,YAAY,CAAC,EACpB,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,iBAAiB,CAAC,IAAI,CAAC,KAAK,qBAkB9B;AAED,iBAAS,aAAa,CAAC,KAAK,EAAE,iBAAiB,CAAC,KAAK,CAAC,KAAK,qBAE1D;AAED,iBAAS,aAAa,CAAC,KAAK,EAAE,iBAAiB,CAAC,UAAU,CAAC,KAAK,qBAQ/D;AAED,iBAAS,kBAAkB,CAAC,KAAK,EAAE,iBAAiB,CAAC,UAAU,CAAC,KAAK,qBAEpE;AAED,iBAAS,aAAa,CAAC,KAAK,EAAE,iBAAiB,CAAC,KAAK,CAAC,KAAK,qBAO1D;AAED,OAAO,EACL,QAAQ,EACR,kBAAkB,EAClB,eAAe,EACf,aAAa,EACb,aAAa,EACb,aAAa,EACb,YAAY,EACZ,aAAa,EACb,YAAY,GACb,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Combobox as ComboboxPrimitive } from '@base-ui/react';
|
|
3
|
+
import { clsx } from 'clsx';
|
|
4
|
+
import { CheckIcon, ChevronDownIcon } from 'lucide-react';
|
|
5
|
+
import { twMerge } from 'tailwind-merge';
|
|
6
|
+
const Combobox = ComboboxPrimitive.Root;
|
|
7
|
+
function ComboboxInput({ triggerLabel, ...props }) {
|
|
8
|
+
return (_jsxs("div", { "data-slot": "combobox-input-wrapper", className: "flex h-9 w-full items-center rounded-md border border-input bg-transparent shadow-xs focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50", children: [_jsx(ComboboxPrimitive.Input, { "data-slot": "combobox-input", className: "h-full min-w-0 flex-1 bg-transparent px-3 py-1 text-sm outline-none placeholder:text-muted-foreground", ...props }), _jsx(ComboboxPrimitive.Trigger, { "aria-label": triggerLabel, className: "flex h-full w-9 items-center justify-center text-muted-foreground", children: _jsx(ChevronDownIcon, { className: "size-4" }) })] }));
|
|
9
|
+
}
|
|
10
|
+
function ComboboxContent({ className, portalContainer, ...props }) {
|
|
11
|
+
return (_jsx(ComboboxPrimitive.Portal, { container: portalContainer, children: _jsx(ComboboxPrimitive.Positioner, { side: "bottom", sideOffset: 6, align: "start", className: "isolate z-50", children: _jsx(ComboboxPrimitive.Popup, { "data-slot": "combobox-content", className: twMerge(clsx('group/combobox-content max-h-96 w-(--anchor-width) min-w-80 overflow-hidden rounded-md bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10', className)), ...props }) }) }));
|
|
12
|
+
}
|
|
13
|
+
function ComboboxList(props) {
|
|
14
|
+
return (_jsx(ComboboxPrimitive.List, { "data-slot": "combobox-list", className: "max-h-80 overflow-y-auto p-1", ...props }));
|
|
15
|
+
}
|
|
16
|
+
function ComboboxItem({ className, children, ...props }) {
|
|
17
|
+
return (_jsxs(ComboboxPrimitive.Item, { "data-slot": "combobox-item", className: twMerge(clsx('relative flex w-full cursor-default items-center rounded-sm py-1.5 pr-8 pl-2 text-sm outline-none data-highlighted:bg-accent data-highlighted:text-accent-foreground', className)), ...props, children: [children, _jsx(ComboboxPrimitive.ItemIndicator, { className: "absolute right-2 flex size-4 items-center justify-center", children: _jsx(CheckIcon, { className: "size-4" }) })] }));
|
|
18
|
+
}
|
|
19
|
+
function ComboboxGroup(props) {
|
|
20
|
+
return _jsx(ComboboxPrimitive.Group, { "data-slot": "combobox-group", ...props });
|
|
21
|
+
}
|
|
22
|
+
function ComboboxLabel(props) {
|
|
23
|
+
return (_jsx(ComboboxPrimitive.GroupLabel, { "data-slot": "combobox-label", className: "px-2 py-1.5 text-xs text-muted-foreground", ...props }));
|
|
24
|
+
}
|
|
25
|
+
function ComboboxCollection(props) {
|
|
26
|
+
return _jsx(ComboboxPrimitive.Collection, { ...props });
|
|
27
|
+
}
|
|
28
|
+
function ComboboxEmpty(props) {
|
|
29
|
+
return (_jsx(ComboboxPrimitive.Empty, { className: "hidden w-full justify-center py-3 text-sm text-muted-foreground group-data-empty/combobox-content:flex", ...props }));
|
|
30
|
+
}
|
|
31
|
+
export { Combobox, ComboboxCollection, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxInput, ComboboxItem, ComboboxLabel, ComboboxList, };
|
|
32
|
+
//# sourceMappingURL=combobox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"combobox.js","sourceRoot":"","sources":["../../../src/components/ui/combobox.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,QAAQ,IAAI,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC,MAAM,QAAQ,GAAG,iBAAiB,CAAC,IAAI,CAAC;AAExC,SAAS,aAAa,CAAC,EACrB,YAAY,EACZ,GAAG,KAAK,EACiD;IACzD,OAAO,CACL,4BACY,wBAAwB,EAClC,SAAS,EAAC,6JAA6J,aAEvK,KAAC,iBAAiB,CAAC,KAAK,iBACZ,gBAAgB,EAC1B,SAAS,EAAC,uGAAuG,KAC7G,KAAK,GACT,EACF,KAAC,iBAAiB,CAAC,OAAO,kBACZ,YAAY,EACxB,SAAS,EAAC,mEAAmE,YAE7E,KAAC,eAAe,IAAC,SAAS,EAAC,QAAQ,GAAG,GACZ,IACxB,CACP,CAAC;AACJ,CAAC;AAED,SAAS,eAAe,CAAC,EACvB,SAAS,EACT,eAAe,EACf,GAAG,KAAK,EAGT;IACC,OAAO,CACL,KAAC,iBAAiB,CAAC,MAAM,IAAC,SAAS,EAAE,eAAe,YAClD,KAAC,iBAAiB,CAAC,UAAU,IAC3B,IAAI,EAAC,QAAQ,EACb,UAAU,EAAE,CAAC,EACb,KAAK,EAAC,OAAO,EACb,SAAS,E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AAO,EACL,QAAQ,EACR,kBAAkB,EAClB,eAAe,EACf,aAAa,EACb,aAAa,EACb,aAAa,EACb,YAAY,EACZ,aAAa,EACb,YAAY,GACb,CAAC","sourcesContent":["import * as React from 'react';\n\nimport { Combobox as ComboboxPrimitive } from '@base-ui/react';\nimport { clsx } from 'clsx';\nimport { CheckIcon, ChevronDownIcon } from 'lucide-react';\nimport { twMerge } from 'tailwind-merge';\n\nconst Combobox = ComboboxPrimitive.Root;\n\nfunction ComboboxInput({\n triggerLabel,\n ...props\n}: ComboboxPrimitive.Input.Props & { triggerLabel: string }) {\n return (\n <div\n data-slot=\"combobox-input-wrapper\"\n className=\"flex h-9 w-full items-center rounded-md border border-input bg-transparent shadow-xs focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50\"\n >\n <ComboboxPrimitive.Input\n data-slot=\"combobox-input\"\n className=\"h-full min-w-0 flex-1 bg-transparent px-3 py-1 text-sm outline-none placeholder:text-muted-foreground\"\n {...props}\n />\n <ComboboxPrimitive.Trigger\n aria-label={triggerLabel}\n className=\"flex h-full w-9 items-center justify-center text-muted-foreground\"\n >\n <ChevronDownIcon className=\"size-4\" />\n </ComboboxPrimitive.Trigger>\n </div>\n );\n}\n\nfunction ComboboxContent({\n className,\n portalContainer,\n ...props\n}: ComboboxPrimitive.Popup.Props & {\n portalContainer?: ComboboxPrimitive.Portal.Props['container'];\n}) {\n return (\n <ComboboxPrimitive.Portal container={portalContainer}>\n <ComboboxPrimitive.Positioner\n side=\"bottom\"\n sideOffset={6}\n align=\"start\"\n className=\"isolate z-50\"\n >\n <ComboboxPrimitive.Popup\n data-slot=\"combobox-content\"\n className={twMerge(\n clsx(\n 'group/combobox-content max-h-96 w-(--anchor-width) min-w-80 overflow-hidden rounded-md bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10',\n className,\n ),\n )}\n {...props}\n />\n </ComboboxPrimitive.Positioner>\n </ComboboxPrimitive.Portal>\n );\n}\n\nfunction ComboboxList(props: ComboboxPrimitive.List.Props) {\n return (\n <ComboboxPrimitive.List\n data-slot=\"combobox-list\"\n className=\"max-h-80 overflow-y-auto p-1\"\n {...props}\n />\n );\n}\n\nfunction ComboboxItem({\n className,\n children,\n ...props\n}: ComboboxPrimitive.Item.Props) {\n return (\n <ComboboxPrimitive.Item\n data-slot=\"combobox-item\"\n className={twMerge(\n clsx(\n 'relative flex w-full cursor-default items-center rounded-sm py-1.5 pr-8 pl-2 text-sm outline-none data-highlighted:bg-accent data-highlighted:text-accent-foreground',\n className,\n ),\n )}\n {...props}\n >\n {children}\n <ComboboxPrimitive.ItemIndicator className=\"absolute right-2 flex size-4 items-center justify-center\">\n <CheckIcon className=\"size-4\" />\n </ComboboxPrimitive.ItemIndicator>\n </ComboboxPrimitive.Item>\n );\n}\n\nfunction ComboboxGroup(props: ComboboxPrimitive.Group.Props) {\n return <ComboboxPrimitive.Group data-slot=\"combobox-group\" {...props} />;\n}\n\nfunction ComboboxLabel(props: ComboboxPrimitive.GroupLabel.Props) {\n return (\n <ComboboxPrimitive.GroupLabel\n data-slot=\"combobox-label\"\n className=\"px-2 py-1.5 text-xs text-muted-foreground\"\n {...props}\n />\n );\n}\n\nfunction ComboboxCollection(props: ComboboxPrimitive.Collection.Props) {\n return <ComboboxPrimitive.Collection {...props} />;\n}\n\nfunction ComboboxEmpty(props: ComboboxPrimitive.Empty.Props) {\n return (\n <ComboboxPrimitive.Empty\n className=\"hidden w-full justify-center py-3 text-sm text-muted-foreground group-data-empty/combobox-content:flex\"\n {...props}\n />\n );\n}\n\nexport {\n Combobox,\n ComboboxCollection,\n ComboboxContent,\n ComboboxEmpty,\n ComboboxGroup,\n ComboboxInput,\n ComboboxItem,\n ComboboxLabel,\n ComboboxList,\n};\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
declare function Table({ className, ...props }: React.ComponentProps<'table'>): React.JSX.Element;
|
|
3
|
+
declare function TableHeader({ className, ...props }: React.ComponentProps<'thead'>): React.JSX.Element;
|
|
4
|
+
declare function TableBody({ className, ...props }: React.ComponentProps<'tbody'>): React.JSX.Element;
|
|
5
|
+
declare function TableRow({ className, ...props }: React.ComponentProps<'tr'>): React.JSX.Element;
|
|
6
|
+
declare function TableHead({ className, ...props }: React.ComponentProps<'th'>): React.JSX.Element;
|
|
7
|
+
declare function TableCell({ className, ...props }: React.ComponentProps<'td'>): React.JSX.Element;
|
|
8
|
+
export { Table, TableBody, TableCell, TableHead, TableHeader, TableRow };
|
|
9
|
+
//# sourceMappingURL=table.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../src/components/ui/table.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,iBAAS,KAAK,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,qBAapE;AAED,iBAAS,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,qBAQ1E;AAED,iBAAS,SAAS,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,qBAQxE;AAED,iBAAS,QAAQ,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,qBAapE;AAED,iBAAS,SAAS,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,qBAarE;AAED,iBAAS,SAAS,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,qBAQrE;AAED,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { clsx } from 'clsx';
|
|
3
|
+
import { twMerge } from 'tailwind-merge';
|
|
4
|
+
function Table({ className, ...props }) {
|
|
5
|
+
return (_jsx("div", { "data-slot": "table-container", className: "relative w-full overflow-x-auto", children: _jsx("table", { "data-slot": "table", className: twMerge(clsx('w-full caption-bottom text-sm', className)), ...props }) }));
|
|
6
|
+
}
|
|
7
|
+
function TableHeader({ className, ...props }) {
|
|
8
|
+
return (_jsx("thead", { "data-slot": "table-header", className: twMerge(clsx('[&_tr]:border-b', className)), ...props }));
|
|
9
|
+
}
|
|
10
|
+
function TableBody({ className, ...props }) {
|
|
11
|
+
return (_jsx("tbody", { "data-slot": "table-body", className: twMerge(clsx('[&_tr:last-child]:border-0', className)), ...props }));
|
|
12
|
+
}
|
|
13
|
+
function TableRow({ className, ...props }) {
|
|
14
|
+
return (_jsx("tr", { "data-slot": "table-row", className: twMerge(clsx('border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted', className)), ...props }));
|
|
15
|
+
}
|
|
16
|
+
function TableHead({ className, ...props }) {
|
|
17
|
+
return (_jsx("th", { "data-slot": "table-head", className: twMerge(clsx('h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground', className)), ...props }));
|
|
18
|
+
}
|
|
19
|
+
function TableCell({ className, ...props }) {
|
|
20
|
+
return (_jsx("td", { "data-slot": "table-cell", className: twMerge(clsx('p-2 align-middle whitespace-nowrap', className)), ...props }));
|
|
21
|
+
}
|
|
22
|
+
export { Table, TableBody, TableCell, TableHead, TableHeader, TableRow };
|
|
23
|
+
//# sourceMappingURL=table.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table.js","sourceRoot":"","sources":["../../../src/components/ui/table.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC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,CAAC,IAAI,CAAC,oCAAoC,EAAE,SAAS,CAAC,CAAC,KACrE,KAAK,GACT,CACH,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC","sourcesContent":["import * as React from 'react';\n\nimport { clsx } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\nfunction Table({ className, ...props }: React.ComponentProps<'table'>) {\n return (\n <div\n data-slot=\"table-container\"\n className=\"relative w-full overflow-x-auto\"\n >\n <table\n data-slot=\"table\"\n className={twMerge(clsx('w-full caption-bottom text-sm', className))}\n {...props}\n />\n </div>\n );\n}\n\nfunction TableHeader({ className, ...props }: React.ComponentProps<'thead'>) {\n return (\n <thead\n data-slot=\"table-header\"\n className={twMerge(clsx('[&_tr]:border-b', className))}\n {...props}\n />\n );\n}\n\nfunction TableBody({ className, ...props }: React.ComponentProps<'tbody'>) {\n return (\n <tbody\n data-slot=\"table-body\"\n className={twMerge(clsx('[&_tr:last-child]:border-0', className))}\n {...props}\n />\n );\n}\n\nfunction TableRow({ className, ...props }: React.ComponentProps<'tr'>) {\n return (\n <tr\n data-slot=\"table-row\"\n className={twMerge(\n clsx(\n 'border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted',\n className,\n ),\n )}\n {...props}\n />\n );\n}\n\nfunction TableHead({ className, ...props }: React.ComponentProps<'th'>) {\n return (\n <th\n data-slot=\"table-head\"\n className={twMerge(\n clsx(\n 'h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground',\n className,\n ),\n )}\n {...props}\n />\n );\n}\n\nfunction TableCell({ className, ...props }: React.ComponentProps<'td'>) {\n return (\n <td\n data-slot=\"table-cell\"\n className={twMerge(clsx('p-2 align-middle whitespace-nowrap', className))}\n {...props}\n />\n );\n}\n\nexport { Table, TableBody, TableCell, TableHead, TableHeader, TableRow };\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entry.rsc.d.ts","sourceRoot":"","sources":["../src/entry.rsc.tsx"],"names":[],"mappings":"AAGA,OAAO,sCAAsC,CAAC;AAI9C,OAAO,cAAc,CAAC;AA0BtB,wBAA8B,mBAAmB,CAAC,OAAO,EAAE,OAAO,qBAwEjE"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { renderToReadableStream } from '@vitejs/plugin-rsc/rsc/server';
|
|
3
|
+
import { SystemSpecSchema } from '@zerospin/core/system/SystemSpecSchema';
|
|
4
|
+
import { SystemDiagrams } from '@zerospin/system-diagrams';
|
|
5
|
+
import '@zerospin/system-diagrams/styles.css';
|
|
6
|
+
import * as Schema from 'effect/Schema';
|
|
7
|
+
import serializedSystemSpec from 'virtual:zerospin-studio-system-spec';
|
|
8
|
+
import './styles.css';
|
|
9
|
+
const systemSpec = Schema.decodeUnknownSync(Schema.fromJsonString(SystemSpecSchema))(serializedSystemSpec);
|
|
10
|
+
function StudioDocument(props) {
|
|
11
|
+
const { sectionId } = props;
|
|
12
|
+
return (_jsxs("html", { lang: "en", children: [_jsxs("head", { children: [_jsx("meta", { charSet: "UTF-8" }), _jsx("meta", { name: "viewport", content: "width=device-width, initial-scale=1.0" }), _jsx("title", { children: `${systemSpec.systemName} · Zerospin Declaration Board` }), import.meta.viteRsc.loadCss()] }), _jsx("body", { children: _jsx(SystemDiagrams, { systemSpec: systemSpec, navigation: { sectionId, basePath: '' } }) })] }));
|
|
13
|
+
}
|
|
14
|
+
export default async function handleStudioRequest(request) {
|
|
15
|
+
const url = new URL(request.url);
|
|
16
|
+
if (request.method !== 'GET') {
|
|
17
|
+
return new Response('Method not allowed', {
|
|
18
|
+
status: 405,
|
|
19
|
+
headers: { Allow: 'GET' },
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
const isRsc = url.pathname === '/index.rsc';
|
|
23
|
+
const pathname = isRsc
|
|
24
|
+
? (url.searchParams.get('pathname') ?? '/')
|
|
25
|
+
: url.pathname;
|
|
26
|
+
let sectionId;
|
|
27
|
+
if (pathname === '/') {
|
|
28
|
+
const aggregate = Object.keys(systemSpec.aggregates).sort((left, right) => left.localeCompare(right))[0];
|
|
29
|
+
const service = Object.keys(systemSpec.services).sort((left, right) => left.localeCompare(right))[0];
|
|
30
|
+
const firstPage = aggregate !== undefined
|
|
31
|
+
? `/aggregates/${encodeURIComponent(aggregate)}`
|
|
32
|
+
: service !== undefined
|
|
33
|
+
? `/services/${encodeURIComponent(service)}`
|
|
34
|
+
: undefined;
|
|
35
|
+
if (firstPage !== undefined) {
|
|
36
|
+
return new Response(null, {
|
|
37
|
+
status: 302,
|
|
38
|
+
headers: {
|
|
39
|
+
Location: isRsc
|
|
40
|
+
? `/index.rsc?pathname=${encodeURIComponent(firstPage)}`
|
|
41
|
+
: firstPage,
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
const route = /^\/(aggregates|services)\/([^/]+)$/.exec(pathname);
|
|
48
|
+
if (!route)
|
|
49
|
+
return new Response('Not found', { status: 404 });
|
|
50
|
+
const group = route[1];
|
|
51
|
+
const encodedName = route[2];
|
|
52
|
+
if (encodedName === undefined)
|
|
53
|
+
return new Response('Not found', { status: 404 });
|
|
54
|
+
let name;
|
|
55
|
+
try {
|
|
56
|
+
name = decodeURIComponent(encodedName);
|
|
57
|
+
}
|
|
58
|
+
catch {
|
|
59
|
+
return new Response('Invalid page name', { status: 400 });
|
|
60
|
+
}
|
|
61
|
+
const owners = group === 'aggregates' ? systemSpec.aggregates : systemSpec.services;
|
|
62
|
+
if (!Object.hasOwn(owners, name))
|
|
63
|
+
return new Response('Not found', { status: 404 });
|
|
64
|
+
sectionId = `system-board-${group === 'aggregates' ? 'aggregate' : 'service'}-${encodeURIComponent(name)}`;
|
|
65
|
+
}
|
|
66
|
+
if (isRsc) {
|
|
67
|
+
const rscStream = renderToReadableStream(_jsx(StudioDocument, { sectionId: sectionId }));
|
|
68
|
+
return new Response(rscStream, {
|
|
69
|
+
headers: { 'Content-Type': 'text/x-component;charset=utf-8' },
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
const { makeStudioHtml } = await import.meta.viteRsc.loadModule('ssr', 'index');
|
|
73
|
+
return new Response(makeStudioHtml(), {
|
|
74
|
+
headers: { 'Content-Type': 'text/html;charset=utf-8' },
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=entry.rsc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entry.rsc.js","sourceRoot":"","sources":["../src/entry.rsc.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,sCAAsC,CAAC;AAC9C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,oBAAoB,MAAM,qCAAqC,CAAC;AAEvE,OAAO,cAAc,CAAC;AAEtB,MAAM,UAAU,GAAG,MAAM,CAAC,iBAAiB,CACzC,MAAM,CAAC,cAAc,CAAC,gBAAgB,CAAC,CACxC,CAAC,oBAAoB,CAAC,CAAC;AAExB,SAAS,cAAc,CAAC,KAAwC;IAC9D,MAAM,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;IAC5B,OAAO,CACL,gBAAM,IAAI,EAAC,IAAI,aACb,2BACE,eAAM,OAAO,EAAC,OAAO,GAAG,EACxB,eAAM,IAAI,EAAC,UAAU,EAAC,OAAO,EAAC,uCAAuC,GAAG,EACxE,0BAAQ,GAAG,UAAU,CAAC,UAAU,+BAA+B,GAAS,EACvE,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,IACzB,EACP,yBACE,KAAC,cAAc,IACb,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AAE,IAAI,CAAC;YAC9B,OAAO,IAAI,QAAQ,CAAC,WAAW,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;QACpD,SAAS,GAAG,gBAAgB,KAAK,KAAK,YAAY,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,IAAI,kBAAkB,CAAC,IAAI,CAAC,EAAE,CAAC;IAC7G,CAAC;IAED,IAAI,KAAK,EAAE,CAAC;QACV,MAAM,SAAS,GAAG,sBAAsB,CACtC,KAAC,cAAc,IAAC,SAAS,EAAE,SAAS,GAAI,CACzC,CAAC;QACF,OAAO,IAAI,QAAQ,CAAC,SAAS,EAAE;YAC7B,OAAO,EAAE,EAAE,cAAc,EAAE,gCAAgC,EAAE;SAC9D,CAAC,CAAC;IACL,CAAC;IAED,MAAM,EAAE,cAAc,EAAE,GAAG,MAAM,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAE7D,KAAK,EAAE,OAAO,CAAC,CAAC;IAClB,OAAO,IAAI,QAAQ,CAAC,cAAc,EAAE,EAAE;QACpC,OAAO,EAAE,EAAE,cAAc,EAAE,yBAAyB,EAAE;KACvD,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { renderToReadableStream } from '@vitejs/plugin-rsc/rsc/server';\nimport { SystemSpecSchema } from '@zerospin/core/system/SystemSpecSchema';\nimport { SystemDiagrams } from '@zerospin/system-diagrams';\nimport '@zerospin/system-diagrams/styles.css';\nimport * as Schema from 'effect/Schema';\nimport serializedSystemSpec from 'virtual:zerospin-studio-system-spec';\n\nimport './styles.css';\n\nconst systemSpec = Schema.decodeUnknownSync(\n Schema.fromJsonString(SystemSpecSchema),\n)(serializedSystemSpec);\n\nfunction StudioDocument(props: { sectionId: string | undefined }) {\n const { sectionId } = props;\n return (\n <html lang=\"en\">\n <head>\n <meta charSet=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n <title>{`${systemSpec.systemName} · Zerospin Declaration Board`}</title>\n {import.meta.viteRsc.loadCss()}\n </head>\n <body>\n <SystemDiagrams\n systemSpec={systemSpec}\n navigation={{ sectionId, basePath: '' }}\n />\n </body>\n </html>\n );\n}\n\nexport default async function handleStudioRequest(request: Request) {\n const url = new URL(request.url);\n if (request.method !== 'GET') {\n return new Response('Method not allowed', {\n status: 405,\n headers: { Allow: 'GET' },\n });\n }\n\n const isRsc = url.pathname === '/index.rsc';\n const pathname = isRsc\n ? (url.searchParams.get('pathname') ?? '/')\n : url.pathname;\n let sectionId: string | undefined;\n if (pathname === '/') {\n const aggregate = Object.keys(systemSpec.aggregates).sort((left, right) =>\n left.localeCompare(right),\n )[0];\n const service = Object.keys(systemSpec.services).sort((left, right) =>\n left.localeCompare(right),\n )[0];\n const firstPage =\n aggregate !== undefined\n ? `/aggregates/${encodeURIComponent(aggregate)}`\n : service !== undefined\n ? `/services/${encodeURIComponent(service)}`\n : undefined;\n if (firstPage !== undefined) {\n return new Response(null, {\n status: 302,\n headers: {\n Location: isRsc\n ? `/index.rsc?pathname=${encodeURIComponent(firstPage)}`\n : firstPage,\n },\n });\n }\n } else {\n const route = /^\\/(aggregates|services)\\/([^/]+)$/.exec(pathname);\n if (!route) return new Response('Not found', { status: 404 });\n const group = route[1];\n const encodedName = route[2];\n if (encodedName === undefined)\n return new Response('Not found', { status: 404 });\n let name: string;\n try {\n name = decodeURIComponent(encodedName);\n } catch {\n return new Response('Invalid page name', { status: 400 });\n }\n const owners =\n group === 'aggregates' ? systemSpec.aggregates : systemSpec.services;\n if (!Object.hasOwn(owners, name))\n return new Response('Not found', { status: 404 });\n sectionId = `system-board-${group === 'aggregates' ? 'aggregate' : 'service'}-${encodeURIComponent(name)}`;\n }\n\n if (isRsc) {\n const rscStream = renderToReadableStream(\n <StudioDocument sectionId={sectionId} />,\n );\n return new Response(rscStream, {\n headers: { 'Content-Type': 'text/x-component;charset=utf-8' },\n });\n }\n\n const { makeStudioHtml } = await import.meta.viteRsc.loadModule<\n typeof import('./entry.ssr.js')\n >('ssr', 'index');\n return new Response(makeStudioHtml(), {\n headers: { 'Content-Type': 'text/html;charset=utf-8' },\n });\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entry.ssr.d.ts","sourceRoot":"","sources":["../src/entry.ssr.tsx"],"names":[],"mappings":"AAEA,wBAAgB,cAAc,WAgB7B"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { getClientEntryUrl } from '@vitejs/plugin-rsc/ssr';
|
|
2
|
+
export function makeStudioHtml() {
|
|
3
|
+
const clientEntryUrl = getClientEntryUrl()
|
|
4
|
+
.replaceAll('&', '&')
|
|
5
|
+
.replaceAll('"', '"');
|
|
6
|
+
return `<!doctype html>
|
|
7
|
+
<html lang="en">
|
|
8
|
+
<head>
|
|
9
|
+
<meta charset="UTF-8" />
|
|
10
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
11
|
+
<title>Zerospin Studio</title>
|
|
12
|
+
</head>
|
|
13
|
+
<body>
|
|
14
|
+
<p role="status">Loading Studio…</p>
|
|
15
|
+
<script type="module" src="${clientEntryUrl}"></script>
|
|
16
|
+
</body>
|
|
17
|
+
</html>`;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=entry.ssr.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entry.ssr.js","sourceRoot":"","sources":["../src/entry.ssr.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D,MAAM,UAAU,cAAc;IAC5B,MAAM,cAAc,GAAG,iBAAiB,EAAE;SACvC,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC;SACxB,UAAU,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;IAC7B,OAAO;;;;;;;;;iCASwB,cAAc;;QAEvC,CAAC;AACT,CAAC","sourcesContent":["import { getClientEntryUrl } from '@vitejs/plugin-rsc/ssr';\n\nexport function makeStudioHtml() {\n const clientEntryUrl = getClientEntryUrl()\n .replaceAll('&', '&')\n .replaceAll('\"', '"');\n return `<!doctype html>\n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n <title>Zerospin Studio</title>\n </head>\n <body>\n <p role=\"status\">Loading Studio…</p>\n <script type=\"module\" src=\"${clientEntryUrl}\"></script>\n </body>\n</html>`;\n}\n"]}
|