Repository navigation
perf(core): the keyboard notifications' duration has its own export #8484
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
vjeux
wants to merge
6
commits into
meta:main
Choose a base branch
from
vjeux:uikit/f1-keyboard-notification
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+133
−42
Draft
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
3f83540
perf(core): the keyboard notifications' duration has its own export
vjeux 6c61c92
Merge main (2af4d305: #8257 squashed, through #8229) into the keyboar…
vjeux 216d05c
Merge main (3c1e876b: #8055's animator, with the AST-105 and AST-103 …
vjeux 9865edf
fix(core): the timing table composes its own-export groups from plain…
vjeux 1adf75c
test(core): the keyboard bundle test catches the fade however esbuild…
vjeux 218ca70
Merge main (0cbddeac02: #8056 and #8521 merged) into the keyboard not…
vjeux File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| '@astryxdesign/core': patch | ||
| --- | ||
|
|
||
| [chore] Internal: the keyboard notifications' duration has its own export in the UIKit timing table, so code that reads only it bundles no other timing value. Not exported from the package entry point. | ||
|
|
||
| @vjeux |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
packages/core/src/motion/uikit/keyboardNotification.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| // Copyright (c) Meta Platforms, Inc. and affiliates. | ||
|
|
||
| /** | ||
| * @file keyboardNotification.test.ts | ||
| * @input timing.ts, bundled on its own with esbuild | ||
| * @output Proof that the keyboard notifications' duration is its own export: | ||
| * the timing table composes it, and a bundle that reads only it carries no | ||
| * other row of the table | ||
| * @position Guards architecture:component-style-authoring INV6 for the | ||
| * keyboard layout guide's one read of the timing table | ||
| */ | ||
|
|
||
| import {execFileSync} from 'node:child_process'; | ||
| import {describe, expect, it} from 'vitest'; | ||
| import {keyboardNotification, timing} from './timing'; | ||
|
|
||
| describe('keyboardNotification', () => { | ||
| it('is the timing table\u2019s keyboard duration', () => { | ||
| expect(timing.keyboardNotificationMs).toBe(keyboardNotification.durationMs); | ||
| }); | ||
|
|
||
| it('a bundle that reads only the keyboard\u2019s duration drops the rest of the table', () => { | ||
| // esbuild runs in its own Node process: jsdom's TextEncoder fails its | ||
| // startup check. | ||
| const code = execFileSync( | ||
| process.execPath, | ||
| [ | ||
| '--input-type=module', | ||
| '-e', | ||
| [ | ||
| "import {build} from 'esbuild';", | ||
| 'const result = await build({', | ||
| " stdin: {contents: \"import {keyboardNotification} from './timing'; export const ms = keyboardNotification.durationMs;\", resolveDir: process.cwd(), loader: 'ts'},", | ||
| " bundle: true, write: false, format: 'esm', minify: true, logLevel: 'silent',", | ||
| '});', | ||
| 'process.stdout.write(result.outputFiles[0].text);', | ||
| ].join('\n'), | ||
| ], | ||
| {cwd: __dirname, encoding: 'utf8'}, | ||
| ); | ||
| expect(code).toContain('383.3'); | ||
| // No other row: not the navigation bar's duration, not the press clocks, | ||
| // not the Reduce Motion fade that shares the table's composition. | ||
| expect(code).not.toContain('navigationBarHideShowMs'); | ||
| expect(code).not.toContain('buttonReleaseMs'); | ||
| // The fade's length and curve, however esbuild prints them: inline in its | ||
| // group or through a shared constant. | ||
| expect(code).not.toMatch(/\b200\b/); | ||
| expect(code).not.toContain('.42,0,.58,1'); | ||
| }); | ||
| }); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At this head this build is
var e={durationMs:383.3},{durationMs:s}=e,o={durationMs:500,curve:[.42,0,.58,1]},…: it carries the Reduce Motion fade row through the binding attiming.ts:144-145, which these two assertions don't name, so the test passes while the bundle still carries another row. Asserting, for example,expect(code).not.toContain('durationMs:500')makes it fail today.