frontile 0.18.0-beta.5 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,5 @@
1
1
  import type { SelectionMode } from '../../../utils/listManager';
2
+ import type { Point } from '../../../utils/safe-area';
2
3
  import type { ListboxItemSignature } from '../listbox/item';
3
4
  /**
4
5
  * How a submenu was asked to open.
@@ -21,6 +22,15 @@ type OpenSource = 'pointer' | 'keyboard';
21
22
  interface SubHandle {
22
23
  open: (source: OpenSource) => void;
23
24
  close: () => void;
25
+ /**
26
+ * Whether this submenu is open and the pointer is somewhere that should
27
+ * keep it that way -- its own safe area, or one of its own descendants'.
28
+ *
29
+ * A level asks this of its children before closing itself. A third level
30
+ * sits outside the second level's safe area entirely, so without it the
31
+ * whole chain unwinds the moment the pointer goes deeper than one level.
32
+ */
33
+ isPointSafe: (point: Point) => boolean;
24
34
  }
25
35
  interface MenuContext extends MenuSelectionContext {
26
36
  /** 0 for the root menu, 1 for a submenu, and so on. */
@@ -1 +1 @@
1
- {"version":3,"file":"menu-context.d.ts","sourceRoot":"","sources":["../../../../src/components/collections/dropdown/menu-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAE5D;;;;;;;;GAQG;AACH,KAAK,UAAU,GAAG,SAAS,GAAG,UAAU,CAAC;AAEzC;;;;;;;GAOG;AACH,UAAU,SAAS;IACjB,IAAI,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC;IACnC,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AAED,UAAU,WAAY,SAAQ,oBAAoB;IAChD,uDAAuD;IACvD,KAAK,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,SAAS,EAAE,MAAM,IAAI,CAAC;IAEtB;;;OAGG;IACH,SAAS,EAAE,MA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AAO,EAAE;IAAE,SAAS,EAAE,MAAM,IAAI,CAAC;IAAC,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;CAAE,GAC/D,WAAW,CAUb;AAED;;;;;;;;;GASG;AACH,iBAAS,2BAA2B,CAClC,MAAM,EAAE,WAAW,EACnB,GAAG,EAAE,oBAAoB,GACxB,WAAW,CAkBb;AAED,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,2BAA2B,EAC3B,KAAK,WAAW,EAChB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,SAAS,EACd,KAAK,UAAU,EAChB,CAAC"}
1
+ {"version":3,"file":"menu-context.d.ts","sourceRoot":"","sources":["../../../../src/components/collections/dropdown/menu-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAE5D;;;;;;;;GAQG;AACH,KAAK,UAAU,GAAG,SAAS,GAAG,UAAU,CAAC;AAEzC;;;;;;;GAOG;AACH,UAAU,SAAS;IACjB,IAAI,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC;IACnC,KAAK,EAAE,MAAM,IAAI,CAAC;IAElB;;;;;;;OAOG;IACH,WAAW,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,OAAO,CAAC;CACxC;AAED,UAAU,WAAY,SAAQ,oBAAoB;IAChD,uDAAuD;IACvD,KAAK,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,SAAS,EAAE,MAAM,IAAI,CAAC;IAEtB;;;OAGG;IACH,SAAS,EAAE,MAAM,IAAI,CAAC;IAEtB,2EAA2E;IAC3E,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAC7B,WAAW,EAAE,CAAC,GA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WAAW,CAUb;AAED;;;;;;;;;GASG;AACH,iBAAS,2BAA2B,CAClC,MAAM,EAAE,WAAW,EACnB,GAAG,EAAE,oBAAoB,GACxB,WAAW,CAkBb;AAED,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,2BAA2B,EAC3B,KAAK,WAAW,EAChB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,SAAS,EACd,KAAK,UAAU,EAChB,CAAC"}
@@ -6,6 +6,7 @@ import type Owner from '@ember/owner';
6
6
  import type { WithBoundArgs } from '@glint/template';
7
7
  import type { ModifierLike } from '@glint/template';
8
8
  import type { Menu } from './dropdown';
9
+ import { type Point } from '../../../utils/safe-area';
9
10
  /**
10
11
  * The raw, unbound `Menu` component, handed in rather than imported.
11
12
  *
@@ -96,6 +97,17 @@ declare class Sub extends Component<SubSignature> {
96
97
  willDestroy(): void;
97
98
  handle: SubHandle;
98
99
  open: (source?: OpenSource) => void;
100
+ /**
101
+ * Close every other submenu at this level.
102
+ *
103
+ * Two sub-triggers next to each other would otherwise both stay on screen:
104
+ * the abandoned level's own close is on a timer, and the pointer moving
105
+ * toward the new one keeps re-arming it. A level's siblings are exactly the
106
+ * other entries in the parent's registry, so closing them as this one opens
107
+ * makes the two states mutually exclusive in a single render -- there is no
108
+ * frame in which both are painted.
109
+ */
110
+ closeSiblings: () => void;
99
111
  close: () => void;
100
112
  /**
101
113
  * Keeps the submenu open while the pointer is heading for it.
@@ -110,9 +122,31 @@ declare class Sub extends Component<SubSignature> {
110
122
  * is outside the safe area, so moving onto one closes the submenu.
111
123
  */
112
124
  trackPointer: (event: PointerEvent) => void;
125
+ /**
126
+ * Whether the pointer is somewhere that should keep this level open.
127
+ *
128
+ * Its own safe area, or -- recursively -- any open descendant's. A third
129
+ * level opens to the right of the second, well outside the polygon that
130
+ * runs from *this* trigger to *this* content, so a level that only
131
+ * consulted its own area would close the instant the pointer went deeper,
132
+ * taking every level below it along. Asking the children means the chain
133
+ * survives exactly as long as the pointer is still somewhere in it.
134
+ */
135
+ isPointSafe: (point: Point) => boolean;
113
136
  startTracking: () => void;
114
137
  stopTracking: () => void;
115
138
  scheduleOpen: () => void;
139
+ /**
140
+ * Arm the close, but never re-arm one already pending.
141
+ *
142
+ * This runs from every `pointermove` that lands outside the safe area, so
143
+ * cancelling and re-scheduling here would let a pointer that simply keeps
144
+ * moving -- across a sibling row, into a sibling's submenu, anywhere on the
145
+ * page -- push the close out indefinitely and strand the level open. Once
146
+ * the pointer has left, the countdown is from that moment and nothing
147
+ * outside the safe area extends it; only `cancelClose` (the pointer coming
148
+ * back inside) stops it.
149
+ */
116
150
  scheduleClose: () => void;
117
151
  cancelClose: () => void;
118
152
  hoverTrigger: import("ember-modifier").FunctionBasedModifier<{
@@ -1 +1 @@
1
- {"version":3,"file":"sub.d.ts","sourceRoot":"","sources":["../../../../src/components/collections/dropdown/sub.gts"],"names":[],"mappings":"AAmbA,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAO3C,OAAO,EAAW,KAAK,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAExE,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AACzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAEtC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAiBvC;;;;;;;;;;;;;;GAcG;AACH,KAAK,aAAa,GAAG,OAAO,IAAI,CAAC;AAEjC;;;;;GAKG;AACH,KAAK,kBAAkB,GAAG,aAAa,CACrC,OAAO,IAAI,EACX,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,YAAY,GAAG,OAAO,GAAG,SAAS,CACpE,C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,aAAa,CAAC;IACvB,MAAM,EAAE;QAAE,OAAO,EAAE,EAAE,CAAA;KAAE,CAAC;CACzB;AAED;;;;;;;GAOG;AACH,cAAM,UAAW,SAAQ,SAAS,CAAC,mBAAmB,CAAC;IACrD;;;;;;OAMG;IACH,IAAI,GAAG,IAAI,MAAM,CAOhB;CAuBF;AAED,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"menu-context.js","sources":["../../../../src/components/collections/dropdown/menu-context.ts"],"sourcesContent":["import type { SelectionMode } from '../../../utils/listManager';\nimport type { ListboxItemSignature } from '../listbox/item';\n\n/**\n * How a submenu was asked to open.\n *\n * It decides whether the submenu highlights its first item: a keyboard user\n * who pressed ArrowRight expects to be somewhere, while a pointer user\n * hovering a row does not expect a selection to move. The `Listbox` at each\n * level is constructed fresh on open, so the source is read once, at mount,\n * as `autoActivateMode`.\n */\ntype OpenSource = 'pointer' | 'keyboard';\n\n/**\n * What a level needs in order to drive a submenu it does not itself render.\n *\n * A level's ArrowRight handler has to open the submenu belonging to whichever\n * item is currently active. The item knows nothing about the submenu, and the\n * `Sub` renders inside the level's own block -- so each `Sub` registers a\n * handle under its trigger's key, and the level looks it up.\n */\ninterface SubHandle {\n open: (source: OpenSource) => void;\n close: () => void;\n}\n\ninterface MenuContext extends MenuSelectionContext {\n /** 0 for the root menu, 1 for a submenu, and so on. */\n depth: number;\n\n /**\n * Close the whole chain. Choosing a leaf three levels down dismisses the\n * entire dropdown, not just the level the leaf sits in.\n */\n closeRoot: () => void;\n\n /**\n * Close just this level, leaving its parent open -- what ArrowLeft does.\n * On the root this is the same thing as `closeRoot`.\n */\n closeSelf: () => void;\n\n /** The submenus registered at this level, keyed by their trigger's key. */\n subs: Map<string, SubHandle>;\n registerSub: (key: string, handle: SubHandle) => void;\n unregisterSub: (key: string) => void;\n\n // Appearance and timing are the root's for the whole chain: a submenu that\n // styled itself would make one menu look like two, so these are declared\n // once on the root and never overridden below it.\n variant?: ListboxItemSignature['Args']['variant'];\n color?: ListboxItemSignature['Args']['color'];\n shortcutVariant?: ListboxItemSignature['Args']['shortcutVariant'];\n disableTransitions?: boolean;\n transitionDuration?: number;\n}\n\n/**\n * The parts of a context a level may declare for itself.\n *\n * Declared once on the root and inherited by every depth -- so `@onAction` and\n * `@selectedKeys` written at the top apply to a leaf at any level -- but a\n * submenu may override any of them for its own level and the levels below,\n * which is what lets a navigation menu hold a multi-select submenu.\n *\n * Split out from `MenuContext` so the overridable set is a type rather than a\n * list repeated in prose and in a literal: `OVERRIDABLE_KEYS` below is indexed\n * by this interface, so an eighth setting added here fails to compile until it\n * is spelled there too, instead of silently being non-overridable.\n */\ninterface MenuSelectionContext {\n selectionMode?: SelectionMode;\n selectedKeys?: string[];\n disabledKeys?: string[];\n allowEmpty?: boolean;\n onAction?: (key: string) => void;\n onSelectionChange?: (keys: string[]) => void;\n closeOnItemSelect?: boolean;\n}\n\nconst OVERRIDABLE_KEYS: Record<keyof MenuSelectionContext, true> = {\n selectionMode: true,\n selectedKeys: true,\n disabledKeys: true,\n allowEmpty: true,\n onAction: true,\n onSelectionChange: true,\n closeOnItemSelect: true\n};\n\ninterface RootMenuContextArgs extends Omit<\n MenuContext,\n 'depth' | 'closeRoot' | 'closeSelf' | 'registerSub' | 'unregisterSub'\n> {\n /** The root popover's close, used for both `closeRoot` and `closeSelf`. */\n close: () => void;\n}\n\n/**\n * `subs` is passed in rather than created here, and deliberately so: the\n * caller is a Glimmer component whose getter rebuilds this object on every\n * render, and a map created here would drop every `Sub` that had already\n * registered. The component owns one stable map for the life of the level.\n */\nfunction bindSubRegistry(\n subs: Map<string, SubHandle>\n): Pick<MenuContext, 'registerSub' | 'unregisterSub'> {\n return {\n registerSub: (key, handle) => subs.set(key, handle),\n unregisterSub: (key) => subs.delete(key)\n };\n}\n\nfunction createRootMenuContext(args: RootMenuContextArgs): MenuContext {\n const { close, subs, ...shared } = args;\n\n return {\n ...shared,\n depth: 0,\n subs,\n closeRoot: close,\n closeSelf: close,\n ...bindSubRegistry(subs)\n };\n}\n\nfunction createChildMenuContext(\n parent: MenuContext,\n options: { closeSelf: () => void; subs: Map<string, SubHandle> }\n): MenuContext {\n const { closeSelf, subs } = options;\n\n return {\n ...parent,\n depth: parent.depth + 1,\n subs,\n closeSelf,\n ...bindSubRegistry(subs)\n };\n}\n\n/**\n * Layers a level's own declarations over the context it inherited.\n *\n * Only settings actually written on this level count: reading them\n * unconditionally would overwrite inherited values with `undefined` and\n * silently break inheritance, which is the default and by far the common case.\n * That case also allocates nothing and hands back the parent's own object, so\n * a level that declares nothing is indistinguishable downstream from one that\n * never had the chance to.\n */\nfunction createOverriddenMenuContext(\n parent: MenuContext,\n own: MenuSelectionContext\n): MenuContext {\n let overrides: Partial<MenuSelectionContext> | undefined;\n\n for (const key of Object.keys(\n OVERRIDABLE_KEYS\n ) as (keyof MenuSelectionContext)[]) {\n const value = own[key];\n\n if (value !== undefined) {\n overrides ??= {};\n // Correlating the key with its own value type is beyond what TS narrows\n // across an index like this; the `Record` above is what actually keeps\n // the key set honest.\n overrides[key] = value as never;\n }\n }\n\n return overrides ? { ...parent, ...overrides } : parent;\n}\n\nexport {\n createRootMenuContext,\n createChildMenuContext,\n createOverriddenMenuContext,\n type MenuContext,\n type MenuSelectionContext,\n type RootMenuContextArgs,\n type SubHandle,\n type OpenSource\n};\n"],"names":["OVERRIDABLE_KEYS","selectionMode","selectedKeys","disabledKeys","allowEmpty","onAction","onSelectionChange","closeOnItemSelect","bindSubRegistry","subs","registerSub","key","handle","set","unregisterSub","delete","createRootMenuContext","args","close","shared","depth","closeRoot","closeSelf","createChildMenuContext","parent","options","createOverriddenMenuContext","own","overrides","Object","keys","value","undefined"],"mappings":"AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAqCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAW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;AACb,EAAA,IAAIC,SAAoD;EAExD,KAAK,MAAMjB,GAAG,IAAIkB,MAAM,CAACC,IAAI,CAC3B9B,gBACF,CAAC,EAAoC;AACnC,IAAA,MAAM+B,KAAK,GAAGJ,GAAG,CAAChB,GAAG,CAAC;IAEtB,IAAIoB,KAAK,KAAKC,SAAS,EAAE;MACvBJ,SAAS,KAAK,EAAE;AAChB;AACA;AACA;AACAA,MAAAA,SAAS,CAACjB,GAAG,CAAC,GAAGoB,KAAc;AACjC,IAAA;AACF,EAAA;AAEA,EAAA,OAAOH,SAAS,GAAG;AAAE,IAAA,GAAGJ,MAAM;IAAE,GAAGI;AAAU,GAAC,GAAGJ,MAAM;AACzD;;"}
1
+ {"version":3,"file":"menu-context.js","sources":["../../../../src/components/collections/dropdown/menu-context.ts"],"sourcesContent":["import type { SelectionMode } from '../../../utils/listManager';\nimport type { Point } from '../../../utils/safe-area';\nimport type { ListboxItemSignature } from '../listbox/item';\n\n/**\n * How a submenu was asked to open.\n *\n * It decides whether the submenu highlights its first item: a keyboard user\n * who pressed ArrowRight expects to be somewhere, while a pointer user\n * hovering a row does not expect a selection to move. The `Listbox` at each\n * level is constructed fresh on open, so the source is read once, at mount,\n * as `autoActivateMode`.\n */\ntype OpenSource = 'pointer' | 'keyboard';\n\n/**\n * What a level needs in order to drive a submenu it does not itself render.\n *\n * A level's ArrowRight handler has to open the submenu belonging to whichever\n * item is currently active. The item knows nothing about the submenu, and the\n * `Sub` renders inside the level's own block -- so each `Sub` registers a\n * handle under its trigger's key, and the level looks it up.\n */\ninterface SubHandle {\n open: (source: OpenSource) => void;\n close: () => void;\n\n /**\n * Whether this submenu is open and the pointer is somewhere that should\n * keep it that way -- its own safe area, or one of its own descendants'.\n *\n * A level asks this of its children before closing itself. A third level\n * sits outside the second level's safe area entirely, so without it the\n * whole chain unwinds the moment the pointer goes deeper than one level.\n */\n isPointSafe: (point: Point) => boolean;\n}\n\ninterface MenuContext extends MenuSelectionContext {\n /** 0 for the root menu, 1 for a submenu, and so on. */\n depth: number;\n\n /**\n * Close the whole chain. Choosing a leaf three levels down dismisses the\n * entire dropdown, not just the level the leaf sits in.\n */\n closeRoot: () => void;\n\n /**\n * Close just this level, leaving its parent open -- what ArrowLeft does.\n * On the root this is the same thing as `closeRoot`.\n */\n closeSelf: () => void;\n\n /** The submenus registered at this level, keyed by their trigger's key. */\n subs: Map<string, SubHandle>;\n registerSub: (key: string, handle: SubHandle) => void;\n unregisterSub: (key: string) => void;\n\n // Appearance and timing are the root's for the whole chain: a submenu that\n // styled itself would make one menu look like two, so these are declared\n // once on the root and never overridden below it.\n variant?: ListboxItemSignature['Args']['variant'];\n color?: ListboxItemSignature['Args']['color'];\n shortcutVariant?: ListboxItemSignature['Args']['shortcutVariant'];\n disableTransitions?: boolean;\n transitionDuration?: number;\n}\n\n/**\n * The parts of a context a level may declare for itself.\n *\n * Declared once on the root and inherited by every depth -- so `@onAction` and\n * `@selectedKeys` written at the top apply to a leaf at any level -- but a\n * submenu may override any of them for its own level and the levels below,\n * which is what lets a navigation menu hold a multi-select submenu.\n *\n * Split out from `MenuContext` so the overridable set is a type rather than a\n * list repeated in prose and in a literal: `OVERRIDABLE_KEYS` below is indexed\n * by this interface, so an eighth setting added here fails to compile until it\n * is spelled there too, instead of silently being non-overridable.\n */\ninterface MenuSelectionContext {\n selectionMode?: SelectionMode;\n selectedKeys?: string[];\n disabledKeys?: string[];\n allowEmpty?: boolean;\n onAction?: (key: string) => void;\n onSelectionChange?: (keys: string[]) => void;\n closeOnItemSelect?: boolean;\n}\n\nconst OVERRIDABLE_KEYS: Record<keyof MenuSelectionContext, true> = {\n selectionMode: true,\n selectedKeys: true,\n disabledKeys: true,\n allowEmpty: true,\n onAction: true,\n onSelectionChange: true,\n closeOnItemSelect: true\n};\n\ninterface RootMenuContextArgs extends Omit<\n MenuContext,\n 'depth' | 'closeRoot' | 'closeSelf' | 'registerSub' | 'unregisterSub'\n> {\n /** The root popover's close, used for both `closeRoot` and `closeSelf`. */\n close: () => void;\n}\n\n/**\n * `subs` is passed in rather than created here, and deliberately so: the\n * caller is a Glimmer component whose getter rebuilds this object on every\n * render, and a map created here would drop every `Sub` that had already\n * registered. The component owns one stable map for the life of the level.\n */\nfunction bindSubRegistry(\n subs: Map<string, SubHandle>\n): Pick<MenuContext, 'registerSub' | 'unregisterSub'> {\n return {\n registerSub: (key, handle) => subs.set(key, handle),\n unregisterSub: (key) => subs.delete(key)\n };\n}\n\nfunction createRootMenuContext(args: RootMenuContextArgs): MenuContext {\n const { close, subs, ...shared } = args;\n\n return {\n ...shared,\n depth: 0,\n subs,\n closeRoot: close,\n closeSelf: close,\n ...bindSubRegistry(subs)\n };\n}\n\nfunction createChildMenuContext(\n parent: MenuContext,\n options: { closeSelf: () => void; subs: Map<string, SubHandle> }\n): MenuContext {\n const { closeSelf, subs } = options;\n\n return {\n ...parent,\n depth: parent.depth + 1,\n subs,\n closeSelf,\n ...bindSubRegistry(subs)\n };\n}\n\n/**\n * Layers a level's own declarations over the context it inherited.\n *\n * Only settings actually written on this level count: reading them\n * unconditionally would overwrite inherited values with `undefined` and\n * silently break inheritance, which is the default and by far the common case.\n * That case also allocates nothing and hands back the parent's own object, so\n * a level that declares nothing is indistinguishable downstream from one that\n * never had the chance to.\n */\nfunction createOverriddenMenuContext(\n parent: MenuContext,\n own: MenuSelectionContext\n): MenuContext {\n let overrides: Partial<MenuSelectionContext> | undefined;\n\n for (const key of Object.keys(\n OVERRIDABLE_KEYS\n ) as (keyof MenuSelectionContext)[]) {\n const value = own[key];\n\n if (value !== undefined) {\n overrides ??= {};\n // Correlating the key with its own value type is beyond what TS narrows\n // across an index like this; the `Record` above is what actually keeps\n // the key set honest.\n overrides[key] = value as never;\n }\n }\n\n return overrides ? { ...parent, ...overrides } : parent;\n}\n\nexport {\n createRootMenuContext,\n createChildMenuContext,\n createOverriddenMenuContext,\n type MenuContext,\n type MenuSelectionContext,\n type RootMenuContextArgs,\n type SubHandle,\n type OpenSource\n};\n"],"names":["OVERRIDABLE_KEYS","selectionMode","selectedKeys","disabledKeys","allowEmpty","onAction","onSelectionChange","closeOnItemSelect","bindSubRegistry","subs","registerSub","key","handle","set","unregisterSub","delete","createRootMenuContext","args","close","shared","depth","closeRoot","closeSelf","createChildMenuContext","parent","options","createOverriddenMenuContext","own","overrides","Object","keys","value","undefined"],"mappings":"AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AA+CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAWA,MAAMA,gBAA0D,GAAG;AACjEC,EAAAA,aAAa,EAAE,IAAI;AACnBC,EAAAA,YAAY,EAAE,IAAI;AAClBC,EAAAA,YAAY,EAAE,IAAI;AAClBC,EAAAA,UAAU,EAAE,IAAI;AAChBC,EAAAA,QAAQ,EAAE,IAAI;AACdC,EAAAA,iBAAiB,EAAE,IAAI;AACvBC,EAAAA,iBAAiB,EAAE;AACrB,CAAC;AAUD;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,eAAeA,CACtBC,IAA4B,EACwB;EACpD,OAAO;AACLC,IAAAA,WAAW,EAAEA,CAACC,GAAG,EAAEC,MAAM,KAAKH,IAAI,CAACI,GAAG,CAACF,GAAG,EAAEC,MAAM,CAAC;AACnDE,IAAAA,aAAa,EAAGH,GAAG,IAAKF,IAAI,CAACM,MAAM,CAACJ,GAAG;GACxC;AACH;AAEA,SAASK,qBAAqBA,CAACC,IAAyB,EAAe;EACrE,MAAM;IAAEC,KAAK;IAAET,IAAI;IAAE,GAAGU;AAAO,GAAC,GAAGF,IAAI;EAEvC,OAAO;AACL,IAAA,GAAGE,MAAM;AACTC,IAAAA,KAAK,EAAE,CAAC;IACRX,IAAI;AACJY,IAAAA,SAAS,EAAEH,KAAK;AAChBI,IAAAA,SAAS,EAAEJ,KAAK;IAChB,GAAGV,eAAe,CAACC,IAAI;GACxB;AACH;AAEA,SAASc,sBAAsBA,CAC7BC,MAAmB,EACnBC,OAAgE,EACnD;EACb,MAAM;IAAEH,SAAS;AAAEb,IAAAA;AAAK,GAAC,GAAGgB,OAAO;EAEnC,OAAO;AACL,IAAA,GAAGD,MAAM;AACTJ,IAAAA,KAAK,EAAEI,MAAM,CAACJ,KAAK,GAAG,CAAC;IACvBX,IAAI;IACJa,SAAS;IACT,GAAGd,eAAe,CAACC,IAAI;GACxB;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASiB,2BAA2BA,CAClCF,MAAmB,EACnBG,GAAyB,EACZ;AACb,EAAA,IAAIC,SAAoD;EAExD,KAAK,MAAMjB,GAAG,IAAIkB,MAAM,CAACC,IAAI,CAC3B9B,gBACF,CAAC,EAAoC;AACnC,IAAA,MAAM+B,KAAK,GAAGJ,GAAG,CAAChB,GAAG,CAAC;IAEtB,IAAIoB,KAAK,KAAKC,SAAS,EAAE;MACvBJ,SAAS,KAAK,EAAE;AAChB;AACA;AACA;AACAA,MAAAA,SAAS,CAACjB,GAAG,CAAC,GAAGoB,KAAc;AACjC,IAAA;AACF,EAAA;AAEA,EAAA,OAAOH,SAAS,GAAG;AAAE,IAAA,GAAGJ,MAAM;IAAE,GAAGI;AAAU,GAAC,GAAGJ,MAAM;AACzD;;"}
@@ -86,19 +86,43 @@ class Sub extends Component {
86
86
  this.args.parentContext.unregisterSub(this.triggerKey);
87
87
  this.stopTracking();
88
88
  cancel(this.#openTimer);
89
- cancel(this.#closeTimer);
89
+ this.cancelClose();
90
90
  }
91
91
  handle = {
92
92
  open: source => this.open(source),
93
- close: () => this.close()
93
+ close: () => this.close(),
94
+ isPointSafe: point => this.isPointSafe(point)
94
95
  };
95
96
  open = (source = 'pointer') => {
97
+ this.closeSiblings();
96
98
  this.openSource = source;
97
99
  this.isOpen = true;
98
100
  this.startTracking();
99
101
  };
102
+ /**
103
+ * Close every other submenu at this level.
104
+ *
105
+ * Two sub-triggers next to each other would otherwise both stay on screen:
106
+ * the abandoned level's own close is on a timer, and the pointer moving
107
+ * toward the new one keeps re-arming it. A level's siblings are exactly the
108
+ * other entries in the parent's registry, so closing them as this one opens
109
+ * makes the two states mutually exclusive in a single render -- there is no
110
+ * frame in which both are painted.
111
+ */
112
+ closeSiblings = () => {
113
+ for (const [key, handle] of this.args.parentContext.subs) {
114
+ if (key !== this.triggerKey) {
115
+ handle.close();
116
+ }
117
+ }
118
+ };
100
119
  close = () => {
101
120
  this.stopTracking();
121
+ // Not just bookkeeping: a close that arrives from elsewhere -- a sibling
122
+ // opening, ArrowLeft -- while a timer is pending would otherwise leave
123
+ // that timer to fire later and close a level the pointer had meanwhile
124
+ // brought back.
125
+ this.cancelClose();
102
126
  if (this.isDestroyed || this.isDestroying) {
103
127
  return;
104
128
  }
@@ -129,22 +153,50 @@ class Sub extends Component {
129
153
  * is outside the safe area, so moving onto one closes the submenu.
130
154
  */
131
155
  trackPointer = event => {
132
- const submenu = document.getElementById(this.submenuId);
133
- if (!this.#triggerEl || !submenu) {
156
+ // Nothing to measure against yet -- neither close nor cancel, just wait
157
+ // for the next move.
158
+ if (!this.#triggerEl || !document.getElementById(this.submenuId)) {
134
159
  return;
135
160
  }
136
- const trigger = this.#triggerEl.getBoundingClientRect();
137
- const content = submenu.getBoundingClientRect();
138
- const point = {
161
+ if (this.isPointSafe({
139
162
  x: event.clientX,
140
163
  y: event.clientY
141
- };
142
- if (isPointInSafeArea(point, trigger, content)) {
164
+ })) {
143
165
  this.cancelClose();
144
166
  } else {
145
167
  this.scheduleClose();
146
168
  }
147
169
  };
170
+ /**
171
+ * Whether the pointer is somewhere that should keep this level open.
172
+ *
173
+ * Its own safe area, or -- recursively -- any open descendant's. A third
174
+ * level opens to the right of the second, well outside the polygon that
175
+ * runs from *this* trigger to *this* content, so a level that only
176
+ * consulted its own area would close the instant the pointer went deeper,
177
+ * taking every level below it along. Asking the children means the chain
178
+ * survives exactly as long as the pointer is still somewhere in it.
179
+ */
180
+ isPointSafe = point => {
181
+ if (!this.isOpen) {
182
+ return false;
183
+ }
184
+ const submenu = document.getElementById(this.submenuId);
185
+ if (!this.#triggerEl || !submenu) {
186
+ return false;
187
+ }
188
+ const trigger = this.#triggerEl.getBoundingClientRect();
189
+ const content = submenu.getBoundingClientRect();
190
+ if (isPointInSafeArea(point, trigger, content)) {
191
+ return true;
192
+ }
193
+ for (const handle of this.#childSubs.values()) {
194
+ if (handle.isPointSafe(point)) {
195
+ return true;
196
+ }
197
+ }
198
+ return false;
199
+ };
148
200
  startTracking = () => {
149
201
  if (this.#isTracking) {
150
202
  return;
@@ -164,9 +216,22 @@ class Sub extends Component {
164
216
  cancel(this.#openTimer);
165
217
  this.#openTimer = later(this, () => this.open('pointer'), SUBMENU_OPEN_DELAY);
166
218
  };
219
+ /**
220
+ * Arm the close, but never re-arm one already pending.
221
+ *
222
+ * This runs from every `pointermove` that lands outside the safe area, so
223
+ * cancelling and re-scheduling here would let a pointer that simply keeps
224
+ * moving -- across a sibling row, into a sibling's submenu, anywhere on the
225
+ * page -- push the close out indefinitely and strand the level open. Once
226
+ * the pointer has left, the countdown is from that moment and nothing
227
+ * outside the safe area extends it; only `cancelClose` (the pointer coming
228
+ * back inside) stops it.
229
+ */
167
230
  scheduleClose = () => {
168
231
  cancel(this.#openTimer);
169
- cancel(this.#closeTimer);
232
+ if (this.#closeTimer) {
233
+ return;
234
+ }
170
235
  this.#closeTimer = later(this, this.close, SUBMENU_CLOSE_DELAY);
171
236
  };
172
237
  cancelClose = () => {
@@ -181,7 +246,7 @@ class Sub extends Component {
181
246
  el.removeEventListener('pointerenter', this.scheduleOpen);
182
247
  el.removeEventListener('pointerleave', this.scheduleClose);
183
248
  cancel(this.#openTimer);
184
- cancel(this.#closeTimer);
249
+ this.cancelClose();
185
250
  this.stopTracking();
186
251
  if (this.#triggerEl === el) {
187
252
  this.#triggerEl = undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"sub.js","sources":["../../../../src/components/collections/dropdown/sub.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { tracked } from '@glimmer/tracking';\nimport { guidFor } from '@ember/object/internals';\nimport { assert } from '@ember/debug';\nimport { hash } from '@ember/helper';\nimport { cancel, later } from '@ember/runloop';\nimport { modifier } from 'ember-modifier';\nimport { Popover, type PopoverSignature } from '../../overlays/popover';\nimport { createChildMenuContext } from './menu-context';\nimport type { MenuContext, OpenSource, SubHandle } from './menu-context';\nimport type { ListboxItem } from '../listbox/item';\nimport type Owner from '@ember/owner';\nimport type { Timer } from '@ember/runloop';\nimport type { WithBoundArgs } from '@glint/template';\nimport type { ModifierLike } from '@glint/template';\nimport type { Menu } from './dropdown';\nimport { isPointInSafeArea, type Rect } from '../../../utils/safe-area';\n\n/**\n * Long enough that dragging the pointer across a row on its way somewhere else\n * does not flash a submenu open, short enough to feel immediate when the\n * pointer settles.\n */\nconst SUBMENU_OPEN_DELAY = 100;\n\n/**\n * The pointer has to cross a gap to reach the submenu, so leaving the trigger\n * cannot close it instantly. The safe-area check below decides *where* the\n * pointer is allowed to go; this is how long it has to get there.\n */\nconst SUBMENU_CLOSE_DELAY = 300;\n\n/**\n * The raw, unbound `Menu` component, handed in rather than imported.\n *\n * `Menu` yields `Sub`, and a `Sub` renders a `Menu` for its own level. Passing\n * it in keeps the *runtime* import running one way -- `dropdown.gts` imports\n * `sub.gts` and nothing goes back at runtime, so there is no import cycle to\n * reason about there. This is a TYPE-only import of `Menu` from `dropdown.gts`\n * (see the `import type` above): it disappears entirely once compiled, so it\n * creates no runtime dependency and no cycle. A loose `ComponentLike<...>`\n * shape was tried first and rejected by Glint -- currying `Sub`'s own named\n * args onto a `ComponentLike` signature produced an \"excessively deep type\n * instantiation\" error, because Glint could not resolve the curried result\n * back to a concrete `Blocks` shape. Naming the real `Menu` type here (still\n * without a runtime import) keeps that resolution concrete.\n */\ntype MenuComponent = typeof Menu;\n\n/**\n * The bound-args shape `Sub` produces for its own `s.Menu` -- `Content`,\n * `context`, `depth`, `menuId`, `openSource` and `close` are all curried\n * by `Sub` itself (see the template below), so a consumer only ever supplies\n * the public args (`@selectionMode`, `@onAction`, and so on).\n */\ntype BoundMenuComponent = WithBoundArgs<\n typeof Menu,\n 'context' | 'depth' | 'menuId' | 'openSource' | 'close' | 'Content'\n>;\n\ninterface SubArgs extends Pick<\n PopoverSignature['Args'],\n | 'placement'\n | 'flipOptions'\n | 'middleware'\n | 'shiftOptions'\n | 'offsetOptions'\n | 'strategy'\n> {\n /**\n * @internal\n *\n * Named `item` rather than `Item`: Ember's template compiler treats any\n * named arg whose first letter is not lowercase (`@Item`, `@Menu`, ...) as\n * reserved and refuses to reference it inside a template -- so every named\n * arg here and on `SubTrigger` below is lowercase even though the values\n * yielded to consumers (`Trigger`, `Menu`, `Sub`) stay capitalized block\n * params, which are not subject to that rule.\n */\n item: WithBoundArgs<typeof ListboxItem, 'manager'>;\n\n /**\n * @internal\n *\n * The raw, unbound `Menu` -- `Sub` curries `Content`/`context`/`depth`/\n * `menuId`/`openSource`/`close` onto it itself (see `BoundMenuComponent`\n * above and the template below).\n */\n menu: MenuComponent;\n\n /**\n * @internal\n */\n parentContext: MenuContext;\n}\n\nexport interface SubSignature {\n Args: SubArgs;\n Blocks: {\n default: [\n {\n Trigger: WithBoundArgs<\n typeof SubTrigger,\n | 'item'\n | 'anchor'\n | 'onTriggerClick'\n | 'isOpen'\n | 'submenuId'\n | 'key'\n | 'hoverTrigger'\n >;\n Menu: BoundMenuComponent;\n isOpen: boolean;\n }\n ];\n };\n}\n\nclass Sub extends Component<SubSignature> {\n /**\n * The key the trigger registers under.\n *\n * Generated rather than asked for: a sub-trigger never selects, so its key\n * never reaches `onAction` or `selectedKeys`, and making consumers invent\n * one would be asking for a value nothing observes.\n */\n triggerKey = `${guidFor(this)}-sub-trigger`;\n\n /** The id of this submenu's `role=\"menu\"` element, for `aria-controls`. */\n submenuId = `${guidFor(this)}-submenu`;\n\n /**\n * The registry this level's own children write into. One map for the life of\n * the component -- see `createRootMenuContext` for why it cannot be built in\n * the getter.\n */\n #childSubs = new Map<string, SubHandle>();\n\n /**\n * The popover is driven in controlled mode.\n *\n * The parent level has to be able to open this submenu from its own\n * ArrowRight handler, through the registered `SubHandle` -- so the open\n * state has to live somewhere reachable from outside the Popover's block,\n * which the yielded `open`/`close` are not.\n */\n @tracked isOpen = false;\n\n /**\n * Not tracked: it is read once, when the freshly mounted `Listbox`\n * constructs its `ListManager`, and never rendered.\n */\n openSource: OpenSource = 'pointer';\n\n constructor(owner: Owner, args: SubArgs) {\n super(owner, args);\n this.args.parentContext.registerSub(this.triggerKey, this.handle);\n }\n\n willDestroy(): void {\n super.willDestroy();\n this.args.parentContext.unregisterSub(this.triggerKey);\n this.stopTracking();\n cancel(this.#openTimer);\n cancel(this.#closeTimer);\n }\n\n handle: SubHandle = {\n open: (source: OpenSource) => this.open(source),\n close: () => this.close()\n };\n\n open = (source: OpenSource = 'pointer') => {\n this.openSource = source;\n this.isOpen = true;\n this.startTracking();\n };\n\n close = () => {\n this.stopTracking();\n\n if (this.isDestroyed || this.isDestroying) {\n return;\n }\n this.isOpen = false;\n };\n\n #openTimer?: Timer;\n #closeTimer?: Timer;\n\n /**\n * The trigger element, captured by `hoverTrigger`, so the safe area can be\n * measured without querying for it.\n */\n #triggerEl?: HTMLElement;\n\n /**\n * Whether the pointer is currently being tracked against the safe area.\n * Guards against installing the document listener twice.\n */\n #isTracking = false;\n\n /**\n * Keeps the submenu open while the pointer is heading for it.\n *\n * The pointer has to cross a gap to reach a submenu, and it crosses it\n * diagonally -- so `pointerleave` on the trigger cannot mean \"close\". While\n * the submenu is open, every pointer move is tested against the safe area:\n * inside it, the pending close is cancelled; outside it, the pointer has\n * clearly gone elsewhere and the submenu closes.\n *\n * This also handles hovering a sibling row with no extra wiring: a sibling\n * is outside the safe area, so moving onto one closes the submenu.\n */\n trackPointer = (event: PointerEvent) => {\n const submenu = document.getElementById(this.submenuId);\n if (!this.#triggerEl || !submenu) {\n return;\n }\n\n const trigger: Rect = this.#triggerEl.getBoundingClientRect();\n const content: Rect = submenu.getBoundingClientRect();\n const point = { x: event.clientX, y: event.clientY };\n\n if (isPointInSafeArea(point, trigger, content)) {\n this.cancelClose();\n } else {\n this.scheduleClose();\n }\n };\n\n startTracking = () => {\n if (this.#isTracking) {\n return;\n }\n this.#isTracking = true;\n document.addEventListener('pointermove', this.trackPointer);\n };\n\n stopTracking = () => {\n if (!this.#isTracking) {\n return;\n }\n this.#isTracking = false;\n document.removeEventListener('pointermove', this.trackPointer);\n };\n\n scheduleOpen = () => {\n this.cancelClose();\n cancel(this.#openTimer);\n this.#openTimer = later(\n this,\n () => this.open('pointer'),\n SUBMENU_OPEN_DELAY\n );\n };\n\n scheduleClose = () => {\n cancel(this.#openTimer);\n cancel(this.#closeTimer);\n this.#closeTimer = later(this, this.close, SUBMENU_CLOSE_DELAY);\n };\n\n cancelClose = () => {\n cancel(this.#closeTimer);\n this.#closeTimer = undefined;\n };\n\n hoverTrigger = modifier((el: HTMLElement) => {\n this.#triggerEl = el;\n el.addEventListener('pointerenter', this.scheduleOpen);\n el.addEventListener('pointerleave', this.scheduleClose);\n\n return () => {\n el.removeEventListener('pointerenter', this.scheduleOpen);\n el.removeEventListener('pointerleave', this.scheduleClose);\n cancel(this.#openTimer);\n cancel(this.#closeTimer);\n this.stopTracking();\n if (this.#triggerEl === el) {\n this.#triggerEl = undefined;\n }\n };\n });\n\n onTriggerClick = () => {\n if (this.isOpen) {\n this.close();\n } else {\n this.open('pointer');\n }\n };\n\n setOpen = (isOpen: boolean) => {\n this.isOpen = isOpen;\n };\n\n get childContext(): MenuContext {\n return createChildMenuContext(this.args.parentContext, {\n closeSelf: this.close,\n subs: this.#childSubs\n });\n }\n\n get depth(): number {\n return this.args.parentContext.depth + 1;\n }\n\n <template>\n <Popover\n @isOpen={{this.isOpen}}\n @onOpenChange={{this.setOpen}}\n @placement={{if @placement @placement \"right-start\"}}\n @flipOptions={{@flipOptions}}\n @middleware={{@middleware}}\n @shiftOptions={{@shiftOptions}}\n @offsetOptions={{@offsetOptions}}\n @strategy={{@strategy}}\n as |p|\n >\n {{yield\n (hash\n Trigger=(component\n SubTrigger\n item=@item\n anchor=p.anchor\n onTriggerClick=this.onTriggerClick\n isOpen=this.isOpen\n submenuId=this.submenuId\n key=this.triggerKey\n hoverTrigger=this.hoverTrigger\n )\n Menu=(component\n @menu\n Content=p.Content\n context=this.childContext\n depth=this.depth\n menuId=this.submenuId\n openSource=this.openSource\n close=this.close\n )\n isOpen=this.isOpen\n )\n }}\n </Popover>\n </template>\n}\n\ninterface SubTriggerArgs {\n /**\n * @internal\n */\n item: WithBoundArgs<typeof ListboxItem, 'manager'>;\n\n /**\n * @internal\n */\n anchor: ModifierLike<{ Element: HTMLElement }>;\n\n /**\n * @internal\n */\n onTriggerClick: () => void;\n\n /**\n * @internal\n */\n isOpen: boolean;\n\n /**\n * @internal\n */\n submenuId: string;\n\n /**\n * The key this row registers under. Generated by `Sub` when omitted; accept\n * an override so a test or a consumer can address the row by `data-key`.\n */\n key?: string;\n\n /**\n * @internal\n */\n hoverTrigger: ModifierLike<{ Element: HTMLElement }>;\n}\n\nexport interface SubTriggerSignature {\n Args: SubTriggerArgs;\n Element: HTMLLIElement;\n Blocks: { default: [] };\n}\n\n/**\n * The row that opens a submenu.\n *\n * It renders the parent level's own bound `item`, so it registers with that\n * level's `ListManager` and takes part in arrow navigation, type-ahead and the\n * roving tab stop exactly like any other row -- while `@hasSubmenu` keeps it\n * from ever selecting.\n */\nclass SubTrigger extends Component<SubTriggerSignature> {\n /**\n * `Sub` always binds a generated `key` by default (see `Sub`'s\n * `Trigger=(component SubTrigger ... key=this.triggerKey)`), so this is\n * never actually missing -- but `@key` on `SubTriggerArgs` stays optional so\n * a consumer-supplied override can win, and `ListboxItem.key` needs a plain\n * `string`, not `string | undefined`.\n */\n get key(): string {\n assert(\n `Sub's item did not receive a @key -- Sub always binds a generated key by default`,\n this.args.key\n );\n\n return this.args.key;\n }\n\n <template>\n <@item\n @key={{this.key}}\n @hasSubmenu={{true}}\n @isSubmenuOpen={{@isOpen}}\n @submenuId={{@submenuId}}\n @onClick={{@onTriggerClick}}\n {{@anchor}}\n {{@hoverTrigger}}\n data-test-id=\"dropdown-submenu-trigger\"\n ...attributes\n >\n {{yield}}\n </@item>\n </template>\n}\n\nexport { Sub, SubTrigger };\n"],"names":["SUBMENU_OPEN_DELAY","SUBMENU_CLOSE_DELAY","Sub","Component","triggerKey","guidFor","submenuId","Map","g","prototype","tracked","i","openSource","constructor","owner","args","parentContext","registerSub","handle","willDestroy","unregisterSub","stopTracking","cancel","open","source","close","isOpen","startTracking","isDestroyed","isDestroying","trackPointer","event","submenu","document","getElementById","trigger","getBoundingClientRect","content","point","x","clientX","y","clientY","isPointInSafeArea","cancelClose","scheduleClose","addEventListener","removeEventListener","scheduleOpen","later","undefined","hoverTrigger","modifier","el","onTriggerClick","setOpen","childContext","createChildMenuContext","closeSelf","subs","depth","setComponentTemplate","precompileTemplate","strictMode","scope","Popover","hash","SubTrigger","key","assert"],"mappings":";;;;;;;;;;;;;;AAuBA,MAAMA,kBAAA,GAAqB,GAAA;AAE3B;;;;AAIC;AACD,MAAMC,mBAAA,GAAsB,GAAA;AAE5B;;;;;;;;;;;;;;AAcC;AAGD;;;;;AAKC;;AAgED,MAAMC,YAAYC,SAAA,CAAU;AAC1B;;;;;;AAMC;AACDC,EAAAA,aAAa,CAAA,EAAGC,OAAA,CAAQ,IAAI,CAAA,CAAA,YAAA,CAAe;AAE3C;AACAC,EAAAA,YAAY,CAAA,EAAGD,OAAA,CAAQ,IAAI,CAAA,CAAA,QAAA,CAAW;AAEtC;;;;AAIC;AACD,EAAA,UAAU,GAAG,IAAIE,GAAA,EAAY;AAE7B;;;;;;;AAOC;AAPD,EAAA;IAAAC,eAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,QAAA,EAAA,CAQCC,OAAA,CAAA,EAAA,YAAA;AAAA,MAAA,OAAiB,KAAA;AAAA,IAAA,CAAA,CAAA;AAAA;EAAA,OAAA,IAAA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,IAAA,CAAA,MAAO;AACL,MAAA,IAAI,CAACF,IAAI,CAAC,SAAA,CAAA;AACZ,IAAA;EACF,CAAA;EAEAgC,OAAA,GAAW7B,MAAe,IAAA;IACxB,IAAI,CAACA,MAAM,GAAGA,MAAA;EAChB,CAAA;EAEA,IAAI8B,eAA4B;AAC9B,IAAA,OAAOC,uBAAuB,IAAI,CAAC1C,IAAI,CAACC,aAAa,EAAE;MACrD0C,SAAA,EAAW,IAAI,CAACjC,KAAK;MACrBkC,IAAA,EAAM,IAAI,CAAC;AACb,KAAA,CAAA;AACF,EAAA;EAEA,IAAIC,KAAAA,GAAgB;IAClB,OAAO,IAAI,CAAC7C,IAAI,CAACC,aAAa,CAAC4C,KAAK,GAAG,CAAA;AACzC,EAAA;AAEA,EAAA;IAAAC,oBAAA,CAAAC,kBAAA,CAAA,0pBAAA,EAqCA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,OAAA;QAAAC,IAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;AA8CA;;;;;;;;AAQA,MAAMA,mBAAmBhE,SAAA,CAAU;AACjC;;;;;;;EAOA,IAAIiE,GAAAA,GAAc;IAChBC,MAAA,CACE,kFAAkF,EAClF,IAAI,CAACtD,IAAI,CAACqD,GAAG,CAAA;AAGf,IAAA,OAAO,IAAI,CAACrD,IAAI,CAACqD,GAAG;AACtB,EAAA;AAEA,EAAA;IAAAP,oBAAA,CAAAC,kBAAA,CAAA,+OAAA,EAcA;MAAAC,UAAA,EAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;"}
1
+ {"version":3,"file":"sub.js","sources":["../../../../src/components/collections/dropdown/sub.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { tracked } from '@glimmer/tracking';\nimport { guidFor } from '@ember/object/internals';\nimport { assert } from '@ember/debug';\nimport { hash } from '@ember/helper';\nimport { cancel, later } from '@ember/runloop';\nimport { modifier } from 'ember-modifier';\nimport { Popover, type PopoverSignature } from '../../overlays/popover';\nimport { createChildMenuContext } from './menu-context';\nimport type { MenuContext, OpenSource, SubHandle } from './menu-context';\nimport type { ListboxItem } from '../listbox/item';\nimport type Owner from '@ember/owner';\nimport type { Timer } from '@ember/runloop';\nimport type { WithBoundArgs } from '@glint/template';\nimport type { ModifierLike } from '@glint/template';\nimport type { Menu } from './dropdown';\nimport {\n isPointInSafeArea,\n type Point,\n type Rect\n} from '../../../utils/safe-area';\n\n/**\n * Long enough that dragging the pointer across a row on its way somewhere else\n * does not flash a submenu open, short enough to feel immediate when the\n * pointer settles.\n */\nconst SUBMENU_OPEN_DELAY = 100;\n\n/**\n * The pointer has to cross a gap to reach the submenu, so leaving the trigger\n * cannot close it instantly. The safe-area check below decides *where* the\n * pointer is allowed to go; this is how long it has to get there.\n */\nconst SUBMENU_CLOSE_DELAY = 300;\n\n/**\n * The raw, unbound `Menu` component, handed in rather than imported.\n *\n * `Menu` yields `Sub`, and a `Sub` renders a `Menu` for its own level. Passing\n * it in keeps the *runtime* import running one way -- `dropdown.gts` imports\n * `sub.gts` and nothing goes back at runtime, so there is no import cycle to\n * reason about there. This is a TYPE-only import of `Menu` from `dropdown.gts`\n * (see the `import type` above): it disappears entirely once compiled, so it\n * creates no runtime dependency and no cycle. A loose `ComponentLike<...>`\n * shape was tried first and rejected by Glint -- currying `Sub`'s own named\n * args onto a `ComponentLike` signature produced an \"excessively deep type\n * instantiation\" error, because Glint could not resolve the curried result\n * back to a concrete `Blocks` shape. Naming the real `Menu` type here (still\n * without a runtime import) keeps that resolution concrete.\n */\ntype MenuComponent = typeof Menu;\n\n/**\n * The bound-args shape `Sub` produces for its own `s.Menu` -- `Content`,\n * `context`, `depth`, `menuId`, `openSource` and `close` are all curried\n * by `Sub` itself (see the template below), so a consumer only ever supplies\n * the public args (`@selectionMode`, `@onAction`, and so on).\n */\ntype BoundMenuComponent = WithBoundArgs<\n typeof Menu,\n 'context' | 'depth' | 'menuId' | 'openSource' | 'close' | 'Content'\n>;\n\ninterface SubArgs extends Pick<\n PopoverSignature['Args'],\n | 'placement'\n | 'flipOptions'\n | 'middleware'\n | 'shiftOptions'\n | 'offsetOptions'\n | 'strategy'\n> {\n /**\n * @internal\n *\n * Named `item` rather than `Item`: Ember's template compiler treats any\n * named arg whose first letter is not lowercase (`@Item`, `@Menu`, ...) as\n * reserved and refuses to reference it inside a template -- so every named\n * arg here and on `SubTrigger` below is lowercase even though the values\n * yielded to consumers (`Trigger`, `Menu`, `Sub`) stay capitalized block\n * params, which are not subject to that rule.\n */\n item: WithBoundArgs<typeof ListboxItem, 'manager'>;\n\n /**\n * @internal\n *\n * The raw, unbound `Menu` -- `Sub` curries `Content`/`context`/`depth`/\n * `menuId`/`openSource`/`close` onto it itself (see `BoundMenuComponent`\n * above and the template below).\n */\n menu: MenuComponent;\n\n /**\n * @internal\n */\n parentContext: MenuContext;\n}\n\nexport interface SubSignature {\n Args: SubArgs;\n Blocks: {\n default: [\n {\n Trigger: WithBoundArgs<\n typeof SubTrigger,\n | 'item'\n | 'anchor'\n | 'onTriggerClick'\n | 'isOpen'\n | 'submenuId'\n | 'key'\n | 'hoverTrigger'\n >;\n Menu: BoundMenuComponent;\n isOpen: boolean;\n }\n ];\n };\n}\n\nclass Sub extends Component<SubSignature> {\n /**\n * The key the trigger registers under.\n *\n * Generated rather than asked for: a sub-trigger never selects, so its key\n * never reaches `onAction` or `selectedKeys`, and making consumers invent\n * one would be asking for a value nothing observes.\n */\n triggerKey = `${guidFor(this)}-sub-trigger`;\n\n /** The id of this submenu's `role=\"menu\"` element, for `aria-controls`. */\n submenuId = `${guidFor(this)}-submenu`;\n\n /**\n * The registry this level's own children write into. One map for the life of\n * the component -- see `createRootMenuContext` for why it cannot be built in\n * the getter.\n */\n #childSubs = new Map<string, SubHandle>();\n\n /**\n * The popover is driven in controlled mode.\n *\n * The parent level has to be able to open this submenu from its own\n * ArrowRight handler, through the registered `SubHandle` -- so the open\n * state has to live somewhere reachable from outside the Popover's block,\n * which the yielded `open`/`close` are not.\n */\n @tracked isOpen = false;\n\n /**\n * Not tracked: it is read once, when the freshly mounted `Listbox`\n * constructs its `ListManager`, and never rendered.\n */\n openSource: OpenSource = 'pointer';\n\n constructor(owner: Owner, args: SubArgs) {\n super(owner, args);\n this.args.parentContext.registerSub(this.triggerKey, this.handle);\n }\n\n willDestroy(): void {\n super.willDestroy();\n this.args.parentContext.unregisterSub(this.triggerKey);\n this.stopTracking();\n cancel(this.#openTimer);\n this.cancelClose();\n }\n\n handle: SubHandle = {\n open: (source: OpenSource) => this.open(source),\n close: () => this.close(),\n isPointSafe: (point: Point) => this.isPointSafe(point)\n };\n\n open = (source: OpenSource = 'pointer') => {\n this.closeSiblings();\n this.openSource = source;\n this.isOpen = true;\n this.startTracking();\n };\n\n /**\n * Close every other submenu at this level.\n *\n * Two sub-triggers next to each other would otherwise both stay on screen:\n * the abandoned level's own close is on a timer, and the pointer moving\n * toward the new one keeps re-arming it. A level's siblings are exactly the\n * other entries in the parent's registry, so closing them as this one opens\n * makes the two states mutually exclusive in a single render -- there is no\n * frame in which both are painted.\n */\n closeSiblings = () => {\n for (const [key, handle] of this.args.parentContext.subs) {\n if (key !== this.triggerKey) {\n handle.close();\n }\n }\n };\n\n close = () => {\n this.stopTracking();\n // Not just bookkeeping: a close that arrives from elsewhere -- a sibling\n // opening, ArrowLeft -- while a timer is pending would otherwise leave\n // that timer to fire later and close a level the pointer had meanwhile\n // brought back.\n this.cancelClose();\n\n if (this.isDestroyed || this.isDestroying) {\n return;\n }\n this.isOpen = false;\n };\n\n #openTimer?: Timer;\n #closeTimer?: Timer;\n\n /**\n * The trigger element, captured by `hoverTrigger`, so the safe area can be\n * measured without querying for it.\n */\n #triggerEl?: HTMLElement;\n\n /**\n * Whether the pointer is currently being tracked against the safe area.\n * Guards against installing the document listener twice.\n */\n #isTracking = false;\n\n /**\n * Keeps the submenu open while the pointer is heading for it.\n *\n * The pointer has to cross a gap to reach a submenu, and it crosses it\n * diagonally -- so `pointerleave` on the trigger cannot mean \"close\". While\n * the submenu is open, every pointer move is tested against the safe area:\n * inside it, the pending close is cancelled; outside it, the pointer has\n * clearly gone elsewhere and the submenu closes.\n *\n * This also handles hovering a sibling row with no extra wiring: a sibling\n * is outside the safe area, so moving onto one closes the submenu.\n */\n trackPointer = (event: PointerEvent) => {\n // Nothing to measure against yet -- neither close nor cancel, just wait\n // for the next move.\n if (!this.#triggerEl || !document.getElementById(this.submenuId)) {\n return;\n }\n\n if (this.isPointSafe({ x: event.clientX, y: event.clientY })) {\n this.cancelClose();\n } else {\n this.scheduleClose();\n }\n };\n\n /**\n * Whether the pointer is somewhere that should keep this level open.\n *\n * Its own safe area, or -- recursively -- any open descendant's. A third\n * level opens to the right of the second, well outside the polygon that\n * runs from *this* trigger to *this* content, so a level that only\n * consulted its own area would close the instant the pointer went deeper,\n * taking every level below it along. Asking the children means the chain\n * survives exactly as long as the pointer is still somewhere in it.\n */\n isPointSafe = (point: Point): boolean => {\n if (!this.isOpen) {\n return false;\n }\n\n const submenu = document.getElementById(this.submenuId);\n if (!this.#triggerEl || !submenu) {\n return false;\n }\n\n const trigger: Rect = this.#triggerEl.getBoundingClientRect();\n const content: Rect = submenu.getBoundingClientRect();\n\n if (isPointInSafeArea(point, trigger, content)) {\n return true;\n }\n\n for (const handle of this.#childSubs.values()) {\n if (handle.isPointSafe(point)) {\n return true;\n }\n }\n\n return false;\n };\n\n startTracking = () => {\n if (this.#isTracking) {\n return;\n }\n this.#isTracking = true;\n document.addEventListener('pointermove', this.trackPointer);\n };\n\n stopTracking = () => {\n if (!this.#isTracking) {\n return;\n }\n this.#isTracking = false;\n document.removeEventListener('pointermove', this.trackPointer);\n };\n\n scheduleOpen = () => {\n this.cancelClose();\n cancel(this.#openTimer);\n this.#openTimer = later(\n this,\n () => this.open('pointer'),\n SUBMENU_OPEN_DELAY\n );\n };\n\n /**\n * Arm the close, but never re-arm one already pending.\n *\n * This runs from every `pointermove` that lands outside the safe area, so\n * cancelling and re-scheduling here would let a pointer that simply keeps\n * moving -- across a sibling row, into a sibling's submenu, anywhere on the\n * page -- push the close out indefinitely and strand the level open. Once\n * the pointer has left, the countdown is from that moment and nothing\n * outside the safe area extends it; only `cancelClose` (the pointer coming\n * back inside) stops it.\n */\n scheduleClose = () => {\n cancel(this.#openTimer);\n\n if (this.#closeTimer) {\n return;\n }\n\n this.#closeTimer = later(this, this.close, SUBMENU_CLOSE_DELAY);\n };\n\n cancelClose = () => {\n cancel(this.#closeTimer);\n this.#closeTimer = undefined;\n };\n\n hoverTrigger = modifier((el: HTMLElement) => {\n this.#triggerEl = el;\n el.addEventListener('pointerenter', this.scheduleOpen);\n el.addEventListener('pointerleave', this.scheduleClose);\n\n return () => {\n el.removeEventListener('pointerenter', this.scheduleOpen);\n el.removeEventListener('pointerleave', this.scheduleClose);\n cancel(this.#openTimer);\n this.cancelClose();\n this.stopTracking();\n if (this.#triggerEl === el) {\n this.#triggerEl = undefined;\n }\n };\n });\n\n onTriggerClick = () => {\n if (this.isOpen) {\n this.close();\n } else {\n this.open('pointer');\n }\n };\n\n setOpen = (isOpen: boolean) => {\n this.isOpen = isOpen;\n };\n\n get childContext(): MenuContext {\n return createChildMenuContext(this.args.parentContext, {\n closeSelf: this.close,\n subs: this.#childSubs\n });\n }\n\n get depth(): number {\n return this.args.parentContext.depth + 1;\n }\n\n <template>\n <Popover\n @isOpen={{this.isOpen}}\n @onOpenChange={{this.setOpen}}\n @placement={{if @placement @placement \"right-start\"}}\n @flipOptions={{@flipOptions}}\n @middleware={{@middleware}}\n @shiftOptions={{@shiftOptions}}\n @offsetOptions={{@offsetOptions}}\n @strategy={{@strategy}}\n as |p|\n >\n {{yield\n (hash\n Trigger=(component\n SubTrigger\n item=@item\n anchor=p.anchor\n onTriggerClick=this.onTriggerClick\n isOpen=this.isOpen\n submenuId=this.submenuId\n key=this.triggerKey\n hoverTrigger=this.hoverTrigger\n )\n Menu=(component\n @menu\n Content=p.Content\n context=this.childContext\n depth=this.depth\n menuId=this.submenuId\n openSource=this.openSource\n close=this.close\n )\n isOpen=this.isOpen\n )\n }}\n </Popover>\n </template>\n}\n\ninterface SubTriggerArgs {\n /**\n * @internal\n */\n item: WithBoundArgs<typeof ListboxItem, 'manager'>;\n\n /**\n * @internal\n */\n anchor: ModifierLike<{ Element: HTMLElement }>;\n\n /**\n * @internal\n */\n onTriggerClick: () => void;\n\n /**\n * @internal\n */\n isOpen: boolean;\n\n /**\n * @internal\n */\n submenuId: string;\n\n /**\n * The key this row registers under. Generated by `Sub` when omitted; accept\n * an override so a test or a consumer can address the row by `data-key`.\n */\n key?: string;\n\n /**\n * @internal\n */\n hoverTrigger: ModifierLike<{ Element: HTMLElement }>;\n}\n\nexport interface SubTriggerSignature {\n Args: SubTriggerArgs;\n Element: HTMLLIElement;\n Blocks: { default: [] };\n}\n\n/**\n * The row that opens a submenu.\n *\n * It renders the parent level's own bound `item`, so it registers with that\n * level's `ListManager` and takes part in arrow navigation, type-ahead and the\n * roving tab stop exactly like any other row -- while `@hasSubmenu` keeps it\n * from ever selecting.\n */\nclass SubTrigger extends Component<SubTriggerSignature> {\n /**\n * `Sub` always binds a generated `key` by default (see `Sub`'s\n * `Trigger=(component SubTrigger ... key=this.triggerKey)`), so this is\n * never actually missing -- but `@key` on `SubTriggerArgs` stays optional so\n * a consumer-supplied override can win, and `ListboxItem.key` needs a plain\n * `string`, not `string | undefined`.\n */\n get key(): string {\n assert(\n `Sub's item did not receive a @key -- Sub always binds a generated key by default`,\n this.args.key\n );\n\n return this.args.key;\n }\n\n <template>\n <@item\n @key={{this.key}}\n @hasSubmenu={{true}}\n @isSubmenuOpen={{@isOpen}}\n @submenuId={{@submenuId}}\n @onClick={{@onTriggerClick}}\n {{@anchor}}\n {{@hoverTrigger}}\n data-test-id=\"dropdown-submenu-trigger\"\n ...attributes\n >\n {{yield}}\n </@item>\n </template>\n}\n\nexport { Sub, SubTrigger };\n"],"names":["SUBMENU_OPEN_DELAY","SUBMENU_CLOSE_DELAY","Sub","Component","triggerKey","guidFor","submenuId","Map","g","prototype","tracked","i","openSource","constructor","owner","args","parentContext","registerSub","handle","willDestroy","unregisterSub","stopTracking","cancel","cancelClose","open","source","close","isPointSafe","point","closeSiblings","isOpen","startTracking","key","subs","isDestroyed","isDestroying","trackPointer","event","document","getElementById","x","clientX","y","clientY","scheduleClose","submenu","trigger","getBoundingClientRect","content","isPointInSafeArea","values","addEventListener","removeEventListener","scheduleOpen","later","undefined","hoverTrigger","modifier","el","onTriggerClick","setOpen","childContext","createChildMenuContext","closeSelf","depth","setComponentTemplate","precompileTemplate","strictMode","scope","Popover","hash","SubTrigger","assert"],"mappings":";;;;;;;;;;;;;;AA2BA,MAAMA,kBAAA,GAAqB,GAAA;AAE3B;;;;AAIC;AACD,MAAMC,mBAAA,GAAsB,GAAA;AAE5B;;;;;;;;;;;;;;AAcC;AAGD;;;;;AAKC;;AAgED,MAAMC,YAAYC,SAAA,CAAU;AAC1B;;;;;;AAMC;AACDC,EAAAA,aAAa,CAAA,EAAGC,OAAA,CAAQ,IAAI,CAAA,CAAA,YAAA,CAAe;AAE3C;AACAC,EAAAA,YAAY,CAAA,EAAGD,OAAA,CAAQ,IAAI,CAAA,CAAA,QAAA,CAAW;AAEtC;;;;AAIC;AACD,EAAA,UAAU,GAAG,IAAIE,GAAA,EAAY;AAE7B;;;;;;;AAOC;AAPD,EAAA;IAAAC,eAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,QAAA,EAAA,CAQCC,OAAA,CAAA,EAAA,YAAA;AAAA,MAAA,OAAiB,KAAA;AAAA,IAAA,CAAA,CAAA;AAAA;EAAA,OAAA,IAAAC,2BAAA,CAAA,IAAA,EAAA,QAAA,CAAA,EAAA,MAAA;AAElB;;;;AAIAC,EAAAA,UAAA,GAAyB,SAAA;AAEzBC,EAAAA,WAAAA,CAAYC,KAAY,EAAEC,IAAa,EAAE;AACvC,IAAA,KAAK,CAACD,KAAA,EAAO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D,IAAI,CAACC,aAAa,CAACgD,KAAK,GAAG,CAAA;AACzC,EAAA;AAEA,EAAA;IAAAC,oBAAA,CAAAC,kBAAA,CAAA,0pBAAA,EAqCA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,OAAA;QAAAC,IAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;AA8CA;;;;;;;;AAQA,MAAMA,mBAAmBpE,SAAA,CAAU;AACjC;;;;;;;EAOA,IAAI6B,GAAAA,GAAc;IAChBwC,MAAA,CACE,kFAAkF,EAClF,IAAI,CAACzD,IAAI,CAACiB,GAAG,CAAA;AAGf,IAAA,OAAO,IAAI,CAACjB,IAAI,CAACiB,GAAG;AACtB,EAAA;AAEA,EAAA;IAAAiC,oBAAA,CAAAC,kBAAA,CAAA,+OAAA,EAcA;MAAAC,UAAA,EAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "frontile",
3
- "version": "0.18.0-beta.5",
3
+ "version": "0.18.0",
4
4
  "description": "Component Library for Ember Octane apps",
5
5
  "keywords": [
6
6
  "ember-addon",
@@ -94,7 +94,7 @@
94
94
  "@embroider/addon-shim": "^1.10.3",
95
95
  "@embroider/macros": "^1.21.1",
96
96
  "@floating-ui/dom": "^1.8.0",
97
- "@frontile/theme": "^0.18.0-beta.5",
97
+ "@frontile/theme": "^0.18.0",
98
98
  "@glint/template": "^1.9.0",
99
99
  "@universal-ember/table": "^4.0.0",
100
100
  "date-fns": "^4.4.0",
@@ -152,5 +152,5 @@
152
152
  "./services/notifications.js": "./dist/_app_/services/notifications.js"
153
153
  }
154
154
  },
155
- "gitHead": "b80d05f59453fed8d6caacb3a05f753a0efc1467"
155
+ "gitHead": "01c5a190c6888b5bb159eba96888663010592a1f"
156
156
  }