@usertour/helpers 0.0.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.
Files changed (81) hide show
  1. package/README.md +68 -0
  2. package/dist/auth.cjs +161 -0
  3. package/dist/auth.d.cts +8 -0
  4. package/dist/auth.d.ts +8 -0
  5. package/dist/auth.js +15 -0
  6. package/dist/chunk-2AEGAICC.js +13 -0
  7. package/dist/chunk-3KG2HTZ3.js +79 -0
  8. package/dist/chunk-3ZGH3NRU.js +103 -0
  9. package/dist/chunk-64BFWPHJ.js +50 -0
  10. package/dist/chunk-BBPZYUJR.js +28 -0
  11. package/dist/chunk-FGFMTWFT.js +23 -0
  12. package/dist/chunk-FNQIIEWK.js +121 -0
  13. package/dist/chunk-FW54TSA3.js +41 -0
  14. package/dist/chunk-G5P7KULU.js +223 -0
  15. package/dist/chunk-GFH3VWOC.js +70 -0
  16. package/dist/chunk-H7VA3ML2.js +29 -0
  17. package/dist/chunk-USHOKNHQ.js +243 -0
  18. package/dist/chunk-VT24VOAZ.js +48 -0
  19. package/dist/chunk-XEO3YXBM.js +10 -0
  20. package/dist/chunk-ZNFXGN3M.js +25 -0
  21. package/dist/color.cjs +84 -0
  22. package/dist/color.d.cts +29 -0
  23. package/dist/color.d.ts +29 -0
  24. package/dist/color.js +11 -0
  25. package/dist/condition.cjs +157 -0
  26. package/dist/condition.d.cts +7 -0
  27. package/dist/condition.d.ts +7 -0
  28. package/dist/condition.js +11 -0
  29. package/dist/content-settings.cjs +76 -0
  30. package/dist/content-settings.d.cts +7 -0
  31. package/dist/content-settings.d.ts +7 -0
  32. package/dist/content-settings.js +11 -0
  33. package/dist/content.cjs +53 -0
  34. package/dist/content.d.cts +6 -0
  35. package/dist/content.d.ts +6 -0
  36. package/dist/content.js +9 -0
  37. package/dist/convert-settings.cjs +308 -0
  38. package/dist/convert-settings.d.cts +7 -0
  39. package/dist/convert-settings.d.ts +7 -0
  40. package/dist/convert-settings.js +13 -0
  41. package/dist/error.cjs +259 -0
  42. package/dist/error.d.cts +56 -0
  43. package/dist/error.d.ts +56 -0
  44. package/dist/error.js +37 -0
  45. package/dist/globals.cjs +64 -0
  46. package/dist/globals.d.cts +27 -0
  47. package/dist/globals.d.ts +27 -0
  48. package/dist/globals.js +29 -0
  49. package/dist/helper.cjs +111 -0
  50. package/dist/helper.d.cts +17 -0
  51. package/dist/helper.d.ts +17 -0
  52. package/dist/helper.js +23 -0
  53. package/dist/index.cjs +1165 -0
  54. package/dist/index.d.cts +18 -0
  55. package/dist/index.d.ts +18 -0
  56. package/dist/index.js +178 -0
  57. package/dist/is-url.cjs +49 -0
  58. package/dist/is-url.d.cts +14 -0
  59. package/dist/is-url.d.ts +14 -0
  60. package/dist/is-url.js +7 -0
  61. package/dist/settings.cjs +65 -0
  62. package/dist/settings.d.cts +5 -0
  63. package/dist/settings.d.ts +5 -0
  64. package/dist/settings.js +7 -0
  65. package/dist/storage.cjs +142 -0
  66. package/dist/storage.d.cts +25 -0
  67. package/dist/storage.d.ts +25 -0
  68. package/dist/storage.js +8 -0
  69. package/dist/type-utils.cjs +109 -0
  70. package/dist/type-utils.d.cts +18 -0
  71. package/dist/type-utils.d.ts +18 -0
  72. package/dist/type-utils.js +37 -0
  73. package/dist/utils.cjs +37 -0
  74. package/dist/utils.d.cts +8 -0
  75. package/dist/utils.d.ts +8 -0
  76. package/dist/utils.js +7 -0
  77. package/dist/vite-env.d.cjs +1 -0
  78. package/dist/vite-env.d.d.cts +1 -0
  79. package/dist/vite-env.d.d.ts +1 -0
  80. package/dist/vite-env.d.js +0 -0
  81. package/package.json +56 -0
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/type-utils.ts
21
+ var type_utils_exports = {};
22
+ __export(type_utils_exports, {
23
+ isArray: () => isArray,
24
+ isBoolean: () => isBoolean,
25
+ isDate: () => isDate,
26
+ isDocument: () => isDocument,
27
+ isEmptyObject: () => isEmptyObject,
28
+ isEmptyString: () => isEmptyString,
29
+ isFile: () => isFile,
30
+ isFormData: () => isFormData,
31
+ isFunction: () => isFunction,
32
+ isNull: () => isNull,
33
+ isNullish: () => isNullish,
34
+ isNumber: () => isNumber,
35
+ isObject: () => isObject,
36
+ isString: () => isString,
37
+ isUint8Array: () => isUint8Array,
38
+ isUndefined: () => isUndefined
39
+ });
40
+ module.exports = __toCommonJS(type_utils_exports);
41
+ var nativeIsArray = Array.isArray;
42
+ var ObjProto = Object.prototype;
43
+ var objToString = ObjProto.toString;
44
+ var objHasOwn = ObjProto.hasOwnProperty;
45
+ var isArray = nativeIsArray || ((obj) => objToString.call(obj) === "[object Array]");
46
+ var isUint8Array = (x) => objToString.call(x) === "[object Uint8Array]";
47
+ var isFunction = (f) => {
48
+ return typeof f === "function";
49
+ };
50
+ var isObject = (x) => {
51
+ return x === Object(x) && !isArray(x);
52
+ };
53
+ var isEmptyObject = (x) => {
54
+ if (isObject(x)) {
55
+ for (const key in x) {
56
+ if (objHasOwn.call(x, key)) {
57
+ return false;
58
+ }
59
+ }
60
+ return true;
61
+ }
62
+ return false;
63
+ };
64
+ var isUndefined = (x) => x === void 0;
65
+ var isString = (x) => {
66
+ return objToString.call(x) === "[object String]";
67
+ };
68
+ var isEmptyString = (x) => isString(x) && x.trim().length === 0;
69
+ var isNull = (x) => {
70
+ return x === null;
71
+ };
72
+ var isNullish = (x) => isUndefined(x) || isNull(x);
73
+ var isDate = (x) => {
74
+ return objToString.call(x) === "[object Date]";
75
+ };
76
+ var isNumber = (x) => {
77
+ return objToString.call(x) === "[object Number]";
78
+ };
79
+ var isBoolean = (x) => {
80
+ return objToString.call(x) === "[object Boolean]";
81
+ };
82
+ var isDocument = (x) => {
83
+ return x instanceof Document;
84
+ };
85
+ var isFormData = (x) => {
86
+ return x instanceof FormData;
87
+ };
88
+ var isFile = (x) => {
89
+ return x instanceof File;
90
+ };
91
+ // Annotate the CommonJS export names for ESM import in node:
92
+ 0 && (module.exports = {
93
+ isArray,
94
+ isBoolean,
95
+ isDate,
96
+ isDocument,
97
+ isEmptyObject,
98
+ isEmptyString,
99
+ isFile,
100
+ isFormData,
101
+ isFunction,
102
+ isNull,
103
+ isNullish,
104
+ isNumber,
105
+ isObject,
106
+ isString,
107
+ isUint8Array,
108
+ isUndefined
109
+ });
@@ -0,0 +1,18 @@
1
+ declare const isArray: (arg: any) => arg is any[];
2
+ declare const isUint8Array: (x: unknown) => x is Uint8Array;
3
+ declare const isFunction: (f: any) => f is (...args: any[]) => any;
4
+ declare const isObject: (x: unknown) => x is Record<string, any>;
5
+ declare const isEmptyObject: (x: unknown) => x is Record<string, any>;
6
+ declare const isUndefined: (x: unknown) => x is undefined;
7
+ declare const isString: (x: unknown) => x is string;
8
+ declare const isEmptyString: (x: unknown) => boolean;
9
+ declare const isNull: (x: unknown) => x is null;
10
+ declare const isNullish: (x: unknown) => x is null | undefined;
11
+ declare const isDate: (x: unknown) => x is Date;
12
+ declare const isNumber: (x: unknown) => x is number;
13
+ declare const isBoolean: (x: unknown) => x is boolean;
14
+ declare const isDocument: (x: unknown) => x is Document;
15
+ declare const isFormData: (x: unknown) => x is FormData;
16
+ declare const isFile: (x: unknown) => x is File;
17
+
18
+ export { isArray, isBoolean, isDate, isDocument, isEmptyObject, isEmptyString, isFile, isFormData, isFunction, isNull, isNullish, isNumber, isObject, isString, isUint8Array, isUndefined };
@@ -0,0 +1,18 @@
1
+ declare const isArray: (arg: any) => arg is any[];
2
+ declare const isUint8Array: (x: unknown) => x is Uint8Array;
3
+ declare const isFunction: (f: any) => f is (...args: any[]) => any;
4
+ declare const isObject: (x: unknown) => x is Record<string, any>;
5
+ declare const isEmptyObject: (x: unknown) => x is Record<string, any>;
6
+ declare const isUndefined: (x: unknown) => x is undefined;
7
+ declare const isString: (x: unknown) => x is string;
8
+ declare const isEmptyString: (x: unknown) => boolean;
9
+ declare const isNull: (x: unknown) => x is null;
10
+ declare const isNullish: (x: unknown) => x is null | undefined;
11
+ declare const isDate: (x: unknown) => x is Date;
12
+ declare const isNumber: (x: unknown) => x is number;
13
+ declare const isBoolean: (x: unknown) => x is boolean;
14
+ declare const isDocument: (x: unknown) => x is Document;
15
+ declare const isFormData: (x: unknown) => x is FormData;
16
+ declare const isFile: (x: unknown) => x is File;
17
+
18
+ export { isArray, isBoolean, isDate, isDocument, isEmptyObject, isEmptyString, isFile, isFormData, isFunction, isNull, isNullish, isNumber, isObject, isString, isUint8Array, isUndefined };
@@ -0,0 +1,37 @@
1
+ import {
2
+ isArray,
3
+ isBoolean,
4
+ isDate,
5
+ isDocument,
6
+ isEmptyObject,
7
+ isEmptyString,
8
+ isFile,
9
+ isFormData,
10
+ isFunction,
11
+ isNull,
12
+ isNullish,
13
+ isNumber,
14
+ isObject,
15
+ isString,
16
+ isUint8Array,
17
+ isUndefined
18
+ } from "./chunk-GFH3VWOC.js";
19
+ import "./chunk-XEO3YXBM.js";
20
+ export {
21
+ isArray,
22
+ isBoolean,
23
+ isDate,
24
+ isDocument,
25
+ isEmptyObject,
26
+ isEmptyString,
27
+ isFile,
28
+ isFormData,
29
+ isFunction,
30
+ isNull,
31
+ isNullish,
32
+ isNumber,
33
+ isObject,
34
+ isString,
35
+ isUint8Array,
36
+ isUndefined
37
+ };
package/dist/utils.cjs ADDED
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/utils.ts
21
+ var utils_exports = {};
22
+ __export(utils_exports, {
23
+ deepClone: () => deepClone
24
+ });
25
+ module.exports = __toCommonJS(utils_exports);
26
+ var deepClone = (obj) => {
27
+ try {
28
+ return structuredClone(obj);
29
+ } catch (error) {
30
+ console.warn("structuredClone failed, falling back to JSON method:", error);
31
+ return JSON.parse(JSON.stringify(obj));
32
+ }
33
+ };
34
+ // Annotate the CommonJS export names for ESM import in node:
35
+ 0 && (module.exports = {
36
+ deepClone
37
+ });
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Deep clone utility function that uses structuredClone with fallback to JSON method
3
+ * @param obj - The object to clone
4
+ * @returns A deep copy of the object
5
+ */
6
+ declare const deepClone: <T>(obj: T) => T;
7
+
8
+ export { deepClone };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Deep clone utility function that uses structuredClone with fallback to JSON method
3
+ * @param obj - The object to clone
4
+ * @returns A deep copy of the object
5
+ */
6
+ declare const deepClone: <T>(obj: T) => T;
7
+
8
+ export { deepClone };
package/dist/utils.js ADDED
@@ -0,0 +1,7 @@
1
+ import {
2
+ deepClone
3
+ } from "./chunk-2AEGAICC.js";
4
+ import "./chunk-XEO3YXBM.js";
5
+ export {
6
+ deepClone
7
+ };
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1 @@
1
+ /// <reference types="vite/client" />
@@ -0,0 +1 @@
1
+ /// <reference types="vite/client" />
File without changes
package/package.json ADDED
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "@usertour/helpers",
3
+ "version": "0.0.1",
4
+ "type": "module",
5
+ "description": "Utility functions and helpers shared across the UserTour project",
6
+ "homepage": "https://www.usertour.io",
7
+ "author": "Usertour, Inc. <support@usertour.io>",
8
+ "license": "AGPL-3.0",
9
+ "main": "./dist/index.js",
10
+ "module": "./dist/index.js",
11
+ "types": "./dist/index.d.ts",
12
+ "exports": {
13
+ ".": {
14
+ "import": "./dist/index.js",
15
+ "require": "./dist/index.js",
16
+ "types": "./dist/index.d.ts"
17
+ }
18
+ },
19
+ "files": ["dist"],
20
+ "scripts": {
21
+ "build": "tsup src --dts",
22
+ "dev": "pnpm build:fast -- --watch",
23
+ "clean": "rimraf dist .turbo",
24
+ "typecheck": "tsc --noEmit",
25
+ "build:fast": "tsup src",
26
+ "prepublishOnly": "pnpm build"
27
+ },
28
+ "dependencies": {
29
+ "@usertour/types": "^0.0.1",
30
+ "fast-deep-equal": "^3.1.3",
31
+ "chroma-js": "^3.1.2",
32
+ "deepmerge-ts": "^7.1.3",
33
+ "@paralleldrive/cuid2": "^2.2.2",
34
+ "class-variance-authority": "^0.4.0",
35
+ "clsx": "^1.2.1",
36
+ "tailwind-merge": "^1.13.2",
37
+ "uuid": "^9.0.1"
38
+ },
39
+ "devDependencies": {
40
+ "@typescript-eslint/eslint-plugin": "^5.59.0",
41
+ "@typescript-eslint/parser": "^5.59.0",
42
+ "@vitejs/plugin-react": "^4.0.0",
43
+ "@types/chroma-js": "^3.1.1",
44
+ "@types/uuid": "^9.0.6",
45
+ "eslint": "^8.38.0",
46
+ "eslint-plugin-react-hooks": "^4.6.0",
47
+ "eslint-plugin-react-refresh": "^0.3.4",
48
+ "typescript": "^5.0.2",
49
+ "vite": "^4.3.9"
50
+ },
51
+ "tsup": {
52
+ "clean": true,
53
+ "target": "es2019",
54
+ "format": ["cjs", "esm"]
55
+ }
56
+ }