@norskvideo/ctl-dev-kit 0.1.98 → 0.1.100
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.
|
@@ -23,7 +23,7 @@ export type ProductShape = "backend-turnkey" | "turnkey";
|
|
|
23
23
|
|
|
24
24
|
// - components the components/ workspace: custom Studio nodes packed into the
|
|
25
25
|
// product-template tar (all three UI surfaces need one).
|
|
26
|
-
// - views the operator screen AS component summary/fullscreen React
|
|
26
|
+
// - views the operator screen AS component inline/summary/fullscreen React
|
|
27
27
|
// rendered inside Studio's own workflow view (oracle).
|
|
28
28
|
// - dashboard the operator screen as a standalone SPA built into
|
|
29
29
|
// dashboards/<workflow>/ and served by Studio (funke, probe).
|
|
@@ -415,7 +415,7 @@ function exampleInfoTs(ctx: ShapeContext): string {
|
|
|
415
415
|
// insertion point cannot produce a lint-clean file.
|
|
416
416
|
const infoImports = [
|
|
417
417
|
'import type Registration from "@norskvideo/norsk-studio/lib/extension/registration";',
|
|
418
|
-
...(hasViews ? [VIEWS_INFO_IMPORTS.fullscreen] : []),
|
|
418
|
+
...(hasViews ? [VIEWS_INFO_IMPORTS.fullscreen, VIEWS_INFO_IMPORTS.inline] : []),
|
|
419
419
|
'import type { ExampleCommand, ExampleEvent, ExampleSettings, ExampleState } from "./runtime";',
|
|
420
420
|
...(hasViews ? [VIEWS_INFO_IMPORTS.summary] : []),
|
|
421
421
|
].join("\n");
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// The `views` feature: the operator screen as React rendered INSIDE Studio's
|
|
2
|
-
// own workflow view —
|
|
3
|
-
//
|
|
4
|
-
//
|
|
2
|
+
// own workflow view — one file per place Studio shows a component: `inline`
|
|
3
|
+
// inside its node on the canvas, `summary` in the sidebar when the node is
|
|
4
|
+
// selected, and a `fullscreen` page at /live/<id>/fullscreen — rather than as a
|
|
5
|
+
// standalone SPA (see dashboard.ts for that answer).
|
|
5
6
|
//
|
|
6
7
|
// It costs no vite workspace and no dashboards/ directory: the screens are
|
|
7
8
|
// compiled into the component's info.client.js by copy-yamls. What it does
|
|
@@ -14,15 +15,16 @@
|
|
|
14
15
|
// sendCommand, so a view never fetches and never opens a socket.
|
|
15
16
|
import type { GeneratedFile, ShapeContext } from "../create-product.ts";
|
|
16
17
|
|
|
17
|
-
const
|
|
18
|
-
//
|
|
18
|
+
const INLINE_TSX = `// PLACEHOLDER — rendered INSIDE the component's node on the canvas. Keep it to a
|
|
19
|
+
// line or two: the node is small, and without this view the node shows only its
|
|
20
|
+
// static config. The sidebar is summary.tsx; the full page is fullscreen.tsx.
|
|
19
21
|
//
|
|
20
22
|
// \`state\` is pushed by Studio from the component's updates.update() calls; this
|
|
21
23
|
// file neither fetches nor subscribes.
|
|
22
24
|
import type { ViewProps } from "@norskvideo/norsk-studio/lib/extension/client-types";
|
|
23
25
|
import type { ExampleCommand, ExampleSettings, ExampleState } from "./runtime";
|
|
24
26
|
|
|
25
|
-
function
|
|
27
|
+
function InlineView({ state }: ViewProps<ExampleSettings, ExampleState, ExampleCommand>) {
|
|
26
28
|
return (
|
|
27
29
|
<div className="text-sm text-gray-700 dark:text-gray-300">
|
|
28
30
|
<span className="font-medium text-gray-900 dark:text-white tabular-nums">{state.ticks}</span> ticks
|
|
@@ -30,6 +32,29 @@ function SummaryView({ state }: ViewProps<ExampleSettings, ExampleState, Example
|
|
|
30
32
|
);
|
|
31
33
|
}
|
|
32
34
|
|
|
35
|
+
export default InlineView;
|
|
36
|
+
`;
|
|
37
|
+
|
|
38
|
+
const SUMMARY_TSX = `// PLACEHOLDER — rendered in Studio's SIDEBAR when the component's node is
|
|
39
|
+
// selected. More room than the node itself (inline.tsx); the fullscreen view is
|
|
40
|
+
// still where full detail belongs.
|
|
41
|
+
//
|
|
42
|
+
// \`state\` is pushed by Studio from the component's updates.update() calls; this
|
|
43
|
+
// file neither fetches nor subscribes.
|
|
44
|
+
import type { ViewProps } from "@norskvideo/norsk-studio/lib/extension/client-types";
|
|
45
|
+
import type { ExampleCommand, ExampleSettings, ExampleState } from "./runtime";
|
|
46
|
+
|
|
47
|
+
function SummaryView({ state, config }: ViewProps<ExampleSettings, ExampleState, ExampleCommand>) {
|
|
48
|
+
return (
|
|
49
|
+
<dl className="grid grid-cols-2 gap-1 text-sm">
|
|
50
|
+
<dt className="text-gray-500 dark:text-gray-400">Heartbeats</dt>
|
|
51
|
+
<dd className="tabular-nums text-gray-900 dark:text-white">{state.ticks}</dd>
|
|
52
|
+
<dt className="text-gray-500 dark:text-gray-400">Interval</dt>
|
|
53
|
+
<dd className="tabular-nums text-gray-900 dark:text-white">{config.heartbeatMs ?? 1000} ms</dd>
|
|
54
|
+
</dl>
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
33
58
|
export default SummaryView;
|
|
34
59
|
`;
|
|
35
60
|
|
|
@@ -69,20 +94,23 @@ export default FullscreenView;
|
|
|
69
94
|
|
|
70
95
|
export function viewsFiles(_ctx: ShapeContext): GeneratedFile[] {
|
|
71
96
|
return [
|
|
97
|
+
{ path: "components/src/library/example/inline.tsx", content: INLINE_TSX },
|
|
72
98
|
{ path: "components/src/library/example/summary.tsx", content: SUMMARY_TSX },
|
|
73
99
|
{ path: "components/src/library/example/fullscreen.tsx", content: FULLSCREEN_TSX },
|
|
74
100
|
];
|
|
75
101
|
}
|
|
76
102
|
|
|
77
|
-
/** Imports the component's info.ts needs when it registers the
|
|
103
|
+
/** Imports the component's info.ts needs when it registers the three views. Kept
|
|
78
104
|
* separate because biome sorts them around the ./runtime import between them. */
|
|
79
105
|
export const VIEWS_INFO_IMPORTS = {
|
|
80
106
|
fullscreen: 'import FullscreenView from "./fullscreen";',
|
|
107
|
+
inline: 'import InlineView from "./inline";',
|
|
81
108
|
summary: 'import SummaryView from "./summary";',
|
|
82
109
|
};
|
|
83
110
|
|
|
84
111
|
/** The `runtime:` entries registering them. */
|
|
85
|
-
export const VIEWS_INFO_RUNTIME = `
|
|
112
|
+
export const VIEWS_INFO_RUNTIME = ` inline: InlineView,
|
|
113
|
+
summary: SummaryView,
|
|
86
114
|
fullscreen: FullscreenView,
|
|
87
115
|
`;
|
|
88
116
|
|
|
@@ -67,8 +67,11 @@ a fresh repo proves the pipeline on its first launch. Replace it or delete it.
|
|
|
67
67
|
if (ctx.features.has("views")) {
|
|
68
68
|
sections.push(`### The operator screen — component views
|
|
69
69
|
|
|
70
|
-
\`summary.tsx\` / \`fullscreen.tsx\` beside the component, registered
|
|
71
|
-
\`runtime\` and rendered INSIDE Studio's workflow view
|
|
70
|
+
\`inline.tsx\` / \`summary.tsx\` / \`fullscreen.tsx\` beside the component, registered
|
|
71
|
+
under its \`runtime\` and rendered INSIDE Studio's workflow view: \`inline\` inside
|
|
72
|
+
the node on the canvas (without it the node shows only static config),
|
|
73
|
+
\`summary\` in the sidebar when the node is selected, \`fullscreen\` as the full
|
|
74
|
+
page. State arrives as
|
|
72
75
|
\`ViewProps.state\` (pushed from every \`updates.update()\`) and commands leave
|
|
73
76
|
through \`sendCommand\` — a view never fetches and never opens a socket.
|
|
74
77
|
|