Prerequisites
Describe the Feature Request
Stencil's createShadowRoot currently builds its options from mode, delegatesFocus and slotAssignment. There is no way for a component author to request clonable, and no way to reach the attachShadow call to set it.
The request is to expose it the same way delegatesFocus and slotAssignment already are.
Describe the Use Case
Any library that measures or duplicates DOM through cloneNode gets an empty element back when it reaches a Stencil shadow component, because the shadow root is silently dropped.
We hit this with AG Grid's column auto-sizing. To size a column to its contents, AG Grid deep clones the cell into an off screen container, reads offsetWidth, then discards the dummy clone. When a cell contains a Stencil shadow component the clone is an empty shell, so the measurement comes back at zero and the column collapses to the width of its header.
Describe Preferred Solution
Mirror the native option, exactly as the existing two options.
- Add a
clonable option to ShadowRootOptions.
- Add a
shadowClonable bit to CMP_FLAGS, set from the decorator at compile time.
- Set it in
createShadowRoot, behind a build flag like the existing BUILD.shadowDelegatesFocus.
Describe Alternatives
Patching the runtime.
Related Code
No response
Additional Information
No response
Prerequisites
Describe the Feature Request
Stencil's
createShadowRootcurrently builds its options frommode,delegatesFocusandslotAssignment. There is no way for a component author to requestclonable, and no way to reach theattachShadowcall to set it.The request is to expose it the same way
delegatesFocusandslotAssignmentalready are.Describe the Use Case
Any library that measures or duplicates DOM through
cloneNodegets an empty element back when it reaches a Stencil shadow component, because the shadow root is silently dropped.We hit this with AG Grid's column auto-sizing. To size a column to its contents, AG Grid deep clones the cell into an off screen container, reads
offsetWidth, then discards the dummy clone. When a cell contains a Stencil shadow component the clone is an empty shell, so the measurement comes back at zero and the column collapses to the width of its header.Describe Preferred Solution
Mirror the native option, exactly as the existing two options.
clonableoption to ShadowRootOptions.shadowClonablebit toCMP_FLAGS, set from the decorator at compile time.createShadowRoot, behind a build flag like the existingBUILD.shadowDelegatesFocus.Describe Alternatives
Patching the runtime.
Related Code
No response
Additional Information
No response