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 slide parts (and mark private methods) #11

Merged
merged 20 commits into from
Jan 11, 2024
Merged

Add slide parts (and mark private methods) #11

merged 20 commits into from
Jan 11, 2024

Conversation

mirisuzanne
Copy link
Member

@mirisuzanne mirisuzanne commented Dec 28, 2023

Related Issue(s)

Reminder to add related issue(s), if available.

Steps to test/reproduce

There's only one sample slide with notes near the end of the demo. But the control panel (command-k) has buttons for hiding one or the other.

I think this branch raises a few questions:

  • I called the three parts a slide-group, slide-frame, and slide-note. Can we come up with better names? slide-container and slide-canvas? Should it be slide-notes plural?
  • We can't provide shadow-dom default styles for anything nested inside a slotted element. Should we find a way around that, or stop providing default slide styles at all, or…?
  • Should this be documented as the primary use-case, or is it good that we allow a simpler all-children-are-slides setup? That may be a moot point if we remove the default styles.
  • If we do remove the shadow-dom styles, that maybe makes it more important that we provide a 'theme' people can apply.

Copy link

netlify bot commented Dec 28, 2023

Deploy Preview for slide-deck ready!

Name Link
🔨 Latest commit baa85a5
🔍 Latest deploy log https://app.netlify.com/sites/slide-deck/deploys/65a021bc9eaf350008220744
😎 Deploy Preview https://deploy-preview-11--slide-deck.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@mirisuzanne mirisuzanne linked an issue Jan 2, 2024 that may be closed by this pull request
This was linked to issues Jan 2, 2024
@mirisuzanne
Copy link
Member Author

Discussion this morning:

  • wrapper: TBD… slide-container? slide-group? slide-item?
  • internals: slide-note and slide-canvas
  • remove shadow dom styles, and provide a light dom css file

@mirisuzanne
Copy link
Member Author

@jamesnw @jerivas @stacyk I believe this is ready for review now

Copy link
Contributor

@jamesnw jamesnw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few comments, and I am also wondering about the idea of a "part mode" or something like that- instead of specifying what is hidden, could we expose another view mode, where the options are View canvas, View Notes, and View Both? This more closely matches how I would think of it.

This overlaps in name and function with the existing view modes of grid and list. In List, should we allow notes only mode? I also am wondering if in List view, if Canvas + Notes is 100vh, so that both can be seen simultaneously?

slide-deck.js Outdated
];

static attrToPropMap = {
'key-control': 'keyControl',
'follow-active': 'followActive',
'full-screen': 'fullScreen',
'slide-view': 'slideView',
'hide-parts': 'hideParts',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this only allows 1, should it just be hide-part?

slide-deck.js Outdated
@@ -98,57 +112,68 @@ class slideDeck extends HTMLElement {

// dynamic
store = {};
slides;
slideNotes;
slideCanvas;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think slideNotes and slideCanvas should be private.

slide-deck.js Outdated
this.controlPanel = this.querySelector(`[slot="control-panel"]`) ??
this.shadowRoot.querySelector(`[part="control-panel"]`);
this.slides = this.querySelectorAll(':scope > :not([slot])');
this.slideNotes = this.querySelectorAll('[slide-note]');
this.slideCanvas = this.querySelectorAll('[slide-canvas]:not(:scope > *)');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to assert that the notes and canvas are inside a slide? That there is only a single instance of each inside each slide?

slide-deck.js Outdated
note.toggleAttribute('hidden', this.hideParts === 'note');
});

this.slideCanvas.forEach((canvas) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because this.slideCanvas is assigned before slide setup is called, the contents of this.slideCanvas is only the elements the user applied the attribute to, and not all of the ones that web component applied the attribute to in #setupSlides().

This means that when you hide canvas, you get this-
image

Only the slides with notes have their canvases hidden.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this was intentional, but maybe not the right choice. For slides without separate canvas and notes, hiding the canvas would mean hiding the entire container. That doesn't seem like exactly what we want.

@mirisuzanne mirisuzanne marked this pull request as ready for review January 4, 2024 19:43
@mirisuzanne
Copy link
Member Author

@jamesnw I agree, a view-mode might make sense - and raises some questions about naming.

From an API design perspective, I think we want both:

  • support for individual manipulation of the primitives (eg you can show either/both in any layout)
  • a way of adding higher-level concepts that combine them ('presentation mode' shows canvas only, in a full-screen layout)

Ideally, consumers would also be able to add their own higher level modes. I tried to expand on some of the common modes I expect in #12 (comment)

Maybe we need a UX proposal here?

slide-deck.css Outdated
Comment on lines 23 to 38
&[blank-slide]::after {
content: '';
background-color: var(--blank-color, black);
background-color: var(--blank-color);
position: absolute;
inset: 0;
z-index: -1;
}

&[blank-slide=black] {
--blank-color: var(--color-dark);
--text-color: var(--color-light);
}

&[blank-slide=white] {
--blank-color: white;
--blank-color: var(--color-light);
--text-color: var(--color-dark);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stacy I think the purpose of the blank slide is hiding what's on the screen - it's a way to temporarily 'pause' the presentation, either with a white or black overlay. Moving the overlay behind the text, and then adding text contrast kinda defeats the purpose, right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mirisuzanne that was not clear to me at all, and for some reason the "blank" in the name made me think it was more like we are starting with a blank slate, a default slide instead of the more obvious intention of "this should not show anything and it should be blank or empty" 🤦🏻‍♀️ . I don't really know what design issues need to be solved in which PRs/Issues right now, and what is a bug vs what isn't yet ready so I feel like I am overthinking things and not being very helpful yet.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense. I think right now the biggest design issues are the comment above (UX questions about how this should work - what views should be available) and actually designing the slide templates over on the workshop repo. It's ok for design to be pretty minimal in this repo for now.

@mirisuzanne
Copy link
Member Author

@stacyk I pushed some updates to the attributes based on our conversation, to try and help make things more clear for styling. It may require a few changes on your end, but I think it gives you more info to work with.

  • The top level slide element is always labeled as slide-item
  • If it has a nested canvas, that becomes slide-item="container", otherwise it becomes slide-item="canvas" and also gets the slide-canvas attribute
  • The active slide always gets aria-current="true"
  • The slide-deck has a new --slide-count property
  • Each slide has a new ---slide-index property

Let me know if you need any of those to change.

@jamesnw
Copy link
Contributor

jamesnw commented Jan 8, 2024

I privatized a few more things. Here's the remaining public API, but @mirisuzanne I have a few questions-

DOM Elements - Should these be public? I don't think we want people setting these values, at the very least.
'slides', 'slideNotes', 'slideCanvas'

Data- these make sense to have public, even when there is overlap with an attribute.
'slideCount','activeSlide', 'slideView', 'keyControl'

Events - is this the right list?
'startEvent', 'resumeEvent', 'joinWithNotesEvent', 'joinEvent', 'endEvent', 'resetEvent', 'blankSlideEvent', 'fullScreenEvent', 'scrollToActive', 'goTo', 'resetActive', 'move', 'goToSaved',

@jamesnw
Copy link
Contributor

jamesnw commented Jan 8, 2024

@mirisuzanne In f5cdd61, I moved the attribute state to getters, which means we can always use the attribute values as the source of truth, and not have to make sure our internal reflection of that value stays up to date. This does mean we need to declare each one instead of adding dynamically, so I'm open to reverting if you'd prefer the old behavior.

slide-deck.js Outdated Show resolved Hide resolved
@stacyk
Copy link
Member

stacyk commented Jan 9, 2024

I didn't get to this one today, but I will look into it tomorrow. Script view definitely isn't ideal for small screens yet.

@mirisuzanne
Copy link
Member Author

@stacyk I think when we merge this, it would be a good time to release a new version and update the workshop repo.

Copy link
Member

@stacyk stacyk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mirisuzanne I pushed an update here with some CSS to make script view a bit more readable on smaller screens. And I agree it should go into the workshop repo when approved/released.

I didn't do anything with the slide numbers here, but that can be a different PR.

Copy link
Member Author

@mirisuzanne mirisuzanne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stacyk looking great - and yeah, I think numbering can wait. I left some style thoughts, but I'm not sure how much we should stress about style, ha.

slide-deck.css Outdated
grid-template-columns: repeat(auto-fill, minmax(min(50ch, 100%), 1fr));
}

&[slide-view=solo] {
--slide-height: 100svh;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this should be set on the grid instead? eg

grid-auto-rows: minmax(100svh, auto);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mirisuzanne when I played with this, the slides with note don't take up the full height then. Am I missing something?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, yeah, but I think we should be hiding the notes in that view? And then it will work.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mirisuzanne It looks like we still need the slide height for the container slide-items (or some additional edits to the CSS). The canvas only items are fine with the grid-rows sizing. Just pushed an update that will make it easier to see if you uncheck the --slide-height on [slide-view=solo] [slide-item]

Screenshot 2024-01-11 at 11 03 18 AM

Screenshot 2024-01-11 at 11 03 22 AM

slide-deck.css Show resolved Hide resolved
--slide-height: 100svh;
}

&[slide-view=script] {
--column-gap: calc(1.25em + 2vw);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To me this looks like more space than is needed? I think a faint boarder would be more useful than space? This feels like a view where context is more useful than whitespace.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mirisuzanne how much space are you seeing? I see like, less than pinky width on active slides?

Official measurement device.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stacyk Oh oh oh, it's the 5em row gap that's real large for me. Sorry. I think that could be more like a hairline and something closer to the column gap.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I started playing with a hairline (it was a little finicky because of the slide item with container and with only canvas are different sizes), but then I wondered if was more than a layout thing that I should apply in a custom theme instead of the default styles in this tool. But I can play with it more in this tool to see if I can get it just right.

@mirisuzanne mirisuzanne merged commit b3c362e into main Jan 11, 2024
4 checks passed
@mirisuzanne mirisuzanne deleted the parts branch January 11, 2024 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Clean up Public & Private API Feature: Support for speaker notes
4 participants