@vectoriox/iox-ui 4.16.2 → 4.17.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.
@@ -2845,6 +2845,83 @@ function composeVirtualTraits(raw, base = raw) {
2845
2845
  return result;
2846
2846
  }
2847
2847
 
2848
+ /**
2849
+ * tree-relations — framework-agnostic helpers for reasoning about a rendered node
2850
+ * tree's structural relationships. Lives in @vectoriox/iox-ui because BOTH renderers
2851
+ * depend on iox-ui (the engine does NOT depend on iox-builder), so the same logic
2852
+ * drives the builder canvas AND the SSR site — no fork.
2853
+ * See iox-ai-guidance `architecture/builder/targeted-hover-state-plan.md`.
2854
+ */
2855
+ /** The css id a node contributes to selectors: its clone `styleId`, else its own `id`. */
2856
+ function nodeCssId(node) {
2857
+ return node.styleId ?? node.id;
2858
+ }
2859
+ /**
2860
+ * Path of css ids from the root down to (and including) the node whose css id === `cssId`.
2861
+ * Returns `null` when no node matches. First match wins (depth-first, pre-order).
2862
+ */
2863
+ function pathToCssId(nodes, cssId) {
2864
+ for (const node of nodes) {
2865
+ const ownId = nodeCssId(node);
2866
+ if (ownId === cssId)
2867
+ return [ownId];
2868
+ if (node.children?.length) {
2869
+ const childPath = pathToCssId(node.children, cssId);
2870
+ if (childPath)
2871
+ return ownId ? [ownId, ...childPath] : childPath;
2872
+ }
2873
+ }
2874
+ return null;
2875
+ }
2876
+ /**
2877
+ * The css id of the NEAREST COMMON ANCESTOR of two nodes (identified by their css ids),
2878
+ * used to scope a `:has()` targeted-state selector so it stays repetition-safe.
2879
+ *
2880
+ * The result may equal `styledCssId` (the trigger sits INSIDE the styled node) or
2881
+ * `triggerCssId` (the styled node sits inside the trigger) — both are valid scopes;
2882
+ * `buildTargetedStateSelector` picks the right selector shape for each. Returns
2883
+ * `undefined` only when a valid scope can't exist: an id is blank, the two ids are the
2884
+ * same node, or they share no ancestor in `root`. Callers MUST skip emitting the rule
2885
+ * when this is `undefined` — never emit an unscoped (page-global) `:has()`, which would
2886
+ * break under repetition.
2887
+ */
2888
+ function nearestCommonAncestorId(root, styledCssId, triggerCssId) {
2889
+ if (!styledCssId || !triggerCssId || styledCssId === triggerCssId)
2890
+ return undefined;
2891
+ const styledPath = pathToCssId(root, styledCssId);
2892
+ const triggerPath = pathToCssId(root, triggerCssId);
2893
+ if (!styledPath || !triggerPath)
2894
+ return undefined;
2895
+ // Walk both paths together; the last shared prefix element is the common ancestor.
2896
+ let common;
2897
+ const shorter = Math.min(styledPath.length, triggerPath.length);
2898
+ for (let i = 0; i < shorter; i++) {
2899
+ if (styledPath[i] !== triggerPath[i])
2900
+ break;
2901
+ common = styledPath[i];
2902
+ }
2903
+ return common;
2904
+ }
2905
+ /**
2906
+ * Build the selector BODY (no leading `.`, matching the builder's `compile()` convention)
2907
+ * for a targeted state, given the resolved scope. Three topologies, one shared rule:
2908
+ *
2909
+ * - trigger INSIDE styled (scope === styled): `iox-node-{styled}:has(.iox-node-{trigger}:{base})`
2910
+ * - styled INSIDE trigger (scope === trigger): `iox-node-{trigger}:{base} .iox-node-{styled}`
2911
+ * - separate subtrees (scope is above both): `iox-node-{scope}:has(.iox-node-{trigger}:{base}) .iox-node-{styled}`
2912
+ *
2913
+ * `scopeCssId` MUST be a value returned by `nearestCommonAncestorId` for the same pair.
2914
+ */
2915
+ function buildTargetedStateSelector(scopeCssId, triggerCssId, styledCssId, base) {
2916
+ if (scopeCssId === styledCssId) {
2917
+ return `iox-node-${styledCssId}:has(.iox-node-${triggerCssId}:${base})`;
2918
+ }
2919
+ if (scopeCssId === triggerCssId) {
2920
+ return `iox-node-${triggerCssId}:${base} .iox-node-${styledCssId}`;
2921
+ }
2922
+ return `iox-node-${scopeCssId}:has(.iox-node-${triggerCssId}:${base}) .iox-node-${styledCssId}`;
2923
+ }
2924
+
2848
2925
  /**
2849
2926
  * Shared RELATIVE (route-context) data resolving — the SINGLE source of truth for how a detail page
2850
2927
  * derives values FROM its current route item, consumed by BOTH the page builder (iox-cms-client) and
@@ -3550,5 +3627,5 @@ function effectiveTransitionId(anim) {
3550
3627
  * Generated bundle index. Do not edit.
3551
3628
  */
3552
3629
 
3553
- export { AOSService, AnalyticsService, BuilderButtonComponent, BuilderDividerComponent, BuilderHeadingComponent, BuilderIconComponent, BuilderImageComponent, BuilderLinkComponent, BuilderSpacerComponent, ButtonBlockComponent, CMSClientInfraModule, CardComponent, ClientGalleryComponent, ClientListComponent, ClientListItemComponent, ClientRepeaterComponent, ClientSliderContainerComponent, ClientSliderSlideComponent, ComponentInstanceRegistryService, ConsentService, ContainerComponent, ContentService, 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, buildTransitionTimeline, collectReferencedAliases, compileDeclarations, composeVirtualTraits, computeRelative, dataSourcePlanToRequest, effectiveTransitionId, excludeSelf, feelFor, getByPath, isReservedAlias, legacyEnterToTransition, matchRouteParams, normalizeCollectionResult, parseUrlList, planDataSource, referencedDataSources, referencedDataSourcesDeep, renderDefaultDeclarations, resolveDerivedInto, resolveGalleryEffect, resolveGalleryUrls, resolvePageTransition, resolveRelativeInto, resolveRepeaterItems, resolveSiblings, resolveSingleItemId, rewriteViewportUnits, stripSuppressedProps, styleKeyToKebab };
3630
+ export { AOSService, AnalyticsService, BuilderButtonComponent, BuilderDividerComponent, BuilderHeadingComponent, BuilderIconComponent, BuilderImageComponent, BuilderLinkComponent, BuilderSpacerComponent, ButtonBlockComponent, CMSClientInfraModule, CardComponent, ClientGalleryComponent, ClientListComponent, ClientListItemComponent, ClientRepeaterComponent, ClientSliderContainerComponent, ClientSliderSlideComponent, ComponentInstanceRegistryService, ConsentService, ContainerComponent, ContentService, 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, dataSourcePlanToRequest, effectiveTransitionId, excludeSelf, feelFor, getByPath, isReservedAlias, legacyEnterToTransition, matchRouteParams, nearestCommonAncestorId, nodeCssId, normalizeCollectionResult, parseUrlList, planDataSource, referencedDataSources, referencedDataSourcesDeep, renderDefaultDeclarations, resolveDerivedInto, resolveGalleryEffect, resolveGalleryUrls, resolvePageTransition, resolveRelativeInto, resolveRepeaterItems, resolveSiblings, resolveSingleItemId, rewriteViewportUnits, stripSuppressedProps, styleKeyToKebab };
3554
3631
  //# sourceMappingURL=vectoriox-iox-ui.mjs.map