@react-fabric/utilities 1.0.0-beta.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.
Files changed (79) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +10 -0
  3. package/dist/cjs/_ascii.js +76 -0
  4. package/dist/cjs/_boundingBox.js +59 -0
  5. package/dist/cjs/_countries.js +2805 -0
  6. package/dist/cjs/_debounce.js +53 -0
  7. package/dist/cjs/_dedupe.js +63 -0
  8. package/dist/cjs/_fetch.js +128 -0
  9. package/dist/cjs/_fileType.js +967 -0
  10. package/dist/cjs/_format.js +118 -0
  11. package/dist/cjs/_getByPath.js +125 -0
  12. package/dist/cjs/_hash.js +67 -0
  13. package/dist/cjs/_interpolate.js +47 -0
  14. package/dist/cjs/_isEqual.js +108 -0
  15. package/dist/cjs/_isType.js +98 -0
  16. package/dist/cjs/_mergeRefs.js +40 -0
  17. package/dist/cjs/_tokenize.js +67 -0
  18. package/dist/cjs/getImageColorset.js +70 -0
  19. package/dist/cjs/index.js +116 -0
  20. package/dist/cjs/useLogger.js +339 -0
  21. package/dist/cjs/yup.js +172 -0
  22. package/dist/esm/_ascii.js +76 -0
  23. package/dist/esm/_boundingBox.js +58 -0
  24. package/dist/esm/_countries.js +2805 -0
  25. package/dist/esm/_debounce.js +53 -0
  26. package/dist/esm/_dedupe.js +60 -0
  27. package/dist/esm/_fetch.js +128 -0
  28. package/dist/esm/_fileType.js +967 -0
  29. package/dist/esm/_format.js +120 -0
  30. package/dist/esm/_getByPath.js +124 -0
  31. package/dist/esm/_hash.js +65 -0
  32. package/dist/esm/_interpolate.js +46 -0
  33. package/dist/esm/_isEqual.js +106 -0
  34. package/dist/esm/_isType.js +85 -0
  35. package/dist/esm/_mergeRefs.js +40 -0
  36. package/dist/esm/_tokenize.js +66 -0
  37. package/dist/esm/getImageColorset.js +70 -0
  38. package/dist/esm/index.js +52 -0
  39. package/dist/esm/useLogger.js +339 -0
  40. package/dist/esm/yup.js +152 -0
  41. package/dist/types/_ascii.d.ts +5 -0
  42. package/dist/types/_boundingBox.d.ts +10 -0
  43. package/dist/types/_countries.d.ts +85 -0
  44. package/dist/types/_debounce.d.ts +8 -0
  45. package/dist/types/_dedupe.d.ts +4 -0
  46. package/dist/types/_fetch.d.ts +23 -0
  47. package/dist/types/_fileType.d.ts +926 -0
  48. package/dist/types/_format.d.ts +27 -0
  49. package/dist/types/_getByPath.d.ts +10 -0
  50. package/dist/types/_hash.d.ts +16 -0
  51. package/dist/types/_interpolate.d.ts +6 -0
  52. package/dist/types/_isEqual.d.ts +15 -0
  53. package/dist/types/_isType.d.ts +14 -0
  54. package/dist/types/_mergeRefs.d.ts +1 -0
  55. package/dist/types/_tokenize.d.ts +8 -0
  56. package/dist/types/getImageColorset.d.ts +1 -0
  57. package/dist/types/index.d.ts +22 -0
  58. package/dist/types/useLogger.d.ts +25 -0
  59. package/dist/types/yup.d.ts +1 -0
  60. package/package.json +48 -0
  61. package/src/_ascii.ts +93 -0
  62. package/src/_boundingBox.ts +72 -0
  63. package/src/_countries.ts +3046 -0
  64. package/src/_debounce.ts +42 -0
  65. package/src/_dedupe.ts +56 -0
  66. package/src/_fetch.ts +109 -0
  67. package/src/_fileType.ts +993 -0
  68. package/src/_format.ts +141 -0
  69. package/src/_getByPath.ts +108 -0
  70. package/src/_hash.ts +62 -0
  71. package/src/_interpolate.ts +42 -0
  72. package/src/_isEqual.ts +102 -0
  73. package/src/_isType.ts +105 -0
  74. package/src/_mergeRefs.ts +33 -0
  75. package/src/_tokenize.ts +69 -0
  76. package/src/getImageColorset.ts +81 -0
  77. package/src/index.ts +51 -0
  78. package/src/useLogger.ts +304 -0
  79. package/src/yup.ts +75 -0
@@ -0,0 +1,70 @@
1
+ 'use strict';
2
+
3
+ /*
4
+ * React Fabric
5
+ * @version: 1.0.0
6
+ *
7
+ *
8
+ * The MIT License (MIT)
9
+ * Copyright (c) 2024 Adarsh Pastakia
10
+ *
11
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
12
+ * and associated documentation files (the "Software"), to deal in the Software without restriction,
13
+ * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
14
+ * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
15
+ * subject to the following conditions:
16
+ *
17
+ * The above copyright notice and this permission notice shall be included in all copies or substantial
18
+ * portions of the Software.
19
+ *
20
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
21
+ * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24
+ */
25
+
26
+ /* istanbul ignore file */
27
+
28
+ var getImageColorset = function getImageColorset(el) {
29
+ // create canvas
30
+ var canvas = document.createElement("canvas");
31
+ canvas.width = Math.min(500, el.naturalWidth);
32
+ canvas.height = Math.min(500, el.naturalHeight);
33
+ var ctx = canvas.getContext("2d");
34
+ if (ctx != null) {
35
+ ctx.drawImage(el, 0, 0, el.naturalWidth, el.naturalHeight, 0, 0, canvas.width, canvas.height);
36
+ var imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);
37
+ var data = imageData.data;
38
+ var r, g, b;
39
+ var dark = 0;
40
+ var light = 0;
41
+ var totalPixels = 0;
42
+ var transparent = (data === null || data === void 0 ? void 0 : data[3]) === 0;
43
+ for (var x = 0, len = data.length; x < len; x += 4) {
44
+ if (data[x + 3] === 0) {
45
+ transparent = true;
46
+ continue;
47
+ }
48
+ if (transparent && data[x - 1] === 1) {
49
+ continue;
50
+ }
51
+ r = data[x];
52
+ g = data[x + 1];
53
+ b = data[x + 2];
54
+ totalPixels++;
55
+ 0.2126 * r + 0.7152 * g + 0.0722 * b < 128 ? dark++ : light++;
56
+ }
57
+ var diff = light / totalPixels - dark / totalPixels;
58
+ var ret = diff > 0 ? "light" : "dark";
59
+ if (transparent) {
60
+ ret += "_transparent";
61
+ }
62
+ return ret;
63
+ }
64
+ return "light";
65
+ };
66
+ if (typeof window !== "undefined")
67
+ // @ts-expect-error ignore
68
+ window.getImageColorset = getImageColorset;
69
+
70
+ exports.getImageColorset = getImageColorset;
@@ -0,0 +1,116 @@
1
+ 'use strict';
2
+
3
+ var _ascii = require('./_ascii.js');
4
+ var _boundingBox = require('./_boundingBox.js');
5
+ var _countries = require('./_countries.js');
6
+ var _debounce = require('./_debounce.js');
7
+ var _dedupe = require('./_dedupe.js');
8
+ var _fetch = require('./_fetch.js');
9
+ var _fileType = require('./_fileType.js');
10
+ var _format = require('./_format.js');
11
+ var _getByPath = require('./_getByPath.js');
12
+ var _hash = require('./_hash.js');
13
+ var _interpolate = require('./_interpolate.js');
14
+ var _isEqual = require('./_isEqual.js');
15
+ var _isType = require('./_isType.js');
16
+ var _mergeRefs = require('./_mergeRefs.js');
17
+ var _tokenize = require('./_tokenize.js');
18
+ var getImageColorset = require('./getImageColorset.js');
19
+ var useLogger = require('./useLogger.js');
20
+ require('./yup.js');
21
+ var _yup = require('yup');
22
+
23
+ function _interopNamespaceDefault(e) {
24
+ var n = Object.create(null);
25
+ if (e) {
26
+ Object.keys(e).forEach(function (k) {
27
+ if (k !== 'default') {
28
+ var d = Object.getOwnPropertyDescriptor(e, k);
29
+ Object.defineProperty(n, k, d.get ? d : {
30
+ enumerable: true,
31
+ get: function () { return e[k]; }
32
+ });
33
+ }
34
+ });
35
+ }
36
+ n.default = e;
37
+ return Object.freeze(n);
38
+ }
39
+
40
+ var _yup__namespace = /*#__PURE__*/_interopNamespaceDefault(_yup);
41
+
42
+ /*
43
+ * React Fabric
44
+ * @version: 1.0.0
45
+ *
46
+ *
47
+ * The MIT License (MIT)
48
+ * Copyright (c) 2024 Adarsh Pastakia
49
+ *
50
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
51
+ * and associated documentation files (the "Software"), to deal in the Software without restriction,
52
+ * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
53
+ * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
54
+ * subject to the following conditions:
55
+ *
56
+ * The above copyright notice and this permission notice shall be included in all copies or substantial
57
+ * portions of the Software.
58
+ *
59
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
60
+ * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
61
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
62
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
63
+ */
64
+
65
+ var EMPTY_ARRAY = [];
66
+ Object.freeze(EMPTY_ARRAY);
67
+ var EMPTY_OBJECT = {};
68
+ Object.freeze(EMPTY_OBJECT);
69
+
70
+ exports.ascii = _ascii.ascii;
71
+ exports.getBoundingBox = _boundingBox.getBoundingBox;
72
+ exports.getBox = _boundingBox.getBox;
73
+ exports.Countries = _countries;
74
+ exports.debounce = _debounce.debounce;
75
+ exports.dedupe = _dedupe.dedupe;
76
+ exports.flatten = _dedupe.flatten;
77
+ exports.flattenAndDedupe = _dedupe.flattenAndDedupe;
78
+ exports.groupBy = _dedupe.groupBy;
79
+ exports.fetch = _fetch._fetch;
80
+ exports.FileUtil = _fileType;
81
+ Object.defineProperty(exports, "Format", {
82
+ enumerable: true,
83
+ get: function () { return _format.Format; }
84
+ });
85
+ exports.getByPath = _getByPath.getByPath;
86
+ exports.getValue = _getByPath.getValue;
87
+ exports.hash = _hash.hash;
88
+ exports.shortHash = _hash.shortHash;
89
+ exports.uuid = _hash.uuid;
90
+ exports.interpolate = _interpolate.interpolate;
91
+ exports.renderTemplate = _interpolate.renderTemplate;
92
+ exports.compareValues = _isEqual.compareValues;
93
+ exports.isEqual = _isEqual.isEqual;
94
+ exports.matchString = _isEqual.matchString;
95
+ exports.isArray = _isType.isArray;
96
+ exports.isBoolean = _isType.isBoolean;
97
+ exports.isColor = _isType.isColor;
98
+ exports.isEmpty = _isType.isEmpty;
99
+ exports.isFalse = _isType.isFalse;
100
+ exports.isNil = _isType.isNil;
101
+ exports.isNull = _isType.isNull;
102
+ exports.isNumber = _isType.isNumber;
103
+ exports.isObject = _isType.isObject;
104
+ exports.isRtl = _isType.isRtl;
105
+ exports.isString = _isType.isString;
106
+ exports.isSvgPath = _isType.isSvgPath;
107
+ exports.isTrue = _isType.isTrue;
108
+ exports.isUndefined = _isType.isUndefined;
109
+ exports.mergeRefs = _mergeRefs.mergeRefs;
110
+ exports.iconToken = _tokenize.iconToken;
111
+ exports.tokenize = _tokenize.tokenize;
112
+ exports.getImageColorset = getImageColorset.getImageColorset;
113
+ exports.useLogger = useLogger.useLogger;
114
+ exports.yup = _yup__namespace;
115
+ exports.EMPTY_ARRAY = EMPTY_ARRAY;
116
+ exports.EMPTY_OBJECT = EMPTY_OBJECT;
@@ -0,0 +1,339 @@
1
+ 'use strict';
2
+
3
+ var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
4
+ var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
5
+ var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
6
+
7
+ var _excluded = ["module"],
8
+ _excluded2 = ["module"],
9
+ _excluded3 = ["module"],
10
+ _excluded4 = ["module"],
11
+ _excluded5 = ["module"];
12
+ /*
13
+ * React Fabric
14
+ * @version: 1.0.0
15
+ *
16
+ *
17
+ * The MIT License (MIT)
18
+ * Copyright (c) 2024 Adarsh Pastakia
19
+ *
20
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
21
+ * and associated documentation files (the "Software"), to deal in the Software without restriction,
22
+ * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
23
+ * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
24
+ * subject to the following conditions:
25
+ *
26
+ * The above copyright notice and this permission notice shall be included in all copies or substantial
27
+ * portions of the Software.
28
+ *
29
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
30
+ * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
31
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
32
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
33
+ */
34
+ var LOG_LEVEL = /*#__PURE__*/function (LOG_LEVEL) {
35
+ LOG_LEVEL[LOG_LEVEL["OFF"] = 0] = "OFF";
36
+ LOG_LEVEL[LOG_LEVEL["WARNING"] = 1] = "WARNING";
37
+ LOG_LEVEL[LOG_LEVEL["INFO"] = 2] = "INFO";
38
+ LOG_LEVEL[LOG_LEVEL["DEBUG"] = 3] = "DEBUG";
39
+ return LOG_LEVEL;
40
+ }(LOG_LEVEL || {});
41
+ /* istanbul ignore file */
42
+ var NODE = {
43
+ LOG: "\x1B[38;5;144m",
44
+ INFO: "\x1B[38;5;81m",
45
+ DEBUG: "\x1B[38;5;110m",
46
+ ERROR: "\x1B[38;5;161m",
47
+ WARNING: "\x1B[38;5;209m",
48
+ TIME: "\x1B[38;5;72m",
49
+ PROCESS: "\x1B[38;5;108m",
50
+ DURATION: "\x1B[38;5;140m",
51
+ RESET: "\x1B[0m",
52
+ logLevel: function logLevel() {
53
+ var _global$LOG_LEVEL;
54
+ return (// @ts-expect-error ignore
55
+ (_global$LOG_LEVEL = global.LOG_LEVEL) !== null && _global$LOG_LEVEL !== void 0 ? _global$LOG_LEVEL : process.env.NODE_ENV !== "production" ? LOG_LEVEL.DEBUG : LOG_LEVEL.WARNING
56
+ );
57
+ },
58
+ makeLog: function makeLog(level) {
59
+ var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
60
+ process = _ref.process,
61
+ module = _ref.module,
62
+ duration = _ref.duration,
63
+ totalTime = _ref.totalTime;
64
+ var ret = [];
65
+ if (process) ret.push("".concat(this.PROCESS, "Process: ").concat(process).concat(this.RESET));
66
+ if (module) ret.push("".concat(this.PROCESS, "Module: ").concat(module).concat(this.RESET));
67
+ if (duration) ret.push("".concat(this.DURATION, "Duration: ").concat(duration).concat(this.RESET));
68
+ if (module) ret.push("".concat(this.DURATION, "TotalTime: ").concat(totalTime).concat(this.RESET));
69
+ return ["[".concat(this.TIME).concat(new Date().toISOString()).concat(this.RESET, "] ").concat(level), ret.join(" ")].filter(Boolean).join("\n");
70
+ },
71
+ log: function log(msg, opts) {
72
+ var _console;
73
+ if (+this.logLevel() < LOG_LEVEL.DEBUG) return;
74
+ for (var _len = arguments.length, rest = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
75
+ rest[_key - 2] = arguments[_key];
76
+ }
77
+ (_console = console).log.apply(_console, [this.makeLog("".concat(this.LOG, "LOG").concat(this.RESET), opts), "\n".concat(msg, "\n")].concat(rest));
78
+ },
79
+ debug: function debug(msg, opts) {
80
+ var _console2;
81
+ if (+this.logLevel() < LOG_LEVEL.DEBUG) return;
82
+ for (var _len2 = arguments.length, rest = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
83
+ rest[_key2 - 2] = arguments[_key2];
84
+ }
85
+ (_console2 = console).debug.apply(_console2, [this.makeLog("".concat(this.DEBUG, "DEBUG").concat(this.RESET), opts), "\n".concat(msg, "\n")].concat(rest));
86
+ },
87
+ info: function info(msg, opts) {
88
+ var _console3;
89
+ if (+this.logLevel() < LOG_LEVEL.INFO) return;
90
+ for (var _len3 = arguments.length, rest = new Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) {
91
+ rest[_key3 - 2] = arguments[_key3];
92
+ }
93
+ (_console3 = console).info.apply(_console3, [this.makeLog("".concat(this.INFO, "INFO").concat(this.RESET), opts), "\n".concat(msg, "\n")].concat(rest));
94
+ },
95
+ error: function error(msg, opts) {
96
+ var _console4;
97
+ for (var _len4 = arguments.length, rest = new Array(_len4 > 2 ? _len4 - 2 : 0), _key4 = 2; _key4 < _len4; _key4++) {
98
+ rest[_key4 - 2] = arguments[_key4];
99
+ }
100
+ (_console4 = console).error.apply(_console4, [this.makeLog("".concat(this.ERROR, "ERROR").concat(this.RESET), opts), "\n".concat(msg, "\n")].concat(rest));
101
+ },
102
+ warning: function warning(msg, opts) {
103
+ var _console5;
104
+ if (+this.logLevel() < LOG_LEVEL.WARNING) return;
105
+ for (var _len5 = arguments.length, rest = new Array(_len5 > 2 ? _len5 - 2 : 0), _key5 = 2; _key5 < _len5; _key5++) {
106
+ rest[_key5 - 2] = arguments[_key5];
107
+ }
108
+ (_console5 = console).warn.apply(_console5, [this.makeLog("".concat(this.WARNING, "WARNING").concat(this.RESET), opts), "\n".concat(msg, "\n")].concat(rest));
109
+ }
110
+ };
111
+ var BROWSER = {
112
+ LOG: "#afaf87",
113
+ INFO: "#5fd7ff",
114
+ DEBUG: "#87afd7",
115
+ ERROR: "#d7005f",
116
+ WARNING: "#ff875f",
117
+ TIME: "#5faf87",
118
+ PROCESS: "#87af87",
119
+ DURATION: "#af87d7",
120
+ logLevel: function logLevel() {
121
+ var _ref2;
122
+ return (// @ts-expect-error ignore
123
+ (_ref2 = typeof window !== "undefined" ? window.LOG_LEVEL : undefined) !== null && _ref2 !== void 0 ? _ref2 : process.env.NODE_ENV !== "production" ? LOG_LEVEL.DEBUG : LOG_LEVEL.WARNING
124
+ );
125
+ },
126
+ makeLog: function makeLog(level, color) {
127
+ var _ref3 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
128
+ process = _ref3.process,
129
+ module = _ref3.module,
130
+ duration = _ref3.duration,
131
+ totalTime = _ref3.totalTime;
132
+ var ret = [];
133
+ var colors = ["color:".concat(this.TIME, ";font-weight:bold;"), "color:".concat(color, ";font-weight:bold;")];
134
+ if (module) ret.push("%cModule: ".concat(module));
135
+ if (process) ret.push("%cProcess: ".concat(process));
136
+ if (duration) ret.push("%cDuration: ".concat(duration));
137
+ if (module) ret.push("%cTotalTime: ".concat(totalTime));
138
+ if (module) colors.push("color:".concat(this.PROCESS));
139
+ if (process) colors.push("color:".concat(this.PROCESS));
140
+ if (duration) colors.push("color:".concat(this.DURATION));
141
+ if (module) colors.push("color:".concat(this.DURATION));
142
+ return [["%c[".concat(new Date().toISOString(), "] ").concat(level), ret.join(" ")].filter(Boolean).join("\n"), colors];
143
+ },
144
+ log: function log(msg, opts) {
145
+ var _console6;
146
+ if (+this.logLevel() < LOG_LEVEL.DEBUG) return;
147
+ var _this$makeLog = this.makeLog("%cLOG", this.LOG, opts),
148
+ _this$makeLog2 = _slicedToArray(_this$makeLog, 2),
149
+ logs = _this$makeLog2[0],
150
+ colors = _this$makeLog2[1];
151
+ for (var _len6 = arguments.length, rest = new Array(_len6 > 2 ? _len6 - 2 : 0), _key6 = 2; _key6 < _len6; _key6++) {
152
+ rest[_key6 - 2] = arguments[_key6];
153
+ }
154
+ (_console6 = console).log.apply(_console6, [logs].concat(_toConsumableArray(colors), ["\n".concat(msg, "\n")], rest));
155
+ },
156
+ debug: function debug(msg, opts) {
157
+ var _console7;
158
+ if (+this.logLevel() < LOG_LEVEL.DEBUG) return;
159
+ var _this$makeLog3 = this.makeLog("%cDEBUG", this.DEBUG, opts),
160
+ _this$makeLog4 = _slicedToArray(_this$makeLog3, 2),
161
+ logs = _this$makeLog4[0],
162
+ colors = _this$makeLog4[1];
163
+ for (var _len7 = arguments.length, rest = new Array(_len7 > 2 ? _len7 - 2 : 0), _key7 = 2; _key7 < _len7; _key7++) {
164
+ rest[_key7 - 2] = arguments[_key7];
165
+ }
166
+ (_console7 = console).debug.apply(_console7, [logs].concat(_toConsumableArray(colors), ["\n".concat(msg, "\n")], rest));
167
+ },
168
+ info: function info(msg, opts) {
169
+ var _console8;
170
+ if (+this.logLevel() < LOG_LEVEL.INFO) return;
171
+ var _this$makeLog5 = this.makeLog("%cINFO", this.INFO, opts),
172
+ _this$makeLog6 = _slicedToArray(_this$makeLog5, 2),
173
+ logs = _this$makeLog6[0],
174
+ colors = _this$makeLog6[1];
175
+ for (var _len8 = arguments.length, rest = new Array(_len8 > 2 ? _len8 - 2 : 0), _key8 = 2; _key8 < _len8; _key8++) {
176
+ rest[_key8 - 2] = arguments[_key8];
177
+ }
178
+ (_console8 = console).info.apply(_console8, [logs].concat(_toConsumableArray(colors), ["\n".concat(msg, "\n")], rest));
179
+ },
180
+ error: function error(msg, opts) {
181
+ var _console9;
182
+ var _this$makeLog7 = this.makeLog("%cERROR", this.ERROR, opts),
183
+ _this$makeLog8 = _slicedToArray(_this$makeLog7, 2),
184
+ logs = _this$makeLog8[0],
185
+ colors = _this$makeLog8[1];
186
+ for (var _len9 = arguments.length, rest = new Array(_len9 > 2 ? _len9 - 2 : 0), _key9 = 2; _key9 < _len9; _key9++) {
187
+ rest[_key9 - 2] = arguments[_key9];
188
+ }
189
+ (_console9 = console).error.apply(_console9, [logs].concat(_toConsumableArray(colors), ["\n".concat(msg, "\n")], rest));
190
+ },
191
+ warning: function warning(msg, opts) {
192
+ var _console10;
193
+ if (+this.logLevel() < LOG_LEVEL.WARNING) return;
194
+ var _this$makeLog9 = this.makeLog("%cWARNING", this.WARNING, opts),
195
+ _this$makeLog10 = _slicedToArray(_this$makeLog9, 2),
196
+ logs = _this$makeLog10[0],
197
+ colors = _this$makeLog10[1];
198
+ for (var _len10 = arguments.length, rest = new Array(_len10 > 2 ? _len10 - 2 : 0), _key10 = 2; _key10 < _len10; _key10++) {
199
+ rest[_key10 - 2] = arguments[_key10];
200
+ }
201
+ (_console10 = console).warn.apply(_console10, [logs].concat(_toConsumableArray(colors), ["\n".concat(msg, "\ntest")], rest));
202
+ }
203
+ };
204
+ var logger = function logger() {
205
+ if (typeof window === "undefined") return NODE;
206
+ if (typeof window !== "undefined") return BROWSER;
207
+ };
208
+
209
+ /**
210
+ * @internal
211
+ */
212
+ var useLogger = function useLogger(mod) {
213
+ return {
214
+ timer: function timer(process) {
215
+ var startTime = new Date().getTime();
216
+ var nextTime = new Date().getTime();
217
+ // eslint-disable-next-line @typescript-eslint/no-this-alias
218
+ var self = this;
219
+ var getTime = function getTime() {
220
+ var ret = (new Date().getTime() - nextTime) / 1000;
221
+ nextTime = new Date().getTime();
222
+ return ret;
223
+ };
224
+ var getFullTime = function getFullTime() {
225
+ return (new Date().getTime() - startTime) / 1000;
226
+ };
227
+ return {
228
+ log: function log(msg) {
229
+ for (var _len11 = arguments.length, rest = new Array(_len11 > 1 ? _len11 - 1 : 0), _key11 = 1; _key11 < _len11; _key11++) {
230
+ rest[_key11 - 1] = arguments[_key11];
231
+ }
232
+ return self.log.apply(self, [msg, {
233
+ process: process,
234
+ duration: getTime(),
235
+ totalTime: getFullTime()
236
+ }].concat(rest));
237
+ },
238
+ debug: function debug(msg) {
239
+ for (var _len12 = arguments.length, rest = new Array(_len12 > 1 ? _len12 - 1 : 0), _key12 = 1; _key12 < _len12; _key12++) {
240
+ rest[_key12 - 1] = arguments[_key12];
241
+ }
242
+ return self.debug.apply(self, [msg, {
243
+ process: process,
244
+ duration: getTime(),
245
+ totalTime: getFullTime()
246
+ }].concat(rest));
247
+ },
248
+ info: function info(msg) {
249
+ for (var _len13 = arguments.length, rest = new Array(_len13 > 1 ? _len13 - 1 : 0), _key13 = 1; _key13 < _len13; _key13++) {
250
+ rest[_key13 - 1] = arguments[_key13];
251
+ }
252
+ return self.info.apply(self, [msg, {
253
+ process: process,
254
+ duration: getTime(),
255
+ totalTime: getFullTime()
256
+ }].concat(rest));
257
+ },
258
+ error: function error(msg) {
259
+ for (var _len14 = arguments.length, rest = new Array(_len14 > 1 ? _len14 - 1 : 0), _key14 = 1; _key14 < _len14; _key14++) {
260
+ rest[_key14 - 1] = arguments[_key14];
261
+ }
262
+ return self.error.apply(self, [msg, {
263
+ process: process,
264
+ duration: getTime(),
265
+ totalTime: getFullTime()
266
+ }].concat(rest));
267
+ },
268
+ warning: function warning(msg) {
269
+ for (var _len15 = arguments.length, rest = new Array(_len15 > 1 ? _len15 - 1 : 0), _key15 = 1; _key15 < _len15; _key15++) {
270
+ rest[_key15 - 1] = arguments[_key15];
271
+ }
272
+ return self.warning.apply(self, [msg, {
273
+ process: process,
274
+ duration: getTime(),
275
+ totalTime: getFullTime()
276
+ }].concat(rest));
277
+ },
278
+ end: function end() {
279
+ var msg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "completed";
280
+ for (var _len16 = arguments.length, rest = new Array(_len16 > 1 ? _len16 - 1 : 0), _key16 = 1; _key16 < _len16; _key16++) {
281
+ rest[_key16 - 1] = arguments[_key16];
282
+ }
283
+ return self.info.apply(self, [msg, {
284
+ process: process,
285
+ duration: getTime(),
286
+ totalTime: getFullTime()
287
+ }].concat(rest));
288
+ }
289
+ };
290
+ },
291
+ log: function log(msg, _ref4) {
292
+ var _logger;
293
+ _ref4.module;
294
+ var opts = _objectWithoutProperties(_ref4, _excluded);
295
+ for (var _len17 = arguments.length, rest = new Array(_len17 > 2 ? _len17 - 2 : 0), _key17 = 2; _key17 < _len17; _key17++) {
296
+ rest[_key17 - 2] = arguments[_key17];
297
+ }
298
+ (_logger = logger()) === null || _logger === void 0 || _logger.log.apply(_logger, [msg, opts].concat(rest));
299
+ },
300
+ debug: function debug(msg, _ref5) {
301
+ var _logger2;
302
+ _ref5.module;
303
+ var opts = _objectWithoutProperties(_ref5, _excluded2);
304
+ for (var _len18 = arguments.length, rest = new Array(_len18 > 2 ? _len18 - 2 : 0), _key18 = 2; _key18 < _len18; _key18++) {
305
+ rest[_key18 - 2] = arguments[_key18];
306
+ }
307
+ (_logger2 = logger()) === null || _logger2 === void 0 || _logger2.debug.apply(_logger2, [msg, opts].concat(rest));
308
+ },
309
+ info: function info(msg, _ref6) {
310
+ var _logger3;
311
+ _ref6.module;
312
+ var opts = _objectWithoutProperties(_ref6, _excluded3);
313
+ for (var _len19 = arguments.length, rest = new Array(_len19 > 2 ? _len19 - 2 : 0), _key19 = 2; _key19 < _len19; _key19++) {
314
+ rest[_key19 - 2] = arguments[_key19];
315
+ }
316
+ (_logger3 = logger()) === null || _logger3 === void 0 || _logger3.info.apply(_logger3, [msg, opts].concat(rest));
317
+ },
318
+ error: function error(msg, _ref7) {
319
+ var _logger4;
320
+ _ref7.module;
321
+ var opts = _objectWithoutProperties(_ref7, _excluded4);
322
+ for (var _len20 = arguments.length, rest = new Array(_len20 > 2 ? _len20 - 2 : 0), _key20 = 2; _key20 < _len20; _key20++) {
323
+ rest[_key20 - 2] = arguments[_key20];
324
+ }
325
+ (_logger4 = logger()) === null || _logger4 === void 0 || _logger4.error.apply(_logger4, [msg, opts].concat(rest));
326
+ },
327
+ warning: function warning(msg, _ref8) {
328
+ var _logger5;
329
+ _ref8.module;
330
+ var opts = _objectWithoutProperties(_ref8, _excluded5);
331
+ for (var _len21 = arguments.length, rest = new Array(_len21 > 2 ? _len21 - 2 : 0), _key21 = 2; _key21 < _len21; _key21++) {
332
+ rest[_key21 - 2] = arguments[_key21];
333
+ }
334
+ (_logger5 = logger()) === null || _logger5 === void 0 || _logger5.warning.apply(_logger5, [msg, opts].concat(rest));
335
+ }
336
+ };
337
+ };
338
+
339
+ exports.useLogger = useLogger;
@@ -0,0 +1,172 @@
1
+ 'use strict';
2
+
3
+ var _yup = require('yup');
4
+
5
+ function _interopNamespaceDefault(e) {
6
+ var n = Object.create(null);
7
+ if (e) {
8
+ Object.keys(e).forEach(function (k) {
9
+ if (k !== 'default') {
10
+ var d = Object.getOwnPropertyDescriptor(e, k);
11
+ Object.defineProperty(n, k, d.get ? d : {
12
+ enumerable: true,
13
+ get: function () { return e[k]; }
14
+ });
15
+ }
16
+ });
17
+ }
18
+ n.default = e;
19
+ return Object.freeze(n);
20
+ }
21
+
22
+ var _yup__namespace = /*#__PURE__*/_interopNamespaceDefault(_yup);
23
+
24
+ /*
25
+ * React Fabric
26
+ * @version: 1.0.0
27
+ *
28
+ *
29
+ * The MIT License (MIT)
30
+ * Copyright (c) 2024 Adarsh Pastakia
31
+ *
32
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
33
+ * and associated documentation files (the "Software"), to deal in the Software without restriction,
34
+ * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
35
+ * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
36
+ * subject to the following conditions:
37
+ *
38
+ * The above copyright notice and this permission notice shall be included in all copies or substantial
39
+ * portions of the Software.
40
+ *
41
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
42
+ * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
43
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
44
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
45
+ */
46
+
47
+ _yup__namespace.setLocale({
48
+ mixed: {
49
+ "default": function _default(_ref) {
50
+ var path = _ref.path,
51
+ label = _ref.label;
52
+ return {
53
+ key: "form:yup.invalid",
54
+ values: {
55
+ path: path,
56
+ label: label
57
+ }
58
+ };
59
+ },
60
+ required: function required(_ref2) {
61
+ var path = _ref2.path,
62
+ label = _ref2.label;
63
+ return {
64
+ key: "form:yup.required",
65
+ values: {
66
+ path: path,
67
+ label: label
68
+ }
69
+ };
70
+ },
71
+ notType: function notType(_ref3) {
72
+ var type = _ref3.type,
73
+ path = _ref3.path,
74
+ label = _ref3.label;
75
+ return {
76
+ key: "form:yup.invalidType",
77
+ values: {
78
+ type: type,
79
+ path: path,
80
+ label: label
81
+ }
82
+ };
83
+ }
84
+ },
85
+ array: {
86
+ min: function min(_ref4) {
87
+ var _min = _ref4.min,
88
+ path = _ref4.path,
89
+ label = _ref4.label;
90
+ return {
91
+ key: "form:yup.arrayMin",
92
+ values: {
93
+ min: _min,
94
+ path: path,
95
+ label: label
96
+ }
97
+ };
98
+ },
99
+ max: function max(_ref5) {
100
+ var _max = _ref5.max,
101
+ path = _ref5.path,
102
+ label = _ref5.label;
103
+ return {
104
+ key: "form:yup.arrayMax",
105
+ values: {
106
+ max: _max,
107
+ path: path,
108
+ label: label
109
+ }
110
+ };
111
+ }
112
+ },
113
+ string: {
114
+ min: function min(_ref6) {
115
+ var _min2 = _ref6.min,
116
+ path = _ref6.path,
117
+ label = _ref6.label;
118
+ return {
119
+ key: "form:yup.stringMin",
120
+ values: {
121
+ min: _min2,
122
+ path: path,
123
+ label: label
124
+ }
125
+ };
126
+ },
127
+ max: function max(_ref7) {
128
+ var _max2 = _ref7.max,
129
+ path = _ref7.path,
130
+ label = _ref7.label;
131
+ return {
132
+ key: "form:yup.stringMax",
133
+ values: {
134
+ max: _max2,
135
+ path: path,
136
+ label: label
137
+ }
138
+ };
139
+ }
140
+ },
141
+ number: {
142
+ min: function min(_ref8) {
143
+ var _min3 = _ref8.min,
144
+ path = _ref8.path,
145
+ label = _ref8.label;
146
+ return {
147
+ key: "form:yup.numberMin",
148
+ values: {
149
+ min: _min3,
150
+ path: path,
151
+ label: label
152
+ }
153
+ };
154
+ },
155
+ max: function max(_ref9) {
156
+ var _max3 = _ref9.max,
157
+ path = _ref9.path,
158
+ label = _ref9.label;
159
+ return {
160
+ key: "form:yup.numberMax",
161
+ values: {
162
+ max: _max3,
163
+ path: path,
164
+ label: label
165
+ }
166
+ };
167
+ }
168
+ },
169
+ "boolean": {}
170
+ });
171
+
172
+ exports.yup = _yup__namespace;