@vectoriox/iox-ui 4.11.0 → 4.13.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
|
@@ -873,6 +873,148 @@ interface DataSourceRequest {
|
|
|
873
873
|
*/
|
|
874
874
|
declare function dataSourcePlanToRequest(plan: DataSourcePlan, endpoints: DataSourceEndpoints): DataSourceRequest | null;
|
|
875
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
|
+
/** The already-resolved inputs a single relative source computes from. Assembled by each consumer:
|
|
992
|
+
* the batch pass reads them from the resolved map; the builder resolves them async per alias. */
|
|
993
|
+
interface RelativeInputs {
|
|
994
|
+
/** The subject item (the current resource) — for `current`/`siblings`/`related`. */
|
|
995
|
+
subject?: any;
|
|
996
|
+
/** The collection to locate within / search — for `siblings`/`related`. */
|
|
997
|
+
collection?: any;
|
|
998
|
+
/** Route path params — for `route`. */
|
|
999
|
+
routeParams?: Record<string, any>;
|
|
1000
|
+
}
|
|
1001
|
+
/**
|
|
1002
|
+
* Compute ONE relative source's value from its already-resolved {@link RelativeInputs} — the SHARED
|
|
1003
|
+
* kind→computation decision, so the batch pass ({@link resolveRelativeInto}) and the builder's async
|
|
1004
|
+
* per-alias resolver produce identical results with no forked switch. `route` → the route params;
|
|
1005
|
+
* `current` → the subject; `siblings` → {@link resolveSiblings} over the collection; `related` → the
|
|
1006
|
+
* collection filtered by {@link buildRelatedFilter}'s predicate (+ {@link excludeSelf}).
|
|
1007
|
+
*/
|
|
1008
|
+
declare function computeRelative(spec: RelativeSourceSpec, inputs: RelativeInputs): any;
|
|
1009
|
+
/**
|
|
1010
|
+
* Compute every `type:'relative'` source into `resolved` (keyed by alias), IN PLACE. Pure w.r.t. HTTP
|
|
1011
|
+
* — it only reads already-resolved roots + the route params, so both consumers run it identically as
|
|
1012
|
+
* a second pass. Delegates each source to {@link computeRelative}. `current`'s subject is `from`;
|
|
1013
|
+
* `siblings`/`related` take `collection` = `from` and `subject` = `subjectFrom ?? from`. Mutates and
|
|
1014
|
+
* returns `resolved`.
|
|
1015
|
+
*/
|
|
1016
|
+
declare function resolveRelativeInto(dataSources: RelativeCapableSource[], resolved: Record<string, any>, routeParams?: Record<string, any>): Record<string, any>;
|
|
1017
|
+
|
|
876
1018
|
/**
|
|
877
1019
|
* Cinematic page-transition presets — the SINGLE SOURCE OF TRUTH shared by the page builder
|
|
878
1020
|
* (preview) and the SSR client engine (production). Pure, transport-agnostic: this module only
|
|
@@ -1020,5 +1162,5 @@ declare function effectiveTransitionId(anim: {
|
|
|
1020
1162
|
enter?: string | null;
|
|
1021
1163
|
} | null | undefined): string;
|
|
1022
1164
|
|
|
1023
|
-
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, collectReferencedAliases, compileDeclarations, composeVirtualTraits, dataSourcePlanToRequest, effectiveTransitionId, feelFor, getByPath, legacyEnterToTransition, matchRouteParams, normalizeCollectionResult, planDataSource, referencedDataSources, referencedDataSourcesDeep, renderDefaultDeclarations, resolveDerivedInto, resolvePageTransition, resolveRepeaterItems, resolveSingleItemId, rewriteViewportUnits, stripSuppressedProps, styleKeyToKebab };
|
|
1024
|
-
export type { DataSourceDomain, DataSourceEndpoints, DataSourceMode, DataSourcePlan, DataSourceQueryFilter, DataSourceRequest, DataSourceRequestSpec, DataSourceRouteFilter, DataSourceSpec, IBuilderEventEmitter, PageTransitionCategory, PageTransitionCategoryMeta, PageTransitionOptions, PageTransitionPreset, ResolvedPageTransition, TransitionFeel, TransitionPhase, TransitionTimelineInput };
|
|
1165
|
+
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, computeRelative, dataSourcePlanToRequest, effectiveTransitionId, excludeSelf, feelFor, getByPath, isReservedAlias, legacyEnterToTransition, matchRouteParams, normalizeCollectionResult, planDataSource, referencedDataSources, referencedDataSourcesDeep, renderDefaultDeclarations, resolveDerivedInto, resolvePageTransition, resolveRelativeInto, resolveRepeaterItems, resolveSiblings, resolveSingleItemId, rewriteViewportUnits, stripSuppressedProps, styleKeyToKebab };
|
|
1166
|
+
export type { BuildRelatedFilterOptions, DataSourceDomain, DataSourceEndpoints, DataSourceMode, DataSourcePlan, DataSourceQueryFilter, DataSourceRequest, DataSourceRequestSpec, DataSourceRouteFilter, DataSourceSpec, IBuilderEventEmitter, PageTransitionCategory, PageTransitionCategoryMeta, PageTransitionOptions, PageTransitionPreset, RelativeInputs, RelativeSourceKind, RelativeSourceSpec, ResolveSiblingsOptions, ResolvedPageTransition, RouteContext, SiblingsResult, TransitionFeel, TransitionPhase, TransitionTimelineInput };
|