-
Notifications
You must be signed in to change notification settings - Fork 27
Milestone2k #347
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
Open
timea-solid
wants to merge
29
commits into
main
Choose a base branch
from
milestone2k
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.
Open
Milestone2k #347
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
88d3011
added icon base size
SharonStrats ccd1e51
small icon
SharonStrats ba3436f
background row colors
SharonStrats b0788fb
xs icon size
SharonStrats da22f87
xl icon size
SharonStrats 19eef55
xxs icon size
SharonStrats d01ee7f
updated css var
timea-solid 270b14f
Merge pull request #343 from SolidOS/refactor/styles-separateCSS
timea-solid 85f0bd5
Initial plan
Copilot d6d4911
Add missing dark theme CSS custom properties to dark.css
Copilot 2032e76
Merge pull request #344 from SolidOS/copilot/sub-pr-342
timea-solid 4c43118
Merge branch 'main' into profileEditA11y
timea-solid d400aa8
Merge branch 'profileEditA11y' of https://github.com/SolidOS/mashlib …
timea-solid bf7377e
removed not in use dump function
timea-solid e00b513
added preparations for mobile
timea-solid 97728df
cnosolidation of mobile options
timea-solid 323e81c
SolidOS app title
timea-solid 1043c5c
removed old table structure form databrowser.html
timea-solid 0e4918f
removed old table structure form databrowser.html
timea-solid 3a9b087
SolidOS app title
timea-solid 476a36c
cnosolidation of mobile options
timea-solid d294201
some merge issues
timea-solid 4723132
merge main
timea-solid 7d61e49
merge main
timea-solid 5fd8127
Update README.md
timea-solid ec908b9
Update src/styles/mash.css
timea-solid c5ed774
Update src/styles/mash.css
timea-solid 641de88
Update src/styles/mash.css
timea-solid 5a6f721
Update src/index.ts
timea-solid 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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
| /* generated by AI - see readme for details*/ | ||
| import type { LayoutMode, LayoutPreference } from 'pane-registry' | ||
|
Check failure on line 2 in src/layout.ts
|
||
|
|
||
| const LAYOUT_STORAGE_KEY = 'mashlib-layout' | ||
| const MOBILE_BREAKPOINT_PX = 768 | ||
|
|
||
| const getStoredLayoutPreference = (): LayoutPreference => { | ||
| const storedLayout = localStorage.getItem(LAYOUT_STORAGE_KEY) | ||
|
|
||
| if (storedLayout === 'mobile' || storedLayout === 'desktop' || storedLayout === 'auto') { | ||
| return storedLayout | ||
| } | ||
|
|
||
| return 'auto' | ||
| } | ||
|
|
||
| const resolveAutomaticLayout = (): LayoutMode => { | ||
| return window.innerWidth <= MOBILE_BREAKPOINT_PX ? 'mobile' : 'desktop' | ||
| } | ||
|
|
||
| const applyLayoutAttributes = (layout: LayoutMode, preference: LayoutPreference) => { | ||
| const root = document.documentElement | ||
| const inputMode = window.matchMedia('(pointer: coarse)').matches ? 'touch' : 'pointer' | ||
|
|
||
| root.setAttribute('data-layout', layout) | ||
| root.setAttribute('data-layout-preference', preference) | ||
| root.setAttribute('data-input-mode', inputMode) | ||
| root.style.setProperty('--app-height', `${window.innerHeight}px`) | ||
|
|
||
| window.dispatchEvent(new CustomEvent('mashlib:layoutchange', { | ||
| detail: { | ||
| inputMode, | ||
| layout, | ||
| preference, | ||
| viewport: { | ||
| height: window.innerHeight, | ||
| width: window.innerWidth | ||
| } | ||
| } | ||
| })) | ||
| } | ||
|
|
||
| const updateLayout = (preference: LayoutPreference = getStoredLayoutPreference()): LayoutMode => { | ||
| const layout = preference === 'auto' ? resolveAutomaticLayout() : preference | ||
| applyLayoutAttributes(layout, preference) | ||
| return layout | ||
| } | ||
|
|
||
| const setLayoutPreference = (preference: LayoutPreference): LayoutMode => { | ||
| if (preference === 'auto') { | ||
| localStorage.removeItem(LAYOUT_STORAGE_KEY) | ||
| } else { | ||
| localStorage.setItem(LAYOUT_STORAGE_KEY, preference) | ||
| } | ||
|
|
||
| return updateLayout(preference) | ||
| } | ||
|
|
||
| const getLayoutPreference = (): LayoutPreference => { | ||
| return getStoredLayoutPreference() | ||
| } | ||
|
|
||
| const getLayoutMode = (): LayoutMode => { | ||
| return (document.documentElement.getAttribute('data-layout') as LayoutMode) || resolveAutomaticLayout() | ||
| } | ||
|
|
||
| const initializeLayout = () => { | ||
| let resizeFrame = 0 | ||
| const syncLayout = () => { | ||
| updateLayout() | ||
| } | ||
|
|
||
| const onResize = () => { | ||
| if (resizeFrame) { | ||
| window.cancelAnimationFrame(resizeFrame) | ||
| } | ||
|
|
||
| resizeFrame = window.requestAnimationFrame(() => { | ||
| resizeFrame = 0 | ||
| syncLayout() | ||
| }) | ||
| } | ||
|
|
||
| syncLayout() | ||
| window.addEventListener('resize', onResize) | ||
|
|
||
| window.matchMedia('(pointer: coarse)').addEventListener('change', syncLayout) | ||
| window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT_PX}px)`).addEventListener('change', syncLayout) | ||
| } | ||
|
|
||
| const getInputMode = (): 'touch' | 'pointer' => { | ||
| return window.matchMedia('(pointer: coarse)').matches ? 'touch' : 'pointer' | ||
| } | ||
|
|
||
| const getViewport = () => ({ | ||
| width: window.innerWidth, | ||
| height: window.innerHeight | ||
| }) | ||
|
|
||
| export const layout = { | ||
| get: getLayoutMode, | ||
| getInputMode, | ||
| getPreference: getLayoutPreference, | ||
| getViewport, | ||
| init: initializeLayout, | ||
| set: setLayoutPreference | ||
| } | ||
Oops, something went wrong.
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.
layout.init()dispatches themashlib:layoutchangeevent immediately (during module init), butsyncEnvironmentToContext()depends on an outliner created later bypanes.initMainPage. This means the initial page load will reliably emitconsole.warn('outliner not ready yet'). Consider delaying registration of the layoutchange listener until afterinitMainPage(or makingsyncEnvironmentToContextsilent until the first successful sync) to avoid noisy logs.