Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add shadow DOM support to @fluentui/react (Fluent v8) #30689

Merged
merged 33 commits into from
Apr 19, 2024
Merged

Conversation

spmonahan
Copy link
Contributor

Previous Behavior

@fluentui/react would not correctly render styles in shadow DOM.

New Behavior

@fluentui/react supports rendering in shadow DOM.

Apologies in advance for the large PR, I know we strive to avoid those for a variety of reasons but given the extent of this change I didn't feel it was feasible to introduce it piecemeal. I have been collecting all the changes in the shadow-dom branch which I've kept up-to-date with master and the PRs into shadow-dom have been reviewed so this is not the first time this code is being looked at.

Related Issue(s)

Copy link

codesandbox-ci bot commented Mar 1, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@fabricteam
Copy link
Collaborator

fabricteam commented Mar 1, 2024

Perf Analysis (@fluentui/react-northstar)

Perf tests with no regressions
Scenario Current PR Ticks Baseline Ticks Ratio
TreeWith60ListItems.default 96 85 1.13:1
ChatWithPopoverPerf.default 201 182 1.1:1
AttachmentMinimalPerf.default 79 74 1.07:1
AttachmentSlotsPerf.default 633 597 1.06:1
ChatDuplicateMessagesPerf.default 157 148 1.06:1
ImageMinimalPerf.default 232 218 1.06:1
InputMinimalPerf.default 564 531 1.06:1
ListCommonPerf.default 397 373 1.06:1
RefMinimalPerf.default 115 108 1.06:1
DividerMinimalPerf.default 212 201 1.05:1
PortalMinimalPerf.default 87 83 1.05:1
ListMinimalPerf.default 310 299 1.04:1
MenuMinimalPerf.default 511 493 1.04:1
ProviderMinimalPerf.default 204 197 1.04:1
TableMinimalPerf.default 237 228 1.04:1
VideoMinimalPerf.default 443 425 1.04:1
BoxMinimalPerf.default 195 189 1.03:1
ButtonMinimalPerf.default 92 89 1.03:1
DialogMinimalPerf.default 450 439 1.03:1
TreeMinimalPerf.default 487 474 1.03:1
CarouselMinimalPerf.default 261 255 1.02:1
DropdownMinimalPerf.default 1444 1416 1.02:1
HeaderSlotsPerf.default 471 460 1.02:1
PopupMinimalPerf.default 347 339 1.02:1
SkeletonMinimalPerf.default 203 199 1.02:1
StatusMinimalPerf.default 394 385 1.02:1
ButtonOverridesMissPerf.default 649 645 1.01:1
CheckboxMinimalPerf.default 1117 1104 1.01:1
GridMinimalPerf.default 192 190 1.01:1
HeaderMinimalPerf.default 210 207 1.01:1
ItemLayoutMinimalPerf.default 720 712 1.01:1
SplitButtonMinimalPerf.default 2242 2225 1.01:1
TextMinimalPerf.default 195 193 1.01:1
AvatarMinimalPerf.default 105 105 1:1
DropdownManyItemsPerf.default 375 374 1:1
FlexMinimalPerf.default 158 158 1:1
LabelMinimalPerf.default 219 219 1:1
RadioGroupMinimalPerf.default 251 250 1:1
TooltipMinimalPerf.default 1284 1282 1:1
DatepickerMinimalPerf.default 3513 3541 0.99:1
LayoutMinimalPerf.default 196 198 0.99:1
LoaderMinimalPerf.default 182 184 0.99:1
MenuButtonMinimalPerf.default 931 945 0.99:1
ReactionMinimalPerf.default 205 207 0.99:1
TableManyItemsPerf.default 1085 1101 0.99:1
ToolbarMinimalPerf.default 532 537 0.99:1
AccordionMinimalPerf.default 89 91 0.98:1
AnimationMinimalPerf.default 293 299 0.98:1
ButtonSlotsPerf.default 323 328 0.98:1
ChatMinimalPerf.default 430 438 0.98:1
EmbedMinimalPerf.default 1846 1887 0.98:1
ListNestedPerf.default 312 320 0.98:1
RosterPerf.default 1537 1572 0.98:1
SliderMinimalPerf.default 725 739 0.98:1
TextAreaMinimalPerf.default 279 285 0.98:1
CustomToolbarPrototype.default 1446 1474 0.98:1
AlertMinimalPerf.default 162 167 0.97:1
ListWith60ListItems.default 347 356 0.97:1
FormMinimalPerf.default 213 222 0.96:1
ProviderMergeThemesPerf.default 640 670 0.96:1
SegmentMinimalPerf.default 195 203 0.96:1
IconMinimalPerf.default 359 380 0.94:1
CardMinimalPerf.default 288 312 0.92:1

@fabricteam
Copy link
Collaborator

fabricteam commented Mar 1, 2024

📊 Bundle size report

Package & Exports Baseline (minified/GZIP) PR Change
react
ActivityItem
68.833 kB
22.613 kB
71.019 kB
23.288 kB
2.186 kB
675 B
react
Announced
36.473 kB
12.628 kB
38.291 kB
13.239 kB
1.818 kB
611 B
react
Breadcrumb
196.131 kB
58.76 kB
200.519 kB
60.03 kB
4.388 kB
1.27 kB
react
Button
190.127 kB
55.019 kB
194.473 kB
56.258 kB
4.346 kB
1.239 kB
react
ButtonGrid
175.918 kB
53.25 kB
180.249 kB
54.478 kB
4.331 kB
1.228 kB
react
Calendar
118.756 kB
36.101 kB
121.542 kB
36.943 kB
2.786 kB
842 B
react
Callout
80.866 kB
26.564 kB
84.008 kB
27.519 kB
3.142 kB
955 B
react
Check
51.062 kB
17.152 kB
52.963 kB
17.773 kB
1.901 kB
621 B
react
Checkbox
57.791 kB
19.17 kB
59.751 kB
19.806 kB
1.96 kB
636 B
react
ChoiceGroup
63.339 kB
20.824 kB
65.276 kB
21.438 kB
1.937 kB
614 B
react
ChoiceGroupOption
56.601 kB
18.695 kB
58.531 kB
19.309 kB
1.93 kB
614 B
react
Coachmark
89.704 kB
28.407 kB
92.837 kB
29.325 kB
3.133 kB
918 B
react
ColorPicker
130.032 kB
40.591 kB
132.885 kB
41.468 kB
2.853 kB
877 B
react
ComboBox
245.355 kB
70.51 kB
250.056 kB
71.808 kB
4.701 kB
1.298 kB
react
CommandBar
197.41 kB
58.464 kB
201.743 kB
59.788 kB
4.333 kB
1.324 kB
react
ContextualMenu
150.967 kB
46.982 kB
154.689 kB
48.034 kB
3.722 kB
1.052 kB
react
DatePicker
180.318 kB
54.947 kB
183.839 kB
56.049 kB
3.521 kB
1.102 kB
react
DetailsList
225.911 kB
64.65 kB
229.162 kB
65.581 kB
3.251 kB
931 B
react
Dialog
205.294 kB
61.428 kB
209.843 kB
62.766 kB
4.549 kB
1.338 kB
react
Divider
17.63 kB
6.234 kB
19.399 kB
6.798 kB
1.769 kB
564 B
react
DocumentCard
211.08 kB
62.793 kB
215.528 kB
64.047 kB
4.448 kB
1.254 kB
react
DraggableZone
33.345 kB
11.166 kB
34.109 kB
11.448 kB
764 B
282 B
react
Dropdown
227.809 kB
66.884 kB
232.488 kB
68.245 kB
4.679 kB
1.361 kB
react
ExtendedPicker
94.987 kB
27.297 kB
96.565 kB
27.809 kB
1.578 kB
512 B
react
Fabric
39.75 kB
13.688 kB
41.537 kB
14.283 kB
1.787 kB
595 B
react
Facepile
206.04 kB
61.687 kB
210.38 kB
62.993 kB
4.34 kB
1.306 kB
react
FloatingPicker
236.281 kB
67.376 kB
240.613 kB
68.613 kB
4.332 kB
1.237 kB
react
FocusTrapZone
15.831 kB
5.54 kB
16.975 kB
5.917 kB
1.144 kB
377 B
react
FocusZone
53.259 kB
16.869 kB
54.844 kB
17.402 kB
1.585 kB
533 B
react
Grid
175.918 kB
53.25 kB
180.249 kB
54.478 kB
4.331 kB
1.228 kB
react
GroupedList
131.707 kB
39.689 kB
134.596 kB
40.586 kB
2.889 kB
897 B
react
GroupedListV2
119.324 kB
36.822 kB
122.213 kB
37.691 kB
2.889 kB
869 B
react
HoverCard
93.735 kB
29.778 kB
96.869 kB
30.705 kB
3.134 kB
927 B
react
Icon
49.74 kB
16.603 kB
51.644 kB
17.197 kB
1.904 kB
594 B
react
Icons
65.829 kB
24.212 kB
66.305 kB
24.379 kB
476 B
167 B
react
Image
44.79 kB
15.024 kB
46.701 kB
15.646 kB
1.911 kB
622 B
react
Keytip
78.588 kB
25.825 kB
81.382 kB
26.67 kB
2.794 kB
845 B
react
KeytipData
13.585 kB
4.418 kB
13.969 kB
4.57 kB
384 B
152 B
react
KeytipLayer
100.422 kB
31.128 kB
103.178 kB
31.926 kB
2.756 kB
798 B
react
Keytips
103.175 kB
32.07 kB
105.946 kB
32.927 kB
2.771 kB
857 B
react
Label
36.347 kB
12.639 kB
38.134 kB
13.207 kB
1.787 kB
568 B
react
Layer
45.683 kB
15.585 kB
47.787 kB
16.255 kB
2.104 kB
670 B
react
Link
37.673 kB
12.993 kB
39.488 kB
13.614 kB
1.815 kB
621 B
react
List
38.136 kB
12.004 kB
39.138 kB
12.373 kB
1.002 kB
369 B
react
MarqueeSelection
72.119 kB
21.676 kB
74.321 kB
22.385 kB
2.202 kB
709 B
react
MessageBar
184.707 kB
55.523 kB
189.034 kB
56.739 kB
4.327 kB
1.216 kB
react
Modal
90.409 kB
29.213 kB
93.34 kB
30.146 kB
2.931 kB
933 B
react
Nav
183.442 kB
55.093 kB
187.831 kB
56.344 kB
4.389 kB
1.251 kB
react
OverflowSet
31.044 kB
10.593 kB
33.191 kB
11.252 kB
2.147 kB
659 B
react
Overlay
38.784 kB
13.401 kB
40.694 kB
14.023 kB
1.91 kB
622 B
react
Panel
194.946 kB
58.34 kB
199.554 kB
59.691 kB
4.608 kB
1.351 kB
react
Persona
111.753 kB
35.58 kB
114.517 kB
36.407 kB
2.764 kB
827 B
react
PersonaCoin
111.753 kB
35.58 kB
114.517 kB
36.407 kB
2.764 kB
827 B
react
PersonaPresence
55.928 kB
18.715 kB
57.833 kB
19.303 kB
1.905 kB
588 B
react
Pickers
287.867 kB
80.661 kB
292.299 kB
81.964 kB
4.432 kB
1.303 kB
react
Pivot
184.252 kB
55.823 kB
188.745 kB
57.061 kB
4.493 kB
1.238 kB
react
Popup
12.032 kB
4.114 kB
12.242 kB
4.181 kB
210 B
67 B
react
Positioning
21.821 kB
7.334 kB
22.608 kB
7.63 kB
787 B
296 B
react
PositioningContainer
70.754 kB
22.84 kB
73.543 kB
23.66 kB
2.789 kB
820 B
react
ProgressIndicator
37.498 kB
12.906 kB
39.286 kB
13.482 kB
1.788 kB
576 B
react
Rating
78.989 kB
25.18 kB
81.762 kB
26.057 kB
2.773 kB
877 B
react
Fluent UI React (entire library)
998.446 kB
277.16 kB
1.012 MB
280.966 kB
13.408 kB
3.806 kB
react
ScrollablePane
53.538 kB
17.113 kB
55.325 kB
17.669 kB
1.787 kB
556 B
react
SearchBox
182.982 kB
55.1 kB
187.309 kB
56.326 kB
4.327 kB
1.226 kB
react
SelectedItemsList
226.707 kB
66.319 kB
231.069 kB
67.581 kB
4.362 kB
1.262 kB
react
Selection
41.202 kB
11.839 kB
42.252 kB
12.203 kB
1.05 kB
364 B
react
Separator
33.397 kB
11.529 kB
35.183 kB
12.088 kB
1.786 kB
559 B
react
Shimmer
47.265 kB
15.632 kB
49.049 kB
16.206 kB
1.784 kB
574 B
react
ShimmeredDetailsList
236.679 kB
67.422 kB
239.937 kB
68.353 kB
3.258 kB
931 B
react
Slider
55.575 kB
18.574 kB
57.449 kB
19.143 kB
1.874 kB
569 B
react
SpinButton
186.661 kB
56.205 kB
191.037 kB
57.463 kB
4.376 kB
1.258 kB
react
Spinner
39.691 kB
13.815 kB
41.481 kB
14.412 kB
1.79 kB
597 B
react
Stack
40.761 kB
13.931 kB
41.547 kB
14.233 kB
786 B
302 B
react
Sticky
32.064 kB
10.324 kB
32.541 kB
10.49 kB
477 B
166 B
react
Styling
44.812 kB
14.688 kB
45.853 kB
15.082 kB
1.041 kB
394 B
react
SwatchColorPicker
186.166 kB
56.724 kB
190.575 kB
57.948 kB
4.409 kB
1.224 kB
react
TeachingBubble
200.004 kB
59.345 kB
204.585 kB
60.676 kB
4.581 kB
1.331 kB
react
Text
35.931 kB
12.486 kB
36.723 kB
12.763 kB
792 B
277 B
react
TextField
78.587 kB
24.642 kB
80.555 kB
25.262 kB
1.968 kB
620 B
react
Theme
42.456 kB
13.773 kB
43.321 kB
14.129 kB
865 B
356 B
react
TimePicker
235.197 kB
68.29 kB
239.898 kB
69.581 kB
4.701 kB
1.291 kB
react
Toggle
44.17 kB
15.346 kB
46.02 kB
15.903 kB
1.85 kB
557 B
react
Tooltip
84.273 kB
27.284 kB
87.036 kB
28.125 kB
2.763 kB
841 B
react
Utilities
71.851 kB
21.843 kB
82.495 kB
25.047 kB
10.644 kB
3.204 kB
react
Viewport
22.945 kB
7.292 kB
23.703 kB
7.589 kB
758 B
297 B
react
WeeklyDayPicker
98.762 kB
30.828 kB
101.682 kB
31.738 kB
2.92 kB
910 B
Unchanged fixtures
Package & Exports Size (minified/GZIP)
global-context
createContext
510 B
328 B
global-context
createContextSelector
537 B
339 B
keyboard-key
keyboard-key package
3.746 kB
1.928 kB
priority-overflow
createOverflowManager
4.447 kB
1.853 kB
react
Autofill
15.365 kB
4.743 kB
react
Color
7.737 kB
3.106 kB
react
DateTimeUtilities
5.244 kB
1.849 kB
react
DragDrop
8.343 kB
2.724 kB
react
ResizeGroup
13.286 kB
4.365 kB
react
ResponsiveMode
8.078 kB
2.95 kB
react
SelectableOption
724 B
413 B
react
ThemeGenerator
12.34 kB
4.106 kB
react
WindowProvider
1.059 kB
541 B
react-accordion
Accordion (including children components)
100.94 kB
30.574 kB
react-alert
Alert
83.737 kB
23.475 kB
react-avatar
Avatar
50.175 kB
15.944 kB
react-avatar
AvatarGroup
19.702 kB
7.794 kB
react-avatar
AvatarGroupItem
64.829 kB
20.272 kB
react-badge
Badge
26.905 kB
8.73 kB
react-badge
CounterBadge
27.806 kB
9.025 kB
react-badge
PresenceBadge
25.311 kB
9.307 kB
react-breadcrumb
@fluentui/react-breadcrumb - package
116.817 kB
32.173 kB
react-button
Button
39.513 kB
11.17 kB
react-button
CompoundButton
46.874 kB
12.662 kB
react-button
MenuButton
44.292 kB
12.544 kB
react-button
SplitButton
52.306 kB
14.135 kB
react-button
ToggleButton
56.558 kB
13.068 kB
react-calendar-compat
Calendar Compat
153.428 kB
40.128 kB
react-card
Card - All
103.992 kB
29.35 kB
react-card
Card
97.003 kB
27.61 kB
react-card
CardFooter
13.971 kB
5.626 kB
react-card
CardHeader
16.214 kB
6.386 kB
react-card
CardPreview
14.015 kB
5.752 kB
react-checkbox
Checkbox
35.656 kB
12.07 kB
react-combobox
Combobox (including child components)
103.128 kB
33.283 kB
react-combobox
Dropdown (including child components)
104.606 kB
33.244 kB
react-components
react-components: Button, FluentProvider & webLightTheme
71.104 kB
20.52 kB
react-components
react-components: Accordion, Button, FluentProvider, Image, Menu, Popover
221.098 kB
62.406 kB
react-components
react-components: FluentProvider & webLightTheme
43.591 kB
14.356 kB
react-components
react-components: entire library
1.056 MB
257.506 kB
react-datepicker-compat
DatePicker Compat
227.367 kB
63.503 kB
react-dialog
Dialog (including children components)
100.478 kB
30.071 kB
react-divider
Divider
20.922 kB
7.791 kB
react-field
Field
22.976 kB
8.722 kB
react-image
Image
15.745 kB
6.231 kB
react-infobutton
InfoButton
139.602 kB
43.628 kB
react-infobutton
InfoLabel
143.417 kB
44.844 kB
react-input
Input
28.122 kB
9.36 kB
react-jsx-runtime
Classic Pragma
1.057 kB
530 B
react-jsx-runtime
JSX Dev Runtime
3.781 kB
1.646 kB
react-jsx-runtime
JSX Runtime
4.377 kB
1.881 kB
react-label
Label
14.266 kB
5.829 kB
react-link
Link
17.082 kB
6.911 kB
react-menu
Menu (including children components)
153.638 kB
46.013 kB
react-menu
Menu (including selectable components)
156.324 kB
46.568 kB
react-message-bar
MessageBar (all components)
24.204 kB
8.983 kB
react-northstar
Accordion
85.392 kB
26.518 kB
react-northstar
Alert
87.45 kB
26.902 kB
react-northstar
Animation
55.34 kB
17.829 kB
react-northstar
Attachment
86.844 kB
26.692 kB
react-northstar
Avatar
80.279 kB
24.629 kB
react-northstar
Box
75.248 kB
23.806 kB
react-northstar
Breadcrumb
79.92 kB
24.709 kB
react-northstar
Button
83.16 kB
25.947 kB
react-northstar
Card
82.705 kB
25.023 kB
react-northstar
Carousel
105.182 kB
31.871 kB
react-northstar
Chat
152.378 kB
45.964 kB
react-northstar
Checkbox
79.807 kB
25.078 kB
react-northstar
Datepicker
184.939 kB
56.194 kB
react-northstar
Debug
8.801 kB
3.594 kB
react-northstar
Design
36.589 kB
12.067 kB
react-northstar
Dialog
112.058 kB
33.615 kB
react-northstar
Divider
76.619 kB
24.129 kB
react-northstar
Dropdown
196.499 kB
59.455 kB
react-northstar
Embed
81.477 kB
25.417 kB
react-northstar
Flex
47.728 kB
15.438 kB
react-northstar
Form
92.527 kB
28.879 kB
react-northstar
Grid
70.584 kB
22.278 kB
react-northstar
Header
74.756 kB
23.461 kB
react-northstar
Image
73.591 kB
23.329 kB
react-northstar
Input
88.346 kB
27.78 kB
react-northstar
ItemLayout
78.231 kB
24.454 kB
react-northstar
Label
77.92 kB
24.41 kB
react-northstar
Layout
75.393 kB
23.798 kB
react-northstar
List
88.493 kB
27.547 kB
react-northstar
Loader
78.616 kB
24.729 kB
react-northstar
Menu
126.89 kB
39.872 kB
react-northstar
MenuButton
161.296 kB
48.883 kB
react-northstar
Pill
83.722 kB
26.069 kB
react-northstar
Popup
133.604 kB
41.483 kB
react-northstar
Portal
58.338 kB
18.852 kB
react-northstar
Provider
93.138 kB
29.63 kB
react-northstar
RadioGroup
83.282 kB
26.053 kB
react-northstar
Reaction
77.28 kB
24.122 kB
react-northstar
Segment
76.209 kB
23.892 kB
react-northstar
Skeleton
77.765 kB
24.2 kB
react-northstar
Slider
84.27 kB
26.737 kB
react-northstar
SplitButton
176.534 kB
52.63 kB
react-northstar
Status
76.272 kB
24.05 kB
react-northstar
SvgIcon
36.823 kB
11.743 kB
react-northstar
Table
80.796 kB
25.154 kB
react-northstar
Text
74.114 kB
23.507 kB
react-northstar
TextArea
74.248 kB
23.492 kB
react-northstar
Toolbar
173.345 kB
52.08 kB
react-northstar
Tooltip
108.261 kB
34.482 kB
react-northstar
Tree
87.855 kB
27.217 kB
react-northstar
Video
75.411 kB
23.799 kB
react-overflow
hooks only
12.86 kB
4.825 kB
react-persona
Persona
57.066 kB
17.821 kB
react-popover
Popover
127.849 kB
40.049 kB
react-portal
Portal
13.717 kB
4.886 kB
react-portal-compat
PortalCompatProvider
7.944 kB
2.588 kB
react-positioning
usePositioning
26.398 kB
9.539 kB
react-progress
ProgressBar
17.428 kB
6.899 kB
react-provider
FluentProvider
23.765 kB
8.662 kB
react-radio
Radio
32.95 kB
10.252 kB
react-radio
RadioGroup
15.354 kB
6.265 kB
react-select
Select
28.609 kB
10.204 kB
react-slider
Slider
39.949 kB
12.968 kB
react-spinbutton
SpinButton
36.774 kB
11.789 kB
react-spinner
Spinner
24.673 kB
8.341 kB
react-swatch-picker-preview
@fluentui/react-swatch-picker-preview - package
108.469 kB
30.284 kB
react-switch
Switch
35.14 kB
11.199 kB
react-table
DataGrid
168.498 kB
46.732 kB
react-table
Table (Primitives only)
45.324 kB
14.116 kB
react-table
Table as DataGrid
137.918 kB
37.149 kB
react-table
Table (Selection only)
76.334 kB
20.553 kB
react-table
Table (Sort only)
74.977 kB
20.155 kB
react-tag-picker-preview
@fluentui/react-tag-picker-preview - package
185.641 kB
54.844 kB
react-tags
InteractionTag
15.299 kB
6.08 kB
react-tags
Tag
29.092 kB
9.418 kB
react-tags
TagGroup
82.044 kB
24.39 kB
react-text
Text - Default
16.705 kB
6.57 kB
react-text
Text - Wrappers
19.878 kB
6.897 kB
react-textarea
Textarea
30.947 kB
10.477 kB
react-theme
Single theme token import
69 B
89 B
react-theme
Teams: all themes
35.666 kB
7.453 kB
react-theme
Teams: Light theme
19.642 kB
5.549 kB
react-timepicker-compat
TimePicker
105.149 kB
34.653 kB
react-toast
Toast (including Toaster)
98.381 kB
29.706 kB
react-tooltip
Tooltip
54.664 kB
19.206 kB
react-utilities
SSRProvider
180 B
160 B
🤖 This report was generated against c3536e2bca834a1ca7570335c2b4bd905f7e8fcc

@fabricteam
Copy link
Collaborator

fabricteam commented Mar 1, 2024

Perf Analysis (@fluentui/react)

No significant results to display.

All results

Scenario Render type Master Ticks PR Ticks Iterations Status
BaseButton mount 626 642 5000
Breadcrumb mount 1729 1708 1000
Checkbox mount 1684 1696 5000
CheckboxBase mount 1475 1512 5000
ChoiceGroup mount 2930 3007 5000
ComboBox mount 654 669 1000
CommandBar mount 6221 6635 1000
ContextualMenu mount 13553 13838 1000
DefaultButton mount 742 820 5000
DetailsRow mount 2180 2225 5000
DetailsRowFast mount 2208 2238 5000
DetailsRowNoStyles mount 2029 2059 5000
Dialog mount 2670 2690 1000
DocumentCardTitle mount 230 239 1000
Dropdown mount 1978 2025 5000
FocusTrapZone mount 1150 1140 5000
FocusZone mount 1081 1087 5000
GroupedList mount 37468 42295 2
GroupedList virtual-rerender 20045 20359 2
GroupedList virtual-rerender-with-unmount 50807 51958 2
GroupedListV2 mount 246 232 2
GroupedListV2 virtual-rerender 220 210 2
GroupedListV2 virtual-rerender-with-unmount 227 230 2
IconButton mount 1091 1148 5000
Label mount 347 356 5000
Layer mount 2704 2773 5000
Link mount 403 399 5000
MenuButton mount 928 964 5000
MessageBar mount 21618 21640 5000
Nav mount 1951 2062 1000
OverflowSet mount 780 790 5000
Panel mount 1855 1780 1000
Persona mount 715 752 1000
Pivot mount 872 922 1000
PrimaryButton mount 852 928 5000
Rating mount 4642 4674 5000
SearchBox mount 897 951 5000
Shimmer mount 1853 1906 5000
Slider mount 1328 1335 5000
SpinButton mount 2911 3014 5000
Spinner mount 393 401 5000
SplitButton mount 1896 1899 5000
Stack mount 412 435 5000
StackWithIntrinsicChildren mount 858 862 5000
StackWithTextChildren mount 2622 2662 5000
SwatchColorPicker mount 6248 6424 5000
TagPicker mount 1449 1524 5000
Text mount 374 382 5000
TextField mount 919 930 5000
ThemeProvider mount 837 848 5000
ThemeProvider virtual-rerender 570 585 5000
ThemeProvider virtual-rerender-with-unmount 1280 1280 5000
Toggle mount 634 625 5000
buttonNative mount 197 199 5000

@Hotell
Copy link
Contributor

Hotell commented Mar 4, 2024

The bundle size increase all around the v8 are bit concerning tbh, have we measured the performance impact for users using v8 but not having need to ulitize web-components apis ?

wondering the effort of making the implementation be opt-in rather than all in ?

@spmonahan
Copy link
Contributor Author

The bundle size increase all around the v8 are bit concerning tbh, have we measured the performance impact for users using v8 but not having need to ulitize web-components apis ?

The existing perf tests do this because they are not using shadow DOM.

wondering the effort of making the implementation be opt-in rather than all in ?

The shadow DOM is opt in but, obviously, the code is not🙁 Looking into options to trim this back.

@fabricteam
Copy link
Collaborator

fabricteam commented Mar 8, 2024

Perf Analysis (@fluentui/react-components)

Scenario Render type Master Ticks PR Ticks Iterations Status
FluentProviderWithTheme virtual-rerender 35 28 10 Possible regression
All results

Scenario Render type Master Ticks PR Ticks Iterations Status
Avatar mount 621 660 5000
Button mount 295 296 5000
Field mount 1151 1120 5000
FluentProvider mount 693 706 5000
FluentProviderWithTheme mount 86 82 10
FluentProviderWithTheme virtual-rerender 35 28 10 Possible regression
FluentProviderWithTheme virtual-rerender-with-unmount 73 82 10
MakeStyles mount 840 855 50000
Persona mount 1770 1720 5000
SpinButton mount 1382 1438 5000
SwatchPicker mount 1546 1521 5000

@fabricteam
Copy link
Collaborator

fabricteam commented Mar 8, 2024

🕵 fluentuiv9 No visual regressions between this PR and main

@spmonahan
Copy link
Contributor Author

wondering the effort of making the implementation be opt-in rather than all in ?

@Hotell First: thank you for taking the time to review! I know this is a gigantic PR so I really appreciate the input!

I've refactored this PR quite a bit to bring the bundle size impact down. There will be some impact across the board because it's not possible to swap out the customizable and styled implementations that allow us to inject the shadow DOM feature at runtime and the existing merge-styles Stylesheet must have some knowledge of the new ShadowDomStylesheet. However, the actual shadow DOM implementation is now injected via context so non-shadow DOM users only pay for a small no-op implementation of the feature.

LMK what you think about this refactor and if you have any ideas to push the bundle size impact lower. That said, I feel the bundle impact is acceptable given this is a feature several teams are interested in and there are no runtime performance regressions.

packages/merge-styles/README.md Outdated Show resolved Hide resolved
@spmonahan
Copy link
Contributor Author

we will also add bundle size fixture for whole v8 react to see the bigger picture impact ( but we assume that the impact should be smaller as shared code from /Styling.ts /Utilities.ts should be bundled only once.

This was added in #31110. I've run it locally to get an initial result while investigating another way to push the bundle size down:

bundle size diff of entire library

For the entire library the bundle size diff is 3.836kb for a 1% increase.

@spmonahan
Copy link
Contributor Author

@Hotell I looked into what we might do about pushing the bundle size down in the styles. Ultimately I don't think it's worth the effort. The styles are plain JS functions so we cannot take advantage of React context to know if the style is being rendered inside a shadow root or not so we'd have to update the functions and plumb this state through. In addition to the added complexity of doing this it'll cut into and bundle size savings we'd achieve. From a bundle size point of view I think it'd be a net positive but from a complexity point of view I think it'd be a negative. If we need to revisit in the future it's always something we could implement later.

@spmonahan spmonahan merged commit 7181c43 into master Apr 19, 2024
23 checks passed
marcosmoura added a commit to marcosmoura/fluentui that referenced this pull request Apr 23, 2024
* master: (416 commits)
  fix: remove relative imports within stories which are invalid for creating 'show docs' and circular dep imports from cypress files (microsoft#31087)
  Fix overlapping bars on continuous axes (microsoft#31035)
  feat(scripts-tasks): implement ~36% faster type-check task (microsoft#31116)
  feat(workspace-plugin): implement split-library-in-two migration generator (microsoft#31086)
  applying package updates
  Sankey diagram: Support number formatting (microsoft#31113)
  Fix wrong position of hover callout in case of single data AreaChart (microsoft#30256)
  Combobox filtering bug fix (microsoft#31141)
  chore(react-tag-picker): adds text elliptical clipping example (microsoft#31114)
  docs: command cheat sheet (microsoft#30685)
  chore: refactor tests for createPresenceComponent() (microsoft#31137)
  Stable Release: TeachingPopover (microsoft#31112)
  applying package updates
  fix: SpinButton buttons now show correct visuals at bounds (microsoft#31126)
  feat: add accessibility docs to Link about color/underlines (microsoft#31121)
  fix: Table and DataGrid should not remove cells from the accessibility tree (microsoft#31068)
  Add shadow DOM support to `@fluentui/react` (Fluent v8) (microsoft#30689)
  fix(react-swatch-picker): fixes after bug bash (microsoft#31097)
  feat: unify v9 babel preset in all packages (microsoft#31088)
  applying package updates
  ...
marcosmoura added a commit to marcosmoura/fluentui that referenced this pull request Apr 23, 2024
* master: (416 commits)
  fix: remove relative imports within stories which are invalid for creating 'show docs' and circular dep imports from cypress files (microsoft#31087)
  Fix overlapping bars on continuous axes (microsoft#31035)
  feat(scripts-tasks): implement ~36% faster type-check task (microsoft#31116)
  feat(workspace-plugin): implement split-library-in-two migration generator (microsoft#31086)
  applying package updates
  Sankey diagram: Support number formatting (microsoft#31113)
  Fix wrong position of hover callout in case of single data AreaChart (microsoft#30256)
  Combobox filtering bug fix (microsoft#31141)
  chore(react-tag-picker): adds text elliptical clipping example (microsoft#31114)
  docs: command cheat sheet (microsoft#30685)
  chore: refactor tests for createPresenceComponent() (microsoft#31137)
  Stable Release: TeachingPopover (microsoft#31112)
  applying package updates
  fix: SpinButton buttons now show correct visuals at bounds (microsoft#31126)
  feat: add accessibility docs to Link about color/underlines (microsoft#31121)
  fix: Table and DataGrid should not remove cells from the accessibility tree (microsoft#31068)
  Add shadow DOM support to `@fluentui/react` (Fluent v8) (microsoft#30689)
  fix(react-swatch-picker): fixes after bug bash (microsoft#31097)
  feat: unify v9 babel preset in all packages (microsoft#31088)
  applying package updates
  ...
miroslavstastny pushed a commit to miroslavstastny/fluentui that referenced this pull request Jun 14, 2024
)

Co-authored-by: brwai <69223766+brwai@users.noreply.github.com>
Co-authored-by: KHMakoto <Humberto.Morimoto@microsoft.com>
@khmakoto khmakoto deleted the shadow-dom branch August 30, 2024 18:06
@khmakoto khmakoto restored the shadow-dom branch August 30, 2024 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Epic]: support rendering in Shadow DOM [Fluent UI React v8]
8 participants