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,270 @@
1
+ {% schema %}
2
+ {
3
+ "name": "Mobile Swiper PC Flex",
4
+ "class": "flex-layout-block",
5
+ "settings": [
6
+ {
7
+ "type": "color_background",
8
+ "id": "background_color",
9
+ "label": "背景颜色",
10
+ "default": "rgba(0,0,0,0)"
11
+ },
12
+ {
13
+ "type": "header",
14
+ "content": "💻 PC端布局设置"
15
+ },
16
+ {
17
+ "type": "number",
18
+ "id": "pc_gap",
19
+ "label": "区块间距 (Gap)",
20
+ "default": 40
21
+ },
22
+ {
23
+ "type": "number",
24
+ "id": "pc_padding_top",
25
+ "label": "PC端顶部内边距 (px)",
26
+ "default": 40
27
+ },
28
+ {
29
+ "type": "number",
30
+ "id": "pc_padding_bottom",
31
+ "label": "PC端底部内边距 (px)",
32
+ "default": 40
33
+ },
34
+ {
35
+ "type": "number",
36
+ "id": "pc_xl_width",
37
+ "label": "XL屏幕内容区域宽度 (px)",
38
+ "default": 1220
39
+ },
40
+ {
41
+ "type": "number",
42
+ "id": "pc_lg_width",
43
+ "label": "LG屏幕内容区域宽度 (vw)",
44
+ "default": 95
45
+ },
46
+ {
47
+ "type": "select",
48
+ "id": "pc_justify",
49
+ "label": "PC主轴对齐 (Justify Content)",
50
+ "options": [
51
+ { "value": "flex-start", "label": "起始对齐 (Flex Start)" },
52
+ { "value": "center", "label": "居中对齐 (Center)" },
53
+ { "value": "flex-end", "label": "末尾对齐 (Flex End)" },
54
+ { "value": "space-between", "label": "两端对齐 (Space Between)" },
55
+ { "value": "space-around", "label": "平均间距 (Space Around)" }
56
+ ],
57
+ "default": "center"
58
+ },
59
+ {
60
+ "type": "select",
61
+ "id": "pc_align",
62
+ "label": "PC交叉轴对齐 (Align Items)",
63
+ "options": [
64
+ { "value": "flex-start", "label": "起始对齐 (Flex Start)" },
65
+ { "value": "center", "label": "居中对齐 (Center)" },
66
+ { "value": "flex-end", "label": "末尾对齐 (Flex End)" }
67
+ ],
68
+ "default": "center"
69
+ },
70
+ {
71
+ "type": "header",
72
+ "content": "📱 移动端 Swiper 设置"
73
+ },
74
+ {
75
+ "type": "number",
76
+ "id": "swiper_slide_padding_x",
77
+ "label": "轮播块与屏幕左右边距 (px)",
78
+ "default": 20
79
+ },
80
+ {
81
+ "type": "number",
82
+ "id": "swiper_slide_height",
83
+ "label": "轮播块高度 (px)",
84
+ "default": 374
85
+ },
86
+ {
87
+ "type": "select",
88
+ "id": "swiper_nav_style",
89
+ "label": "切换按钮样式",
90
+ "options": [
91
+ { "value": "dark", "label": "深色" },
92
+ { "value": "light", "label": "浅色" }
93
+ ],
94
+ "default": "light"
95
+ },
96
+ {
97
+ "type": "number",
98
+ "id": "mobile_padding_top",
99
+ "label": "移动端顶部内边距 (px)",
100
+ "default": 32
101
+ },
102
+ {
103
+ "type": "number",
104
+ "id": "mobile_padding_bottom",
105
+ "label": "移动端底部内边距 (px)",
106
+ "default": 32
107
+ }
108
+ ],
109
+ "blocks": [
110
+ {
111
+ "type": "@theme"
112
+ }
113
+ ],
114
+ "presets": [
115
+ {
116
+ "name": "移动端轮播 & PC左右布局"
117
+ }
118
+ ]
119
+ }
120
+ {% endschema %}
121
+
122
+ {% assign block_size = block.blocks.size %}
123
+ {% assign bullets_width_half = block_size
124
+ | minus: 1
125
+ | times: 14
126
+ | plus: 6
127
+ | divided_by: 2.0
128
+ | ceil
129
+ %}
130
+ {% assign btn_offset = bullets_width_half | plus: 14 | plus: 36 %}
131
+
132
+ <div class='swiper zz-mb-swiper-pc-flex'>
133
+ <div class='swiper-wrapper lg:tw-flex'>
134
+ {% content_for 'blocks' %}
135
+ </div>
136
+ <div class='swiper-button-prev {% if block_size <= 1 %} tw-hidden {% endif %} lg:tw-hidden'>
137
+ {% if block.settings.swiper_nav_style == 'light' %}
138
+ {% render 'icon-prev-light' %}
139
+ {% else %}
140
+ {% render 'icon-prev-dark' %}
141
+ {% endif %}
142
+ </div>
143
+ <div class='swiper-button-next {% if block_size <= 1 %} tw-hidden {% endif %} lg:tw-hidden'>
144
+ {% if block.settings.swiper_nav_style == 'light' %}
145
+ {% render 'icon-next-light' %}
146
+ {% else %}
147
+ {% render 'icon-next-dark' %}
148
+ {% endif %}
149
+ </div>
150
+ <div class='swiper-pagination {% if block_size <= 1 %} tw-hidden {% endif %} lg:tw-hidden'></div>
151
+ </div>
152
+
153
+ <script>
154
+ document.addEventListener('DOMContentLoaded', function () {
155
+ // 移动端添加轮播
156
+ if (window.innerWidth < 1024) {
157
+ (function() {
158
+ const bannerImageSwiper = new Swiper(
159
+ '#shopify-block-{{ block.id }} .zz-mb-swiper-pc-flex',
160
+ {
161
+ slidesPerView: 'auto',
162
+ centeredSlides: true,
163
+ spaceBetween: 8,
164
+ navigation: {
165
+ nextEl: '.swiper-button-next',
166
+ prevEl: '.swiper-button-prev',
167
+ },
168
+ pagination: {
169
+ el: '#shopify-block-{{ block.id }} .swiper-pagination',
170
+ clickable: true,
171
+ },
172
+ effect: 'slide',
173
+ }
174
+ );
175
+ })();
176
+
177
+ (function() {
178
+ // 获取 class zz-mb-swiper-pc-flex 的元素 且data-id 为 block.id 的元素
179
+ const zzMbSwiper = document.querySelector(`#shopify-block-{{ block.id }} .zz-mb-swiper-pc-flex`);
180
+ // 获取当前 swiper-wrapper 下面 所有 第一层 div
181
+ const swiperSlides = zzMbSwiper.querySelectorAll('.swiper-wrapper > div');
182
+ // 给每个 swiper-slide 添加 class swiper-slide
183
+ swiperSlides.forEach(slide => {
184
+ slide.classList.add('swiper-slide');
185
+ });
186
+ })();
187
+ }
188
+ });
189
+ </script>
190
+
191
+ <style>
192
+ #shopify-block-{{ block.id }} {
193
+ background-color: {{ block.settings.background_color }};
194
+ padding-top: {{ block.settings.mobile_padding_top }}px;
195
+ padding-bottom: {{ block.settings.mobile_padding_bottom }}px;
196
+ }
197
+
198
+ @media (min-width: 1024px) {
199
+ #shopify-block-{{ block.id }} {
200
+ padding-top: {{ block.settings.pc_padding_top }}px;
201
+ padding-bottom: {{ block.settings.pc_padding_bottom }}px;
202
+ padding-left: 0px;
203
+ padding-right: 0px;
204
+ width: 100%;
205
+ }
206
+ #shopify-block-{{ block.id }} .swiper-wrapper {
207
+ display: flex;
208
+ gap: {{ block.settings.pc_gap }}px;
209
+ justify-content: {{ block.settings.pc_justify }};
210
+ align-items: {{ block.settings.pc_align }};
211
+ width: {{ block.settings.pc_lg_width }}vw;
212
+ margin: 0 auto;
213
+ }
214
+ }
215
+
216
+ @media (min-width: 1280px) {
217
+ #shopify-block-{{ block.id }} .swiper-wrapper {
218
+ width: {{ block.settings.pc_xl_width }}px;
219
+ margin: 0 auto;
220
+ }
221
+ }
222
+
223
+ @media screen and (max-width: 1023px) {
224
+ #shopify-block-{{ block.id }} .swiper-wrapper {
225
+ padding-bottom: 60px;
226
+ }
227
+ #shopify-block-{{ block.id }} .swiper-slide {
228
+ width: calc(100% - 40px);
229
+ height: {{ block.settings.swiper_slide_height }}px;
230
+ overflow: hidden;
231
+ }
232
+ #shopify-block-{{ block.id }} .swiper-button-next,
233
+ #shopify-block-{{ block.id }} .swiper-button-prev {
234
+ z-index: 99;
235
+ top: unset;
236
+ bottom: 0;
237
+ width: 36px;
238
+ height: 36px;
239
+ }
240
+ #shopify-block-{{ block.id }} .swiper-button-next:after,
241
+ #shopify-block-{{ block.id }} .swiper-button-prev:after {
242
+ display: none;
243
+ }
244
+ #shopify-block-{{ block.id }} .swiper-button-prev {
245
+ left: 50%;
246
+ transform: translate(-{{ btn_offset }}px, 0px);
247
+ }
248
+ #shopify-block-{{ block.id }} .swiper-button-next {
249
+ left: unset;
250
+ right: 50%;
251
+ transform: translate({{ btn_offset }}px, 0px);
252
+ }
253
+ #shopify-block-{{ block.id }} .swiper-pagination-bullets .swiper-pagination-bullet {
254
+ margin: 0 4px;
255
+ width: 6px;
256
+ height: 6px;
257
+ {% if block.settings.swiper_nav_style == 'light' %}
258
+ background: #000000;
259
+ opacity: 0.3;
260
+ {% else %}
261
+ background: #ffffff;
262
+ opacity: 0.5;
263
+ {% endif %}
264
+ }
265
+ #shopify-block-{{ block.id }} .swiper-pagination-bullets .swiper-pagination-bullet.swiper-pagination-bullet-active {
266
+ width: 6px;
267
+ opacity: 1;
268
+ }
269
+ }
270
+ </style>
@@ -0,0 +1,177 @@
1
+ {% schema %}
2
+ {
3
+ "name": "Ratio Image",
4
+ "class": "ratio-image",
5
+ "settings": [
6
+ {
7
+ "type": "header",
8
+ "content": "PC端设置"
9
+ },
10
+ {
11
+ "type": "image_picker",
12
+ "id": "desktop_image",
13
+ "label": "PC端图片"
14
+ },
15
+ {
16
+ "type": "range",
17
+ "id": "pc_width",
18
+ "min": 0,
19
+ "max": 100,
20
+ "step": 1,
21
+ "unit": "%",
22
+ "label": "PC端占父容器的百分比,单位%",
23
+ "default": 50
24
+ },
25
+ {
26
+ "type": "number",
27
+ "id": "desktop_border_radius",
28
+ "label": "PC端圆角",
29
+ "default": 16,
30
+ "info": "单位:px"
31
+ },
32
+ {
33
+ "type": "header",
34
+ "content": "移动端设置"
35
+ },
36
+ {
37
+ "type": "image_picker",
38
+ "id": "mobile_image",
39
+ "label": "移动端图片"
40
+ },
41
+ {
42
+ "type": "range",
43
+ "id": "mobile_width",
44
+ "min": 0,
45
+ "max": 100,
46
+ "step": 1,
47
+ "unit": "%",
48
+ "label": "移动端占父容器的百分比,单位%",
49
+ "default": 100
50
+ },
51
+ {
52
+ "type": "number",
53
+ "id": "mobile_border_radius",
54
+ "label": "移动端圆角",
55
+ "default": 10,
56
+ "info": "单位:px"
57
+ },
58
+ {
59
+ "type": "text",
60
+ "id": "alt",
61
+ "label": "alt",
62
+ "default": "image loading"
63
+ },
64
+ {
65
+ "type": "checkbox",
66
+ "id": "has_link",
67
+ "label": "是否有链接",
68
+ "default": false
69
+ },
70
+ {
71
+ "type": "select",
72
+ "id": "function_type",
73
+ "label": "功能类型",
74
+ "options": [
75
+ {
76
+ "value": "link",
77
+ "label": "链接"
78
+ },
79
+ {
80
+ "value": "link_map",
81
+ "label": "多国家映射"
82
+ },
83
+ ],
84
+ "default": "link",
85
+ "visible_if": "{{ block.settings.has_link == true }}"
86
+ },
87
+ {
88
+ "type": "url",
89
+ "id": "url",
90
+ "label": "链接",
91
+ "visible_if": "{{ block.settings.function_type == 'link' and block.settings.has_link == true }}"
92
+ },
93
+ {
94
+ "type": "textarea",
95
+ "id": "links",
96
+ "label": "Sites Link Map",
97
+ "info": "国家对应链接的表,国家即是国家选择器上显示的字段,国家和路由之间用冒号隔开( 冒号后要加空格)。国家之间换行,“default”为其他未写的默认的链接 EG: Canada: https://hoverair.com/ default: https://hoverair.com/ ",
98
+ "visible_if": "{{ block.settings.function_type == 'link_map' and block.settings.has_link == true }}"
99
+ },
100
+
101
+ ],
102
+ "presets": [
103
+ {
104
+ "name": "宽度比例图片"
105
+ }
106
+ ]
107
+ }
108
+ {% endschema %}
109
+
110
+ {% assign link_class = 'zz-link-' | append: block.id %}
111
+ {% assign image_class = 'ratio-image ' | append: link_class %}
112
+
113
+ {% render 'zz-img',
114
+ pc_image: block.settings.desktop_image,
115
+ mb_image: block.settings.mobile_image,
116
+ image_alt: block.settings.alt | escape,
117
+ class_name: image_class,
118
+ %}
119
+
120
+ <style>
121
+
122
+ #shopify-block-{{ block.id }} {
123
+ {% if block.settings.has_link %}
124
+ cursor: pointer;
125
+ {% endif %}
126
+ overflow: hidden;
127
+ }
128
+
129
+ @media screen and (max-width: 1023px) {
130
+ #shopify-block-{{ block.id }} {
131
+ width: {% if block.settings.mobile_width > 0 %}{{ block.settings.mobile_width }}%{% else %}100%{% endif %};
132
+ border-radius: {{ block.settings.mobile_border_radius }}px;
133
+ }
134
+
135
+ }
136
+ @media screen and (min-width: 1024px) {
137
+ #shopify-block-{{ block.id }} {
138
+ width: {% if block.settings.pc_width > 0 %}{{ block.settings.pc_width }}%{% else %}100%{% endif %};
139
+ border-radius: {{ block.settings.desktop_border_radius }}px;
140
+ }
141
+ }
142
+
143
+
144
+ </style>
145
+
146
+ {% if block.settings.has_link %}
147
+ {% if block.settings.function_type == 'link_map' %}
148
+ <script>
149
+ document.addEventListener('DOMContentLoaded', (event) => {
150
+ const btn = document.getElementsByClassName('{{ link_class }}')
151
+ if(btn && btn.length > 0) {
152
+ Array.from(btn).forEach(item => {
153
+ bindSiteJump(item, {{ block.settings.links | json }})
154
+ })
155
+ }
156
+ })
157
+ </script>
158
+ {% else %}
159
+ <script>
160
+ document.addEventListener('DOMContentLoaded', (event) => {
161
+
162
+ const btn = document.getElementsByClassName('{{ link_class }}')
163
+ if(btn && btn.length > 0) {
164
+ Array.from(btn).forEach(item => {
165
+ item.addEventListener('click', (event) => {
166
+ event.preventDefault();
167
+ // 阻止冒泡
168
+ event.stopPropagation();
169
+ window.location.href = '{{ block.settings.url }}';
170
+ })
171
+ })
172
+ }
173
+ })
174
+ </script>
175
+ {% endif %}
176
+
177
+ {% endif %}
@@ -0,0 +1,112 @@
1
+ {% schema %}
2
+ {
3
+ "name": "Ratio Video",
4
+ "class": "ratio-video",
5
+ "settings": [
6
+ {
7
+ "type": "header",
8
+ "content": "PC端设置"
9
+ },
10
+ {
11
+ "type": "video",
12
+ "id": "video_pc",
13
+ "label": "PC端视频"
14
+ },
15
+ {
16
+ "type": "image_picker",
17
+ "id": "poster_pc",
18
+ "label": "PC端视频 封面"
19
+ },
20
+ {
21
+ "type": "range",
22
+ "id": "pc_width",
23
+ "min": 0,
24
+ "max": 100,
25
+ "step": 1,
26
+ "unit": "%",
27
+ "label": "PC端占父容器的百分比,单位%",
28
+ "default": 50
29
+ },
30
+ {
31
+ "type": "number",
32
+ "id": "desktop_border_radius",
33
+ "label": "PC端圆角",
34
+ "default": 16,
35
+ "info": "单位:px"
36
+ },
37
+ {
38
+ "type": "header",
39
+ "content": "移动端设置"
40
+ },
41
+ {
42
+ "type": "video",
43
+ "id": "video_mb",
44
+ "label": "移动端视频"
45
+ },
46
+ {
47
+ "type": "image_picker",
48
+ "id": "poster_mb",
49
+ "label": "移动端视频封面"
50
+ },
51
+
52
+ {
53
+ "type": "range",
54
+ "id": "mobile_width",
55
+ "min": 0,
56
+ "max": 100,
57
+ "step": 1,
58
+ "unit": "%",
59
+ "label": "移动端占父容器的百分比,单位%",
60
+ "default": 100
61
+ },
62
+ {
63
+ "type": "number",
64
+ "id": "mobile_border_radius",
65
+ "label": "移动端圆角",
66
+ "default": 10,
67
+ "info": "单位:px"
68
+ },
69
+
70
+ ],
71
+ "presets": [
72
+ {
73
+ "name": "宽度比例视频",
74
+
75
+ }
76
+ ]
77
+ }
78
+ {% endschema %}
79
+
80
+
81
+ {% render 'zz-video',
82
+ pc_video: block.settings.video_pc,
83
+ pc_poster: block.settings.poster_pc,
84
+ mb_video: block.settings.video_mb,
85
+ mb_poster: block.settings.poster_mb,
86
+ lazy: true,
87
+ class: 'ratio-video tw-w-full tw-h-auto',
88
+ autoplay: true,
89
+ loop: true,
90
+ muted: true
91
+ %}
92
+
93
+ <style>
94
+
95
+ #shopify-block-{{ block.id }} {
96
+ width: {% if block.settings.mobile_width > 0 %}{{ block.settings.mobile_width }}%{% else %}100%{% endif %};
97
+ border-radius: {{ block.settings.mobile_border_radius }}px;
98
+ overflow: hidden;
99
+ box-sizing: border-box;
100
+ overflow: hidden;
101
+ }
102
+
103
+
104
+ @media screen and (min-width: 1024px) {
105
+ #shopify-block-{{ block.id }} {
106
+ width: {% if block.settings.pc_width > 0 %}{{ block.settings.pc_width }}%{% else %}100%{% endif %};
107
+ border-radius: {{ block.settings.desktop_border_radius }}px;
108
+ }
109
+ }
110
+
111
+
112
+ </style>