@base-framework/base 3.7.76 → 3.7.77

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.
@@ -64,13 +64,9 @@ export class Component extends Unit {
64
64
  /**
65
65
  * This will resume the data during persistence.
66
66
  *
67
- * For components with externally-provided data (temp components
68
- * created by { data: localVar } in layouts), we use the fresh
69
- * data instance from setData() so closure references stay valid.
70
- *
71
- * For regular components, the persisted data is the source of
72
- * truth — it holds accumulated state (list items, filters, etc.)
73
- * that should be preserved until the component fetches updates.
67
+ * Delegates to DataResumeHelper which owns the fresh-vs-persisted
68
+ * reconciliation, retain/refresh-state policy, silent stage writes,
69
+ * and stale-publish queue draining.
74
70
  *
75
71
  * @protected
76
72
  * @param {Data|null} persistedData
@@ -0,0 +1,108 @@
1
+ /** @typedef {import('../data/data.js').Data} Data */
2
+ /**
3
+ * DataResumeHelper
4
+ *
5
+ * Owns the data-merge logic used when a persisted component is
6
+ * resumed (e.g. when the router re-activates a cached route).
7
+ *
8
+ * The component delegates here so its own surface stays focused
9
+ * on lifecycle, leaving all of the
10
+ * - fresh-vs-persisted reconciliation,
11
+ * - retain/refresh-state policy,
12
+ * - silent stage writes, and
13
+ * - batched-publish queue draining
14
+ * in one auditable place.
15
+ *
16
+ * @class
17
+ */
18
+ export class DataResumeHelper {
19
+ /**
20
+ * This will resume the data for a component during persistence.
21
+ *
22
+ * @param {object} component - host component (mutated: component.data is set)
23
+ * @param {Data|null} persistedData
24
+ * @returns {void}
25
+ */
26
+ static resume(component: object, persistedData: Data | null): void;
27
+ /**
28
+ * Refresh the host component's data with fresh prop-derived
29
+ * values from setData(), then refresh context data from parent.
30
+ *
31
+ * @param {object} component
32
+ * @returns {void}
33
+ */
34
+ static refresh(component: object): void;
35
+ /**
36
+ * Push parent-context changes into the persisted context data.
37
+ * Only reference-changed keys are written, via the silent API,
38
+ * to avoid republishing the entire context tree on resume.
39
+ *
40
+ * @param {object} component
41
+ * @returns {void}
42
+ */
43
+ static refreshContext(component: object): void;
44
+ /**
45
+ * Resume path for temp components created by
46
+ * `{ data: localVar }` in layouts: the fresh data
47
+ * instance must win so closures stay valid; only
48
+ * persisted keys missing from fresh (or all keys
49
+ * when retainState is set) are merged in.
50
+ *
51
+ * @protected
52
+ * @param {object} component
53
+ * @param {Data|null} persistedData
54
+ * @returns {void}
55
+ */
56
+ protected static _resumeExternal(component: object, persistedData: Data | null): void;
57
+ /**
58
+ * Diff persisted stage against fresh stage for external
59
+ * data. When retain is true, persisted values win for
60
+ * every key; otherwise only persisted keys absent from
61
+ * fresh are copied (so async-added properties survive).
62
+ *
63
+ * Reference-equal values are skipped to avoid the deep
64
+ * Publisher.publish cascade on unchanged subtrees.
65
+ *
66
+ * @protected
67
+ * @param {object} old
68
+ * @param {object} freshStage
69
+ * @param {boolean} retain
70
+ * @returns {Object<string, *>}
71
+ */
72
+ protected static _buildExternalUpdates(old: object, freshStage: object, retain: boolean): {
73
+ [x: string]: any;
74
+ };
75
+ /**
76
+ * Resume path for regular components: fresh data from
77
+ * setData() (already in component.data via _setupData)
78
+ * is the base; persisted values are merged in silently
79
+ * unless retainState is flagged (then persisted wins
80
+ * outright) or refreshState is flagged (then only keys
81
+ * missing from fresh are copied).
82
+ *
83
+ * @protected
84
+ * @param {object} component
85
+ * @param {Data|null} persistedData
86
+ * @returns {void}
87
+ */
88
+ protected static _resumeOwned(component: object, persistedData: Data | null): void;
89
+ /**
90
+ * Diff persisted stage against the fresh owned-data stage.
91
+ *
92
+ * - refresh=true: fresh values are authoritative; only
93
+ * persisted keys missing from fresh are copied.
94
+ * - refresh=false: persisted non-null values win on changed
95
+ * keys; null/undefined are ignored so fresh defaults stay,
96
+ * allowing the component to re-fetch on resume.
97
+ *
98
+ * @protected
99
+ * @param {object} old
100
+ * @param {object} currentStage
101
+ * @param {boolean} refresh
102
+ * @returns {Object<string, *>}
103
+ */
104
+ protected static _buildOwnedUpdates(old: object, currentStage: object, refresh: boolean): {
105
+ [x: string]: any;
106
+ };
107
+ }
108
+ export type Data = import("../data/data.js").Data;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base-framework/base",
3
- "version": "3.7.76",
3
+ "version": "3.7.77",
4
4
  "description": "This is a javascript framework.",
5
5
  "main": "./dist/base.js",
6
6
  "type": "module",