@blokkli/editor 2.0.0-alpha.61 → 2.0.0-alpha.63

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 (128) hide show
  1. package/dist/global/types/colorOptions.d.ts +16 -0
  2. package/dist/module.json +1 -1
  3. package/dist/module.mjs +168 -14
  4. package/dist/modules/agent/runtime/app/components/Conversation/Item/Assistant/index.vue +14 -5
  5. package/dist/modules/agent/runtime/app/features/agent/ConversationsAdmin/ConversationsTab/Item.vue +2 -2
  6. package/dist/modules/agent/runtime/app/features/agent/ConversationsAdmin/RatingsTab/Item.vue +2 -2
  7. package/dist/modules/agent/runtime/app/features/agent/ConversationsAdmin/SplitView/ConversationDetail.vue +2 -2
  8. package/dist/modules/agent/runtime/app/features/agent/Transcript/MessageContent.vue +14 -1
  9. package/dist/modules/agent/runtime/app/features/agent/Transcript/index.vue +30 -12
  10. package/dist/modules/agent/runtime/app/helpers/linkifyBlockUuids.d.ts +11 -0
  11. package/dist/modules/agent/runtime/app/helpers/linkifyBlockUuids.js +47 -0
  12. package/dist/modules/agent/runtime/app/tools/auto_translate_paragraphs/Component.d.vue.ts +22 -0
  13. package/dist/modules/agent/runtime/app/tools/auto_translate_paragraphs/Component.vue +28 -26
  14. package/dist/modules/agent/runtime/app/tools/auto_translate_paragraphs/Component.vue.d.ts +22 -0
  15. package/dist/modules/agent/runtime/app/tools/auto_translate_paragraphs/index.d.ts +15 -0
  16. package/dist/modules/agent/runtime/app/tools/delegate_text_rewrite/Component.d.vue.ts +22 -0
  17. package/dist/modules/agent/runtime/app/tools/delegate_text_rewrite/Component.vue +59 -16
  18. package/dist/modules/agent/runtime/app/tools/delegate_text_rewrite/Component.vue.d.ts +22 -0
  19. package/dist/modules/agent/runtime/app/tools/delegate_text_rewrite/index.d.ts +15 -0
  20. package/dist/modules/agent/runtime/app/tools/fieldDiffApproval.d.ts +85 -15
  21. package/dist/modules/agent/runtime/app/tools/fieldDiffApproval.js +138 -28
  22. package/dist/modules/agent/runtime/app/tools/schemas.d.ts +15 -5
  23. package/dist/modules/agent/runtime/app/tools/schemas.js +29 -12
  24. package/dist/modules/agent/runtime/app/tools/search_text/index.js +1 -1
  25. package/dist/modules/agent/runtime/app/tools/update_text_fields/Component.d.vue.ts +22 -0
  26. package/dist/modules/agent/runtime/app/tools/update_text_fields/Component.vue +54 -30
  27. package/dist/modules/agent/runtime/app/tools/update_text_fields/Component.vue.d.ts +22 -0
  28. package/dist/modules/agent/runtime/app/tools/update_text_fields/index.d.ts +15 -0
  29. package/dist/modules/agent/runtime/server/default-system-prompts/architecture.js +1 -1
  30. package/dist/modules/agent/runtime/server/default-system-prompts/important-rules.js +1 -0
  31. package/dist/modules/charts/runtime/blokkli/tools/chart_schemas.d.ts +1 -1
  32. package/dist/modules/charts/runtime/blokkli/tools/chart_schemas.js +12 -5
  33. package/dist/modules/charts/runtime/components/ChartRenderer/index.vue +7 -16
  34. package/dist/modules/charts/runtime/features/charts/Editor/ColorDropdown/index.vue +7 -77
  35. package/dist/modules/charts/runtime/features/charts/Editor/CsvImport/csvHelpers.d.ts +1 -1
  36. package/dist/modules/charts/runtime/features/charts/Editor/useChartEditorState.d.ts +1 -1
  37. package/dist/modules/charts/runtime/helpers/index.d.ts +2 -1
  38. package/dist/modules/charts/runtime/helpers/index.js +4 -2
  39. package/dist/modules/drupal/graphql/base/fragment.paragraphsBlokkliMutationResult.graphql +3 -0
  40. package/dist/modules/drupal/runtime/adapter/index.js +38 -27
  41. package/dist/runtime/composables/useBlokkliRuntimeConfig.d.ts +50 -0
  42. package/dist/runtime/composables/useBlokkliRuntimeConfig.js +34 -0
  43. package/dist/runtime/editor/adapter/index.d.ts +2 -1
  44. package/dist/runtime/editor/components/ColorDropdown/index.d.vue.ts +26 -0
  45. package/dist/runtime/editor/components/ColorDropdown/index.vue +116 -0
  46. package/dist/runtime/editor/components/ColorDropdown/index.vue.d.ts +26 -0
  47. package/dist/runtime/editor/components/DiffApproval/Highlight/Item.d.vue.ts +14 -20
  48. package/dist/runtime/editor/components/DiffApproval/Highlight/Item.vue +97 -52
  49. package/dist/runtime/editor/components/DiffApproval/Highlight/Item.vue.d.ts +14 -20
  50. package/dist/runtime/editor/components/DiffApproval/Highlight/index.d.vue.ts +6 -6
  51. package/dist/runtime/editor/components/DiffApproval/Highlight/index.vue +30 -21
  52. package/dist/runtime/editor/components/DiffApproval/Highlight/index.vue.d.ts +6 -6
  53. package/dist/runtime/editor/components/DiffApproval/Toolbar/index.d.vue.ts +19 -9
  54. package/dist/runtime/editor/components/DiffApproval/Toolbar/index.vue +18 -9
  55. package/dist/runtime/editor/components/DiffApproval/Toolbar/index.vue.d.ts +19 -9
  56. package/dist/runtime/editor/components/DiffApproval/index.d.vue.ts +14 -6
  57. package/dist/runtime/editor/components/DiffApproval/index.vue +62 -35
  58. package/dist/runtime/editor/components/DiffApproval/index.vue.d.ts +14 -6
  59. package/dist/runtime/editor/components/DiffApproval/types.d.ts +32 -0
  60. package/dist/runtime/editor/components/DiffApproval/types.js +22 -0
  61. package/dist/runtime/editor/components/Dropdown/index.d.vue.ts +5 -4
  62. package/dist/runtime/editor/components/Dropdown/index.vue +89 -29
  63. package/dist/runtime/editor/components/Dropdown/index.vue.d.ts +5 -4
  64. package/dist/runtime/editor/components/FlexTextarea/index.d.vue.ts +1 -1
  65. package/dist/runtime/editor/components/FlexTextarea/index.vue.d.ts +1 -1
  66. package/dist/runtime/editor/components/NestedEditorOverlay/index.d.vue.ts +2 -2
  67. package/dist/runtime/editor/components/NestedEditorOverlay/index.vue +3 -3
  68. package/dist/runtime/editor/components/NestedEditorOverlay/index.vue.d.ts +2 -2
  69. package/dist/runtime/editor/components/PopupHost/index.d.vue.ts +13 -0
  70. package/dist/runtime/editor/components/PopupHost/index.vue +12 -0
  71. package/dist/runtime/editor/components/PopupHost/index.vue.d.ts +13 -0
  72. package/dist/runtime/editor/components/index.d.ts +2 -0
  73. package/dist/runtime/editor/components/index.js +2 -0
  74. package/dist/runtime/editor/css/output.css +1 -1
  75. package/dist/runtime/editor/features/analyze/Main.vue +15 -2
  76. package/dist/runtime/editor/features/analyze/Results/ResultsItemNodes.vue +4 -1
  77. package/dist/runtime/editor/features/analyze/Results/ResultsItemNodesTarget.vue +25 -16
  78. package/dist/runtime/editor/features/analyze/analyzers/defaults/validations.d.ts +10 -0
  79. package/dist/runtime/editor/features/analyze/analyzers/defaults/validations.js +39 -0
  80. package/dist/runtime/editor/features/analyze/analyzers/helpers/Context.d.ts +5 -1
  81. package/dist/runtime/editor/features/analyze/analyzers/helpers/Context.js +5 -0
  82. package/dist/runtime/editor/features/analyze/index.vue +0 -1
  83. package/dist/runtime/editor/features/changelog/changelog.json +9 -1
  84. package/dist/runtime/editor/features/comments/Comment/Meta/index.vue +1 -1
  85. package/dist/runtime/editor/features/comments/Comment/index.vue +1 -1
  86. package/dist/runtime/editor/features/publish/Dialog/Violations.d.vue.ts +12 -0
  87. package/dist/runtime/editor/features/publish/Dialog/Violations.vue +117 -0
  88. package/dist/runtime/editor/features/publish/Dialog/Violations.vue.d.ts +12 -0
  89. package/dist/runtime/editor/features/publish/Dialog/index.vue +61 -24
  90. package/dist/runtime/editor/features/publish/index.vue +2 -4
  91. package/dist/runtime/editor/features/publish/types.d.ts +0 -4
  92. package/dist/runtime/editor/helpers/color/index.d.ts +7 -0
  93. package/dist/runtime/editor/helpers/color/index.js +14 -0
  94. package/dist/runtime/editor/helpers/diff/index.d.ts +87 -0
  95. package/dist/runtime/editor/helpers/diff/index.js +256 -0
  96. package/dist/runtime/editor/helpers/injections.d.ts +11 -0
  97. package/dist/runtime/editor/helpers/injections.js +1 -0
  98. package/dist/runtime/editor/plugins/Sidebar/Detached/index.d.vue.ts +1 -1
  99. package/dist/runtime/editor/plugins/Sidebar/Detached/index.vue.d.ts +1 -1
  100. package/dist/runtime/editor/plugins/Sidebar/index.d.vue.ts +2 -2
  101. package/dist/runtime/editor/plugins/Sidebar/index.vue.d.ts +2 -2
  102. package/dist/runtime/editor/providers/analyze.js +5 -2
  103. package/dist/runtime/editor/providers/config.d.ts +3 -1
  104. package/dist/runtime/editor/providers/config.js +46 -15
  105. package/dist/runtime/editor/providers/state.d.ts +13 -0
  106. package/dist/runtime/editor/providers/state.js +7 -0
  107. package/dist/runtime/editor/translations/de.json +7 -4
  108. package/dist/runtime/editor/translations/fr.json +2 -4
  109. package/dist/runtime/editor/translations/gsw_CH.json +7 -4
  110. package/dist/runtime/editor/translations/it.json +2 -4
  111. package/dist/runtime/helpers/colors.d.ts +39 -0
  112. package/dist/runtime/helpers/colors.js +28 -0
  113. package/dist/runtime/types/colors.d.ts +11 -0
  114. package/package.json +1 -1
  115. package/dist/runtime/editor/features/validations/Overlay/Item.d.vue.ts +0 -7
  116. package/dist/runtime/editor/features/validations/Overlay/Item.vue +0 -36
  117. package/dist/runtime/editor/features/validations/Overlay/Item.vue.d.ts +0 -7
  118. package/dist/runtime/editor/features/validations/Overlay/index.d.vue.ts +0 -7
  119. package/dist/runtime/editor/features/validations/Overlay/index.vue +0 -115
  120. package/dist/runtime/editor/features/validations/Overlay/index.vue.d.ts +0 -7
  121. package/dist/runtime/editor/features/validations/SidebarItem/index.d.vue.ts +0 -10
  122. package/dist/runtime/editor/features/validations/SidebarItem/index.vue +0 -41
  123. package/dist/runtime/editor/features/validations/SidebarItem/index.vue.d.ts +0 -10
  124. package/dist/runtime/editor/features/validations/index.d.vue.ts +0 -3
  125. package/dist/runtime/editor/features/validations/index.vue +0 -91
  126. package/dist/runtime/editor/features/validations/index.vue.d.ts +0 -3
  127. package/dist/runtime/editor/types/config.d.ts +0 -5
  128. /package/dist/runtime/{editor/types/config.js → types/colors.js} +0 -0
@@ -29,7 +29,7 @@
29
29
  </template>
30
30
 
31
31
  <script setup>
32
- import { computed, inject, ref, useAppConfig } from "#imports";
32
+ import { computed, inject, ref, useBlokkliRuntimeConfig } from "#imports";
33
33
  import { applyFootnotes, SUPERSCRIPTS } from "../../helpers";
34
34
  import { detectDateFormat, formatDateCategory } from "../../helpers/dateFormat";
35
35
  import { INJECT_CHART_PREVIEW_DYNAMIC_DATA } from "../../helpers/previewInjection";
@@ -55,17 +55,12 @@ const props = defineProps({
55
55
  dynamicData: { type: [Object, null], required: false }
56
56
  });
57
57
  const isEditing = inject(INJECT_IS_EDITING, false);
58
- const appConfig = useAppConfig();
58
+ const { resolveColorHex, colorPalette } = useBlokkliRuntimeConfig();
59
59
  const providerEntity = inject(INJECT_PROVIDER_CONTEXT, null);
60
60
  const previewDynamicData = inject(INJECT_CHART_PREVIEW_DYNAMIC_DATA, null);
61
61
  const currentLanguage = computed(
62
62
  () => props.languageOverride ?? providerEntity?.value.language ?? ""
63
63
  );
64
- const colorPalette = computed(() => {
65
- const map = appConfig.blokkli?.colorOptions;
66
- if (!map) return [];
67
- return Object.keys(map).map((id) => ({ id, hex: map[id] }));
68
- });
69
64
  const hasDynamicSource = computed(() => !!props.dataSource);
70
65
  const effectiveDynamicPayload = computed(() => {
71
66
  if (props.dynamicData !== void 0 && props.dynamicData !== null) {
@@ -80,17 +75,17 @@ const effectiveData = computed(() => {
80
75
  const overrides = props.dataSource?.seriesOverrides ?? {};
81
76
  const categoryOverrides = props.dataSource?.categoryColorOverrides ?? {};
82
77
  const palette = colorPalette.value;
83
- const fallback = palette[0]?.id ?? "";
78
+ const fallback = palette[0] ?? "";
84
79
  const visibleSeries = payload.series.filter(
85
80
  (s) => overrides[s.name]?.hidden !== true
86
81
  );
87
82
  const series = visibleSeries.map((s, i) => ({
88
83
  name: s.name,
89
- color: overrides[s.name]?.color ?? palette[i % Math.max(palette.length, 1)]?.id ?? fallback,
84
+ color: overrides[s.name]?.color ?? palette[i % Math.max(palette.length, 1)] ?? fallback,
90
85
  data: s.data
91
86
  }));
92
87
  const categoryColors = payload.categories.map((label, i) => {
93
- return categoryOverrides[label] ?? palette[i % Math.max(palette.length, 1)]?.id ?? fallback;
88
+ return categoryOverrides[label] ?? palette[i % Math.max(palette.length, 1)] ?? fallback;
94
89
  });
95
90
  return {
96
91
  categories: payload.categories,
@@ -159,10 +154,6 @@ function superscriptFor(n) {
159
154
  }
160
155
  return String(n).split("").map((d) => SUPERSCRIPTS[d] || d).join("");
161
156
  }
162
- function resolveHex(id) {
163
- const map = appConfig.blokkli?.colorOptions;
164
- return map?.[id] || "#888888";
165
- }
166
157
  const typeComponent = computed(
167
158
  () => chartTypeComponents[props.type]
168
159
  );
@@ -176,8 +167,8 @@ const renderProps = computed(() => {
176
167
  name: applyFootnotes(s.name),
177
168
  data: s.data
178
169
  })),
179
- seriesHexColors: data.series.map((s) => resolveHex(s.color)),
180
- categoryHexColors: data.categoryColors.map(resolveHex),
170
+ seriesHexColors: data.series.map((s) => resolveColorHex(s.color)),
171
+ categoryHexColors: data.categoryColors.map(resolveColorHex),
181
172
  typeOptions: props.typeOptions ?? {},
182
173
  numberFormat: resolvedNumberFormat.value,
183
174
  isEditing,
@@ -1,84 +1,14 @@
1
1
  <template>
2
- <Dropdown position="top-left" button-class="bk-chart-color-dropdown-button">
3
- <template #button>
4
- <span
5
- class="bk-chart-color-swatch bk-chart-data-table-input"
6
- :style="{ backgroundColor: displayColor }"
7
- />
8
- </template>
9
- <template #default="{ close }">
10
- <DropdownItem
11
- v-for="entry in colorOptions"
12
- :key="entry.id"
13
- :text="entry.label"
14
- @click="
15
- () => {
16
- emit('select', entry.id);
17
- close();
18
- }
19
- "
20
- >
21
- <span
22
- class="bk-chart-color-swatch"
23
- :style="{ backgroundColor: entry.hex }"
24
- />
25
- </DropdownItem>
26
- </template>
27
- </Dropdown>
2
+ <ColorDropdown
3
+ :model-value="colorId"
4
+ @update:model-value="$emit('select', $event)"
5
+ />
28
6
  </template>
29
7
 
30
8
  <script setup>
31
- import { computed, useBlokkli } from "#imports";
32
- import { Dropdown, DropdownItem } from "#blokkli/editor/components";
33
- const props = defineProps({
9
+ import { ColorDropdown } from "#blokkli/editor/components";
10
+ defineProps({
34
11
  colorId: { type: String, required: true }
35
12
  });
36
- const emit = defineEmits(["select"]);
37
- const { config } = useBlokkli();
38
- const colorOptions = computed(() => config.colorOptions.value);
39
- const displayColor = computed(() => config.getColorHex(props.colorId));
13
+ defineEmits(["select"]);
40
14
  </script>
41
-
42
- <style>/*! tailwindcss v4.2.4 | MIT License | https://tailwindcss.com */
43
- .bk .bk-chart-color-dropdown-button {
44
- display: flex;
45
- width: 40px;
46
- height: 40px;
47
- align-items: center;
48
- justify-content: center;
49
- }
50
- :is(.bk .bk-chart-color-dropdown-button):hover .bk-chart-color-swatch {
51
- outline-style: var(--bk-tw-outline-style);
52
- outline-width: 2px;
53
- outline-offset: calc(2px * -1);
54
- outline-color: rgb(var(--bk-theme-mono-100) / 1);
55
- }
56
- @supports (color: color-mix(in lab, red, red)) {
57
- :is(.bk .bk-chart-color-dropdown-button):hover .bk-chart-color-swatch {
58
- outline-color: color-mix(in oklab, rgb(var(--bk-theme-mono-100) / 1) 40%, transparent);
59
- }
60
- }
61
- :is(:is(.bk .bk-chart-color-dropdown-button):hover .bk-chart-color-swatch):before {
62
- opacity: 80%;
63
- }
64
- .bk .bk-chart-color-swatch {
65
- position: relative;
66
- display: block;
67
- width: 20px;
68
- height: 20px;
69
- border-radius: calc(infinity * 1px);
70
- }
71
- :is(.bk .bk-chart-color-swatch):before {
72
- content: '';
73
- position: absolute;
74
- top: 0px;
75
- left: 0px;
76
- width: 100%;
77
- height: 100%;
78
- border-radius: calc(infinity * 1px);
79
- border-style: var(--bk-tw-border-style);
80
- border-width: 1px;
81
- border-color: rgb(var(--bk-theme-mono-900) / 1);
82
- opacity: 40%;
83
- }
84
- </style>
@@ -1,4 +1,4 @@
1
- import type { ColorOption } from '#blokkli/editor/types/config';
1
+ import type { ColorOption } from '#blokkli/types/colors';
2
2
  import type { ChartSeries } from '../../../../types.js';
3
3
  export type CsvGrid = string[][];
4
4
  export type ColumnRole = 'category' | 'series' | 'value' | 'groupBy' | 'ignore';
@@ -1,5 +1,5 @@
1
1
  import type { BlokkliChartData, ChartSeries, ChartType } from '../../../types.js';
2
- import type { ColorOption } from '#blokkli/editor/types/config';
2
+ import type { ColorOption } from '#blokkli/types/colors';
3
3
  export declare function useChartEditorState(initial: BlokkliChartData, options: ColorOption[]): {
4
4
  data: any;
5
5
  canUndo: any;
@@ -1,5 +1,5 @@
1
1
  import type { BlokkliChartData } from '../types.js';
2
- import type { ColorOption } from '#blokkli/editor/types/config';
2
+ import type { ColorOption } from '#blokkli/types/colors';
3
3
  export declare const SUPERSCRIPTS: Record<string, string>;
4
4
  /**
5
5
  * Replace `{1}`, `{2}`, etc. with Unicode superscript characters.
@@ -11,6 +11,7 @@ export declare function applyFootnotes(text: string): string;
11
11
  export declare function getFirstColorId(options: ColorOption[]): string;
12
12
  /**
13
13
  * Get a color ID for the given index, cycling through available colors.
14
+ * Always returns the canonical form (`<base>.<mainShade>` for ramps).
14
15
  */
15
16
  export declare function getColorIdAtIndex(index: number, options: ColorOption[]): string;
16
17
  export declare function getDefaultChartData(options: ColorOption[]): BlokkliChartData;
@@ -1,3 +1,4 @@
1
+ import { canonicalColorId } from "#blokkli/helpers/colors";
1
2
  import { detectDateFormat } from "./dateFormat.js";
2
3
  export const SUPERSCRIPTS = {
3
4
  "1": "\xB9",
@@ -18,11 +19,12 @@ export function applyFootnotes(text) {
18
19
  );
19
20
  }
20
21
  export function getFirstColorId(options) {
21
- return options[0]?.id || "";
22
+ return options[0] ? canonicalColorId(options[0]) : "";
22
23
  }
23
24
  export function getColorIdAtIndex(index, options) {
24
25
  if (options.length === 0) return "";
25
- return options[index % options.length]?.id || options[0]?.id || "";
26
+ const option = options[index % options.length] ?? options[0];
27
+ return canonicalColorId(option);
26
28
  }
27
29
  export function getDefaultChartData(options) {
28
30
  return {
@@ -4,4 +4,7 @@ fragment paragraphsBlokkliMutationResult on ParagraphsBlokkliMutationResult {
4
4
  state {
5
5
  ...paragraphsBlokkliEditState
6
6
  }
7
+ violations {
8
+ ...paragraphsBlokkliViolation
9
+ }
7
10
  }
@@ -178,7 +178,7 @@ export default defineBlokkliEditAdapter(
178
178
  },
179
179
  {}
180
180
  ),
181
- entityTypeConfig: v.data.entityTypeConfig
181
+ entityTypeConfig: v.data.entityTypeConfig ?? []
182
182
  };
183
183
  });
184
184
  const entityTypeConfigMap = /* @__PURE__ */ new Map();
@@ -336,7 +336,8 @@ export default defineBlokkliEditAdapter(
336
336
  return {
337
337
  success: !!action?.success,
338
338
  state: action?.state,
339
- errors: (action?.errors ?? []).filter(falsy)
339
+ errors: (action?.errors ?? []).filter(falsy),
340
+ violations: action?.violations ?? []
340
341
  };
341
342
  };
342
343
  const mapImportSummary = (summary) => {
@@ -1510,7 +1511,7 @@ export default defineBlokkliEditAdapter(
1510
1511
  host: hostInput()
1511
1512
  }).then((v) => mapConversation(v.data.conversation)),
1512
1513
  list: () => useGraphqlQuery("pbAgentConversations", { host: hostInput() }).then(
1513
- (v) => v.data.result.items
1514
+ (v) => v.data.result?.items ?? []
1514
1515
  ),
1515
1516
  delete: (uuid) => useGraphqlMutation("pbAgentConversationDelete", { uuid }).then(
1516
1517
  (v) => v.data.result.success
@@ -1526,33 +1527,43 @@ export default defineBlokkliEditAdapter(
1526
1527
  }
1527
1528
  if (hasQuery("pbAgentConversationsAll")) {
1528
1529
  adapter.agentConversations.queryConversations = (e) => useGraphqlQuery("pbAgentConversationsAll", { page: e.page }).then(
1529
- (v) => ({
1530
- filters: mapPluginConfigInputs(v.data.result.filters),
1531
- items: v.data.result.items.map((c) => ({
1532
- uuid: c.uuid,
1533
- title: c.title,
1534
- createdAt: c.createdAt,
1535
- updatedAt: c.updatedAt,
1536
- host: c.host ? {
1537
- entityType: c.host.entityType,
1538
- entityUuid: c.host.entityUuid,
1539
- label: c.host.label ?? null,
1540
- editUrl: c.host.editUrl ?? null
1541
- } : null,
1542
- author: mapBlokkliUser(c.author)
1543
- })),
1544
- perPage: v.data.result.perPage,
1545
- total: v.data.result.total
1546
- })
1530
+ (v) => {
1531
+ if (!v.data.result) {
1532
+ throw new Error("Failed to load agent conversations.");
1533
+ }
1534
+ return {
1535
+ filters: mapPluginConfigInputs(v.data.result.filters),
1536
+ items: v.data.result.items.map((c) => ({
1537
+ uuid: c.uuid,
1538
+ title: c.title,
1539
+ createdAt: c.createdAt,
1540
+ updatedAt: c.updatedAt,
1541
+ host: c.host ? {
1542
+ entityType: c.host.entityType,
1543
+ entityUuid: c.host.entityUuid,
1544
+ label: c.host.label ?? null,
1545
+ editUrl: c.host.editUrl ?? null
1546
+ } : null,
1547
+ author: mapBlokkliUser(c.author)
1548
+ })),
1549
+ perPage: v.data.result.perPage,
1550
+ total: v.data.result.total
1551
+ };
1552
+ }
1547
1553
  );
1548
1554
  }
1549
1555
  if (hasQuery("pbAgentFeedbackAll")) {
1550
- adapter.agentConversations.queryFeedback = (e) => useGraphqlQuery("pbAgentFeedbackAll", { page: e.page }).then((v) => ({
1551
- filters: mapPluginConfigInputs(v.data.result.filters),
1552
- items: v.data.result.items.map(mapFeedback),
1553
- perPage: v.data.result.perPage,
1554
- total: v.data.result.total
1555
- }));
1556
+ adapter.agentConversations.queryFeedback = (e) => useGraphqlQuery("pbAgentFeedbackAll", { page: e.page }).then((v) => {
1557
+ if (!v.data.result) {
1558
+ throw new Error("Failed to load agent feedback.");
1559
+ }
1560
+ return {
1561
+ filters: mapPluginConfigInputs(v.data.result.filters),
1562
+ items: v.data.result.items.map(mapFeedback),
1563
+ perPage: v.data.result.perPage,
1564
+ total: v.data.result.total
1565
+ };
1566
+ });
1556
1567
  }
1557
1568
  }
1558
1569
  if (hasMutation("pbBulkUpdateFieldValues")) {
@@ -0,0 +1,50 @@
1
+ import { type ComputedRef } from '#imports';
2
+ type UseBlokkliRuntimeConfig = {
3
+ /**
4
+ * Resolve a canonical color id to its current hex.
5
+ *
6
+ * Reads `app.config.blokkli.colorOptions` first; if the id is missing,
7
+ * disabled (null override on the id itself or its `<base>`), or null
8
+ * /undefined to begin with, cascades through `colorPalette` in order
9
+ * and returns the first that resolves. Falls back to `FALLBACK_HEX`
10
+ * only when every palette entry is also gone.
11
+ */
12
+ resolveColorHex: (id: string | null | undefined) => string;
13
+ /**
14
+ * Ordered canonical color ids with disabled entries already filtered
15
+ * out — a `<base>: null` family-disable drops `<base>.<mainShade>`,
16
+ * a direct `<id>: null` drops that id. Cycle through this for default
17
+ * color assignment (e.g. dynamic chart series).
18
+ */
19
+ colorPalette: ComputedRef<string[]>;
20
+ };
21
+ /**
22
+ * Runtime-only config surface for userland and integrator components
23
+ * (chart renderers, custom blocks, …) outside the editor.
24
+ *
25
+ * Sources:
26
+ * - `app.config.blokkli.colorOptions` — flat `Record<canonicalId, string | null>`
27
+ * seeded by the module with every canonical id (bare for flat colors,
28
+ * `<base>.<shade>` for ramped colors) at its build-time hex. `null`
29
+ * disables. The bare `<base>` is kept for ramped colors so userland
30
+ * can family-disable with `<base>: null`. This is the user-overridable
31
+ * surface — `updateAppConfig` deep-merges into it.
32
+ * - `#blokkli-build/config` → `colorPalette` — ordered canonical ids
33
+ * (one per declared family — flat ids verbatim, ramped ids as
34
+ * `<base>.<mainShade>`). Build-time static data, NOT in appConfig
35
+ * because it's not userland-overridable. Used as the cascading
36
+ * fallback for unresolved ids.
37
+ *
38
+ * Returns:
39
+ * - `resolveColorHex(id)` — flat lookup. If the requested id is missing
40
+ * or disabled, cascade through the enabled palette in order and return
41
+ * the first one that resolves. If even that yields nothing, return
42
+ * `FALLBACK_HEX`.
43
+ * - `colorPalette` — computed ordered canonical ids with disabled
44
+ * entries already filtered out (a `<base>: null` family-disable drops
45
+ * `<base>.<mainShade>`; a direct `<id>: null` drops that id). Userland
46
+ * can cycle through this directly to assign default colors — no need
47
+ * to second-guess which ids are still live.
48
+ */
49
+ export declare function useBlokkliRuntimeConfig(): UseBlokkliRuntimeConfig;
50
+ export {};
@@ -0,0 +1,34 @@
1
+ import { computed, useAppConfig } from "#imports";
2
+ import { colorPalette as canonicalPalette } from "#blokkli-build/config";
3
+ import { FALLBACK_HEX } from "../helpers/colors.js";
4
+ export function useBlokkliRuntimeConfig() {
5
+ const appConfig = useAppConfig();
6
+ const overrides = computed(
7
+ () => appConfig.blokkli?.colorOptions ?? {}
8
+ );
9
+ function lookup(lookupId) {
10
+ const map = overrides.value;
11
+ const dotIndex = lookupId.indexOf(".");
12
+ if (dotIndex !== -1) {
13
+ const baseId = lookupId.slice(0, dotIndex);
14
+ if (map[baseId] === null) return void 0;
15
+ }
16
+ const value = map[lookupId];
17
+ return typeof value === "string" ? value : void 0;
18
+ }
19
+ const colorPalette = computed(
20
+ () => canonicalPalette.filter((id) => lookup(id) !== void 0)
21
+ );
22
+ function resolveColorHex(id) {
23
+ if (id) {
24
+ const direct = lookup(id);
25
+ if (direct !== void 0) return direct;
26
+ }
27
+ for (const fallbackId of colorPalette.value) {
28
+ const hex = lookup(fallbackId);
29
+ if (hex !== void 0) return hex;
30
+ }
31
+ return FALLBACK_HEX;
32
+ }
33
+ return { resolveColorHex, colorPalette };
34
+ }
@@ -1,7 +1,7 @@
1
1
  import type { ComputedRef } from 'vue';
2
2
  import type { AddNewBlockEvent, AddNewBlocksEvent, MoveBlockEvent, MoveMultipleBlocksEvent } from '../events/index.js';
3
3
  import type { PluginConfigInput } from '../types/pluginConfig.js';
4
- import type { EntityTranslation, MappedState } from '../types/state.js';
4
+ import type { EntityTranslation, MappedState, Validation } from '../types/state.js';
5
5
  import type { BlockBundleDefinition, EntityTypeBundleInfo, EntityTypeInfo, FieldConfig } from '../types/definitions.js';
6
6
  import type { EditBlockEvent } from '../features/edit/types.js';
7
7
  import type { UserPermissions } from '../types/permissions.js';
@@ -10,6 +10,7 @@ export interface MutationResponseLike<T> {
10
10
  success: boolean;
11
11
  state?: T;
12
12
  errors?: string[];
13
+ violations?: Validation[];
13
14
  }
14
15
  export interface GenericAdapterResponse<T> {
15
16
  success: boolean;
@@ -0,0 +1,26 @@
1
+ type __VLS_Props = {
2
+ buttonClass?: string;
3
+ };
4
+ type __VLS_ModelProps = {
5
+ modelValue?: string;
6
+ };
7
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
8
+ declare var __VLS_9: {
9
+ displayColor: any;
10
+ };
11
+ type __VLS_Slots = {} & {
12
+ default?: (props: typeof __VLS_9) => any;
13
+ };
14
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
15
+ "update:modelValue": (value: string) => any;
16
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
17
+ "onUpdate:modelValue"?: ((value: string) => any) | undefined;
18
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
19
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
20
+ declare const _default: typeof __VLS_export;
21
+ export default _default;
22
+ type __VLS_WithSlots<T, S> = T & {
23
+ new (): {
24
+ $slots: S;
25
+ };
26
+ };
@@ -0,0 +1,116 @@
1
+ <template>
2
+ <Dropdown
3
+ position="top-left"
4
+ :button-class="
5
+ buttonClass ?? '_bk_size-40 _bk_flex _bk_items-center _bk_justify-center _bk_group'
6
+ "
7
+ >
8
+ <template #button>
9
+ <slot :display-color>
10
+ <span
11
+ class="_bk_rounded-full _bk_block _bk_size-20 _bk_relative _bk_group-hover:outline-2 _bk_group-hover:outline-mono-100/40 _bk_group-hover:-outline-offset-2 _bk_group-hover:before:opacity-80"
12
+ :style="{ backgroundColor: displayColor }"
13
+ />
14
+ </slot>
15
+ </template>
16
+ <div
17
+ v-if="hasAnyShades"
18
+ class="_bk_p-5 _bk_flex _bk_flex-wrap _bk_relative"
19
+ :style="{
20
+ maxWidth: maxShades * 40 + 10 + 'px'
21
+ }"
22
+ >
23
+ <div
24
+ v-for="row in colorRows"
25
+ :key="row.entryId"
26
+ class="_bk_flex _bk_items-center"
27
+ >
28
+ <button
29
+ v-for="item in row.items"
30
+ :key="item.colorId"
31
+ type="button"
32
+ class="_bk_group/tooltip _bk_flex _bk_border-none _bk_bg-transparent _bk_cursor-pointer _bk_size-40 _bk_items-center _bk_justify-center _bk_group"
33
+ @click="selectedId = item.colorId"
34
+ >
35
+ <span
36
+ class="_bk_rounded-full _bk_block _bk_relative _bk_outline-2 _bk_outline-offset-2 _bk_outline-transparent _bk_size-30"
37
+ :class="[
38
+ item.isMain && [
39
+ '_bk_before:content-empty _bk_before:absolute _bk_before:size-8 _bk_before:rounded-full _bk_before:left-1/2 _bk_before:top-1/2 _bk_before:-translate-x-1/2 _bk_before:-translate-y-1/2',
40
+ item.isLightBg ? '_bk_before:bg-black' : '_bk_before:bg-white'
41
+ ],
42
+ isSelected(item.colorId) ? '_bk_outline-mono-900!' : '_bk_group-hover:outline-mono-300'
43
+ ]"
44
+ :style="{ backgroundColor: item.hex }"
45
+ />
46
+ <Tooltip :label="item.label" placement="above-left" small />
47
+ </button>
48
+ </div>
49
+ </div>
50
+ <template v-else>
51
+ <DropdownItem
52
+ v-for="entry in colorOptions"
53
+ :key="entry.id"
54
+ :text="entry.label"
55
+ :class="{ '_bk_bg-mono-100 _bk_text-mono-950': isSelected(entry.id) }"
56
+ @click="selectedId = entry.id"
57
+ >
58
+ <span
59
+ class="_bk_rounded-full _bk_block _bk_size-20 _bk_relative"
60
+ :style="{ backgroundColor: entry.hex }"
61
+ />
62
+ </DropdownItem>
63
+ </template>
64
+ </Dropdown>
65
+ </template>
66
+
67
+ <script setup>
68
+ import { computed, useBlokkli } from "#imports";
69
+ import { Dropdown, DropdownItem, Tooltip } from "#blokkli/editor/components";
70
+ import { isLightHex } from "#blokkli/editor/helpers/color";
71
+ defineProps({
72
+ buttonClass: { type: String, required: false }
73
+ });
74
+ const selectedId = defineModel({ type: String, ...{
75
+ default: ""
76
+ } });
77
+ const { config, $t } = useBlokkli();
78
+ const colorOptions = computed(() => config.colorOptions.value);
79
+ const hasAnyShades = computed(
80
+ () => colorOptions.value.some((entry) => entry.shades?.length)
81
+ );
82
+ const displayColor = computed(() => config.getColorHex(selectedId.value));
83
+ const colorRows = computed(
84
+ () => colorOptions.value.map((entry) => ({
85
+ entryId: entry.id,
86
+ items: entry.shades?.length ? entry.shades.map((shade) => ({
87
+ // Always emit the shade-qualified form for ramped colors — the
88
+ // bare base id is never emitted from this component, so consumers
89
+ // can compare ids with naive string equality without knowing
90
+ // which shade was declared as the family's main.
91
+ colorId: `${entry.id}.${shade.id}`,
92
+ label: shade.isMain ? `${entry.label} ${shade.id} (${$t("mainColor", "main color")})` : `${entry.label} ${shade.id}`,
93
+ hex: shade.hex,
94
+ isMain: !!shade.isMain,
95
+ isLightBg: isLightHex(shade.hex)
96
+ })) : [
97
+ {
98
+ colorId: entry.id,
99
+ label: entry.label,
100
+ hex: entry.hex,
101
+ isMain: false,
102
+ isLightBg: isLightHex(entry.hex)
103
+ }
104
+ ]
105
+ })).sort((a, b) => b.items.length - a.items.length)
106
+ );
107
+ const maxShades = computed(
108
+ () => colorOptions.value.reduce(
109
+ (max, entry) => Math.max(max, entry.shades?.length ?? 0),
110
+ 0
111
+ )
112
+ );
113
+ function isSelected(id) {
114
+ return selectedId.value === id;
115
+ }
116
+ </script>
@@ -0,0 +1,26 @@
1
+ type __VLS_Props = {
2
+ buttonClass?: string;
3
+ };
4
+ type __VLS_ModelProps = {
5
+ modelValue?: string;
6
+ };
7
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
8
+ declare var __VLS_9: {
9
+ displayColor: any;
10
+ };
11
+ type __VLS_Slots = {} & {
12
+ default?: (props: typeof __VLS_9) => any;
13
+ };
14
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
15
+ "update:modelValue": (value: string) => any;
16
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
17
+ "onUpdate:modelValue"?: ((value: string) => any) | undefined;
18
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
19
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
20
+ declare const _default: typeof __VLS_export;
21
+ export default _default;
22
+ type __VLS_WithSlots<T, S> = T & {
23
+ new (): {
24
+ $slots: S;
25
+ };
26
+ };
@@ -1,33 +1,27 @@
1
+ import type { ApprovalItem, ApprovalUnit } from '../types.js';
1
2
  type __VLS_Props = {
2
- uuid: string;
3
- fieldName: string;
4
- value: string;
5
- selected: boolean;
6
- active: boolean;
3
+ item: ApprovalItem;
4
+ /** Units belonging to this item, in reading order. Never empty in practice. */
5
+ units: ApprovalUnit[];
6
+ selected: Record<string, boolean>;
7
+ activeKey: string | null;
7
8
  /**
8
- * Render the new value entirely as an insertion instead of a diff.
9
- *
10
- * See the prop of the same name on DiffApproval.
9
+ * Render the new value entirely as an insertion instead of a diff. See the
10
+ * prop of the same name on DiffApproval.
11
11
  */
12
12
  insertionsOnly?: boolean;
13
13
  };
14
- /**
15
- * Restore the original Vue-managed nodes immediately, in preparation for the
16
- * consumer's mutation. After this runs, Vue's reactive patch can write the
17
- * new value into the live tracked nodes — and the post-mutation
18
- * `onBeforeUnmount` restore is skipped so it doesn't clobber that value.
19
- */
20
14
  declare function commitForApply(): void;
21
- declare function updateRect(): void;
15
+ declare function updateRects(): void;
22
16
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
23
- updateRect: typeof updateRect;
17
+ updateRects: typeof updateRects;
24
18
  commitForApply: typeof commitForApply;
25
19
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
26
- toggle: () => void;
27
- activate: () => void;
20
+ toggle: (key: string) => void;
21
+ activate: (key: string) => void;
28
22
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
29
- onToggle?: (() => any) | undefined;
30
- onActivate?: (() => any) | undefined;
23
+ onToggle?: ((key: string) => any) | undefined;
24
+ onActivate?: ((key: string) => any) | undefined;
31
25
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
32
26
  declare const _default: typeof __VLS_export;
33
27
  export default _default;