vfit 1.0.7 → 2.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.
- package/dist/fitscale.es.js +179 -40
- package/dist/fitscale.umd.js +1 -1
- package/dist/index.d.ts +8 -4
- package/dist/style.css +1 -1
- package/dist/useFitPosition.d.ts +15 -0
- package/dist/useFitScale.d.ts +3 -0
- package/package.json +4 -4
package/dist/fitscale.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { inject, ref, reactive, computed, watch, defineComponent, createElementBlock, openBlock, normalizeStyle, unref, renderSlot } from "vue";
|
|
2
2
|
function observeScale(target, designHeight, onScale, scaleMode = "auto", designWidth = 1920) {
|
|
3
3
|
const observer = new ResizeObserver((entries) => {
|
|
4
4
|
for (const entry of entries) {
|
|
@@ -23,7 +23,47 @@ function observeScale(target, designHeight, onScale, scaleMode = "auto", designW
|
|
|
23
23
|
observer.observe(target);
|
|
24
24
|
return observer;
|
|
25
25
|
}
|
|
26
|
-
const
|
|
26
|
+
const FitScaleKey = Symbol("FitScale");
|
|
27
|
+
function useFitScale() {
|
|
28
|
+
const injectedFitScale = inject(FitScaleKey, ref(1));
|
|
29
|
+
return injectedFitScale;
|
|
30
|
+
}
|
|
31
|
+
function useFitPosition(props, options = {}) {
|
|
32
|
+
const position = reactive({
|
|
33
|
+
scale: `scale(1)`,
|
|
34
|
+
top: "auto",
|
|
35
|
+
bottom: "auto",
|
|
36
|
+
left: "auto",
|
|
37
|
+
right: "auto",
|
|
38
|
+
translate: "translate(0, 0)"
|
|
39
|
+
});
|
|
40
|
+
const origin = computed(() => {
|
|
41
|
+
if (options.origin) return options.origin;
|
|
42
|
+
const hasRight = props.right !== void 0;
|
|
43
|
+
const hasBottom = props.bottom !== void 0;
|
|
44
|
+
if (hasRight && hasBottom) return "100% 100%";
|
|
45
|
+
if (hasRight) return "100% 0";
|
|
46
|
+
if (hasBottom) return "0 100%";
|
|
47
|
+
return "0 0";
|
|
48
|
+
});
|
|
49
|
+
const fitScale = inject(FitScaleKey, ref(1));
|
|
50
|
+
watch([() => props.scale, fitScale], () => {
|
|
51
|
+
const s = props.scale && props.scale > 0 ? props.scale : (fitScale == null ? void 0 : fitScale.value) ?? 1;
|
|
52
|
+
position.scale = `scale(${s}) translateZ(0)`;
|
|
53
|
+
const styleKey = ["top", "bottom", "left", "right"];
|
|
54
|
+
styleKey.forEach((key) => {
|
|
55
|
+
const val = props[key];
|
|
56
|
+
if (props.unit === "%") {
|
|
57
|
+
position[key] = val == void 0 ? "auto" : `${val}${props.unit}`;
|
|
58
|
+
} else {
|
|
59
|
+
const needScale = options.scaleKeys ? options.scaleKeys.includes(key) : key === "left" || key === "top";
|
|
60
|
+
position[key] = val == void 0 ? "auto" : `${needScale ? val * s : val}${props.unit}`;
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}, { immediate: true });
|
|
64
|
+
return { position, origin };
|
|
65
|
+
}
|
|
66
|
+
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
27
67
|
__name: "FitContainer",
|
|
28
68
|
props: {
|
|
29
69
|
scale: { type: Number, default: 0 },
|
|
@@ -35,41 +75,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
35
75
|
z: { type: Number, default: 300 }
|
|
36
76
|
},
|
|
37
77
|
setup(__props) {
|
|
38
|
-
const position = reactive({
|
|
39
|
-
scale: `scale(1)`,
|
|
40
|
-
top: "auto",
|
|
41
|
-
bottom: "auto",
|
|
42
|
-
left: "auto",
|
|
43
|
-
right: "auto"
|
|
44
|
-
});
|
|
45
78
|
const props = __props;
|
|
46
|
-
const origin =
|
|
47
|
-
const hasRight = props.right !== void 0;
|
|
48
|
-
const hasBottom = props.bottom !== void 0;
|
|
49
|
-
if (hasRight && hasBottom) return "100% 100%";
|
|
50
|
-
if (hasRight) return "100% 0";
|
|
51
|
-
if (hasBottom) return "0 100%";
|
|
52
|
-
return "0 0";
|
|
53
|
-
});
|
|
54
|
-
const fitScale = inject(FitScaleKey, ref(1));
|
|
55
|
-
watch([() => props.scale, fitScale], () => {
|
|
56
|
-
const s = props.scale && props.scale > 0 ? props.scale : (fitScale == null ? void 0 : fitScale.value) ?? 1;
|
|
57
|
-
position.scale = `scale(${s}) translateZ(0)`;
|
|
58
|
-
const styleKey = ["top", "bottom", "left", "right"];
|
|
59
|
-
styleKey.forEach((key) => {
|
|
60
|
-
const val = props[key];
|
|
61
|
-
if (props.unit === "%") {
|
|
62
|
-
position[key] = val == void 0 ? "auto" : `${val}${props.unit}`;
|
|
63
|
-
} else {
|
|
64
|
-
const needScale = key === "left" || key === "top";
|
|
65
|
-
position[key] = val == void 0 ? "auto" : `${needScale ? val * s : val}${props.unit}`;
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
}, { immediate: true });
|
|
79
|
+
const { position, origin } = useFitPosition(props);
|
|
69
80
|
return (_ctx, _cache) => {
|
|
70
81
|
return openBlock(), createElementBlock("div", {
|
|
71
82
|
class: "fit-container",
|
|
72
|
-
style: normalizeStyle({ transform: position.scale, transformOrigin: origin
|
|
83
|
+
style: normalizeStyle({ transform: unref(position).scale, transformOrigin: unref(origin), top: unref(position).top, bottom: unref(position).bottom, left: unref(position).left, right: unref(position).right, zIndex: props.z })
|
|
73
84
|
}, [
|
|
74
85
|
renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
|
75
86
|
], 4);
|
|
@@ -83,8 +94,131 @@ const _export_sfc = (sfc, props) => {
|
|
|
83
94
|
}
|
|
84
95
|
return target;
|
|
85
96
|
};
|
|
86
|
-
const FitContainer = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
87
|
-
const
|
|
97
|
+
const FitContainer = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-42c37d40"]]);
|
|
98
|
+
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
99
|
+
__name: "VFitLT",
|
|
100
|
+
props: {
|
|
101
|
+
scale: { type: Number, default: 0 },
|
|
102
|
+
top: { type: Number },
|
|
103
|
+
left: { type: Number },
|
|
104
|
+
unit: { type: String, default: "px" },
|
|
105
|
+
z: { type: Number, default: 300 }
|
|
106
|
+
},
|
|
107
|
+
setup(__props) {
|
|
108
|
+
const props = __props;
|
|
109
|
+
const { position, origin } = useFitPosition(props);
|
|
110
|
+
return (_ctx, _cache) => {
|
|
111
|
+
return openBlock(), createElementBlock("div", {
|
|
112
|
+
class: "vfit-lt",
|
|
113
|
+
style: normalizeStyle({ transform: unref(position).scale, transformOrigin: unref(origin), top: unref(position).top, left: unref(position).left, zIndex: props.z })
|
|
114
|
+
}, [
|
|
115
|
+
renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
|
116
|
+
], 4);
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
const VFitLT = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-1533313f"]]);
|
|
121
|
+
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
122
|
+
__name: "VFitRT",
|
|
123
|
+
props: {
|
|
124
|
+
scale: { type: Number, default: 0 },
|
|
125
|
+
top: { type: Number },
|
|
126
|
+
right: { type: Number },
|
|
127
|
+
unit: { type: String, default: "px" },
|
|
128
|
+
z: { type: Number, default: 300 }
|
|
129
|
+
},
|
|
130
|
+
setup(__props) {
|
|
131
|
+
const props = __props;
|
|
132
|
+
const { position, origin } = useFitPosition(props, {
|
|
133
|
+
origin: "100% 0",
|
|
134
|
+
scaleKeys: ["top", "right"]
|
|
135
|
+
});
|
|
136
|
+
return (_ctx, _cache) => {
|
|
137
|
+
return openBlock(), createElementBlock("div", {
|
|
138
|
+
class: "vfit-rt",
|
|
139
|
+
style: normalizeStyle({ transform: unref(position).scale, transformOrigin: unref(origin), top: unref(position).top, right: unref(position).right, zIndex: props.z })
|
|
140
|
+
}, [
|
|
141
|
+
renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
|
142
|
+
], 4);
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
const VFitRT = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-dfa9fc63"]]);
|
|
147
|
+
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
148
|
+
__name: "VFitLB",
|
|
149
|
+
props: {
|
|
150
|
+
scale: { type: Number, default: 0 },
|
|
151
|
+
bottom: { type: Number },
|
|
152
|
+
left: { type: Number },
|
|
153
|
+
unit: { type: String, default: "px" },
|
|
154
|
+
z: { type: Number, default: 300 }
|
|
155
|
+
},
|
|
156
|
+
setup(__props) {
|
|
157
|
+
const props = __props;
|
|
158
|
+
const { position, origin } = useFitPosition(props, {
|
|
159
|
+
origin: "0 100%",
|
|
160
|
+
scaleKeys: ["bottom", "left"]
|
|
161
|
+
});
|
|
162
|
+
return (_ctx, _cache) => {
|
|
163
|
+
return openBlock(), createElementBlock("div", {
|
|
164
|
+
class: "vfit-lb",
|
|
165
|
+
style: normalizeStyle({ transform: unref(position).scale, transformOrigin: unref(origin), bottom: unref(position).bottom, left: unref(position).left, zIndex: props.z })
|
|
166
|
+
}, [
|
|
167
|
+
renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
|
168
|
+
], 4);
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
const VFitLB = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-e2439afc"]]);
|
|
173
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
174
|
+
__name: "VFitRB",
|
|
175
|
+
props: {
|
|
176
|
+
scale: { type: Number, default: 0 },
|
|
177
|
+
bottom: { type: Number },
|
|
178
|
+
right: { type: Number },
|
|
179
|
+
unit: { type: String, default: "px" },
|
|
180
|
+
z: { type: Number, default: 300 }
|
|
181
|
+
},
|
|
182
|
+
setup(__props) {
|
|
183
|
+
const props = __props;
|
|
184
|
+
const { position, origin } = useFitPosition(props, {
|
|
185
|
+
origin: "100% 100%",
|
|
186
|
+
scaleKeys: ["bottom", "right"]
|
|
187
|
+
});
|
|
188
|
+
return (_ctx, _cache) => {
|
|
189
|
+
return openBlock(), createElementBlock("div", {
|
|
190
|
+
class: "vfit-rb",
|
|
191
|
+
style: normalizeStyle({ transform: unref(position).scale, transformOrigin: unref(origin), bottom: unref(position).bottom, right: unref(position).right, zIndex: props.z })
|
|
192
|
+
}, [
|
|
193
|
+
renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
|
194
|
+
], 4);
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
const VFitRB = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-33198615"]]);
|
|
199
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
200
|
+
__name: "VFitCenter",
|
|
201
|
+
props: {
|
|
202
|
+
scale: { type: Number, default: 0 },
|
|
203
|
+
z: { type: Number, default: 300 }
|
|
204
|
+
},
|
|
205
|
+
setup(__props) {
|
|
206
|
+
const props = __props;
|
|
207
|
+
const { position, origin } = useFitPosition(props, {
|
|
208
|
+
origin: "50% 50%",
|
|
209
|
+
scaleKeys: []
|
|
210
|
+
});
|
|
211
|
+
return (_ctx, _cache) => {
|
|
212
|
+
return openBlock(), createElementBlock("div", {
|
|
213
|
+
class: "vfit-center",
|
|
214
|
+
style: normalizeStyle({ transform: unref(position).scale, transformOrigin: unref(origin), zIndex: props.z })
|
|
215
|
+
}, [
|
|
216
|
+
renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
|
217
|
+
], 4);
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
const VFitCenter = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-289ce2dd"]]);
|
|
88
222
|
function createFitScale(options = {}) {
|
|
89
223
|
const fitScale = ref(1);
|
|
90
224
|
return {
|
|
@@ -97,16 +231,21 @@ function createFitScale(options = {}) {
|
|
|
97
231
|
app.provide(FitScaleKey, fitScale);
|
|
98
232
|
app.config.globalProperties.$fitScale = fitScale;
|
|
99
233
|
app.component("FitContainer", FitContainer);
|
|
234
|
+
app.component("vfit-lt", VFitLT);
|
|
235
|
+
app.component("vfit-rt", VFitRT);
|
|
236
|
+
app.component("vfit-lb", VFitLB);
|
|
237
|
+
app.component("vfit-rb", VFitRB);
|
|
238
|
+
app.component("vfit-center", VFitCenter);
|
|
100
239
|
}
|
|
101
240
|
};
|
|
102
241
|
}
|
|
103
|
-
function useFitScale() {
|
|
104
|
-
const injectedFitScale = inject(FitScaleKey, ref(1));
|
|
105
|
-
return injectedFitScale;
|
|
106
|
-
}
|
|
107
242
|
export {
|
|
108
243
|
FitContainer,
|
|
109
|
-
|
|
244
|
+
VFitCenter,
|
|
245
|
+
VFitLB,
|
|
246
|
+
VFitLT,
|
|
247
|
+
VFitRB,
|
|
248
|
+
VFitRT,
|
|
110
249
|
createFitScale,
|
|
111
250
|
useFitScale
|
|
112
251
|
};
|
package/dist/fitscale.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(t,e){typeof exports==="object"&&typeof module!=="undefined"?e(exports,require("vue")):typeof define==="function"&&define.amd?define(["exports","vue"],e):(t=typeof globalThis!=="undefined"?globalThis:t||self,e(t.FitScale={},t.Vue))})(this,function(t,e){"use strict";function o(t,e,o,n="auto",
|
|
1
|
+
(function(t,e){typeof exports==="object"&&typeof module!=="undefined"?e(exports,require("vue")):typeof define==="function"&&define.amd?define(["exports","vue"],e):(t=typeof globalThis!=="undefined"?globalThis:t||self,e(t.FitScale={},t.Vue))})(this,function(t,e){"use strict";function o(t,e,o,n="auto",r=1920){const i=new ResizeObserver(t=>{for(const i of t){const t=i.contentRect.height;const s=i.contentRect.width;let l;if(n==="height"){l=t/e}else if(n==="width"){l=s/r}else{const o=r/e;if(s/t<o){l=s/r}else{l=t/e}}o(l)}});i.observe(t);return i}const n=Symbol("FitScale");function r(){const t=e.inject(n,e.ref(1));return t}function i(t,o={}){const r=e.reactive({scale:`scale(1)`,top:"auto",bottom:"auto",left:"auto",right:"auto",translate:"translate(0, 0)"});const i=e.computed(()=>{if(o.origin)return o.origin;const e=t.right!==void 0;const n=t.bottom!==void 0;if(e&&n)return"100% 100%";if(e)return"100% 0";if(n)return"0 100%";return"0 0"});const s=e.inject(n,e.ref(1));e.watch([()=>t.scale,s],()=>{const e=t.scale&&t.scale>0?t.scale:(s==null?void 0:s.value)??1;r.scale=`scale(${e}) translateZ(0)`;const n=["top","bottom","left","right"];n.forEach(n=>{const i=t[n];if(t.unit==="%"){r[n]=i==void 0?"auto":`${i}${t.unit}`}else{const s=o.scaleKeys?o.scaleKeys.includes(n):n==="left"||n==="top";r[n]=i==void 0?"auto":`${s?i*e:i}${t.unit}`}})},{immediate:true});return{position:r,origin:i}}const s=e.defineComponent({__name:"FitContainer",props:{scale:{type:Number,default:0},top:{type:Number},bottom:{type:Number},left:{type:Number},right:{type:Number},unit:{type:String,default:"px"},z:{type:Number,default:300}},setup(t){const o=t;const{position:n,origin:r}=i(o);return(t,i)=>(e.openBlock(),e.createElementBlock("div",{class:"fit-container",style:e.normalizeStyle({transform:e.unref(n).scale,transformOrigin:e.unref(r),top:e.unref(n).top,bottom:e.unref(n).bottom,left:e.unref(n).left,right:e.unref(n).right,zIndex:o.z})},[e.renderSlot(t.$slots,"default",{},void 0,true)],4))}});const l=(t,e)=>{const o=t.__vccOpts||t;for(const[n,r]of e){o[n]=r}return o};const c=l(s,[["__scopeId","data-v-42c37d40"]]);const u=e.defineComponent({__name:"VFitLT",props:{scale:{type:Number,default:0},top:{type:Number},left:{type:Number},unit:{type:String,default:"px"},z:{type:Number,default:300}},setup(t){const o=t;const{position:n,origin:r}=i(o);return(t,i)=>(e.openBlock(),e.createElementBlock("div",{class:"vfit-lt",style:e.normalizeStyle({transform:e.unref(n).scale,transformOrigin:e.unref(r),top:e.unref(n).top,left:e.unref(n).left,zIndex:o.z})},[e.renderSlot(t.$slots,"default",{},void 0,true)],4))}});const a=l(u,[["__scopeId","data-v-1533313f"]]);const f=e.defineComponent({__name:"VFitRT",props:{scale:{type:Number,default:0},top:{type:Number},right:{type:Number},unit:{type:String,default:"px"},z:{type:Number,default:300}},setup(t){const o=t;const{position:n,origin:r}=i(o,{origin:"100% 0",scaleKeys:["top","right"]});return(t,i)=>(e.openBlock(),e.createElementBlock("div",{class:"vfit-rt",style:e.normalizeStyle({transform:e.unref(n).scale,transformOrigin:e.unref(r),top:e.unref(n).top,right:e.unref(n).right,zIndex:o.z})},[e.renderSlot(t.$slots,"default",{},void 0,true)],4))}});const p=l(f,[["__scopeId","data-v-dfa9fc63"]]);const d=e.defineComponent({__name:"VFitLB",props:{scale:{type:Number,default:0},bottom:{type:Number},left:{type:Number},unit:{type:String,default:"px"},z:{type:Number,default:300}},setup(t){const o=t;const{position:n,origin:r}=i(o,{origin:"0 100%",scaleKeys:["bottom","left"]});return(t,i)=>(e.openBlock(),e.createElementBlock("div",{class:"vfit-lb",style:e.normalizeStyle({transform:e.unref(n).scale,transformOrigin:e.unref(r),bottom:e.unref(n).bottom,left:e.unref(n).left,zIndex:o.z})},[e.renderSlot(t.$slots,"default",{},void 0,true)],4))}});const m=l(d,[["__scopeId","data-v-e2439afc"]]);const y=e.defineComponent({__name:"VFitRB",props:{scale:{type:Number,default:0},bottom:{type:Number},right:{type:Number},unit:{type:String,default:"px"},z:{type:Number,default:300}},setup(t){const o=t;const{position:n,origin:r}=i(o,{origin:"100% 100%",scaleKeys:["bottom","right"]});return(t,i)=>(e.openBlock(),e.createElementBlock("div",{class:"vfit-rb",style:e.normalizeStyle({transform:e.unref(n).scale,transformOrigin:e.unref(r),bottom:e.unref(n).bottom,right:e.unref(n).right,zIndex:o.z})},[e.renderSlot(t.$slots,"default",{},void 0,true)],4))}});const g=l(y,[["__scopeId","data-v-33198615"]]);const b=e.defineComponent({__name:"VFitCenter",props:{scale:{type:Number,default:0},z:{type:Number,default:300}},setup(t){const o=t;const{position:n,origin:r}=i(o,{origin:"50% 50%",scaleKeys:[]});return(t,i)=>(e.openBlock(),e.createElementBlock("div",{class:"vfit-center",style:e.normalizeStyle({transform:e.unref(n).scale,transformOrigin:e.unref(r),zIndex:o.z})},[e.renderSlot(t.$slots,"default",{},void 0,true)],4))}});const v=l(b,[["__scopeId","data-v-289ce2dd"]]);function h(t={}){const r=e.ref(1);return{install(e){const i=typeof t.target==="string"?document.querySelector(t.target):t.target;const s=i||document.querySelector("#app");o(s,t.designHeight??1080,t=>{r.value=t},t.scaleMode??"auto",t.designWidth??1920);e.provide(n,r);e.config.globalProperties.$fitScale=r;e.component("FitContainer",c);e.component("vfit-lt",a);e.component("vfit-rt",p);e.component("vfit-lb",m);e.component("vfit-rb",g);e.component("vfit-center",v)}}}t.FitContainer=c;t.VFitCenter=v;t.VFitLB=m;t.VFitLT=a;t.VFitRB=g;t.VFitRT=p;t.createFitScale=h;t.useFitScale=r;Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})});
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
import type { App
|
|
1
|
+
import type { App } from 'vue';
|
|
2
|
+
import { useFitScale } from './useFitScale';
|
|
2
3
|
import FitContainer from './components/FitContainer.vue';
|
|
3
|
-
|
|
4
|
+
import VFitLT from './components/VFitLT.vue';
|
|
5
|
+
import VFitRT from './components/VFitRT.vue';
|
|
6
|
+
import VFitLB from './components/VFitLB.vue';
|
|
7
|
+
import VFitRB from './components/VFitRB.vue';
|
|
8
|
+
import VFitCenter from './components/VFitCenter.vue';
|
|
4
9
|
export type FitScaleOptions = {
|
|
5
10
|
target?: string | HTMLElement;
|
|
6
11
|
designHeight?: number;
|
|
@@ -10,5 +15,4 @@ export type FitScaleOptions = {
|
|
|
10
15
|
export declare function createFitScale(options?: FitScaleOptions): {
|
|
11
16
|
install(app: App): void;
|
|
12
17
|
};
|
|
13
|
-
export
|
|
14
|
-
export { FitContainer };
|
|
18
|
+
export { FitContainer, VFitLT, VFitRT, VFitLB, VFitRB, VFitCenter, useFitScale };
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.fit-container[data-v-
|
|
1
|
+
.fit-container[data-v-42c37d40],.vfit-lt[data-v-1533313f]{position:absolute;transform-origin:0 0;z-index:300;will-change:transform;backface-visibility:hidden;perspective:1000px}.vfit-rt[data-v-dfa9fc63]{position:absolute;transform-origin:100% 0;z-index:300;will-change:transform;backface-visibility:hidden;perspective:1000px}.vfit-lb[data-v-e2439afc]{position:absolute;transform-origin:0 100%;z-index:300;will-change:transform;backface-visibility:hidden;perspective:1000px}.vfit-rb[data-v-33198615]{position:absolute;transform-origin:100% 100%;z-index:300;will-change:transform;backface-visibility:hidden;perspective:1000px}.vfit-center[data-v-289ce2dd]{position:absolute;top:50%;left:50%;transform-origin:50% 50%;z-index:300;will-change:transform;backface-visibility:hidden;perspective:1000px}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare function useFitPosition(props: any, options?: {
|
|
2
|
+
origin?: string;
|
|
3
|
+
scaleKeys?: string[];
|
|
4
|
+
extraTransform?: string;
|
|
5
|
+
}): {
|
|
6
|
+
position: {
|
|
7
|
+
scale: string;
|
|
8
|
+
top: string;
|
|
9
|
+
bottom: string;
|
|
10
|
+
left: string;
|
|
11
|
+
right: string;
|
|
12
|
+
translate: string;
|
|
13
|
+
};
|
|
14
|
+
origin: import("vue").ComputedRef<string>;
|
|
15
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vfit",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "A tiny Vue 3 plugin to auto-fit UI scale based on container size, plus a FitContainer component for easy positioning.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vue3",
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
"module": "dist/fitscale.es.js",
|
|
27
27
|
"exports": {
|
|
28
28
|
".": {
|
|
29
|
-
"types": "dist/index.d.ts",
|
|
30
|
-
"import": "dist/fitscale.es.js",
|
|
31
|
-
"require": "dist/fitscale.umd.js"
|
|
29
|
+
"types": "./dist/index.d.ts",
|
|
30
|
+
"import": "./dist/fitscale.es.js",
|
|
31
|
+
"require": "./dist/fitscale.umd.js"
|
|
32
32
|
},
|
|
33
33
|
"./style.css": "./dist/style.css"
|
|
34
34
|
},
|