@kubex/zinc 1.1.31 → 1.1.33

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 (35) hide show
  1. package/dist/chunks/zn.4YKYUIHS.js +3 -0
  2. package/dist/chunks/zn.6RARZYEJ.js +22 -0
  3. package/dist/chunks/zn.7VCR5ZZL.js +1 -0
  4. package/dist/chunks/zn.AI3T35DX.js +1 -0
  5. package/dist/chunks/zn.CU5HCKLN.js +1 -0
  6. package/dist/chunks/zn.EHO4QQOL.js +1 -0
  7. package/dist/chunks/zn.GBBMMHHG.js +8 -0
  8. package/dist/chunks/zn.GRJSS6IO.js +1 -0
  9. package/dist/chunks/zn.HPUEBV7K.js +1 -0
  10. package/dist/chunks/zn.J2JOUV3V.js +8 -0
  11. package/dist/chunks/zn.NKUIXDNI.js +1 -0
  12. package/dist/chunks/zn.S4ZVBYAS.js +3 -0
  13. package/dist/chunks/zn.UBLZO6CI.js +1 -0
  14. package/dist/chunks/zn.XO7QERPZ.js +716 -0
  15. package/dist/chunks/zn.ZGI3WHSG.js +4 -0
  16. package/dist/custom-elements.json +61 -2
  17. package/dist/web-types.json +1 -1
  18. package/dist/zn.d.ts +21 -0
  19. package/dist/zn.min.js +1323 -2074
  20. package/index.html +1 -1
  21. package/package.json +3 -3
  22. package/scripts/build.js +10 -5
  23. package/src/components/chart/chart.component.ts +20 -27
  24. package/src/components/chart/echarts-loader.ts +30 -0
  25. package/src/components/editor/editor.component.ts +1 -2
  26. package/src/components/editor/modules/emoji/emoji-mart-loader.ts +28 -0
  27. package/src/components/editor/modules/emoji/emoji.ts +3 -9
  28. package/src/components/editor/modules/emoji/headless/headless-emoji.ts +2 -9
  29. package/src/components/icon/icon.component.ts +34 -2
  30. package/src/components/icon-picker/icon-picker.component.ts +35 -35
  31. package/src/components/icon-picker/material-icons.ts +530 -10442
  32. package/src/components/rating/rating.component.ts +1 -2
  33. package/src/components/simple-chart/simple-chart.component.ts +15 -6
  34. package/src/zinc-autoloader.ts +0 -2
  35. package/tsconfig.json +2 -1
@@ -1,4 +1,3 @@
1
- import {clamp} from "lodash";
2
1
  import {classMap} from "lit/directives/class-map.js";
3
2
  import {type CSSResultGroup, html, unsafeCSS} from 'lit';
4
3
  import {FormControlController, validValidityState} from "../../internal/form";
@@ -98,7 +97,7 @@ export default class ZnRating extends ZincElement implements ZincFormControl {
98
97
  const {left, width} = this.rating.getBoundingClientRect();
99
98
  const value = this._roundToPrecision(((coordinate - left) / width) * this.max, this.precision);
100
99
 
101
- return clamp(value, 0, this.max);
100
+ return Math.min(Math.max(value, 0), this.max);
102
101
  }
103
102
 
104
103
  private _getValueFromMousePosition(event: MouseEvent): number {
@@ -1,16 +1,11 @@
1
- import * as echarts from 'echarts/core';
2
- import { BarChart } from 'echarts/charts';
3
- import { CanvasRenderer } from 'echarts/renderers';
4
1
  import { type CSSResultGroup, html, unsafeCSS } from 'lit';
5
- import { GridComponent, TooltipComponent } from 'echarts/components';
2
+ import { loadECharts } from '../chart/echarts-loader';
6
3
  import { property } from 'lit/decorators.js';
7
4
  import { ResizeController } from '@lit-labs/observers/resize-controller.js';
8
5
  import styles from './simple-chart.scss';
9
6
  import ZincElement from '../../internal/zinc-element';
10
7
  import type { ECharts } from 'echarts/core';
11
8
 
12
- echarts.use([BarChart, GridComponent, TooltipComponent, CanvasRenderer]);
13
-
14
9
  const DEFAULT_LABELS = [
15
10
  'Jun 2016', 'Jul 2016', 'Aug 2016', 'Sep 2016', 'Oct 2016', 'Nov 2016',
16
11
  'Dec 2016', 'Jan 2017', 'Feb 2017', 'Mar 2017', 'Apr 2017', 'May 2017',
@@ -41,6 +36,7 @@ export default class ZnSimpleChart extends ZincElement {
41
36
  }) enableAnimations: boolean | number = false;
42
37
 
43
38
  private chart?: ECharts;
39
+ private initPromise?: Promise<void>;
44
40
  private readonly resizeObserver = new ResizeController(this, {
45
41
  target: null,
46
42
  skipInitial: true,
@@ -48,8 +44,21 @@ export default class ZnSimpleChart extends ZincElement {
48
44
  });
49
45
 
50
46
  firstUpdated() {
47
+ this.initPromise = this.initChart().catch(() => undefined);
48
+ }
49
+
50
+ // Make `await el.updateComplete` cover the lazy echarts load and chart init
51
+ protected override async getUpdateComplete(): Promise<boolean> {
52
+ const result = await super.getUpdateComplete();
53
+ await this.initPromise;
54
+ return result;
55
+ }
56
+
57
+ private async initChart() {
51
58
  const host = this.shadowRoot?.getElementById('chart') as HTMLElement | null;
52
59
  if (!host) return;
60
+ const echarts = await loadECharts();
61
+ if (!this.isConnected || this.chart) return;
53
62
  this.chart = echarts.init(host);
54
63
  const data = this.datasets?.[0]?.data ?? DEFAULT_DATA;
55
64
  const labels = this.labels ?? DEFAULT_LABELS;
@@ -45,8 +45,6 @@ function register(tagName: string): Promise<void> {
45
45
 
46
46
  // Register it
47
47
  return new Promise((resolve, reject) => {
48
- // @ts-expect-error Dynamic imports are only supported when the --module flag is set to es2020, es2022, esnext,
49
- // commonjs, amd, system, umd, node16, or nodenext
50
48
  import(path).then(() => resolve()).catch(() => reject(new Error(`Unable to autoload <${tagName}> from ${path}`)));
51
49
  });
52
50
  }
package/tsconfig.json CHANGED
@@ -2,7 +2,8 @@
2
2
  {
3
3
  "compilerOptions": {
4
4
  /* Visit https://aka.ms/tsconfig.json to read more about this file */
5
- "target": "es2017",
5
+ "target": "es2020",
6
+ "module": "esnext",
6
7
  "moduleResolution": "node",
7
8
  "lib": [
8
9
  "dom",