@amcharts/amcharts5 5.1.9 → 5.1.12
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/hierarchy/ForceDirected.d.ts +1 -0
- package/.internal/charts/hierarchy/ForceDirected.d.ts.map +1 -1
- package/.internal/charts/hierarchy/ForceDirected.js +9 -0
- package/.internal/charts/hierarchy/ForceDirected.js.map +1 -1
- package/.internal/charts/hierarchy/LinkedHierarchy.d.ts +1 -0
- package/.internal/charts/hierarchy/LinkedHierarchy.d.ts.map +1 -1
- package/.internal/charts/hierarchy/LinkedHierarchy.js +12 -3
- package/.internal/charts/hierarchy/LinkedHierarchy.js.map +1 -1
- package/.internal/charts/radar/RadarChart.d.ts.map +1 -1
- package/.internal/charts/radar/RadarChart.js +0 -2
- package/.internal/charts/radar/RadarChart.js.map +1 -1
- package/.internal/charts/xy/XYChart.d.ts +8 -1
- package/.internal/charts/xy/XYChart.d.ts.map +1 -1
- package/.internal/charts/xy/XYChart.js +22 -3
- package/.internal/charts/xy/XYChart.js.map +1 -1
- package/.internal/charts/xy/XYChartDefaultTheme.d.ts.map +1 -1
- package/.internal/charts/xy/XYChartDefaultTheme.js +0 -2
- package/.internal/charts/xy/XYChartDefaultTheme.js.map +1 -1
- package/.internal/charts/xy/axes/Axis.d.ts.map +1 -1
- package/.internal/charts/xy/axes/Axis.js +1 -0
- package/.internal/charts/xy/axes/Axis.js.map +1 -1
- package/.internal/charts/xy/axes/AxisRendererX.d.ts.map +1 -1
- package/.internal/charts/xy/axes/AxisRendererX.js +1 -0
- package/.internal/charts/xy/axes/AxisRendererX.js.map +1 -1
- package/.internal/charts/xy/axes/DateAxis.d.ts.map +1 -1
- package/.internal/charts/xy/axes/DateAxis.js +46 -4
- package/.internal/charts/xy/axes/DateAxis.js.map +1 -1
- package/.internal/charts/xy/axes/ValueAxis.d.ts +13 -0
- package/.internal/charts/xy/axes/ValueAxis.d.ts.map +1 -1
- package/.internal/charts/xy/axes/ValueAxis.js +125 -75
- package/.internal/charts/xy/axes/ValueAxis.js.map +1 -1
- package/.internal/charts/xy/series/BaseColumnSeries.d.ts.map +1 -1
- package/.internal/charts/xy/series/BaseColumnSeries.js +9 -0
- package/.internal/charts/xy/series/BaseColumnSeries.js.map +1 -1
- package/.internal/charts/xy/series/XYSeries.d.ts +11 -0
- package/.internal/charts/xy/series/XYSeries.d.ts.map +1 -1
- package/.internal/charts/xy/series/XYSeries.js +44 -11
- package/.internal/charts/xy/series/XYSeries.js.map +1 -1
- package/.internal/core/Root.d.ts +1 -0
- package/.internal/core/Root.d.ts.map +1 -1
- package/.internal/core/Root.js +11 -2
- package/.internal/core/Root.js.map +1 -1
- package/.internal/core/render/GridLayout.d.ts.map +1 -1
- package/.internal/core/render/GridLayout.js +11 -9
- package/.internal/core/render/GridLayout.js.map +1 -1
- package/.internal/core/render/HorizontalLayout.d.ts.map +1 -1
- package/.internal/core/render/HorizontalLayout.js +40 -34
- package/.internal/core/render/HorizontalLayout.js.map +1 -1
- package/.internal/core/render/Legend.d.ts.map +1 -1
- package/.internal/core/render/Legend.js +7 -0
- package/.internal/core/render/Legend.js.map +1 -1
- package/.internal/core/render/Scrollbar.d.ts.map +1 -1
- package/.internal/core/render/Scrollbar.js +3 -0
- package/.internal/core/render/Scrollbar.js.map +1 -1
- package/.internal/core/render/Series.d.ts +5 -0
- package/.internal/core/render/Series.d.ts.map +1 -1
- package/.internal/core/render/Series.js +40 -10
- package/.internal/core/render/Series.js.map +1 -1
- package/.internal/core/render/Sprite.d.ts +4 -0
- package/.internal/core/render/Sprite.d.ts.map +1 -1
- package/.internal/core/render/Sprite.js +14 -0
- package/.internal/core/render/Sprite.js.map +1 -1
- package/.internal/core/render/VerticalLayout.d.ts.map +1 -1
- package/.internal/core/render/VerticalLayout.js +40 -34
- package/.internal/core/render/VerticalLayout.js.map +1 -1
- package/.internal/core/render/backend/CanvasRenderer.d.ts +1 -0
- package/.internal/core/render/backend/CanvasRenderer.d.ts.map +1 -1
- package/.internal/core/render/backend/CanvasRenderer.js +17 -1
- package/.internal/core/render/backend/CanvasRenderer.js.map +1 -1
- package/.internal/core/render/backend/Renderer.d.ts +1 -0
- package/.internal/core/render/backend/Renderer.d.ts.map +1 -1
- package/.internal/core/render/backend/Renderer.js.map +1 -1
- package/.internal/core/util/PopulateString.js +12 -2
- package/.internal/core/util/PopulateString.js.map +1 -1
- package/.internal/core/util/Time.d.ts.map +1 -1
- package/.internal/core/util/Time.js +4 -0
- package/.internal/core/util/Time.js.map +1 -1
- package/.internal/plugins/exporting/ExportingMenu.d.ts.map +1 -1
- package/.internal/plugins/exporting/ExportingMenu.js +3 -2
- package/.internal/plugins/exporting/ExportingMenu.js.map +1 -1
- package/.internal/plugins/json/Classes-script.d.ts +271 -0
- package/.internal/plugins/json/Classes-script.d.ts.map +1 -0
- package/.internal/plugins/json/Classes-script.js +139 -0
- package/.internal/plugins/json/Classes-script.js.map +1 -0
- package/.internal/plugins/json/Classes.d.ts +262 -262
- package/.internal/plugins/json/Classes.d.ts.map +1 -1
- package/.internal/plugins/json/Classes.js +131 -262
- package/.internal/plugins/json/Classes.js.map +1 -1
- package/.internal/plugins/json/Json.d.ts +3 -3
- package/.internal/plugins/json/Json.d.ts.map +1 -1
- package/.internal/plugins/json/Json.js +301 -34
- package/.internal/plugins/json/Json.js.map +1 -1
- package/CHANGELOG.md +45 -0
- 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/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/json/README.md +6 -0
- package/examples/javascript/json/index.css +11 -0
- package/examples/javascript/json/index.html +12 -0
- package/examples/javascript/json/index.js +206 -0
- package/examples/javascript/json/package.json +16 -0
- package/examples/javascript/json/webpack.config.js +38 -0
- package/examples/javascript/map-animating-along-lines/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-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/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-chord/package.json +1 -1
- package/examples/typescript/flow-chord/webpack.config.js +1 -1
- package/examples/typescript/flow-chord-directed/package.json +1 -1
- package/examples/typescript/flow-chord-directed/webpack.config.js +1 -1
- package/examples/typescript/flow-chord-non-ribbon/package.json +1 -1
- package/examples/typescript/flow-chord-non-ribbon/webpack.config.js +1 -1
- package/examples/typescript/flow-sankey/package.json +1 -1
- package/examples/typescript/flow-sankey/webpack.config.js +1 -1
- package/examples/typescript/gauge/package.json +1 -1
- package/examples/typescript/gauge/webpack.config.js +1 -1
- package/examples/typescript/gauge-bands/package.json +1 -1
- package/examples/typescript/gauge-bands/webpack.config.js +1 -1
- package/examples/typescript/hierarchy-force-directed/package.json +1 -1
- package/examples/typescript/hierarchy-force-directed/webpack.config.js +1 -1
- package/examples/typescript/hierarchy-pack/package.json +1 -1
- package/examples/typescript/hierarchy-pack/webpack.config.js +1 -1
- package/examples/typescript/hierarchy-partition/package.json +1 -1
- package/examples/typescript/hierarchy-partition/webpack.config.js +1 -1
- package/examples/typescript/hierarchy-sunburst/package.json +1 -1
- package/examples/typescript/hierarchy-sunburst/webpack.config.js +1 -1
- package/examples/typescript/hierarchy-tree/package.json +1 -1
- package/examples/typescript/hierarchy-tree/webpack.config.js +1 -1
- package/examples/typescript/hierarchy-treemap/package.json +1 -1
- package/examples/typescript/hierarchy-treemap/webpack.config.js +1 -1
- package/examples/typescript/json/README.md +6 -0
- package/examples/typescript/json/index.css +11 -0
- package/examples/typescript/json/index.html +12 -0
- package/examples/typescript/json/index.ts +206 -0
- package/examples/typescript/json/package.json +18 -0
- package/examples/typescript/json/tsconfig.json +12 -0
- package/examples/typescript/json/webpack.config.js +45 -0
- package/examples/typescript/map-animating-along-lines/package.json +1 -1
- package/examples/typescript/map-animating-along-lines/webpack.config.js +1 -1
- package/examples/typescript/map-day-and-night/package.json +1 -1
- package/examples/typescript/map-day-and-night/webpack.config.js +1 -1
- package/examples/typescript/map-globe-rotate-to-country/package.json +1 -1
- package/examples/typescript/map-globe-rotate-to-country/webpack.config.js +1 -1
- package/examples/typescript/map-globe-with-projected-circles/package.json +1 -1
- package/examples/typescript/map-globe-with-projected-circles/webpack.config.js +1 -1
- package/examples/typescript/map-with-bubbles/package.json +1 -1
- package/examples/typescript/map-with-bubbles/webpack.config.js +1 -1
- package/examples/typescript/map-zoom-to-country/package.json +1 -1
- package/examples/typescript/map-zoom-to-country/webpack.config.js +1 -1
- package/examples/typescript/misc-40-charts/package.json +1 -1
- package/examples/typescript/misc-40-charts/webpack.config.js +1 -1
- package/examples/typescript/misc-microchart-grid/package.json +1 -1
- package/examples/typescript/misc-microchart-grid/webpack.config.js +1 -1
- package/examples/typescript/pie-chart/package.json +1 -1
- package/examples/typescript/pie-chart/webpack.config.js +1 -1
- package/examples/typescript/pie-donut-chart/package.json +1 -1
- package/examples/typescript/pie-donut-chart/webpack.config.js +1 -1
- package/examples/typescript/pie-variable-radius/package.json +1 -1
- package/examples/typescript/pie-variable-radius/webpack.config.js +1 -1
- package/examples/typescript/radar-column-iwatch-style/package.json +1 -1
- package/examples/typescript/radar-column-iwatch-style/webpack.config.js +1 -1
- package/examples/typescript/radar-heat-map/package.json +1 -1
- package/examples/typescript/radar-heat-map/webpack.config.js +1 -1
- package/examples/typescript/radar-line/package.json +1 -1
- package/examples/typescript/radar-line/webpack.config.js +1 -1
- package/examples/typescript/radar-time-line/package.json +1 -1
- package/examples/typescript/radar-time-line/webpack.config.js +1 -1
- package/examples/typescript/sliced-funnel/package.json +1 -1
- package/examples/typescript/sliced-funnel/webpack.config.js +1 -1
- package/examples/typescript/sliced-pictorial-stacked/package.json +1 -1
- package/examples/typescript/sliced-pictorial-stacked/webpack.config.js +1 -1
- package/examples/typescript/sliced-pyramid/package.json +1 -1
- package/examples/typescript/sliced-pyramid/webpack.config.js +1 -1
- package/examples/typescript/venn-diagram/package.json +1 -1
- package/examples/typescript/venn-diagram/webpack.config.js +1 -1
- package/examples/typescript/wordcloud-with-data/package.json +1 -1
- package/examples/typescript/wordcloud-with-data/webpack.config.js +1 -1
- package/examples/typescript/wordcloud-with-text/package.json +1 -1
- package/examples/typescript/wordcloud-with-text/webpack.config.js +1 -1
- package/examples/typescript/xy-100-percent-stacked-column/package.json +1 -1
- package/examples/typescript/xy-100-percent-stacked-column/webpack.config.js +1 -1
- package/examples/typescript/xy-animated-bullet-at-the-end-of-the-series/package.json +1 -1
- package/examples/typescript/xy-animated-bullet-at-the-end-of-the-series/webpack.config.js +1 -1
- package/examples/typescript/xy-bubble/package.json +1 -1
- package/examples/typescript/xy-bubble/webpack.config.js +1 -1
- package/examples/typescript/xy-candlestick/package.json +1 -1
- package/examples/typescript/xy-candlestick/webpack.config.js +1 -1
- package/examples/typescript/xy-clustered-column/package.json +1 -1
- package/examples/typescript/xy-clustered-column/webpack.config.js +1 -1
- package/examples/typescript/xy-column/package.json +1 -1
- package/examples/typescript/xy-column/webpack.config.js +1 -1
- package/examples/typescript/xy-comparing-series-google-analytics-style/package.json +1 -1
- package/examples/typescript/xy-comparing-series-google-analytics-style/webpack.config.js +1 -1
- package/examples/typescript/xy-data-grouping/package.json +1 -1
- package/examples/typescript/xy-data-grouping/webpack.config.js +1 -1
- package/examples/typescript/xy-draggable-range/package.json +1 -1
- package/examples/typescript/xy-draggable-range/webpack.config.js +1 -1
- package/examples/typescript/xy-drawing-series-with-mouse-or-touch/package.json +1 -1
- package/examples/typescript/xy-drawing-series-with-mouse-or-touch/webpack.config.js +1 -1
- package/examples/typescript/xy-dumbbell plot/package.json +1 -1
- package/examples/typescript/xy-dumbbell plot/webpack.config.js +1 -1
- package/examples/typescript/xy-evenly-spaced-date-axis/package.json +1 -1
- package/examples/typescript/xy-evenly-spaced-date-axis/webpack.config.js +1 -1
- package/examples/typescript/xy-line/package.json +1 -1
- package/examples/typescript/xy-line/webpack.config.js +1 -1
- package/examples/typescript/xy-line-highlight-on-legend-hover/package.json +1 -1
- package/examples/typescript/xy-line-highlight-on-legend-hover/webpack.config.js +1 -1
- package/examples/typescript/xy-live-data/package.json +1 -1
- package/examples/typescript/xy-live-data/webpack.config.js +1 -1
- package/examples/typescript/xy-multiple-synced-value-axes/package.json +1 -1
- package/examples/typescript/xy-multiple-synced-value-axes/webpack.config.js +1 -1
- package/examples/typescript/xy-ohlc/package.json +1 -1
- package/examples/typescript/xy-ohlc/webpack.config.js +1 -1
- package/examples/typescript/xy-real-time-data-sorting/package.json +1 -1
- package/examples/typescript/xy-real-time-data-sorting/webpack.config.js +1 -1
- package/examples/typescript/xy-smoothed-line/package.json +1 -1
- package/examples/typescript/xy-smoothed-line/webpack.config.js +1 -1
- package/examples/typescript/xy-stacked-and-clustered-column/package.json +1 -1
- package/examples/typescript/xy-stacked-and-clustered-column/webpack.config.js +1 -1
- package/examples/typescript/xy-stacked-column/package.json +1 -1
- package/examples/typescript/xy-stacked-column/webpack.config.js +1 -1
- package/examples/typescript/xy-stacked-step/package.json +1 -1
- package/examples/typescript/xy-stacked-step/webpack.config.js +1 -1
- package/examples/typescript/xy-stock/package.json +1 -1
- package/examples/typescript/xy-stock/webpack.config.js +1 -1
- package/examples/typescript/xy-stock-comparing/package.json +1 -1
- package/examples/typescript/xy-stock-comparing/webpack.config.js +1 -1
- package/index.d.ts +4 -0
- package/index.d.ts.map +1 -1
- package/index.js +4 -0
- package/index.js.map +1 -1
- package/locales/lt_LT.js +25 -25
- package/locales/lt_LT.js.map +1 -1
- package/package.json +9 -9
- package/xy.d.ts +1 -0
- package/xy.d.ts.map +1 -1
- package/xy.js +1 -0
- package/xy.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Json.js","sourceRoot":"","sources":["../../../../../src/.internal/plugins/json/Json.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAExD,OAAO,KAAK,KAAK,MAAM,sBAAsB,CAAC;AAC9C,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAGhD,OAAO,OAAO,MAAM,WAAW,CAAC;AAYhC,SAAS,MAAM,CAAC,KAAU;IACtB,OAAO,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAE,KAAa,CAAC,IAAI,CAAC,CAAC;AACjG,CAAC;AAED;IAAA;IA0CA,CAAC;;;;;eAzCG,UAA0B,IAAU,EAAE,MAAe;YAArD,iBAoCC;YAnCG,IAAI,MAAM,CAAC,MAAM,CAAC,EAAE;gBAChB,IAAM,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,CAAQ,CAAC;gBAC9C,IAAI,CAAC,SAAS,EAAE;oBACZ,MAAM,IAAI,KAAK,CAAC,wBAAwB,GAAG,MAAM,CAAC,IAAI,GAAG,GAAG,CAAC,CAAC;iBACjE;gBAED,IAAM,QAAM,GAAG,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAM,CAAC;gBAEzD,IAAI,QAAM,YAAY,MAAM,EAAE;oBAC1B,IAAI,MAAM,CAAC,QAAQ,EAAE;wBACjB,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,QAA8B,EAAE,UAAC,OAAO;4BACvD,QAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;wBACvD,CAAC,CAAC,CAAC;qBACN;iBACJ;gBAED,IAAI,QAAM,YAAY,SAAS,EAAE;oBAC7B,IAAI,MAAM,CAAC,QAAQ,EAAE;wBACjB,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,QAAwB,EAAE,UAAC,KAAK;4BAC/C,IAAM,MAAM,GAAG,KAAI,CAAC,KAAK,CAAS,IAAI,EAAE,KAAK,CAAC,CAAC;4BAE/C,IAAI,CAAC,CAAC,MAAM,YAAY,MAAM,CAAC,EAAE;gCAC7B,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;6BAC9C;4BAED,QAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;wBACjC,CAAC,CAAC,CAAC;qBACN;iBACJ;gBAED,OAAO,QAAM,CAAC;aAEjB;iBAAM;gBACH,MAAM,IAAI,KAAK,CAAC,iEAAiE,CAAC,CAAC;aACtF;QACL,CAAC;;;;;;eAED,UAAgC,IAAU,EAAE,MAAc;YACtD,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;QAChD,CAAC;;IACL,iBAAC;AAAD,CAAC,AA1CD,IA0CC","sourcesContent":["import type { Root } from \"../../core/Root\";\nimport type { Settings } from \"../../core/util/Entity\";\nimport { Entity } from \"../../core/util/Entity\";\nimport { Sprite } from \"../../core/render/Sprite\";\nimport { Container } from \"../../core/render/Container\";\n\nimport * as $type from \"../../core/util/Type\";\nimport * as $array from \"../../core/util/Array\";\n\nimport type { IClasses } from \"./Classes\";\nimport classes from \"./Classes\";\n\ninterface IAdapter<E extends Settings> {\n key: keyof E[\"_settings\"],\n callback: (value: E[\"_settings\"][this[\"key\"]], target: E, key: this[\"key\"]) => E[\"_settings\"][this[\"key\"]];\n}\n\ninterface IJson {\n name: keyof IClasses;\n [key: string]: unknown;\n}\n\nfunction isJson(value: any): value is IJson {\n return $type.isObject(value) && !$type.isArray(value) && $type.isString((value as any).name);\n}\n\nexport class JsonParser {\n parse<E extends Settings>(root: Root, object: unknown): E {\n if (isJson(object)) {\n const construct = classes[object.name] as any;\n if (!construct) {\n throw new Error(\"Could not find class `\" + object.name + \"`\");\n }\n\n const entity = construct.new(root, object.settings) as E;\n\n if (entity instanceof Entity) {\n if (object.adapters) {\n $array.each(object.adapters as Array<IAdapter<E>>, (adapter) => {\n entity.adapters.add(adapter.key, adapter.callback);\n });\n }\n }\n\n if (entity instanceof Container) {\n if (object.children) {\n $array.each(object.children as Array<IJson>, (child) => {\n const sprite = this.parse<Sprite>(root, child);\n\n if (!(sprite instanceof Sprite)) {\n throw new Error(\"Children must be Sprite\");\n }\n\n entity.children.push(sprite);\n });\n }\n }\n\n return entity;\n\n } else {\n throw new Error(\"JsonParser.parse requires an object which has a `name` property\");\n }\n }\n\n parseString<E extends Settings>(root: Root, string: string): E {\n return this.parse(root, JSON.parse(string));\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Json.js","sourceRoot":"","sources":["../../../../../src/.internal/plugins/json/Json.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEpD,OAAO,KAAK,KAAK,MAAM,sBAAsB,CAAC;AAC9C,OAAO,KAAK,MAAM,MAAM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AI,EAAE,MAAM,CAAC,EAAC;qBACxC;;;;;CACJ;AAGD;IAAA;IAQA,CAAC;;;;;eAPG,UAA8B,IAAU,EAAE,MAAe;;;oBACrD,sBAAO,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC,EAAC;;;SACtC;;;;;;eAED,UAAoC,IAAU,EAAE,MAAc;;;;gCACnD,qBAAM,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,EAAA;gCAAjD,sBAAO,SAA0C,EAAC;;;;SACrD;;IACL,iBAAC;AAAD,CAAC,AARD,IAQC","sourcesContent":["import type { Root } from \"../../core/Root\";\nimport type { Sprite } from \"../../core/render/Sprite\";\nimport { Entity } from \"../../core/util/Entity\";\nimport { Container } from \"../../core/render/Container\";\nimport { Color } from \"../../core/util/Color\";\nimport { Template } from \"../../core/util/Template\";\n\nimport * as $type from \"../../core/util/Type\";\nimport * as $array from \"../../core/util/Array\";\nimport * as $object from \"../../core/util/Object\";\n\nimport type { IClasses } from \"./Classes\";\nimport classes from \"./Classes\";\n\n\ninterface IRef {\n [key: string]: any;\n}\n\n\nfunction isObject(value: any): value is { [key: string]: any } {\n return $type.isObject(value);\n}\n\n\nasync function getClass(name: string): Promise<typeof Entity> {\n const promise = classes[name as keyof IClasses];\n return await promise() as typeof Entity;\n}\n\n\nfunction parseArray(root: Root, value: Array<unknown>, refs: Array<IRef>): Promise<any> {\n return Promise.all($array.map(value, (value) => parseType(root, value, refs)));\n}\n\n\nfunction lookupRef(refs: Array<IRef>, name: string): any {\n let i = refs.length;\n\n while (i--) {\n const sub = refs[i];\n\n if (name in sub) {\n return sub[name];\n }\n }\n\n throw new Error(\"Could not find ref #\" + name);\n}\n\n\ninterface IAdapter<E extends Entity> {\n key: keyof E[\"_settings\"],\n callback: (value: E[\"_settings\"][this[\"key\"]], target: E, key: this[\"key\"]) => E[\"_settings\"][this[\"key\"]],\n}\n\ntype IParsedProperties = Array<(entity: Entity) => void>;\n\ninterface IParsedEntity<E extends Entity> {\n isValue: false,\n type: string | undefined,\n construct: typeof Entity | undefined,\n settings: object | undefined,\n adapters: Array<IAdapter<E>> | undefined,\n children: Array<Sprite> | undefined,\n properties: IParsedProperties | undefined,\n value: object,\n}\n\ntype IParsed<E extends Entity>\n = IParsedEntity<E>\n | { isValue: true, value: any };\n\n\nasync function parseSettings<E extends Entity>(root: Root, object: object, refs: Array<IRef>): Promise<E[\"_settings\"]> {\n const settings: { [key: string]: any } = {};\n\n await Promise.all($array.map($object.keys(object), async (key) => {\n settings[key] = await parseType(root, object[key], refs);\n }));\n\n return settings;\n}\n\n\nasync function parseProperties(root: Root, object: object, refs: Array<IRef>): Promise<IParsedProperties> {\n return await Promise.all($array.map($object.keys(object), async (key) => {\n const parsed = await parseValue(root, object[key], refs);\n\n return (entity: Entity) => {\n const old = entity[key] as unknown;\n\n if (old && old instanceof Entity) {\n // TODO merge it if the value is an Entity\n if (parsed.isValue) {\n throw new Error(\"Cannot merge value into Entity\");\n }\n\n if (parsed.settings) {\n old.setAll(parsed.settings);\n }\n\n mergeEntity(old, parsed);\n\n } else if (parsed.isValue) {\n // Merge Array into List\n if (old && $type.isArray(parsed.value)) {\n $array.each(parsed.value, (value) => {\n (old as any).push(value);\n });\n\n } else {\n // TODO merge it if the value is an Entity\n (entity as any)[key] = parsed.value;\n }\n\n } else {\n (entity as any)[key] = constructEntity(root, parsed);\n }\n };\n }));\n}\n\n\nasync function parseRefs(root: Root, object: { [key: string]: any }, refs: Array<IRef>): Promise<IRef> {\n const newRefs: IRef = {};\n\n await Promise.all($array.map($object.keys(object), async (key) => {\n newRefs[key] = await parseType(root, object[key], refs);\n }));\n\n return newRefs;\n}\n\n\nasync function parseValue<E extends Entity>(root: Root, value: any, refs: Array<IRef>): Promise<IParsed<E>> {\n if ($type.isArray(value)) {\n return {\n isValue: true,\n value: await parseArray(root, value, refs),\n };\n\n } else if (isObject(value)) {\n if (value.type === \"Color\") {\n return {\n isValue: true,\n value: Color.fromAny(value.value),\n };\n\n } else if (value.type === \"Template\") {\n if (value.refs) {\n refs = refs.concat([await parseRefs(root, value.refs, refs)]);\n }\n\n const settings = (value.settings ? await parseSettings(root, value.settings, refs) : {});\n\n return {\n isValue: true,\n value: Template.new(settings),\n };\n\n } else {\n if (value.refs) {\n refs = refs.concat([await parseRefs(root, value.refs, refs)]);\n }\n\n const [construct, settings, properties, children] = await Promise.all([\n (value.type ? getClass(value.type) : Promise.resolve(undefined)),\n (value.settings ? parseSettings(root, value.settings, refs) : Promise.resolve(undefined)),\n (value.properties ? parseProperties(root, value.properties, refs) : Promise.resolve(undefined)),\n (value.children ? parseArray(root, value.children, refs) : Promise.resolve(undefined)),\n ]);\n\n return {\n isValue: false,\n type: value.type,\n construct,\n settings,\n adapters: value.adapters,\n children,\n properties,\n value,\n };\n }\n\n } else if ($type.isString(value)) {\n if (value[0] === \"#\") {\n const ref = value.slice(1);\n\n if (value[1] === \"#\") {\n return {\n isValue: true,\n value: ref,\n };\n\n } else {\n return {\n isValue: true,\n value: lookupRef(refs, ref),\n };\n }\n\n } else {\n return {\n isValue: true,\n value,\n };\n }\n\n } else {\n return {\n isValue: true,\n value,\n };\n }\n}\n\n\nfunction mergeEntity<E extends Entity>(entity: E, parsed: IParsedEntity<E>): void {\n if (parsed.adapters) {\n $array.each(parsed.adapters, (adapter) => {\n entity.adapters.add(adapter.key, adapter.callback);\n });\n }\n\n if (parsed.properties) {\n $array.each(parsed.properties, (fn) => {\n fn(entity);\n });\n }\n\n if (entity instanceof Container) {\n if (parsed.children) {\n entity.children.setAll(parsed.children);\n }\n }\n}\n\n\nfunction constructEntity<E extends Entity>(root: Root, parsed: IParsedEntity<E>): E | object {\n if (!parsed.construct) {\n return parsed.value;\n }\n\n const entity = parsed.construct.new(root, parsed.settings || {}) as E;\n\n mergeEntity(entity, parsed);\n\n return entity;\n}\n\n\nasync function parseType(root: Root, value: unknown, refs: Array<IRef>): Promise<any> {\n const parsed = await parseValue(root, value, refs);\n\n if (parsed.isValue) {\n return parsed.value;\n\n } else {\n return constructEntity(root, parsed);\n }\n}\n\n\nexport class JsonParser {\n async parse<E extends Entity>(root: Root, object: unknown): Promise<E> {\n return parseType(root, object, []);\n }\n\n async parseString<E extends Entity>(root: Root, string: string): Promise<E> {\n return await this.parse(root, JSON.parse(string));\n }\n}\n"]}
|
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,51 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
|
|
|
5
5
|
Please note, that this project, while following numbering syntax, it DOES NOT
|
|
6
6
|
adhere to [Semantic Versioning](http://semver.org/spec/v2.0.0.html) rules.
|
|
7
7
|
|
|
8
|
+
## [5.1.12] - 2022-04-07
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
- Rounding a Date during daylight saving hour could produce incorrect result in some specific cases.
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [5.1.11] - 2022-04-06
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
- `groupDataWithOriginals` and `groupDataCallback` settings added to `XYSeries`. [More info](https://www.amcharts.com/docs/v5/charts/xy-chart/axes/date-axis/#Custom_aggregation_functions).
|
|
18
|
+
- `strictMinMaxSelection` setting added to `ValueAxis`. When set to `true`, the axis won't round `min` and `max` of a selection to the nearest round values, but will use actual min and max (`extraMin` and `extraMax` will still be added if set). This is a good feature when your series displays not actual but derivative values, like `valueYChangeSelection` as it helps to avoid frequent jumping of series to adjusted min and max of the axis.
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
- Internal layout of `XYChart` containers was changed. `plotContainers` now goes to `yAxesAndPlotContainer`, and `plotContainer` and `topPlotContainer` goe into `plotContainers`.
|
|
22
|
+
|
|
23
|
+
### Fixed
|
|
24
|
+
- If `XYChart` was used without animated theme, and scrollbar's background was clicked to zoom to some specific spot, it resulted in scrollbar not being updated anymore when zoomed with wheel or zoom-out button.
|
|
25
|
+
- Fixed and issue where nodes of `ForceDirected` series were flickering to 0,0 point when div of a chart was resized.
|
|
26
|
+
- Fixed potential XSS injection issue with the accessibility of tooltips.
|
|
27
|
+
- `container` setting in `ExportingMenu` was being ignored.
|
|
28
|
+
- In some specific cases not all series were included in min/max calculation of a `ValueAxis` resulting not all series to be visible.
|
|
29
|
+
- When whole series was out of selected scope, its last or first value (depending on seleciton) was still included when calculating min and max.
|
|
30
|
+
- Layouts were allocating space for margins of hidden items.
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
## [5.1.10] - 2022-03-30
|
|
34
|
+
|
|
35
|
+
### Added
|
|
36
|
+
- New in-line text formatting property `verticalAlign` added. Currently supports only `"super"` and `"sub"` values. E.g. `Copyright[fontSize: 8px; verticalAlign: super;]TM[\]`.
|
|
37
|
+
|
|
38
|
+
### Changed
|
|
39
|
+
- Logarithmic scale on `ValueAxis` was revamped with a different approach. No changes from the configration, but might influence appearance/scale.
|
|
40
|
+
- When calculating derivative values for series, `low`, `high`, and `open` used previous `low`, `high`, and `open` values. Now they all use `value` instead.
|
|
41
|
+
- Updated to D3 v7.
|
|
42
|
+
|
|
43
|
+
### Fixed
|
|
44
|
+
- In some cases, using a text placehodler, an empty string was shown insteaf of a zero.
|
|
45
|
+
- Some grid container masking issues fixed.
|
|
46
|
+
- Sometimes `valueAxis` was zoomed-in a bit on the first render of an `XYChart`.
|
|
47
|
+
- Axis ranges with `dRadius > 0` were not visible on `RadarChart`.
|
|
48
|
+
- Dynamic change of `value*Show` fields of an `XYSeries` was not working.
|
|
49
|
+
- Removing data from a legend could lead to JS errors in some particular cases.
|
|
50
|
+
- Ghost label was creating a gap in an `XYChartScrollbar` between scrollbar bottom an scrollbar series.
|
|
51
|
+
|
|
52
|
+
|
|
8
53
|
## [5.1.9] - 2022-03-17
|
|
9
54
|
|
|
10
55
|
### Fixed
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
body {
|
|
2
|
+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
|
|
3
|
+
padding: 0;
|
|
4
|
+
margin: 0;
|
|
5
|
+
background-color: #ffffff;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
#chartdiv {
|
|
9
|
+
width: 100%;
|
|
10
|
+
height: 80vh;
|
|
11
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<title>amCharts 5 Example - json</title>
|
|
6
|
+
<link rel="stylesheet" href="index.css" />
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
<div id="chartdiv"></div>
|
|
10
|
+
<script src="dist/index.js"></script>
|
|
11
|
+
</body>
|
|
12
|
+
</html>
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import * as am5 from "@amcharts/amcharts5";
|
|
2
|
+
|
|
3
|
+
import am5themes_Animated from "@amcharts/amcharts5/themes/Animated";
|
|
4
|
+
import * as am5plugins_json from "@amcharts/amcharts5/plugins/json";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
// Create root element
|
|
8
|
+
// https://www.amcharts.com/docs/v5/getting-started/#Root_element
|
|
9
|
+
const root = am5.Root.new("chartdiv");
|
|
10
|
+
|
|
11
|
+
// Set themes
|
|
12
|
+
// https://www.amcharts.com/docs/v5/concepts/themes/
|
|
13
|
+
root.setThemes([
|
|
14
|
+
am5themes_Animated.new(root)
|
|
15
|
+
]);
|
|
16
|
+
|
|
17
|
+
// Specify date fields, so that they are formatted accordingly in tooltips
|
|
18
|
+
// https://www.amcharts.com/docs/v5/concepts/formatters/data-placeholders/#Formatting_placeholders
|
|
19
|
+
root.dateFormatter.setAll({
|
|
20
|
+
dateFields: ["valueX"]
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
async function main() {
|
|
25
|
+
const chart = await new am5plugins_json.JsonParser().parse(root, {
|
|
26
|
+
refs: {
|
|
27
|
+
data: [
|
|
28
|
+
{
|
|
29
|
+
"date": 1652425200000,
|
|
30
|
+
"value": 92
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"date": 1652511600000,
|
|
34
|
+
"value": 95
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"date": 1652598000000,
|
|
38
|
+
"value": 100
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"date": 1652684400000,
|
|
42
|
+
"value": 100
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"date": 1652770800000,
|
|
46
|
+
"value": 96
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"date": 1652857200000,
|
|
50
|
+
"value": 97
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"date": 1652943600000,
|
|
54
|
+
"value": 94
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"date": 1653030000000,
|
|
58
|
+
"value": 89
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"date": 1653116400000,
|
|
62
|
+
"value": 89
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"date": 1653202800000,
|
|
66
|
+
"value": 87
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"date": 1653289200000,
|
|
70
|
+
"value": 84
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"date": 1653375600000,
|
|
74
|
+
"value": 81
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"date": 1653462000000,
|
|
78
|
+
"value": 85
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"date": 1653548400000,
|
|
82
|
+
"value": 89
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"date": 1653634800000,
|
|
86
|
+
"value": 86
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"date": 1653721200000,
|
|
90
|
+
"value": 90
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"date": 1653807600000,
|
|
94
|
+
"value": 93
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"date": 1653894000000,
|
|
98
|
+
"value": 94
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"date": 1653980400000,
|
|
102
|
+
"value": 94
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"date": 1654066800000,
|
|
106
|
+
"value": 96
|
|
107
|
+
}
|
|
108
|
+
],
|
|
109
|
+
xAxis: {
|
|
110
|
+
type: "DateAxis",
|
|
111
|
+
settings: {
|
|
112
|
+
maxDeviation: 0.5,
|
|
113
|
+
baseInterval: {
|
|
114
|
+
timeUnit: "day",
|
|
115
|
+
count: 1
|
|
116
|
+
},
|
|
117
|
+
renderer: {
|
|
118
|
+
type: "AxisRendererX",
|
|
119
|
+
settings: {
|
|
120
|
+
pan: "zoom"
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
tooltip: {
|
|
124
|
+
type: "Tooltip",
|
|
125
|
+
},
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
yAxis: {
|
|
129
|
+
type: "ValueAxis",
|
|
130
|
+
settings: {
|
|
131
|
+
maxDeviation: 1,
|
|
132
|
+
renderer: {
|
|
133
|
+
type: "AxisRendererY",
|
|
134
|
+
settings: {
|
|
135
|
+
pan: "zoom"
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
type: "XYChart",
|
|
142
|
+
settings: {
|
|
143
|
+
panX: false,
|
|
144
|
+
panY: false,
|
|
145
|
+
wheelX: "panX",
|
|
146
|
+
wheelY: "zoomX",
|
|
147
|
+
cursor: {
|
|
148
|
+
type: "XYCursor",
|
|
149
|
+
settings: {
|
|
150
|
+
behavior: "zoomX"
|
|
151
|
+
},
|
|
152
|
+
properties: {
|
|
153
|
+
lineY: {
|
|
154
|
+
settings: {
|
|
155
|
+
visible: false
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
scrollbarX: {
|
|
161
|
+
type: "Scrollbar",
|
|
162
|
+
settings: {
|
|
163
|
+
orientation: "horizontal"
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
properties: {
|
|
168
|
+
xAxes: [
|
|
169
|
+
"#xAxis",
|
|
170
|
+
],
|
|
171
|
+
yAxes: [
|
|
172
|
+
"#yAxis",
|
|
173
|
+
],
|
|
174
|
+
series: [
|
|
175
|
+
{
|
|
176
|
+
type: "LineSeries",
|
|
177
|
+
settings: {
|
|
178
|
+
name: "Series",
|
|
179
|
+
xAxis: "#xAxis",
|
|
180
|
+
yAxis: "#yAxis",
|
|
181
|
+
valueYField: "value",
|
|
182
|
+
valueXField: "date",
|
|
183
|
+
tooltip: {
|
|
184
|
+
type: "Tooltip",
|
|
185
|
+
settings: {
|
|
186
|
+
labelText: "{valueX}: {valueY}"
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
properties: {
|
|
191
|
+
data: "#data"
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
],
|
|
195
|
+
},
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
root.container.children.push(chart);
|
|
199
|
+
|
|
200
|
+
// Make stuff animate on load
|
|
201
|
+
// https://www.amcharts.com/docs/v5/concepts/animations/#Forcing_appearance_animation
|
|
202
|
+
chart.series.getIndex(0).appear(1000);
|
|
203
|
+
chart.appear(1000, 100);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
main();
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"private": true,
|
|
3
|
+
"name": "amcharts5-example-json",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"devDependencies": {
|
|
6
|
+
"@amcharts/amcharts5": "^5.1.12",
|
|
7
|
+
"source-map-loader": "^3.0.0",
|
|
8
|
+
"webpack": "^5.1.3",
|
|
9
|
+
"webpack-cli": "^4.1.0",
|
|
10
|
+
"webpack-dev-server": "^3.11.0"
|
|
11
|
+
},
|
|
12
|
+
"scripts": {
|
|
13
|
+
"build": "webpack",
|
|
14
|
+
"start": "webpack serve --mode development"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
var $path = require("path");
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
mode: "production",
|
|
5
|
+
|
|
6
|
+
devtool: "source-map",
|
|
7
|
+
|
|
8
|
+
stats: "errors-warnings",
|
|
9
|
+
|
|
10
|
+
target: ["web", "es5"],
|
|
11
|
+
|
|
12
|
+
entry: {
|
|
13
|
+
index: "./index.js",
|
|
14
|
+
},
|
|
15
|
+
|
|
16
|
+
devServer: {
|
|
17
|
+
publicPath: "/dist/",
|
|
18
|
+
liveReload: true,
|
|
19
|
+
overlay: true,
|
|
20
|
+
noInfo: true,
|
|
21
|
+
open: true
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
output: {
|
|
25
|
+
path: $path.join(__dirname, "dist"),
|
|
26
|
+
publicPath: "dist/",
|
|
27
|
+
filename: "[name].js",
|
|
28
|
+
chunkFilename: "[name].js"
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
module: {
|
|
32
|
+
rules: [{
|
|
33
|
+
test: /.js$/,
|
|
34
|
+
use: ["source-map-loader"],
|
|
35
|
+
enforce: "pre"
|
|
36
|
+
}]
|
|
37
|
+
}
|
|
38
|
+
};
|