@gx-design-vue/image 0.2.0-alpha.0 → 0.2.0-alpha.2

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 (69) hide show
  1. package/dist/Image.d.ts +6 -0
  2. package/dist/Image.js +322 -0
  3. package/dist/ImagePreview.d.ts +6 -0
  4. package/dist/ImagePreview.js +593 -0
  5. package/dist/g-image.esm.js +1577 -0
  6. package/dist/g-image.js +1 -0
  7. package/dist/hooks/useImageBoundary.d.ts +15 -0
  8. package/dist/hooks/useImageBoundary.js +24 -0
  9. package/dist/hooks/useImagePreview.d.ts +23 -0
  10. package/dist/hooks/useImagePreview.js +54 -0
  11. package/dist/hooks/useImageTransform.d.ts +23 -0
  12. package/dist/hooks/useImageTransform.js +92 -0
  13. package/dist/hooks/useMouseEvent.d.ts +22 -0
  14. package/dist/hooks/useMouseEvent.js +71 -0
  15. package/dist/hooks/useTouchEvent.d.ts +23 -0
  16. package/dist/{ImagePreview/hooks → hooks}/useTouchEvent.js +31 -32
  17. package/dist/index.d.ts +4 -5
  18. package/dist/index.js +3 -6
  19. package/dist/interface.d.ts +169 -0
  20. package/dist/interface.js +1 -0
  21. package/dist/style/index.d.ts +7 -0
  22. package/dist/{style.js → style/index.js} +19 -26
  23. package/dist/style/preview.d.ts +14 -0
  24. package/dist/style/preview.js +182 -0
  25. package/dist/theme/augment.d.ts +10 -0
  26. package/dist/theme/augment.js +1 -0
  27. package/dist/theme/interface/components.d.ts +10 -0
  28. package/dist/theme/interface/components.js +1 -0
  29. package/package.json +9 -8
  30. package/dist/GImage.d.ts +0 -162
  31. package/dist/GImage.js +0 -221
  32. package/dist/ImagePreview/Operations.d.ts +0 -83
  33. package/dist/ImagePreview/Operations.js +0 -71
  34. package/dist/ImagePreview/hooks/getFixScaleEleTransPosition.d.ts +0 -19
  35. package/dist/ImagePreview/hooks/getFixScaleEleTransPosition.js +0 -40
  36. package/dist/ImagePreview/hooks/useImageTransform.d.ts +0 -39
  37. package/dist/ImagePreview/hooks/useImageTransform.js +0 -105
  38. package/dist/ImagePreview/hooks/useMouseEvent.d.ts +0 -14
  39. package/dist/ImagePreview/hooks/useMouseEvent.js +0 -100
  40. package/dist/ImagePreview/hooks/useTouchEvent.d.ts +0 -12
  41. package/dist/ImagePreview/index.d.ts +0 -162
  42. package/dist/ImagePreview/index.js +0 -303
  43. package/dist/ImagePreview/props.d.ts +0 -88
  44. package/dist/ImagePreview/props.js +0 -53
  45. package/dist/ImagePreview/style.d.ts +0 -30
  46. package/dist/ImagePreview/style.js +0 -286
  47. package/dist/ImagePreview/typings.d.ts +0 -19
  48. package/dist/ImagePreview/typings.js +0 -1
  49. package/dist/ImagePreview/utils/KeyCode.d.ts +0 -438
  50. package/dist/ImagePreview/utils/KeyCode.js +0 -173
  51. package/dist/ImagePreview/utils/addEventListener.d.ts +0 -6
  52. package/dist/ImagePreview/utils/addEventListener.js +0 -22
  53. package/dist/ImagePreview/utils/util.d.ts +0 -7
  54. package/dist/ImagePreview/utils/util.js +0 -8
  55. package/dist/hooks/useFrameSetState.d.ts +0 -5
  56. package/dist/hooks/useFrameSetState.js +0 -33
  57. package/dist/image.esm.js +0 -2374
  58. package/dist/image.js +0 -1
  59. package/dist/props.d.ts +0 -84
  60. package/dist/props.js +0 -66
  61. package/dist/slots.d.ts +0 -6
  62. package/dist/slots.js +0 -21
  63. package/dist/style.d.ts +0 -9
  64. package/dist/typings.d.ts +0 -6
  65. package/dist/typings.js +0 -1
  66. package/dist/utils/aria.d.ts +0 -15
  67. package/dist/utils/aria.js +0 -16
  68. package/dist/utils/util.d.ts +0 -4
  69. package/dist/utils/util.js +0 -8
@@ -1,53 +0,0 @@
1
- import { baseProps } from "../props.js";
2
-
3
- //#region src/ImagePreview/props.ts
4
- var props_default = {
5
- urls: {
6
- type: Array,
7
- default: () => []
8
- },
9
- open: {
10
- type: Boolean,
11
- default: false
12
- },
13
- scaleStep: {
14
- type: Number,
15
- default: .5
16
- },
17
- minScale: {
18
- type: Number,
19
- default: .32
20
- },
21
- maxScale: {
22
- type: Number,
23
- default: 32
24
- },
25
- movable: {
26
- type: Boolean,
27
- default: true
28
- },
29
- disabled: Boolean,
30
- zIndex: baseProps.zIndex,
31
- current: baseProps.current,
32
- infinite: baseProps.infinite,
33
- getContainer: baseProps.getContainer,
34
- onHideOnClickModal: {
35
- type: Boolean,
36
- default: true
37
- },
38
- countRender: [
39
- Function,
40
- Array,
41
- Object
42
- ],
43
- icons: {
44
- type: Object,
45
- default: () => ({})
46
- },
47
- onTransform: Function,
48
- onOpenChange: Function,
49
- "onUpdate:open": Function
50
- };
51
-
52
- //#endregion
53
- export { props_default as default };
@@ -1,30 +0,0 @@
1
- import * as vue0 from "vue";
2
- import { CSSObject, Keyframe, ProAliasToken } from "@gx-design-vue/pro-provider";
3
- import * as ant_design_vue_es__util_type0 from "ant-design-vue/es/_util/type";
4
-
5
- //#region src/ImagePreview/style.d.ts
6
- interface ImageToken extends ProAliasToken {
7
- previewCls: string;
8
- zIndexPopup: number;
9
- previewOperationSize: number;
10
- modalMaskBg: string;
11
- componentCls: string;
12
- iconCls: string;
13
- previewOperationHoverColor: string;
14
- previewOperationColor: string;
15
- imagePreviewSwitchSize: number;
16
- previewOperationColorDisabled: string;
17
- }
18
- declare const viewFadeIn: Keyframe;
19
- declare const viewFadeOut: Keyframe;
20
- type PositionType = 'static' | 'relative' | 'fixed' | 'absolute' | 'sticky' | undefined;
21
- declare function genBoxStyle(position?: PositionType): CSSObject;
22
- declare function resetComponent(token: ProAliasToken): CSSObject;
23
- declare function genPreviewOperationsStyle(token: ImageToken): CSSObject;
24
- declare function genPreviewSwitchStyle(token: ImageToken): CSSObject;
25
- declare function useStyle(componentCls: string): {
26
- wrapSSR: (node: ant_design_vue_es__util_type0.VueNode) => ant_design_vue_es__util_type0.VueNode;
27
- hashId: vue0.ComputedRef<string>;
28
- };
29
- //#endregion
30
- export { ImageToken, PositionType, genBoxStyle, genPreviewOperationsStyle, genPreviewSwitchStyle, resetComponent, useStyle, viewFadeIn, viewFadeOut };
@@ -1,286 +0,0 @@
1
- import { Keyframe, mergeToken, useStyle as useStyle$1 } from "@gx-design-vue/pro-provider";
2
- import { TinyColor } from "@ctrl/tinycolor";
3
-
4
- //#region src/ImagePreview/style.ts
5
- const viewFadeIn = new Keyframe("viewFadeIn", {
6
- "0%": { opacity: 0 },
7
- "100%": { opacity: 1 }
8
- });
9
- const viewFadeOut = new Keyframe("viewFadeOut", {
10
- "0%": { opacity: 1 },
11
- "100%": { opacity: 0 }
12
- });
13
- const viewZoomBadgeIn = new Keyframe("viewZoomBadgeIn", {
14
- "0%": {
15
- transform: "scale(0)",
16
- opacity: 0
17
- },
18
- "100%": {
19
- transform: "scale(1)",
20
- opacity: 1
21
- }
22
- });
23
- const viewZoomBadgeOut = new Keyframe("viewZoomBadgeOut", {
24
- "0%": { transform: "scale(1)" },
25
- "100%": {
26
- transform: "scale(0)",
27
- opacity: 0
28
- }
29
- });
30
- function genBoxStyle(position) {
31
- return {
32
- position: position || "absolute",
33
- inset: 0
34
- };
35
- }
36
- function box(position) {
37
- return {
38
- position,
39
- top: 0,
40
- insetInlineEnd: 0,
41
- bottom: 0,
42
- insetInlineStart: 0
43
- };
44
- }
45
- function resetComponent(token) {
46
- return {
47
- boxSizing: "border-box",
48
- margin: 0,
49
- padding: 0,
50
- color: token.colorText,
51
- fontSize: token.fontSize,
52
- lineHeight: token.lineHeight,
53
- listStyle: "none",
54
- fontFamily: token.fontFamily
55
- };
56
- }
57
- function genPreviewOperationsStyle(token) {
58
- const { previewCls, modalMaskBg, marginXL, margin, colorTextLightSolid, previewOperationColorDisabled, previewOperationHoverColor, motionDurationSlow, iconCls } = token;
59
- const closeBg = new TinyColor(modalMaskBg).setAlpha(.1);
60
- const closeBgHover = closeBg.clone().setAlpha(.2);
61
- const operationBg = new TinyColor(modalMaskBg).setAlpha(.5);
62
- const operationsBgHover = new TinyColor(modalMaskBg).setAlpha(.03);
63
- return {
64
- [`${previewCls}-footer`]: {
65
- position: "fixed",
66
- bottom: marginXL,
67
- left: {
68
- _skip_check_: true,
69
- value: "50%"
70
- },
71
- display: "flex",
72
- flexDirection: "column",
73
- alignItems: "center",
74
- color: token.previewOperationColor,
75
- transform: "translateX(-50%)"
76
- },
77
- [`${previewCls}-progress`]: { marginBottom: margin },
78
- [`${previewCls}-close`]: {
79
- position: "fixed",
80
- top: marginXL,
81
- right: {
82
- _skip_check_: true,
83
- value: marginXL
84
- },
85
- display: "flex",
86
- alignItems: "center",
87
- justifyContent: "center",
88
- color: colorTextLightSolid,
89
- backgroundColor: closeBg.toRgbString(),
90
- borderRadius: token.borderRadiusLG,
91
- backdropFilter: "saturate(180%) blur(10px)",
92
- width: token.sizeXL,
93
- height: token.sizeXL,
94
- outline: 0,
95
- border: 0,
96
- cursor: "pointer",
97
- transition: `all ${motionDurationSlow}`,
98
- "&:hover": { backgroundColor: closeBgHover.toRgbString() },
99
- [`& > ${iconCls}`]: { fontSize: token.previewOperationSize }
100
- },
101
- [`${previewCls}-operations`]: {
102
- display: "flex",
103
- alignItems: "center",
104
- gap: token.sizeXXS,
105
- padding: token.paddingXXS,
106
- border: `1px solid ${token.colorBorderSecondary}`,
107
- backgroundColor: operationBg.toRgbString(),
108
- borderRadius: token.borderRadiusLG,
109
- backdropFilter: "saturate(150%) blur(10px)",
110
- "&-operation": {
111
- display: "flex",
112
- alignItems: "center",
113
- justifyContent: "center",
114
- width: token.sizeXL + 4,
115
- height: token.sizeXL + 4,
116
- cursor: "pointer",
117
- color: colorTextLightSolid,
118
- borderRadius: token.borderRadiusSM,
119
- transition: `all ${motionDurationSlow}`,
120
- userSelect: "none",
121
- [`&:not(${previewCls}-operations-operation-disabled):hover > ${iconCls}`]: { color: previewOperationHoverColor },
122
- "&:hover": { backgroundColor: operationsBgHover.toRgbString() },
123
- "&-disabled": {
124
- color: previewOperationColorDisabled,
125
- cursor: "not-allowed"
126
- },
127
- "&:first-of-type": { marginInlineStart: 0 },
128
- [`& > ${iconCls}`]: { fontSize: token.previewOperationSize }
129
- }
130
- }
131
- };
132
- }
133
- function genPreviewSwitchStyle(token) {
134
- const { modalMaskBg, iconCls, previewOperationColorDisabled, previewCls, zIndexPopup, motionDurationSlow, colorTextLightSolid } = token;
135
- const operationBg = new TinyColor(modalMaskBg).setAlpha(.1);
136
- const operationBgHover = operationBg.clone().setAlpha(.2);
137
- return {
138
- [`${previewCls}-switch-left, ${previewCls}-switch-right`]: {
139
- position: "fixed",
140
- insetBlockStart: "50%",
141
- zIndex: token.calc(zIndexPopup).add(1).equal(),
142
- display: "flex",
143
- alignItems: "center",
144
- justifyContent: "center",
145
- borderRadius: token.borderRadius,
146
- backdropFilter: "saturate(180%) blur(10px)",
147
- width: token.imagePreviewSwitchSize,
148
- height: token.imagePreviewSwitchSize,
149
- marginTop: token.calc(token.imagePreviewSwitchSize).mul(-1).div(2).equal(),
150
- color: colorTextLightSolid,
151
- background: operationBg.toRgbString(),
152
- transform: `translateY(-50%)`,
153
- cursor: "pointer",
154
- transition: `all ${motionDurationSlow}`,
155
- userSelect: "none",
156
- "&:hover": { background: operationBgHover.toRgbString() },
157
- "&-disabled": { "&, &:hover": {
158
- color: previewOperationColorDisabled,
159
- background: "transparent",
160
- cursor: "not-allowed",
161
- [`> ${iconCls}`]: { cursor: "not-allowed" }
162
- } },
163
- [`> ${iconCls}`]: { fontSize: token.previewOperationSize }
164
- },
165
- [`${previewCls}-switch-left`]: { insetInlineStart: token.marginSM },
166
- [`${previewCls}-switch-right`]: { insetInlineEnd: token.marginSM }
167
- };
168
- }
169
- const genImagePreviewStyle = (token) => {
170
- const { motionEaseOut, motionDurationSlow } = token;
171
- return {
172
- [token.componentCls]: {
173
- height: "100%",
174
- textAlign: "center",
175
- pointerEvents: "none",
176
- "&-root": {
177
- ...box("fixed"),
178
- zIndex: token.zIndexPopup,
179
- overflow: "auto",
180
- outline: 0,
181
- WebkitOverflowScrolling: "touch"
182
- },
183
- "&-wrap": {
184
- ...box("fixed"),
185
- zIndex: token.zIndexPopup,
186
- overflow: "auto",
187
- outline: 0,
188
- WebkitOverflowScrolling: "touch"
189
- },
190
- "&-mask": {
191
- ...box("fixed"),
192
- zIndex: token.zIndexPopupBase,
193
- height: "100%",
194
- backgroundColor: token.colorBgMask,
195
- backdropFilter: "blur(8px)"
196
- },
197
- "&-body": {
198
- ...genBoxStyle(),
199
- overflow: "hidden"
200
- },
201
- "&-img": {
202
- maxWidth: "100%",
203
- maxHeight: "70%",
204
- verticalAlign: "middle",
205
- transform: "scale3d(1, 1, 1)",
206
- cursor: "grab",
207
- transition: `transform ${motionDurationSlow} ${motionEaseOut} 0s`,
208
- userSelect: "none",
209
- "&-wrapper": {
210
- ...genBoxStyle(),
211
- transition: `transform ${motionDurationSlow} ${motionEaseOut} 0s`,
212
- display: "flex",
213
- justifyContent: "center",
214
- alignItems: "center",
215
- "& > *": { pointerEvents: "auto" },
216
- "&::before": {
217
- display: "inline-block",
218
- width: 1,
219
- height: "50%",
220
- marginInlineEnd: -1,
221
- content: "\"\""
222
- }
223
- }
224
- },
225
- [`&-moving`]: { [`${token.componentCls}-view-img`]: {
226
- cursor: "grabbing",
227
- "&-wrapper": { transitionDuration: "0s" }
228
- } },
229
- [`&-mask-zoom-appear, &-mask-zoom-enter`]: {
230
- animationName: viewFadeIn,
231
- animationDuration: token.motionDurationSlow,
232
- animationTimingFunction: "linear",
233
- userSelect: "none"
234
- },
235
- [`&-mask-zoom-leave`]: {
236
- animationName: viewFadeOut,
237
- animationDuration: token.motionDurationSlow,
238
- animationTimingFunction: "linear",
239
- pointerEvents: "none"
240
- },
241
- [`&-zoom-appear, &-zoom-enter`]: {
242
- animationName: viewZoomBadgeIn,
243
- opacity: 0,
244
- animationTimingFunction: token.motionEaseOutCirc,
245
- animationFillMode: "both",
246
- transform: "none",
247
- animationDuration: token.motionDurationMid,
248
- userSelect: "none"
249
- },
250
- [`&-zoom-enter-active`]: { animationPlayState: "running" },
251
- [`&-zoom-leave`]: {
252
- animationName: viewZoomBadgeOut,
253
- animationDuration: token.motionDurationSlow,
254
- animationTimingFunction: token.motionEaseInOutCirc,
255
- animationFillMode: "both"
256
- }
257
- },
258
- [`${token.componentCls}-root`]: { [`${token.componentCls}-wrapper`]: { zIndex: token.zIndexPopup } },
259
- [`${token.componentCls}-operations-wrapper`]: {
260
- position: "fixed",
261
- insetBlockStart: 0,
262
- insetInlineEnd: 0,
263
- zIndex: token.calc(token.zIndexPopup).add(1).equal(),
264
- width: "100%"
265
- },
266
- "&": [genPreviewOperationsStyle(token), genPreviewSwitchStyle(token)]
267
- };
268
- };
269
- function useStyle(componentCls) {
270
- return useStyle$1("ImageViewer", (token) => {
271
- return [genImagePreviewStyle(mergeToken(token, {
272
- zIndexPopup: token.zIndexPopupBase + 80,
273
- previewOperationColor: new TinyColor(token.colorTextLightSolid).setAlpha(.65).toRgbString(),
274
- previewOperationHoverColor: new TinyColor(token.colorTextLightSolid).setAlpha(.85).toRgbString(),
275
- previewOperationColorDisabled: new TinyColor(token.colorTextLightSolid).setAlpha(.25).toRgbString(),
276
- imagePreviewSwitchSize: token.sizeXL,
277
- modalMaskBg: new TinyColor("#000").setAlpha(.45).toRgbString(),
278
- previewOperationSize: token.fontSizeIcon * 1.5,
279
- iconCls: ".anticon",
280
- previewCls: token.componentCls
281
- }))];
282
- }, componentCls);
283
- }
284
-
285
- //#endregion
286
- export { genBoxStyle, genPreviewOperationsStyle, genPreviewSwitchStyle, resetComponent, useStyle, viewFadeIn, viewFadeOut };
@@ -1,19 +0,0 @@
1
- import { PreviewPropsIcons } from "./props.js";
2
- import { ComputedRef } from "vue";
3
- import { CustomRender, WithFalse } from "@gx-design-vue/pro-utils";
4
-
5
- //#region src/ImagePreview/typings.d.ts
6
- type MouseEventHandler = (e: MouseEvent) => void;
7
- interface PreviewUrl {
8
- url: string;
9
- loading: boolean;
10
- canPreview: boolean;
11
- }
12
- interface ImagePreviewTools {
13
- type: keyof PreviewPropsIcons;
14
- icon: WithFalse<CustomRender>;
15
- onClick: () => void;
16
- disabled?: ComputedRef<boolean>;
17
- }
18
- //#endregion
19
- export { ImagePreviewTools, MouseEventHandler, PreviewUrl };
@@ -1 +0,0 @@
1
- export { };