@genome-spy/core 0.45.0 → 0.46.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.
- package/dist/bundle/{index-lmJu1tfP.js → index-BtRKzKhM.js} +6 -6
- package/dist/bundle/{index--cKb-dKG.js → index-BwFvhduA.js} +5 -5
- package/dist/bundle/{index-1QVesMzU.js → index-C8lYPtq_.js} +1 -1
- package/dist/bundle/{index-Pv3tKJ1W.js → index-CkI3Kd2P.js} +3 -3
- package/dist/bundle/{index-Y-LdHNIz.js → index-CmBp-spD.js} +1 -1
- package/dist/bundle/{index-z4Cs62EO.js → index-Dixm7K89.js} +4 -4
- package/dist/bundle/{index-noY1e-G6.js → index-Sk-Wtwdn.js} +5 -5
- package/dist/bundle/{index-UyrC0vvF.js → index-Z7JiNsFI.js} +4 -4
- package/dist/bundle/{index-LD6yPc3X.js → index-mihmTLo-.js} +1 -1
- package/dist/bundle/index.es.js +3624 -3516
- package/dist/bundle/index.js +101 -92
- package/dist/bundle/{long-Veu0zKh9.js → long-CYrAUkxh.js} +2 -2
- package/dist/bundle/{remoteFile-Ur-gRKsH.js → remoteFile-1_eCK3VV.js} +1 -1
- package/dist/schema.json +156 -15
- package/dist/src/data/collector.d.ts +1 -0
- package/dist/src/data/collector.d.ts.map +1 -1
- package/dist/src/data/collector.js +19 -3
- package/dist/src/data/flow.test.js +4 -0
- package/dist/src/data/flowNode.d.ts +31 -14
- package/dist/src/data/flowNode.d.ts.map +1 -1
- package/dist/src/data/flowNode.js +53 -20
- package/dist/src/data/flowTestUtils.d.ts +5 -0
- package/dist/src/data/flowTestUtils.d.ts.map +1 -1
- package/dist/src/data/flowTestUtils.js +11 -0
- package/dist/src/data/sources/dataSource.d.ts +17 -0
- package/dist/src/data/sources/dataSource.d.ts.map +1 -1
- package/dist/src/data/sources/dataSource.js +34 -0
- package/dist/src/data/sources/inlineSource.js +1 -1
- package/dist/src/data/sources/lazy/bigBedSource.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/bigBedSource.js +6 -0
- package/dist/src/data/sources/lazy/bigWigSource.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/bigWigSource.js +28 -15
- package/dist/src/data/sources/lazy/singleAxisLazySource.d.ts +0 -8
- package/dist/src/data/sources/lazy/singleAxisLazySource.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/singleAxisLazySource.js +1 -13
- package/dist/src/data/sources/lazy/singleAxisWindowedSource.js +3 -3
- package/dist/src/data/sources/namedSource.js +1 -1
- package/dist/src/data/sources/sequenceSource.d.ts.map +1 -1
- package/dist/src/data/sources/sequenceSource.js +2 -1
- package/dist/src/data/sources/urlSource.d.ts.map +1 -1
- package/dist/src/data/sources/urlSource.js +9 -5
- package/dist/src/data/transforms/clone.d.ts +1 -0
- package/dist/src/data/transforms/clone.d.ts.map +1 -1
- package/dist/src/data/transforms/coverage.d.ts +4 -1
- package/dist/src/data/transforms/coverage.d.ts.map +1 -1
- package/dist/src/data/transforms/coverage.js +44 -31
- package/dist/src/data/transforms/filter.d.ts +4 -3
- package/dist/src/data/transforms/filter.d.ts.map +1 -1
- package/dist/src/data/transforms/filter.js +7 -8
- package/dist/src/data/transforms/filter.test.js +4 -2
- package/dist/src/data/transforms/formula.d.ts +4 -3
- package/dist/src/data/transforms/formula.d.ts.map +1 -1
- package/dist/src/data/transforms/formula.js +7 -5
- package/dist/src/data/transforms/formula.test.js +13 -7
- package/dist/src/genomeSpy.d.ts +5 -2
- package/dist/src/genomeSpy.d.ts.map +1 -1
- package/dist/src/genomeSpy.js +24 -8
- package/dist/src/marks/mark.d.ts.map +1 -1
- package/dist/src/marks/mark.js +11 -0
- package/dist/src/spec/view.d.ts +52 -9
- package/dist/src/styles/genome-spy.css.d.ts +1 -1
- package/dist/src/styles/genome-spy.css.d.ts.map +1 -1
- package/dist/src/styles/genome-spy.css.js +4 -0
- package/dist/src/styles/genome-spy.scss +5 -0
- package/dist/src/types/viewContext.d.ts +9 -2
- package/dist/src/utils/expression.js +1 -1
- package/dist/src/view/paramMediator.d.ts +2 -1
- package/dist/src/view/paramMediator.d.ts.map +1 -1
- package/dist/src/view/paramMediator.js +3 -2
- package/dist/src/view/paramMediator.test.js +13 -0
- package/dist/src/view/viewFactory.d.ts +4 -1
- package/dist/src/view/viewFactory.d.ts.map +1 -1
- package/dist/src/view/viewFactory.js +52 -24
- package/dist/src/view/viewUtils.d.ts +2 -7
- package/dist/src/view/viewUtils.d.ts.map +1 -1
- package/dist/src/view/viewUtils.js +21 -30
- package/package.json +2 -2
- /package/dist/bundle/{__vite-browser-external-ENoMJThg.js → __vite-browser-external-C--ziKoh.js} +0 -0
- /package/dist/bundle/{_commonjsHelpers-QtkX90xp.js → _commonjsHelpers-BIiJCwQW.js} +0 -0
|
@@ -52,10 +52,11 @@ export default class ParamMediator {
|
|
|
52
52
|
*
|
|
53
53
|
* @param {string} paramName
|
|
54
54
|
* @param {T} initialValue
|
|
55
|
+
* @param {boolean} [passive] If true, the setter will not notify listeners when the value changes.
|
|
55
56
|
* @returns {(value: T) => void}
|
|
56
57
|
* @template T
|
|
57
58
|
*/
|
|
58
|
-
allocateSetter<T>(paramName: string, initialValue: T): (value: T) => void;
|
|
59
|
+
allocateSetter<T>(paramName: string, initialValue: T, passive?: boolean): (value: T) => void;
|
|
59
60
|
/**
|
|
60
61
|
* Gets an existing setter for a parameter. Throws if the setter is not found.
|
|
61
62
|
* @param {string} paramName
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paramMediator.d.ts","sourceRoot":"","sources":["../../../src/view/paramMediator.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"paramMediator.d.ts","sourceRoot":"","sources":["../../../src/view/paramMediator.js"],"names":[],"mappings":"AAuQA;;;GAGG;AACH,6BAHW,GAAG,+CAKb;AAED;;;;;;;GAOG;AACH,oFASC;AAED;;;;;;;;;;GAUG;AACH,mFANW,aAAa,+CAEW,IAAI,KAwCtC;AA9UD;;;;;GAKG;AACH;IA2BI;;;;;OAKG;IACH,2BALW,MAAM,aAAa,EAU7B;IA7BD;;;OAGG;IACH,0BAHU,IAAI,MAAM,EAAE,IAAI,MAAM,IAAI,CAAC,CAAC,CAGvB;IA2Bf;;;OAGG;IACH,gFAzCqB,GAAG,KAAK,IAAI,CAkEhC;IAED;;;;;;;OAOG;IACH,6BANW,MAAM,6BAEN,OAAO,iBACS,IAAI,CA8B9B;IAED;;;OAGG;IACH,qBAFW,MAAM,WA/Fc,GAAG,KAAK,IAAI,CAuG1C;IAED;;;OAGG;IACH,oBAFW,MAAM,OAIhB;IAED;;;OAGG;IACH,qBAFW,MAAM,OAKhB;IAED;;OAEG;IACH,0FAIC;IAED;;;;;OAKG;IACH,0CAJW,MAAM,GACJ,aAAa,CASzB;IAID;;;;OAIG;IACH,uBAFW,MAAM,mBA4EhB;IAED;;;;OAIG;IACH,qBAFW,MAAM,OAKhB;;CACJ;;;;;;4BA9P4F,MAAM,IAAI,KAAK,IAAI;gBAAc,MAAM,IAAI;gBAAc,MAAM,MAAM"}
|
|
@@ -82,10 +82,11 @@ export default class ParamMediator {
|
|
|
82
82
|
*
|
|
83
83
|
* @param {string} paramName
|
|
84
84
|
* @param {T} initialValue
|
|
85
|
+
* @param {boolean} [passive] If true, the setter will not notify listeners when the value changes.
|
|
85
86
|
* @returns {(value: T) => void}
|
|
86
87
|
* @template T
|
|
87
88
|
*/
|
|
88
|
-
allocateSetter(paramName, initialValue) {
|
|
89
|
+
allocateSetter(paramName, initialValue, passive = false) {
|
|
89
90
|
if (this.#allocatedSetters.has(paramName)) {
|
|
90
91
|
throw new Error(
|
|
91
92
|
"Setter already allocated for parameter: " + paramName
|
|
@@ -99,7 +100,7 @@ export default class ParamMediator {
|
|
|
99
100
|
this.#paramValues.set(paramName, value);
|
|
100
101
|
|
|
101
102
|
const listeners = this.paramListeners.get(paramName);
|
|
102
|
-
if (listeners) {
|
|
103
|
+
if (listeners && !passive) {
|
|
103
104
|
for (const listener of listeners) {
|
|
104
105
|
listener();
|
|
105
106
|
}
|
|
@@ -55,6 +55,19 @@ describe("Single-level ParamMediator", () => {
|
|
|
55
55
|
expect(calls).toBe(2);
|
|
56
56
|
});
|
|
57
57
|
|
|
58
|
+
test("Passive parameter does not trigger listeners", () => {
|
|
59
|
+
const pm = new ParamMediator();
|
|
60
|
+
const setter = pm.allocateSetter("foo", 42, true);
|
|
61
|
+
const expr = pm.createExpression("foo");
|
|
62
|
+
|
|
63
|
+
let result = expr();
|
|
64
|
+
|
|
65
|
+
expr.addListener(() => (result = expr()));
|
|
66
|
+
|
|
67
|
+
setter(50);
|
|
68
|
+
expect(result).toBe(42);
|
|
69
|
+
});
|
|
70
|
+
|
|
58
71
|
test("Expression invalidation", () => {
|
|
59
72
|
const pm = new ParamMediator();
|
|
60
73
|
const setter = pm.allocateSetter("foo", 42);
|
|
@@ -55,7 +55,7 @@ export function isSampleSpec(spec: import("../spec/view.js").ViewSpec): spec is
|
|
|
55
55
|
export const VIEW_ROOT_NAME: "viewRoot";
|
|
56
56
|
/**
|
|
57
57
|
* @typedef {object} ViewFactoryOptions
|
|
58
|
-
* @property {boolean} [allowImport]
|
|
58
|
+
* @property {boolean} [allowImport] allows imports from urls
|
|
59
59
|
* @property {boolean} [wrapRoot]
|
|
60
60
|
*/
|
|
61
61
|
/**
|
|
@@ -102,6 +102,9 @@ export class ViewFactory {
|
|
|
102
102
|
#private;
|
|
103
103
|
}
|
|
104
104
|
export type ViewFactoryOptions = {
|
|
105
|
+
/**
|
|
106
|
+
* allows imports from urls
|
|
107
|
+
*/
|
|
105
108
|
allowImport?: boolean;
|
|
106
109
|
wrapRoot?: boolean;
|
|
107
110
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"viewFactory.d.ts","sourceRoot":"","sources":["../../../src/view/viewFactory.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"viewFactory.d.ts","sourceRoot":"","sources":["../../../src/view/viewFactory.js"],"names":[],"mappings":"AAgRA;;;;GAIG;AACH,iHAEC;AAED;;;;GAIG;AACH,mHAEC;AAED;;;;GAIG;AACH,mHAOC;AAED;;;;GAIG;AACH,yIAMC;AAED;;;;GAIG;AACH,mCAHW,MAAM,gDAKhB;AAED;;;;GAIG;AACH,uHAEC;AAED;;;;GAIG;AACH,6FAEC;AAED;;;;GAIG;AACH,qHAEC;AAED;;;;GAIG;AACH,2HAOC;AAlWD,wCAAyC;AAEzC;;;;GAIG;AAEH;;GAEG;AACH;IAiBI;;OAEG;IACH,sBAFW,kBAAkB,EAoC5B;IAjCG,2CAA2C;IAC3C,SADW,SAAS,kBAAkB,CAAC,CAKtC;IA8BL;;;OAGG;IACH,qEAlDiC,OAAO,yHAC2B,OAAO,oBAAoB,EAAE,OAAO,eAAe,OAAO,WAAW,EAAE,OAAO,gBAAgB,MAAM,KAAK,IAAI,QAmD/K;IAED;;;;;;OAMG;IACH,wHAJW,OAAO,oBAAoB,EAAE,OAAO,eACpC,OAAO,WAAW,EAAE,OAAO,gBAC3B,MAAM,QAmBhB;IAED;;;;OAIG;IACH,iGAQC;IAED;;;;;;;;;;OAUG;IACH,uKALW,OAAO,oBAAoB,EAAE,OAAO,eACpC,OAAO,WAAW,EAAE,OAAO,gBAC3B,MAAM,4DACc,IAAI,iBAuElC;;CACJ;;;;;kBAjMa,OAAO;eACP,OAAO;;iBAfJ,WAAW"}
|
|
@@ -13,7 +13,7 @@ export const VIEW_ROOT_NAME = "viewRoot";
|
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* @typedef {object} ViewFactoryOptions
|
|
16
|
-
* @property {boolean} [allowImport]
|
|
16
|
+
* @property {boolean} [allowImport] allows imports from urls
|
|
17
17
|
* @property {boolean} [wrapRoot]
|
|
18
18
|
*/
|
|
19
19
|
|
|
@@ -148,24 +148,33 @@ export class ViewFactory {
|
|
|
148
148
|
let viewSpec;
|
|
149
149
|
|
|
150
150
|
if (isImportSpec(spec)) {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
spec,
|
|
154
|
-
dataParent.getBaseUrl(),
|
|
155
|
-
context
|
|
156
|
-
);
|
|
151
|
+
/** @type {ViewSpec} */
|
|
152
|
+
let importedSpec;
|
|
157
153
|
|
|
158
|
-
|
|
159
|
-
|
|
154
|
+
if ("url" in spec.import) {
|
|
155
|
+
if (this.options.allowImport) {
|
|
156
|
+
importedSpec = await loadExternalViewSpec(
|
|
157
|
+
spec,
|
|
158
|
+
dataParent.getBaseUrl(),
|
|
159
|
+
context
|
|
160
|
+
);
|
|
161
|
+
} else {
|
|
162
|
+
throw new ViewError(
|
|
163
|
+
"Importing views is not allowed!",
|
|
164
|
+
layoutParent
|
|
165
|
+
);
|
|
160
166
|
}
|
|
161
|
-
|
|
162
|
-
|
|
167
|
+
} else if ("template" in spec.import) {
|
|
168
|
+
importedSpec = findTemplate(spec.import.template, dataParent);
|
|
163
169
|
} else {
|
|
164
|
-
throw new
|
|
165
|
-
"Importing views is not allowed!",
|
|
166
|
-
layoutParent
|
|
167
|
-
);
|
|
170
|
+
throw new Error("Invalid import: " + JSON.stringify(spec));
|
|
168
171
|
}
|
|
172
|
+
|
|
173
|
+
validator?.(importedSpec);
|
|
174
|
+
|
|
175
|
+
applyParamsToImportedSpec(importedSpec, spec);
|
|
176
|
+
|
|
177
|
+
viewSpec = importedSpec;
|
|
169
178
|
} else {
|
|
170
179
|
viewSpec = spec;
|
|
171
180
|
}
|
|
@@ -200,19 +209,38 @@ export class ViewFactory {
|
|
|
200
209
|
}
|
|
201
210
|
|
|
202
211
|
/**
|
|
203
|
-
*
|
|
212
|
+
* @param {string} name
|
|
213
|
+
* @param {View} view Start searching from this view, then search within its parent, etc.
|
|
214
|
+
*/
|
|
215
|
+
function findTemplate(name, view) {
|
|
216
|
+
const template = view.spec?.templates?.[name];
|
|
217
|
+
if (template) {
|
|
218
|
+
// Ensure that the template is not altered
|
|
219
|
+
return structuredClone(template);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
if (view.dataParent) {
|
|
223
|
+
return findTemplate(name, view.dataParent);
|
|
224
|
+
} else {
|
|
225
|
+
throw new Error(
|
|
226
|
+
`Cannot find template "${name}" in current view or its ancestors!`
|
|
227
|
+
);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/**
|
|
204
232
|
* @param {ViewSpec} importedSpec
|
|
205
|
-
* @param {import("../spec/view.js").
|
|
233
|
+
* @param {import("../spec/view.js").ImportSpec} importSpec
|
|
206
234
|
*/
|
|
207
|
-
function applyParamsToImportedSpec(importedSpec,
|
|
208
|
-
if (
|
|
209
|
-
importedSpec.name =
|
|
235
|
+
function applyParamsToImportedSpec(importedSpec, importSpec) {
|
|
236
|
+
if (importSpec.name != null) {
|
|
237
|
+
importedSpec.name = importSpec.name;
|
|
210
238
|
}
|
|
211
239
|
|
|
212
|
-
const params = isArray(
|
|
213
|
-
?
|
|
214
|
-
: isObject(
|
|
215
|
-
? Object.entries(
|
|
240
|
+
const params = isArray(importSpec.params)
|
|
241
|
+
? importSpec.params
|
|
242
|
+
: isObject(importSpec.params)
|
|
243
|
+
? Object.entries(importSpec.params).map(([name, value]) => ({
|
|
216
244
|
name,
|
|
217
245
|
value,
|
|
218
246
|
}))
|
|
@@ -10,12 +10,6 @@ export function isFacetFieldDef(def: import("../spec/channel.js").ChannelDef | i
|
|
|
10
10
|
* @returns {spec is FacetMapping}
|
|
11
11
|
*/
|
|
12
12
|
export function isFacetMapping(def: import("../spec/channel.js").FacetFieldDef | import("../spec/view.js").FacetMapping): spec is FacetMapping;
|
|
13
|
-
/**
|
|
14
|
-
*
|
|
15
|
-
* @param {object} config
|
|
16
|
-
* @returns {config is ImportConfig}
|
|
17
|
-
*/
|
|
18
|
-
export function isImportConfig(config: object): config is ImportConfig;
|
|
19
13
|
/**
|
|
20
14
|
* Returns all marks in the order (DFS) they are rendered
|
|
21
15
|
* @param {View} root
|
|
@@ -60,8 +54,9 @@ export function findEncodedFields(view: View): {
|
|
|
60
54
|
* @param {import("../spec/view.js").ImportSpec} spec
|
|
61
55
|
* @param {string} baseUrl
|
|
62
56
|
* @param {import("../types/viewContext.js").default} viewContext
|
|
57
|
+
* @returns {Promise<import("../spec/view.js").ViewSpec>}
|
|
63
58
|
*/
|
|
64
|
-
export function loadExternalViewSpec(spec: import("../spec/view.js").ImportSpec, baseUrl: string, viewContext: import("../types/viewContext.js").default): Promise<
|
|
59
|
+
export function loadExternalViewSpec(spec: import("../spec/view.js").ImportSpec, baseUrl: string, viewContext: import("../types/viewContext.js").default): Promise<import("../spec/view.js").ViewSpec>;
|
|
65
60
|
/**
|
|
66
61
|
* @param {function(View, View[]):void} visitor
|
|
67
62
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"viewUtils.d.ts","sourceRoot":"","sources":["../../../src/view/viewUtils.js"],"names":[],"mappings":"AAWA;;;;GAIG;AACH,qCAHW,OAAO,oBAAoB,EAAE,UAAU,GAAG,OAAO,iBAAiB,EAAE,YAAY,yBAK1F;AAED;;;;GAIG;AACH,oCAHW,OAAO,oBAAoB,EAAE,aAAa,GAAG,OAAO,iBAAiB,EAAE,YAAY,wBAQ7F;AAED
|
|
1
|
+
{"version":3,"file":"viewUtils.d.ts","sourceRoot":"","sources":["../../../src/view/viewUtils.js"],"names":[],"mappings":"AAWA;;;;GAIG;AACH,qCAHW,OAAO,oBAAoB,EAAE,UAAU,GAAG,OAAO,iBAAiB,EAAE,YAAY,yBAK1F;AAED;;;;GAIG;AACH,oCAHW,OAAO,oBAAoB,EAAE,aAAa,GAAG,OAAO,iBAAiB,EAAE,YAAY,wBAQ7F;AAED;;;GAGG;AACH,+BAFW,IAAI,wCAMd;AAED;;;;GAIG;AACH,wCAFW,IAAI,UASd;AAED;;GAEG;AACH,kDAFW,IAAI,QAiBd;AAED;;;;;;;GAOG;AACH,4CAFW,IAAI,QAUd;AAED;;;;GAIG;AACH,qCAJW,IAAI,iBACJ,OAAO,qBAAqB,EAAE,OAAO,CAAC,IAAI,CAAC,wDAcrD;AAED;;;GAGG;AACH,wCAFW,IAAI;UAGO,QAAQ;aAAW,OAAO,oBAAoB,EAAE,OAAO;WAAS,OAAO,oBAAoB,EAAE,KAAK;UAAQ,OAAO,oBAAoB,EAAE,IAAI;IAqBhK;AAED;;;;;GAKG;AACH,2CALW,OAAO,iBAAiB,EAAE,UAAU,WACpC,MAAM,eACN,OAAO,yBAAyB,EAAE,OAAO,GACvC,QAAQ,OAAO,iBAAiB,EAAE,QAAQ,CAAC,CA6BvD;AAED;;GAEG;AACH,gDAFoB,IAAI,QAAE,IAAI,EAAE,KAAE,IAAI,+BAkBrC;AAED;;;;;;GAMG;AACH,4CAJW,IAAI,QACJ,MAAM,GACJ,IAAI,EAAE,CAalB;AAED;;;GAGG;AACH,0CAFW,IAAI,eAqBd;AAOD;;GAEG;AACH,gDAFW,IAAI,mDAId;AAED;;GAEG;AACH,kDAFW,OAAO,wBAAwB,EAAE,cAAc;;;EAczD;AAxBM,uCAFI,MAAM,WAE0D;iBA/O9B,WAAW;qBAFnC,eAAe"}
|
|
@@ -30,15 +30,6 @@ export function isFacetMapping(def) {
|
|
|
30
30
|
);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
/**
|
|
34
|
-
*
|
|
35
|
-
* @param {object} config
|
|
36
|
-
* @returns {config is ImportConfig}
|
|
37
|
-
*/
|
|
38
|
-
export function isImportConfig(config) {
|
|
39
|
-
return "name" in config || "url" in config;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
33
|
/**
|
|
43
34
|
* Returns all marks in the order (DFS) they are rendered
|
|
44
35
|
* @param {View} root
|
|
@@ -151,34 +142,34 @@ export function findEncodedFields(view) {
|
|
|
151
142
|
* @param {import("../spec/view.js").ImportSpec} spec
|
|
152
143
|
* @param {string} baseUrl
|
|
153
144
|
* @param {import("../types/viewContext.js").default} viewContext
|
|
145
|
+
* @returns {Promise<import("../spec/view.js").ViewSpec>}
|
|
154
146
|
*/
|
|
155
147
|
export async function loadExternalViewSpec(spec, baseUrl, viewContext) {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
}
|
|
148
|
+
const importParam = spec.import;
|
|
149
|
+
if ("url" in importParam) {
|
|
150
|
+
const loader = vegaLoader({ baseURL: baseUrl });
|
|
151
|
+
const url = importParam.url;
|
|
161
152
|
|
|
162
|
-
|
|
163
|
-
|
|
153
|
+
const importedSpec = JSON.parse(
|
|
154
|
+
await loader.load(url).catch((/** @type {Error} */ e) => {
|
|
155
|
+
throw new Error(
|
|
156
|
+
`Could not load imported view spec: ${url} \nReason: ${e.message}`
|
|
157
|
+
);
|
|
158
|
+
})
|
|
159
|
+
);
|
|
164
160
|
|
|
165
|
-
|
|
166
|
-
|
|
161
|
+
if (viewContext.isViewSpec(importedSpec)) {
|
|
162
|
+
importedSpec.baseUrl = url.match(/^[^?#]*\//)?.[0];
|
|
163
|
+
return importedSpec;
|
|
164
|
+
} else {
|
|
167
165
|
throw new Error(
|
|
168
|
-
`
|
|
166
|
+
`The imported spec "${url}" is not a view spec: ${JSON.stringify(
|
|
167
|
+
spec
|
|
168
|
+
)}`
|
|
169
169
|
);
|
|
170
|
-
}
|
|
171
|
-
);
|
|
172
|
-
|
|
173
|
-
if (viewContext.isViewSpec(importedSpec)) {
|
|
174
|
-
importedSpec.baseUrl = url.match(/^[^?#]*\//)?.[0];
|
|
175
|
-
return importedSpec;
|
|
170
|
+
}
|
|
176
171
|
} else {
|
|
177
|
-
throw new Error(
|
|
178
|
-
`The imported spec "${url}" is not a view spec: ${JSON.stringify(
|
|
179
|
-
spec
|
|
180
|
-
)}`
|
|
181
|
-
);
|
|
172
|
+
throw new Error("Not an url import: " + JSON.stringify(importParam));
|
|
182
173
|
}
|
|
183
174
|
}
|
|
184
175
|
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
},
|
|
8
8
|
"contributors": [],
|
|
9
9
|
"license": "MIT",
|
|
10
|
-
"version": "0.
|
|
10
|
+
"version": "0.46.1",
|
|
11
11
|
"jsdelivr": "dist/bundle/index.js",
|
|
12
12
|
"unpkg": "dist/bundle/index.js",
|
|
13
13
|
"browser": "dist/bundle/index.js",
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"vega-scale": "^7.3.1",
|
|
65
65
|
"vega-util": "^1.17.2"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "9e43f979e60032c4a6a3780b1eba429358917bd7"
|
|
68
68
|
}
|
/package/dist/bundle/{__vite-browser-external-ENoMJThg.js → __vite-browser-external-C--ziKoh.js}
RENAMED
|
File without changes
|
|
File without changes
|