@picked/react 0.0.66 → 0.0.67-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.
@@ -5,11 +5,13 @@ interface HtmlRenderProps {
5
5
  }
6
6
  /**
7
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.
8
+ * Picked-tagged scripts. The shadow boundary keeps the host page's CSS from bleeding into the
9
+ * landing-page markup and lets shadow-scoped page scripts locate their own root during rehydration. On the server
10
+ * the markup is emitted as a declarative shadow DOM template, a parser-only feature the browser
11
+ * attaches as a real shadow root while parsing the response, so content is present from first paint.
12
+ * On the client, the first commit adopts that parser-attached root and only rehydrates its scripts; a
13
+ * client-only mount or a later content change attaches and writes the shadow root imperatively
14
+ * instead. A non-matching value or a `null` content renders nothing.
13
15
  *
14
16
  * @param {HtmlRenderProps} props - The component props.
15
17
  * @returns {React.JSX.Element} The shadow-root host element.
@@ -1 +1 @@
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
+ {"version":3,"file":"HtmlRender.d.ts","sourceRoot":"","sources":["../../src/experience/HtmlRender.tsx"],"names":[],"mappings":"AAAA,8GAA8G;AAC9G,OAAO,KAA4B,MAAM,OAAO,CAAA;AAQhD,UAAU,eAAe;IACvB,wEAAwE;IACxE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;CACvB;AAED;;;;;;;;;;;;;;GAcG;AACH,iBAAS,UAAU,CAAC,EAAE,IAAI,EAAE,EAAE,eAAe,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAgChE;AAED,eAAe,UAAU,CAAA"}
@@ -1 +1 @@
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};
1
+ import{useEffect as e,useRef as t}from"react";import{isHtmlAssetValue as n,rehydrateScripts as r,supportsShadowRoot as i,supportsWindow as a}from"@picked/client";import{jsx as o}from"react/jsx-runtime";function s({html:s}){let c=(n(s)?s:null)?.content??``,l=t(null),u=t(!1);return e(()=>{let e=l.current;if(!i()||!e)return;let t=e.shadowRoot,n=!u.current;if(u.current=!0,t&&n){c&&r(t);return}let a=t??e.attachShadow({mode:`open`});a.innerHTML=c,c&&r(a)},[c]),a()?o(`div`,{ref:l,suppressHydrationWarning:!0}):o(`div`,{ref:l,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`<template shadowrootmode="open">${c}</template>`}})}export{s as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@picked/react",
3
- "version": "0.0.66",
3
+ "version": "0.0.67-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.66",
88
+ "@picked/client": "0.0.67-next.1",
89
89
  "effector": "^23.3.0",
90
90
  "react": "19.2.2",
91
91
  "react-dom": "19.2.2"