@vectoriox/iox-ui 4.10.0 → 4.12.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,6 +1,6 @@
1
1
  {
2
2
  "name": "@vectoriox/iox-ui",
3
- "version": "4.10.0",
3
+ "version": "4.12.0",
4
4
  "peerDependencies": {
5
5
  "@angular/common": ">=20.0.0",
6
6
  "@angular/core": ">=20.0.0",
@@ -842,6 +842,16 @@ declare function getByPath(obj: any, path: string): any;
842
842
  */
843
843
  declare function resolveDerivedInto(dataSources: DataSourceSpec[], resolved: Record<string, any>): Record<string, any>;
844
844
  declare function resolveRepeaterItems(resolved: any, sourcePath?: string | null): any[];
845
+ /** Aliases referenced anywhere in a node tree: a repeater/slider `source` (a `bindings` entry with
846
+ * `prop === 'source'`, or `props.source` for the slider) plus every binding's `source`. */
847
+ declare function collectReferencedAliases(nodes: any[], acc?: Set<string>): Set<string>;
848
+ /** The subset of `all` whose `alias` is referenced by `nodes` (shallow — direct references only). */
849
+ declare function referencedDataSources(nodes: any[], all: any[]): any[];
850
+ /** Like `referencedDataSources`, but also pulls in the DERIVED dependencies (transitively): a
851
+ * referenced `derived` alias needs its `request.derived.from` source resolved too, even though the
852
+ * layout never names the parent directly. Use this when RESOLVING (the engine) so derived views
853
+ * don't resolve to nothing. */
854
+ declare function referencedDataSourcesDeep(nodes: any[], all: any[]): any[];
845
855
  /** Base URLs for the PUBLIC content controllers. Both must end with `/`. The builder and the SSR
846
856
  * engine pass their own host (they proxy `/api` differently) but MUST target the public
847
857
  * (`@Public()`) controllers, never the authed admin ones — data resolving is storefront data. */
@@ -863,6 +873,130 @@ interface DataSourceRequest {
863
873
  */
864
874
  declare function dataSourcePlanToRequest(plan: DataSourcePlan, endpoints: DataSourceEndpoints): DataSourceRequest | null;
865
875
 
876
+ /**
877
+ * Shared RELATIVE (route-context) data resolving — the SINGLE source of truth for how a detail page
878
+ * derives values FROM its current route item, consumed by BOTH the page builder (iox-cms-client) and
879
+ * the SSR client engine (iox-client-engine). Companion to `data-source-resolver.ts`.
880
+ *
881
+ * These are the pure, transport-agnostic pieces behind the Route binding scope
882
+ * (`$route` / `$current` / `$siblings` / `$related`). Resolution is a DEPENDENT SECOND PASS: the
883
+ * consumer resolves `$current` first (the existing single by-id fetch via `planDataSource`), then
884
+ * calls these to derive the relative values — there is NO new `DataSourcePlan` kind (`$related` still
885
+ * feeds a normal `collection` plan built from {@link buildRelatedFilter}). See
886
+ * `architecture/builder/relative-data-sources-plan.md`.
887
+ *
888
+ * There must be no second copy of this decision logic; only the transport (which HTTP layer fetches
889
+ * the ordered collection / related list) differs between the two consumers.
890
+ */
891
+ /** Aliases in the Route scope are platform-owned and start with this prefix; a USER alias may never
892
+ * start with it, which keeps the Route scope structurally collision-proof with Local/Global. Used to
893
+ * validate new/renamed aliases and to render the reserved (read-only) item state in the bind picker. */
894
+ declare const RESERVED_ALIAS_PREFIX = "$";
895
+ /** True for a platform-owned Route-scope alias (`$route`, `$current`, `$siblings`, `$related`, …). */
896
+ declare function isReservedAlias(alias: string | null | undefined): boolean;
897
+ /** The `$siblings` value: the current item's neighbours within an ordered set. */
898
+ interface SiblingsResult<T = any> {
899
+ /** The item before the current one (`null` at the start, unless `wrap`). */
900
+ prev: T | null;
901
+ /** The item after the current one (`null` at the end, unless `wrap`). */
902
+ next: T | null;
903
+ /** Zero-based position of the current item in the ordered set; `-1` when not found. */
904
+ index: number;
905
+ /** Total items in the set. */
906
+ count: number;
907
+ /** `true` when the current item is the first in the set. */
908
+ isFirst: boolean;
909
+ /** `true` when the current item is the last in the set. */
910
+ isLast: boolean;
911
+ }
912
+ interface ResolveSiblingsOptions {
913
+ /** Field identifying the current item within the list. Default `_id`. */
914
+ idField?: string;
915
+ /** Dot/bracket path to sort by BEFORE locating neighbours (e.g. `order`, `date`). Omit to use the
916
+ * list's existing order. The same item neighbours differently per ordering, so this is the one
917
+ * choice `$siblings` requires. */
918
+ sortBy?: string;
919
+ /** Sort direction when `sortBy` is set. Default `asc`. */
920
+ sortDir?: 'asc' | 'desc';
921
+ /** Wrap around the ends (`last.next` → first, `first.prev` → last). Only applies when `count > 1`.
922
+ * Default `false`. */
923
+ wrap?: boolean;
924
+ }
925
+ /**
926
+ * Locate the current item within an ordered set and return its neighbours + position. Pure: the input
927
+ * list is never mutated (sorting works on a shallow copy). `currentId` is compared to each item's
928
+ * `idField` via string equality (route-param values are strings). When the current id isn't found,
929
+ * `index` is `-1` and `prev`/`next` are `null` (but `count` still reflects the set size).
930
+ */
931
+ declare function resolveSiblings<T = any>(items: T[] | null | undefined, currentId: string | number | null | undefined, options?: ResolveSiblingsOptions): SiblingsResult<T>;
932
+ interface BuildRelatedFilterOptions {
933
+ /** Field(s) on the current item whose value(s) the related items must match (e.g. `category`,
934
+ * or `['category', 'brand']`). Each contributes an equality filter on that field. */
935
+ matchFields: string | string[];
936
+ }
937
+ /**
938
+ * Build the collection filter for `$related` from the resolved current item: an equality match on
939
+ * each `matchField`'s value (e.g. same `category`). Feeds a normal `collection` plan — no new plan
940
+ * kind. Fields whose value is not a scalar (or is empty) are omitted, matching
941
+ * `buildDataSourceFilter`'s "don't over-filter" rule. Exclude-self is applied to the RESULT via
942
+ * {@link excludeSelf} (the public query controllers are equality-only, so it can't be a `$ne` param).
943
+ */
944
+ declare function buildRelatedFilter(current: any, options: BuildRelatedFilterOptions): Record<string, any>;
945
+ /**
946
+ * Drop the current item from a list by `idField` (default `_id`). Used to exclude self from a
947
+ * `$related` result after fetch. A nullish/empty `currentId` leaves the list unchanged.
948
+ */
949
+ declare function excludeSelf<T = any>(items: T[] | null | undefined, currentId: string | number | null | undefined, idField?: string): T[];
950
+ /** The resolved Route-scope context bound values read from (`$route.projectId`, `$current.title`,
951
+ * `$siblings.next`, `$related`). Assembled by each consumer during its dependent second pass. */
952
+ interface RouteContext {
953
+ /** Route path params for the current URL (from `matchRouteParams`). */
954
+ $route: Record<string, string>;
955
+ /** The resolved current item (the page's single by-id source). */
956
+ $current: any;
957
+ /** Neighbours of the current item within a chosen ordered set. */
958
+ $siblings?: SiblingsResult;
959
+ /** Items related to the current one (same-attribute), excluding self. */
960
+ $related?: any[];
961
+ }
962
+ type RelativeSourceKind = 'route' | 'current' | 'siblings' | 'related';
963
+ interface RelativeSourceSpec {
964
+ kind: RelativeSourceKind;
965
+ /** The source alias this derives from: for `current` the subject single-source; for
966
+ * `siblings`/`related` the COLLECTION alias to locate within / search. Unused for `route`. */
967
+ from?: string;
968
+ /** `siblings`/`related`: the SUBJECT source alias (the current item) whose id / field values drive
969
+ * the computation. Defaults to `from` when omitted. May reference `$current`. */
970
+ subjectFrom?: string;
971
+ /** Field identifying an item. Default `_id`. */
972
+ idField?: string;
973
+ /** `siblings`: sort the set before locating neighbours. */
974
+ sortBy?: string;
975
+ sortDir?: 'asc' | 'desc';
976
+ wrap?: boolean;
977
+ /** `related`: field(s) on the subject the results must match. */
978
+ matchFields?: string | string[];
979
+ /** `related`: drop the subject from its own results. Default `true`. */
980
+ excludeSelf?: boolean;
981
+ }
982
+ /** Duck-typed view of a data source carrying an optional relative descriptor (avoids a hard dep on
983
+ * the full editor model / a circular type import). */
984
+ interface RelativeCapableSource {
985
+ alias?: string;
986
+ type?: string;
987
+ request?: {
988
+ relative?: RelativeSourceSpec;
989
+ };
990
+ }
991
+ /**
992
+ * Compute every `type:'relative'` source into `resolved` (keyed by alias), IN PLACE. Pure w.r.t. HTTP
993
+ * — it only reads already-resolved roots + the route params, so both consumers run it identically as
994
+ * a second pass. `route` → the route params; `current` → the subject source value; `siblings` →
995
+ * {@link resolveSiblings} over the collection; `related` → the collection filtered client-side by
996
+ * {@link buildRelatedFilter}'s predicate (+ {@link excludeSelf}). Mutates and returns `resolved`.
997
+ */
998
+ declare function resolveRelativeInto(dataSources: RelativeCapableSource[], resolved: Record<string, any>, routeParams?: Record<string, any>): Record<string, any>;
999
+
866
1000
  /**
867
1001
  * Cinematic page-transition presets — the SINGLE SOURCE OF TRUTH shared by the page builder
868
1002
  * (preview) and the SSR client engine (production). Pure, transport-agnostic: this module only
@@ -1010,5 +1144,5 @@ declare function effectiveTransitionId(anim: {
1010
1144
  enter?: string | null;
1011
1145
  } | null | undefined): string;
1012
1146
 
1013
- export { AOSService, AnalyticsService, BuilderButtonComponent, BuilderDividerComponent, BuilderHeadingComponent, BuilderIconComponent, BuilderImageComponent, BuilderLinkComponent, BuilderSpacerComponent, ButtonBlockComponent, CMSClientInfraModule, CardComponent, ClientListComponent, ClientListItemComponent, ClientRepeaterComponent, ClientSliderContainerComponent, ClientSliderSlideComponent, ComponentInstanceRegistryService, ConsentService, ContainerComponent, ContentService, DEFAULT_PAGE_TRANSITION, DEFAULT_PAGE_TRANSITION_DURATION, DEFAULT_PAGE_TRANSITION_EASING, DEFAULT_PAGE_TRANSITION_PERSPECTIVE, DEFAULT_WIDTH_BY_TYPE, ENVIRONMENT, IOX_BUILDER_EVENTS, IS_PREVIEW, IoxAnimateContainer, IoxAosDirective, IoxAosModule, IoxBuilderComponentsModule, IoxComponentRegistryService, IoxPageComponent, IoxPageModule, IoxUiModule, LinkedContainerComponent, PAGE_TRANSITION_CATEGORIES, PAGE_TRANSITION_PRESETS, PageScrollProvider, PrivacyModalComponent, PrivacyModalService, PrivacyModelEvent, SUPPRESSED_STYLE_PROPS_BY_TYPE, SectionComponent, TRANSITION_FEELS, TextBlockComponent, VIRTUAL_TRAIT_KEYS, ViewPositionDirective, ViewPositionModule, WebSettingsService, applyFeel, buildDataSourceFilter, buildTransitionTimeline, compileDeclarations, composeVirtualTraits, dataSourcePlanToRequest, effectiveTransitionId, feelFor, getByPath, legacyEnterToTransition, matchRouteParams, normalizeCollectionResult, planDataSource, renderDefaultDeclarations, resolveDerivedInto, resolvePageTransition, resolveRepeaterItems, resolveSingleItemId, rewriteViewportUnits, stripSuppressedProps, styleKeyToKebab };
1014
- export type { DataSourceDomain, DataSourceEndpoints, DataSourceMode, DataSourcePlan, DataSourceQueryFilter, DataSourceRequest, DataSourceRequestSpec, DataSourceRouteFilter, DataSourceSpec, IBuilderEventEmitter, PageTransitionCategory, PageTransitionCategoryMeta, PageTransitionOptions, PageTransitionPreset, ResolvedPageTransition, TransitionFeel, TransitionPhase, TransitionTimelineInput };
1147
+ export { AOSService, AnalyticsService, BuilderButtonComponent, BuilderDividerComponent, BuilderHeadingComponent, BuilderIconComponent, BuilderImageComponent, BuilderLinkComponent, BuilderSpacerComponent, ButtonBlockComponent, CMSClientInfraModule, CardComponent, ClientListComponent, ClientListItemComponent, ClientRepeaterComponent, ClientSliderContainerComponent, ClientSliderSlideComponent, ComponentInstanceRegistryService, ConsentService, ContainerComponent, ContentService, DEFAULT_PAGE_TRANSITION, DEFAULT_PAGE_TRANSITION_DURATION, DEFAULT_PAGE_TRANSITION_EASING, DEFAULT_PAGE_TRANSITION_PERSPECTIVE, DEFAULT_WIDTH_BY_TYPE, ENVIRONMENT, IOX_BUILDER_EVENTS, IS_PREVIEW, IoxAnimateContainer, IoxAosDirective, IoxAosModule, IoxBuilderComponentsModule, IoxComponentRegistryService, IoxPageComponent, IoxPageModule, IoxUiModule, LinkedContainerComponent, PAGE_TRANSITION_CATEGORIES, PAGE_TRANSITION_PRESETS, PageScrollProvider, PrivacyModalComponent, PrivacyModalService, PrivacyModelEvent, RESERVED_ALIAS_PREFIX, SUPPRESSED_STYLE_PROPS_BY_TYPE, SectionComponent, TRANSITION_FEELS, TextBlockComponent, VIRTUAL_TRAIT_KEYS, ViewPositionDirective, ViewPositionModule, WebSettingsService, applyFeel, buildDataSourceFilter, buildRelatedFilter, buildTransitionTimeline, collectReferencedAliases, compileDeclarations, composeVirtualTraits, dataSourcePlanToRequest, effectiveTransitionId, excludeSelf, feelFor, getByPath, isReservedAlias, legacyEnterToTransition, matchRouteParams, normalizeCollectionResult, planDataSource, referencedDataSources, referencedDataSourcesDeep, renderDefaultDeclarations, resolveDerivedInto, resolvePageTransition, resolveRelativeInto, resolveRepeaterItems, resolveSiblings, resolveSingleItemId, rewriteViewportUnits, stripSuppressedProps, styleKeyToKebab };
1148
+ export type { BuildRelatedFilterOptions, DataSourceDomain, DataSourceEndpoints, DataSourceMode, DataSourcePlan, DataSourceQueryFilter, DataSourceRequest, DataSourceRequestSpec, DataSourceRouteFilter, DataSourceSpec, IBuilderEventEmitter, PageTransitionCategory, PageTransitionCategoryMeta, PageTransitionOptions, PageTransitionPreset, RelativeSourceKind, RelativeSourceSpec, ResolveSiblingsOptions, ResolvedPageTransition, RouteContext, SiblingsResult, TransitionFeel, TransitionPhase, TransitionTimelineInput };