-
Notifications
You must be signed in to change notification settings - Fork 13
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
Preferences API #106
Draft
JayPanoz
wants to merge
103
commits into
develop
Choose a base branch
from
PreferencesAPI
base: develop
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.
Draft
Preferences API #106
+2,453
−134
Conversation
This file contains 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
These anchor elements are implementation-specific and shouldn’t be forced upon all consumers of the ts-toolkit. An Injectable API should be provided to do this.
So that they stay consistent across the Navigator package
Rewritten as a class whose properties you can update for user settings
Updates from Playground: - user line length is used instead of optimal if defined - colCount more than 2 - colCount null instead of auto - line length getters in px
This is covered by resizeObserver in EpubNavigator
Otherwise the initial value is kept
- cachedScrollWidth may go stale on go_next due to appending virtual columns, resulting in Navigator skipping the last portion of the scrollableDocument. So we ensure it can’t be. - ResizeObserver may end up in an infinite loop with the previous code so it’s updated to prevent that - need to solve init (CSS props in FrameBlob) so that snapping can happen with virtual columns on load
This was referenced Mar 3, 2025
When going backwards and ColumnSnapper had to mount again, snapOffset at the end was off with virtual columns cos wnd.scrollX was not taking the virtual col into account. This should hopefully resolve this issue.
Have to filter transforms on documentElement in MutationObserver so that it won’t stop on last screen
Otherwise page number will always be null
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This branch is meant to implementing the Preferences API in the ts-toolkit Navigator, bringing it on par with – and taking inspiration from – Readium’s Mobile toolkits.
This will make it a lot easier to implement user settings in apps and is using ReadiumCSS version 2.
It will be merged as a new major version since it will consequently come with breaking changes.
In ReadiumCSS v1,
auto
pagination was built-in, switching from 1 to 2 columns depending on the window/screen width. This is no longer the case. However, we plan to replace this feature with preferences that can be set:ch
(number of characters)ch
, can beundefined
, ornull
.The logic is the following:
2
. It can be as many as apps see fitauto
mode1
, dropping a column in the process if it can’t fitundefined
, then optimal line-length is the minimal onenull
then this lower bound is disabled entirely and apps can enforce the number of columns they wantThis is currently implemented in Readium/Playground and will be ported back into the ts-toolkit.