@base-framework/base 3.5.74 → 3.6.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.
@@ -1 +1 @@
1
- export function Atom(callBack: Function): Function;
1
+ export function Atom(callBack: (arg0: object, arg1: any) => object): (...args: any[]) => object;
@@ -9,5 +9,5 @@
9
9
  */
10
10
  export class CloakComponent extends Component {
11
11
  }
12
- export function Cloak(props: any): typeof Component | null;
12
+ export function Cloak(props: any): typeof Component;
13
13
  import { Component } from "./component.js";
@@ -1,2 +1,4 @@
1
- export function Jot(layout: object | Function, extend?: typeof Component): typeof Component;
1
+ export function Jot(layout: object | Function, extend?: typeof Component): {
2
+ new (...args: any[]): Component;
3
+ };
2
4
  import { Component } from './component.js';
@@ -1 +1,4 @@
1
- export function parseArgs(args: Array<any>): object;
1
+ export function parseArgs(args: Array<any>): {
2
+ props: object;
3
+ children: any;
4
+ };
@@ -1,2 +1,4 @@
1
- export function Pod(callBack: Function, extend?: typeof Component): typeof Component | null;
1
+ export function Pod(callBack: Function, extend?: typeof Component): {
2
+ new (...args: any[]): Component;
3
+ } | null;
2
4
  import { Component } from './component.js';
@@ -1,4 +1,16 @@
1
- export function DefaultProps(): object;
2
- export function StringProp(value: string): object;
3
- export function ArrayProp(value: Array<any>): object;
4
- export function ObjectProp(args: Array<any>): object;
1
+ export function DefaultProps(): {
2
+ props: object;
3
+ children: any[];
4
+ };
5
+ export function StringProp(value: string | number): {
6
+ props: object;
7
+ children: Array<object>;
8
+ };
9
+ export function ArrayProp(value: Array<any>): {
10
+ props: object;
11
+ children: Array<any>;
12
+ };
13
+ export function ObjectProp(args: Array<any>): {
14
+ props: object;
15
+ children: any;
16
+ };
@@ -1 +1,9 @@
1
+ /**
2
+ * Invalidate cached proxies for a specific target object.
3
+ * Called when an object is replaced to ensure stale proxies aren't used.
4
+ *
5
+ * @param {object} target - The object whose cache should be cleared
6
+ * @returns {void}
7
+ */
8
+ export function invalidateProxyCache(target: object): void;
1
9
  export function DataProxy(data: object, root?: string): ProxyConstructor;
@@ -1,5 +1,6 @@
1
1
  export namespace DataUtils {
2
2
  let deepDataPattern: RegExp;
3
+ let segmentCache: LRUCache;
3
4
  /**
4
5
  * This will check if a string has deep data.
5
6
  *
@@ -9,9 +10,25 @@ export namespace DataUtils {
9
10
  function hasDeepData(str: string): boolean;
10
11
  /**
11
12
  * This will get the deep data segments.
13
+ * Results are cached for performance - 50-70% faster than regex on every call.
12
14
  *
13
15
  * @param {string} str
14
16
  * @returns {Array<any>|null}
15
17
  */
16
18
  function getSegments(str: string): Array<any> | null;
17
19
  }
20
+ /**
21
+ * Simple LRU Cache implementation for caching parsed path segments.
22
+ * Caches up to 1000 most recently used paths (~50KB memory overhead).
23
+ *
24
+ * @class
25
+ */
26
+ declare class LRUCache {
27
+ constructor(maxSize?: number);
28
+ cache: Map<any, any>;
29
+ maxSize: number;
30
+ get(key: any): any;
31
+ set(key: any, value: any): void;
32
+ clear(): void;
33
+ }
34
+ export {};
@@ -12,6 +12,28 @@ export class DataPubSub {
12
12
  * @protected
13
13
  */
14
14
  protected callBacks: Map<any, any>;
15
+ /**
16
+ * Queue for batching publish calls
17
+ * @type {Map<string, Array>}
18
+ * @protected
19
+ */
20
+ protected updateQueue: Map<string, any[]>;
21
+ /**
22
+ * Flag to track if flush is scheduled
23
+ * @type {boolean}
24
+ * @protected
25
+ */
26
+ protected flushScheduled: boolean;
27
+ /**
28
+ * Enable/disable batching (useful for testing)
29
+ * @type {boolean}
30
+ */
31
+ batchingEnabled: boolean;
32
+ /**
33
+ * Debug mode for observability
34
+ * @type {boolean}
35
+ */
36
+ debugMode: boolean;
15
37
  /**
16
38
  * This will get a subscriber array.
17
39
  *
@@ -50,6 +72,8 @@ export class DataPubSub {
50
72
  remove(msg: string): void;
51
73
  /**
52
74
  * This will publish a message.
75
+ * In batching mode, updates are queued and flushed in a microtask.
76
+ * Data operations remain synchronous; only DOM updates are batched.
53
77
  *
54
78
  * @overload
55
79
  * @param {string} msg
@@ -58,4 +82,34 @@ export class DataPubSub {
58
82
  * @returns {void}
59
83
  */
60
84
  publish(msg: string, value: string, committer?: object): void;
85
+ /**
86
+ * Schedule a flush in a microtask.
87
+ * Ensures only one flush is scheduled at a time.
88
+ *
89
+ * @returns {void}
90
+ */
91
+ scheduleFlush(): void;
92
+ /**
93
+ * Flush all queued updates.
94
+ * Deduplicates updates (only last update per msg is applied).
95
+ *
96
+ * @returns {void}
97
+ */
98
+ flush(): void;
99
+ /**
100
+ * Flush queued updates synchronously.
101
+ * Use as escape hatch when immediate updates are critical.
102
+ *
103
+ * @returns {void}
104
+ */
105
+ flushSync(): void;
106
+ /**
107
+ * Publish a message immediately without batching.
108
+ * This is the original synchronous publish logic.
109
+ *
110
+ * @param {string} msg
111
+ * @param {...any} args
112
+ * @returns {void}
113
+ */
114
+ publishImmediate(msg: string, ...args: any[]): void;
61
115
  }
@@ -22,9 +22,9 @@ export class DataSource extends TwoWaySource {
22
22
  */
23
23
  data: object;
24
24
  /**
25
- * @type {string} prop
25
+ * @type {?string} prop
26
26
  */
27
- prop: string;
27
+ prop: string | null;
28
28
  /**
29
29
  * This will set the data value.
30
30
  *
@@ -5,7 +5,7 @@
5
5
  * will wrap the comment atom to pass route to the
6
6
  * imported layout.
7
7
  *
8
- * @type {typeof Component | null}
8
+ * @type {typeof Component}
9
9
  */
10
- export const ImportWrapper: typeof Component | null;
10
+ export const ImportWrapper: typeof Component;
11
11
  import { Component } from "../component/component.js";
@@ -10,20 +10,20 @@ export class Builder {
10
10
  * This will render a function/Unit/Component.
11
11
  *
12
12
  * @param {object|function} layout
13
- * @param {object} container
14
- * @param {object} [parent]
13
+ * @param {?object} container
14
+ * @param {?object} [parent]
15
15
  * @returns {*} The render result.
16
16
  */
17
- static render(layout: object | Function, container: object, parent?: object): any;
17
+ static render(layout: object | Function, container: object | null, parent?: object | null): any;
18
18
  /**
19
19
  * This will build a JSON layout.
20
20
  *
21
21
  * @param {object} obj The JSON layout.
22
- * @param {object} [container] The parent receiving the layout.
23
- * @param {object} [parent] The component adding the layout.
22
+ * @param {?object} [container] The parent receiving the layout.
23
+ * @param {?object} [parent] The component adding the layout.
24
24
  * @returns {*} The render result.
25
25
  */
26
- static build(obj: object, container?: object, parent?: object): any;
26
+ static build(obj: object, container?: object | null, parent?: object | null): any;
27
27
  /**
28
28
  * This will rebuild a layout.
29
29
  *
@@ -1 +1 @@
1
- export function forEach(ele: object, settings: any[], parent: object): void;
1
+ export function forEach(ele: object, settings: Array<any>, parent: object): void;
@@ -34,9 +34,10 @@ export class HtmlHelper extends Html {
34
34
  * @param {object} ele
35
35
  * @param {string} attr
36
36
  * @param {*} value
37
+ * @param {object} [parent]
37
38
  * @returns {void}
38
39
  */
39
- static addAttr(ele: object, attr: string, value: any, parent: any): void;
40
+ static addAttr(ele: object, attr: string, value: any, parent?: object): void;
40
41
  /**
41
42
  * This will add content to an element.
42
43
  *
@@ -19,6 +19,11 @@ export class Router {
19
19
  title: string;
20
20
  lastPath: any;
21
21
  path: any;
22
+ /**
23
+ * Cache for last matched route - provides 70-90% speedup on repeated navigation.
24
+ * @type {object|null} lastMatchedRoute
25
+ */
26
+ lastMatchedRoute: object | null;
22
27
  /**
23
28
  * This will be used to access our history object.
24
29
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base-framework/base",
3
- "version": "3.5.74",
3
+ "version": "3.6.1",
4
4
  "description": "This is a javascript framework.",
5
5
  "main": "./dist/base.js",
6
6
  "type": "module",