@dxos/plugin-sheet 0.6.12-main.ed7cda7 → 0.6.12-main.f9d0246
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/dist/lib/browser/{SheetContainer-V4GCCZTX.mjs → SheetContainer-VISF3VUB.mjs} +6 -6
- package/dist/lib/browser/{SheetContainer-V4GCCZTX.mjs.map → SheetContainer-VISF3VUB.mjs.map} +3 -3
- package/dist/lib/browser/{chunk-T3NJFTD4.mjs → chunk-WZMOZKQZ.mjs} +2 -2
- package/dist/lib/browser/{chunk-T3NJFTD4.mjs.map → chunk-WZMOZKQZ.mjs.map} +3 -3
- package/dist/lib/browser/{chunk-6ZMQVB4Z.mjs → chunk-Z2XOOC2R.mjs} +81 -62
- package/dist/lib/browser/chunk-Z2XOOC2R.mjs.map +7 -0
- package/dist/lib/browser/{chunk-U2JHW3L6.mjs → chunk-ZLJ2GRE2.mjs} +173 -42
- package/dist/lib/browser/chunk-ZLJ2GRE2.mjs.map +7 -0
- package/dist/lib/browser/{graph-T27BOBOV.mjs → graph-4XFKIHRL.mjs} +4 -4
- package/dist/lib/browser/index.mjs +15 -13
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/types.mjs +1 -1
- package/dist/lib/node/{SheetContainer-3ZY7MPWJ.cjs → SheetContainer-2MEALQWW.cjs} +14 -14
- package/dist/lib/node/{SheetContainer-3ZY7MPWJ.cjs.map → SheetContainer-2MEALQWW.cjs.map} +3 -3
- package/dist/lib/node/{chunk-OTTD7FBK.cjs → chunk-6DQABRGJ.cjs} +192 -60
- package/dist/lib/node/chunk-6DQABRGJ.cjs.map +7 -0
- package/dist/lib/node/{chunk-Q3HBHPRL.cjs → chunk-AOP42UAA.cjs} +5 -5
- package/dist/lib/node/{chunk-Q3HBHPRL.cjs.map → chunk-AOP42UAA.cjs.map} +3 -3
- package/dist/lib/node/{chunk-DD6FIXWC.cjs → chunk-P5QYYEHQ.cjs} +86 -67
- package/dist/lib/node/chunk-P5QYYEHQ.cjs.map +7 -0
- package/dist/lib/node/{graph-SPKGX7W4.cjs → graph-2LRDUXBZ.cjs} +14 -14
- package/dist/lib/node/graph-2LRDUXBZ.cjs.map +7 -0
- package/dist/lib/node/index.cjs +25 -24
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/types.cjs +8 -8
- package/dist/lib/node/types.cjs.map +1 -1
- package/dist/lib/node-esm/{SheetContainer-PXSJX6XK.mjs → SheetContainer-RPSUSXWS.mjs} +6 -6
- package/dist/lib/node-esm/{SheetContainer-PXSJX6XK.mjs.map → SheetContainer-RPSUSXWS.mjs.map} +3 -3
- package/dist/lib/node-esm/{chunk-D6KU5MI7.mjs → chunk-4MM7THJW.mjs} +81 -62
- package/dist/lib/node-esm/chunk-4MM7THJW.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-7HVSOTGA.mjs → chunk-5RLTCIE2.mjs} +173 -42
- package/dist/lib/node-esm/chunk-5RLTCIE2.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-BMNA27EX.mjs → chunk-RR2AO4SM.mjs} +2 -2
- package/dist/lib/node-esm/{chunk-BMNA27EX.mjs.map → chunk-RR2AO4SM.mjs.map} +3 -3
- package/dist/lib/node-esm/{graph-U67IO4UC.mjs → graph-WG5EKOMO.mjs} +4 -4
- package/dist/lib/node-esm/index.mjs +15 -13
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/types.mjs +1 -1
- package/dist/types/src/SheetPlugin.d.ts.map +1 -1
- package/dist/types/src/components/GridSheet/GridSheet.d.ts +3 -3
- package/dist/types/src/components/GridSheet/GridSheet.d.ts.map +1 -1
- package/dist/types/src/components/GridSheet/GridSheet.stories.d.ts +1 -1
- package/dist/types/src/components/GridSheet/GridSheet.stories.d.ts.map +1 -1
- package/dist/types/src/components/Sheet/Sheet.stories.d.ts.map +1 -1
- package/dist/types/src/components/Sheet/sheet-context.d.ts +3 -3
- package/dist/types/src/components/Sheet/sheet-context.d.ts.map +1 -1
- package/dist/types/src/components/SheetContainer.d.ts +1 -1
- package/dist/types/src/components/index.d.ts +1 -1
- package/dist/types/src/defs/types.d.ts.map +1 -1
- package/dist/types/src/defs/util.d.ts +1 -1
- package/dist/types/src/defs/util.d.ts.map +1 -1
- package/dist/types/src/extensions/compute.d.ts +5 -1
- package/dist/types/src/extensions/compute.d.ts.map +1 -1
- package/dist/types/src/extensions/compute.stories.d.ts.map +1 -1
- package/dist/types/src/graph/async-function.d.ts +7 -1
- package/dist/types/src/graph/async-function.d.ts.map +1 -1
- package/dist/types/src/graph/compute-graph.d.ts +12 -9
- package/dist/types/src/graph/compute-graph.d.ts.map +1 -1
- package/dist/types/src/graph/compute-graph.stories.d.ts.map +1 -1
- package/dist/types/src/graph/compute-graph.test.d.ts +2 -0
- package/dist/types/src/graph/compute-graph.test.d.ts.map +1 -0
- package/dist/types/src/graph/compute-node.d.ts +9 -2
- package/dist/types/src/graph/compute-node.d.ts.map +1 -1
- package/dist/types/src/graph/edge-function.d.ts.map +1 -1
- package/dist/types/src/graph/{custom-function.d.ts → testing/custom-function.d.ts} +3 -1
- package/dist/types/src/graph/testing/custom-function.d.ts.map +1 -0
- package/dist/types/src/graph/testing/index.d.ts +2 -0
- package/dist/types/src/graph/testing/index.d.ts.map +1 -0
- package/dist/types/src/hooks/useComputeGraph.d.ts.map +1 -1
- package/dist/types/src/hooks/useSheetModel.d.ts +2 -2
- package/dist/types/src/hooks/useSheetModel.d.ts.map +1 -1
- package/dist/types/src/model/sheet-model.d.ts +3 -3
- package/dist/types/src/model/sheet-model.d.ts.map +1 -1
- package/dist/types/src/testing/testing.d.ts +4 -5
- package/dist/types/src/testing/testing.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +4 -3
- package/dist/types/src/types.d.ts.map +1 -1
- package/package.json +33 -33
- package/src/SheetPlugin.tsx +9 -7
- package/src/components/CellEditor/CellEditor.stories.tsx +1 -1
- package/src/components/GridSheet/GridSheet.stories.tsx +5 -4
- package/src/components/GridSheet/GridSheet.tsx +4 -4
- package/src/components/Sheet/Sheet.stories.tsx +21 -20
- package/src/components/Sheet/sheet-context.tsx +4 -4
- package/src/components/SheetContainer.tsx +2 -2
- package/src/defs/types.ts +1 -0
- package/src/defs/util.ts +19 -3
- package/src/extensions/compute.stories.tsx +18 -16
- package/src/extensions/compute.ts +72 -39
- package/src/graph/async-function.ts +13 -6
- package/src/graph/compute-graph.stories.tsx +4 -3
- package/src/graph/compute-graph.test.ts +127 -0
- package/src/graph/compute-graph.ts +64 -41
- package/src/graph/compute-node.ts +16 -5
- package/src/graph/edge-function.ts +1 -2
- package/src/graph/{custom-function.ts → testing/custom-function.ts} +10 -2
- package/src/graph/testing/index.ts +5 -0
- package/src/hooks/hooks.stories.tsx +3 -3
- package/src/hooks/useComputeGraph.ts +2 -1
- package/src/hooks/useSheetModel.ts +4 -7
- package/src/model/sheet-model.ts +44 -29
- package/src/testing/testing.tsx +17 -15
- package/src/types.ts +3 -3
- package/dist/lib/browser/chunk-6ZMQVB4Z.mjs.map +0 -7
- package/dist/lib/browser/chunk-U2JHW3L6.mjs.map +0 -7
- package/dist/lib/node/chunk-DD6FIXWC.cjs.map +0 -7
- package/dist/lib/node/chunk-OTTD7FBK.cjs.map +0 -7
- package/dist/lib/node/graph-SPKGX7W4.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-7HVSOTGA.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-D6KU5MI7.mjs.map +0 -7
- package/dist/types/src/graph/compute-graph.browser.test.d.ts +0 -2
- package/dist/types/src/graph/compute-graph.browser.test.d.ts.map +0 -1
- package/dist/types/src/graph/custom-function.d.ts.map +0 -1
- package/src/graph/compute-graph.browser.test.ts +0 -104
- /package/dist/lib/browser/{graph-T27BOBOV.mjs.map → graph-4XFKIHRL.mjs.map} +0 -0
- /package/dist/lib/node-esm/{graph-U67IO4UC.mjs.map → graph-WG5EKOMO.mjs.map} +0 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
2
|
|
|
3
3
|
// packages/plugins/plugin-sheet/src/graph/compute-graph.ts
|
|
4
|
+
import defaultsDeep2 from "lodash.defaultsdeep";
|
|
4
5
|
import { Event as Event2 } from "@dxos/async";
|
|
5
6
|
import { Filter as Filter2, fullyQualifiedId } from "@dxos/client/echo";
|
|
6
7
|
import { Resource as Resource2 } from "@dxos/context";
|
|
@@ -9,7 +10,7 @@ import { PublicKey } from "@dxos/keys";
|
|
|
9
10
|
import { log as log3 } from "@dxos/log";
|
|
10
11
|
import { FunctionType as FunctionType2 } from "@dxos/plugin-script/types";
|
|
11
12
|
import { nonNullable as nonNullable2 } from "@dxos/util";
|
|
12
|
-
import { HyperFormula } from "#hyperformula";
|
|
13
|
+
import { ExportedCellChange, HyperFormula } from "#hyperformula";
|
|
13
14
|
|
|
14
15
|
// packages/plugins/plugin-sheet/src/graph/async-function.ts
|
|
15
16
|
import defaultsDeep from "lodash.defaultsdeep";
|
|
@@ -30,7 +31,7 @@ var FunctionContext = class _FunctionContext {
|
|
|
30
31
|
...args
|
|
31
32
|
});
|
|
32
33
|
}
|
|
33
|
-
constructor(_hf, _space,
|
|
34
|
+
constructor(_hf, _space, _options) {
|
|
34
35
|
this._hf = _hf;
|
|
35
36
|
this._space = _space;
|
|
36
37
|
this._cache = /* @__PURE__ */ new Map();
|
|
@@ -38,12 +39,11 @@ var FunctionContext = class _FunctionContext {
|
|
|
38
39
|
this._subscriptions = /* @__PURE__ */ new Map();
|
|
39
40
|
this._invocations = {};
|
|
40
41
|
this._options = defaultsDeep(_options ?? {}, defaultFunctionContextOptions);
|
|
41
|
-
this._onUpdate = debounce(() => {
|
|
42
|
+
this._onUpdate = debounce((update) => {
|
|
42
43
|
this._hf.resumeEvaluation();
|
|
43
|
-
onUpdate(
|
|
44
|
+
this._options.onUpdate?.(update);
|
|
44
45
|
}, this._options.recalculationDelay);
|
|
45
46
|
}
|
|
46
|
-
// TODO(burdon): Remove?
|
|
47
47
|
get space() {
|
|
48
48
|
return this._space;
|
|
49
49
|
}
|
|
@@ -92,18 +92,21 @@ var FunctionContext = class _FunctionContext {
|
|
|
92
92
|
value: value2
|
|
93
93
|
}, {
|
|
94
94
|
F: __dxlog_file,
|
|
95
|
-
L:
|
|
95
|
+
L: 145,
|
|
96
96
|
S: this,
|
|
97
97
|
C: (f, a) => f(...a)
|
|
98
98
|
});
|
|
99
|
-
this._onUpdate(
|
|
99
|
+
this._onUpdate({
|
|
100
|
+
name,
|
|
101
|
+
cell
|
|
102
|
+
});
|
|
100
103
|
} catch (err) {
|
|
101
104
|
log.warn("failed", {
|
|
102
105
|
cell,
|
|
103
106
|
err
|
|
104
107
|
}, {
|
|
105
108
|
F: __dxlog_file,
|
|
106
|
-
L:
|
|
109
|
+
L: 149,
|
|
107
110
|
S: this,
|
|
108
111
|
C: (f, a) => f(...a)
|
|
109
112
|
});
|
|
@@ -123,7 +126,7 @@ var FunctionContext = class _FunctionContext {
|
|
|
123
126
|
cache: value
|
|
124
127
|
}, {
|
|
125
128
|
F: __dxlog_file,
|
|
126
|
-
L:
|
|
129
|
+
L: 157,
|
|
127
130
|
S: this,
|
|
128
131
|
C: (f, a) => f(...a)
|
|
129
132
|
});
|
|
@@ -154,12 +157,11 @@ var ComputeNode = class extends Resource {
|
|
|
154
157
|
this.sheetId = sheetId;
|
|
155
158
|
this.update = new Event();
|
|
156
159
|
}
|
|
157
|
-
// TODO(burdon): Remove?
|
|
158
160
|
get graph() {
|
|
159
161
|
return this._graph;
|
|
160
162
|
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
+
clear() {
|
|
164
|
+
this._graph.hf.clearSheet(this.sheetId);
|
|
163
165
|
}
|
|
164
166
|
getValue(cell) {
|
|
165
167
|
const value = this._graph.hf.getCellValue({
|
|
@@ -184,6 +186,8 @@ var ComputeNode = class extends Resource {
|
|
|
184
186
|
]
|
|
185
187
|
]);
|
|
186
188
|
}
|
|
189
|
+
async _open() {
|
|
190
|
+
}
|
|
187
191
|
};
|
|
188
192
|
|
|
189
193
|
// packages/plugins/plugin-sheet/src/graph/edge-function.ts
|
|
@@ -259,11 +263,7 @@ EdgeFunctionPlugin.implementedFunctions = {
|
|
|
259
263
|
{
|
|
260
264
|
argumentType: FunctionArgumentType.STRING
|
|
261
265
|
},
|
|
262
|
-
// Remote function arguments (currently supporting up to
|
|
263
|
-
{
|
|
264
|
-
argumentType: FunctionArgumentType.ANY,
|
|
265
|
-
optionalArg: true
|
|
266
|
-
},
|
|
266
|
+
// Remote function arguments (currently supporting up to 8).
|
|
267
267
|
{
|
|
268
268
|
argumentType: FunctionArgumentType.ANY,
|
|
269
269
|
optionalArg: true
|
|
@@ -2688,34 +2688,30 @@ var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-sheet/s
|
|
|
2688
2688
|
var OBJECT_ID_LENGTH = 60;
|
|
2689
2689
|
var CUSTOM_FUNCTION = "ECHO";
|
|
2690
2690
|
var defaultOptions = {
|
|
2691
|
-
licenseKey: "gpl-v3"
|
|
2692
|
-
plugins: [
|
|
2693
|
-
{
|
|
2694
|
-
plugin: EdgeFunctionPlugin,
|
|
2695
|
-
translations: EdgeFunctionPluginTranslations
|
|
2696
|
-
}
|
|
2697
|
-
]
|
|
2691
|
+
licenseKey: "gpl-v3"
|
|
2698
2692
|
};
|
|
2693
|
+
var defaultPlugins = [
|
|
2694
|
+
{
|
|
2695
|
+
plugin: EdgeFunctionPlugin,
|
|
2696
|
+
translations: EdgeFunctionPluginTranslations
|
|
2697
|
+
}
|
|
2698
|
+
];
|
|
2699
2699
|
var PREFIX = "__";
|
|
2700
2700
|
var createSheetName = (id) => `${PREFIX}${id}`;
|
|
2701
2701
|
var getSheetId = (name) => name.startsWith(PREFIX) ? name.slice(PREFIX.length) : void 0;
|
|
2702
|
-
var createComputeGraphRegistry = (options = {}) => {
|
|
2703
|
-
return new ComputeGraphRegistry({
|
|
2704
|
-
...defaultOptions,
|
|
2705
|
-
...options
|
|
2706
|
-
});
|
|
2707
|
-
};
|
|
2708
2702
|
var ComputeGraphRegistry = class extends Resource2 {
|
|
2709
|
-
constructor(
|
|
2703
|
+
constructor(options = {
|
|
2704
|
+
plugins: defaultPlugins
|
|
2705
|
+
}) {
|
|
2710
2706
|
super();
|
|
2711
|
-
this.
|
|
2712
|
-
this.
|
|
2707
|
+
this._graphs = /* @__PURE__ */ new Map();
|
|
2708
|
+
this._options = defaultsDeep2({}, options, defaultOptions);
|
|
2713
2709
|
this._options.plugins?.forEach(({ plugin, translations }) => {
|
|
2714
2710
|
HyperFormula.registerFunctionPlugin(plugin, translations);
|
|
2715
2711
|
});
|
|
2716
2712
|
}
|
|
2717
2713
|
getGraph(spaceId) {
|
|
2718
|
-
return this.
|
|
2714
|
+
return this._graphs.get(spaceId);
|
|
2719
2715
|
}
|
|
2720
2716
|
async getOrCreateGraph(space) {
|
|
2721
2717
|
let graph = this.getGraph(space.id);
|
|
@@ -2724,7 +2720,7 @@ var ComputeGraphRegistry = class extends Resource2 {
|
|
|
2724
2720
|
space: space.id
|
|
2725
2721
|
}, {
|
|
2726
2722
|
F: __dxlog_file3,
|
|
2727
|
-
L:
|
|
2723
|
+
L: 93,
|
|
2728
2724
|
S: this,
|
|
2729
2725
|
C: (f, a) => f(...a)
|
|
2730
2726
|
});
|
|
@@ -2733,21 +2729,26 @@ var ComputeGraphRegistry = class extends Resource2 {
|
|
|
2733
2729
|
return graph;
|
|
2734
2730
|
}
|
|
2735
2731
|
async createGraph(space) {
|
|
2736
|
-
invariant(!this.
|
|
2732
|
+
invariant(!this._graphs.has(space.id), `ComputeGraph already exists for space: ${space.id}`, {
|
|
2737
2733
|
F: __dxlog_file3,
|
|
2738
|
-
L:
|
|
2734
|
+
L: 101,
|
|
2739
2735
|
S: this,
|
|
2740
2736
|
A: [
|
|
2741
|
-
"!this.
|
|
2737
|
+
"!this._graphs.has(space.id)",
|
|
2742
2738
|
"`ComputeGraph already exists for space: ${space.id}`"
|
|
2743
2739
|
]
|
|
2744
2740
|
});
|
|
2745
2741
|
const hf = HyperFormula.buildEmpty(this._options);
|
|
2746
2742
|
const graph = new ComputeGraph(hf, space, this._options);
|
|
2747
|
-
|
|
2748
|
-
|
|
2743
|
+
this._graphs.set(space.id, graph);
|
|
2744
|
+
await graph.open();
|
|
2749
2745
|
return graph;
|
|
2750
2746
|
}
|
|
2747
|
+
async _close() {
|
|
2748
|
+
for (const graph of this._graphs.values()) {
|
|
2749
|
+
await graph.close();
|
|
2750
|
+
}
|
|
2751
|
+
}
|
|
2751
2752
|
};
|
|
2752
2753
|
var ComputeGraph = class extends Resource2 {
|
|
2753
2754
|
constructor(_hf, _space, _options) {
|
|
@@ -2758,28 +2759,39 @@ var ComputeGraph = class extends Resource2 {
|
|
|
2758
2759
|
this.id = `graph-${PublicKey.random().truncate()}`;
|
|
2759
2760
|
this._nodes = /* @__PURE__ */ new Map();
|
|
2760
2761
|
this._functions = [];
|
|
2761
|
-
this.context = new FunctionContext(this._hf, this._space, this.refresh.bind(this), this._options);
|
|
2762
2762
|
this.update = new Event2();
|
|
2763
|
+
this.context = new FunctionContext(this._hf, this._space, this._options);
|
|
2763
2764
|
this._hf.updateConfig({
|
|
2764
2765
|
context: this.context
|
|
2765
2766
|
});
|
|
2767
|
+
const onValuesUpdate = (changes) => {
|
|
2768
|
+
for (const change of changes) {
|
|
2769
|
+
if (change instanceof ExportedCellChange) {
|
|
2770
|
+
const { sheet } = change;
|
|
2771
|
+
const node = this._nodes.get(sheet);
|
|
2772
|
+
if (node) {
|
|
2773
|
+
node.update.emit({
|
|
2774
|
+
type: "valuesUpdated",
|
|
2775
|
+
change
|
|
2776
|
+
});
|
|
2777
|
+
}
|
|
2778
|
+
}
|
|
2779
|
+
}
|
|
2780
|
+
};
|
|
2781
|
+
this._hf.on("valuesUpdated", onValuesUpdate);
|
|
2782
|
+
this._ctx.onDispose(() => this._hf.off("valuesUpdated", onValuesUpdate));
|
|
2766
2783
|
}
|
|
2767
|
-
// TODO(burdon): Remove.
|
|
2768
2784
|
get hf() {
|
|
2769
2785
|
return this._hf;
|
|
2770
2786
|
}
|
|
2771
|
-
refresh() {
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
});
|
|
2780
|
-
this.update.emit();
|
|
2781
|
-
}
|
|
2782
|
-
getFunctions({ standard = true, echo = true } = {}) {
|
|
2787
|
+
// refresh() {
|
|
2788
|
+
// log('refresh', { id: this.id });
|
|
2789
|
+
// this.update.emit();
|
|
2790
|
+
// }
|
|
2791
|
+
getFunctions({ standard, echo } = {
|
|
2792
|
+
standard: true,
|
|
2793
|
+
echo: true
|
|
2794
|
+
}) {
|
|
2783
2795
|
return [
|
|
2784
2796
|
...standard ? this._hf.getRegisteredFunctionNames().map((name) => defaultFunctions.find((fn) => fn.name === name) ?? {
|
|
2785
2797
|
name
|
|
@@ -2797,10 +2809,10 @@ var ComputeGraph = class extends Resource2 {
|
|
|
2797
2809
|
// This would enable on-the-fly instantiation of new models when then are referenced.
|
|
2798
2810
|
// E.g., Cross-object reference would be stored as "ObjectId!A1"
|
|
2799
2811
|
// The graph would then load the object and create a ComputeNode (model) of the appropriate type.
|
|
2800
|
-
getOrCreateNode(name) {
|
|
2812
|
+
async getOrCreateNode(name) {
|
|
2801
2813
|
invariant(name.length, void 0, {
|
|
2802
2814
|
F: __dxlog_file3,
|
|
2803
|
-
L:
|
|
2815
|
+
L: 193,
|
|
2804
2816
|
S: this,
|
|
2805
2817
|
A: [
|
|
2806
2818
|
"name.length",
|
|
@@ -2813,17 +2825,16 @@ var ComputeGraph = class extends Resource2 {
|
|
|
2813
2825
|
name
|
|
2814
2826
|
}, {
|
|
2815
2827
|
F: __dxlog_file3,
|
|
2816
|
-
L:
|
|
2828
|
+
L: 195,
|
|
2817
2829
|
S: this,
|
|
2818
2830
|
C: (f, a) => f(...a)
|
|
2819
2831
|
});
|
|
2820
2832
|
this._hf.addSheet(name);
|
|
2821
|
-
this.update.emit();
|
|
2822
2833
|
}
|
|
2823
2834
|
const sheetId = this._hf.getSheetId(name);
|
|
2824
2835
|
invariant(sheetId !== void 0, void 0, {
|
|
2825
2836
|
F: __dxlog_file3,
|
|
2826
|
-
L:
|
|
2837
|
+
L: 201,
|
|
2827
2838
|
S: this,
|
|
2828
2839
|
A: [
|
|
2829
2840
|
"sheetId !== undefined",
|
|
@@ -2831,6 +2842,7 @@ var ComputeGraph = class extends Resource2 {
|
|
|
2831
2842
|
]
|
|
2832
2843
|
});
|
|
2833
2844
|
const node = new ComputeNode(this, sheetId);
|
|
2845
|
+
await node.open();
|
|
2834
2846
|
this._nodes.set(sheetId, node);
|
|
2835
2847
|
return node;
|
|
2836
2848
|
}
|
|
@@ -2905,21 +2917,28 @@ var ComputeGraph = class extends Resource2 {
|
|
|
2905
2917
|
const query = this._space.db.query(Filter2.schema(FunctionType2));
|
|
2906
2918
|
const unsubscribe = query.subscribe(({ objects }) => {
|
|
2907
2919
|
this._functions = objects.filter(({ binding }) => binding);
|
|
2908
|
-
this.update.emit(
|
|
2920
|
+
this.update.emit({
|
|
2921
|
+
type: "functionsUpdated"
|
|
2922
|
+
});
|
|
2909
2923
|
});
|
|
2910
2924
|
this._ctx.onDispose(unsubscribe);
|
|
2911
2925
|
}
|
|
2912
2926
|
}
|
|
2927
|
+
async _close() {
|
|
2928
|
+
for (const node of this._nodes.values()) {
|
|
2929
|
+
await node.close();
|
|
2930
|
+
}
|
|
2931
|
+
}
|
|
2913
2932
|
};
|
|
2914
2933
|
|
|
2915
2934
|
export {
|
|
2916
2935
|
ComputeNode,
|
|
2917
2936
|
defaultFunctions,
|
|
2918
2937
|
defaultOptions,
|
|
2938
|
+
defaultPlugins,
|
|
2919
2939
|
createSheetName,
|
|
2920
2940
|
getSheetId,
|
|
2921
|
-
createComputeGraphRegistry,
|
|
2922
2941
|
ComputeGraphRegistry,
|
|
2923
2942
|
ComputeGraph
|
|
2924
2943
|
};
|
|
2925
|
-
//# sourceMappingURL=chunk-
|
|
2944
|
+
//# sourceMappingURL=chunk-4MM7THJW.mjs.map
|