@norskvideo/norsk-studio 1.1.0 → 1.3.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.
- package/lib/client/componentevents.js +2 -2
- package/lib/client/componentevents.js.map +1 -1
- package/lib/client/jsx/node-editor.js +1 -1
- package/lib/client/jsx/node-editor.js.map +1 -1
- package/lib/client/jsx/selected.d.ts +1 -1
- package/lib/client/jsx/selected.js +1 -1
- package/lib/client/jsx/selected.js.map +1 -1
- package/lib/client/rete.js +3 -3
- package/lib/client/rete.js.map +1 -1
- package/lib/client/session-view.js +1 -1
- package/lib/client/session-view.js.map +1 -1
- package/lib/client/session.js +2 -2
- package/lib/client/session.js.map +1 -1
- package/lib/client/tools.js +1 -1
- package/lib/client/tools.js.map +1 -1
- package/lib/runtime/document.d.ts +1 -1
- package/lib/runtime/document.js +8 -8
- package/lib/runtime/document.js.map +1 -1
- package/lib/runtime/execution.d.ts +1 -1
- package/lib/runtime/execution.js +3 -3
- package/lib/runtime/execution.js.map +1 -1
- package/lib/runtime/norsk-comms.d.ts +0 -2
- package/lib/runtime/norsk-comms.js +7 -23
- package/lib/runtime/norsk-comms.js.map +1 -1
- package/lib/server/config.d.ts +6 -4
- package/lib/server/config.js +5 -3
- package/lib/server/config.js.map +1 -1
- package/lib/server/index.js +6 -9
- package/lib/server/index.js.map +1 -1
- package/lib/server/runner.js +4 -4
- package/lib/server/runner.js.map +1 -1
- package/lib/server/session.d.ts +1 -1
- package/lib/server/session.js +3 -3
- package/lib/server/session.js.map +1 -1
- package/lib/shared/document.d.ts +2 -2
- package/lib/shared/document.js +15 -15
- package/lib/shared/document.js.map +1 -1
- package/lib/shared/norsk.d.ts +0 -2
- package/lib/shared/server-msg.d.ts +1 -3
- package/lib/shared/util.js +1 -1
- package/lib/shared/util.js.map +1 -1
- package/lib/test/_util/builder.js +2 -2
- package/lib/test/_util/builder.js.map +1 -1
- package/lib/test/_util/sinks.js +2 -2
- package/lib/test/_util/sinks.js.map +1 -1
- package/lib/test/client-designview.js +9 -9
- package/lib/test/client-designview.js.map +1 -1
- package/lib/test/client-session.js +4 -4
- package/lib/test/client-session.js.map +1 -1
- package/lib/test/client-ui.js +1 -1
- package/lib/test/client-ui.js.map +1 -1
- package/lib/test/document-execution.js +3 -3
- package/lib/test/document-execution.js.map +1 -1
- package/lib/test/document-loading.js +27 -27
- package/lib/test/document-loading.js.map +1 -1
- package/lib/test/id-generation.js +7 -0
- package/lib/test/id-generation.js.map +1 -1
- package/lib/test/runtime-comms.js +5 -5
- package/lib/test/runtime-comms.js.map +1 -1
- package/lib/test/subscriptions.js +9 -9
- package/lib/test/subscriptions.js.map +1 -1
- package/package.json +1 -1
- package/ui/index.js +27 -27
package/ui/index.js
CHANGED
|
@@ -169551,7 +169551,7 @@ function displayNodeId(id, document2) {
|
|
|
169551
169551
|
if (!id) {
|
|
169552
169552
|
return "";
|
|
169553
169553
|
}
|
|
169554
|
-
return document2.
|
|
169554
|
+
return document2.components[id]?.config?.displayName ?? id;
|
|
169555
169555
|
}
|
|
169556
169556
|
function assertUnreachable(_2) {
|
|
169557
169557
|
throw new Error("Didn't expect to get here");
|
|
@@ -169800,7 +169800,7 @@ function runGlobalValidationForRow(globalRule, currentValue, node, top2) {
|
|
|
169800
169800
|
if (globalRule.include && !globalRule.include(node.config, top2)) {
|
|
169801
169801
|
return void 0;
|
|
169802
169802
|
}
|
|
169803
|
-
const matching = Object.values(top2.
|
|
169803
|
+
const matching = Object.values(top2.components).flatMap((n4) => {
|
|
169804
169804
|
if (n4.id == node.id)
|
|
169805
169805
|
return void 0;
|
|
169806
169806
|
return Object.entries(n4.info.configForm.form).flatMap(([k2, v2]) => {
|
|
@@ -169850,7 +169850,7 @@ function runGlobalValidationForRow(globalRule, currentValue, node, top2) {
|
|
|
169850
169850
|
}
|
|
169851
169851
|
}
|
|
169852
169852
|
var DocumentDescription = class {
|
|
169853
|
-
|
|
169853
|
+
components = {};
|
|
169854
169854
|
errors;
|
|
169855
169855
|
warnings;
|
|
169856
169856
|
layout;
|
|
@@ -169871,15 +169871,15 @@ var DocumentDescription = class {
|
|
|
169871
169871
|
}
|
|
169872
169872
|
}
|
|
169873
169873
|
this.globalConfig = { ...yaml.__globalConfig };
|
|
169874
|
-
if (yaml.
|
|
169875
|
-
for (const node of yaml.
|
|
169874
|
+
if (yaml.components) {
|
|
169875
|
+
for (const node of yaml.components) {
|
|
169876
169876
|
const info = library.find(node.type ?? "undefined");
|
|
169877
169877
|
if (!info) {
|
|
169878
169878
|
console.error("Failed to load node into document as type is missing", node.config?.id, node.type);
|
|
169879
169879
|
} else if (!node.config?.id) {
|
|
169880
169880
|
console.error("Missing id on node", node.config?.id, node.type);
|
|
169881
169881
|
} else {
|
|
169882
|
-
this.
|
|
169882
|
+
this.components[node.config.id] = new NodeDescription(this, node, info);
|
|
169883
169883
|
}
|
|
169884
169884
|
}
|
|
169885
169885
|
}
|
|
@@ -169893,7 +169893,7 @@ var DocumentDescription = class {
|
|
|
169893
169893
|
});
|
|
169894
169894
|
}
|
|
169895
169895
|
forEachNode(f) {
|
|
169896
|
-
Object.values(this.
|
|
169896
|
+
Object.values(this.components).forEach(f);
|
|
169897
169897
|
}
|
|
169898
169898
|
addNode(type) {
|
|
169899
169899
|
const info = this.library.find(type);
|
|
@@ -169901,12 +169901,12 @@ var DocumentDescription = class {
|
|
|
169901
169901
|
throw new Error("Failed to find type for addition to document: " + type);
|
|
169902
169902
|
}
|
|
169903
169903
|
const node = new NodeDescription(this, { type, config: { id: "", displayName: "" }, subscriptions: [] }, info);
|
|
169904
|
-
this.
|
|
169904
|
+
this.components[node.id] = node;
|
|
169905
169905
|
this.events.emit("onNodeAdded", { id: "", node });
|
|
169906
169906
|
return node;
|
|
169907
169907
|
}
|
|
169908
169908
|
removeNode(id) {
|
|
169909
|
-
const existing = this.
|
|
169909
|
+
const existing = this.components[id];
|
|
169910
169910
|
if (existing) {
|
|
169911
169911
|
existing.subscriptions.forEach((s2) => {
|
|
169912
169912
|
existing.removeSubscription(s2.source);
|
|
@@ -169915,12 +169915,12 @@ var DocumentDescription = class {
|
|
|
169915
169915
|
const subscriber = this.getNode(s2);
|
|
169916
169916
|
subscriber.removeSubscription(id);
|
|
169917
169917
|
});
|
|
169918
|
-
delete this.
|
|
169918
|
+
delete this.components[id];
|
|
169919
169919
|
this.events.emit("onNodeRemoved", { id, node: existing });
|
|
169920
169920
|
}
|
|
169921
169921
|
}
|
|
169922
169922
|
findNode(id) {
|
|
169923
|
-
return this.
|
|
169923
|
+
return this.components[id];
|
|
169924
169924
|
}
|
|
169925
169925
|
getNode(id) {
|
|
169926
169926
|
const node = this.findNode(id);
|
|
@@ -169932,7 +169932,7 @@ var DocumentDescription = class {
|
|
|
169932
169932
|
return {
|
|
169933
169933
|
__layout: this.layout ? Object.entries(this.layout).map(([k2, v2]) => ({ id: k2, x: v2.x, y: v2.y })) : [],
|
|
169934
169934
|
__globalConfig: this.globalConfig,
|
|
169935
|
-
|
|
169935
|
+
components: Object.entries(this.components).map(([_id, node]) => node.toYaml())
|
|
169936
169936
|
};
|
|
169937
169937
|
}
|
|
169938
169938
|
onNodeRemoved(h) {
|
|
@@ -169955,8 +169955,8 @@ var DocumentDescription = class {
|
|
|
169955
169955
|
}
|
|
169956
169956
|
handleNodeUpdate({ id, node }) {
|
|
169957
169957
|
if (id != node.id) {
|
|
169958
|
-
delete this.
|
|
169959
|
-
this.
|
|
169958
|
+
delete this.components[id];
|
|
169959
|
+
this.components[node.id] = node;
|
|
169960
169960
|
this.forEachNode((n4) => {
|
|
169961
169961
|
n4.subscriptions.forEach((s2) => {
|
|
169962
169962
|
if (s2.source == id) {
|
|
@@ -170059,14 +170059,14 @@ var NodeSubscriptionDescription = class {
|
|
|
170059
170059
|
}
|
|
170060
170060
|
set source(id) {
|
|
170061
170061
|
this.yaml.source = id;
|
|
170062
|
-
this.document.events.emit("onSubscriptionUpdated", { subscription: this, source: this.node, destination: this.document.
|
|
170062
|
+
this.document.events.emit("onSubscriptionUpdated", { subscription: this, source: this.node, destination: this.document.components[this.source] });
|
|
170063
170063
|
}
|
|
170064
170064
|
get streams() {
|
|
170065
170065
|
return this.yaml.streams;
|
|
170066
170066
|
}
|
|
170067
170067
|
set streams(config) {
|
|
170068
170068
|
this.yaml.streams = config;
|
|
170069
|
-
this.document.events.emit("onSubscriptionUpdated", { subscription: this, source: this.node, destination: this.document.
|
|
170069
|
+
this.document.events.emit("onSubscriptionUpdated", { subscription: this, source: this.node, destination: this.document.components[this.source] });
|
|
170070
170070
|
}
|
|
170071
170071
|
yaml;
|
|
170072
170072
|
node;
|
|
@@ -179690,7 +179690,7 @@ var AllReteThen = class {
|
|
|
179690
179690
|
void this.area.update("node", element.id);
|
|
179691
179691
|
}
|
|
179692
179692
|
async redraw() {
|
|
179693
|
-
for (const node of Object.values(this.session.description.
|
|
179693
|
+
for (const node of Object.values(this.session.description.components)) {
|
|
179694
179694
|
const destinationElement = this.elementsByNodeId[node.id];
|
|
179695
179695
|
if (!destinationElement)
|
|
179696
179696
|
continue;
|
|
@@ -179708,7 +179708,7 @@ var AllReteThen = class {
|
|
|
179708
179708
|
await this.reset(session);
|
|
179709
179709
|
this.elementsByNodeId = {};
|
|
179710
179710
|
const compiled = session.description;
|
|
179711
|
-
for (const node of Object.values(compiled.
|
|
179711
|
+
for (const node of Object.values(compiled.components)) {
|
|
179712
179712
|
const warnings = compiled.warnings.filter((w2) => w2.context.nodeId == node.id);
|
|
179713
179713
|
const errors = compiled.errors.filter((w2) => w2.context.nodeId == node.id);
|
|
179714
179714
|
const element = await this.createElementForNode(node, warnings, errors);
|
|
@@ -179717,7 +179717,7 @@ var AllReteThen = class {
|
|
|
179717
179717
|
await this.area.translate(element.id, { x: layout.x, y: layout.y });
|
|
179718
179718
|
}
|
|
179719
179719
|
}
|
|
179720
|
-
for (const node of Object.values(compiled.
|
|
179720
|
+
for (const node of Object.values(compiled.components)) {
|
|
179721
179721
|
const destinationElement = this.elementsByNodeId[node.id];
|
|
179722
179722
|
for (const subscription of node.subscriptions) {
|
|
179723
179723
|
const sourceElement = this.elementsByNodeId[subscription.source];
|
|
@@ -199877,7 +199877,7 @@ var selected_node_default = SelectedNode;
|
|
|
199877
199877
|
|
|
199878
199878
|
// build/client/client/jsx/selected.js
|
|
199879
199879
|
function SelectedNodes(props) {
|
|
199880
|
-
return (0, import_jsx_runtime106.jsxs)("ul", { className: "w-60", children: [props.
|
|
199880
|
+
return (0, import_jsx_runtime106.jsxs)("ul", { className: "w-60", children: [props.components.map((n4) => (0, import_jsx_runtime106.jsx)(selected_node_default, { library: props.library, node: n4, toplevel: props.toplevel, onEdit: props.onNodeEdit, onDelete: props.onNodeDelete, onClearSelection: props.onClearSelection, onSubscriptionHighlightStart: (s2) => props.onSubscriptionHighlightStart(n4.description.id, s2), onSubscriptionHighlightStop: (s2) => props.onSubscriptionHighlightStop(n4.description.id, s2), onSubscriptionSelect: (s2) => props.onSubscriptionSelected(n4.description.id, s2), isLive: !!props.liveState, liveState: props.liveState?.[n4.description.id], sendCommand: (c2) => props.sendCommand(n4.description.id, c2) }, `node-${n4.description.id}`)), props.liveState ? (0, import_jsx_runtime106.jsx)(import_jsx_runtime106.Fragment, {}) : props.connections.map((info, i3) => (0, import_jsx_runtime106.jsx)(selected_connection_default, { library: props.library, toplevel: props.toplevel, connection: info, onEdit: props.onConnectionEdit, onDelete: props.onConnectionDelete, onClearSelection: props.onClearSelection }, `{connection-${i3}`))] });
|
|
199881
199881
|
}
|
|
199882
199882
|
var selected_default = SelectedNodes;
|
|
199883
199883
|
|
|
@@ -201834,7 +201834,7 @@ function Id(_target, _description) {
|
|
|
201834
201834
|
}
|
|
201835
201835
|
function getNextId(existingId, displayName, description, x2) {
|
|
201836
201836
|
const withoutSpaces = displayName.replace(/\s/g, "_").toLowerCase();
|
|
201837
|
-
const withoutWeirdCharacters = withoutSpaces.replace(/[\s~`!@#$%^&*(){}[\];:"'
|
|
201837
|
+
const withoutWeirdCharacters = withoutSpaces.replace(/[\s~`!@#$%^&*(){}[\];:"'<,.>?/\\|+=]/g, "");
|
|
201838
201838
|
const attempt = `${withoutWeirdCharacters}${x2 ? "-" + x2 : ""}`;
|
|
201839
201839
|
if (description.findNode(attempt) && existingId !== attempt) {
|
|
201840
201840
|
return getNextId(existingId, displayName, description, x2 ? x2++ : 1);
|
|
@@ -202126,7 +202126,7 @@ function ControlsImpl(props) {
|
|
|
202126
202126
|
function renderSelected() {
|
|
202127
202127
|
return selected_default({
|
|
202128
202128
|
library: props.library,
|
|
202129
|
-
|
|
202129
|
+
components: currentState.selectedNodes,
|
|
202130
202130
|
connections: currentState.selectedConnections,
|
|
202131
202131
|
toplevel: props.session.description,
|
|
202132
202132
|
onNodeEdit,
|
|
@@ -202340,13 +202340,13 @@ var ComponentEvents = class {
|
|
|
202340
202340
|
const node = e2.node;
|
|
202341
202341
|
if (!node)
|
|
202342
202342
|
return;
|
|
202343
|
-
for (const n4 of Object.values(this.session.description.
|
|
202343
|
+
for (const n4 of Object.values(this.session.description.components)) {
|
|
202344
202344
|
n4.info.designtime?.uiEvents?.onGlobalNodeUpdated?.call(n4, node, e2.id);
|
|
202345
202345
|
}
|
|
202346
202346
|
}
|
|
202347
202347
|
onNodeRemoved(e2) {
|
|
202348
202348
|
e2.node?.info.designtime?.uiEvents?.onNodeRemoved?.call(e2.node, e2.id);
|
|
202349
|
-
for (const n4 of Object.values(this.session.description.
|
|
202349
|
+
for (const n4 of Object.values(this.session.description.components)) {
|
|
202350
202350
|
n4.info.designtime?.uiEvents?.onGlobalNodeRemoved?.call(n4, e2.node, e2.id);
|
|
202351
202351
|
}
|
|
202352
202352
|
}
|
|
@@ -202427,7 +202427,7 @@ var Session = class {
|
|
|
202427
202427
|
if (!update) {
|
|
202428
202428
|
return;
|
|
202429
202429
|
}
|
|
202430
|
-
const node = this.description.
|
|
202430
|
+
const node = this.description.components[id];
|
|
202431
202431
|
if (!node) {
|
|
202432
202432
|
console.error("Target of node update no longer exists??", id);
|
|
202433
202433
|
return;
|
|
@@ -202464,7 +202464,7 @@ var Session = class {
|
|
|
202464
202464
|
}
|
|
202465
202465
|
updateLiveInfo(summary) {
|
|
202466
202466
|
const shuffled = {};
|
|
202467
|
-
for (const [id, update] of Object.entries(summary.
|
|
202467
|
+
for (const [id, update] of Object.entries(summary.components)) {
|
|
202468
202468
|
const runtimeState = this.active[id]?.runtimeState;
|
|
202469
202469
|
shuffled[id] = { runtimeState, inputs: [], ...update };
|
|
202470
202470
|
}
|
|
@@ -203002,7 +203002,7 @@ function Main(props) {
|
|
|
203002
203002
|
switch (msgType) {
|
|
203003
203003
|
case "init": {
|
|
203004
203004
|
if (msg.document) {
|
|
203005
|
-
const node = msg.document.
|
|
203005
|
+
const node = msg.document.components?.find((n4) => n4.config?.id == props.nodeId);
|
|
203006
203006
|
const latestInfo = node?.type ? props.library.find(node?.type) : void 0;
|
|
203007
203007
|
setInfo(latestInfo);
|
|
203008
203008
|
setConfig(node?.config);
|