Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
chore(mobile): gather the iOS styling in one stylesheet
Elian Dorancfe1e3fff285
diff --git a/apps/client/src/stylesheets/theme-next/base.css b/apps/client/src/stylesheets/theme-next/base.cssindex 7954f89060..b42a6bb611 100644--- a/apps/client/src/stylesheets/theme-next/base.css+++ b/apps/client/src/stylesheets/theme-next/base.css@@ -6,6 +6,7 @@@import url(./notes/text.css);@import url(./notes/canvas.css);@import url(./menus.css);+@import url(./ios.css);@font-face {font-family: "Inter";diff --git a/apps/client/src/stylesheets/theme-next/ios.css b/apps/client/src/stylesheets/theme-next/ios.cssnew file mode 100644index 0000000000..fca975a577--- /dev/null+++ b/apps/client/src/stylesheets/theme-next/ios.css@@ -0,0 +1,135 @@+/*+ * iOS: the glass surfaces of iOS 26, drawn with the `--glass-*` tokens. The components define what+ * these variables control and their default values; this file sets them for iOS, and holds the+ * rules that only iOS has.+ */++body.mobile.ios {+ --dropdown-backdrop-filter: blur(16px) saturate(1.5) brightness(1.15);+ --mobile-sheet-margin: 8px;+ --mobile-sheet-radius: 28px;++ /* The formatting toolbar: a capsule, with its buttons spaced out. */+ --mobile-toolbar-border: 0px;+ --mobile-toolbar-gap: 10px;+ --mobile-toolbar-radius: calc(var(--mobile-toolbar-height) / 2);+ --mobile-toolbar-pill-radius: 999px;+ --mobile-toolbar-pill-press-scale: 1.12;+ --mobile-toolbar-item-gap: 14px;+ --mobile-toolbar-items-inset: 8px;++ /* A menu in the keyboard's place stands a gap below the toolbar, as the keyboard does. */+ --keyboard-panel-rise: 0px;+ --keyboard-panel-margin: var(--mobile-sheet-margin);++ .classic-toolbar-island {+ background: var(--glass-background);+ backdrop-filter: var(--dropdown-backdrop-filter);+ box-shadow: var(--glass-shadow);+ }++ .dropdown-menu {+ --mobile-menu-group-radius: 12px;+ }+}++@media (max-width: 991px) {+ body.mobile.ios {+ --mobile-bottom-offset: max(+ 12px,+ calc(var(--safe-area-inset-bottom, env(safe-area-inset-bottom)) - 8px)+ );+ --mobile-bottom-bar-height: calc(var(--launcher-pane-horiz-size) + var(--mobile-bottom-offset));+ --mobile-backdrop-color: transparent;+ /* Must equal the height of `.title-row` in style.css. */+ --mobile-title-row-height: 50px;++ /* Sheets, including the toolbar's menu in the keyboard's place. */+ :is(+ .tn-dropdown-portal:is(.global-menu, .right-dropdown-widget) > .dropdown-menu,+ .dropdown-menu.mobile-bottom-menu+ ).show {+ --menu-background-color: var(--glass-background);+ border: 0;+ border-radius: var(--mobile-sheet-radius);+ box-shadow: var(--glass-shadow);+ }++ :is(+ .tn-dropdown-portal:is(.global-menu, .right-dropdown-widget) > .dropdown-menu,+ .dropdown-menu.mobile-bottom-menu:not(.keyboard-panel)+ ).show {+ margin: 0 var(--mobile-sheet-margin) var(--mobile-sheet-margin);+ max-height: calc(var(--tn-modal-max-height) - var(--dropdown-bottom) - var(--mobile-sheet-margin));+ }++ :is(#context-menu-container, .dropdown-menu).mobile-bottom-menu.show {+ padding-bottom: var(--menu-padding-size) !important;+ }++ /* The title row and the launcher bar float over the note, which scrolls beneath them. */+ #mobile-bottom-bar {+ position: relative;+ z-index: 999;+ height: var(--mobile-bottom-bar-height);+ margin-top: calc(-1 * var(--mobile-bottom-bar-height));+ padding-inline: 16px;+ border-top: 0;+ background: transparent;+ pointer-events: none;+ }++ #mobile-bottom-bar > #launcher-pane {+ pointer-events: auto;+ border: 0;+ border-radius: calc(var(--launcher-pane-horiz-size) / 2);+ background: var(--glass-background) !important;+ backdrop-filter: var(--dropdown-backdrop-filter);+ box-shadow: var(--glass-shadow);++ .launcher-button {+ border-radius: 50%;+ }+ }++ &:not(.keyboard-panel-open) #root-widget:not(.virtual-keyboard-opened) .note-split > .scrolling-container {+ padding-bottom: var(--mobile-bottom-bar-height);+ scroll-padding-bottom: var(--mobile-bottom-bar-height);+ }++ .note-split:not(.options) > .title-row {+ position: relative;+ z-index: 999;+ isolation: isolate;+ margin-bottom: calc(-1 * var(--mobile-title-row-height));+ padding-inline: 8px;+ border-bottom: 0;++ &::before {+ content: "";+ position: absolute;+ inset: 0 0 -16px;+ z-index: -1;+ background: linear-gradient(var(--main-background-color) 55%, transparent);+ pointer-events: none;+ }++ .icon-action:not(.note-icon) {+ border-radius: 50%;+ background: var(--glass-background);+ backdrop-filter: var(--dropdown-backdrop-filter);+ box-shadow: var(--glass-shadow);+ transition: scale 250ms cubic-bezier(0.3, 1.6, 0.5, 1);++ &:active {+ scale: 0.92;+ }+ }+ }++ .note-split:not(.options) > .title-row + .scrolling-container {+ padding-top: var(--mobile-title-row-height);+ scroll-padding-top: var(--mobile-title-row-height);+ }+ }+}diff --git a/apps/client/src/stylesheets/theme-next/menus.css b/apps/client/src/stylesheets/theme-next/menus.cssindex 03478423fd..610c7aa34a 100644--- a/apps/client/src/stylesheets/theme-next/menus.css+++ b/apps/client/src/stylesheets/theme-next/menus.css@@ -296,27 +296,6 @@ body.mobile .dropdown-menu.note-autocomplete-menu {border-radius: var(--dropdown-border-radius) var(--dropdown-border-radius) 0 0;}- /* On iOS, a sheet floats clear of the screen's edges as a pane of glass. */- body.mobile.ios :is(- .tn-dropdown-portal:is(.global-menu, .right-dropdown-widget) > .dropdown-menu,- .dropdown-menu.mobile-bottom-menu:not(.keyboard-panel)- ).show {- --mobile-sheet-margin: 8px;- --menu-background-color: var(--glass-background);- margin: 0 var(--mobile-sheet-margin) var(--mobile-sheet-margin);- max-height: calc(var(--tn-modal-max-height) - var(--dropdown-bottom) - var(--mobile-sheet-margin));- border: 0;- border-radius: 28px;- box-shadow: var(--glass-shadow);- }-- body.mobile.ios :is(#context-menu-container, .dropdown-menu).mobile-bottom-menu:not(.keyboard-panel).show {- padding-bottom: var(--menu-padding-size) !important;- }-}--body.mobile.ios .dropdown-menu {- --mobile-menu-group-radius: 12px;}/* Beside its toggle in a tablet's wider mobile layout, wide enough for its rows to be tapped. */diff --git a/apps/client/src/stylesheets/theme-next/shell.css b/apps/client/src/stylesheets/theme-next/shell.cssindex ccc749ac79..66e660fd97 100644--- a/apps/client/src/stylesheets/theme-next/shell.css+++ b/apps/client/src/stylesheets/theme-next/shell.css@@ -12,10 +12,6 @@--dropdown-border-radius: 10px;}-body.mobile.ios {- --dropdown-backdrop-filter: blur(16px) saturate(1.5) brightness(1.15);-}-#root-widget {background-color: var(--root-background);}@@ -245,82 +241,6 @@ body.layout-horizontal > .horizontal {body.mobile #launcher-pane {background: transparent !important;}-- /* On iOS, the title row and the launcher bar float over the note, which scrolls beneath them. */- body.mobile.ios {- --mobile-bottom-offset: max(- 12px,- calc(var(--safe-area-inset-bottom, env(safe-area-inset-bottom)) - 8px)- );- --mobile-bottom-bar-height: calc(var(--launcher-pane-horiz-size) + var(--mobile-bottom-offset));- --mobile-backdrop-color: transparent;- /* Must equal the height of `.title-row` in style.css. */- --mobile-title-row-height: 50px;-- #mobile-bottom-bar {- position: relative;- z-index: 999;- height: var(--mobile-bottom-bar-height);- margin-top: calc(-1 * var(--mobile-bottom-bar-height));- padding-inline: 16px;- border-top: 0;- background: transparent;- pointer-events: none;- }-- #mobile-bottom-bar > #launcher-pane {- pointer-events: auto;- border: 0;- border-radius: calc(var(--launcher-pane-horiz-size) / 2);- background: var(--glass-background) !important;- backdrop-filter: var(--dropdown-backdrop-filter);- box-shadow: var(--glass-shadow);-- .launcher-button {- border-radius: 50%;- }- }-- &:not(.keyboard-panel-open) #root-widget:not(.virtual-keyboard-opened) .note-split > .scrolling-container {- padding-bottom: var(--mobile-bottom-bar-height);- scroll-padding-bottom: var(--mobile-bottom-bar-height);- }-- .note-split:not(.options) > .title-row {- position: relative;- z-index: 999;- isolation: isolate;- margin-bottom: calc(-1 * var(--mobile-title-row-height));- padding-inline: 8px;- border-bottom: 0;-- &::before {- content: "";- position: absolute;- inset: 0 0 -16px;- z-index: -1;- background: linear-gradient(var(--main-background-color) 55%, transparent);- pointer-events: none;- }-- .icon-action:not(.note-icon) {- border-radius: 50%;- background: var(--glass-background);- backdrop-filter: var(--dropdown-backdrop-filter);- box-shadow: var(--glass-shadow);- transition: scale 250ms cubic-bezier(0.3, 1.6, 0.5, 1);-- &:active {- scale: 0.92;- }- }- }-- .note-split:not(.options) > .title-row + .scrolling-container {- padding-top: var(--mobile-title-row-height);- scroll-padding-top: var(--mobile-title-row-height);- }- }}@media (min-width: 992px) {diff --git a/apps/client/src/widgets/type_widgets/text/mobile_editor_toolbar.css b/apps/client/src/widgets/type_widgets/text/mobile_editor_toolbar.cssindex a1dce22b08..fc7fcbbb20 100644--- a/apps/client/src/widgets/type_widgets/text/mobile_editor_toolbar.css+++ b/apps/client/src/widgets/type_widgets/text/mobile_editor_toolbar.css@@ -7,6 +7,12 @@ body.mobile {--mobile-toolbar-gap: 6px;--mobile-toolbar-radius: 6px;--mobile-toolbar-pill-radius: 6px;+ --mobile-toolbar-pill-press-scale: 1;+ --mobile-toolbar-item-gap: 0px;+ --mobile-toolbar-items-inset: 0px;+ /* How far a menu in the keyboard's place rises over the gap to meet the toolbar. */+ --keyboard-panel-rise: var(--mobile-toolbar-gap);+ --keyboard-panel-margin: 0px;--mobile-toolbar-clearance: calc(var(--mobile-toolbar-height) + 2 * var(--mobile-toolbar-gap));.classic-toolbar-outer-container {@@ -58,38 +64,6 @@ body.mobile {visibility: hidden;}- &.ios {- --mobile-toolbar-border: 0px;- --mobile-toolbar-gap: 10px;- --mobile-toolbar-radius: calc(var(--mobile-toolbar-height) / 2);- --mobile-toolbar-pill-radius: 999px;-- .classic-toolbar-island {- background: var(--glass-background, var(--main-background-color));- backdrop-filter: var(--dropdown-backdrop-filter);- box-shadow: var(--glass-shadow, inset 0 0 0 1px var(--main-border-color));- }-- .classic-toolbar-widget .ck.ck-toolbar .ck-toolbar__items {- gap: 14px;- padding-inline-start: 8px;- }-- .classic-toolbar-widget .ck.ck-toolbar .ck-toolbar__items > :is(- .ck-button,- .ck-dropdown > .ck-button,- .ck-dropdown > .ck-splitbutton > .ck-button- ) {- &::before {- transition: scale 250ms cubic-bezier(0.3, 1.6, 0.5, 1);- }-- &:not(.ck-disabled):active::before {- scale: 1.12;- }- }- }-.classic-toolbar-widget {position: absolute;bottom: 0;@@ -117,10 +91,18 @@ body.mobile {/* A menu of the toolbar in the place of the keyboard (see `useKeyboardPanel`). */&.keyboard-panel-open {+ /* `useKeyboardPanel()` measures a menu of its own height as if it rose by the whole gap. */+ --keyboard-panel-place-offset: calc(+ var(--mobile-toolbar-gap) - var(--keyboard-panel-rise) + var(--keyboard-panel-margin)+ );--keyboard-panel-lift: max(0px,calc(- var(--tn-keyboard-place-height, var(--tn-keyboard-height, 0px))+ var(+ --tn-keyboard-place-height,+ calc(var(--tn-keyboard-height, 0px) - var(--keyboard-panel-place-offset))+ )+ + var(--keyboard-panel-place-offset)- var(--tn-layout-shrink, 0px)));@@ -167,41 +149,17 @@ body.mobile {.dropdown-menu.mobile-bottom-menu.keyboard-panel.show {--dropdown-bottom: calc(-1 * var(--tn-layout-shrink, 0px));- height: calc(var(--tn-keyboard-height) + var(--mobile-toolbar-gap));- max-height: calc(var(--tn-keyboard-height) + var(--mobile-toolbar-gap));+ height: calc(var(--tn-keyboard-height) + var(--keyboard-panel-rise) - var(--keyboard-panel-margin));+ max-height: calc(var(--tn-keyboard-height) + var(--keyboard-panel-rise) - var(--keyboard-panel-margin));+ margin: 0 var(--keyboard-panel-margin) var(--keyboard-panel-margin);}.dropdown-menu.mobile-bottom-menu.keyboard-panel.keyboard-panel-own-height.show {height: auto;- max-height: min(50vh, calc(var(--tn-keyboard-height, 50vh) + var(--mobile-toolbar-gap)));- }-- /* On iOS, the menu is an island of its own, a gap below the toolbar as the keyboard is. */- &.ios {- --keyboard-panel-margin: 8px;-- /* `useKeyboardPanel()` measures the place as if the menu rose by the gap to the toolbar. */- &.keyboard-panel-open:has(.dropdown-menu.keyboard-panel-own-height) {- --keyboard-panel-lift: calc(- var(--tn-keyboard-place-height, 0px) + var(--mobile-toolbar-gap) + var(--keyboard-panel-margin)- );- }-- .dropdown-menu.mobile-bottom-menu.keyboard-panel.show {- --menu-background-color: var(--glass-background, var(--menu-background-color-no-backdrop));- height: calc(var(--tn-keyboard-height) - var(--keyboard-panel-margin));- max-height: calc(var(--tn-keyboard-height) - var(--keyboard-panel-margin));- margin: 0 var(--keyboard-panel-margin) var(--keyboard-panel-margin);- padding-bottom: var(--menu-padding-size, 8px) !important;- border: 0;- border-radius: 28px;- box-shadow: var(--glass-shadow, inset 0 0 0 1px var(--dropdown-border-color));- }-- .dropdown-menu.mobile-bottom-menu.keyboard-panel.keyboard-panel-own-height.show {- height: auto;- max-height: min(50vh, calc(var(--tn-keyboard-height, 50vh) - var(--keyboard-panel-margin)));- }+ max-height: min(+ 50vh,+ calc(var(--tn-keyboard-height, 50vh) + var(--keyboard-panel-rise) - var(--keyboard-panel-margin))+ );}.dropdown-menu.mobile-bottom-menu.keyboard-panel.replaces-panel[data-reveal]:not([data-closing]) {@@ -270,6 +228,11 @@ body.mobile {position: absolute;border: none;+ > .ck-toolbar__items {+ gap: var(--mobile-toolbar-item-gap);+ padding-inline-start: var(--mobile-toolbar-items-inset);+ }+> .ck-toolbar__items > * {margin-block: 0;}@@ -312,6 +275,11 @@ body.mobile {linear-gradient(var(--mobile-toolbar-pill-tint), var(--mobile-toolbar-pill-tint)),var(--mobile-toolbar-pill);box-shadow: var(--mobile-toolbar-pill-shadow);+ transition: scale 250ms cubic-bezier(0.3, 1.6, 0.5, 1);+ }++ &:not(.ck-disabled):active::before {+ scale: var(--mobile-toolbar-pill-press-scale);}&.ck-on {