@aglyn/aglyn 1.0.0-beta.260 → 1.0.0-beta.262
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/package.json +11 -11
- package/src/lib/app-utils/docs-help-sections.generated.js +1 -1
- package/src/lib/app-utils/docs-help-sections.generated.js.map +1 -1
- package/src/lib/app-utils/docs-index.generated.js +2 -2
- package/src/lib/app-utils/docs-index.generated.js.map +1 -1
- package/src/lib/app-utils/element-motion.d.ts +17 -1
- package/src/lib/app-utils/element-motion.js +36 -10
- package/src/lib/app-utils/element-motion.js.map +1 -1
- package/src/lib/app-utils/notifications.d.ts +10 -6
- package/src/lib/app-utils/notifications.js +102 -9
- package/src/lib/app-utils/notifications.js.map +1 -1
- package/src/lib/app-utils/operator-alerts.js +19 -0
- package/src/lib/app-utils/operator-alerts.js.map +1 -1
- package/src/lib/app-utils/weekly-summary.d.ts +100 -0
- package/src/lib/app-utils/weekly-summary.js +137 -0
- package/src/lib/app-utils/weekly-summary.js.map +1 -0
- package/src/lib/plugin-manager/plugin-figures.d.ts +42 -0
- package/src/lib/plugin-manager/plugin-figures.js +51 -0
- package/src/lib/plugin-manager/plugin-figures.js.map +1 -1
- package/src/lib/plugin-manager/stock-photo-provider.d.ts +5 -0
- package/src/lib/plugin-manager/stock-photo-provider.js.map +1 -1
|
@@ -36,7 +36,15 @@ import { type AnimationEase, type AnimationPreset } from './element-animation';
|
|
|
36
36
|
* page's Largest Contentful Paint, never move: they are painted where
|
|
37
37
|
* they stand from the first frame. Its band — a background color or a
|
|
38
38
|
* cover photo — never moves either.
|
|
39
|
-
* - Every later section's content slides in on `scroll
|
|
39
|
+
* - Every later section's content slides in on `scroll`, each section in
|
|
40
|
+
* turn taking the next of the character's {@link
|
|
41
|
+
* ElementMotionCharacter.sectionPresets}, so a page does not arrive as
|
|
42
|
+
* one repeated move.
|
|
43
|
+
* - A split — a column of words beside a picture — comes in from its
|
|
44
|
+
* sides when the character says {@link ElementMotionCharacter.sides}:
|
|
45
|
+
* the left column from the left, the right from the right, the second a
|
|
46
|
+
* stagger step after the first. A picture whose preset zooms keeps its
|
|
47
|
+
* zoom.
|
|
40
48
|
* - A group of like items — a grid of cards, a list, the questions of an
|
|
41
49
|
* FAQ, a dataset repeated over one card — STAGGERS its items, one after
|
|
42
50
|
* another, rather than arriving as one block.
|
|
@@ -71,6 +79,14 @@ export interface ElementMotionCharacter {
|
|
|
71
79
|
staggerStepMs: number;
|
|
72
80
|
/** Gap between the rungs of the first section's load ladder. */
|
|
73
81
|
heroStepMs: number;
|
|
82
|
+
/**
|
|
83
|
+
* The presets later sections take in turn, the second section the first of
|
|
84
|
+
* them; {@link preset} alone when absent. A section's pictures still take
|
|
85
|
+
* {@link mediaPreset}.
|
|
86
|
+
*/
|
|
87
|
+
sectionPresets?: readonly AnimationPreset[];
|
|
88
|
+
/** Whether a split's two columns come in from their own sides. */
|
|
89
|
+
sides?: boolean;
|
|
74
90
|
}
|
|
75
91
|
/** The motion a page gets when nothing says otherwise: a soft rise, as the attributes panel defaults to. */
|
|
76
92
|
export declare const ELEMENT_MOTION_DEFAULT: ElementMotionCharacter;
|
|
@@ -22,7 +22,12 @@ import { ANIMATION_MAX_DELAY_MS, ANIMATION_MAX_DURATION_MS, ANIMATION_MAX_STAGGE
|
|
|
22
22
|
ease: 'smooth',
|
|
23
23
|
durationMs: 600,
|
|
24
24
|
staggerStepMs: 90,
|
|
25
|
-
heroStepMs: 120
|
|
25
|
+
heroStepMs: 120,
|
|
26
|
+
sectionPresets: [
|
|
27
|
+
'slide-up',
|
|
28
|
+
'fade'
|
|
29
|
+
],
|
|
30
|
+
sides: true
|
|
26
31
|
};
|
|
27
32
|
/** The most rungs the first section's ladder climbs; later blocks share the last. */ export const ELEMENT_MOTION_HERO_RUNGS = 6;
|
|
28
33
|
/**
|
|
@@ -118,6 +123,7 @@ const clamp = (value, max)=>Math.min(Math.max(Math.round(value), 0), max);
|
|
|
118
123
|
* move.
|
|
119
124
|
*/ export function applyElementMotion(nodes, options = {}) {
|
|
120
125
|
var _options_character, _options_rootId, _options_sectionIds;
|
|
126
|
+
var _character_sectionPresets;
|
|
121
127
|
if (!nodes) return nodes;
|
|
122
128
|
const character = (_options_character = options.character) != null ? _options_character : ELEMENT_MOTION_DEFAULT;
|
|
123
129
|
const rootId = (_options_rootId = options.rootId) != null ? _options_rootId : CANVAS_ROOT_ELEMENT_ID;
|
|
@@ -201,14 +207,15 @@ const clamp = (value, max)=>Math.min(Math.max(Math.round(value), 0), max);
|
|
|
201
207
|
}
|
|
202
208
|
return false;
|
|
203
209
|
};
|
|
204
|
-
const presetOf = (id, group)=>{
|
|
210
|
+
const presetOf = (id, group, words)=>{
|
|
205
211
|
const media = group ? children(id).every(leadsWithMedia) : leadsWithMedia(id);
|
|
206
|
-
return media ? character.mediaPreset :
|
|
212
|
+
return media ? character.mediaPreset : words;
|
|
207
213
|
};
|
|
208
|
-
const animate = (id, trigger, delayMs)=>{
|
|
214
|
+
const animate = (id, trigger, delayMs, words = character.preset, side)=>{
|
|
209
215
|
const group = isGroup(id);
|
|
216
|
+
const preset = presetOf(id, group, words);
|
|
210
217
|
patches.set(id, _extends({
|
|
211
|
-
[NODE_ANIMATION_PROP]:
|
|
218
|
+
[NODE_ANIMATION_PROP]: side && !preset.startsWith('zoom') ? side : preset,
|
|
212
219
|
[NODE_ANIMATION_TRIGGER_PROP]: trigger,
|
|
213
220
|
[NODE_ANIMATION_DURATION_PROP]: clamp(character.durationMs, ANIMATION_MAX_DURATION_MS)
|
|
214
221
|
}, delayMs > 0 ? {
|
|
@@ -229,13 +236,27 @@ const clamp = (value, max)=>Math.min(Math.max(Math.round(value), 0), max);
|
|
|
229
236
|
}
|
|
230
237
|
return at;
|
|
231
238
|
};
|
|
232
|
-
/**
|
|
239
|
+
/**
|
|
240
|
+
* A column of words beside a picture: two blocks, one of which leads with a
|
|
241
|
+
* picture and one of which does not, neither left alone. Two cards that
|
|
242
|
+
* both lead with one are a group, and stagger.
|
|
243
|
+
*/ const isSplit = (id)=>{
|
|
244
|
+
const kids = children(id);
|
|
245
|
+
return kids.length === 2 && leadsWithMedia(kids[0]) !== leadsWithMedia(kids[1]) && !kids.some(holds);
|
|
246
|
+
};
|
|
247
|
+
/** A later section's content: on scroll, groups staggered, splits from their sides, nothing nested. */ const place = (id, words)=>{
|
|
233
248
|
if (closed(id)) return;
|
|
249
|
+
if (character.sides && isSplit(id)) {
|
|
250
|
+
const [start, end] = children(id);
|
|
251
|
+
animate(start, 'scroll', 0, words, 'slide-right');
|
|
252
|
+
animate(end, 'scroll', character.staggerStepMs, words, 'slide-left');
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
234
255
|
if (holds(id) || !isGroup(id) && holdsGroup(id)) {
|
|
235
|
-
for (const child of children(id))place(child);
|
|
256
|
+
for (const child of children(id))place(child, words);
|
|
236
257
|
return;
|
|
237
258
|
}
|
|
238
|
-
animate(id, 'scroll', 0);
|
|
259
|
+
animate(id, 'scroll', 0, words);
|
|
239
260
|
};
|
|
240
261
|
/** Down through wrappers of one child that are free to move. */ const descend = (id)=>{
|
|
241
262
|
let at = id;
|
|
@@ -316,15 +337,20 @@ const clamp = (value, max)=>Math.min(Math.max(Math.round(value), 0), max);
|
|
|
316
337
|
};
|
|
317
338
|
const sections = ((_options_sectionIds = options.sectionIds) != null ? _options_sectionIds : children(rootId)).filter((id)=>!!node(id));
|
|
318
339
|
if (sections[0]) markStill(sections[0]);
|
|
340
|
+
const turns = ((_character_sectionPresets = character.sectionPresets) == null ? void 0 : _character_sectionPresets.length) ? character.sectionPresets : [
|
|
341
|
+
character.preset
|
|
342
|
+
];
|
|
319
343
|
sections.forEach((id, index)=>{
|
|
344
|
+
var _turns_;
|
|
320
345
|
if (closed(id)) return;
|
|
321
346
|
const content = contentOf(id);
|
|
322
347
|
// The band itself never moves — only what it holds — so a section that
|
|
323
348
|
// is nothing but its band has nothing to move.
|
|
324
349
|
if (content === id && !children(id).length) return;
|
|
350
|
+
const words = (_turns_ = turns[(index - 1) % turns.length]) != null ? _turns_ : character.preset;
|
|
325
351
|
if (index === 0) ladder(content);
|
|
326
|
-
else if (content === id && !isGroup(id)) for (const child of children(id))place(child);
|
|
327
|
-
else place(content);
|
|
352
|
+
else if (content === id && !isGroup(id) && !(character.sides && isSplit(id))) for (const child of children(id))place(child, words);
|
|
353
|
+
else place(content, words);
|
|
328
354
|
});
|
|
329
355
|
if (!patches.size) return nodes;
|
|
330
356
|
const next = _extends({}, nodes);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../libs/aglyn/src/lib/app-utils/element-motion.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { CANVAS_ROOT_ELEMENT_ID } from '../foundation/constants/canvas'\nimport {\n ANIMATION_MAX_DELAY_MS,\n ANIMATION_MAX_DURATION_MS,\n ANIMATION_MAX_STAGGER_STEP_MS,\n NODE_ANIMATION_DELAY_PROP,\n NODE_ANIMATION_DURATION_PROP,\n NODE_ANIMATION_EASE_PROP,\n NODE_ANIMATION_PROPS,\n NODE_ANIMATION_PROP,\n NODE_ANIMATION_STAGGER_PROP,\n NODE_ANIMATION_STAGGER_STEP_PROP,\n NODE_ANIMATION_TRIGGER_PROP,\n type AnimationEase,\n type AnimationPreset,\n type AnimationTrigger,\n} from './element-animation'\n\n/**\n * Entrance motion for a whole page (AGL-3838): the pass that writes the\n * existing animation props (`element-animation.ts`) onto a page built by\n * code — a starter, a new site's home, a page the AI composed — so it moves\n * the way an author would have set it up by hand in the attributes panel.\n *\n * Nothing new is rendered or shipped: the pass only writes the reserved\n * `aglynAnimation*` props the renderer and the tenant's stylesheet already\n * read, with values from their own vocabulary. A page that moves pays the\n * stylesheet and the scroll observer it always paid; a page this pass leaves\n * alone pays nothing.\n *\n * ## The rules\n *\n * - The FIRST section's secondary content — its eyebrow, its lede, its\n * buttons, a small picture — plays on `load`, as a short ladder: each\n * block starts {@link ElementMotionCharacter.heroStepMs} after the one\n * before. Its main heading and its largest picture, the candidates for the\n * page's Largest Contentful Paint, never move: they are painted where\n * they stand from the first frame. Its band — a background color or a\n * cover photo — never moves either.\n * - Every later section's content slides in on `scroll`.\n * - A group of like items — a grid of cards, a list, the questions of an\n * FAQ, a dataset repeated over one card — STAGGERS its items, one after\n * another, rather than arriving as one block.\n * - A picture, and a group whose items each lead with one, takes the\n * character's media preset.\n * - Never touched: forms and their fields, navigation and the site's frame,\n * anything out of the flow (`position: fixed | sticky | absolute` — a\n * cover photo's backdrop is its band's), anything hidden, and\n * anything that already carries an animation prop — an author's choice,\n * `none` included, is never overwritten. A block that HOLDS one of those\n * is not animated as a whole either; its other children are animated one\n * by one instead, so a form never slides in with its section.\n * - Never nested: once a block animates, nothing inside it does. Two\n * entrances on the same pixels multiply their fades and add their\n * offsets, which reads as a stutter, not as motion.\n *\n * Pure and idempotent: a page it already moved comes back as the same\n * object, which is what lets a caller compare by identity to skip a write.\n *\n * Leaf imports only, the same as `starter-template-nodes.ts`: the starter\n * kit reads this from the console's client gallery and its seed route alike.\n */\n\n/** A page's motion: the presets, curve and timing every entrance on it shares. */\nexport interface ElementMotionCharacter {\n /** Words and blocks: a section's content, a group of cards. */\n preset: AnimationPreset\n /** A picture, or a group whose every item leads with one. */\n mediaPreset: AnimationPreset\n ease: AnimationEase\n durationMs: number\n /** Gap between the items of a staggered group. */\n staggerStepMs: number\n /** Gap between the rungs of the first section's load ladder. */\n heroStepMs: number\n}\n\n/** The motion a page gets when nothing says otherwise: a soft rise, as the attributes panel defaults to. */\nexport const ELEMENT_MOTION_DEFAULT: ElementMotionCharacter = {\n preset: 'slide-up',\n mediaPreset: 'fade',\n ease: 'smooth',\n durationMs: 600,\n staggerStepMs: 90,\n heroStepMs: 120,\n}\n\n/** The most rungs the first section's ladder climbs; later blocks share the last. */\nexport const ELEMENT_MOTION_HERO_RUNGS = 6\n\n/**\n * Elements that are never animated, nor animated as part of a block that\n * holds them: forms and every field of one, and the site's navigation and\n * frame. A field that slides in under a visitor's cursor is a field they\n * miss, and a header that moves is a site that looks broken.\n */\nexport const ELEMENT_MOTION_NEVER: ReadonlySet<string> = new Set([\n // Forms and their fields.\n 'form',\n 'formField',\n 'muiFormControl',\n 'muiFormLabel',\n 'muiFormControlLabel',\n 'muiFormHelperText',\n 'muiInput',\n 'muiSelect',\n 'muiSelectOption',\n 'muiRadioGroup',\n 'muiRadio',\n 'muiCheckbox',\n 'muiRating',\n 'muiDatePicker',\n 'muiTimePicker',\n 'newsletter-signup',\n 'member-signin',\n 'member-signup',\n 'member-recovery',\n 'booking',\n 'reservation-widget',\n 'customer-account',\n 'return-request',\n 'order-status',\n 'searchBox',\n 'collectionSearch',\n // Navigation and the site's frame.\n 'layoutSlot',\n 'muiAppBar',\n 'muiToolbar',\n 'muiDrawer',\n 'muiDrawerToggle',\n 'muiNavMenu',\n 'muiMegaMenu',\n 'muiBreadcrumbs',\n 'muiTabs',\n 'languageSwitcher',\n 'themeModeSwitcher',\n 'cart',\n])\n\n/** Pictures: what the media preset is for. */\nconst MEDIA: ReadonlySet<string> = new Set(['image', 'video', 'videoEmbed', 'gated-video'])\n\n/** Components that list like items whatever their children are. */\nconst LISTS: ReadonlySet<string> = new Set(['muiList', 'muiImageList', 'collectionEntries'])\n\n/**\n * What a group's items are made of when they are alike: cards, cells,\n * panels, pictures. Words and buttons never count, however alike — a row of\n * two buttons is a call to action, not a group of cards.\n */\nconst ITEMS: ReadonlySet<string> = new Set([\n 'muiCard',\n 'muiPaper',\n 'muiGrid',\n 'muiStack',\n 'muiBox',\n 'muiLinkBox',\n 'muiListItem',\n 'muiImageListItem',\n 'muiAccordion',\n 'reusableInstance',\n 'div',\n 'image',\n 'video',\n])\n\ninterface MotionNode {\n componentId?: string\n props?: Record<string, unknown>\n sx?: Record<string, unknown>\n nodes?: string[]\n hidden?: boolean\n}\n\nexport interface ElementMotionOptions {\n /** The page's root; the canvas root when absent. */\n rootId?: string\n /** The page's sections in order; the root's own children when absent. */\n sectionIds?: readonly string[]\n character?: ElementMotionCharacter\n}\n\nconst clamp = (value: number, max: number): number => Math.min(Math.max(Math.round(value), 0), max)\n\n/**\n * Whether a style value — plain or one per breakpoint — takes the element out\n * of the flow: pinned to the screen, or laid over its band, as a cover\n * photo's backdrop and its scrim are. Either is part of the band, not of what\n * the band holds.\n */\nfunction pins(value: unknown): boolean {\n if (value === 'fixed' || value === 'sticky' || value === 'absolute') return true\n return typeof value === 'object' && value !== null && Object.values(value).some(pins)\n}\n\n/**\n * Writes entrance motion onto a page's nodes by the rules above, and returns\n * the new node map — or `nodes` itself, unchanged, when there was nothing to\n * move.\n */\nexport function applyElementMotion<T extends Record<string, any>>(nodes: T, options: ElementMotionOptions = {}): T {\n if (!nodes) return nodes\n const character = options.character ?? ELEMENT_MOTION_DEFAULT\n const rootId = options.rootId ?? CANVAS_ROOT_ELEMENT_ID\n const node = (id: string): MotionNode | undefined => nodes[id] as MotionNode | undefined\n const children = (id: string): string[] => (node(id)?.nodes ?? []).filter((child) => typeof child === 'string' && !!node(child))\n const patches = new Map<string, Record<string, unknown>>()\n\n /** The first section's Largest Contentful Paint candidates, painted where they stand. */\n const still = new Set<string>()\n /** Left alone, and so is everything inside it. */\n const closed = (id: string): boolean => {\n const at = node(id)\n if (!at) return true\n if (at.hidden || still.has(id)) return true\n if (ELEMENT_MOTION_NEVER.has(String(at.componentId ?? ''))) return true\n if (at.props && NODE_ANIMATION_PROPS.some((prop) => at.props?.[prop] !== undefined)) return true\n return pins(at.sx?.['position'])\n }\n const holdsClosed = new Map<string, boolean>()\n /** The element, or one inside it, is left alone: it cannot move as one block. */\n const holds = (id: string): boolean => {\n const known = holdsClosed.get(id)\n if (known !== undefined) return known\n holdsClosed.set(id, false)\n const result = closed(id) || children(id).some(holds)\n holdsClosed.set(id, result)\n return result\n }\n const groupMemo = new Map<string, boolean>()\n const belowMemo = new Map<string, boolean>()\n /**\n * A group of like items, whose items stagger. A grid or a row of panels\n * that holds a group of its own is the LAYOUT around it — a heading beside\n * its cards — so it is opened up and the group inside staggers instead.\n */\n const isGroup = (id: string): boolean => {\n const known = groupMemo.get(id)\n if (known !== undefined) return known\n const at = node(id) as MotionNode\n const componentId = String(at.componentId ?? '')\n const kids = children(id)\n let result: boolean\n // A dataset repeated over one card renders one child per record.\n if ((at.props?.['repeatDataset'] || LISTS.has(componentId)) && kids.length) result = true\n else if (kids.length < 2) result = false\n else {\n const first = String(node(kids[0])?.componentId ?? '')\n const alike =\n (componentId === 'muiGrid' && !!at.props?.['container']) ||\n (ITEMS.has(first) && kids.every((child) => node(child)?.componentId === first))\n result = alike && !holdsGroup(id)\n }\n groupMemo.set(id, result)\n return result\n }\n /** A group sits somewhere inside the element. */\n const holdsGroup = (id: string): boolean => {\n const known = belowMemo.get(id)\n if (known !== undefined) return known\n const result = children(id).some((child) => isGroup(child) || holdsGroup(child))\n belowMemo.set(id, result)\n return result\n }\n /** Leads with a picture: its first leaf, down its first children, is one. */\n const leadsWithMedia = (id: string): boolean => {\n let at = id\n for (let depth = 0; depth < 12; depth += 1) {\n if (MEDIA.has(String(node(at)?.componentId ?? ''))) return true\n const kids = children(at)\n if (!kids.length) return false\n at = kids[0]\n }\n return false\n }\n const presetOf = (id: string, group: boolean): AnimationPreset => {\n const media = group ? children(id).every(leadsWithMedia) : leadsWithMedia(id)\n return media ? character.mediaPreset : character.preset\n }\n\n const animate = (id: string, trigger: AnimationTrigger, delayMs: number): void => {\n const group = isGroup(id)\n patches.set(id, {\n [NODE_ANIMATION_PROP]: presetOf(id, group),\n [NODE_ANIMATION_TRIGGER_PROP]: trigger,\n [NODE_ANIMATION_DURATION_PROP]: clamp(character.durationMs, ANIMATION_MAX_DURATION_MS),\n ...(delayMs > 0 ? { [NODE_ANIMATION_DELAY_PROP]: clamp(delayMs, ANIMATION_MAX_DELAY_MS) } : {}),\n [NODE_ANIMATION_EASE_PROP]: character.ease,\n ...(group\n ? {\n [NODE_ANIMATION_STAGGER_PROP]: true,\n [NODE_ANIMATION_STAGGER_STEP_PROP]: clamp(character.staggerStepMs, ANIMATION_MAX_STAGGER_STEP_MS),\n }\n : {}),\n })\n }\n\n /** Down through wrappers of one child, to where a section's content starts. */\n const contentOf = (id: string): string => {\n let at = id\n while (!closed(at) && !isGroup(at)) {\n const kids = children(at)\n if (kids.length !== 1) break\n at = kids[0]\n }\n return at\n }\n\n /** A later section's content: on scroll, groups staggered, nothing nested. */\n const place = (id: string): void => {\n if (closed(id)) return\n if (holds(id) || (!isGroup(id) && holdsGroup(id))) {\n for (const child of children(id)) place(child)\n return\n }\n animate(id, 'scroll', 0)\n }\n\n /** Down through wrappers of one child that are free to move. */\n const descend = (id: string): string => {\n let at = id\n for (let kids = children(at); kids.length === 1 && !closed(kids[0]); kids = children(at)) at = kids[0]\n return at\n }\n\n /**\n * The first section's content: on load, one rung per block, around the\n * blocks that stay still. A rung that holds one is opened up, down to the\n * parts beside it, so the eyebrow, the lede and the buttons still climb.\n */\n const ladder = (id: string): void => {\n if (closed(id)) return\n // A repeat's one child is the card every record is drawn with: the\n // repeat staggers its records rather than each record playing at once.\n if (isGroup(id) && children(id).length < 2) return animate(id, 'load', 0)\n const around = (at: string): string[] =>\n children(at).flatMap((child) => (closed(child) ? [] : holds(child) ? around(child) : [child]))\n const base = children(id).length ? around(id) : [id]\n // A column of words beside a picture is opened up, so its lines climb one\n // after another before the picture lands.\n const rungs: string[] = []\n base.forEach((rung, index) => {\n const inner = descend(rung)\n const kids = children(inner)\n const opens =\n kids.length >= 2 &&\n !isGroup(inner) &&\n !leadsWithMedia(inner) &&\n rungs.length + kids.length + (base.length - index - 1) <= ELEMENT_MOTION_HERO_RUNGS\n rungs.push(...(opens ? kids : [rung]))\n })\n // A rung left alone takes no step of the ladder: the first block that moves starts at once.\n rungs\n .filter((rung) => !closed(rung))\n .forEach((rung, index) => animate(rung, 'load', Math.min(index, ELEMENT_MOTION_HERO_RUNGS - 1) * character.heroStepMs))\n }\n\n /**\n * What the first section paints first, and so what Lighthouse times as its\n * Largest Contentful Paint (AGL-3581): its main heading — the h1, else its\n * first heading — and its largest picture. Neither ever starts at opacity 0,\n * which would hold the paint back by the length of the entrance.\n */\n const markStill = (sectionId: string): void => {\n const order: string[] = []\n const walk = (id: string): void => {\n order.push(id)\n for (const child of children(id)) walk(child)\n }\n walk(sectionId)\n const typeOf = (id: string) => {\n const at = node(id)\n return at?.componentId === 'muiTypography' ? String(at.props?.['variant'] ?? '') : null\n }\n const main = (id: string) => /^(h1|display)/i.test(typeOf(id) ?? '') || (typeOf(id) !== null && node(id)?.props?.['component'] === 'h1')\n const heading = order.find(main) ?? order.find((id) => /^(h[1-6]|display)/i.test(typeOf(id) ?? ''))\n if (heading) still.add(heading)\n const size = (id: string): number => {\n const at = node(id)\n const read = (value: unknown) => (typeof value === 'number' ? value : parseFloat(String(value ?? '')) || 0)\n return Math.max(read(at?.props?.['height']), read(at?.props?.['width']), read(at?.sx?.['height']), read(at?.sx?.['width']))\n }\n let picture: string | undefined\n for (const id of order) {\n if (MEDIA.has(String(node(id)?.componentId ?? '')) && (picture === undefined || size(id) > size(picture))) picture = id\n }\n if (picture) still.add(picture)\n }\n\n const sections = (options.sectionIds ?? children(rootId)).filter((id) => !!node(id))\n if (sections[0]) markStill(sections[0])\n sections.forEach((id, index) => {\n if (closed(id)) return\n const content = contentOf(id)\n // The band itself never moves — only what it holds — so a section that\n // is nothing but its band has nothing to move.\n if (content === id && !children(id).length) return\n if (index === 0) ladder(content)\n else if (content === id && !isGroup(id)) for (const child of children(id)) place(child)\n else place(content)\n })\n\n if (!patches.size) return nodes\n const next: Record<string, any> = { ...nodes }\n for (const [id, props] of patches) {\n next[id] = { ...nodes[id], props: { ...(nodes[id]?.props ?? {}), ...props } }\n }\n return next as T\n}\n"],"names":["CANVAS_ROOT_ELEMENT_ID","ANIMATION_MAX_DELAY_MS","ANIMATION_MAX_DURATION_MS","ANIMATION_MAX_STAGGER_STEP_MS","NODE_ANIMATION_DELAY_PROP","NODE_ANIMATION_DURATION_PROP","NODE_ANIMATION_EASE_PROP","NODE_ANIMATION_PROPS","NODE_ANIMATION_PROP","NODE_ANIMATION_STAGGER_PROP","NODE_ANIMATION_STAGGER_STEP_PROP","NODE_ANIMATION_TRIGGER_PROP","ELEMENT_MOTION_DEFAULT","preset","mediaPreset","ease","durationMs","staggerStepMs","heroStepMs","ELEMENT_MOTION_HERO_RUNGS","ELEMENT_MOTION_NEVER","Set","MEDIA","LISTS","ITEMS","clamp","value","max","Math","min","round","pins","Object","values","some","applyElementMotion","nodes","options","character","rootId","node","id","children","filter","child","patches","Map","still","closed","at","hidden","has","String","componentId","props","prop","undefined","sx","holdsClosed","holds","known","get","set","result","groupMemo","belowMemo","isGroup","kids","length","first","alike","every","holdsGroup","leadsWithMedia","depth","presetOf","group","media","animate","trigger","delayMs","contentOf","place","descend","ladder","around","flatMap","base","rungs","forEach","rung","index","inner","opens","push","markStill","sectionId","order","walk","typeOf","main","test","heading","find","add","size","read","parseFloat","picture","sections","sectionIds","content","next"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,sBAAsB,QAAQ,oCAAgC;AACvE,SACEC,sBAAsB,EACtBC,yBAAyB,EACzBC,6BAA6B,EAC7BC,yBAAyB,EACzBC,4BAA4B,EAC5BC,wBAAwB,EACxBC,oBAAoB,EACpBC,mBAAmB,EACnBC,2BAA2B,EAC3BC,gCAAgC,EAChCC,2BAA2B,QAItB,yBAAqB;AA6D5B,0GAA0G,GAC1G,OAAO,MAAMC,yBAAiD;IAC5DC,QAAQ;IACRC,aAAa;IACbC,MAAM;IACNC,YAAY;IACZC,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AxC4E,IAAI,CAACvE,GAAG,GAAG,aAAKL,KAAK,CAACK,GAAG;YAAEa,OAAO,sBAAMlB,YAAAA,KAAK,CAACK,GAAG,qBAATL,UAAWkB,KAAK,mBAAI,CAAC,GAAOA;;IACtE;IACA,OAAO0D;AACT"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../libs/aglyn/src/lib/app-utils/element-motion.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { CANVAS_ROOT_ELEMENT_ID } from '../foundation/constants/canvas'\nimport {\n ANIMATION_MAX_DELAY_MS,\n ANIMATION_MAX_DURATION_MS,\n ANIMATION_MAX_STAGGER_STEP_MS,\n NODE_ANIMATION_DELAY_PROP,\n NODE_ANIMATION_DURATION_PROP,\n NODE_ANIMATION_EASE_PROP,\n NODE_ANIMATION_PROPS,\n NODE_ANIMATION_PROP,\n NODE_ANIMATION_STAGGER_PROP,\n NODE_ANIMATION_STAGGER_STEP_PROP,\n NODE_ANIMATION_TRIGGER_PROP,\n type AnimationEase,\n type AnimationPreset,\n type AnimationTrigger,\n} from './element-animation'\n\n/**\n * Entrance motion for a whole page (AGL-3838): the pass that writes the\n * existing animation props (`element-animation.ts`) onto a page built by\n * code — a starter, a new site's home, a page the AI composed — so it moves\n * the way an author would have set it up by hand in the attributes panel.\n *\n * Nothing new is rendered or shipped: the pass only writes the reserved\n * `aglynAnimation*` props the renderer and the tenant's stylesheet already\n * read, with values from their own vocabulary. A page that moves pays the\n * stylesheet and the scroll observer it always paid; a page this pass leaves\n * alone pays nothing.\n *\n * ## The rules\n *\n * - The FIRST section's secondary content — its eyebrow, its lede, its\n * buttons, a small picture — plays on `load`, as a short ladder: each\n * block starts {@link ElementMotionCharacter.heroStepMs} after the one\n * before. Its main heading and its largest picture, the candidates for the\n * page's Largest Contentful Paint, never move: they are painted where\n * they stand from the first frame. Its band — a background color or a\n * cover photo — never moves either.\n * - Every later section's content slides in on `scroll`, each section in\n * turn taking the next of the character's {@link\n * ElementMotionCharacter.sectionPresets}, so a page does not arrive as\n * one repeated move.\n * - A split — a column of words beside a picture — comes in from its\n * sides when the character says {@link ElementMotionCharacter.sides}:\n * the left column from the left, the right from the right, the second a\n * stagger step after the first. A picture whose preset zooms keeps its\n * zoom.\n * - A group of like items — a grid of cards, a list, the questions of an\n * FAQ, a dataset repeated over one card — STAGGERS its items, one after\n * another, rather than arriving as one block.\n * - A picture, and a group whose items each lead with one, takes the\n * character's media preset.\n * - Never touched: forms and their fields, navigation and the site's frame,\n * anything out of the flow (`position: fixed | sticky | absolute` — a\n * cover photo's backdrop is its band's), anything hidden, and\n * anything that already carries an animation prop — an author's choice,\n * `none` included, is never overwritten. A block that HOLDS one of those\n * is not animated as a whole either; its other children are animated one\n * by one instead, so a form never slides in with its section.\n * - Never nested: once a block animates, nothing inside it does. Two\n * entrances on the same pixels multiply their fades and add their\n * offsets, which reads as a stutter, not as motion.\n *\n * Pure and idempotent: a page it already moved comes back as the same\n * object, which is what lets a caller compare by identity to skip a write.\n *\n * Leaf imports only, the same as `starter-template-nodes.ts`: the starter\n * kit reads this from the console's client gallery and its seed route alike.\n */\n\n/** A page's motion: the presets, curve and timing every entrance on it shares. */\nexport interface ElementMotionCharacter {\n /** Words and blocks: a section's content, a group of cards. */\n preset: AnimationPreset\n /** A picture, or a group whose every item leads with one. */\n mediaPreset: AnimationPreset\n ease: AnimationEase\n durationMs: number\n /** Gap between the items of a staggered group. */\n staggerStepMs: number\n /** Gap between the rungs of the first section's load ladder. */\n heroStepMs: number\n /**\n * The presets later sections take in turn, the second section the first of\n * them; {@link preset} alone when absent. A section's pictures still take\n * {@link mediaPreset}.\n */\n sectionPresets?: readonly AnimationPreset[]\n /** Whether a split's two columns come in from their own sides. */\n sides?: boolean\n}\n\n/** The motion a page gets when nothing says otherwise: a soft rise, as the attributes panel defaults to. */\nexport const ELEMENT_MOTION_DEFAULT: ElementMotionCharacter = {\n preset: 'slide-up',\n mediaPreset: 'fade',\n ease: 'smooth',\n durationMs: 600,\n staggerStepMs: 90,\n heroStepMs: 120,\n sectionPresets: ['slide-up', 'fade'],\n sides: true,\n}\n\n/** The most rungs the first section's ladder climbs; later blocks share the last. */\nexport const ELEMENT_MOTION_HERO_RUNGS = 6\n\n/**\n * Elements that are never animated, nor animated as part of a block that\n * holds them: forms and every field of one, and the site's navigation and\n * frame. A field that slides in under a visitor's cursor is a field they\n * miss, and a header that moves is a site that looks broken.\n */\nexport const ELEMENT_MOTION_NEVER: ReadonlySet<string> = new Set([\n // Forms and their fields.\n 'form',\n 'formField',\n 'muiFormControl',\n 'muiFormLabel',\n 'muiFormControlLabel',\n 'muiFormHelperText',\n 'muiInput',\n 'muiSelect',\n 'muiSelectOption',\n 'muiRadioGroup',\n 'muiRadio',\n 'muiCheckbox',\n 'muiRating',\n 'muiDatePicker',\n 'muiTimePicker',\n 'newsletter-signup',\n 'member-signin',\n 'member-signup',\n 'member-recovery',\n 'booking',\n 'reservation-widget',\n 'customer-account',\n 'return-request',\n 'order-status',\n 'searchBox',\n 'collectionSearch',\n // Navigation and the site's frame.\n 'layoutSlot',\n 'muiAppBar',\n 'muiToolbar',\n 'muiDrawer',\n 'muiDrawerToggle',\n 'muiNavMenu',\n 'muiMegaMenu',\n 'muiBreadcrumbs',\n 'muiTabs',\n 'languageSwitcher',\n 'themeModeSwitcher',\n 'cart',\n])\n\n/** Pictures: what the media preset is for. */\nconst MEDIA: ReadonlySet<string> = new Set(['image', 'video', 'videoEmbed', 'gated-video'])\n\n/** Components that list like items whatever their children are. */\nconst LISTS: ReadonlySet<string> = new Set(['muiList', 'muiImageList', 'collectionEntries'])\n\n/**\n * What a group's items are made of when they are alike: cards, cells,\n * panels, pictures. Words and buttons never count, however alike — a row of\n * two buttons is a call to action, not a group of cards.\n */\nconst ITEMS: ReadonlySet<string> = new Set([\n 'muiCard',\n 'muiPaper',\n 'muiGrid',\n 'muiStack',\n 'muiBox',\n 'muiLinkBox',\n 'muiListItem',\n 'muiImageListItem',\n 'muiAccordion',\n 'reusableInstance',\n 'div',\n 'image',\n 'video',\n])\n\ninterface MotionNode {\n componentId?: string\n props?: Record<string, unknown>\n sx?: Record<string, unknown>\n nodes?: string[]\n hidden?: boolean\n}\n\nexport interface ElementMotionOptions {\n /** The page's root; the canvas root when absent. */\n rootId?: string\n /** The page's sections in order; the root's own children when absent. */\n sectionIds?: readonly string[]\n character?: ElementMotionCharacter\n}\n\nconst clamp = (value: number, max: number): number => Math.min(Math.max(Math.round(value), 0), max)\n\n/**\n * Whether a style value — plain or one per breakpoint — takes the element out\n * of the flow: pinned to the screen, or laid over its band, as a cover\n * photo's backdrop and its scrim are. Either is part of the band, not of what\n * the band holds.\n */\nfunction pins(value: unknown): boolean {\n if (value === 'fixed' || value === 'sticky' || value === 'absolute') return true\n return typeof value === 'object' && value !== null && Object.values(value).some(pins)\n}\n\n/**\n * Writes entrance motion onto a page's nodes by the rules above, and returns\n * the new node map — or `nodes` itself, unchanged, when there was nothing to\n * move.\n */\nexport function applyElementMotion<T extends Record<string, any>>(nodes: T, options: ElementMotionOptions = {}): T {\n if (!nodes) return nodes\n const character = options.character ?? ELEMENT_MOTION_DEFAULT\n const rootId = options.rootId ?? CANVAS_ROOT_ELEMENT_ID\n const node = (id: string): MotionNode | undefined => nodes[id] as MotionNode | undefined\n const children = (id: string): string[] => (node(id)?.nodes ?? []).filter((child) => typeof child === 'string' && !!node(child))\n const patches = new Map<string, Record<string, unknown>>()\n\n /** The first section's Largest Contentful Paint candidates, painted where they stand. */\n const still = new Set<string>()\n /** Left alone, and so is everything inside it. */\n const closed = (id: string): boolean => {\n const at = node(id)\n if (!at) return true\n if (at.hidden || still.has(id)) return true\n if (ELEMENT_MOTION_NEVER.has(String(at.componentId ?? ''))) return true\n if (at.props && NODE_ANIMATION_PROPS.some((prop) => at.props?.[prop] !== undefined)) return true\n return pins(at.sx?.['position'])\n }\n const holdsClosed = new Map<string, boolean>()\n /** The element, or one inside it, is left alone: it cannot move as one block. */\n const holds = (id: string): boolean => {\n const known = holdsClosed.get(id)\n if (known !== undefined) return known\n holdsClosed.set(id, false)\n const result = closed(id) || children(id).some(holds)\n holdsClosed.set(id, result)\n return result\n }\n const groupMemo = new Map<string, boolean>()\n const belowMemo = new Map<string, boolean>()\n /**\n * A group of like items, whose items stagger. A grid or a row of panels\n * that holds a group of its own is the LAYOUT around it — a heading beside\n * its cards — so it is opened up and the group inside staggers instead.\n */\n const isGroup = (id: string): boolean => {\n const known = groupMemo.get(id)\n if (known !== undefined) return known\n const at = node(id) as MotionNode\n const componentId = String(at.componentId ?? '')\n const kids = children(id)\n let result: boolean\n // A dataset repeated over one card renders one child per record.\n if ((at.props?.['repeatDataset'] || LISTS.has(componentId)) && kids.length) result = true\n else if (kids.length < 2) result = false\n else {\n const first = String(node(kids[0])?.componentId ?? '')\n const alike =\n (componentId === 'muiGrid' && !!at.props?.['container']) ||\n (ITEMS.has(first) && kids.every((child) => node(child)?.componentId === first))\n result = alike && !holdsGroup(id)\n }\n groupMemo.set(id, result)\n return result\n }\n /** A group sits somewhere inside the element. */\n const holdsGroup = (id: string): boolean => {\n const known = belowMemo.get(id)\n if (known !== undefined) return known\n const result = children(id).some((child) => isGroup(child) || holdsGroup(child))\n belowMemo.set(id, result)\n return result\n }\n /** Leads with a picture: its first leaf, down its first children, is one. */\n const leadsWithMedia = (id: string): boolean => {\n let at = id\n for (let depth = 0; depth < 12; depth += 1) {\n if (MEDIA.has(String(node(at)?.componentId ?? ''))) return true\n const kids = children(at)\n if (!kids.length) return false\n at = kids[0]\n }\n return false\n }\n const presetOf = (id: string, group: boolean, words: AnimationPreset): AnimationPreset => {\n const media = group ? children(id).every(leadsWithMedia) : leadsWithMedia(id)\n return media ? character.mediaPreset : words\n }\n\n const animate = (\n id: string,\n trigger: AnimationTrigger,\n delayMs: number,\n words: AnimationPreset = character.preset,\n side?: AnimationPreset,\n ): void => {\n const group = isGroup(id)\n const preset = presetOf(id, group, words)\n patches.set(id, {\n [NODE_ANIMATION_PROP]: side && !preset.startsWith('zoom') ? side : preset,\n [NODE_ANIMATION_TRIGGER_PROP]: trigger,\n [NODE_ANIMATION_DURATION_PROP]: clamp(character.durationMs, ANIMATION_MAX_DURATION_MS),\n ...(delayMs > 0 ? { [NODE_ANIMATION_DELAY_PROP]: clamp(delayMs, ANIMATION_MAX_DELAY_MS) } : {}),\n [NODE_ANIMATION_EASE_PROP]: character.ease,\n ...(group\n ? {\n [NODE_ANIMATION_STAGGER_PROP]: true,\n [NODE_ANIMATION_STAGGER_STEP_PROP]: clamp(character.staggerStepMs, ANIMATION_MAX_STAGGER_STEP_MS),\n }\n : {}),\n })\n }\n\n /** Down through wrappers of one child, to where a section's content starts. */\n const contentOf = (id: string): string => {\n let at = id\n while (!closed(at) && !isGroup(at)) {\n const kids = children(at)\n if (kids.length !== 1) break\n at = kids[0]\n }\n return at\n }\n\n /**\n * A column of words beside a picture: two blocks, one of which leads with a\n * picture and one of which does not, neither left alone. Two cards that\n * both lead with one are a group, and stagger.\n */\n const isSplit = (id: string): boolean => {\n const kids = children(id)\n return kids.length === 2 && leadsWithMedia(kids[0]) !== leadsWithMedia(kids[1]) && !kids.some(holds)\n }\n\n /** A later section's content: on scroll, groups staggered, splits from their sides, nothing nested. */\n const place = (id: string, words: AnimationPreset): void => {\n if (closed(id)) return\n if (character.sides && isSplit(id)) {\n const [start, end] = children(id)\n animate(start, 'scroll', 0, words, 'slide-right')\n animate(end, 'scroll', character.staggerStepMs, words, 'slide-left')\n return\n }\n if (holds(id) || (!isGroup(id) && holdsGroup(id))) {\n for (const child of children(id)) place(child, words)\n return\n }\n animate(id, 'scroll', 0, words)\n }\n\n /** Down through wrappers of one child that are free to move. */\n const descend = (id: string): string => {\n let at = id\n for (let kids = children(at); kids.length === 1 && !closed(kids[0]); kids = children(at)) at = kids[0]\n return at\n }\n\n /**\n * The first section's content: on load, one rung per block, around the\n * blocks that stay still. A rung that holds one is opened up, down to the\n * parts beside it, so the eyebrow, the lede and the buttons still climb.\n */\n const ladder = (id: string): void => {\n if (closed(id)) return\n // A repeat's one child is the card every record is drawn with: the\n // repeat staggers its records rather than each record playing at once.\n if (isGroup(id) && children(id).length < 2) return animate(id, 'load', 0)\n const around = (at: string): string[] =>\n children(at).flatMap((child) => (closed(child) ? [] : holds(child) ? around(child) : [child]))\n const base = children(id).length ? around(id) : [id]\n // A column of words beside a picture is opened up, so its lines climb one\n // after another before the picture lands.\n const rungs: string[] = []\n base.forEach((rung, index) => {\n const inner = descend(rung)\n const kids = children(inner)\n const opens =\n kids.length >= 2 &&\n !isGroup(inner) &&\n !leadsWithMedia(inner) &&\n rungs.length + kids.length + (base.length - index - 1) <= ELEMENT_MOTION_HERO_RUNGS\n rungs.push(...(opens ? kids : [rung]))\n })\n // A rung left alone takes no step of the ladder: the first block that moves starts at once.\n rungs\n .filter((rung) => !closed(rung))\n .forEach((rung, index) => animate(rung, 'load', Math.min(index, ELEMENT_MOTION_HERO_RUNGS - 1) * character.heroStepMs))\n }\n\n /**\n * What the first section paints first, and so what Lighthouse times as its\n * Largest Contentful Paint (AGL-3581): its main heading — the h1, else its\n * first heading — and its largest picture. Neither ever starts at opacity 0,\n * which would hold the paint back by the length of the entrance.\n */\n const markStill = (sectionId: string): void => {\n const order: string[] = []\n const walk = (id: string): void => {\n order.push(id)\n for (const child of children(id)) walk(child)\n }\n walk(sectionId)\n const typeOf = (id: string) => {\n const at = node(id)\n return at?.componentId === 'muiTypography' ? String(at.props?.['variant'] ?? '') : null\n }\n const main = (id: string) => /^(h1|display)/i.test(typeOf(id) ?? '') || (typeOf(id) !== null && node(id)?.props?.['component'] === 'h1')\n const heading = order.find(main) ?? order.find((id) => /^(h[1-6]|display)/i.test(typeOf(id) ?? ''))\n if (heading) still.add(heading)\n const size = (id: string): number => {\n const at = node(id)\n const read = (value: unknown) => (typeof value === 'number' ? value : parseFloat(String(value ?? '')) || 0)\n return Math.max(read(at?.props?.['height']), read(at?.props?.['width']), read(at?.sx?.['height']), read(at?.sx?.['width']))\n }\n let picture: string | undefined\n for (const id of order) {\n if (MEDIA.has(String(node(id)?.componentId ?? '')) && (picture === undefined || size(id) > size(picture))) picture = id\n }\n if (picture) still.add(picture)\n }\n\n const sections = (options.sectionIds ?? children(rootId)).filter((id) => !!node(id))\n if (sections[0]) markStill(sections[0])\n const turns = character.sectionPresets?.length ? character.sectionPresets : [character.preset]\n sections.forEach((id, index) => {\n if (closed(id)) return\n const content = contentOf(id)\n // The band itself never moves — only what it holds — so a section that\n // is nothing but its band has nothing to move.\n if (content === id && !children(id).length) return\n const words = turns[(index - 1) % turns.length] ?? character.preset\n if (index === 0) ladder(content)\n else if (content === id && !isGroup(id) && !(character.sides && isSplit(id)))\n for (const child of children(id)) place(child, words)\n else place(content, words)\n })\n\n if (!patches.size) return nodes\n const next: Record<string, any> = { ...nodes }\n for (const [id, props] of patches) {\n next[id] = { ...nodes[id], props: { ...(nodes[id]?.props ?? {}), ...props } }\n }\n return next as T\n}\n"],"names":["CANVAS_ROOT_ELEMENT_ID","ANIMATION_MAX_DELAY_MS","ANIMATION_MAX_DURATION_MS","ANIMATION_MAX_STAGGER_STEP_MS","NODE_ANIMATION_DELAY_PROP","NODE_ANIMATION_DURATION_PROP","NODE_ANIMATION_EASE_PROP","NODE_ANIMATION_PROPS","NODE_ANIMATION_PROP","NODE_ANIMATION_STAGGER_PROP","NODE_ANIMATION_STAGGER_STEP_PROP","NODE_ANIMATION_TRIGGER_PROP","ELEMENT_MOTION_DEFAULT","preset","mediaPreset","ease","durationMs","staggerStepMs","heroStepMs","sectionPresets","sides","ELEMENT_MOTION_HERO_RUNGS","ELEMENT_MOTION_NEVER","Set","MEDIA","LISTS","ITEMS","clamp","value","max","Math","min","round","pins","Object","values","some","applyElementMotion","nodes","options","character","rootId","node","id","children","filter","child","patches","Map","still","closed","at","hidden","has","String","componentId","props","prop","undefined","sx","holdsClosed","holds","known","get","set","result","groupMemo","belowMemo","isGroup","kids","length","first","alike","every","holdsGroup","leadsWithMedia","depth","presetOf","group","words","media","animate","trigger","delayMs","side","startsWith","contentOf","isSplit","place","start","end","descend","ladder","around","flatMap","base","rungs","forEach","rung","index","inner","opens","push","markStill","sectionId","order","walk","typeOf","main","test","heading","find","add","size","read","parseFloat","picture","sections","sectionIds","turns","content","next"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,sBAAsB,QAAQ,oCAAgC;AACvE,SACEC,sBAAsB,EACtBC,yBAAyB,EACzBC,6BAA6B,EAC7BC,yBAAyB,EACzBC,4BAA4B,EAC5BC,wBAAwB,EACxBC,oBAAoB,EACpBC,mBAAmB,EACnBC,2BAA2B,EAC3BC,gCAAgC,EAChCC,2BAA2B,QAItB,yBAAqB;AA6E5B,0GAA0G,GAC1G,OAAO,MAAMC,yBAAiD;IAC5DC,QAAQ;IACRC,aAAa;IACbC,MAAM;IACNC,YAAY;IACZC,eAAe;IACfC,YAAY;IACZC,gBAAgB;QAAC;QAAY;KAAO;IACpCC,OAAO;AACT,EAAC;AAED,mFAAmF,GACnF,OAAO,MAAMC,4BAA4B,EAAC;AAE1C;;;;;CAKC,GACD,OAAO,MAAMC,uBAA4C,IAAIC,IAAI;IAC/D,0BAA0B;IAC1B;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,mCAAmC;IACnC;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD,EAAC;AAEF,4CAA4C,GAC5C,MAAMC,QAA6B,IAAID,IAAI;IAA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C5C,MAAMS,SAAQwC,UAAAA,KAAK,CAAC,AAACpB,CAAAA,QAAQ,CAAA,IAAKoB,MAAMjD,MAAM,CAAC,YAAjCiD,UAAqC/E,UAAU3B,MAAM;QACnE,IAAIsF,UAAU,GAAGP,OAAO4B;aACnB,IAAIA,YAAY7E,MAAM,CAACyB,QAAQzB,OAAO,CAAEH,CAAAA,UAAUpB,KAAK,IAAImE,QAAQ5C,GAAE,GACxE,KAAK,MAAMG,SAASF,SAASD,IAAK6C,MAAM1C,OAAOiC;aAC5CS,MAAMgC,SAASzC;IACtB;IAEA,IAAI,CAAChC,QAAQkE,IAAI,EAAE,OAAO3E;IAC1B,MAAMmF,OAA4B,aAAKnF;IACvC,KAAK,MAAM,CAACK,IAAIa,MAAM,IAAIT,QAAS;;YACOT;QAAxCmF,IAAI,CAAC9E,GAAG,GAAG,aAAKL,KAAK,CAACK,GAAG;YAAEa,OAAO,sBAAMlB,YAAAA,KAAK,CAACK,GAAG,qBAATL,UAAWkB,KAAK,mBAAI,CAAC,GAAOA;;IACtE;IACA,OAAOiE;AACT"}
|
|
@@ -202,7 +202,7 @@ export declare const DIGEST_PREFS_FIELD = "digestPrefs";
|
|
|
202
202
|
* stored under it.
|
|
203
203
|
*/
|
|
204
204
|
export interface NotificationDigestDeclaration {
|
|
205
|
-
/** The plugin that composes and sends it. */
|
|
205
|
+
/** The plugin that composes and sends it; `core` for the platform's own. */
|
|
206
206
|
pluginId: string;
|
|
207
207
|
/** The key its switch is stored under in {@link DIGEST_PREFS_FIELD}. */
|
|
208
208
|
key: string;
|
|
@@ -334,15 +334,19 @@ export declare const NOTIFICATION_CHANNEL_DEFAULTS: Readonly<Record<Notification
|
|
|
334
334
|
console: boolean;
|
|
335
335
|
}>>;
|
|
336
336
|
/**
|
|
337
|
-
* The types whose default differs from their category's:
|
|
338
|
-
*
|
|
339
|
-
* the people who run it unless they said otherwise.
|
|
337
|
+
* The types whose default differs from their category's: each emails its
|
|
338
|
+
* recipients unless they said otherwise.
|
|
340
339
|
*
|
|
341
340
|
* Below every stored answer, the category's included, so a person who
|
|
342
341
|
* switched content email off keeps it off; above the category default, so
|
|
343
342
|
* everyone who never answered (every account, new or old) is emailed.
|
|
344
|
-
*
|
|
345
|
-
*
|
|
343
|
+
*
|
|
344
|
+
* What is here is what somebody misses by hearing about it only in the
|
|
345
|
+
* console: a site's own transactions, work handed to them, their AI jobs,
|
|
346
|
+
* their bill, a reply or a verdict they are waiting on, an announcement, and
|
|
347
|
+
* every notice that something STOPPED or needs a person now. A type that
|
|
348
|
+
* already mails its own message stays out of the channel's way either way —
|
|
349
|
+
* see {@link NOTIFICATION_SELF_SENT_EMAIL_TYPES} and the `skipEmail` callers.
|
|
346
350
|
*/
|
|
347
351
|
export declare const NOTIFICATION_TYPE_CHANNEL_DEFAULTS: Partial<Record<AglynNotificationType, Partial<Record<NotificationChannel, boolean>>>>;
|
|
348
352
|
/** What a type does on a channel when nobody has answered for it or its category. */
|
|
@@ -260,7 +260,23 @@ export const NOTIFICATION_CATEGORY_DESCRIPTIONS = inCategoryOrder(CORE_CATEGORY_
|
|
|
260
260
|
* digest is a schedule a person keeps or drops, not a bucket of types, and one
|
|
261
261
|
* switch governs both the console notification and the email it travels with.
|
|
262
262
|
*/ export const DIGEST_PREFS_FIELD = 'digestPrefs';
|
|
263
|
-
/**
|
|
263
|
+
/**
|
|
264
|
+
* The platform's own digests, listed before any plugin's. The Weekly summary
|
|
265
|
+
* (AGL-3867) is the core's because it reads every plugin's figures and
|
|
266
|
+
* belongs to none of them; its key is the one
|
|
267
|
+
* `@aglyn/tenant-data-admin/server/weekly-summary` reads.
|
|
268
|
+
*/ const CORE_NOTIFICATION_DIGESTS = [
|
|
269
|
+
{
|
|
270
|
+
pluginId: 'core',
|
|
271
|
+
key: 'weeklySummary',
|
|
272
|
+
label: 'Weekly summary',
|
|
273
|
+
description: 'Each Monday by email, for the workspaces you own or manage: last week’s visitors, top pages, ' + 'form submissions, new leads, bookings, sales and deals. Free, and nothing is generated.'
|
|
274
|
+
}
|
|
275
|
+
];
|
|
276
|
+
/** Every declared digest, in the order the settings page lists them. */ export const NOTIFICATION_DIGESTS = [
|
|
277
|
+
...CORE_NOTIFICATION_DIGESTS,
|
|
278
|
+
...PLUGIN_NOTIFICATION_DIGESTS_DECLARED
|
|
279
|
+
];
|
|
264
280
|
/**
|
|
265
281
|
* Whether a person keeps one digest: on unless its key is stored `false`. It
|
|
266
282
|
* reads only its own key — a category mute lives in a different map and does
|
|
@@ -284,9 +300,9 @@ export const NOTIFICATION_SETTINGS_FIELD = 'notificationSettings';
|
|
|
284
300
|
/**
|
|
285
301
|
* What a category does when nobody has said otherwise.
|
|
286
302
|
*
|
|
287
|
-
* Console on, email OFF, for every category
|
|
288
|
-
* the exception, by type, in
|
|
289
|
-
* Email defaults off because the inbox is
|
|
303
|
+
* Console on, email OFF, for every category. The types a person needs to hear
|
|
304
|
+
* about without opening the console are the exception, by type, in
|
|
305
|
+
* {@link NOTIFICATION_TYPE_CHANNEL_DEFAULTS}. Email defaults off because the inbox is
|
|
290
306
|
* not ours to fill: the product already sends transactional mail nobody opted
|
|
291
307
|
* into — welcome, verification, invites, dunning, usage alerts — and every one
|
|
292
308
|
* of those leaves on the same domain a customer's password reset depends on.
|
|
@@ -330,16 +346,21 @@ export const NOTIFICATION_SETTINGS_FIELD = 'notificationSettings';
|
|
|
330
346
|
};
|
|
331
347
|
export const NOTIFICATION_CHANNEL_DEFAULTS = inCategoryOrder(CORE_CHANNEL_DEFAULTS, (declaration)=>_extends({}, declaration.defaults));
|
|
332
348
|
/**
|
|
333
|
-
* The types whose default differs from their category's:
|
|
334
|
-
*
|
|
335
|
-
* the people who run it unless they said otherwise.
|
|
349
|
+
* The types whose default differs from their category's: each emails its
|
|
350
|
+
* recipients unless they said otherwise.
|
|
336
351
|
*
|
|
337
352
|
* Below every stored answer, the category's included, so a person who
|
|
338
353
|
* switched content email off keeps it off; above the category default, so
|
|
339
354
|
* everyone who never answered (every account, new or old) is emailed.
|
|
340
|
-
*
|
|
341
|
-
*
|
|
355
|
+
*
|
|
356
|
+
* What is here is what somebody misses by hearing about it only in the
|
|
357
|
+
* console: a site's own transactions, work handed to them, their AI jobs,
|
|
358
|
+
* their bill, a reply or a verdict they are waiting on, an announcement, and
|
|
359
|
+
* every notice that something STOPPED or needs a person now. A type that
|
|
360
|
+
* already mails its own message stays out of the channel's way either way —
|
|
361
|
+
* see {@link NOTIFICATION_SELF_SENT_EMAIL_TYPES} and the `skipEmail` callers.
|
|
342
362
|
*/ export const NOTIFICATION_TYPE_CHANNEL_DEFAULTS = {
|
|
363
|
+
// A site's own transactions (AGL-3600).
|
|
343
364
|
'content.formSubmission': {
|
|
344
365
|
email: true
|
|
345
366
|
},
|
|
@@ -348,6 +369,78 @@ export const NOTIFICATION_CHANNEL_DEFAULTS = inCategoryOrder(CORE_CHANNEL_DEFAUL
|
|
|
348
369
|
},
|
|
349
370
|
'content.order': {
|
|
350
371
|
email: true
|
|
372
|
+
},
|
|
373
|
+
// Work handed to one person, and the AI jobs they started.
|
|
374
|
+
'content.taskAssigned': {
|
|
375
|
+
email: true
|
|
376
|
+
},
|
|
377
|
+
'content.contactAssigned': {
|
|
378
|
+
email: true
|
|
379
|
+
},
|
|
380
|
+
'content.leadAssigned': {
|
|
381
|
+
email: true
|
|
382
|
+
},
|
|
383
|
+
'content.aiJobNeedsYou': {
|
|
384
|
+
email: true
|
|
385
|
+
},
|
|
386
|
+
'content.aiJobDone': {
|
|
387
|
+
email: true
|
|
388
|
+
},
|
|
389
|
+
'content.aiJobFailed': {
|
|
390
|
+
email: true
|
|
391
|
+
},
|
|
392
|
+
// The workspace's bill. A usage crossing sends its own email and passes
|
|
393
|
+
// `skipEmail`, so this default never mails it twice.
|
|
394
|
+
'billing.invoice': {
|
|
395
|
+
email: true
|
|
396
|
+
},
|
|
397
|
+
'billing.paymentFailed': {
|
|
398
|
+
email: true
|
|
399
|
+
},
|
|
400
|
+
'billing.subscriptionCanceled': {
|
|
401
|
+
email: true
|
|
402
|
+
},
|
|
403
|
+
'billing.usage': {
|
|
404
|
+
email: true
|
|
405
|
+
},
|
|
406
|
+
// An answer somebody is waiting on.
|
|
407
|
+
'marketplace.review': {
|
|
408
|
+
email: true
|
|
409
|
+
},
|
|
410
|
+
'support.ticketReply': {
|
|
411
|
+
email: true
|
|
412
|
+
},
|
|
413
|
+
'system.announcement': {
|
|
414
|
+
email: true
|
|
415
|
+
},
|
|
416
|
+
// Something stopped, or needs a person now.
|
|
417
|
+
'system.formSubmissionsPaused': {
|
|
418
|
+
email: true
|
|
419
|
+
},
|
|
420
|
+
'system.visitorRecordsPaused': {
|
|
421
|
+
email: true
|
|
422
|
+
},
|
|
423
|
+
'system.abuseReportUrgent': {
|
|
424
|
+
email: true
|
|
425
|
+
},
|
|
426
|
+
'system.riskNotice': {
|
|
427
|
+
email: true
|
|
428
|
+
},
|
|
429
|
+
'system.dmcaCounterNotice': {
|
|
430
|
+
email: true
|
|
431
|
+
},
|
|
432
|
+
'system.bandwidthCeilingTripped': {
|
|
433
|
+
email: true
|
|
434
|
+
},
|
|
435
|
+
'system.billingWebhookHalfApplied': {
|
|
436
|
+
email: true
|
|
437
|
+
},
|
|
438
|
+
'system.disputeUnattributed': {
|
|
439
|
+
email: true
|
|
440
|
+
},
|
|
441
|
+
// Staff hear when somebody starts building.
|
|
442
|
+
'staff.siteCreated': {
|
|
443
|
+
email: true
|
|
351
444
|
}
|
|
352
445
|
};
|
|
353
446
|
/** What a type does on a channel when nobody has answered for it or its category. */ export function notificationTypeChannelDefault(type, channel) {
|