@vectoriox/iox-ui 4.19.0 → 4.21.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.
@@ -1913,10 +1913,38 @@ function planDataSource(ds, routeParams = {}, queryParams = {}) {
1913
1913
  const d = ds.request?.derived;
1914
1914
  return d?.from ? { kind: 'derived', from: d.from, path: d.path ?? '', mode } : { kind: 'none' };
1915
1915
  }
1916
+ case 'variable':
1917
+ // A VARIABLE is a page-local resource whose value is WRITTEN at runtime by an interaction
1918
+ // (setContext), never fetched. It resolves to nothing here on purpose: the page renders
1919
+ // its empty state until something writes it. `request.variable.itemsFrom` only names the
1920
+ // source whose items it holds, so the bind picker can suggest fields.
1921
+ return { kind: 'none' };
1916
1922
  default:
1917
1923
  return { kind: 'none' };
1918
1924
  }
1919
1925
  }
1926
+ /**
1927
+ * The aliases on a page that are VARIABLES — runtime-written resources, not fetched data.
1928
+ *
1929
+ * Shared so the builder and the SSR engine agree on which aliases start empty and are filled by
1930
+ * interactions. See element-context-state-plan.md.
1931
+ */
1932
+ function variableAliases(dataSources) {
1933
+ const out = new Set();
1934
+ for (const ds of dataSources ?? []) {
1935
+ if (ds?.type === 'variable' && ds.alias)
1936
+ out.add(ds.alias);
1937
+ }
1938
+ return out;
1939
+ }
1940
+ /** The source alias whose items a variable holds, if it declares one (for field suggestions). */
1941
+ function variableItemsFrom(dataSources, alias) {
1942
+ for (const ds of dataSources ?? []) {
1943
+ if (ds?.type === 'variable' && ds.alias === alias)
1944
+ return ds.request?.variable?.itemsFrom || undefined;
1945
+ }
1946
+ return undefined;
1947
+ }
1920
1948
  /**
1921
1949
  * Normalise a collection response into the shape a source expects: unwraps `{items}`/`{data}`
1922
1950
  * envelopes, then returns the first item for a `single` source or the whole array for a `list`.
@@ -3480,6 +3508,59 @@ function contextActionEffect(action, pass = 'forward') {
3480
3508
  return params.noReverse ? null : { op: 'clear', slot };
3481
3509
  }
3482
3510
 
3511
+ /**
3512
+ * Which slot keys are actually IN USE on a page — derived from the layout tree itself.
3513
+ *
3514
+ * A slot only matters at runtime if something writes it (a `setContext`/`clearContext` action) or
3515
+ * reads it (a binding whose `source` names it). Deriving the set from the tree means the runtime
3516
+ * works without waiting on the page model: a DECLARED `IoxContextSlot` adds typing for the bind
3517
+ * picker and a `default`, but is not required for the channel to function.
3518
+ *
3519
+ * Union of declared + in-use, so a declared-but-unused slot still seeds its default, and a slot used
3520
+ * by a symbol dropped onto a page that never declared it still works (it just has no default).
3521
+ */
3522
+ function collectContextSlotKeys(nodes,
3523
+ /** Declared VARIABLES — page resources of `type: 'variable'`, or legacy slot declarations. */
3524
+ declared = []) {
3525
+ const written = new Set();
3526
+ const read = new Set();
3527
+ walk(nodes, written, read);
3528
+ // A binding only names a SLOT if something writes that key; otherwise it names a data source.
3529
+ const keys = new Set(written);
3530
+ for (const key of read)
3531
+ if (written.has(key))
3532
+ keys.add(key);
3533
+ for (const decl of declared) {
3534
+ // A declared variable (a data source of type 'variable') or a legacy IoxContextSlot.
3535
+ const key = decl?.key
3536
+ ?? (decl?.type === 'variable' ? decl.alias : undefined);
3537
+ if (key)
3538
+ keys.add(key);
3539
+ }
3540
+ return keys;
3541
+ }
3542
+ function walk(nodes, written, read) {
3543
+ for (const raw of nodes ?? []) {
3544
+ const node = raw;
3545
+ if (!node)
3546
+ continue;
3547
+ for (const ix of node.interactions ?? []) {
3548
+ for (const action of [...(ix?.actions ?? []), ...(ix?.reverseActions ?? [])]) {
3549
+ const effect = contextActionEffect(action, 'forward')
3550
+ ?? contextActionEffect(action, 'reverse');
3551
+ if (effect)
3552
+ written.add(effect.slot);
3553
+ }
3554
+ }
3555
+ for (const binding of node.bindings ?? []) {
3556
+ if (binding?.source)
3557
+ read.add(binding.source);
3558
+ }
3559
+ if (Array.isArray(node.children))
3560
+ walk(node.children, written, read);
3561
+ }
3562
+ }
3563
+
3483
3564
  /**
3484
3565
  * Cinematic page-transition presets — the SINGLE SOURCE OF TRUTH shared by the page builder
3485
3566
  * (preview) and the SSR client engine (production). Pure, transport-agnostic: this module only
@@ -3914,5 +3995,5 @@ function effectiveTransitionId(anim) {
3914
3995
  * Generated bundle index. Do not edit.
3915
3996
  */
3916
3997
 
3917
- export { AOSService, AnalyticsService, BuilderButtonComponent, BuilderDividerComponent, BuilderHeadingComponent, BuilderIconComponent, BuilderImageComponent, BuilderLinkComponent, BuilderSpacerComponent, ButtonBlockComponent, CMSClientInfraModule, CONTEXT_ACTION_TYPES, CardComponent, ClientGalleryComponent, ClientListComponent, ClientListItemComponent, ClientRepeaterComponent, ClientSliderContainerComponent, ClientSliderSlideComponent, ComponentInstanceRegistryService, ConsentService, ContainerComponent, ContentService, ContextStore, DEFAULT_GALLERY_SCHEDULER, DEFAULT_PAGE_TRANSITION, DEFAULT_PAGE_TRANSITION_DURATION, DEFAULT_PAGE_TRANSITION_EASING, DEFAULT_PAGE_TRANSITION_PERSPECTIVE, DEFAULT_WIDTH_BY_TYPE, ENVIRONMENT, GALLERY_EFFECTS, GALLERY_EFFECT_DESCRIPTORS, GalleryLoop, IOX_BUILDER_EVENTS, IS_PREVIEW, IoxAnimateContainer, IoxAosDirective, IoxAosModule, IoxBuilderComponentsModule, IoxComponentRegistryService, IoxPageComponent, IoxPageModule, IoxUiModule, LinkedContainerComponent, PAGE_TRANSITION_CATEGORIES, PAGE_TRANSITION_PRESETS, PIPE_DESCRIPTORS, PIPE_REGISTRY, PageScrollProvider, PrivacyModalComponent, PrivacyModalService, PrivacyModelEvent, RESERVED_ALIAS_PREFIX, SUPPRESSED_STYLE_PROPS_BY_TYPE, SectionComponent, TRANSITION_FEELS, TextBlockComponent, VIRTUAL_TRAIT_KEYS, ViewPositionDirective, ViewPositionModule, WebSettingsService, applyBindingPipes, applyFeel, buildDataSourceFilter, buildRelatedFilter, buildTargetedStateSelector, buildTransitionTimeline, collectReferencedAliases, compileDeclarations, composeVirtualTraits, computeRelative, contextActionEffect, contextSlotKeys, dataSourcePlanToRequest, declaredInputNames, effectiveTransitionId, excludeSelf, feelFor, getByPath, initialSlotValues, isContextAction, isReservedAlias, isValidSlotKey, legacyEnterToTransition, matchRouteParams, nearestCommonAncestorId, nodeCssId, nodeUsesContext, normalizeCollectionResult, parseUrlList, planDataSource, referencedDataSources, referencedDataSourcesDeep, renderDefaultDeclarations, resolveContextValue, resolveDerivedInto, resolveGalleryEffect, resolveGalleryUrls, resolvePageTransition, resolvePath, resolveRelativeInto, resolveRepeaterItems, resolveSiblings, resolveSingleItemId, rewriteViewportUnits, safeSetInput, stripSuppressedProps, styleKeyToKebab, withContextSlots };
3998
+ export { AOSService, AnalyticsService, BuilderButtonComponent, BuilderDividerComponent, BuilderHeadingComponent, BuilderIconComponent, BuilderImageComponent, BuilderLinkComponent, BuilderSpacerComponent, ButtonBlockComponent, CMSClientInfraModule, CONTEXT_ACTION_TYPES, CardComponent, ClientGalleryComponent, ClientListComponent, ClientListItemComponent, ClientRepeaterComponent, ClientSliderContainerComponent, ClientSliderSlideComponent, ComponentInstanceRegistryService, ConsentService, ContainerComponent, ContentService, ContextStore, DEFAULT_GALLERY_SCHEDULER, DEFAULT_PAGE_TRANSITION, DEFAULT_PAGE_TRANSITION_DURATION, DEFAULT_PAGE_TRANSITION_EASING, DEFAULT_PAGE_TRANSITION_PERSPECTIVE, DEFAULT_WIDTH_BY_TYPE, ENVIRONMENT, GALLERY_EFFECTS, GALLERY_EFFECT_DESCRIPTORS, GalleryLoop, IOX_BUILDER_EVENTS, IS_PREVIEW, IoxAnimateContainer, IoxAosDirective, IoxAosModule, IoxBuilderComponentsModule, IoxComponentRegistryService, IoxPageComponent, IoxPageModule, IoxUiModule, LinkedContainerComponent, PAGE_TRANSITION_CATEGORIES, PAGE_TRANSITION_PRESETS, PIPE_DESCRIPTORS, PIPE_REGISTRY, PageScrollProvider, PrivacyModalComponent, PrivacyModalService, PrivacyModelEvent, RESERVED_ALIAS_PREFIX, SUPPRESSED_STYLE_PROPS_BY_TYPE, SectionComponent, TRANSITION_FEELS, TextBlockComponent, VIRTUAL_TRAIT_KEYS, ViewPositionDirective, ViewPositionModule, WebSettingsService, applyBindingPipes, applyFeel, buildDataSourceFilter, buildRelatedFilter, buildTargetedStateSelector, buildTransitionTimeline, collectContextSlotKeys, collectReferencedAliases, compileDeclarations, composeVirtualTraits, computeRelative, contextActionEffect, contextSlotKeys, dataSourcePlanToRequest, declaredInputNames, effectiveTransitionId, excludeSelf, feelFor, getByPath, initialSlotValues, isContextAction, isReservedAlias, isValidSlotKey, legacyEnterToTransition, matchRouteParams, nearestCommonAncestorId, nodeCssId, nodeUsesContext, normalizeCollectionResult, parseUrlList, planDataSource, referencedDataSources, referencedDataSourcesDeep, renderDefaultDeclarations, resolveContextValue, resolveDerivedInto, resolveGalleryEffect, resolveGalleryUrls, resolvePageTransition, resolvePath, resolveRelativeInto, resolveRepeaterItems, resolveSiblings, resolveSingleItemId, rewriteViewportUnits, safeSetInput, stripSuppressedProps, styleKeyToKebab, variableAliases, variableItemsFrom, withContextSlots };
3918
3999
  //# sourceMappingURL=vectoriox-iox-ui.mjs.map