Skip to content

Commit 16ed2bb

Browse files
committed
add astro-rainbow-line package
1 parent d026d74 commit 16ed2bb

10 files changed

Lines changed: 170 additions & 3 deletions

File tree

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@ $ pnpm cbt # => clean build test
2929

3030
| package | description |
3131
|-|-|
32-
| [`offscreen-display`](packages/offscreen-display/) | Helpers for creating custom offscreen canvas elements |
33-
| [`rainbow-line`](packages/rainbow-line/) | A custom element that displays a cut line animated with rainbow colors |
32+
| [`offscreen-display`](packages/offscreen-display/) | helpers for creating custom offscreen canvas elements |
33+
| [`rainbow-line`](packages/rainbow-line/) | a web component that displays a cut line animated with rainbow colors |
34+
| [`@spearwolf/astro-rainbow-line`](packages/astro-rainbow-line/) | astro wrapper for the rainbow-line web component |
3435

3536
‼️ [for those interested in the shadow-ents-* packages, we are happy to announce that they have now been relocated to their own dedicated monorepo, "shadow-objects"](https://github.com/spearwolf/shadow-objects)
3637

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
rainbow-line-v0.2.1.js
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
.eslintignore
3+
project.json
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# @spearwolf/astro-rainbow-line
2+
3+
An astro wrapper for the [rainbow-line web component](https://github.com/spearwolf/visual-fx-web-components/tree/main/packages/rainbow-line).
4+
5+
> It is currently assumed that the [rainbow-line.js](./rainbow-line-v0.2.1.js) is located under `${import.meta.env.BASE_URL}/js/rainbow-line-v0.2.1.js`.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
interface Props {
3+
shadow?: boolean;
4+
colorSliceWidth?: number;
5+
sliceCycleTime?: number;
6+
cycleDirection?: 'left' | 'right';
7+
}
8+
9+
const {shadow = false, colorSliceWidth = 10, sliceCycleTime = 7, cycleDirection = 'right'} = Astro.props;
10+
---
11+
12+
<rainbow-line
13+
class="rainbow"
14+
color-slice-width={colorSliceWidth}
15+
slice-cycle-time={sliceCycleTime}
16+
cycle-direction={cycleDirection}></rainbow-line>
17+
{
18+
shadow && (
19+
<rainbow-line
20+
class="rainbow-shadow"
21+
color-slice-width={colorSliceWidth}
22+
slice-cycle-time={sliceCycleTime}
23+
cycle-direction={cycleDirection}
24+
/>
25+
)
26+
}
27+
28+
<script is:inline async type="module" src={`${import.meta.env.BASE_URL}/js/rainbow-line-v0.2.1.js`}></script>
29+
30+
<style>
31+
.rainbow {
32+
height: var(--rainbow-line-height, 4px);
33+
}
34+
.rainbow-shadow {
35+
--height: var(--rainbow-shadow-height, 12px);
36+
height: var(--height);
37+
opacity: var(--rainbow-shadow-opacity, 0.4);
38+
filter: blur(var(--height));
39+
}
40+
</style>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"name": "@spearwolf/astro-rainbow-line",
3+
"description": "astro wrapper for the rainbow-line web component",
4+
"version": "1.0.0",
5+
"main": "RainbowLine.astro",
6+
"author": {
7+
"name": "Wolfger Schramm",
8+
"email": "wolfger@spearwolf.de",
9+
"url": "https://www.spearwolf.de"
10+
},
11+
"license": "Apache-2.0",
12+
"homepage": "https://github.com/spearwolf/visual-fx-web-components",
13+
"scripts": {
14+
"publishNpmPkg": "pnpm node ../../scripts/publishNpmPkg.mjs ."
15+
}
16+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"name": "astro-rainbow-line",
3+
"$schema": "../../node_modules/nx/schemas/project-schema.json",
4+
"root": "packages/astro-rainbow-line",
5+
"sourceRoot": "{projectRoot}",
6+
"projectType": "library",
7+
"tags": []
8+
}

packages/astro-rainbow-line/rainbow-line-v0.2.1.js

Lines changed: 90 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pnpm-lock.yaml

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/publishNpmPkg.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ exec(`npm show ${pkgJson.name} versions --json`, (error, stdout, stderr) => {
3737
} else {
3838
publishPackage();
3939
}
40-
} else if (stderr && stderr.toString().includes('npm ERR! code E404')) {
40+
} else if (stderr && stderr.toString().includes('E404')) {
41+
// => npm ERR! code E404
4142
console.log('oh it looks like this is the first time to publish the package');
4243
publishPackage();
4344
} else {

0 commit comments

Comments
 (0)