@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.
Files changed (84) hide show
  1. package/README.md +15 -91
  2. package/dist/apollo-data/apollo-data.esm.js +1 -1
  3. package/dist/apollo-data/p-4d3f0792.entry.js +1 -0
  4. package/dist/apollo-data/p-C2k3WBpi.js +11 -0
  5. package/dist/apollo-data/p-D64asVrg.js +2 -0
  6. package/dist/apollo-data/{p-b7471c12.entry.js → p-e2c3a317.entry.js} +1 -1
  7. package/dist/cjs/apollo-data-bar-chart_5.cjs.entry.js +1193 -0
  8. package/dist/cjs/{apollo-data-base-CxVQ-WVP.js → apollo-data-base-COGMOEqL.js} +7 -11
  9. package/dist/cjs/apollo-data-donut-chart.cjs.entry.js +3 -3
  10. package/dist/cjs/apollo-data.cjs.js +3 -3
  11. package/dist/cjs/{index-Cl7HgRm0.js → index-Bd5risOy.js} +116 -63
  12. package/dist/cjs/loader.cjs.js +2 -2
  13. package/dist/collection/apollo-data-base.js +4 -8
  14. package/dist/collection/collection-manifest.json +5 -2
  15. package/dist/collection/components/apollo-data-bar/apollo-data-bar.js +10 -9
  16. package/dist/collection/components/apollo-data-bar/apollo-data-bar.stories.js +122 -0
  17. package/dist/collection/components/apollo-data-donut/apollo-data-donut.js +1 -1
  18. package/dist/collection/components/apollo-data-donut/apollo-data-donut.stories.js +132 -0
  19. package/dist/collection/components/apollo-data-heat-map/apollo-data-heat-map.js +208 -0
  20. package/dist/collection/components/apollo-data-heat-map/apollo-data-heat-map.stories.js +137 -0
  21. package/dist/collection/components/apollo-data-line/apollo-data-line.js +8 -6
  22. package/dist/collection/components/apollo-data-line/apollo-data-line.stories.js +122 -0
  23. package/dist/collection/components/apollo-data-scatter/apollo-data-scatter.js +1 -1
  24. package/dist/collection/components/apollo-data-scatter/apollo-data-scatter.stories.js +147 -0
  25. package/dist/collection/components/apollo-data-world-map/apollo-data-world-map.js +294 -0
  26. package/dist/collection/components/apollo-data-world-map/apollo-data-world-map.stories.js +126 -0
  27. package/dist/collection/examples/apollo-data-heat-map.examples.js +131 -0
  28. package/dist/collection/examples/apollo-data-world-map.examples.js +45 -0
  29. package/dist/collection/examples/index.js +2 -0
  30. package/dist/collection/utils/code-generator.js +1 -1
  31. package/dist/components/apollo-data-bar-chart.js +1 -1
  32. package/dist/components/apollo-data-donut-chart.js +1 -1
  33. package/dist/components/apollo-data-heat-map.d.ts +11 -0
  34. package/dist/components/apollo-data-heat-map.js +1 -0
  35. package/dist/components/apollo-data-line-chart.js +1 -1
  36. package/dist/components/apollo-data-scatter-chart.js +1 -1
  37. package/dist/components/apollo-data-world-map-chart.d.ts +11 -0
  38. package/dist/components/apollo-data-world-map-chart.js +1 -0
  39. package/dist/components/index.js +1 -1
  40. package/dist/components/p-CfbMSXKd.js +11 -0
  41. package/dist/components/p-gcjU8DVr.js +1 -0
  42. package/dist/esm/apollo-data-bar-chart_5.entry.js +1187 -0
  43. package/dist/esm/{apollo-data-base-BWkrM8dc.js → apollo-data-base-C2k3WBpi.js} +7 -11
  44. package/dist/esm/apollo-data-donut-chart.entry.js +3 -3
  45. package/dist/esm/apollo-data.js +4 -4
  46. package/dist/esm/{index-Bb2nY-Tf.js → index-D64asVrg.js} +116 -63
  47. package/dist/esm/loader.js +3 -3
  48. package/dist/types/apollo-data-base.d.ts +2 -2
  49. package/dist/types/components/apollo-data-bar/apollo-data-bar.stories.d.ts +5 -0
  50. package/dist/types/components/apollo-data-donut/apollo-data-donut.stories.d.ts +5 -0
  51. package/dist/types/components/apollo-data-heat-map/apollo-data-heat-map.d.ts +140 -0
  52. package/dist/types/components/apollo-data-heat-map/apollo-data-heat-map.stories.d.ts +5 -0
  53. package/dist/types/components/apollo-data-line/apollo-data-line.stories.d.ts +5 -0
  54. package/dist/types/components/apollo-data-scatter/apollo-data-scatter.d.ts +1 -3
  55. package/dist/types/components/apollo-data-scatter/apollo-data-scatter.stories.d.ts +5 -0
  56. package/dist/types/components/apollo-data-world-map/apollo-data-world-map.d.ts +281 -0
  57. package/dist/types/components/apollo-data-world-map/apollo-data-world-map.stories.d.ts +5 -0
  58. package/dist/types/components.d.ts +128 -8
  59. package/dist/types/examples/apollo-data-heat-map.examples.d.ts +11 -0
  60. package/dist/types/examples/apollo-data-scatter.examples.d.ts +1 -1
  61. package/dist/types/examples/apollo-data-world-map.examples.d.ts +11 -0
  62. package/dist/types/examples/index.d.ts +2 -0
  63. package/dist/types/stencil-public-runtime.d.ts +23 -2
  64. package/dist/types/utils/code-generator.d.ts +1 -3
  65. package/package.json +8 -8
  66. package/src/examples/apollo-data-bar.examples.ts +157 -157
  67. package/src/examples/apollo-data-heat-map.examples.ts +147 -0
  68. package/src/examples/apollo-data-line.examples.ts +91 -91
  69. package/src/examples/apollo-data-scatter.examples.ts +1 -1
  70. package/src/examples/apollo-data-world-map.examples.ts +57 -0
  71. package/src/examples/index.ts +3 -1
  72. package/dist/apollo-data/p-2nuV5Vny.js +0 -1
  73. package/dist/apollo-data/p-4ac3c97c.entry.js +0 -1
  74. package/dist/apollo-data/p-BWkrM8dc.js +0 -11
  75. package/dist/apollo-data/p-Bb2nY-Tf.js +0 -2
  76. package/dist/apollo-data/p-e518baac.entry.js +0 -1
  77. package/dist/cjs/apollo-data-bar-chart.cjs.entry.js +0 -314
  78. package/dist/cjs/apollo-data-line-chart_2.cjs.entry.js +0 -534
  79. package/dist/cjs/constants-B3weDEpc.js +0 -5
  80. package/dist/components/p-7XF5Cax8.js +0 -11
  81. package/dist/components/p-Dws5s-Xe.js +0 -1
  82. package/dist/esm/apollo-data-bar-chart.entry.js +0 -312
  83. package/dist/esm/apollo-data-line-chart_2.entry.js +0 -531
  84. 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 < -1e-6) phi0 = -90;
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 < -1e-6 || angle < epsilon$3 && sum < -1e-12) ^ (winding & 1);
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 = -1e9;
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 => setTimeout(resolve, 0));
67626
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
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-Cl7HgRm0.js');
4
- var apolloDataBase = require('./apollo-data-base-CxVQ-WVP.js');
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: 'fb26a6b02b83b0ce64a8301149b66f5d09a4a7b4' }, index.h("div", { key: 'fc08cdc3c0c0fda7f7c13149532eb61f511aa035', id: "container", style: { width: '100%', height: '100%' } })));
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-Cl7HgRm0.js');
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.41.3 | MIT Licensed | https://stenciljs.com
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-line-chart_2.cjs",[[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"]}]]],["apollo-data-bar-chart.cjs",[[513,"apollo-data-bar-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);
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.41.3 | MIT Licensed | https://stenciljs.com
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
- instance[memberName] = hostRef.$instanceValues$.has(memberName) ? hostRef.$instanceValues$.get(memberName) : ogValue;
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) && true) {
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] != n) {
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 ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
829
+ if (flags & 2 /* hasRendered */) {
791
830
  if (instance.componentShouldUpdate) {
792
- if (instance.componentShouldUpdate(newVal, oldVal, propName) === false) {
831
+ const shouldUpdate = instance.componentShouldUpdate(newVal, oldVal, propName);
832
+ if (shouldUpdate === false && !(flags & 16 /* isQueuedForUpdate */)) {
793
833
  return;
794
834
  }
795
835
  }
796
- scheduleUpdate(hostRef, false);
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 } = Object.getOwnPropertyDescriptor(prototype, memberName) || {};
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
- if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
940
- hostRef.$flags$ |= 32 /* hasInitializedComponent */;
941
- const bundleId = cmpMeta.$lazyBundleId$;
942
- if (bundleId) {
943
- const CstrImport = loadModule(cmpMeta, hostRef);
944
- if (CstrImport && "then" in CstrImport) {
945
- const endLoad = uniqueTime();
946
- Cstr = await CstrImport;
947
- endLoad();
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 = CstrImport;
950
- }
951
- if (!Cstr) {
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
- Cstr = elm.constructor;
976
- const cmpTag = elm.localName;
977
- customElements.whenDefined(cmpTag).then(() => hostRef.$flags$ |= 128 /* isWatchReady */);
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 */ && memberName in elm && elm[memberName] !== Object.prototype[memberName]) {
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;
@@ -1,12 +1,12 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-Cl7HgRm0.js');
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-line-chart_2.cjs",[[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"]}]]],["apollo-data-bar-chart.cjs",[[513,"apollo-data-bar-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);
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 => setTimeout(resolve, 0));
12
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
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.41.3",
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
- if (ApolloDataBarChart.tooltipStylesInjected) {
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
- ApolloDataBarChart.tooltipStylesInjected = true;
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
- ApolloDataBarChart.tooltipStylesInjected = true;
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('adSpec is required for apollo-data-bar-chart');
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('Data is required for apollo-data-bar-chart');
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.period' },
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.period !== hoveredPeriod', value: 0.2 }, { value: 1 }],
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: '86ed2e74e5abd57e684a93bc9cf6a014b3ed081c' }, h("div", { key: '96e5f7dd2dfa6a104ca709d1399308a86041c2f3', id: "container", style: { width: '100%', height: '100%' } })));
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: 'fb26a6b02b83b0ce64a8301149b66f5d09a4a7b4' }, h("div", { key: 'fc08cdc3c0c0fda7f7c13149532eb61f511aa035', id: "container", style: { width: '100%', height: '100%' } })));
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"; }