ngx-blocks-studio 0.2.0 → 0.2.1

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.
@@ -2487,6 +2487,40 @@ function isPlainObject(value) {
2487
2487
  const proto = Object.getPrototypeOf(value);
2488
2488
  return proto === null || proto === Object.prototype;
2489
2489
  }
2490
+ function looksLikeBlockIdReference(value) {
2491
+ if (value['component'] != null)
2492
+ return false;
2493
+ const blockId = value['blockId'];
2494
+ if (typeof blockId === 'string' && blockId.length > 0) {
2495
+ return true;
2496
+ }
2497
+ const id = value['id'];
2498
+ if (typeof id !== 'string' || id.length === 0) {
2499
+ return false;
2500
+ }
2501
+ if ('blockDefinition' in value) {
2502
+ return true;
2503
+ }
2504
+ const keys = Object.keys(value);
2505
+ if (keys.length !== 1 || keys[0] !== 'id') {
2506
+ return false;
2507
+ }
2508
+ return !id.includes('{{') && !id.includes('[(');
2509
+ }
2510
+ /**
2511
+ * Child block entry in a parent input tree (`blocks`, `rows`, `columns`, etc.).
2512
+ * Template refs inside these objects are resolved when that block is loaded, not on the parent.
2513
+ */
2514
+ function looksLikeBlockDescriptor(value) {
2515
+ if (!isPlainObject(value))
2516
+ return false;
2517
+ if (typeof value['component'] === 'string' && isPlainObject(value['inputs'])) {
2518
+ return true;
2519
+ }
2520
+ return looksLikeBlockIdReference(value);
2521
+ }
2522
+ /** Same as {@link looksLikeBlockDescriptor}; use in custom layout blocks if needed. */
2523
+ const shouldDeferInputTemplateResolution = looksLikeBlockDescriptor;
2490
2524
  function stringNeedsInputResolve(s) {
2491
2525
  if (classifyTwoWayString(s) !== 'none')
2492
2526
  return true;
@@ -2507,6 +2541,8 @@ function valueNeedsInputResolve(value, visited = new WeakSet()) {
2507
2541
  if (value != null && typeof value === 'object') {
2508
2542
  if (!isPlainObject(value))
2509
2543
  return false;
2544
+ if (looksLikeBlockDescriptor(value))
2545
+ return false;
2510
2546
  if (visited.has(value))
2511
2547
  return false;
2512
2548
  visited.add(value);
@@ -2525,6 +2561,8 @@ function valueContainsMustacheInTree(value, visited = new WeakSet()) {
2525
2561
  if (value != null && typeof value === 'object') {
2526
2562
  if (!isPlainObject(value))
2527
2563
  return false;
2564
+ if (looksLikeBlockDescriptor(value))
2565
+ return false;
2528
2566
  if (visited.has(value))
2529
2567
  return false;
2530
2568
  visited.add(value);
@@ -2564,6 +2602,8 @@ function resolveNestedTemplateValues(value, ctx, path = '', visited = new WeakSe
2564
2602
  if (value != null && typeof value === 'object') {
2565
2603
  if (!isPlainObject(value))
2566
2604
  return value;
2605
+ if (looksLikeBlockDescriptor(value))
2606
+ return value;
2567
2607
  if (visited.has(value))
2568
2608
  return value;
2569
2609
  visited.add(value);
@@ -3139,5 +3179,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.3", ngImpor
3139
3179
  * Generated bundle index. Do not edit.
3140
3180
  */
3141
3181
 
3142
- 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 };
3182
+ 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, mustacheSegmentToString, normalizeDirectives, normalizeServices, parseFlowTemplate, parseRefPath, parseTwoWayRef, refPathResolvesToSignal, resolveBlockReference, resolveMustacheInterpolatedString, resolveNestedTemplateValues, resolveRefOrModel, resolveRefPath, resolveReferenceValue, resolveTemplateString, safeParseBlockDescription, setRefValue, shouldDeferInputTemplateResolution, splitCallableRef, valueContainsMustacheInTree, valueNeedsInputResolve };
3143
3183
  //# sourceMappingURL=ngx-blocks-studio.mjs.map