@vectoriox/iox-ui 5.171.0 → 5.173.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.
@@ -862,23 +862,23 @@ declare const SPEC_SITE_PATTERNS: {
862
862
  readonly t: "Heading";
863
863
  readonly es: "h2";
864
864
  readonly level: "h2";
865
- readonly ph: "copy";
866
- readonly text: "A sentence a client actually said, in their own words.";
865
+ readonly ph: "quote";
866
+ readonly text: "A client’s own words go here";
867
867
  readonly tracks: readonly [{
868
868
  readonly prop: "words";
869
869
  readonly keys: readonly [readonly [0.08, 0], readonly [0.7, 100]];
870
870
  }];
871
- readonly textHe: "משפט שלקוח באמת אמר, במילים שלו.";
871
+ readonly textHe: "כאן יופיעו המילים של לקוח";
872
872
  }, {
873
873
  readonly t: "Text";
874
874
  readonly es: "small";
875
- readonly ph: "copy";
876
- readonly text: "[Client name] · [Project, city]";
875
+ readonly ph: "quote";
876
+ readonly text: "The client’s name";
877
877
  readonly tracks: readonly [{
878
878
  readonly prop: "opacity";
879
879
  readonly keys: readonly [readonly [0.7, 0], readonly [0.82, 1]];
880
880
  }];
881
- readonly textHe: "[שם הלקוח] · [פרויקט, עיר]";
881
+ readonly textHe: "שם הלקוח";
882
882
  }];
883
883
  }];
884
884
  }];
@@ -4290,21 +4290,21 @@ declare const SPEC_SITE_PATTERNS: {
4290
4290
  }, {
4291
4291
  readonly t: "Text";
4292
4292
  readonly es: "lead";
4293
- readonly ph: "copy";
4294
- readonly text: "A sentence a client actually said, in their own words.";
4293
+ readonly ph: "quote";
4294
+ readonly text: "A client’s own words go here";
4295
4295
  readonly lay: {
4296
4296
  readonly textAlign: "center";
4297
4297
  };
4298
- readonly textHe: "משפט שלקוח באמת אמר, במילים שלו.";
4298
+ readonly textHe: "כאן יופיעו המילים של לקוח";
4299
4299
  }, {
4300
4300
  readonly t: "Text";
4301
4301
  readonly es: "small";
4302
- readonly ph: "copy";
4303
- readonly text: "[Client name] · [Project, city]";
4302
+ readonly ph: "quote";
4303
+ readonly text: "The client’s name";
4304
4304
  readonly lay: {
4305
4305
  readonly textAlign: "center";
4306
4306
  };
4307
- readonly textHe: "[שם הלקוח] · [פרויקט, עיר]";
4307
+ readonly textHe: "שם הלקוח";
4308
4308
  }];
4309
4309
  }];
4310
4310
  }];
@@ -11239,7 +11239,10 @@ declare enum PatternPlaceholder {
11239
11239
  /** CC4b (Q37): a price the studio types — free text, publish-blocking, its label shown meanwhile, never a number. */
11240
11240
  Price = "price",
11241
11241
  /** L2 (`proof.stat-row`): a number the studio stands behind — publish-blocking, its label shown, never a number. */
11242
- Stat = "stat"
11242
+ Stat = "stat",
11243
+ /** iox-ui#145 (`proof.testimonial-single`, `proof.scene-words`): a client's own words or name — publish-blocking,
11244
+ * its label shown, never a slot (a plan can never fill a testimonial) and never a sample sentence. */
11245
+ Quote = "quote"
11243
11246
  }
11244
11247
  /** CC3: what an `opens` node opens. */
11245
11248
  declare enum PatternOpens {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vectoriox/iox-ui",
3
- "version": "5.171.0",
3
+ "version": "5.173.0",
4
4
  "peerDependencies": {
5
5
  "@angular/common": ">=20.0.0",
6
6
  "@angular/core": ">=20.0.0",
@@ -1,4 +1,4 @@
1
- import { CompositeNode, CompositeNodeFactory, writeProp } from './composite-node';
1
+ import { CompositeNode, CompositeNodeFactory, findByRole, readProp, removeFromComposite, writeProp, writeStyles } from './composite-node';
2
2
  import { COLUMN, recipeLang, recipePart, recipeText, ROW, WORDS, ZERO } from './recipe-parts';
3
3
 
4
4
  /**
@@ -178,8 +178,14 @@ export const POPUP_KIND_ARRIVAL: Readonly<Record<PopupKind, { screens?: number;
178
178
 
179
179
  /** The recipe's OWN words — mechanism microcopy, in the site's language. The rest is the owner's. */
180
180
  const POPUP_WORDS = {
181
- en: { close: 'Close', send: 'Send', label: { [PopupKind.Announcement]: 'Announcement', [PopupKind.Offer]: 'Offer', [PopupKind.Newsletter]: 'Newsletter' } },
182
- he: { close: 'סגירה', send: 'שליחה', label: { [PopupKind.Announcement]: 'הודעה', [PopupKind.Offer]: 'הצעה', [PopupKind.Newsletter]: 'ניוזלטר' } },
181
+ en: {
182
+ close: 'Close', send: 'Send', label: { [PopupKind.Announcement]: 'Announcement', [PopupKind.Offer]: 'Offer', [PopupKind.Newsletter]: 'Newsletter' },
183
+ layers: { popup: 'Popup', picture: 'Picture', words: 'Words', dates: 'Dates', title: 'Title', action: 'Action' },
184
+ },
185
+ he: {
186
+ close: 'סגירה', send: 'שליחה', label: { [PopupKind.Announcement]: 'הודעה', [PopupKind.Offer]: 'הצעה', [PopupKind.Newsletter]: 'ניוזלטר' },
187
+ layers: { popup: 'חלון קופץ', picture: 'תמונה', words: 'מילים', dates: 'תאריכים', title: 'כותרת', action: 'פעולה' },
188
+ },
183
189
  } as const;
184
190
 
185
191
  export type PopupWords = (typeof POPUP_WORDS)['en'] | (typeof POPUP_WORDS)['he'];
@@ -214,6 +220,12 @@ export interface PopupRecipeOptions {
214
220
  /** The ONE action: a link to a page of the site, with its words. No route = no action (an announcement may have none). */
215
221
  actionLabel?: string;
216
222
  actionRoute?: string | null;
223
+ /** PU2c (PP-D3): stamp the action link EMPTY — no words, no page — for the author to fill (the builder's palette). Until
224
+ * it names a page it is a dead link, which the Publishable gate blocks; never a page we guessed. */
225
+ emptyAction?: boolean;
226
+ /** PU2c: the language of the LAYER names (the Layers row, the crumb: "חלון קופץ — הצעה") — the admin's, when the palette
227
+ * stamps it. Defaults to `lang`; the visitor's words (the ✕, the Dialog's label) always follow `lang`. */
228
+ labelLang?: string | null;
217
229
  /** The owner's picture (`art: picture`); '' = the DS3 empty-image box ("Add image"). */
218
230
  imageSrc?: string;
219
231
  imageAlt?: string;
@@ -227,6 +239,31 @@ export interface PopupRecipeOptions {
227
239
  newsletterForm?: CompositeNode | null;
228
240
  }
229
241
 
242
+ /** The dialog element style's padding, as the style writes it (design-core `dialog`): a card without a picture wears it. */
243
+ const DIALOG_PAD = 'var(--iox-dialog-pad)';
244
+
245
+ /** The layout the popup's ROOT wears in a form — ONE rule the recipe and a later "Where it sits" change both read. */
246
+ function popupRootLayout(bar: boolean, picture: boolean): Record<string, string> {
247
+ const { padding: _rowPad, ...row } = ROW;
248
+ // The dialog style's padding holds, except around a picture: the picture runs to the card's edge, the words keep the pad.
249
+ if (bar) return { ...row, width: '100%', maxWidth: '100%', gap: '16px' };
250
+ return { ...row, width: picture ? '560px' : '420px', maxWidth: '100%', alignItems: 'stretch', gap: '0px', ...(picture ? { padding: ZERO } : {}) };
251
+ }
252
+
253
+ /** The layout the words' column wears in a form (a bar lays them in one wrapping line). */
254
+ function popupContentLayout(bar: boolean, picture: boolean): Record<string, string> {
255
+ if (bar) return { ...ROW, flexGrow: '1', flexWrap: 'wrap', gap: '4px 16px' };
256
+ return { ...COLUMN, flexGrow: '1', width: 'auto', gap: '8px', ...(picture ? { padding: DIALOG_PAD } : {}) };
257
+ }
258
+
259
+ function popupMedia(create: CompositeNodeFactory, layers: PopupWords['layers'], src = '', alt = ''): CompositeNode {
260
+ const media = recipePart(create, 'popup-media', 'Container', PopupRole.Media, null, {}, layers.picture,
261
+ { ...COLUMN, width: '40%', flexShrink: '0', overflow: 'hidden' });
262
+ media.children = [recipePart(create, 'popup-image', 'Image', null, null, { src, alt }, layers.picture,
263
+ { width: '100%', height: '100%', minHeight: '160px', objectFit: 'cover', margin: ZERO })];
264
+ return media;
265
+ }
266
+
230
267
  /** The popup — ONE root. Pure over the factory: the builder and the composer get the same tree. */
231
268
  export function buildPopupRecipe(create: CompositeNodeFactory, options: PopupRecipeOptions = {}): CompositeNode {
232
269
  const kind = options.kind ?? PopupKind.Offer;
@@ -234,15 +271,13 @@ export function buildPopupRecipe(create: CompositeNodeFactory, options: PopupRec
234
271
  const form = popupFormOf(kind, options.form ?? mix.form);
235
272
  const art = form === PopupForm.Bar ? PopupArt.None : options.art ?? mix.art;
236
273
  const words = popupWords(options.lang);
274
+ const layers = popupWords(options.labelLang ?? options.lang).layers;
275
+ const kindLayer = popupWords(options.labelLang ?? options.lang).label[kind];
237
276
  const title = options.title?.trim() ?? '';
238
277
  const bar = form === PopupForm.Bar;
239
278
 
240
279
  const picture = art === PopupArt.Picture;
241
- // The dialog style's padding holds, except around a picture: the picture runs to the card's edge, the words keep the pad.
242
- const { padding: _rowPad, ...row } = ROW;
243
- const root = recipePart(create, 'popup', 'Dialog', PopupRole.Popup, Style.Dialog, {}, `Popup — ${words.label[kind]}`,
244
- bar ? { ...row, width: '100%', maxWidth: '100%', gap: '16px' }
245
- : { ...row, width: picture ? '560px' : '420px', maxWidth: '100%', alignItems: 'stretch', gap: '0px', ...(picture ? { padding: ZERO } : {}) });
280
+ const root = recipePart(create, 'popup', 'Dialog', PopupRole.Popup, Style.Dialog, {}, `${layers.popup} — ${kindLayer}`, popupRootLayout(bar, picture));
246
281
  writeProp(root, 'placement', 'center'); // the popup's own form places it (iox-design.css), never the placement
247
282
  writeProp(root, 'closeOnBackdrop', true); // centred only: a click on the scrim is a close (remembered)
248
283
  writeProp(root, 'showCloseButton', true);
@@ -253,29 +288,21 @@ export function buildPopupRecipe(create: CompositeNodeFactory, options: PopupRec
253
288
  writeProp(root, PopupTrait.Again, options.again ?? mix.again);
254
289
 
255
290
  const children: CompositeNode[] = [];
256
- if (picture) {
257
- const media = recipePart(create, 'popup-media', 'Container', PopupRole.Media, null, {}, 'Picture',
258
- { ...COLUMN, width: '40%', flexShrink: '0', overflow: 'hidden' });
259
- media.children = [recipePart(create, 'popup-image', 'Image', null, null, { src: options.imageSrc ?? '', alt: options.imageAlt ?? '' }, 'Picture',
260
- { width: '100%', height: '100%', minHeight: '160px', objectFit: 'cover', margin: ZERO })];
261
- children.push(media);
262
- }
263
- const content = recipePart(create, 'popup-content', 'Container', PopupRole.Content, null, {}, 'Words',
264
- bar ? { ...ROW, flexGrow: '1', flexWrap: 'wrap', gap: '4px 16px' }
265
- : { ...COLUMN, flexGrow: '1', width: 'auto', gap: '8px', ...(picture ? { padding: 'var(--iox-dialog-pad)' } : {}) });
291
+ if (picture) children.push(popupMedia(create, layers, options.imageSrc ?? '', options.imageAlt ?? ''));
292
+ const content = recipePart(create, 'popup-content', 'Container', PopupRole.Content, null, {}, layers.words, popupContentLayout(bar, picture));
266
293
  const parts: CompositeNode[] = [];
267
- if (options.eyebrow?.trim()) parts.push(recipeText(create, 'popup-eyebrow', PopupRole.Eyebrow, Style.Eyebrow, options.eyebrow.trim(), 'Dates'));
268
- parts.push(recipePart(create, 'popup-title', 'Heading', PopupRole.Title, Style.Title, { content: title, level: 'h2' }, 'Title', WORDS));
269
- if (options.body?.trim() || !bar) parts.push(recipeText(create, 'popup-body', PopupRole.Body, Style.Body, options.body?.trim() ?? '', 'Words'));
294
+ if (options.eyebrow?.trim()) parts.push(recipeText(create, 'popup-eyebrow', PopupRole.Eyebrow, Style.Eyebrow, options.eyebrow.trim(), layers.dates));
295
+ parts.push(recipePart(create, 'popup-title', 'Heading', PopupRole.Title, Style.Title, { content: title, level: 'h2' }, layers.title, WORDS));
296
+ if (options.body?.trim() || !bar) parts.push(recipeText(create, 'popup-body', PopupRole.Body, Style.Body, options.body?.trim() ?? '', layers.words));
270
297
  if (kind === PopupKind.Newsletter && options.newsletterForm) {
271
298
  const f = options.newsletterForm;
272
299
  f.role = PopupRole.Form;
273
300
  parts.push(f);
274
- } else if (options.actionRoute) {
301
+ } else if (options.actionRoute || options.emptyAction) {
275
302
  // A popup's action is QUIET — never the page's primary button (§6): the look's link (a Link, the consent banner's
276
303
  // privacy link's shape), hugging its words — the column would stretch its box (focus ring, hover) to full width.
277
304
  parts.push(recipePart(create, 'popup-action', 'Link', PopupRole.Action, Style.Link,
278
- { label: options.actionLabel?.trim() ?? '', linkType: 'page', pageRoute: options.actionRoute }, 'Action',
305
+ { label: options.actionLabel?.trim() ?? '', linkType: 'page', pageRoute: options.actionRoute ?? '' }, layers.action,
279
306
  { ...WORDS, alignSelf: 'flex-start' }));
280
307
  }
281
308
  content.children = parts;
@@ -283,3 +310,52 @@ export function buildPopupRecipe(create: CompositeNodeFactory, options: PopupRec
283
310
  root.children = children;
284
311
  return root;
285
312
  }
313
+
314
+ /** What a "Where it sits" change did to the popup's parts. */
315
+ export interface PopupFormChange {
316
+ /** The form the popup now sits in (judged: `centred` only for a newsletter). */
317
+ form: PopupForm;
318
+ /** The picture part a bar dropped, or null. */
319
+ removed: CompositeNode | null;
320
+ /** The picture part a card got back, or null. */
321
+ added: CompositeNode | null;
322
+ }
323
+
324
+ export interface PopupFormOptions {
325
+ /** The language of a re-stamped part's layer name. */
326
+ labelLang?: string | null;
327
+ }
328
+
329
+ /**
330
+ * PU2c — "Where it sits", in ONE edit (the builder applies it as one undo step): the form trait AND the parts that follow
331
+ * it, so a popup re-shaped later is the tree the recipe would stamp in that form. A BAR drops the picture part (one line
332
+ * holds no picture) and lays its words in a row; a CORNER / CENTRED card of a kind that carries a picture (an Offer) gets
333
+ * the picture part back — empty, the DS3 "Add image" box — and lays its words in a column. Its words, form and action are
334
+ * never touched. Mutates `root`; without a factory nothing is stamped back.
335
+ */
336
+ export function setPopupForm(root: CompositeNode, form: PopupForm, create?: CompositeNodeFactory, options: PopupFormOptions = {}): PopupFormChange {
337
+ const kindValue = readProp(root, PopupTrait.Kind);
338
+ const kind = (Object.values(PopupKind) as unknown[]).includes(kindValue) ? kindValue as PopupKind : PopupKind.Offer;
339
+ const judged = popupFormOf(kind, form);
340
+ writeProp(root, PopupTrait.Form, judged);
341
+ const bar = judged === PopupForm.Bar;
342
+ let media = findByRole(root, PopupRole.Media) ?? null;
343
+ let removed: CompositeNode | null = null;
344
+ let added: CompositeNode | null = null;
345
+ if (bar && media) {
346
+ removeFromComposite(root, media);
347
+ removed = media;
348
+ media = null;
349
+ } else if (!bar && !media && create && POPUP_KIND_MIX[kind].art === PopupArt.Picture) {
350
+ media = added = popupMedia(create, popupWords(options.labelLang).layers);
351
+ root.children = [media, ...(root.children ?? [])];
352
+ }
353
+ const picture = !!media;
354
+ // The recipe's layout for the new form, so the tree is the one the recipe stamps in this form: with no picture the card
355
+ // takes back its dialog style's padding (the style writes it as this token reference); '' clears a wrap only the bar wrote
356
+ // (the compiler skips an empty value).
357
+ writeStyles(root, { alignItems: 'center', padding: DIALOG_PAD, ...popupRootLayout(bar, picture) });
358
+ const content = findByRole(root, PopupRole.Content);
359
+ if (content) writeStyles(content, { flexWrap: '', ...popupContentLayout(bar, picture) });
360
+ return { form: judged, removed, added };
361
+ }
@@ -463,6 +463,7 @@ function chooseText(pn: PatternNode, ctx: Ctx): TextChoice {
463
463
  if (pn.ph === PatternPlaceholder.Copy) return { value: own, placeholder: { kind: PlaceholderKind.Copy } };
464
464
  if (pn.ph === PatternPlaceholder.Price) return { value: own, placeholder: { kind: PlaceholderKind.Price } };
465
465
  if (pn.ph === PatternPlaceholder.Stat) return { value: own, placeholder: { kind: PlaceholderKind.Stat } };
466
+ if (pn.ph === PatternPlaceholder.Quote) return { value: own, placeholder: { kind: PlaceholderKind.Quote } };
466
467
  return { value: own };
467
468
  }
468
469
 
@@ -209,6 +209,9 @@ export enum PatternPlaceholder {
209
209
  Price = 'price',
210
210
  /** L2 (`proof.stat-row`): a number the studio stands behind — publish-blocking, its label shown, never a number. */
211
211
  Stat = 'stat',
212
+ /** iox-ui#145 (`proof.testimonial-single`, `proof.scene-words`): a client's own words or name — publish-blocking,
213
+ * its label shown, never a slot (a plan can never fill a testimonial) and never a sample sentence. */
214
+ Quote = 'quote',
212
215
  }
213
216
 
214
217
  /** CC3: what an `opens` node opens. */
@@ -1225,8 +1225,8 @@ export const SPEC_SITE_PATTERNS = {
1225
1225
  "t": "Heading",
1226
1226
  "es": "h2",
1227
1227
  "level": "h2",
1228
- "ph": "copy",
1229
- "text": "A sentence a client actually said, in their own words.",
1228
+ "ph": "quote",
1229
+ "text": "A client’s own words go here",
1230
1230
  "tracks": [
1231
1231
  {
1232
1232
  "prop": "words",
@@ -1242,13 +1242,13 @@ export const SPEC_SITE_PATTERNS = {
1242
1242
  ]
1243
1243
  }
1244
1244
  ],
1245
- "textHe": "משפט שלקוח באמת אמר, במילים שלו."
1245
+ "textHe": "כאן יופיעו המילים של לקוח"
1246
1246
  },
1247
1247
  {
1248
1248
  "t": "Text",
1249
1249
  "es": "small",
1250
- "ph": "copy",
1251
- "text": "[Client name] · [Project, city]",
1250
+ "ph": "quote",
1251
+ "text": "The client’s name",
1252
1252
  "tracks": [
1253
1253
  {
1254
1254
  "prop": "opacity",
@@ -1264,7 +1264,7 @@ export const SPEC_SITE_PATTERNS = {
1264
1264
  ]
1265
1265
  }
1266
1266
  ],
1267
- "textHe": "[שם הלקוח] · [פרויקט, עיר]"
1267
+ "textHe": "שם הלקוח"
1268
1268
  }
1269
1269
  ]
1270
1270
  }
@@ -5171,22 +5171,22 @@ export const SPEC_SITE_PATTERNS = {
5171
5171
  {
5172
5172
  "t": "Text",
5173
5173
  "es": "lead",
5174
- "ph": "copy",
5175
- "text": "A sentence a client actually said, in their own words.",
5174
+ "ph": "quote",
5175
+ "text": "A client’s own words go here",
5176
5176
  "lay": {
5177
5177
  "textAlign": "center"
5178
5178
  },
5179
- "textHe": "משפט שלקוח באמת אמר, במילים שלו."
5179
+ "textHe": "כאן יופיעו המילים של לקוח"
5180
5180
  },
5181
5181
  {
5182
5182
  "t": "Text",
5183
5183
  "es": "small",
5184
- "ph": "copy",
5185
- "text": "[Client name] · [Project, city]",
5184
+ "ph": "quote",
5185
+ "text": "The client’s name",
5186
5186
  "lay": {
5187
5187
  "textAlign": "center"
5188
5188
  },
5189
- "textHe": "[שם הלקוח] · [פרויקט, עיר]"
5189
+ "textHe": "שם הלקוח"
5190
5190
  }
5191
5191
  ]
5192
5192
  }