@blokkli/editor 2.0.0-alpha.60 → 2.0.0-alpha.62

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 (130) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/module.mjs +1 -1
  3. package/dist/modules/agent/index.mjs +2 -5
  4. package/dist/modules/agent/runtime/app/features/agent/Container.vue +3 -3
  5. package/dist/modules/agent/runtime/app/features/agent/Panel/index.vue +15 -3
  6. package/dist/modules/agent/runtime/app/features/agent/index.vue +5 -1
  7. package/dist/modules/agent/runtime/app/features/agent/types.d.ts +2 -1
  8. package/dist/modules/agent/runtime/app/helpers/mutationResult.d.ts +38 -0
  9. package/dist/modules/agent/runtime/app/helpers/mutationResult.js +49 -0
  10. package/dist/modules/agent/runtime/app/prompts/fixReadability.js +3 -3
  11. package/dist/modules/agent/runtime/app/providers/agentProvider.d.ts +2 -1
  12. package/dist/modules/agent/runtime/app/providers/agentProvider.js +6 -6
  13. package/dist/modules/agent/runtime/app/providers/toolsProvider.js +3 -13
  14. package/dist/modules/agent/runtime/app/tools/add_content_search_paragraphs/index.d.ts +25 -0
  15. package/dist/modules/agent/runtime/app/tools/add_content_search_paragraphs/index.js +3 -2
  16. package/dist/modules/agent/runtime/app/tools/add_fragment/index.d.ts +22 -0
  17. package/dist/modules/agent/runtime/app/tools/add_fragment/index.js +3 -2
  18. package/dist/modules/agent/runtime/app/tools/add_media_paragraph/index.d.ts +24 -0
  19. package/dist/modules/agent/runtime/app/tools/add_media_paragraph/index.js +3 -2
  20. package/dist/modules/agent/runtime/app/tools/add_paragraphs/index.d.ts +32 -0
  21. package/dist/modules/agent/runtime/app/tools/add_paragraphs/index.js +6 -4
  22. package/dist/modules/agent/runtime/app/tools/add_reusable_paragraph/index.d.ts +22 -0
  23. package/dist/modules/agent/runtime/app/tools/add_reusable_paragraph/index.js +3 -2
  24. package/dist/modules/agent/runtime/app/tools/add_template/index.d.ts +22 -0
  25. package/dist/modules/agent/runtime/app/tools/add_template/index.js +5 -3
  26. package/dist/modules/agent/runtime/app/tools/ask_question/index.d.ts +3 -3
  27. package/dist/modules/agent/runtime/app/tools/ask_question/index.js +7 -6
  28. package/dist/modules/agent/runtime/app/tools/auto_translate_paragraphs/index.d.ts +10 -1
  29. package/dist/modules/agent/runtime/app/tools/auto_translate_paragraphs/index.js +4 -4
  30. package/dist/modules/agent/runtime/app/tools/check_readability_for_texts/index.d.ts +17 -0
  31. package/dist/modules/agent/runtime/app/tools/check_readability_for_texts/index.js +2 -2
  32. package/dist/modules/agent/runtime/app/tools/delegate_text_rewrite/index.d.ts +10 -1
  33. package/dist/modules/agent/runtime/app/tools/delegate_text_rewrite/index.js +3 -2
  34. package/dist/modules/agent/runtime/app/tools/delete_paragraphs/index.d.ts +16 -0
  35. package/dist/modules/agent/runtime/app/tools/delete_paragraphs/index.js +3 -2
  36. package/dist/modules/agent/runtime/app/tools/detach_reusable_paragraph/index.d.ts +16 -0
  37. package/dist/modules/agent/runtime/app/tools/detach_reusable_paragraph/index.js +3 -2
  38. package/dist/modules/agent/runtime/app/tools/duplicate_paragraphs/index.d.ts +22 -0
  39. package/dist/modules/agent/runtime/app/tools/duplicate_paragraphs/index.js +5 -3
  40. package/dist/modules/agent/runtime/app/tools/find_paragraphs/index.d.ts +31 -0
  41. package/dist/modules/agent/runtime/app/tools/find_paragraphs/index.js +7 -7
  42. package/dist/modules/agent/runtime/app/tools/get_all_fragments/index.d.ts +7 -0
  43. package/dist/modules/agent/runtime/app/tools/get_all_fragments/index.js +2 -2
  44. package/dist/modules/agent/runtime/app/tools/get_all_page_content/index.d.ts +10 -0
  45. package/dist/modules/agent/runtime/app/tools/get_all_page_content/index.js +2 -2
  46. package/dist/modules/agent/runtime/app/tools/get_bundle_info/index.d.ts +35 -0
  47. package/dist/modules/agent/runtime/app/tools/get_bundle_info/index.js +2 -2
  48. package/dist/modules/agent/runtime/app/tools/get_child_paragraphs/index.d.ts +20 -0
  49. package/dist/modules/agent/runtime/app/tools/get_child_paragraphs/index.js +2 -2
  50. package/dist/modules/agent/runtime/app/tools/get_content_fields/index.d.ts +30 -0
  51. package/dist/modules/agent/runtime/app/tools/get_content_fields/index.js +7 -6
  52. package/dist/modules/agent/runtime/app/tools/get_mutation_history/index.d.ts +25 -0
  53. package/dist/modules/agent/runtime/app/tools/get_mutation_history/index.js +2 -2
  54. package/dist/modules/agent/runtime/app/tools/get_page_structure/index.d.ts +8 -0
  55. package/dist/modules/agent/runtime/app/tools/get_page_structure/index.js +2 -2
  56. package/dist/modules/agent/runtime/app/tools/get_page_text/index.d.ts +6 -0
  57. package/dist/modules/agent/runtime/app/tools/get_page_text/index.js +2 -2
  58. package/dist/modules/agent/runtime/app/tools/get_paragraph_context/index.d.ts +81 -0
  59. package/dist/modules/agent/runtime/app/tools/get_paragraph_context/index.js +20 -12
  60. package/dist/modules/agent/runtime/app/tools/get_paragraph_options/index.d.ts +14 -0
  61. package/dist/modules/agent/runtime/app/tools/get_paragraph_options/index.js +2 -2
  62. package/dist/modules/agent/runtime/app/tools/get_paragraphs_in_viewport/index.d.ts +38 -0
  63. package/dist/modules/agent/runtime/app/tools/get_paragraphs_in_viewport/index.js +7 -6
  64. package/dist/modules/agent/runtime/app/tools/get_readability_issues/index.d.ts +12 -0
  65. package/dist/modules/agent/runtime/app/tools/get_readability_issues/index.js +2 -2
  66. package/dist/modules/agent/runtime/app/tools/get_referenced_entities/index.d.ts +14 -0
  67. package/dist/modules/agent/runtime/app/tools/get_referenced_entities/index.js +2 -2
  68. package/dist/modules/agent/runtime/app/tools/get_selected_paragraphs/index.d.ts +9 -0
  69. package/dist/modules/agent/runtime/app/tools/get_selected_paragraphs/index.js +2 -2
  70. package/dist/modules/agent/runtime/app/tools/go_to_history_index/index.d.ts +16 -0
  71. package/dist/modules/agent/runtime/app/tools/go_to_history_index/index.js +3 -2
  72. package/dist/modules/agent/runtime/app/tools/move_paragraphs/index.d.ts +22 -0
  73. package/dist/modules/agent/runtime/app/tools/move_paragraphs/index.js +3 -2
  74. package/dist/modules/agent/runtime/app/tools/rearrange_paragraphs/index.d.ts +21 -0
  75. package/dist/modules/agent/runtime/app/tools/rearrange_paragraphs/index.js +3 -2
  76. package/dist/modules/agent/runtime/app/tools/replace_content_search_item/index.d.ts +20 -0
  77. package/dist/modules/agent/runtime/app/tools/replace_content_search_item/index.js +3 -2
  78. package/dist/modules/agent/runtime/app/tools/replace_media_field/index.d.ts +19 -0
  79. package/dist/modules/agent/runtime/app/tools/replace_media_field/index.js +3 -2
  80. package/dist/modules/agent/runtime/app/tools/schemas.d.ts +13 -5
  81. package/dist/modules/agent/runtime/app/tools/schemas.js +17 -10
  82. package/dist/modules/agent/runtime/app/tools/search_content/index.d.ts +15 -0
  83. package/dist/modules/agent/runtime/app/tools/search_content/index.js +8 -7
  84. package/dist/modules/agent/runtime/app/tools/search_media/index.d.ts +5 -1
  85. package/dist/modules/agent/runtime/app/tools/search_media/index.js +2 -2
  86. package/dist/modules/agent/runtime/app/tools/search_reusable_paragraphs/index.d.ts +16 -0
  87. package/dist/modules/agent/runtime/app/tools/search_reusable_paragraphs/index.js +2 -2
  88. package/dist/modules/agent/runtime/app/tools/search_templates/index.d.ts +13 -0
  89. package/dist/modules/agent/runtime/app/tools/search_templates/index.js +2 -2
  90. package/dist/modules/agent/runtime/app/tools/search_text/index.d.ts +15 -0
  91. package/dist/modules/agent/runtime/app/tools/search_text/index.js +2 -2
  92. package/dist/modules/agent/runtime/app/tools/select_media/index.d.ts +2 -2
  93. package/dist/modules/agent/runtime/app/tools/select_media/index.js +2 -2
  94. package/dist/modules/agent/runtime/app/tools/set_paragraph_options/index.d.ts +19 -0
  95. package/dist/modules/agent/runtime/app/tools/set_paragraph_options/index.js +3 -2
  96. package/dist/modules/agent/runtime/app/tools/swap_paragraphs/index.d.ts +17 -0
  97. package/dist/modules/agent/runtime/app/tools/swap_paragraphs/index.js +3 -2
  98. package/dist/modules/agent/runtime/app/tools/update_text_fields/index.d.ts +13 -4
  99. package/dist/modules/agent/runtime/app/tools/update_text_fields/index.js +8 -7
  100. package/dist/modules/agent/runtime/app/tools/web_fetch/index.d.ts +17 -0
  101. package/dist/modules/agent/runtime/app/tools/web_fetch/index.js +2 -2
  102. package/dist/modules/agent/runtime/app/types/index.d.ts +6 -9
  103. package/dist/modules/agent/runtime/app/types/index.js +4 -3
  104. package/dist/modules/agent/runtime/server/agent.js +1 -1
  105. package/dist/modules/agent/runtime/server/classes/Session/index.d.ts +2 -2
  106. package/dist/modules/agent/runtime/server/classes/Session/index.js +6 -5
  107. package/dist/modules/agent/runtime/server/default-system-prompts/important-rules.js +2 -1
  108. package/dist/modules/agent/runtime/shared/toolParams.d.ts +19 -0
  109. package/dist/modules/agent/runtime/shared/toolParams.js +6 -0
  110. package/dist/modules/agent/runtime/shared/types.d.ts +23 -4
  111. package/dist/modules/agent/runtime/shared/types.js +6 -1
  112. package/dist/modules/charts/runtime/features/charts/Editor/ColorDropdown/index.vue +4 -13
  113. package/dist/modules/drupal/runtime/adapter/index.js +36 -26
  114. package/dist/runtime/editor/components/Actions/Title/index.vue +7 -6
  115. package/dist/runtime/editor/components/DiffApproval/index.vue +2 -2
  116. package/dist/runtime/editor/components/Dropdown/index.vue +0 -39
  117. package/dist/runtime/editor/components/DropdownItem/index.d.vue.ts +12 -2
  118. package/dist/runtime/editor/components/DropdownItem/index.vue +46 -2
  119. package/dist/runtime/editor/components/DropdownItem/index.vue.d.ts +12 -2
  120. package/dist/runtime/editor/components/FlexTextarea/index.d.vue.ts +1 -1
  121. package/dist/runtime/editor/components/FlexTextarea/index.vue.d.ts +1 -1
  122. package/dist/runtime/editor/css/output.css +1 -1
  123. package/dist/runtime/editor/features/changelog/changelog.json +9 -1
  124. package/dist/runtime/editor/plugins/Sidebar/Detached/index.d.vue.ts +1 -1
  125. package/dist/runtime/editor/plugins/Sidebar/Detached/index.vue.d.ts +1 -1
  126. package/dist/runtime/editor/plugins/Sidebar/index.d.vue.ts +2 -2
  127. package/dist/runtime/editor/plugins/Sidebar/index.vue.d.ts +2 -2
  128. package/dist/runtime/editor/translations/de.json +2 -0
  129. package/dist/runtime/editor/translations/gsw_CH.json +9 -0
  130. package/package.json +3 -2
@@ -1,5 +1,5 @@
1
1
  import type { Peer } from 'crossws';
2
- import type { PageContext, ClientToolDefinition, ServerToolMetadata, ConversationStateSnapshot } from '../../../shared/types.js';
2
+ import type { PageContext, ClientToolDefinition, ServerToolMetadata, ConversationStateSnapshot, SelectedBlock } from '../../../shared/types.js';
3
3
  import type { ServerPlan } from '../../server-tools/index.js';
4
4
  export declare class Session {
5
5
  /** The single, immutable source of truth for the conversation. */
@@ -56,7 +56,7 @@ export declare class Session {
56
56
  */
57
57
  private getToolSummary;
58
58
  init(toolNames: string[], pageContext: PageContext): void;
59
- start(peer: Peer, prompt: string, apiKey: string, authSecret: string, selectedUuids?: string[], autoLoadTools?: string[], autoLoadSkills?: string[], preSeededResults?: {
59
+ start(peer: Peer, prompt: string, apiKey: string, authSecret: string, selectedBlocks?: SelectedBlock[], autoLoadTools?: string[], autoLoadSkills?: string[], preSeededResults?: {
60
60
  toolName: string;
61
61
  params: Record<string, unknown>;
62
62
  result: unknown;
@@ -129,7 +129,7 @@ export class Session {
129
129
  this.loadedSkills = /* @__PURE__ */ new Set();
130
130
  this.pageContext = pageContext;
131
131
  }
132
- start(peer, prompt, apiKey, authSecret, selectedUuids, autoLoadTools, autoLoadSkills, preSeededResults, autoExecuteTools, rollbackToUserMessageIndex) {
132
+ start(peer, prompt, apiKey, authSecret, selectedBlocks, autoLoadTools, autoLoadSkills, preSeededResults, autoExecuteTools, rollbackToUserMessageIndex) {
133
133
  if (this.isProcessing) {
134
134
  send(peer, {
135
135
  type: "error",
@@ -156,7 +156,7 @@ export class Session {
156
156
  prompt,
157
157
  apiKey,
158
158
  authSecret,
159
- selectedUuids,
159
+ selectedBlocks,
160
160
  autoLoadTools,
161
161
  autoLoadSkills,
162
162
  preSeededResults,
@@ -356,7 +356,7 @@ export class Session {
356
356
  this.pendingPlanApproval = { resolve };
357
357
  });
358
358
  }
359
- async runAgentLoop(peer, prompt, apiKey, authSecret, selectedUuids, autoLoadTools, autoLoadSkills, preSeededResults, autoExecuteTools) {
359
+ async runAgentLoop(peer, prompt, apiKey, authSecret, selectedBlocks, autoLoadTools, autoLoadSkills, preSeededResults, autoExecuteTools) {
360
360
  if (this.toolNames.length === 0) {
361
361
  this.isProcessing = false;
362
362
  send(peer, {
@@ -404,9 +404,10 @@ ${skill.content}`
404
404
  }
405
405
  }
406
406
  const userParts = [];
407
- if (selectedUuids?.length) {
407
+ if (selectedBlocks?.length) {
408
+ const formatted = selectedBlocks.map((b) => `${b.bundle} (${b.uuid})`).join(", ");
408
409
  userParts.push(
409
- `[User has selected the following paragraphs: ${selectedUuids.join(", ")}]`
410
+ selectedBlocks.length === 1 ? `[User has selected one block: ${formatted}]` : `[User has selected: ${formatted}]`
410
411
  );
411
412
  }
412
413
  userParts.push(prompt);
@@ -14,7 +14,8 @@ export default defineBlokkliAgentSystemPrompt({
14
14
  - Use the move_paragraphs tool when moving paragraphs, instead of creating a new paragraph of the same bundle and copy pasting text.
15
15
  - ALL mutation MCP tools will make sure that the mutation is valid - it's not possible for you to make a mistake there. They return a descriptive error message.
16
16
  - It's impossible for you to make irreversible mutations! All mutations can ALWAYS be undone. You can not actually publish any changes, this can only be done by a human.
17
- - When the user's prompt implies acting on specific paragraphs but doesn't specify which ones (e.g. "translate this to german", "make this bigger", "delete these"), ALWAYS call "get_selected_paragraphs" first to check what is selected. Do this even if the prompt seems ambiguous - the selection is the most likely target.
17
+ - The user's first message includes their selection inline as "[User has selected: <bundle> (<uuid>), ...]". Treat that as the target of vague references like "this", "these", "translate this", "make this bigger" \u2014 no extra tool call needed to identify them.
18
+ - For LATER messages where the prompt implies acting on the current selection but the first-message annotation is absent or stale, call "get_selected_paragraphs" \u2014 the user may have changed their selection since the conversation started.
18
19
  - You can output text as you please, markdown is allowed!
19
20
  `;
20
21
  }
@@ -13,8 +13,27 @@ import { z } from 'zod';
13
13
  *
14
14
  * Lives in `shared/` so both client tools and server-only tools build the same
15
15
  * coercion into their respective bundles from one source.
16
+ *
17
+ * Return type is explicit so mkdist's isolated-declaration emit preserves it
18
+ * when this helper appears nested inside another schema. Chaining `.optional()`
19
+ * or `.default()` on the result would degrade to `any` in the published `.d.ts`
20
+ * — use {@link optionalBooleanParam} / {@link booleanParamWithDefault} instead.
16
21
  */
17
22
  export declare function booleanParam(description: string): z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodBoolean>;
23
+ /**
24
+ * Optional variant of {@link booleanParam}. Use instead of
25
+ * `booleanParam(...).optional()` so isolated-declaration emit can preserve the
26
+ * type — chained Zod method calls aren't resolvable by mkdist's per-file
27
+ * declaration emit and collapse to `any` in the published `.d.ts`.
28
+ */
29
+ export declare function optionalBooleanParam(description: string): z.ZodOptional<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodBoolean>>;
30
+ /**
31
+ * Optional boolean with a default. Use instead of
32
+ * `booleanParam(...).optional().default(value)` so isolated-declaration emit
33
+ * can preserve the type. The default value applies when the param is omitted
34
+ * or `undefined` at parse time.
35
+ */
36
+ export declare function booleanParamWithDefault(description: string, defaultValue: boolean): z.ZodDefault<z.ZodOptional<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodBoolean>>>;
18
37
  /**
19
38
  * Coerce double-serialized array/object params back to their real values.
20
39
  *
@@ -9,6 +9,12 @@ export function booleanParam(description) {
9
9
  return value;
10
10
  }, z.boolean().describe(description));
11
11
  }
12
+ export function optionalBooleanParam(description) {
13
+ return booleanParam(description).optional();
14
+ }
15
+ export function booleanParamWithDefault(description, defaultValue) {
16
+ return booleanParam(description).optional().default(defaultValue);
17
+ }
12
18
  export function coerceStringifiedParams(params) {
13
19
  const result = {};
14
20
  for (const key of Object.keys(params)) {
@@ -207,6 +207,7 @@ export type PageContext = {
207
207
  * Both Anthropic and OpenAI SDKs map to these via HTTP status codes.
208
208
  */
209
209
  export declare const agentErrorTypeSchema: z.ZodEnum<{
210
+ unknown: "unknown";
210
211
  authentication: "authentication";
211
212
  rate_limit: "rate_limit";
212
213
  overloaded: "overloaded";
@@ -214,7 +215,6 @@ export declare const agentErrorTypeSchema: z.ZodEnum<{
214
215
  bad_request: "bad_request";
215
216
  connection: "connection";
216
217
  unauthorized: "unauthorized";
217
- unknown: "unknown";
218
218
  }>;
219
219
  export type AgentErrorType = z.infer<typeof agentErrorTypeSchema>;
220
220
  /**
@@ -312,6 +312,21 @@ export declare const pageStructureSchema: z.ZodObject<{
312
312
  entityContentFields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
313
313
  }, z.core.$strip>;
314
314
  export type PageStructure = z.infer<typeof pageStructureSchema>;
315
+ /**
316
+ * A block the user had selected when sending the initial message. The bundle
317
+ * and label travel with the UUID so the LLM can disambiguate "this" / "these"
318
+ * without an extra `get_selected_paragraphs` round-trip.
319
+ */
320
+ export type SelectedBlock = {
321
+ uuid: string;
322
+ bundle: string;
323
+ label: string;
324
+ };
325
+ export declare const selectedBlockSchema: z.ZodObject<{
326
+ uuid: z.ZodString;
327
+ bundle: z.ZodString;
328
+ label: z.ZodString;
329
+ }, z.core.$strip>;
315
330
  export declare const clientMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
316
331
  type: z.ZodLiteral<"authenticate">;
317
332
  authToken: z.ZodString;
@@ -340,8 +355,8 @@ export declare const clientMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
340
355
  name: z.ZodString;
341
356
  label: z.ZodString;
342
357
  type: z.ZodEnum<{
343
- reference: "reference";
344
358
  link: "link";
359
+ reference: "reference";
345
360
  }>;
346
361
  allowed: z.ZodArray<z.ZodObject<{
347
362
  type: z.ZodString;
@@ -380,8 +395,8 @@ export declare const clientMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
380
395
  name: z.ZodString;
381
396
  label: z.ZodString;
382
397
  type: z.ZodEnum<{
383
- reference: "reference";
384
398
  link: "link";
399
+ reference: "reference";
385
400
  }>;
386
401
  allowed: z.ZodArray<z.ZodObject<{
387
402
  type: z.ZodString;
@@ -406,7 +421,11 @@ export declare const clientMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
406
421
  }, z.core.$strip>, z.ZodObject<{
407
422
  type: z.ZodLiteral<"start">;
408
423
  prompt: z.ZodString;
409
- selectedUuids: z.ZodOptional<z.ZodArray<z.ZodString>>;
424
+ selectedBlocks: z.ZodOptional<z.ZodArray<z.ZodObject<{
425
+ uuid: z.ZodString;
426
+ bundle: z.ZodString;
427
+ label: z.ZodString;
428
+ }, z.core.$strip>>>;
410
429
  autoLoadTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
411
430
  autoLoadSkills: z.ZodOptional<z.ZodArray<z.ZodString>>;
412
431
  preSeededResults: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -101,6 +101,11 @@ export const pageStructureSchema = z.object({
101
101
  fields: z.record(z.string(), z.array(pageStructureBlockSchema)),
102
102
  entityContentFields: z.record(z.string(), z.string()).optional()
103
103
  });
104
+ export const selectedBlockSchema = z.object({
105
+ uuid: z.string(),
106
+ bundle: z.string(),
107
+ label: z.string()
108
+ });
104
109
  const genericContentBlockSchema = z.discriminatedUnion("type", [
105
110
  z.object({ type: z.literal("text"), text: z.string() }),
106
111
  z.object({ type: z.literal("skill"), name: z.string(), text: z.string() }),
@@ -142,7 +147,7 @@ export const clientMessageSchema = z.discriminatedUnion("type", [
142
147
  z.object({
143
148
  type: z.literal("start"),
144
149
  prompt: z.string(),
145
- selectedUuids: z.array(z.string()).optional(),
150
+ selectedBlocks: z.array(selectedBlockSchema).optional(),
146
151
  autoLoadTools: z.array(z.string()).optional(),
147
152
  autoLoadSkills: z.array(z.string()).optional(),
148
153
  preSeededResults: z.array(
@@ -7,12 +7,10 @@
7
7
  />
8
8
  </template>
9
9
  <template #default="{ close }">
10
- <button
10
+ <DropdownItem
11
11
  v-for="entry in colorOptions"
12
12
  :key="entry.id"
13
- type="button"
14
- class="bk-dropdown-menu-item _bk_min-w-[200px] _bk_group/item"
15
- :class="{ 'bk-is-active': colorId === entry.id }"
13
+ :text="entry.label"
16
14
  @click="
17
15
  () => {
18
16
  emit('select', entry.id);
@@ -24,21 +22,14 @@
24
22
  class="bk-chart-color-swatch"
25
23
  :style="{ backgroundColor: entry.hex }"
26
24
  />
27
- <span
28
- :class="{
29
- '_bk_text-mono-500 _bk_font-normal _bk_group-hover/item:text-mono-900': colorId !== entry.id,
30
- '_bk_font-bold': colorId === entry.id
31
- }"
32
- >{{ entry.label }}</span
33
- >
34
- </button>
25
+ </DropdownItem>
35
26
  </template>
36
27
  </Dropdown>
37
28
  </template>
38
29
 
39
30
  <script setup>
40
31
  import { computed, useBlokkli } from "#imports";
41
- import { Dropdown } from "#blokkli/editor/components";
32
+ import { Dropdown, DropdownItem } from "#blokkli/editor/components";
42
33
  const props = defineProps({
43
34
  colorId: { type: String, required: true }
44
35
  });
@@ -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();
@@ -1510,7 +1510,7 @@ export default defineBlokkliEditAdapter(
1510
1510
  host: hostInput()
1511
1511
  }).then((v) => mapConversation(v.data.conversation)),
1512
1512
  list: () => useGraphqlQuery("pbAgentConversations", { host: hostInput() }).then(
1513
- (v) => v.data.result.items
1513
+ (v) => v.data.result?.items ?? []
1514
1514
  ),
1515
1515
  delete: (uuid) => useGraphqlMutation("pbAgentConversationDelete", { uuid }).then(
1516
1516
  (v) => v.data.result.success
@@ -1526,33 +1526,43 @@ export default defineBlokkliEditAdapter(
1526
1526
  }
1527
1527
  if (hasQuery("pbAgentConversationsAll")) {
1528
1528
  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
- })
1529
+ (v) => {
1530
+ if (!v.data.result) {
1531
+ throw new Error("Failed to load agent conversations.");
1532
+ }
1533
+ return {
1534
+ filters: mapPluginConfigInputs(v.data.result.filters),
1535
+ items: v.data.result.items.map((c) => ({
1536
+ uuid: c.uuid,
1537
+ title: c.title,
1538
+ createdAt: c.createdAt,
1539
+ updatedAt: c.updatedAt,
1540
+ host: c.host ? {
1541
+ entityType: c.host.entityType,
1542
+ entityUuid: c.host.entityUuid,
1543
+ label: c.host.label ?? null,
1544
+ editUrl: c.host.editUrl ?? null
1545
+ } : null,
1546
+ author: mapBlokkliUser(c.author)
1547
+ })),
1548
+ perPage: v.data.result.perPage,
1549
+ total: v.data.result.total
1550
+ };
1551
+ }
1547
1552
  );
1548
1553
  }
1549
1554
  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
- }));
1555
+ adapter.agentConversations.queryFeedback = (e) => useGraphqlQuery("pbAgentFeedbackAll", { page: e.page }).then((v) => {
1556
+ if (!v.data.result) {
1557
+ throw new Error("Failed to load agent feedback.");
1558
+ }
1559
+ return {
1560
+ filters: mapPluginConfigInputs(v.data.result.filters),
1561
+ items: v.data.result.items.map(mapFeedback),
1562
+ perPage: v.data.result.perPage,
1563
+ total: v.data.result.total
1564
+ };
1565
+ });
1556
1566
  }
1557
1567
  }
1558
1568
  if (hasMutation("pbBulkUpdateFieldValues")) {
@@ -91,15 +91,16 @@
91
91
  />
92
92
  </button>
93
93
  <div
94
- v-if="editingEnabled"
95
- v-show="showDropdown"
94
+ v-show="showDropdown && editingEnabled"
96
95
  id="bk-blokkli-item-actions-dropdown"
97
96
  class="_bk_absolute _bk_bottom-full _bk_left-0 _bk_min-w-[300px] _bk_bg-mono-900 _bk_text-mono-200 _bk_shadow-xl-inverted _bk_w-screen _bk_lg:w-auto _bk_flex _bk_flex-col _bk_lg:top-full _bk_lg:bottom-auto _bk_lg:shadow-xl _bk_lg:left-[23px]"
98
97
  >
99
- <EditActionsItemDropdown
100
- v-if="showDropdown"
101
- @close="showDropdown = false"
102
- />
98
+ <div>
99
+ <EditActionsItemDropdown
100
+ v-if="showDropdown"
101
+ @close="showDropdown = false"
102
+ />
103
+ </div>
103
104
  </div>
104
105
  </div>
105
106
  </template>
@@ -78,7 +78,7 @@ const items = [...props.items].sort((a, b) => {
78
78
  });
79
79
  const currentIndex = ref(0);
80
80
  const currentItem = computed(() => {
81
- return props.items.at(currentIndex.value) ?? null;
81
+ return items.at(currentIndex.value) ?? null;
82
82
  });
83
83
  const selected = reactive(
84
84
  Object.fromEntries(items.map((item) => [item.id, true]))
@@ -144,7 +144,7 @@ onBlokkliEvent("keyPressed", (e) => {
144
144
  }
145
145
  });
146
146
  onBlokkliEvent("editable:focus", (e) => {
147
- const index = props.items.findIndex(
147
+ const index = items.findIndex(
148
148
  (item) => item.fieldName === e.fieldName && item.uuid === e.uuid
149
149
  );
150
150
  if (index !== -1) {
@@ -151,43 +151,4 @@ defineExpose({ close });
151
151
  margin-top: 5px;
152
152
  transform-origin: 100% 0;
153
153
  }
154
- .bk .bk-dropdown-menu-item {
155
- display: flex;
156
- width: 100%;
157
- align-items: center;
158
- gap: 8px;
159
- padding-inline: 10px;
160
- padding-block: 10px;
161
- text-align: left;
162
- font-size: var(--text-sm, 14px);
163
- line-height: var(--bk-tw-leading, var(--text-sm--line-height, calc(1.25 / 0.875)));
164
- color: rgb(var(--bk-theme-mono-700) / 1);
165
- cursor: pointer;
166
- --bk-tw-border-style: none;
167
- border-style: none;
168
- background-color: transparent;
169
- }
170
- @media (hover: hover) {
171
- :is(.bk .bk-dropdown-menu-item):hover {
172
- background-color: rgb(var(--bk-theme-mono-100) / 1);
173
- }
174
- }
175
- @media (hover: hover) {
176
- :is(.bk .bk-dropdown-menu-item):hover {
177
- color: rgb(var(--bk-theme-mono-950) / 1);
178
- }
179
- }
180
- .bk .bk-dropdown-menu-item {
181
- --bk-tw-leading: 1;
182
- line-height: 1;
183
- white-space: nowrap;
184
- }
185
- :is(.bk .bk-dropdown-menu-item):hover svg {
186
- fill: rgb(var(--bk-theme-accent-700) / 1);
187
- }
188
- :is(.bk .bk-dropdown-menu-item) svg {
189
- width: 18px;
190
- height: 18px;
191
- fill: currentcolor;
192
- }
193
154
  </style>
@@ -1,13 +1,23 @@
1
1
  import type { BlokkliIcon } from '#blokkli-build/icons';
2
2
  type __VLS_Props = {
3
- icon: BlokkliIcon;
3
+ icon?: BlokkliIcon;
4
4
  text: string;
5
5
  disabled?: boolean;
6
6
  };
7
- declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
7
+ declare var __VLS_1: {};
8
+ type __VLS_Slots = {} & {
9
+ default?: (props: typeof __VLS_1) => any;
10
+ };
11
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
8
12
  click: () => any;
9
13
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
10
14
  onClick?: (() => any) | undefined;
11
15
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
16
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
12
17
  declare const _default: typeof __VLS_export;
13
18
  export default _default;
19
+ type __VLS_WithSlots<T, S> = T & {
20
+ new (): {
21
+ $slots: S;
22
+ };
23
+ };
@@ -1,6 +1,8 @@
1
1
  <template>
2
2
  <button class="bk-dropdown-menu-item" :disabled @click="$emit('click')">
3
- <Icon :name="icon" />
3
+ <slot>
4
+ <Icon v-if="icon" :name="icon" />
5
+ </slot>
4
6
  <span>{{ text }}</span>
5
7
  </button>
6
8
  </template>
@@ -8,9 +10,51 @@
8
10
  <script setup>
9
11
  import { Icon } from "#blokkli/editor/components";
10
12
  defineProps({
11
- icon: { type: null, required: true },
13
+ icon: { type: null, required: false },
12
14
  text: { type: String, required: true },
13
15
  disabled: { type: Boolean, required: false }
14
16
  });
15
17
  defineEmits(["click"]);
16
18
  </script>
19
+
20
+ <style>/*! tailwindcss v4.2.4 | MIT License | https://tailwindcss.com */
21
+ .bk .bk-dropdown-menu-item {
22
+ display: flex;
23
+ width: 100%;
24
+ align-items: center;
25
+ gap: 8px;
26
+ padding-inline: 10px;
27
+ padding-block: 10px;
28
+ text-align: left;
29
+ font-size: var(--text-sm, 14px);
30
+ line-height: var(--bk-tw-leading, var(--text-sm--line-height, calc(1.25 / 0.875)));
31
+ color: rgb(var(--bk-theme-mono-700) / 1);
32
+ cursor: pointer;
33
+ --bk-tw-border-style: none;
34
+ border-style: none;
35
+ background-color: transparent;
36
+ }
37
+ @media (hover: hover) {
38
+ :is(.bk .bk-dropdown-menu-item):hover {
39
+ background-color: rgb(var(--bk-theme-mono-100) / 1);
40
+ }
41
+ }
42
+ @media (hover: hover) {
43
+ :is(.bk .bk-dropdown-menu-item):hover {
44
+ color: rgb(var(--bk-theme-mono-950) / 1);
45
+ }
46
+ }
47
+ .bk .bk-dropdown-menu-item {
48
+ --bk-tw-leading: 1;
49
+ line-height: 1;
50
+ white-space: nowrap;
51
+ }
52
+ :is(.bk .bk-dropdown-menu-item):hover svg {
53
+ fill: rgb(var(--bk-theme-accent-700) / 1);
54
+ }
55
+ :is(.bk .bk-dropdown-menu-item) svg {
56
+ width: 18px;
57
+ height: 18px;
58
+ fill: currentcolor;
59
+ }
60
+ </style>
@@ -1,13 +1,23 @@
1
1
  import type { BlokkliIcon } from '#blokkli-build/icons';
2
2
  type __VLS_Props = {
3
- icon: BlokkliIcon;
3
+ icon?: BlokkliIcon;
4
4
  text: string;
5
5
  disabled?: boolean;
6
6
  };
7
- declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
7
+ declare var __VLS_1: {};
8
+ type __VLS_Slots = {} & {
9
+ default?: (props: typeof __VLS_1) => any;
10
+ };
11
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
8
12
  click: () => any;
9
13
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
10
14
  onClick?: (() => any) | undefined;
11
15
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
16
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
12
17
  declare const _default: typeof __VLS_export;
13
18
  export default _default;
19
+ type __VLS_WithSlots<T, S> = T & {
20
+ new (): {
21
+ $slots: S;
22
+ };
23
+ };
@@ -28,8 +28,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
28
28
  onSubmit?: (() => any) | undefined;
29
29
  "onUpdate:modelValue"?: ((value: string) => any) | undefined;
30
30
  }>, {
31
- minHeight: number;
32
31
  maxHeight: number;
32
+ minHeight: number;
33
33
  onBeforePaste: (data: ClipboardData) => boolean;
34
34
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
35
35
  declare const _default: typeof __VLS_export;
@@ -28,8 +28,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
28
28
  onSubmit?: (() => any) | undefined;
29
29
  "onUpdate:modelValue"?: ((value: string) => any) | undefined;
30
30
  }>, {
31
- minHeight: number;
32
31
  maxHeight: number;
32
+ minHeight: number;
33
33
  onBeforePaste: (data: ClipboardData) => boolean;
34
34
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
35
35
  declare const _default: typeof __VLS_export;