DocsFrameworks

Svelte

Use the action on an element. Reactive options update the measured wrapping; removing the element cleans up the controller.

Basic action

Attach the juliya action with options to an element that has a measurable width.

svelte
<script>
import { juliya } from '@oddmash/juliya/svelte';
let text = "Read every line naturally.";
</script>
<p use:juliya={{ text, locale: 'en' }}></p>

Language selection

Pass the locale explicitly for multilingual apps; omitted locale is Korean.

Required options

Pass text or inline: true, not both.

OptionRequiredDefaultPurpose
textConditional-Source for string mode; omit in inline mode
inlineConditionalfalseSet true for existing inline markup
localeOptionalkoLanguage rules; React also reads the nearest Provider
strategyOptionalbalancedBalanced or greedy layout
breakLongWordsOptionaltrueAllow grapheme-safe splits for overlong words
forcedBreaksOptional-Source UTF-16 boundary offsets

Inline markup

For trusted externally rendered HTML use juliyaScope; do not mutate Svelte-owned dynamic text from both paths.

svelte
<p use:juliya={{ inline: true }}><strong>Read every line naturally.</strong></p>

State changes and forced boundaries

Reactive action parameters call update; removal calls destroy. Keep forced UTF-16 offsets in sync with the text.

SvelteKit and SSR

Render consistent server content first and enhance after browser hydration.