@vectoriox/iox-ui 5.116.0 → 5.118.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.
@@ -180,6 +180,9 @@ export interface FooterRepair {
180
180
  export interface FooterContext {
181
181
  name: string;
182
182
  design: DesignChoices;
183
+ /** The business's tagline: absent or blank, the brand block holds the name alone — never the Text's default words
184
+ * (a copy placeholder never blocks publishing, so an empty one would go live as "Enter text here"). */
185
+ tagline?: string;
183
186
  }
184
187
 
185
188
  /** The phone the closing name must fit (the render check's). */
@@ -221,6 +224,18 @@ const part = (id: string): PatternNode => clone(PARTS[id]);
221
224
  const laid = (node: PatternNode, lay: Readonly<Record<string, string>>): PatternNode => ({ ...node, lay: { ...(node.lay ?? {}), ...lay } });
222
225
  const GAP = 'var(--iox-space-gap)';
223
226
  const CENTRED = { alignItems: 'center', textAlign: 'center' };
227
+ const WORDS = new Set(['Text', 'Heading', 'Link']);
228
+ /** Centred through and through: every node of a composed site stamps its own `textAlign`, so centring a block's
229
+ * container never reaches its words — each word node is centred, each container centres its children. */
230
+ const centred = (node: PatternNode): PatternNode => ({
231
+ ...laid(node, WORDS.has(node.t) ? { textAlign: 'center' } : CENTRED),
232
+ ...(node.c ? { c: node.c.map(centred) } : {}),
233
+ });
234
+ /** The brand block: the name, and the tagline only when the business has one. */
235
+ const brandPart = (ctx: FooterContext): PatternNode => {
236
+ const node = part('brand');
237
+ return ctx.tagline?.trim() ? node : { ...node, c: (node.c ?? []).filter(n => n.fromBusiness !== 'tagline') };
238
+ };
224
239
 
225
240
  /** The columns of a footer's grid: the name's block wider, one column per block it holds. */
226
241
  function columnsOf(count: number): Pick<PatternNode, 'lay' | 'resp'> {
@@ -245,7 +260,7 @@ function holdPart(hold: string, mix: FooterMix): PatternNode {
245
260
  }
246
261
 
247
262
  /** The body: the blocks it holds, arranged. */
248
- function bodyOf(mix: FooterMix): PatternNode[] {
263
+ function bodyOf(mix: FooterMix, ctx: FooterContext): PatternNode[] {
249
264
  const holds = mix.holds.map(h => holdPart(h, mix));
250
265
  switch (mix.arrange) {
251
266
  case FooterArrange.Line: {
@@ -256,24 +271,24 @@ function bodyOf(mix: FooterMix): PatternNode[] {
256
271
  return [row];
257
272
  }
258
273
  case FooterArrange.Centred: {
259
- const blocks = mix.holds.map(h => (h === FooterHold.Pages ? laid(part('pageRow'), { justifyContent: 'center' }) : laid(holdPart(h, mix), CENTRED)));
274
+ const blocks = mix.holds.map(h => (h === FooterHold.Pages ? laid(part('pageRow'), { justifyContent: 'center' }) : centred(holdPart(h, mix))));
260
275
  return [
261
- { t: 'Container', es: 'box', lay: { display: 'flex', flexDirection: 'column', gap: '28px', ...CENTRED }, c: [laid(part('brand'), CENTRED), ...blocks] },
276
+ { t: 'Container', es: 'box', lay: { display: 'flex', flexDirection: 'column', gap: '28px', ...CENTRED }, c: [centred(brandPart(ctx)), ...blocks] },
262
277
  part('rule'),
263
278
  laid(part('copyright'), { textAlign: 'center' }),
264
279
  ];
265
280
  }
266
281
  default:
267
- return [{ t: 'Container', es: 'box', ...columnsOf(holds.length), c: [part('brand'), ...holds] }, part('rule'), part('copyright')];
282
+ return [{ t: 'Container', es: 'box', ...columnsOf(holds.length), c: [brandPart(ctx), ...holds] }, part('rule'), part('copyright')];
268
283
  }
269
284
  }
270
285
 
271
286
  /** A footer mix as a pattern: what the composer stamps as the site's footer (global, after the page). Check it first. */
272
287
  export function footerPattern(mix: FooterMix, ctx: FooterContext): SitePattern {
273
288
  const plain = mix.ground === FooterGround.Plain;
274
- const call = mix.closing === FooterClosing.Call ? [mix.arrange === FooterArrange.Columns ? part('call') : laid(part('call'), CENTRED)] : [];
289
+ const call = mix.closing === FooterClosing.Call ? [mix.arrange === FooterArrange.Columns ? part('call') : centred(part('call'))] : [];
275
290
  const name = mix.closing === FooterClosing.Name ? [closingName(ctx)] : [];
276
- const c = [...(plain ? [part('rule')] : []), ...call, ...bodyOf(mix), ...name];
291
+ const c = [...(plain ? [part('rule')] : []), ...call, ...bodyOf(mix, ctx), ...name];
277
292
  // The contract's shell; a Section with one child does not stack it (the patterns' rule, build-spec "more than one child").
278
293
  const { lay, ...shell } = part('section');
279
294
  const node: PatternNode = { ...shell, ...(c.length > 1 && lay ? { lay } : {}), ...(plain ? {} : { scheme: mix.ground }), c };