@xemahq/ui-kernel 0.5.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. package/dist/lib/biome-host/define-web-biome.d.ts +3 -3
  2. package/dist/lib/biome-host/define-web-biome.d.ts.map +1 -1
  3. package/dist/lib/biome-host/define-web-biome.js +23 -2
  4. package/dist/lib/biome-host/define-web-biome.js.map +1 -1
  5. package/dist/lib/biome-host/frontend-biome.d.ts +4 -3
  6. package/dist/lib/biome-host/frontend-biome.d.ts.map +1 -1
  7. package/dist/lib/biome-host/host-bridge.d.ts +2 -0
  8. package/dist/lib/biome-host/host-bridge.d.ts.map +1 -1
  9. package/dist/lib/biome-host/host-bridge.js.map +1 -1
  10. package/dist/lib/biome-host/i18n-hooks.d.ts +4 -0
  11. package/dist/lib/biome-host/i18n-hooks.d.ts.map +1 -0
  12. package/dist/lib/biome-host/i18n-hooks.js +22 -0
  13. package/dist/lib/biome-host/i18n-hooks.js.map +1 -0
  14. package/dist/lib/biome-host/i18n-port.d.ts +15 -0
  15. package/dist/lib/biome-host/i18n-port.d.ts.map +1 -0
  16. package/dist/lib/biome-host/i18n-port.js +29 -0
  17. package/dist/lib/biome-host/i18n-port.js.map +1 -0
  18. package/dist/lib/biome-host/index.d.ts +2 -1
  19. package/dist/lib/biome-host/index.d.ts.map +1 -1
  20. package/dist/lib/biome-host/index.js +2 -1
  21. package/dist/lib/biome-host/index.js.map +1 -1
  22. package/dist/lib/biome-host/realtime-port.d.ts +1 -1
  23. package/dist/lib/biome-host/realtime-port.d.ts.map +1 -1
  24. package/dist/session-kit/approvals/approval-model.d.ts.map +1 -1
  25. package/dist/session-kit/approvals/approval-model.js.map +1 -1
  26. package/dist/ui/branding/app-branding-provider.d.ts +17 -0
  27. package/dist/ui/branding/app-branding-provider.d.ts.map +1 -0
  28. package/dist/ui/branding/app-branding-provider.js +81 -0
  29. package/dist/ui/branding/app-branding-provider.js.map +1 -0
  30. package/dist/ui/branding/sanitize.d.ts +4 -0
  31. package/dist/ui/branding/sanitize.d.ts.map +1 -0
  32. package/dist/ui/branding/sanitize.js +47 -0
  33. package/dist/ui/branding/sanitize.js.map +1 -0
  34. package/dist/ui/breakpoints.d.ts +2 -0
  35. package/dist/ui/breakpoints.d.ts.map +1 -0
  36. package/dist/ui/breakpoints.js +5 -0
  37. package/dist/ui/breakpoints.js.map +1 -0
  38. package/dist/ui/charts/bar-chart.d.ts +7 -0
  39. package/dist/ui/charts/bar-chart.d.ts.map +1 -0
  40. package/dist/ui/charts/bar-chart.js +47 -0
  41. package/dist/ui/charts/bar-chart.js.map +1 -0
  42. package/dist/ui/charts/chart-frame.d.ts +25 -0
  43. package/dist/ui/charts/chart-frame.d.ts.map +1 -0
  44. package/dist/ui/charts/chart-frame.js +23 -0
  45. package/dist/ui/charts/chart-frame.js.map +1 -0
  46. package/dist/ui/charts/chart-types.d.ts +19 -0
  47. package/dist/ui/charts/chart-types.d.ts.map +1 -0
  48. package/dist/ui/charts/chart-types.js +3 -0
  49. package/dist/ui/charts/chart-types.js.map +1 -0
  50. package/dist/ui/charts/chart-utils.d.ts +22 -0
  51. package/dist/ui/charts/chart-utils.d.ts.map +1 -0
  52. package/dist/ui/charts/chart-utils.js +97 -0
  53. package/dist/ui/charts/chart-utils.js.map +1 -0
  54. package/dist/ui/charts/donut-chart.d.ts +7 -0
  55. package/dist/ui/charts/donut-chart.d.ts.map +1 -0
  56. package/dist/ui/charts/donut-chart.js +55 -0
  57. package/dist/ui/charts/donut-chart.js.map +1 -0
  58. package/dist/ui/charts/index.d.ts +8 -0
  59. package/dist/ui/charts/index.d.ts.map +1 -0
  60. package/dist/ui/charts/index.js +21 -0
  61. package/dist/ui/charts/index.js.map +1 -0
  62. package/dist/ui/charts/line-chart.d.ts +7 -0
  63. package/dist/ui/charts/line-chart.d.ts.map +1 -0
  64. package/dist/ui/charts/line-chart.js +70 -0
  65. package/dist/ui/charts/line-chart.js.map +1 -0
  66. package/dist/ui/charts/sparkline.d.ts +13 -0
  67. package/dist/ui/charts/sparkline.d.ts.map +1 -0
  68. package/dist/ui/charts/sparkline.js +39 -0
  69. package/dist/ui/charts/sparkline.js.map +1 -0
  70. package/dist/ui/hooks/use-is-mobile.d.ts +2 -0
  71. package/dist/ui/hooks/use-is-mobile.d.ts.map +1 -0
  72. package/dist/ui/hooks/use-is-mobile.js +19 -0
  73. package/dist/ui/hooks/use-is-mobile.js.map +1 -0
  74. package/dist/ui/index.d.ts +6 -0
  75. package/dist/ui/index.d.ts.map +1 -1
  76. package/dist/ui/index.js +14 -1
  77. package/dist/ui/index.js.map +1 -1
  78. package/dist/ui/pdf/pdf-preview.d.ts +8 -0
  79. package/dist/ui/pdf/pdf-preview.d.ts.map +1 -0
  80. package/dist/ui/pdf/pdf-preview.js +34 -0
  81. package/dist/ui/pdf/pdf-preview.js.map +1 -0
  82. package/dist/ui/primitives/preview-device-frame.d.ts +9 -0
  83. package/dist/ui/primitives/preview-device-frame.d.ts.map +1 -0
  84. package/dist/ui/primitives/preview-device-frame.js +90 -0
  85. package/dist/ui/primitives/preview-device-frame.js.map +1 -0
  86. package/package.json +8 -7
  87. package/src/lib/biome-host/define-web-biome.test.js +93 -0
  88. package/src/lib/biome-host/define-web-biome.ts +76 -15
  89. package/src/lib/biome-host/frontend-biome.ts +47 -18
  90. package/src/lib/biome-host/host-bridge.ts +13 -0
  91. package/src/lib/biome-host/i18n-hooks.ts +50 -0
  92. package/src/lib/biome-host/i18n-port.test.ts +50 -0
  93. package/src/lib/biome-host/i18n-port.ts +96 -0
  94. package/src/lib/biome-host/index.ts +2 -1
  95. package/src/lib/biome-host/realtime-port.ts +9 -3
  96. package/src/lib/system-bus/enums.ts +1 -1
  97. package/src/lib/system-bus/index.ts +1 -1
  98. package/src/lib/system-bus/intents.ts +1 -1
  99. package/src/session-kit/approvals/ApprovalCard.tsx +1 -1
  100. package/src/session-kit/approvals/ApprovalsCenter.tsx +2 -2
  101. package/src/session-kit/approvals/CapabilityApprovalStickyBar.tsx +1 -1
  102. package/src/session-kit/approvals/Obligation.tsx +1 -1
  103. package/src/session-kit/approvals/ScopedBody.tsx +1 -1
  104. package/src/session-kit/approvals/approval-model.ts +7 -8
  105. package/src/session-kit/approvals/index.ts +1 -1
  106. package/src/session-kit/approvals/obligation-display.ts +1 -1
  107. package/src/session-kit/approvals/risk-accent.ts +1 -1
  108. package/src/session-kit/combobox/Combobox.tsx +1 -1
  109. package/src/session-kit/display/MessageTurn.tsx +1 -1
  110. package/src/session-kit/display/TokenMeter.tsx +1 -1
  111. package/src/session-kit/index.ts +3 -3
  112. package/src/session-kit/lib/enums.ts +1 -1
  113. package/src/session-kit/lib/status-dot.ts +1 -1
  114. package/src/session-kit/primitives/RiskPill.tsx +1 -1
  115. package/src/ui/branding/app-branding-provider.tsx +146 -0
  116. package/src/ui/branding/sanitize.ts +77 -0
  117. package/src/ui/breakpoints.ts +14 -0
  118. package/src/ui/charts/bar-chart.tsx +135 -0
  119. package/src/ui/charts/chart-frame.tsx +112 -0
  120. package/src/ui/charts/chart-types.ts +52 -0
  121. package/src/ui/charts/chart-utils.ts +158 -0
  122. package/src/ui/charts/charts.test.tsx +204 -0
  123. package/src/ui/charts/donut-chart.tsx +111 -0
  124. package/src/ui/charts/index.ts +27 -0
  125. package/src/ui/charts/line-chart.tsx +180 -0
  126. package/src/ui/charts/sparkline.tsx +101 -0
  127. package/src/ui/hooks/use-is-mobile.ts +28 -0
  128. package/src/ui/index.ts +22 -0
  129. package/src/ui/pdf/pdf-preview.tsx +122 -0
  130. package/src/ui/primitives/preview-device-frame.tsx +205 -0
  131. package/dist/lib/biome-host/composition-validation.d.ts +0 -22
  132. package/dist/lib/biome-host/composition-validation.d.ts.map +0 -1
  133. package/dist/lib/biome-host/composition-validation.js +0 -127
  134. package/dist/lib/biome-host/composition-validation.js.map +0 -1
  135. package/dist/lib/biome-host/nav.d.ts +0 -17
  136. package/dist/lib/biome-host/nav.d.ts.map +0 -1
  137. package/dist/lib/biome-host/nav.js +0 -52
  138. package/dist/lib/biome-host/nav.js.map +0 -1
  139. package/dist/registry/lib/composition-validation-host.d.ts +0 -3
  140. package/dist/registry/lib/composition-validation-host.d.ts.map +0 -1
  141. package/dist/registry/lib/composition-validation-host.js +0 -10
  142. package/dist/registry/lib/composition-validation-host.js.map +0 -1
  143. package/src/lib/biome-host/nav.ts +0 -83
package/src/ui/index.ts CHANGED
@@ -15,8 +15,12 @@ export { cn } from './cn';
15
15
  // ── design tokens (semantic styling SSOT) ──
16
16
  export * from './design-tokens';
17
17
 
18
+ // ── responsive breakpoint token (JS ↔ Tailwind `md`, single source) ──
19
+ export { MOBILE_BREAKPOINT } from './breakpoints';
20
+
18
21
  // ── hooks ──
19
22
  export { useDebouncedValue } from './hooks/use-debounced-value';
23
+ export { useIsMobile } from './hooks/use-is-mobile';
20
24
 
21
25
  // ── shadcn primitives ──
22
26
  export * from './primitives/button';
@@ -46,6 +50,22 @@ export * from './primitives/tag-multi-select';
46
50
  export * from './primitives/sheet';
47
51
  export * from './primitives/form-stepper';
48
52
  export * from './primitives/async-combobox';
53
+ export {
54
+ PreviewDeviceFrame,
55
+ type PreviewDevice,
56
+ } from './primitives/preview-device-frame';
57
+
58
+ // ── chart primitives (Wave 9.2 — pure SVG, no external chart lib) ──
59
+ export * from './charts';
60
+
61
+ // ── runtime branding applier (Wave 8.4) ──
62
+ export {
63
+ AppBrandingProvider,
64
+ useAppBranding,
65
+ APP_PRIMARY_COLOR_VAR,
66
+ type AppBrandingProviderProps,
67
+ type AppBrandingContextValue,
68
+ } from './branding/app-branding-provider';
49
69
 
50
70
  // ── Xema chrome ──
51
71
  export { default as ErrorCard, type ErrorMessageFormatter } from './chrome/ErrorCard';
@@ -66,3 +86,5 @@ export { StateCard } from './chrome/StateCard';
66
86
  export { default as PageHeader, PageToolbar } from './chrome/PageHeader';
67
87
  export { default as LoadingState, type LoadingStateVariant } from './chrome/LoadingState';
68
88
  export { default as AsyncBoundary } from './chrome/AsyncBoundary';
89
+
90
+ export { PdfPreview, type PdfPreviewProps } from './pdf/pdf-preview';
@@ -0,0 +1,122 @@
1
+ 'use client';
2
+
3
+ /**
4
+ * PdfPreview — a reusable, canvas-rendered PDF viewer with in-app zoom, for any
5
+ * web biome or host surface (exported from `@xemahq/ui-kernel/ui`).
6
+ *
7
+ * WHY canvas, not an `<iframe>`: the bytes are frequently UNTRUSTED (user
8
+ * uploads, third-party artifacts). pdf.js renders each page to a `<canvas>` with
9
+ * NO iframe and NO script execution — strictly safer than embedding the file in
10
+ * a browser viewer — while giving zoom controls a fully-sandboxed iframe cannot.
11
+ * Text/annotation layers are disabled: this is a PREVIEW, not an editor.
12
+ *
13
+ * The component only renders from a resolved `url` (durable publicUrl, dataUrl,
14
+ * or `blob:`); the caller owns fetching/authing/revoking that URL.
15
+ */
16
+ import { RotateCcw, ZoomIn, ZoomOut } from 'lucide-react';
17
+ import { useCallback, useMemo, useState, type JSX } from 'react';
18
+ import { Document, Page, pdfjs } from 'react-pdf';
19
+
20
+ import { cn } from '../cn';
21
+
22
+ // The pdf.js worker is loaded same-origin (CSP-safe, and CJS-build-safe — no
23
+ // `import.meta`). The HOST app must serve the version-matched worker at this
24
+ // path — host-web copies `pdfjs-dist/build/pdf.worker.min.mjs` into `public/`
25
+ // via its `copy-pdf-worker` script (run on predev/prebuild). Overridable before
26
+ // first render for hosts that serve it elsewhere.
27
+ if (!pdfjs.GlobalWorkerOptions.workerSrc) {
28
+ pdfjs.GlobalWorkerOptions.workerSrc = '/pdf.worker.min.mjs';
29
+ }
30
+
31
+ const MIN_SCALE = 0.5;
32
+ const MAX_SCALE = 3;
33
+ const STEP = 0.25;
34
+ const DEFAULT_SCALE = 1;
35
+
36
+ const clampScale = (s: number): number =>
37
+ Math.min(MAX_SCALE, Math.max(MIN_SCALE, Math.round(s * 100) / 100));
38
+
39
+ export interface PdfPreviewProps {
40
+ /** A resolved, fetchable URL: durable `publicUrl`, `dataUrl`, or `blob:`. */
41
+ readonly url: string;
42
+ /** Human label shown in the toolbar / used as the document title. */
43
+ readonly title?: string;
44
+ readonly className?: string;
45
+ }
46
+
47
+ export function PdfPreview({ url, title, className }: PdfPreviewProps): JSX.Element {
48
+ const [numPages, setNumPages] = useState(0);
49
+ const [scale, setScale] = useState(DEFAULT_SCALE);
50
+ const [error, setError] = useState<string | null>(null);
51
+
52
+ // Stable `file` identity so react-pdf doesn't re-fetch on every render.
53
+ const file = useMemo(() => ({ url }), [url]);
54
+
55
+ const zoomOut = useCallback(() => setScale((s) => clampScale(s - STEP)), []);
56
+ const zoomIn = useCallback(() => setScale((s) => clampScale(s + STEP)), []);
57
+ const reset = useCallback(() => setScale(DEFAULT_SCALE), []);
58
+
59
+ const btn =
60
+ 'inline-flex h-7 w-7 items-center justify-center rounded text-neutral-600 ' +
61
+ 'hover:bg-neutral-200/70 disabled:pointer-events-none disabled:opacity-40 ' +
62
+ 'focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-1';
63
+
64
+ return (
65
+ <div
66
+ className={cn(
67
+ 'flex h-[520px] flex-col overflow-hidden rounded border border-neutral-200 bg-white',
68
+ className,
69
+ )}
70
+ >
71
+ <div className="flex items-center gap-1 border-b border-neutral-200 bg-neutral-50 px-2 py-1">
72
+ <button type="button" onClick={zoomOut} disabled={scale <= MIN_SCALE} aria-label="Zoom out" className={btn}>
73
+ <ZoomOut className="h-4 w-4" />
74
+ </button>
75
+ <span className="w-12 text-center text-xs tabular-nums text-neutral-500">
76
+ {Math.round(scale * 100)}%
77
+ </span>
78
+ <button type="button" onClick={zoomIn} disabled={scale >= MAX_SCALE} aria-label="Zoom in" className={btn}>
79
+ <ZoomIn className="h-4 w-4" />
80
+ </button>
81
+ <button type="button" onClick={reset} disabled={scale === DEFAULT_SCALE} aria-label="Reset zoom" className={btn}>
82
+ <RotateCcw className="h-4 w-4" />
83
+ </button>
84
+ {title ? (
85
+ <span className="ml-2 min-w-0 flex-1 truncate text-xs text-neutral-400" title={title}>
86
+ {title}
87
+ </span>
88
+ ) : null}
89
+ </div>
90
+
91
+ <div className="flex-1 overflow-auto bg-neutral-100 p-3">
92
+ {error ? (
93
+ <div className="p-4 text-xs text-neutral-500">
94
+ Couldn&apos;t render this PDF ({error}). Use the download affordance.
95
+ </div>
96
+ ) : (
97
+ <Document
98
+ file={file}
99
+ onLoadSuccess={({ numPages: n }) => {
100
+ setNumPages(n);
101
+ setError(null);
102
+ }}
103
+ onLoadError={(e) => setError(e.message)}
104
+ loading={<div className="p-4 text-xs text-neutral-500">Loading PDF…</div>}
105
+ className="flex flex-col items-center gap-3"
106
+ >
107
+ {Array.from({ length: numPages }, (_, i) => (
108
+ <Page
109
+ key={i}
110
+ pageNumber={i + 1}
111
+ scale={scale}
112
+ renderTextLayer={false}
113
+ renderAnnotationLayer={false}
114
+ className="shadow-sm"
115
+ />
116
+ ))}
117
+ </Document>
118
+ )}
119
+ </div>
120
+ </div>
121
+ );
122
+ }
@@ -0,0 +1,205 @@
1
+ // ═══════════════════════════════════════════════════════════════════════════
2
+ // ── PreviewDeviceFrame — CSS-transform-scaled device bezel ──
3
+ //
4
+ // Wraps a child (typically an iframe, but any node works) in a scale-to-fit
5
+ // bezel for Tablet (768×1024) and Mobile (390×844). Desktop renders children
6
+ // at 100% width/height. Presentation renders a responsive 16:9 viewport;
7
+ // A4 renders a 794×1123 portrait sheet — both grow/shrink to fit the panel.
8
+ //
9
+ // IMPORTANT: We scale the *wrapper* via `transform: scale(...)` — the child is
10
+ // always rendered at the bezel's native resolution. This avoids ResizeObserver
11
+ // churn inside an embedded app (width/height stay constant; only the parent's
12
+ // visual size changes). Devices report the bezel's intended CSS pixel
13
+ // dimensions to the child regardless of the visual scale.
14
+ //
15
+ // Owned by the UI kernel so both the host session-preview surface AND biome
16
+ // canvases (e.g. App Forge's builder) reuse ONE bezel — there is no second
17
+ // device-frame implementation.
18
+ // ═══════════════════════════════════════════════════════════════════════════
19
+
20
+ import { useLayoutEffect, useRef, useState, type ReactNode } from 'react';
21
+
22
+ import { cn } from '../cn';
23
+
24
+ /**
25
+ * Closed set of preview viewports. `desktop`/`tablet`/`mobile` are the
26
+ * device widths an app builder offers; `presentation`/`a4` are
27
+ * document-preview viewports used by the session preview surface only.
28
+ */
29
+ export type PreviewDevice =
30
+ | 'desktop'
31
+ | 'tablet'
32
+ | 'mobile'
33
+ | 'presentation'
34
+ | 'a4';
35
+
36
+ interface PreviewDeviceFrameProps {
37
+ readonly device: PreviewDevice;
38
+ readonly children: ReactNode;
39
+ }
40
+
41
+ interface Bezel {
42
+ width: number;
43
+ height: number;
44
+ radius: number;
45
+ }
46
+
47
+ const BEZELS: Record<
48
+ Exclude<PreviewDevice, 'desktop' | 'presentation' | 'a4'>,
49
+ Bezel
50
+ > = {
51
+ tablet: { width: 768, height: 1024, radius: 18 },
52
+ mobile: { width: 390, height: 844, radius: 36 },
53
+ };
54
+
55
+ const PRESENTATION_VIEWPORT: Bezel = { width: 1280, height: 720, radius: 20 };
56
+ // A4 at 96 dpi: 210mm × 297mm → 794×1123 px
57
+ const A4_VIEWPORT: Bezel = { width: 794, height: 1123, radius: 4 };
58
+
59
+ export function PreviewDeviceFrame({
60
+ device,
61
+ children,
62
+ }: PreviewDeviceFrameProps) {
63
+ if (device === 'desktop') {
64
+ return <div className="h-full w-full">{children}</div>;
65
+ }
66
+ if (device === 'presentation') {
67
+ return (
68
+ <ResponsiveViewport bezel={PRESENTATION_VIEWPORT} aspectRatio={16 / 9}>
69
+ {children}
70
+ </ResponsiveViewport>
71
+ );
72
+ }
73
+ if (device === 'a4') {
74
+ return (
75
+ <ResponsiveViewport bezel={A4_VIEWPORT} aspectRatio={794 / 1123}>
76
+ {children}
77
+ </ResponsiveViewport>
78
+ );
79
+ }
80
+ return <ScaledBezel bezel={BEZELS[device]}>{children}</ScaledBezel>;
81
+ }
82
+
83
+ interface ScaledBezelProps {
84
+ readonly bezel: Bezel;
85
+ readonly children: ReactNode;
86
+ }
87
+
88
+ /**
89
+ * Render a fixed-size bezel at (bezel.width × bezel.height) CSS px, then
90
+ * scale the whole wrapper down to fit its container. The child inside stays
91
+ * at the bezel's native resolution.
92
+ */
93
+ function ScaledBezel({ bezel, children }: ScaledBezelProps) {
94
+ const containerRef = useRef<HTMLDivElement | null>(null);
95
+ const [scale, setScale] = useState(1);
96
+
97
+ useLayoutEffect(() => {
98
+ const el = containerRef.current;
99
+ if (!el) return;
100
+ const compute = (): void => {
101
+ const { clientWidth, clientHeight } = el;
102
+ if (clientWidth === 0 || clientHeight === 0) return;
103
+ // Leave a tiny margin so the shadow is not clipped.
104
+ const margin = 24;
105
+ const availW = Math.max(0, clientWidth - margin);
106
+ const availH = Math.max(0, clientHeight - margin);
107
+ const next = Math.min(1, availW / bezel.width, availH / bezel.height);
108
+ setScale(next);
109
+ };
110
+ compute();
111
+ const observer = new ResizeObserver(compute);
112
+ observer.observe(el);
113
+ return () => observer.disconnect();
114
+ }, [bezel.width, bezel.height]);
115
+
116
+ return (
117
+ <div
118
+ ref={containerRef}
119
+ className="flex h-full w-full items-center justify-center overflow-hidden bg-paper-elev/60 p-2"
120
+ >
121
+ <div
122
+ className={cn(
123
+ 'relative shrink-0 overflow-hidden bg-paper shadow-2xl ring-1 ring-border/75',
124
+ )}
125
+ style={{
126
+ width: bezel.width,
127
+ height: bezel.height,
128
+ borderRadius: bezel.radius,
129
+ // Scale the WRAPPER — NOT the child element. The child's own
130
+ // width/height in CSS pixels remain bezel.width × bezel.height, so
131
+ // an embedded app sees a stable viewport and no ResizeObserver churn
132
+ // when the outer panel resizes.
133
+ transform: `scale(${scale})`,
134
+ transformOrigin: 'center center',
135
+ }}
136
+ >
137
+ {children}
138
+ </div>
139
+ </div>
140
+ );
141
+ }
142
+
143
+ interface ResponsiveViewportProps extends ScaledBezelProps {
144
+ /** Width-to-height ratio used to letterbox/pillarbox the frame. */
145
+ readonly aspectRatio: number;
146
+ }
147
+
148
+ /**
149
+ * Fit an arbitrary-aspect-ratio viewport inside the available space and let
150
+ * the child resize to that real size. Content sees the actual viewport
151
+ * dimensions instead of a transform-scaled shell, so it can adapt responsively.
152
+ */
153
+ function ResponsiveViewport({
154
+ bezel,
155
+ aspectRatio,
156
+ children,
157
+ }: ResponsiveViewportProps) {
158
+ const containerRef = useRef<HTMLDivElement | null>(null);
159
+ const [size, setSize] = useState(() => ({
160
+ width: bezel.width,
161
+ height: bezel.height,
162
+ }));
163
+
164
+ useLayoutEffect(() => {
165
+ const el = containerRef.current;
166
+ if (!el) return;
167
+ const compute = (): void => {
168
+ const { clientWidth, clientHeight } = el;
169
+ if (clientWidth === 0 || clientHeight === 0) return;
170
+ const margin = 24;
171
+ const availW = Math.max(0, clientWidth - margin);
172
+ const availH = Math.max(0, clientHeight - margin);
173
+ const nextWidth = Math.min(availW, availH * aspectRatio);
174
+ const nextHeight = nextWidth / aspectRatio;
175
+ setSize({
176
+ width: Math.max(1, Math.round(nextWidth)),
177
+ height: Math.max(1, Math.round(nextHeight)),
178
+ });
179
+ };
180
+ compute();
181
+ const observer = new ResizeObserver(compute);
182
+ observer.observe(el);
183
+ return () => observer.disconnect();
184
+ }, [bezel.width, bezel.height]);
185
+
186
+ return (
187
+ <div
188
+ ref={containerRef}
189
+ className="flex h-full w-full items-center justify-center overflow-hidden bg-paper-elev/60 p-2"
190
+ >
191
+ <div
192
+ className={cn(
193
+ 'relative shrink-0 overflow-hidden bg-paper shadow-2xl ring-1 ring-border/75',
194
+ )}
195
+ style={{
196
+ width: size.width,
197
+ height: size.height,
198
+ borderRadius: bezel.radius,
199
+ }}
200
+ >
201
+ {children}
202
+ </div>
203
+ </div>
204
+ );
205
+ }
@@ -1,22 +0,0 @@
1
- import type { FrontendBiome } from './frontend-biome';
2
- export declare enum CompositionDiagnosticSeverity {
3
- Error = "error",
4
- Warning = "warning"
5
- }
6
- export declare enum CompositionDiagnosticCode {
7
- DuplicateRoutePath = "duplicate_route_path",
8
- DuplicateNavId = "duplicate_nav_id",
9
- UnknownSlot = "unknown_slot",
10
- OrphanedPanelSlot = "orphaned_panel_slot"
11
- }
12
- export interface CompositionDiagnostic {
13
- readonly code: CompositionDiagnosticCode;
14
- readonly severity: CompositionDiagnosticSeverity;
15
- readonly biomeIds: readonly string[];
16
- readonly message: string;
17
- }
18
- export interface ValidateBiomeCompositionOptions {
19
- readonly knownSlots: ReadonlySet<string>;
20
- }
21
- export declare function validateBiomeComposition(biomes: readonly FrontendBiome[], options: ValidateBiomeCompositionOptions): readonly CompositionDiagnostic[];
22
- //# sourceMappingURL=composition-validation.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"composition-validation.d.ts","sourceRoot":"","sources":["../../../src/lib/biome-host/composition-validation.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGtD,oBAAY,6BAA6B;IAMvC,KAAK,UAAU;IAOf,OAAO,YAAY;CACpB;AAGD,oBAAY,yBAAyB;IAEnC,kBAAkB,yBAAyB;IAE3C,cAAc,qBAAqB;IAKnC,WAAW,iBAAiB;IAK5B,iBAAiB,wBAAwB;CAC1C;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,IAAI,EAAE,yBAAyB,CAAC;IACzC,QAAQ,CAAC,QAAQ,EAAE,6BAA6B,CAAC;IAEjD,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IAErC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,+BAA+B;IAM9C,QAAQ,CAAC,UAAU,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC1C;AAwBD,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,SAAS,aAAa,EAAE,EAChC,OAAO,EAAE,+BAA+B,GACvC,SAAS,qBAAqB,EAAE,CA6FlC"}
@@ -1,127 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CompositionDiagnosticCode = exports.CompositionDiagnosticSeverity = void 0;
4
- exports.validateBiomeComposition = validateBiomeComposition;
5
- var CompositionDiagnosticSeverity;
6
- (function (CompositionDiagnosticSeverity) {
7
- CompositionDiagnosticSeverity["Error"] = "error";
8
- CompositionDiagnosticSeverity["Warning"] = "warning";
9
- })(CompositionDiagnosticSeverity || (exports.CompositionDiagnosticSeverity = CompositionDiagnosticSeverity = {}));
10
- var CompositionDiagnosticCode;
11
- (function (CompositionDiagnosticCode) {
12
- CompositionDiagnosticCode["DuplicateRoutePath"] = "duplicate_route_path";
13
- CompositionDiagnosticCode["DuplicateNavId"] = "duplicate_nav_id";
14
- CompositionDiagnosticCode["UnknownSlot"] = "unknown_slot";
15
- CompositionDiagnosticCode["OrphanedPanelSlot"] = "orphaned_panel_slot";
16
- })(CompositionDiagnosticCode || (exports.CompositionDiagnosticCode = CompositionDiagnosticCode = {}));
17
- function biomeOwnedSlotOwner(slot) {
18
- const slashIndex = slot.indexOf('/');
19
- if (slashIndex <= 0)
20
- return null;
21
- if (slot.indexOf('/', slashIndex + 1) !== -1)
22
- return null;
23
- const owner = slot.slice(0, slashIndex);
24
- const name = slot.slice(slashIndex + 1);
25
- if (owner.length === 0 || name.length === 0)
26
- return null;
27
- return owner;
28
- }
29
- function validateBiomeComposition(biomes, options) {
30
- const diagnostics = [];
31
- const biomeIds = new Set(biomes.map((b) => b.id));
32
- const routeOwners = new Map();
33
- for (const biome of biomes) {
34
- for (const route of biome.routes ?? []) {
35
- const scope = route.projectScoped ? 'project' : 'root';
36
- const key = `${scope}:${route.path}`;
37
- const owners = routeOwners.get(key);
38
- if (owners)
39
- owners.push(biome.id);
40
- else
41
- routeOwners.set(key, [biome.id]);
42
- }
43
- }
44
- for (const [key, owners] of routeOwners) {
45
- if (owners.length < 2)
46
- continue;
47
- const [scope, path] = splitFirst(key, ':');
48
- diagnostics.push({
49
- code: CompositionDiagnosticCode.DuplicateRoutePath,
50
- severity: CompositionDiagnosticSeverity.Error,
51
- biomeIds: owners,
52
- message: `Route path '${path}' (${scope}-scoped) is contributed by multiple biomes: ` +
53
- `${owners.join(', ')}. Each route must be unique within its scope — ` +
54
- `only one would mount and the others would be unreachable.`,
55
- });
56
- }
57
- const navOwners = new Map();
58
- for (const biome of biomes) {
59
- for (const navItem of biome.navItems ?? []) {
60
- const owners = navOwners.get(navItem.id);
61
- if (owners)
62
- owners.push(biome.id);
63
- else
64
- navOwners.set(navItem.id, [biome.id]);
65
- }
66
- }
67
- for (const [navId, owners] of navOwners) {
68
- if (owners.length < 2)
69
- continue;
70
- diagnostics.push({
71
- code: CompositionDiagnosticCode.DuplicateNavId,
72
- severity: CompositionDiagnosticSeverity.Error,
73
- biomeIds: owners,
74
- message: `Nav id '${navId}' is contributed by multiple biomes: ${owners.join(', ')}. ` +
75
- `Nav ids must be unique — a duplicate silently overwrites the ` +
76
- `feature-route mapping and collides as a render key.`,
77
- });
78
- }
79
- for (const biome of biomes) {
80
- for (const panel of biome.panels ?? []) {
81
- if (options.knownSlots.has(panel.slot))
82
- continue;
83
- const owner = biomeOwnedSlotOwner(panel.slot);
84
- if (owner === null) {
85
- diagnostics.push({
86
- code: CompositionDiagnosticCode.UnknownSlot,
87
- severity: CompositionDiagnosticSeverity.Warning,
88
- biomeIds: [biome.id],
89
- message: `Biome '${biome.id}' panel '${panel.id}' targets slot '${panel.slot}', ` +
90
- `which is neither a known host slot nor a well-formed ` +
91
- `'<owner>/<name>' biome-owned slot. It will never render — ` +
92
- `check for a typo against the host slot catalog.`,
93
- });
94
- continue;
95
- }
96
- if (!biomeIds.has(owner)) {
97
- diagnostics.push({
98
- code: CompositionDiagnosticCode.OrphanedPanelSlot,
99
- severity: CompositionDiagnosticSeverity.Warning,
100
- biomeIds: [biome.id],
101
- message: `Biome '${biome.id}' panel '${panel.id}' targets biome-owned slot ` +
102
- `'${panel.slot}', but its owner biome '${owner}' is not registered. ` +
103
- `The panel will never render until '${owner}' is enabled.`,
104
- });
105
- }
106
- }
107
- }
108
- return sortDiagnostics(diagnostics);
109
- }
110
- function splitFirst(value, sep) {
111
- const idx = value.indexOf(sep);
112
- if (idx === -1)
113
- return [value, ''];
114
- return [value.slice(0, idx), value.slice(idx + sep.length)];
115
- }
116
- function sortDiagnostics(diagnostics) {
117
- return diagnostics.slice().sort((a, b) => {
118
- if (a.code !== b.code)
119
- return a.code.localeCompare(b.code);
120
- const ai = a.biomeIds.join(',');
121
- const bi = b.biomeIds.join(',');
122
- if (ai !== bi)
123
- return ai.localeCompare(bi);
124
- return a.message.localeCompare(b.message);
125
- });
126
- }
127
- //# sourceMappingURL=composition-validation.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"composition-validation.js","sourceRoot":"","sources":["../../../src/lib/biome-host/composition-validation.ts"],"names":[],"mappings":";;;AAkGA,4DAgGC;AA1KD,IAAY,6BAcX;AAdD,WAAY,6BAA6B;IAMvC,gDAAe,CAAA;IAOf,oDAAmB,CAAA;AACrB,CAAC,EAdW,6BAA6B,6CAA7B,6BAA6B,QAcxC;AAGD,IAAY,yBAeX;AAfD,WAAY,yBAAyB;IAEnC,wEAA2C,CAAA;IAE3C,gEAAmC,CAAA;IAKnC,yDAA4B,CAAA;IAK5B,sEAAyC,CAAA;AAC3C,CAAC,EAfW,yBAAyB,yCAAzB,yBAAyB,QAepC;AA0BD,SAAS,mBAAmB,CAAC,IAAY;IACvC,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACrC,IAAI,UAAU,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IACjC,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC;IAC1D,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;IACxC,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC;IACxC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,IAAI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KAAK,CAAC,KAAK,CAAC,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;AAC9D,CAAC;AAGD,SAAS,eAAe,CACtB,WAAoC;IAEpC,OAAO,WAAW,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QACvC,IAAI,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI;YAAE,OAAO,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QAC3D,MAAM,EAAE,GAAG,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAChC,MAAM,EAAE,GAAG,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAChC,IAAI,EAAE,KAAK,EAAE;YAAE,OAAO,EAAE,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;QAC3C,OAAO,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;IAC5C,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -1,17 +0,0 @@
1
- import type { ComponentType } from 'react';
2
- export interface NavItem {
3
- readonly key: string;
4
- readonly label: string;
5
- readonly icon?: ComponentType<{
6
- className?: string | undefined;
7
- }> | undefined;
8
- readonly weight?: number | undefined;
9
- readonly fromBiome?: boolean | undefined;
10
- }
11
- export interface NavSection {
12
- readonly heading?: string | undefined;
13
- readonly items: readonly NavItem[];
14
- }
15
- export declare function mergeNavSections(coreSections: readonly NavSection[]): readonly NavSection[];
16
- export declare function mergeFeatureRouteMap(coreFeatureRoutes: Readonly<Record<string, string>>): Record<string, string>;
17
- //# sourceMappingURL=nav.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"nav.d.ts","sourceRoot":"","sources":["../../../src/lib/biome-host/nav.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAI3C,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,CAAC,EAAE,aAAa,CAAC;QAAE,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;KAAE,CAAC,GAAG,SAAS,CAAC;IAC9E,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAErC,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAC1C;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,QAAQ,CAAC,KAAK,EAAE,SAAS,OAAO,EAAE,CAAC;CACpC;AAUD,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,SAAS,UAAU,EAAE,GAAG,SAAS,UAAU,EAAE,CAsC3F;AAQD,wBAAgB,oBAAoB,CAClC,iBAAiB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAClD,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAQxB"}
@@ -1,52 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mergeNavSections = mergeNavSections;
4
- exports.mergeFeatureRouteMap = mergeFeatureRouteMap;
5
- const biome_registry_1 = require("./biome-registry");
6
- function mergeNavSections(coreSections) {
7
- const sectionMap = new Map();
8
- const sectionOrder = [];
9
- for (const section of coreSections) {
10
- const heading = section.heading ?? '';
11
- sectionOrder.push(heading);
12
- sectionMap.set(heading, [...section.items]);
13
- }
14
- for (const biome of biome_registry_1.biomeRegistry.list()) {
15
- for (const navItem of biome.navItems ?? []) {
16
- const heading = navItem.section ?? '';
17
- let bucket = sectionMap.get(heading);
18
- if (!bucket) {
19
- bucket = [];
20
- sectionOrder.push(heading);
21
- sectionMap.set(heading, bucket);
22
- }
23
- bucket.push({
24
- key: navItem.id,
25
- label: navItem.label,
26
- icon: navItem.icon,
27
- weight: navItem.weight,
28
- fromBiome: true,
29
- });
30
- }
31
- }
32
- return sectionOrder.map((heading) => ({
33
- heading: heading === '' ? undefined : heading,
34
- items: (sectionMap.get(heading) ?? []).slice().sort((a, b) => {
35
- const wa = a.weight ?? 100;
36
- const wb = b.weight ?? 100;
37
- if (wa !== wb)
38
- return wa - wb;
39
- return a.key.localeCompare(b.key);
40
- }),
41
- }));
42
- }
43
- function mergeFeatureRouteMap(coreFeatureRoutes) {
44
- const out = { ...coreFeatureRoutes };
45
- for (const biome of biome_registry_1.biomeRegistry.list()) {
46
- for (const navItem of biome.navItems ?? []) {
47
- out[navItem.id] = navItem.route;
48
- }
49
- }
50
- return out;
51
- }
52
- //# sourceMappingURL=nav.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"nav.js","sourceRoot":"","sources":["../../../src/lib/biome-host/nav.ts"],"names":[],"mappings":";;AA0BA,4CAsCC;AAQD,oDAUC;AAhFD,qDAAiD;AAwBjD,SAAgB,gBAAgB,CAAC,YAAmC;IAClE,MAAM,UAAU,GAAG,IAAI,GAAG,EAAqB,CAAC;IAChD,MAAM,YAAY,GAAa,EAAE,CAAC;IAElC,KAAK,MAAM,OAAO,IAAI,YAAY,EAAE,CAAC;QACnC,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC;QACtC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC3B,UAAU,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;IAC9C,CAAC;IAED,KAAK,MAAM,KAAK,IAAI,8BAAa,CAAC,IAAI,EAAE,EAAE,CAAC;QACzC,KAAK,MAAM,OAAO,IAAI,KAAK,CAAC,QAAQ,IAAI,EAAE,EAAE,CAAC;YAC3C,MAAM,OAAO,GAAG,OAAO,C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BAAiB,EAAE,CAAC;IAC7D,KAAK,MAAM,KAAK,IAAI,8BAAa,CAAC,IAAI,EAAE,EAAE,CAAC;QACzC,KAAK,MAAM,OAAO,IAAI,KAAK,CAAC,QAAQ,IAAI,EAAE,EAAE,CAAC;YAC3C,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC;QAClC,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -1,3 +0,0 @@
1
- import { type CompositionDiagnostic, type FrontendBiome } from '../../index';
2
- export declare function validateHostBiomeComposition(biomes: readonly FrontendBiome[]): readonly CompositionDiagnostic[];
3
- //# sourceMappingURL=composition-validation-host.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"composition-validation-host.d.ts","sourceRoot":"","sources":["../../../src/registry/lib/composition-validation-host.ts"],"names":[],"mappings":"AAUA,OAAO,EACL,KAAK,qBAAqB,EAC1B,KAAK,aAAa,EAEnB,MAAM,aAAa,CAAC;AAkBrB,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,SAAS,aAAa,EAAE,GAC/B,SAAS,qBAAqB,EAAE,CAElC"}
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateHostBiomeComposition = validateHostBiomeComposition;
4
- const index_1 = require("../../index");
5
- const extension_points_1 = require("./extension-points");
6
- const HOST_SLOT_IDS = new Set(Object.values(extension_points_1.HostExtensionSlots));
7
- function validateHostBiomeComposition(biomes) {
8
- return (0, index_1.validateBiomeComposition)(biomes, { knownSlots: HOST_SLOT_IDS });
9
- }
10
- //# sourceMappingURL=composition-validation-host.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"composition-validation-host.js","sourceRoot":"","sources":["../../../src/registry/lib/composition-validation-host.ts"],"names":[],"mappings":";;AAgCA,oEAIC;AA1BD,uCAIqB;AAErB,yDAAwD;AAOxD,MAAM,aAAa,GAAwB,IAAI,GAAG,CAChD,MAAM,CAAC,MAAM,CAAC,qCAAkB,CAAC,CAClC,CAAC;AAOF,SAAgB,4BAA4B,CAC1C,MAAgC;IAEhC,OAAO,IAAA,gCAAwB,EAAC,MAAM,EAAE,EAAE,UAAU,EAAE,aAAa,EAAE,CAAC,CAAC;AACzE,CAAC"}