You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For interactive components that would require client side interactivity, like for event handlers, these component should be authored rendering into a Shadow Root with [Declarative Shadow DOM](https://developer.chrome.com/docs/css-ui/declarative-shadow-dom) and using [Constructable Stylesheets](https://web.dev/articles/constructable-stylesheets).
107
+
For interactive components that would require client side interactivity, like event handlers, these components should be authored rendering into a Shadow Root using [Declarative Shadow DOM](https://developer.chrome.com/docs/css-ui/declarative-shadow-dom) and with Greenwood's [raw plugin](https://github.com/ProjectEvergreen/greenwood/tree/master/packages/plugin-import-raw).
108
+
109
+
<details>
110
+
Ideally we would be using <a href="https://web.dev/articles/constructable-stylesheets">Constructable Stylesheets and Import Attributes</a> but CSS Import Attributes are <a href="https://github.com/ProjectEvergreen/www.greenwoodjs.dev/pull/57#issuecomment-2295349811">not baseline yet</a>. 😞
111
+
</details>
108
112
109
113
```css
110
114
/* card.css */
@@ -115,7 +119,7 @@ For interactive components that would require client side interactivity, like fo
const{ name }=node.children.head.data.children.head.data;
69
-
70
70
constscopedClassName=`${scope}-${hash}-${name}`;
71
71
classNameMap[name]=scopedClassName;
72
72
73
-
scopedCssContents=scopedCssContents.replace(
74
-
`\.${name}`,
75
-
`\.${scopedClassName}`,
76
-
);
73
+
/*
74
+
* bit of a hacky solution since as we are walking class names one at a time, if we have multiple uses of .heading (for example)
75
+
* then by the end we could have .my-component-111-header.my-component-111-header.etc, since we want to replace all instances (e.g. the g flag in Regex)
76
+
*
77
+
* csstree supports loc so we _could_ target the class replacement down to start / end points, but that unfortunately slows things down a lot
78
+
*/
79
+
// TODO this is a pretty ugly find / replace technique...
80
+
// will definitely want to refactor and test this well
0 commit comments