@amcharts/amcharts5 5.16.2 → 5.17.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/.internal/charts/map/MapChartDefaultTheme.d.ts.map +1 -1
- package/.internal/charts/map/MapChartDefaultTheme.js +3 -0
- package/.internal/charts/map/MapChartDefaultTheme.js.map +1 -1
- package/.internal/charts/map/MapSankeyNodes.d.ts +155 -0
- package/.internal/charts/map/MapSankeyNodes.d.ts.map +1 -0
- package/.internal/charts/map/MapSankeyNodes.js +151 -0
- package/.internal/charts/map/MapSankeyNodes.js.map +1 -0
- package/.internal/charts/map/MapSankeySeries.d.ts +412 -0
- package/.internal/charts/map/MapSankeySeries.d.ts.map +1 -0
- package/.internal/charts/map/MapSankeySeries.js +868 -0
- package/.internal/charts/map/MapSankeySeries.js.map +1 -0
- package/.internal/core/Classes.d.ts +6 -0
- package/.internal/core/Classes.d.ts.map +1 -1
- package/.internal/core/Classes.js.map +1 -1
- package/.internal/core/Registry.js +1 -1
- package/.internal/core/Registry.js.map +1 -1
- package/.internal/core/util/Entity.d.ts.map +1 -1
- package/.internal/core/util/Entity.js +6 -0
- package/.internal/core/util/Entity.js.map +1 -1
- package/.internal/core/util/Math.d.ts +132 -49
- package/.internal/core/util/Math.d.ts.map +1 -1
- package/.internal/core/util/Math.js +151 -50
- package/.internal/core/util/Math.js.map +1 -1
- package/.internal/core/util/Object.d.ts +24 -1
- package/.internal/core/util/Object.d.ts.map +1 -1
- package/.internal/core/util/Object.js +24 -1
- package/.internal/core/util/Object.js.map +1 -1
- package/.internal/core/util/Utils.d.ts +69 -3
- package/.internal/core/util/Utils.d.ts.map +1 -1
- package/.internal/core/util/Utils.js +72 -18
- package/.internal/core/util/Utils.js.map +1 -1
- package/.internal/plugins/json/Classes-script.d.ts +6 -0
- package/.internal/plugins/json/Classes-script.d.ts.map +1 -1
- package/.internal/plugins/json/Classes-script.js +3 -0
- package/.internal/plugins/json/Classes-script.js.map +1 -1
- package/.internal/plugins/json/Classes.d.ts +6 -0
- package/.internal/plugins/json/Classes.d.ts.map +1 -1
- package/.internal/plugins/json/Classes.js +3 -0
- package/.internal/plugins/json/Classes.js.map +1 -1
- package/CHANGELOG.md +23 -8
- package/examples/javascript/flow-arc-horizontal/package.json +1 -1
- package/examples/javascript/flow-arc-vertical/package.json +1 -1
- package/examples/javascript/flow-chord/package.json +1 -1
- package/examples/javascript/flow-chord-directed/package.json +1 -1
- package/examples/javascript/flow-chord-non-ribbon/package.json +1 -1
- package/examples/javascript/flow-sankey/package.json +1 -1
- package/examples/javascript/gantt/package.json +1 -1
- package/examples/javascript/gantt-multilevel/package.json +1 -1
- package/examples/javascript/gantt-simple/package.json +1 -1
- package/examples/javascript/gauge/package.json +1 -1
- package/examples/javascript/gauge-bands/package.json +1 -1
- package/examples/javascript/hierarchy-force-directed/package.json +1 -1
- package/examples/javascript/hierarchy-pack/package.json +1 -1
- package/examples/javascript/hierarchy-partition/package.json +1 -1
- package/examples/javascript/hierarchy-sunburst/package.json +1 -1
- package/examples/javascript/hierarchy-tree/package.json +1 -1
- package/examples/javascript/hierarchy-treemap/package.json +1 -1
- package/examples/javascript/hierarchy-voronoi-treemap/package.json +1 -1
- package/examples/javascript/jest/package.json +1 -1
- package/examples/javascript/json-pie/package.json +1 -1
- package/examples/javascript/json-xy/package.json +1 -1
- package/examples/javascript/map-animating-along-lines/package.json +1 -1
- package/examples/javascript/map-clustered-points/package.json +1 -1
- package/examples/javascript/map-day-and-night/package.json +1 -1
- package/examples/javascript/map-globe-rotate-to-country/package.json +1 -1
- package/examples/javascript/map-globe-with-projected-circles/package.json +1 -1
- package/examples/javascript/map-sankey/README.md +6 -0
- package/examples/javascript/map-sankey/index.css +11 -0
- package/examples/javascript/map-sankey/index.html +13 -0
- package/examples/javascript/map-sankey/index.js +361 -0
- package/examples/javascript/map-sankey/package.json +17 -0
- package/examples/javascript/map-sankey/webpack.config.js +38 -0
- package/examples/javascript/map-sankey-waypoints/README.md +6 -0
- package/examples/javascript/map-sankey-waypoints/index.css +11 -0
- package/examples/javascript/map-sankey-waypoints/index.html +13 -0
- package/examples/javascript/map-sankey-waypoints/index.js +394 -0
- package/examples/javascript/map-sankey-waypoints/package.json +17 -0
- package/examples/javascript/map-sankey-waypoints/webpack.config.js +38 -0
- package/examples/javascript/map-with-bubbles/package.json +1 -1
- package/examples/javascript/map-zoom-to-country/package.json +1 -1
- package/examples/javascript/misc-40-charts/package.json +1 -1
- package/examples/javascript/misc-microchart-grid/package.json +1 -1
- package/examples/javascript/pie-chart/package.json +1 -1
- package/examples/javascript/pie-donut-chart/package.json +1 -1
- package/examples/javascript/pie-variable-radius/package.json +1 -1
- package/examples/javascript/radar-column-iwatch-style/package.json +1 -1
- package/examples/javascript/radar-heat-map/package.json +1 -1
- package/examples/javascript/radar-line/package.json +1 -1
- package/examples/javascript/radar-time-line/package.json +1 -1
- package/examples/javascript/sliced-funnel/package.json +1 -1
- package/examples/javascript/sliced-pictorial-stacked/package.json +1 -1
- package/examples/javascript/sliced-pyramid/package.json +1 -1
- package/examples/javascript/stock-chart/package.json +1 -1
- package/examples/javascript/stock-chart-comparing-stocks/package.json +1 -1
- package/examples/javascript/stock-chart-data-granularity/package.json +1 -1
- package/examples/javascript/stock-chart-data-grouping/package.json +1 -1
- package/examples/javascript/stock-chart-intraday/package.json +1 -1
- package/examples/javascript/stock-chart-live/package.json +1 -1
- package/examples/javascript/stock-chart-volume-separate-panel/package.json +1 -1
- package/examples/javascript/timeline-horizontal-serpentine-chart/package.json +1 -1
- package/examples/javascript/timeline-linear-process-diagram/package.json +1 -1
- package/examples/javascript/timeline-serpentine-chart/package.json +1 -1
- package/examples/javascript/timeline-spiral-chart/package.json +1 -1
- package/examples/javascript/venn-diagram/package.json +1 -1
- package/examples/javascript/wordcloud-with-data/package.json +1 -1
- package/examples/javascript/wordcloud-with-text/package.json +1 -1
- package/examples/javascript/xy-100-percent-stacked-column/package.json +1 -1
- package/examples/javascript/xy-animated-bullet-at-the-end-of-the-series/package.json +1 -1
- package/examples/javascript/xy-bubble/package.json +1 -1
- package/examples/javascript/xy-candlestick/package.json +1 -1
- package/examples/javascript/xy-clustered-column/package.json +1 -1
- package/examples/javascript/xy-column/package.json +1 -1
- package/examples/javascript/xy-comparing-series-google-analytics-style/package.json +1 -1
- package/examples/javascript/xy-data-grouping/package.json +1 -1
- package/examples/javascript/xy-draggable-range/package.json +1 -1
- package/examples/javascript/xy-drawing-series-with-mouse-or-touch/package.json +1 -1
- package/examples/javascript/xy-dumbbell plot/package.json +1 -1
- package/examples/javascript/xy-evenly-spaced-date-axis/package.json +1 -1
- package/examples/javascript/xy-line/package.json +1 -1
- package/examples/javascript/xy-line-highlight-on-legend-hover/package.json +1 -1
- package/examples/javascript/xy-live-data/package.json +1 -1
- package/examples/javascript/xy-multiple-synced-value-axes/package.json +1 -1
- package/examples/javascript/xy-ohlc/package.json +1 -1
- package/examples/javascript/xy-real-time-data-sorting/package.json +1 -1
- package/examples/javascript/xy-smoothed-line/package.json +1 -1
- package/examples/javascript/xy-stacked-and-clustered-column/package.json +1 -1
- package/examples/javascript/xy-stacked-column/package.json +1 -1
- package/examples/javascript/xy-stacked-step/package.json +1 -1
- package/examples/javascript/xy-stock/package.json +1 -1
- package/examples/javascript/xy-stock-comparing/package.json +1 -1
- package/examples/typescript/flow-arc-horizontal/package.json +1 -1
- package/examples/typescript/flow-arc-vertical/package.json +1 -1
- package/examples/typescript/flow-chord/package.json +1 -1
- package/examples/typescript/flow-chord-directed/package.json +1 -1
- package/examples/typescript/flow-chord-non-ribbon/package.json +1 -1
- package/examples/typescript/flow-sankey/package.json +1 -1
- package/examples/typescript/gantt/package.json +1 -1
- package/examples/typescript/gantt-multilevel/package.json +1 -1
- package/examples/typescript/gantt-simple/package.json +1 -1
- package/examples/typescript/gauge/package.json +1 -1
- package/examples/typescript/gauge-bands/package.json +1 -1
- package/examples/typescript/hierarchy-force-directed/package.json +1 -1
- package/examples/typescript/hierarchy-pack/package.json +1 -1
- package/examples/typescript/hierarchy-partition/package.json +1 -1
- package/examples/typescript/hierarchy-sunburst/package.json +1 -1
- package/examples/typescript/hierarchy-tree/package.json +1 -1
- package/examples/typescript/hierarchy-treemap/package.json +1 -1
- package/examples/typescript/hierarchy-voronoi-treemap/package.json +1 -1
- package/examples/typescript/jest/package.json +1 -1
- package/examples/typescript/json-pie/package.json +1 -1
- package/examples/typescript/json-xy/package.json +1 -1
- package/examples/typescript/map-animating-along-lines/package.json +1 -1
- package/examples/typescript/map-clustered-points/package.json +1 -1
- package/examples/typescript/map-day-and-night/package.json +1 -1
- package/examples/typescript/map-globe-rotate-to-country/package.json +1 -1
- package/examples/typescript/map-globe-with-projected-circles/package.json +1 -1
- package/examples/typescript/map-sankey/README.md +6 -0
- package/examples/typescript/map-sankey/index.css +11 -0
- package/examples/typescript/map-sankey/index.html +13 -0
- package/examples/typescript/map-sankey/index.ts +361 -0
- package/examples/typescript/map-sankey/package.json +19 -0
- package/examples/typescript/map-sankey/tsconfig.json +12 -0
- package/examples/typescript/map-sankey/webpack.config.js +45 -0
- package/examples/typescript/map-sankey-waypoints/README.md +6 -0
- package/examples/typescript/map-sankey-waypoints/index.css +11 -0
- package/examples/typescript/map-sankey-waypoints/index.html +13 -0
- package/examples/typescript/map-sankey-waypoints/index.ts +394 -0
- package/examples/typescript/map-sankey-waypoints/package.json +19 -0
- package/examples/typescript/map-sankey-waypoints/tsconfig.json +12 -0
- package/examples/typescript/map-sankey-waypoints/webpack.config.js +45 -0
- package/examples/typescript/map-with-bubbles/package.json +1 -1
- package/examples/typescript/map-zoom-to-country/package.json +1 -1
- package/examples/typescript/misc-40-charts/package.json +1 -1
- package/examples/typescript/misc-microchart-grid/package.json +1 -1
- package/examples/typescript/pie-chart/package.json +1 -1
- package/examples/typescript/pie-donut-chart/package.json +1 -1
- package/examples/typescript/pie-variable-radius/package.json +1 -1
- package/examples/typescript/radar-column-iwatch-style/package.json +1 -1
- package/examples/typescript/radar-heat-map/package.json +1 -1
- package/examples/typescript/radar-line/package.json +1 -1
- package/examples/typescript/radar-time-line/package.json +1 -1
- package/examples/typescript/sliced-funnel/package.json +1 -1
- package/examples/typescript/sliced-pictorial-stacked/package.json +1 -1
- package/examples/typescript/sliced-pyramid/package.json +1 -1
- package/examples/typescript/stock-chart/package.json +1 -1
- package/examples/typescript/stock-chart-comparing-stocks/package.json +1 -1
- package/examples/typescript/stock-chart-data-granularity/package.json +1 -1
- package/examples/typescript/stock-chart-data-grouping/package.json +1 -1
- package/examples/typescript/stock-chart-intraday/package.json +1 -1
- package/examples/typescript/stock-chart-live/package.json +1 -1
- package/examples/typescript/stock-chart-volume-separate-panel/package.json +1 -1
- package/examples/typescript/timeline-horizontal-serpentine-chart/package.json +1 -1
- package/examples/typescript/timeline-linear-process-diagram/package.json +1 -1
- package/examples/typescript/timeline-serpentine-chart/package.json +1 -1
- package/examples/typescript/timeline-spiral-chart/package.json +1 -1
- package/examples/typescript/venn-diagram/package.json +1 -1
- package/examples/typescript/wordcloud-with-data/package.json +1 -1
- package/examples/typescript/wordcloud-with-text/package.json +1 -1
- package/examples/typescript/xy-100-percent-stacked-column/package.json +1 -1
- package/examples/typescript/xy-animated-bullet-at-the-end-of-the-series/package.json +1 -1
- package/examples/typescript/xy-bubble/package.json +1 -1
- package/examples/typescript/xy-candlestick/package.json +1 -1
- package/examples/typescript/xy-clustered-column/package.json +1 -1
- package/examples/typescript/xy-column/package.json +1 -1
- package/examples/typescript/xy-comparing-series-google-analytics-style/package.json +1 -1
- package/examples/typescript/xy-data-grouping/package.json +1 -1
- package/examples/typescript/xy-draggable-range/package.json +1 -1
- package/examples/typescript/xy-drawing-series-with-mouse-or-touch/package.json +1 -1
- package/examples/typescript/xy-dumbbell plot/package.json +1 -1
- package/examples/typescript/xy-evenly-spaced-date-axis/package.json +1 -1
- package/examples/typescript/xy-line/package.json +1 -1
- package/examples/typescript/xy-line-highlight-on-legend-hover/package.json +1 -1
- package/examples/typescript/xy-live-data/package.json +1 -1
- package/examples/typescript/xy-multiple-synced-value-axes/package.json +1 -1
- package/examples/typescript/xy-ohlc/package.json +1 -1
- package/examples/typescript/xy-real-time-data-sorting/package.json +1 -1
- package/examples/typescript/xy-smoothed-line/package.json +1 -1
- package/examples/typescript/xy-stacked-and-clustered-column/package.json +1 -1
- package/examples/typescript/xy-stacked-column/package.json +1 -1
- package/examples/typescript/xy-stacked-step/package.json +1 -1
- package/examples/typescript/xy-stock/package.json +1 -1
- package/examples/typescript/xy-stock-comparing/package.json +1 -1
- package/map.d.ts +2 -0
- package/map.d.ts.map +1 -1
- package/map.js +2 -0
- package/map.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
import type { Keyof } from "./Type";
|
|
2
|
+
/**
|
|
3
|
+
* Returns an array of object's own enumerable property names.
|
|
4
|
+
*
|
|
5
|
+
* @param object Source object
|
|
6
|
+
* @return Array of property names
|
|
7
|
+
*/
|
|
2
8
|
export declare function keys<O>(object: O): Array<Keyof<O>>;
|
|
9
|
+
/**
|
|
10
|
+
* Returns an array of object's own enumerable [key, value] pairs.
|
|
11
|
+
*
|
|
12
|
+
* @param object Source object
|
|
13
|
+
* @return Array of [key, value] tuples
|
|
14
|
+
*/
|
|
3
15
|
export declare function entries<O>(object: O): Array<[Keyof<O>, O[Keyof<O>]]>;
|
|
4
16
|
/**
|
|
5
17
|
* Returns an array of object's property names ordered using specific ordering
|
|
@@ -10,7 +22,19 @@ export declare function entries<O>(object: O): Array<[Keyof<O>, O[Keyof<O>]]>;
|
|
|
10
22
|
* @returns Object property names
|
|
11
23
|
*/
|
|
12
24
|
export declare function keysOrdered<Object>(object: Object, order: (a: Keyof<Object>, b: Keyof<Object>) => number): Array<Keyof<Object>>;
|
|
25
|
+
/**
|
|
26
|
+
* Returns a shallow copy of the object.
|
|
27
|
+
*
|
|
28
|
+
* @param object Source object
|
|
29
|
+
* @return Shallow copy
|
|
30
|
+
*/
|
|
13
31
|
export declare function copy<O>(object: O): O;
|
|
32
|
+
/**
|
|
33
|
+
* Iterates through all properties of the object calling `fn` for each of them.
|
|
34
|
+
*
|
|
35
|
+
* @param object Source object
|
|
36
|
+
* @param f Callback function
|
|
37
|
+
*/
|
|
14
38
|
export declare function each<O>(object: O, f: <K extends keyof O>(key: K, value: Exclude<O[K], undefined>) => void): void;
|
|
15
39
|
/**
|
|
16
40
|
* Iterates through all properties of the object calling `fn` for each of them.
|
|
@@ -45,7 +69,6 @@ export declare function hasKey<Object, Key extends keyof Object>(object: Object,
|
|
|
45
69
|
* @param fromObject Source object
|
|
46
70
|
* @param toObject Target object
|
|
47
71
|
* @return Updated target object
|
|
48
|
-
* @todo Maybe consolidate with utils.copy?
|
|
49
72
|
*/
|
|
50
73
|
export declare function softCopyProperties(source: Object, target: Object): Object;
|
|
51
74
|
//# sourceMappingURL=Object.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Object.d.ts","sourceRoot":"","sources":["../../../../../src/.internal/core/util/Object.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAEpC,wBAAgB,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAElD;AAED,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAEpE;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAE/H;AAED,wBAAgB,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,MAAM,CAAC,GAAG,CAAC,KAAK,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,MAAM,GAAG,IAAI,CAIpL;AAED;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,MAAM,EAAE,GAAG,SAAS,MAAM,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,GAAG,OAAO,CAE1F;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CASzE"}
|
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
import * as $array from "./Array";
|
|
2
|
+
/**
|
|
3
|
+
* Returns an array of object's own enumerable property names.
|
|
4
|
+
*
|
|
5
|
+
* @param object Source object
|
|
6
|
+
* @return Array of property names
|
|
7
|
+
*/
|
|
2
8
|
export function keys(object) {
|
|
3
9
|
return Object.keys(object);
|
|
4
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* Returns an array of object's own enumerable [key, value] pairs.
|
|
13
|
+
*
|
|
14
|
+
* @param object Source object
|
|
15
|
+
* @return Array of [key, value] tuples
|
|
16
|
+
*/
|
|
5
17
|
export function entries(object) {
|
|
6
18
|
return Object.entries(object);
|
|
7
19
|
}
|
|
@@ -16,9 +28,21 @@ export function entries(object) {
|
|
|
16
28
|
export function keysOrdered(object, order) {
|
|
17
29
|
return keys(object).sort(order);
|
|
18
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Returns a shallow copy of the object.
|
|
33
|
+
*
|
|
34
|
+
* @param object Source object
|
|
35
|
+
* @return Shallow copy
|
|
36
|
+
*/
|
|
19
37
|
export function copy(object) {
|
|
20
38
|
return Object.assign({}, object);
|
|
21
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* Iterates through all properties of the object calling `fn` for each of them.
|
|
42
|
+
*
|
|
43
|
+
* @param object Source object
|
|
44
|
+
* @param f Callback function
|
|
45
|
+
*/
|
|
22
46
|
export function each(object, f) {
|
|
23
47
|
keys(object).forEach((key) => {
|
|
24
48
|
f(key, object[key]);
|
|
@@ -71,7 +95,6 @@ export function hasKey(object, key) {
|
|
|
71
95
|
* @param fromObject Source object
|
|
72
96
|
* @param toObject Target object
|
|
73
97
|
* @return Updated target object
|
|
74
|
-
* @todo Maybe consolidate with utils.copy?
|
|
75
98
|
*/
|
|
76
99
|
export function softCopyProperties(source, target) {
|
|
77
100
|
each(source, (key, value) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Object.js","sourceRoot":"","sources":["../../../../../src/.internal/core/util/Object.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,SAAS,CAAC;AAGlC,MAAM,UAAU,IAAI,CAAI,MAAS;IAChC,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAoB,CAAC;AAC/C,CAAC;AAED,MAAM,UAAU,OAAO,CAAI,MAAS;IACnC,OAAO,MAAM,CAAC,OAAO,CAAC,MAAM,CAAoC,CAAC;AAClE,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,WAAW,CAAS,MAAc,EAAE,KAAqD;IACxG,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACjC,CAAC;AAED,MAAM,UAAU,IAAI,CAAI,MAAS;IAChC,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;AAClC,CAAC;AAED,MAAM,UAAU,IAAI,CAAI,MAAS,EAAE,CAAuE;IACzG,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;QAC5B,CAAC,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,CAAQ,CAAC,CAAC;IAC5B,CAAC,CAAC,CAAC;AACJ,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,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AuE;QACvE,IAAI,KAAK,IAAI,IAAI,IAAU,MAAO,CAAC,GAAG,CAAC,IAAI,IAAI,EAAE;YAC1C,MAAO,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;SAC3B;IACF,CAAC,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AACf,CAAC","sourcesContent":["import * as $array from \"./Array\";\nimport type { Keyof } from \"./Type\";\n\n/**\n * Returns an array of object's own enumerable property names.\n *\n * @param object Source object\n * @return Array of property names\n */\nexport function keys<O>(object: O): Array<Keyof<O>> {\n\treturn Object.keys(object) as Array<Keyof<O>>;\n}\n\n/**\n * Returns an array of object's own enumerable [key, value] pairs.\n *\n * @param object Source object\n * @return Array of [key, value] tuples\n */\nexport function entries<O>(object: O): Array<[Keyof<O>, O[Keyof<O>]]> {\n\treturn Object.entries(object) as Array<[Keyof<O>, O[Keyof<O>] ]>;\n}\n\n/**\n * Returns an array of object's property names ordered using specific ordering\n * function.\n *\n * @param object Source object\n * @param order Ordering function\n * @returns Object property names\n */\nexport function keysOrdered<Object>(object: Object, order: (a: Keyof<Object>, b: Keyof<Object>) => number): Array<Keyof<Object>> {\n\treturn keys(object).sort(order);\n}\n\n/**\n * Returns a shallow copy of the object.\n *\n * @param object Source object\n * @return Shallow copy\n */\nexport function copy<O>(object: O): O {\n\treturn Object.assign({}, object);\n}\n\n/**\n * Iterates through all properties of the object calling `fn` for each of them.\n *\n * @param object Source object\n * @param f Callback function\n */\nexport function each<O>(object: O, f: <K extends keyof O>(key: K, value: Exclude<O[K], undefined>) => void): void {\n\tkeys(object).forEach((key) => {\n\t\tf(key, object[key] as any);\n\t});\n}\n\n/**\n * Iterates through all properties of the object calling `fn` for each of them.\n *\n * If return value of the function evaluates to `false` further iteration is\n * cancelled.\n *\n * @param object Source object\n * @param fn Callback function\n */\nexport function eachContinue<Object>(object: Object, fn: <Key extends Keyof<Object>>(key: Key, value: Object[Key]) => boolean): void {\n\tfor (let key in object) {\n\t\tif (hasKey(object, key)) {\n\t\t\tif (!fn(key as Keyof<Object>, object[key] as Object[Keyof<Object>])) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * Orders object properties using custom `ord` function and iterates through\n * them calling `fn` for each of them.\n *\n * @param object Source object\n * @param fn Callback function\n * @param order Ordering function\n */\nexport function eachOrdered<Object>(object: Object, fn: <Key extends Keyof<Object>>(key: Key, value: Object[Key]) => void, ord: (a: Keyof<Object>, b: Keyof<Object>) => number): void {\n\t$array.each(keysOrdered(object, ord), (key) => {\n\t\tfn(key, object[key]);\n\t});\n}\n\n/**\n * Checks if `object` has a specific `key`.\n *\n * @param object Source object\n * @param key Property name\n * @returns Has key?\n */\nexport function hasKey<Object, Key extends keyof Object>(object: Object, key: Key): boolean {\n\treturn {}.hasOwnProperty.call(object, key);\n}\n\n/**\n * Copies all properties of one object to the other, omitting undefined, but only if property in target object doesn't have a value set.\n *\n * @param fromObject Source object\n * @param toObject Target object\n * @return Updated target object\n */\nexport function softCopyProperties(source: Object, target: Object): Object {\n\teach(source, (key, value) => {\n\t\t// only if value is set\n\t\t//if ($type.hasValue(value) && !($type.hasValue((<any>target)[key]))) {\n\t\tif (value != null && (<any>target)[key] == null) {\n\t\t\t(<any>target)[key] = value;\n\t\t}\n\t});\n\treturn target;\n}\n"]}
|
|
@@ -76,6 +76,11 @@ export declare function isTouchEvent(ev: MouseEvent | Touch): boolean;
|
|
|
76
76
|
* @ignore Exclude from docs
|
|
77
77
|
*/
|
|
78
78
|
export declare function setStyle(dom: HTMLElement, property: string, value: string | undefined): void;
|
|
79
|
+
/**
|
|
80
|
+
* Gets style property value on a DOM element.
|
|
81
|
+
*
|
|
82
|
+
* @ignore Exclude from docs
|
|
83
|
+
*/
|
|
79
84
|
export declare function getStyle(dom: HTMLElement, property: string): string | undefined;
|
|
80
85
|
/**
|
|
81
86
|
* Gets the target of the event, works for shadow DOM too.
|
|
@@ -104,6 +109,11 @@ export declare function isLocalEvent(event: IPointerEvent, target: Sprite): bool
|
|
|
104
109
|
* @param interactive Interactive?
|
|
105
110
|
*/
|
|
106
111
|
export declare function setInteractive(target: HTMLElement, interactive: boolean): void;
|
|
112
|
+
/**
|
|
113
|
+
* Returns a normalized key name from a keyboard event.
|
|
114
|
+
*
|
|
115
|
+
* @ignore
|
|
116
|
+
*/
|
|
107
117
|
export declare function getEventKey(event: KeyboardEvent): string;
|
|
108
118
|
/**
|
|
109
119
|
* Returns the shadow root of the element or null
|
|
@@ -191,8 +201,27 @@ export declare function addClass(element: HTMLElement | SVGElement, className: s
|
|
|
191
201
|
* @param className Class name to add
|
|
192
202
|
*/
|
|
193
203
|
export declare function removeClass(element: HTMLElement, className: string): void;
|
|
204
|
+
/**
|
|
205
|
+
* Returns `true` if the current device is running iOS.
|
|
206
|
+
*
|
|
207
|
+
* @return Is iOS?
|
|
208
|
+
*/
|
|
194
209
|
export declare function iOS(): boolean;
|
|
210
|
+
/**
|
|
211
|
+
* Returns a safe canvas resolution for the current device.
|
|
212
|
+
* Returns `1` on iOS to avoid memory issues, `undefined` otherwise.
|
|
213
|
+
*
|
|
214
|
+
* @return Resolution or undefined
|
|
215
|
+
*/
|
|
195
216
|
export declare function getSafeResolution(): number | undefined;
|
|
217
|
+
/**
|
|
218
|
+
* Converts a value that can be a number or [[Percent]] to an absolute number
|
|
219
|
+
* relative to the given full value.
|
|
220
|
+
*
|
|
221
|
+
* @param percent Input value (number or Percent)
|
|
222
|
+
* @param full Full reference value
|
|
223
|
+
* @return Absolute value
|
|
224
|
+
*/
|
|
196
225
|
export declare function relativeToValue(percent: number | Percent | undefined | null, full: number): number;
|
|
197
226
|
/**
|
|
198
227
|
* Returns number of decimals
|
|
@@ -217,9 +246,36 @@ export declare function decimalPlaces(number: number): number;
|
|
|
217
246
|
* @return Padded value as string
|
|
218
247
|
*/
|
|
219
248
|
export declare function padString(value: any, len?: number, char?: string): string;
|
|
249
|
+
/**
|
|
250
|
+
* Removes whitespace from the beginning of a string.
|
|
251
|
+
*
|
|
252
|
+
* @param text Source string
|
|
253
|
+
* @return Trimmed string
|
|
254
|
+
*/
|
|
220
255
|
export declare function trimLeft(text: string): string;
|
|
256
|
+
/**
|
|
257
|
+
* Removes whitespace from the end of a string.
|
|
258
|
+
*
|
|
259
|
+
* @param text Source string
|
|
260
|
+
* @return Trimmed string
|
|
261
|
+
*/
|
|
221
262
|
export declare function trimRight(text: string): string;
|
|
263
|
+
/**
|
|
264
|
+
* Removes whitespace from both ends of a string.
|
|
265
|
+
*
|
|
266
|
+
* @param text Source string
|
|
267
|
+
* @return Trimmed string
|
|
268
|
+
*/
|
|
222
269
|
export declare function trim(text: string): string;
|
|
270
|
+
/**
|
|
271
|
+
* Truncates a string to a maximum length, appending an ellipsis.
|
|
272
|
+
*
|
|
273
|
+
* @param text Source string
|
|
274
|
+
* @param maxLength Maximum character length
|
|
275
|
+
* @param breakWords Allow breaking mid-word?
|
|
276
|
+
* @param ellipsis Ellipsis string to append
|
|
277
|
+
* @return Truncated string
|
|
278
|
+
*/
|
|
223
279
|
export declare function truncateTextWithEllipsis(text: string, maxLength: number, breakWords?: boolean, ellipsis?: string): string;
|
|
224
280
|
/**
|
|
225
281
|
* Tries to determine format type.
|
|
@@ -285,7 +341,6 @@ export declare function splitString(source: string): string[];
|
|
|
285
341
|
* @param date Date
|
|
286
342
|
* @param utc Assume UTC dates?
|
|
287
343
|
* @return Year day
|
|
288
|
-
* @todo Account for UTC
|
|
289
344
|
*/
|
|
290
345
|
export declare function getYearDay(date: Date, utc?: boolean): number;
|
|
291
346
|
/**
|
|
@@ -294,7 +349,6 @@ export declare function getYearDay(date: Date, utc?: boolean): number;
|
|
|
294
349
|
* @param date Date
|
|
295
350
|
* @param utc Assume UTC dates?
|
|
296
351
|
* @return Week number
|
|
297
|
-
* @todo Account for UTC
|
|
298
352
|
*/
|
|
299
353
|
export declare function getWeek(date: Date, _utc?: boolean): number;
|
|
300
354
|
/**
|
|
@@ -304,7 +358,6 @@ export declare function getWeek(date: Date, _utc?: boolean): number;
|
|
|
304
358
|
* @param utc Assume UTC dates?
|
|
305
359
|
* @return Year of week
|
|
306
360
|
* @since 5.3.0
|
|
307
|
-
* @todo Account for UTC
|
|
308
361
|
*/
|
|
309
362
|
export declare function getWeekYear(date: Date, _utc?: boolean): number;
|
|
310
363
|
/**
|
|
@@ -342,7 +395,20 @@ export declare function get12Hours(hours: number, base?: number): number;
|
|
|
342
395
|
* @return Time zone name
|
|
343
396
|
*/
|
|
344
397
|
export declare function getTimeZone(date: Date, long?: boolean, savings?: boolean, utc?: boolean, timezone?: string): string;
|
|
398
|
+
/**
|
|
399
|
+
* Returns the UTC offset in minutes for a given timezone.
|
|
400
|
+
*
|
|
401
|
+
* @param timezone IANA timezone identifier
|
|
402
|
+
* @param targetDate Date to check offset for
|
|
403
|
+
* @return Offset in minutes
|
|
404
|
+
*/
|
|
345
405
|
export declare function getTimezoneOffset(timezone: string, targetDate?: Date): number;
|
|
406
|
+
/**
|
|
407
|
+
* Capitalizes the first letter of a string.
|
|
408
|
+
*
|
|
409
|
+
* @param text Source string
|
|
410
|
+
* @return Capitalized string
|
|
411
|
+
*/
|
|
346
412
|
export declare function capitalizeFirst(text: string): string;
|
|
347
413
|
/**
|
|
348
414
|
* ============================================================================
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Utils.d.ts","sourceRoot":"","sources":["../../../../../src/.internal/core/util/Utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,KAAK,KAAK,MAAM,QAAQ,CAAC;AAGhC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,EAAY,aAAa,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEhE;;;;;GAKG;AAEH;;;;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M,CAGvE;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,MAAM,GAAG,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAgBzF;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAGzE;AAED;;;;;;;GAOG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,IAAI,GAAG,OAAO,CAE5C;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,UAAU,EAAE,MAAM,GAAG,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAQ5F;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,IAAI,EAAE,gBAAgB,GAAE,IAAiC,EAAE,eAAe,GAAE,IAAiC,GAAG,IAAI,CAQ3J;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAOhF;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,EAAE,OAAO,GAAG,OAAO,CAiB3D"}
|
|
@@ -194,6 +194,11 @@ export function isTouchEvent(ev) {
|
|
|
194
194
|
export function setStyle(dom, property, value) {
|
|
195
195
|
dom.style[property] = value;
|
|
196
196
|
}
|
|
197
|
+
/**
|
|
198
|
+
* Gets style property value on a DOM element.
|
|
199
|
+
*
|
|
200
|
+
* @ignore Exclude from docs
|
|
201
|
+
*/
|
|
197
202
|
export function getStyle(dom, property) {
|
|
198
203
|
return dom.style[property];
|
|
199
204
|
}
|
|
@@ -265,6 +270,11 @@ export function setInteractive(target, interactive) {
|
|
|
265
270
|
target.style.pointerEvents = "none";
|
|
266
271
|
}
|
|
267
272
|
}
|
|
273
|
+
/**
|
|
274
|
+
* Returns a normalized key name from a keyboard event.
|
|
275
|
+
*
|
|
276
|
+
* @ignore
|
|
277
|
+
*/
|
|
268
278
|
export function getEventKey(event) {
|
|
269
279
|
if (event.key !== undefined) {
|
|
270
280
|
return event.key;
|
|
@@ -308,10 +318,7 @@ export function getShadowRoot(a) {
|
|
|
308
318
|
}
|
|
309
319
|
}
|
|
310
320
|
/**
|
|
311
|
-
*
|
|
312
|
-
*
|
|
313
|
-
* @ignore Exclude from docs
|
|
314
|
-
* @todo Description
|
|
321
|
+
* @ignore
|
|
315
322
|
*/
|
|
316
323
|
let rootStylesheet;
|
|
317
324
|
/**
|
|
@@ -334,11 +341,7 @@ function createStylesheet(element, text, nonce = "") {
|
|
|
334
341
|
return e;
|
|
335
342
|
}
|
|
336
343
|
/**
|
|
337
|
-
*
|
|
338
|
-
*
|
|
339
|
-
* @ignore Exclude from docs
|
|
340
|
-
* @todo Description
|
|
341
|
-
* @return [description]
|
|
344
|
+
* @ignore
|
|
342
345
|
*/
|
|
343
346
|
function getStylesheet(element, nonce = "") {
|
|
344
347
|
if (element === null) {
|
|
@@ -366,12 +369,7 @@ function getStylesheet(element, nonce = "") {
|
|
|
366
369
|
}
|
|
367
370
|
}
|
|
368
371
|
/**
|
|
369
|
-
*
|
|
370
|
-
*
|
|
371
|
-
* @ignore Exclude from docs
|
|
372
|
-
* @todo Description
|
|
373
|
-
* @param selector [description]
|
|
374
|
-
* @return [description]
|
|
372
|
+
* @ignore
|
|
375
373
|
*/
|
|
376
374
|
function appendStylesheet(root, selector) {
|
|
377
375
|
const index = root.cssRules.length;
|
|
@@ -584,12 +582,31 @@ export function removeClass(element, className) {
|
|
|
584
582
|
// // Remove iOS-specific selection;
|
|
585
583
|
// setStyle(dom, "tapHighlightColor", "");
|
|
586
584
|
// }
|
|
585
|
+
/**
|
|
586
|
+
* Returns `true` if the current device is running iOS.
|
|
587
|
+
*
|
|
588
|
+
* @return Is iOS?
|
|
589
|
+
*/
|
|
587
590
|
export function iOS() {
|
|
588
591
|
return /apple/i.test(navigator.vendor) && "ontouchend" in document;
|
|
589
592
|
}
|
|
593
|
+
/**
|
|
594
|
+
* Returns a safe canvas resolution for the current device.
|
|
595
|
+
* Returns `1` on iOS to avoid memory issues, `undefined` otherwise.
|
|
596
|
+
*
|
|
597
|
+
* @return Resolution or undefined
|
|
598
|
+
*/
|
|
590
599
|
export function getSafeResolution() {
|
|
591
600
|
return iOS() ? 1 : undefined;
|
|
592
601
|
}
|
|
602
|
+
/**
|
|
603
|
+
* Converts a value that can be a number or [[Percent]] to an absolute number
|
|
604
|
+
* relative to the given full value.
|
|
605
|
+
*
|
|
606
|
+
* @param percent Input value (number or Percent)
|
|
607
|
+
* @param full Full reference value
|
|
608
|
+
* @return Absolute value
|
|
609
|
+
*/
|
|
593
610
|
export function relativeToValue(percent, full) {
|
|
594
611
|
if ($type.isNumber(percent)) {
|
|
595
612
|
return percent;
|
|
@@ -635,15 +652,42 @@ export function padString(value, len = 0, char = "0") {
|
|
|
635
652
|
}
|
|
636
653
|
return len > value.length ? Array(len - value.length + 1).join(char) + value : value;
|
|
637
654
|
}
|
|
655
|
+
/**
|
|
656
|
+
* Removes whitespace from the beginning of a string.
|
|
657
|
+
*
|
|
658
|
+
* @param text Source string
|
|
659
|
+
* @return Trimmed string
|
|
660
|
+
*/
|
|
638
661
|
export function trimLeft(text) {
|
|
639
662
|
return text.replace(/^[\s]*/, "");
|
|
640
663
|
}
|
|
664
|
+
/**
|
|
665
|
+
* Removes whitespace from the end of a string.
|
|
666
|
+
*
|
|
667
|
+
* @param text Source string
|
|
668
|
+
* @return Trimmed string
|
|
669
|
+
*/
|
|
641
670
|
export function trimRight(text) {
|
|
642
671
|
return text.replace(/[\s]*$/, "");
|
|
643
672
|
}
|
|
673
|
+
/**
|
|
674
|
+
* Removes whitespace from both ends of a string.
|
|
675
|
+
*
|
|
676
|
+
* @param text Source string
|
|
677
|
+
* @return Trimmed string
|
|
678
|
+
*/
|
|
644
679
|
export function trim(text) {
|
|
645
680
|
return trimLeft(trimRight(text));
|
|
646
681
|
}
|
|
682
|
+
/**
|
|
683
|
+
* Truncates a string to a maximum length, appending an ellipsis.
|
|
684
|
+
*
|
|
685
|
+
* @param text Source string
|
|
686
|
+
* @param maxLength Maximum character length
|
|
687
|
+
* @param breakWords Allow breaking mid-word?
|
|
688
|
+
* @param ellipsis Ellipsis string to append
|
|
689
|
+
* @return Truncated string
|
|
690
|
+
*/
|
|
647
691
|
export function truncateTextWithEllipsis(text, maxLength, breakWords = false, ellipsis = "...") {
|
|
648
692
|
if (text.length > maxLength) {
|
|
649
693
|
// Find the last non-alphanumeric character before maxLength
|
|
@@ -809,7 +853,6 @@ export function splitString(source) {
|
|
|
809
853
|
* @param date Date
|
|
810
854
|
* @param utc Assume UTC dates?
|
|
811
855
|
* @return Year day
|
|
812
|
-
* @todo Account for UTC
|
|
813
856
|
*/
|
|
814
857
|
export function getYearDay(date, utc = false) {
|
|
815
858
|
// TODO: utc needed?
|
|
@@ -825,7 +868,6 @@ export function getYearDay(date, utc = false) {
|
|
|
825
868
|
* @param date Date
|
|
826
869
|
* @param utc Assume UTC dates?
|
|
827
870
|
* @return Week number
|
|
828
|
-
* @todo Account for UTC
|
|
829
871
|
*/
|
|
830
872
|
export function getWeek(date, _utc = false) {
|
|
831
873
|
const d = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()));
|
|
@@ -841,7 +883,6 @@ export function getWeek(date, _utc = false) {
|
|
|
841
883
|
* @param utc Assume UTC dates?
|
|
842
884
|
* @return Year of week
|
|
843
885
|
* @since 5.3.0
|
|
844
|
-
* @todo Account for UTC
|
|
845
886
|
*/
|
|
846
887
|
export function getWeekYear(date, _utc = false) {
|
|
847
888
|
const d = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()));
|
|
@@ -923,12 +964,25 @@ export function getTimeZone(date, long = false, savings = false, utc = false, ti
|
|
|
923
964
|
}
|
|
924
965
|
return trim(wtz);
|
|
925
966
|
}
|
|
967
|
+
/**
|
|
968
|
+
* Returns the UTC offset in minutes for a given timezone.
|
|
969
|
+
*
|
|
970
|
+
* @param timezone IANA timezone identifier
|
|
971
|
+
* @param targetDate Date to check offset for
|
|
972
|
+
* @return Offset in minutes
|
|
973
|
+
*/
|
|
926
974
|
export function getTimezoneOffset(timezone, targetDate) {
|
|
927
975
|
const date = targetDate || new Date(Date.UTC(2012, 0, 1, 0, 0, 0, 0));
|
|
928
976
|
const utcDate = new Date(date.toLocaleString("en-US", { timeZone: "UTC" }));
|
|
929
977
|
const tzDate = new Date(date.toLocaleString("en-US", { timeZone: timezone }));
|
|
930
978
|
return (tzDate.getTime() - utcDate.getTime()) / 6e4 * -1;
|
|
931
979
|
}
|
|
980
|
+
/**
|
|
981
|
+
* Capitalizes the first letter of a string.
|
|
982
|
+
*
|
|
983
|
+
* @param text Source string
|
|
984
|
+
* @return Capitalized string
|
|
985
|
+
*/
|
|
932
986
|
export function capitalizeFirst(text) {
|
|
933
987
|
return text.charAt(0).toUpperCase() + text.slice(1);
|
|
934
988
|
}
|