@picked/react 0.0.65 → 0.0.66-next.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.
|
@@ -4,12 +4,15 @@ interface HtmlRenderProps {
|
|
|
4
4
|
readonly html: unknown;
|
|
5
5
|
}
|
|
6
6
|
/**
|
|
7
|
-
* Renders a resolved html-asset field's HTML
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* Renders a resolved html-asset field's HTML inside an open shadow root and rehydrates its
|
|
8
|
+
* Picked-tagged scripts after commit. The shadow boundary keeps the host page's CSS from bleeding
|
|
9
|
+
* into the landing-page markup and gives shadow-scoped page scripts their own `getRootNode()`.
|
|
10
|
+
* Markup is written imperatively because React does not render into a shadow root, so on the server
|
|
11
|
+
* (and where Shadow DOM is unavailable) the host stays empty until the client effect runs. A
|
|
12
|
+
* non-matching value or a `null` content renders nothing.
|
|
10
13
|
*
|
|
11
14
|
* @param {HtmlRenderProps} props - The component props.
|
|
12
|
-
* @returns {React.JSX.Element} The
|
|
15
|
+
* @returns {React.JSX.Element} The shadow-root host element.
|
|
13
16
|
* @example
|
|
14
17
|
* <HtmlRender html={content.body} />
|
|
15
18
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HtmlRender.d.ts","sourceRoot":"","sources":["../../src/experience/HtmlRender.tsx"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"HtmlRender.d.ts","sourceRoot":"","sources":["../../src/experience/HtmlRender.tsx"],"names":[],"mappings":"AAAA,8GAA8G;AAC9G,OAAO,KAA4B,MAAM,OAAO,CAAA;AAGhD,UAAU,eAAe;IACvB,wEAAwE;IACxE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;CACvB;AAED;;;;;;;;;;;;GAYG;AACH,iBAAS,UAAU,CAAC,EAAE,IAAI,EAAE,EAAE,eAAe,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAehE;AAED,eAAe,UAAU,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useEffect as e,useRef as t}from"react";import{isHtmlAssetValue as n,rehydrateScripts as r,
|
|
1
|
+
import{useEffect as e,useRef as t}from"react";import{isHtmlAssetValue as n,rehydrateScripts as r,supportsShadowRoot as i}from"@picked/client";import{jsx as a}from"react/jsx-runtime";function o({html:o}){let s=(n(o)?o:null)?.content??``,c=t(null);return e(()=>{let e=c.current;if(!i()||!e)return;let t=e.shadowRoot??e.attachShadow({mode:`open`});t.innerHTML=s,s&&r(t)},[s]),a(`div`,{ref:c})}export{o as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@picked/react",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.66-next.1",
|
|
4
4
|
"devDependencies": {
|
|
5
5
|
"@picked/client": "workspace:*",
|
|
6
6
|
"@repo/eslint-config": "workspace:*",
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
},
|
|
86
86
|
"module": "./dist/index.js",
|
|
87
87
|
"peerDependencies": {
|
|
88
|
-
"@picked/client": "0.0.
|
|
88
|
+
"@picked/client": "0.0.66-next.1",
|
|
89
89
|
"effector": "^23.3.0",
|
|
90
90
|
"react": "19.2.2",
|
|
91
91
|
"react-dom": "19.2.2"
|