@chelone/vue 0.4.0 → 0.6.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 (58) hide show
  1. package/README.md +1 -0
  2. package/dist/admin/admin-shell.vue.js +1 -1
  3. package/dist/components/admin/auth/auth-callback.vue.js +1 -1
  4. package/dist/components/admin/auth/login-form.vue.js +1 -1
  5. package/dist/components/admin/auth/login-with-email.vue.js +1 -1
  6. package/dist/components/admin/feedback/loading-indicator.vue.js +1 -1
  7. package/dist/components/admin/feedback/spinner.vue.js +1 -1
  8. package/dist/components/admin/fields/api-key-field.vue.d.ts +1 -1
  9. package/dist/components/admin/fields/api-key-field.vue.js +2 -12
  10. package/dist/components/admin/fields/select-field.vue.d.ts +17 -6
  11. package/dist/components/admin/fields/select-field.vue.js +1 -1
  12. package/dist/components/admin/inputs/checkbox-group-input.vue.d.ts +14 -7
  13. package/dist/components/admin/inputs/checkbox-group-input.vue.js +2 -2
  14. package/dist/components/admin/inputs/datagrid-input.vue.d.ts +20 -5
  15. package/dist/components/admin/inputs/datagrid-input.vue.js +7 -3
  16. package/dist/components/admin/inputs/radio-button-group-input.vue.d.ts +14 -7
  17. package/dist/components/admin/inputs/radio-button-group-input.vue.js +2 -2
  18. package/dist/components/admin/list/count-spinner.vue.js +1 -1
  19. package/dist/components/admin/supabase/forgot-password-form.vue.js +1 -1
  20. package/dist/components/admin/supabase/set-password-form.vue.js +1 -1
  21. package/dist/components/index.d.ts +0 -2
  22. package/dist/components/kanban/kanban-board.vue.js +260 -0
  23. package/dist/components/kanban/kanban-draggable-card.vue.d.ts +18 -0
  24. package/dist/components/kanban/kanban-draggable-card.vue.js +32 -0
  25. package/dist/components/kanban/kanban-draggable-card2.vue.js +4 -0
  26. package/dist/components/kanban/kanban-drop-area.vue.d.ts +15 -0
  27. package/dist/components/kanban/kanban-drop-area.vue.js +29 -0
  28. package/dist/components/kanban/kanban-drop-area2.vue.js +4 -0
  29. package/dist/components/maps-osm/osm-feature-operator.vue.js +1 -1
  30. package/dist/components/ui/chart/chart-container.vue.d.ts +18 -0
  31. package/dist/components/ui/chart/chart-container.vue.js +40 -0
  32. package/dist/components/ui/chart/chart-container2.vue.js +4 -0
  33. package/dist/components/ui/chart/chart-legend-content.vue.d.ts +9 -0
  34. package/dist/components/ui/chart/chart-legend-content.vue.js +56 -0
  35. package/dist/components/ui/chart/chart-legend-content2.vue.js +4 -0
  36. package/dist/components/ui/chart/chart-style.vue.d.ts +7 -0
  37. package/dist/components/ui/chart/chart-style.vue.js +43 -0
  38. package/dist/components/ui/chart/chart-style2.vue.js +4 -0
  39. package/dist/components/ui/chart/chart-tooltip-content.vue.d.ts +7 -0
  40. package/dist/components/ui/chart/chart-tooltip-content.vue.js +122 -0
  41. package/dist/components/ui/chart/chart-tooltip-content2.vue.js +4 -0
  42. package/dist/components/ui/chart/index.d.ts +11 -0
  43. package/dist/components/ui/chart/utils.d.ts +81 -0
  44. package/dist/components/ui/chart/utils.js +52 -0
  45. package/dist/components/ui/index.d.ts +1 -0
  46. package/dist/components/ui/spinner.vue.js +1 -29
  47. package/dist/components/ui/spinner2.vue.js +29 -1
  48. package/dist/create-resource-components.d.ts +142 -18
  49. package/dist/data/create-chelone-hooks.d.ts +2 -1
  50. package/dist/data/queries.d.ts +6 -3
  51. package/dist/data/queries.js +8 -4
  52. package/dist/index.js +398 -387
  53. package/dist/kanban.d.ts +1 -0
  54. package/dist/kanban.js +4 -0
  55. package/package.json +18 -4
  56. package/dist/components/admin/list/kanban-board.vue.js +0 -275
  57. /package/dist/components/{admin/list → kanban}/kanban-board.vue.d.ts +0 -0
  58. /package/dist/components/{admin/list → kanban}/kanban-board2.vue.js +0 -0
@@ -0,0 +1,32 @@
1
+ import { defineComponent, ref, openBlock, createElementBlock, unref, renderSlot } from "vue";
2
+ import { useDraggable } from "@dnd-kit/vue";
3
+ const _hoisted_1 = ["data-dragging", "data-draggable"];
4
+ const _sfc_main = /* @__PURE__ */ defineComponent({
5
+ __name: "kanban-draggable-card",
6
+ props: {
7
+ id: {},
8
+ draggable: { type: Boolean }
9
+ },
10
+ setup(__props) {
11
+ const props = __props;
12
+ const element = ref();
13
+ const { isDragging } = useDraggable({
14
+ id: () => props.id,
15
+ element,
16
+ disabled: () => !props.draggable
17
+ });
18
+ return (_ctx, _cache) => {
19
+ return openBlock(), createElementBlock("div", {
20
+ ref_key: "element",
21
+ ref: element,
22
+ "data-dragging": unref(isDragging) ? "" : void 0,
23
+ "data-draggable": __props.draggable ? "" : void 0
24
+ }, [
25
+ renderSlot(_ctx.$slots, "default")
26
+ ], 8, _hoisted_1);
27
+ };
28
+ }
29
+ });
30
+ export {
31
+ _sfc_main as default
32
+ };
@@ -0,0 +1,4 @@
1
+ import _sfc_main from "./kanban-draggable-card.vue.js";
2
+ export {
3
+ _sfc_main as default
4
+ };
@@ -0,0 +1,15 @@
1
+ type __VLS_Props = {
2
+ columnId: string;
3
+ };
4
+ declare var __VLS_1: {};
5
+ type __VLS_Slots = {} & {
6
+ default?: (props: typeof __VLS_1) => any;
7
+ };
8
+ declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
9
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
10
+ export default _default;
11
+ type __VLS_WithSlots<T, S> = T & {
12
+ new (): {
13
+ $slots: S;
14
+ };
15
+ };
@@ -0,0 +1,29 @@
1
+ import { defineComponent, ref, openBlock, createElementBlock, unref, renderSlot } from "vue";
2
+ import { useDroppable } from "@dnd-kit/vue";
3
+ const _hoisted_1 = ["data-over"];
4
+ const _sfc_main = /* @__PURE__ */ defineComponent({
5
+ __name: "kanban-drop-area",
6
+ props: {
7
+ columnId: {}
8
+ },
9
+ setup(__props) {
10
+ const props = __props;
11
+ const element = ref();
12
+ const { isDropTarget } = useDroppable({
13
+ id: () => props.columnId,
14
+ element
15
+ });
16
+ return (_ctx, _cache) => {
17
+ return openBlock(), createElementBlock("div", {
18
+ ref_key: "element",
19
+ ref: element,
20
+ "data-over": unref(isDropTarget) ? "" : void 0
21
+ }, [
22
+ renderSlot(_ctx.$slots, "default")
23
+ ], 8, _hoisted_1);
24
+ };
25
+ }
26
+ });
27
+ export {
28
+ _sfc_main as default
29
+ };
@@ -0,0 +1,4 @@
1
+ import _sfc_main from "./kanban-drop-area.vue.js";
2
+ export {
3
+ _sfc_main as default
4
+ };
@@ -6,7 +6,7 @@ import { useTranslate } from "../../i18n/use-translate.js";
6
6
  import { useNotify } from "../../notification-hooks.js";
7
7
  import { useMapsConfig } from "../maps/use-map.js";
8
8
  import _sfc_main$1 from "../ui/button.vue.js";
9
- import _sfc_main$2 from "../ui/spinner.vue.js";
9
+ import _sfc_main$2 from "../ui/spinner2.vue.js";
10
10
  import { fetchOsmFeatures } from "./osm-features.js";
11
11
  import { subtractMask, unionAll } from "./osm-geometry-ops.js";
12
12
  const _sfc_main = /* @__PURE__ */ defineComponent({
@@ -0,0 +1,18 @@
1
+ import { type ChartConfig } from "./utils.js";
2
+ type __VLS_Props = {
3
+ id?: string;
4
+ class?: string;
5
+ config: ChartConfig;
6
+ };
7
+ declare var __VLS_4: {};
8
+ type __VLS_Slots = {} & {
9
+ default?: (props: typeof __VLS_4) => any;
10
+ };
11
+ declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
12
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
13
+ export default _default;
14
+ type __VLS_WithSlots<T, S> = T & {
15
+ new (): {
16
+ $slots: S;
17
+ };
18
+ };
@@ -0,0 +1,40 @@
1
+ import { defineComponent, toRefs, openBlock, createElementBlock, normalizeClass, unref, createVNode, renderSlot } from "vue";
2
+ import { cn } from "../../../lib/utils.js";
3
+ import _sfc_main$1 from "./chart-style.vue.js";
4
+ import { useId, provideChartContext } from "./utils.js";
5
+ const _sfc_main = /* @__PURE__ */ defineComponent({
6
+ __name: "chart-container",
7
+ props: {
8
+ id: {},
9
+ class: {},
10
+ config: {}
11
+ },
12
+ setup(__props) {
13
+ const props = __props;
14
+ const { config } = toRefs(props);
15
+ const uniqueId = useId();
16
+ const chartId = `chart-${props.id || uniqueId}`;
17
+ provideChartContext({ id: uniqueId, config });
18
+ return (_ctx, _cache) => {
19
+ return openBlock(), createElementBlock("div", {
20
+ "data-slot": "chart",
21
+ "data-chart": chartId,
22
+ class: normalizeClass(
23
+ unref(cn)(
24
+ "[&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border flex aspect-video justify-center text-xs [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden",
25
+ props.class
26
+ )
27
+ )
28
+ }, [
29
+ createVNode(_sfc_main$1, {
30
+ id: chartId,
31
+ config: unref(config)
32
+ }, null, 8, ["config"]),
33
+ renderSlot(_ctx.$slots, "default")
34
+ ], 2);
35
+ };
36
+ }
37
+ });
38
+ export {
39
+ _sfc_main as default
40
+ };
@@ -0,0 +1,4 @@
1
+ import _sfc_main from "./chart-container.vue.js";
2
+ export {
3
+ _sfc_main as default
4
+ };
@@ -0,0 +1,9 @@
1
+ type __VLS_Props = {
2
+ class?: string;
3
+ hideIcon?: boolean;
4
+ verticalAlign?: "top" | "bottom";
5
+ };
6
+ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
7
+ verticalAlign: "top" | "bottom";
8
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
9
+ export default _default;
@@ -0,0 +1,56 @@
1
+ import { defineComponent, computed, openBlock, createElementBlock, normalizeClass, unref, Fragment, renderList, createBlock, resolveDynamicComponent, normalizeStyle, createTextVNode, toDisplayString, createCommentVNode } from "vue";
2
+ import { cn } from "../../../lib/utils.js";
3
+ import { useChart } from "./utils.js";
4
+ const _sfc_main = /* @__PURE__ */ defineComponent({
5
+ __name: "chart-legend-content",
6
+ props: {
7
+ class: {},
8
+ hideIcon: { type: Boolean },
9
+ verticalAlign: { default: "bottom" }
10
+ },
11
+ setup(__props) {
12
+ const props = __props;
13
+ const { config } = useChart();
14
+ const items = computed(
15
+ () => Object.entries(config.value).map(([key, item]) => ({
16
+ key,
17
+ item,
18
+ // A themed entry has no single color; `ChartStyle` defines the variable.
19
+ color: item.color ?? `var(--color-${key})`,
20
+ label: item.label ?? key
21
+ }))
22
+ );
23
+ return (_ctx, _cache) => {
24
+ return items.value.length ? (openBlock(), createElementBlock("div", {
25
+ key: 0,
26
+ class: normalizeClass(
27
+ unref(cn)(
28
+ "flex items-center justify-center gap-4",
29
+ props.verticalAlign === "top" ? "pb-3" : "pt-3",
30
+ props.class
31
+ )
32
+ )
33
+ }, [
34
+ (openBlock(true), createElementBlock(Fragment, null, renderList(items.value, (entry) => {
35
+ return openBlock(), createElementBlock("div", {
36
+ key: entry.key,
37
+ "data-slot": "chart-legend-item",
38
+ class: "flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"
39
+ }, [
40
+ entry.item.icon && !props.hideIcon ? (openBlock(), createBlock(resolveDynamicComponent(entry.item.icon), { key: 0 })) : (openBlock(), createElementBlock("div", {
41
+ key: 1,
42
+ class: "h-2 w-2 shrink-0 rounded-[2px]",
43
+ style: normalizeStyle({ backgroundColor: entry.color })
44
+ }, null, 4)),
45
+ typeof entry.label !== "string" ? (openBlock(), createBlock(resolveDynamicComponent(entry.label), { key: 2 })) : (openBlock(), createElementBlock(Fragment, { key: 3 }, [
46
+ createTextVNode(toDisplayString(entry.label), 1)
47
+ ], 64))
48
+ ]);
49
+ }), 128))
50
+ ], 2)) : createCommentVNode("", true);
51
+ };
52
+ }
53
+ });
54
+ export {
55
+ _sfc_main as default
56
+ };
@@ -0,0 +1,4 @@
1
+ import _sfc_main from "./chart-legend-content.vue.js";
2
+ export {
3
+ _sfc_main as default
4
+ };
@@ -0,0 +1,7 @@
1
+ import { type ChartConfig } from "./utils.js";
2
+ type __VLS_Props = {
3
+ id: string;
4
+ config: ChartConfig;
5
+ };
6
+ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
7
+ export default _default;
@@ -0,0 +1,43 @@
1
+ import { defineComponent, computed, openBlock, createBlock, resolveDynamicComponent, withCtx, createTextVNode, toDisplayString, createCommentVNode } from "vue";
2
+ import { THEMES } from "./utils.js";
3
+ const _sfc_main = /* @__PURE__ */ defineComponent({
4
+ __name: "chart-style",
5
+ props: {
6
+ id: {},
7
+ config: {}
8
+ },
9
+ setup(__props) {
10
+ const props = __props;
11
+ const THEME_NAMES = ["light", "dark"];
12
+ const SAFE_TOKEN = /^[\w-]+$/;
13
+ const SAFE_COLOR = /^[^<>{};]+$/;
14
+ const css = computed(() => {
15
+ if (!SAFE_TOKEN.test(props.id)) return "";
16
+ const colored = Object.entries(props.config).filter(
17
+ ([key, item]) => SAFE_TOKEN.test(key) && (item.theme || item.color)
18
+ );
19
+ if (!colored.length) return "";
20
+ return THEME_NAMES.map((theme) => {
21
+ const prefix = THEMES[theme];
22
+ const lines = colored.flatMap(([key, item]) => {
23
+ const color = item.theme?.[theme] ?? item.color;
24
+ return color && SAFE_COLOR.test(color) ? [` --color-${key}: ${color};`] : [];
25
+ });
26
+ return `${prefix} [data-chart=${props.id}] {
27
+ ${lines.join("\n")}
28
+ }`;
29
+ }).join("\n");
30
+ });
31
+ return (_ctx, _cache) => {
32
+ return css.value ? (openBlock(), createBlock(resolveDynamicComponent("style"), { key: 0 }, {
33
+ default: withCtx(() => [
34
+ createTextVNode(toDisplayString(css.value), 1)
35
+ ]),
36
+ _: 1
37
+ })) : createCommentVNode("", true);
38
+ };
39
+ }
40
+ });
41
+ export {
42
+ _sfc_main as default
43
+ };
@@ -0,0 +1,4 @@
1
+ import _sfc_main from "./chart-style.vue.js";
2
+ export {
3
+ _sfc_main as default
4
+ };
@@ -0,0 +1,7 @@
1
+ import { type ChartTooltipOptions, type ChartTooltipRenderProps } from "./utils.js";
2
+ type __VLS_Props = ChartTooltipOptions & ChartTooltipRenderProps;
3
+ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
4
+ payload: import("./utils.js").ChartDatum;
5
+ indicator: "line" | "dot" | "dashed";
6
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
7
+ export default _default;
@@ -0,0 +1,122 @@
1
+ import { defineComponent, computed, openBlock, createElementBlock, normalizeClass, unref, toDisplayString, createCommentVNode, createElementVNode, Fragment, renderList, createBlock, resolveDynamicComponent, normalizeStyle, createTextVNode } from "vue";
2
+ import { cn } from "../../../lib/utils.js";
3
+ import { useChart } from "./utils.js";
4
+ const _hoisted_1 = {
5
+ key: 0,
6
+ class: "font-medium"
7
+ };
8
+ const _hoisted_2 = { class: "grid gap-1.5" };
9
+ const _hoisted_3 = { class: "grid gap-1.5" };
10
+ const _hoisted_4 = {
11
+ key: 0,
12
+ class: "font-medium"
13
+ };
14
+ const _hoisted_5 = { class: "text-muted-foreground" };
15
+ const _hoisted_6 = {
16
+ key: 0,
17
+ class: "font-mono font-medium text-foreground tabular-nums"
18
+ };
19
+ const _sfc_main = /* @__PURE__ */ defineComponent({
20
+ __name: "chart-tooltip-content",
21
+ props: {
22
+ class: {},
23
+ hideLabel: { type: Boolean },
24
+ hideIndicator: { type: Boolean },
25
+ indicator: { default: "dot" },
26
+ nameKey: {},
27
+ labelKey: {},
28
+ labelFormatter: {},
29
+ color: {},
30
+ payload: { default: () => ({}) },
31
+ x: {}
32
+ },
33
+ setup(__props) {
34
+ const props = __props;
35
+ const { config } = useChart();
36
+ const label = computed(() => {
37
+ if (props.hideLabel) return null;
38
+ if (props.labelKey && props.payload[props.labelKey] != null) {
39
+ return String(props.payload[props.labelKey]);
40
+ }
41
+ if (props.x === void 0) return null;
42
+ if (props.labelFormatter) return String(props.labelFormatter(props.x));
43
+ return props.x instanceof Date ? props.x.toISOString() : String(props.x);
44
+ });
45
+ const rows = computed(
46
+ () => Object.entries(props.payload).filter(([key]) => Object.hasOwn(config.value, key) && key !== props.labelKey).map(([key, value]) => {
47
+ const item = config.value[key];
48
+ const named = props.nameKey ? props.payload[props.nameKey] : void 0;
49
+ return {
50
+ key,
51
+ item,
52
+ name: item?.label ?? (named != null ? String(named) : key),
53
+ value: value == null ? null : typeof value === "number" ? value.toLocaleString() : String(value),
54
+ color: props.color ?? item?.color ?? `var(--color-${key})`
55
+ };
56
+ })
57
+ );
58
+ const nestLabel = computed(
59
+ () => rows.value.length === 1 && props.indicator !== "dot"
60
+ );
61
+ return (_ctx, _cache) => {
62
+ return openBlock(), createElementBlock("div", {
63
+ class: normalizeClass(
64
+ unref(cn)(
65
+ "grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",
66
+ props.class
67
+ )
68
+ )
69
+ }, [
70
+ label.value && !nestLabel.value ? (openBlock(), createElementBlock("div", _hoisted_1, toDisplayString(label.value), 1)) : createCommentVNode("", true),
71
+ createElementVNode("div", _hoisted_2, [
72
+ (openBlock(true), createElementBlock(Fragment, null, renderList(rows.value, (row) => {
73
+ return openBlock(), createElementBlock("div", {
74
+ key: row.key,
75
+ class: normalizeClass(
76
+ unref(cn)(
77
+ "flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground",
78
+ props.indicator === "dot" && "items-center"
79
+ )
80
+ )
81
+ }, [
82
+ row.item?.icon ? (openBlock(), createBlock(resolveDynamicComponent(row.item?.icon), { key: 0 })) : !props.hideIndicator ? (openBlock(), createElementBlock("div", {
83
+ key: 1,
84
+ class: normalizeClass(
85
+ unref(cn)(
86
+ "shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)",
87
+ props.indicator === "dot" && "h-2.5 w-2.5",
88
+ props.indicator === "line" && "w-1",
89
+ props.indicator === "dashed" && "w-0 border-[1.5px] border-dashed bg-transparent",
90
+ nestLabel.value && props.indicator === "dashed" && "my-0.5"
91
+ )
92
+ ),
93
+ style: normalizeStyle({ "--color-bg": row.color, "--color-border": row.color })
94
+ }, null, 6)) : createCommentVNode("", true),
95
+ createElementVNode("div", {
96
+ class: normalizeClass(
97
+ unref(cn)(
98
+ "flex flex-1 justify-between leading-none",
99
+ nestLabel.value ? "items-end" : "items-center"
100
+ )
101
+ )
102
+ }, [
103
+ createElementVNode("div", _hoisted_3, [
104
+ nestLabel.value && label.value ? (openBlock(), createElementBlock("div", _hoisted_4, toDisplayString(label.value), 1)) : createCommentVNode("", true),
105
+ createElementVNode("span", _hoisted_5, [
106
+ typeof row.name !== "string" ? (openBlock(), createBlock(resolveDynamicComponent(row.name), { key: 0 })) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
107
+ createTextVNode(toDisplayString(row.name), 1)
108
+ ], 64))
109
+ ])
110
+ ]),
111
+ row.value !== null ? (openBlock(), createElementBlock("span", _hoisted_6, toDisplayString(row.value), 1)) : createCommentVNode("", true)
112
+ ], 2)
113
+ ], 2);
114
+ }), 128))
115
+ ])
116
+ ], 2);
117
+ };
118
+ }
119
+ });
120
+ export {
121
+ _sfc_main as default
122
+ };
@@ -0,0 +1,4 @@
1
+ import _sfc_main from "./chart-tooltip-content.vue.js";
2
+ export {
3
+ _sfc_main as default
4
+ };
@@ -0,0 +1,11 @@
1
+ /**
2
+ * The dependency-free `chart` family barrel — the Vue analog of shadcn-vue's
3
+ * `ui/chart`, without its UI-primitive and utility dependencies. shadcn-vue's
4
+ * re-export of the tooltip and crosshair from the chart library is left out so
5
+ * nothing here imports one; the charts import those themselves.
6
+ */
7
+ export { default as ChartContainer } from "./chart-container.vue.js";
8
+ export { default as ChartLegendContent } from "./chart-legend-content.vue.js";
9
+ export { default as ChartStyle } from "./chart-style.vue.js";
10
+ export { default as ChartTooltipContent } from "./chart-tooltip-content.vue.js";
11
+ export { type ChartConfig, type ChartContextProps, type ChartDatum, type ChartDatumValue, type ChartTooltipOptions, type ChartTooltipRenderProps, componentToString, provideChartContext, THEMES, useChart, } from "./utils.js";
@@ -0,0 +1,81 @@
1
+ /**
2
+ * The non-component core of the dependency-free `chart` family: the config
3
+ * type, the theme map, the `useChart` context and `componentToString`.
4
+ *
5
+ * Ported from shadcn-vue's `ui/chart` without its context, id and client-check
6
+ * helper packages: the context is a typed `InjectionKey` as in
7
+ * `dropdown-menu/context.ts`, ids come from a module counter (Vue's peer range
8
+ * starts before Vue's own `useId`), and the client check is a `typeof window`
9
+ * test.
10
+ */
11
+ import { type Component, type Ref } from "vue";
12
+ /** Format: `{ THEME_NAME: CSS_SELECTOR }`. */
13
+ export declare const THEMES: {
14
+ readonly light: "";
15
+ readonly dark: ".dark";
16
+ };
17
+ export type ChartConfig = {
18
+ [key in string]: {
19
+ label?: string | Component;
20
+ icon?: string | Component;
21
+ } & ({
22
+ color?: string;
23
+ theme?: never;
24
+ } | {
25
+ color?: never;
26
+ theme: Record<keyof typeof THEMES, string>;
27
+ });
28
+ };
29
+ /** A value a tooltip can show; the datum's other fields are never read. */
30
+ export type ChartDatumValue = string | number | boolean | Date | null | undefined;
31
+ /** One hovered datum: field name to value. */
32
+ export type ChartDatum = Record<string, ChartDatumValue>;
33
+ /** unovis hands a tooltip either the datum or a node holding it as `data`. */
34
+ type ChartTooltipTarget = ChartDatum | {
35
+ data: ChartDatum;
36
+ };
37
+ /** What `componentToString` adds to the props it is given. */
38
+ export interface ChartTooltipRenderProps {
39
+ payload?: ChartDatum;
40
+ /** The hovered x value. */
41
+ x?: number | Date;
42
+ }
43
+ /** The props of `<ChartTooltipContent>` a caller sets. */
44
+ export interface ChartTooltipOptions {
45
+ class?: string;
46
+ hideLabel?: boolean;
47
+ hideIndicator?: boolean;
48
+ indicator?: "line" | "dot" | "dashed";
49
+ /** Payload key whose value names each row; defaults to the key itself. */
50
+ nameKey?: string;
51
+ /** Payload key shown as the heading in place of `x`. */
52
+ labelKey?: string;
53
+ labelFormatter?: (x: number | Date) => string | number;
54
+ color?: string;
55
+ }
56
+ /** The contract `<ChartContainer>` provides to the chart parts. */
57
+ export interface ChartContextProps {
58
+ id: string;
59
+ config: Ref<ChartConfig>;
60
+ }
61
+ /** Provide the chart context (called by `<ChartContainer>` in `setup`). */
62
+ export declare function provideChartContext(ctx: ChartContextProps): void;
63
+ /** Read the ambient chart context. Throws outside a `<ChartContainer>`. */
64
+ export declare function useChart(): ChartContextProps;
65
+ /**
66
+ * A page-unique id, safe to put in a selector. Inside a component it is Vue's
67
+ * own `useId` where the installed Vue has one (3.5+), which is per app and so
68
+ * matches between server render and hydration. Vue's peer range starts at 3.4,
69
+ * and `componentToString` calls this outside a component; both fall back to a
70
+ * module counter, which a server that renders several requests in one process
71
+ * does not reset, so on Vue 3.4 pass `id` to `<ChartContainer>` for SSR.
72
+ */
73
+ export declare function useId(): string;
74
+ /**
75
+ * Turn a tooltip component into a `(data, x?) => html` function, the shape
76
+ * unovis' tooltip `triggers` take. Returns nothing on the server, where
77
+ * there is no DOM to render into. The HTML comes from Vue's renderer, so text
78
+ * in the payload is escaped.
79
+ */
80
+ export declare function componentToString(config: ChartConfig, component: Component, props?: ChartTooltipOptions): ((data: ChartTooltipTarget, x?: number | Date) => string) | undefined;
81
+ export {};
@@ -0,0 +1,52 @@
1
+ import * as Vue from "vue";
2
+ import { getCurrentInstance, provide, inject, defineComponent, ref, h, createApp } from "vue";
3
+ const THEMES = { light: "", dark: ".dark" };
4
+ const ChartKey = /* @__PURE__ */ Symbol("chelone-chart");
5
+ function provideChartContext(ctx) {
6
+ provide(ChartKey, ctx);
7
+ }
8
+ function useChart() {
9
+ const ctx = inject(ChartKey, null);
10
+ if (!ctx) {
11
+ throw new Error("useChart: used outside a <ChartContainer> component.");
12
+ }
13
+ return ctx;
14
+ }
15
+ let idCounter = 0;
16
+ function useId() {
17
+ const vueUseId = Vue.useId;
18
+ if (vueUseId && getCurrentInstance()) {
19
+ return vueUseId().replace(/[^\w-]/g, "");
20
+ }
21
+ idCounter += 1;
22
+ return `chelone-${idCounter}`;
23
+ }
24
+ function isWrapped(target) {
25
+ return "data" in target && typeof target.data === "object" && target.data !== null && !(target.data instanceof Date);
26
+ }
27
+ function componentToString(config, component, props) {
28
+ if (typeof window === "undefined") return void 0;
29
+ const id = useId();
30
+ return (data, x) => {
31
+ const payload = isWrapped(data) ? data.data : data;
32
+ const host = defineComponent({
33
+ setup() {
34
+ provideChartContext({ id, config: ref(config) });
35
+ return () => h(component, { ...props, payload, x });
36
+ }
37
+ });
38
+ const app = createApp(host);
39
+ const el = document.createElement("div");
40
+ app.mount(el);
41
+ const html = el.innerHTML;
42
+ app.unmount();
43
+ return html;
44
+ };
45
+ }
46
+ export {
47
+ THEMES,
48
+ componentToString,
49
+ provideChartContext,
50
+ useChart,
51
+ useId
52
+ };
@@ -4,6 +4,7 @@ export { Badge, type BadgeVariant } from "./badge.js";
4
4
  export { default as Button } from "./button.vue.js";
5
5
  export { type ButtonSize, type ButtonVariant, type ButtonVariantsOptions, buttonVariants, } from "./button-variants.js";
6
6
  export { Card, CardContent, CardFooter, CardHeader, CardTitle, } from "./card.js";
7
+ export { type ChartConfig, ChartContainer, type ChartContextProps, ChartLegendContent, ChartStyle, ChartTooltipContent, componentToString, provideChartContext, THEMES, useChart, } from "./chart/index.js";
7
8
  export { default as Checkbox } from "./checkbox.vue.js";
8
9
  export type { CommandContext, CommandDialogProps, CommandFilter, CommandItemEntry, CommandProps, } from "./command/index.js";
9
10
  export { Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandKey, CommandList, CommandSeparator, CommandShortcut, defaultCommandFilter, provideCommand, useCommand, } from "./command/index.js";
@@ -1,32 +1,4 @@
1
- import { defineComponent, computed, openBlock, createElementBlock, normalizeClass, createElementVNode } from "vue";
2
- import { cn } from "../../lib/utils.js";
3
- const _sfc_main = /* @__PURE__ */ defineComponent({
4
- __name: "spinner",
5
- props: {
6
- class: {}
7
- },
8
- setup(__props) {
9
- const props = __props;
10
- const classes = computed(() => cn("size-4 animate-spin", props.class));
11
- return (_ctx, _cache) => {
12
- return openBlock(), createElementBlock("svg", {
13
- role: "status",
14
- "aria-label": "Loading",
15
- class: normalizeClass(classes.value),
16
- "data-slot": "spinner",
17
- viewBox: "0 0 24 24",
18
- fill: "none",
19
- stroke: "currentColor",
20
- "stroke-width": "2",
21
- "stroke-linecap": "round",
22
- "stroke-linejoin": "round",
23
- "aria-hidden": "false"
24
- }, [..._cache[0] || (_cache[0] = [
25
- createElementVNode("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" }, null, -1)
26
- ])], 2);
27
- };
28
- }
29
- });
1
+ import _sfc_main from "./spinner2.vue.js";
30
2
  export {
31
3
  _sfc_main as default
32
4
  };
@@ -1,4 +1,32 @@
1
- import _sfc_main from "./spinner.vue.js";
1
+ import { defineComponent, computed, openBlock, createElementBlock, normalizeClass, createElementVNode } from "vue";
2
+ import { cn } from "../../lib/utils.js";
3
+ const _sfc_main = /* @__PURE__ */ defineComponent({
4
+ __name: "spinner",
5
+ props: {
6
+ class: {}
7
+ },
8
+ setup(__props) {
9
+ const props = __props;
10
+ const classes = computed(() => cn("size-4 animate-spin", props.class));
11
+ return (_ctx, _cache) => {
12
+ return openBlock(), createElementBlock("svg", {
13
+ role: "status",
14
+ "aria-label": "Loading",
15
+ class: normalizeClass(classes.value),
16
+ "data-slot": "spinner",
17
+ viewBox: "0 0 24 24",
18
+ fill: "none",
19
+ stroke: "currentColor",
20
+ "stroke-width": "2",
21
+ "stroke-linecap": "round",
22
+ "stroke-linejoin": "round",
23
+ "aria-hidden": "false"
24
+ }, [..._cache[0] || (_cache[0] = [
25
+ createElementVNode("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" }, null, -1)
26
+ ])], 2);
27
+ };
28
+ }
29
+ });
2
30
  export {
3
31
  _sfc_main as default
4
32
  };