zz-shopify-components 0.0.1-beta.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.
Files changed (61) hide show
  1. package/README.md +12 -0
  2. package/assets/fade-in-content.js +169 -0
  3. package/assets/gsap.min.js +11 -0
  4. package/assets/http-request.js +73 -0
  5. package/assets/jquery.js +2 -0
  6. package/assets/lozad.js +10 -0
  7. package/assets/site-jump.js +52 -0
  8. package/assets/site-jumpV2.js +35 -0
  9. package/assets/swiper-bundle.min.css +13 -0
  10. package/assets/swiper-bundle.min.js +14 -0
  11. package/assets/swiper.css +331 -0
  12. package/assets/zz-components.css +323 -0
  13. package/assets/zz-components.js +166 -0
  14. package/blocks/zz-accessories-item.liquid +183 -0
  15. package/blocks/zz-accessories-swiper.liquid +223 -0
  16. package/blocks/zz-button.liquid +189 -0
  17. package/blocks/zz-content-description-html.liquid +199 -0
  18. package/blocks/zz-content-description.liquid +200 -0
  19. package/blocks/zz-flex-layout-bg-block.liquid +520 -0
  20. package/blocks/zz-flex-layout-block.liquid +545 -0
  21. package/blocks/zz-flex-layout-widget.liquid +318 -0
  22. package/blocks/zz-full-screen-swiper.liquid +444 -0
  23. package/blocks/zz-icon.liquid +46 -0
  24. package/blocks/zz-mail.liquid +135 -0
  25. package/blocks/zz-mb-swiper-pc-flex.liquid +270 -0
  26. package/blocks/zz-ratio-image.liquid +177 -0
  27. package/blocks/zz-ratio-video.liquid +112 -0
  28. package/blocks/zz-responsive-width-image.liquid +219 -0
  29. package/blocks/zz-responsive-width-video.liquid +163 -0
  30. package/blocks/zz-scroll-animate-bg-text.liquid +265 -0
  31. package/blocks/zz-scroll-cover.liquid +64 -0
  32. package/blocks/zz-tag.liquid +48 -0
  33. package/blocks/zz-text.liquid +225 -0
  34. package/blocks/zz-title.liquid +284 -0
  35. package/blocks/zz-video-button.liquid +81 -0
  36. package/blocks/zz-video-swiper-perview-item.liquid +216 -0
  37. package/blocks/zz-video-swiper-perview.liquid +582 -0
  38. package/component.config.json +4 -0
  39. package/package.json +23 -0
  40. package/scripts/postinstall-v2.js +47 -0
  41. package/scripts/postinstall.js +39 -0
  42. package/sections/zz-flex-layout-section.liquid +266 -0
  43. package/sections/zz-navigation-tab-v3.liquid +403 -0
  44. package/sections/zz-navigation-tab.liquid +410 -0
  45. package/sections/zz-video-collapse-swiper.liquid +522 -0
  46. package/sections/zz-video-tab-swiper.liquid +745 -0
  47. package/snippets/zz-button.liquid +70 -0
  48. package/snippets/zz-content-text.liquid +56 -0
  49. package/snippets/zz-h2.liquid +31 -0
  50. package/snippets/zz-h3.liquid +31 -0
  51. package/snippets/zz-h4.liquid +30 -0
  52. package/snippets/zz-h5.liquid +39 -0
  53. package/snippets/zz-h6.liquid +39 -0
  54. package/snippets/zz-icon.liquid +74 -0
  55. package/snippets/zz-img.liquid +44 -0
  56. package/snippets/zz-prev-next-btn.liquid +62 -0
  57. package/snippets/zz-spoke.liquid +142 -0
  58. package/snippets/zz-tag.liquid +22 -0
  59. package/snippets/zz-video-button.liquid +55 -0
  60. package/snippets/zz-video-md.liquid +117 -0
  61. package/snippets/zz-video.liquid +117 -0
@@ -0,0 +1,522 @@
1
+ {% schema %}
2
+ {
3
+ "name": "Video Img Collapse View",
4
+ "class": "zz-video-collapse-view",
5
+
6
+ "settings": [
7
+ {
8
+ "type": "image_picker",
9
+ "id": "logo",
10
+ "label": "Logo"
11
+ },
12
+ {
13
+ "type": "color",
14
+ "id": "bg_color",
15
+ "default": "#000000",
16
+ "label": "背景色"
17
+ },
18
+ {
19
+ "type": "number",
20
+ "id": "pc_padding_top",
21
+ "label": "PC上内边距 (Padding Top)",
22
+ "default": 80
23
+ },
24
+ {
25
+ "type": "number",
26
+ "id": "pc_padding_bottom",
27
+ "label": "PC下内边距 (Padding Bottom)",
28
+ "default": 80
29
+ },
30
+ {
31
+ "type": "number",
32
+ "id": "mobile_padding_top",
33
+ "label": "移动上内边距 (Padding Top)",
34
+
35
+ "default": 40
36
+ },
37
+ {
38
+ "type": "number",
39
+ "id": "mobile_padding_bottom",
40
+ "label": "移动下内边距 (Padding Bottom)",
41
+ "default": 40
42
+ },
43
+ {
44
+ "type": "color",
45
+ "id": "tab_title_active_color",
46
+ "label": "Tab标题激活颜色",
47
+ "default": "#ffffff"
48
+ },
49
+ {
50
+ "type": "color",
51
+ "id": "tab_title_color",
52
+ "label": "Tab标题颜色",
53
+ "default": "#BDBDBD"
54
+ },
55
+ {
56
+ "type": "color",
57
+ "id": "collapsible_text_color",
58
+ "label": "可折叠文字颜色",
59
+ "default": "#B2B2B2"
60
+ },
61
+ {
62
+ "type": "color",
63
+ "id": "tab_bar_bg_color",
64
+ "label": "移动端Tab栏背景颜色",
65
+ "default": "#2B2B2B"
66
+ },
67
+ {
68
+ "type": "select",
69
+ "id": "collapse_button_color",
70
+ "label": "展开按钮颜色风格",
71
+ "options": [
72
+ { "value": "white", "label": "白色" },
73
+ { "value": "black", "label": "黑色" },
74
+ ],
75
+ "default": "white"
76
+ },
77
+
78
+
79
+ ],
80
+ "blocks": [
81
+ {
82
+ "type": "title",
83
+ "name": "标题",
84
+ "settings": [
85
+ {
86
+ "type": "richtext",
87
+ "id": "pc_title",
88
+ "label": "PC标题内容 (PC Title Content)",
89
+ "default": "<p>这里是标题</p>"
90
+ },
91
+ {
92
+ "type": "richtext",
93
+ "id": "mb_title",
94
+ "label": "移动标题内容 (Mobile Title Content)",
95
+
96
+ },
97
+ {
98
+ "type": "color",
99
+ "id": "text_color",
100
+ "label": "文字颜色",
101
+ "default": "#ffffff"
102
+ },
103
+ {
104
+ "type": "number",
105
+ "id": "pc_margin_bottom",
106
+ "label": "PC下外边距 (Margin Bottom)",
107
+ "default": 40
108
+ },
109
+ {
110
+ "type": "number",
111
+ "id": "mobile_margin_bottom",
112
+ "label": "移动下外边距 (Margin Bottom)",
113
+ "default": 20
114
+ }
115
+ ]
116
+ },
117
+ {
118
+ "type": "text_content",
119
+ "name": "文字内容",
120
+ "settings": [
121
+ {
122
+ "type": "richtext",
123
+ "id": "pc_text",
124
+ "label": "PC文字内容 (PC Text Content)",
125
+ "default": "<p>这里是文字内容</p>"
126
+ },
127
+ {
128
+ "type": "richtext",
129
+ "id": "mb_text",
130
+ "label": "移动文字内容 (Mobile Text Content)",
131
+ "default": "<p>这里是文字内容</p>"
132
+ },
133
+ {
134
+ "type": "color",
135
+ "id": "text_color",
136
+ "label": "文字颜色",
137
+ "default": "#ffffff"
138
+ },
139
+ {
140
+ "type": "number",
141
+ "id": "pc_margin_bottom",
142
+ "label": "PC下外边距 (Margin Bottom)",
143
+ "default": 40
144
+ },
145
+ {
146
+ "type": "number",
147
+ "id": "mobile_margin_bottom",
148
+ "label": "移动下外边距 (Margin Bottom)",
149
+ "default": 20
150
+ }
151
+ ]
152
+ },
153
+ {
154
+ "type": "collapsible_row",
155
+ "name": "可折叠行",
156
+ "settings": [
157
+ {
158
+ "type": "text",
159
+ "id": "heading",
160
+ "label": "标题"
161
+ },
162
+ {
163
+ "type": "html",
164
+ "id": "row_content",
165
+ "label": "description"
166
+ },
167
+ {
168
+ "type": "video",
169
+ "id": "video_pc",
170
+ "label": "Video"
171
+ },
172
+ {
173
+ "type": "image_picker",
174
+ "id": "poster_pc",
175
+ "label": "Poster"
176
+ },
177
+ {
178
+ "type": "video",
179
+ "id": "video_mb",
180
+ "label": "Video(Mobile)"
181
+ },
182
+ {
183
+ "type": "image_picker",
184
+ "id": "poster_mb",
185
+ "label": "Poster(Mobile)"
186
+ },
187
+ ]
188
+ }
189
+ ],
190
+
191
+ "presets": [
192
+ {
193
+ "name": "Video Img Collapse View"
194
+ },
195
+ {
196
+ "name": "内容折叠+视频图片",
197
+ "settings": {
198
+
199
+ },
200
+ "blocks": [
201
+ {
202
+ "type": "title",
203
+ "settings": {
204
+ "pc_title": "<p>内容折叠+视频图片</p>",
205
+ "mb_title": "<p>内容折叠+视频图片</p>",
206
+ "text_color": "#ffffff",
207
+ }
208
+ },
209
+ {
210
+ "type": "text_content",
211
+ "settings": {
212
+ "pc_text": "<p>内容折叠+视频图片,左侧视频和图片,右边可折叠内容</p>",
213
+ "mb_text": "<p>内容折叠+视频图片,左侧视频和图片,右边可折叠内容</p>",
214
+ "text_color": "#ffffff",
215
+ }
216
+ },
217
+ {
218
+ "type": "collapsible_row",
219
+ "settings": {
220
+ "heading": "TitleOne",
221
+ "row_content": "<p>Capture high-speed action and slow it waaaay down, and stretch out a moment in time.</p>",
222
+ "poster_pc": "shopify://shop_images/preset_pc_swiper_video_poster.png",
223
+ "poster_mb": "shopify://shop_images/preset_mobile_swiper_video_poster.png"
224
+ }
225
+ },
226
+ {
227
+ "type": "collapsible_row",
228
+ "settings": {
229
+ "heading": "TitleTwo",
230
+ "row_content": "<p>For 9:16 social content, switch to vertical orientation for scroll-stopping Ultra HD 4K@30.</p>",
231
+ "poster_pc": "shopify://shop_images/preset_pc_swiper_video_poster_1.png",
232
+ "poster_mb": "shopify://shop_images/preset_mobile_swiper_video_poster_1.png"
233
+ }
234
+ },
235
+ ]
236
+ }
237
+ ]
238
+ }
239
+ {% endschema %}
240
+
241
+ <div class='video-collapse-swiper tw-relative'>
242
+ {% assign non_collapsible_blocks = section.blocks | reject: 'type', 'collapsible_row' %}
243
+ <div class="collapse-title-desc fade-in-box tw-flex tw-flex-col tw-justify-center">
244
+
245
+ {% for block in non_collapsible_blocks %}
246
+ {% case block.type %}
247
+ {% when 'title' %}
248
+ {% render 'zz-h2',
249
+ title: block.settings.pc_title,
250
+ title_mb: block.settings.mb_title,
251
+ title_color: block.settings.text_color,
252
+ class_name: 'content-title tw-text-center'
253
+ %}
254
+ <style>
255
+ #shopify-section-{{section.id}} .content-title {
256
+ margin-bottom: {{ block.settings.mobile_margin_bottom }}px;
257
+ }
258
+ @media screen and (min-width: 1024px) {
259
+ #shopify-section-{{section.id}} .content-title {
260
+ margin-bottom: {{ block.settings.pc_margin_bottom }}px;
261
+ }
262
+ }
263
+ </style>
264
+ {% when 'text_content' %}
265
+ {% render 'zz-content-text',
266
+ text: block.settings.pc_text,
267
+ mb_text: block.settings.mb_text,
268
+ text_color: block.settings.text_color,
269
+ class_name: 'content-text tw-text-center'
270
+ %}
271
+ <style>
272
+
273
+ #shopify-section-{{section.id}} .content-text {
274
+ margin-bottom: {{ block.settings.mobile_margin_bottom }}px;
275
+ }
276
+ @media screen and (min-width: 1024px) {
277
+ #shopify-section-{{section.id}} .content-text {
278
+ margin-bottom: {{ block.settings.pc_margin_bottom }}px;
279
+ }
280
+ }
281
+ </style>
282
+
283
+ {% endcase %}
284
+ {% endfor %}
285
+
286
+ </div>
287
+ <div class="max-lg:tw-hidden tw-w-[90vw] xl:tw-w-[1220px] tw-mx-auto">
288
+ <div class="collaspse-div yw-w-full tw-flex tw-items-center tw-justify-between">
289
+ <div class="tw-w-[68%]">
290
+ {% assign swiper_blocks = section.blocks | where: 'type', 'collapsible_row' %}
291
+ {% for collapsible_row in swiper_blocks %}
292
+ <div class='collasps-video-box tw-hidden tw-w-full tw-rounded-[16px] tw-overflow-hidden'>
293
+ {% comment %} pc端配置视频 {% endcomment %}
294
+ {% if collapsible_row.settings.video_pc != blank %}
295
+ {% render 'zz-video',
296
+ pc_video: collapsible_row.settings.video_pc,
297
+ pc_poster: collapsible_row.settings.poster_pc,
298
+ lazy: true,
299
+ class: 'tw-w-full tw-h-auto tw-rounded-[16px] ',
300
+ autoplay: true,
301
+ loop: true,
302
+ muted: true
303
+ %}
304
+ {% else %}
305
+ {%- if collapsible_row.settings.poster_pc != blank -%}
306
+ {% render 'zz-img',
307
+ pc_image: collapsible_row.settings.poster_pc,
308
+ image_alt: collapsible_row.settings.heading | escape,
309
+ class_name: 'ratio-image',
310
+ %}
311
+ {% endif %}
312
+ {% endif %}
313
+
314
+ </div>
315
+ {% endfor %}
316
+ </div>
317
+ <div class="tw-w-[27%]">
318
+ <div class="tw-daisy-join tw-daisy-join-vertical tw-w-full">
319
+ {% for collapsible_row in swiper_blocks %}
320
+ <div class="tw-daisy-collapse collapse-arrow tw-daisy-join-item ">
321
+ <input type="radio" name="my-accordion-{{ section.id }}" value="{{ forloop.index }}" {% if forloop.first %}checked data-last-checked="true"{% endif %} onclick="handleFAQClick(this)" style="cursor: pointer;" />
322
+ <div class="tw-daisy-collapse-title tw-py-[20px] tw-px-0 tw-text-[20px] tw-font-[700] tw-leading-[1]" style="color: {{ section.settings.tab_title_active_color }};">
323
+ {{ collapsible_row.settings.heading }}
324
+ </div>
325
+ <div class="tw-p-0 tw-daisy-collapse-content">
326
+ <div class="row-content tw-pb-[1rem] tw-text-[16px] tw-leading-[1.5]" style="color: {{ section.settings.collapsible_text_color }};">
327
+ {{ collapsible_row.settings.row_content }}
328
+ </div>
329
+ </div>
330
+ </div>
331
+ {% endfor %}
332
+ </div>
333
+ </div>
334
+
335
+ </div>
336
+ </div>
337
+
338
+ <div class='tw-px-[20px] tw-py-[20px] lg:tw-hidden'>
339
+ {% for collapsible_row in swiper_blocks %}
340
+ <div class='video-box tw-hidden tw-rounded-[10px] tw-overflow-hidden'>
341
+ {% comment %} 移动端配置视频 {% endcomment %}
342
+ {% if collapsible_row.settings.video_mb != blank %}
343
+ {% render 'zz-video',
344
+ mb_video: collapsible_row.settings.video_mb,
345
+ mb_poster: collapsible_row.settings.poster_mb,
346
+ autoplay: true,
347
+ loop: true,
348
+ class: 'tw-w-full tw-h-auto tw-rounded-[10px]',
349
+ muted: true
350
+ %}
351
+ {% else %}
352
+ {%- if collapsible_row.settings.poster_mb != blank -%}
353
+ {% render 'zz-img',
354
+ mb_image: collapsible_row.settings.poster_mb,
355
+ image_alt: collapsible_row.settings.heading | escape,
356
+ %}
357
+ {% endif %}
358
+ {% endif %}
359
+ </div>
360
+ {% endfor %}
361
+ </div>
362
+
363
+ <div class="lg:tw-hidden">
364
+ <div class="tw-px-[20px] tw-py-[20px] tw-flex tw-flex-col tw-items-center tw-justify-center">
365
+ <div
366
+ class='tabs tw-flex tw-justify-between tw-w-full tw-min-w-[320px] tw-max-w-[480px] tw-px-[16px] tw-rounded-[16px] tw-items-center tw-h-[32px] tw-mb-[12px]'
367
+ style="background-color: {{ section.settings.tab_bar_bg_color }};">
368
+ {% for collapsible_row in swiper_blocks %}
369
+ <div
370
+ class='tab-item tw-cursor-pointer tw-text-[10px] tw-font-[500] hover:tw-border-white'
371
+ style="color: {{ section.settings.tab_title_color }};"
372
+ data-index='{{ forloop.index0 }}'
373
+ >
374
+ {{ collapsible_row.settings.heading }}
375
+ </div>
376
+ {% endfor %}
377
+ </div>
378
+
379
+ <div class='video-content '>
380
+ {% for collapsible_row in swiper_blocks %}
381
+ <div
382
+ class='content-item row-content tw-hidden tw-font-[500] tw-leading-[1.5] tw-text-center' data-index='{{ forloop.index0 }}'
383
+ style="color: {{ section.settings.collapsible_text_color }};"
384
+ >
385
+ {{ collapsible_row.settings.row_content }}
386
+ </div>
387
+ {% endfor %}
388
+ </div>
389
+
390
+ </div>
391
+ </div>
392
+
393
+
394
+
395
+ </div>
396
+
397
+ <style>
398
+ #shopify-section-{{section.id}} {
399
+ width: 100%;
400
+ background: {{ section.settings.bg_color }};
401
+ padding-top: {{ section.settings.mobile_padding_top }}px;
402
+ padding-bottom: {{ section.settings.mobile_padding_bottom }}px;
403
+
404
+ }
405
+ #shopify-section-{{section.id}} .tw-daisy-collapse {
406
+ border-bottom: 1px solid #4C4C4C;
407
+ }
408
+
409
+ #shopify-section-{{section.id}} .row-content a {
410
+ color: #378DDD;
411
+ }
412
+
413
+ #shopify-section-{{section.id}} .tab-item.active {
414
+ font-weight: 700;
415
+ color: {{ section.settings.tab_title_active_color }} !important;
416
+
417
+ }
418
+ #shopify-section-{{section.id}} .content-item.active {
419
+ display: block;
420
+ }
421
+ #shopify-section-{{ section.id }} .collapse-arrow > .tw-daisy-collapse-title::after {
422
+ position: absolute;
423
+ right: 0;
424
+ top: 50%;
425
+ transform: translateY(-50%);
426
+ width: 24px;
427
+ height: 24px;
428
+ transition: all 0.3s;
429
+ content: '';
430
+ width: 20px;
431
+ height: 20px;
432
+ {% if section.settings.collapse_button_color == 'white' %}
433
+ background-image: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 21' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4.34375 8.11816L10.0006 13.775L15.6575 8.11816' stroke='white' stroke-linecap='round'/%3E%3C/svg%3E");
434
+ {% else %}
435
+ background-image: url("data:image/svg+xml,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%3E%3Cpath%20d%3D%22M4.34497%208L10.0018%2013.6569L15.6587%208%22%20stroke%3D%22black%22%20stroke-linecap%3D%22round%22/%3E%3C/svg%3E");
436
+ {% endif %}
437
+
438
+ }
439
+ #shopify-section-{{ section.id }} .collapse-arrow input[type="radio"]:checked ~ .tw-daisy-collapse-title::after {
440
+ transform: translateY(-50%) rotate(180deg);
441
+ }
442
+ #shopify-section-{{ section.id }} .tw-daisy-collapse:last-child {
443
+ border-bottom: none;
444
+ }
445
+ @media screen and (min-width: 1024px) {
446
+ #shopify-section-{{section.id}} {
447
+ padding-top: {{ section.settings.pc_padding_top }}px;
448
+ padding-bottom: {{ section.settings.pc_padding_bottom }}px;
449
+ }
450
+ }
451
+ </style>
452
+
453
+ <script>
454
+ document.addEventListener('DOMContentLoaded', function () {
455
+ const tabs = document.querySelectorAll(
456
+ '#shopify-section-{{section.id}} .tab-item'
457
+ );
458
+ const videos = document.querySelectorAll(
459
+ '#shopify-section-{{section.id}} .video-box'
460
+ );
461
+ const contents = document.querySelectorAll(
462
+ '#shopify-section-{{section.id}} .content-item'
463
+ );
464
+ const collapses = document.querySelectorAll(
465
+ '#shopify-section-{{section.id}} .collasps-video-box'
466
+ );
467
+
468
+ tabs.forEach((tab, index) => {
469
+ tab.addEventListener('click', (e) => {
470
+ // 清除所有激活状态
471
+ tabs.forEach((t) => t.classList.remove('active'));
472
+ videos.forEach((v) => v.classList.add('tw-hidden'));
473
+ contents.forEach((c) => c.classList.remove('active'));
474
+
475
+ // 激活当前选项
476
+ tab.classList.add('active');
477
+ if (videos[index]) videos[index].classList.remove('tw-hidden');
478
+ if (contents[index]) contents[index].classList.add('active');
479
+ });
480
+ });
481
+
482
+ // 默认激活第一个选项
483
+ if (tabs.length > 0) {
484
+ tabs[0].click();
485
+ }
486
+ // 折叠行点击事件处理
487
+ const collaspsRadios = document.querySelectorAll(
488
+ '#shopify-section-{{section.id}} input[type="radio"]'
489
+ );
490
+ console.log('collaspsRadios', collaspsRadios);
491
+ window.handleFAQClick = function (radio) {
492
+ if (radio.checked && radio.getAttribute('data-last-checked') === 'true') {
493
+ radio.checked = false;
494
+ radio.setAttribute('data-last-checked', 'false');
495
+ } else {
496
+ const radios = document.getElementsByName(radio.name);
497
+ radios.forEach((r) => r.setAttribute('data-last-checked', 'false'));
498
+ radio.setAttribute('data-last-checked', 'true');
499
+ }
500
+ // 控制 collasps-video-box 显示与隐藏
501
+ collapses.forEach((collapse, index) => {
502
+ if (radio.value == index + 1) {
503
+ collapse.classList.remove('tw-hidden');
504
+ } else {
505
+ collapse.classList.add('tw-hidden');
506
+ }
507
+ });
508
+ }
509
+
510
+
511
+ // 默认显示第一个 collasps-video-box
512
+ if (collapses.length > 0) {
513
+ collapses.forEach((collapse, index) => {
514
+ if (index === 0) {
515
+ collapse.classList.remove('tw-hidden');
516
+ } else {
517
+ collapse.classList.add('tw-hidden');
518
+ }
519
+ });
520
+ }
521
+ });
522
+ </script>