ngx-json-render 0.7.3 → 0.7.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -25,9 +25,16 @@ ng add ngx-json-render
25
25
  npm install ngx-json-render @json-render/core zod
26
26
  ```
27
27
 
28
- Requires Angular ≥ 20. CI proves both ends of that range on every push: the
29
- library builds and its suite passes on Angular 20 (the floor) and on Angular
30
- 22 (the current release), as well as on the 21 the workspace itself pins.
28
+ Requires Angular ≥ 19. CI proves both ends of that range on every push: the
29
+ library builds on Angular 19 (the floor), and its suite passes on 20 and on
30
+ 22 (the current release) as well as on the 21 the workspace itself pins —
31
+ Angular 19's CLI has no unit-test builder to run it with. What npm serves is
32
+ checked too: the package built on 21 is installed into a fresh app on 19, 20
33
+ and 22, built with strict templates and driven in Chrome. On Angular 19 the
34
+ `ngx-json-render/testing` harness uses 19's
35
+ `provideExperimentalZonelessChangeDetection` by itself. The Material catalog,
36
+ [`ngx-json-render-material`](../ngx-json-render-material/README.md), needs
37
+ Angular ≥ 20.
31
38
  The same goes for `@json-render/core`: 0.20 and 0.21 are both admitted
32
39
  (`>=0.20.0 <0.22.0`), the workspace pins the newest and CI tests the floor.
33
40
 
@@ -1,6 +1,6 @@
1
1
  import { NgComponentOutlet } from '@angular/common';
2
2
  import * as i0 from '@angular/core';
3
- import { provideZonelessChangeDetection, inject, Injector, signal, ChangeDetectionStrategy, Component, computed, isDevMode } from '@angular/core';
3
+ import { inject, Injector, signal, ChangeDetectionStrategy, Component, computed, isDevMode } from '@angular/core';
4
4
  import { TestBed } from '@angular/core/testing';
5
5
  import { RENDER_CONTEXT, ELEMENT_KEY, JsonRenderer, JsonRenderValidationService } from 'ngx-json-render';
6
6
 
@@ -170,6 +170,24 @@ function usageLine(usage) {
170
170
  *
171
171
  * @internal Not exported from the entry point.
172
172
  */
173
+ /**
174
+ * Zoneless change detection, under whichever name this Angular exports it.
175
+ *
176
+ * Angular 19 calls it `provideExperimentalZonelessChangeDetection`, 20 renamed
177
+ * it `provideZonelessChangeDetection`, and 21 dropped the old name. The peer
178
+ * range spans both, so neither can be a named import: whichever one the
179
+ * consumer's Angular lacks would fail their bundler with a missing export.
180
+ * `core` is a parameter only so the fallback can be tested on a newer Angular.
181
+ */
182
+ function zonelessChangeDetection(core = i0) {
183
+ const named = core;
184
+ const provide = named['provideZonelessChangeDetection'] ??
185
+ named['provideExperimentalZonelessChangeDetection'];
186
+ if (!provide) {
187
+ throw new Error('ngx-json-render/testing: this @angular/core exports no zoneless change detection provider.');
188
+ }
189
+ return provide();
190
+ }
173
191
  /**
174
192
  * Configure the TestBed, unless the test already did.
175
193
  *
@@ -181,7 +199,7 @@ function usageLine(usage) {
181
199
  function configureTestBed(caller, providers) {
182
200
  try {
183
201
  TestBed.configureTestingModule({
184
- providers: [provideZonelessChangeDetection(), ...providers],
202
+ providers: [zonelessChangeDetection(), ...providers],
185
203
  });
186
204
  }
187
205
  catch {
@@ -1 +1 @@
1
- {"version":3,"file":"ngx-json-render-testing.mjs","sources":["../../../projects/ngx-json-render/testing/src/recorded-transport.ts","../../../projects/ngx-json-render/testing/src/fixture-helpers.ts","../../../projects/ngx-json-render/testing/src/render-component.ts","../../../projects/ngx-json-render/testing/src/render-spec.ts","../../../projects/ngx-json-render/testing/src/public-api.ts","../../../projects/ngx-json-render/testing/src/ngx-json-render-testing.ts"],"sourcesContent":["import type { Spec } from '@json-render/core';\n\n/**\n * The lines of one recorded response body, in the order the server sent them,\n * without their trailing newlines.\n */\nexport type Recording = readonly string[];\n\n/**\n * What to replay for a request. Either one recording for every request, a\n * lookup by prompt, or a function for anything more involved.\n */\nexport type Recordings =\n | Recording\n | Readonly<Record<string, Recording>>\n | ((\n prompt: string,\n body: Readonly<Record<string, unknown>>,\n ) => Recording | undefined);\n\n/** An error the recorded server answers with instead of a stream. */\nexport interface RecordedFailure {\n /** HTTP status. Defaults to 500. */\n status?: number;\n /** The `message` field of the JSON error body. */\n message?: string;\n}\n\n/** Options for {@link recordedTransport}. */\nexport interface RecordedTransportOptions {\n /**\n * Milliseconds between lines — the pace a model would emit them at.\n * Defaults to 0, which still yields to the event loop between lines, so a\n * test can observe the stream in flight.\n */\n delayMs?: number;\n /**\n * Answer with an error instead of a stream. A function is called per\n * request, so a test can turn the failure on and off between sends.\n */\n fail?: RecordedFailure | (() => RecordedFailure | null | undefined);\n /**\n * Pull the prompt out of the request body. The default reads `prompt`\n * (what `injectUIStream` sends) and falls back to the last message's\n * content (what `injectChatUI` sends).\n */\n promptOf?: (body: Readonly<Record<string, unknown>>) => string;\n}\n\n/** The rejection `fetch` raises when its signal fires. */\nfunction abortError(): Error {\n const error = new Error('The operation was aborted.');\n error.name = 'AbortError';\n return error;\n}\n\n/** A JSON error body, shaped the way the streaming hooks read it. */\nfunction errorResponse(status: number, message: string): Response {\n return new Response(JSON.stringify({ message }), {\n status,\n headers: { 'Content-Type': 'application/json' },\n });\n}\n\nfunction parseBody(body: BodyInit | null | undefined): Record<string, unknown> {\n try {\n const parsed: unknown = JSON.parse(String(body ?? '{}'));\n return parsed && typeof parsed === 'object'\n ? (parsed as Record<string, unknown>)\n : {};\n } catch {\n return {};\n }\n}\n\n/**\n * The prompt of a request, from either hook's body shape. Both are the\n * package's own, so the default knows them and a test does not have to.\n */\nfunction defaultPromptOf(body: Readonly<Record<string, unknown>>): string {\n const prompt = body['prompt'];\n if (typeof prompt === 'string') return prompt;\n\n const messages = body['messages'];\n if (!Array.isArray(messages) || messages.length === 0) return '';\n const last: unknown = messages[messages.length - 1];\n const content = (last as { content?: unknown } | null)?.content;\n return typeof content === 'string' ? content : '';\n}\n\nfunction toFinder(\n recordings: Recordings,\n): (prompt: string, body: Record<string, unknown>) => Recording | undefined {\n if (typeof recordings === 'function') return recordings;\n if (Array.isArray(recordings)) return () => recordings as Recording;\n const byPrompt = recordings as Readonly<Record<string, Recording>>;\n return (prompt) => byPrompt[prompt];\n}\n\nfunction replay(\n lines: Recording,\n delayMs: number,\n signal: AbortSignal | null,\n): ReadableStream<Uint8Array> {\n const encoder = new TextEncoder();\n return new ReadableStream<Uint8Array>({\n start(controller) {\n let index = 0;\n let timer: ReturnType<typeof setTimeout> | null = null;\n\n // A superseded or stopped generation has to die mid-flight the way a\n // real request does, or a test of that behaviour proves nothing.\n const onAbort = () => {\n if (timer) clearTimeout(timer);\n controller.error(abortError());\n };\n signal?.addEventListener('abort', onAbort, { once: true });\n\n const push = () => {\n if (index >= lines.length) {\n signal?.removeEventListener('abort', onAbort);\n controller.close();\n return;\n }\n controller.enqueue(encoder.encode(`${lines[index++]}\\n`));\n timer = setTimeout(push, delayMs);\n };\n timer = setTimeout(push, delayMs);\n },\n });\n}\n\n/**\n * A `fetch` that answers the streaming hooks from a recording instead of a\n * server.\n *\n * Both {@link injectUIStream} and {@link injectChatUI} take any function with\n * fetch's shape, so a test runs the real client — request body, streamed\n * lines, usage metadata, abort on supersede — with no server, no API key and\n * no global patched behind the test's back. Only the transport is recorded.\n *\n * @example\n * ```ts\n * const ui = injectUIStream({\n * api: '/api/generate',\n * fetch: recordedTransport(specStream(spec)),\n * });\n * ```\n *\n * @example Different answers per prompt, at a visible pace:\n * ```ts\n * recordedTransport(\n * { 'a dashboard': specStream(dashboard), 'a form': specStream(form) },\n * { delayMs: 20 },\n * );\n * ```\n */\nexport function recordedTransport(\n recordings: Recordings,\n options: RecordedTransportOptions = {},\n): typeof globalThis.fetch {\n const { delayMs = 0, promptOf = defaultPromptOf } = options;\n const find = toFinder(recordings);\n\n return async (_input, init) => {\n const failure =\n typeof options.fail === 'function' ? options.fail() : options.fail;\n if (failure) {\n return errorResponse(\n failure.status ?? 500,\n failure.message ?? 'The recorded server failed this request.',\n );\n }\n\n const body = parseBody(init?.body);\n const prompt = promptOf(body);\n const lines = find(prompt, body);\n if (!lines) {\n return errorResponse(404, `No recording for ${JSON.stringify(prompt)}.`);\n }\n\n const signal = init?.signal ?? null;\n if (signal?.aborted) throw abortError();\n\n return new Response(replay(lines, delayMs, signal), { status: 200 });\n };\n}\n\n/** Escape a JSON Pointer segment (RFC 6901). */\nfunction pointer(segment: string): string {\n return segment.replace(/~/g, '~0').replace(/\\//g, '~1');\n}\n\n/**\n * The JSONL patch lines a model would emit to build `spec`: the root, then\n * the state, then one line per element in declaration order.\n *\n * Recording a stream by hand means writing patches by hand; this writes them\n * from the spec a test already has, so the test says what it renders rather\n * than how the wire spells it.\n */\nexport function specStream(spec: Spec): string[] {\n const lines = [\n JSON.stringify({ op: 'add', path: '/root', value: spec.root }),\n ];\n if (spec.state) {\n lines.push(\n JSON.stringify({ op: 'add', path: '/state', value: spec.state }),\n );\n }\n for (const [key, element] of Object.entries(spec.elements ?? {})) {\n lines.push(\n JSON.stringify({\n op: 'add',\n path: `/elements/${pointer(key)}`,\n value: element,\n }),\n );\n }\n return lines;\n}\n\n/**\n * The usage metadata line `injectUIStream` reads into its `usage` signal.\n * Append it to a recording to exercise that path.\n */\nexport function usageLine(usage: {\n promptTokens?: number;\n completionTokens?: number;\n totalTokens?: number;\n}): string {\n return JSON.stringify({\n __meta: 'usage',\n promptTokens: usage.promptTokens ?? 0,\n completionTokens: usage.completionTokens ?? 0,\n totalTokens: usage.totalTokens ?? 0,\n });\n}\n","import { type Provider, provideZonelessChangeDetection } from '@angular/core';\nimport { type ComponentFixture, TestBed } from '@angular/core/testing';\n\n/**\n * What `renderSpec` and `renderComponent` share: the TestBed setup, the settle\n * loop, and the handful of DOM queries a test runs against what rendered.\n *\n * @internal Not exported from the entry point.\n */\n\n/**\n * Configure the TestBed, unless the test already did.\n *\n * A test that called `TestBed.runInInjectionContext` first — or that renders\n * a second time — has an instantiated module, and configuring it again\n * throws. Its own module stands; the only thing that cannot be salvaged is\n * this call's `providers`, so that is the one case worth failing over.\n */\nexport function configureTestBed(caller: string, providers: Provider[]): void {\n try {\n TestBed.configureTestingModule({\n providers: [provideZonelessChangeDetection(), ...providers],\n });\n } catch {\n if (providers.length > 0) {\n throw new Error(\n `${caller}: the TestBed was already instantiated, so \\`providers\\` cannot be applied. Pass them to your own TestBed.configureTestingModule() call instead.`,\n );\n }\n }\n}\n\n/** Let effects, promises and change detection finish. */\nexport function settler(\n fixture: ComponentFixture<unknown>,\n): () => Promise<void> {\n return async () => {\n // Twice: the first pass runs the effects that a render schedules, the\n // second renders what those effects changed. One pass leaves a test\n // asserting against a frame that no browser would ever show.\n await fixture.whenStable();\n fixture.detectChanges();\n await fixture.whenStable();\n };\n}\n\n/** The DOM half of a harness. */\nexport interface DomQueries {\n /** Trimmed text of the first match, or of everything when given nothing. */\n text(selector?: string): string;\n /** Trimmed text of every match. */\n texts(selector: string): string[];\n /** The first match. Throws when there is none. */\n find<T extends HTMLElement>(selector: string): T;\n /** Every match, possibly none. */\n findAll<T extends HTMLElement>(selector: string): T[];\n /** Click an element (or the first match of a selector) and settle. */\n click(target: string | Element): Promise<void>;\n /** Set an input's value, fire `input`, and settle. */\n fill(target: string | Element, value: string): Promise<void>;\n}\n\nexport function domQueries(\n caller: string,\n element: HTMLElement,\n settle: () => Promise<void>,\n): DomQueries {\n const resolve = (target: string | Element): HTMLElement => {\n if (typeof target !== 'string') return target as HTMLElement;\n const found = element.querySelector<HTMLElement>(target);\n if (!found) {\n throw new Error(\n `${caller}: nothing matches ${JSON.stringify(target)}. Rendered HTML:\\n${element.innerHTML}`,\n );\n }\n return found;\n };\n\n return {\n text: (selector) =>\n ((selector ? resolve(selector) : element).textContent ?? '').trim(),\n texts: (selector) =>\n Array.from(element.querySelectorAll(selector)).map((el) =>\n (el.textContent ?? '').trim(),\n ),\n find: <T extends HTMLElement>(selector: string) => resolve(selector) as T,\n findAll: <T extends HTMLElement>(selector: string) =>\n Array.from(element.querySelectorAll<T>(selector)),\n async click(target) {\n resolve(target).click();\n await settle();\n },\n async fill(target, value) {\n const input = resolve(target) as HTMLInputElement;\n input.value = value;\n input.dispatchEvent(new Event('input', { bubbles: true }));\n await settle();\n },\n };\n}\n","import { NgComponentOutlet } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n Injector,\n type Provider,\n type Type,\n computed,\n inject,\n isDevMode,\n signal,\n} from '@angular/core';\nimport { type ComponentFixture, TestBed } from '@angular/core/testing';\nimport type { UIElement } from '@json-render/core';\nimport {\n ELEMENT_KEY,\n type EventHandle,\n RENDER_CONTEXT,\n type RenderContext,\n} from 'ngx-json-render';\nimport {\n type DomQueries,\n configureTestBed,\n domQueries,\n settler,\n} from './fixture-helpers';\n\n/** One `setBound` call that reached a bound prop, in order. */\nexport interface BoundWrite {\n prop: string;\n value: unknown;\n}\n\n/** Options for {@link renderComponent}. Everything is optional. */\nexport interface RenderComponentOptions<P extends object> {\n /** The resolved props the component sees. Defaults to `{}`. */\n props?: P;\n /**\n * Which props are two-way bound, as `prop → state path` — what\n * `$bindState` / `$bindItem` would have resolved to. A `setBound` on a prop\n * listed here is recorded and written back into `props`; on any other prop\n * it is a no-op, exactly as under the renderer.\n */\n bindings?: Record<string, string>;\n /**\n * The events the spec would bind in `on`. Only affects what `ctx.on(event)`\n * reports as `bound` — `emitted` records every event regardless.\n */\n on?: readonly string[];\n /** The loading flag the component sees. */\n loading?: boolean;\n /** The spec key, for components that `injectElementKey()`. */\n key?: string;\n /** The element's catalog type name. */\n type?: string;\n /** Extra TestBed providers for anything else the component injects. */\n providers?: Provider[];\n}\n\n/**\n * A catalog component mounted on its own, and what it said to the renderer\n * it thinks it is inside.\n */\nexport interface ComponentHarness<T, P extends object> extends DomQueries {\n /** The fixture of the host the component is mounted in. */\n readonly fixture: ComponentFixture<unknown>;\n /** The host element, the root of the rendered DOM. */\n readonly element: HTMLElement;\n /** The component instance. */\n readonly component: T;\n /** The render context the component injected. */\n readonly context: RenderContext<P>;\n /** Every event the component emitted, bound or not, in order. */\n readonly emitted: readonly string[];\n /** Every `setBound` that reached a bound prop, in order. */\n readonly writes: readonly BoundWrite[];\n\n /** The props as the component currently sees them. */\n props(): P;\n /** Replace the props and settle. */\n setProps(props: P): Promise<void>;\n /** Merge into the props and settle. */\n patchProps(patch: Partial<P>): Promise<void>;\n /** Flip the loading flag and settle. */\n setLoading(loading: boolean): Promise<void>;\n /** Let effects, promises and change detection finish. */\n settle(): Promise<void>;\n /** Destroy the fixture. Rarely needed — TestBed resets between tests. */\n destroy(): void;\n}\n\n/**\n * Mounted through `NgComponentOutlet` with an element injector, the way\n * `<jr-element>` mounts a catalog component — so the context is the\n * component's own, not the TestBed module's, and a test can mount twice.\n */\n@Component({\n selector: 'jr-component-test-host',\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [NgComponentOutlet],\n template: `\n @if (component(); as type) {\n <ng-container *ngComponentOutlet=\"type; injector: injector()\" />\n }\n `,\n})\nclass JrComponentTestHost {\n readonly parent = inject(Injector);\n readonly component = signal<Type<unknown> | null>(null);\n readonly injector = signal<Injector>(this.parent);\n}\n\n/** The renderer-owned services a component can only have from a renderer. */\nconst RENDERER_ONLY =\n /JsonRender(RootContext|StateService|ValidationService|ActionsService)/;\n\n/**\n * Turn \"no provider for the renderer's services\" into what to do about it.\n * `<jr-children>`, `injectFieldValidation` and `injectActions` all need a\n * real renderer behind them; there is no honest fake for a subtree.\n */\nfunction explainMissingRenderer(error: unknown): never {\n const message = error instanceof Error ? error.message : String(error);\n if (RENDERER_ONLY.test(message)) {\n throw new Error(\n `renderComponent: this component needs a real <json-render> — it renders <jr-children>, validates a field or dispatches actions itself. Test it with renderSpec instead.\\n\\n${message}`,\n );\n }\n throw error;\n}\n\n/**\n * Mount a catalog component with no renderer and no spec: hand it props, and\n * read back the events it emitted and the values it wrote to bound props.\n *\n * This is the test of a component as a presentational one — what it draws\n * for these props, and what it says when used. What the spec then does with\n * that is the renderer's business, and `renderSpec` is where to test it.\n *\n * `props` is not inferred from the first value, so a later `patchProps` can\n * set a prop the first render left out. Pass `P` to have the props typed.\n *\n * A component that renders `<jr-children>`, registers field validation or\n * dispatches actions directly needs the renderer's services and fails with a\n * message pointing at `renderSpec`.\n *\n * @example\n * ```ts\n * const button = await renderComponent(MyButton, { props: { label: 'Save' } });\n *\n * expect(button.text('button')).toBe('Save');\n * await button.click('button');\n * expect(button.emitted).toEqual(['press']);\n *\n * await button.patchProps({ disabled: true });\n * expect(button.find<HTMLButtonElement>('button').disabled).toBe(true);\n * ```\n */\nexport async function renderComponent<\n T,\n P extends object = Record<string, unknown>,\n>(\n component: Type<T>,\n options: RenderComponentOptions<NoInfer<P>> = {},\n): Promise<ComponentHarness<T, P>> {\n const emitted: string[] = [];\n const writes: BoundWrite[] = [];\n\n const props = signal<P>(options.props ?? ({} as P));\n const loading = signal(options.loading ?? false);\n const bindings = options.bindings;\n const boundEvents = new Set(options.on ?? []);\n const key = signal(options.key ?? 'element');\n\n const element = computed(\n () =>\n ({\n type: options.type ?? component.name,\n props: props(),\n children: [],\n }) as UIElement<string, P>,\n );\n\n const emit = (event: string) => {\n emitted.push(event);\n };\n\n const context: RenderContext<P> = {\n element,\n props: props.asReadonly(),\n emit,\n on: (event): EventHandle => ({\n emit: () => emit(event),\n shouldPreventDefault: false,\n bound: boundEvents.has(event),\n }),\n bindings: signal(bindings).asReadonly(),\n loading: loading.asReadonly(),\n setBound: (prop, value) => {\n if (!bindings?.[prop]) {\n if (isDevMode()) {\n console.warn(\n `[ngx-json-render] setBound(\"${prop}\"): prop has no $bindState/$bindItem binding`,\n );\n }\n return;\n }\n writes.push({ prop, value });\n // What the renderer's round trip amounts to: the write lands in state,\n // and the bound prop resolves to it on the next read.\n props.update((current) => ({ ...current, [prop]: value }));\n },\n };\n\n configureTestBed('renderComponent', options.providers ?? []);\n\n const fixture = TestBed.createComponent(JrComponentTestHost);\n const host = fixture.componentInstance;\n host.injector.set(\n Injector.create({\n providers: [\n { provide: RENDER_CONTEXT, useValue: context },\n { provide: ELEMENT_KEY, useValue: key.asReadonly() },\n ],\n parent: host.parent,\n }),\n );\n host.component.set(component);\n\n const settle = settler(fixture);\n try {\n await settle();\n } catch (error) {\n explainMissingRenderer(error);\n }\n\n const mounted = fixture.debugElement.query(\n (candidate) => candidate.componentInstance instanceof component,\n );\n if (!mounted) {\n throw new Error(\n `renderComponent: ${component.name} did not mount. Is it a component?`,\n );\n }\n\n const root = fixture.nativeElement as HTMLElement;\n\n return {\n fixture,\n element: root,\n component: mounted.componentInstance as T,\n context,\n emitted,\n writes,\n\n props: () => props(),\n async setProps(next) {\n props.set(next);\n await settle();\n },\n async patchProps(patch) {\n props.update((current) => ({ ...current, ...patch }));\n await settle();\n },\n async setLoading(next) {\n loading.set(next);\n await settle();\n },\n settle,\n\n ...domQueries('renderComponent', root, settle),\n\n destroy: () => fixture.destroy(),\n };\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n type Provider,\n type Type,\n signal,\n} from '@angular/core';\nimport { type ComponentFixture, TestBed } from '@angular/core/testing';\nimport type {\n ActionHandler,\n ComputedFunction,\n DirectiveDefinition,\n Spec,\n StateStore,\n ValidationFunction,\n} from '@json-render/core';\nimport {\n type ComponentRegistry,\n JsonRenderStateService,\n JsonRenderValidationService,\n JsonRenderer,\n type RegistryEntry,\n type StateChange,\n type StateModel,\n} from 'ngx-json-render';\nimport {\n type DomQueries,\n configureTestBed,\n domQueries,\n settler,\n} from './fixture-helpers';\n\n/** One action the spec asked for, in the order it was dispatched. */\nexport interface DispatchedAction {\n name: string;\n params?: Record<string, unknown>;\n}\n\n/** Options for {@link renderSpec}. Everything but `registry` is optional. */\nexport interface RenderSpecOptions {\n /** Catalog type name → Angular component. The one required option. */\n registry: ComponentRegistry;\n /** Initial state model. Defaults to the spec's own `state`. */\n state?: StateModel;\n /** External store, for controlled mode. */\n store?: StateStore | null;\n /** Action handlers by name. Dispatches are recorded either way. */\n handlers?: Record<string, ActionHandler>;\n /** Catch-all handler for actions with no dedicated handler. */\n onAction?: (name: string, params?: Record<string, unknown>) => unknown;\n /** Navigation function for `onSuccess: { navigate }`. */\n navigate?: (path: string) => void;\n /** Fallback component for unknown types. */\n fallback?: Type<unknown> | RegistryEntry | null;\n /** Named functions for `$computed` props. */\n functions?: Record<string, ComputedFunction>;\n /** Custom validation functions. */\n validationFunctions?: Record<string, ValidationFunction>;\n /** Custom directives for `$`-prefixed values. */\n directives?: DirectiveDefinition<any>[];\n /** Render as if the spec were still streaming. */\n loading?: boolean;\n /** Extra TestBed providers, e.g. a `JR_CONFIRM_DIALOG` replacement. */\n providers?: Provider[];\n}\n\n/**\n * A rendered spec, and the handful of things a test does to one.\n *\n * `fixture` and `element` are there for everything this does not cover — the\n * harness is a shortcut, not a wall.\n */\nexport interface SpecHarness extends DomQueries {\n /** The fixture of the host that owns the `<json-render>`. */\n readonly fixture: ComponentFixture<unknown>;\n /** The host element, the root of the rendered DOM. */\n readonly element: HTMLElement;\n /** The renderer instance. */\n readonly renderer: JsonRenderer;\n /** The renderer's state store. */\n readonly store: JsonRenderStateService;\n /** The renderer's validation service. */\n readonly validation: JsonRenderValidationService;\n /** Every action the spec dispatched, handled or not, in order. */\n readonly dispatched: readonly DispatchedAction[];\n /** Every state change the renderer emitted, flattened, in order. */\n readonly changes: readonly StateChange[];\n\n /** Render a different spec (a later streaming frame, say). */\n setSpec(spec: Spec | null): Promise<void>;\n /** Flip the loading flag catalog components see. */\n setLoading(loading: boolean): Promise<void>;\n /** Let effects, promises and change detection finish. */\n settle(): Promise<void>;\n\n /** Read a state path, e.g. `/form/email`. */\n read(path: string): unknown;\n /** Write a state path and settle. */\n write(path: string, value: unknown): Promise<void>;\n /** The whole state model. */\n state(): StateModel;\n\n /** Destroy the fixture. Rarely needed — TestBed resets between tests. */\n destroy(): void;\n}\n\n@Component({\n selector: 'jr-test-host',\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [JsonRenderer],\n template: `\n <json-render\n [spec]=\"spec()\"\n [registry]=\"registry()\"\n [loading]=\"loading()\"\n [state]=\"state()\"\n [store]=\"store()\"\n [handlers]=\"handlers()\"\n [onAction]=\"onAction()\"\n [navigate]=\"navigate()\"\n [fallback]=\"fallback()\"\n [functions]=\"functions()\"\n [validationFunctions]=\"validationFunctions()\"\n [directives]=\"directives()\"\n (stateChange)=\"record($event)\"\n />\n `,\n})\nclass JrTestHost {\n readonly spec = signal<Spec | null>(null);\n readonly registry = signal<ComponentRegistry>({});\n readonly loading = signal(false);\n readonly state = signal<StateModel | undefined>(undefined);\n readonly store = signal<StateStore | null>(null);\n readonly handlers = signal<Record<string, ActionHandler> | undefined>(\n undefined,\n );\n readonly onAction = signal<\n ((name: string, params?: Record<string, unknown>) => unknown) | null\n >(null);\n readonly navigate = signal<((path: string) => void) | null>(null);\n readonly fallback = signal<Type<unknown> | RegistryEntry | null>(null);\n readonly functions = signal<Record<string, ComputedFunction> | undefined>(\n undefined,\n );\n readonly validationFunctions = signal<\n Record<string, ValidationFunction> | undefined\n >(undefined);\n readonly directives = signal<DirectiveDefinition<any>[] | undefined>(\n undefined,\n );\n\n record: (changes: StateChange[]) => void = () => {};\n}\n\n/**\n * Wrap every handler so a dispatch is recorded whether or not the action is\n * handled. Without this, `dispatched` would silently omit exactly the actions\n * a test bothered to wire up.\n */\nfunction recordingHandlers(\n handlers: Record<string, ActionHandler> | undefined,\n dispatched: DispatchedAction[],\n): Record<string, ActionHandler> | undefined {\n if (!handlers) return undefined;\n const wrapped: Record<string, ActionHandler> = {};\n for (const [name, handler] of Object.entries(handlers)) {\n wrapped[name] = (params: Record<string, unknown>) => {\n dispatched.push({ name, params });\n return handler(params);\n };\n }\n return wrapped;\n}\n\n/**\n * Render a spec against a registry and hand back the few things a test does\n * to it.\n *\n * Testing a catalog component otherwise means a host component, a TestBed\n * module, a zoneless provider, two settle passes and a `querySelector` — the\n * same twenty lines in every project that adopts this package, none of them\n * about the component under test.\n *\n * @example\n * ```ts\n * const ui = await renderSpec(\n * {\n * root: 'save',\n * elements: {\n * save: { type: 'Button', props: { label: 'Save' }, on: { press: { action: 'save' } } },\n * },\n * },\n * { registry: { Button: MyButton } },\n * );\n *\n * expect(ui.text('button')).toBe('Save');\n * await ui.click('button');\n * expect(ui.dispatched).toEqual([{ name: 'save', params: {} }]);\n * ```\n */\nexport async function renderSpec(\n spec: Spec | null,\n options: RenderSpecOptions,\n): Promise<SpecHarness> {\n const dispatched: DispatchedAction[] = [];\n const changes: StateChange[] = [];\n\n configureTestBed('renderSpec', options.providers ?? []);\n\n const fixture = TestBed.createComponent(JrTestHost);\n const host = fixture.componentInstance;\n\n host.registry.set(options.registry);\n host.loading.set(options.loading ?? false);\n host.state.set(options.state);\n host.store.set(options.store ?? null);\n host.handlers.set(recordingHandlers(options.handlers, dispatched));\n host.onAction.set((name, params) => {\n dispatched.push({ name, params });\n return options.onAction?.(name, params);\n });\n host.navigate.set(options.navigate ?? null);\n host.fallback.set(options.fallback ?? null);\n host.functions.set(options.functions);\n host.validationFunctions.set(options.validationFunctions);\n host.directives.set(options.directives);\n host.record = (batch) => changes.push(...batch);\n host.spec.set(spec);\n\n const settle = settler(fixture);\n await settle();\n\n const element = fixture.nativeElement as HTMLElement;\n // Found by predicate rather than with `By.directive`, which would make\n // @angular/platform-browser a dependency of this entry point for one line.\n const rendererElement = fixture.debugElement.query(\n (candidate) => candidate.componentInstance instanceof JsonRenderer,\n );\n const renderer = rendererElement.componentInstance as JsonRenderer;\n const store = renderer.stateStore;\n // From the renderer's own injector: these services are provided by the\n // component, so the root TestBed injector has never heard of them.\n const validation = rendererElement.injector.get(JsonRenderValidationService);\n\n return {\n fixture,\n element,\n renderer,\n store,\n validation,\n dispatched,\n changes,\n\n async setSpec(next) {\n host.spec.set(next);\n await settle();\n },\n async setLoading(loading) {\n host.loading.set(loading);\n await settle();\n },\n settle,\n\n read: (path) => store.get(path),\n async write(path, value) {\n store.set(path, value);\n await settle();\n },\n state: () => store.state(),\n\n ...domQueries('renderSpec', element, settle),\n\n destroy: () => fixture.destroy(),\n };\n}\n","/*\n * Public API Surface of ngx-json-render/testing\n *\n * Test utilities, shipped as a separate entry point so nothing here can be\n * pulled into an application bundle by accident.\n */\n\nexport {\n recordedTransport,\n specStream,\n usageLine,\n type Recording,\n type Recordings,\n type RecordedFailure,\n type RecordedTransportOptions,\n} from './recorded-transport';\nexport {\n renderComponent,\n type BoundWrite,\n type ComponentHarness,\n type RenderComponentOptions,\n} from './render-component';\nexport {\n renderSpec,\n type DispatchedAction,\n type RenderSpecOptions,\n type SpecHarness,\n} from './render-spec';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;AAiDA;AACA,SAAS,UAAU,GAAA;AACjB,IAAA,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,4BAA4B,CAAC;AACrD,IAAA,KAAK,CAAC,IAAI,GAAG,YAAY;AACzB,IAAA,OAAO,KAAK;AACd;AAEA;AACA,SAAS,aAAa,CAAC,MAAc,EAAE,OAAe,EAAA;IACpD,OAAO,IAAI,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE;QAC/C,MAAM;AACN,QAAA,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;AAChD,KAAA,CAAC;AACJ;AAEA,SAAS,SAAS,CAAC,IAAiC,EAAA;AAClD,IAAA,IAAI;AACF,QAAA,MAAM,MAAM,GAAY,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC;AACxD,QAAA,OAAO,MAAM,IAAI,OAAO,MAAM,KAAK;AACjC,cAAG;cACD,EAAE;IACR;AAAE,IAAA,MAAM;AACN,QAAA,OAAO,EAAE;IACX;AACF;AAEA;;;AAGG;AACH,SAAS,eAAe,CAAC,IAAuC,EAAA;AAC9D,IAAA,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC;IAC7B,IAAI,OAAO,MAAM,KAAK,QAAQ;AAAE,QAAA,OAAO,MAAM;AAE7C,IAAA,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC;AACjC,IAAA,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;AAAE,QAAA,OAAO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AE;KACjC;AACH;;ACnRA;;;;;AAKG;;ACLH;;AAEG;;"}
1
+ {"version":3,"file":"ngx-json-render-testing.mjs","sources":["../../../projects/ngx-json-render/testing/src/recorded-transport.ts","../../../projects/ngx-json-render/testing/src/fixture-helpers.ts","../../../projects/ngx-json-render/testing/src/render-component.ts","../../../projects/ngx-json-render/testing/src/render-spec.ts","../../../projects/ngx-json-render/testing/src/public-api.ts","../../../projects/ngx-json-render/testing/src/ngx-json-render-testing.ts"],"sourcesContent":["import type { Spec } from '@json-render/core';\n\n/**\n * The lines of one recorded response body, in the order the server sent them,\n * without their trailing newlines.\n */\nexport type Recording = readonly string[];\n\n/**\n * What to replay for a request. Either one recording for every request, a\n * lookup by prompt, or a function for anything more involved.\n */\nexport type Recordings =\n | Recording\n | Readonly<Record<string, Recording>>\n | ((\n prompt: string,\n body: Readonly<Record<string, unknown>>,\n ) => Recording | undefined);\n\n/** An error the recorded server answers with instead of a stream. */\nexport interface RecordedFailure {\n /** HTTP status. Defaults to 500. */\n status?: number;\n /** The `message` field of the JSON error body. */\n message?: string;\n}\n\n/** Options for {@link recordedTransport}. */\nexport interface RecordedTransportOptions {\n /**\n * Milliseconds between lines — the pace a model would emit them at.\n * Defaults to 0, which still yields to the event loop between lines, so a\n * test can observe the stream in flight.\n */\n delayMs?: number;\n /**\n * Answer with an error instead of a stream. A function is called per\n * request, so a test can turn the failure on and off between sends.\n */\n fail?: RecordedFailure | (() => RecordedFailure | null | undefined);\n /**\n * Pull the prompt out of the request body. The default reads `prompt`\n * (what `injectUIStream` sends) and falls back to the last message's\n * content (what `injectChatUI` sends).\n */\n promptOf?: (body: Readonly<Record<string, unknown>>) => string;\n}\n\n/** The rejection `fetch` raises when its signal fires. */\nfunction abortError(): Error {\n const error = new Error('The operation was aborted.');\n error.name = 'AbortError';\n return error;\n}\n\n/** A JSON error body, shaped the way the streaming hooks read it. */\nfunction errorResponse(status: number, message: string): Response {\n return new Response(JSON.stringify({ message }), {\n status,\n headers: { 'Content-Type': 'application/json' },\n });\n}\n\nfunction parseBody(body: BodyInit | null | undefined): Record<string, unknown> {\n try {\n const parsed: unknown = JSON.parse(String(body ?? '{}'));\n return parsed && typeof parsed === 'object'\n ? (parsed as Record<string, unknown>)\n : {};\n } catch {\n return {};\n }\n}\n\n/**\n * The prompt of a request, from either hook's body shape. Both are the\n * package's own, so the default knows them and a test does not have to.\n */\nfunction defaultPromptOf(body: Readonly<Record<string, unknown>>): string {\n const prompt = body['prompt'];\n if (typeof prompt === 'string') return prompt;\n\n const messages = body['messages'];\n if (!Array.isArray(messages) || messages.length === 0) return '';\n const last: unknown = messages[messages.length - 1];\n const content = (last as { content?: unknown } | null)?.content;\n return typeof content === 'string' ? content : '';\n}\n\nfunction toFinder(\n recordings: Recordings,\n): (prompt: string, body: Record<string, unknown>) => Recording | undefined {\n if (typeof recordings === 'function') return recordings;\n if (Array.isArray(recordings)) return () => recordings as Recording;\n const byPrompt = recordings as Readonly<Record<string, Recording>>;\n return (prompt) => byPrompt[prompt];\n}\n\nfunction replay(\n lines: Recording,\n delayMs: number,\n signal: AbortSignal | null,\n): ReadableStream<Uint8Array> {\n const encoder = new TextEncoder();\n return new ReadableStream<Uint8Array>({\n start(controller) {\n let index = 0;\n let timer: ReturnType<typeof setTimeout> | null = null;\n\n // A superseded or stopped generation has to die mid-flight the way a\n // real request does, or a test of that behaviour proves nothing.\n const onAbort = () => {\n if (timer) clearTimeout(timer);\n controller.error(abortError());\n };\n signal?.addEventListener('abort', onAbort, { once: true });\n\n const push = () => {\n if (index >= lines.length) {\n signal?.removeEventListener('abort', onAbort);\n controller.close();\n return;\n }\n controller.enqueue(encoder.encode(`${lines[index++]}\\n`));\n timer = setTimeout(push, delayMs);\n };\n timer = setTimeout(push, delayMs);\n },\n });\n}\n\n/**\n * A `fetch` that answers the streaming hooks from a recording instead of a\n * server.\n *\n * Both {@link injectUIStream} and {@link injectChatUI} take any function with\n * fetch's shape, so a test runs the real client — request body, streamed\n * lines, usage metadata, abort on supersede — with no server, no API key and\n * no global patched behind the test's back. Only the transport is recorded.\n *\n * @example\n * ```ts\n * const ui = injectUIStream({\n * api: '/api/generate',\n * fetch: recordedTransport(specStream(spec)),\n * });\n * ```\n *\n * @example Different answers per prompt, at a visible pace:\n * ```ts\n * recordedTransport(\n * { 'a dashboard': specStream(dashboard), 'a form': specStream(form) },\n * { delayMs: 20 },\n * );\n * ```\n */\nexport function recordedTransport(\n recordings: Recordings,\n options: RecordedTransportOptions = {},\n): typeof globalThis.fetch {\n const { delayMs = 0, promptOf = defaultPromptOf } = options;\n const find = toFinder(recordings);\n\n return async (_input, init) => {\n const failure =\n typeof options.fail === 'function' ? options.fail() : options.fail;\n if (failure) {\n return errorResponse(\n failure.status ?? 500,\n failure.message ?? 'The recorded server failed this request.',\n );\n }\n\n const body = parseBody(init?.body);\n const prompt = promptOf(body);\n const lines = find(prompt, body);\n if (!lines) {\n return errorResponse(404, `No recording for ${JSON.stringify(prompt)}.`);\n }\n\n const signal = init?.signal ?? null;\n if (signal?.aborted) throw abortError();\n\n return new Response(replay(lines, delayMs, signal), { status: 200 });\n };\n}\n\n/** Escape a JSON Pointer segment (RFC 6901). */\nfunction pointer(segment: string): string {\n return segment.replace(/~/g, '~0').replace(/\\//g, '~1');\n}\n\n/**\n * The JSONL patch lines a model would emit to build `spec`: the root, then\n * the state, then one line per element in declaration order.\n *\n * Recording a stream by hand means writing patches by hand; this writes them\n * from the spec a test already has, so the test says what it renders rather\n * than how the wire spells it.\n */\nexport function specStream(spec: Spec): string[] {\n const lines = [\n JSON.stringify({ op: 'add', path: '/root', value: spec.root }),\n ];\n if (spec.state) {\n lines.push(\n JSON.stringify({ op: 'add', path: '/state', value: spec.state }),\n );\n }\n for (const [key, element] of Object.entries(spec.elements ?? {})) {\n lines.push(\n JSON.stringify({\n op: 'add',\n path: `/elements/${pointer(key)}`,\n value: element,\n }),\n );\n }\n return lines;\n}\n\n/**\n * The usage metadata line `injectUIStream` reads into its `usage` signal.\n * Append it to a recording to exercise that path.\n */\nexport function usageLine(usage: {\n promptTokens?: number;\n completionTokens?: number;\n totalTokens?: number;\n}): string {\n return JSON.stringify({\n __meta: 'usage',\n promptTokens: usage.promptTokens ?? 0,\n completionTokens: usage.completionTokens ?? 0,\n totalTokens: usage.totalTokens ?? 0,\n });\n}\n","import * as angularCore from '@angular/core';\nimport type { EnvironmentProviders, Provider } from '@angular/core';\nimport { type ComponentFixture, TestBed } from '@angular/core/testing';\n\n/**\n * What `renderSpec` and `renderComponent` share: the TestBed setup, the settle\n * loop, and the handful of DOM queries a test runs against what rendered.\n *\n * @internal Not exported from the entry point.\n */\n\n/**\n * Zoneless change detection, under whichever name this Angular exports it.\n *\n * Angular 19 calls it `provideExperimentalZonelessChangeDetection`, 20 renamed\n * it `provideZonelessChangeDetection`, and 21 dropped the old name. The peer\n * range spans both, so neither can be a named import: whichever one the\n * consumer's Angular lacks would fail their bundler with a missing export.\n * `core` is a parameter only so the fallback can be tested on a newer Angular.\n */\nexport function zonelessChangeDetection(\n core: object = angularCore,\n): EnvironmentProviders {\n const named = core as Record<\n string,\n (() => EnvironmentProviders) | undefined\n >;\n const provide =\n named['provideZonelessChangeDetection'] ??\n named['provideExperimentalZonelessChangeDetection'];\n if (!provide) {\n throw new Error(\n 'ngx-json-render/testing: this @angular/core exports no zoneless change detection provider.',\n );\n }\n return provide();\n}\n\n/**\n * Configure the TestBed, unless the test already did.\n *\n * A test that called `TestBed.runInInjectionContext` first — or that renders\n * a second time — has an instantiated module, and configuring it again\n * throws. Its own module stands; the only thing that cannot be salvaged is\n * this call's `providers`, so that is the one case worth failing over.\n */\nexport function configureTestBed(caller: string, providers: Provider[]): void {\n try {\n TestBed.configureTestingModule({\n providers: [zonelessChangeDetection(), ...providers],\n });\n } catch {\n if (providers.length > 0) {\n throw new Error(\n `${caller}: the TestBed was already instantiated, so \\`providers\\` cannot be applied. Pass them to your own TestBed.configureTestingModule() call instead.`,\n );\n }\n }\n}\n\n/** Let effects, promises and change detection finish. */\nexport function settler(\n fixture: ComponentFixture<unknown>,\n): () => Promise<void> {\n return async () => {\n // Twice: the first pass runs the effects that a render schedules, the\n // second renders what those effects changed. One pass leaves a test\n // asserting against a frame that no browser would ever show.\n await fixture.whenStable();\n fixture.detectChanges();\n await fixture.whenStable();\n };\n}\n\n/** The DOM half of a harness. */\nexport interface DomQueries {\n /** Trimmed text of the first match, or of everything when given nothing. */\n text(selector?: string): string;\n /** Trimmed text of every match. */\n texts(selector: string): string[];\n /** The first match. Throws when there is none. */\n find<T extends HTMLElement>(selector: string): T;\n /** Every match, possibly none. */\n findAll<T extends HTMLElement>(selector: string): T[];\n /** Click an element (or the first match of a selector) and settle. */\n click(target: string | Element): Promise<void>;\n /** Set an input's value, fire `input`, and settle. */\n fill(target: string | Element, value: string): Promise<void>;\n}\n\nexport function domQueries(\n caller: string,\n element: HTMLElement,\n settle: () => Promise<void>,\n): DomQueries {\n const resolve = (target: string | Element): HTMLElement => {\n if (typeof target !== 'string') return target as HTMLElement;\n const found = element.querySelector<HTMLElement>(target);\n if (!found) {\n throw new Error(\n `${caller}: nothing matches ${JSON.stringify(target)}. Rendered HTML:\\n${element.innerHTML}`,\n );\n }\n return found;\n };\n\n return {\n text: (selector) =>\n ((selector ? resolve(selector) : element).textContent ?? '').trim(),\n texts: (selector) =>\n Array.from(element.querySelectorAll(selector)).map((el) =>\n (el.textContent ?? '').trim(),\n ),\n find: <T extends HTMLElement>(selector: string) => resolve(selector) as T,\n findAll: <T extends HTMLElement>(selector: string) =>\n Array.from(element.querySelectorAll<T>(selector)),\n async click(target) {\n resolve(target).click();\n await settle();\n },\n async fill(target, value) {\n const input = resolve(target) as HTMLInputElement;\n input.value = value;\n input.dispatchEvent(new Event('input', { bubbles: true }));\n await settle();\n },\n };\n}\n","import { NgComponentOutlet } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n Injector,\n type Provider,\n type Type,\n computed,\n inject,\n isDevMode,\n signal,\n} from '@angular/core';\nimport { type ComponentFixture, TestBed } from '@angular/core/testing';\nimport type { UIElement } from '@json-render/core';\nimport {\n ELEMENT_KEY,\n type EventHandle,\n RENDER_CONTEXT,\n type RenderContext,\n} from 'ngx-json-render';\nimport {\n type DomQueries,\n configureTestBed,\n domQueries,\n settler,\n} from './fixture-helpers';\n\n/** One `setBound` call that reached a bound prop, in order. */\nexport interface BoundWrite {\n prop: string;\n value: unknown;\n}\n\n/** Options for {@link renderComponent}. Everything is optional. */\nexport interface RenderComponentOptions<P extends object> {\n /** The resolved props the component sees. Defaults to `{}`. */\n props?: P;\n /**\n * Which props are two-way bound, as `prop → state path` — what\n * `$bindState` / `$bindItem` would have resolved to. A `setBound` on a prop\n * listed here is recorded and written back into `props`; on any other prop\n * it is a no-op, exactly as under the renderer.\n */\n bindings?: Record<string, string>;\n /**\n * The events the spec would bind in `on`. Only affects what `ctx.on(event)`\n * reports as `bound` — `emitted` records every event regardless.\n */\n on?: readonly string[];\n /** The loading flag the component sees. */\n loading?: boolean;\n /** The spec key, for components that `injectElementKey()`. */\n key?: string;\n /** The element's catalog type name. */\n type?: string;\n /** Extra TestBed providers for anything else the component injects. */\n providers?: Provider[];\n}\n\n/**\n * A catalog component mounted on its own, and what it said to the renderer\n * it thinks it is inside.\n */\nexport interface ComponentHarness<T, P extends object> extends DomQueries {\n /** The fixture of the host the component is mounted in. */\n readonly fixture: ComponentFixture<unknown>;\n /** The host element, the root of the rendered DOM. */\n readonly element: HTMLElement;\n /** The component instance. */\n readonly component: T;\n /** The render context the component injected. */\n readonly context: RenderContext<P>;\n /** Every event the component emitted, bound or not, in order. */\n readonly emitted: readonly string[];\n /** Every `setBound` that reached a bound prop, in order. */\n readonly writes: readonly BoundWrite[];\n\n /** The props as the component currently sees them. */\n props(): P;\n /** Replace the props and settle. */\n setProps(props: P): Promise<void>;\n /** Merge into the props and settle. */\n patchProps(patch: Partial<P>): Promise<void>;\n /** Flip the loading flag and settle. */\n setLoading(loading: boolean): Promise<void>;\n /** Let effects, promises and change detection finish. */\n settle(): Promise<void>;\n /** Destroy the fixture. Rarely needed — TestBed resets between tests. */\n destroy(): void;\n}\n\n/**\n * Mounted through `NgComponentOutlet` with an element injector, the way\n * `<jr-element>` mounts a catalog component — so the context is the\n * component's own, not the TestBed module's, and a test can mount twice.\n */\n@Component({\n selector: 'jr-component-test-host',\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [NgComponentOutlet],\n template: `\n @if (component(); as type) {\n <ng-container *ngComponentOutlet=\"type; injector: injector()\" />\n }\n `,\n})\nclass JrComponentTestHost {\n readonly parent = inject(Injector);\n readonly component = signal<Type<unknown> | null>(null);\n readonly injector = signal<Injector>(this.parent);\n}\n\n/** The renderer-owned services a component can only have from a renderer. */\nconst RENDERER_ONLY =\n /JsonRender(RootContext|StateService|ValidationService|ActionsService)/;\n\n/**\n * Turn \"no provider for the renderer's services\" into what to do about it.\n * `<jr-children>`, `injectFieldValidation` and `injectActions` all need a\n * real renderer behind them; there is no honest fake for a subtree.\n */\nfunction explainMissingRenderer(error: unknown): never {\n const message = error instanceof Error ? error.message : String(error);\n if (RENDERER_ONLY.test(message)) {\n throw new Error(\n `renderComponent: this component needs a real <json-render> — it renders <jr-children>, validates a field or dispatches actions itself. Test it with renderSpec instead.\\n\\n${message}`,\n );\n }\n throw error;\n}\n\n/**\n * Mount a catalog component with no renderer and no spec: hand it props, and\n * read back the events it emitted and the values it wrote to bound props.\n *\n * This is the test of a component as a presentational one — what it draws\n * for these props, and what it says when used. What the spec then does with\n * that is the renderer's business, and `renderSpec` is where to test it.\n *\n * `props` is not inferred from the first value, so a later `patchProps` can\n * set a prop the first render left out. Pass `P` to have the props typed.\n *\n * A component that renders `<jr-children>`, registers field validation or\n * dispatches actions directly needs the renderer's services and fails with a\n * message pointing at `renderSpec`.\n *\n * @example\n * ```ts\n * const button = await renderComponent(MyButton, { props: { label: 'Save' } });\n *\n * expect(button.text('button')).toBe('Save');\n * await button.click('button');\n * expect(button.emitted).toEqual(['press']);\n *\n * await button.patchProps({ disabled: true });\n * expect(button.find<HTMLButtonElement>('button').disabled).toBe(true);\n * ```\n */\nexport async function renderComponent<\n T,\n P extends object = Record<string, unknown>,\n>(\n component: Type<T>,\n options: RenderComponentOptions<NoInfer<P>> = {},\n): Promise<ComponentHarness<T, P>> {\n const emitted: string[] = [];\n const writes: BoundWrite[] = [];\n\n const props = signal<P>(options.props ?? ({} as P));\n const loading = signal(options.loading ?? false);\n const bindings = options.bindings;\n const boundEvents = new Set(options.on ?? []);\n const key = signal(options.key ?? 'element');\n\n const element = computed(\n () =>\n ({\n type: options.type ?? component.name,\n props: props(),\n children: [],\n }) as UIElement<string, P>,\n );\n\n const emit = (event: string) => {\n emitted.push(event);\n };\n\n const context: RenderContext<P> = {\n element,\n props: props.asReadonly(),\n emit,\n on: (event): EventHandle => ({\n emit: () => emit(event),\n shouldPreventDefault: false,\n bound: boundEvents.has(event),\n }),\n bindings: signal(bindings).asReadonly(),\n loading: loading.asReadonly(),\n setBound: (prop, value) => {\n if (!bindings?.[prop]) {\n if (isDevMode()) {\n console.warn(\n `[ngx-json-render] setBound(\"${prop}\"): prop has no $bindState/$bindItem binding`,\n );\n }\n return;\n }\n writes.push({ prop, value });\n // What the renderer's round trip amounts to: the write lands in state,\n // and the bound prop resolves to it on the next read.\n props.update((current) => ({ ...current, [prop]: value }));\n },\n };\n\n configureTestBed('renderComponent', options.providers ?? []);\n\n const fixture = TestBed.createComponent(JrComponentTestHost);\n const host = fixture.componentInstance;\n host.injector.set(\n Injector.create({\n providers: [\n { provide: RENDER_CONTEXT, useValue: context },\n { provide: ELEMENT_KEY, useValue: key.asReadonly() },\n ],\n parent: host.parent,\n }),\n );\n host.component.set(component);\n\n const settle = settler(fixture);\n try {\n await settle();\n } catch (error) {\n explainMissingRenderer(error);\n }\n\n const mounted = fixture.debugElement.query(\n (candidate) => candidate.componentInstance instanceof component,\n );\n if (!mounted) {\n throw new Error(\n `renderComponent: ${component.name} did not mount. Is it a component?`,\n );\n }\n\n const root = fixture.nativeElement as HTMLElement;\n\n return {\n fixture,\n element: root,\n component: mounted.componentInstance as T,\n context,\n emitted,\n writes,\n\n props: () => props(),\n async setProps(next) {\n props.set(next);\n await settle();\n },\n async patchProps(patch) {\n props.update((current) => ({ ...current, ...patch }));\n await settle();\n },\n async setLoading(next) {\n loading.set(next);\n await settle();\n },\n settle,\n\n ...domQueries('renderComponent', root, settle),\n\n destroy: () => fixture.destroy(),\n };\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n type Provider,\n type Type,\n signal,\n} from '@angular/core';\nimport { type ComponentFixture, TestBed } from '@angular/core/testing';\nimport type {\n ActionHandler,\n ComputedFunction,\n DirectiveDefinition,\n Spec,\n StateStore,\n ValidationFunction,\n} from '@json-render/core';\nimport {\n type ComponentRegistry,\n JsonRenderStateService,\n JsonRenderValidationService,\n JsonRenderer,\n type RegistryEntry,\n type StateChange,\n type StateModel,\n} from 'ngx-json-render';\nimport {\n type DomQueries,\n configureTestBed,\n domQueries,\n settler,\n} from './fixture-helpers';\n\n/** One action the spec asked for, in the order it was dispatched. */\nexport interface DispatchedAction {\n name: string;\n params?: Record<string, unknown>;\n}\n\n/** Options for {@link renderSpec}. Everything but `registry` is optional. */\nexport interface RenderSpecOptions {\n /** Catalog type name → Angular component. The one required option. */\n registry: ComponentRegistry;\n /** Initial state model. Defaults to the spec's own `state`. */\n state?: StateModel;\n /** External store, for controlled mode. */\n store?: StateStore | null;\n /** Action handlers by name. Dispatches are recorded either way. */\n handlers?: Record<string, ActionHandler>;\n /** Catch-all handler for actions with no dedicated handler. */\n onAction?: (name: string, params?: Record<string, unknown>) => unknown;\n /** Navigation function for `onSuccess: { navigate }`. */\n navigate?: (path: string) => void;\n /** Fallback component for unknown types. */\n fallback?: Type<unknown> | RegistryEntry | null;\n /** Named functions for `$computed` props. */\n functions?: Record<string, ComputedFunction>;\n /** Custom validation functions. */\n validationFunctions?: Record<string, ValidationFunction>;\n /** Custom directives for `$`-prefixed values. */\n directives?: DirectiveDefinition<any>[];\n /** Render as if the spec were still streaming. */\n loading?: boolean;\n /** Extra TestBed providers, e.g. a `JR_CONFIRM_DIALOG` replacement. */\n providers?: Provider[];\n}\n\n/**\n * A rendered spec, and the handful of things a test does to one.\n *\n * `fixture` and `element` are there for everything this does not cover — the\n * harness is a shortcut, not a wall.\n */\nexport interface SpecHarness extends DomQueries {\n /** The fixture of the host that owns the `<json-render>`. */\n readonly fixture: ComponentFixture<unknown>;\n /** The host element, the root of the rendered DOM. */\n readonly element: HTMLElement;\n /** The renderer instance. */\n readonly renderer: JsonRenderer;\n /** The renderer's state store. */\n readonly store: JsonRenderStateService;\n /** The renderer's validation service. */\n readonly validation: JsonRenderValidationService;\n /** Every action the spec dispatched, handled or not, in order. */\n readonly dispatched: readonly DispatchedAction[];\n /** Every state change the renderer emitted, flattened, in order. */\n readonly changes: readonly StateChange[];\n\n /** Render a different spec (a later streaming frame, say). */\n setSpec(spec: Spec | null): Promise<void>;\n /** Flip the loading flag catalog components see. */\n setLoading(loading: boolean): Promise<void>;\n /** Let effects, promises and change detection finish. */\n settle(): Promise<void>;\n\n /** Read a state path, e.g. `/form/email`. */\n read(path: string): unknown;\n /** Write a state path and settle. */\n write(path: string, value: unknown): Promise<void>;\n /** The whole state model. */\n state(): StateModel;\n\n /** Destroy the fixture. Rarely needed — TestBed resets between tests. */\n destroy(): void;\n}\n\n@Component({\n selector: 'jr-test-host',\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [JsonRenderer],\n template: `\n <json-render\n [spec]=\"spec()\"\n [registry]=\"registry()\"\n [loading]=\"loading()\"\n [state]=\"state()\"\n [store]=\"store()\"\n [handlers]=\"handlers()\"\n [onAction]=\"onAction()\"\n [navigate]=\"navigate()\"\n [fallback]=\"fallback()\"\n [functions]=\"functions()\"\n [validationFunctions]=\"validationFunctions()\"\n [directives]=\"directives()\"\n (stateChange)=\"record($event)\"\n />\n `,\n})\nclass JrTestHost {\n readonly spec = signal<Spec | null>(null);\n readonly registry = signal<ComponentRegistry>({});\n readonly loading = signal(false);\n readonly state = signal<StateModel | undefined>(undefined);\n readonly store = signal<StateStore | null>(null);\n readonly handlers = signal<Record<string, ActionHandler> | undefined>(\n undefined,\n );\n readonly onAction = signal<\n ((name: string, params?: Record<string, unknown>) => unknown) | null\n >(null);\n readonly navigate = signal<((path: string) => void) | null>(null);\n readonly fallback = signal<Type<unknown> | RegistryEntry | null>(null);\n readonly functions = signal<Record<string, ComputedFunction> | undefined>(\n undefined,\n );\n readonly validationFunctions = signal<\n Record<string, ValidationFunction> | undefined\n >(undefined);\n readonly directives = signal<DirectiveDefinition<any>[] | undefined>(\n undefined,\n );\n\n record: (changes: StateChange[]) => void = () => {};\n}\n\n/**\n * Wrap every handler so a dispatch is recorded whether or not the action is\n * handled. Without this, `dispatched` would silently omit exactly the actions\n * a test bothered to wire up.\n */\nfunction recordingHandlers(\n handlers: Record<string, ActionHandler> | undefined,\n dispatched: DispatchedAction[],\n): Record<string, ActionHandler> | undefined {\n if (!handlers) return undefined;\n const wrapped: Record<string, ActionHandler> = {};\n for (const [name, handler] of Object.entries(handlers)) {\n wrapped[name] = (params: Record<string, unknown>) => {\n dispatched.push({ name, params });\n return handler(params);\n };\n }\n return wrapped;\n}\n\n/**\n * Render a spec against a registry and hand back the few things a test does\n * to it.\n *\n * Testing a catalog component otherwise means a host component, a TestBed\n * module, a zoneless provider, two settle passes and a `querySelector` — the\n * same twenty lines in every project that adopts this package, none of them\n * about the component under test.\n *\n * @example\n * ```ts\n * const ui = await renderSpec(\n * {\n * root: 'save',\n * elements: {\n * save: { type: 'Button', props: { label: 'Save' }, on: { press: { action: 'save' } } },\n * },\n * },\n * { registry: { Button: MyButton } },\n * );\n *\n * expect(ui.text('button')).toBe('Save');\n * await ui.click('button');\n * expect(ui.dispatched).toEqual([{ name: 'save', params: {} }]);\n * ```\n */\nexport async function renderSpec(\n spec: Spec | null,\n options: RenderSpecOptions,\n): Promise<SpecHarness> {\n const dispatched: DispatchedAction[] = [];\n const changes: StateChange[] = [];\n\n configureTestBed('renderSpec', options.providers ?? []);\n\n const fixture = TestBed.createComponent(JrTestHost);\n const host = fixture.componentInstance;\n\n host.registry.set(options.registry);\n host.loading.set(options.loading ?? false);\n host.state.set(options.state);\n host.store.set(options.store ?? null);\n host.handlers.set(recordingHandlers(options.handlers, dispatched));\n host.onAction.set((name, params) => {\n dispatched.push({ name, params });\n return options.onAction?.(name, params);\n });\n host.navigate.set(options.navigate ?? null);\n host.fallback.set(options.fallback ?? null);\n host.functions.set(options.functions);\n host.validationFunctions.set(options.validationFunctions);\n host.directives.set(options.directives);\n host.record = (batch) => changes.push(...batch);\n host.spec.set(spec);\n\n const settle = settler(fixture);\n await settle();\n\n const element = fixture.nativeElement as HTMLElement;\n // Found by predicate rather than with `By.directive`, which would make\n // @angular/platform-browser a dependency of this entry point for one line.\n const rendererElement = fixture.debugElement.query(\n (candidate) => candidate.componentInstance instanceof JsonRenderer,\n );\n const renderer = rendererElement.componentInstance as JsonRenderer;\n const store = renderer.stateStore;\n // From the renderer's own injector: these services are provided by the\n // component, so the root TestBed injector has never heard of them.\n const validation = rendererElement.injector.get(JsonRenderValidationService);\n\n return {\n fixture,\n element,\n renderer,\n store,\n validation,\n dispatched,\n changes,\n\n async setSpec(next) {\n host.spec.set(next);\n await settle();\n },\n async setLoading(loading) {\n host.loading.set(loading);\n await settle();\n },\n settle,\n\n read: (path) => store.get(path),\n async write(path, value) {\n store.set(path, value);\n await settle();\n },\n state: () => store.state(),\n\n ...domQueries('renderSpec', element, settle),\n\n destroy: () => fixture.destroy(),\n };\n}\n","/*\n * Public API Surface of ngx-json-render/testing\n *\n * Test utilities, shipped as a separate entry point so nothing here can be\n * pulled into an application bundle by accident.\n */\n\nexport {\n recordedTransport,\n specStream,\n usageLine,\n type Recording,\n type Recordings,\n type RecordedFailure,\n type RecordedTransportOptions,\n} from './recorded-transport';\nexport {\n renderComponent,\n type BoundWrite,\n type ComponentHarness,\n type RenderComponentOptions,\n} from './render-component';\nexport {\n renderSpec,\n type DispatchedAction,\n type RenderSpecOptions,\n type SpecHarness,\n} from './render-spec';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["angularCore"],"mappings":";;;;;;AAiDA;AACA,SAAS,UAAU,GAAA;AACjB,IAAA,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,4BAA4B,CAAC;AACrD,IAAA,KAAK,CAAC,IAAI,GAAG,YAAY;AACzB,IAAA,OAAO,KAAK;AACd;AAEA;AACA,SAAS,aAAa,CAAC,MAAc,EAAE,OAAe,EAAA;IACpD,OAAO,IAAI,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE;QAC/C,MAAM;AACN,QAAA,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;AAChD,KAAA,CAAC;AACJ;AAEA,SAAS,SAAS,CAAC,IAAiC,EAAA;AAClD,IAAA,IAAI;AACF,QAAA,MAAM,MAAM,GAAY,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC;AACxD,QAAA,OAAO,MAAM,IAAI,OAAO,MAAM,KAAK;AACjC,cAAG;cACD,EAAE;IACR;AAAE,IAAA,MAAM;AACN,QAAA,OAAO,EAAE;IACX;AACF;AAEA;;;AAGG;AACH,SAAS,eAAe,CAAC,IAAuC,EAAA;AAC9D,IAAA,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC;IAC7B,IAAI,OAAO,MAAM,KAAK,QAAQ;AAAE,QAAA,OAAO,MAAM;AAE7C,IAAA,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC;AACjC,IAAA,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;AAAE,QAAA,OAAO,EAAE;IAChE,MAAM,IAAI,GAAY,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;AACnD,IA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AAC;YACtB,MAAM,MAAM,EAAE;QAChB,CAAC;AACD,QAAA,KAAK,EAAE,MAAM,KAAK,CAAC,KAAK,EAAE;AAE1B,QAAA,GAAG,UAAU,CAAC,YAAY,EAAE,OAAO,EAAE,MAAM,CAAC;AAE5C,QAAA,OAAO,EAAE,MAAM,OAAO,CAAC,OAAO,EAAE;KACjC;AACH;;ACnRA;;;;;AAKG;;ACLH;;AAEG;;"}
@@ -1537,6 +1537,8 @@ class JrElement {
1537
1537
  }
1538
1538
  },
1539
1539
  };
1540
+ // Typed as Injector for the peer range: see `confirmInjector` in
1541
+ // renderer.component.ts.
1540
1542
  outletInjector = Injector.create({
1541
1543
  providers: [
1542
1544
  { provide: RENDER_CONTEXT, useValue: this.renderCtx },
@@ -2406,6 +2408,9 @@ class JsonRenderer {
2406
2408
  * one token wide instead of a component contract the renderer would have to
2407
2409
  * bind to.
2408
2410
  */
2411
+ // Typed as Injector, not left to inference: Angular 20+ infers its
2412
+ // `DestroyableInjector`, which Angular 19's typings do not export, and the
2413
+ // inferred type would land in the published declarations.
2409
2414
  confirmInjector = computed(() => {
2410
2415
  const config = this.pendingConfirm();
2411
2416
  if (!config)