@vectoriox/iox-ui 5.35.0 → 5.36.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.
@@ -105,6 +105,896 @@ function removeFromComposite(root, node) {
105
105
  return true;
106
106
  }
107
107
 
108
+ /**
109
+ * ACCORDION (CC2 — composite K1; complex-components boards 3, 4 and 9, APPROVED 2026-10-20). Not a
110
+ * component: a recipe of ordinary nodes, each part carrying a role, so every part is selectable on the
111
+ * canvas, in the layer tree and the breadcrumb, and wears its own element style (R2).
112
+ *
113
+ * Container `box` role accordion traits multiple · defaultOn (Manual)
114
+ * — or a Repeater bound to a list role accordion ONE template item (From content, R3)
115
+ * └─ Container `accordion-item` role accordion.item itemKey k1 … (Manual) · the row's id (From content)
116
+ * ├─ LinkedContainer `accordion-trigger` role accordion.trigger → <hN><button> (the question's level)
117
+ * │ ├─ Heading `h3` the question (rendered as phrasing inside the button)
118
+ * │ └─ Icon `icon` role accordion.icon Item open → rotate
119
+ * └─ Container `accordion-panel` role accordion.panel inside a hidden="until-found" region
120
+ * └─ Text `body` the answer
121
+ *
122
+ * The behaviour is BUILT IN (composite plan D1 = B): which items are open is one state machine
123
+ * (`nextAccordionState`), the ARIA and DOM state one planner (`accordionItemState` and the attribute
124
+ * functions), the keyboard one key map — read by the builder canvas, both engine paths and the composer.
125
+ */
126
+ var AccordionRole;
127
+ (function (AccordionRole) {
128
+ AccordionRole["Accordion"] = "accordion";
129
+ AccordionRole["Item"] = "accordion.item";
130
+ AccordionRole["Trigger"] = "accordion.trigger";
131
+ AccordionRole["Icon"] = "accordion.icon";
132
+ AccordionRole["Panel"] = "accordion.panel";
133
+ })(AccordionRole || (AccordionRole = {}));
134
+ /** The behaviour options a composite root stores as ordinary TRAITS (composite plan §3). */
135
+ var CompositeBehaviourTrait;
136
+ (function (CompositeBehaviourTrait) {
137
+ /** Several items may be open at once ("Allow several open"). */
138
+ CompositeBehaviourTrait["Multiple"] = "multiple";
139
+ /** Which items open by default: first · none · all. */
140
+ CompositeBehaviourTrait["DefaultOn"] = "defaultOn";
141
+ })(CompositeBehaviourTrait || (CompositeBehaviourTrait = {}));
142
+ var AccordionDefaultOn;
143
+ (function (AccordionDefaultOn) {
144
+ AccordionDefaultOn["First"] = "first";
145
+ AccordionDefaultOn["None"] = "none";
146
+ AccordionDefaultOn["All"] = "all";
147
+ })(AccordionDefaultOn || (AccordionDefaultOn = {}));
148
+ const ACCORDION_DEFAULT_ONS = [AccordionDefaultOn.First, AccordionDefaultOn.None, AccordionDefaultOn.All];
149
+ /** Behaviour ▸ Icon — a preset over the items' icons, never a stored trait (detected from the icons). */
150
+ var AccordionIcon;
151
+ (function (AccordionIcon) {
152
+ AccordionIcon["Chevron"] = "chevron";
153
+ AccordionIcon["Plus"] = "plus";
154
+ AccordionIcon["None"] = "none";
155
+ })(AccordionIcon || (AccordionIcon = {}));
156
+ const ACCORDION_ICONS = [AccordionIcon.Chevron, AccordionIcon.Plus, AccordionIcon.None];
157
+ /** Each icon's glyph and how far it turns when its item opens (board 4: a chevron flips, a plus becomes ×). */
158
+ const ACCORDION_ICON_GLYPH = {
159
+ [AccordionIcon.Chevron]: { iconClass: 'ph ph-caret-down', turn: '180deg' },
160
+ [AccordionIcon.Plus]: { iconClass: 'ph ph-plus', turn: '45deg' },
161
+ };
162
+ /** The item-open style state (a part INSIDE an item, styled by its item being open — board 9 "Item open"). */
163
+ const ITEM_OPEN_STATE = 'trigger-on';
164
+ /** A part that IS on (an item, its header, its panel — board 9 "Open"). */
165
+ const ON_STATE = 'on';
166
+ /** Items from content default to twenty rows (board 9 Q13). */
167
+ const ACCORDION_CONTENT_LIMIT = 20;
168
+ /** The words a fresh accordion starts with — generic, the author's to replace (as Card v2's are). */
169
+ const ACCORDION_WORDS = [
170
+ { question: 'Write the first question people ask', answer: 'Answer it plainly, in two or three short sentences.' },
171
+ { question: 'Write the second question', answer: 'Answer it plainly, in two or three short sentences.' },
172
+ { question: 'Write the third question', answer: 'Answer it plainly, in two or three short sentences.' },
173
+ ];
174
+ const ACCORDION_NEW_ITEM_WORDS = { question: 'Write a new question', answer: 'Answer it plainly, in two or three short sentences.' };
175
+ var Type$1;
176
+ (function (Type) {
177
+ Type["Container"] = "Container";
178
+ Type["LinkedContainer"] = "LinkedContainer";
179
+ Type["Heading"] = "Heading";
180
+ Type["Text"] = "Text";
181
+ Type["Icon"] = "Icon";
182
+ Type["Repeater"] = "Repeater";
183
+ })(Type$1 || (Type$1 = {}));
184
+ var Style$1;
185
+ (function (Style) {
186
+ Style["Root"] = "box";
187
+ Style["Item"] = "accordion-item";
188
+ Style["Trigger"] = "accordion-trigger";
189
+ Style["Question"] = "h3";
190
+ Style["Icon"] = "icon";
191
+ Style["Panel"] = "accordion-panel";
192
+ Style["Answer"] = "body";
193
+ })(Style$1 || (Style$1 = {}));
194
+ const ZERO_BOX$1 = '0px 0px 0px 0px';
195
+ const HEADING_LEVELS = ['h2', 'h3', 'h4', 'h5', 'h6'];
196
+ const DEFAULT_LEVEL = 'h3';
197
+ /** A linked trait the header must never carry: it is a button, not a link. */
198
+ const LINK_TYPE$1 = 'linkType';
199
+ /** What each part holds in the recipe — layout only; its LOOK is its element style. */
200
+ const PART_BASE = {
201
+ // The items are a column a token apart (`accordion-gap`: 0 for a divider list, 12px for cards).
202
+ [AccordionRole.Accordion]: { display: 'flex', flexDirection: 'column', gap: 'var(--iox-accordion-gap)', width: '100%', minHeight: 'auto', height: 'auto' },
203
+ [AccordionRole.Item]: { display: 'block', width: '100%', minHeight: 'auto', height: 'auto' },
204
+ // The header is the whole row: the question takes the line, the icon sits at its end (board 4).
205
+ [AccordionRole.Trigger]: { display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: '16px', width: '100%', minHeight: 'auto', height: 'auto', textAlign: 'start', cursor: 'pointer' },
206
+ [AccordionRole.Icon]: { flexShrink: '0', fontSize: '22px', transitionDuration: 'var(--iox-dur-base)', transitionTimingFunction: 'var(--iox-ease-standard)' },
207
+ [AccordionRole.Panel]: { display: 'block', width: '100%', minHeight: 'auto', height: 'auto' },
208
+ };
209
+ /** The question INHERITS the header's ink (board 4's wears table: the Question reads no colour token), so the
210
+ * header's hover ink reaches the words; and it sits in the row with no margin of its own. */
211
+ const QUESTION_BASE = { color: 'inherit', margin: ZERO_BOX$1, flexGrow: '1', minWidth: '0px' };
212
+ const ANSWER_BASE = { margin: ZERO_BOX$1, padding: ZERO_BOX$1, minHeight: 'auto' };
213
+ function make$1(create, key, type, role, style, props = {}, label) {
214
+ const node = create({ key, type, props, elementStyle: style });
215
+ if (role)
216
+ node.role = role;
217
+ if (label)
218
+ node.label = label;
219
+ if (role && PART_BASE[role])
220
+ writeStyles(node, PART_BASE[role]);
221
+ return node;
222
+ }
223
+ /** The item's icon; its Item-open state (the turn) is driven by ITS item (`stateTriggers`). */
224
+ function buildIcon(create, key, icon, itemId) {
225
+ const glyph = ACCORDION_ICON_GLYPH[icon];
226
+ const node = make$1(create, key, Type$1.Icon, AccordionRole.Icon, Style$1.Icon, { iconClass: glyph.iconClass }, 'Icon');
227
+ node.stateStyles = { ...(node.stateStyles ?? {}), [ITEM_OPEN_STATE]: { rotate: glyph.turn } };
228
+ if (itemId)
229
+ node.stateTriggers = { ...(node.stateTriggers ?? {}), [ITEM_OPEN_STATE]: itemId };
230
+ return node;
231
+ }
232
+ /** One item: header (question + icon) and panel (answer). `key` makes every part's recipe key unique. */
233
+ function buildAccordionItem(create, words, itemKey, icon = AccordionIcon.Chevron) {
234
+ const item = make$1(create, `${itemKey}`, Type$1.Container, AccordionRole.Item, Style$1.Item, {}, 'Item');
235
+ item.itemKey = itemKey;
236
+ const trigger = make$1(create, `${itemKey}-trigger`, Type$1.LinkedContainer, AccordionRole.Trigger, Style$1.Trigger, {}, 'Header');
237
+ const question = make$1(create, `${itemKey}-question`, Type$1.Heading, null, Style$1.Question, { content: words.question, level: DEFAULT_LEVEL }, 'Heading');
238
+ writeStyles(question, QUESTION_BASE);
239
+ trigger.children = [question, ...(icon === AccordionIcon.None ? [] : [buildIcon(create, `${itemKey}-icon`, icon, item.id)])];
240
+ const panel = make$1(create, `${itemKey}-panel`, Type$1.Container, AccordionRole.Panel, Style$1.Panel, {}, 'Panel');
241
+ const answer = make$1(create, `${itemKey}-answer`, Type$1.Text, null, Style$1.Answer, { content: words.answer, tag: 'p' }, 'Text');
242
+ writeStyles(answer, ANSWER_BASE);
243
+ panel.children = [answer];
244
+ item.children = [trigger, panel];
245
+ return item;
246
+ }
247
+ /** A fresh Accordion: three items, one open at a time, the first open by default (board 4). */
248
+ function buildAccordionRecipe(create, options = {}) {
249
+ const root = make$1(create, 'accordion', Type$1.Container, AccordionRole.Accordion, Style$1.Root, {}, 'Accordion');
250
+ writeProp(root, CompositeBehaviourTrait.Multiple, options.multiple ?? false);
251
+ writeProp(root, CompositeBehaviourTrait.DefaultOn, options.defaultOn ?? AccordionDefaultOn.First);
252
+ const words = options.items ?? ACCORDION_WORDS;
253
+ root.children = words.map((w, i) => buildAccordionItem(create, w, `k${i + 1}`, options.icon ?? AccordionIcon.Chevron));
254
+ return root;
255
+ }
256
+ // ── reading a tree ──────────────────────────────────────────────────────────────────────────────
257
+ function isAccordionRoot(node) {
258
+ return node?.role === AccordionRole.Accordion;
259
+ }
260
+ /** True for any part of an accordion (its root included). */
261
+ function isAccordionPart(node) {
262
+ return !!node?.role && (node.role === AccordionRole.Accordion || node.role.startsWith(`${AccordionRole.Accordion}.`));
263
+ }
264
+ /** The accordion a node belongs to: the nearest ancestor (or the node itself) playing `accordion`.
265
+ * `path` = the node's ancestors, root first. */
266
+ function accordionRootOf(node, path) {
267
+ if (isAccordionRoot(node))
268
+ return node;
269
+ for (let i = path.length - 1; i >= 0; i--)
270
+ if (isAccordionRoot(path[i]))
271
+ return path[i];
272
+ return null;
273
+ }
274
+ /** The item a node sits in (the node itself when it is one), or null. */
275
+ function accordionItemOf(node, path) {
276
+ if (node.role === AccordionRole.Item)
277
+ return node;
278
+ for (let i = path.length - 1; i >= 0; i--) {
279
+ if (path[i].role === AccordionRole.Item)
280
+ return path[i];
281
+ if (isAccordionRoot(path[i]))
282
+ return null;
283
+ }
284
+ return null;
285
+ }
286
+ /** True when the root takes its items from content (a Repeater bound to a list, R3). */
287
+ function isAccordionFromContent(root) {
288
+ return !!root && root.type === Type$1.Repeater;
289
+ }
290
+ /** The root's items in order — every item (Manual), or the one template item (From content). */
291
+ function accordionItems(root) {
292
+ return (root.children ?? []).filter(c => c.role === AccordionRole.Item);
293
+ }
294
+ const asBool = (v) => v === true || v === 'true';
295
+ /** The root's behaviour (an unset trait reads its default: one at a time, the first open). */
296
+ function accordionBehaviour(root) {
297
+ const raw = root ? readProp(root, CompositeBehaviourTrait.DefaultOn) : undefined;
298
+ const defaultOn = ACCORDION_DEFAULT_ONS.includes(raw) ? raw : AccordionDefaultOn.First;
299
+ return { multiple: root ? asBool(readProp(root, CompositeBehaviourTrait.Multiple)) : false, defaultOn };
300
+ }
301
+ /** Behaviour ▸ Allow several open / Open by default. False when the node has no such trait. */
302
+ function setAccordionBehaviour(root, patch) {
303
+ let ok = true;
304
+ if (patch.multiple !== undefined)
305
+ ok = writeProp(root, CompositeBehaviourTrait.Multiple, patch.multiple) && ok;
306
+ if (patch.defaultOn !== undefined)
307
+ ok = writeProp(root, CompositeBehaviourTrait.DefaultOn, patch.defaultOn) && ok;
308
+ return ok;
309
+ }
310
+ /** The header of an item. */
311
+ function accordionTriggerOf(item) {
312
+ return findByRole(item, AccordionRole.Trigger);
313
+ }
314
+ /** The panel of an item. */
315
+ function accordionPanelOf(item) {
316
+ return findByRole(item, AccordionRole.Panel);
317
+ }
318
+ /** The question: the first Heading inside the header. */
319
+ function accordionQuestionOf(item) {
320
+ const trigger = accordionTriggerOf(item);
321
+ let hit;
322
+ if (trigger)
323
+ walkComposite(trigger, n => { if (!hit && n.type === Type$1.Heading)
324
+ hit = n; });
325
+ return hit;
326
+ }
327
+ /** The answer: the first Text inside the panel. */
328
+ function accordionAnswerOf(item) {
329
+ const panel = accordionPanelOf(item);
330
+ let hit;
331
+ if (panel)
332
+ walkComposite(panel, n => { if (!hit && n.type === Type$1.Text)
333
+ hit = n; });
334
+ return hit;
335
+ }
336
+ const stripTags = (v) => String(v ?? '').replace(/<[^>]*>/g, '').trim();
337
+ /** An item's name in the Items list and the layer tree: its question's words. */
338
+ function accordionItemLabel(item) {
339
+ const q = accordionQuestionOf(item);
340
+ return q ? stripTags(readProp(q, 'content')) : '';
341
+ }
342
+ /** Items ▸ rename: the question's words. */
343
+ function renameAccordionItem(item, question) {
344
+ const q = accordionQuestionOf(item);
345
+ return !!q && writeProp(q, 'content', question);
346
+ }
347
+ /** The heading level the header's wrapper renders (`<h3><button>`): its question's level. */
348
+ function accordionHeadingLevel(trigger) {
349
+ let level;
350
+ const visit = (n) => {
351
+ if (level !== undefined)
352
+ return;
353
+ if (n.type === Type$1.Heading) {
354
+ level = readProp(n, 'level');
355
+ return;
356
+ }
357
+ for (const c of n.children ?? [])
358
+ visit(c);
359
+ };
360
+ for (const c of trigger?.children ?? [])
361
+ visit(c);
362
+ return HEADING_LEVELS.includes(level) ? level : DEFAULT_LEVEL;
363
+ }
364
+ // ── editing (Items list, selection toolbar, Behaviour ▸ Icon) ──────────────────────────────────
365
+ /** A key no item of `root` holds yet (`k4`…). */
366
+ function nextItemKey(root) {
367
+ const taken = new Set(accordionItems(root).map(i => i.itemKey).filter(Boolean));
368
+ let n = taken.size + 1;
369
+ while (taken.has(`k${n}`))
370
+ n++;
371
+ return `k${n}`;
372
+ }
373
+ /** Items ▸ Add item (and the toolbar's "Add item"): a fresh item after `after` (or at the end), wearing the
374
+ * accordion's current icon. Returns the new item. */
375
+ function addAccordionItem(root, create, after, words = ACCORDION_NEW_ITEM_WORDS) {
376
+ const key = nextItemKey(root);
377
+ const item = buildAccordionItem(create, words, key, detectAccordionIcon(root));
378
+ const children = [...(root.children ?? [])];
379
+ const at = after ? children.indexOf(after) : -1;
380
+ children.splice(at < 0 ? children.length : at + 1, 0, item);
381
+ root.children = children;
382
+ return item;
383
+ }
384
+ /** Items ▸ drag to reorder: move an item to `toIndex` among the items. False when it is not an item of `root`. */
385
+ function moveAccordionItem(root, item, toIndex) {
386
+ const children = [...(root.children ?? [])];
387
+ const from = children.indexOf(item);
388
+ if (from < 0 || item.role !== AccordionRole.Item)
389
+ return false;
390
+ children.splice(from, 1);
391
+ const items = children.filter(c => c.role === AccordionRole.Item);
392
+ const anchor = items[Math.max(0, Math.min(toIndex, items.length))];
393
+ const at = anchor ? children.indexOf(anchor) : children.length;
394
+ children.splice(at, 0, item);
395
+ root.children = children;
396
+ return true;
397
+ }
398
+ var AccordionEditRefusal;
399
+ (function (AccordionEditRefusal) {
400
+ /** An accordion keeps at least one item (composite plan T11). */
401
+ AccordionEditRefusal["LastItem"] = "last-item";
402
+ })(AccordionEditRefusal || (AccordionEditRefusal = {}));
403
+ /** Why removing `item` from `root` is refused, or null. */
404
+ function accordionRemovalRefusal(root, item) {
405
+ if (!root || item?.role !== AccordionRole.Item)
406
+ return null;
407
+ return accordionItems(root).length <= 1 ? AccordionEditRefusal.LastItem : null;
408
+ }
409
+ /** The icon the accordion's items wear now (the first item's; None when it has no icon). */
410
+ function detectAccordionIcon(root) {
411
+ const first = accordionItems(root)[0];
412
+ const icon = first ? findByRole(first, AccordionRole.Icon) : undefined;
413
+ if (!icon)
414
+ return first ? AccordionIcon.None : AccordionIcon.Chevron;
415
+ const cls = String(readProp(icon, 'iconClass') ?? '');
416
+ return cls.includes(ACCORDION_ICON_GLYPH[AccordionIcon.Plus].iconClass.split(' ')[1]) ? AccordionIcon.Plus : AccordionIcon.Chevron;
417
+ }
418
+ /**
419
+ * Behaviour ▸ Icon: every item's header shows the chevron, the plus, or no icon. A switch between glyphs
420
+ * keeps the icon NODE (its styles and interactions) and changes its glyph and turn; None removes it, and a
421
+ * glyph after None stamps it back from the recipe. Returns how many items changed.
422
+ */
423
+ function setAccordionIcon(root, icon, create) {
424
+ let changed = 0;
425
+ for (const item of accordionItems(root)) {
426
+ const trigger = accordionTriggerOf(item);
427
+ if (!trigger)
428
+ continue;
429
+ const existing = findByRole(trigger, AccordionRole.Icon);
430
+ if (icon === AccordionIcon.None) {
431
+ if (existing && removeFromComposite(trigger, existing))
432
+ changed++;
433
+ continue;
434
+ }
435
+ const glyph = ACCORDION_ICON_GLYPH[icon];
436
+ if (existing) {
437
+ writeProp(existing, 'iconClass', glyph.iconClass);
438
+ existing.stateStyles = { ...(existing.stateStyles ?? {}), [ITEM_OPEN_STATE]: { ...(existing.stateStyles?.[ITEM_OPEN_STATE] ?? {}), rotate: glyph.turn } };
439
+ changed++;
440
+ }
441
+ else if (create) {
442
+ trigger.children = [...(trigger.children ?? []), buildIcon(create, `${item.itemKey ?? 'item'}-icon`, icon, item.id)];
443
+ changed++;
444
+ }
445
+ }
446
+ return changed;
447
+ }
448
+ /** The node id every `trigger-on` state inside an item points at: its ITEM (`stateTriggers['trigger-on']`). */
449
+ function itemOpenTriggerIds(root) {
450
+ for (const item of accordionItems(root)) {
451
+ if (!item.id)
452
+ continue;
453
+ walkComposite(item, n => {
454
+ if (n === item || !n.stateStyles?.[ITEM_OPEN_STATE])
455
+ return;
456
+ n.stateTriggers = { ...(n.stateTriggers ?? {}), [ITEM_OPEN_STATE]: item.id };
457
+ });
458
+ }
459
+ }
460
+ // ── state machine ───────────────────────────────────────────────────────────────────────────────
461
+ /** The keys open on first render: the first item, none, or all (From content: resolved against the rows). */
462
+ function initialAccordionOpen(keys, defaultOn) {
463
+ if (defaultOn === AccordionDefaultOn.None || !keys.length)
464
+ return new Set();
465
+ if (defaultOn === AccordionDefaultOn.All)
466
+ return new Set(keys);
467
+ return new Set([keys[0]]);
468
+ }
469
+ /** The open keys after toggling `key`: one at a time closes the others; several leaves them. */
470
+ function nextAccordionState(open, key, behaviour) {
471
+ if (open.has(key)) {
472
+ const next = new Set(open);
473
+ next.delete(key);
474
+ return next;
475
+ }
476
+ return behaviour.multiple ? new Set([...open, key]) : new Set([key]);
477
+ }
478
+ /** The open keys after OPENING `key` (find-in-page, selecting into a closed panel). */
479
+ function openAccordionItem(open, key, behaviour) {
480
+ return open.has(key) ? new Set(open) : nextAccordionState(open, key, behaviour);
481
+ }
482
+ var AccordionKeyAction;
483
+ (function (AccordionKeyAction) {
484
+ AccordionKeyAction["Next"] = "next";
485
+ AccordionKeyAction["Previous"] = "previous";
486
+ AccordionKeyAction["First"] = "first";
487
+ AccordionKeyAction["Last"] = "last";
488
+ })(AccordionKeyAction || (AccordionKeyAction = {}));
489
+ /** The APG accordion's keys on a header: ↓ ↑ move (and wrap), Home / End jump. Enter and Space are the
490
+ * button's own. */
491
+ const KEY_ACTIONS = {
492
+ ArrowDown: AccordionKeyAction.Next,
493
+ ArrowUp: AccordionKeyAction.Previous,
494
+ Home: AccordionKeyAction.First,
495
+ End: AccordionKeyAction.Last,
496
+ };
497
+ function accordionKeyAction(key) {
498
+ return KEY_ACTIONS[key] ?? null;
499
+ }
500
+ /** The header index `action` moves focus to, from `current` among `count` headers (↓ ↑ wrap). */
501
+ function accordionFocusIndex(action, current, count) {
502
+ if (count <= 0)
503
+ return -1;
504
+ switch (action) {
505
+ case AccordionKeyAction.Next: return (current + 1) % count;
506
+ case AccordionKeyAction.Previous: return (current - 1 + count) % count;
507
+ case AccordionKeyAction.First: return 0;
508
+ case AccordionKeyAction.Last: return count - 1;
509
+ }
510
+ }
511
+ // ── identity, ids and attributes (both renderers, SSR included) ────────────────────────────────
512
+ /** A key safe in an element id. */
513
+ function domSafeKey(raw) {
514
+ return String(raw ?? '').replace(/[^A-Za-z0-9_-]/g, '-');
515
+ }
516
+ /** A content row's identity: its own id (never its index — a reorder in the CMS must never pair a header with
517
+ * another row's panel, R3); the index only for a row that has none. */
518
+ function rowItemKey(row, index) {
519
+ const r = row;
520
+ const id = r && typeof r === 'object' ? (r._id ?? r.id) : undefined;
521
+ return id !== undefined && id !== null && id !== '' ? domSafeKey(id) : `row-${index}`;
522
+ }
523
+ /** The ARIA pairing ids of an item: unique per accordion (its root's node id) and per item (its key). */
524
+ function accordionDomIds(rootId, itemKey) {
525
+ const base = `iox-acc-${domSafeKey(rootId)}-${domSafeKey(itemKey)}`;
526
+ return { trigger: `${base}-h`, panel: `${base}-p` };
527
+ }
528
+ function accordionScope(rootId, behaviour, keys) {
529
+ return { rootId, behaviour, keys, open: initialAccordionOpen(keys, behaviour.defaultOn) };
530
+ }
531
+ function accordionItemState(scope, index) {
532
+ const key = scope.keys[index] ?? `item-${index}`;
533
+ return { key, index, on: scope.open.has(key), ids: accordionDomIds(scope.rootId, key) };
534
+ }
535
+ /** `data-iox-on` — the ONE attribute every "on" style keys on (Open, Item open). */
536
+ const ON_ATTRIBUTE = 'data-iox-on';
537
+ const ITEM_KEY_ATTRIBUTE = 'data-iox-item-key';
538
+ const COMPOSITE_ATTRIBUTE = 'data-iox-composite';
539
+ const MULTIPLE_ATTRIBUTE = 'data-iox-multiple';
540
+ const DEFAULT_ON_ATTRIBUTE = 'data-iox-default-on';
541
+ /** The value a closed panel's region carries: find-in-page can still reveal it (D9, board 4). */
542
+ const UNTIL_FOUND = 'until-found';
543
+ /** The structural classes the renderers write around an accordion's parts (no node owns them). */
544
+ var AccordionClass;
545
+ (function (AccordionClass) {
546
+ AccordionClass["Heading"] = "iox-accordion-heading";
547
+ AccordionClass["Button"] = "iox-accordion-button";
548
+ AccordionClass["Track"] = "iox-accordion-track";
549
+ AccordionClass["Region"] = "iox-accordion-region";
550
+ })(AccordionClass || (AccordionClass = {}));
551
+ function accordionRootAttributes(behaviour) {
552
+ return {
553
+ [COMPOSITE_ATTRIBUTE]: AccordionRole.Accordion,
554
+ [DEFAULT_ON_ATTRIBUTE]: behaviour.defaultOn,
555
+ ...(behaviour.multiple ? { [MULTIPLE_ATTRIBUTE]: '' } : {}),
556
+ };
557
+ }
558
+ function accordionItemAttributes(state) {
559
+ return { [ITEM_KEY_ATTRIBUTE]: state.key, ...(state.on ? { [ON_ATTRIBUTE]: '' } : {}) };
560
+ }
561
+ function accordionTriggerAttributes(state) {
562
+ return {
563
+ type: 'button',
564
+ id: state.ids.trigger,
565
+ 'aria-expanded': state.on ? 'true' : 'false',
566
+ 'aria-controls': state.ids.panel,
567
+ ...(state.on ? { [ON_ATTRIBUTE]: '' } : {}),
568
+ };
569
+ }
570
+ /** The track wrapping a panel: its row collapses to 0 while closed (the ONE hiding rule, iox-design.css). */
571
+ function accordionTrackAttributes(state) {
572
+ return state.on ? { [ON_ATTRIBUTE]: '' } : {};
573
+ }
574
+ /** The region the panel sits in: `hidden="until-found"` while closed, so its words stay in the page. */
575
+ function accordionRegionAttributes(state) {
576
+ return {
577
+ role: 'region',
578
+ id: state.ids.panel,
579
+ 'aria-labelledby': state.ids.trigger,
580
+ ...(state.on ? {} : { hidden: UNTIL_FOUND }),
581
+ };
582
+ }
583
+ function accordionPanelAttributes(state) {
584
+ return state.on ? { [ON_ATTRIBUTE]: '' } : {};
585
+ }
586
+ /** `attrs` as an HTML attribute string (` a="b" c`), values escaped by `esc`. */
587
+ function serializeDomAttributes(attrs, esc) {
588
+ return Object.entries(attrs).map(([k, v]) => (v === '' ? ` ${k}` : ` ${k}="${esc(v)}"`)).join('');
589
+ }
590
+ const SHORT_TEXT = new Set(['text']);
591
+ const LONG_TEXT = new Set(['textarea', 'richText', 'editor']);
592
+ /** R3 (board 9 Q19): switching to From content binds the question to the first short-text field and the
593
+ * answer to the first long-text field. ONE rule for the builder's switch and the composer. */
594
+ function pickAccordionAutoBinds(fields) {
595
+ const isString = (f) => !f.type || f.type === 'string';
596
+ const question = fields.find(f => isString(f) && SHORT_TEXT.has(String(f.controller ?? 'text')))?.name ?? null;
597
+ const answer = fields.find(f => isString(f) && LONG_TEXT.has(String(f.controller ?? '')) && f.name !== question)?.name ?? null;
598
+ return { question, answer };
599
+ }
600
+ /** The bound props of the question and the answer (each a content trait). */
601
+ const ACCORDION_BIND_PROP = 'content';
602
+ /**
603
+ * Manual → From content (board 9 "Items: Manual · From content"): the root becomes `repeater` (a Repeater node
604
+ * the caller created with the same id, role, label, element style and styles — a type change is the
605
+ * consumer's), the FIRST item becomes the one template (its parts, styles and interactions kept; its key
606
+ * dropped — a row's key is its id) and the others are removed. Returns the removed items.
607
+ */
608
+ function accordionToContent(root, repeater) {
609
+ const items = accordionItems(root);
610
+ const [template, ...rest] = items;
611
+ if (template)
612
+ delete template.itemKey;
613
+ repeater.role = AccordionRole.Accordion;
614
+ repeater.children = template ? [template] : [];
615
+ writeProp(repeater, CompositeBehaviourTrait.Multiple, accordionBehaviour(root).multiple);
616
+ writeProp(repeater, CompositeBehaviourTrait.DefaultOn, accordionBehaviour(root).defaultOn);
617
+ return rest;
618
+ }
619
+ /**
620
+ * From content → Manual: the rows come in as static items — each a copy of the template (`cloneItem`, which
621
+ * gives the copy fresh ids) whose bound words are written in as its own and whose bindings are dropped.
622
+ * `container` is the manual root the caller created. Returns the new items.
623
+ */
624
+ function accordionToManual(root, container, rows, cloneItem, resolve) {
625
+ const template = accordionItems(root)[0];
626
+ container.role = AccordionRole.Accordion;
627
+ writeProp(container, CompositeBehaviourTrait.Multiple, accordionBehaviour(root).multiple);
628
+ writeProp(container, CompositeBehaviourTrait.DefaultOn, accordionBehaviour(root).defaultOn);
629
+ const items = template ? rows.map((row, i) => {
630
+ const item = cloneItem(template);
631
+ item.itemKey = `k${i + 1}`;
632
+ walkComposite(item, n => {
633
+ const bindings = n.bindings ?? [];
634
+ for (const b of bindings) {
635
+ const value = resolve(row, b);
636
+ if (value !== undefined && value !== null)
637
+ writeProp(n, b.prop, value);
638
+ }
639
+ if (bindings.length)
640
+ n.bindings = [];
641
+ });
642
+ return item;
643
+ }) : [];
644
+ container.children = items;
645
+ return items;
646
+ }
647
+ /** The style a part holds for `name` (both node shapes) — exported for the consumers' detectors. */
648
+ function accordionPartStyle(node, name) {
649
+ return readOwnedTrait(node, { trait: name });
650
+ }
651
+
652
+ /**
653
+ * The Accordion's RUNTIME (CC2) — ONE copy, DOM only, for the builder canvas and the live site (both engine
654
+ * paths render the same markup). It reads the markup the renderers write (iox-design.css + accordion.ts's
655
+ * attribute planners), so the server's first paint and every later state agree:
656
+ *
657
+ * [root] data-iox-composite="accordion" data-iox-default-on [data-iox-multiple] (the node's own element —
658
+ * its role class may sit on a wrapper host, as the engine's component-path Repeater draws it)
659
+ * .iox-role-accordion-item data-iox-item-key [data-iox-on]
660
+ * hN.iox-accordion-heading > button.iox-accordion-button id aria-expanded aria-controls
661
+ * .iox-accordion-track [data-iox-on] > .iox-accordion-region role=region [hidden=until-found]
662
+ * .iox-role-accordion-panel
663
+ *
664
+ * It owns: a click on a header toggles its item; ↓ ↑ Home End move between the headers of THIS accordion
665
+ * (a nested one keeps its own); find-in-page (`beforematch`) opens the item that holds the match; a closed
666
+ * panel gets `hidden="until-found"` after its track has collapsed (at once under reduced motion). Every
667
+ * change dispatches `iox-item-on` / `iox-item-off` on the item, the `itemOn` / `itemOff` interaction
668
+ * triggers. The open set is LIVE ∪ FORCED: the builder forces items open (a selection inside a closed panel,
669
+ * "All open"); the live site forces nothing.
670
+ */
671
+ const ITEM_ON_EVENT = 'iox-item-on';
672
+ const ITEM_OFF_EVENT = 'iox-item-off';
673
+ const ROOT_SELECTOR = `[${COMPOSITE_ATTRIBUTE}="${AccordionRole.Accordion}"]`;
674
+ const ITEM_SELECTOR = '.iox-role-accordion-item';
675
+ const PANEL_SELECTOR = '.iox-role-accordion-panel';
676
+ const BUTTON_SELECTOR = `.${AccordionClass.Button}`;
677
+ const TRACK_SELECTOR = `.${AccordionClass.Track}`;
678
+ const REGION_SELECTOR = `.${AccordionClass.Region}`;
679
+ /** How long a closing track may take before its region is hidden (dur-base is 200–320ms in every pack). */
680
+ const MAX_CLOSE_MS = 600;
681
+ const REDUCED_MOTION = '(prefers-reduced-motion: reduce)';
682
+ /** The accordion an element belongs to (the element itself when it is a root). */
683
+ function closestAccordion(el) {
684
+ return el?.closest?.(ROOT_SELECTOR) ?? null;
685
+ }
686
+ /** The item an element sits in (itself when it is one). */
687
+ function closestAccordionItem(el) {
688
+ return el?.closest?.(ITEM_SELECTOR) ?? null;
689
+ }
690
+ /** Subscribe to an item turning on / off — what the `itemOn` / `itemOff` interaction triggers listen to. The
691
+ * item is the element's own item (the element itself when it is one). Returns the unsubscribe. */
692
+ function onAccordionItemState(el, on, handler) {
693
+ const item = closestAccordionItem(el);
694
+ if (!item)
695
+ return () => undefined;
696
+ const type = on ? ITEM_ON_EVENT : ITEM_OFF_EVENT;
697
+ item.addEventListener(type, handler);
698
+ return () => item.removeEventListener(type, handler);
699
+ }
700
+ /** True when the element's item is open now. */
701
+ function isAccordionItemOn(el) {
702
+ return !!closestAccordionItem(el)?.hasAttribute(ON_ATTRIBUTE);
703
+ }
704
+ const nodeIdOf = (el) => {
705
+ for (const c of Array.from(el.classList))
706
+ if (c.startsWith('iox-node-'))
707
+ return c.slice('iox-node-'.length);
708
+ return '';
709
+ };
710
+ function behaviourOf(root) {
711
+ const raw = root.getAttribute(DEFAULT_ON_ATTRIBUTE);
712
+ return {
713
+ multiple: root.hasAttribute(MULTIPLE_ATTRIBUTE),
714
+ defaultOn: ACCORDION_DEFAULT_ONS.includes(raw) ? raw : AccordionDefaultOn.First,
715
+ };
716
+ }
717
+ function setAttr(el, name, value) {
718
+ if (!el)
719
+ return;
720
+ if (value === null) {
721
+ if (el.hasAttribute(name))
722
+ el.removeAttribute(name);
723
+ }
724
+ else if (el.getAttribute(name) !== value)
725
+ el.setAttribute(name, value);
726
+ }
727
+ class AccordionRuntime {
728
+ constructor(root, options = {}) {
729
+ this.root = root;
730
+ this.options = options;
731
+ this.shown = new Set();
732
+ this.closing = new Map();
733
+ this.observer = null;
734
+ this.stampQueued = false;
735
+ /** The builder attaches a root before its items render: the saved default is applied once they do. */
736
+ this.awaitingItems = false;
737
+ this.onClick = (event) => {
738
+ const button = event.target?.closest?.(BUTTON_SELECTOR);
739
+ if (!button || closestAccordion(button) !== this.root)
740
+ return;
741
+ const item = closestAccordionItem(button);
742
+ if (!item)
743
+ return;
744
+ event.preventDefault();
745
+ this.toggle(this.keyOf(item));
746
+ };
747
+ this.onKeydown = (event) => {
748
+ const e = event;
749
+ const action = accordionKeyAction(e.key);
750
+ const button = e.target?.closest?.(BUTTON_SELECTOR);
751
+ if (!action || !button || closestAccordion(button) !== this.root)
752
+ return;
753
+ const buttons = this.buttons();
754
+ const at = buttons.indexOf(button);
755
+ const target = buttons[accordionFocusIndex(action, at, buttons.length)];
756
+ if (!target)
757
+ return;
758
+ e.preventDefault();
759
+ target.focus();
760
+ };
761
+ this.onBeforeMatch = (event) => {
762
+ const region = event.target?.closest?.(REGION_SELECTOR);
763
+ const item = closestAccordionItem(region);
764
+ if (!item || closestAccordion(item.parentElement) !== this.root)
765
+ return;
766
+ this.open(this.keyOf(item));
767
+ };
768
+ this.behaviourValue = options.behaviour ?? behaviourOf(root);
769
+ root.setAttribute(COMPOSITE_ATTRIBUTE, AccordionRole.Accordion);
770
+ // The server rendered the first state; with no server state the root's default decides.
771
+ // (The builder passes the behaviour and starts from the saved default; on the live site the server
772
+ // stamped every item's key and state, and that is the truth.)
773
+ const items = this.items();
774
+ const serverStamped = !options.behaviour && items.some(i => i.hasAttribute(ITEM_KEY_ATTRIBUTE));
775
+ this.live = serverStamped
776
+ ? new Set(items.filter(i => i.hasAttribute(ON_ATTRIBUTE)).map(i => this.keyOf(i, items)))
777
+ : initialAccordionOpen(items.map(i => this.keyOf(i, items)), this.behaviourValue.defaultOn);
778
+ this.awaitingItems = !serverStamped && !items.length;
779
+ this.shown = new Set(this.live);
780
+ // Capture: on the builder canvas every part's own listener stops the click (it selects that part), and
781
+ // the header must still toggle — the canvas is a live runtime.
782
+ root.addEventListener('click', this.onClick, true);
783
+ root.addEventListener('keydown', this.onKeydown);
784
+ root.addEventListener('beforematch', this.onBeforeMatch, true);
785
+ if (options.observe && typeof MutationObserver !== 'undefined') {
786
+ this.observer = new MutationObserver(() => this.queueStamp());
787
+ this.observer.observe(root, { childList: true, subtree: true });
788
+ }
789
+ this.stamp(true);
790
+ }
791
+ get behaviour() {
792
+ return this.behaviourValue;
793
+ }
794
+ /** The behaviour changed in the panel: re-read, and start from the new default. */
795
+ setBehaviour(behaviour) {
796
+ const changedDefault = behaviour.defaultOn !== this.behaviourValue.defaultOn;
797
+ this.behaviourValue = behaviour;
798
+ if (behaviour.multiple)
799
+ this.root.setAttribute(MULTIPLE_ATTRIBUTE, '');
800
+ else
801
+ this.root.removeAttribute(MULTIPLE_ATTRIBUTE);
802
+ this.root.setAttribute(DEFAULT_ON_ATTRIBUTE, behaviour.defaultOn);
803
+ if (changedDefault)
804
+ this.resetLive();
805
+ else
806
+ this.stamp();
807
+ }
808
+ /** THIS accordion's items, in document order (a nested accordion's items are its own). */
809
+ items() {
810
+ return Array.from(this.root.querySelectorAll(ITEM_SELECTOR)).filter(i => closestAccordion(i.parentElement) === this.root);
811
+ }
812
+ /** The open keys the live state holds (before anything forced). */
813
+ get liveKeys() {
814
+ return this.live;
815
+ }
816
+ /** The keys showing open right now. */
817
+ get openKeys() {
818
+ return this.shown;
819
+ }
820
+ keyOf(item, items = this.items()) {
821
+ return item.getAttribute(ITEM_KEY_ATTRIBUTE) || `item-${items.indexOf(item)}`;
822
+ }
823
+ toggle(key) {
824
+ this.live = nextAccordionState(this.live, key, this.behaviourValue);
825
+ this.stamp();
826
+ }
827
+ open(key) {
828
+ this.live = openAccordionItem(this.live, key, this.behaviourValue);
829
+ this.stamp();
830
+ }
831
+ /** Back to the saved default ("Showing on canvas ▸ As saved"). */
832
+ resetLive() {
833
+ const items = this.items();
834
+ this.live = initialAccordionOpen(items.map(i => this.keyOf(i, items)), this.behaviourValue.defaultOn);
835
+ this.stamp();
836
+ }
837
+ /** The forced set changed (builder design state): show it. */
838
+ refresh() {
839
+ this.stamp();
840
+ }
841
+ destroy() {
842
+ this.root.removeEventListener('click', this.onClick, true);
843
+ this.root.removeEventListener('keydown', this.onKeydown);
844
+ this.root.removeEventListener('beforematch', this.onBeforeMatch, true);
845
+ this.observer?.disconnect();
846
+ this.observer = null;
847
+ for (const t of this.closing.values())
848
+ clearTimeout(t);
849
+ this.closing.clear();
850
+ }
851
+ queueStamp() {
852
+ if (this.stampQueued)
853
+ return;
854
+ this.stampQueued = true;
855
+ const run = () => { this.stampQueued = false; this.stamp(); };
856
+ if (typeof queueMicrotask === 'function')
857
+ queueMicrotask(run);
858
+ else
859
+ Promise.resolve().then(run);
860
+ }
861
+ reduced() {
862
+ if (this.options.reducedMotion)
863
+ return this.options.reducedMotion();
864
+ try {
865
+ return typeof matchMedia === 'function' && matchMedia(REDUCED_MOTION).matches;
866
+ }
867
+ catch {
868
+ return false;
869
+ }
870
+ }
871
+ /** Write every item's state into its markup; announce what changed. */
872
+ stamp(first = false) {
873
+ // Our own writes must not wake the observer (they are attributes; it watches the child lists only).
874
+ const items = this.items();
875
+ if (this.awaitingItems && items.length) {
876
+ this.awaitingItems = false;
877
+ this.live = initialAccordionOpen(items.map(i => this.keyOf(i, items)), this.behaviourValue.defaultOn);
878
+ first = true;
879
+ }
880
+ const forced = this.options.forced?.() ?? new Set();
881
+ const rootId = this.options.rootId ?? nodeIdOf(this.root);
882
+ const next = new Set();
883
+ items.forEach((item, index) => {
884
+ const key = this.keyOf(item, items);
885
+ const on = this.live.has(key) || forced.has(key);
886
+ if (on)
887
+ next.add(key);
888
+ this.stampItem(item, key, index, on, rootId, first);
889
+ });
890
+ const was = first ? new Set() : this.shown;
891
+ this.shown = next;
892
+ // On the first stamp an item open by default HAS opened: its `itemOn` listeners attached so far hear it
893
+ // (the builder renders an item's parts, and attaches their interactions, before its root's runtime; the
894
+ // live engine attaches the runtime first and its interactions run an already-open item's at once).
895
+ for (const item of items) {
896
+ const key = this.keyOf(item, items);
897
+ if (next.has(key) && !was.has(key))
898
+ dispatch(item, ITEM_ON_EVENT);
899
+ else if (!next.has(key) && was.has(key))
900
+ dispatch(item, ITEM_OFF_EVENT);
901
+ }
902
+ }
903
+ stampItem(item, key, index, on, rootId, first) {
904
+ const ids = accordionDomIds(rootId, key);
905
+ if (!item.hasAttribute(ITEM_KEY_ATTRIBUTE))
906
+ item.setAttribute(ITEM_KEY_ATTRIBUTE, key);
907
+ setAttr(item, ON_ATTRIBUTE, on ? '' : null);
908
+ const button = this.own(item, BUTTON_SELECTOR);
909
+ const track = this.own(item, TRACK_SELECTOR);
910
+ const region = this.own(item, REGION_SELECTOR);
911
+ const panel = this.own(item, PANEL_SELECTOR);
912
+ setAttr(button, 'type', 'button');
913
+ setAttr(button, 'id', ids.trigger);
914
+ setAttr(button, 'aria-expanded', on ? 'true' : 'false');
915
+ setAttr(button, 'aria-controls', ids.panel);
916
+ setAttr(button, ON_ATTRIBUTE, on ? '' : null);
917
+ setAttr(track, ON_ATTRIBUTE, on ? '' : null);
918
+ setAttr(panel, ON_ATTRIBUTE, on ? '' : null);
919
+ setAttr(region, 'role', 'region');
920
+ setAttr(region, 'id', ids.panel);
921
+ setAttr(region, 'aria-labelledby', ids.trigger);
922
+ if (!region)
923
+ return;
924
+ const pending = this.closing.get(key);
925
+ if (on) {
926
+ if (pending) {
927
+ clearTimeout(pending);
928
+ this.closing.delete(key);
929
+ }
930
+ setAttr(region, 'hidden', null);
931
+ return;
932
+ }
933
+ if (region.hasAttribute('hidden') || pending)
934
+ return;
935
+ // Closing: the track collapses first (its transition), THEN the region is hidden — hiding it at once
936
+ // would collapse it with no motion. At first paint, or under reduced motion, it is hidden at once.
937
+ if (first || this.reduced()) {
938
+ setAttr(region, 'hidden', UNTIL_FOUND);
939
+ return;
940
+ }
941
+ const hide = () => {
942
+ this.closing.delete(key);
943
+ if (!item.hasAttribute(ON_ATTRIBUTE))
944
+ setAttr(region, 'hidden', UNTIL_FOUND);
945
+ };
946
+ this.closing.set(key, setTimeout(hide, this.closeDelay(track)));
947
+ }
948
+ closeDelay(track) {
949
+ try {
950
+ const view = track?.ownerDocument?.defaultView;
951
+ const raw = track && view ? view.getComputedStyle(track).transitionDuration : '';
952
+ const ms = Math.max(0, ...String(raw).split(',').map(s => (s.trim().endsWith('ms') ? parseFloat(s) : parseFloat(s) * 1000)).filter(n => !isNaN(n)));
953
+ return Math.min(MAX_CLOSE_MS, ms + 20);
954
+ }
955
+ catch {
956
+ return 0;
957
+ }
958
+ }
959
+ /** The element `selector` matches inside `item` that belongs to it, not to an item nested in it. */
960
+ own(item, selector) {
961
+ return Array.from(item.querySelectorAll(selector)).find(el => closestAccordionItem(el) === item) ?? null;
962
+ }
963
+ buttons() {
964
+ return this.items().map(i => this.own(i, BUTTON_SELECTOR)).filter((b) => !!b);
965
+ }
966
+ }
967
+ function dispatch(el, type) {
968
+ const Ctor = globalThis.CustomEvent;
969
+ if (Ctor)
970
+ el.dispatchEvent(new Ctor(type, { bubbles: false }));
971
+ }
972
+ /** Attach the runtime to one rendered accordion root, unless it already runs one. Returns the NEW runtime, or
973
+ * null when the root already had one (so a caller destroys only what it created). */
974
+ function attachAccordionAt(root, options = {}) {
975
+ if (ATTACHED.has(root))
976
+ return null;
977
+ const runtime = new AccordionRuntime(root, options);
978
+ ATTACHED.set(root, runtime);
979
+ return runtime;
980
+ }
981
+ /** Attach the runtime to every accordion under `container` that has none yet. Returns the new runtimes. */
982
+ function attachAccordions(container, options = {}) {
983
+ const out = [];
984
+ container.querySelectorAll(ROOT_SELECTOR).forEach(root => {
985
+ const runtime = attachAccordionAt(root, options);
986
+ if (runtime)
987
+ out.push(runtime);
988
+ });
989
+ return out;
990
+ }
991
+ /** Detach a runtime `attachAccordions` created. */
992
+ function detachAccordion(runtime) {
993
+ runtime.destroy();
994
+ ATTACHED.delete(runtime.root);
995
+ }
996
+ const ATTACHED = new WeakMap();
997
+
108
998
  /**
109
999
  * BADGE + CHIP (composite T25; complex-components board 8). A Badge is a Container wearing
110
1000
  * `badge-<tone>` › Icon + Text; its TONE is its element style, so Badge ▸ Tone writes the style and
@@ -656,6 +1546,12 @@ const COMPOSITE_ROLE_SPECS = {
656
1546
  [CardRole.Title]: { parent: CardRole.Content, locked: true },
657
1547
  [CardRole.Text]: { parent: CardRole.Content, part: CardPart.Text },
658
1548
  [CardRole.Actions]: { parent: CardRole.Content, part: CardPart.Actions },
1549
+ // CC2 — an item always keeps its header and its panel; the icon is Behaviour ▸ Icon's.
1550
+ [AccordionRole.Accordion]: { parent: null },
1551
+ [AccordionRole.Item]: { parent: AccordionRole.Accordion },
1552
+ [AccordionRole.Trigger]: { parent: AccordionRole.Item, locked: true },
1553
+ [AccordionRole.Panel]: { parent: AccordionRole.Item, locked: true },
1554
+ [AccordionRole.Icon]: { parent: AccordionRole.Trigger },
659
1555
  };
660
1556
  var StructureEdit;
661
1557
  (function (StructureEdit) {
@@ -693,7 +1589,8 @@ function isLockedPart(node) {
693
1589
  * @vectoriox/iox-ui/composite-core — composites built from the builder's own parts (composite-components
694
1590
  * plan §3a). FRAMEWORK-FREE: the builder, the SSR engine and iox-cms (generation-core's composer, the site
695
1591
  * build) read the same recipes, roles and structure rules. Card v2 + Badge / Chip (T23 / T25) are the
696
- * first; Accordion and Tabs join with their own phases.
1592
+ * first; the Accordion (CC2) adds the first composite RUNTIME (accordion-runtime.ts — DOM only, no
1593
+ * framework); Tabs join with their own phase.
697
1594
  * ⚠️ Consumers wire the usual trio — ng-package raw-ts assets, jest moduleNameMapper, tsconfig paths.
698
1595
  */
699
1596
 
@@ -701,5 +1598,5 @@ function isLockedPart(node) {
701
1598
  * Generated bundle index. Do not edit.
702
1599
  */
703
1600
 
704
- export { BADGE_TONES, BADGE_TONE_ICONS, BadgeTone, CARD_LAYOUTS, CARD_LAYOUT_CUSTOM, CARD_PARTS, CARD_PART_ROLE, CARD_STACK_BREAKPOINT, CARD_WORDS, CHIP_ICON, CHIP_STYLE, COMPOSITE_ROLE_SPECS, CardLayout, CardPart, CardRole, PILL_LABEL_STYLE, StructureEdit, StructureRefusal, applyCardLayout, badgeStyleId, badgeToneOf, buildBadge, buildCardRecipe, buildChip, cardPartsOf, cardRootOf, cardTitleOf, clearLayerStyles, detectCardLayout, findByRole, isCardLinked, isCardRoot, isLockedPart, isPillNode, parentInComposite, readLayerStyle, readProp, readStyle, removeFromComposite, setBadgeTone, setCardLinked, setCardPart, structureRefusal, walkComposite, writeLayerStyles, writeProp, writeStyles };
1601
+ export { ACCORDION_BIND_PROP, ACCORDION_CONTENT_LIMIT, ACCORDION_DEFAULT_ONS, ACCORDION_ICONS, ACCORDION_ICON_GLYPH, ACCORDION_NEW_ITEM_WORDS, ACCORDION_WORDS, AccordionClass, AccordionDefaultOn, AccordionEditRefusal, AccordionIcon, AccordionKeyAction, AccordionRole, AccordionRuntime, BADGE_TONES, BADGE_TONE_ICONS, BadgeTone, CARD_LAYOUTS, CARD_LAYOUT_CUSTOM, CARD_PARTS, CARD_PART_ROLE, CARD_STACK_BREAKPOINT, CARD_WORDS, CHIP_ICON, CHIP_STYLE, COMPOSITE_ATTRIBUTE, COMPOSITE_ROLE_SPECS, CardLayout, CardPart, CardRole, CompositeBehaviourTrait, DEFAULT_ON_ATTRIBUTE, ITEM_KEY_ATTRIBUTE, ITEM_OFF_EVENT, ITEM_ON_EVENT, ITEM_OPEN_STATE, MULTIPLE_ATTRIBUTE, ON_ATTRIBUTE, ON_STATE, PILL_LABEL_STYLE, StructureEdit, StructureRefusal, UNTIL_FOUND, accordionAnswerOf, accordionBehaviour, accordionDomIds, accordionFocusIndex, accordionHeadingLevel, accordionItemAttributes, accordionItemLabel, accordionItemOf, accordionItemState, accordionItems, accordionKeyAction, accordionPanelAttributes, accordionPanelOf, accordionPartStyle, accordionQuestionOf, accordionRegionAttributes, accordionRemovalRefusal, accordionRootAttributes, accordionRootOf, accordionScope, accordionToContent, accordionToManual, accordionTrackAttributes, accordionTriggerAttributes, accordionTriggerOf, addAccordionItem, applyCardLayout, attachAccordionAt, attachAccordions, badgeStyleId, badgeToneOf, buildAccordionItem, buildAccordionRecipe, buildBadge, buildCardRecipe, buildChip, cardPartsOf, cardRootOf, cardTitleOf, clearLayerStyles, closestAccordion, closestAccordionItem, detachAccordion, detectAccordionIcon, detectCardLayout, domSafeKey, findByRole, initialAccordionOpen, isAccordionFromContent, isAccordionItemOn, isAccordionPart, isAccordionRoot, isCardLinked, isCardRoot, isLockedPart, isPillNode, itemOpenTriggerIds, moveAccordionItem, nextAccordionState, nextItemKey, onAccordionItemState, openAccordionItem, parentInComposite, pickAccordionAutoBinds, readLayerStyle, readProp, readStyle, removeFromComposite, renameAccordionItem, rowItemKey, serializeDomAttributes, setAccordionBehaviour, setAccordionIcon, setBadgeTone, setCardLinked, setCardPart, structureRefusal, walkComposite, writeLayerStyles, writeProp, writeStyles };
705
1602
  //# sourceMappingURL=vectoriox-iox-ui-composite-core.mjs.map