DocsFrameworks

Framework scopes

Vue and Svelte expose scope directives and actions with the shared JSON settings.

Vue 3

The scope directive removes prior DOM mutations before Vue updates and reapplies after the update. Validate the same JSON settings as the DOM API.

vue
<script setup>
import { parseConfig } from '@oddmash/juliya';
import { juliyaScopeDirective as vJuliyaScope } from '@oddmash/juliya/vue';
import raw from './juliya.json';
const config = parseConfig(raw);
</script>
<template><article v-juliya-scope="config"><p>Text</p></article></template>

Svelte

The scope action is for externally owned markup or trusted {@html} content. For dynamic strings rendered by Svelte use the individual action. The caller sanitizes the HTML.

svelte
<script>
  import { parseConfig } from '@oddmash/juliya';
  import { juliyaScope } from '@oddmash/juliya/svelte';
  import raw from './juliya.json';
  const config = parseConfig(raw);
</script>
<article use:juliyaScope={config}>{@html sanitizedHtml}</article>