proto-player-wc 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +58 -0
- package/dist/cjs/app-globals-3a1e7e63.js +5 -0
- package/dist/cjs/index-b288947a.js +1332 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/loader.cjs.js +15 -0
- package/dist/cjs/proto-activator_2.cjs.entry.js +149 -0
- package/dist/cjs/proto-player-wc.cjs.js +25 -0
- package/dist/collection/collection-manifest.json +13 -0
- package/dist/collection/components/proto-activator/proto-360.js +10 -0
- package/dist/collection/components/proto-activator/proto-activator.css +49 -0
- package/dist/collection/components/proto-activator/proto-activator.js +92 -0
- package/dist/collection/components/proto-player/proto-player.css +46 -0
- package/dist/collection/components/proto-player/proto-player.js +170 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/utils/index.js +1 -0
- package/dist/collection/utils/types.js +1 -0
- package/dist/components/index.d.ts +33 -0
- package/dist/components/index.js +1 -0
- package/dist/components/proto-activator.d.ts +11 -0
- package/dist/components/proto-activator.js +56 -0
- package/dist/components/proto-player.d.ts +11 -0
- package/dist/components/proto-player.js +139 -0
- package/dist/esm/app-globals-0f993ce5.js +3 -0
- package/dist/esm/index-a01c1d3b.js +1306 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader.js +11 -0
- package/dist/esm/proto-activator_2.entry.js +144 -0
- package/dist/esm/proto-player-wc.js +20 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/proto-player-wc/index.esm.js +0 -0
- package/dist/proto-player-wc/p-873a05d2.entry.js +1 -0
- package/dist/proto-player-wc/p-8817443a.js +2 -0
- package/dist/proto-player-wc/p-e1255160.js +1 -0
- package/dist/proto-player-wc/proto-player-wc.esm.js +1 -0
- package/dist/types/components/proto-activator/proto-360.d.ts +5 -0
- package/dist/types/components/proto-activator/proto-activator.d.ts +8 -0
- package/dist/types/components/proto-player/proto-player.d.ts +24 -0
- package/dist/types/components.d.ts +60 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/stencil-public-runtime.d.ts +1680 -0
- package/dist/types/utils/index.d.ts +1 -0
- package/dist/types/utils/types.d.ts +8 -0
- package/loader/cdn.js +1 -0
- package/loader/index.cjs.js +1 -0
- package/loader/index.d.ts +24 -0
- package/loader/index.es2017.js +1 -0
- package/loader/index.js +2 -0
- package/loader/package.json +11 -0
- package/package.json +41 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Richard Hess
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# proto-player-wc
|
|
2
|
+
|
|
3
|
+
a technology POC...
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
## usage
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
yarn install
|
|
11
|
+
yarn demo
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## features
|
|
15
|
+
|
|
16
|
+
- stencil based web component
|
|
17
|
+
- uses mitt for an eventbus
|
|
18
|
+
- a single player component (on the root page)
|
|
19
|
+
- many activator components (can be floating elements)
|
|
20
|
+
- activators use the eventbus to communicate to the player
|
|
21
|
+
- player has an overlay and iframe
|
|
22
|
+
- player uses postMessage to communicate to/from iframe
|
|
23
|
+
- uses a `resize-iframe` message to pass size back to the player web component
|
|
24
|
+
|
|
25
|
+
## architecture
|
|
26
|
+
|
|
27
|
+
The architecture for this is a decoupled (ie. loosely-coupled) one, where there's a single player component (on the root page) and potentially many activator components on a page. A simple event bus is used to tie everything together and the only connector is `activate` events which the player component listens for. This means it's also possible to create and emit these `activate` events directly from code on the page, even if you choose not to use the activator web components.
|
|
28
|
+
|
|
29
|
+
This approach allows for the activator web components to be placed anywhere on the page (simple or floating elements). The only real coupling is the event bus `name`, which you pass to all of the individual web components on the page. This allows for the integrator (ie. consuming application) to define the name used for the event bus on the `window` object.
|
|
30
|
+
|
|
31
|
+
The player component lives on the root of the page and is essentially an invisible element (0x0) on that page. It provides a simple overly and a psuedo modal which displays the actual player within it. The toplevel wrapper in this modal is an iframe which gives us the ability to isolate ALL of the idiosyncrasies of the actual player from the composing application.
|
|
32
|
+
|
|
33
|
+
We recommend using [mitt][mitt-io] for the event bus because of both it's simplicity and size (only 200 bytes).
|
|
34
|
+
|
|
35
|
+
## integration
|
|
36
|
+
|
|
37
|
+
At a minimum, an integrator would need to add the following to their page:
|
|
38
|
+
|
|
39
|
+
1. create an event bus using [mitt][mitt-io]
|
|
40
|
+
2. store this event bus on the `window` object with a `name`
|
|
41
|
+
3. add the `proto-player` web component to the base page
|
|
42
|
+
4. add one or more `proto-activator` web components on this same page
|
|
43
|
+
5. pass the `name` of the event bus to all of these web components, using attributes
|
|
44
|
+
6. Done, it just works...
|
|
45
|
+
|
|
46
|
+
## articles
|
|
47
|
+
|
|
48
|
+
- [The ultimate guide to iframes][u-iframes] - _LogRocket_
|
|
49
|
+
|
|
50
|
+
## references
|
|
51
|
+
|
|
52
|
+
- [mitt][mitt-io] - _tiny 200 byte functional event emitter / pubsub._
|
|
53
|
+
|
|
54
|
+
[float-ui]: https://github.com/floating-ui/floating-ui
|
|
55
|
+
[mitt-io]: https://github.com/developit/mitt
|
|
56
|
+
[nano-id]: https://github.com/ai/nanoid
|
|
57
|
+
[nano-uuid]: https://blog.bitsrc.io/why-is-nanoid-replacing-uuid-1b5100e62ed2
|
|
58
|
+
[u-iframes]: https://blog.logrocket.com/the-ultimate-guide-to-iframes/
|