ziko 0.50.2 → 0.51.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 (44) hide show
  1. package/dist/ziko.js +1515 -1398
  2. package/dist/ziko.mjs +1515 -1398
  3. package/package.json +1 -1
  4. package/src/__helpers__/checkers/index.js +1 -0
  5. package/src/data/converter/csv.js +1 -1
  6. package/src/events/binders/coordinates-based-event.js +25 -0
  7. package/src/events/binders/index.js +11 -6
  8. package/src/events/customizers/normalise-coordinates.js +0 -0
  9. package/src/events/details-setter/index.js +3 -1
  10. package/src/events/details-setter/mouse.js +35 -0
  11. package/src/events/details-setter/pointer.js +33 -31
  12. package/src/events/details-setter/touch.js +37 -0
  13. package/src/math/complex/index.js +2 -3
  14. package/src/math/discret/Conversion/index.js +1 -1
  15. package/src/math/discret/Logic/index.js +1 -1
  16. package/src/math/functions/index.js +8 -9
  17. package/src/math/matrix/helpers/det.js +36 -0
  18. package/src/math/matrix/helpers/index.js +3 -0
  19. package/src/math/matrix/helpers/inverse.js +52 -0
  20. package/src/math/matrix/helpers/stack.js +24 -0
  21. package/src/math/matrix/index.js +1 -1
  22. package/src/math/matrix/matrix.js +601 -0
  23. package/src/math/random/index.js +88 -92
  24. package/src/math/signal/functions.js +23 -25
  25. package/src/math/utils/arithmetic.js +15 -17
  26. package/src/math/utils/mapfun.js +3 -7
  27. package/src/router/file-based-router/index.js +46 -0
  28. package/src/router/index.js +2 -0
  29. package/src/router/utils/dynamic-routes-parser.js +76 -0
  30. package/src/router/utils/get-root.js +16 -0
  31. package/src/router/utils/index.js +5 -0
  32. package/src/router/utils/normalize-path.js +17 -0
  33. package/src/router/utils/routes-grouper.js +22 -0
  34. package/src/router/utils/routes-matcher.js +60 -0
  35. package/types/index.d.ts +1 -0
  36. package/types/router/file-based-router/index.d.ts +20 -0
  37. package/types/router/index.d.ts +2 -0
  38. package/types/router/utils/dynamic-routes-parser.d.ts +14 -0
  39. package/types/router/utils/get-root.d.ts +11 -0
  40. package/types/router/utils/index.d.ts +5 -0
  41. package/types/router/utils/normalize-path.d.ts +15 -0
  42. package/types/router/utils/routes-grouper.d.ts +29 -0
  43. package/types/router/utils/routes-matcher.d.ts +1 -0
  44. package/src/math/matrix/Matrix.js +0 -675
package/types/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export type * from './math'
2
2
  export type * from './time'
3
+ export type * from './router'
3
4
  export type * from './hooks'
4
5
  export type * from './data'
@@ -0,0 +1,20 @@
1
+ // createSPAFileBasedRouter.d.ts
2
+
3
+ import { UIElement } from '../../../src/ui/constructors/UIElement.js'
4
+
5
+ /**
6
+ * Creates a SPA (Single Page Application) file-based router.
7
+ * Automatically loads and mounts the component corresponding to the current path.
8
+ * Supports dynamic routes and parameter extraction.
9
+ *
10
+ * @param pages - An object mapping route paths to async module functions that return a component.
11
+ * Example: { "/user/[id]": () => import("./pages/user/[id].js") }
12
+ * @param target - Optional DOM element to mount the component. Defaults to `document.body`.
13
+ */
14
+ export function createSPAFileBasedRouter(
15
+ pages: Record<
16
+ string,
17
+ () => Promise<{ default: (param? : Record<string, string>) => UIElement }>
18
+ >,
19
+ target?: HTMLElement | UIElement
20
+ ): Promise<void>;
@@ -0,0 +1,2 @@
1
+ export type * from './file-based-router'
2
+ export type * from './utils'
@@ -0,0 +1,14 @@
1
+ // dynamic_routes_parser.d.ts
2
+
3
+ /**
4
+ * Parses a route according to a dynamic mask and returns extracted parameters.
5
+ *
6
+ * @param mask - The dynamic route mask (e.g., "/user/[id]+", "/blog/[...slug]").
7
+ * @param route - The actual route to parse (e.g., "/user/42", "/blog/2025/oct/post").
8
+ * @returns An object mapping parameter names to their corresponding values.
9
+ * Returns an empty object if the route does not match the mask.
10
+ */
11
+ export declare function dynamic_routes_parser(
12
+ mask: string,
13
+ route: string
14
+ ): Record<string, string>;
@@ -0,0 +1,11 @@
1
+ // get_root.d.ts
2
+
3
+ /**
4
+ * Finds the common root path among an array of paths.
5
+ * Dynamic segments (e.g., `[id]`) are considered as matching any segment.
6
+ *
7
+ * @param paths - An array of route paths (e.g., ["/user/42", "/user/99"]).
8
+ * @returns The common root path as a string (e.g., "/user/").
9
+ * Returns an empty string if no common root exists.
10
+ */
11
+ export declare function get_root(paths: string[]): string;
@@ -0,0 +1,5 @@
1
+ export type * from './dynamic-routes-parser.d.ts'
2
+ export type * from './routes-matcher.d.ts'
3
+ export type * from './get-root.d.ts'
4
+ export type * from './routes-grouper.d.ts'
5
+ export type * from './normalize-path.d.ts'
@@ -0,0 +1,15 @@
1
+ // normalize_path.d.ts
2
+
3
+ /**
4
+ * Normalizes a file path into a route path.
5
+ *
6
+ * @param inputPath - The file path to normalize (e.g., "./src/pages/user/[id].ts").
7
+ * @param root - The root directory to consider as the base (default: "./src/pages").
8
+ * @param extensions - Array of valid file extensions (default: ["js", "ts"]).
9
+ * @returns A normalized route path (e.g., "/user/[id]") or an empty string if it cannot be normalized.
10
+ */
11
+ export declare function normalize_path(
12
+ inputPath: string,
13
+ root?: string,
14
+ extensions?: string[]
15
+ ): string;
@@ -0,0 +1,29 @@
1
+ // routes_utils.d.ts
2
+
3
+ /**
4
+ * Checks if a route path is dynamic.
5
+ * Dynamic segments include:
6
+ * - Parameters like "[id]"
7
+ * - Catch-all segments like "[...slug]"
8
+ * - Optional segments like "[id]+"
9
+ *
10
+ * @param path - The route path to check.
11
+ * @returns `true` if the path is dynamic, otherwise `false`.
12
+ */
13
+ export function is_dynamic(path: string): boolean;
14
+
15
+ /**
16
+ * Groups routes into static and dynamic categories.
17
+ * Throws an error if an optional parameter appears anywhere but the end of the path.
18
+ *
19
+ * @param routeMap - An object mapping route paths to their handlers/values.
20
+ * @returns An object with two properties:
21
+ * - `static`: Routes with no dynamic segments.
22
+ * - `dynamic`: Routes with dynamic segments.
23
+ */
24
+ export function routes_grouper<T>(
25
+ routeMap: Record<string, T>
26
+ ): {
27
+ static: Record<string, T>;
28
+ dynamic: Record<string, T>;
29
+ };
@@ -0,0 +1 @@
1
+ export declare function routes_matcher(mask: string, route: string): boolean;