@aegis-framework/artemis 0.3.29 → 0.4.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/LICENSE +1 -1
- package/dist/artemis.browser.js +4 -0
- package/dist/artemis.browser.js.map +24 -0
- package/dist/artemis.js +3 -1
- package/dist/artemis.js.map +23 -1
- package/dist/types/DOM.d.ts +383 -0
- package/dist/types/DOM.d.ts.map +1 -0
- package/dist/types/Debug.d.ts +118 -0
- package/dist/types/Debug.d.ts.map +1 -0
- package/dist/types/FileSystem.d.ts +69 -0
- package/dist/types/FileSystem.d.ts.map +1 -0
- package/dist/types/Form.d.ts +32 -0
- package/dist/types/Form.d.ts.map +1 -0
- package/dist/types/Platform.d.ts +93 -0
- package/dist/types/Platform.d.ts.map +1 -0
- package/dist/types/Preload.d.ts +26 -0
- package/dist/types/Preload.d.ts.map +1 -0
- package/dist/types/Request.d.ts +86 -0
- package/dist/types/Request.d.ts.map +1 -0
- package/dist/types/Space.d.ts +205 -0
- package/dist/types/Space.d.ts.map +1 -0
- package/dist/types/SpaceAdapter/IndexedDB.d.ts +130 -0
- package/dist/types/SpaceAdapter/IndexedDB.d.ts.map +1 -0
- package/dist/types/SpaceAdapter/LocalStorage.d.ts +125 -0
- package/dist/types/SpaceAdapter/LocalStorage.d.ts.map +1 -0
- package/dist/types/SpaceAdapter/RemoteStorage.d.ts +122 -0
- package/dist/types/SpaceAdapter/RemoteStorage.d.ts.map +1 -0
- package/dist/types/SpaceAdapter/SessionStorage.d.ts +30 -0
- package/dist/types/SpaceAdapter/SessionStorage.d.ts.map +1 -0
- package/dist/types/SpaceAdapter/types.d.ts +76 -0
- package/dist/types/SpaceAdapter/types.d.ts.map +1 -0
- package/dist/types/Text.d.ts +47 -0
- package/dist/types/Text.d.ts.map +1 -0
- package/dist/types/Util.d.ts +31 -0
- package/dist/types/Util.d.ts.map +1 -0
- package/dist/types/browser.d.ts +7 -0
- package/dist/types/browser.d.ts.map +1 -0
- package/dist/types/index.d.ts +11 -0
- package/dist/types/index.d.ts.map +1 -0
- package/package.json +42 -53
- package/dist/artemis.min.js +0 -2
- package/dist/artemis.min.js.map +0 -1
- package/dist/index.js +0 -2
- package/dist/index.js.map +0 -1
- package/index.js +0 -10
- package/src/DOM.js +0 -993
- package/src/Debug.js +0 -233
- package/src/FileSystem.js +0 -109
- package/src/Form.js +0 -73
- package/src/Platform.js +0 -166
- package/src/Preload.js +0 -48
- package/src/Request.js +0 -163
- package/src/Space.js +0 -334
- package/src/SpaceAdapter/IndexedDB.js +0 -345
- package/src/SpaceAdapter/LocalStorage.js +0 -395
- package/src/SpaceAdapter/RemoteStorage.js +0 -225
- package/src/SpaceAdapter/SessionStorage.js +0 -46
- package/src/Text.js +0 -133
- package/src/Util.js +0 -55
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ==============================
|
|
3
|
+
* Local Storage Adapter
|
|
4
|
+
* ==============================
|
|
5
|
+
*/
|
|
6
|
+
import type { LocalStorageConfiguration, StorageValue, KeyValueResult, UpgradeCallback } from './types';
|
|
7
|
+
/**
|
|
8
|
+
* The Local Storage Adapter provides the Space Class the ability to interact
|
|
9
|
+
* with the localStorage API found in most modern browsers.
|
|
10
|
+
*/
|
|
11
|
+
export declare class LocalStorage {
|
|
12
|
+
name: string;
|
|
13
|
+
version: string;
|
|
14
|
+
store: string;
|
|
15
|
+
id: string;
|
|
16
|
+
numericVersion: number;
|
|
17
|
+
upgrades: Record<string, UpgradeCallback<LocalStorage>>;
|
|
18
|
+
storage: Storage | Promise<LocalStorage> | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* Create a new LocalStorage. If no configuration is provided, the LocalStorage
|
|
21
|
+
* global object is used. The LocalStorage Adapter can provide independency
|
|
22
|
+
* by store name and space name.
|
|
23
|
+
*
|
|
24
|
+
* @param configuration - Configuration Object for the Adapter
|
|
25
|
+
*/
|
|
26
|
+
constructor({ name, version, store }: LocalStorageConfiguration);
|
|
27
|
+
/**
|
|
28
|
+
* Modify the configuration
|
|
29
|
+
*
|
|
30
|
+
* @param config - Configuration object to set up
|
|
31
|
+
*/
|
|
32
|
+
configuration(config: LocalStorageConfiguration): void;
|
|
33
|
+
/**
|
|
34
|
+
* Open the Storage Object
|
|
35
|
+
*
|
|
36
|
+
* @returns Promise resolving to this adapter
|
|
37
|
+
*/
|
|
38
|
+
open(): Promise<this>;
|
|
39
|
+
/**
|
|
40
|
+
* Store a key-value pair
|
|
41
|
+
*
|
|
42
|
+
* @param key - Key with which this value will be saved
|
|
43
|
+
* @param value - Value to save
|
|
44
|
+
* @returns Promise with key and value
|
|
45
|
+
*/
|
|
46
|
+
set(key: string, value: StorageValue): Promise<KeyValueResult>;
|
|
47
|
+
/**
|
|
48
|
+
* Update a key-value pair. The update method will use Object.assign()
|
|
49
|
+
* in the case of objects so no value is lost.
|
|
50
|
+
*
|
|
51
|
+
* @param key - Key with which this value will be saved
|
|
52
|
+
* @param value - Value to save
|
|
53
|
+
* @returns Promise with key and value
|
|
54
|
+
*/
|
|
55
|
+
update(key: string, value: StorageValue): Promise<KeyValueResult>;
|
|
56
|
+
/**
|
|
57
|
+
* Retrieves a value from storage given its key
|
|
58
|
+
*
|
|
59
|
+
* @param key - Key with which the value was saved
|
|
60
|
+
* @returns Promise resolving to the retrieved value
|
|
61
|
+
*/
|
|
62
|
+
get(key: string): Promise<StorageValue>;
|
|
63
|
+
/**
|
|
64
|
+
* Retrieves all the values in the space in a key-value JSON object
|
|
65
|
+
*
|
|
66
|
+
* @returns Promise resolving to all values
|
|
67
|
+
*/
|
|
68
|
+
getAll(): Promise<Record<string, StorageValue>>;
|
|
69
|
+
/**
|
|
70
|
+
* Check if the space contains a given key.
|
|
71
|
+
*
|
|
72
|
+
* @param key - Key to look for
|
|
73
|
+
* @returns Promise that resolves if key exists
|
|
74
|
+
*/
|
|
75
|
+
contains(key: string): Promise<void>;
|
|
76
|
+
/**
|
|
77
|
+
* Upgrade a Space Version
|
|
78
|
+
*
|
|
79
|
+
* @param oldVersion - The version of the storage to be upgraded
|
|
80
|
+
* @param newVersion - The version to be upgraded to
|
|
81
|
+
* @param callback - Function to transform the old stored values
|
|
82
|
+
* @returns Promise
|
|
83
|
+
*/
|
|
84
|
+
upgrade(oldVersion: string, newVersion: string, callback: UpgradeCallback<LocalStorage>): Promise<void>;
|
|
85
|
+
/**
|
|
86
|
+
* Helper for the upgrade progress by executing callbacks in order
|
|
87
|
+
*/
|
|
88
|
+
private _upgrade;
|
|
89
|
+
/**
|
|
90
|
+
* Rename a Space
|
|
91
|
+
*
|
|
92
|
+
* @param name - New name to be used
|
|
93
|
+
* @returns Promise for the rename operation
|
|
94
|
+
*/
|
|
95
|
+
rename(name: string): Promise<void>;
|
|
96
|
+
/**
|
|
97
|
+
* Get the key that corresponds to a given index in the storage
|
|
98
|
+
*
|
|
99
|
+
* @param index - Index to get the key from
|
|
100
|
+
* @param full - Whether to return the full key name including space id
|
|
101
|
+
* @returns Promise resolving to the key's name
|
|
102
|
+
*/
|
|
103
|
+
key(index: number, full?: boolean): Promise<string>;
|
|
104
|
+
/**
|
|
105
|
+
* Return all keys stored in the space.
|
|
106
|
+
*
|
|
107
|
+
* @param full - Whether to return the full key name including space id
|
|
108
|
+
* @returns Promise resolving to array of keys
|
|
109
|
+
*/
|
|
110
|
+
keys(full?: boolean): Promise<string[]>;
|
|
111
|
+
/**
|
|
112
|
+
* Delete a value from the space given its key
|
|
113
|
+
*
|
|
114
|
+
* @param key - Key of the item to delete
|
|
115
|
+
* @returns Promise resolving to the value of the deleted object
|
|
116
|
+
*/
|
|
117
|
+
remove(key: string): Promise<StorageValue>;
|
|
118
|
+
/**
|
|
119
|
+
* Clear the entire space
|
|
120
|
+
*
|
|
121
|
+
* @returns Promise for the clear operation
|
|
122
|
+
*/
|
|
123
|
+
clear(): Promise<void>;
|
|
124
|
+
}
|
|
125
|
+
//# sourceMappingURL=LocalStorage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|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IACH,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,eAAe,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAMvG;;OAEG;IACH,OAAO,CAAC,QAAQ;IAUhB;;;;;OAKG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAgCnC;;;;;;OAMG;IACH,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,GAAE,OAAe,GAAG,OAAO,CAAC,MAAM,CAAC;IAW1D;;;;;OAKG;IACH,IAAI,CAAC,IAAI,GAAE,OAAe,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAc9C;;;;;OAKG;IACH,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAO1C;;;;OAIG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAQtB"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ==============================
|
|
3
|
+
* Remote Storage Adapter
|
|
4
|
+
* ==============================
|
|
5
|
+
*/
|
|
6
|
+
import { Request } from '../Request';
|
|
7
|
+
import type { RequestOptions } from '../Request';
|
|
8
|
+
import type { RemoteStorageConfiguration, StorageValue, KeyValueResult } from './types';
|
|
9
|
+
/**
|
|
10
|
+
* The Remote Storage Adapter provides the Space Class the ability to interact
|
|
11
|
+
* with a server in order to handle data persistence. The server's implementation
|
|
12
|
+
* is up to the developer but it will need to respond to this adapter's request
|
|
13
|
+
* formatting. This adapter uses the Request class to perform its tasks.
|
|
14
|
+
*/
|
|
15
|
+
export declare class RemoteStorage {
|
|
16
|
+
name: string;
|
|
17
|
+
version: string;
|
|
18
|
+
store: string;
|
|
19
|
+
endpoint: string;
|
|
20
|
+
props: RequestOptions;
|
|
21
|
+
storage: typeof Request | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Create a new Remote Storage. This adapter requires an endpoint URL where
|
|
24
|
+
* it will make the requests.
|
|
25
|
+
*
|
|
26
|
+
* @param configuration - Configuration Object for the Adapter
|
|
27
|
+
*/
|
|
28
|
+
constructor({ name, version, store, endpoint, props }: RemoteStorageConfiguration);
|
|
29
|
+
/**
|
|
30
|
+
* Modify the configuration
|
|
31
|
+
*
|
|
32
|
+
* @param config - Configuration object to set up
|
|
33
|
+
*/
|
|
34
|
+
configuration(config: RemoteStorageConfiguration): void;
|
|
35
|
+
/**
|
|
36
|
+
* Open the Storage Object
|
|
37
|
+
*
|
|
38
|
+
* @returns Promise resolving to this adapter
|
|
39
|
+
*/
|
|
40
|
+
open(): Promise<this>;
|
|
41
|
+
/**
|
|
42
|
+
* Store a key-value pair. This function sends a POST request to the server
|
|
43
|
+
*
|
|
44
|
+
* @param key - Key with which this value will be saved
|
|
45
|
+
* @param value - Value to save
|
|
46
|
+
* @returns Promise with key and response
|
|
47
|
+
*/
|
|
48
|
+
set(key: string, value: StorageValue): Promise<KeyValueResult>;
|
|
49
|
+
/**
|
|
50
|
+
* Update a key-value pair. The update method will use Object.assign()
|
|
51
|
+
* in the case of objects so no value is lost. This function sends a PUT
|
|
52
|
+
* request to the server.
|
|
53
|
+
*
|
|
54
|
+
* @param key - Key with which this value will be saved
|
|
55
|
+
* @param value - Value to save
|
|
56
|
+
* @returns Promise with key and response
|
|
57
|
+
*/
|
|
58
|
+
update(key: string, value: StorageValue): Promise<KeyValueResult>;
|
|
59
|
+
/**
|
|
60
|
+
* Retrieves a value from storage given its key
|
|
61
|
+
*
|
|
62
|
+
* @param key - Key with which the value was saved
|
|
63
|
+
* @returns Promise resolving to the retrieved value
|
|
64
|
+
*/
|
|
65
|
+
get(key: string): Promise<StorageValue>;
|
|
66
|
+
/**
|
|
67
|
+
* Retrieves all the values in the space in a key-value JSON object
|
|
68
|
+
*
|
|
69
|
+
* @returns Promise resolving to all values
|
|
70
|
+
*/
|
|
71
|
+
getAll(): Promise<Record<string, StorageValue>>;
|
|
72
|
+
/**
|
|
73
|
+
* Check if a space contains a given key.
|
|
74
|
+
*
|
|
75
|
+
* @param key - Key to look for
|
|
76
|
+
* @returns Promise that resolves if key exists
|
|
77
|
+
*/
|
|
78
|
+
contains(key: string): Promise<void>;
|
|
79
|
+
/**
|
|
80
|
+
* Upgrading the Storage must be done on the server side, therefore this
|
|
81
|
+
* function always gets rejected.
|
|
82
|
+
*
|
|
83
|
+
* @returns Promise rejection
|
|
84
|
+
*/
|
|
85
|
+
upgrade(): Promise<never>;
|
|
86
|
+
/**
|
|
87
|
+
* Renaming the Storage must be done on the server side, therefore this
|
|
88
|
+
* function always gets rejected.
|
|
89
|
+
*
|
|
90
|
+
* @returns Promise rejection
|
|
91
|
+
*/
|
|
92
|
+
rename(): Promise<never>;
|
|
93
|
+
/**
|
|
94
|
+
* Getting a key by its index is not possible in this adapter, therefore
|
|
95
|
+
* this function always gets rejected.
|
|
96
|
+
*
|
|
97
|
+
* @returns Promise rejection
|
|
98
|
+
*/
|
|
99
|
+
key(): Promise<never>;
|
|
100
|
+
/**
|
|
101
|
+
* Return all keys stored in the space. This makes a GET request to the
|
|
102
|
+
* full endpoint with a keys query parameter.
|
|
103
|
+
*
|
|
104
|
+
* @returns Promise resolving to array of keys
|
|
105
|
+
*/
|
|
106
|
+
keys(): Promise<string[]>;
|
|
107
|
+
/**
|
|
108
|
+
* Delete a value from the space given its key. This function sends a
|
|
109
|
+
* DELETE request to the server.
|
|
110
|
+
*
|
|
111
|
+
* @param key - Key of the item to delete
|
|
112
|
+
* @returns Promise resolving to the key and response
|
|
113
|
+
*/
|
|
114
|
+
remove(key: string): Promise<StorageValue>;
|
|
115
|
+
/**
|
|
116
|
+
* Clear the entire space. This function sends a DELETE request to the server.
|
|
117
|
+
*
|
|
118
|
+
* @returns Promise for the clear operation
|
|
119
|
+
*/
|
|
120
|
+
clear(): Promise<void>;
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=RemoteStorage.d.ts.map
|
|
@@ -0,0 +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AAI,CAAC;IAUpC;;;;;OAKG;IACH,OAAO,IAAI,OAAO,CAAC,KAAK,CAAC;IAIzB;;;;;OAKG;IACH,MAAM,IAAI,OAAO,CAAC,KAAK,CAAC;IAIxB;;;;;OAKG;IACH,GAAG,IAAI,OAAO,CAAC,KAAK,CAAC;IAIrB;;;;;OAKG;IACH,IAAI,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAMzB;;;;;;OAMG;IACH,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAQ1C;;;;OAIG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAKtB"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ==============================
|
|
3
|
+
* Session Storage Adapter
|
|
4
|
+
* ==============================
|
|
5
|
+
*/
|
|
6
|
+
import { LocalStorage } from './LocalStorage';
|
|
7
|
+
import type { LocalStorageConfiguration } from './types';
|
|
8
|
+
/**
|
|
9
|
+
* The Session Storage Adapter provides the Space Class the ability to interact
|
|
10
|
+
* with the sessionStorage API found in most modern browsers. Since this API
|
|
11
|
+
* shares pretty much the same methods as the local storage one, this class
|
|
12
|
+
* inherits from the LocalStorage adapter.
|
|
13
|
+
*/
|
|
14
|
+
export declare class SessionStorage extends LocalStorage {
|
|
15
|
+
/**
|
|
16
|
+
* Create a new SessionStorage. If no configuration is provided, the SessionStorage
|
|
17
|
+
* global object is used. The SessionStorage Adapter can provide independency
|
|
18
|
+
* by store name and space name.
|
|
19
|
+
*
|
|
20
|
+
* @param configuration - Configuration Object for the Adapter
|
|
21
|
+
*/
|
|
22
|
+
constructor({ name, version, store }: LocalStorageConfiguration);
|
|
23
|
+
/**
|
|
24
|
+
* Open the Storage Object
|
|
25
|
+
*
|
|
26
|
+
* @returns Promise resolving to this adapter
|
|
27
|
+
*/
|
|
28
|
+
open(): Promise<this>;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=SessionStorage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SessionStorage.d.ts","sourceRoot":"","sources":["../../../src/SpaceAdapter/SessionStorage.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;AAEzD;;;;;GAKG;AACH,qBAAa,cAAe,SAAQ,YAAY;IAC/C;;;;;;OAMG;gBACS,EAAE,IAAS,EAAE,OAAY,EAAE,KAAU,EAAE,EAAE,yBAAyB;IAI9E;;;;OAIG;IACH,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAMrB"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ==============================
|
|
3
|
+
* Space Adapter Types
|
|
4
|
+
* ==============================
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Base configuration for all space adapters
|
|
8
|
+
*/
|
|
9
|
+
export interface SpaceConfiguration {
|
|
10
|
+
name?: string;
|
|
11
|
+
version?: string;
|
|
12
|
+
store?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* LocalStorage/SessionStorage configuration
|
|
16
|
+
*/
|
|
17
|
+
export type LocalStorageConfiguration = SpaceConfiguration;
|
|
18
|
+
/**
|
|
19
|
+
* IndexedDB configuration with additional options
|
|
20
|
+
*/
|
|
21
|
+
export interface IndexedDBConfiguration extends SpaceConfiguration {
|
|
22
|
+
props?: IDBObjectStoreParameters;
|
|
23
|
+
index?: Record<string, {
|
|
24
|
+
name: string;
|
|
25
|
+
field: string;
|
|
26
|
+
props?: IDBIndexParameters;
|
|
27
|
+
}>;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* RemoteStorage configuration
|
|
31
|
+
*/
|
|
32
|
+
export interface RemoteStorageConfiguration extends SpaceConfiguration {
|
|
33
|
+
endpoint?: string;
|
|
34
|
+
props?: Record<string, string>;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Generic storage value type
|
|
38
|
+
*/
|
|
39
|
+
export type StorageValue = unknown;
|
|
40
|
+
/**
|
|
41
|
+
* Key-value result type
|
|
42
|
+
*/
|
|
43
|
+
export interface KeyValueResult {
|
|
44
|
+
key: string;
|
|
45
|
+
value: StorageValue;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Upgrade callback function type
|
|
49
|
+
*/
|
|
50
|
+
export type UpgradeCallback<T = unknown> = (adapter: T, event?: IDBVersionChangeEvent) => Promise<void>;
|
|
51
|
+
/**
|
|
52
|
+
* Base interface for all space adapters
|
|
53
|
+
*/
|
|
54
|
+
export interface SpaceAdapterInterface {
|
|
55
|
+
name: string;
|
|
56
|
+
version: string;
|
|
57
|
+
store: string;
|
|
58
|
+
open(): Promise<this>;
|
|
59
|
+
set(key: string | null, value: StorageValue): Promise<KeyValueResult>;
|
|
60
|
+
update(key: string, value: StorageValue): Promise<KeyValueResult>;
|
|
61
|
+
get(key: string): Promise<StorageValue>;
|
|
62
|
+
getAll(): Promise<Record<string, StorageValue>>;
|
|
63
|
+
contains(key: string): Promise<void>;
|
|
64
|
+
upgrade(oldVersion: string, newVersion: string, callback: UpgradeCallback): Promise<void>;
|
|
65
|
+
rename(name: string): Promise<void>;
|
|
66
|
+
key(index: number, full?: boolean): Promise<string>;
|
|
67
|
+
keys(full?: boolean): Promise<string[]>;
|
|
68
|
+
remove(key: string): Promise<StorageValue>;
|
|
69
|
+
clear(): Promise<void>;
|
|
70
|
+
configuration?(config: SpaceConfiguration): void;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Space adapter constructor type
|
|
74
|
+
*/
|
|
75
|
+
export type SpaceAdapterConstructor = new (config: SpaceConfiguration) => SpaceAdapterInterface;
|
|
76
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceR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export declare class Text {
|
|
10
|
+
/**
|
|
11
|
+
* Capitalizes every word in a string
|
|
12
|
+
*
|
|
13
|
+
* @param text - Text string to capitalize
|
|
14
|
+
* @returns Capitalized string
|
|
15
|
+
*/
|
|
16
|
+
static capitalize(text: string): string;
|
|
17
|
+
/**
|
|
18
|
+
* Gets the suffix of a string given a key
|
|
19
|
+
*
|
|
20
|
+
* @param key - Key part of the string
|
|
21
|
+
* @param text - Full string to extract the suffix from
|
|
22
|
+
* @returns Suffix
|
|
23
|
+
*/
|
|
24
|
+
static suffix(key: string, text: string): string;
|
|
25
|
+
/**
|
|
26
|
+
* Get the currently selected text
|
|
27
|
+
*
|
|
28
|
+
* @returns Text selection
|
|
29
|
+
*/
|
|
30
|
+
static selection(): string;
|
|
31
|
+
/**
|
|
32
|
+
* Gets the prefix of a string given a key
|
|
33
|
+
*
|
|
34
|
+
* @param key - Key part of the string
|
|
35
|
+
* @param text - Full string to extract the prefix from
|
|
36
|
+
* @returns Prefix
|
|
37
|
+
*/
|
|
38
|
+
static prefix(key: string, text: string): string;
|
|
39
|
+
/**
|
|
40
|
+
* Transforms a given text into a friendly URL string replacing all special characters
|
|
41
|
+
*
|
|
42
|
+
* @param text - The text to build the url from
|
|
43
|
+
* @returns Friendly URL
|
|
44
|
+
*/
|
|
45
|
+
static friendly(text: string): string;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=Text.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../src/Text.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,qBAAa,IAAI;IAChB;;;;;OAKG;IACH,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAMvC;;;;;;OAMG;IACH,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM;IAUhD;;;;OAIG;IACH,MAAM,CAAC,SAAS,IAAI,MAAM;IAQ1B;;;;;;OAMG;IACH,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM;IAShD;;;;;OAKG;IACH,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;CAwDrC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ==============================
|
|
3
|
+
* Util
|
|
4
|
+
* ==============================
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Callable function type
|
|
8
|
+
*/
|
|
9
|
+
export type Callable<T = unknown> = (...args: unknown[]) => T | Promise<T>;
|
|
10
|
+
/**
|
|
11
|
+
* Provides diverse utility functions
|
|
12
|
+
*/
|
|
13
|
+
export declare class Util {
|
|
14
|
+
/**
|
|
15
|
+
* Calls any function using promises to keep a standard behavior between
|
|
16
|
+
* async and sync functions.
|
|
17
|
+
*
|
|
18
|
+
* @param callable - The function to run
|
|
19
|
+
* @param context - The object `this` will be mapped to
|
|
20
|
+
* @param args - List of parameters to pass to the function when called
|
|
21
|
+
* @returns A promise that resolves to the result of the function
|
|
22
|
+
*/
|
|
23
|
+
static callAsync<T = unknown>(callable: Callable<T>, context: unknown, ...args: unknown[]): Promise<T>;
|
|
24
|
+
/**
|
|
25
|
+
* Creates a UUID. These UUIDs should not be trusted for uniqueness
|
|
26
|
+
*
|
|
27
|
+
* @returns Generated UUID
|
|
28
|
+
*/
|
|
29
|
+
static uuid(): string;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=Util.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Util.d.ts","sourceRoot":"","sources":["../../src/Util.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,MAAM,QAAQ,CAAC,CAAC,GAAG,OAAO,IAAI,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;AAE3E;;GAEG;AACH,qBAAa,IAAI;IAChB;;;;;;;;OAQG;IACH,MAAM,CAAC,SAAS,CAAC,CAAC,GAAG,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC;IAgBtG;;;;OAIG;IACH,MAAM,CAAC,IAAI,IAAI,MAAM;CAYrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../src/browser.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAEnC,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,MAAM;QACf,OAAO,EAAE,OAAO,OAAO,CAAC;KACxB;CACD"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './Debug';
|
|
2
|
+
export * from './DOM';
|
|
3
|
+
export * from './FileSystem';
|
|
4
|
+
export * from './Form';
|
|
5
|
+
export { Platform } from './Platform';
|
|
6
|
+
export * from './Preload';
|
|
7
|
+
export * from './Request';
|
|
8
|
+
export * from './Space';
|
|
9
|
+
export * from './Text';
|
|
10
|
+
export * from './Util';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aegis-framework/artemis",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Aegis Framework Javascript Library",
|
|
5
|
-
"
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/artemis.js",
|
|
6
7
|
"module": "./dist/artemis.js",
|
|
7
|
-
"
|
|
8
|
+
"types": "./dist/types/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/types/index.d.ts",
|
|
12
|
+
"import": "./dist/artemis.js",
|
|
13
|
+
"default": "./dist/artemis.js"
|
|
14
|
+
},
|
|
15
|
+
"./browser": {
|
|
16
|
+
"types": "./dist/types/index.d.ts",
|
|
17
|
+
"import": "./dist/artemis.browser.js",
|
|
18
|
+
"default": "./dist/artemis.browser.js"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"sideEffects": false,
|
|
8
22
|
"repository": {
|
|
9
23
|
"type": "git",
|
|
10
24
|
"url": "https://gitlab.com/AegisFramework/Artemis.git"
|
|
@@ -13,67 +27,42 @@
|
|
|
13
27
|
"url": "https://gitlab.com/AegisFramework/Artemis/issues"
|
|
14
28
|
},
|
|
15
29
|
"homepage": "https://aegisframework.com/",
|
|
16
|
-
"author": "
|
|
30
|
+
"author": "Diana Islas Ocampo <dev@hyuchia.com>",
|
|
17
31
|
"license": "MIT",
|
|
18
32
|
"keywords": [
|
|
19
33
|
"artemis",
|
|
20
34
|
"dom",
|
|
21
35
|
"javascript",
|
|
36
|
+
"typescript",
|
|
22
37
|
"library"
|
|
23
38
|
],
|
|
24
|
-
"targets": {
|
|
25
|
-
"module": {
|
|
26
|
-
"source": "index.js",
|
|
27
|
-
"engines": {
|
|
28
|
-
"browsers": "Chrome 80"
|
|
29
|
-
},
|
|
30
|
-
"outputFormat": "esmodule",
|
|
31
|
-
"isLibrary": true,
|
|
32
|
-
"optimize": true,
|
|
33
|
-
"includeNodeModules": true
|
|
34
|
-
},
|
|
35
|
-
"main": {
|
|
36
|
-
"source": "index.js",
|
|
37
|
-
"engines": {
|
|
38
|
-
"node": ">= 12"
|
|
39
|
-
},
|
|
40
|
-
"outputFormat": "commonjs",
|
|
41
|
-
"isLibrary": true,
|
|
42
|
-
"optimize": true,
|
|
43
|
-
"includeNodeModules": true
|
|
44
|
-
},
|
|
45
|
-
"legacy": {
|
|
46
|
-
"source": "browser.js",
|
|
47
|
-
"context": "browser",
|
|
48
|
-
"outputFormat": "global",
|
|
49
|
-
"engines": {
|
|
50
|
-
"browsers": "> 0.5%, last 2 versions, not dead"
|
|
51
|
-
},
|
|
52
|
-
"isLibrary": false,
|
|
53
|
-
"optimize": true,
|
|
54
|
-
"includeNodeModules": true
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
39
|
"scripts": {
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"build": "
|
|
61
|
-
"build:
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
40
|
+
"build": "yarn clean && yarn lint && yarn check && yarn build:module && yarn build:legacy && yarn build:types",
|
|
41
|
+
"build:module": "bun build ./src/index.ts --target browser --format esm --outdir ./dist --sourcemap=linked --minify && mv ./dist/index.js ./dist/artemis.js && mv ./dist/index.js.map ./dist/artemis.js.map && sed -i 's/index.js.map/artemis.js.map/' ./dist/artemis.js",
|
|
42
|
+
"build:legacy": "bun build ./src/browser.ts --target browser --format esm --outdir ./dist --sourcemap=linked --minify && mv ./dist/browser.js ./dist/artemis.browser.js && mv ./dist/browser.js.map ./dist/artemis.browser.js.map && sed -i 's/browser.js.map/artemis.browser.js.map/' ./dist/artemis.browser.js",
|
|
43
|
+
"build:types": "tsc --emitDeclarationOnly --declarationDir ./dist/types",
|
|
44
|
+
"check": "tsc --noEmit",
|
|
45
|
+
"lint": "eslint ./src/**/*.ts",
|
|
46
|
+
"clean": "rm -rf dist",
|
|
47
|
+
"test": "http-server -p 3000 -c-1"
|
|
65
48
|
},
|
|
66
49
|
"devDependencies": {
|
|
67
|
-
"eslint": "^
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"
|
|
50
|
+
"@babel/eslint-parser": "^7.28.5",
|
|
51
|
+
"@eslint/js": "^9.39.1",
|
|
52
|
+
"@typescript-eslint/eslint-plugin": "^8.48.1",
|
|
53
|
+
"@typescript-eslint/parser": "^8.48.1",
|
|
54
|
+
"bun": "^1.3.3",
|
|
55
|
+
"eslint": "^9.39.1",
|
|
56
|
+
"http-server": "^14.1.1",
|
|
57
|
+
"typescript": "^5.9.3",
|
|
58
|
+
"typescript-eslint": "^8.48.1"
|
|
71
59
|
},
|
|
72
60
|
"files": [
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
-
"
|
|
61
|
+
"dist/",
|
|
62
|
+
"LICENSE",
|
|
63
|
+
"README.md",
|
|
64
|
+
"package.json"
|
|
76
65
|
],
|
|
77
|
-
"
|
|
78
|
-
"
|
|
66
|
+
"browserslist": "> 0.5%, last 2 versions, not dead",
|
|
67
|
+
"packageManager": "yarn@4.12.0"
|
|
79
68
|
}
|