Extras
The extras
config contains options to enable new/experimental features in
Rindo, add & remove runtime for DOM features that require manipulations to
polyfills, etc. For example, not all DOM APIs are fully polyfilled when using
the Slot polyfill. Most of these are opt-in, since not all users require the
additional runtime.
appendChildSlotFix​
By default, the slot polyfill does not update appendChild()
so that it appends new child nodes into the correct child slot like how shadow dom works. This is an opt-in polyfill for those who need it.
cloneNodeFix​
By default, the runtime does not polyfill cloneNode()
when cloning a component that uses the slot polyfill. This is an opt-in polyfill for those who need it.
enableImportInjection​
In some cases, it can be difficult to lazily load Rindo components in a separate project that uses a bundler such as Wite.
Enabling this flag will allow downstream projects that consume a Rindo library and use a bundler such as Wite to lazily load the Rindo library's components.
In order for this flag to work:
- The Rindo library must expose lazy loadable components, such as those created with the
dist
output target - The Rindo library must be recompiled with this flag set to
true
This flag works by creating dynamic import statements for every lazily loadable component in a Rindo project. Users of this flag should note that they may see an increase in their bundle size.
Defaults to false
.
experimentalImportInjection​
This flag has been deprecated in favor of enableImportInjection
, which provides the same
functionality. experimentalImportInjection
will be removed in a future major version of Rindo.
In some cases, it can be difficult to lazily load Rindo components in a separate project that uses a bundler such as Wite.
This is an experimental flag that, when set to true
, will allow downstream projects that consume a Rindo library
and use a bundler such as Wite to lazily load the Rindo library's components.
In order for this flag to work:
- The Rindo library must expose lazy loadable components, such as those created with the
dist
output target - The Rindo library must be recompiled with this flag set to
true
This flag works by creating dynamic import statements for every lazily loadable component in a Rindo project. Users of this flag should note that they may see an increase in their bundle size.
Defaults to false
.
experimentalScopedSlotChanges​
This option updates runtime behavior for Rindo's support of slots in scoped components to match more closely with the native Shadow DOM behaviors.
When set to true
, the following behaviors will be applied:
- Rindo will hide projected nodes that do not have a destination
slot
- The
textContent
getter will return the text content of all nodes located in a slot - The
textContent
setter will overwrite all nodes located in a slot
Defaults to false
.
These behaviors only apply to components using scoped encapsulation!
experimentalSlotFixes​
This option enables all current and future slot-related fixes. When enabled it will enable the following options, overriding their values if they are specified separately:
Slot-related fixes to the runtime will be added over the course of Rindo v4,
with the intent of making these the default behavior in Rindo v5. When set to
true
fixes for the following issues will be applied:
- Elements rendered outside of slot when shadow not enabled
- A slot gets the attribute hidden when it shouldn't
- Nested slots mis-ordered when not using Shadow DOM
- Inconsistent behavior: slot-fb breaks styling of default slot content in component with 'shadow: false'
- Slot content went missing within dynamic component
- Slot element loses its parent reference and disappears when its parent is rendered conditionally
- Failed to execute 'removeChild' on 'Node'
- React fails to manage children in Rindo slot
- Slot name is not updated when it is bind to a prop
- Conditionally rendered slots not working
New fixes enabled by this experimental flag are not subject to Rindo's semantic versioning policy.
lifecycleDOMEvents​
Dispatches component lifecycle events. By default these events are not dispatched, but by enabling this to true
these events can be listened for on window
. Mainly used for testing.
Event Name | Description |
---|---|
rindo_componentWillLoad | Dispatched for each component's componentWillLoad . |
rindo_componentWillUpdate | Dispatched for each component's componentWillUpdate . |
rindo_componentWillRender | Dispatched for each component's componentWillRender . |
rindo_componentDidLoad | Dispatched for each component's componentDidLoad . |
rindo_componentDidUpdate | Dispatched for each component's componentDidUpdate . |
rindo_componentDidRender | Dispatched for each component's componentDidRender . |
scopedSlotTextContentFix​
An experimental flag that when set to true
, aligns the behavior of invoking the textContent
getter/setter on a scoped component to act more like a component that uses the shadow DOM. Specifically, invoking textContent
on a component will adhere to the return values described in MDN's article on textContent. Defaults to false
.
scriptDataOpts​
It is possible to assign data to the actual <script>
element's data-opts
property, which then gets passed to Rindo's initial bootstrap. This feature is only required for very special cases and rarely needed. When set to false
it will not read this data. Defaults to false
.
slotChildNodesFix​
For browsers that do not support shadow dom (IE11 and Edge 18 and below), slot is polyfilled to simulate the same behavior. However, the host element's childNodes
and children
getters are not patched to only show the child nodes and elements of the default slot. Defaults to false
.