@sincpro/web-composer 0.0.0-stage → 1.0.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 (53) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +269 -2
  3. package/dist/domain/enums.d.ts +55 -0
  4. package/dist/domain/enums.js +48 -0
  5. package/dist/domain/index.d.ts +9 -0
  6. package/dist/domain/index.js +8 -0
  7. package/dist/domain/layout.d.ts +92 -0
  8. package/dist/domain/layout.js +216 -0
  9. package/dist/domain/palette.d.ts +42 -0
  10. package/dist/domain/palette.js +89 -0
  11. package/dist/domain/registry.d.ts +135 -0
  12. package/dist/domain/registry.js +37 -0
  13. package/dist/domain/resource.d.ts +21 -0
  14. package/dist/domain/resource.js +62 -0
  15. package/dist/domain/url.d.ts +16 -0
  16. package/dist/domain/url.js +145 -0
  17. package/dist/domain/workspace.d.ts +174 -0
  18. package/dist/domain/workspace.js +393 -0
  19. package/dist/index.d.ts +24 -0
  20. package/dist/index.js +23 -0
  21. package/dist/shell/Composer.d.ts +23 -0
  22. package/dist/shell/Composer.js +88 -0
  23. package/dist/shell/Palette.d.ts +9 -0
  24. package/dist/shell/Palette.js +124 -0
  25. package/dist/shell/PanelFrame.d.ts +38 -0
  26. package/dist/shell/PanelFrame.js +70 -0
  27. package/dist/shell/PanelHost.d.ts +23 -0
  28. package/dist/shell/PanelHost.js +201 -0
  29. package/dist/shell/Peek.d.ts +26 -0
  30. package/dist/shell/Peek.js +64 -0
  31. package/dist/shell/RecordLink.d.ts +12 -0
  32. package/dist/shell/RecordLink.js +55 -0
  33. package/dist/shell/ViewHost.d.ts +11 -0
  34. package/dist/shell/ViewHost.js +53 -0
  35. package/dist/shell/copy.d.ts +73 -0
  36. package/dist/shell/copy.js +130 -0
  37. package/dist/shell/icons.d.ts +22 -0
  38. package/dist/shell/icons.js +19 -0
  39. package/dist/shell/skin.d.ts +72 -0
  40. package/dist/shell/skin.js +35 -0
  41. package/dist/shell/styles.d.ts +19 -0
  42. package/dist/shell/styles.js +212 -0
  43. package/dist/state/api.d.ts +36 -0
  44. package/dist/state/api.js +170 -0
  45. package/dist/state/drag.d.ts +31 -0
  46. package/dist/state/drag.js +95 -0
  47. package/dist/state/store.d.ts +69 -0
  48. package/dist/state/store.js +200 -0
  49. package/dist/state/useKeyboard.d.ts +16 -0
  50. package/dist/state/useKeyboard.js +63 -0
  51. package/dist/state/useWorkspace.d.ts +23 -0
  52. package/dist/state/useWorkspace.js +34 -0
  53. package/package.json +83 -4
@@ -0,0 +1,53 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { formatRef, loadView, rootRef, } from "../domain/index.js";
3
+ import { composerCopy } from "./copy.js";
4
+ import { useSkin } from "./skin.js";
5
+ import { Component, lazy, memo, Suspense, useMemo, } from "react";
6
+ /**
7
+ * The only thing that turns a reference into pixels. Resolves against the
8
+ * registry, isolates failure, and lends the navigation API — the view never
9
+ * receives workspace state, or two domains would couple through it.
10
+ *
11
+ * Three distinct states because each one is someone else's job: unregistered
12
+ * is wiring, loading is normal, broken is a domain bug.
13
+ *
14
+ * The view is keyed by the resource WITHOUT its params: another record is another view, but
15
+ * another face of the same one — a filter, a tab, `api.setParams` — is the same view receiving
16
+ * a new `resource`. Remounting there threw away the search typed, the scroll and the selection.
17
+ */
18
+ /** What stands where a view could not be drawn. Plain text: it must work even when nothing
19
+ * else does. */
20
+ function DefaultNotice({ heading, detail, bad = false }) {
21
+ return (_jsxs("div", { role: "status", className: "sc-notice", ...(bad ? { "data-tone": "bad" } : {}), children: [_jsx("strong", { children: heading }), _jsx("code", { children: detail })] }));
22
+ }
23
+ class ErrorBoundary extends Component {
24
+ state = { error: null };
25
+ static getDerivedStateFromError(error) {
26
+ return { error };
27
+ }
28
+ componentDidCatch(error, info) {
29
+ console.error(`[view ${this.props.name}] failed to render`, error, info.componentStack);
30
+ }
31
+ componentDidUpdate(prev) {
32
+ if (prev.name !== this.props.name && this.state.error !== null) {
33
+ this.setState({ error: null });
34
+ }
35
+ }
36
+ render() {
37
+ if (this.state.error === null)
38
+ return this.props.children;
39
+ const { Notice } = this.props;
40
+ return (_jsx(Notice, { bad: true, heading: composerCopy().view.failed, detail: `${this.props.name} — ${this.state.error.message}` }));
41
+ }
42
+ }
43
+ function Host({ resource, registry, api, fallback }) {
44
+ const key = formatRef(resource);
45
+ const spec = registry.resolve(resource);
46
+ const Notice = useSkin().Notice ?? DefaultNotice;
47
+ const View = useMemo(() => (spec === null ? null : lazy(async () => ({ default: await loadView(spec) }))), [spec]);
48
+ if (spec === null || View === null) {
49
+ return (_jsx(Notice, { heading: composerCopy().view.unresolved, detail: `${key} — is the «${resource.domain}» domain missing from the registry?` }));
50
+ }
51
+ return (_jsx(ErrorBoundary, { name: key, Notice: Notice, children: _jsx(Suspense, { fallback: fallback ?? _jsx("p", { className: "sc-loading", children: composerCopy().view.loading(spec.domain) }), children: _jsx(View, { resource: resource, api: api }, formatRef(rootRef(resource))) }) }));
52
+ }
53
+ export const ViewHost = memo(Host);
@@ -0,0 +1,73 @@
1
+ /**
2
+ * Every word the composer draws, in one table. English by
3
+ * default; an application installs its language ONCE with `installComposerCopy`, next to the
4
+ * design system's `installCopy`, and no component carries a hard-coded string.
5
+ */
6
+ export type ComposerCopy = {
7
+ panel: {
8
+ more: string;
9
+ moveTo: string;
10
+ left: string;
11
+ leftHint: string;
12
+ right: string;
13
+ rightHint: string;
14
+ bottom: string;
15
+ bottomHint: string;
16
+ window: string;
17
+ windowHint: string;
18
+ expand: string;
19
+ minimize: string;
20
+ restore: string;
21
+ enlarge: string;
22
+ close: string;
23
+ resizeZone: (zone: string) => string;
24
+ resizeBetween: string;
25
+ dropLeft: string;
26
+ dropRight: string;
27
+ dropBottom: string;
28
+ };
29
+ peek: {
30
+ openAsPage: string;
31
+ openAsPanel: string;
32
+ close: string;
33
+ back: (to: string) => string;
34
+ };
35
+ discard: {
36
+ title: string;
37
+ detail: (names: readonly string[]) => string;
38
+ keep: string;
39
+ discard: string;
40
+ };
41
+ link: {
42
+ peek: string;
43
+ side: string;
44
+ window: string;
45
+ };
46
+ view: {
47
+ failed: string;
48
+ unresolved: string;
49
+ loading: (domain: string) => string;
50
+ };
51
+ palette: {
52
+ label: string;
53
+ placeholder: string;
54
+ sections: {
55
+ actions: string;
56
+ goto: string;
57
+ found: string;
58
+ };
59
+ empty: string;
60
+ searching: string;
61
+ hint: string;
62
+ };
63
+ shortcuts: readonly {
64
+ keys: string;
65
+ action: string;
66
+ }[];
67
+ };
68
+ export declare const ENGLISH_COMPOSER_COPY: ComposerCopy;
69
+ export declare const SPANISH_COMPOSER_COPY: ComposerCopy;
70
+ /** Install the composer's words once, where the application starts. */
71
+ export declare function installComposerCopy(copy: ComposerCopy): void;
72
+ /** The words in use. A plain read: they are installed before anything draws. */
73
+ export declare const composerCopy: () => ComposerCopy;
@@ -0,0 +1,130 @@
1
+ /**
2
+ * Every word the composer draws, in one table. English by
3
+ * default; an application installs its language ONCE with `installComposerCopy`, next to the
4
+ * design system's `installCopy`, and no component carries a hard-coded string.
5
+ */
6
+ export const ENGLISH_COMPOSER_COPY = {
7
+ panel: {
8
+ more: "More",
9
+ moveTo: "move to",
10
+ left: "To the left",
11
+ leftHint: "docked to the left edge",
12
+ right: "To the right",
13
+ rightHint: "docked to the right edge",
14
+ bottom: "To the bottom",
15
+ bottomHint: "docked to the foot",
16
+ window: "Window",
17
+ windowHint: "floating; drag it by the title",
18
+ expand: "Expand to a page",
19
+ minimize: "Minimize",
20
+ restore: "Restore",
21
+ enlarge: "Enlarge",
22
+ close: "Close",
23
+ resizeZone: (zone) => `Resize the ${zone} zone`,
24
+ resizeBetween: "Resize between two panels",
25
+ dropLeft: "to the left",
26
+ dropRight: "to the right",
27
+ dropBottom: "to the bottom",
28
+ },
29
+ peek: {
30
+ openAsPage: "Open as page",
31
+ openAsPanel: "Open as panel",
32
+ close: "Close the preview",
33
+ back: (to) => `Back to ${to}`,
34
+ },
35
+ discard: {
36
+ title: "Discard the changes?",
37
+ detail: (names) => `What was typed in ${names.join(", ")} has not been saved.`,
38
+ keep: "Keep editing",
39
+ discard: "Discard",
40
+ },
41
+ link: { peek: "Peek", side: "Open beside", window: "Open in a window" },
42
+ view: {
43
+ failed: "This view failed to render",
44
+ unresolved: "Nobody can resolve this reference",
45
+ loading: (domain) => `loading ${domain}…`,
46
+ },
47
+ palette: {
48
+ label: "Command palette",
49
+ placeholder: "Go to, search, or act on what you are on…",
50
+ sections: { actions: "Do", goto: "Go to", found: "Found" },
51
+ empty: "Nothing matches",
52
+ searching: "searching…",
53
+ hint: "↵ page · ⌥↵ peek · ⇧↵ beside · ⌘↵ window · esc close",
54
+ },
55
+ shortcuts: [
56
+ { keys: "⌘K", action: "go to, search, or act on what you are on" },
57
+ { keys: "⌥←", action: "one page back, or one step back in the peek" },
58
+ { keys: "⌘⌥[ / ⌘⌥]", action: "move focus between the page and the panels" },
59
+ { keys: "⌘⇧⏎", action: "maximize the focused surface, or restore it" },
60
+ { keys: "⌘⇧⌫", action: "close the focused panel or the peek" },
61
+ { keys: "Esc", action: "close the peek, or restore the maximized view" },
62
+ { keys: "← → on a handle", action: "resize without the mouse" },
63
+ ],
64
+ };
65
+ export const SPANISH_COMPOSER_COPY = {
66
+ panel: {
67
+ more: "Más",
68
+ moveTo: "mover a",
69
+ left: "A la izquierda",
70
+ leftHint: "acoplado al borde izquierdo",
71
+ right: "A la derecha",
72
+ rightHint: "acoplado al borde derecho",
73
+ bottom: "Abajo",
74
+ bottomHint: "acoplado al pie",
75
+ window: "Ventana",
76
+ windowHint: "flotante; se arrastra por el título",
77
+ expand: "Agrandar a página",
78
+ minimize: "Minimizar",
79
+ restore: "Restaurar",
80
+ enlarge: "Maximizar",
81
+ close: "Cerrar",
82
+ resizeZone: (zone) => `Redimensionar la zona ${{ left: "izquierda", right: "derecha", bottom: "inferior" }[zone] ?? zone}`,
83
+ resizeBetween: "Redimensionar entre dos paneles",
84
+ dropLeft: "a la izquierda",
85
+ dropRight: "a la derecha",
86
+ dropBottom: "abajo",
87
+ },
88
+ peek: {
89
+ openAsPage: "Abrir como página",
90
+ openAsPanel: "Abrir como panel",
91
+ close: "Cerrar la vista previa",
92
+ back: (to) => `Volver a ${to}`,
93
+ },
94
+ discard: {
95
+ title: "¿Descartar los cambios?",
96
+ detail: (names) => `Lo escrito en ${names.join(", ")} no se guardó.`,
97
+ keep: "Seguir editando",
98
+ discard: "Descartar",
99
+ },
100
+ link: { peek: "Vistazo", side: "Abrir al lado", window: "Abrir en una ventana" },
101
+ view: {
102
+ failed: "Esta vista no se pudo dibujar",
103
+ unresolved: "Nadie sabe resolver esta referencia",
104
+ loading: (domain) => `cargando ${domain}…`,
105
+ },
106
+ palette: {
107
+ label: "Paleta de comandos",
108
+ placeholder: "Ir a, buscar o actuar sobre lo que miras…",
109
+ sections: { actions: "Hacer", goto: "Ir a", found: "Encontrado" },
110
+ empty: "Nada coincide",
111
+ searching: "buscando…",
112
+ hint: "↵ página · ⌥↵ vistazo · ⇧↵ al lado · ⌘↵ ventana · esc cerrar",
113
+ },
114
+ shortcuts: [
115
+ { keys: "⌘K", action: "ir a, buscar o actuar sobre lo que miras" },
116
+ { keys: "⌥←", action: "una página atrás, o un paso atrás en el vistazo" },
117
+ { keys: "⌘⌥[ / ⌘⌥]", action: "mover el foco entre la página y los paneles" },
118
+ { keys: "⌘⇧⏎", action: "maximizar la superficie con foco, o restaurarla" },
119
+ { keys: "⌘⇧⌫", action: "cerrar el panel con foco o el vistazo" },
120
+ { keys: "Esc", action: "cerrar el vistazo, o restaurar la vista maximizada" },
121
+ { keys: "← → en un divisor", action: "redimensionar sin el mouse" },
122
+ ],
123
+ };
124
+ let installed = ENGLISH_COMPOSER_COPY;
125
+ /** Install the composer's words once, where the application starts. */
126
+ export function installComposerCopy(copy) {
127
+ installed = copy;
128
+ }
129
+ /** The words in use. A plain read: they are installed before anything draws. */
130
+ export const composerCopy = () => installed;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * The few glyphs the frames need, drawn here so the composer depends on no icon library. Same
3
+ * shape as any icon component (`className`, `strokeWidth`), so an application can pass its own
4
+ * wherever the composer takes an icon.
5
+ */
6
+ export type IconProps = {
7
+ className?: string;
8
+ strokeWidth?: number;
9
+ };
10
+ export declare const MoreIcon: ({ className, strokeWidth }: IconProps) => import("react").JSX.Element;
11
+ export declare const ExpandIcon: ({ className, strokeWidth }: IconProps) => import("react").JSX.Element;
12
+ export declare const MinimizeIcon: ({ className, strokeWidth }: IconProps) => import("react").JSX.Element;
13
+ export declare const MaximizeIcon: ({ className, strokeWidth }: IconProps) => import("react").JSX.Element;
14
+ export declare const RestoreIcon: ({ className, strokeWidth }: IconProps) => import("react").JSX.Element;
15
+ export declare const CloseIcon: ({ className, strokeWidth }: IconProps) => import("react").JSX.Element;
16
+ export declare const LeftIcon: ({ className, strokeWidth }: IconProps) => import("react").JSX.Element;
17
+ export declare const RightIcon: ({ className, strokeWidth }: IconProps) => import("react").JSX.Element;
18
+ export declare const BottomIcon: ({ className, strokeWidth }: IconProps) => import("react").JSX.Element;
19
+ export declare const WindowIcon: ({ className, strokeWidth }: IconProps) => import("react").JSX.Element;
20
+ export declare const BackIcon: ({ className, strokeWidth }: IconProps) => import("react").JSX.Element;
21
+ export declare const SearchIcon: ({ className, strokeWidth }: IconProps) => import("react").JSX.Element;
22
+ export declare const PeekIcon: ({ className, strokeWidth }: IconProps) => import("react").JSX.Element;
@@ -0,0 +1,19 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ function glyph(paths) {
3
+ return function Icon({ className, strokeWidth = 2 }) {
4
+ return (_jsx("svg", { viewBox: "0 0 24 24", width: "16", height: "16", fill: "none", stroke: "currentColor", strokeWidth: strokeWidth, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, ...(className === undefined ? {} : { className }), children: paths }));
5
+ };
6
+ }
7
+ export const MoreIcon = glyph(_jsxs(_Fragment, { children: [_jsx("circle", { cx: "5", cy: "12", r: "1" }), _jsx("circle", { cx: "12", cy: "12", r: "1" }), _jsx("circle", { cx: "19", cy: "12", r: "1" })] }));
8
+ export const ExpandIcon = glyph(_jsx("path", { d: "M7 17 17 7M8 7h9v9" }));
9
+ export const MinimizeIcon = glyph(_jsx("path", { d: "M5 12h14" }));
10
+ export const MaximizeIcon = glyph(_jsx("rect", { x: "5", y: "5", width: "14", height: "14", rx: "2" }));
11
+ export const RestoreIcon = glyph(_jsxs(_Fragment, { children: [_jsx("rect", { x: "8", y: "8", width: "12", height: "12", rx: "2" }), _jsx("path", { d: "M4 16V6a2 2 0 0 1 2-2h10" })] }));
12
+ export const CloseIcon = glyph(_jsx("path", { d: "M18 6 6 18M6 6l12 12" }));
13
+ export const LeftIcon = glyph(_jsxs(_Fragment, { children: [_jsx("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2" }), _jsx("path", { d: "M9 3v18" })] }));
14
+ export const RightIcon = glyph(_jsxs(_Fragment, { children: [_jsx("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2" }), _jsx("path", { d: "M15 3v18" })] }));
15
+ export const BottomIcon = glyph(_jsxs(_Fragment, { children: [_jsx("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2" }), _jsx("path", { d: "M3 15h18" })] }));
16
+ export const WindowIcon = glyph(_jsxs(_Fragment, { children: [_jsx("rect", { x: "3", y: "5", width: "18", height: "14", rx: "2" }), _jsx("rect", { x: "12", y: "11", width: "6", height: "5", rx: "1" })] }));
17
+ export const BackIcon = glyph(_jsx("path", { d: "M19 12H5M12 19l-7-7 7-7" }));
18
+ export const SearchIcon = glyph(_jsxs(_Fragment, { children: [_jsx("circle", { cx: "11", cy: "11", r: "7" }), _jsx("path", { d: "m20 20-3.5-3.5" })] }));
19
+ export const PeekIcon = glyph(_jsxs(_Fragment, { children: [_jsx("path", { d: "M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12Z" }), _jsx("circle", { cx: "12", cy: "12", r: "3" })] }));
@@ -0,0 +1,72 @@
1
+ import { type IconProps } from "./icons.js";
2
+ import type { ComponentType, ReactNode } from "react";
3
+ /**
4
+ * What the composer draws, open to be replaced. The composer owns the BEHAVIOUR — where a thing
5
+ * opens, how it moves, what is remembered — and ships a minimal look so it works out of the box.
6
+ * The look is the application's: every piece here can be swapped, one at a time, and what is
7
+ * not passed keeps the default.
8
+ *
9
+ * <Composer skin={{ icons: { close: X, more: Ellipsis }, Peek: MyDrawer }} … />
10
+ *
11
+ * Three levels, from least to most work: the `--sc-*` variables (colors, radius), these pieces,
12
+ * and `styles: false` to drop the default sheet and style the `sc-*` classes from scratch.
13
+ */
14
+ export type Icon = ComponentType<IconProps>;
15
+ export type SkinIcons = {
16
+ more: Icon;
17
+ expand: Icon;
18
+ minimize: Icon;
19
+ maximize: Icon;
20
+ restore: Icon;
21
+ close: Icon;
22
+ left: Icon;
23
+ right: Icon;
24
+ bottom: Icon;
25
+ window: Icon;
26
+ back: Icon;
27
+ search: Icon;
28
+ peek: Icon;
29
+ };
30
+ /** The drawer a peek is read in. It must not block what is behind it, take the focus on open,
31
+ * and close on Escape while the focus is inside — claiming the key with `preventDefault`. */
32
+ export type PeekProps = {
33
+ title: string;
34
+ onClose: () => void;
35
+ /** «Open as panel», «Back to …», «Open as page»: already wired, only to be placed. */
36
+ actions?: ReactNode;
37
+ children: ReactNode;
38
+ };
39
+ /** The question before throwing away what was typed. `onAnswer(false)` is the safe answer and
40
+ * what Escape gives. */
41
+ export type ConfirmProps = {
42
+ open: boolean;
43
+ title: string;
44
+ detail: string;
45
+ keep: string;
46
+ discard: string;
47
+ onAnswer: (ok: boolean) => void;
48
+ };
49
+ /** What stands where a view could not be drawn: a reference nobody resolves, or a view that
50
+ * threw. */
51
+ export type NoticeProps = {
52
+ heading: string;
53
+ detail: string;
54
+ bad?: boolean;
55
+ };
56
+ export type Skin = {
57
+ icons: SkinIcons;
58
+ Peek: ComponentType<PeekProps> | null;
59
+ Confirm: ComponentType<ConfirmProps> | null;
60
+ Notice: ComponentType<NoticeProps> | null;
61
+ /** `false` drops the default sheet: the `sc-*` classes are then yours to style. */
62
+ styles: boolean;
63
+ };
64
+ /** What `<Composer skin>` takes: any part, the rest stays default. */
65
+ export type ComposerSkin = Partial<Omit<Skin, "icons">> & {
66
+ icons?: Partial<SkinIcons>;
67
+ };
68
+ export declare const DEFAULT_ICONS: SkinIcons;
69
+ export declare function resolveSkin(skin: ComposerSkin | undefined): Skin;
70
+ export declare const SkinProvider: import("react").Provider<Skin>;
71
+ /** The skin in use. Outside a `<Composer>` — a `RecordLink` in a test — the default. */
72
+ export declare const useSkin: () => Skin;
@@ -0,0 +1,35 @@
1
+ import { BackIcon, BottomIcon, CloseIcon, ExpandIcon, LeftIcon, MaximizeIcon, MinimizeIcon, MoreIcon, PeekIcon, RestoreIcon, RightIcon, SearchIcon, WindowIcon, } from "./icons.js";
2
+ import { createContext, useContext } from "react";
3
+ export const DEFAULT_ICONS = {
4
+ more: MoreIcon,
5
+ expand: ExpandIcon,
6
+ minimize: MinimizeIcon,
7
+ maximize: MaximizeIcon,
8
+ restore: RestoreIcon,
9
+ close: CloseIcon,
10
+ left: LeftIcon,
11
+ right: RightIcon,
12
+ bottom: BottomIcon,
13
+ window: WindowIcon,
14
+ back: BackIcon,
15
+ search: SearchIcon,
16
+ peek: PeekIcon,
17
+ };
18
+ /** `null` components mean «the composer's own»; they are resolved where they are drawn, so this
19
+ * file does not import the shell. */
20
+ const DEFAULT_SKIN = {
21
+ icons: DEFAULT_ICONS,
22
+ Peek: null,
23
+ Confirm: null,
24
+ Notice: null,
25
+ styles: true,
26
+ };
27
+ export function resolveSkin(skin) {
28
+ if (skin === undefined)
29
+ return DEFAULT_SKIN;
30
+ return { ...DEFAULT_SKIN, ...skin, icons: { ...DEFAULT_ICONS, ...skin.icons } };
31
+ }
32
+ const SkinContext = createContext(DEFAULT_SKIN);
33
+ export const SkinProvider = SkinContext.Provider;
34
+ /** The skin in use. Outside a `<Composer>` — a `RecordLink` in a test — the default. */
35
+ export const useSkin = () => useContext(SkinContext);
@@ -0,0 +1,19 @@
1
+ /**
2
+ * The composer's own skin: the frames, the drawer, the rail, the dialog and ⌘K, with no design
3
+ * system behind it. It is the minimum that makes the windows usable — the views inside them are
4
+ * the application's, drawn with whatever it uses.
5
+ *
6
+ * Every color, radius and shadow is a CSS variable with a default, so an application themes it
7
+ * from anywhere above the workspace (`:root` included) without a stylesheet of its own:
8
+ *
9
+ * :root {
10
+ * --sc-surface: var(--my-surface);
11
+ * --sc-accent: var(--my-brand);
12
+ * }
13
+ *
14
+ * The classes (`sc-*`) are stable: they are how a skin is overridden. The sheet is a React 19
15
+ * `<style href precedence>`: hoisted to <head> and drawn once however many workspaces there are,
16
+ * so nothing has to be imported.
17
+ */
18
+ /** Drawn by `<Composer>`. Exported for an application that draws the parts on their own. */
19
+ export declare function ComposerStyles(): import("react").JSX.Element;
@@ -0,0 +1,212 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /**
3
+ * The composer's own skin: the frames, the drawer, the rail, the dialog and ⌘K, with no design
4
+ * system behind it. It is the minimum that makes the windows usable — the views inside them are
5
+ * the application's, drawn with whatever it uses.
6
+ *
7
+ * Every color, radius and shadow is a CSS variable with a default, so an application themes it
8
+ * from anywhere above the workspace (`:root` included) without a stylesheet of its own:
9
+ *
10
+ * :root {
11
+ * --sc-surface: var(--my-surface);
12
+ * --sc-accent: var(--my-brand);
13
+ * }
14
+ *
15
+ * The classes (`sc-*`) are stable: they are how a skin is overridden. The sheet is a React 19
16
+ * `<style href precedence>`: hoisted to <head> and drawn once however many workspaces there are,
17
+ * so nothing has to be imported.
18
+ */
19
+ const CSS = `
20
+ .sc-root {
21
+ --_ground: var(--sc-ground, light-dark(#f6f6f4, #161615));
22
+ --_surface: var(--sc-surface, light-dark(#ffffff, #1f1f1d));
23
+ --_line: var(--sc-line, light-dark(#e4e3df, #2f2f2c));
24
+ --_line-strong: var(--sc-line-strong, light-dark(#cfcdc7, #44433f));
25
+ --_ink: var(--sc-ink, light-dark(#1d1d1b, #ecebe7));
26
+ --_muted: var(--sc-muted, light-dark(#6b6a66, #a3a29d));
27
+ --_accent: var(--sc-accent, light-dark(#2b4a8b, #8fb0f0));
28
+ --_danger: var(--sc-danger, light-dark(#b3261e, #f2958e));
29
+ --_on-danger: var(--sc-on-danger, #ffffff);
30
+ --_scrim: var(--sc-scrim, rgb(0 0 0 / 0.32));
31
+ --_shadow: var(--sc-shadow, 0 10px 30px rgb(0 0 0 / 0.16));
32
+ --_radius: var(--sc-radius, 8px);
33
+ --_radius-control: var(--sc-radius-control, 6px);
34
+ --_text: var(--sc-text, 13px);
35
+ --_text-small: var(--sc-text-small, 12px);
36
+ --_tint: color-mix(in srgb, var(--_accent) 10%, transparent);
37
+ --_hover: color-mix(in srgb, var(--_ink) 7%, transparent);
38
+
39
+ position: relative;
40
+ display: flex;
41
+ flex: 1;
42
+ flex-direction: column;
43
+ min-height: 0;
44
+ background: var(--_ground);
45
+ color: var(--_ink);
46
+ font-size: var(--_text);
47
+ }
48
+ .sc-root *, .sc-root *::before, .sc-root *::after { box-sizing: border-box; }
49
+ .sc-root :focus-visible { outline: 2px solid var(--_accent); outline-offset: 1px; }
50
+
51
+ .sc-empty { display: flex; flex: 1; min-height: 0; align-items: center; justify-content: center; padding: 32px; }
52
+ .sc-host { position: relative; flex: 1; min-height: 0; overflow: hidden; }
53
+ .sc-slot { position: absolute; isolation: isolate; min-height: 0; }
54
+ .sc-slot[data-page] { overflow: auto; }
55
+ .sc-slot[data-pad="all"] { padding: 4px; }
56
+ .sc-slot[data-pad="x"] { padding: 0 4px; }
57
+ .sc-slot[data-pad="y"] { padding: 4px 0; }
58
+
59
+ .sc-frame {
60
+ display: flex; flex-direction: column; height: 100%; min-height: 0; min-width: 0;
61
+ overflow: hidden; background: var(--_surface);
62
+ border: 1px solid var(--_line-strong); border-radius: var(--_radius);
63
+ }
64
+ .sc-frame[data-focused] { border-color: var(--_accent); box-shadow: 0 0 0 1px var(--_tint); }
65
+ .sc-frame[data-floating] { box-shadow: var(--_shadow); }
66
+ .sc-frame[data-dragging] { opacity: 0.4; }
67
+
68
+ .sc-header {
69
+ position: relative; display: flex; flex-shrink: 0; align-items: center; gap: 2px;
70
+ height: 34px; padding: 0 3px 0 10px; background: var(--_ground);
71
+ border-bottom: 1px solid var(--_line); user-select: none; cursor: grab;
72
+ }
73
+ .sc-header[data-floating] { cursor: move; touch-action: none; }
74
+ .sc-header[data-rail] {
75
+ flex: 1; flex-direction: column; height: auto; padding: 3px 0; border-bottom: 0;
76
+ }
77
+ .sc-title {
78
+ flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
79
+ font-size: var(--_text-small); font-weight: 500;
80
+ }
81
+ .sc-header[data-rail] .sc-title { min-height: 0; padding: 4px 0; writing-mode: vertical-rl; }
82
+ .sc-body { flex: 1; min-height: 0; overflow: auto; container-type: inline-size; }
83
+
84
+ .sc-control {
85
+ display: inline-flex; flex-shrink: 0; align-items: center; justify-content: center;
86
+ width: 26px; height: 26px; padding: 0; border: 0; border-radius: var(--_radius-control);
87
+ background: transparent; color: var(--_muted); cursor: pointer;
88
+ }
89
+ .sc-control:hover { background: var(--_hover); color: var(--_ink); }
90
+ .sc-control[aria-pressed="true"], .sc-control[aria-expanded="true"] { background: var(--_tint); color: var(--_accent); }
91
+ .sc-control[data-danger]:hover { color: var(--_danger); }
92
+
93
+ .sc-menu {
94
+ position: absolute; top: calc(100% + 2px); right: 4px; z-index: 50; min-width: 220px;
95
+ margin: 0; padding: 4px; list-style: none; background: var(--_surface);
96
+ border: 1px solid var(--_line-strong); border-radius: var(--_radius); box-shadow: var(--_shadow);
97
+ cursor: default;
98
+ }
99
+ .sc-menu-label { padding: 6px 8px 2px; color: var(--_muted); font-size: var(--_text-small); }
100
+ .sc-menu-item {
101
+ display: flex; width: 100%; align-items: center; gap: 8px; padding: 6px 8px;
102
+ border: 0; border-radius: var(--_radius-control); background: transparent;
103
+ color: var(--_ink); font: inherit; text-align: left; cursor: pointer;
104
+ }
105
+ .sc-menu-item:hover, .sc-menu-item:focus { background: var(--_hover); outline: 0; }
106
+ .sc-menu-item[aria-checked="true"] { color: var(--_accent); font-weight: 600; }
107
+ .sc-menu-hint { margin-left: auto; color: var(--_muted); font-size: var(--_text-small); font-weight: 400; }
108
+
109
+ .sc-handle { position: absolute; z-index: 10; transition: background-color 80ms; touch-action: none; }
110
+ .sc-handle[data-axis="x"] { cursor: col-resize; }
111
+ .sc-handle[data-axis="y"] { cursor: row-resize; }
112
+ .sc-handle:hover { background: color-mix(in srgb, var(--_accent) 25%, transparent); }
113
+ .sc-root .sc-handle:focus-visible { background: color-mix(in srgb, var(--_accent) 35%, transparent); outline: 0; }
114
+
115
+ .sc-grip { position: absolute; z-index: 10; touch-action: none; }
116
+ .sc-grip[data-grip="e"] { top: 0; right: 0; width: 8px; height: 100%; cursor: e-resize; }
117
+ .sc-grip[data-grip="s"] { bottom: 0; left: 0; width: 100%; height: 8px; cursor: s-resize; }
118
+ .sc-grip[data-grip="se"] { right: 0; bottom: 0; width: 16px; height: 16px; cursor: se-resize; }
119
+
120
+ .sc-drops { position: absolute; inset: 0; pointer-events: none; }
121
+ .sc-drop {
122
+ position: absolute; z-index: 30; display: flex; align-items: center; justify-content: center;
123
+ border: 2px dashed transparent; border-radius: var(--_radius); pointer-events: none;
124
+ color: var(--_accent); font-size: var(--_text-small); font-weight: 500;
125
+ }
126
+ .sc-drop[data-armed] { pointer-events: auto; }
127
+ .sc-drop[data-over] { border-color: var(--_accent); background: var(--_tint); }
128
+
129
+ .sc-overlay { position: absolute; z-index: 40; pointer-events: none; }
130
+ .sc-overlay > * { pointer-events: auto; }
131
+
132
+ .sc-peek {
133
+ position: absolute; top: 0; right: 0; bottom: 0; z-index: 30;
134
+ display: flex; flex-direction: column; width: min(30rem, 100%); overflow: hidden;
135
+ background: var(--_surface); border-left: 1px solid var(--_line-strong);
136
+ border-radius: var(--_radius) 0 0 var(--_radius); box-shadow: var(--_shadow); outline: 0;
137
+ }
138
+ .sc-peek-head { display: flex; flex-shrink: 0; align-items: center; gap: 8px; padding: 8px 8px 8px 12px; border-bottom: 1px solid var(--_line); }
139
+ .sc-peek-title {
140
+ flex: 1; min-width: 0; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
141
+ font-size: var(--_text); font-weight: 600;
142
+ }
143
+ .sc-peek-actions { display: flex; flex-shrink: 0; flex-wrap: wrap; gap: 6px; padding: 6px 12px; border-bottom: 1px solid var(--_line); }
144
+ .sc-peek-body { flex: 1; min-height: 0; overflow: auto; padding: 12px; container-type: inline-size; }
145
+
146
+ .sc-button {
147
+ display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px;
148
+ border: 1px solid var(--_line-strong); border-radius: var(--_radius-control);
149
+ background: var(--_surface); color: var(--_ink); font: inherit; font-size: var(--_text-small);
150
+ font-weight: 500; white-space: nowrap; cursor: pointer;
151
+ }
152
+ .sc-button:hover { background: var(--_hover); }
153
+ .sc-button[data-role="ghost"] { border-color: transparent; background: transparent; color: var(--_accent); }
154
+ .sc-button[data-role="ghost"]:hover { background: var(--_tint); }
155
+ .sc-button[data-role="danger"] { border-color: var(--_danger); background: var(--_danger); color: var(--_on-danger); }
156
+
157
+ .sc-dialog {
158
+ width: min(26rem, calc(100% - 32px)); padding: 0; border: 0; border-radius: var(--_radius);
159
+ background: var(--_surface); color: var(--_ink); box-shadow: var(--_shadow);
160
+ }
161
+ .sc-dialog::backdrop { background: var(--_scrim); }
162
+ .sc-dialog-title { margin: 0; padding: 16px 16px 0; font-size: 16px; font-weight: 600; }
163
+ .sc-dialog-body { margin: 0; padding: 10px 16px 16px; color: var(--_muted); }
164
+ .sc-dialog-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--_line); background: var(--_ground); }
165
+
166
+ .sc-notice { padding: 24px; color: var(--_muted); text-align: center; }
167
+ .sc-notice strong { display: block; margin-bottom: 4px; color: var(--_ink); }
168
+ .sc-notice[data-tone="bad"] strong { color: var(--_danger); }
169
+ .sc-notice code { font-size: var(--_text-small); }
170
+ .sc-loading { padding: 16px; color: var(--_muted); font-size: var(--_text-small); }
171
+
172
+ .sc-scrim {
173
+ position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-start;
174
+ justify-content: center; padding: 96px 16px 0; background: var(--_scrim);
175
+ }
176
+ .sc-palette {
177
+ width: 100%; max-width: 36rem; overflow: hidden; background: var(--_surface);
178
+ border: 1px solid var(--_line-strong); border-radius: var(--_radius); box-shadow: var(--_shadow);
179
+ }
180
+ .sc-palette-search { display: flex; align-items: center; gap: 8px; padding: 0 12px; border-bottom: 1px solid var(--_line); color: var(--_muted); }
181
+ .sc-palette-search input {
182
+ flex: 1; min-width: 0; height: 44px; border: 0; background: transparent; color: var(--_ink);
183
+ font: inherit; font-size: 14px;
184
+ }
185
+ .sc-palette-search input:focus { outline: 0; }
186
+ .sc-palette-list { max-height: 24rem; margin: 0; padding: 4px; overflow-y: auto; list-style: none; }
187
+ .sc-palette-section { margin: 0; padding: 8px 8px 4px; color: var(--_muted); font-size: var(--_text-small); font-weight: 500; }
188
+ .sc-option { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: var(--_radius-control); cursor: default; }
189
+ .sc-option[aria-selected="true"] { background: var(--_tint); }
190
+ .sc-option-icon { display: flex; flex-shrink: 0; width: 16px; justify-content: center; color: var(--_muted); }
191
+ .sc-option-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
192
+ .sc-option-detail { flex-shrink: 0; color: var(--_muted); font-size: var(--_text-small); }
193
+ .sc-kbd { flex-shrink: 0; padding: 0 6px; border: 1px solid var(--_line); border-radius: var(--_radius-control); color: var(--_muted); font-size: var(--_text-small); }
194
+ .sc-palette-empty { padding: 24px 12px; color: var(--_muted); font-style: italic; text-align: center; }
195
+ .sc-palette-hint { margin: 0; padding: 6px 12px; border-top: 1px solid var(--_line); color: var(--_muted); font-size: var(--_text-small); }
196
+
197
+ .sc-link { display: inline-flex; min-width: 0; align-items: center; gap: 4px; }
198
+ .sc-link[data-dragging] { opacity: 0.4; }
199
+ .sc-link-name {
200
+ min-width: 0; padding: 0; overflow: hidden; border: 0; background: transparent;
201
+ color: var(--_accent); font: inherit; text-align: left; text-overflow: ellipsis;
202
+ white-space: nowrap; cursor: pointer;
203
+ }
204
+ .sc-link-name:hover { text-decoration: underline; text-underline-offset: 4px; }
205
+ .sc-link-icons { display: inline-flex; flex-shrink: 0; opacity: 0; transition: opacity 80ms; }
206
+ .sc-link:hover .sc-link-icons, .sc-link:focus-within .sc-link-icons { opacity: 1; }
207
+ .sc-link-icons .sc-control { width: 22px; height: 22px; }
208
+ `;
209
+ /** Drawn by `<Composer>`. Exported for an application that draws the parts on their own. */
210
+ export function ComposerStyles() {
211
+ return (_jsx("style", { href: "sincpro-web-composer", precedence: "low", children: CSS }));
212
+ }