@vectoriox/iox-ui 5.205.0 → 5.206.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/data-core/index.d.ts +13 -4
- package/design-core/index.d.ts +269 -6
- package/fesm2022/vectoriox-iox-ui-data-core.mjs +23 -4
- package/fesm2022/vectoriox-iox-ui-data-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-design-core.mjs +3064 -2682
- package/fesm2022/vectoriox-iox-ui-design-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs +1159 -172
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-harness-core.mjs +71 -19
- package/fesm2022/vectoriox-iox-ui-harness-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-scene-core.mjs +32 -4
- package/fesm2022/vectoriox-iox-ui-scene-core.mjs.map +1 -1
- package/generation-core/index.d.ts +411 -34
- package/harness-core/index.d.ts +52 -12
- package/package.json +1 -1
- package/scene-core/index.d.ts +16 -2
- package/src/data-core/placeholder-rows.ts +24 -3
- package/src/design-core/colour-eval.ts +22 -0
- package/src/design-core/contrast-audit.ts +96 -2
- package/src/design-core/design-token.model.ts +2 -0
- package/src/design-core/flavor-spec.generated.ts +184 -0
- package/src/design-core/font-metrics.ts +14 -1
- package/src/design-core/font-vertical.ts +80 -0
- package/src/design-core/public-api.ts +1 -0
- package/src/design-core/style-presets.ts +20 -1
- package/src/design-core/token-css.ts +3 -1
- package/src/generation-core/audit-site.ts +5 -3
- package/src/generation-core/compose-free.ts +1 -1
- package/src/generation-core/compose-layout.ts +172 -22
- package/src/generation-core/critic-calibration.ts +26 -9
- package/src/generation-core/critic-numbers.ts +259 -0
- package/src/generation-core/critic-prompt.ts +53 -6
- package/src/generation-core/critic-rubric.generated.ts +6 -6
- package/src/generation-core/critic-sheet.ts +112 -1
- package/src/generation-core/layout-render-check.ts +35 -2
- package/src/generation-core/nav-shape.ts +67 -8
- package/src/generation-core/opening-mix.ts +61 -17
- package/src/generation-core/public-api.ts +2 -0
- package/src/generation-core/social-links.ts +47 -8
- package/src/generation-core/stock-photos.ts +149 -14
- package/src/generation-core/stock-search.ts +108 -19
- package/src/generation-core/stock-subjects.ts +204 -0
- package/src/harness-core/business-types.ts +3 -0
- package/src/harness-core/harness-spec.generated.ts +54 -15
- package/src/harness-core/intake.ts +18 -5
- package/src/scene-core/scene.ts +34 -3
- package/styles/iox-design.css +41 -2
- package/styles/iox-forms.css +7 -6
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AccountRole, ShopRole } from '@vectoriox/iox-ui/composite-core';
|
|
2
2
|
import { commerceLanguage } from '@vectoriox/iox-ui/commerce-core';
|
|
3
|
-
import { LinkType, MenuButtonKind, menuButtonOf, menuButtonProps, menuDialogProps, MenuLook, MenuShows, menuShowsOf, MenuTrait } from '@vectoriox/iox-ui/design-core';
|
|
3
|
+
import { LinkType, MenuButtonKind, menuButtonOf, menuButtonProps, menuDialogProps, MenuLook, MenuShows, menuShowsOf, MenuTrait, textWidthEm } from '@vectoriox/iox-ui/design-core';
|
|
4
4
|
|
|
5
5
|
import { PatternGlobalPosition } from './patterns';
|
|
6
6
|
import { createSerializedNode, SerializedNode, walkSerialized } from './serialized-node';
|
|
@@ -244,6 +244,60 @@ export function barIconForRoute(route: string): string {
|
|
|
244
244
|
return ROUTE_ICONS.find(([re]) => re.test(route))?.[1] ?? FALLBACK_ICON;
|
|
245
245
|
}
|
|
246
246
|
|
|
247
|
+
/** iox-ui#196: the narrowest phone a bar is drawn for, and its label's size (`tabbar-label-size`: the live bars measured
|
|
248
|
+
* 11–11.7 px) — the bar's `6px 8px` padding, its 4 px gaps and an item's 2 px sides are the bar's own (`bar`,
|
|
249
|
+
* `BAR_ITEM_LAY`). A label is measured in Poppins at 500, a wide sans of the looks, so a narrower face fits too. */
|
|
250
|
+
const BAR_PHONE_PX = 360;
|
|
251
|
+
const BAR_LABEL_PX = 12;
|
|
252
|
+
const BAR_SIDES_PX = 16;
|
|
253
|
+
const BAR_GAP_PX = 4;
|
|
254
|
+
const BAR_ITEM_SIDES_PX = 4;
|
|
255
|
+
const BAR_LABEL_FACE = { stack: 'Poppins', weight: 500, tracking: 0 } as const;
|
|
256
|
+
/** The short word a page is said by in a bar, by its address (its page name aside) — only where its name does not fit. */
|
|
257
|
+
const BAR_SHORT_WORDS: ReadonlyArray<[RegExp, Readonly<Record<'en' | 'he', string>>]> = [
|
|
258
|
+
// first match wins — "workshops" holds both "work" and "shop"
|
|
259
|
+
[/workshop|class|course/i, { en: 'Classes', he: 'סדנאות' }],
|
|
260
|
+
[/menu/i, { en: 'Menu', he: 'תפריט' }],
|
|
261
|
+
[/book|reserv/i, { en: 'Booking', he: 'הזמנה' }],
|
|
262
|
+
[/contact/i, { en: 'Contact', he: 'צור קשר' }],
|
|
263
|
+
[/visit|find|location|directions/i, { en: 'Visit', he: 'הגעה' }],
|
|
264
|
+
[/about|story/i, { en: 'About', he: 'אודות' }],
|
|
265
|
+
[/team/i, { en: 'Team', he: 'צוות' }],
|
|
266
|
+
[/shop|store|product/i, { en: 'Shop', he: 'חנות' }],
|
|
267
|
+
[/work|project|portfolio/i, { en: 'Work', he: 'עבודות' }],
|
|
268
|
+
[/journal|blog|news/i, { en: 'Journal', he: 'בלוג' }],
|
|
269
|
+
[/service|treatment/i, { en: 'Services', he: 'שירותים' }],
|
|
270
|
+
[/room|stay/i, { en: 'Rooms', he: 'חדרים' }],
|
|
271
|
+
[/galler/i, { en: 'Gallery', he: 'גלריה' }],
|
|
272
|
+
[/faq|question/i, { en: 'FAQ', he: 'שאלות' }],
|
|
273
|
+
[/pric/i, { en: 'Prices', he: 'מחירים' }],
|
|
274
|
+
[/event/i, { en: 'Events', he: 'אירועים' }],
|
|
275
|
+
];
|
|
276
|
+
|
|
277
|
+
/** True when `words` stand on one line inside one of `items` bar items on the narrowest phone (iox-ui#196). */
|
|
278
|
+
export function barLabelFits(words: string, items: number): boolean {
|
|
279
|
+
const n = Math.max(1, items);
|
|
280
|
+
const room = (BAR_PHONE_PX - BAR_SIDES_PX - BAR_GAP_PX * (n - 1)) / n - BAR_ITEM_SIDES_PX;
|
|
281
|
+
return textWidthEm(words, BAR_LABEL_FACE) * BAR_LABEL_PX <= room;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* What a bar item says (iox-ui#196): the page's name where it fits its item on the narrowest phone, else the short word
|
|
286
|
+
* its address is said by in the site's language ("Request a booking" → Booking, "יצירת קשר והגעה" → צור קשר) unless
|
|
287
|
+
* another item already says it; a page no short word names keeps its name (the shared CSS ends it with …). The item's
|
|
288
|
+
* layer name stays the page's name. Pure.
|
|
289
|
+
*/
|
|
290
|
+
export function barLabels(pages: ReadonlyArray<NavPage>, items: number, locale?: string): string[] {
|
|
291
|
+
const lang = commerceLanguage(locale) === 'he' ? 'he' : 'en';
|
|
292
|
+
const out = pages.map(p => p.label);
|
|
293
|
+
pages.forEach((page, i) => {
|
|
294
|
+
if (barLabelFits(page.label, items)) return;
|
|
295
|
+
const word = BAR_SHORT_WORDS.find(([re]) => re.test(page.route))?.[1][lang];
|
|
296
|
+
if (word && barLabelFits(word, items) && !out.some(l => navWordKey(l, lang) === navWordKey(word, lang))) out[i] = word;
|
|
297
|
+
});
|
|
298
|
+
return out;
|
|
299
|
+
}
|
|
300
|
+
|
|
247
301
|
/** One page the navigation links to, read off its links. */
|
|
248
302
|
export interface NavPage {
|
|
249
303
|
label: string;
|
|
@@ -647,10 +701,10 @@ function dressMenu(kit: Kit, dr: SerializedNode | null, menu: SerializedNode | n
|
|
|
647
701
|
if (close) dressButton(kit, close, 'drawer-close', look.button, true, words);
|
|
648
702
|
}
|
|
649
703
|
|
|
650
|
-
function barItem(kit: Kit, i: number, page: NavPage): SerializedNode {
|
|
704
|
+
function barItem(kit: Kit, i: number, page: NavPage, says: string): SerializedNode {
|
|
651
705
|
const item = part(kit, `bar-item-${i}`, LINKED, { linkType: LinkType.Page, pageRoute: page.route, target: '_self' }, 'bottom-bar-item', NavRole.BarItem, BAR_ITEM_LAY);
|
|
652
706
|
item.label = page.label;
|
|
653
|
-
item.children = [iconNode(kit, `bar-item-${i}-icon`, barIconForRoute(page.route)), labelText(kit, `bar-item-${i}-label`,
|
|
707
|
+
item.children = [iconNode(kit, `bar-item-${i}-icon`, barIconForRoute(page.route)), labelText(kit, `bar-item-${i}-label`, says)];
|
|
654
708
|
return item;
|
|
655
709
|
}
|
|
656
710
|
|
|
@@ -679,14 +733,16 @@ function barPages(root: SerializedNode, pages: NavPage[], count: number, words:
|
|
|
679
733
|
return withHome(root, pages, words).slice(0, count);
|
|
680
734
|
}
|
|
681
735
|
|
|
682
|
-
function bar(kit: Kit, root: SerializedNode, pages: NavPage[], shape: NavShape, count: number, drawerId: string | null, at: string, words: MenuWords): SerializedNode {
|
|
736
|
+
function bar(kit: Kit, root: SerializedNode, pages: NavPage[], shape: NavShape, count: number, drawerId: string | null, at: string, words: MenuWords, locale?: string): SerializedNode {
|
|
683
737
|
// The node IS fixed (not only its element style): the builder canvas forces a node's own `position`
|
|
684
738
|
// with !important, so a stored `static` default would pin the bar into the flow there.
|
|
685
739
|
const b = part(kit, 'bar', CONTAINER, { htmlTag: 'nav' }, 'bottom-bar', NavRole.Bar,
|
|
686
740
|
{ position: 'fixed', justifyContent: 'space-around', alignItems: 'stretch', gap: '4px', padding: '6px 8px', width: 'auto' });
|
|
687
741
|
phoneOnly(b, at, 'flex');
|
|
688
742
|
const itemCount = shape === NavShape.Both ? count - 1 : count;
|
|
689
|
-
|
|
743
|
+
const shown = barPages(root, pages, itemCount, words);
|
|
744
|
+
const says = barLabels(shown, shown.length + (shape === NavShape.Both && drawerId ? 1 : 0), locale);
|
|
745
|
+
b.children = shown.map((p, i) => barItem(kit, i, p, says[i]));
|
|
690
746
|
if (shape === NavShape.Both && drawerId) b.children.push(moreItem(kit, drawerId, words));
|
|
691
747
|
b.isGlobal = true;
|
|
692
748
|
b.globalPosition = PatternGlobalPosition.After;
|
|
@@ -869,7 +925,7 @@ export function planNavShape(globals: ReadonlyArray<SerializedNode>, shape: NavS
|
|
|
869
925
|
let more: SerializedNode | null = null;
|
|
870
926
|
if (wantBar) {
|
|
871
927
|
const count = clampBarCount(options.barItems, shape);
|
|
872
|
-
if (!b) b = bar(kit, root, pages, shape, count, dr?.id ?? null, at, words);
|
|
928
|
+
if (!b) b = bar(kit, root, pages, shape, count, dr?.id ?? null, at, words, options.locale);
|
|
873
929
|
else {
|
|
874
930
|
moveDisplayOverride(b, at);
|
|
875
931
|
more = (b.children ?? []).find(c => c.role === NavRole.More) ?? null;
|
|
@@ -879,7 +935,10 @@ export function planNavShape(globals: ReadonlyArray<SerializedNode>, shape: NavS
|
|
|
879
935
|
const want = shape === NavShape.Both ? count - 1 : count;
|
|
880
936
|
const extra = barPages(root, pages, BAR_ITEMS_MAX, words).filter(p => !items.some(c => prop(c, 'pageRoute') === p.route));
|
|
881
937
|
while (items.length > want) items.pop();
|
|
882
|
-
while (items.length < want && extra.length)
|
|
938
|
+
while (items.length < want && extra.length) {
|
|
939
|
+
const page = extra.shift()!;
|
|
940
|
+
items.push(barItem(kit, items.length, page, barLabels([page], want + (shape === NavShape.Both ? 1 : 0), options.locale)[0]));
|
|
941
|
+
}
|
|
883
942
|
}
|
|
884
943
|
if (shape === NavShape.Both && dr) b.children.push(retarget(more ?? moreItem(kit, dr.id, words), dr.id));
|
|
885
944
|
}
|
|
@@ -944,7 +1003,7 @@ export function addBarItem(globals: ReadonlyArray<SerializedNode>, options: Pick
|
|
|
944
1003
|
const words = menuWords(options.locale, sitePages.map(p => p.label));
|
|
945
1004
|
const page = barPages(root, sitePages, BAR_ITEMS_MAX + 1, words).find(p => !linked.has(p.route))
|
|
946
1005
|
?? { label: words.home, route: HOME_ROUTE };
|
|
947
|
-
const item = barItem(makeKit(out, root.id, options.newId), kids.length, page);
|
|
1006
|
+
const item = barItem(makeKit(out, root.id, options.newId), kids.length, page, barLabels([page], kids.length + 1, options.locale)[0]);
|
|
948
1007
|
const more = kids.findIndex(c => c.role === NavRole.More);
|
|
949
1008
|
if (more >= 0) kids.splice(more, 0, item); else kids.push(item);
|
|
950
1009
|
return { globals: out, added: true };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DesignChoices, designTokenRows, elementStyleFace, resolveDesignChoices, textWidthEm } from '@vectoriox/iox-ui/design-core';
|
|
1
|
+
import { DesignChoices, designTokenRows, elementStyleDropCss, elementStyleFace, resolveDesignChoices, textWidthEm } from '@vectoriox/iox-ui/design-core';
|
|
2
2
|
|
|
3
3
|
import { LAYOUT_INSET } from './layout-column';
|
|
4
4
|
import { GenerationTier } from './site-plan.model';
|
|
@@ -561,7 +561,9 @@ const MIN_PHONE_DISPLAY_PX = 36;
|
|
|
561
561
|
const LAPTOP_SIDE_PX = 32;
|
|
562
562
|
const PHONE_SIDE_PX = 24;
|
|
563
563
|
|
|
564
|
-
|
|
564
|
+
/** The element style the opening's display line wears (`title`'s). */
|
|
565
|
+
const EDGE_STYLE = 'display';
|
|
566
|
+
const faceOf = (ctx: OpeningContext) => elementStyleFace(ctx.design ?? resolveDesignChoices({}), EDGE_STYLE);
|
|
565
567
|
const nameWords = (name: string): string[] => name.trim().split(/\s+/).filter(Boolean);
|
|
566
568
|
|
|
567
569
|
/** How wide the name stands, in em of the display face: the whole line, and its longest word. */
|
|
@@ -574,6 +576,23 @@ function nameEm(ctx: OpeningContext): { line: number; longest: number } {
|
|
|
574
576
|
};
|
|
575
577
|
}
|
|
576
578
|
|
|
579
|
+
/** How many lines the name wraps into at `size` px across `room` px — word by word on the display face's own widths, as a
|
|
580
|
+
* browser breaks it (`text-wrap: balance` evens the lines, never adds one). */
|
|
581
|
+
function wordWrapper(ctx: OpeningContext): (size: number, room: number) => number {
|
|
582
|
+
const face = faceOf(ctx);
|
|
583
|
+
const widths = nameWords(ctx.name).map(w => textWidthEm(w, face));
|
|
584
|
+
const space = textWidthEm(' ', face);
|
|
585
|
+
return (size, room) => {
|
|
586
|
+
let lines = 1;
|
|
587
|
+
let run = 0;
|
|
588
|
+
for (const w of widths) {
|
|
589
|
+
const next = run ? run + (space + w) * size : w * size;
|
|
590
|
+
if (run && next > room) { lines++; run = w * size; } else run = next;
|
|
591
|
+
}
|
|
592
|
+
return lines;
|
|
593
|
+
};
|
|
594
|
+
}
|
|
595
|
+
|
|
577
596
|
/** A display-size name fits: one line across a laptop at a size that reads, and every word across a phone (R-H6). */
|
|
578
597
|
function nameFits(ctx: OpeningContext, oneLine: boolean): boolean {
|
|
579
598
|
const { line, longest } = nameEm(ctx);
|
|
@@ -618,15 +637,17 @@ export function openingDisplaySize(ctx: OpeningContext, panel: boolean): Opening
|
|
|
618
637
|
if (!token) return null;
|
|
619
638
|
const [tokenPhone, tokenLaptop] = [Number(token[1]), Number(token[2])];
|
|
620
639
|
const pad = panel ? Number(PX.exec(rows.get('space-pad') ?? '')?.[1] ?? PANEL_PAD_PX) : 0;
|
|
621
|
-
|
|
622
|
-
|
|
640
|
+
const leading = Number(rows.get('leading-display')) > 0 ? Number(rows.get('leading-display')) : 1;
|
|
641
|
+
const wrap = wordWrapper(ctx);
|
|
642
|
+
/** The largest size that keeps the words within `lines` lines of `room` AS THEY WRAP (word by word, on the face's own
|
|
643
|
+
* widths — pro-law: a filled-to-82% guess said three lines where its words broke into four and pushed the button
|
|
644
|
+
* under the first screen), their longest word on one, the lines' height within `screen` px — never above the cap. */
|
|
623
645
|
const fitted = (room: number, lines: number, screen: number): number => {
|
|
624
|
-
let size = 0;
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
size = Math.max(size, Math.min(R.capBody * body, across, (room * FIT) / longest, screen / n));
|
|
646
|
+
for (let size = Math.floor(Math.min(R.capBody * body, (room * FIT) / longest)); size > 0; size--) {
|
|
647
|
+
const n = wrap(size, room * FIT);
|
|
648
|
+
if (n <= lines && n * size * leading <= screen) return size;
|
|
628
649
|
}
|
|
629
|
-
return
|
|
650
|
+
return 0;
|
|
630
651
|
};
|
|
631
652
|
const laptop = fitted(Math.min(R.roomPx, LAPTOP_PX - 2 * LAPTOP_SIDE_PX) - 2 * pad, R.lines, R.screenShare * LAPTOP_SCREEN_H);
|
|
632
653
|
const phone = Math.min(laptop, fitted(PHONE_PX - 2 * PHONE_FRAME_PX - 2 * pad, R.phoneLines, R.phoneScreenShare * PHONE_SCREEN_H));
|
|
@@ -723,6 +744,9 @@ const TYPE_LED_HEIGHT = 'min(64svh, 600px)';
|
|
|
723
744
|
const typeLedHeights = (mix: OpeningMix): { laptop: string; phone?: string } =>
|
|
724
745
|
mix.words === OpeningWords.Apart ? { laptop: OPENING_HEIGHT } : { laptop: TYPE_LED_HEIGHT, phone: '0px' };
|
|
725
746
|
const INSET_LAPTOP = '24px';
|
|
747
|
+
/** iox-ui#196: the cue stands at the end inset (`inset-inline-end: 4%`, iox-design.css) and keeps the same inset on its
|
|
748
|
+
* start side — every word inside the screen, at 1440 and 390, in both directions. */
|
|
749
|
+
export const OPENING_CUE_MAX_WIDTH = '92%';
|
|
726
750
|
const ABS_FILL: Readonly<Record<string, string>> = { position: 'absolute', top: '0px', left: '0px', width: '100%', height: '100%', zIndex: '0' };
|
|
727
751
|
const MEDIA_FILL: Readonly<Record<string, string>> = { ...ABS_FILL, aspectRatio: 'auto', borderRadius: '0px', objectFit: 'cover' };
|
|
728
752
|
const OVER = (z: number): Readonly<Record<string, string>> => ({ position: 'relative', zIndex: String(z) });
|
|
@@ -754,15 +778,33 @@ const phoneFramePad = (mix: OpeningMix): string =>
|
|
|
754
778
|
const sizedPx = (em: number, side: number | string, cap: string): string =>
|
|
755
779
|
`min(calc((100vw - ${typeof side === 'number' ? `${2 * side}px` : `2 * ${side}`}) * ${FIT} / ${Math.max(em, 1).toFixed(3)}), ${cap})`;
|
|
756
780
|
|
|
781
|
+
/** The name on the edge is set tight on a laptop; a phone's line leaves room should a face still break it. */
|
|
782
|
+
const EDGE_LINE_HEIGHT = 0.82;
|
|
783
|
+
const EDGE_PHONE_LINE_HEIGHT = 0.9;
|
|
784
|
+
|
|
757
785
|
/**
|
|
758
786
|
* The name standing on the bottom edge (`words:on-edge`): ONE display line on a laptop AND on a phone (iox-ui#150) — a
|
|
759
787
|
* phone sizes it by the whole name across the room beside it (`phoneSide`), never by its longest word: sized by a word,
|
|
760
|
-
* a long name wrapped to four lines at 80 px, its lines touching, and pushed the page a screen down.
|
|
761
|
-
*
|
|
788
|
+
* a long name wrapped to four lines at 80 px, its lines touching, and pushed the page a screen down.
|
|
789
|
+
* iox-ui#206: the frame crops the name at its BASELINE — the line drops by the display face's own amount at each line
|
|
790
|
+
* height (design-core `baselineDropEm`), so its descenders go under the edge and its letters stand whole on it. A fixed
|
|
791
|
+
* 0.16em put Fraunces' baseline 0.11em under the edge: the store's capitals were cut through.
|
|
792
|
+
* iox-ui#215: the drop is CSS that reads the display family's derived metric tokens (design-core `elementStyleDropCss`),
|
|
793
|
+
* so a font changed in Design moves the line with it, in the builder and on the live site; it falls back to the face
|
|
794
|
+
* composed with.
|
|
762
795
|
*/
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
796
|
+
function edgeTitle(line: number, phoneSide: number | string, ctx: OpeningContext): PatternNode {
|
|
797
|
+
const design = ctx.design ?? resolveDesignChoices({});
|
|
798
|
+
return title({
|
|
799
|
+
fontSize: sizedPx(line, LAPTOP_SIDE_PX, '50svh'), lineHeight: String(EDGE_LINE_HEIGHT), margin: '0px',
|
|
800
|
+
translateY: elementStyleDropCss(design, EDGE_STYLE, EDGE_LINE_HEIGHT),
|
|
801
|
+
}, {
|
|
802
|
+
resp: { mobile: {
|
|
803
|
+
fontSize: sizedPx(line, phoneSide, '22vw'), lineHeight: String(EDGE_PHONE_LINE_HEIGHT),
|
|
804
|
+
translateY: elementStyleDropCss(design, EDGE_STYLE, EDGE_PHONE_LINE_HEIGHT),
|
|
805
|
+
} },
|
|
806
|
+
});
|
|
807
|
+
}
|
|
766
808
|
|
|
767
809
|
function frameNode(mix: OpeningMix, children: PatternNode[]): PatternNode {
|
|
768
810
|
const inset = mix.frame === OpeningFrame.Inset || mix.frame === OpeningFrame.Shrinks;
|
|
@@ -908,7 +950,7 @@ function typeLedWordsNodes(mix: OpeningMix, ctx: OpeningContext): PatternNode[]
|
|
|
908
950
|
lay: { position: 'absolute', left: '0px', bottom: '0px', width: '100%', zIndex: '1', padding: `0px ${LAPTOP_SIDE_PX}px`, overflow: 'visible' },
|
|
909
951
|
resp: { mobile: { position: 'relative', left: 'auto', bottom: 'auto', padding: '0px', margin: `auto 0px calc(-1 * ${phoneFramePad(mix)}) 0px` } },
|
|
910
952
|
// The words sit inside the frame's own padding on a phone: the line is sized across what it leaves.
|
|
911
|
-
c: [edgeTitle(line, `max(${phoneFramePad(mix)}, ${LAYOUT_INSET})
|
|
953
|
+
c: [edgeTitle(line, `max(${phoneFramePad(mix)}, ${LAYOUT_INSET})`, ctx)],
|
|
912
954
|
}];
|
|
913
955
|
case OpeningWords.Wordmark:
|
|
914
956
|
case OpeningWords.Behind:
|
|
@@ -948,7 +990,7 @@ function wordsNodes(mix: OpeningMix, ctx: OpeningContext): PatternNode[] {
|
|
|
948
990
|
t: 'Container', es: 'box', role: OpeningRole.Words,
|
|
949
991
|
lay: { position: 'absolute', left: '0px', bottom: '0px', width: '100%', zIndex: '1', padding: `0px ${LAPTOP_SIDE_PX}px`, overflow: 'visible' },
|
|
950
992
|
resp: { mobile: { padding: `0px ${PHONE_SIDE_PX}px` } },
|
|
951
|
-
c: [edgeTitle(line, PHONE_SIDE_PX)],
|
|
993
|
+
c: [edgeTitle(line, PHONE_SIDE_PX, ctx)],
|
|
952
994
|
}];
|
|
953
995
|
case OpeningWords.Wordmark:
|
|
954
996
|
case OpeningWords.Behind:
|
|
@@ -1020,7 +1062,9 @@ function extrasNodes(mix: OpeningMix): PatternNode[] {
|
|
|
1020
1062
|
});
|
|
1021
1063
|
}
|
|
1022
1064
|
if (mix.extras.includes(OpeningExtra.Cue)) {
|
|
1023
|
-
|
|
1065
|
+
// iox-ui#196: as wide as its words (a Text is 100% by default — at the end inset it started 4% off the screen), and
|
|
1066
|
+
// never wider than the room between the two insets (the shared CSS holds that for a cue saved before).
|
|
1067
|
+
out.push({ t: 'Text', es: 'eyebrow', role: OpeningRole.Cue, text: 'Scroll', textHe: 'גללו', lay: { position: 'absolute', bottom: '20px', zIndex: '2', margin: '0px', width: 'auto', maxWidth: OPENING_CUE_MAX_WIDTH } });
|
|
1024
1068
|
}
|
|
1025
1069
|
return out;
|
|
1026
1070
|
}
|
|
@@ -54,6 +54,7 @@ export * from './audit-words';
|
|
|
54
54
|
export * from './stock-match';
|
|
55
55
|
export * from './stock-photos';
|
|
56
56
|
export * from './stock-search';
|
|
57
|
+
export * from './stock-subjects';
|
|
57
58
|
export * from './film';
|
|
58
59
|
export * from './art-direction';
|
|
59
60
|
export * from './pictures';
|
|
@@ -114,6 +115,7 @@ export * from './design-ops-of';
|
|
|
114
115
|
export * from './critic-rubric.generated';
|
|
115
116
|
export * from './critic';
|
|
116
117
|
export * from './critic-sheet';
|
|
118
|
+
export * from './critic-numbers';
|
|
117
119
|
export * from './critic-prompt';
|
|
118
120
|
export * from './critic-calibration';
|
|
119
121
|
export * from './structure-fingerprint';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LinkType } from '@vectoriox/iox-ui/design-core';
|
|
2
|
-
import { channelHref, ChannelKind } from '@vectoriox/iox-ui/forms-core';
|
|
2
|
+
import { channelHref, ChannelKind, FORM_CHANNEL_ROLE, parseChannelHref } from '@vectoriox/iox-ui/forms-core';
|
|
3
3
|
|
|
4
4
|
import { FOOTER_SOCIAL_NETWORKS, FooterRole, footerSocialLinks, FooterSocialLink, recognisedSocialLinks, socialLinkOf, socialLinksPart } from './footer-mix';
|
|
5
5
|
import { PatternNode } from './patterns';
|
|
@@ -18,8 +18,9 @@ import { FACT_KEYS } from './site-plan.model';
|
|
|
18
18
|
* - `SITE_SOCIAL_FIELDS`, `siteSocialLinks`, `siteSocialPatch` — the Site settings record's fields, read and written;
|
|
19
19
|
* - `statedWhatsAppHref` — a stated WhatsApp link as the contact form's WhatsApp channel (forms-core `channelHref`);
|
|
20
20
|
* - `withFollowRow` — a contact section with the footer's social part ("Follow" and the links) beside its contact facts;
|
|
21
|
-
* - `followSiteSocials` — every follow row a saved layout holds, drawn from Site settings ▸ Socials AT RENDER (iox-ui#201)
|
|
22
|
-
* the engine and the builder both apply it, so a link changed in
|
|
21
|
+
* - `followSiteSocials` — every follow row a saved layout holds, drawn from Site settings ▸ Socials AT RENDER (iox-ui#201),
|
|
22
|
+
* and every form's WhatsApp channel with them (iox-ui#205): the engine and the builder both apply it, so a link changed in
|
|
23
|
+
* Site settings reaches every site, old builds included.
|
|
23
24
|
*
|
|
24
25
|
* Pure and framework-free (iox-cms imports it).
|
|
25
26
|
*/
|
|
@@ -198,6 +199,13 @@ export function withFollowRow(node: PatternNode, social: ReadonlyArray<string> |
|
|
|
198
199
|
* the links will show and the template survives the next save.
|
|
199
200
|
* - Site settings unread (`null` — the read failed or the studio has no record yet): the layout as saved.
|
|
200
201
|
*
|
|
202
|
+
* A form's WhatsApp channel (iox-ui#205) is the same fact in another place: the "Message us on WhatsApp" button beside a
|
|
203
|
+
* form (role `form.channel`) whose address is a WhatsApp chat. Its number is Site settings' WhatsApp, read when the page is
|
|
204
|
+
* drawn — a changed number reaches it as it reaches the follow row. Site settings without a WhatsApp: on the LIVE site the
|
|
205
|
+
* button goes (a chat with a number the studio dropped is worse than none — the submit stays); in the BUILDER it stays as
|
|
206
|
+
* saved. Its words, look and the rest of the form are the owner's and are never touched. A channel the owner pointed
|
|
207
|
+
* elsewhere (a call, an email, a link) is not a WhatsApp channel and is never touched either.
|
|
208
|
+
*
|
|
201
209
|
* Pure: a new tree where something changed, the same node objects where nothing did; ids of the copies are derived from the
|
|
202
210
|
* template's (`<template>-<network>`), so a builder save and the next render agree.
|
|
203
211
|
*/
|
|
@@ -239,9 +247,23 @@ const PH_WEIGHT = /^ph(-(thin|light|regular|bold|fill|duotone))?$/;
|
|
|
239
247
|
/** The suffix a copy's id carries — stripped to find the template's own id on the next pass. */
|
|
240
248
|
const NETWORK_SUFFIX = new RegExp(`-(${FOOTER_SOCIAL_NETWORKS.map(n => n.id).join('|')})$`);
|
|
241
249
|
|
|
242
|
-
/**
|
|
250
|
+
/** Where a channel (a ButtonBlock that links) writes its address. */
|
|
251
|
+
const CHANNEL_URL_SLOT = 'href';
|
|
252
|
+
|
|
253
|
+
/** A form's WhatsApp channel (iox-ui#205): role `form.channel`, its address a WhatsApp chat (forms-core `parseChannelHref`). */
|
|
254
|
+
function isWhatsAppChannel(n: FollowRowNode | null | undefined): boolean {
|
|
255
|
+
if (n?.role !== FORM_CHANNEL_ROLE) return false;
|
|
256
|
+
const { kind, value } = parseChannelHref(n.props?.[CHANNEL_URL_SLOT]);
|
|
257
|
+
return kind === ChannelKind.WhatsApp && !!value;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/** A node Site settings ▸ Socials draws: a follow row, or a form's WhatsApp channel. */
|
|
261
|
+
const isFollowed = (n: FollowRowNode): boolean => isFollowRow(n) || isWhatsAppChannel(n);
|
|
262
|
+
|
|
263
|
+
/** True when the tree holds a follow row (a stamped follow link) or a form's WhatsApp channel — a renderer reads Site
|
|
264
|
+
* settings only then. */
|
|
243
265
|
export function holdsFollowRow(nodes: ReadonlyArray<FollowRowNode> | null | undefined): boolean {
|
|
244
|
-
return (nodes ?? []).some(n => n?.role === FOLLOW_LINK_ROLE || holdsFollowRow(n?.children));
|
|
266
|
+
return (nodes ?? []).some(n => n?.role === FOLLOW_LINK_ROLE || isWhatsAppChannel(n) || holdsFollowRow(n?.children));
|
|
245
267
|
}
|
|
246
268
|
|
|
247
269
|
/** Every follow row of `roots` drawn from Site settings' links (`siteSocialLinks` of the record) — see above. Pure. */
|
|
@@ -252,7 +274,12 @@ export function followSiteSocials<T extends FollowRowNode>(
|
|
|
252
274
|
): T[] {
|
|
253
275
|
if (site == null || !holdsFollowRow(roots)) return roots as T[];
|
|
254
276
|
const links = footerSocialLinks(site).links;
|
|
277
|
+
const whatsApp = statedWhatsAppHref(site);
|
|
255
278
|
return splice(roots as ReadonlyArray<FollowRowNode>, n => {
|
|
279
|
+
if (isWhatsAppChannel(n)) {
|
|
280
|
+
const channel = followChannel(n, whatsApp, view);
|
|
281
|
+
return channel ? [channel] : [];
|
|
282
|
+
}
|
|
256
283
|
if (!isFollowRow(n)) return undefined;
|
|
257
284
|
const row = followRow(n, links, view);
|
|
258
285
|
return row ? [row] : [];
|
|
@@ -290,10 +317,10 @@ const holdsLink = (n: FollowRowNode): boolean => (n.children ?? []).some(k => k.
|
|
|
290
317
|
/** A row: the `footer.social` block, or (a one-line footer) the bare box its stamped links sit in. */
|
|
291
318
|
const isFollowRow = (n: FollowRowNode): boolean => n.role === FOLLOW_ROW_ROLE || (n.children ?? []).some(k => k.role === FOLLOW_LINK_ROLE);
|
|
292
319
|
|
|
293
|
-
/** Every follow row
|
|
320
|
+
/** Every node Site settings draws (a follow row, a WhatsApp channel) by its id — the outermost, never looked inside. */
|
|
294
321
|
function followRowsById(nodes: ReadonlyArray<FollowRowNode>, out = new Map<string, FollowRowNode>()): Map<string, FollowRowNode> {
|
|
295
322
|
for (const n of nodes) {
|
|
296
|
-
if (
|
|
323
|
+
if (isFollowed(n)) out.set(n.id, n);
|
|
297
324
|
else if (n.children) followRowsById(n.children, out);
|
|
298
325
|
}
|
|
299
326
|
return out;
|
|
@@ -317,7 +344,7 @@ export function keepSavedFollowRows<T extends FollowRowNode>(
|
|
|
317
344
|
if (!storedRows.size) return serialized as T[];
|
|
318
345
|
const drawnRows = followRowsById(drawn);
|
|
319
346
|
return splice(serialized as ReadonlyArray<FollowRowNode>, n => {
|
|
320
|
-
if (!
|
|
347
|
+
if (!isFollowed(n)) return undefined;
|
|
321
348
|
const stored = storedRows.get(n.id);
|
|
322
349
|
const asDrawn = drawnRows.get(n.id);
|
|
323
350
|
return stored && asDrawn && JSON.stringify(n) === JSON.stringify(asDrawn) ? [stored] : [n];
|
|
@@ -334,6 +361,18 @@ function followRow(row: FollowRowNode, links: ReadonlyArray<FooterSocialLink>, v
|
|
|
334
361
|
return links.length || holdsLink(next) ? next : null;
|
|
335
362
|
}
|
|
336
363
|
|
|
364
|
+
/**
|
|
365
|
+
* A form's WhatsApp channel drawn: Site settings' WhatsApp as its address (any `?text=` the owner added kept), the same node
|
|
366
|
+
* when it already is; no WhatsApp in Site settings — gone on the live site, as saved in the builder.
|
|
367
|
+
*/
|
|
368
|
+
function followChannel(channel: FollowRowNode, whatsApp: string, view: FollowRowView): FollowRowNode | null {
|
|
369
|
+
if (!whatsApp) return view === FollowRowView.Edit ? channel : null;
|
|
370
|
+
const current = String(channel.props?.[CHANNEL_URL_SLOT] ?? '').trim();
|
|
371
|
+
const suffix = current.match(/[?#].*$/)?.[0] ?? '';
|
|
372
|
+
const href = `${whatsApp}${suffix}`;
|
|
373
|
+
return href === current ? channel : { ...channel, props: { ...channel.props, [CHANNEL_URL_SLOT]: href } };
|
|
374
|
+
}
|
|
375
|
+
|
|
337
376
|
/** The template drawn for one network: its address (external), its words, its glyph, ids derived. */
|
|
338
377
|
function followLink(template: FollowRowNode, link: FooterSocialLink): FollowRowNode {
|
|
339
378
|
const glyph = FOOTER_SOCIAL_NETWORKS.find(n => n.id === link.network)?.icon;
|