frontile 0.18.0-beta.4 → 0.18.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.
Files changed (83) hide show
  1. package/declarations/components/collections/dropdown/menu-context.d.ts +10 -0
  2. package/declarations/components/collections/dropdown/menu-context.d.ts.map +1 -1
  3. package/declarations/components/collections/dropdown/sub.d.ts +34 -0
  4. package/declarations/components/collections/dropdown/sub.d.ts.map +1 -1
  5. package/declarations/components/collections/table/cell-default.d.ts.map +1 -1
  6. package/declarations/components/collections/table/index.d.ts.map +1 -1
  7. package/declarations/components/collections/table/table.d.ts.map +1 -1
  8. package/declarations/components/collections/table/types.d.ts.map +1 -1
  9. package/declarations/components/collections/table/utils.d.ts.map +1 -1
  10. package/declarations/components/forms/field.d.ts.map +1 -1
  11. package/declarations/components/forms/form.d.ts.map +1 -1
  12. package/declarations/components/forms/native-select.d.ts.map +1 -1
  13. package/declarations/components/forms/select/select.d.ts +4 -76
  14. package/declarations/components/forms/select/select.d.ts.map +1 -1
  15. package/declarations/components/forms/select/types.d.ts.map +1 -1
  16. package/declarations/components/navigation/breadcrumbs/breadcrumbs.d.ts +251 -0
  17. package/declarations/components/navigation/breadcrumbs/breadcrumbs.d.ts.map +1 -0
  18. package/declarations/components/navigation/breadcrumbs/collapse.d.ts +52 -0
  19. package/declarations/components/navigation/breadcrumbs/collapse.d.ts.map +1 -0
  20. package/declarations/components/navigation/breadcrumbs/ellipsis.d.ts +56 -0
  21. package/declarations/components/navigation/breadcrumbs/ellipsis.d.ts.map +1 -0
  22. package/declarations/components/navigation/breadcrumbs/item.d.ts +100 -0
  23. package/declarations/components/navigation/breadcrumbs/item.d.ts.map +1 -0
  24. package/declarations/components/navigation/breadcrumbs/separator.d.ts +27 -0
  25. package/declarations/components/navigation/breadcrumbs/separator.d.ts.map +1 -0
  26. package/declarations/components/navigation/breadcrumbs.d.ts +6 -0
  27. package/declarations/components/navigation/breadcrumbs.d.ts.map +1 -0
  28. package/declarations/components/navigation/index.d.ts +1 -0
  29. package/declarations/components/navigation/index.d.ts.map +1 -1
  30. package/declarations/components/overlays/overlay.d.ts.map +1 -1
  31. package/declarations/components/overlays/tooltip.d.ts +18 -19
  32. package/declarations/components/overlays/tooltip.d.ts.map +1 -1
  33. package/declarations/components/status/progress-bar.d.ts.map +1 -1
  34. package/declarations/components/utilities/collapsible.d.ts.map +1 -1
  35. package/declarations/utils/deferred-work.d.ts +4 -1
  36. package/declarations/utils/deferred-work.d.ts.map +1 -1
  37. package/dist/components/collections/dropdown/menu-context.js.map +1 -1
  38. package/dist/components/collections/dropdown/sub.js +78 -13
  39. package/dist/components/collections/dropdown/sub.js.map +1 -1
  40. package/dist/components/collections/simple-table/index.js.map +1 -1
  41. package/dist/components/collections/table/cell-default.js +0 -2
  42. package/dist/components/collections/table/cell-default.js.map +1 -1
  43. package/dist/components/collections/table/table.js +4 -46
  44. package/dist/components/collections/table/table.js.map +1 -1
  45. package/dist/components/collections/table/utils.js +0 -2
  46. package/dist/components/collections/table/utils.js.map +1 -1
  47. package/dist/components/forms/field.js +0 -1
  48. package/dist/components/forms/field.js.map +1 -1
  49. package/dist/components/forms/form.js +1 -39
  50. package/dist/components/forms/form.js.map +1 -1
  51. package/dist/components/forms/native-select.js +0 -3
  52. package/dist/components/forms/native-select.js.map +1 -1
  53. package/dist/components/forms/select/select.js +9 -116
  54. package/dist/components/forms/select/select.js.map +1 -1
  55. package/dist/components/navigation/breadcrumbs/breadcrumbs.js +208 -0
  56. package/dist/components/navigation/breadcrumbs/breadcrumbs.js.map +1 -0
  57. package/dist/components/navigation/breadcrumbs/collapse.js +49 -0
  58. package/dist/components/navigation/breadcrumbs/collapse.js.map +1 -0
  59. package/dist/components/navigation/breadcrumbs/ellipsis.js +40 -0
  60. package/dist/components/navigation/breadcrumbs/ellipsis.js.map +1 -0
  61. package/dist/components/navigation/breadcrumbs/item.js +102 -0
  62. package/dist/components/navigation/breadcrumbs/item.js.map +1 -0
  63. package/dist/components/navigation/breadcrumbs/separator.js +24 -0
  64. package/dist/components/navigation/breadcrumbs/separator.js.map +1 -0
  65. package/dist/components/navigation/breadcrumbs.js +4 -0
  66. package/dist/components/navigation/breadcrumbs.js.map +1 -0
  67. package/dist/components/navigation/index.js +3 -0
  68. package/dist/components/navigation/index.js.map +1 -1
  69. package/dist/components/overlays/overlay.js +0 -1
  70. package/dist/components/overlays/overlay.js.map +1 -1
  71. package/dist/components/overlays/tooltip.js +19 -21
  72. package/dist/components/overlays/tooltip.js.map +1 -1
  73. package/dist/components/status/progress-bar.js +0 -3
  74. package/dist/components/status/progress-bar.js.map +1 -1
  75. package/dist/components/utilities/collapsible.js +2 -4
  76. package/dist/components/utilities/collapsible.js.map +1 -1
  77. package/dist/index.js +3 -0
  78. package/dist/index.js.map +1 -1
  79. package/dist/navigation.js +3 -0
  80. package/dist/navigation.js.map +1 -1
  81. package/dist/utils/deferred-work.js +27 -2
  82. package/dist/utils/deferred-work.js.map +1 -1
  83. package/package.json +3 -3
@@ -0,0 +1,102 @@
1
+ import Component from '@glimmer/component';
2
+ import { cached } from '@glimmer/tracking';
3
+ import { service } from '@ember/service';
4
+ import { LinkTo } from '@ember/routing';
5
+ import { BreadcrumbsSeparator } from './separator.js';
6
+ import { precompileTemplate } from '@ember/template-compilation';
7
+ import { setComponentTemplate } from '@ember/component';
8
+ import { d as decorateFieldV2, i as initializeDeferredDecorator, a as decorateMethodV2 } from '../../../runtime--fcdnjmJ-BOdRhmsS.js';
9
+
10
+ /**
11
+ * One crumb: its `<li>`, the crumb itself, and the separator that follows it.
12
+ *
13
+ * The separator is rendered here rather than by the root, and hidden on the
14
+ * last crumb by CSS. That is what lets both authoring forms work without
15
+ * either one knowing an item's position.
16
+ */
17
+ class BreadcrumbsItem extends Component {
18
+ static {
19
+ decorateFieldV2(this.prototype, "router", [service]);
20
+ }
21
+ #router = (initializeDeferredDecorator(this, "router"), void 0); // Ember's service injection is getter-based, so this resolves only when
22
+ // `isCurrent` below actually reads it -- which happens only when `@route` was
23
+ // passed and `@isCurrent` was not. An application that does not route never
24
+ // touches the router.
25
+ get models() {
26
+ // `!= null` (not truthiness) so a legitimate falsy dynamic segment --
27
+ // `@model={{0}}` or `@model=""` -- is not silently dropped.
28
+ return this.args.models ?? (this.args.model != null ? [this.args.model] : []);
29
+ }
30
+ // `LinkTo`'s `@query` throws when given `undefined` rather than treating it
31
+ // as "no query params" -- so this must default to an empty object, the same
32
+ // way `models` defaults to an empty array.
33
+ static {
34
+ decorateMethodV2(this.prototype, "models", [cached]);
35
+ }
36
+ get query() {
37
+ return this.args.query ?? {};
38
+ }
39
+ static {
40
+ decorateMethodV2(this.prototype, "query", [cached]);
41
+ }
42
+ get isDisabled() {
43
+ return this.args.isDisabled ?? false;
44
+ }
45
+ /** Whether this crumb points anywhere at all. */
46
+ get hasTarget() {
47
+ return Boolean(this.args.route || this.args.href);
48
+ }
49
+ /**
50
+ * A `LinkTo` is only rendered for a route the crumb can actually navigate
51
+ * to. `LinkTo` cannot be talked out of a real, navigable href -- its
52
+ * `@disabled` only short-circuits the click handler and tags on an un-themed
53
+ * `disabled` class -- so a disabled route crumb falls through to the plain
54
+ * anchor instead, where dropping the href is what actually disables it.
55
+ */
56
+ get rendersLink() {
57
+ return Boolean(this.args.route) && !this.isDisabled;
58
+ }
59
+ /**
60
+ * Precedence, highest first: an explicit `@isCurrent`; the router, for a
61
+ * `@route` crumb; then the rule that a crumb with no link target is the page
62
+ * you are on -- which is what lets `<b.Item>Title</b.Item>` be correct with
63
+ * no arguments.
64
+ */
65
+ get isCurrent() {
66
+ if (this.args.isCurrent !== undefined) {
67
+ return this.args.isCurrent;
68
+ }
69
+ if (this.args.route) {
70
+ // Redundant belt-and-braces: `RouterService#isActive` already entangles
71
+ // itself with `currentURL`'s tag internally, so this getter recomputes on
72
+ // every transition even without the read below. Kept anyway as a
73
+ // documented, version-independent guarantee -- and covered by the
74
+ // transition test in `breadcrumbs-routing-test.gts` -- in case that
75
+ // internal entanglement is ever dropped.
76
+ void this.router.currentURL;
77
+ try {
78
+ return this.router.isActive(this.args.route, ...this.models, {
79
+ queryParams: this.query
80
+ });
81
+ } catch {
82
+ // `isActive` throws for a route that is not currently reachable -- an
83
+ // unentered engine, or a dynamic segment whose model is not loaded.
84
+ // Not being reachable is not being current.
85
+ return false;
86
+ }
87
+ }
88
+ return !this.hasTarget;
89
+ }
90
+ static {
91
+ setComponentTemplate(precompileTemplate("<li data-part=\"item\" class={{@itemClass}}>\n {{#if this.rendersLink}}\n <LinkTo @route={{@route}} @models={{this.models}} @query={{this.query}} data-part=\"link\" class=\"{{@linkClass}} {{@class}}\" aria-disabled=\"false\" data-disabled=\"false\" {{@setupItem this.isCurrent}} ...attributes>\n {{yield}}\n </LinkTo>\n {{else if this.hasTarget}}\n {{!-- template-lint-disable no-unsupported-role-attributes --}}\n <a data-part=\"link\" href={{unless this.isDisabled @href}} class=\"{{@linkClass}} {{@class}}\" aria-disabled=\"{{this.isDisabled}}\" data-disabled=\"{{this.isDisabled}}\" {{@setupItem this.isCurrent}} ...attributes>\n {{yield}}\n </a>\n {{else}}\n <span data-part=\"link\" class=\"{{@linkClass}} {{@class}}\" {{@setupItem this.isCurrent}} ...attributes>\n {{yield}}\n </span>\n {{/if}}\n\n <BreadcrumbsSeparator @class={{@separatorClass}} @separator={{@separator}} />\n</li>", {
92
+ strictMode: true,
93
+ scope: () => ({
94
+ LinkTo,
95
+ BreadcrumbsSeparator
96
+ })
97
+ }), this);
98
+ }
99
+ }
100
+
101
+ export { BreadcrumbsItem, BreadcrumbsItem as default };
102
+ //# sourceMappingURL=item.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"item.js","sources":["../../../../src/components/navigation/breadcrumbs/item.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { cached } from '@glimmer/tracking';\nimport { service } from '@ember/service';\nimport { LinkTo } from '@ember/routing';\nimport { BreadcrumbsSeparator } from './separator';\nimport type RouterService from '@ember/routing/router-service';\nimport type { ComponentLike, ModifierLike } from '@glint/template';\n\ninterface BreadcrumbsItemArgs {\n /**\n * Renders a `LinkTo` for this route and derives the current state from the\n * router. Omit it (and pass `@href`) to stay entirely router-free.\n */\n route?: string;\n\n /** Dynamic segments for `@route`. */\n models?: unknown[];\n\n /** A single dynamic segment for `@route`. */\n model?: unknown;\n\n /** Query params for `@route`. */\n query?: Record<string, unknown>;\n\n /** Renders a plain anchor. */\n href?: string;\n\n /**\n * Overrides the current-page state. Wins over every other rule.\n */\n isCurrent?: boolean;\n\n /**\n * Marks the crumb as disabled. An anchor cannot be natively disabled, so the\n * href is dropped as well -- `aria-disabled` alone still leaves it\n * clickable. Only affects a linked crumb: an unlinked crumb (no `@route` or\n * `@href`) renders as a `<span>` and never receives `aria-disabled` or\n * `data-disabled` regardless of this arg.\n *\n * @defaultValue false\n */\n isDisabled?: boolean;\n\n /** Class names appended to this crumb's theme classes. */\n class?: string;\n\n /**\n * Supplied by Breadcrumbs. Not part of the public API.\n *\n * @internal\n */\n itemClass: string;\n\n /** @internal */\n linkClass: string;\n\n /** @internal */\n separatorClass: string;\n\n /** @internal */\n separator?: ComponentLike<{ Element: SVGElement }>;\n\n /** @internal */\n setupItem: ModifierLike<{\n Element: HTMLElement;\n Args: { Positional: [boolean] };\n }>;\n}\n\ninterface BreadcrumbsItemSignature {\n Args: BreadcrumbsItemArgs;\n Blocks: { default: [] };\n /**\n * Not `HTMLAnchorElement`: this component's crumb element varies -- an `<a>`\n * or a `<span>` for an unlinked current crumb -- so the signature has to name\n * the common supertype or `...attributes` is mistyped for the span case.\n */\n Element: HTMLElement;\n}\n\n/**\n * One crumb: its `<li>`, the crumb itself, and the separator that follows it.\n *\n * The separator is rendered here rather than by the root, and hidden on the\n * last crumb by CSS. That is what lets both authoring forms work without\n * either one knowing an item's position.\n */\nclass BreadcrumbsItem extends Component<BreadcrumbsItemSignature> {\n // Ember's service injection is getter-based, so this resolves only when\n // `isCurrent` below actually reads it -- which happens only when `@route` was\n // passed and `@isCurrent` was not. An application that does not route never\n // touches the router.\n @service declare router: RouterService;\n\n @cached\n get models(): unknown[] {\n // `!= null` (not truthiness) so a legitimate falsy dynamic segment --\n // `@model={{0}}` or `@model=\"\"` -- is not silently dropped.\n return (\n this.args.models ?? (this.args.model != null ? [this.args.model] : [])\n );\n }\n\n // `LinkTo`'s `@query` throws when given `undefined` rather than treating it\n // as \"no query params\" -- so this must default to an empty object, the same\n // way `models` defaults to an empty array.\n @cached\n get query(): Record<string, unknown> {\n return this.args.query ?? {};\n }\n\n get isDisabled(): boolean {\n return this.args.isDisabled ?? false;\n }\n\n /** Whether this crumb points anywhere at all. */\n get hasTarget(): boolean {\n return Boolean(this.args.route || this.args.href);\n }\n\n /**\n * A `LinkTo` is only rendered for a route the crumb can actually navigate\n * to. `LinkTo` cannot be talked out of a real, navigable href -- its\n * `@disabled` only short-circuits the click handler and tags on an un-themed\n * `disabled` class -- so a disabled route crumb falls through to the plain\n * anchor instead, where dropping the href is what actually disables it.\n */\n get rendersLink(): boolean {\n return Boolean(this.args.route) && !this.isDisabled;\n }\n\n /**\n * Precedence, highest first: an explicit `@isCurrent`; the router, for a\n * `@route` crumb; then the rule that a crumb with no link target is the page\n * you are on -- which is what lets `<b.Item>Title</b.Item>` be correct with\n * no arguments.\n */\n get isCurrent(): boolean {\n if (this.args.isCurrent !== undefined) {\n return this.args.isCurrent;\n }\n\n if (this.args.route) {\n // Redundant belt-and-braces: `RouterService#isActive` already entangles\n // itself with `currentURL`'s tag internally, so this getter recomputes on\n // every transition even without the read below. Kept anyway as a\n // documented, version-independent guarantee -- and covered by the\n // transition test in `breadcrumbs-routing-test.gts` -- in case that\n // internal entanglement is ever dropped.\n void this.router.currentURL;\n\n try {\n return this.router.isActive(this.args.route, ...this.models, {\n queryParams: this.query\n } as never);\n } catch {\n // `isActive` throws for a route that is not currently reachable -- an\n // unentered engine, or a dynamic segment whose model is not loaded.\n // Not being reachable is not being current.\n return false;\n }\n }\n\n return !this.hasTarget;\n }\n\n <template>\n <li data-part=\"item\" class={{@itemClass}}>\n {{#if this.rendersLink}}\n <LinkTo\n @route={{@route}}\n @models={{this.models}}\n @query={{this.query}}\n data-part=\"link\"\n class=\"{{@linkClass}} {{@class}}\"\n aria-disabled=\"false\"\n data-disabled=\"false\"\n {{@setupItem this.isCurrent}}\n ...attributes\n >\n {{yield}}\n </LinkTo>\n {{else if this.hasTarget}}\n {{! template-lint-disable no-unsupported-role-attributes }}\n <a\n data-part=\"link\"\n href={{unless this.isDisabled @href}}\n class=\"{{@linkClass}} {{@class}}\"\n aria-disabled=\"{{this.isDisabled}}\"\n data-disabled=\"{{this.isDisabled}}\"\n {{@setupItem this.isCurrent}}\n ...attributes\n >\n {{yield}}\n </a>\n {{else}}\n <span\n data-part=\"link\"\n class=\"{{@linkClass}} {{@class}}\"\n {{@setupItem this.isCurrent}}\n ...attributes\n >\n {{yield}}\n </span>\n {{/if}}\n\n <BreadcrumbsSeparator\n @class={{@separatorClass}}\n @separator={{@separator}}\n />\n </li>\n </template>\n}\n\nexport {\n BreadcrumbsItem,\n type BreadcrumbsItemSignature,\n type BreadcrumbsItemArgs\n};\nexport default BreadcrumbsItem;\n"],"names":["BreadcrumbsItem","Component","g","prototype","service","i","models","args","model","n","cached","query","isDisabled","hasTarget","Boolean","route","href","rendersLink","isCurrent","undefined","router","currentURL","isActive","queryParams","setComponentTemplate","precompileTemplate","strictMode","scope","LinkTo","BreadcrumbsSeparator"],"mappings":";;;;;;;;;AAgFA;;;;;;;AAOA,MAAMA,wBAAwBC,SAAA,CAAU;AAAA,EAAA;IAAAC,eAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,QAAA,EAAA,CAKrCC,OAAA,CAAA,CAAA;AAAA;EAAA,OAAA,IAAAC,2BAAA,CAAA,IAAA,EAAA,QAAA,CAAA,EAAA,MAAA,EAAA;AAHD;AACA;AACA;EAGA,IACIC,MAAAA,GAAoB;AACtB;AACA;IACA,OACE,IAAI,CAACC,IAAI,CAACD,MAAM,KAAK,IAAI,CAACC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AAA,GAAK,IAAI,CAACT,MAAM,EAAE;UAC3DiB,WAAA,EAAa,IAAI,CAACZ;AACpB,SAAU,CAAA;AACZ,MAAA,CAAA,CAAE,MAAM;AACN;AACA;AACA;AACA,QAAA,OAAO,KAAA;AACT,MAAA;AACF,IAAA;IAEA,OAAO,CAAC,IAAI,CAACE,SAAS;AACxB,EAAA;AAEA,EAAA;IAAAW,oBAAA,CAAAC,kBAAA,CAAA,q6BAAA,EA6CA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,MAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;"}
@@ -0,0 +1,24 @@
1
+ import { c as ChevronRightIcon } from '../../../icons-DZ61nCzv.js';
2
+ import { precompileTemplate } from '@ember/template-compilation';
3
+ import { setComponentTemplate } from '@ember/component';
4
+ import templateOnly from '@ember/component/template-only';
5
+
6
+ /**
7
+ * The punctuation between two crumbs.
8
+ *
9
+ * Shared by `Item` and `Ellipsis`, which each render their own `<li>` and so
10
+ * each need one. The CSS that hides it on the last `<li>` only works while the
11
+ * two stay identical, which one definition guarantees and two copies don't.
12
+ *
13
+ * Always `aria-hidden`: the `<ol>` and `aria-current` carry the structure, so
14
+ * announcing a chevron between every crumb would be reading decoration.
15
+ */
16
+ const BreadcrumbsSeparator = setComponentTemplate(precompileTemplate("<span data-part=\"separator\" aria-hidden=\"true\" class={{@class}} ...attributes>\n {{#if @separator}}<@separator />{{else}}<ChevronRightIcon />{{/if}}\n</span>", {
17
+ strictMode: true,
18
+ scope: () => ({
19
+ ChevronRightIcon
20
+ })
21
+ }), templateOnly());
22
+
23
+ export { BreadcrumbsSeparator, BreadcrumbsSeparator as default };
24
+ //# sourceMappingURL=separator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"separator.js","sources":["../../../../src/components/navigation/breadcrumbs/separator.gts"],"sourcesContent":["import { ChevronRightIcon } from '../../../-private/icons';\nimport type { TOC } from '@ember/component/template-only';\nimport type { ComponentLike } from '@glint/template';\n\nexport interface BreadcrumbsSeparatorSignature {\n Args: {\n /** The `separator` slot's resolved classes, from the root. */\n class: string;\n\n /** The consumer's `@separator`, replacing the default chevron. */\n separator?: ComponentLike<{ Element: SVGElement }>;\n };\n Element: HTMLSpanElement;\n}\n\n/**\n * The punctuation between two crumbs.\n *\n * Shared by `Item` and `Ellipsis`, which each render their own `<li>` and so\n * each need one. The CSS that hides it on the last `<li>` only works while the\n * two stay identical, which one definition guarantees and two copies don't.\n *\n * Always `aria-hidden`: the `<ol>` and `aria-current` carry the structure, so\n * announcing a chevron between every crumb would be reading decoration.\n */\nconst BreadcrumbsSeparator: TOC<BreadcrumbsSeparatorSignature> = <template>\n <span data-part=\"separator\" aria-hidden=\"true\" class={{@class}} ...attributes>\n {{#if @separator}}<@separator />{{else}}<ChevronRightIcon />{{/if}}\n </span>\n</template>;\n\nexport { BreadcrumbsSeparator };\nexport default BreadcrumbsSeparator;\n"],"names":["BreadcrumbsSeparator","setComponentTemplate","precompileTemplate","strictMode","scope","ChevronRightIcon","templateOnly"],"mappings":";;;;;AAeA;;;;;;;;;AASC;AACD,MAAMA,oBAA0B,GAAAC,oBAAA,CAAiCC,kBAAA,CAAA,oKAAA,EAIjE;EAAAC,UAAA,EAAA,IAAA;AAAAC,EAAAA,KAAA,EAAAA,OAAA;AAAAC,IAAAA;AAAA,GAAA;AAAU,CAAA,CAAA,EAAAC,YAAA,EAAA;;"}
@@ -0,0 +1,4 @@
1
+ export { Breadcrumbs, Breadcrumbs as default } from './breadcrumbs/breadcrumbs.js';
2
+ export { BreadcrumbsItem } from './breadcrumbs/item.js';
3
+ export { BreadcrumbsEllipsis } from './breadcrumbs/ellipsis.js';
4
+ //# sourceMappingURL=breadcrumbs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"breadcrumbs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
@@ -6,4 +6,7 @@ export { TabNavItem } from './tab-nav/item.js';
6
6
  export { ExternalLink } from './external-link.js';
7
7
  export { Pagination } from './pagination/pagination.js';
8
8
  export { paginationRange } from './pagination/range.js';
9
+ export { Breadcrumbs } from './breadcrumbs/breadcrumbs.js';
10
+ export { BreadcrumbsItem } from './breadcrumbs/item.js';
11
+ export { BreadcrumbsEllipsis } from './breadcrumbs/ellipsis.js';
9
12
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}
@@ -97,7 +97,6 @@ function unlockBodyScroll() {
97
97
  previousBodyOverflow = '';
98
98
  }
99
99
  }
100
- // finds if the el has a parent with the id `ember-basic-dropdown-wormhole` or a role of `alert`
101
100
  function hasWormholeOrAlertParentElement(el) {
102
101
  let parent = el.parentElement;
103
102
  while (parent) {
@@ -1 +1 @@
1
- {"version":3,"file":"overlay.js","sources":["../../../src/components/overlays/overlay.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { cached, tracked } from '@glimmer/tracking';\nimport { action } from '@ember/object';\nimport { later } from '@ember/runloop';\nimport { on } from '@ember/modifier';\nimport { cssTransition } from 'ember-css-transitions';\nimport { useStyles } from '@frontile/theme';\nimport { modifier } from 'ember-modifier';\nimport { focusTrap, type FocusTrapModifierSignature } from 'ember-focus-trap';\nimport { createFocusTrap, type FocusTrap } from 'focus-trap';\nimport onClickOutside from 'ember-click-outside/modifiers/on-click-outside';\nimport { Backdrop, type BackdropSignature } from './backdrop';\nimport {\n afterFirstPaint,\n hasPainted,\n shouldDeferMount,\n shouldSkipEnterTransition,\n withoutEnterTransition\n} from './mount-animation';\nimport { Portal, findParentPortal, type PortalSignature } from './portal';\nimport type Owner from '@ember/owner';\nimport type { ModifierLike } from '@glint/template';\nimport type { CssTransitionSignature } from 'ember-css-transitions/modifiers/css-transition';\nimport { isTesting, macroCondition } from '@embroider/macros';\n\ntype FocusTrapOptions = NonNullable<\n FocusTrapModifierSignature['Args']['Named']['focusTrapOptions']\n>;\n\ntype FocusTrapLifecycleMethod = 'activate' | 'deactivate' | 'pause' | 'unpause';\n\n/**\n * Wraps `createFocusTrap` so activate/deactivate/pause/unpause never throw.\n *\n * focus-trap keeps a page-global stack of traps; deactivating one can reach\n * into the stack to re-validate (`unpause`) whichever trap is now on top. If\n * that other trap's container was already torn down -- which this test suite\n * does constantly, mounting and unmounting hundreds of trapped overlays in a\n * single browser session -- focus-trap throws \"must have at least one\n * container with at least one tabbable node\", per its own docs' \"Help\"\n * section: this is an expected hazard of trapped elements that \"appear and\n * disappear dynamically\", not a sign of a real focus bug. Test-only: real\n * usage never hits the same rapid-fire mount/unmount churn.\n */\nfunction createTestResilientFocusTrap(\n ...args: Parameters<typeof createFocusTrap>\n): FocusTrap {\n const trap = createFocusTrap(...args);\n\n const guard =\n (method: FocusTrapLifecycleMethod) =>\n (...methodArgs: unknown[]): FocusTrap => {\n try {\n return (trap[method] as (...a: unknown[]) => FocusTrap)(...methodArgs);\n } catch {\n return trap;\n }\n };\n\n return {\n ...trap,\n activate: guard('activate'),\n deactivate: guard('deactivate'),\n pause: guard('pause'),\n unpause: guard('unpause')\n };\n}\n\n/**\n * Whether `target` sits inside a portal nested within this overlay's own\n * portal.\n *\n * The question a click handler needs answered is about *this* click, not about\n * the mere existence of a nested portal. Asking only \"is a nested portal\n * mounted?\" made a parent overlay ignore every outside click for as long as a\n * child was open -- so with a Dropdown submenu (or a Select inside a Modal)\n * open, clicking the page did not close anything.\n *\n * A portal that is not a descendant of this overlay's portal -- one given an\n * explicit `@target`, or opted out of `appendToParentPortal` -- is not nested,\n * and a click in it is a genuine outside click.\n */\nfunction isWithinNestedPortal(\n contentElement: HTMLElement,\n target: EventTarget | null\n): boolean {\n const ownPortal = findParentPortal(contentElement);\n if (!ownPortal || !(target instanceof Element)) {\n return false;\n }\n\n const targetPortal = target.closest('[data-portal=\"true\"]');\n if (!targetPortal || targetPortal === ownPortal) {\n return false;\n }\n\n return ownPortal.contains(targetPortal);\n}\n\n// Blocking the body scroll mutates global state, so it has to be reference\n// counted: nested overlays (a Drawer opened from a Modal, a Select inside a\n// Modal) each lock on open and unlock on close, and only the last one out is\n// allowed to restore the page. We also remember the inline value the app had\n// before the first lock, so restoring does not silently wipe an app-level\n// `body { overflow: ... }`.\nlet bodyScrollLockCount = 0;\nlet previousBodyOverflow = '';\n\nfunction lockBodyScroll(): void {\n if (bodyScrollLockCount === 0) {\n previousBodyOverflow = document.body.style.overflow;\n document.body.style.overflow = 'hidden';\n }\n bodyScrollLockCount++;\n}\n\nfunction unlockBodyScroll(): void {\n if (bodyScrollLockCount === 0) {\n return;\n }\n\n bodyScrollLockCount--;\n\n if (bodyScrollLockCount === 0) {\n document.body.style.overflow = previousBodyOverflow;\n previousBodyOverflow = '';\n }\n}\n\n// finds if the el has a parent with the id `ember-basic-dropdown-wormhole` or a role of `alert`\nfunction hasWormholeOrAlertParentElement(el: HTMLElement) {\n let parent = el.parentElement;\n while (parent) {\n if (\n parent.id === 'ember-basic-dropdown-wormhole' ||\n parent.role === 'alert'\n ) {\n return true;\n }\n parent = parent.parentElement;\n }\n return false;\n}\n\ninterface Args extends Pick<\n PortalSignature['Args'],\n 'renderInPlace' | 'target'\n> {\n /**\n * Duration of the animation\n *\n * @defaultValue 200\n */\n transitionDuration?: number;\n\n /**\n * How the area behind the overlay is rendered: `none` omits the backdrop\n * entirely, `transparent` keeps it clickable but invisible, `faded` dims the\n * page, and `blur` blurs it.\n */\n backdrop?: BackdropSignature['Args']['type'];\n\n /**\n * Transition classes for the backdrop, overriding the defaults used when it\n * fades in and out.\n */\n backdropTransition?: BackdropSignature['Args']['transition'];\n\n /**\n * Disable css transitions\n *\n * @defaultValue false\n */\n disableTransitions?: boolean;\n\n /**\n * Whether an overlay that is *already open the first time it renders* --\n * deep-linked open, or restored by a page refresh -- animates in.\n *\n * When true (the default) the overlay waits for the browser's first paint\n * before mounting, so the animation plays against a page the user has\n * already seen. Set it to false for an already-open overlay that should\n * simply be there, with no reveal. An overlay opened later by interaction\n * animates either way, and so does closing.\n *\n * @defaultValue true\n */\n animateOnMount?: boolean;\n\n /**\n * Whether the focus trap is disabled or not\n *\n * @defaultValue false\n */\n disableFocusTrap?: boolean;\n\n /**\n * Focus trap options\n *\n * @defaultValue { clickOutsideDeactivates: true, allowOutsideClick: true }\n */\n focusTrapOptions?: FocusTrapOptions;\n\n /**\n * Whether it is open or not\n */\n isOpen: boolean;\n\n /**\n * A function that will be called when closed\n */\n onClose?: () => void;\n\n /**\n * A function that will be called when closing is finished executing, this\n * includes waiting for animations/transitions to finish.\n */\n didClose?: () => void;\n\n /**\n * A function that will be called when opened\n */\n onOpen?: () => void;\n\n /**\n * Whether to close when the area outside (the backdrop) is clicked\n *\n * @defaultValue true\n */\n closeOnOutsideClick?: boolean;\n\n /**\n * Whether to close when the overlay element is clicked, used for modal and drawer components.\n * This is set to true by default to allow \"outside click\" functionality to work properly.\n * Most overlay content is wrapped with an inner element, preventing accidental closure.\n *\n * @defaultValue true\n */\n closeOnOverlayElementClick?: boolean;\n\n /**\n * Whether to close when the escape key is pressed\n *\n * @defaultValue true\n */\n closeOnEscapeKey?: boolean;\n\n /**\n * Transition options\n *\n * @defaultValue {name:'overlay-transition--fade'}\n */\n transition?: CssTransitionSignature['Args']['Named'];\n\n /**\n * Opt out of the flex layout applied to the content element, for overlays\n * that need to lay their content out themselves.\n *\n * @defaultValue false\n */\n disableFlexContent?: boolean;\n\n /**\n * An extra modifier applied to the content element, for behavior the overlay\n * doesn't provide itself.\n */\n customContentModifier?: ModifierLike<{ Element: HTMLElement }>;\n\n /**\n * Custom class name for the content element, merged with the default ones\n * using Tailwind Merge.\n */\n class?: string;\n /**\n * @defaultValue false\n */\n preventFocusRestore?: boolean;\n\n /**\n * When focusTrap is disabled, by default Oberlay will be auto focused. This option prevents that.\n * @defaultValue false\n */\n preventAutoFocus?: boolean;\n\n /**\n * @defaultValue true\n */\n blockScroll?: boolean;\n}\n\ninterface OverlaySignature {\n Args: Args;\n Element: HTMLDivElement;\n Blocks: { default: [] };\n}\n\nclass Overlay extends Component<OverlaySignature> {\n @tracked keepOpen = false;\n\n // Whether the browser has painted since this overlay was created. Only ever\n // consulted while the mount is being deferred; see `mount-animation.ts`.\n @tracked hasWaitedForPaint = false;\n\n // Whether `@isOpen` was already true on the very first render. Captured once\n // rather than derived, because the whole question is about what the args\n // looked like at mount.\n isOpenAtMount = this.args.isOpen === true;\n\n // Whether the page had already painted when this overlay was created, which\n // only an overlay that mounts open ever has to know -- and every Dropdown,\n // Select and Tooltip in the app builds an Overlay too.\n hadPaintedAtMount = this.isOpenAtMount ? hasPainted() : false;\n\n // Latched when the first open closes, so a *reopen* of the same overlay\n // animates normally. Only a genuine close counts: the content element is\n // also torn down and rebuilt when the portal destination changes under an\n // open overlay, and flipping this then would swap the enter class names out\n // from under the running modifier, which cleans up using whatever names it\n // holds when the transition ends.\n @tracked hasClosedOnce = false;\n\n contentElement: HTMLElement | undefined;\n focusedElement: Element | null | undefined;\n mouseDownContentElement: EventTarget | null = null;\n\n // Whether *this* overlay is holding a reference on the body scroll lock. We\n // record the decision made when opening instead of re-deriving it at\n // teardown, because the args can change while the overlay is open and an\n // asymmetric lock/unlock would leak the reference count.\n didLockBodyScroll = false;\n\n cancelPaintWait: (() => void) | undefined;\n\n constructor(owner: Owner, args: Args) {\n super(owner, args);\n\n if (!this.shouldDeferMount) {\n return;\n }\n\n this.cancelPaintWait = afterFirstPaint(() => {\n if (!this.isDestroying && !this.isDestroyed) {\n this.hasWaitedForPaint = true;\n }\n });\n }\n\n willDestroy(): void {\n super.willDestroy();\n this.cancelPaintWait?.();\n }\n\n handleClose(): void {\n if (this.args.isOpen && typeof this.args.onClose === 'function') {\n this.args.onClose();\n }\n }\n\n @action handleContentClick(event: MouseEvent): void {\n if (\n this.args.closeOnOutsideClick !== false &&\n this.args.closeOnOverlayElementClick !== false &&\n event.target === this.contentElement &&\n this.mouseDownContentElement == this.contentElement &&\n !isWithinNestedPortal(this.contentElement, event.target) &&\n !hasWormholeOrAlertParentElement(event.target as HTMLElement)\n ) {\n this.handleClose();\n }\n this.mouseDownContentElement = null;\n }\n\n @action handleOutsideClick(e: Event): void {\n if (\n this.args.closeOnOutsideClick !== false &&\n this.contentElement &&\n !isWithinNestedPortal(this.contentElement, e.target) &&\n !hasWormholeOrAlertParentElement(e.target as HTMLElement)\n ) {\n this.handleClose();\n e.preventDefault();\n }\n }\n\n @action\n handleContentMouseDown(event: MouseEvent): void {\n if (this.args.closeOnOverlayElementClick !== false) {\n this.mouseDownContentElement = event.target;\n }\n }\n\n @action\n handleKeyDown(event: KeyboardEvent): void {\n if (event.key === 'Escape' && this.args.closeOnEscapeKey !== false) {\n this.handleClose();\n event.preventDefault();\n event.stopImmediatePropagation();\n }\n }\n\n setupContent = modifier((el: HTMLDivElement) => {\n let transitionDuration = this.args.transitionDuration || 200;\n if (!this.isAnimationEnabled) {\n transitionDuration = 0;\n }\n later(() => {\n if (this.isDestroyed) return;\n if (this.args.disableFocusTrap !== true) return;\n if (this.args.preventAutoFocus === true) return;\n el.focus();\n }, transitionDuration);\n\n this.contentElement = el;\n this.keepOpen = true;\n this.focusedElement = document.activeElement;\n\n if (this.args.renderInPlace !== true && this.args.blockScroll !== false) {\n this.didLockBodyScroll = true;\n lockBodyScroll();\n }\n\n if (typeof this.args.onOpen === 'function') {\n this.args.onOpen();\n }\n return () => {\n this.contentElement = undefined;\n\n if (this.args.isOpen !== true) {\n this.hasClosedOnce = true;\n }\n\n if (this.didLockBodyScroll) {\n this.didLockBodyScroll = false;\n unlockBodyScroll();\n }\n\n const { didClose } = this.args;\n later(() => {\n if (!this.isDestroyed) this.keepOpen = false;\n if (typeof didClose === 'function' && !this.isDestroyed) {\n didClose();\n }\n\n // restore focus\n if (\n !this.args.preventFocusRestore &&\n this.focusedElement &&\n (this.focusedElement as HTMLElement).tabIndex > -1 &&\n typeof (this.focusedElement as HTMLElement).focus !== 'undefined'\n ) {\n (this.focusedElement as HTMLElement).focus();\n }\n }, transitionDuration);\n };\n });\n\n @cached\n get mountAnimationState() {\n return {\n isFirstOpen: this.isOpenAtMount && !this.hasClosedOnce,\n animationsEnabled: this.isAnimationEnabled,\n animateOnMount: this.args.animateOnMount,\n canWaitForFrame: typeof requestAnimationFrame === 'function',\n hasPainted: this.hadPaintedAtMount\n };\n }\n\n get shouldDeferMount(): boolean {\n return shouldDeferMount(this.mountAnimationState);\n }\n\n get skipEnterTransition(): boolean {\n return shouldSkipEnterTransition(this.mountAnimationState);\n }\n\n get isVisible(): boolean {\n if (this.shouldDeferMount && !this.hasWaitedForPaint) {\n return false;\n }\n\n return this.args.isOpen || this.keepOpen;\n }\n\n get backdrop(): BackdropSignature['Args']['type'] {\n if (!this.args.isOpen) {\n return 'none';\n }\n return this.args.backdrop || 'faded';\n }\n\n get isAnimationEnabled(): boolean {\n if (macroCondition(isTesting())) {\n return false;\n }\n return !(this.args.disableTransitions === true);\n }\n\n /**\n * Consumer options are merged over the defaults rather than replacing them.\n *\n * Swapping the object wholesale made setting any single option -- a\n * `setReturnFocus`, an `initialFocus` -- silently drop\n * `clickOutsideDeactivates` and `allowOutsideClick` with it, at which point\n * the trap swallows outside clicks and the overlay can only be dismissed\n * with Escape. Nothing warns, and the cause is nowhere near the symptom.\n * A consumer that genuinely wants the trap to hold outside clicks can still\n * say so by passing those two as `false`.\n */\n get focusTrapOptions(): FocusTrapOptions {\n return {\n clickOutsideDeactivates: true,\n allowOutsideClick: true,\n ...this.args.focusTrapOptions\n };\n }\n\n get createFocusTrap(): typeof createFocusTrap | undefined {\n if (macroCondition(isTesting())) {\n return createTestResilientFocusTrap;\n }\n return undefined;\n }\n\n get classes() {\n const { overlay } = useStyles();\n\n return overlay({\n class: this.args.class,\n inPlace: this.args.renderInPlace,\n enableFlexContent: !(this.args.disableFlexContent === true)\n });\n }\n\n get customContentModifier() {\n if (this.args.customContentModifier) {\n return this.args.customContentModifier;\n }\n\n return modifier(() => {});\n }\n\n // Applied to both the content and the backdrop, so they never disagree about\n // whether this mount animates.\n maybeWithoutEnter<T extends object>(options: T): T {\n return this.skipEnterTransition ? withoutEnterTransition(options) : options;\n }\n\n get backdropTransition() {\n return this.maybeWithoutEnter(\n this.args.backdropTransition || { isEnabled: this.isAnimationEnabled }\n );\n }\n\n get transition() {\n let options: BackdropSignature['Args']['transition'] = {\n name: 'overlay-transition--fade',\n isEnabled: this.isAnimationEnabled\n };\n\n if (typeof this.args.transition === 'object') {\n options = { ...options, ...this.args.transition };\n }\n\n return this.maybeWithoutEnter(options);\n }\n\n <template>\n {{! template-lint-disable no-invalid-interactive }}\n {{! template-lint-disable no-pointer-down-event-binding }}\n\n {{#if this.isVisible}}\n <Portal @renderInPlace={{@renderInPlace}} @target={{@target}}>\n <Backdrop\n @type={{this.backdrop}}\n @inPlace={{@renderInPlace}}\n @transition={{this.backdropTransition}}\n />\n\n {{#if @isOpen}}\n <div\n {{this.setupContent}}\n {{on \"click\" this.handleContentClick}}\n {{on \"keydown\" this.handleKeyDown}}\n {{on \"mousedown\" this.handleContentMouseDown}}\n {{cssTransition\n didTransitionIn=this.transition.didTransitionIn\n didTransitionOut=this.transition.didTransitionOut\n enterClass=this.transition.enterClass\n enterActiveClass=this.transition.enterActiveClass\n enterToClass=this.transition.enterToClass\n isEnabled=this.transition.isEnabled\n leaveClass=this.transition.leaveClass\n leaveActiveClass=this.transition.leaveActiveClass\n leaveToClass=this.transition.leaveToClass\n name=this.transition.name\n parentSelector=this.transition.parentSelector\n }}\n {{onClickOutside this.handleOutsideClick capture=true}}\n {{focusTrap\n isActive=(if @disableFocusTrap false @isOpen)\n focusTrapOptions=this.focusTrapOptions\n _createFocusTrap=this.createFocusTrap\n }}\n class={{this.classes}}\n {{! Keep this custom modifer by last}}\n {{this.customContentModifier}}\n data-component=\"overlay\"\n data-part=\"base\"\n tabindex=\"0\"\n ...attributes\n >\n {{yield}}\n </div>\n {{/if}}\n </Portal>\n {{/if}}\n </template>\n}\n\nexport { Overlay, type OverlaySignature };\nexport default Overlay;\n"],"names":["createTestResilientFocusTrap","args","trap","createFocusTrap","guard","method","methodArgs","activate","deactivate","pause","unpause","isWithinNestedPortal","contentElement","target","ownPortal","findParentPortal","Element","targetPortal","closest","contains","bodyScrollLockCount","previousBodyOverflow","lockBodyScroll","document","body","style","overflow","unlockBodyScroll","hasWormholeOrAlertParentElement","el","parent","parentElement","id","role","Overlay","Component","g","prototype","tracked","i","isOpenAtMount","isOpen","hadPaintedAtMount","hasPainted","focusedElement","mouseDownContentElement","didLockBodyScroll","cancelPaintWait","constructor","owner","shouldDeferMount","afterFirstPaint","isDestroying","isDestroyed","hasWaitedForPaint","willDestroy","handleClose","onClose","handleContentClick","event","closeOnOutsideClick","closeOnOverlayElementClick","n","action","handleOutsideClick","e","preventDefault","handleContentMouseDown","handleKeyDown","key","closeOnEscapeKey","stopImmediatePropagation","setupContent","modifier","transitionDuration","isAnimationEnabled","later","disableFocusTrap","preventAutoFocus","focus","keepOpen","activeElement","renderInPlace","blockScroll","onOpen","undefined","hasClosedOnce","didClose","preventFocusRestore","tabIndex","mountAnimationState","isFirstOpen","animationsEnabled","animateOnMount","canWaitForFrame","requestAnimationFrame","cached","skipEnterTransition","shouldSkipEnterTransition","isVisible","backdrop","macroCondition","isTesting","disableTransitions","focusTrapOptions","clickOutsideDeactivates","allowOutsideClick","classes","overlay","useStyles","class","inPlace","enableFlexContent","disableFlexContent","customContentModifier","maybeWithoutEnter","options","withoutEnterTransition","backdropTransition","isEnabled","transition","name","setComponentTemplate","precompileTemplate","strictMode","scope","Portal","Backdrop","on","cssTransition","onClickOutside","focusTrap"],"mappings":";;;;;;;;;;;;;;;;;;;AA+BA;;;;;;;;;;;;AAYC;AACD,SAASA,4BAAAA,CACP,GAAGC,IAAwC,EAC1C;AACD,EAAA,MAAMC,OAAOC,eAAA,CAAA,GAAmBF,IAAA,CAAA;AAEhC,EAAA,MAAMG,K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U;AAC5CJ,MAAAA,OAAA,GAAU;AAAE,QAAA,GAAGA,OAAO;QAAE,GAAG,IAAI,CAACnH,IAAI,CAACuH;OAAW;AAClD,IAAA;AAEA,IAAA,OAAO,IAAI,CAACL,iBAAiB,CAACC,OAAA,CAAA;AAChC,EAAA;AAEA,EAAA;IAAAM,oBAAA,CAAAC,kBAAA,CAAA,k5CAAA,EAkDA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,MAAA;QAAAC,QAAA;QAAAC,EAAA;QAAAC,aAAA;QAAAC,cAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;"}
1
+ {"version":3,"file":"overlay.js","sources":["../../../src/components/overlays/overlay.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { cached, tracked } from '@glimmer/tracking';\nimport { action } from '@ember/object';\nimport { later } from '@ember/runloop';\nimport { on } from '@ember/modifier';\nimport { cssTransition } from 'ember-css-transitions';\nimport { useStyles } from '@frontile/theme';\nimport { modifier } from 'ember-modifier';\nimport { focusTrap, type FocusTrapModifierSignature } from 'ember-focus-trap';\nimport { createFocusTrap, type FocusTrap } from 'focus-trap';\nimport onClickOutside from 'ember-click-outside/modifiers/on-click-outside';\nimport { Backdrop, type BackdropSignature } from './backdrop';\nimport {\n afterFirstPaint,\n hasPainted,\n shouldDeferMount,\n shouldSkipEnterTransition,\n withoutEnterTransition\n} from './mount-animation';\nimport { Portal, findParentPortal, type PortalSignature } from './portal';\nimport type Owner from '@ember/owner';\nimport type { ModifierLike } from '@glint/template';\nimport type { CssTransitionSignature } from 'ember-css-transitions/modifiers/css-transition';\nimport { isTesting, macroCondition } from '@embroider/macros';\n\ntype FocusTrapOptions = NonNullable<\n FocusTrapModifierSignature['Args']['Named']['focusTrapOptions']\n>;\n\ntype FocusTrapLifecycleMethod = 'activate' | 'deactivate' | 'pause' | 'unpause';\n\n/**\n * Wraps `createFocusTrap` so activate/deactivate/pause/unpause never throw.\n *\n * focus-trap keeps a page-global stack of traps; deactivating one can reach\n * into the stack to re-validate (`unpause`) whichever trap is now on top. If\n * that other trap's container was already torn down -- which this test suite\n * does constantly, mounting and unmounting hundreds of trapped overlays in a\n * single browser session -- focus-trap throws \"must have at least one\n * container with at least one tabbable node\", per its own docs' \"Help\"\n * section: this is an expected hazard of trapped elements that \"appear and\n * disappear dynamically\", not a sign of a real focus bug. Test-only: real\n * usage never hits the same rapid-fire mount/unmount churn.\n */\nfunction createTestResilientFocusTrap(\n ...args: Parameters<typeof createFocusTrap>\n): FocusTrap {\n const trap = createFocusTrap(...args);\n\n const guard =\n (method: FocusTrapLifecycleMethod) =>\n (...methodArgs: unknown[]): FocusTrap => {\n try {\n return (trap[method] as (...a: unknown[]) => FocusTrap)(...methodArgs);\n } catch {\n return trap;\n }\n };\n\n return {\n ...trap,\n activate: guard('activate'),\n deactivate: guard('deactivate'),\n pause: guard('pause'),\n unpause: guard('unpause')\n };\n}\n\n/**\n * Whether `target` sits inside a portal nested within this overlay's own\n * portal.\n *\n * The question a click handler needs answered is about *this* click, not about\n * the mere existence of a nested portal. Asking only \"is a nested portal\n * mounted?\" made a parent overlay ignore every outside click for as long as a\n * child was open -- so with a Dropdown submenu (or a Select inside a Modal)\n * open, clicking the page did not close anything.\n *\n * A portal that is not a descendant of this overlay's portal -- one given an\n * explicit `@target`, or opted out of `appendToParentPortal` -- is not nested,\n * and a click in it is a genuine outside click.\n */\nfunction isWithinNestedPortal(\n contentElement: HTMLElement,\n target: EventTarget | null\n): boolean {\n const ownPortal = findParentPortal(contentElement);\n if (!ownPortal || !(target instanceof Element)) {\n return false;\n }\n\n const targetPortal = target.closest('[data-portal=\"true\"]');\n if (!targetPortal || targetPortal === ownPortal) {\n return false;\n }\n\n return ownPortal.contains(targetPortal);\n}\n\n// Blocking the body scroll mutates global state, so it has to be reference\n// counted: nested overlays (a Drawer opened from a Modal, a Select inside a\n// Modal) each lock on open and unlock on close, and only the last one out is\n// allowed to restore the page. We also remember the inline value the app had\n// before the first lock, so restoring does not silently wipe an app-level\n// `body { overflow: ... }`.\nlet bodyScrollLockCount = 0;\nlet previousBodyOverflow = '';\n\nfunction lockBodyScroll(): void {\n if (bodyScrollLockCount === 0) {\n previousBodyOverflow = document.body.style.overflow;\n document.body.style.overflow = 'hidden';\n }\n bodyScrollLockCount++;\n}\n\nfunction unlockBodyScroll(): void {\n if (bodyScrollLockCount === 0) {\n return;\n }\n\n bodyScrollLockCount--;\n\n if (bodyScrollLockCount === 0) {\n document.body.style.overflow = previousBodyOverflow;\n previousBodyOverflow = '';\n }\n}\n\nfunction hasWormholeOrAlertParentElement(el: HTMLElement) {\n let parent = el.parentElement;\n while (parent) {\n if (\n parent.id === 'ember-basic-dropdown-wormhole' ||\n parent.role === 'alert'\n ) {\n return true;\n }\n parent = parent.parentElement;\n }\n return false;\n}\n\ninterface Args extends Pick<\n PortalSignature['Args'],\n 'renderInPlace' | 'target'\n> {\n /**\n * Duration of the animation\n *\n * @defaultValue 200\n */\n transitionDuration?: number;\n\n /**\n * How the area behind the overlay is rendered: `none` omits the backdrop\n * entirely, `transparent` keeps it clickable but invisible, `faded` dims the\n * page, and `blur` blurs it.\n */\n backdrop?: BackdropSignature['Args']['type'];\n\n /**\n * Transition classes for the backdrop, overriding the defaults used when it\n * fades in and out.\n */\n backdropTransition?: BackdropSignature['Args']['transition'];\n\n /**\n * Disable css transitions\n *\n * @defaultValue false\n */\n disableTransitions?: boolean;\n\n /**\n * Whether an overlay that is *already open the first time it renders* --\n * deep-linked open, or restored by a page refresh -- animates in.\n *\n * When true (the default) the overlay waits for the browser's first paint\n * before mounting, so the animation plays against a page the user has\n * already seen. Set it to false for an already-open overlay that should\n * simply be there, with no reveal. An overlay opened later by interaction\n * animates either way, and so does closing.\n *\n * @defaultValue true\n */\n animateOnMount?: boolean;\n\n /**\n * Whether the focus trap is disabled or not\n *\n * @defaultValue false\n */\n disableFocusTrap?: boolean;\n\n /**\n * Focus trap options\n *\n * @defaultValue { clickOutsideDeactivates: true, allowOutsideClick: true }\n */\n focusTrapOptions?: FocusTrapOptions;\n\n /**\n * Whether it is open or not\n */\n isOpen: boolean;\n\n /**\n * A function that will be called when closed\n */\n onClose?: () => void;\n\n /**\n * A function that will be called when closing is finished executing, this\n * includes waiting for animations/transitions to finish.\n */\n didClose?: () => void;\n\n /**\n * A function that will be called when opened\n */\n onOpen?: () => void;\n\n /**\n * Whether to close when the area outside (the backdrop) is clicked\n *\n * @defaultValue true\n */\n closeOnOutsideClick?: boolean;\n\n /**\n * Whether to close when the overlay element is clicked, used for modal and drawer components.\n * This is set to true by default to allow \"outside click\" functionality to work properly.\n * Most overlay content is wrapped with an inner element, preventing accidental closure.\n *\n * @defaultValue true\n */\n closeOnOverlayElementClick?: boolean;\n\n /**\n * Whether to close when the escape key is pressed\n *\n * @defaultValue true\n */\n closeOnEscapeKey?: boolean;\n\n /**\n * Transition options\n *\n * @defaultValue {name:'overlay-transition--fade'}\n */\n transition?: CssTransitionSignature['Args']['Named'];\n\n /**\n * Opt out of the flex layout applied to the content element, for overlays\n * that need to lay their content out themselves.\n *\n * @defaultValue false\n */\n disableFlexContent?: boolean;\n\n /**\n * An extra modifier applied to the content element, for behavior the overlay\n * doesn't provide itself.\n */\n customContentModifier?: ModifierLike<{ Element: HTMLElement }>;\n\n /**\n * Custom class name for the content element, merged with the default ones\n * using Tailwind Merge.\n */\n class?: string;\n /**\n * @defaultValue false\n */\n preventFocusRestore?: boolean;\n\n /**\n * When focusTrap is disabled, by default Oberlay will be auto focused. This option prevents that.\n * @defaultValue false\n */\n preventAutoFocus?: boolean;\n\n /**\n * @defaultValue true\n */\n blockScroll?: boolean;\n}\n\ninterface OverlaySignature {\n Args: Args;\n Element: HTMLDivElement;\n Blocks: { default: [] };\n}\n\nclass Overlay extends Component<OverlaySignature> {\n @tracked keepOpen = false;\n\n // Whether the browser has painted since this overlay was created. Only ever\n // consulted while the mount is being deferred; see `mount-animation.ts`.\n @tracked hasWaitedForPaint = false;\n\n // Whether `@isOpen` was already true on the very first render. Captured once\n // rather than derived, because the whole question is about what the args\n // looked like at mount.\n isOpenAtMount = this.args.isOpen === true;\n\n // Whether the page had already painted when this overlay was created, which\n // only an overlay that mounts open ever has to know -- and every Dropdown,\n // Select and Tooltip in the app builds an Overlay too.\n hadPaintedAtMount = this.isOpenAtMount ? hasPainted() : false;\n\n // Latched when the first open closes, so a *reopen* of the same overlay\n // animates normally. Only a genuine close counts: the content element is\n // also torn down and rebuilt when the portal destination changes under an\n // open overlay, and flipping this then would swap the enter class names out\n // from under the running modifier, which cleans up using whatever names it\n // holds when the transition ends.\n @tracked hasClosedOnce = false;\n\n contentElement: HTMLElement | undefined;\n focusedElement: Element | null | undefined;\n mouseDownContentElement: EventTarget | null = null;\n\n // Whether *this* overlay is holding a reference on the body scroll lock. We\n // record the decision made when opening instead of re-deriving it at\n // teardown, because the args can change while the overlay is open and an\n // asymmetric lock/unlock would leak the reference count.\n didLockBodyScroll = false;\n\n cancelPaintWait: (() => void) | undefined;\n\n constructor(owner: Owner, args: Args) {\n super(owner, args);\n\n if (!this.shouldDeferMount) {\n return;\n }\n\n this.cancelPaintWait = afterFirstPaint(() => {\n if (!this.isDestroying && !this.isDestroyed) {\n this.hasWaitedForPaint = true;\n }\n });\n }\n\n willDestroy(): void {\n super.willDestroy();\n this.cancelPaintWait?.();\n }\n\n handleClose(): void {\n if (this.args.isOpen && typeof this.args.onClose === 'function') {\n this.args.onClose();\n }\n }\n\n @action handleContentClick(event: MouseEvent): void {\n if (\n this.args.closeOnOutsideClick !== false &&\n this.args.closeOnOverlayElementClick !== false &&\n event.target === this.contentElement &&\n this.mouseDownContentElement == this.contentElement &&\n !isWithinNestedPortal(this.contentElement, event.target) &&\n !hasWormholeOrAlertParentElement(event.target as HTMLElement)\n ) {\n this.handleClose();\n }\n this.mouseDownContentElement = null;\n }\n\n @action handleOutsideClick(e: Event): void {\n if (\n this.args.closeOnOutsideClick !== false &&\n this.contentElement &&\n !isWithinNestedPortal(this.contentElement, e.target) &&\n !hasWormholeOrAlertParentElement(e.target as HTMLElement)\n ) {\n this.handleClose();\n e.preventDefault();\n }\n }\n\n @action\n handleContentMouseDown(event: MouseEvent): void {\n if (this.args.closeOnOverlayElementClick !== false) {\n this.mouseDownContentElement = event.target;\n }\n }\n\n @action\n handleKeyDown(event: KeyboardEvent): void {\n if (event.key === 'Escape' && this.args.closeOnEscapeKey !== false) {\n this.handleClose();\n event.preventDefault();\n event.stopImmediatePropagation();\n }\n }\n\n setupContent = modifier((el: HTMLDivElement) => {\n let transitionDuration = this.args.transitionDuration || 200;\n if (!this.isAnimationEnabled) {\n transitionDuration = 0;\n }\n later(() => {\n if (this.isDestroyed) return;\n if (this.args.disableFocusTrap !== true) return;\n if (this.args.preventAutoFocus === true) return;\n el.focus();\n }, transitionDuration);\n\n this.contentElement = el;\n this.keepOpen = true;\n this.focusedElement = document.activeElement;\n\n if (this.args.renderInPlace !== true && this.args.blockScroll !== false) {\n this.didLockBodyScroll = true;\n lockBodyScroll();\n }\n\n if (typeof this.args.onOpen === 'function') {\n this.args.onOpen();\n }\n return () => {\n this.contentElement = undefined;\n\n if (this.args.isOpen !== true) {\n this.hasClosedOnce = true;\n }\n\n if (this.didLockBodyScroll) {\n this.didLockBodyScroll = false;\n unlockBodyScroll();\n }\n\n const { didClose } = this.args;\n later(() => {\n if (!this.isDestroyed) this.keepOpen = false;\n if (typeof didClose === 'function' && !this.isDestroyed) {\n didClose();\n }\n\n // restore focus\n if (\n !this.args.preventFocusRestore &&\n this.focusedElement &&\n (this.focusedElement as HTMLElement).tabIndex > -1 &&\n typeof (this.focusedElement as HTMLElement).focus !== 'undefined'\n ) {\n (this.focusedElement as HTMLElement).focus();\n }\n }, transitionDuration);\n };\n });\n\n @cached\n get mountAnimationState() {\n return {\n isFirstOpen: this.isOpenAtMount && !this.hasClosedOnce,\n animationsEnabled: this.isAnimationEnabled,\n animateOnMount: this.args.animateOnMount,\n canWaitForFrame: typeof requestAnimationFrame === 'function',\n hasPainted: this.hadPaintedAtMount\n };\n }\n\n get shouldDeferMount(): boolean {\n return shouldDeferMount(this.mountAnimationState);\n }\n\n get skipEnterTransition(): boolean {\n return shouldSkipEnterTransition(this.mountAnimationState);\n }\n\n get isVisible(): boolean {\n if (this.shouldDeferMount && !this.hasWaitedForPaint) {\n return false;\n }\n\n return this.args.isOpen || this.keepOpen;\n }\n\n get backdrop(): BackdropSignature['Args']['type'] {\n if (!this.args.isOpen) {\n return 'none';\n }\n return this.args.backdrop || 'faded';\n }\n\n get isAnimationEnabled(): boolean {\n if (macroCondition(isTesting())) {\n return false;\n }\n return !(this.args.disableTransitions === true);\n }\n\n /**\n * Consumer options are merged over the defaults rather than replacing them.\n *\n * Swapping the object wholesale made setting any single option -- a\n * `setReturnFocus`, an `initialFocus` -- silently drop\n * `clickOutsideDeactivates` and `allowOutsideClick` with it, at which point\n * the trap swallows outside clicks and the overlay can only be dismissed\n * with Escape. Nothing warns, and the cause is nowhere near the symptom.\n * A consumer that genuinely wants the trap to hold outside clicks can still\n * say so by passing those two as `false`.\n */\n get focusTrapOptions(): FocusTrapOptions {\n return {\n clickOutsideDeactivates: true,\n allowOutsideClick: true,\n ...this.args.focusTrapOptions\n };\n }\n\n get createFocusTrap(): typeof createFocusTrap | undefined {\n if (macroCondition(isTesting())) {\n return createTestResilientFocusTrap;\n }\n return undefined;\n }\n\n get classes() {\n const { overlay } = useStyles();\n\n return overlay({\n class: this.args.class,\n inPlace: this.args.renderInPlace,\n enableFlexContent: !(this.args.disableFlexContent === true)\n });\n }\n\n get customContentModifier() {\n if (this.args.customContentModifier) {\n return this.args.customContentModifier;\n }\n\n return modifier(() => {});\n }\n\n // Applied to both the content and the backdrop, so they never disagree about\n // whether this mount animates.\n maybeWithoutEnter<T extends object>(options: T): T {\n return this.skipEnterTransition ? withoutEnterTransition(options) : options;\n }\n\n get backdropTransition() {\n return this.maybeWithoutEnter(\n this.args.backdropTransition || { isEnabled: this.isAnimationEnabled }\n );\n }\n\n get transition() {\n let options: BackdropSignature['Args']['transition'] = {\n name: 'overlay-transition--fade',\n isEnabled: this.isAnimationEnabled\n };\n\n if (typeof this.args.transition === 'object') {\n options = { ...options, ...this.args.transition };\n }\n\n return this.maybeWithoutEnter(options);\n }\n\n <template>\n {{! template-lint-disable no-invalid-interactive }}\n {{! template-lint-disable no-pointer-down-event-binding }}\n\n {{#if this.isVisible}}\n <Portal @renderInPlace={{@renderInPlace}} @target={{@target}}>\n <Backdrop\n @type={{this.backdrop}}\n @inPlace={{@renderInPlace}}\n @transition={{this.backdropTransition}}\n />\n\n {{#if @isOpen}}\n <div\n {{this.setupContent}}\n {{on \"click\" this.handleContentClick}}\n {{on \"keydown\" this.handleKeyDown}}\n {{on \"mousedown\" this.handleContentMouseDown}}\n {{cssTransition\n didTransitionIn=this.transition.didTransitionIn\n didTransitionOut=this.transition.didTransitionOut\n enterClass=this.transition.enterClass\n enterActiveClass=this.transition.enterActiveClass\n enterToClass=this.transition.enterToClass\n isEnabled=this.transition.isEnabled\n leaveClass=this.transition.leaveClass\n leaveActiveClass=this.transition.leaveActiveClass\n leaveToClass=this.transition.leaveToClass\n name=this.transition.name\n parentSelector=this.transition.parentSelector\n }}\n {{onClickOutside this.handleOutsideClick capture=true}}\n {{focusTrap\n isActive=(if @disableFocusTrap false @isOpen)\n focusTrapOptions=this.focusTrapOptions\n _createFocusTrap=this.createFocusTrap\n }}\n class={{this.classes}}\n {{! Keep this custom modifer by last}}\n {{this.customContentModifier}}\n data-component=\"overlay\"\n data-part=\"base\"\n tabindex=\"0\"\n ...attributes\n >\n {{yield}}\n </div>\n {{/if}}\n </Portal>\n {{/if}}\n </template>\n}\n\nexport { Overlay, type OverlaySignature };\nexport default Overlay;\n"],"names":["createTestResilientFocusTrap","args","trap","createFocusTrap","guard","method","methodArgs","activate","deactivate","pause","unpause","isWithinNestedPortal","contentElement","target","ownPortal","findParentPortal","Element","targetPortal","closest","contains","bodyScrollLockCount","previousBodyOverflow","lockBodyScroll","document","body","style","overflow","unlockBodyScroll","hasWormholeOrAlertParentElement","el","parent","parentElement","id","role","Overlay","Component","g","prototype","tracked","i","isOpenAtMount","isOpen","hadPaintedAtMount","hasPainted","focusedElement","mouseDownContentElement","didLockBodyScroll","cancelPaintWait","constructor","owner","shouldDeferMount","afterFirstPaint","isDestroying","isDestroyed","hasWaitedForPaint","willDestroy","handleClose","onClose","handleContentClick","event","closeOnOutsideClick","closeOnOverlayElementClick","n","action","handleOutsideClick","e","preventDefault","handleContentMouseDown","handleKeyDown","key","closeOnEscapeKey","stopImmediatePropagation","setupContent","modifier","transitionDuration","isAnimationEnabled","later","disableFocusTrap","preventAutoFocus","focus","keepOpen","activeElement","renderInPlace","blockScroll","onOpen","undefined","hasClosedOnce","didClose","preventFocusRestore","tabIndex","mountAnimationState","isFirstOpen","animationsEnabled","animateOnMount","canWaitForFrame","requestAnimationFrame","cached","skipEnterTransition","shouldSkipEnterTransition","isVisible","backdrop","macroCondition","isTesting","disableTransitions","focusTrapOptions","clickOutsideDeactivates","allowOutsideClick","classes","overlay","useStyles","class","inPlace","enableFlexContent","disableFlexContent","customContentModifier","maybeWithoutEnter","options","withoutEnterTransition","backdropTransition","isEnabled","transition","name","setComponentTemplate","precompileTemplate","strictMode","scope","Portal","Backdrop","on","cssTransition","onClickOutside","focusTrap"],"mappings":";;;;;;;;;;;;;;;;;;;AA+BA;;;;;;;;;;;;AAYC;AACD,SAASA,4BAAAA,CACP,GAAGC,IAAwC,EAC1C;AACD,EAAA,MAAMC,OAAOC,eAAA,CAAA,GAAmBF,IAAA,CAAA;AAEhC,EAAA,MAAMG,KAAA,GACHC,MAAQ,IACT,CAAC,GAAGC,UAAmB,KAAK;IAC1B,IAAI;AACF,MAAA,OAAQJ,IAAI,CAACG,MAAA,CAAO,CAAkC,GAAKC,UAAA,CAAA;AAC7D,IAAA,CAAA,CAAE,MAAM;AACN,MAAA,OAAOJ,IAAA;AACT,IAAA;EACF,CAAA;EA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AAA,CAAA,k5CAAA,EAkDA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,MAAA;QAAAC,QAAA;QAAAC,EAAA;QAAAC,aAAA;QAAAC,cAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;"}
@@ -97,8 +97,8 @@ class Tooltip extends Component {
97
97
  * and possibly infinite" (reproduces the same way typed as `unknown`).
98
98
  * Applying a modifier directly (`{{this.someModifier someArg}}`) type-checks
99
99
  * fine; it is specifically the currying keyword's overload resolution that
100
- * Glint chokes on, matching the brief's anticipated fallback: build the
101
- * bound modifier value from plain JS instead of templated currying.
100
+ * Glint chokes on, so this file builds the bound modifier value from plain
101
+ * JS instead of templated currying.
102
102
  *
103
103
  * `modifier()` from `ember-modifier` returns the exact function it is
104
104
  * given, with only a modifier manager attached out of band (see its
@@ -126,16 +126,15 @@ class Tooltip extends Component {
126
126
  * reading `this.args.isDisabled` there is what makes ember-modifier tear
127
127
  * down and reinstall the trigger's listeners when it changes, without
128
128
  * needing a new outer modifier identity (so the element itself is never
129
- * remounted). The brief's sketch instead made `@isDisabled` an unreachable
130
- * `openDelay` (`Number.MAX_SAFE_INTEGER`) passed through to `Popover`. That
131
- * does not work: `@ember/test-helpers`' `settled()` -- which every
132
- * `await triggerEvent(...)` calls internally -- waits on
133
- * `backburner.hasTimers()`, which is true for *any* pending `later()` call
134
- * no matter how far in the future, so a `mouseenter` scheduling an
135
- * effectively-infinite open left every subsequent `await` hanging until
136
- * the QUnit test timeout (confirmed: the test hung at exactly 60000ms).
137
- * Skipping the hover installation entirely while disabled avoids ever
138
- * scheduling that timer in the first place.
129
+ * remounted). Passing `@isDisabled` through as an unreachable `openDelay`
130
+ * (`Number.MAX_SAFE_INTEGER`) does not work instead: `@ember/test-helpers`'
131
+ * `settled()` -- which every `await triggerEvent(...)` calls internally --
132
+ * waits on `backburner.hasTimers()`, which is true for *any* pending
133
+ * `later()` call no matter how far in the future, so a `mouseenter`
134
+ * scheduling an effectively-infinite open left every subsequent `await`
135
+ * hanging until the QUnit test timeout. Skipping the hover installation
136
+ * entirely while disabled avoids ever scheduling that timer in the first
137
+ * place.
139
138
  *
140
139
  * ANCHOR CHURN GUARD: the wrapper function below reads `this.isOpen`
141
140
  * *transitively* -- not directly, but through `trigger`'s own autotracking
@@ -155,16 +154,16 @@ class Tooltip extends Component {
155
154
  * `ember-modifier` before *every* re-run, same-element re-runs included --
156
155
  * therefore does not tear the anchor down synchronously; it only tears
157
156
  * down `trigger` immediately (the half that legitimately needs to re-run on
158
- * every open/close -- that's what keeps `aria-describedby` in sync, and
159
- * Task 5 documented it as required for controlled mode) and *defers* the
160
- * anchor decision via `scheduleAnchorTeardownCheck`.
157
+ * every open/close -- that's what keeps `aria-describedby` in sync, which
158
+ * controlled mode also depends on) and *defers* the anchor decision via
159
+ * `scheduleAnchorTeardownCheck`.
161
160
  *
162
- * FIX ROUND 2 -- the leak this guard introduced, and why a deferred check:
161
+ * Why a deferred check, rather than just comparing `element` identity:
163
162
  * `ember-modifier` gives the destructor no way to tell "about to re-run for
164
163
  * the same element" apart from "genuinely destroyed" -- both call the same
165
- * returned closure. Guarding the anchor by comparing `element` identity (as
166
- * fix round 1 did) is correct for the re-run case but has no destructor
167
- * path left for the case where `element` is removed entirely while
164
+ * returned closure. An identity comparison alone is correct for the
165
+ * re-run case but has no destructor path left for the case where `element`
166
+ * is removed entirely while
168
167
  * `Tooltip` itself keeps living (e.g. `{{#if this.show}}<button
169
168
  * {{t.trigger}}>{{/if}}`) -- nothing ever calls `ensureAnchor` again to
170
169
  * notice the change, and `willDestroy` only runs when `Tooltip` itself is
@@ -372,8 +371,7 @@ class TooltipContent extends Component {
372
371
  * placed before its own ...attributes). Tooltip has no element of its own:
373
372
  * its "base"/"arrow" slots render on the exact same portaled div
374
373
  * Overlay/Popover.Content own, so this is the only way to mark it
375
- * data-component="tooltip" without touching overlay.gts/popover.gts, which
376
- * are out of scope for this migration.
374
+ * data-component="tooltip" without touching overlay.gts/popover.gts.
377
375
  */
378
376
  static {
379
377
  setComponentTemplate(precompileTemplate("<@PopoverContent @class={{@classNames.base}} @arrowClass={{@classNames.arrow}} @arrow={{@arrow}} @disableInteractive={{@disableInteractive}} @transition={{hash name=\"overlay-transition--tooltip\"}} @blockScroll={{false}} @backdrop=\"none\" role=\"tooltip\" tabindex=\"-1\" data-component=\"tooltip\" data-part=\"base\" ...attributes>\n {{yield}}\n</@PopoverContent>", {
@@ -1 +1 @@
1
- {"version":3,"file":"tooltip.js","sources":["../../../src/components/overlays/tooltip.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { assert } from '@ember/debug';\nimport { hash } from '@ember/helper';\nimport { modifier } from 'ember-modifier';\n\nimport { next, cancel } from '@ember/runloop';\nimport type { Timer as EmberTimer } from '@ember/runloop';\nimport { useStyles } from '@frontile/theme';\nimport { Popover, type PopoverSignature } from './popover';\nimport type {\n TooltipVariants,\n TooltipSlots,\n SlotsToClasses\n} from '@frontile/theme';\nimport type { ModifierLike, WithBoundArgs } from '@glint/template';\nimport type Owner from '@ember/owner';\n\n/**\n * The type of `Popover`'s yielded `Content`, already bound to its internal\n * wiring (`loop`, `isOpen`, `id`, ...). Reusing this instead of\n * `ComponentLike<ContentSignature>` matters: the latter is the *unbound*\n * signature, so invoking it in a template would again require every one of\n * those internal args -- exactly what `WithBoundArgs` exists to avoid.\n */\ntype BoundPopoverContent = PopoverSignature['Blocks']['default'][0]['Content'];\n\n/**\n * The concrete function signature backing `PopoverTriggerModifier`. Glint's\n * `ModifierLike` is deliberately opaque -- it exists to keep a modifier from\n * being invoked as a plain function in application code -- so there is no\n * type-safe way to call through to it. This narrow, well-understood cast is\n * the exception: `modifier()` from `ember-modifier` returns the exact\n * function it was given. `ember-modifier`'s `dist/index.js` ends `modifier()`\n * with `return setModifierManager(() => MANAGER, fn);`. Its own comment there\n * calls the declared return type \"a *lie*\" -- that is about the TYPE, not the\n * runtime: `setModifierManager` delegates to `@glimmer/manager`'s\n * `setInternalModifierManager`, whose body is `map.set(obj, manager), obj`,\n * so it really does hand back the same `fn`. At runtime `p.trigger` *is*\n * that function. `(el, positional, named) => teardown` is how\n * `Popover`'s own `trigger` is declared.\n *\n * WARNING FOR A FUTURE UPGRADER: this cast is verified against\n * `ember-modifier@4.3.0`'s *function-based* modifier manager, whose\n * `createModifier`/`updateModifier`/`installModifier` call the given function\n * directly as `instance(element, positional, named)` -- i.e. the manager adds\n * no wrapping of its own, so invoking `p.trigger`/`p.anchor` here as plain\n * functions is genuinely calling the same code the manager would call.\n * `ModifierLike` has no call signature *by design* (it exists specifically to\n * stop application code from doing this), so there is no type-safe\n * alternative to the cast. A major `ember-modifier` upgrade could change the\n * manager's calling convention (or start wrapping the function) with no\n * compiler signal at this cast site -- re-verify against the new\n * `dist/index.js` before assuming this still holds. The runtime `assert`\n * calls at the call sites below exist so a break here fails loudly (a thrown\n * dev-mode assertion) instead of silently (a tooltip that never opens).\n */\ntype PopoverTriggerFn = (\n element: HTMLElement,\n positional: ['hover'],\n named: { aria: 'describedby' }\n) => void | (() => void);\n\n/**\n * `p.anchor` (`Velcro`'s `hook`) needs the same runtime call-through as\n * `p.trigger` above -- it is what makes `velcro.loop`/`p.Content`'s `@loop`\n * resolve at all. A consumer normally applies `{{p.anchor}}` and\n * `{{p.trigger}}` as two separate modifiers on the trigger element (see\n * `popover-test.gts`); a tooltip's single yielded `t.trigger` has to install\n * both. Same upgrade warning as `PopoverTriggerFn` above: `ember-velcro`'s\n * `hook` is built with the identical `setModifierManager(() => MANAGER, fn)`\n * pattern, so the same function-based-modifier assumption applies here too.\n */\ntype PopoverAnchorFn = (\n element: HTMLElement | SVGElement\n) => void | (() => void);\n\n/**\n * A modifier value that will be invoked directly as a function rather than\n * applied in a template. See `PopoverTriggerFn` for why that is sound and\n * what has to be re-verified on an `ember-modifier` upgrade. Stands in for\n * `p.anchor`/`p.trigger` wherever this file only needs to cache and compare\n * their identity (not call them) -- the actual call sites still narrow to\n * `PopoverAnchorFn`/`PopoverTriggerFn` via the existing documented casts.\n */\ntype CallableModifier = object;\n\ninterface TooltipSignature {\n Args: {\n /**\n * The tooltip's text. A shorthand for the common case; pass a `Content`\n * block instead when the tooltip needs markup. Passing both asserts.\n */\n content?: string;\n\n /**\n * The requested placement of the tooltip relative to its trigger. This is\n * a preference, not a guarantee: the flip middleware may resolve it to\n * the opposite side when there is no room for it in the requested spot.\n *\n * @defaultValue 'top'\n */\n placement?: PopoverSignature['Args']['placement'];\n\n /**\n * Renders an arrow pointing at the trigger.\n *\n * @defaultValue false\n */\n arrow?: boolean;\n\n /**\n * The tooltip's size, which scales its padding and label text.\n *\n * @defaultValue 'md'\n */\n size?: TooltipVariants['size'];\n\n /**\n * The tooltip's semantic color role. The arrow inherits the body's\n * background, so it follows the chosen intent automatically.\n *\n * @defaultValue 'neutral'\n */\n color?: TooltipVariants['color'];\n\n /**\n * Milliseconds before opening on hover or keyboard focus.\n *\n * @defaultValue 200\n */\n openDelay?: number;\n\n /**\n * Milliseconds before closing. Also the window the pointer has to cross\n * the gap into the tooltip, so a very small value makes the tooltip\n * effectively non-interactive.\n *\n * @defaultValue 150\n */\n closeDelay?: number;\n\n /**\n * Closes as soon as the pointer leaves the trigger, rather than letting it\n * move onto the tooltip.\n *\n * @defaultValue false\n */\n disableInteractive?: boolean;\n\n /**\n * Installs the trigger but never opens. For a tooltip whose text is\n * conditionally irrelevant.\n *\n * @defaultValue false\n */\n isDisabled?: boolean;\n\n /**\n * Whether the tooltip is open. Pair with `onOpenChange` to control it;\n * leave it unset to let the tooltip manage its own state. Passing\n * `isOpen` alone, without `onOpenChange`, falls back to uncontrolled\n * behavior.\n */\n isOpen?: boolean;\n\n /**\n * Callback when the tooltip opens or closes, receiving the new state.\n */\n onOpenChange?: (isOpen: boolean) => void;\n\n /**\n * Callback when closing has finished, including any exit transition.\n */\n didClose?: () => void;\n\n /**\n * The gap, in pixels, between the trigger and the tooltip. The default\n * leaves room for the arrow when `@arrow` is enabled.\n *\n * @defaultValue 8\n */\n offsetOptions?: PopoverSignature['Args']['offsetOptions'];\n\n /**\n * Options for the floating-ui flip middleware, which moves the tooltip\n * to the opposite side when it would overflow the viewport. Forwarded\n * to the underlying `Popover`.\n */\n flipOptions?: PopoverSignature['Args']['flipOptions'];\n\n /**\n * Options for the floating-ui shift middleware, which nudges the\n * tooltip along its axis to keep it in view. Forwarded to the\n * underlying `Popover`.\n */\n shiftOptions?: PopoverSignature['Args']['shiftOptions'];\n\n /**\n * Additional floating-ui middleware, for positioning behavior beyond\n * what `placement`, `offsetOptions`, `flipOptions`, and `shiftOptions`\n * cover. Forwarded to the underlying `Popover`.\n */\n middleware?: PopoverSignature['Args']['middleware'];\n\n /**\n * The CSS positioning strategy, forwarded to the underlying\n * `Popover`/floating-ui.\n *\n * @defaultValue 'absolute'\n */\n strategy?: PopoverSignature['Args']['strategy'];\n\n /**\n * Custom class for the tooltip, merged with the theme's using Tailwind\n * Merge.\n */\n class?: string;\n\n /**\n * Class names for each slot, merged with the theme's.\n */\n classes?: SlotsToClasses<TooltipSlots>;\n };\n Element: HTMLDivElement;\n Blocks: {\n default: [\n {\n /**\n * The modifier to apply to the element the tooltip describes. Installs\n * the hover/focus listeners that open and close the tooltip, and keeps\n * `aria-describedby` in sync while it does.\n */\n trigger: ModifierLike<{ Element: HTMLElement }>;\n Content: WithBoundArgs<\n typeof TooltipContent,\n | 'PopoverContent'\n | 'classNames'\n | 'arrow'\n | 'disableInteractive'\n | 'hasContentArg'\n >;\n\n /**\n * Whether the tooltip is currently open.\n */\n isOpen: boolean;\n\n /**\n * Opens the tooltip.\n */\n open: () => void;\n\n /**\n * Closes the tooltip.\n */\n close: () => void;\n }\n ];\n };\n}\n\nclass Tooltip extends Component<TooltipSignature> {\n get classNames() {\n const { tooltip } = useStyles();\n\n const { base, arrow } = tooltip({\n size: this.args.size,\n color: this.args.color\n });\n\n return {\n base: base({ class: [this.args.classes?.base, this.args.class] }),\n arrow: arrow({ class: this.args.classes?.arrow })\n };\n }\n\n get placement(): PopoverSignature['Args']['placement'] {\n return this.args.placement ?? 'top';\n }\n\n get offsetOptions() {\n return this.args.offsetOptions ?? 8;\n }\n\n get openDelay(): number {\n return typeof this.args.openDelay === 'number' ? this.args.openDelay : 200;\n }\n\n get closeDelay(): number {\n return typeof this.args.closeDelay === 'number'\n ? this.args.closeDelay\n : 150;\n }\n\n /**\n * `p.trigger` cannot be curried in a `.gts` template with the template's\n * `(modifier ...)` keyword: even binding a single positional argument onto\n * a wrapper modifier -- whatever its declared type -- makes Glint's\n * `--declaration` pass fail with \"Type instantiation is excessively deep\n * and possibly infinite\" (reproduces the same way typed as `unknown`).\n * Applying a modifier directly (`{{this.someModifier someArg}}`) type-checks\n * fine; it is specifically the currying keyword's overload resolution that\n * Glint chokes on, matching the brief's anticipated fallback: build the\n * bound modifier value from plain JS instead of templated currying.\n *\n * `modifier()` from `ember-modifier` returns the exact function it is\n * given, with only a modifier manager attached out of band (see its\n * `dist/index.js`: `setModifierManager(() => MANAGER, fn); return fn;`),\n * and `ember-velcro`'s `hook` (`p.anchor`) is built the same way. So both\n * `p.anchor` and `p.trigger` are, at runtime, genuinely just those\n * functions -- calling them directly from plain JS is well-defined, even\n * though Glint's opaque `ModifierLike` intentionally exposes no call\n * signature for either.\n *\n * `t.trigger` has to install *both*: a tooltip's trigger element is also\n * its `Velcro` anchor. A normal `Popover` consumer applies `{{p.anchor}}`\n * and `{{p.trigger}}` as two separate modifiers on the same element (see\n * `popover-test.gts`); missing the anchor doesn't fail loudly by itself --\n * it just leaves `velcro.loop` (and so `p.Content`'s `@loop`) undefined,\n * which then asserts inside `Content`.\n *\n * Memoized on the `(anchor, trigger)` pair's identity (both stable for a\n * given `Popover` instance, since `Popover`/`Velcro` each assign their\n * fields once) so `t.trigger` keeps a stable identity across re-renders\n * instead of tearing down and reinstalling on every one.\n *\n * `@isDisabled` is read *inside* the installed function below, rather than\n * baked into this cache -- deliberately. `modifier()`'s function autotracks:\n * reading `this.args.isDisabled` there is what makes ember-modifier tear\n * down and reinstall the trigger's listeners when it changes, without\n * needing a new outer modifier identity (so the element itself is never\n * remounted). The brief's sketch instead made `@isDisabled` an unreachable\n * `openDelay` (`Number.MAX_SAFE_INTEGER`) passed through to `Popover`. That\n * does not work: `@ember/test-helpers`' `settled()` -- which every\n * `await triggerEvent(...)` calls internally -- waits on\n * `backburner.hasTimers()`, which is true for *any* pending `later()` call\n * no matter how far in the future, so a `mouseenter` scheduling an\n * effectively-infinite open left every subsequent `await` hanging until\n * the QUnit test timeout (confirmed: the test hung at exactly 60000ms).\n * Skipping the hover installation entirely while disabled avoids ever\n * scheduling that timer in the first place.\n *\n * ANCHOR CHURN GUARD: the wrapper function below reads `this.isOpen`\n * *transitively* -- not directly, but through `trigger`'s own autotracking\n * of `aria-describedby` -- so `ember-modifier` tears the whole wrapper down\n * and reinstalls it on every open/close. Without a guard, that would call\n * `anchor(element)` again on every cycle, and `Velcro`'s `hook` reassigns\n * its own `@tracked hook` field each time it runs, which tears down and\n * restarts floating-ui's `autoUpdate` positioning loop for no reason -- a\n * normal `Popover` consumer never pays this cost, because there `anchor`\n * and `trigger` are two separate modifiers and `anchor`'s body reads\n * nothing tracked, so it installs once and never re-runs.\n *\n * The fix keys the anchor's lifecycle on the *element* in instance state\n * (`anchoredElement`/`anchorTeardown`), not on the wrapper modifier's own\n * re-run: `ensureAnchor` below only calls `anchor(element)` when the\n * element actually changes. The wrapper's own destructor -- called by\n * `ember-modifier` before *every* re-run, same-element re-runs included --\n * therefore does not tear the anchor down synchronously; it only tears\n * down `trigger` immediately (the half that legitimately needs to re-run on\n * every open/close -- that's what keeps `aria-describedby` in sync, and\n * Task 5 documented it as required for controlled mode) and *defers* the\n * anchor decision via `scheduleAnchorTeardownCheck`.\n *\n * FIX ROUND 2 -- the leak this guard introduced, and why a deferred check:\n * `ember-modifier` gives the destructor no way to tell \"about to re-run for\n * the same element\" apart from \"genuinely destroyed\" -- both call the same\n * returned closure. Guarding the anchor by comparing `element` identity (as\n * fix round 1 did) is correct for the re-run case but has no destructor\n * path left for the case where `element` is removed entirely while\n * `Tooltip` itself keeps living (e.g. `{{#if this.show}}<button\n * {{t.trigger}}>{{/if}}`) -- nothing ever calls `ensureAnchor` again to\n * notice the change, and `willDestroy` only runs when `Tooltip` itself is\n * torn down. `scheduleAnchorTeardownCheck`/`confirmAnchorTeardown` resolve\n * the ambiguity by deferring one runloop turn (`@ember/runloop`'s `next`):\n * if the wrapper re-runs for the same element, `ensureAnchor` cancels the\n * pending check synchronously, before it fires; if `element` was genuinely\n * removed, nothing cancels it and the anchor is torn down for real one turn\n * later. The anchor is therefore torn down in exactly three places:\n * `ensureAnchor` (a different element arrived), `confirmAnchorTeardown`\n * (the deferred check fired unchallenged), and `willDestroy` (the component\n * itself is destroyed) -- never synchronously inside the wrapper's own\n * destructor.\n */\n cachedTrigger?: {\n anchor: CallableModifier;\n trigger: CallableModifier;\n modifier: ModifierLike<{ Element: HTMLElement }>;\n };\n\n /**\n * The element the anchor is currently installed on, and the teardown\n * `anchor(element)` handed back for it. Lives on the component instance\n * (not in the modifier's own closure) so it survives every open/close\n * re-run of the wrapper modifier -- see the churn-guard note above.\n */\n anchoredElement?: HTMLElement | SVGElement;\n anchorTeardown?: () => void;\n\n /**\n * A scheduled-but-not-yet-confirmed anchor teardown, set by the wrapper\n * modifier's destructor (see `makeTrigger`) and cancelled by `ensureAnchor`\n * if the wrapper turns out to have just re-run for the same element.\n *\n * WHY THIS EXISTS: `ember-modifier` calls the wrapper's destructor before\n * *every* re-run (same-element open/close churn included) as well as on\n * genuine removal, and does not tell us which. So the destructor alone\n * cannot decide whether to tear the anchor down. Deferring the decision by\n * one runloop turn resolves the ambiguity: if the wrapper is only\n * re-running, `ensureAnchor` runs synchronously afterwards (same tick,\n * before the deferred check fires) and cancels this; if the element was\n * genuinely removed, nothing calls `ensureAnchor` again, so the deferred\n * check fires and the anchor is torn down for real.\n *\n * Scheduled with `@ember/runloop`'s `next`/`cancel`, like the rest of this\n * codebase's timer usage (see `popover.gts`'s `hoverTimer`), rather than a\n * bespoke `setTimeout`.\n */\n pendingAnchorTeardown?: {\n element: HTMLElement | SVGElement;\n timer: EmberTimer;\n };\n\n /**\n * Installs `anchor` on `element` only if it is not already installed\n * there. Called on every wrapper re-run (every open/close), but is a no-op\n * on all but the first call and any call where the element genuinely\n * changed.\n *\n * Declared as a regular (prototype) method rather than an arrow-function\n * class field -- unlike `makeTrigger`, it is only ever called as\n * `this.ensureAnchor(...)`, never passed by reference, so it doesn't need\n * per-instance `this`-binding. Living on the prototype also makes it the\n * one seam the test suite can wrap to count real anchor installations\n * (see `tooltip-test.gts`'s anchor-churn-guard test).\n */\n ensureAnchor(anchor: CallableModifier, element: HTMLElement | SVGElement) {\n // The wrapper modifier re-ran for this same element -- any anchor\n // teardown its destructor speculatively scheduled (see\n // `scheduleAnchorTeardownCheck`) is stale: the element didn't actually go\n // away, so cancel the pending check before it can fire.\n if (\n this.pendingAnchorTeardown &&\n this.pendingAnchorTeardown.element === element\n ) {\n cancel(this.pendingAnchorTeardown.timer);\n this.pendingAnchorTeardown = undefined;\n }\n\n if (this.anchoredElement === element) {\n return;\n }\n\n // A different element arrived (or this is the first install for this\n // wrapper): tear down whatever anchor is currently installed before\n // installing the new one, so we never leak a stale `autoUpdate` loop.\n this.anchorTeardown?.();\n\n assert(\n \"Expected `p.anchor` to be a callable function (ember-velcro's `hook`, built the same way `ember-modifier`'s `modifier()` builds a callable function-based modifier). If this fires, an `ember-modifier` or `ember-velcro` upgrade likely changed how modifier values are constructed -- see the `PopoverAnchorFn`/`PopoverTriggerFn` comments above.\",\n typeof anchor === 'function'\n );\n\n const teardown = (anchor as unknown as PopoverAnchorFn)(element);\n\n this.anchoredElement = element;\n this.anchorTeardown = teardown ?? undefined;\n }\n\n /**\n * Called from the wrapper modifier's destructor -- i.e. on *every*\n * re-run of the wrapper, not only on genuine removal of `element`. Defers\n * the decision by one runloop turn: schedules `confirmAnchorTeardown` via\n * `next()`, which only actually tears the anchor down if nothing cancels\n * it first. `ensureAnchor` (above) is what cancels it, synchronously,\n * within the same runloop turn, if the wrapper turns out to have simply\n * re-run for the same element.\n */\n scheduleAnchorTeardownCheck(element: HTMLElement | SVGElement) {\n // Superseding an earlier pending check for a different element should\n // not normally happen (a new one would already have been resolved by an\n // intervening `ensureAnchor` call), but cancel defensively rather than\n // leak the earlier timer.\n if (this.pendingAnchorTeardown) {\n cancel(this.pendingAnchorTeardown.timer);\n }\n\n const timer = next(() => this.confirmAnchorTeardown(element));\n this.pendingAnchorTeardown = { element, timer };\n }\n\n /**\n * Runs one runloop turn after the wrapper modifier's destructor scheduled\n * it. If it gets here at all (i.e. `ensureAnchor` did not cancel it in the\n * meantime), the wrapper never re-ran for `element` -- the element was\n * genuinely removed -- so the anchor installed on it is torn down for\n * real.\n */\n confirmAnchorTeardown(element: HTMLElement | SVGElement) {\n if (\n !this.pendingAnchorTeardown ||\n this.pendingAnchorTeardown.element !== element\n ) {\n // Already superseded/cancelled (or, in principle, stale) -- nothing to\n // do.\n return;\n }\n\n this.pendingAnchorTeardown = undefined;\n\n if (this.anchoredElement === element) {\n this.anchorTeardown?.();\n this.anchoredElement = undefined;\n this.anchorTeardown = undefined;\n }\n }\n\n willDestroy() {\n super.willDestroy();\n if (this.pendingAnchorTeardown) {\n cancel(this.pendingAnchorTeardown.timer);\n this.pendingAnchorTeardown = undefined;\n }\n this.anchorTeardown?.();\n this.anchoredElement = undefined;\n this.anchorTeardown = undefined;\n }\n\n makeTrigger = (\n anchor: CallableModifier,\n trigger: CallableModifier\n ): ModifierLike<{ Element: HTMLElement }> => {\n if (\n !this.cachedTrigger ||\n this.cachedTrigger.anchor !== anchor ||\n this.cachedTrigger.trigger !== trigger\n ) {\n this.cachedTrigger = {\n anchor,\n trigger,\n modifier: modifier((element: HTMLElement) => {\n this.ensureAnchor(anchor, element);\n\n if (this.args.isDisabled) {\n return undefined;\n }\n\n assert(\n \"Expected `p.trigger` to be a callable function (a modifier built by `ember-modifier`'s `modifier()`). If this fires, an `ember-modifier` upgrade likely changed how function-based modifiers are constructed -- see the `PopoverTriggerFn` comment above.\",\n typeof trigger === 'function'\n );\n\n const teardownTrigger = (trigger as unknown as PopoverTriggerFn)(\n element,\n ['hover'],\n { aria: 'describedby' }\n );\n\n // `ember-modifier` calls this destructor before *every* re-run --\n // including a same-element re-run driven by `this.isOpen` churn --\n // and on genuine removal of `element`, with no way to tell which\n // from here. The trigger half always tears down and reinstalls\n // (that's what keeps `aria-describedby` in sync). The anchor half\n // cannot follow the same rule -- unconditionally tearing it down\n // here would reintroduce the churn this guard exists to prevent --\n // so it's handled by deferred confirmation: `scheduleAnchorTeardownCheck`\n // only *actually* tears the anchor down one runloop turn later, and\n // only if `ensureAnchor` doesn't cancel it first because the\n // wrapper turned out to just be re-running for the same element.\n // See the doc comments on `pendingAnchorTeardown` /\n // `scheduleAnchorTeardownCheck` / `confirmAnchorTeardown` above.\n return () => {\n teardownTrigger?.();\n this.scheduleAnchorTeardownCheck(element);\n };\n }) as unknown as ModifierLike<{ Element: HTMLElement }>\n };\n }\n\n return this.cachedTrigger.modifier;\n };\n\n <template>\n <Popover\n @placement={{this.placement}}\n @offsetOptions={{this.offsetOptions}}\n @flipOptions={{@flipOptions}}\n @shiftOptions={{@shiftOptions}}\n @middleware={{@middleware}}\n @strategy={{@strategy}}\n @openDelay={{this.openDelay}}\n @closeDelay={{this.closeDelay}}\n @isOpen={{@isOpen}}\n @onOpenChange={{@onOpenChange}}\n @didClose={{@didClose}}\n as |p|\n >\n {{yield\n (hash\n trigger=(this.makeTrigger p.anchor p.trigger)\n isOpen=p.isOpen\n open=p.open\n close=p.close\n Content=(component\n TooltipContent\n PopoverContent=p.Content\n classNames=this.classNames\n arrow=@arrow\n disableInteractive=@disableInteractive\n hasContentArg=(if @content true false)\n )\n )\n }}\n\n {{#if @content}}\n <TooltipContent\n @PopoverContent={{p.Content}}\n @classNames={{this.classNames}}\n @arrow={{@arrow}}\n @disableInteractive={{@disableInteractive}}\n ...attributes\n >\n {{@content}}\n </TooltipContent>\n {{/if}}\n </Popover>\n </template>\n}\n\ninterface TooltipContentSignature {\n Args: {\n /**\n * @internal\n */\n PopoverContent: BoundPopoverContent;\n\n /**\n * @internal\n */\n classNames: { base: string; arrow: string };\n\n /**\n * @internal\n */\n arrow?: boolean;\n\n /**\n * @internal\n */\n disableInteractive?: boolean;\n\n /**\n * @internal\n * Set only on the bound `Content` yielded to the consumer. Lets this\n * component assert when it renders while `@content` is also in use --\n * a `Tooltip` cannot otherwise tell whether the consumer invoked the\n * yielded `Content` block.\n */\n hasContentArg?: boolean;\n };\n Element: HTMLDivElement;\n Blocks: { default: [] };\n}\n\n/**\n * The tooltip's content. Configures `Popover.Content` for a tooltip: no focus\n * trap, no autofocus, no scroll lock, `role=\"tooltip\"`, and `tabindex=\"-1\"` so\n * it is never a tab stop -- `Overlay` sets `tabindex=\"0\"` but spreads\n * `...attributes` after it, so this wins.\n *\n * Its constructor also asserts that `@content` and a `<t.Content>` block are\n * never used together: `hasContentArg` is set only on the bound `Content`\n * yielded to the consumer (see `TooltipContentSignature['Args']`), so this\n * component renders with it `true` exactly when the consumer both passed\n * `@content` to `Tooltip` *and* invoked the yielded `Content` block. The\n * check has to live here, on the content side, rather than on `Tooltip`\n * itself, because a Glimmer component has no way to observe whether a\n * consumer invoked one of its yielded blocks -- `Tooltip` cannot tell\n * `<t.Content>` was used at all until this component actually renders.\n */\nclass TooltipContent extends Component<TooltipContentSignature> {\n constructor(owner: Owner, args: TooltipContentSignature['Args']) {\n super(owner, args);\n\n assert(\n '<Tooltip> received both @content and a <t.Content> block. Use one or the other.',\n !this.args.hasContentArg\n );\n }\n\n /**\n * `data-component`/`data-part` below are written before ...attributes, so\n * they flow through Popover.Content's own ...attributes forwarding onto\n * Overlay's rendered div and override its default data-component=\"overlay\"\n * -- the standard splattributes-override pattern Overlay's own template is\n * written to support (its literal data-component=\"overlay\" is likewise\n * placed before its own ...attributes). Tooltip has no element of its own:\n * its \"base\"/\"arrow\" slots render on the exact same portaled div\n * Overlay/Popover.Content own, so this is the only way to mark it\n * data-component=\"tooltip\" without touching overlay.gts/popover.gts, which\n * are out of scope for this migration.\n */\n <template>\n <@PopoverContent\n @class={{@classNames.base}}\n @arrowClass={{@classNames.arrow}}\n @arrow={{@arrow}}\n @disableInteractive={{@disableInteractive}}\n @transition={{hash name=\"overlay-transition--tooltip\"}}\n @blockScroll={{false}}\n @backdrop=\"none\"\n role=\"tooltip\"\n tabindex=\"-1\"\n data-component=\"tooltip\"\n data-part=\"base\"\n ...attributes\n >\n {{yield}}\n </@PopoverContent>\n </template>\n}\n\nexport { Tooltip, type TooltipSignature };\nexport default Tooltip;\n"],"names":["Tooltip","Component","classNames","tooltip","useStyles","base","arrow","size","args","color","class","classes","placement","offsetOptions","openDelay","closeDelay","cachedTrigger","anchoredElement","anchorTeardown","pendingAnchorTeardown","ensureAnchor","anchor","element","cancel","timer","undefined","assert","teardown","scheduleAnchorTeardownCheck","next","confirmAnchorTeardown","willDestroy","makeTrigger","trigger","modifier","isDisabled","teardownTrigger","aria","setComponentTemplate","precompileTemplate","strictMode","scope","Popover","hash","TooltipContent","constructor","owner","hasContentArg"],"mappings":";;;;;;;;;;AA0BA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BC;AAOD;;;;;;;;;AASC;AAKD;;;;;;;AAOC;AAkLD,MAAMA,gBAAgBC,SAAA,CAAU;EAC9B,IAAIC,UAAAA,GAAa;IACf,MAAM;AAAEC,MAAAA;KAAS,GAAGC,SAAA,EAAA;IAEpB,MAAM;MAAEC,IAAI;AAAEC,MAAAA;KAAO,GAAGH,OAAA,CAAQ;AAC9BI,MAAAA,IAAA,EAAM,IAAI,CAACC,IAAI,CAACD,IAAI;AACpBE,MAAAA,KAAA,EAAO,IAAI,CAACD,IAAI,CAACC;AACnB,KAAA,CAAA;IAEA,OAAO;MACLJ,IAAA,EAAMA,IAAA,CAAK;AAAEK,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A,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,OAAA;QAAAC,IAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;AAqCA;;;;;;;;;;;;;;;;AAgBA,MAAMA,uBAAuB3C,SAAA,CAAU;AACrC4C,EAAAA,WAAAA,CAAYC,KAAY,EAAEtC,IAAqC,EAAE;AAC/D,IAAA,KAAK,CAACsC,KAAA,EAAOtC,IAAA,CAAA;IAEbkB,MAAA,CACE,mFACA,CAAC,IAAI,CAAClB,IAAI,CAACuC,aAAa,CAAA;AAE5B,EAAA;AAEA;;;;;;;;;;;AAWC;AACD,EAAA;IAAAT,oBAAA,CAAAC,kBAAA,CAAA,iXAAA,EAiBA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;AAAAE,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;"}
1
+ {"version":3,"file":"tooltip.js","sources":["../../../src/components/overlays/tooltip.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { assert } from '@ember/debug';\nimport { hash } from '@ember/helper';\nimport { modifier } from 'ember-modifier';\n\nimport { next, cancel } from '@ember/runloop';\nimport type { Timer as EmberTimer } from '@ember/runloop';\nimport { useStyles } from '@frontile/theme';\nimport { Popover, type PopoverSignature } from './popover';\nimport type {\n TooltipVariants,\n TooltipSlots,\n SlotsToClasses\n} from '@frontile/theme';\nimport type { ModifierLike, WithBoundArgs } from '@glint/template';\nimport type Owner from '@ember/owner';\n\n/**\n * The type of `Popover`'s yielded `Content`, already bound to its internal\n * wiring (`loop`, `isOpen`, `id`, ...). Reusing this instead of\n * `ComponentLike<ContentSignature>` matters: the latter is the *unbound*\n * signature, so invoking it in a template would again require every one of\n * those internal args -- exactly what `WithBoundArgs` exists to avoid.\n */\ntype BoundPopoverContent = PopoverSignature['Blocks']['default'][0]['Content'];\n\n/**\n * The concrete function signature backing `PopoverTriggerModifier`. Glint's\n * `ModifierLike` is deliberately opaque -- it exists to keep a modifier from\n * being invoked as a plain function in application code -- so there is no\n * type-safe way to call through to it. This narrow, well-understood cast is\n * the exception: `modifier()` from `ember-modifier` returns the exact\n * function it was given. `ember-modifier`'s `dist/index.js` ends `modifier()`\n * with `return setModifierManager(() => MANAGER, fn);`. Its own comment there\n * calls the declared return type \"a *lie*\" -- that is about the TYPE, not the\n * runtime: `setModifierManager` delegates to `@glimmer/manager`'s\n * `setInternalModifierManager`, whose body is `map.set(obj, manager), obj`,\n * so it really does hand back the same `fn`. At runtime `p.trigger` *is*\n * that function. `(el, positional, named) => teardown` is how\n * `Popover`'s own `trigger` is declared.\n *\n * WARNING FOR A FUTURE UPGRADER: this cast is verified against\n * `ember-modifier@4.3.0`'s *function-based* modifier manager, whose\n * `createModifier`/`updateModifier`/`installModifier` call the given function\n * directly as `instance(element, positional, named)` -- i.e. the manager adds\n * no wrapping of its own, so invoking `p.trigger`/`p.anchor` here as plain\n * functions is genuinely calling the same code the manager would call.\n * `ModifierLike` has no call signature *by design* (it exists specifically to\n * stop application code from doing this), so there is no type-safe\n * alternative to the cast. A major `ember-modifier` upgrade could change the\n * manager's calling convention (or start wrapping the function) with no\n * compiler signal at this cast site -- re-verify against the new\n * `dist/index.js` before assuming this still holds. The runtime `assert`\n * calls at the call sites below exist so a break here fails loudly (a thrown\n * dev-mode assertion) instead of silently (a tooltip that never opens).\n */\ntype PopoverTriggerFn = (\n element: HTMLElement,\n positional: ['hover'],\n named: { aria: 'describedby' }\n) => void | (() => void);\n\n/**\n * `p.anchor` (`Velcro`'s `hook`) needs the same runtime call-through as\n * `p.trigger` above -- it is what makes `velcro.loop`/`p.Content`'s `@loop`\n * resolve at all. A consumer normally applies `{{p.anchor}}` and\n * `{{p.trigger}}` as two separate modifiers on the trigger element (see\n * `popover-test.gts`); a tooltip's single yielded `t.trigger` has to install\n * both. Same upgrade warning as `PopoverTriggerFn` above: `ember-velcro`'s\n * `hook` is built with the identical `setModifierManager(() => MANAGER, fn)`\n * pattern, so the same function-based-modifier assumption applies here too.\n */\ntype PopoverAnchorFn = (\n element: HTMLElement | SVGElement\n) => void | (() => void);\n\n/**\n * A modifier value that will be invoked directly as a function rather than\n * applied in a template. See `PopoverTriggerFn` for why that is sound and\n * what has to be re-verified on an `ember-modifier` upgrade. Stands in for\n * `p.anchor`/`p.trigger` wherever this file only needs to cache and compare\n * their identity (not call them) -- the actual call sites still narrow to\n * `PopoverAnchorFn`/`PopoverTriggerFn` via the existing documented casts.\n */\ntype CallableModifier = object;\n\ninterface TooltipSignature {\n Args: {\n /**\n * The tooltip's text. A shorthand for the common case; pass a `Content`\n * block instead when the tooltip needs markup. Passing both asserts.\n */\n content?: string;\n\n /**\n * The requested placement of the tooltip relative to its trigger. This is\n * a preference, not a guarantee: the flip middleware may resolve it to\n * the opposite side when there is no room for it in the requested spot.\n *\n * @defaultValue 'top'\n */\n placement?: PopoverSignature['Args']['placement'];\n\n /**\n * Renders an arrow pointing at the trigger.\n *\n * @defaultValue false\n */\n arrow?: boolean;\n\n /**\n * The tooltip's size, which scales its padding and label text.\n *\n * @defaultValue 'md'\n */\n size?: TooltipVariants['size'];\n\n /**\n * The tooltip's semantic color role. The arrow inherits the body's\n * background, so it follows the chosen intent automatically.\n *\n * @defaultValue 'neutral'\n */\n color?: TooltipVariants['color'];\n\n /**\n * Milliseconds before opening on hover or keyboard focus.\n *\n * @defaultValue 200\n */\n openDelay?: number;\n\n /**\n * Milliseconds before closing. Also the window the pointer has to cross\n * the gap into the tooltip, so a very small value makes the tooltip\n * effectively non-interactive.\n *\n * @defaultValue 150\n */\n closeDelay?: number;\n\n /**\n * Closes as soon as the pointer leaves the trigger, rather than letting it\n * move onto the tooltip.\n *\n * @defaultValue false\n */\n disableInteractive?: boolean;\n\n /**\n * Installs the trigger but never opens. For a tooltip whose text is\n * conditionally irrelevant.\n *\n * @defaultValue false\n */\n isDisabled?: boolean;\n\n /**\n * Whether the tooltip is open. Pair with `onOpenChange` to control it;\n * leave it unset to let the tooltip manage its own state. Passing\n * `isOpen` alone, without `onOpenChange`, falls back to uncontrolled\n * behavior.\n */\n isOpen?: boolean;\n\n /**\n * Callback when the tooltip opens or closes, receiving the new state.\n */\n onOpenChange?: (isOpen: boolean) => void;\n\n /**\n * Callback when closing has finished, including any exit transition.\n */\n didClose?: () => void;\n\n /**\n * The gap, in pixels, between the trigger and the tooltip. The default\n * leaves room for the arrow when `@arrow` is enabled.\n *\n * @defaultValue 8\n */\n offsetOptions?: PopoverSignature['Args']['offsetOptions'];\n\n /**\n * Options for the floating-ui flip middleware, which moves the tooltip\n * to the opposite side when it would overflow the viewport. Forwarded\n * to the underlying `Popover`.\n */\n flipOptions?: PopoverSignature['Args']['flipOptions'];\n\n /**\n * Options for the floating-ui shift middleware, which nudges the\n * tooltip along its axis to keep it in view. Forwarded to the\n * underlying `Popover`.\n */\n shiftOptions?: PopoverSignature['Args']['shiftOptions'];\n\n /**\n * Additional floating-ui middleware, for positioning behavior beyond\n * what `placement`, `offsetOptions`, `flipOptions`, and `shiftOptions`\n * cover. Forwarded to the underlying `Popover`.\n */\n middleware?: PopoverSignature['Args']['middleware'];\n\n /**\n * The CSS positioning strategy, forwarded to the underlying\n * `Popover`/floating-ui.\n *\n * @defaultValue 'absolute'\n */\n strategy?: PopoverSignature['Args']['strategy'];\n\n /**\n * Custom class for the tooltip, merged with the theme's using Tailwind\n * Merge.\n */\n class?: string;\n\n /**\n * Class names for each slot, merged with the theme's.\n */\n classes?: SlotsToClasses<TooltipSlots>;\n };\n Element: HTMLDivElement;\n Blocks: {\n default: [\n {\n /**\n * The modifier to apply to the element the tooltip describes. Installs\n * the hover/focus listeners that open and close the tooltip, and keeps\n * `aria-describedby` in sync while it does.\n */\n trigger: ModifierLike<{ Element: HTMLElement }>;\n Content: WithBoundArgs<\n typeof TooltipContent,\n | 'PopoverContent'\n | 'classNames'\n | 'arrow'\n | 'disableInteractive'\n | 'hasContentArg'\n >;\n\n /**\n * Whether the tooltip is currently open.\n */\n isOpen: boolean;\n\n /**\n * Opens the tooltip.\n */\n open: () => void;\n\n /**\n * Closes the tooltip.\n */\n close: () => void;\n }\n ];\n };\n}\n\nclass Tooltip extends Component<TooltipSignature> {\n get classNames() {\n const { tooltip } = useStyles();\n\n const { base, arrow } = tooltip({\n size: this.args.size,\n color: this.args.color\n });\n\n return {\n base: base({ class: [this.args.classes?.base, this.args.class] }),\n arrow: arrow({ class: this.args.classes?.arrow })\n };\n }\n\n get placement(): PopoverSignature['Args']['placement'] {\n return this.args.placement ?? 'top';\n }\n\n get offsetOptions() {\n return this.args.offsetOptions ?? 8;\n }\n\n get openDelay(): number {\n return typeof this.args.openDelay === 'number' ? this.args.openDelay : 200;\n }\n\n get closeDelay(): number {\n return typeof this.args.closeDelay === 'number'\n ? this.args.closeDelay\n : 150;\n }\n\n /**\n * `p.trigger` cannot be curried in a `.gts` template with the template's\n * `(modifier ...)` keyword: even binding a single positional argument onto\n * a wrapper modifier -- whatever its declared type -- makes Glint's\n * `--declaration` pass fail with \"Type instantiation is excessively deep\n * and possibly infinite\" (reproduces the same way typed as `unknown`).\n * Applying a modifier directly (`{{this.someModifier someArg}}`) type-checks\n * fine; it is specifically the currying keyword's overload resolution that\n * Glint chokes on, so this file builds the bound modifier value from plain\n * JS instead of templated currying.\n *\n * `modifier()` from `ember-modifier` returns the exact function it is\n * given, with only a modifier manager attached out of band (see its\n * `dist/index.js`: `setModifierManager(() => MANAGER, fn); return fn;`),\n * and `ember-velcro`'s `hook` (`p.anchor`) is built the same way. So both\n * `p.anchor` and `p.trigger` are, at runtime, genuinely just those\n * functions -- calling them directly from plain JS is well-defined, even\n * though Glint's opaque `ModifierLike` intentionally exposes no call\n * signature for either.\n *\n * `t.trigger` has to install *both*: a tooltip's trigger element is also\n * its `Velcro` anchor. A normal `Popover` consumer applies `{{p.anchor}}`\n * and `{{p.trigger}}` as two separate modifiers on the same element (see\n * `popover-test.gts`); missing the anchor doesn't fail loudly by itself --\n * it just leaves `velcro.loop` (and so `p.Content`'s `@loop`) undefined,\n * which then asserts inside `Content`.\n *\n * Memoized on the `(anchor, trigger)` pair's identity (both stable for a\n * given `Popover` instance, since `Popover`/`Velcro` each assign their\n * fields once) so `t.trigger` keeps a stable identity across re-renders\n * instead of tearing down and reinstalling on every one.\n *\n * `@isDisabled` is read *inside* the installed function below, rather than\n * baked into this cache -- deliberately. `modifier()`'s function autotracks:\n * reading `this.args.isDisabled` there is what makes ember-modifier tear\n * down and reinstall the trigger's listeners when it changes, without\n * needing a new outer modifier identity (so the element itself is never\n * remounted). Passing `@isDisabled` through as an unreachable `openDelay`\n * (`Number.MAX_SAFE_INTEGER`) does not work instead: `@ember/test-helpers`'\n * `settled()` -- which every `await triggerEvent(...)` calls internally --\n * waits on `backburner.hasTimers()`, which is true for *any* pending\n * `later()` call no matter how far in the future, so a `mouseenter`\n * scheduling an effectively-infinite open left every subsequent `await`\n * hanging until the QUnit test timeout. Skipping the hover installation\n * entirely while disabled avoids ever scheduling that timer in the first\n * place.\n *\n * ANCHOR CHURN GUARD: the wrapper function below reads `this.isOpen`\n * *transitively* -- not directly, but through `trigger`'s own autotracking\n * of `aria-describedby` -- so `ember-modifier` tears the whole wrapper down\n * and reinstalls it on every open/close. Without a guard, that would call\n * `anchor(element)` again on every cycle, and `Velcro`'s `hook` reassigns\n * its own `@tracked hook` field each time it runs, which tears down and\n * restarts floating-ui's `autoUpdate` positioning loop for no reason -- a\n * normal `Popover` consumer never pays this cost, because there `anchor`\n * and `trigger` are two separate modifiers and `anchor`'s body reads\n * nothing tracked, so it installs once and never re-runs.\n *\n * The fix keys the anchor's lifecycle on the *element* in instance state\n * (`anchoredElement`/`anchorTeardown`), not on the wrapper modifier's own\n * re-run: `ensureAnchor` below only calls `anchor(element)` when the\n * element actually changes. The wrapper's own destructor -- called by\n * `ember-modifier` before *every* re-run, same-element re-runs included --\n * therefore does not tear the anchor down synchronously; it only tears\n * down `trigger` immediately (the half that legitimately needs to re-run on\n * every open/close -- that's what keeps `aria-describedby` in sync, which\n * controlled mode also depends on) and *defers* the anchor decision via\n * `scheduleAnchorTeardownCheck`.\n *\n * Why a deferred check, rather than just comparing `element` identity:\n * `ember-modifier` gives the destructor no way to tell \"about to re-run for\n * the same element\" apart from \"genuinely destroyed\" -- both call the same\n * returned closure. An identity comparison alone is correct for the\n * re-run case but has no destructor path left for the case where `element`\n * is removed entirely while\n * `Tooltip` itself keeps living (e.g. `{{#if this.show}}<button\n * {{t.trigger}}>{{/if}}`) -- nothing ever calls `ensureAnchor` again to\n * notice the change, and `willDestroy` only runs when `Tooltip` itself is\n * torn down. `scheduleAnchorTeardownCheck`/`confirmAnchorTeardown` resolve\n * the ambiguity by deferring one runloop turn (`@ember/runloop`'s `next`):\n * if the wrapper re-runs for the same element, `ensureAnchor` cancels the\n * pending check synchronously, before it fires; if `element` was genuinely\n * removed, nothing cancels it and the anchor is torn down for real one turn\n * later. The anchor is therefore torn down in exactly three places:\n * `ensureAnchor` (a different element arrived), `confirmAnchorTeardown`\n * (the deferred check fired unchallenged), and `willDestroy` (the component\n * itself is destroyed) -- never synchronously inside the wrapper's own\n * destructor.\n */\n cachedTrigger?: {\n anchor: CallableModifier;\n trigger: CallableModifier;\n modifier: ModifierLike<{ Element: HTMLElement }>;\n };\n\n /**\n * The element the anchor is currently installed on, and the teardown\n * `anchor(element)` handed back for it. Lives on the component instance\n * (not in the modifier's own closure) so it survives every open/close\n * re-run of the wrapper modifier -- see the churn-guard note above.\n */\n anchoredElement?: HTMLElement | SVGElement;\n anchorTeardown?: () => void;\n\n /**\n * A scheduled-but-not-yet-confirmed anchor teardown, set by the wrapper\n * modifier's destructor (see `makeTrigger`) and cancelled by `ensureAnchor`\n * if the wrapper turns out to have just re-run for the same element.\n *\n * WHY THIS EXISTS: `ember-modifier` calls the wrapper's destructor before\n * *every* re-run (same-element open/close churn included) as well as on\n * genuine removal, and does not tell us which. So the destructor alone\n * cannot decide whether to tear the anchor down. Deferring the decision by\n * one runloop turn resolves the ambiguity: if the wrapper is only\n * re-running, `ensureAnchor` runs synchronously afterwards (same tick,\n * before the deferred check fires) and cancels this; if the element was\n * genuinely removed, nothing calls `ensureAnchor` again, so the deferred\n * check fires and the anchor is torn down for real.\n *\n * Scheduled with `@ember/runloop`'s `next`/`cancel`, like the rest of this\n * codebase's timer usage (see `popover.gts`'s `hoverTimer`), rather than a\n * bespoke `setTimeout`.\n */\n pendingAnchorTeardown?: {\n element: HTMLElement | SVGElement;\n timer: EmberTimer;\n };\n\n /**\n * Installs `anchor` on `element` only if it is not already installed\n * there. Called on every wrapper re-run (every open/close), but is a no-op\n * on all but the first call and any call where the element genuinely\n * changed.\n *\n * Declared as a regular (prototype) method rather than an arrow-function\n * class field -- unlike `makeTrigger`, it is only ever called as\n * `this.ensureAnchor(...)`, never passed by reference, so it doesn't need\n * per-instance `this`-binding. Living on the prototype also makes it the\n * one seam the test suite can wrap to count real anchor installations\n * (see `tooltip-test.gts`'s anchor-churn-guard test).\n */\n ensureAnchor(anchor: CallableModifier, element: HTMLElement | SVGElement) {\n // The wrapper modifier re-ran for this same element -- any anchor\n // teardown its destructor speculatively scheduled (see\n // `scheduleAnchorTeardownCheck`) is stale: the element didn't actually go\n // away, so cancel the pending check before it can fire.\n if (\n this.pendingAnchorTeardown &&\n this.pendingAnchorTeardown.element === element\n ) {\n cancel(this.pendingAnchorTeardown.timer);\n this.pendingAnchorTeardown = undefined;\n }\n\n if (this.anchoredElement === element) {\n return;\n }\n\n // A different element arrived (or this is the first install for this\n // wrapper): tear down whatever anchor is currently installed before\n // installing the new one, so we never leak a stale `autoUpdate` loop.\n this.anchorTeardown?.();\n\n assert(\n \"Expected `p.anchor` to be a callable function (ember-velcro's `hook`, built the same way `ember-modifier`'s `modifier()` builds a callable function-based modifier). If this fires, an `ember-modifier` or `ember-velcro` upgrade likely changed how modifier values are constructed -- see the `PopoverAnchorFn`/`PopoverTriggerFn` comments above.\",\n typeof anchor === 'function'\n );\n\n const teardown = (anchor as unknown as PopoverAnchorFn)(element);\n\n this.anchoredElement = element;\n this.anchorTeardown = teardown ?? undefined;\n }\n\n /**\n * Called from the wrapper modifier's destructor -- i.e. on *every*\n * re-run of the wrapper, not only on genuine removal of `element`. Defers\n * the decision by one runloop turn: schedules `confirmAnchorTeardown` via\n * `next()`, which only actually tears the anchor down if nothing cancels\n * it first. `ensureAnchor` (above) is what cancels it, synchronously,\n * within the same runloop turn, if the wrapper turns out to have simply\n * re-run for the same element.\n */\n scheduleAnchorTeardownCheck(element: HTMLElement | SVGElement) {\n // Superseding an earlier pending check for a different element should\n // not normally happen (a new one would already have been resolved by an\n // intervening `ensureAnchor` call), but cancel defensively rather than\n // leak the earlier timer.\n if (this.pendingAnchorTeardown) {\n cancel(this.pendingAnchorTeardown.timer);\n }\n\n const timer = next(() => this.confirmAnchorTeardown(element));\n this.pendingAnchorTeardown = { element, timer };\n }\n\n /**\n * Runs one runloop turn after the wrapper modifier's destructor scheduled\n * it. If it gets here at all (i.e. `ensureAnchor` did not cancel it in the\n * meantime), the wrapper never re-ran for `element` -- the element was\n * genuinely removed -- so the anchor installed on it is torn down for\n * real.\n */\n confirmAnchorTeardown(element: HTMLElement | SVGElement) {\n if (\n !this.pendingAnchorTeardown ||\n this.pendingAnchorTeardown.element !== element\n ) {\n // Already superseded/cancelled (or, in principle, stale) -- nothing to\n // do.\n return;\n }\n\n this.pendingAnchorTeardown = undefined;\n\n if (this.anchoredElement === element) {\n this.anchorTeardown?.();\n this.anchoredElement = undefined;\n this.anchorTeardown = undefined;\n }\n }\n\n willDestroy() {\n super.willDestroy();\n if (this.pendingAnchorTeardown) {\n cancel(this.pendingAnchorTeardown.timer);\n this.pendingAnchorTeardown = undefined;\n }\n this.anchorTeardown?.();\n this.anchoredElement = undefined;\n this.anchorTeardown = undefined;\n }\n\n makeTrigger = (\n anchor: CallableModifier,\n trigger: CallableModifier\n ): ModifierLike<{ Element: HTMLElement }> => {\n if (\n !this.cachedTrigger ||\n this.cachedTrigger.anchor !== anchor ||\n this.cachedTrigger.trigger !== trigger\n ) {\n this.cachedTrigger = {\n anchor,\n trigger,\n modifier: modifier((element: HTMLElement) => {\n this.ensureAnchor(anchor, element);\n\n if (this.args.isDisabled) {\n return undefined;\n }\n\n assert(\n \"Expected `p.trigger` to be a callable function (a modifier built by `ember-modifier`'s `modifier()`). If this fires, an `ember-modifier` upgrade likely changed how function-based modifiers are constructed -- see the `PopoverTriggerFn` comment above.\",\n typeof trigger === 'function'\n );\n\n const teardownTrigger = (trigger as unknown as PopoverTriggerFn)(\n element,\n ['hover'],\n { aria: 'describedby' }\n );\n\n // `ember-modifier` calls this destructor before *every* re-run --\n // including a same-element re-run driven by `this.isOpen` churn --\n // and on genuine removal of `element`, with no way to tell which\n // from here. The trigger half always tears down and reinstalls\n // (that's what keeps `aria-describedby` in sync). The anchor half\n // cannot follow the same rule -- unconditionally tearing it down\n // here would reintroduce the churn this guard exists to prevent --\n // so it's handled by deferred confirmation: `scheduleAnchorTeardownCheck`\n // only *actually* tears the anchor down one runloop turn later, and\n // only if `ensureAnchor` doesn't cancel it first because the\n // wrapper turned out to just be re-running for the same element.\n // See the doc comments on `pendingAnchorTeardown` /\n // `scheduleAnchorTeardownCheck` / `confirmAnchorTeardown` above.\n return () => {\n teardownTrigger?.();\n this.scheduleAnchorTeardownCheck(element);\n };\n }) as unknown as ModifierLike<{ Element: HTMLElement }>\n };\n }\n\n return this.cachedTrigger.modifier;\n };\n\n <template>\n <Popover\n @placement={{this.placement}}\n @offsetOptions={{this.offsetOptions}}\n @flipOptions={{@flipOptions}}\n @shiftOptions={{@shiftOptions}}\n @middleware={{@middleware}}\n @strategy={{@strategy}}\n @openDelay={{this.openDelay}}\n @closeDelay={{this.closeDelay}}\n @isOpen={{@isOpen}}\n @onOpenChange={{@onOpenChange}}\n @didClose={{@didClose}}\n as |p|\n >\n {{yield\n (hash\n trigger=(this.makeTrigger p.anchor p.trigger)\n isOpen=p.isOpen\n open=p.open\n close=p.close\n Content=(component\n TooltipContent\n PopoverContent=p.Content\n classNames=this.classNames\n arrow=@arrow\n disableInteractive=@disableInteractive\n hasContentArg=(if @content true false)\n )\n )\n }}\n\n {{#if @content}}\n <TooltipContent\n @PopoverContent={{p.Content}}\n @classNames={{this.classNames}}\n @arrow={{@arrow}}\n @disableInteractive={{@disableInteractive}}\n ...attributes\n >\n {{@content}}\n </TooltipContent>\n {{/if}}\n </Popover>\n </template>\n}\n\ninterface TooltipContentSignature {\n Args: {\n /**\n * @internal\n */\n PopoverContent: BoundPopoverContent;\n\n /**\n * @internal\n */\n classNames: { base: string; arrow: string };\n\n /**\n * @internal\n */\n arrow?: boolean;\n\n /**\n * @internal\n */\n disableInteractive?: boolean;\n\n /**\n * @internal\n * Set only on the bound `Content` yielded to the consumer. Lets this\n * component assert when it renders while `@content` is also in use --\n * a `Tooltip` cannot otherwise tell whether the consumer invoked the\n * yielded `Content` block.\n */\n hasContentArg?: boolean;\n };\n Element: HTMLDivElement;\n Blocks: { default: [] };\n}\n\n/**\n * The tooltip's content. Configures `Popover.Content` for a tooltip: no focus\n * trap, no autofocus, no scroll lock, `role=\"tooltip\"`, and `tabindex=\"-1\"` so\n * it is never a tab stop -- `Overlay` sets `tabindex=\"0\"` but spreads\n * `...attributes` after it, so this wins.\n *\n * Its constructor also asserts that `@content` and a `<t.Content>` block are\n * never used together: `hasContentArg` is set only on the bound `Content`\n * yielded to the consumer (see `TooltipContentSignature['Args']`), so this\n * component renders with it `true` exactly when the consumer both passed\n * `@content` to `Tooltip` *and* invoked the yielded `Content` block. The\n * check has to live here, on the content side, rather than on `Tooltip`\n * itself, because a Glimmer component has no way to observe whether a\n * consumer invoked one of its yielded blocks -- `Tooltip` cannot tell\n * `<t.Content>` was used at all until this component actually renders.\n */\nclass TooltipContent extends Component<TooltipContentSignature> {\n constructor(owner: Owner, args: TooltipContentSignature['Args']) {\n super(owner, args);\n\n assert(\n '<Tooltip> received both @content and a <t.Content> block. Use one or the other.',\n !this.args.hasContentArg\n );\n }\n\n /**\n * `data-component`/`data-part` below are written before ...attributes, so\n * they flow through Popover.Content's own ...attributes forwarding onto\n * Overlay's rendered div and override its default data-component=\"overlay\"\n * -- the standard splattributes-override pattern Overlay's own template is\n * written to support (its literal data-component=\"overlay\" is likewise\n * placed before its own ...attributes). Tooltip has no element of its own:\n * its \"base\"/\"arrow\" slots render on the exact same portaled div\n * Overlay/Popover.Content own, so this is the only way to mark it\n * data-component=\"tooltip\" without touching overlay.gts/popover.gts.\n */\n <template>\n <@PopoverContent\n @class={{@classNames.base}}\n @arrowClass={{@classNames.arrow}}\n @arrow={{@arrow}}\n @disableInteractive={{@disableInteractive}}\n @transition={{hash name=\"overlay-transition--tooltip\"}}\n @blockScroll={{false}}\n @backdrop=\"none\"\n role=\"tooltip\"\n tabindex=\"-1\"\n data-component=\"tooltip\"\n data-part=\"base\"\n ...attributes\n >\n {{yield}}\n </@PopoverContent>\n </template>\n}\n\nexport { Tooltip, type TooltipSignature };\nexport default Tooltip;\n"],"names":["Tooltip","Component","classNames","tooltip","useStyles","base","arrow","size","args","color","class","classes","placement","offsetOptions","openDelay","closeDelay","cachedTrigger","anchoredElement","anchorTeardown","pendingAnchorTeardown","ensureAnchor","anchor","element","cancel","timer","undefined","assert","teardown","scheduleAnchorTeardownCheck","next","confirmAnchorTeardown","willDestroy","makeTrigger","trigger","modifier","isDisabled","teardownTrigger","aria","setComponentTemplate","precompileTemplate","strictMode","scope","Popover","hash","TooltipContent","constructor","owner","hasContentArg"],"mappings":";;;;;;;;;;AA0BA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BC;AAOD;;;;;;;;;AASC;AAKD;;;;;;;AAOC;AAkLD,MAAMA,gBAAgBC,SAAA,CAAU;EAC9B,IAAIC,UAAAA,GAAa;IACf,MAAM;AAAEC,MAAAA;KAAS,GAAGC,SAAA,EAAA;IAEpB,MAAM;MAAEC,IAAI;AAAEC,MAAAA;KAAO,GAAGH,OAAA,CAAQ;AAC9BI,MAAAA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