unika-components 1.0.183 → 1.0.184

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.
@@ -1,7 +1,36 @@
1
-
2
- .uni-image-component {
3
- max-width: 100%;
4
- }
1
+
2
+ .uni-video-component {
3
+ position: relative;
4
+ text-align: center;
5
+ }
6
+ .play-pause-button {
7
+ position: absolute;
8
+ top: 50%;
9
+ left: 50%;
10
+ transform: translate(-50%, -50%);
11
+ cursor: pointer;
12
+ font-size: 2rem;
13
+ color: #fff;
14
+ background: rgba(0, 0, 0, 0.6);
15
+ border-radius: 50%;
16
+ padding: 10px;
17
+ transition: background 0.3s;
18
+ }
19
+ .play-pause-button:hover {
20
+ background: rgba(0, 0, 0, 0.8);
21
+ }
22
+
23
+
24
+ .uni-calendar-component {
25
+
26
+ }
27
+ .slot-number {
28
+ position: absolute;
29
+ bottom: 2px;
30
+ left: 7px;
31
+ font-size: 12px;
32
+ color: #666
33
+ }
5
34
 
6
35
  h2.uni-text-component, p.uni-text-component {
7
36
  margin-bottom: 0;
@@ -14,28 +43,6 @@ button.uni-text-component {
14
43
  box-sizing: border-box;
15
44
  white-space: pre-wrap;
16
45
  }
17
-
18
- .like-button {
19
- display: flex;
20
- flex-direction: column;
21
- align-items: center;
22
- cursor: pointer;
23
- }
24
-
25
- .icon-heart {
26
- font-size: 24px;
27
- color: #e74c3c;
28
- }
29
-
30
- .liked {
31
- color: #f00; /* 更改颜色以示已赞 */
32
- }
33
-
34
- .like-count {
35
- margin-top: 4px;
36
- font-size: 16px;
37
- color: #333;
38
- }
39
46
 
40
47
  .slide-guide {
41
48
  position: absolute;
@@ -109,39 +116,32 @@ body, html {
109
116
  transform: translate3d(-50%, -50%, 0);
110
117
  }
111
118
  }
119
+
120
+ .uni-image-component {
121
+ max-width: 100%;
122
+ }
112
123
 
124
+ .like-button {
125
+ display: flex;
126
+ flex-direction: column;
127
+ align-items: center;
128
+ cursor: pointer;
129
+ }
113
130
 
114
- .uni-calendar-component {
115
-
131
+ .icon-heart {
132
+ font-size: 24px;
133
+ color: #e74c3c;
116
134
  }
117
- .slot-number {
118
- position: absolute;
119
- bottom: 2px;
120
- left: 7px;
121
- font-size: 12px;
122
- color: #666
135
+
136
+ .liked {
137
+ color: #f00; /* 更改颜色以示已赞 */
123
138
  }
124
139
 
125
- .uni-video-component {
126
- position: relative;
127
- text-align: center;
128
- }
129
- .play-pause-button {
130
- position: absolute;
131
- top: 50%;
132
- left: 50%;
133
- transform: translate(-50%, -50%);
134
- cursor: pointer;
135
- font-size: 2rem;
136
- color: #fff;
137
- background: rgba(0, 0, 0, 0.6);
138
- border-radius: 50%;
139
- padding: 10px;
140
- transition: background 0.3s;
141
- }
142
- .play-pause-button:hover {
143
- background: rgba(0, 0, 0, 0.8);
144
- }
140
+ .like-count {
141
+ margin-top: 4px;
142
+ font-size: 16px;
143
+ color: #333;
144
+ }
145
145
 
146
146
  .effect {
147
147
  width: 100%;
@@ -196,6 +196,10 @@ body, html {
196
196
  max-width: 100%;
197
197
  max-height: 100%;
198
198
  }
199
+
200
+ .uni-svg-component {
201
+ display: inline-block;
202
+ }
199
203
 
200
204
  .uni-build-up-component {
201
205
  }
@@ -94318,7 +94318,7 @@ axios.default = axios;
94318
94318
  var axios$1 = axios;
94319
94319
 
94320
94320
  const defaultProps = transformToComponentProps(componentsDefaultProps['uni-svg'].props, isEditingProp);
94321
- const defaultStyles = without$1(Object.keys(componentsDefaultProps['uni-svg'].props), 'actionType', 'url', 'color', 'svgSrc');
94321
+ const defaultStyles = without$1(Object.keys(svgDefaultProps), 'actionType', 'url', 'color', 'svgSrc');
94322
94322
  var script = defineComponent({
94323
94323
  name: 'uni-svg',
94324
94324
  props: {
@@ -94328,35 +94328,39 @@ var script = defineComponent({
94328
94328
  const styleProps = useStylePick(props, defaultStyles);
94329
94329
  const handleClick = useComponentClick(props);
94330
94330
  const svgContent = ref('');
94331
- // Function to fetch SVG content from the URL
94332
94331
  const fetchSvg = (url) => {
94333
- try {
94334
- const response = axios$1.get(url, {
94335
- headers: {
94336
- Accept: 'image/svg+xml'
94337
- }
94338
- });
94339
- return response;
94340
- }
94341
- catch (error) {
94332
+ return axios$1.get(url, {
94333
+ headers: {
94334
+ Accept: 'image/svg+xml'
94335
+ }
94336
+ }).then(response => response.data)
94337
+ .catch(error => {
94342
94338
  console.error('Error fetching SVG:', error);
94343
94339
  return '';
94340
+ });
94341
+ };
94342
+ const updateSvgColor = (svg, color, width, height) => {
94343
+ const parser = new DOMParser();
94344
+ const svgDoc = parser.parseFromString(svg, 'image/svg+xml');
94345
+ const svgElement = svgDoc.getElementsByTagName('svg')[0];
94346
+ const paths = svgDoc.getElementsByTagName('path');
94347
+ for (let i = 0; i < paths.length; i++) {
94348
+ paths[i].setAttribute('fill', color);
94344
94349
  }
94350
+ if (svgElement) {
94351
+ svgElement.setAttribute('width', width);
94352
+ svgElement.setAttribute('height', height);
94353
+ }
94354
+ return new XMLSerializer().serializeToString(svgDoc);
94345
94355
  };
94346
- // Function to load and color the SVG
94347
- const loadSvg = (svgSrc) => {
94348
- fetchSvg(svgSrc);
94349
- // if (svg) {
94350
- // svgContent.value = updateSvgColor(svg, props.color, props.width, props.height)
94351
- // }
94356
+ const loadSvg = () => {
94357
+ fetchSvg(props.svgSrc).then(svg => {
94358
+ if (svg) {
94359
+ svgContent.value = updateSvgColor(svg, props.color, props.width, props.height);
94360
+ }
94361
+ });
94352
94362
  };
94353
- // watch(() => props.svgSrc, loadSvg, { immediate: true })
94354
- // watch(() => props.color, loadSvg)
94355
- // watch(() => props.width, loadSvg)
94356
- // watch(() => props.height, loadSvg)
94357
- watch(() => props.svgSrc, (newValue, oldValue) => {
94358
- loadSvg(newValue);
94359
- }, { deep: true });
94363
+ watch([() => props.svgSrc, () => props.color, () => props.width, () => props.height], loadSvg, { immediate: true });
94360
94364
  return {
94361
94365
  styleProps,
94362
94366
  handleClick,
@@ -94379,6 +94383,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
94379
94383
  }
94380
94384
 
94381
94385
  script.render = render;
94386
+ script.__scopeId = "data-v-42564b0f";
94382
94387
  script.__file = "src/components/UniSvg/UniSvg.vue";
94383
94388
 
94384
94389
  script.install = (app) => {
@@ -94324,7 +94324,7 @@ summary tabindex target title type usemap value width wmode wrap`;
94324
94324
  var axios$1 = axios;
94325
94325
 
94326
94326
  const defaultProps = transformToComponentProps(componentsDefaultProps['uni-svg'].props, isEditingProp);
94327
- const defaultStyles = without$1(Object.keys(componentsDefaultProps['uni-svg'].props), 'actionType', 'url', 'color', 'svgSrc');
94327
+ const defaultStyles = without$1(Object.keys(svgDefaultProps), 'actionType', 'url', 'color', 'svgSrc');
94328
94328
  var script = vue.defineComponent({
94329
94329
  name: 'uni-svg',
94330
94330
  props: {
@@ -94334,35 +94334,39 @@ summary tabindex target title type usemap value width wmode wrap`;
94334
94334
  const styleProps = useStylePick(props, defaultStyles);
94335
94335
  const handleClick = useComponentClick(props);
94336
94336
  const svgContent = vue.ref('');
94337
- // Function to fetch SVG content from the URL
94338
94337
  const fetchSvg = (url) => {
94339
- try {
94340
- const response = axios$1.get(url, {
94341
- headers: {
94342
- Accept: 'image/svg+xml'
94343
- }
94344
- });
94345
- return response;
94346
- }
94347
- catch (error) {
94338
+ return axios$1.get(url, {
94339
+ headers: {
94340
+ Accept: 'image/svg+xml'
94341
+ }
94342
+ }).then(response => response.data)
94343
+ .catch(error => {
94348
94344
  console.error('Error fetching SVG:', error);
94349
94345
  return '';
94346
+ });
94347
+ };
94348
+ const updateSvgColor = (svg, color, width, height) => {
94349
+ const parser = new DOMParser();
94350
+ const svgDoc = parser.parseFromString(svg, 'image/svg+xml');
94351
+ const svgElement = svgDoc.getElementsByTagName('svg')[0];
94352
+ const paths = svgDoc.getElementsByTagName('path');
94353
+ for (let i = 0; i < paths.length; i++) {
94354
+ paths[i].setAttribute('fill', color);
94350
94355
  }
94356
+ if (svgElement) {
94357
+ svgElement.setAttribute('width', width);
94358
+ svgElement.setAttribute('height', height);
94359
+ }
94360
+ return new XMLSerializer().serializeToString(svgDoc);
94351
94361
  };
94352
- // Function to load and color the SVG
94353
- const loadSvg = (svgSrc) => {
94354
- fetchSvg(svgSrc);
94355
- // if (svg) {
94356
- // svgContent.value = updateSvgColor(svg, props.color, props.width, props.height)
94357
- // }
94362
+ const loadSvg = () => {
94363
+ fetchSvg(props.svgSrc).then(svg => {
94364
+ if (svg) {
94365
+ svgContent.value = updateSvgColor(svg, props.color, props.width, props.height);
94366
+ }
94367
+ });
94358
94368
  };
94359
- // watch(() => props.svgSrc, loadSvg, { immediate: true })
94360
- // watch(() => props.color, loadSvg)
94361
- // watch(() => props.width, loadSvg)
94362
- // watch(() => props.height, loadSvg)
94363
- vue.watch(() => props.svgSrc, (newValue, oldValue) => {
94364
- loadSvg(newValue);
94365
- }, { deep: true });
94369
+ vue.watch([() => props.svgSrc, () => props.color, () => props.width, () => props.height], loadSvg, { immediate: true });
94366
94370
  return {
94367
94371
  styleProps,
94368
94372
  handleClick,
@@ -94385,6 +94389,7 @@ summary tabindex target title type usemap value width wmode wrap`;
94385
94389
  }
94386
94390
 
94387
94391
  script.render = render;
94392
+ script.__scopeId = "data-v-42564b0f";
94388
94393
  script.__file = "src/components/UniSvg/UniSvg.vue";
94389
94394
 
94390
94395
  script.install = (app) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unika-components",
3
- "version": "1.0.183",
3
+ "version": "1.0.184",
4
4
  "private": false,
5
5
  "main": "dist/unika-components.umd.js",
6
6
  "module": "dist/unika-components.esm.js",