Primitives / foldkit-primitives/interaction

Layers

namespace · packages/primitives/src/interaction/layers.ts:7

export * as Layers from './layers.js'

ScrollLock and HideOutside as Behaviors: each attaches its foldkit-primitives/dom Mount to a container slot. No Bundle, because the lock and the inert set are document facts Foldkit already refcounts and keys.

In the guides

Members

Layers.hideOutside

const · packages/primitives/src/interaction/layers.ts:34

const hideOutside: <Slots>(
  slots: Slots,
) => <Input, ParentMessage>(options: {
  readonly container: keyof Slots & string
}) => Behavior.NamedBehavior<Slots, Input, ParentMessage>

Marks everything outside the container inert while it is mounted.

Layers.hideOutsideMount

const · packages/primitives/src/dom/layers.ts:28

const hideOutsideMount: Mount.MountDefinitionNoArgs<'HideOutside', never>

Makes everything outside the element inert while it is mounted, and restores it after.

Layers.scrollLock

const · packages/primitives/src/interaction/layers.ts:31

const scrollLock: <Slots>(
  slots: Slots,
) => <Input, ParentMessage>(options: {
  readonly container: keyof Slots & string
}) => Behavior.NamedBehavior<Slots, Input, ParentMessage>

Locks the document's scroll while the container is mounted; nested locks release together.

Layers.scrollLockMount

const · packages/primitives/src/dom/layers.ts:17

const scrollLockMount: Mount.MountDefinitionNoArgs<'ScrollLock', never>

Locks the document's scroll while the element is mounted; nested locks release with the last.