-
Notifications
You must be signed in to change notification settings - Fork 7.5k
refactor(types): Type enhancements #8968
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
mister-ben
wants to merge
24
commits into
videojs:main
Choose a base branch
from
mister-ben:type-enhancements
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
Changes from 17 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
e93f224
wiip
mister-ben 0d7a77d
Merge branch 'main' into type-experiment-467
mister-ben bebefa8
Merge branch 'main' into type-experiment-467
mister-ben 53c6c3d
Update typescript
mister-ben 705df44
Types overhaul
mister-ben 9813b5c
Merge branch 'main' into type-experiment-467
mister-ben c6754b2
update jsdoc,tsc deps
mister-ben fcc47da
reorg exports
mister-ben c1d4bd0
list of strings for audio/video track types
mister-ben dd7f1ff
use standard types for TextTracks
mister-ben 74c1316
Fix type of SourceObject, MediaObject
mister-ben 2ea0ced
Update description to match type
mister-ben 1b482a5
Add more to component options
mister-ben 8d2f672
Fullscreen properties
mister-ben 2e5fc2d
Define player options and have them importable from top level
mister-ben f7da0c6
fixes
mister-ben c884bfa
Merge branch 'main' into type-enhancements
mister-ben ea97ef1
Add redundant jsdoc so that tsc understands
mister-ben 7420c3d
Merge branch 'main' into type-enhancements
mister-ben 08eeb6e
lint
2798afd
support @template {typeof Component} T
mister-ben 4e5dbb1
Update regiserComponent jsdoc
mister-ben 88aead4
Merge branch 'main' into type-enhancements
mister-ben 84cd78d
Merge branch 'main' into type-enhancements
mister-ben 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,18 @@ import {merge} from './utils/obj.js'; | |
* @returns {void} | ||
*/ | ||
|
||
/** | ||
* @typedef {Object} ComponentOptions | ||
* @property {Object[]} [children] | ||
* @property {string} [classname] | ||
* @property {boolean} [initChildren] | ||
* @property {boolean} [reportTouchActivity] | ||
* @property {string} [name] | ||
* @property {boolean} [createEl=true] | ||
* @property {HTMLElement} [el] | ||
* @property {boolean} [evented] | ||
*/ | ||
|
||
/** | ||
* Base class for all UI Components. | ||
* Components are UI objects which represent both a javascript object and an element | ||
|
@@ -39,17 +51,9 @@ class Component { | |
* @param {Player} player | ||
* The `Player` that this class should be attached to. | ||
* | ||
* @param {Object} [options] | ||
* @param {ComponentOptions} [options] | ||
* The key/value store of component options. | ||
* | ||
* @param {Object[]} [options.children] | ||
* An array of children objects to initialize this component with. Children objects have | ||
* a name property that will be used if more than one component of the same type needs to be | ||
* added. | ||
* | ||
* @param {string} [options.className] | ||
* A class or space separated list of classes to add the component | ||
* | ||
* @param {ReadyCallback} [ready] | ||
* Function that gets called when the `Component` is ready. | ||
*/ | ||
|
@@ -589,22 +593,22 @@ class Component { | |
|
||
return iconContainer; | ||
} | ||
|
||
/** | ||
* Add a child `Component` inside the current `Component`. | ||
* | ||
* @param {string|Component} child | ||
* @template {Component} T | ||
* @param {string|T} child | ||
* The name or instance of a child to add. | ||
* | ||
* @param {Object} [options={}] | ||
* @param {ComponentOptions} [options={}] | ||
* The key/value store of options that will get passed to children of | ||
* the child. | ||
* | ||
* @param {number} [index=this.children_.length] | ||
* The index to attempt to add a child into. | ||
* | ||
* | ||
* @return {Component} | ||
* @return {T} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
* The `Component` that gets added as a child. When using a string the | ||
* `Component` will get created by this process. | ||
*/ | ||
|
@@ -1242,7 +1246,7 @@ class Component { | |
* An object that contains width and height values of the `Component`s | ||
* computed style. Uses `window.getComputedStyle`. | ||
* | ||
* @typedef {Object} Component~DimensionObject | ||
* @typedef {Object} DimensionObject | ||
* | ||
* @property {number} width | ||
* The width of the `Component`s computed style. | ||
|
@@ -1257,7 +1261,7 @@ class Component { | |
* | ||
* Uses `window.getComputedStyle`. | ||
* | ||
* @return {Component~DimensionObject} | ||
* @return {DimensionObject} | ||
* The computed dimensions of the component's element. | ||
*/ | ||
currentDimensions() { | ||
|
@@ -1979,10 +1983,10 @@ class Component { | |
* @param {string} name | ||
* The name of the `Component` to register. | ||
* | ||
* @param {Component} ComponentToRegister | ||
* @param {typeof Component} ComponentToRegister | ||
* The `Component` class to register. | ||
* | ||
* @return {Component} | ||
* @return {typeof Component} | ||
mister-ben marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* The `Component` that was registered. | ||
*/ | ||
static registerComponent(name, ComponentToRegister) { | ||
|
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
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.
Uh oh!
There was an error while loading. Please reload this page.