frontile 0.18.11 → 0.18.13

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 (79) hide show
  1. package/declarations/components/buttons/button-group.d.ts +1 -1
  2. package/declarations/components/buttons/button-group.d.ts.map +1 -1
  3. package/declarations/components/buttons/button.d.ts +4 -2
  4. package/declarations/components/buttons/button.d.ts.map +1 -1
  5. package/declarations/components/buttons/chip.d.ts +4 -3
  6. package/declarations/components/buttons/chip.d.ts.map +1 -1
  7. package/declarations/components/buttons/icon-button.d.ts +50 -0
  8. package/declarations/components/buttons/icon-button.d.ts.map +1 -0
  9. package/declarations/components/buttons/index.d.ts +1 -0
  10. package/declarations/components/buttons/index.d.ts.map +1 -1
  11. package/declarations/components/buttons/toggle-button.d.ts +1 -1
  12. package/declarations/components/buttons/toggle-button.d.ts.map +1 -1
  13. package/declarations/components/forms/select/types.d.ts +1 -1
  14. package/declarations/components/layout/app-layout.d.ts +53 -5
  15. package/declarations/components/layout/app-layout.d.ts.map +1 -1
  16. package/declarations/components/layout/aside.d.ts +79 -0
  17. package/declarations/components/layout/aside.d.ts.map +1 -1
  18. package/declarations/components/layout/context.d.ts +12 -4
  19. package/declarations/components/layout/context.d.ts.map +1 -1
  20. package/declarations/components/layout/in-layout-region.d.ts +38 -0
  21. package/declarations/components/layout/in-layout-region.d.ts.map +1 -0
  22. package/declarations/components/layout/index.d.ts +2 -0
  23. package/declarations/components/layout/index.d.ts.map +1 -1
  24. package/declarations/components/layout/navbar.d.ts +43 -0
  25. package/declarations/components/layout/navbar.d.ts.map +1 -1
  26. package/declarations/components/layout/region.d.ts +60 -0
  27. package/declarations/components/layout/region.d.ts.map +1 -0
  28. package/declarations/components/layout/sidebar.d.ts +43 -0
  29. package/declarations/components/layout/sidebar.d.ts.map +1 -1
  30. package/declarations/components/overlays/tooltip.d.ts +1 -1
  31. package/declarations/components/status/badge.d.ts +8 -7
  32. package/declarations/components/status/badge.d.ts.map +1 -1
  33. package/declarations/components/utilities/card.d.ts +94 -0
  34. package/declarations/components/utilities/card.d.ts.map +1 -0
  35. package/declarations/components/utilities/icon.d.ts +57 -0
  36. package/declarations/components/utilities/icon.d.ts.map +1 -0
  37. package/declarations/components/utilities/index.d.ts +2 -0
  38. package/declarations/components/utilities/index.d.ts.map +1 -1
  39. package/declarations/services/frontile-layout-regions.d.ts +69 -0
  40. package/declarations/services/frontile-layout-regions.d.ts.map +1 -0
  41. package/dist/_app_/services/frontile-layout-regions.js +1 -0
  42. package/dist/buttons.js +1 -0
  43. package/dist/buttons.js.map +1 -1
  44. package/dist/components/buttons/button.js.map +1 -1
  45. package/dist/components/buttons/chip.js.map +1 -1
  46. package/dist/components/buttons/icon-button.js +33 -0
  47. package/dist/components/buttons/icon-button.js.map +1 -0
  48. package/dist/components/buttons/index.js +1 -0
  49. package/dist/components/buttons/index.js.map +1 -1
  50. package/dist/components/forms/select/select.js +1 -1
  51. package/dist/components/forms/select/select.js.map +1 -1
  52. package/dist/components/layout/app-layout.js +11 -3
  53. package/dist/components/layout/app-layout.js.map +1 -1
  54. package/dist/components/layout/aside.js +56 -2
  55. package/dist/components/layout/aside.js.map +1 -1
  56. package/dist/components/layout/context.js.map +1 -1
  57. package/dist/components/layout/in-layout-region.js +42 -0
  58. package/dist/components/layout/in-layout-region.js.map +1 -0
  59. package/dist/components/layout/index.js +2 -0
  60. package/dist/components/layout/index.js.map +1 -1
  61. package/dist/components/layout/region.js +51 -0
  62. package/dist/components/layout/region.js.map +1 -0
  63. package/dist/components/overlays/tooltip.js.map +1 -1
  64. package/dist/components/status/badge.js.map +1 -1
  65. package/dist/components/utilities/card.js +38 -0
  66. package/dist/components/utilities/card.js.map +1 -0
  67. package/dist/components/utilities/icon.js +33 -0
  68. package/dist/components/utilities/icon.js.map +1 -0
  69. package/dist/components/utilities/index.js +2 -0
  70. package/dist/components/utilities/index.js.map +1 -1
  71. package/dist/index.js +5 -0
  72. package/dist/index.js.map +1 -1
  73. package/dist/layout.js +2 -0
  74. package/dist/layout.js.map +1 -1
  75. package/dist/services/frontile-layout-regions.js +149 -0
  76. package/dist/services/frontile-layout-regions.js.map +1 -0
  77. package/dist/utilities.js +2 -0
  78. package/dist/utilities.js.map +1 -1
  79. package/package.json +4 -3
@@ -1,14 +1,16 @@
1
1
  import Component from '@glimmer/component';
2
2
  import { cached } from '@glimmer/tracking';
3
3
  import { guidFor } from '@ember/object/internals';
4
+ import { service } from '@ember/service';
4
5
  import { registerDestructor } from '@ember/destroyable';
6
+ import { modifier } from 'ember-modifier';
5
7
  import { useStyles } from '@frontile/theme';
6
8
  import Drawer from '../overlays/drawer.js';
7
9
  import { AppLayoutState } from './app-layout-state.js';
8
10
  import { layoutVariants } from './context.js';
9
11
  import { precompileTemplate } from '@ember/template-compilation';
10
12
  import { setComponentTemplate } from '@ember/component';
11
- import { a as decorateMethodV2 } from '../../runtime--fcdnjmJ-DOFHQ2m8.js';
13
+ import { d as decorateFieldV2, i as initializeDeferredDecorator, a as decorateMethodV2 } from '../../runtime--fcdnjmJ-DOFHQ2m8.js';
12
14
 
13
15
  /**
14
16
  * A panel beside `Main`, shown while `asideOpen` is true. From `lg` (64rem)
@@ -19,14 +21,44 @@ import { a as decorateMethodV2 } from '../../runtime--fcdnjmJ-DOFHQ2m8.js';
19
21
  * is always inline.
20
22
  */
21
23
  class Aside extends Component {
24
+ static {
25
+ decorateFieldV2(this.prototype, "regions", [service('frontile-layout-regions')]);
26
+ }
27
+ #regions = (initializeDeferredDecorator(this, "regions"), void 0);
22
28
  fallbackState = new AppLayoutState();
29
+ /** `@region`, read once. */
30
+ region;
23
31
  constructor(owner, args) {
24
32
  super(owner, args);
25
33
  const unregister = args.layout?.registerAside(this);
26
34
  if (unregister) {
27
35
  registerDestructor(this, unregister);
28
36
  }
37
+ this.region = args.region;
38
+ if (args.region !== undefined) {
39
+ // A drawer with nothing in it closes, so that content coming back
40
+ // never opens a modal by itself. The inline column is only hidden
41
+ // while empty and keeps its open state.
42
+ registerDestructor(this, this.regions.onEmpty(args.region, () => {
43
+ if (this.inDrawer) {
44
+ this.state.closeAside();
45
+ }
46
+ }));
47
+ }
29
48
  }
49
+ /**
50
+ * Always true for a block aside; one with `@region` needs a source. Also
51
+ * read by the layout's `hasAside` (`RegisteredAside`).
52
+ */
53
+ get available() {
54
+ const region = this.region;
55
+ return region === undefined || this.regions.hasContent(region);
56
+ }
57
+ /** Makes the `aside` element the region's target. Nothing without `@region`. */
58
+ registerTarget = modifier(element => {
59
+ const region = this.region;
60
+ return region === undefined ? undefined : this.regions.registerTarget(region, element);
61
+ });
30
62
  get state() {
31
63
  return this.args.layout?.state ?? this.args.state ?? this.fallbackState;
32
64
  }
@@ -57,6 +89,28 @@ class Aside extends Component {
57
89
  closeDrawer = () => {
58
90
  this.state.closeAside();
59
91
  };
92
+ /**
93
+ * Open only while there is something to show. The drawer stays mounted
94
+ * while empty, so emptying it plays the close transition instead of
95
+ * removing it at once.
96
+ */
97
+ get isOpen() {
98
+ return this.state.asideOpen && this.available;
99
+ }
100
+ /**
101
+ * A drawer closed because it emptied has no toggle to return focus to
102
+ * (`AsideToggle` is hidden too), so focus goes to `Main` instead of the
103
+ * page body.
104
+ */
105
+ didCloseDrawer = () => {
106
+ const active = document.activeElement;
107
+ if (this.available || active && active !== document.body) {
108
+ return;
109
+ }
110
+ const mainId = this.args.layout?.mainId;
111
+ const main = mainId ? document.getElementById(mainId) : null;
112
+ main?.focus();
113
+ };
60
114
  get styles() {
61
115
  const layout = this.args.layout;
62
116
  return useStyles().appLayout({
@@ -85,7 +139,7 @@ class Aside extends Component {
85
139
  decorateMethodV2(this.prototype, "mobileClassNames", [cached]);
86
140
  }
87
141
  static {
88
- setComponentTemplate(precompileTemplate("{{#if this.inDrawer}}\n <Drawer @isOpen={{this.state.asideOpen}} @onClose={{this.closeDrawer}} @placement={{this.placement}} @size=\"xs\" @variant=\"flat\" id={{@layout.asideDrawerId}} aria-label={{this.label}}>\n <aside id={{this.id}} aria-label={{this.label}} data-part=\"mobile-aside\" class={{this.mobileClassNames}} ...attributes>\n {{yield}}\n </aside>\n </Drawer>\n{{else if this.state.asideOpen}}\n <aside id={{this.id}} aria-label={{this.label}} data-part=\"aside\" class={{this.classNames}} ...attributes>\n {{yield}}\n </aside>\n{{/if}}", {
142
+ setComponentTemplate(precompileTemplate("{{#if this.inDrawer}}\n <Drawer @isOpen={{this.isOpen}} @onClose={{this.closeDrawer}} @didClose={{this.didCloseDrawer}} @placement={{this.placement}} @size=\"xs\" @variant=\"flat\" id={{@layout.asideDrawerId}} aria-label={{this.label}}>\n <aside id={{this.id}} aria-label={{this.label}} data-part=\"mobile-aside\" class={{this.mobileClassNames}} {{this.registerTarget}} ...attributes>\n {{#unless this.region}}{{yield}}{{/unless}}\n </aside>\n </Drawer>\n{{else if this.isOpen}}\n <aside id={{this.id}} aria-label={{this.label}} data-part=\"aside\" class={{this.classNames}} {{this.registerTarget}} ...attributes>\n {{#unless this.region}}{{yield}}{{/unless}}\n </aside>\n{{/if}}", {
89
143
  strictMode: true,
90
144
  scope: () => ({
91
145
  Drawer
@@ -1 +1 @@
1
- {"version":3,"file":"aside.js","sources":["../../../src/components/layout/aside.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { cached } from '@glimmer/tracking';\nimport { guidFor } from '@ember/object/internals';\nimport { registerDestructor } from '@ember/destroyable';\nimport { useStyles } from '@frontile/theme';\nimport Drawer from '../overlays/drawer';\nimport { AppLayoutState } from './app-layout-state';\nimport { layoutVariants, type AppLayoutContext } from './context';\nimport type { AppLayoutVariants } from '@frontile/theme';\nimport type Owner from '@ember/owner';\n\ninterface AsideArgs {\n /**\n * The accessible name of the `aside` landmark, also the name of the drawer\n * below `lg`.\n *\n * @defaultValue 'Details'\n */\n label?: string;\n\n /**\n * The layout variant, `inset` or `attached`. Only used when the aside is\n * rendered outside an `AppLayout`; inside one it follows the layout.\n *\n * @defaultValue 'attached'\n */\n variant?: AppLayoutVariants['variant'];\n\n /**\n * The state that drives it. Only used when the aside is rendered outside\n * an `AppLayout`; inside one it follows the layout's state.\n */\n state?: AppLayoutState;\n\n /**\n * Supplied by `AppLayout`. Not part of the public API.\n *\n * @internal\n */\n layout?: AppLayoutContext;\n}\n\ninterface AsideSignature {\n Args: AsideArgs;\n Blocks: { default: [] };\n Element: HTMLElement;\n}\n\n/**\n * A panel beside `Main`, shown while `asideOpen` is true. From `lg` (64rem)\n * up it is an in-flow column that narrows `Main`; below `lg` the same block\n * renders in a `Drawer` from the same side, whatever the layout's\n * `@breakpoint` is.\n * Open it with `AsideToggle`. Outside an `AppLayout` it needs `@state` and\n * is always inline.\n */\nclass Aside extends Component<AsideSignature> {\n fallbackState = new AppLayoutState();\n\n constructor(owner: Owner, args: AsideArgs) {\n super(owner, args);\n const unregister = args.layout?.registerAside(this);\n if (unregister) {\n registerDestructor(this, unregister);\n }\n }\n\n get state(): AppLayoutState {\n return this.args.layout?.state ?? this.args.state ?? this.fallbackState;\n }\n\n /**\n * Below `lg` the content moves into the drawer. Only one of the two is\n * rendered, so the block (and any ids in it) exists once.\n */\n get inDrawer(): boolean {\n return this.args.layout?.belowAsideBreakpoint ?? false;\n }\n\n get label(): string {\n return this.args.label ?? 'Details';\n }\n\n get id(): string {\n return this.args.layout?.asideId ?? `${guidFor(this)}-aside`;\n }\n\n /**\n * The aside sits opposite the sidebar: at the end, or at the start with\n * `sidebarSide=\"end\"`. `Drawer` placements are physical, so that side is\n * resolved against the layout's direction.\n */\n get placement(): 'left' | 'right' {\n const layout = this.args.layout;\n const atStart = layout?.config.sidebarSide === 'end';\n const rtl = layout?.isRtl() ?? false;\n return atStart !== rtl ? 'left' : 'right';\n }\n\n closeDrawer = (): void => {\n this.state.closeAside();\n };\n\n @cached\n get styles() {\n const layout = this.args.layout;\n return useStyles().appLayout({\n ...layoutVariants(layout?.config),\n variant: layout?.config.variant ?? this.args.variant ?? 'attached',\n standalone: !layout\n });\n }\n\n @cached\n get classNames(): string {\n return this.styles.aside({ class: this.args.layout?.classes?.aside });\n }\n\n @cached\n get mobileClassNames(): string {\n return this.styles.mobileAside({\n class: this.args.layout?.classes?.mobileAside\n });\n }\n\n <template>\n {{#if this.inDrawer}}\n <Drawer\n @isOpen={{this.state.asideOpen}}\n @onClose={{this.closeDrawer}}\n @placement={{this.placement}}\n @size=\"xs\"\n @variant=\"flat\"\n id={{@layout.asideDrawerId}}\n aria-label={{this.label}}\n >\n <aside\n id={{this.id}}\n aria-label={{this.label}}\n data-part=\"mobile-aside\"\n class={{this.mobileClassNames}}\n ...attributes\n >\n {{yield}}\n </aside>\n </Drawer>\n {{else if this.state.asideOpen}}\n <aside\n id={{this.id}}\n aria-label={{this.label}}\n data-part=\"aside\"\n class={{this.classNames}}\n ...attributes\n >\n {{yield}}\n </aside>\n {{/if}}\n </template>\n}\n\nexport { Aside, type AsideSignature, type AsideArgs };\nexport default Aside;\n"],"names":["Aside","Component","fallbackState","AppLayoutState","constructor","owner","args","unregister","layout","registerAside","registerDestructor","state","inDrawer","belowAsideBreakpoint","label","id","asideId","guidFor","placement","atStart","config","sidebarSide","rtl","isRtl","closeDrawer","closeAside","styles","useStyles","appLayout","layoutVariants","variant","standalone","n","prototype","cached","classNames","aside","class","classes","mobileClassNames","mobileAside","setComponentTemplate","precompileTemplate","strictMode","scope","Drawer"],"mappings":";;;;;;;;;;;;AAgDA;;;;;;;;AAQA,MAAMA,cAAcC,SAAA,CAAU;AAC5BC,EAAAA,aAAA,GAAgB,IAAIC,cAAA,EAAA;AAEpBC,EAAAA,WAAAA,CAAYC,KAAY,EAAEC,IAAe,EAAE;AACzC,IAAA,KAAK,CAACD,KAAA,EAAOC,IAAA,CAAA;IACb,MAAMC,UAAA,GAAaD,IAAA,CAAKE,MAAM,EAAEC,cAAc,IAAI,CAAA;AAClD,IAAA,IAAIF,UAAA,EAAY;AACdG,MAAAA,kBAAA,CAAmB,IAAI,EAAEH,UAAA,CAAA;AAC3B,IAAA;AACF,EAAA;EAEA,IAAII,QAAwB;AAC1B,IAAA,OAA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AA,CAAA;AACF,EAAA;AAAA,EAAA;IAAAwB,gBAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,QAAA,EAAA,CARCC,MAAA,CAAA,CAAA;AAAA;EAUD,IACIC,UAAAA,GAAqB;AACvB,IAAA,OAAO,IAAI,CAACT,MAAM,CAACU,KAAK,CAAC;MAAEC,KAAA,EAAO,IAAI,CAAC/B,IAAI,CAACE,MAAM,EAAE8B,OAAA,EAASF;AAAM,KAAA,CAAA;AACrE,EAAA;AAAA,EAAA;IAAAJ,gBAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,YAAA,EAAA,CAHCC,MAAA,CAAA,CAAA;AAAA;EAKD,IACIK,gBAAAA,GAA2B;AAC7B,IAAA,OAAO,IAAI,CAACb,MAAM,CAACc,WAAW,CAAC;MAC7BH,KAAA,EAAO,IAAI,CAAC/B,IAAI,CAACE,MAAM,EAAE8B,OAAA,EAASE;AACpC,KAAA,CAAA;AACF,EAAA;AAAA,EAAA;IAAAR,gBAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,kBAAA,EAAA,CALCC,MAAA,CAAA,CAAA;AAAA;AAOD,EAAA;IAAAO,oBAAA,CAAAC,kBAAA,CAAA,ujBAAA,EAgCA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;"}
1
+ {"version":3,"file":"aside.js","sources":["../../../src/components/layout/aside.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { cached } from '@glimmer/tracking';\nimport { guidFor } from '@ember/object/internals';\nimport { service } from '@ember/service';\nimport { registerDestructor } from '@ember/destroyable';\nimport { modifier } from 'ember-modifier';\nimport { useStyles } from '@frontile/theme';\nimport Drawer from '../overlays/drawer';\nimport { AppLayoutState } from './app-layout-state';\nimport { layoutVariants, type AppLayoutContext } from './context';\nimport type { AppLayoutVariants } from '@frontile/theme';\nimport type FrontileLayoutRegionsService from '../../services/frontile-layout-regions';\nimport type Owner from '@ember/owner';\n\ninterface AsideArgs {\n /**\n * The accessible name of the `aside` landmark, also the name of the drawer\n * below `lg`.\n *\n * @defaultValue 'Details'\n */\n label?: string;\n\n /**\n * The layout variant, `inset` or `attached`. Only used when the aside is\n * rendered outside an `AppLayout`; inside one it follows the layout.\n *\n * @defaultValue 'attached'\n */\n variant?: AppLayoutVariants['variant'];\n\n /**\n * The state that drives it. Only used when the aside is rendered outside\n * an `AppLayout`; inside one it follows the layout's state.\n */\n state?: AppLayoutState;\n\n /**\n * Fill the aside from `<InLayoutRegion @name=\"…\">` with this name, from\n * any template including a route template, instead of from its own block.\n * While nothing fills it, the aside and `AsideToggle` render nothing.\n * Region names are global to the app. Read once.\n */\n region?: string;\n\n /**\n * Supplied by `AppLayout`. Not part of the public API.\n *\n * @internal\n */\n layout?: AppLayoutContext;\n}\n\ninterface AsideSignature {\n Args: AsideArgs;\n Blocks: { default: [] };\n Element: HTMLElement;\n}\n\n/**\n * A panel beside `Main`, shown while `asideOpen` is true. From `lg` (64rem)\n * up it is an in-flow column that narrows `Main`; below `lg` the same block\n * renders in a `Drawer` from the same side, whatever the layout's\n * `@breakpoint` is.\n * Open it with `AsideToggle`. Outside an `AppLayout` it needs `@state` and\n * is always inline.\n */\nclass Aside extends Component<AsideSignature> {\n @service('frontile-layout-regions')\n declare regions: FrontileLayoutRegionsService;\n\n fallbackState = new AppLayoutState();\n /** `@region`, read once. */\n region: string | undefined;\n\n constructor(owner: Owner, args: AsideArgs) {\n super(owner, args);\n const unregister = args.layout?.registerAside(this);\n if (unregister) {\n registerDestructor(this, unregister);\n }\n this.region = args.region;\n if (args.region !== undefined) {\n // A drawer with nothing in it closes, so that content coming back\n // never opens a modal by itself. The inline column is only hidden\n // while empty and keeps its open state.\n registerDestructor(\n this,\n this.regions.onEmpty(args.region, () => {\n if (this.inDrawer) {\n this.state.closeAside();\n }\n })\n );\n }\n }\n\n /**\n * Always true for a block aside; one with `@region` needs a source. Also\n * read by the layout's `hasAside` (`RegisteredAside`).\n */\n get available(): boolean {\n const region = this.region;\n return region === undefined || this.regions.hasContent(region);\n }\n\n /** Makes the `aside` element the region's target. Nothing without `@region`. */\n registerTarget = modifier((element: HTMLElement) => {\n const region = this.region;\n return region === undefined\n ? undefined\n : this.regions.registerTarget(region, element);\n });\n\n get state(): AppLayoutState {\n return this.args.layout?.state ?? this.args.state ?? this.fallbackState;\n }\n\n /**\n * Below `lg` the content moves into the drawer. Only one of the two is\n * rendered, so the block (and any ids in it) exists once.\n */\n get inDrawer(): boolean {\n return this.args.layout?.belowAsideBreakpoint ?? false;\n }\n\n get label(): string {\n return this.args.label ?? 'Details';\n }\n\n get id(): string {\n return this.args.layout?.asideId ?? `${guidFor(this)}-aside`;\n }\n\n /**\n * The aside sits opposite the sidebar: at the end, or at the start with\n * `sidebarSide=\"end\"`. `Drawer` placements are physical, so that side is\n * resolved against the layout's direction.\n */\n get placement(): 'left' | 'right' {\n const layout = this.args.layout;\n const atStart = layout?.config.sidebarSide === 'end';\n const rtl = layout?.isRtl() ?? false;\n return atStart !== rtl ? 'left' : 'right';\n }\n\n closeDrawer = (): void => {\n this.state.closeAside();\n };\n\n /**\n * Open only while there is something to show. The drawer stays mounted\n * while empty, so emptying it plays the close transition instead of\n * removing it at once.\n */\n get isOpen(): boolean {\n return this.state.asideOpen && this.available;\n }\n\n /**\n * A drawer closed because it emptied has no toggle to return focus to\n * (`AsideToggle` is hidden too), so focus goes to `Main` instead of the\n * page body.\n */\n didCloseDrawer = (): void => {\n const active = document.activeElement;\n if (this.available || (active && active !== document.body)) {\n return;\n }\n const mainId = this.args.layout?.mainId;\n const main = mainId ? document.getElementById(mainId) : null;\n main?.focus();\n };\n\n @cached\n get styles() {\n const layout = this.args.layout;\n return useStyles().appLayout({\n ...layoutVariants(layout?.config),\n variant: layout?.config.variant ?? this.args.variant ?? 'attached',\n standalone: !layout\n });\n }\n\n @cached\n get classNames(): string {\n return this.styles.aside({ class: this.args.layout?.classes?.aside });\n }\n\n @cached\n get mobileClassNames(): string {\n return this.styles.mobileAside({\n class: this.args.layout?.classes?.mobileAside\n });\n }\n\n <template>\n {{#if this.inDrawer}}\n <Drawer\n @isOpen={{this.isOpen}}\n @onClose={{this.closeDrawer}}\n @didClose={{this.didCloseDrawer}}\n @placement={{this.placement}}\n @size=\"xs\"\n @variant=\"flat\"\n id={{@layout.asideDrawerId}}\n aria-label={{this.label}}\n >\n <aside\n id={{this.id}}\n aria-label={{this.label}}\n data-part=\"mobile-aside\"\n class={{this.mobileClassNames}}\n {{this.registerTarget}}\n ...attributes\n >\n {{#unless this.region}}{{yield}}{{/unless}}\n </aside>\n </Drawer>\n {{else if this.isOpen}}\n <aside\n id={{this.id}}\n aria-label={{this.label}}\n data-part=\"aside\"\n class={{this.classNames}}\n {{this.registerTarget}}\n ...attributes\n >\n {{#unless this.region}}{{yield}}{{/unless}}\n </aside>\n {{/if}}\n </template>\n}\n\nexport { Aside, type AsideSignature, type AsideArgs };\nexport default Aside;\n"],"names":["Aside","Component","g","prototype","service","i","fallbackState","AppLayoutState","region","constructor","owner","args","unregister","layout","registerAside","registerDestructor","undefined","regions","onEmpty","inDrawer","state","closeAside","available","hasContent","registerTarget","modifier","element","belowAsideBreakpoint","label","id","asideId","guidFor","placement","atStart","config","sidebarSide","rtl","isRtl","closeDrawer","isOpen","asideOpen","didCloseDrawer","active","document","activeElement","body","mainId","main","getElementById","focus","styles","useStyles","appLayout","layoutVariants","variant","standalone","n","cached","classNames","aside","class","classes","mobileClassNames","mobileAside","setComponentTemplate","precompileTemplate","strictMode","scope","Drawer"],"mappings":";;;;;;;;;;;;;;AA2DA;;;;;;;;AAQA,MAAMA,cAAcC,SAAA,CAAU;AAAA,EAAA;AAAAC,IAAAA,eAAA,MAAAC,SAAA,EAAA,SAAA,EAAA,CAC3BC,OAAA,CAAQ,yBAAA,CAAA,CAAA,CAAA;AAAA;EAAA,QAAA,IAAAC,2BAAA,CAAA,IAAA,EAA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O,oBAAA,CAAAC,kBAAA,CAAA,2rBAAA,EAmCA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"context.js","sources":["../../../src/components/layout/context.ts"],"sourcesContent":["import { useStyles, type SlotsToClasses } from '@frontile/theme';\nimport type { AppLayoutSlots, AppLayoutVariants } from '@frontile/theme';\nimport type { AppLayoutState } from './app-layout-state';\n\nexport type AppLayoutStyles = ReturnType<\n ReturnType<typeof useStyles>['appLayout']\n>;\n\n/**\n * What `AppLayout` hands each part it yields. Internal: parts receive it as\n * a bound `@layout` argument and fall back to standalone styles without it.\n */\nexport interface AppLayoutContext {\n state: AppLayoutState;\n mainId: string;\n sidebarId: string;\n /** The `MenuToggle`'s id, so the drawer can return focus to it. */\n menuToggleId: string;\n /** The mobile drawer's id. */\n drawerId: string;\n styles: AppLayoutStyles;\n /** The variant props the layout's `styles` were built from. */\n config: AppLayoutConfig;\n classes?: SlotsToClasses<AppLayoutSlots>;\n /** Whether the viewport is below `config.breakpoint` (tracked). */\n readonly belowBreakpoint: boolean;\n /**\n * Whether the sidebar is collapsed as drawn: `state.sidebarCollapsed`,\n * except that a sidebar with `@collapsible=\"none\"` never is (tracked).\n */\n readonly sidebarCollapsed: boolean;\n /** The aside's id, for `AsideToggle`'s `aria-controls`. */\n asideId: string;\n /** The aside drawer's id. */\n asideDrawerId: string;\n /**\n * Whether the viewport is below `lg`, where the aside is a drawer. Fixed at\n * `lg`, independent of `config.breakpoint` (tracked).\n */\n readonly belowAsideBreakpoint: boolean;\n /** Whether the layout's root is laid out right to left. */\n isRtl(): boolean;\n /**\n * Called by `Sidebar` so the layout can report its effective collapse.\n * Returns the matching unregister function.\n */\n registerSidebar(sidebar: RegisteredSidebar): () => void;\n /** Whether a `Sidebar` is registered (tracked). */\n readonly hasSidebar: boolean;\n /**\n * Whether `SidebarToggle` and `MenuToggle` render: there is a `Sidebar`,\n * and the bottom bar is not standing in for it (tracked).\n */\n readonly canToggleSidebar: boolean;\n /**\n * How navigation is shown below the breakpoint: the sidebar in a `drawer`,\n * or a `bottom` bar (`BottomNav`) with no sidebar (tracked).\n */\n readonly mobileNav: 'drawer' | 'bottom';\n /**\n * Whether the bottom bar replaces the sidebar right now: `mobileNav` is\n * `bottom` and the viewport is below the breakpoint. `Sidebar`,\n * `MenuToggle` and `SidebarToggle` render nothing then, and `BottomNav`\n * renders (tracked).\n */\n readonly bottomNavMode: boolean;\n /**\n * Whether a registered `BottomNav` is shown: `bottomNavMode` with a\n * `BottomNav` in the layout. Settles after the first render, like the\n * registered sidebar (tracked).\n */\n readonly bottomNavShown: boolean;\n /**\n * Called by `BottomNav` so the layout can give it a row and publish\n * `--app-bottomnav-height`. Returns the matching unregister function.\n */\n registerBottomNav(nav: object): () => void;\n /**\n * Whether an `Aside` is rendered in the layout. `AsideToggle` renders\n * nothing without one. Settles after the first render, like the registered\n * sidebar (tracked).\n */\n readonly hasAside: boolean;\n /**\n * Called by `Aside` so the layout knows it has one. Returns the matching\n * unregister function.\n */\n registerAside(aside: object): () => void;\n}\n\nexport interface RegisteredSidebar {\n readonly collapsed: boolean;\n readonly collapsible: 'icon' | 'offcanvas' | 'none';\n readonly size: 'default' | 'rail';\n}\n\nexport interface AppLayoutConfig {\n variant: 'inset' | 'attached';\n navbarPlacement: 'frame' | 'content';\n breakpoint: 'sm' | 'md' | 'lg';\n scrollMode: 'content' | 'page';\n sidebarSide: 'start' | 'end';\n color: NonNullable<AppLayoutVariants['color']>;\n sidebarSurface: NonNullable<AppLayoutVariants['sidebarSurface']>;\n navbarSurface: NonNullable<AppLayoutVariants['navbarSurface']>;\n}\n\n/**\n * The layout-wide variants a part passes when it builds its own styles from\n * the layout's config. `variant` is left to the part: a standalone part\n * picks its own default.\n */\nexport function layoutVariants(\n config: AppLayoutConfig | undefined\n): Partial<\n Pick<\n AppLayoutConfig,\n 'navbarPlacement' | 'breakpoint' | 'scrollMode' | 'sidebarSide'\n >\n> {\n return {\n navbarPlacement: config?.navbarPlacement,\n breakpoint: config?.breakpoint,\n scrollMode: config?.scrollMode,\n sidebarSide: config?.sidebarSide\n };\n}\n\n/** Styles for a part rendered outside an `AppLayout`: no card chrome. */\nexport function standaloneStyles(): AppLayoutStyles {\n return useStyles().appLayout({ variant: 'attached' });\n}\n\ntype StateKey = 'sidebarCollapsed' | 'mobileSidebarOpen' | 'asideOpen';\n\nexport interface ControlledStateArgs {\n sidebarCollapsed?: boolean;\n onSidebarCollapsedChange?: (value: boolean) => void;\n mobileSidebarOpen?: boolean;\n onMobileSidebarOpenChange?: (value: boolean) => void;\n asideOpen?: boolean;\n onAsideOpenChange?: (value: boolean) => void;\n}\n\nconst CALLBACKS = {\n sidebarCollapsed: 'onSidebarCollapsedChange',\n mobileSidebarOpen: 'onMobileSidebarOpenChange',\n asideOpen: 'onAsideOpenChange'\n} as const;\n\n/**\n * An `AppLayoutState` whose fields can each be controlled by an argument.\n *\n * A field is controlled when its argument is *passed* (checked with `in`, as\n * `Tabs` does for `@value`); it then reads from the argument and a write only\n * calls the matching `on…Change` callback. An uncontrolled field reads and\n * writes the wrapped state, seeded from the `@default…` arguments, and calls\n * the callback too.\n */\nexport class ControlledAppLayoutState implements AppLayoutState {\n #own: AppLayoutState;\n #args: () => ControlledStateArgs;\n\n constructor(own: AppLayoutState, args: () => ControlledStateArgs) {\n this.#own = own;\n this.#args = args;\n }\n\n #read(key: StateKey): boolean {\n const args = this.#args();\n return key in args ? Boolean(args[key]) : this.#own[key];\n }\n\n #write(key: StateKey, value: boolean): void {\n if (this.#read(key) === value) {\n return;\n }\n this.#own[key] = value;\n this.#args()[CALLBACKS[key]]?.(value);\n }\n\n get sidebarCollapsed(): boolean {\n return this.#read('sidebarCollapsed');\n }\n\n set sidebarCollapsed(value: boolean) {\n this.#write('sidebarCollapsed', value);\n }\n\n get mobileSidebarOpen(): boolean {\n return this.#read('mobileSidebarOpen');\n }\n\n set mobileSidebarOpen(value: boolean) {\n this.#write('mobileSidebarOpen', value);\n }\n\n get asideOpen(): boolean {\n return this.#read('asideOpen');\n }\n\n set asideOpen(value: boolean) {\n this.#write('asideOpen', value);\n }\n\n toggleSidebar = (): void => {\n this.sidebarCollapsed = !this.sidebarCollapsed;\n };\n\n collapseSidebar = (): void => {\n this.sidebarCollapsed = true;\n };\n\n expandSidebar = (): void => {\n this.sidebarCollapsed = false;\n };\n\n openMobileSidebar = (): void => {\n this.mobileSidebarOpen = true;\n };\n\n closeMobileSidebar = (): void => {\n this.mobileSidebarOpen = false;\n };\n\n toggleAside = (): void => {\n this.asideOpen = !this.asideOpen;\n };\n\n closeAside = (): void => {\n this.asideOpen = false;\n };\n}\n"],"names":["layoutVariants","config","navbarPlacement","breakpoint","scrollMode","sidebarSide","standaloneStyles","useStyles","appLayout","variant","CALLBACKS","sidebarCollapsed","mobileSidebarOpen","asideOpen","ControlledAppLayoutState","constructor","own","args","#read","key","Boolean","#write","value","toggleSidebar","collapseSidebar","expandSidebar","openMobileSidebar","closeMobileSidebar","toggleAside","closeAside"],"mappings":";;AAQA;AACA;AACA;AACA;;AAgGA;AACA;AACA;AACA;AACA;AACO,SAASA,cAAcA,CAC5BC,MAAmC,EAMnC;EACA,OAAO;IACLC,eAAe,EAAED,MAAM,EAAEC,eAAe;IACxCC,UAAU,EAAEF,MAAM,EAAEE,UAAU;IAC9BC,UAAU,EAAEH,MAAM,EAAEG,UAAU;IAC9BC,WAAW,EAAEJ,MAAM,EAAEI;GACtB;AACH;;AAEA;AACO,SAASC,gBAAgBA,GAAoB;AAClD,EAAA,OAAOC,SAAS,EAAE,CAACC,SAAS,CAAC;AAAEC,IAAAA,OAAO,EAAE;AAAW,GAAC,CAAC;AACvD;AAaA,MAAMC,SAAS,GAAG;AAChBC,EAAAA,gBAAgB,EAAE,0BAA0B;AAC5CC,EAAAA,iBAAiB,EAAE,2BAA2B;AAC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mB,EAAEA,KAAK,CAAC;AACzC,EAAA;EAEA,IAAIT,SAASA,GAAY;AACvB,IAAA,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC;AAChC,EAAA;EAEA,IAAIA,SAASA,CAACS,KAAc,EAAE;AAC5B,IAAA,IAAI,CAAC,MAAM,CAAC,WAAW,EAAEA,KAAK,CAAC;AACjC,EAAA;EAEAC,aAAa,GAAGA,MAAY;AAC1B,IAAA,IAAI,CAACZ,gBAAgB,GAAG,CAAC,IAAI,CAACA,gBAAgB;EAChD,CAAC;EAEDa,eAAe,GAAGA,MAAY;IAC5B,IAAI,CAACb,gBAAgB,GAAG,IAAI;EAC9B,CAAC;EAEDc,aAAa,GAAGA,MAAY;IAC1B,IAAI,CAACd,gBAAgB,GAAG,KAAK;EAC/B,CAAC;EAEDe,iBAAiB,GAAGA,MAAY;IAC9B,IAAI,CAACd,iBAAiB,GAAG,IAAI;EAC/B,CAAC;EAEDe,kBAAkB,GAAGA,MAAY;IAC/B,IAAI,CAACf,iBAAiB,GAAG,KAAK;EAChC,CAAC;EAEDgB,WAAW,GAAGA,MAAY;AACxB,IAAA,IAAI,CAACf,SAAS,GAAG,CAAC,IAAI,CAACA,SAAS;EAClC,CAAC;EAEDgB,UAAU,GAAGA,MAAY;IACvB,IAAI,CAAChB,SAAS,GAAG,KAAK;EACxB,CAAC;AACH;;"}
1
+ {"version":3,"file":"context.js","sources":["../../../src/components/layout/context.ts"],"sourcesContent":["import { useStyles, type SlotsToClasses } from '@frontile/theme';\nimport type { AppLayoutSlots, AppLayoutVariants } from '@frontile/theme';\nimport type { AppLayoutState } from './app-layout-state';\n\nexport type AppLayoutStyles = ReturnType<\n ReturnType<typeof useStyles>['appLayout']\n>;\n\n/**\n * What `AppLayout` hands each part it yields. Internal: parts receive it as\n * a bound `@layout` argument and fall back to standalone styles without it.\n */\nexport interface AppLayoutContext {\n state: AppLayoutState;\n mainId: string;\n sidebarId: string;\n /** The `MenuToggle`'s id, so the drawer can return focus to it. */\n menuToggleId: string;\n /** The mobile drawer's id. */\n drawerId: string;\n styles: AppLayoutStyles;\n /** The variant props the layout's `styles` were built from. */\n config: AppLayoutConfig;\n classes?: SlotsToClasses<AppLayoutSlots>;\n /** Whether the viewport is below `config.breakpoint` (tracked). */\n readonly belowBreakpoint: boolean;\n /**\n * Whether the sidebar is collapsed as drawn: `state.sidebarCollapsed`,\n * except that a sidebar with `@collapsible=\"none\"` never is (tracked).\n */\n readonly sidebarCollapsed: boolean;\n /** The aside's id, for `AsideToggle`'s `aria-controls`. */\n asideId: string;\n /** The aside drawer's id. */\n asideDrawerId: string;\n /**\n * Whether the viewport is below `lg`, where the aside is a drawer. Fixed at\n * `lg`, independent of `config.breakpoint` (tracked).\n */\n readonly belowAsideBreakpoint: boolean;\n /** Whether the layout's root is laid out right to left. */\n isRtl(): boolean;\n /**\n * Called by `Sidebar` so the layout can report its effective collapse.\n * Returns the matching unregister function.\n */\n registerSidebar(sidebar: RegisteredSidebar): () => void;\n /** Whether a `Sidebar` is registered (tracked). */\n readonly hasSidebar: boolean;\n /**\n * Whether `SidebarToggle` and `MenuToggle` render: there is a `Sidebar`,\n * and the bottom bar is not standing in for it (tracked).\n */\n readonly canToggleSidebar: boolean;\n /**\n * How navigation is shown below the breakpoint: the sidebar in a `drawer`,\n * or a `bottom` bar (`BottomNav`) with no sidebar (tracked).\n */\n readonly mobileNav: 'drawer' | 'bottom';\n /**\n * Whether the bottom bar replaces the sidebar right now: `mobileNav` is\n * `bottom` and the viewport is below the breakpoint. `Sidebar`,\n * `MenuToggle` and `SidebarToggle` render nothing then, and `BottomNav`\n * renders (tracked).\n */\n readonly bottomNavMode: boolean;\n /**\n * Whether a registered `BottomNav` is shown: `bottomNavMode` with a\n * `BottomNav` in the layout. Settles after the first render, like the\n * registered sidebar (tracked).\n */\n readonly bottomNavShown: boolean;\n /**\n * Called by `BottomNav` so the layout can give it a row and publish\n * `--app-bottomnav-height`. Returns the matching unregister function.\n */\n registerBottomNav(nav: object): () => void;\n /**\n * Whether an `Aside` is rendered in the layout and has something to show.\n * `AsideToggle` renders nothing without one. False while an `Aside` with\n * `@region` has no source. Settles after the first render, like the\n * registered sidebar (tracked).\n */\n readonly hasAside: boolean;\n /**\n * Called by `Aside` so the layout knows it has one. Returns the matching\n * unregister function.\n */\n registerAside(aside: RegisteredAside): () => void;\n}\n\nexport interface RegisteredAside {\n /**\n * Whether the aside has content to show. An `Aside` with `@region`\n * reports false while no source fills it.\n */\n readonly available: boolean;\n}\n\nexport interface RegisteredSidebar {\n readonly collapsed: boolean;\n readonly collapsible: 'icon' | 'offcanvas' | 'none';\n readonly size: 'default' | 'rail';\n}\n\nexport interface AppLayoutConfig {\n variant: 'inset' | 'attached';\n navbarPlacement: 'frame' | 'content';\n breakpoint: 'sm' | 'md' | 'lg';\n scrollMode: 'content' | 'page';\n sidebarSide: 'start' | 'end';\n color: NonNullable<AppLayoutVariants['color']>;\n sidebarSurface: NonNullable<AppLayoutVariants['sidebarSurface']>;\n navbarSurface: NonNullable<AppLayoutVariants['navbarSurface']>;\n}\n\n/**\n * The layout-wide variants a part passes when it builds its own styles from\n * the layout's config. `variant` is left to the part: a standalone part\n * picks its own default.\n */\nexport function layoutVariants(\n config: AppLayoutConfig | undefined\n): Partial<\n Pick<\n AppLayoutConfig,\n 'navbarPlacement' | 'breakpoint' | 'scrollMode' | 'sidebarSide'\n >\n> {\n return {\n navbarPlacement: config?.navbarPlacement,\n breakpoint: config?.breakpoint,\n scrollMode: config?.scrollMode,\n sidebarSide: config?.sidebarSide\n };\n}\n\n/** Styles for a part rendered outside an `AppLayout`: no card chrome. */\nexport function standaloneStyles(): AppLayoutStyles {\n return useStyles().appLayout({ variant: 'attached' });\n}\n\ntype StateKey = 'sidebarCollapsed' | 'mobileSidebarOpen' | 'asideOpen';\n\nexport interface ControlledStateArgs {\n sidebarCollapsed?: boolean;\n onSidebarCollapsedChange?: (value: boolean) => void;\n mobileSidebarOpen?: boolean;\n onMobileSidebarOpenChange?: (value: boolean) => void;\n asideOpen?: boolean;\n onAsideOpenChange?: (value: boolean) => void;\n}\n\nconst CALLBACKS = {\n sidebarCollapsed: 'onSidebarCollapsedChange',\n mobileSidebarOpen: 'onMobileSidebarOpenChange',\n asideOpen: 'onAsideOpenChange'\n} as const;\n\n/**\n * An `AppLayoutState` whose fields can each be controlled by an argument.\n *\n * A field is controlled when its argument is *passed* (checked with `in`, as\n * `Tabs` does for `@value`); it then reads from the argument and a write only\n * calls the matching `on…Change` callback. An uncontrolled field reads and\n * writes the wrapped state, seeded from the `@default…` arguments, and calls\n * the callback too.\n */\nexport class ControlledAppLayoutState implements AppLayoutState {\n #own: AppLayoutState;\n #args: () => ControlledStateArgs;\n\n constructor(own: AppLayoutState, args: () => ControlledStateArgs) {\n this.#own = own;\n this.#args = args;\n }\n\n #read(key: StateKey): boolean {\n const args = this.#args();\n return key in args ? Boolean(args[key]) : this.#own[key];\n }\n\n #write(key: StateKey, value: boolean): void {\n if (this.#read(key) === value) {\n return;\n }\n this.#own[key] = value;\n this.#args()[CALLBACKS[key]]?.(value);\n }\n\n get sidebarCollapsed(): boolean {\n return this.#read('sidebarCollapsed');\n }\n\n set sidebarCollapsed(value: boolean) {\n this.#write('sidebarCollapsed', value);\n }\n\n get mobileSidebarOpen(): boolean {\n return this.#read('mobileSidebarOpen');\n }\n\n set mobileSidebarOpen(value: boolean) {\n this.#write('mobileSidebarOpen', value);\n }\n\n get asideOpen(): boolean {\n return this.#read('asideOpen');\n }\n\n set asideOpen(value: boolean) {\n this.#write('asideOpen', value);\n }\n\n toggleSidebar = (): void => {\n this.sidebarCollapsed = !this.sidebarCollapsed;\n };\n\n collapseSidebar = (): void => {\n this.sidebarCollapsed = true;\n };\n\n expandSidebar = (): void => {\n this.sidebarCollapsed = false;\n };\n\n openMobileSidebar = (): void => {\n this.mobileSidebarOpen = true;\n };\n\n closeMobileSidebar = (): void => {\n this.mobileSidebarOpen = false;\n };\n\n toggleAside = (): void => {\n this.asideOpen = !this.asideOpen;\n };\n\n closeAside = (): void => {\n this.asideOpen = false;\n };\n}\n"],"names":["layoutVariants","config","navbarPlacement","breakpoint","scrollMode","sidebarSide","standaloneStyles","useStyles","appLayout","variant","CALLBACKS","sidebarCollapsed","mobileSidebarOpen","asideOpen","ControlledAppLayoutState","constructor","own","args","#read","key","Boolean","#write","value","toggleSidebar","collapseSidebar","expandSidebar","openMobileSidebar","closeMobileSidebar","toggleAside","closeAside"],"mappings":";;AAQA;AACA;AACA;AACA;;AAyGA;AACA;AACA;AACA;AACA;AACO,SAASA,cAAcA,CAC5BC,MAAmC,EAMnC;EACA,OAAO;IACLC,eAAe,EAAED,MAAM,EAAEC,eAAe;IACxCC,UAAU,EAAEF,MAAM,EAAEE,UAAU;IAC9BC,UAAU,EAAEH,MAAM,EAAEG,UAAU;IAC9BC,WAAW,EAAEJ,MAAM,EAAEI;GACtB;AACH;;AAEA;AACO,SAASC,gBAAgBA,GAAoB;AAClD,EAAA,OAAOC,SAAS,EAAE,CAACC,SAAS,CAAC;AAAEC,IAAAA,OAAO,EAAE;AAAW,GAAC,CAAC;AACvD;AAaA,MAAMC,SAAS,GAAG;AAChBC,EAAAA,gBAAgB,EAAE,0BAA0B;AAC5CC,EAAAA,iBAAiB,EAAE,2BAA2B;AAC9CC,EAAAA,SAAS,EAAE;AACb,CAAU;;AAEV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,wBAAwB,CAA2B;AAC9D,EAAA,IAAI;AACJ,EAAA,KAAK;AAELC,EAAAA,WAAWA,CAACC,GAAmB,EAAEC,IAA+B,EAAE;AAChE,IAAA,IAAI,CAAC,IAAI,GAAGD,GAAG;AACf,IAAA,IAAI,CAAC,KAAK,GAAGC,IAAI;AACnB,EAAA;EAEA,KAAKC,CAACC,GAAa,EAAW;AAC5B,IAAA,MAAMF,IAAI,GAAG,IAAI,CAAC,KAAK,EAAE;AACzB,IAAA,OAAOE,GAAG,IAAIF,IAAI,GAAGG,OAAO,CAACH,I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MAAY;IAC1B,IAAI,CAACd,gBAAgB,GAAG,KAAK;EAC/B,CAAC;EAEDe,iBAAiB,GAAGA,MAAY;IAC9B,IAAI,CAACd,iBAAiB,GAAG,IAAI;EAC/B,CAAC;EAEDe,kBAAkB,GAAGA,MAAY;IAC/B,IAAI,CAACf,iBAAiB,GAAG,KAAK;EAChC,CAAC;EAEDgB,WAAW,GAAGA,MAAY;AACxB,IAAA,IAAI,CAACf,SAAS,GAAG,CAAC,IAAI,CAACA,SAAS;EAClC,CAAC;EAEDgB,UAAU,GAAGA,MAAY;IACvB,IAAI,CAAChB,SAAS,GAAG,KAAK;EACxB,CAAC;AACH;;"}
@@ -0,0 +1,42 @@
1
+ import Component from '@glimmer/component';
2
+ import { service } from '@ember/service';
3
+ import { registerDestructor } from '@ember/destroyable';
4
+ import { precompileTemplate } from '@ember/template-compilation';
5
+ import { setComponentTemplate } from '@ember/component';
6
+ import { d as decorateFieldV2, i as initializeDeferredDecorator } from '../../runtime--fcdnjmJ-DOFHQ2m8.js';
7
+
8
+ /**
9
+ * Renders its block into the layout region of the same name, from anywhere
10
+ * in the app, including a route template inside `{{outlet}}`. Nothing
11
+ * renders where it sits, and the block gets no wrapper element.
12
+ *
13
+ * The source that rendered last is the one shown. When it goes away (a
14
+ * child route exits) the previous one comes back. In a parent route
15
+ * template, put it before `{{outlet}}` so the child's source renders later
16
+ * and wins. With `@multiple` on the region, every source is shown.
17
+ */
18
+ class InLayoutRegion extends Component {
19
+ static {
20
+ decorateFieldV2(this.prototype, "regions", [service('frontile-layout-regions')]);
21
+ }
22
+ #regions = (initializeDeferredDecorator(this, "regions"), void 0);
23
+ token = {};
24
+ /** `@name`, read once: the source stays in the region it joined. */
25
+ name;
26
+ constructor(owner, args) {
27
+ super(owner, args);
28
+ this.name = args.name;
29
+ registerDestructor(this, this.regions.addSource(this.name, this.token));
30
+ }
31
+ get target() {
32
+ return this.regions.targetFor(this.name, this.token);
33
+ }
34
+ static {
35
+ setComponentTemplate(precompileTemplate("{{#if this.target}}\n {{#in-element this.target insertBefore=null}}{{yield}}{{/in-element}}\n{{/if}}", {
36
+ strictMode: true
37
+ }), this);
38
+ }
39
+ }
40
+
41
+ export { InLayoutRegion, InLayoutRegion as default };
42
+ //# sourceMappingURL=in-layout-region.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"in-layout-region.js","sources":["../../../src/components/layout/in-layout-region.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { service } from '@ember/service';\nimport { registerDestructor } from '@ember/destroyable';\nimport type FrontileLayoutRegionsService from '../../services/frontile-layout-regions';\nimport type Owner from '@ember/owner';\n\ninterface InLayoutRegionArgs {\n /**\n * The name of the region to render into: a `layout.Region @name`, or a\n * `layout.Aside @region`. Read once.\n */\n name: string;\n}\n\ninterface InLayoutRegionSignature {\n Args: InLayoutRegionArgs;\n Blocks: {\n /** The content rendered in the region. */\n default: [];\n };\n}\n\n/**\n * Renders its block into the layout region of the same name, from anywhere\n * in the app, including a route template inside `{{outlet}}`. Nothing\n * renders where it sits, and the block gets no wrapper element.\n *\n * The source that rendered last is the one shown. When it goes away (a\n * child route exits) the previous one comes back. In a parent route\n * template, put it before `{{outlet}}` so the child's source renders later\n * and wins. With `@multiple` on the region, every source is shown.\n */\nclass InLayoutRegion extends Component<InLayoutRegionSignature> {\n @service('frontile-layout-regions')\n declare regions: FrontileLayoutRegionsService;\n\n token = {};\n /** `@name`, read once: the source stays in the region it joined. */\n name: string;\n\n constructor(owner: Owner, args: InLayoutRegionArgs) {\n super(owner, args);\n this.name = args.name;\n registerDestructor(this, this.regions.addSource(this.name, this.token));\n }\n\n get target(): Element | null {\n return this.regions.targetFor(this.name, this.token);\n }\n\n <template>\n {{#if this.target}}\n {{#in-element this.target insertBefore=null}}{{yield}}{{/in-element}}\n {{/if}}\n </template>\n}\n\nexport {\n InLayoutRegion,\n type InLayoutRegionSignature,\n type InLayoutRegionArgs\n};\nexport default InLayoutRegion;\n"],"names":["InLayoutRegion","Component","g","prototype","service","i","token","name","constructor","owner","args","registerDestructor","regions","addSource","target","targetFor","setComponentTemplate","precompileTemplate","strictMode"],"mappings":";;;;;;;AAsBA;;;;;;;;;;AAUA,MAAMA,uBAAuBC,SAAA,CAAU;AAAA,EAAA;AAAAC,IAAAA,eAAA,MAAAC,SAAA,EAAA,SAAA,EAAA,CACpCC,OAAA,CAAQ,yBAAA,CAAA,CAAA,CAAA;AAAA;EAAA,QAAA,IAAAC,2BAAA,CAAA,IAAA,EAAA,SAAA,CAAA,EAAA,MAAA;EAGTC,KAAA,GAAQ,EAAC;AACT;EACAC,IAAA;AAEAC,EAAAA,WAAAA,CAAYC,KAAY,EAAEC,IAAwB,EAAE;AAClD,IAAA,KAAK,CAACD,KAAA,EAAOC,IAAA,CAAA;AACb,IAAA,IAAI,CAACH,IAAI,GAAGG,IAAA,CAAKH,IAAI;AACrBI,IAAAA,kBAAA,CAAmB,IAAI,EAAE,IAAI,CAACC,OAAO,CAACC,SAAS,CAAC,IAAI,CAACN,IAAI,EAAE,IAAI,CAACD,KAAK,CAAA,CAAA;AACvE,EAAA;EAEA,IAAIQ,MAAAA,GAAyB;AAC3B,IAAA,OAAO,IAAI,CAACF,OAAO,CAACG,SAAS,CAAC,IAAI,CAACR,IAAI,EAAE,IAAI,CAACD,KAAK,CAAA;AACrD,EAAA;AAEA,EAAA;IAAAU,oBAAA,CAAAC,kBAAA,CAAA,uGAAA,EAIA;MAAAC,UAAA,EAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;"}
@@ -11,4 +11,6 @@ export { PageHeader } from './page-header.js';
11
11
  export { Sidebar } from './sidebar.js';
12
12
  export { SidebarGroup } from './sidebar-group.js';
13
13
  export { SidebarToggle } from './sidebar-toggle.js';
14
+ export { Region } from './region.js';
15
+ export { InLayoutRegion } from './in-layout-region.js';
14
16
  //# 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":";;;;;;;;;;;;;;"}
@@ -0,0 +1,51 @@
1
+ import Component from '@glimmer/component';
2
+ import { service } from '@ember/service';
3
+ import { modifier } from 'ember-modifier';
4
+ import { standaloneStyles } from './context.js';
5
+ import { precompileTemplate } from '@ember/template-compilation';
6
+ import { setComponentTemplate } from '@ember/component';
7
+ import { d as decorateFieldV2, i as initializeDeferredDecorator } from '../../runtime--fcdnjmJ-DOFHQ2m8.js';
8
+
9
+ /**
10
+ * A named place in the layout that any template, including a route template
11
+ * inside `{{outlet}}`, fills with `InLayoutRegion`. Its element is
12
+ * `display: contents`, so the content lays out as if it were written where
13
+ * the region sits. `data-has-content` is `true` while a source fills it.
14
+ */
15
+ class Region extends Component {
16
+ static {
17
+ decorateFieldV2(this.prototype, "regions", [service('frontile-layout-regions')]);
18
+ }
19
+ #regions = (initializeDeferredDecorator(this, "regions"), void 0);
20
+ /** `@name`, read once. */name;
21
+ /** `@multiple`, read once. */
22
+ multiple;
23
+ constructor(owner, args) {
24
+ super(owner, args);
25
+ this.name = args.name;
26
+ this.multiple = args.multiple ?? false;
27
+ }
28
+ register = modifier(element => this.regions.registerTarget(this.name, element, {
29
+ multiple: this.multiple
30
+ }));
31
+ get classNames() {
32
+ const styles = this.args.layout?.styles ?? standaloneStyles();
33
+ return styles.region({
34
+ class: this.args.layout?.classes?.region
35
+ });
36
+ }
37
+ get hasContent() {
38
+ return this.regions.hasContent(this.name);
39
+ }
40
+ get hasContentString() {
41
+ return this.hasContent ? 'true' : 'false';
42
+ }
43
+ static {
44
+ setComponentTemplate(precompileTemplate("<div data-part=\"region\" data-region={{this.name}} data-has-content={{this.hasContentString}} class={{this.classNames}} {{this.register}} ...attributes>\n {{#unless this.hasContent}}{{yield}}{{/unless}}\n</div>", {
45
+ strictMode: true
46
+ }), this);
47
+ }
48
+ }
49
+
50
+ export { Region, Region as default };
51
+ //# sourceMappingURL=region.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"region.js","sources":["../../../src/components/layout/region.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { service } from '@ember/service';\nimport { modifier } from 'ember-modifier';\nimport { standaloneStyles, type AppLayoutContext } from './context';\nimport type FrontileLayoutRegionsService from '../../services/frontile-layout-regions';\nimport type Owner from '@ember/owner';\n\ninterface RegionArgs {\n /**\n * The region's name, matched by `InLayoutRegion @name`. Names are global\n * to the app. Read once, when the region renders.\n */\n name: string;\n\n /**\n * Render every source, in the order they rendered, instead of only the\n * newest. After the region renders again, sources follow template order.\n * Read once, when the region renders.\n *\n * @defaultValue false\n */\n multiple?: boolean;\n\n /**\n * Supplied by `AppLayout`. Not part of the public API.\n *\n * @internal\n */\n layout?: AppLayoutContext;\n}\n\ninterface RegionSignature {\n Args: RegionArgs;\n Blocks: {\n /** Rendered while no `InLayoutRegion` fills the region. */\n default: [];\n };\n Element: HTMLDivElement;\n}\n\n/**\n * A named place in the layout that any template, including a route template\n * inside `{{outlet}}`, fills with `InLayoutRegion`. Its element is\n * `display: contents`, so the content lays out as if it were written where\n * the region sits. `data-has-content` is `true` while a source fills it.\n */\nclass Region extends Component<RegionSignature> {\n @service('frontile-layout-regions')\n declare regions: FrontileLayoutRegionsService;\n\n /** `@name`, read once. */\n name: string;\n /** `@multiple`, read once. */\n multiple: boolean;\n\n constructor(owner: Owner, args: RegionArgs) {\n super(owner, args);\n this.name = args.name;\n this.multiple = args.multiple ?? false;\n }\n\n register = modifier((element: HTMLElement) =>\n this.regions.registerTarget(this.name, element, {\n multiple: this.multiple\n })\n );\n\n get classNames(): string {\n const styles = this.args.layout?.styles ?? standaloneStyles();\n return styles.region({ class: this.args.layout?.classes?.region });\n }\n\n get hasContent(): boolean {\n return this.regions.hasContent(this.name);\n }\n\n get hasContentString(): 'true' | 'false' {\n return this.hasContent ? 'true' : 'false';\n }\n\n <template>\n <div\n data-part=\"region\"\n data-region={{this.name}}\n data-has-content={{this.hasContentString}}\n class={{this.classNames}}\n {{this.register}}\n ...attributes\n >\n {{#unless this.hasContent}}{{yield}}{{/unless}}\n </div>\n </template>\n}\n\nexport { Region, type RegionSignature, type RegionArgs };\nexport default Region;\n"],"names":["Region","Component","g","prototype","service","i","name","multiple","constructor","owner","args","register","modifier","element","regions","registerTarget","classNames","styles","layout","standaloneStyles","region","class","classes","hasContent","hasContentString","setComponentTemplate","precompileTemplate","strictMode"],"mappings":";;;;;;;;AAwCA;;;;;;AAMA,MAAMA,eAAeC,SAAA,CAAU;AAAA,EAAA;AAAAC,IAAAA,eAAA,MAAAC,SAAA,EAAA,SAAA,EAAA,CAC5BC,OAAA,CAAQ,yBAAA,CAAA,CAAA,CAAA;AAAA;EAAA,QAAA,IAAAC,2BAAA,CAAA,IAAA,EAAA,SAAA,CAAA,EAAA,MAAA;AAGT,4BACAC,IAAA;AACA;EACAC,QAAA;AAEAC,EAAAA,WAAAA,CAAYC,KAAY,EAAEC,IAAgB,EAAE;AAC1C,IAAA,KAAK,CAACD,KAAA,EAAOC,IAAA,CAAA;AACb,IAAA,IAAI,CAACJ,IAAI,GAAGI,IAAA,CAAKJ,IAAI;AACrB,IAAA,IAAI,CAACC,QAAQ,GAAGG,IAAA,CAAKH,QAAQ,IAAI,KAAA;AACnC,EAAA;AAEAI,EAAAA,QAAA,GAAWC,QAAA,CAAUC,OAAS,IAC5B,IAAI,CAACC,OAAO,CAACC,cAAc,CAAC,IAAI,CAACT,IAAI,EAAEO,OAAA,EAAS;IAC9CN,QAAA,EAAU,IAAI,CAACA;AACjB,GAAA,CAAA,CAAA;EAGF,IAAIS,UAAAA,GAAqB;AACvB,IAAA,MAAMC,SAAS,IAAI,CAACP,IAAI,CAACQ,MAAM,EAAED,MAAA,IAAUE,gBAAA,EAAA;IAC3C,OAAOF,MAAA,CAAOG,MAAM,CAAC;MAAEC,KAAA,EAAO,IAAI,CAACX,IAAI,CAACQ,MAAM,EAAEI,OAAA,EAASF;AAAO,KAAA,CAAA;AAClE,EAAA;EAEA,IAAIG,UAAAA,GAAsB;IACxB,OAAO,IAAI,CAACT,OAAO,CAACS,UAAU,CAAC,IAAI,CAACjB,IAAI,CAAA;AAC1C,EAAA;EAEA,IAAIkB,gBAAAA,GAAqC;AACvC,IAAA,OAAO,IAAI,CAACD,UAAU,GAAG,MAAA,GAAS,OAAA;AACpC,EAAA;AAEA,EAAA;IAAAE,oBAAA,CAAAC,kBAAA,CAAA,sNAAA,EAWA;MAAAC,UAAA,EAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;"}
@@ -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, 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,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,QAAAA,KAAA,EAAO,CAAC,IAAI,CAACF,IAAI,CAACG,OAAO,EAAEN,IAAA,EAAM,IAAI,CAACG,IAAI,CAACE,KA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AAU,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;;;;;;;;;;AAUC;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 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,IAAA,EAAM,IAAI,CAACC,IAAI,CAACD,IAAI;AACpBE,MAAAA,KAAA,EAAO,IAAI,CAACD,IAAI,CAACC;AACnB,KAAA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AI,oBAAA,CAAAC,kBAAA,CAAA,w2BAAA,EA4CA;MAAAC,UAAA,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;;;;;;;;;;AAUC;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 +1 @@
1
- {"version":3,"file":"badge.js","sources":["../../../src/components/status/badge.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { useStyles } from '@frontile/theme';\n\ninterface BadgeSignature {\n Args: {\n /**\n * The badge variant. There is no `solid`: a saturated block reads as a\n * Chip or Button.\n *\n * @defaultValue 'soft'\n */\n variant?: 'soft' | 'outline';\n\n /**\n * The color of the badge.\n *\n * @defaultValue 'neutral'\n */\n color?:\n 'neutral' | 'primary' | 'secondary' | 'tertiary' | 'success' | 'danger';\n\n /**\n * The size of the badge\n *\n * @defaultValue 'md'\n */\n size?: 'xs' | 'sm' | 'md' | 'lg';\n\n /**\n * Adds a dot before the content, colored by `@color`.\n *\n * @defaultValue false\n */\n withDot?: boolean;\n\n /**\n * Custom class name, it will override the default ones using Tailwind Merge library.\n */\n class?: string;\n\n /**\n * A figure shown after the label, such as a price or a count. A number is\n * accepted, and `0` still renders; only `undefined` or `null` leaves the\n * value out. Rendered in its own part so the theme can give it a\n * tabular, heavier treatment.\n */\n value?: string | number;\n\n /**\n * A unit shown after the value, such as `/mo`. Rendered only when set.\n */\n unit?: string;\n };\n Blocks: {\n /**\n * The badge label.\n */\n default: [];\n\n /**\n * An icon shown before the label. Using this block means the label must\n * go in the `<:default>` block.\n */\n startIcon?: [];\n\n /**\n * An icon shown after the value and unit. Using this block means the label\n * must go in the `<:default>` block.\n */\n endIcon?: [];\n };\n Element: HTMLSpanElement;\n}\n\n/**\n * A non-interactive label for status or metadata. Renders, in order: dot, start\n * icon, label, value, unit, end icon.\n *\n * When you pass a named block (`<:startIcon>` or `<:endIcon>`), Glimmer no\n * longer treats loose content as the default block, so put the label in\n * `<:default>`.\n *\n * Facet 2.0 content parts map one-to-one onto this API, so there are no extra\n * slots: `leading` is the default block, `price` is `@value`, `unit` is\n * `@unit`, `startGlyph` is `<:startIcon>` and `endGlyph` is `<:endIcon>`.\n */\nclass Badge extends Component<BadgeSignature> {\n // `!= null` rather than truthiness, so a count of `0` is shown.\n get hasValue(): boolean {\n return this.args.value != null;\n }\n\n get classNames() {\n const { badge } = useStyles();\n\n const { base, value, unit, icon, dot } = badge({\n color: this.args.color,\n size: this.args.size,\n variant: this.args.variant\n });\n\n return {\n base: base({ class: this.args.class }),\n value: value(),\n unit: unit(),\n icon: icon(),\n dot: dot()\n };\n }\n\n <template>\n <span\n class={{this.classNames.base}}\n data-component=\"badge\"\n data-part=\"base\"\n ...attributes\n >\n {{#if @withDot}}\n <span class={{this.classNames.dot}} data-part=\"dot\"></span>\n {{/if}}\n {{#if (has-block \"startIcon\")}}\n <span\n class={{this.classNames.icon}}\n data-part=\"icon\"\n data-position=\"start\"\n >\n {{yield to=\"startIcon\"}}\n </span>\n {{/if}}\n {{yield}}\n {{#if this.hasValue}}\n <span\n class={{this.classNames.value}}\n data-part=\"value\"\n >{{@value}}</span>\n {{/if}}\n {{#if @unit}}\n <span class={{this.classNames.unit}} data-part=\"unit\">{{@unit}}</span>\n {{/if}}\n {{#if (has-block \"endIcon\")}}\n <span\n class={{this.classNames.icon}}\n data-part=\"icon\"\n data-position=\"end\"\n >\n {{yield to=\"endIcon\"}}\n </span>\n {{/if}}\n </span>\n </template>\n}\n\nexport { Badge, type BadgeSignature };\nexport default Badge;\n"],"names":["Badge","Component","hasValue","args","value","classNames","badge","useStyles","base","unit","icon","dot","color","size","variant","class","setComponentTemplate","precompileTemplate","strictMode"],"mappings":";;;;;AA0EA;;;;;;;;;;;;AAYA,MAAMA,cAAcC,SAAA,CAAU;AAC5B;EACA,IAAIC,QAAAA,GAAoB;AACtB,IAAA,OAAO,IAAI,CAACC,IAAI,CAACC,KAAK,IAAI,IAAA;AAC5B,EAAA;EAEA,IAAIC,UAAAA,GAAa;IACf,MAAM;AAAEC,MAAAA;KAAO,GAAGC,SAAA,EAAA;IAElB,MAAM;MAAEC,IAAI;MAAEJ,KAAK;MAAEK,IAAI;MAAEC,IAAI;AAAEC,MAAAA;KAAK,GAAGL,KAAA,CAAM;AAC7CM,MAAAA,KAAA,EAAO,IAAI,CAACT,IAAI,CAACS,KAAK;AACtBC,MAAAA,IAAA,EAAM,IAAI,CAACV,IAAI,CAACU,IAAI;AACpBC,MAAAA,OAAA,EAAS,IAAI,CAACX,IAAI,CAACW;AACrB,KAAA,CAAA;IAEA,OAAO;MACLN,IAAA,EAAMA,IAAA,CAAK;AAAEO,QAAAA,KAAA,EAAO,IAAI,CAACZ,IAAI,CAACY;AAAM,OAAA,CAAA;MACpCX,KAAA,EAAOA,KAAA,EAAA;MACPK,IAAA,EAAMA,IAAA,EAAA;MACNC,IAAA,EAAMA,IAAA,EAAA;MACNC,GAAA,EAAKA,GAAA;KACP;AACF,EAAA;AAEA,EAAA;IAAAK,oBAAA,CAAAC,kBAAA,CAAA,4xBAAA,EAuCA;MAAAC,UAAA,EAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;"}
1
+ {"version":3,"file":"badge.js","sources":["../../../src/components/status/badge.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { useStyles } from '@frontile/theme';\n\ninterface BadgeSignature {\n Args: {\n /**\n * The badge variant. `solid` fills with the color's default level, `soft`\n * is a tinted surface, and `outline` draws the color as a border.\n *\n * @defaultValue 'solid'\n */\n variant?: 'solid' | 'soft' | 'outline';\n\n /**\n * The color of the badge.\n *\n * @defaultValue 'neutral'\n */\n color?:\n 'neutral' | 'primary' | 'secondary' | 'tertiary' | 'success' | 'danger';\n\n /**\n * The size of the badge. Uses Button's size names and text size: the same\n * `@size` gives the same label text size on Badge, Chip and Button.\n *\n * @defaultValue 'xs'\n */\n size?: '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n\n /**\n * Adds a dot before the content, colored by `@color`.\n *\n * @defaultValue false\n */\n withDot?: boolean;\n\n /**\n * Custom class name, it will override the default ones using Tailwind Merge library.\n */\n class?: string;\n\n /**\n * A figure shown after the label, such as a price or a count. A number is\n * accepted, and `0` still renders; only `undefined` or `null` leaves the\n * value out. Rendered in its own part so the theme can give it a\n * tabular, heavier treatment.\n */\n value?: string | number;\n\n /**\n * A unit shown after the value, such as `/mo`. Rendered only when set.\n */\n unit?: string;\n };\n Blocks: {\n /**\n * The badge label.\n */\n default: [];\n\n /**\n * An icon shown before the label. Using this block means the label must\n * go in the `<:default>` block.\n */\n startIcon?: [];\n\n /**\n * An icon shown after the value and unit. Using this block means the label\n * must go in the `<:default>` block.\n */\n endIcon?: [];\n };\n Element: HTMLSpanElement;\n}\n\n/**\n * A non-interactive label for status or metadata. Renders, in order: dot, start\n * icon, label, value, unit, end icon.\n *\n * When you pass a named block (`<:startIcon>` or `<:endIcon>`), Glimmer no\n * longer treats loose content as the default block, so put the label in\n * `<:default>`.\n *\n * Facet 2.0 content parts map one-to-one onto this API, so there are no extra\n * slots: `leading` is the default block, `price` is `@value`, `unit` is\n * `@unit`, `startGlyph` is `<:startIcon>` and `endGlyph` is `<:endIcon>`.\n */\nclass Badge extends Component<BadgeSignature> {\n // `!= null` rather than truthiness, so a count of `0` is shown.\n get hasValue(): boolean {\n return this.args.value != null;\n }\n\n get classNames() {\n const { badge } = useStyles();\n\n const { base, value, unit, icon, dot } = badge({\n color: this.args.color,\n size: this.args.size,\n variant: this.args.variant\n });\n\n return {\n base: base({ class: this.args.class }),\n value: value(),\n unit: unit(),\n icon: icon(),\n dot: dot()\n };\n }\n\n <template>\n <span\n class={{this.classNames.base}}\n data-component=\"badge\"\n data-part=\"base\"\n ...attributes\n >\n {{#if @withDot}}\n <span class={{this.classNames.dot}} data-part=\"dot\"></span>\n {{/if}}\n {{#if (has-block \"startIcon\")}}\n <span\n class={{this.classNames.icon}}\n data-part=\"icon\"\n data-position=\"start\"\n >\n {{yield to=\"startIcon\"}}\n </span>\n {{/if}}\n {{yield}}\n {{#if this.hasValue}}\n <span\n class={{this.classNames.value}}\n data-part=\"value\"\n >{{@value}}</span>\n {{/if}}\n {{#if @unit}}\n <span class={{this.classNames.unit}} data-part=\"unit\">{{@unit}}</span>\n {{/if}}\n {{#if (has-block \"endIcon\")}}\n <span\n class={{this.classNames.icon}}\n data-part=\"icon\"\n data-position=\"end\"\n >\n {{yield to=\"endIcon\"}}\n </span>\n {{/if}}\n </span>\n </template>\n}\n\nexport { Badge, type BadgeSignature };\nexport default Badge;\n"],"names":["Badge","Component","hasValue","args","value","classNames","badge","useStyles","base","unit","icon","dot","color","size","variant","class","setComponentTemplate","precompileTemplate","strictMode"],"mappings":";;;;;AA2EA;;;;;;;;;;;;AAYA,MAAMA,cAAcC,SAAA,CAAU;AAC5B;EACA,IAAIC,QAAAA,GAAoB;AACtB,IAAA,OAAO,IAAI,CAACC,IAAI,CAACC,KAAK,IAAI,IAAA;AAC5B,EAAA;EAEA,IAAIC,UAAAA,GAAa;IACf,MAAM;AAAEC,MAAAA;KAAO,GAAGC,SAAA,EAAA;IAElB,MAAM;MAAEC,IAAI;MAAEJ,KAAK;MAAEK,IAAI;MAAEC,IAAI;AAAEC,MAAAA;KAAK,GAAGL,KAAA,CAAM;AAC7CM,MAAAA,KAAA,EAAO,IAAI,CAACT,IAAI,CAACS,KAAK;AACtBC,MAAAA,IAAA,EAAM,IAAI,CAACV,IAAI,CAACU,IAAI;AACpBC,MAAAA,OAAA,EAAS,IAAI,CAACX,IAAI,CAACW;AACrB,KAAA,CAAA;IAEA,OAAO;MACLN,IAAA,EAAMA,IAAA,CAAK;AAAEO,QAAAA,KAAA,EAAO,IAAI,CAACZ,IAAI,CAACY;AAAM,OAAA,CAAA;MACpCX,KAAA,EAAOA,KAAA,EAAA;MACPK,IAAA,EAAMA,IAAA,EAAA;MACNC,IAAA,EAAMA,IAAA,EAAA;MACNC,GAAA,EAAKA,GAAA;KACP;AACF,EAAA;AAEA,EAAA;IAAAK,oBAAA,CAAAC,kBAAA,CAAA,4xBAAA,EAuCA;MAAAC,UAAA,EAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;"}
@@ -0,0 +1,38 @@
1
+ import Component from '@glimmer/component';
2
+ import { useStyles } from '@frontile/theme';
3
+ import { precompileTemplate } from '@ember/template-compilation';
4
+ import { setComponentTemplate } from '@ember/component';
5
+
6
+ class Card extends Component {
7
+ get classNames() {
8
+ const {
9
+ card
10
+ } = useStyles();
11
+ return card({
12
+ variant: this.args.variant,
13
+ color: this.args.color,
14
+ density: this.args.density,
15
+ elevation: this.args.elevation,
16
+ isSelected: this.args.isSelected,
17
+ isInteractive: this.args.isInteractive,
18
+ isDisabled: this.args.isDisabled,
19
+ class: this.args.class
20
+ });
21
+ }
22
+ get indicatorClassNames() {
23
+ const {
24
+ cardIndicator
25
+ } = useStyles();
26
+ return cardIndicator({
27
+ color: this.args.color
28
+ });
29
+ }
30
+ static {
31
+ setComponentTemplate(precompileTemplate("<div class={{this.classNames}} data-component=\"card\" data-part=\"base\" data-selected={{@isSelected}} data-disabled={{@isDisabled}} ...attributes>\n {{yield}}\n {{#if @isSelected}}\n {{#if (has-block \"indicator\")}}\n <span class={{this.indicatorClassNames}} data-part=\"indicator\" aria-hidden=\"true\">\n {{yield to=\"indicator\"}}\n </span>\n {{/if}}\n {{/if}}\n</div>", {
32
+ strictMode: true
33
+ }), this);
34
+ }
35
+ }
36
+
37
+ export { Card, Card as default };
38
+ //# sourceMappingURL=card.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"card.js","sources":["../../../src/components/utilities/card.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { useStyles } from '@frontile/theme';\n\ninterface CardSignature {\n Args: {\n /**\n * The surface treatment. `outline` is a bordered card, `flat` has no\n * visible border, and `soft` swaps the fill for a faint tint with no\n * border.\n *\n * @defaultValue 'outline'\n */\n variant?: 'outline' | 'flat' | 'soft';\n\n /**\n * Colours the hover and selected border. The resting border is neutral\n * either way. The border is 1px in every state; hover and selected add a\n * second 1px inset layer in the same colour so they read as 2px without a\n * layout shift.\n *\n * @defaultValue 'neutral'\n */\n color?: 'neutral' | 'primary';\n\n /**\n * How much padding surrounds the contents.\n *\n * @defaultValue 'comfortable'\n */\n density?: 'compact' | 'comfortable' | 'spacious';\n\n /**\n * `raised` gives an `outline` card its shadow, and lifts it on hover when\n * the card is interactive. `none` removes both. `flat` and `soft` never\n * have a shadow, so this changes nothing for them.\n *\n * @defaultValue 'raised'\n */\n elevation?: 'raised' | 'none';\n\n /**\n * Shows the card as selected. This is appearance only: Card holds no\n * selection state, and does not set `role` or `aria-*` for you. Pair it\n * with whatever provides the selection behaviour and semantics. A selected\n * card also shows the `indicator` block, if one is passed.\n *\n * @defaultValue false\n */\n isSelected?: boolean;\n\n /**\n * Adds the hover, pressed, focus-visible and pointer styles for a card\n * that can be clicked. It does not make the card focusable or add an\n * event handler; use a `button`, a link, or `role` and `tabindex` through\n * `...attributes` for that.\n *\n * @defaultValue false\n */\n isInteractive?: boolean;\n\n /**\n * Dims the card and removes its hover and pressed styles. Disabled and\n * selected can be combined: the selected border and its inset layer stay\n * visible.\n *\n * @defaultValue false\n */\n isDisabled?: boolean;\n\n /**\n * Custom class name, it will override the default ones using Tailwind\n * Merge library.\n */\n class?: string;\n };\n Blocks: {\n /**\n * The card's contents. Card has no regions of its own; lay them out here.\n * When the `indicator` block is also used, the contents go in\n * `<:default>`, because named blocks cannot sit beside loose content.\n */\n default: [];\n\n /**\n * Opts in to a selection indicator: a small circle at the card's top-right\n * corner holding whatever you pass, usually a check icon from your own\n * icon library. It is shown only while the card is selected, is hidden\n * from assistive technology, and takes its fill from `@color`. Card never\n * supplies the icon, so it depends on no icon set.\n *\n * A parent with `overflow: hidden` clips the part that overhangs the\n * corner.\n */\n indicator?: [];\n };\n Element: HTMLDivElement;\n}\n\nclass Card extends Component<CardSignature> {\n get classNames() {\n const { card } = useStyles();\n\n return card({\n variant: this.args.variant,\n color: this.args.color,\n density: this.args.density,\n elevation: this.args.elevation,\n isSelected: this.args.isSelected,\n isInteractive: this.args.isInteractive,\n isDisabled: this.args.isDisabled,\n class: this.args.class\n });\n }\n\n get indicatorClassNames() {\n const { cardIndicator } = useStyles();\n\n return cardIndicator({ color: this.args.color });\n }\n\n <template>\n <div\n class={{this.classNames}}\n data-component=\"card\"\n data-part=\"base\"\n data-selected={{@isSelected}}\n data-disabled={{@isDisabled}}\n ...attributes\n >\n {{yield}}\n {{#if @isSelected}}\n {{#if (has-block \"indicator\")}}\n <span\n class={{this.indicatorClassNames}}\n data-part=\"indicator\"\n aria-hidden=\"true\"\n >\n {{yield to=\"indicator\"}}\n </span>\n {{/if}}\n {{/if}}\n </div>\n </template>\n}\n\nexport { Card };\nexport default Card;\n"],"names":["Card","Component","classNames","card","useStyles","variant","args","color","density","elevation","isSelected","isInteractive","isDisabled","class","indicatorClassNames","cardIndicator","setComponentTemplate","precompileTemplate","strictMode"],"mappings":";;;;;AAkGA,MAAMA,aAAaC,SAAA,CAAU;EAC3B,IAAIC,UAAAA,GAAa;IACf,MAAM;AAAEC,MAAAA;KAAM,GAAGC,SAAA,EAAA;AAEjB,IAAA,OAAOD,IAAA,CAAK;AACVE,MAAAA,OAAA,EAAS,IAAI,CAACC,IAAI,CAACD,OAAO;AAC1BE,MAAAA,KAAA,EAAO,IAAI,CAACD,IAAI,CAACC,KAAK;AACtBC,MAAAA,OAAA,EAAS,IAAI,CAACF,IAAI,CAACE,OAAO;AAC1BC,MAAAA,SAAA,EAAW,IAAI,CAACH,IAAI,CAACG,SAAS;AAC9BC,MAAAA,UAAA,EAAY,IAAI,CAACJ,IAAI,CAACI,UAAU;AAChCC,MAAAA,aAAA,EAAe,IAAI,CAACL,IAAI,CAACK,aAAa;AACtCC,MAAAA,UAAA,EAAY,IAAI,CAACN,IAAI,CAACM,UAAU;AAChCC,MAAAA,KAAA,EAAO,IAAI,CAACP,IAAI,CAACO;AACnB,KAAA,CAAA;AACF,EAAA;EAEA,IAAIC,mBAAAA,GAAsB;IACxB,MAAM;AAAEC,MAAAA;KAAe,GAAGX,SAAA,EAAA;AAE1B,IAAA,OAAOW,aAAA,CAAc;AAAER,MAAAA,KAAA,EAAO,IAAI,CAACD,IAAI,CAACC;AAAM,KAAA,CAAA;AAChD,EAAA;AAEA,EAAA;IAAAS,oBAAA,CAAAC,kBAAA,CAAA,kZAAA,EAsBA;MAAAC,UAAA,EAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;"}