@blokkli/editor 2.0.0-alpha.35 → 2.0.0-alpha.37
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/blockOptions.d.ts +10 -2
- package/dist/global/types/definitions.d.ts +12 -5
- package/dist/module.d.mts +2 -2
- package/dist/module.json +1 -1
- package/dist/module.mjs +126 -7
- package/dist/modules/agent/index.d.mts +1 -1
- package/dist/modules/agent/index.mjs +273 -25
- package/dist/modules/agent/runtime/app/composables/agentProvider.d.ts +2 -2
- package/dist/modules/agent/runtime/app/composables/agentProvider.js +34 -17
- package/dist/modules/agent/runtime/app/composables/defineBlokkliAgentTool.d.ts +2 -20
- package/dist/modules/agent/runtime/app/composables/defineBlokkliAgentTool.js +0 -3
- package/dist/modules/agent/runtime/app/features/agent/Panel/Conversation/Item/Assistant/index.vue +2 -2
- package/dist/modules/agent/runtime/app/features/agent/Panel/Conversation/Item/User/index.vue +1 -2
- package/dist/modules/agent/runtime/app/features/agent/Panel/DebugGallery/index.vue +1 -2
- package/dist/modules/agent/runtime/app/features/agent/Panel/Input/Actions/index.d.vue.ts +1 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Input/Actions/index.vue +67 -86
- package/dist/modules/agent/runtime/app/features/agent/Panel/Input/Actions/index.vue.d.ts +1 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Input/index.vue +10 -12
- package/dist/modules/agent/runtime/app/features/agent/Panel/Welcome/de.md +2 -2
- package/dist/modules/agent/runtime/app/features/agent/Panel/Welcome/en.md +2 -2
- package/dist/modules/agent/runtime/app/features/agent/Panel/index.vue +1 -5
- package/dist/modules/agent/runtime/app/features/agent/Transcript/index.d.vue.ts +8 -0
- package/dist/modules/agent/runtime/app/features/agent/Transcript/index.vue +138 -0
- package/dist/modules/agent/runtime/app/features/agent/Transcript/index.vue.d.ts +8 -0
- package/dist/modules/agent/runtime/app/features/agent/index.vue +94 -38
- package/dist/modules/agent/runtime/app/helpers/index.d.ts +16 -19
- package/dist/modules/agent/runtime/app/helpers/index.js +22 -46
- package/dist/modules/agent/runtime/app/helpers/pageStructure.js +1 -1
- package/dist/modules/agent/runtime/app/tools/add_content_search_paragraph/index.js +5 -9
- package/dist/modules/agent/runtime/app/tools/add_fragment/index.js +2 -6
- package/dist/modules/agent/runtime/app/tools/add_media_paragraph/index.js +2 -6
- package/dist/modules/agent/runtime/app/tools/add_paragraphs/index.js +2 -3
- package/dist/modules/agent/runtime/app/tools/add_reusable_paragraph/index.js +2 -6
- package/dist/modules/agent/runtime/app/tools/add_template/index.js +2 -6
- package/dist/modules/agent/runtime/app/tools/analyze_content/index.js +120 -0
- package/dist/modules/agent/runtime/app/tools/check_readability/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/check_readability/index.js +57 -0
- package/dist/modules/agent/runtime/app/tools/duplicate_paragraphs/index.js +2 -6
- package/dist/modules/agent/runtime/app/tools/get_all_page_content/index.js +1 -1
- package/dist/modules/agent/runtime/app/tools/get_bundle_info/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/get_bundle_info/index.js +176 -0
- package/dist/modules/agent/runtime/app/tools/get_content_fields/index.js +1 -1
- package/dist/modules/agent/runtime/app/tools/get_paragraph_context/index.js +7 -5
- package/dist/modules/agent/runtime/app/tools/get_paragraph_options/index.js +2 -1
- package/dist/modules/agent/runtime/app/tools/get_selected_paragraphs/index.js +2 -3
- package/dist/modules/agent/runtime/app/tools/helpers.d.ts +53 -0
- package/dist/modules/agent/runtime/app/tools/helpers.js +187 -0
- package/dist/modules/agent/runtime/app/tools/move_paragraphs/index.js +2 -6
- package/dist/modules/agent/runtime/app/tools/schemas.d.ts +1 -44
- package/dist/modules/agent/runtime/app/tools/schemas.js +0 -174
- package/dist/modules/agent/runtime/app/tools/search_content/index.js +40 -47
- package/dist/modules/agent/runtime/app/tools/set_paragraph_options/index.js +2 -5
- package/dist/modules/agent/runtime/app/types/index.d.ts +0 -61
- package/dist/modules/agent/runtime/server/Session.d.ts +29 -8
- package/dist/modules/agent/runtime/server/Session.js +168 -85
- package/dist/modules/agent/runtime/server/SessionManager.d.ts +3 -0
- package/dist/modules/agent/runtime/server/SessionManager.js +4 -1
- package/dist/modules/agent/runtime/server/agent.js +3 -2
- package/dist/modules/agent/runtime/server/agentPrompt.d.ts +9 -1
- package/dist/modules/agent/runtime/server/agentPrompt.js +26 -0
- package/dist/modules/agent/runtime/server/default-skills/fixReadability.d.ts +2 -0
- package/dist/modules/agent/runtime/server/default-skills/fixReadability.js +69 -0
- package/dist/modules/agent/runtime/server/default-system-prompts/page-context.js +28 -0
- package/dist/modules/agent/runtime/server/server-tools/index.d.ts +10 -2
- package/dist/modules/agent/runtime/server/server-tools/index.js +1 -1
- package/dist/modules/agent/runtime/server/server-tools/load_tools/index.js +1 -1
- package/dist/modules/agent/runtime/shared/types.d.ts +81 -12
- package/dist/modules/agent/runtime/shared/types.js +22 -10
- package/dist/modules/charts/index.d.mts +35 -0
- package/dist/modules/charts/index.mjs +57 -0
- package/dist/modules/charts/runtime/blokkli/skills/charts.d.ts +2 -0
- package/dist/modules/charts/runtime/blokkli/skills/charts.js +42 -0
- package/dist/modules/charts/runtime/blokkli/tools/chart_schemas.d.ts +86 -0
- package/dist/modules/charts/runtime/blokkli/tools/chart_schemas.js +136 -0
- package/dist/modules/charts/runtime/blokkli/tools/create_chart/index.d.ts +2 -0
- package/dist/modules/charts/runtime/blokkli/tools/create_chart/index.js +93 -0
- package/dist/modules/charts/runtime/blokkli/tools/get_chart_data/index.d.ts +2 -0
- package/dist/modules/charts/runtime/blokkli/tools/get_chart_data/index.js +66 -0
- package/dist/modules/charts/runtime/blokkli/tools/get_chart_type_options/index.d.ts +2 -0
- package/dist/modules/charts/runtime/blokkli/tools/get_chart_type_options/index.js +40 -0
- package/dist/modules/charts/runtime/blokkli/tools/update_chart/index.d.ts +2 -0
- package/dist/modules/charts/runtime/blokkli/tools/update_chart/index.js +89 -0
- package/dist/modules/charts/runtime/chartTypes/area.d.ts +7 -0
- package/dist/modules/charts/runtime/chartTypes/area.js +68 -0
- package/dist/modules/charts/runtime/chartTypes/bar.d.ts +8 -0
- package/dist/modules/charts/runtime/chartTypes/bar.js +76 -0
- package/dist/modules/charts/runtime/chartTypes/define.d.ts +2 -0
- package/dist/modules/charts/runtime/chartTypes/define.js +3 -0
- package/dist/modules/charts/runtime/chartTypes/donut.d.ts +6 -0
- package/dist/modules/charts/runtime/chartTypes/donut.js +45 -0
- package/dist/modules/charts/runtime/chartTypes/heatmap.d.ts +4 -0
- package/dist/modules/charts/runtime/chartTypes/heatmap.js +54 -0
- package/dist/modules/charts/runtime/chartTypes/index.d.ts +39 -0
- package/dist/modules/charts/runtime/chartTypes/index.js +47 -0
- package/dist/modules/charts/runtime/chartTypes/line.d.ts +7 -0
- package/dist/modules/charts/runtime/chartTypes/line.js +68 -0
- package/dist/modules/charts/runtime/chartTypes/pie.d.ts +5 -0
- package/dist/modules/charts/runtime/chartTypes/pie.js +28 -0
- package/dist/modules/charts/runtime/chartTypes/radar.d.ts +7 -0
- package/dist/modules/charts/runtime/chartTypes/radar.js +52 -0
- package/dist/modules/charts/runtime/chartTypes/radialBar.d.ts +6 -0
- package/dist/modules/charts/runtime/chartTypes/radialBar.js +44 -0
- package/dist/modules/charts/runtime/chartTypes/shared.d.ts +67 -0
- package/dist/modules/charts/runtime/chartTypes/shared.js +103 -0
- package/dist/modules/charts/runtime/chartTypes/types.d.ts +29 -0
- package/dist/modules/charts/runtime/chartTypes/types.js +0 -0
- package/dist/modules/charts/runtime/components/ChartRenderer/index.d.vue.ts +147 -0
- package/dist/modules/charts/runtime/components/ChartRenderer/index.vue +120 -0
- package/dist/modules/charts/runtime/components/ChartRenderer/index.vue.d.ts +147 -0
- package/dist/modules/charts/runtime/components/index.d.ts +1 -0
- package/dist/modules/charts/runtime/components/index.js +1 -0
- package/dist/modules/charts/runtime/features/charts/Editor/ChartTypeOptions/index.d.vue.ts +16 -0
- package/dist/modules/charts/runtime/features/charts/Editor/ChartTypeOptions/index.vue +97 -0
- package/dist/modules/charts/runtime/features/charts/Editor/ChartTypeOptions/index.vue.d.ts +16 -0
- package/dist/modules/charts/runtime/features/charts/Editor/ChartTypePicker/index.d.vue.ts +11 -0
- package/dist/modules/charts/runtime/features/charts/Editor/ChartTypePicker/index.vue +34 -0
- package/dist/modules/charts/runtime/features/charts/Editor/ChartTypePicker/index.vue.d.ts +11 -0
- package/dist/modules/charts/runtime/features/charts/Editor/ColorDropdown/index.d.vue.ts +12 -0
- package/dist/modules/charts/runtime/features/charts/Editor/ColorDropdown/index.vue +49 -0
- package/dist/modules/charts/runtime/features/charts/Editor/ColorDropdown/index.vue.d.ts +12 -0
- package/dist/modules/charts/runtime/features/charts/Editor/CsvImport/index.d.vue.ts +19 -0
- package/dist/modules/charts/runtime/features/charts/Editor/CsvImport/index.vue +89 -0
- package/dist/modules/charts/runtime/features/charts/Editor/CsvImport/index.vue.d.ts +19 -0
- package/dist/modules/charts/runtime/features/charts/Editor/DataTable/index.d.vue.ts +23 -0
- package/dist/modules/charts/runtime/features/charts/Editor/DataTable/index.vue +224 -0
- package/dist/modules/charts/runtime/features/charts/Editor/DataTable/index.vue.d.ts +23 -0
- package/dist/{runtime/editor/features/clipboard/List → modules/charts/runtime/features/charts/Editor/FootnoteEditor}/index.d.vue.ts +4 -5
- package/dist/modules/charts/runtime/features/charts/Editor/FootnoteEditor/index.vue +61 -0
- package/dist/{runtime/editor/features/clipboard/List → modules/charts/runtime/features/charts/Editor/FootnoteEditor}/index.vue.d.ts +4 -5
- package/dist/modules/charts/runtime/features/charts/Editor/Preview/index.d.vue.ts +10 -0
- package/dist/modules/charts/runtime/features/charts/Editor/Preview/index.vue +45 -0
- package/dist/modules/charts/runtime/features/charts/Editor/Preview/index.vue.d.ts +10 -0
- package/dist/modules/charts/runtime/features/charts/Editor/index.d.vue.ts +11 -0
- package/dist/modules/charts/runtime/features/charts/Editor/index.vue +249 -0
- package/dist/modules/charts/runtime/features/charts/Editor/index.vue.d.ts +11 -0
- package/dist/modules/charts/runtime/features/charts/Editor/useChartEditorState.d.ts +17 -0
- package/dist/modules/charts/runtime/features/charts/Editor/useChartEditorState.js +90 -0
- package/dist/modules/charts/runtime/features/charts/index.d.vue.ts +3 -0
- package/dist/modules/charts/runtime/features/charts/index.vue +72 -0
- package/dist/modules/charts/runtime/features/charts/index.vue.d.ts +3 -0
- package/dist/modules/charts/runtime/helpers/index.d.ts +26 -0
- package/dist/modules/charts/runtime/helpers/index.js +80 -0
- package/dist/modules/charts/runtime/types.d.ts +33 -0
- package/dist/modules/charts/runtime/types.js +0 -0
- package/dist/modules/drupal/graphql/features/fragments.graphql +2 -0
- package/dist/modules/drupal/index.d.mts +1 -1
- package/dist/modules/drupal/runtime/adapter/index.d.ts +3 -1
- package/dist/modules/drupal/runtime/adapter/index.js +16 -12
- package/dist/modules/table-of-contents/index.d.mts +11 -0
- package/dist/modules/table-of-contents/index.mjs +24 -0
- package/dist/modules/table-of-contents/runtime/components/BlokkliTableOfContents/index.d.vue.ts +44 -0
- package/dist/modules/table-of-contents/runtime/components/BlokkliTableOfContents/index.vue +43 -0
- package/dist/modules/table-of-contents/runtime/components/BlokkliTableOfContents/index.vue.d.ts +44 -0
- package/dist/modules/table-of-contents/runtime/types/index.d.ts +4 -0
- package/dist/modules/table-of-contents/runtime/types/index.js +0 -0
- package/dist/runtime/components/Blocks/Fragment/index.vue +6 -2
- package/dist/runtime/components/BlokkliItem.vue +9 -4
- package/dist/runtime/components/BlokkliProvider.d.vue.ts +7 -0
- package/dist/runtime/components/BlokkliProvider.vue +7 -1
- package/dist/runtime/components/BlokkliProvider.vue.d.ts +7 -0
- package/dist/runtime/composables/defineBlokkli.js +1 -1
- package/dist/runtime/composables/useBlokkliHelper.js +4 -2
- package/dist/runtime/editor/components/AnimationCanvas/index.vue +17 -27
- package/dist/runtime/editor/components/Banner/index.d.vue.ts +13 -2
- package/dist/runtime/editor/components/Banner/index.vue +4 -2
- package/dist/runtime/editor/components/Banner/index.vue.d.ts +13 -2
- package/dist/runtime/editor/components/Dropdown/index.d.vue.ts +27 -0
- package/dist/runtime/editor/components/Dropdown/index.vue +107 -0
- package/dist/runtime/editor/components/Dropdown/index.vue.d.ts +27 -0
- package/dist/{modules/agent/runtime/app/features/agent/Panel/Input/Actions → runtime/editor/components}/DropdownItem/index.d.vue.ts +1 -0
- package/dist/{modules/agent/runtime/app/features/agent/Panel/Input/Actions → runtime/editor/components}/DropdownItem/index.vue +3 -2
- package/dist/{modules/agent/runtime/app/features/agent/Panel/Input/Actions → runtime/editor/components}/DropdownItem/index.vue.d.ts +1 -0
- package/dist/runtime/editor/components/EditProvider.d.vue.ts +2 -0
- package/dist/runtime/editor/components/EditProvider.vue +11 -7
- package/dist/runtime/editor/components/EditProvider.vue.d.ts +2 -0
- package/dist/runtime/editor/components/FlexTextarea/index.d.vue.ts +5 -1
- package/dist/runtime/editor/components/FlexTextarea/index.vue +24 -101
- package/dist/runtime/editor/components/FlexTextarea/index.vue.d.ts +5 -1
- package/dist/runtime/editor/components/Form/Radio/index.d.vue.ts +1 -0
- package/dist/runtime/editor/components/Form/Radio/index.vue +3 -2
- package/dist/runtime/editor/components/Form/Radio/index.vue.d.ts +1 -0
- package/dist/runtime/editor/components/ItemIcon/index.vue +10 -2
- package/dist/runtime/editor/components/NestedEditorOverlay/index.d.vue.ts +13 -3
- package/dist/runtime/editor/components/NestedEditorOverlay/index.vue +43 -16
- package/dist/runtime/editor/components/NestedEditorOverlay/index.vue.d.ts +13 -3
- package/dist/runtime/editor/components/Popup/index.d.vue.ts +30 -0
- package/dist/runtime/editor/components/Popup/index.vue +82 -0
- package/dist/runtime/editor/components/Popup/index.vue.d.ts +30 -0
- package/dist/runtime/editor/components/PreviewProvider.d.vue.ts +2 -0
- package/dist/runtime/editor/components/PreviewProvider.vue +3 -2
- package/dist/runtime/editor/components/PreviewProvider.vue.d.ts +2 -0
- package/dist/runtime/editor/components/Resizable/index.vue +4 -1
- package/dist/runtime/editor/components/ShortcutIndicator/index.vue +1 -1
- package/dist/runtime/editor/components/Toolbar/index.vue +107 -6
- package/dist/runtime/editor/components/index.d.ts +4 -1
- package/dist/runtime/editor/components/index.js +6 -0
- package/dist/runtime/editor/composables/defineDropAreas.js +3 -3
- package/dist/runtime/editor/composables/defineDropHandler.d.ts +3 -0
- package/dist/runtime/editor/composables/defineDropHandler.js +10 -0
- package/dist/runtime/editor/composables/index.d.ts +1 -0
- package/dist/runtime/editor/composables/index.js +1 -0
- package/dist/runtime/editor/composables/onElementResize.js +0 -1
- package/dist/runtime/editor/composables/useEditableFieldOverride.js +4 -5
- package/dist/runtime/editor/css/output.css +1 -1
- package/dist/runtime/editor/events/index.d.ts +16 -0
- package/dist/runtime/editor/features/add-list/Help/Item.vue +5 -2
- package/dist/runtime/editor/features/add-list/index.vue +58 -1
- package/dist/runtime/editor/features/analyze/Main.d.vue.ts +3 -2
- package/dist/runtime/editor/features/analyze/Main.vue +28 -44
- package/dist/runtime/editor/features/analyze/Main.vue.d.ts +3 -2
- package/dist/runtime/editor/features/analyze/analyzers/readability.js +65 -0
- package/dist/runtime/editor/features/analyze/analyzers/types.d.ts +19 -0
- package/dist/runtime/editor/features/analyze/index.vue +18 -15
- package/dist/runtime/editor/features/artboard/Renderer.vue +1 -1
- package/dist/runtime/editor/features/clipboard/DropElement/Video.d.vue.ts +8 -0
- package/dist/runtime/editor/features/clipboard/{List/Item → DropElement}/Video.vue +1 -5
- package/dist/runtime/editor/features/clipboard/DropElement/Video.vue.d.ts +8 -0
- package/dist/runtime/editor/features/clipboard/DropElement/helpers.d.ts +1 -0
- package/dist/runtime/editor/features/clipboard/DropElement/helpers.js +14 -0
- package/dist/runtime/editor/features/clipboard/DropElement/index.d.vue.ts +16 -0
- package/dist/runtime/editor/features/clipboard/DropElement/index.vue +97 -0
- package/dist/runtime/editor/features/clipboard/DropElement/index.vue.d.ts +16 -0
- package/dist/runtime/editor/features/clipboard/helpers.d.ts +15 -0
- package/dist/runtime/editor/features/clipboard/helpers.js +62 -0
- package/dist/runtime/editor/features/clipboard/index.vue +586 -338
- package/dist/runtime/editor/features/clipboard/types.d.ts +14 -2
- package/dist/runtime/editor/features/debug/index.vue +1 -1
- package/dist/runtime/editor/features/dev-mode/index.vue +86 -2
- package/dist/runtime/editor/features/dragging-overlay/DragItems/index.vue +17 -5
- package/dist/runtime/editor/features/dragging-overlay/Renderer/index.vue +2 -2
- package/dist/runtime/editor/features/dragging-overlay/index.vue +125 -219
- package/dist/runtime/editor/features/edit/index.vue +20 -0
- package/dist/runtime/editor/features/editable-field/Overlay/Plaintext/index.vue +4 -4
- package/dist/runtime/editor/features/editable-field/Overlay/index.vue +6 -0
- package/dist/runtime/editor/features/fragments/types.d.ts +1 -0
- package/dist/runtime/editor/features/hover/Renderer/index.vue +30 -3
- package/dist/runtime/editor/features/hover/index.vue +1 -1
- package/dist/runtime/editor/features/library/index.vue +14 -0
- package/dist/runtime/editor/features/media-library/index.vue +32 -1
- package/dist/runtime/editor/features/options/Form/Checkbox/index.d.vue.ts +2 -2
- package/dist/runtime/editor/features/options/Form/Checkbox/index.vue +3 -3
- package/dist/runtime/editor/features/options/Form/Checkbox/index.vue.d.ts +2 -2
- package/dist/runtime/editor/features/options/Form/Checkboxes/index.d.vue.ts +2 -2
- package/dist/runtime/editor/features/options/Form/Checkboxes/index.vue +5 -5
- package/dist/runtime/editor/features/options/Form/Checkboxes/index.vue.d.ts +2 -2
- package/dist/runtime/editor/features/options/Form/ComplexType/index.d.vue.ts +11 -0
- package/dist/runtime/editor/features/options/Form/ComplexType/index.vue +36 -0
- package/dist/runtime/editor/features/options/Form/ComplexType/index.vue.d.ts +11 -0
- package/dist/runtime/editor/features/options/Form/Item.d.vue.ts +5 -4
- package/dist/runtime/editor/features/options/Form/Item.vue +24 -50
- package/dist/runtime/editor/features/options/Form/Item.vue.d.ts +5 -4
- package/dist/runtime/editor/features/options/Form/Number/index.d.vue.ts +3 -3
- package/dist/runtime/editor/features/options/Form/Number/index.vue +7 -17
- package/dist/runtime/editor/features/options/Form/Number/index.vue.d.ts +3 -3
- package/dist/runtime/editor/features/options/Form/Range/index.d.vue.ts +2 -2
- package/dist/runtime/editor/features/options/Form/Range/index.vue +4 -4
- package/dist/runtime/editor/features/options/Form/Range/index.vue.d.ts +2 -2
- package/dist/runtime/editor/features/options/Form/index.vue +15 -5
- package/dist/runtime/editor/features/search/index.vue +25 -1
- package/dist/runtime/editor/features/selection/index.vue +2 -2
- package/dist/runtime/editor/features/structure/index.vue +25 -1
- package/dist/runtime/editor/features/tour/index.vue +22 -12
- package/dist/runtime/editor/features/transform/index.vue +1 -3
- package/dist/runtime/editor/helpers/clipboardData/index.d.ts +11 -0
- package/dist/runtime/editor/helpers/clipboardData/index.js +157 -0
- package/dist/runtime/editor/helpers/options/index.js +5 -0
- package/dist/runtime/editor/icons/svg/stars.svg +5 -1
- 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 +15 -4
- package/dist/runtime/editor/plugins/Sidebar/index.vue +4 -2
- package/dist/runtime/editor/plugins/Sidebar/index.vue.d.ts +15 -4
- package/dist/runtime/editor/providers/analyze.d.ts +43 -0
- package/dist/runtime/editor/providers/analyze.js +78 -0
- package/dist/runtime/editor/providers/animation.d.ts +4 -0
- package/dist/runtime/editor/providers/animation.js +6 -0
- package/dist/runtime/editor/providers/definition.d.ts +2 -2
- package/dist/runtime/editor/providers/definition.js +7 -1
- package/dist/runtime/editor/providers/dom.d.ts +5 -0
- package/dist/runtime/editor/providers/dom.js +11 -2
- package/dist/runtime/editor/providers/dragdrop.d.ts +55 -0
- package/dist/runtime/editor/providers/dragdrop.js +37 -0
- package/dist/runtime/editor/providers/fields.d.ts +19 -1
- package/dist/runtime/editor/providers/fields.js +54 -2
- package/dist/runtime/editor/providers/storage.js +15 -0
- package/dist/runtime/editor/providers/ui.d.ts +6 -0
- package/dist/runtime/editor/providers/ui.js +19 -0
- package/dist/runtime/editor/translations/de.json +338 -58
- package/dist/runtime/editor/translations/fr.json +331 -51
- package/dist/runtime/editor/translations/gsw_CH.json +336 -56
- package/dist/runtime/editor/translations/it.json +331 -51
- package/dist/runtime/editor/types/app.d.ts +4 -2
- package/dist/runtime/editor/types/draggable.d.ts +1 -0
- package/dist/runtime/editor/types/ui.d.ts +1 -1
- package/dist/runtime/helpers/imports/index.d.ts +8 -1
- package/dist/runtime/helpers/imports/index.js +15 -6
- package/dist/runtime/helpers/injections.d.ts +6 -2
- package/dist/runtime/helpers/injections.js +3 -0
- package/dist/runtime/helpers/runtimeHelpers/index.js +14 -0
- package/dist/runtime/types/blockOptions.d.ts +2 -1
- package/dist/runtime/types/definitions.d.ts +12 -5
- package/dist/runtime/types/provider.d.ts +2 -0
- package/dist/shared/editor.6D5vApr0.mjs +30 -0
- package/dist/shared/{editor.DMFfaLVE.mjs → editor.BFIzNSQM.mjs} +1 -30
- package/dist/shared/{editor.Iax3GCvt.d.mts → editor.BdBm1Z7C.d.mts} +34 -0
- package/dist/types.d.mts +1 -1
- package/package.json +21 -3
- package/dist/modules/agent/runtime/app/tools/get_available_bundles/index.js +0 -104
- package/dist/runtime/editor/features/clipboard/List/Item/File.d.vue.ts +0 -4
- package/dist/runtime/editor/features/clipboard/List/Item/File.vue +0 -60
- package/dist/runtime/editor/features/clipboard/List/Item/File.vue.d.ts +0 -4
- package/dist/runtime/editor/features/clipboard/List/Item/Video.d.vue.ts +0 -4
- package/dist/runtime/editor/features/clipboard/List/Item/Video.vue.d.ts +0 -4
- package/dist/runtime/editor/features/clipboard/List/index.vue +0 -72
- package/dist/runtime/editor/features/tour/Popup/index.d.vue.ts +0 -9
- package/dist/runtime/editor/features/tour/Popup/index.vue +0 -34
- package/dist/runtime/editor/features/tour/Popup/index.vue.d.ts +0 -9
- package/dist/runtime/editor/providers/dropArea.d.ts +0 -48
- package/dist/runtime/editor/providers/dropArea.js +0 -22
- /package/dist/modules/agent/runtime/app/tools/{get_available_bundles → analyze_content}/index.d.ts +0 -0
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { defineBlokkliAgentTool } from "#blokkli/agent/app/composables";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
blockOptionsMapSchema,
|
|
6
|
-
buildBlockOptionsMap
|
|
7
|
-
} from "../schemas.js";
|
|
3
|
+
import { parentSchema, blockOptionsMapSchema } from "../schemas.js";
|
|
4
|
+
import { buildBlockOptionsMap } from "../helpers.js";
|
|
8
5
|
import { getAvailableOptions } from "#blokkli/editor/helpers/options";
|
|
6
|
+
import { fragmentBlockBundle } from "#blokkli-build/config";
|
|
9
7
|
const paramsSchema = z.object({
|
|
10
8
|
uuid: z.string().describe("The paragraph UUID"),
|
|
11
9
|
includeParentChain: z.boolean().optional().default(true).describe("Include ancestor parent paragraphs up to the page"),
|
|
@@ -77,6 +75,7 @@ const resultSchema = z.object({
|
|
|
77
75
|
uuid: z.string().describe("The paragraph UUID"),
|
|
78
76
|
bundle: z.string().describe("The paragraph type"),
|
|
79
77
|
label: z.string().describe("Human-readable paragraph label"),
|
|
78
|
+
fragmentName: z.string().optional().describe("The fragment name, if this paragraph is a fragment block"),
|
|
80
79
|
nestingLevel: z.number().describe("Nesting depth (0 = root level)"),
|
|
81
80
|
parent: parentSchema.nullable().describe("The parent entity containing this paragraph"),
|
|
82
81
|
parentChain: z.array(parentChainItemSchema).optional().describe("Ancestor parent paragraphs from immediate parent to page"),
|
|
@@ -132,6 +131,9 @@ export default defineBlokkliAgentTool({
|
|
|
132
131
|
nestingLevel: state.getNestingLevel(params.uuid),
|
|
133
132
|
parent
|
|
134
133
|
};
|
|
134
|
+
if (block.bundle === fragmentBlockBundle && block.fragment?.name) {
|
|
135
|
+
result.fragmentName = block.fragment.name;
|
|
136
|
+
}
|
|
135
137
|
if (params.includeParentChain) {
|
|
136
138
|
const parentChain = [];
|
|
137
139
|
let currentUuid = state.getParentEntityUuid(params.uuid);
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { defineBlokkliAgentTool } from "#blokkli/agent/app/composables";
|
|
3
3
|
import { getAvailableOptions } from "#blokkli/editor/helpers/options";
|
|
4
|
-
import { blockOptionsMapSchema
|
|
4
|
+
import { blockOptionsMapSchema } from "../schemas.js";
|
|
5
|
+
import { buildBlockOptionsMap } from "../helpers.js";
|
|
5
6
|
const paramsSchema = z.object({
|
|
6
7
|
uuids: z.array(z.string()).describe("The paragraph UUIDs to get options for")
|
|
7
8
|
});
|
|
@@ -23,11 +23,10 @@ export default defineBlokkliAgentTool({
|
|
|
23
23
|
resultSchema,
|
|
24
24
|
execute(ctx) {
|
|
25
25
|
const { selection, types, $t } = ctx.app;
|
|
26
|
-
const paragraphs = selection.
|
|
27
|
-
const item = selection.items.value.find((v) => v.uuid === uuid);
|
|
26
|
+
const paragraphs = selection.items.value.map((item) => {
|
|
28
27
|
const bundle = item?.bundle ?? "unknown";
|
|
29
28
|
return {
|
|
30
|
-
uuid,
|
|
29
|
+
uuid: item.uuid,
|
|
31
30
|
bundle,
|
|
32
31
|
label: types.getBlockLabel(bundle)
|
|
33
32
|
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { OptionItem } from '#blokkli/editor/helpers/options';
|
|
2
|
+
import type { BlokkliApp } from '#blokkli/editor/types/app';
|
|
3
|
+
import type { BlockOptionsMap } from './schemas.js';
|
|
4
|
+
/**
|
|
5
|
+
* Extract a simple key→label map from the various radios/checkboxes option formats.
|
|
6
|
+
* Handles plain strings, icon objects, color objects, grid objects, etc.
|
|
7
|
+
*/
|
|
8
|
+
export declare function extractOptionLabels(option: Record<string, unknown>): Record<string, string> | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* Build a block options map from available options and mutated state.
|
|
11
|
+
*/
|
|
12
|
+
export declare function buildBlockOptionsMap(availableOptions: OptionItem[], mutatedOptions: Record<string, Record<string, string>>, uuid: string): BlockOptionsMap;
|
|
13
|
+
/**
|
|
14
|
+
* Build a block options map from option definitions, using defaults as current values.
|
|
15
|
+
*/
|
|
16
|
+
export declare function buildBlockOptionsMapFromDefinitions(options: Record<string, Record<string, unknown>>): BlockOptionsMap;
|
|
17
|
+
/**
|
|
18
|
+
* Validate a single option value against its definition.
|
|
19
|
+
* Returns an error string or undefined if valid.
|
|
20
|
+
*/
|
|
21
|
+
export declare function validateOptionValue(key: string, value: string | boolean | number | string[], optionDef: OptionItem): string | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Resolve an editable field config to its simplified type.
|
|
24
|
+
* Returns 'plain' for text fields, 'markup' for rich text/frame fields, null for unsupported.
|
|
25
|
+
*/
|
|
26
|
+
export declare function getFieldType(app: BlokkliApp, entityType: string, bundle: string, fieldName: string): 'plain' | 'markup' | null;
|
|
27
|
+
/**
|
|
28
|
+
* Read the current value of an editable field on a block or entity.
|
|
29
|
+
* Tries the registered getValue() callback first, falls back to DOM element reading.
|
|
30
|
+
*/
|
|
31
|
+
export declare function getEditableValue(app: BlokkliApp, entityType: string, uuid: string, bundle: string, fieldName: string, fieldType: 'plain' | 'markup'): string;
|
|
32
|
+
/**
|
|
33
|
+
* Get all child fields and their paragraphs for a given entity UUID.
|
|
34
|
+
* Walks mutatedFields to find fields belonging to the entity.
|
|
35
|
+
*/
|
|
36
|
+
export declare function getParagraphChildren(app: BlokkliApp, uuid: string): {
|
|
37
|
+
fieldName: string;
|
|
38
|
+
paragraphs: {
|
|
39
|
+
uuid: string;
|
|
40
|
+
bundle: string;
|
|
41
|
+
}[];
|
|
42
|
+
}[];
|
|
43
|
+
/**
|
|
44
|
+
* Resolve a `position` string to the `afterUuid` value expected by adapter methods.
|
|
45
|
+
*
|
|
46
|
+
* Returns `{ afterUuid: string | null }` on success, or `{ error: string }` if
|
|
47
|
+
* the referenced UUID is not found in the target field.
|
|
48
|
+
*/
|
|
49
|
+
export declare function resolvePosition(app: BlokkliApp, parentUuid: string, fieldName: string, position?: string): {
|
|
50
|
+
afterUuid: string | null;
|
|
51
|
+
} | {
|
|
52
|
+
error: string;
|
|
53
|
+
};
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { getMutatedOptionValue } from "#blokkli/editor/helpers/options";
|
|
2
|
+
import { getRuntimeOptionValue } from "#blokkli/runtime-helpers";
|
|
3
|
+
export function extractOptionLabels(option) {
|
|
4
|
+
if (!("options" in option) || !option.options) return void 0;
|
|
5
|
+
const raw = option.options;
|
|
6
|
+
const labels = {};
|
|
7
|
+
for (const [key, value] of Object.entries(raw)) {
|
|
8
|
+
if (typeof value === "string") {
|
|
9
|
+
labels[key] = value;
|
|
10
|
+
} else if (typeof value === "object" && value !== null && "label" in value) {
|
|
11
|
+
labels[key] = String(value.label);
|
|
12
|
+
} else {
|
|
13
|
+
labels[key] = key;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return labels;
|
|
17
|
+
}
|
|
18
|
+
export function buildBlockOptionsMap(availableOptions, mutatedOptions, uuid) {
|
|
19
|
+
const result = {};
|
|
20
|
+
for (const opt of availableOptions) {
|
|
21
|
+
const rawValue = getMutatedOptionValue(
|
|
22
|
+
mutatedOptions,
|
|
23
|
+
uuid,
|
|
24
|
+
opt.property,
|
|
25
|
+
opt.option.default
|
|
26
|
+
);
|
|
27
|
+
const currentValue = getRuntimeOptionValue(opt.option, rawValue);
|
|
28
|
+
result[opt.property] = buildBlockOptionEntry(opt.option, currentValue);
|
|
29
|
+
}
|
|
30
|
+
return result;
|
|
31
|
+
}
|
|
32
|
+
export function buildBlockOptionsMapFromDefinitions(options) {
|
|
33
|
+
const result = {};
|
|
34
|
+
for (const [key, opt] of Object.entries(options)) {
|
|
35
|
+
result[key] = buildBlockOptionEntry(
|
|
36
|
+
opt,
|
|
37
|
+
opt.default
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
return result;
|
|
41
|
+
}
|
|
42
|
+
function buildBlockOptionEntry(opt, currentValue) {
|
|
43
|
+
const entry = {
|
|
44
|
+
type: opt.type,
|
|
45
|
+
label: opt.label,
|
|
46
|
+
currentValue
|
|
47
|
+
};
|
|
48
|
+
if (opt.description) {
|
|
49
|
+
entry.description = opt.description;
|
|
50
|
+
}
|
|
51
|
+
const labels = extractOptionLabels(opt);
|
|
52
|
+
if (labels) {
|
|
53
|
+
entry.options = labels;
|
|
54
|
+
}
|
|
55
|
+
if ("min" in opt) {
|
|
56
|
+
entry.min = opt.min;
|
|
57
|
+
}
|
|
58
|
+
if ("max" in opt) {
|
|
59
|
+
entry.max = opt.max;
|
|
60
|
+
}
|
|
61
|
+
if ("step" in opt && opt.type === "range") {
|
|
62
|
+
entry.step = opt.step;
|
|
63
|
+
}
|
|
64
|
+
return entry;
|
|
65
|
+
}
|
|
66
|
+
export function validateOptionValue(key, value, optionDef) {
|
|
67
|
+
const optionType = optionDef.option.type;
|
|
68
|
+
if (optionType === "checkbox") {
|
|
69
|
+
if (typeof value !== "boolean" && value !== "1" && value !== "0" && value !== "true" && value !== "false") {
|
|
70
|
+
return `Option "${key}" expects a boolean value`;
|
|
71
|
+
}
|
|
72
|
+
} else if (optionType === "radios") {
|
|
73
|
+
if (typeof value !== "string") {
|
|
74
|
+
return `Option "${key}" expects a string value`;
|
|
75
|
+
}
|
|
76
|
+
if ("options" in optionDef.option && optionDef.option.options) {
|
|
77
|
+
const allowedKeys = Object.keys(optionDef.option.options);
|
|
78
|
+
if (!allowedKeys.includes(value)) {
|
|
79
|
+
return `Option "${key}" value must be one of: ${allowedKeys.join(", ")}`;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
} else if (optionType === "checkboxes") {
|
|
83
|
+
if (!Array.isArray(value) && typeof value !== "string") {
|
|
84
|
+
return `Option "${key}" expects an array of strings or comma-separated string`;
|
|
85
|
+
}
|
|
86
|
+
if ("options" in optionDef.option && optionDef.option.options) {
|
|
87
|
+
const allowedKeys = Object.keys(optionDef.option.options);
|
|
88
|
+
const values = Array.isArray(value) ? value : value.split(",");
|
|
89
|
+
for (const v of values) {
|
|
90
|
+
if (!allowedKeys.includes(v)) {
|
|
91
|
+
return `Option "${key}" value "${v}" is not allowed. Must be one of: ${allowedKeys.join(", ")}`;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
} else if (optionType === "number" || optionType === "range") {
|
|
96
|
+
const numValue = typeof value === "number" ? value : Number.parseFloat(String(value));
|
|
97
|
+
if (Number.isNaN(numValue)) {
|
|
98
|
+
return `Option "${key}" expects a numeric value`;
|
|
99
|
+
}
|
|
100
|
+
if ("min" in optionDef.option && numValue < optionDef.option.min) {
|
|
101
|
+
return `Option "${key}" value must be >= ${optionDef.option.min}`;
|
|
102
|
+
}
|
|
103
|
+
if ("max" in optionDef.option && numValue > optionDef.option.max) {
|
|
104
|
+
return `Option "${key}" value must be <= ${optionDef.option.max}`;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return void 0;
|
|
108
|
+
}
|
|
109
|
+
export function getFieldType(app, entityType, bundle, fieldName) {
|
|
110
|
+
const config = app.types.editableFieldConfig.forName(
|
|
111
|
+
entityType,
|
|
112
|
+
bundle,
|
|
113
|
+
fieldName
|
|
114
|
+
);
|
|
115
|
+
if (!config) return null;
|
|
116
|
+
if (config.type === "table") return null;
|
|
117
|
+
if (config.type === "frame" || config.type === "markup") return "markup";
|
|
118
|
+
return "plain";
|
|
119
|
+
}
|
|
120
|
+
export function getEditableValue(app, entityType, uuid, bundle, fieldName, fieldType) {
|
|
121
|
+
const editables = app.directive.getEditablesForBlock(uuid);
|
|
122
|
+
const editable = editables.find((e) => e.fieldName === fieldName);
|
|
123
|
+
if (editable?.getValue) {
|
|
124
|
+
return editable.getValue();
|
|
125
|
+
}
|
|
126
|
+
const element = app.directive.findEditableElement(fieldName, {
|
|
127
|
+
type: entityType,
|
|
128
|
+
uuid,
|
|
129
|
+
bundle
|
|
130
|
+
});
|
|
131
|
+
if (element) {
|
|
132
|
+
return fieldType === "markup" ? element.innerHTML || "" : element.textContent || "";
|
|
133
|
+
}
|
|
134
|
+
return "";
|
|
135
|
+
}
|
|
136
|
+
export function getParagraphChildren(app, uuid) {
|
|
137
|
+
const result = [];
|
|
138
|
+
for (const field of app.state.mutatedFields.value) {
|
|
139
|
+
if (field.entityUuid === uuid && field.list.length > 0) {
|
|
140
|
+
result.push({
|
|
141
|
+
fieldName: field.name,
|
|
142
|
+
paragraphs: field.list.map((item) => ({
|
|
143
|
+
uuid: item.uuid,
|
|
144
|
+
bundle: item.bundle
|
|
145
|
+
}))
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return result;
|
|
150
|
+
}
|
|
151
|
+
export function resolvePosition(app, parentUuid, fieldName, position) {
|
|
152
|
+
const fieldList = app.state.mutatedFields.value.find(
|
|
153
|
+
(f) => f.entityUuid === parentUuid && f.name === fieldName
|
|
154
|
+
);
|
|
155
|
+
const list = fieldList?.list ?? [];
|
|
156
|
+
if (position === void 0 || position === "end") {
|
|
157
|
+
const lastBlock = list.at(-1);
|
|
158
|
+
return { afterUuid: lastBlock?.uuid ?? null };
|
|
159
|
+
}
|
|
160
|
+
if (position === "start") {
|
|
161
|
+
return { afterUuid: null };
|
|
162
|
+
}
|
|
163
|
+
if (position.startsWith("after:")) {
|
|
164
|
+
const uuid = position.slice(6);
|
|
165
|
+
const found = list.find((b) => b.uuid === uuid);
|
|
166
|
+
if (!found) {
|
|
167
|
+
return {
|
|
168
|
+
error: `Position "after:${uuid}": paragraph not found in field "${fieldName}".`
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
return { afterUuid: uuid };
|
|
172
|
+
}
|
|
173
|
+
if (position.startsWith("before:")) {
|
|
174
|
+
const uuid = position.slice(7);
|
|
175
|
+
const index = list.findIndex((b) => b.uuid === uuid);
|
|
176
|
+
if (index === -1) {
|
|
177
|
+
return {
|
|
178
|
+
error: `Position "before:${uuid}": paragraph not found in field "${fieldName}".`
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
const preceding = index > 0 ? list[index - 1] : void 0;
|
|
182
|
+
return { afterUuid: preceding?.uuid ?? null };
|
|
183
|
+
}
|
|
184
|
+
return {
|
|
185
|
+
error: `Invalid position value: "${position}". Use "start", "end", "after:<UUID>", or "before:<UUID>".`
|
|
186
|
+
};
|
|
187
|
+
}
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { defineBlokkliAgentTool } from "#blokkli/agent/app/composables";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
parentSchema,
|
|
6
|
-
positionSchema,
|
|
7
|
-
resolvePosition
|
|
8
|
-
} from "../schemas.js";
|
|
3
|
+
import { mutationResultSchema, parentSchema, positionSchema } from "../schemas.js";
|
|
4
|
+
import { resolvePosition } from "../helpers.js";
|
|
9
5
|
const paramsSchema = z.object({
|
|
10
6
|
uuids: z.array(z.string()).describe("The UUIDs of the paragraphs to move"),
|
|
11
7
|
parent: parentSchema.describe("The target parent entity"),
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import type { OptionItem } from '#blokkli/editor/helpers/options';
|
|
3
|
-
import type { BlokkliApp } from '#blokkli/editor/types/app';
|
|
4
2
|
/**
|
|
5
3
|
* Shared schema for a single block option with its current value.
|
|
6
4
|
*/
|
|
@@ -28,10 +26,6 @@ export declare const blockOptionsMapSchema: z.ZodRecord<z.ZodString, z.ZodObject
|
|
|
28
26
|
currentValue: z.ZodUnion<readonly [z.ZodString, z.ZodBoolean, z.ZodNumber, z.ZodArray<z.ZodString>]>;
|
|
29
27
|
}, z.core.$strip>>;
|
|
30
28
|
export type BlockOptionsMap = z.infer<typeof blockOptionsMapSchema>;
|
|
31
|
-
/**
|
|
32
|
-
* Build a block options map from available options and mutated state.
|
|
33
|
-
*/
|
|
34
|
-
export declare function buildBlockOptionsMap(availableOptions: OptionItem[], mutatedOptions: Record<string, Record<string, string>>, uuid: string): BlockOptionsMap;
|
|
35
29
|
/**
|
|
36
30
|
* Schema for a parent entity (the container of a block).
|
|
37
31
|
* A parent is an entity + field combination where blocks can be placed.
|
|
@@ -50,9 +44,9 @@ export declare const mutationResultSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
50
44
|
type: z.ZodEnum<{
|
|
51
45
|
add: "add";
|
|
52
46
|
delete: "delete";
|
|
53
|
-
options: "options";
|
|
54
47
|
move: "move";
|
|
55
48
|
rewrite: "rewrite";
|
|
49
|
+
options: "options";
|
|
56
50
|
}>;
|
|
57
51
|
label: z.ZodString;
|
|
58
52
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -62,32 +56,6 @@ export declare const mutationResultSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
62
56
|
* Shared schema for option values (used by add_blocks and set_block_options).
|
|
63
57
|
*/
|
|
64
58
|
export declare const optionValueSchema: z.ZodUnion<readonly [z.ZodString, z.ZodBoolean, z.ZodNumber, z.ZodArray<z.ZodString>]>;
|
|
65
|
-
/**
|
|
66
|
-
* Validate a single option value against its definition.
|
|
67
|
-
* Returns an error string or undefined if valid.
|
|
68
|
-
*/
|
|
69
|
-
export declare function validateOptionValue(key: string, value: string | boolean | number | string[], optionDef: OptionItem): string | undefined;
|
|
70
|
-
/**
|
|
71
|
-
* Resolve an editable field config to its simplified type.
|
|
72
|
-
* Returns 'plain' for text fields, 'markup' for rich text/frame fields, null for unsupported.
|
|
73
|
-
*/
|
|
74
|
-
export declare function getFieldType(app: BlokkliApp, entityType: string, bundle: string, fieldName: string): 'plain' | 'markup' | null;
|
|
75
|
-
/**
|
|
76
|
-
* Read the current value of an editable field on a block or entity.
|
|
77
|
-
* Tries the registered getValue() callback first, falls back to DOM element reading.
|
|
78
|
-
*/
|
|
79
|
-
export declare function getEditableValue(app: BlokkliApp, entityType: string, uuid: string, bundle: string, fieldName: string, fieldType: 'plain' | 'markup'): string;
|
|
80
|
-
/**
|
|
81
|
-
* Get all child fields and their paragraphs for a given entity UUID.
|
|
82
|
-
* Walks mutatedFields to find fields belonging to the entity.
|
|
83
|
-
*/
|
|
84
|
-
export declare function getParagraphChildren(app: BlokkliApp, uuid: string): {
|
|
85
|
-
fieldName: string;
|
|
86
|
-
paragraphs: {
|
|
87
|
-
uuid: string;
|
|
88
|
-
bundle: string;
|
|
89
|
-
}[];
|
|
90
|
-
}[];
|
|
91
59
|
/**
|
|
92
60
|
* Shared schema for the `position` parameter used by mutation tools that insert blocks.
|
|
93
61
|
*
|
|
@@ -98,17 +66,6 @@ export declare function getParagraphChildren(app: BlokkliApp, uuid: string): {
|
|
|
98
66
|
* - `"before:<UUID>"` — insert before the block with the given UUID
|
|
99
67
|
*/
|
|
100
68
|
export declare const positionSchema: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
101
|
-
/**
|
|
102
|
-
* Resolve a `position` string to the `afterUuid` value expected by adapter methods.
|
|
103
|
-
*
|
|
104
|
-
* Returns `{ afterUuid: string | null }` on success, or `{ error: string }` if
|
|
105
|
-
* the referenced UUID is not found in the target field.
|
|
106
|
-
*/
|
|
107
|
-
export declare function resolvePosition(app: BlokkliApp, parentUuid: string, fieldName: string, position?: string): {
|
|
108
|
-
afterUuid: string | null;
|
|
109
|
-
} | {
|
|
110
|
-
error: string;
|
|
111
|
-
};
|
|
112
69
|
/**
|
|
113
70
|
* Schema for the success result sent back to the AI after mutation is applied.
|
|
114
71
|
*/
|
|
@@ -1,21 +1,4 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { getMutatedOptionValue } from "#blokkli/editor/helpers/options";
|
|
3
|
-
import { getRuntimeOptionValue } from "#blokkli/runtime-helpers";
|
|
4
|
-
function extractOptionLabels(option) {
|
|
5
|
-
if (!("options" in option) || !option.options) return void 0;
|
|
6
|
-
const raw = option.options;
|
|
7
|
-
const labels = {};
|
|
8
|
-
for (const [key, value] of Object.entries(raw)) {
|
|
9
|
-
if (typeof value === "string") {
|
|
10
|
-
labels[key] = value;
|
|
11
|
-
} else if (typeof value === "object" && value !== null && "label" in value) {
|
|
12
|
-
labels[key] = String(value.label);
|
|
13
|
-
} else {
|
|
14
|
-
labels[key] = key;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
return labels;
|
|
18
|
-
}
|
|
19
2
|
export const blockOptionSchema = z.object({
|
|
20
3
|
type: z.string().describe(
|
|
21
4
|
"The option type (checkbox, radios, checkboxes, text, number, range, color, datetime-local)"
|
|
@@ -32,41 +15,6 @@ export const blockOptionsMapSchema = z.record(
|
|
|
32
15
|
z.string().describe("Option property name"),
|
|
33
16
|
blockOptionSchema
|
|
34
17
|
);
|
|
35
|
-
export function buildBlockOptionsMap(availableOptions, mutatedOptions, uuid) {
|
|
36
|
-
const result = {};
|
|
37
|
-
for (const opt of availableOptions) {
|
|
38
|
-
const rawValue = getMutatedOptionValue(
|
|
39
|
-
mutatedOptions,
|
|
40
|
-
uuid,
|
|
41
|
-
opt.property,
|
|
42
|
-
opt.option.default
|
|
43
|
-
);
|
|
44
|
-
const currentValue = getRuntimeOptionValue(opt.option, rawValue);
|
|
45
|
-
const entry = {
|
|
46
|
-
type: opt.option.type,
|
|
47
|
-
label: opt.option.label,
|
|
48
|
-
currentValue
|
|
49
|
-
};
|
|
50
|
-
if (opt.option.description) {
|
|
51
|
-
entry.description = opt.option.description;
|
|
52
|
-
}
|
|
53
|
-
const labels = extractOptionLabels(opt.option);
|
|
54
|
-
if (labels) {
|
|
55
|
-
entry.options = labels;
|
|
56
|
-
}
|
|
57
|
-
if ("min" in opt.option) {
|
|
58
|
-
entry.min = opt.option.min;
|
|
59
|
-
}
|
|
60
|
-
if ("max" in opt.option) {
|
|
61
|
-
entry.max = opt.option.max;
|
|
62
|
-
}
|
|
63
|
-
if ("step" in opt.option && opt.option.type === "range") {
|
|
64
|
-
entry.step = opt.option.step;
|
|
65
|
-
}
|
|
66
|
-
result[opt.property] = entry;
|
|
67
|
-
}
|
|
68
|
-
return result;
|
|
69
|
-
}
|
|
70
18
|
export const parentSchema = z.object({
|
|
71
19
|
type: z.string().describe(
|
|
72
20
|
"The entity type of the parent. Do NOT guess this - always use the parent object returned by get_child_paragraphs."
|
|
@@ -91,131 +39,9 @@ export const optionValueSchema = z.union([
|
|
|
91
39
|
z.number(),
|
|
92
40
|
z.array(z.string())
|
|
93
41
|
]);
|
|
94
|
-
export function validateOptionValue(key, value, optionDef) {
|
|
95
|
-
const optionType = optionDef.option.type;
|
|
96
|
-
if (optionType === "checkbox") {
|
|
97
|
-
if (typeof value !== "boolean" && value !== "1" && value !== "0" && value !== "true" && value !== "false") {
|
|
98
|
-
return `Option "${key}" expects a boolean value`;
|
|
99
|
-
}
|
|
100
|
-
} else if (optionType === "radios") {
|
|
101
|
-
if (typeof value !== "string") {
|
|
102
|
-
return `Option "${key}" expects a string value`;
|
|
103
|
-
}
|
|
104
|
-
if ("options" in optionDef.option && optionDef.option.options) {
|
|
105
|
-
const allowedKeys = Object.keys(optionDef.option.options);
|
|
106
|
-
if (!allowedKeys.includes(value)) {
|
|
107
|
-
return `Option "${key}" value must be one of: ${allowedKeys.join(", ")}`;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
} else if (optionType === "checkboxes") {
|
|
111
|
-
if (!Array.isArray(value) && typeof value !== "string") {
|
|
112
|
-
return `Option "${key}" expects an array of strings or comma-separated string`;
|
|
113
|
-
}
|
|
114
|
-
if ("options" in optionDef.option && optionDef.option.options) {
|
|
115
|
-
const allowedKeys = Object.keys(optionDef.option.options);
|
|
116
|
-
const values = Array.isArray(value) ? value : value.split(",");
|
|
117
|
-
for (const v of values) {
|
|
118
|
-
if (!allowedKeys.includes(v)) {
|
|
119
|
-
return `Option "${key}" value "${v}" is not allowed. Must be one of: ${allowedKeys.join(", ")}`;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
} else if (optionType === "number" || optionType === "range") {
|
|
124
|
-
const numValue = typeof value === "number" ? value : Number.parseFloat(String(value));
|
|
125
|
-
if (Number.isNaN(numValue)) {
|
|
126
|
-
return `Option "${key}" expects a numeric value`;
|
|
127
|
-
}
|
|
128
|
-
if ("min" in optionDef.option && numValue < optionDef.option.min) {
|
|
129
|
-
return `Option "${key}" value must be >= ${optionDef.option.min}`;
|
|
130
|
-
}
|
|
131
|
-
if ("max" in optionDef.option && numValue > optionDef.option.max) {
|
|
132
|
-
return `Option "${key}" value must be <= ${optionDef.option.max}`;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
return void 0;
|
|
136
|
-
}
|
|
137
|
-
export function getFieldType(app, entityType, bundle, fieldName) {
|
|
138
|
-
const config = app.types.editableFieldConfig.forName(
|
|
139
|
-
entityType,
|
|
140
|
-
bundle,
|
|
141
|
-
fieldName
|
|
142
|
-
);
|
|
143
|
-
if (!config) return null;
|
|
144
|
-
if (config.type === "table") return null;
|
|
145
|
-
if (config.type === "frame" || config.type === "markup") return "markup";
|
|
146
|
-
return "plain";
|
|
147
|
-
}
|
|
148
|
-
export function getEditableValue(app, entityType, uuid, bundle, fieldName, fieldType) {
|
|
149
|
-
const editables = app.directive.getEditablesForBlock(uuid);
|
|
150
|
-
const editable = editables.find((e) => e.fieldName === fieldName);
|
|
151
|
-
if (editable?.getValue) {
|
|
152
|
-
return editable.getValue();
|
|
153
|
-
}
|
|
154
|
-
const element = app.directive.findEditableElement(fieldName, {
|
|
155
|
-
type: entityType,
|
|
156
|
-
uuid,
|
|
157
|
-
bundle
|
|
158
|
-
});
|
|
159
|
-
if (element) {
|
|
160
|
-
return fieldType === "markup" ? element.innerHTML || "" : element.textContent || "";
|
|
161
|
-
}
|
|
162
|
-
return "";
|
|
163
|
-
}
|
|
164
|
-
export function getParagraphChildren(app, uuid) {
|
|
165
|
-
const result = [];
|
|
166
|
-
for (const field of app.state.mutatedFields.value) {
|
|
167
|
-
if (field.entityUuid === uuid && field.list.length > 0) {
|
|
168
|
-
result.push({
|
|
169
|
-
fieldName: field.name,
|
|
170
|
-
paragraphs: field.list.map((item) => ({
|
|
171
|
-
uuid: item.uuid,
|
|
172
|
-
bundle: item.bundle
|
|
173
|
-
}))
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
return result;
|
|
178
|
-
}
|
|
179
42
|
export const positionSchema = z.string().optional().default("end").describe(
|
|
180
43
|
'Where to place the paragraph(s). "start" = beginning, "end" (default) = append at end, "after:<UUID>" = after a specific paragraph, "before:<UUID>" = before a specific paragraph.'
|
|
181
44
|
);
|
|
182
|
-
export function resolvePosition(app, parentUuid, fieldName, position) {
|
|
183
|
-
const fieldList = app.state.mutatedFields.value.find(
|
|
184
|
-
(f) => f.entityUuid === parentUuid && f.name === fieldName
|
|
185
|
-
);
|
|
186
|
-
const list = fieldList?.list ?? [];
|
|
187
|
-
if (position === void 0 || position === "end") {
|
|
188
|
-
const lastBlock = list.at(-1);
|
|
189
|
-
return { afterUuid: lastBlock?.uuid ?? null };
|
|
190
|
-
}
|
|
191
|
-
if (position === "start") {
|
|
192
|
-
return { afterUuid: null };
|
|
193
|
-
}
|
|
194
|
-
if (position.startsWith("after:")) {
|
|
195
|
-
const uuid = position.slice(6);
|
|
196
|
-
const found = list.find((b) => b.uuid === uuid);
|
|
197
|
-
if (!found) {
|
|
198
|
-
return {
|
|
199
|
-
error: `Position "after:${uuid}": paragraph not found in field "${fieldName}".`
|
|
200
|
-
};
|
|
201
|
-
}
|
|
202
|
-
return { afterUuid: uuid };
|
|
203
|
-
}
|
|
204
|
-
if (position.startsWith("before:")) {
|
|
205
|
-
const uuid = position.slice(7);
|
|
206
|
-
const index = list.findIndex((b) => b.uuid === uuid);
|
|
207
|
-
if (index === -1) {
|
|
208
|
-
return {
|
|
209
|
-
error: `Position "before:${uuid}": paragraph not found in field "${fieldName}".`
|
|
210
|
-
};
|
|
211
|
-
}
|
|
212
|
-
const preceding = index > 0 ? list[index - 1] : void 0;
|
|
213
|
-
return { afterUuid: preceding?.uuid ?? null };
|
|
214
|
-
}
|
|
215
|
-
return {
|
|
216
|
-
error: `Invalid position value: "${position}". Use "start", "end", "after:<UUID>", or "before:<UUID>".`
|
|
217
|
-
};
|
|
218
|
-
}
|
|
219
45
|
export const mutationSuccessSchema = z.union([
|
|
220
46
|
z.object({
|
|
221
47
|
success: z.literal(true),
|
|
@@ -13,53 +13,46 @@ const resultSchema = z.array(
|
|
|
13
13
|
})
|
|
14
14
|
);
|
|
15
15
|
export default defineBlokkliAgentTool({
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
name: "search_content",
|
|
17
|
+
description: 'Search for content items by tab ID and query. The available tab IDs and their entity types are listed in the system prompt under "Content Search Tabs". Use the tab ID that matches the type of content you are looking for.',
|
|
18
|
+
category: "query",
|
|
19
|
+
lazy: true,
|
|
20
|
+
requiredAdapterMethods: ["getContentSearchTabs", "getContentSearchResults"],
|
|
21
|
+
modes: ["readonly", "editing", "translating", "review"],
|
|
22
|
+
label($t) {
|
|
23
|
+
return $t("aiAgentSearchContentRunning", "Searching content...");
|
|
24
|
+
},
|
|
25
|
+
paramsSchema: z.object({
|
|
26
|
+
tab: z.string().describe(
|
|
27
|
+
"The tab ID to search in. See the system prompt for available tab IDs."
|
|
28
|
+
),
|
|
29
|
+
query: z.string().describe("The search query")
|
|
30
|
+
}),
|
|
31
|
+
resultSchema,
|
|
32
|
+
async execute(ctx, params) {
|
|
20
33
|
const tabs = await ctx.adapter.getContentSearchTabs();
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const items = await toolCtx.adapter.getContentSearchResults(
|
|
45
|
-
tab.id,
|
|
46
|
-
params.query
|
|
47
|
-
);
|
|
48
|
-
return {
|
|
49
|
-
label: `Searched ${tab.title} for "${params.query}"`,
|
|
50
|
-
result: items.map((item) => ({
|
|
51
|
-
id: item.id,
|
|
52
|
-
title: item.title,
|
|
53
|
-
entityType: item.entityType,
|
|
54
|
-
entityBundle: item.entityBundle,
|
|
55
|
-
targetBundles: item.targetBundles,
|
|
56
|
-
context: item.context,
|
|
57
|
-
text: item.text,
|
|
58
|
-
imageUrl: item.imageUrl
|
|
59
|
-
}))
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
});
|
|
34
|
+
const tab = tabs.find((t) => t.id === params.tab);
|
|
35
|
+
if (!tab) {
|
|
36
|
+
return {
|
|
37
|
+
error: `Invalid tab ID "${params.tab}". Available tabs: ${tabs.map((t) => t.id).join(", ")}`
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
const items = await ctx.adapter.getContentSearchResults(
|
|
41
|
+
params.tab,
|
|
42
|
+
params.query
|
|
43
|
+
);
|
|
44
|
+
return {
|
|
45
|
+
label: `Searched ${tab.title} for "${params.query}"`,
|
|
46
|
+
result: items.map((item) => ({
|
|
47
|
+
id: item.id,
|
|
48
|
+
title: item.title,
|
|
49
|
+
entityType: item.entityType,
|
|
50
|
+
entityBundle: item.entityBundle,
|
|
51
|
+
targetBundles: item.targetBundles,
|
|
52
|
+
context: item.context,
|
|
53
|
+
text: item.text,
|
|
54
|
+
imageUrl: item.imageUrl
|
|
55
|
+
}))
|
|
56
|
+
};
|
|
64
57
|
}
|
|
65
58
|
});
|