yummies 5.7.0 → 5.8.0
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/async.js +26 -59
- package/async.js.map +1 -0
- package/common.d.ts +1 -1
- package/common.d.ts.map +1 -1
- package/common.js +5 -13
- package/common.js.map +1 -0
- package/complex/global-config.d.ts +1 -1
- package/complex/global-config.d.ts.map +1 -1
- package/complex/index.d.ts +3 -3
- package/complex/index.d.ts.map +1 -1
- package/complex/modules-factory.d.ts +1 -1
- package/complex/modules-factory.d.ts.map +1 -1
- package/complex.js +66 -0
- package/complex.js.map +1 -0
- package/cookie.d.ts +1 -1
- package/cookie.d.ts.map +1 -1
- package/cookie.js +4 -8
- package/cookie.js.map +1 -0
- package/css.d.ts +1 -1
- package/css.js +2780 -49
- package/css.js.map +1 -0
- package/data.js +32 -50
- package/data.js.map +1 -0
- package/date-time.d.ts +2 -3
- package/date-time.d.ts.map +1 -1
- package/date-time.js +588 -154
- package/date-time.js.map +1 -0
- package/device.js +23 -20
- package/device.js.map +1 -0
- package/encodings.js +269 -265
- package/encodings.js.map +1 -0
- package/errors.d.ts +1 -1
- package/errors.d.ts.map +1 -1
- package/errors.js +8 -29
- package/errors.js.map +1 -0
- package/file.js +19 -23
- package/file.js.map +1 -0
- package/format/_exports.d.ts +4 -4
- package/format/_exports.d.ts.map +1 -1
- package/format/index.d.ts +1 -1
- package/format/index.d.ts.map +1 -1
- package/format/number.d.ts +1 -1
- package/format/number.d.ts.map +1 -1
- package/format/percent.d.ts +2 -2
- package/format/percent.d.ts.map +1 -1
- package/format.js +27 -0
- package/format.js.map +1 -0
- package/html.d.ts +2 -2
- package/html.d.ts.map +1 -1
- package/html.js +636 -169
- package/html.js.map +1 -0
- package/id.js +25 -70
- package/id.js.map +1 -0
- package/imports.js +22 -37
- package/imports.js.map +1 -0
- package/math.d.ts +1 -1
- package/math.d.ts.map +1 -1
- package/math.js +10 -14
- package/math.js.map +1 -0
- package/media.js +54 -96
- package/media.js.map +1 -0
- package/mobx/apply-observable.d.ts +1 -1
- package/mobx/apply-observable.d.ts.map +1 -1
- package/mobx/create-enhanced-atom.d.ts +2 -2
- package/mobx/create-enhanced-atom.d.ts.map +1 -1
- package/mobx/deep-observable-struct.d.ts +1 -1
- package/mobx/deep-observable-struct.d.ts.map +1 -1
- package/mobx/get-mobx-administration.d.ts +2 -2
- package/mobx/get-mobx-administration.d.ts.map +1 -1
- package/mobx/index.d.ts +5 -5
- package/mobx/index.d.ts.map +1 -1
- package/mobx/lazy-observe.d.ts +6 -0
- package/mobx/lazy-observe.d.ts.map +1 -1
- package/mobx.js +89 -0
- package/mobx.js.map +1 -0
- package/ms.js +12 -17
- package/ms.js.map +1 -0
- package/number.js +9 -12
- package/number.js.map +1 -0
- package/package.json +93 -92
- package/parser/_exports.d.ts +3 -3
- package/parser/_exports.d.ts.map +1 -1
- package/parser/index.d.ts +1 -1
- package/parser/index.d.ts.map +1 -1
- package/parser/number.d.ts +1 -1
- package/parser/number.d.ts.map +1 -1
- package/parser/percent.d.ts +2 -2
- package/parser/percent.d.ts.map +1 -1
- package/parser/string.d.ts +1 -1
- package/parser/string.d.ts.map +1 -1
- package/parser.js +15 -0
- package/parser.js.map +1 -0
- package/price.js +13 -16
- package/price.js.map +1 -0
- package/random.js +11 -13
- package/random.js.map +1 -0
- package/react/hooks/index.d.ts +21 -21
- package/react/hooks/index.d.ts.map +1 -1
- package/react/hooks/use-click-outside.d.ts +1 -1
- package/react/hooks/use-define-ref.d.ts +1 -1
- package/react/hooks/use-element-ref.d.ts +1 -1
- package/react/hooks/use-event.d.ts +1 -1
- package/react/hooks/use-event.d.ts.map +1 -1
- package/react/hooks/use-initial-height.d.ts +1 -1
- package/react/hooks/use-last-value-ref.d.ts +1 -1
- package/react/hooks/use-resize-observer.d.ts +1 -1
- package/react/hooks/use-sync-ref.d.ts +1 -1
- package/react/hooks/use-toggle.d.ts +1 -1
- package/react/hooks/use-value.d.ts +1 -1
- package/react/index.d.ts +1 -1
- package/react/index.d.ts.map +1 -1
- package/react.js +152 -0
- package/react.js.map +1 -0
- package/sound.js +7 -11
- package/sound.js.map +1 -0
- package/text.js +20 -46
- package/text.js.map +1 -0
- package/type-guard/_exports.d.ts +1 -1
- package/type-guard/_exports.d.ts.map +1 -1
- package/type-guard/index.d.ts +1 -1
- package/type-guard/index.d.ts.map +1 -1
- package/type-guard.js +5 -0
- package/type-guard.js.map +1 -0
- package/utility-types.d.ts.map +1 -0
- package/utility-types.js +2 -0
- package/utility-types.js.map +1 -0
- package/utils/types.js +2 -1
- package/utils/types.js.map +1 -0
- package/vibrate.js +6 -7
- package/vibrate.js.map +1 -0
- package/~index-C3wKHvHr.js +80 -0
- package/~index-C3wKHvHr.js.map +1 -0
- package/~number-EWff2XI6.js +25 -0
- package/~number-EWff2XI6.js.map +1 -0
- package/~number-baxVnzrJ.js +32 -0
- package/~number-baxVnzrJ.js.map +1 -0
- package/async.cjs +0 -70
- package/async.d.cts +0 -28
- package/async.d.cts.map +0 -1
- package/common.cjs +0 -18
- package/common.d.cts +0 -15
- package/common.d.cts.map +0 -1
- package/complex/counter.cjs +0 -21
- package/complex/counter.d.cts +0 -15
- package/complex/counter.d.cts.map +0 -1
- package/complex/counter.js +0 -17
- package/complex/global-config.cjs +0 -46
- package/complex/global-config.d.cts +0 -11
- package/complex/global-config.d.cts.map +0 -1
- package/complex/global-config.js +0 -41
- package/complex/index.cjs +0 -19
- package/complex/index.d.cts +0 -4
- package/complex/index.d.cts.map +0 -1
- package/complex/index.js +0 -3
- package/complex/modules-factory.cjs +0 -50
- package/complex/modules-factory.d.cts +0 -49
- package/complex/modules-factory.d.cts.map +0 -1
- package/complex/modules-factory.js +0 -46
- package/cookie.cjs +0 -13
- package/cookie.d.cts +0 -3
- package/cookie.d.cts.map +0 -1
- package/css.cjs +0 -64
- package/css.d.cts +0 -42
- package/css.d.cts.map +0 -1
- package/data.cjs +0 -58
- package/data.d.cts +0 -4
- package/data.d.cts.map +0 -1
- package/date-time.cjs +0 -171
- package/date-time.d.cts +0 -28
- package/date-time.d.cts.map +0 -1
- package/device.cjs +0 -28
- package/device.d.cts +0 -8
- package/device.d.cts.map +0 -1
- package/encodings.cjs +0 -270
- package/encodings.d.cts +0 -2
- package/encodings.d.cts.map +0 -1
- package/errors.cjs +0 -34
- package/errors.d.cts +0 -19
- package/errors.d.cts.map +0 -1
- package/file.cjs +0 -29
- package/file.d.cts +0 -3
- package/file.d.cts.map +0 -1
- package/format/_exports.cjs +0 -20
- package/format/_exports.d.cts +0 -5
- package/format/_exports.d.cts.map +0 -1
- package/format/_exports.js +0 -4
- package/format/constants.cjs +0 -6
- package/format/constants.d.cts +0 -4
- package/format/constants.d.cts.map +0 -1
- package/format/constants.js +0 -3
- package/format/index.cjs +0 -40
- package/format/index.d.cts +0 -3
- package/format/index.d.cts.map +0 -1
- package/format/index.js +0 -4
- package/format/number.cjs +0 -48
- package/format/number.d.cts +0 -36
- package/format/number.d.cts.map +0 -1
- package/format/number.js +0 -44
- package/format/percent.cjs +0 -27
- package/format/percent.d.cts +0 -15
- package/format/percent.d.cts.map +0 -1
- package/format/percent.js +0 -23
- package/format/skip-spaces.cjs +0 -8
- package/format/skip-spaces.d.cts +0 -5
- package/format/skip-spaces.d.cts.map +0 -1
- package/format/skip-spaces.js +0 -4
- package/html.cjs +0 -202
- package/html.d.cts +0 -44
- package/html.d.cts.map +0 -1
- package/id.cjs +0 -76
- package/id.d.cts +0 -63
- package/id.d.cts.map +0 -1
- package/imports.cjs +0 -45
- package/imports.d.cts +0 -15
- package/imports.d.cts.map +0 -1
- package/math.cjs +0 -23
- package/math.d.cts +0 -13
- package/math.d.cts.map +0 -1
- package/media.cjs +0 -115
- package/media.d.cts +0 -20
- package/media.d.cts.map +0 -1
- package/mobx/apply-observable.cjs +0 -16
- package/mobx/apply-observable.d.cts +0 -4
- package/mobx/apply-observable.d.cts.map +0 -1
- package/mobx/apply-observable.js +0 -12
- package/mobx/create-enhanced-atom.cjs +0 -16
- package/mobx/create-enhanced-atom.d.cts +0 -11
- package/mobx/create-enhanced-atom.d.cts.map +0 -1
- package/mobx/create-enhanced-atom.js +0 -12
- package/mobx/deep-observable-struct.cjs +0 -61
- package/mobx/deep-observable-struct.d.cts +0 -7
- package/mobx/deep-observable-struct.d.cts.map +0 -1
- package/mobx/deep-observable-struct.js +0 -57
- package/mobx/get-mobx-administration.cjs +0 -6
- package/mobx/get-mobx-administration.d.cts +0 -6
- package/mobx/get-mobx-administration.d.cts.map +0 -1
- package/mobx/get-mobx-administration.js +0 -2
- package/mobx/index.cjs +0 -21
- package/mobx/index.d.cts +0 -6
- package/mobx/index.d.cts.map +0 -1
- package/mobx/index.js +0 -5
- package/mobx/lazy-observe.cjs +0 -52
- package/mobx/lazy-observe.d.cts +0 -8
- package/mobx/lazy-observe.d.cts.map +0 -1
- package/mobx/lazy-observe.js +0 -48
- package/ms.cjs +0 -22
- package/ms.d.cts +0 -19
- package/ms.d.cts.map +0 -1
- package/number.cjs +0 -16
- package/number.d.cts +0 -8
- package/number.d.cts.map +0 -1
- package/parser/_exports.cjs +0 -19
- package/parser/_exports.d.cts +0 -4
- package/parser/_exports.d.cts.map +0 -1
- package/parser/_exports.js +0 -3
- package/parser/index.cjs +0 -40
- package/parser/index.d.cts +0 -3
- package/parser/index.d.cts.map +0 -1
- package/parser/index.js +0 -4
- package/parser/number.cjs +0 -48
- package/parser/number.d.cts +0 -21
- package/parser/number.d.cts.map +0 -1
- package/parser/number.js +0 -44
- package/parser/percent.cjs +0 -8
- package/parser/percent.d.cts +0 -4
- package/parser/percent.d.cts.map +0 -1
- package/parser/percent.js +0 -4
- package/parser/string.cjs +0 -18
- package/parser/string.d.cts +0 -7
- package/parser/string.d.cts.map +0 -1
- package/parser/string.js +0 -14
- package/price.cjs +0 -21
- package/price.d.cts +0 -6
- package/price.d.cts.map +0 -1
- package/random.cjs +0 -25
- package/random.d.cts +0 -9
- package/random.d.cts.map +0 -1
- package/react/hooks/index.cjs +0 -37
- package/react/hooks/index.d.cts +0 -22
- package/react/hooks/index.d.cts.map +0 -1
- package/react/hooks/index.js +0 -21
- package/react/hooks/use-abort-controller.cjs +0 -15
- package/react/hooks/use-abort-controller.d.cts +0 -2
- package/react/hooks/use-abort-controller.d.cts.map +0 -1
- package/react/hooks/use-abort-controller.js +0 -11
- package/react/hooks/use-abort-signal.cjs +0 -8
- package/react/hooks/use-abort-signal.d.cts +0 -2
- package/react/hooks/use-abort-signal.d.cts.map +0 -1
- package/react/hooks/use-abort-signal.js +0 -4
- package/react/hooks/use-click-outside.cjs +0 -17
- package/react/hooks/use-click-outside.d.cts +0 -9
- package/react/hooks/use-click-outside.d.cts.map +0 -1
- package/react/hooks/use-click-outside.js +0 -13
- package/react/hooks/use-constant.cjs +0 -19
- package/react/hooks/use-constant.d.cts +0 -9
- package/react/hooks/use-constant.d.cts.map +0 -1
- package/react/hooks/use-constant.js +0 -15
- package/react/hooks/use-define-ref.cjs +0 -19
- package/react/hooks/use-define-ref.d.cts +0 -10
- package/react/hooks/use-define-ref.d.cts.map +0 -1
- package/react/hooks/use-define-ref.js +0 -15
- package/react/hooks/use-element-ref.cjs +0 -12
- package/react/hooks/use-element-ref.d.cts +0 -2
- package/react/hooks/use-element-ref.d.cts.map +0 -1
- package/react/hooks/use-element-ref.js +0 -8
- package/react/hooks/use-event-listener.cjs +0 -17
- package/react/hooks/use-event-listener.d.cts +0 -8
- package/react/hooks/use-event-listener.d.cts.map +0 -1
- package/react/hooks/use-event-listener.js +0 -13
- package/react/hooks/use-event.cjs +0 -23
- package/react/hooks/use-event.d.cts +0 -3
- package/react/hooks/use-event.d.cts.map +0 -1
- package/react/hooks/use-event.js +0 -19
- package/react/hooks/use-flag.cjs +0 -19
- package/react/hooks/use-flag.d.cts +0 -8
- package/react/hooks/use-flag.d.cts.map +0 -1
- package/react/hooks/use-flag.js +0 -15
- package/react/hooks/use-force-update.cjs +0 -11
- package/react/hooks/use-force-update.d.cts +0 -2
- package/react/hooks/use-force-update.d.cts.map +0 -1
- package/react/hooks/use-force-update.js +0 -7
- package/react/hooks/use-initial-height.cjs +0 -15
- package/react/hooks/use-initial-height.d.cts +0 -5
- package/react/hooks/use-initial-height.d.cts.map +0 -1
- package/react/hooks/use-initial-height.js +0 -11
- package/react/hooks/use-instance.cjs +0 -31
- package/react/hooks/use-instance.d.cts +0 -27
- package/react/hooks/use-instance.d.cts.map +0 -1
- package/react/hooks/use-instance.js +0 -27
- package/react/hooks/use-intersection-observer.cjs +0 -14
- package/react/hooks/use-intersection-observer.d.cts +0 -2
- package/react/hooks/use-intersection-observer.d.cts.map +0 -1
- package/react/hooks/use-intersection-observer.js +0 -10
- package/react/hooks/use-last-defined-value.cjs +0 -12
- package/react/hooks/use-last-defined-value.d.cts +0 -2
- package/react/hooks/use-last-defined-value.d.cts.map +0 -1
- package/react/hooks/use-last-defined-value.js +0 -8
- package/react/hooks/use-last-value-ref.cjs +0 -12
- package/react/hooks/use-last-value-ref.d.cts +0 -2
- package/react/hooks/use-last-value-ref.d.cts.map +0 -1
- package/react/hooks/use-last-value-ref.js +0 -8
- package/react/hooks/use-life-cycle.cjs +0 -14
- package/react/hooks/use-life-cycle.d.cts +0 -5
- package/react/hooks/use-life-cycle.d.cts.map +0 -1
- package/react/hooks/use-life-cycle.js +0 -10
- package/react/hooks/use-resize-observer.cjs +0 -15
- package/react/hooks/use-resize-observer.d.cts +0 -2
- package/react/hooks/use-resize-observer.d.cts.map +0 -1
- package/react/hooks/use-resize-observer.js +0 -11
- package/react/hooks/use-sync-ref.cjs +0 -10
- package/react/hooks/use-sync-ref.d.cts +0 -2
- package/react/hooks/use-sync-ref.d.cts.map +0 -1
- package/react/hooks/use-sync-ref.js +0 -6
- package/react/hooks/use-toggle.cjs +0 -10
- package/react/hooks/use-toggle.d.cts +0 -2
- package/react/hooks/use-toggle.d.cts.map +0 -1
- package/react/hooks/use-toggle.js +0 -6
- package/react/hooks/use-value.cjs +0 -12
- package/react/hooks/use-value.d.cts +0 -5
- package/react/hooks/use-value.d.cts.map +0 -1
- package/react/hooks/use-value.js +0 -8
- package/react/hooks/use-visibility-state.cjs +0 -18
- package/react/hooks/use-visibility-state.d.cts +0 -2
- package/react/hooks/use-visibility-state.d.cts.map +0 -1
- package/react/hooks/use-visibility-state.js +0 -14
- package/react/index.cjs +0 -17
- package/react/index.d.cts +0 -2
- package/react/index.d.cts.map +0 -1
- package/react/index.js +0 -1
- package/sound.cjs +0 -16
- package/sound.d.cts +0 -7
- package/sound.d.cts.map +0 -1
- package/storage.cjs +0 -48
- package/storage.d.cts +0 -39
- package/storage.d.cts.map +0 -1
- package/storage.js +0 -43
- package/text.cjs +0 -53
- package/text.d.cts +0 -15
- package/text.d.cts.map +0 -1
- package/type-guard/_exports.cjs +0 -129
- package/type-guard/_exports.d.cts +0 -86
- package/type-guard/_exports.d.cts.map +0 -1
- package/type-guard/_exports.js +0 -125
- package/type-guard/index.cjs +0 -40
- package/type-guard/index.d.cts +0 -3
- package/type-guard/index.d.cts.map +0 -1
- package/type-guard/index.js +0 -4
- package/utils/types.cjs +0 -2
- package/utils/types.d.cts +0 -395
- package/utils/types.d.cts.map +0 -1
- package/vibrate.cjs +0 -12
- package/vibrate.d.cts +0 -5
- package/vibrate.d.cts.map +0 -1
package/format/index.cjs
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.format = void 0;
|
|
37
|
-
// This way is more treeshakable than collecting
|
|
38
|
-
// it into one exportable object export const format
|
|
39
|
-
const format = __importStar(require("./_exports.cjs"));
|
|
40
|
-
exports.format = format;
|
package/format/index.d.cts
DELETED
package/format/index.d.cts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/format/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,uBAAsB;AAExC,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
package/format/index.js
DELETED
package/format/number.cjs
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.number = void 0;
|
|
4
|
-
const number_js_1 = require("../parser/number.cjs");
|
|
5
|
-
const index_js_1 = require("../type-guard/index.cjs");
|
|
6
|
-
const constants_js_1 = require("./constants.cjs");
|
|
7
|
-
const number = (rawValue, userSettings) => {
|
|
8
|
-
const settings = {
|
|
9
|
-
...exports.number.defaultSettings,
|
|
10
|
-
...userSettings,
|
|
11
|
-
};
|
|
12
|
-
const digits = settings.digits ?? 0;
|
|
13
|
-
const cutZeros = settings?.cutZeros ?? false;
|
|
14
|
-
const delimiter = settings.delimiter ?? ' ';
|
|
15
|
-
const postfix = settings.postfix ?? '';
|
|
16
|
-
const emptyText = settings.emptyText ?? constants_js_1.NO_VALUE;
|
|
17
|
-
const digitsOnlyForFloat = settings.digitsOnlyForFloat ?? true;
|
|
18
|
-
let value;
|
|
19
|
-
if (index_js_1.typeGuard.isString(rawValue)) {
|
|
20
|
-
value = (0, number_js_1.number)(value, { fallback: undefined });
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
value = rawValue;
|
|
24
|
-
}
|
|
25
|
-
if (index_js_1.typeGuard.isNumber(value)) {
|
|
26
|
-
let raw = `${value}`;
|
|
27
|
-
if (digits !== false) {
|
|
28
|
-
raw = value.toFixed(digits);
|
|
29
|
-
}
|
|
30
|
-
if (cutZeros) {
|
|
31
|
-
raw = `${+raw}`;
|
|
32
|
-
}
|
|
33
|
-
const [integerPart, decimalPart] = raw.split('.', 2);
|
|
34
|
-
let formattedIntegerPart = integerPart;
|
|
35
|
-
let formattedDecimalPart = '';
|
|
36
|
-
if (decimalPart && (!digitsOnlyForFloat || !/^0+$/.test(decimalPart))) {
|
|
37
|
-
formattedDecimalPart = `.${decimalPart}`;
|
|
38
|
-
}
|
|
39
|
-
const rgx = /(\d+)(\d{3})/;
|
|
40
|
-
while (rgx.test(formattedIntegerPart) && delimiter) {
|
|
41
|
-
formattedIntegerPart = formattedIntegerPart.replace(rgx, `$1${delimiter}$2`);
|
|
42
|
-
}
|
|
43
|
-
return formattedIntegerPart + formattedDecimalPart + postfix;
|
|
44
|
-
}
|
|
45
|
-
return emptyText;
|
|
46
|
-
};
|
|
47
|
-
exports.number = number;
|
|
48
|
-
exports.number.defaultSettings = {};
|
package/format/number.d.cts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import type { Maybe } from "../utils/types.cjs";
|
|
2
|
-
export interface NumberFormatSettings {
|
|
3
|
-
delimiter?: string;
|
|
4
|
-
/**
|
|
5
|
-
* digitsOnlyForFloat - Show digits after decimal point only if they are not zeros after converting to number.
|
|
6
|
-
* Example: "0.00" -> "0", "0.10" -> "0.1", but "0.003" -> "0.003"
|
|
7
|
-
*
|
|
8
|
-
* @default true
|
|
9
|
-
*/
|
|
10
|
-
digitsOnlyForFloat?: boolean;
|
|
11
|
-
/**
|
|
12
|
-
* Text which will be returned if the value is undefined, null, NaN, Infinity or empty string.
|
|
13
|
-
* Example: "–" will be returned if the value is undefined and emptyText is "–".
|
|
14
|
-
*/
|
|
15
|
-
emptyText?: string;
|
|
16
|
-
/**
|
|
17
|
-
* Text to append to the end of the formatted number.
|
|
18
|
-
* Example: if value is 1000 and postfix is "₽", result will be "1 000₽".
|
|
19
|
-
*/
|
|
20
|
-
postfix?: string;
|
|
21
|
-
/**
|
|
22
|
-
* Fixed number of digits after the decimal point (number.toFixed() method)
|
|
23
|
-
* If set to false, the truncation is ignored!
|
|
24
|
-
*/
|
|
25
|
-
digits?: number | false;
|
|
26
|
-
/**
|
|
27
|
-
* Remove trailing zeros from the end of the number
|
|
28
|
-
* Example: 0.010000000000000000000000000000000000000000000 -> 0.01
|
|
29
|
-
*/
|
|
30
|
-
cutZeros?: boolean;
|
|
31
|
-
}
|
|
32
|
-
export declare const number: {
|
|
33
|
-
(rawValue: Maybe<string | number>, userSettings?: Maybe<NumberFormatSettings>): string;
|
|
34
|
-
defaultSettings: NumberFormatSettings;
|
|
35
|
-
};
|
|
36
|
-
//# sourceMappingURL=number.d.ts.map
|
package/format/number.d.cts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"number.d.ts","sourceRoot":"","sources":["../../src/format/number.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,2BAA0B;AAI/C,MAAM,WAAW,oBAAoB;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;OAKG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IACxB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,eAAO,MAAM,MAAM;eACP,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,iBACjB,KAAK,CAAC,oBAAoB,CAAC,GACzC,MAAM;;CAqDR,CAAC"}
|
package/format/number.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { number as toNumber } from "../parser/number.js";
|
|
2
|
-
import { typeGuard } from "../type-guard/index.js";
|
|
3
|
-
import { NO_VALUE } from "./constants.js";
|
|
4
|
-
export const number = (rawValue, userSettings) => {
|
|
5
|
-
const settings = {
|
|
6
|
-
...number.defaultSettings,
|
|
7
|
-
...userSettings,
|
|
8
|
-
};
|
|
9
|
-
const digits = settings.digits ?? 0;
|
|
10
|
-
const cutZeros = settings?.cutZeros ?? false;
|
|
11
|
-
const delimiter = settings.delimiter ?? ' ';
|
|
12
|
-
const postfix = settings.postfix ?? '';
|
|
13
|
-
const emptyText = settings.emptyText ?? NO_VALUE;
|
|
14
|
-
const digitsOnlyForFloat = settings.digitsOnlyForFloat ?? true;
|
|
15
|
-
let value;
|
|
16
|
-
if (typeGuard.isString(rawValue)) {
|
|
17
|
-
value = toNumber(value, { fallback: undefined });
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
value = rawValue;
|
|
21
|
-
}
|
|
22
|
-
if (typeGuard.isNumber(value)) {
|
|
23
|
-
let raw = `${value}`;
|
|
24
|
-
if (digits !== false) {
|
|
25
|
-
raw = value.toFixed(digits);
|
|
26
|
-
}
|
|
27
|
-
if (cutZeros) {
|
|
28
|
-
raw = `${+raw}`;
|
|
29
|
-
}
|
|
30
|
-
const [integerPart, decimalPart] = raw.split('.', 2);
|
|
31
|
-
let formattedIntegerPart = integerPart;
|
|
32
|
-
let formattedDecimalPart = '';
|
|
33
|
-
if (decimalPart && (!digitsOnlyForFloat || !/^0+$/.test(decimalPart))) {
|
|
34
|
-
formattedDecimalPart = `.${decimalPart}`;
|
|
35
|
-
}
|
|
36
|
-
const rgx = /(\d+)(\d{3})/;
|
|
37
|
-
while (rgx.test(formattedIntegerPart) && delimiter) {
|
|
38
|
-
formattedIntegerPart = formattedIntegerPart.replace(rgx, `$1${delimiter}$2`);
|
|
39
|
-
}
|
|
40
|
-
return formattedIntegerPart + formattedDecimalPart + postfix;
|
|
41
|
-
}
|
|
42
|
-
return emptyText;
|
|
43
|
-
};
|
|
44
|
-
number.defaultSettings = {};
|
package/format/percent.cjs
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.percent = void 0;
|
|
4
|
-
const number_js_1 = require("../parser/number.cjs");
|
|
5
|
-
const index_js_1 = require("../type-guard/index.cjs");
|
|
6
|
-
const constants_js_1 = require("./constants.cjs");
|
|
7
|
-
/**
|
|
8
|
-
* 100 -> 100%
|
|
9
|
-
* 99.123214412 -> 99.12%
|
|
10
|
-
* 99.123214412 -> 99,12%
|
|
11
|
-
*/
|
|
12
|
-
const percent = (value, settings) => {
|
|
13
|
-
const numericValue = (0, number_js_1.number)(value, {
|
|
14
|
-
...settings,
|
|
15
|
-
digits: settings?.digits ?? 2,
|
|
16
|
-
fallback: Number.NaN,
|
|
17
|
-
});
|
|
18
|
-
if (index_js_1.typeGuard.isNumber(numericValue)) {
|
|
19
|
-
const divider = settings?.divider ?? '.';
|
|
20
|
-
const formattedPercent = divider === '.' ? numericValue : `${numericValue}`.replace('.', divider);
|
|
21
|
-
return `${formattedPercent}${settings?.delimiter ?? ''}${settings?.symbol ?? '%'}`;
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
return settings?.emptyText ?? constants_js_1.NO_VALUE;
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
exports.percent = percent;
|
package/format/percent.d.cts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { type NumberParserSettings } from "../parser/number.cjs";
|
|
2
|
-
import type { Maybe } from "../utils/types.cjs";
|
|
3
|
-
export interface PercentFormatSettings extends Omit<NumberParserSettings, 'fallback'> {
|
|
4
|
-
divider?: string;
|
|
5
|
-
delimiter?: string;
|
|
6
|
-
symbol?: string;
|
|
7
|
-
emptyText?: string;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* 100 -> 100%
|
|
11
|
-
* 99.123214412 -> 99.12%
|
|
12
|
-
* 99.123214412 -> 99,12%
|
|
13
|
-
*/
|
|
14
|
-
export declare const percent: (value: Maybe<number | string>, settings?: PercentFormatSettings) => string;
|
|
15
|
-
//# sourceMappingURL=percent.d.ts.map
|
package/format/percent.d.cts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"percent.d.ts","sourceRoot":"","sources":["../../src/format/percent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,oBAAoB,EAAU,6BAA4B;AAExE,OAAO,KAAK,EAAE,KAAK,EAAE,2BAA0B;AAI/C,MAAM,WAAW,qBACf,SAAQ,IAAI,CAAC,oBAAoB,EAAE,UAAU,CAAC;IAC9C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;GAIG;AACH,eAAO,MAAM,OAAO,GAClB,OAAO,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,EAC7B,WAAW,qBAAqB,WAkBjC,CAAC"}
|
package/format/percent.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { number } from "../parser/number.js";
|
|
2
|
-
import { typeGuard } from "../type-guard/index.js";
|
|
3
|
-
import { NO_VALUE } from "./constants.js";
|
|
4
|
-
/**
|
|
5
|
-
* 100 -> 100%
|
|
6
|
-
* 99.123214412 -> 99.12%
|
|
7
|
-
* 99.123214412 -> 99,12%
|
|
8
|
-
*/
|
|
9
|
-
export const percent = (value, settings) => {
|
|
10
|
-
const numericValue = number(value, {
|
|
11
|
-
...settings,
|
|
12
|
-
digits: settings?.digits ?? 2,
|
|
13
|
-
fallback: Number.NaN,
|
|
14
|
-
});
|
|
15
|
-
if (typeGuard.isNumber(numericValue)) {
|
|
16
|
-
const divider = settings?.divider ?? '.';
|
|
17
|
-
const formattedPercent = divider === '.' ? numericValue : `${numericValue}`.replace('.', divider);
|
|
18
|
-
return `${formattedPercent}${settings?.delimiter ?? ''}${settings?.symbol ?? '%'}`;
|
|
19
|
-
}
|
|
20
|
-
else {
|
|
21
|
-
return settings?.emptyText ?? NO_VALUE;
|
|
22
|
-
}
|
|
23
|
-
};
|
package/format/skip-spaces.cjs
DELETED
package/format/skip-spaces.d.cts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"skip-spaces.d.ts","sourceRoot":"","sources":["../../src/format/skip-spaces.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,UAAU,GAAI,OAAO,MAAM,WAAgC,CAAC"}
|
package/format/skip-spaces.js
DELETED
package/html.cjs
DELETED
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.isPrefersLightTheme = exports.isPrefersDarkTheme = exports.calcScrollbarWidth = exports.startViewTransitionSafety = exports.checkElementHasParent = exports.sanitizeHtml = exports.globalScrollIntoViewForY = exports.skipEvent = exports.collectOffsetTop = exports.downloadUsingAnchor = exports.getComputedColor = void 0;
|
|
7
|
-
exports.wrapTextToTagLink = wrapTextToTagLink;
|
|
8
|
-
exports.getElementInnerHeight = getElementInnerHeight;
|
|
9
|
-
exports.getElementInnerWidth = getElementInnerWidth;
|
|
10
|
-
const dompurify_1 = __importDefault(require("dompurify"));
|
|
11
|
-
const media_js_1 = require("./media.cjs");
|
|
12
|
-
/**
|
|
13
|
-
* Вытаскивает RGB из любого цвета
|
|
14
|
-
*
|
|
15
|
-
* Не рекомендуется к использованию так как вызывает reflow
|
|
16
|
-
*/
|
|
17
|
-
const getComputedColor = (color) => {
|
|
18
|
-
if (!color)
|
|
19
|
-
return null;
|
|
20
|
-
const d = document.createElement('div');
|
|
21
|
-
d.style.color = color;
|
|
22
|
-
document.body.append(d);
|
|
23
|
-
const rgbcolor = globalThis.getComputedStyle(d).color;
|
|
24
|
-
const match = /rgba?\((\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*\d+[.d+]*)*\)/g.exec(rgbcolor);
|
|
25
|
-
d.remove();
|
|
26
|
-
if (!match)
|
|
27
|
-
return null;
|
|
28
|
-
return `${match[1]}, ${match[2]}, ${match[3]}`;
|
|
29
|
-
};
|
|
30
|
-
exports.getComputedColor = getComputedColor;
|
|
31
|
-
const downloadUsingAnchor = (urlOrBlob, fileName) => {
|
|
32
|
-
const url = (0, media_js_1.blobToUrl)(urlOrBlob);
|
|
33
|
-
const a = document.createElement('a');
|
|
34
|
-
a.href = url;
|
|
35
|
-
a.download = fileName ?? 'file';
|
|
36
|
-
a.target = '_blank';
|
|
37
|
-
document.body.append(a);
|
|
38
|
-
a.click();
|
|
39
|
-
a.remove();
|
|
40
|
-
};
|
|
41
|
-
exports.downloadUsingAnchor = downloadUsingAnchor;
|
|
42
|
-
/**
|
|
43
|
-
* Surrounds string in an anchor tag
|
|
44
|
-
*/
|
|
45
|
-
function wrapTextToTagLink(link) {
|
|
46
|
-
const descr = String(link).replace(/^(https?:\/{0,2})?(w{3}\.)?/, 'www.');
|
|
47
|
-
if (!/^https?:\/{2}/.test(link))
|
|
48
|
-
link = `http://${link}`;
|
|
49
|
-
return `<a href=${link} target="_blank">${descr}</a>`;
|
|
50
|
-
}
|
|
51
|
-
const collectOffsetTop = (element) => {
|
|
52
|
-
let offsetTop = 0;
|
|
53
|
-
let node = element;
|
|
54
|
-
while (node != null) {
|
|
55
|
-
offsetTop += node.offsetTop;
|
|
56
|
-
node = node.parentElement;
|
|
57
|
-
}
|
|
58
|
-
return offsetTop;
|
|
59
|
-
};
|
|
60
|
-
exports.collectOffsetTop = collectOffsetTop;
|
|
61
|
-
const skipEvent = (e) => {
|
|
62
|
-
e.preventDefault();
|
|
63
|
-
e.stopPropagation();
|
|
64
|
-
return false;
|
|
65
|
-
};
|
|
66
|
-
exports.skipEvent = skipEvent;
|
|
67
|
-
const globalScrollIntoViewForY = (node) => {
|
|
68
|
-
const scrollContainer = document.body;
|
|
69
|
-
const pageHeight = window.innerHeight;
|
|
70
|
-
const nodeBounding = node.getBoundingClientRect();
|
|
71
|
-
const scrollPagesCount = scrollContainer.scrollHeight / pageHeight;
|
|
72
|
-
const scrollPageNumber = Math.min(Math.max(nodeBounding.top / pageHeight, 1), scrollPagesCount);
|
|
73
|
-
window.scroll({
|
|
74
|
-
top: scrollPageNumber * pageHeight,
|
|
75
|
-
behavior: 'smooth',
|
|
76
|
-
});
|
|
77
|
-
};
|
|
78
|
-
exports.globalScrollIntoViewForY = globalScrollIntoViewForY;
|
|
79
|
-
const sanitizeDefaults = {
|
|
80
|
-
ALLOWED_TAGS: [
|
|
81
|
-
'a',
|
|
82
|
-
'article',
|
|
83
|
-
'b',
|
|
84
|
-
'blockquote',
|
|
85
|
-
'br',
|
|
86
|
-
'caption',
|
|
87
|
-
'code',
|
|
88
|
-
'del',
|
|
89
|
-
'details',
|
|
90
|
-
'div',
|
|
91
|
-
'em',
|
|
92
|
-
'h1',
|
|
93
|
-
'h2',
|
|
94
|
-
'h3',
|
|
95
|
-
'h4',
|
|
96
|
-
'h5',
|
|
97
|
-
'h6',
|
|
98
|
-
'hr',
|
|
99
|
-
'i',
|
|
100
|
-
'img',
|
|
101
|
-
'ins',
|
|
102
|
-
'kbd',
|
|
103
|
-
'li',
|
|
104
|
-
'main',
|
|
105
|
-
'ol',
|
|
106
|
-
'p',
|
|
107
|
-
'pre',
|
|
108
|
-
'section',
|
|
109
|
-
'span',
|
|
110
|
-
'strong',
|
|
111
|
-
'sub',
|
|
112
|
-
'summary',
|
|
113
|
-
'sup',
|
|
114
|
-
'table',
|
|
115
|
-
'tbody',
|
|
116
|
-
'td',
|
|
117
|
-
'th',
|
|
118
|
-
'thead',
|
|
119
|
-
'tr',
|
|
120
|
-
'u',
|
|
121
|
-
'ul',
|
|
122
|
-
],
|
|
123
|
-
ALLOWED_ATTR: ['href', 'target', 'name', 'src', 'class'],
|
|
124
|
-
};
|
|
125
|
-
const sanitizeHtml = (html, config) => {
|
|
126
|
-
return dompurify_1.default.sanitize(html || '', {
|
|
127
|
-
...sanitizeDefaults,
|
|
128
|
-
...config,
|
|
129
|
-
});
|
|
130
|
-
};
|
|
131
|
-
exports.sanitizeHtml = sanitizeHtml;
|
|
132
|
-
const checkElementHasParent = (element, parent) => {
|
|
133
|
-
let node = element;
|
|
134
|
-
if (!parent)
|
|
135
|
-
return false;
|
|
136
|
-
while (node != null) {
|
|
137
|
-
if (node === parent) {
|
|
138
|
-
return true;
|
|
139
|
-
}
|
|
140
|
-
else {
|
|
141
|
-
node = node.parentElement;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
return false;
|
|
145
|
-
};
|
|
146
|
-
exports.checkElementHasParent = checkElementHasParent;
|
|
147
|
-
/**
|
|
148
|
-
* Executes a function within a view transition if supported by the browser.
|
|
149
|
-
*
|
|
150
|
-
* @param {VoidFunction} fn - The function to be executed.
|
|
151
|
-
* @returns {ViewTransition} - The result of the executed function.
|
|
152
|
-
*
|
|
153
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Document/startViewTransition | MDN: Document.startViewTransition}
|
|
154
|
-
*/
|
|
155
|
-
const startViewTransitionSafety = (fn, params) => {
|
|
156
|
-
if (document.startViewTransition && !params?.disabled) {
|
|
157
|
-
return document.startViewTransition(fn);
|
|
158
|
-
}
|
|
159
|
-
fn();
|
|
160
|
-
};
|
|
161
|
-
exports.startViewTransitionSafety = startViewTransitionSafety;
|
|
162
|
-
/**
|
|
163
|
-
* Вычисляет размер скроллбара
|
|
164
|
-
*/
|
|
165
|
-
const calcScrollbarWidth = () => {
|
|
166
|
-
const outer = document.createElement('div');
|
|
167
|
-
outer.style.visibility = 'hidden';
|
|
168
|
-
outer.style.width = '100px';
|
|
169
|
-
outer.style.overflow = 'scroll';
|
|
170
|
-
document.body.append(outer);
|
|
171
|
-
const inner = document.createElement('div');
|
|
172
|
-
inner.style.width = '100%';
|
|
173
|
-
outer.append(inner);
|
|
174
|
-
const scrollbarWidth = outer.offsetWidth - inner.offsetWidth;
|
|
175
|
-
outer.parentNode?.removeChild(outer);
|
|
176
|
-
return scrollbarWidth;
|
|
177
|
-
};
|
|
178
|
-
exports.calcScrollbarWidth = calcScrollbarWidth;
|
|
179
|
-
/**
|
|
180
|
-
* Calculates the inner height of an HTML element, accounting for padding.
|
|
181
|
-
*/
|
|
182
|
-
function getElementInnerHeight(element) {
|
|
183
|
-
const { clientHeight } = element;
|
|
184
|
-
const { paddingTop, paddingBottom } = getComputedStyle(element);
|
|
185
|
-
return (clientHeight -
|
|
186
|
-
Number.parseFloat(paddingTop) -
|
|
187
|
-
Number.parseFloat(paddingBottom));
|
|
188
|
-
}
|
|
189
|
-
/**
|
|
190
|
-
* Calculates the inner width of an HTML element, accounting for padding.
|
|
191
|
-
*/
|
|
192
|
-
function getElementInnerWidth(el) {
|
|
193
|
-
const { clientWidth } = el;
|
|
194
|
-
const { paddingLeft, paddingRight } = getComputedStyle(el);
|
|
195
|
-
return (clientWidth -
|
|
196
|
-
Number.parseFloat(paddingLeft) -
|
|
197
|
-
Number.parseFloat(paddingRight));
|
|
198
|
-
}
|
|
199
|
-
const isPrefersDarkTheme = () => !!globalThis.matchMedia?.('(prefers-color-scheme: dark)')?.matches;
|
|
200
|
-
exports.isPrefersDarkTheme = isPrefersDarkTheme;
|
|
201
|
-
const isPrefersLightTheme = () => !!globalThis.matchMedia?.('(prefers-color-scheme: light)')?.matches;
|
|
202
|
-
exports.isPrefersLightTheme = isPrefersLightTheme;
|
package/html.d.cts
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { type Config as DOMPurifyConfig } from 'dompurify';
|
|
2
|
-
import type { Maybe } from "./utils/types.cjs";
|
|
3
|
-
/**
|
|
4
|
-
* Вытаскивает RGB из любого цвета
|
|
5
|
-
*
|
|
6
|
-
* Не рекомендуется к использованию так как вызывает reflow
|
|
7
|
-
*/
|
|
8
|
-
export declare const getComputedColor: (color?: string) => string | null;
|
|
9
|
-
export declare const downloadUsingAnchor: (urlOrBlob: string | Blob, fileName?: string) => void;
|
|
10
|
-
/**
|
|
11
|
-
* Surrounds string in an anchor tag
|
|
12
|
-
*/
|
|
13
|
-
export declare function wrapTextToTagLink(link: string): string;
|
|
14
|
-
export declare const collectOffsetTop: (element: HTMLElement | null) => number;
|
|
15
|
-
export declare const skipEvent: (e: Event) => boolean;
|
|
16
|
-
export declare const globalScrollIntoViewForY: (node: HTMLElement) => void;
|
|
17
|
-
export declare const sanitizeHtml: (html: Maybe<string>, config?: DOMPurifyConfig) => string;
|
|
18
|
-
export declare const checkElementHasParent: (element: HTMLElement | null, parent: Maybe<HTMLElement>) => boolean;
|
|
19
|
-
/**
|
|
20
|
-
* Executes a function within a view transition if supported by the browser.
|
|
21
|
-
*
|
|
22
|
-
* @param {VoidFunction} fn - The function to be executed.
|
|
23
|
-
* @returns {ViewTransition} - The result of the executed function.
|
|
24
|
-
*
|
|
25
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Document/startViewTransition | MDN: Document.startViewTransition}
|
|
26
|
-
*/
|
|
27
|
-
export declare const startViewTransitionSafety: (fn: VoidFunction, params?: {
|
|
28
|
-
disabled?: boolean;
|
|
29
|
-
}) => ViewTransition | undefined;
|
|
30
|
-
/**
|
|
31
|
-
* Вычисляет размер скроллбара
|
|
32
|
-
*/
|
|
33
|
-
export declare const calcScrollbarWidth: () => number;
|
|
34
|
-
/**
|
|
35
|
-
* Calculates the inner height of an HTML element, accounting for padding.
|
|
36
|
-
*/
|
|
37
|
-
export declare function getElementInnerHeight(element: HTMLElement): number;
|
|
38
|
-
/**
|
|
39
|
-
* Calculates the inner width of an HTML element, accounting for padding.
|
|
40
|
-
*/
|
|
41
|
-
export declare function getElementInnerWidth(el: HTMLElement): number;
|
|
42
|
-
export declare const isPrefersDarkTheme: () => boolean;
|
|
43
|
-
export declare const isPrefersLightTheme: () => boolean;
|
|
44
|
-
//# sourceMappingURL=html.d.ts.map
|
package/html.d.cts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../src/html.ts"],"names":[],"mappings":"AAAA,OAAkB,EAAE,KAAK,MAAM,IAAI,eAAe,EAAE,MAAM,WAAW,CAAC;AAGtE,OAAO,KAAK,EAAE,KAAK,EAAE,0BAAyB;AAE9C;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,GAAI,QAAQ,MAAM,KAAG,MAAM,GAAG,IAe1D,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAC9B,WAAW,MAAM,GAAG,IAAI,EACxB,WAAW,MAAM,SAgBlB,CAAC;AAEF;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,UAI7C;AAED,eAAO,MAAM,gBAAgB,GAAI,SAAS,WAAW,GAAG,IAAI,WAU3D,CAAC;AAEF,eAAO,MAAM,SAAS,GAAI,GAAG,KAAK,YAKjC,CAAC;AAEF,eAAO,MAAM,wBAAwB,GAAI,MAAM,WAAW,SAezD,CAAC;AAiDF,eAAO,MAAM,YAAY,GAAI,MAAM,KAAK,CAAC,MAAM,CAAC,EAAE,SAAS,eAAe,WAKzE,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAChC,SAAS,WAAW,GAAG,IAAI,EAC3B,QAAQ,KAAK,CAAC,WAAW,CAAC,YAe3B,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,yBAAyB,GACpC,IAAI,YAAY,EAChB,SAAS;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,+BAMhC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,cAmB9B,CAAC;AAEF;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,WAAW,UAQzD;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,WAAW,UAQnD;AAED,eAAO,MAAM,kBAAkB,eACqC,CAAC;AAErE,eAAO,MAAM,mBAAmB,eACqC,CAAC"}
|
package/id.cjs
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.generateStackBasedId = exports.generateLinearNumericId = exports.createLinearNumericIdGenerator = exports.generateNumericShortId = exports.generateNumericId = exports.generateShortId = exports.generateId = void 0;
|
|
4
|
-
const nanoid_1 = require("nanoid");
|
|
5
|
-
const DIGITS = '0123456789';
|
|
6
|
-
const LATIN_CHARS = 'abcdefghijklmnopqrstuvwxyz';
|
|
7
|
-
const ALPHABET = `${LATIN_CHARS}${DIGITS}`;
|
|
8
|
-
/**
|
|
9
|
-
* Использует алфавит abcdefghijklmnopqrstuvwxyz0123456789
|
|
10
|
-
* Размер 6
|
|
11
|
-
*/
|
|
12
|
-
exports.generateId = (0, nanoid_1.customAlphabet)(ALPHABET, 6);
|
|
13
|
-
/**
|
|
14
|
-
* Использует алфавит abcdefghijklmnopqrstuvwxyz0123456789
|
|
15
|
-
* Размер 4
|
|
16
|
-
*/
|
|
17
|
-
exports.generateShortId = (0, nanoid_1.customAlphabet)(ALPHABET, 4);
|
|
18
|
-
/**
|
|
19
|
-
* Использует алфавит 0123456789
|
|
20
|
-
* Размер 6
|
|
21
|
-
*/
|
|
22
|
-
exports.generateNumericId = (0, nanoid_1.customAlphabet)(DIGITS, 6);
|
|
23
|
-
/**
|
|
24
|
-
* Использует алфавит 0123456789
|
|
25
|
-
* Размер 4
|
|
26
|
-
*/
|
|
27
|
-
exports.generateNumericShortId = (0, nanoid_1.customAlphabet)(DIGITS, 4);
|
|
28
|
-
/**
|
|
29
|
-
* Создает функцию, которая будет создавать уникальную строку, уникальность которой основана на порядке вызова этой функции
|
|
30
|
-
*
|
|
31
|
-
* @example
|
|
32
|
-
* ```ts
|
|
33
|
-
* generateLinearNumericId = createLinearNumericIdGenerator(6);
|
|
34
|
-
* generateLinearNumericId() // '000000'
|
|
35
|
-
* generateLinearNumericId() // '000001'
|
|
36
|
-
* ...
|
|
37
|
-
* generateLinearNumericId() // '999999'
|
|
38
|
-
* generateLinearNumericId() // '1000000'
|
|
39
|
-
* ...
|
|
40
|
-
* generateLinearNumericId() // '9999999'
|
|
41
|
-
* generateLinearNumericId() // '10000000'
|
|
42
|
-
* ```
|
|
43
|
-
*
|
|
44
|
-
* @param size размер
|
|
45
|
-
* @returns {()=>string}
|
|
46
|
-
*/
|
|
47
|
-
const createLinearNumericIdGenerator = (size = 9) => {
|
|
48
|
-
let lastCount = 0;
|
|
49
|
-
return () => {
|
|
50
|
-
return (lastCount++).toString().padStart(size, '0');
|
|
51
|
-
};
|
|
52
|
-
};
|
|
53
|
-
exports.createLinearNumericIdGenerator = createLinearNumericIdGenerator;
|
|
54
|
-
/**
|
|
55
|
-
*
|
|
56
|
-
* @example
|
|
57
|
-
* ```ts
|
|
58
|
-
* generateLinearNumericId() // '000000000'
|
|
59
|
-
* generateLinearNumericId() // '000000001'
|
|
60
|
-
* ...
|
|
61
|
-
* generateLinearNumericId() // '999999999'
|
|
62
|
-
* generateLinearNumericId() // '1000000000'
|
|
63
|
-
* ...
|
|
64
|
-
* generateLinearNumericId() // '9999999999'
|
|
65
|
-
* generateLinearNumericId() // '10000000000'
|
|
66
|
-
* ```
|
|
67
|
-
*
|
|
68
|
-
*/
|
|
69
|
-
exports.generateLinearNumericId = (0, exports.createLinearNumericIdGenerator)();
|
|
70
|
-
/**
|
|
71
|
-
* Is not recommended to use.
|
|
72
|
-
*
|
|
73
|
-
* Generates execution stack based pseudo-id (just sliced string from error stack)
|
|
74
|
-
*/
|
|
75
|
-
const generateStackBasedId = () => new Error().stack.split('\n').slice(1, 4).join('');
|
|
76
|
-
exports.generateStackBasedId = generateStackBasedId;
|