diff --git a/.changeset/nested-app-hotkeys.md b/.changeset/nested-app-hotkeys.md new file mode 100644 index 000000000..c060a5b84 --- /dev/null +++ b/.changeset/nested-app-hotkeys.md @@ -0,0 +1,5 @@ +--- +'@tanstack/hotkeys': patch +--- + +App hotkeys spread from one `defineAppHotkeys` call into another keep the kind of their default hotkey, so adapters accept `timeout` or `requireReset` for them, and an entry that replaces a spread-in `hotkey` or `options` is checked like any other declaration. A large app can declare its hotkeys in several files and combine them with full types. diff --git a/.intent/review-state.json b/.intent/review-state.json index 74edee1ca..4f1aa1da6 100644 --- a/.intent/review-state.json +++ b/.intent/review-state.json @@ -3,9 +3,9 @@ "baseline": "ad56a4b0dbf3c34d8552eca2cc88c5c7000d520a", "items": { "skill:packages/alpine-hotkeys/skills/alpine-hotkeys/SKILL.md": { - "fingerprint": "efed627cc138c053376acfb13cc3297832b39c451b6eaac239cac53031de0bee", + "fingerprint": "37e0681d1445a2b72779ae5d23fe1daaec13f44ec5c013199a0d9281542996e0", "snapshot": { - "docs/framework/alpine/guides/app-hotkeys.md": "f52f21ea98e6f6a32e8c1d7a593c2c5bbe4cd671d997bae3e7b116737f34d967", + "docs/framework/alpine/guides/app-hotkeys.md": "9422d7d872521cc5fd2246b07408f10666790fa625fb78df519217b541873472", "docs/framework/alpine/quick-start.md": "822d70174d351fa7b2fe2e773b4fb3a2b558191386001025cdf2efac7b0c7854", "packages/alpine-hotkeys/skills/alpine-hotkeys/SKILL.md": "9fbcfd1931996b186aed72bd06bae929b68dd83840b170a33cad1065c11db2e9", "packages/alpine-hotkeys/skills/alpine-hotkeys/references/app-hotkeys.md": "0fb12f409b5aec0999df3799f86d116b24d4d4d00131041e63d59264a7af1c98", @@ -17,12 +17,12 @@ "packages/alpine-hotkeys/src/hotkeysPlugin.ts": "35ffb8b772a178690d956f3b3a165b577c40d1723e186f5ffdef4a985f7be90b", "packages/alpine-hotkeys/src/scope.ts": "4521cc6c2abb1706bdd2b73e158e67b2eef7f5d325e22b1f50b65cf473b56905" }, - "head": "7cf53a0cf4759de322e2bdf45b5b834960d68778", + "head": "00217cf3f2b203d406d1097656f2275156026943", "outcome": "no-change", - "reason": "The changed guides add trigger(), call-site meta, and the enabled getter, which the core skills own; this framework skill makes no claim that meta comes only from the declaration or that enabled is boolean-only, and its wiring examples stay valid. Vue already resolves a getter enabled as a reactive source; only a code comment changed.", + "reason": "The guide gained a section on splitting declarations across files. This framework skill does not show split declarations, and app-hotkeys carries the new pitfall.", "evidence": [ - "packages/alpine-hotkeys/skills/alpine-hotkeys/SKILL.md", - "pnpm -C packages/hotkeys exec vitest run (2182 passed, including tests/trigger.test.ts); nx test:lib/test:types/test:eslint/test:build for 20 projects passed; intent validate packages/hotkeys/skills passed. Not run: fresh-consumer sessions." + "docs/framework/alpine/guides/app-hotkeys.md", + "packages/hotkeys vitest run: 61 files, 2186 tests passed; test:types passed; intent validate passed. Not run: fresh-consumer sessions." ] }, "skill:packages/angular-hotkeys/skills/angular-hotkeys/SKILL.md": { @@ -44,9 +44,9 @@ "evidence": ["packages/angular-hotkeys/src/injectHotkeyRecorder.ts"] }, "skill:packages/ember-hotkeys/skills/ember-hotkeys/SKILL.md": { - "fingerprint": "4594e45858c6d948c2635844c953f55e7787792b67f1dd7ba7a2e7535bbfefb8", + "fingerprint": "3ee32dabee46e6852f1e13ca1bb89f3fa2601d586e716509fae66d3b748a306f", "snapshot": { - "docs/framework/ember/guides/app-hotkeys.md": "539daeb1bae8b47b39ede5cb9ba093790e445842f8189cd3bfc4265aa23f7902", + "docs/framework/ember/guides/app-hotkeys.md": "edcbcdaad431daf08dc0420f614d0a289177657879f18fceb230154927c372fb", "docs/framework/ember/quick-start.md": "2c8dc08cae925871408200ef4636adbac20cb23312d18773d726ca340c91f0e1", "packages/ember-hotkeys/skills/ember-hotkeys/SKILL.md": "80f84449e5baf6eee842e9885fe446ce673e388c9730ca62489d87a3e4f7f416", "packages/ember-hotkeys/skills/ember-hotkeys/references/app-hotkeys.md": "46d43786e0d2a5fca97c203f3e998bb6295ce45c16f181612973fd3788c1acc8", @@ -58,23 +58,23 @@ "packages/ember-hotkeys/src/useHotkeyRecorder.ts": "67e6ac60574e3d510f8d6199a5eb92303b6315051d1fb8a42decf75dcebc070b", "packages/ember-hotkeys/src/useHotkeys.ts": "963345b3720ddefec8677b9b9d9dfa2b6346e22b32f9f2034d406b43e5c5ccf8" }, - "head": "7cf53a0cf4759de322e2bdf45b5b834960d68778", + "head": "00217cf3f2b203d406d1097656f2275156026943", "outcome": "no-change", - "reason": "The changed guides add trigger(), call-site meta, and the enabled getter, which the core skills own; this framework skill makes no claim that meta comes only from the declaration or that enabled is boolean-only, and its wiring examples stay valid. Vue already resolves a getter enabled as a reactive source; only a code comment changed.", + "reason": "The guide gained a section on splitting declarations across files. This framework skill does not show split declarations, and app-hotkeys carries the new pitfall.", "evidence": [ - "packages/ember-hotkeys/skills/ember-hotkeys/SKILL.md", - "pnpm -C packages/hotkeys exec vitest run (2182 passed, including tests/trigger.test.ts); nx test:lib/test:types/test:eslint/test:build for 20 projects passed; intent validate packages/hotkeys/skills passed. Not run: fresh-consumer sessions." + "docs/framework/ember/guides/app-hotkeys.md", + "packages/hotkeys vitest run: 61 files, 2186 tests passed; test:types passed; intent validate passed. Not run: fresh-consumer sessions." ] }, "skill:packages/hotkeys/skills/app-hotkeys/SKILL.md": { - "fingerprint": "fe43854068a515c8f615c1dd592974e7b5a86d7c0f909c83ad8305bf9250f686", + "fingerprint": "429d527f33560a7d431b653761967e0ae9cc7ccdcca8f86136b53db07c02920c", "snapshot": { - "docs/framework/react/guides/app-hotkeys.md": "845fcdd4e86f595f02fb0d7941466148f9c6cbe44b3b7311380f8cd6410c37ee", + "docs/framework/react/guides/app-hotkeys.md": "84085c3644fe0fbeab6fc4850866e26d75404d02fad7039336ac5555bdfb9f7a", "docs/framework/react/guides/cheat-sheet-ui-helpers.md": "a2c4c3add145ef9f04043edc7e2ca8b3fe07acdfea8c17144011da967ddfc318", "docs/framework/react/guides/custom-hotkey-recording.md": "4fe7986194e14c13976027c15164492bcdcea652e8379e3f0fe84fa5d84f4847", - "packages/hotkeys/skills/app-hotkeys/SKILL.md": "b505242472b0e519f9ff6649b21074e96937595fa647ead904fc0ea7c4679730", + "packages/hotkeys/skills/app-hotkeys/SKILL.md": "454b7d1321a4f4d1a5aa4dd363466fb3acdd5f85935daa519768dc0a64622bcd", "packages/hotkeys/skills/app-hotkeys/references/recording.md": "742e56e73e58abfbbe354ab03abca29e3ebe08d79a84b43daf842b594d6e2b4c", - "packages/hotkeys/src/app-hotkeys.ts": "b2965c516985dcde1f0158aac48f2706db43a3c767b3de6e82d06c8f48ad4db2", + "packages/hotkeys/src/app-hotkeys.ts": "333fd70aa19406169d384344eba3339c8e757519f02e1a1df2d5c0758d0f1f85", "packages/hotkeys/src/conflicts.ts": "3c8628500aee3e7ba14ec78411b5f5398fd66cbc00359ffdf227a81729a76fe5", "packages/hotkeys/src/hotkey-recorder.ts": "1b194de54bbd7d94c7a3ee581103651eed7077334adac55522ff499c951a2d2c", "packages/react-hotkeys/tests/skills/shortcut-settings/fixture.tsx": "ecc6155241ebccca4ef4cd76e8925b3abeec73e9d88e6906bdf70e4c604788aa", @@ -86,12 +86,12 @@ "packages/react-hotkeys/tests/skills/shortcut-settings/solution.tsx": "3441296dea51490188d34991428fe2b8bf11ce6fafbdf6e2f7595ff7082f1400", "packages/react-hotkeys/tests/skills/shortcut-settings/task.md": "7163ed96e6694c745461f0edaf296b353906cfdb868f9c5df7d08ee01a4ba0ea" }, - "head": "345b94ef72a6b78b6fa8de153b98fa6f73e8ecfd", - "outcome": "no-change", - "reason": "Review feedback round: keyup chords keep their release when a getter enables them during their own keydown; app hotkey meta layers merge without declared meta; palette examples use buttons and filter status !== 'disabled'. The skill text still matches: the palette pitfall says trigger() checks only enabled and runs suspended hotkeys, and no skill sentence covers keyup getter timing or meta layer merging.", + "head": "00217cf3f2b203d406d1097656f2275156026943", + "outcome": "updated", + "reason": "Added a pitfall: split a large catalog with nested defineAppHotkeys calls rather than as const satisfies, and keep ids unique across files.", "evidence": [ - "docs/framework/react/guides/cheat-sheet-ui-helpers.md", - "pnpm -C packages/hotkeys exec vitest run (all passed, including tests/trigger.test.ts); intent validate packages/hotkeys/skills passed. Not run: fresh-consumer sessions." + "packages/hotkeys/src/app-hotkeys.ts", + "packages/hotkeys tests and types pass; pnpm test:pr 317/317 tasks passed; intent validate passed. Not run: fresh-consumer sessions." ] }, "skill:packages/hotkeys/skills/hotkeys-core/SKILL.md": { @@ -125,9 +125,9 @@ ] }, "skill:packages/lit-hotkeys/skills/lit-hotkeys/SKILL.md": { - "fingerprint": "3d8d3164d1d21f0d68fc8ad9419d7bcb4e1a2a233703710181ccd3973b2c9c96", + "fingerprint": "06aec1094d240b8929910df4607575d4f61e8a9f2c972e9f3c465e0e77481a96", "snapshot": { - "docs/framework/lit/guides/app-hotkeys.md": "a9cbb7e27099887b247638ec9fb5b08eb07ee7a21430f2c3e62b76cd7f108959", + "docs/framework/lit/guides/app-hotkeys.md": "2da9237f5bd03e5ee8c7e9b3b66285dbd915ed096f6f90d83d512a5734158e59", "docs/framework/lit/quick-start.md": "23152e6740cda01b503a85357b6cca35d948ae23d9dc4703c7fddc3b53c354f3", "packages/lit-hotkeys/skills/lit-hotkeys/SKILL.md": "326b0a1ddd9579c65389e755d5a2e0a69512ef7f91aca21bda7db9c0ddb51521", "packages/lit-hotkeys/skills/lit-hotkeys/references/app-hotkeys.md": "3c5b805f628d0b14361e43944283f3b7271362cc5831def6406e677ce21f2678", @@ -136,12 +136,12 @@ "packages/lit-hotkeys/src/controllers/hotkey.ts": "79d2602f8855075599d0fb7250e865a3b525eda5a5dc274a3c386edd1abe734e", "packages/lit-hotkeys/src/decorators/hotkey.ts": "ff03f664004dd013a2cdd984e7587f4f8c3ac651bf98efc9918a8296393d13ef" }, - "head": "7cf53a0cf4759de322e2bdf45b5b834960d68778", + "head": "00217cf3f2b203d406d1097656f2275156026943", "outcome": "no-change", - "reason": "The changed guides add trigger(), call-site meta, and the enabled getter, which the core skills own; this framework skill makes no claim that meta comes only from the declaration or that enabled is boolean-only, and its wiring examples stay valid. Vue already resolves a getter enabled as a reactive source; only a code comment changed.", + "reason": "The guide gained a section on splitting declarations across files. This framework skill does not show split declarations, and app-hotkeys carries the new pitfall.", "evidence": [ - "packages/lit-hotkeys/skills/lit-hotkeys/SKILL.md", - "pnpm -C packages/hotkeys exec vitest run (2182 passed, including tests/trigger.test.ts); nx test:lib/test:types/test:eslint/test:build for 20 projects passed; intent validate packages/hotkeys/skills passed. Not run: fresh-consumer sessions." + "docs/framework/lit/guides/app-hotkeys.md", + "packages/hotkeys vitest run: 61 files, 2186 tests passed; test:types passed; intent validate passed. Not run: fresh-consumer sessions." ] }, "skill:packages/octane-hotkeys/skills/octane-hotkeys/SKILL.md": { @@ -272,24 +272,24 @@ ] }, "planning:_artifacts": { - "fingerprint": "8c27cea85abbacb56bdcd37f97dda3772ad7489d6560e61833aa6b6b8695887f", + "fingerprint": "44450355cd9c53d46fad6e8d04fe598361ab0f4adefa46980f19913ee09f99e6", "snapshot": { - "_artifacts/domain_map.yaml": "c54de2bdc7cdec51ad1917d14dc77cae4d0157221b7be5187983658eeee99b83", - "_artifacts/skill_spec.md": "183cee9b394f323ee97d7a41fb173a1b2835bcc95904884bd12b1e3d2f8069f1", + "_artifacts/domain_map.yaml": "fd7871cd1e1825435a188393cea39ee713f75265a07f7d2b05694881b01f1efe", + "_artifacts/skill_spec.md": "88f06cd2cdfe465571e7659db26c03d8e0df8e014126fa5165020b562d849123", "_artifacts/skill_tree.yaml": "28586eb71e346a16cbaa064559562cb08199a684904db6dd0684251428afd35e", - "docs/framework/alpine/guides/app-hotkeys.md": "f52f21ea98e6f6a32e8c1d7a593c2c5bbe4cd671d997bae3e7b116737f34d967", + "docs/framework/alpine/guides/app-hotkeys.md": "9422d7d872521cc5fd2246b07408f10666790fa625fb78df519217b541873472", "docs/framework/alpine/quick-start.md": "822d70174d351fa7b2fe2e773b4fb3a2b558191386001025cdf2efac7b0c7854", "docs/framework/angular/guides/provide-hotkeys-and-scopes.md": "2cf7b561968f2caf257fd4676221a4f89f26ee039560b03c6731d37e851b0239", "docs/framework/angular/quick-start.md": "6853a3618a349160d18f61b97e8996c3ad4709930d4048192a724afa0b291690", - "docs/framework/ember/guides/app-hotkeys.md": "539daeb1bae8b47b39ede5cb9ba093790e445842f8189cd3bfc4265aa23f7902", + "docs/framework/ember/guides/app-hotkeys.md": "edcbcdaad431daf08dc0420f614d0a289177657879f18fceb230154927c372fb", "docs/framework/ember/quick-start.md": "2c8dc08cae925871408200ef4636adbac20cb23312d18773d726ca340c91f0e1", - "docs/framework/lit/guides/app-hotkeys.md": "a9cbb7e27099887b247638ec9fb5b08eb07ee7a21430f2c3e62b76cd7f108959", + "docs/framework/lit/guides/app-hotkeys.md": "2da9237f5bd03e5ee8c7e9b3b66285dbd915ed096f6f90d83d512a5734158e59", "docs/framework/lit/quick-start.md": "23152e6740cda01b503a85357b6cca35d948ae23d9dc4703c7fddc3b53c354f3", "docs/framework/octane/guides/hotkeys-provider-and-scopes.md": "9cbd09514a6d869bb2a9da0b57b743a2fe5b233bc13f330a369316fc4c820f4b", "docs/framework/octane/quick-start.md": "239e2bc768ad1a9ebb0c6c972756d23ff6d78752d9355da6bb566eb4cd1591d1", "docs/framework/preact/guides/hotkeys-provider-and-scopes.md": "1bc452334df3ef96debf4377310266eca28dbc6330f38a403521c50e45fd076b", "docs/framework/preact/quick-start.md": "247a2beda75d6c50bc0345aa8a9ef0a247e588fe8f4cfe7ea7733c6c8c9f15db", - "docs/framework/react/guides/app-hotkeys.md": "845fcdd4e86f595f02fb0d7941466148f9c6cbe44b3b7311380f8cd6410c37ee", + "docs/framework/react/guides/app-hotkeys.md": "84085c3644fe0fbeab6fc4850866e26d75404d02fad7039336ac5555bdfb9f7a", "docs/framework/react/guides/cheat-sheet-ui-helpers.md": "a2c4c3add145ef9f04043edc7e2ca8b3fe07acdfea8c17144011da967ddfc318", "docs/framework/react/guides/custom-hotkey-recording.md": "4fe7986194e14c13976027c15164492bcdcea652e8379e3f0fe84fa5d84f4847", "docs/framework/react/guides/hotkeys-provider-and-scopes.md": "57039ef29571e18c058ea77d104140e33c9b7fbda7de561c4d77247a47a566ce", @@ -328,12 +328,12 @@ "packages/ember-hotkeys/src/useHotkey.ts": "afddc8e2c34ec8bb6351d4162d38710c60927c60cbb0cc6695b5dfd751d32159", "packages/ember-hotkeys/src/useHotkeyRecorder.ts": "67e6ac60574e3d510f8d6199a5eb92303b6315051d1fb8a42decf75dcebc070b", "packages/ember-hotkeys/src/useHotkeys.ts": "963345b3720ddefec8677b9b9d9dfa2b6346e22b32f9f2034d406b43e5c5ccf8", - "packages/hotkeys/skills/app-hotkeys/SKILL.md": "b505242472b0e519f9ff6649b21074e96937595fa647ead904fc0ea7c4679730", + "packages/hotkeys/skills/app-hotkeys/SKILL.md": "454b7d1321a4f4d1a5aa4dd363466fb3acdd5f85935daa519768dc0a64622bcd", "packages/hotkeys/skills/app-hotkeys/references/recording.md": "742e56e73e58abfbbe354ab03abca29e3ebe08d79a84b43daf842b594d6e2b4c", "packages/hotkeys/skills/hotkeys-core/SKILL.md": "6a7f07c7d3d35af8c02dcc8835e97ae5a39ca498596665dd1e8894578d707062", "packages/hotkeys/skills/hotkeys-core/references/scopes.md": "1139da465c06e76ee1d489cb14fc3ce952011666b67f64855846805c241c2108", "packages/hotkeys/skills/hotkeys-core/references/testing.md": "c2957eaac34ca431832069156504cf7434dcb96d5227bcb7cbb2129dc8e979bd", - "packages/hotkeys/src/app-hotkeys.ts": "b2965c516985dcde1f0158aac48f2706db43a3c767b3de6e82d06c8f48ad4db2", + "packages/hotkeys/src/app-hotkeys.ts": "333fd70aa19406169d384344eba3339c8e757519f02e1a1df2d5c0758d0f1f85", "packages/hotkeys/src/conflicts.ts": "3c8628500aee3e7ba14ec78411b5f5398fd66cbc00359ffdf227a81729a76fe5", "packages/hotkeys/src/hotkey-manager.ts": "787f629388c0fc5ef9b656efbc39efd18c62cbee0f96b7c0ef6673abc4c1f6fe", "packages/hotkeys/src/hotkey-recorder.ts": "1b194de54bbd7d94c7a3ee581103651eed7077334adac55522ff499c951a2d2c", @@ -403,12 +403,12 @@ "packages/vue-hotkeys/src/useHotkeyRecorder.ts": "f9090de677350d72ae3e1732eab11e5b89b5cf00021f2cc5e88d2fe3f2fb743d", "packages/vue-hotkeys/src/useHotkeys.ts": "219ded7bd27e250567817a9e74cb6c0032a58c1da6a6be81e820f4a67ab6c8c7" }, - "head": "e921fb8292343f4d8f5f264030b0d5b48594a371", + "head": "00217cf3f2b203d406d1097656f2275156026943", "outcome": "updated", - "reason": "Review feedback round: the guides now limit the keyup release promise to keyup chords, matching the enabled JSDoc. domain_map.yaml palette pattern now type-checks and filters disabled registrations; skill_spec.md and skill_tree.yaml stay accurate.", + "reason": "domain_map.yaml records the satisfies-instead-of-nested-defineAppHotkeys failure mode; skill_spec.md lists it and adds a source sync entry. skill_tree.yaml stays accurate.", "evidence": [ - "docs/framework/react/guides/hotkeys.md", - "pnpm -C packages/hotkeys exec vitest run (all passed, including tests/trigger.test.ts); intent validate packages/hotkeys/skills passed. Not run: fresh-consumer sessions." + "_artifacts/skill_spec.md", + "packages/hotkeys tests and types pass; pnpm test:pr 317/317 tasks passed; intent validate passed. Not run: fresh-consumer sessions." ] }, "source:.changeset/intent-skills.md": { @@ -2374,84 +2374,108 @@ ] }, "source:docs/reference/classes/AppHotkeysStore.md": { - "fingerprint": "06ee6a69b907f9852f64237bb6217db32406f33ece7e362b0481c304ea2e6db2", + "fingerprint": "ee56a9dac570650aeb4c27efbc832fb750260d755269945d6130b5291b60402d", "snapshot": { - "docs/reference/classes/AppHotkeysStore.md": "105dc34a84c1c43d7af8a89aeb9b7a0576b07bfe82744ff34df0deda18fed493" + "docs/reference/classes/AppHotkeysStore.md": "079967f338979e3a38a8dd909c5c5d0da988beebd91a9f7833b4c1a7a613a64f" }, - "head": "cd1c66aab538ccac294e72ee36ae4466fa9b2d2b", + "head": "00217cf3f2b203d406d1097656f2275156026943", "outcome": "no-change", - "reason": "Regenerated reference page. The skills cover the formatForAria, createFormatter, and suspendCharacterKeys API changes.", - "evidence": ["packages/hotkeys/skills/hotkeys-core/SKILL.md"] + "reason": "Generated by pnpm generate-docs; the DefinedAppHotkeys doc text and line numbers changed. Guidance reviewed under app-hotkeys.", + "evidence": [ + "docs/reference/classes/AppHotkeysStore.md", + "packages/hotkeys tests and types pass; pnpm test:pr 317/317 tasks passed; intent validate passed. Not run: fresh-consumer sessions." + ] }, "source:docs/reference/functions/defineAppHotkeys.md": { - "fingerprint": "b64be9a81474b04f7b38887ff2c15a630c2dfa1d12b24c257cfa00b6ea7cad81", + "fingerprint": "80e2a561a7be5b46d63e0b95d39e1e07407624ac5f13c567537af40bf23eabbd", "snapshot": { - "docs/reference/functions/defineAppHotkeys.md": "e56639bb9d5af49fe025d9cb0adf940e391dca195f46c8957344698fe961e552" + "docs/reference/functions/defineAppHotkeys.md": "b929ce86f004a52d3a2bd67afe20a347a9ee30ca8c6fd89bd5773897499f2467" }, - "head": "fc48fc09f82cd285da5e0991948d604cec2a3263", + "head": "00217cf3f2b203d406d1097656f2275156026943", "outcome": "no-change", - "reason": "Recorder lifecycle fixes, examples and guides; covered by tests.", - "evidence": ["Core 2,001 tests, adapter suites, e2e"] + "reason": "Generated by pnpm generate-docs; the DefinedAppHotkeys doc text and line numbers changed. Guidance reviewed under app-hotkeys.", + "evidence": [ + "docs/reference/functions/defineAppHotkeys.md", + "packages/hotkeys tests and types pass; pnpm test:pr 317/317 tasks passed; intent validate passed. Not run: fresh-consumer sessions." + ] }, "source:docs/reference/functions/getAppHotkeyRegistrationOptions.md": { - "fingerprint": "bbae22e9197bdf187e48df85727d2668622d49d45f759ae1e9db141208da8db5", + "fingerprint": "d1cdcd266808e9eff6833076fbc8ae0c5b82f0d27949e76d22c94875862c0333", "snapshot": { - "docs/reference/functions/getAppHotkeyRegistrationOptions.md": "47515b484395182a5f3814ecff0ded556d442cfffd333378d2316baa26f0a196" + "docs/reference/functions/getAppHotkeyRegistrationOptions.md": "000a1a1a3ecc7ebdd9d3a0facb410489a87b3212285467fca60436ba9dc34a36" }, - "head": "cd1c66aab538ccac294e72ee36ae4466fa9b2d2b", + "head": "00217cf3f2b203d406d1097656f2275156026943", "outcome": "no-change", - "reason": "Regenerated reference page. The skills cover the formatForAria, createFormatter, and suspendCharacterKeys API changes.", - "evidence": ["packages/hotkeys/skills/hotkeys-core/SKILL.md"] + "reason": "Generated by pnpm generate-docs; the DefinedAppHotkeys doc text and line numbers changed. Guidance reviewed under app-hotkeys.", + "evidence": [ + "docs/reference/functions/getAppHotkeyRegistrationOptions.md", + "packages/hotkeys tests and types pass; pnpm test:pr 317/317 tasks passed; intent validate passed. Not run: fresh-consumer sessions." + ] }, "source:docs/reference/functions/isAppHotkey.md": { - "fingerprint": "d5ac732442089caf14e605e9c8b3356d2d069a556ee15c81cd44b7bb4bcfc381", + "fingerprint": "fb2f5aca7fc13ac36946371e08713d6b22be5583c9c4017b638f31cf823be5c6", "snapshot": { - "docs/reference/functions/isAppHotkey.md": "f0f404d78068fe4b54d0e8ce7f96a7f77d236e484a4c71029b20ac0bcf62af39" + "docs/reference/functions/isAppHotkey.md": "437cf972cec1f57f8fe715ccb8bffeda3a2127198228f34889d1104633419153" }, - "head": "fc48fc09f82cd285da5e0991948d604cec2a3263", + "head": "00217cf3f2b203d406d1097656f2275156026943", "outcome": "no-change", - "reason": "Recorder lifecycle fixes, examples and guides; covered by tests.", - "evidence": ["Core 2,001 tests, adapter suites, e2e"] + "reason": "Generated by pnpm generate-docs; the DefinedAppHotkeys doc text and line numbers changed. Guidance reviewed under app-hotkeys.", + "evidence": [ + "docs/reference/functions/isAppHotkey.md", + "packages/hotkeys tests and types pass; pnpm test:pr 317/317 tasks passed; intent validate passed. Not run: fresh-consumer sessions." + ] }, "source:docs/reference/functions/isCustomHotkey.md": { - "fingerprint": "3fb9b53d46e1cdb347c0805efec7cd0a808fde3fcbfbbba66a0f34d373d881dc", + "fingerprint": "007cbf70d6ddb9966b15209435541f1d3cc15d3f28fa0da6c2fa872968d535c0", "snapshot": { - "docs/reference/functions/isCustomHotkey.md": "41db6364b07a315202f40ca82f7efb823f7ca76a120567a6d4cd5797ab0035ac" + "docs/reference/functions/isCustomHotkey.md": "2d9507868acbd371fbcbc45b7c2dd9b6fea7a5be2a9077fbd3be239eb4feedc1" }, - "head": "fc48fc09f82cd285da5e0991948d604cec2a3263", + "head": "00217cf3f2b203d406d1097656f2275156026943", "outcome": "no-change", - "reason": "Recorder lifecycle fixes, examples and guides; covered by tests.", - "evidence": ["Core 2,001 tests, adapter suites, e2e"] + "reason": "Generated by pnpm generate-docs; the DefinedAppHotkeys doc text and line numbers changed. Guidance reviewed under app-hotkeys.", + "evidence": [ + "docs/reference/functions/isCustomHotkey.md", + "packages/hotkeys tests and types pass; pnpm test:pr 317/317 tasks passed; intent validate passed. Not run: fresh-consumer sessions." + ] }, "source:docs/reference/functions/provideAppHotkeys.md": { - "fingerprint": "b82356ccce645747c9a6decbb3167c5329cf6862716e9cfc256a90dc39c06813", + "fingerprint": "0e236bb72e70f8a008dafa46ceb9e48a25a550989b4db44c62eaffe2cb8d30c0", "snapshot": { - "docs/reference/functions/provideAppHotkeys.md": "80f4c93dd1021ea428041d4aac35d133a57a854607de8bc0695c7326c7c99ed6" + "docs/reference/functions/provideAppHotkeys.md": "5771fe0131ddb9f32d996cd2adee709912e2aae04fd952b21a4329e277e67d89" }, - "head": "cd1c66aab538ccac294e72ee36ae4466fa9b2d2b", + "head": "00217cf3f2b203d406d1097656f2275156026943", "outcome": "no-change", - "reason": "Regenerated reference page. The skills cover the formatForAria, createFormatter, and suspendCharacterKeys API changes.", - "evidence": ["packages/hotkeys/skills/hotkeys-core/SKILL.md"] + "reason": "Generated by pnpm generate-docs; the DefinedAppHotkeys doc text and line numbers changed. Guidance reviewed under app-hotkeys.", + "evidence": [ + "docs/reference/functions/provideAppHotkeys.md", + "packages/hotkeys tests and types pass; pnpm test:pr 317/317 tasks passed; intent validate passed. Not run: fresh-consumer sessions." + ] }, "source:docs/reference/functions/publishAppHotkeysStore.md": { - "fingerprint": "c393ff22700da1b5d4a9dc947a1f9ccaab5ae9fec989f3f20760f856dca5b0a4", + "fingerprint": "3c192748840a54520d62cffb4845c426202ce6624663e3a33f84e8d1d0bb287e", "snapshot": { - "docs/reference/functions/publishAppHotkeysStore.md": "9a75d067604791ae5e4fa863a9943f6b2f88ebb9e72925051a2e33f0001fe41c" + "docs/reference/functions/publishAppHotkeysStore.md": "022fb9347d729f48e13529347183da2b5202c84c529a31e070a60276ff6d1277" }, - "head": "cd1c66aab538ccac294e72ee36ae4466fa9b2d2b", + "head": "00217cf3f2b203d406d1097656f2275156026943", "outcome": "no-change", - "reason": "Regenerated reference page. The skills cover the formatForAria, createFormatter, and suspendCharacterKeys API changes.", - "evidence": ["packages/hotkeys/skills/hotkeys-core/SKILL.md"] + "reason": "Generated by pnpm generate-docs; the DefinedAppHotkeys doc text and line numbers changed. Guidance reviewed under app-hotkeys.", + "evidence": [ + "docs/reference/functions/publishAppHotkeysStore.md", + "packages/hotkeys tests and types pass; pnpm test:pr 317/317 tasks passed; intent validate passed. Not run: fresh-consumer sessions." + ] }, "source:docs/reference/functions/resolveAppHotkey.md": { - "fingerprint": "97a00977285ed46d66fc64098005164f60a4e390e3cfecaf335c2f3aae00cba3", + "fingerprint": "b4cb90d940fa282f9a1ed751bfbee7d7fb509240b0f209301bebaa864f0eb092", "snapshot": { - "docs/reference/functions/resolveAppHotkey.md": "4569a0f748f6c1a489ec936dd116076de6ab9544bbfa2492a4c97905ead589a3" + "docs/reference/functions/resolveAppHotkey.md": "1297982241a19b1d661f714fa8526be12ab026d90ae3e03223008c200410230c" }, - "head": "cd1c66aab538ccac294e72ee36ae4466fa9b2d2b", + "head": "00217cf3f2b203d406d1097656f2275156026943", "outcome": "no-change", - "reason": "Regenerated reference page. The skills cover the formatForAria, createFormatter, and suspendCharacterKeys API changes.", - "evidence": ["packages/hotkeys/skills/hotkeys-core/SKILL.md"] + "reason": "Generated by pnpm generate-docs; the DefinedAppHotkeys doc text and line numbers changed. Guidance reviewed under app-hotkeys.", + "evidence": [ + "docs/reference/functions/resolveAppHotkey.md", + "packages/hotkeys tests and types pass; pnpm test:pr 317/317 tasks passed; intent validate passed. Not run: fresh-consumer sessions." + ] }, "source:docs/reference/interfaces/AppHotkey.md": { "fingerprint": "2fcea44dd9ba28061f6055e3517f5ac69a8c851cb18c33d1c2494c293b036f87", @@ -2474,34 +2498,43 @@ "evidence": ["Core 2,001 tests, adapter suites, e2e"] }, "source:docs/reference/interfaces/AppHotkeyListItem.md": { - "fingerprint": "361cc9a529f76f1c07e121160cd983a4851d148dfbbec366c2851abc18081ce6", + "fingerprint": "5b034f6b32a4469ad5ef57c619325fe9b4de58ab578d0625d47edb927d59ba4c", "snapshot": { - "docs/reference/interfaces/AppHotkeyListItem.md": "a357c6eb11f37ee70266cba59095d2b1f2f34b5ed4d4ce269a2fd2b1a0bb1b89" + "docs/reference/interfaces/AppHotkeyListItem.md": "4154af1d72bab146c1b5a9076898514ca947e43bc66d9a14753b2c507b9735b8" }, - "head": "cd1c66aab538ccac294e72ee36ae4466fa9b2d2b", + "head": "00217cf3f2b203d406d1097656f2275156026943", "outcome": "no-change", - "reason": "Regenerated reference page. The skills cover the formatForAria, createFormatter, and suspendCharacterKeys API changes.", - "evidence": ["packages/hotkeys/skills/hotkeys-core/SKILL.md"] + "reason": "Generated by pnpm generate-docs; the DefinedAppHotkeys doc text and line numbers changed. Guidance reviewed under app-hotkeys.", + "evidence": [ + "docs/reference/interfaces/AppHotkeyListItem.md", + "packages/hotkeys tests and types pass; pnpm test:pr 317/317 tasks passed; intent validate passed. Not run: fresh-consumer sessions." + ] }, "source:docs/reference/interfaces/AppHotkeysState.md": { - "fingerprint": "1cda7d8acac789e9c50f0f1d7bcfc11e1394b5a3e66d4c6b700b2bd34f393206", + "fingerprint": "10db17d25258323cd89f2d9831d0ce8b0f339c939f2bdcd06f9cf5b334c757c5", "snapshot": { - "docs/reference/interfaces/AppHotkeysState.md": "a92e7c661b92d75f9ee8b3d0c05d7c1b250ee6b67d0b3d778a04e228f2cb0e60" + "docs/reference/interfaces/AppHotkeysState.md": "155c058a995b5eb320511913bb3cd1d2d04d73080f8c48e838152c898d3287f9" }, - "head": "cd1c66aab538ccac294e72ee36ae4466fa9b2d2b", + "head": "00217cf3f2b203d406d1097656f2275156026943", "outcome": "no-change", - "reason": "Regenerated reference page. The skills cover the formatForAria, createFormatter, and suspendCharacterKeys API changes.", - "evidence": ["packages/hotkeys/skills/hotkeys-core/SKILL.md"] + "reason": "Generated by pnpm generate-docs; the DefinedAppHotkeys doc text and line numbers changed. Guidance reviewed under app-hotkeys.", + "evidence": [ + "docs/reference/interfaces/AppHotkeysState.md", + "packages/hotkeys tests and types pass; pnpm test:pr 317/317 tasks passed; intent validate passed. Not run: fresh-consumer sessions." + ] }, "source:docs/reference/interfaces/AppHotkeysStoreOptions.md": { - "fingerprint": "309f37da7b05a7c3183be0b4600e7e242261568862bdcba2bedd45a70bcab645", + "fingerprint": "d6f4f1caa6d233b83eaa97cb98f167c7b050056bb83fcb24f6f1b2187b94b8e0", "snapshot": { - "docs/reference/interfaces/AppHotkeysStoreOptions.md": "9976b8d6badd18e980c28bc791a260e27c2b46fcac9f2db077c476b74399904b" + "docs/reference/interfaces/AppHotkeysStoreOptions.md": "1acb0dc68432c76499a52973f50c68dab0da953169b69635e1a8fe1c20d0a1e5" }, - "head": "cd1c66aab538ccac294e72ee36ae4466fa9b2d2b", + "head": "00217cf3f2b203d406d1097656f2275156026943", "outcome": "no-change", - "reason": "Regenerated reference page. The skills cover the formatForAria, createFormatter, and suspendCharacterKeys API changes.", - "evidence": ["packages/hotkeys/skills/hotkeys-core/SKILL.md"] + "reason": "Generated by pnpm generate-docs; the DefinedAppHotkeys doc text and line numbers changed. Guidance reviewed under app-hotkeys.", + "evidence": [ + "docs/reference/interfaces/AppHotkeysStoreOptions.md", + "packages/hotkeys tests and types pass; pnpm test:pr 317/317 tasks passed; intent validate passed. Not run: fresh-consumer sessions." + ] }, "source:docs/reference/interfaces/Register.md": { "fingerprint": "e8327baf0e0d43563d5bcf3deffdf934f959ecda36e1e47d24ea1121cf7d8e84", @@ -2524,24 +2557,30 @@ "evidence": ["Core 2,001 tests, adapter suites, e2e"] }, "source:docs/reference/type-aliases/AppHotkeyDefaultKind.md": { - "fingerprint": "e80644f086ab93747b39ce8741c75888726b65f1e21a5b7e3eb86eaae888491d", + "fingerprint": "812ec8a724e43cb03193f538d5ea3021a5c5b13ea063353aca247c6b41948f08", "snapshot": { - "docs/reference/type-aliases/AppHotkeyDefaultKind.md": "979eb223bb8cf2397c58d3cf409bea9feea106e0e4ac7efb3a6bc59447e3e910" + "docs/reference/type-aliases/AppHotkeyDefaultKind.md": "fc164a543295563aa83216c9e43c067ee1d59d3b2544ff63c52dddb254ccd0f8" }, - "head": "fc48fc09f82cd285da5e0991948d604cec2a3263", + "head": "00217cf3f2b203d406d1097656f2275156026943", "outcome": "no-change", - "reason": "Recorder lifecycle fixes, examples and guides; covered by tests.", - "evidence": ["Core 2,001 tests, adapter suites, e2e"] + "reason": "Generated by pnpm generate-docs; the DefinedAppHotkeys doc text and line numbers changed. Guidance reviewed under app-hotkeys.", + "evidence": [ + "docs/reference/type-aliases/AppHotkeyDefaultKind.md", + "packages/hotkeys tests and types pass; pnpm test:pr 317/317 tasks passed; intent validate passed. Not run: fresh-consumer sessions." + ] }, "source:docs/reference/type-aliases/AppHotkeyId.md": { - "fingerprint": "1cebda0ac333121de953fcd92d5b5805248a8085d769fe2106bf429f49fb98b4", + "fingerprint": "8d7b0bf64dc3eb03b63e6987585722533d69079001cc2cd0982840fa01227859", "snapshot": { - "docs/reference/type-aliases/AppHotkeyId.md": "289d4bf550988b0cfe06ac0c13639d5d97d639c89838de631d4e331e3c82b15e" + "docs/reference/type-aliases/AppHotkeyId.md": "eec5b6f35e5fdcf661e3b58752b102c2469f514349318f5c51c01228d5fc4a81" }, - "head": "fc48fc09f82cd285da5e0991948d604cec2a3263", + "head": "00217cf3f2b203d406d1097656f2275156026943", "outcome": "no-change", - "reason": "Recorder lifecycle fixes, examples and guides; covered by tests.", - "evidence": ["Core 2,001 tests, adapter suites, e2e"] + "reason": "Generated by pnpm generate-docs; the DefinedAppHotkeys doc text and line numbers changed. Guidance reviewed under app-hotkeys.", + "evidence": [ + "docs/reference/type-aliases/AppHotkeyId.md", + "packages/hotkeys tests and types pass; pnpm test:pr 317/317 tasks passed; intent validate passed. Not run: fresh-consumer sessions." + ] }, "source:docs/reference/type-aliases/AppHotkeyOptions.md": { "fingerprint": "327b5ffd47c85efec6edd4aa80701241fab943c29d4d14a3ae99703c1eb5b87d", @@ -2564,16 +2603,16 @@ "evidence": ["Core 2,001 tests, adapter suites, e2e"] }, "source:docs/reference/type-aliases/AppHotkeyStatus.md": { - "fingerprint": "1a7958ae75c1e70bab221804c3ac19988b75338d1a6b92447ec396b6114ba0b9", + "fingerprint": "9682045bee188c5f57e5519dd15264185547390899188f2e3c6690fb6d6039d6", "snapshot": { - "docs/reference/type-aliases/AppHotkeyStatus.md": "caeb73b5f57f31466e076937cd9b258a8262da3cbf83ea68e29669a5393cf1a9" + "docs/reference/type-aliases/AppHotkeyStatus.md": "62b1af9fda054f775813e56b0d260a7d51b92f87f38363569b399b2b95b7ea46" }, - "head": "7cf53a0cf4759de322e2bdf45b5b834960d68778", + "head": "00217cf3f2b203d406d1097656f2275156026943", "outcome": "no-change", - "reason": "Generated by pnpm generate-docs from the changed JSDoc and types; the guidance it reflects is reviewed under the app-hotkeys and hotkeys-core skills.", + "reason": "Generated by pnpm generate-docs; the DefinedAppHotkeys doc text and line numbers changed. Guidance reviewed under app-hotkeys.", "evidence": [ "docs/reference/type-aliases/AppHotkeyStatus.md", - "pnpm -C packages/hotkeys exec vitest run (2182 passed, including tests/trigger.test.ts); nx test:lib/test:types/test:eslint/test:build for 20 projects passed; intent validate packages/hotkeys/skills passed. Not run: fresh-consumer sessions." + "packages/hotkeys tests and types pass; pnpm test:pr 317/317 tasks passed; intent validate passed. Not run: fresh-consumer sessions." ] }, "source:docs/reference/type-aliases/AppHotkeys.md": { @@ -2587,34 +2626,43 @@ "evidence": ["Core 2,001 tests, adapter suites, e2e"] }, "source:docs/reference/type-aliases/CustomHotkeys.md": { - "fingerprint": "cd23beead962cebbc0212b0d219f9791d06dd89525dd60fa6b58d0abbfff4038", + "fingerprint": "9a5fc3348f198fb2e1f96c0155ad21132540584b44c6ec797c94c571e0005461", "snapshot": { - "docs/reference/type-aliases/CustomHotkeys.md": "0750d8f216280b73c5001e319d0bcb153a766b5dd0d5ed7fe156136f60a36c5f" + "docs/reference/type-aliases/CustomHotkeys.md": "907ae0aae55fd2895fb76f48ee6576a2c4026f7e1e09ce2c77535a592b003e2a" }, - "head": "fc48fc09f82cd285da5e0991948d604cec2a3263", + "head": "00217cf3f2b203d406d1097656f2275156026943", "outcome": "no-change", - "reason": "Recorder lifecycle fixes, examples and guides; covered by tests.", - "evidence": ["Core 2,001 tests, adapter suites, e2e"] + "reason": "Generated by pnpm generate-docs; the DefinedAppHotkeys doc text and line numbers changed. Guidance reviewed under app-hotkeys.", + "evidence": [ + "docs/reference/type-aliases/CustomHotkeys.md", + "packages/hotkeys tests and types pass; pnpm test:pr 317/317 tasks passed; intent validate passed. Not run: fresh-consumer sessions." + ] }, "source:docs/reference/type-aliases/DefinedAppHotkeys.md": { - "fingerprint": "9604deb31080b95dfbd1f4cda2b4be616f39b14c181ccba9876bbc6f91daf195", + "fingerprint": "a2e7d49a67416a25643d5cd0008edbc344083b95ff1b43a11912a363887bd28d", "snapshot": { - "docs/reference/type-aliases/DefinedAppHotkeys.md": "aed6741c8b736ebf5508d5d12eb8fce8d7cb2868fca05bc67e107983f7d233c8" + "docs/reference/type-aliases/DefinedAppHotkeys.md": "7b2d83701acf751f5001eb8dce27243d6ec91960a8b505f081f47c6797551483" }, - "head": "fc48fc09f82cd285da5e0991948d604cec2a3263", + "head": "00217cf3f2b203d406d1097656f2275156026943", "outcome": "no-change", - "reason": "Recorder lifecycle fixes, examples and guides; covered by tests.", - "evidence": ["Core 2,001 tests, adapter suites, e2e"] + "reason": "Generated by pnpm generate-docs; the DefinedAppHotkeys doc text and line numbers changed. Guidance reviewed under app-hotkeys.", + "evidence": [ + "docs/reference/type-aliases/DefinedAppHotkeys.md", + "packages/hotkeys tests and types pass; pnpm test:pr 317/317 tasks passed; intent validate passed. Not run: fresh-consumer sessions." + ] }, "source:docs/reference/type-aliases/RegisteredAppHotkeys.md": { - "fingerprint": "ca4d97e8c0298a23eec7931a1f16da8a4f5f151d1b6f9726afa907c460c4bcbf", + "fingerprint": "73a267466a36538eaaef69be25decf7c0ef8cc9fd2624cbb7df3c04d913b32a4", "snapshot": { - "docs/reference/type-aliases/RegisteredAppHotkeys.md": "0a6680b0791ed1c8031753b67c6b84a0a7c3b6eb397a826e4232d95c481e2345" + "docs/reference/type-aliases/RegisteredAppHotkeys.md": "c4187a8a17557a6c6bb49107f566de6abc6f7e0ef5227dd33ad2c7610b41badf" }, - "head": "fc48fc09f82cd285da5e0991948d604cec2a3263", + "head": "00217cf3f2b203d406d1097656f2275156026943", "outcome": "no-change", - "reason": "Recorder lifecycle fixes, examples and guides; covered by tests.", - "evidence": ["Core 2,001 tests, adapter suites, e2e"] + "reason": "Generated by pnpm generate-docs; the DefinedAppHotkeys doc text and line numbers changed. Guidance reviewed under app-hotkeys.", + "evidence": [ + "docs/reference/type-aliases/RegisteredAppHotkeys.md", + "packages/hotkeys tests and types pass; pnpm test:pr 317/317 tasks passed; intent validate passed. Not run: fresh-consumer sessions." + ] }, "source:docs/reference/type-aliases/Target.md": { "fingerprint": "a2dd0f2c761b2ffad8bbb14b82903e48c2977e92bcbb189bea349a812639935f", @@ -4383,16 +4431,16 @@ "evidence": [".gitignore"] }, "source:docs/framework/angular/guides/app-hotkeys.md": { - "fingerprint": "86b9eefde21a91be960eef7d686fa21ccc932eda2d422d8509649985fdd83ec2", + "fingerprint": "ac58b62b7cb47006a41d3ff71f224833bbdfb934f684fa475a6888263d9b199a", "snapshot": { - "docs/framework/angular/guides/app-hotkeys.md": "55e68f1efbe5d97b7fe9982422911e6027a9a38878f734170ef7fbb456e28a1d" + "docs/framework/angular/guides/app-hotkeys.md": "af71ddae537759959c89f8a1698d8e32584fdaa729293961919c4c6b91126ed8" }, - "head": "7cf53a0cf4759de322e2bdf45b5b834960d68778", + "head": "00217cf3f2b203d406d1097656f2275156026943", "outcome": "updated", - "reason": "Source or guide change for trigger(), call-site meta, or enabled getters; the affected guidance was updated in the app-hotkeys and hotkeys-core skills and their references.", + "reason": "Guide gained a Split declarations across files section; the app-hotkeys skill carries the matching pitfall.", "evidence": [ "docs/framework/angular/guides/app-hotkeys.md", - "pnpm -C packages/hotkeys exec vitest run (2182 passed, including tests/trigger.test.ts); nx test:lib/test:types/test:eslint/test:build for 20 projects passed; intent validate packages/hotkeys/skills passed. Not run: fresh-consumer sessions." + "packages/hotkeys vitest run: 61 files, 2186 tests passed; test:types passed; intent validate passed. Not run: fresh-consumer sessions." ] }, "source:docs/framework/angular/reference/functions/injectDefaultHotkeysOptions.md": { @@ -4480,16 +4528,16 @@ "evidence": ["packages/angular-hotkeys/skills/angular-hotkeys/SKILL.md"] }, "source:docs/framework/octane/guides/app-hotkeys.md": { - "fingerprint": "1a6f89763308ef2b814ec959aeeb1ee168ec84f6f5b92aa07ea5f34ca84c623c", + "fingerprint": "a05575e86690c9452dc9798a35b6f91ff16bf01a533b37cc43bef2bc379393cc", "snapshot": { - "docs/framework/octane/guides/app-hotkeys.md": "8772523506ada62a838bf47129c6a0fd9a55833478fdcefa54d4b258006ebc9d" + "docs/framework/octane/guides/app-hotkeys.md": "b217709f2ca1ddc53e632262896526333b64250b1d31177ae00533ae71e60f8a" }, - "head": "7cf53a0cf4759de322e2bdf45b5b834960d68778", + "head": "00217cf3f2b203d406d1097656f2275156026943", "outcome": "updated", - "reason": "Source or guide change for trigger(), call-site meta, or enabled getters; the affected guidance was updated in the app-hotkeys and hotkeys-core skills and their references.", + "reason": "Guide gained a Split declarations across files section; the app-hotkeys skill carries the matching pitfall.", "evidence": [ "docs/framework/octane/guides/app-hotkeys.md", - "pnpm -C packages/hotkeys exec vitest run (2182 passed, including tests/trigger.test.ts); nx test:lib/test:types/test:eslint/test:build for 20 projects passed; intent validate packages/hotkeys/skills passed. Not run: fresh-consumer sessions." + "packages/hotkeys vitest run: 61 files, 2186 tests passed; test:types passed; intent validate passed. Not run: fresh-consumer sessions." ] }, "source:docs/framework/octane/reference/functions/HotkeysProvider.md": { @@ -4565,16 +4613,16 @@ ] }, "source:docs/framework/preact/guides/app-hotkeys.md": { - "fingerprint": "02effd776008ffa0759d1767b665dbbe4d5ee36a49a35f38e0e0885fbca1211d", + "fingerprint": "28108e133c748cc711e90f37c0cf8481a2a27838274dc72163e40283b080b0ef", "snapshot": { - "docs/framework/preact/guides/app-hotkeys.md": "b40b6ba37c32719ebeb2fcd37d83742275b2113c121d864d67bb1f39343eb849" + "docs/framework/preact/guides/app-hotkeys.md": "1762b5fee0673a8801fb36e5c523d0e09f5037180d49cf82f8ca23bf8bcca44d" }, - "head": "7cf53a0cf4759de322e2bdf45b5b834960d68778", + "head": "00217cf3f2b203d406d1097656f2275156026943", "outcome": "updated", - "reason": "Source or guide change for trigger(), call-site meta, or enabled getters; the affected guidance was updated in the app-hotkeys and hotkeys-core skills and their references.", + "reason": "Guide gained a Split declarations across files section; the app-hotkeys skill carries the matching pitfall.", "evidence": [ "docs/framework/preact/guides/app-hotkeys.md", - "pnpm -C packages/hotkeys exec vitest run (2182 passed, including tests/trigger.test.ts); nx test:lib/test:types/test:eslint/test:build for 20 projects passed; intent validate packages/hotkeys/skills passed. Not run: fresh-consumer sessions." + "packages/hotkeys vitest run: 61 files, 2186 tests passed; test:types passed; intent validate passed. Not run: fresh-consumer sessions." ] }, "source:docs/framework/preact/reference/functions/HotkeysProvider.md": { @@ -4654,16 +4702,16 @@ ] }, "source:docs/framework/solid/guides/app-hotkeys.md": { - "fingerprint": "d11d21927e2dd0299f5c224e8b9396a35fb88355a05c4f05261df1ab0a3fbf86", + "fingerprint": "28fd8deb994b846414db41efd0e54d43644678b623dd31f746c303719b4cb514", "snapshot": { - "docs/framework/solid/guides/app-hotkeys.md": "1720bf589c8c71c491132e95a6de1bc70f57478ea95b996ff326c3a9da43fbb9" + "docs/framework/solid/guides/app-hotkeys.md": "369f288020b9a16c379ee4a45d6ea5edd89c0fc1665fd1ac44c5bc126d64dc79" }, - "head": "7cf53a0cf4759de322e2bdf45b5b834960d68778", + "head": "00217cf3f2b203d406d1097656f2275156026943", "outcome": "updated", - "reason": "Source or guide change for trigger(), call-site meta, or enabled getters; the affected guidance was updated in the app-hotkeys and hotkeys-core skills and their references.", + "reason": "Guide gained a Split declarations across files section; the app-hotkeys skill carries the matching pitfall.", "evidence": [ "docs/framework/solid/guides/app-hotkeys.md", - "pnpm -C packages/hotkeys exec vitest run (2182 passed, including tests/trigger.test.ts); nx test:lib/test:types/test:eslint/test:build for 20 projects passed; intent validate packages/hotkeys/skills passed. Not run: fresh-consumer sessions." + "packages/hotkeys vitest run: 61 files, 2186 tests passed; test:types passed; intent validate passed. Not run: fresh-consumer sessions." ] }, "source:docs/framework/solid/reference/functions/createHeldKeyCodes.md": { @@ -4755,16 +4803,16 @@ ] }, "source:docs/framework/svelte/guides/app-hotkeys.md": { - "fingerprint": "52d73181fac8e27abe50dfbd9f0b42e6e78fe411dffb9e56be2a007a164cfc36", + "fingerprint": "fc9654b037e2ff3106dd5e8331f183d3cdc82824c652d92e8b6a0fbb1471a786", "snapshot": { - "docs/framework/svelte/guides/app-hotkeys.md": "c0f6549ce5d3f337924586fe0218484655f9b7102bd8db0ddbedf2db17b38de0" + "docs/framework/svelte/guides/app-hotkeys.md": "7cfccab32f992223f3825ea59ea2edfaae5bb27b48351ea28b4abfe65ab31993" }, - "head": "7cf53a0cf4759de322e2bdf45b5b834960d68778", + "head": "00217cf3f2b203d406d1097656f2275156026943", "outcome": "updated", - "reason": "Source or guide change for trigger(), call-site meta, or enabled getters; the affected guidance was updated in the app-hotkeys and hotkeys-core skills and their references.", + "reason": "Guide gained a Split declarations across files section; the app-hotkeys skill carries the matching pitfall.", "evidence": [ "docs/framework/svelte/guides/app-hotkeys.md", - "pnpm -C packages/hotkeys exec vitest run (2182 passed, including tests/trigger.test.ts); nx test:lib/test:types/test:eslint/test:build for 20 projects passed; intent validate packages/hotkeys/skills passed. Not run: fresh-consumer sessions." + "packages/hotkeys vitest run: 61 files, 2186 tests passed; test:types passed; intent validate passed. Not run: fresh-consumer sessions." ] }, "source:docs/framework/svelte/reference/functions/getDefaultHotkeysOptions.md": { @@ -4852,16 +4900,16 @@ ] }, "source:docs/framework/vue/guides/app-hotkeys.md": { - "fingerprint": "ad8212cab615a8013a9fecea6ee6b4bd66503f1f46449582906fe59f8b8374b1", + "fingerprint": "54f74856ffcd330a6439699ffceb56841a3cd722ac2d990948e41316202af21f", "snapshot": { - "docs/framework/vue/guides/app-hotkeys.md": "15d4d1d9f38273f65992ed897cb81e48949f94a5127df3f8055a8e33df3674fc" + "docs/framework/vue/guides/app-hotkeys.md": "3209d5a325d9558cfcbb832cb67046098b53343f5ce59d0c0e2a8154e8a162c9" }, - "head": "7cf53a0cf4759de322e2bdf45b5b834960d68778", + "head": "00217cf3f2b203d406d1097656f2275156026943", "outcome": "updated", - "reason": "Source or guide change for trigger(), call-site meta, or enabled getters; the affected guidance was updated in the app-hotkeys and hotkeys-core skills and their references.", + "reason": "Guide gained a Split declarations across files section; the app-hotkeys skill carries the matching pitfall.", "evidence": [ "docs/framework/vue/guides/app-hotkeys.md", - "pnpm -C packages/hotkeys exec vitest run (2182 passed, including tests/trigger.test.ts); nx test:lib/test:types/test:eslint/test:build for 20 projects passed; intent validate packages/hotkeys/skills passed. Not run: fresh-consumer sessions." + "packages/hotkeys vitest run: 61 files, 2186 tests passed; test:types passed; intent validate passed. Not run: fresh-consumer sessions." ] }, "source:docs/framework/vue/reference/functions/useHeldKeys.md": { @@ -7174,14 +7222,17 @@ ] }, "source:packages/hotkeys/tests/app-hotkeys.test.ts": { - "fingerprint": "b254ec0af66dc8c33c67253e9e78a9968af2faf48df69172cfed6e9729a84bb3", + "fingerprint": "6b89915683d4a502580c0130d47e46c954ac096628fc49d07a5b17c38e3e1659", "snapshot": { - "packages/hotkeys/tests/app-hotkeys.test.ts": "12c528fc00413e85efc0eb0733d8d077a03f5b9b28f96e388e35f8f7959b6ba6" + "packages/hotkeys/tests/app-hotkeys.test.ts": "3f616bef3f18f2cc2ec5e41078eb3e443d3ca21e4f1909f9a4bb37b844f314b4" }, - "head": "6f837e4d688f72b762181737c4589fbde7606b36", - "outcome": "out-of-scope", - "reason": "Test change; it describes no library behavior the guidance covers.", - "evidence": ["packages/hotkeys/tests/app-hotkeys.test.ts"] + "head": "00217cf3f2b203d406d1097656f2275156026943", + "outcome": "no-change", + "reason": "Tests for spread-in app hotkeys; no skill covers test files.", + "evidence": [ + "packages/hotkeys/tests/app-hotkeys.test.ts", + "packages/hotkeys tests and types pass; pnpm test:pr 317/317 tasks passed; intent validate passed. Not run: fresh-consumer sessions." + ] }, "source:packages/hotkeys/tests/unset-values.test.ts": { "fingerprint": "f928c9450c2f2f916cf639f3cc0a81e3a49effda3b8e90c51002bda9422539ca", @@ -19747,15 +19798,16 @@ "evidence": ["packages/hotkeys/tests/typed-keys.ts"] }, "source:packages/hotkeys/tests/app-hotkeys-type-performance.test.ts": { - "fingerprint": "09c3753975106ac8e52dbbf8b5ac0ae47cfbf3cacfae821c75f6084bd9f88e2a", + "fingerprint": "894957d778d6efe08acc11f276569cc60190427e73f5cd351c23ab98b0da2bc5", "snapshot": { - "packages/hotkeys/tests/app-hotkeys-type-performance.test.ts": "46dd65673a817ea469df53a4a1123178e6168ba97519ff89729ba6381afda9c5" + "packages/hotkeys/tests/app-hotkeys-type-performance.test.ts": "2eb25fec571f622b36fb8860a0d434cc661a311ad64babff8e655fbb94f926ad" }, - "head": "cb07b6e30afe73eb13ea4f2ad08eaaeed387e0d7", - "outcome": "out-of-scope", - "reason": "Test code for the Vue provider and composable types, useKeyHold notifications and defineAppHotkeys type-check time; it carries no guidance for library users.", + "head": "00217cf3f2b203d406d1097656f2275156026943", + "outcome": "no-change", + "reason": "Tests for spread-in app hotkeys; no skill covers test files.", "evidence": [ - "packages/hotkeys/tests/app-hotkeys-type-performance.test.ts" + "packages/hotkeys/tests/app-hotkeys-type-performance.test.ts", + "packages/hotkeys vitest run: 61 files, 2186 tests passed; test:types passed; intent validate passed. Not run: fresh-consumer sessions." ] }, "source:packages/vue-hotkeys/tests/composable-types.test.ts": { @@ -19779,14 +19831,17 @@ "evidence": ["packages/vue-hotkeys/tests/provider-types.test.ts"] }, "source:docs/reference/interfaces/RecordedKeyPresses.md": { - "fingerprint": "a1eb45d6d8d53d0c494d2184dd50d1ef35e4356d66c051665fecd1fa6a4e9d01", + "fingerprint": "04d5eae9a2c60068a8cbb73cedb7521338edb090f86d965c5d858b58e34d6cf1", "snapshot": { - "docs/reference/interfaces/RecordedKeyPresses.md": "d807703d99b0c72d3a45b4c2e5e5e3832c50e631a0be7bc42c97a1d9608ef80d" + "docs/reference/interfaces/RecordedKeyPresses.md": "06e7e15e1ec72f96298450f4a97feb2994c16f324bb085cc62b9fb24f170f077" }, - "head": "fc48fc09f82cd285da5e0991948d604cec2a3263", + "head": "00217cf3f2b203d406d1097656f2275156026943", "outcome": "no-change", - "reason": "Recorder lifecycle fixes, examples and guides; covered by tests.", - "evidence": ["Core 2,001 tests, adapter suites, e2e"] + "reason": "Generated by pnpm generate-docs; the DefinedAppHotkeys doc text and line numbers changed. Guidance reviewed under app-hotkeys.", + "evidence": [ + "docs/reference/interfaces/RecordedKeyPresses.md", + "packages/hotkeys tests and types pass; pnpm test:pr 317/317 tasks passed; intent validate passed. Not run: fresh-consumer sessions." + ] }, "source:e2e/layouts/alt-graph.spec.ts": { "fingerprint": "1d818886e7a3303a598c6cee6dade34a01bdda7891c28ad9c695395a6745fb83", @@ -21197,14 +21252,17 @@ ] }, "source:docs/reference/interfaces/CustomHotkeyActions.md": { - "fingerprint": "e56521ab19f7ea9d8b12993777dc25907a4f90072f64925b65e919d759bff601", + "fingerprint": "b391107f8db3eefa6fcfe2ee651c96b8ddcd01e211b62b5f016cdc5a651c1450", "snapshot": { - "docs/reference/interfaces/CustomHotkeyActions.md": "a541f66cec4103043eeb69c6237cb1500f262a24b88be23fed2ec604428d625a" + "docs/reference/interfaces/CustomHotkeyActions.md": "f0120a977c54b9a79fa77222d2633fd6542e6722c5c606dda17c613cc2997bab" }, - "head": "cd1c66aab538ccac294e72ee36ae4466fa9b2d2b", + "head": "00217cf3f2b203d406d1097656f2275156026943", "outcome": "no-change", - "reason": "Regenerated reference page. The skills cover the formatForAria, createFormatter, and suspendCharacterKeys API changes.", - "evidence": ["packages/hotkeys/skills/hotkeys-core/SKILL.md"] + "reason": "Generated by pnpm generate-docs; the DefinedAppHotkeys doc text and line numbers changed. Guidance reviewed under app-hotkeys.", + "evidence": [ + "docs/reference/interfaces/CustomHotkeyActions.md", + "packages/hotkeys tests and types pass; pnpm test:pr 317/317 tasks passed; intent validate passed. Not run: fresh-consumer sessions." + ] }, "source:docs/reference/interfaces/HotkeyRecorderActions.md": { "fingerprint": "2aeefdedab9d46b9cdc15bfc543502e5aa8ea404b114b1cf306cab75617dfd22", @@ -21278,14 +21336,17 @@ ] }, "source:docs/reference/type-aliases/RegisteredAppHotkeyListItem.md": { - "fingerprint": "d4becc16f9f77bf55d4400bbc09ebf3ead5ffd984f6ea7d41ef32472909ab9fc", + "fingerprint": "84375491c9ba7bb738b24626ab3375a1e0e78fb0ad710438b0deabe60687a07e", "snapshot": { - "docs/reference/type-aliases/RegisteredAppHotkeyListItem.md": "acbbcd5120729cf3138850c25ad6f6d01e2c06242970e56c6ce1765255cb9add" + "docs/reference/type-aliases/RegisteredAppHotkeyListItem.md": "8a96cfc9ce16e1fc5e283bde668d3ebf323e462d8fa60d7dc16ad6f04648aae1" }, - "head": "cd1c66aab538ccac294e72ee36ae4466fa9b2d2b", + "head": "00217cf3f2b203d406d1097656f2275156026943", "outcome": "no-change", - "reason": "Regenerated reference page. The skills cover the formatForAria, createFormatter, and suspendCharacterKeys API changes.", - "evidence": ["packages/hotkeys/skills/hotkeys-core/SKILL.md"] + "reason": "Generated by pnpm generate-docs; the DefinedAppHotkeys doc text and line numbers changed. Guidance reviewed under app-hotkeys.", + "evidence": [ + "docs/reference/type-aliases/RegisteredAppHotkeyListItem.md", + "packages/hotkeys tests and types pass; pnpm test:pr 317/317 tasks passed; intent validate passed. Not run: fresh-consumer sessions." + ] }, "source:docs/reference/type-aliases/ResolvableModifier.md": { "fingerprint": "fcb4596a0b2b6fea6a50fc233100d68908142fd1c1c40254655601e6cce29489", @@ -21544,24 +21605,30 @@ "evidence": ["Core, adapter and e2e suites; battery 159/159"] }, "source:docs/reference/adapter/functions/installAppHotkeysStore.md": { - "fingerprint": "b1e5fb01a8796e39756b610cbdc13ff06f4d7284af6bedfd1a32f5a84e495c2b", + "fingerprint": "38ee274c9fdb96e725f794d21202c8a3ba318ca5a7568a00a9d6f10ffd894f55", "snapshot": { - "docs/reference/adapter/functions/installAppHotkeysStore.md": "85b38bbe057336e25491c1714ccf1144d40262ca8a07351c9aced62f090f1587" + "docs/reference/adapter/functions/installAppHotkeysStore.md": "d5f8ea49cfeae36b40aeb7164fe0de97b3b0a2f14137c322d7283be2bf0ed8ed" }, - "head": "fc48fc09f82cd285da5e0991948d604cec2a3263", + "head": "00217cf3f2b203d406d1097656f2275156026943", "outcome": "no-change", - "reason": "Recorder lifecycle fixes, examples and guides; covered by tests.", - "evidence": ["Core 2,001 tests, adapter suites, e2e"] + "reason": "Generated by pnpm generate-docs; the DefinedAppHotkeys doc text and line numbers changed. Guidance reviewed under app-hotkeys.", + "evidence": [ + "docs/reference/adapter/functions/installAppHotkeysStore.md", + "packages/hotkeys tests and types pass; pnpm test:pr 317/317 tasks passed; intent validate passed. Not run: fresh-consumer sessions." + ] }, "source:docs/reference/functions/installAppHotkeysStore.md": { - "fingerprint": "d2cbc93e3a723795805ca1a4194ca2049f1658d11d354181dbedfcf8ea0830a2", + "fingerprint": "ffd3460b765d7f436361a643f1f39241fa3f5789be87b02adad577db4bea01ad", "snapshot": { - "docs/reference/functions/installAppHotkeysStore.md": "85b38bbe057336e25491c1714ccf1144d40262ca8a07351c9aced62f090f1587" + "docs/reference/functions/installAppHotkeysStore.md": "d5f8ea49cfeae36b40aeb7164fe0de97b3b0a2f14137c322d7283be2bf0ed8ed" }, - "head": "fc48fc09f82cd285da5e0991948d604cec2a3263", + "head": "00217cf3f2b203d406d1097656f2275156026943", "outcome": "no-change", - "reason": "Recorder lifecycle fixes, examples and guides; covered by tests.", - "evidence": ["Core 2,001 tests, adapter suites, e2e"] + "reason": "Generated by pnpm generate-docs; the DefinedAppHotkeys doc text and line numbers changed. Guidance reviewed under app-hotkeys.", + "evidence": [ + "docs/reference/functions/installAppHotkeysStore.md", + "packages/hotkeys tests and types pass; pnpm test:pr 317/317 tasks passed; intent validate passed. Not run: fresh-consumer sessions." + ] }, "source:packages/hotkeys/tests/app-hotkeys-factory.test.ts": { "fingerprint": "be094b2d055590a9f30a13eb115c9f53aac4df238dfa8e855b4d8ecccdfeeae5", diff --git a/_artifacts/domain_map.yaml b/_artifacts/domain_map.yaml index 6cb342ea6..6f4c1d4ce 100644 --- a/_artifacts/domain_map.yaml +++ b/_artifacts/domain_map.yaml @@ -224,6 +224,13 @@ skills: skills: - app-hotkeys - hotkeys-core + - mistake: Splitting declarations with satisfies instead of nested defineAppHotkeys + mechanism: '`as const satisfies Record` checks hotkey strings but not kind-specific options, so a `timeout` on a chord fails only at the final defineAppHotkeys call, far from the file that declares it.' + wrong_pattern: "export const editorHotkeys = { 'editor.format': { hotkey: 'Mod+Shift+F' } } as const satisfies Record" + correct_pattern: "export const editorHotkeys = defineAppHotkeys({ 'editor.format': { hotkey: 'Mod+Shift+F' } }); defineAppHotkeys({ ...editorHotkeys })" + source: src/app-hotkeys.ts (DefinedAppHotkeys); docs/framework/react/guides/app-hotkeys.md#split-declarations-across-files + priority: MEDIUM + status: active - mistake: Declaring a copy of a shared hotkey per page mechanism: One app hotkey per page splits the user's custom binding and settings row for what is one shortcut. wrong_pattern: "defineAppHotkeys({ 'tables.search': { hotkey: 'Shift+F' }, 'roles.search': { hotkey: 'Shift+F' } })" diff --git a/_artifacts/skill_spec.md b/_artifacts/skill_spec.md index dca654e79..ba9462946 100644 --- a/_artifacts/skill_spec.md +++ b/_artifacts/skill_spec.md @@ -49,7 +49,7 @@ The skills teach agents to use those APIs directly. The core skills hold the fra | 12 | A second copy of @tanstack/hotkeys | MEDIUM | src/_manager-ref.ts | — | | 13 | Testing without a fixed platform | MEDIUM | src/platform.ts, runtime probe | — | -### app-hotkeys (10 failure modes) +### app-hotkeys (11 failure modes) | # | Mistake | Priority | Source | Cross-skill? | | --- | ------------------------------------------------ | -------- | ---------------------------------- | -------------------- | @@ -63,6 +63,7 @@ The skills teach agents to use those APIs directly. The core skills hold the fra | 8 | Rewriting recorded physical bindings | MEDIUM | sensible-defaults.md | — | | 9 | A palette that keeps its own action map | HIGH | src/hotkey-manager.ts (trigger) | hotkeys-core | | 10 | Declaring a copy of a shared hotkey per page | MEDIUM | src/adapter.ts (call-site meta) | — | +| 11 | Splitting declarations with `satisfies` | MEDIUM | src/app-hotkeys.ts (nested define) | — | ### Framework skills @@ -217,3 +218,9 @@ The skills teach agents to use those APIs directly. The core skills hold the fra - **Source:** branch `feat/hotkey-trigger` from `7cf53a0c`. Registration views, registration handles, and `HotkeyManager` gain `trigger()`, which runs the registered callback without a key press with the key press's context, a synthetic event for the hotkey when none is passed, and only `enabled` checked. The devtools Trigger button uses it. App hotkey registrations accept call-site `meta`, merged over the declared meta for that registration only. `enabled` accepts a getter, read on each key press, on `trigger()`, and when views report `status`. - **Changes:** `app-hotkeys` gains two pitfalls: a command palette runs registrations with `view.trigger()` instead of keeping its own action map, and a shared hotkey gets a page-specific name with call-site `meta` instead of a copy per page. `hotkeys-core` gains a table row for a palette that copies each shortcut's action. `references/scopes.md` describes `'disabled'` for getters. `domain_map.yaml` records both failure modes. Framework skills are unchanged: none claims `meta` comes only from the declaration, and Vue already resolves a getter `enabled` as a reactive source. `skill_tree.yaml` is unchanged. - **Checks:** `packages/hotkeys/tests/trigger.test.ts` covers `trigger()`, getters, and the meta merge; React and Preact app hotkey tests cover call-site meta through an adapter. `intent validate` passes. Not run: fresh-consumer sessions. + +### Source sync — 2026-11-29 — app hotkeys split across files + +- **Source:** branch `feat/nested-app-hotkeys` from `00217cf3`. `defineAppHotkeys` accepts the app hotkeys of another `defineAppHotkeys` call. Spread-in entries keep their id and the kind of their default, and skip the option check that their own call already ran. An entry that replaces a spread-in `hotkey` or `options` is checked like any other declaration. Types only; no runtime change. +- **Changes:** `app-hotkeys` gains a pitfall: split a large catalog with nested `defineAppHotkeys` calls instead of `as const satisfies Record`, which defers the kind-specific option check to the final call. Every framework's `app-hotkeys.md` guide gains a "Split declarations across files" section. `domain_map.yaml` records the failure mode. Framework skills and `skill_tree.yaml` are unchanged: no framework skill shows split declarations. +- **Checks:** `packages/hotkeys/tests/app-hotkeys.test.ts` covers spread-in types, a renamed entry, and option errors beside spread-in entries; `app-hotkeys-type-performance.test.ts` spreads 100 entries. `intent validate` passes. Not run: fresh-consumer sessions. diff --git a/docs/framework/alpine/guides/app-hotkeys.md b/docs/framework/alpine/guides/app-hotkeys.md index db10dbf48..bcdc8b2cd 100644 --- a/docs/framework/alpine/guides/app-hotkeys.md +++ b/docs/framework/alpine/guides/app-hotkeys.md @@ -47,6 +47,32 @@ declare module '@tanstack/alpine-hotkeys' { The `Register` augmentation types `createAppHotkeys()`, the ids accepted by `createCustomHotkeys()`, and the `CustomHotkeys` type. +### Split declarations across files + +A large app can declare its hotkeys next to the features that own them. Call `defineAppHotkeys` in each file, then spread the results into the one object you register: + +```ts +// features/editor/hotkeys.ts +import { defineAppHotkeys } from '@tanstack/alpine-hotkeys' + +export const editorHotkeys = defineAppHotkeys({ + 'editor.format': { hotkey: 'Mod+Shift+F', meta: { name: 'Format document' } }, +}) +``` + +```ts +// app-hotkeys.ts +import { defineAppHotkeys } from '@tanstack/alpine-hotkeys' +import { editorHotkeys } from './features/editor/hotkeys' + +export const appHotkeys = defineAppHotkeys({ + ...editorHotkeys, + 'palette.open': { hotkey: null, meta: { name: 'Command palette' } }, +}) +``` + +Each file's call checks its own declarations, so a mismatched option is a type error in that file. Spread-in entries keep their id and the kind of their default. Register and provide only the combined object, since a file's own object lists only that file's hotkeys. A later spread replaces an entry with the same id without an error, so keep ids unique across files. + ## Provide app hotkeys Publish the declarations with `provideAppHotkeys` before Alpine starts: diff --git a/docs/framework/angular/guides/app-hotkeys.md b/docs/framework/angular/guides/app-hotkeys.md index d9d842049..242fd693b 100644 --- a/docs/framework/angular/guides/app-hotkeys.md +++ b/docs/framework/angular/guides/app-hotkeys.md @@ -45,6 +45,32 @@ declare module '@tanstack/angular-hotkeys' { The `Register` module augmentation enables autocomplete and type checking for `injectAppHotkeys()`, `injectCustomHotkeys()`, and `CustomHotkeys`. +### Split declarations across files + +A large app can declare its hotkeys next to the features that own them. Call `defineAppHotkeys` in each file, then spread the results into the one object you register: + +```ts +// features/editor/hotkeys.ts +import { defineAppHotkeys } from '@tanstack/angular-hotkeys' + +export const editorHotkeys = defineAppHotkeys({ + 'editor.format': { hotkey: 'Mod+Shift+F', meta: { name: 'Format document' } }, +}) +``` + +```ts +// app-hotkeys.ts +import { defineAppHotkeys } from '@tanstack/angular-hotkeys' +import { editorHotkeys } from './features/editor/hotkeys' + +export const appHotkeys = defineAppHotkeys({ + ...editorHotkeys, + 'palette.open': { hotkey: null, meta: { name: 'Command palette' } }, +}) +``` + +Each file's call checks its own declarations, so a mismatched option is a type error in that file. Spread-in entries keep their id and the kind of their default. Register and provide only the combined object, since a file's own object lists only that file's hotkeys. A later spread replaces an entry with the same id without an error, so keep ids unique across files. + ## Provide app hotkeys Pass the declarations to `provideHotkeys` in your application config. See [Provide app hotkeys](./provide-hotkeys-and-scopes#provide-app-hotkeys): diff --git a/docs/framework/ember/guides/app-hotkeys.md b/docs/framework/ember/guides/app-hotkeys.md index a5a3ae46a..973d412c7 100644 --- a/docs/framework/ember/guides/app-hotkeys.md +++ b/docs/framework/ember/guides/app-hotkeys.md @@ -47,6 +47,32 @@ declare module '@tanstack/ember-hotkeys' { The `Register` augmentation types `useAppHotkeys()`, the ids accepted by `useCustomHotkeys()`, and the `CustomHotkeys` type. +### Split declarations across files + +A large app can declare its hotkeys next to the features that own them. Call `defineAppHotkeys` in each file, then spread the results into the one object you register: + +```ts +// features/editor/hotkeys.ts +import { defineAppHotkeys } from '@tanstack/ember-hotkeys' + +export const editorHotkeys = defineAppHotkeys({ + 'editor.format': { hotkey: 'Mod+Shift+F', meta: { name: 'Format document' } }, +}) +``` + +```ts +// app-hotkeys.ts +import { defineAppHotkeys } from '@tanstack/ember-hotkeys' +import { editorHotkeys } from './features/editor/hotkeys' + +export const appHotkeys = defineAppHotkeys({ + ...editorHotkeys, + 'palette.open': { hotkey: null, meta: { name: 'Command palette' } }, +}) +``` + +Each file's call checks its own declarations, so a mismatched option is a type error in that file. Spread-in entries keep their id and the kind of their default. Register and provide only the combined object, since a file's own object lists only that file's hotkeys. A later spread replaces an entry with the same id without an error, so keep ids unique across files. + ## Provide app hotkeys Publish the declarations with `provideAppHotkeys` before the application boots: diff --git a/docs/framework/lit/guides/app-hotkeys.md b/docs/framework/lit/guides/app-hotkeys.md index b3d285b24..828f1aa13 100644 --- a/docs/framework/lit/guides/app-hotkeys.md +++ b/docs/framework/lit/guides/app-hotkeys.md @@ -47,6 +47,32 @@ declare module '@tanstack/lit-hotkeys' { The `Register` augmentation types `AppHotkeysController`, the ids it accepts when changing custom hotkeys, and the `CustomHotkeys` type. +### Split declarations across files + +A large app can declare its hotkeys next to the features that own them. Call `defineAppHotkeys` in each file, then spread the results into the one object you register: + +```ts +// features/editor/hotkeys.ts +import { defineAppHotkeys } from '@tanstack/lit-hotkeys' + +export const editorHotkeys = defineAppHotkeys({ + 'editor.format': { hotkey: 'Mod+Shift+F', meta: { name: 'Format document' } }, +}) +``` + +```ts +// app-hotkeys.ts +import { defineAppHotkeys } from '@tanstack/lit-hotkeys' +import { editorHotkeys } from './features/editor/hotkeys' + +export const appHotkeys = defineAppHotkeys({ + ...editorHotkeys, + 'palette.open': { hotkey: null, meta: { name: 'Command palette' } }, +}) +``` + +Each file's call checks its own declarations, so a mismatched option is a type error in that file. Spread-in entries keep their id and the kind of their default. Register and provide only the combined object, since a file's own object lists only that file's hotkeys. A later spread replaces an entry with the same id without an error, so keep ids unique across files. + ## Provide app hotkeys Publish the declarations with `provideAppHotkeys` before your elements render: diff --git a/docs/framework/octane/guides/app-hotkeys.md b/docs/framework/octane/guides/app-hotkeys.md index 01559e6db..80231fa7d 100644 --- a/docs/framework/octane/guides/app-hotkeys.md +++ b/docs/framework/octane/guides/app-hotkeys.md @@ -45,6 +45,32 @@ declare module '@tanstack/octane-hotkeys' { The `Register` module augmentation enables autocomplete and type checking for `useAppHotkeys()`, `useCustomHotkeys()`, and `CustomHotkeys`. +### Split declarations across files + +A large app can declare its hotkeys next to the features that own them. Call `defineAppHotkeys` in each file, then spread the results into the one object you register: + +```ts +// features/editor/hotkeys.ts +import { defineAppHotkeys } from '@tanstack/octane-hotkeys' + +export const editorHotkeys = defineAppHotkeys({ + 'editor.format': { hotkey: 'Mod+Shift+F', meta: { name: 'Format document' } }, +}) +``` + +```ts +// app-hotkeys.ts +import { defineAppHotkeys } from '@tanstack/octane-hotkeys' +import { editorHotkeys } from './features/editor/hotkeys' + +export const appHotkeys = defineAppHotkeys({ + ...editorHotkeys, + 'palette.open': { hotkey: null, meta: { name: 'Command palette' } }, +}) +``` + +Each file's call checks its own declarations, so a mismatched option is a type error in that file. Spread-in entries keep their id and the kind of their default. Register and provide only the combined object, since a file's own object lists only that file's hotkeys. A later spread replaces an entry with the same id without an error, so keep ids unique across files. + ## Provide app hotkeys Pass your declarations to the root `HotkeysProvider` (see [Provide app hotkeys](./hotkeys-provider-and-scopes#provide-app-hotkeys)): diff --git a/docs/framework/preact/guides/app-hotkeys.md b/docs/framework/preact/guides/app-hotkeys.md index d578ba5fe..0b4b08f90 100644 --- a/docs/framework/preact/guides/app-hotkeys.md +++ b/docs/framework/preact/guides/app-hotkeys.md @@ -45,6 +45,32 @@ declare module '@tanstack/preact-hotkeys' { The `Register` module augmentation enables autocomplete and type checking for `useAppHotkeys()`, `useCustomHotkeys()`, and `CustomHotkeys`. +### Split declarations across files + +A large app can declare its hotkeys next to the features that own them. Call `defineAppHotkeys` in each file, then spread the results into the one object you register: + +```ts +// features/editor/hotkeys.ts +import { defineAppHotkeys } from '@tanstack/preact-hotkeys' + +export const editorHotkeys = defineAppHotkeys({ + 'editor.format': { hotkey: 'Mod+Shift+F', meta: { name: 'Format document' } }, +}) +``` + +```ts +// app-hotkeys.ts +import { defineAppHotkeys } from '@tanstack/preact-hotkeys' +import { editorHotkeys } from './features/editor/hotkeys' + +export const appHotkeys = defineAppHotkeys({ + ...editorHotkeys, + 'palette.open': { hotkey: null, meta: { name: 'Command palette' } }, +}) +``` + +Each file's call checks its own declarations, so a mismatched option is a type error in that file. Spread-in entries keep their id and the kind of their default. Register and provide only the combined object, since a file's own object lists only that file's hotkeys. A later spread replaces an entry with the same id without an error, so keep ids unique across files. + ## Provide app hotkeys Pass your declarations to the root `HotkeysProvider` (see [Provide app hotkeys](./hotkeys-provider-and-scopes#provide-app-hotkeys)): diff --git a/docs/framework/react/guides/app-hotkeys.md b/docs/framework/react/guides/app-hotkeys.md index 664f365fc..0b6d7d8bf 100644 --- a/docs/framework/react/guides/app-hotkeys.md +++ b/docs/framework/react/guides/app-hotkeys.md @@ -45,6 +45,32 @@ declare module '@tanstack/react-hotkeys' { The `Register` module augmentation enables autocomplete and type checking for `useAppHotkeys()`, `useCustomHotkeys()`, and `CustomHotkeys`. +### Split declarations across files + +A large app can declare its hotkeys next to the features that own them. Call `defineAppHotkeys` in each file, then spread the results into the one object you register: + +```ts +// features/editor/hotkeys.ts +import { defineAppHotkeys } from '@tanstack/react-hotkeys' + +export const editorHotkeys = defineAppHotkeys({ + 'editor.format': { hotkey: 'Mod+Shift+F', meta: { name: 'Format document' } }, +}) +``` + +```ts +// app-hotkeys.ts +import { defineAppHotkeys } from '@tanstack/react-hotkeys' +import { editorHotkeys } from './features/editor/hotkeys' + +export const appHotkeys = defineAppHotkeys({ + ...editorHotkeys, + 'palette.open': { hotkey: null, meta: { name: 'Command palette' } }, +}) +``` + +Each file's call checks its own declarations, so a mismatched option is a type error in that file. Spread-in entries keep their id and the kind of their default. Register and provide only the combined object, since a file's own object lists only that file's hotkeys. A later spread replaces an entry with the same id without an error, so keep ids unique across files. + ## Provide app hotkeys Pass your declarations to the root `HotkeysProvider` (see [Provide app hotkeys](./hotkeys-provider-and-scopes#provide-app-hotkeys)): diff --git a/docs/framework/solid/guides/app-hotkeys.md b/docs/framework/solid/guides/app-hotkeys.md index 4b5d89511..268f73c37 100644 --- a/docs/framework/solid/guides/app-hotkeys.md +++ b/docs/framework/solid/guides/app-hotkeys.md @@ -45,6 +45,32 @@ declare module '@tanstack/solid-hotkeys' { The `Register` module augmentation enables autocomplete and type checking for `useAppHotkeys()`, `useCustomHotkeys()`, and `CustomHotkeys`. +### Split declarations across files + +A large app can declare its hotkeys next to the features that own them. Call `defineAppHotkeys` in each file, then spread the results into the one object you register: + +```ts +// features/editor/hotkeys.ts +import { defineAppHotkeys } from '@tanstack/solid-hotkeys' + +export const editorHotkeys = defineAppHotkeys({ + 'editor.format': { hotkey: 'Mod+Shift+F', meta: { name: 'Format document' } }, +}) +``` + +```ts +// app-hotkeys.ts +import { defineAppHotkeys } from '@tanstack/solid-hotkeys' +import { editorHotkeys } from './features/editor/hotkeys' + +export const appHotkeys = defineAppHotkeys({ + ...editorHotkeys, + 'palette.open': { hotkey: null, meta: { name: 'Command palette' } }, +}) +``` + +Each file's call checks its own declarations, so a mismatched option is a type error in that file. Spread-in entries keep their id and the kind of their default. Register and provide only the combined object, since a file's own object lists only that file's hotkeys. A later spread replaces an entry with the same id without an error, so keep ids unique across files. + ## Provide app hotkeys Pass your declarations to the root `HotkeysProvider` (see [Provide app hotkeys](./hotkeys-provider-and-scopes#provide-app-hotkeys)): diff --git a/docs/framework/svelte/guides/app-hotkeys.md b/docs/framework/svelte/guides/app-hotkeys.md index bb1ca7623..e2f8eaa73 100644 --- a/docs/framework/svelte/guides/app-hotkeys.md +++ b/docs/framework/svelte/guides/app-hotkeys.md @@ -45,6 +45,32 @@ declare module '@tanstack/svelte-hotkeys' { The `Register` module augmentation enables autocomplete and type checking for `getAppHotkeys()`, `getCustomHotkeys()`, and `CustomHotkeys`. +### Split declarations across files + +A large app can declare its hotkeys next to the features that own them. Call `defineAppHotkeys` in each file, then spread the results into the one object you register: + +```ts +// features/editor/hotkeys.ts +import { defineAppHotkeys } from '@tanstack/svelte-hotkeys' + +export const editorHotkeys = defineAppHotkeys({ + 'editor.format': { hotkey: 'Mod+Shift+F', meta: { name: 'Format document' } }, +}) +``` + +```ts +// app-hotkeys.ts +import { defineAppHotkeys } from '@tanstack/svelte-hotkeys' +import { editorHotkeys } from './features/editor/hotkeys' + +export const appHotkeys = defineAppHotkeys({ + ...editorHotkeys, + 'palette.open': { hotkey: null, meta: { name: 'Command palette' } }, +}) +``` + +Each file's call checks its own declarations, so a mismatched option is a type error in that file. Spread-in entries keep their id and the kind of their default. Register and provide only the combined object, since a file's own object lists only that file's hotkeys. A later spread replaces an entry with the same id without an error, so keep ids unique across files. + ## Provide app hotkeys Pass the declarations to the root `HotkeysProvider`. See [Provide app hotkeys](./hotkeys-provider-and-scopes#provide-app-hotkeys): diff --git a/docs/framework/vue/guides/app-hotkeys.md b/docs/framework/vue/guides/app-hotkeys.md index e1891a05e..d9c6510c2 100644 --- a/docs/framework/vue/guides/app-hotkeys.md +++ b/docs/framework/vue/guides/app-hotkeys.md @@ -45,6 +45,32 @@ declare module '@tanstack/vue-hotkeys' { The `Register` module augmentation enables autocomplete and type checking for `useAppHotkeys()`, `useCustomHotkeys()`, and `CustomHotkeys`. +### Split declarations across files + +A large app can declare its hotkeys next to the features that own them. Call `defineAppHotkeys` in each file, then spread the results into the one object you register: + +```ts +// features/editor/hotkeys.ts +import { defineAppHotkeys } from '@tanstack/vue-hotkeys' + +export const editorHotkeys = defineAppHotkeys({ + 'editor.format': { hotkey: 'Mod+Shift+F', meta: { name: 'Format document' } }, +}) +``` + +```ts +// app-hotkeys.ts +import { defineAppHotkeys } from '@tanstack/vue-hotkeys' +import { editorHotkeys } from './features/editor/hotkeys' + +export const appHotkeys = defineAppHotkeys({ + ...editorHotkeys, + 'palette.open': { hotkey: null, meta: { name: 'Command palette' } }, +}) +``` + +Each file's call checks its own declarations, so a mismatched option is a type error in that file. Spread-in entries keep their id and the kind of their default. Register and provide only the combined object, since a file's own object lists only that file's hotkeys. A later spread replaces an entry with the same id without an error, so keep ids unique across files. + ## Provide app hotkeys Pass the declarations to the root `HotkeysProvider`. See [Provide app hotkeys](./hotkeys-provider-and-scopes#provide-app-hotkeys): diff --git a/docs/reference/adapter/functions/installAppHotkeysStore.md b/docs/reference/adapter/functions/installAppHotkeysStore.md index 1d75fe7bc..332d401d1 100644 --- a/docs/reference/adapter/functions/installAppHotkeysStore.md +++ b/docs/reference/adapter/functions/installAppHotkeysStore.md @@ -9,7 +9,7 @@ title: installAppHotkeysStore function installAppHotkeysStore(): void; ``` -Defined in: [app-hotkeys.ts:207](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L207) +Defined in: [app-hotkeys.ts:230](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L230) Lets providers in this bundle create stores for app hotkeys. `defineAppHotkeys` calls it. Adapters call it where the declarations can diff --git a/docs/reference/classes/AppHotkeysStore.md b/docs/reference/classes/AppHotkeysStore.md index b6f1f9145..446c836f4 100644 --- a/docs/reference/classes/AppHotkeysStore.md +++ b/docs/reference/classes/AppHotkeysStore.md @@ -5,7 +5,7 @@ title: AppHotkeysStore -Defined in: [app-hotkeys.ts:459](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L459) +Defined in: [app-hotkeys.ts:482](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L482) Holds declared app hotkeys and the user's custom hotkeys. Framework providers create one and expose it through hooks; devtools read it from @@ -36,7 +36,7 @@ store.setCustomHotkey('doc.save', 'Mod+Shift+S') new AppHotkeysStore(appHotkeys, options?): AppHotkeysStore; ``` -Defined in: [app-hotkeys.ts:466](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L466) +Defined in: [app-hotkeys.ts:489](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L489) #### Parameters @@ -60,7 +60,7 @@ Defined in: [app-hotkeys.ts:466](https://github.com/TanStack/hotkeys/blob/main/p readonly store: Store>; ``` -Defined in: [app-hotkeys.ts:460](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L460) +Defined in: [app-hotkeys.ts:483](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L483) ## Accessors @@ -72,7 +72,7 @@ Defined in: [app-hotkeys.ts:460](https://github.com/TanStack/hotkeys/blob/main/p get appHotkeys(): T; ``` -Defined in: [app-hotkeys.ts:485](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L485) +Defined in: [app-hotkeys.ts:508](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L508) Effective app hotkeys. @@ -90,7 +90,7 @@ Effective app hotkeys. get customHotkeys(): CustomHotkeys; ``` -Defined in: [app-hotkeys.ts:490](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L490) +Defined in: [app-hotkeys.ts:513](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L513) The user's hotkeys that differ from the defaults. @@ -113,7 +113,7 @@ findConflicts( | null>[]; ``` -Defined in: [app-hotkeys.ts:579](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L579) +Defined in: [app-hotkeys.ts:602](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L602) Other app hotkeys that would collide if `id` used `hotkey`. App hotkeys collide when their scopes match or either is `'global'`, and their @@ -169,7 +169,7 @@ get(id): | undefined; ``` -Defined in: [app-hotkeys.ts:554](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L554) +Defined in: [app-hotkeys.ts:577](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L577) Effective app hotkey for an id, or `undefined` when it is not declared. @@ -195,7 +195,7 @@ Effective app hotkey for an id, or `undefined` when it is not declared. getList(registrations): AppHotkeyListItem[]; ``` -Defined in: [app-hotkeys.ts:664](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L664) +Defined in: [app-hotkeys.ts:687](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L687) Joins app hotkeys with live registrations, in declaration order. Adapters call this with the manager's registration views. @@ -218,7 +218,7 @@ Adapters call this with the manager's registration views. resetCustomHotkey(id): void; ``` -Defined in: [app-hotkeys.ts:641](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L641) +Defined in: [app-hotkeys.ts:664](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L664) Restores the default hotkey for an app hotkey. @@ -240,7 +240,7 @@ keyof `T` & `string` resetCustomHotkeys(): void; ``` -Defined in: [app-hotkeys.ts:648](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L648) +Defined in: [app-hotkeys.ts:671](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L671) Restores every default hotkey. @@ -256,7 +256,7 @@ Restores every default hotkey. setAppHotkeys(appHotkeys): void; ``` -Defined in: [app-hotkeys.ts:540](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L540) +Defined in: [app-hotkeys.ts:563](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L563) Replaces the declarations, for example after hot module replacement. Custom hotkeys for ids that still exist are kept. @@ -286,7 +286,7 @@ setCustomHotkey( | null>[]; ``` -Defined in: [app-hotkeys.ts:607](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L607) +Defined in: [app-hotkeys.ts:630](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L630) Sets the user's hotkey for an app hotkey. `null` unbinds it. A hotkey equal to the default removes the customization. Pass the recorder's @@ -325,7 +325,7 @@ hotkey, such as `''`, and both return an empty array. setOptions(options): void; ``` -Defined in: [app-hotkeys.ts:504](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L504) +Defined in: [app-hotkeys.ts:527](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L527) Updates options. Providers call it with their props on every update. diff --git a/docs/reference/functions/defineAppHotkeys.md b/docs/reference/functions/defineAppHotkeys.md index 7bedd14fc..55afd32df 100644 --- a/docs/reference/functions/defineAppHotkeys.md +++ b/docs/reference/functions/defineAppHotkeys.md @@ -9,7 +9,7 @@ title: defineAppHotkeys function defineAppHotkeys(definitions): DefinedAppHotkeys; ``` -Defined in: [app-hotkeys.ts:182](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L182) +Defined in: [app-hotkeys.ts:205](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L205) Declares every app hotkey up front, without registering any, so cheat sheets and settings screens can list hotkeys whose components have not diff --git a/docs/reference/functions/getAppHotkeyRegistrationOptions.md b/docs/reference/functions/getAppHotkeyRegistrationOptions.md index ff8be86f2..d32982d30 100644 --- a/docs/reference/functions/getAppHotkeyRegistrationOptions.md +++ b/docs/reference/functions/getAppHotkeyRegistrationOptions.md @@ -9,7 +9,7 @@ title: getAppHotkeyRegistrationOptions function getAppHotkeyRegistrationOptions(appHotkey): AppHotkeyChordOptions & AppHotkeySequenceOptions & object; ``` -Defined in: [app-hotkeys.ts:716](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L716) +Defined in: [app-hotkeys.ts:739](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L739) Options that adapters pass to the manager when registering an app hotkey: declared options, scope, meta, and the app hotkey id. The manager drops options diff --git a/docs/reference/functions/installAppHotkeysStore.md b/docs/reference/functions/installAppHotkeysStore.md index 1d75fe7bc..332d401d1 100644 --- a/docs/reference/functions/installAppHotkeysStore.md +++ b/docs/reference/functions/installAppHotkeysStore.md @@ -9,7 +9,7 @@ title: installAppHotkeysStore function installAppHotkeysStore(): void; ``` -Defined in: [app-hotkeys.ts:207](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L207) +Defined in: [app-hotkeys.ts:230](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L230) Lets providers in this bundle create stores for app hotkeys. `defineAppHotkeys` calls it. Adapters call it where the declarations can diff --git a/docs/reference/functions/isAppHotkey.md b/docs/reference/functions/isAppHotkey.md index a9231f764..f49e8b986 100644 --- a/docs/reference/functions/isAppHotkey.md +++ b/docs/reference/functions/isAppHotkey.md @@ -9,7 +9,7 @@ title: isAppHotkey function isAppHotkey(value): value is AppHotkey; ``` -Defined in: [app-hotkeys.ts:214](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L214) +Defined in: [app-hotkeys.ts:237](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L237) Whether a value is an app hotkey created by `defineAppHotkeys`. diff --git a/docs/reference/functions/isCustomHotkey.md b/docs/reference/functions/isCustomHotkey.md index ed267a73c..cec51df0d 100644 --- a/docs/reference/functions/isCustomHotkey.md +++ b/docs/reference/functions/isCustomHotkey.md @@ -9,7 +9,7 @@ title: isCustomHotkey function isCustomHotkey(appHotkey, platform?): boolean; ``` -Defined in: [app-hotkeys.ts:232](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L232) +Defined in: [app-hotkeys.ts:255](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L255) Whether an app hotkey's effective hotkey differs from its default. diff --git a/docs/reference/functions/provideAppHotkeys.md b/docs/reference/functions/provideAppHotkeys.md index fa12435dd..28005d31d 100644 --- a/docs/reference/functions/provideAppHotkeys.md +++ b/docs/reference/functions/provideAppHotkeys.md @@ -9,7 +9,7 @@ title: provideAppHotkeys function provideAppHotkeys(appHotkeys, options?): object; ``` -Defined in: [app-hotkeys.ts:763](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L763) +Defined in: [app-hotkeys.ts:786](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L786) Creates an app hotkeys store and publishes it on the HotkeyManager, for adapters without a provider component (such as Lit and Alpine). Hotkey diff --git a/docs/reference/functions/publishAppHotkeysStore.md b/docs/reference/functions/publishAppHotkeysStore.md index 4655160f4..4ef3d19d8 100644 --- a/docs/reference/functions/publishAppHotkeysStore.md +++ b/docs/reference/functions/publishAppHotkeysStore.md @@ -9,7 +9,7 @@ title: publishAppHotkeysStore function publishAppHotkeysStore(store): () => void; ``` -Defined in: [app-hotkeys.ts:737](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L737) +Defined in: [app-hotkeys.ts:760](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L760) Publishes a provider's store on the HotkeyManager so devtools can list declared hotkeys. Returns a cleanup function that unpublishes it if it is diff --git a/docs/reference/functions/resolveAppHotkey.md b/docs/reference/functions/resolveAppHotkey.md index 358cb6cb2..890dfc3e9 100644 --- a/docs/reference/functions/resolveAppHotkey.md +++ b/docs/reference/functions/resolveAppHotkey.md @@ -9,7 +9,7 @@ title: resolveAppHotkey function resolveAppHotkey(appHotkey, store): AppHotkey; ``` -Defined in: [app-hotkeys.ts:704](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L704) +Defined in: [app-hotkeys.ts:727](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L727) Returns the provider's version of an app hotkey, so custom hotkeys apply even when a component imports the declaration directly. Falls back to the diff --git a/docs/reference/interfaces/AppHotkeyListItem.md b/docs/reference/interfaces/AppHotkeyListItem.md index 933ee0297..e79a76a80 100644 --- a/docs/reference/interfaces/AppHotkeyListItem.md +++ b/docs/reference/interfaces/AppHotkeyListItem.md @@ -5,7 +5,7 @@ title: AppHotkeyListItem -Defined in: [app-hotkeys.ts:378](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L378) +Defined in: [app-hotkeys.ts:401](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L401) One row of an app hotkey cheat sheet. @@ -23,7 +23,7 @@ One row of an app hotkey cheat sheet. appHotkey: T; ``` -Defined in: [app-hotkeys.ts:379](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L379) +Defined in: [app-hotkeys.ts:402](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L402) *** @@ -33,7 +33,7 @@ Defined in: [app-hotkeys.ts:379](https://github.com/TanStack/hotkeys/blob/main/p isCustom: boolean; ``` -Defined in: [app-hotkeys.ts:382](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L382) +Defined in: [app-hotkeys.ts:405](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L405) Whether the effective hotkey differs from the declared default. @@ -45,7 +45,7 @@ Whether the effective hotkey differs from the declared default. registrations: HotkeyRegistrationView[]; ``` -Defined in: [app-hotkeys.ts:384](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L384) +Defined in: [app-hotkeys.ts:407](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L407) Live registrations of this app hotkey (for example, one per list row). @@ -57,4 +57,4 @@ Live registrations of this app hotkey (for example, one per list row). status: AppHotkeyStatus; ``` -Defined in: [app-hotkeys.ts:380](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L380) +Defined in: [app-hotkeys.ts:403](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L403) diff --git a/docs/reference/interfaces/AppHotkeysState.md b/docs/reference/interfaces/AppHotkeysState.md index fb2e5faa7..6675f0e2e 100644 --- a/docs/reference/interfaces/AppHotkeysState.md +++ b/docs/reference/interfaces/AppHotkeysState.md @@ -5,7 +5,7 @@ title: AppHotkeysState -Defined in: [app-hotkeys.ts:388](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L388) +Defined in: [app-hotkeys.ts:411](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L411) State of an `AppHotkeysStore`. @@ -23,7 +23,7 @@ State of an `AppHotkeysStore`. appHotkeys: T; ``` -Defined in: [app-hotkeys.ts:390](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L390) +Defined in: [app-hotkeys.ts:413](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L413) Effective app hotkeys: declarations with custom hotkeys applied. @@ -35,6 +35,6 @@ Effective app hotkeys: declarations with custom hotkeys applied. customHotkeys: CustomHotkeys; ``` -Defined in: [app-hotkeys.ts:392](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L392) +Defined in: [app-hotkeys.ts:415](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L415) The user's hotkeys that differ from the defaults. diff --git a/docs/reference/interfaces/AppHotkeysStoreOptions.md b/docs/reference/interfaces/AppHotkeysStoreOptions.md index e748e59c6..d4bd8ed7d 100644 --- a/docs/reference/interfaces/AppHotkeysStoreOptions.md +++ b/docs/reference/interfaces/AppHotkeysStoreOptions.md @@ -5,7 +5,7 @@ title: AppHotkeysStoreOptions -Defined in: [app-hotkeys.ts:429](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L429) +Defined in: [app-hotkeys.ts:452](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L452) Options for `AppHotkeysStore`. @@ -23,7 +23,7 @@ Options for `AppHotkeysStore`. optional customHotkeys?: CustomHotkeys | null; ``` -Defined in: [app-hotkeys.ts:437](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L437) +Defined in: [app-hotkeys.ts:460](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L460) The user's saved custom hotkeys. Unknown ids and invalid entries are ignored. Passing a different value to `setOptions` later, such as data @@ -39,7 +39,7 @@ clears them. optional onCustomHotkeysChange?: (customHotkeys) => void; ``` -Defined in: [app-hotkeys.ts:439](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L439) +Defined in: [app-hotkeys.ts:462](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L462) Called with the custom hotkeys after every change, ready to save. @@ -61,6 +61,6 @@ Called with the custom hotkeys after every change, ready to save. optional platform?: HotkeyPlatform; ``` -Defined in: [app-hotkeys.ts:441](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L441) +Defined in: [app-hotkeys.ts:464](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L464) Platform used to compare hotkeys. Defaults to detection. diff --git a/docs/reference/interfaces/CustomHotkeyActions.md b/docs/reference/interfaces/CustomHotkeyActions.md index 75f6ff87d..a99c2ebf4 100644 --- a/docs/reference/interfaces/CustomHotkeyActions.md +++ b/docs/reference/interfaces/CustomHotkeyActions.md @@ -5,7 +5,7 @@ title: CustomHotkeyActions -Defined in: [app-hotkeys.ts:401](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L401) +Defined in: [app-hotkeys.ts:424](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L424) Actions that change the user's custom hotkeys, as adapters return them. @@ -20,7 +20,7 @@ findConflicts: (id, hotkey, recordedWith?) => AppHotkey[]; ``` -Defined in: [app-hotkeys.ts:421](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L421) +Defined in: [app-hotkeys.ts:444](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L444) Other app hotkeys that would collide if `id` used `hotkey`. Pass the recorder's `context` for a recorded hotkey: it has the key press, which @@ -55,7 +55,7 @@ also finds a hotkey written differently that the same press fires. resetCustomHotkey: (id) => void; ``` -Defined in: [app-hotkeys.ts:413](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L413) +Defined in: [app-hotkeys.ts:436](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L436) Restores the default hotkey for an app hotkey. @@ -77,7 +77,7 @@ Restores the default hotkey for an app hotkey. resetCustomHotkeys: () => void; ``` -Defined in: [app-hotkeys.ts:415](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L415) +Defined in: [app-hotkeys.ts:438](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L438) Restores every default hotkey. @@ -96,7 +96,7 @@ setCustomHotkey: (id, hotkey, recordedWith?) => AppHotkey[]; ``` -Defined in: [app-hotkeys.ts:407](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L407) +Defined in: [app-hotkeys.ts:430](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L430) Sets the user's hotkey for an app hotkey. `null` unbinds it. Returns conflicting app hotkeys; when any exist, nothing changes. Pass diff --git a/docs/reference/interfaces/RecordedKeyPresses.md b/docs/reference/interfaces/RecordedKeyPresses.md index 7371cb84d..8752636c5 100644 --- a/docs/reference/interfaces/RecordedKeyPresses.md +++ b/docs/reference/interfaces/RecordedKeyPresses.md @@ -5,7 +5,7 @@ title: RecordedKeyPresses -Defined in: [app-hotkeys.ts:340](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L340) +Defined in: [app-hotkeys.ts:363](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L363) The key presses that recorded a hotkey. A recorder passes them to `validate` and `onRecord` as its context, which can be passed on as is. @@ -18,7 +18,7 @@ and `onRecord` as its context, which can be passed on as is. optional event?: KeyboardEvent; ``` -Defined in: [app-hotkeys.ts:342](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L342) +Defined in: [app-hotkeys.ts:365](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L365) The key press that recorded a chord. @@ -30,6 +30,6 @@ The key press that recorded a chord. optional events?: readonly KeyboardEvent[]; ``` -Defined in: [app-hotkeys.ts:344](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L344) +Defined in: [app-hotkeys.ts:367](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L367) The key press that recorded each step of a sequence. diff --git a/docs/reference/type-aliases/AppHotkeyDefaultKind.md b/docs/reference/type-aliases/AppHotkeyDefaultKind.md index 5ad9027f7..0ffbaeeb8 100644 --- a/docs/reference/type-aliases/AppHotkeyDefaultKind.md +++ b/docs/reference/type-aliases/AppHotkeyDefaultKind.md @@ -9,7 +9,7 @@ title: AppHotkeyDefaultKind type AppHotkeyDefaultKind = THotkey extends null ? null : THotkey extends readonly [unknown] ? HotkeyChord : THotkey extends ReadonlyArray ? HotkeySequence : HotkeyChord; ``` -Defined in: [app-hotkeys.ts:132](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L132) +Defined in: [app-hotkeys.ts:141](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L141) The kind of a declared default hotkey; a one-step sequence is a chord. diff --git a/docs/reference/type-aliases/AppHotkeyId.md b/docs/reference/type-aliases/AppHotkeyId.md index 7dce21e97..8048172f5 100644 --- a/docs/reference/type-aliases/AppHotkeyId.md +++ b/docs/reference/type-aliases/AppHotkeyId.md @@ -9,6 +9,6 @@ title: AppHotkeyId type AppHotkeyId = keyof RegisteredAppHotkeys & string; ``` -Defined in: [app-hotkeys.ts:158](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L158) +Defined in: [app-hotkeys.ts:181](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L181) Ids of the registered app hotkeys. diff --git a/docs/reference/type-aliases/AppHotkeyStatus.md b/docs/reference/type-aliases/AppHotkeyStatus.md index ed8669391..40823da65 100644 --- a/docs/reference/type-aliases/AppHotkeyStatus.md +++ b/docs/reference/type-aliases/AppHotkeyStatus.md @@ -12,7 +12,7 @@ type AppHotkeyStatus = | "unbound"; ``` -Defined in: [app-hotkeys.ts:375](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L375) +Defined in: [app-hotkeys.ts:398](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L398) Status of an app hotkey in the running app. - `'active'`: at least one enabled registration diff --git a/docs/reference/type-aliases/CustomHotkeys.md b/docs/reference/type-aliases/CustomHotkeys.md index 9d35640c8..750a711e8 100644 --- a/docs/reference/type-aliases/CustomHotkeys.md +++ b/docs/reference/type-aliases/CustomHotkeys.md @@ -9,7 +9,7 @@ title: CustomHotkeys type CustomHotkeys = { -readonly [K in keyof T]?: Hotkey | null }; ``` -Defined in: [app-hotkeys.ts:164](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L164) +Defined in: [app-hotkeys.ts:187](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L187) The user's hotkeys that differ from the declared defaults, keyed by app hotkey id. This is the shape to save. `null` means the user unbound it. diff --git a/docs/reference/type-aliases/DefinedAppHotkeys.md b/docs/reference/type-aliases/DefinedAppHotkeys.md index 4e933453b..49952206f 100644 --- a/docs/reference/type-aliases/DefinedAppHotkeys.md +++ b/docs/reference/type-aliases/DefinedAppHotkeys.md @@ -6,12 +6,16 @@ title: DefinedAppHotkeys ```ts -type DefinedAppHotkeys = { readonly [K in keyof T & string]: AppHotkey> }; +type DefinedAppHotkeys = { readonly [K in keyof T & string]: AppHotkey> }; ``` -Defined in: [app-hotkeys.ts:141](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L141) +Defined in: [app-hotkeys.ts:156](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L156) -The app hotkeys returned by `defineAppHotkeys` for a declaration object. +The app hotkeys returned by `defineAppHotkeys` for a declaration object. An +entry that is already an app hotkey, spread in from another +`defineAppHotkeys` call, keeps the kind of its default. Spread the results +of `defineAppHotkeys`, not app hotkeys read from a store: their `hotkey` is +the user's custom hotkey, which would become the new default. ## Type Parameters diff --git a/docs/reference/type-aliases/RegisteredAppHotkeyListItem.md b/docs/reference/type-aliases/RegisteredAppHotkeyListItem.md index 9cf18315f..8fa18ba3c 100644 --- a/docs/reference/type-aliases/RegisteredAppHotkeyListItem.md +++ b/docs/reference/type-aliases/RegisteredAppHotkeyListItem.md @@ -9,6 +9,6 @@ title: RegisteredAppHotkeyListItem type RegisteredAppHotkeyListItem = AppHotkeyListItem; ``` -Defined in: [app-hotkeys.ts:396](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L396) +Defined in: [app-hotkeys.ts:419](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L419) A cheat sheet row for one of the registered app hotkeys. diff --git a/docs/reference/type-aliases/RegisteredAppHotkeys.md b/docs/reference/type-aliases/RegisteredAppHotkeys.md index 7f32bce64..1459a971a 100644 --- a/docs/reference/type-aliases/RegisteredAppHotkeys.md +++ b/docs/reference/type-aliases/RegisteredAppHotkeys.md @@ -9,6 +9,6 @@ title: RegisteredAppHotkeys type RegisteredAppHotkeys = Register extends object ? T : AppHotkeys; ``` -Defined in: [app-hotkeys.ts:151](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L151) +Defined in: [app-hotkeys.ts:174](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/app-hotkeys.ts#L174) The app hotkeys type from `Register`, or a generic map when none is registered. diff --git a/packages/hotkeys/skills/app-hotkeys/SKILL.md b/packages/hotkeys/skills/app-hotkeys/SKILL.md index 31f04f74f..f1c9ff0b3 100644 --- a/packages/hotkeys/skills/app-hotkeys/SKILL.md +++ b/packages/hotkeys/skills/app-hotkeys/SKILL.md @@ -58,6 +58,7 @@ Augment `Register` in the adapter module you import from, such as `declare modul - **Conflict checks need the recorder's `context`.** Two hotkeys can be written differently and fire for the same key press, such as `Shift+[Slash]` recorded by code and a declared `?`. `findConflicts(id, hotkey, context)` and `setCustomHotkey(id, hotkey, context)` check with the key press when they get the `context` that `validate` and `onRecord` receive. Without it, they only compare how the hotkeys are written. - **Rename a shared hotkey per page with call-site `meta`.** One declared `list.focus-search` can register as `{ meta: { name: 'Search tables' } }` on one page and `'Search roles'` on another. It merges over the declared meta for that registration, so registration lists and palettes show the page's name, while the settings row keeps the declared one. Don't declare a copy per page. - **A command palette runs registrations, not declarations.** App hotkeys hold no callback. List the views from the adapter's registrations list and call `view.trigger()` on the one picked; it runs the callback the mounted component registered. It checks only `enabled`, so it still runs while the palette's exclusive scope suspends the hotkey. +- **Split a large catalog with nested `defineAppHotkeys` calls, not `satisfies`.** Each feature file calls `defineAppHotkeys`, and one module spreads the results into the object it registers and provides. Each call type-checks its own entries, and spread-in entries keep their id and default kind. `as const satisfies Record` skips the kind-specific option check until the final call. A later spread replaces an entry with the same id silently, so keep ids unique across files. - **A cheat sheet dialog usually gets an exclusive scope.** Register the hotkey that opened it inside the dialog too, so the same keys close it. When building the "press a new shortcut" control, read [recording](references/recording.md). diff --git a/packages/hotkeys/src/app-hotkeys.ts b/packages/hotkeys/src/app-hotkeys.ts index 72670092b..649531da6 100644 --- a/packages/hotkeys/src/app-hotkeys.ts +++ b/packages/hotkeys/src/app-hotkeys.ts @@ -118,14 +118,23 @@ type StrictOptions = TOptions extends object * takes seconds and gigabytes for a few dozen entries. */ type ValidatedAppHotkeyInputs = { - [K in keyof T]: T[K] extends { hotkey: infer THotkey } - ? { - options?: StrictOptions< - T[K] extends { options: infer TOptions } ? TOptions : {}, - AllowedOptions - > - } - : never + [K in keyof T]: T[K] extends AppHotkey + ? [AppHotkeyOptions] extends [NonNullable] + ? unknown + : { + options?: StrictOptions< + T[K]['options'], + AllowedOptions> + > + } + : T[K] extends { hotkey: infer THotkey } + ? { + options?: StrictOptions< + T[K] extends { options: infer TOptions } ? TOptions : {}, + AllowedOptions + > + } + : never } /** The kind of a declared default hotkey; a one-step sequence is a chord. */ @@ -137,14 +146,28 @@ export type AppHotkeyDefaultKind = THotkey extends null ? HotkeySequence : HotkeyChord -/** The app hotkeys returned by `defineAppHotkeys` for a declaration object. */ +/** + * The app hotkeys returned by `defineAppHotkeys` for a declaration object. An + * entry that is already an app hotkey, spread in from another + * `defineAppHotkeys` call, keeps the kind of its default. Spread the results + * of `defineAppHotkeys`, not app hotkeys read from a store: their `hotkey` is + * the user's custom hotkey, which would become the new default. + */ export type DefinedAppHotkeys> = { - readonly [K in keyof T & string]: AppHotkey< - K, - AppHotkeyDefaultKind - > + readonly [K in keyof T & string]: AppHotkey> } +/** + * The default kind of one declaration. A spread-in app hotkey keeps its own + * kind unless the declaration replaces its `hotkey`. + */ +type DeclaredDefaultKind = + TInput extends AppHotkey + ? [Hotkey | null] extends [TInput['hotkey']] + ? TDefault + : AppHotkeyDefaultKind + : AppHotkeyDefaultKind + export type { Register } from './register' /** The app hotkeys type from `Register`, or a generic map when none is registered. */ diff --git a/packages/hotkeys/tests/app-hotkeys-type-performance.test.ts b/packages/hotkeys/tests/app-hotkeys-type-performance.test.ts index 383514d29..9516096f4 100644 --- a/packages/hotkeys/tests/app-hotkeys-type-performance.test.ts +++ b/packages/hotkeys/tests/app-hotkeys-type-performance.test.ts @@ -320,3 +320,19 @@ describe('defineAppHotkeys with many entries', () => { >() }) }) + +describe('defineAppHotkeys with many spread-in entries', () => { + it('keeps each entry typed by id and kind', () => { + const combined = defineAppHotkeys({ + ...appHotkeys, + 'help.open': { hotkey: 'Shift+?' }, + }) + expect(Object.keys(combined)).toHaveLength(101) + expectTypeOf(combined['chord.49']).toEqualTypeOf< + AppHotkey<'chord.49', HotkeyChord> + >() + expectTypeOf(combined['sequence.49']).toEqualTypeOf< + AppHotkey<'sequence.49', HotkeySequence> + >() + }) +}) diff --git a/packages/hotkeys/tests/app-hotkeys.test.ts b/packages/hotkeys/tests/app-hotkeys.test.ts index 8ca2cafdc..609ce0f66 100644 --- a/packages/hotkeys/tests/app-hotkeys.test.ts +++ b/packages/hotkeys/tests/app-hotkeys.test.ts @@ -104,6 +104,79 @@ describe('defineAppHotkeys', () => { }) }) + it('accepts the app hotkeys of another call, keeping their types', () => { + const profileHotkeys = defineAppHotkeys({ + 'profile.edit': { hotkey: 'Mod+E', meta: { name: 'Edit profile' } }, + }) + const combined = defineAppHotkeys({ + ...appHotkeys, + ...profileHotkeys, + 'help.open': { hotkey: 'Shift+?' }, + renamed: appHotkeys['nav.home'], + }) + + expect(combined['nav.home']).toMatchObject({ + '~appHotkey': true, + id: 'nav.home', + hotkey: ['G', 'H'], + defaultHotkey: ['G', 'H'], + meta: { name: 'Go home' }, + options: { timeout: 500 }, + }) + expect(combined['profile.edit'].meta).toEqual({ name: 'Edit profile' }) + expect(combined.renamed.id).toBe('renamed') + + expectTypeOf(combined['doc.save']).toEqualTypeOf< + AppHotkey<'doc.save', HotkeyChord> + >() + expectTypeOf(combined['nav.home']).toEqualTypeOf< + AppHotkey<'nav.home', HotkeySequence> + >() + expectTypeOf(combined['palette.open']).toEqualTypeOf< + AppHotkey<'palette.open', null> + >() + expectTypeOf(combined['profile.edit']).toEqualTypeOf< + AppHotkey<'profile.edit', HotkeyChord> + >() + expectTypeOf(combined['help.open']).toEqualTypeOf< + AppHotkey<'help.open', HotkeyChord> + >() + expectTypeOf(combined.renamed).toEqualTypeOf< + AppHotkey<'renamed', HotkeySequence> + >() + defineAppHotkeys({ + ...appHotkeys, + // @ts-expect-error timeout applies only to sequences + a: { hotkey: 'Mod+S', options: { timeout: 500 } }, + }) + }) + + it('checks a spread-in app hotkey whose hotkey or options change', () => { + const changed = defineAppHotkeys({ + sequence: { ...appHotkeys['doc.save'], hotkey: ['G', 'S'] }, + chord: { ...appHotkeys['doc.save'], options: { requireReset: false } }, + unbound: { ...appHotkeys['nav.home'], hotkey: null }, + }) + expectTypeOf(changed.unbound).toEqualTypeOf>() + expect(changed.sequence.defaultHotkey).toEqual(['G', 'S']) + expectTypeOf(changed.sequence).toEqualTypeOf< + AppHotkey<'sequence', HotkeySequence> + >() + expectTypeOf(changed.chord).toEqualTypeOf>() + defineAppHotkeys({ + // @ts-expect-error timeout applies only to sequences + a: { ...appHotkeys['doc.save'], options: { timeout: 500 } }, + }) + defineAppHotkeys({ + b: { + ...appHotkeys['doc.save'], + hotkey: ['G', 'H'], + // @ts-expect-error requireReset applies only to chords + options: { requireReset: true }, + }, + }) + }) + it('isAppHotkey distinguishes app hotkeys from hotkeys', () => { expect(isAppHotkey(appHotkeys['doc.save'])).toBe(true) expect(isAppHotkey('Mod+S')).toBe(false)