Skip to content

Commit

Permalink
feat: initial version
Browse files Browse the repository at this point in the history
  • Loading branch information
songkeys committed Jun 17, 2022
1 parent 2274ca9 commit a7a6b8b
Show file tree
Hide file tree
Showing 36 changed files with 100,950 additions and 1,034 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ typings/

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
Expand All @@ -102,3 +101,5 @@ dist

# TernJS port file
.tern-port

.DS_Store
44 changes: 22 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,40 +9,40 @@
[![Issues][issues-shield]][issues-url]
[![MIT License][license-shield]][license-url]

[npm-version]: https://img.shields.io/npm/v/node-lib-template.svg?style=for-the-badge
[npm-url]: https://www.npmjs.com/package/node-lib-template
[contributors-shield]: https://img.shields.io/github/contributors/Songkeys/node-lib-template.svg?style=for-the-badge
[contributors-url]: https://github.com/Songkeys/node-lib-template/graphs/contributors
[forks-shield]: https://img.shields.io/github/forks/Songkeys/node-lib-template.svg?style=for-the-badge
[forks-url]: https://github.com/Songkeys/node-lib-template/network/members
[stars-shield]: https://img.shields.io/github/stars/Songkeys/node-lib-template.svg?style=for-the-badge
[stars-url]: https://github.com/Songkeys/node-lib-template/stargazers
[issues-shield]: https://img.shields.io/github/issues/Songkeys/node-lib-template.svg?style=for-the-badge
[issues-url]: https://github.com/Songkeys/node-lib-template/issues
[license-shield]: https://img.shields.io/github/license/Songkeys/node-lib-template.svg?style=for-the-badge
[license-url]: https://github.com/Songkeys/node-lib-template/blob/master/LICENSE.txt
[npm-version]: https://img.shields.io/npm/v/uni-media.svg?style=for-the-badge
[npm-url]: https://www.npmjs.com/package/uni-media
[contributors-shield]: https://img.shields.io/github/contributors/Songkeys/uni-media.svg?style=for-the-badge
[contributors-url]: https://github.com/Songkeys/uni-media/graphs/contributors
[forks-shield]: https://img.shields.io/github/forks/Songkeys/uni-media.svg?style=for-the-badge
[forks-url]: https://github.com/Songkeys/uni-media/network/members
[stars-shield]: https://img.shields.io/github/stars/Songkeys/uni-media.svg?style=for-the-badge
[stars-url]: https://github.com/Songkeys/uni-media/stargazers
[issues-shield]: https://img.shields.io/github/issues/Songkeys/uni-media.svg?style=for-the-badge
[issues-url]: https://github.com/Songkeys/uni-media/issues
[license-shield]: https://img.shields.io/github/license/Songkeys/uni-media.svg?style=for-the-badge
[license-url]: https://github.com/Songkeys/uni-media/blob/master/LICENSE.txt

<!-- PROJECT LOGO -->

<br />
<div align="center">
<a href="https://github.com/Songkeys/node-lib-template">
<img src="images/logo.svg" alt="Logo" width="80" height="80">
<a href="https://github.com/Songkeys/uni-media">
<img src="/hero.png" alt="Logo" width="160" height="160">
</a>

<h2 align="center">Node.js-Library-Template</h2>
<h2 align="center">uni-media</h2>

<p align="center">
A Node.js TypeScript library starter template to jumpstart your projects!
Easily embed any types of media (images, videos, audios, pdfs, 3d-models...) in your web app
<br />
<a href="https://github.com/Songkeys/node-lib-template"><strong>Explore the docs »</strong></a>
<a href="https://github.com/Songkeys/uni-media"><strong>Explore the docs »</strong></a>
<br />
<br />
<a href="https://github.com/Songkeys/node-lib-template">View Demo</a>
<a href="https://github.com/Songkeys/uni-media">View Demo</a>
·
<a href="https://github.com/Songkeys/node-lib-template/issues">Report Bug</a>
<a href="https://github.com/Songkeys/uni-media/issues">Report Bug</a>
·
<a href="https://github.com/Songkeys/node-lib-template/issues">Request Feature</a>
<a href="https://github.com/Songkeys/uni-media/issues">Request Feature</a>
</p>
</div>

Expand All @@ -55,7 +55,7 @@ A Node.js TypeScript library starter template to jumpstart your projects!
## Getting Started

1. Use this template to create your own library.
2. Replace all `node-lib-template` in the code with your project's name.
2. Replace all `uni-media` in the code with your project's name.
3. Replace all `Songkeys` in the code with your GitHub username.

Features and acknowledgements:
Expand Down Expand Up @@ -85,7 +85,7 @@ _For more examples, please refer to the [Documentation](https://example.com)_
- [ ] Chinese
- [ ] Spanish

See the [open issues](https://github.com/Songkeys/node-lib-template/issues) for a full list of proposed features (and known issues).
See the [open issues](https://github.com/Songkeys/uni-media/issues) for a full list of proposed features (and known issues).

<p align="right">(<a href="#top">back to top</a>)</p>

Expand Down
5 changes: 5 additions & 0 deletions dev/files/a.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<html>
<body>
<h1>Hi, This is an example html page.</h1>
</body>
</html>
112 changes: 112 additions & 0 deletions dev/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
<!DOCTYPE html>

<html>
<head>
<meta charset="utf-8" />
<title>&lt;uni-media> Demo</title>
<script src="../node_modules/lit/polyfill-support.js"></script>
<script type="module" src="../dist/uni-media.global.js"></script>
</head>
<body>
<script>
function handleGetFiletype(e) {
console.log('getFiletype', e)
}
document.addEventListener('filetype', handleGetFiletype)
</script>
<h3>Image</h3>
<uni-media
alt="A cat"
title="I'm a cat"
src="https://placekitten.com/200/300"
>
<div slot="loading">Loading...</div>
</uni-media>

<h3>Video</h3>
<uni-media
src="ipfs://bafybeigg55zmqvfouox64ljpiqrt4lscacgcf77chmz4evgqlmicfk2rni/BigBuckBunny.mp4"
width="500"
height="350"
></uni-media>

<h3>Audio</h3>
<uni-media
src="https://raw.githubusercontent.com/Songkeys/oss/master/mac/13.01.mp3"
></uni-media>

<h3>GLB model</h3>
<uni-media
src="https://modelviewer.dev/shared-assets/models/NeilArmstrong.glb"
camera-controls
enable-pan
poster="https://modelviewer.dev/shared-assets/models/NeilArmstrong.webp"
seamless-poster
style="height: 300px; width: 300px"
onclick="console.log('clicked')"
></uni-media>

<h3>PDF</h3>
<uni-media
src="https://docs.rss3.io/assets/files/RSS3-Whitepaper-6fcdadb8afda04da7de5f48c0a1935c0.pdf"
></uni-media>

<h3>HTML</h3>
<uni-media src="./files/a.html"></uni-media>

<h3>Error</h3>
<uni-media src="https://404">
<div slot="loading">Loading...</div>
<!-- <div slot="error">Error occurs!</div> -->
</uni-media>

<h3>Use in React</h3>
<div id="react-root"></div>
<script
src="https://unpkg.com/react@18/umd/react.development.js"
crossorigin
></script>
<script
src="https://unpkg.com/react-dom@18/umd/react-dom.development.js"
crossorigin
></script>
<script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>
<script type="text/babel">
const domContainer = document.querySelector('#react-root')
const root = ReactDOM.createRoot(domContainer)
const ReactDemo = (
<div>
<div>This is rendered by React</div>
<uni-media
alt="A cat"
title="I'm a cat"
src="https://placekitten.com/200/300"
></uni-media>
</div>
)
root.render(ReactDemo)
</script>

<h3>Use in Vue</h3>
<script src="https://unpkg.com/vue@3"></script>
<div id="vue-root">
<div>{{ message }}</div>
<uni-media
alt="A cat"
title="I'm a cat"
src="https://placekitten.com/200/300"
></uni-media>
</div>
<script>
const VueDemo = {
data() {
return {
message: 'This is rendered by Vue',
}
},
}

Vue.createApp(VueDemo).mount('#vue-root')
</script>
</body>
</html>
Loading

0 comments on commit a7a6b8b

Please sign in to comment.