@varlet/shared 3.2.10-alpha.1715410887389 → 3.2.10
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.cjs +9 -0
- package/lib/index.d.cts +2 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.js +8 -0
- package/package.json +1 -1
package/lib/index.cjs
CHANGED
|
@@ -75,6 +75,7 @@ __export(src_exports, {
|
|
|
75
75
|
removeArrayBlank: () => removeArrayBlank,
|
|
76
76
|
removeItem: () => removeItem,
|
|
77
77
|
requestAnimationFrame: () => requestAnimationFrame,
|
|
78
|
+
slash: () => slash,
|
|
78
79
|
supportTouch: () => supportTouch,
|
|
79
80
|
throttle: () => throttle,
|
|
80
81
|
toDataURL: () => toDataURL,
|
|
@@ -284,6 +285,13 @@ var kebabCase = (s) => {
|
|
|
284
285
|
const ret = s.replace(/([A-Z])/g, " $1").trim();
|
|
285
286
|
return ret.split(" ").join("-").toLowerCase();
|
|
286
287
|
};
|
|
288
|
+
var slash = (path) => {
|
|
289
|
+
const isExtendedLengthPath = path.startsWith("\\\\?\\");
|
|
290
|
+
if (isExtendedLengthPath) {
|
|
291
|
+
return path;
|
|
292
|
+
}
|
|
293
|
+
return path.replace(/\\/g, "/");
|
|
294
|
+
};
|
|
287
295
|
function createNamespaceFn(namespace) {
|
|
288
296
|
return (name) => {
|
|
289
297
|
const componentName = `${namespace}-${name}`;
|
|
@@ -343,6 +351,7 @@ function createNamespaceFn(namespace) {
|
|
|
343
351
|
removeArrayBlank,
|
|
344
352
|
removeItem,
|
|
345
353
|
requestAnimationFrame,
|
|
354
|
+
slash,
|
|
346
355
|
supportTouch,
|
|
347
356
|
throttle,
|
|
348
357
|
toDataURL,
|
package/lib/index.d.cts
CHANGED
|
@@ -48,6 +48,7 @@ declare const clampArrayRange: (index: number, arr: Array<unknown>) => number;
|
|
|
48
48
|
declare const bigCamelize: (s: string) => string;
|
|
49
49
|
declare const camelize: (s: string) => string;
|
|
50
50
|
declare const kebabCase: (s: string) => string;
|
|
51
|
+
declare const slash: (path: string) => string;
|
|
51
52
|
type BEM<S extends string | undefined, N extends string, NC extends string> = S extends undefined ? NC : S extends `$--${infer CM}` ? `${N}--${CM}` : S extends `--${infer M}` ? `${NC}--${M}` : `${NC}__${S}`;
|
|
52
53
|
declare function createNamespaceFn<N extends string>(namespace: N): <C extends string>(name: C) => {
|
|
53
54
|
name: string;
|
|
@@ -55,4 +56,4 @@ declare function createNamespaceFn<N extends string>(namespace: N): <C extends s
|
|
|
55
56
|
classes: (...classes: Classes) => any[];
|
|
56
57
|
};
|
|
57
58
|
|
|
58
|
-
export { BEM, ClassName, Classes, bigCamelize, call, camelize, cancelAnimationFrame, clamp, clampArrayRange, classes, createNamespaceFn, debounce, doubleRaf, find, getGlobalThis, getRect, getScrollLeft, getScrollTop, getStyle, hasOwn, inBrowser, inMobile, inViewport, isArray, isBoolean, isEmpty, isFunction, isNumber, isNumeric, isObject, isPlainObject, isString, isURL, isWindow, kebabCase, normalizeToArray, preventDefault, raf, removeArrayBlank, removeItem, requestAnimationFrame, supportTouch, throttle, toDataURL, toNumber, toggleItem, uniq };
|
|
59
|
+
export { BEM, ClassName, Classes, bigCamelize, call, camelize, cancelAnimationFrame, clamp, clampArrayRange, classes, createNamespaceFn, debounce, doubleRaf, find, getGlobalThis, getRect, getScrollLeft, getScrollTop, getStyle, hasOwn, inBrowser, inMobile, inViewport, isArray, isBoolean, isEmpty, isFunction, isNumber, isNumeric, isObject, isPlainObject, isString, isURL, isWindow, kebabCase, normalizeToArray, preventDefault, raf, removeArrayBlank, removeItem, requestAnimationFrame, slash, supportTouch, throttle, toDataURL, toNumber, toggleItem, uniq };
|
package/lib/index.d.ts
CHANGED
|
@@ -48,6 +48,7 @@ declare const clampArrayRange: (index: number, arr: Array<unknown>) => number;
|
|
|
48
48
|
declare const bigCamelize: (s: string) => string;
|
|
49
49
|
declare const camelize: (s: string) => string;
|
|
50
50
|
declare const kebabCase: (s: string) => string;
|
|
51
|
+
declare const slash: (path: string) => string;
|
|
51
52
|
type BEM<S extends string | undefined, N extends string, NC extends string> = S extends undefined ? NC : S extends `$--${infer CM}` ? `${N}--${CM}` : S extends `--${infer M}` ? `${NC}--${M}` : `${NC}__${S}`;
|
|
52
53
|
declare function createNamespaceFn<N extends string>(namespace: N): <C extends string>(name: C) => {
|
|
53
54
|
name: string;
|
|
@@ -55,4 +56,4 @@ declare function createNamespaceFn<N extends string>(namespace: N): <C extends s
|
|
|
55
56
|
classes: (...classes: Classes) => any[];
|
|
56
57
|
};
|
|
57
58
|
|
|
58
|
-
export { BEM, ClassName, Classes, bigCamelize, call, camelize, cancelAnimationFrame, clamp, clampArrayRange, classes, createNamespaceFn, debounce, doubleRaf, find, getGlobalThis, getRect, getScrollLeft, getScrollTop, getStyle, hasOwn, inBrowser, inMobile, inViewport, isArray, isBoolean, isEmpty, isFunction, isNumber, isNumeric, isObject, isPlainObject, isString, isURL, isWindow, kebabCase, normalizeToArray, preventDefault, raf, removeArrayBlank, removeItem, requestAnimationFrame, supportTouch, throttle, toDataURL, toNumber, toggleItem, uniq };
|
|
59
|
+
export { BEM, ClassName, Classes, bigCamelize, call, camelize, cancelAnimationFrame, clamp, clampArrayRange, classes, createNamespaceFn, debounce, doubleRaf, find, getGlobalThis, getRect, getScrollLeft, getScrollTop, getStyle, hasOwn, inBrowser, inMobile, inViewport, isArray, isBoolean, isEmpty, isFunction, isNumber, isNumeric, isObject, isPlainObject, isString, isURL, isWindow, kebabCase, normalizeToArray, preventDefault, raf, removeArrayBlank, removeItem, requestAnimationFrame, slash, supportTouch, throttle, toDataURL, toNumber, toggleItem, uniq };
|
package/lib/index.js
CHANGED
|
@@ -218,6 +218,13 @@ var kebabCase = (s) => {
|
|
|
218
218
|
const ret = s.replace(/([A-Z])/g, " $1").trim();
|
|
219
219
|
return ret.split(" ").join("-").toLowerCase();
|
|
220
220
|
};
|
|
221
|
+
var slash = (path) => {
|
|
222
|
+
const isExtendedLengthPath = path.startsWith("\\\\?\\");
|
|
223
|
+
if (isExtendedLengthPath) {
|
|
224
|
+
return path;
|
|
225
|
+
}
|
|
226
|
+
return path.replace(/\\/g, "/");
|
|
227
|
+
};
|
|
221
228
|
function createNamespaceFn(namespace) {
|
|
222
229
|
return (name) => {
|
|
223
230
|
const componentName = `${namespace}-${name}`;
|
|
@@ -276,6 +283,7 @@ export {
|
|
|
276
283
|
removeArrayBlank,
|
|
277
284
|
removeItem,
|
|
278
285
|
requestAnimationFrame,
|
|
286
|
+
slash,
|
|
279
287
|
supportTouch,
|
|
280
288
|
throttle,
|
|
281
289
|
toDataURL,
|