@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.
- package/dist/global/types/colorOptions.d.ts +16 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +168 -14
- package/dist/modules/agent/runtime/app/components/Conversation/Item/Assistant/index.vue +14 -5
- package/dist/modules/agent/runtime/app/features/agent/ConversationsAdmin/ConversationsTab/Item.vue +2 -2
- package/dist/modules/agent/runtime/app/features/agent/ConversationsAdmin/RatingsTab/Item.vue +2 -2
- package/dist/modules/agent/runtime/app/features/agent/ConversationsAdmin/SplitView/ConversationDetail.vue +2 -2
- package/dist/modules/agent/runtime/app/features/agent/Transcript/MessageContent.vue +14 -1
- package/dist/modules/agent/runtime/app/features/agent/Transcript/index.vue +30 -12
- package/dist/modules/agent/runtime/app/helpers/linkifyBlockUuids.d.ts +11 -0
- package/dist/modules/agent/runtime/app/helpers/linkifyBlockUuids.js +47 -0
- package/dist/modules/agent/runtime/app/tools/auto_translate_paragraphs/Component.d.vue.ts +22 -0
- package/dist/modules/agent/runtime/app/tools/auto_translate_paragraphs/Component.vue +28 -26
- package/dist/modules/agent/runtime/app/tools/auto_translate_paragraphs/Component.vue.d.ts +22 -0
- package/dist/modules/agent/runtime/app/tools/auto_translate_paragraphs/index.d.ts +15 -0
- package/dist/modules/agent/runtime/app/tools/delegate_text_rewrite/Component.d.vue.ts +22 -0
- package/dist/modules/agent/runtime/app/tools/delegate_text_rewrite/Component.vue +59 -16
- package/dist/modules/agent/runtime/app/tools/delegate_text_rewrite/Component.vue.d.ts +22 -0
- package/dist/modules/agent/runtime/app/tools/delegate_text_rewrite/index.d.ts +15 -0
- package/dist/modules/agent/runtime/app/tools/fieldDiffApproval.d.ts +85 -15
- package/dist/modules/agent/runtime/app/tools/fieldDiffApproval.js +138 -28
- package/dist/modules/agent/runtime/app/tools/schemas.d.ts +15 -5
- package/dist/modules/agent/runtime/app/tools/schemas.js +29 -12
- package/dist/modules/agent/runtime/app/tools/search_text/index.js +1 -1
- package/dist/modules/agent/runtime/app/tools/update_text_fields/Component.d.vue.ts +22 -0
- package/dist/modules/agent/runtime/app/tools/update_text_fields/Component.vue +54 -30
- package/dist/modules/agent/runtime/app/tools/update_text_fields/Component.vue.d.ts +22 -0
- package/dist/modules/agent/runtime/app/tools/update_text_fields/index.d.ts +15 -0
- package/dist/modules/agent/runtime/server/default-system-prompts/architecture.js +1 -1
- package/dist/modules/agent/runtime/server/default-system-prompts/important-rules.js +1 -0
- package/dist/modules/charts/runtime/blokkli/tools/chart_schemas.d.ts +1 -1
- package/dist/modules/charts/runtime/blokkli/tools/chart_schemas.js +12 -5
- package/dist/modules/charts/runtime/components/ChartRenderer/index.vue +7 -16
- package/dist/modules/charts/runtime/features/charts/Editor/ColorDropdown/index.vue +7 -77
- package/dist/modules/charts/runtime/features/charts/Editor/CsvImport/csvHelpers.d.ts +1 -1
- package/dist/modules/charts/runtime/features/charts/Editor/useChartEditorState.d.ts +1 -1
- package/dist/modules/charts/runtime/helpers/index.d.ts +2 -1
- package/dist/modules/charts/runtime/helpers/index.js +4 -2
- package/dist/modules/drupal/graphql/base/fragment.paragraphsBlokkliMutationResult.graphql +3 -0
- package/dist/modules/drupal/runtime/adapter/index.js +2 -1
- package/dist/runtime/composables/useBlokkliRuntimeConfig.d.ts +50 -0
- package/dist/runtime/composables/useBlokkliRuntimeConfig.js +34 -0
- package/dist/runtime/editor/adapter/index.d.ts +2 -1
- package/dist/runtime/editor/components/ColorDropdown/index.d.vue.ts +26 -0
- package/dist/runtime/editor/components/ColorDropdown/index.vue +116 -0
- package/dist/runtime/editor/components/ColorDropdown/index.vue.d.ts +26 -0
- package/dist/runtime/editor/components/DiffApproval/Highlight/Item.d.vue.ts +14 -20
- package/dist/runtime/editor/components/DiffApproval/Highlight/Item.vue +97 -52
- package/dist/runtime/editor/components/DiffApproval/Highlight/Item.vue.d.ts +14 -20
- package/dist/runtime/editor/components/DiffApproval/Highlight/index.d.vue.ts +6 -6
- package/dist/runtime/editor/components/DiffApproval/Highlight/index.vue +30 -21
- package/dist/runtime/editor/components/DiffApproval/Highlight/index.vue.d.ts +6 -6
- package/dist/runtime/editor/components/DiffApproval/Toolbar/index.d.vue.ts +19 -9
- package/dist/runtime/editor/components/DiffApproval/Toolbar/index.vue +18 -9
- package/dist/runtime/editor/components/DiffApproval/Toolbar/index.vue.d.ts +19 -9
- package/dist/runtime/editor/components/DiffApproval/index.d.vue.ts +14 -6
- package/dist/runtime/editor/components/DiffApproval/index.vue +62 -35
- package/dist/runtime/editor/components/DiffApproval/index.vue.d.ts +14 -6
- package/dist/runtime/editor/components/DiffApproval/types.d.ts +32 -0
- package/dist/runtime/editor/components/DiffApproval/types.js +22 -0
- package/dist/runtime/editor/components/Dropdown/index.d.vue.ts +5 -4
- package/dist/runtime/editor/components/Dropdown/index.vue +89 -29
- package/dist/runtime/editor/components/Dropdown/index.vue.d.ts +5 -4
- package/dist/runtime/editor/components/FlexTextarea/index.d.vue.ts +1 -1
- package/dist/runtime/editor/components/FlexTextarea/index.vue.d.ts +1 -1
- package/dist/runtime/editor/components/NestedEditorOverlay/index.d.vue.ts +2 -2
- package/dist/runtime/editor/components/NestedEditorOverlay/index.vue +3 -3
- package/dist/runtime/editor/components/NestedEditorOverlay/index.vue.d.ts +2 -2
- package/dist/runtime/editor/components/PopupHost/index.d.vue.ts +13 -0
- package/dist/runtime/editor/components/PopupHost/index.vue +12 -0
- package/dist/runtime/editor/components/PopupHost/index.vue.d.ts +13 -0
- package/dist/runtime/editor/components/index.d.ts +2 -0
- package/dist/runtime/editor/components/index.js +2 -0
- package/dist/runtime/editor/css/output.css +1 -1
- package/dist/runtime/editor/features/analyze/Main.vue +15 -2
- package/dist/runtime/editor/features/analyze/Results/ResultsItemNodes.vue +4 -1
- package/dist/runtime/editor/features/analyze/Results/ResultsItemNodesTarget.vue +25 -16
- package/dist/runtime/editor/features/analyze/analyzers/defaults/validations.d.ts +10 -0
- package/dist/runtime/editor/features/analyze/analyzers/defaults/validations.js +39 -0
- package/dist/runtime/editor/features/analyze/analyzers/helpers/Context.d.ts +5 -1
- package/dist/runtime/editor/features/analyze/analyzers/helpers/Context.js +5 -0
- package/dist/runtime/editor/features/analyze/index.vue +0 -1
- package/dist/runtime/editor/features/changelog/changelog.json +9 -1
- package/dist/runtime/editor/features/comments/Comment/Meta/index.vue +1 -1
- package/dist/runtime/editor/features/comments/Comment/index.vue +1 -1
- package/dist/runtime/editor/features/publish/Dialog/Violations.d.vue.ts +12 -0
- package/dist/runtime/editor/features/publish/Dialog/Violations.vue +117 -0
- package/dist/runtime/editor/features/publish/Dialog/Violations.vue.d.ts +12 -0
- package/dist/runtime/editor/features/publish/Dialog/index.vue +61 -24
- package/dist/runtime/editor/features/publish/index.vue +2 -4
- package/dist/runtime/editor/features/publish/types.d.ts +0 -4
- package/dist/runtime/editor/helpers/color/index.d.ts +7 -0
- package/dist/runtime/editor/helpers/color/index.js +14 -0
- package/dist/runtime/editor/helpers/diff/index.d.ts +87 -0
- package/dist/runtime/editor/helpers/diff/index.js +256 -0
- package/dist/runtime/editor/helpers/injections.d.ts +11 -0
- package/dist/runtime/editor/helpers/injections.js +1 -0
- package/dist/runtime/editor/plugins/Sidebar/Detached/index.d.vue.ts +1 -1
- package/dist/runtime/editor/plugins/Sidebar/Detached/index.vue.d.ts +1 -1
- package/dist/runtime/editor/plugins/Sidebar/index.d.vue.ts +2 -2
- package/dist/runtime/editor/plugins/Sidebar/index.vue.d.ts +2 -2
- package/dist/runtime/editor/providers/analyze.js +5 -2
- package/dist/runtime/editor/providers/config.d.ts +3 -1
- package/dist/runtime/editor/providers/config.js +46 -15
- package/dist/runtime/editor/providers/state.d.ts +13 -0
- package/dist/runtime/editor/providers/state.js +7 -0
- package/dist/runtime/editor/translations/de.json +7 -4
- package/dist/runtime/editor/translations/fr.json +2 -4
- package/dist/runtime/editor/translations/gsw_CH.json +7 -4
- package/dist/runtime/editor/translations/it.json +2 -4
- package/dist/runtime/helpers/colors.d.ts +39 -0
- package/dist/runtime/helpers/colors.js +28 -0
- package/dist/runtime/types/colors.d.ts +11 -0
- package/package.json +1 -1
- package/dist/runtime/editor/features/validations/Overlay/Item.d.vue.ts +0 -7
- package/dist/runtime/editor/features/validations/Overlay/Item.vue +0 -36
- package/dist/runtime/editor/features/validations/Overlay/Item.vue.d.ts +0 -7
- package/dist/runtime/editor/features/validations/Overlay/index.d.vue.ts +0 -7
- package/dist/runtime/editor/features/validations/Overlay/index.vue +0 -115
- package/dist/runtime/editor/features/validations/Overlay/index.vue.d.ts +0 -7
- package/dist/runtime/editor/features/validations/SidebarItem/index.d.vue.ts +0 -10
- package/dist/runtime/editor/features/validations/SidebarItem/index.vue +0 -41
- package/dist/runtime/editor/features/validations/SidebarItem/index.vue.d.ts +0 -10
- package/dist/runtime/editor/features/validations/index.d.vue.ts +0 -3
- package/dist/runtime/editor/features/validations/index.vue +0 -91
- package/dist/runtime/editor/features/validations/index.vue.d.ts +0 -3
- package/dist/runtime/editor/types/config.d.ts +0 -5
- /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
|
-
|
|
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="
|
|
10
|
+
:style="rects[unit.key]"
|
|
9
11
|
>
|
|
10
|
-
<button class="_bk_size-full _bk_block" @click.prevent="$emit('activate')" />
|
|
11
12
|
<button
|
|
12
|
-
|
|
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="
|
|
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 {
|
|
48
|
+
import {
|
|
49
|
+
computeDiff,
|
|
50
|
+
computeInsertion,
|
|
51
|
+
flattenSegments,
|
|
52
|
+
renderSegmentDiff
|
|
53
|
+
} from "#blokkli/editor/helpers/diff";
|
|
44
54
|
const props = defineProps({
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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
|
|
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
|
|
72
|
-
|
|
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 (
|
|
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
|
-
() =>
|
|
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({
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
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
|
-
|
|
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
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
selected: boolean
|
|
6
|
-
|
|
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
|
|
15
|
+
declare function updateRects(): void;
|
|
22
16
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
|
|
23
|
-
|
|
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
|
-
|
|
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
|
|
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: (
|
|
25
|
+
toggle: (key: string) => any;
|
|
26
26
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
27
|
-
onToggle?: ((
|
|
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="
|
|
8
|
+
v-for="item in items"
|
|
9
9
|
:key="item.id"
|
|
10
10
|
ref="itemRefs"
|
|
11
|
-
:
|
|
12
|
-
:
|
|
13
|
-
:
|
|
14
|
-
:
|
|
15
|
-
:active="i === activeIndex"
|
|
11
|
+
:item
|
|
12
|
+
:units="unitsByItemId[item.id] ?? []"
|
|
13
|
+
:selected
|
|
14
|
+
:active-key
|
|
16
15
|
:insertions-only
|
|
17
|
-
@activate="
|
|
18
|
-
@toggle="emit('toggle',
|
|
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
|
-
|
|
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
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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
|
-
|
|
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
|
|
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: (
|
|
25
|
+
toggle: (key: string) => any;
|
|
26
26
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
27
|
-
onToggle?: ((
|
|
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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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": (
|
|
19
|
-
"update:reasons": (
|
|
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"?: ((
|
|
28
|
-
"onUpdate:reasons"?: ((
|
|
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
|
-
{{
|
|
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"> · {{ bundleLabel }}</template>
|
|
73
|
+
<template v-if="currentUnit.kind === 'segment'">
|
|
74
|
+
·
|
|
75
|
+
<span class="_bk_font-mono _bk_text-mono-300"
|
|
76
|
+
><{{ currentUnit.segment.tag }}></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[
|
|
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[
|
|
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[
|
|
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
|
-
|
|
141
|
-
|
|
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
|
|
158
|
-
emit("update:selected",
|
|
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.
|
|
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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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": (
|
|
19
|
-
"update:reasons": (
|
|
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"?: ((
|
|
28
|
-
"onUpdate:reasons"?: ((
|
|
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-
|
|
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
|
|
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
|
-
|
|
25
|
-
|
|
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
|
-
|
|
31
|
-
|
|
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;
|