@pisell/utils 3.0.4 → 3.0.6
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/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js +27 -0
- package/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/defineProperty.js +12 -0
- package/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js +25 -0
- package/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/toPrimitive.js +14 -0
- package/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/toPropertyKey.js +9 -0
- package/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/typeof.js +11 -0
- package/es/arrayUtils.d.ts +76 -1
- package/es/arrayUtils.js +103 -24
- package/es/common/stateHelper.d.ts +22 -0
- package/es/common/stateHelper.js +23 -0
- package/es/common/types.d.ts +31 -0
- package/es/componentStorage.d.ts +38 -0
- package/es/componentStorage.js +106 -0
- package/es/constants/index.js +7 -9
- package/es/date.d.ts +6 -3
- package/es/date.js +36 -53
- package/es/document.d.ts +6 -3
- package/es/document.js +43 -67
- package/es/escPosPrinter/EscPosPrinter.js +353 -490
- package/es/escPosPrinter/index.d.ts +9 -9
- package/es/escPosPrinter/index.js +37 -52
- package/es/format.d.ts +29 -0
- package/es/format.js +90 -112
- package/es/image.d.ts +13 -10
- package/es/image.js +48 -60
- package/es/index.d.ts +39 -18
- package/es/index.js +40 -29
- package/es/jsBridge/index.d.ts +14 -106
- package/es/jsBridge/index.js +57 -40
- package/es/jsBridge/regDeviceApi.js +87 -126
- package/es/jsBridge/types.d.ts +129 -0
- package/es/locales.d.ts +11 -11
- package/es/locales.js +79 -69
- package/es/log.d.ts +11 -6
- package/es/log.js +37 -59
- package/es/miniRedux.d.ts +20 -13
- package/es/miniRedux.js +42 -71
- package/es/number-input/hooks/useNumberInputState.d.ts +29 -0
- package/es/number-input/hooks/useNumberInputState.js +72 -0
- package/es/number-input/types.d.ts +96 -0
- package/es/number-input/utils/formatter.d.ts +56 -0
- package/es/number-input/utils/formatter.js +56 -0
- package/es/number-input/utils/validation.d.ts +32 -0
- package/es/number-input/utils/validation.js +52 -0
- package/es/otherUtils.d.ts +12 -9
- package/es/otherUtils.js +71 -120
- package/es/platform.d.ts +12 -9
- package/es/platform.js +61 -85
- package/es/select/hooks/useDebouncedSearch.d.ts +23 -0
- package/es/select/hooks/useDebouncedSearch.js +41 -0
- package/es/select/hooks/useSelectState.d.ts +19 -0
- package/es/select/hooks/useSelectState.js +60 -0
- package/es/select/index.d.ts +7 -0
- package/es/select/types.d.ts +256 -0
- package/es/select/utils/filterOptions.d.ts +23 -0
- package/es/select/utils/filterOptions.js +29 -0
- package/es/select/utils/helpers.d.ts +43 -0
- package/es/select/utils/helpers.js +51 -0
- package/es/select/utils/index.d.ts +4 -0
- package/es/select/utils/sortOptions.d.ts +13 -0
- package/es/select/utils/sortOptions.js +20 -0
- package/es/select/utils/tagAggregation.d.ts +25 -0
- package/es/select/utils/tagAggregation.js +35 -0
- package/es/text-input/hooks/useTextInputState.d.ts +28 -0
- package/es/text-input/hooks/useTextInputState.js +70 -0
- package/es/text-input/types.d.ts +56 -0
- package/es/text-input/utils/validation.d.ts +28 -0
- package/es/text-input/utils/validation.js +51 -0
- package/es/typeUtils.d.ts +11 -8
- package/es/typeUtils.js +61 -84
- package/es/walletValidity.d.ts +57 -0
- package/es/walletValidity.js +404 -460
- package/es/weighing.d.ts +65 -0
- package/es/weighing.js +96 -0
- package/lib/_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js +27 -0
- package/lib/_virtual/_@oxc-project_runtime@0.122.0/helpers/defineProperty.js +12 -0
- package/lib/_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js +25 -0
- package/lib/_virtual/_@oxc-project_runtime@0.122.0/helpers/toPrimitive.js +14 -0
- package/lib/_virtual/_@oxc-project_runtime@0.122.0/helpers/toPropertyKey.js +9 -0
- package/lib/_virtual/_@oxc-project_runtime@0.122.0/helpers/typeof.js +16 -0
- package/lib/_virtual/_rolldown/runtime.js +23 -0
- package/lib/arrayUtils.d.ts +76 -1
- package/lib/arrayUtils.js +102 -37
- package/lib/common/stateHelper.d.ts +22 -0
- package/lib/common/stateHelper.js +23 -0
- package/lib/common/types.d.ts +31 -0
- package/lib/componentStorage.d.ts +38 -0
- package/lib/componentStorage.js +114 -0
- package/lib/constants/index.js +7 -36
- package/lib/date.d.ts +6 -3
- package/lib/date.js +43 -65
- package/lib/document.d.ts +6 -3
- package/lib/document.js +46 -62
- package/lib/escPosPrinter/EscPosPrinter.js +327 -403
- package/lib/escPosPrinter/index.d.ts +9 -9
- package/lib/escPosPrinter/index.js +38 -84
- package/lib/format.d.ts +29 -0
- package/lib/format.js +91 -93
- package/lib/image.d.ts +13 -10
- package/lib/image.js +48 -74
- package/lib/index.d.ts +39 -18
- package/lib/index.js +137 -68
- package/lib/jsBridge/index.d.ts +14 -106
- package/lib/jsBridge/index.js +60 -60
- package/lib/jsBridge/regDeviceApi.js +86 -133
- package/lib/jsBridge/types.d.ts +129 -0
- package/lib/locales.d.ts +11 -11
- package/lib/locales.js +79 -63
- package/lib/log.d.ts +11 -6
- package/lib/log.js +37 -61
- package/lib/miniRedux.d.ts +20 -13
- package/lib/miniRedux.js +43 -91
- package/lib/number-input/hooks/useNumberInputState.d.ts +29 -0
- package/lib/number-input/hooks/useNumberInputState.js +73 -0
- package/lib/number-input/types.d.ts +96 -0
- package/lib/number-input/utils/formatter.d.ts +56 -0
- package/lib/number-input/utils/formatter.js +58 -0
- package/lib/number-input/utils/validation.d.ts +32 -0
- package/lib/number-input/utils/validation.js +52 -0
- package/lib/otherUtils.d.ts +12 -9
- package/lib/otherUtils.js +86 -91
- package/lib/platform.d.ts +12 -9
- package/lib/platform.js +68 -123
- package/lib/select/hooks/useDebouncedSearch.d.ts +23 -0
- package/lib/select/hooks/useDebouncedSearch.js +42 -0
- package/lib/select/hooks/useSelectState.d.ts +19 -0
- package/lib/select/hooks/useSelectState.js +62 -0
- package/lib/select/index.d.ts +7 -0
- package/lib/select/types.d.ts +256 -0
- package/lib/select/utils/filterOptions.d.ts +23 -0
- package/lib/select/utils/filterOptions.js +30 -0
- package/lib/select/utils/helpers.d.ts +43 -0
- package/lib/select/utils/helpers.js +55 -0
- package/lib/select/utils/index.d.ts +4 -0
- package/lib/select/utils/sortOptions.d.ts +13 -0
- package/lib/select/utils/sortOptions.js +20 -0
- package/lib/select/utils/tagAggregation.d.ts +25 -0
- package/lib/select/utils/tagAggregation.js +35 -0
- package/lib/text-input/hooks/useTextInputState.d.ts +28 -0
- package/lib/text-input/hooks/useTextInputState.js +71 -0
- package/lib/text-input/types.d.ts +56 -0
- package/lib/text-input/utils/validation.d.ts +28 -0
- package/lib/text-input/utils/validation.js +51 -0
- package/lib/typeUtils.d.ts +11 -8
- package/lib/typeUtils.js +68 -73
- package/lib/walletValidity.d.ts +57 -0
- package/lib/walletValidity.js +420 -323
- package/lib/weighing.d.ts +65 -0
- package/lib/weighing.js +114 -0
- package/package.json +1 -1
- package/es/constants/index.d.ts +0 -7
- package/es/firebase/config/index.d.ts +0 -13
- package/es/firebase/config/index.js +0 -54
- package/es/firebase/index.d.ts +0 -28
- package/es/firebase/index.js +0 -232
- package/lib/constants/index.d.ts +0 -7
- package/lib/firebase/config/index.d.ts +0 -13
- package/lib/firebase/config/index.js +0 -79
- package/lib/firebase/index.d.ts +0 -28
- package/lib/firebase/index.js +0 -180
package/lib/firebase/index.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { FirebaseApp } from 'firebase/app';
|
|
2
|
-
import { Auth } from 'firebase/auth';
|
|
3
|
-
import { ref, Database, goOnline, goOffline } from 'firebase/database';
|
|
4
|
-
declare let firebaseApp: FirebaseApp;
|
|
5
|
-
declare let auth: Auth;
|
|
6
|
-
declare let database: Database;
|
|
7
|
-
export declare const initFirebase: (config?: any) => void;
|
|
8
|
-
export { database, firebaseApp, auth, ref, goOnline, goOffline };
|
|
9
|
-
export declare const getPath: (path: string) => string;
|
|
10
|
-
export declare const setAuthStateChangeCallback: (callback: (user: any) => void) => void;
|
|
11
|
-
export declare const signUp: (email: string, password: string) => Promise<import("firebase/auth").User>;
|
|
12
|
-
export declare const signInUser: (email: string, password: string) => Promise<import("firebase/auth").User>;
|
|
13
|
-
export declare const signOutUser: () => Promise<void>;
|
|
14
|
-
export declare const readData: (path: string) => Promise<any>;
|
|
15
|
-
export declare const writeData: (path: string, data: any) => Promise<void>;
|
|
16
|
-
export declare const onDataChange: (path: string, callback: (snapshot: any) => void) => import("firebase/database").Unsubscribe;
|
|
17
|
-
export declare const onDataChanged: (path: string, callback: (snapshot: any) => void) => import("firebase/database").Unsubscribe;
|
|
18
|
-
export declare const removeDataListener: (listener: any) => void;
|
|
19
|
-
declare const _default: {
|
|
20
|
-
signInUser: (email: string, password: string) => Promise<import("firebase/auth").User>;
|
|
21
|
-
signOutUser: () => Promise<void>;
|
|
22
|
-
readData: (path: string) => Promise<any>;
|
|
23
|
-
writeData: (path: string, data: any) => Promise<void>;
|
|
24
|
-
onDataChange: (path: string, callback: (snapshot: any) => void) => import("firebase/database").Unsubscribe;
|
|
25
|
-
removeDataListener: (listener: any) => void;
|
|
26
|
-
onDataChanged: (path: string, callback: (snapshot: any) => void) => import("firebase/database").Unsubscribe;
|
|
27
|
-
};
|
|
28
|
-
export default _default;
|
package/lib/firebase/index.js
DELETED
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
|
|
19
|
-
// src/firebase/index.ts
|
|
20
|
-
var firebase_exports = {};
|
|
21
|
-
__export(firebase_exports, {
|
|
22
|
-
auth: () => auth,
|
|
23
|
-
database: () => database,
|
|
24
|
-
default: () => firebase_default,
|
|
25
|
-
firebaseApp: () => firebaseApp,
|
|
26
|
-
getPath: () => getPath,
|
|
27
|
-
goOffline: () => import_database.goOffline,
|
|
28
|
-
goOnline: () => import_database.goOnline,
|
|
29
|
-
initFirebase: () => initFirebase,
|
|
30
|
-
onDataChange: () => onDataChange,
|
|
31
|
-
onDataChanged: () => onDataChanged,
|
|
32
|
-
readData: () => readData,
|
|
33
|
-
ref: () => import_database.ref,
|
|
34
|
-
removeDataListener: () => removeDataListener,
|
|
35
|
-
setAuthStateChangeCallback: () => setAuthStateChangeCallback,
|
|
36
|
-
signInUser: () => signInUser,
|
|
37
|
-
signOutUser: () => signOutUser,
|
|
38
|
-
signUp: () => signUp,
|
|
39
|
-
writeData: () => writeData
|
|
40
|
-
});
|
|
41
|
-
module.exports = __toCommonJS(firebase_exports);
|
|
42
|
-
var import_app = require("firebase/app");
|
|
43
|
-
var import_auth = require("firebase/auth");
|
|
44
|
-
var import_database = require("firebase/database");
|
|
45
|
-
var import_config = require("./config");
|
|
46
|
-
var import_typeUtils = require("../typeUtils");
|
|
47
|
-
var isClient = typeof window != "undefined" && window.document;
|
|
48
|
-
var isDefaultInit = isClient && ((0, import_typeUtils.isUndefined)(window == null ? void 0 : window.__isDefaultInit) ? true : window == null ? void 0 : window.__isDefaultInit);
|
|
49
|
-
var isInitialized = false;
|
|
50
|
-
var firebaseApp = {};
|
|
51
|
-
var auth = {};
|
|
52
|
-
var database = {};
|
|
53
|
-
var initFirebase = (config) => {
|
|
54
|
-
isInitialized = true;
|
|
55
|
-
firebaseApp = (0, import_app.initializeApp)(config || import_config.firebaseConfig);
|
|
56
|
-
auth = (0, import_auth.getAuth)(firebaseApp);
|
|
57
|
-
database = (0, import_database.getDatabase)(firebaseApp);
|
|
58
|
-
};
|
|
59
|
-
if (isClient && window.__wxjs_environment !== "miniprogram" && isDefaultInit) {
|
|
60
|
-
initFirebase();
|
|
61
|
-
}
|
|
62
|
-
var getPath = (path) => {
|
|
63
|
-
return path;
|
|
64
|
-
};
|
|
65
|
-
var setAuthStateChangeCallback = (callback) => {
|
|
66
|
-
auth.onAuthStateChanged(callback);
|
|
67
|
-
};
|
|
68
|
-
var signUp = async (email, password) => {
|
|
69
|
-
try {
|
|
70
|
-
const userCredential = await (0, import_auth.createUserWithEmailAndPassword)(
|
|
71
|
-
auth,
|
|
72
|
-
email,
|
|
73
|
-
password
|
|
74
|
-
);
|
|
75
|
-
return userCredential.user;
|
|
76
|
-
} catch (error) {
|
|
77
|
-
console.error("Error signing up:", error);
|
|
78
|
-
throw error;
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
var signInUser = async (email, password) => {
|
|
82
|
-
try {
|
|
83
|
-
const userCredential = await (0, import_auth.signInWithEmailAndPassword)(
|
|
84
|
-
auth,
|
|
85
|
-
email,
|
|
86
|
-
password
|
|
87
|
-
);
|
|
88
|
-
return userCredential.user;
|
|
89
|
-
} catch (error) {
|
|
90
|
-
console.error("Error signing in:", error);
|
|
91
|
-
throw error;
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
var signOutUser = async () => {
|
|
95
|
-
try {
|
|
96
|
-
return (0, import_auth.signOut)(auth);
|
|
97
|
-
} catch (error) {
|
|
98
|
-
console.error("Error signing out:", error);
|
|
99
|
-
throw error;
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
var readData = async (path) => {
|
|
103
|
-
try {
|
|
104
|
-
if (!isInitialized) {
|
|
105
|
-
initFirebase();
|
|
106
|
-
}
|
|
107
|
-
const dataSnapshot = await (0, import_database.get)((0, import_database.ref)(database, getPath(path)));
|
|
108
|
-
return dataSnapshot.val();
|
|
109
|
-
} catch (error) {
|
|
110
|
-
console.error("Error reading data:", error);
|
|
111
|
-
throw error;
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
var writeData = async (path, data) => {
|
|
115
|
-
try {
|
|
116
|
-
if (!isInitialized) {
|
|
117
|
-
initFirebase();
|
|
118
|
-
}
|
|
119
|
-
return (0, import_database.set)((0, import_database.ref)(database, getPath(path)), data);
|
|
120
|
-
} catch (error) {
|
|
121
|
-
console.error("Error writing data:", error);
|
|
122
|
-
throw error;
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
var onDataChange = (path, callback) => {
|
|
126
|
-
try {
|
|
127
|
-
if (!isInitialized) {
|
|
128
|
-
initFirebase();
|
|
129
|
-
}
|
|
130
|
-
} catch (error) {
|
|
131
|
-
console.error("init error", error);
|
|
132
|
-
}
|
|
133
|
-
const databaseRef = (0, import_database.ref)(database, getPath(path));
|
|
134
|
-
const listener = (0, import_database.onValue)(databaseRef, callback);
|
|
135
|
-
return listener;
|
|
136
|
-
};
|
|
137
|
-
var onDataChanged = (path, callback) => {
|
|
138
|
-
try {
|
|
139
|
-
if (!isInitialized) {
|
|
140
|
-
initFirebase();
|
|
141
|
-
}
|
|
142
|
-
} catch (error) {
|
|
143
|
-
console.error("init error", error);
|
|
144
|
-
}
|
|
145
|
-
const databaseRef = (0, import_database.ref)(database, getPath(path));
|
|
146
|
-
const listener = (0, import_database.onChildChanged)(databaseRef, callback);
|
|
147
|
-
return listener;
|
|
148
|
-
};
|
|
149
|
-
var removeDataListener = (listener) => {
|
|
150
|
-
(0, import_database.off)(listener);
|
|
151
|
-
};
|
|
152
|
-
var firebase_default = {
|
|
153
|
-
signInUser,
|
|
154
|
-
signOutUser,
|
|
155
|
-
readData,
|
|
156
|
-
writeData,
|
|
157
|
-
onDataChange,
|
|
158
|
-
removeDataListener,
|
|
159
|
-
onDataChanged
|
|
160
|
-
};
|
|
161
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
162
|
-
0 && (module.exports = {
|
|
163
|
-
auth,
|
|
164
|
-
database,
|
|
165
|
-
firebaseApp,
|
|
166
|
-
getPath,
|
|
167
|
-
goOffline,
|
|
168
|
-
goOnline,
|
|
169
|
-
initFirebase,
|
|
170
|
-
onDataChange,
|
|
171
|
-
onDataChanged,
|
|
172
|
-
readData,
|
|
173
|
-
ref,
|
|
174
|
-
removeDataListener,
|
|
175
|
-
setAuthStateChangeCallback,
|
|
176
|
-
signInUser,
|
|
177
|
-
signOutUser,
|
|
178
|
-
signUp,
|
|
179
|
-
writeData
|
|
180
|
-
});
|