Skip to content

Public Symbols

@nhtio/lucid-resourceful-vue-components/symbols

Low-level injection symbols and related validation/display types intended for advanced integrations. In most cases you should prefer the provided composables (useIoC, useScopedDisplay, useValidation, etc.). Reach for these exports only when you need to:

  • Provide/override the IoC container in a non-standard mount environment.
  • Manually inject a scoped display instance inside custom wrapper components.
  • Bridge Resourceful Record or Record Form internals into deeply nested custom components without prop drilling.
  • Access the Resourceful Record event bus consumer directly (advanced orchestration / testing).

When (not) to use them

Use symbols when constructor‑level or plugin‑level setup is required that composables cannot cover (e.g. SSR hydration, micro‑frontend shells, cross‑app portals). Avoid them for routine component logic—composables handle lifecycle scoping and future internal changes.

Injection Symbols

SymbolPurposeTypical ProviderFallback If Missing
IoCSymbolRoot service container (i18n, http, cache, timezones, etc.)Plugin install (createApp().use(...))Hard failure / undefined behavior
ResourcefulIndexScopedDisplaySymbolDisplay/orientation context for a single ResourcefulIndex instanceInternal mount of ResourcefulIndexNot injected → responsive heuristics degrade
ResourcefulRecordScopedDisplaySymbolDisplay/orientation for ResourcefulRecordResourcefulRecord componentSimilar orientation fallback
ResourcefulRecordScopedBusConsumerSymbolEvent bus consumer for record form actions (submit, reset, setFieldValue, etc.)ResourcefulRecordProgrammatic form control lost
ResourcefulRecordFormScopedDisplaySymbolDisplay scope for nested record form componentRecord form wrapperLayout decisions fall back to global display
ResourcefulRecordFormScopedBusConsumerSymbolEvent bus consumer within form‑scoped contextRecord form wrapperLocalized form event dispatch not available

These are re-exported here for convenience when working with the above symbols.

  • InjectionKey — Vue DI key type.
  • ScopedDisplayInstance, ScopedDisplayOrientation — Encapsulated viewport/orientation metrics for container‑scoped responsive logic.
  • Validation surface: useValidation, ValidationProps, ValidationFieldBindings, VInputPublicProps, VFieldPublicProps, VeeValidateStateVInputProps, DefinedField, DataTypeOf, MaybePromise.
  • ResourcefulRecordBusConsumer, ResourcefulRecordBusEventMap — Programmatic record form actions & events.

Example: Custom Plugin Override

Providing a custom IoC instance (SSR or multi‑tenant shell):

ts
import { IoCSymbol } from '@nhtio/lucid-resourceful-vue-components/symbols'
import { createApp } from 'vue'
import App from './App.vue'

const app = createApp(App)
app.provide(IoCSymbol, myCustomIoc) // Advanced use: supply pre-wired services
app.mount('#app')

Example: Access Record Bus Directly

ts
import { ResourcefulRecordScopedBusConsumerSymbol } from '@nhtio/lucid-resourceful-vue-components/symbols'
import { inject } from 'vue'

const bus = inject(ResourcefulRecordScopedBusConsumerSymbol)
bus?.on('doFormSubmit', () => {
  // instrumentation / analytics
})

Cautions

  • Symbols are internal contracts: minor version bumps may refine behavior (names will remain stable, but emitted event payloads could evolve). Prefer composables unless you truly need the raw channel.
  • Avoid leaking injected instances across async boundaries that outlive component trees (retain weak references or clone data).
  • Always null‑check injected symbols; consumer components may be rendered outside expected providers during tests.

For most consumers, the IoC and Components docs provide the higher-level extension points you need.