@myissue/vue-website-page-builder 3.4.13 → 3.4.14

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.13",
3
+ "version": "3.4.14",
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",
@@ -4,7 +4,7 @@
4
4
  :class="{ '': expanded }"
5
5
  >
6
6
  <div
7
- 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 pbx-bg-white hover:pbx-bg-myPrimaryLightGrayColor"
7
+ 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 pbx-bg-white hover:pbx-bg-myPrimaryLightGrayColor pbx-select-none"
8
8
  @click="expanded = !expanded"
9
9
  >
10
10
  <p class="pbx-myPrimaryParagraph pbx-font-medium pbx-my-0 pbx-py-0">
@@ -2271,6 +2271,49 @@ export class PageBuilderService {
2271
2271
  return false
2272
2272
  }
2273
2273
 
2274
+ /**
2275
+ * Exports all CSS used in the builder as a string.
2276
+ * - Includes all inline styles and a list of all classes used.
2277
+ * - If you use Tailwind, classes are your main "CSS".
2278
+ * - If you have custom CSS, you can also include it here.
2279
+ */
2280
+ public exportCssFromPageBuilder(): string {
2281
+ const pagebuilder = document.querySelector('#pagebuilder')
2282
+ if (!pagebuilder) return ''
2283
+
2284
+ // Collect all inline styles
2285
+ const inlineStyles: string[] = []
2286
+ pagebuilder.querySelectorAll('[style]').forEach((el) => {
2287
+ const selector = el.id
2288
+ ? `#${el.id}`
2289
+ : el.className
2290
+ ? `.${Array.from(el.classList).join('.')}`
2291
+ : el.tagName.toLowerCase()
2292
+ inlineStyles.push(`${selector} { ${el.getAttribute('style')} }`)
2293
+ })
2294
+
2295
+ // Collect all classes used
2296
+ const classSet = new Set<string>()
2297
+ pagebuilder.querySelectorAll('[class]').forEach((el) => {
2298
+ el.className
2299
+ .split(/\s+/)
2300
+ .filter(Boolean)
2301
+ .forEach((cls) => classSet.add(cls))
2302
+ })
2303
+
2304
+ // Optionally, output as a CSS comment block
2305
+ const classesComment =
2306
+ '/* Classes used in this page (for Tailwind or custom CSS):\n' +
2307
+ Array.from(classSet)
2308
+ .sort()
2309
+ .map((cls) => `.${cls}`)
2310
+ .join('\n') +
2311
+ '\n*/'
2312
+
2313
+ // Combine everything
2314
+ return [classesComment, ...inlineStyles].join('\n\n')
2315
+ }
2316
+
2274
2317
  /**
2275
2318
  * Applies a selected image to the current element.
2276
2319
  * @param {ImageObject} image - The image object to apply.