@nura-js/svelte
v0.1.1
Published
Svelte adapter for Nura.js
Maintainers
Readme
@nura-js/svelte
Official Svelte adapter that initializes Nura.js with stores, actions, and DOM-aware components.
Installation
pnpm add @nura-js/svelteUsage Example
<script lang="ts">
import { initNura, NuraProvider, nuraAction } from '@nura-js/svelte';
import { defineActionSpec } from '@nura-js/core';
const { registry } = initNura({
actions: [
defineActionSpec({ name: 'open_orders', type: 'open', target: 'orders' }),
],
});
</script>
<NuraProvider {registry}>
<button use:nuraAction={{ name: 'open_orders' }} data-nu-scope="orders">
Open orders
</button>
</NuraProvider>Key APIs
initNuracreates the registry and shares context across the Svelte tree.NuraProviderexposes context anddata-nu-*helpers.nurasyncs interaction telemetry via a generic action.nuraActionregisters intents and executes actions from elements.createNuraStorebuilds derived stores for runtime helpers and permissions.
Type References
NuraContext— shared context with registry and DOM indexer.NuraActionParams— parameters for thenuraaction (scope, metadata, etc.).UseNuraReturn— helper result for accessing the runtime in scripts.UseNuraActionOptions— configuration for retrieving reactive actions.
Additional Resources
- Repository: https://github.com/nura-ia/nurajs
- Issues: https://github.com/nura-ia/nurajs/issues
