@circutor/charts 0.1.0 → 0.3.0

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 (32) hide show
  1. package/dist/bundler/index.d.ts +35 -0
  2. package/dist/bundler/index.js +1 -0
  3. package/dist/bundler/itic-chart.d.ts +11 -0
  4. package/dist/bundler/itic-chart.js +1 -0
  5. package/dist/charts/charts.esm.js +1 -1
  6. package/dist/charts/p-7d11d611.entry.js +25 -0
  7. package/dist/charts/p-BPCJmLvQ.js +3 -0
  8. package/dist/cjs/charts.cjs.js +2 -2
  9. package/dist/cjs/{index-_N-tWlJj.js → index-dJHivNOd.js} +21 -0
  10. package/dist/cjs/itic-chart.cjs.entry.js +489 -77
  11. package/dist/cjs/loader.cjs.js +2 -2
  12. package/dist/collection/components/itic-chart/index.js +133 -6
  13. package/dist/collection/components/itic-chart/itic-chart.css +5 -0
  14. package/dist/collection/components/itic-chart/itic-chart.i18n.js +26 -0
  15. package/dist/collection/components/itic-chart/itic-chart.options.js +115 -32
  16. package/dist/collection/components/itic-chart/itic-chart.phases.js +55 -0
  17. package/dist/components/index.js +1 -1
  18. package/dist/components/itic-chart.js +3 -3
  19. package/dist/esm/charts.js +3 -3
  20. package/dist/esm/{index--cwjvYaF.js → index-BPCJmLvQ.js} +20 -1
  21. package/dist/esm/itic-chart.entry.js +489 -77
  22. package/dist/esm/loader.js +3 -3
  23. package/dist/types/components/itic-chart/index.d.ts +29 -2
  24. package/dist/types/components/itic-chart/itic-chart.i18n.d.ts +13 -0
  25. package/dist/types/components/itic-chart/itic-chart.options.d.ts +53 -4
  26. package/dist/types/components/itic-chart/itic-chart.phases.d.ts +17 -0
  27. package/dist/types/components.d.ts +43 -4
  28. package/dist/types/index.d.ts +1 -1
  29. package/package.json +11 -7
  30. package/readme.md +273 -37
  31. package/dist/charts/p--cwjvYaF.js +0 -3
  32. package/dist/charts/p-35caac53.entry.js +0 -25
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Get the base path to where the assets can be found. Use "setAssetPath(path)"
3
+ * if the path needs to be customized.
4
+ */
5
+ export declare const getAssetPath: (path: string) => string;
6
+
7
+ /**
8
+ * Used to manually set the base path where assets can be found.
9
+ * If the script is used as "module", it's recommended to use "import.meta.url",
10
+ * such as "setAssetPath(import.meta.url)". Other options include
11
+ * "setAssetPath(document.currentScript.src)", or using a bundler's replace plugin to
12
+ * dynamically set the path at build time, such as "setAssetPath(process.env.ASSET_PATH)".
13
+ * But do note that this configuration depends on how your script is bundled, or lack of
14
+ * bundling, and where your assets can be loaded from. Additionally custom bundling
15
+ * will have to ensure the static assets are copied to its build directory.
16
+ */
17
+ export declare const setAssetPath: (path: string) => void;
18
+
19
+ /**
20
+ * Used to specify a nonce value that corresponds with an application's CSP.
21
+ * When set, the nonce will be added to all dynamically created script and style tags at runtime.
22
+ * Alternatively, the nonce value can be set on a meta tag in the DOM head
23
+ * (<meta name="csp-nonce" content="{ nonce value here }" />) which
24
+ * will result in the same behavior.
25
+ */
26
+ export declare const setNonce: (nonce: string) => void
27
+
28
+ export interface SetPlatformOptions {
29
+ raf?: (c: FrameRequestCallback) => number;
30
+ ael?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
31
+ rel?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
32
+ }
33
+ export declare const setPlatformOptions: (opts: SetPlatformOptions) => void;
34
+
35
+ export * from '../types';
@@ -0,0 +1 @@
1
+ function t(t,e,n){const o="undefined"!=typeof HTMLElement?HTMLElement.prototype:null;for(;t&&t!==o;){const o=Object.getOwnPropertyDescriptor(t,e);if(o&&(!n||o.get))return o;t=Object.getPrototypeOf(t)}}var e,n=(e,n)=>{var o;Object.entries(null!=(o=n.o.t)?o:{}).map((([o,[l]])=>{if(31&l||32&l){const l=e[o],s=t(Object.getPrototypeOf(e),o,!0)||Object.getOwnPropertyDescriptor(e,o);s&&Object.defineProperty(e,o,{get(){return s.get.call(this)},set(t){s.set.call(this,t)},configurable:!0,enumerable:!0}),n.l.has(o)?e[o]=n.l.get(o):void 0!==l&&(e[o]=l)}}))},o=t=>{if(t.__stencil__getHostRef)return t.__stencil__getHostRef()},l=(t,e)=>(0,console.error)(t,e),s=new Map,i="undefined"!=typeof window?window:{},r=i.HTMLElement||class{},c={i:0,u:"",jmp:t=>t(),raf:t=>requestAnimationFrame(t),ael:(t,e,n,o)=>t.addEventListener(e,n,o),rel:(t,e,n,o)=>t.removeEventListener(e,n,o),ce:(t,e)=>new CustomEvent(t,e)},u=(()=>{try{return!!i.document.adoptedStyleSheets&&(new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replaceSync)}catch(t){}return!1})(),f=!!u&&(()=>!!i.document&&Object.getOwnPropertyDescriptor(i.document.adoptedStyleSheets,"length").writable)(),a=!1,d=[],h=[],p=()=>{var t;return(null==(t=i.document)?void 0:t.hidden)?setTimeout($,16):c.raf($)},m=(t,e)=>n=>{t.push(n),a||(a=!0,e&&4&c.i?v($):p())},b=t=>{for(let e=0;e<t.length;e++)try{t[e](performance.now())}catch(t){l(t)}t.length=0},$=()=>{b(d),b(h),(a=d.length>0)&&p()},v=t=>Promise.resolve(void 0).then(t),y=m(h,!0),w=t=>{const e=new URL(t,c.u);return e.origin!==i.location.origin?e.href:e.pathname},j=t=>c.u=t;function g(){const t=this.attachShadow({mode:"open"});void 0===e&&(e=null),e&&(f?t.adoptedStyleSheets.push(e):t.adoptedStyleSheets=[...t.adoptedStyleSheets,e])}var O,S=new WeakMap,k=t=>"sc-"+t.h,M=t=>"object"==(t=typeof t)||"function"===t,E=(t,e,...n)=>{let o=null,s=null,i=!1,r=!1;const c=[],u=e=>{for(let n=0;n<e.length;n++)if(o=e[n],Array.isArray(o))u(o);else if(null!=o&&"boolean"!=typeof o){if(i="function"!=typeof t&&!M(o))o+="";else if("function"!=typeof t&&void 0===o.i){l("Invalid vNode child");continue}i&&r?c[c.length-1].p+=o:c.push(i?C(null,o):o),r=i}};if(u(n),e){e.key&&(s=e.key);{const t=e.className||e.class;t&&(e.class="object"!=typeof t?t:Object.keys(t).filter((e=>t[e])).join(" "))}}const f=C(t,null);return f.m=e,c.length>0&&(f.$=c),f.v=s,f},C=(t,e)=>({i:0,j:t,p:null!=e?e:null,O:null,$:null,m:null,v:null}),L={},_=t=>{if(!t)return;const e=Object.keys(t);if(0===e.length)return;let n=!1;for(const o of e){if(n)break;for(const e of t[o])if("string"==typeof e){n=!0;break}}if(!n)return t;const o={};for(const n of e)o[n]=t[n].map((t=>"string"==typeof t?{[t]:0}:t));return o},x=(t,e)=>null==t||M(t)?t:1&e?t+"":t,A=(t,e)=>{const n=t;return{emit:t=>D(n,e,{bubbles:!0,composed:!0,cancelable:!0,detail:t})}},D=(t,e,n)=>{const o=c.ce(e,n);return t.dispatchEvent(o),o},H=(t,e,n,o)=>{if(n!==o)if(e.toLowerCase(),"class"===e){const e=t.classList,l=P(n);let s=P(o);{let t=l.filter((t=>t&&!s.includes(t)));e.remove(...t),e.add(...s.filter((t=>t&&!l.includes(t))))}}else"key"===e||"ref"===e&&o&&B(o,t)},N=/\s/,P=t=>("object"==typeof t&&t&&"baseVal"in t&&(t=t.baseVal),t&&"string"==typeof t?t.split(N):[]),U=(t,e)=>{const n=11===e.O.nodeType&&e.O.host?e.O.host:e.O,o=t&&t.m||{},l=e.m||{};for(const t of W(Object.keys(o)))t in l||H(n,t,o[t],void 0);for(const t of W(Object.keys(l)))H(n,t,o[t],l[t])};function W(t){return t.includes("ref")?[...t.filter((t=>"ref"!==t)),"ref"]:t}var R=[],T=[],V=(t,e,n)=>{const o=e.$[n];let l,s,r=0;if(!i.document)throw Error("You are trying to render a Stencil component in an environment that doesn't support the DOM.");if(l=o.O=i.document.createElement(o.j),U(null,o),o.$){const e="template"===o.j?l.content:l;for(r=0;r<o.$.length;++r)s=V(t,o,r),s&&e.appendChild(s)}return l["s-hn"]=O,l},q=(t,e,n,o,l,s)=>{let i,r=t;for(r.shadowRoot&&r.tagName===O&&(r=r.shadowRoot),"template"===n.j&&(r=r.content);l<=s;++l)o[l]&&(i=V(null,n,l),i&&(o[l].O=i,G(r,i,e)))},F=(t,e,n)=>{for(let o=e;o<=n;++o){const e=t[o];if(e){const t=e.O;Y(e),t&&t.remove()}}},z=(t,e,n=!1)=>t.j===e.j&&(n?(n&&!t.v&&e.v&&(t.v=e.v),!0):t.v===e.v),I=(t,e,n=!1)=>{const o=e.O=t.O,l=t.$,s=e.$;U(t,e),null!==l&&null!==s?((t,e,n,o,l=!1)=>{let s,i,r=0,c=0,u=0,f=0,a=e.length-1,d=e[0],h=e[a],p=o.length-1,m=o[0],b=o[p];const $="template"===n.j?t.content:t;for(;r<=a&&c<=p;)if(null==d)d=e[++r];else if(null==h)h=e[--a];else if(null==m)m=o[++c];else if(null==b)b=o[--p];else if(z(d,m,l))I(d,m,l),d=e[++r],m=o[++c];else if(z(h,b,l))I(h,b,l),h=e[--a],b=o[--p];else if(z(d,b,l))I(d,b,l),G($,d.O,h.O.nextSibling),d=e[++r],b=o[--p];else if(z(h,m,l))I(h,m,l),G($,h.O,d.O),h=e[--a],m=o[++c];else{for(u=-1,f=r;f<=a;++f)if(e[f]&&null!==e[f].v&&e[f].v===m.v){u=f;break}u>=0?(i=e[u],i.j!==m.j?s=V(e&&e[c],n,c):(I(i,m,l),e[u]=void 0,s=i.O),m=o[++c]):(s=V(e&&e[c],n,c),m=o[++c]),s&&G(d.O.parentNode,s,d.O)}r>a?q(t,null==o[p+1]?null:o[p+1].O,n,o,c,p):c>p&&F(e,r,a)})(o,l,e,s,n):null!==s?q(o,null,e,s,0,s.length-1):!n&&null!==l&&F(l,0,l.length-1)},Y=t=>{t.m&&t.m.ref&&R.push((()=>t.m.ref(null))),t.$&&t.$.map(Y)},B=(t,e)=>{T.push((()=>t(e)))},G=(t,e,n)=>null==t?void 0:t.insertBefore(e,n),J=(t,e,n=!1)=>{const o=t.$hostElement$,l=t.S||C(null,null),s=(t=>t&&t.j===L)(e)?e:E(null,null,e);if(O=o.tagName,n&&s.m)for(const t of Object.keys(s.m))o.hasAttribute(t)&&!["key","ref","style","class"].includes(t)&&(s.m[t]=o[t]);s.j=null,s.i|=4,t.S=s,s.O=l.O=o.shadowRoot||o,I(l,s,n),R.forEach((t=>t())),R.length=0,T.forEach((t=>t())),T.length=0},K=(t,e)=>{if(e&&!t.k&&e["s-p"]){const n=e["s-p"].push(new Promise((o=>t.k=()=>{e["s-p"].splice(n-1,1),o()})))}},Q=(t,e)=>{if(t.i|=16,4&t.i)return void(t.i|=512);K(t,t.M);const n=()=>X(t,e);if(!e)return y(n);queueMicrotask((()=>{n()}))},X=(t,e)=>{const n=t.$hostElement$,o=n;if(!o)throw Error(`Can't render component <${n.tagName.toLowerCase()} /> with invalid Stencil runtime! Make sure this imported component is compiled with a \`externalRuntime: true\` flag. For more information, please refer to https://stenciljs.com/docs/custom-elements#externalruntime`);let l;return l=st(o,e?"componentWillLoad":"componentWillUpdate",void 0,n),l=Z(l,(()=>st(o,"componentWillRender",void 0,n))),Z(l,(()=>et(t,o,e)))},Z=(t,e)=>tt(t)?t.then(e).catch((t=>{console.error(t),e()})):e(),tt=t=>t instanceof Promise||t&&t.then&&"function"==typeof t.then,et=async(t,e,n)=>{var o;const l=t.$hostElement$,r=l["s-rc"];n&&(t=>{const e=t.o,n=t.$hostElement$,o=e.i,l=((t,e)=>{var n,o,l;const r=k(e),a=s.get(r);if(!i.document)return r;if(t=11===t.nodeType?t:i.document,a)if("string"==typeof a){let l,s=S.get(t=t.head||t);if(s||S.set(t,s=new Set),!s.has(r)){l=i.document.createElement("style"),l.textContent=a;const d=null!=(n=c.C)?n:function(){var t,e,n;return null!=(n=null==(e=null==(t=i.document.head)?void 0:t.querySelector('meta[name="csp-nonce"]'))?void 0:e.getAttribute("content"))?n:void 0}();if(null!=d&&l.setAttribute("nonce",d),!(1&e.i))if("HEAD"===t.nodeName){const e=t.querySelectorAll("link[rel=preconnect]"),n=e.length>0?e[e.length-1].nextSibling:t.querySelector("style");t.insertBefore(l,(null==n?void 0:n.parentNode)===t?n:null)}else if("host"in t)if(u){const e=new(null!=(o=t.defaultView)?o:t.ownerDocument.defaultView).CSSStyleSheet;e.replaceSync(a),f?t.adoptedStyleSheets.unshift(e):t.adoptedStyleSheets=[e,...t.adoptedStyleSheets]}else{const e=t.querySelector("style");e?e.textContent=a+e.textContent:t.prepend(l)}else t.append(l);1&e.i&&t.insertBefore(l,null),4&e.i&&(l.textContent+="slot-fb{display:contents}slot-fb[hidden]{display:none}"),s&&s.add(r)}}else{let e=S.get(t);if(e||S.set(t,e=new Set),!e.has(r)){const n=null!=(l=t.defaultView)?l:t.ownerDocument.defaultView;let o;if(a.constructor===n.CSSStyleSheet)o=a;else{o=new n.CSSStyleSheet;for(let t=0;t<a.cssRules.length;t++)o.insertRule(a.cssRules[t].cssText,t)}f?t.adoptedStyleSheets.push(o):t.adoptedStyleSheets=[...t.adoptedStyleSheets,o],e.add(r)}}return r})(n.shadowRoot?n.shadowRoot:n.getRootNode(),e);10&o&&(n["s-sc"]=l,n.classList.add(l+"-h"))})(t);nt(t,e,l,n),r&&(r.map((t=>t())),l["s-rc"]=void 0);{const e=null!=(o=l["s-p"])?o:[],n=()=>ot(t);0===e.length?n():(Promise.all(e).then(n).catch(n),t.i|=4,e.length=0)}},nt=(t,e,n,o)=>{try{e=e.render(),t.i&=-17,t.i|=2,J(t,e,o)}catch(e){l(e,t.$hostElement$)}return null},ot=t=>{const e=t.$hostElement$,n=e,o=t.M;st(n,"componentDidRender",void 0,e),64&t.i?st(n,"componentDidUpdate",void 0,e):(t.i|=64,it(e),st(n,"componentDidLoad",void 0,e),t.L(e),o||lt()),t.k&&(t.k(),t.k=void 0),512&t.i&&v((()=>Q(t,!1))),t.i&=-517},lt=()=>{v((()=>D(i,"appload",{detail:{namespace:"charts"}})))},st=(t,e,n,o)=>{if(t&&t[e])try{return t[e](n)}catch(t){l(t,o)}},it=t=>t.classList.add("hydrated"),rt=(t,e,n,s)=>{const i=o(t);if(!i)return;const r=t,c=i.l.get(e),u=i.i,f=r;if(!((n=x(n,s.t[e][0]))===c||Number.isNaN(c)&&Number.isNaN(n))){if(i.l.set(e,n),s._){const t=s._[e];t&&t.map((t=>{try{const[[o,l]]=Object.entries(t);(128&u||1&l)&&(f?f[o](n,c,e):i.A.push((()=>{i.D[o](n,c,e)})))}catch(t){l(t,r)}}))}if(2&u){if(f.componentShouldUpdate&&!1===f.componentShouldUpdate(n,c,e)&&!(16&u))return;16&u||Q(i,!1)}}},ct=(e,n)=>{var l,s;const i=e.prototype;{e.watchers&&!n._&&(n._=_(e.watchers)),e.deserializers&&!n.H&&(n.H=e.deserializers),e.serializers&&!n.N&&(n.N=e.serializers);const r=Object.entries(null!=(l=n.t)?l:{});r.map((([e,[l]])=>{if(31&l||32&l){const{get:s,set:r}=t(i,e)||{};s&&(n.t[e][0]|=2048),r&&(n.t[e][0]|=4096),Object.defineProperty(i,e,{get(){return s?s.apply(this):((t,e)=>o(this).l.get(e))(0,e)},configurable:!0,enumerable:!0}),Object.defineProperty(i,e,{set(t){const s=o(this);if(s){if(r)return void 0===(32&l?this[e]:s.$hostElement$[e])&&s.l.get(e)&&(t=s.l.get(e)),r.call(this,x(t,l)),void rt(this,e,t=32&l?this[e]:s.$hostElement$[e],n);rt(this,e,t,n)}}})}}));{const t=new Map;i.attributeChangedCallback=function(e,l,s){c.jmp((()=>{var c;const u=t.get(e),f=o(this);if(this.hasOwnProperty(u),i.hasOwnProperty(u)&&"number"==typeof this[u]&&this[u]==s)return;if(null==u){const t=null==f?void 0:f.i;if(f&&t&&!(8&t)&&s!==l){const o=this,i=null==(c=n._)?void 0:c[e];null==i||i.forEach((n=>{const[[i,r]]=Object.entries(n);null!=o[i]&&(128&t||1&r)&&o[i].call(o,s,l,e)}))}return}const a=r.find((([t])=>t===u)),d=4&(a?a[1][0]:0),h=d&&null===s&&void 0===this[u];d&&(s=null!==s&&"false"!==s);const p=Object.getOwnPropertyDescriptor(i,u);h||s==this[u]||p.get&&!p.set||(this[u]=s)}))},e.observedAttributes=Array.from(new Set([...Object.keys(null!=(s=n._)?s:{}),...r.filter((([t,e])=>31&e[0])).map((([e,n])=>{const o=n[1]||e;return t.set(o,e),o}))]))}}return e},ut=async(t,e,n)=>{let o;try{if(!(32&e.i)&&(e.i|=32,e.i&=-1025,o=t.constructor,customElements.whenDefined(t.localName).then((()=>e.i|=128)),o&&o.style)){let t;"string"==typeof o.style&&(t=o.style);const e=k(n);if(!s.has(e)){const o=()=>{};((t,e,n)=>{let o=s.get(t);u&&n?(o=o||new CSSStyleSheet,"string"==typeof o?o=e:o.replaceSync(e)):o=e,s.set(t,o)})(e,t,!!(1&n.i)),o()}}const l=e.M,i=()=>Q(e,!0);l&&l["s-rc"]?l["s-rc"].push(i):i()}catch(n){l(n,t),e.k&&(e.k(),e.k=void 0),!e.L||1024&e.i||e.L(t)}},ft=(t,e)=>{const s={i:e[0],h:e[1]};try{s.t=e[2],s._=_(t._),s.H=t.H,s.N=t.N;const l=t.prototype.connectedCallback,i=t.prototype.disconnectedCallback;return Object.assign(t.prototype,{__hasHostListenerAttached:!1,__registerHost(){((t,e)=>{const o={i:0,$hostElement$:t,o:e,l:new Map,P:new Map};o.U=new Promise((t=>o.L=t)),t["s-p"]=[],t["s-rc"]=[];const l=o;t.__stencil__getHostRef=()=>l,512&e.i&&n(t,o)})(this,s)},connectedCallback(){if(!this.__hasHostListenerAttached){if(!o(this))return;this.__hasHostListenerAttached=!0}(t=>{if(!(1&c.i)){const e=o(t);if(!e)return;const n=e.o,l=()=>{};if(1&e.i)(null==e?void 0:e.D)||(1024&e.i?setTimeout((()=>ut(t,e,n)),1e3):(null==e?void 0:e.U)&&e.U.then((()=>{})));else{e.i|=1;{let n=t;for(;n=n.parentNode||n.host;)if(n["s-p"]){K(e,e.M=n);break}}n.t&&Object.entries(n.t).map((([e,[n]])=>{if(31&n&&Object.prototype.hasOwnProperty.call(t,e)){const n=t[e];delete t[e],t[e]=n}})),ut(t,e,n)}l()}})(this),l&&l.call(this)},disconnectedCallback(){(async t=>{S.has(t)&&S.delete(t),t.shadowRoot&&S.has(t.shadowRoot)&&S.delete(t.shadowRoot)})(this),i&&i.call(this)},__attachShadow(){if(this.shadowRoot){if("open"!==this.shadowRoot.mode)throw Error(`Unable to re-use existing shadow root for ${s.h}! Mode is set to ${this.shadowRoot.mode} but Stencil only supports open shadow roots.`)}else g.call(this,s)}}),Object.defineProperty(t,"is",{value:s.h,configurable:!0}),ct(t,s)}catch(e){return l(e),t}},at=t=>c.C=t,dt=t=>Object.assign(c,t),ht=new WeakMap;function pt(t,e){let n=ht.get(e);n||(n={i:0,o:{i:0,h:e.tagName},$hostElement$:e},ht.set(e,n)),J(n,t)}function mt(t){return t}export{r as H,A as c,w as getAssetPath,E as h,ft as p,pt as render,j as setAssetPath,at as setNonce,dt as setPlatformOptions,mt as t}
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface IticChart extends Components.IticChart, HTMLElement {}
4
+ export const IticChart: {
5
+ prototype: IticChart;
6
+ new (): IticChart;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1 @@
1
+ import{t as e,p as t,H as n,c as a,h as i}from"./index.js";import*as o from"echarts/core";import{LineChart as s,ScatterChart as r}from"echarts/charts";import{GridComponent as l,LegendComponent as c,TooltipComponent as u}from"echarts/components";import{CanvasRenderer as m}from"echarts/renderers";const h=["ca","de","en","es","fr","pt"],d={ca:{ariaLabel:"Corba ITIC",xAxisName:"Durada (ms)",yAxisName:"Voltatge (% del voltatge nominal)",tooltip:{asset:"Actiu",date:"Data",eventType:"Esdeveniment",duration:"Durada",voltage:"Voltatge",status:"Estat",phase:"Fase",min:"Mín.",max:"Màx."},eventTypes:{VOLTAGE_DIP:"Buit de tensió",VOLTAGE_SWELL:"Augment de tensió",POWER_INTERRUPT:"Interrupció",VOLTAGE_TRANSIENT:"Transitori de voltatge",VOLTAGE_VARIATION:"Variació de voltatge",OVER_VOLTAGE:"Sobretensió",SUB_VOLTAGE:"Subtensió"},phases:{ALL:"Totes",NONE:""}},de:{ariaLabel:"ITIC-Diagramm",xAxisName:"Dauer (ms)",yAxisName:"Spannung (% der Nennspannung)",tooltip:{asset:"Vermögenswert",date:"Datum",eventType:"Ereignis",duration:"Dauer",voltage:"Spannung",status:"Status",phase:"Phase",min:"Min.",max:"Max."},eventTypes:{VOLTAGE_DIP:"Spannungseinbruch",VOLTAGE_SWELL:"Spannungserhöhung",POWER_INTERRUPT:"Stromunterbrechung",VOLTAGE_TRANSIENT:"Spannungstransient",VOLTAGE_VARIATION:"Spannungsschwankung",OVER_VOLTAGE:"Überspannung",SUB_VOLTAGE:"Unterspannung"},phases:{ALL:"Alle",NONE:""}},en:{ariaLabel:"ITIC chart",xAxisName:"Duration (ms)",yAxisName:"Voltage (% of nominal voltage)",tooltip:{asset:"Asset",date:"Date",eventType:"Event",duration:"Duration",voltage:"Voltage",status:"Status",phase:"Phase",min:"Min",max:"Max"},eventTypes:{VOLTAGE_DIP:"Voltage dip",VOLTAGE_SWELL:"Voltage swell",POWER_INTERRUPT:"Power interruption",VOLTAGE_TRANSIENT:"Voltage transient",VOLTAGE_VARIATION:"Voltage variation",OVER_VOLTAGE:"Overvoltage",SUB_VOLTAGE:"Subvoltage"},phases:{ALL:"All",NONE:""}},es:{ariaLabel:"Curva ITIC",xAxisName:"Duración (ms)",yAxisName:"Voltaje (% del voltaje nominal)",tooltip:{asset:"Activo",date:"Fecha",eventType:"Evento",duration:"Duración",voltage:"Voltaje",status:"Estado",phase:"Fase",min:"Mín.",max:"Máx."},eventTypes:{VOLTAGE_DIP:"Hueco de tensión",VOLTAGE_SWELL:"Aumento de tensión",POWER_INTERRUPT:"Interrupción",VOLTAGE_TRANSIENT:"Transitorio de voltaje",VOLTAGE_VARIATION:"Variación de voltaje",OVER_VOLTAGE:"Sobretensión",SUB_VOLTAGE:"Subtensión"},phases:{ALL:"Todas",NONE:""}},fr:{ariaLabel:"Courbe ITIC",xAxisName:"Durée (ms)",yAxisName:"Tension (% de la tension nominale)",tooltip:{asset:"Dispositif",date:"Date",eventType:"Événement",duration:"Durée",voltage:"Tension",status:"Statut",phase:"Phase",min:"Min.",max:"Max."},eventTypes:{VOLTAGE_DIP:"Creux de tension",VOLTAGE_SWELL:"Augmentation de tension",POWER_INTERRUPT:"Interruption",VOLTAGE_TRANSIENT:"Tension transitoire",VOLTAGE_VARIATION:"Variation de tension",OVER_VOLTAGE:"Surtension",SUB_VOLTAGE:"Sous-tension"},phases:{ALL:"Toutes",NONE:""}},pt:{ariaLabel:"Curva ITIC",xAxisName:"Duração (ms)",yAxisName:"Tensão (% da tensão nominal)",tooltip:{asset:"Ativo",date:"Data",eventType:"Evento",duration:"Duração",voltage:"Tensão",status:"Status",phase:"Fase",min:"Mín.",max:"Máx."},eventTypes:{VOLTAGE_DIP:"Queda de tensão",VOLTAGE_SWELL:"Aumento de tensão",POWER_INTERRUPT:"Interrupção",VOLTAGE_TRANSIENT:"Tensão transitória",VOLTAGE_VARIATION:"Variação de tensão",OVER_VOLTAGE:"Sobretensão",SUB_VOLTAGE:"Subtensão"},phases:{ALL:"Todas",NONE:""}}};function p(e){const t=((null!=e?e:"")+"").split(/[-_]/)[0].toLowerCase();return h.includes(t)?t:"en"}const A=e=>d[e],L=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);function T(e,t){return L(e.eventTypes,t)?e.eventTypes[t]:t}function g(e,t){return L(e.phases,t)?e.phases[t]:void 0}const E="#a67c52",O="#20262C",y="#B9BDC0",N="#00B388",v={AN:{name:"L1",color:E},BN:{name:"L2",color:O},CN:{name:"L3",color:y},AB:{name:"L1",color:E},BC:{name:"L2",color:O},CA:{name:"L3",color:y},"AN,BN,CN":{name:"L1,L2,L3",color:N},"AB,BC,CA":{name:"L1,L2,L3",color:N},ALL:{name:"",color:"#4C5CC5"},A:{name:"L1"},B:{name:"L2"},C:{name:"L3"},"AN,BN":{name:"L1,L2"},"AN,CN":{name:"L1,L3"},"BN,CN":{name:"L2,L3"},"AB,BC":{name:"L1,L2"},"AB,CA":{name:"L1,L3"},"BC,CA":{name:"L2,L3"},NONE:{name:""}},b=e=>null==e?"":e+"",S=e=>Object.prototype.hasOwnProperty.call(v,e)?v[e]:{name:e};function V(e,t){var n;const a=b(e),i=S(a);return Object.assign(Object.assign({},i),{name:null!==(n=g(t,a))&&void 0!==n?n:i.name})}const x=e=>"ALL"===e?2:"NONE"===e?1:0;function I(e){return e.map((e=>{const t=b(e.phase);return{group:e,code:t,rank:x(t),name:S(t).name}})).sort(((e,t)=>e.rank-t.rank||C(e.name,t.name)||C(e.code,t.code))).map((({group:e})=>e))}const C=(e,t)=>e<t?-1:e>t?1:0,f={locale:"en"},D=e=>null==e||""===e;function _(e){const t=new Intl.NumberFormat(e);return e=>t.format(e)}const G=e=>!1!==e.clickable;const R=[[.167,500],[1,200],[3,140],[3,120],[500,120],[500,110],[1e5,110]],B=[[20,0],[20,70],[500,70],[500,80],[1e4,80],[1e4,90],[1e5,90]],F={animation:!1,grid:{right:"20px",left:"60px"},legend:{top:0},tooltip:{appendTo:"body"},textStyle:{fontFamily:"CDS-Regular, Arial"},xAxis:{type:"log",min:1,max:1e5,nameGap:30,nameLocation:"middle",nameTextStyle:{fontSize:16,fontWeight:"bold"}},yAxis:{type:"value",min:0,max:200,nameTextStyle:{fontSize:16,fontWeight:"bold"},nameRotate:90,nameGap:40,nameLocation:"middle"}},w=[{type:"line",data:R,areaStyle:{origin:"end",color:"#FFEDEA"},lineStyle:{color:"#000"},silent:!0,showSymbol:!1,emphasis:{disabled:!0}},{type:"line",data:B,areaStyle:{origin:"start",color:"#FFF5DF"},silent:!0,showSymbol:!1,lineStyle:{color:"#000"},emphasis:{disabled:!0}},{type:"line",data:B,areaStyle:{origin:100,color:"#DDFAF1"},silent:!0,showSymbol:!1,lineStyle:{color:"#000"},emphasis:{disabled:!0}},{type:"line",data:R,areaStyle:{origin:100,color:"#DDFAF1"},silent:!0,showSymbol:!1,lineStyle:{color:"#000"},emphasis:{disabled:!0}},{type:"line",data:[[.1,500],[.167,500]],areaStyle:{origin:100,color:"#DDFAF1"},silent:!0,showSymbol:!1,lineStyle:{color:"transparent"},emphasis:{disabled:!0}},{type:"line",data:[[.1,0],[20,0]],areaStyle:{origin:100,color:"#DDFAF1"},silent:!0,showSymbol:!1,lineStyle:{color:"transparent"},emphasis:{disabled:!0}}];o.use([s,r,l,c,u,m]);const P=t(class extends n{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.pointClick=a(this,"pointClick"),this.locale="en",this.parsedGroups=[]}onGroupsChange(){this.updateChart()}onLocaleChange(){this.updateAriaLabel(),this.updateChart()}onTimeZoneChange(){this.validateTimeZone(),this.updateChart()}connectedCallback(){this.el.hasAttribute("role")||this.el.setAttribute("role","img"),this.updateAriaLabel(),this.initChart()}componentWillLoad(){this.validateTimeZone()}componentDidLoad(){this.initChart()}disconnectedCallback(){var e,t;null===(e=this.resizeObserver)||void 0===e||e.disconnect(),this.resizeObserver=void 0,null===(t=this.chart)||void 0===t||t.dispose(),this.chart=void 0}updateAriaLabel(){const e=this.el.getAttribute("aria-label");null!==e&&e!==this.defaultAriaLabel||(this.defaultAriaLabel=A(p(this.locale)).ariaLabel,this.el.setAttribute("aria-label",this.defaultAriaLabel))}validateTimeZone(){this.validTimeZone=void 0,this.timeZone&&(function(){try{return!0}catch(e){return!1}}()?this.validTimeZone=this.timeZone:console.error(`[itic-chart] Invalid "timeZone" prop: "${this.timeZone}". Using the browser's time zone.`))}initChart(){this.container&&!this.chart&&(this.chart=o.init(this.container),this.chart.on("click",(e=>{const t=function(e,{componentType:t,seriesIndex:n,dataIndex:a}){if("series"!==t||null==n||null==a)return;const i=I(e)[n-w.length],o=null==i?void 0:i.points[a];return o&&G(o)?{point:o,group:i}:void 0}(this.parsedGroups,e);t&&this.pointClick.emit(t)})),"undefined"!=typeof ResizeObserver&&(this.resizeObserver=new ResizeObserver((()=>{var e;return null===(e=this.chart)||void 0===e?void 0:e.resize()})),this.resizeObserver.observe(this.container)),this.updateChart())}updateChart(){if(!this.chart)return;this.parsedGroups=[];try{this.parsedGroups=function(e){if(null==e||""===e)return[];const t="string"==typeof e?JSON.parse(e):e;if(!Array.isArray(t))throw new TypeError('"groups" must be an array of point groups');return t}(this.groups)}catch(e){console.error('[itic-chart] Invalid "groups" prop:',e)}const e=function(e,t=f){const n=A(t.locale),a=function({locale:e,timeZone:t}){const n=A(e),a=new Intl.DateTimeFormat(e,{day:"2-digit",month:"short",hour:"2-digit",minute:"2-digit",second:"2-digit",fractionalSecondDigits:3,hourCycle:"h23",timeZone:t}),i=new Intl.NumberFormat(e,{style:"unit",unit:"millisecond",maximumFractionDigits:3}),o=new Intl.NumberFormat(e,{style:"percent",maximumFractionDigits:1}),s=new Intl.NumberFormat(e,{minimumFractionDigits:2,maximumFractionDigits:2}),r=e=>{const t=new Date(e);return Number.isNaN(t.getTime())?(null!=e?e:"")+"":a.format(t)},l=e=>Number(e)?s.format(Number(e))+" V":void 0;return(e,t)=>[["asset",D(t.assetName)?void 0:t.assetName+""],["date",r(e.ts)],["eventType",D(e.eventType)?void 0:T(n,e.eventType+"")],["duration",i.format(Number(e.duration))],["voltage",o.format(Number(e.voltage)/100)],["status",D(e.status)?void 0:e.status+""],["phase",V(t.phase,n).name||"-"],["min",l(e.min)],["max",l(e.max)]].filter((e=>void 0!==e[1])).map((([e,t])=>` <strong>${n.tooltip[e]}</strong>: ${function(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}(t)}`)).join("<br/>")}(t),i={formatter:_(t.locale)};return Object.assign(Object.assign({},F),{xAxis:Object.assign(Object.assign({},F.xAxis),{name:n.xAxisName,axisLabel:i}),yAxis:Object.assign(Object.assign({},F.yAxis),{name:n.yAxisName,axisLabel:i}),series:[...w,...I(e).map((e=>{const{name:t,color:i}=V(e.phase,n);return{type:"scatter",name:t,data:e.points.map((e=>({value:[e.duration,e.voltage],cursor:G(e)?"pointer":"default"}))),symbolSize:12,z:4,itemStyle:i?{color:i,opacity:1}:{opacity:1},tooltip:{formatter:t=>a(e.points[t.dataIndex],e)}}}))]})}(this.parsedGroups,{locale:p(this.locale),timeZone:this.validTimeZone});this.chart.setOption(e,{notMerge:!0})}render(){return i("div",{key:"2bb964d590a36c9c9501761c3f848ad364a29030",class:"chart",ref:e=>this.container=e})}get el(){return this}static get watchers(){return{groups:[{onGroupsChange:0}],locale:[{onLocaleChange:0}],timeZone:[{onTimeZoneChange:0}]}}static get style(){return":host{display:block;height:400px;background:var(--itic-chart-background, transparent)}.chart{width:100%;height:100%}"}},[1,"itic-chart",{groups:[1],locale:[1],timeZone:[1,"time-zone"]},void 0,{groups:[{onGroupsChange:0}],locale:[{onLocaleChange:0}],timeZone:[{onTimeZoneChange:0}]}]);function j(){"undefined"!=typeof customElements&&["itic-chart"].forEach((t=>{"itic-chart"===t&&(customElements.get(e(t))||customElements.define(e(t),P))}))}j();const W=P,U=j;export{W as IticChart,U as defineCustomElement}
@@ -1 +1 @@
1
- import{p as a,b as o}from"./p--cwjvYaF.js";export{s as setNonce}from"./p--cwjvYaF.js";import{g as r}from"./p-DQuL1Twl.js";(()=>{const s=import.meta.url,o={};return""!==s&&(o.resourcesUrl=new URL(".",s).href),a(o)})().then((async a=>(await r(),o([["p-35caac53",[[1,"itic-chart",{groups:[1]},null,{groups:[{onGroupsChange:0}]}]]]],a))));
1
+ import{p as o,b as e}from"./p-BPCJmLvQ.js";export{s as setNonce}from"./p-BPCJmLvQ.js";import{g as n}from"./p-DQuL1Twl.js";(()=>{const e=import.meta.url,n={};return""!==e&&(n.resourcesUrl=new URL(".",e).href),o(n)})().then((async o=>(await n(),e([["p-7d11d611",[[1,"itic-chart",{groups:[1],locale:[1],timeZone:[1,"time-zone"]},null,{groups:[{onGroupsChange:0}],locale:[{onLocaleChange:0}],timeZone:[{onTimeZoneChange:0}]}]]]],o))));