@aegis-framework/artemis 0.4.1 → 0.5.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 (36) hide show
  1. package/README.md +547 -96
  2. package/dist/artemis.browser.js +2 -2
  3. package/dist/artemis.browser.js.map +18 -17
  4. package/dist/artemis.js +2 -2
  5. package/dist/artemis.js.map +18 -17
  6. package/dist/types/DOM.d.ts +189 -207
  7. package/dist/types/DOM.d.ts.map +1 -1
  8. package/dist/types/Debug.d.ts +73 -2
  9. package/dist/types/Debug.d.ts.map +1 -1
  10. package/dist/types/FileSystem.d.ts +55 -38
  11. package/dist/types/FileSystem.d.ts.map +1 -1
  12. package/dist/types/Form.d.ts +41 -16
  13. package/dist/types/Form.d.ts.map +1 -1
  14. package/dist/types/Platform.d.ts +62 -63
  15. package/dist/types/Platform.d.ts.map +1 -1
  16. package/dist/types/Preload.d.ts +70 -11
  17. package/dist/types/Preload.d.ts.map +1 -1
  18. package/dist/types/Request.d.ts +111 -47
  19. package/dist/types/Request.d.ts.map +1 -1
  20. package/dist/types/Space.d.ts +19 -6
  21. package/dist/types/Space.d.ts.map +1 -1
  22. package/dist/types/SpaceAdapter/IndexedDB.d.ts +10 -7
  23. package/dist/types/SpaceAdapter/IndexedDB.d.ts.map +1 -1
  24. package/dist/types/SpaceAdapter/LocalStorage.d.ts +18 -8
  25. package/dist/types/SpaceAdapter/LocalStorage.d.ts.map +1 -1
  26. package/dist/types/SpaceAdapter/RemoteStorage.d.ts +15 -2
  27. package/dist/types/SpaceAdapter/RemoteStorage.d.ts.map +1 -1
  28. package/dist/types/SpaceAdapter/SessionStorage.d.ts +21 -2
  29. package/dist/types/SpaceAdapter/SessionStorage.d.ts.map +1 -1
  30. package/dist/types/SpaceAdapter/types.d.ts +32 -1
  31. package/dist/types/SpaceAdapter/types.d.ts.map +1 -1
  32. package/dist/types/Text.d.ts +34 -23
  33. package/dist/types/Text.d.ts.map +1 -1
  34. package/dist/types/Util.d.ts +18 -14
  35. package/dist/types/Util.d.ts.map +1 -1
  36. package/package.json +3 -4
package/README.md CHANGED
@@ -1,168 +1,619 @@
1
1
  # Artemis
2
2
 
3
- Artemis is a JavaScript Library that aims to provide common utilities needed during development such as DOM manipulation, a wrapper for client based Storage and other functions that may be useful for web app development.
3
+ Artemis is a lightweight JavaScript/TypeScript library providing common utilities for web development including DOM manipulation, storage wrappers, HTTP requests, and platform detection.
4
4
 
5
- ## Using it
6
- Artemis is provided as a CommonJS, ES6 and global library.
5
+ ## Installation
7
6
 
8
- ### Browser
7
+ ```bash
8
+ # Using npm
9
+ npm install @aegis-framework/artemis
9
10
 
10
- ```html
11
- <script src='./artemis.min.js'></script>
12
- ```
11
+ # Using yarn
12
+ yarn add @aegis-framework/artemis
13
13
 
14
- ```javascript
15
- const { $_, Text } = Artemis;
14
+ # Using bun
15
+ bun add @aegis-framework/artemis
16
16
  ```
17
17
 
18
- ### ES6 Modules
18
+ ### ES Modules
19
19
 
20
20
  ```javascript
21
- import { $_, Text } from '@aegis-framework/artemis';
21
+ import { $_, Text, Space, SpaceAdapter } from '@aegis-framework/artemis';
22
22
  ```
23
23
 
24
- ### Node JS
24
+ ### Browser (Script Tag)
25
25
 
26
- ```javascript
27
- const { $_, Text } = require ('@aegis-framework/artemis');
26
+ ```html
27
+ <script src="path/to/artemis.browser.js"></script>
28
+ <script>
29
+ const { $_, Text, Space, SpaceAdapter } = Artemis;
30
+ </script>
28
31
  ```
29
32
 
30
-
31
- Below are some simple examples but you can read the full [documentation of each class](https://gitlab.com/AegisFramework/Artemis/tree/master/docs) for more details.
33
+ ---
32
34
 
33
35
  ## Classes
34
36
 
35
37
  ### DOM
36
- Artemis core library focuses on DOM manipulation, providing a jQuery-like experience and API
38
+
39
+ jQuery-like DOM manipulation with a modern API.
37
40
 
38
41
  ```javascript
39
- $_ready (()=> {
40
- $_('body').append ('<h1>Some Title</h1>');
41
- $_('h1').text ('A different title');
42
- $_('h1').style ('color', '#424242');
42
+ import { $_, $_ready, $_create } from '@aegis-framework/artemis';
43
+
44
+ $_ready(() => {
45
+ // Select and manipulate elements
46
+ $_('h1').text('Hello World').addClass('title');
47
+
48
+ // Chained operations
49
+ $_('.card')
50
+ .addClass('active')
51
+ .style({ 'background-color': '#fff', 'padding': '1rem' })
52
+ .fadeIn(400);
53
+
54
+ // Event handling
55
+ $_('button').click((e) => {
56
+ console.log('Button clicked!');
57
+ });
58
+
59
+ // Event delegation
60
+ $_('ul').on('click', 'li', (e) => {
61
+ console.log('List item clicked:', e.target);
62
+ });
63
+
64
+ // Create new elements
65
+ const div = $_create('div', { class: 'container', id: 'main' });
66
+
67
+ // Traversal
68
+ $_('.item').parent().addClass('has-item');
69
+ $_('.item').siblings().removeClass('active');
70
+ $_('.item').next().addClass('following');
71
+
72
+ // Animations
73
+ $_('#box').fadeOut(400, () => console.log('Hidden'));
74
+ $_('#box').fadeIn(400, () => console.log('Visible'));
75
+ $_('#box').animate(
76
+ [{ transform: 'scale(1)' }, { transform: 'scale(1.2)' }],
77
+ { duration: 300, fill: 'forwards' }
78
+ );
43
79
  });
44
80
  ```
45
81
 
46
- ### Form
47
- Artemis also includes a small form utility class that helps with filling and retrieving values from a form.
82
+ #### Key Methods
83
+
84
+ | Method | Description |
85
+ |--------|-------------|
86
+ | `addClass(name)` | Add a class |
87
+ | `removeClass(name?)` | Remove class(es) |
88
+ | `toggleClass(names)` | Toggle space-separated classes |
89
+ | `hasClass(name)` | Check if all elements have class |
90
+ | `text(value?)` | Get/set text content |
91
+ | `html(value?)` | Get/set HTML content |
92
+ | `value(value?)` | Get/set form element value |
93
+ | `attribute(name, value?)` | Get/set attribute |
94
+ | `data(name, value?)` | Get/set data attributes |
95
+ | `style(prop, value?)` | Get/set inline styles |
96
+ | `on(event, callback)` | Add event listener |
97
+ | `off(event, callback)` | Remove event listener |
98
+ | `trigger(event, detail?)` | Dispatch custom event |
99
+ | `find(selector)` | Find descendants |
100
+ | `closest(selector)` | Find closest ancestor |
101
+ | `parent()` | Get parent elements |
102
+ | `parents()` | Get all ancestors |
103
+ | `children()` | Get child elements |
104
+ | `siblings()` | Get sibling elements |
105
+ | `next()` | Get next sibling |
106
+ | `prev()` | Get previous sibling |
107
+ | `first()` | Get first element |
108
+ | `last()` | Get last element |
109
+ | `eq(index)` | Get element at index |
110
+ | `append(content)` | Append content |
111
+ | `prepend(content)` | Prepend content |
112
+ | `remove()` | Remove elements |
113
+ | `empty()` | Clear children |
114
+ | `clone(deep?)` | Clone elements |
115
+ | `fadeIn(duration, callback?)` | Fade in animation |
116
+ | `fadeOut(duration, callback?)` | Fade out animation |
117
+ | `animate(keyframes, options)` | Web Animations API |
118
+
119
+ ---
48
120
 
49
- ```html
50
- <form data-form="MyForm">
51
- <input type="text" name="SomeInput">
52
- <input type="text" name="OtherInput">
53
- </form>
54
- ```
121
+ ### Space
122
+
123
+ Storage wrapper with namespacing, versioning, and multiple backend adapters.
55
124
 
56
125
  ```javascript
57
- Form.fill ('MyForm', {
58
- 'SomeInput': 'Here is some Value',
59
- 'OtherInput': 'And here’s another one'
126
+ import { Space, SpaceAdapter } from '@aegis-framework/artemis';
127
+
128
+ // LocalStorage adapter
129
+ const storage = new Space(SpaceAdapter.LocalStorage, {
130
+ name: 'MyApp',
131
+ version: '1.0.0'
60
132
  });
61
133
 
62
- console.log (Form.values ('MyForm'));
134
+ await storage.open();
135
+
136
+ // Basic operations
137
+ await storage.set('user', { name: 'John', age: 30 });
138
+ const user = await storage.get('user');
139
+ await storage.update('user', { age: 31 }); // Merges with existing
140
+ await storage.remove('user');
141
+ await storage.clear();
142
+
143
+ // Get all data
144
+ const allData = await storage.getAll();
145
+ const keys = await storage.keys();
146
+
147
+ // Iterate
148
+ await storage.each((key, value) => {
149
+ console.log(key, value);
150
+ });
151
+
152
+ // Check existence
153
+ await storage.contains('user'); // Resolves if exists, rejects if not
154
+
155
+ // Callbacks
156
+ storage.onCreate((key, value) => console.log('Created:', key));
157
+ storage.onUpdate((key, value) => console.log('Updated:', key));
158
+ storage.onDelete((key, value) => console.log('Deleted:', key));
159
+
160
+ // Transformations (modify data on get/set)
161
+ storage.addTransformation({
162
+ id: 'timestamps',
163
+ set: (key, value) => ({ ...value, updatedAt: Date.now() }),
164
+ get: (key, value) => value
165
+ });
63
166
  ```
64
167
 
65
- ### Space
168
+ #### Adapters
66
169
 
67
- The Space Library is a wrapper for simple storage solutions as Local and Session storage but provides data independence through storage namespaces and versioning.
170
+ **LocalStorage** - Persistent browser storage
171
+ ```javascript
172
+ new Space(SpaceAdapter.LocalStorage, { name: 'App', version: '1.0.0' });
173
+ ```
68
174
 
175
+ **SessionStorage** - Session-only storage
69
176
  ```javascript
70
- let space = new Space (SpaceAdapter.LocalStorage, {
71
- name: 'Storage',
72
- version: '0.1.0'
73
- });
177
+ new Space(SpaceAdapter.SessionStorage, { name: 'App', version: '1.0.0' });
178
+ ```
74
179
 
75
- space.set ('Test', {
76
- value: 'Some Value'
77
- }).then (({key, value}) => {
78
- console.log ('The value was inserted correctly!');
180
+ **IndexedDB** - Large-scale structured storage
181
+ ```javascript
182
+ new Space(SpaceAdapter.IndexedDB, {
183
+ name: 'App',
184
+ version: '1.0.0',
185
+ store: 'users',
186
+ props: { keyPath: 'id', autoIncrement: true },
187
+ index: {
188
+ email: { name: 'Email Index', field: 'email', props: { unique: true } }
189
+ }
79
190
  });
191
+ ```
80
192
 
81
- space.get ('Test').then ((value) => {
82
- return value;
83
- }).then (({key, value}) => {
84
- console.log (value);
193
+ **RemoteStorage** - REST API backend
194
+ ```javascript
195
+ new Space(SpaceAdapter.RemoteStorage, {
196
+ name: 'App',
197
+ version: '1.0.0',
198
+ endpoint: 'https://api.example.com/',
199
+ store: 'users'
85
200
  });
201
+ ```
202
+
203
+ #### Version Upgrades
86
204
 
87
- space = new Space (SpaceAdapter.LocalStorage, {
88
- name: 'Storage',
89
- version: '0.1.1'
205
+ ```javascript
206
+ const storage = new Space(SpaceAdapter.LocalStorage, {
207
+ name: 'App',
208
+ version: '2.0.0'
90
209
  });
91
210
 
92
- space.upgrade ('0.1.0', '0.1.1', (storage) => {
93
- return storage.set ('Test', {
94
- value: 'Other Value'
95
- });
211
+ // Define upgrades before opening
212
+ await storage.upgrade('1.0.0', '2.0.0', async (adapter) => {
213
+ const oldData = await adapter.get('config');
214
+ await adapter.set('config', { ...oldData, newField: 'value' });
96
215
  });
216
+
217
+ await storage.open(); // Upgrades run automatically
97
218
  ```
98
219
 
220
+ ---
221
+
99
222
  ### Request
100
- The request library provides a simple way to send HTTP requests using the fetch API.
223
+
224
+ HTTP client built on the Fetch API with timeout support and error handling.
101
225
 
102
226
  ```javascript
103
- Request.get ('https://example.com/api/', {
104
- 'someQueryParam': 'Some Query Value!'
105
- }).then ((response) => {
106
- return response.text ();
107
- }).then ((text) => {
108
- console.log (text);
227
+ import { Request, RequestError, RequestTimeoutError } from '@aegis-framework/artemis';
228
+
229
+ // GET request
230
+ const response = await Request.get('https://api.example.com/users', {
231
+ page: 1,
232
+ limit: 10
109
233
  });
110
234
 
111
- Request.post ('https://example.com/api/', {
112
- 'someKey': 'Some Value!'
113
- }).then ((response) => {
114
- return response.text ();
115
- }).then ((text) => {
116
- console.log (text);
235
+ // POST with JSON
236
+ const created = await Request.postJson('https://api.example.com/users', {
237
+ name: 'John',
238
+ email: 'john@example.com'
117
239
  });
240
+
241
+ // PUT, PATCH, DELETE
242
+ await Request.put(url, data);
243
+ await Request.patch(url, data);
244
+ await Request.delete(url);
245
+
246
+ // HEAD request (check if resource exists)
247
+ const exists = await Request.exists('https://api.example.com/users/1');
248
+
249
+ // With timeout
250
+ const data = await Request.json('https://api.example.com/slow', {}, {
251
+ timeout: 5000 // 5 seconds
252
+ });
253
+
254
+ // Different response types
255
+ const json = await Request.json(url);
256
+ const text = await Request.text(url);
257
+ const blob = await Request.blob(url);
258
+ const buffer = await Request.arrayBuffer(url);
259
+
260
+ // Custom headers
261
+ await Request.post(url, data, {
262
+ headers: {
263
+ 'Authorization': 'Bearer token',
264
+ 'Content-Type': 'application/json'
265
+ }
266
+ });
267
+
268
+ // Error handling
269
+ try {
270
+ const data = await Request.json(url);
271
+ } catch (error) {
272
+ if (error instanceof RequestError) {
273
+ console.log('HTTP Error:', error.status, error.statusText);
274
+ } else if (error instanceof RequestTimeoutError) {
275
+ console.log('Request timed out');
276
+ }
277
+ }
278
+
279
+ // Serialize data to query string
280
+ const query = Request.serialize({ name: 'John', tags: ['a', 'b'] });
118
281
  ```
119
282
 
120
- ### Platform
121
- The platform library provides several utility methods to obtain information about the platform in which the code is running.
283
+ ---
284
+
285
+ ### Form
286
+
287
+ Form filling and value retrieval utilities.
288
+
289
+ ```html
290
+ <form data-form="UserForm">
291
+ <input type="text" name="username">
292
+ <input type="email" name="email">
293
+ <input type="number" name="age">
294
+ <input type="checkbox" name="newsletter">
295
+ <select name="country">
296
+ <option value="us">USA</option>
297
+ <option value="uk">UK</option>
298
+ </select>
299
+ </form>
300
+ ```
122
301
 
123
302
  ```javascript
124
- if (Platform.mobile ('Android')) {
125
- console.log ('You are running this on Android!');
126
- } else if (Platform.mobile ()) {
127
- console.log ('You are running this on some kind of mobile device!');
128
- } else if (Platform.desktop ('macOS')) {
129
- console.log ('You are running this on a Mac!');
130
- }
303
+ import { Form } from '@aegis-framework/artemis';
304
+
305
+ // Fill form with data
306
+ Form.fill('UserForm', {
307
+ username: 'john_doe',
308
+ email: 'john@example.com',
309
+ age: 30,
310
+ newsletter: true,
311
+ country: 'us'
312
+ });
313
+
314
+ // Get form values with type parsing
315
+ const values = Form.values('UserForm', {
316
+ parseNumbers: true, // Parse number inputs as numbers
317
+ parseBooleans: true // Parse single checkboxes as booleans
318
+ });
319
+ // { username: 'john_doe', email: '...', age: 30, newsletter: true, country: 'us' }
131
320
 
132
- if (Platform.electron ()) {
133
- console.log ('You are running this on a Electron!');
134
- } else if (Platform.cordova ()) {
135
- console.log ('You are running this on a Cordova!');
321
+ // Reset form
322
+ Form.reset('UserForm');
323
+
324
+ // Validation
325
+ if (Form.isValid('UserForm')) {
326
+ // Submit form
136
327
  }
328
+
329
+ // Show validation messages
330
+ Form.reportValidity('UserForm');
331
+ ```
332
+
333
+ ---
334
+
335
+ ### Platform
336
+
337
+ Platform and feature detection.
338
+
339
+ ```javascript
340
+ import { Platform } from '@aegis-framework/artemis';
341
+
342
+ // Device type
343
+ Platform.desktop(); // true if desktop
344
+ Platform.desktop('macOS'); // true if macOS
345
+ Platform.desktop('Windows'); // true if Windows
346
+ Platform.desktop('Linux'); // true if Linux
347
+
348
+ Platform.mobile(); // true if any mobile
349
+ Platform.mobile('iOS'); // true if iPhone/iPod
350
+ Platform.mobile('iPadOS'); // true if iPad
351
+ Platform.mobile('Android'); // true if Android
352
+
353
+ // Display
354
+ Platform.orientation; // 'portrait' | 'landscape'
355
+ Platform.portrait; // true if portrait
356
+ Platform.landscape; // true if landscape
357
+ Platform.retina; // true if high DPI display
358
+
359
+ // Input
360
+ Platform.touch; // true if touch supported
361
+ Platform.canHover; // true if hover supported
362
+ Platform.coarsePointer; // true if touch is primary
363
+ Platform.finePointer; // true if mouse is primary
364
+
365
+ // User preferences
366
+ Platform.darkMode; // true if dark mode preferred
367
+ Platform.reducedMotion; // true if reduced motion preferred
368
+
369
+ // Runtime environment
370
+ Platform.electron; // true if Electron
371
+ Platform.cordova; // true if Cordova/PhoneGap
372
+ Platform.standalone; // true if installed PWA
373
+
374
+ // Features
375
+ Platform.serviceWorkers; // true if service workers supported
137
376
  ```
138
377
 
378
+ ---
379
+
139
380
  ### Text
140
- The text library provides simple utility methods to perform text transformations or other text related functions.
381
+
382
+ Text transformation utilities.
141
383
 
142
384
  ```javascript
143
- console.log (Text.capitalize ('is this text capitalized?'));
144
- // Logs: Is This Text Capitalized?
385
+ import { Text } from '@aegis-framework/artemis';
386
+
387
+ // Capitalize words
388
+ Text.capitalize('hello world'); // 'Hello World'
389
+ Text.capitalize('API docs', { preserveCase: true }); // 'API Docs'
390
+
391
+ // URL-friendly slug
392
+ Text.friendly('Hello World!'); // 'hello-world'
393
+ Text.friendly('Café Münich'); // 'cafe-munich'
145
394
 
146
- console.log (Text.suffix ('Hello', 'Hello how are you?'));
147
- // Logs: how are you?
395
+ // Truncate with ellipsis
396
+ Text.truncate('Long text here', 10); // 'Long te...'
397
+ Text.truncate('Long text', 10, '…'); // 'Long text'
148
398
 
149
- console.log (Text.prefix ('how are you?', 'Hello how are you?'));
150
- // Logs: Hello
399
+ // Extract parts
400
+ Text.prefix('@', 'user@example.com'); // 'user'
401
+ Text.suffix('@', 'user@example.com'); // 'example.com'
402
+
403
+ // Check for blank
404
+ Text.isBlank(''); // true
405
+ Text.isBlank(' '); // true
406
+ Text.isBlank(null); // true
407
+ Text.isBlank('text'); // false
408
+
409
+ // Get selected text
410
+ const selected = Text.selection();
151
411
  ```
152
412
 
413
+ ---
414
+
415
+ ### FileSystem
416
+
417
+ File operations and utilities.
418
+
419
+ ```javascript
420
+ import { FileSystem } from '@aegis-framework/artemis';
421
+
422
+ // Read local file
423
+ const text = await FileSystem.read(file, 'text');
424
+ const base64 = await FileSystem.read(file, 'base64');
425
+ const buffer = await FileSystem.read(file, 'buffer');
426
+ const binary = await FileSystem.read(file, 'binary');
427
+
428
+ // Read remote file
429
+ const content = await FileSystem.readRemote('https://example.com/file.txt', 'text');
430
+
431
+ // Create and download file
432
+ const file = FileSystem.create('data.json', JSON.stringify(data), 'application/json');
433
+ FileSystem.download(file);
434
+ FileSystem.download(blob, 'custom-name.txt');
435
+
436
+ // File type checks
437
+ FileSystem.isImage('photo.jpg'); // true
438
+ FileSystem.isVideo('movie.mp4'); // true
439
+ FileSystem.isAudio('song.mp3'); // true
440
+ FileSystem.extension('file.txt'); // 'txt'
441
+
442
+ // Human-readable size
443
+ FileSystem.humanSize(1536); // '1.5 KB'
444
+ FileSystem.humanSize(1048576); // '1 MB'
445
+ ```
446
+
447
+ ---
448
+
153
449
  ### Util
154
- The util library provides diverse methods that could be useful for some applications
450
+
451
+ General utilities.
155
452
 
156
453
  ```javascript
157
- console.log (Util.uuid ());
158
- // Logs: Some UUID such as 116a7d96-8c6c-46ee-a9e1-3c7183e691b5
454
+ import { Util } from '@aegis-framework/artemis';
455
+
456
+ // Generate UUID v4
457
+ const id = Util.uuid(); // 'f47ac10b-58cc-4372-a567-0e02b2c3d479'
458
+
459
+ // Ensure async execution
460
+ await Util.callAsync(someFunction, context, arg1, arg2);
461
+
462
+ // Debounce (delay until quiet period)
463
+ const debouncedSearch = Util.debounce((query) => {
464
+ fetch(`/search?q=${query}`);
465
+ }, 300);
466
+
467
+ input.addEventListener('input', (e) => debouncedSearch(e.target.value));
468
+
469
+ // Throttle (limit call frequency)
470
+ const throttledScroll = Util.throttle(() => {
471
+ console.log('Scroll position:', window.scrollY);
472
+ }, 100);
473
+
474
+ window.addEventListener('scroll', throttledScroll);
475
+ ```
476
+
477
+ ---
478
+
479
+ ### Debug
159
480
 
160
- function test () {
161
- console.log ('A simple Function');
481
+ Conditional console logging with debug levels.
482
+
483
+ ```javascript
484
+ import { Debug, DebugLevel } from '@aegis-framework/artemis';
485
+
486
+ // Set debug level
487
+ Debug.setLevel(DebugLevel.DEBUG); // Show all logs
488
+ Debug.setLevel(DebugLevel.ERROR); // Only errors
489
+ Debug.setLevel(DebugLevel.NONE); // Silent
490
+
491
+ // Levels: NONE < ERROR < WARNING < INFO < DEBUG < ALL
492
+
493
+ // Logging (respects debug level)
494
+ Debug.log('General log'); // DEBUG+
495
+ Debug.debug('Debug info'); // DEBUG+
496
+ Debug.info('Information'); // INFO+
497
+ Debug.warning('Warning!'); // WARNING+
498
+ Debug.warn('Also warning'); // WARNING+
499
+ Debug.error('Error!'); // ERROR+
500
+
501
+ // Assertions
502
+ Debug.assert(value > 0, 'Value must be positive');
503
+
504
+ // Grouping
505
+ Debug.group('Network requests');
506
+ Debug.log('Request 1');
507
+ Debug.log('Request 2');
508
+ Debug.groupEnd();
509
+
510
+ Debug.groupCollapsed('Collapsed group');
511
+ Debug.log('Hidden by default');
512
+ Debug.groupEnd();
513
+
514
+ // Tables
515
+ Debug.table([{ name: 'Alice', age: 25 }, { name: 'Bob', age: 30 }]);
516
+
517
+ // Timing
518
+ Debug.time('Operation');
519
+ // ... do work ...
520
+ Debug.timeLog('Operation', 'still running...');
521
+ // ... more work ...
522
+ Debug.timeEnd('Operation'); // Logs: Operation: 123.45ms
523
+
524
+ // Counting
525
+ Debug.count('myFunction called'); // myFunction called: 1
526
+ Debug.count('myFunction called'); // myFunction called: 2
527
+ Debug.countReset('myFunction called');
528
+
529
+ // Object inspection
530
+ Debug.dir(complexObject);
531
+ Debug.dirxml(htmlElement);
532
+
533
+ // Clear console
534
+ Debug.clear();
535
+
536
+ // Check level
537
+ if (Debug.isEnabled(DebugLevel.DEBUG)) {
538
+ // Expensive debug operation
162
539
  }
540
+ ```
163
541
 
164
- Util.callAsync (test).then (() => {
165
- console.log ('Test was executed and a promise was inserted so test behaves like a function using promises');
166
- });
542
+ ---
543
+
544
+ ### Preload
545
+
546
+ Asset preloading utilities.
547
+
548
+ ```javascript
549
+ import { Preload } from '@aegis-framework/artemis';
550
+
551
+ // Preload single image
552
+ const img = await Preload.image('/assets/hero.jpg');
553
+ document.body.appendChild(img);
554
+
555
+ // Preload multiple images
556
+ const images = await Preload.images([
557
+ '/assets/1.jpg',
558
+ '/assets/2.jpg',
559
+ '/assets/3.jpg'
560
+ ]);
561
+
562
+ // Preload files with priority hint
563
+ await Preload.file('/data/config.json', 'high');
564
+ await Preload.files(['/a.js', '/b.js'], 'low');
565
+
566
+ // Preload specific asset types
567
+ await Preload.stylesheet('/styles/main.css');
568
+ await Preload.script('/js/vendor.js');
569
+ await Preload.font('/fonts/custom.woff2');
570
+
571
+ // Cache API integration
572
+ const isCached = await Preload.isCached('my-cache', '/assets/image.jpg');
573
+ await Preload.addToCache('my-cache', '/assets/image.jpg');
574
+ await Preload.addAllToCache('my-cache', ['/a.js', '/b.js', '/c.css']);
575
+ ```
576
+
577
+ ---
578
+
579
+ ## TypeScript Support
580
+
581
+ Artemis is written in TypeScript and includes full type definitions.
582
+
583
+ ```typescript
584
+ import {
585
+ $_,
586
+ DOM,
587
+ Space,
588
+ SpaceAdapter,
589
+ Request,
590
+ Platform,
591
+ Text,
592
+ FileSystem,
593
+ Form,
594
+ Util,
595
+ Debug,
596
+ DebugLevel,
597
+ Preload
598
+ } from '@aegis-framework/artemis';
599
+
600
+ import type {
601
+ SpaceConfiguration,
602
+ DesktopPlatform,
603
+ MobilePlatform,
604
+ Orientation,
605
+ FileReadType,
606
+ CapitalizeOptions
607
+ } from '@aegis-framework/artemis';
608
+
609
+ const config: SpaceConfiguration = {
610
+ name: 'MyApp',
611
+ version: '1.0.0'
612
+ };
613
+
614
+ const storage = new Space(SpaceAdapter.LocalStorage, config);
615
+ ```
616
+
617
+ ## License
167
618
 
168
- ```
619
+ MIT License - See [LICENSE](LICENSE) for details.