@hestia-earth/ui-components 0.42.29 → 0.42.31

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.
@@ -16,7 +16,9 @@ import { select, selectAll } from 'd3-selection';
16
16
  import { isEmpty, unique, monthsBefore, toPrecision, isNumber, isUndefined, toComma, duration, keyToLabel, sum, min, max, mean, median, ellipsis as ellipsis$1, getPercentileValue, isEqual as isEqual$2, diffInDays } from '@hestia-earth/utils';
17
17
  import { json2csv } from 'json-2-csv';
18
18
  import { propertyValue as propertyValue$1, emptyValue } from '@hestia-earth/utils/term';
19
- import { getDefaultModelId, getModelGroup, loadResourceKey, getArrayTreatment, isInSystemBoundary } from '@hestia-earth/glossary';
19
+ import defaultModelId from '@hestia-earth/glossary/resources/defaultModelId.json';
20
+ import modelGroups from '@hestia-earth/glossary/resources/modelGroups.json';
21
+ import inHestiaDefaultSystemBoundary from '@hestia-earth/glossary/resources/inHestiaDefaultSystemBoundary.json';
20
22
  import isEqual$1 from 'lodash.isequal';
21
23
  import { DataState, filenameWithoutExt, nodeTypeToParam, allowedDataStates, SupportedExtensions, fileToExt, fileExt, maxFileSizeMb } from '@hestia-earth/api';
22
24
  import { models as models$1, loadConfig, getFormulas, renderFormula, getMaxStage } from '@hestia-earth/engine-models';
@@ -37,6 +39,7 @@ import { Chart, BarController, LineController, CategoryScale, LinearScale, Point
37
39
  import C2S from 'canvas-to-svg';
38
40
  import 'chartjs-adapter-date-fns';
39
41
  import annotationPlugin from 'chartjs-plugin-annotation';
42
+ import emissionGroupings from '@hestia-earth/glossary/resources/emission-groupings.json';
40
43
  import { headersFromCsv, toCsv as toCsv$1, toJson, toCsvPivot, ErrorKeys } from '@hestia-earth/schema-convert';
41
44
  import { isCSVIncluded, isDefaultCSVSelected } from '@hestia-earth/json-schema/schema-utils';
42
45
  import { recommendedProperties, loadSchemas } from '@hestia-earth/json-schema';
@@ -45,6 +48,7 @@ import { ScrollStrategyOptions, CdkOverlayOrigin, CdkConnectedOverlay } from '@a
45
48
  import { ResizableDirective, ResizeHandleDirective } from 'angular-resizable-element';
46
49
  import set from 'lodash.set';
47
50
  import { MarkdownComponent } from 'ngx-markdown';
51
+ import arrayTreatment from '@hestia-earth/glossary/resources/arrayTreatment.json';
48
52
  import * as semver from 'semver';
49
53
  import { parse } from 'papaparse';
50
54
  import omit from 'lodash.omit';
@@ -895,6 +899,17 @@ const polygonBounds = (polygon) => {
895
899
  return paths.reduce((prev, curr) => prev.extend(curr), new google.maps.LatLngBounds());
896
900
  };
897
901
 
902
+ // Local re-implementations of the `@hestia-earth/glossary` getters that read the resources directly
903
+ // instead of via the glossary barrel. Importing the barrel pulls its module into the bundle and can
904
+ // duplicate a resource when another consumer imports the same file by subpath; going straight to the
905
+ // resource avoids both. Keep these in sync with the getters in `@hestia-earth/glossary/index.mjs`.
906
+ const getDefaultModelId = (id) => defaultModelId[id];
907
+ const getModelGroup = (id, modelId) => (modelGroups[id] || {})[modelId];
908
+ const isInSystemBoundary = (id) => {
909
+ const value = inHestiaDefaultSystemBoundary[id];
910
+ return !value || value === 'true';
911
+ };
912
+
898
913
  const maxAreaSize = 5000;
899
914
  const siteTooBig = ({ area }) => area && area / 100 > maxAreaSize;
900
915
  const hasMultipleValues = (values) => (values || []).length > 1;
@@ -6794,7 +6809,7 @@ const toLine = (values) => values.map(escape).join(',');
6794
6809
 
6795
6810
  class CyclesEmissionsCategoryService {
6796
6811
  constructor() {
6797
- this.data = loadResourceKey('emission-groupings.json');
6812
+ this.data = emissionGroupings;
6798
6813
  this.categoryLabel = (key) => (key ? keyToLabel(key.replace(/category/gi, '')) : 'Unset');
6799
6814
  /**
6800
6815
  * The list of all available categories.
@@ -10584,7 +10599,7 @@ const measurementFormula = (values, termId, total) => {
10584
10599
  const arrayTreatmentFormula = (numbers, termId, total) => {
10585
10600
  const list = numbers.map(formatFormulaValue);
10586
10601
  const count = numbers.length;
10587
- switch (getArrayTreatment(termId)) {
10602
+ switch (arrayTreatment[termId] || 'sum') {
10588
10603
  case 'mean':
10589
10604
  return `Average of ${count} values: (${list.join(' + ')}) / ${count} = ${total}`;
10590
10605
  case 'mode':