renusify 2.5.2 → 3.0.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 (212) hide show
  1. package/components/app/index.vue +74 -22
  2. package/components/app/toast/index.vue +76 -71
  3. package/components/app/toast/toast.vue +62 -44
  4. package/components/avatar/index.vue +207 -84
  5. package/components/button/buttonConfirm.vue +53 -26
  6. package/components/button/buttonGroup.js +0 -2
  7. package/components/button/buttonGroup.vue +310 -62
  8. package/components/button/index.vue +584 -100
  9. package/components/calendar/index.js +0 -2
  10. package/components/calendar/index.vue +326 -262
  11. package/components/calendar/month.vue +64 -55
  12. package/components/calendar/year.vue +30 -25
  13. package/components/card/index.vue +139 -59
  14. package/components/codeEditor/highlightCss.vue +38 -39
  15. package/components/codeEditor/highlightHtml.vue +64 -64
  16. package/components/codeEditor/highlightJs.vue +37 -38
  17. package/components/codeEditor/index.vue +129 -79
  18. package/components/codeEditor/run.vue +225 -39
  19. package/components/codeEditor/useCodeFormatter.js +150 -0
  20. package/components/confirm/index.vue +139 -80
  21. package/components/container/col.vue +5 -4
  22. package/components/container/divider.vue +28 -19
  23. package/components/container/index.vue +34 -15
  24. package/components/container/row.vue +26 -9
  25. package/components/container/spacer.vue +2 -4
  26. package/components/container/style.scss +3 -0
  27. package/components/content/index.vue +49 -32
  28. package/components/cropper/index.vue +401 -244
  29. package/components/float/index.vue +542 -415
  30. package/components/form/addressInput/index.vue +184 -109
  31. package/components/form/camInput/index.vue +370 -244
  32. package/components/form/checkInput/index.vue +138 -71
  33. package/components/form/checkboxInput/index.vue +93 -49
  34. package/components/form/colorInput/Alpha.vue +81 -83
  35. package/components/form/colorInput/Hue.vue +91 -68
  36. package/components/form/colorInput/Preview.vue +43 -47
  37. package/components/form/colorInput/Saturation.vue +101 -86
  38. package/components/form/colorInput/index.vue +71 -39
  39. package/components/form/colorInput/picker.vue +111 -106
  40. package/components/form/colorInput/useColor.js +153 -0
  41. package/components/form/dateInput/index.vue +691 -356
  42. package/components/form/dateInput/month.vue +63 -54
  43. package/components/form/dateInput/year.vue +35 -25
  44. package/components/form/fileInput/index.js +0 -1
  45. package/components/form/fileInput/index.vue +263 -106
  46. package/components/form/fileInput/single.vue +332 -168
  47. package/components/form/groupInput/index.vue +199 -101
  48. package/components/form/index.vue +189 -83
  49. package/components/form/input/index.vue +416 -377
  50. package/components/form/jsonInput/JsonView.vue +54 -56
  51. package/components/form/jsonInput/index.vue +247 -165
  52. package/components/form/maskInput/index.vue +252 -132
  53. package/components/form/numberInput/index.js +0 -1
  54. package/components/form/numberInput/index.vue +226 -117
  55. package/components/form/passwordInput/index.js +2 -1
  56. package/components/form/passwordInput/index.vue +269 -102
  57. package/components/form/radioInput/index.vue +143 -72
  58. package/components/form/rangeInput/index.vue +280 -167
  59. package/components/form/ratingInput/index.vue +57 -57
  60. package/components/form/selectInput/index.js +1 -3
  61. package/components/form/selectInput/index.vue +584 -296
  62. package/components/form/switchInput/index.vue +73 -59
  63. package/components/form/telInput/index.js +0 -1
  64. package/components/form/telInput/index.vue +238 -135
  65. package/components/form/textArea/index.vue +72 -35
  66. package/components/form/textEditor/index.vue +739 -0
  67. package/components/form/{text-editor → textEditor}/style.scss +8 -16
  68. package/components/form/textInput/index.vue +54 -32
  69. package/components/form/timeInput/index.vue +82 -55
  70. package/components/form/timeInput/range.vue +115 -94
  71. package/components/form/timeInput/timepicker.vue +382 -449
  72. package/components/form/uniqueInput/index.vue +105 -48
  73. package/components/form/unitInput/index.vue +139 -84
  74. package/components/formCreator/index.js +0 -1
  75. package/components/formCreator/index.vue +314 -148
  76. package/components/highlight/index.vue +41 -25
  77. package/components/highlight/style.scss +2 -2
  78. package/components/highlight/{mixin.js → useHighlight.js} +181 -160
  79. package/components/icon/index.vue +79 -33
  80. package/components/img/index.vue +250 -147
  81. package/components/img/preview.vue +180 -198
  82. package/components/img/svgImg.vue +42 -39
  83. package/components/index.js +5 -20
  84. package/components/infinite/index.js +3 -3
  85. package/components/infinite/index.vue +290 -66
  86. package/components/map/index.vue +428 -261
  87. package/components/map/route.vue +794 -487
  88. package/components/map/select.vue +118 -58
  89. package/components/menu/index.vue +206 -94
  90. package/components/meta/meta.js +26 -3
  91. package/components/modal/index.vue +382 -156
  92. package/components/notify/index.vue +204 -86
  93. package/components/notify/notification.vue +38 -55
  94. package/components/progress/circle.vue +189 -70
  95. package/components/progress/line.vue +266 -46
  96. package/components/searchBox/index.js +1 -3
  97. package/components/searchBox/index.vue +194 -101
  98. package/components/skeleton/index.vue +45 -20
  99. package/components/slider/index.vue +319 -156
  100. package/components/swiper/index.vue +237 -108
  101. package/components/table/crud/footer.vue +77 -53
  102. package/components/table/crud/header.vue +71 -72
  103. package/components/table/crud/index.vue +629 -399
  104. package/components/table/index.vue +721 -278
  105. package/components/timeAgo/index.vue +145 -96
  106. package/components/tour/index.vue +338 -235
  107. package/components/tree/index.vue +235 -89
  108. package/components/tree/tree-element.vue +106 -106
  109. package/directive/animate/index.js +77 -0
  110. package/directive/clickOutSide/index.js +98 -0
  111. package/directive/drag/index.js +153 -0
  112. package/directive/index.js +11 -13
  113. package/directive/intersect/index.js +263 -0
  114. package/directive/mask/index.js +67 -0
  115. package/directive/parallax/index.js +78 -0
  116. package/directive/ripple/index.js +14 -0
  117. package/directive/scroll/index.js +272 -24
  118. package/directive/sortable/index.js +274 -0
  119. package/directive/title/index.js +75 -0
  120. package/directive/touch/index.js +268 -0
  121. package/index.js +11 -19
  122. package/package.json +5 -2
  123. package/plugins/validation/Validate.js +88 -79
  124. package/scripts/generate-docs.mjs +226 -0
  125. package/scripts/menu.mjs +240 -0
  126. package/scripts/parser.mjs +1086 -0
  127. package/style/_index.scss +7 -0
  128. package/style/app.scss +13 -65
  129. package/style/colors.scss +5 -22
  130. package/style/functions/index.scss +8 -0
  131. package/style/mixins/index.scss +17 -5
  132. package/style/variables/base.scss +155 -178
  133. package/style/variables/color.scss +0 -12
  134. package/style/variables/utilities.scss +0 -180
  135. package/tools/helper.js +0 -8
  136. package/tools/icons.js +7 -2
  137. package/tools/root.js +71 -0
  138. package/components/app/style.scss +0 -41
  139. package/components/app/toast/style.scss +0 -20
  140. package/components/avatar/style.scss +0 -32
  141. package/components/bar/bottomNav.js +0 -1
  142. package/components/bar/bottomNav.vue +0 -28
  143. package/components/bar/bottomNavigationCircle.js +0 -2
  144. package/components/bar/bottomNavigationCircle.vue +0 -99
  145. package/components/bar/scss/bottomNav.scss +0 -67
  146. package/components/bar/scss/toolbar.scss +0 -174
  147. package/components/bar/toolbar/index.js +0 -8
  148. package/components/bar/toolbar/index.vue +0 -35
  149. package/components/bar/toolbar/laptop.vue +0 -33
  150. package/components/bar/toolbar/menuChilds.vue +0 -41
  151. package/components/bar/toolbar/menuLaptop.vue +0 -41
  152. package/components/bar/toolbar/menuMob.vue +0 -39
  153. package/components/bar/toolbar/mixin.js +0 -43
  154. package/components/bar/toolbar/mobile.vue +0 -34
  155. package/components/breadcrumb/bredcrumbItem.vue +0 -39
  156. package/components/breadcrumb/index.js +0 -3
  157. package/components/breadcrumb/index.vue +0 -71
  158. package/components/breadcrumb/style.scss +0 -51
  159. package/components/button/style.scss +0 -411
  160. package/components/card/style.scss +0 -86
  161. package/components/chart/chart.js +0 -1
  162. package/components/chart/chart.vue +0 -69
  163. package/components/chart/worldMap.js +0 -2
  164. package/components/chart/worldMap.vue +0 -1112
  165. package/components/chat/MessageList.vue +0 -163
  166. package/components/chat/chatInput.vue +0 -150
  167. package/components/chat/chatMsg.vue +0 -276
  168. package/components/chat/index.js +0 -11
  169. package/components/chat/index.vue +0 -113
  170. package/components/chip/index.js +0 -3
  171. package/components/chip/index.vue +0 -77
  172. package/components/chip/style.scss +0 -199
  173. package/components/codeEditor/mixin.js +0 -145
  174. package/components/countdown/index.js +0 -1
  175. package/components/countdown/index.vue +0 -105
  176. package/components/form/colorInput/mixin.js +0 -132
  177. package/components/form/fileInput/file.js +0 -148
  178. package/components/form/telInput/assets/flags.png +0 -0
  179. package/components/form/telInput/assets/flags@2x.png +0 -0
  180. package/components/form/text-editor/index.vue +0 -705
  181. package/components/icon/style.scss +0 -17
  182. package/components/infinite/div.js +0 -6
  183. package/components/infinite/div.vue +0 -193
  184. package/components/infinite/page.js +0 -3
  185. package/components/infinite/page.vue +0 -105
  186. package/components/list/index.js +0 -3
  187. package/components/list/index.vue +0 -122
  188. package/components/list/style.scss +0 -66
  189. package/components/message/index.js +0 -4
  190. package/components/message/index.vue +0 -40
  191. package/components/modal/style.scss +0 -146
  192. package/components/nestable/NestableItem.vue +0 -307
  193. package/components/nestable/editable.js +0 -44
  194. package/components/nestable/index.js +0 -1
  195. package/components/nestable/index.vue +0 -226
  196. package/components/nestable/methods.js +0 -416
  197. package/components/progress/style.scss +0 -229
  198. package/components/table/style.scss +0 -338
  199. package/components/tabs/index.js +0 -3
  200. package/components/tabs/index.vue +0 -151
  201. package/components/timeline/index.js +0 -6
  202. package/components/timeline/index.vue +0 -76
  203. package/directive/resize/index.js +0 -30
  204. package/directive/skeleton/index.js +0 -27
  205. package/directive/skeleton/style.scss +0 -37
  206. package/plugins/request/Request.js +0 -68
  207. package/style/animation.scss +0 -94
  208. package/style/style.scss +0 -8
  209. package/tools/rootable.js +0 -75
  210. /package/components/form/{text-editor → textEditor}/index.js +0 -0
  211. /package/components/form/{text-editor → textEditor}/preview.js +0 -0
  212. /package/components/form/{text-editor → textEditor}/preview.vue +0 -0
@@ -1,42 +1,88 @@
1
1
  <template>
2
2
  <span ref="icon" :class="classes">
3
+ <!-- Default slot for icon content. -->
3
4
  <slot></slot>
4
5
  </span>
5
6
  </template>
6
7
 
7
- <script>
8
- import './style.scss'
9
-
10
- export default {
11
- name: 'index',
12
- props: {
13
- width: {type: String},
14
- height: {type: String},
15
- disabled: Boolean,
16
- exact: Boolean
17
- },
18
- mounted() {
19
- if (this.width || this.height) {
20
- const el = this.$refs.icon.firstElementChild
21
- if (el) {
22
- if (this.width) {
23
- el.setAttribute('width', this.width)
24
- }
25
- if (this.height) {
26
- el.setAttribute('height', this.height)
27
- }
28
- }
29
- }
30
- },
31
- computed: {
32
- classes() {
33
- let a = {
34
- 'icon-disabled': this.disabled,
35
- 'exact-icon': this.exact
36
- }
37
- a[`${this.$r.prefix}icon`] = true
38
- return a
39
- }
8
+ <script setup>
9
+ import {computed, inject, onMounted, ref} from 'vue'
10
+
11
+ /**
12
+ * Component properties configuration
13
+ * @typedef {Object} ComponentProps
14
+ */
15
+
16
+ const props = defineProps({
17
+ /**
18
+ * Width of the component
19
+ * @description CSS width value (e.g., '100px', '50%', 'auto')
20
+ * @example '100%'
21
+ * @example '300px'
22
+ */
23
+ width: {type: String},
24
+
25
+ /**
26
+ * Height of the component
27
+ * @description CSS height value (e.g., '100px', '50%', 'auto')
28
+ * @example '200px'
29
+ * @memberof ComponentProps
30
+ */
31
+ height: {type: String},
32
+
33
+ /**
34
+ * Whether the icon is disabled
35
+ * @description When true, user interaction is prevented and visual styling indicates disabled state
36
+ */
37
+ disabled: Boolean,
38
+
39
+ /**
40
+ * Whether to apply exact icon for both rtl and ltr
41
+ */
42
+ exact: Boolean
43
+ })
44
+
45
+ const $r = inject('renusify').$r
46
+
47
+ const icon = ref(null)
48
+
49
+ const classes = computed(() => {
50
+ return {
51
+ [`${$r.prefix}icon`]: true,
52
+ 'icon-disabled': props.disabled,
53
+ 'exact-icon': props.exact
54
+ }
55
+ })
56
+
57
+ onMounted(() => {
58
+ if (props.width || props.height) {
59
+ const el = icon.value?.firstElementChild
60
+ if (el) {
61
+ if (props.width) {
62
+ el.setAttribute('width', props.width)
63
+ }
64
+ if (props.height) {
65
+ el.setAttribute('height', props.height)
40
66
  }
41
67
  }
68
+ }
69
+ })
42
70
  </script>
71
+ <style lang="scss">
72
+ @use "../../style" as *;
73
+
74
+ .#{$prefix}icon {
75
+ display: inline-flex;
76
+ vertical-align: -.5rem;
77
+
78
+ &.icon-disabled {
79
+ @include disable-states();
80
+ }
81
+
82
+ @include rtl() {
83
+ &:not(.exact-icon) {
84
+ transform: scale(-1, 1);
85
+ }
86
+ }
87
+ }
88
+ </style>
@@ -3,16 +3,21 @@
3
3
  [$r.prefix+'img']:true,
4
4
  'img-hoverZoom':hoverZoom,'img-hoverDark':hoverDark,'img-hover-preview':preview}"
5
5
  ref="rImg">
6
- <div v-if="preview" class="img-preview w-full h-full d-flex v-center h-center"
6
+ <div v-if="preview" class="img-preview d-flex v-center h-center"
7
7
  >
8
8
  <r-btn icon @click="show_preview=true">
9
9
  <r-icon v-html="$r.icons.eye"></r-icon>
10
10
  </r-btn>
11
11
  </div>
12
- <img v-if="load &&!isSvg" ref="img" :alt="alt" :height="size.height>0?size.height:'auto'" :src="link" :style="{'height':size.height>0?undefined:'auto',
12
+ <img v-if="load &&!isSvg" ref="img" :alt="alt"
13
+ :height="size.height>0?size.height:'auto'"
14
+ :width="size.width>0?size.width:'auto'"
15
+ :sizes="size.width>0?size.width+'px':'auto'"
16
+ :src="link"
17
+ :srcset="srcset"
18
+ :style="{'height':size.height>0?undefined:'auto',
13
19
  'width':size.width>0?undefined:'auto'
14
20
  }"
15
- :width="size.width>0?size.width:'auto'"
16
21
  draggable="false"/>
17
22
  <svg-img v-else-if="load &&isSvg&&link" :link="link" :size="size">
18
23
  </svg-img>
@@ -21,165 +26,261 @@
21
26
  </teleport>
22
27
  </div>
23
28
  </template>
24
- <script>
25
- import {defineAsyncComponent} from 'vue'
26
-
27
- export default {
28
- name: 'r-img',
29
- components: {
30
- SvgImg: defineAsyncComponent(() => import('./svgImg.vue')),
31
- previewImg: defineAsyncComponent(() => import('./preview.vue')),
29
+ <script setup>
30
+ import {defineAsyncComponent, ref, computed, onMounted, nextTick} from 'vue'
31
+
32
+ const props = defineProps({
33
+ /**
34
+ * Source URL of the image
35
+ * Required: true
36
+ * Example: 'https://codenus.com/pwa/logo'
37
+ */
38
+ src: {
39
+ type: String,
40
+ required: true
32
41
  },
33
- props: {
34
- src: {
35
- type: String,
36
- required: true
37
- },
38
- preview: String,
39
- alt: {
40
- type: String,
41
- required: true
42
- },
43
- lazy: {
44
- type: String,
45
- default: 'create',
46
- validator: function (value) {
47
- return ['no', 'create'].indexOf(value) !== -1
48
- }
49
- },
50
- width: {
51
- type: [String, Number]
52
- },
53
- height: {
54
- type: [String, Number]
55
- },
56
- query: String,
57
- autoSize: Boolean,
58
- hoverZoom: Boolean,
59
- hoverDark: Boolean,
60
- isSvg: Boolean,
61
- svgCache: {type: Number, default: 86400},
62
- wPH: Number
42
+
43
+ /**
44
+ * Preview image URL for high resolution image
45
+ * Example: 'https://codenus.com/pwa/logo'
46
+ */
47
+ preview: String,
48
+
49
+ /**
50
+ * Alternative text for the image (accessibility)
51
+ * Required: true
52
+ * Example: 'A beautiful sunset over the mountains'
53
+ */
54
+ alt: {
55
+ type: String,
56
+ required: true
63
57
  },
64
- data() {
65
- return {
66
- show_preview: false,
67
- load: false,
68
- view: false,
69
- modifier: this.lazy !== 'no' ? 'once' : 'pre',
70
- time_id: null,
71
- size: {width: 0, height: 0}
72
- }
58
+
59
+ /**
60
+ * Lazy loading behavior
61
+ * Allowed values: 'no', 'create'
62
+ * - 'no': No lazy loading
63
+ * - 'create': Create lazy loading instance
64
+ */
65
+ lazy: {
66
+ type: String,
67
+ default: 'create',
68
+ validator: (value) => ['no', 'create'].includes(value)
73
69
  },
74
- created() {
75
- this.activate()
70
+
71
+ /**
72
+ * Width of the image
73
+ * Example: '100%', 300, '200px'
74
+ */
75
+ width: {
76
+ type: [String, Number]
76
77
  },
77
- computed: {
78
- link() {
79
- if (this.lazy !== 'no' && !this.view) {
80
- return null
81
- }
82
- let res = this.src
83
- if (!(res.startsWith('/') || res.startsWith('http://') || res.startsWith('https://') || res.startsWith('data:image/'))) {
84
- res = '/' + res
85
- }
86
- if (this.src.search('[?]') === -1) {
87
- res += '?'
88
- }
89
- if (this.query) {
90
- res += this.query
91
- }
92
- if (this.isSvg && this.svgCache) {
93
- res += '&c=' + this.svgCache
94
- }
95
- if (!this.isSvg && ((this.autoSize && this.size.width > 0) || this.width)) {
96
- res += `&w=${this.size.width}`
97
- }
98
- if (!this.isSvg && ((this.autoSize && this.size.height > 0) || this.height)) {
99
- res += `&h=${this.size.height}`
100
- }
101
- return res
102
- }
78
+
79
+ /**
80
+ * Height of the image
81
+ * Example: 'auto', 200, '150px'
82
+ */
83
+ height: {
84
+ type: [String, Number]
103
85
  },
104
- methods: {
105
- check(isIntersecting) {
106
- if (isIntersecting) {
107
- this.view = true
108
- }
109
- },
110
- getSize() {
111
- let res = {width: 0, height: 0}
112
- if (this.width) {
113
- res["width"] = this.width
114
- }
115
- if (this.height) {
116
- res["height"] = this.height
117
- }
118
- let wPH = this.wPH
119
- if (!wPH) {
120
- const ls = this.src.split('/')
121
- if (ls.length > 0) {
122
- const p = ls[ls.length - 1].split('_')
123
- if (p.length === 3) {
124
- const p0 = parseInt(p[0])
125
- const p1 = parseInt(p[1])
126
- if (p0 && p1) {
127
- wPH = p0 / p1
128
- }
129
- } else {
130
- wPH = 1
131
- }
132
- }
133
- }
134
- if (wPH) {
135
- if (res['width'] !== 0 && res['height'] === 0) {
136
- res['height'] = parseInt(res['width'] / wPH)
137
- }
138
- if (res['width'] === 0 && res['height'] !== 0) {
139
- res['width'] = parseInt(res['height'] * wPH)
140
- }
141
- }
142
86
 
143
- if (res['width'] !== 0 || res['height'] !== 0) {
144
- return this.size = res
145
- }
87
+ /**
88
+ * Query parameters to append to the image URL
89
+ * Example: '?quality=80&format=webp'
90
+ */
91
+ query: String,
146
92
 
147
- if (this.$refs.rImg && this.$refs.rImg.parentElement && this.$refs.rImg.parentElement.clientWidth > 0) {
148
- let cs = window.getComputedStyle(this.$refs.rImg.parentElement)
149
- let paddingX = parseFloat(cs.paddingLeft) + parseFloat(cs.paddingRight);
150
- let borderX = parseFloat(cs.borderLeftWidth) + parseFloat(cs.borderRightWidth);
151
- let w = parseInt(parseFloat(cs.getPropertyValue('width')) - paddingX - borderX);
152
- return this.size = {
153
- width: w,
154
- height: parseInt(wPH ? w / wPH : 0)
155
- }
156
- }
157
- return false
93
+ /**
94
+ * Whether to automatically generate srcset for responsive images
95
+ */
96
+ autoSrcset: {type: Boolean, default: true},
97
+
98
+ /**
99
+ * Whether to automatically calculate image dimensions
100
+ */
101
+ autoSize: Boolean,
102
+
103
+ /**
104
+ * Whether to enable zoom on hover effect
105
+ */
106
+ hoverZoom: Boolean,
107
+
108
+ /**
109
+ * Whether to apply dark overlay on hover
110
+ */
111
+ hoverDark: Boolean,
112
+
113
+ /**
114
+ * Whether the image is an SVG file
115
+ */
116
+ isSvg: Boolean,
117
+
118
+ /**
119
+ * Cache duration for SVG files in seconds
120
+ * Default: 86400 (24 hours)
121
+ */
122
+ svgCache: {type: Number, default: 86400},
123
+
124
+ /**
125
+ * Width-per-height ratio (aspect ratio)
126
+ * Example: 1.777 (for 16:9 aspect ratio)
127
+ */
128
+ wPH: Number
129
+ })
130
+
131
+ const SvgImg = defineAsyncComponent(() => import('./svgImg.vue'))
132
+ const PreviewImg = defineAsyncComponent(() => import('./preview.vue'))
133
+
134
+ const show_preview = ref(false)
135
+ const load = ref(false)
136
+ const view = ref(false)
137
+ const modifier = computed(() => props.lazy !== 'no' ? 'once' : 'pre')
138
+ const srcset = ref(null)
139
+ const size = ref({width: 0, height: 0})
140
+
141
+ const rImg = ref(null)
142
+
143
+ const link = computed(() => {
144
+ if (props.lazy !== 'no' && !view.value) {
145
+ return null
146
+ }
147
+
148
+ let res = props.src
149
+ if (!(res.startsWith('/') || res.startsWith('http://') || res.startsWith('https://') || res.startsWith('data:image/'))) {
150
+ res = '/' + res
151
+ }
158
152
 
159
- },
160
- activate() {
161
- this.getSize()
162
- if (this.size.width !== 0 || this.size.height) {
163
- this.load = true
153
+ if (props.src.search('[?]') === -1) {
154
+ res += '?'
155
+ }
156
+
157
+ if (props.query) {
158
+ res += props.query
159
+ }
160
+
161
+ if (props.isSvg && props.svgCache) {
162
+ res += '&c=' + props.svgCache
163
+ }
164
+
165
+ if (!props.isSvg && ((props.autoSize && size.value.width > 0) || props.width)) {
166
+ res += `&w=${size.value.width}`
167
+ }
168
+
169
+ if (!props.isSvg && ((props.autoSize && size.value.height > 0) || props.height)) {
170
+ res += `&h=${size.value.height}`
171
+ }
172
+
173
+ return res
174
+ })
175
+
176
+ const set_srcset = (wph) => {
177
+ if (!props.autoSrcset) return
178
+
179
+ let src = props.src
180
+ if (src.search('[?]') === -1) {
181
+ src += '?'
182
+ }
183
+ if (props.query) {
184
+ src += props.query
185
+ }
186
+
187
+ const sizes = [300, 600, 900, 1200]
188
+ const srcs = sizes.map(width => {
189
+ const height = parseInt(width / wph)
190
+ return `${src}&w=${width}&h=${height} ${width}w`
191
+ })
192
+ srcset.value = srcs.join(',')
193
+ }
194
+
195
+ const check = (isIntersecting) => {
196
+ if (isIntersecting) {
197
+ view.value = true
198
+ }
199
+ }
200
+
201
+ const getSize = () => {
202
+ const res = {width: 0, height: 0}
203
+
204
+ if (props.width) {
205
+ res.width = props.width
206
+ }
207
+ if (props.height) {
208
+ res.height = props.height
209
+ }
210
+
211
+ let wPH = props.wPH
212
+ if (!wPH) {
213
+ const ls = props.src.split('/')
214
+ if (ls.length > 0) {
215
+ const p = ls[ls.length - 1].split('_')
216
+ if (p.length === 3) {
217
+ const p0 = parseInt(p[0])
218
+ const p1 = parseInt(p[1])
219
+ if (p0 && p1) {
220
+ wPH = p0 / p1
221
+ }
164
222
  } else {
165
- clearTimeout(this.time_id)
166
- this.time_id = setTimeout(() => {
167
- this.activate()
168
- }, 100)
223
+ wPH = 1
169
224
  }
225
+ }
226
+ }
170
227
 
228
+ if (wPH) {
229
+ if (res.width !== 0 && res.height === 0) {
230
+ res.height = parseInt(res.width / wPH)
171
231
  }
172
- },
173
- beforeUnmount() {
174
- clearTimeout(this.time_id)
232
+ if (res.width === 0 && res.height !== 0) {
233
+ res.width = parseInt(res.height * wPH)
234
+ }
235
+ }
236
+
237
+ if (res.width !== 0 || res.height !== 0) {
238
+ set_srcset(res.width / res.height)
239
+ size.value = res
240
+ return size.value
241
+ }
242
+
243
+ if (rImg.value && rImg.value.parentElement && rImg.value.parentElement.clientWidth > 0) {
244
+ const cs = window.getComputedStyle(rImg.value.parentElement)
245
+ const paddingX = parseFloat(cs.paddingLeft) + parseFloat(cs.paddingRight)
246
+ const borderX = parseFloat(cs.borderLeftWidth) + parseFloat(cs.borderRightWidth)
247
+ const w = parseInt(parseFloat(cs.getPropertyValue('width')) - paddingX - borderX)
248
+ set_srcset(wPH)
249
+ size.value = {
250
+ width: w,
251
+ height: parseInt(wPH ? w / wPH : 0)
252
+ }
253
+ return size.value
254
+ }
255
+
256
+ return false
257
+ }
258
+
259
+ const activate = (n=0) => {
260
+ if (n>10)return;
261
+ getSize()
262
+ if (size.value.width !== 0 || size.value.height) {
263
+ load.value = true
264
+ } else {
265
+ nextTick(() => {
266
+ activate(n++)
267
+ })
175
268
  }
176
269
  }
270
+
271
+ onMounted(() => {
272
+ nextTick(() => {
273
+ activate()
274
+ })
275
+ })
276
+
177
277
  </script>
278
+
178
279
  <style lang="scss">
179
280
  @use "sass:map";
180
- @use "../../style/variables/base";
281
+ @use "../../style" as *;
181
282
 
182
- .#{base.$prefix}img {
283
+ .#{$prefix}img {
183
284
  position: relative;
184
285
  display: inline-flex;
185
286
  max-width: 100%;
@@ -225,18 +326,20 @@ export default {
225
326
  left: 0;
226
327
  max-width: 0;
227
328
  overflow: hidden;
329
+ width: 100%;
330
+ height: 100%;
228
331
  }
229
332
  }
230
333
 
231
- .#{base.$prefix}img-preview-container {
334
+ .#{$prefix}img-preview-container {
232
335
  width: 100vw;
233
- height: 100vh;
336
+ height: 100%;
234
337
  overflow: hidden;
235
338
  position: fixed;
236
339
  touch-action: none;
237
340
  background: var(--color-overlay);
238
341
  backdrop-filter: blur(3px) grayscale(30%);
239
- z-index: map.get(base.$z-index, 'important');
342
+ z-index: map.get($z-index, 'veryImportant');
240
343
  top: 0;
241
344
  left: 0;
242
345