Skip to content
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

Add scroll view #3482

Merged
merged 32 commits into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
6aa1eae
foundation for reader mode, activate via 'mode=reader/print' config p…
hakimel Sep 12, 2023
f26d315
separate reader mode into individual controller, add scroll triggers …
hakimel Sep 14, 2023
0f27ef4
revert demo changes to index.html
hakimel Sep 14, 2023
eaf5f61
reader mode; deeplink support, presentation scaling, scroll trigger f…
hakimel Sep 14, 2023
4da6f6b
refactoring, fix preload distance
hakimel Sep 14, 2023
5de7da7
reader mode can be turned off without reload, add Reveal.toggleReader()
hakimel Sep 19, 2023
0861b07
revamped reader mode sticky logic, add option for fullscreen pages
hakimel Sep 20, 2023
f0950ba
rename 'mode' config value to 'view'
hakimel Sep 20, 2023
e49e89a
reader mode supports scroll snapping, sticky pages with scroll trigge…
hakimel Sep 21, 2023
97f2e18
fix preload bug
hakimel Sep 21, 2023
4c9cc89
refactoring, remove unused layout
hakimel Sep 22, 2023
c856fa9
dispatch slidechange events in reader mode
hakimel Sep 25, 2023
3db2340
fix issues with active slide logic in reader mode, foundational work …
hakimel Oct 5, 2023
899a45d
update api method name
hakimel Oct 5, 2023
ab52d33
add support for responsively activating reader mode via
hakimel Oct 6, 2023
d84aa34
reader mode tests
hakimel Oct 6, 2023
1f1ca3a
refactoring
hakimel Oct 6, 2023
1871824
reader mode; named deeplink support, stay on same slide when reader m…
hakimel Oct 6, 2023
f80ee3b
reader mode progress bar
hakimel Oct 10, 2023
2347991
reader mode progress bar can be dragged to scroll
hakimel Oct 10, 2023
a6abd04
finishing touches on reader mode progress bar
hakimel Oct 10, 2023
2c5a83c
refactoring
hakimel Oct 10, 2023
09f36ad
mobile tweaks
hakimel Oct 11, 2023
122642f
reader progress theming, automatically invert based on slide bg
hakimel Oct 11, 2023
be5d811
convert sass controls spacing to css var, full height reader progress…
hakimel Oct 11, 2023
980b902
disable overview while in reader mode
hakimel Oct 11, 2023
c1b1745
audit fix
hakimel Oct 11, 2023
d802789
more accurate scroll trigger positioning in progress bar
hakimel Oct 12, 2023
198cbc4
reader mode tweaks
hakimel Oct 12, 2023
a7d0916
reader mode accessibility, bug fixes
hakimel Oct 12, 2023
b8b55b8
readerScrollBar -> readerScrollbar
hakimel Oct 12, 2023
7108476
Merge branch 'master' into feature/reader-mode
hakimel Oct 12, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion css/print/pdf.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* https://revealjs.com/pdf-export/
*/

html.print-pdf {
html.reveal-print {
* {
-webkit-print-color-adjust: exact;
}
Expand Down
229 changes: 220 additions & 9 deletions css/reveal.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ html.reveal-full-page {
height: 100%;
height: 100vh;
height: calc( var(--vh, 1vh) * 100 );
height: 100svh;
overflow: hidden;
}

Expand All @@ -31,6 +32,8 @@ html.reveal-full-page {

background-color: #fff;
color: #000;

--r-controls-spacing: 12px;
}

// Force the presentation to cover the full viewport when we
Expand Down Expand Up @@ -271,13 +274,11 @@ $controlsArrowAngleActive: 36deg;
}

.reveal .controls {
$spacing: 12px;

display: none;
position: absolute;
top: auto;
bottom: $spacing;
right: $spacing;
bottom: var(--r-controls-spacing);
right: var(--r-controls-spacing);
left: auto;
z-index: 11;
color: #000;
Expand Down Expand Up @@ -509,7 +510,9 @@ $controlsArrowAngleActive: 36deg;
// Edge aligned controls layout
@media screen and (min-width: 500px) {

$spacing: 0.8em;
.reveal-viewport {
--r-controls-spacing: 0.8em;
}

.reveal .controls[data-controls-layout="edges"] {
& {
Expand All @@ -529,24 +532,24 @@ $controlsArrowAngleActive: 36deg;

.navigate-left {
top: 50%;
left: $spacing;
left: var(--r-controls-spacing);
margin-top: -$controlArrowSize*0.5;
}

.navigate-right {
top: 50%;
right: $spacing;
right: var(--r-controls-spacing);
margin-top: -$controlArrowSize*0.5;
}

.navigate-up {
top: $spacing;
top: var(--r-controls-spacing);
left: 50%;
margin-left: -$controlArrowSize*0.5;
}

.navigate-down {
bottom: $spacing - $controlArrowSpacing + 0.3em;
bottom: calc(var(--r-controls-spacing) - #{$controlArrowSpacing} + 0.3em);
left: 50%;
margin-left: -$controlArrowSize*0.5;
}
Expand Down Expand Up @@ -1864,6 +1867,214 @@ $notesWidthPercent: 25%;
}


/*********************************************
* READER MODE
*********************************************/
.reveal-viewport.loading-scroll-mode {
visibility: hidden;
}

.reveal-viewport.reveal-reader {
& {
margin: 0 auto !important;
overflow: auto;
overflow-x: hidden;
overflow-y: auto;
z-index: 1;

--r-reader-progress-width: 8px;
--r-reader-progress-trigger-size: 6px;
}

@media screen and (max-width: 500px) {
--r-reader-progress-width: 3px;
--r-reader-progress-trigger-size: 3px;
}

.reveal .controls,
.reveal .progress,
.reveal .playback,
.reveal .backgrounds,
.reveal .slide-number {
display: none !important;
}

.reveal {
overflow: visible;
touch-action: manipulation;
}
.reveal .slides {
position: static;
pointer-events: initial;

left: auto;
top: auto;
width: 100% !important;
margin: 0 !important;
padding: 0 !important;

overflow: visible;
display: block;

perspective: none;
perspective-origin: 50% 50%;
}

.reveal .slides .reader-page {
position: relative;
width: 100%;
height: calc(var(--page-height) + var(--page-scroll-padding));
z-index: 1;
overflow: visible;
}

.reveal .slides .reader-page-sticky {
position: sticky;
height: var(--page-height);
top: 0px;
}

.reveal .slides .reader-page-content {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}

.reveal .slides .reader-page section {
visibility: visible !important;
display: block !important;
position: absolute !important;
top: 50% !important;
left: 50% !important;
opacity: 1 !important;
transform: scale(var(--slide-scale)) translate(-50%, -50%) !important;
transform-style: flat !important;
transform-origin: 0 0 !important;
}

.reveal .slide-background {
display: block !important;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: auto !important;
visibility: visible;
opacity: 1;
touch-action: manipulation;
}
}

.reveal-viewport.reveal-reader[data-reader-scroll-bar="true"]::-webkit-scrollbar,
.reveal-viewport.reveal-reader[data-reader-scroll-bar="auto"]::-webkit-scrollbar {
display: none;
}

.reveal.has-dark-background,
.reveal-viewport.has-dark-background {
--r-overlay-element-bg-color: 240, 240, 240;
--r-overlay-element-fg-color: 0, 0, 0;
}
.reveal.has-light-background,
.reveal-viewport.has-light-background {
--r-overlay-element-bg-color: 0, 0, 0;
--r-overlay-element-fg-color: 240, 240, 240;
}

.reveal-viewport.reveal-reader .reader-progress {
position: sticky;
top: 50%;
z-index: 20;
opacity: 0;
transition: all 0.3s ease;

&.visible,
&:hover {
opacity: 1;
}

.reader-progress-inner {
position: absolute;
width: var(--r-reader-progress-width);
height: calc(var(--viewport-height) - var(--r-controls-spacing) * 2);
right: var(--r-controls-spacing);
top: 0;
transform: translateY(-50%);
border-radius: var(--r-reader-progress-width);
z-index: 10;
}

// Hit area
.reader-progress-inner:after {
content: '';
position: absolute;
width: 200%;
height: 100%;
top: 0;
left: -50%;
background: rgba( 0, 0, 0, 0 );
z-index: -1;
}

.reader-progress-playhead {
position: absolute;
width: var(--r-reader-progress-width);
height: var(--r-reader-progress-width);
top: 0;
left: 0;
border-radius: var(--r-reader-progress-width);
background-color: rgba(var(--r-overlay-element-bg-color), 1);
z-index: 11;
transition: background-color 0.2s ease, height 0.4s ease;
}

.reader-progress-slide {
position: absolute;
width: 100%;
background-color: rgba(var(--r-overlay-element-bg-color), 0.2);
box-shadow: 0 0 0px 1px rgba(var(--r-overlay-element-fg-color), 0.1);
border-radius: var(--r-reader-progress-width);
transition: background-color 0.2s ease;
}

.reader-progress-slide.active {
background-color: rgba(var(--r-overlay-element-bg-color), 1);
}

.reader-progress-trigger {
position: absolute;
width: 100%;
transition: background-color 0.2s ease;
}

.reader-progress-slide.active.has-triggers {
background-color: rgba(var(--r-overlay-element-bg-color), 0.4);
z-index: 10;
}

.reader-progress-slide.active .reader-progress-trigger:after {
content: '';
position: absolute;
width: var(--r-reader-progress-trigger-size);
height: var(--r-reader-progress-trigger-size);
border-radius: 20px;
bottom: 0;
left: 50%;
transform: translate(-50%, 0);
background-color: rgba(var(--r-overlay-element-bg-color), 0.8);
transition: transform 0.2s ease;
}

.reader-progress-slide.active .reader-progress-trigger.active:after {
transform: translate(calc( var(--r-reader-progress-width) * -2), 0);
background-color: rgba(var(--r-overlay-element-bg-color), 1);
}
}


/*********************************************
* PRINT STYLES
*********************************************/
Expand Down
3 changes: 3 additions & 0 deletions css/theme/source/beige.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ $linkColorHover: lighten( $linkColor, 20% );
$selectionBackgroundColor: rgba(79, 64, 28, 0.99);
$heading1TextShadow: 0 1px 0 #ccc, 0 2px 0 #c9c9c9, 0 3px 0 #bbb, 0 4px 0 #b9b9b9, 0 5px 0 #aaa, 0 6px 1px rgba(0,0,0,.1), 0 0 5px rgba(0,0,0,.1), 0 1px 3px rgba(0,0,0,.3), 0 3px 5px rgba(0,0,0,.2), 0 5px 10px rgba(0,0,0,.25), 0 20px 20px rgba(0,0,0,.15);

$overlayElementBgColor: 0, 0, 0;
$overlayElementFgColor: 240, 240, 240;

// Background generator
@mixin bodyBackground() {
@include radial-gradient( rgba(247,242,211,1), rgba(255,255,255,1) );
Expand Down
3 changes: 3 additions & 0 deletions css/theme/source/serif.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ $linkColor: #51483D;
$linkColorHover: lighten( $linkColor, 20% );
$selectionBackgroundColor: #26351C;

$overlayElementBgColor: 0, 0, 0;
$overlayElementFgColor: 240, 240, 240;

.reveal a {
line-height: 1.3em;
}
Expand Down
3 changes: 3 additions & 0 deletions css/theme/source/simple.scss
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ $linkColor: #00008B;
$linkColorHover: lighten( $linkColor, 20% );
$selectionBackgroundColor: rgba(0, 0, 0, 0.99);

$overlayElementBgColor: 0, 0, 0;
$overlayElementFgColor: 240, 240, 240;

// Change text colors against dark slide backgrounds
@include dark-bg-text-color(#fff);

Expand Down
3 changes: 3 additions & 0 deletions css/theme/source/sky.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ $linkColor: #3b759e;
$linkColorHover: lighten( $linkColor, 20% );
$selectionBackgroundColor: #134674;

$overlayElementBgColor: 0, 0, 0;
$overlayElementFgColor: 240, 240, 240;

// Fix links so they are not cut off
.reveal a {
line-height: 1.3em;
Expand Down
3 changes: 3 additions & 0 deletions css/theme/source/solarized.scss
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ $linkColor: $blue;
$linkColorHover: lighten( $linkColor, 20% );
$selectionBackgroundColor: $magenta;

$overlayElementBgColor: 0, 0, 0;
$overlayElementFgColor: 240, 240, 240;

// Background generator
// @mixin bodyBackground() {
// @include radial-gradient( rgba($base3,1), rgba(lighten($base3, 20%),1) );
Expand Down
3 changes: 3 additions & 0 deletions css/theme/source/white-contrast.scss
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ $heading2Size: 1.6em;
$heading3Size: 1.3em;
$heading4Size: 1.0em;

$overlayElementBgColor: 0, 0, 0;
$overlayElementFgColor: 240, 240, 240;

// Change text colors against dark slide backgrounds
@include dark-bg-text-color(#fff);

Expand Down
3 changes: 3 additions & 0 deletions css/theme/source/white.scss
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ $heading2Size: 1.6em;
$heading3Size: 1.3em;
$heading4Size: 1.0em;

$overlayElementBgColor: 0, 0, 0;
$overlayElementFgColor: 240, 240, 240;

// Change text colors against dark slide backgrounds
@include dark-bg-text-color(#fff);

Expand Down
2 changes: 2 additions & 0 deletions css/theme/template/exposer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@
--r-link-color-hover: #{$linkColorHover};
--r-selection-background-color: #{$selectionBackgroundColor};
--r-selection-color: #{$selectionColor};
--r-overlay-element-bg-color: #{$overlayElementBgColor};
--r-overlay-element-fg-color: #{$overlayElementFgColor};
}
5 changes: 5 additions & 0 deletions css/theme/template/settings.scss
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ $linkColorHover: lighten( $linkColor, 20% );
$selectionBackgroundColor: #FF5E99;
$selectionColor: #fff;

// Colors used for UI elements that are overlaid on top of
// the presentation
$overlayElementBgColor: 240, 240, 240;
$overlayElementFgColor: 0, 0, 0;

// Generates the presentation background, can be overridden
// to return a background image or gradient
@mixin bodyBackground() {
Expand Down
4 changes: 2 additions & 2 deletions dist/reveal.css

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/reveal.esm.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/reveal.esm.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/reveal.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/reveal.js.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions dist/theme/beige.css
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ section.has-dark-background, section.has-dark-background h1, section.has-dark-ba
--r-link-color-hover: #c0a86e;
--r-selection-background-color: rgba(79, 64, 28, 0.99);
--r-selection-color: #fff;
--r-overlay-element-bg-color: 0, 0, 0;
--r-overlay-element-fg-color: 240, 240, 240;
}

.reveal-viewport {
Expand Down
Loading
Loading