@myissue/vue-website-page-builder 3.0.1 → 3.0.12

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.
Files changed (2) hide show
  1. package/README.md +3 -289
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -162,299 +162,15 @@ Customizing the page builder is made simple since all the logic resides in the P
162
162
 
163
163
  ```vue
164
164
  <script setup>
165
- const mediaLibraryStore = useMediaLibraryStore();
166
- const pageBuilderStateStore = usePageBuilderStateStore();
167
- const userStore = useUserStore();
168
- const openPageBuilder = ref(false);
169
-
170
- const pageBuilderPrimaryHandler = ref(null);
171
- const pageBuilderSecondaryHandler = ref(null);
172
- const pageBuilder = new PageBuilder(pageBuilderStateStore, mediaLibraryStore);
173
- const formType = ref('create');
174
-
175
- const getIsLoading = computed(() => {
176
- return userStore.getIsLoading;
177
- });
178
-
179
- const pathPageBuilderStorageCreate = `page-builder-create-post`;
180
-
181
- const resourceId = 1;
182
- const pathPageBuilderStorageUpdate = `page-builder-update-post-id-${resourceId}`;
183
-
184
- const handlePageBuilder = async function () {
185
-
186
- userStore.setIsLoading(true);
187
-
188
- await nextTick();
189
- openPageBuilder.value = true;
190
-
191
- if (formType.value === 'create') {
192
- pageBuilderStateStore.setComponents([]);
193
- pageBuilder.areComponentsStoredInLocalStorage();
194
- }
195
-
196
- // handle click
197
- pageBuilderPrimaryHandler.value = async function () {
198
- userStore.setIsLoading(true);
199
-
200
- if (formType.value === 'update') {
201
- await nextTick();
202
- pageBuilder.saveComponentsLocalStorageUpdate();
203
- }
204
-
205
-
206
- openPageBuilder.value = false;
207
- userStore.setIsLoading(false);
208
- };
209
-
210
- // handle click
211
- pageBuilderSecondaryHandler.value = async function () {
212
- userStore.setIsLoading(true);
213
-
214
- // save to local storage if new resource
215
- if (formType.value === 'create') {
216
- await nextTick();
217
- pageBuilder.saveComponentsLocalStorage();
218
- await nextTick();
219
- }
220
- // save to local storage if update
221
- if (formType.value === 'update') {
222
- await nextTick();
223
- pageBuilder.synchronizeDOMAndComponents();
224
- await nextTick();
225
- }
226
-
227
- openPageBuilder.value = false;
228
- userStore.setIsLoading(false);
229
- };
230
-
231
- userStore.setIsLoading(false);
232
-
233
- // end modal
234
- };
235
- // Builder # End
236
- const handleDraftForUpdate = async function () {
237
- userStore.setIsLoading(true);
238
-
239
- if (formType.value === 'update') {
240
- await nextTick();
241
- pageBuilder.areComponentsStoredInLocalStorageUpdate();
242
- await nextTick();
243
- pageBuilder.setEventListenersForElements();****
244
- userStore.setIsLoading(false);
245
- }
246
- };
247
-
248
- onBeforeMount(() => {
249
- pageBuilderStateStore.setLocalStorageItemName(pathPageBuilderStorageCreate);
250
-
251
- pageBuilderStateStore.setLocalStorageItemNameUpdate(
252
- pathPageBuilderStorageUpdate
253
- );
254
- });
165
+ import { PageBuilder } from '@myissue/vue-website-page-builder'
166
+ import '@myissue/vue-website-page-builder/style.css'
255
167
  </script>
256
168
 
257
169
  <template>
258
- <PageBuilderModal
259
- :show="openPageBuilder"
260
- updateOrCreate="create"
261
- @pageBuilderPrimaryHandler="pageBuilderPrimaryHandler"
262
- @pageBuilderSecondaryHandler="pageBuilderSecondaryHandler"
263
- @handleDraftForUpdate="handleDraftForUpdate"
264
- >
265
- <PageBuilderView></PageBuilderView>
266
- </PageBuilderModal>
267
- </template>
268
- ```
269
-
270
- ### Saving Page Builder drafts to local storage
271
-
272
- Each Page Builder draft is automatically saved to local storage, allowing you to resume your work later. This process differs slightly depending on whether you are creating a new resource like a blog post, job ad, or listing, or updating an existing resource.
273
-
274
- When creating a new resource like a blog post, job ad, or listing, you need to specify a name for the local storage item that will store the draft. This is done as follows:
275
-
276
- ```js
277
- const pathPageBuilderStorageCreate = `page-builder-create-post`
278
-
279
- onBeforeMount(() => {
280
- // Define local storage key name before on mount
281
- pageBuilderStateStore.setLocalStorageItemName(pathPageBuilderStorageCreate)
282
- })
283
- ```
284
-
285
- For updating an existing resource like a blog post, job ad, or listing, you must first obtain the blog post ID and then save a name that includes this ID to local storage. This way, the Page Builder can find the exact resource from local storage later on when the user wants to continue editing the resource with the unique ID:
286
-
287
- ```js
288
- const resourceId = 1
289
- const pathPageBuilderStorageUpdate = `page-builder-update-post-id-${resourceId}`
290
-
291
- onBeforeMount(() => {
292
- // Define local storage key name before on mount
293
- pageBuilderStateStore.setLocalStorageItemNameUpdate(pathPageBuilderStorageUpdate)
294
- })
295
- ```
296
-
297
- In both cases, the pageBuilderStateStore is responsible for handling the local storage name, ensuring that the correct draft is stored and retrieved as needed.
298
-
299
- ### HTML Components
300
-
301
- If Creating new components, please always add the HTML inside section tags.
302
-
303
- ```html
304
- <section>
305
- <div>
306
- <p>New components</p>
307
- </div>
308
- </section>
309
- ```
310
-
311
- HTML components are currently stored in a JSON file named `components.json` in the root directory. HTML components can also be easily stored in the database, resulting in better management. Simply provide the `setLoadComponents` method with the new URL for loading components from the backend.
312
-
313
- ### Unsplash
314
-
315
- Please note that if you want to use Unsplash, simply create an .env file in your root folder and enter your Unsplash API key and value.
316
-
317
- Example: VITE_UNSPLASH_KEY="your-unsplash-api-key-here"
318
-
319
- [Get your unsplash api key here](https://unsplash.com/developers).
320
-
321
- ## Use with Backend
322
-
323
- The Page builder's capabilities become infinite when integrated with a backend.
324
-
325
- If you're familiar with Laravel, the Page Builder is already integrated with the open-source Laravel Free Listing Directory, Blog & Job Board Theme, which is available at:
326
- [demo & repo](https://github.com/qaiswardag/laravel_vue_directory_and_job_board_theme).
327
-
328
- By utilizing a backend Framework, the HTML components, currently stored in a JSON file at `components.json`, can be easily stored in the database, resulting in better management of HTML components.
329
-
330
- ## Get in touch
331
-
332
- If you have any questions or if you're looking for customization, feel free to connect with me on LinkedIn and send me a message.
333
-
334
- - [Email](mailto:qais.wardag@outlook.com)
335
- - [LinkedIn](https://www.linkedin.com/in/qaiswardag)
336
-
337
- ## Contributing
338
-
339
- Thank you for considering contributing to this project!
340
-
341
- # Vue Website Page Builder
342
-
343
- A powerful, flexible Vue 3 page builder component for creating dynamic websites.
344
-
345
- ## Features
346
-
347
- - 🎨 Drag & drop page builder interface
348
- - 🧩 Modular component system
349
- - 📱 Responsive design support
350
- - 🎯 TypeScript support
351
- - 🔧 Customizable components
352
- - 💾 State management with Pinia
353
- - 🎨 TailwindCSS styling
354
-
355
- ## Installation
356
-
357
- ### For Production Use
358
-
359
- ```bash
360
- npm install vue-website-page-builder
361
- ```
362
-
363
- ### For Local Development
364
-
365
- If you want to use this package locally in your Laravel project for development:
366
-
367
- 1. **Clone and build the package:**
368
-
369
- ```bash
370
- git clone <repository-url>
371
- cd vue-website-page-builder
372
- npm install
373
- npm run build:lib
374
- ```
375
-
376
- 2. **Set up in your Laravel project:**
377
-
378
- ```bash
379
- # In your Laravel project's resources/js/package.json
380
- {
381
- "dependencies": {
382
- "vue-website-page-builder": "file:../../../vue-website-page-builder",
383
- "vue": "^3.5.13",
384
- "pinia": "^2.1.7"
385
- }
386
- }
387
- ```
388
-
389
- 3. **Install dependencies:**
390
- ```bash
391
- cd your-laravel-project/resources/js
392
- npm install
393
- ```
394
-
395
- For detailed local development setup, see [LOCAL_DEVELOPMENT.md](./LOCAL_DEVELOPMENT.md).
396
-
397
- ## Usage
398
-
399
- ```vue
400
- <template>
401
- <div>
402
- <PageBuilder />
403
- </div>
170
+ <PageBuilder />
404
171
  </template>
405
-
406
- <script setup>
407
- import { PageBuilder, usePageBuilderStateStore } from 'vue-website-page-builder'
408
- import 'vue-website-page-builder/style.css'
409
-
410
- const pageBuilderStore = usePageBuilderStateStore()
411
- </script>
412
- ```
413
-
414
- ## Available Components
415
-
416
- - `PageBuilder` - Main page builder interface
417
- - `Preview` - Preview component for displaying built pages
418
-
419
- ## Available Stores
420
-
421
- - `usePageBuilderStateStore` - Main state management store
422
-
423
- ## Development
424
-
425
- ### Scripts
426
-
427
- - `npm run dev` - Start development server
428
- - `npm run build:lib` - Build library for distribution
429
- - `npm run build` - Build for production
430
- - `npm run type-check` - Run TypeScript type checking
431
- - `npm run lint` - Run ESLint
432
- - `npm run format` - Format code with Prettier
433
-
434
- ### Local Development Setup
435
-
436
- Use the provided setup script:
437
-
438
- ```bash
439
- ./setup-local-dev.sh
440
172
  ```
441
173
 
442
- Or follow the manual steps in [LOCAL_DEVELOPMENT.md](./LOCAL_DEVELOPMENT.md).
443
-
444
- ## Requirements
445
-
446
- - Vue 3.5+
447
- - Node.js 18+
448
- - TypeScript 5+
449
-
450
- ## Dependencies
451
-
452
- - Vue 3
453
- - Pinia (state management)
454
- - TailwindCSS (styling)
455
- - TipTap (rich text editing)
456
- - Headless UI (accessible components)
457
-
458
174
  ## License
459
175
 
460
176
  [MIT License](./LICENSE)
@@ -466,5 +182,3 @@ Or follow the manual steps in [LOCAL_DEVELOPMENT.md](./LOCAL_DEVELOPMENT.md).
466
182
  3. Make your changes
467
183
  4. Build and test locally
468
184
  5. Submit a pull request
469
-
470
- For local development setup, see [LOCAL_DEVELOPMENT.md](./LOCAL_DEVELOPMENT.md).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myissue/vue-website-page-builder",
3
- "version": "v3.0.1",
3
+ "version": "v3.0.12",
4
4
  "description": "🚧 DEVELOPMENT VERSION - Vue.js page builder component with drag & drop functionality. Not ready for production use.",
5
5
  "type": "module",
6
6
  "main": "./dist/vue-website-page-builder.umd.cjs",