nuxt-ui-tools 1.0.1 → 1.1.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 (226) hide show
  1. package/dist/module.d.mts +3 -0
  2. package/dist/module.json +1 -1
  3. package/dist/module.mjs +37 -0
  4. package/dist/runtime/dashboard/components/block/dashboard-block-state.d.vue.ts +12 -0
  5. package/dist/runtime/dashboard/components/block/dashboard-block-state.vue +59 -0
  6. package/dist/runtime/dashboard/components/block/dashboard-block-state.vue.d.ts +12 -0
  7. package/dist/runtime/dashboard/components/block/dashboard-data-table.d.vue.ts +9 -0
  8. package/dist/runtime/dashboard/components/block/dashboard-data-table.vue +47 -0
  9. package/dist/runtime/dashboard/components/block/dashboard-data-table.vue.d.ts +9 -0
  10. package/dist/runtime/dashboard/components/block/dashboard-ring.d.vue.ts +34 -0
  11. package/dist/runtime/dashboard/components/block/dashboard-ring.vue +91 -0
  12. package/dist/runtime/dashboard/components/block/dashboard-ring.vue.d.ts +34 -0
  13. package/dist/runtime/dashboard/components/block/dashboard-row-actions.d.vue.ts +13 -0
  14. package/dist/runtime/dashboard/components/block/dashboard-row-actions.vue +49 -0
  15. package/dist/runtime/dashboard/components/block/dashboard-row-actions.vue.d.ts +13 -0
  16. package/dist/runtime/dashboard/components/block/dashboard-skeleton.d.vue.ts +34 -0
  17. package/dist/runtime/dashboard/components/block/dashboard-skeleton.vue +312 -0
  18. package/dist/runtime/dashboard/components/block/dashboard-skeleton.vue.d.ts +34 -0
  19. package/dist/runtime/dashboard/components/charts/renderer.d.ts +43 -0
  20. package/dist/runtime/dashboard/components/charts/renderer.js +34 -0
  21. package/dist/runtime/dashboard/components/charts/unovis/dashboard-donut-chart.d.vue.ts +18 -0
  22. package/dist/runtime/dashboard/components/charts/unovis/dashboard-donut-chart.vue +45 -0
  23. package/dist/runtime/dashboard/components/charts/unovis/dashboard-donut-chart.vue.d.ts +18 -0
  24. package/dist/runtime/dashboard/components/charts/unovis/dashboard-xy-chart.d.vue.ts +14 -0
  25. package/dist/runtime/dashboard/components/charts/unovis/dashboard-xy-chart.vue +190 -0
  26. package/dist/runtime/dashboard/components/charts/unovis/dashboard-xy-chart.vue.d.ts +14 -0
  27. package/dist/runtime/dashboard/components/charts/unovis/dashboard-xy-marks.d.vue.ts +13 -0
  28. package/dist/runtime/dashboard/components/charts/unovis/dashboard-xy-marks.vue +72 -0
  29. package/dist/runtime/dashboard/components/charts/unovis/dashboard-xy-marks.vue.d.ts +13 -0
  30. package/dist/runtime/dashboard/components/charts/unovis/xy-layers.d.ts +43 -0
  31. package/dist/runtime/dashboard/components/charts/unovis/xy-layers.js +60 -0
  32. package/dist/runtime/dashboard/components/dashboard-alerts.d.vue.ts +49 -0
  33. package/dist/runtime/dashboard/components/dashboard-alerts.vue +226 -0
  34. package/dist/runtime/dashboard/components/dashboard-alerts.vue.d.ts +49 -0
  35. package/dist/runtime/dashboard/components/dashboard-bar-chart.d.vue.ts +53 -0
  36. package/dist/runtime/dashboard/components/dashboard-bar-chart.vue +131 -0
  37. package/dist/runtime/dashboard/components/dashboard-bar-chart.vue.d.ts +53 -0
  38. package/dist/runtime/dashboard/components/dashboard-bars.d.vue.ts +49 -0
  39. package/dist/runtime/dashboard/components/dashboard-bars.vue +187 -0
  40. package/dist/runtime/dashboard/components/dashboard-bars.vue.d.ts +49 -0
  41. package/dist/runtime/dashboard/components/dashboard-card.d.vue.ts +47 -0
  42. package/dist/runtime/dashboard/components/dashboard-card.vue +316 -0
  43. package/dist/runtime/dashboard/components/dashboard-card.vue.d.ts +47 -0
  44. package/dist/runtime/dashboard/components/dashboard-combo-chart.d.vue.ts +52 -0
  45. package/dist/runtime/dashboard/components/dashboard-combo-chart.vue +128 -0
  46. package/dist/runtime/dashboard/components/dashboard-combo-chart.vue.d.ts +52 -0
  47. package/dist/runtime/dashboard/components/dashboard-donut-chart.d.vue.ts +48 -0
  48. package/dist/runtime/dashboard/components/dashboard-donut-chart.vue +216 -0
  49. package/dist/runtime/dashboard/components/dashboard-donut-chart.vue.d.ts +48 -0
  50. package/dist/runtime/dashboard/components/dashboard-feed.d.vue.ts +49 -0
  51. package/dist/runtime/dashboard/components/dashboard-feed.vue +238 -0
  52. package/dist/runtime/dashboard/components/dashboard-feed.vue.d.ts +49 -0
  53. package/dist/runtime/dashboard/components/dashboard-funnel.d.vue.ts +34 -0
  54. package/dist/runtime/dashboard/components/dashboard-funnel.vue +157 -0
  55. package/dist/runtime/dashboard/components/dashboard-funnel.vue.d.ts +34 -0
  56. package/dist/runtime/dashboard/components/dashboard-gauge.d.vue.ts +55 -0
  57. package/dist/runtime/dashboard/components/dashboard-gauge.vue +177 -0
  58. package/dist/runtime/dashboard/components/dashboard-gauge.vue.d.ts +55 -0
  59. package/dist/runtime/dashboard/components/dashboard-grid.d.vue.ts +38 -0
  60. package/dist/runtime/dashboard/components/dashboard-grid.vue +49 -0
  61. package/dist/runtime/dashboard/components/dashboard-grid.vue.d.ts +38 -0
  62. package/dist/runtime/dashboard/components/dashboard-legend.d.vue.ts +8 -0
  63. package/dist/runtime/dashboard/components/dashboard-legend.vue +37 -0
  64. package/dist/runtime/dashboard/components/dashboard-legend.vue.d.ts +8 -0
  65. package/dist/runtime/dashboard/components/dashboard-line-chart.d.vue.ts +46 -0
  66. package/dist/runtime/dashboard/components/dashboard-line-chart.vue +129 -0
  67. package/dist/runtime/dashboard/components/dashboard-line-chart.vue.d.ts +46 -0
  68. package/dist/runtime/dashboard/components/dashboard-list.d.vue.ts +63 -0
  69. package/dist/runtime/dashboard/components/dashboard-list.vue +239 -0
  70. package/dist/runtime/dashboard/components/dashboard-list.vue.d.ts +63 -0
  71. package/dist/runtime/dashboard/components/dashboard-paired-bars.d.vue.ts +43 -0
  72. package/dist/runtime/dashboard/components/dashboard-paired-bars.vue +194 -0
  73. package/dist/runtime/dashboard/components/dashboard-paired-bars.vue.d.ts +43 -0
  74. package/dist/runtime/dashboard/components/dashboard-refresh.d.vue.ts +29 -0
  75. package/dist/runtime/dashboard/components/dashboard-refresh.vue +86 -0
  76. package/dist/runtime/dashboard/components/dashboard-refresh.vue.d.ts +29 -0
  77. package/dist/runtime/dashboard/components/dashboard-relative-time.d.vue.ts +12 -0
  78. package/dist/runtime/dashboard/components/dashboard-relative-time.vue +23 -0
  79. package/dist/runtime/dashboard/components/dashboard-relative-time.vue.d.ts +12 -0
  80. package/dist/runtime/dashboard/components/dashboard-stack-bar.d.vue.ts +36 -0
  81. package/dist/runtime/dashboard/components/dashboard-stack-bar.vue +162 -0
  82. package/dist/runtime/dashboard/components/dashboard-stack-bar.vue.d.ts +36 -0
  83. package/dist/runtime/dashboard/components/dashboard-stat.d.vue.ts +69 -0
  84. package/dist/runtime/dashboard/components/dashboard-stat.vue +279 -0
  85. package/dist/runtime/dashboard/components/dashboard-stat.vue.d.ts +69 -0
  86. package/dist/runtime/dashboard/components/dashboard-stats.d.vue.ts +38 -0
  87. package/dist/runtime/dashboard/components/dashboard-stats.vue +202 -0
  88. package/dist/runtime/dashboard/components/dashboard-stats.vue.d.ts +38 -0
  89. package/dist/runtime/dashboard/components/dashboard-table.d.vue.ts +52 -0
  90. package/dist/runtime/dashboard/components/dashboard-table.vue +305 -0
  91. package/dist/runtime/dashboard/components/dashboard-table.vue.d.ts +52 -0
  92. package/dist/runtime/dashboard/components/dashboard-tabs.d.vue.ts +35 -0
  93. package/dist/runtime/dashboard/components/dashboard-tabs.vue +55 -0
  94. package/dist/runtime/dashboard/components/dashboard-tabs.vue.d.ts +35 -0
  95. package/dist/runtime/dashboard/components/dashboard-total.d.vue.ts +10 -0
  96. package/dist/runtime/dashboard/components/dashboard-total.vue +32 -0
  97. package/dist/runtime/dashboard/components/dashboard-total.vue.d.ts +10 -0
  98. package/dist/runtime/dashboard/components/dashboard-widget.d.vue.ts +46 -0
  99. package/dist/runtime/dashboard/components/dashboard-widget.vue +84 -0
  100. package/dist/runtime/dashboard/components/dashboard-widget.vue.d.ts +46 -0
  101. package/dist/runtime/dashboard/composables/use-dashboard-api.d.ts +15 -0
  102. package/dist/runtime/dashboard/composables/use-dashboard-api.js +91 -0
  103. package/dist/runtime/dashboard/composables/use-dashboard-block.d.ts +22 -0
  104. package/dist/runtime/dashboard/composables/use-dashboard-block.js +35 -0
  105. package/dist/runtime/dashboard/composables/use-dashboard-chart.d.ts +36 -0
  106. package/dist/runtime/dashboard/composables/use-dashboard-chart.js +118 -0
  107. package/dist/runtime/dashboard/composables/use-dashboard-derived.d.ts +12 -0
  108. package/dist/runtime/dashboard/composables/use-dashboard-derived.js +47 -0
  109. package/dist/runtime/dashboard/composables/use-dashboard-format.d.ts +6 -0
  110. package/dist/runtime/dashboard/composables/use-dashboard-format.js +12 -0
  111. package/dist/runtime/dashboard/composables/use-dashboard-options.d.ts +8 -0
  112. package/dist/runtime/dashboard/composables/use-dashboard-options.js +63 -0
  113. package/dist/runtime/dashboard/composables/use-dashboard-param-scope.d.ts +30 -0
  114. package/dist/runtime/dashboard/composables/use-dashboard-param-scope.js +71 -0
  115. package/dist/runtime/dashboard/composables/use-dashboard-remote-options.d.ts +12 -0
  116. package/dist/runtime/dashboard/composables/use-dashboard-remote-options.js +117 -0
  117. package/dist/runtime/dashboard/composables/use-dashboard-resource.d.ts +35 -0
  118. package/dist/runtime/dashboard/composables/use-dashboard-resource.js +80 -0
  119. package/dist/runtime/dashboard/composables/use-dashboard-scope.d.ts +46 -0
  120. package/dist/runtime/dashboard/composables/use-dashboard-scope.js +127 -0
  121. package/dist/runtime/dashboard/composables/use-dashboard-time.d.ts +13 -0
  122. package/dist/runtime/dashboard/composables/use-dashboard-time.js +40 -0
  123. package/dist/runtime/dashboard/composables/use-dashboard-ui.d.ts +22 -0
  124. package/dist/runtime/dashboard/composables/use-dashboard-ui.js +19 -0
  125. package/dist/runtime/dashboard/composables/use-dashboard-views.d.ts +46 -0
  126. package/dist/runtime/dashboard/composables/use-dashboard-views.js +49 -0
  127. package/dist/runtime/dashboard/composables/use-dashboard.d.ts +24 -0
  128. package/dist/runtime/dashboard/composables/use-dashboard.js +42 -0
  129. package/dist/runtime/dashboard/constants/query.d.ts +16 -0
  130. package/dist/runtime/dashboard/constants/query.js +15 -0
  131. package/dist/runtime/dashboard/index.d.ts +4 -0
  132. package/dist/runtime/dashboard/index.js +3 -0
  133. package/dist/runtime/dashboard/schema/index.d.ts +57 -0
  134. package/dist/runtime/dashboard/schema/index.js +3 -0
  135. package/dist/runtime/dashboard/types/blocks.d.ts +251 -0
  136. package/dist/runtime/dashboard/types/blocks.js +0 -0
  137. package/dist/runtime/dashboard/types/charts.d.ts +60 -0
  138. package/dist/runtime/dashboard/types/charts.js +0 -0
  139. package/dist/runtime/dashboard/types/index.d.ts +7 -0
  140. package/dist/runtime/dashboard/types/index.js +0 -0
  141. package/dist/runtime/dashboard/types/options.d.ts +46 -0
  142. package/dist/runtime/dashboard/types/options.js +0 -0
  143. package/dist/runtime/dashboard/types/params.d.ts +115 -0
  144. package/dist/runtime/dashboard/types/params.js +0 -0
  145. package/dist/runtime/dashboard/types/resource.d.ts +106 -0
  146. package/dist/runtime/dashboard/types/resource.js +0 -0
  147. package/dist/runtime/dashboard/types/runtime.d.ts +44 -0
  148. package/dist/runtime/dashboard/types/runtime.js +0 -0
  149. package/dist/runtime/dashboard/types/schema.d.ts +171 -0
  150. package/dist/runtime/dashboard/types/schema.js +0 -0
  151. package/dist/runtime/dashboard/types/ui.d.ts +201 -0
  152. package/dist/runtime/dashboard/types/ui.js +0 -0
  153. package/dist/runtime/dashboard/utils/builders/dashboard-params.d.ts +85 -0
  154. package/dist/runtime/dashboard/utils/builders/dashboard-params.js +87 -0
  155. package/dist/runtime/dashboard/utils/chart-frame.d.ts +5 -0
  156. package/dist/runtime/dashboard/utils/chart-frame.js +27 -0
  157. package/dist/runtime/dashboard/utils/charts.d.ts +61 -0
  158. package/dist/runtime/dashboard/utils/charts.js +142 -0
  159. package/dist/runtime/dashboard/utils/comparison.d.ts +15 -0
  160. package/dist/runtime/dashboard/utils/comparison.js +19 -0
  161. package/dist/runtime/dashboard/utils/export.d.ts +13 -0
  162. package/dist/runtime/dashboard/utils/export.js +45 -0
  163. package/dist/runtime/dashboard/utils/options.d.ts +12 -0
  164. package/dist/runtime/dashboard/utils/options.js +23 -0
  165. package/dist/runtime/dashboard/utils/params/codecs.d.ts +14 -0
  166. package/dist/runtime/dashboard/utils/params/codecs.js +69 -0
  167. package/dist/runtime/dashboard/utils/resource.d.ts +16 -0
  168. package/dist/runtime/dashboard/utils/resource.js +39 -0
  169. package/dist/runtime/dashboard/utils/schema.d.ts +9 -0
  170. package/dist/runtime/dashboard/utils/schema.js +31 -0
  171. package/dist/runtime/dashboard/utils/sparkline.d.ts +21 -0
  172. package/dist/runtime/dashboard/utils/sparkline.js +53 -0
  173. package/dist/runtime/dashboard/utils/state.d.ts +28 -0
  174. package/dist/runtime/dashboard/utils/state.js +32 -0
  175. package/dist/runtime/dashboard/utils/time.d.ts +17 -0
  176. package/dist/runtime/dashboard/utils/time.js +60 -0
  177. package/dist/runtime/dashboard/utils/tracker.d.ts +12 -0
  178. package/dist/runtime/dashboard/utils/tracker.js +31 -0
  179. package/dist/runtime/dashboard/utils/ui.d.ts +38 -0
  180. package/dist/runtime/dashboard/utils/ui.js +24 -0
  181. package/dist/runtime/dashboard/utils/visibility.d.ts +2 -0
  182. package/dist/runtime/dashboard/utils/visibility.js +25 -0
  183. package/dist/runtime/form/types/options.d.ts +15 -36
  184. package/dist/runtime/i18n/locales/en.js +62 -0
  185. package/dist/runtime/i18n/locales/fr.js +62 -0
  186. package/dist/runtime/i18n/types.d.ts +67 -0
  187. package/dist/runtime/shared/index.d.ts +2 -0
  188. package/dist/runtime/shared/styles/tokens.css +1 -1
  189. package/dist/runtime/shared/types/query.d.ts +10 -0
  190. package/dist/runtime/shared/types/query.js +0 -0
  191. package/dist/runtime/shared/types/remote-options.d.ts +37 -0
  192. package/dist/runtime/shared/types/remote-options.js +0 -0
  193. package/dist/runtime/spreadsheet/components/layout/spreadsheet-import-footer.d.vue.ts +2 -2
  194. package/dist/runtime/spreadsheet/components/layout/spreadsheet-import-footer.vue.d.ts +2 -2
  195. package/dist/runtime/spreadsheet/composables/use-spreadsheet-internals.d.ts +15 -15
  196. package/dist/runtime/spreadsheet/composables/use-spreadsheet-resolutions.d.ts +2 -2
  197. package/dist/runtime/spreadsheet/schema/normalize.d.ts +1 -1
  198. package/dist/runtime/spreadsheet/utils/references/sources.d.ts +1 -1
  199. package/dist/runtime/table/components/data-list/data-list-content.d.vue.ts +1 -1
  200. package/dist/runtime/table/components/data-list/data-list-content.vue.d.ts +1 -1
  201. package/dist/runtime/table/components/data-list/data-list-infinite-loader.d.vue.ts +1 -1
  202. package/dist/runtime/table/components/data-list/data-list-infinite-loader.vue.d.ts +1 -1
  203. package/dist/runtime/table/components/data-list/data-list-layout-switch.d.vue.ts +1 -1
  204. package/dist/runtime/table/components/data-list/data-list-layout-switch.vue.d.ts +1 -1
  205. package/dist/runtime/table/components/data-list/data-list-pagination.d.vue.ts +1 -1
  206. package/dist/runtime/table/components/data-list/data-list-pagination.vue.d.ts +1 -1
  207. package/dist/runtime/table/components/data-list/data-list-sort-menu.d.vue.ts +1 -1
  208. package/dist/runtime/table/components/data-list/data-list-sort-menu.vue.d.ts +1 -1
  209. package/dist/runtime/table/components/data-list/sort-menu-panel.d.vue.ts +2 -2
  210. package/dist/runtime/table/components/data-list/sort-menu-panel.vue.d.ts +2 -2
  211. package/dist/runtime/table/components/filters/shared/filter-match-mode-button.d.vue.ts +1 -1
  212. package/dist/runtime/table/components/filters/shared/filter-match-mode-button.vue.d.ts +1 -1
  213. package/dist/runtime/table/components/layout/table-footer.d.vue.ts +1 -1
  214. package/dist/runtime/table/components/layout/table-footer.vue.d.ts +1 -1
  215. package/dist/runtime/table/components/table/table-cell-ellipsis.d.ts +1 -1
  216. package/dist/runtime/table/composables/use-query-state.d.ts +3 -3
  217. package/dist/runtime/table/composables/use-table-columns.d.ts +3 -3
  218. package/dist/runtime/table/composables/use-table-internals.d.ts +27 -27
  219. package/dist/runtime/table/composables/use-table-pagination.d.ts +2 -2
  220. package/dist/runtime/table/composables/use-table-selection.d.ts +1 -1
  221. package/dist/runtime/table/composables/use-table-state.d.ts +3 -3
  222. package/dist/runtime/table/types/source.d.ts +4 -5
  223. package/dist/runtime/table/utils/columns/menu.d.ts +1 -1
  224. package/dist/runtime/table/utils/columns/state.d.ts +1 -1
  225. package/dist/runtime/table/utils/data-list-ui.d.ts +1 -1
  226. package/package.json +28 -1
@@ -0,0 +1,190 @@
1
+ <script setup>
2
+ import VisAxis from "@unovis/vue/components/axis";
3
+ import VisCrosshair from "@unovis/vue/components/crosshair";
4
+ import VisGroupedBar from "@unovis/vue/components/grouped-bar";
5
+ import VisPlotband from "@unovis/vue/components/plotband";
6
+ import VisStackedBar from "@unovis/vue/components/stacked-bar";
7
+ import VisTooltip from "@unovis/vue/components/tooltip";
8
+ import VisXYContainer from "@unovis/vue/containers/xy-container";
9
+ import { usePreferredReducedMotion } from "@vueuse/core";
10
+ import { computed } from "vue";
11
+ import { renderDashboardChartTooltip } from "../../../utils/chart-frame";
12
+ import DashboardXyMarks from "./dashboard-xy-marks.vue";
13
+ import { resolveDashboardXyLayer } from "./xy-layers";
14
+ const props = defineProps({
15
+ frame: { type: Object, required: true },
16
+ height: { type: Number, required: true },
17
+ selectable: { type: Boolean, required: false }
18
+ });
19
+ const emit = defineEmits(["select"]);
20
+ function select(event) {
21
+ const box = event.currentTarget;
22
+ if (!props.selectable || !(box instanceof HTMLElement)) return;
23
+ const rect = box.getBoundingClientRect();
24
+ const start = margin.value.left + (padding.value.left ?? 0);
25
+ const width = rect.width - start - margin.value.right - (padding.value.right ?? 0);
26
+ if (width <= 0) return;
27
+ const [from, to] = props.frame.xDomain;
28
+ const index = Math.round(from + (event.clientX - rect.left - start) / width * (to - from));
29
+ if (index >= 0 && index < props.frame.data.length) emit("select", index);
30
+ }
31
+ const reducedMotion = usePreferredReducedMotion();
32
+ const duration = computed(() => reducedMotion.value === "reduce" ? 0 : 450);
33
+ const left = computed(() => resolveDashboardXyLayer(props.frame, "left"));
34
+ const right = computed(() => resolveDashboardXyLayer(props.frame, "right"));
35
+ const hasBars = computed(() => left.value.bars.count > 0);
36
+ const margin = computed(() => ({
37
+ bottom: 24,
38
+ left: 46,
39
+ right: props.frame.right ? 46 : 8,
40
+ top: 10
41
+ }));
42
+ const padding = computed(
43
+ () => hasBars.value ? {} : { left: 8, right: props.frame.right ? 6 : 16 }
44
+ );
45
+ const barGeometry = computed(() => {
46
+ const count = Math.max(1, left.value.bars.count);
47
+ const points = Math.max(2, props.frame.data.length);
48
+ const slots = (points + 1) / points;
49
+ if (props.frame.stacked) return { barMaxWidth: 24, barPadding: 1 - Math.min(0.9, 0.34 * slots) };
50
+ const dense = count > 2;
51
+ const width = dense ? 12 : 16;
52
+ const gap = dense ? 2 : 1;
53
+ return {
54
+ barPadding: count > 1 ? gap / (width + gap) : 0,
55
+ groupMaxWidth: count * (width + gap),
56
+ groupPadding: 1 - Math.min(0.9, (dense ? 0.16 : 0.26) * count * slots)
57
+ };
58
+ });
59
+ const tickValues = computed(() => props.frame.labels.map((_, index) => index));
60
+ const x = (datum) => datum.index;
61
+ const formatX = (value) => value instanceof Date ? "" : props.frame.labels[value] ?? "";
62
+ const formatAxis = (axis) => (value) => value instanceof Date || !axis ? "" : axis.format(value);
63
+ const formatLeft = computed(() => formatAxis(props.frame.left));
64
+ const formatRight = computed(() => formatAxis(props.frame.right));
65
+ const tooltip = (datum) => renderDashboardChartTooltip(props.frame, datum);
66
+ const crosshair = { hideWhenFarFromPointer: false, template: tooltip };
67
+ const bands = computed(() => hasBars.value ? [] : props.frame.selection);
68
+ const bandColor = "color-mix(in oklab, var(--ui-primary) 9%, transparent)";
69
+ function labelStyle(label) {
70
+ const start = margin.value.left + (padding.value.left ?? 0);
71
+ const end = margin.value.right + (padding.value.right ?? 0);
72
+ const [from, to] = props.frame.xDomain;
73
+ const [min, max] = props.frame.left.domain;
74
+ const fraction = to === from ? 0.5 : (label.index - from) / (to - from);
75
+ const plot = props.height - margin.value.top - margin.value.bottom;
76
+ const ratio = max === min ? 0 : (label.value - min) / (max - min);
77
+ return {
78
+ left: `calc(${start}px + (100% - ${start + end}px) * ${fraction})`,
79
+ top: `${margin.value.top + plot * (1 - ratio)}px`,
80
+ transform: label.value < 0 ? "translate(-50%, 4px)" : "translate(-50%, calc(-100% - 4px))"
81
+ };
82
+ }
83
+ </script>
84
+
85
+ <template>
86
+ <div
87
+ class="nut-dash-chart relative w-full"
88
+ :class="[hasBars && 'nut-dash-chart--bars', selectable && 'cursor-pointer']"
89
+ :style="{ height: `${height}px` }"
90
+ @click="select"
91
+ >
92
+ <VisXYContainer
93
+ :height="height"
94
+ :margin="margin"
95
+ :padding="padding"
96
+ :auto-margin="false"
97
+ :x-domain="frame.xDomain"
98
+ :y-domain="frame.left.domain"
99
+ :duration="duration"
100
+ >
101
+ <VisPlotband
102
+ v-for="index in bands"
103
+ :key="`band-${index}`"
104
+ axis="x"
105
+ :from="index - 0.5"
106
+ :to="index + 0.5"
107
+ :color="bandColor"
108
+ />
109
+ <VisStackedBar
110
+ v-if="frame.stacked && hasBars"
111
+ :data="frame.data"
112
+ :x="x"
113
+ :y="left.bars.y"
114
+ :color="left.bars.color"
115
+ :bar-padding="barGeometry.barPadding"
116
+ :bar-max-width="barGeometry.barMaxWidth"
117
+ :rounded-corners="2"
118
+ />
119
+ <VisGroupedBar
120
+ v-else-if="hasBars"
121
+ :data="frame.data"
122
+ :x="x"
123
+ :y="left.bars.y"
124
+ :color="left.bars.color"
125
+ :group-padding="barGeometry.groupPadding"
126
+ :group-max-width="barGeometry.groupMaxWidth"
127
+ :bar-padding="barGeometry.barPadding"
128
+ :bar-min-height="0"
129
+ :rounded-corners="2"
130
+ />
131
+ <DashboardXyMarks :layer="left" :data="frame.data" />
132
+ <VisAxis
133
+ type="x"
134
+ :tick-format="formatX"
135
+ :tick-values="tickValues"
136
+ :num-ticks="tickValues.length"
137
+ :grid-line="false"
138
+ :tick-line="false"
139
+ :domain-line="false"
140
+ :tick-text-hide-overlapping="true"
141
+ />
142
+ <VisAxis
143
+ type="y"
144
+ :tick-format="formatLeft"
145
+ :tick-values="frame.left.ticks"
146
+ :tick-line="false"
147
+ :domain-line="false"
148
+ />
149
+ <VisCrosshair :data="frame.data" v-bind="crosshair" />
150
+ <VisTooltip />
151
+ </VisXYContainer>
152
+
153
+ <!-- Secondary axis: a second container over the first, sharing its x domain and margins. -->
154
+ <VisXYContainer
155
+ v-if="frame.right"
156
+ class="pointer-events-none !absolute inset-0"
157
+ :height="height"
158
+ :margin="margin"
159
+ :padding="padding"
160
+ :auto-margin="false"
161
+ :x-domain="frame.xDomain"
162
+ :y-domain="frame.right.domain"
163
+ :duration="duration"
164
+ >
165
+ <DashboardXyMarks :layer="right" :data="frame.data" />
166
+ <VisAxis
167
+ type="y"
168
+ position="right"
169
+ :tick-format="formatRight"
170
+ :tick-values="frame.right.ticks"
171
+ :tick-text-color="right.lineColor"
172
+ :grid-line="false"
173
+ :tick-line="false"
174
+ :domain-line="false"
175
+ />
176
+ </VisXYContainer>
177
+
178
+ <span
179
+ v-for="label in frame.valueLabels"
180
+ :key="`label-${label.index}`"
181
+ aria-hidden="true"
182
+ class="pointer-events-none absolute text-[10.5px] leading-none whitespace-nowrap tabular-nums"
183
+ :class="label.strong ? 'font-semibold text-highlighted' : 'text-muted'"
184
+ :style="labelStyle(label)"
185
+ data-value-label
186
+ >
187
+ {{ label.text }}
188
+ </span>
189
+ </div>
190
+ </template>
@@ -0,0 +1,14 @@
1
+ import type { DashboardChartFrame } from '../../../types/index.js';
2
+ type __VLS_Props = {
3
+ frame: DashboardChartFrame;
4
+ height: number;
5
+ /** A click selects the x position under the pointer. */
6
+ selectable?: boolean;
7
+ };
8
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
9
+ select: (index: number) => any;
10
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
11
+ onSelect?: ((index: number) => any) | undefined;
12
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
13
+ declare const _default: typeof __VLS_export;
14
+ export default _default;
@@ -0,0 +1,13 @@
1
+ import type { DashboardChartDatum } from '../../../types/index.js';
2
+ import type { DashboardXyLayer } from './xy-layers.js';
3
+ /**
4
+ * Line-side marks of one value axis: area fills, dashed comparison lines, solid lines, their point
5
+ * markers, and reference lines. Rendered inside a `VisXYContainer`, which registers them.
6
+ */
7
+ type __VLS_Props = {
8
+ layer: DashboardXyLayer;
9
+ data: DashboardChartDatum[];
10
+ };
11
+ declare const __VLS_export: 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: typeof __VLS_export;
13
+ export default _default;
@@ -0,0 +1,72 @@
1
+ <script setup>
2
+ import { CurveType } from "@unovis/ts";
3
+ import VisArea from "@unovis/vue/components/area";
4
+ import VisLine from "@unovis/vue/components/line";
5
+ import VisPlotline from "@unovis/vue/components/plotline";
6
+ import VisScatter from "@unovis/vue/components/scatter";
7
+ defineProps({
8
+ layer: { type: Object, required: true },
9
+ data: { type: Array, required: true }
10
+ });
11
+ const x = (datum) => datum.index;
12
+ const dash = () => [4, 5];
13
+ const surface = () => "var(--ui-bg)";
14
+ </script>
15
+
16
+ <template>
17
+ <VisArea
18
+ v-for="area in layer.areas"
19
+ :key="`area-${area.key}`"
20
+ :data="area.data"
21
+ :x="x"
22
+ :y="area.y"
23
+ :color="area.color"
24
+ :opacity="area.opacity"
25
+ :curve-type="CurveType.MonotoneX"
26
+ />
27
+ <VisLine
28
+ v-if="layer.dashed.count"
29
+ :data="data"
30
+ :x="x"
31
+ :y="layer.dashed.y"
32
+ :color="layer.dashed.color"
33
+ :line-dash-array="dash"
34
+ :line-width="1.5"
35
+ :curve-type="CurveType.MonotoneX"
36
+ />
37
+ <VisLine
38
+ v-if="layer.solid.count"
39
+ :data="data"
40
+ :x="x"
41
+ :y="layer.solid.y"
42
+ :color="layer.solid.color"
43
+ :line-width="2"
44
+ :curve-type="CurveType.MonotoneX"
45
+ />
46
+ <VisScatter
47
+ v-for="dots in layer.dots"
48
+ :key="`dots-${dots.key}`"
49
+ :data="dots.data"
50
+ :x="x"
51
+ :y="dots.y"
52
+ :size="5.2"
53
+ :color="surface"
54
+ :stroke-color="dots.stroke"
55
+ :stroke-width="1.6"
56
+ />
57
+ <VisPlotline
58
+ v-for="reference in layer.references"
59
+ :key="reference.key"
60
+ axis="y"
61
+ :value="reference.value"
62
+ :line-style="[2, 4]"
63
+ :line-width="1"
64
+ color="var(--nut-dash-ref)"
65
+ :label-text="reference.text"
66
+ :label-position="reference.position"
67
+ :label-offset-x="4"
68
+ :label-offset-y="7"
69
+ label-color="var(--nut-dash-ref-label)"
70
+ :label-size="10"
71
+ />
72
+ </template>
@@ -0,0 +1,13 @@
1
+ import type { DashboardChartDatum } from '../../../types/index.js';
2
+ import type { DashboardXyLayer } from './xy-layers.js';
3
+ /**
4
+ * Line-side marks of one value axis: area fills, dashed comparison lines, solid lines, their point
5
+ * markers, and reference lines. Rendered inside a `VisXYContainer`, which registers them.
6
+ */
7
+ type __VLS_Props = {
8
+ layer: DashboardXyLayer;
9
+ data: DashboardChartDatum[];
10
+ };
11
+ declare const __VLS_export: 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: typeof __VLS_export;
13
+ export default _default;
@@ -0,0 +1,43 @@
1
+ import type { DashboardChartDatum, DashboardChartFrame } from '../../../types/index.js';
2
+ type DashboardXyAccessor = (datum: DashboardChartDatum) => number | undefined;
3
+ /**
4
+ * Series drawn by one unovis component: one accessor and one color per series. unovis calls the
5
+ * color accessor with a datum (bars) or the whole data array (lines), then the series index.
6
+ */
7
+ export interface DashboardXySeriesSet {
8
+ count: number;
9
+ y: DashboardXyAccessor[];
10
+ color: (datum: DashboardChartDatum | DashboardChartDatum[], index: number) => string;
11
+ }
12
+ /** Marks of one series drawn from its defined points only (areas, point markers). */
13
+ export interface DashboardXyPointMark {
14
+ key: string;
15
+ color: string;
16
+ data: DashboardChartDatum[];
17
+ y: DashboardXyAccessor;
18
+ }
19
+ /** Everything drawn against one value axis, resolved once per frame. */
20
+ export interface DashboardXyLayer {
21
+ bars: DashboardXySeriesSet;
22
+ solid: DashboardXySeriesSet;
23
+ dashed: DashboardXySeriesSet;
24
+ /** Area fills; comparison (dashed) areas are fainter. */
25
+ areas: (DashboardXyPointMark & {
26
+ opacity: number;
27
+ })[];
28
+ /** Point markers of solid line and area series. */
29
+ dots: (DashboardXyPointMark & {
30
+ stroke: () => string;
31
+ })[];
32
+ references: {
33
+ key: string;
34
+ value: number;
35
+ text: string;
36
+ position: 'top-left' | 'top-right';
37
+ }[];
38
+ /** Color of the axis' first line series (the right axis labels take it). */
39
+ lineColor: string | null;
40
+ }
41
+ /** Splits the frame's series of one axis into the unovis components that draw them. */
42
+ export declare function resolveDashboardXyLayer(frame: DashboardChartFrame, axis: 'left' | 'right'): DashboardXyLayer;
43
+ export {};
@@ -0,0 +1,60 @@
1
+ import { fadeDashboardColor } from "../../../utils/charts.js";
2
+ function accessor(series) {
3
+ return (datum) => datum.values[series.index];
4
+ }
5
+ function seriesSet(series) {
6
+ return {
7
+ color: (_datum, index) => series[index]?.color ?? "var(--nut-dash-s1)",
8
+ count: series.length,
9
+ y: series.map(accessor)
10
+ };
11
+ }
12
+ function barSet(series, emphasis) {
13
+ const base = seriesSet(series);
14
+ if (!emphasis) return base;
15
+ return {
16
+ ...base,
17
+ color: (datum, index) => {
18
+ const color = base.color(datum, index);
19
+ return Array.isArray(datum) || emphasis[datum.index] ? color : fadeDashboardColor(color);
20
+ }
21
+ };
22
+ }
23
+ function definedData(frame, series) {
24
+ return frame.data.filter((datum) => datum.values[series.index] !== void 0);
25
+ }
26
+ export function resolveDashboardXyLayer(frame, axis) {
27
+ const series = frame.series.filter((entry) => entry.axis === axis);
28
+ const lines = series.filter((entry) => entry.type !== "bar");
29
+ const solid = lines.filter((entry) => !entry.dashed);
30
+ const scale = axis === "right" ? frame.right : frame.left;
31
+ return {
32
+ areas: lines.filter((entry) => entry.type === "area").map((entry) => ({
33
+ color: entry.color,
34
+ data: definedData(frame, entry),
35
+ key: entry.key,
36
+ opacity: entry.dashed ? 0.06 : 0.14,
37
+ y: accessor(entry)
38
+ })),
39
+ bars: barSet(
40
+ series.filter((entry) => entry.type === "bar"),
41
+ frame.emphasis
42
+ ),
43
+ dashed: seriesSet(lines.filter((entry) => entry.dashed)),
44
+ dots: solid.map((entry) => ({
45
+ color: entry.color,
46
+ data: definedData(frame, entry),
47
+ key: entry.key,
48
+ stroke: () => entry.color,
49
+ y: accessor(entry)
50
+ })),
51
+ lineColor: (solid[0] ?? lines[0])?.color ?? null,
52
+ references: frame.references.filter((reference) => reference.axis === axis).map((reference, index) => ({
53
+ key: `${axis}-${index}`,
54
+ position: reference.position === "start" ? "top-left" : "top-right",
55
+ text: reference.label || (scale ? scale.format(reference.value) : String(reference.value)),
56
+ value: reference.value
57
+ })),
58
+ solid: seriesSet(solid)
59
+ };
60
+ }
@@ -0,0 +1,49 @@
1
+ import type { LazyTextValue } from '#ui-tools/shared/types/utils';
2
+ import type { DashboardAlertAction, DashboardAlertSeverity, DashboardAlertsUi, DashboardBlockBaseProps, DashboardBlockUi, DashboardRowActions, DashboardSelected, DashboardSelectEvent, DashboardSourceLike, DashboardValueFormat } from '../types/index.js';
3
+ declare const __VLS_export: <TRow>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
4
+ props: import("vue").PublicProps & __VLS_PrettifyLocal<Omit<DashboardBlockBaseProps, "ui"> & {
5
+ source: DashboardSourceLike<readonly TRow[] | undefined>;
6
+ severity: (row: TRow) => DashboardAlertSeverity;
7
+ /** What needs attention. */
8
+ label: (row: TRow) => LazyTextValue;
9
+ description?: (row: TRow) => LazyTextValue | undefined;
10
+ /** Trailing figure (a count, an amount). Numbers go through `format`. */
11
+ value?: (row: TRow) => LazyTextValue | null | undefined;
12
+ format?: DashboardValueFormat;
13
+ /** Icon of the row. Defaults to the severity's icon. */
14
+ icon?: (row: TRow) => string | undefined;
15
+ /** Button at the end of the row (a link or a handler). */
16
+ action?: (row: TRow) => DashboardAlertAction | null | undefined;
17
+ /** `severity` (default): most severe first, ties in source order. `source`: as received. */
18
+ order?: "severity" | "source";
19
+ /** Rows shown in the card. The expand dialog, table view, and CSV export show them all. */
20
+ limit?: number;
21
+ rowKey?: (row: TRow, index: number) => PropertyKey;
22
+ /** Rows shown as selected (the value a `select` handler stored). */
23
+ selected?: DashboardSelected<TRow>;
24
+ /** More actions of each row: inline icon buttons and a `⋮` menu after its `action`. */
25
+ rowActions?: DashboardRowActions<TRow>;
26
+ /** Makes each row a button (next to its `action`). */
27
+ onSelect?: (event: DashboardSelectEvent<TRow>) => void;
28
+ ui?: DashboardBlockUi & DashboardAlertsUi;
29
+ }> & (typeof globalThis extends {
30
+ __VLS_PROPS_FALLBACK: infer P;
31
+ } ? P : {});
32
+ expose: (exposed: {}) => void;
33
+ attrs: any;
34
+ slots: {
35
+ 'header-right'?: () => unknown;
36
+ toolbar?: () => unknown;
37
+ footer?: () => unknown;
38
+ };
39
+ emit: {};
40
+ }>) => import("vue").VNode & {
41
+ __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
42
+ };
43
+ declare const _default: typeof __VLS_export;
44
+ export default _default;
45
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
46
+ [K in keyof T]: T[K];
47
+ } : {
48
+ [K in keyof T as K]: T[K];
49
+ }) & {};