Repository navigation
Conversation
pierreneter
left a comment
There was a problem hiding this comment.
Thank you, the five components are a sensible set and the built-in markup is otherwise unchanged.
One regression for hosts that pass no components, so I can't merge it yet:
DefaultDialog(src/react/ui.tsx:124) no longer putsde-dialog-extraon the prompt's extra button, andDialogActionhas no field for it..de-dialog-extra { margin-right: auto }is dead, so "Remove link" in the edit-link prompt moves from the left edge to beside Cancel / OK. The "built-in markup is unchanged" test intest/ui.test.tsxleaves the dialogs out, so nothing catches it. Please restore the class (anextraflag onDialogActionwould do) and add the dialogs to that test.
Non-blocking:
- A host
SelectgetsIconNames in its options, butIconis not exported, so it cannot draw the built-in icons. docs/theming.mddefinesButtonandSeparatorinline in JSX, which remounts every toolbar button on each host render. Please hoist them in the example.
I also found that toolbar overflow reserved a fixed 34px for “More tools,” which could clip wider host buttons. It now measures the rendered button’s width, with regression coverage. Verification: 553 unit tests, typecheck, library/SDK builds, package checks, and the full CI browser suite pass. Current |
pierreneter
left a comment
There was a problem hiding this comment.
Thanks, all three points are done: de-dialog-extra is back through DialogAction.extra and the dialogs are in the markup test, Icon is exported, and the docs example is hoisted.
Two things in the new code (line numbers are at 8fa9681):
src/react/edit/Toolbar.tsx:615: the More wrapper is measured after the row has already squeezed it, because.de-ebar-morewrap(styles.css:686) can shrink. Host More button<button>More tools</button>, 600px row, 17 items: in Chromium the wrapper is squeezed to 56px (natural width 78px), the effect stores 56, the cut stays the same and the label wraps. The e2e fixture gives the button a fixedwidth: 140, which cannot shrink, so the test passes.flex: noneon the wrapper fixes it.src/react/common/Dialog.tsx:48: the prompt's primary action is{ primary: true, submit: true }with noonClick. It only works when the host renders it as a submit button inside a form. A host Dialog that putsactionsin a footer outside the form (MUIDialogActions, a Radix footer) gets an OK button that does nothing. Giving the actiononClick: done, and skippingonClickfor submit buttons inDefaultDialog, covers both.
It also needs a rebase onto main (conflicts in docs/api.md and src/react/DocViewer.tsx), and at its current head it conflicts with #6 in four files. See my note on #9 about the order of the stack.
Non-blocking:
- The overflow effect has no deps and calls
getBoundingClientRect()on every toolbar render. It also changes the built-in toolbar: the reserve was 34 and the built-in wrapper measures 28, so one more item can fit and the slack is gone. Rendering More in the measuring pass and measuring it with the items needs no guess and no second effect. - Item widths are cached by
sig(type name and title), which does not change whencomponentsdoes, for example throughmount().update({ components }). The cut is then computed from the old widths. - A host
Selectthat portals its list cannot be used inside the overflow popover or aPop:useDismiss(Toolbar.tsx:239) checks DOM containment, so the popover closes on mousedown andonChangenever fires. That deserves a line in the docs at least. Dialog.tsx:25:PromptDialogfocuses and selects its input in a mount-only effect. With a host Dialog that mounts its children one pass later, nothing is focused and the rename text is not preselected. A callback ref would do.SelectProps.iconis anIconNamestring whileButtonProps.iconis a node, and the docs table forSelectleaves outicon,classNameand whatlabel: nullmeans. A host that writes{p.icon}{p.label}as for Button shows the literal name.docs/theming.md:113says the size list goes throughSelect, butSizeBoxhas its own listbox. The Page setup, Header / footer and Details dialogs and the border-picker buttons keep the built-in markup as well.src/react/ui.tsx:106: a nestedOfficeUIProviderwithoutlocaleresets the texts to English, while icons and components merge with the outer one. And{ ...outer, ...components }lets an explicitundefinederase the outer component.docs/theming.md:110: the new table is not column-aligned.
A host can render its own Button, Select, Separator, Dialog and Toast in the
engine's toolbars and dialogs (`components` prop, UIComponentsProvider), for
a design system's controls where design tokens are not enough. Each one left
out keeps the built-in one, whose markup is unchanged.
- every toolbar button goes through Button: Btn, the color, picker and
overflow toggles, the font size steps; Dropdown/Select through Select
- PromptDialog and ConfirmDialog build their actions and body and render
them through Dialog; Toast keeps its timer and renders through Toast
- OfficeUIProvider carries icons, components, locale and strings to views
mounted without DocViewer
- the overflow button's title is its accessible name ("More tools"), so the
unused "More" text goes
- docs/theming.md "Your own components"; unit tests for each component and
nested providers; e2e with host components: toolbar, formatting keeps the
selection, overflow at a narrow width, the link prompt
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
8fa9681 to
e21a9fb
Compare
|
Fixed natural-width measurement for “More tools,” including component replacement and wrapper shrinking. Prompt actions now work with host footers outside the form, submit once, and focus delayed inputs correctly. Also addressed provider inheritance, same-React-tree Select portals, and documentation limits. Replaced exact HTML assertions with parsed-element checks and removed the unused Rebased onto #6. Build, typecheck and browser regressions pass locally. Upstream integration note: this candidate was reviewed and tested against |
The texts upstream added meanwhile go through the strings table, in English and German: Duplicate sheet (now a real copy of the sheet), the custom number format picker, the fill and merged-paste limits, the message after a merge drops values, the cell field's label, and the unsupported-file error saying what the file is instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pierreneter
left a comment
There was a problem hiding this comment.
Thanks, both points and the non-blocking ones are done. I checked at b66f919:
- More is measured at its natural width (
flex: none, and it is in the measuring pass). - The prompt's OK works from a footer outside the form and submits once.
- The widths are re-measured when
componentschange. - A portaled Select in the same React tree works inside the overflow menu and a
Pop. - The prompt input gets focus with a late-mounting host Dialog.
- Nested providers inherit, and an explicit
undefineddoes not erase the outer component.
In the VM, the unit tests (1218), the build, and the ui-layout, components, ui-built, locale-built and icons browser suites all pass. Nothing blocking from my side.
Non-blocking:
src/react/edit/Toolbar.tsx:594and:626-643: item widths are measured only whenmeasurementchanges, and the ResizeObserver watches only the row. A hostSelectthat sizes itself to its label (many design-system selects ignorewidth) grows when its value changes. The cut then stays where it was and More is pushed out of the row. A probe with a 400px row, a font Select and 16 buttons, after switching from "Arial" to a long font name: the Select grew from 43 to 236px, the cut stayed at 11, and More ended at x = 581. A window resize reuses the cached widths, so it stays there. Observing the[data-i]wrappers and the More wrapper as well would fix it. At least the docs could say that a host Select must keep the width it is given.- With no
components, one more item can now fit than onmain, because the built-in More measures 28px where 34 was reserved. In a sweep of 300-540px rows this happened at 48 of 241 widths, and More never overflowed. I'm fine with that, just noting it as a visible change. docs/theming.md:123-124says SizeBox keeps the built-in markup, but its − / + buttons go through the hostButton(Toolbar.tsx:515, 552).docs/api.md:77: the newcomponentsrow is wider than the rest of the table, so its pipes don't line up.
Hosts can supply
Button,Select,Separator,DialogandToastimplementations to use their design system in the viewer. Omitted components keep the built-in versions. Define the custom component types outside render so toolbar controls stay mounted.Toolbar overflow reserves the natural width of the host's “More tools” button and measures again when component types change. Prompt actions work when a host puts the footer outside the form, and delayed inputs receive focus when they mount. Select portals within the same React tree work in popovers. The theming guide documents the props, built-in exceptions and focus behavior.
This layer follows #6 in the stack and includes v0.17.0. Regression coverage checks the rendered controls, keyboard and pointer interactions, prompts and layout.