cogsbox-state 0.5.476 → 0.5.479
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 +92 -0
- package/dist/CogsState.d.ts +84 -74
- package/dist/CogsState.d.ts.map +1 -1
- package/dist/CogsState.js +920 -844
- package/dist/CogsState.js.map +1 -1
- package/dist/Components.d.ts.map +1 -1
- package/dist/Components.js +110 -108
- package/dist/Components.js.map +1 -1
- package/dist/PluginRunner.d.ts.map +1 -1
- package/dist/PluginRunner.js +0 -1
- package/dist/PluginRunner.js.map +1 -1
- package/dist/index.js +35 -34
- package/dist/plugins.d.ts +93 -294
- package/dist/plugins.d.ts.map +1 -1
- package/dist/plugins.js +191 -60
- package/dist/plugins.js.map +1 -1
- package/dist/store.d.ts +3 -0
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +470 -417
- package/dist/store.js.map +1 -1
- package/dist/utility.d.ts +1 -3
- package/dist/utility.d.ts.map +1 -1
- package/dist/utility.js +63 -73
- package/dist/utility.js.map +1 -1
- package/package.json +3 -3
- package/src/CogsState.tsx +405 -115
- package/src/Components.tsx +3 -1
- package/src/PluginRunner.tsx +3 -3
- package/src/plugins.ts +822 -108
- package/src/store.ts +131 -3
- package/src/utility.ts +1 -33
package/src/Components.tsx
CHANGED
|
@@ -271,6 +271,7 @@ export function FormElementWrapper({
|
|
|
271
271
|
|
|
272
272
|
useEffect(() => {
|
|
273
273
|
const { getShadowMetadata, setShadowMetadata } = getGlobalStore.getState();
|
|
274
|
+
console.log('FormElementWrapper effect running for:', stateKey, path);
|
|
274
275
|
|
|
275
276
|
// Initialize clientActivityState if needed
|
|
276
277
|
const currentMeta = getShadowMetadata(stateKey, path) || {};
|
|
@@ -302,7 +303,7 @@ export function FormElementWrapper({
|
|
|
302
303
|
inputType: formElementRef.current?.type,
|
|
303
304
|
mountedAt: Date.now(),
|
|
304
305
|
});
|
|
305
|
-
|
|
306
|
+
console.log('currentMeta', currentMeta);
|
|
306
307
|
setShadowMetadata(stateKey, path, currentMeta);
|
|
307
308
|
|
|
308
309
|
// Subscribe to path updates
|
|
@@ -551,6 +552,7 @@ export function FormElementWrapper({
|
|
|
551
552
|
</ValidationWrapper>
|
|
552
553
|
);
|
|
553
554
|
}
|
|
555
|
+
|
|
554
556
|
export function useRegisterComponent(
|
|
555
557
|
stateKey: string,
|
|
556
558
|
componentId: string,
|
package/src/PluginRunner.tsx
CHANGED
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
8
|
} from './plugins';
|
|
9
9
|
import type { CogsPlugin } from './plugins';
|
|
10
10
|
import type { StateObject, UpdateTypeDetail } from './CogsState';
|
|
11
|
-
import { ClientActivityState, FormEventType } from './store';
|
|
12
11
|
|
|
13
12
|
const { setHookResult, removeHookResult } = pluginStore.getState();
|
|
14
13
|
|
|
@@ -20,7 +19,7 @@ const PluginInstance = React.memo(
|
|
|
20
19
|
stateHandler,
|
|
21
20
|
}: {
|
|
22
21
|
stateKey: string;
|
|
23
|
-
plugin: CogsPlugin<any, any, any, any, any>;
|
|
22
|
+
plugin: CogsPlugin<any, any, any, any, any, any, any>;
|
|
24
23
|
options: any;
|
|
25
24
|
stateHandler: StateObject<any>;
|
|
26
25
|
}) => {
|
|
@@ -118,7 +117,7 @@ const PluginInstance = React.memo(
|
|
|
118
117
|
options,
|
|
119
118
|
hookData: hookDataRef.current,
|
|
120
119
|
...deconstructed,
|
|
121
|
-
...scopedMetadata,
|
|
120
|
+
...scopedMetadata,
|
|
122
121
|
});
|
|
123
122
|
}
|
|
124
123
|
};
|
|
@@ -177,6 +176,7 @@ export function PluginRunner({ children }: { children: React.ReactNode }) {
|
|
|
177
176
|
// this component will re-render to update the list of PluginInstances.
|
|
178
177
|
useEffect(() => {
|
|
179
178
|
const unsubscribe = pluginStore.subscribe(forceUpdate);
|
|
179
|
+
|
|
180
180
|
return unsubscribe;
|
|
181
181
|
}, []);
|
|
182
182
|
|