@myissue/vue-website-page-builder 3.4.9 → 3.4.11

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.4.9",
3
+ "version": "3.4.11",
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",
@@ -210,8 +210,14 @@ const handleModalIframeSrc = function () {
210
210
  <div class="pbx-myInputGroup">
211
211
  <div class="pbx-myPrimaryFormOrganizationHeaderDescriptionSection">
212
212
  <div class="pbx-myPrimaryFormOrganizationHeader">
213
- <label for="video" class="pbx-myPrimaryInputLabel">Video url:</label>
214
- <input v-model="iframeSrc" type="text" class="pbx-myPrimaryInput" name="video" />
213
+ <label for="youtube-video" class="pbx-myPrimaryInputLabel">Video url:</label>
214
+ <input
215
+ id="youtube-video"
216
+ v-model="iframeSrc"
217
+ type="text"
218
+ class="pbx-myPrimaryInput"
219
+ name="video"
220
+ />
215
221
  <div
216
222
  v-if="urlError"
217
223
  class="pbx-min-h-[2.5rem] pbx-flex pbx-items-center pbx-justify-start"
package/src/css/style.css CHANGED
@@ -440,10 +440,6 @@
440
440
  width: 100%;
441
441
  cursor: pointer;
442
442
  }
443
- #page-builder-editor strong,
444
- #pagebuilder strong {
445
- font-weight: 500;
446
- }
447
443
 
448
444
  .pbx-reorder-highlight {
449
445
  animation: pbx-reorder-flash 0.4s ease-in-out;
@@ -476,6 +472,7 @@
476
472
  border-radius: 0.5rem;
477
473
  cursor: pointer;
478
474
  line-height: 1.5;
475
+ font-weight: normal;
479
476
  }
480
477
 
481
478
  .pbx-myPrimarySelect {
@@ -519,18 +516,9 @@
519
516
  #page-builder-editor ul,
520
517
  #pagebuilder ul {
521
518
  list-style: disc !important;
522
- padding: 1rem 0 0 1rem;
519
+ padding: 1rem 0 0 1.4rem;
523
520
  margin-left: 1em;
524
- line-height: 1.2;
525
- }
526
-
527
- #page-builder-editor ol,
528
- #page-builder-editor-editable-area ol,
529
- #page-builder-editor ul,
530
- #page-builder-editor-editable-area ul {
531
- list-style: disc !important;
532
- padding: 1rem 0 0 1rem;
533
- line-height: 1.2;
521
+ line-height: 2rem;
534
522
  }
535
523
 
536
524
  .pbx-headless-dropdown {
@@ -592,9 +580,15 @@
592
580
  color: inherit;
593
581
  text-decoration: none;
594
582
  }
583
+
584
+ #page-builder-editor strong,
585
+ #pagebuilder strong {
586
+ font: inherit;
587
+ font-weight: 500;
588
+ }
589
+
595
590
  #pagebuilder code,
596
591
  #pagebuilder pre,
597
- #pagebuilder strong,
598
592
  #pagebuilder em {
599
593
  font: inherit;
600
594
  font-weight: inherit;
@@ -2444,6 +2444,17 @@ export class PageBuilderService {
2444
2444
  this.addHyperlinkToElement(hyperlinkEnable, urlInput || null, openHyperlinkInNewTab || false)
2445
2445
  }
2446
2446
 
2447
+ public async addTheme(components: string): Promise<void> {
2448
+ try {
2449
+ if (components) {
2450
+ await this.mountComponentsToDOM(components)
2451
+ }
2452
+ await this.handleAutoSave()
2453
+ } catch (error) {
2454
+ console.error('Error adding component:', error)
2455
+ }
2456
+ }
2457
+
2447
2458
  /**
2448
2459
  * Adds a new component to the page builder.
2449
2460
  * @param {ComponentObject} componentObject - The component to add.
@@ -2,11 +2,10 @@
2
2
  import { ref, computed } from 'vue'
3
3
  import componentHelpers from '../../utils/html-elements/componentHelpers'
4
4
  import components from '../../utils/html-elements/component'
5
+ import themes from '../../utils/html-elements/themes'
5
6
  import { usePageBuilderModal } from '../../composables/usePageBuilderModal'
6
- import { generateComponentPreview } from '../../utils/componentPreviews'
7
7
  import type { ComponentObject } from '../../types'
8
8
  import { getPageBuilder } from '../../composables/builderInstance'
9
-
10
9
  import { useTranslations } from '../../composables/useTranslations'
11
10
 
12
11
  const { translate } = useTranslations()
@@ -22,6 +21,9 @@ defineProps({
22
21
 
23
22
  const isLoading = ref(false)
24
23
 
24
+ const selectedThemeSelection = ref('Components')
25
+
26
+ const componentOrThemes = ['Components', 'Themes']
25
27
  const selectedCategory = ref('All')
26
28
 
27
29
  const categories = computed(() => {
@@ -36,9 +38,32 @@ const filteredComponents = computed(() => {
36
38
  return components[0].components.data.filter((comp) => comp.category === selectedCategory.value)
37
39
  })
38
40
 
41
+ const selectedThemeCategory = ref('All')
42
+
43
+ const themeCategories = computed(() => {
44
+ const allCategories = themes[0].themes.data.map((comp) => comp.category)
45
+ return ['All', ...new Set(allCategories)]
46
+ })
47
+
48
+ const filteredThemes = computed(() => {
49
+ if (selectedThemeCategory.value === 'All') {
50
+ return themes[0].themes.data
51
+ }
52
+ return themes[0].themes.data.filter((comp) => comp.category === selectedThemeCategory.value)
53
+ })
54
+
39
55
  // Get modal close function
40
56
  const { closeAddComponentModal } = usePageBuilderModal()
41
57
 
58
+ // Super simple component addition with professional modal closing!
59
+ const handleDropTheme = async function (components: string) {
60
+ isLoading.value = true
61
+
62
+ await pageBuilderService.addTheme(components)
63
+ closeAddComponentModal()
64
+ isLoading.value = false
65
+ }
66
+
42
67
  // Super simple component addition with professional modal closing!
43
68
  const handleDropComponent = async function (componentObject: ComponentObject) {
44
69
  isLoading.value = true
@@ -70,11 +95,6 @@ const convertToComponentObject = function (comp: any): ComponentObject {
70
95
  title: comp.title,
71
96
  }
72
97
  }
73
-
74
- // Get SVG preview for component
75
- const getSvgPreview = (title: string) => {
76
- return generateComponentPreview(title)
77
- }
78
98
  </script>
79
99
 
80
100
  <style scoped>
@@ -111,77 +131,151 @@ const getSvgPreview = (title: string) => {
111
131
  </div>
112
132
  </template>
113
133
  <div v-if="!isLoading">
114
- <!-- Helper Components Section -->
115
- <div class="pbx-mb-8">
116
- <h3 class="pbx-myQuaternaryHeader pbx-mb-4">{{ translate('Helper Components') }}</h3>
117
- <div
118
- class="pbx-px-2 pbx-grid pbx-grid-cols-1 sm:pbx-grid-cols-2 md:pbx-grid-cols-3 lg:pbx-grid-cols-4 pbx-gap-4"
134
+ <div class="pbx-mb-4 pbx-flex pbx-jusitify-left pbx-items-center pbx-gap-2">
135
+ <button
136
+ v-for="category in componentOrThemes"
137
+ :key="category"
138
+ @click="selectedThemeSelection = category"
139
+ class="pbx-mySecondaryButton pbx-text-xs pbx-px-4"
140
+ :class="[
141
+ selectedThemeSelection === category
142
+ ? 'pbx-bg-myPrimaryLinkColor pbx-text-white hover:pbx-bg-myPrimaryLinkColor hover:pbx-text-white'
143
+ : 'hover:pbx-bg-myPrimaryLinkColor hover:pbx-text-white',
144
+ ]"
119
145
  >
146
+ {{ translate(category) }}
147
+ </button>
148
+ </div>
149
+
150
+ <!-- theme is selected start -->
151
+ <template v-if="selectedThemeSelection === 'Themes'">
152
+ <div class="pbx-mb-8">
153
+ <h3 class="pbx-myQuaternaryHeader pbx-mb-4">{{ translate('Themes') }}</h3>
154
+ <div class="pbx-mb-4 pbx-flex pbx-jusitify-left pbx-items-center pbx-gap-2">
155
+ <button
156
+ v-for="category in themeCategories"
157
+ :key="category"
158
+ @click="selectedThemeCategory = category"
159
+ class="pbx-mySecondaryButton pbx-text-xs pbx-px-4"
160
+ :class="[
161
+ selectedThemeCategory === category
162
+ ? 'pbx-bg-myPrimaryLinkColor pbx-text-white hover:pbx-bg-myPrimaryLinkColor hover:pbx-text-white'
163
+ : 'hover:pbx-bg-myPrimaryLinkColor hover:pbx-text-white',
164
+ ]"
165
+ >
166
+ {{ translate(category) }}
167
+ </button>
168
+ </div>
169
+
120
170
  <div
121
- v-for="helper in componentHelpers"
122
- :key="helper.title"
123
- class="pbx-border-solid pbx-border pbx-border-gray-400 pbx-overflow-hidden hover:pbx-border-myPrimaryLinkColor pbx-duration-100 pbx-cursor-pointer pbx-p-4"
124
- @click="handleDropComponent(helper)"
171
+ class="pbx-px-2 pbx-grid pbx-grid-cols-1 sm:pbx-grid-cols-2 md:pbx-grid-cols-3 lg:pbx-grid-cols-4 pbx-gap-4"
125
172
  >
126
173
  <div
127
- class="pbx-max-h-72 pbx-cursor-pointer pbx-object-contain pbx-bg-white pbx-mx-auto"
174
+ v-for="theme in filteredThemes"
175
+ :key="theme.title"
176
+ class="pbx-border-solid pbx-border pbx-border-gray-400 pbx-overflow-hidden hover:pbx-border-myPrimaryLinkColor pbx-duration-100 pbx-cursor-pointer"
177
+ @click="handleDropTheme(theme.html_code)"
128
178
  >
129
- <div v-if="false" class="pbx-mr-2" v-html="helper.icon"></div>
130
- <h4 class="pbx-myPrimaryParagraph pbx-text-base pbx-font-medium">
131
- {{ translate(helper.title) }}
132
- </h4>
133
- </div>
134
- <div class="pbx-myPrimaryParagraph pbx-text-xs pbx-font-normal pbx-pt-2">
135
- {{ translate('Click to add') }} {{ helper.title.toLowerCase() }}
136
- {{ translate('component') }}
179
+ <div
180
+ class="pbx-overflow-hidden pbx-whitespace-pre-line pbx-flex-1 pbx-h-auto pbx-border-0 pbx-border-solid pbx-border-b pbx-border-gray-200 lg:pbx-py-10 pbx-py-8 pbx-px-2"
181
+ >
182
+ <!-- Use SVG preview instead of external images -->
183
+ <div
184
+ class="pbx-max-h-72 pbx-cursor-pointer pbx-bg-white pbx-mx-auto pbx-flex pbx-items-center pbx-justify-center"
185
+ v-html="theme.cover_image"
186
+ ></div>
187
+ </div>
188
+ <div class="pbx-p-3">
189
+ <h4 class="pbx-myPrimaryParagraph pbx-text-sm pbx-font-normal">
190
+ {{ translate(theme.title) }}
191
+ </h4>
192
+ <div class="pbx-myPrimaryParagraph pbx-text-xs pbx-font-normal pbx-pt-2">
193
+ {{ translate('Click to add theme') }}
194
+ </div>
195
+ </div>
137
196
  </div>
138
197
  </div>
139
198
  </div>
140
- </div>
199
+ </template>
200
+ <!-- theme is selected end -->
141
201
 
142
- <!-- Regular Components Section -->
143
- <div class="pbx-px-2" v-if="customMediaComponent">
144
- <h3 class="pbx-myQuaternaryHeader pbx-mb-4">{{ translate('Layout Components') }}</h3>
145
- <div class="pbx-mb-4 pbx-flex pbx-jusitify-left pbx-items-center pbx-gap-2">
146
- <button
147
- v-for="category in categories"
148
- :key="category"
149
- @click="selectedCategory = category"
150
- class="pbx-mySecondaryButton pbx-text-xs pbx-px-4"
151
- :class="{ active: selectedCategory === category }"
202
+ <template v-if="selectedThemeSelection === 'Components'">
203
+ <!-- Helper Components Section -->
204
+ <div class="pbx-mb-8">
205
+ <h3 class="pbx-myQuaternaryHeader pbx-mb-4">{{ translate('Helper Components') }}</h3>
206
+ <div
207
+ class="pbx-px-2 pbx-grid pbx-grid-cols-1 sm:pbx-grid-cols-2 md:pbx-grid-cols-3 lg:pbx-grid-cols-4 pbx-gap-4"
152
208
  >
153
- {{ translate(category) }}
154
- </button>
209
+ <div
210
+ v-for="helper in componentHelpers"
211
+ :key="helper.title"
212
+ class="pbx-border-solid pbx-border pbx-border-gray-400 pbx-overflow-hidden hover:pbx-border-myPrimaryLinkColor pbx-duration-100 pbx-cursor-pointer pbx-p-4"
213
+ @click="handleDropComponent(helper)"
214
+ >
215
+ <div
216
+ class="pbx-max-h-72 pbx-cursor-pointer pbx-object-contain pbx-bg-white pbx-mx-auto"
217
+ >
218
+ <div v-if="false" class="pbx-mr-2" v-html="helper.icon"></div>
219
+ <h4 class="pbx-myPrimaryParagraph pbx-text-base pbx-font-medium">
220
+ {{ translate(helper.title) }}
221
+ </h4>
222
+ </div>
223
+ <div class="pbx-myPrimaryParagraph pbx-text-xs pbx-font-normal pbx-pt-2">
224
+ {{ translate('Click to add') }} {{ helper.title.toLowerCase() }}
225
+ {{ translate('component') }}
226
+ </div>
227
+ </div>
228
+ </div>
155
229
  </div>
156
- <div
157
- class="pbx-grid pbx-grid-cols-1 sm:pbx-grid-cols-2 md:pbx-grid-cols-3 pbx-gap-4 pbx-pb-4"
158
- >
230
+
231
+ <!-- Regular Components Section -->
232
+ <div class="pbx-px-2" v-if="customMediaComponent">
233
+ <h3 class="pbx-myQuaternaryHeader pbx-mb-4">{{ translate('Layout Components') }}</h3>
234
+ <div class="pbx-mb-4 pbx-flex pbx-jusitify-left pbx-items-center pbx-gap-2">
235
+ <button
236
+ v-for="category in categories"
237
+ :key="category"
238
+ @click="selectedCategory = category"
239
+ class="pbx-mySecondaryButton pbx-text-xs pbx-px-4"
240
+ :class="[
241
+ selectedCategory === category
242
+ ? 'pbx-bg-myPrimaryLinkColor pbx-text-white hover:pbx-bg-myPrimaryLinkColor hover:pbx-text-white'
243
+ : 'hover:pbx-bg-myPrimaryLinkColor hover:pbx-text-white',
244
+ ]"
245
+ >
246
+ {{ translate(category) }}
247
+ </button>
248
+ </div>
159
249
  <div
160
- v-for="comp in filteredComponents"
161
- :key="comp.title"
162
- class="pbx-border-solid pbx-border pbx-border-gray-400 pbx-overflow-hidden hover:pbx-border-myPrimaryLinkColor pbx-duration-100 pbx-cursor-pointer"
163
- @click="handleDropComponent(convertToComponentObject(comp))"
250
+ class="pbx-grid pbx-grid-cols-1 sm:pbx-grid-cols-2 md:pbx-grid-cols-3 pbx-gap-4 pbx-pb-4"
164
251
  >
165
252
  <div
166
- class="pbx-overflow-hidden pbx-whitespace-pre-line pbx-flex-1 pbx-h-auto pbx-border-0 pbx-border-solid pbx-border-b pbx-border-gray-200 lg:pbx-py-10 pbx-py-8 pbx-px-2"
253
+ v-for="comp in filteredComponents"
254
+ :key="comp.title"
255
+ class="pbx-border-solid pbx-border pbx-border-gray-400 pbx-overflow-hidden hover:pbx-border-myPrimaryLinkColor pbx-duration-100 pbx-cursor-pointer"
256
+ @click="handleDropComponent(convertToComponentObject(comp))"
167
257
  >
168
- <!-- Use SVG preview instead of external images -->
169
258
  <div
170
- class="pbx-max-h-72 pbx-cursor-pointer pbx-bg-white pbx-mx-auto pbx-flex pbx-items-center pbx-justify-center"
171
- v-html="getSvgPreview(comp.title)"
172
- ></div>
173
- </div>
174
- <div class="pbx-p-3">
175
- <h4 class="pbx-myPrimaryParagraph pbx-text-sm pbx-font-normal">
176
- {{ translate(comp.title) }}
177
- </h4>
178
- <div class="pbx-myPrimaryParagraph pbx-text-xs pbx-font-normal pbx-pt-2">
179
- {{ translate('Click to add component') }}
259
+ class="pbx-overflow-hidden pbx-whitespace-pre-line pbx-flex-1 pbx-h-auto pbx-border-0 pbx-border-solid pbx-border-b pbx-border-gray-200 lg:pbx-py-10 pbx-py-8 pbx-px-2"
260
+ >
261
+ <!-- Use SVG preview instead of external images -->
262
+ <div
263
+ class="pbx-max-h-72 pbx-cursor-pointer pbx-bg-white pbx-mx-auto pbx-flex pbx-items-center pbx-justify-center"
264
+ v-html="comp.cover_image"
265
+ ></div>
266
+ </div>
267
+ <div class="pbx-p-3">
268
+ <h4 class="pbx-myPrimaryParagraph pbx-text-sm pbx-font-normal">
269
+ {{ translate(comp.title) }}
270
+ </h4>
271
+ <div class="pbx-myPrimaryParagraph pbx-text-xs pbx-font-normal pbx-pt-2">
272
+ {{ translate('Click to add component') }}
273
+ </div>
180
274
  </div>
181
275
  </div>
182
276
  </div>
183
277
  </div>
184
- </div>
278
+ </template>
185
279
  <div>
186
280
  <button class="pbx-sr-only">Focusable fallback</button>
187
281
  </div>