@blokkli/editor 2.0.0-alpha.35 → 2.0.0-alpha.36

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 (199) hide show
  1. package/dist/global/types/blockOptions.d.ts +9 -2
  2. package/dist/global/types/definitions.d.ts +12 -5
  3. package/dist/module.d.mts +2 -2
  4. package/dist/module.json +1 -1
  5. package/dist/module.mjs +56 -4
  6. package/dist/modules/agent/index.d.mts +1 -1
  7. package/dist/modules/agent/index.mjs +38 -20
  8. package/dist/modules/agent/runtime/app/composables/agentProvider.d.ts +2 -2
  9. package/dist/modules/agent/runtime/app/composables/agentProvider.js +3 -3
  10. package/dist/modules/agent/runtime/app/features/agent/Panel/Input/Actions/index.vue +34 -60
  11. package/dist/modules/agent/runtime/app/features/agent/Transcript/index.d.vue.ts +8 -0
  12. package/dist/modules/agent/runtime/app/features/agent/Transcript/index.vue +138 -0
  13. package/dist/modules/agent/runtime/app/features/agent/Transcript/index.vue.d.ts +8 -0
  14. package/dist/modules/agent/runtime/app/features/agent/index.vue +5 -1
  15. package/dist/modules/agent/runtime/app/tools/get_bundle_info/index.js +175 -0
  16. package/dist/modules/agent/runtime/app/tools/get_paragraph_context/index.js +5 -0
  17. package/dist/modules/agent/runtime/app/tools/schemas.d.ts +10 -1
  18. package/dist/modules/agent/runtime/app/tools/schemas.js +36 -23
  19. package/dist/modules/agent/runtime/server/Session.d.ts +4 -2
  20. package/dist/modules/agent/runtime/server/Session.js +61 -57
  21. package/dist/modules/agent/runtime/server/agentPrompt.d.ts +9 -1
  22. package/dist/modules/agent/runtime/server/agentPrompt.js +26 -0
  23. package/dist/modules/agent/runtime/shared/types.d.ts +35 -1
  24. package/dist/modules/charts/index.d.mts +35 -0
  25. package/dist/modules/charts/index.mjs +43 -0
  26. package/dist/modules/charts/runtime/blokkli/skills/charts.d.ts +2 -0
  27. package/dist/modules/charts/runtime/blokkli/skills/charts.js +42 -0
  28. package/dist/modules/charts/runtime/blokkli/tools/chart_schemas.d.ts +63 -0
  29. package/dist/modules/charts/runtime/blokkli/tools/chart_schemas.js +98 -0
  30. package/dist/modules/charts/runtime/blokkli/tools/create_chart/index.d.ts +2 -0
  31. package/dist/modules/charts/runtime/blokkli/tools/create_chart/index.js +86 -0
  32. package/dist/modules/charts/runtime/blokkli/tools/get_chart_data/index.d.ts +2 -0
  33. package/dist/modules/charts/runtime/blokkli/tools/get_chart_data/index.js +74 -0
  34. package/dist/modules/charts/runtime/blokkli/tools/get_chart_type_options/index.d.ts +2 -0
  35. package/dist/modules/charts/runtime/blokkli/tools/get_chart_type_options/index.js +42 -0
  36. package/dist/modules/charts/runtime/blokkli/tools/update_chart/index.d.ts +2 -0
  37. package/dist/modules/charts/runtime/blokkli/tools/update_chart/index.js +101 -0
  38. package/dist/modules/charts/runtime/chartTypes/area.d.ts +2 -0
  39. package/dist/modules/charts/runtime/chartTypes/area.js +68 -0
  40. package/dist/modules/charts/runtime/chartTypes/bar.d.ts +2 -0
  41. package/dist/modules/charts/runtime/chartTypes/bar.js +76 -0
  42. package/dist/modules/charts/runtime/chartTypes/define.d.ts +2 -0
  43. package/dist/modules/charts/runtime/chartTypes/define.js +3 -0
  44. package/dist/modules/charts/runtime/chartTypes/donut.d.ts +2 -0
  45. package/dist/modules/charts/runtime/chartTypes/donut.js +45 -0
  46. package/dist/modules/charts/runtime/chartTypes/heatmap.d.ts +2 -0
  47. package/dist/modules/charts/runtime/chartTypes/heatmap.js +54 -0
  48. package/dist/modules/charts/runtime/chartTypes/index.d.ts +21 -0
  49. package/dist/modules/charts/runtime/chartTypes/index.js +47 -0
  50. package/dist/modules/charts/runtime/chartTypes/line.d.ts +2 -0
  51. package/dist/modules/charts/runtime/chartTypes/line.js +68 -0
  52. package/dist/modules/charts/runtime/chartTypes/pie.d.ts +2 -0
  53. package/dist/modules/charts/runtime/chartTypes/pie.js +28 -0
  54. package/dist/modules/charts/runtime/chartTypes/radar.d.ts +2 -0
  55. package/dist/modules/charts/runtime/chartTypes/radar.js +52 -0
  56. package/dist/modules/charts/runtime/chartTypes/radialBar.d.ts +2 -0
  57. package/dist/modules/charts/runtime/chartTypes/radialBar.js +44 -0
  58. package/dist/modules/charts/runtime/chartTypes/shared.d.ts +52 -0
  59. package/dist/modules/charts/runtime/chartTypes/shared.js +103 -0
  60. package/dist/modules/charts/runtime/chartTypes/types.d.ts +29 -0
  61. package/dist/modules/charts/runtime/chartTypes/types.js +0 -0
  62. package/dist/modules/charts/runtime/components/ChartRenderer/index.d.vue.ts +4 -0
  63. package/dist/modules/charts/runtime/components/ChartRenderer/index.vue +120 -0
  64. package/dist/modules/charts/runtime/components/ChartRenderer/index.vue.d.ts +4 -0
  65. package/dist/modules/charts/runtime/components/Fragment/BlokkliChart.d.vue.ts +3 -0
  66. package/dist/modules/charts/runtime/components/Fragment/BlokkliChart.vue +29 -0
  67. package/dist/modules/charts/runtime/components/Fragment/BlokkliChart.vue.d.ts +3 -0
  68. package/dist/modules/charts/runtime/features/charts/Editor/ChartTypeOptions/index.d.vue.ts +15 -0
  69. package/dist/modules/charts/runtime/features/charts/Editor/ChartTypeOptions/index.vue +97 -0
  70. package/dist/modules/charts/runtime/features/charts/Editor/ChartTypeOptions/index.vue.d.ts +15 -0
  71. package/dist/modules/charts/runtime/features/charts/Editor/ChartTypePicker/index.d.vue.ts +11 -0
  72. package/dist/modules/charts/runtime/features/charts/Editor/ChartTypePicker/index.vue +34 -0
  73. package/dist/modules/charts/runtime/features/charts/Editor/ChartTypePicker/index.vue.d.ts +11 -0
  74. package/dist/modules/charts/runtime/features/charts/Editor/ColorDropdown/index.d.vue.ts +12 -0
  75. package/dist/modules/charts/runtime/features/charts/Editor/ColorDropdown/index.vue +49 -0
  76. package/dist/modules/charts/runtime/features/charts/Editor/ColorDropdown/index.vue.d.ts +12 -0
  77. package/dist/modules/charts/runtime/features/charts/Editor/CsvImport/index.d.vue.ts +19 -0
  78. package/dist/modules/charts/runtime/features/charts/Editor/CsvImport/index.vue +90 -0
  79. package/dist/modules/charts/runtime/features/charts/Editor/CsvImport/index.vue.d.ts +19 -0
  80. package/dist/modules/charts/runtime/features/charts/Editor/DataTable/index.d.vue.ts +23 -0
  81. package/dist/modules/charts/runtime/features/charts/Editor/DataTable/index.vue +224 -0
  82. package/dist/modules/charts/runtime/features/charts/Editor/DataTable/index.vue.d.ts +23 -0
  83. package/dist/modules/charts/runtime/features/charts/Editor/FootnoteEditor/index.d.vue.ts +10 -0
  84. package/dist/modules/charts/runtime/features/charts/Editor/FootnoteEditor/index.vue +61 -0
  85. package/dist/modules/charts/runtime/features/charts/Editor/FootnoteEditor/index.vue.d.ts +10 -0
  86. package/dist/modules/charts/runtime/features/charts/Editor/Preview/index.d.vue.ts +8 -0
  87. package/dist/modules/charts/runtime/features/charts/Editor/Preview/index.vue +23 -0
  88. package/dist/modules/charts/runtime/features/charts/Editor/Preview/index.vue.d.ts +8 -0
  89. package/dist/modules/charts/runtime/features/charts/Editor/index.d.vue.ts +10 -0
  90. package/dist/modules/charts/runtime/features/charts/Editor/index.vue +243 -0
  91. package/dist/modules/charts/runtime/features/charts/Editor/index.vue.d.ts +10 -0
  92. package/dist/modules/charts/runtime/features/charts/Editor/useChartEditorState.d.ts +17 -0
  93. package/dist/modules/charts/runtime/features/charts/Editor/useChartEditorState.js +90 -0
  94. package/dist/modules/charts/runtime/features/charts/index.d.vue.ts +3 -0
  95. package/dist/modules/charts/runtime/features/charts/index.vue +72 -0
  96. package/dist/modules/charts/runtime/features/charts/index.vue.d.ts +3 -0
  97. package/dist/modules/charts/runtime/helpers/index.d.ts +1 -0
  98. package/dist/modules/charts/runtime/helpers/index.js +17 -0
  99. package/dist/modules/charts/runtime/types.d.ts +51 -0
  100. package/dist/modules/charts/runtime/types.js +64 -0
  101. package/dist/modules/drupal/graphql/features/fragments.graphql +2 -0
  102. package/dist/modules/drupal/index.d.mts +1 -1
  103. package/dist/modules/drupal/runtime/adapter/index.js +12 -8
  104. package/dist/modules/table-of-contents/index.d.mts +11 -0
  105. package/dist/modules/table-of-contents/index.mjs +24 -0
  106. package/dist/modules/table-of-contents/runtime/components/BlokkliTableOfContents/index.d.vue.ts +44 -0
  107. package/dist/modules/table-of-contents/runtime/components/BlokkliTableOfContents/index.vue +43 -0
  108. package/dist/modules/table-of-contents/runtime/components/BlokkliTableOfContents/index.vue.d.ts +44 -0
  109. package/dist/modules/table-of-contents/runtime/types/index.d.ts +4 -0
  110. package/dist/modules/table-of-contents/runtime/types/index.js +0 -0
  111. package/dist/runtime/components/Blocks/Fragment/index.vue +6 -2
  112. package/dist/runtime/components/BlokkliItem.vue +8 -3
  113. package/dist/runtime/components/BlokkliProvider.d.vue.ts +7 -0
  114. package/dist/runtime/components/BlokkliProvider.vue +7 -1
  115. package/dist/runtime/components/BlokkliProvider.vue.d.ts +7 -0
  116. package/dist/runtime/composables/useBlokkliHelper.js +4 -2
  117. package/dist/runtime/editor/components/AnimationCanvas/index.vue +4 -20
  118. package/dist/runtime/editor/components/Banner/index.d.vue.ts +12 -2
  119. package/dist/runtime/editor/components/Banner/index.vue +4 -2
  120. package/dist/runtime/editor/components/Banner/index.vue.d.ts +12 -2
  121. package/dist/runtime/editor/components/Dropdown/index.d.vue.ts +27 -0
  122. package/dist/runtime/editor/components/Dropdown/index.vue +107 -0
  123. package/dist/runtime/editor/components/Dropdown/index.vue.d.ts +27 -0
  124. package/dist/{modules/agent/runtime/app/features/agent/Panel/Input/Actions → runtime/editor/components}/DropdownItem/index.vue +1 -1
  125. package/dist/runtime/editor/components/EditProvider.d.vue.ts +2 -0
  126. package/dist/runtime/editor/components/EditProvider.vue +4 -3
  127. package/dist/runtime/editor/components/EditProvider.vue.d.ts +2 -0
  128. package/dist/runtime/editor/components/Form/Radio/index.d.vue.ts +1 -0
  129. package/dist/runtime/editor/components/Form/Radio/index.vue +3 -2
  130. package/dist/runtime/editor/components/Form/Radio/index.vue.d.ts +1 -0
  131. package/dist/runtime/editor/components/ItemIcon/index.vue +10 -2
  132. package/dist/runtime/editor/components/NestedEditorOverlay/index.d.vue.ts +13 -3
  133. package/dist/runtime/editor/components/NestedEditorOverlay/index.vue +15 -7
  134. package/dist/runtime/editor/components/NestedEditorOverlay/index.vue.d.ts +13 -3
  135. package/dist/runtime/editor/components/PreviewProvider.d.vue.ts +2 -0
  136. package/dist/runtime/editor/components/PreviewProvider.vue +3 -2
  137. package/dist/runtime/editor/components/PreviewProvider.vue.d.ts +2 -0
  138. package/dist/runtime/editor/components/ShortcutIndicator/index.vue +1 -1
  139. package/dist/runtime/editor/components/index.d.ts +3 -1
  140. package/dist/runtime/editor/components/index.js +4 -0
  141. package/dist/runtime/editor/composables/onElementResize.js +0 -1
  142. package/dist/runtime/editor/composables/useEditableFieldOverride.js +4 -5
  143. package/dist/runtime/editor/css/output.css +1 -1
  144. package/dist/runtime/editor/events/index.d.ts +7 -0
  145. package/dist/runtime/editor/features/add-list/Help/Item.vue +5 -2
  146. package/dist/runtime/editor/features/artboard/Renderer.vue +1 -1
  147. package/dist/runtime/editor/features/clipboard/index.vue +1 -1
  148. package/dist/runtime/editor/features/debug/index.vue +1 -1
  149. package/dist/runtime/editor/features/dev-mode/index.vue +86 -2
  150. package/dist/runtime/editor/features/edit/index.vue +20 -0
  151. package/dist/runtime/editor/features/fragments/types.d.ts +1 -0
  152. package/dist/runtime/editor/features/hover/Renderer/index.vue +30 -3
  153. package/dist/runtime/editor/features/hover/index.vue +1 -1
  154. package/dist/runtime/editor/features/options/Form/Checkbox/index.d.vue.ts +2 -2
  155. package/dist/runtime/editor/features/options/Form/Checkbox/index.vue +3 -3
  156. package/dist/runtime/editor/features/options/Form/Checkbox/index.vue.d.ts +2 -2
  157. package/dist/runtime/editor/features/options/Form/Checkboxes/index.d.vue.ts +2 -2
  158. package/dist/runtime/editor/features/options/Form/Checkboxes/index.vue +5 -5
  159. package/dist/runtime/editor/features/options/Form/Checkboxes/index.vue.d.ts +2 -2
  160. package/dist/runtime/editor/features/options/Form/Item.d.vue.ts +2 -2
  161. package/dist/runtime/editor/features/options/Form/Item.vue +14 -48
  162. package/dist/runtime/editor/features/options/Form/Item.vue.d.ts +2 -2
  163. package/dist/runtime/editor/features/options/Form/Number/index.d.vue.ts +3 -3
  164. package/dist/runtime/editor/features/options/Form/Number/index.vue +7 -17
  165. package/dist/runtime/editor/features/options/Form/Number/index.vue.d.ts +3 -3
  166. package/dist/runtime/editor/features/options/Form/Range/index.d.vue.ts +2 -2
  167. package/dist/runtime/editor/features/options/Form/Range/index.vue +4 -4
  168. package/dist/runtime/editor/features/options/Form/Range/index.vue.d.ts +2 -2
  169. package/dist/runtime/editor/features/options/Form/index.vue +10 -5
  170. package/dist/runtime/editor/features/selection/index.vue +2 -2
  171. package/dist/runtime/editor/features/transform/index.vue +1 -3
  172. package/dist/runtime/editor/plugins/Sidebar/index.d.vue.ts +1 -1
  173. package/dist/runtime/editor/plugins/Sidebar/index.vue.d.ts +1 -1
  174. package/dist/runtime/editor/providers/definition.d.ts +2 -2
  175. package/dist/runtime/editor/providers/definition.js +7 -1
  176. package/dist/runtime/editor/providers/dom.d.ts +5 -0
  177. package/dist/runtime/editor/providers/dom.js +11 -2
  178. package/dist/runtime/editor/providers/fields.d.ts +19 -1
  179. package/dist/runtime/editor/providers/fields.js +54 -2
  180. package/dist/runtime/editor/translations/de.json +269 -1
  181. package/dist/runtime/editor/translations/fr.json +269 -1
  182. package/dist/runtime/editor/translations/gsw_CH.json +269 -1
  183. package/dist/runtime/editor/translations/it.json +269 -1
  184. package/dist/runtime/helpers/imports/index.d.ts +8 -1
  185. package/dist/runtime/helpers/imports/index.js +15 -6
  186. package/dist/runtime/helpers/injections.d.ts +5 -1
  187. package/dist/runtime/helpers/injections.js +3 -0
  188. package/dist/runtime/helpers/runtimeHelpers/index.js +14 -0
  189. package/dist/runtime/types/definitions.d.ts +8 -5
  190. package/dist/runtime/types/provider.d.ts +2 -0
  191. package/dist/shared/editor.6D5vApr0.mjs +30 -0
  192. package/dist/shared/{editor.DMFfaLVE.mjs → editor.BFIzNSQM.mjs} +1 -30
  193. package/dist/shared/{editor.Iax3GCvt.d.mts → editor.CWQIFIEQ.d.mts} +22 -0
  194. package/dist/types.d.mts +1 -1
  195. package/package.json +17 -1
  196. package/dist/modules/agent/runtime/app/tools/get_available_bundles/index.js +0 -104
  197. /package/dist/modules/agent/runtime/app/tools/{get_available_bundles → get_bundle_info}/index.d.ts +0 -0
  198. /package/dist/{modules/agent/runtime/app/features/agent/Panel/Input/Actions → runtime/editor/components}/DropdownItem/index.d.vue.ts +0 -0
  199. /package/dist/{modules/agent/runtime/app/features/agent/Panel/Input/Actions → runtime/editor/components}/DropdownItem/index.vue.d.ts +0 -0
@@ -0,0 +1,49 @@
1
+ <template>
2
+ <Dropdown position="top-left">
3
+ <template #button>
4
+ <span
5
+ class="bk-chart-color-swatch"
6
+ :style="{ backgroundColor: displayColor }"
7
+ />
8
+ </template>
9
+ <template #default="{ close }">
10
+ <button
11
+ v-for="(entry, id) in colors"
12
+ :key="id"
13
+ type="button"
14
+ class="bk-chart-color-option"
15
+ :class="{ 'is-active': colorId === id }"
16
+ @click="
17
+ () => {
18
+ emit('select', id);
19
+ close();
20
+ }
21
+ "
22
+ >
23
+ <span
24
+ class="bk-chart-color-swatch"
25
+ :style="{ backgroundColor: entry.color }"
26
+ />
27
+ <span>{{ entry.label }}</span>
28
+ </button>
29
+ </template>
30
+ </Dropdown>
31
+ </template>
32
+
33
+ <script setup>
34
+ import { computed } from "#imports";
35
+ import { Dropdown } from "#blokkli/editor/components";
36
+ const props = defineProps({
37
+ colorId: { type: String, required: true },
38
+ colors: { type: Object, required: true }
39
+ });
40
+ const emit = defineEmits(["select"]);
41
+ const displayColor = computed(() => {
42
+ const entry = props.colors[props.colorId];
43
+ if (entry) {
44
+ return entry.color;
45
+ }
46
+ const first = Object.values(props.colors)[0];
47
+ return first?.color || "#888888";
48
+ });
49
+ </script>
@@ -0,0 +1,12 @@
1
+ import type { ChartColor } from '../../../../types.js';
2
+ type __VLS_Props = {
3
+ colorId: string;
4
+ colors: Record<string, ChartColor>;
5
+ };
6
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
7
+ select: (colorId: string) => any;
8
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
9
+ onSelect?: ((colorId: string) => any) | undefined;
10
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
11
+ declare const _default: typeof __VLS_export;
12
+ export default _default;
@@ -0,0 +1,19 @@
1
+ import type { ChartSeries, ChartColor } from '../../../../types.js';
2
+ type __VLS_Props = {
3
+ colors: Record<string, ChartColor>;
4
+ };
5
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
6
+ import: (payload: {
7
+ categories: string[];
8
+ series: ChartSeries[];
9
+ categoryColors: string[];
10
+ }) => any;
11
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
12
+ onImport?: ((payload: {
13
+ categories: string[];
14
+ series: ChartSeries[];
15
+ categoryColors: string[];
16
+ }) => any) | undefined;
17
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
18
+ declare const _default: typeof __VLS_export;
19
+ export default _default;
@@ -0,0 +1,90 @@
1
+ <template>
2
+ <button
3
+ type="button"
4
+ class="bk-button bk-is-small"
5
+ @click="fileInputEl?.click()"
6
+ >
7
+ {{ $t("chartsImportCsv", "Import CSV") }}
8
+ </button>
9
+ <input
10
+ ref="fileInputEl"
11
+ type="file"
12
+ accept=".csv,text/csv"
13
+ class="bk-chart-data-table-file-input"
14
+ @change="onFileChange"
15
+ />
16
+ </template>
17
+
18
+ <script setup>
19
+ import { useTemplateRef, useBlokkli } from "#imports";
20
+ import { getColorIdAtIndex } from "../../../../types";
21
+ import { parseNumericInput } from "../../../../helpers";
22
+ const props = defineProps({
23
+ colors: { type: Object, required: true }
24
+ });
25
+ const emit = defineEmits(["import"]);
26
+ const { $t } = useBlokkli();
27
+ const fileInputEl = useTemplateRef("fileInputEl");
28
+ function parseCsvLine(line) {
29
+ const cells = [];
30
+ let current = "";
31
+ let inQuotes = false;
32
+ for (let i = 0; i < line.length; i++) {
33
+ const char = line[i];
34
+ if (inQuotes) {
35
+ if (char === '"' && line[i + 1] === '"') {
36
+ current += '"';
37
+ i++;
38
+ } else if (char === '"') {
39
+ inQuotes = false;
40
+ } else {
41
+ current += char;
42
+ }
43
+ } else if (char === '"') {
44
+ inQuotes = true;
45
+ } else if (char === "," || char === ";" || char === " ") {
46
+ cells.push(current.trim());
47
+ current = "";
48
+ } else {
49
+ current += char;
50
+ }
51
+ }
52
+ cells.push(current.trim());
53
+ return cells;
54
+ }
55
+ function onFileChange(event) {
56
+ const input = event.target;
57
+ const file = input.files?.[0];
58
+ if (!file) return;
59
+ const reader = new FileReader();
60
+ reader.onload = (e) => {
61
+ const text = e.target?.result;
62
+ if (typeof text !== "string") return;
63
+ const lines = text.split(/\r?\n/).map((l) => l.trim()).filter((l) => l.length > 0);
64
+ if (lines.length < 2) return;
65
+ const header = parseCsvLine(lines[0]);
66
+ const seriesNames = header.slice(1);
67
+ if (seriesNames.length === 0) return;
68
+ const categories = [];
69
+ const seriesData = seriesNames.map(() => []);
70
+ for (let i = 1; i < lines.length; i++) {
71
+ const cells = parseCsvLine(lines[i]);
72
+ categories.push(cells[0] || `Category ${i}`);
73
+ for (let si = 0; si < seriesNames.length; si++) {
74
+ seriesData[si].push(parseNumericInput(cells[si + 1] || ""));
75
+ }
76
+ }
77
+ const series = seriesNames.map((name, i) => ({
78
+ name: name || `Series ${i + 1}`,
79
+ color: getColorIdAtIndex(i, props.colors),
80
+ data: seriesData[i]
81
+ }));
82
+ const categoryColors = categories.map(
83
+ (_, i) => getColorIdAtIndex(i, props.colors)
84
+ );
85
+ emit("import", { categories, series, categoryColors });
86
+ };
87
+ reader.readAsText(file);
88
+ input.value = "";
89
+ }
90
+ </script>
@@ -0,0 +1,19 @@
1
+ import type { ChartSeries, ChartColor } from '../../../../types.js';
2
+ type __VLS_Props = {
3
+ colors: Record<string, ChartColor>;
4
+ };
5
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
6
+ import: (payload: {
7
+ categories: string[];
8
+ series: ChartSeries[];
9
+ categoryColors: string[];
10
+ }) => any;
11
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
12
+ onImport?: ((payload: {
13
+ categories: string[];
14
+ series: ChartSeries[];
15
+ categoryColors: string[];
16
+ }) => any) | undefined;
17
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
18
+ declare const _default: typeof __VLS_export;
19
+ export default _default;
@@ -0,0 +1,23 @@
1
+ import type { ChartSeries, ChartColor } from '../../../../types.js';
2
+ type __VLS_Props = {
3
+ categories: string[];
4
+ series: ChartSeries[];
5
+ categoryColors: string[];
6
+ hasMultipleSeries: boolean;
7
+ hasSeriesColors: boolean;
8
+ hasCategoryColors: boolean;
9
+ colors: Record<string, ChartColor>;
10
+ removeRow: (index: number) => void;
11
+ removeSeries: (index: number) => void;
12
+ };
13
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
14
+ "update:categories": (value: string[]) => any;
15
+ "update:series": (value: ChartSeries[]) => any;
16
+ "update:categoryColors": (value: string[]) => any;
17
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
18
+ "onUpdate:categories"?: ((value: string[]) => any) | undefined;
19
+ "onUpdate:series"?: ((value: ChartSeries[]) => any) | undefined;
20
+ "onUpdate:categoryColors"?: ((value: string[]) => any) | undefined;
21
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
22
+ declare const _default: typeof __VLS_export;
23
+ export default _default;
@@ -0,0 +1,224 @@
1
+ <template>
2
+ <table
3
+ class="bk-chart-data-table"
4
+ @keydown="onTableKeydown"
5
+ @input="onTableInput"
6
+ @click="onTableClick"
7
+ >
8
+ <thead v-if="hasMultipleSeries">
9
+ <tr>
10
+ <th />
11
+ <th v-for="(s, si) in visibleSeries" :key="si">
12
+ <div class="bk-chart-data-table-series-header">
13
+ <ColorDropdown
14
+ v-if="hasSeriesColors"
15
+ :color-id="s.color"
16
+ :colors="colors"
17
+ @select="updateSeriesColor(si, $event)"
18
+ />
19
+ <input
20
+ type="text"
21
+ :value="s.name"
22
+ class="bk-chart-data-table-series-name"
23
+ @change="
24
+ updateSeriesName(si, $event.target.value)
25
+ "
26
+ />
27
+ <button
28
+ v-if="series.length > 1"
29
+ type="button"
30
+ class="bk-chart-data-table-remove"
31
+ @click="props.removeSeries(si)"
32
+ >
33
+ <Icon name="bk_mdi_delete" />
34
+ </button>
35
+ </div>
36
+ </th>
37
+ <th v-if="canDeleteRows" />
38
+ </tr>
39
+ </thead>
40
+ <tbody>
41
+ <tr v-for="(cat, ci) in categories" :key="ci">
42
+ <td>
43
+ <div class="bk-chart-data-table-category-cell">
44
+ <ColorDropdown
45
+ v-if="hasCategoryColors"
46
+ :color-id="categoryColors[ci] || ''"
47
+ :colors="colors"
48
+ @select="updateCategoryColor(ci, $event)"
49
+ />
50
+ <input
51
+ type="text"
52
+ :value="cat"
53
+ @change="
54
+ updateCategory(ci, $event.target.value)
55
+ "
56
+ />
57
+ </div>
58
+ </td>
59
+ <td v-for="(s, si) in visibleSeries" :key="si">
60
+ <input
61
+ type="text"
62
+ inputmode="decimal"
63
+ :value="s.data[ci]"
64
+ @blur="
65
+ updateValue(si, ci, $event.target.value)
66
+ "
67
+ />
68
+ </td>
69
+ <td v-if="canDeleteRows">
70
+ <button
71
+ type="button"
72
+ class="bk-chart-data-table-remove"
73
+ @click="props.removeRow(ci)"
74
+ >
75
+ <Icon name="bk_mdi_delete" />
76
+ </button>
77
+ </td>
78
+ </tr>
79
+ </tbody>
80
+ </table>
81
+ </template>
82
+
83
+ <script setup>
84
+ import { computed, ref } from "#imports";
85
+ import { parseNumericInput } from "../../../../helpers";
86
+ import { Icon } from "#blokkli/editor/components";
87
+ import ColorDropdown from "../ColorDropdown/index.vue";
88
+ const props = defineProps({
89
+ categories: { type: Array, required: true },
90
+ series: { type: Array, required: true },
91
+ categoryColors: { type: Array, required: true },
92
+ hasMultipleSeries: { type: Boolean, required: true },
93
+ hasSeriesColors: { type: Boolean, required: true },
94
+ hasCategoryColors: { type: Boolean, required: true },
95
+ colors: { type: Object, required: true },
96
+ removeRow: { type: Function, required: true },
97
+ removeSeries: { type: Function, required: true }
98
+ });
99
+ const emit = defineEmits(["update:categories", "update:series", "update:categoryColors"]);
100
+ const visibleSeries = computed(
101
+ () => props.hasMultipleSeries ? props.series : props.series.slice(0, 1)
102
+ );
103
+ const canDeleteRows = computed(() => props.categories.length > 1);
104
+ function updateCategory(index, value) {
105
+ if (props.categories[index] === value) return;
106
+ const updated = [...props.categories];
107
+ updated[index] = value;
108
+ emit("update:categories", updated);
109
+ }
110
+ function updateValue(seriesIndex, categoryIndex, raw) {
111
+ const value = parseNumericInput(raw);
112
+ if (props.series[seriesIndex]?.data[categoryIndex] === value) return;
113
+ const updated = props.series.map((s, si) => {
114
+ if (si !== seriesIndex) return s;
115
+ const data = [...s.data];
116
+ data[categoryIndex] = value;
117
+ return { ...s, data };
118
+ });
119
+ emit("update:series", updated);
120
+ }
121
+ function updateSeriesName(index, name) {
122
+ emit(
123
+ "update:series",
124
+ props.series.map((s, i) => i === index ? { ...s, name } : s)
125
+ );
126
+ }
127
+ function updateSeriesColor(index, colorId) {
128
+ emit(
129
+ "update:series",
130
+ props.series.map((s, i) => i === index ? { ...s, color: colorId } : s)
131
+ );
132
+ }
133
+ function updateCategoryColor(index, colorId) {
134
+ const updated = [...props.categoryColors];
135
+ updated[index] = colorId;
136
+ emit("update:categoryColors", updated);
137
+ }
138
+ const editing = ref(false);
139
+ function onTableInput(e) {
140
+ if (e.target instanceof HTMLInputElement) {
141
+ editing.value = true;
142
+ }
143
+ }
144
+ function onTableClick(e) {
145
+ if (e.target instanceof HTMLInputElement) {
146
+ editing.value = true;
147
+ }
148
+ }
149
+ function onTableKeydown(e) {
150
+ const { key } = e;
151
+ if (key !== "ArrowUp" && key !== "ArrowDown" && key !== "ArrowLeft" && key !== "ArrowRight" && key !== "Enter" && key !== "F2" && key !== "Escape") {
152
+ return;
153
+ }
154
+ const active = document.activeElement;
155
+ if (!(active instanceof HTMLElement)) return;
156
+ if (key === "F2" && active instanceof HTMLInputElement) {
157
+ editing.value = true;
158
+ const len = active.value.length;
159
+ active.setSelectionRange(len, len);
160
+ e.preventDefault();
161
+ return;
162
+ }
163
+ if (key === "Escape" && active instanceof HTMLInputElement) {
164
+ editing.value = false;
165
+ active.select();
166
+ e.preventDefault();
167
+ return;
168
+ }
169
+ if (key === "Enter" && !(active instanceof HTMLInputElement)) return;
170
+ if (key === "Enter" && !editing.value && !e.shiftKey) {
171
+ editing.value = true;
172
+ const input = active;
173
+ const len = input.value.length;
174
+ input.setSelectionRange(len, len);
175
+ e.preventDefault();
176
+ return;
177
+ }
178
+ const table = active.closest("table");
179
+ if (!table) return;
180
+ if (editing.value && active instanceof HTMLInputElement) {
181
+ const atStart = active.selectionStart === 0 && active.selectionEnd === 0;
182
+ const atEnd = active.selectionEnd === active.value.length && active.selectionStart === active.selectionEnd;
183
+ if (key === "ArrowLeft" && !atStart) return;
184
+ if (key === "ArrowRight" && !atEnd) return;
185
+ if (key === "ArrowUp" || key === "ArrowDown") return;
186
+ }
187
+ const cellSelector = "input, button";
188
+ const rows = Array.from(
189
+ table.querySelectorAll("thead > tr, tbody > tr")
190
+ );
191
+ let currentRow = -1;
192
+ let currentCol = -1;
193
+ for (let r = 0; r < rows.length; r++) {
194
+ const cells = Array.from(
195
+ rows[r].querySelectorAll(cellSelector)
196
+ );
197
+ const col = cells.indexOf(active);
198
+ if (col !== -1) {
199
+ currentRow = r;
200
+ currentCol = col;
201
+ break;
202
+ }
203
+ }
204
+ if (currentRow === -1) return;
205
+ let targetRow = currentRow;
206
+ let targetCol = currentCol;
207
+ if (key === "ArrowUp" || key === "Enter" && e.shiftKey) targetRow--;
208
+ else if (key === "ArrowDown" || key === "Enter" && !e.shiftKey) targetRow++;
209
+ else if (key === "ArrowLeft") targetCol--;
210
+ else if (key === "ArrowRight") targetCol++;
211
+ if (targetRow < 0 || targetRow >= rows.length) return;
212
+ const targetCells = Array.from(
213
+ rows[targetRow].querySelectorAll(cellSelector)
214
+ );
215
+ if (targetCol < 0 || targetCol >= targetCells.length) return;
216
+ e.preventDefault();
217
+ editing.value = false;
218
+ const target = targetCells[targetCol];
219
+ target.focus();
220
+ if (target instanceof HTMLInputElement) {
221
+ target.select();
222
+ }
223
+ }
224
+ </script>
@@ -0,0 +1,23 @@
1
+ import type { ChartSeries, ChartColor } from '../../../../types.js';
2
+ type __VLS_Props = {
3
+ categories: string[];
4
+ series: ChartSeries[];
5
+ categoryColors: string[];
6
+ hasMultipleSeries: boolean;
7
+ hasSeriesColors: boolean;
8
+ hasCategoryColors: boolean;
9
+ colors: Record<string, ChartColor>;
10
+ removeRow: (index: number) => void;
11
+ removeSeries: (index: number) => void;
12
+ };
13
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
14
+ "update:categories": (value: string[]) => any;
15
+ "update:series": (value: ChartSeries[]) => any;
16
+ "update:categoryColors": (value: string[]) => any;
17
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
18
+ "onUpdate:categories"?: ((value: string[]) => any) | undefined;
19
+ "onUpdate:series"?: ((value: ChartSeries[]) => any) | undefined;
20
+ "onUpdate:categoryColors"?: ((value: string[]) => any) | undefined;
21
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
22
+ declare const _default: typeof __VLS_export;
23
+ export default _default;
@@ -0,0 +1,10 @@
1
+ type __VLS_Props = {
2
+ footnotes: string[];
3
+ };
4
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
5
+ "update:footnotes": (value: string[]) => any;
6
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
7
+ "onUpdate:footnotes"?: ((value: string[]) => any) | undefined;
8
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
9
+ declare const _default: typeof __VLS_export;
10
+ export default _default;
@@ -0,0 +1,61 @@
1
+ <template>
2
+ <div class="bk-chart-data-table-footnotes">
3
+ <label class="bk-form-label">{{
4
+ $t("chartsFootnotes", "Footnotes")
5
+ }}</label>
6
+ <div
7
+ v-for="(note, i) in footnotes"
8
+ :key="i"
9
+ class="bk-chart-data-table-footnote-row"
10
+ >
11
+ <span class="bk-chart-data-table-footnote-marker">{{
12
+ superscriptFor(i + 1)
13
+ }}</span>
14
+ <input
15
+ type="text"
16
+ :value="note"
17
+ class="bk-form-input"
18
+ @change="updateFootnote(i, $event.target.value)"
19
+ />
20
+ <button
21
+ type="button"
22
+ class="bk-chart-data-table-remove"
23
+ @click="removeFootnote(i)"
24
+ >
25
+ <Icon name="bk_mdi_delete" />
26
+ </button>
27
+ </div>
28
+ <button type="button" class="bk-button bk-is-small" @click="addFootnote">
29
+ <Icon name="bk_mdi_add" />
30
+ {{ $t("chartsAddFootnote", "Add footnote") }}
31
+ </button>
32
+ </div>
33
+ </template>
34
+
35
+ <script setup>
36
+ import { useBlokkli } from "#imports";
37
+ import { SUPERSCRIPTS } from "../../../../types";
38
+ import { Icon } from "#blokkli/editor/components";
39
+ const { $t } = useBlokkli();
40
+ const props = defineProps({
41
+ footnotes: { type: Array, required: true }
42
+ });
43
+ const emit = defineEmits(["update:footnotes"]);
44
+ function superscriptFor(n) {
45
+ return String(n).split("").map((d) => SUPERSCRIPTS[d] || d).join("");
46
+ }
47
+ function updateFootnote(index, value) {
48
+ const updated = [...props.footnotes];
49
+ updated[index] = value;
50
+ emit("update:footnotes", updated);
51
+ }
52
+ function addFootnote() {
53
+ emit("update:footnotes", [...props.footnotes, ""]);
54
+ }
55
+ function removeFootnote(index) {
56
+ emit(
57
+ "update:footnotes",
58
+ props.footnotes.filter((_, i) => i !== index)
59
+ );
60
+ }
61
+ </script>
@@ -0,0 +1,10 @@
1
+ type __VLS_Props = {
2
+ footnotes: string[];
3
+ };
4
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
5
+ "update:footnotes": (value: string[]) => any;
6
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
7
+ "onUpdate:footnotes"?: ((value: string[]) => any) | undefined;
8
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
9
+ declare const _default: typeof __VLS_export;
10
+ export default _default;
@@ -0,0 +1,8 @@
1
+ import type { BlokkliChartData } from '../../../../types.js';
2
+ type __VLS_Props = {
3
+ data: BlokkliChartData | null;
4
+ stale: boolean;
5
+ };
6
+ 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>;
7
+ declare const _default: typeof __VLS_export;
8
+ export default _default;
@@ -0,0 +1,23 @@
1
+ <template>
2
+ <div :class="{ 'bk-is-stale': stale }">
3
+ <ChartRenderer v-if="data" v-bind="data" />
4
+ <div v-else class="bk-chart-preview-placeholder">
5
+ {{
6
+ $t(
7
+ "chartsPreviewPlaceholder",
8
+ 'Click "Refresh Preview" to see the chart.'
9
+ )
10
+ }}
11
+ </div>
12
+ </div>
13
+ </template>
14
+
15
+ <script setup>
16
+ import { useBlokkli } from "#imports";
17
+ import ChartRenderer from "../../../../components/ChartRenderer/index.vue";
18
+ const { $t } = useBlokkli();
19
+ defineProps({
20
+ data: { type: [Object, null], required: true },
21
+ stale: { type: Boolean, required: true }
22
+ });
23
+ </script>
@@ -0,0 +1,8 @@
1
+ import type { BlokkliChartData } from '../../../../types.js';
2
+ type __VLS_Props = {
3
+ data: BlokkliChartData | null;
4
+ stale: boolean;
5
+ };
6
+ 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>;
7
+ declare const _default: typeof __VLS_export;
8
+ export default _default;
@@ -0,0 +1,10 @@
1
+ import type { BlokkliChartData } from '../../../types.js';
2
+ type __VLS_Props = {
3
+ uuid: string;
4
+ };
5
+ declare function getData(): BlokkliChartData;
6
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
7
+ getData: typeof getData;
8
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
9
+ declare const _default: typeof __VLS_export;
10
+ export default _default;