ngx-blocks-studio 0.2.0 → 0.2.2
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
|
@@ -539,6 +539,10 @@ declare function resolveRefPath(refPath: string, ctx: ResolverContext): {
|
|
|
539
539
|
target: unknown;
|
|
540
540
|
path: string[];
|
|
541
541
|
} | null;
|
|
542
|
+
/**
|
|
543
|
+
* True when any segment on the ref path is (or ends at) a signal or callable leaf.
|
|
544
|
+
*/
|
|
545
|
+
declare function refPathHasSignalAlongPath(refPath: string, ctx: ResolverContext): boolean;
|
|
542
546
|
/**
|
|
543
547
|
* Get a value from an object by dot-notation path (e.g. "name.firstName" -> obj.name?.firstName).
|
|
544
548
|
* Returns undefined if any segment is null/undefined or not an object.
|
|
@@ -593,7 +597,7 @@ interface InterpretFlowOptions {
|
|
|
593
597
|
*/
|
|
594
598
|
interpolateText?: (segment: string) => string;
|
|
595
599
|
/**
|
|
596
|
-
* When set, `@if (…)`
|
|
600
|
+
* When set, `@if (…)` and `@for (… of …)` evaluate collection/condition via this instead of `resolveRefOrModel`.
|
|
597
601
|
*/
|
|
598
602
|
resolveCondition?: (expression: string, scope: FlowScope) => unknown;
|
|
599
603
|
/**
|
|
@@ -625,7 +629,7 @@ declare function resolveReferenceValue(ref: string, ctx: ResolverContext): unkno
|
|
|
625
629
|
* Safe expression evaluation (same as output `{{ }}` / `@if (...)` when used with this module).
|
|
626
630
|
* Falls back to `resolveReferenceValue` if parsing fails (treat whole string as a ref path).
|
|
627
631
|
*/
|
|
628
|
-
declare function evaluateExpression(expression: string, ctx: ResolverContext, payload: unknown): unknown;
|
|
632
|
+
declare function evaluateExpression(expression: string, ctx: ResolverContext, payload: unknown, scope?: Record<string, unknown>): unknown;
|
|
629
633
|
/**
|
|
630
634
|
* Resolves only `{{ … }}` segments via `evaluateExpression`.
|
|
631
635
|
* Single full-string `{{ expr }}` preserves the evaluated type; mixed templates return a string.
|
|
@@ -641,7 +645,7 @@ interface ResolveTemplateStringOptions {
|
|
|
641
645
|
}
|
|
642
646
|
/**
|
|
643
647
|
* Unified template resolution: flow (`@if`, `@for`, `${}`) plus `{{ }}` in flow text segments.
|
|
644
|
-
* `@if`
|
|
648
|
+
* `@if` / `@for (… of …)` use `evaluateExpression` (safe expressions + ref fallback).
|
|
645
649
|
*/
|
|
646
650
|
declare function resolveTemplateString(value: string, ctx: ResolverContext, payload?: unknown, options?: ResolveTemplateStringOptions): unknown;
|
|
647
651
|
|
|
@@ -659,6 +663,10 @@ interface BlockLoadOptions {
|
|
|
659
663
|
registry?: BlockRegistry;
|
|
660
664
|
/** Map of block id → full description or loader; used when description is a block reference. */
|
|
661
665
|
blockDefinitions?: Record<string, BlockDefinitionOrLoader>;
|
|
666
|
+
/** Generation captured when the directive started this load; paired with {@link getCurrentLoadGeneration}. */
|
|
667
|
+
loadGeneration?: number;
|
|
668
|
+
/** Returns the directive's current load generation (invalidates in-flight loads when it changes). */
|
|
669
|
+
getCurrentLoadGeneration?: () => number;
|
|
662
670
|
}
|
|
663
671
|
declare const INTERPOLATE_MAX_PLACEHOLDERS = 200;
|
|
664
672
|
/** Builds a two-way binding when only a read getter exists for the key (used by {@link createInputBindingsWithWarnings}). */
|
|
@@ -669,7 +677,7 @@ declare class BlockLoaderService {
|
|
|
669
677
|
private readonly directiveRegistry;
|
|
670
678
|
private readonly serviceRegistry;
|
|
671
679
|
private readonly blockRegistryService;
|
|
672
|
-
load(description: BlockInput | BlockReference, viewContainerRef: ViewContainerRef, model: Signal<unknown | undefined>, options?: BlockLoadOptions): Promise<ComponentRef<unknown
|
|
680
|
+
load(description: BlockInput | BlockReference, viewContainerRef: ViewContainerRef, model: Signal<unknown | undefined>, options?: BlockLoadOptions): Promise<ComponentRef<unknown> | null>;
|
|
673
681
|
private resolveServices;
|
|
674
682
|
private buildChildInjectorFromTypes;
|
|
675
683
|
/** Resolve all service types in parallel (single batch for load). */
|
|
@@ -701,11 +709,59 @@ declare class BlockDirective {
|
|
|
701
709
|
* Useful for "same component, different inputs" scenarios like tabs/switch blocks.
|
|
702
710
|
*/
|
|
703
711
|
readonly reloadKey: _angular_core.InputSignal<unknown>;
|
|
704
|
-
loadBlock(resolved: BlockInput | BlockReference, registry?: BlockRegistry, blockDefinitions?: Record<string, BlockDefinitionOrLoader
|
|
712
|
+
loadBlock(resolved: BlockInput | BlockReference, registry?: BlockRegistry, blockDefinitions?: Record<string, BlockDefinitionOrLoader>, loadGeneration?: number, getCurrentLoadGeneration?: () => number): Promise<_angular_core.ComponentRef<unknown> | null>;
|
|
705
713
|
constructor();
|
|
706
714
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<BlockDirective, never>;
|
|
707
715
|
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<BlockDirective, "[block]", never, { "description": { "alias": "description"; "required": false; "isSignal": true; }; "blockRegistry": { "alias": "blockRegistry"; "required": false; "isSignal": true; }; "blockDefinitions": { "alias": "blockDefinitions"; "required": false; "isSignal": true; }; "model": { "alias": "model"; "required": false; "isSignal": true; }; "reloadKey": { "alias": "reloadKey"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
708
716
|
}
|
|
709
717
|
|
|
710
|
-
|
|
711
|
-
|
|
718
|
+
/** JSON-like objects only — skip class instances, Date, Map, etc. */
|
|
719
|
+
declare function isPlainObject(value: unknown): value is Record<string, unknown>;
|
|
720
|
+
/**
|
|
721
|
+
* Child block entry in a parent input tree (`blocks`, `rows`, `columns`, etc.).
|
|
722
|
+
* Template refs inside these objects are resolved when that block is loaded, not on the parent.
|
|
723
|
+
*/
|
|
724
|
+
declare function looksLikeBlockDescriptor(value: unknown): boolean;
|
|
725
|
+
/** Same as {@link looksLikeBlockDescriptor}; use in custom layout blocks if needed. */
|
|
726
|
+
declare const shouldDeferInputTemplateResolution: typeof looksLikeBlockDescriptor;
|
|
727
|
+
/** True when any string leaf in the tree needs input-style resolution (mustache, flow, or `[( )]`). */
|
|
728
|
+
declare function valueNeedsInputResolve(value: unknown, visited?: WeakSet<object>): boolean;
|
|
729
|
+
/** True when any string leaf contains `{{ }}` (block model seeding). */
|
|
730
|
+
declare function valueContainsMustacheInTree(value: unknown, visited?: WeakSet<object>): boolean;
|
|
731
|
+
interface ResolveNestedTemplateOptions {
|
|
732
|
+
/**
|
|
733
|
+
* When true, exact `[(refPath)]` strings resolve to the current ref value (read-only).
|
|
734
|
+
* Does not create Angular two-way bindings on nested keys.
|
|
735
|
+
*/
|
|
736
|
+
resolveTwoWayStringsAsReadonly?: boolean;
|
|
737
|
+
escapeFlowRefs?: boolean;
|
|
738
|
+
}
|
|
739
|
+
/**
|
|
740
|
+
* Deep-resolve template strings in plain objects and arrays (new object graph each call).
|
|
741
|
+
*/
|
|
742
|
+
declare function resolveNestedTemplateValues(value: unknown, ctx: ResolverContext, path?: string, visited?: WeakSet<object>, options?: ResolveNestedTemplateOptions): unknown;
|
|
743
|
+
interface TemplateInputRefLeaf {
|
|
744
|
+
refPath: string;
|
|
745
|
+
/** When true (`ref('path', true)`), embed the leaf {@link Signal} on nested inputs when present. */
|
|
746
|
+
embedLeafSignal: boolean;
|
|
747
|
+
}
|
|
748
|
+
/** Single full-string mustache / two-way ref for nested input materialization. */
|
|
749
|
+
declare function parseTemplateInputRefLeaf(str: string, ctx: ResolverContext): TemplateInputRefLeaf | undefined;
|
|
750
|
+
/**
|
|
751
|
+
* Stable nested graph at bind time: literals and unresolved template strings stay as-is;
|
|
752
|
+
* only `{{ ref('path', true) }}` embeds the leaf {@link Signal} (or reactive fallback).
|
|
753
|
+
*/
|
|
754
|
+
declare function materializeNestedReactiveInput(value: unknown, ctx: ResolverContext, path?: string, visited?: WeakSet<object>, options?: ResolveNestedTemplateOptions): unknown;
|
|
755
|
+
/**
|
|
756
|
+
* Resolve a {@link materializeNestedReactiveInput} graph for block input binding:
|
|
757
|
+
* template strings become plain values; embedded {@link Signal}s are kept as references.
|
|
758
|
+
*/
|
|
759
|
+
declare function resolveMaterializedNestedInput(value: unknown, ctx: ResolverContext, path?: string, visited?: WeakSet<object>, options?: ResolveNestedTemplateOptions): unknown;
|
|
760
|
+
/**
|
|
761
|
+
* Deep-read values from {@link materializeNestedReactiveInput}: unwraps embedded
|
|
762
|
+
* `Signal`s / `computed`s and recurses through plain objects and arrays.
|
|
763
|
+
*/
|
|
764
|
+
declare function readNestedInputValue<T>(value: T): T;
|
|
765
|
+
|
|
766
|
+
export { BlockDefinitionsRegistry, BlockDirective, BlockLoaderService, BlockRegistryImpl, BlockRegistryService, ChainedBlockRegistry, ComponentRegistry, DirectiveRegistry, GuardRegistry, INTERPOLATE_MAX_PLACEHOLDERS, RegistryMetadataStore, RouteLoader, ServiceRegistry, buildComputedForTemplate, classifyTwoWayString, collectRefPaths, createInputBindingsWithWarnings, createOutputHandler, deepMergeBlockDefinition, evaluateExpression, extractReadonlyRefs, getRefPathFromReadonly, getRefSignal, getRefValue, getValueByPath, interpretFlow, isBlockDefinitionLoader, isBlockReference, isInvalidTwoWayMix, isOutputCallObject, isOutputReference, isPlainObject, isTwoWayRefString, linkedTwoWayFromInputGetter, looksLikeBlockDescriptor, looksLikeFlowTemplate, materializeNestedReactiveInput, mustacheSegmentToString, normalizeDirectives, normalizeServices, parseFlowTemplate, parseRefPath, parseTemplateInputRefLeaf, parseTwoWayRef, readNestedInputValue, refPathHasSignalAlongPath, refPathResolvesToSignal, resolveBlockReference, resolveMaterializedNestedInput, resolveMustacheInterpolatedString, resolveNestedTemplateValues, resolveRefOrModel, resolveRefPath, resolveReferenceValue, resolveTemplateString, safeParseBlockDescription, setRefValue, shouldDeferInputTemplateResolution, splitCallableRef, valueContainsMustacheInTree, valueNeedsInputResolve };
|
|
767
|
+
export type { AllRegistryMetadata, BlockDefinitionLoader, BlockDefinitionOrLoader, BlockDescription, BlockInput, BlockInstanceHandle, BlockLoadOptions, BlockOutputValue, BlockReference, BlockRegistry, CurrentInstance, FlowNode, FlowScope, GuardLoader, GuardOrLoader, GuardOrType, InterpretFlowOptions, OutputCallObject, OutputOnError, OutputReference, ParsedRefPath, RegistryEntryType, RegistryMetadataRecord, ResolveNestedTemplateOptions, ResolveTemplateStringOptions, ResolverContext, RouteConfig, RouteConfigs, SafeParseBlockDescriptionResult, ScopedRegistryNode, ServiceEntry, TemplateInputRefLeaf, ThenChainStep };
|