@flowtools/uplot 0.0.10 → 0.0.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/README.md CHANGED
@@ -14,9 +14,9 @@ pnpm add @flowtools/uplot uplot @vueuse/core
14
14
 
15
15
  ```vue
16
16
  <script setup lang="ts">
17
- import { ref } from 'vue'
18
17
  import type { AlignedData, Options } from '@flowtools/uplot'
19
18
  import { Uplot } from '@flowtools/uplot'
19
+ import { ref } from 'vue'
20
20
 
21
21
  const options = ref<Options>({
22
22
  series: [
package/dist/index.es.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { defineComponent as F, ref as D, onMounted as N, watch as v, nextTick as P, openBlock as p, createElementBlock as u, renderSlot as j, unref as d, createElementVNode as y, createTextVNode as U, toDisplayString as h, createCommentVNode as S, Fragment as L, renderList as M, normalizeClass as R, normalizeStyle as C } from "vue";
2
- import q from "uplot";
3
- import { useElementSize as G, useVModel as T } from "@vueuse/core";
4
- const B = (n) => {
2
+ import { useElementSize as q, useVModel as T } from "@vueuse/core";
3
+ import G from "uplot";
4
+ function B(n) {
5
5
  if (typeof n == "object" && n !== null) {
6
6
  if (typeof Object.getPrototypeOf == "function") {
7
7
  const r = Object.getPrototypeOf(n);
@@ -10,15 +10,19 @@ const B = (n) => {
10
10
  return Object.prototype.toString.call(n) === "[object Object]";
11
11
  }
12
12
  return !1;
13
- }, c = (...n) => n.reduce((r, a) => {
14
- if (Array.isArray(a))
15
- throw new TypeError(
16
- "Arguments provided to ts-deepmerge must be objects, not arrays."
17
- );
18
- return a && Object.keys(a).forEach((o) => {
19
- ["__proto__", "constructor", "prototype"].includes(o) || (Array.isArray(r[o]) && Array.isArray(a[o]) ? r[o] = c.options.mergeArrays ? Array.from(new Set(r[o].concat(a[o]))) : a[o] : B(r[o]) && B(a[o]) ? r[o] = c(r[o], a[o]) : r[o] = a[o]);
20
- }), r;
21
- }, {}), E = {
13
+ }
14
+ function c(...n) {
15
+ return n.reduce((r, a) => {
16
+ if (Array.isArray(a))
17
+ throw new TypeError(
18
+ "Arguments provided to ts-deepmerge must be objects, not arrays."
19
+ );
20
+ return a && Object.keys(a).forEach((o) => {
21
+ ["__proto__", "constructor", "prototype"].includes(o) || (Array.isArray(r[o]) && Array.isArray(a[o]) ? r[o] = c.options.mergeArrays ? Array.from(new Set(r[o].concat(a[o]))) : a[o] : B(r[o]) && B(a[o]) ? r[o] = c(r[o], a[o]) : r[o] = a[o]);
22
+ }), r;
23
+ }, {});
24
+ }
25
+ const E = {
22
26
  mergeArrays: !0
23
27
  };
24
28
  c.options = E;
@@ -33,13 +37,13 @@ c.withOptions = (n, ...r) => {
33
37
  const H = { class: "__uplot-root" }, I = {
34
38
  key: 0,
35
39
  class: "extra-info"
36
- }, J = /* @__PURE__ */ y("br", null, null, -1), K = { style: { "text-align": "left" } }, Q = { class: "__uplot-legend" }, W = ["onClick"], X = {
40
+ }, J = { style: { "text-align": "left" } }, K = { class: "__uplot-legend" }, Q = ["onClick"], W = {
37
41
  key: 1,
38
42
  class: "__uplot-legend-value"
39
- }, Y = {
43
+ }, X = {
40
44
  key: 2,
41
45
  class: "__uplot-legend-value"
42
- }, te = /* @__PURE__ */ F({
46
+ }, oe = /* @__PURE__ */ F({
43
47
  __name: "uplot",
44
48
  props: {
45
49
  options: {},
@@ -52,7 +56,7 @@ const H = { class: "__uplot-root" }, I = {
52
56
  },
53
57
  emits: ["select", "cursor", "update:zoom", "update:series"],
54
58
  setup(n, { expose: r, emit: a }) {
55
- const o = n, _ = a, b = D(), { width: w, height: x } = G(b), z = T(o, "zoom", _, { passive: !0 }), i = T(o, "series", _, { passive: !0 }), $ = {
59
+ const o = n, g = a, b = D(), { width: w, height: x } = q(b), z = T(o, "zoom", g, { passive: !0 }), i = T(o, "series", g, { passive: !0 }), $ = {
56
60
  title: void 0,
57
61
  legend: {
58
62
  show: !1
@@ -60,26 +64,26 @@ const H = { class: "__uplot-root" }, I = {
60
64
  hooks: {
61
65
  init: [
62
66
  (e) => {
63
- o.showDebug && console.log("init", e), i.value = e.series.map((l, t) => ({
64
- label: l.label,
65
- stroke: typeof l.stroke == "function" ? l.stroke(e, t) : null,
67
+ o.showDebug && console.log("init", e), i.value = e.series.map((t, s) => ({
68
+ label: t.label,
69
+ stroke: typeof t.stroke == "function" ? t.stroke(e, s) : null,
66
70
  value: null,
67
71
  data: null,
68
- show: l.show
72
+ show: t.show
69
73
  // ...s,
70
74
  }));
71
75
  }
72
76
  ],
73
77
  setCursor: [
74
78
  (e) => {
75
- _("cursor", e.cursor), i.value = e.series.map((l, t) => {
79
+ g("cursor", e.cursor), i.value = e.series.map((t, s) => {
76
80
  var f, m;
77
81
  return {
78
- label: l.label,
79
- stroke: typeof l.stroke == "function" ? l.stroke(e, t) : null,
80
- value: e.cursor.idx && e.data[t][e.cursor.idx] ? typeof l.value == "function" ? l.value(e, e.data[t][e.cursor.idx], t, e.cursor.idx) : e.data[t][e.cursor.idx] : null,
81
- data: (f = e.cursor) != null && f.idx ? e.data[t][(m = e.cursor) == null ? void 0 : m.idx] : null,
82
- show: l.show
82
+ label: t.label,
83
+ stroke: typeof t.stroke == "function" ? t.stroke(e, s) : null,
84
+ value: e.cursor.idx && e.data[s][e.cursor.idx] ? typeof t.value == "function" ? t.value(e, e.data[s][e.cursor.idx], s, e.cursor.idx) : e.data[s][e.cursor.idx] : null,
85
+ data: (f = e.cursor) != null && f.idx ? e.data[s][(m = e.cursor) == null ? void 0 : m.idx] : null,
86
+ show: t.show
83
87
  // ...s,
84
88
  };
85
89
  });
@@ -87,7 +91,7 @@ const H = { class: "__uplot-root" }, I = {
87
91
  ],
88
92
  setSelect: [
89
93
  (e) => {
90
- _("select", e.select), o.showDebug && console.log("setSelect", e.select), z.value = [
94
+ g("select", e.select), o.showDebug && console.log("setSelect", e.select), z.value = [
91
95
  e.posToVal(e.select.left, "x"),
92
96
  e.posToVal(e.select.left + e.select.width, "x")
93
97
  ];
@@ -103,10 +107,10 @@ const H = { class: "__uplot-root" }, I = {
103
107
  ]
104
108
  }
105
109
  };
106
- let s;
110
+ let l;
107
111
  const O = D();
108
112
  function A() {
109
- s && s.destroy(), s = new q({ width: 100, height: 100, ...c(o.options, $) }, o.data, b.value), O.value = s, o.zoom[0] !== null && o.zoom[1] !== null && s.setScale("x", { min: o.zoom[0], max: o.zoom[1] }), setTimeout(() => {
113
+ l && l.destroy(), l = new G({ width: 100, height: 100, ...c(o.options, $) }, o.data, b.value), O.value = l, o.zoom[0] !== null && o.zoom[1] !== null && l.setScale("x", { min: o.zoom[0], max: o.zoom[1] }), setTimeout(() => {
110
114
  k();
111
115
  }, 0);
112
116
  }
@@ -118,26 +122,26 @@ const H = { class: "__uplot-root" }, I = {
118
122
  });
119
123
  }), v(o.data, (e) => {
120
124
  if (o.noResetScale) {
121
- s.setData(e, !1), s.redraw(!1);
125
+ l.setData(e, !1), l.redraw(!1);
122
126
  return;
123
127
  }
124
- s.setData(e, !0);
125
- }), v(o.options, (e, l) => {
126
- o.showDebug && console.log("watch options", e, l), A();
127
- }), v(() => o.zoom, (e, l) => {
128
- e[0] !== null && e[1] !== null && (s.scales.x.min !== e[0] || s.scales.x.max !== e[1]) && (console.log("watch zoom setScale", s.scales.x.min, e[0], s.scales.x.max, e[1]), s.setScale("x", { min: e[0], max: e[1] }));
128
+ l.setData(e, !0);
129
+ }), v(o.options, (e, t) => {
130
+ o.showDebug && console.log("watch options", e, t), A();
131
+ }), v(() => o.zoom, (e) => {
132
+ e[0] !== null && e[1] !== null && (l.scales.x.min !== e[0] || l.scales.x.max !== e[1]) && (console.log("watch zoom setScale", l.scales.x.min, e[0], l.scales.x.max, e[1]), l.setScale("x", { min: e[0], max: e[1] }));
129
133
  });
130
134
  function k() {
131
- s.setSize({ width: w.value, height: x.value }), o.showDebug && console.log("resize", s);
135
+ l.setSize({ width: w.value, height: x.value }), o.showDebug && console.log("resize", l);
132
136
  }
133
- function g(e) {
134
- var l, t;
135
- typeof e == "object" && (e = ((l = i.value) == null ? void 0 : l.indexOf(e)) || -1), s.setSeries(e, { show: !s.series[e].show }), (t = i.value) != null && t[e] && (i.value[e].show = s.series[e].show);
137
+ function _(e) {
138
+ var t, s;
139
+ typeof e == "object" && (e = ((t = i.value) == null ? void 0 : t.indexOf(e)) || -1), l.setSeries(e, { show: !l.series[e].show }), (s = i.value) != null && s[e] && (i.value[e].show = l.series[e].show);
136
140
  }
137
- return r({ toggleShow: g, uplot: O }), (e, l) => (p(), u("div", H, [
141
+ return r({ toggleShow: _, uplot: O }), (e, t) => (p(), u("div", H, [
138
142
  j(e.$slots, "header", {
139
143
  series: d(i),
140
- toggleShow: g
144
+ toggleShow: _
141
145
  }),
142
146
  y("div", {
143
147
  ref_key: "el",
@@ -146,30 +150,30 @@ const H = { class: "__uplot-root" }, I = {
146
150
  }, null, 512),
147
151
  e.showDebug ? (p(), u("div", I, [
148
152
  U(h(d(w)) + " x " + h(d(x)) + " ", 1),
149
- J,
150
- y("pre", K, h(d(i)), 1)
153
+ t[0] || (t[0] = y("br", null, null, -1)),
154
+ y("pre", J, h(d(i)), 1)
151
155
  ])) : S("", !0),
152
156
  e.noFooter ? S("", !0) : j(e.$slots, "footer", {
153
157
  key: 1,
154
158
  series: d(i),
155
- toggleShow: g
159
+ toggleShow: _
156
160
  }, () => [
157
- y("div", Q, [
158
- (p(!0), u(L, null, M(d(i), (t, f) => {
161
+ y("div", K, [
162
+ (p(!0), u(L, null, M(d(i), (s, f) => {
159
163
  var m;
160
164
  return p(), u("div", {
161
- key: t.label,
162
- class: R(["__uplot-legend-series", [`__uplot-${(m = t.label) == null ? void 0 : m.toLowerCase()}`, `__uplot-i-${f}`]]),
163
- style: C({ backgroundColor: t.show ? "" : "lightgrey" }),
164
- onClick: (Z) => g(f)
165
+ key: s.label,
166
+ class: R(["__uplot-legend-series", [`__uplot-${(m = s.label) == null ? void 0 : m.toLowerCase()}`, `__uplot-i-${f}`]]),
167
+ style: C({ backgroundColor: s.show ? "" : "lightgrey" }),
168
+ onClick: (Y) => _(f)
165
169
  }, [
166
170
  f !== 0 ? (p(), u("span", {
167
171
  key: 0,
168
- style: C({ color: t.stroke || "black" }),
172
+ style: C({ color: s.stroke || "black" }),
169
173
  class: "__uplot-legend-label"
170
- }, h(t.label), 5)) : S("", !0),
171
- t.value ? (p(), u("span", X, h(t.value), 1)) : (p(), u("span", Y, "--"))
172
- ], 14, W);
174
+ }, h(s.label), 5)) : S("", !0),
175
+ s.value ? (p(), u("span", W, h(s.value), 1)) : (p(), u("span", X, "--"))
176
+ ], 14, Q);
173
177
  }), 128))
174
178
  ])
175
179
  ])
@@ -177,5 +181,5 @@ const H = { class: "__uplot-root" }, I = {
177
181
  }
178
182
  });
179
183
  export {
180
- te as Uplot
184
+ oe as Uplot
181
185
  };
package/dist/index.umd.js CHANGED
@@ -1 +1 @@
1
- (function(i,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("vue"),require("uplot"),require("@vueuse/core")):typeof define=="function"&&define.amd?define(["exports","vue","uplot","@vueuse/core"],o):(i=typeof globalThis<"u"?globalThis:i||self,o(i["change-name"]={},i.vue,i.Uplot,i.core))})(this,function(i,o,D,g){"use strict";const w=c=>{if(typeof c=="object"&&c!==null){if(typeof Object.getPrototypeOf=="function"){const r=Object.getPrototypeOf(c);return r===Object.prototype||r===null}return Object.prototype.toString.call(c)==="[object Object]"}return!1},d=(...c)=>c.reduce((r,a)=>{if(Array.isArray(a))throw new TypeError("Arguments provided to ts-deepmerge must be objects, not arrays.");return a&&Object.keys(a).forEach(t=>{["__proto__","constructor","prototype"].includes(t)||(Array.isArray(r[t])&&Array.isArray(a[t])?r[t]=d.options.mergeArrays?Array.from(new Set(r[t].concat(a[t]))):a[t]:w(r[t])&&w(a[t])?r[t]=d(r[t],a[t]):r[t]=a[t])}),r},{}),S={mergeArrays:!0};d.options=S,d.withOptions=(c,...r)=>{d.options={mergeArrays:!0,...c};const a=d(...r);return d.options=S,a};const E={class:"__uplot-root"},O={key:0,class:"extra-info"},A=o.createElementVNode("br",null,null,-1),j={style:{"text-align":"left"}},C={class:"__uplot-legend"},T=["onClick"],N={key:1,class:"__uplot-legend-value"},V={key:2,class:"__uplot-legend-value"},$=o.defineComponent({__name:"uplot",props:{options:{},data:{},noResetScale:{type:Boolean,default:!1},showDebug:{type:Boolean,default:!1},noFooter:{type:Boolean,default:!1},zoom:{default:()=>[null,null]},series:{}},emits:["select","cursor","update:zoom","update:series"],setup(c,{expose:r,emit:a}){const t=c,h=a,_=o.ref(),{width:y,height:b}=g.useElementSize(_),k=g.useVModel(t,"zoom",h,{passive:!0}),p=g.useVModel(t,"series",h,{passive:!0}),M={title:void 0,legend:{show:!1},hooks:{init:[e=>{t.showDebug&&console.log("init",e),p.value=e.series.map((n,l)=>({label:n.label,stroke:typeof n.stroke=="function"?n.stroke(e,l):null,value:null,data:null,show:n.show}))}],setCursor:[e=>{h("cursor",e.cursor),p.value=e.series.map((n,l)=>{var f,m;return{label:n.label,stroke:typeof n.stroke=="function"?n.stroke(e,l):null,value:e.cursor.idx&&e.data[l][e.cursor.idx]?typeof n.value=="function"?n.value(e,e.data[l][e.cursor.idx],l,e.cursor.idx):e.data[l][e.cursor.idx]:null,data:(f=e.cursor)!=null&&f.idx?e.data[l][(m=e.cursor)==null?void 0:m.idx]:null,show:n.show}})}],setSelect:[e=>{h("select",e.select),t.showDebug&&console.log("setSelect",e.select),k.value=[e.posToVal(e.select.left,"x"),e.posToVal(e.select.left+e.select.width,"x")]}],setScale:[e=>{t.showDebug&&console.log("setScale",e.scales),k.value=[e.scales.x.min||null,e.scales.x.max||null]}]}};let s;const x=o.ref();function z(){s&&s.destroy(),s=new D({width:100,height:100,...d(t.options,M)},t.data,_.value),x.value=s,t.zoom[0]!==null&&t.zoom[1]!==null&&s.setScale("x",{min:t.zoom[0],max:t.zoom[1]}),setTimeout(()=>{B()},0)}o.onMounted(()=>{z()}),o.watch([y,b],()=>{o.nextTick(()=>{B()})}),o.watch(t.data,e=>{if(t.noResetScale){s.setData(e,!1),s.redraw(!1);return}s.setData(e,!0)}),o.watch(t.options,(e,n)=>{t.showDebug&&console.log("watch options",e,n),z()}),o.watch(()=>t.zoom,(e,n)=>{e[0]!==null&&e[1]!==null&&(s.scales.x.min!==e[0]||s.scales.x.max!==e[1])&&(console.log("watch zoom setScale",s.scales.x.min,e[0],s.scales.x.max,e[1]),s.setScale("x",{min:e[0],max:e[1]}))});function B(){s.setSize({width:y.value,height:b.value}),t.showDebug&&console.log("resize",s)}function u(e){var n,l;typeof e=="object"&&(e=((n=p.value)==null?void 0:n.indexOf(e))||-1),s.setSeries(e,{show:!s.series[e].show}),(l=p.value)!=null&&l[e]&&(p.value[e].show=s.series[e].show)}return r({toggleShow:u,uplot:x}),(e,n)=>(o.openBlock(),o.createElementBlock("div",E,[o.renderSlot(e.$slots,"header",{series:o.unref(p),toggleShow:u}),o.createElementVNode("div",{ref_key:"el",ref:_,class:"__uplot"},null,512),e.showDebug?(o.openBlock(),o.createElementBlock("div",O,[o.createTextVNode(o.toDisplayString(o.unref(y))+" x "+o.toDisplayString(o.unref(b))+" ",1),A,o.createElementVNode("pre",j,o.toDisplayString(o.unref(p)),1)])):o.createCommentVNode("",!0),e.noFooter?o.createCommentVNode("",!0):o.renderSlot(e.$slots,"footer",{key:1,series:o.unref(p),toggleShow:u},()=>[o.createElementVNode("div",C,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(o.unref(p),(l,f)=>{var m;return o.openBlock(),o.createElementBlock("div",{key:l.label,class:o.normalizeClass(["__uplot-legend-series",[`__uplot-${(m=l.label)==null?void 0:m.toLowerCase()}`,`__uplot-i-${f}`]]),style:o.normalizeStyle({backgroundColor:l.show?"":"lightgrey"}),onClick:P=>u(f)},[f!==0?(o.openBlock(),o.createElementBlock("span",{key:0,style:o.normalizeStyle({color:l.stroke||"black"}),class:"__uplot-legend-label"},o.toDisplayString(l.label),5)):o.createCommentVNode("",!0),l.value?(o.openBlock(),o.createElementBlock("span",N,o.toDisplayString(l.value),1)):(o.openBlock(),o.createElementBlock("span",V,"--"))],14,T)}),128))])])]))}});i.Uplot=$,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})});
1
+ (function(c,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("vue"),require("@vueuse/core"),require("uplot")):typeof define=="function"&&define.amd?define(["exports","vue","@vueuse/core","uplot"],o):(c=typeof globalThis<"u"?globalThis:c||self,o(c["change-name"]={},c.vue,c.core,c.Uplot))})(this,function(c,o,g,D){"use strict";function w(i){if(typeof i=="object"&&i!==null){if(typeof Object.getPrototypeOf=="function"){const r=Object.getPrototypeOf(i);return r===Object.prototype||r===null}return Object.prototype.toString.call(i)==="[object Object]"}return!1}function f(...i){return i.reduce((r,a)=>{if(Array.isArray(a))throw new TypeError("Arguments provided to ts-deepmerge must be objects, not arrays.");return a&&Object.keys(a).forEach(t=>{["__proto__","constructor","prototype"].includes(t)||(Array.isArray(r[t])&&Array.isArray(a[t])?r[t]=f.options.mergeArrays?Array.from(new Set(r[t].concat(a[t]))):a[t]:w(r[t])&&w(a[t])?r[t]=f(r[t],a[t]):r[t]=a[t])}),r},{})}const S={mergeArrays:!0};f.options=S,f.withOptions=(i,...r)=>{f.options={mergeArrays:!0,...i};const a=f(...r);return f.options=S,a};const E={class:"__uplot-root"},O={key:0,class:"extra-info"},A={style:{"text-align":"left"}},j={class:"__uplot-legend"},C=["onClick"],T={key:1,class:"__uplot-legend-value"},N={key:2,class:"__uplot-legend-value"},$=o.defineComponent({__name:"uplot",props:{options:{},data:{},noResetScale:{type:Boolean,default:!1},showDebug:{type:Boolean,default:!1},noFooter:{type:Boolean,default:!1},zoom:{default:()=>[null,null]},series:{}},emits:["select","cursor","update:zoom","update:series"],setup(i,{expose:r,emit:a}){const t=i,h=a,y=o.ref(),{width:_,height:b}=g.useElementSize(y),k=g.useVModel(t,"zoom",h,{passive:!0}),p=g.useVModel(t,"series",h,{passive:!0}),M={title:void 0,legend:{show:!1},hooks:{init:[e=>{t.showDebug&&console.log("init",e),p.value=e.series.map((l,s)=>({label:l.label,stroke:typeof l.stroke=="function"?l.stroke(e,s):null,value:null,data:null,show:l.show}))}],setCursor:[e=>{h("cursor",e.cursor),p.value=e.series.map((l,s)=>{var d,m;return{label:l.label,stroke:typeof l.stroke=="function"?l.stroke(e,s):null,value:e.cursor.idx&&e.data[s][e.cursor.idx]?typeof l.value=="function"?l.value(e,e.data[s][e.cursor.idx],s,e.cursor.idx):e.data[s][e.cursor.idx]:null,data:(d=e.cursor)!=null&&d.idx?e.data[s][(m=e.cursor)==null?void 0:m.idx]:null,show:l.show}})}],setSelect:[e=>{h("select",e.select),t.showDebug&&console.log("setSelect",e.select),k.value=[e.posToVal(e.select.left,"x"),e.posToVal(e.select.left+e.select.width,"x")]}],setScale:[e=>{t.showDebug&&console.log("setScale",e.scales),k.value=[e.scales.x.min||null,e.scales.x.max||null]}]}};let n;const x=o.ref();function z(){n&&n.destroy(),n=new D({width:100,height:100,...f(t.options,M)},t.data,y.value),x.value=n,t.zoom[0]!==null&&t.zoom[1]!==null&&n.setScale("x",{min:t.zoom[0],max:t.zoom[1]}),setTimeout(()=>{B()},0)}o.onMounted(()=>{z()}),o.watch([_,b],()=>{o.nextTick(()=>{B()})}),o.watch(t.data,e=>{if(t.noResetScale){n.setData(e,!1),n.redraw(!1);return}n.setData(e,!0)}),o.watch(t.options,(e,l)=>{t.showDebug&&console.log("watch options",e,l),z()}),o.watch(()=>t.zoom,e=>{e[0]!==null&&e[1]!==null&&(n.scales.x.min!==e[0]||n.scales.x.max!==e[1])&&(console.log("watch zoom setScale",n.scales.x.min,e[0],n.scales.x.max,e[1]),n.setScale("x",{min:e[0],max:e[1]}))});function B(){n.setSize({width:_.value,height:b.value}),t.showDebug&&console.log("resize",n)}function u(e){var l,s;typeof e=="object"&&(e=((l=p.value)==null?void 0:l.indexOf(e))||-1),n.setSeries(e,{show:!n.series[e].show}),(s=p.value)!=null&&s[e]&&(p.value[e].show=n.series[e].show)}return r({toggleShow:u,uplot:x}),(e,l)=>(o.openBlock(),o.createElementBlock("div",E,[o.renderSlot(e.$slots,"header",{series:o.unref(p),toggleShow:u}),o.createElementVNode("div",{ref_key:"el",ref:y,class:"__uplot"},null,512),e.showDebug?(o.openBlock(),o.createElementBlock("div",O,[o.createTextVNode(o.toDisplayString(o.unref(_))+" x "+o.toDisplayString(o.unref(b))+" ",1),l[0]||(l[0]=o.createElementVNode("br",null,null,-1)),o.createElementVNode("pre",A,o.toDisplayString(o.unref(p)),1)])):o.createCommentVNode("",!0),e.noFooter?o.createCommentVNode("",!0):o.renderSlot(e.$slots,"footer",{key:1,series:o.unref(p),toggleShow:u},()=>[o.createElementVNode("div",j,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(o.unref(p),(s,d)=>{var m;return o.openBlock(),o.createElementBlock("div",{key:s.label,class:o.normalizeClass(["__uplot-legend-series",[`__uplot-${(m=s.label)==null?void 0:m.toLowerCase()}`,`__uplot-i-${d}`]]),style:o.normalizeStyle({backgroundColor:s.show?"":"lightgrey"}),onClick:P=>u(d)},[d!==0?(o.openBlock(),o.createElementBlock("span",{key:0,style:o.normalizeStyle({color:s.stroke||"black"}),class:"__uplot-legend-label"},o.toDisplayString(s.label),5)):o.createCommentVNode("",!0),s.value?(o.openBlock(),o.createElementBlock("span",T,o.toDisplayString(s.value),1)):(o.openBlock(),o.createElementBlock("span",N,"--"))],14,C)}),128))])])]))}});c.Uplot=$,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
@@ -0,0 +1,2 @@
1
+ declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
2
+ export default _default;
@@ -1,4 +1,4 @@
1
- import Uplot from 'uplot';
1
+ import { default as Uplot } from 'uplot';
2
2
  export type Options = Omit<Uplot.Options, 'height' | 'width'>;
3
3
  export type AlignedData = Uplot.AlignedData;
4
4
  export interface Series {
@@ -24,74 +24,56 @@ interface UplotProps {
24
24
  series?: Series[];
25
25
  }
26
26
  declare function toggleShow(idx: number | Series): void;
27
- declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<UplotProps>, {
28
- noResetScale: boolean;
29
- showDebug: boolean;
30
- noFooter: boolean;
31
- zoom: () => null[];
32
- }>, {
27
+ declare function __VLS_template(): {
28
+ slots: {
29
+ header?(_: {
30
+ series: {
31
+ label: string | undefined;
32
+ stroke: string | null;
33
+ value: number | string | null | undefined;
34
+ data: number | null | undefined;
35
+ show: boolean | undefined;
36
+ }[] | undefined;
37
+ toggleShow: typeof toggleShow;
38
+ }): any;
39
+ footer?(_: {
40
+ series: {
41
+ label: string | undefined;
42
+ stroke: string | null;
43
+ value: number | string | null | undefined;
44
+ data: number | null | undefined;
45
+ show: boolean | undefined;
46
+ }[] | undefined;
47
+ toggleShow: typeof toggleShow;
48
+ }): any;
49
+ };
50
+ refs: {
51
+ el: HTMLDivElement;
52
+ };
53
+ attrs: Partial<{}>;
54
+ };
55
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
56
+ declare const __VLS_component: import('vue').DefineComponent<UplotProps, {
33
57
  toggleShow: typeof toggleShow;
34
- uplot: import("vue").Ref<any>;
35
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
36
- select: (select: Uplot.Select) => void;
37
- cursor: (cursor: Uplot.Cursor) => void;
38
- "update:zoom": (zoom: number[]) => void;
39
- "update:series": (series: Series[]) => void;
40
- }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<UplotProps>, {
41
- noResetScale: boolean;
42
- showDebug: boolean;
43
- noFooter: boolean;
44
- zoom: () => null[];
45
- }>>> & {
58
+ uplot: import('vue').Ref<any, any>;
59
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
60
+ select: (select: Uplot.Select) => any;
61
+ cursor: (cursor: Uplot.Cursor) => any;
62
+ "update:zoom": (zoom: number[]) => any;
63
+ "update:series": (series: Series[]) => any;
64
+ }, string, import('vue').PublicProps, Readonly<UplotProps> & Readonly<{
46
65
  onSelect?: ((select: Uplot.Select) => any) | undefined;
47
66
  onCursor?: ((cursor: Uplot.Cursor) => any) | undefined;
48
67
  "onUpdate:zoom"?: ((zoom: number[]) => any) | undefined;
49
68
  "onUpdate:series"?: ((series: Series[]) => any) | undefined;
50
- }, {
69
+ }>, {
51
70
  noResetScale: boolean;
52
71
  showDebug: boolean;
53
72
  noFooter: boolean;
54
73
  zoom: number[] | null[];
55
- }, {}>, {
56
- header?(_: {
57
- series: {
58
- label: string | undefined;
59
- stroke: string | null;
60
- value: string | number | null | undefined;
61
- data: number | null | undefined;
62
- show: boolean | undefined;
63
- }[] | undefined;
64
- toggleShow: typeof toggleShow;
65
- }): any;
66
- footer?(_: {
67
- series: {
68
- label: string | undefined;
69
- stroke: string | null;
70
- value: string | number | null | undefined;
71
- data: number | null | undefined;
72
- show: boolean | undefined;
73
- }[] | undefined;
74
- toggleShow: typeof toggleShow;
75
- }): any;
76
- }>;
74
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
75
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
77
76
  export default _default;
78
- type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
79
- type __VLS_TypePropsToRuntimeProps<T> = {
80
- [K in keyof T]-?: {} extends Pick<T, K> ? {
81
- type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
82
- } : {
83
- type: import('vue').PropType<T[K]>;
84
- required: true;
85
- };
86
- };
87
- type __VLS_WithDefaults<P, D> = {
88
- [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
89
- default: D[K];
90
- }> : P[K];
91
- };
92
- type __VLS_Prettify<T> = {
93
- [K in keyof T]: T[K];
94
- } & {};
95
77
  type __VLS_WithTemplateSlots<T, S> = T & {
96
78
  new (): {
97
79
  $slots: S;
@@ -1 +1 @@
1
- export { default as Uplot } from './components/Uplot.vue';
1
+ export { default as Uplot } from './components/uplot.vue';
@@ -13,11 +13,11 @@ type TMerged<T> = [T] extends [Array<any>] ? {
13
13
  interface IObject {
14
14
  [key: string]: any;
15
15
  }
16
- declare const merge: {
17
- <T extends IObject[]>(...objects: T): TMerged<T[number]>;
18
- options: IOptions;
19
- withOptions<T_1 extends IObject[]>(options: Partial<IOptions>, ...objects: T_1): TMerged<T_1[number]>;
20
- };
16
+ declare function merge<T extends IObject[]>(...objects: T): TMerged<T[number]>;
17
+ declare namespace merge {
18
+ var options: IOptions;
19
+ var withOptions: <T extends IObject[]>(options: Partial<IOptions>, ...objects: T) => TMerged<T[number]>;
20
+ }
21
21
  interface IOptions {
22
22
  mergeArrays: boolean;
23
23
  }
@@ -1,2 +1,2 @@
1
- declare const _default: import("vite").UserConfig;
1
+ declare const _default: import('vite').UserConfig;
2
2
  export default _default;
package/package.json CHANGED
@@ -1,59 +1,70 @@
1
1
  {
2
2
  "name": "@flowtools/uplot",
3
3
  "type": "module",
4
- "version": "0.0.10",
4
+ "version": "0.0.12",
5
5
  "description": "Modern vue component for uplot",
6
- "keywords": [
7
- "add keywords"
8
- ],
6
+ "author": "Jukka Raimovaara <roska@mentalhouse.fi> (Mentalhouse Oy)",
7
+ "license": "MIT",
8
+ "funding": "https://github.com/sponsors/flow-tools",
9
9
  "homepage": "https://github.com/flow-tools/uplot",
10
- "bugs": "https://github.com/flow-tools/uplot",
11
- "author": "add author",
12
10
  "repository": {
13
11
  "type": "git",
14
12
  "url": "https://github.com/flow-tools/uplot.git"
15
13
  },
16
- "funding": "https://github.com/sponsors/flow-tools",
17
- "engines": {
18
- "node": ">=16"
19
- },
20
- "packageManager": "pnpm@7.28.0",
14
+ "bugs": "https://github.com/flow-tools/uplot",
15
+ "keywords": [
16
+ "vue",
17
+ "uplot",
18
+ "chart",
19
+ "component"
20
+ ],
21
21
  "exports": {
22
22
  ".": {
23
- "import": "./dist/index.es.js",
24
- "types": "./dist/index.d.ts"
23
+ "types": "./dist/index.d.ts",
24
+ "import": "./dist/index.es.js"
25
25
  },
26
26
  "./dist/style.css": "./dist/style.css"
27
27
  },
28
28
  "main": "./dist/index.es.js",
29
29
  "types": "./dist/index.d.ts",
30
30
  "files": [
31
- "dist",
32
31
  "LICENSE",
33
- "README.md"
32
+ "README.md",
33
+ "dist"
34
34
  ],
35
- "license": "MIT",
35
+ "engines": {
36
+ "node": ">=18"
37
+ },
36
38
  "peerDependencies": {
37
39
  "@vueuse/core": "^9.13.0",
38
40
  "uplot": "^1.6.24",
39
41
  "vue": "=>3.2.47"
40
42
  },
41
43
  "devDependencies": {
42
- "@antfu/eslint-config": "^2.6.3",
43
- "@vitejs/plugin-vue": "^5.0.3",
44
- "@vitest/coverage-c8": "^0.33.0",
45
- "@vue/test-utils": "^2.4.3",
46
- "@vueuse/core": "^10.7.2",
47
- "bumpp": "^9.3.0",
48
- "eslint": "^8.56.0",
49
- "jsdom": "^24.0.0",
50
- "typescript": "^5.3.3",
51
- "uplot": "^1.6.28",
44
+ "@antfu/eslint-config": "^3.11.2",
45
+ "@types/node": "^22.10.1",
46
+ "@vitejs/plugin-vue": "^5.2.1",
47
+ "@vitest/coverage-v8": "^2.1.6",
48
+ "@vue/test-utils": "^2.4.6",
49
+ "@vueuse/core": "^12.0.0",
50
+ "bumpp": "^9.8.1",
51
+ "eslint": "^9.15.0",
52
+ "jsdom": "^25.0.1",
53
+ "lint-staged": "^15.2.10",
54
+ "simple-git-hooks": "^2.11.1",
55
+ "typescript": "^5.7.2",
56
+ "uplot": "^1.6.31",
52
57
  "vi-canvas-mock": "^1.0.0",
53
- "vite": "^5.0.12",
54
- "vite-plugin-dts": "^3.7.2",
55
- "vitest": "^1.2.1",
56
- "vue": "^3.4.15"
58
+ "vite": "^6.0.1",
59
+ "vite-plugin-dts": "^4.3.0",
60
+ "vitest": "^2.1.6",
61
+ "vue": "^3.5.13"
62
+ },
63
+ "simple-git-hooks": {
64
+ "pre-commit": "pnpm lint-staged"
65
+ },
66
+ "lint-staged": {
67
+ "*": "pnpm eslint . --fix"
57
68
  },
58
69
  "publishConfig": {
59
70
  "access": "public"
@@ -66,6 +77,7 @@
66
77
  "lint:fix": "eslint . --fix",
67
78
  "test": "vitest",
68
79
  "test:watch": "vitest --watch",
69
- "coverage": "vitest run --coverage"
80
+ "coverage": "vitest run --coverage",
81
+ "postinstall": "npx simple-git-hooks"
70
82
  }
71
83
  }
File without changes