vue-chrts 0.0.49 → 0.0.50

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-chrts",
3
- "version": "0.0.49",
3
+ "version": "0.0.50",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"
package/dist/index.cjs DELETED
@@ -1,215 +0,0 @@
1
- (function(global, factory) {
2
- typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("vue"), require("vue/server-renderer"), require("@unovis/ts"), require("@unovis/vue")) : typeof define === "function" && define.amd ? define(["exports", "vue", "vue/server-renderer", "@unovis/ts", "@unovis/vue"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global["vue-chrts"] = {}, global.Vue, global.serverRenderer, global.ts, global.vue$1));
3
- })(this, function(exports2, vue, serverRenderer, ts, vue$1) {
4
- "use strict";
5
- const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
6
- __name: "Area",
7
- __ssrInlineRender: true,
8
- props: {
9
- data: {},
10
- height: {},
11
- xLabel: {},
12
- yLabel: {},
13
- categories: {},
14
- xFormatter: {},
15
- yFormatter: {},
16
- curveType: {},
17
- xNumTicks: { default: (props) => props.data.length > 24 ? 24 / 4 : props.data.length - 1 },
18
- yNumTicks: { default: (props) => props.data.length > 24 ? 24 / 4 : props.data.length - 1 },
19
- hideLegend: { type: Boolean },
20
- hideTooltip: { type: Boolean },
21
- gridLineX: { type: Boolean },
22
- domainLineX: { type: Boolean },
23
- gridLineY: { type: Boolean },
24
- domainLineY: { type: Boolean },
25
- paginationPoisition: {}
26
- },
27
- setup(__props) {
28
- const props = __props;
29
- const colors = Object.values(props.categories).map((c) => c.color);
30
- function accessors(id) {
31
- var _a;
32
- return {
33
- y: (d) => Number(d[id]),
34
- color: ((_a = props.categories[id]) == null ? void 0 : _a.color) ?? "#3b82f6"
35
- };
36
- }
37
- const svgDefs = colors.map(
38
- (color, index) => `
39
- <linearGradient id="gradient${index}-${color}" gradientTransform="rotate(90)">
40
- <stop offset="0%" stop-color="${color}" stop-opacity="1" />
41
- <stop offset="100%" stop-color="${color}" stop-opacity="0" />
42
- </linearGradient>
43
- `
44
- ).join("");
45
- return (_ctx, _push, _parent, _attrs) => {
46
- _push(`<div${serverRenderer.ssrRenderAttrs(vue.mergeProps({
47
- class: ["flex flex-col space-y-4", {
48
- "flex-col-reverse": props.paginationPoisition === "top"
49
- }]
50
- }, _attrs))}>`);
51
- _push(serverRenderer.ssrRenderComponent(vue.unref(vue$1.VisXYContainer), {
52
- data: _ctx.data,
53
- height: _ctx.height,
54
- "svg-defs": vue.unref(svgDefs)
55
- }, {
56
- default: vue.withCtx((_, _push2, _parent2, _scopeId) => {
57
- if (_push2) {
58
- if (!_ctx.hideTooltip) {
59
- _push2(serverRenderer.ssrRenderComponent(vue.unref(vue$1.VisTooltip), {
60
- "horizontal-placement": vue.unref(ts.Position).Right,
61
- "vertical-placement": vue.unref(ts.Position).Top
62
- }, null, _parent2, _scopeId));
63
- } else {
64
- _push2(`<!---->`);
65
- }
66
- _push2(`<!--[-->`);
67
- serverRenderer.ssrRenderList(Object.keys(props.categories), (i, iKey) => {
68
- _push2(`<!--[-->`);
69
- _push2(serverRenderer.ssrRenderComponent(vue.unref(vue$1.VisArea), vue.mergeProps({
70
- x: (_2, i2) => i2,
71
- ref_for: true
72
- }, accessors(i), {
73
- color: `url(#gradient${iKey}-${vue.unref(colors)[iKey]})`,
74
- opacity: 0.5,
75
- "curve-type": _ctx.curveType ?? vue.unref(ts.CurveType).MonotoneX
76
- }), null, _parent2, _scopeId));
77
- _push2(serverRenderer.ssrRenderComponent(vue.unref(vue$1.VisLine), {
78
- x: (_2, i2) => i2,
79
- y: (d) => d[i],
80
- color: vue.unref(colors)[iKey],
81
- "curve-type": _ctx.curveType ?? vue.unref(ts.CurveType).MonotoneX
82
- }, null, _parent2, _scopeId));
83
- _push2(`<!--]-->`);
84
- });
85
- _push2(`<!--]-->`);
86
- _push2(serverRenderer.ssrRenderComponent(vue.unref(vue$1.VisAxis), {
87
- type: "x",
88
- "tick-format": _ctx.xFormatter,
89
- "num-ticks": _ctx.xNumTicks,
90
- label: _ctx.xLabel,
91
- "grid-line": _ctx.gridLineX,
92
- "domain-line": _ctx.domainLineX,
93
- "tick-line": !!_ctx.gridLineX
94
- }, null, _parent2, _scopeId));
95
- _push2(serverRenderer.ssrRenderComponent(vue.unref(vue$1.VisAxis), {
96
- type: "y",
97
- "num-ticks": _ctx.yNumTicks ?? _ctx.data.length,
98
- "tick-format": _ctx.yFormatter,
99
- label: _ctx.yLabel,
100
- "grid-line": _ctx.gridLineY,
101
- "domain-line": _ctx.domainLineY,
102
- "tick-line": !!_ctx.gridLineY
103
- }, null, _parent2, _scopeId));
104
- } else {
105
- return [
106
- !_ctx.hideTooltip ? (vue.openBlock(), vue.createBlock(vue.unref(vue$1.VisTooltip), {
107
- key: 0,
108
- "horizontal-placement": vue.unref(ts.Position).Right,
109
- "vertical-placement": vue.unref(ts.Position).Top
110
- }, null, 8, ["horizontal-placement", "vertical-placement"])) : vue.createCommentVNode("", true),
111
- (vue.openBlock(true), vue.createBlock(vue.Fragment, null, vue.renderList(Object.keys(props.categories), (i, iKey) => {
112
- return vue.openBlock(), vue.createBlock(vue.Fragment, { key: iKey }, [
113
- vue.createVNode(vue.unref(vue$1.VisArea), vue.mergeProps({
114
- x: (_2, i2) => i2,
115
- ref_for: true
116
- }, accessors(i), {
117
- color: `url(#gradient${iKey}-${vue.unref(colors)[iKey]})`,
118
- opacity: 0.5,
119
- "curve-type": _ctx.curveType ?? vue.unref(ts.CurveType).MonotoneX
120
- }), null, 16, ["x", "color", "curve-type"]),
121
- vue.createVNode(vue.unref(vue$1.VisLine), {
122
- x: (_2, i2) => i2,
123
- y: (d) => d[i],
124
- color: vue.unref(colors)[iKey],
125
- "curve-type": _ctx.curveType ?? vue.unref(ts.CurveType).MonotoneX
126
- }, null, 8, ["x", "y", "color", "curve-type"])
127
- ], 64);
128
- }), 128)),
129
- vue.createVNode(vue.unref(vue$1.VisAxis), {
130
- type: "x",
131
- "tick-format": _ctx.xFormatter,
132
- "num-ticks": _ctx.xNumTicks,
133
- label: _ctx.xLabel,
134
- "grid-line": _ctx.gridLineX,
135
- "domain-line": _ctx.domainLineX,
136
- "tick-line": !!_ctx.gridLineX
137
- }, null, 8, ["tick-format", "num-ticks", "label", "grid-line", "domain-line", "tick-line"]),
138
- vue.createVNode(vue.unref(vue$1.VisAxis), {
139
- type: "y",
140
- "num-ticks": _ctx.yNumTicks ?? _ctx.data.length,
141
- "tick-format": _ctx.yFormatter,
142
- label: _ctx.yLabel,
143
- "grid-line": _ctx.gridLineY,
144
- "domain-line": _ctx.domainLineY,
145
- "tick-line": !!_ctx.gridLineY
146
- }, null, 8, ["num-ticks", "tick-format", "label", "grid-line", "domain-line", "tick-line"])
147
- ];
148
- }
149
- }),
150
- _: 1
151
- }, _parent));
152
- if (!_ctx.hideLegend) {
153
- _push(`<div class="flex items center justify-end">`);
154
- _push(serverRenderer.ssrRenderComponent(vue.unref(vue$1.VisBulletLegend), {
155
- items: Object.values(_ctx.categories)
156
- }, null, _parent));
157
- _push(`</div>`);
158
- } else {
159
- _push(`<!---->`);
160
- }
161
- _push(`</div>`);
162
- };
163
- }
164
- });
165
- const _sfc_setup$1 = _sfc_main$1.setup;
166
- _sfc_main$1.setup = (props, ctx) => {
167
- const ssrContext = vue.useSSRContext();
168
- (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/Area/Area.vue");
169
- return _sfc_setup$1 ? _sfc_setup$1(props, ctx) : void 0;
170
- };
171
- var PaginationPosition = /* @__PURE__ */ ((PaginationPosition2) => {
172
- PaginationPosition2["Top"] = "top";
173
- PaginationPosition2["Bottom"] = "bottom";
174
- return PaginationPosition2;
175
- })(PaginationPosition || {});
176
- const _sfc_main = /* @__PURE__ */ vue.defineComponent({
177
- __name: "Button",
178
- __ssrInlineRender: true,
179
- props: {
180
- variant: {},
181
- size: {}
182
- },
183
- setup(__props) {
184
- return (_ctx, _push, _parent, _attrs) => {
185
- _push(`<button${serverRenderer.ssrRenderAttrs(vue.mergeProps({
186
- class: [
187
- "button",
188
- `button--${_ctx.variant || "primary"}`,
189
- `button--${_ctx.size || "medium"}`
190
- ]
191
- }, _attrs))} data-v-52b6ec0c>`);
192
- serverRenderer.ssrRenderSlot(_ctx.$slots, "default", {}, null, _push, _parent);
193
- _push(`</button>`);
194
- };
195
- }
196
- });
197
- const _export_sfc = (sfc, props) => {
198
- const target = sfc.__vccOpts || sfc;
199
- for (const [key, val] of props) {
200
- target[key] = val;
201
- }
202
- return target;
203
- };
204
- const _sfc_setup = _sfc_main.setup;
205
- _sfc_main.setup = (props, ctx) => {
206
- const ssrContext = vue.useSSRContext();
207
- (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/Button/Button.vue");
208
- return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
209
- };
210
- const Button = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-52b6ec0c"]]);
211
- exports2.Area = _sfc_main$1;
212
- exports2.Button = Button;
213
- exports2.PaginationPosition = PaginationPosition;
214
- Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
215
- });
package/dist/index.js DELETED
@@ -1,215 +0,0 @@
1
- import { defineComponent, mergeProps, unref, withCtx, createBlock, createCommentVNode, createVNode, openBlock, Fragment, renderList, useSSRContext } from "vue";
2
- import { ssrRenderAttrs, ssrRenderComponent, ssrRenderList, ssrRenderSlot } from "vue/server-renderer";
3
- import { Position, CurveType } from "@unovis/ts";
4
- import { VisXYContainer, VisTooltip, VisArea, VisLine, VisAxis, VisBulletLegend } from "@unovis/vue";
5
- const _sfc_main$1 = /* @__PURE__ */ defineComponent({
6
- __name: "Area",
7
- __ssrInlineRender: true,
8
- props: {
9
- data: {},
10
- height: {},
11
- xLabel: {},
12
- yLabel: {},
13
- categories: {},
14
- xFormatter: {},
15
- yFormatter: {},
16
- curveType: {},
17
- xNumTicks: { default: (props) => props.data.length > 24 ? 24 / 4 : props.data.length - 1 },
18
- yNumTicks: { default: (props) => props.data.length > 24 ? 24 / 4 : props.data.length - 1 },
19
- hideLegend: { type: Boolean },
20
- hideTooltip: { type: Boolean },
21
- gridLineX: { type: Boolean },
22
- domainLineX: { type: Boolean },
23
- gridLineY: { type: Boolean },
24
- domainLineY: { type: Boolean },
25
- paginationPoisition: {}
26
- },
27
- setup(__props) {
28
- const props = __props;
29
- const colors = Object.values(props.categories).map((c) => c.color);
30
- function accessors(id) {
31
- var _a;
32
- return {
33
- y: (d) => Number(d[id]),
34
- color: ((_a = props.categories[id]) == null ? void 0 : _a.color) ?? "#3b82f6"
35
- };
36
- }
37
- const svgDefs = colors.map(
38
- (color, index) => `
39
- <linearGradient id="gradient${index}-${color}" gradientTransform="rotate(90)">
40
- <stop offset="0%" stop-color="${color}" stop-opacity="1" />
41
- <stop offset="100%" stop-color="${color}" stop-opacity="0" />
42
- </linearGradient>
43
- `
44
- ).join("");
45
- return (_ctx, _push, _parent, _attrs) => {
46
- _push(`<div${ssrRenderAttrs(mergeProps({
47
- class: ["flex flex-col space-y-4", {
48
- "flex-col-reverse": props.paginationPoisition === "top"
49
- }]
50
- }, _attrs))}>`);
51
- _push(ssrRenderComponent(unref(VisXYContainer), {
52
- data: _ctx.data,
53
- height: _ctx.height,
54
- "svg-defs": unref(svgDefs)
55
- }, {
56
- default: withCtx((_, _push2, _parent2, _scopeId) => {
57
- if (_push2) {
58
- if (!_ctx.hideTooltip) {
59
- _push2(ssrRenderComponent(unref(VisTooltip), {
60
- "horizontal-placement": unref(Position).Right,
61
- "vertical-placement": unref(Position).Top
62
- }, null, _parent2, _scopeId));
63
- } else {
64
- _push2(`<!---->`);
65
- }
66
- _push2(`<!--[-->`);
67
- ssrRenderList(Object.keys(props.categories), (i, iKey) => {
68
- _push2(`<!--[-->`);
69
- _push2(ssrRenderComponent(unref(VisArea), mergeProps({
70
- x: (_2, i2) => i2,
71
- ref_for: true
72
- }, accessors(i), {
73
- color: `url(#gradient${iKey}-${unref(colors)[iKey]})`,
74
- opacity: 0.5,
75
- "curve-type": _ctx.curveType ?? unref(CurveType).MonotoneX
76
- }), null, _parent2, _scopeId));
77
- _push2(ssrRenderComponent(unref(VisLine), {
78
- x: (_2, i2) => i2,
79
- y: (d) => d[i],
80
- color: unref(colors)[iKey],
81
- "curve-type": _ctx.curveType ?? unref(CurveType).MonotoneX
82
- }, null, _parent2, _scopeId));
83
- _push2(`<!--]-->`);
84
- });
85
- _push2(`<!--]-->`);
86
- _push2(ssrRenderComponent(unref(VisAxis), {
87
- type: "x",
88
- "tick-format": _ctx.xFormatter,
89
- "num-ticks": _ctx.xNumTicks,
90
- label: _ctx.xLabel,
91
- "grid-line": _ctx.gridLineX,
92
- "domain-line": _ctx.domainLineX,
93
- "tick-line": !!_ctx.gridLineX
94
- }, null, _parent2, _scopeId));
95
- _push2(ssrRenderComponent(unref(VisAxis), {
96
- type: "y",
97
- "num-ticks": _ctx.yNumTicks ?? _ctx.data.length,
98
- "tick-format": _ctx.yFormatter,
99
- label: _ctx.yLabel,
100
- "grid-line": _ctx.gridLineY,
101
- "domain-line": _ctx.domainLineY,
102
- "tick-line": !!_ctx.gridLineY
103
- }, null, _parent2, _scopeId));
104
- } else {
105
- return [
106
- !_ctx.hideTooltip ? (openBlock(), createBlock(unref(VisTooltip), {
107
- key: 0,
108
- "horizontal-placement": unref(Position).Right,
109
- "vertical-placement": unref(Position).Top
110
- }, null, 8, ["horizontal-placement", "vertical-placement"])) : createCommentVNode("", true),
111
- (openBlock(true), createBlock(Fragment, null, renderList(Object.keys(props.categories), (i, iKey) => {
112
- return openBlock(), createBlock(Fragment, { key: iKey }, [
113
- createVNode(unref(VisArea), mergeProps({
114
- x: (_2, i2) => i2,
115
- ref_for: true
116
- }, accessors(i), {
117
- color: `url(#gradient${iKey}-${unref(colors)[iKey]})`,
118
- opacity: 0.5,
119
- "curve-type": _ctx.curveType ?? unref(CurveType).MonotoneX
120
- }), null, 16, ["x", "color", "curve-type"]),
121
- createVNode(unref(VisLine), {
122
- x: (_2, i2) => i2,
123
- y: (d) => d[i],
124
- color: unref(colors)[iKey],
125
- "curve-type": _ctx.curveType ?? unref(CurveType).MonotoneX
126
- }, null, 8, ["x", "y", "color", "curve-type"])
127
- ], 64);
128
- }), 128)),
129
- createVNode(unref(VisAxis), {
130
- type: "x",
131
- "tick-format": _ctx.xFormatter,
132
- "num-ticks": _ctx.xNumTicks,
133
- label: _ctx.xLabel,
134
- "grid-line": _ctx.gridLineX,
135
- "domain-line": _ctx.domainLineX,
136
- "tick-line": !!_ctx.gridLineX
137
- }, null, 8, ["tick-format", "num-ticks", "label", "grid-line", "domain-line", "tick-line"]),
138
- createVNode(unref(VisAxis), {
139
- type: "y",
140
- "num-ticks": _ctx.yNumTicks ?? _ctx.data.length,
141
- "tick-format": _ctx.yFormatter,
142
- label: _ctx.yLabel,
143
- "grid-line": _ctx.gridLineY,
144
- "domain-line": _ctx.domainLineY,
145
- "tick-line": !!_ctx.gridLineY
146
- }, null, 8, ["num-ticks", "tick-format", "label", "grid-line", "domain-line", "tick-line"])
147
- ];
148
- }
149
- }),
150
- _: 1
151
- }, _parent));
152
- if (!_ctx.hideLegend) {
153
- _push(`<div class="flex items center justify-end">`);
154
- _push(ssrRenderComponent(unref(VisBulletLegend), {
155
- items: Object.values(_ctx.categories)
156
- }, null, _parent));
157
- _push(`</div>`);
158
- } else {
159
- _push(`<!---->`);
160
- }
161
- _push(`</div>`);
162
- };
163
- }
164
- });
165
- const _sfc_setup$1 = _sfc_main$1.setup;
166
- _sfc_main$1.setup = (props, ctx) => {
167
- const ssrContext = useSSRContext();
168
- (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/Area/Area.vue");
169
- return _sfc_setup$1 ? _sfc_setup$1(props, ctx) : void 0;
170
- };
171
- var PaginationPosition = /* @__PURE__ */ ((PaginationPosition2) => {
172
- PaginationPosition2["Top"] = "top";
173
- PaginationPosition2["Bottom"] = "bottom";
174
- return PaginationPosition2;
175
- })(PaginationPosition || {});
176
- const _sfc_main = /* @__PURE__ */ defineComponent({
177
- __name: "Button",
178
- __ssrInlineRender: true,
179
- props: {
180
- variant: {},
181
- size: {}
182
- },
183
- setup(__props) {
184
- return (_ctx, _push, _parent, _attrs) => {
185
- _push(`<button${ssrRenderAttrs(mergeProps({
186
- class: [
187
- "button",
188
- `button--${_ctx.variant || "primary"}`,
189
- `button--${_ctx.size || "medium"}`
190
- ]
191
- }, _attrs))} data-v-52b6ec0c>`);
192
- ssrRenderSlot(_ctx.$slots, "default", {}, null, _push, _parent);
193
- _push(`</button>`);
194
- };
195
- }
196
- });
197
- const _export_sfc = (sfc, props) => {
198
- const target = sfc.__vccOpts || sfc;
199
- for (const [key, val] of props) {
200
- target[key] = val;
201
- }
202
- return target;
203
- };
204
- const _sfc_setup = _sfc_main.setup;
205
- _sfc_main.setup = (props, ctx) => {
206
- const ssrContext = useSSRContext();
207
- (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("src/components/Button/Button.vue");
208
- return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
209
- };
210
- const Button = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-52b6ec0c"]]);
211
- export {
212
- _sfc_main$1 as Area,
213
- Button,
214
- PaginationPosition
215
- };