zz-shopify-components 0.25.1-beta.2 → 0.25.1-beta.4

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>
@@ -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
+
@@ -0,0 +1,92 @@
1
+ <style>
2
+ #shopify-block-{{block.id}} {
3
+ background-color: #F7F8FA;
4
+
5
+ }
6
+ @media screen and (max-width: 1024px) {
7
+ #shopify-block-{{block.id}} {
8
+ border-radius: 10px;
9
+ width: calc(100% - 75px);
10
+ box-sizing: border-box;
11
+ padding: 30px 20px;
12
+ }
13
+ #shopify-block-{{block.id}} .image-video-box {
14
+ }
15
+ }
16
+ @media screen and (min-width: 1024px) {
17
+ #shopify-block-{{block.id}} {
18
+ border-radius: 16px;
19
+ width: 540px;
20
+ box-sizing: border-box;
21
+ padding: 30px;
22
+ }
23
+ }
24
+
25
+
26
+
27
+
28
+ </style>
29
+
30
+ {% assign media_class = 'zz-link-' | append: block.id %}
31
+
32
+ <div class='media-info-box banner-item {{ media_class }} max-md:tw-rounded-[12px] md:tw-rounded-[16px] tw-relative'>
33
+ <div class="zz-title-comment-item-top tw-flex tw-items-center tw-mb-[20px]">
34
+ <img src="{{ block.settings.avatar | image_url }}" width="48" height="48" alt="Avatar" class="zz-title-comment-item-avatar tw-w-[36px] tw-h-[36px] tw-rounded-[90px] lg:tw-w-[40px] lg:tw-h-[40px] lg:tw-rounded-[100px]" />
35
+ <div class="tw-flex-1">
36
+ {% assign nickname_color = block.settings.text_color
37
+ | color_modify: 'alpha', 0.6
38
+ %}
39
+ <p class="zz-title-comment-item-name tw-text-[14px] tw-ml-[12px] tw-font-semibold" style="color: {{ block.settings.text_color }};">{{ block.settings.name }}</p>
40
+ <p class="zz-title-comment-item-nickname tw-text-[14px] tw-ml-[12px]" style="color: {{ nickname_color }};">{{ block.settings.nickname }}</p>
41
+ </div>
42
+ </div>
43
+
44
+ <div class="zz-title-comment-item-content tw-text-[16px] max-lg:tw-text-[14px] tw-leading-[1.3]" style="color: {{ block.settings.text_color }};">{{ block.settings.content }}</div>
45
+
46
+
47
+ </div>
48
+
49
+
50
+ {% schema %}
51
+ {
52
+ "name": "Swiper Comment Item",
53
+ "class": "zz-swiper-comment-item",
54
+ "settings": [
55
+
56
+ {
57
+ "type": "image_picker",
58
+ "id": "avatar",
59
+ "label": "Avatar 头像"
60
+ },
61
+ {
62
+ "type": "text",
63
+ "id": "name",
64
+ "label": "name",
65
+ },
66
+ {
67
+ "type": "text",
68
+ "id": "nickname",
69
+ "label": "nickname",
70
+ },
71
+ {
72
+ "type": "richtext",
73
+ "id": "content",
74
+ "label": "评论内容",
75
+ },
76
+ {
77
+ "type": "color",
78
+ "id": "text_color",
79
+ "label": "文字颜色",
80
+ "default": "#000000"
81
+ },
82
+
83
+
84
+ ],
85
+ "presets": [
86
+ {
87
+ "name": "Swiper Comment Item"
88
+ },
89
+ ]
90
+ }
91
+ {% endschema %}
92
+