@gravity-platform/unoverse-react 0.0.4 → 0.0.6

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/index.d.cts CHANGED
@@ -134,8 +134,9 @@ declare function StreamedUnoverseTemplate({ client, store, uri, onAction, theme:
134
134
  /** Returns the resolved theme (null until the first fetch resolves). */
135
135
  declare function useUnoverseTheme(client: UnoverseClient, name?: string): ResolvedTheme | null;
136
136
 
137
- declare function IsolatedRoot({ children }: {
137
+ declare function IsolatedRoot({ children, rootStyle }: {
138
138
  children: ReactNode;
139
+ rootStyle?: CSSProperties;
139
140
  }): react.JSX.Element;
140
141
 
141
142
  interface UnoverseConnectionConfig {
package/dist/index.d.ts CHANGED
@@ -134,8 +134,9 @@ declare function StreamedUnoverseTemplate({ client, store, uri, onAction, theme:
134
134
  /** Returns the resolved theme (null until the first fetch resolves). */
135
135
  declare function useUnoverseTheme(client: UnoverseClient, name?: string): ResolvedTheme | null;
136
136
 
137
- declare function IsolatedRoot({ children }: {
137
+ declare function IsolatedRoot({ children, rootStyle }: {
138
138
  children: ReactNode;
139
+ rootStyle?: CSSProperties;
139
140
  }): react.JSX.Element;
140
141
 
141
142
  interface UnoverseConnectionConfig {
package/dist/index.js CHANGED
@@ -7204,7 +7204,7 @@ var RESET_CSS = `
7204
7204
  font: inherit; letter-spacing: inherit; color: inherit; margin: 0;
7205
7205
  }
7206
7206
  `;
7207
- function IsolatedRoot({ children }) {
7207
+ function IsolatedRoot({ children, rootStyle }) {
7208
7208
  const hostRef = useRef(null);
7209
7209
  const [shadow, setShadow] = useState3(null);
7210
7210
  useEffect2(() => {
@@ -7215,7 +7215,7 @@ function IsolatedRoot({ children }) {
7215
7215
  return /* @__PURE__ */ jsx3("div", { ref: hostRef, style: { display: "contents" }, children: shadow && createPortal(
7216
7216
  /* @__PURE__ */ jsxs2(Fragment, { children: [
7217
7217
  /* @__PURE__ */ jsx3("style", { children: RESET_CSS }),
7218
- /* @__PURE__ */ jsx3("div", { className: "uno-isolate-root", children })
7218
+ /* @__PURE__ */ jsx3("div", { className: "uno-isolate-root", style: rootStyle, children })
7219
7219
  ] }),
7220
7220
  shadow
7221
7221
  ) });
@@ -7249,12 +7249,19 @@ function UnoverseComponent({ client, uri, data, onAction, theme, isolate = true
7249
7249
  const propDefaults2 = Object.fromEntries(
7250
7250
  Object.entries(def.props ?? {}).map(([k, v]) => [k, v?.default])
7251
7251
  );
7252
- const merged = data ?? propDefaults2;
7253
- const body = /* @__PURE__ */ jsxs3(Fragment2, { children: [
7254
- /* @__PURE__ */ jsx4("style", { children: keyframesCss(activeTheme) }),
7255
- /* @__PURE__ */ jsx4("div", { style: { display: "contents", ...activeTheme.root }, children: renderNode(def.root, merged, onAction, activeTheme) })
7252
+ const merged = { ...propDefaults2, ...data ?? {} };
7253
+ const keyframes = /* @__PURE__ */ jsx4("style", { children: keyframesCss(activeTheme) });
7254
+ const tree = renderNode(def.root, merged, onAction, activeTheme);
7255
+ if (isolate) {
7256
+ return /* @__PURE__ */ jsxs3(IsolatedRoot, { rootStyle: activeTheme.root, children: [
7257
+ keyframes,
7258
+ tree
7259
+ ] });
7260
+ }
7261
+ return /* @__PURE__ */ jsxs3(Fragment2, { children: [
7262
+ keyframes,
7263
+ /* @__PURE__ */ jsx4("div", { style: { display: "contents", ...activeTheme.root }, children: tree })
7256
7264
  ] });
7257
- return isolate ? /* @__PURE__ */ jsx4(IsolatedRoot, { children: body }) : body;
7258
7265
  }
7259
7266
 
7260
7267
  // src/streamed.tsx
@@ -7394,11 +7401,18 @@ function StreamedUnoverseTemplate({ client, store, uri, onAction, theme: themePr
7394
7401
  // button submits it. Lives in the store (shared state), not locally in Input.
7395
7402
  draft: store.getDraft()
7396
7403
  };
7397
- const body = /* @__PURE__ */ jsxs4(Fragment3, { children: [
7398
- /* @__PURE__ */ jsx6("style", { children: keyframesCss(theme) }),
7399
- /* @__PURE__ */ jsx6("div", { style: { display: "contents", ...theme.root }, children: renderNode(def.root, rootData, onAction, theme, void 0, resolve) })
7404
+ const keyframes = /* @__PURE__ */ jsx6("style", { children: keyframesCss(theme) });
7405
+ const tree = renderNode(def.root, rootData, onAction, theme, void 0, resolve);
7406
+ if (isolate) {
7407
+ return /* @__PURE__ */ jsxs4(IsolatedRoot, { rootStyle: theme.root, children: [
7408
+ keyframes,
7409
+ tree
7410
+ ] });
7411
+ }
7412
+ return /* @__PURE__ */ jsxs4(Fragment3, { children: [
7413
+ keyframes,
7414
+ /* @__PURE__ */ jsx6("div", { style: { display: "contents", ...theme.root }, children: tree })
7400
7415
  ] });
7401
- return isolate ? /* @__PURE__ */ jsx6(IsolatedRoot, { children: body }) : body;
7402
7416
  }
7403
7417
 
7404
7418
  // src/connection.tsx