@plitzi/sdk-shared 0.31.2 → 0.32.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.
- package/CHANGELOG.md +19 -0
- package/dist/hooks/usePlitziServiceContext.d.ts +1 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +2 -1
- package/dist/state/index.d.ts +1 -0
- package/dist/state/index.mjs +2 -0
- package/dist/state/runtimeStatePersist.d.ts +3 -0
- package/dist/state/runtimeStatePersist.mjs +12 -0
- package/dist/types/StateTypes.d.ts +6 -6
- package/dist/types/StoreTypes.d.ts +5 -1
- package/package.json +14 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @plitzi/sdk-shared
|
|
2
2
|
|
|
3
|
+
## 0.32.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- v0.32.1
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @plitzi/nexus@0.32.1
|
|
10
|
+
|
|
11
|
+
## 0.32.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- v0.32.0
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
- @plitzi/nexus@0.32.0
|
|
21
|
+
|
|
3
22
|
## 0.31.2
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BuilderContextValue } from '../builder';
|
|
2
2
|
import { NetworkContextValue } from '../network';
|
|
3
|
-
import { CollectionContextValue, ComponentContextValue, EventBridgeContextValue, InteractionsContextValue, NavigationContextValue, PluginsContextValue, SegmentsContextValue,
|
|
3
|
+
import { CollectionContextValue, ComponentContextValue, EventBridgeContextValue, InteractionsContextValue, NavigationContextValue, PluginsContextValue, SegmentsContextValue, Theme } from '../types';
|
|
4
4
|
import { Context, ReactNode, RefObject } from 'react';
|
|
5
5
|
export type PlitziServiceContextValue<TEventBridge = any, TInteractions = any> = {
|
|
6
6
|
settings: {
|
|
@@ -23,7 +23,6 @@ export type PlitziServiceContextValue<TEventBridge = any, TInteractions = any> =
|
|
|
23
23
|
NavigationContext: Context<NavigationContextValue>;
|
|
24
24
|
CollectionContext: Context<CollectionContextValue>;
|
|
25
25
|
ComponentContext: Context<ComponentContextValue>;
|
|
26
|
-
StateManagerContext: Context<StateManagerContextValue>;
|
|
27
26
|
EventBridgeContext: Context<EventBridgeContextValue<TEventBridge>>;
|
|
28
27
|
PluginsContext: Context<PluginsContextValue>;
|
|
29
28
|
InteractionsContext: Context<InteractionsContextValue<TInteractions>>;
|
package/dist/index.d.ts
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -34,4 +34,5 @@ import fe, { ThemeContext as pe } from "./theme/ThemeProvider.mjs";
|
|
|
34
34
|
import me from "./server/rsc/RscContext.mjs";
|
|
35
35
|
import he from "./server/hooks/useRscData.mjs";
|
|
36
36
|
import ge from "./server/rsc/RscProvider.mjs";
|
|
37
|
-
|
|
37
|
+
import { runtimeStatePersist as _e } from "./state/runtimeStatePersist.mjs";
|
|
38
|
+
export { e as BuilderContext, ee as BuilderMutations, te as BuilderQueries, ne as BuilderSubscriptions, n as CollectionContext, I as ComponentContext, M as DevToolsContext, X as EMPTY_SCHEMA, G as EMPTY_STYLE_SCHEMA, L as ElementContext, Q as NetworkContext, $ as NetworkInternalContext, _ as ParamsFromURL, N as PlitziConsole, V as PlitziServiceContext, H as PlitziServiceProvider, oe as RTCodec, se as RTEvent, ce as RTEventCloseCode, me as RscContext, ge as RscProvider, Y as SchemaContext, re as SdkMutations, ie as SdkQueries, ae as SegmentsContext, K as StyleBindingsAllowed, U as StyleVariableCategory, pe as ThemeContext, fe as ThemeProvider, Z as VARIABLE_REGEX, q as baseDefaultValue, t as contexts, P as createStoreDevToolsLogger, k as createStripTypenameLink, v as delay, O as disableReactDevTools, y as emptyObject, r as fetchManifest, o as formatDate, s as formatDateUTC, c as formatFromNow, l as formatUTCToLocal, i as generateFacade, b as generateID, x as getDisplayName, u as getDurationMs, le as getInstance, S as getKeyDecoded, C as getPathsFromObeject, h as hasValidToken, w as hexToRGB, J as inheritableAttributesBase, d as isDate, T as isInViewport, ue as isRTEvent, E as isTestMode, f as isValidFormat, D as makeId, F as pConsole, p as parseDate, g as processTwig, _e as runtimeStatePersist, de as setInstance, A as stripTypenameDeep, W as styleConstants, a as syntaxHighlight, m as toUnixSeconds, R as useElement, z as useNetwork, B as usePlitziServiceContext, j as useRegisterSource, he as useRscData };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './runtimeStatePersist';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { persistMiddleware as e } from "@plitzi/nexus";
|
|
2
|
+
//#region src/state/runtimeStatePersist.ts
|
|
3
|
+
var t = (t) => e({
|
|
4
|
+
key: `plitzi_${t}_state`,
|
|
5
|
+
paths: ["runtime.state"],
|
|
6
|
+
storage: ({ schema: e }) => {
|
|
7
|
+
let t = e?.settings;
|
|
8
|
+
return t?.keepState ? t.stateStorage === "sessionStorage" ? "session" : "local" : !1;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
//#endregion
|
|
12
|
+
export { t as runtimeStatePersist };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
export type
|
|
3
|
-
state:
|
|
4
|
-
setState:
|
|
5
|
-
setStateByKey: (key: string, value: unknown
|
|
6
|
-
|
|
1
|
+
export type RuntimeState = Record<string, unknown>;
|
|
2
|
+
export type RuntimeStateInstance = {
|
|
3
|
+
state: RuntimeState;
|
|
4
|
+
setState: (value: RuntimeState | ((prev: RuntimeState) => RuntimeState)) => void;
|
|
5
|
+
setStateByKey: (key: string, value: unknown) => void;
|
|
6
|
+
clearState: () => void;
|
|
7
7
|
};
|
|
@@ -9,6 +9,9 @@ export type RuntimeSourceValues = {
|
|
|
9
9
|
queryParams: Record<string, unknown>;
|
|
10
10
|
};
|
|
11
11
|
auth?: Record<string, unknown>;
|
|
12
|
+
state?: Record<string, unknown>;
|
|
13
|
+
/** @deprecated Use the `state` source (mirrors `runtime.state`). Kept as an alias so existing `page.*` bindings keep
|
|
14
|
+
* working; it still carries the runtime state plus `currentPageId`. */
|
|
12
15
|
page?: Record<string, unknown>;
|
|
13
16
|
};
|
|
14
17
|
export type CommonState = {
|
|
@@ -18,7 +21,8 @@ export type CommonState = {
|
|
|
18
21
|
style: Style;
|
|
19
22
|
segments: Record<string, Segment>;
|
|
20
23
|
runtime?: {
|
|
21
|
-
sources
|
|
24
|
+
sources: RuntimeSourceValues & Record<string, unknown>;
|
|
25
|
+
state?: Record<string, unknown>;
|
|
22
26
|
};
|
|
23
27
|
sources?: Record<string, Source>;
|
|
24
28
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plitzi/sdk-shared",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.32.1",
|
|
4
4
|
"license": "AGPL-3.0",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -869,6 +869,18 @@
|
|
|
869
869
|
"types": "./dist/server/rsc/RscProvider.d.ts",
|
|
870
870
|
"import": "./dist/server/rsc/RscProvider.mjs"
|
|
871
871
|
},
|
|
872
|
+
"./state": {
|
|
873
|
+
"types": "./dist/state/index.d.ts",
|
|
874
|
+
"import": "./dist/state/index.mjs"
|
|
875
|
+
},
|
|
876
|
+
"./state/index": {
|
|
877
|
+
"types": "./dist/state/index.d.ts",
|
|
878
|
+
"import": "./dist/state/index.mjs"
|
|
879
|
+
},
|
|
880
|
+
"./state/runtimeStatePersist": {
|
|
881
|
+
"types": "./dist/state/runtimeStatePersist.d.ts",
|
|
882
|
+
"import": "./dist/state/runtimeStatePersist.mjs"
|
|
883
|
+
},
|
|
872
884
|
"./style": {
|
|
873
885
|
"types": "./dist/style/index.d.ts",
|
|
874
886
|
"import": "./dist/style/index.mjs"
|
|
@@ -999,7 +1011,7 @@
|
|
|
999
1011
|
},
|
|
1000
1012
|
"dependencies": {
|
|
1001
1013
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
1002
|
-
"@plitzi/nexus": "0.
|
|
1014
|
+
"@plitzi/nexus": "0.32.1",
|
|
1003
1015
|
"@plitzi/plitzi-ui": "^1.6.9",
|
|
1004
1016
|
"date-fns": "^4.3.0",
|
|
1005
1017
|
"date-fns-tz": "^3.2.0",
|