Skip to content

fix: skin syntax usage cleanup#48

Merged
cjpillsbury merged 9 commits intomainfrom
fix/skin-syntax-usage-cleanup
Oct 10, 2025
Merged

fix: skin syntax usage cleanup#48
cjpillsbury merged 9 commits intomainfrom
fix/skin-syntax-usage-cleanup

Conversation

@cjpillsbury
Copy link
Copy Markdown
Collaborator

@cjpillsbury cjpillsbury commented Oct 9, 2025

Some refactors to make skin compilation simpler and more reliable. Multiple callouts in self-added PR comments.

@vercel
Copy link
Copy Markdown

vercel bot commented Oct 9, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
vjs-10-demo-html Ready Ready Preview Comment Oct 10, 2025 7:21pm
vjs-10-demo-react Ready Ready Preview Comment Oct 10, 2025 7:21pm
vjs-10-website Ready Ready Preview Comment Oct 10, 2025 7:21pm

@vercel vercel bot temporarily deployed to Preview – vjs-10-website October 10, 2025 15:14 Inactive
@vercel vercel bot temporarily deployed to Preview – vjs-10-demo-html October 10, 2025 15:14 Inactive
@vercel vercel bot temporarily deployed to Preview – vjs-10-demo-react October 10, 2025 15:14 Inactive
@cjpillsbury cjpillsbury force-pushed the fix/skin-syntax-usage-cleanup branch from e91f51a to a919f39 Compare October 10, 2025 19:20
@vercel vercel bot temporarily deployed to Preview – vjs-10-demo-html October 10, 2025 19:20 Inactive
@vercel vercel bot temporarily deployed to Preview – vjs-10-website October 10, 2025 19:20 Inactive
@vercel vercel bot temporarily deployed to Preview – vjs-10-demo-react October 10, 2025 19:21 Inactive
@@ -0,0 +1,136 @@
import type { PropsWithChildren } from 'react';
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Don't worry about maintaining these or keeping them in sync with skin updates/refactors. Here primarily for compiler iteration, validation, and other testing.

},
"dependencies": {
"@vjs-10/react": "workspace:*",
"@vjs-10/react-icons": "workspace:*",
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Added to test in-app defined skins.


// Register the custom element
if (!globalThis.customElements.get('media-current-time-display')) {
// @ts-ignore - Custom element constructor compatibility
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Some eslint error strays I caught. Sorry for the noise!


#setupPortal(): void {
const portalId = this.getAttribute('root-id');
const portalId = this.getAttribute('root-id') ?? '@default_portal_id';
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This and the corresponding changes in react, as well as the related changes to the respective media containers, are very much a stopgap. We need to build a "real architecture" here, and hopefully can use media container as the default owner of (at least tooltip-related) portals to simplify use cases. Done for now to simplify problem space for complier.

return /* html */ `
<slot name="media"></slot>
<slot></slot>
<div id="@default_portal_id" style={ position: absolute; zIndex: 10; }>
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Dum dum solution for default portals. slot bits were due to styling inheritance between skin-defined tooltip styles vs. container component shadow dom-defined portal root (and css boundaries implicated therein). On @mihar-22's radar as a tough problem that needs to be figured out.

customElements.define('media-container', MediaContainer);
// Register the custom element
if (!globalThis.customElements.get('media-container')) {
// @ts-expect-error ts(2345)
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

We need to carve out time to fix all of our TS woes at some point...

@@ -1,5 +1,4 @@
import { MediaSkin } from '../media-skin';
import { uniqueId } from '../utils/element-utils';

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

simplified skin for compiler

<div ref={composedRef} {...props}>
{children}
{/* @TODO We need to make sure this is non-brittle longer term (CJP) */}
<div id={portalId} style={{ position: 'absolute', zIndex: 10 }} />
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

same as above convo (though react side required less hackrobatics. Thoughts on the table are using context providers and consumers for some of these hack-ins.

<PlayButton className={`${styles.Button} ${styles.IconButton} ${styles.PlayButton}`}>
<PlayIcon className={styles.PlayIcon}></PlayIcon>
<PauseIcon className={styles.PauseIcon}></PauseIcon>
<PlayIcon className={`${styles.PlayIcon} ${styles.Icon}`} />
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

skin simplification for compiler. Used for descendant selectors (previously used svg, which is not appropriately equivalent for html/web component equivalent).

@@ -1,180 +0,0 @@
/** @TODO: Improve/Polish CSS Here */
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Removing to avoid repo noise. It's in history if we ever want/need to refer back.

import type { MediaDefaultSkinStyles } from './types';

import { cn } from '../../utils/cn';
// NOTE: Removing import to sidestep for compiler complexity (CJP)
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Skin styles simplification for compiler. TL;DR:

  1. imports would need to be pulled in as well. Longer term we may want to either solve this or just bake in some common css+js(x) utils into the compiler (cn, clsx, maybe others)
  2. Make sure non-tailwind-utility classes correspond with key names.
  3. Avoid selectors that use element names, since they may not be appropriately equivalent when cross-compiling, especially for VJS components (e.g. [&_svg] vs. added Icon: cn('icon') + [&_.icon])
  4. If key names are intended to correspond with component names, try to make them be exact matches (e.g. FullScreen vs. Fullscreen. Previously also VolumeButton vs. MuteButton, TimeSlider vs. TimeRange, etc. etc.)

<PlayButton className={`${styles.Button} ${styles.IconButton} ${styles.PlayButton}`}>
<PlayIcon className={styles.PlayIcon}></PlayIcon>
<PauseIcon className={styles.PauseIcon}></PauseIcon>
<PlayIcon className={`${styles.PlayIcon} ${styles.Icon}`} />
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Added Icon for reasons discussed in styles.ts comments.

@cjpillsbury cjpillsbury marked this pull request as ready for review October 10, 2025 19:36
@@ -1,12 +1,14 @@
export { CurrentTimeDisplay } from './components/media-current-time-display.js';
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Adding missing component and other relevant exports to main module for compiler efforts.

export { MuteButton } from './components/MuteButton';
export { PlayButton } from './components/PlayButton';
export { Popover } from './components/Popover';
export { TimeSlider } from './components/TimeSlider';
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Adding missing component and other relevant exports to main module for compiler efforts.

@cjpillsbury cjpillsbury merged commit d4f3f4b into main Oct 10, 2025
4 checks passed
@github-actions github-actions bot mentioned this pull request Oct 24, 2025
@mihar-22 mihar-22 deleted the fix/skin-syntax-usage-cleanup branch November 24, 2025 03:50
@github-actions github-actions bot mentioned this pull request Feb 26, 2026
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.

1 participant