ngx-json-render 0.5.0 → 0.6.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ngx-json-render",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "Angular renderer for json-render — stream AI-generated JSON specs into real Angular components with signals.",
5
5
  "keywords": [
6
6
  "angular",
@@ -601,10 +601,53 @@ declare class JrElement {
601
601
  private readonly devtoolsActive;
602
602
  /** The raw (unresolved) element from the spec. */
603
603
  readonly rawElement: Signal<UIElement<string, Record<string, unknown>> | undefined>;
604
+ /**
605
+ * The state paths this element's expressions can read, or null when the
606
+ * spec doesn't say — see {@link collectStateReads} for when that is.
607
+ */
608
+ private readonly stateReads;
609
+ /**
610
+ * One signal per path this element reads, each holding the value at that
611
+ * path. They are rebuilt only when the paths change, and a cell that stays
612
+ * keeps its last value, so a path that didn't change is not a change.
613
+ *
614
+ * A cell compares like a resolved prop does: primitives by value, objects
615
+ * by reference with the internal store (which copies every path it writes)
616
+ * and never equal with an external `store`, which may write into its
617
+ * snapshot in place.
618
+ */
619
+ private readonly stateCells;
620
+ /**
621
+ * How many times {@link readableState} has taken a snapshot. The dev-mode
622
+ * check compares it between state writes to tell which ones were skipped.
623
+ */
624
+ private snapshotsTaken;
625
+ /**
626
+ * The state to resolve against: the whole snapshot, but only as fresh as
627
+ * the paths this element reads. A write elsewhere doesn't reach it, so the
628
+ * element doesn't resolve anything for it. An element whose reads are
629
+ * unknown follows every write, as all elements did before.
630
+ */
631
+ private readonly readableState;
604
632
  /** Prop/visibility resolution context (state + repeat scope + extensions). */
605
633
  private readonly resolutionCtx;
606
634
  protected readonly visible: Signal<boolean>;
607
- /** The element with all prop expressions resolved. */
635
+ /**
636
+ * The element with all prop expressions resolved.
637
+ *
638
+ * Resolving builds a new props object on every state write, whatever the
639
+ * write touched. Handing that on as a change would re-run every catalog
640
+ * template in the tree for one keystroke, so a result that holds the same
641
+ * values as the last one counts as unchanged and keeps the old object.
642
+ *
643
+ * Two-way bound elements are the exception, and keep treating every
644
+ * resolution as a change. Their component writes the user's input into the
645
+ * DOM before it reaches state, so the DOM can differ from a prop whose
646
+ * value never did: typing and a `clearStatePath` in the same turn take
647
+ * the prop from '' through 'milk' back to '' with nobody reading 'milk'.
648
+ * The README tells catalog authors to sync such inputs with an effect on
649
+ * props, and that effect only gets to put the DOM right if it runs.
650
+ */
608
651
  readonly resolvedElement: Signal<UIElement<string, Record<string, unknown>> | undefined>;
609
652
  /** Two-way binding paths ($bindState / $bindItem) by prop name. */
610
653
  readonly bindings: Signal<Record<string, string> | undefined>;
@@ -631,6 +674,14 @@ declare class JrElement {
631
674
  private readonly renderCtx;
632
675
  protected readonly outletInjector: _angular_core.DestroyableInjector;
633
676
  constructor();
677
+ /**
678
+ * Resolve this element against the whole current state and warn, once per
679
+ * element key, when that differs from what it shows after skipping a write.
680
+ *
681
+ * It only reports, and leaves the element as it is: correcting it here would
682
+ * make dev mode render what production doesn't.
683
+ */
684
+ private checkSkippedWrite;
634
685
  /**
635
686
  * Resolution context with a live state snapshot, so `$state` references in
636
687
  * later actions of a chain see mutations from earlier ones.