@versoly/plugins 0.0.1

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/dist/index.js ADDED
@@ -0,0 +1,1061 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var src_exports = {};
22
+ __export(src_exports, {
23
+ defineConfig: () => defineConfig,
24
+ plugins: () => plugins
25
+ });
26
+ module.exports = __toCommonJS(src_exports);
27
+
28
+ // src/config.ts
29
+ var defineConfig = (config) => {
30
+ return config;
31
+ };
32
+
33
+ // src/plugins/headroom.ts
34
+ var headroom = defineConfig({
35
+ name: "Headroom",
36
+ cdnUrls: [
37
+ {
38
+ url: "https://cdnjs.cloudflare.com/ajax/libs/headroom/0.12.0/headroom.min.js",
39
+ inline: false,
40
+ defer: true
41
+ }
42
+ ],
43
+ js: `window.vGetElementsByToggle('headroom').forEach((elem, index) => {
44
+ let options = window.vGetElementOptions(elem);
45
+
46
+ var headroom = new Headroom(elem, {
47
+ classes: {
48
+ pinned: "d-block block",
49
+ unpinned: 'd-none hidden'
50
+ },
51
+ ...options
52
+ });
53
+
54
+ headroom.init();
55
+ });`,
56
+ checks: [{ plugin: "headroom" }],
57
+ components: []
58
+ });
59
+
60
+ // src/plugins/marquee.ts
61
+ var src = "https://d1pnnwteuly8z3.cloudfront.net/libs/versoly-marquee/0.0.2/versoly-marquee.iife.js";
62
+ var marquee = defineConfig({
63
+ name: "Marquee",
64
+ options: {
65
+ name: "Marquee",
66
+ previewInEditor: true,
67
+ isShown: {
68
+ props: {
69
+ "data-toggle": "marquee"
70
+ }
71
+ },
72
+ fields: [
73
+ {
74
+ name: "Loop",
75
+ type: "BooleanPropOption",
76
+ propsName: "data-options.loop",
77
+ defaultValue: true,
78
+ enabledValue: true,
79
+ inHeaderAction: true,
80
+ headerGroup: "Core"
81
+ },
82
+ {
83
+ name: "Duration",
84
+ type: "SliderPropOption",
85
+ propsName: "data-options.duration",
86
+ min: 1,
87
+ max: 20,
88
+ stepSize: 1,
89
+ defaultValue: 5
90
+ },
91
+ {
92
+ name: "Direction",
93
+ type: "IconButtonOption",
94
+ propsName: "data-options.direction",
95
+ options: ["ltr", "rtl", "ttb", "btt"],
96
+ defaultValue: "ltr"
97
+ },
98
+ {
99
+ name: "Pauseable",
100
+ type: "BooleanPropOption",
101
+ propsName: "data-options.pauseable",
102
+ defaultValue: true
103
+ },
104
+ {
105
+ name: "Iterations",
106
+ type: "SliderPropOption",
107
+ propsName: "data-options.iterations",
108
+ min: 1,
109
+ max: 5,
110
+ stepSize: 1,
111
+ defaultValue: 1,
112
+ enabledValue: 1,
113
+ inHeaderAction: true,
114
+ headerGroup: "Core"
115
+ }
116
+ ]
117
+ },
118
+ checks: [{ plugin: "marquee" }],
119
+ src,
120
+ cdnUrls: [
121
+ {
122
+ url: src,
123
+ defer: true
124
+ }
125
+ ],
126
+ js: `window.vMarquees = [];
127
+ window.vGetElementsByToggle('marquee').forEach((elem, index) => {
128
+ const options = window.vGetElementOptions(elem);
129
+ const marquee = new Marquee(elem, options);
130
+ elem.setAttribute('data-marquee-index', index);
131
+ window.vMarquees.push(elem);
132
+ });`,
133
+ displayNames: [
134
+ {
135
+ displayName: "Marquee",
136
+ property: "data-toggle",
137
+ value: "marquee"
138
+ }
139
+ ]
140
+ });
141
+
142
+ // src/plugins/swiper.ts
143
+ var js = `
144
+ window.vSwipers = [];
145
+ window.vGetElementsByToggle('swiper').forEach((elem, index) => {
146
+ let props = window.vGetElementOptions(elem);
147
+
148
+ if (props.pagination && props.pagination.renderBullet === 'number') {
149
+ props.pagination.renderBullet = function(index, className) {
150
+ const span = document.createElement('span');
151
+ span.className = className;
152
+ span.textContent = index + 1;
153
+ return span.outerHTML;
154
+ }
155
+ }
156
+
157
+ elem.setAttribute('data-swiper-index', index);
158
+ window.vSwipers.push(new Swiper(elem, props));
159
+ });`;
160
+ var swiper = defineConfig({
161
+ name: "Swiper",
162
+ cdnUrls: [
163
+ {
164
+ url: `https://cdnjs.cloudflare.com/ajax/libs/Swiper/9.3.2/swiper-bundle.min.js`,
165
+ inline: false,
166
+ defer: true
167
+ },
168
+ {
169
+ url: `https://cdnjs.cloudflare.com/ajax/libs/Swiper/9.3.2/swiper-bundle.min.css`
170
+ }
171
+ ],
172
+ js,
173
+ checks: [{ plugin: "swiper" }]
174
+ });
175
+
176
+ // src/plugins/prism.ts
177
+ var prism = defineConfig({
178
+ name: "Prism",
179
+ cdnUrls: [
180
+ {
181
+ url: "https://cdnjs.cloudflare.com/ajax/libs/prism/1.25.0/plugins/line-numbers/prism-line-numbers.min.css"
182
+ },
183
+ {
184
+ url: "https://cdnjs.cloudflare.com/ajax/libs/prism/1.25.0/prism.min.js"
185
+ },
186
+ {
187
+ url: "https://cdnjs.cloudflare.com/ajax/libs/prism/1.25.0/plugins/autoloader/prism-autoloader.min.js"
188
+ },
189
+ {
190
+ url: "https://cdnjs.cloudflare.com/ajax/libs/prism/1.25.0/plugins/line-numbers/prism-line-numbers.min.js"
191
+ }
192
+ ],
193
+ js: `
194
+ document.querySelectorAll("pre > code[class^='language-']").forEach((elem) => {
195
+ elem.parentNode.innerHTML = elem.parentNode.innerHTML.trim();
196
+ });
197
+
198
+ let themeLink = window.vPrismTheme !== undefined ? window.vPrismTheme : 'default';
199
+
200
+ if (themeLink === 'default') {
201
+ themeLink = 'https://cdnjs.cloudflare.com/ajax/libs/prism/1.25.0/themes/prism.min.css';
202
+ } else if (themeLink && !themeLink.includes('https://')) {
203
+ themeLink = 'https://cdnjs.cloudflare.com/ajax/libs/prism-themes/1.9.0/prism-' + themeLink + '.min.css';
204
+ }
205
+
206
+ if (themeLink && themeLink.includes('https://')) {
207
+ const link = document.createElement('link');
208
+ link.rel = 'stylesheet';
209
+ link.href = themeLink;
210
+ document.head.appendChild(link);
211
+ }
212
+
213
+ window.addEventListener('load', () => {
214
+ window.Prism && window.Prism.highlightAll();
215
+ });`,
216
+ checks: [{ html: "prism" }]
217
+ });
218
+
219
+ // src/plugins/tailtip.ts
220
+ var js2 = `window.vTailtips = [];
221
+
222
+ document.querySelectorAll('[data-toggle="tooltip"]').forEach((elem) => {
223
+ const tailtip = Tailtip(elem, window.vGetElementOptions(elem));
224
+ window.vTailtips.push(tailtip);
225
+ });`;
226
+ var tailtip = defineConfig({
227
+ name: "Tailtip",
228
+ src: "https://d1pnnwteuly8z3.cloudfront.net/libs/tailtip/1.0.3/tailtip.js",
229
+ cdnUrls: [
230
+ {
231
+ url: "https://d1pnnwteuly8z3.cloudfront.net/libs/tailtip/1.0.3/tailtip.js",
232
+ defer: true
233
+ }
234
+ ],
235
+ js: js2,
236
+ checks: [{ plugin: "tailtip" }],
237
+ components: [
238
+ {
239
+ name: "Info Tooltip",
240
+ category: "Plugins",
241
+ html: `<span class="flex w-4 h-4 bg-dark text-white items-center justify-center rounded-full text-xs font-medium" data-toggle="tooltip">i</span>
242
+ <div class="tooltip" role="tooltip">
243
+ <div class="tooltip-inner">
244
+ <span>This is a tooltip that is shown when hovered or clicked.</span>
245
+ </div>
246
+ <div class="tooltip-arrow"></div>
247
+ </div>`
248
+ }
249
+ ],
250
+ options: {
251
+ name: "Tailtip Options",
252
+ // isShown: (element) => element['data-toggle'] === 'tooltip',
253
+ isShown: {
254
+ props: {
255
+ "data-toggle": "tooltip"
256
+ }
257
+ },
258
+ previewInEditor: true,
259
+ fields: [
260
+ {
261
+ name: "tailtip",
262
+ type: "TailtipOption"
263
+ },
264
+ {
265
+ name: "Placement",
266
+ propsName: "data-options.placement",
267
+ type: "DropdownPropOption",
268
+ inline: true,
269
+ noneDisplayValue: "Default",
270
+ options: [false, "top", "bottom", "left", "right"]
271
+ }
272
+ ]
273
+ }
274
+ });
275
+
276
+ // src/plugins/taos.ts
277
+ var js3 = `!function(){const e=(e,t)=>{let s=!1;return()=>{s||(e(),s=!0,setTimeout((()=>s=!1),t))}},t=e=>{e.className!==e.dataset.taosClass&&(e.className=e.dataset.taosClass)},s=e=>e.className=e.className.replaceAll("taos:",""),a=e=>(e.className.includes("taos-init")||(e.dataset.taosClass=e.className+" taos-init",t(e)),e.className+=" !duration-[0ms] !delay-[0ms]",s(e),{element:e,once:"1"===getComputedStyle(e)["animation-iteration-count"],offset:parseInt(e.dataset.taosOffset||0)});let n=[],i=window.innerWidth,o=window.scrollY;const l=e((()=>{n.forEach((e=>e.trigger=e.element.getBoundingClientRect().top-window.innerHeight+e.offset+o))}),250),r=()=>{n=[],document.querySelectorAll('[class*="taos"]').forEach((e=>n.push(a(e)))),l(),requestAnimationFrame(c)},c=()=>{o=window.scrollY,n.forEach((({element:e,trigger:a,once:n})=>{a<o?t(e):!n&&e.className.includes("taos:")&&s(e)})),l()};r(),addEventListener("scroll",e(c,32)),addEventListener("orientationchange",r),addEventListener("resize",((e,t)=>{let s=null;return()=>{clearTimeout(s),s=setTimeout(e,t)}})((()=>{i!==window.innerWidth&&(i=window.innerWidth,r())}),250)),new MutationObserver((e=>{e.forEach((({target:e})=>{e.className&&!e.className.includes("taos-init")&&e.className.includes("taos:")&&n.push(a(e))}))})).observe(document,{attributes:!0,childList:!0,subtree:!0})}();`;
278
+ var taos = defineConfig({
279
+ name: "TAOS",
280
+ css: `
281
+ html.js :where([class*="taos:"]:not(.taos-init)) {
282
+ visibility: hidden;
283
+ }`,
284
+ js: js3,
285
+ checks: [{ plugin: "taos" }, { html: "taos:" }],
286
+ safelist: ["!duration-[0ms]", "!delay-[0ms]"]
287
+ });
288
+
289
+ // src/plugins/tilt.ts
290
+ var js4 = `window.vTilts = [];
291
+ window.vGetElementsByToggle('tilt').forEach((tiltEle, index) => {
292
+ const options = window.vGetElementOptions(elem);
293
+ VanillaTilt.init(tiltEle, options)
294
+ tiltEle.setAttribute('data-tilt-index', index);
295
+ window.vTilts.push(tiltEle);
296
+ });`;
297
+ var tilt = defineConfig({
298
+ name: "Tilt",
299
+ options: {
300
+ name: "Tilt",
301
+ previewInEditor: true,
302
+ isShown: {
303
+ props: {
304
+ "data-toggle": "tilt"
305
+ }
306
+ },
307
+ fields: [
308
+ {
309
+ name: "Speed",
310
+ type: "SliderPropOption",
311
+ propsName: "data-options.speed",
312
+ min: 0,
313
+ max: 3e3,
314
+ stepSize: 100,
315
+ defaultValue: 300
316
+ },
317
+ {
318
+ name: "Max Tilt",
319
+ type: "SliderPropOption",
320
+ propsName: "data-options.max",
321
+ min: 0,
322
+ max: 180,
323
+ stepSize: 1,
324
+ defaultValue: 35
325
+ },
326
+ {
327
+ name: "Reverse",
328
+ type: "BooleanPropOption",
329
+ propsName: "data-options.reverse",
330
+ defaultValue: false,
331
+ enabledValue: true,
332
+ inHeaderAction: true,
333
+ headerGroup: "Core"
334
+ },
335
+ {
336
+ name: "Transition",
337
+ type: "BooleanPropOption",
338
+ propsName: "data-options.transition",
339
+ defaultValue: true,
340
+ enabledValue: false,
341
+ inHeaderAction: true,
342
+ headerGroup: "Core"
343
+ },
344
+ {
345
+ label: "Easing",
346
+ name: "Easing",
347
+ propsName: "data-options.easing",
348
+ type: "TextOption",
349
+ defaultValue: "cubic-bezier(.03,.98,.52,.99)",
350
+ enabledValue: "cubic-bezier(.03,.98,.52,.99)",
351
+ inHeaderAction: true,
352
+ headerGroup: "Core"
353
+ },
354
+ {
355
+ name: "Full Page Listening",
356
+ type: "BooleanPropOption",
357
+ propsName: "data-options.full-page-listening",
358
+ defaultValue: false,
359
+ enabledValue: true,
360
+ inHeaderAction: true,
361
+ headerGroup: "Core"
362
+ },
363
+ {
364
+ name: "Start X",
365
+ type: "SliderPropOption",
366
+ propsName: "data-options.startX",
367
+ min: 0,
368
+ max: 180,
369
+ stepSize: 1,
370
+ defaultValue: 0,
371
+ enabledValue: 15,
372
+ inHeaderAction: true,
373
+ headerGroup: "Core"
374
+ },
375
+ {
376
+ name: "Start Y",
377
+ type: "SliderPropOption",
378
+ propsName: "data-options.startY",
379
+ min: 0,
380
+ max: 180,
381
+ stepSize: 1,
382
+ defaultValue: 0,
383
+ enabledValue: 15,
384
+ inHeaderAction: true,
385
+ headerGroup: "Core"
386
+ },
387
+ {
388
+ name: "Perspective",
389
+ type: "SliderPropOption",
390
+ propsName: "data-options.perspective",
391
+ min: 0,
392
+ max: 3e3,
393
+ stepSize: 1,
394
+ defaultValue: 1e3,
395
+ enabledValue: 1e3,
396
+ inHeaderAction: true,
397
+ headerGroup: "Core"
398
+ },
399
+ {
400
+ name: "Scale",
401
+ type: "SliderPropOption",
402
+ propsName: "data-options.scale",
403
+ min: 0.5,
404
+ max: 3,
405
+ stepSize: 0.1,
406
+ defaultValue: 1,
407
+ enabledValue: 1.5,
408
+ inHeaderAction: true,
409
+ headerGroup: "Core"
410
+ },
411
+ {
412
+ name: "Axis",
413
+ type: "IconButtonOption",
414
+ propsName: "data-options.axis",
415
+ options: ["x", "y"],
416
+ defaultValue: null,
417
+ enabledValue: "x",
418
+ inHeaderAction: true,
419
+ headerGroup: "Core"
420
+ },
421
+ {
422
+ name: "Glare",
423
+ type: "BooleanPropOption",
424
+ propsName: "data-options.glare",
425
+ defaultValue: false,
426
+ enabledValue: true,
427
+ inHeaderAction: true,
428
+ headerGroup: "Glare"
429
+ },
430
+ {
431
+ name: "Max Glare",
432
+ type: "SliderPropOption",
433
+ propsName: "data-options.max-glare",
434
+ min: 0.1,
435
+ max: 1,
436
+ stepSize: 0.1,
437
+ defaultValue: 1,
438
+ enabledValue: 0.5,
439
+ inHeaderAction: true,
440
+ headerGroup: "Glare"
441
+ },
442
+ {
443
+ name: "Reset",
444
+ type: "BooleanPropOption",
445
+ propsName: "data-options.reset",
446
+ defaultValue: true,
447
+ enabledValue: true,
448
+ inHeaderAction: true,
449
+ headerGroup: "Reset"
450
+ },
451
+ {
452
+ name: "Reset To Start",
453
+ type: "BooleanPropOption",
454
+ propsName: "data-options.reset-to-start",
455
+ defaultValue: true,
456
+ enabledValue: true,
457
+ inHeaderAction: true,
458
+ headerGroup: "Reset"
459
+ }
460
+ ]
461
+ },
462
+ cdnUrls: [
463
+ {
464
+ url: "https://cdnjs.cloudflare.com/ajax/libs/vanilla-tilt/1.8.0/vanilla-tilt.js",
465
+ defer: true
466
+ }
467
+ ],
468
+ js: js4,
469
+ checks: [{ plugin: "tilt" }],
470
+ components: [
471
+ {
472
+ name: "Tilt Image",
473
+ category: "Plugins",
474
+ html: `<img class="w-96" src="https://dummyimage.com/1000x600/edf2f7/0f1631&text=Placeholder" data-toggle="tilt" data-options="{'max':15,'reset':true}" />`
475
+ },
476
+ {
477
+ name: "Tilt Div",
478
+ category: "Plugins",
479
+ html: `<div class="w-full h-full" data-toggle="tilt" data-options="{'max':15,'reset':true}"></div>`
480
+ }
481
+ ]
482
+ });
483
+
484
+ // src/plugins/typed.ts
485
+ var typed = defineConfig({
486
+ name: "Typed",
487
+ options: {
488
+ name: "Typed Effect Options",
489
+ previewInEditor: true,
490
+ isShown: {
491
+ props: {
492
+ "data-toggle": "typed"
493
+ }
494
+ },
495
+ fields: [
496
+ {
497
+ type: "TextOption",
498
+ name: "Phrases",
499
+ tooltipProps: { content: "Use commas to add new words/phrases" },
500
+ placeholder: "second phrase., third phrase.",
501
+ propsName: "data-options.strings",
502
+ isArray: true
503
+ },
504
+ {
505
+ name: "Loop",
506
+ type: "BooleanPropOption",
507
+ propsName: "data-options.loop",
508
+ defaultValue: true,
509
+ enabledValue: true,
510
+ inHeaderAction: true,
511
+ headerGroup: "Core"
512
+ },
513
+ {
514
+ name: "Type Speed",
515
+ type: "SliderPropOption",
516
+ propsName: "data-options.typeSpeed",
517
+ min: 10,
518
+ max: 400,
519
+ stepSize: 10,
520
+ defaultValue: 100,
521
+ enabledValue: 100,
522
+ inHeaderAction: true,
523
+ headerGroup: "Core"
524
+ },
525
+ {
526
+ name: "Back Speed",
527
+ type: "SliderPropOption",
528
+ propsName: "data-options.backSpeed",
529
+ min: 10,
530
+ max: 400,
531
+ stepSize: 10,
532
+ defaultValue: 50,
533
+ enabledValue: 50,
534
+ inHeaderAction: true,
535
+ headerGroup: "Core"
536
+ },
537
+ {
538
+ name: "Start Delay",
539
+ type: "SliderPropOption",
540
+ propsName: "data-options.startDelay",
541
+ min: 50,
542
+ max: 3e3,
543
+ stepSize: 50,
544
+ defaultValue: 500,
545
+ enabledValue: 500,
546
+ inHeaderAction: true,
547
+ headerGroup: "Core"
548
+ },
549
+ {
550
+ name: "Back Delay",
551
+ type: "SliderPropOption",
552
+ propsName: "data-options.backDelay",
553
+ min: 50,
554
+ max: 3e3,
555
+ stepSize: 50,
556
+ defaultValue: 1e3,
557
+ enabledValue: 1e3,
558
+ inHeaderAction: true,
559
+ headerGroup: "Core"
560
+ }
561
+ ]
562
+ },
563
+ cdnUrls: [
564
+ {
565
+ url: "https://cdnjs.cloudflare.com/ajax/libs/typed.js/2.0.11/typed.min.js",
566
+ defer: true
567
+ }
568
+ ],
569
+ js: `
570
+ window.vGetElementsByToggle('typed').forEach((elem, index) => {
571
+ let options = window.vGetElementOptions(elem);
572
+
573
+ options.strings = [elem.innerHTML, ...options.strings];
574
+ elem.innerHTML = '';
575
+
576
+ new Typed(elem, {
577
+ typeSpeed: 100,
578
+ backSpeed: 50,
579
+ startDelay: 500,
580
+ backDelay: 1000,
581
+ loop: true,
582
+ ...options
583
+ });
584
+ });`,
585
+ checks: [{ plugin: "typed" }],
586
+ components: [
587
+ // {
588
+ // name: 'Tilt Div',
589
+ // category: 'Plugins',
590
+ // html: `<div class="w-full h-full" data-toggle="tilt" data-options="{'max':15,'reset':true}"></div>`,
591
+ // },
592
+ ],
593
+ displayNames: [
594
+ {
595
+ displayName: "Typed Effect",
596
+ property: "data-toggle",
597
+ value: "typed"
598
+ }
599
+ ]
600
+ });
601
+
602
+ // src/plugins/eventAnalytics.ts
603
+ var eventAnalytics = defineConfig({
604
+ name: "Event Analytics",
605
+ js: `const eventElements = document.querySelectorAll('[data-eventid]');
606
+ for (const eventElement of eventElements) {
607
+ if (eventElement.tagName !== 'FORM') {
608
+ eventElement.addEventListener('click', function(e) {
609
+ const eventName = eventElement.getAttribute('data-eventid');
610
+
611
+ if (window.versoly) {
612
+ window.versoly.event({name: eventName})
613
+ }
614
+ if (window.gtag) {
615
+ window.gtag('event', eventName)
616
+ }
617
+ if (window.amplitude) {
618
+ window.amplitude.getInstance().logEvent(event);
619
+ }
620
+ })
621
+ }
622
+ }`,
623
+ checks: [{ html: "data-eventid" }]
624
+ });
625
+
626
+ // src/plugins/versolyAnalytics.ts
627
+ var js5 = `!function(e){e.versoly.event=function(t){if(!("visibilityState"in document&&"prerender"===document.visibilityState||/bot|google|baidu|bing|msn|duckduckbot|teoma|slurp|yandex/i.test(navigator.userAgent)||e._phantom||e.__nightmare||e.navigator.webdriver||e.Cypress||""===e.location.host)){var n=new XMLHttpRequest;n.open("POST",e.versoly.url,!0),n.setRequestHeader("Content-Type","application/json; charset=UTF-8"),n.send(JSON.stringify({siteId:e.versoly.id,referrer:document.referrer,paramReferrer:"",hostname:e.location.hostname,pathname:e.location.pathname+e.location.search,width:e.innerWidth,height:e.innerHeight,tz:Intl.DateTimeFormat().resolvedOptions().timeZone,...t}))}}}(window),window.versoly.event({name: 'pageview'});`;
628
+ var versolyAnalytics = defineConfig({
629
+ name: "Versoly Analytics",
630
+ js: js5,
631
+ checks: [{ html: "/api/event" }]
632
+ });
633
+
634
+ // src/plugins/modal.ts
635
+ var modal = defineConfig({
636
+ name: "Versoly UI Modal",
637
+ js: `window.vGetElementsByToggle('modal').forEach(elem => {
638
+ let options = window.vGetElementOptions(elem);
639
+
640
+ if (options.globalBlockId && window.vComponents[options.globalBlockId]) {
641
+ elem.dataset.html = window.vComponents[options.globalBlockId];
642
+
643
+ if (window.vComponents[options.globalBlockId].includes('data-formid')) {
644
+ options.beforeShown = 'addFormListener'
645
+ }
646
+ }
647
+
648
+ elem.dataset.options = JSON.stringify(options);
649
+ });`,
650
+ checks: [{ plugin: "modal" }]
651
+ });
652
+
653
+ // src/plugins/form.ts
654
+ var form = defineConfig({
655
+ name: "versoly-form",
656
+ checks: [{ plugin: "formid" }],
657
+ js: `window.vPageLoadedAt = Date.now()
658
+
659
+ setTimeout(() => {
660
+ let inputs = [...document.getElementsByTagName("input")]
661
+ inputs.forEach(i => {
662
+ if (i.name === 'email_second' || i.name === 'name_second') {
663
+ i.setAttribute('aria-hidden', 'true')
664
+ i.setAttribute('tabindex', '-1')
665
+ i.setAttribute('autocomplete', 'false')
666
+ }
667
+ })
668
+ }, 3000)
669
+
670
+ const sendFormData = function (e, form) {
671
+ e.preventDefault();
672
+ const formId = form.dataset.formid;
673
+ let scriptsByForm = window.vForms[formId] || {}
674
+
675
+ if (window.vPageLoadedAt + 3000 > Date.now()) {
676
+ return null
677
+ }
678
+
679
+ let data = {
680
+ created: Date.now(),
681
+ url: location.pathname + location.search
682
+ }
683
+
684
+ const filteredForms = document.querySelectorAll('[data-formId="' + formId + '"]')
685
+ let formIndex = 0
686
+ filteredForms.forEach((f, index) => {
687
+ if (f === form) {
688
+ formIndex = index
689
+ }
690
+ })
691
+
692
+ const errorElement = document.querySelectorAll('[data-form-errorid="' + formId + '"]')[formIndex]
693
+ let inputs = [
694
+ ...form.getElementsByTagName("input"),
695
+ ...form.getElementsByTagName("textarea"),
696
+ ...form.getElementsByTagName("select")
697
+ ]
698
+
699
+ inputs.forEach(input => {
700
+ if (input.type === 'radio') {
701
+ if (input.checked) {
702
+ data[input.name] = input.value
703
+ }
704
+ return
705
+ }
706
+ if (input.tagName === 'SELECT') {
707
+ data[input.name] = input.options[input.selectedIndex].value
708
+ return
709
+ }
710
+ if (input.type === 'checkbox') {
711
+ data[input.name] = input.checked + ""
712
+ return
713
+ }
714
+ data[input.name] = input.value
715
+ })
716
+
717
+ if (!!data['email_second'] || !!data['name_second']) {
718
+ return null
719
+ }
720
+ delete data['email_second'];
721
+ delete data['name_second'];
722
+
723
+ if (scriptsByForm.pre) {
724
+ eval(scriptsByForm.pre)
725
+ }
726
+
727
+ const submitButton = form.querySelector(('button[type="submit"]'))
728
+ const buttonInnerHTML = submitButton.innerHTML
729
+ submitButton.disabled = true
730
+
731
+ let loadingButtonInnerHTML = '<i class="fa fa-spinner fa-spin"></i> Loading'
732
+ if (submitButton.getAttribute('data-loading-html')) {
733
+ loadingButtonInnerHTML = submitButton.getAttribute('data-loading-html')
734
+ }
735
+ submitButton.innerHTML = loadingButtonInnerHTML
736
+
737
+ data = JSON.stringify(data)
738
+ fetch('https://api.versoly.com/v1/form/submit', {
739
+ method: 'POST',
740
+ headers: {
741
+ 'Content-Type': 'application/json'
742
+ },
743
+ body: JSON.stringify({formId: formId, data: data})
744
+ })
745
+ .then(function (response){
746
+ if (!response.ok) {
747
+ throw new Error('Bad response from server');
748
+ }
749
+
750
+ if (window.versoly && form.getAttribute('data-eventid')) {
751
+ window.versoly.event({name: form.getAttribute('data-eventid')})
752
+ }
753
+
754
+ if (scriptsByForm.post) {
755
+ eval(scriptsByForm.post)
756
+ }
757
+
758
+ if (form.dataset["successUrl"]) {
759
+ window.location.replace(form.dataset["successUrl"])
760
+ return
761
+ }
762
+
763
+ const successElement = document.querySelectorAll('[data-form-successid="' + formId + '"]')[formIndex]
764
+
765
+ if (successElement) {
766
+ successElement.classList.remove("d-js");
767
+ errorElement.classList.add("d-js");
768
+ form.classList.add("d-js");
769
+
770
+ successElement.classList.remove("d-none");
771
+ errorElement.classList.add("d-none");
772
+ form.classList.add("d-none");
773
+ }
774
+
775
+ submitButton.disabled = false
776
+ submitButton.innerHTML = buttonInnerHTML
777
+ })
778
+ .catch(function (error){
779
+ console.log(error)
780
+ if (errorElement) {
781
+ errorElement.classList.remove("d-js");
782
+ errorElement.classList.remove("d-none");
783
+ }
784
+ if (scriptsByForm.failed) {
785
+ eval(scriptsByForm.failed)
786
+ }
787
+ submitButton.disabled = false
788
+ submitButton.innerHTML = buttonInnerHTML
789
+ })
790
+ }
791
+
792
+
793
+ window.addFormListener = () => {
794
+ const forms = document.querySelectorAll('[data-formid]');
795
+
796
+ for (const form of forms) {
797
+ if (!form.getAttribute('data-has-form-eventlistener')) {
798
+ form.addEventListener("submit", function (e) {
799
+ sendFormData(e, form)
800
+ });
801
+ form.setAttribute('data-has-form-eventlistener', 'true')
802
+ }
803
+ }
804
+ }
805
+ window.addFormListener && window.addFormListener()
806
+ `
807
+ });
808
+
809
+ // src/plugins/countup.ts
810
+ var countup = defineConfig({
811
+ name: "Countup",
812
+ cdnUrls: [
813
+ {
814
+ url: "https://cdnjs.cloudflare.com/ajax/libs/scrollReveal.js/3.4.0/scrollreveal.min.js"
815
+ },
816
+ {
817
+ url: "https://cdnjs.cloudflare.com/ajax/libs/countup.js/2.0.8/countUp.umd.min.js"
818
+ }
819
+ ],
820
+ js: `window.scrollReveal = ScrollReveal();
821
+
822
+ window.countStart = e => {
823
+ var startVal = e.dataset.from ? +e.dataset.from : 0
824
+ ,endVal = e.dataset.to ? +e.dataset.to : 0
825
+ ,duration = e.dataset.duration ? +e.dataset.duration : 2
826
+ ,options = e.dataset.options ? JSON.parse(e.dataset.options) : {}
827
+ const up = new countUp.CountUp(e, endVal, {...options, startVal, duration});
828
+ up.start()
829
+ }
830
+
831
+ window.vGetElementsByToggle('countup').forEach(e => {
832
+ scrollReveal.reveal(e, {beforeReveal: window.countStart, duration: 0});
833
+ });`,
834
+ checks: [{ plugin: "countup" }],
835
+ options: {
836
+ name: "Countup Options",
837
+ isShown: {
838
+ props: {
839
+ "data-toggle": "countup"
840
+ }
841
+ },
842
+ fields: [
843
+ {
844
+ name: "Count From",
845
+ propsName: "data-from",
846
+ type: "NumberOption"
847
+ },
848
+ {
849
+ name: "Count To",
850
+ propsName: "data-to",
851
+ type: "NumberOption"
852
+ },
853
+ {
854
+ name: "Duration",
855
+ propsName: "data-duration",
856
+ type: "NumberOption",
857
+ placeholder: "2",
858
+ stepSize: 0.1
859
+ },
860
+ {
861
+ name: "Countup when Visible",
862
+ propsName: "data-aos",
863
+ options: [false, true],
864
+ type: "BooleanPropOption",
865
+ defaultValue: false
866
+ }
867
+ ]
868
+ },
869
+ components: [
870
+ {
871
+ name: "Countup",
872
+ category: "Plugins",
873
+ html: `<h2 data-toggle="countup" data-aos data-aos-id="countup:in" data-from="100" data-to="800">100</h2>`
874
+ }
875
+ ]
876
+ });
877
+
878
+ // src/plugins/countdown.ts
879
+ var js6 = `window.vGetElementsByToggle('countdown').forEach(e => {
880
+ const deadline = new Date(e.dataset.countdown).getTime();
881
+
882
+ const daysEl = e.querySelector('[data-countdown-type="days"]'),
883
+ hoursEl = e.querySelector('[data-countdown-type="hours"]'),
884
+ minutesEl = e.querySelector('[data-countdown-type="minutes"]'),
885
+ secondsEl = e.querySelector('[data-countdown-type="seconds"]');
886
+
887
+ const countdownFunc = () => {
888
+ const now = new Date().getTime();
889
+ let t = deadline - now;
890
+
891
+ if (t < 0) {
892
+ clearInterval(x);
893
+ t = 0;
894
+ }
895
+
896
+ let seconds = ''+Math.floor((t / 1000) % 60),
897
+ minutes = ''+Math.floor((t / 1000 / 60) % 60),
898
+ hours = ''+Math.floor((t / (1000 * 60 * 60)) % 24),
899
+ days = ''+Math.floor(t / (1000 * 60 * 60 * 24));
900
+
901
+ if (seconds.length === 1) seconds = '0' + seconds;
902
+ if (minutes.length === 1) minutes = '0' + minutes;
903
+ if (hours.length === 1) hours = '0' + hours;
904
+ if (days.length === 1) days = '0' + days;
905
+
906
+ if (secondsEl) secondsEl.innerHTML = seconds;
907
+ if (minutesEl) minutesEl.innerHTML = minutes;
908
+ if (hoursEl) hoursEl.innerHTML = hours;
909
+ if (daysEl) daysEl.innerHTML = days;
910
+ }
911
+
912
+ var x = setInterval(countdownFunc, 1000);
913
+ countdownFunc();
914
+ })
915
+ `;
916
+ var currentDate = /* @__PURE__ */ new Date();
917
+ var ISODateIn5Days = new Date(currentDate.getTime() + 5 * 24 * 60 * 60 * 1234).toISOString();
918
+ var countdown = defineConfig({
919
+ name: "Countdown Options",
920
+ js: js6,
921
+ checks: [{ plugin: "countdown" }],
922
+ options: {
923
+ name: "Countdown",
924
+ isShown: {
925
+ props: {
926
+ "data-toggle": "countdown",
927
+ "data-countdown": true
928
+ }
929
+ },
930
+ fields: [
931
+ {
932
+ name: "Countdown Timer",
933
+ propsName: "data-countdown",
934
+ type: "DateTimePickerOption"
935
+ }
936
+ ]
937
+ },
938
+ components: [
939
+ {
940
+ name: "Countdown",
941
+ category: "Plugins",
942
+ html: `<h2 class="font-semibold" data-toggle="countdown" data-countdown="${ISODateIn5Days}">
943
+ <span data-countdown-type="days">4</span>
944
+ <span class="opacity-20">:</span>
945
+ <span data-countdown-type="hours">1</span>
946
+ <span class="opacity-20">:</span>
947
+ <span data-countdown-type="minutes">0</span>
948
+ <span class="opacity-20">:</span>
949
+ <span data-countdown-type="seconds">0</span>
950
+ </h2>`
951
+ }
952
+ ]
953
+ });
954
+
955
+ // src/plugins/calendly.ts
956
+ var calendly = defineConfig({
957
+ name: "Calendly",
958
+ cdnUrls: [
959
+ {
960
+ url: "https://assets.calendly.com/assets/external/widget.js",
961
+ delay: true
962
+ },
963
+ {
964
+ url: "https://assets.calendly.com/assets/external/widget.css",
965
+ delay: true
966
+ }
967
+ ],
968
+ js: `
969
+ document.querySelectorAll('[data-calendly-url]').forEach(a => {
970
+ const url = a.getAttribute('data-calendly-url')
971
+
972
+ if (!url) {
973
+ return;
974
+ }
975
+
976
+ a.addEventListener('click', e => {
977
+ e.preventDefault();
978
+ window.Calendly.initPopupWidget({ url, parentElement: a})
979
+ })
980
+ });`,
981
+ checks: [{ plugin: "calendly" }, { html: "calendly" }],
982
+ options: {
983
+ name: "Calendly Options",
984
+ isShown: {
985
+ props: {
986
+ "data-calendly-url": true
987
+ }
988
+ },
989
+ fields: [
990
+ {
991
+ name: "Calendly Url",
992
+ propsName: "data-calendly-url",
993
+ type: "TextOption"
994
+ }
995
+ ]
996
+ }
997
+ });
998
+
999
+ // src/plugins/versolyUI.ts
1000
+ var versolyUI = defineConfig({
1001
+ name: "Versoly UI",
1002
+ cdnUrls: [
1003
+ {
1004
+ url: "https://d1pnnwteuly8z3.cloudfront.net/libs/floating-ui/1.0.1/floating-ui.min.js",
1005
+ defer: true
1006
+ },
1007
+ {
1008
+ url: "https://d1pnnwteuly8z3.cloudfront.net/libs/versoly-ui/2.1.1/versoly-ui.js",
1009
+ delay: true
1010
+ }
1011
+ ]
1012
+ });
1013
+
1014
+ // src/plugins/finisherHeader.ts
1015
+ var finisherHeader = defineConfig({
1016
+ name: "Finisher Header",
1017
+ cdnUrls: [
1018
+ {
1019
+ url: "https://d1pnnwteuly8z3.cloudfront.net/js/finisher-header.es5.min.js",
1020
+ defer: true
1021
+ }
1022
+ ],
1023
+ js: `document.querySelectorAll('.finisher-header').forEach(elem => {
1024
+ let options = window.vGetElementOptions(elem);
1025
+ new FinisherHeader(options);
1026
+ });`,
1027
+ checks: [{ html: "finisher-header" }],
1028
+ components: [
1029
+ {
1030
+ name: "Finisher Header",
1031
+ category: "Plugins",
1032
+ html: `<div class="finisher-header" data-toggle="finisher-header" data-options="{'count':15,'size':{'min':2,'max':40,'pulse':0},'speed':{'x':{'min':0,'max':0.8},'y':{'min':0,'max':0.2}},'colors':{'background':'#fff','particles':['#ff926b','#87ddfe','#acaaff','#1bffc2','#f9a5fe']},'blending':'screen','opacity':{'center':1,'edge':1},'skew':-1,'shapes':['c','s','t']}"></div>`
1033
+ }
1034
+ ]
1035
+ });
1036
+
1037
+ // src/plugins/index.ts
1038
+ var plugins = {
1039
+ headroom,
1040
+ marquee,
1041
+ swiper,
1042
+ prism,
1043
+ tailtip,
1044
+ taos,
1045
+ tilt,
1046
+ typed,
1047
+ modal,
1048
+ form,
1049
+ finisherHeader,
1050
+ countup,
1051
+ countdown,
1052
+ eventAnalytics,
1053
+ versolyAnalytics,
1054
+ versolyUI,
1055
+ calendly
1056
+ };
1057
+ // Annotate the CommonJS export names for ESM import in node:
1058
+ 0 && (module.exports = {
1059
+ defineConfig,
1060
+ plugins
1061
+ });