@blokkli/editor 2.0.0-alpha.34 → 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 (204) 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 +9 -0
  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/BlokkliField.d.vue.ts +6 -0
  113. package/dist/runtime/components/BlokkliField.vue +4 -0
  114. package/dist/runtime/components/BlokkliField.vue.d.ts +6 -0
  115. package/dist/runtime/components/BlokkliItem.vue +8 -3
  116. package/dist/runtime/components/BlokkliProvider.d.vue.ts +7 -0
  117. package/dist/runtime/components/BlokkliProvider.vue +7 -1
  118. package/dist/runtime/components/BlokkliProvider.vue.d.ts +7 -0
  119. package/dist/runtime/composables/useBlokkliHelper.js +4 -2
  120. package/dist/runtime/editor/components/AnimationCanvas/index.vue +31 -22
  121. package/dist/runtime/editor/components/Banner/index.d.vue.ts +12 -2
  122. package/dist/runtime/editor/components/Banner/index.vue +4 -2
  123. package/dist/runtime/editor/components/Banner/index.vue.d.ts +12 -2
  124. package/dist/runtime/editor/components/DraggableList.d.vue.ts +2 -0
  125. package/dist/runtime/editor/components/DraggableList.vue +4 -1
  126. package/dist/runtime/editor/components/DraggableList.vue.d.ts +2 -0
  127. package/dist/runtime/editor/components/Dropdown/index.d.vue.ts +27 -0
  128. package/dist/runtime/editor/components/Dropdown/index.vue +107 -0
  129. package/dist/runtime/editor/components/Dropdown/index.vue.d.ts +27 -0
  130. package/dist/{modules/agent/runtime/app/features/agent/Panel/Input/Actions → runtime/editor/components}/DropdownItem/index.vue +1 -1
  131. package/dist/runtime/editor/components/EditProvider.d.vue.ts +2 -0
  132. package/dist/runtime/editor/components/EditProvider.vue +4 -3
  133. package/dist/runtime/editor/components/EditProvider.vue.d.ts +2 -0
  134. package/dist/runtime/editor/components/Form/Radio/index.d.vue.ts +1 -0
  135. package/dist/runtime/editor/components/Form/Radio/index.vue +3 -2
  136. package/dist/runtime/editor/components/Form/Radio/index.vue.d.ts +1 -0
  137. package/dist/runtime/editor/components/ItemIcon/index.vue +10 -2
  138. package/dist/runtime/editor/components/NestedEditorOverlay/index.d.vue.ts +13 -3
  139. package/dist/runtime/editor/components/NestedEditorOverlay/index.vue +15 -7
  140. package/dist/runtime/editor/components/NestedEditorOverlay/index.vue.d.ts +13 -3
  141. package/dist/runtime/editor/components/PreviewProvider.d.vue.ts +2 -0
  142. package/dist/runtime/editor/components/PreviewProvider.vue +3 -2
  143. package/dist/runtime/editor/components/PreviewProvider.vue.d.ts +2 -0
  144. package/dist/runtime/editor/components/ShortcutIndicator/index.vue +1 -1
  145. package/dist/runtime/editor/components/index.d.ts +3 -1
  146. package/dist/runtime/editor/components/index.js +4 -0
  147. package/dist/runtime/editor/composables/onElementResize.js +0 -1
  148. package/dist/runtime/editor/composables/useEditableFieldOverride.js +4 -5
  149. package/dist/runtime/editor/css/output.css +1 -1
  150. package/dist/runtime/editor/events/index.d.ts +7 -0
  151. package/dist/runtime/editor/features/add-list/Help/Item.vue +5 -2
  152. package/dist/runtime/editor/features/artboard/Renderer.vue +1 -1
  153. package/dist/runtime/editor/features/clipboard/index.vue +1 -1
  154. package/dist/runtime/editor/features/debug/index.vue +1 -1
  155. package/dist/runtime/editor/features/dev-mode/index.vue +86 -2
  156. package/dist/runtime/editor/features/edit/index.vue +20 -0
  157. package/dist/runtime/editor/features/fragments/types.d.ts +1 -0
  158. package/dist/runtime/editor/features/hover/Renderer/index.vue +30 -3
  159. package/dist/runtime/editor/features/hover/index.vue +1 -1
  160. package/dist/runtime/editor/features/options/Form/Checkbox/index.d.vue.ts +2 -2
  161. package/dist/runtime/editor/features/options/Form/Checkbox/index.vue +3 -3
  162. package/dist/runtime/editor/features/options/Form/Checkbox/index.vue.d.ts +2 -2
  163. package/dist/runtime/editor/features/options/Form/Checkboxes/index.d.vue.ts +2 -2
  164. package/dist/runtime/editor/features/options/Form/Checkboxes/index.vue +5 -5
  165. package/dist/runtime/editor/features/options/Form/Checkboxes/index.vue.d.ts +2 -2
  166. package/dist/runtime/editor/features/options/Form/Item.d.vue.ts +2 -2
  167. package/dist/runtime/editor/features/options/Form/Item.vue +14 -48
  168. package/dist/runtime/editor/features/options/Form/Item.vue.d.ts +2 -2
  169. package/dist/runtime/editor/features/options/Form/Number/index.d.vue.ts +3 -3
  170. package/dist/runtime/editor/features/options/Form/Number/index.vue +7 -17
  171. package/dist/runtime/editor/features/options/Form/Number/index.vue.d.ts +3 -3
  172. package/dist/runtime/editor/features/options/Form/Range/index.d.vue.ts +2 -2
  173. package/dist/runtime/editor/features/options/Form/Range/index.vue +4 -4
  174. package/dist/runtime/editor/features/options/Form/Range/index.vue.d.ts +2 -2
  175. package/dist/runtime/editor/features/options/Form/index.vue +10 -5
  176. package/dist/runtime/editor/features/selection/index.vue +2 -2
  177. package/dist/runtime/editor/features/transform/index.vue +1 -3
  178. package/dist/runtime/editor/providers/definition.d.ts +2 -2
  179. package/dist/runtime/editor/providers/definition.js +7 -1
  180. package/dist/runtime/editor/providers/dom.d.ts +5 -0
  181. package/dist/runtime/editor/providers/dom.js +11 -2
  182. package/dist/runtime/editor/providers/fields.d.ts +19 -1
  183. package/dist/runtime/editor/providers/fields.js +54 -2
  184. package/dist/runtime/editor/translations/de.json +269 -1
  185. package/dist/runtime/editor/translations/fr.json +269 -1
  186. package/dist/runtime/editor/translations/gsw_CH.json +269 -1
  187. package/dist/runtime/editor/translations/it.json +269 -1
  188. package/dist/runtime/editor/types/field.d.ts +2 -1
  189. package/dist/runtime/helpers/imports/index.d.ts +8 -1
  190. package/dist/runtime/helpers/imports/index.js +15 -6
  191. package/dist/runtime/helpers/injections.d.ts +10 -1
  192. package/dist/runtime/helpers/injections.js +6 -0
  193. package/dist/runtime/helpers/runtimeHelpers/index.js +14 -0
  194. package/dist/runtime/types/definitions.d.ts +8 -5
  195. package/dist/runtime/types/provider.d.ts +2 -0
  196. package/dist/shared/editor.6D5vApr0.mjs +30 -0
  197. package/dist/shared/{editor.DMFfaLVE.mjs → editor.BFIzNSQM.mjs} +1 -30
  198. package/dist/shared/{editor.Iax3GCvt.d.mts → editor.CWQIFIEQ.d.mts} +22 -0
  199. package/dist/types.d.mts +1 -1
  200. package/package.json +17 -1
  201. package/dist/modules/agent/runtime/app/tools/get_available_bundles/index.js +0 -104
  202. /package/dist/modules/agent/runtime/app/tools/{get_available_bundles → get_bundle_info}/index.d.ts +0 -0
  203. /package/dist/{modules/agent/runtime/app/features/agent/Panel/Input/Actions → runtime/editor/components}/DropdownItem/index.d.vue.ts +0 -0
  204. /package/dist/{modules/agent/runtime/app/features/agent/Panel/Input/Actions → runtime/editor/components}/DropdownItem/index.vue.d.ts +0 -0
@@ -0,0 +1,243 @@
1
+ <template>
2
+ <div class="bk-chart-editor" @wheel.capture.stop>
3
+ <div class="bk-chart-editor-top">
4
+ <div class="bk-chart-editor-top-actions">
5
+ <div class="bk-chart-editor-actions">
6
+ <button type="button" :disabled="!canUndo" @click="undo">
7
+ <Icon name="bk_mdi_undo" />
8
+ </button>
9
+ <button type="button" :disabled="!canRedo" @click="redo">
10
+ <Icon name="bk_mdi_redo" />
11
+ </button>
12
+ </div>
13
+
14
+ <ChartTypePicker v-model="data.type" />
15
+ </div>
16
+
17
+ <ChartTypeOptions
18
+ v-if="chartDef"
19
+ v-model:title="data.title"
20
+ :options="chartDef.editor.options"
21
+ :type-options="data.typeOptions || {}"
22
+ @update:type-options="data.typeOptions = $event"
23
+ />
24
+ </div>
25
+
26
+ <div class="bk-chart-editor-main">
27
+ <div class="bk-chart-editor-section">
28
+ <div class="bk-chart-editor-preview-header">
29
+ <label class="bk-form-label">{{
30
+ $t("chartsPreview", "Preview")
31
+ }}</label>
32
+ <div class="bk-chart-editor-preview-actions">
33
+ <button
34
+ v-if="!autoUpdate"
35
+ type="button"
36
+ class="bk-button bk-is-small"
37
+ @click="refreshPreview"
38
+ >
39
+ {{ $t("chartsRefreshPreview", "Refresh Preview") }}
40
+ </button>
41
+ <FormToggle
42
+ v-model="autoUpdate"
43
+ :label="$t('chartsAutoUpdate', 'Auto-update')"
44
+ />
45
+ </div>
46
+ </div>
47
+ <Preview :data="previewData" :stale="isStale" />
48
+ </div>
49
+
50
+ <div class="bk-chart-editor-section">
51
+ <label class="bk-form-label">{{ $t("chartsData", "Data") }}</label>
52
+ <DataTable
53
+ :categories="data.categories"
54
+ :series="data.series"
55
+ :category-colors="data.categoryColors"
56
+ :has-multiple-series="caps.hasMultipleSeries"
57
+ :has-series-colors="caps.hasSeriesColors"
58
+ :has-category-colors="caps.hasCategoryColors"
59
+ :colors="COLORS"
60
+ :remove-row="removeRow"
61
+ :remove-series="removeSeries"
62
+ @update:categories="data.categories = $event"
63
+ @update:series="data.series = $event"
64
+ @update:category-colors="data.categoryColors = $event"
65
+ />
66
+ <div class="bk-chart-data-table-actions">
67
+ <button type="button" class="bk-button bk-is-small" @click="addRow">
68
+ <Icon name="bk_mdi_add_row_below" />
69
+ {{ $t("chartsAddRow", "Add row") }}
70
+ </button>
71
+ <button
72
+ v-if="caps.hasMultipleSeries"
73
+ type="button"
74
+ class="bk-button bk-is-small"
75
+ @click="addSeries"
76
+ >
77
+ <Icon name="bk_mdi_add_column_right" />
78
+ {{ $t("chartsAddColumn", "Add column") }}
79
+ </button>
80
+ <CsvImport :colors="COLORS" @import="importData" />
81
+ </div>
82
+ </div>
83
+
84
+ <div class="bk-chart-editor-section">
85
+ <FootnoteEditor
86
+ :footnotes="data.footnotes"
87
+ @update:footnotes="data.footnotes = $event"
88
+ />
89
+ </div>
90
+ </div>
91
+ </div>
92
+ </template>
93
+
94
+ <script setup>
95
+ import { ref, computed, watch, useBlokkli, onBeforeUnmount } from "#imports";
96
+ import { getDefaultChartData, getFirstColorId } from "../../../types";
97
+ import { getChartType, getDefaultTypeOptions } from "../../../chartTypes";
98
+ import { COLORS } from "#blokkli-build/charts-config";
99
+ import { useChartEditorState } from "./useChartEditorState";
100
+ import { Icon, FormToggle } from "#blokkli/editor/components";
101
+ import ChartTypePicker from "./ChartTypePicker/index.vue";
102
+ import DataTable from "./DataTable/index.vue";
103
+ import CsvImport from "./CsvImport/index.vue";
104
+ import FootnoteEditor from "./FootnoteEditor/index.vue";
105
+ import Preview from "./Preview/index.vue";
106
+ import ChartTypeOptions from "./ChartTypeOptions/index.vue";
107
+ import { onBlokkliEvent } from "#blokkli/editor/composables";
108
+ const props = defineProps({
109
+ uuid: { type: String, required: true }
110
+ });
111
+ const { $t, state } = useBlokkli();
112
+ function getCurrentData() {
113
+ const rawData = state.mutatedOptions[props.uuid]?.data || state.getFieldListItem(props.uuid)?.options?.data;
114
+ if (rawData) {
115
+ try {
116
+ const parsed = JSON.parse(rawData);
117
+ if (parsed && Array.isArray(parsed.series) && parsed.series.length > 0) {
118
+ const fallbackId = getFirstColorId(COLORS);
119
+ for (const series of parsed.series) {
120
+ if (!COLORS[series.color]) {
121
+ series.color = fallbackId;
122
+ }
123
+ }
124
+ if (Array.isArray(parsed.categoryColors)) {
125
+ for (let i = 0; i < parsed.categoryColors.length; i++) {
126
+ if (!COLORS[parsed.categoryColors[i]]) {
127
+ parsed.categoryColors[i] = fallbackId;
128
+ }
129
+ }
130
+ } else {
131
+ parsed.categoryColors = parsed.categories.map(
132
+ (_, i) => {
133
+ const ids = Object.keys(COLORS);
134
+ return ids[i % ids.length] || fallbackId;
135
+ }
136
+ );
137
+ }
138
+ if (!Array.isArray(parsed.footnotes)) {
139
+ parsed.footnotes = [];
140
+ }
141
+ if (!parsed.typeOptions || typeof parsed.typeOptions !== "object") {
142
+ parsed.typeOptions = getDefaultTypeOptions(parsed.type);
143
+ }
144
+ return parsed;
145
+ }
146
+ } catch {
147
+ }
148
+ }
149
+ return getDefaultChartData(COLORS);
150
+ }
151
+ const {
152
+ data,
153
+ canUndo,
154
+ canRedo,
155
+ undo,
156
+ redo,
157
+ addRow,
158
+ addSeries,
159
+ removeRow,
160
+ removeSeries,
161
+ importData
162
+ } = useChartEditorState(getCurrentData(), COLORS);
163
+ const autoUpdate = ref(true);
164
+ const previewData = ref(
165
+ JSON.parse(JSON.stringify(data.value))
166
+ );
167
+ const isStale = ref(false);
168
+ let debounceTimer = null;
169
+ function refreshPreview() {
170
+ previewData.value = JSON.parse(JSON.stringify(data.value));
171
+ isStale.value = false;
172
+ }
173
+ watch(
174
+ data,
175
+ () => {
176
+ if (autoUpdate.value) {
177
+ if (debounceTimer) clearTimeout(debounceTimer);
178
+ isStale.value = true;
179
+ debounceTimer = setTimeout(refreshPreview, 500);
180
+ } else {
181
+ isStale.value = true;
182
+ }
183
+ },
184
+ { deep: true }
185
+ );
186
+ watch(autoUpdate, (enabled) => {
187
+ if (enabled) {
188
+ refreshPreview();
189
+ }
190
+ });
191
+ onBeforeUnmount(() => {
192
+ if (debounceTimer) clearTimeout(debounceTimer);
193
+ });
194
+ const chartDef = computed(() => getChartType(data.value.type, $t));
195
+ const caps = computed(() => {
196
+ const def = chartDef.value;
197
+ return {
198
+ hasMultipleSeries: def?.hasMultipleSeries ?? true,
199
+ hasSeriesColors: def?.hasSeriesColors ?? true,
200
+ hasCategoryColors: def?.hasCategoryColors ?? false
201
+ };
202
+ });
203
+ const typeOptionsCache = {
204
+ ...data.value.typeOptions
205
+ };
206
+ watch(
207
+ () => data.value.type,
208
+ (type) => {
209
+ const defaults = getDefaultTypeOptions(type);
210
+ const merged = {};
211
+ for (const key of Object.keys(defaults)) {
212
+ merged[key] = key in typeOptionsCache ? typeOptionsCache[key] : defaults[key];
213
+ }
214
+ data.value.typeOptions = merged;
215
+ }
216
+ );
217
+ watch(
218
+ () => data.value.typeOptions,
219
+ (opts) => {
220
+ if (opts) {
221
+ Object.assign(typeOptionsCache, opts);
222
+ }
223
+ },
224
+ { deep: true }
225
+ );
226
+ function getData() {
227
+ return data.value;
228
+ }
229
+ onBlokkliEvent("keyPressed", (e) => {
230
+ if (e.code === "z" && e.meta) {
231
+ e.originalEvent.preventDefault();
232
+ if (canUndo.value) {
233
+ undo();
234
+ }
235
+ } else if (e.code === "Z" && e.meta && e.shift) {
236
+ e.originalEvent.preventDefault();
237
+ if (canRedo.value) {
238
+ redo();
239
+ }
240
+ }
241
+ });
242
+ defineExpose({ getData });
243
+ </script>
@@ -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;
@@ -0,0 +1,17 @@
1
+ import type { BlokkliChartData, ChartColor, ChartSeries } from '../../../types.js';
2
+ export declare function useChartEditorState(initial: BlokkliChartData, colors: Record<string, ChartColor>): {
3
+ data: any;
4
+ canUndo: any;
5
+ canRedo: any;
6
+ undo: () => void;
7
+ redo: () => void;
8
+ addRow: () => void;
9
+ addSeries: () => void;
10
+ removeRow: (index: number) => void;
11
+ removeSeries: (index: number) => void;
12
+ importData: (payload: {
13
+ categories: string[];
14
+ series: ChartSeries[];
15
+ categoryColors: string[];
16
+ }) => void;
17
+ };
@@ -0,0 +1,90 @@
1
+ import { ref, watch, nextTick, computed } from "#imports";
2
+ import { getColorIdAtIndex } from "../../../types.js";
3
+ const MAX_HISTORY = 50;
4
+ function clone(v) {
5
+ return JSON.parse(JSON.stringify(v));
6
+ }
7
+ export function useChartEditorState(initial, colors) {
8
+ const data = ref(clone(initial));
9
+ const stack = ref([clone(initial)]);
10
+ const index = ref(0);
11
+ let isApplying = false;
12
+ const canUndo = computed(() => index.value > 0);
13
+ const canRedo = computed(() => index.value < stack.value.length - 1);
14
+ watch(
15
+ data,
16
+ (newVal) => {
17
+ if (isApplying) return;
18
+ stack.value.splice(index.value + 1);
19
+ stack.value.push(clone(newVal));
20
+ if (stack.value.length > MAX_HISTORY) {
21
+ stack.value.shift();
22
+ }
23
+ index.value = stack.value.length - 1;
24
+ },
25
+ { deep: true }
26
+ );
27
+ function undo() {
28
+ if (!canUndo.value) return;
29
+ isApplying = true;
30
+ index.value--;
31
+ data.value = clone(stack.value[index.value]);
32
+ nextTick(() => {
33
+ isApplying = false;
34
+ });
35
+ }
36
+ function redo() {
37
+ if (!canRedo.value) return;
38
+ isApplying = true;
39
+ index.value++;
40
+ data.value = clone(stack.value[index.value]);
41
+ nextTick(() => {
42
+ isApplying = false;
43
+ });
44
+ }
45
+ function addRow() {
46
+ data.value.categories.push(`Category ${data.value.categories.length + 1}`);
47
+ for (const s of data.value.series) {
48
+ s.data.push(0);
49
+ }
50
+ data.value.categoryColors.push(
51
+ getColorIdAtIndex(data.value.categoryColors.length, colors)
52
+ );
53
+ }
54
+ function addSeries() {
55
+ data.value.series.push({
56
+ name: `Series ${data.value.series.length + 1}`,
57
+ color: getColorIdAtIndex(data.value.series.length, colors),
58
+ data: Array.from({ length: data.value.categories.length }).fill(
59
+ 0
60
+ )
61
+ });
62
+ }
63
+ function removeRow(index2) {
64
+ data.value.categories.splice(index2, 1);
65
+ for (const s of data.value.series) {
66
+ s.data.splice(index2, 1);
67
+ }
68
+ data.value.categoryColors.splice(index2, 1);
69
+ }
70
+ function removeSeries(index2) {
71
+ data.value.series.splice(index2, 1);
72
+ }
73
+ function importData(payload) {
74
+ data.value.categories = payload.categories;
75
+ data.value.series = payload.series;
76
+ data.value.categoryColors = payload.categoryColors;
77
+ }
78
+ return {
79
+ data,
80
+ canUndo,
81
+ canRedo,
82
+ undo,
83
+ redo,
84
+ addRow,
85
+ addSeries,
86
+ removeRow,
87
+ removeSeries,
88
+ importData
89
+ };
90
+ }
@@ -0,0 +1,3 @@
1
+ declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ declare const _default: typeof __VLS_export;
3
+ export default _default;
@@ -0,0 +1,72 @@
1
+ <template>
2
+ <NestedEditorOverlay
3
+ v-if="uuid"
4
+ :uuid
5
+ :title="$t('chartsEditorTitle', 'Edit chart')"
6
+ icon="bk_mdi_area_chart"
7
+ theme="accent"
8
+ :element
9
+ @submit="onSubmit"
10
+ @close="onSubmit"
11
+ >
12
+ <ChartsEditor ref="editorRef" :uuid />
13
+ </NestedEditorOverlay>
14
+ </template>
15
+
16
+ <script setup>
17
+ import { onBlokkliEvent } from "#blokkli/editor/composables";
18
+ import {
19
+ defineBlokkliFeature,
20
+ ref,
21
+ useTemplateRef,
22
+ useBlokkli,
23
+ computed
24
+ } from "#imports";
25
+ import { NestedEditorOverlay } from "#blokkli/editor/components";
26
+ import ChartsEditor from "./Editor/index.vue";
27
+ defineBlokkliFeature({
28
+ id: "charts",
29
+ icon: "bk_mdi_area_chart",
30
+ label: "Charts",
31
+ description: "Add and edit interactive charts.",
32
+ requiredAdapterMethods: ["updateOptions"]
33
+ });
34
+ const { $t, state, adapter, dom, blocks } = useBlokkli();
35
+ const uuid = ref(null);
36
+ const element = computed(() => {
37
+ if (!uuid.value) {
38
+ return null;
39
+ }
40
+ const block = blocks.getBlock(uuid.value);
41
+ if (!block) {
42
+ return null;
43
+ }
44
+ return dom.getDragElement(block);
45
+ });
46
+ const isLoading = ref(false);
47
+ const editorRef = useTemplateRef("editorRef");
48
+ async function onSubmit() {
49
+ if (!uuid.value || !editorRef.value) return;
50
+ const chartData = editorRef.value.getData();
51
+ isLoading.value = true;
52
+ await state.mutateWithLoadingState(
53
+ () => adapter.updateOptions([
54
+ {
55
+ uuid: uuid.value,
56
+ key: "data",
57
+ value: JSON.stringify(chartData)
58
+ }
59
+ ]),
60
+ $t("chartsEditorSaveError", "The chart could not be saved.")
61
+ );
62
+ isLoading.value = false;
63
+ uuid.value = null;
64
+ }
65
+ onBlokkliEvent("fragment:edit", (data) => {
66
+ if (data.name === "blokkli_chart") {
67
+ uuid.value = data.uuid;
68
+ } else {
69
+ uuid.value = null;
70
+ }
71
+ });
72
+ </script>
@@ -0,0 +1,3 @@
1
+ declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ declare const _default: typeof __VLS_export;
3
+ export default _default;
@@ -0,0 +1 @@
1
+ export declare function parseNumericInput(raw: string): number;
@@ -0,0 +1,17 @@
1
+ export function parseNumericInput(raw) {
2
+ let str = raw.trim();
3
+ if (!str) return 0;
4
+ str = str.replace(/'/g, "");
5
+ if (str.includes(",")) {
6
+ const isThousandsSep = /,\d{3}(?:,\d{3})*$/.test(str);
7
+ if (isThousandsSep) {
8
+ str = str.replace(/,/g, "");
9
+ } else {
10
+ str = str.replace(/\./g, "");
11
+ const lastComma = str.lastIndexOf(",");
12
+ str = str.slice(0, lastComma) + "." + str.slice(lastComma + 1);
13
+ }
14
+ }
15
+ const value = Number.parseFloat(str);
16
+ return Number.isFinite(value) ? value : 0;
17
+ }
@@ -0,0 +1,51 @@
1
+ export type ChartType = 'bar' | 'line' | 'pie' | 'area' | 'donut' | 'heatmap' | 'radialBar' | 'radar';
2
+ export type ChartSeries = {
3
+ name: string;
4
+ /**
5
+ * The color identifier as defined in the module options.
6
+ */
7
+ color: string;
8
+ data: number[];
9
+ };
10
+ export type BlokkliChartData = {
11
+ title: string;
12
+ type: ChartType;
13
+ categories: string[];
14
+ series: ChartSeries[];
15
+ /**
16
+ * Color identifiers per category, used for pie/donut charts where each
17
+ * slice has its own color.
18
+ */
19
+ categoryColors: string[];
20
+ footnotes: string[];
21
+ typeOptions?: Record<string, unknown>;
22
+ };
23
+ declare const SUPERSCRIPTS: Record<string, string>;
24
+ export { SUPERSCRIPTS };
25
+ /**
26
+ * Replace `{1}`, `{2}`, etc. with Unicode superscript characters.
27
+ */
28
+ export declare function applyFootnotes(text: string): string;
29
+ export type ChartColor = {
30
+ color: string;
31
+ label: string;
32
+ };
33
+ /**
34
+ * Resolve a color ID to a concrete CSS color value that ApexCharts can use.
35
+ *
36
+ * Plain values like '#ff0000' or 'rgb(255, 0, 0)' are returned as-is.
37
+ * Values containing 'var(' (e.g. 'rgb(var(--theme-primary))') are resolved
38
+ * by setting the value on a DOM element and reading the computed color.
39
+ *
40
+ * Falls back to the first defined color if the ID is not found.
41
+ */
42
+ export declare function resolveChartColor(colorId: string, colors: Record<string, ChartColor>, el?: HTMLElement | null): string;
43
+ /**
44
+ * Get the fallback color ID (first defined color).
45
+ */
46
+ export declare function getFirstColorId(colors: Record<string, ChartColor>): string;
47
+ /**
48
+ * Get a color ID for the given index, cycling through available colors.
49
+ */
50
+ export declare function getColorIdAtIndex(index: number, colors: Record<string, ChartColor>): string;
51
+ export declare function getDefaultChartData(colors: Record<string, ChartColor>): BlokkliChartData;
@@ -0,0 +1,64 @@
1
+ const SUPERSCRIPTS = {
2
+ "1": "\xB9",
3
+ "2": "\xB2",
4
+ "3": "\xB3",
5
+ "4": "\u2074",
6
+ "5": "\u2075",
7
+ "6": "\u2076",
8
+ "7": "\u2077",
9
+ "8": "\u2078",
10
+ "9": "\u2079",
11
+ "0": "\u2070"
12
+ };
13
+ export { SUPERSCRIPTS };
14
+ export function applyFootnotes(text) {
15
+ return text.replace(
16
+ /\{(\d)\}/g,
17
+ (_, d) => SUPERSCRIPTS[d] || `{${d}}`
18
+ );
19
+ }
20
+ export function resolveChartColor(colorId, colors, el) {
21
+ const ids = Object.keys(colors);
22
+ const entry = colors[colorId] || colors[ids[0] || ""];
23
+ if (!entry) {
24
+ return "#888888";
25
+ }
26
+ const value = entry.color;
27
+ if (!value.includes("var(")) {
28
+ return value;
29
+ }
30
+ const target = el || document.documentElement;
31
+ const prev = target.style.color;
32
+ target.style.color = value;
33
+ const resolved = getComputedStyle(target).color;
34
+ target.style.color = prev;
35
+ return resolved || value;
36
+ }
37
+ export function getFirstColorId(colors) {
38
+ return Object.keys(colors)[0] || "";
39
+ }
40
+ export function getColorIdAtIndex(index, colors) {
41
+ const ids = Object.keys(colors);
42
+ return ids[index % ids.length] || ids[0] || "";
43
+ }
44
+ export function getDefaultChartData(colors) {
45
+ return {
46
+ title: "",
47
+ type: "bar",
48
+ categories: ["Category 1", "Category 2", "Category 3"],
49
+ series: [
50
+ {
51
+ name: "Series 1",
52
+ color: getColorIdAtIndex(0, colors),
53
+ data: [30, 40, 35]
54
+ }
55
+ ],
56
+ categoryColors: [
57
+ getColorIdAtIndex(0, colors),
58
+ getColorIdAtIndex(1, colors),
59
+ getColorIdAtIndex(2, colors)
60
+ ],
61
+ footnotes: [],
62
+ typeOptions: {}
63
+ };
64
+ }
@@ -7,6 +7,7 @@ mutation pbAddFragmentParagraph(
7
7
  $hostUuid: String!
8
8
  $hostFieldName: String!
9
9
  $afterUuid: String
10
+ $options: String
10
11
  ) {
11
12
  state: paragraphsEditMutationState(
12
13
  entityType: $entityType
@@ -18,6 +19,7 @@ mutation pbAddFragmentParagraph(
18
19
  hostType: $hostType
19
20
  hostUuid: $hostUuid
20
21
  hostFieldName: $hostFieldName
22
+ options: $options
21
23
  ) {
22
24
  ...paragraphsBlokkliMutationResult
23
25
  }
@@ -1,4 +1,4 @@
1
- import { B as BlokkliModule } from '../../shared/editor.Iax3GCvt.mjs';
1
+ import { B as BlokkliModule } from '../../shared/editor.CWQIFIEQ.mjs';
2
2
  import 'nuxt/schema';
3
3
  import 'consola';
4
4
  import '../../../dist/global/types/definitions.js';
@@ -704,14 +704,18 @@ export default defineBlokkliEditAdapter(
704
704
  }).then(mapMutation);
705
705
  }
706
706
  if (hasMutation("pbAddFragmentParagraph")) {
707
- adapter.fragmentsAddBlock = (e) => useGraphqlMutation("pbAddFragmentParagraph", {
708
- ...ctx.value,
709
- hostType: e.host.type,
710
- hostFieldName: e.host.fieldName,
711
- hostUuid: e.host.uuid,
712
- afterUuid: e.preceedingUuid,
713
- name: e.name
714
- }).then(mapMutation);
707
+ adapter.fragmentsAddBlock = (e) => {
708
+ const options = e.options ? JSON.stringify(e.options) : void 0;
709
+ return useGraphqlMutation("pbAddFragmentParagraph", {
710
+ ...ctx.value,
711
+ hostType: e.host.type,
712
+ hostFieldName: e.host.fieldName,
713
+ hostUuid: e.host.uuid,
714
+ afterUuid: e.preceedingUuid,
715
+ name: e.name,
716
+ options
717
+ }).then(mapMutation);
718
+ };
715
719
  }
716
720
  if (hasMutation("pbReplaceMedia")) {
717
721
  adapter.mediaLibraryReplaceMedia = (e) => useGraphqlMutation("pbReplaceMedia", {
@@ -0,0 +1,11 @@
1
+ import { B as BlokkliModule } from '../../shared/editor.CWQIFIEQ.mjs';
2
+ import 'nuxt/schema';
3
+ import 'consola';
4
+ import '../../../dist/global/types/definitions.js';
5
+ import '../../../dist/global/types/theme.js';
6
+ import '@nuxt/kit';
7
+ import '../../../dist/global/types/features.js';
8
+
9
+ declare const _default: (options?: object) => BlokkliModule<object>;
10
+
11
+ export { _default as default };
@@ -0,0 +1,24 @@
1
+ import { createResolver, addComponent } from '@nuxt/kit';
2
+ import { d as defineBlokkliModule } from '../../shared/editor.CGf7C_0M.mjs';
3
+ import { fileURLToPath } from 'node:url';
4
+
5
+ const index = defineBlokkliModule({
6
+ setup(ctx) {
7
+ const moduleResolver = createResolver(
8
+ fileURLToPath(new URL("./", import.meta.url))
9
+ );
10
+ ctx.helper.addAlias(
11
+ "#blokkli/table-of-contents",
12
+ moduleResolver.resolve("./runtime/types")
13
+ );
14
+ addComponent({
15
+ filePath: moduleResolver.resolve(
16
+ "./runtime/components/BlokkliTableOfContents/index.vue"
17
+ ),
18
+ name: "BlokkliTableOfContents",
19
+ global: true
20
+ });
21
+ }
22
+ });
23
+
24
+ export { index as default };