@myissue/vue-website-page-builder 3.3.55 → 3.3.57

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.55",
3
+ "version": "3.3.57",
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",
@@ -9,6 +9,12 @@ const pageBuilderService = getPageBuilder()
9
9
  // Use shared store instance
10
10
  const pageBuilderStateStore = sharedPageBuilderStore
11
11
 
12
+ defineProps({
13
+ globalPageLayout: {
14
+ Type: Boolean,
15
+ },
16
+ })
17
+
12
18
  const backgroundColor = ref(null)
13
19
  const getBackgroundColor = computed(() => {
14
20
  return pageBuilderStateStore.getBackgroundColor
@@ -27,8 +33,23 @@ watch(
27
33
  <template>
28
34
  <Listbox as="div" v-model="backgroundColor">
29
35
  <div class="pbx-relative">
30
- <div class="pbx-flex pbx-gap-2 pbx-items-center">
36
+ <div
37
+ :class="[
38
+ globalPageLayout
39
+ ? 'pbx-flex pbx-flex-col pbx-border-solid pbx-border pbx-border-gray-400'
40
+ : 'pbx-flex pbx-gap-2 pbx-items-center',
41
+ ]"
42
+ >
43
+ <ListboxButton
44
+ v-if="globalPageLayout"
45
+ class="pbx-flex pbx-flex-row pbx-justify-between pbx-items-center pbx-pl-3 pbx-pr-3 pbx-py-5 pbx-cursor-pointer pbx-duration-200 hover:pbx-bg-myPrimaryLightGrayColor"
46
+ >
47
+ <p class="pbx-myPrimaryParagraph pbx-font-medium pbx-my-0 pbx-py-0">Background Color</p>
48
+ <span v-if="globalPageLayout" class="material-symbols-outlined"> chevron_right </span>
49
+ </ListboxButton>
50
+
31
51
  <ListboxButton
52
+ v-if="!globalPageLayout"
32
53
  class="pbx-h-10 pbx-w-10 pbx-flex-end 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-gray-100 hover:pbx-fill-white pbx-bg-gray-300 focus-visible:pbx-ring-0"
33
54
  >
34
55
  <div class="pbx-flex pbx-flex-col">
@@ -52,9 +52,7 @@ const handleAddClasses = async () => {
52
52
  <EditorAccordion>
53
53
  <template #title>Generated CSS</template>
54
54
  <template #content>
55
- <p class="pbx-myPrimaryParagraph pbx-font-medium pbx-py-0 pbx-my-4">CSS applied</p>
56
-
57
- <label class="pbx-myPrimaryInputLabel">
55
+ <label class="pbx-myPrimaryInputLabel pbx-my-4">
58
56
  This is the CSS applied by the builder. Add your own CSS and press Enter to apply it to the
59
57
  selected element.
60
58
  </label>
@@ -8,6 +8,13 @@ const pageBuilderService = getPageBuilder()
8
8
 
9
9
  // Use shared store instance
10
10
  const pageBuilderStateStore = sharedPageBuilderStore
11
+
12
+ defineProps({
13
+ globalPageLayout: {
14
+ Type: Boolean,
15
+ },
16
+ })
17
+
11
18
  const textColor = ref(null)
12
19
  const getTextColor = computed(() => {
13
20
  return pageBuilderStateStore.getTextColor
@@ -26,8 +33,23 @@ watch(
26
33
  <template>
27
34
  <Listbox as="div" v-model="textColor">
28
35
  <div class="pbx-relative">
29
- <div class="pbx-flex pbx-gap-2 pbx-items-center">
36
+ <div
37
+ :class="[
38
+ globalPageLayout
39
+ ? 'pbx-flex pbx-flex-col pbx-border-solid pbx-border pbx-border-gray-400'
40
+ : 'pbx-flex pbx-gap-2 pbx-items-center',
41
+ ]"
42
+ >
43
+ <ListboxButton
44
+ v-if="globalPageLayout"
45
+ class="pbx-flex pbx-flex-row pbx-justify-between pbx-items-center pbx-pl-3 pbx-pr-3 pbx-py-5 pbx-cursor-pointer pbx-duration-200 hover:pbx-bg-myPrimaryLightGrayColor"
46
+ >
47
+ <p class="pbx-myPrimaryParagraph pbx-font-medium pbx-my-0 pbx-py-0">Text Color</p>
48
+ <span v-if="globalPageLayout" class="material-symbols-outlined"> chevron_right </span>
49
+ </ListboxButton>
50
+
30
51
  <ListboxButton
52
+ v-if="!globalPageLayout"
31
53
  class="pbx-h-10 pbx-w-10 pbx-flex-end 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-gray-100 hover:pbx-fill-white pbx-bg-gray-300 focus-visible:pbx-ring-0"
32
54
  >
33
55
  <div class="pbx-flex pbx-flex-col">
@@ -9,6 +9,7 @@ import Padding from './Editables/Padding.vue'
9
9
  import Margin from './Editables/Margin.vue'
10
10
  import BorderRadius from './Editables/BorderRadius.vue'
11
11
  import BackgroundColorEditor from './Editables/BackgroundColorEditor.vue'
12
+ import TextColorEditor from './Editables/TextColorEditor.vue'
12
13
  import Borders from './Editables/Borders.vue'
13
14
  import LinkEditor from './Editables/LinkEditor.vue'
14
15
  import TipTap from '../../TipTap/TipTap.vue'
@@ -16,6 +17,10 @@ import EditGetElement from './Editables/EditGetElement.vue'
16
17
  import ElementEditor from './Editables/ElementEditor.vue'
17
18
  import { getPageBuilder } from '../../../composables/builderInstance'
18
19
  import EditorAccordion from '../EditorMenu/EditorAccordion.vue'
20
+ import fullHTMLContent from '../../../utils/builder/html-doc-declaration-with-components'
21
+ import ModalBuilder from '../../../Components/Modals/ModalBuilder.vue'
22
+ import { extractCleanHTMLFromPageBuilder } from '../../../composables/extractCleanHTMLFromPageBuilder'
23
+
19
24
  const pageBuilderService = getPageBuilder()
20
25
  // Use shared store instance
21
26
  const pageBuilderStateStore = sharedPageBuilderStore
@@ -23,7 +28,9 @@ const pageBuilderStateStore = sharedPageBuilderStore
23
28
  // emit
24
29
  const emit = defineEmits(['closeEditor'])
25
30
 
26
- // get current element tag
31
+ const getComponents = computed(() => {
32
+ return pageBuilderStateStore.getComponents
33
+ })
27
34
  const getElement = computed(() => {
28
35
  return pageBuilderStateStore.getElement
29
36
  })
@@ -64,13 +71,47 @@ function onScroll() {
64
71
  }
65
72
  }
66
73
 
67
- // handle download HTML
74
+ // generate HTML
75
+ const generateHTML = function (filename, HTML) {
76
+ const element = document.createElement('a')
77
+ element.setAttribute(
78
+ 'href',
79
+ 'data:text/html;charset=utf-8,' + encodeURIComponent(fullHTMLContent(HTML)),
80
+ )
81
+ element.setAttribute('download', filename)
82
+
83
+ element.style.display = 'none'
84
+ document.body.appendChild(element)
85
+
86
+ element.click()
87
+
88
+ document.body.removeChild(element)
89
+ }
90
+
68
91
  const handleDownloadHTML = function () {
69
- downloadedComponents.value = getComponents.value.map((component) => {
70
- return component.html_code
71
- })
92
+ const pagebuilder = document.getElementById('pagebuilder')
93
+ if (!pagebuilder) {
94
+ return
95
+ }
96
+
97
+ const html = extractCleanHTMLFromPageBuilder(pagebuilder)
98
+
99
+ generateHTML('downloaded_html.html', html)
100
+ }
101
+ const showModalGlobalPageStyles = ref(null)
72
102
 
73
- generateHTML('downloaded_html.html', downloadedComponents.value.join(''))
103
+ const handleUpdatePageStyles = async function () {
104
+ showModalGlobalPageStyles.value = true
105
+
106
+ await pageBuilderService.globalPageStyles()
107
+ }
108
+ const handleCloseGlobalPageStyles = async function () {
109
+ // Remove global highlight if present
110
+ const pagebuilder = document.querySelector('#pagebuilder')
111
+ if (pagebuilder) {
112
+ pagebuilder.removeAttribute('data-global-selected')
113
+ }
114
+ showModalGlobalPageStyles.value = false
74
115
  }
75
116
  </script>
76
117
 
@@ -129,26 +170,89 @@ const handleDownloadHTML = function () {
129
170
  </article>
130
171
  </div>
131
172
 
132
- <article class="pbx-my-1 pbx-bg-white">
173
+ <!-- Global Page Styles -->
174
+ <article
175
+ v-if="Array.isArray(getComponents) && getComponents.length >= 1"
176
+ class="pbx-my-1 pbx-bg-white"
177
+ >
133
178
  <EditorAccordion>
134
- <template #title>Download HTML</template>
179
+ <template #title>Global Page Styles</template>
135
180
  <template #content>
136
- <p class="pbx-myPrimaryParagraph pbx-font-medium pbx-py-0 pbx-my-4">
137
- Download Page as HTML
138
- </p>
181
+ <label class="pbx-myPrimaryInputLabel pbx-my-4">
182
+ Apply styles that affect the entire page. These settings include global font family,
183
+ text color, background color, and other universal styles that apply to all sections.
184
+ </label>
139
185
 
186
+ <div class="pbx-mt-4">
187
+ <button @click="handleUpdatePageStyles" type="button" class="pbx-myPrimaryButton">
188
+ Update Page Styles
189
+ </button>
190
+ </div>
191
+ </template>
192
+ </EditorAccordion>
193
+ </article>
194
+ <!-- Global Page Styles -->
195
+
196
+ <!-- Download Layout HTML -->
197
+ <article
198
+ v-if="Array.isArray(getComponents) && getComponents.length >= 1"
199
+ class="pbx-my-1 pbx-bg-white"
200
+ >
201
+ <EditorAccordion>
202
+ <template #title>Download HTML</template>
203
+ <template #content>
204
+ <label class="pbx-myPrimaryInputLabel pbx-my-4">
205
+ Export the entire page as a standalone HTML file. This includes all sections, content,
206
+ and applied styles, making it ready for use or integration elsewhere.
207
+ </label>
140
208
  <div class="pbx-mt-4">
141
209
  <button @click="handleDownloadHTML" type="button" class="pbx-myPrimaryButton">
142
210
  Download HTML file
143
211
  </button>
144
212
  </div>
145
213
  </template>
146
-
147
- <!-- Download Layout HTML - end -->
148
214
  </EditorAccordion>
215
+ <!-- Download Layout HTML -->
149
216
  </article>
150
-
151
- <article class="pbx-mt-1 pbx-bg-white"></article>
152
217
  </div>
218
+
219
+ <ModalBuilder
220
+ maxWidth="md"
221
+ minHeight="pbx-h-[90vh]"
222
+ :showModalBuilder="showModalGlobalPageStyles"
223
+ title="Global Page Styles"
224
+ @closeMainModalBuilder="handleCloseGlobalPageStyles"
225
+ >
226
+ <div class="pbx-min-h-[90vh] pbx-flex pbx-flex-col pbx-gap-2 pbx-pt-4 pbx-pb-2">
227
+ <p class="pbx-myPrimaryParagraph">
228
+ Apply styles that affect the entire page. These settings include global font family, text
229
+ color, background color, and other universal styles that apply to all sections.
230
+ </p>
231
+ <article class="pbx-my-1 pbx-bg-gray-100">
232
+ <Typography></Typography>
233
+ </article>
234
+ <article class="pbx-my-1 pbx-bg-gray-100">
235
+ <TextColorEditor :globalPageLayout="true"></TextColorEditor>
236
+ </article>
237
+ <article class="pbx-my-1 pbx-bg-gray-100">
238
+ <BackgroundColorEditor :globalPageLayout="true"></BackgroundColorEditor>
239
+ </article>
240
+ <article class="pbx-my-1 pbx-bg-gray-100">
241
+ <Padding> </Padding>
242
+ </article>
243
+ <article class="pbx-my-1 pbx-bg-gray-100">
244
+ <Margin> </Margin>
245
+ </article>
246
+ <article class="pbx-my-1 pbx-bg-gray-100">
247
+ <BorderRadius></BorderRadius>
248
+ </article>
249
+ <article class="pbx-my-1 pbx-bg-gray-100">
250
+ <Borders></Borders>
251
+ </article>
252
+ <article class="pbx-my-1 pbx-bg-gray-100">
253
+ <ClassEditor></ClassEditor>
254
+ </article>
255
+ </div>
256
+ </ModalBuilder>
153
257
  </div>
154
258
  </template>
@@ -1,39 +1,16 @@
1
1
  <script setup>
2
2
  import { ref, computed } from 'vue'
3
3
  import { sharedPageBuilderStore } from '../../../stores/shared-store'
4
- import fullHTMLContent from '../../../utils/builder/html-doc-declaration-with-components'
4
+
5
5
  import { isEmptyObject } from '../../../helpers/isEmptyObject.ts'
6
6
  const version = __APP_VERSION__
7
7
 
8
8
  // Use shared store instance
9
9
  const pageBuilderStateStore = sharedPageBuilderStore
10
10
 
11
- const downloadedComponents = ref(null)
12
-
13
11
  const getPageBuilderConfig = computed(() => {
14
12
  return pageBuilderStateStore.getPageBuilderConfig
15
13
  })
16
-
17
- const getComponents = computed(() => {
18
- return pageBuilderStateStore.getComponents
19
- })
20
-
21
- // generate HTML
22
- const generateHTML = function (filename, HTML) {
23
- const element = document.createElement('a')
24
- element.setAttribute(
25
- 'href',
26
- 'data:text/html;charset=utf-8,' + encodeURIComponent(fullHTMLContent(HTML)),
27
- )
28
- element.setAttribute('download', filename)
29
-
30
- element.style.display = 'none'
31
- document.body.appendChild(element)
32
-
33
- element.click()
34
-
35
- document.body.removeChild(element)
36
- }
37
14
  </script>
38
15
 
39
16
  <template>
@@ -9,7 +9,7 @@ import { preloadImage } from '../../../composables/preloadImage'
9
9
  import DynamicModalBuilder from '../../Modals/DynamicModalBuilder.vue'
10
10
 
11
11
  import { getPageBuilder } from '../../../composables/builderInstance'
12
- import { delay } from '@/composables/delay'
12
+ import { delay } from '../../../composables/delay'
13
13
  const pageBuilderService = getPageBuilder()
14
14
 
15
15
  // Use shared store instance
@@ -61,7 +61,7 @@ const configPageBuilder = {
61
61
  image: '/jane_doe.jpg',
62
62
  },
63
63
  updateOrCreate: {
64
- formType: 'update',
64
+ formType: 'create',
65
65
  formName: 'collection',
66
66
  },
67
67
  pageBuilderLogo: {
@@ -79,6 +79,14 @@ const configPageBuilder = {
79
79
  settings: {
80
80
  brandColor: '#DB93B0',
81
81
  },
82
+ // pageSettings: {
83
+ // classes:
84
+ // 'pbx-font-didot pbx-italic pbx-px-20 pbx-rounded-full pbx-rounded-tr-full pbx-border-8 pbx-border-green-800 pbx-border-solid pbx-text-neutral-300 pbx-bg-stone-700',
85
+ // style: {
86
+ // backgroundColor: 'red',
87
+ // border: '6px solid yellow',
88
+ // },
89
+ // },
82
90
  } as const
83
91
 
84
92
  onMounted(async () => {
@@ -232,7 +232,7 @@ const handlerRumeEditingForUpdate = async function () {
232
232
  secondModalButtonResumeEditingFunction.value = function () {}
233
233
 
234
234
  thirdModalButtonResumeEditingFunction.value = async function () {
235
- await pageBuilderService.resumeEditingForUpdate()
235
+ await pageBuilderService.resumeEditingFromDraft()
236
236
  pageBuilderStateStore.setHasLocalDraftForUpdate(false)
237
237
 
238
238
  showModalResumeEditing.value = false
@@ -330,7 +330,7 @@ function updatePanelPosition() {
330
330
  }
331
331
 
332
332
  onMounted(async () => {
333
- await pageBuilderService.tryMountPendingComponents()
333
+ await pageBuilderService.completeBuilderInitialization()
334
334
 
335
335
  updatePanelPosition()
336
336
 
@@ -755,7 +755,7 @@ onMounted(async () => {
755
755
  id="contains-pagebuilder"
756
756
  class="pbx-pl-4 pbx-pr-4 pbx-pb-4 pbx-pt-1 pbx-h-full pbx-overflow-y-auto"
757
757
  >
758
- <div id="pagebuilder" class="pbx-text-black">
758
+ <div id="pagebuilder" class="pbx-text-black pbx-font-sans">
759
759
  <div ref="draggableZone">
760
760
  <!-- Added Components to DOM # start -->
761
761
  <div
@@ -13,14 +13,12 @@ const previewData = localStorage.getItem('preview')
13
13
 
14
14
  if (previewData) {
15
15
  try {
16
- const parsedData = JSON.parse(previewData)
17
- htmlPage.value = Array.isArray(parsedData) ? parsedData.join('') : ''
18
- } catch (error) {
19
- console.error('Error parsing preview data:', error)
16
+ const parsed = JSON.parse(previewData)
17
+ htmlPage.value = Array.isArray(parsed) ? parsed.join('') : ''
18
+ } catch (err) {
19
+ console.error('Invalid preview data:', err)
20
20
  htmlPage.value = ''
21
21
  }
22
- } else {
23
- htmlPage.value = ''
24
22
  }
25
23
  </script>
26
24