@myissue/vue-website-page-builder 3.3.96 → 3.3.98

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myissue/vue-website-page-builder",
3
- "version": "3.3.96",
3
+ "version": "3.3.98",
4
4
  "description": "Vue 3 page builder component with drag & drop functionality.",
5
5
  "type": "module",
6
6
  "main": "./dist/vue-website-page-builder.umd.cjs",
@@ -52,12 +52,12 @@
52
52
  "license": "MIT",
53
53
  "repository": {
54
54
  "type": "git",
55
- "url": "https://github.com/qaiswardag/vue-website-page-builder.git"
55
+ "url": "git+ssh://git@github.com/myissue-org/vue-website-page-builder.git"
56
56
  },
57
57
  "bugs": {
58
- "url": "https://github.com/qaiswardag/vue-website-page-builder/issues"
58
+ "url": "https://github.com/myissue-org/vue-website-page-builder/issues"
59
59
  },
60
- "homepage": "https://mybuilder.dev",
60
+ "homepage": "https://www.mybuilder.dev",
61
61
  "engines": {
62
62
  "node": ">=18.0.0",
63
63
  "npm": ">=8.0.0"
@@ -18,7 +18,7 @@ const version = __APP_VERSION__
18
18
  </p>
19
19
  <p class="pbx-myPrimaryParagraph pbx-mt-3">
20
20
  <a
21
- href="https://github.com/qaiswardag/vue-website-page-builder"
21
+ href="https://github.com/myissue-org/vue-website-page-builder"
22
22
  target="_blank"
23
23
  class="pbx-myPrimaryLink pbx-text-myPrimaryDarkGrayColor"
24
24
  >
@@ -1,6 +1,6 @@
1
1
  <script setup>
2
2
  import DynamicModalBuilder from '../../../Modals/DynamicModalBuilder.vue'
3
- import { ref } from 'vue'
3
+ import { ref, computed } from 'vue'
4
4
  import { getPageBuilder } from '../../../../composables/builderInstance'
5
5
  import { useTranslations } from '../../../../composables/useTranslations'
6
6
 
@@ -22,6 +22,9 @@ const firstModalButtonFunctionDynamicModalBuilder = ref(null)
22
22
  const secondModalButtonFunctionDynamicModalBuilder = ref(null)
23
23
  const thirdModalButtonFunctionDynamicModalBuilder = ref(null)
24
24
 
25
+ const canMoveUp = computed(() => pageBuilderService.canMoveUp())
26
+ const canMoveDown = computed(() => pageBuilderService.canMoveDown())
27
+
25
28
  // remove component
26
29
  const handleDelete = function () {
27
30
  showModalDeleteComponent.value = true
@@ -78,14 +81,26 @@ const handleDelete = function () {
78
81
  <button
79
82
  type="button"
80
83
  @click="pageBuilderService.reorderComponent(-1)"
81
- class="pbx-h-10 pbx-w-10 pbx-cursor-pointer pbx-rounded-full pbx-flex pbx-items-center pbx-border-none pbx-justify-center pbx-bg-gray-50 pbx-aspect-square hover:pbx-bg-myPrimaryLinkColor hover:pbx-text-white focus-visible:pbx-ring-0 pbx-text-black hover:pbx-text-white"
84
+ :disabled="!canMoveUp"
85
+ class="pbx-h-10 pbx-w-10 pbx-rounded-full pbx-flex pbx-items-center pbx-border-none pbx-justify-center pbx-bg-gray-50 pbx-aspect-square pbx-text-black"
86
+ :class="[
87
+ canMoveUp
88
+ ? 'hover:pbx-bg-myPrimaryLinkColor hover:pbx-text-white focus-visible:pbx-ring-0'
89
+ : 'pbx-cursor-not-allowed pbx-bg-opacity-20 hover:pbx-bg-gray-200',
90
+ ]"
82
91
  >
83
92
  <span class="material-symbols-outlined"> move_up </span>
84
93
  </button>
85
94
  <button
86
95
  type="button"
87
96
  @click="pageBuilderService.reorderComponent(1)"
88
- class="pbx-h-10 pbx-w-10 pbx-cursor-pointer pbx-rounded-full pbx-flex pbx-items-center pbx-border-none pbx-justify-center pbx-bg-gray-50 pbx-aspect-square hover:pbx-bg-myPrimaryLinkColor hover:pbx-text-white focus-visible:pbx-ring-0 pbx-text-black hover:pbx-text-white"
97
+ :disabled="!canMoveDown"
98
+ class="pbx-h-10 pbx-w-10 pbx-rounded-full pbx-flex pbx-items-center pbx-border-none pbx-justify-center pbx-bg-gray-50 pbx-aspect-square pbx-text-black"
99
+ :class="[
100
+ canMoveDown
101
+ ? 'hover:pbx-bg-myPrimaryLinkColor hover:pbx-text-white focus-visible:pbx-ring-0'
102
+ : 'pbx-cursor-not-allowed pbx-bg-opacity-20 hover:pbx-bg-gray-200',
103
+ ]"
89
104
  >
90
105
  <span class="material-symbols-outlined"> move_down </span>
91
106
  </button>
@@ -1,11 +1,13 @@
1
- <script setup>
2
- import { computed } from 'vue'
1
+ <script setup lang="ts">
2
+ import { computed, ref } from 'vue'
3
3
  import { sharedPageBuilderStore } from '../../../stores/shared-store'
4
4
  import GlobalLoader from '../../../Components/Loaders/GlobalLoader.vue'
5
5
  import { getPageBuilder } from '../../../composables/builderInstance'
6
6
 
7
7
  const pageBuilderService = getPageBuilder()
8
8
 
9
+ const emit = defineEmits(['toolbar-hide-request'])
10
+
9
11
  // Use shared store instance
10
12
  const pageBuilderStateStore = sharedPageBuilderStore
11
13
 
@@ -13,30 +15,69 @@ const getIsLoadingGlobal = computed(() => {
13
15
  return pageBuilderStateStore.getIsLoadingGlobal
14
16
  })
15
17
 
18
+ const historyIndex = computed(() => pageBuilderStateStore.getHistoryIndex)
19
+ const historyLength = computed(() => pageBuilderStateStore.getHistoryLength)
20
+
21
+ const canUndo = computed(() => historyIndex.value > 0)
22
+ const canRedo = computed(() => historyIndex.value < historyLength.value - 1)
23
+
16
24
  const handleUndo = async function () {
17
- await pageBuilderService.undo()
25
+ if (canUndo.value) {
26
+ // Emit event to hide toolbar
27
+ emit('toolbar-hide-request')
28
+ await pageBuilderService.undo()
29
+ await pageBuilderService.clearHtmlSelection()
30
+ }
18
31
  }
32
+
19
33
  const handleRedo = async function () {
20
- await pageBuilderService.redo()
34
+ if (canRedo.value) {
35
+ // Emit event to hide toolbar
36
+ emit('toolbar-hide-request')
37
+ await pageBuilderService.redo()
38
+ await pageBuilderService.clearHtmlSelection()
39
+ }
21
40
  }
22
41
  </script>
23
42
 
24
43
  <template>
25
44
  <GlobalLoader v-if="getIsLoadingGlobal"></GlobalLoader>
26
- <div class="pbx-flex-1 pbx-flex pbx-justify-center pbx-items-center pbx-py-2 pbx-w-full gap-2">
45
+ <div
46
+ @click="
47
+ async () => {
48
+ await pageBuilderService.clearHtmlSelection()
49
+ }
50
+ "
51
+ class="pbx-flex-1 pbx-flex pbx-justify-center pbx-items-center pbx-py-2 pbx-w-full gap-1"
52
+ >
27
53
  <!-- Undo Start -->
28
- <button @click="handleUndo" type="button">
54
+ <button @click="handleUndo" type="button" :disabled="!canUndo">
29
55
  <div
30
- class="pbx-h-10 pbx-w-10 pbx-cursor-pointer pbx-rounded-full pbx-flex pbx-items-center pbx-border-none pbx-justify-center pbx-bg-gray-50 pbx-aspect-square hover:pbx-bg-myPrimaryLinkColor focus-visible:pbx-ring-0 pbx-text-black hover:pbx-text-white"
56
+ class="pbx-h-10 pbx-w-10 pbx-rounded-full pbx-flex pbx-items-center pbx-border-none pbx-justify-center pbx-bg-gray-50 pbx-aspect-square pbx-text-black hover:pbx-text-white"
57
+ :class="[
58
+ canUndo
59
+ ? 'pbx-cursor-pointer hover:pbx-bg-myPrimaryLinkColor focus-visible:pbx-ring-0'
60
+ : 'pbx-cursor-not-allowed pbx-bg-opacity-20 hover:pbx-bg-gray-200',
61
+ ]"
31
62
  >
32
63
  <span class="material-symbols-outlined"> undo </span>
33
64
  </div>
34
65
  </button>
35
66
  <!-- Undo End -->
67
+ <div
68
+ class="pbx-text-xs pbx-text-gray-600 pbx-mx-2 pbx-py-3 pbx-px-2 pbx-border-solid pbx-border pbx-border-gray-200 pbx-rounded-full"
69
+ >
70
+ {{ historyIndex + 1 }}/{{ historyLength }}
71
+ </div>
36
72
  <!-- Redo Start -->
37
- <button @click="handleRedo" type="button">
73
+ <button @click="handleRedo" type="button" :disabled="!canRedo">
38
74
  <div
39
- class="pbx-h-10 pbx-w-10 pbx-cursor-pointer pbx-rounded-full pbx-flex pbx-items-center pbx-border-none pbx-justify-center pbx-bg-gray-50 pbx-aspect-square hover:pbx-bg-myPrimaryLinkColor focus-visible:pbx-ring-0 pbx-text-black hover:pbx-text-white pbx-ml-2"
75
+ class="pbx-h-10 pbx-w-10 pbx-rounded-full pbx-flex pbx-items-center pbx-border-none pbx-justify-center pbx-bg-gray-50 pbx-aspect-square pbx-text-black hover:pbx-text-white"
76
+ :class="[
77
+ canRedo
78
+ ? 'pbx-cursor-pointer hover:pbx-bg-myPrimaryLinkColor focus-visible:pbx-ring-0'
79
+ : 'pbx-cursor-not-allowed pbx-bg-opacity-20 hover:pbx-bg-gray-200',
80
+ ]"
40
81
  >
41
82
  <span class="material-symbols-outlined"> redo </span>
42
83
  </div>
@@ -320,12 +320,18 @@ const ensureBuilderInitialized = function () {
320
320
  }
321
321
  }
322
322
 
323
- const pageBuilderWrapper = ref(null)
324
- let lastToolbarLeft = null
325
- let lastToolbarTop = null
323
+ const pbxBuilderWrapper = ref(null)
324
+
325
+ const hideToolbar = function () {
326
+ const toolbar = document.querySelector('#pbxEditToolbar')
327
+ if (toolbar) {
328
+ toolbar.classList.remove('is-visible')
329
+ toolbar.removeAttribute('style')
330
+ }
331
+ }
326
332
 
327
333
  function updatePanelPosition() {
328
- const container = pageBuilderWrapper.value
334
+ const container = pbxBuilderWrapper.value
329
335
  const editToolbarElement = container && container.querySelector('#pbxEditToolbar')
330
336
 
331
337
  if (!container || !editToolbarElement) return
@@ -356,11 +362,9 @@ function updatePanelPosition() {
356
362
  editToolbarElement.style.left = `${left}px`
357
363
  editToolbarElement.style.top = `${top}px`
358
364
  editToolbarElement.classList.add('is-visible')
359
-
360
- lastToolbarLeft = left
361
- lastToolbarTop = top
362
365
  } else {
363
366
  editToolbarElement.classList.remove('is-visible')
367
+ editToolbarElement.removeAttribute('style') // Ensure all styles are removed
364
368
  }
365
369
  }
366
370
 
@@ -389,7 +393,7 @@ onMounted(async () => {
389
393
  updatePanelPosition()
390
394
 
391
395
  // Set up MutationObserver and event listeners
392
- const container = pageBuilderWrapper.value
396
+ const container = pbxBuilderWrapper.value
393
397
  if (!container) return
394
398
 
395
399
  const observer = new MutationObserver(updatePanelPosition)
@@ -528,7 +532,7 @@ onMounted(async () => {
528
532
  </template>
529
533
  <!-- Logo # end -->
530
534
 
531
- <UndoRedo></UndoRedo>
535
+ <UndoRedo @toolbar-hide-request="hideToolbar"></UndoRedo>
532
536
 
533
537
  <div
534
538
  @click.self="
@@ -858,18 +862,14 @@ onMounted(async () => {
858
862
  <!-- Left Menu End -->
859
863
 
860
864
  <main
861
- ref="pageBuilderWrapper"
865
+ ref="pbxBuilderWrapper"
862
866
  id="page-builder-wrapper"
863
- class="pbx-transition-all pbx-duration-300 pbx-font-sans pbx-p-1 pbx-flex pbx-flex-col pbx-grow pbx-rounded-tr-2xl pbx-rounded-tl-2xl pbx-border-solid pbx-border pbx-border-gray-200 pbx-items-stretch pbx-text-black pbx-h-[100vh] pbx-overflow-y-auto"
867
+ class="pbx-transition-all pbx-duration-300 pbx-font-sans pbx-p-1 pbx-flex pbx-flex-col pbx-grow pbx-rounded-tr-2xl pbx-rounded-tl-2xl pbx-border-solid pbx-border pbx-border-gray-200 pbx-items-stretch pbx-text-black pbx-h-[100vh] pbx-overflow-y-scroll pbx-relative pbx-pt-14"
864
868
  :class="[getMenuRight ? 'pbx-w-full' : 'pbx-w-full']"
865
869
  >
866
870
  <div
867
871
  id="pbxEditToolbar"
868
872
  class="pbx-z-30 lg:pbx-mx-20 pbx-flex pbx-gap-2 pbx-justify-center pbx-items-center pbx-rounded pbx-px-4 pbx-bg-red-200 pbx-h-0"
869
- style="
870
- box-shadow: 0 0 0 10px oklch(86.9% 0.005 56.366);
871
- background: oklch(86.9% 0.005 56.366);
872
- "
873
873
  >
874
874
  <template v-if="getElement">
875
875
  <EditGetElement></EditGetElement>
package/src/css/style.css CHANGED
@@ -395,6 +395,8 @@
395
395
  padding-right: 1rem;
396
396
  padding-left: 1rem;
397
397
  height: 2.2rem;
398
+ box-shadow: 0 0 0 10px oklch(86.9% 0.005 56.366);
399
+ background: oklch(86.9% 0.005 56.366);
398
400
  }
399
401
 
400
402
  /* CSS for content inside page builder # start */
@@ -476,3 +478,25 @@
476
478
  list-style: disc !important;
477
479
  padding: 0rem;
478
480
  }
481
+
482
+ .pbx-reorder-highlight {
483
+ animation: pbx-reorder-flash 0.4s ease-in-out;
484
+ }
485
+
486
+ @keyframes pbx-reorder-flash {
487
+ 0% {
488
+ transform: scale(1);
489
+ opacity: 1;
490
+ }
491
+ 50% {
492
+ transform: scale(0.8);
493
+ opacity: 0.6;
494
+ }
495
+ 100% {
496
+ transform: scale(1);
497
+ opacity: 1;
498
+ }
499
+ }
500
+
501
+ .pbx-sibling-highlight {
502
+ }