@ui-doc/html-renderer 0.4.0 → 1.0.2

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.
@@ -1,4 +1,4 @@
1
- import type { GenerateContext } from '@ui-doc/core';
1
+ import type { GenerateContext, GenerateExampleContext } from '@ui-doc/core';
2
2
  import type { Node } from './nodes';
3
3
  import type { Parser } from './Parser.types';
4
4
  import type { RenderContext, Renderer, SourceInput } from './Renderer.types';
@@ -12,10 +12,10 @@ export declare class HtmlRenderer implements Renderer {
12
12
  addPartial(name: string, partial: SourceInput): this;
13
13
  addPage(name: string, page: SourceInput): this;
14
14
  protected parse(input: SourceInput): Node;
15
- generate(context: GenerateContext, layout?: string): string;
15
+ generate(context: GenerateContext | GenerateExampleContext, layout?: string): string;
16
16
  page(name: string, context: RenderContext): string;
17
17
  partial(name: string, context?: RenderContext): string;
18
18
  protected render(rootNode: Node, context: RenderContext): string;
19
- protected generateContext(context: GenerateContext): RenderContext;
19
+ protected generateContext(context: GenerateContext | GenerateExampleContext): RenderContext;
20
20
  protected makeAttributes(attrs?: Record<string, string>): string;
21
21
  }
@@ -7,7 +7,7 @@ export declare class InlineReader implements Reader {
7
7
  protected currentPos: number;
8
8
  protected currentContent: string;
9
9
  constructor(input: string, source?: string);
10
- peak(k?: PositiveInteger): string;
10
+ peek(k?: PositiveInteger): string;
11
11
  consume(k?: PositiveInteger): string;
12
12
  isEof(): boolean;
13
13
  debug(): {
@@ -9,17 +9,18 @@ export interface Lexer {
9
9
  * @param {PositiveInteger} k
10
10
  * @returns {Token | undefined} next token or undefined if there are no more tokens.
11
11
  */
12
- peek<T extends PositiveInteger = 1>(k?: T): TokenReturn<T>;
12
+ peek: <T extends PositiveInteger = 1>(k?: T) => TokenReturn<T>;
13
13
  /**
14
14
  * Get the next token /next k-th token, and remove it from the token stream.
15
- * This means, calling the consume() method multiple times will return a new token at each invocation.
15
+ * This means, calling the consume() method multiple times will return a new token at each
16
+ * invocation.
16
17
  * @param {PositiveInteger} k
17
18
  * @returns {Token | undefined} next token or undefined if there are no more tokens.
18
19
  */
19
- consume<T extends PositiveInteger = 1>(k?: T): TokenReturn<T>;
20
+ consume: <T extends PositiveInteger = 1>(k?: T) => TokenReturn<T>;
20
21
  /**
21
22
  * Get the debug information about the current state of the lexer.
22
23
  * @returns {object} debug information
23
24
  */
24
- debug(): ReturnType<Reader['debug']>;
25
+ debug: () => ReturnType<Reader['debug']>;
25
26
  }
@@ -1,8 +1,8 @@
1
- import { HtmlCurlyBraceLexer } from './HtmlCurlyBraceLexer';
2
1
  import type { TagNode } from './nodes';
3
- import { Node } from './nodes/Node';
4
2
  import type { Parser, TagNodeParse } from './Parser.types';
5
3
  import type { Reader } from './Reader.types';
4
+ import { HtmlCurlyBraceLexer } from './HtmlCurlyBraceLexer';
5
+ import { Node } from './nodes/Node';
6
6
  export declare class NodeParser implements Parser {
7
7
  protected tags: Record<string, TagNodeParse>;
8
8
  static init(): NodeParser;
@@ -1,13 +1,13 @@
1
1
  import type { Node, TagNode } from './nodes';
2
2
  import type { Reader } from './Reader.types';
3
- import type { Token } from './Token.types';
3
+ import type { TokenValue } from './Token.types';
4
4
  export interface TagNodeParse {
5
5
  identifier: string;
6
6
  example: string;
7
7
  hasContent: boolean;
8
- parse(): {
9
- addToken(token: Token): void;
10
- create(): TagNode;
8
+ parse: () => {
9
+ addToken: (token: TokenValue) => void;
10
+ create: () => TagNode;
11
11
  };
12
12
  }
13
13
  export interface Parser {
@@ -16,10 +16,10 @@ export interface Parser {
16
16
  * @param {Reader} reader
17
17
  * @returns {Node} AST
18
18
  */
19
- parse(reader: Reader): Node;
19
+ parse: (reader: Reader) => Node;
20
20
  /**
21
21
  * Register a tag parser.
22
22
  * @param {TagNodeParse} tag
23
23
  */
24
- registerTagParser(tag: TagNodeParse): this;
24
+ registerTagParser: (tag: TagNodeParse) => this;
25
25
  }
@@ -1 +1 @@
1
- export type PositiveInteger<T extends number = number> = `${T}` extends '0' | `-${any}` | `${any}.${any}` ? never : T;
1
+ export type PositiveInteger<T extends number = number> = `${T}` extends '0' | `-${string}` | `${string}.${string}` ? never : T;
@@ -2,31 +2,33 @@ import type { PositiveInteger } from './Primitive.types';
2
2
  export interface Reader {
3
3
  /**
4
4
  * Get the next character / next k-th character from the input.
5
- * This is used to look ahead the characters without consuming/removing them from the input stream.
5
+ * This is used to look ahead the characters without consuming/removing them from the input
6
+ * stream.
6
7
  * Calling the peek() method more than once will return the same character.
7
8
  *
8
9
  * @param {PositiveInteger} k number
9
10
  * @returns {string} next character
10
11
  */
11
- peak(k?: PositiveInteger): string;
12
+ peek: (k?: PositiveInteger) => string;
12
13
  /**
13
14
  * Get the next character /next k-th token from the input, and remove it from the input.
14
- * This means, calling the consume() method multiple times will return a new character at each invocation.
15
+ * This means, calling the consume() method multiple times will return a new character at each
16
+ * invocation.
15
17
  *
16
18
  * @param {PositiveInteger} k
17
19
  * @returns {string} next character
18
20
  */
19
- consume(k?: PositiveInteger): string;
21
+ consume: (k?: PositiveInteger) => string;
20
22
  /**
21
23
  * Check if the input stream is empty.
22
24
  * @returns {boolean} true if the input stream is empty, false otherwise.
23
25
  */
24
- isEof(): boolean;
26
+ isEof: () => boolean;
25
27
  /**
26
28
  * Get the debug information about the current state of the reader.
27
29
  * @returns {object} debug information
28
30
  */
29
- debug(): {
31
+ debug: () => {
30
32
  source: string;
31
33
  line: PositiveInteger;
32
34
  pos: PositiveInteger;
@@ -1,14 +1,14 @@
1
- import { Renderer as CoreRenderer } from '@ui-doc/core';
1
+ import type { Renderer as CoreRenderer } from '@ui-doc/core';
2
2
  import type { Reader } from './Reader.types';
3
- export type RenderContext = Record<string, any>;
3
+ export type RenderContext = Record<string, unknown>;
4
4
  export type SourceInput = {
5
5
  source: string;
6
6
  content: string;
7
7
  } | Reader;
8
8
  export interface Renderer extends CoreRenderer {
9
- addLayout(name: string, layout: SourceInput): this;
10
- addPartial(name: string, partial: SourceInput): this;
11
- addPage(name: string, page: SourceInput): this;
12
- page(name: string, context: RenderContext): string;
13
- partial(name: string, context?: RenderContext): string;
9
+ addLayout: (name: string, layout: SourceInput) => this;
10
+ addPartial: (name: string, partial: SourceInput) => this;
11
+ addPage: (name: string, page: SourceInput) => this;
12
+ page: (name: string, context: RenderContext) => string;
13
+ partial: (name: string, context?: RenderContext) => string;
14
14
  }
@@ -1,7 +1,9 @@
1
1
  /**
2
- * Initialize expandable/collapsable elements by using the [aria-expanded](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-expanded) attribute.
2
+ * Initialize expandable/collapsable elements by using the
3
+ * [aria-expanded](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-expanded) attribute.
3
4
  *
4
- * When an element with the `aria-expanded` attribute is clicked, the value of the attribute will be toggled between `true` and `false`.
5
+ * When an element with the `aria-expanded` attribute is clicked, the value of the attribute will
6
+ * be toggled between `true` and `false`.
5
7
  *
6
8
  * @location functions.expand Expand
7
9
  * @example
@@ -52,7 +52,8 @@ function ready(callback) {
52
52
  }
53
53
  }
54
54
  /**
55
- * Animate an element using css animations/transitions. This function will add the necessary classes to the element to trigger the animation.
55
+ * Animate an element using css animations/transitions. This function will add the necessary
56
+ * classes to the element to trigger the animation.
56
57
  * When doing an entering animation following classes will be added:
57
58
  * - `[animation-name]-enter-active`
58
59
  * - `[animation-name]-enter-from`
@@ -62,9 +63,11 @@ function ready(callback) {
62
63
  * - `[animation-name]-leave-from`
63
64
  * - `[animation-name]-leave-to`
64
65
  *
65
- * The animation classes will be removed after the animation is done. If a callback is provided it will be called after the animation is done.
66
+ * The animation classes will be removed after the animation is done. If a callback is provided
67
+ * it will be called after the animation is done.
66
68
  *
67
- * The `-active` class will stay on the element until the animation is done. The `-from` class will be removed after the first frame and the `-to`
69
+ * The `-active` class will stay on the element until the animation is done. The `-from` class will
70
+ * be removed after the first frame and the `-to`
68
71
  * class will be added after the first frame.
69
72
  *
70
73
  * @param target html element to animate
@@ -92,7 +95,8 @@ function animate(target, animationName, entering, callback) {
92
95
  target.classList.add(animateClassActive, animateClassFrom);
93
96
  requestAnimationFrame(() => {
94
97
  const styles = window.getComputedStyle(target);
95
- // if the element has no transition or animation we can call the afterAnimation function in the next frame
98
+ // if the element has no transition or animation we can call the afterAnimation function in the
99
+ // next frame
96
100
  if (['all', 'none'].includes(styles.transition) && styles.animationName === 'none') {
97
101
  requestAnimationFrame(afterAnimation);
98
102
  }
@@ -122,8 +126,10 @@ function queryParentSelector(element, selector, maxDepth = 10) {
122
126
  }
123
127
 
124
128
  /**
125
- * Sometimes you need to prevent the user from interacting with other elements while an element is expanded. Then you need the [inert](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/inert) attribute.
126
- * You can set the `data-inert` attribute with selectors (comma separated) to control the `inert` attribute of elements matching your selectors.
129
+ * Sometimes you need to prevent the user from interacting with other elements while an element
130
+ * is expanded. Then you need the [inert](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/inert) attribute.
131
+ * You can set the `data-inert` attribute with selectors (comma separated) to control the
132
+ * `inert` attribute of elements matching your selectors.
127
133
  * @location functions.expand.with-inerts Expand controlling inert
128
134
  * @order 30
129
135
  * @example
@@ -144,13 +150,16 @@ function queryParentSelector(element, selector, maxDepth = 10) {
144
150
  */
145
151
  function toggleInert(target, show) {
146
152
  const inertSelector = target.getAttribute('data-inert');
147
- if (!inertSelector) {
153
+ if (inertSelector === null || inertSelector === '') {
148
154
  return;
149
155
  }
150
156
  inertSelector.split(',').forEach(selector => {
151
157
  // if the target is inside an element with the same selector, we don't want to remove the inert attribute
152
158
  const activeParentWithSameSelector = !show
153
- ? queryParentSelector(target.parentElement, `[data-inert="${selector}"],[data-inert^="${selector},"],[data-inert$=",${selector}"],[data-inert*=",${selector},"]`)
159
+ ? queryParentSelector(target.parentElement, `[data-inert="${selector}"],`
160
+ + `[data-inert^="${selector},"],`
161
+ + `[data-inert$=",${selector}"],`
162
+ + `[data-inert*=",${selector},"]`)
154
163
  : null;
155
164
  if (activeParentWithSameSelector) {
156
165
  return;
@@ -245,7 +254,7 @@ function toggleControlTarget(selector, show, callback) {
245
254
  });
246
255
  }
247
256
  toggleInert(target, show);
248
- if (animationName) {
257
+ if (animationName !== null && animationName !== '') {
249
258
  if (show) {
250
259
  toggleHide();
251
260
  animate(target, animationName, show);
@@ -259,9 +268,11 @@ function toggleControlTarget(selector, show, callback) {
259
268
  }
260
269
  }
261
270
  /**
262
- * Initialize expandable/collapsable elements by using the [aria-expanded](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-expanded) attribute.
271
+ * Initialize expandable/collapsable elements by using the
272
+ * [aria-expanded](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-expanded) attribute.
263
273
  *
264
- * When an element with the `aria-expanded` attribute is clicked, the value of the attribute will be toggled between `true` and `false`.
274
+ * When an element with the `aria-expanded` attribute is clicked, the value of the attribute will
275
+ * be toggled between `true` and `false`.
265
276
  *
266
277
  * @location functions.expand Expand
267
278
  * @example
@@ -290,7 +301,7 @@ function initExpand() {
290
301
  sibling.dispatchEvent(new MouseEvent('click', { bubbles: true, relatedTarget: expander }));
291
302
  });
292
303
  }
293
- if (controlTarget) {
304
+ if (controlTarget !== null && controlTarget !== '') {
294
305
  toggleControlTarget(`#${controlTarget}`, !expanded, toggleExpanded);
295
306
  }
296
307
  else {
@@ -298,7 +309,7 @@ function initExpand() {
298
309
  }
299
310
  };
300
311
  expander.addEventListener('click', toggle);
301
- if (controlTarget) {
312
+ if (controlTarget !== null && controlTarget !== '') {
302
313
  // select all controls inside the controlled area that have the same aria-controls attribute
303
314
  document
304
315
  .querySelectorAll(`#${controlTarget} [aria-controls="${controlTarget}"]`)
@@ -1 +1 @@
1
- {"version":3,"file":"ui-doc.cjs","sources":["../../../scripts/services/example.ts","../../../scripts/utils/dom.ts","../../../scripts/utils/select.ts","../../../scripts/services/expand.ts","../../../scripts/services/sidebar.ts","../../../scripts/app.ts"],"sourcesContent":["export function initExample() {\n document.querySelectorAll<HTMLIFrameElement>('[data-example] > iframe').forEach(iframe => {\n const document = iframe.contentDocument ?? iframe.contentWindow?.document\n\n if (!document) {\n return\n }\n\n const initHeightChange = () => {\n let currentHeight = 0\n const changeHeight = () => {\n if (document.body.scrollHeight === currentHeight) {\n return\n }\n\n currentHeight = document.body.scrollHeight\n iframe.style.height = `${currentHeight}px`\n }\n\n // Initial height change\n changeHeight()\n\n // Use MutationObserver to detect changes in the DOM and change height if required\n const mutationObserver = new MutationObserver(changeHeight)\n\n mutationObserver.observe(document.body, {\n attributes: true,\n childList: true,\n subtree: true,\n })\n\n // Use ResizeObserver to detect changes in the viewport and change height if required\n const resizeObserver = new ResizeObserver(changeHeight)\n\n resizeObserver.observe(document.body)\n }\n\n if (document.readyState === 'complete') {\n initHeightChange()\n } else {\n iframe.addEventListener('load', initHeightChange)\n }\n })\n}\n","/**\n * Run function when dom is ready\n *\n * @param callback function to run when dom is ready\n */\nexport function ready(callback: (this: Document) => void): void {\n if (document.readyState !== 'loading') {\n callback.call(document)\n } else {\n document.addEventListener('DOMContentLoaded', callback)\n }\n}\n\n/**\n * Animate an element using css animations/transitions. This function will add the necessary classes to the element to trigger the animation.\n * When doing an entering animation following classes will be added:\n * - `[animation-name]-enter-active`\n * - `[animation-name]-enter-from`\n * - `[animation-name]-enter-to`\n * When doing a leaving animation following classes will be added:\n * - `[animation-name]-leave-active`\n * - `[animation-name]-leave-from`\n * - `[animation-name]-leave-to`\n *\n * The animation classes will be removed after the animation is done. If a callback is provided it will be called after the animation is done.\n *\n * The `-active` class will stay on the element until the animation is done. The `-from` class will be removed after the first frame and the `-to`\n * class will be added after the first frame.\n *\n * @param target html element to animate\n * @param animationName animation name to be used\n * @param entering determine if the elements animation should be entering or leaving\n * @param callback to be called after the animation is done\n */\nexport function animate(\n target: HTMLElement,\n animationName: string,\n entering: boolean,\n callback?: () => void,\n): void {\n const animationState = entering ? 'enter' : 'leave'\n const animateClassActive = `${animationName}-${animationState}-active`\n const animateClassTo = `${animationName}-${animationState}-to`\n const animateClassFrom = `${animationName}-${animationState}-from`\n const afterAnimation = () => {\n target.classList.remove(animateClassTo, animateClassActive)\n target.removeEventListener('animationend', afterAnimation)\n target.removeEventListener('transitionend', afterAnimation)\n\n if (callback) {\n callback()\n }\n }\n\n target.addEventListener('animationend', afterAnimation)\n target.addEventListener('transitionend', afterAnimation)\n\n target.addEventListener('animationcancel', afterAnimation)\n target.addEventListener('transitioncancel', afterAnimation)\n\n target.classList.add(animateClassActive, animateClassFrom)\n requestAnimationFrame(() => {\n const styles = window.getComputedStyle(target)\n\n // if the element has no transition or animation we can call the afterAnimation function in the next frame\n if (['all', 'none'].includes(styles.transition) && styles.animationName === 'none') {\n requestAnimationFrame(afterAnimation)\n }\n\n target.classList.remove(animateClassFrom)\n target.classList.add(animateClassTo)\n })\n}\n","/**\n * Query the first parent element that matches the selector\n *\n * @param element to search in\n * @param selector to be matched\n * @param maxDepth maximum depth to search\n * @returns element that matches the selector\n */\n\nexport function queryParentSelector<K extends keyof HTMLElementTagNameMap>(\n element: HTMLElement | null,\n selector: K,\n maxDepth?: number,\n): HTMLElementTagNameMap[K] | null\nexport function queryParentSelector<K extends keyof SVGElementTagNameMap>(\n element: HTMLElement | null,\n selector: K,\n maxDepth?: number,\n): SVGElementTagNameMap[K] | null\nexport function queryParentSelector<K extends keyof MathMLElementTagNameMap>(\n element: HTMLElement | null,\n selectors: K,\n maxDepth?: number,\n): MathMLElementTagNameMap[K] | null\nexport function queryParentSelector<E extends Element = Element>(\n element: HTMLElement | null,\n selector: string,\n maxDepth?: number,\n): E | null\nexport function queryParentSelector(\n element: HTMLElement | null,\n selector: string,\n maxDepth = 10,\n): Element | null {\n if (maxDepth <= 0 || element === null) {\n return null\n }\n\n if (element.matches(selector)) {\n return element as Element\n }\n\n return element.parentElement\n ? queryParentSelector(element.parentElement, selector, maxDepth - 1)\n : null\n}\n","import { animate } from '../utils/dom'\nimport { queryParentSelector } from '../utils/select'\n\n/**\n * Sometimes you need to prevent the user from interacting with other elements while an element is expanded. Then you need the [inert](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/inert) attribute.\n * You can set the `data-inert` attribute with selectors (comma separated) to control the `inert` attribute of elements matching your selectors.\n * @location functions.expand.with-inerts Expand controlling inert\n * @order 30\n * @example\n * <style>\n * button::after {\n * content: ' ' attr(aria-expanded);\n * }\n * </style>\n * <button aria-expanded=\"false\" aria-controls=\"target\">Expanded:</button>\n * <div id=\"target\" hidden data-inert=\"[data-inert-controlled],#inert-controlled-2\">Controlled Target</div>\n * <div data-inert-controlled=\"\"><button>Button 1.1</button><button>Button 1.2</button></div>\n * <div id=\"inert-controlled-2\"><button>Button 2.1</button><button>Button 2.2</button></div>\n * @code\n * <button aria-expanded=\"false\" aria-controls=\"target\">Expanded:</button>\n * <div id=\"target\" hidden data-inert=\"[data-inert-controlled],#inert-controlled-2\">Controlled Target</div>\n * <div data-inert-controlled=\"1\"><button>Button 1.1</button><button>Button 1.2</button></div>\n * <div id=\"inert-controlled-2\"><button>Button 2.1</button><button>Button 2.2</button></div>\n */\nfunction toggleInert(target: HTMLElement, show: boolean): void {\n const inertSelector = target.getAttribute('data-inert')\n\n if (!inertSelector) {\n return\n }\n\n inertSelector.split(',').forEach(selector => {\n // if the target is inside an element with the same selector, we don't want to remove the inert attribute\n const activeParentWithSameSelector = !show\n ? queryParentSelector(\n target.parentElement,\n `[data-inert=\"${selector}\"],[data-inert^=\"${selector},\"],[data-inert$=\",${selector}\"],[data-inert*=\",${selector},\"]`,\n )\n : null\n\n if (activeParentWithSameSelector) {\n return\n }\n\n document.querySelectorAll(selector).forEach(invertOn => {\n if (show) {\n invertOn.setAttribute('inert', '')\n } else {\n invertOn.removeAttribute('inert')\n }\n })\n })\n}\n\n/**\n * If you want to control a specific aria you can combine [aria-expanded](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-expanded) attribute with [aria-controls](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-controls) attribute.\n *\n * When an element with the `aria-expanded` attribute is clicked, the value of the attribute will be toggled between `true` and `false`. Also the element with the id specified in the `aria-controls` attribute will be toggled between `aria-hidden=\"true\"` and `aria-hidden=\"false\"`. If no `aria-hidden` attribute is present, the `hidden` attribute will be used.`\n *\n * @location functions.expand.with-controls Expand with controls\n * @order 10\n * @example\n * <style>\n * button::after {\n * content: ' ' attr(aria-expanded);\n * }\n * </style>\n * <button aria-expanded=\"true\" aria-controls=\"target-aria-hidden\">Expanded:</button>\n * <div id=\"target-aria-hidden\" aria-hidden=\"false\">Controlled Target</div>\n * <hr>\n * <button aria-expanded=\"true\" aria-controls=\"target-hidden\">Expanded:</button>\n * <div id=\"target-hidden\">Controlled Target</div>\n * @code\n * <button aria-expanded=\"true\" aria-controls=\"target-aria-hidden\">Expanded:</button>\n * <div id=\"target-aria-hidden\" aria-hidden=\"false\">Controlled Target</div>\n * <hr>\n * <button aria-expanded=\"true\" aria-controls=\"target-hidden\">Expanded:</button>\n * <div id=\"target-hidden\">Controlled Target</div>\n */\n\n/**\n * You can add animations/transitions on the controlled element by adding the `data-animate` attribute with the animation name.\n * The animation name will be used to add the necessary classes to the element to trigger the animation.\n * Please refer to the animate function for more information, what classes will be added and when.\n *\n * @location functions.expand.with-animation Expand with animation\n * @order 20\n * @example\n * <style>\n * .fade-enter-active,\n * .fade-leave-active {\n * transition: opacity 0.5s ease;\n * }\n *\n * .fade-enter-from,\n * .fade-leave-to {\n * opacity: 0;\n * }\n * </style>\n * <button aria-expanded=\"true\" aria-controls=\"target-hidden\">Toggle Controlled Area</button>\n * <div id=\"target-hidden\" data-animate=\"fade\">Controlled Target</div>\n */\nfunction toggleControlTarget(selector: string, show: boolean, callback: () => void): void {\n const target = document.querySelector<HTMLElement>(selector)\n\n if (!target) {\n return\n }\n\n const animationName = target.getAttribute('data-animate')\n const toggleHide = () => {\n if (target.hasAttribute('aria-hidden')) {\n target.setAttribute('aria-hidden', show ? 'false' : 'true')\n } else if (show) {\n target.removeAttribute('hidden')\n } else {\n target.setAttribute('hidden', '')\n }\n\n callback()\n }\n\n if (show) {\n // set tabindex=0 for all elements with tabindex=-1 that are not inside an aria-hidden element\n target\n .querySelectorAll<HTMLElement>(\n ':scope > [tabindex=\"-1\"], [tabindex=\"-1\"]:not([aria-hidden=\"true\"] [tabindex=\"-1\"], [hidden] [tabindex=\"-1\"])',\n )\n .forEach(el => {\n el.setAttribute('tabindex', '0')\n })\n } else {\n // set tabindex=-1 for all elements with tabindex=0\n target.querySelectorAll<HTMLElement>('[tabindex=\"0\"]').forEach(el => {\n el.setAttribute('tabindex', '-1')\n })\n }\n\n toggleInert(target, show)\n\n if (animationName) {\n if (show) {\n toggleHide()\n animate(target, animationName, show)\n } else {\n animate(target, animationName, show, toggleHide)\n }\n } else {\n toggleHide()\n }\n}\n\n/**\n * Initialize expandable/collapsable elements by using the [aria-expanded](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-expanded) attribute.\n *\n * When an element with the `aria-expanded` attribute is clicked, the value of the attribute will be toggled between `true` and `false`.\n *\n * @location functions.expand Expand\n * @example\n * <style>\n * button::after {\n * content: ' ' attr(aria-expanded);\n * }\n * </style>\n * <button aria-expanded=\"false\">Expanded:</button>\n * @code\n * <button aria-expanded=\"false\">Expanded:</button>\n */\nexport function initExpand(): void {\n document.querySelectorAll<HTMLElement>('[aria-expanded]').forEach(expander => {\n const controlTarget = expander.getAttribute('aria-controls')\n const toggle = (e: MouseEvent) => {\n const expanded = expander.getAttribute('aria-expanded') === 'true'\n const toggleExpanded = () => {\n expander.setAttribute('aria-expanded', expanded ? 'false' : 'true') // when expanded we need to set false\n }\n\n // if data-hide-same-level is set, we need to klick all other expanded elements to close them\n if (expander.parentElement && expander.hasAttribute('data-hide-same-level')) {\n Array.from(expander.parentElement.querySelectorAll(':scope > [aria-expanded=\"true\"]'))\n .filter(el => el !== expander && el !== e.relatedTarget)\n .forEach(sibling => {\n sibling.dispatchEvent(\n new MouseEvent('click', { bubbles: true, relatedTarget: expander }),\n )\n })\n }\n\n if (controlTarget) {\n toggleControlTarget(`#${controlTarget}`, !expanded, toggleExpanded)\n } else {\n toggleExpanded()\n }\n }\n\n expander.addEventListener('click', toggle)\n\n if (controlTarget) {\n // select all controls inside the controlled area that have the same aria-controls attribute\n document\n .querySelectorAll<HTMLElement>(`#${controlTarget} [aria-controls=\"${controlTarget}\"]`)\n .forEach(control => {\n control.addEventListener('click', toggle)\n })\n }\n })\n}\n","function createSidebar(sidebar: HTMLElement) {\n const links: Record<string, HTMLLinkElement> = {}\n const observer = new IntersectionObserver(\n entries => {\n const activeEntries = entries.filter(entry => entry.isIntersecting)\n\n if (activeEntries.length <= 0) {\n return\n }\n\n Object.keys(links).forEach(id => {\n links[id].classList.remove('active')\n })\n\n const activeLink = links[activeEntries[0].target.id]\n\n activeLink.classList.add('active')\n if (activeLink?.parentElement?.parentElement?.parentElement instanceof HTMLLIElement) {\n activeLink.parentElement.parentElement.parentElement\n .querySelector('a')\n ?.classList.add('active')\n }\n },\n {\n root: null,\n rootMargin: '0px 0px -90% 0px',\n threshold: 0.5,\n },\n )\n\n sidebar.querySelectorAll<HTMLLinkElement>('a[href^=\"#\"]').forEach(link => {\n const id = link.href.split('#')[1]\n const target = document.getElementById(id)\n\n if (target) {\n observer.observe(target)\n links[id] = link\n }\n })\n}\n\nexport function initSidebar() {\n document.querySelectorAll('[data-sidebar]').forEach(sidebar => {\n createSidebar(sidebar as HTMLElement)\n })\n}\n","import { initExample } from './services/example'\nimport { initExpand } from './services/expand'\nimport { initSidebar } from './services/sidebar'\nimport { ready } from './utils/dom'\n\nready(() => {\n initExpand()\n initExample()\n initSidebar()\n})\n"],"names":[],"mappings":";;SAAgB,WAAW,GAAA;IACzB,QAAQ,CAAC,gBAAgB,CAAoB,yBAAyB,CAAC,CAAC,OAAO,CAAC,MAAM,IAAG;;AACvF,QAAA,MAAM,QAAQ,GAAG,CAAA,EAAA,GAAA,MAAM,CAA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MAAM,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;QAClC,MAAM,MAAM,GAAG,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC,CAAA;QAE1C,IAAI,MAAM,EAAE;AACV,YAAA,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;AACxB,YAAA,KAAK,CAAC,EAAE,CAAC,GAAG,IAAI,CAAA;SACjB;AACH,KAAC,CAAC,CAAA;AACJ,CAAC;SAEe,WAAW,GAAA;IACzB,QAAQ,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,CAAC,OAAO,CAAC,OAAO,IAAG;QAC5D,aAAa,CAAC,OAAsB,CAAC,CAAA;AACvC,KAAC,CAAC,CAAA;AACJ;;ACxCA,KAAK,CAAC,MAAK;AACT,IAAA,UAAU,EAAE,CAAA;AACZ,IAAA,WAAW,EAAE,CAAA;AACb,IAAA,WAAW,EAAE,CAAA;AACf,CAAC,CAAC;;"}
1
+ {"version":3,"file":"ui-doc.cjs","sources":["../../../scripts/services/example.ts","../../../scripts/utils/dom.ts","../../../scripts/utils/select.ts","../../../scripts/services/expand.ts","../../../scripts/services/sidebar.ts","../../../scripts/app.ts"],"sourcesContent":["export function initExample(): void {\n document.querySelectorAll<HTMLIFrameElement>('[data-example] > iframe').forEach(iframe => {\n const document = iframe.contentDocument ?? iframe.contentWindow?.document\n\n if (!document) {\n return\n }\n\n const initHeightChange = (): void => {\n let currentHeight = 0\n const changeHeight = (): void => {\n if (document.body.scrollHeight === currentHeight) {\n return\n }\n\n currentHeight = document.body.scrollHeight\n iframe.style.height = `${currentHeight}px`\n }\n\n // Initial height change\n changeHeight()\n\n // Use MutationObserver to detect changes in the DOM and change height if required\n const mutationObserver = new MutationObserver(changeHeight)\n\n mutationObserver.observe(document.body, {\n attributes: true,\n childList: true,\n subtree: true,\n })\n\n // Use ResizeObserver to detect changes in the viewport and change height if required\n const resizeObserver = new ResizeObserver(changeHeight)\n\n resizeObserver.observe(document.body)\n }\n\n if (document.readyState === 'complete') {\n initHeightChange()\n } else {\n iframe.addEventListener('load', initHeightChange)\n }\n })\n}\n","/**\n * Run function when dom is ready\n *\n * @param callback function to run when dom is ready\n */\nexport function ready(callback: (this: Document) => void): void {\n if (document.readyState !== 'loading') {\n callback.call(document)\n } else {\n document.addEventListener('DOMContentLoaded', callback)\n }\n}\n\n/**\n * Animate an element using css animations/transitions. This function will add the necessary\n * classes to the element to trigger the animation.\n * When doing an entering animation following classes will be added:\n * - `[animation-name]-enter-active`\n * - `[animation-name]-enter-from`\n * - `[animation-name]-enter-to`\n * When doing a leaving animation following classes will be added:\n * - `[animation-name]-leave-active`\n * - `[animation-name]-leave-from`\n * - `[animation-name]-leave-to`\n *\n * The animation classes will be removed after the animation is done. If a callback is provided\n * it will be called after the animation is done.\n *\n * The `-active` class will stay on the element until the animation is done. The `-from` class will\n * be removed after the first frame and the `-to`\n * class will be added after the first frame.\n *\n * @param target html element to animate\n * @param animationName animation name to be used\n * @param entering determine if the elements animation should be entering or leaving\n * @param callback to be called after the animation is done\n */\nexport function animate(\n target: HTMLElement,\n animationName: string,\n entering: boolean,\n callback?: () => void,\n): void {\n const animationState = entering ? 'enter' : 'leave'\n const animateClassActive = `${animationName}-${animationState}-active`\n const animateClassTo = `${animationName}-${animationState}-to`\n const animateClassFrom = `${animationName}-${animationState}-from`\n const afterAnimation = (): void => {\n target.classList.remove(animateClassTo, animateClassActive)\n target.removeEventListener('animationend', afterAnimation)\n target.removeEventListener('transitionend', afterAnimation)\n\n if (callback) {\n callback()\n }\n }\n\n target.addEventListener('animationend', afterAnimation)\n target.addEventListener('transitionend', afterAnimation)\n\n target.addEventListener('animationcancel', afterAnimation)\n target.addEventListener('transitioncancel', afterAnimation)\n\n target.classList.add(animateClassActive, animateClassFrom)\n requestAnimationFrame(() => {\n const styles = window.getComputedStyle(target)\n\n // if the element has no transition or animation we can call the afterAnimation function in the\n // next frame\n if (['all', 'none'].includes(styles.transition) && styles.animationName === 'none') {\n requestAnimationFrame(afterAnimation)\n }\n\n target.classList.remove(animateClassFrom)\n target.classList.add(animateClassTo)\n })\n}\n","/**\n * Query the first parent element that matches the selector\n *\n * @param element to search in\n * @param selector to be matched\n * @param maxDepth maximum depth to search\n * @returns element that matches the selector\n */\n\nexport function queryParentSelector<K extends keyof HTMLElementTagNameMap>(\n element: HTMLElement | null,\n selector: K,\n maxDepth?: number,\n): HTMLElementTagNameMap[K] | null\nexport function queryParentSelector<K extends keyof SVGElementTagNameMap>(\n element: HTMLElement | null,\n selector: K,\n maxDepth?: number,\n): SVGElementTagNameMap[K] | null\nexport function queryParentSelector<K extends keyof MathMLElementTagNameMap>(\n element: HTMLElement | null,\n selectors: K,\n maxDepth?: number,\n): MathMLElementTagNameMap[K] | null\nexport function queryParentSelector<E extends Element = Element>(\n element: HTMLElement | null,\n selector: string,\n maxDepth?: number,\n): E | null\nexport function queryParentSelector(\n element: HTMLElement | null,\n selector: string,\n maxDepth = 10,\n): Element | null {\n if (maxDepth <= 0 || element === null) {\n return null\n }\n\n if (element.matches(selector)) {\n return element as Element\n }\n\n return element.parentElement\n ? queryParentSelector(element.parentElement, selector, maxDepth - 1)\n : null\n}\n","import { animate } from '../utils/dom'\nimport { queryParentSelector } from '../utils/select'\n\n/**\n * Sometimes you need to prevent the user from interacting with other elements while an element\n * is expanded. Then you need the [inert](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/inert) attribute.\n * You can set the `data-inert` attribute with selectors (comma separated) to control the\n * `inert` attribute of elements matching your selectors.\n * @location functions.expand.with-inerts Expand controlling inert\n * @order 30\n * @example\n * <style>\n * button::after {\n * content: ' ' attr(aria-expanded);\n * }\n * </style>\n * <button aria-expanded=\"false\" aria-controls=\"target\">Expanded:</button>\n * <div id=\"target\" hidden data-inert=\"[data-inert-controlled],#inert-controlled-2\">Controlled Target</div>\n * <div data-inert-controlled=\"\"><button>Button 1.1</button><button>Button 1.2</button></div>\n * <div id=\"inert-controlled-2\"><button>Button 2.1</button><button>Button 2.2</button></div>\n * @code\n * <button aria-expanded=\"false\" aria-controls=\"target\">Expanded:</button>\n * <div id=\"target\" hidden data-inert=\"[data-inert-controlled],#inert-controlled-2\">Controlled Target</div>\n * <div data-inert-controlled=\"1\"><button>Button 1.1</button><button>Button 1.2</button></div>\n * <div id=\"inert-controlled-2\"><button>Button 2.1</button><button>Button 2.2</button></div>\n */\nfunction toggleInert(target: HTMLElement, show: boolean): void {\n const inertSelector = target.getAttribute('data-inert')\n\n if (inertSelector === null || inertSelector === '') {\n return\n }\n\n inertSelector.split(',').forEach(selector => {\n // if the target is inside an element with the same selector, we don't want to remove the inert attribute\n const activeParentWithSameSelector = !show\n ? queryParentSelector(\n target.parentElement,\n `[data-inert=\"${selector}\"],`\n + `[data-inert^=\"${selector},\"],`\n + `[data-inert$=\",${selector}\"],`\n + `[data-inert*=\",${selector},\"]`,\n )\n : null\n\n if (activeParentWithSameSelector) {\n return\n }\n\n document.querySelectorAll(selector).forEach(invertOn => {\n if (show) {\n invertOn.setAttribute('inert', '')\n } else {\n invertOn.removeAttribute('inert')\n }\n })\n })\n}\n\n/**\n * If you want to control a specific aria you can combine [aria-expanded](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-expanded) attribute with [aria-controls](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-controls) attribute.\n *\n * When an element with the `aria-expanded` attribute is clicked, the value of the attribute will be toggled between `true` and `false`. Also the element with the id specified in the `aria-controls` attribute will be toggled between `aria-hidden=\"true\"` and `aria-hidden=\"false\"`. If no `aria-hidden` attribute is present, the `hidden` attribute will be used.`\n *\n * @location functions.expand.with-controls Expand with controls\n * @order 10\n * @example\n * <style>\n * button::after {\n * content: ' ' attr(aria-expanded);\n * }\n * </style>\n * <button aria-expanded=\"true\" aria-controls=\"target-aria-hidden\">Expanded:</button>\n * <div id=\"target-aria-hidden\" aria-hidden=\"false\">Controlled Target</div>\n * <hr>\n * <button aria-expanded=\"true\" aria-controls=\"target-hidden\">Expanded:</button>\n * <div id=\"target-hidden\">Controlled Target</div>\n * @code\n * <button aria-expanded=\"true\" aria-controls=\"target-aria-hidden\">Expanded:</button>\n * <div id=\"target-aria-hidden\" aria-hidden=\"false\">Controlled Target</div>\n * <hr>\n * <button aria-expanded=\"true\" aria-controls=\"target-hidden\">Expanded:</button>\n * <div id=\"target-hidden\">Controlled Target</div>\n */\n\n/**\n * You can add animations/transitions on the controlled element by adding the `data-animate` attribute with the animation name.\n * The animation name will be used to add the necessary classes to the element to trigger the animation.\n * Please refer to the animate function for more information, what classes will be added and when.\n *\n * @location functions.expand.with-animation Expand with animation\n * @order 20\n * @example\n * <style>\n * .fade-enter-active,\n * .fade-leave-active {\n * transition: opacity 0.5s ease;\n * }\n *\n * .fade-enter-from,\n * .fade-leave-to {\n * opacity: 0;\n * }\n * </style>\n * <button aria-expanded=\"true\" aria-controls=\"target-hidden\">Toggle Controlled Area</button>\n * <div id=\"target-hidden\" data-animate=\"fade\">Controlled Target</div>\n */\nfunction toggleControlTarget(selector: string, show: boolean, callback: () => void): void {\n const target = document.querySelector<HTMLElement>(selector)\n\n if (!target) {\n return\n }\n\n const animationName = target.getAttribute('data-animate')\n const toggleHide = (): void => {\n if (target.hasAttribute('aria-hidden')) {\n target.setAttribute('aria-hidden', show ? 'false' : 'true')\n } else if (show) {\n target.removeAttribute('hidden')\n } else {\n target.setAttribute('hidden', '')\n }\n\n callback()\n }\n\n if (show) {\n // set tabindex=0 for all elements with tabindex=-1 that are not inside an aria-hidden element\n target\n .querySelectorAll<HTMLElement>(\n ':scope > [tabindex=\"-1\"], [tabindex=\"-1\"]:not([aria-hidden=\"true\"] [tabindex=\"-1\"], [hidden] [tabindex=\"-1\"])',\n )\n .forEach(el => {\n el.setAttribute('tabindex', '0')\n })\n } else {\n // set tabindex=-1 for all elements with tabindex=0\n target.querySelectorAll<HTMLElement>('[tabindex=\"0\"]').forEach(el => {\n el.setAttribute('tabindex', '-1')\n })\n }\n\n toggleInert(target, show)\n\n if (animationName !== null && animationName !== '') {\n if (show) {\n toggleHide()\n animate(target, animationName, show)\n } else {\n animate(target, animationName, show, toggleHide)\n }\n } else {\n toggleHide()\n }\n}\n\n/**\n * Initialize expandable/collapsable elements by using the\n * [aria-expanded](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-expanded) attribute.\n *\n * When an element with the `aria-expanded` attribute is clicked, the value of the attribute will\n * be toggled between `true` and `false`.\n *\n * @location functions.expand Expand\n * @example\n * <style>\n * button::after {\n * content: ' ' attr(aria-expanded);\n * }\n * </style>\n * <button aria-expanded=\"false\">Expanded:</button>\n * @code\n * <button aria-expanded=\"false\">Expanded:</button>\n */\nexport function initExpand(): void {\n document.querySelectorAll<HTMLElement>('[aria-expanded]').forEach(expander => {\n const controlTarget = expander.getAttribute('aria-controls')\n const toggle = (e: MouseEvent): void => {\n const expanded = expander.getAttribute('aria-expanded') === 'true'\n const toggleExpanded = (): void => {\n expander.setAttribute('aria-expanded', expanded ? 'false' : 'true') // when expanded we need to set false\n }\n\n // if data-hide-same-level is set, we need to klick all other expanded elements to close them\n if (expander.parentElement && expander.hasAttribute('data-hide-same-level')) {\n Array.from(expander.parentElement.querySelectorAll(':scope > [aria-expanded=\"true\"]'))\n .filter(el => el !== expander && el !== e.relatedTarget)\n .forEach(sibling => {\n sibling.dispatchEvent(\n new MouseEvent('click', { bubbles: true, relatedTarget: expander }),\n )\n })\n }\n\n if (controlTarget !== null && controlTarget !== '') {\n toggleControlTarget(`#${controlTarget}`, !expanded, toggleExpanded)\n } else {\n toggleExpanded()\n }\n }\n\n expander.addEventListener('click', toggle)\n\n if (controlTarget !== null && controlTarget !== '') {\n // select all controls inside the controlled area that have the same aria-controls attribute\n document\n .querySelectorAll<HTMLElement>(`#${controlTarget} [aria-controls=\"${controlTarget}\"]`)\n .forEach(control => {\n control.addEventListener('click', toggle)\n })\n }\n })\n}\n","function createSidebar(sidebar: HTMLElement): void {\n const links: Record<string, HTMLLinkElement> = {}\n const observer = new IntersectionObserver(\n entries => {\n const activeEntries = entries.filter(entry => entry.isIntersecting)\n\n if (activeEntries.length <= 0) {\n return\n }\n\n Object.keys(links).forEach(id => {\n links[id].classList.remove('active')\n })\n\n const activeLink = links[activeEntries[0].target.id]\n\n activeLink.classList.add('active')\n if (activeLink?.parentElement?.parentElement?.parentElement instanceof HTMLLIElement) {\n activeLink.parentElement.parentElement.parentElement\n .querySelector('a')\n ?.classList\n .add('active')\n }\n },\n {\n root: null,\n rootMargin: '0px 0px -90% 0px',\n threshold: 0.5,\n },\n )\n\n sidebar.querySelectorAll<HTMLLinkElement>('a[href^=\"#\"]').forEach(link => {\n const id = link.href.split('#')[1]\n const target = document.getElementById(id)\n\n if (target) {\n observer.observe(target)\n links[id] = link\n }\n })\n}\n\nexport function initSidebar(): void {\n document.querySelectorAll('[data-sidebar]').forEach(sidebar => {\n createSidebar(sidebar as HTMLElement)\n })\n}\n","import { initExample } from './services/example'\nimport { initExpand } from './services/expand'\nimport { initSidebar } from './services/sidebar'\nimport { ready } from './utils/dom'\n\nready(() => {\n initExpand()\n initExample()\n initSidebar()\n})\n"],"names":[],"mappings":";;SAAgB,WAAW,GAAA;IACzB,QAAQ,CAAC,gBAAgB,CAAoB,yBAAyB,CAAC,CAAC,OAAO,CAAC,MAAM,IAAG;;AACvF,QAAA,MAAM,QAAQ,GAAG,CAAA,EAAA,GAAA,MAAM,CAAC,eAAe,MAAI,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAA,CAAA,EAAA,GAAA,MAAM,CAAC,aAAa,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAE,QAAQ,CAAA;QAEzE,IAAI,CAAC,QAAQ,EAAE;YACb,OAAM;SACP;QAED,MAAM,gBAAgB,GAAG,MAAW;YAClC,IAAI,aAAa,GAAG,CAAC,CAAA;YACrB,MAA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MAAM,MAAM,GAAG,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC,CAAA;QAE1C,IAAI,MAAM,EAAE;AACV,YAAA,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;AACxB,YAAA,KAAK,CAAC,EAAE,CAAC,GAAG,IAAI,CAAA;SACjB;AACH,KAAC,CAAC,CAAA;AACJ,CAAC;SAEe,WAAW,GAAA;IACzB,QAAQ,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,CAAC,OAAO,CAAC,OAAO,IAAG;QAC5D,aAAa,CAAC,OAAsB,CAAC,CAAA;AACvC,KAAC,CAAC,CAAA;AACJ;;ACzCA,KAAK,CAAC,MAAK;AACT,IAAA,UAAU,EAAE,CAAA;AACZ,IAAA,WAAW,EAAE,CAAA;AACb,IAAA,WAAW,EAAE,CAAA;AACf,CAAC,CAAC;;"}
@@ -1 +1 @@
1
- !function(){"use strict";function e(e,t,n,r){const a=n?"enter":"leave",i=`${t}-${a}-active`,o=`${t}-${a}-to`,l=`${t}-${a}-from`,d=()=>{e.classList.remove(o,i),e.removeEventListener("animationend",d),e.removeEventListener("transitionend",d),r&&r()};e.addEventListener("animationend",d),e.addEventListener("transitionend",d),e.addEventListener("animationcancel",d),e.addEventListener("transitioncancel",d),e.classList.add(i,l),requestAnimationFrame((()=>{const t=window.getComputedStyle(e);["all","none"].includes(t.transition)&&"none"===t.animationName&&requestAnimationFrame(d),e.classList.remove(l),e.classList.add(o)}))}function t(e,n,r=10){return r<=0||null===e?null:e.matches(n)?e:e.parentElement?t(e.parentElement,n,r-1):null}function n(e,n){const r=e.getAttribute("data-inert");r&&r.split(",").forEach((r=>{(n?null:t(e.parentElement,`[data-inert="${r}"],[data-inert^="${r},"],[data-inert$=",${r}"],[data-inert*=",${r},"]`))||document.querySelectorAll(r).forEach((e=>{n?e.setAttribute("inert",""):e.removeAttribute("inert")}))}))}function r(){document.querySelectorAll("[aria-expanded]").forEach((t=>{const r=t.getAttribute("aria-controls"),a=a=>{const i="true"===t.getAttribute("aria-expanded"),o=()=>{t.setAttribute("aria-expanded",i?"false":"true")};t.parentElement&&t.hasAttribute("data-hide-same-level")&&Array.from(t.parentElement.querySelectorAll(':scope > [aria-expanded="true"]')).filter((e=>e!==t&&e!==a.relatedTarget)).forEach((e=>{e.dispatchEvent(new MouseEvent("click",{bubbles:!0,relatedTarget:t}))})),r?function(t,r,a){const i=document.querySelector(t);if(!i)return;const o=i.getAttribute("data-animate"),l=()=>{i.hasAttribute("aria-hidden")?i.setAttribute("aria-hidden",r?"false":"true"):r?i.removeAttribute("hidden"):i.setAttribute("hidden",""),a()};r?i.querySelectorAll(':scope > [tabindex="-1"], [tabindex="-1"]:not([aria-hidden="true"] [tabindex="-1"], [hidden] [tabindex="-1"])').forEach((e=>{e.setAttribute("tabindex","0")})):i.querySelectorAll('[tabindex="0"]').forEach((e=>{e.setAttribute("tabindex","-1")})),n(i,r),o?r?(l(),e(i,o,r)):e(i,o,r,l):l()}(`#${r}`,!i,o):o()};t.addEventListener("click",a),r&&document.querySelectorAll(`#${r} [aria-controls="${r}"]`).forEach((e=>{e.addEventListener("click",a)}))}))}function a(){document.querySelectorAll("[data-sidebar]").forEach((e=>{!function(e){const t={},n=new IntersectionObserver((e=>{var n,r,a;const i=e.filter((e=>e.isIntersecting));if(i.length<=0)return;Object.keys(t).forEach((e=>{t[e].classList.remove("active")}));const o=t[i[0].target.id];o.classList.add("active"),(null===(r=null===(n=null==o?void 0:o.parentElement)||void 0===n?void 0:n.parentElement)||void 0===r?void 0:r.parentElement)instanceof HTMLLIElement&&(null===(a=o.parentElement.parentElement.parentElement.querySelector("a"))||void 0===a||a.classList.add("active"))}),{root:null,rootMargin:"0px 0px -90% 0px",threshold:.5});e.querySelectorAll('a[href^="#"]').forEach((e=>{const r=e.href.split("#")[1],a=document.getElementById(r);a&&(n.observe(a),t[r]=e)}))}(e)}))}var i;i=()=>{r(),document.querySelectorAll("[data-example] > iframe").forEach((e=>{var t,n;const r=null!==(t=e.contentDocument)&&void 0!==t?t:null===(n=e.contentWindow)||void 0===n?void 0:n.document;if(!r)return;const a=()=>{let t=0;const n=()=>{r.body.scrollHeight!==t&&(t=r.body.scrollHeight,e.style.height=`${t}px`)};n(),new MutationObserver(n).observe(r.body,{attributes:!0,childList:!0,subtree:!0}),new ResizeObserver(n).observe(r.body)};"complete"===r.readyState?a():e.addEventListener("load",a)})),a()},"loading"!==document.readyState?i.call(document):document.addEventListener("DOMContentLoaded",i)}();
1
+ !function(){"use strict";function e(e,t,n,r){const a=n?"enter":"leave",i=`${t}-${a}-active`,o=`${t}-${a}-to`,l=`${t}-${a}-from`,d=()=>{e.classList.remove(o,i),e.removeEventListener("animationend",d),e.removeEventListener("transitionend",d),r&&r()};e.addEventListener("animationend",d),e.addEventListener("transitionend",d),e.addEventListener("animationcancel",d),e.addEventListener("transitioncancel",d),e.classList.add(i,l),requestAnimationFrame((()=>{const t=window.getComputedStyle(e);["all","none"].includes(t.transition)&&"none"===t.animationName&&requestAnimationFrame(d),e.classList.remove(l),e.classList.add(o)}))}function t(e,n,r=10){return r<=0||null===e?null:e.matches(n)?e:e.parentElement?t(e.parentElement,n,r-1):null}function n(e,n){const r=e.getAttribute("data-inert");null!==r&&""!==r&&r.split(",").forEach((r=>{(n?null:t(e.parentElement,`[data-inert="${r}"],[data-inert^="${r},"],[data-inert$=",${r}"],[data-inert*=",${r},"]`))||document.querySelectorAll(r).forEach((e=>{n?e.setAttribute("inert",""):e.removeAttribute("inert")}))}))}function r(){document.querySelectorAll("[aria-expanded]").forEach((t=>{const r=t.getAttribute("aria-controls"),a=a=>{const i="true"===t.getAttribute("aria-expanded"),o=()=>{t.setAttribute("aria-expanded",i?"false":"true")};t.parentElement&&t.hasAttribute("data-hide-same-level")&&Array.from(t.parentElement.querySelectorAll(':scope > [aria-expanded="true"]')).filter((e=>e!==t&&e!==a.relatedTarget)).forEach((e=>{e.dispatchEvent(new MouseEvent("click",{bubbles:!0,relatedTarget:t}))})),null!==r&&""!==r?function(t,r,a){const i=document.querySelector(t);if(!i)return;const o=i.getAttribute("data-animate"),l=()=>{i.hasAttribute("aria-hidden")?i.setAttribute("aria-hidden",r?"false":"true"):r?i.removeAttribute("hidden"):i.setAttribute("hidden",""),a()};r?i.querySelectorAll(':scope > [tabindex="-1"], [tabindex="-1"]:not([aria-hidden="true"] [tabindex="-1"], [hidden] [tabindex="-1"])').forEach((e=>{e.setAttribute("tabindex","0")})):i.querySelectorAll('[tabindex="0"]').forEach((e=>{e.setAttribute("tabindex","-1")})),n(i,r),null!==o&&""!==o?r?(l(),e(i,o,r)):e(i,o,r,l):l()}(`#${r}`,!i,o):o()};t.addEventListener("click",a),null!==r&&""!==r&&document.querySelectorAll(`#${r} [aria-controls="${r}"]`).forEach((e=>{e.addEventListener("click",a)}))}))}function a(){document.querySelectorAll("[data-sidebar]").forEach((e=>{!function(e){const t={},n=new IntersectionObserver((e=>{var n,r,a;const i=e.filter((e=>e.isIntersecting));if(i.length<=0)return;Object.keys(t).forEach((e=>{t[e].classList.remove("active")}));const o=t[i[0].target.id];o.classList.add("active"),(null===(r=null===(n=null==o?void 0:o.parentElement)||void 0===n?void 0:n.parentElement)||void 0===r?void 0:r.parentElement)instanceof HTMLLIElement&&(null===(a=o.parentElement.parentElement.parentElement.querySelector("a"))||void 0===a||a.classList.add("active"))}),{root:null,rootMargin:"0px 0px -90% 0px",threshold:.5});e.querySelectorAll('a[href^="#"]').forEach((e=>{const r=e.href.split("#")[1],a=document.getElementById(r);a&&(n.observe(a),t[r]=e)}))}(e)}))}var i;i=()=>{r(),document.querySelectorAll("[data-example] > iframe").forEach((e=>{var t,n;const r=null!==(t=e.contentDocument)&&void 0!==t?t:null===(n=e.contentWindow)||void 0===n?void 0:n.document;if(!r)return;const a=()=>{let t=0;const n=()=>{r.body.scrollHeight!==t&&(t=r.body.scrollHeight,e.style.height=`${t}px`)};n(),new MutationObserver(n).observe(r.body,{attributes:!0,childList:!0,subtree:!0}),new ResizeObserver(n).observe(r.body)};"complete"===r.readyState?a():e.addEventListener("load",a)})),a()},"loading"!==document.readyState?i.call(document):document.addEventListener("DOMContentLoaded",i)}();
@@ -50,7 +50,8 @@ function ready(callback) {
50
50
  }
51
51
  }
52
52
  /**
53
- * Animate an element using css animations/transitions. This function will add the necessary classes to the element to trigger the animation.
53
+ * Animate an element using css animations/transitions. This function will add the necessary
54
+ * classes to the element to trigger the animation.
54
55
  * When doing an entering animation following classes will be added:
55
56
  * - `[animation-name]-enter-active`
56
57
  * - `[animation-name]-enter-from`
@@ -60,9 +61,11 @@ function ready(callback) {
60
61
  * - `[animation-name]-leave-from`
61
62
  * - `[animation-name]-leave-to`
62
63
  *
63
- * The animation classes will be removed after the animation is done. If a callback is provided it will be called after the animation is done.
64
+ * The animation classes will be removed after the animation is done. If a callback is provided
65
+ * it will be called after the animation is done.
64
66
  *
65
- * The `-active` class will stay on the element until the animation is done. The `-from` class will be removed after the first frame and the `-to`
67
+ * The `-active` class will stay on the element until the animation is done. The `-from` class will
68
+ * be removed after the first frame and the `-to`
66
69
  * class will be added after the first frame.
67
70
  *
68
71
  * @param target html element to animate
@@ -90,7 +93,8 @@ function animate(target, animationName, entering, callback) {
90
93
  target.classList.add(animateClassActive, animateClassFrom);
91
94
  requestAnimationFrame(() => {
92
95
  const styles = window.getComputedStyle(target);
93
- // if the element has no transition or animation we can call the afterAnimation function in the next frame
96
+ // if the element has no transition or animation we can call the afterAnimation function in the
97
+ // next frame
94
98
  if (['all', 'none'].includes(styles.transition) && styles.animationName === 'none') {
95
99
  requestAnimationFrame(afterAnimation);
96
100
  }
@@ -120,8 +124,10 @@ function queryParentSelector(element, selector, maxDepth = 10) {
120
124
  }
121
125
 
122
126
  /**
123
- * Sometimes you need to prevent the user from interacting with other elements while an element is expanded. Then you need the [inert](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/inert) attribute.
124
- * You can set the `data-inert` attribute with selectors (comma separated) to control the `inert` attribute of elements matching your selectors.
127
+ * Sometimes you need to prevent the user from interacting with other elements while an element
128
+ * is expanded. Then you need the [inert](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/inert) attribute.
129
+ * You can set the `data-inert` attribute with selectors (comma separated) to control the
130
+ * `inert` attribute of elements matching your selectors.
125
131
  * @location functions.expand.with-inerts Expand controlling inert
126
132
  * @order 30
127
133
  * @example
@@ -142,13 +148,16 @@ function queryParentSelector(element, selector, maxDepth = 10) {
142
148
  */
143
149
  function toggleInert(target, show) {
144
150
  const inertSelector = target.getAttribute('data-inert');
145
- if (!inertSelector) {
151
+ if (inertSelector === null || inertSelector === '') {
146
152
  return;
147
153
  }
148
154
  inertSelector.split(',').forEach(selector => {
149
155
  // if the target is inside an element with the same selector, we don't want to remove the inert attribute
150
156
  const activeParentWithSameSelector = !show
151
- ? queryParentSelector(target.parentElement, `[data-inert="${selector}"],[data-inert^="${selector},"],[data-inert$=",${selector}"],[data-inert*=",${selector},"]`)
157
+ ? queryParentSelector(target.parentElement, `[data-inert="${selector}"],`
158
+ + `[data-inert^="${selector},"],`
159
+ + `[data-inert$=",${selector}"],`
160
+ + `[data-inert*=",${selector},"]`)
152
161
  : null;
153
162
  if (activeParentWithSameSelector) {
154
163
  return;
@@ -243,7 +252,7 @@ function toggleControlTarget(selector, show, callback) {
243
252
  });
244
253
  }
245
254
  toggleInert(target, show);
246
- if (animationName) {
255
+ if (animationName !== null && animationName !== '') {
247
256
  if (show) {
248
257
  toggleHide();
249
258
  animate(target, animationName, show);
@@ -257,9 +266,11 @@ function toggleControlTarget(selector, show, callback) {
257
266
  }
258
267
  }
259
268
  /**
260
- * Initialize expandable/collapsable elements by using the [aria-expanded](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-expanded) attribute.
269
+ * Initialize expandable/collapsable elements by using the
270
+ * [aria-expanded](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-expanded) attribute.
261
271
  *
262
- * When an element with the `aria-expanded` attribute is clicked, the value of the attribute will be toggled between `true` and `false`.
272
+ * When an element with the `aria-expanded` attribute is clicked, the value of the attribute will
273
+ * be toggled between `true` and `false`.
263
274
  *
264
275
  * @location functions.expand Expand
265
276
  * @example
@@ -288,7 +299,7 @@ function initExpand() {
288
299
  sibling.dispatchEvent(new MouseEvent('click', { bubbles: true, relatedTarget: expander }));
289
300
  });
290
301
  }
291
- if (controlTarget) {
302
+ if (controlTarget !== null && controlTarget !== '') {
292
303
  toggleControlTarget(`#${controlTarget}`, !expanded, toggleExpanded);
293
304
  }
294
305
  else {
@@ -296,7 +307,7 @@ function initExpand() {
296
307
  }
297
308
  };
298
309
  expander.addEventListener('click', toggle);
299
- if (controlTarget) {
310
+ if (controlTarget !== null && controlTarget !== '') {
300
311
  // select all controls inside the controlled area that have the same aria-controls attribute
301
312
  document
302
313
  .querySelectorAll(`#${controlTarget} [aria-controls="${controlTarget}"]`)