Skip to content

Commit

Permalink
Merge pull request #38 from tomhazledine/buffering
Browse files Browse the repository at this point in the history
Buffering
  • Loading branch information
tomhazledine authored Feb 15, 2024
2 parents 60fac10 + 3264c99 commit 2039e45
Show file tree
Hide file tree
Showing 23 changed files with 274 additions and 91 deletions.
Binary file added demo/audio-examples/long-audio-example.mp3
Binary file not shown.
12 changes: 11 additions & 1 deletion demo/build.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import * as esbuild from "esbuild";
import { parseArgs, watchFiles } from "../build.utils.js";

import _package from "../package.json" assert { type: "json" };
const version = _package.version;

const args = parseArgs(process.argv);

const config = {
Expand All @@ -9,7 +12,14 @@ const config = {
minify: args.mode !== "development",
treeShaking: args.mode !== "development",
sourcemap: args.mode === "development",
entryPoints: ["demo/index.js", "demo/composable.js", "demo/types.js"],
entryPoints: [
"demo/index.js",
"demo/composable.js",
"demo/types.js",
"build/picobel-component.js",
"build/picobel.all.css",
{ out: `manual`, in: `build/picobel.${version}.js` }
],
entryNames: "picobel-demo-[name]"
};

Expand Down
7 changes: 0 additions & 7 deletions demo/component-default.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,6 @@
<head>
<meta charset="UTF-8" />
<title>Picobel.js Test Page</title>

<!-- Load the Picobel CSS -->
<link
rel="stylesheet"
href="../src/css/picobel.all.css"
type="text/css"
/>
</head>
<body style="font-family: sans-serif">
<nav>
Expand Down
4 changes: 2 additions & 2 deletions demo/component.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<!-- Load the Picobel CSS -->
<link
rel="stylesheet"
href="../src/css/picobel.all.css"
href="./build/picobel-demo-picobel.all.css"
type="text/css"
/>
</head>
Expand Down Expand Up @@ -81,7 +81,7 @@ <h2>

<script
type="text/javascript"
src="../build/picobel-component.js"
src="./build/picobel-demo-picobel-component.js"
></script>
</body>
</html>
2 changes: 1 addition & 1 deletion demo/composable.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<!-- Load the Picobel CSS -->
<link
rel="stylesheet"
href="../src/css/picobel.all.css"
href="./build/picobel-demo-picobel.all.css"
type="text/css"
/>
</head>
Expand Down
11 changes: 9 additions & 2 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<!-- Load the Picobel CSS -->
<link
rel="stylesheet"
href="../src/css/picobel.all.css"
href="./build/picobel-demo-picobel.all.css"
type="text/css"
/>
</head>
Expand Down Expand Up @@ -50,6 +50,11 @@ <h1>Some stuff...</h1>
<source src="./audio-examples/taken-at-the-flood.mp3" />
Your browser does not support the <code>audio</code> element.
</audio>

<audio controls preload="auto">
<source src="./audio-examples/long-audio-example.mp3" />
Your browser does not support the <code>audio</code> element.
</audio>
</div>

<p>
Expand All @@ -59,9 +64,11 @@ <h1>Some stuff...</h1>
natus earum nisi ducimus.
</p>

<h2>With an "unfound" source URL</h2>

<audio
class="testClass--one testClass--two"
src="http://audio.eatenbymonsters.com/reviews/coldWarKids/lostThatEasy.mp3"
src="./audio-examples/missing.mp3"
controls
>
Your browser does not support the <code>audio</code> element.
Expand Down
3 changes: 2 additions & 1 deletion demo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import picobel from "../build/picobel.js";
// Picobel();
// Picobel({ theme: "bare" });
// Picobel({ theme: "default" });
const audio = picobel({ theme: "itunes" });
// const audio = picobel({ theme: "itunes" });
const audio = picobel({ theme: "skeleton" });
// Picobel({ theme: "bbc" });
// Picobel({ theme: "eatenbymonsters" });
// Picobel({ theme: "itunes" });
Expand Down
7 changes: 5 additions & 2 deletions demo/manual.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<!-- Load the Picobel CSS -->
<link
rel="stylesheet"
href="../src/css/picobel.all.css"
href="./build/picobel-demo-picobel.all.css"
type="text/css"
/>
</head>
Expand Down Expand Up @@ -68,7 +68,10 @@ <h1>Some stuff...</h1>
</audio>

<!-- Load Scripts -->
<script type="text/javascript" src="../build/picobel.3.0.3.js"></script>
<script
type="text/javascript"
src="./build/picobel-demo-manual.js"
></script>
<script>
const picobelInstance = picobel();
console.log({ picobelInstance });
Expand Down
5 changes: 4 additions & 1 deletion demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@
"name": "picobel-demo",
"version": "1.0.0",
"description": "Demo page for Picobel",
"type": "module"
"type": "module",
"devDependencies": {
"node-static": "^0.7.11"
}
}
34 changes: 34 additions & 0 deletions demo/server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import http from "http";
import path from "path";
import readline from "readline";

import { Server } from "node-static";

export const server = (buildPath, port) => {
const file = new Server(buildPath);

http.createServer(function (request, response) {
request
.addListener("end", function () {
// Serve files!
file.serve(request, response);
})
.resume();
}).listen(port);
};

const PORT = 8080;
const OUT = path.resolve(".", `./demo/`);
console.log(OUT);
console.log(`Serving result at http://localhost:${PORT}/`);
server(OUT, PORT);

console.log(`Press "q" to exit`);
readline.emitKeypressEvents(process.stdin);
process.stdin.setRawMode(true);

process.stdin.on("keypress", (str, key) => {
if (key.name === "q") {
process.exit();
}
});
40 changes: 40 additions & 0 deletions demo/yarn.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1


colors@>=0.6.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/colors/-/colors-1.4.0.tgz#c50491479d4c1bdaed2c9ced32cf7c7dc2360f78"
integrity sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==

mime@^1.2.9:
version "1.6.0"
resolved "https://registry.yarnpkg.com/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1"
integrity sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==

minimist@~0.0.1:
version "0.0.10"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.10.tgz#de3f98543dbf96082be48ad1a0c7cda836301dcf"
integrity sha512-iotkTvxc+TwOm5Ieim8VnSNvCDjCK9S8G3scJ50ZthspSxa7jx50jkhYduuAtAjvfDUwSgOwf8+If99AlOEhyw==

node-static@^0.7.11:
version "0.7.11"
resolved "https://registry.yarnpkg.com/node-static/-/node-static-0.7.11.tgz#60120d349f3cef533e4e820670057eb631882e7f"
integrity sha512-zfWC/gICcqb74D9ndyvxZWaI1jzcoHmf4UTHWQchBNuNMxdBLJMDiUgZ1tjGLEIe/BMhj2DxKD8HOuc2062pDQ==
dependencies:
colors ">=0.6.0"
mime "^1.2.9"
optimist ">=0.3.4"

optimist@>=0.3.4:
version "0.6.1"
resolved "https://registry.yarnpkg.com/optimist/-/optimist-0.6.1.tgz#da3ea74686fa21a19a111c326e90eb15a0196686"
integrity sha512-snN4O4TkigujZphWLN0E//nQmm7790RYaE53DdL7ZYwee2D8DDo9/EyYiKUfN3rneWUjhJnueija3G9I2i0h3g==
dependencies:
minimist "~0.0.1"
wordwrap "~0.0.2"

wordwrap@~0.0.2:
version "0.0.3"
resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.3.tgz#a3d5da6cd5c0bc0008d37234bbaf1bed63059107"
integrity sha512-1tMA907+V4QmxV7dbRvb4/8MaRALK6q9Abid3ndMYnbyo8piisCmeONVqVSXqQA3KaP4SLt5b7ud6E2sqP8TFw==
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"build:dev": "node build.js --mode=development",
"build:demo": "node build.js && node demo/build.js",
"build:demo:dev": "node build.js --mode=development && node demo/build.js --mode=development",
"demo:serve": "node ./demo/server",
"prepublish": "npm run build",
"prepublishOnly": "npm run build"
},
Expand Down
4 changes: 2 additions & 2 deletions src/css/picobel.bbc.css
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
background-size: 2em 2em;
background-repeat: repeat;
background-position: 0 0;
animation: background_slide linear infinite 0.4s;
animation: bbc_background_slide linear infinite 0.4s;
}
.bbc.picobel .bbc__loader:after {
content: "Loading";
Expand Down Expand Up @@ -622,7 +622,7 @@
}

/* Simulates an infinite slide-to-the-right effect. */
@keyframes background_slide {
@keyframes bbc_background_slide {
0% {
background-position: 0 0;
}
Expand Down
4 changes: 2 additions & 2 deletions src/css/picobel.default.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
}

/* Simulates an infinite slide-to-the-right effect. */
@keyframes background_slide {
@keyframes default_background_slide {
0% {
background-position: 0 0;
}
Expand Down Expand Up @@ -74,7 +74,7 @@
background-size: var(--progress-bar-height) var(--progress-bar-height);
background-repeat: repeat;
background-position: 0 0;
animation: background_slide linear infinite 0.4s;
animation: default_background_slide linear infinite 0.4s;
}

/* Only show the loader when we're loading */
Expand Down
4 changes: 2 additions & 2 deletions src/css/picobel.eatenbymonsters.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
}

/* Simulates an infinite slide-to-the-right effect. */
@keyframes background_slide {
@keyframes ebm_background_slide {
0% {
background-position: 0 0;
}
Expand Down Expand Up @@ -51,7 +51,7 @@
background-size: 2em 2em;
background-repeat: repeat;
background-position: 0 0;
animation: background_slide linear infinite 0.4s;
animation: ebm_background_slide linear infinite 0.4s;
}

/* Only show the loader when we're loading */
Expand Down
4 changes: 2 additions & 2 deletions src/css/picobel.pitchfork.css
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
background-size: 2em 2em;
background-repeat: repeat;
background-position: 0 0;
animation: background_slide linear infinite 0.3s;
animation: pitchfork_background_slide linear infinite 0.3s;
}
.pitchfork.picobel.loading .loader {
display: block;
Expand Down Expand Up @@ -237,7 +237,7 @@
}

/* Simulates an infinite slide-to-the-right effect. */
@keyframes background_slide {
@keyframes pitchfork_background_slide {
0% {
background-position: 0 0;
}
Expand Down
Loading

0 comments on commit 2039e45

Please sign in to comment.