@blokkli/editor 2.0.0-alpha.62 → 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 +2 -1
  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
@@ -1,31 +1,36 @@
1
1
  <template>
2
2
  <div
3
+ v-for="unit in units"
4
+ :key="unit.key"
3
5
  class="_bk_absolute _bk_top-0 _bk_left-0 _bk_rounded"
4
6
  :class="[
5
- selected ? '_bk_border-lime-normal _bk_outline-lime-normal/30' : '_bk_border-red-normal _bk_outline-red-normal/30',
6
- active ? '_bk_border-4 _bk_outline-[5px] _bk_rounded-tl-none' : '_bk_border _bk_hover:border-mono-500 _bk_hover:bg-mono-400/20'
7
+ selected[unit.key] ? '_bk_border-lime-normal _bk_outline-lime-normal/30' : '_bk_border-red-normal _bk_outline-red-normal/30',
8
+ activeKey === unit.key ? '_bk_border-4 _bk_outline-[5px] _bk_rounded-tl-none' : '_bk_border _bk_hover:border-mono-500 _bk_hover:bg-mono-400/20'
7
9
  ]"
8
- :style="rect"
10
+ :style="rects[unit.key]"
9
11
  >
10
- <button class="_bk_size-full _bk_block" @click.prevent="$emit('activate')" />
11
12
  <button
12
- v-show="active"
13
+ class="_bk_size-full _bk_block"
14
+ @click.prevent="emit('activate', unit.key)"
15
+ />
16
+ <button
17
+ v-show="activeKey === unit.key"
13
18
  class="_bk_absolute _bk_left-[-3px] _bk_bottom-full _bk_h-30 _bk_px-8 _bk_flex _bk_items-center _bk_justify-center _bk_gap-5 _bk_text-white _bk_rounded-t-md"
14
19
  :class="
15
- selected ? '_bk_bg-lime-normal _bk_hover:bg-lime-dark' : '_bk_bg-red-normal _bk_hover:bg-red-dark'
20
+ selected[unit.key] ? '_bk_bg-lime-normal _bk_hover:bg-lime-dark' : '_bk_bg-red-normal _bk_hover:bg-red-dark'
16
21
  "
17
- @click.prevent="$emit('toggle')"
22
+ @click.prevent="emit('toggle', unit.key)"
18
23
  >
19
24
  <Icon
20
- :name="selected ? 'bk_mdi_check' : 'bk_mdi_close'"
25
+ :name="selected[unit.key] ? 'bk_mdi_check' : 'bk_mdi_close'"
21
26
  class="_bk_size-20 _bk_p-2 _bk_rounded _bk_flex _bk_items-center _bk_justify-center _bk_border _bk_border-white"
22
- :class="selected ? '_bk_text-lime-normal _bk_bg-white' : '_bk_text-white'"
27
+ :class="selected[unit.key] ? '_bk_text-lime-normal _bk_bg-white' : '_bk_text-white'"
23
28
  />
24
29
  <span
25
30
  class="_bk_text-xs _bk_font-semibold _bk_uppercase _bk_tracking-wider _bk_leading-none _bk_translate-y-1"
26
31
  >
27
32
  {{
28
- selected ? $t("aiAgentApprovalAccepted", "Accepted") : $t("aiAgentApprovalRejected", "Rejected")
33
+ selected[unit.key] ? $t("aiAgentApprovalAccepted", "Accepted") : $t("aiAgentApprovalRejected", "Rejected")
29
34
  }}
30
35
  </span>
31
36
  </button>
@@ -40,39 +45,63 @@ import {
40
45
  } from "#blokkli/editor/composables";
41
46
  import { Icon } from "#blokkli/editor/components";
42
47
  import { itemEntityType } from "#blokkli-build/config";
43
- import { computeDiff, computeInsertion } from "#blokkli/editor/helpers/diff";
48
+ import {
49
+ computeDiff,
50
+ computeInsertion,
51
+ flattenSegments,
52
+ renderSegmentDiff
53
+ } from "#blokkli/editor/helpers/diff";
44
54
  const props = defineProps({
45
- uuid: { type: String, required: true },
46
- fieldName: { type: String, required: true },
47
- value: { type: String, required: true },
48
- selected: { type: Boolean, required: true },
49
- active: { type: Boolean, required: true },
55
+ item: { type: Object, required: true },
56
+ units: { type: Array, required: true },
57
+ selected: { type: Object, required: true },
58
+ activeKey: { type: [String, null], required: true },
50
59
  insertionsOnly: { type: Boolean, required: false }
51
60
  });
52
- defineEmits(["activate", "toggle"]);
53
- const { ui, blocks, context, $t } = useBlokkli();
61
+ const emit = defineEmits(["activate", "toggle"]);
62
+ const { $t, ui, blocks, context } = useBlokkli();
54
63
  function resolveHost() {
55
- if (props.uuid === context.value.entityUuid) {
64
+ if (props.item.uuid === context.value.entityUuid) {
56
65
  return {
57
66
  type: context.value.entityType,
58
67
  bundle: context.value.entityBundle,
59
- uuid: props.uuid
68
+ uuid: props.item.uuid
60
69
  };
61
70
  }
62
- const block = blocks.getBlock(props.uuid);
71
+ const block = blocks.getBlock(props.item.uuid);
63
72
  return {
64
73
  type: itemEntityType,
65
74
  bundle: block?.bundle || "",
66
- uuid: props.uuid
75
+ uuid: props.item.uuid
67
76
  };
68
77
  }
69
78
  const host = resolveHost();
70
- const override = useEditableFieldOverride(props.fieldName, host);
71
- const diffHtml = computed(
72
- () => props.insertionsOnly ? computeInsertion(props.value) : computeDiff(override.originalValue, props.value)
73
- );
79
+ const override = useEditableFieldOverride(props.item.fieldName, host);
80
+ const isSegmented = computed(() => Array.isArray(props.item.segments));
81
+ const acceptedBySegmentId = computed(() => {
82
+ if (!props.item.segments) return {};
83
+ const out = {};
84
+ for (const atom of flattenSegments(props.item.segments)) {
85
+ out[atom.id] = props.selected[`${props.item.id}:${atom.id}`] !== false;
86
+ }
87
+ return out;
88
+ });
89
+ const diffHtml = computed(() => {
90
+ if (props.item.segments) {
91
+ return renderSegmentDiff(props.item.segments, {
92
+ insertionsOnly: props.insertionsOnly,
93
+ acceptedById: acceptedBySegmentId.value
94
+ });
95
+ }
96
+ return props.insertionsOnly ? computeInsertion(props.item.value) : computeDiff(override.originalValue, props.item.value);
97
+ });
74
98
  function applyOverride() {
75
- if (props.selected) {
99
+ if (isSegmented.value) {
100
+ override.setDiffHtml(diffHtml.value);
101
+ return;
102
+ }
103
+ const onlyUnit = props.units[0];
104
+ if (onlyUnit && props.selected[onlyUnit.key]) {
76
105
  override.setDiffHtml(diffHtml.value);
77
106
  } else {
78
107
  override.restore();
@@ -80,8 +109,11 @@ function applyOverride() {
80
109
  }
81
110
  applyOverride();
82
111
  watch(
83
- () => props.selected,
84
- () => applyOverride()
112
+ () => props.units.map((u) => props.selected[u.key]),
113
+ () => {
114
+ applyOverride();
115
+ updateRects();
116
+ }
85
117
  );
86
118
  let committed = false;
87
119
  function commitForApply() {
@@ -89,37 +121,50 @@ function commitForApply() {
89
121
  committed = true;
90
122
  }
91
123
  onBeforeUnmount(() => {
92
- if (committed) {
93
- return;
94
- }
124
+ if (committed) return;
95
125
  override.restore();
96
126
  });
97
- defineExpose({ updateRect, commitForApply });
98
- const rect = ref({ width: "0", height: "0", transform: "" });
99
- function updateRect() {
100
- const el = override.element;
101
- if (el) {
102
- const r = ui.getAbsoluteElementRect(el);
103
- const pad = 5;
104
- rect.value = {
105
- width: r.width + pad * 2 + "px",
106
- height: r.height + pad * 2 + "px",
107
- transform: `translate(${r.x - pad}px, ${r.y - pad}px)`
108
- };
109
- } else {
110
- rect.value = {
111
- width: "0",
112
- height: "0",
113
- transform: "",
114
- visibility: "hidden"
115
- };
127
+ defineExpose({ updateRects, commitForApply });
128
+ const rects = ref({});
129
+ const HIDDEN_RECT = {
130
+ width: "0",
131
+ height: "0",
132
+ transform: "",
133
+ visibility: "hidden"
134
+ };
135
+ function computeRect(el) {
136
+ const r = ui.getAbsoluteElementRect(el);
137
+ const pad = 5;
138
+ return {
139
+ width: r.width + pad * 2 + "px",
140
+ height: r.height + pad * 2 + "px",
141
+ transform: `translate(${r.x - pad}px, ${r.y - pad}px)`
142
+ };
143
+ }
144
+ function resolveUnitElement(unit) {
145
+ const root = override.element;
146
+ if (!root) return null;
147
+ if (unit.kind === "whole") return root;
148
+ return root.querySelector(
149
+ `[data-chunk-index="${CSS.escape(unit.segment.id)}"]`
150
+ );
151
+ }
152
+ function updateRects() {
153
+ const next = {};
154
+ for (const unit of props.units) {
155
+ const el = resolveUnitElement(unit);
156
+ next[unit.key] = el ? computeRect(el) : HIDDEN_RECT;
116
157
  }
158
+ rects.value = next;
117
159
  }
160
+ updateRects();
118
161
  let lastFullUpdate = 0;
119
162
  onBlokkliEvent("animationFrame", (ctx) => {
120
163
  const forceRefresh = ctx.time - lastFullUpdate > 1e3;
121
164
  if (!forceRefresh) return;
122
165
  lastFullUpdate = ctx.time;
123
- updateRect();
166
+ if (!isSegmented.value) {
167
+ updateRects();
168
+ }
124
169
  });
125
170
  </script>
@@ -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;
@@ -1,15 +1,15 @@
1
- import type { ApprovalItem } from '../types.js';
1
+ import type { ApprovalItem, ApprovalUnit } from '../types.js';
2
2
  type __VLS_Props = {
3
3
  items: ApprovalItem[];
4
- selected: Record<number, boolean>;
4
+ units: ApprovalUnit[];
5
+ selected: Record<string, boolean>;
5
6
  insertionsOnly?: boolean;
6
7
  };
7
8
  declare function updateRects(): void;
8
9
  /**
9
10
  * Reset each accepted item's editable to its original Vue-tracked DOM, then
10
11
  * mark them committed so the post-mutation unmount-restore is a no-op. Called
11
- * by DiffApproval BEFORE emitting `apply`, so the consumer's mutation patches
12
- * onto the freshly-restored nodes instead of the throwaway diff markup.
12
+ * by DiffApproval BEFORE emitting `apply`.
13
13
  */
14
14
  declare function commitSelected(): void;
15
15
  type __VLS_ModelProps = {
@@ -22,9 +22,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
22
22
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
23
23
  "update:modelValue": (value: number) => any;
24
24
  } & {
25
- toggle: (id: number) => any;
25
+ toggle: (key: string) => any;
26
26
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
27
- onToggle?: ((id: number) => any) | undefined;
27
+ onToggle?: ((key: string) => any) | undefined;
28
28
  "onUpdate:modelValue"?: ((value: number) => any) | undefined;
29
29
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
30
30
  declare const _default: typeof __VLS_export;
@@ -5,17 +5,16 @@
5
5
  :style="containerStyle"
6
6
  >
7
7
  <Item
8
- v-for="(item, i) in items"
8
+ v-for="item in items"
9
9
  :key="item.id"
10
10
  ref="itemRefs"
11
- :uuid="item.uuid"
12
- :field-name="item.fieldName"
13
- :value="item.value"
14
- :selected="!!selected[item.id]"
15
- :active="i === activeIndex"
11
+ :item
12
+ :units="unitsByItemId[item.id] ?? []"
13
+ :selected
14
+ :active-key
16
15
  :insertions-only
17
- @activate="activeIndex = i"
18
- @toggle="emit('toggle', item.id)"
16
+ @activate="(key) => onActivate(key)"
17
+ @toggle="(key) => emit('toggle', key)"
19
18
  />
20
19
  </div>
21
20
  </Teleport>
@@ -26,6 +25,7 @@ import { computed, useTemplateRef, useBlokkli } from "#imports";
26
25
  import Item from "./Item.vue";
27
26
  const props = defineProps({
28
27
  items: { type: Array, required: true },
28
+ units: { type: Array, required: true },
29
29
  selected: { type: Object, required: true },
30
30
  insertionsOnly: { type: Boolean, required: false }
31
31
  });
@@ -41,26 +41,35 @@ const containerStyle = computed(() => {
41
41
  transform: `translate(${offset.x}px, ${offset.y}px) scale(${ui.artboardScale.value})`
42
42
  };
43
43
  });
44
+ const unitsByItemId = computed(() => {
45
+ const out = {};
46
+ for (const unit of props.units) {
47
+ const list = out[unit.item.id] ?? [];
48
+ list.push(unit);
49
+ out[unit.item.id] = list;
50
+ }
51
+ return out;
52
+ });
53
+ const activeKey = computed(() => {
54
+ return props.units.at(activeIndex.value)?.key ?? null;
55
+ });
56
+ function onActivate(key) {
57
+ const idx = props.units.findIndex((u) => u.key === key);
58
+ if (idx !== -1) activeIndex.value = idx;
59
+ }
44
60
  function updateRects() {
45
61
  if (itemRefs.value) {
46
62
  for (const item of itemRefs.value) {
47
- if (!item) {
48
- continue;
49
- }
50
- item.updateRect();
63
+ if (!item) continue;
64
+ item.updateRects();
51
65
  }
52
66
  }
53
67
  }
54
68
  function commitSelected() {
55
- if (!itemRefs.value) {
56
- return;
57
- }
58
- for (let i = 0; i < itemRefs.value.length; i++) {
59
- const ref = itemRefs.value[i];
60
- const item = props.items[i];
61
- if (ref && item && props.selected[item.id]) {
62
- ref.commitForApply();
63
- }
69
+ if (!itemRefs.value) return;
70
+ for (const ref of itemRefs.value) {
71
+ if (!ref) continue;
72
+ ref.commitForApply();
64
73
  }
65
74
  }
66
75
  defineExpose({ updateRects, commitSelected });
@@ -1,15 +1,15 @@
1
- import type { ApprovalItem } from '../types.js';
1
+ import type { ApprovalItem, ApprovalUnit } from '../types.js';
2
2
  type __VLS_Props = {
3
3
  items: ApprovalItem[];
4
- selected: Record<number, boolean>;
4
+ units: ApprovalUnit[];
5
+ selected: Record<string, boolean>;
5
6
  insertionsOnly?: boolean;
6
7
  };
7
8
  declare function updateRects(): void;
8
9
  /**
9
10
  * Reset each accepted item's editable to its original Vue-tracked DOM, then
10
11
  * mark them committed so the post-mutation unmount-restore is a no-op. Called
11
- * by DiffApproval BEFORE emitting `apply`, so the consumer's mutation patches
12
- * onto the freshly-restored nodes instead of the throwaway diff markup.
12
+ * by DiffApproval BEFORE emitting `apply`.
13
13
  */
14
14
  declare function commitSelected(): void;
15
15
  type __VLS_ModelProps = {
@@ -22,9 +22,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
22
22
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
23
23
  "update:modelValue": (value: number) => any;
24
24
  } & {
25
- toggle: (id: number) => any;
25
+ toggle: (key: string) => any;
26
26
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
27
- onToggle?: ((id: number) => any) | undefined;
27
+ onToggle?: ((key: string) => any) | undefined;
28
28
  "onUpdate:modelValue"?: ((value: number) => any) | undefined;
29
29
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
30
30
  declare const _default: typeof __VLS_export;
@@ -1,10 +1,20 @@
1
- import type { ApprovalItem } from '../types.js';
1
+ import type { ApprovalItem, ApprovalUnit } from '../types.js';
2
2
  type __VLS_Props = {
3
+ currentUnit: ApprovalUnit;
3
4
  currentItem: ApprovalItem;
4
- currentIndex: number;
5
- totalItems: number;
6
- selected: Record<number, boolean>;
7
- reasons: Record<number, string>;
5
+ /**
6
+ * 1-based position of the current unit across the whole batch — a single
7
+ * progress count that includes per-chunk units for segmented fields.
8
+ */
9
+ unitIndex: number;
10
+ totalUnits: number;
11
+ /**
12
+ * 1-based segment index within the current field. 0 when the current unit
13
+ * is whole-field (the segment chip is hidden in that case).
14
+ */
15
+ segmentIndex: number;
16
+ selected: Record<string, boolean>;
17
+ reasons: Record<string, string>;
8
18
  applyLabel: string;
9
19
  /**
10
20
  * Whether to show the rejection reason input.
@@ -15,8 +25,8 @@ type __VLS_Props = {
15
25
  showReason?: boolean;
16
26
  };
17
27
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
18
- "update:selected": (id: number, value: boolean) => void;
19
- "update:reasons": (id: number, value: string) => void;
28
+ "update:selected": (key: string, value: boolean) => void;
29
+ "update:reasons": (key: string, value: string) => void;
20
30
  cancel: () => void;
21
31
  apply: () => void;
22
32
  prev: () => void;
@@ -24,8 +34,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
24
34
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
25
35
  onCancel?: (() => any) | undefined;
26
36
  onApply?: (() => any) | undefined;
27
- "onUpdate:selected"?: ((id: number, value: boolean) => any) | undefined;
28
- "onUpdate:reasons"?: ((id: number, value: string) => any) | undefined;
37
+ "onUpdate:selected"?: ((key: string, value: boolean) => any) | undefined;
38
+ "onUpdate:reasons"?: ((key: string, value: string) => any) | undefined;
29
39
  onPrev?: (() => any) | undefined;
30
40
  onNext?: (() => any) | undefined;
31
41
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -65,11 +65,18 @@
65
65
  class="_bk_flex _bk_items-center _bk_gap-10 _bk_px-15 _bk_border-l _bk_border-l-mono-600 _bk_h-full"
66
66
  >
67
67
  <span class="_bk_text-mono-400 _bk_tabular-nums _bk_whitespace-nowrap">
68
- {{ currentIndex + 1 }} / {{ totalItems }}
68
+ {{ unitIndex }} / {{ totalUnits }}
69
69
  </span>
70
70
  <span class="_bk_font-medium _bk_whitespace-nowrap">
71
71
  {{ currentItem.fieldLabel }}
72
72
  <template v-if="bundleLabel"> &middot; {{ bundleLabel }}</template>
73
+ <template v-if="currentUnit.kind === 'segment'">
74
+ &middot;
75
+ <span class="_bk_font-mono _bk_text-mono-300"
76
+ >&lt;{{ currentUnit.segment.tag }}&gt;</span
77
+ >
78
+ {{ segmentIndex }}
79
+ </template>
73
80
  </span>
74
81
  </div>
75
82
 
@@ -78,7 +85,7 @@
78
85
  class="_bk_mx-15"
79
86
  color-scheme="dark"
80
87
  stretch
81
- :model-value="selected[currentItem.id]"
88
+ :model-value="selected[currentUnit.key]"
82
89
  :label="$t('aiAgentApprovalAccept', 'Accept')"
83
90
  @update:model-value="toggleCurrent"
84
91
  />
@@ -97,13 +104,13 @@
97
104
  </div>
98
105
 
99
106
  <div
100
- v-if="!selected[currentItem.id] && showReason"
107
+ v-if="!selected[currentUnit.key] && showReason"
101
108
  class="_bk_flex-1 _bk_min-w-0 _bk_px-10"
102
109
  >
103
110
  <input
104
111
  type="text"
105
112
  class="_bk_w-full _bk_h-30 _bk_px-10 _bk_rounded _bk_bg-mono-800 _bk_text-mono-100 _bk_text-sm _bk_border _bk_border-mono-600 _bk_outline-none _bk_placeholder:text-mono-500 _bk_focus:border-mono-400"
106
- :value="reasons[currentItem.id]"
113
+ :value="reasons[currentUnit.key]"
107
114
  :placeholder="
108
115
  $t(
109
116
  'aiAgentBatchRewriteReasonPlaceholder',
@@ -136,9 +143,11 @@ import {
136
143
  Tooltip
137
144
  } from "#blokkli/editor/components";
138
145
  const props = defineProps({
146
+ currentUnit: { type: Object, required: true },
139
147
  currentItem: { type: Object, required: true },
140
- currentIndex: { type: Number, required: true },
141
- totalItems: { type: Number, required: true },
148
+ unitIndex: { type: Number, required: true },
149
+ totalUnits: { type: Number, required: true },
150
+ segmentIndex: { type: Number, required: true },
142
151
  selected: { type: Object, required: true },
143
152
  reasons: { type: Object, required: true },
144
153
  applyLabel: { type: String, required: true },
@@ -154,12 +163,12 @@ const bundleLabel = computed(() => {
154
163
  return def?.label || block.bundle;
155
164
  });
156
165
  function toggleCurrent() {
157
- const item = props.currentItem;
158
- emit("update:selected", item.id, !props.selected[item.id]);
166
+ const key = props.currentUnit.key;
167
+ emit("update:selected", key, !props.selected[key]);
159
168
  }
160
169
  function onReasonInput(event) {
161
170
  const value = event.target.value;
162
- emit("update:reasons", props.currentItem.id, value);
171
+ emit("update:reasons", props.currentUnit.key, value);
163
172
  }
164
173
  </script>
165
174
 
@@ -1,10 +1,20 @@
1
- import type { ApprovalItem } from '../types.js';
1
+ import type { ApprovalItem, ApprovalUnit } from '../types.js';
2
2
  type __VLS_Props = {
3
+ currentUnit: ApprovalUnit;
3
4
  currentItem: ApprovalItem;
4
- currentIndex: number;
5
- totalItems: number;
6
- selected: Record<number, boolean>;
7
- reasons: Record<number, string>;
5
+ /**
6
+ * 1-based position of the current unit across the whole batch — a single
7
+ * progress count that includes per-chunk units for segmented fields.
8
+ */
9
+ unitIndex: number;
10
+ totalUnits: number;
11
+ /**
12
+ * 1-based segment index within the current field. 0 when the current unit
13
+ * is whole-field (the segment chip is hidden in that case).
14
+ */
15
+ segmentIndex: number;
16
+ selected: Record<string, boolean>;
17
+ reasons: Record<string, string>;
8
18
  applyLabel: string;
9
19
  /**
10
20
  * Whether to show the rejection reason input.
@@ -15,8 +25,8 @@ type __VLS_Props = {
15
25
  showReason?: boolean;
16
26
  };
17
27
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
18
- "update:selected": (id: number, value: boolean) => void;
19
- "update:reasons": (id: number, value: string) => void;
28
+ "update:selected": (key: string, value: boolean) => void;
29
+ "update:reasons": (key: string, value: string) => void;
20
30
  cancel: () => void;
21
31
  apply: () => void;
22
32
  prev: () => void;
@@ -24,8 +34,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
24
34
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
25
35
  onCancel?: (() => any) | undefined;
26
36
  onApply?: (() => any) | undefined;
27
- "onUpdate:selected"?: ((id: number, value: boolean) => any) | undefined;
28
- "onUpdate:reasons"?: ((id: number, value: string) => any) | undefined;
37
+ "onUpdate:selected"?: ((key: string, value: boolean) => any) | undefined;
38
+ "onUpdate:reasons"?: ((key: string, value: string) => any) | undefined;
29
39
  onPrev?: (() => any) | undefined;
30
40
  onNext?: (() => any) | undefined;
31
41
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -2,14 +2,14 @@ import type { ApprovalItem } from './types.js';
2
2
  type __VLS_Props = {
3
3
  items: ApprovalItem[];
4
4
  /**
5
- * Whether to show the per-item rejection reason input.
5
+ * Whether to show the per-unit rejection reason input.
6
6
  *
7
7
  * Used by the agent tools to feed feedback back to the LLM. Leave it off when
8
8
  * changes are applied directly with no agent loop.
9
9
  */
10
10
  showReason?: boolean;
11
11
  /**
12
- * Render the new value entirely as an insertion (<ins>) instead of a diff
12
+ * Render new values entirely as insertions (<ins>) instead of a diff
13
13
  * against the original.
14
14
  *
15
15
  * For features like translation the new text bears little resemblance to the
@@ -21,14 +21,22 @@ type __VLS_Props = {
21
21
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
22
22
  cancel: () => any;
23
23
  apply: (data: {
24
- selected: Record<number, boolean>;
25
- reasons: Record<number, string>;
24
+ /**
25
+ * Acceptance keyed by unit. For unsegmented items the key is the
26
+ * stringified item id; for segmented items it's `${itemId}:${segmentId}`.
27
+ */
28
+ selected: Record<string, boolean>;
29
+ reasons: Record<string, string>;
26
30
  }) => any;
27
31
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
28
32
  onCancel?: (() => any) | undefined;
29
33
  onApply?: ((data: {
30
- selected: Record<number, boolean>;
31
- reasons: Record<number, string>;
34
+ /**
35
+ * Acceptance keyed by unit. For unsegmented items the key is the
36
+ * stringified item id; for segmented items it's `${itemId}:${segmentId}`.
37
+ */
38
+ selected: Record<string, boolean>;
39
+ reasons: Record<string, string>;
32
40
  }) => any) | undefined;
33
41
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
34
42
  declare const _default: typeof __VLS_export;