Skip to content

Commit dd74375

Browse files
committed
chore: restructure project for simplicity
1 parent 7ff14a3 commit dd74375

File tree

108 files changed

+4247
-2740
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+4247
-2740
lines changed

.eslintrc.json

-6
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,6 @@
66
"airbnb-typescript",
77
"plugin:@stencil/recommended"
88
],
9-
"ignorePatterns": [
10-
"media/",
11-
"packages/react/src/",
12-
"packages/vue/src/",
13-
"packages/angular/src/"
14-
],
159
"rules": {
1610
"no-console": "off",
1711
"default-case": "off",

.github/workflows/release.yml

+8-4
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ jobs:
1616
node-version: 14
1717
- name: Install pnpm
1818
run: curl -L https://raw.githubusercontent.com/pnpm/self-installer/master/install.js | node
19-
- name: Install dependencies
20-
run: pnpm install
19+
- name: Install root dependencies
20+
run: pnpm install --filter vime
21+
- name: Install core dependencies
22+
run: pnpm install --filter @vime/core
2123
- name: Test
2224
run: pnpm run test:e2e.providers --filter @vime/core
2325
release:
@@ -32,8 +34,10 @@ jobs:
3234
node-version: 14
3335
- name: Install pnpm
3436
run: curl -L https://raw.githubusercontent.com/pnpm/self-installer/master/install.js | node
35-
- name: Install dependencies
36-
run: pnpm install
37+
- name: Install root dependencies
38+
run: pnpm install --filter vime
39+
- name: Install packages/* dependencies
40+
run: pnpm install --filter ./packages
3741
- name: Test
3842
run: pnpm run test:ci --filter @vime/core
3943
- name: Coverage

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ pnpm-debug.log*
3333
chrome-profiler-events*.json
3434
speed-measure-plugin*.json
3535

36+
packages/angular/src/directives/
37+
packages/react/src/components.ts
38+
packages/react/src/react-component-lib/
39+
packages/vue/src/components.ts
40+
packages/vue/src/vue-component-lib/
41+
3642
/tmp
3743
/out-tsc
3844
/bazel-out

CHANGELOG.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Changelog
22

3-
Automatically generated by [semantic-release](https://github.com/semantic-release/semantic-release)
4-
and can be found on the [releases page](https://github.com/vime-js/vime/releases).
3+
Automatically generated by [semantic-release](https://github.com/semantic-release/semantic-release)
4+
and can be found on the [releases page](https://github.com/vime-js/vime/releases).

CODE_OF_CONDUCT.md

+11-12
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
# Contributor Covenant Code of Conduct
32

43
## Our Pledge
@@ -18,23 +17,23 @@ diverse, inclusive, and healthy community.
1817
Examples of behavior that contributes to a positive environment for our
1918
community include:
2019

21-
* Demonstrating empathy and kindness toward other people
22-
* Being respectful of differing opinions, viewpoints, and experiences
23-
* Giving and gracefully accepting constructive feedback
24-
* Accepting responsibility and apologizing to those affected by our mistakes,
20+
- Demonstrating empathy and kindness toward other people
21+
- Being respectful of differing opinions, viewpoints, and experiences
22+
- Giving and gracefully accepting constructive feedback
23+
- Accepting responsibility and apologizing to those affected by our mistakes,
2524
and learning from the experience
26-
* Focusing on what is best not just for us as individuals, but for the
25+
- Focusing on what is best not just for us as individuals, but for the
2726
overall community
2827

2928
Examples of unacceptable behavior include:
3029

31-
* The use of sexualized language or imagery, and sexual attention or
30+
- The use of sexualized language or imagery, and sexual attention or
3231
advances of any kind
33-
* Trolling, insulting or derogatory comments, and personal or political attacks
34-
* Public or private harassment
35-
* Publishing others' private information, such as a physical or email
32+
- Trolling, insulting or derogatory comments, and personal or political attacks
33+
- Public or private harassment
34+
- Publishing others' private information, such as a physical or email
3635
address, without their explicit permission
37-
* Other conduct which could reasonably be considered inappropriate in a
36+
- Other conduct which could reasonably be considered inappropriate in a
3837
professional setting
3938

4039
## Enforcement Responsibilities
@@ -107,7 +106,7 @@ Violating these terms may lead to a permanent ban.
107106
### 4. Permanent Ban
108107

109108
**Community Impact**: Demonstrating a pattern of violation of community
110-
standards, including sustained inappropriate behavior, harassment of an
109+
standards, including sustained inappropriate behavior, harassment of an
111110
individual, or aggression toward or disparagement of classes of individuals.
112111

113112
**Consequence**: A permanent ban from any sort of public interaction within

CONTRIBUTING.md

+122-129
Large diffs are not rendered by default.

README.md

+31-20
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,24 @@
1212
alt="Vime 2 - Video Player Screenshot"
1313
/>
1414

15-
Vime is simply a collection of [web components](https://developer.mozilla.org/en-US/docs/Web/Web_Components)
15+
Vime is simply a collection of [web components](https://developer.mozilla.org/en-US/docs/Web/Web_Components)
1616
that enable you to easily build and customize your own media player.
1717

1818
- 🖥  Responsive (mobile/desktop).
1919
- 👌  Touch input friendly.
20-
- 🎥  Multi-provider support (HTML5, HLS, YouTube, Vimeo etc.).
20+
- 🎥  Multi-provider support (HTML5, HLS, YouTube, Vimeo etc.).
2121
- ♾️  Avoid cross-browser differences on media related APIs such as fullscreen and picture-in-picture.
22-
- 👐  [Accessible](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) via ARIA
23-
roles/states/properties and keyboard support.
22+
- 👐  [Accessible](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) via ARIA
23+
roles/states/properties and keyboard support.
2424
- 🌎  I18N support.
2525
- 🎨  Style anything you want with [CSS variables](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties).
2626
- 🏎️  Performant with [preconnections](https://css-tricks.com/using-relpreconnect-to-establish-network-connections-early-and-increase-performance) + [lazy loading](https://www.imperva.com/learn/performance/lazy-loading) of components and media out of the box.
2727
- ️🧰  Awesome default UI's for audio/video/live media on mobile and desktop.
2828
- 🛠  Comprehensive [player API](../components/core/player/readme.md).
2929
- 💪  Built with TypeScript so you can enjoy completely typed components.
30-
- 🏠  Feel right at home with HTML/CSS/JS thanks to web components.
31-
- 🍽️  Serve it with your favourite framework whether it's React, Vue, Angular or whatever the cool
32-
kids on the block use today.
30+
- 🏠  Feel right at home with HTML/CSS/JS thanks to web components.
31+
- 🍽️  Serve it with your favourite framework whether it's React, Vue, Angular or whatever the cool
32+
kids on the block use today.
3333

3434
🍭 Here's a few little bites of what you can do with Vime ...
3535

@@ -39,13 +39,24 @@ kids on the block use today.
3939
<vime-video poster="/media/poster.png" cross-origin>
4040
<!-- Why `data-src`? Lazy loading. You can always use `src` if you don't need it. -->
4141
<source data-src="/media/video.mp4" type="video/mp4" />
42-
<track default kind="subtitles" src="/media/subs/en.vtt" srclang="en" label="English" />
43-
<track kind="subtitles" src="/media/subs/es.vtt" srclang="es" label="Spanish" />
42+
<track
43+
default
44+
kind="subtitles"
45+
src="/media/subs/en.vtt"
46+
srclang="en"
47+
label="English"
48+
/>
49+
<track
50+
kind="subtitles"
51+
src="/media/subs/es.vtt"
52+
srclang="es"
53+
label="Spanish"
54+
/>
4455
</vime-video>
4556
</vime-player>
4657
```
4758

48-
*Custom UI?*
59+
_Custom UI?_
4960

5061
```html
5162
<!-- Lets add a little splash of color throughout the player. -->
@@ -77,7 +88,7 @@ kids on the block use today.
7788
</vime-player>
7889
```
7990

80-
*In a hurry?*
91+
_In a hurry?_
8192

8293
```html
8394
<!-- Light themed audio player. -->
@@ -99,9 +110,9 @@ There are framework specific bindings for:
99110
- [Vue](https://vuejs.org)
100111
- [Angular](https://angular.io)
101112

102-
Keep in mind, that at its core Vime is still simply web components. Even if your framework is
103-
not mentioned in the list above, it most likely still supports Vime natively. You can check
104-
[here](https://custom-elements-everywhere.com/) if your framework has complete support for
113+
Keep in mind, that at its core Vime is still simply web components. Even if your framework is
114+
not mentioned in the list above, it most likely still supports Vime natively. You can check
115+
[here](https://custom-elements-everywhere.com/) if your framework has complete support for
105116
web components.
106117

107118
There are also [examples](./examples) for loading and using Vime with:
@@ -114,8 +125,8 @@ There are also [examples](./examples) for loading and using Vime with:
114125

115126
## 🖥️ Browsers
116127

117-
Vime is forward thinking and built for the modern web. All
118-
[ES6 Compatible](https://caniuse.com/#feat=es6-module) browsers are supported, some of which are
128+
Vime is forward thinking and built for the modern web. All
129+
[ES6 Compatible](https://caniuse.com/#feat=es6-module) browsers are supported, some of which are
119130
listed below.
120131

121132
- Edge 79+
@@ -138,16 +149,16 @@ listed below.
138149

139150
Documentation can be found at [https://vimejs.com](https://vimejs.com).
140151

141-
*Looking for V1 docs? -> https://v1.vimejs.com*
152+
_Looking for V1 docs? -> https://v1.vimejs.com_
142153

143154
## 🙋 Support
144155

145-
Feel free to join our [Discord channel][discord] if you'd like help with anything related to Vime.
156+
Feel free to join our [Discord channel][discord] if you'd like help with anything related to Vime.
146157
Please remember to be respectful and patient as this is a community driven project.
147158

148159
## 🔨 Contributing
149160

150-
If you'd like to contribute and help in building a better media player for the web, then everything
161+
If you'd like to contribute and help in building a better media player for the web, then everything
151162
you need to get started can be found in the [Contributing Guide](./CONTRIBUTING.md).
152163

153164
## ❤️ Sponsors
@@ -179,4 +190,4 @@ A huge thanks to our sponsors who support open-source projects like Vime.
179190
[mdn-media-element]: https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement
180191
[youtube]: https://developers.google.com/youtube/iframe_api_reference
181192
[vimeo]: https://developer.vimeo.com/player/sdk
182-
[dailymotion]: https://developer.dailymotion.com/player
193+
[dailymotion]: https://developer.dailymotion.com/player

docs/README.md

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# @vime/docs
2+
3+
Vime is simply a collection of [web components](https://developer.mozilla.org/en-US/docs/Web/Web_Components)
4+
that help you easily build and customize your our own media player. This package contains the source
5+
code for the Vime documentation site hosted at https://vimejs.com. The website is built using
6+
[Docusaurus 2](https://v2.docusaurus.io/), a modern static website generator.
7+
8+
### Local Development
9+
10+
```bash
11+
$: npm install
12+
13+
$: npm run start
14+
```
15+
16+
This command starts a local development server and opens up a browser window. Most changes are
17+
reflected live without having to restart the server.
18+
19+
It's important to note that **`docs/components` is autogenerated** by `@vime/core`. If you'd like
20+
to update those docs run the following commands:
21+
22+
```bash
23+
$: cd ..
24+
25+
$: npm run setup
26+
27+
$: cd packages/core
28+
29+
# Update the docs inside `src/components` and then run:
30+
$: npm run build
31+
```

docs/babel.config.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
3+
};
+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
---
2+
title: vime-embed
3+
sidebar_label: Embed
4+
slug: api
5+
---
6+
7+
Embeds an external media player and enables interacting with it via `postMessage`.
8+
9+
## Example
10+
11+
```html
12+
<vime-embed
13+
embed-src="https://www.youtube-nocookie.com/embed/DyTCOwB0DVw"
14+
media-title="Agent 327: Operation Barbershop"
15+
origin="https://www.youtube-nocookie.com"
16+
/>
17+
18+
<script>
19+
const embed = document.querySelector("vime-embed");
20+
embed.params = { autoplay: 1, muted: 1, controls: 0 };
21+
embed.addEventListener("vEmbedMessage", (e) => {
22+
const message = e.detail;
23+
console.log(message);
24+
});
25+
</script>
26+
```
27+
28+
<!-- Auto Generated Below -->
29+
30+
## Properties
31+
32+
| Property | Attribute | Description | Type | Default |
33+
| ---------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------- | ----------- |
34+
| `decoder` | -- | A function which accepts the raw message received from the embedded media player via `postMessage` and converts it into a POJO. | `((data: string) => Record<string, any> ∣ undefined) ∣ undefined` | `undefined` |
35+
| `embedSrc` | `embed-src` | A URL that will load the external player and media (Eg: https://www.youtube.com/embed/DyTCOwB0DVw). | `string` | `''` |
36+
| `mediaTitle` | `media-title` | The title of the current media so it can be set on the inner `iframe` for screen readers. | `string` | `''` |
37+
| `origin` | `origin` | Where the src request had originated from without any path information. | `string ∣ undefined` | `undefined` |
38+
| `params` | -- | The parameters to pass to the embedded player. These are encoded as a query string and appended to the `embedSrc` prop. | `{ [x: string]: any; }` | `{}` |
39+
| `preconnections` | -- | A collection of URLs to that the browser should immediately start establishing a connection with. | `string[]` | `[]` |
40+
41+
## Events
42+
43+
| Event | Description | Type |
44+
| ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- |
45+
| `vEmbedLoaded` | Emitted when the embedded player and any new media has loaded. | `CustomEvent<void>` |
46+
| `vEmbedMessage` | Emitted when a new message is received from the embedded player via `postMessage`. | `CustomEvent<any>` |
47+
| `vEmbedSrcChange` | Emitted when the `embedSrc` or `params` props change. The payload contains the `params` serialized into a query string and appended to `embedSrc`. | `CustomEvent<string>` |
48+
49+
## Methods
50+
51+
### `postMessage(message: any, target?: string | undefined) => Promise<void>`
52+
53+
Posts a message to the embedded media player.
54+
55+
#### Returns
56+
57+
Type: `Promise<void>`
58+
59+
## Dependencies
60+
61+
### Used by
62+
63+
- [vime-dailymotion](../../providers/dailymotion/readme.md)
64+
- [vime-vimeo](../../providers/vimeo/readme.md)
65+
- [vime-youtube](../../providers/youtube/readme.md)
66+
67+
### Graph
68+
69+
```mermaid
70+
graph TD;
71+
vime-dailymotion --> vime-embed
72+
vime-vimeo --> vime-embed
73+
vime-youtube --> vime-embed
74+
style vime-embed fill:#f9f,stroke:#333,stroke-width:4px
75+
```
76+
77+
---
78+
79+
_Built with [StencilJS](https://stenciljs.com/)_

0 commit comments

Comments
 (0)