@blokkli/editor 2.0.0-alpha.23 → 2.0.0-alpha.25
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/module.json +1 -1
- package/dist/module.mjs +252 -92
- package/dist/runtime/blokkliPlugins/BlockIndicator/index.vue.d.ts +38 -0
- package/dist/runtime/blokkliPlugins/ContextMenu/index.vue +1 -1
- package/dist/runtime/blokkliPlugins/ContextMenu/index.vue.d.ts +15 -0
- package/dist/runtime/blokkliPlugins/DebugOverlay/index.vue.d.ts +6 -0
- package/dist/runtime/blokkliPlugins/ItemAction/index.vue.d.ts +28 -3
- package/dist/runtime/blokkliPlugins/Sidebar/Detached/index.vue +6 -4
- package/dist/runtime/blokkliPlugins/Sidebar/index.vue +11 -3
- package/dist/runtime/blokkliPlugins/Sidebar/index.vue.d.ts +138 -3
- package/dist/runtime/blokkliPlugins/ToolbarButton/index.vue +5 -1
- package/dist/runtime/blokkliPlugins/ToolbarButton/index.vue.d.ts +116 -0
- package/dist/runtime/blokkliPlugins/TourItem/index.vue +22 -13
- package/dist/runtime/blokkliPlugins/TourItem/index.vue.d.ts +22 -0
- package/dist/runtime/blokkliPlugins/ViewOption/index.vue.d.ts +98 -0
- package/dist/runtime/blokkliPlugins/index.d.ts +1 -3
- package/dist/runtime/blokkliPlugins/index.js +0 -4
- package/dist/runtime/components/Blocks/NotImplemented/index.vue +24 -0
- package/dist/runtime/components/Blocks/NotImplemented/index.vue.d.ts +6 -0
- package/dist/runtime/components/BlokkliEditable.vue.d.ts +11 -0
- package/dist/runtime/components/BlokkliItem.vue +16 -3
- package/dist/runtime/components/BlokkliItem.vue.d.ts +2 -0
- package/dist/runtime/components/BlokkliProvider.vue.d.ts +1 -1
- package/dist/runtime/components/Edit/Actions/ItemDropdown.vue +1 -1
- package/dist/runtime/components/Edit/Actions/index.vue +78 -73
- package/dist/runtime/components/Edit/AddListItem/index.vue +9 -35
- package/dist/runtime/components/Edit/AddListItem/index.vue.d.ts +6 -15
- package/dist/runtime/components/Edit/AppMenu/MenuButton.vue +39 -0
- package/dist/runtime/{blokkliPlugins/MenuButton/index.vue.d.ts → components/Edit/AppMenu/MenuButton.vue.d.ts} +0 -4
- package/dist/runtime/components/Edit/AppMenu/index.vue +62 -40
- package/dist/runtime/components/Edit/ArtboardTooltip/index.vue +6 -0
- package/dist/runtime/components/Edit/BlockProxy/index.vue +2 -2
- package/dist/runtime/components/Edit/BlokkliErrorBoundary.vue +3 -0
- package/dist/runtime/components/Edit/BlokkliRootErrorBoundary.vue +4 -1
- package/dist/runtime/components/Edit/Dialog/index.vue +33 -47
- package/dist/runtime/components/Edit/Dialog/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/DraggableList.vue +12 -9
- package/dist/runtime/components/Edit/EditIndicator.vue +11 -4
- package/dist/runtime/components/Edit/EditProvider.vue +75 -55
- package/dist/runtime/components/Edit/EditProvider.vue.d.ts +1 -1
- package/dist/runtime/components/Edit/Features/AddList/Actions/Action.vue +53 -0
- package/dist/runtime/components/Edit/Features/AddList/Actions/Action.vue.d.ts +7 -0
- package/dist/runtime/components/Edit/Features/AddList/Actions/index.vue +41 -0
- package/dist/runtime/components/Edit/Features/AddList/Actions/index.vue.d.ts +5 -0
- package/dist/runtime/components/Edit/Features/AddList/Blocks/index.vue +13 -50
- package/dist/runtime/components/Edit/Features/AddList/Blocks/index.vue.d.ts +5 -0
- package/dist/runtime/components/Edit/Features/AddList/index.vue +76 -119
- package/dist/runtime/components/Edit/Features/Analyze/Icon.vue +85 -0
- package/dist/runtime/components/Edit/Features/Analyze/Icon.vue.d.ts +5 -0
- package/dist/runtime/components/Edit/Features/Analyze/Main.vue +288 -59
- package/dist/runtime/components/Edit/Features/Analyze/Main.vue.d.ts +8 -1
- package/dist/runtime/components/Edit/Features/Analyze/Renderer/fragment.glsl +25 -13
- package/dist/runtime/components/Edit/Features/Analyze/Renderer/index.vue +114 -52
- package/dist/runtime/components/Edit/Features/Analyze/Renderer/index.vue.d.ts +16 -2
- package/dist/runtime/components/Edit/Features/Analyze/Renderer/vertex.glsl +31 -11
- package/dist/runtime/components/Edit/Features/Analyze/Results/Results.vue +2 -0
- package/dist/runtime/components/Edit/Features/Analyze/Results/Results.vue.d.ts +8 -1
- package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItem.vue +4 -4
- package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItem.vue.d.ts +20 -2
- package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItemNodes.vue +11 -18
- package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItemNodes.vue.d.ts +10 -3
- package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItemNodesTarget.vue +46 -40
- package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItemNodesTarget.vue.d.ts +10 -4
- package/dist/runtime/components/Edit/Features/Analyze/Summary/Chart.vue +8 -4
- package/dist/runtime/components/Edit/Features/Analyze/analyzers/axe.js +1 -0
- package/dist/runtime/components/Edit/Features/Analyze/analyzers/helpers/Context.d.ts +4 -3
- package/dist/runtime/components/Edit/Features/Analyze/analyzers/helpers/Context.js +2 -1
- package/dist/runtime/components/Edit/Features/Analyze/analyzers/readability.js +61 -20
- package/dist/runtime/components/Edit/Features/Analyze/analyzers/types.d.ts +15 -1
- package/dist/runtime/components/Edit/Features/Analyze/index.vue +23 -2
- package/dist/runtime/components/Edit/Features/Artboard/Overview/index.vue +22 -8
- package/dist/runtime/components/Edit/Features/Artboard/Renderer.vue +42 -21
- package/dist/runtime/components/Edit/Features/Artboard/Scrollbar/index.vue +10 -4
- package/dist/runtime/components/Edit/Features/Assistant/Overlay/index.vue +2 -28
- package/dist/runtime/components/Edit/Features/Assistant/index.vue +18 -14
- package/dist/runtime/components/Edit/Features/BlockScheduler/Dialog/index.vue +11 -1
- package/dist/runtime/components/Edit/Features/BlockScheduler/index.vue +2 -2
- package/dist/runtime/components/Edit/Features/Clipboard/List/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/Clipboard/index.vue +52 -18
- package/dist/runtime/components/Edit/Features/CommandPalette/Palette/Item/index.vue +0 -2
- package/dist/runtime/components/Edit/Features/CommandPalette/Palette/Item/index.vue.d.ts +6 -4
- package/dist/runtime/components/Edit/Features/CommandPalette/Palette/index.vue +77 -27
- package/dist/runtime/components/Edit/Features/CommandPalette/index.vue +7 -4
- package/dist/runtime/components/Edit/Features/Comments/index.vue +2 -2
- package/dist/runtime/components/Edit/Features/Debug/Main.vue.d.ts +1 -1
- package/dist/runtime/components/Edit/Features/Debug/Rects/index.vue +2 -2
- package/dist/runtime/components/Edit/Features/Debug/Section/Logging.vue.d.ts +1 -1
- package/dist/runtime/components/Edit/Features/DraggingOverlay/DragItems/DragItem.vue +113 -0
- package/dist/runtime/components/Edit/Features/DraggingOverlay/DragItems/DragItem.vue.d.ts +25 -0
- package/dist/runtime/components/Edit/Features/DraggingOverlay/DragItems/index.vue +8 -97
- package/dist/runtime/components/Edit/Features/DraggingOverlay/Renderer/fragment.glsl +2 -5
- package/dist/runtime/components/Edit/Features/DraggingOverlay/Renderer/index.vue +38 -5
- package/dist/runtime/components/Edit/Features/DraggingOverlay/Renderer/vertex.glsl +10 -1
- package/dist/runtime/components/Edit/Features/DraggingOverlay/index.vue +1 -2
- package/dist/runtime/components/Edit/Features/EditForm/Frame/index.vue +8 -2
- package/dist/runtime/components/Edit/Features/EditForm/index.vue +3 -9
- package/dist/runtime/components/Edit/Features/EditableField/Overlay/Plaintext/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/EditableField/Overlay/index.vue +4 -3
- package/dist/runtime/components/Edit/Features/EditableField/index.vue +2 -2
- package/dist/runtime/components/Edit/Features/EditableMask/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/EntityTitle/index.vue +7 -2
- package/dist/runtime/components/Edit/Features/Exit/index.vue +12 -9
- package/dist/runtime/components/Edit/Features/Fragments/index.vue +27 -31
- package/dist/runtime/components/Edit/Features/ImportExisting/Dialog/index.vue +1 -0
- package/dist/runtime/components/Edit/Features/ImportExisting/index.vue +25 -24
- package/dist/runtime/components/Edit/Features/Library/EditReusable/index.vue +4 -4
- package/dist/runtime/components/Edit/Features/Library/LibraryDialog/index.vue +9 -2
- package/dist/runtime/components/Edit/Features/Library/ReusableDialog/index.vue +13 -3
- package/dist/runtime/components/Edit/Features/Library/index.vue +26 -24
- package/dist/runtime/components/Edit/Features/MediaLibrary/Library/index.vue +3 -2
- package/dist/runtime/components/Edit/Features/MultiSelect/Renderer/index.vue +1 -3
- package/dist/runtime/components/Edit/Features/Options/Form/Item.vue.d.ts +1 -1
- package/dist/runtime/components/Edit/Features/PreviewGrant/index.vue +3 -1
- package/dist/runtime/components/Edit/Features/Publish/Dialog/index.vue +10 -0
- package/dist/runtime/components/Edit/Features/Publish/index.vue +17 -15
- package/dist/runtime/components/Edit/Features/ResponsivePreview/Frame/index.vue +3 -2
- package/dist/runtime/components/Edit/Features/ResponsivePreview/index.vue +3 -2
- package/dist/runtime/components/Edit/Features/Revert/index.vue +24 -18
- package/dist/runtime/components/Edit/Features/Search/Overlay/Results/Content/index.vue +8 -2
- package/dist/runtime/components/Edit/Features/Search/Overlay/Results/Page/index.vue +12 -2
- package/dist/runtime/components/Edit/Features/Search/Overlay/index.vue +11 -3
- package/dist/runtime/components/Edit/Features/Search/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/Overlay/index.vue +128 -31
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/Overlay/index.vue.d.ts +6 -6
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/index.vue +3 -6
- package/dist/runtime/components/Edit/Features/Selection/Renderer/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/Settings/Dialog/index.vue +1 -0
- package/dist/runtime/components/Edit/Features/Settings/index.vue +26 -18
- package/dist/runtime/components/Edit/Features/Structure/List/Field/index.vue +3 -3
- package/dist/runtime/components/Edit/Features/TouchActionBar/index.vue +2 -2
- package/dist/runtime/components/Edit/Features/Tour/Overlay/index.vue +3 -3
- package/dist/runtime/components/Edit/Features/Tour/Popup/index.vue +2 -2
- package/dist/runtime/components/Edit/Features/Tour/index.vue +12 -10
- package/dist/runtime/components/Edit/Features/Transform/Dialog/index.vue +7 -1
- package/dist/runtime/components/Edit/Features/Transform/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/Translations/index.vue +18 -17
- package/dist/runtime/components/Edit/Form/Textarea/index.vue +1 -1
- package/dist/runtime/components/Edit/FormOverlay/index.vue +13 -4
- package/dist/runtime/components/Edit/Indicators/index.vue +1 -1
- package/dist/runtime/components/Edit/InfoBox/index.vue +3 -2
- package/dist/runtime/components/Edit/InfoBox/index.vue.d.ts +6 -1
- package/dist/runtime/components/Edit/ItemIconBox/index.vue +41 -0
- package/dist/runtime/components/Edit/{AddListItemIcon → ItemIconBox}/index.vue.d.ts +5 -5
- package/dist/runtime/components/Edit/Konami/Game/index.vue +0 -1
- package/dist/runtime/components/Edit/Konami/index.vue +3 -5
- package/dist/runtime/components/Edit/Messages/Item/index.vue +11 -2
- package/dist/runtime/components/Edit/Messages/index.vue +6 -1
- package/dist/runtime/components/Edit/Overlay/index.vue +70 -0
- package/dist/runtime/components/Edit/Overlay/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/PreviewProvider.vue +3 -3
- package/dist/runtime/components/Edit/ScaleToFit/index.vue +4 -4
- package/dist/runtime/components/Edit/SystemRequirements/index.vue +36 -36
- package/dist/runtime/components/Edit/Toolbar/index.vue +47 -48
- package/dist/runtime/components/Edit/index.d.ts +2 -2
- package/dist/runtime/components/Edit/index.js +2 -2
- package/dist/runtime/composables/defineBlokkliFeature.d.ts +1 -1
- package/dist/runtime/composables/useBlokkli.d.ts +6 -1
- package/dist/runtime/composables/useBlokkli.js +4 -1
- package/dist/runtime/css/output.css +1 -1
- package/dist/runtime/helpers/composables/defineAddAction.d.ts +2 -0
- package/dist/runtime/helpers/composables/defineAddAction.js +10 -0
- package/dist/runtime/helpers/composables/defineElementStyle.d.ts +2 -0
- package/dist/runtime/helpers/composables/defineElementStyle.js +33 -0
- package/dist/runtime/helpers/composables/defineItemDropdownAction.d.ts +1 -1
- package/dist/runtime/helpers/composables/defineItemDropdownAction.js +2 -2
- package/dist/runtime/helpers/composables/defineMenuButton.d.ts +2 -0
- package/dist/runtime/helpers/composables/defineMenuButton.js +10 -0
- package/dist/runtime/helpers/composables/defineRenderer.d.ts +1 -1
- package/dist/runtime/helpers/composables/onBroadcastEvent.d.ts +1 -1
- package/dist/runtime/helpers/composables/useBlockRegistration.d.ts +1 -1
- package/dist/runtime/helpers/composables/useBlockRegistration.js +12 -1
- package/dist/runtime/helpers/composables/useDebugLogger.d.ts +1 -1
- package/dist/runtime/helpers/composables/useDialog.d.ts +3 -0
- package/dist/runtime/helpers/composables/useDialog.js +16 -0
- package/dist/runtime/helpers/composables/useFocusTrap.d.ts +52 -0
- package/dist/runtime/helpers/composables/useFocusTrap.js +59 -0
- package/dist/runtime/helpers/composables/useGlobalBlokkliObject.d.ts +1 -1
- package/dist/runtime/helpers/{useTransitionedValue.js → composables/useTransitionedValue.js} +1 -1
- package/dist/runtime/helpers/dropTargets/index.d.ts +1 -1
- package/dist/runtime/helpers/dropTargets/index.js +17 -3
- package/dist/runtime/helpers/imports/index.d.ts +2 -1
- package/dist/runtime/helpers/imports/index.js +10 -1
- package/dist/runtime/helpers/{animationProvider.d.ts → providers/animation.d.ts} +100 -7
- package/dist/runtime/helpers/{animationProvider.js → providers/animation.js} +21 -11
- package/dist/runtime/helpers/providers/blocks.d.ts +25 -3
- package/dist/runtime/helpers/providers/blocks.js +19 -0
- package/dist/runtime/helpers/providers/commands.d.ts +41 -0
- package/dist/runtime/helpers/{commandsProvider.js → providers/commands.js} +1 -1
- package/dist/runtime/helpers/providers/debug.d.ts +125 -0
- package/dist/runtime/helpers/{debugProvider.js → providers/debug.js} +2 -2
- package/dist/runtime/helpers/providers/definition.d.ts +87 -0
- package/dist/runtime/helpers/providers/directive.d.ts +88 -2
- package/dist/runtime/helpers/providers/directive.js +18 -2
- package/dist/runtime/helpers/providers/dom.d.ts +225 -0
- package/dist/runtime/helpers/{domProvider.js → providers/dom.js} +34 -76
- package/dist/runtime/helpers/providers/dropArea.d.ts +47 -0
- package/dist/runtime/helpers/{dropAreaProvider.js → providers/dropArea.js} +1 -1
- package/dist/runtime/helpers/providers/element.d.ts +58 -1
- package/dist/runtime/helpers/providers/features.d.ts +56 -0
- package/dist/runtime/helpers/{featuresProvider.js → providers/features.js} +1 -1
- package/dist/runtime/helpers/providers/fields.d.ts +19 -4
- package/dist/runtime/helpers/providers/fields.js +1 -1
- package/dist/runtime/helpers/providers/indicators.d.ts +44 -0
- package/dist/runtime/helpers/providers/keyboard.d.ts +76 -0
- package/dist/runtime/helpers/{keyboardProvider.js → providers/keyboard.js} +1 -8
- package/dist/runtime/helpers/providers/plugin.d.ts +81 -0
- package/dist/runtime/helpers/providers/plugin.js +64 -0
- package/dist/runtime/helpers/{selectionProvider.d.ts → providers/selection.d.ts} +4 -1
- package/dist/runtime/helpers/{selectionProvider.js → providers/selection.js} +1 -1
- package/dist/runtime/helpers/providers/state.d.ts +227 -0
- package/dist/runtime/helpers/{stateProvider.js → providers/state.js} +3 -3
- package/dist/runtime/helpers/providers/storage.d.ts +64 -0
- package/dist/runtime/helpers/{textProvider.d.ts → providers/texts.d.ts} +1 -1
- package/dist/runtime/helpers/providers/theme.d.ts +119 -0
- package/dist/runtime/helpers/{themeProvider.js → providers/theme.js} +3 -3
- package/dist/runtime/helpers/providers/tour.d.ts +49 -0
- package/dist/runtime/helpers/{tourProvider.js → providers/tour.js} +1 -1
- package/dist/runtime/helpers/providers/types.d.ts +170 -0
- package/dist/runtime/helpers/{typesProvider.js → providers/types.js} +45 -1
- package/dist/runtime/helpers/providers/ui.d.ts +339 -0
- package/dist/runtime/helpers/{uiProvider.js → providers/ui.js} +94 -86
- package/dist/runtime/helpers/runtimeHelpers/index.d.ts +1 -1
- package/dist/runtime/helpers/symbols.d.ts +1 -0
- package/dist/runtime/helpers/symbols.js +3 -0
- package/dist/runtime/icons/click.svg +1 -0
- package/dist/runtime/types/blockOptions.d.ts +349 -0
- package/dist/runtime/types/index.d.ts +34 -31
- package/package.json +2 -2
- package/dist/runtime/blokkliPlugins/AddAction/index.vue +0 -96
- package/dist/runtime/blokkliPlugins/AddAction/index.vue.d.ts +0 -26
- package/dist/runtime/blokkliPlugins/MenuButton/index.vue +0 -68
- package/dist/runtime/components/Edit/AddListItemIcon/index.vue +0 -19
- package/dist/runtime/helpers/commandsProvider.d.ts +0 -9
- package/dist/runtime/helpers/debugProvider.d.ts +0 -33
- package/dist/runtime/helpers/definitionProvider.d.ts +0 -19
- package/dist/runtime/helpers/domProvider.d.ts +0 -90
- package/dist/runtime/helpers/dropAreaProvider.d.ts +0 -9
- package/dist/runtime/helpers/featuresProvider.d.ts +0 -17
- package/dist/runtime/helpers/indicatorsProvider.d.ts +0 -10
- package/dist/runtime/helpers/keyboardProvider.d.ts +0 -20
- package/dist/runtime/helpers/pluginProvider.d.ts +0 -26
- package/dist/runtime/helpers/pluginProvider.js +0 -62
- package/dist/runtime/helpers/stateProvider.d.ts +0 -47
- package/dist/runtime/helpers/storageProvider.d.ts +0 -17
- package/dist/runtime/helpers/themeProvider.d.ts +0 -30
- package/dist/runtime/helpers/tourProvider.d.ts +0 -11
- package/dist/runtime/helpers/typesProvider.d.ts +0 -36
- package/dist/runtime/helpers/uiProvider.d.ts +0 -60
- package/dist/runtime/types/blokkOptions.d.ts +0 -100
- /package/dist/runtime/helpers/{addElementClasses.d.ts → composables/addElementClasses.d.ts} +0 -0
- /package/dist/runtime/helpers/{addElementClasses.js → composables/addElementClasses.js} +0 -0
- /package/dist/runtime/helpers/{useTransitionedValue.d.ts → composables/useTransitionedValue.d.ts} +0 -0
- /package/dist/runtime/helpers/{broadcastProvider.d.ts → providers/broadcast.d.ts} +0 -0
- /package/dist/runtime/helpers/{broadcastProvider.js → providers/broadcast.js} +0 -0
- /package/dist/runtime/helpers/{definitionProvider.js → providers/definition.js} +0 -0
- /package/dist/runtime/helpers/{indicatorsProvider.js → providers/indicators.js} +0 -0
- /package/dist/runtime/helpers/{storageProvider.js → providers/storage.js} +0 -0
- /package/dist/runtime/helpers/{textProvider.js → providers/texts.js} +0 -0
- /package/dist/runtime/types/{blokkOptions.js → blockOptions.js} +0 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { type Ref } from 'vue';
|
|
2
|
+
import type { BlockIndicator } from '../../types/index.js';
|
|
3
|
+
export type IndicatorsProvider = {
|
|
4
|
+
/**
|
|
5
|
+
* List of all active block indicators.
|
|
6
|
+
*
|
|
7
|
+
* Indicators are visual badges/icons that appear on blocks
|
|
8
|
+
* (e.g., anchor icons, schedule indicators, etc.).
|
|
9
|
+
*/
|
|
10
|
+
indicators: Ref<BlockIndicator[]>;
|
|
11
|
+
/**
|
|
12
|
+
* UUID of the currently hovered block.
|
|
13
|
+
*
|
|
14
|
+
* Used to show/hide hover-specific indicators.
|
|
15
|
+
*/
|
|
16
|
+
hovered: Ref<string>;
|
|
17
|
+
/**
|
|
18
|
+
* Add a block indicator.
|
|
19
|
+
*
|
|
20
|
+
* Registers a new indicator to be displayed on a block.
|
|
21
|
+
*
|
|
22
|
+
* @param indicator - The indicator configuration
|
|
23
|
+
*/
|
|
24
|
+
addIndicator: (indicator: BlockIndicator) => void;
|
|
25
|
+
/**
|
|
26
|
+
* Remove a block indicator.
|
|
27
|
+
*
|
|
28
|
+
* Removes an indicator based on its ID and the block UUID.
|
|
29
|
+
* Both must match to remove the indicator.
|
|
30
|
+
*
|
|
31
|
+
* @param id - The indicator ID
|
|
32
|
+
* @param uuid - The block UUID
|
|
33
|
+
*/
|
|
34
|
+
removeIndicator: (id: string, uuid: string) => void;
|
|
35
|
+
/**
|
|
36
|
+
* Set the currently hovered block.
|
|
37
|
+
*
|
|
38
|
+
* Updates the hovered state used to show hover-specific indicators.
|
|
39
|
+
*
|
|
40
|
+
* @param uuid - The block UUID, or null/undefined to clear
|
|
41
|
+
*/
|
|
42
|
+
setHovered: (uuid?: string | null) => void;
|
|
43
|
+
};
|
|
44
|
+
export default function (): IndicatorsProvider;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { type Ref, type ComputedRef } from 'vue';
|
|
2
|
+
import type { KeyboardShortcut } from '#blokkli/types';
|
|
3
|
+
type RegisteredShortcut = {
|
|
4
|
+
key: string;
|
|
5
|
+
shortcut: KeyboardShortcut;
|
|
6
|
+
};
|
|
7
|
+
export type KeyboardProvider = {
|
|
8
|
+
/**
|
|
9
|
+
* Whether the Space key is currently pressed.
|
|
10
|
+
*
|
|
11
|
+
* Commonly used to enable panning mode in the artboard.
|
|
12
|
+
*/
|
|
13
|
+
isPressingSpace: Readonly<Ref<boolean>>;
|
|
14
|
+
/**
|
|
15
|
+
* Whether Control/Meta key is currently pressed.
|
|
16
|
+
*
|
|
17
|
+
* Meta is Cmd on macOS, Ctrl on Windows/Linux.
|
|
18
|
+
* Also true when CapsLock is active.
|
|
19
|
+
*/
|
|
20
|
+
isPressingControl: Readonly<Ref<boolean>>;
|
|
21
|
+
/**
|
|
22
|
+
* Whether the Shift key is currently pressed.
|
|
23
|
+
*/
|
|
24
|
+
isPressingShift: Readonly<Ref<boolean>>;
|
|
25
|
+
/**
|
|
26
|
+
* Update keyboard modifier state from a mouse/pointer event.
|
|
27
|
+
*
|
|
28
|
+
* Useful for updating modifier state during drag operations where
|
|
29
|
+
* keyboard events might not fire.
|
|
30
|
+
*
|
|
31
|
+
* @param e - The mouse or pointer event
|
|
32
|
+
*/
|
|
33
|
+
setShortcutStateFromEvent: (e: MouseEvent | PointerEvent) => void;
|
|
34
|
+
/**
|
|
35
|
+
* List of all registered keyboard shortcuts.
|
|
36
|
+
*
|
|
37
|
+
* Shortcuts are registered by features, buttons, and actions to enable
|
|
38
|
+
* keyboard navigation and commands.
|
|
39
|
+
*/
|
|
40
|
+
shortcuts: ComputedRef<RegisteredShortcut[]>;
|
|
41
|
+
/**
|
|
42
|
+
* Register a keyboard shortcut.
|
|
43
|
+
*
|
|
44
|
+
* Adds the shortcut to the global shortcuts list for display in help UI.
|
|
45
|
+
*
|
|
46
|
+
* @param shortcut - The keyboard shortcut configuration
|
|
47
|
+
*/
|
|
48
|
+
registerShortcut: (shortcut: KeyboardShortcut) => void;
|
|
49
|
+
/**
|
|
50
|
+
* Unregister a keyboard shortcut.
|
|
51
|
+
*
|
|
52
|
+
* Removes the shortcut from the global shortcuts list.
|
|
53
|
+
*
|
|
54
|
+
* @param shortcut - The keyboard shortcut to remove
|
|
55
|
+
*/
|
|
56
|
+
unregisterShortcut: (shortcut: KeyboardShortcut) => void;
|
|
57
|
+
/**
|
|
58
|
+
* Lock keyboard events.
|
|
59
|
+
*
|
|
60
|
+
* Prevents keyboard shortcuts from firing. Used when text input is focused
|
|
61
|
+
* or dialogs are open to avoid unintended actions.
|
|
62
|
+
*
|
|
63
|
+
* @param id - Unique identifier for this lock
|
|
64
|
+
*/
|
|
65
|
+
lockKeyboardEvents: (id: string) => void;
|
|
66
|
+
/**
|
|
67
|
+
* Unlock keyboard events.
|
|
68
|
+
*
|
|
69
|
+
* Removes a keyboard lock, re-enabling shortcuts when all locks are removed.
|
|
70
|
+
*
|
|
71
|
+
* @param id - The lock identifier to remove
|
|
72
|
+
*/
|
|
73
|
+
unlockKeyboardEvents: (id: string) => void;
|
|
74
|
+
};
|
|
75
|
+
export default function (): KeyboardProvider;
|
|
76
|
+
export {};
|
|
@@ -3,7 +3,6 @@ import {
|
|
|
3
3
|
readonly,
|
|
4
4
|
onMounted,
|
|
5
5
|
onBeforeUnmount,
|
|
6
|
-
watch,
|
|
7
6
|
computed
|
|
8
7
|
} from "vue";
|
|
9
8
|
import { eventBus } from "#blokkli/helpers/eventBus";
|
|
@@ -13,7 +12,7 @@ function getControlState(e) {
|
|
|
13
12
|
}
|
|
14
13
|
return e.getModifierState("Control") || e.getModifierState("Meta");
|
|
15
14
|
}
|
|
16
|
-
export default function(
|
|
15
|
+
export default function() {
|
|
17
16
|
const isPressingControl = ref(false);
|
|
18
17
|
const isPressingSpace = ref(false);
|
|
19
18
|
const isPressingShift = ref(false);
|
|
@@ -62,12 +61,6 @@ export default function(animationProvider) {
|
|
|
62
61
|
document.removeEventListener("keyup", onKeyUp);
|
|
63
62
|
document.removeEventListener("visibilitychange", onVisibilityChange);
|
|
64
63
|
});
|
|
65
|
-
watch(isPressingSpace, () => {
|
|
66
|
-
animationProvider.requestDraw();
|
|
67
|
-
});
|
|
68
|
-
watch(isPressingControl, () => {
|
|
69
|
-
animationProvider.requestDraw();
|
|
70
|
-
});
|
|
71
64
|
const getShortcutKey = (shortcut) => [!!shortcut.meta, !!shortcut.shift, shortcut.code].join("-");
|
|
72
65
|
const registerShortcut = (shortcut) => {
|
|
73
66
|
registeredShortcuts.value.push({ key: getShortcutKey(shortcut), shortcut });
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { AddAction } from '#blokkli/types';
|
|
2
|
+
import type { BlokkliIcon } from '#blokkli-build/icons';
|
|
3
|
+
type PluginAddFunction<T> = () => T | T[] | undefined;
|
|
4
|
+
type AddActionFunction = PluginAddFunction<AddAction>;
|
|
5
|
+
export type ItemDropdownAction = {
|
|
6
|
+
id: string;
|
|
7
|
+
label: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
enabled?: boolean;
|
|
10
|
+
icon?: BlokkliIcon;
|
|
11
|
+
bundle?: string;
|
|
12
|
+
weight?: number;
|
|
13
|
+
group: string;
|
|
14
|
+
callback: () => void;
|
|
15
|
+
};
|
|
16
|
+
type ItemDropdownActionFunction = PluginAddFunction<ItemDropdownAction>;
|
|
17
|
+
export type MenuButtonPlugin = {
|
|
18
|
+
id: string;
|
|
19
|
+
title: string;
|
|
20
|
+
description: string;
|
|
21
|
+
icon?: BlokkliIcon;
|
|
22
|
+
type?: 'success' | 'danger' | 'yellow';
|
|
23
|
+
weight?: number;
|
|
24
|
+
secondary?: boolean;
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
callback: () => void;
|
|
27
|
+
};
|
|
28
|
+
type MenuButtonFunction = PluginAddFunction<MenuButtonPlugin>;
|
|
29
|
+
type PluginFunctionMap = {
|
|
30
|
+
addAction: AddActionFunction;
|
|
31
|
+
itemDropdownAction: ItemDropdownActionFunction;
|
|
32
|
+
menuButton: MenuButtonFunction;
|
|
33
|
+
};
|
|
34
|
+
type PluginDataMap = {
|
|
35
|
+
addAction: AddAction;
|
|
36
|
+
itemDropdownAction: ItemDropdownAction;
|
|
37
|
+
menuButton: MenuButtonPlugin;
|
|
38
|
+
};
|
|
39
|
+
export type PluginProvider = {
|
|
40
|
+
/**
|
|
41
|
+
* Register a plugin provider function.
|
|
42
|
+
*
|
|
43
|
+
* The function will be called when plugins of this type are requested.
|
|
44
|
+
* It can return a single plugin, an array of plugins, or undefined.
|
|
45
|
+
*
|
|
46
|
+
* @param type - The plugin type ('addAction', 'itemDropdownAction', 'menuButton')
|
|
47
|
+
* @param fn - Function that returns plugin(s)
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```ts
|
|
51
|
+
* plugin.add('addAction', () => ({
|
|
52
|
+
* id: 'custom-add',
|
|
53
|
+
* label: 'Add Custom',
|
|
54
|
+
* bundles: ['text'],
|
|
55
|
+
* callback: () => console.log('add'),
|
|
56
|
+
* }))
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
add<T extends keyof PluginFunctionMap>(type: T, fn: PluginFunctionMap[T]): void;
|
|
60
|
+
/**
|
|
61
|
+
* Unregister a plugin provider function.
|
|
62
|
+
*
|
|
63
|
+
* Removes a previously registered function so it no longer provides plugins.
|
|
64
|
+
*
|
|
65
|
+
* @param type - The plugin type
|
|
66
|
+
* @param fn - The function to remove (must be the same reference used in add)
|
|
67
|
+
*/
|
|
68
|
+
remove<T extends keyof PluginFunctionMap>(type: T, fn: PluginFunctionMap[T]): void;
|
|
69
|
+
/**
|
|
70
|
+
* Get all plugins from all registered providers.
|
|
71
|
+
*
|
|
72
|
+
* Calls all registered provider functions for this type, flattens the results,
|
|
73
|
+
* and filters out undefined values.
|
|
74
|
+
*
|
|
75
|
+
* @param type - The plugin type to retrieve
|
|
76
|
+
* @returns Array of all available plugins of this type
|
|
77
|
+
*/
|
|
78
|
+
get<T extends keyof PluginDataMap>(type: T): PluginDataMap[T][];
|
|
79
|
+
};
|
|
80
|
+
export default function (): PluginProvider;
|
|
81
|
+
export {};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { ref } from "#imports";
|
|
2
|
+
export default function() {
|
|
3
|
+
const addActionPlugins = ref([]);
|
|
4
|
+
const itemDropdownActionPlugins = ref([]);
|
|
5
|
+
const menuButtonPlugins = ref([]);
|
|
6
|
+
function add(type, fn) {
|
|
7
|
+
if (type === "addAction") {
|
|
8
|
+
addActionPlugins.value.push(fn);
|
|
9
|
+
} else if (type === "itemDropdownAction") {
|
|
10
|
+
itemDropdownActionPlugins.value.push(fn);
|
|
11
|
+
} else if (type === "menuButton") {
|
|
12
|
+
menuButtonPlugins.value.push(fn);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function remove(type, fn) {
|
|
16
|
+
if (type === "addAction") {
|
|
17
|
+
addActionPlugins.value = addActionPlugins.value.filter(
|
|
18
|
+
(v) => v !== fn
|
|
19
|
+
);
|
|
20
|
+
} else if (type === "itemDropdownAction") {
|
|
21
|
+
itemDropdownActionPlugins.value = itemDropdownActionPlugins.value.filter(
|
|
22
|
+
(v) => v !== fn
|
|
23
|
+
);
|
|
24
|
+
} else if (type === "menuButton") {
|
|
25
|
+
menuButtonPlugins.value = menuButtonPlugins.value.filter(
|
|
26
|
+
(v) => v !== fn
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function get(type) {
|
|
31
|
+
let storage;
|
|
32
|
+
if (type === "addAction") {
|
|
33
|
+
storage = addActionPlugins.value;
|
|
34
|
+
} else if (type === "itemDropdownAction") {
|
|
35
|
+
storage = itemDropdownActionPlugins.value;
|
|
36
|
+
} else if (type === "menuButton") {
|
|
37
|
+
storage = menuButtonPlugins.value;
|
|
38
|
+
} else {
|
|
39
|
+
return [];
|
|
40
|
+
}
|
|
41
|
+
const result = [];
|
|
42
|
+
for (let i = 0; i < storage.length; i++) {
|
|
43
|
+
const callback = storage[i];
|
|
44
|
+
if (!callback) {
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
const callbackResult = callback();
|
|
48
|
+
if (!callbackResult) {
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
if (Array.isArray(callbackResult)) {
|
|
52
|
+
result.push(...callbackResult);
|
|
53
|
+
} else {
|
|
54
|
+
result.push(callbackResult);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return result;
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
add,
|
|
61
|
+
remove,
|
|
62
|
+
get
|
|
63
|
+
};
|
|
64
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Ref, type ComputedRef } from '#imports';
|
|
2
2
|
import type { DraggableItem, InteractionMode, RenderedFieldListItem } from '#blokkli/types';
|
|
3
|
-
import type { BlocksProvider } from './
|
|
3
|
+
import type { BlocksProvider } from './blocks.js';
|
|
4
4
|
export type SelectionProvider = {
|
|
5
5
|
/**
|
|
6
6
|
* The currently selected UUIDs.
|
|
@@ -66,6 +66,9 @@ export type SelectionProvider = {
|
|
|
66
66
|
* The block bundles of the items being dragged.
|
|
67
67
|
*/
|
|
68
68
|
dragItemsBundles: ComputedRef<string[]>;
|
|
69
|
+
/**
|
|
70
|
+
* Determine if the given block UUID is currently selected.
|
|
71
|
+
*/
|
|
69
72
|
isBlockSelected(uuid: string): boolean;
|
|
70
73
|
/**
|
|
71
74
|
* Lock selection.
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import { type Ref, type ComputedRef } from 'vue';
|
|
2
|
+
import type { BlokkliAdapter, AdapterContext } from '../../adapter/index.js';
|
|
3
|
+
import type { MutatedField, EditEntity, MutatedOptions, TranslationState, MappedState, MutationItem, Validation, MutateWithLoadingStateFunction, EditMode, FieldListItem, PublishOptions, EditPermission } from '#blokkli/types';
|
|
4
|
+
import type { TextProvider } from './texts.js';
|
|
5
|
+
export type BlokkliOwner = {
|
|
6
|
+
name: string | undefined;
|
|
7
|
+
currentUserIsOwner: boolean;
|
|
8
|
+
};
|
|
9
|
+
export type RenderedBlock = {
|
|
10
|
+
item: FieldListItem;
|
|
11
|
+
parentEntityType: string;
|
|
12
|
+
parentEntityBundle: string;
|
|
13
|
+
parentEntityUuid: string;
|
|
14
|
+
};
|
|
15
|
+
export type StateProvider = {
|
|
16
|
+
/**
|
|
17
|
+
* Information about the editing session owner.
|
|
18
|
+
*
|
|
19
|
+
* Includes owner name and whether the current user is the owner.
|
|
20
|
+
*/
|
|
21
|
+
owner: Readonly<Ref<BlokkliOwner | null>>;
|
|
22
|
+
/**
|
|
23
|
+
* Refresh key that changes when state is reloaded.
|
|
24
|
+
*
|
|
25
|
+
* Use as a component key to force remounting when state updates.
|
|
26
|
+
*/
|
|
27
|
+
refreshKey: Readonly<Ref<string>>;
|
|
28
|
+
/**
|
|
29
|
+
* All mutated fields in the current editing session.
|
|
30
|
+
*
|
|
31
|
+
* Each field contains its entity context, field name, and list of blocks.
|
|
32
|
+
*/
|
|
33
|
+
mutatedFields: Readonly<Ref<MutatedField[]>>;
|
|
34
|
+
/**
|
|
35
|
+
* The host entity being edited.
|
|
36
|
+
*
|
|
37
|
+
* Contains label, status, and bundle information.
|
|
38
|
+
*/
|
|
39
|
+
entity: Readonly<Ref<EditEntity>>;
|
|
40
|
+
/**
|
|
41
|
+
* Mutated options for all blocks and the host entity.
|
|
42
|
+
*
|
|
43
|
+
* Maps block UUIDs (or 'HOST' for host options) to their option values.
|
|
44
|
+
*/
|
|
45
|
+
mutatedOptions: MutatedOptions;
|
|
46
|
+
/**
|
|
47
|
+
* Translation state for the edited entity.
|
|
48
|
+
*
|
|
49
|
+
* Includes source language, available languages, and existing translations.
|
|
50
|
+
*/
|
|
51
|
+
translation: Readonly<Ref<TranslationState>>;
|
|
52
|
+
/**
|
|
53
|
+
* Publishing options and capabilities.
|
|
54
|
+
*
|
|
55
|
+
* Indicates whether publishing, scheduling, and revisions are available.
|
|
56
|
+
*/
|
|
57
|
+
publishOptions: Readonly<Ref<PublishOptions>>;
|
|
58
|
+
/**
|
|
59
|
+
* History of all mutations in the editing session.
|
|
60
|
+
*
|
|
61
|
+
* Used for undo/redo functionality and tracking changes.
|
|
62
|
+
*/
|
|
63
|
+
mutations: Readonly<Ref<MutationItem[]>>;
|
|
64
|
+
/**
|
|
65
|
+
* Current position in the mutation history.
|
|
66
|
+
*
|
|
67
|
+
* -1 indicates no mutations, 0+ indicates active mutation index.
|
|
68
|
+
*/
|
|
69
|
+
currentMutationIndex: Readonly<Ref<number>>;
|
|
70
|
+
/**
|
|
71
|
+
* Validation violations for the current state.
|
|
72
|
+
*
|
|
73
|
+
* Contains errors and warnings about invalid field values or configurations.
|
|
74
|
+
*/
|
|
75
|
+
violations: Readonly<Ref<Validation[]>>;
|
|
76
|
+
/**
|
|
77
|
+
* Execute a mutation with loading state and error handling.
|
|
78
|
+
*
|
|
79
|
+
* Shows loading indicator, handles errors, updates state, and shows messages.
|
|
80
|
+
*
|
|
81
|
+
* @param callback - Function that performs the mutation
|
|
82
|
+
* @param errorMessage - Error message to show on failure (false to suppress)
|
|
83
|
+
* @param successMessage - Optional success message to show
|
|
84
|
+
* @returns True if successful, false if failed
|
|
85
|
+
*/
|
|
86
|
+
mutateWithLoadingState: MutateWithLoadingStateFunction;
|
|
87
|
+
/**
|
|
88
|
+
* Current edit mode.
|
|
89
|
+
*
|
|
90
|
+
* - 'readonly': User cannot edit (no permission or not owner)
|
|
91
|
+
* - 'editing': User can edit
|
|
92
|
+
* - 'translating': User is editing a translation
|
|
93
|
+
*/
|
|
94
|
+
editMode: Readonly<Ref<EditMode>>;
|
|
95
|
+
/**
|
|
96
|
+
* The raw mutated entity data from the adapter.
|
|
97
|
+
*
|
|
98
|
+
* Contains adapter-specific entity data (e.g., Drupal entity fields).
|
|
99
|
+
*/
|
|
100
|
+
mutatedEntity: Readonly<Ref<any>>;
|
|
101
|
+
/**
|
|
102
|
+
* Whether the current user can edit.
|
|
103
|
+
*
|
|
104
|
+
* True when state is loaded, user is owner, no load errors, and has edit permission.
|
|
105
|
+
*/
|
|
106
|
+
canEdit: ComputedRef<boolean>;
|
|
107
|
+
/**
|
|
108
|
+
* List of permissions for the current user.
|
|
109
|
+
*
|
|
110
|
+
* Includes 'edit', 'view', and other adapter-specific permissions.
|
|
111
|
+
*/
|
|
112
|
+
permissions: ComputedRef<EditPermission[]>;
|
|
113
|
+
/**
|
|
114
|
+
* Whether state has been successfully loaded.
|
|
115
|
+
*
|
|
116
|
+
* True when state loaded without errors.
|
|
117
|
+
*/
|
|
118
|
+
stateAvailable: ComputedRef<boolean>;
|
|
119
|
+
/**
|
|
120
|
+
* Whether a loading operation is in progress.
|
|
121
|
+
*
|
|
122
|
+
* Automatically adds 'bk-body-loading' class to document.body when true.
|
|
123
|
+
*/
|
|
124
|
+
isLoading: Readonly<Ref<boolean>>;
|
|
125
|
+
/**
|
|
126
|
+
* UUIDs of all blocks loaded from the library.
|
|
127
|
+
*
|
|
128
|
+
* Blocks with bundle 'from_library'.
|
|
129
|
+
*/
|
|
130
|
+
fromLibraryUuids: Readonly<Ref<Readonly<string[]>>>;
|
|
131
|
+
/**
|
|
132
|
+
* Get the number of blocks in a field.
|
|
133
|
+
*
|
|
134
|
+
* Results are cached for performance.
|
|
135
|
+
*
|
|
136
|
+
* @param key - The field key (entityUuid:fieldName)
|
|
137
|
+
* @returns Number of blocks in the field
|
|
138
|
+
*/
|
|
139
|
+
getFieldBlockCount: (key: string) => number;
|
|
140
|
+
/**
|
|
141
|
+
* Get the total count of blocks with a specific bundle.
|
|
142
|
+
*
|
|
143
|
+
* @param bundle - The block bundle
|
|
144
|
+
* @returns Total number of blocks with this bundle
|
|
145
|
+
*/
|
|
146
|
+
getBlockBundleCount: (bundle: string) => number;
|
|
147
|
+
/**
|
|
148
|
+
* Get a field list item by UUID.
|
|
149
|
+
*
|
|
150
|
+
* @param uuid - The block UUID
|
|
151
|
+
* @returns The field list item, or undefined if not found
|
|
152
|
+
*/
|
|
153
|
+
getFieldListItem: (uuid: string) => FieldListItem | undefined;
|
|
154
|
+
/**
|
|
155
|
+
* Get the mutated field that contains a block.
|
|
156
|
+
*
|
|
157
|
+
* @param uuid - The block UUID
|
|
158
|
+
* @returns The field containing this block, or undefined if not found
|
|
159
|
+
*/
|
|
160
|
+
getFieldListForBlock: (uuid: string) => MutatedField | undefined;
|
|
161
|
+
/**
|
|
162
|
+
* Get a mutated field by entity UUID and field name.
|
|
163
|
+
*
|
|
164
|
+
* @param uuid - The entity UUID
|
|
165
|
+
* @param fieldName - The field name
|
|
166
|
+
* @returns The mutated field, or undefined if not found
|
|
167
|
+
*/
|
|
168
|
+
getMutatedField: (uuid: string, fieldName: string) => MutatedField | undefined;
|
|
169
|
+
/**
|
|
170
|
+
* Get all block UUIDs, optionally filtered by bundle.
|
|
171
|
+
*
|
|
172
|
+
* @param bundle - Optional bundle to filter by
|
|
173
|
+
* @returns Array of block UUIDs
|
|
174
|
+
*/
|
|
175
|
+
getAllUuids: (bundle?: string) => string[];
|
|
176
|
+
/**
|
|
177
|
+
* Get the nesting level of a block.
|
|
178
|
+
*
|
|
179
|
+
* Level 0 = block in host entity field
|
|
180
|
+
* Level 1 = block in another block's field
|
|
181
|
+
* Level 2+ = deeper nesting
|
|
182
|
+
*
|
|
183
|
+
* @param uuid - The block UUID
|
|
184
|
+
* @returns The nesting level (0+)
|
|
185
|
+
*/
|
|
186
|
+
getNestingLevel: (uuid: string) => number;
|
|
187
|
+
/**
|
|
188
|
+
* Check if a block is a child (direct or nested) of another block.
|
|
189
|
+
*
|
|
190
|
+
* Recursively checks parent relationships.
|
|
191
|
+
*
|
|
192
|
+
* @param childUuid - The potential child block UUID
|
|
193
|
+
* @param parentUuid - The potential parent block UUID
|
|
194
|
+
* @returns True if childUuid is a descendant of parentUuid
|
|
195
|
+
*/
|
|
196
|
+
isChildOf: (childUuid: string, parentUuid: string) => boolean;
|
|
197
|
+
/**
|
|
198
|
+
* Get the current mapped state.
|
|
199
|
+
*
|
|
200
|
+
* Throws error if called before state is available.
|
|
201
|
+
*
|
|
202
|
+
* @returns The current mapped state
|
|
203
|
+
*/
|
|
204
|
+
getMappedState: () => MappedState;
|
|
205
|
+
/**
|
|
206
|
+
* Temporarily override the state.
|
|
207
|
+
*
|
|
208
|
+
* Used for previewing changes without committing them.
|
|
209
|
+
*
|
|
210
|
+
* @param state - The temporary state to use
|
|
211
|
+
*/
|
|
212
|
+
setOverrideState: (state: MappedState) => void;
|
|
213
|
+
/**
|
|
214
|
+
* Clear the temporary override and restore previous state.
|
|
215
|
+
*
|
|
216
|
+
* Throws error if no override is active.
|
|
217
|
+
*/
|
|
218
|
+
clearOverrideState: () => void;
|
|
219
|
+
/**
|
|
220
|
+
* Get the field key for a block UUID.
|
|
221
|
+
*
|
|
222
|
+
* @param uuid - The block UUID
|
|
223
|
+
* @returns The field key (entityUuid:fieldName), or null if not found
|
|
224
|
+
*/
|
|
225
|
+
getFieldKeyForUuid: (uuid: string) => string | null;
|
|
226
|
+
};
|
|
227
|
+
export default function (adapter: BlokkliAdapter<any>, context: ComputedRef<AdapterContext>, $t: TextProvider, providerKey: string, permissions: EditPermission[]): Promise<StateProvider>;
|
|
@@ -6,12 +6,12 @@ import {
|
|
|
6
6
|
provide
|
|
7
7
|
} from "vue";
|
|
8
8
|
import { refreshNuxtData, useState } from "nuxt/app";
|
|
9
|
-
import { INJECT_MUTATED_FIELDS_MAP } from "
|
|
10
|
-
import onBlokkliEvent from "
|
|
9
|
+
import { INJECT_MUTATED_FIELDS_MAP } from "../symbols.js";
|
|
10
|
+
import onBlokkliEvent from "../composables/onBlokkliEvent.js";
|
|
11
11
|
import { falsy, getFieldKey } from "#blokkli/helpers";
|
|
12
12
|
import { eventBus, emitMessage } from "#blokkli/helpers/eventBus";
|
|
13
13
|
import { nextTick } from "#imports";
|
|
14
|
-
import { addElementClasses } from "
|
|
14
|
+
import { addElementClasses } from "../composables/addElementClasses.js";
|
|
15
15
|
import { BUNDLE_FROM_LIBRARY } from "#blokkli/constants";
|
|
16
16
|
const HOST_OPTION_KEY = "HOST";
|
|
17
17
|
function mapPublishOptions(context) {
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { type ComputedRef, type WritableComputedRef } from '#imports';
|
|
2
|
+
import type { AdapterContext, BlokkliAdapter } from '#blokkli/adapter';
|
|
3
|
+
export type StorageProvider = {
|
|
4
|
+
/**
|
|
5
|
+
* Create a reactive storage value synced to localStorage.
|
|
6
|
+
*
|
|
7
|
+
* The value is automatically persisted to localStorage on change.
|
|
8
|
+
* Can optionally be synced to user settings on the server.
|
|
9
|
+
*
|
|
10
|
+
* @param key - Storage key (will be prefixed with 'blokkli:')
|
|
11
|
+
* @param defaultValue - Default value if no stored value exists
|
|
12
|
+
* @param persist - Whether to sync to server user settings (default: false)
|
|
13
|
+
* @returns Reactive writable computed ref synced to storage
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* const showGrid = storage.use('showGrid', false)
|
|
18
|
+
* showGrid.value = true // Automatically saved to localStorage
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
use: <T>(key: string | ComputedRef<string>, defaultValue: T, persist?: boolean) => WritableComputedRef<T>;
|
|
22
|
+
/**
|
|
23
|
+
* Create a reactive storage value with entity context prefix.
|
|
24
|
+
*
|
|
25
|
+
* Same as `use()` but automatically prefixes the key with entity type and UUID.
|
|
26
|
+
* Useful for entity-specific settings (e.g., sidebar state per page).
|
|
27
|
+
*
|
|
28
|
+
* @param key - Storage key (will be prefixed with context)
|
|
29
|
+
* @param defaultValue - Default value if no stored value exists
|
|
30
|
+
* @param persist - Whether to sync to server user settings (default: false)
|
|
31
|
+
* @returns Reactive writable computed ref synced to storage
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```ts
|
|
35
|
+
* // If context is node:abc123, key becomes 'sidebarOpen:node:abc123'
|
|
36
|
+
* const sidebarOpen = storage.useWithContextPrefix('sidebarOpen', false)
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
useWithContextPrefix: <T>(key: string, defaultValue: T, persist?: boolean) => WritableComputedRef<T>;
|
|
40
|
+
/**
|
|
41
|
+
* Clear all blokkli storage values.
|
|
42
|
+
*
|
|
43
|
+
* Removes all localStorage entries starting with 'blokkli:' prefix.
|
|
44
|
+
* Does not affect server user settings.
|
|
45
|
+
*/
|
|
46
|
+
clearAll: () => void;
|
|
47
|
+
/**
|
|
48
|
+
* Clear a specific storage value.
|
|
49
|
+
*
|
|
50
|
+
* Removes the value from localStorage (without prefix).
|
|
51
|
+
*
|
|
52
|
+
* @param key - The storage key to clear (without 'blokkli:' prefix)
|
|
53
|
+
*/
|
|
54
|
+
clear: (key: string) => void;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Create a reactive variable that is synced to local storage using the
|
|
58
|
+
* given key. The sync only happens client side and after the component
|
|
59
|
+
* has been mounted.
|
|
60
|
+
*
|
|
61
|
+
* This composable can be used to keep state across page navigations and
|
|
62
|
+
* even after a refresh.
|
|
63
|
+
*/
|
|
64
|
+
export default function (adapter: BlokkliAdapter<any>, context: ComputedRef<AdapterContext>): Promise<StorageProvider>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { type ComputedRef } from 'vue';
|
|
2
|
-
import type { AdapterContext } from '
|
|
2
|
+
import type { AdapterContext } from '../../adapter/index.js';
|
|
3
3
|
export type TextProvider = (key: string, defaultValue?: string) => string;
|
|
4
4
|
export default function (context?: ComputedRef<AdapterContext>): TextProvider;
|