createShadowModule() function
Home > @rimitive/view > createShadowModule
createShadowModule() function
Section titled “createShadowModule() function”Create a Shadow module for a given adapter.
Signature:
createShadowModule: <TConfig extends TreeConfig>(adapter: Adapter<TConfig>) => Module<"shadow", ShadowService<NodeOf<TConfig>>, { scopes: CreateScopes;}>Parameters
Section titled “Parameters”|
Parameter |
Type |
Description |
|---|---|---|
|
adapter |
Adapter<TConfig> |
Returns:
Module<“shadow”, ShadowService<NodeOf<TConfig>>, { scopes: CreateScopes; }>
Example
Section titled “Example”import { compose } from '@rimitive/core';import { createShadowModule } from '@rimitive/view/shadow';import { createDOMAdapter } from '@rimitive/view/adapters/dom';
const adapter = createDOMAdapter();const ShadowModule = createShadowModule(adapter);
const { shadow, el } = compose(ElModule, ShadowModule);
el('div')( shadow({ mode: 'open', styles: css })( el('p')('Isolated content') ))