@aegis-framework/artemis 0.5.1 → 0.5.3

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/README.md CHANGED
@@ -68,13 +68,28 @@ $_ready(() => {
68
68
  $_('button').off('click'); // Remove all click handlers
69
69
  $_('button').off(); // Remove all handlers
70
70
 
71
+ // Delegated handler removal
72
+ $_('ul').off('click', 'li'); // Remove all delegated 'li' handlers
73
+ $_('ul').off('click', 'li', handler); // Remove specific delegated handler
74
+
71
75
  // Create new elements
72
76
  const div = $_create('div', { class: 'container', id: 'main' });
73
77
 
74
78
  // Traversal
75
79
  $_('.item').parent().addClass('has-item');
80
+ $_('.item').parents(); // All ancestors
76
81
  $_('.item').siblings().removeClass('active');
82
+ $_('.item').children();
77
83
  $_('.item').next().addClass('following');
84
+ $_('.item').prev().addClass('previous');
85
+ $_('.item').closest('.wrapper');
86
+ $_('.item').find('.child');
87
+
88
+ // Visibility
89
+ $_('#box').hide();
90
+ $_('#box').show(); // Default: display 'block'
91
+ $_('#box').show('flex'); // Custom display value
92
+ $_('#box').isVisible(); // true if any element in collection is visible
78
93
 
79
94
  // Animations
80
95
  $_('#box').fadeOut(400, () => console.log('Hidden'));
@@ -83,46 +98,83 @@ $_ready(() => {
83
98
  [{ transform: 'scale(1)' }, { transform: 'scale(1.2)' }],
84
99
  { duration: 300, fill: 'forwards' }
85
100
  );
101
+
102
+ // Dimensions and position
103
+ const width = $_('#box').width();
104
+ const height = $_('#box').height();
105
+ const pos = $_('#box').offset(); // { top, left } relative to document
106
+
107
+ // Scroll
108
+ $_('#section').scrollIntoView({ behavior: 'smooth' });
86
109
  });
87
110
  ```
88
111
 
89
- #### Key Methods
112
+ #### Methods
90
113
 
91
114
  | Method | Description |
92
115
  |--------|-------------|
116
+ | `hide()` | Set `display: none` |
117
+ | `show(display?)` | Set display (default: `'block'`) |
93
118
  | `addClass(name)` | Add a class |
94
- | `removeClass(name?)` | Remove class(es) |
119
+ | `removeClass(name?)` | Remove class, or all classes if no arg |
95
120
  | `toggleClass(names)` | Toggle space-separated classes |
96
121
  | `hasClass(name)` | Check if all elements have class |
97
122
  | `text(value?)` | Get/set text content |
98
123
  | `html(value?)` | Get/set HTML content |
99
124
  | `value(value?)` | Get/set form element value |
100
125
  | `attribute(name, value?)` | Get/set attribute |
126
+ | `removeAttribute(name)` | Remove an attribute |
127
+ | `hasAttribute(name)` | Check if all elements have attribute |
101
128
  | `data(name, value?)` | Get/set data attributes |
102
- | `style(prop, value?)` | Get/set inline styles |
129
+ | `removeData(name)` | Remove a data attribute |
130
+ | `style(prop, value?)` | Get/set inline styles (also accepts object) |
131
+ | `property(name, value?)` | Get/set DOM properties |
103
132
  | `on(event, callback)` | Add event listener |
104
133
  | `on(event, selector, callback)` | Add delegated event listener |
105
134
  | `off(event?, selectorOrCallback?, callback?)` | Remove event listener(s) |
106
- | `trigger(event, detail?)` | Dispatch custom event |
135
+ | `trigger(event, detail?)` | Dispatch event (CustomEvent if detail provided) |
136
+ | `click(callback)` | Shortcut for `on('click', callback)` |
137
+ | `keyup(callback)` | Shortcut for `on('keyup', callback)` |
138
+ | `keydown(callback)` | Shortcut for `on('keydown', callback)` |
139
+ | `submit(callback)` | Shortcut for `on('submit', callback)` |
140
+ | `change(callback)` | Shortcut for `on('change', callback)` |
141
+ | `scroll(callback)` | Shortcut for `on('scroll', callback)` |
142
+ | `input(callback)` | Shortcut for `on('input', callback)` |
107
143
  | `find(selector)` | Find descendants |
108
144
  | `closest(selector)` | Find closest ancestor |
145
+ | `filter(selector)` | Filter collection by selector |
146
+ | `matches(selector)` | Check if all elements match selector |
109
147
  | `parent()` | Get parent elements |
110
148
  | `parents()` | Get all ancestors |
111
149
  | `children()` | Get child elements |
112
150
  | `siblings()` | Get sibling elements |
113
151
  | `next()` | Get next sibling |
114
152
  | `prev()` | Get previous sibling |
115
- | `first()` | Get first element |
116
- | `last()` | Get last element |
117
- | `eq(index)` | Get element at index |
118
- | `append(content)` | Append content |
119
- | `prepend(content)` | Prepend content |
120
- | `remove()` | Remove elements |
121
- | `empty()` | Clear children |
122
- | `clone(deep?)` | Clone elements |
123
- | `fadeIn(duration, callback?)` | Fade in animation |
124
- | `fadeOut(duration, callback?)` | Fade out animation |
153
+ | `first()` | Get first element as new DOM instance |
154
+ | `last()` | Get last element as new DOM instance |
155
+ | `eq(index)` | Get element at index (negative counts from end) |
156
+ | `get(index)` | Get raw HTMLElement at index |
157
+ | `each(callback)` | Iterate with `(element, index)` callback |
158
+ | `exists()` | Check if collection is non-empty |
159
+ | `append(content)` | Append HTML string or Element |
160
+ | `prepend(content)` | Prepend HTML string or Element |
161
+ | `after(content)` | Insert HTML after each element |
162
+ | `before(content)` | Insert HTML before each element |
163
+ | `remove()` | Remove elements from DOM |
164
+ | `empty()` | Remove all children |
165
+ | `clone(deep?)` | Clone elements (default: deep) |
166
+ | `replaceWith(content)` | Replace elements with HTML string or Element |
167
+ | `reset()` | Reset form elements |
168
+ | `focus()` | Focus the first element |
169
+ | `blur()` | Blur the first element |
170
+ | `isVisible()` | Check if any element is visible |
171
+ | `offset()` | Get `{ top, left }` relative to document |
172
+ | `width()` | Get width of first element |
173
+ | `height()` | Get height of first element |
174
+ | `fadeIn(duration?, callback?)` | Fade in (default: 400ms) |
175
+ | `fadeOut(duration?, callback?)` | Fade out (default: 400ms) |
125
176
  | `animate(keyframes, options)` | Web Animations API |
177
+ | `scrollIntoView(options?)` | Scroll first element into view |
126
178
 
127
179
  ---
128
180
 
@@ -152,13 +204,16 @@ await storage.clear();
152
204
  const allData = await storage.getAll();
153
205
  const keys = await storage.keys();
154
206
 
207
+ // Get key by index (LocalStorage/SessionStorage only)
208
+ const firstKey = await storage.key(0);
209
+
155
210
  // Iterate
156
211
  await storage.each((key, value) => {
157
212
  console.log(key, value);
158
213
  });
159
214
 
160
- // Check existence
161
- await storage.contains('user'); // Resolves if exists, rejects if not
215
+ // Check existence (resolves if exists, rejects if not)
216
+ await storage.contains('user');
162
217
 
163
218
  // Callbacks
164
219
  storage.onCreate((key, value) => console.log('Created:', key));
@@ -171,6 +226,15 @@ storage.addTransformation({
171
226
  set: (key, value) => ({ ...value, updatedAt: Date.now() }),
172
227
  get: (key, value) => value
173
228
  });
229
+
230
+ storage.removeTransformation('timestamps');
231
+
232
+ // Read/update configuration
233
+ const config = storage.configuration();
234
+ storage.configuration({ name: 'NewName' });
235
+
236
+ // Rename the space (LocalStorage/SessionStorage only)
237
+ await storage.rename('NewName');
174
238
  ```
175
239
 
176
240
  #### Adapters
@@ -180,12 +244,12 @@ storage.addTransformation({
180
244
  new Space(SpaceAdapter.LocalStorage, { name: 'App', version: '1.0.0' });
181
245
  ```
182
246
 
183
- **SessionStorage** - Session-only storage
247
+ **SessionStorage** - Session-only storage (no version upgrades)
184
248
  ```javascript
185
- new Space(SpaceAdapter.SessionStorage, { name: 'App', version: '1.0.0' });
249
+ new Space(SpaceAdapter.SessionStorage, { name: 'App' });
186
250
  ```
187
251
 
188
- **IndexedDB** - Large-scale structured storage
252
+ **IndexedDB** - Large-scale structured storage (requires name, version, and store)
189
253
  ```javascript
190
254
  new Space(SpaceAdapter.IndexedDB, {
191
255
  name: 'App',
@@ -225,6 +289,24 @@ await storage.upgrade('1.0.0', '2.0.0', async (adapter) => {
225
289
  await storage.open(); // Upgrades run automatically
226
290
  ```
227
291
 
292
+ #### Error Handling
293
+
294
+ ```javascript
295
+ import {
296
+ LocalStorageKeyNotFoundError,
297
+ IndexedDBKeyNotFoundError,
298
+ RemoteStorageKeyNotFoundError
299
+ } from '@aegis-framework/artemis';
300
+
301
+ try {
302
+ await storage.get('missing-key');
303
+ } catch (error) {
304
+ if (error instanceof LocalStorageKeyNotFoundError) {
305
+ console.log('Key not found in LocalStorage');
306
+ }
307
+ }
308
+ ```
309
+
228
310
  ---
229
311
 
230
312
  ### Request
@@ -251,7 +333,10 @@ await Request.put(url, data);
251
333
  await Request.patch(url, data);
252
334
  await Request.delete(url);
253
335
 
254
- // HEAD request (check if resource exists)
336
+ // HEAD request
337
+ const headResponse = await Request.head(url);
338
+
339
+ // Check if resource exists (HEAD + check status)
255
340
  const exists = await Request.exists('https://api.example.com/users/1');
256
341
 
257
342
  // With timeout
@@ -279,20 +364,43 @@ try {
279
364
  } catch (error) {
280
365
  if (error instanceof RequestError) {
281
366
  console.log('HTTP Error:', error.status, error.statusText);
367
+ console.log('Response:', error.response);
282
368
  } else if (error instanceof RequestTimeoutError) {
283
369
  console.log('Request timed out');
284
370
  }
285
371
  }
286
372
 
287
373
  // Serialize data to query string
288
- const query = Request.serialize({ name: 'John', tags: ['a', 'b'] });
374
+ Request.serialize({ name: 'John', tags: ['a', 'b'] });
375
+ // 'name=John&tags[]=a&tags[]=b'
376
+
377
+ Request.serialize({ filter: { status: 'active' } });
378
+ // 'filter[status]=active'
289
379
  ```
290
380
 
381
+ #### Methods
382
+
383
+ | Method | Description |
384
+ |--------|-------------|
385
+ | `get(url, data?, options?)` | GET request (data appended as query params) |
386
+ | `post(url, data, options?)` | POST request |
387
+ | `put(url, data, options?)` | PUT request |
388
+ | `patch(url, data, options?)` | PATCH request |
389
+ | `delete(url, data?, options?)` | DELETE request (data as query params) |
390
+ | `head(url, data?, options?)` | HEAD request (data as query params) |
391
+ | `json<T>(url, data?, options?)` | GET and parse JSON response |
392
+ | `postJson<T>(url, data, options?)` | POST with JSON body, parse JSON response |
393
+ | `blob(url, data?, options?)` | GET and return as Blob |
394
+ | `text(url, data?, options?)` | GET and return as text |
395
+ | `arrayBuffer(url, data?, options?)` | GET and return as ArrayBuffer |
396
+ | `exists(url, options?)` | Check if URL returns 2xx (HEAD request) |
397
+ | `serialize(data, prefix?)` | Serialize object to query string |
398
+
291
399
  ---
292
400
 
293
401
  ### Form
294
402
 
295
- Form filling and value retrieval utilities.
403
+ Form filling and value retrieval utilities. Forms are identified by their `data-form` attribute.
296
404
 
297
405
  ```html
298
406
  <form data-form="UserForm">
@@ -321,8 +429,8 @@ Form.fill('UserForm', {
321
429
 
322
430
  // Get form values with type parsing
323
431
  const values = Form.values('UserForm', {
324
- parseNumbers: true, // Parse number inputs as numbers
325
- parseBooleans: true // Parse single checkboxes as booleans
432
+ parseNumbers: true, // Parse number inputs as numbers (default: true)
433
+ parseBooleans: true // Parse single checkboxes as booleans (default: true)
326
434
  });
327
435
  // { username: 'john_doe', email: '...', age: 30, newsletter: true, country: 'us' }
328
436
 
@@ -342,45 +450,52 @@ Form.reportValidity('UserForm');
342
450
 
343
451
  ### Platform
344
452
 
345
- Platform and feature detection.
453
+ Platform and feature detection using `matchMedia` and `NavigatorUAData` where available.
346
454
 
347
455
  ```javascript
348
456
  import { Platform } from '@aegis-framework/artemis';
349
457
 
350
- // Device type
351
- Platform.desktop(); // true if desktop
352
- Platform.desktop('macOS'); // true if macOS
353
- Platform.desktop('Windows'); // true if Windows
354
- Platform.desktop('Linux'); // true if Linux
355
-
356
- Platform.mobile(); // true if any mobile
357
- Platform.mobile('iOS'); // true if iPhone/iPod
358
- Platform.mobile('iPadOS'); // true if iPad
359
- Platform.mobile('Android'); // true if Android
458
+ // Desktop detection
459
+ Platform.desktop(); // true if any desktop
460
+ Platform.desktop('macOS'); // true if macOS
461
+ Platform.desktop('Windows'); // true if Windows
462
+ Platform.desktop('Linux'); // true if Linux (excludes Android)
463
+ Platform.desktop('ChromeOS'); // true if ChromeOS
464
+ Platform.desktop('FreeBSD'); // true if FreeBSD
465
+
466
+ // Mobile detection
467
+ Platform.mobile(); // true if any mobile
468
+ Platform.mobile('iOS'); // true if iPhone/iPod
469
+ Platform.mobile('iPadOS'); // true if iPad (detects modern iPads reporting as macOS)
470
+ Platform.mobile('Android'); // true if Android
471
+ Platform.mobile('WindowsMobile'); // true if Windows Phone
472
+ Platform.mobile('BlackBerry'); // true if BlackBerry
360
473
 
361
474
  // Display
362
475
  Platform.orientation; // 'portrait' | 'landscape'
363
476
  Platform.portrait; // true if portrait
364
477
  Platform.landscape; // true if landscape
365
- Platform.retina; // true if high DPI display
478
+ Platform.retina; // true if high DPI display (devicePixelRatio >= 2)
366
479
 
367
- // Input
480
+ // Input capabilities
368
481
  Platform.touch; // true if touch supported
369
482
  Platform.canHover; // true if hover supported
370
- Platform.coarsePointer; // true if touch is primary
371
- Platform.finePointer; // true if mouse is primary
483
+ Platform.coarsePointer; // true if touch is primary input
484
+ Platform.finePointer; // true if mouse/trackpad is primary input
372
485
 
373
486
  // User preferences
374
487
  Platform.darkMode; // true if dark mode preferred
375
488
  Platform.reducedMotion; // true if reduced motion preferred
376
489
 
377
490
  // Runtime environment
491
+ Platform.standalone; // true if installed PWA
378
492
  Platform.electron; // true if Electron
493
+ Platform.electrobun; // true if Electrobun
494
+ Platform.desktopApp; // true if Electron or Electrobun
379
495
  Platform.cordova; // true if Cordova/PhoneGap
380
- Platform.standalone; // true if installed PWA
381
496
 
382
- // Features
383
- Platform.serviceWorkers; // true if service workers supported
497
+ // Feature support
498
+ Platform.serviceWorkers; // true if service workers available (requires secure context)
384
499
  ```
385
500
 
386
501
  ---
@@ -393,7 +508,7 @@ Text transformation utilities.
393
508
  import { Text } from '@aegis-framework/artemis';
394
509
 
395
510
  // Capitalize words
396
- Text.capitalize('hello world'); // 'Hello World'
511
+ Text.capitalize('hello world'); // 'Hello World'
397
512
  Text.capitalize('API docs', { preserveCase: true }); // 'API Docs'
398
513
 
399
514
  // URL-friendly slug
@@ -402,9 +517,10 @@ Text.friendly('Café Münich'); // 'cafe-munich'
402
517
 
403
518
  // Truncate with ellipsis
404
519
  Text.truncate('Long text here', 10); // 'Long te...'
405
- Text.truncate('Long text', 10, '…'); // 'Long text'
520
+ Text.truncate('Long text', 10, '…'); // 'Long text' (under limit, returned as-is)
521
+ Text.truncate('Hello', 2, '...'); // '..' (maxLength < ellipsis, truncates ellipsis)
406
522
 
407
- // Extract parts
523
+ // Extract parts of a string
408
524
  Text.prefix('@', 'user@example.com'); // 'user'
409
525
  Text.suffix('@', 'user@example.com'); // 'example.com'
410
526
 
@@ -414,7 +530,7 @@ Text.isBlank(' '); // true
414
530
  Text.isBlank(null); // true
415
531
  Text.isBlank('text'); // false
416
532
 
417
- // Get selected text
533
+ // Get selected text in the document
418
534
  const selected = Text.selection();
419
535
  ```
420
536
 
@@ -427,27 +543,32 @@ File operations and utilities.
427
543
  ```javascript
428
544
  import { FileSystem } from '@aegis-framework/artemis';
429
545
 
430
- // Read local file
546
+ // Read local file (from file input, drag and drop, etc.)
431
547
  const text = await FileSystem.read(file, 'text');
432
- const base64 = await FileSystem.read(file, 'base64');
433
- const buffer = await FileSystem.read(file, 'buffer');
434
- const binary = await FileSystem.read(file, 'binary');
548
+ const base64 = await FileSystem.read(file, 'base64'); // Returns data URL
549
+ const buffer = await FileSystem.read(file, 'buffer'); // Returns ArrayBuffer
550
+ const binary = await FileSystem.read(file, 'binary'); // Returns binary string
435
551
 
436
552
  // Read remote file
437
553
  const content = await FileSystem.readRemote('https://example.com/file.txt', 'text');
438
554
 
439
- // Create and download file
440
- const file = FileSystem.create('data.json', JSON.stringify(data), 'application/json');
441
- FileSystem.download(file);
555
+ // Create and download files
556
+ const newFile = FileSystem.create('data.json', JSON.stringify(data), 'application/json');
557
+ FileSystem.download(newFile);
442
558
  FileSystem.download(blob, 'custom-name.txt');
443
559
 
444
560
  // File type checks
445
- FileSystem.isImage('photo.jpg'); // true
446
- FileSystem.isVideo('movie.mp4'); // true
447
- FileSystem.isAudio('song.mp3'); // true
448
- FileSystem.extension('file.txt'); // 'txt'
561
+ FileSystem.isImage('photo.jpg'); // true (jpg, jpeg, png, gif, svg, webp, avif, bmp, ico, tiff, heic)
562
+ FileSystem.isVideo('movie.mp4'); // true (mp4, webm, ogg, mov, avi, mkv, m4v)
563
+ FileSystem.isAudio('song.mp3'); // true (mp3, wav, ogg, flac, aac, m4a, wma)
564
+
565
+ // File extension
566
+ FileSystem.extension('file.txt'); // 'txt'
567
+ FileSystem.extension('.gitignore'); // '' (hidden files return empty by default)
568
+ FileSystem.extension('.gitignore', true); // 'gitignore' (allowHiddenFiles)
569
+ FileSystem.extension('archive.tar.gz'); // 'gz'
449
570
 
450
- // Human-readable size
571
+ // Human-readable file size
451
572
  FileSystem.humanSize(1536); // '1.5 KB'
452
573
  FileSystem.humanSize(1048576); // '1 MB'
453
574
  ```
@@ -474,7 +595,7 @@ const debouncedSearch = Util.debounce((query) => {
474
595
 
475
596
  input.addEventListener('input', (e) => debouncedSearch(e.target.value));
476
597
 
477
- // Throttle (limit call frequency)
598
+ // Throttle (limit call frequency, leading edge only)
478
599
  const throttledScroll = Util.throttle(() => {
479
600
  console.log('Scroll position:', window.scrollY);
480
601
  }, 100);
@@ -486,7 +607,7 @@ window.addEventListener('scroll', throttledScroll);
486
607
 
487
608
  ### Debug
488
609
 
489
- Conditional console logging with debug levels.
610
+ Conditional console logging with debug levels. All console methods are gated behind a configurable level so debug output can be silenced in production.
490
611
 
491
612
  ```javascript
492
613
  import { Debug, DebugLevel } from '@aegis-framework/artemis';
@@ -496,20 +617,28 @@ Debug.setLevel(DebugLevel.DEBUG); // Show all logs
496
617
  Debug.setLevel(DebugLevel.ERROR); // Only errors
497
618
  Debug.setLevel(DebugLevel.NONE); // Silent
498
619
 
499
- // Levels: NONE < ERROR < WARNING < INFO < DEBUG < ALL
620
+ // Levels: NONE (0) < ERROR (1) < WARNING (2) < INFO (3) < DEBUG (4) < ALL (5)
621
+
622
+ // Alternative getter/setter
623
+ Debug.level(DebugLevel.INFO); // Set level, returns current
624
+ const current = Debug.level(); // Get current level
625
+ const level = Debug.currentLevel; // Getter for current level
500
626
 
501
627
  // Logging (respects debug level)
502
628
  Debug.log('General log'); // DEBUG+
503
629
  Debug.debug('Debug info'); // DEBUG+
504
630
  Debug.info('Information'); // INFO+
505
631
  Debug.warning('Warning!'); // WARNING+
506
- Debug.warn('Also warning'); // WARNING+
632
+ Debug.warn('Also warning'); // WARNING+ (alias)
507
633
  Debug.error('Error!'); // ERROR+
508
634
 
509
- // Assertions
635
+ // Assertions (ERROR+)
510
636
  Debug.assert(value > 0, 'Value must be positive');
511
637
 
512
- // Grouping
638
+ // Stack trace (DEBUG+)
639
+ Debug.trace('Trace point');
640
+
641
+ // Grouping (DEBUG+)
513
642
  Debug.group('Network requests');
514
643
  Debug.log('Request 1');
515
644
  Debug.log('Request 2');
@@ -519,62 +648,81 @@ Debug.groupCollapsed('Collapsed group');
519
648
  Debug.log('Hidden by default');
520
649
  Debug.groupEnd();
521
650
 
522
- // Tables
651
+ // Tables (DEBUG+)
523
652
  Debug.table([{ name: 'Alice', age: 25 }, { name: 'Bob', age: 30 }]);
524
653
 
525
- // Timing
654
+ // Timing (DEBUG+)
526
655
  Debug.time('Operation');
527
656
  // ... do work ...
528
657
  Debug.timeLog('Operation', 'still running...');
529
658
  // ... more work ...
530
659
  Debug.timeEnd('Operation'); // Logs: Operation: 123.45ms
531
660
 
532
- // Counting
661
+ // Counting (DEBUG+)
533
662
  Debug.count('myFunction called'); // myFunction called: 1
534
663
  Debug.count('myFunction called'); // myFunction called: 2
535
664
  Debug.countReset('myFunction called');
536
665
 
537
- // Object inspection
666
+ // Object inspection (DEBUG+)
538
667
  Debug.dir(complexObject);
539
668
  Debug.dirxml(htmlElement);
540
669
 
541
- // Clear console
670
+ // Clear console (DEBUG+)
542
671
  Debug.clear();
543
672
 
544
- // Check level
673
+ // Check level before expensive operations
545
674
  if (Debug.isEnabled(DebugLevel.DEBUG)) {
546
- // Expensive debug operation
675
+ Debug.log(JSON.stringify(largeObject));
547
676
  }
677
+
678
+ // Format strings (no level check, pure utility)
679
+ const msg = Debug.format('User %s has %d items: %j', 'Alice', 3, ['a', 'b']);
680
+ // 'User Alice has 3 items: ["a","b"]'
681
+ // Supports: %s (string), %d/%i (integer), %o/%O (JSON), %j (JSON), %c (ignored), %% (literal %)
548
682
  ```
549
683
 
550
684
  ---
551
685
 
552
686
  ### Preload
553
687
 
554
- Asset preloading utilities.
688
+ Asset preloading utilities for images, audio, fonts, stylesheets, scripts, and generic files.
555
689
 
556
690
  ```javascript
557
691
  import { Preload } from '@aegis-framework/artemis';
558
692
 
559
- // Preload single image
693
+ // Preload and decode a single image (ready to render without delay)
560
694
  const img = await Preload.image('/assets/hero.jpg');
561
695
  document.body.appendChild(img);
562
696
 
563
- // Preload multiple images
697
+ // Preload multiple images in parallel
564
698
  const images = await Preload.images([
565
699
  '/assets/1.jpg',
566
700
  '/assets/2.jpg',
567
701
  '/assets/3.jpg'
568
702
  ]);
569
703
 
570
- // Preload files with priority hint
704
+ // Preload and decode audio into an AudioBuffer
705
+ const audioCtx = new AudioContext();
706
+ const buffer = await Preload.audio('/sounds/click.mp3', audioCtx);
707
+
708
+ // Without providing a context (a temporary one is created and closed automatically)
709
+ const buffer2 = await Preload.audio('/sounds/alert.mp3');
710
+
711
+ // Preload multiple audio files (shares a single AudioContext for efficiency)
712
+ const buffers = await Preload.audios(
713
+ ['/sounds/a.mp3', '/sounds/b.mp3'],
714
+ audioCtx
715
+ );
716
+
717
+ // Preload generic files with fetch priority hint
571
718
  await Preload.file('/data/config.json', 'high');
572
719
  await Preload.files(['/a.js', '/b.js'], 'low');
573
720
 
574
- // Preload specific asset types
721
+ // Preload specific asset types (preloads only, does not apply/execute)
575
722
  await Preload.stylesheet('/styles/main.css');
576
723
  await Preload.script('/js/vendor.js');
577
- await Preload.font('/fonts/custom.woff2');
724
+ await Preload.font('/fonts/custom.woff2'); // crossOrigin: true by default
725
+ await Preload.font('/fonts/local.woff2', false); // No crossOrigin
578
726
 
579
727
  // Cache API integration
580
728
  const isCached = await Preload.isCached('my-cache', '/assets/image.jpg');
@@ -590,36 +738,57 @@ Artemis is written in TypeScript and includes full type definitions.
590
738
 
591
739
  ```typescript
592
740
  import {
593
- $_,
741
+ // DOM
742
+ $_, $_ready, $_create,
594
743
  DOM,
595
- Space,
596
- SpaceAdapter,
597
- Request,
598
- Platform,
599
- Text,
600
- FileSystem,
601
- Form,
602
- Util,
603
- Debug,
604
- DebugLevel,
744
+
745
+ // Storage
746
+ Space, SpaceAdapter,
747
+ LocalStorage, SessionStorage, IndexedDB, RemoteStorage,
748
+
749
+ // Storage errors
750
+ LocalStorageKeyNotFoundError,
751
+ IndexedDBKeyNotFoundError,
752
+ RemoteStorageKeyNotFoundError,
753
+
754
+ // HTTP
755
+ Request, RequestError, RequestTimeoutError,
756
+
757
+ // Utilities
758
+ Platform, Text, FileSystem, Form, Util,
759
+ Debug, DebugLevel,
605
760
  Preload
606
761
  } from '@aegis-framework/artemis';
607
762
 
763
+ // Type imports
608
764
  import type {
609
- SpaceConfiguration,
610
- DesktopPlatform,
611
- MobilePlatform,
612
- Orientation,
613
- FileReadType,
614
- CapitalizeOptions
615
- } from '@aegis-framework/artemis';
765
+ // DOM types
766
+ DOMSelector, DOMOffset, StyleProperties,
767
+ EventCallback, ElementCallback,
616
768
 
617
- const config: SpaceConfiguration = {
618
- name: 'MyApp',
619
- version: '1.0.0'
620
- };
769
+ // Storage types
770
+ SpaceConfiguration, StorageValue, KeyValueResult,
771
+ UpgradeCallback, SpaceAdapterType, SpaceAdapterConstructor,
772
+ SpaceCallback, Transformation, TransformationFunction,
621
773
 
622
- const storage = new Space(SpaceAdapter.LocalStorage, config);
774
+ // Request types
775
+ RequestData, RequestOptions,
776
+
777
+ // Platform types
778
+ DesktopPlatform, MobilePlatform, Orientation,
779
+
780
+ // Form types
781
+ FormValue, FormValues, FormParseOptions,
782
+
783
+ // FileSystem types
784
+ FileReadType, FileReadResult,
785
+
786
+ // Text types
787
+ CapitalizeOptions,
788
+
789
+ // Util types
790
+ Callable
791
+ } from '@aegis-framework/artemis';
623
792
  ```
624
793
 
625
794
  ## License