@flowtools/uplot 0.0.5 → 0.0.7

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
@@ -55,6 +55,7 @@ You can use header and footer slots to add or customize the header and legend. B
55
55
  </template>
56
56
  </Uplot>
57
57
  </template>
58
+ ```
58
59
 
59
60
  ## Interacting with the uplot
60
61
 
package/dist/index.es.js CHANGED
@@ -1,6 +1,6 @@
1
- import { defineComponent as U, ref as k, onMounted as V, watch as b, nextTick as $, openBlock as u, createElementBlock as p, renderSlot as D, unref as f, createElementVNode as g, createTextVNode as P, toDisplayString as h, createCommentVNode as S, Fragment as F, renderList as N, normalizeClass as L, normalizeStyle as j } from "vue";
1
+ import { defineComponent as V, ref as k, onMounted as $, watch as b, nextTick as P, openBlock as u, createElementBlock as p, renderSlot as D, unref as f, createElementVNode as g, createTextVNode as F, toDisplayString as h, createCommentVNode as S, Fragment as N, renderList as U, normalizeClass as L, normalizeStyle as j } from "vue";
2
2
  import M from "uplot";
3
- import { useElementSize as q, useVModel as C } from "@vueuse/core";
3
+ import { useElementSize as R, useVModel as C } from "@vueuse/core";
4
4
  const T = (a) => {
5
5
  if (typeof a == "object" && a !== null) {
6
6
  if (typeof Object.getPrototypeOf == "function") {
@@ -10,13 +10,13 @@ const T = (a) => {
10
10
  return Object.prototype.toString.call(a) === "[object Object]";
11
11
  }
12
12
  return !1;
13
- }, c = (...a) => a.reduce((r, s) => {
14
- if (Array.isArray(s))
13
+ }, c = (...a) => a.reduce((r, l) => {
14
+ if (Array.isArray(l))
15
15
  throw new TypeError(
16
16
  "Arguments provided to ts-deepmerge must be objects, not arrays."
17
17
  );
18
- return s && Object.keys(s).forEach((o) => {
19
- ["__proto__", "constructor", "prototype"].includes(o) || (Array.isArray(r[o]) && Array.isArray(s[o]) ? r[o] = c.options.mergeArrays ? Array.from(new Set(r[o].concat(s[o]))) : s[o] : T(r[o]) && T(s[o]) ? r[o] = c(r[o], s[o]) : r[o] = s[o]);
18
+ return l && Object.keys(l).forEach((o) => {
19
+ ["__proto__", "constructor", "prototype"].includes(o) || (Array.isArray(r[o]) && Array.isArray(l[o]) ? r[o] = c.options.mergeArrays ? Array.from(new Set(r[o].concat(l[o]))) : l[o] : T(r[o]) && T(l[o]) ? r[o] = c(r[o], l[o]) : r[o] = l[o]);
20
20
  }), r;
21
21
  }, {}), B = {
22
22
  mergeArrays: !0
@@ -27,32 +27,32 @@ c.withOptions = (a, ...r) => {
27
27
  mergeArrays: !0,
28
28
  ...a
29
29
  };
30
- const s = c(...r);
31
- return c.options = B, s;
30
+ const l = c(...r);
31
+ return c.options = B, l;
32
32
  };
33
- const G = { class: "__uplot-root" }, H = {
33
+ const q = { class: "__uplot-root" }, G = {
34
34
  key: 0,
35
35
  class: "extra-info"
36
- }, I = /* @__PURE__ */ g("br", null, null, -1), J = { style: { "text-align": "left" } }, K = { class: "__uplot-legend" }, Q = ["onClick"], R = {
36
+ }, H = /* @__PURE__ */ g("br", null, null, -1), I = { style: { "text-align": "left" } }, J = { class: "__uplot-legend" }, K = ["onClick"], Q = {
37
37
  key: 1,
38
38
  class: "__uplot-legend-value"
39
39
  }, W = {
40
40
  key: 2,
41
41
  class: "__uplot-legend-value"
42
- }, oe = /* @__PURE__ */ U({
43
- __name: "Uplot",
42
+ }, oe = /* @__PURE__ */ V({
43
+ __name: "uplot",
44
44
  props: {
45
- options: null,
46
- data: null,
47
- resetScale: { type: Boolean, default: !1 },
45
+ options: {},
46
+ data: {},
47
+ noResetScale: { type: Boolean, default: !1 },
48
48
  showDebug: { type: Boolean, default: !1 },
49
49
  noFooter: { type: Boolean, default: !1 },
50
50
  zoom: { default: () => [null, null] },
51
- series: null
51
+ series: {}
52
52
  },
53
53
  emits: ["select", "cursor", "update:zoom", "update:series"],
54
- setup(a, { expose: r, emit: s }) {
55
- const o = a, v = k(), { width: y, height: w } = q(v), x = C(o, "zoom", s, { passive: !0 }), i = C(o, "series", s, { passive: !0 }), E = {
54
+ setup(a, { expose: r, emit: l }) {
55
+ const o = a, v = k(), { width: y, height: w } = R(v), z = C(o, "zoom", l, { passive: !0 }), i = C(o, "series", l, { passive: !0 }), E = {
56
56
  title: void 0,
57
57
  legend: {
58
58
  show: !1
@@ -60,26 +60,26 @@ const G = { class: "__uplot-root" }, H = {
60
60
  hooks: {
61
61
  init: [
62
62
  (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,
63
+ o.showDebug && console.log("init", e), i.value = e.series.map((s, t) => ({
64
+ label: s.label,
65
+ stroke: typeof s.stroke == "function" ? s.stroke(e, t) : null,
66
66
  value: null,
67
67
  data: null,
68
- show: l.show
68
+ show: s.show
69
69
  // ...s,
70
70
  }));
71
71
  }
72
72
  ],
73
73
  setCursor: [
74
74
  (e) => {
75
- s("cursor", e.cursor), i.value = e.series.map((l, t) => {
75
+ l("cursor", e.cursor), i.value = e.series.map((s, t) => {
76
76
  var d, _;
77
77
  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,
78
+ label: s.label,
79
+ stroke: typeof s.stroke == "function" ? s.stroke(e, t) : null,
80
+ value: e.cursor.idx && e.data[t][e.cursor.idx] ? typeof s.value == "function" ? s.value(e, e.data[t][e.cursor.idx], t, e.cursor.idx) : e.data[t][e.cursor.idx] : null,
81
81
  data: (d = e.cursor) != null && d.idx ? e.data[t][(_ = e.cursor) == null ? void 0 : _.idx] : null,
82
- show: l.show
82
+ show: s.show
83
83
  // ...s,
84
84
  };
85
85
  });
@@ -87,7 +87,7 @@ const G = { class: "__uplot-root" }, H = {
87
87
  ],
88
88
  setSelect: [
89
89
  (e) => {
90
- s("select", e.select), o.showDebug && console.log("setSelect", e.select), x.value = [
90
+ l("select", e.select), o.showDebug && console.log("setSelect", e.select), z.value = [
91
91
  e.posToVal(e.select.left, "x"),
92
92
  e.posToVal(e.select.left + e.select.width, "x")
93
93
  ];
@@ -95,7 +95,7 @@ const G = { class: "__uplot-root" }, H = {
95
95
  ],
96
96
  setScale: [
97
97
  (e) => {
98
- x.value = [
98
+ z.value = [
99
99
  e.scales.x.min || null,
100
100
  e.scales.x.max || null
101
101
  ];
@@ -104,35 +104,35 @@ const G = { class: "__uplot-root" }, H = {
104
104
  }
105
105
  };
106
106
  let n;
107
- const z = k();
107
+ const x = k();
108
108
  function O() {
109
- n && n.destroy(), n = new M({ width: 100, height: 100, ...c(o.options, E) }, o.data, v.value), z.value = n, o.zoom[0] !== null && o.zoom[1] !== null && n.setScale("x", { min: o.zoom[0], max: o.zoom[1] }), setTimeout(() => {
109
+ n && n.destroy(), n = new M({ width: 100, height: 100, ...c(o.options, E) }, o.data, v.value), x.value = n, o.zoom[0] !== null && o.zoom[1] !== null && n.setScale("x", { min: o.zoom[0], max: o.zoom[1] }), setTimeout(() => {
110
110
  A();
111
111
  }, 0);
112
112
  }
113
- V(() => {
113
+ $(() => {
114
114
  O();
115
115
  }), b([y, w], () => {
116
- $(() => {
116
+ P(() => {
117
117
  A();
118
118
  });
119
119
  }), b(o.data, (e) => {
120
- if (o.resetScale) {
120
+ if (o.noResetScale) {
121
121
  n.setData(e);
122
122
  return;
123
123
  }
124
124
  n.setData(e, !0), n.redraw();
125
- }), b(o.options, (e, l) => {
126
- o.showDebug && console.log("watch options", e, l), O();
125
+ }), b(o.options, (e, s) => {
126
+ o.showDebug && console.log("watch options", e, s), O();
127
127
  });
128
128
  function A() {
129
129
  n.setSize({ width: y.value, height: w.value }), o.showDebug && console.log("resize", n);
130
130
  }
131
131
  function m(e) {
132
- var l, t;
133
- typeof e == "object" && (e = ((l = i.value) == null ? void 0 : l.indexOf(e)) || -1), n.setSeries(e, { show: !n.series[e].show }), (t = i.value) != null && t[e] && (i.value[e].show = n.series[e].show);
132
+ var s, t;
133
+ typeof e == "object" && (e = ((s = i.value) == null ? void 0 : s.indexOf(e)) || -1), n.setSeries(e, { show: !n.series[e].show }), (t = i.value) != null && t[e] && (i.value[e].show = n.series[e].show);
134
134
  }
135
- return r({ toggleShow: m, uplot: z }), (e, l) => (u(), p("div", G, [
135
+ return r({ toggleShow: m, uplot: x }), (e, s) => (u(), p("div", q, [
136
136
  D(e.$slots, "header", {
137
137
  series: f(i),
138
138
  toggleShow: m
@@ -142,18 +142,18 @@ const G = { class: "__uplot-root" }, H = {
142
142
  ref: v,
143
143
  class: "__uplot"
144
144
  }, null, 512),
145
- a.showDebug ? (u(), p("div", H, [
146
- P(h(f(y)) + " x " + h(f(w)) + " ", 1),
147
- I,
148
- g("pre", J, h(f(i)), 1)
145
+ e.showDebug ? (u(), p("div", G, [
146
+ F(h(f(y)) + " x " + h(f(w)) + " ", 1),
147
+ H,
148
+ g("pre", I, h(f(i)), 1)
149
149
  ])) : S("", !0),
150
- a.noFooter ? S("", !0) : D(e.$slots, "footer", {
150
+ e.noFooter ? S("", !0) : D(e.$slots, "footer", {
151
151
  key: 1,
152
152
  series: f(i),
153
153
  toggleShow: m
154
154
  }, () => [
155
- g("div", K, [
156
- (u(!0), p(F, null, N(f(i), (t, d) => {
155
+ g("div", J, [
156
+ (u(!0), p(N, null, U(f(i), (t, d) => {
157
157
  var _;
158
158
  return u(), p("div", {
159
159
  key: t.label,
@@ -166,8 +166,8 @@ const G = { class: "__uplot-root" }, H = {
166
166
  style: j({ color: t.stroke || "black" }),
167
167
  class: "__uplot-legend-label"
168
168
  }, h(t.label), 5)) : S("", !0),
169
- t.value ? (u(), p("span", R, h(t.value), 1)) : (u(), p("span", W, "--"))
170
- ], 14, Q);
169
+ t.value ? (u(), p("span", Q, h(t.value), 1)) : (u(), p("span", W, "--"))
170
+ ], 14, K);
171
171
  }), 128))
172
172
  ])
173
173
  ])
package/dist/index.umd.js CHANGED
@@ -1 +1 @@
1
- (function(i,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("uplot"),require("@vueuse/core")):typeof define=="function"&&define.amd?define(["exports","vue","uplot","@vueuse/core"],e):(i=typeof globalThis<"u"?globalThis:i||self,e(i["change-name"]={},i.vue,i.Uplot,i.core))})(this,function(i,e,z,h){"use strict";const U="",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,n)=>{if(Array.isArray(n))throw new TypeError("Arguments provided to ts-deepmerge must be objects, not arrays.");return n&&Object.keys(n).forEach(o=>{["__proto__","constructor","prototype"].includes(o)||(Array.isArray(r[o])&&Array.isArray(n[o])?r[o]=d.options.mergeArrays?Array.from(new Set(r[o].concat(n[o]))):n[o]:w(r[o])&&w(n[o])?r[o]=d(r[o],n[o]):r[o]=n[o])}),r},{}),b={mergeArrays:!0};d.options=b,d.withOptions=(c,...r)=>{d.options={mergeArrays:!0,...c};const n=d(...r);return d.options=b,n};const E={class:"__uplot-root"},O={key:0,class:"extra-info"},D=e.createElementVNode("br",null,null,-1),A={style:{"text-align":"left"}},V={class:"__uplot-legend"},j=["onClick"],C={key:1,class:"__uplot-legend-value"},T={key:2,class:"__uplot-legend-value"},N=e.defineComponent({__name:"Uplot",props:{options:null,data:null,resetScale:{type:Boolean,default:!1},showDebug:{type:Boolean,default:!1},noFooter:{type:Boolean,default:!1},zoom:{default:()=>[null,null]},series:null},emits:["select","cursor","update:zoom","update:series"],setup(c,{expose:r,emit:n}){const o=c,_=e.ref(),{width:g,height:y}=h.useElementSize(_),S=h.useVModel(o,"zoom",n,{passive:!0}),p=h.useVModel(o,"series",n,{passive:!0}),P={title:void 0,legend:{show:!1},hooks:{init:[t=>{o.showDebug&&console.log("init",t),p.value=t.series.map((s,l)=>({label:s.label,stroke:typeof s.stroke=="function"?s.stroke(t,l):null,value:null,data:null,show:s.show}))}],setCursor:[t=>{n("cursor",t.cursor),p.value=t.series.map((s,l)=>{var f,u;return{label:s.label,stroke:typeof s.stroke=="function"?s.stroke(t,l):null,value:t.cursor.idx&&t.data[l][t.cursor.idx]?typeof s.value=="function"?s.value(t,t.data[l][t.cursor.idx],l,t.cursor.idx):t.data[l][t.cursor.idx]:null,data:(f=t.cursor)!=null&&f.idx?t.data[l][(u=t.cursor)==null?void 0:u.idx]:null,show:s.show}})}],setSelect:[t=>{n("select",t.select),o.showDebug&&console.log("setSelect",t.select),S.value=[t.posToVal(t.select.left,"x"),t.posToVal(t.select.left+t.select.width,"x")]}],setScale:[t=>{S.value=[t.scales.x.min||null,t.scales.x.max||null]}]}};let a;const k=e.ref();function B(){a&&a.destroy(),a=new z({width:100,height:100,...d(o.options,P)},o.data,_.value),k.value=a,o.zoom[0]!==null&&o.zoom[1]!==null&&a.setScale("x",{min:o.zoom[0],max:o.zoom[1]}),setTimeout(()=>{x()},0)}e.onMounted(()=>{B()}),e.watch([g,y],()=>{e.nextTick(()=>{x()})}),e.watch(o.data,t=>{if(o.resetScale){a.setData(t);return}a.setData(t,!0),a.redraw()}),e.watch(o.options,(t,s)=>{o.showDebug&&console.log("watch options",t,s),B()});function x(){a.setSize({width:g.value,height:y.value}),o.showDebug&&console.log("resize",a)}function m(t){var s,l;typeof t=="object"&&(t=((s=p.value)==null?void 0:s.indexOf(t))||-1),a.setSeries(t,{show:!a.series[t].show}),(l=p.value)!=null&&l[t]&&(p.value[t].show=a.series[t].show)}return r({toggleShow:m,uplot:k}),(t,s)=>(e.openBlock(),e.createElementBlock("div",E,[e.renderSlot(t.$slots,"header",{series:e.unref(p),toggleShow:m}),e.createElementVNode("div",{ref_key:"el",ref:_,class:"__uplot"},null,512),c.showDebug?(e.openBlock(),e.createElementBlock("div",O,[e.createTextVNode(e.toDisplayString(e.unref(g))+" x "+e.toDisplayString(e.unref(y))+" ",1),D,e.createElementVNode("pre",A,e.toDisplayString(e.unref(p)),1)])):e.createCommentVNode("",!0),c.noFooter?e.createCommentVNode("",!0):e.renderSlot(t.$slots,"footer",{key:1,series:e.unref(p),toggleShow:m},()=>[e.createElementVNode("div",V,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(p),(l,f)=>{var u;return e.openBlock(),e.createElementBlock("div",{key:l.label,class:e.normalizeClass(["__uplot-legend-series",[`__uplot-${(u=l.label)==null?void 0:u.toLowerCase()}`,`__uplot-i-${f}`]]),style:e.normalizeStyle({backgroundColor:l.show?"":"lightgrey"}),onClick:M=>m(f)},[f!==0?(e.openBlock(),e.createElementBlock("span",{key:0,style:e.normalizeStyle({color:l.stroke||"black"}),class:"__uplot-legend-label"},e.toDisplayString(l.label),5)):e.createCommentVNode("",!0),l.value?(e.openBlock(),e.createElementBlock("span",C,e.toDisplayString(l.value),1)):(e.openBlock(),e.createElementBlock("span",T,"--"))],14,j)}),128))])])]))}}),$="";i.Uplot=N,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})});
1
+ (function(i,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("uplot"),require("@vueuse/core")):typeof define=="function"&&define.amd?define(["exports","vue","uplot","@vueuse/core"],e):(i=typeof globalThis<"u"?globalThis:i||self,e(i["change-name"]={},i.vue,i.Uplot,i.core))})(this,function(i,e,x,h){"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,n)=>{if(Array.isArray(n))throw new TypeError("Arguments provided to ts-deepmerge must be objects, not arrays.");return n&&Object.keys(n).forEach(t=>{["__proto__","constructor","prototype"].includes(t)||(Array.isArray(r[t])&&Array.isArray(n[t])?r[t]=d.options.mergeArrays?Array.from(new Set(r[t].concat(n[t]))):n[t]:w(r[t])&&w(n[t])?r[t]=d(r[t],n[t]):r[t]=n[t])}),r},{}),b={mergeArrays:!0};d.options=b,d.withOptions=(c,...r)=>{d.options={mergeArrays:!0,...c};const n=d(...r);return d.options=b,n};const E={class:"__uplot-root"},O={key:0,class:"extra-info"},D=e.createElementVNode("br",null,null,-1),A={style:{"text-align":"left"}},V={class:"__uplot-legend"},j=["onClick"],C={key:1,class:"__uplot-legend-value"},T={key:2,class:"__uplot-legend-value"},N=e.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:n}){const t=c,_=e.ref(),{width:g,height:y}=h.useElementSize(_),S=h.useVModel(t,"zoom",n,{passive:!0}),p=h.useVModel(t,"series",n,{passive:!0}),P={title:void 0,legend:{show:!1},hooks:{init:[o=>{t.showDebug&&console.log("init",o),p.value=o.series.map((s,l)=>({label:s.label,stroke:typeof s.stroke=="function"?s.stroke(o,l):null,value:null,data:null,show:s.show}))}],setCursor:[o=>{n("cursor",o.cursor),p.value=o.series.map((s,l)=>{var f,u;return{label:s.label,stroke:typeof s.stroke=="function"?s.stroke(o,l):null,value:o.cursor.idx&&o.data[l][o.cursor.idx]?typeof s.value=="function"?s.value(o,o.data[l][o.cursor.idx],l,o.cursor.idx):o.data[l][o.cursor.idx]:null,data:(f=o.cursor)!=null&&f.idx?o.data[l][(u=o.cursor)==null?void 0:u.idx]:null,show:s.show}})}],setSelect:[o=>{n("select",o.select),t.showDebug&&console.log("setSelect",o.select),S.value=[o.posToVal(o.select.left,"x"),o.posToVal(o.select.left+o.select.width,"x")]}],setScale:[o=>{S.value=[o.scales.x.min||null,o.scales.x.max||null]}]}};let a;const k=e.ref();function B(){a&&a.destroy(),a=new x({width:100,height:100,...d(t.options,P)},t.data,_.value),k.value=a,t.zoom[0]!==null&&t.zoom[1]!==null&&a.setScale("x",{min:t.zoom[0],max:t.zoom[1]}),setTimeout(()=>{z()},0)}e.onMounted(()=>{B()}),e.watch([g,y],()=>{e.nextTick(()=>{z()})}),e.watch(t.data,o=>{if(t.noResetScale){a.setData(o);return}a.setData(o,!0),a.redraw()}),e.watch(t.options,(o,s)=>{t.showDebug&&console.log("watch options",o,s),B()});function z(){a.setSize({width:g.value,height:y.value}),t.showDebug&&console.log("resize",a)}function m(o){var s,l;typeof o=="object"&&(o=((s=p.value)==null?void 0:s.indexOf(o))||-1),a.setSeries(o,{show:!a.series[o].show}),(l=p.value)!=null&&l[o]&&(p.value[o].show=a.series[o].show)}return r({toggleShow:m,uplot:k}),(o,s)=>(e.openBlock(),e.createElementBlock("div",E,[e.renderSlot(o.$slots,"header",{series:e.unref(p),toggleShow:m}),e.createElementVNode("div",{ref_key:"el",ref:_,class:"__uplot"},null,512),o.showDebug?(e.openBlock(),e.createElementBlock("div",O,[e.createTextVNode(e.toDisplayString(e.unref(g))+" x "+e.toDisplayString(e.unref(y))+" ",1),D,e.createElementVNode("pre",A,e.toDisplayString(e.unref(p)),1)])):e.createCommentVNode("",!0),o.noFooter?e.createCommentVNode("",!0):e.renderSlot(o.$slots,"footer",{key:1,series:e.unref(p),toggleShow:m},()=>[e.createElementVNode("div",V,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(p),(l,f)=>{var u;return e.openBlock(),e.createElementBlock("div",{key:l.label,class:e.normalizeClass(["__uplot-legend-series",[`__uplot-${(u=l.label)==null?void 0:u.toLowerCase()}`,`__uplot-i-${f}`]]),style:e.normalizeStyle({backgroundColor:l.show?"":"lightgrey"}),onClick:q=>m(f)},[f!==0?(e.openBlock(),e.createElementBlock("span",{key:0,style:e.normalizeStyle({color:l.stroke||"black"}),class:"__uplot-legend-label"},e.toDisplayString(l.label),5)):e.createCommentVNode("",!0),l.value?(e.openBlock(),e.createElementBlock("span",C,e.toDisplayString(l.value),1)):(e.openBlock(),e.createElementBlock("span",T,"--"))],14,j)}),128))])])]))}}),M="";i.Uplot=N,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})});
@@ -0,0 +1,119 @@
1
+ import Uplot from 'uplot';
2
+ export type Options = Omit<Uplot.Options, 'height' | 'width'>;
3
+ export type AlignedData = Uplot.AlignedData;
4
+ export interface Series {
5
+ label: string | undefined;
6
+ stroke: string | null;
7
+ value: number | string | null | undefined;
8
+ data: number | null | undefined;
9
+ show: boolean | undefined;
10
+ }
11
+ export type Cursor = Uplot.Cursor;
12
+ export type Select = Uplot.Select;
13
+ export interface UplotElement extends Partial<HTMLElement> {
14
+ toggleShow: (serie: Series | number) => void;
15
+ uplot: Uplot;
16
+ }
17
+ declare function toggleShow(idx: number | Series): void;
18
+ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
19
+ data: {
20
+ type: import("vue").PropType<Uplot.AlignedData>;
21
+ required: true;
22
+ };
23
+ series: {
24
+ type: import("vue").PropType<Series[]>;
25
+ };
26
+ options: {
27
+ type: import("vue").PropType<Options>;
28
+ required: true;
29
+ };
30
+ noResetScale: {
31
+ type: import("vue").PropType<boolean>;
32
+ default: boolean;
33
+ };
34
+ showDebug: {
35
+ type: import("vue").PropType<boolean>;
36
+ default: boolean;
37
+ };
38
+ noFooter: {
39
+ type: import("vue").PropType<boolean>;
40
+ default: boolean;
41
+ };
42
+ zoom: {
43
+ type: import("vue").PropType<number[] | null[]>;
44
+ default: () => null[];
45
+ };
46
+ }, {
47
+ toggleShow: typeof toggleShow;
48
+ uplot: import("vue").Ref<any>;
49
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
50
+ select: (select: Uplot.Select) => void;
51
+ cursor: (cursor: Uplot.Cursor) => void;
52
+ "update:zoom": (zoom: number[]) => void;
53
+ "update:series": (series: Series[]) => void;
54
+ }, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
55
+ data: {
56
+ type: import("vue").PropType<Uplot.AlignedData>;
57
+ required: true;
58
+ };
59
+ series: {
60
+ type: import("vue").PropType<Series[]>;
61
+ };
62
+ options: {
63
+ type: import("vue").PropType<Options>;
64
+ required: true;
65
+ };
66
+ noResetScale: {
67
+ type: import("vue").PropType<boolean>;
68
+ default: boolean;
69
+ };
70
+ showDebug: {
71
+ type: import("vue").PropType<boolean>;
72
+ default: boolean;
73
+ };
74
+ noFooter: {
75
+ type: import("vue").PropType<boolean>;
76
+ default: boolean;
77
+ };
78
+ zoom: {
79
+ type: import("vue").PropType<number[] | null[]>;
80
+ default: () => null[];
81
+ };
82
+ }>> & {
83
+ onSelect?: ((select: Uplot.Select) => any) | undefined;
84
+ onCursor?: ((cursor: Uplot.Cursor) => any) | undefined;
85
+ "onUpdate:zoom"?: ((zoom: number[]) => any) | undefined;
86
+ "onUpdate:series"?: ((series: Series[]) => any) | undefined;
87
+ }, {
88
+ noResetScale: boolean;
89
+ showDebug: boolean;
90
+ noFooter: boolean;
91
+ zoom: number[] | null[];
92
+ }, {}>, {
93
+ header?(_: {
94
+ series: (Series[] & {
95
+ label: string | undefined;
96
+ stroke: string | null;
97
+ value: string | number | null | undefined;
98
+ data: number | null | undefined;
99
+ show: boolean | undefined;
100
+ }[]) | undefined;
101
+ toggleShow: typeof toggleShow;
102
+ }): any;
103
+ footer?(_: {
104
+ series: (Series[] & {
105
+ label: string | undefined;
106
+ stroke: string | null;
107
+ value: string | number | null | undefined;
108
+ data: number | null | undefined;
109
+ show: boolean | undefined;
110
+ }[]) | undefined;
111
+ toggleShow: typeof toggleShow;
112
+ }): any;
113
+ }>;
114
+ export default _default;
115
+ type __VLS_WithTemplateSlots<T, S> = T & {
116
+ new (): {
117
+ $slots: S;
118
+ };
119
+ };
@@ -0,0 +1 @@
1
+ export {};
package/dist/style.css CHANGED
@@ -1 +1 @@
1
- .uplot,.uplot *,.uplot *:before,.uplot *:after{box-sizing:border-box}.uplot{font-family:system-ui,-apple-system,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";line-height:1.5;width:min-content}.u-title{text-align:center;font-size:18px;font-weight:700}.u-wrap{position:relative;user-select:none}.u-over,.u-under{position:absolute}.u-under{overflow:hidden}.uplot canvas{display:block;position:relative;width:100%;height:100%}.u-axis{position:absolute}.u-legend{font-size:14px;margin:auto;text-align:center}.u-inline{display:block}.u-inline *{display:inline-block}.u-inline tr{margin-right:16px}.u-legend th{font-weight:600}.u-legend th>*{vertical-align:middle;display:inline-block}.u-legend .u-marker{width:1em;height:1em;margin-right:4px;background-clip:padding-box!important}.u-inline.u-live th:after{content:":";vertical-align:middle}.u-inline:not(.u-live) .u-value{display:none}.u-series>*{padding:4px}.u-series th{cursor:pointer}.u-legend .u-off>*{opacity:.3}.u-select{background:rgba(0,0,0,.07);position:absolute;pointer-events:none}.u-cursor-x,.u-cursor-y{position:absolute;left:0;top:0;pointer-events:none;will-change:transform;z-index:100}.u-hz .u-cursor-x,.u-vt .u-cursor-y{height:100%;border-right:1px dashed #607D8B}.u-hz .u-cursor-y,.u-vt .u-cursor-x{width:100%;border-bottom:1px dashed #607D8B}.u-cursor-pt{position:absolute;top:0;left:0;border-radius:50%;border:0 solid;pointer-events:none;will-change:transform;z-index:100;background-clip:padding-box!important}.u-axis.u-off,.u-select.u-off,.u-cursor-x.u-off,.u-cursor-y.u-off,.u-cursor-pt.u-off{display:none}.__uplot{flex:1 1 auto;min-height:120px;position:relative}.__uplot-root{display:flex;flex-direction:column;width:100%;height:100%}.__uplot .uplot{position:absolute;top:0;left:0;right:0;bottom:0}.__uplot-legend{display:flex;flex-direction:row;flex-wrap:wrap;justify-content:space-between;align-items:center;align-content:center;padding:.5em;gap:.25em;font-size:10px}.__uplot-legend-series{display:flex;flex-direction:column;flex-wrap:nowrap;justify-content:space-between;align-items:center;align-content:center;padding:5px;background-color:#fff;color:#000;border:1px solid lightgray;border-radius:5px;min-width:6em;min-height:4em}.__uplot-i-0{min-width:12em;justify-content:end}.extra-info{position:absolute;bottom:0;left:0;background-color:#fff;color:#000;padding:5px;border:1px solid black}
1
+ .uplot,.uplot *,.uplot *:before,.uplot *:after{box-sizing:border-box}.uplot{font-family:system-ui,-apple-system,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";line-height:1.5;width:min-content}.u-title{text-align:center;font-size:18px;font-weight:700}.u-wrap{position:relative;-webkit-user-select:none;user-select:none}.u-over,.u-under{position:absolute}.u-under{overflow:hidden}.uplot canvas{display:block;position:relative;width:100%;height:100%}.u-axis{position:absolute}.u-legend{font-size:14px;margin:auto;text-align:center}.u-inline{display:block}.u-inline *{display:inline-block}.u-inline tr{margin-right:16px}.u-legend th{font-weight:600}.u-legend th>*{vertical-align:middle;display:inline-block}.u-legend .u-marker{width:1em;height:1em;margin-right:4px;background-clip:padding-box!important}.u-inline.u-live th:after{content:":";vertical-align:middle}.u-inline:not(.u-live) .u-value{display:none}.u-series>*{padding:4px}.u-series th{cursor:pointer}.u-legend .u-off>*{opacity:.3}.u-select{background:rgba(0,0,0,.07);position:absolute;pointer-events:none}.u-cursor-x,.u-cursor-y{position:absolute;left:0;top:0;pointer-events:none;will-change:transform;z-index:100}.u-hz .u-cursor-x,.u-vt .u-cursor-y{height:100%;border-right:1px dashed #607D8B}.u-hz .u-cursor-y,.u-vt .u-cursor-x{width:100%;border-bottom:1px dashed #607D8B}.u-cursor-pt{position:absolute;top:0;left:0;border-radius:50%;border:0 solid;pointer-events:none;will-change:transform;z-index:100;background-clip:padding-box!important}.u-axis.u-off,.u-select.u-off,.u-cursor-x.u-off,.u-cursor-y.u-off,.u-cursor-pt.u-off{display:none}.__uplot{flex:1 1 auto;min-height:120px;position:relative}.__uplot-root{display:flex;flex-direction:column;width:100%;height:100%}.__uplot .uplot{position:absolute;top:0;left:0;right:0;bottom:0}.__uplot-legend{display:flex;flex-direction:row;flex-wrap:wrap;justify-content:space-between;align-items:center;align-content:center;padding:.5em;gap:.25em;font-size:10px}.__uplot-legend-series{display:flex;flex-direction:column;flex-wrap:nowrap;justify-content:space-between;align-items:center;align-content:center;padding:5px;background-color:#fff;color:#000;border:1px solid lightgray;border-radius:5px;min-width:6em;min-height:4em}.__uplot-i-0{min-width:12em;justify-content:end}.extra-info{position:absolute;bottom:0;left:0;background-color:#fff;color:#000;padding:5px;border:1px solid black}
@@ -0,0 +1 @@
1
+ export {};
File without changes
@@ -0,0 +1,2 @@
1
+ declare const _default: import("vite").UserConfig;
2
+ export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowtools/uplot",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "description": "Modern vue component for uplot",
5
5
  "keywords": [
6
6
  "add keywords"
@@ -38,21 +38,21 @@
38
38
  "vue": "=>3.2.47"
39
39
  },
40
40
  "devDependencies": {
41
- "@antfu/eslint-config": "^0.36.0",
42
- "@vitejs/plugin-vue": "^4.1.0",
43
- "@vitest/coverage-c8": "^0.29.3",
44
- "@vue/test-utils": "^2.3.1",
45
- "@vueuse/core": "^9.13.0",
46
- "bumpp": "^9.0.0",
47
- "eslint": "^8.36.0",
48
- "jsdom": "^21.1.1",
49
- "typescript": "^5.0.2",
41
+ "@antfu/eslint-config": "^0.40.2",
42
+ "@vitejs/plugin-vue": "^4.2.3",
43
+ "@vitest/coverage-c8": "^0.33.0",
44
+ "@vue/test-utils": "^2.4.1",
45
+ "@vueuse/core": "^10.3.0",
46
+ "bumpp": "^9.1.1",
47
+ "eslint": "^8.46.0",
48
+ "jsdom": "^22.1.0",
49
+ "typescript": "^5.1.6",
50
50
  "uplot": "^1.6.24",
51
51
  "vi-canvas-mock": "^1.0.0",
52
- "vite": "^4.2.0",
53
- "vite-plugin-dts": "^2.1.0",
54
- "vitest": "^0.29.3",
55
- "vue": "^3.2.47"
52
+ "vite": "^4.4.9",
53
+ "vite-plugin-dts": "^3.5.1",
54
+ "vitest": "^0.34.1",
55
+ "vue": "^3.3.4"
56
56
  },
57
57
  "publishConfig": {
58
58
  "access": "public"
File without changes
File without changes