-
-
Notifications
You must be signed in to change notification settings - Fork 112
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
refactor(web): unifies touch-layout typing, updating Web to the common/web/types version 🐵 #9664
refactor(web): unifies touch-layout typing, updating Web to the common/web/types version 🐵 #9664
Conversation
User Test ResultsTest specification and instructions User tests are not required |
// Enables DOM types, but just for this one module. | ||
///<reference lib="dom" /> | ||
|
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.
/common/web/keyboard-processor/build.sh build
will run into a build error within this file if this line is not present. (The file references the URL
type, which is the cause.) It apparently doesn't matter that keyboard-processor
doesn't even touch or import anything from the file; it's just a mutual export alongside the ones we do want, and that's enough to cause the issue during TS compilation.
keyboard-processor
compiles without access to the DOM libraries except where made explicit.
This is the only change made in this PR to common/web/types
.
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.
Hmm, @srl295 I think we should pull URL
usage out of this module and have a helper instead. It's apparently used in 4 places altogether in unit tests and kmc:
- kmc buildTestData/index.ts
- kmc BuildLdmlKeyboard.ts
- unit test: reader-callback-test.ts
- unit test helpers/index.ts
Propose the following:
static get defaultImportsURL() {
return ['../import/', import.meta.url];
}
And in usage:
readerOptions: {
importsPath: fileURLToPath(new URL(...LDMLKeyboardXMLSourceFileReader.defaultImportsURL))
}
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.
I presume that'd be a separate issue, not something I ought do here?
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.
Yeah it could be a separate PR. Be good to address it before this change lands in master though, just for cleanliness.
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.
Up as #9788.
…ness' into refactor/web/common-layout-typing
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.
Looks pretty good, just a couple of suggestions really, and an alternate way of solving the /// <reference>
in common/web/types which I think is probably cleaner
// Enables DOM types, but just for this one module. | ||
///<reference lib="dom" /> | ||
|
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.
Hmm, @srl295 I think we should pull URL
usage out of this module and have a helper instead. It's apparently used in 4 places altogether in unit tests and kmc:
- kmc buildTestData/index.ts
- kmc BuildLdmlKeyboard.ts
- unit test: reader-callback-test.ts
- unit test helpers/index.ts
Propose the following:
static get defaultImportsURL() {
return ['../import/', import.meta.url];
}
And in usage:
readerOptions: {
importsPath: fileURLToPath(new URL(...LDMLKeyboardXMLSourceFileReader.defaultImportsURL))
}
TODO: |
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.
LGTM, noting that the validation in oskSubKey ll.27-33 is re-corrected in #9804.
Co-authored-by: Marc Durdin <marc@durdin.net>
In order to integrate the Web OSK for our new, upcoming gesture types... Web needs the corresponding type information. Rather than continue to keep the touch-layout typing WET, I've put in the work necessary to have Web use the definitions from
common/web/types
- meaning KMW will now use the same type specifications as Developer's Web-keyboard compiler. (With minor extensions for post-processing.)There were a few rough edges to resolve in doing so, but it also provided a wonderful excuse to take care of a few longstanding nits we've had. In particular, Web finally gets to say farewell to
string
formpad
,width
, andsp
typing - though it keeps the legacy-friendlysanitize
methods that enforce the correct typing viaNumber.parse
.The main benefit: Web now has access to flick and multitap layout-spec data, which I'll need for upcoming work.
This was motivated by follow-up work to #9657, but since that starts ripping apart KMW's OSK to the point that certain integration tests will be failing, it's probably clearer for the review process (and for management checks) to 'base' it just before that point.
@keymanapp-test-bot skip