@vectoriox/iox-ui 4.8.1 → 4.10.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.
@@ -2337,6 +2337,10 @@ function planDataSource(ds, routeParams = {}, queryParams = {}) {
2337
2337
  }
2338
2338
  case 'static':
2339
2339
  return { kind: 'static', data: ds.request?.data ?? null, mode };
2340
+ case 'derived': {
2341
+ const d = ds.request?.derived;
2342
+ return d?.from ? { kind: 'derived', from: d.from, path: d.path ?? '', mode } : { kind: 'none' };
2343
+ }
2340
2344
  default:
2341
2345
  return { kind: 'none' };
2342
2346
  }
@@ -2350,6 +2354,62 @@ function normalizeCollectionResult(mode, data) {
2350
2354
  const items = Array.isArray(data) ? data : (data?.items ?? data?.data ?? []);
2351
2355
  return mode === 'single' ? (items[0] ?? null) : items;
2352
2356
  }
2357
+ /** Navigate a dot/bracket path into an object, e.g. `gallery`, `details.images`, `variants[0].skus`.
2358
+ * Returns undefined if any segment is missing. Kept minimal + self-contained so it is shareable by
2359
+ * both the builder and the SSR engine (the two have divergent local `resolvePath` copies). */
2360
+ function getByPath(obj, path) {
2361
+ if (obj == null || !path)
2362
+ return obj;
2363
+ // Turn `a[0].b` into ['a','0','b'].
2364
+ const segments = path.replace(/\[(\w+)\]/g, '.$1').split('.').filter(Boolean);
2365
+ let cur = obj;
2366
+ for (const seg of segments) {
2367
+ if (cur == null)
2368
+ return undefined;
2369
+ cur = cur[seg];
2370
+ }
2371
+ return cur;
2372
+ }
2373
+ /**
2374
+ * The array a Repeater (or a repeating Slider) iterates over — the SHARED decision so the builder
2375
+ * canvas and the SSR engine agree (see data-source-resolving.md).
2376
+ * - No `sourcePath`: the resolved source IS the list. An array passes through; a lone object degrades
2377
+ * to a single-row list (back-compat with the old `fetchItems`); null/undefined → `[]`.
2378
+ * - With `sourcePath`: the source resolved to a SINGLE resource (e.g. a product); dive into the
2379
+ * nested array property (e.g. `gallery`). Non-array / missing → `[]`.
2380
+ */
2381
+ /**
2382
+ * Fill in `derived` aliases in an already-resolved map. Given the data sources and a map of resolved
2383
+ * NON-derived values (by alias), compute each `type:'derived'` alias as `getByPath(parent, path)` in
2384
+ * dependency order (chains resolved by iterating until stable). Mutates + returns the map. Used by the
2385
+ * SSR engine after it resolves the root sources; the builder resolves derived lazily per alias.
2386
+ */
2387
+ function resolveDerivedInto(dataSources, resolved) {
2388
+ const derived = (dataSources ?? []).filter(d => d?.type === 'derived' && !!d.alias);
2389
+ let changed = true, guard = 0;
2390
+ while (changed && guard++ < 25) {
2391
+ changed = false;
2392
+ for (const d of derived) {
2393
+ if (d.alias in resolved)
2394
+ continue;
2395
+ const from = d.request?.derived?.from;
2396
+ if (from && from in resolved) {
2397
+ resolved[d.alias] = getByPath(resolved[from], d.request.derived.path ?? '');
2398
+ changed = true;
2399
+ }
2400
+ }
2401
+ }
2402
+ return resolved;
2403
+ }
2404
+ function resolveRepeaterItems(resolved, sourcePath) {
2405
+ if (sourcePath) {
2406
+ const nested = getByPath(resolved, sourcePath);
2407
+ return Array.isArray(nested) ? nested : [];
2408
+ }
2409
+ if (Array.isArray(resolved))
2410
+ return resolved;
2411
+ return resolved == null ? [] : [resolved];
2412
+ }
2353
2413
  /**
2354
2414
  * Turn a resolved {@link DataSourcePlan} into the concrete public HTTP request (url + params) — the
2355
2415
  * SINGLE place that decides the URL shape, shared by the builder binding preview and the SSR engine
@@ -2808,5 +2868,5 @@ function effectiveTransitionId(anim) {
2808
2868
  * Generated bundle index. Do not edit.
2809
2869
  */
2810
2870
 
2811
- 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, legacyEnterToTransition, matchRouteParams, normalizeCollectionResult, planDataSource, renderDefaultDeclarations, resolvePageTransition, resolveSingleItemId, rewriteViewportUnits, stripSuppressedProps, styleKeyToKebab };
2871
+ 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 };
2812
2872
  //# sourceMappingURL=vectoriox-iox-ui.mjs.map