@varlet/shared 2.17.0-alpha.1695624483655 → 2.17.0-alpha.1695808133927
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/lib/index.d.ts +2 -1
- package/lib/index.js +8 -0
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -30,5 +30,6 @@ declare const doubleRaf: () => Promise<unknown>;
|
|
|
30
30
|
declare const getStyle: (element: Element) => CSSStyleDeclaration;
|
|
31
31
|
declare const getRect: (element: Element | Window) => DOMRect;
|
|
32
32
|
declare const inViewport: (element: HTMLElement) => boolean;
|
|
33
|
+
declare const toDataURL: (file: File) => Promise<string>;
|
|
33
34
|
|
|
34
|
-
export { bigCamelize, camelize, cancelAnimationFrame, clamp, clampArrayRange, doubleRaf, find, getGlobalThis, getRect, getStyle, inBrowser, inViewport, isArray, isBoolean, isEmpty, isFunction, isNumber, isObject, isPlainObject, isString, isURL, isWindow, kebabCase, normalizeToArray, raf, removeItem, requestAnimationFrame, supportTouch, throttle, toNumber, toggleItem, uniq };
|
|
35
|
+
export { bigCamelize, camelize, cancelAnimationFrame, clamp, clampArrayRange, doubleRaf, find, getGlobalThis, getRect, getStyle, inBrowser, inViewport, isArray, isBoolean, isEmpty, isFunction, isNumber, isObject, isPlainObject, isString, isURL, isWindow, kebabCase, normalizeToArray, raf, removeItem, requestAnimationFrame, supportTouch, throttle, toDataURL, toNumber, toggleItem, uniq };
|
package/lib/index.js
CHANGED
|
@@ -155,6 +155,13 @@ var inViewport = (element) => {
|
|
|
155
155
|
const yInViewport = top <= height && bottom >= 0;
|
|
156
156
|
return xInViewport && yInViewport;
|
|
157
157
|
};
|
|
158
|
+
var toDataURL = (file) => new Promise((resolve) => {
|
|
159
|
+
const fileReader = new FileReader();
|
|
160
|
+
fileReader.onload = () => {
|
|
161
|
+
resolve(fileReader.result);
|
|
162
|
+
};
|
|
163
|
+
fileReader.readAsDataURL(file);
|
|
164
|
+
});
|
|
158
165
|
export {
|
|
159
166
|
bigCamelize,
|
|
160
167
|
camelize,
|
|
@@ -185,6 +192,7 @@ export {
|
|
|
185
192
|
requestAnimationFrame,
|
|
186
193
|
supportTouch,
|
|
187
194
|
throttle,
|
|
195
|
+
toDataURL,
|
|
188
196
|
toNumber,
|
|
189
197
|
toggleItem,
|
|
190
198
|
uniq
|