ngx-blocks-studio 0.1.0 → 0.2.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,10 +1,18 @@
1
1
  {
2
2
  "name": "ngx-blocks-studio",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "git+https://github.com/winghei/ngx-blocks-studio.git"
7
+ },
8
+ "bugs": {
9
+ "url": "https://github.com/winghei/ngx-blocks-studio/issues"
10
+ },
11
+ "homepage": "https://github.com/winghei/ngx-blocks-studio#readme",
4
12
  "peerDependencies": {
5
- "@angular/common": "^21.0.0",
6
- "@angular/core": "^21.0.0",
7
- "@angular/router": "^21.0.0",
13
+ "@angular/common": "^22.0.0",
14
+ "@angular/core": "^22.0.0",
15
+ "@angular/router": "^22.0.0",
8
16
  "rxjs": "^7.0.0"
9
17
  },
10
18
  "dependencies": {
@@ -21,5 +29,6 @@
21
29
  "types": "./types/ngx-blocks-studio.d.ts",
22
30
  "default": "./fesm2022/ngx-blocks-studio.mjs"
23
31
  }
24
- }
32
+ },
33
+ "type": "module"
25
34
  }
@@ -1,5 +1,5 @@
1
1
  import * as _angular_core from '@angular/core';
2
- import { Type, Injector, Signal, ViewContainerRef, ComponentRef } from '@angular/core';
2
+ import { Type, Injector, Signal, ViewContainerRef, ComponentRef, WritableSignal } from '@angular/core';
3
3
  import { CanActivateFn, RunGuardsAndResolvers } from '@angular/router';
4
4
 
5
5
  /**
@@ -306,7 +306,7 @@ declare class RouteLoader {
306
306
  private loadComponent;
307
307
  private getGuard;
308
308
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<RouteLoader, never>;
309
- static ɵprov: _angular_core.ɵɵInjectableDeclaration<RouteLoader>;
309
+ static ɵprov: _angular_core.ɵɵInjectableDeclaration<any>;
310
310
  }
311
311
 
312
312
  interface CurrentInstance {
@@ -380,7 +380,7 @@ declare class BlockRegistryService {
380
380
  getRegistryForScope(scopeKey: string): BlockRegistry | null;
381
381
  getParentScopeKey(scopeKey: string): string | null;
382
382
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<BlockRegistryService, never>;
383
- static ɵprov: _angular_core.ɵɵInjectableDeclaration<BlockRegistryService>;
383
+ static ɵprov: _angular_core.ɵɵInjectableDeclaration<any>;
384
384
  }
385
385
 
386
386
  /**
@@ -507,8 +507,9 @@ declare function parseRefPath(refPath: string): ParsedRefPath;
507
507
  declare function extractReadonlyRefs(template: string): string[];
508
508
  declare function isTwoWayRefString(value: unknown): value is string;
509
509
  /**
510
- * True when a string contains two-way ref delimiters `[(` or `)]` but is not a valid
511
- * standalone two-way ref (exact form `[(refPath)]`). Mixing two-way with literals or {{ }} is invalid.
510
+ * True when a string contains the two-way ref opener `[(` but is not a valid standalone
511
+ * two-way ref (exact form `[(refPath)]`). Mixing two-way with literals or {{ }} is invalid.
512
+ * Plain `)]` substrings (e.g. Tailwind `minmax(0,1fr)]`) are not treated as two-way syntax.
512
513
  */
513
514
  declare function isInvalidTwoWayMix(value: unknown): value is string;
514
515
  /**
@@ -660,6 +661,9 @@ interface BlockLoadOptions {
660
661
  blockDefinitions?: Record<string, BlockDefinitionOrLoader>;
661
662
  }
662
663
  declare const INTERPOLATE_MAX_PLACEHOLDERS = 200;
664
+ /** Builds a two-way binding when only a read getter exists for the key (used by {@link createInputBindingsWithWarnings}). */
665
+ declare function linkedTwoWayFromInputGetter(resolvedInputs: Record<string, (() => unknown) | undefined>, key: string): WritableSignal<unknown>;
666
+ declare function createInputBindingsWithWarnings(ownerName: string, inputKeys: Set<string>, twoWayKeys: Set<string>, outputKeys: Set<string>, resolvedInputs: Record<string, (() => unknown) | undefined>, resolvedTwoWay: Record<string, unknown>, resolvedOutputs: Record<string, (value: unknown) => void>): _angular_core.Binding[];
663
667
  declare class BlockLoaderService {
664
668
  private readonly componentRegistry;
665
669
  private readonly directiveRegistry;
@@ -674,17 +678,16 @@ declare class BlockLoaderService {
674
678
  private getDirectiveTypes;
675
679
  /** Resolve model from desc (interpolate ref if string) and set on blockInstance. */
676
680
  private resolveContextModel;
677
- private valueContainsTemplate;
678
- private resolveNestedModelTemplates;
679
681
  private withModelOverrideContext;
680
682
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<BlockLoaderService, never>;
681
- static ɵprov: _angular_core.ɵɵInjectableDeclaration<BlockLoaderService>;
683
+ static ɵprov: _angular_core.ɵɵInjectableDeclaration<any>;
682
684
  }
683
685
 
684
686
  declare class BlockDirective {
685
687
  private readonly viewContainerRef;
686
688
  private readonly loader;
687
689
  private readonly destroyRef;
690
+ private readonly loadState;
688
691
  /** Full description, or { id } / { blockId, blockDefinition? } to reuse/override from blockDefinitions. */
689
692
  readonly description: _angular_core.InputSignal<BlockInput | BlockReference | null>;
690
693
  /** Registry for block instances by id; pass from root so nested blocks share it. */
@@ -698,24 +701,11 @@ declare class BlockDirective {
698
701
  * Useful for "same component, different inputs" scenarios like tabs/switch blocks.
699
702
  */
700
703
  readonly reloadKey: _angular_core.InputSignal<unknown>;
701
- private loadResult;
702
- private lastRegistry;
703
- private lastId;
704
- private loadedComponent;
705
- private loadedServicesKey;
706
- private loadedReloadKey;
707
- private loadedDescKey;
708
- private loadGeneration;
709
- /** Invalidates in-flight block-reference resolution when the effect re-runs. */
710
- private effectRunId;
711
- /** Avoid re-parsing when the same description reference is passed (e.g. stable signal). */
712
- private lastDescRef;
713
- private lastParsedData;
704
+ loadBlock(resolved: BlockInput | BlockReference, registry?: BlockRegistry, blockDefinitions?: Record<string, BlockDefinitionOrLoader>): Promise<_angular_core.ComponentRef<unknown>>;
714
705
  constructor();
715
- private clear;
716
706
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<BlockDirective, never>;
717
707
  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>;
718
708
  }
719
709
 
720
- export { BlockDefinitionsRegistry, BlockDirective, BlockLoaderService, BlockRegistryImpl, BlockRegistryService, ChainedBlockRegistry, ComponentRegistry, DirectiveRegistry, GuardRegistry, INTERPOLATE_MAX_PLACEHOLDERS, RegistryMetadataStore, RouteLoader, ServiceRegistry, buildComputedForTemplate, classifyTwoWayString, collectRefPaths, createOutputHandler, deepMergeBlockDefinition, evaluateExpression, extractReadonlyRefs, getRefPathFromReadonly, getRefSignal, getRefValue, getValueByPath, interpretFlow, isBlockDefinitionLoader, isBlockReference, isInvalidTwoWayMix, isOutputCallObject, isOutputReference, isTwoWayRefString, looksLikeFlowTemplate, mustacheSegmentToString, normalizeDirectives, normalizeServices, parseFlowTemplate, parseRefPath, parseTwoWayRef, refPathResolvesToSignal, resolveBlockReference, resolveMustacheInterpolatedString, resolveRefOrModel, resolveRefPath, resolveReferenceValue, resolveTemplateString, safeParseBlockDescription, setRefValue, splitCallableRef };
710
+ 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, isTwoWayRefString, linkedTwoWayFromInputGetter, looksLikeFlowTemplate, mustacheSegmentToString, normalizeDirectives, normalizeServices, parseFlowTemplate, parseRefPath, parseTwoWayRef, refPathResolvesToSignal, resolveBlockReference, resolveMustacheInterpolatedString, resolveRefOrModel, resolveRefPath, resolveReferenceValue, resolveTemplateString, safeParseBlockDescription, setRefValue, splitCallableRef };
721
711
  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, ResolveTemplateStringOptions, ResolverContext, RouteConfig, RouteConfigs, SafeParseBlockDescriptionResult, ScopedRegistryNode, ServiceEntry, ThenChainStep };