@flowtools/uplot 0.0.10 → 0.0.11
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/dist/index.es.js +15 -11
- package/dist/index.umd.js +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/utils/deepmerge.d.ts +5 -5
- package/package.json +30 -18
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
2
|
import q from "uplot";
|
|
3
3
|
import { useElementSize as G, useVModel as T } from "@vueuse/core";
|
|
4
|
-
|
|
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
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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;
|
|
@@ -124,7 +128,7 @@ const H = { class: "__uplot-root" }, I = {
|
|
|
124
128
|
s.setData(e, !0);
|
|
125
129
|
}), v(o.options, (e, l) => {
|
|
126
130
|
o.showDebug && console.log("watch options", e, l), A();
|
|
127
|
-
}), v(() => o.zoom, (e
|
|
131
|
+
}), v(() => o.zoom, (e) => {
|
|
128
132
|
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] }));
|
|
129
133
|
});
|
|
130
134
|
function k() {
|
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";
|
|
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";function 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}function f(...c){return 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]=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=(c,...r)=>{f.options={mergeArrays:!0,...c};const a=f(...r);return f.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"},$={key:2,class:"__uplot-legend-value"},M=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}),P={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 d,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:(d=e.cursor)!=null&&d.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,...f(t.options,P)},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=>{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,d)=>{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-${d}`]]),style:o.normalizeStyle({backgroundColor:l.show?"":"lightgrey"}),onClick:V=>u(d)},[d!==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",$,"--"))],14,T)}),128))])])]))}});i.Uplot=M,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})});
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default as Uplot } from './components/
|
|
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
|
|
17
|
-
|
|
18
|
-
options: IOptions;
|
|
19
|
-
withOptions<
|
|
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
|
}
|
package/package.json
CHANGED
|
@@ -1,38 +1,41 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flowtools/uplot",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.11",
|
|
5
|
+
"packageManager": "pnpm@8.14.0",
|
|
5
6
|
"description": "Modern vue component for uplot",
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
"author": "Jukka Raimovaara <roska@mentalhouse.fi> (Mentalhouse Oy)",
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"funding": "https://github.com/sponsors/flow-tools",
|
|
9
10
|
"homepage": "https://github.com/flow-tools/uplot",
|
|
10
|
-
"bugs": "https://github.com/flow-tools/uplot",
|
|
11
|
-
"author": "add author",
|
|
12
11
|
"repository": {
|
|
13
12
|
"type": "git",
|
|
14
13
|
"url": "https://github.com/flow-tools/uplot.git"
|
|
15
14
|
},
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
"bugs": "https://github.com/flow-tools/uplot",
|
|
16
|
+
"keywords": [
|
|
17
|
+
"vue",
|
|
18
|
+
"uplot",
|
|
19
|
+
"chart",
|
|
20
|
+
"component"
|
|
21
|
+
],
|
|
21
22
|
"exports": {
|
|
22
23
|
".": {
|
|
23
|
-
"
|
|
24
|
-
"
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"import": "./dist/index.es.js"
|
|
25
26
|
},
|
|
26
27
|
"./dist/style.css": "./dist/style.css"
|
|
27
28
|
},
|
|
28
29
|
"main": "./dist/index.es.js",
|
|
29
30
|
"types": "./dist/index.d.ts",
|
|
30
31
|
"files": [
|
|
31
|
-
"dist",
|
|
32
32
|
"LICENSE",
|
|
33
|
-
"README.md"
|
|
33
|
+
"README.md",
|
|
34
|
+
"dist"
|
|
34
35
|
],
|
|
35
|
-
"
|
|
36
|
+
"engines": {
|
|
37
|
+
"node": ">=18"
|
|
38
|
+
},
|
|
36
39
|
"peerDependencies": {
|
|
37
40
|
"@vueuse/core": "^9.13.0",
|
|
38
41
|
"uplot": "^1.6.24",
|
|
@@ -41,12 +44,14 @@
|
|
|
41
44
|
"devDependencies": {
|
|
42
45
|
"@antfu/eslint-config": "^2.6.3",
|
|
43
46
|
"@vitejs/plugin-vue": "^5.0.3",
|
|
44
|
-
"@vitest/coverage-
|
|
47
|
+
"@vitest/coverage-v8": "^1.2.1",
|
|
45
48
|
"@vue/test-utils": "^2.4.3",
|
|
46
49
|
"@vueuse/core": "^10.7.2",
|
|
47
50
|
"bumpp": "^9.3.0",
|
|
48
51
|
"eslint": "^8.56.0",
|
|
49
52
|
"jsdom": "^24.0.0",
|
|
53
|
+
"lint-staged": "^15.2.0",
|
|
54
|
+
"simple-git-hooks": "^2.9.0",
|
|
50
55
|
"typescript": "^5.3.3",
|
|
51
56
|
"uplot": "^1.6.28",
|
|
52
57
|
"vi-canvas-mock": "^1.0.0",
|
|
@@ -55,6 +60,12 @@
|
|
|
55
60
|
"vitest": "^1.2.1",
|
|
56
61
|
"vue": "^3.4.15"
|
|
57
62
|
},
|
|
63
|
+
"simple-git-hooks": {
|
|
64
|
+
"pre-commit": "pnpm lint-staged"
|
|
65
|
+
},
|
|
66
|
+
"lint-staged": {
|
|
67
|
+
"*": "pnpm eslint . --fix"
|
|
68
|
+
},
|
|
58
69
|
"publishConfig": {
|
|
59
70
|
"access": "public"
|
|
60
71
|
},
|
|
@@ -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
|
}
|