{"version":3,"file":"daffodil-design-tree.mjs","sources":["../../../libs/design/tree/src/tree/tree-notifier.service.ts","../../../libs/design/tree/src/utils/flatten-tree.ts","../../../libs/design/tree/src/utils/traverse-tree.ts","../../../libs/design/tree/src/utils/hydrate-tree.ts","../../../libs/design/tree/src/tree/tree.component.ts","../../../libs/design/tree/src/tree/tree.component.html","../../../libs/design/tree/src/utils/walk-up.ts","../../../libs/design/tree/src/utils/open-ancestors.ts","../../../libs/design/tree/src/tree-item/tree-item.directive.ts","../../../libs/design/tree/src/tree.module.ts","../../../libs/design/tree/src/utils/transform.ts","../../../libs/design/tree/src/tree.ts","../../../libs/design/tree/src/daffodil-design-tree.ts"],"sourcesContent":["import {\n  Inject,\n  OnDestroy,\n} from '@angular/core';\nimport { BehaviorSubject } from 'rxjs';\n\n/**\n * This service is used by tree items to notify their parent\n * that the tree has to be recomputed.\n *\n * This service is a multiton associated with each tree instance.\n * It follows the same lifecycle as the tree it is associated with.\n */\n@Inject({})\nexport class DaffTreeNotifierService implements OnDestroy {\n\n  /**\n   * @docs-private\n   */\n  private _notice: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(true);\n\n  /**\n   * An observable that emits when the tree needs to be re-computed.\n   */\n  notice$ = this._notice.asObservable();\n\n  /**\n   * `notify` can be called to trigger a re-computation of the tree\n   * if data has changed unexpectedly and a re-render did not occur.\n   *\n   * This should be used sparingly. Instead, prefer updating `data` on the tree\n   * itself for performance reasons.\n   */\n  notify() {\n    this._notice.next(true);\n  }\n\n  /**\n   * Cleanup when the tree is destroyed.\n   *\n   * @docs-private\n   */\n  ngOnDestroy(): void {\n    this._notice.complete();\n  }\n}\n","import { collect } from '@daffodil/core';\n\nimport { DaffTreeUi } from '../interfaces/tree-ui';\n\n/**\n * A flattened node of a tree. This is used when translating the tree data\n * structure into an array.\n */\nexport interface DaffTreeFlatNode {\n  id: number | string;\n  title: string;\n  url: string;\n  level: number;\n  hasChildren: boolean;\n  data: unknown;\n  visible: boolean;\n  _treeRef: DaffTreeUi<unknown>;\n}\n\n/**\n * Flatten a DaffTreeUi<unknown> into an array, removing elements from the array\n * below nodes in the tree that are not open.\n */\nexport const flattenTree = (daffUiTree: DaffTreeUi<unknown>, removeNodes: boolean = false): DaffTreeFlatNode[] =>  {\n  const tree: DaffTreeFlatNode[] = [];\n  if(!daffUiTree) {\n    return [];\n  }\n\n  let items = [\n    {\n      ...daffUiTree,\n      level: 0,\n      data: undefined,\n      open: true,\n      _treeRef: daffUiTree,\n    },\n  ];\n\n\n  while(items) {\n    const el = items.pop();\n    if(!el) {\n      break;\n    }\n\n    items = [\n      ...items,\n      ...el.items.map((i) => ({\n        ...i,\n        level:\n        el.level + 1,\n        _treeRef: i,\n      })).reverse(),\n    ];\n\n    const hasClosedAncestor = el._treeRef.parent\n      ? collect(el._treeRef.parent, (node) => node.parent ? [node.parent] : [], el.level).reduce(\n        (acc, parent) => acc || !parent.open,\n        false,\n      )\n      : false;\n\n    if(!removeNodes && el._treeRef.parent) {\n      tree.push({\n        id: el.id,\n        title: el.title,\n        level: el.level,\n        url : el.url,\n        visible: !hasClosedAncestor,\n        hasChildren: el.items.length > 0,\n        data: undefined,\n        _treeRef: el._treeRef,\n      });\n    } else if(removeNodes && el._treeRef.parent?.open) {\n      tree.push({\n        id: el.id,\n        title: el.title,\n        level: el.level,\n        url : el.url,\n        visible: !hasClosedAncestor,\n        hasChildren: el.items.length > 0,\n        data: undefined,\n        _treeRef: el._treeRef,\n      });\n    }\n  }\n\n  return tree;\n};\n","import { RecursiveTreeKeyOfType } from '../interfaces/recursive-key';\n\n/**\n * Traverse the tree, pre-order, right-to-left\n */\nexport const traverse = <T extends Record<any, any>, V extends Record<any, any> = T>(\n  tree: T,\n  visit: (tree: T) => V,\n  key: RecursiveTreeKeyOfType<T>,\n): V => {\n  let stack = [\n    tree,\n  ];\n\n  while(stack) {\n    const el = stack.pop();\n    if(!el) {\n      break;\n    }\n\n    visit(el);\n\n    stack = [\n      ...stack,\n      ...<T[]><unknown>el[key],\n    ];\n  }\n\n  return tree;\n};\n","import { traverse } from './traverse-tree';\nimport { DaffTreeData } from '../interfaces/tree-data';\nimport { DaffTreeUi } from '../interfaces/tree-ui';\n\nexport const daffDataTreeToUiTree = <T>(data: DaffTreeData<T>, parent: DaffTreeUi<T>, open: boolean = false): DaffTreeUi<T> => ({\n  id: parent ? `${parent.id}.${data.id ?? data.title}` : (data.id ?? data.title),\n  title: data.title,\n  url: data.url,\n  data: data.data,\n  open,\n  parent,\n  items: [],\n});\n\n/**\n * This function translates the original data given to us by the client\n * to the internal representation of the tree used by the {@link DaffTreeComponent}\n */\nexport const hydrateTree = <T>(data: DaffTreeData<T>, treeId?: string): DaffTreeUi<T> => {\n  const root: DaffTreeUi<T> = {\n    id: treeId ?? (data.id ?? data.title),\n    title: data.title,\n    url: data.url,\n    data: data.data,\n    open: true,\n    parent: undefined,\n    items: [],\n  };\n\n  let treeStack = [\n    root,\n  ];\n\n  traverse(data, (el) => {\n    const treeEl = treeStack.pop();\n    treeEl.items = el.items.map((i) =>  daffDataTreeToUiTree(i, treeEl, false));\n    treeStack = [\n      ...treeStack,\n      ...treeEl.items,\n    ];\n    return el;\n  }, 'items');\n\n  return root;\n};\n","/* eslint-disable quote-props */\nimport { NgTemplateOutlet } from '@angular/common';\nimport {\n  ChangeDetectionStrategy,\n  Component,\n  computed,\n  contentChild,\n  inject,\n  input,\n  signal,\n  TemplateRef,\n  ViewEncapsulation,\n} from '@angular/core';\n\nimport { DaffArticleEncapsulatedDirective } from '@daffodil/design';\n\nimport { DaffTreeNotifierService } from './tree-notifier.service';\nimport { DaffTreeData } from '../interfaces/tree-data';\nimport { DaffTreeRenderMode } from '../interfaces/tree-render-mode';\nimport { flattenTree } from '../utils/flatten-tree';\nimport { hydrateTree } from '../utils/hydrate-tree';\n\nlet daffTreeId = 0;\n\n/**\n * The `DaffTreeComponent` allows you to render tree structures as interactable UI.\n *\n * @example Basic use of the tree component\n * ```html\n * <ul daff-tree [tree]=\"tree\">\n *   <ng-template #daffTreeItemWithChildrenTpl let-node>\n *       <button daffTreeItem [node]=\"node\">{{ node.title }} </button>\n *   </ng-template>\n *\n *   <ng-template #daffTreeItemTpl let-node>\n *       <a daffTreeItem [node]=\"node\" [routerLink]=\"node.url\">{{ node.title }}</a>\n *   </ng-template>\n * </ul>\n * ```\n *\n * where `tree` is a {@link DaffTreeData}.\n *\n */\n@Component({\n  // eslint-disable-next-line @angular-eslint/component-selector\n  selector: 'ul[daff-tree]',\n  templateUrl: './tree.component.html',\n  styleUrls: ['./tree.component.scss'],\n  encapsulation: ViewEncapsulation.None,\n  changeDetection: ChangeDetectionStrategy.OnPush,\n  providers: [\n    DaffTreeNotifierService,\n  ],\n  hostDirectives: [{\n    directive: DaffArticleEncapsulatedDirective,\n  }],\n  host: {\n    'class': 'daff-tree',\n  },\n  imports: [\n    NgTemplateOutlet,\n  ],\n})\nexport class DaffTreeComponent {\n  private notifier = inject(DaffTreeNotifierService);\n\n  /**\n   * The rendering mode for nodes in the tree.\n   *\n   * Default value is `in-dom`, which means nodes are present in the DOM.\n   *\n   * Generally, `not-in-dom` is faster as there are less DOM elements to render,\n   * but there may be use-cases (like SEO) where having the tree in the DOM\n   * is relevant.\n   */\n  readonly renderMode = input<DaffTreeRenderMode>('in-dom');\n\n  /**\n   * A unique identifier for the tree instance.\n   * Used as a prefix for all node IDs in the tree.\n   * If not provided, an auto-incrementing number is used.\n   */\n  readonly id = input<string>(`${daffTreeId++}`);\n\n  /**\n   * The tree data you would like to render.\n   */\n  readonly tree = input<DaffTreeData<unknown>>();\n\n  /**\n   * The internal tree element.\n   */\n  private _tree = computed(() => {\n    const tree = this.tree();\n    return tree ? hydrateTree(tree, this.id()) : undefined;\n  });\n\n  /**\n   * A revision counter incremented by notifications from tree items.\n   * Used to trigger re-flattening when tree item state changes.\n   */\n  readonly _revision = signal(0);\n\n  /**\n   * @docs-private\n   *\n   * The flattened tree data. For debugging purposes, you can iterate through this if you want to inspect\n   * the resulting array structure we computed to render the tree.\n   */\n  readonly flatTree = computed(() => {\n    this._revision();\n    const tree = this._tree();\n    return tree ? flattenTree(tree, this.renderMode() === 'not-in-dom') : [];\n  });\n\n  /**\n   * The template used to render tree-nodes that themselves have children.\n   *\n   * @docs-private\n   */\n  readonly withChildrenTemplate = contentChild<TemplateRef<any>>('daffTreeItemWithChildrenTpl');\n\n  /**\n   * The template used to render tree-nodes that have no children.\n   *\n   * @docs-private\n   */\n  readonly treeItemTemplate = contentChild<TemplateRef<any>>('daffTreeItemTpl');\n\n  constructor() {\n    this.notifier.notice$.subscribe(() => {\n      this._revision.update((r) => r + 1);\n    });\n  }\n}\n","@for (node of flatTree(); track node.id) {\n\t<li [attr.aria-level]=\"node.level\" [class.hidden]=\"!node.visible\">\n\t\t<ng-container\n\t\t\t*ngTemplateOutlet=\"node.hasChildren ? withChildrenTemplate() : treeItemTemplate(); context: { $implicit: node }\">\n\t\t</ng-container>\n\t</li>\n}","import { DaffTreeUi } from '../interfaces/tree-ui';\n\n/**\n * Walk up the tree from a leaf to the root applying the\n * visit function at each node along the way.\n */\nexport const walkUp = <T>(\n  tree: DaffTreeUi<T>,\n  visit: (tree: DaffTreeUi<T>) => DaffTreeUi<T>,\n): DaffTreeUi<T> => {\n  while(tree.parent) {\n    visit(tree);\n    tree = tree.parent;\n  }\n\n  return tree;\n};\n","import { walkUp } from './walk-up';\nimport { DaffTreeUi } from '../interfaces/tree-ui';\n\n/**\n * Open all ancestor nodes of the given node so that it becomes visible in the tree.\n */\nexport const daffTreeOpenAncestors = <T>(node: DaffTreeUi<T>): void => {\n  walkUp(node, (ancestor) => {\n    ancestor.open = true;\n    return ancestor;\n  });\n};\n","/* eslint-disable quote-props */\n\nimport { DOCUMENT } from '@angular/common';\nimport {\n  computed,\n  Directive,\n  effect,\n  inject,\n  input,\n  untracked,\n} from '@angular/core';\n\nimport { DaffTreeNotifierService } from '../tree/tree-notifier.service';\nimport { DaffTreeFlatNode } from '../utils/flatten-tree';\nimport { daffTreeOpenAncestors } from '../utils/open-ancestors';\n\n/**\n * The `DaffTreeItemDirective` marks elements as tree child nodes that interact with the parent tree structure.\n *\n * @example Using a `[daffTreeItem]`\n *\n * `[tree]` is a {@link DaffTreeData} and `[daff-tree]` is a {@link DaffTreeComponent}.\n *\n * ```html\n * <ul daff-tree [tree]=\"tree\">\n *   <ng-template #daffTreeItemWithChildrenTpl let-node>\n *       <button daffTreeItem [node]=\"node\">{{ node.title }} </button>\n *   </ng-template>\n *\n *   <ng-template #daffTreeItemTpl let-node>\n *       <a daffTreeItem [node]=\"node\" [routerLink]=\"node.url\">{{ node.title }}</a>\n *   </ng-template>\n * </ul>\n * ```\n *\n */\n@Directive({\n  selector: '[daffTreeItem]',\n  host: {\n    'class': 'daff-tree-item',\n    '[class.selected]': 'selected()',\n    '[class.parent]': 'isParent()',\n    '[class.open]': 'open()',\n    '[attr.id]': 'id()',\n    '[attr.aria-expanded]': 'ariaExpanded()',\n    '[style.--depth]': 'depth()',\n    '(keydown.escape)': 'onEscape()',\n    '(click)': 'onClick()',\n  },\n})\nexport class DaffTreeItemDirective {\n  private document = inject(DOCUMENT);\n  private treeNotifier = inject(DaffTreeNotifierService);\n\n  /**\n   * The {@link DaffTreeFlatNode} associated with this specific tree item.\n   */\n  readonly node = input.required<DaffTreeFlatNode>();\n\n  /**\n   * Whether or not the tree item is the currently active item.\n   * Note that there is no requirement that there only be one active item at a time.\n   *\n   * When a tree item becomes selected, all of its ancestor nodes\n   * will be automatically opened so that the selected item is visible.\n   */\n  readonly selected = input(false);\n\n  /**\n   * The html `id` of the tree item. This is derived from the {@link DaffTreeData}.\n   */\n  protected readonly id = computed(() => 'tree-' + this.node().id);\n\n  /**\n   * A property indicating the depth of the tree.\n   */\n  protected readonly depth = computed(() => this.node().level);\n\n  /**\n   * Whether or not this node has children.\n   */\n  protected readonly isParent = computed(() => this.node().hasChildren);\n\n  /**\n   * Indicates whether or not the tree is `open`.\n   */\n  protected readonly open = computed(() => this.node()._treeRef.open);\n\n  /**\n   * Accessibility property, notifying users about whether\n   * or not the tree item is open.\n   *\n   * @docs-private\n   */\n  protected readonly ariaExpanded = computed(() => {\n    const node = this.node();\n    return node.hasChildren ? (node._treeRef.open ? 'true' : 'false') : undefined;\n  });\n\n  constructor() {\n    effect(() => {\n      if(this.selected()) {\n        const node = untracked(this.node);\n        daffTreeOpenAncestors(node._treeRef);\n        this.treeNotifier.notify();\n      }\n    });\n  }\n\n  /**\n   * @docs-private\n   */\n  onEscape() {\n    this.toggleParent(this.node());\n  }\n\n  /**\n   * @docs-private\n   */\n  onClick() {\n    if(this.node().hasChildren) {\n      this.toggleTree(this.node());\n    }\n    this.treeNotifier.notify();\n  }\n\n  /**\n   * Toggle the open state of the tree's parent.\n   */\n  toggleParent(node: DaffTreeFlatNode) {\n    if(node._treeRef?.parent.parent === undefined) {\n      return;\n    }\n    node._treeRef.parent.open = !node._treeRef.parent.open;\n    (<Document>this.document).getElementById('tree-' + node._treeRef.parent.id).focus();\n  }\n\n  /**\n   * Toggle the open state of this specific subtree tree.\n   */\n  toggleTree(node: DaffTreeFlatNode) {\n    if(node._treeRef.open === false) {\n      node._treeRef.open = true;\n    } else {\n      node._treeRef.open = false;\n    }\n  }\n}\n","import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\n\nimport { DaffTreeComponent } from './tree/tree.component';\nimport { DaffTreeItemDirective } from './tree-item/tree-item.directive';\n\n/**\n * @deprecated in favor of {@link DAFF_TREE_COMPONENTS}. Deprecated in version 0.78.0. Will be removed in version 1.0.0.\n */\n@NgModule({\n  imports: [\n    CommonModule,\n    DaffTreeComponent,\n    DaffTreeItemDirective,\n  ],\n  exports: [\n    DaffTreeComponent,\n    DaffTreeItemDirective,\n  ],\n})\nexport class DaffTreeModule { }\n","import { RecursiveTreeKeyOfType } from '../interfaces/recursive-key';\nimport { DaffTreeData } from '../interfaces/tree-data';\n\n/**\n * Transform a tree-like structure into a {@link DaffTreeData}.\n *\n * @param tree - The data structure representing tree-like data.\n * @param transformFn - A user-supplied function that will transform the user\n *  type into a {@link DaffTreeData}\n * @param key - The property of the your tree that indicates which\n *  key contains the \"children\" of your tree structure.\n *\n */\nexport const daffTransformTree = <\n\n  T extends Record<any,any>,\n  V\n>(\n  tree: T,\n  transformFn: (type: T) => DaffTreeData<V>,\n  key: RecursiveTreeKeyOfType<T>,\n): DaffTreeData<V> => {\n\n  const transformedTree: DaffTreeData<V> = transformFn(tree);\n\n  const queue: { node: T; parent: DaffTreeData<V> }[] = [{ node: tree, parent: transformedTree }];\n\n  while (queue.length > 0) {\n    const { node, parent } = queue.shift();\n\n    const childItems = node[key];\n    for (const child of <T[]>childItems) {\n      const transformedChild: DaffTreeData<V> = transformFn(child);\n      parent.items.push(transformedChild);\n      queue.push({ node: child, parent: transformedChild });\n    }\n  }\n\n  return transformedTree;\n};\n","import { DaffTreeComponent } from './tree/tree.component';\nimport { DaffTreeItemDirective } from './tree-item/tree-item.directive';\n\n/**\n * @docs-private\n */\nexport const DAFF_TREE_COMPONENTS = <const> [\n  DaffTreeComponent,\n  DaffTreeItemDirective,\n];\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;AAMA;;;;;;AAMG;AAEI,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB,CAAA;AAA7B,IAAA,WAAA,GAAA;AAEL;;AAEG;AACK,QAAA,IAAA,CAAA,OAAO,GAA6B,IAAI,eAAe,CAAU,IAAI,CAAC;AAE9E;;AAEG;AACH,QAAA,IAAA,CAAA,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE;IAqBvC;AAnBE;;;;;;AAMG;IACH,MAAM,GAAA;AACJ,QAAA,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC;IACzB;AAEA;;;;AAIG;IACH,WAAW,GAAA;AACT,QAAA,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE;IACzB;CACD;AA/BY,uBAAuB,GAAA,UAAA,CAAA;IADnC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