Skip to content

Commit 6ee0a58

Browse files
authored
Clean up <ThemeProvider> and various CSS related stuff (#5611)
* Clean CSS injection * Clean up nonce usage * Remove nonce from <ThemeProvider> * Rename <WebChatTheme> to <Inject*CSS> * Clean up * Add comment * Add comment * Fix identifier * Remove nonce requirement * Direct inject after building style elements * Add entry * Remove launcher experience * Fix imports * Fix imports * Fix tests * Better imports * Use Happy DOM * Return children as-is * Remove unnecessary files * Dedupe across instances * Add test * Use hooks * Mvoe from hook to leaf node * Move to create CSS function * Fix tsup * Allow rectifying twice * Mark nonce as optional * Reverse order * Add component * Add /component * Remove snapshots * Fix script-0.mjs * Fix script-0.mjs * Fix styleOptions * Allow cascaded rectify style options * Separate stylesRoot from fluent-theme * Mark stylesRoot as optional * Componentize <InjectStyleElements> * Fix --watch 200 * Fix flakiness * Fix test * Fix test * Fix --watch 200 * Move stylesheet to bottommost on re-inject * Fix hideScrollToEndButton * Fix hideScrollToEndButton * Clean up * Clean up * Clean up * Rename *CSS -> *Stylesheet * Componentize as <FluentThemeStylesheet> * Rename to <CSSCustomPropertiesContainer> * Fix tests * Fix styleRoots and import hooks * Add importmap for hook * Move InjectStyleElements to styles package * Yellow instead of white * Add styles as devDependencies * Fix import map * Retrigger checks
1 parent 7671e32 commit 6ee0a58

File tree

116 files changed

+1278
-515
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+1278
-515
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ Notes: web developers are advised to use [`~` (tilde range)](https://github.com/
144144
- `import { hooks } from 'botframework-webchat'` should be replaced by `import * as hooks from 'botframework-webchat/hook'`
145145
- Added target to Chrome 100 and re-enable Lightning CSS for ESM builds, by [@compulim](https://github.com/compulim) in PR [#5602](https://github.com/microsoft/BotFramework-WebChat/pull/5602)
146146
- Relaxed `role` prop to allow any string instead of ARIA landmark roles, in PR [#5561](https://github.com/microsoft/BotFramework-WebChat/pull/5561), by [@compulim](https://github.com/compulim)
147+
- Cleaned up `<ThemeProvider>` and various CSS related code, in PR [#5611](https://github.com/microsoft/BotFramework-WebChat/pull/5611), by [@compulim](https://github.com/compulim)
147148

148149
### Changed
149150

__tests__/html/fluentTheme/customElement/shadowRoot.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
);
5757

5858
render(
59-
<FluentThemeProvider>
59+
<FluentThemeProvider nonce="test" stylesRoot={this.shadowRoot}>
6060
<App />
6161
</FluentThemeProvider>,
6262
container

__tests__/html/hooks.useInjectStyles.changeNonce.js

Lines changed: 0 additions & 5 deletions
This file was deleted.

__tests__/html/hooks.useInjectStyles.changeRoot.js

Lines changed: 0 additions & 5 deletions
This file was deleted.

__tests__/html/hooks.useInjectStyles.dupeElement.js

Lines changed: 0 additions & 5 deletions
This file was deleted.

__tests__/html/hooks.useInjectStyles.js

Lines changed: 0 additions & 5 deletions
This file was deleted.

__tests__/html/hooks.useInjectStyles.link.js

Lines changed: 0 additions & 5 deletions
This file was deleted.

__tests__/html2/activity/message-status.html

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
"@fluentui/tokens": "https://esm.sh/@fluentui/tokens?deps=react@18&exports=createDarkTheme,webLightTheme",
1212
"@testduet/wait-for": "https://unpkg.com/@testduet/wait-for@main/dist/wait-for.mjs",
1313
"botframework-webchat": "/__dist__/packages/bundle/static/botframework-webchat.js",
14+
"botframework-webchat/component": "/__dist__/packages/bundle/static/botframework-webchat/component.js",
1415
"botframework-webchat/decorator": "/__dist__/packages/bundle/static/botframework-webchat/decorator.js",
16+
"botframework-webchat/hook": "/__dist__/packages/bundle/static/botframework-webchat/hook.js",
1517
"botframework-webchat/internal": "/__dist__/packages/bundle/static/botframework-webchat/internal.js",
1618
"botframework-webchat-fluent-theme": "/__dist__/packages/fluent-theme/static/botframework-webchat-fluent-theme.js",
1719
"react": "https://esm.sh/react@18",
@@ -57,7 +59,7 @@
5759

5860
// TODO: This is for `createDirectLineEmulator` only, should find ways to eliminate this line.
5961
window.WebChat = { createStoreWithOptions };
60-
62+
6163
run(async function () {
6264
const { directLine, store } = createDirectLineEmulator();
6365

@@ -276,7 +278,7 @@
276278
author
277279
}]
278280
});
279-
281+
280282
await pageConditions.numActivitiesShown(6);
281283
await host.snapshot('local');
282284

@@ -362,4 +364,4 @@
362364
</script>
363365
</body>
364366

365-
</html>
367+
</html>

__tests__/html2/citation/url.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@
1111
"@fluentui/tokens": "https://esm.sh/@fluentui/tokens?deps=react@18&exports=createDarkTheme,webLightTheme",
1212
"@testduet/wait-for": "https://unpkg.com/@testduet/wait-for@main/dist/wait-for.mjs",
1313
"botframework-webchat": "/__dist__/packages/bundle/static/botframework-webchat.js",
14+
"botframework-webchat/component": "/__dist__/packages/bundle/static/botframework-webchat/component.js",
1415
"botframework-webchat/decorator": "/__dist__/packages/bundle/static/botframework-webchat/decorator.js",
1516
"botframework-webchat/internal": "/__dist__/packages/bundle/static/botframework-webchat/internal.js",
17+
"botframework-webchat/hook": "/__dist__/packages/bundle/static/botframework-webchat/hook.js",
1618
"botframework-webchat-fluent-theme": "/__dist__/packages/fluent-theme/static/botframework-webchat-fluent-theme.js",
1719
"react": "https://esm.sh/react@18",
1820
"react-dom": "https://esm.sh/react-dom@18",
@@ -334,10 +336,10 @@
334336
'mailto:support+roadmap@example.com?subject=Roadmap%20Review%20%5BTemplate%5D&body=Please%20review%20slide%203.%0AThanks%21',
335337
'https://example.sharepoint.com/sites/Docs/Q1%231%20Plan.pptx'
336338
]);
337-
339+
338340
await host.snapshot('local');
339341
});
340342
</script>
341343
</body>
342344

343-
</html>
345+
</html>

0 commit comments

Comments
 (0)