zz-shopify-components 0.25.1-beta.3 → 0.25.1-beta.5

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.
@@ -173,26 +173,26 @@ if (!customElements.get('zz-video-popup')) {
173
173
  this.popup = null;
174
174
  }
175
175
 
176
-
177
- connectedCallback() {
178
- this.querySelectorAll('.togglePopup').forEach((el) => {
179
- el.addEventListener('click', (event) => {
180
- console.log('click');
181
- if (event.target.tagName !== 'VIDEO') {
182
- this.togglePopup();
183
- }
176
+
177
+ connectedCallback() {
178
+ this.querySelectorAll('.togglePopup').forEach((el) => {
179
+ el.addEventListener('click', (event) => {
180
+ console.log('click');
181
+ if (event.target.tagName !== 'VIDEO') {
182
+ this.togglePopup();
183
+ }
184
+ });
184
185
  });
185
- });
186
- this.popup = this.querySelector('.popup');
186
+ this.popup = this.querySelector('.popup');
187
187
 
188
-
189
- }
190
188
 
191
- disconnectedCallback() {
192
- if (this.popup && document.body.contains(this.popup)) {
193
- document.body.removeChild(this.popup); // 清理 popup 元素
194
189
  }
195
- }
190
+
191
+ disconnectedCallback() {
192
+ if (this.popup && document.body.contains(this.popup)) {
193
+ document.body.removeChild(this.popup); // 清理 popup 元素
194
+ }
195
+ }
196
196
 
197
197
  togglePopup() {
198
198
  if (!this.popup) return;
@@ -381,16 +381,16 @@ if (!customElements.get('zz-video-popup')) {
381
381
  function isSafari() {
382
382
  const ua = navigator.userAgent;
383
383
  // 包含 Safari / WebKit,且不包含 Chrome / CriOS / FxiOS / Android
384
- return /Safari/.test(ua)
384
+ return /Safari/.test(ua)
385
385
  && /AppleWebKit/.test(ua)
386
386
  && !/CriOS|FxiOS|Chrome|Edg|OPR/.test(ua);
387
387
  }
388
388
 
389
389
  function isSafari26() {
390
- const ua = navigator.userAgent;
391
- if (!isSafari()) return false;
392
- // 检查 “Version/26.0” 或类似标识
393
- return /Version\/26\./.test(ua);
390
+ const ua = navigator.userAgent;
391
+ if (!isSafari()) return false;
392
+ // 检查 “Version/26.0” 或类似标识
393
+ return /Version\/26\./.test(ua);
394
394
  }
395
395
 
396
396
 
@@ -446,4 +446,22 @@ function getVisibleDisplayMedias(container) {
446
446
  }
447
447
  }
448
448
  return null;
449
- }
449
+ }
450
+
451
+ // component 统一的初始化入口
452
+ document.addEventListener('DOMContentLoaded', (event) => {
453
+ const isDesktop = window.innerWidth > 1023;
454
+ if (!isDesktop) {
455
+ const switchCard = document.querySelectorAll('.product-switch-card');
456
+ if (switchCard.length > 0) {
457
+ setInterval(() => {
458
+ switchCard.forEach(card => {
459
+ card.classList.toggle('switchCard');
460
+ });
461
+ }, 3000);
462
+ }
463
+
464
+ }
465
+
466
+
467
+ });
@@ -25,6 +25,12 @@
25
25
  "label": "Text Color",
26
26
  "default": "#ffffff"
27
27
  },
28
+ {
29
+ "type": "color",
30
+ "id": "content_color",
31
+ "label": "Content Color",
32
+ "default": "#ffffff"
33
+ },
28
34
  {
29
35
  "type": "image_picker",
30
36
  "id": "bgImage",
@@ -72,7 +78,7 @@
72
78
  }
73
79
  {% endschema %}
74
80
 
75
- {% assign content_color = block.settings.text_color
81
+ {% assign content_color = block.settings.content_color
76
82
  | color_modify: 'alpha', 0.7
77
83
  %}
78
84
  <div class='bundle-card-item lg:tw-rounded-[16px]
@@ -22,15 +22,26 @@
22
22
  ]
23
23
  }
24
24
  {% endschema %}
25
+ <style>
26
+ #shopify-block-{{ block.id }} {
27
+ display: contents;
28
+ }
29
+ #shopify-block-{{ block.id }} .tw-daisy-tab {
30
+ padding: 12px 28px;
31
+ font-size: 14px;
32
+ line-height: 1.25;
33
+ background: #F5F5F6;
34
+ --tab-padding: 1.25rem;
35
+ }
36
+ </style>
25
37
 
26
38
  <input
27
- type="radio"
28
- name="zz-bundle-compare-item-{{ block.id }}"
29
- role="tab"
30
- class="tw-daisy-tab"
31
- aria-label= {{ block.settings.title }}
32
- checked="checked" />
33
- <div role="tabpanel" class="tw-daisy-tab-content tw-w-full tw-p-10">
34
-
35
- <img src="{{ block.settings.image | image_url }}" alt="{{ block.settings.title }}" class="tw-w-full tw-h-full" />
36
- </div>
39
+ type="radio"
40
+ name="my_tabs_1"
41
+ role="tab"
42
+ class="tw-daisy-tab"
43
+ aria-label="{{ block.settings.title }}"
44
+ checked="checked" />
45
+ <div role="tabpanel" class="tw-daisy-tab-content tw-w-full tw-top-[100px] tw-absolute">
46
+ <img src="{{ block.settings.image | image_url }}" alt="{{ block.settings.title }}" class=" tw-w-[100%]" />
47
+ </div>
@@ -23,11 +23,31 @@
23
23
  ]
24
24
  }
25
25
  {% endschema %}
26
- {% comment %} <div class="zz-bundle-compare-container">
27
- {% content_for 'block', block %}
28
- </div> {% endcomment %}
29
26
 
30
- <div role="tablist" class="tw-daisy-tabs tw-daisy-tabs-bordered">
27
+ <div class=" tw-relative tw-h-[85vh]">
28
+ <div role="tablist" class="tw-daisy-tabs tw-w-full tw-daisy-tabs-bordered tw-overflow-x-auto">
31
29
  {% content_for 'blocks' %}
32
30
  </div>
31
+ </div>
32
+
33
+
34
+
35
+ <style>
36
+ .tw-daisy-tabs-bordered .tw-daisy-tab {
37
+ border-color: var(--fallback-bc,oklch(var(--bc)/var(--tw-border-opacity)));
38
+ --tw-border-opacity: 0.2;
39
+ border-style: solid;
40
+ border-bottom-width: calc(var(--tab-border, 1px) + 1px);
41
+ }
42
+
43
+ #shopify-block-{{ block.id }} .tw-daisy-tabs.tw-overflow-x-auto {
44
+ -ms-overflow-style: none; /* IE、Edge */
45
+ scrollbar-width: none; /* Firefox */
46
+ }
47
+
48
+ #shopify-block-{{ block.id }} .tw-daisy-tabs.tw-overflow-x-auto::-webkit-scrollbar {
49
+ display: none; /* Chrome、Safari */
50
+ }
51
+
33
52
 
53
+ </style>
@@ -171,6 +171,13 @@
171
171
  "info": "非全屏展示时有效",
172
172
  "visible_if": "{{ block.settings.pc_full_width == false }}"
173
173
  },
174
+ {
175
+ "type": "number",
176
+ "id": "pc_padding_x",
177
+ "label": "PC端左右内边距",
178
+ "default": 0,
179
+ "info": "单位:px"
180
+ },
174
181
  {
175
182
  "type": "number",
176
183
  "id": "pc_fixed_height",
@@ -185,6 +192,16 @@
185
192
  "default": 0,
186
193
  "info": "默认自适应高度,单位:px",
187
194
  },
195
+ {
196
+ "type": "range",
197
+ "id": "pc_border_radius",
198
+ "min": 0,
199
+ "max": 50,
200
+ "step": 1,
201
+ "unit": "px",
202
+ "label": "PC端圆角大小",
203
+ "default": 0
204
+ },
188
205
  {
189
206
  "type": "header",
190
207
  "content": "📱 移动端布局设置"
@@ -251,6 +268,16 @@
251
268
  "label": "移动端底部内边距 (px)",
252
269
  "default": 0
253
270
  },
271
+ {
272
+ "type": "range",
273
+ "id": "mobile_border_radius",
274
+ "min": 0,
275
+ "max": 50,
276
+ "step": 1,
277
+ "unit": "px",
278
+ "label": "移动端圆角大小",
279
+ "default": 0
280
+ },
254
281
  {
255
282
  "type": "header",
256
283
  "content": "动画设置"
@@ -281,6 +308,10 @@
281
308
  ],
282
309
  "default": "none-animation"
283
310
  },
311
+ {
312
+ "type": "header",
313
+ "content": "特殊设置"
314
+ },
284
315
  {
285
316
  "type": "checkbox",
286
317
  "id": "has_link",
@@ -333,7 +364,24 @@
333
364
  "id": "overflow_x_hidden",
334
365
  "label": "是否禁止横轴移动",
335
366
  "default": true
336
- }
367
+ },
368
+ {
369
+ "type": "header",
370
+ "content": "统计相关"
371
+ },
372
+ {
373
+ "type": "text",
374
+ "id": "module_id",
375
+ "label": "唯一业务id",
376
+ "info": "需要唯一不要与其他模块重复,用户定位、埋点统计、代码隐藏控制等"
377
+ },
378
+ {
379
+ "type": "checkbox",
380
+ "id": "is_exposure",
381
+ "label": "是否曝光统计",
382
+ "default": false,
383
+ "info": "勾选后会对Block模块进行曝光统计埋点, 必须填写唯一业务id"
384
+ },
337
385
 
338
386
  ],
339
387
  "blocks": [
@@ -456,11 +504,22 @@
456
504
  padding-bottom: {{ block.settings.mobile_padding_bottom }}px;
457
505
  padding-left: {{ block.settings.mobile_padding_x }}px;
458
506
  padding-right: {{ block.settings.mobile_padding_x }}px;
507
+ border-radius: {{ block.settings.mobile_border_radius }}px;
459
508
  {% if block.settings.has_link %}
460
509
  cursor: pointer;
461
510
  {% endif %}
462
511
  }
463
512
 
513
+ {% if block.settings.mobile_border_radius != 0 %}
514
+ #shopify-block-{{ block.id }} .flex-layout-image {
515
+ border-radius: {{ block.settings.mobile_border_radius }}px;
516
+ }
517
+ #shopify-block-{{ block.id }} .flex-layout-video {
518
+ border-radius: {{ block.settings.mobile_border_radius }}px;
519
+ }
520
+ {% endif %}
521
+
522
+
464
523
  @media (min-width: 1024px) {
465
524
  #shopify-block-{{ block.id }} .bg-responsive-block-layout {
466
525
  flex-direction: {{ block.settings.pc_direction }};
@@ -469,11 +528,11 @@
469
528
  gap: {{ block.settings.pc_gap }}px;
470
529
  padding-top: {{ block.settings.pc_padding_top }}px;
471
530
  padding-bottom: {{ block.settings.pc_padding_bottom }}px;
472
- margin-top: {{ block.settings.pc_margin_top }}px;
531
+ padding-left: {{ block.settings.pc_padding_x }}px;
532
+ padding-right: {{ block.settings.pc_padding_x }}px;
533
+ border-radius: {{ block.settings.pc_border_radius }}px;
534
+ margin-top: {{ block.settings.pc_margin_top }}px;
473
535
  margin-bottom: {{ block.settings.pc_margin_bottom }}px;
474
- padding-left: 0px;
475
- padding-right: 0px;
476
-
477
536
  {% if block.settings.pc_full_width %}
478
537
  width: 100%;
479
538
  {% else %}
@@ -491,6 +550,15 @@
491
550
  object-fit: cover;
492
551
  }
493
552
  {% endif %}
553
+
554
+ {% if block.settings.pc_border_radius != 0 %}
555
+ #shopify-block-{{ block.id }} .flex-layout-image {
556
+ border-radius: {{ block.settings.pc_border_radius }}px;
557
+ }
558
+ #shopify-block-{{ block.id }} .flex-layout-video {
559
+ border-radius: {{ block.settings.pc_border_radius }}px;
560
+ }
561
+ {% endif %}
494
562
  }
495
563
 
496
564
  @media (min-width: 1280px) {
@@ -574,7 +642,14 @@
574
642
 
575
643
  {% assign layout_class = 'bg-layout' | append: block.id %}
576
644
 
577
- <div class="bg-responsive-block-layout {{ layout_class }} {{ block.settings.self_animation }} {{ block.settings.child_animation }}">
645
+ <div
646
+ {% if block.settings.module_id != blank %}
647
+ data-track-zz-block="{{ block.settings.module_id }}"
648
+ {% endif %}
649
+ {% if block.settings.is_exposure != false %}
650
+ data-track-zz-exposure="true"
651
+ {% endif %}
652
+ class="bg-responsive-block-layout {{ layout_class }} {{ block.settings.self_animation }} {{ block.settings.child_animation }}">
578
653
 
579
654
  {% content_for 'blocks' %}
580
655
  </div>
@@ -563,7 +563,7 @@
563
563
  {% endif %}
564
564
  {% if block.settings.offset_top_mobile != blank %}
565
565
  position: relative;
566
- top: -{{ block.settings.offset_top_mobile }}px;
566
+ margin-top: -{{ block.settings.offset_top_mobile }}px;
567
567
 
568
568
  {% endif %}
569
569
 
@@ -0,0 +1,147 @@
1
+ <style>
2
+ #shopify-block-{{block.id}} {
3
+ background-color: #1A1A1A;
4
+
5
+ }
6
+ #shopify-block-{{block.id}} .product-img-div {
7
+ width: 100%;
8
+ aspect-ratio: 335 / 252;
9
+ }
10
+ #shopify-block-{{block.id}} .info-btn {
11
+ border: 1px solid #FFFFFF
12
+ }
13
+
14
+ #shopify-block-{{block.id}}.switchCard .product-image {
15
+ opacity: 0;
16
+ }
17
+ #shopify-block-{{block.id}}.switchCard {
18
+ background-color: transparent;
19
+ background-image: url('{{ block.settings.bg_image | image_url }}');
20
+ background-size: cover;
21
+ background-position: center;
22
+ }
23
+ @media screen and (min-width: 1024px) {
24
+ #shopify-block-{{block.id}} {
25
+ flex: 1;
26
+ border-radius: 16px;
27
+ transition: background 0.3s ease;
28
+ }
29
+ #shopify-block-{{block.id}}:hover {
30
+ background-color: transparent;
31
+ background-image: url('{{ block.settings.bg_image | image_url }}');
32
+ background-size: cover;
33
+ background-position: center;
34
+ }
35
+ #shopify-block-{{block.id}}:hover .product-image {
36
+ opacity: 0;
37
+ }
38
+
39
+ }
40
+ @media screen and (max-width: 1024px) {
41
+ #shopify-block-{{block.id}} {
42
+ width: 100%;
43
+ border-radius: 10px;
44
+ }
45
+ }
46
+
47
+
48
+
49
+ </style>
50
+
51
+ <div class="product-img-div tw-w-full">
52
+ {%
53
+ render 'zz-img',
54
+ pc_image: block.settings.product_image,
55
+ mb_image: block.settings.product_image,
56
+ image_alt: block.settings.heading | escape,
57
+ class_name: 'tw-w-full tw-h-full product-image',
58
+ %}
59
+
60
+ </div>
61
+ <div class="tw-pl-[30px] tw-pr-[30px] tw-pb-[30px] lg:tw-pl-[40px] lg:tw-pr-[40px] lg:tw-pb-[40px]">
62
+ {% if block.settings.product_name_image %}
63
+ <img
64
+ class="image-name tw-w-auto tw-h-[38px] lg:tw-h-[54px] "
65
+ src="{{ block.settings.product_name_image | image_url }}"
66
+ alt="x1 pro"
67
+ width="auto" height="54"
68
+ />
69
+ {% else %}
70
+ <p class="tw-text-white tw-text-[20px]">{{ block.settings.product_name }}</p>
71
+ {% endif %}
72
+ <p class="tw-text-[16px] lg:tw-text-[20px] tw-leading-[1.25] tw-mt-[12px] lg:tw-mt-[24px] tw-text-white">{{ block.settings.description }}</p>
73
+ <div class="tw-flex tw-justify-center tw-gap-[15px] tw-items-center tw-mt-[24px] lg:tw-gap-[20px] lg:tw-mt-[30px]">
74
+ <a class="tw-block tw-bg-white tw-text-center tw-flex-1 tw-text-black tw-text-[14px] tw-py-[10px] tw-rounded-[4px]" href="{{ block.settings.left_button_url }}">
75
+ {{ block.settings.left_button_text }}
76
+ </a>
77
+ <a class="info-btn tw-text-white tw-text-[14px] tw-text-center tw-flex-1 tw-py-[10px] tw-rounded-[4px]" href="{{ block.settings.right_button_url }}">
78
+ {{ block.settings.right_button_text }}
79
+ </a>
80
+ </div>
81
+ </div>
82
+
83
+ {% schema %}
84
+ {
85
+ "name": "Product Switch Card",
86
+ "class": "product-switch-card",
87
+ "settings": [
88
+ {
89
+ "type": "image_picker",
90
+ "id": "bg_image",
91
+ "label": "背景图片"
92
+ },
93
+
94
+ {
95
+ "type": "image_picker",
96
+ "id": "product_image",
97
+ "label": "产品图片"
98
+ },
99
+ {
100
+ "type": "image_picker",
101
+ "id": "product_name_image",
102
+ "label": "产品名称,商标图片",
103
+ "info": "兼容带图标的名称"
104
+ },
105
+ {
106
+ "type": "text",
107
+ "id": "product_name",
108
+ "label": "产品名称"
109
+ },
110
+ {
111
+ "type": "text",
112
+ "id": "left_button_text",
113
+ "label": "左侧按钮文字",
114
+ },
115
+ {
116
+ "type": "text",
117
+ "id": "right_button_text",
118
+ "label": "右侧按钮文字",
119
+ },
120
+ {
121
+ "type": "text",
122
+ "id": "description",
123
+ "label": "描述",
124
+ },
125
+ {
126
+ "type": "url",
127
+ "id": "left_button_url",
128
+ "label": "左侧按钮链接",
129
+ },
130
+ {
131
+ "type": "url",
132
+ "id": "right_button_url",
133
+ "label": "右侧按钮链接",
134
+ },
135
+ ],
136
+ "presets": [
137
+ {
138
+ "name": "Product Switch Card"
139
+ },
140
+ ]
141
+ }
142
+ {% endschema %}
143
+
144
+
145
+ <script>
146
+
147
+ </script>
@@ -0,0 +1,142 @@
1
+ <style>
2
+ @media screen and (max-width: 1024px) {
3
+ #shopify-block-{{block.id}} {
4
+ width: calc(100% - 50px);
5
+ box-sizing: border-box;
6
+
7
+ }
8
+ #shopify-block-{{block.id}} .image-video-box {
9
+ width: 100%;
10
+ aspect-ratio: 335 / 252;
11
+ object-fit: cover;
12
+ }
13
+ }
14
+ @media screen and (min-width: 1024px) {
15
+ #shopify-block-{{block.id}} {
16
+ width: 340px;
17
+ }
18
+ #shopify-block-{{block.id}} .image-video-box {
19
+ width: 100%;
20
+ aspect-ratio: 400 / 225;
21
+ object-fit: cover;
22
+ }
23
+ }
24
+ @media screen and (min-width: 1280px) {
25
+ #shopify-block-{{block.id}} {
26
+ width: 400px;
27
+ }
28
+ }
29
+
30
+
31
+
32
+ </style>
33
+
34
+
35
+ <a href="{{ block.settings.url }}" data-track-zz-element="{{ block.settings.click_id }}">
36
+
37
+ <div class='media-box banner-item max-md:tw-rounded-[12px] md:tw-rounded-[16px] tw-relative'>
38
+ {% if block.settings.video_pc != blank %}
39
+
40
+ {% render 'zz-video',
41
+ pc_video: block.settings.video_pc,
42
+ pc_poster: block.settings.poster_pc,
43
+ mb_video: block.settings.video_mb,
44
+ mb_poster: block.settings.poster_mb,
45
+ lazy: true,
46
+ class: 'image-video-box tw-w-full tw-h-auto max-md:tw-rounded-[12px] md:tw-rounded-[16px]',
47
+ autoplay: true,
48
+ muted: true,
49
+ loop: block.settings.video_loop
50
+ %}
51
+ {% else %}
52
+ {%
53
+ render 'zz-img',
54
+ pc_image: block.settings.poster_pc,
55
+ mb_image: block.settings.poster_mb,
56
+ image_alt: block.settings.heading | escape,
57
+ class_name: 'image-video-box max-md:tw-rounded-[12px] md:tw-rounded-[16px]',
58
+ %}
59
+ {% endif %}
60
+ <div class="tw-absolute tw-bottom-[20px] tw-left-[16px] lg:tw-left-[20px]">
61
+ {% if block.settings.heading != blank %}
62
+ <div class= 'tw-text-white/60 tw-text-[12px] lg:tw-text-[16px] tw-font-medium'>
63
+ {{ block.settings.heading }}
64
+ </div>
65
+ {% endif %}
66
+ {% if block.settings.tag_text != blank %}
67
+ <div class='heading-box tw-font-medium tw-text-white lg:tw-text-[20px] max-lg:tw-text-[14px]'>
68
+ {{ block.settings.tag_text }}
69
+ </div>
70
+ {% endif %}
71
+ </div>
72
+
73
+
74
+
75
+ </div>
76
+ </a>
77
+
78
+
79
+
80
+ {% schema %}
81
+ {
82
+ "name": "Swiper Blog Item",
83
+ "class": "zz-swiper-blog-item",
84
+ "settings": [
85
+ {
86
+ "type": "video",
87
+ "id": "video_pc",
88
+ "label": "Video"
89
+ },
90
+ {
91
+ "type": "checkbox",
92
+ "id": "video_loop",
93
+ "label": "视频循环播放",
94
+ "default": false
95
+ },
96
+ {
97
+ "type": "image_picker",
98
+ "id": "poster_pc",
99
+ "label": "Poster",
100
+ "info": "不配置视频就展示这个图"
101
+ },
102
+ {
103
+ "type": "video",
104
+ "id": "video_mb",
105
+ "label": "Video(Mobile)"
106
+ },
107
+ {
108
+ "type": "image_picker",
109
+ "id": "poster_mb",
110
+ "label": "Poster(Mobile)",
111
+ "info": "不配置视频就展示这个图"
112
+ },
113
+ {
114
+ "type": "text",
115
+ "id": "heading",
116
+ "label": "标题",
117
+ },
118
+ {
119
+ "type": "text",
120
+ "id": "tag_text",
121
+ "label": "标签文案",
122
+ },
123
+ {
124
+ "type": "url",
125
+ "id": "url",
126
+ "label": "链接",
127
+ },
128
+ {
129
+ "type": "text",
130
+ "id": "click_id",
131
+ "label": "点击统计id",
132
+ },
133
+ ],
134
+ "presets": [
135
+ {
136
+ "name": "Swiper Blog Item",
137
+ "category": "Swiper Block"
138
+ },
139
+ ]
140
+ }
141
+ {% endschema %}
142
+