@knotx/utils 0.4.16 → 0.5.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/index.cjs +29 -0
- package/dist/index.d.cts +8 -1
- package/dist/index.d.mts +8 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +26 -1
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -53,9 +53,36 @@ function getSymbol(name) {
|
|
|
53
53
|
return Symbol.for(`knotx:${name}`);
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
function cancelAnimationFrame(id) {
|
|
57
|
+
if (typeof globalThis.cancelAnimationFrame !== "undefined") {
|
|
58
|
+
return globalThis.cancelAnimationFrame(id);
|
|
59
|
+
}
|
|
60
|
+
return globalThis.clearTimeout(id);
|
|
61
|
+
}
|
|
62
|
+
function requestAnimationFrame(fn) {
|
|
63
|
+
if (typeof globalThis.requestAnimationFrame !== "undefined") {
|
|
64
|
+
return globalThis.requestAnimationFrame(fn);
|
|
65
|
+
}
|
|
66
|
+
return globalThis.setTimeout(fn, 0);
|
|
67
|
+
}
|
|
68
|
+
function cancelIdleCallback(id) {
|
|
69
|
+
if (typeof globalThis.cancelIdleCallback !== "undefined") {
|
|
70
|
+
return globalThis.cancelIdleCallback(id);
|
|
71
|
+
}
|
|
72
|
+
return globalThis.clearTimeout(id);
|
|
73
|
+
}
|
|
74
|
+
function requestIdleCallback(fn, op) {
|
|
75
|
+
if (typeof globalThis.requestIdleCallback !== "undefined") {
|
|
76
|
+
return globalThis.requestIdleCallback(fn, op);
|
|
77
|
+
}
|
|
78
|
+
return globalThis.setTimeout(fn);
|
|
79
|
+
}
|
|
80
|
+
|
|
56
81
|
exports.addBemModifier = addBemModifier;
|
|
57
82
|
exports.bem = bem;
|
|
58
83
|
exports.buildDiffOperation = buildDiffOperation;
|
|
84
|
+
exports.cancelAnimationFrame = cancelAnimationFrame;
|
|
85
|
+
exports.cancelIdleCallback = cancelIdleCallback;
|
|
59
86
|
exports.emptyOperation = emptyOperation;
|
|
60
87
|
exports.flattenOperations = flattenOperations;
|
|
61
88
|
exports.generateId = generateId;
|
|
@@ -63,3 +90,5 @@ exports.getSymbol = getSymbol;
|
|
|
63
90
|
exports.isDraftOperation = isDraftOperation;
|
|
64
91
|
exports.isEmptyBatchOperation = isEmptyBatchOperation;
|
|
65
92
|
exports.isInitOperation = isInitOperation;
|
|
93
|
+
exports.requestAnimationFrame = requestAnimationFrame;
|
|
94
|
+
exports.requestIdleCallback = requestIdleCallback;
|
package/dist/index.d.cts
CHANGED
|
@@ -28,4 +28,11 @@ declare function getSymbol<TName extends string>(name: TName): symbol & {
|
|
|
28
28
|
__knotx__?: TName;
|
|
29
29
|
};
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
declare function cancelAnimationFrame(id: any): void;
|
|
32
|
+
declare function requestAnimationFrame(fn: () => void): any;
|
|
33
|
+
declare function cancelIdleCallback(id: any): void;
|
|
34
|
+
declare function requestIdleCallback(fn: () => void, op?: {
|
|
35
|
+
timeout: number;
|
|
36
|
+
}): any;
|
|
37
|
+
|
|
38
|
+
export { type DataEmptyBatchOperation, type DataInitBatchOperation, addBemModifier, bem, buildDiffOperation, cancelAnimationFrame, cancelIdleCallback, emptyOperation, flattenOperations, generateId, getSymbol, isDraftOperation, isEmptyBatchOperation, isInitOperation, requestAnimationFrame, requestIdleCallback };
|
package/dist/index.d.mts
CHANGED
|
@@ -28,4 +28,11 @@ declare function getSymbol<TName extends string>(name: TName): symbol & {
|
|
|
28
28
|
__knotx__?: TName;
|
|
29
29
|
};
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
declare function cancelAnimationFrame(id: any): void;
|
|
32
|
+
declare function requestAnimationFrame(fn: () => void): any;
|
|
33
|
+
declare function cancelIdleCallback(id: any): void;
|
|
34
|
+
declare function requestIdleCallback(fn: () => void, op?: {
|
|
35
|
+
timeout: number;
|
|
36
|
+
}): any;
|
|
37
|
+
|
|
38
|
+
export { type DataEmptyBatchOperation, type DataInitBatchOperation, addBemModifier, bem, buildDiffOperation, cancelAnimationFrame, cancelIdleCallback, emptyOperation, flattenOperations, generateId, getSymbol, isDraftOperation, isEmptyBatchOperation, isInitOperation, requestAnimationFrame, requestIdleCallback };
|
package/dist/index.d.ts
CHANGED
|
@@ -28,4 +28,11 @@ declare function getSymbol<TName extends string>(name: TName): symbol & {
|
|
|
28
28
|
__knotx__?: TName;
|
|
29
29
|
};
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
declare function cancelAnimationFrame(id: any): void;
|
|
32
|
+
declare function requestAnimationFrame(fn: () => void): any;
|
|
33
|
+
declare function cancelIdleCallback(id: any): void;
|
|
34
|
+
declare function requestIdleCallback(fn: () => void, op?: {
|
|
35
|
+
timeout: number;
|
|
36
|
+
}): any;
|
|
37
|
+
|
|
38
|
+
export { type DataEmptyBatchOperation, type DataInitBatchOperation, addBemModifier, bem, buildDiffOperation, cancelAnimationFrame, cancelIdleCallback, emptyOperation, flattenOperations, generateId, getSymbol, isDraftOperation, isEmptyBatchOperation, isInitOperation, requestAnimationFrame, requestIdleCallback };
|
package/dist/index.js
CHANGED
|
@@ -51,4 +51,29 @@ function getSymbol(name) {
|
|
|
51
51
|
return Symbol.for(`knotx:${name}`);
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
function cancelAnimationFrame(id) {
|
|
55
|
+
if (typeof globalThis.cancelAnimationFrame !== "undefined") {
|
|
56
|
+
return globalThis.cancelAnimationFrame(id);
|
|
57
|
+
}
|
|
58
|
+
return globalThis.clearTimeout(id);
|
|
59
|
+
}
|
|
60
|
+
function requestAnimationFrame(fn) {
|
|
61
|
+
if (typeof globalThis.requestAnimationFrame !== "undefined") {
|
|
62
|
+
return globalThis.requestAnimationFrame(fn);
|
|
63
|
+
}
|
|
64
|
+
return globalThis.setTimeout(fn, 0);
|
|
65
|
+
}
|
|
66
|
+
function cancelIdleCallback(id) {
|
|
67
|
+
if (typeof globalThis.cancelIdleCallback !== "undefined") {
|
|
68
|
+
return globalThis.cancelIdleCallback(id);
|
|
69
|
+
}
|
|
70
|
+
return globalThis.clearTimeout(id);
|
|
71
|
+
}
|
|
72
|
+
function requestIdleCallback(fn, op) {
|
|
73
|
+
if (typeof globalThis.requestIdleCallback !== "undefined") {
|
|
74
|
+
return globalThis.requestIdleCallback(fn, op);
|
|
75
|
+
}
|
|
76
|
+
return globalThis.setTimeout(fn);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export { addBemModifier, bem, buildDiffOperation, cancelAnimationFrame, cancelIdleCallback, emptyOperation, flattenOperations, generateId, getSymbol, isDraftOperation, isEmptyBatchOperation, isInitOperation, requestAnimationFrame, requestIdleCallback };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@knotx/utils",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "Utils for Knotx",
|
|
5
5
|
"author": "boenfu",
|
|
6
6
|
"license": "MIT",
|
|
@@ -28,12 +28,12 @@
|
|
|
28
28
|
"dist"
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@knotx/data": "0.
|
|
31
|
+
"@knotx/data": "0.5.1"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@knotx/build-config": "0.
|
|
35
|
-
"@knotx/eslint-config": "0.
|
|
36
|
-
"@knotx/typescript-config": "0.
|
|
34
|
+
"@knotx/build-config": "0.5.1",
|
|
35
|
+
"@knotx/eslint-config": "0.5.1",
|
|
36
|
+
"@knotx/typescript-config": "0.5.1"
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|
|
39
39
|
"build": "unbuild",
|