@guebbit/vue-toolkit 1.0.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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core.js","sourceRoot":"","sources":["../../src/stores/core.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAA;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAGpC,MAAM,CAAC,MAAM,YAAY,GAAG,WAAW,CAAC,MAAM,EAAE,GAAG,EAAE;IAEnD;;;OAGG;IACH,MAAM,QAAQ,GAAG,GAAG,CAAmC,EAAE,CAAC,CAAC;IAE3D;;;;;OAKG;IACH,MAAM,UAAU,GAAG,CAAC,GAAoB,EAAE,KAAc,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IAEzF;;OAEG;IACH,MAAM,aAAa,GAAG,GAAG,EAAE,CAAE,QAAQ,CAAC,KAAK,GAAG,EAAE,CAAC;IAEjD;;OAEG;IACH,MAAM,UAAU,GAAG,CAAC,GAAoB,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAEjE;;OAEG;IACH,MAAM,SAAS,GAAG,QAAQ,CACxB,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAClD,CAAA;IAED,OAAO;QACL,QAAQ;QACR,SAAS;QACT,aAAa;QACb,UAAU;QACV,UAAU;KACX,CAAA;AACH,CAAC,CAAC,CAAA"}
@@ -0,0 +1,93 @@
1
+ import { defineStore } from "pinia";
2
+ import { ref, computed } from 'vue';
3
+ export var IToastType;
4
+ (function (IToastType) {
5
+ IToastType["PRIMARY"] = "primary";
6
+ IToastType["SECONDARY"] = "secondary";
7
+ IToastType["DANGER"] = "error";
8
+ IToastType["WARNING"] = "warning";
9
+ IToastType["SUCCESS"] = "success";
10
+ })(IToastType || (IToastType = {}));
11
+ /**
12
+ *
13
+ */
14
+ export const useNotificationsStore = defineStore('notifications', () => {
15
+ // ________________ MESSAGES (also known as toasts) ________________
16
+ /**
17
+ * Settings
18
+ */
19
+ const history = ref([]);
20
+ /**
21
+ * Visible messages
22
+ */
23
+ const messages = computed(() => history.value.filter(({ visible }) => visible));
24
+ /**
25
+ * Add a message then after a timeout and then remove it (FIFO)
26
+ *
27
+ * @param message
28
+ * @param type
29
+ * @param timeout
30
+ */
31
+ const addMessage = (message, type = IToastType.PRIMARY, timeout = -1) => {
32
+ const id = crypto.randomUUID();
33
+ // Add to history
34
+ history.value.push({
35
+ id,
36
+ message,
37
+ type,
38
+ visible: true,
39
+ });
40
+ // Remove after timeout (if any)
41
+ if (timeout > 0)
42
+ setTimeout(() => { hideMessage(id); }, timeout);
43
+ };
44
+ /**
45
+ * Find a message by id
46
+ *
47
+ * @param _id
48
+ */
49
+ const findMessage = (_id) => history.value.find(({ id }) => id === _id);
50
+ /**
51
+ * Hide a message visiblity
52
+ *
53
+ * @param _id
54
+ */
55
+ const hideMessage = (_id) => {
56
+ const message = findMessage(_id);
57
+ if (message)
58
+ message.visible = false;
59
+ };
60
+ /**
61
+ * Show a message visiblity
62
+ *
63
+ * @param _id
64
+ */
65
+ const showMessage = (_id) => {
66
+ const message = findMessage(_id);
67
+ if (message)
68
+ message.visible = true;
69
+ };
70
+ /**
71
+ * Permanently remove a message (even from history)
72
+ *
73
+ * @param _id
74
+ */
75
+ const removeMessage = (_id) => history.value = history.value.filter(({ id }) => id !== _id);
76
+ // ________________ DIALOGS ________________
77
+ /**
78
+ * Manage all dialogs
79
+ * key is dialog name, value is dialog visibility (on/off)
80
+ */
81
+ const dialogs = ref({});
82
+ return {
83
+ history,
84
+ messages,
85
+ addMessage,
86
+ findMessage,
87
+ hideMessage,
88
+ showMessage,
89
+ removeMessage,
90
+ dialogs,
91
+ };
92
+ });
93
+ //# sourceMappingURL=notifications.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notifications.js","sourceRoot":"","sources":["../../src/stores/notifications.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAEpC,MAAM,CAAN,IAAY,UAMX;AAND,WAAY,UAAU;IACpB,iCAAmB,CAAA;IACnB,qCAAuB,CAAA;IACvB,8BAAgB,CAAA;IAChB,iCAAmB,CAAA;IACnB,iCAAmB,CAAA;AACrB,CAAC,EANW,UAAU,KAAV,UAAU,QAMrB;AAQD;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,WAAW,CAAC,eAAe,EAAE,GAAG,EAAE;IAErE,oEAAoE;IAEpE;;OAEG;IACH,MAAM,OAAO,GAAG,GAAG,CAAC,EAAqB,CAAC,CAAC;IAE3C;;OAEG;IACH,MAAM,QAAQ,GAAG,QAAQ,CAAC,GAAG,EAAE,CAC7B,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,CAC/C,CAAC;IAEF;;;;;;OAMG;IACH,MAAM,UAAU,GAAG,CAAC,OAAe,EAAE,IAAI,GAAG,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,CAAC,CAAC,EAAE,EAAE;QAC9E,MAAM,EAAE,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;QAC/B,iBAAiB;QACjB,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC;YACjB,EAAE;YACF,OAAO;YACP,IAAI;YACJ,OAAO,EAAE,IAAI;SACd,CAAC,CAAC;QACH,gCAAgC;QAChC,IAAG,OAAO,GAAG,CAAC;YACZ,UAAU,CAAC,GAAG,EAAE,GAAG,WAAW,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;IACpD,CAAC,CAAA;IAED;;;;OAIG;IACH,MAAM,WAAW,GAAG,CAAC,GAAW,EAAE,EAAE,CAClC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC;IAE7C;;;;OAIG;IACH,MAAM,WAAW,GAAG,CAAC,GAAW,EAAE,EAAE;QAClC,MAAM,OAAO,GAAG,WAAW,CAAC,GAAG,CAAC,CAAA;QAChC,IAAI,OAAO;YACT,OAAO,CAAC,OAAO,GAAG,KAAK,CAAA;IAC3B,CAAC,CAAC;IAEF;;;;OAIG;IACH,MAAM,WAAW,GAAG,CAAC,GAAW,EAAE,EAAE;QAClC,MAAM,OAAO,GAAG,WAAW,CAAC,GAAG,CAAC,CAAA;QAChC,IAAI,OAAO;YACT,OAAO,CAAC,OAAO,GAAG,IAAI,CAAA;IAC1B,CAAC,CAAC;IAEF;;;;OAIG;IACH,MAAM,aAAa,GAAG,CAAC,GAAW,EAAE,EAAE,CACpC,OAAO,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC;IAI/D,4CAA4C;IAE5C;;;OAGG;IACH,MAAM,OAAO,GAAG,GAAG,CAAC,EAA6B,CAAC,CAAA;IAElD,OAAO;QACL,OAAO;QACP,QAAQ;QACR,UAAU;QACV,WAAW;QACX,WAAW;QACX,WAAW;QACX,aAAa;QACb,OAAO;KACR,CAAC;AACJ,CAAC,CAAC,CAAC"}
@@ -0,0 +1,29 @@
1
+ export declare const useStructureDataManagement: <T extends Record<string | number | symbol, any> = Record<string, any>, K extends string | number | symbol = keyof T, P extends string | number | symbol = string | number | symbol>(identifiers?: string | string[], delimiter?: string) => {
2
+ createIdentifier: <C = T>(itemData: C, customIdentifiers?: string | string[]) => K;
3
+ identifier: string;
4
+ itemDictionary: [Record<K, T>] extends [import("vue").Ref<any, any>] ? import("@vue/shared").IfAny<import("vue").Ref<any, any> & Record<K, T>, import("vue").Ref<import("vue").Ref<any, any> & Record<K, T>, import("vue").Ref<any, any> & Record<K, T>>, import("vue").Ref<any, any> & Record<K, T>> : import("vue").Ref<import("vue").UnwrapRef<Record<K, T>>, Record<K, T> | import("vue").UnwrapRef<Record<K, T>>>;
5
+ itemList: import("vue").ComputedRef<T[]>;
6
+ setRecords: (items: Record<K, T>) => Record<K, T>;
7
+ resetRecords: () => {};
8
+ getRecord: (..._arguments: (K | undefined)[]) => T | undefined;
9
+ getRecords: (idsArray?: (K | (K | undefined)[])[]) => T[];
10
+ addRecord: (itemData: T) => T;
11
+ addRecords: (itemsArray: (T | undefined)[]) => void;
12
+ editRecord: (data?: Partial<T>, id?: K | K[], create?: boolean) => void;
13
+ editRecords: (itemsArray: (T | undefined)[]) => void;
14
+ deleteRecord: (id: K) => boolean | undefined;
15
+ selectedIdentifier: import("vue").Ref<K | undefined, K | undefined>;
16
+ selectedRecord: import("vue").ComputedRef<T | undefined>;
17
+ pageCurrent: import("vue").Ref<number, number>;
18
+ pageSize: import("vue").Ref<number, number>;
19
+ pageTotal: import("vue").ComputedRef<number>;
20
+ pageOffset: import("vue").ComputedRef<number>;
21
+ pageItemList: import("vue").ComputedRef<T[]>;
22
+ parentHasMany: [Record<P, string[]>] extends [import("vue").Ref<any, any>] ? import("@vue/shared").IfAny<import("vue").Ref<any, any> & Record<P, string[]>, import("vue").Ref<import("vue").Ref<any, any> & Record<P, string[]>, import("vue").Ref<any, any> & Record<P, string[]>>, import("vue").Ref<any, any> & Record<P, string[]>> : import("vue").Ref<import("vue").UnwrapRef<Record<P, string[]>>, Record<P, string[]> | import("vue").UnwrapRef<Record<P, string[]>>>;
23
+ addToParent: (parentId: P, childId: string) => void;
24
+ removeFromParent: (parentId: P, childId: string) => string[];
25
+ removeDuplicateChildren: (parentId: P) => string[];
26
+ getRecordsByParent: (parentId?: P) => Record<K, T>;
27
+ getListByParent: (parentId?: P) => T[];
28
+ };
29
+ //# sourceMappingURL=structureDataManagement.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"structureDataManagement.d.ts","sourceRoot":"","sources":["../../../src/composables/structureDataManagement.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,0BAA0B,GAGrC,CAAC,SAAS,MAAM,CAAC,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAErE,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC,EAG5C,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,EAG7D,cAAa,MAAM,GAAG,MAAM,EAAS,EAErC,kBAAe;uBASW,CAAC,gBAAgB,CAAC,sBAAsB,MAAM,GAAG,MAAM,EAAE,KAAG,CAAC;;;;wBA4B5D,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,KAAG,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC;;+BAcpB,CAAC,CAAC,GAAG,SAAS,CAAC,EAAE,KAAG,CAAC,GAAG,SAAS;4BAUrC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,SAAS,CAAC,EAAE,CAAC,EAAE,KAG/B,CAAC,EAAE;0BAQE,CAAC;6BAQE,CAAC,CAAC,GAAG,SAAS,CAAC,EAAE;wBAkBvB,OAAO,CAAC,CAAC,CAAC,OAAY,CAAC,GAAG,CAAC,EAAE;8BA4BtB,CAAC,CAAC,GAAG,SAAS,CAAC,EAAE;uBAaxB,CAAC;;;;;;;;;4BAkEI,CAAC;iCAWI,CAAC;wCASM,CAAC;oCAOL,CAAC,KAAG,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC;iCAgBnB,CAAC,KAAG,CAAC,EAAE;CAkC5C,CAAC"}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=structureFormValidation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"structureFormValidation.d.ts","sourceRoot":"","sources":["../../../src/composables/structureFormValidation.ts"],"names":[],"mappings":""}
@@ -0,0 +1,128 @@
1
+ /**
2
+ * Ideas:
3
+ * - Create a "check" method to know in advance if a fetch request will be denied and cache used
4
+ */
5
+ /**
6
+ * Fetch settings customization
7
+ * If they are NOT set, default behavior will be used
8
+ */
9
+ export interface IFetchSettings {
10
+ /**
11
+ * Ignore TTL and force the request anyway
12
+ */
13
+ forced?: boolean;
14
+ /**
15
+ * Enable loading during promises
16
+ */
17
+ loading?: boolean;
18
+ /**
19
+ * When I don't want to replace the data but merge it instead with the existing one
20
+ * (replacing only the old fields with the new ones)
21
+ *
22
+ * This could happen because I use different fetches that return different fields for the same item
23
+ *
24
+ * Example:
25
+ * I could have a fetch call with custom lastUpdateKey that retrieves a list of items that I have already and maybe with a valid TTL.
26
+ * Without merge I would just refresh like a soft-forced. With merge I can update the items with new data
27
+ */
28
+ merge?: boolean;
29
+ /**
30
+ * TTL for this specific request.
31
+ * Example: if you set a 10 min TTL instead of the default 1 hour,
32
+ * the data will be considered "stale" after 10 minutes
33
+ * and a new request will be made to refresh it
34
+ */
35
+ TTL?: number;
36
+ /**
37
+ * Replace the key used for TTL management
38
+ * (It will still have the unique prefix)
39
+ */
40
+ lastUpdateKey?: string;
41
+ /**
42
+ * Change the key used for loading management
43
+ */
44
+ loadingKey?: string;
45
+ }
46
+ /**
47
+ * Time To Live and Last Update
48
+ * Optimize fetch requests by caching data and preventing unnecessary requests
49
+ */
50
+ export declare enum ELastUpdateKeywords {
51
+ ALL = "_all",
52
+ TARGET = "_target",
53
+ PARENT = "_parent",
54
+ ONLINE = "_online",
55
+ GENERIC = "_generic"
56
+ }
57
+ /**
58
+ * Stringified query => page => array if ids of the found products
59
+ */
60
+ export type ISearchCache<K = string | number> = Record<string, Record<number, K[]>>;
61
+ /**
62
+ * Composable customization settings
63
+ */
64
+ export interface IStructureRestApi {
65
+ identifiers?: string | string[];
66
+ loadingKey?: string;
67
+ TTL?: number;
68
+ delimiter?: string;
69
+ getLoading?: (key?: string, value?: boolean) => void;
70
+ setLoading?: (key?: string, value?: boolean) => void;
71
+ }
72
+ export declare const useStructureRestApi: <T extends Record<string | number, any> = Record<string, any>, K extends string | number = Extract<keyof T, string | number>, P extends string | number = string | number>({ identifiers, loadingKey, TTL, delimiter, getLoading, setLoading }?: IStructureRestApi) => {
73
+ createIdentifier: <C = T>(itemData: C, customIdentifiers?: string | string[]) => K;
74
+ identifierKey: string;
75
+ loadingKey: string;
76
+ itemDictionary: [Record<K, T>] extends [import("vue").Ref<any, any>] ? import("@vue/shared").IfAny<import("vue").Ref<any, any> & Record<K, T>, import("vue").Ref<import("vue").Ref<any, any> & Record<K, T>, import("vue").Ref<any, any> & Record<K, T>>, import("vue").Ref<any, any> & Record<K, T>> : import("vue").Ref<import("vue").UnwrapRef<Record<K, T>>, Record<K, T> | import("vue").UnwrapRef<Record<K, T>>>;
77
+ itemList: import("vue").ComputedRef<T[]>;
78
+ setRecords: (items: Record<K, T>) => Record<K, T>;
79
+ resetRecords: () => {};
80
+ getRecord: (..._arguments: (K | undefined)[]) => T | undefined;
81
+ getRecords: (idsArray?: (K | (K | undefined)[])[]) => T[];
82
+ addRecord: (itemData: T) => T;
83
+ addRecords: (itemsArray: (T | undefined)[]) => void;
84
+ editRecord: (data?: Partial<T>, id?: K | K[] | undefined, create?: boolean) => void;
85
+ deleteRecord: (id: K) => boolean | undefined;
86
+ selectedIdentifier: import("vue").Ref<K | undefined, K | undefined>;
87
+ selectedRecord: import("vue").ComputedRef<T | undefined>;
88
+ pageCurrent: import("vue").Ref<number, number>;
89
+ pageSize: import("vue").Ref<number, number>;
90
+ pageTotal: import("vue").ComputedRef<number>;
91
+ pageOffset: import("vue").ComputedRef<number>;
92
+ pageItemList: import("vue").ComputedRef<T[]>;
93
+ parentHasMany: [Record<P, string[]>] extends [import("vue").Ref<any, any>] ? import("@vue/shared").IfAny<import("vue").Ref<any, any> & Record<P, string[]>, import("vue").Ref<import("vue").Ref<any, any> & Record<P, string[]>, import("vue").Ref<any, any> & Record<P, string[]>>, import("vue").Ref<any, any> & Record<P, string[]>> : import("vue").Ref<import("vue").UnwrapRef<Record<P, string[]>>, Record<P, string[]> | import("vue").UnwrapRef<Record<P, string[]>>>;
94
+ addToParent: (parentId: P, childId: string) => void;
95
+ removeFromParent: (parentId: P, childId: string) => string[];
96
+ removeDuplicateChildren: (parentId: P) => string[];
97
+ getRecordsByParent: (parentId?: P | undefined) => Record<K, T>;
98
+ getListByParent: (parentId?: P | undefined) => T[];
99
+ startLoading: (postfix?: string) => true | void;
100
+ stopLoading: (postfix?: string) => false | void;
101
+ loading: import("vue").ComputedRef<boolean | void>;
102
+ lastUpdate: {
103
+ _all: number;
104
+ _target: Record<K, number>;
105
+ _parent: Record<P, number>;
106
+ _online: Record<string, number>;
107
+ _generic: Record<string, number>;
108
+ };
109
+ resetLastUpdate: (branch?: ELastUpdateKeywords) => void;
110
+ getLastUpdate: (key?: number | string, branch?: ELastUpdateKeywords) => boolean;
111
+ editLastUpdate: (value?: number, key?: number | string, branch?: ELastUpdateKeywords) => void;
112
+ checkAndEditLastUpdate: (key?: number | string, branch?: ELastUpdateKeywords) => boolean;
113
+ saveRecords: (items?: (T | undefined)[], merge?: boolean, onSave?: (item: T) => void) => (T | undefined)[];
114
+ fetchAny: <F = any>(asyncCall: () => Promise<F>, { forced, loading, lastUpdateKey, loadingKey }?: Omit<IFetchSettings, "merge">) => Promise<F | undefined>;
115
+ fetchAll: (apiCall: () => Promise<(T | undefined)[]>, { forced, loading, merge, lastUpdateKey, loadingKey }?: IFetchSettings, mismatch?: boolean) => Promise<(T | undefined)[]>;
116
+ fetchByParent: (apiCall: () => Promise<(T | undefined)[]>, parentId: P, { forced, loading, merge, lastUpdateKey, loadingKey }?: IFetchSettings, mismatch?: boolean) => Promise<(T | undefined)[]>;
117
+ fetchTarget: (apiCall: () => Promise<T | undefined>, id?: K, { forced, loading, merge, lastUpdateKey, loadingKey }?: IFetchSettings) => Promise<T | undefined>;
118
+ fetchMultiple: (apiCall: () => Promise<(T | undefined)[]>, ids?: K[], { forced, loading, merge, loadingKey, lastUpdateKey }?: IFetchSettings) => Promise<(T | undefined)[]>;
119
+ searchCached: import("vue").Ref<ISearchCache<K>, ISearchCache<K>>;
120
+ searchKeyGen: (object?: object) => string;
121
+ searchGet: (key: string | object, page?: number) => T[];
122
+ searchCleanup: () => void;
123
+ fetchSearch: <F = object>(apiCall: () => Promise<(T | undefined)[]>, filters?: F, page?: number, { forced, loading, merge, lastUpdateKey, loadingKey }?: IFetchSettings, mismatch?: boolean) => Promise<(T | undefined)[]>;
124
+ createTarget: (apiCall: () => Promise<T | undefined>, dummyData?: T, { loading, lastUpdateKey, loadingKey }?: Omit<IFetchSettings, "forced" | "merge">, fetchLike?: boolean) => Promise<T | undefined>;
125
+ updateTarget: <F = T>(apiCall: () => Promise<F | (T | undefined)[]>, itemData: Partial<T>, id?: K, { loading, merge, lastUpdateKey, loadingKey }?: Omit<IFetchSettings, "forced">, fetchLike?: boolean, fetchAgain?: boolean) => Promise<F | (T | undefined)[]>;
126
+ deleteTarget: <F = unknown>(apiCall: () => Promise<F>, id: K, { loading, loadingKey }?: Pick<IFetchSettings, "loading" | "loadingKey">) => Promise<F>;
127
+ };
128
+ //# sourceMappingURL=structureRestApi.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"structureRestApi.d.ts","sourceRoot":"","sources":["../../../src/composables/structureRestApi.ts"],"names":[],"mappings":"AAGA;;;GAGG;AAEH;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC3B;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;IAEhB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IAEjB;;;;;;;;;OASG;IACH,KAAK,CAAC,EAAE,OAAO,CAAA;IAEf;;;;;OAKG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;IAE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AC,GAAG,SAAS,CAAC,EAAE,CAAC;4BAwDhB,MAAM,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,cACzB,CAAC,2CAKV,IAAI,CAAC,cAAc,EAAE,QAAQ,GAAG,OAAO,CAAC,0BAE5C,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;mBAgDH,CAAC,eACV,MAAM,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,SAAS,CAAC,EAAE,CAAC,YACnC,OAAO,CAAC,CAAC,CAAC,OACf,CAAC,kDAMH,IAAI,CAAC,cAAc,EAAE,QAAQ,CAAC,gDAGlC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,SAAS,CAAC,EAAE,CAAC;mBA2CX,CAAC,qBACV,MAAM,OAAO,CAAC,CAAC,CAAC,MACrB,CAAC,4BAIF,IAAI,CAAC,cAAc,EAAE,SAAS,GAAG,YAAY,CAAC,KAClD,OAAO,CAAC,CAAC,CAAC;CA4EhB,CAAC"}
@@ -0,0 +1,5 @@
1
+ export { useCoreStore } from "./stores/core";
2
+ export { useNotificationsStore } from "./stores/notifications";
3
+ export { useStructureDataManagement } from "./composables/structureDataManagement";
4
+ export { useStructureRestApi } from "./composables/structureRestApi";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAA;AAC9D,OAAO,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAA;AAClF,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAA"}
@@ -0,0 +1,20 @@
1
+ export declare const useCoreStore: import("pinia").StoreDefinition<"core", Pick<{
2
+ loadings: import("vue").Ref<Record<string | symbol, boolean>, Record<string | symbol, boolean>>;
3
+ isLoading: import("vue").ComputedRef<boolean>;
4
+ resetLoadings: () => {};
5
+ setLoading: (key: string | symbol, value: boolean) => boolean;
6
+ getLoading: (key: string | symbol) => boolean;
7
+ }, "loadings">, Pick<{
8
+ loadings: import("vue").Ref<Record<string | symbol, boolean>, Record<string | symbol, boolean>>;
9
+ isLoading: import("vue").ComputedRef<boolean>;
10
+ resetLoadings: () => {};
11
+ setLoading: (key: string | symbol, value: boolean) => boolean;
12
+ getLoading: (key: string | symbol) => boolean;
13
+ }, "isLoading">, Pick<{
14
+ loadings: import("vue").Ref<Record<string | symbol, boolean>, Record<string | symbol, boolean>>;
15
+ isLoading: import("vue").ComputedRef<boolean>;
16
+ resetLoadings: () => {};
17
+ setLoading: (key: string | symbol, value: boolean) => boolean;
18
+ getLoading: (key: string | symbol) => boolean;
19
+ }, "resetLoadings" | "setLoading" | "getLoading">>;
20
+ //# sourceMappingURL=core.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../src/stores/core.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,YAAY;;;;sBAcE,MAAM,GAAG,MAAM,SAAS,OAAO;sBAU/B,MAAM,GAAG,MAAM;;;;;sBAVf,MAAM,GAAG,MAAM,SAAS,OAAO;sBAU/B,MAAM,GAAG,MAAM;;;;;sBAVf,MAAM,GAAG,MAAM,SAAS,OAAO;sBAU/B,MAAM,GAAG,MAAM;kDAgBxC,CAAA"}
@@ -0,0 +1,120 @@
1
+ export declare enum IToastType {
2
+ PRIMARY = "primary",
3
+ SECONDARY = "secondary",
4
+ DANGER = "error",
5
+ WARNING = "warning",
6
+ SUCCESS = "success"
7
+ }
8
+ export interface IToastMessage {
9
+ id: string;
10
+ message: string;
11
+ type: IToastType;
12
+ visible: boolean;
13
+ }
14
+ /**
15
+ *
16
+ */
17
+ export declare const useNotificationsStore: import("pinia").StoreDefinition<"notifications", Pick<{
18
+ history: import("vue").Ref<{
19
+ id: string;
20
+ message: string;
21
+ type: IToastType;
22
+ visible: boolean;
23
+ }[], IToastMessage[] | {
24
+ id: string;
25
+ message: string;
26
+ type: IToastType;
27
+ visible: boolean;
28
+ }[]>;
29
+ messages: import("vue").ComputedRef<{
30
+ id: string;
31
+ message: string;
32
+ type: IToastType;
33
+ visible: boolean;
34
+ }[]>;
35
+ addMessage: (message: string, type?: IToastType, timeout?: number) => void;
36
+ findMessage: (_id: string) => {
37
+ id: string;
38
+ message: string;
39
+ type: IToastType;
40
+ visible: boolean;
41
+ } | undefined;
42
+ hideMessage: (_id: string) => void;
43
+ showMessage: (_id: string) => void;
44
+ removeMessage: (_id: string) => {
45
+ id: string;
46
+ message: string;
47
+ type: IToastType;
48
+ visible: boolean;
49
+ }[];
50
+ dialogs: import("vue").Ref<Record<string, boolean>, Record<string, boolean>>;
51
+ }, "history" | "dialogs">, Pick<{
52
+ history: import("vue").Ref<{
53
+ id: string;
54
+ message: string;
55
+ type: IToastType;
56
+ visible: boolean;
57
+ }[], IToastMessage[] | {
58
+ id: string;
59
+ message: string;
60
+ type: IToastType;
61
+ visible: boolean;
62
+ }[]>;
63
+ messages: import("vue").ComputedRef<{
64
+ id: string;
65
+ message: string;
66
+ type: IToastType;
67
+ visible: boolean;
68
+ }[]>;
69
+ addMessage: (message: string, type?: IToastType, timeout?: number) => void;
70
+ findMessage: (_id: string) => {
71
+ id: string;
72
+ message: string;
73
+ type: IToastType;
74
+ visible: boolean;
75
+ } | undefined;
76
+ hideMessage: (_id: string) => void;
77
+ showMessage: (_id: string) => void;
78
+ removeMessage: (_id: string) => {
79
+ id: string;
80
+ message: string;
81
+ type: IToastType;
82
+ visible: boolean;
83
+ }[];
84
+ dialogs: import("vue").Ref<Record<string, boolean>, Record<string, boolean>>;
85
+ }, "messages">, Pick<{
86
+ history: import("vue").Ref<{
87
+ id: string;
88
+ message: string;
89
+ type: IToastType;
90
+ visible: boolean;
91
+ }[], IToastMessage[] | {
92
+ id: string;
93
+ message: string;
94
+ type: IToastType;
95
+ visible: boolean;
96
+ }[]>;
97
+ messages: import("vue").ComputedRef<{
98
+ id: string;
99
+ message: string;
100
+ type: IToastType;
101
+ visible: boolean;
102
+ }[]>;
103
+ addMessage: (message: string, type?: IToastType, timeout?: number) => void;
104
+ findMessage: (_id: string) => {
105
+ id: string;
106
+ message: string;
107
+ type: IToastType;
108
+ visible: boolean;
109
+ } | undefined;
110
+ hideMessage: (_id: string) => void;
111
+ showMessage: (_id: string) => void;
112
+ removeMessage: (_id: string) => {
113
+ id: string;
114
+ message: string;
115
+ type: IToastType;
116
+ visible: boolean;
117
+ }[];
118
+ dialogs: import("vue").Ref<Record<string, boolean>, Record<string, boolean>>;
119
+ }, "addMessage" | "findMessage" | "hideMessage" | "showMessage" | "removeMessage">>;
120
+ //# sourceMappingURL=notifications.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notifications.d.ts","sourceRoot":"","sources":["../../../src/stores/notifications.ts"],"names":[],"mappings":"AAGA,oBAAY,UAAU;IACpB,OAAO,YAAY;IACnB,SAAS,cAAc;IACvB,MAAM,UAAU;IAChB,OAAO,YAAY;IACnB,OAAO,YAAY;CACpB;AACD,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,UAAU,CAAC;IACjB,OAAO,EAAE,OAAO,CAAA;CACjB;AAED;;GAEG;AACH,eAAO,MAAM,qBAAqB;;YAT5B,MAAM;iBACD,MAAM;cACT,UAAU;iBACP,OAAO;;YAHZ,MAAM;iBACD,MAAM;cACT,UAAU;iBACP,OAAO;;;YAHZ,MAAM;iBACD,MAAM;cACT,UAAU;iBACP,OAAO;;0BA6Ba,MAAM;uBAmBT,MAAM;YAnD5B,MAAM;iBACD,MAAM;cACT,UAAU;iBACP,OAAO;;uBAwDU,MAAM;uBAWN,MAAM;yBAWJ,MAAM;YAjF9B,MAAM;iBACD,MAAM;cACT,UAAU;iBACP,OAAO;;;;;YAHZ,MAAM;iBACD,MAAM;cACT,UAAU;iBACP,OAAO;;YAHZ,MAAM;iBACD,MAAM;cACT,UAAU;iBACP,OAAO;;;YAHZ,MAAM;iBACD,MAAM;cACT,UAAU;iBACP,OAAO;;0BA6Ba,MAAM;uBAmBT,MAAM;YAnD5B,MAAM;iBACD,MAAM;cACT,UAAU;iBACP,OAAO;;uBAwDU,MAAM;uBAWN,MAAM;yBAWJ,MAAM;YAjF9B,MAAM;iBACD,MAAM;cACT,UAAU;iBACP,OAAO;;;;;YAHZ,MAAM;iBACD,MAAM;cACT,UAAU;iBACP,OAAO;;YAHZ,MAAM;iBACD,MAAM;cACT,UAAU;iBACP,OAAO;;;YAHZ,MAAM;iBACD,MAAM;cACT,UAAU;iBACP,OAAO;;0BA6Ba,MAAM;uBAmBT,MAAM;YAnD5B,MAAM;iBACD,MAAM;cACT,UAAU;iBACP,OAAO;;uBAwDU,MAAM;uBAWN,MAAM;yBAWJ,MAAM;YAjF9B,MAAM;iBACD,MAAM;cACT,UAAU;iBACP,OAAO;;;mFAqGhB,CAAC"}
package/package.json ADDED
@@ -0,0 +1,74 @@
1
+ {
2
+ "name": "@guebbit/vue-toolkit",
3
+ "version": "1.0.0",
4
+ "license": "AGPLv3.0",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "module": "dist/index.js",
8
+ "types": "dist/types/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "import": "./dist/index.js",
12
+ "types": "./dist/types/index.d.ts"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist",
17
+ "README.md",
18
+ "LICENSE",
19
+ "CHANGELOG"
20
+ ],
21
+ "sideEffects": false,
22
+ "scripts": {
23
+ "build": "tsc",
24
+ "test": "jest --config jest.config.cjs --passWithNoTests",
25
+ "test:target": "jest --config jest.config.cjs /tests/getColorBrightness.spec.ts",
26
+ "lint": "eslint \"*/**/*.{ts,js,json}\"",
27
+ "lint:fix": "eslint \"*/**/*.{ts,js,json}\" --fix",
28
+ "docs:dev": "vitepress dev docs --port 8080",
29
+ "docs:build": "vitepress build docs",
30
+ "docs:preview": "vitepress preview docs",
31
+ "update:all": "npx npm-check-updates -u",
32
+ "complete": "npm run build && npm run test && npm run lint && npm run docs:build",
33
+ "publish:public": "npm run complete && npm publish --access public"
34
+ },
35
+ "peerDependencies": {
36
+ "pinia": ">=2.0.0",
37
+ "vue": ">=3.0.0"
38
+ },
39
+ "devDependencies": {
40
+ "@commitlint/cli": "^20.5.0",
41
+ "@commitlint/config-conventional": "^20.5.0",
42
+ "@eslint/js": "^9.0.0",
43
+ "@types/eslint": "^9.6.1",
44
+ "@types/jest": "^30.0.0",
45
+ "@typescript-eslint/eslint-plugin": "^8.57.2",
46
+ "@typescript-eslint/parser": "^8.57.2",
47
+ "@vitest/eslint-plugin": "^1.6.13",
48
+ "@vue/eslint-config-typescript": "^14.7.0",
49
+ "eslint": "^9.39.2",
50
+ "eslint-config-prettier": "^10.1.8",
51
+ "eslint-plugin-cypress": "^6.2.1",
52
+ "eslint-plugin-oxlint": "^1.57.0",
53
+ "eslint-plugin-prettier": "^5.5.5",
54
+ "eslint-plugin-unicorn": "^64.0.0",
55
+ "eslint-plugin-vue": "^10.8.0",
56
+ "husky": "^9.1.7",
57
+ "jest": "^30.3.0",
58
+ "pinia": "^3.0.4",
59
+ "prettier": "^3.8.1",
60
+ "ts-jest": "^29.4.6",
61
+ "typescript": "^5.9.3",
62
+ "typescript-eslint": "^8.57.2",
63
+ "vitepress": "^1.6.4",
64
+ "vue": "^3.5.31"
65
+ },
66
+ "husky": {
67
+ "hooks": {
68
+ "pre-commit": "npm run complete"
69
+ }
70
+ },
71
+ "dependencies": {
72
+ "zod": "^4.3.6"
73
+ }
74
+ }