@mmapp/react 0.1.0-alpha.19 → 0.1.0-alpha.20
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/dist/actions-HOXZPBTT.mjs +116 -0
- package/dist/chunk-FBKUGKQI.mjs +1938 -0
- package/dist/chunk-ZAHMWAER.mjs +1960 -0
- package/dist/index.js +29 -7
- package/dist/index.mjs +1 -1
- package/dist/player/index.js +29 -7
- package/dist/player/index.mjs +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -995,7 +995,7 @@ var init_actions = __esm({
|
|
|
995
995
|
},
|
|
996
996
|
children: [
|
|
997
997
|
isLoading || loadingProp ? "\u23F3" : icon ? String(icon) : null,
|
|
998
|
-
text != null ? String(text) : null,
|
|
998
|
+
text != null ? typeof text === "string" || typeof text === "number" ? String(text) : text : null,
|
|
999
999
|
iconRight ? String(iconRight) : null
|
|
1000
1000
|
]
|
|
1001
1001
|
}
|
|
@@ -6278,6 +6278,14 @@ var PlayerProvider = ({
|
|
|
6278
6278
|
|
|
6279
6279
|
// src/player/ExperienceRenderer.tsx
|
|
6280
6280
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
6281
|
+
var SharedLocalContext = import_react44.default.createContext({
|
|
6282
|
+
state: {},
|
|
6283
|
+
setLocal: () => {
|
|
6284
|
+
}
|
|
6285
|
+
});
|
|
6286
|
+
function useSharedLocal() {
|
|
6287
|
+
return import_react44.default.useContext(SharedLocalContext);
|
|
6288
|
+
}
|
|
6281
6289
|
var NodeErrorBoundary = class extends import_react44.default.Component {
|
|
6282
6290
|
constructor(props) {
|
|
6283
6291
|
super(props);
|
|
@@ -6495,13 +6503,19 @@ var NodeRenderer = ({ node, fallback }) => {
|
|
|
6495
6503
|
const resolver = playerCtx?.resolver ?? null;
|
|
6496
6504
|
const atomRegistry = playerCtx?.atomRegistry;
|
|
6497
6505
|
const themeTokens = useTheme();
|
|
6506
|
+
const sharedLocal = useSharedLocal();
|
|
6498
6507
|
const localDefaults = node.config?.localDefaults ?? {};
|
|
6499
|
-
|
|
6500
|
-
|
|
6501
|
-
|
|
6502
|
-
|
|
6503
|
-
|
|
6508
|
+
(0, import_react44.useEffect)(() => {
|
|
6509
|
+
if (Object.keys(localDefaults).length > 0) {
|
|
6510
|
+
for (const [key, value] of Object.entries(localDefaults)) {
|
|
6511
|
+
if (sharedLocal.state[key] === void 0) {
|
|
6512
|
+
sharedLocal.setLocal(key, value);
|
|
6513
|
+
}
|
|
6514
|
+
}
|
|
6515
|
+
}
|
|
6504
6516
|
}, []);
|
|
6517
|
+
const localState = sharedLocal.state;
|
|
6518
|
+
const handleSetLocal = sharedLocal.setLocal;
|
|
6505
6519
|
const [, setFetchVersion] = (0, import_react44.useState)(0);
|
|
6506
6520
|
const handleRefreshQuery = (0, import_react44.useCallback)(() => {
|
|
6507
6521
|
setFetchVersion((v) => v + 1);
|
|
@@ -6652,6 +6666,14 @@ var ExperienceRenderer = ({
|
|
|
6652
6666
|
}) => {
|
|
6653
6667
|
const playerCtx = usePlayerContext();
|
|
6654
6668
|
const nodes = Array.isArray(tree) ? tree : [tree];
|
|
6669
|
+
const [sharedLocalState, setSharedLocalState] = (0, import_react44.useState)({});
|
|
6670
|
+
const handleSharedSetLocal = (0, import_react44.useCallback)((key, value) => {
|
|
6671
|
+
setSharedLocalState((prev) => ({ ...prev, [key]: value }));
|
|
6672
|
+
}, []);
|
|
6673
|
+
const sharedLocal = (0, import_react44.useMemo)(() => ({
|
|
6674
|
+
state: sharedLocalState,
|
|
6675
|
+
setLocal: handleSharedSetLocal
|
|
6676
|
+
}), [sharedLocalState, handleSharedSetLocal]);
|
|
6655
6677
|
const rootScope = (0, import_react44.useMemo)(() => buildScope({
|
|
6656
6678
|
auth: playerCtx?.auth ?? initialScope?.auth,
|
|
6657
6679
|
entity,
|
|
@@ -6682,7 +6704,7 @@ var ExperienceRenderer = ({
|
|
|
6682
6704
|
}
|
|
6683
6705
|
}
|
|
6684
6706
|
}), [playerCtx?.auth, entity, initialScope]);
|
|
6685
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ScopeContext.Provider, { value: rootScope, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className, children: nodes.map((node, i) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(NodeErrorBoundary, { nodeId: node.id, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(NodeRenderer, { node, fallback }) }, node.id ?? i)) }) });
|
|
6707
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SharedLocalContext.Provider, { value: sharedLocal, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ScopeContext.Provider, { value: rootScope, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className, children: nodes.map((node, i) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(NodeErrorBoundary, { nodeId: node.id, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(NodeRenderer, { node, fallback }) }, node.id ?? i)) }) }) });
|
|
6686
6708
|
};
|
|
6687
6709
|
|
|
6688
6710
|
// src/player/resolver.ts
|
package/dist/index.mjs
CHANGED
package/dist/player/index.js
CHANGED
|
@@ -999,7 +999,7 @@ var init_actions = __esm({
|
|
|
999
999
|
},
|
|
1000
1000
|
children: [
|
|
1001
1001
|
isLoading || loadingProp ? "\u23F3" : icon ? String(icon) : null,
|
|
1002
|
-
text != null ? String(text) : null,
|
|
1002
|
+
text != null ? typeof text === "string" || typeof text === "number" ? String(text) : text : null,
|
|
1003
1003
|
iconRight ? String(iconRight) : null
|
|
1004
1004
|
]
|
|
1005
1005
|
}
|
|
@@ -2460,6 +2460,14 @@ var PlayerProvider = ({
|
|
|
2460
2460
|
|
|
2461
2461
|
// src/player/ExperienceRenderer.tsx
|
|
2462
2462
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
2463
|
+
var SharedLocalContext = import_react12.default.createContext({
|
|
2464
|
+
state: {},
|
|
2465
|
+
setLocal: () => {
|
|
2466
|
+
}
|
|
2467
|
+
});
|
|
2468
|
+
function useSharedLocal() {
|
|
2469
|
+
return import_react12.default.useContext(SharedLocalContext);
|
|
2470
|
+
}
|
|
2463
2471
|
var NodeErrorBoundary = class extends import_react12.default.Component {
|
|
2464
2472
|
constructor(props) {
|
|
2465
2473
|
super(props);
|
|
@@ -2677,13 +2685,19 @@ var NodeRenderer = ({ node, fallback }) => {
|
|
|
2677
2685
|
const resolver = playerCtx?.resolver ?? null;
|
|
2678
2686
|
const atomRegistry = playerCtx?.atomRegistry;
|
|
2679
2687
|
const themeTokens = useTheme();
|
|
2688
|
+
const sharedLocal = useSharedLocal();
|
|
2680
2689
|
const localDefaults = node.config?.localDefaults ?? {};
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2690
|
+
(0, import_react12.useEffect)(() => {
|
|
2691
|
+
if (Object.keys(localDefaults).length > 0) {
|
|
2692
|
+
for (const [key, value] of Object.entries(localDefaults)) {
|
|
2693
|
+
if (sharedLocal.state[key] === void 0) {
|
|
2694
|
+
sharedLocal.setLocal(key, value);
|
|
2695
|
+
}
|
|
2696
|
+
}
|
|
2697
|
+
}
|
|
2686
2698
|
}, []);
|
|
2699
|
+
const localState = sharedLocal.state;
|
|
2700
|
+
const handleSetLocal = sharedLocal.setLocal;
|
|
2687
2701
|
const [, setFetchVersion] = (0, import_react12.useState)(0);
|
|
2688
2702
|
const handleRefreshQuery = (0, import_react12.useCallback)(() => {
|
|
2689
2703
|
setFetchVersion((v) => v + 1);
|
|
@@ -2834,6 +2848,14 @@ var ExperienceRenderer = ({
|
|
|
2834
2848
|
}) => {
|
|
2835
2849
|
const playerCtx = usePlayerContext();
|
|
2836
2850
|
const nodes = Array.isArray(tree) ? tree : [tree];
|
|
2851
|
+
const [sharedLocalState, setSharedLocalState] = (0, import_react12.useState)({});
|
|
2852
|
+
const handleSharedSetLocal = (0, import_react12.useCallback)((key, value) => {
|
|
2853
|
+
setSharedLocalState((prev) => ({ ...prev, [key]: value }));
|
|
2854
|
+
}, []);
|
|
2855
|
+
const sharedLocal = (0, import_react12.useMemo)(() => ({
|
|
2856
|
+
state: sharedLocalState,
|
|
2857
|
+
setLocal: handleSharedSetLocal
|
|
2858
|
+
}), [sharedLocalState, handleSharedSetLocal]);
|
|
2837
2859
|
const rootScope = (0, import_react12.useMemo)(() => buildScope({
|
|
2838
2860
|
auth: playerCtx?.auth ?? initialScope?.auth,
|
|
2839
2861
|
entity,
|
|
@@ -2864,7 +2886,7 @@ var ExperienceRenderer = ({
|
|
|
2864
2886
|
}
|
|
2865
2887
|
}
|
|
2866
2888
|
}), [playerCtx?.auth, entity, initialScope]);
|
|
2867
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ScopeContext.Provider, { value: rootScope, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className, children: nodes.map((node, i) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(NodeErrorBoundary, { nodeId: node.id, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(NodeRenderer, { node, fallback }) }, node.id ?? i)) }) });
|
|
2889
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SharedLocalContext.Provider, { value: sharedLocal, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ScopeContext.Provider, { value: rootScope, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className, children: nodes.map((node, i) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(NodeErrorBoundary, { nodeId: node.id, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(NodeRenderer, { node, fallback }) }, node.id ?? i)) }) }) });
|
|
2868
2890
|
};
|
|
2869
2891
|
|
|
2870
2892
|
// src/player/resolver.ts
|
package/dist/player/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mmapp/react",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.20",
|
|
4
4
|
"description": "React integration for the MindMatrix Player — hooks, components, and WebSocket bridge for browser-side workflow engines",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@tanstack/react-query": ">=5.0.0"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@mmapp/player-core": "^0.1.0-alpha.
|
|
38
|
+
"@mmapp/player-core": "^0.1.0-alpha.20"
|
|
39
39
|
},
|
|
40
40
|
"publishConfig": {
|
|
41
41
|
"access": "public"
|