@varlet/shared 2.17.0-alpha.1695776492474 → 2.17.0-alpha.1695910724155

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 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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@varlet/shared",
3
- "version": "2.17.0-alpha.1695776492474",
3
+ "version": "2.17.0-alpha.1695910724155",
4
4
  "type": "module",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.js",