DocsCore concepts

Scoped DOM

Initialize an explicit root with mountJuliyaScope, selector rules and optional CSS properties. Code blocks and controls remain excluded; inline code is protected.

Mount and cleanup

Only include selectors or data-juliya opted-in elements are managed. Call refresh for external stylesheet changes, update for new configuration, and destroy when removing the container.

ts
import { mountJuliyaScope } from '@oddmash/juliya/dom';
const scope = mountJuliyaScope(root, { include: ['h1', 'p'], locale: 'en' });
scope.destroy();

Targets and exclusions

Use exclude or data-juliya-ignore to opt out. Nested scopes belong to the nearest owner; code blocks, editable elements and controls are excluded. Inline code is protected; if a planned break crosses it, the paragraph uses native wrapping. Existing inline nodes and styles are preserved on cleanup.

CSS options

After scope initialization, --juliya-locale, --juliya-strategy and --juliya-break-long-words override selector rules; valid data-juliya-* attributes take precedence. CSS alone does not start the engine.

css
.article p {
  --juliya-strategy: balanced;
  --juliya-break-long-words: true;
}
@media (max-width: 480px) {
  .article p { --juliya-strategy: greedy; }
}