@aegis-framework/artemis 0.4.1 → 0.5.1

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 (37) hide show
  1. package/README.md +555 -96
  2. package/dist/artemis.browser.js +2 -2
  3. package/dist/artemis.browser.js.map +19 -18
  4. package/dist/artemis.js +2 -2
  5. package/dist/artemis.js.map +18 -17
  6. package/dist/types/DOM.d.ts +190 -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/dist/types/browser.d.ts.map +1 -1
  37. package/package.json +10 -11
@@ -3,45 +3,56 @@
3
3
  * Text
4
4
  * ==============================
5
5
  */
6
- /**
7
- * Provides utility functions for texts
8
- */
6
+ export interface CapitalizeOptions {
7
+ preserveCase?: boolean;
8
+ }
9
9
  export declare class Text {
10
10
  /**
11
- * Capitalizes every word in a string
11
+ * Capitalize the first letter of each word.
12
12
  *
13
- * @param text - Text string to capitalize
14
- * @returns Capitalized string
13
+ * @param text - Text to capitalize
14
+ * @param options - Capitalization options
15
+ * @returns Capitalized text
15
16
  */
16
- static capitalize(text: string): string;
17
+ static capitalize(text: string, options?: CapitalizeOptions): string;
17
18
  /**
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
19
+ * Get the currently selected text in the document.
23
20
  */
24
- static suffix(key: string, text: string): string;
21
+ static selection(): string;
25
22
  /**
26
- * Get the currently selected text
23
+ * Get the text after a given key/substring.
27
24
  *
28
- * @returns Text selection
25
+ * @param key - The substring to search for
26
+ * @param text - The text to search in
27
+ * @returns Text after the key, or empty string if not found
29
28
  */
30
- static selection(): string;
29
+ static suffix(key: string, text: string): string;
31
30
  /**
32
- * Gets the prefix of a string given a key
31
+ * Get the text before a given key/substring.
33
32
  *
34
- * @param key - Key part of the string
35
- * @param text - Full string to extract the prefix from
36
- * @returns Prefix
33
+ * @param key - The substring to search for
34
+ * @param text - The text to search in
35
+ * @returns Text before the key, or empty string if not found
37
36
  */
38
37
  static prefix(key: string, text: string): string;
39
38
  /**
40
- * Transforms a given text into a friendly URL string replacing all special characters
39
+ * Convert text to a URL-friendly slug.
41
40
  *
42
- * @param text - The text to build the url from
43
- * @returns Friendly URL
41
+ * @param text - Text to convert
42
+ * @returns URL-friendly slug
44
43
  */
45
44
  static friendly(text: string): string;
45
+ /**
46
+ * Truncate text to a maximum length with ellipsis.
47
+ *
48
+ * @param text - Text to truncate
49
+ * @param maxLength - Maximum length (including ellipsis)
50
+ * @param ellipsis - Ellipsis string to append (default: '...')
51
+ */
52
+ static truncate(text: string, maxLength: number, ellipsis?: string): string;
53
+ /**
54
+ * Check if a string is empty or contains only whitespace.
55
+ */
56
+ static isBlank(text: string | null | undefined): boolean;
46
57
  }
47
58
  //# sourceMappingURL=Text.d.ts.map
@@ -1 +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"}
1
+ {"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../src/Text.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,WAAW,iBAAiB;IAChC,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,qBAAa,IAAI;IAEf;;;;;;OAMG;IACH,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,iBAAsB,GAAG,MAAM;IAUxE;;OAEG;IACH,MAAM,CAAC,SAAS,IAAI,MAAM;IAI1B;;;;;;OAMG;IACH,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM;IAUhD;;;;;;OAMG;IACH,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM;IAUhD;;;;;OAKG;IACH,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAYrC;;;;;;OAMG;IACH,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAc,GAAG,MAAM;IAQlF;;OAEG;IACH,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO;CAGzD"}
@@ -3,29 +3,33 @@
3
3
  * Util
4
4
  * ==============================
5
5
  */
6
- /**
7
- * Callable function type
8
- */
9
6
  export type Callable<T = unknown> = (...args: unknown[]) => T | Promise<T>;
10
- /**
11
- * Provides diverse utility functions
12
- */
13
7
  export declare class Util {
14
8
  /**
15
- * Calls any function using promises to keep a standard behavior between
16
- * async and sync functions.
9
+ * Calls a function and ensures it returns a Promise.
17
10
  *
18
11
  * @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
12
+ * @param context - The `this` context
13
+ * @param args - Arguments to pass
22
14
  */
23
15
  static callAsync<T = unknown>(callable: Callable<T>, context: unknown, ...args: unknown[]): Promise<T>;
24
16
  /**
25
- * Creates a UUID. These UUIDs should not be trusted for uniqueness
26
- *
27
- * @returns Generated UUID
17
+ * Generates a UUID v4.
28
18
  */
29
19
  static uuid(): string;
20
+ /**
21
+ * Debounce a function call.
22
+ *
23
+ * @param fn - Function to debounce
24
+ * @param delay - Delay in milliseconds
25
+ */
26
+ static debounce<T extends (...args: unknown[]) => unknown>(fn: T, delay: number): (...args: Parameters<T>) => void;
27
+ /**
28
+ * Throttle a function call.
29
+ *
30
+ * @param fn - Function to throttle
31
+ * @param limit - Minimum time between calls in milliseconds
32
+ */
33
+ static throttle<T extends (...args: unknown[]) => unknown>(fn: T, limit: number): (...args: Parameters<T>) => void;
30
34
  }
31
35
  //# sourceMappingURL=Util.d.ts.map
@@ -1 +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"}
1
+ {"version":3,"file":"Util.d.ts","sourceRoot":"","sources":["../../src/Util.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,MAAM,QAAQ,CAAC,CAAC,GAAG,OAAO,IAAI,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;AAE3E,qBAAa,IAAI;IACf;;;;;;OAMG;WACU,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;IAQ5G;;OAEG;IACH,MAAM,CAAC,IAAI,IAAI,MAAM;IAoBrB;;;;;OAKG;IACH,MAAM,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,IAAI;IAclH;;;;;OAKG;IACH,MAAM,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,IAAI;CAanH"}
@@ -1 +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"}
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;IACb,UAAU,MAAM;QACd,OAAO,EAAE,OAAO,OAAO,CAAC;KACzB;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aegis-framework/artemis",
3
- "version": "0.4.1",
3
+ "version": "0.5.1",
4
4
  "description": "Aegis Framework Javascript Library",
5
5
  "type": "module",
6
6
  "main": "./dist/artemis.js",
@@ -37,25 +37,25 @@
37
37
  "library"
38
38
  ],
39
39
  "scripts": {
40
- "build": "yarn clean && yarn lint && yarn check && yarn build:module && yarn build:legacy && yarn build:types",
40
+ "build": "bun run clean && bun run lint && bun run check && bun run build:module && bun run build:legacy && bun run build:types",
41
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
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
43
  "build:types": "tsc --emitDeclarationOnly --declarationDir ./dist/types",
44
44
  "check": "tsc --noEmit",
45
45
  "lint": "eslint ./src/**/*.ts",
46
46
  "clean": "rm -rf dist",
47
- "test": "http-server -p 3000 -c-1"
47
+ "test": "bun test/index.html"
48
48
  },
49
49
  "devDependencies": {
50
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",
51
+ "@eslint/js": "^9.39.2",
52
+ "@typescript-eslint/eslint-plugin": "^8.50.0",
53
+ "@typescript-eslint/parser": "^8.50.0",
54
+ "bun": "^1.3.5",
55
+ "eslint": "^9.39.2",
56
56
  "http-server": "^14.1.1",
57
57
  "typescript": "^5.9.3",
58
- "typescript-eslint": "^8.48.1"
58
+ "typescript-eslint": "^8.50.0"
59
59
  },
60
60
  "files": [
61
61
  "dist/",
@@ -63,6 +63,5 @@
63
63
  "README.md",
64
64
  "package.json"
65
65
  ],
66
- "browserslist": "> 0.5%, last 2 versions, not dead",
67
- "packageManager": "yarn@4.12.0"
66
+ "browserslist": "> 0.5%, last 2 versions, not dead"
68
67
  }