@xplortech/apollo-data 0.0.5 → 0.0.7
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/README.md +15 -91
- package/dist/apollo-data/apollo-data.esm.js +1 -1
- package/dist/apollo-data/p-4d3f0792.entry.js +1 -0
- package/dist/apollo-data/p-C2k3WBpi.js +11 -0
- package/dist/apollo-data/p-D64asVrg.js +2 -0
- package/dist/apollo-data/{p-b7471c12.entry.js → p-e2c3a317.entry.js} +1 -1
- package/dist/cjs/apollo-data-bar-chart_5.cjs.entry.js +1193 -0
- package/dist/cjs/{apollo-data-base-CxVQ-WVP.js → apollo-data-base-COGMOEqL.js} +7 -11
- package/dist/cjs/apollo-data-donut-chart.cjs.entry.js +3 -3
- package/dist/cjs/apollo-data.cjs.js +3 -3
- package/dist/cjs/{index-Cl7HgRm0.js → index-Bd5risOy.js} +116 -63
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/apollo-data-base.js +4 -8
- package/dist/collection/collection-manifest.json +5 -2
- package/dist/collection/components/apollo-data-bar/apollo-data-bar.js +10 -9
- package/dist/collection/components/apollo-data-bar/apollo-data-bar.stories.js +122 -0
- package/dist/collection/components/apollo-data-donut/apollo-data-donut.js +1 -1
- package/dist/collection/components/apollo-data-donut/apollo-data-donut.stories.js +132 -0
- package/dist/collection/components/apollo-data-heat-map/apollo-data-heat-map.js +208 -0
- package/dist/collection/components/apollo-data-heat-map/apollo-data-heat-map.stories.js +137 -0
- package/dist/collection/components/apollo-data-line/apollo-data-line.js +8 -6
- package/dist/collection/components/apollo-data-line/apollo-data-line.stories.js +122 -0
- package/dist/collection/components/apollo-data-scatter/apollo-data-scatter.js +1 -1
- package/dist/collection/components/apollo-data-scatter/apollo-data-scatter.stories.js +147 -0
- package/dist/collection/components/apollo-data-world-map/apollo-data-world-map.js +294 -0
- package/dist/collection/components/apollo-data-world-map/apollo-data-world-map.stories.js +126 -0
- package/dist/collection/examples/apollo-data-heat-map.examples.js +131 -0
- package/dist/collection/examples/apollo-data-world-map.examples.js +45 -0
- package/dist/collection/examples/index.js +2 -0
- package/dist/collection/utils/code-generator.js +1 -1
- package/dist/components/apollo-data-bar-chart.js +1 -1
- package/dist/components/apollo-data-donut-chart.js +1 -1
- package/dist/components/apollo-data-heat-map.d.ts +11 -0
- package/dist/components/apollo-data-heat-map.js +1 -0
- package/dist/components/apollo-data-line-chart.js +1 -1
- package/dist/components/apollo-data-scatter-chart.js +1 -1
- package/dist/components/apollo-data-world-map-chart.d.ts +11 -0
- package/dist/components/apollo-data-world-map-chart.js +1 -0
- package/dist/components/index.js +1 -1
- package/dist/components/p-CfbMSXKd.js +11 -0
- package/dist/components/p-gcjU8DVr.js +1 -0
- package/dist/esm/apollo-data-bar-chart_5.entry.js +1187 -0
- package/dist/esm/{apollo-data-base-BWkrM8dc.js → apollo-data-base-C2k3WBpi.js} +7 -11
- package/dist/esm/apollo-data-donut-chart.entry.js +3 -3
- package/dist/esm/apollo-data.js +4 -4
- package/dist/esm/{index-Bb2nY-Tf.js → index-D64asVrg.js} +116 -63
- package/dist/esm/loader.js +3 -3
- package/dist/types/apollo-data-base.d.ts +2 -2
- package/dist/types/components/apollo-data-bar/apollo-data-bar.stories.d.ts +5 -0
- package/dist/types/components/apollo-data-donut/apollo-data-donut.stories.d.ts +5 -0
- package/dist/types/components/apollo-data-heat-map/apollo-data-heat-map.d.ts +140 -0
- package/dist/types/components/apollo-data-heat-map/apollo-data-heat-map.stories.d.ts +5 -0
- package/dist/types/components/apollo-data-line/apollo-data-line.stories.d.ts +5 -0
- package/dist/types/components/apollo-data-scatter/apollo-data-scatter.d.ts +1 -3
- package/dist/types/components/apollo-data-scatter/apollo-data-scatter.stories.d.ts +5 -0
- package/dist/types/components/apollo-data-world-map/apollo-data-world-map.d.ts +281 -0
- package/dist/types/components/apollo-data-world-map/apollo-data-world-map.stories.d.ts +5 -0
- package/dist/types/components.d.ts +128 -8
- package/dist/types/examples/apollo-data-heat-map.examples.d.ts +11 -0
- package/dist/types/examples/apollo-data-scatter.examples.d.ts +1 -1
- package/dist/types/examples/apollo-data-world-map.examples.d.ts +11 -0
- package/dist/types/examples/index.d.ts +2 -0
- package/dist/types/stencil-public-runtime.d.ts +23 -2
- package/dist/types/utils/code-generator.d.ts +1 -3
- package/package.json +8 -8
- package/src/examples/apollo-data-bar.examples.ts +157 -157
- package/src/examples/apollo-data-heat-map.examples.ts +147 -0
- package/src/examples/apollo-data-line.examples.ts +91 -91
- package/src/examples/apollo-data-scatter.examples.ts +1 -1
- package/src/examples/apollo-data-world-map.examples.ts +57 -0
- package/src/examples/index.ts +3 -1
- package/dist/apollo-data/p-2nuV5Vny.js +0 -1
- package/dist/apollo-data/p-4ac3c97c.entry.js +0 -1
- package/dist/apollo-data/p-BWkrM8dc.js +0 -11
- package/dist/apollo-data/p-Bb2nY-Tf.js +0 -2
- package/dist/apollo-data/p-e518baac.entry.js +0 -1
- package/dist/cjs/apollo-data-bar-chart.cjs.entry.js +0 -314
- package/dist/cjs/apollo-data-line-chart_2.cjs.entry.js +0 -534
- package/dist/cjs/constants-B3weDEpc.js +0 -5
- package/dist/components/p-7XF5Cax8.js +0 -11
- package/dist/components/p-Dws5s-Xe.js +0 -1
- package/dist/esm/apollo-data-bar-chart.entry.js +0 -312
- package/dist/esm/apollo-data-line-chart_2.entry.js +0 -531
- package/dist/esm/constants-2nuV5Vny.js +0 -3
|
@@ -22831,7 +22831,7 @@ var boundsStream$1 = {
|
|
|
22831
22831
|
boundsStream$1.lineEnd = boundsLineEnd;
|
|
22832
22832
|
if (areaRingSum$1 < 0) lambda0 = -(lambda1 = 180), phi0 = -(phi1 = 90);
|
|
22833
22833
|
else if (deltaSum > epsilon$3) phi1 = 90;
|
|
22834
|
-
else if (deltaSum < -
|
|
22834
|
+
else if (deltaSum < -epsilon$3) phi0 = -90;
|
|
22835
22835
|
range$4[0] = lambda0, range$4[1] = lambda1;
|
|
22836
22836
|
},
|
|
22837
22837
|
sphere: function() {
|
|
@@ -23432,7 +23432,7 @@ function polygonContains(polygon, point) {
|
|
|
23432
23432
|
// from the point to the South pole. If it is zero, then the point is the
|
|
23433
23433
|
// same side as the South pole.
|
|
23434
23434
|
|
|
23435
|
-
return (angle < -
|
|
23435
|
+
return (angle < -epsilon$3 || angle < epsilon$3 && sum < -epsilon2) ^ (winding & 1);
|
|
23436
23436
|
}
|
|
23437
23437
|
|
|
23438
23438
|
function clip$1(pointVisible, clipLine, interpolate, start) {
|
|
@@ -23883,7 +23883,7 @@ function clipLine(a, b, x0, y0, x1, y1) {
|
|
|
23883
23883
|
return true;
|
|
23884
23884
|
}
|
|
23885
23885
|
|
|
23886
|
-
var clipMax = 1e9, clipMin = -
|
|
23886
|
+
var clipMax = 1e9, clipMin = -clipMax;
|
|
23887
23887
|
|
|
23888
23888
|
// TODO Use d3-polygon’s polygonContains here for the ring check?
|
|
23889
23889
|
// TODO Eliminate duplicate buffering in clipBuffer and polygon.push?
|
|
@@ -67613,17 +67613,12 @@ async function _embed(el, spec, opts = {}, loader) {
|
|
|
67613
67613
|
return { view, spec, vgSpec, finalize, embedOptions: opts };
|
|
67614
67614
|
}
|
|
67615
67615
|
|
|
67616
|
-
// @ts-ignore
|
|
67617
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-constraint
|
|
67618
67616
|
class ApolloBase {
|
|
67619
|
-
// @ts-ignore
|
|
67620
|
-
getViewData(data, spec) {
|
|
67621
|
-
throw new Error('getViewData is not implemented');
|
|
67622
|
-
}
|
|
67623
67617
|
async renderChart() {
|
|
67624
67618
|
// Wait for shadow DOM to be ready
|
|
67625
|
-
await new Promise(resolve =>
|
|
67626
|
-
|
|
67619
|
+
await new Promise(resolve => {
|
|
67620
|
+
setTimeout(resolve, 0);
|
|
67621
|
+
});
|
|
67627
67622
|
const container = this.el?.shadowRoot?.querySelector('#container');
|
|
67628
67623
|
if (!container) {
|
|
67629
67624
|
return;
|
|
@@ -67635,6 +67630,7 @@ class ApolloBase {
|
|
|
67635
67630
|
spec = typeof this.adSpec === 'string' ? JSON.parse(this.adSpec) : this.adSpec;
|
|
67636
67631
|
}
|
|
67637
67632
|
catch (err) {
|
|
67633
|
+
// eslint-disable-next-line no-console
|
|
67638
67634
|
console.error('Error parsing data/spec', err);
|
|
67639
67635
|
return;
|
|
67640
67636
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
4
|
-
var apolloDataBase = require('./apollo-data-base-
|
|
3
|
+
var index = require('./index-Bd5risOy.js');
|
|
4
|
+
var apolloDataBase = require('./apollo-data-base-COGMOEqL.js');
|
|
5
5
|
|
|
6
6
|
const ApolloDataDonutChart = class extends apolloDataBase.ApolloBase {
|
|
7
7
|
constructor(hostRef) {
|
|
@@ -401,7 +401,7 @@ const ApolloDataDonutChart = class extends apolloDataBase.ApolloBase {
|
|
|
401
401
|
};
|
|
402
402
|
}
|
|
403
403
|
render() {
|
|
404
|
-
return (index.h(index.Host, { key: '
|
|
404
|
+
return (index.h(index.Host, { key: '5d9ba4976956c4f0d29b9aa8638373895c0c3f7f' }, index.h("div", { key: '2db6d1418492898de84a167e35ecc8b16d695942', id: "container", style: { width: '100%', height: '100%' } })));
|
|
405
405
|
}
|
|
406
406
|
};
|
|
407
407
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-Bd5risOy.js');
|
|
4
4
|
var appGlobals = require('./app-globals-V2Kpy_OQ.js');
|
|
5
5
|
|
|
6
6
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
7
7
|
/*
|
|
8
|
-
Stencil Client Patch Browser v4.
|
|
8
|
+
Stencil Client Patch Browser v4.43.2 | MIT Licensed | https://stenciljs.com
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
var patchBrowser = () => {
|
|
@@ -19,7 +19,7 @@ var patchBrowser = () => {
|
|
|
19
19
|
|
|
20
20
|
patchBrowser().then(async (options) => {
|
|
21
21
|
await appGlobals.globalScripts();
|
|
22
|
-
return index.bootstrapLazy([["apollo-data-
|
|
22
|
+
return index.bootstrapLazy([["apollo-data-bar-chart_5.cjs",[[513,"apollo-data-bar-chart",{"adData":[1,"ad-data"],"adSpec":[1,"ad-spec"]}],[513,"apollo-data-heat-map",{"adData":[1,"ad-data"],"adSpec":[1,"ad-spec"]}],[513,"apollo-data-line-chart",{"adData":[1,"ad-data"],"adSpec":[1,"ad-spec"]}],[513,"apollo-data-scatter-chart",{"adData":[1,"ad-data"],"adSpec":[1,"ad-spec"]}],[513,"apollo-data-world-map-chart",{"adData":[1,"ad-data"],"adSpec":[1,"ad-spec"]}]]],["apollo-data-donut-chart.cjs",[[513,"apollo-data-donut-chart",{"adData":[1,"ad-data"],"adSpec":[1,"ad-spec"]}]]]], options);
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
exports.setNonce = index.setNonce;
|
|
@@ -4,9 +4,22 @@ const NAMESPACE = 'apollo-data';
|
|
|
4
4
|
const BUILD = /* apollo-data */ { hydratedSelectorName: "hydrated", lazyLoad: true, prop: true, propChangeCallback: false, updatable: true};
|
|
5
5
|
|
|
6
6
|
/*
|
|
7
|
-
Stencil Client Platform v4.
|
|
7
|
+
Stencil Client Platform v4.43.2 | MIT Licensed | https://stenciljs.com
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
+
|
|
11
|
+
// src/utils/get-prop-descriptor.ts
|
|
12
|
+
function getPropertyDescriptor(obj, memberName, getOnly) {
|
|
13
|
+
const stopAt = typeof HTMLElement !== "undefined" ? HTMLElement.prototype : null;
|
|
14
|
+
while (obj && obj !== stopAt) {
|
|
15
|
+
const desc = Object.getOwnPropertyDescriptor(obj, memberName);
|
|
16
|
+
if (desc && (!getOnly || desc.get)) return desc;
|
|
17
|
+
obj = Object.getPrototypeOf(obj);
|
|
18
|
+
}
|
|
19
|
+
return void 0;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// src/utils/es2022-rewire-class-members.ts
|
|
10
23
|
var reWireGetterSetter = (instance, hostRef) => {
|
|
11
24
|
var _a;
|
|
12
25
|
const cmpMeta = hostRef.$cmpMeta$;
|
|
@@ -14,7 +27,7 @@ var reWireGetterSetter = (instance, hostRef) => {
|
|
|
14
27
|
members.map(([memberName, [memberFlags]]) => {
|
|
15
28
|
if ((memberFlags & 31 /* Prop */ || memberFlags & 32 /* State */)) {
|
|
16
29
|
const ogValue = instance[memberName];
|
|
17
|
-
const ogDescriptor = getPropertyDescriptor(Object.getPrototypeOf(instance), memberName) || Object.getOwnPropertyDescriptor(instance, memberName);
|
|
30
|
+
const ogDescriptor = getPropertyDescriptor(Object.getPrototypeOf(instance), memberName, true) || Object.getOwnPropertyDescriptor(instance, memberName);
|
|
18
31
|
if (ogDescriptor) {
|
|
19
32
|
Object.defineProperty(instance, memberName, {
|
|
20
33
|
get() {
|
|
@@ -27,18 +40,14 @@ var reWireGetterSetter = (instance, hostRef) => {
|
|
|
27
40
|
enumerable: true
|
|
28
41
|
});
|
|
29
42
|
}
|
|
30
|
-
|
|
43
|
+
if (hostRef.$instanceValues$.has(memberName)) {
|
|
44
|
+
instance[memberName] = hostRef.$instanceValues$.get(memberName);
|
|
45
|
+
} else if (ogValue !== void 0) {
|
|
46
|
+
instance[memberName] = ogValue;
|
|
47
|
+
}
|
|
31
48
|
}
|
|
32
49
|
});
|
|
33
50
|
};
|
|
34
|
-
function getPropertyDescriptor(obj, memberName) {
|
|
35
|
-
while (obj) {
|
|
36
|
-
const desc = Object.getOwnPropertyDescriptor(obj, memberName);
|
|
37
|
-
if (desc == null ? void 0 : desc.get) return desc;
|
|
38
|
-
obj = Object.getPrototypeOf(obj);
|
|
39
|
-
}
|
|
40
|
-
return void 0;
|
|
41
|
-
}
|
|
42
51
|
|
|
43
52
|
// src/client/client-host-ref.ts
|
|
44
53
|
var getHostRef = (ref) => {
|
|
@@ -327,15 +336,45 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRen
|
|
|
327
336
|
}
|
|
328
337
|
}
|
|
329
338
|
}
|
|
330
|
-
} else if (memberName === "key") ; else {
|
|
339
|
+
} else if (memberName === "key") ; else if (memberName[0] === "a" && memberName.startsWith("attr:")) {
|
|
340
|
+
const propName = memberName.slice(5);
|
|
341
|
+
let attrName;
|
|
342
|
+
{
|
|
343
|
+
const hostRef = getHostRef(elm);
|
|
344
|
+
if (hostRef && hostRef.$cmpMeta$ && hostRef.$cmpMeta$.$members$) {
|
|
345
|
+
const memberMeta = hostRef.$cmpMeta$.$members$[propName];
|
|
346
|
+
if (memberMeta && memberMeta[1]) {
|
|
347
|
+
attrName = memberMeta[1];
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
if (!attrName) {
|
|
352
|
+
attrName = propName.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
353
|
+
}
|
|
354
|
+
if (newValue == null || newValue === false) {
|
|
355
|
+
if (newValue !== false || elm.getAttribute(attrName) === "") {
|
|
356
|
+
elm.removeAttribute(attrName);
|
|
357
|
+
}
|
|
358
|
+
} else {
|
|
359
|
+
elm.setAttribute(attrName, newValue === true ? "" : newValue);
|
|
360
|
+
}
|
|
361
|
+
return;
|
|
362
|
+
} else if (memberName[0] === "p" && memberName.startsWith("prop:")) {
|
|
363
|
+
const propName = memberName.slice(5);
|
|
364
|
+
try {
|
|
365
|
+
elm[propName] = newValue;
|
|
366
|
+
} catch (e) {
|
|
367
|
+
}
|
|
368
|
+
return;
|
|
369
|
+
} else {
|
|
331
370
|
const isComplex = isComplexType(newValue);
|
|
332
|
-
if ((isProp || isComplex && newValue !== null) &&
|
|
371
|
+
if ((isProp || isComplex && newValue !== null) && !isSvg) {
|
|
333
372
|
try {
|
|
334
373
|
if (!elm.tagName.includes("-")) {
|
|
335
374
|
const n = newValue == null ? "" : newValue;
|
|
336
375
|
if (memberName === "list") {
|
|
337
376
|
isProp = false;
|
|
338
|
-
} else if (oldValue == null || elm[memberName]
|
|
377
|
+
} else if (oldValue == null || elm[memberName] !== n) {
|
|
339
378
|
if (typeof elm.__lookupSetter__(memberName) === "function") {
|
|
340
379
|
elm[memberName] = n;
|
|
341
380
|
} else {
|
|
@@ -685,7 +724,7 @@ var updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
|
685
724
|
if (childrenPromises.length === 0) {
|
|
686
725
|
postUpdate();
|
|
687
726
|
} else {
|
|
688
|
-
Promise.all(childrenPromises).then(postUpdate);
|
|
727
|
+
Promise.all(childrenPromises).then(postUpdate).catch(postUpdate);
|
|
689
728
|
hostRef.$flags$ |= 4 /* isWaitingForChildren */;
|
|
690
729
|
childrenPromises.length = 0;
|
|
691
730
|
}
|
|
@@ -787,13 +826,16 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
787
826
|
const didValueChange = newVal !== oldVal && !areBothNaN;
|
|
788
827
|
if ((!(flags & 8 /* isConstructingInstance */) || oldVal === void 0) && didValueChange) {
|
|
789
828
|
hostRef.$instanceValues$.set(propName, newVal);
|
|
790
|
-
if (
|
|
829
|
+
if (flags & 2 /* hasRendered */) {
|
|
791
830
|
if (instance.componentShouldUpdate) {
|
|
792
|
-
|
|
831
|
+
const shouldUpdate = instance.componentShouldUpdate(newVal, oldVal, propName);
|
|
832
|
+
if (shouldUpdate === false && !(flags & 16 /* isQueuedForUpdate */)) {
|
|
793
833
|
return;
|
|
794
834
|
}
|
|
795
835
|
}
|
|
796
|
-
|
|
836
|
+
if (!(flags & 16 /* isQueuedForUpdate */)) {
|
|
837
|
+
scheduleUpdate(hostRef, false);
|
|
838
|
+
}
|
|
797
839
|
}
|
|
798
840
|
}
|
|
799
841
|
};
|
|
@@ -806,7 +848,7 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
806
848
|
const members = Object.entries((_a = cmpMeta.$members$) != null ? _a : {});
|
|
807
849
|
members.map(([memberName, [memberFlags]]) => {
|
|
808
850
|
if ((memberFlags & 31 /* Prop */ || (flags & 2 /* proxyState */) && memberFlags & 32 /* State */)) {
|
|
809
|
-
const { get: origGetter, set: origSetter } =
|
|
851
|
+
const { get: origGetter, set: origSetter } = getPropertyDescriptor(prototype, memberName) || {};
|
|
810
852
|
if (origGetter) cmpMeta.$members$[memberName][0] |= 2048 /* Getter */;
|
|
811
853
|
if (origSetter) cmpMeta.$members$[memberName][0] |= 4096 /* Setter */;
|
|
812
854
|
if (flags & 1 /* isElementConstructor */ || !origGetter) {
|
|
@@ -936,53 +978,64 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
936
978
|
// src/runtime/initialize-component.ts
|
|
937
979
|
var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
938
980
|
let Cstr;
|
|
939
|
-
|
|
940
|
-
hostRef.$flags$
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
981
|
+
try {
|
|
982
|
+
if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
|
|
983
|
+
hostRef.$flags$ |= 32 /* hasInitializedComponent */;
|
|
984
|
+
const bundleId = cmpMeta.$lazyBundleId$;
|
|
985
|
+
if (bundleId) {
|
|
986
|
+
const CstrImport = loadModule(cmpMeta, hostRef);
|
|
987
|
+
if (CstrImport && "then" in CstrImport) {
|
|
988
|
+
const endLoad = uniqueTime();
|
|
989
|
+
Cstr = await CstrImport;
|
|
990
|
+
endLoad();
|
|
991
|
+
} else {
|
|
992
|
+
Cstr = CstrImport;
|
|
993
|
+
}
|
|
994
|
+
if (!Cstr) {
|
|
995
|
+
throw new Error(`Constructor for "${cmpMeta.$tagName$}#${hostRef.$modeName$}" was not found`);
|
|
996
|
+
}
|
|
997
|
+
if (!Cstr.isProxied) {
|
|
998
|
+
proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
|
|
999
|
+
Cstr.isProxied = true;
|
|
1000
|
+
}
|
|
1001
|
+
const endNewInstance = createTime("createInstance", cmpMeta.$tagName$);
|
|
1002
|
+
{
|
|
1003
|
+
hostRef.$flags$ |= 8 /* isConstructingInstance */;
|
|
1004
|
+
}
|
|
1005
|
+
try {
|
|
1006
|
+
new Cstr(hostRef);
|
|
1007
|
+
} catch (e) {
|
|
1008
|
+
consoleError(e, elm);
|
|
1009
|
+
}
|
|
1010
|
+
{
|
|
1011
|
+
hostRef.$flags$ &= -9 /* isConstructingInstance */;
|
|
1012
|
+
}
|
|
1013
|
+
endNewInstance();
|
|
1014
|
+
{
|
|
1015
|
+
fireConnectedCallback(hostRef.$lazyInstance$, elm);
|
|
1016
|
+
}
|
|
948
1017
|
} else {
|
|
949
|
-
Cstr =
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
throw new Error(`Constructor for "${cmpMeta.$tagName$}#${hostRef.$modeName$}" was not found`);
|
|
953
|
-
}
|
|
954
|
-
if (!Cstr.isProxied) {
|
|
955
|
-
proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
|
|
956
|
-
Cstr.isProxied = true;
|
|
957
|
-
}
|
|
958
|
-
const endNewInstance = createTime("createInstance", cmpMeta.$tagName$);
|
|
959
|
-
{
|
|
960
|
-
hostRef.$flags$ |= 8 /* isConstructingInstance */;
|
|
961
|
-
}
|
|
962
|
-
try {
|
|
963
|
-
new Cstr(hostRef);
|
|
964
|
-
} catch (e) {
|
|
965
|
-
consoleError(e, elm);
|
|
966
|
-
}
|
|
967
|
-
{
|
|
968
|
-
hostRef.$flags$ &= -9 /* isConstructingInstance */;
|
|
969
|
-
}
|
|
970
|
-
endNewInstance();
|
|
971
|
-
{
|
|
972
|
-
fireConnectedCallback(hostRef.$lazyInstance$, elm);
|
|
1018
|
+
Cstr = elm.constructor;
|
|
1019
|
+
const cmpTag = elm.localName;
|
|
1020
|
+
customElements.whenDefined(cmpTag).then(() => hostRef.$flags$ |= 128 /* isWatchReady */);
|
|
973
1021
|
}
|
|
1022
|
+
}
|
|
1023
|
+
const ancestorComponent = hostRef.$ancestorComponent$;
|
|
1024
|
+
const schedule = () => scheduleUpdate(hostRef, true);
|
|
1025
|
+
if (ancestorComponent && ancestorComponent["s-rc"]) {
|
|
1026
|
+
ancestorComponent["s-rc"].push(schedule);
|
|
974
1027
|
} else {
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
1028
|
+
schedule();
|
|
1029
|
+
}
|
|
1030
|
+
} catch (e) {
|
|
1031
|
+
consoleError(e, elm);
|
|
1032
|
+
if (hostRef.$onRenderResolve$) {
|
|
1033
|
+
hostRef.$onRenderResolve$();
|
|
1034
|
+
hostRef.$onRenderResolve$ = void 0;
|
|
1035
|
+
}
|
|
1036
|
+
if (hostRef.$onReadyResolve$) {
|
|
1037
|
+
hostRef.$onReadyResolve$(elm);
|
|
978
1038
|
}
|
|
979
|
-
}
|
|
980
|
-
const ancestorComponent = hostRef.$ancestorComponent$;
|
|
981
|
-
const schedule = () => scheduleUpdate(hostRef, true);
|
|
982
|
-
if (ancestorComponent && ancestorComponent["s-rc"]) {
|
|
983
|
-
ancestorComponent["s-rc"].push(schedule);
|
|
984
|
-
} else {
|
|
985
|
-
schedule();
|
|
986
1039
|
}
|
|
987
1040
|
};
|
|
988
1041
|
var fireConnectedCallback = (instance, elm) => {
|
|
@@ -1013,7 +1066,7 @@ var connectedCallback = (elm) => {
|
|
|
1013
1066
|
}
|
|
1014
1067
|
if (cmpMeta.$members$) {
|
|
1015
1068
|
Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
|
|
1016
|
-
if (memberFlags & 31 /* Prop */ &&
|
|
1069
|
+
if (memberFlags & 31 /* Prop */ && Object.prototype.hasOwnProperty.call(elm, memberName)) {
|
|
1017
1070
|
const value = elm[memberName];
|
|
1018
1071
|
delete elm[memberName];
|
|
1019
1072
|
elm[memberName] = value;
|
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-Bd5risOy.js');
|
|
4
4
|
var appGlobals = require('./app-globals-V2Kpy_OQ.js');
|
|
5
5
|
|
|
6
6
|
const defineCustomElements = async (win, options) => {
|
|
7
7
|
if (typeof window === 'undefined') return undefined;
|
|
8
8
|
await appGlobals.globalScripts();
|
|
9
|
-
return index.bootstrapLazy([["apollo-data-
|
|
9
|
+
return index.bootstrapLazy([["apollo-data-bar-chart_5.cjs",[[513,"apollo-data-bar-chart",{"adData":[1,"ad-data"],"adSpec":[1,"ad-spec"]}],[513,"apollo-data-heat-map",{"adData":[1,"ad-data"],"adSpec":[1,"ad-spec"]}],[513,"apollo-data-line-chart",{"adData":[1,"ad-data"],"adSpec":[1,"ad-spec"]}],[513,"apollo-data-scatter-chart",{"adData":[1,"ad-data"],"adSpec":[1,"ad-spec"]}],[513,"apollo-data-world-map-chart",{"adData":[1,"ad-data"],"adSpec":[1,"ad-spec"]}]]],["apollo-data-donut-chart.cjs",[[513,"apollo-data-donut-chart",{"adData":[1,"ad-data"],"adSpec":[1,"ad-spec"]}]]]], options);
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
exports.setNonce = index.setNonce;
|
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
// @ts-ignore
|
|
2
1
|
import embed from "vega-embed";
|
|
3
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-constraint
|
|
4
2
|
export class ApolloBase {
|
|
5
|
-
// @ts-ignore
|
|
6
|
-
getViewData(data, spec) {
|
|
7
|
-
throw new Error('getViewData is not implemented');
|
|
8
|
-
}
|
|
9
3
|
async renderChart() {
|
|
10
4
|
// Wait for shadow DOM to be ready
|
|
11
|
-
await new Promise(resolve =>
|
|
12
|
-
|
|
5
|
+
await new Promise(resolve => {
|
|
6
|
+
setTimeout(resolve, 0);
|
|
7
|
+
});
|
|
13
8
|
const container = this.el?.shadowRoot?.querySelector('#container');
|
|
14
9
|
if (!container) {
|
|
15
10
|
return;
|
|
@@ -21,6 +16,7 @@ export class ApolloBase {
|
|
|
21
16
|
spec = typeof this.adSpec === 'string' ? JSON.parse(this.adSpec) : this.adSpec;
|
|
22
17
|
}
|
|
23
18
|
catch (err) {
|
|
19
|
+
// eslint-disable-next-line no-console
|
|
24
20
|
console.error('Error parsing data/spec', err);
|
|
25
21
|
return;
|
|
26
22
|
}
|
|
@@ -2,12 +2,15 @@
|
|
|
2
2
|
"entries": [
|
|
3
3
|
"components/apollo-data-bar/apollo-data-bar.js",
|
|
4
4
|
"components/apollo-data-donut/apollo-data-donut.js",
|
|
5
|
+
"components/apollo-data-heat-map/apollo-data-heat-map.js",
|
|
5
6
|
"components/apollo-data-line/apollo-data-line.js",
|
|
6
|
-
"components/apollo-data-scatter/apollo-data-scatter.js"
|
|
7
|
+
"components/apollo-data-scatter/apollo-data-scatter.js",
|
|
8
|
+
"components/apollo-data-world-map/apollo-data-world-map.js"
|
|
7
9
|
],
|
|
10
|
+
"mixins": [],
|
|
8
11
|
"compiler": {
|
|
9
12
|
"name": "@stencil/core",
|
|
10
|
-
"version": "4.
|
|
13
|
+
"version": "4.43.2",
|
|
11
14
|
"typescriptVersion": "5.8.3"
|
|
12
15
|
},
|
|
13
16
|
"collections": [],
|
|
@@ -17,12 +17,13 @@ export class ApolloDataBarChart extends ApolloBase {
|
|
|
17
17
|
await this.renderChart();
|
|
18
18
|
}
|
|
19
19
|
injectTooltipStyles() {
|
|
20
|
-
|
|
20
|
+
const chartClass = this.constructor;
|
|
21
|
+
if (chartClass.tooltipStylesInjected) {
|
|
21
22
|
return;
|
|
22
23
|
}
|
|
23
24
|
const styleId = 'apollo-data-bar-tooltip-styles';
|
|
24
25
|
if (document.getElementById(styleId)) {
|
|
25
|
-
|
|
26
|
+
chartClass.tooltipStylesInjected = true;
|
|
26
27
|
return;
|
|
27
28
|
}
|
|
28
29
|
const style = document.createElement('style');
|
|
@@ -71,16 +72,16 @@ export class ApolloDataBarChart extends ApolloBase {
|
|
|
71
72
|
}
|
|
72
73
|
`;
|
|
73
74
|
document.head.appendChild(style);
|
|
74
|
-
|
|
75
|
+
chartClass.tooltipStylesInjected = true;
|
|
75
76
|
}
|
|
76
|
-
// @ts-ignore
|
|
77
77
|
async getViewData(data, spec) {
|
|
78
|
+
const componentTag = this.el?.tagName?.toLowerCase() ?? 'apollo-data-bar-chart';
|
|
78
79
|
if (!spec) {
|
|
79
|
-
throw new Error(
|
|
80
|
+
throw new Error(`adSpec is required for ${componentTag}`);
|
|
80
81
|
}
|
|
81
82
|
const { tooltipPrefix = '', currencySymbol = '' } = spec;
|
|
82
83
|
if (!data || data.length === 0) {
|
|
83
|
-
throw new Error(
|
|
84
|
+
throw new Error(`Data is required for ${componentTag}`);
|
|
84
85
|
}
|
|
85
86
|
const uniqueCategories = Array.from(new Set(data.map(item => item.category)));
|
|
86
87
|
const formatNumber = tooltipPrefix ? '.2f' : '.0f';
|
|
@@ -131,7 +132,7 @@ export class ApolloDataBarChart extends ApolloBase {
|
|
|
131
132
|
name: 'hoveredPeriod',
|
|
132
133
|
value: null,
|
|
133
134
|
on: [
|
|
134
|
-
{ events: 'rect:mouseover', update: 'datum.
|
|
135
|
+
{ events: 'rect:mouseover', update: 'datum.periodId' },
|
|
135
136
|
{ events: 'rect:mouseout', update: 'null' },
|
|
136
137
|
],
|
|
137
138
|
},
|
|
@@ -295,7 +296,7 @@ export class ApolloDataBarChart extends ApolloBase {
|
|
|
295
296
|
},
|
|
296
297
|
},
|
|
297
298
|
update: {
|
|
298
|
-
opacity: [{ test: 'hoveredPeriod && datum.
|
|
299
|
+
opacity: [{ test: 'hoveredPeriod && datum.periodId !== hoveredPeriod', value: 0.2 }, { value: 1 }],
|
|
299
300
|
},
|
|
300
301
|
},
|
|
301
302
|
},
|
|
@@ -303,7 +304,7 @@ export class ApolloDataBarChart extends ApolloBase {
|
|
|
303
304
|
};
|
|
304
305
|
}
|
|
305
306
|
render() {
|
|
306
|
-
return (h(Host, { key: '
|
|
307
|
+
return (h(Host, { key: 'fd34c44431e85e36cec86ff19c7142c2deb2e9ff' }, h("div", { key: 'f3e9c269e4817b0f06233860c67649f1e1d9ec16', id: "container", style: { width: '100%', height: '100%' } })));
|
|
307
308
|
}
|
|
308
309
|
static get is() { return "apollo-data-bar-chart"; }
|
|
309
310
|
static get encapsulation() { return "shadow"; }
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { html } from "lit-html";
|
|
2
|
+
import { barExamples } from "../../examples/apollo-data-bar.examples";
|
|
3
|
+
import { generateReactCode, generateVueCode, generateWebComponentCode, generateInstallationDocs } from "../../utils/code-generator";
|
|
4
|
+
function getCodeForFramework(props, framework) {
|
|
5
|
+
switch (framework) {
|
|
6
|
+
case 'vue':
|
|
7
|
+
return generateVueCode('apollo-data-bar-chart', props);
|
|
8
|
+
case 'webcomponent':
|
|
9
|
+
return generateWebComponentCode('apollo-data-bar-chart', props);
|
|
10
|
+
case 'react':
|
|
11
|
+
default:
|
|
12
|
+
return generateReactCode('apollo-data-bar-chart', props);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
const meta = {
|
|
16
|
+
title: 'Apollo Data/Bar Chart',
|
|
17
|
+
tags: ['autodocs'],
|
|
18
|
+
argTypes: {
|
|
19
|
+
adData: {
|
|
20
|
+
control: 'object',
|
|
21
|
+
description: 'Array of data items. Each item must have label (string), category (string), value (number), and periodId (string, typically a date YYYY-MM-DD).',
|
|
22
|
+
table: {
|
|
23
|
+
type: {
|
|
24
|
+
summary: 'BarDataItem[]',
|
|
25
|
+
detail: 'interface BarDataItem {\n label: string;\n category: string;\n value: number;\n periodId: string; // date string e.g. YYYY-MM-DD\n}',
|
|
26
|
+
},
|
|
27
|
+
defaultValue: { summary: '[]' },
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
adSpec: {
|
|
31
|
+
control: 'object',
|
|
32
|
+
description: 'Specification object for customizing the chart appearance.',
|
|
33
|
+
table: {
|
|
34
|
+
type: {
|
|
35
|
+
summary: 'BarSpec',
|
|
36
|
+
detail: 'interface BarSpec {\n colorSet?: string[];\n tooltipPrefix?: string;\n currencySymbol?: string;\n yAxisTitle?: string;\n xAxisTitle?: string;\n}',
|
|
37
|
+
},
|
|
38
|
+
defaultValue: { summary: '{}' },
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
decorators: [
|
|
43
|
+
(story, context) => {
|
|
44
|
+
const framework = context.globals?.framework || 'react';
|
|
45
|
+
setTimeout(() => {
|
|
46
|
+
const doc = globalThis.document;
|
|
47
|
+
if (doc) {
|
|
48
|
+
const installSections = {
|
|
49
|
+
react: doc.querySelector('.install-react'),
|
|
50
|
+
vue: doc.querySelector('.install-vue'),
|
|
51
|
+
webcomponent: doc.querySelector('.install-webcomponent'),
|
|
52
|
+
};
|
|
53
|
+
Object.values(installSections).forEach((section) => {
|
|
54
|
+
if (section)
|
|
55
|
+
section.setAttribute('style', 'display: none;');
|
|
56
|
+
});
|
|
57
|
+
const selectedSection = installSections[framework];
|
|
58
|
+
if (selectedSection)
|
|
59
|
+
selectedSection.setAttribute('style', 'display: block;');
|
|
60
|
+
}
|
|
61
|
+
}, 0);
|
|
62
|
+
return story();
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
parameters: {
|
|
66
|
+
docs: {
|
|
67
|
+
description: {
|
|
68
|
+
component: `${generateInstallationDocs('react', 'apollo-data-bar-chart')}
|
|
69
|
+
|
|
70
|
+
${generateInstallationDocs('vue', 'apollo-data-bar-chart')}
|
|
71
|
+
|
|
72
|
+
${generateInstallationDocs('webcomponent', 'apollo-data-bar-chart')}
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## Description
|
|
77
|
+
|
|
78
|
+
A stacked bar chart component built with Vega that displays data by period with interactive hover effects. Each data item has a \`label\` (shown on the x-axis), \`category\`, \`value\`, and \`periodId\` (use a date string like \`YYYY-MM-DD\` for the period). Use \`adSpec.xAxisTitle\` and \`adSpec.yAxisTitle\` to customize axis labels. The example uses the monthly sales by product preset from \`barExamples\`.
|
|
79
|
+
|
|
80
|
+
**Tip:** Use the Framework selector in the toolbar above to switch between React, Vue, and Web Component installation instructions and code examples.`,
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
viewMode: 'story',
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
export default meta;
|
|
87
|
+
const chartWrapper = (args) => html `
|
|
88
|
+
<div style="width: 800px; height: 400px;">
|
|
89
|
+
<apollo-data-bar-chart .adData=${args.adData} .adSpec=${args.adSpec}></apollo-data-bar-chart>
|
|
90
|
+
</div>
|
|
91
|
+
`;
|
|
92
|
+
export const MonthlySalesByProduct = {
|
|
93
|
+
args: {
|
|
94
|
+
adData: barExamples[1].props.adData,
|
|
95
|
+
adSpec: barExamples[1].props.adSpec ?? {},
|
|
96
|
+
},
|
|
97
|
+
render: args => chartWrapper(args),
|
|
98
|
+
parameters: {
|
|
99
|
+
codeGenerator: (args, framework) => getCodeForFramework({ adData: args.adData ?? barExamples[1].props.adData, adSpec: args.adSpec ?? barExamples[1].props.adSpec ?? {} }, framework),
|
|
100
|
+
docs: {
|
|
101
|
+
description: { story: barExamples[1].description },
|
|
102
|
+
source: {
|
|
103
|
+
language: 'tsx',
|
|
104
|
+
type: 'dynamic',
|
|
105
|
+
transform: (_code, storyContext) => {
|
|
106
|
+
try {
|
|
107
|
+
const framework = storyContext?.globals?.framework || 'react';
|
|
108
|
+
const props = {
|
|
109
|
+
adData: storyContext?.args?.adData ?? barExamples[1].props.adData,
|
|
110
|
+
adSpec: storyContext?.args?.adSpec ?? barExamples[1].props.adSpec ?? {},
|
|
111
|
+
};
|
|
112
|
+
return getCodeForFramework(props, framework);
|
|
113
|
+
}
|
|
114
|
+
catch (error) {
|
|
115
|
+
console.error('Error in transform function:', error);
|
|
116
|
+
return `<apollo-data-bar-chart />`;
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
};
|
|
@@ -397,7 +397,7 @@ export class ApolloDataDonutChart extends ApolloBase {
|
|
|
397
397
|
};
|
|
398
398
|
}
|
|
399
399
|
render() {
|
|
400
|
-
return (h(Host, { key: '
|
|
400
|
+
return (h(Host, { key: '5d9ba4976956c4f0d29b9aa8638373895c0c3f7f' }, h("div", { key: '2db6d1418492898de84a167e35ecc8b16d695942', id: "container", style: { width: '100%', height: '100%' } })));
|
|
401
401
|
}
|
|
402
402
|
static get is() { return "apollo-data-donut-chart"; }
|
|
403
403
|
static get encapsulation() { return "shadow"; }
|