ember-primitives 0.48.2 → 0.49.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/declarations/components/portal.d.ts.map +1 -1
  2. package/declarations/tabster.d.ts.map +1 -1
  3. package/declarations/utils.d.ts.map +1 -1
  4. package/declarations/viewport/in-viewport.d.ts +70 -0
  5. package/declarations/viewport/in-viewport.d.ts.map +1 -0
  6. package/declarations/viewport/viewport.d.ts +59 -0
  7. package/declarations/viewport/viewport.d.ts.map +1 -0
  8. package/declarations/viewport.d.ts +3 -0
  9. package/declarations/viewport.d.ts.map +1 -0
  10. package/dist/-private.js +0 -1
  11. package/dist/-private.js.map +1 -1
  12. package/dist/color-scheme.js +0 -1
  13. package/dist/color-scheme.js.map +1 -1
  14. package/dist/{component-Bs3N-G9z.js → component-BXy_iafw.js} +2 -3
  15. package/dist/component-BXy_iafw.js.map +1 -0
  16. package/dist/components/accordion.js +5 -6
  17. package/dist/components/accordion.js.map +1 -1
  18. package/dist/components/avatar.js +3 -4
  19. package/dist/components/avatar.js.map +1 -1
  20. package/dist/components/dialog.js +2 -3
  21. package/dist/components/dialog.js.map +1 -1
  22. package/dist/components/external-link.js +1 -2
  23. package/dist/components/external-link.js.map +1 -1
  24. package/dist/components/form.js +1 -2
  25. package/dist/components/form.js.map +1 -1
  26. package/dist/components/heading.js +1 -2
  27. package/dist/components/heading.js.map +1 -1
  28. package/dist/components/keys.js +2 -3
  29. package/dist/components/keys.js.map +1 -1
  30. package/dist/components/layout/hero.js +1 -1
  31. package/dist/components/layout/sticky-footer.js +1 -1
  32. package/dist/components/link.js +1 -2
  33. package/dist/components/link.js.map +1 -1
  34. package/dist/components/menu.js +6 -8
  35. package/dist/components/menu.js.map +1 -1
  36. package/dist/components/one-time-password.js +1 -2
  37. package/dist/components/popover.js +3 -4
  38. package/dist/components/popover.js.map +1 -1
  39. package/dist/components/portal-targets.js +2 -3
  40. package/dist/components/portal-targets.js.map +1 -1
  41. package/dist/components/portal.js +3 -7
  42. package/dist/components/portal.js.map +1 -1
  43. package/dist/components/progress.js +2 -3
  44. package/dist/components/progress.js.map +1 -1
  45. package/dist/components/rating.js +1 -2
  46. package/dist/components/scroller.js +1 -2
  47. package/dist/components/scroller.js.map +1 -1
  48. package/dist/components/shadowed.js +2 -3
  49. package/dist/components/shadowed.js.map +1 -1
  50. package/dist/components/switch.js +5 -6
  51. package/dist/components/switch.js.map +1 -1
  52. package/dist/components/tabs.js +6 -7
  53. package/dist/components/tabs.js.map +1 -1
  54. package/dist/components/toggle-group.js +3 -4
  55. package/dist/components/toggle-group.js.map +1 -1
  56. package/dist/components/toggle.js +2 -3
  57. package/dist/components/toggle.js.map +1 -1
  58. package/dist/components/visually-hidden.js +1 -2
  59. package/dist/components/visually-hidden.js.map +1 -1
  60. package/dist/components/zoetrope.js +1 -2
  61. package/dist/dom-context.js +2 -3
  62. package/dist/dom-context.js.map +1 -1
  63. package/dist/floating-ui.js +1 -2
  64. package/dist/head.js +1 -2
  65. package/dist/head.js.map +1 -1
  66. package/dist/helpers/body-class.js +0 -1
  67. package/dist/helpers/body-class.js.map +1 -1
  68. package/dist/helpers/link.js +0 -1
  69. package/dist/helpers/link.js.map +1 -1
  70. package/dist/helpers/service.js +0 -1
  71. package/dist/helpers/service.js.map +1 -1
  72. package/dist/helpers.js +0 -1
  73. package/dist/helpers.js.map +1 -1
  74. package/dist/iframe.js +0 -1
  75. package/dist/iframe.js.map +1 -1
  76. package/dist/{index-DKE67I8L.js → index-gRO4Cvlf.js} +2 -2
  77. package/dist/index-gRO4Cvlf.js.map +1 -0
  78. package/dist/index.js +3 -4
  79. package/dist/index.js.map +1 -1
  80. package/dist/load.js +0 -1
  81. package/dist/load.js.map +1 -1
  82. package/dist/narrowing.js +0 -1
  83. package/dist/narrowing.js.map +1 -1
  84. package/dist/on-resize.js +0 -1
  85. package/dist/on-resize.js.map +1 -1
  86. package/dist/{otp-C6hCCXKx.js → otp-7rz1PWP0.js} +6 -7
  87. package/dist/otp-7rz1PWP0.js.map +1 -0
  88. package/dist/proper-links.js +0 -1
  89. package/dist/proper-links.js.map +1 -1
  90. package/dist/qp.js +0 -1
  91. package/dist/qp.js.map +1 -1
  92. package/dist/{rating-D052JWRa.js → rating-CjBVsX6q.js} +5 -6
  93. package/dist/rating-CjBVsX6q.js.map +1 -0
  94. package/dist/resize-observer.js +0 -1
  95. package/dist/resize-observer.js.map +1 -1
  96. package/dist/service.js +0 -1
  97. package/dist/service.js.map +1 -1
  98. package/dist/store.js +0 -1
  99. package/dist/store.js.map +1 -1
  100. package/dist/styles.css.js +0 -1
  101. package/dist/tabster.js +0 -1
  102. package/dist/tabster.js.map +1 -1
  103. package/dist/test-support.js +0 -1
  104. package/dist/test-support.js.map +1 -1
  105. package/dist/{utils-C5796IKA.js → utils-D0v9WKmV.js} +1 -2
  106. package/dist/utils-D0v9WKmV.js.map +1 -0
  107. package/dist/utils.js +4 -1
  108. package/dist/utils.js.map +1 -1
  109. package/dist/viewport/in-viewport.js +82 -0
  110. package/dist/viewport/in-viewport.js.map +1 -0
  111. package/dist/viewport/viewport.js +92 -0
  112. package/dist/viewport/viewport.js.map +1 -0
  113. package/dist/viewport.js +3 -0
  114. package/dist/viewport.js.map +1 -0
  115. package/package.json +20 -20
  116. package/dist/component-Bs3N-G9z.js.map +0 -1
  117. package/dist/index-DKE67I8L.js.map +0 -1
  118. package/dist/otp-C6hCCXKx.js.map +0 -1
  119. package/dist/rating-D052JWRa.js.map +0 -1
  120. package/dist/utils-C5796IKA.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"link.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
1
+ {"version":3,"file":"link.js","sources":["../../src/components/link.gts"],"sourcesContent":["/**\n * TODO: make template-only component,\n * and use class-based modifier?\n *\n * This would require that modifiers could run pre-render\n */\nimport { hash } from '@ember/helper';\nimport { on } from '@ember/modifier';\n\nimport { link } from '../helpers/link.ts';\nimport { ExternalLink } from './external-link.gts';\n\nimport type { TOC } from '@ember/component/template-only';\n\nexport interface Signature {\n Element: HTMLAnchorElement;\n Args: {\n /**\n * the `href` string value to set on the anchor element.\n */\n href: string;\n /**\n * When calculating the \"active\" state of the link, you may decide\n * whether or not you want to _require_ that all query params be considered (true)\n * or specify individual query params, ignoring anything not specified.\n *\n * For example:\n *\n * ```gjs live preview\n * import { Link } from 'ember-primitives';\n *\n * <template>\n * <Link @href=\"/\" @includeActiveQueryParams={{true}} as |a|>\n * ...\n * </Link>\n * </template>\n * ```\n *\n * the data-active state here will only be \"true\" on\n * - `/`\n * - `/?foo=2`\n * - `/?foo=&bar=`\n *\n */\n includeActiveQueryParams?: true | string[];\n /**\n * When calculating the \"active\" state of the link, you may decide\n * whether or not you want to consider sub paths to be active when\n * child routes/urls are active.\n *\n * For example:\n *\n * ```gjs live preview\n * import { Link } from 'ember-primitives';\n *\n * <template>\n * <Link @href=\"/forum/1\" @activeOnSubPaths={{true}} as |a|>\n * ...\n * </Link>\n * </template>\n * ```\n *\n * the data-active state here will be \"true\" on\n * - `/forum/1`\n * - `/forum/1/posts`\n * - `/forum/1/posts/comments`\n * - `/forum/1/*etc*`\n *\n * if `@activeOnSubPaths` is set to false or left off\n * the data-active state here will only be \"true\" on\n * - `/forum/1`\n *\n */\n activeOnSubPaths?: true;\n };\n Blocks: {\n default: [\n {\n /**\n * Indicates if the passed `href` is pointing to an external site.\n * Useful if you want your links to have additional context for when\n * a user is about to leave your site.\n *\n * For example:\n *\n * ```gjs live preview\n * import { Link } from 'ember-primitives';\n *\n * const MyLink = <template>\n * <Link @href={{@href}} as |a|>\n * {{yield}}\n * {{#if a.isExternal}}\n * ➚\n * {{/if}}\n * </Link>\n * </template>;\n *\n * <template>\n * <MyLink @href=\"https://developer.mozilla.org\">MDN</MyLink> &nbsp;&nbsp;\n * <MyLink @href=\"/\">Home</MyLink>\n * </template>\n * ```\n */\n isExternal: boolean;\n /**\n * Indicates if the passed `href` is *active*, or the user is on the same basepath.\n * This allows consumers to style their link if they wish or style their text.\n * The active state will also be present on a `data-active` attribute on the generated anchor tag.\n *\n *\n * For example\n * ```gjs\n * import { Link, service } from 'ember-primitives';\n *\n * const MyLink = <template>\n * <Link @href=\"...\"> as |a|>\n * <span class=\"{{if a.isActive 'underline'}}\">\n * {{yield}}\n * </span>\n * </Link>\n * </template>\n *\n * <template>\n * {{#let (service 'router') as |router|}}\n * <MyLink @href={{router.currentURL}}>Ths page</MyLink> &nbsp;&nbsp;\n * <MyLink @href=\"/\">Home</MyLink>\n * {{/let}}\n * </template>\n * ```\n *\n * By default, the query params are omitted from `isActive` calculation, but you may\n * configure the query params to be included if you wish\n * See: `@includeActiveQueryParams`\n *\n * By default, only the exact route/url is considered for the `isActive` calculation,\n * but you may configure sub routes/paths to also be considered active\n * See: `@activeOnSubPaths`\n *\n * Note that external links are never active.\n */\n isActive: boolean;\n },\n ];\n };\n}\n\n/**\n * A light wrapper around the [Anchor element][mdn-a], which will appropriately make your link an external link if the passed `@href` is not on the same domain.\n *\n *\n * [mdn-a]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a\n */\nexport const Link: TOC<Signature> = <template>\n {{#let (link @href includeActiveQueryParams=@includeActiveQueryParams activeOnSubPaths=@activeOnSubPaths) as |l|}}\n {{#if l.isExternal}}\n <ExternalLink href={{@href}} ...attributes>\n {{yield (hash isExternal=true isActive=false)}}\n </ExternalLink>\n {{else}}\n <a\n data-active={{l.isActive}}\n href={{if @href @href \"##missing##\"}}\n {{on \"click\" l.handleClick}}\n ...attributes\n >\n {{yield (hash isExternal=false isActive=l.isActive)}}\n </a>\n {{/if}}\n {{/let}}\n</template>;\n\nexport default Link;\n"],"names":["Link","setComponentTemplate","precompileTemplate","strictMode","scope","link","ExternalLink","hash","on","templateOnly"],"mappings":";;;;;;;;AAAA;;;;;AAKC;AA6ID;;;;;AAKC;MACYA,IAAU,GAAAC,oBAAA,CAAaC,kBAAA,CAAA,0eAAA,EAiBpC;EAAAC,UAAA,EAAA,IAAA;AAAAC,EAAAA,KAAA,EAAAA,OAAA;IAAAC,IAAA;IAAAC,YAAA;IAAAC,IAAA;AAAAC,IAAAA;AAAA,GAAA;AAAU,CAAA,CAAA,EAAAC,YAAA,EAAA;;;;"}
@@ -1,4 +1,3 @@
1
-
2
1
  import Component from '@glimmer/component';
3
2
  import { hash } from '@ember/helper';
4
3
  import { on } from '@ember/modifier';
@@ -22,7 +21,7 @@ const TABSTER_CONFIG_CONTENT = getTabsterAttribute({
22
21
  const TABSTER_CONFIG_TRIGGER = {
23
22
  deloser: {}
24
23
  };
25
- const Separator = setComponentTemplate(precompileTemplate("\n <div role=\"separator\" ...attributes>\n {{yield}}\n </div>\n", {
24
+ const Separator = setComponentTemplate(precompileTemplate("<div role=\"separator\" ...attributes>\n {{yield}}\n</div>", {
26
25
  strictMode: true
27
26
  }), templateOnly());
28
27
  /**
@@ -42,14 +41,14 @@ function focusOnHover(e) {
42
41
  item?.focus();
43
42
  }
44
43
  }
45
- const Item = setComponentTemplate(precompileTemplate("\n {{!-- @glint-expect-error --}}\n {{#let (if @onSelect (modifier on \"click\" @onSelect)) as |maybeClick|}}\n <button type=\"button\" role=\"menuitem\" {{!-- @glint-expect-error --}} {{maybeClick}} {{on \"click\" @toggle}} {{on \"pointermove\" focusOnHover}} ...attributes>\n {{yield}}\n </button>\n {{/let}}\n", {
44
+ const Item = setComponentTemplate(precompileTemplate("{{!-- @glint-expect-error --}}\n{{#let (if @onSelect (modifier on \"click\" @onSelect)) as |maybeClick|}}\n <button type=\"button\" role=\"menuitem\" {{!-- @glint-expect-error --}} {{maybeClick}} {{on \"click\" @toggle}} {{on \"pointermove\" focusOnHover}} ...attributes>\n {{yield}}\n </button>\n{{/let}}", {
46
45
  strictMode: true,
47
46
  scope: () => ({
48
47
  on,
49
48
  focusOnHover
50
49
  })
51
50
  }), templateOnly());
52
- const LinkItem = setComponentTemplate(precompileTemplate("\n <Link role=\"menuitem\" @href={{@href}} @includeActiveQueryParams={{@includeActiveQueryParams}} @activeOnSubPaths={{@activeOnSubPaths}} {{on \"click\" @toggle}} {{on \"pointermove\" focusOnHover}} ...attributes>\n {{yield}}\n </Link>\n", {
51
+ const LinkItem = setComponentTemplate(precompileTemplate("<Link role=\"menuitem\" @href={{@href}} @includeActiveQueryParams={{@includeActiveQueryParams}} @activeOnSubPaths={{@activeOnSubPaths}} {{on \"click\" @toggle}} {{on \"pointermove\" focusOnHover}} ...attributes>\n {{yield}}\n</Link>", {
53
52
  strictMode: true,
54
53
  scope: () => ({
55
54
  Link,
@@ -86,7 +85,7 @@ const installContent = modifier((element, _, {
86
85
  document.removeEventListener("keydown", onDocumentKeydown);
87
86
  };
88
87
  });
89
- const Content = setComponentTemplate(precompileTemplate("\n {{#if @isOpen.current}}\n <@PopoverContent id={{@contentId}} role=\"menu\" data-tabster={{TABSTER_CONFIG_CONTENT}} tabindex=\"0\" {{installContent isOpen=@isOpen triggerElement=@triggerElement}} ...attributes>\n {{yield (hash Item=(component Item toggle=@isOpen.toggle) LinkItem=(component LinkItem toggle=@isOpen.toggle) Separator=Separator)}}\n </@PopoverContent>\n {{/if}}\n", {
88
+ const Content = setComponentTemplate(precompileTemplate("{{#if @isOpen.current}}\n <@PopoverContent id={{@contentId}} role=\"menu\" data-tabster={{TABSTER_CONFIG_CONTENT}} tabindex=\"0\" {{installContent isOpen=@isOpen triggerElement=@triggerElement}} ...attributes>\n {{yield (hash Item=(component Item toggle=@isOpen.toggle) LinkItem=(component LinkItem toggle=@isOpen.toggle) Separator=Separator)}}\n </@PopoverContent>\n{{/if}}", {
90
89
  strictMode: true,
91
90
  scope: () => ({
92
91
  TABSTER_CONFIG_CONTENT,
@@ -125,13 +124,12 @@ const trigger = modifier((element, _, {
125
124
  };
126
125
  element.addEventListener("click", onTriggerClick);
127
126
  triggerElement.current = element;
128
- // eslint-disable-next-line @typescript-eslint/no-unsafe-call
129
127
  setReference(element);
130
128
  return () => {
131
129
  element.removeEventListener("click", onTriggerClick);
132
130
  };
133
131
  });
134
- const Trigger = setComponentTemplate(precompileTemplate("\n <button type=\"button\" {{@triggerModifier stopPropagation=@stopPropagation preventDefault=@preventDefault}} ...attributes>\n {{yield}}\n </button>\n", {
132
+ const Trigger = setComponentTemplate(precompileTemplate("<button type=\"button\" {{@triggerModifier stopPropagation=@stopPropagation preventDefault=@preventDefault}} ...attributes>\n {{yield}}\n</button>", {
135
133
  strictMode: true
136
134
  }), templateOnly());
137
135
  const IsOpen = () => cell(false);
@@ -139,7 +137,7 @@ const TriggerElement = () => cell();
139
137
  class Menu extends Component {
140
138
  contentId = guidFor(this);
141
139
  static {
142
- setComponentTemplate(precompileTemplate("\n {{#let (IsOpen) (TriggerElement) as |isOpen triggerEl|}}\n <Popover @flipOptions={{@flipOptions}} @middleware={{@middleware}} @offsetOptions={{@offsetOptions}} @placement={{@placement}} @shiftOptions={{@shiftOptions}} @strategy={{@strategy}} @inline={{@inline}} as |p|>\n {{#let (modifier trigger triggerElement=triggerEl isOpen=isOpen contentId=this.contentId setReference=p.setReference) as |triggerModifier|}}\n {{yield (hash trigger=triggerModifier Trigger=(component Trigger triggerModifier=triggerModifier) Content=(component Content PopoverContent=p.Content isOpen=isOpen triggerElement=triggerEl contentId=this.contentId) arrow=p.arrow isOpen=isOpen.current)}}\n {{/let}}\n </Popover>\n {{/let}}\n ", {
140
+ setComponentTemplate(precompileTemplate("{{#let (IsOpen) (TriggerElement) as |isOpen triggerEl|}}\n <Popover @flipOptions={{@flipOptions}} @middleware={{@middleware}} @offsetOptions={{@offsetOptions}} @placement={{@placement}} @shiftOptions={{@shiftOptions}} @strategy={{@strategy}} @inline={{@inline}} as |p|>\n {{#let (modifier trigger triggerElement=triggerEl isOpen=isOpen contentId=this.contentId setReference=p.setReference) as |triggerModifier|}}\n {{yield (hash trigger=triggerModifier Trigger=(component Trigger triggerModifier=triggerModifier) Content=(component Content PopoverContent=p.Content isOpen=isOpen triggerElement=triggerEl contentId=this.contentId) arrow=p.arrow isOpen=isOpen.current)}}\n {{/let}}\n </Popover>\n{{/let}}", {
143
141
  strictMode: true,
144
142
  scope: () => ({
145
143
  IsOpen,
@@ -1 +1 @@
1
- {"version":3,"file":"menu.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
1
+ {"version":3,"file":"menu.js","sources":["../../src/components/menu.gts"],"sourcesContent":["import Component from \"@glimmer/component\";\nimport { hash } from \"@ember/helper\";\nimport { on } from \"@ember/modifier\";\nimport { guidFor } from \"@ember/object/internals\";\n\nimport { modifier as eModifier } from \"ember-modifier\";\nimport { cell } from \"ember-resources\";\nimport { getTabster, getTabsterAttribute, MoverDirections, setTabsterAttribute } from \"tabster\";\n\nimport { Link, type Signature as LinkSignature } from \"./link.gts\";\nimport { Popover, type Signature as PopoverSignature } from \"./popover.gts\";\n\nimport type { TOC } from \"@ember/component/template-only\";\nimport type { WithBoundArgs } from \"@glint/template\";\n\ntype Cell<V> = ReturnType<typeof cell<V>>;\ntype LinkArgs = LinkSignature[\"Args\"];\ntype PopoverArgs = PopoverSignature[\"Args\"];\ntype PopoverBlockParams = PopoverSignature[\"Blocks\"][\"default\"][0];\n\nconst TABSTER_CONFIG_CONTENT = getTabsterAttribute(\n {\n mover: {\n direction: MoverDirections.Both,\n cyclic: true,\n },\n deloser: {},\n },\n true,\n);\n\nconst TABSTER_CONFIG_TRIGGER = {\n deloser: {},\n};\n\nexport interface Signature {\n Args: PopoverArgs;\n Blocks: {\n default: [\n {\n arrow: PopoverBlockParams[\"arrow\"];\n trigger: WithBoundArgs<\n typeof trigger,\n \"triggerElement\" | \"contentId\" | \"isOpen\" | \"setReference\"\n >;\n Trigger: WithBoundArgs<typeof Trigger, \"triggerModifier\">;\n Content: WithBoundArgs<\n typeof Content,\n \"triggerElement\" | \"contentId\" | \"isOpen\" | \"PopoverContent\"\n >;\n isOpen: boolean;\n },\n ];\n };\n}\n\nexport interface SeparatorSignature {\n Element: HTMLDivElement;\n Blocks: { default: [] };\n}\n\nconst Separator: TOC<SeparatorSignature> = <template>\n <div role=\"separator\" ...attributes>\n {{yield}}\n </div>\n</template>;\n\n/**\n * We focus items on `pointerMove` to achieve the following:\n *\n * - Mouse over an item (it focuses)\n * - Leave mouse where it is and use keyboard to focus a different item\n * - Wiggle mouse without it leaving previously focused item\n * - Previously focused item should re-focus\n *\n * If we used `mouseOver`/`mouseEnter` it would not re-focus when the mouse\n * wiggles. This is to match native menu implementation.\n */\nfunction focusOnHover(e: PointerEvent) {\n const item = e.currentTarget;\n\n if (item instanceof HTMLElement) {\n item?.focus();\n }\n}\n\ninterface PrivateItemSignature {\n Element: HTMLButtonElement;\n Args: { onSelect?: (event: Event) => void; toggle: () => void };\n Blocks: { default: [] };\n}\n\nexport interface ItemSignature {\n Element: PrivateItemSignature[\"Element\"];\n Args: Omit<PrivateItemSignature[\"Args\"], \"toggle\">;\n Blocks: PrivateItemSignature[\"Blocks\"];\n}\n\nconst Item: TOC<PrivateItemSignature> = <template>\n {{! @glint-expect-error }}\n {{#let (if @onSelect (modifier on \"click\" @onSelect)) as |maybeClick|}}\n <button\n type=\"button\"\n role=\"menuitem\"\n {{! @glint-expect-error }}\n {{maybeClick}}\n {{on \"click\" @toggle}}\n {{on \"pointermove\" focusOnHover}}\n ...attributes\n >\n {{yield}}\n </button>\n {{/let}}\n</template>;\n\ninterface LinkItemArgs extends LinkArgs {\n toggle: () => void;\n}\n\ninterface PrivateLinkItemSignature {\n Element: HTMLAnchorElement;\n Args: LinkItemArgs;\n Blocks: { default: [] };\n}\n\nexport interface LinkItemSignature {\n Element: PrivateLinkItemSignature[\"Element\"];\n Args: LinkArgs;\n Blocks: PrivateLinkItemSignature[\"Blocks\"];\n}\n\nconst LinkItem: TOC<PrivateLinkItemSignature> = <template>\n <Link\n role=\"menuitem\"\n @href={{@href}}\n @includeActiveQueryParams={{@includeActiveQueryParams}}\n @activeOnSubPaths={{@activeOnSubPaths}}\n {{on \"click\" @toggle}}\n {{on \"pointermove\" focusOnHover}}\n ...attributes\n >\n {{yield}}\n </Link>\n</template>;\n\nconst installContent = eModifier<{\n Element: HTMLElement;\n Args: {\n Named: {\n isOpen: Cell<boolean>;\n triggerElement: Cell<HTMLElement>;\n };\n };\n}>((element, _: [], { isOpen, triggerElement }) => {\n // focus first focusable element on the content\n const tabster = getTabster(window);\n const firstFocusable = tabster?.focusable.findFirst({\n container: element,\n });\n\n firstFocusable?.focus();\n\n // listen for \"outside\" clicks\n function onDocumentClick(e: MouseEvent) {\n if (\n isOpen.current &&\n e.target &&\n !element.contains(e.target as HTMLElement) &&\n !triggerElement.current?.contains(e.target as HTMLElement)\n ) {\n isOpen.current = false;\n }\n }\n\n // listen for the escape key\n function onDocumentKeydown(e: KeyboardEvent) {\n if (isOpen.current && e.key === \"Escape\") {\n isOpen.current = false;\n }\n }\n\n document.addEventListener(\"click\", onDocumentClick);\n document.addEventListener(\"keydown\", onDocumentKeydown);\n\n return () => {\n document.removeEventListener(\"click\", onDocumentClick);\n document.removeEventListener(\"keydown\", onDocumentKeydown);\n };\n});\n\ninterface PrivateContentSignature {\n Element: HTMLDivElement;\n Args: {\n triggerElement: Cell<HTMLElement>;\n contentId: string;\n isOpen: Cell<boolean>;\n PopoverContent: PopoverBlockParams[\"Content\"];\n };\n Blocks: {\n default: [\n {\n Item: WithBoundArgs<typeof Item, \"toggle\">;\n LinkItem: WithBoundArgs<typeof LinkItem, \"toggle\">;\n Separator: typeof Separator;\n },\n ];\n };\n}\n\nexport interface ContentSignature {\n Element: PrivateContentSignature[\"Element\"];\n Blocks: PrivateContentSignature[\"Blocks\"];\n}\n\nconst Content: TOC<PrivateContentSignature> = <template>\n {{#if @isOpen.current}}\n <@PopoverContent\n id={{@contentId}}\n role=\"menu\"\n data-tabster={{TABSTER_CONFIG_CONTENT}}\n tabindex=\"0\"\n {{installContent isOpen=@isOpen triggerElement=@triggerElement}}\n ...attributes\n >\n {{yield\n (hash\n Item=(component Item toggle=@isOpen.toggle)\n LinkItem=(component LinkItem toggle=@isOpen.toggle)\n Separator=Separator\n )\n }}\n </@PopoverContent>\n {{/if}}\n</template>;\n\ninterface PrivateTriggerModifierSignature {\n Element: HTMLElement;\n Args: {\n Named: {\n triggerElement: Cell<HTMLElement>;\n isOpen: Cell<boolean>;\n contentId: string;\n setReference: PopoverBlockParams[\"setReference\"];\n stopPropagation?: boolean;\n preventDefault?: boolean;\n };\n };\n}\n\nexport interface TriggerModifierSignature {\n Element: PrivateTriggerModifierSignature[\"Element\"];\n}\n\nconst trigger = eModifier<PrivateTriggerModifierSignature>(\n (\n element,\n _: [],\n { triggerElement, isOpen, contentId, setReference, stopPropagation, preventDefault },\n ) => {\n element.setAttribute(\"aria-haspopup\", \"menu\");\n\n if (isOpen.current) {\n element.setAttribute(\"aria-controls\", contentId);\n element.setAttribute(\"aria-expanded\", \"true\");\n } else {\n element.removeAttribute(\"aria-controls\");\n element.setAttribute(\"aria-expanded\", \"false\");\n }\n\n setTabsterAttribute(element, TABSTER_CONFIG_TRIGGER);\n\n const onTriggerClick = (event: MouseEvent) => {\n if (stopPropagation) {\n event.stopPropagation();\n }\n\n if (preventDefault) {\n event.preventDefault();\n }\n\n isOpen.toggle();\n };\n\n element.addEventListener(\"click\", onTriggerClick);\n\n triggerElement.current = element;\n\n setReference(element);\n\n return () => {\n element.removeEventListener(\"click\", onTriggerClick);\n };\n },\n);\n\ninterface PrivateTriggerSignature {\n Element: HTMLButtonElement;\n Args: {\n triggerModifier: WithBoundArgs<\n typeof trigger,\n \"triggerElement\" | \"contentId\" | \"isOpen\" | \"setReference\"\n >;\n stopPropagation?: boolean;\n preventDefault?: boolean;\n };\n Blocks: { default: [] };\n}\n\nexport interface TriggerSignature {\n Element: PrivateTriggerSignature[\"Element\"];\n Blocks: PrivateTriggerSignature[\"Blocks\"];\n}\n\nconst Trigger: TOC<PrivateTriggerSignature> = <template>\n <button\n type=\"button\"\n {{@triggerModifier stopPropagation=@stopPropagation preventDefault=@preventDefault}}\n ...attributes\n >\n {{yield}}\n </button>\n</template>;\n\nconst IsOpen = () => cell<boolean>(false);\nconst TriggerElement = () => cell<HTMLElement>();\n\nexport class Menu extends Component<Signature> {\n contentId = guidFor(this);\n\n <template>\n {{#let (IsOpen) (TriggerElement) as |isOpen triggerEl|}}\n <Popover\n @flipOptions={{@flipOptions}}\n @middleware={{@middleware}}\n @offsetOptions={{@offsetOptions}}\n @placement={{@placement}}\n @shiftOptions={{@shiftOptions}}\n @strategy={{@strategy}}\n @inline={{@inline}}\n as |p|\n >\n {{#let\n (modifier\n trigger\n triggerElement=triggerEl\n isOpen=isOpen\n contentId=this.contentId\n setReference=p.setReference\n )\n as |triggerModifier|\n }}\n {{yield\n (hash\n trigger=triggerModifier\n Trigger=(component Trigger triggerModifier=triggerModifier)\n Content=(component\n Content\n PopoverContent=p.Content\n isOpen=isOpen\n triggerElement=triggerEl\n contentId=this.contentId\n )\n arrow=p.arrow\n isOpen=isOpen.current\n )\n }}\n {{/let}}\n </Popover>\n {{/let}}\n </template>\n}\n\nexport default Menu;\n"],"names":["TABSTER_CONFIG_CONTENT","getTabsterAttribute","mover","direction","MoverDirections","Both","cyclic","deloser","TABSTER_CONFIG_TRIGGER","Separator","setComponentTemplate","precompileTemplate","strictMode","templateOnly","focusOnHover","e","item","currentTarget","HTMLElement","focus","Item","scope","on","LinkItem","Link","installContent","eModifier","element","_","isOpen","triggerElement","tabster","getTabster","window","firstFocusable","focusable","findFirst","container","onDocumentClick","current","target","contains","onDocumentKeydown","key","document","addEventListener","removeEventListener","Content","hash","trigger","contentId","setReference","stopPropagation","preventDefault","setAttribute","removeAttribute","setTabsterAttribute","onTriggerClick","event","toggle","Trigger","IsOpen","cell","TriggerElement","Menu","Component","guidFor","Popover"],"mappings":";;;;;;;;;;;;;AAoBA,MAAMA,yBAAyBC,mBAAA,CAC7B;AACEC,EAAAA,KAAA,EAAO;IACLC,SAAA,EAAWC,gBAAgBC,IAAI;AAC/BC,IAAAA,MAAA,EAAQ;GACV;AACAC,EAAAA,OAAA,EAAS;AACX,CAAA,EACA,IAAA,CAAA;AAG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CAAA;AAExB,EAAA;IAAAxD,oBAAA,CAAAC,kBAAA,CAAA,6sBAAA,EAwCA;MAAAC,UAAA,EAAA,IAAA;AAAAS,MAAAA,KAAA,EAAAA,OAAA;QAAAwC,MAAA;QAAAE,cAAA;QAAAI,OAAA;QAAAlB,OAAA;QAAAD,IAAA;QAAAY,OAAA;AAAAb,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
@@ -1,3 +1,2 @@
1
-
2
- export { a as OTP, O as OTPInput } from '../otp-C6hCCXKx.js';
1
+ export { a as OTP, O as OTPInput } from '../otp-7rz1PWP0.js';
3
2
  //# sourceMappingURL=one-time-password.js.map
@@ -1,10 +1,9 @@
1
-
2
1
  import { hash } from '@ember/helper';
3
2
  import { arrow } from '@floating-ui/dom';
4
3
  import { element } from 'ember-element-helper';
5
4
  import { modifier } from 'ember-modifier';
6
5
  import { cell } from 'ember-resources';
7
- import { F as FloatingUI } from '../component-Bs3N-G9z.js';
6
+ import { F as FloatingUI } from '../component-BXy_iafw.js';
8
7
  import { Portal } from './portal.js';
9
8
  import { TARGETS } from './portal-targets.js';
10
9
  import { precompileTemplate } from '@ember/template-compilation';
@@ -18,7 +17,7 @@ function getElementTag(tagName) {
18
17
  * Allows lazy evaluation of the portal target (do nothing until rendered)
19
18
  * This is useful because the algorithm for finding the portal target isn't cheap.
20
19
  */
21
- const Content = setComponentTemplate(precompileTemplate("\n {{#let (element (getElementTag @as)) as |El|}}\n {{#if @inline}}\n {{!-- @glint-ignore\n https://github.com/tildeio/ember-element-helper/issues/91\n https://github.com/typed-ember/glint/issues/610\n --}}\n <El {{@floating}} ...attributes>\n {{yield}}\n </El>\n {{else}}\n <Portal @to={{TARGETS.popover}}>\n {{!-- @glint-ignore\n https://github.com/tildeio/ember-element-helper/issues/91\n https://github.com/typed-ember/glint/issues/610\n --}}\n <El {{@floating}} ...attributes>\n {{yield}}\n </El>\n </Portal>\n {{/if}}\n {{/let}}\n", {
20
+ const Content = setComponentTemplate(precompileTemplate("{{#let (element (getElementTag @as)) as |El|}}\n {{#if @inline}}\n {{!-- @glint-ignore\n https://github.com/tildeio/ember-element-helper/issues/91\n https://github.com/typed-ember/glint/issues/610\n --}}\n <El {{@floating}} ...attributes>\n {{yield}}\n </El>\n {{else}}\n <Portal @to={{TARGETS.popover}}>\n {{!-- @glint-ignore\n https://github.com/tildeio/ember-element-helper/issues/91\n https://github.com/typed-ember/glint/issues/610\n --}}\n <El {{@floating}} ...attributes>\n {{yield}}\n </El>\n </Portal>\n {{/if}}\n{{/let}}", {
22
21
  strictMode: true,
23
22
  scope: () => ({
24
23
  element,
@@ -81,7 +80,7 @@ function flipOptions(options) {
81
80
  ...options
82
81
  };
83
82
  }
84
- const Popover = setComponentTemplate(precompileTemplate("\n {{#let (ArrowElement) as |arrowElement|}}\n <FloatingUI @placement={{@placement}} @strategy={{@strategy}} @middleware={{maybeAddArrow @middleware arrowElement.current}} @flipOptions={{flipOptions @flipOptions}} @shiftOptions={{@shiftOptions}} @offsetOptions={{@offsetOptions}} as |reference floating extra|>\n {{#let (modifier attachArrow arrowElement=arrowElement data=extra.data) as |arrow|}}\n {{yield (hash reference=reference setReference=extra.setReference Content=(component Content floating=floating inline=@inline) data=extra.data arrow=arrow)}}\n {{/let}}\n </FloatingUI>\n {{/let}}\n", {
83
+ const Popover = setComponentTemplate(precompileTemplate("{{#let (ArrowElement) as |arrowElement|}}\n <FloatingUI @placement={{@placement}} @strategy={{@strategy}} @middleware={{maybeAddArrow @middleware arrowElement.current}} @flipOptions={{flipOptions @flipOptions}} @shiftOptions={{@shiftOptions}} @offsetOptions={{@offsetOptions}} as |reference floating extra|>\n {{#let (modifier attachArrow arrowElement=arrowElement data=extra.data) as |arrow|}}\n {{yield (hash reference=reference setReference=extra.setReference Content=(component Content floating=floating inline=@inline) data=extra.data arrow=arrow)}}\n {{/let}}\n </FloatingUI>\n{{/let}}", {
85
84
  strictMode: true,
86
85
  scope: () => ({
87
86
  ArrowElement,
@@ -1 +1 @@
1
- {"version":3,"file":"popover.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
1
+ {"version":3,"file":"popover.js","sources":["../../src/components/popover.gts"],"sourcesContent":["import { hash } from \"@ember/helper\";\n\nimport { arrow } from \"@floating-ui/dom\";\nimport { element } from \"ember-element-helper\";\nimport { modifier as eModifier } from \"ember-modifier\";\nimport { cell } from \"ember-resources\";\n\nimport { FloatingUI } from \"../floating-ui.ts\";\nimport { Portal } from \"./portal.gts\";\nimport { TARGETS } from \"./portal-targets.gts\";\n\nimport type { Signature as FloatingUiComponentSignature } from \"../floating-ui/component.ts\";\nimport type { Signature as HookSignature } from \"../floating-ui/modifier.ts\";\nimport type { TOC } from \"@ember/component/template-only\";\nimport type { ElementContext, Middleware } from \"@floating-ui/dom\";\nimport type { ModifierLike, WithBoundArgs } from \"@glint/template\";\n\nexport interface Signature {\n Args: {\n /**\n * See the Floating UI's [flip docs](https://floating-ui.com/docs/flip) for possible values.\n *\n * This argument is forwarded to the `<FloatingUI>` component.\n */\n flipOptions?: HookSignature[\"Args\"][\"Named\"][\"flipOptions\"];\n /**\n * Array of one or more objects to add to Floating UI's list of [middleware](https://floating-ui.com/docs/middleware)\n *\n * This argument is forwarded to the `<FloatingUI>` component.\n */\n middleware?: HookSignature[\"Args\"][\"Named\"][\"middleware\"];\n /**\n * See the Floating UI's [offset docs](https://floating-ui.com/docs/offset) for possible values.\n *\n * This argument is forwarded to the `<FloatingUI>` component.\n */\n offsetOptions?: HookSignature[\"Args\"][\"Named\"][\"offsetOptions\"];\n /**\n * One of the possible [`placements`](https://floating-ui.com/docs/computeposition#placement). The default is 'bottom'.\n *\n * Possible values are\n * - top\n * - bottom\n * - right\n * - left\n *\n * And may optionally have `-start` or `-end` added to adjust position along the side.\n *\n * This argument is forwarded to the `<FloatingUI>` component.\n */\n placement?: `${\"top\" | \"bottom\" | \"left\" | \"right\"}${\"\" | \"-start\" | \"-end\"}`;\n /**\n * See the Floating UI's [shift docs](https://floating-ui.com/docs/shift) for possible values.\n *\n * This argument is forwarded to the `<FloatingUI>` component.\n */\n shiftOptions?: HookSignature[\"Args\"][\"Named\"][\"shiftOptions\"];\n /**\n * CSS position property, either `fixed` or `absolute`.\n *\n * Pros and cons of each strategy are explained on [Floating UI's Docs](https://floating-ui.com/docs/computePosition#strategy)\n *\n * This argument is forwarded to the `<FloatingUI>` component.\n */\n strategy?: HookSignature[\"Args\"][\"Named\"][\"strategy\"];\n\n /**\n * By default, the popover is portaled.\n * If you don't control your CSS, and the positioning of the popover content\n * is misbehaving, you may pass \"@inline={{true}}\" to opt out of portalling.\n *\n * Inline may also be useful in nested menus, where you know exactly how the nesting occurs\n */\n inline?: boolean;\n };\n Blocks: {\n default: [\n {\n reference: FloatingUiComponentSignature[\"Blocks\"][\"default\"][0];\n setReference: FloatingUiComponentSignature[\"Blocks\"][\"default\"][2][\"setReference\"];\n Content: WithBoundArgs<typeof Content, \"floating\">;\n data: FloatingUiComponentSignature[\"Blocks\"][\"default\"][2][\"data\"];\n arrow: ModifierLike<{ Element: HTMLElement }>;\n },\n ];\n };\n}\n\nfunction getElementTag(tagName: undefined | string) {\n return tagName || \"div\";\n}\n\n/**\n * Allows lazy evaluation of the portal target (do nothing until rendered)\n * This is useful because the algorithm for finding the portal target isn't cheap.\n */\nconst Content: TOC<{\n Element: HTMLDivElement;\n Args: {\n floating: ModifierLike<{ Element: HTMLElement }>;\n inline?: boolean;\n /**\n * By default the popover content is wrapped in a div.\n * You may change this by supplying the name of an element here.\n *\n * For example:\n * ```gjs\n * <Popover as |p|>\n * <p.Content @as=\"dialog\">\n * this is now focus trapped\n * </p.Content>\n * </Popover>\n * ```\n */\n as?: string;\n };\n Blocks: { default: [] };\n}> = <template>\n {{#let (element (getElementTag @as)) as |El|}}\n {{#if @inline}}\n {{! @glint-ignore\n https://github.com/tildeio/ember-element-helper/issues/91\n https://github.com/typed-ember/glint/issues/610\n }}\n <El {{@floating}} ...attributes>\n {{yield}}\n </El>\n {{else}}\n <Portal @to={{TARGETS.popover}}>\n {{! @glint-ignore\n https://github.com/tildeio/ember-element-helper/issues/91\n https://github.com/typed-ember/glint/issues/610\n }}\n <El {{@floating}} ...attributes>\n {{yield}}\n </El>\n </Portal>\n {{/if}}\n {{/let}}\n</template>;\n\ninterface AttachArrowSignature {\n Element: HTMLElement;\n Args: {\n Named: {\n arrowElement: ReturnType<typeof ArrowElement>;\n data:\n | undefined\n | {\n placement: string;\n middlewareData?: {\n arrow?: { x?: number; y?: number };\n };\n };\n };\n };\n}\n\nconst arrowSides = {\n top: \"bottom\",\n right: \"left\",\n bottom: \"top\",\n left: \"right\",\n};\n\ntype Direction = \"top\" | \"bottom\" | \"left\" | \"right\";\ntype Placement = `${Direction}${\"\" | \"-start\" | \"-end\"}`;\n\nconst attachArrow: ModifierLike<AttachArrowSignature> = eModifier<AttachArrowSignature>(\n (element, _: [], named) => {\n if (element === named.arrowElement.current) {\n if (!named.data) return;\n if (!named.data.middlewareData) return;\n\n const { arrow } = named.data.middlewareData;\n const { placement } = named.data;\n\n if (!arrow) return;\n if (!placement) return;\n\n const { x: arrowX, y: arrowY } = arrow;\n const otherSide = (placement as Placement).split(\"-\")[0] as Direction;\n const staticSide = arrowSides[otherSide];\n\n Object.assign(named.arrowElement.current.style, {\n left: arrowX != null ? `${arrowX}px` : \"\",\n top: arrowY != null ? `${arrowY}px` : \"\",\n right: \"\",\n bottom: \"\",\n [staticSide]: \"-4px\",\n });\n\n return;\n }\n\n void (async () => {\n await Promise.resolve();\n named.arrowElement.set(element);\n })();\n },\n);\n\nconst ArrowElement: () => ReturnType<typeof cell<HTMLElement>> = () => cell<HTMLElement>();\n\nfunction maybeAddArrow(middleware: Middleware[] | undefined, element: Element | undefined) {\n const result = [...(middleware || [])];\n\n if (element) {\n result.push(arrow({ element }));\n }\n\n return result;\n}\n\nfunction flipOptions(options: HookSignature[\"Args\"][\"Named\"][\"flipOptions\"]) {\n return {\n elementContext: \"reference\" as ElementContext,\n ...options,\n };\n}\n\nexport const Popover: TOC<Signature> = <template>\n {{#let (ArrowElement) as |arrowElement|}}\n <FloatingUI\n @placement={{@placement}}\n @strategy={{@strategy}}\n @middleware={{maybeAddArrow @middleware arrowElement.current}}\n @flipOptions={{flipOptions @flipOptions}}\n @shiftOptions={{@shiftOptions}}\n @offsetOptions={{@offsetOptions}}\n as |reference floating extra|\n >\n {{#let (modifier attachArrow arrowElement=arrowElement data=extra.data) as |arrow|}}\n {{yield\n (hash\n reference=reference\n setReference=extra.setReference\n Content=(component Content floating=floating inline=@inline)\n data=extra.data\n arrow=arrow\n )\n }}\n {{/let}}\n </FloatingUI>\n {{/let}}\n</template>;\n\nexport default Popover;\n"],"names":["getElementTag","tagName","Content","setComponentTemplate","precompileTemplate","strictMode","scope","element","Portal","TARGETS","templateOnly","arrowSides","top","right","bottom","left","attachArrow","eModifier","_","named","arrowElement","current","data","middlewareData","arrow","placement","x","arrowX","y","arrowY","otherSide","split","staticSide","Object","assign","style","Promise","resolve","set","ArrowElement","cell","maybeAddArrow","middleware","result","push","flipOptions","options","elementContext","Popover","FloatingUI","hash"],"mappings":";;;;;;;;;;;;AAwFA,SAASA,aAAAA,CAAcC,OAA2B,EAAA;EAChD,OAAOA,OAAA,IAAW,KAAA;AACpB;AAEA;;;AAGC;AACD,MAAMC,OAqBD,GAAAC,oBAAA,CAAAC,kBAAA,CAAA,inBAAA,EAsBL;EAAAC,UAAA,EAAA,IAAA;AAAAC,EAAAA,KAAA,EAAAA,OAAA;IAAAC,OAAA;IAAAP,aAAA;IAAAQ,MAAA;AAAAC,IAAAA;AAAA,GAAA;AAAU,CAAA,CAAA,EAAAC,YAAA,EAAA,CAAA;AAmBV,MAAMC,UAAA,GAAa;AACjBC,EAAAA,GAAA,EAAK,QAAA;AACLC,EAAAA,KAAA,EAAO,MAAA;AACPC,EAAAA,MAAA,EAAQ,KAAA;AACRC,EAAAA,IAAA,EAAM;AACR,CAAA;AAKA,MAAMC,WAA0B,GAAwBC,SACtD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C,YAAsC,GAAqBA,MAAMC,IAAA,EAAK;AAE5E,SAASC,cAAcC,UAAoC,EAAEnC,OAA4B,EAAA;EACvF,MAAMoC,MAAA,GAAS,CAAI,IAACD,cAAc,EAAE,CAAA,CAAE;AAEtC,EAAA,IAAInC,OAAA,EAAS;AACXoC,IAAAA,MAAA,CAAOC,IAAI,CAACpB,KAAA,CAAM;AAAEjB,MAAAA;AAAQ,KAAA,CAAA,CAAA;AAC9B,EAAA;AAEA,EAAA,OAAOoC,MAAA;AACT;AAEA,SAASE,WAAAA,CAAYC,OAAsD,EAAA;EACzE,OAAO;AACLC,IAAAA,cAAA,EAAgB,WAAe;IAC/B,GAAGD;GACL;AACF;MAEaE,OAAa,GAAA7C,oBAAA,CAAaC,kBAAA,CAAA,8lBAAA,EAwBvC;EAAAC,UAAA,EAAA,IAAA;AAAAC,EAAAA,KAAA,EAAAA,OAAA;IAAAiC,YAAA;IAAAU,UAAA;IAAAR,aAAA;IAAAI,WAAA;IAAA7B,WAAA;IAAAkC,IAAA;AAAAhD,IAAAA;AAAA,GAAA;AAAU,CAAA,CAAA,EAAAQ,YAAA,EAAA;;;;"}
@@ -1,4 +1,3 @@
1
-
2
1
  import { assert } from '@ember/debug';
3
2
  import { macroCondition, isDevelopingApp } from '@embroider/macros';
4
3
  import { modifier } from 'ember-modifier';
@@ -72,7 +71,7 @@ const register = modifier((element, [name]) => {
72
71
  cache.delete(name);
73
72
  };
74
73
  });
75
- const PortalTargets = setComponentTemplate(precompileTemplate("\n <div data-portal-name={{TARGETS.popover}}></div>\n <div data-portal-name={{TARGETS.tooltip}}></div>\n <div data-portal-name={{TARGETS.modal}}></div>\n", {
74
+ const PortalTargets = setComponentTemplate(precompileTemplate("<div data-portal-name={{TARGETS.popover}}></div>\n<div data-portal-name={{TARGETS.tooltip}}></div>\n<div data-portal-name={{TARGETS.modal}}></div>", {
76
75
  strictMode: true,
77
76
  scope: () => ({
78
77
  TARGETS
@@ -81,7 +80,7 @@ const PortalTargets = setComponentTemplate(precompileTemplate("\n <div data-por
81
80
  /**
82
81
  * For manually registering a PortalTarget for use with Portal
83
82
  */
84
- const PortalTarget = setComponentTemplate(precompileTemplate("\n <div {{register @name}} ...attributes></div>\n", {
83
+ const PortalTarget = setComponentTemplate(precompileTemplate("<div {{register @name}} ...attributes></div>", {
85
84
  strictMode: true,
86
85
  scope: () => ({
87
86
  register
@@ -1 +1 @@
1
- {"version":3,"file":"portal-targets.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
1
+ {"version":3,"file":"portal-targets.js","sources":["../../src/components/portal-targets.gts"],"sourcesContent":["import { assert } from \"@ember/debug\";\nimport { isDevelopingApp, macroCondition } from \"@embroider/macros\";\n\nimport { modifier } from \"ember-modifier\";\nimport { TrackedMap, TrackedSet } from \"tracked-built-ins\";\n\nimport type { TOC } from \"@ember/component/template-only\";\n\nconst cache = new TrackedMap<string, Set<Element>>();\n\nexport const TARGETS = Object.freeze({\n popover: \"ember-primitives__portal-targets__popover\",\n tooltip: \"ember-primitives__portal-targets__tooltip\",\n modal: \"ember-primitives__portal-targets__modal\",\n});\n\nexport function findNearestTarget(origin: Element, name: string): Element | undefined {\n assert(`first argument to \\`findNearestTarget\\` must be an element`, origin instanceof Element);\n assert(`second argument to \\`findNearestTarget\\` must be a string`, typeof name === `string`);\n\n let element: Element | undefined | null = null;\n\n let parent = origin.parentNode;\n\n const manuallyRegisteredSet = cache.get(name);\n const manuallyRegistered: Element[] | null = manuallyRegisteredSet?.size\n ? [...manuallyRegisteredSet]\n : null;\n\n /**\n * For use with <PortalTarget @name=\"hi\" />\n */\n function findRegistered(host: ParentNode): Element | undefined {\n return manuallyRegistered?.find((element) => {\n if (host.contains(element)) {\n return element;\n }\n });\n }\n\n const selector = Object.values(TARGETS as Record<string, string>).includes(name)\n ? `[data-portal-name=${name}]`\n : name;\n\n /**\n * Default portals / non-registered -- here we match a query selector instead of an element\n */\n function findDefault(host: ParentNode): Element | undefined {\n return host.querySelector(selector) as Element;\n }\n\n const finder = manuallyRegistered ? findRegistered : findDefault;\n\n /**\n * Crawl up the ancestry looking for our portal target\n */\n while (!element && parent) {\n element = finder(parent);\n if (element) break;\n parent = parent.parentNode;\n }\n\n if (macroCondition(isDevelopingApp())) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n (window as any).prime0 = origin;\n }\n\n if (name.startsWith(\"ember-primitives\")) {\n assert(\n `Could not find element by the given name: \\`${name}\\`.` +\n ` The known names are ` +\n `${Object.values(TARGETS).join(\", \")} ` +\n `-- but any name will work as long as it is set to the \\`data-portal-name\\` attribute ` +\n `(or if the name has been specifically registered via the <PortalTarget /> component). ` +\n `Double check that the element you're wanting to portal to is rendered. ` +\n `The element passed to \\`findNearestTarget\\` is stored on \\`window.prime0\\` ` +\n `You can debug in your browser's console via ` +\n `\\`document.querySelector('[data-portal-name=\"${name}\"]')\\``,\n element,\n );\n }\n\n return element ?? undefined;\n}\n\nconst register = modifier((element: Element, [name]: [name: string]) => {\n assert(`@name is required when using <PortalTarget>`, name);\n\n void (async () => {\n // Bad TypeScript lint.\n // eslint-disable-next-line @typescript-eslint/await-thenable\n await 0;\n\n let existing = cache.get(name);\n\n if (!existing) {\n existing = new TrackedSet<Element>();\n cache.set(name, existing);\n }\n\n existing.add(element);\n })();\n\n return () => {\n cache.delete(name);\n };\n});\n\nexport interface Signature {\n Element: null;\n}\n\nexport const PortalTargets: TOC<Signature> = <template>\n <div data-portal-name={{TARGETS.popover}}></div>\n <div data-portal-name={{TARGETS.tooltip}}></div>\n <div data-portal-name={{TARGETS.modal}}></div>\n</template>;\n\n/**\n * For manually registering a PortalTarget for use with Portal\n */\nexport const PortalTarget: TOC<{\n Element: HTMLDivElement;\n Args: {\n /**\n * The name of the PortalTarget\n *\n * This exact string may be passed to `Portal`'s `@to` argument.\n */\n name: string;\n };\n}> = <template>\n <div {{register @name}} ...attributes></div>\n</template>;\n\nexport default PortalTargets;\n"],"names":["cache","TrackedMap","TARGETS","Object","freeze","popover","tooltip","modal","findNearestTarget","origin","name","assert","Element","element","parent","parentNode","manuallyRegisteredSet","get","manuallyRegistered","size","findRegistered","host","find","contains","selector","values","includes","findDefault","querySelector","finder","macroCondition","isDevelopingApp","window","prime0","startsWith","join","undefined","register","modifier","existing","TrackedSet","set","add","delete","PortalTargets","setComponentTemplate","precompileTemplate","strictMode","scope","templateOnly","PortalTarget"],"mappings":";;;;;;;;AAQA,MAAMA,KAAA,GAAQ,IAAIC,UAAA,EAAuB;MAE5BC,OAAA,GAAUC,MAAA,CAAOC,MAAM,CAAC;AACnCC,EAAAA,OAAA,EAAS,2CAAA;AACTC,EAAAA,OAAA,EAAS,2CAAA;AACTC,EAAAA,KAAA,EAAO;AACT,CAAA;AAEO,SAASC,kBAAkBC,MAAe,EAAEC,IAAY,EAAsB;AACnFC,EAAAA,MAAA,CAAO,CAAA,0DAAA,CAA4D,EAAEF,MAAA,YAAkBG,OAAA,CAAA;AACvFD,EAAAA,MAAA,CAAO,CAAA,yDAAA,CAA2D,EAAE,OAAOD,IAAA,KAAS,QAAQ,CAAA;EAE5F,IAAIG,OAAmC,GAAG,IAAA;AAE1C,EAAA,IAAIC,MAAA,GAASL,OAAOM,UAAU;AAE9B,EAAA,MAAMC,qBAAA,GAAwBhB,KAAA,CAAMiB,GAAG,CAACP,IAAA,CAAA;EACxC,MAAMQ,kBAAoC,GAAGF,uBAAuBG,IAAA,GAChE,CAAI,GAAAH,qBAAA,CAAsB,GAC1B,IAAA;AAEJ;;AAEC;EACD,SAASI,cAAAA,CAAeC,IAAgB,EAAsB;AAC5D,IAAA,OAAOH,kBAAA,EAAoBI,KAAMT,OAAA,IAAA;AAC/B,MAAA,IAAIQ,IAAA,CAAKE,QAAQ,CAACV,OAAA,CAAA,EAAU;AAC1B,QAAA,OAAOA,OAAA;AACT,MAAA;AACF,IAAA,CAAA,CAAA;AACF,EAAA;AAEA,EAAA,MAAMW,WAAWrB,MAAA,CAAOsB,MAAM,CAACvB,SAAmCwB,QAAQ,CAAChB,QACv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IAAA,MAAM,CAAA;AAEN,IAAA,IAAI6B,QAAA,GAAWvC,KAAA,CAAMiB,GAAG,CAACP,IAAA,CAAA;IAEzB,IAAI,CAAC6B,QAAA,EAAU;AACbA,MAAAA,QAAA,GAAW,IAAIC,UAAA,EAAW;AAC1BxC,MAAAA,KAAA,CAAMyC,GAAG,CAAC/B,IAAA,EAAM6B,QAAA,CAAA;AAClB,IAAA;AAEAA,IAAAA,QAAA,CAASG,GAAG,CAAC7B,OAAA,CAAA;AACf,EAAA,CAAC,GAAA;AAED,EAAA,OAAO,MAAA;AACLb,IAAAA,KAAA,CAAM2C,MAAM,CAACjC,IAAA,CAAA;EACf,CAAA;AACF,CAAA,CAAA;MAMakC,aAAmB,GAAAC,oBAAA,CAAaC,kBAAA,CAAA,oJAAA,EAI7C;EAAAC,UAAA,EAAA,IAAA;AAAAC,EAAAA,KAAA,EAAAA,OAAA;AAAA9C,IAAAA;AAAA,GAAA;AAAU,CAAA,CAAA,EAAA+C,YAAA,EAAA;AAEV;;;MAGaC,oCAURJ,kBAAA,CAAA,8CAAA,EAEL;EAAAC,UAAA,EAAA,IAAA;AAAAC,EAAAA,KAAA,EAAAA,OAAA;AAAAX,IAAAA;AAAA,GAAA;AAAU,CAAA,CAAA,EAAAY,YAAA,EAAA;;;;"}
@@ -1,4 +1,3 @@
1
-
2
1
  import { assert } from '@ember/debug';
3
2
  import { schedule } from '@ember/runloop';
4
3
  import { buildWaiter } from '@ember/test-waiters';
@@ -10,7 +9,6 @@ import { precompileTemplate } from '@ember/template-compilation';
10
9
  import { setComponentTemplate } from '@ember/component';
11
10
  import templateOnly from '@ember/component/template-only';
12
11
 
13
- /* eslint-disable @typescript-eslint/no-redundant-type-constituents */
14
12
  /**
15
13
  * Polyfill for ember-wormhole behavior
16
14
  *
@@ -38,9 +36,7 @@ function wormhole(query) {
38
36
  return found;
39
37
  }
40
38
  const anchor = modifier((element, [to, update]) => {
41
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call
42
39
  const found = findNearestTarget(element, to);
43
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
44
40
  update(found);
45
41
  });
46
42
  const ElementValue = () => cell();
@@ -62,7 +58,7 @@ function wormholeCompat(selector) {
62
58
  });
63
59
  }
64
60
  resourceFactory(wormholeCompat);
65
- const Portal = setComponentTemplate(precompileTemplate("\n {{#if (isElement @to)}}\n <ToElement @to={{@to}} @append={{@append}}>\n {{yield}}\n </ToElement>\n {{else if @wormhole}}\n {{#let (wormholeCompat @wormhole) as |target|}}\n {{#if target}}\n {{#in-element target insertBefore=null}}\n {{yield}}\n {{/in-element}}\n {{/if}}\n {{/let}}\n {{else if @to}}\n <Nestable @to={{@to}} @append={{@append}}>\n {{yield}}\n </Nestable>\n {{else}}\n {{assert \"either @to or @wormhole is required. Received neither\"}}\n {{/if}}\n", {
61
+ const Portal = setComponentTemplate(precompileTemplate("{{#if (isElement @to)}}\n <ToElement @to={{@to}} @append={{@append}}>\n {{yield}}\n </ToElement>\n{{else if @wormhole}}\n {{#let (wormholeCompat @wormhole) as |target|}}\n {{#if target}}\n {{#in-element target insertBefore=null}}\n {{yield}}\n {{/in-element}}\n {{/if}}\n {{/let}}\n{{else if @to}}\n <Nestable @to={{@to}} @append={{@append}}>\n {{yield}}\n </Nestable>\n{{else}}\n {{assert \"either @to or @wormhole is required. Received neither\"}}\n{{/if}}", {
66
62
  strictMode: true,
67
63
  scope: () => ({
68
64
  isElement,
@@ -72,10 +68,10 @@ const Portal = setComponentTemplate(precompileTemplate("\n {{#if (isElement @to
72
68
  assert
73
69
  })
74
70
  }), templateOnly());
75
- const ToElement = setComponentTemplate(precompileTemplate("\n {{#if @append}}\n {{#in-element @to insertBefore=null}}\n {{yield}}\n {{/in-element}}\n {{else}}\n {{#in-element @to}}\n {{yield}}\n {{/in-element}}\n {{/if}}\n", {
71
+ const ToElement = setComponentTemplate(precompileTemplate("{{#if @append}}\n {{#in-element @to insertBefore=null}}\n {{yield}}\n {{/in-element}}\n{{else}}\n {{#in-element @to}}\n {{yield}}\n {{/in-element}}\n{{/if}}", {
76
72
  strictMode: true
77
73
  }), templateOnly());
78
- const Nestable = setComponentTemplate(precompileTemplate("\n {{#let (ElementValue) as |target|}}\n {{!-- This div is always going to be empty,\n because it'll either find the portal and render content elsewhere,\n it it won't find the portal and won't render anything.\n --}}\n {{!-- template-lint-disable no-inline-styles --}}\n <div style=\"display:contents;\" {{anchor @to target.set}}>\n {{#if target.current}}\n {{#if @append}}\n {{#in-element target.current insertBefore=null}}\n {{yield}}\n {{/in-element}}\n {{else}}\n {{#in-element target.current}}\n {{yield}}\n {{/in-element}}\n {{/if}}\n {{/if}}\n </div>\n {{/let}}\n", {
74
+ const Nestable = setComponentTemplate(precompileTemplate("{{#let (ElementValue) as |target|}}\n {{!-- This div is always going to be empty,\n because it'll either find the portal and render content elsewhere,\n it it won't find the portal and won't render anything.\n --}}\n {{!-- template-lint-disable no-inline-styles --}}\n <div style=\"display:contents;\" {{anchor @to target.set}}>\n {{#if target.current}}\n {{#if @append}}\n {{#in-element target.current insertBefore=null}}\n {{yield}}\n {{/in-element}}\n {{else}}\n {{#in-element target.current}}\n {{yield}}\n {{/in-element}}\n {{/if}}\n {{/if}}\n </div>\n{{/let}}", {
79
75
  strictMode: true,
80
76
  scope: () => ({
81
77
  ElementValue,
@@ -1 +1 @@
1
- {"version":3,"file":"portal.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
1
+ {"version":3,"file":"portal.js","sources":["../../src/components/portal.gts"],"sourcesContent":["import { assert } from \"@ember/debug\";\nimport { schedule } from \"@ember/runloop\";\nimport { buildWaiter } from \"@ember/test-waiters\";\n\nimport { modifier } from \"ember-modifier\";\nimport { cell, resource, resourceFactory } from \"ember-resources\";\n\nimport { isElement } from \"../narrowing.ts\";\nimport { findNearestTarget, type TARGETS } from \"./portal-targets.gts\";\n\nimport type { TOC } from \"@ember/component/template-only\";\n\ntype Targets = (typeof TARGETS)[keyof typeof TARGETS];\n\ninterface ToSignature {\n Args: {\n to: string;\n append?: boolean;\n };\n Blocks: {\n default: [];\n };\n}\ninterface ElementSignature {\n Args: {\n to: Element;\n append?: boolean;\n };\n Blocks: {\n default: [];\n };\n}\n\nexport interface Signature {\n Args: {\n /**\n * The name of the PortalTarget to render in to.\n * This is the value of the `data-portal-name` attribute\n * of the element you wish to render in to.\n *\n * This can also be an Element which pairs nicely with query-utilities such as the platform-native `querySelector`\n */\n to?: (Targets | (string & {})) | Element;\n\n /**\n * Set to true to append to the portal instead of replace\n *\n * Default: false\n */\n append?: boolean;\n /**\n * For ember-wormhole style behavior, this argument may be an id,\n * or a selector.\n * This can also be an element, in which case the behavior is identical to `@to`\n */\n wormhole?: string | Element;\n };\n Blocks: {\n /**\n * The portaled content\n */\n default: [];\n };\n}\n\n/**\n * Polyfill for ember-wormhole behavior\n *\n * Example usage:\n * ```gjs\n * import { wormhole, Portal } from 'ember-primitives/components/portal';\n *\n * <template>\n * <div id=\"the-portal\"></div>\n *\n * <Portal @to={{wormhole \"the-portal\"}}>\n * content renders in the above div\n * </Portal>\n * </template>\n *\n * ```\n */\nexport function wormhole(query: string | null | undefined | Element) {\n assert(`Expected query/element to be truthy.`, query);\n\n if (isElement(query)) {\n return query;\n }\n\n let found = document.getElementById(query);\n\n found ??= document.querySelector(query);\n\n return found;\n}\n\nconst anchor = modifier(\n (element: Element, [to, update]: [string, ReturnType<typeof ElementValue>[\"set\"]]) => {\n const found = findNearestTarget(element, to);\n\n update(found);\n },\n);\n\nconst ElementValue = () => cell<Element | ShadowRoot | null | undefined>();\n\nconst waiter = buildWaiter(\"ember-primitives:portal\");\n\nfunction wormholeCompat(selector: string | Element) {\n const target = wormhole(selector);\n\n if (target) return target;\n\n return resource(() => {\n const target = cell<Element | undefined | null>();\n\n const token = waiter.beginAsync();\n\n // eslint-disable-next-line ember/no-runloop\n schedule(\"afterRender\", () => {\n const result = wormhole(selector);\n\n waiter.endAsync(token);\n target.current = result;\n assert(\n `Could not find element with id/selector \\`${typeof selector === \"string\" ? selector : \"<Element>\"}\\``,\n result,\n );\n });\n\n return () => target.current;\n });\n}\n\nresourceFactory(wormholeCompat);\n\nexport const Portal: TOC<Signature> = <template>\n {{#if (isElement @to)}}\n <ToElement @to={{@to}} @append={{@append}}>\n {{yield}}\n </ToElement>\n {{else if @wormhole}}\n {{#let (wormholeCompat @wormhole) as |target|}}\n {{#if target}}\n {{#in-element target insertBefore=null}}\n {{yield}}\n {{/in-element}}\n {{/if}}\n {{/let}}\n {{else if @to}}\n <Nestable @to={{@to}} @append={{@append}}>\n {{yield}}\n </Nestable>\n {{else}}\n {{assert \"either @to or @wormhole is required. Received neither\"}}\n {{/if}}\n</template>;\n\nconst ToElement: TOC<ElementSignature> = <template>\n {{#if @append}}\n {{#in-element @to insertBefore=null}}\n {{yield}}\n {{/in-element}}\n {{else}}\n {{#in-element @to}}\n {{yield}}\n {{/in-element}}\n {{/if}}\n</template>;\n\nconst Nestable: TOC<ToSignature> = <template>\n {{#let (ElementValue) as |target|}}\n {{! This div is always going to be empty,\n because it'll either find the portal and render content elsewhere,\n it it won't find the portal and won't render anything.\n }}\n {{! template-lint-disable no-inline-styles }}\n <div style=\"display:contents;\" {{anchor @to target.set}}>\n {{#if target.current}}\n {{#if @append}}\n {{#in-element target.current insertBefore=null}}\n {{yield}}\n {{/in-element}}\n {{else}}\n {{#in-element target.current}}\n {{yield}}\n {{/in-element}}\n {{/if}}\n {{/if}}\n </div>\n {{/let}}\n</template>;\n\nexport default Portal;\n"],"names":["wormhole","query","assert","isElement","found","document","getElementById","querySelector","anchor","modifier","element","to","update","findNearestTarget","ElementValue","cell","waiter","buildWaiter","wormholeCompat","selector","target","resource","token","beginAsync","schedule","result","endAsync","current","resourceFactory","Portal","setComponentTemplate","precompileTemplate","strictMode","scope","ToElement","Nestable","templateOnly"],"mappings":";;;;;;;;;;;AAiEA;;;;;;;;;;;;;;;;;AAiBO,SAASA,QAAAA,CAASC,KAA0C,EAAA;AACjEC,EA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AC7B,EAAA,CAAA,CAAA;AACF;AAEAC,eAAA,CAAgBV,cAAA,CAAA;MAEHW,MAAY,GAAAC,oBAAA,CAAaC,kBAAA,CAAA,gfAAA,EAoBtC;EAAAC,UAAA,EAAA,IAAA;AAAAC,EAAAA,KAAA,EAAAA,OAAA;IAAA9B,SAAA;IAAA+B,SAAA;IAAAhB,cAAA;IAAAiB,QAAA;AAAAjC,IAAAA;AAAA,GAAA;AAAU,CAAA,CAAA,EAAAkC,YAAA,EAAA;AAEV,MAAMF,SAAe,GAAAJ,oBAAA,CAAoBC,kBAAA,CAAA,wKAAA,EAUzC;EAAAC,UAAA,EAAA;AAAU,CAAA,CAAA,EAAAI,YAAA,EAAA,CAAA;AAEV,MAAMD,QAAc,GAAAL,oBAAA,CAAeC,kBAAA,CAAA,+oBAAA,EAqBnC;EAAAC,UAAA,EAAA,IAAA;AAAAC,EAAAA,KAAA,EAAAA,OAAA;IAAAnB,YAAA;AAAAN,IAAAA;AAAA,GAAA;AAAU,CAAA,CAAA,EAAA4B,YAAA,EAAA,CAAA;;;;"}
@@ -1,4 +1,3 @@
1
-
2
1
  import Component from '@glimmer/component';
3
2
  import { hash } from '@ember/helper';
4
3
  import { precompileTemplate } from '@ember/template-compilation';
@@ -33,7 +32,7 @@ function getValue(userValue, maxValue) {
33
32
  function getValueLabel(value, max) {
34
33
  return `${Math.round(value / max * 100)}%`;
35
34
  }
36
- const Indicator = setComponentTemplate(precompileTemplate("\n <div ...attributes data-max={{@max}} data-value={{@value}} data-state={{progressState @value @max}} data-percent={{@percent}}>\n {{yield}}\n </div>\n", {
35
+ const Indicator = setComponentTemplate(precompileTemplate("<div ...attributes data-max={{@max}} data-value={{@value}} data-state={{progressState @value @max}} data-percent={{@percent}}>\n {{yield}}\n</div>", {
37
36
  strictMode: true,
38
37
  scope: () => ({
39
38
  progressState
@@ -56,7 +55,7 @@ class Progress extends Component {
56
55
  return Math.round(this.decimal * 100 * 100) / 100;
57
56
  }
58
57
  static {
59
- setComponentTemplate(precompileTemplate("\n <div ...attributes aria-valuemax={{this.max}} aria-valuemin=\"0\" aria-valuenow={{this.value}} aria-valuetext={{this.valueLabel}} role=\"progressbar\" data-value={{this.value}} data-state={{progressState this.value this.max}} data-max={{this.max}} data-min=\"0\" data-percent={{this.percent}}>\n\n {{yield (hash Indicator=(component Indicator value=this.value max=this.max percent=this.percent) value=this.value percent=this.percent decimal=this.decimal)}}\n </div>\n ", {
58
+ setComponentTemplate(precompileTemplate("<div ...attributes aria-valuemax={{this.max}} aria-valuemin=\"0\" aria-valuenow={{this.value}} aria-valuetext={{this.valueLabel}} role=\"progressbar\" data-value={{this.value}} data-state={{progressState this.value this.max}} data-max={{this.max}} data-min=\"0\" data-percent={{this.percent}}>\n\n {{yield (hash Indicator=(component Indicator value=this.value max=this.max percent=this.percent) value=this.value percent=this.percent decimal=this.decimal)}}\n</div>", {
60
59
  strictMode: true,
61
60
  scope: () => ({
62
61
  progressState,
@@ -1 +1 @@
1
- {"version":3,"file":"progress.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
1
+ {"version":3,"file":"progress.js","sources":["../../src/components/progress.gts"],"sourcesContent":["import Component from \"@glimmer/component\";\nimport { hash } from \"@ember/helper\";\n\nimport type { TOC } from \"@ember/component/template-only\";\nimport type { WithBoundArgs } from \"@glint/template\";\n\nexport interface Signature {\n Element: HTMLDivElement;\n Args: {\n /**\n * The current progress\n * This may be less than 0 or more than `max`,\n * but the resolved value (managed internally, and yielded out)\n * does not exceed the range [0, max]\n */\n value: number;\n /**\n * The max value, defaults to 100\n */\n max?: number;\n };\n Blocks: {\n default: [\n {\n /**\n * The indicator element with some state applied.\n * This can be used to style the progress of bar.\n */\n Indicator: WithBoundArgs<typeof Indicator, \"value\" | \"max\" | \"percent\">;\n /**\n * The value as a percent of how far along the indicator should be\n * positioned, between 0 and 100.\n * Will be rounded to two decimal places.\n */\n percent: number;\n /**\n * The value as a percent of how far along the indicator should be positioned,\n * between 0 and 1\n */\n decimal: number;\n /**\n * The resolved value within the limits of the progress bar.\n */\n value: number;\n },\n ];\n };\n}\n\ntype ProgressState = \"indeterminate\" | \"complete\" | \"loading\";\n\nconst DEFAULT_MAX = 100;\n\n/**\n * Non-negative, non-NaN, non-Infinite, positive, rational\n */\nfunction isValidProgressNumber(value: number | undefined | null): value is number {\n if (typeof value !== \"number\") return false;\n if (!Number.isFinite(value)) return false;\n\n return value >= 0;\n}\n\nfunction progressState(value: number | undefined | null, maxValue: number): ProgressState {\n return value == null ? \"indeterminate\" : value === maxValue ? \"complete\" : \"loading\";\n}\n\nfunction getMax(userMax: number | undefined | null): number {\n return isValidProgressNumber(userMax) ? userMax : DEFAULT_MAX;\n}\n\nfunction getValue(userValue: number | undefined | null, maxValue: number): number {\n const max = getMax(maxValue);\n\n if (!isValidProgressNumber(userValue)) {\n return 0;\n }\n\n if (userValue > max) {\n return max;\n }\n\n return userValue;\n}\n\nfunction getValueLabel(value: number, max: number) {\n return `${Math.round((value / max) * 100)}%`;\n}\n\nconst Indicator: TOC<{\n Element: HTMLDivElement;\n Args: { max: number; value: number; percent: number };\n Blocks: { default: [] };\n}> = <template>\n <div\n ...attributes\n data-max={{@max}}\n data-value={{@value}}\n data-state={{progressState @value @max}}\n data-percent={{@percent}}\n >\n {{yield}}\n </div>\n</template>;\n\nexport class Progress extends Component<Signature> {\n get max() {\n return getMax(this.args.max);\n }\n\n get value() {\n return getValue(this.args.value, this.max);\n }\n\n get valueLabel() {\n return getValueLabel(this.value, this.max);\n }\n\n get decimal() {\n return this.value / this.max;\n }\n\n get percent() {\n return Math.round(this.decimal * 100 * 100) / 100;\n }\n\n <template>\n <div\n ...attributes\n aria-valuemax={{this.max}}\n aria-valuemin=\"0\"\n aria-valuenow={{this.value}}\n aria-valuetext={{this.valueLabel}}\n role=\"progressbar\"\n data-value={{this.value}}\n data-state={{progressState this.value this.max}}\n data-max={{this.max}}\n data-min=\"0\"\n data-percent={{this.percent}}\n >\n\n {{yield\n (hash\n Indicator=(component Indicator value=this.value max=this.max percent=this.percent)\n value=this.value\n percent=this.percent\n decimal=this.decimal\n )\n }}\n </div>\n </template>\n}\n\nexport default Progress;\n"],"names":["DEFAULT_MAX","isValidProgressNumber","value","Number","isFinite","progressState","maxValue","getMax","userMax","getValue","userValue","max","getValueLabel","Math","round","Indicator","setComponentTemplate","precompileTemplate","strictMode","scope","templateOnly","Progress","Component","args","valueLabel","decimal","percent","hash"],"mappings":";;;;;;AAmDA,MAAMA,WAAA,GAAc,GAAA;AAEpB;;;AAGA,SAASC,qBAAAA,CAAsBC,KAAgC,EAAkB;AAC/E,EAAA,IAAI,OAAOA,KAAA,KAAU,QAAA,EAAU,OAAO,KAAA;EACtC,IAAI,CAACC,MAAA,CAAOC,QAAQ,CAACF,QAAQ,OAAO,KAAA;EAEpC,OAAOA,KAAA,IAAS,CAAA;AAClB;AAEA,SAASG,aAAAA,CAAcH,KAAgC,EAAEI,QAAgB,EAAG;AAC1E,EAAA,OAAOJ,KAAA,IAAS,IAAA,GAAO,eAAA,GAAkBA,KAAA,KAAUI,WAAW,UAAA,GAAa,SAAA;AAC7E;AAEA,SAASC,MAAAA,CAAOC,OAAkC,EAAS;AACzD,EAAA,OAAOP,qBAAA,CAAsBO,WAAWA,OAAA,GAAUR,WAAA;AACpD;AAEA,SAASS,QAAAA,CAASC,SAAoC,EAAEJ,QAAgB,EAAS;AAC/E,EAAA,MAAMK,MAAMJ,MAAA,CAAOD,QAAA,CAAA;AAEnB,EAAA,IAAI,CAACL,sBAAsBS,SAAA,CAAA,EAAY;AACrC,IAAA,OAAO,CAAA;AACT,EAAA;EAEA,IAAIA,YAAYC,GAAA,EAAK;AACnB,IAAA,OAAOA,GAAA;AACT,EAAA;AAEA,EAAA,OAAOD,SAAA;AACT;AAEA,SAASE,aAAAA,CAAcV,KAAa,EAAES,GAAW,EAAA;EAC/C,OAAO,CAAA,EAAGE,IAAA,CAAKC,KAAK,CAAEZ,KAAA,GAAQS,GAAG,GAAI,GAAA,CAAA,CAAA,CAAA,CAAO;AAC9C;AAEA,MAAMI,SAID,GAAAC,oBAAA,CAAAC,kBAAA,CAAA,qJAAA,EAUL;EAAAC,UAAA,EAAA,IAAA;AAAAC,EAAAA,KAAA,EAAAA,OAAA;AAAAd,IAAAA;AAAA,GAAA;AAAU,CAAA,CAAA,EAAAe,YAAA,EAAA,CAAA;AAEH,MAAMC,iBAAiBC,SAAA,CAAU;EACtC,IAAIX,GAAAA,GAAM;AACR,IAAA,OAAOJ,MAAA,CAAO,IAAI,CAACgB,IAAI,CAACZ,GAAG,CAAA;AAC7B,EAAA;EAEA,IAAIT,KAAAA,GAAQ;IACV,OAAOO,QAAA,CAAS,IAAI,CAACc,IAAI,CAACrB,KAAK,EAAE,IAAI,CAACS,GAAG,CAAA;AAC3C,EAAA;EAEA,IAAIa,UAAAA,GAAa;IACf,OAAOZ,cAAc,IAAI,CAACV,KAAK,EAAE,IAAI,CAACS,GAAG,CAAA;AAC3C,EAAA;EAEA,IAAIc,OAAAA,GAAU;AACZ,IAAA,OAAO,IAAI,CAACvB,KAAK,GAAG,IAAI,CAACS,GAAG;AAC9B,EAAA;EAEA,IAAIe,OAAAA,GAAU;AACZ,IAAA,OAAOb,IAAA,CAAKC,KAAK,CAAC,IAAI,CAACW,OAAO,GAAG,MAAM,GAAA,CAAA,GAAO,GAAA;AAChD,EAAA;AAEA,EAAA;IAAAT,oBAAA,CAAAC,kBAAA,CAAA,mdAAA,EAwBA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAd,aAAA;QAAAsB,IAAA;AAAAZ,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
@@ -1,3 +1,2 @@
1
-
2
- export { R as Rating } from '../rating-D052JWRa.js';
1
+ export { R as Rating } from '../rating-CjBVsX6q.js';
3
2
  //# sourceMappingURL=rating.js.map
@@ -1,4 +1,3 @@
1
-
2
1
  import Component from '@glimmer/component';
3
2
  import { isDestroyed, isDestroying } from '@ember/destroyable';
4
3
  import { hash } from '@ember/helper';
@@ -60,7 +59,7 @@ class Scroller extends Component {
60
59
  });
61
60
  };
62
61
  static {
63
- setComponentTemplate(precompileTemplate("\n <div tabindex=\"0\" ...attributes {{this.ref}}>\n {{yield (hash scrollToBottom=this.scrollToBottom scrollToTop=this.scrollToTop scrollToLeft=this.scrollToLeft scrollToRight=this.scrollToRight)}}\n </div>\n ", {
62
+ setComponentTemplate(precompileTemplate("<div tabindex=\"0\" ...attributes {{this.ref}}>\n {{yield (hash scrollToBottom=this.scrollToBottom scrollToTop=this.scrollToTop scrollToLeft=this.scrollToLeft scrollToRight=this.scrollToRight)}}\n</div>", {
64
63
  strictMode: true,
65
64
  scope: () => ({
66
65
  hash
@@ -1 +1 @@
1
- {"version":3,"file":"scroller.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
1
+ {"version":3,"file":"scroller.js","sources":["../../src/components/scroller.gts"],"sourcesContent":["import Component from \"@glimmer/component\";\nimport { isDestroyed, isDestroying } from \"@ember/destroyable\";\nimport { hash } from \"@ember/helper\";\n\nimport { modifier } from \"ember-modifier\";\n\n/**\n * Utility component for helping with scrolling in any direction within\n * any of the 4 directions: up, down, left, right.\n *\n * This can be used to auto-scroll content as new content is inserted into the scrollable area, or possibly to bring focus to something on the page.\n */\nexport class Scroller extends Component<{\n /**\n * A containing element is required - in this case, a div.\n * It must be scrollable for this component to work, but can be customized.\n *\n * By default, this element will have some styling applied:\n * overflow: auto;\n *\n * By default, this element will have tabindex=\"0\" to support keyboard usage.\n *\n * The scroll-behavior is \"auto\", which can be controlled via CSS\n * https://developer.mozilla.org/en-US/docs/Web/CSS/scroll-behavior\n *\n */\n Element: HTMLDivElement;\n Blocks: {\n default: [\n {\n /**\n * Scroll the content to the bottom\n *\n * ```gjs\n * import { Scroller } from 'ember-primitives';\n *\n * <template>\n * <Scroller as |s|>\n * ...\n *\n * {{ (s.scrollToBottom) }}\n * </Scroller>\n * </template>\n * ```\n */\n scrollToBottom: () => void;\n /**\n * Scroll the content to the top\n *\n * ```gjs\n * import { Scroller } from 'ember-primitives';\n *\n * <template>\n * <Scroller as |s|>\n * ...\n *\n * {{ (s.scrollToTop) }}\n * </Scroller>\n * </template>\n * ```\n */\n scrollToTop: () => void;\n /**\n * Scroll the content to the left\n *\n * ```gjs\n * import { Scroller } from 'ember-primitives';\n *\n * <template>\n * <Scroller as |s|>\n * ...\n *\n * {{ (s.scrollToLeft) }}\n * </Scroller>\n * </template>\n * ```\n */\n scrollToLeft: () => void;\n /**\n * Scroll the content to the right\n *\n * ```gjs\n * import { Scroller } from 'ember-primitives';\n *\n * <template>\n * <Scroller as |s|>\n * ...\n *\n * {{ (s.scrollToRight) }}\n * </Scroller>\n * </template>\n * ```\n */\n scrollToRight: () => void;\n },\n ];\n };\n}> {\n declare withinElement: HTMLDivElement;\n\n ref = modifier((el: HTMLDivElement) => {\n this.withinElement = el;\n });\n\n #frame?: number;\n\n scrollToBottom = () => {\n if (this.#frame) {\n cancelAnimationFrame(this.#frame);\n }\n\n this.#frame = requestAnimationFrame(() => {\n if (isDestroyed(this) || isDestroying(this)) return;\n\n this.withinElement.scrollTo({\n top: this.withinElement.scrollHeight,\n behavior: \"auto\",\n });\n });\n };\n\n scrollToTop = () => {\n if (this.#frame) {\n cancelAnimationFrame(this.#frame);\n }\n\n this.#frame = requestAnimationFrame(() => {\n if (isDestroyed(this) || isDestroying(this)) return;\n\n this.withinElement.scrollTo({\n top: 0,\n behavior: \"auto\",\n });\n });\n };\n\n scrollToLeft = () => {\n if (this.#frame) {\n cancelAnimationFrame(this.#frame);\n }\n\n this.#frame = requestAnimationFrame(() => {\n if (isDestroyed(this) || isDestroying(this)) return;\n\n this.withinElement.scrollTo({\n left: 0,\n behavior: \"auto\",\n });\n });\n };\n\n scrollToRight = () => {\n if (this.#frame) {\n cancelAnimationFrame(this.#frame);\n }\n\n this.#frame = requestAnimationFrame(() => {\n if (isDestroyed(this) || isDestroying(this)) return;\n\n this.withinElement.scrollTo({\n left: this.withinElement.scrollWidth,\n behavior: \"auto\",\n });\n });\n };\n\n <template>\n <div tabindex=\"0\" ...attributes {{this.ref}}>\n {{yield\n (hash\n scrollToBottom=this.scrollToBottom\n scrollToTop=this.scrollToTop\n scrollToLeft=this.scrollToLeft\n scrollToRight=this.scrollToRight\n )\n }}\n </div>\n </template>\n}\n"],"names":["Scroller","Component","ref","modifier","el","withinElement","scrollToBottom","cancelAnimationFrame","requestAnimationFrame","isDestroyed","isDestroying","scrollTo","top","scrollHeight","behavior","scrollToTop","scrollToLeft","left","scrollToRight","scrollWidth","setComponentTemplate","precompileTemplate","strictMode","scope","hash"],"mappings":";;;;;;;AAYO,MAAMA,QAAA,SAAiBC,SAAA;AAwF5BC,EAAAA,GAAA,GAAMC,QAAA,CAAUC,EAAI,IAAA;IAClB,IAAI,CAACC,aAAa,GAAGD,EAAA;AACvB,EAAA,CAAA,CAAA;AAEA,EAAA,MAAM;EAENE,cAAA,GAAiBA,MAAA;AACf,IAAA,IAAI,IAAI,CAAC,MAAM,EAAE;AACfC,MAAAA,oBAAA,CAAqB,IAAI,CAAC,MAAM,CAAA;AAClC,IAAA;AAEA,IAAA,IAAI,CAAC,MAAM,GAAGC,qBAAA,CAAsB,MAAA;MAClC,IAAIC,WAAA,CAAY,IAAI,CAAA,IAAKC,YAAA,CAAa,IAAI,CAAA,EAAG;AAE7C,MAAA,IAAI,CAACL,aAAa,CAACM,QAAQ,CAAC;AAC1BC,QAAAA,GAAA,EAAK,IAAI,CAACP,aAAa,CAACQ,YAAY;AACpCC,QAAAA,QAAA,EAAU;AACZ,OAAA,CAAA;AACF,IAAA,CAAA,CAAA;EACF,CAAA;EAEAC,WAAA,GAAcA,MAAA;AACZ,IAAA,IAAI,IAAI,CAAC,MAAM,EAAE;AACfR,MAAAA,oBAAA,CAAqB,IAAI,CAAC,MAAM,CAAA;AAClC,IAAA;AAEA,IAAA,IAAI,CAAC,MAAM,GAAGC,qBAAA,CAAsB,MAAA;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AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
@@ -1,4 +1,3 @@
1
-
2
1
  import Component from '@glimmer/component';
3
2
  import { precompileTemplate } from '@ember/template-compilation';
4
3
  import { setComponentTemplate } from '@ember/component';
@@ -11,7 +10,7 @@ const getStyles = () => [...document.querySelectorAll("link")].map(link => link.
11
10
  *
12
11
  * link is only valid in the head element.
13
12
  */
14
- const Styles = setComponentTemplate(precompileTemplate("\n <style>\n {{#each (getStyles) as |styleHref|}}\n\n @import \"{{styleHref}}\";\n\n {{/each}}\n </style>\n", {
13
+ const Styles = setComponentTemplate(precompileTemplate("<style>\n {{#each (getStyles) as |styleHref|}}\n\n @import \"{{styleHref}}\";\n\n {{/each}}\n</style>", {
15
14
  strictMode: true,
16
15
  scope: () => ({
17
16
  getStyles
@@ -64,7 +63,7 @@ class Shadowed extends Component {
64
63
  this.shadow = div;
65
64
  }
66
65
  static {
67
- setComponentTemplate(precompileTemplate("\n <div ...attributes>{{this.host}}</div>\n\n {{#in-element this.shadow}}\n\n {{#if @includeStyles}}\n <Styles />\n {{/if}}\n\n {{yield}}\n\n {{/in-element}}\n ", {
66
+ setComponentTemplate(precompileTemplate("<div ...attributes>{{this.host}}</div>\n\n{{#in-element this.shadow}}\n\n {{#if @includeStyles}}\n <Styles />\n {{/if}}\n\n {{yield}}\n\n{{/in-element}}", {
68
67
  strictMode: true,
69
68
  scope: () => ({
70
69
  Styles
@@ -1 +1 @@
1
- {"version":3,"file":"shadowed.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
1
+ {"version":3,"file":"shadowed.js","sources":["../../src/components/shadowed.gts"],"sourcesContent":["import Component from \"@glimmer/component\";\n\nimport type Owner from \"@ember/owner\";\n\n// index.html has the production-fingerprinted references to these links\n// Ideally, we'd have some pre-processor scan everything for references to\n// assets in public, but idk how to set that up\nconst getStyles = () => [...document.querySelectorAll(\"link\")].map((link) => link.href);\n\n/**\n * style + native @import\n * is the only robust way to load styles in a shadowroot.\n *\n * link is only valid in the head element.\n */\nconst Styles = <template>\n <style>\n {{#each (getStyles) as |styleHref|}}\n\n @import \"{{styleHref}}\";\n\n {{/each}}\n </style>\n</template>;\n\n/**\n * Render content in a shadow dom, attached to a div.\n *\n * Uses the [shadow DOM][mdn-shadow-dom] API.\n *\n * [mdn-shadow-dom]: https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_shadow_DOM\n *\n * This is useful when you want to render content that escapes your app's styles.\n */\nexport class Shadowed extends Component<{\n /**\n * The shadow dom attaches to a div element.\n * You may specify any attribute, and it'll be applied to this host element.\n */\n Element: HTMLDivElement;\n Args: {\n /**\n * @public\n *\n * By default, shadow-dom does not include any styles.\n * Setting this to true will include all the `<style>` tags\n * that are present in the `<head>` element.\n */\n includeStyles?: boolean;\n };\n Blocks: {\n /**\n * Content to be placed within the ShadowDOM\n */\n default: [];\n };\n}> {\n shadow: HTMLDivElement;\n host: HTMLDivElement;\n /**\n * ember-source 5.6 broke the ability to in-element\n * natively into a shadowroot.\n *\n * We have two or three more dives than we should have here.\n *\n *\n * See these ember-source bugs:\n * - https://github.com/emberjs/ember.js/issues/20643\n * - https://github.com/emberjs/ember.js/issues/20642\n * - https://github.com/emberjs/ember.js/issues/20641\n *\n * Ideally, shadowdom should be built in.\n * Couple paths forward:\n * - (as the overall template tag)\n * <template shadowrootmode=\"open\">\n * </template>\n *\n * - Build a component into the framework that does the above ^\n * - add additional parsing in content-tag to allow\n * nested <template>\n *\n */\n constructor(owner: Owner, args: { includeStyles?: boolean }) {\n super(owner, args);\n\n const element = document.createElement(\"div\");\n const shadowRoot = element.attachShadow({ mode: \"open\" });\n const div = document.createElement(\"div\");\n\n shadowRoot.appendChild(div);\n this.host = element;\n this.shadow = div;\n }\n\n <template>\n <div ...attributes>{{this.host}}</div>\n\n {{#in-element this.shadow}}\n\n {{#if @includeStyles}}\n <Styles />\n {{/if}}\n\n {{yield}}\n\n {{/in-element}}\n </template>\n}\n\nexport default Shadowed;\n"],"names":["getStyles","document","querySelectorAll","map","link","href","Styles","setComponentTemplate","precompileTemplate","strictMode","scope","templateOnly","Shadowed","Component","shadow","host","constructor","owner","args","element","createElement","shadowRoot","attachShadow","mode","div","appendChild"],"mappings":";;;;;AAOA,MAAMA,YAAYA,MAAM,CAAI,GAAAC,QAAA,CAASC,gBAAgB,CAAC,MAAA,CAAA,CAAQ,CAACC,GAAG,CAAEC,IAAA,IAASA,KAAKC,IAAI,CAAA;AAEtF;;;;;;AAMA,MAAMC,MAAA,GAAAC,oBAAA,CAASC,kBAAA,CAAA,4GAAA,EAQf;EAAAC,UAAA,EAAA,IAAA;AAAAC,EAAAA,KAAA,EAAAA,OAAA;AAAAV,IAAAA;AAAA,GAAA;AAAU,CAAA,CAAA,EAAAW,YAAA,EAAA,CAAA;AAEV;;;;;;;;;AASO,MAAMC,QAAA,SAAiBC,SAAA;EAuB5BC,MAAA;EACAC,IAAA;AACA;;;;;;;;;;;;;;;;;;;;;;;AAuBAC,EAAAA,WAAAA,CAAYC,KAAY,EAAEC,IAAiC,EAAE;AAC3D,IAAA,KAAK,CAACD,KAAA,EAAOC,IAAA,CAAA;AAEb,IAAA,MAAMC,OAAA,GAAUlB,QAAA,CAASmB,aAAa,CAAC,KAAA,CAAA;AACvC,IAAA,MAAMC,UAAA,GAAaF,OAAA,CAAQG,YAAY,CAAC;AAAEC,MAAAA,IAAA,EAAM;AAAO,KAAA,CAAA;AACvD,IAAA,MAAMC,GAAA,GAAMvB,QAAA,CAASmB,aAAa,CAAC,KAAA,CAAA;AAEnCC,IAAAA,UAAA,CAAWI,WAAW,CAACD,GAAA,CAAA;IACvB,IAAI,CAACT,IAAI,GAAGI,OAAA;IACZ,IAAI,CAACL,MAAM,GAAGU,GAAA;AAChB,EAAA;AAEA,EAAA;IAAAjB,oBAAA,CAAAC,kBAAA,CAAA,gKAAA,EAYA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;AAAAJ,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
@@ -1,4 +1,3 @@
1
-
2
1
  import { fn, hash } from '@ember/helper';
3
2
  import { on } from '@ember/modifier';
4
3
  import { cell } from 'ember-resources';
@@ -6,16 +5,16 @@ import { uniqueId } from '../utils.js';
6
5
  import { precompileTemplate } from '@ember/template-compilation';
7
6
  import { setComponentTemplate } from '@ember/component';
8
7
  import templateOnly from '@ember/component/template-only';
9
- import { t as toggleWithFallback } from '../utils-C5796IKA.js';
8
+ import { t as toggleWithFallback } from '../utils-D0v9WKmV.js';
10
9
 
11
- setComponentTemplate(precompileTemplate("\n <div ...attributes>{{yield}}</div>\n", {
10
+ setComponentTemplate(precompileTemplate("<div ...attributes>{{yield}}</div>", {
12
11
  strictMode: true
13
12
  }), templateOnly());
14
- const Label = setComponentTemplate(precompileTemplate("\n <label for={{@for}} ...attributes>{{yield}}</label>\n", {
13
+ const Label = setComponentTemplate(precompileTemplate("<label for={{@for}} ...attributes>{{yield}}</label>", {
15
14
  strictMode: true
16
15
  }), templateOnly());
17
16
 
18
- const Checkbox = setComponentTemplate(precompileTemplate("\n {{#let (cell @checked) as |checked|}}\n <input id={{@id}} type=\"checkbox\" role=\"switch\" checked={{checked.current}} aria-checked={{checked.current}} data-state={{if checked.current \"on\" \"off\"}} {{on \"click\" (fn toggleWithFallback checked.toggle @onChange)}} ...attributes />\n {{/let}}\n", {
17
+ const Checkbox = setComponentTemplate(precompileTemplate("{{#let (cell @checked) as |checked|}}\n <input id={{@id}} type=\"checkbox\" role=\"switch\" checked={{checked.current}} aria-checked={{checked.current}} data-state={{if checked.current \"on\" \"off\"}} {{on \"click\" (fn toggleWithFallback checked.toggle @onChange)}} ...attributes />\n{{/let}}", {
19
18
  strictMode: true,
20
19
  scope: () => ({
21
20
  cell,
@@ -27,7 +26,7 @@ const Checkbox = setComponentTemplate(precompileTemplate("\n {{#let (cell @chec
27
26
  /**
28
27
  * @public
29
28
  */
30
- const Switch = setComponentTemplate(precompileTemplate("\n <div ...attributes data-prim-switch>\n {{!-- @glint-nocheck --}}\n {{#let (uniqueId) as |id|}}\n {{yield (hash Control=(component Checkbox checked=@checked id=id onChange=@onChange) Label=(component Label for=id))}}\n {{/let}}\n </div>\n", {
29
+ const Switch = setComponentTemplate(precompileTemplate("<div ...attributes data-prim-switch>\n {{!-- @glint-nocheck --}}\n {{#let (uniqueId) as |id|}}\n {{yield (hash Control=(component Checkbox checked=@checked id=id onChange=@onChange) Label=(component Label for=id))}}\n {{/let}}\n</div>", {
31
30
  strictMode: true,
32
31
  scope: () => ({
33
32
  uniqueId,
@@ -1 +1 @@
1
- {"version":3,"file":"switch.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
1
+ {"version":3,"file":"switch.js","sources":["../../src/components/-private/typed-elements.gts","../../src/components/switch.gts"],"sourcesContent":["import type { TOC } from \"@ember/component/template-only\";\n\nexport const Div: TOC<{ Element: HTMLDivElement; Blocks: { default: [] } }> = <template>\n <div ...attributes>{{yield}}</div>\n</template>;\n\nexport const Label: TOC<{\n Element: HTMLLabelElement;\n Args: { for: string };\n Blocks: { default: [] };\n}> = <template>\n <label for={{@for}} ...attributes>{{yield}}</label>\n</template>;\n","import { fn, hash } from \"@ember/helper\";\nimport { on } from \"@ember/modifier\";\n\nimport { cell } from \"ember-resources\";\n\nimport { uniqueId } from \"../utils.ts\";\nimport { Label } from \"./-private/typed-elements.gts\";\nimport { toggleWithFallback } from \"./-private/utils.ts\";\n\nimport type { TOC } from \"@ember/component/template-only\";\nimport type { WithBoundArgs } from \"@glint/template\";\n\nexport interface Signature {\n Element: HTMLInputElement;\n Args: {\n /**\n * The initial checked value of the Switch.\n * This value is reactive, so if the value that\n * `@checked` is set to updates, the state of the Switch will also update.\n */\n checked?: boolean;\n /**\n * Callback when the Switch state is toggled\n */\n onChange?: (checked: boolean, event: Event) => void;\n };\n Blocks: {\n default?: [\n {\n /**\n * The Switch Element.\n * It has a pre-wired `id` so that the relevant Label is\n * appropriately associated via the `for` property of the Label.\n *\n * ```gjs\n * import { Switch } from 'ember-primitives';\n *\n * <template>\n * <Switch as |s|>\n * <s.Control />\n * </Switch>\n * </template>\n * ```\n */\n Control: WithBoundArgs<typeof Checkbox, \"checked\" | \"id\" | \"onChange\">;\n /**\n * The Switch element requires a label, and this label already has\n * the association to the Control by setting the `for` attribute to the `id` of the Control\n *\n * ```gjs\n * import { Switch } from 'ember-primitives';\n *\n * <template>\n * <Switch as |s|>\n * <s.Label />\n * </Switch>\n * </template>\n * ```\n */\n Label: WithBoundArgs<typeof Label, \"for\">;\n },\n ];\n };\n}\n\ninterface ControlSignature {\n Element: HTMLInputElement;\n Args: { id: string; checked?: boolean; onChange: () => void };\n}\n\nconst Checkbox: TOC<ControlSignature> = <template>\n {{#let (cell @checked) as |checked|}}\n <input\n id={{@id}}\n type=\"checkbox\"\n role=\"switch\"\n checked={{checked.current}}\n aria-checked={{checked.current}}\n data-state={{if checked.current \"on\" \"off\"}}\n {{on \"click\" (fn toggleWithFallback checked.toggle @onChange)}}\n ...attributes\n />\n {{/let}}\n</template>;\n\n/**\n * @public\n */\nexport const Switch: TOC<Signature> = <template>\n <div ...attributes data-prim-switch>\n {{! @glint-nocheck }}\n {{#let (uniqueId) as |id|}}\n {{yield\n (hash\n Control=(component Checkbox checked=@checked id=id onChange=@onChange)\n Label=(component Label for=id)\n )\n }}\n {{/let}}\n </div>\n</template>;\n\nexport default Switch;\n"],"names":["precompileTemplate","strictMode","templateOnly","Label","Checkbox","setComponentTemplate","scope","cell","on","fn","toggleWithFallback","Switch","uniqueId","hash"],"mappings":";;;;;;;;;qBAE8EA,kBAAA,CAAA,oCAAA,EAE9E;EAAAC,UAAA,EAAA;AAAU,CAAA,CAAA,EAAAC,YAAA,EAAA;AAEH,MAAMC,6BAIRH,kBAAA,CAAA,qDAAA,EAEL;EAAAC,UAAA,EAAA;AAAU,CAAA,CAAA,EAAAC,YAAA,EAAA,CAAA;;AC0DV,MAAME,QAAc,GAAAC,oBAAA,CAAoBL,kBAAA,CAAA,ySAAA,EAaxC;EAAAC,UAAA,EAAA,IAAA;AAAAK,EAAAA,KAAA,EAAAA,OAAA;IAAAC,IAAA;IAAAC,EAAA;IAAAC,EAAA;AAAAC,IAAAA;AAAA,GAAA;AAAU,CAAA,CAAA,EAAAR,YAAA,EAAA,CAAA;AAEV;;AAEC;MACYS,MAAY,GAAAN,oBAAA,CAAaL,kBAAA,CAAA,kPAAA,EAYtC;EAAAC,UAAA,EAAA,IAAA;AAAAK,EAAAA,KAAA,EAAAA,OAAA;IAAAM,QAAA;IAAAC,IAAA;IAAAT,QAAA;AAAAD,IAAAA;AAAA,GAAA;AAAU,CAAA,CAAA,EAAAD,YAAA,EAAA;;;;"}
@@ -1,4 +1,3 @@
1
-
2
1
  import Component from '@glimmer/component';
3
2
  import { tracked } from '@glimmer/tracking';
4
3
  import { isDestroyed, isDestroying } from '@ember/destroyable';
@@ -31,17 +30,17 @@ const TABSTER_CONFIG = getTabsterAttribute({
31
30
  },
32
31
  deloser: {}
33
32
  }, true);
34
- const TabLink = setComponentTemplate(precompileTemplate("\n <a href=\"##missing##\" ...attributes role=\"tab\" aria-controls={{@panelId}} id={{@id}}>\n {{yield}}\n </a>\n", {
33
+ const TabLink = setComponentTemplate(precompileTemplate("<a href=\"##missing##\" ...attributes role=\"tab\" aria-controls={{@panelId}} id={{@id}}>\n {{yield}}\n</a>", {
35
34
  strictMode: true
36
35
  }), templateOnly());
37
- const TabButton = setComponentTemplate(precompileTemplate("\n <button ...attributes role=\"tab\" type=\"button\" aria-controls={{@panelId}} aria-selected={{String (@state.isActive @id @value)}} id={{@id}} {{on \"click\" @handleClick}} {{!-- The Types for modifier are wrong --}} {{!-- @glint-expect-error--}} {{(if @state.isAutomatic (modifier on \"focus\" @handleClick))}}>\n {{yield}}\n </button>\n", {
36
+ const TabButton = setComponentTemplate(precompileTemplate("<button ...attributes role=\"tab\" type=\"button\" aria-controls={{@panelId}} aria-selected={{String (@state.isActive @id @value)}} id={{@id}} {{on \"click\" @handleClick}} {{!-- The Types for modifier are wrong --}} {{!-- @glint-expect-error--}} {{(if @state.isAutomatic (modifier on \"focus\" @handleClick))}}>\n {{yield}}\n</button>", {
38
37
  strictMode: true,
39
38
  scope: () => ({
40
39
  String,
41
40
  on
42
41
  })
43
42
  }), templateOnly());
44
- const TabContent = setComponentTemplate(precompileTemplate("\n <Portal @to=\"#{{@state.tabpanelId}}\" @append={{true}}>\n {{#if (@state.isActive @tabId)}}\n <div ...attributes role=\"tabpanel\" aria-labelledby={{@tabId}} id={{@id}}>\n {{yield}}\n </div>\n {{/if}}\n </Portal>\n", {
43
+ const TabContent = setComponentTemplate(precompileTemplate("<Portal @to=\"#{{@state.tabpanelId}}\" @append={{true}}>\n {{#if (@state.isActive @tabId)}}\n <div ...attributes role=\"tabpanel\" aria-labelledby={{@tabId}} id={{@id}}>\n {{yield}}\n </div>\n {{/if}}\n</Portal>", {
45
44
  strictMode: true,
46
45
  scope: () => ({
47
46
  Portal
@@ -67,7 +66,7 @@ class TabContainer extends Component {
67
66
  return this.args.label ?? this.tabId;
68
67
  }
69
68
  static {
70
- setComponentTemplate(precompileTemplate("\n {{#if @label}}\n <TabButton @state={{@state}} @id={{this.tabId}} @value={{@value}} @panelId={{this.panelId}} @handleClick={{fn @state.handleChange this.tabId @value}}>\n {{#if (isString @label)}}\n {{@label}}\n {{else}}\n <@label />\n {{/if}}\n </TabButton>\n\n <TabContent @state={{@state}} @id={{this.panelId}} @tabId={{this.tabId}}>\n {{#if @content}}\n {{#if (isString @content)}}\n {{@content}}\n {{else}}\n <@content />\n {{/if}}\n {{else}}\n {{yield}}\n {{/if}}\n </TabContent>\n {{else}}\n {{yield (makeTab (component TabButton state=@state value=@value id=this.tabId panelId=this.panelId handleClick=(fn @state.handleChange this.tabId @value)) (component TabLink state=@state id=this.tabId panelId=this.panelId)) (component TabContent state=@state id=this.panelId tabId=this.tabId)}}\n {{/if}}\n ", {
69
+ setComponentTemplate(precompileTemplate("{{#if @label}}\n <TabButton @state={{@state}} @id={{this.tabId}} @value={{@value}} @panelId={{this.panelId}} @handleClick={{fn @state.handleChange this.tabId @value}}>\n {{#if (isString @label)}}\n {{@label}}\n {{else}}\n <@label />\n {{/if}}\n </TabButton>\n\n <TabContent @state={{@state}} @id={{this.panelId}} @tabId={{this.tabId}}>\n {{#if @content}}\n {{#if (isString @content)}}\n {{@content}}\n {{else}}\n <@content />\n {{/if}}\n {{else}}\n {{yield}}\n {{/if}}\n </TabContent>\n{{else}}\n {{yield (makeTab (component TabButton state=@state value=@value id=this.tabId panelId=this.panelId handleClick=(fn @state.handleChange this.tabId @value)) (component TabLink state=@state id=this.tabId panelId=this.panelId)) (component TabContent state=@state id=this.panelId tabId=this.tabId)}}\n{{/if}}", {
71
70
  strictMode: true,
72
71
  scope: () => ({
73
72
  TabButton,
@@ -80,7 +79,7 @@ class TabContainer extends Component {
80
79
  }), this);
81
80
  }
82
81
  }
83
- const Label = setComponentTemplate(precompileTemplate("\n <Portal @to=\"#{{@state.labelId}}\">\n {{yield}}\n </Portal>\n", {
82
+ const Label = setComponentTemplate(precompileTemplate("<Portal @to=\"#{{@state.labelId}}\">\n {{yield}}\n</Portal>", {
84
83
  strictMode: true,
85
84
  scope: () => ({
86
85
  Portal
@@ -201,7 +200,7 @@ class Tabs extends Component {
201
200
  this.state = new TabState(args);
202
201
  }
203
202
  static {
204
- setComponentTemplate(precompileTemplate("\n <div class=\"ember-primitives__tabs\" ...attributes data-active={{this.state.activeLabel}}>\n {{!-- This element will be portaled in to and replaced if tabs.Label is invoked --}}\n <div class=\"ember-primitives__tabs__label\" id={{this.state.labelId}}>\n {{#if (isString @label)}}\n {{@label}}\n {{else}}\n <@label />\n {{/if}}\n </div>\n <div class=\"ember-primitives__tabs__tablist\" role=\"tablist\" aria-labelledby={{this.state.labelId}} data-tabster={{TABSTER_CONFIG}}>\n {{yield (makeAPI (component TabContainer state=this.state) (component Label state=this.state))}}\n </div>\n {{!--\n Tab's contents are portaled in to this element\n --}}\n <div class=\"ember-primitives__tabs__tabpanel\" id={{this.state.tabpanelId}}></div>\n </div>\n ", {
203
+ setComponentTemplate(precompileTemplate("<div class=\"ember-primitives__tabs\" ...attributes data-active={{this.state.activeLabel}}>\n {{!-- This element will be portaled in to and replaced if tabs.Label is invoked --}}\n <div class=\"ember-primitives__tabs__label\" id={{this.state.labelId}}>\n {{#if (isString @label)}}\n {{@label}}\n {{else}}\n <@label />\n {{/if}}\n </div>\n <div class=\"ember-primitives__tabs__tablist\" role=\"tablist\" aria-labelledby={{this.state.labelId}} data-tabster={{TABSTER_CONFIG}}>\n {{yield (makeAPI (component TabContainer state=this.state) (component Label state=this.state))}}\n </div>\n {{!--\n Tab's contents are portaled in to this element\n --}}\n <div class=\"ember-primitives__tabs__tabpanel\" id={{this.state.tabpanelId}}></div>\n</div>", {
205
204
  strictMode: true,
206
205
  scope: () => ({
207
206
  isString,