@vectoriox/iox-ui 4.33.1 → 4.35.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.
@@ -2090,7 +2090,7 @@ function buildSwiperBreakpoints(inputs, responsive) {
2090
2090
  let previous = null;
2091
2091
  // Narrowest → widest, so "same as the band below" is a comparison against what we just emitted.
2092
2092
  for (const band of [...bands].reverse()) {
2093
- const resolved = pick(resolveInputs(inputs, responsive, band.id));
2093
+ const resolved = pick$1(resolveInputs(inputs, responsive, band.id));
2094
2094
  if (previous && sameValues(previous, resolved))
2095
2095
  continue;
2096
2096
  map[band.minWidth] = resolved;
@@ -2133,7 +2133,7 @@ function bandsWidestFirst() {
2133
2133
  return { id: def.id, minWidth };
2134
2134
  });
2135
2135
  }
2136
- function pick(resolved) {
2136
+ function pick$1(resolved) {
2137
2137
  const out = {};
2138
2138
  for (const name of SWIPER_RESPONSIVE_TRAITS) {
2139
2139
  if (resolved[name] !== undefined)
@@ -5466,6 +5466,588 @@ function resolvePath(obj, path) {
5466
5466
  }, obj);
5467
5467
  }
5468
5468
 
5469
+ /**
5470
+ * Resolve one binding's value out of its already-selected source data: path lookup, then pipes.
5471
+ *
5472
+ * Trivial on its own, which is exactly why it had been retyped at three call sites — the engine's
5473
+ * string renderer, the engine's component renderer and the builder canvas — plus a fourth needed by
5474
+ * page SEO. `resolvePath` itself was forked five times before it was shared, and the copy that
5475
+ * drifted caused a repeater to render in the SSR HTML and then blank on hydration.
5476
+ *
5477
+ * What is NOT here: picking the source (`resolvedData[binding.source]`) and deciding what an empty
5478
+ * context slot means. Those are per-renderer policy — the string renderer clears the prop, the
5479
+ * builder skips it — so they stay with the caller.
5480
+ */
5481
+ function resolveBoundValue(sourceData, binding, ctx = {}) {
5482
+ const raw = binding.path ? resolvePath(sourceData, binding.path) : sourceData;
5483
+ return applyBindingPipes(raw, binding.pipes, ctx);
5484
+ }
5485
+
5486
+ /**
5487
+ * The canonical shape of a page's SEO metadata, plus the flat tag list both renderers emit.
5488
+ *
5489
+ * ⚠️ This file is the ONLY declaration of that shape. Before it existed, `iox-cms` stored
5490
+ * `seo.og.title` while the SSR engine read a flat `seo.ogTitle`, so no Open Graph tag had ever been
5491
+ * emitted, and `iox-cms-client` carried a third, hand-copied variant of the same schema. See
5492
+ * iox-ai-guidance `architecture/cms/seo-plan.md`.
5493
+ */
5494
+ /**
5495
+ * The text fields that can carry a binding, as dotted paths into the document.
5496
+ *
5497
+ * One list, used by the resolver and (phase 2) by the panel that draws the bind affordance — so a
5498
+ * field can never be bindable in the UI and ignored at render time. `robots`, `sitemap.*` and
5499
+ * `structuredData` are deliberately absent: they are pick-lists and blobs, not prose.
5500
+ */
5501
+ const SEO_BINDABLE_FIELDS = [
5502
+ 'title',
5503
+ 'description',
5504
+ 'canonicalUrl',
5505
+ 'og.title',
5506
+ 'og.description',
5507
+ 'og.image',
5508
+ 'twitter.title',
5509
+ 'twitter.description',
5510
+ 'twitter.image',
5511
+ ];
5512
+ /**
5513
+ * The bottom rung of the ladder, as a table rather than a chain of ifs.
5514
+ *
5515
+ * Deliberately short. `og:title` and `twitter:*` are NOT here — `seoToTags` already falls back to
5516
+ * the page title for them, and materialising a copy of a value we did not author would only make
5517
+ * later drift harder to see.
5518
+ */
5519
+ const SEO_AUTO_SOURCES = [
5520
+ { field: 'title', source: 'contentTitle' },
5521
+ { field: 'description', source: 'contentDescription' },
5522
+ { field: 'og.image', source: 'contentImage' },
5523
+ { field: 'canonicalUrl', source: 'pageUrl' },
5524
+ ];
5525
+ /** Recommended maximum before search results truncate the title. */
5526
+ const SEO_TITLE_MAX = 60;
5527
+ /** Recommended maximum before search results truncate the description. */
5528
+ const SEO_DESCRIPTION_MAX = 160;
5529
+ const SEO_ROBOTS_OPTIONS = [
5530
+ { label: 'Index, Follow', value: 'index, follow' },
5531
+ { label: 'Index, No Follow', value: 'index, nofollow' },
5532
+ { label: 'No Index, Follow', value: 'noindex, follow' },
5533
+ { label: 'No Index, No Follow', value: 'noindex, nofollow' },
5534
+ ];
5535
+ const SEO_TWITTER_CARD_OPTIONS = [
5536
+ { label: 'Summary', value: 'summary' },
5537
+ { label: 'Summary Large Image', value: 'summary_large_image' },
5538
+ { label: 'App', value: 'app' },
5539
+ { label: 'Player', value: 'player' },
5540
+ ];
5541
+ const SEO_CHANGE_FREQ_OPTIONS = [
5542
+ { label: 'Always', value: 'always' },
5543
+ { label: 'Hourly', value: 'hourly' },
5544
+ { label: 'Daily', value: 'daily' },
5545
+ { label: 'Weekly', value: 'weekly' },
5546
+ { label: 'Monthly', value: 'monthly' },
5547
+ { label: 'Yearly', value: 'yearly' },
5548
+ { label: 'Never', value: 'never' },
5549
+ ];
5550
+
5551
+ /**
5552
+ * Coerce whatever a page document happens to hold into a `SeoDoc`.
5553
+ *
5554
+ * Every consumer calls this before reading `seo`, because four shapes are in the wild:
5555
+ * • the current nested shape (`og.title`);
5556
+ * • the flat shape the SSR engine used to read (`ogTitle`) — never actually written, but a
5557
+ * document hand-edited against the old engine code could carry it;
5558
+ * • `""` for "not set", which must not become an empty `<meta>`;
5559
+ * • `{ override: '…' }`, the per-field value object that plan phase 2 introduces — tolerated here
5560
+ * so the ladder can land without a second normalizer.
5561
+ *
5562
+ * Empty branches are dropped rather than left as `{}`, so `if (seo.og)` is a meaningful test.
5563
+ */
5564
+ function normalizeSeoDoc(raw) {
5565
+ const src = asRecord(raw);
5566
+ if (!src)
5567
+ return {};
5568
+ const og = compact({
5569
+ title: seoString(pick(src, 'og', 'title') ?? src['ogTitle']),
5570
+ description: seoString(pick(src, 'og', 'description') ?? src['ogDescription']),
5571
+ image: seoString(pick(src, 'og', 'image') ?? src['ogImage']),
5572
+ });
5573
+ const twitter = compact({
5574
+ card: seoString(pick(src, 'twitter', 'card')),
5575
+ title: seoString(pick(src, 'twitter', 'title')),
5576
+ description: seoString(pick(src, 'twitter', 'description')),
5577
+ image: seoString(pick(src, 'twitter', 'image')),
5578
+ });
5579
+ const sitemap = compact({
5580
+ include: bool(pick(src, 'sitemap', 'include')),
5581
+ priority: num(pick(src, 'sitemap', 'priority')),
5582
+ changeFreq: seoString(pick(src, 'sitemap', 'changeFreq')),
5583
+ });
5584
+ const structuredData = structured(src['structuredData']);
5585
+ const doc = compact({
5586
+ title: seoString(src['title']),
5587
+ description: seoString(src['description']),
5588
+ keywords: seoString(src['keywords']),
5589
+ canonicalUrl: seoString(src['canonicalUrl']),
5590
+ robots: seoString(src['robots']),
5591
+ og,
5592
+ twitter,
5593
+ sitemap,
5594
+ structuredData,
5595
+ });
5596
+ return doc ?? {};
5597
+ }
5598
+ /** Read `src[branch][leaf]` without assuming the branch exists or is an object. */
5599
+ function pick(src, branch, leaf) {
5600
+ const nested = asRecord(src[branch]);
5601
+ return nested ? nested[leaf] : undefined;
5602
+ }
5603
+ /**
5604
+ * A field's value as a trimmed string, or `undefined`. Exported because the resolver needs the exact
5605
+ * same coercion for a value it has just pulled out of a data source.
5606
+ *
5607
+ * Unwraps the value object: a bound or auto field has no `override`, so it correctly resolves to
5608
+ * `undefined` here and `resolveSeo` fills it in from the lower rungs.
5609
+ */
5610
+ function seoString(value) {
5611
+ const wrapper = asRecord(value);
5612
+ const raw = wrapper ? wrapper['override'] : value;
5613
+ if (typeof raw === 'number')
5614
+ return String(raw);
5615
+ if (typeof raw !== 'string')
5616
+ return undefined;
5617
+ const trimmed = raw.trim();
5618
+ return trimmed.length ? trimmed : undefined;
5619
+ }
5620
+ /**
5621
+ * `UIFormToDTO` can hand back `"true"` / `"false"` for a switch (see
5622
+ * `architecture/cms/shop.md` — the boolean/number coercion pitfall), so accept both.
5623
+ */
5624
+ function bool(value) {
5625
+ if (typeof value === 'boolean')
5626
+ return value;
5627
+ if (value === 'true')
5628
+ return true;
5629
+ if (value === 'false')
5630
+ return false;
5631
+ return undefined;
5632
+ }
5633
+ function num(value) {
5634
+ if (typeof value === 'number')
5635
+ return Number.isFinite(value) ? value : undefined;
5636
+ if (typeof value !== 'string' || !value.trim().length)
5637
+ return undefined;
5638
+ const parsed = Number(value);
5639
+ return Number.isFinite(parsed) ? parsed : undefined;
5640
+ }
5641
+ /** JSON-LD is stored as an object or as a JSON string from the `json` controller. */
5642
+ function structured(value) {
5643
+ if (typeof value === 'string') {
5644
+ const trimmed = value.trim();
5645
+ if (!trimmed.length)
5646
+ return undefined;
5647
+ try {
5648
+ return JSON.parse(trimmed);
5649
+ }
5650
+ catch {
5651
+ return undefined;
5652
+ }
5653
+ }
5654
+ if (Array.isArray(value))
5655
+ return value.length ? value : undefined;
5656
+ const record = asRecord(value);
5657
+ return record && Object.keys(record).length ? record : undefined;
5658
+ }
5659
+ function asRecord(value) {
5660
+ return value !== null && typeof value === 'object' && !Array.isArray(value)
5661
+ ? value
5662
+ : undefined;
5663
+ }
5664
+ /** Drop `undefined` values and empty nested objects, so absence is always `undefined`. */
5665
+ function compact(value) {
5666
+ const out = {};
5667
+ for (const [key, entry] of Object.entries(value)) {
5668
+ if (entry === undefined)
5669
+ continue;
5670
+ out[key] = entry;
5671
+ }
5672
+ return (Object.keys(out).length ? out : undefined);
5673
+ }
5674
+
5675
+ /**
5676
+ * Turn a page's SEO document into the flat list of head tags to emit.
5677
+ *
5678
+ * Both renderers call this, so a page cannot describe itself differently to a crawler than the
5679
+ * builder previews. The order is fixed and part of the contract: title, description, keywords,
5680
+ * canonical, Open Graph, Twitter, robots.
5681
+ *
5682
+ * Fallbacks are deliberately shallow — `og:title` reuses the page title, `twitter:*` reuses the
5683
+ * Open Graph values — because a social scraper that finds no `og:title` falls back to `<title>`
5684
+ * itself, and duplicating a value we did not author only makes the drift harder to see. The
5685
+ * "derive from the page content" half of the ladder (first h1, first paragraph, first image) is
5686
+ * `resolveSeo`, which runs BEFORE this and hands its output in as a filled-in `SeoDoc`.
5687
+ */
5688
+ function seoToTags(seo, ctx = {}) {
5689
+ const doc = normalizeSeoDoc(seo);
5690
+ const tags = [];
5691
+ const title = doc.title ?? trimmed(ctx.fallbackTitle);
5692
+ if (title)
5693
+ tags.push({ kind: 'title', content: title });
5694
+ if (doc.description)
5695
+ tags.push({ kind: 'meta', attr: 'name', key: 'description', content: doc.description });
5696
+ if (doc.keywords)
5697
+ tags.push({ kind: 'meta', attr: 'name', key: 'keywords', content: doc.keywords });
5698
+ if (doc.canonicalUrl)
5699
+ tags.push({ kind: 'link', rel: 'canonical', href: doc.canonicalUrl });
5700
+ // Open Graph. `og:url` reuses the canonical URL, which is what it means.
5701
+ const ogTitle = doc.og?.title ?? title;
5702
+ const ogDescription = doc.og?.description ?? doc.description;
5703
+ if (ogTitle)
5704
+ tags.push({ kind: 'meta', attr: 'property', key: 'og:title', content: ogTitle });
5705
+ if (ogDescription)
5706
+ tags.push({ kind: 'meta', attr: 'property', key: 'og:description', content: ogDescription });
5707
+ if (doc.og?.image)
5708
+ tags.push({ kind: 'meta', attr: 'property', key: 'og:image', content: doc.og.image });
5709
+ if (doc.canonicalUrl)
5710
+ tags.push({ kind: 'meta', attr: 'property', key: 'og:url', content: doc.canonicalUrl });
5711
+ // Twitter. Emitted ONLY when a card type is chosen: without `twitter:card` the other tags are
5712
+ // ignored anyway, so writing them would be noise that looks like configuration.
5713
+ if (doc.twitter?.card) {
5714
+ tags.push({ kind: 'meta', attr: 'name', key: 'twitter:card', content: doc.twitter.card });
5715
+ const twitterTitle = doc.twitter.title ?? ogTitle;
5716
+ const twitterDescription = doc.twitter.description ?? ogDescription;
5717
+ const twitterImage = doc.twitter.image ?? doc.og?.image;
5718
+ if (twitterTitle)
5719
+ tags.push({ kind: 'meta', attr: 'name', key: 'twitter:title', content: twitterTitle });
5720
+ if (twitterDescription) {
5721
+ tags.push({ kind: 'meta', attr: 'name', key: 'twitter:description', content: twitterDescription });
5722
+ }
5723
+ if (twitterImage)
5724
+ tags.push({ kind: 'meta', attr: 'name', key: 'twitter:image', content: twitterImage });
5725
+ }
5726
+ if (doc.robots)
5727
+ tags.push({ kind: 'meta', attr: 'name', key: 'robots', content: doc.robots });
5728
+ return tags;
5729
+ }
5730
+ function trimmed(value) {
5731
+ const out = value?.trim();
5732
+ return out?.length ? out : undefined;
5733
+ }
5734
+
5735
+ /**
5736
+ * The authoring schema for the `seo` object, in the platform's standard property dialect: `label`
5737
+ * at property level, rendering metadata under `controller`.
5738
+ *
5739
+ * ONE builder, two callers: `iox-cms` spreads it into `PagesSchema` (the stored schema) and
5740
+ * `iox-cms-client` feeds it to `<dynamic-form>`. Those used to be two hand-written copies that had
5741
+ * already drifted — different controller types for the same field, and the client's copy missing
5742
+ * `structuredData` entirely.
5743
+ *
5744
+ * `keywords` is deliberately absent: the tag is emitted when a document carries one, but there is
5745
+ * no reason to invite new ones.
5746
+ */
5747
+ function buildSeoSchemaProperties() {
5748
+ return {
5749
+ title: {
5750
+ type: 'string',
5751
+ label: 'Meta Title',
5752
+ controller: {
5753
+ type: 'text',
5754
+ placeholder: 'Page title for search engines',
5755
+ maxLength: SEO_TITLE_MAX,
5756
+ },
5757
+ },
5758
+ description: {
5759
+ type: 'string',
5760
+ label: 'Meta Description',
5761
+ controller: {
5762
+ type: 'textarea',
5763
+ placeholder: 'Brief description for search results',
5764
+ maxLength: SEO_DESCRIPTION_MAX,
5765
+ },
5766
+ },
5767
+ canonicalUrl: {
5768
+ type: 'string',
5769
+ label: 'Canonical URL',
5770
+ controller: {
5771
+ type: 'text',
5772
+ placeholder: 'https://example.com/page',
5773
+ },
5774
+ },
5775
+ robots: {
5776
+ type: 'string',
5777
+ label: 'Robots',
5778
+ controller: {
5779
+ type: 'select',
5780
+ options: SEO_ROBOTS_OPTIONS.map(option => ({ ...option })),
5781
+ },
5782
+ },
5783
+ og: {
5784
+ type: 'object',
5785
+ label: 'Open Graph',
5786
+ controller: { type: 'object' },
5787
+ properties: {
5788
+ title: {
5789
+ type: 'string',
5790
+ label: 'OG Title',
5791
+ controller: { type: 'text', placeholder: 'Title for social sharing' },
5792
+ },
5793
+ description: {
5794
+ type: 'string',
5795
+ label: 'OG Description',
5796
+ controller: { type: 'textarea', placeholder: 'Description for social sharing' },
5797
+ },
5798
+ image: {
5799
+ type: 'string',
5800
+ label: 'OG Image',
5801
+ controller: { type: 'image' },
5802
+ },
5803
+ },
5804
+ },
5805
+ twitter: {
5806
+ type: 'object',
5807
+ label: 'Twitter Card',
5808
+ controller: { type: 'object' },
5809
+ properties: {
5810
+ card: {
5811
+ type: 'string',
5812
+ label: 'Card Type',
5813
+ controller: {
5814
+ type: 'select',
5815
+ options: SEO_TWITTER_CARD_OPTIONS.map(option => ({ ...option })),
5816
+ },
5817
+ },
5818
+ title: {
5819
+ type: 'string',
5820
+ label: 'Twitter Title',
5821
+ controller: { type: 'text' },
5822
+ },
5823
+ description: {
5824
+ type: 'string',
5825
+ label: 'Twitter Description',
5826
+ controller: { type: 'textarea' },
5827
+ },
5828
+ image: {
5829
+ type: 'string',
5830
+ label: 'Twitter Image',
5831
+ controller: { type: 'image' },
5832
+ },
5833
+ },
5834
+ },
5835
+ structuredData: {
5836
+ type: 'object',
5837
+ label: 'Structured Data (JSON-LD)',
5838
+ controller: { type: 'json' },
5839
+ },
5840
+ sitemap: {
5841
+ type: 'object',
5842
+ label: 'Sitemap Settings',
5843
+ controller: { type: 'object' },
5844
+ properties: {
5845
+ include: {
5846
+ type: 'boolean',
5847
+ label: 'Include in Sitemap',
5848
+ controller: { type: 'switch' },
5849
+ },
5850
+ priority: {
5851
+ type: 'number',
5852
+ label: 'Priority',
5853
+ controller: { type: 'range', options: { min: 0, max: 1, step: 0.1 } },
5854
+ },
5855
+ changeFreq: {
5856
+ type: 'string',
5857
+ label: 'Change Frequency',
5858
+ controller: {
5859
+ type: 'select',
5860
+ options: SEO_CHANGE_FREQ_OPTIONS.map(option => ({ ...option })),
5861
+ },
5862
+ },
5863
+ },
5864
+ },
5865
+ };
5866
+ }
5867
+
5868
+ /*
5869
+ * @vectoriox/iox-ui/seo-core — the shared, FRAMEWORK-FREE core of page SEO.
5870
+ *
5871
+ * ⚠️ Nothing in this entry point may import Angular, RxJS, the DOM, or Node. It is consumed by
5872
+ * THREE runtimes: the builder panel (Angular), the SSR engine (Angular), and `iox-cms` (NestJS,
5873
+ * plain Node) — the same reason `forms-core` exists.
5874
+ *
5875
+ * A page describes itself to a crawler exactly once: `seoToTags` is the only place that decides
5876
+ * which head tags a page emits, and `buildSeoSchemaProperties` the only place that declares what an
5877
+ * author can fill in. See iox-ai-guidance `architecture/cms/seo-plan.md`.
5878
+ */
5879
+
5880
+ /** `SeoBinding.pipes` is typed loosely in the framework-free core; narrow it once, here. */
5881
+ function boundSpec(binding) {
5882
+ return { path: binding.path, pipes: binding.pipes };
5883
+ }
5884
+ function resolveSeo(seo, ctx = {}) {
5885
+ // Rung 1 is exactly what the normalizer already produces: overrides, plus every non-bindable
5886
+ // field (robots, sitemap, structuredData) carried through untouched.
5887
+ const out = normalizeSeoDoc(seo);
5888
+ const raw = (seo && typeof seo === 'object' && !Array.isArray(seo) ? seo : {});
5889
+ // Derivation walks the whole tree, so do it once and only if some field will actually ask.
5890
+ let derived;
5891
+ const content = () => (derived ??= deriveSeoFromContent(ctx.tree, ctx.resolvedData));
5892
+ for (const field of SEO_BINDABLE_FIELDS) {
5893
+ if (readField(out, field) !== undefined)
5894
+ continue; // an override won
5895
+ const stored = fieldValue(raw, field);
5896
+ // Rung 2 — the binding.
5897
+ if (stored?.binding) {
5898
+ const value = resolveSeoBinding(stored.binding, ctx.resolvedData);
5899
+ if (value !== undefined) {
5900
+ writeField(out, field, value);
5901
+ continue;
5902
+ }
5903
+ }
5904
+ // Rung 3 — derive it, unless this field opted out.
5905
+ if (stored?.auto === false)
5906
+ continue;
5907
+ const source = SEO_AUTO_SOURCES.find(entry => entry.field === field)?.source;
5908
+ const auto = source ? autoValue(source, content, ctx) : undefined;
5909
+ if (auto !== undefined)
5910
+ writeField(out, field, auto);
5911
+ }
5912
+ // One last pass so a resolved value gets the same trimming and empty-branch dropping as a stored
5913
+ // one — `if (seo.og)` must keep meaning something.
5914
+ return normalizeSeoDoc(out);
5915
+ }
5916
+ /** Resolve one SEO binding against the page's data. `undefined` when its source did not resolve. */
5917
+ function resolveSeoBinding(binding, resolvedData) {
5918
+ const sourceData = resolvedData?.[binding.source];
5919
+ if (sourceData == null)
5920
+ return undefined;
5921
+ return seoString(resolveBoundValue(sourceData, boundSpec(binding)));
5922
+ }
5923
+ function autoValue(source, content, ctx) {
5924
+ switch (source) {
5925
+ case 'contentTitle':
5926
+ return content().title ?? seoString(ctx.pageName);
5927
+ case 'contentDescription':
5928
+ return content().description;
5929
+ case 'contentImage':
5930
+ return content().image;
5931
+ case 'pageUrl':
5932
+ return seoString(ctx.pageUrl);
5933
+ }
5934
+ }
5935
+ /**
5936
+ * Derive a title, description and image from the page's own content, in document order.
5937
+ *
5938
+ * ⚠️ Node bindings are resolved here too. On a template page the `<h1>` is normally bound to
5939
+ * `$current.title`, so reading `props.content` alone would return the design-time placeholder — the
5940
+ * same trap that made context slots fall through to component defaults. An unresolved binding yields
5941
+ * nothing rather than the placeholder.
5942
+ *
5943
+ * Node shapes are the renderers' own: `Heading` has `level` + `content`, `Text` has `content` (rich
5944
+ * HTML from the editor) + `tag`, `Image` has `src`.
5945
+ */
5946
+ function deriveSeoFromContent(tree, resolvedData) {
5947
+ const out = {};
5948
+ /** A heading that is not an h1 — used only if the page has no h1 at all. */
5949
+ let fallbackHeading;
5950
+ const visit = (nodes) => {
5951
+ for (const node of nodes ?? []) {
5952
+ const current = node;
5953
+ if (!current)
5954
+ continue;
5955
+ const props = resolveNodeProps(current, resolvedData);
5956
+ switch (current['type']) {
5957
+ case 'Heading': {
5958
+ const text = plainText(props['content']);
5959
+ if (text) {
5960
+ if (props['level'] === 'h1')
5961
+ out.title ??= text;
5962
+ else
5963
+ fallbackHeading ??= text;
5964
+ }
5965
+ break;
5966
+ }
5967
+ case 'Text': {
5968
+ // `span` is inline decoration, not a paragraph.
5969
+ if (props['tag'] !== 'span')
5970
+ out.description ??= truncate(plainText(props['content']), SEO_DESCRIPTION_MAX);
5971
+ break;
5972
+ }
5973
+ case 'Image': {
5974
+ out.image ??= seoString(props['src']);
5975
+ break;
5976
+ }
5977
+ }
5978
+ visit(current['children']);
5979
+ }
5980
+ };
5981
+ visit(tree);
5982
+ out.title ??= fallbackHeading;
5983
+ return out;
5984
+ }
5985
+ /** A node's props with its bindings applied — only what derivation reads, never the whole node. */
5986
+ function resolveNodeProps(node, resolvedData) {
5987
+ const props = { ...(node['props'] ?? {}) };
5988
+ for (const binding of (node['bindings'] ?? [])) {
5989
+ if (!binding?.prop)
5990
+ continue;
5991
+ const sourceData = resolvedData?.[binding.source];
5992
+ // A bound prop whose source did not resolve must NOT fall through to the design-time default.
5993
+ props[binding.prop] = sourceData == null ? undefined : resolveBoundValue(sourceData, boundSpec(binding));
5994
+ }
5995
+ return props;
5996
+ }
5997
+ /**
5998
+ * Editor content is rich HTML. Strip it to prose: tags out, block boundaries become spaces so words
5999
+ * do not fuse, the handful of entities an editor emits decoded, whitespace collapsed.
6000
+ */
6001
+ function plainText(value) {
6002
+ const raw = seoString(value);
6003
+ if (!raw)
6004
+ return undefined;
6005
+ const text = raw
6006
+ .replace(/<(br|\/p|\/div|\/li|\/h[1-6])\s*\/?>/gi, ' ')
6007
+ .replace(/<[^>]*>/g, '')
6008
+ .replace(/&nbsp;/gi, ' ')
6009
+ .replace(/&amp;/gi, '&')
6010
+ .replace(/&lt;/gi, '<')
6011
+ .replace(/&gt;/gi, '>')
6012
+ .replace(/&quot;/gi, '"')
6013
+ .replace(/&#39;|&apos;/gi, "'")
6014
+ .replace(/\s+/g, ' ')
6015
+ .trim();
6016
+ return text.length ? text : undefined;
6017
+ }
6018
+ /** Cut to `max` characters on a word boundary, with an ellipsis only when something was cut. */
6019
+ function truncate(value, max) {
6020
+ if (!value || value.length <= max)
6021
+ return value;
6022
+ const cut = value.slice(0, max - 1);
6023
+ const lastSpace = cut.lastIndexOf(' ');
6024
+ return (lastSpace > max * 0.6 ? cut.slice(0, lastSpace) : cut).trimEnd() + '…';
6025
+ }
6026
+ // ── dotted-path access over the document, so the field table stays data and not a switch ───────────
6027
+ function fieldValue(raw, field) {
6028
+ const value = readField(raw, field);
6029
+ if (value === null || typeof value !== 'object' || Array.isArray(value))
6030
+ return undefined;
6031
+ return value;
6032
+ }
6033
+ function readField(doc, field) {
6034
+ const [branch, leaf] = field.split('.');
6035
+ if (!leaf)
6036
+ return doc[branch];
6037
+ const nested = doc[branch];
6038
+ return nested && typeof nested === 'object' ? nested[leaf] : undefined;
6039
+ }
6040
+ function writeField(doc, field, value) {
6041
+ const [branch, leaf] = field.split('.');
6042
+ if (!leaf) {
6043
+ doc[branch] = value;
6044
+ return;
6045
+ }
6046
+ const nested = (doc[branch] && typeof doc[branch] === 'object' ? doc[branch] : {});
6047
+ nested[leaf] = value;
6048
+ doc[branch] = nested;
6049
+ }
6050
+
5469
6051
  /**
5470
6052
  * Element context state — shared types.
5471
6053
  *
@@ -6153,5 +6735,5 @@ function effectiveTransitionId(anim) {
6153
6735
  * Generated bundle index. Do not edit.
6154
6736
  */
6155
6737
 
6156
- export { AOSService, AnalyticsService, BREAKPOINTS, Breakpoint, BreakpointQueryKind, 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, DeclarationContext, ENVIRONMENT, FormRenderState, FormRuntimeService, GALLERY_EFFECTS, GALLERY_EFFECT_DESCRIPTORS, GalleryLoop, IOX_BUILDER_EVENTS, IOX_FORM_MESSAGES, IOX_FORM_NAVIGATOR, IOX_FORM_TRANSPORT, IS_PREVIEW, IoxAnimateContainer, IoxAosDirective, IoxAosModule, IoxBuilderComponentsModule, IoxComponentRegistryService, IoxFieldComponent, IoxFormComponent, IoxFormErrorComponent, IoxFormSuccessComponent, IoxPageComponent, IoxPageModule, IoxSubmitButtonComponent, IoxUiModule, LinkedContainerComponent, PAGE_TRANSITION_CATEGORIES, PAGE_TRANSITION_PRESETS, PIPE_DESCRIPTORS, PIPE_REGISTRY, PageScrollProvider, PrivacyModalComponent, PrivacyModalService, PrivacyModelEvent, RESERVED_ALIAS_PREFIX, SUPPRESSED_STYLE_PROPS_BY_TYPE, SWIPER_RESPONSIVE_TRAITS, SectionComponent, TRANSITION_FEELS, TextBlockComponent, VIRTUAL_TRAIT_GROUPS, VIRTUAL_TRAIT_KEYS, ViewPositionDirective, ViewPositionModule, WebSettingsService, activeActions, applyBindingPipes, applyFeel, breakpointDef, breakpointForWidth, breakpointQueryFor, buildDataSourceFilter, buildRelatedFilter, buildSwiperBreakpoints, buildTargetedStateSelector, buildTransitionTimeline, cascadeChain, clearInputOverride, clearOverride, collectContextSlotKeys, collectReferencedAliases, compileDeclarations, composeVirtualTraits, computeRelative, contextActionEffect, contextSlotKeys, countOverrides, dataSourcePlanToRequest, declaredInputNames, defaultMessageResolver, effectiveTransitionId, excludeSelf, feelFor, getByPath, initialSlotValues, isActionEnabled, isContextAction, isInputOverriddenAt, isOverriddenAt, isReservedAlias, isValidSlotKey, legacyEnterToTransition, matchRouteParams, mediaQueryFor, mergeSwiperBreakpoints, nearestCommonAncestorId, nodeCssId, nodeUsesContext, normalizeCollectionResult, normalizeGalleryImage, parentBreakpoint, parseUrlList, planDataSource, planResponsiveRules, referencedDataSources, referencedDataSourcesDeep, renderDefaultDeclarations, resolveContextValue, resolveDerivedInto, resolveGalleryEffect, resolveGalleryUrls, resolveInputChain, resolveInputs, resolvePageTransition, resolvePath, resolveRelativeInto, resolveRepeaterItems, resolveSiblings, resolveSingleItemId, resolveStateStyles, resolveStyleProps, resolveValueChain, rewriteViewportUnits, safeSetInput, setInputOverride, setOverride, stateNamesIn, stripSuppressedProps, styleKeyToKebab, variableAliases, variableItemsFrom, withContextSlots, wrapInBreakpointQuery, wrapInMediaQuery };
6738
+ export { AOSService, AnalyticsService, BREAKPOINTS, Breakpoint, BreakpointQueryKind, 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, DeclarationContext, ENVIRONMENT, FormRenderState, FormRuntimeService, GALLERY_EFFECTS, GALLERY_EFFECT_DESCRIPTORS, GalleryLoop, IOX_BUILDER_EVENTS, IOX_FORM_MESSAGES, IOX_FORM_NAVIGATOR, IOX_FORM_TRANSPORT, IS_PREVIEW, IoxAnimateContainer, IoxAosDirective, IoxAosModule, IoxBuilderComponentsModule, IoxComponentRegistryService, IoxFieldComponent, IoxFormComponent, IoxFormErrorComponent, IoxFormSuccessComponent, IoxPageComponent, IoxPageModule, IoxSubmitButtonComponent, IoxUiModule, LinkedContainerComponent, PAGE_TRANSITION_CATEGORIES, PAGE_TRANSITION_PRESETS, PIPE_DESCRIPTORS, PIPE_REGISTRY, PageScrollProvider, PrivacyModalComponent, PrivacyModalService, PrivacyModelEvent, RESERVED_ALIAS_PREFIX, SUPPRESSED_STYLE_PROPS_BY_TYPE, SWIPER_RESPONSIVE_TRAITS, SectionComponent, TRANSITION_FEELS, TextBlockComponent, VIRTUAL_TRAIT_GROUPS, VIRTUAL_TRAIT_KEYS, ViewPositionDirective, ViewPositionModule, WebSettingsService, activeActions, applyBindingPipes, applyFeel, breakpointDef, breakpointForWidth, breakpointQueryFor, buildDataSourceFilter, buildRelatedFilter, buildSwiperBreakpoints, buildTargetedStateSelector, buildTransitionTimeline, cascadeChain, clearInputOverride, clearOverride, collectContextSlotKeys, collectReferencedAliases, compileDeclarations, composeVirtualTraits, computeRelative, contextActionEffect, contextSlotKeys, countOverrides, dataSourcePlanToRequest, declaredInputNames, defaultMessageResolver, deriveSeoFromContent, effectiveTransitionId, excludeSelf, feelFor, getByPath, initialSlotValues, isActionEnabled, isContextAction, isInputOverriddenAt, isOverriddenAt, isReservedAlias, isValidSlotKey, legacyEnterToTransition, matchRouteParams, mediaQueryFor, mergeSwiperBreakpoints, nearestCommonAncestorId, nodeCssId, nodeUsesContext, normalizeCollectionResult, normalizeGalleryImage, parentBreakpoint, parseUrlList, planDataSource, planResponsiveRules, referencedDataSources, referencedDataSourcesDeep, renderDefaultDeclarations, resolveBoundValue, resolveContextValue, resolveDerivedInto, resolveGalleryEffect, resolveGalleryUrls, resolveInputChain, resolveInputs, resolvePageTransition, resolvePath, resolveRelativeInto, resolveRepeaterItems, resolveSeo, resolveSiblings, resolveSingleItemId, resolveStateStyles, resolveStyleProps, resolveValueChain, rewriteViewportUnits, safeSetInput, setInputOverride, setOverride, stateNamesIn, stripSuppressedProps, styleKeyToKebab, variableAliases, variableItemsFrom, withContextSlots, wrapInBreakpointQuery, wrapInMediaQuery };
6157
6739
  //# sourceMappingURL=vectoriox-iox-ui.mjs.map