@plitzi/sdk-shared 0.32.0 → 0.32.2
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 +16 -0
- package/dist/dataSource/getBindingsDetails.d.ts +10 -0
- package/dist/dataSource/getBindingsDetails.mjs +49 -0
- package/dist/dataSource/hooks/useRegisterSource.mjs +1 -1
- package/dist/dataSource/index.d.ts +2 -0
- package/dist/dataSource/index.mjs +3 -1
- package/dist/dataSource/utility/arrayMap.d.ts +6 -0
- package/dist/dataSource/utility/arrayMap.mjs +28 -0
- package/dist/dataSource/utility/capitalize.d.ts +3 -0
- package/dist/dataSource/utility/capitalize.mjs +11 -0
- package/dist/dataSource/utility/dateConverter.d.ts +3 -0
- package/dist/dataSource/utility/dateConverter.mjs +60 -0
- package/dist/dataSource/utility/index.d.ts +7 -0
- package/dist/dataSource/utility/index.mjs +22 -0
- package/dist/dataSource/utility/staticValue.d.ts +3 -0
- package/dist/dataSource/utility/staticValue.mjs +47 -0
- package/dist/dataSource/utility/stringToArray.d.ts +3 -0
- package/dist/dataSource/utility/stringToArray.mjs +20 -0
- package/dist/dataSource/utility/styleSelector.d.ts +3 -0
- package/dist/dataSource/utility/styleSelector.mjs +42 -0
- package/dist/dataSource/utility/twigTemplate.d.ts +3 -0
- package/dist/dataSource/utility/twigTemplate.mjs +26 -0
- package/dist/devTools/utils/PlitziConsole.mjs +30 -17
- package/dist/elements/index.d.ts +1 -5
- package/dist/elements/index.mjs +1 -3
- package/dist/helpers/security.mjs +2 -1
- package/dist/hooks/usePlitziServiceContext.d.ts +1 -1
- package/dist/index.mjs +23 -24
- package/dist/server/index.d.ts +1 -3
- package/dist/server/index.mjs +2 -3
- package/dist/server/rsc/RscProvider.d.ts +1 -1
- package/dist/server/rsc/RscProvider.mjs +22 -22
- package/dist/store/index.d.ts +193 -0
- package/dist/store/index.mjs +5 -0
- package/dist/store/tracing/index.d.ts +8 -0
- package/dist/store/tracing/index.mjs +6 -0
- package/dist/store/tracing/preview.d.ts +3 -0
- package/dist/store/tracing/preview.mjs +38 -0
- package/dist/store/tracing/tracingCollector.d.ts +17 -0
- package/dist/store/tracing/tracingCollector.mjs +85 -0
- package/dist/store/tracing/tracingMiddleware.d.ts +2 -0
- package/dist/store/tracing/tracingMiddleware.mjs +5 -0
- package/dist/store/tracing/tracingStore.d.ts +6 -0
- package/dist/store/tracing/tracingStore.mjs +10 -0
- package/dist/store/tracing/useTracing.d.ts +6 -0
- package/dist/store/tracing/useTracing.mjs +13 -0
- package/dist/theme/ThemeProvider.d.ts +1 -1
- package/dist/types/ServerTypes.d.ts +10 -2
- package/dist/types/StoreTypes.d.ts +39 -0
- package/dist/websockets/RTCodec.mjs +1 -1
- package/package.json +103 -38
- package/setupTests.ts +4 -0
- package/dist/elements/ElementContext.d.ts +0 -19
- package/dist/elements/ElementContext.mjs +0 -6
- package/dist/elements/hooks/useElement.d.ts +0 -3
- package/dist/elements/hooks/useElement.mjs +0 -10
- package/dist/server/hooks/useRscData.d.ts +0 -14
- package/dist/server/hooks/useRscData.mjs +0 -16
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { createStoreHook as e } from "@plitzi/nexus/react";
|
|
2
|
+
//#region src/store/index.ts
|
|
3
|
+
var { useStore: t, useStoreSync: n, useStoreGetter: r, useStoreSetter: i } = e(), { useStore: a, useStoreSync: o, useStoreGetter: s, useStoreSetter: c } = e(), { useStore: l, useStoreSync: u, useStoreGetter: d, useStoreSetter: f } = e();
|
|
4
|
+
//#endregion
|
|
5
|
+
export { l as useBuilderStore, d as useBuilderStoreGetter, f as useBuilderStoreSetter, u as useBuilderStoreSync, t as useCommonStore, r as useCommonStoreGetter, i as useCommonStoreSetter, n as useCommonStoreSync, a as useSdkStore, s as useSdkStoreGetter, c as useSdkStoreSetter, o as useSdkStoreSync };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { default as tracingCollector } from './tracingCollector';
|
|
2
|
+
import { default as tracingStore } from './tracingStore';
|
|
3
|
+
import { default as useTracing } from './useTracing';
|
|
4
|
+
export { MAX_COMMITS, createTracingState } from './tracingStore';
|
|
5
|
+
export { previewValue, diffProps } from './preview';
|
|
6
|
+
export { tracingMiddleware } from './tracingMiddleware';
|
|
7
|
+
export type { UseTracingReturn } from './useTracing';
|
|
8
|
+
export { tracingStore, tracingCollector, useTracing };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { diffProps as e, previewValue as t } from "./preview.mjs";
|
|
2
|
+
import n, { MAX_COMMITS as r, createTracingState as i } from "./tracingStore.mjs";
|
|
3
|
+
import a from "./tracingCollector.mjs";
|
|
4
|
+
import o from "./useTracing.mjs";
|
|
5
|
+
import { tracingMiddleware as s } from "./tracingMiddleware.mjs";
|
|
6
|
+
export { r as MAX_COMMITS, i as createTracingState, e as diffProps, t as previewValue, a as tracingCollector, s as tracingMiddleware, n as tracingStore, o as useTracing };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
//#region src/store/tracing/preview.ts
|
|
2
|
+
var e = (e) => {
|
|
3
|
+
if (e === void 0) return "undefined";
|
|
4
|
+
if (e === null) return "null";
|
|
5
|
+
let t = typeof e;
|
|
6
|
+
if (t === "function") return "ƒ";
|
|
7
|
+
if (t === "string") {
|
|
8
|
+
let t = e;
|
|
9
|
+
return JSON.stringify(t.length > 40 ? `${t.slice(0, 40)}…` : t);
|
|
10
|
+
}
|
|
11
|
+
return t === "symbol" ? e.toString() : t === "number" || t === "boolean" || t === "bigint" ? `${e}` : Array.isArray(e) ? e.length === 0 ? "[]" : `[…${e.length}]` : "$$typeof" in e ? "<ReactElement>" : "{…}";
|
|
12
|
+
}, t = (t) => {
|
|
13
|
+
if (typeof t != "object" || !t) return e(t);
|
|
14
|
+
if ("$$typeof" in t) return "<ReactElement>";
|
|
15
|
+
if (Array.isArray(t)) return t.length === 0 ? "[]" : `[${t.slice(0, 4).map(e).join(", ")}${t.length > 4 ? ", …" : ""}]`;
|
|
16
|
+
let n = t, r = Object.keys(n);
|
|
17
|
+
return r.length === 0 ? "{}" : `{ ${r.slice(0, 4).map((t) => `${t}: ${e(n[t])}`).join(", ")}${r.length > 4 ? ", …" : ""} }`;
|
|
18
|
+
}, n = (e, t) => {
|
|
19
|
+
if (Object.is(e, t)) return !0;
|
|
20
|
+
if (e === null || t === null || typeof e != "object" || typeof t != "object" || Array.isArray(e) !== Array.isArray(t)) return !1;
|
|
21
|
+
let n = Object.keys(e), r = Object.keys(t);
|
|
22
|
+
return n.length === r.length ? n.every((n) => Object.is(e[n], t[n])) : !1;
|
|
23
|
+
}, r = (e, r) => {
|
|
24
|
+
if (!e) return [];
|
|
25
|
+
let i = [], a = /* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(r)]);
|
|
26
|
+
for (let o of a) {
|
|
27
|
+
let a = e[o], s = r[o];
|
|
28
|
+
if (!Object.is(a, s) && (i.push({
|
|
29
|
+
key: o,
|
|
30
|
+
prev: t(a),
|
|
31
|
+
next: t(s),
|
|
32
|
+
ref: n(a, s)
|
|
33
|
+
}), i.length >= 12)) break;
|
|
34
|
+
}
|
|
35
|
+
return i;
|
|
36
|
+
};
|
|
37
|
+
//#endregion
|
|
38
|
+
export { r as diffProps, t as previewValue };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { PropChange } from '../../types';
|
|
2
|
+
import { ProfilerOnRenderCallback } from 'react';
|
|
3
|
+
declare const tracingCollector: {
|
|
4
|
+
onRender: ProfilerOnRenderCallback;
|
|
5
|
+
linkParent: (id: string, parentId: string | undefined) => void;
|
|
6
|
+
recordProps: (id: string, changes: PropChange[]) => void;
|
|
7
|
+
recordStoreChange: (change: {
|
|
8
|
+
path: string | undefined;
|
|
9
|
+
prevValue: unknown;
|
|
10
|
+
nextValue: unknown;
|
|
11
|
+
}) => void;
|
|
12
|
+
setHydrated: () => void;
|
|
13
|
+
start: () => void;
|
|
14
|
+
stop: () => void;
|
|
15
|
+
clear: () => void;
|
|
16
|
+
};
|
|
17
|
+
export default tracingCollector;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { previewValue as e } from "./preview.mjs";
|
|
2
|
+
import t from "./tracingStore.mjs";
|
|
3
|
+
import { createRecorder as n } from "@plitzi/nexus";
|
|
4
|
+
//#region src/store/tracing/tracingCollector.ts
|
|
5
|
+
var r = n({ max: 30 }), i = [], a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), c = !0, l = 0, u = /* @__PURE__ */ new Map(), d = !1, f = !1, p = 0, m = !1, h = !1, g = typeof requestAnimationFrame == "function" ? (e) => {
|
|
6
|
+
requestAnimationFrame(e);
|
|
7
|
+
} : (e) => {
|
|
8
|
+
setTimeout(e, 16);
|
|
9
|
+
}, _ = () => {
|
|
10
|
+
let e = {};
|
|
11
|
+
for (let [t, n] of s) e[t] = {
|
|
12
|
+
parentId: o.get(t),
|
|
13
|
+
baseDuration: n
|
|
14
|
+
};
|
|
15
|
+
return e;
|
|
16
|
+
}, v = () => {
|
|
17
|
+
c && (c = !1, t.setState("tree", _())), t.setState("hydrated", h), t.setState("commits", i);
|
|
18
|
+
}, y = () => {
|
|
19
|
+
h || (h = !0, f && t.setState("hydrated", !0));
|
|
20
|
+
}, b = () => {
|
|
21
|
+
if (m = !1, a.size > 0) {
|
|
22
|
+
let e = [...a.values()].sort((e, t) => e.timestamp - t.timestamp);
|
|
23
|
+
a.clear(), i = [...i, ...e], i.length > 200 && (i = i.slice(i.length - 200));
|
|
24
|
+
}
|
|
25
|
+
f && v();
|
|
26
|
+
}, x = (e, t) => {
|
|
27
|
+
(!o.has(e) || o.get(e) !== t) && (c = !0), o.set(e, t);
|
|
28
|
+
}, S = () => {
|
|
29
|
+
let t = r.entriesSince(l);
|
|
30
|
+
l = r.lastSeq();
|
|
31
|
+
let n = /* @__PURE__ */ new Map();
|
|
32
|
+
for (let e of t) {
|
|
33
|
+
if (e.path === void 0) continue;
|
|
34
|
+
let t = n.get(e.path);
|
|
35
|
+
t ? t.next = e.nextValue : n.set(e.path, {
|
|
36
|
+
prev: e.prevValue,
|
|
37
|
+
next: e.nextValue
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
return [...n.entries()].map(([t, n]) => ({
|
|
41
|
+
path: t,
|
|
42
|
+
preview: `${e(n.prev)} → ${e(n.next)}`
|
|
43
|
+
}));
|
|
44
|
+
}, C = {
|
|
45
|
+
onRender: (e, n, r, i, l, f) => {
|
|
46
|
+
d || (d = !0, t.setState("enabled", !0)), s.has(e) || (c = !0), s.set(e, i);
|
|
47
|
+
let h = u.get(e);
|
|
48
|
+
u.delete(e);
|
|
49
|
+
let _ = {
|
|
50
|
+
id: e,
|
|
51
|
+
parentId: o.get(e),
|
|
52
|
+
phase: n,
|
|
53
|
+
actualDuration: r,
|
|
54
|
+
baseDuration: i,
|
|
55
|
+
changedProps: h
|
|
56
|
+
}, v = a.get(f);
|
|
57
|
+
v ? (v.elements.push(_), v.elementCount += 1, v.duration = Math.max(v.duration, r)) : (p += 1, a.set(f, {
|
|
58
|
+
commitId: p,
|
|
59
|
+
timestamp: f,
|
|
60
|
+
duration: r,
|
|
61
|
+
elementCount: 1,
|
|
62
|
+
elements: [_],
|
|
63
|
+
causes: S()
|
|
64
|
+
})), m || (m = !0, g(b));
|
|
65
|
+
},
|
|
66
|
+
linkParent: x,
|
|
67
|
+
recordProps: (e, t) => {
|
|
68
|
+
u.set(e, t);
|
|
69
|
+
},
|
|
70
|
+
recordStoreChange: (e) => {
|
|
71
|
+
r.record(e);
|
|
72
|
+
},
|
|
73
|
+
setHydrated: y,
|
|
74
|
+
start: () => {
|
|
75
|
+
f = !0, b(), v();
|
|
76
|
+
},
|
|
77
|
+
stop: () => {
|
|
78
|
+
f = !1;
|
|
79
|
+
},
|
|
80
|
+
clear: () => {
|
|
81
|
+
i = [], a.clear(), l = r.lastSeq(), u.clear(), p = 0, c = !0, v();
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
//#endregion
|
|
85
|
+
export { C as default };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { TracingState } from '../../types';
|
|
2
|
+
export declare const MAX_COMMITS = 200;
|
|
3
|
+
export declare const MAX_CAUSES = 30;
|
|
4
|
+
export declare const createTracingState: () => TracingState;
|
|
5
|
+
declare const tracingStore: import('@plitzi/nexus').StoreApi<TracingState>;
|
|
6
|
+
export default tracingStore;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createStore as e } from "@plitzi/nexus";
|
|
2
|
+
//#region src/store/tracing/tracingStore.ts
|
|
3
|
+
var t = 200, n = () => ({
|
|
4
|
+
enabled: !1,
|
|
5
|
+
hydrated: !1,
|
|
6
|
+
commits: [],
|
|
7
|
+
tree: {}
|
|
8
|
+
}), r = e(n(), { id: "tracing" });
|
|
9
|
+
//#endregion
|
|
10
|
+
export { t as MAX_COMMITS, n as createTracingState, r as default };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import e from "./tracingStore.mjs";
|
|
2
|
+
import t from "./tracingCollector.mjs";
|
|
3
|
+
import { useEffect as n, useSyncExternalStore as r } from "react";
|
|
4
|
+
//#region src/store/tracing/useTracing.ts
|
|
5
|
+
var i = () => {
|
|
6
|
+
let i = r(e.subscribe, e.getState, e.getState);
|
|
7
|
+
return n(() => (t.start(), t.stop), []), {
|
|
8
|
+
...i,
|
|
9
|
+
clear: t.clear
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
13
|
+
export { i as default };
|
|
@@ -7,6 +7,6 @@ export type ThemeProviderProps = {
|
|
|
7
7
|
storageType?: 'localStorage' | 'sessionStorage';
|
|
8
8
|
children?: ReactNode;
|
|
9
9
|
};
|
|
10
|
-
declare const ThemeProvider: ({ defaultTheme, storageKey, storageType, children }: ThemeProviderProps) => import("react
|
|
10
|
+
declare const ThemeProvider: ({ defaultTheme, storageKey, storageType, children }: ThemeProviderProps) => import("react").JSX.Element;
|
|
11
11
|
export { ThemeContext };
|
|
12
12
|
export default ThemeProvider;
|
|
@@ -19,6 +19,8 @@ export type SSRRequest = {
|
|
|
19
19
|
protocol: 'http' | 'https';
|
|
20
20
|
headers: SSRHeaders;
|
|
21
21
|
query: Record<string, string>;
|
|
22
|
+
/** Raw request body. Populated only for endpoints that consume it (e.g. the login/logout handlers). */
|
|
23
|
+
body?: string;
|
|
22
24
|
ctx: SSRContext;
|
|
23
25
|
};
|
|
24
26
|
export type SSRResponseHelpers = {
|
|
@@ -30,6 +32,11 @@ export type SSRResponseHelpers = {
|
|
|
30
32
|
write: (chunk: string | Buffer) => void;
|
|
31
33
|
end: () => void;
|
|
32
34
|
};
|
|
35
|
+
export type SSRRenderResult = {
|
|
36
|
+
status?: number;
|
|
37
|
+
redirect?: string;
|
|
38
|
+
headers?: Record<string, string>;
|
|
39
|
+
};
|
|
33
40
|
export type SSRCredential = {
|
|
34
41
|
provider: string;
|
|
35
42
|
data: unknown;
|
|
@@ -74,6 +81,7 @@ export type SSRTemplateProps = {
|
|
|
74
81
|
reactJsx?: string;
|
|
75
82
|
reactDom?: string;
|
|
76
83
|
reactDomClient?: string;
|
|
84
|
+
reactCompilerRuntime?: string;
|
|
77
85
|
/** When true the client-side <script> block is omitted — useful for inspecting raw SSR HTML. */
|
|
78
86
|
ssrOnly?: boolean;
|
|
79
87
|
debugMode?: boolean;
|
|
@@ -116,8 +124,8 @@ export type SSRAdapters = {
|
|
|
116
124
|
getOfflineData: (spaceId: number, environment: string, revision?: number) => Promise<OfflineDataRaw | undefined>;
|
|
117
125
|
getSpaceDeployment: (req: SSRRequest) => Promise<SSRSpaceDeployment>;
|
|
118
126
|
getUser?: (req: SSRRequest) => Promise<SSRUser | undefined>;
|
|
119
|
-
onLogin?: (req: SSRRequest) => Promise<boolean>;
|
|
120
|
-
onLogout?: (req: SSRRequest) => Promise<void>;
|
|
127
|
+
onLogin?: (req: SSRRequest, res: SSRResponseHelpers) => Promise<boolean>;
|
|
128
|
+
onLogout?: (req: SSRRequest, res: SSRResponseHelpers) => Promise<void>;
|
|
121
129
|
/** Called by the RSC endpoint to fetch server-side data for server components.
|
|
122
130
|
* When `ids` is provided the adapter should return data only for those element IDs.
|
|
123
131
|
* Omitting `ids` (initial SSR fetch or full refresh) must return data for all elements. */
|
|
@@ -23,6 +23,7 @@ export type CommonState = {
|
|
|
23
23
|
runtime?: {
|
|
24
24
|
sources: RuntimeSourceValues & Record<string, unknown>;
|
|
25
25
|
state?: Record<string, unknown>;
|
|
26
|
+
elements?: Record<string, unknown>;
|
|
26
27
|
};
|
|
27
28
|
sources?: Record<string, Source>;
|
|
28
29
|
};
|
|
@@ -38,3 +39,41 @@ export type BuilderState = CommonState & {
|
|
|
38
39
|
setSelected: (elementId?: string, iframeDOM?: HTMLIFrameElement | null, force?: boolean) => void;
|
|
39
40
|
};
|
|
40
41
|
export type SdkState = CommonState & {};
|
|
42
|
+
export type RenderPhase = 'mount' | 'update' | 'nested-update';
|
|
43
|
+
export type PropChange = {
|
|
44
|
+
key: string;
|
|
45
|
+
prev: string;
|
|
46
|
+
next: string;
|
|
47
|
+
ref?: boolean;
|
|
48
|
+
};
|
|
49
|
+
export type CommitElementRender = {
|
|
50
|
+
id: string;
|
|
51
|
+
parentId?: string;
|
|
52
|
+
phase: RenderPhase;
|
|
53
|
+
actualDuration: number;
|
|
54
|
+
baseDuration: number;
|
|
55
|
+
changedProps?: PropChange[];
|
|
56
|
+
};
|
|
57
|
+
export type CommitCause = {
|
|
58
|
+
path: string;
|
|
59
|
+
preview?: string;
|
|
60
|
+
};
|
|
61
|
+
export type CommitEntry = {
|
|
62
|
+
commitId: number;
|
|
63
|
+
timestamp: number;
|
|
64
|
+
duration: number;
|
|
65
|
+
elementCount: number;
|
|
66
|
+
elements: CommitElementRender[];
|
|
67
|
+
causes: CommitCause[];
|
|
68
|
+
};
|
|
69
|
+
export type TracingTreeNode = {
|
|
70
|
+
parentId?: string;
|
|
71
|
+
baseDuration: number;
|
|
72
|
+
};
|
|
73
|
+
export type TracingTree = Record<string, TracingTreeNode>;
|
|
74
|
+
export type TracingState = {
|
|
75
|
+
enabled: boolean;
|
|
76
|
+
hydrated: boolean;
|
|
77
|
+
commits: CommitEntry[];
|
|
78
|
+
tree: TracingTree;
|
|
79
|
+
};
|
|
@@ -10,7 +10,7 @@ var e = /* @__PURE__ */ function(e) {
|
|
|
10
10
|
this.encoder = new TextEncoder(), this.decoder = new TextDecoder();
|
|
11
11
|
}
|
|
12
12
|
encode(e, t) {
|
|
13
|
-
let n = t !== void 0, r = n ? JSON.stringify(t) : "", i = n ? this.encoder.encode(r) : new Uint8Array(), a = new ArrayBuffer(5 + i.length), o = new DataView(a);
|
|
13
|
+
let n = t !== void 0, r = n ? JSON.stringify(t) : "", i = n ? this.encoder.encode(r) : /* @__PURE__ */ new Uint8Array(), a = new ArrayBuffer(5 + i.length), o = new DataView(a);
|
|
14
14
|
return o.setUint8(0, e), o.setUint32(1, i.length), i.length > 0 && new Uint8Array(a, 5).set(i), a;
|
|
15
15
|
}
|
|
16
16
|
decode(e) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plitzi/sdk-shared",
|
|
3
|
-
"version": "0.32.
|
|
3
|
+
"version": "0.32.2",
|
|
4
4
|
"license": "AGPL-3.0",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -50,6 +50,10 @@
|
|
|
50
50
|
"types": "./dist/dataSource/index.d.ts",
|
|
51
51
|
"import": "./dist/dataSource/index.mjs"
|
|
52
52
|
},
|
|
53
|
+
"./dataSource/getBindingsDetails": {
|
|
54
|
+
"types": "./dist/dataSource/getBindingsDetails.d.ts",
|
|
55
|
+
"import": "./dist/dataSource/getBindingsDetails.mjs"
|
|
56
|
+
},
|
|
53
57
|
"./dataSource/hooks": {
|
|
54
58
|
"types": "./dist/dataSource/hooks/index.d.ts",
|
|
55
59
|
"import": "./dist/dataSource/hooks/index.mjs"
|
|
@@ -66,6 +70,42 @@
|
|
|
66
70
|
"types": "./dist/dataSource/index.d.ts",
|
|
67
71
|
"import": "./dist/dataSource/index.mjs"
|
|
68
72
|
},
|
|
73
|
+
"./dataSource/utility": {
|
|
74
|
+
"types": "./dist/dataSource/utility/index.d.ts",
|
|
75
|
+
"import": "./dist/dataSource/utility/index.mjs"
|
|
76
|
+
},
|
|
77
|
+
"./dataSource/utility/arrayMap": {
|
|
78
|
+
"types": "./dist/dataSource/utility/arrayMap.d.ts",
|
|
79
|
+
"import": "./dist/dataSource/utility/arrayMap.mjs"
|
|
80
|
+
},
|
|
81
|
+
"./dataSource/utility/capitalize": {
|
|
82
|
+
"types": "./dist/dataSource/utility/capitalize.d.ts",
|
|
83
|
+
"import": "./dist/dataSource/utility/capitalize.mjs"
|
|
84
|
+
},
|
|
85
|
+
"./dataSource/utility/dateConverter": {
|
|
86
|
+
"types": "./dist/dataSource/utility/dateConverter.d.ts",
|
|
87
|
+
"import": "./dist/dataSource/utility/dateConverter.mjs"
|
|
88
|
+
},
|
|
89
|
+
"./dataSource/utility/index": {
|
|
90
|
+
"types": "./dist/dataSource/utility/index.d.ts",
|
|
91
|
+
"import": "./dist/dataSource/utility/index.mjs"
|
|
92
|
+
},
|
|
93
|
+
"./dataSource/utility/staticValue": {
|
|
94
|
+
"types": "./dist/dataSource/utility/staticValue.d.ts",
|
|
95
|
+
"import": "./dist/dataSource/utility/staticValue.mjs"
|
|
96
|
+
},
|
|
97
|
+
"./dataSource/utility/stringToArray": {
|
|
98
|
+
"types": "./dist/dataSource/utility/stringToArray.d.ts",
|
|
99
|
+
"import": "./dist/dataSource/utility/stringToArray.mjs"
|
|
100
|
+
},
|
|
101
|
+
"./dataSource/utility/styleSelector": {
|
|
102
|
+
"types": "./dist/dataSource/utility/styleSelector.d.ts",
|
|
103
|
+
"import": "./dist/dataSource/utility/styleSelector.mjs"
|
|
104
|
+
},
|
|
105
|
+
"./dataSource/utility/twigTemplate": {
|
|
106
|
+
"types": "./dist/dataSource/utility/twigTemplate.d.ts",
|
|
107
|
+
"import": "./dist/dataSource/utility/twigTemplate.mjs"
|
|
108
|
+
},
|
|
69
109
|
"./devTools": {
|
|
70
110
|
"types": "./dist/devTools/index.d.ts",
|
|
71
111
|
"import": "./dist/devTools/index.mjs"
|
|
@@ -90,14 +130,6 @@
|
|
|
90
130
|
"types": "./dist/elements/ComponentContext.d.ts",
|
|
91
131
|
"import": "./dist/elements/ComponentContext.mjs"
|
|
92
132
|
},
|
|
93
|
-
"./elements/ElementContext": {
|
|
94
|
-
"types": "./dist/elements/ElementContext.d.ts",
|
|
95
|
-
"import": "./dist/elements/ElementContext.mjs"
|
|
96
|
-
},
|
|
97
|
-
"./elements/hooks/useElement": {
|
|
98
|
-
"types": "./dist/elements/hooks/useElement.d.ts",
|
|
99
|
-
"import": "./dist/elements/hooks/useElement.mjs"
|
|
100
|
-
},
|
|
101
133
|
"./elements/index": {
|
|
102
134
|
"types": "./dist/elements/index.d.ts",
|
|
103
135
|
"import": "./dist/elements/index.mjs"
|
|
@@ -853,10 +885,6 @@
|
|
|
853
885
|
"types": "./dist/server/index.d.ts",
|
|
854
886
|
"import": "./dist/server/index.mjs"
|
|
855
887
|
},
|
|
856
|
-
"./server/hooks/useRscData": {
|
|
857
|
-
"types": "./dist/server/hooks/useRscData.d.ts",
|
|
858
|
-
"import": "./dist/server/hooks/useRscData.mjs"
|
|
859
|
-
},
|
|
860
888
|
"./server/index": {
|
|
861
889
|
"types": "./dist/server/index.d.ts",
|
|
862
890
|
"import": "./dist/server/index.mjs"
|
|
@@ -881,6 +909,42 @@
|
|
|
881
909
|
"types": "./dist/state/runtimeStatePersist.d.ts",
|
|
882
910
|
"import": "./dist/state/runtimeStatePersist.mjs"
|
|
883
911
|
},
|
|
912
|
+
"./store": {
|
|
913
|
+
"types": "./dist/store/index.d.ts",
|
|
914
|
+
"import": "./dist/store/index.mjs"
|
|
915
|
+
},
|
|
916
|
+
"./store/index": {
|
|
917
|
+
"types": "./dist/store/index.d.ts",
|
|
918
|
+
"import": "./dist/store/index.mjs"
|
|
919
|
+
},
|
|
920
|
+
"./store/tracing": {
|
|
921
|
+
"types": "./dist/store/tracing/index.d.ts",
|
|
922
|
+
"import": "./dist/store/tracing/index.mjs"
|
|
923
|
+
},
|
|
924
|
+
"./store/tracing/index": {
|
|
925
|
+
"types": "./dist/store/tracing/index.d.ts",
|
|
926
|
+
"import": "./dist/store/tracing/index.mjs"
|
|
927
|
+
},
|
|
928
|
+
"./store/tracing/preview": {
|
|
929
|
+
"types": "./dist/store/tracing/preview.d.ts",
|
|
930
|
+
"import": "./dist/store/tracing/preview.mjs"
|
|
931
|
+
},
|
|
932
|
+
"./store/tracing/tracingCollector": {
|
|
933
|
+
"types": "./dist/store/tracing/tracingCollector.d.ts",
|
|
934
|
+
"import": "./dist/store/tracing/tracingCollector.mjs"
|
|
935
|
+
},
|
|
936
|
+
"./store/tracing/tracingMiddleware": {
|
|
937
|
+
"types": "./dist/store/tracing/tracingMiddleware.d.ts",
|
|
938
|
+
"import": "./dist/store/tracing/tracingMiddleware.mjs"
|
|
939
|
+
},
|
|
940
|
+
"./store/tracing/tracingStore": {
|
|
941
|
+
"types": "./dist/store/tracing/tracingStore.d.ts",
|
|
942
|
+
"import": "./dist/store/tracing/tracingStore.mjs"
|
|
943
|
+
},
|
|
944
|
+
"./store/tracing/useTracing": {
|
|
945
|
+
"types": "./dist/store/tracing/useTracing.d.ts",
|
|
946
|
+
"import": "./dist/store/tracing/useTracing.mjs"
|
|
947
|
+
},
|
|
884
948
|
"./style": {
|
|
885
949
|
"types": "./dist/style/index.d.ts",
|
|
886
950
|
"import": "./dist/style/index.mjs"
|
|
@@ -1011,11 +1075,12 @@
|
|
|
1011
1075
|
},
|
|
1012
1076
|
"dependencies": {
|
|
1013
1077
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
1014
|
-
"@plitzi/nexus": "0.32.
|
|
1015
|
-
"@plitzi/plitzi-ui": "^1.6.
|
|
1016
|
-
"date-fns": "^4.
|
|
1078
|
+
"@plitzi/nexus": "0.32.2",
|
|
1079
|
+
"@plitzi/plitzi-ui": "^1.6.13",
|
|
1080
|
+
"date-fns": "^4.4.0",
|
|
1017
1081
|
"date-fns-tz": "^3.2.0",
|
|
1018
|
-
"graphql-tag": "^2.12.
|
|
1082
|
+
"graphql-tag": "^2.12.7",
|
|
1083
|
+
"immer": "^11.1.8",
|
|
1019
1084
|
"twig": "^3.0.0",
|
|
1020
1085
|
"zod": "^4.4.3"
|
|
1021
1086
|
},
|
|
@@ -1024,53 +1089,53 @@
|
|
|
1024
1089
|
"react-dom": "^19"
|
|
1025
1090
|
},
|
|
1026
1091
|
"devDependencies": {
|
|
1027
|
-
"@babel/cli": "^
|
|
1028
|
-
"@babel/core": "^
|
|
1029
|
-
"@babel/eslint-parser": "^
|
|
1030
|
-
"@babel/plugin-syntax-flow": "^
|
|
1031
|
-
"@babel/plugin-transform-react-jsx": "^
|
|
1032
|
-
"@babel/preset-env": "^
|
|
1092
|
+
"@babel/cli": "^8.0.1",
|
|
1093
|
+
"@babel/core": "^8.0.1",
|
|
1094
|
+
"@babel/eslint-parser": "^8.0.1",
|
|
1095
|
+
"@babel/plugin-syntax-flow": "^8.0.1",
|
|
1096
|
+
"@babel/plugin-transform-react-jsx": "^8.0.1",
|
|
1097
|
+
"@babel/preset-env": "^8.0.2",
|
|
1033
1098
|
"@eslint/js": "^10.0.1",
|
|
1034
1099
|
"@tailwindcss/forms": "^0.5.11",
|
|
1035
1100
|
"@testing-library/dom": "^10.4.1",
|
|
1036
1101
|
"@testing-library/react": "^16.3.2",
|
|
1037
1102
|
"@testing-library/react-hooks": "^8.0.1",
|
|
1038
1103
|
"@testing-library/user-event": "^14.6.1",
|
|
1039
|
-
"@types/react": "^19.2.
|
|
1104
|
+
"@types/react": "^19.2.17",
|
|
1040
1105
|
"@types/react-dom": "^19.2.3",
|
|
1041
1106
|
"@types/twig": "^1.12.17",
|
|
1042
1107
|
"@vitejs/plugin-react": "^6.0.2",
|
|
1043
|
-
"@vitest/coverage-v8": "^4.1.
|
|
1108
|
+
"@vitest/coverage-v8": "^4.1.9",
|
|
1044
1109
|
"babel-minify": "^0.5.2",
|
|
1045
1110
|
"eslint": "^9.39.4",
|
|
1046
1111
|
"eslint-config-airbnb": "^19.0.4",
|
|
1047
1112
|
"eslint-config-prettier": "^10.1.8",
|
|
1048
|
-
"eslint-config-turbo": "^2.9.
|
|
1113
|
+
"eslint-config-turbo": "^2.9.18",
|
|
1049
1114
|
"eslint-import-resolver-alias": "^1.1.2",
|
|
1050
1115
|
"eslint-plugin-cypress": "^6.4.1",
|
|
1051
1116
|
"eslint-plugin-flowtype": "8.0.3",
|
|
1052
1117
|
"eslint-plugin-import": "^2.32.0",
|
|
1053
|
-
"eslint-plugin-jsdoc": "^63.0.
|
|
1118
|
+
"eslint-plugin-jsdoc": "^63.0.7",
|
|
1054
1119
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
1055
|
-
"eslint-plugin-prettier": "^5.5.
|
|
1120
|
+
"eslint-plugin-prettier": "^5.5.6",
|
|
1056
1121
|
"eslint-plugin-react": "^7.37.5",
|
|
1057
1122
|
"eslint-plugin-react-hooks": "^7.1.1",
|
|
1058
|
-
"eslint-plugin-react-refresh": "^0.5.
|
|
1059
|
-
"eslint-plugin-storybook": "^10.4.
|
|
1123
|
+
"eslint-plugin-react-refresh": "^0.5.3",
|
|
1124
|
+
"eslint-plugin-storybook": "^10.4.6",
|
|
1060
1125
|
"globals": "^17.6.0",
|
|
1061
1126
|
"jsdom": "^29.1.1",
|
|
1062
1127
|
"postcss": "^8.5.15",
|
|
1063
|
-
"prettier": "^3.8.
|
|
1064
|
-
"react": "^19.2.
|
|
1065
|
-
"react-dom": "^19.2.
|
|
1066
|
-
"tailwindcss": "^4.3.
|
|
1128
|
+
"prettier": "^3.8.4",
|
|
1129
|
+
"react": "^19.2.7",
|
|
1130
|
+
"react-dom": "^19.2.7",
|
|
1131
|
+
"tailwindcss": "^4.3.1",
|
|
1067
1132
|
"terser": "^5.48.0",
|
|
1068
1133
|
"typescript": "^6.0.3",
|
|
1069
|
-
"typescript-eslint": "^8.
|
|
1070
|
-
"vite": "^8.0.
|
|
1071
|
-
"vite-plugin-dts": "^5.0.
|
|
1134
|
+
"typescript-eslint": "^8.61.1",
|
|
1135
|
+
"vite": "^8.0.16",
|
|
1136
|
+
"vite-plugin-dts": "^5.0.2",
|
|
1072
1137
|
"vite-plugin-react": "^4.0.1",
|
|
1073
|
-
"vitest": "^4.1.
|
|
1138
|
+
"vitest": "^4.1.9",
|
|
1074
1139
|
"vitest-fetch-mock": "^0.4.5"
|
|
1075
1140
|
}
|
|
1076
1141
|
}
|
package/setupTests.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { vi } from 'vitest';
|
|
2
2
|
import createFetchMock from 'vitest-fetch-mock';
|
|
3
3
|
|
|
4
|
+
(globalThis as Record<string, unknown>).PERF_MULTIPLIER = Number(
|
|
5
|
+
process.env.PERF_MULTIPLIER ?? (process.env.TURBO_RUN ? 5 : 1)
|
|
6
|
+
);
|
|
7
|
+
|
|
4
8
|
// set globalThis.fetch and globalThis.fetchMock
|
|
5
9
|
const fetchMocker = createFetchMock(vi);
|
|
6
10
|
fetchMocker.enableMocks();
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Element, ElementLayout } from '../types';
|
|
2
|
-
import { CSSProperties } from 'react';
|
|
3
|
-
export type ElementContextValue<T extends 'skipHOC' | 'full' = 'full'> = {
|
|
4
|
-
id: string;
|
|
5
|
-
rootId?: string;
|
|
6
|
-
} & (T extends 'skipHOC' ? {
|
|
7
|
-
plitziJsxSkipHOC: true;
|
|
8
|
-
} : {
|
|
9
|
-
plitziJsxSkipHOC?: boolean;
|
|
10
|
-
className?: string;
|
|
11
|
-
plitziElementLayout?: ElementLayout;
|
|
12
|
-
attributes: Element['attributes'];
|
|
13
|
-
definition: Element['definition'];
|
|
14
|
-
elementState: Record<string, unknown>;
|
|
15
|
-
style?: CSSProperties;
|
|
16
|
-
setElementState: <S extends Record<string, unknown> = Record<string, unknown>>(value?: S | ((prev: S) => S)) => boolean;
|
|
17
|
-
});
|
|
18
|
-
declare const ElementContext: import('react').Context<ElementContextValue<"full"> | ElementContextValue<"skipHOC">>;
|
|
19
|
-
export default ElementContext;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import e from "../ElementContext.mjs";
|
|
2
|
-
import { use as t } from "react";
|
|
3
|
-
//#region src/elements/hooks/useElement.ts
|
|
4
|
-
var n = () => {
|
|
5
|
-
let n = t(e);
|
|
6
|
-
if (n === void 0) throw Error("ElementContext value is undefined. Make sure you use the ElementContext before using the hook.");
|
|
7
|
-
return n;
|
|
8
|
-
};
|
|
9
|
-
//#endregion
|
|
10
|
-
export { n as default };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns RSC data for the given element.
|
|
3
|
-
* Returns null (not undefined) when the element is registered as a server
|
|
4
|
-
* element but carries no extra payload — the distinction matters for callers
|
|
5
|
-
* that want to know whether the key was present at all.
|
|
6
|
-
*/
|
|
7
|
-
declare const useRscData: <T>() => {
|
|
8
|
-
enabled: boolean;
|
|
9
|
-
serverData: Record<string, unknown> | undefined;
|
|
10
|
-
elementData: T | null | undefined;
|
|
11
|
-
isServerElement: boolean | undefined;
|
|
12
|
-
refresh: ((ids?: string[]) => Promise<void>) | undefined;
|
|
13
|
-
};
|
|
14
|
-
export default useRscData;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import e from "../../elements/hooks/useElement.mjs";
|
|
2
|
-
import t from "../rsc/RscContext.mjs";
|
|
3
|
-
import { use as n } from "react";
|
|
4
|
-
//#region src/server/hooks/useRscData.ts
|
|
5
|
-
var r = () => {
|
|
6
|
-
let { id: r } = e(), { enabled: i, serverData: a, refresh: o } = n(t);
|
|
7
|
-
return {
|
|
8
|
-
enabled: i,
|
|
9
|
-
serverData: a,
|
|
10
|
-
elementData: r ? a?.[r] ?? null : void 0,
|
|
11
|
-
isServerElement: a && r in a,
|
|
12
|
-
refresh: o
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
//#endregion
|
|
16
|
-
export { r as default };
|