@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
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { itemEntityType } from "#blokkli-build/config";
|
|
2
2
|
import onBlokkliEvent from "../composables/onBlokkliEvent.js";
|
|
3
|
+
import { ref } from "#imports";
|
|
4
|
+
import { BUNDLE_BLOKKLI_FRAGMENT } from "#blokkli/constants";
|
|
3
5
|
export default function(state, dom, context) {
|
|
4
6
|
const renderedFieldListItemCache = /* @__PURE__ */ new Map();
|
|
7
|
+
const refreshKey = ref(1);
|
|
5
8
|
function getParentBlockBundle(field) {
|
|
6
9
|
if (field.entityType !== itemEntityType) {
|
|
7
10
|
return null;
|
|
@@ -26,7 +29,18 @@ export default function(state, dom, context) {
|
|
|
26
29
|
}
|
|
27
30
|
return null;
|
|
28
31
|
}
|
|
32
|
+
function getFragmentData(item) {
|
|
33
|
+
if (item.bundle === BUNDLE_BLOKKLI_FRAGMENT && item.props.name) {
|
|
34
|
+
return {
|
|
35
|
+
name: item.props.name
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
29
40
|
function getBlock(uuid) {
|
|
41
|
+
if (refreshKey.value === 0) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
30
44
|
const cached = renderedFieldListItemCache.get(uuid);
|
|
31
45
|
if (cached) {
|
|
32
46
|
return cached;
|
|
@@ -54,6 +68,7 @@ export default function(state, dom, context) {
|
|
|
54
68
|
isNested: fieldList.entityType === itemEntityType,
|
|
55
69
|
fieldListType: field?.fieldListType ?? "default",
|
|
56
70
|
library: getLibraryData(item),
|
|
71
|
+
fragment: getFragmentData(item),
|
|
57
72
|
parentBlockBundle,
|
|
58
73
|
host: {
|
|
59
74
|
type: fieldList.entityType,
|
|
@@ -66,6 +81,9 @@ export default function(state, dom, context) {
|
|
|
66
81
|
return renderedItem;
|
|
67
82
|
}
|
|
68
83
|
function getAllBlocks() {
|
|
84
|
+
if (refreshKey.value === 0) {
|
|
85
|
+
return [];
|
|
86
|
+
}
|
|
69
87
|
const blocks = [];
|
|
70
88
|
const uuids = state.getAllUuids();
|
|
71
89
|
for (let i = 0; i < uuids.length; i++) {
|
|
@@ -83,6 +101,7 @@ export default function(state, dom, context) {
|
|
|
83
101
|
}
|
|
84
102
|
onBlokkliEvent("state:reloaded", () => {
|
|
85
103
|
renderedFieldListItemCache.clear();
|
|
104
|
+
refreshKey.value++;
|
|
86
105
|
});
|
|
87
106
|
return {
|
|
88
107
|
getBlock,
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { Command } from '#blokkli/types';
|
|
2
|
+
type CommandsProviderFunction = () => Command[] | Command | undefined;
|
|
3
|
+
export type CommandsProvider = {
|
|
4
|
+
/**
|
|
5
|
+
* Register a command provider function.
|
|
6
|
+
*
|
|
7
|
+
* The function will be called when commands are requested.
|
|
8
|
+
* It can return a single command, an array of commands, or undefined.
|
|
9
|
+
*
|
|
10
|
+
* @param fn - Function that returns commands
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* commands.add(() => ({
|
|
15
|
+
* id: 'my-command',
|
|
16
|
+
* label: 'My Command',
|
|
17
|
+
* callback: () => console.log('executed'),
|
|
18
|
+
* }))
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
add: (fn: CommandsProviderFunction) => void;
|
|
22
|
+
/**
|
|
23
|
+
* Unregister a command provider function.
|
|
24
|
+
*
|
|
25
|
+
* Removes a previously registered function so it no longer provides commands.
|
|
26
|
+
*
|
|
27
|
+
* @param fn - The function to remove (must be the same reference used in add)
|
|
28
|
+
*/
|
|
29
|
+
remove: (fn: CommandsProviderFunction) => void;
|
|
30
|
+
/**
|
|
31
|
+
* Get all commands from all registered providers.
|
|
32
|
+
*
|
|
33
|
+
* Calls all registered provider functions, flattens the results,
|
|
34
|
+
* and filters out undefined values.
|
|
35
|
+
*
|
|
36
|
+
* @returns Array of all available commands
|
|
37
|
+
*/
|
|
38
|
+
getCommands: () => Command[];
|
|
39
|
+
};
|
|
40
|
+
export default function (): CommandsProvider;
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import type { StorageProvider } from './storage.js';
|
|
2
|
+
import { type ComputedRef } from '#imports';
|
|
3
|
+
export type DebugLogger = {
|
|
4
|
+
/**
|
|
5
|
+
* Log a debug message.
|
|
6
|
+
*
|
|
7
|
+
* The message is always stored in the message history.
|
|
8
|
+
* It's only output to console if debug mode is enabled and this logger is active.
|
|
9
|
+
*
|
|
10
|
+
* @param message - The log message
|
|
11
|
+
* @param v - Additional context values to log
|
|
12
|
+
*/
|
|
13
|
+
log: (message: string, ...v: any) => void;
|
|
14
|
+
/**
|
|
15
|
+
* Log an error message.
|
|
16
|
+
*
|
|
17
|
+
* The message is always stored in the message history.
|
|
18
|
+
* It's only output to console if debug mode is enabled and this logger is active.
|
|
19
|
+
*
|
|
20
|
+
* @param message - The error message
|
|
21
|
+
* @param v - Additional context values to log
|
|
22
|
+
*/
|
|
23
|
+
error: (message: string, ...v: any) => void;
|
|
24
|
+
};
|
|
25
|
+
export type LogMessage = {
|
|
26
|
+
type: 'log' | 'error' | 'event';
|
|
27
|
+
name: string;
|
|
28
|
+
date: string;
|
|
29
|
+
message: string;
|
|
30
|
+
context?: string;
|
|
31
|
+
};
|
|
32
|
+
type RegisteredDebugOverlay = {
|
|
33
|
+
id: string;
|
|
34
|
+
label: string;
|
|
35
|
+
active: boolean;
|
|
36
|
+
};
|
|
37
|
+
export type DebugProvider = {
|
|
38
|
+
/**
|
|
39
|
+
* Whether debug mode is currently enabled.
|
|
40
|
+
*
|
|
41
|
+
* Persisted in storage and controls console output for all loggers.
|
|
42
|
+
*/
|
|
43
|
+
isEnabled: ComputedRef<boolean>;
|
|
44
|
+
/**
|
|
45
|
+
* Toggle debug mode on/off.
|
|
46
|
+
*
|
|
47
|
+
* When disabled, debug messages are still collected but not output to console.
|
|
48
|
+
*/
|
|
49
|
+
toggle: () => void;
|
|
50
|
+
/**
|
|
51
|
+
* Create a named debug logger.
|
|
52
|
+
*
|
|
53
|
+
* Each logger has a unique name that appears in console output and can be
|
|
54
|
+
* individually enabled/disabled. The logger is automatically registered.
|
|
55
|
+
*
|
|
56
|
+
* @param name - Unique name for this logger (e.g., 'DomProvider', 'Animation')
|
|
57
|
+
* @returns Logger instance with log and error methods
|
|
58
|
+
*/
|
|
59
|
+
createLogger: (name: string) => DebugLogger;
|
|
60
|
+
/**
|
|
61
|
+
* Register a debug overlay.
|
|
62
|
+
*
|
|
63
|
+
* Debug overlays are visual debugging tools that can be toggled on/off.
|
|
64
|
+
* Examples include viewport visualization, rect debugging, etc.
|
|
65
|
+
*
|
|
66
|
+
* @param id - Unique identifier for the overlay
|
|
67
|
+
* @param label - Human-readable label for the overlay
|
|
68
|
+
*/
|
|
69
|
+
registerOverlay: (id: string, label: string) => void;
|
|
70
|
+
/**
|
|
71
|
+
* Unregister a debug overlay.
|
|
72
|
+
*
|
|
73
|
+
* Removes an overlay from the available overlays list.
|
|
74
|
+
*
|
|
75
|
+
* @param id - Identifier of the overlay to remove
|
|
76
|
+
*/
|
|
77
|
+
unregisterOverlay: (id: string) => void;
|
|
78
|
+
/**
|
|
79
|
+
* List of all registered debug overlays with their active state.
|
|
80
|
+
*
|
|
81
|
+
* Each overlay includes whether it's currently visible.
|
|
82
|
+
*/
|
|
83
|
+
overlays: ComputedRef<RegisteredDebugOverlay[]>;
|
|
84
|
+
/**
|
|
85
|
+
* Toggle a debug overlay on/off.
|
|
86
|
+
*
|
|
87
|
+
* Active state is persisted in storage.
|
|
88
|
+
*
|
|
89
|
+
* @param id - Identifier of the overlay to toggle
|
|
90
|
+
*/
|
|
91
|
+
toggleOverlay: (id: string) => void;
|
|
92
|
+
/**
|
|
93
|
+
* List of all registered logger names.
|
|
94
|
+
*
|
|
95
|
+
* Includes all loggers created via createLogger().
|
|
96
|
+
*/
|
|
97
|
+
registeredLoggers: ComputedRef<string[]>;
|
|
98
|
+
/**
|
|
99
|
+
* List of currently enabled logger names.
|
|
100
|
+
*
|
|
101
|
+
* When empty, all loggers are active.
|
|
102
|
+
* When non-empty, only listed loggers output to console.
|
|
103
|
+
*/
|
|
104
|
+
enabledLoggers: ComputedRef<string[]>;
|
|
105
|
+
/**
|
|
106
|
+
* Toggle a logger's enabled state.
|
|
107
|
+
*
|
|
108
|
+
* Adds or removes the logger from the enabled list.
|
|
109
|
+
* State is persisted in storage.
|
|
110
|
+
*
|
|
111
|
+
* @param name - Name of the logger to toggle
|
|
112
|
+
*/
|
|
113
|
+
toggleLogger: (name: string) => void;
|
|
114
|
+
/**
|
|
115
|
+
* Get all collected debug messages.
|
|
116
|
+
*
|
|
117
|
+
* Returns messages from all loggers and events, regardless of enabled state.
|
|
118
|
+
* Useful for debugging issues after they occur.
|
|
119
|
+
*
|
|
120
|
+
* @returns Array of all log messages with timestamps
|
|
121
|
+
*/
|
|
122
|
+
getMessages: () => LogMessage[];
|
|
123
|
+
};
|
|
124
|
+
export default function (storage: StorageProvider): DebugProvider;
|
|
125
|
+
export {};
|
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
onMounted,
|
|
5
5
|
ref
|
|
6
6
|
} from "#imports";
|
|
7
|
-
import { eventBus } from "
|
|
8
|
-
import { useGlobalBlokkliObject } from "
|
|
7
|
+
import { eventBus } from "./../eventBus.js";
|
|
8
|
+
import { useGlobalBlokkliObject } from "./../composables/useGlobalBlokkliObject.js";
|
|
9
9
|
export default function(storage) {
|
|
10
10
|
const showDebug = storage.use("showDebug", false);
|
|
11
11
|
const visible = storage.use("visibleDebugOverlays", []);
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { type Ref, type ComputedRef } from '#imports';
|
|
2
|
+
import type { BlockDefinition, FragmentDefinition, ProviderDefinition } from '#blokkli-build/definitions';
|
|
3
|
+
import type { ValidFieldListTypes, BlockBundleWithNested } from '#blokkli-build/generated-types';
|
|
4
|
+
import type { DeepReadonly } from 'vue';
|
|
5
|
+
import type { BlockDefinitionOptionsInput } from '../../types/index.js';
|
|
6
|
+
import { type RuntimeBlockOptionArray } from '#blokkli-build/runtime-options';
|
|
7
|
+
export type DefinitionProvider = {
|
|
8
|
+
/**
|
|
9
|
+
* Get the block definition for a specific context.
|
|
10
|
+
*
|
|
11
|
+
* Checks for context-specific definitions in this order:
|
|
12
|
+
* 1. Field list type specific (e.g., bundle__field:canvas)
|
|
13
|
+
* 2. Parent bundle specific (e.g., bundle__parent:accordion)
|
|
14
|
+
* 3. Default bundle definition
|
|
15
|
+
*
|
|
16
|
+
* @param bundle - The block bundle name
|
|
17
|
+
* @param fieldListType - The field list type context
|
|
18
|
+
* @param parentBundle - Optional parent block bundle for nested blocks
|
|
19
|
+
* @returns The block definition, or undefined if not found
|
|
20
|
+
*/
|
|
21
|
+
getBlockDefinition: (bundle: string, fieldListType: ValidFieldListTypes, parentBundle?: BlockBundleWithNested | null) => BlockDefinition | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Get the default block definition for a bundle.
|
|
24
|
+
*
|
|
25
|
+
* Returns the base definition without considering context (field list type or parent).
|
|
26
|
+
*
|
|
27
|
+
* @param bundle - The block bundle name
|
|
28
|
+
* @returns The default block definition, or undefined if not found
|
|
29
|
+
*/
|
|
30
|
+
getDefaultDefinition: (bundle: string) => BlockDefinition | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Get a fragment definition by name.
|
|
33
|
+
*
|
|
34
|
+
* @param name - The fragment name
|
|
35
|
+
* @returns The fragment definition, or undefined if not found
|
|
36
|
+
*/
|
|
37
|
+
getFragmentDefinition: (name: string) => FragmentDefinition | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Get a provider definition for an entity type and bundle.
|
|
40
|
+
*
|
|
41
|
+
* @param entityType - The entity type (e.g., 'node', 'block_content')
|
|
42
|
+
* @param entityBundle - The entity bundle (e.g., 'article', 'page')
|
|
43
|
+
* @returns The provider definition, or undefined if not found
|
|
44
|
+
*/
|
|
45
|
+
getProviderDefinition: (entityType: string, entityBundle: string) => ProviderDefinition | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Get the icon name for a block bundle.
|
|
48
|
+
*
|
|
49
|
+
* @param bundle - The block bundle name
|
|
50
|
+
* @returns The icon name, or undefined if no icon is defined
|
|
51
|
+
*/
|
|
52
|
+
getBlockIcon: (bundle: string) => string | undefined;
|
|
53
|
+
/**
|
|
54
|
+
* List of all registered fragment definitions.
|
|
55
|
+
*
|
|
56
|
+
* Updates automatically via HMR during development.
|
|
57
|
+
*/
|
|
58
|
+
fragmentDefinitions: ComputedRef<FragmentDefinition[]>;
|
|
59
|
+
/**
|
|
60
|
+
* List of all registered block definitions.
|
|
61
|
+
*
|
|
62
|
+
* Updates automatically via HMR during development.
|
|
63
|
+
*/
|
|
64
|
+
blockDefinitions: ComputedRef<BlockDefinition[]>;
|
|
65
|
+
/**
|
|
66
|
+
* Global options that apply to all blocks.
|
|
67
|
+
*/
|
|
68
|
+
globalOptions: DeepReadonly<Ref<BlockDefinitionOptionsInput>>;
|
|
69
|
+
/**
|
|
70
|
+
* Runtime option values for all blocks.
|
|
71
|
+
*
|
|
72
|
+
* Maps block UUIDs to their option values. Structure:
|
|
73
|
+
* - First level: block UUID
|
|
74
|
+
* - Second level: option key → option value array
|
|
75
|
+
*
|
|
76
|
+
* Updates automatically via HMR during development.
|
|
77
|
+
*/
|
|
78
|
+
runtimeOptions: DeepReadonly<Ref<Record<string, Record<string, RuntimeBlockOptionArray>>>>;
|
|
79
|
+
/**
|
|
80
|
+
* Render key that changes when definitions are updated.
|
|
81
|
+
*
|
|
82
|
+
* Use as a component key to force remounting when definitions change.
|
|
83
|
+
* Automatically increments via HMR during development.
|
|
84
|
+
*/
|
|
85
|
+
renderKey: DeepReadonly<Ref<string>>;
|
|
86
|
+
};
|
|
87
|
+
export default function (): DefinitionProvider;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { BlokkliDirectiveType, EntityContext, Rectangle } from '#blokkli/types';
|
|
2
|
-
import type { UiProvider } from '
|
|
2
|
+
import type { UiProvider } from './ui.js';
|
|
3
3
|
import { type ComputedRef } from '#imports';
|
|
4
|
-
import type { DebugProvider } from '
|
|
4
|
+
import type { DebugProvider } from './debug.js';
|
|
5
5
|
type EditableFieldData = EntityContext & {
|
|
6
6
|
key: string;
|
|
7
7
|
fieldName: string;
|
|
@@ -13,16 +13,102 @@ type DroppableFieldElementData = EditableFieldData & {
|
|
|
13
13
|
element: HTMLElement;
|
|
14
14
|
};
|
|
15
15
|
export type DirectiveProvider = {
|
|
16
|
+
/**
|
|
17
|
+
* Initialize the directive provider.
|
|
18
|
+
*
|
|
19
|
+
* Starts the IntersectionObserver to track directive element visibility and positions.
|
|
20
|
+
*/
|
|
16
21
|
init: () => void;
|
|
22
|
+
/**
|
|
23
|
+
* Register a directive element for tracking.
|
|
24
|
+
*
|
|
25
|
+
* Starts observing the element with IntersectionObserver to track visibility and position.
|
|
26
|
+
* For 'editable' directives on blocks, also indexes by UUID for quick lookup.
|
|
27
|
+
*
|
|
28
|
+
* @param el - The HTML element with the directive
|
|
29
|
+
* @param fieldName - The field name
|
|
30
|
+
* @param entity - The entity context (type, bundle, UUID)
|
|
31
|
+
* @param type - The directive type ('editable' or 'droppable')
|
|
32
|
+
* @param isComponent - Whether this is a component-based field
|
|
33
|
+
* @param getValue - Optional function to get the current field value
|
|
34
|
+
*/
|
|
17
35
|
registerDirectiveElement: (el: HTMLElement, fieldName: string, entity: EntityContext, type: BlokkliDirectiveType, isComponent: boolean, getValue?: () => string) => void;
|
|
36
|
+
/**
|
|
37
|
+
* Unregister a directive element from tracking.
|
|
38
|
+
*
|
|
39
|
+
* Stops observing the element and removes it from all tracking maps.
|
|
40
|
+
*
|
|
41
|
+
* @param el - The HTML element to unregister
|
|
42
|
+
* @param fieldName - The field name
|
|
43
|
+
* @param entity - The entity context
|
|
44
|
+
* @param type - The directive type
|
|
45
|
+
*/
|
|
18
46
|
unregisterDirectiveElement: (el: HTMLElement, fieldName: string, entity: EntityContext, type: BlokkliDirectiveType) => void;
|
|
47
|
+
/**
|
|
48
|
+
* Get rectangles for all visible directives of a specific type.
|
|
49
|
+
*
|
|
50
|
+
* Only includes directives currently in the viewport.
|
|
51
|
+
*
|
|
52
|
+
* @param directiveType - The directive type to filter by
|
|
53
|
+
* @returns Array of rectangles for visible directives
|
|
54
|
+
*/
|
|
19
55
|
getVisible: (directiveType: BlokkliDirectiveType) => Rectangle[];
|
|
56
|
+
/**
|
|
57
|
+
* Find the editable field at a specific screen coordinate.
|
|
58
|
+
*
|
|
59
|
+
* Converts screen coordinates to artboard space and checks if any visible
|
|
60
|
+
* editable field contains the point.
|
|
61
|
+
*
|
|
62
|
+
* @param x - Screen X coordinate
|
|
63
|
+
* @param y - Screen Y coordinate
|
|
64
|
+
* @returns The editable field data at that point, or undefined
|
|
65
|
+
*/
|
|
20
66
|
getEditableAtPoint: (x: number, y: number) => EditableFieldData | undefined;
|
|
67
|
+
/**
|
|
68
|
+
* Get all editable fields for a specific block.
|
|
69
|
+
*
|
|
70
|
+
* Only returns 'editable' type directives on block entities.
|
|
71
|
+
*
|
|
72
|
+
* @param uuid - The block UUID
|
|
73
|
+
* @returns Array of editable fields for the block
|
|
74
|
+
*/
|
|
21
75
|
getEditablesForBlock: (uuid: string) => EditableFieldData[];
|
|
76
|
+
/**
|
|
77
|
+
* Get all droppable field elements.
|
|
78
|
+
*
|
|
79
|
+
* Returns fields with the 'droppable' directive type along with their HTML elements.
|
|
80
|
+
*
|
|
81
|
+
* @returns Array of droppable field data with elements
|
|
82
|
+
*/
|
|
22
83
|
getDroppableElements: () => DroppableFieldElementData[];
|
|
84
|
+
/**
|
|
85
|
+
* Find the HTML element for an editable field.
|
|
86
|
+
*
|
|
87
|
+
* @param fieldName - The field name
|
|
88
|
+
* @param host - The host entity context
|
|
89
|
+
* @returns The field's HTML element, or undefined if not found
|
|
90
|
+
*/
|
|
23
91
|
findEditableElement: (fieldName: string, host: EntityContext) => HTMLElement | undefined;
|
|
92
|
+
/**
|
|
93
|
+
* Find the editable field data.
|
|
94
|
+
*
|
|
95
|
+
* @param fieldName - The field name
|
|
96
|
+
* @param host - The host entity context
|
|
97
|
+
* @returns The editable field data, or undefined if not found
|
|
98
|
+
*/
|
|
24
99
|
findEditable: (fieldName: string, host: EntityContext) => EditableFieldData | undefined;
|
|
100
|
+
/**
|
|
101
|
+
* Whether the directive provider is ready.
|
|
102
|
+
*
|
|
103
|
+
* Ready when IntersectionObserver is initialized and initial measurements are complete.
|
|
104
|
+
*/
|
|
25
105
|
isReady: ComputedRef<boolean>;
|
|
106
|
+
/**
|
|
107
|
+
* Settlement key that increments after directive changes settle.
|
|
108
|
+
*
|
|
109
|
+
* Useful for triggering reactivity after directives are registered/unregistered.
|
|
110
|
+
*/
|
|
111
|
+
settleKey: ComputedRef<number>;
|
|
26
112
|
};
|
|
27
113
|
export default function (debug: DebugProvider, ui: UiProvider): DirectiveProvider;
|
|
28
114
|
export {};
|
|
@@ -14,6 +14,8 @@ export default function(debug, ui) {
|
|
|
14
14
|
const rects = {};
|
|
15
15
|
const visible = /* @__PURE__ */ new Set();
|
|
16
16
|
const editablesByUuid = {};
|
|
17
|
+
let settleTimeout = null;
|
|
18
|
+
const settleKey = ref(0);
|
|
17
19
|
function doInitTimeout() {
|
|
18
20
|
if (initTimeout) {
|
|
19
21
|
window.clearTimeout(initTimeout);
|
|
@@ -24,6 +26,14 @@ export default function(debug, ui) {
|
|
|
24
26
|
}, 500);
|
|
25
27
|
}
|
|
26
28
|
}
|
|
29
|
+
function doSettleTimeout() {
|
|
30
|
+
if (settleTimeout) {
|
|
31
|
+
window.clearTimeout(settleTimeout);
|
|
32
|
+
}
|
|
33
|
+
settleTimeout = window.setTimeout(() => {
|
|
34
|
+
settleKey.value++;
|
|
35
|
+
}, 50);
|
|
36
|
+
}
|
|
27
37
|
function getVisible(directiveType) {
|
|
28
38
|
return [...visible.keys()].map((key) => {
|
|
29
39
|
if (key.startsWith(directiveType)) {
|
|
@@ -91,6 +101,7 @@ export default function(debug, ui) {
|
|
|
91
101
|
}
|
|
92
102
|
logger.log("Registered directive element", data);
|
|
93
103
|
doInitTimeout();
|
|
104
|
+
doSettleTimeout();
|
|
94
105
|
}
|
|
95
106
|
function unregisterDirectiveElement(el, fieldName, entity, directiveType) {
|
|
96
107
|
const key = getEditableKey(fieldName, entity, directiveType);
|
|
@@ -106,6 +117,7 @@ export default function(debug, ui) {
|
|
|
106
117
|
editablesByUuid[entity.uuid][fieldName] = void 0;
|
|
107
118
|
}
|
|
108
119
|
}
|
|
120
|
+
doSettleTimeout();
|
|
109
121
|
}
|
|
110
122
|
function init() {
|
|
111
123
|
intersectionObserver.init();
|
|
@@ -192,7 +204,10 @@ export default function(debug, ui) {
|
|
|
192
204
|
const key = getEditableKey(fieldName, host, "editable");
|
|
193
205
|
return fieldData.get(key);
|
|
194
206
|
}
|
|
195
|
-
onBlokkliEvent("state:reloaded",
|
|
207
|
+
onBlokkliEvent("state:reloaded", () => {
|
|
208
|
+
handleRefresh();
|
|
209
|
+
doSettleTimeout();
|
|
210
|
+
});
|
|
196
211
|
onBlokkliEvent("ui:resized", handleRefresh);
|
|
197
212
|
onBlokkliEvent("option:finish-change", handleRefresh);
|
|
198
213
|
onBeforeUnmount(() => {
|
|
@@ -210,6 +225,7 @@ export default function(debug, ui) {
|
|
|
210
225
|
getEditablesForBlock,
|
|
211
226
|
findEditableElement,
|
|
212
227
|
getDroppableElements,
|
|
213
|
-
isReady: computed(() => !isInitalizing.value)
|
|
228
|
+
isReady: computed(() => !isInitalizing.value),
|
|
229
|
+
settleKey: computed(() => settleKey.value)
|
|
214
230
|
};
|
|
215
231
|
}
|