@varlet/shared 2.17.1 → 2.18.0-alpha.1697511280107

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
@@ -31,5 +31,6 @@ declare const getStyle: (element: Element) => CSSStyleDeclaration;
31
31
  declare const getRect: (element: Element | Window) => DOMRect;
32
32
  declare const inViewport: (element: HTMLElement) => boolean;
33
33
  declare const toDataURL: (file: File) => Promise<string>;
34
+ declare const preventDefault: (event: Event) => void;
34
35
 
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 };
36
+ 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, preventDefault, raf, removeItem, requestAnimationFrame, supportTouch, throttle, toDataURL, toNumber, toggleItem, uniq };
package/lib/index.js CHANGED
@@ -162,6 +162,12 @@ var toDataURL = (file) => new Promise((resolve) => {
162
162
  };
163
163
  fileReader.readAsDataURL(file);
164
164
  });
165
+ var preventDefault = (event) => {
166
+ if (event.cancelable === false) {
167
+ return;
168
+ }
169
+ event.preventDefault();
170
+ };
165
171
  export {
166
172
  bigCamelize,
167
173
  camelize,
@@ -187,6 +193,7 @@ export {
187
193
  isWindow,
188
194
  kebabCase,
189
195
  normalizeToArray,
196
+ preventDefault,
190
197
  raf,
191
198
  removeItem,
192
199
  requestAnimationFrame,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@varlet/shared",
3
- "version": "2.17.1",
3
+ "version": "2.18.0-alpha.1697511280107",
4
4
  "type": "module",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.js",