@blokkli/editor 2.0.0-alpha.22 → 2.0.0-alpha.24
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 +150 -226
- package/dist/runtime/blokkliPlugins/ContextMenu/index.vue +1 -1
- package/dist/runtime/blokkliPlugins/Sidebar/Detached/index.vue +20 -14
- package/dist/runtime/blokkliPlugins/Sidebar/Detached/index.vue.d.ts +8 -4
- package/dist/runtime/blokkliPlugins/Sidebar/index.vue +55 -25
- package/dist/runtime/blokkliPlugins/Sidebar/index.vue.d.ts +5 -4
- package/dist/runtime/blokkliPlugins/ToolbarButton/index.vue +9 -2
- package/dist/runtime/blokkliPlugins/ToolbarButton/index.vue.d.ts +2 -0
- package/dist/runtime/blokkliPlugins/TourItem/index.vue +22 -13
- package/dist/runtime/blokkliPlugins/TourItem/index.vue.d.ts +1 -0
- package/dist/runtime/blokkliPlugins/ViewOption/index.vue +3 -1
- package/dist/runtime/blokkliPlugins/index.d.ts +1 -5
- package/dist/runtime/blokkliPlugins/index.js +0 -8
- package/dist/runtime/components/Blocks/FromLibrary/index.vue +0 -5
- package/dist/runtime/components/BlokkliEditable.vue +6 -1
- package/dist/runtime/components/BlokkliField.vue +1 -1
- package/dist/runtime/components/BlokkliProvider.vue +4 -4
- package/dist/runtime/components/BlokkliProvider.vue.d.ts +1 -1
- package/dist/runtime/components/Edit/Actions/ItemDropdown.vue +66 -0
- package/dist/runtime/components/Edit/Actions/ItemDropdown.vue.d.ts +6 -0
- package/dist/runtime/components/Edit/Actions/index.vue +80 -117
- package/dist/runtime/components/Edit/AddListItem/index.vue +8 -29
- package/dist/runtime/components/Edit/AddListItem/index.vue.d.ts +2 -3
- package/dist/runtime/components/Edit/AnimationCanvas/index.vue +23 -68
- 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/BlockProxy/index.vue +2 -8
- package/dist/runtime/components/Edit/BlokkliErrorBoundary.vue +33 -49
- package/dist/runtime/components/Edit/BlokkliErrorBoundary.vue.d.ts +14 -1
- package/dist/runtime/components/Edit/BlokkliRootErrorBoundary.vue +93 -0
- package/dist/runtime/components/Edit/BlokkliRootErrorBoundary.vue.d.ts +12 -0
- package/dist/runtime/components/Edit/Dialog/index.vue +26 -5
- package/dist/runtime/components/Edit/Dialog/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/DraggableList.vue +5 -25
- package/dist/runtime/components/Edit/EditProvider.vue +71 -41
- package/dist/runtime/components/Edit/EditProvider.vue.d.ts +1 -1
- package/dist/runtime/components/Edit/Features/AddList/Actions/Action.vue +52 -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/{Selection/OverlayFallback → AddList/Actions}/index.vue.d.ts +1 -1
- package/dist/runtime/components/Edit/Features/{BlockAddList → AddList/Blocks}/index.vue +36 -108
- package/dist/runtime/components/Edit/Features/{Hover/Overlay → AddList/Blocks}/index.vue.d.ts +7 -2
- package/dist/runtime/components/Edit/Features/AddList/index.vue +76 -110
- package/dist/runtime/components/Edit/Features/Analyze/{Renderer.vue → Main.vue} +4 -8
- package/dist/runtime/components/Edit/Features/Analyze/{Overlay → Renderer}/fragment.glsl +10 -6
- package/dist/runtime/components/Edit/Features/Analyze/{Overlay → Renderer}/index.vue +43 -15
- package/dist/runtime/components/Edit/Features/Analyze/{Overlay → Renderer}/index.vue.d.ts +0 -2
- package/dist/runtime/components/Edit/Features/Analyze/{Overlay → Renderer}/vertex.glsl +11 -9
- package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItemNodesTarget.vue +15 -3
- package/dist/runtime/components/Edit/Features/Analyze/index.vue +7 -3
- package/dist/runtime/components/Edit/Features/Anchors/index.vue +2 -2
- package/dist/runtime/components/Edit/Features/Artboard/Renderer.vue +41 -20
- package/dist/runtime/components/Edit/Features/Artboard/Scrollbar/index.vue +3 -2
- 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 +1 -0
- package/dist/runtime/components/Edit/Features/BlockScheduler/index.vue +2 -2
- package/dist/runtime/components/Edit/Features/Clipboard/List/index.vue +22 -11
- package/dist/runtime/components/Edit/Features/Clipboard/index.vue +70 -29
- 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/Conversions/index.vue +16 -9
- package/dist/runtime/components/Edit/Features/Debug/DebugSection.vue +24 -0
- package/dist/runtime/components/Edit/Features/Debug/DebugSection.vue.d.ts +16 -0
- package/dist/runtime/components/Edit/Features/Debug/Main.vue +80 -0
- package/dist/runtime/components/Edit/Features/Debug/Section/Features.vue +34 -0
- package/dist/runtime/components/Edit/Features/Debug/Section/Icons.vue +15 -0
- package/dist/runtime/components/Edit/Features/Debug/Section/Icons.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Debug/Section/Keyboard.vue +17 -0
- package/dist/runtime/components/Edit/Features/Debug/Section/Keyboard.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Debug/Section/Logging.vue +66 -0
- package/dist/runtime/components/Edit/Features/Debug/Section/Logging.vue.d.ts +6 -0
- package/dist/runtime/components/Edit/Features/Debug/Section/Rendering.vue +96 -0
- package/dist/runtime/components/Edit/Features/Debug/Section/Rendering.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Debug/Section/Selection.vue +25 -0
- package/dist/runtime/components/Edit/Features/Debug/Section/Selection.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Debug/index.vue +2 -2
- 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 +23 -119
- package/dist/runtime/components/Edit/Features/DraggingOverlay/Renderer/fragment.glsl +77 -0
- package/dist/runtime/components/Edit/Features/DraggingOverlay/{DropTargets → Renderer}/index.vue +138 -92
- package/dist/runtime/components/Edit/Features/DraggingOverlay/{DropTargets → Renderer}/vertex.glsl +60 -8
- package/dist/runtime/components/Edit/Features/DraggingOverlay/index.vue +4 -5
- package/dist/runtime/components/Edit/Features/EditForm/index.vue +2 -2
- package/dist/runtime/components/Edit/Features/EditableField/Overlay/index.vue +0 -6
- package/dist/runtime/components/Edit/Features/EditableField/index.vue +8 -4
- package/dist/runtime/components/Edit/Features/Exit/index.vue +12 -9
- package/dist/runtime/components/Edit/Features/Fragments/Dialog/Item/index.vue +1 -5
- package/dist/runtime/components/Edit/Features/Fragments/index.vue +27 -31
- package/dist/runtime/components/Edit/Features/Hover/Renderer/fragment.glsl +141 -0
- package/dist/runtime/components/Edit/Features/Hover/{Overlay → Renderer}/index.vue +225 -38
- package/dist/runtime/components/Edit/Features/Hover/Renderer/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Hover/{Overlay → Renderer}/vertex.glsl +49 -11
- package/dist/runtime/components/Edit/Features/Hover/index.vue +9 -6
- 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 +2 -2
- package/dist/runtime/components/Edit/Features/Library/LibraryDialog/Item/index.vue +1 -5
- package/dist/runtime/components/Edit/Features/Library/ReusableDialog/index.vue +1 -0
- package/dist/runtime/components/Edit/Features/Library/index.vue +50 -36
- package/dist/runtime/components/Edit/Features/MediaLibrary/Library/Item.vue +1 -1
- package/dist/runtime/components/Edit/Features/MediaLibrary/Library/index.vue +26 -13
- package/dist/runtime/components/Edit/Features/MediaLibrary/Library/index.vue.d.ts +0 -1
- package/dist/runtime/components/Edit/Features/MediaLibrary/index.vue +3 -47
- package/dist/runtime/components/Edit/Features/MultiSelect/{Overlay → Renderer}/fragment.glsl +13 -26
- package/dist/runtime/components/Edit/Features/MultiSelect/{Overlay → Renderer}/index.vue +131 -75
- package/dist/runtime/components/Edit/Features/MultiSelect/{Overlay → Renderer}/index.vue.d.ts +0 -1
- package/dist/runtime/components/Edit/Features/MultiSelect/{Overlay → Renderer}/vertex.glsl +27 -2
- package/dist/runtime/components/Edit/Features/MultiSelect/index.vue +25 -12
- package/dist/runtime/components/Edit/Features/Ownership/index.vue +2 -2
- package/dist/runtime/components/Edit/Features/PreviewGrant/index.vue +2 -1
- package/dist/runtime/components/Edit/Features/Publish/Dialog/index.vue +1 -0
- package/dist/runtime/components/Edit/Features/Publish/index.vue +17 -15
- package/dist/runtime/components/Edit/Features/ResponsivePreview/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/Revert/index.vue +24 -18
- package/dist/runtime/components/Edit/Features/Search/Overlay/Results/Content/index.vue +23 -6
- package/dist/runtime/components/Edit/Features/Search/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/Overlay/index.vue +21 -17
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/Overlay/index.vue.d.ts +6 -6
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/Renderer/fragment.glsl +19 -17
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/Renderer/index.vue +242 -131
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/Renderer/vertex.glsl +29 -12
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/index.vue +15 -10
- package/dist/runtime/components/Edit/Features/Selection/{Overlay → Renderer}/fragment.glsl +23 -14
- package/dist/runtime/components/Edit/Features/Selection/{Overlay → Renderer}/index.vue +121 -28
- package/dist/runtime/components/Edit/Features/Selection/{Overlay → Renderer}/index.vue.d.ts +0 -2
- package/dist/runtime/components/Edit/Features/Selection/{Overlay → Renderer}/vertex.glsl +23 -14
- package/dist/runtime/components/Edit/Features/Selection/index.vue +46 -59
- package/dist/runtime/components/Edit/Features/Settings/Dialog/index.vue +1 -0
- package/dist/runtime/components/Edit/Features/Settings/index.vue +25 -17
- package/dist/runtime/components/Edit/Features/TouchActionBar/index.vue +2 -2
- package/dist/runtime/components/Edit/Features/Tour/Overlay/index.vue +1 -1
- 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 +5 -5
- package/dist/runtime/components/Edit/Features/Transform/index.vue +30 -23
- package/dist/runtime/components/Edit/Features/Translations/index.vue +18 -17
- package/dist/runtime/components/Edit/Form/Checkboxes/index.vue +43 -0
- package/dist/runtime/components/Edit/Form/Checkboxes/index.vue.d.ts +20 -0
- package/dist/runtime/components/Edit/FormOverlay/index.vue +13 -4
- 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/Item/index.vue.d.ts +1 -1
- package/dist/runtime/components/Edit/Messages/index.vue +6 -1
- package/dist/runtime/components/Edit/Overlay/index.vue +66 -0
- package/dist/runtime/components/Edit/Overlay/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/PreviewProvider.vue +1 -1
- package/dist/runtime/components/Edit/Sortli/index.vue +5 -8
- package/dist/runtime/components/Edit/Sortli/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/SystemRequirements/index.vue +36 -36
- package/dist/runtime/components/Edit/Toolbar/index.vue +47 -51
- package/dist/runtime/components/Edit/ViewportBlockingRect/index.vue +9 -2
- package/dist/runtime/components/Edit/ViewportBlockingRect/index.vue.d.ts +4 -1
- package/dist/runtime/components/Edit/index.d.ts +7 -5
- package/dist/runtime/components/Edit/index.js +13 -9
- package/dist/runtime/css/output.css +1 -1
- package/dist/runtime/helpers/animationProvider.d.ts +58 -9
- package/dist/runtime/helpers/animationProvider.js +318 -75
- package/dist/runtime/helpers/composables/defineAddAction.d.ts +2 -0
- package/dist/runtime/helpers/composables/defineAddAction.js +10 -0
- package/dist/runtime/helpers/composables/defineItemDropdownAction.d.ts +2 -0
- package/dist/runtime/helpers/composables/defineItemDropdownAction.js +10 -0
- 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 +5 -2
- package/dist/runtime/helpers/composables/defineRenderer.js +3 -2
- package/dist/runtime/helpers/composables/useDialog.d.ts +3 -0
- package/dist/runtime/helpers/composables/useDialog.js +16 -0
- package/dist/runtime/helpers/composables/useGlobalBlokkliObject.d.ts +16 -0
- package/dist/runtime/helpers/composables/useGlobalBlokkliObject.js +36 -0
- package/dist/runtime/helpers/debugProvider.d.ts +13 -3
- package/dist/runtime/helpers/debugProvider.js +80 -12
- package/dist/runtime/helpers/defineElementStyle.d.ts +2 -0
- package/dist/runtime/helpers/defineElementStyle.js +33 -0
- package/dist/runtime/helpers/domProvider.d.ts +1 -0
- package/dist/runtime/helpers/domProvider.js +51 -32
- package/dist/runtime/helpers/dropTargets/index.d.ts +1 -1
- package/dist/runtime/helpers/dropTargets/index.js +18 -4
- package/dist/runtime/helpers/eventBus.d.ts +1 -1
- package/dist/runtime/helpers/index.d.ts +1 -6
- package/dist/runtime/helpers/index.js +0 -81
- package/dist/runtime/helpers/pluginProvider.d.ts +38 -3
- package/dist/runtime/helpers/pluginProvider.js +49 -18
- package/dist/runtime/helpers/providers/blocks.js +10 -0
- package/dist/runtime/helpers/providers/directive.d.ts +4 -1
- package/dist/runtime/helpers/providers/directive.js +9 -2
- package/dist/runtime/helpers/providers/fields.d.ts +9 -1
- package/dist/runtime/helpers/stateProvider.js +1 -0
- package/dist/runtime/helpers/uiProvider.d.ts +13 -12
- package/dist/runtime/helpers/uiProvider.js +117 -81
- package/dist/runtime/helpers/webgl/index.d.ts +2 -3
- package/dist/runtime/helpers/webgl/index.js +9 -14
- package/dist/runtime/icons/click.svg +1 -0
- package/dist/runtime/icons/dock-left.svg +1 -0
- package/dist/runtime/icons/dock-right.svg +1 -0
- package/dist/runtime/icons/dock-window.svg +1 -0
- package/dist/runtime/plugins/blokkliDirectives.js +1 -1
- package/dist/runtime/types/index.d.ts +16 -26
- package/package.json +1 -1
- package/dist/runtime/blokkliPlugins/AddAction/index.vue +0 -96
- package/dist/runtime/blokkliPlugins/AddAction/index.vue.d.ts +0 -26
- package/dist/runtime/blokkliPlugins/DroppableEdit/index.vue +0 -56
- package/dist/runtime/blokkliPlugins/DroppableEdit/index.vue.d.ts +0 -24
- package/dist/runtime/blokkliPlugins/ItemDropdown/index.vue +0 -76
- package/dist/runtime/blokkliPlugins/ItemDropdown/index.vue.d.ts +0 -31
- package/dist/runtime/blokkliPlugins/MenuButton/index.vue +0 -66
- package/dist/runtime/components/Edit/AddListItemIcon/index.vue +0 -19
- package/dist/runtime/components/Edit/Features/BlockAddList/docs.md +0 -15
- package/dist/runtime/components/Edit/Features/Debug/Renderer.vue +0 -240
- package/dist/runtime/components/Edit/Features/DraggingOverlay/DropTargets/fragment.glsl +0 -96
- package/dist/runtime/components/Edit/Features/Hover/Overlay/fragment.glsl +0 -139
- package/dist/runtime/components/Edit/Features/Selection/OverlayFallback/index.vue +0 -42
- /package/dist/runtime/components/Edit/Features/Analyze/{Renderer.vue.d.ts → Main.vue.d.ts} +0 -0
- /package/dist/runtime/components/Edit/Features/Anchors/{Renderer.vue → Overlay/index.vue} +0 -0
- /package/dist/runtime/components/Edit/Features/{BlockAddList → Anchors/Overlay}/index.vue.d.ts +0 -0
- /package/dist/runtime/components/Edit/Features/Debug/{Renderer.vue.d.ts → Main.vue.d.ts} +0 -0
- /package/dist/runtime/components/Edit/Features/{Anchors/Renderer.vue.d.ts → Debug/Section/Features.vue.d.ts} +0 -0
- /package/dist/runtime/components/Edit/Features/DraggingOverlay/{DropTargets → Renderer}/index.vue.d.ts +0 -0
- /package/dist/runtime/components/Edit/Features/Ownership/{Renderer.vue → Banner/index.vue} +0 -0
- /package/dist/runtime/components/Edit/Features/Ownership/{Renderer.vue.d.ts → Banner/index.vue.d.ts} +0 -0
|
@@ -1,33 +1,64 @@
|
|
|
1
|
+
import { ref } from "#imports";
|
|
1
2
|
export default function() {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
+
}
|
|
5
14
|
}
|
|
6
|
-
function
|
|
7
|
-
|
|
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
|
+
}
|
|
8
29
|
}
|
|
9
|
-
function
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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];
|
|
13
44
|
if (!callback) {
|
|
14
45
|
continue;
|
|
15
46
|
}
|
|
16
|
-
const
|
|
17
|
-
if (!
|
|
47
|
+
const callbackResult = callback();
|
|
48
|
+
if (!callbackResult) {
|
|
18
49
|
continue;
|
|
19
50
|
}
|
|
20
|
-
if (Array.isArray(
|
|
21
|
-
|
|
51
|
+
if (Array.isArray(callbackResult)) {
|
|
52
|
+
result.push(...callbackResult);
|
|
22
53
|
} else {
|
|
23
|
-
|
|
54
|
+
result.push(callbackResult);
|
|
24
55
|
}
|
|
25
56
|
}
|
|
26
|
-
return
|
|
57
|
+
return result;
|
|
27
58
|
}
|
|
28
59
|
return {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
60
|
+
add,
|
|
61
|
+
remove,
|
|
62
|
+
get
|
|
32
63
|
};
|
|
33
64
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { itemEntityType } from "#blokkli-build/config";
|
|
2
2
|
import onBlokkliEvent from "../composables/onBlokkliEvent.js";
|
|
3
|
+
import { BUNDLE_BLOKKLI_FRAGMENT } from "#blokkli/constants";
|
|
3
4
|
export default function(state, dom, context) {
|
|
4
5
|
const renderedFieldListItemCache = /* @__PURE__ */ new Map();
|
|
5
6
|
function getParentBlockBundle(field) {
|
|
@@ -26,6 +27,14 @@ export default function(state, dom, context) {
|
|
|
26
27
|
}
|
|
27
28
|
return null;
|
|
28
29
|
}
|
|
30
|
+
function getFragmentData(item) {
|
|
31
|
+
if (item.bundle === BUNDLE_BLOKKLI_FRAGMENT && item.props.name) {
|
|
32
|
+
return {
|
|
33
|
+
name: item.props.name
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
29
38
|
function getBlock(uuid) {
|
|
30
39
|
const cached = renderedFieldListItemCache.get(uuid);
|
|
31
40
|
if (cached) {
|
|
@@ -54,6 +63,7 @@ export default function(state, dom, context) {
|
|
|
54
63
|
isNested: fieldList.entityType === itemEntityType,
|
|
55
64
|
fieldListType: field?.fieldListType ?? "default",
|
|
56
65
|
library: getLibraryData(item),
|
|
66
|
+
fragment: getFragmentData(item),
|
|
57
67
|
parentBlockBundle,
|
|
58
68
|
host: {
|
|
59
69
|
type: fieldList.entityType,
|
|
@@ -6,19 +6,22 @@ type EditableFieldData = EntityContext & {
|
|
|
6
6
|
key: string;
|
|
7
7
|
fieldName: string;
|
|
8
8
|
directiveType: BlokkliDirectiveType;
|
|
9
|
+
isComponent: boolean;
|
|
10
|
+
getValue?: () => string;
|
|
9
11
|
};
|
|
10
12
|
type DroppableFieldElementData = EditableFieldData & {
|
|
11
13
|
element: HTMLElement;
|
|
12
14
|
};
|
|
13
15
|
export type DirectiveProvider = {
|
|
14
16
|
init: () => void;
|
|
15
|
-
registerDirectiveElement: (el: HTMLElement, fieldName: string, entity: EntityContext, type: BlokkliDirectiveType) => void;
|
|
17
|
+
registerDirectiveElement: (el: HTMLElement, fieldName: string, entity: EntityContext, type: BlokkliDirectiveType, isComponent: boolean, getValue?: () => string) => void;
|
|
16
18
|
unregisterDirectiveElement: (el: HTMLElement, fieldName: string, entity: EntityContext, type: BlokkliDirectiveType) => void;
|
|
17
19
|
getVisible: (directiveType: BlokkliDirectiveType) => Rectangle[];
|
|
18
20
|
getEditableAtPoint: (x: number, y: number) => EditableFieldData | undefined;
|
|
19
21
|
getEditablesForBlock: (uuid: string) => EditableFieldData[];
|
|
20
22
|
getDroppableElements: () => DroppableFieldElementData[];
|
|
21
23
|
findEditableElement: (fieldName: string, host: EntityContext) => HTMLElement | undefined;
|
|
24
|
+
findEditable: (fieldName: string, host: EntityContext) => EditableFieldData | undefined;
|
|
22
25
|
isReady: ComputedRef<boolean>;
|
|
23
26
|
};
|
|
24
27
|
export default function (debug: DebugProvider, ui: UiProvider): DirectiveProvider;
|
|
@@ -71,13 +71,15 @@ export default function(debug, ui) {
|
|
|
71
71
|
rootMargin: "400px 0px 400px 0px"
|
|
72
72
|
}
|
|
73
73
|
);
|
|
74
|
-
function registerDirectiveElement(el, fieldName, entity, directiveType) {
|
|
74
|
+
function registerDirectiveElement(el, fieldName, entity, directiveType, isComponent, getValue) {
|
|
75
75
|
const key = getEditableKey(fieldName, entity, directiveType);
|
|
76
76
|
const data = {
|
|
77
77
|
...entity,
|
|
78
78
|
fieldName,
|
|
79
79
|
directiveType,
|
|
80
|
-
key
|
|
80
|
+
key,
|
|
81
|
+
isComponent,
|
|
82
|
+
getValue
|
|
81
83
|
};
|
|
82
84
|
elementMap.set(el, data);
|
|
83
85
|
fieldData.set(key, data);
|
|
@@ -186,6 +188,10 @@ export default function(debug, ui) {
|
|
|
186
188
|
const key = getEditableKey(fieldName, host, "editable");
|
|
187
189
|
return elements.get(key);
|
|
188
190
|
}
|
|
191
|
+
function findEditable(fieldName, host) {
|
|
192
|
+
const key = getEditableKey(fieldName, host, "editable");
|
|
193
|
+
return fieldData.get(key);
|
|
194
|
+
}
|
|
189
195
|
onBlokkliEvent("state:reloaded", handleRefresh);
|
|
190
196
|
onBlokkliEvent("ui:resized", handleRefresh);
|
|
191
197
|
onBlokkliEvent("option:finish-change", handleRefresh);
|
|
@@ -200,6 +206,7 @@ export default function(debug, ui) {
|
|
|
200
206
|
init,
|
|
201
207
|
getVisible,
|
|
202
208
|
getEditableAtPoint,
|
|
209
|
+
findEditable,
|
|
203
210
|
getEditablesForBlock,
|
|
204
211
|
findEditableElement,
|
|
205
212
|
getDroppableElements,
|
|
@@ -3,6 +3,14 @@ import type { DomProvider } from '../domProvider.js';
|
|
|
3
3
|
import type { StateProvider } from '../stateProvider.js';
|
|
4
4
|
import type { BlockDefinitionProvider } from '../typesProvider.js';
|
|
5
5
|
export type FieldsProvider = {
|
|
6
|
-
find: (
|
|
6
|
+
find: (
|
|
7
|
+
/**
|
|
8
|
+
* The host entity UUID.
|
|
9
|
+
*/
|
|
10
|
+
uuid: string,
|
|
11
|
+
/**
|
|
12
|
+
* The name of the field.
|
|
13
|
+
*/
|
|
14
|
+
fieldName: string) => BlokkliFieldElement | undefined;
|
|
7
15
|
};
|
|
8
16
|
export default function (state: StateProvider, dom: DomProvider, types: BlockDefinitionProvider): FieldsProvider;
|
|
@@ -99,6 +99,7 @@ export default async function(adapter, context, $t, providerKey, permissions) {
|
|
|
99
99
|
publishOptions.value.revisionLogMessage = newPublishOptions.revisionLogMessage;
|
|
100
100
|
}
|
|
101
101
|
function setContext(context2, override) {
|
|
102
|
+
eventBus.emit("state:reload:before");
|
|
102
103
|
if (!override) {
|
|
103
104
|
_mappedState = context2 ?? null;
|
|
104
105
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { type Ref, type ComputedRef } from '
|
|
1
|
+
import { type Ref, type ComputedRef } from '#imports';
|
|
2
|
+
import type { ShallowRef } from 'vue';
|
|
2
3
|
import type { StorageProvider } from './storageProvider.js';
|
|
3
|
-
import type {
|
|
4
|
+
import type { Coord, GlobalUiDialog, Rectangle, SidebarRegion, Size } from '#blokkli/types';
|
|
4
5
|
import type { Viewport } from '#blokkli/constants';
|
|
5
|
-
import type { StateProvider } from './stateProvider.js';
|
|
6
6
|
import type { AdapterContext } from '#blokkli/adapter';
|
|
7
7
|
import type { ThemeColorName } from '#blokkli/types/theme';
|
|
8
8
|
import type { ElementProvider } from './providers/element.js';
|
|
@@ -10,17 +10,15 @@ export type UiProvider = {
|
|
|
10
10
|
rootElement: () => HTMLElement;
|
|
11
11
|
artboardElement: () => HTMLElement;
|
|
12
12
|
providerElement: HTMLElement;
|
|
13
|
-
menu: {
|
|
14
|
-
isOpen: Readonly<Ref<boolean>>;
|
|
15
|
-
close: () => void;
|
|
16
|
-
open: () => void;
|
|
17
|
-
};
|
|
18
13
|
isMobile: ComputedRef<boolean>;
|
|
19
14
|
isDesktop: ComputedRef<boolean>;
|
|
20
15
|
isAnimating: Ref<boolean>;
|
|
21
16
|
isAnalyzing: Ref<boolean>;
|
|
22
17
|
isProxyMode: Ref<boolean>;
|
|
23
|
-
hasDialogOpen:
|
|
18
|
+
hasDialogOpen: ComputedRef<boolean>;
|
|
19
|
+
currentDialog: Readonly<Ref<GlobalUiDialog | null>>;
|
|
20
|
+
openDialog: (dialog: GlobalUiDialog) => void;
|
|
21
|
+
closeDialog: (id?: string) => void;
|
|
24
22
|
hasTooltipOpen: ComputedRef<boolean>;
|
|
25
23
|
openTooltip: Ref<string>;
|
|
26
24
|
selectionColor: ComputedRef<ThemeColorName | null>;
|
|
@@ -32,10 +30,8 @@ export type UiProvider = {
|
|
|
32
30
|
transformLabel: ComputedRef<string>;
|
|
33
31
|
useAnimations: ComputedRef<boolean>;
|
|
34
32
|
lowPerformanceMode: ComputedRef<boolean>;
|
|
35
|
-
toolbarHeight: ComputedRef<number>;
|
|
36
33
|
visibleViewport: ComputedRef<Rectangle>;
|
|
37
34
|
visibleViewportPadded: ComputedRef<Rectangle>;
|
|
38
|
-
addListOrientation: ComputedRef<AddListOrientation>;
|
|
39
35
|
setViewportBlockingRectangle: (key: string, rect?: Rectangle) => void;
|
|
40
36
|
viewportBlockingRects: ComputedRef<Rectangle[]>;
|
|
41
37
|
appViewport: ComputedRef<Viewport>;
|
|
@@ -52,5 +48,10 @@ export type UiProvider = {
|
|
|
52
48
|
getViewportRelativeRect: (rect: Rectangle, scale?: number, offset?: Coord) => Rectangle;
|
|
53
49
|
setBannerHeight: (id: string, height: number) => void;
|
|
54
50
|
removeBanner: (id: string) => void;
|
|
51
|
+
setActiveSidebar: (region: SidebarRegion, id: string) => void;
|
|
52
|
+
removeActiveSidebar: (region: SidebarRegion, id: string) => void;
|
|
53
|
+
hasSidebarLeft: ComputedRef<boolean>;
|
|
54
|
+
hasSidebarRight: ComputedRef<boolean>;
|
|
55
|
+
mainLayoutElement: Readonly<ShallowRef<HTMLDivElement | null>>;
|
|
55
56
|
};
|
|
56
|
-
export default function (providerElement: HTMLElement, storage: StorageProvider,
|
|
57
|
+
export default function (providerElement: HTMLElement, storage: StorageProvider, context: ComputedRef<AdapterContext>, element: ElementProvider, mainLayoutElement: Readonly<ShallowRef<HTMLDivElement | null>>, visibleViewportElement: Readonly<ShallowRef<HTMLDivElement | null>>): UiProvider;
|
|
@@ -2,11 +2,14 @@ import {
|
|
|
2
2
|
onMounted,
|
|
3
3
|
onBeforeUnmount,
|
|
4
4
|
ref,
|
|
5
|
-
computed
|
|
6
|
-
|
|
5
|
+
computed,
|
|
6
|
+
watch,
|
|
7
|
+
readonly
|
|
8
|
+
} from "#imports";
|
|
7
9
|
import { eventBus } from "./eventBus.js";
|
|
8
10
|
import { falsy } from "./index.js";
|
|
9
11
|
import { addElementClasses } from "./addElementClasses.js";
|
|
12
|
+
import { defineElementStyle } from "./defineElementStyle.js";
|
|
10
13
|
import { defaultLanguage, forceDefaultLanguage } from "#blokkli-build/config";
|
|
11
14
|
const CLASS_PROXY_MODE = "bk-is-proxy-mode";
|
|
12
15
|
const localeMap = {
|
|
@@ -15,7 +18,7 @@ const localeMap = {
|
|
|
15
18
|
it: "it-CH",
|
|
16
19
|
en: "en-GB"
|
|
17
20
|
};
|
|
18
|
-
export default function(providerElement, storage,
|
|
21
|
+
export default function(providerElement, storage, context, element, mainLayoutElement, visibleViewportElement) {
|
|
19
22
|
let cachedRootElement = null;
|
|
20
23
|
let cachedArtboardElement = null;
|
|
21
24
|
const interfaceLanguage = computed(() => {
|
|
@@ -25,9 +28,14 @@ export default function(providerElement, storage, state, context, element) {
|
|
|
25
28
|
const lang = interfaceLanguage.value;
|
|
26
29
|
return localeMap[lang] || lang;
|
|
27
30
|
});
|
|
31
|
+
const viewportWidth = ref(window.innerWidth);
|
|
32
|
+
const viewportHeight = ref(window.innerHeight);
|
|
33
|
+
const visibleViewportWidth = ref(0);
|
|
34
|
+
const visibleViewportHeight = ref(0);
|
|
35
|
+
const visibleViewportX = ref(0);
|
|
36
|
+
const visibleViewportY = ref(0);
|
|
28
37
|
const isProxyMode = ref(false);
|
|
29
|
-
const
|
|
30
|
-
const hasDialogOpen = ref(false);
|
|
38
|
+
const currentDialog = ref(null);
|
|
31
39
|
const openTooltip = ref("");
|
|
32
40
|
const hasTransformOverlayOpen = ref(false);
|
|
33
41
|
const isAnimating = ref(false);
|
|
@@ -35,6 +43,15 @@ export default function(providerElement, storage, state, context, element) {
|
|
|
35
43
|
const transformLabel = ref("");
|
|
36
44
|
const openContextMenu = ref("");
|
|
37
45
|
const banners = ref({});
|
|
46
|
+
function openDialog(dialog) {
|
|
47
|
+
currentDialog.value = dialog;
|
|
48
|
+
}
|
|
49
|
+
function closeDialog(id) {
|
|
50
|
+
if (!id || currentDialog.value?.id === id) {
|
|
51
|
+
currentDialog.value = null;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
const hasDialogOpen = computed(() => currentDialog.value !== null);
|
|
38
55
|
function setBannerHeight(id, height) {
|
|
39
56
|
banners.value[id] = height;
|
|
40
57
|
}
|
|
@@ -62,17 +79,42 @@ export default function(providerElement, storage, state, context, element) {
|
|
|
62
79
|
y: 0
|
|
63
80
|
});
|
|
64
81
|
const artboardScale = ref(1);
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
82
|
+
const resizeElementMap = /* @__PURE__ */ new WeakMap();
|
|
83
|
+
let visibleViewportResizeTimeout = null;
|
|
84
|
+
function updateVisibleViewport() {
|
|
85
|
+
if (!visibleViewportElement.value) {
|
|
68
86
|
return;
|
|
69
87
|
}
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
88
|
+
const rect = visibleViewportElement.value.getBoundingClientRect();
|
|
89
|
+
visibleViewportWidth.value = rect.width;
|
|
90
|
+
visibleViewportHeight.value = rect.height;
|
|
91
|
+
visibleViewportX.value = rect.x;
|
|
92
|
+
visibleViewportY.value = rect.y;
|
|
93
|
+
}
|
|
94
|
+
const resizeObserver = new ResizeObserver((entries) => {
|
|
95
|
+
for (const entry of entries) {
|
|
96
|
+
const size = entry.contentBoxSize[0];
|
|
97
|
+
if (!size) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
const key = resizeElementMap.get(entry.target);
|
|
101
|
+
if (!key) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
if (key === "artboard") {
|
|
105
|
+
artboardSize.value.width = size.inlineSize;
|
|
106
|
+
artboardSize.value.height = size.blockSize;
|
|
107
|
+
} else if (key === "visible-viewport") {
|
|
108
|
+
visibleViewportWidth.value = size.inlineSize;
|
|
109
|
+
visibleViewportHeight.value = size.blockSize;
|
|
110
|
+
if (visibleViewportResizeTimeout) {
|
|
111
|
+
window.clearTimeout(visibleViewportResizeTimeout);
|
|
112
|
+
}
|
|
113
|
+
visibleViewportResizeTimeout = window.setTimeout(() => {
|
|
114
|
+
updateVisibleViewport();
|
|
115
|
+
}, 50);
|
|
116
|
+
}
|
|
73
117
|
}
|
|
74
|
-
artboardSize.value.width = size.inlineSize;
|
|
75
|
-
artboardSize.value.height = size.blockSize;
|
|
76
118
|
});
|
|
77
119
|
const setViewportBlockingRectangle = (key, rect) => {
|
|
78
120
|
if (!rect) {
|
|
@@ -117,8 +159,6 @@ export default function(providerElement, storage, state, context, element) {
|
|
|
117
159
|
}
|
|
118
160
|
return "desktop";
|
|
119
161
|
});
|
|
120
|
-
const viewportWidth = ref(window.innerWidth);
|
|
121
|
-
const viewportHeight = ref(window.innerHeight);
|
|
122
162
|
const isMobile = computed(() => appViewport.value === "mobile");
|
|
123
163
|
const isDesktop = computed(() => appViewport.value === "desktop");
|
|
124
164
|
let resizeTimeout = null;
|
|
@@ -130,63 +170,42 @@ export default function(providerElement, storage, state, context, element) {
|
|
|
130
170
|
eventBus.emit("ui:resized");
|
|
131
171
|
}, 400);
|
|
132
172
|
};
|
|
133
|
-
const
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
const activeSidebarLeft = storage.use("sidebar:active:left", "");
|
|
140
|
-
const activeSidebarRight = storage.use("sidebar:active:right", "");
|
|
141
|
-
const settingsStorage = storage.use("feature:add-list:settings", {
|
|
142
|
-
orientation: "vertical"
|
|
143
|
-
});
|
|
144
|
-
const addListOrientation = computed(
|
|
145
|
-
() => isMobile.value ? "horizontal" : settingsStorage.value.orientation
|
|
146
|
-
);
|
|
147
|
-
const visibleViewportX = computed(() => {
|
|
148
|
-
let x = 0;
|
|
149
|
-
if (!isMobile.value) {
|
|
150
|
-
if (addListOrientation.value === "vertical" && state.editMode.value === "editing") {
|
|
151
|
-
x += 70;
|
|
173
|
+
const activeSidebarsLeft = ref([]);
|
|
174
|
+
const activeSidebarsRight = ref([]);
|
|
175
|
+
function setActiveSidebar(region, id) {
|
|
176
|
+
if (region === "left") {
|
|
177
|
+
if (activeSidebarsLeft.value.includes(id)) {
|
|
178
|
+
return;
|
|
152
179
|
}
|
|
153
|
-
|
|
154
|
-
|
|
180
|
+
activeSidebarsLeft.value.push(id);
|
|
181
|
+
} else {
|
|
182
|
+
if (activeSidebarsRight.value.includes(id)) {
|
|
183
|
+
return;
|
|
155
184
|
}
|
|
185
|
+
activeSidebarsRight.value.push(id);
|
|
156
186
|
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
if (activeSidebarRight.value) {
|
|
168
|
-
width -= 351;
|
|
187
|
+
}
|
|
188
|
+
function removeActiveSidebar(region, id) {
|
|
189
|
+
if (region === "left") {
|
|
190
|
+
activeSidebarsLeft.value = activeSidebarsLeft.value.filter(
|
|
191
|
+
(v) => v !== id
|
|
192
|
+
);
|
|
193
|
+
} else {
|
|
194
|
+
activeSidebarsRight.value = activeSidebarsRight.value.filter(
|
|
195
|
+
(v) => v !== id
|
|
196
|
+
);
|
|
169
197
|
}
|
|
170
|
-
|
|
198
|
+
}
|
|
199
|
+
const hasSidebarLeft = computed(() => {
|
|
200
|
+
return !!activeSidebarsLeft.value.length;
|
|
171
201
|
});
|
|
172
|
-
const
|
|
173
|
-
|
|
174
|
-
if (addListOrientation.value === "horizontal") {
|
|
175
|
-
if (isMobile.value) {
|
|
176
|
-
height -= 50;
|
|
177
|
-
} else {
|
|
178
|
-
height -= 70;
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
const bannerHeights = Object.values(banners.value).filter(Boolean);
|
|
182
|
-
bannerHeights.forEach((bannerHeight) => {
|
|
183
|
-
height -= bannerHeight;
|
|
184
|
-
});
|
|
185
|
-
height -= bannerHeights.length * 10;
|
|
186
|
-
return height;
|
|
202
|
+
const hasSidebarRight = computed(() => {
|
|
203
|
+
return !!activeSidebarsRight.value.length;
|
|
187
204
|
});
|
|
188
205
|
const blockingPaddingX = computed(() => 15);
|
|
189
206
|
const blockingPaddingY = computed(() => 50);
|
|
207
|
+
const viewportPadding = computed(() => 10);
|
|
208
|
+
const scrollbarWidth = computed(() => 16);
|
|
190
209
|
const viewportBlockingRects = computed(() => {
|
|
191
210
|
return Object.values(viewportBlockingRectsMap.value).map((rect) => {
|
|
192
211
|
if (!rect) {
|
|
@@ -209,11 +228,12 @@ export default function(providerElement, storage, state, context, element) {
|
|
|
209
228
|
};
|
|
210
229
|
});
|
|
211
230
|
const visibleViewportPadded = computed(() => {
|
|
231
|
+
const p = viewportPadding.value;
|
|
212
232
|
return {
|
|
213
|
-
x: visibleViewportX.value +
|
|
214
|
-
y: visibleViewportY.value +
|
|
215
|
-
width: visibleViewportWidth.value -
|
|
216
|
-
height: visibleViewportHeight.value -
|
|
233
|
+
x: visibleViewportX.value + p,
|
|
234
|
+
y: visibleViewportY.value + p,
|
|
235
|
+
width: visibleViewportWidth.value - 2 * p,
|
|
236
|
+
height: visibleViewportHeight.value - 2 * p
|
|
217
237
|
};
|
|
218
238
|
});
|
|
219
239
|
const viewport = computed(() => {
|
|
@@ -262,29 +282,42 @@ export default function(providerElement, storage, state, context, element) {
|
|
|
262
282
|
addElementClasses(
|
|
263
283
|
document.documentElement,
|
|
264
284
|
"bk-has-sidebar-left",
|
|
265
|
-
|
|
285
|
+
hasSidebarLeft
|
|
266
286
|
);
|
|
267
287
|
addElementClasses(
|
|
268
288
|
document.documentElement,
|
|
269
289
|
"bk-has-sidebar-right",
|
|
270
|
-
|
|
290
|
+
hasSidebarRight
|
|
271
291
|
);
|
|
272
292
|
addElementClasses(document.documentElement, ["bk-html-root"]);
|
|
273
293
|
addElementClasses(document.body, "bk-body");
|
|
274
294
|
addElementClasses(document.documentElement, CLASS_PROXY_MODE, isProxyMode);
|
|
275
295
|
addElementClasses(document.documentElement, "bk-is-analyzing", isAnalyzing);
|
|
296
|
+
function observeElement(element2, key) {
|
|
297
|
+
resizeElementMap.set(element2, key);
|
|
298
|
+
resizeObserver.observe(element2);
|
|
299
|
+
}
|
|
300
|
+
watch(
|
|
301
|
+
visibleViewportElement,
|
|
302
|
+
(el) => {
|
|
303
|
+
if (el) {
|
|
304
|
+
observeElement(el, "visible-viewport");
|
|
305
|
+
}
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
immediate: true
|
|
309
|
+
}
|
|
310
|
+
);
|
|
276
311
|
onMounted(() => {
|
|
277
312
|
viewportWidth.value = window.innerWidth;
|
|
278
313
|
viewportHeight.value = window.innerHeight;
|
|
279
314
|
window.addEventListener("resize", onResize);
|
|
280
315
|
const artboard = artboardElement();
|
|
281
|
-
|
|
316
|
+
observeElement(artboard, "artboard");
|
|
282
317
|
});
|
|
283
318
|
onBeforeUnmount(() => {
|
|
284
319
|
window.removeEventListener("resize", onResize);
|
|
285
320
|
clearTimeout(resizeTimeout);
|
|
286
|
-
const artboard = artboardElement();
|
|
287
|
-
resizeObserver.unobserve(artboard);
|
|
288
321
|
resizeObserver.disconnect();
|
|
289
322
|
});
|
|
290
323
|
const hasTooltipOpen = computed(() => !!openTooltip.value);
|
|
@@ -301,12 +334,9 @@ export default function(providerElement, storage, state, context, element) {
|
|
|
301
334
|
const selectionColor = computed(() => {
|
|
302
335
|
return selectionColors.value[selectionColors.value.length - 1]?.color ?? null;
|
|
303
336
|
});
|
|
337
|
+
defineElementStyle("--bk-viewport-padding", viewportPadding);
|
|
338
|
+
defineElementStyle("--bk-scrollbar-width", scrollbarWidth);
|
|
304
339
|
return {
|
|
305
|
-
menu: {
|
|
306
|
-
isOpen: menuIsOpen,
|
|
307
|
-
close: () => menuIsOpen.value = false,
|
|
308
|
-
open: () => menuIsOpen.value = true
|
|
309
|
-
},
|
|
310
340
|
artboardElement,
|
|
311
341
|
rootElement,
|
|
312
342
|
providerElement,
|
|
@@ -320,8 +350,6 @@ export default function(providerElement, storage, state, context, element) {
|
|
|
320
350
|
useAnimations,
|
|
321
351
|
visibleViewport,
|
|
322
352
|
visibleViewportPadded,
|
|
323
|
-
toolbarHeight,
|
|
324
|
-
addListOrientation,
|
|
325
353
|
setViewportBlockingRectangle,
|
|
326
354
|
viewportBlockingRects,
|
|
327
355
|
appViewport,
|
|
@@ -346,6 +374,14 @@ export default function(providerElement, storage, state, context, element) {
|
|
|
346
374
|
setSelectionColor,
|
|
347
375
|
removeSelectionColor,
|
|
348
376
|
setBannerHeight,
|
|
349
|
-
removeBanner
|
|
377
|
+
removeBanner,
|
|
378
|
+
setActiveSidebar,
|
|
379
|
+
removeActiveSidebar,
|
|
380
|
+
hasSidebarLeft,
|
|
381
|
+
hasSidebarRight,
|
|
382
|
+
mainLayoutElement,
|
|
383
|
+
openDialog,
|
|
384
|
+
closeDialog,
|
|
385
|
+
currentDialog: readonly(currentDialog)
|
|
350
386
|
};
|
|
351
387
|
}
|
|
@@ -19,7 +19,6 @@ type PendingRect<T> = {
|
|
|
19
19
|
checkOverlap: boolean;
|
|
20
20
|
};
|
|
21
21
|
export declare class RectangleBufferCollector<T extends RectangleBufferRect> {
|
|
22
|
-
gl?: WebGLRenderingContext;
|
|
23
22
|
added: Set<string>;
|
|
24
23
|
rects: Record<string, T>;
|
|
25
24
|
positions: number[];
|
|
@@ -34,13 +33,13 @@ export declare class RectangleBufferCollector<T extends RectangleBufferRect> {
|
|
|
34
33
|
placedRects: PlacedRectangle[];
|
|
35
34
|
deferredMode: boolean;
|
|
36
35
|
pendingRects: PendingRect<T>[];
|
|
37
|
-
constructor(
|
|
36
|
+
constructor(options?: RectangleBufferCollectorOptions);
|
|
38
37
|
reset(): void;
|
|
39
38
|
getIdealPosition(x: number, y: number, width: number, height: number, isEmptyField?: boolean): Rectangle;
|
|
40
39
|
addRectangle(rect: Omit<T, 'index'>, type: number, checkOverlap?: boolean): void;
|
|
41
40
|
processPendingRects(): void;
|
|
42
41
|
getIndex(id: string): number | undefined;
|
|
43
42
|
updateRectangle(): void;
|
|
44
|
-
createBufferInfo(): BufferInfo
|
|
43
|
+
createBufferInfo(gl: WebGLRenderingContext): BufferInfo;
|
|
45
44
|
}
|
|
46
45
|
export {};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { createBufferInfoFromArrays } from "twgl.js";
|
|
2
2
|
import { intersects } from "../index.js";
|
|
3
3
|
export class RectangleBufferCollector {
|
|
4
|
-
gl;
|
|
5
4
|
added = /* @__PURE__ */ new Set();
|
|
6
5
|
rects = {};
|
|
7
6
|
positions = [];
|
|
@@ -16,8 +15,7 @@ export class RectangleBufferCollector {
|
|
|
16
15
|
placedRects = [];
|
|
17
16
|
deferredMode = false;
|
|
18
17
|
pendingRects = [];
|
|
19
|
-
constructor(
|
|
20
|
-
this.gl = gl;
|
|
18
|
+
constructor(options) {
|
|
21
19
|
this.deferredMode = options?.deferredMode || false;
|
|
22
20
|
}
|
|
23
21
|
reset() {
|
|
@@ -279,40 +277,37 @@ export class RectangleBufferCollector {
|
|
|
279
277
|
}
|
|
280
278
|
updateRectangle() {
|
|
281
279
|
}
|
|
282
|
-
createBufferInfo() {
|
|
283
|
-
|
|
284
|
-
return null;
|
|
285
|
-
}
|
|
286
|
-
return createBufferInfoFromArrays(this.gl, {
|
|
280
|
+
createBufferInfo(gl) {
|
|
281
|
+
return createBufferInfoFromArrays(gl, {
|
|
287
282
|
a_position: {
|
|
288
283
|
numComponents: 3,
|
|
289
284
|
data: this.positions,
|
|
290
|
-
type:
|
|
285
|
+
type: gl.FLOAT
|
|
291
286
|
},
|
|
292
287
|
a_rect_id: {
|
|
293
288
|
numComponents: 1,
|
|
294
289
|
data: this.rectId,
|
|
295
|
-
type:
|
|
290
|
+
type: gl.FLOAT
|
|
296
291
|
},
|
|
297
292
|
a_state: {
|
|
298
293
|
numComponents: 1,
|
|
299
294
|
data: this.state,
|
|
300
|
-
type:
|
|
295
|
+
type: gl.FLOAT
|
|
301
296
|
},
|
|
302
297
|
a_rect_type: {
|
|
303
298
|
numComponents: 1,
|
|
304
299
|
data: this.types,
|
|
305
|
-
type:
|
|
300
|
+
type: gl.FLOAT
|
|
306
301
|
},
|
|
307
302
|
a_rect_radius: {
|
|
308
303
|
numComponents: 4,
|
|
309
304
|
data: this.radius,
|
|
310
|
-
type:
|
|
305
|
+
type: gl.FLOAT
|
|
311
306
|
},
|
|
312
307
|
a_quad: {
|
|
313
308
|
numComponents: 4,
|
|
314
309
|
data: this.quad,
|
|
315
|
-
type:
|
|
310
|
+
type: gl.FLOAT
|
|
316
311
|
},
|
|
317
312
|
indices: this.indices
|
|
318
313
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M10.76,8.69A0.76,0.76 0 0,0 10,9.45V20.9C10,21.32 10.34,21.66 10.76,21.66C10.95,21.66 11.11,21.6 11.24,21.5L13.15,19.95L14.81,23.57C14.94,23.84 15.21,24 15.5,24C15.61,24 15.72,24 15.83,23.92L18.59,22.64C18.97,22.46 19.15,22 18.95,21.63L17.28,18L19.69,17.55C19.85,17.5 20,17.43 20.12,17.29C20.39,16.97 20.35,16.5 20,16.21L11.26,8.86L11.25,8.87C11.12,8.76 10.95,8.69 10.76,8.69M15,10V8H20V10H15M13.83,4.76L16.66,1.93L18.07,3.34L15.24,6.17L13.83,4.76M10,0H12V5H10V0M3.93,14.66L6.76,11.83L8.17,13.24L5.34,16.07L3.93,14.66M3.93,3.34L5.34,1.93L8.17,4.76L6.76,6.17L3.93,3.34M7,10H2V8H7V10" /></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 4H4A2 2 0 0 0 2 6V18A2 2 0 0 0 4 20H20A2 2 0 0 0 22 18V6A2 2 0 0 0 20 4M20 18H9V6H20Z" /></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 4H4A2 2 0 0 0 2 6V18A2 2 0 0 0 4 20H20A2 2 0 0 0 22 18V6A2 2 0 0 0 20 4M15 18H4V6H15Z" /></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18 18V20H4A2 2 0 0 1 2 18V8H4V18M22 6V14A2 2 0 0 1 20 16H8A2 2 0 0 1 6 14V6A2 2 0 0 1 8 4H20A2 2 0 0 1 22 6M20 6H8V14H20Z" /></svg>
|