@substrate-system/blur-hash 0.0.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 +20 -0
- package/README.example.md +84 -0
- package/README.md +112 -0
- package/dist/index.cjs +81 -0
- package/dist/index.cjs.map +7 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +62 -0
- package/dist/index.js.map +7 -0
- package/dist/index.min.js +16 -0
- package/dist/index.min.js.map +7 -0
- package/dist/meta.json +41 -0
- package/dist/style.css +33 -0
- package/dist/style.min.css +2 -0
- package/package.json +98 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
THE MIT LICENSE (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright © 2024 Nick Thomas <nichoth@nichoth.com>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
6
|
+
this software and associated documentation files (the “Software”), to deal in
|
|
7
|
+
the Software without restriction, including without limitation the rights to
|
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
10
|
+
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, FITNESS
|
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# package name here
|
|
2
|
+

|
|
3
|
+
[](README.md)
|
|
4
|
+
[](README.md)
|
|
5
|
+
[](https://semver.org/)
|
|
6
|
+
[](package.json)
|
|
7
|
+
[](LICENSE)
|
|
8
|
+
|
|
9
|
+
`<package description goes here>`
|
|
10
|
+
|
|
11
|
+
[See a live demo](https://namespace.github.io/package-name/)
|
|
12
|
+
|
|
13
|
+
## install
|
|
14
|
+
|
|
15
|
+
Installation instructions
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
npm i -S @namespace/package
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## API
|
|
22
|
+
|
|
23
|
+
This exposes ESM and common JS via [package.json `exports` field](https://nodejs.org/api/packages.html#exports).
|
|
24
|
+
|
|
25
|
+
### ESM
|
|
26
|
+
```js
|
|
27
|
+
import '@namespace/package/module'
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Common JS
|
|
31
|
+
```js
|
|
32
|
+
require('@namespace/package/module')
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## CSS
|
|
36
|
+
|
|
37
|
+
### Import CSS
|
|
38
|
+
|
|
39
|
+
```js
|
|
40
|
+
import '@namespace/package-name/css'
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Or minified:
|
|
44
|
+
```js
|
|
45
|
+
import '@namespace/package-name/css/min'
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Customize CSS via some variables
|
|
49
|
+
|
|
50
|
+
```css
|
|
51
|
+
component-name {
|
|
52
|
+
--example: pink;
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## use
|
|
57
|
+
This calls the global function `customElements.define`. Just import, then use
|
|
58
|
+
the tag in your HTML.
|
|
59
|
+
|
|
60
|
+
### JS
|
|
61
|
+
```js
|
|
62
|
+
import '@namespace/package/module'
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### HTML
|
|
66
|
+
```html
|
|
67
|
+
<div>
|
|
68
|
+
<example-component></example-component>
|
|
69
|
+
</div>
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### pre-built JS
|
|
73
|
+
This package exposes minified JS files too. Copy them to a location that is
|
|
74
|
+
accessible to your web server, then link to them in HTML.
|
|
75
|
+
|
|
76
|
+
#### copy
|
|
77
|
+
```sh
|
|
78
|
+
cp ./node_modules/@namespace/package/dist/module.min.js ./public
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
#### HTML
|
|
82
|
+
```html
|
|
83
|
+
<script type="module" src="./module.min.js"></script>
|
|
84
|
+
```
|
package/README.md
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# blur hash
|
|
2
|
+

|
|
3
|
+
[](README.md)
|
|
4
|
+
[](README.md)
|
|
5
|
+
[](https://semver.org/)
|
|
6
|
+
[](package.json)
|
|
7
|
+
[](LICENSE)
|
|
8
|
+
|
|
9
|
+
This is the ["blur-up" image loading technique](https://css-tricks.com/the-blur-up-technique-for-loading-background-images/), with the [blur-hash algorithm](https://blurha.sh/), as a [web component](https://developer.mozilla.org/en-US/docs/Web/API/Web_components).
|
|
10
|
+
|
|
11
|
+
[See a live demonstration](https://substrate-system.github.io/blur-hash/)
|
|
12
|
+
|
|
13
|
+
> [!TIP]
|
|
14
|
+
> Throttle the internet speed with the dev tools.
|
|
15
|
+
|
|
16
|
+
## install
|
|
17
|
+
|
|
18
|
+
```sh
|
|
19
|
+
npm i -S @substrate-system/blur-hash
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## API
|
|
23
|
+
|
|
24
|
+
This exposes ESM and common JS via [package.json `exports` field](https://nodejs.org/api/packages.html#exports).
|
|
25
|
+
|
|
26
|
+
### ESM
|
|
27
|
+
```js
|
|
28
|
+
import '@substrate-system/blur-hash'
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Common JS
|
|
32
|
+
```js
|
|
33
|
+
require('@substrate-system/blur-hash')
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## CSS
|
|
37
|
+
|
|
38
|
+
### Import CSS
|
|
39
|
+
|
|
40
|
+
```js
|
|
41
|
+
import '@substrate-system/blur-hash/css'
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Or minified:
|
|
45
|
+
```js
|
|
46
|
+
import '@substrate-system/blur-hash/css/min'
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## use
|
|
50
|
+
This calls the global function `customElements.define`. Just import, then use
|
|
51
|
+
the tag in your HTML.
|
|
52
|
+
|
|
53
|
+
### JS
|
|
54
|
+
```js
|
|
55
|
+
import '@substrate-system/blur-hash'
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### HTML
|
|
59
|
+
```html
|
|
60
|
+
<div>
|
|
61
|
+
<blur-hash
|
|
62
|
+
time="0.6s"
|
|
63
|
+
placeholder="LEHV6nWB2yk8pyo0adR*.7kCMdnj"
|
|
64
|
+
src="..."
|
|
65
|
+
width=100
|
|
66
|
+
height=100
|
|
67
|
+
>
|
|
68
|
+
</blur-hash>
|
|
69
|
+
</div>
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### attributes
|
|
73
|
+
Takes the following attributes
|
|
74
|
+
|
|
75
|
+
#### time
|
|
76
|
+
The time for css transitions and animation. This is set as a CSS variable.
|
|
77
|
+
|
|
78
|
+
#### placeholder
|
|
79
|
+
The string created by the blurhash algorithm. See [node example](#create-the-string).
|
|
80
|
+
|
|
81
|
+
#### width & height
|
|
82
|
+
The dimensions of the image
|
|
83
|
+
|
|
84
|
+
## pre-built JS
|
|
85
|
+
This package exposes minified JS files too. Copy them to a location that is
|
|
86
|
+
accessible to your web server, then link to them in HTML.
|
|
87
|
+
|
|
88
|
+
### copy
|
|
89
|
+
```sh
|
|
90
|
+
cp ./node_modules/@substrate-system/blur-hash/dist/blur-hash.min.js ./public
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### HTML
|
|
94
|
+
```html
|
|
95
|
+
<script type="module" src="./blur-hash.min.js"></script>
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Create the string
|
|
99
|
+
This package includes a CLI tool to create the placeholder string. After installing this as a dependency,
|
|
100
|
+
|
|
101
|
+
```sh
|
|
102
|
+
npx blur ./my-file.jpg
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Will print a string to stdout that can be used as a placeholder attribute.
|
|
106
|
+
|
|
107
|
+
### Print to system clipboard
|
|
108
|
+
On mac os,
|
|
109
|
+
|
|
110
|
+
```sh
|
|
111
|
+
npx blur ./my-file.jpg | pbcopy
|
|
112
|
+
```
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
var src_exports = {};
|
|
21
|
+
__export(src_exports, {
|
|
22
|
+
BlurHash: () => BlurHash
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(src_exports);
|
|
25
|
+
var import_blurhash = require("blurhash");
|
|
26
|
+
var import_debug = require("@bicycle-codes/debug");
|
|
27
|
+
const debug = (0, import_debug.createDebug)();
|
|
28
|
+
class BlurHash extends HTMLElement {
|
|
29
|
+
static {
|
|
30
|
+
__name(this, "BlurHash");
|
|
31
|
+
}
|
|
32
|
+
constructor() {
|
|
33
|
+
super();
|
|
34
|
+
const srcset = this.getAttribute("srcset");
|
|
35
|
+
const placeholder = this.getAttribute("placeholder");
|
|
36
|
+
if (!placeholder) throw new Error("not placeholder");
|
|
37
|
+
document.body.style.setProperty(
|
|
38
|
+
"--blur-hash-time",
|
|
39
|
+
this.getAttribute("time") || "0.6s"
|
|
40
|
+
);
|
|
41
|
+
this.innerHTML = `<canvas
|
|
42
|
+
class="blurry"
|
|
43
|
+
width=${this.getAttribute("width")}
|
|
44
|
+
height=${this.getAttribute("height")}
|
|
45
|
+
></canvas>
|
|
46
|
+
<img class="blurry"
|
|
47
|
+
${srcset ? `srcset="${srcset}"` : ""}
|
|
48
|
+
alt="${this.getAttribute("alt")}"
|
|
49
|
+
content-visibility="${this.getAttribute("content-visibility") || "auto"}"
|
|
50
|
+
decoding="${this.getAttribute("decoding") || "async"}"
|
|
51
|
+
loading="${this.getAttribute("loading") || "lazy"}"
|
|
52
|
+
class="image-element blurry"
|
|
53
|
+
src="${this.getAttribute("src")}"
|
|
54
|
+
/>
|
|
55
|
+
`;
|
|
56
|
+
}
|
|
57
|
+
connectedCallback() {
|
|
58
|
+
const width = parseInt(this.getAttribute("width") ?? "");
|
|
59
|
+
const height = parseInt(this.getAttribute("height") ?? "");
|
|
60
|
+
const placeholder = this.getAttribute("placeholder");
|
|
61
|
+
if (!placeholder || !width || !height) {
|
|
62
|
+
throw new Error("Missing attributes");
|
|
63
|
+
}
|
|
64
|
+
const pixels = (0, import_blurhash.decode)(placeholder, width, height);
|
|
65
|
+
const canvas = this.querySelector("canvas");
|
|
66
|
+
const ctx = canvas.getContext("2d");
|
|
67
|
+
const imageData = ctx.createImageData(width, height);
|
|
68
|
+
imageData.data.set(pixels);
|
|
69
|
+
ctx.putImageData(imageData, 0, 0);
|
|
70
|
+
const img = this.querySelector("img");
|
|
71
|
+
img.addEventListener("load", () => {
|
|
72
|
+
debug("loaded");
|
|
73
|
+
canvas.style.display = "none";
|
|
74
|
+
img.classList.remove("blurry");
|
|
75
|
+
img.classList.add("sharp");
|
|
76
|
+
});
|
|
77
|
+
debug("the image", img);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
customElements.define("blur-hash", BlurHash);
|
|
81
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/index.ts"],
|
|
4
|
+
"sourcesContent": ["import { decode } from 'blurhash'\nimport { createDebug } from '@bicycle-codes/debug'\nconst debug = createDebug()\n\n// for docuement.querySelector\ndeclare global {\n interface HTMLElementTagNameMap {\n 'blur-hash': BlurHash\n }\n}\n\nexport class BlurHash extends HTMLElement {\n constructor () {\n super()\n const srcset = this.getAttribute('srcset')\n const placeholder = this.getAttribute('placeholder')\n if (!placeholder) throw new Error('not placeholder')\n\n document.body.style.setProperty('--blur-hash-time',\n this.getAttribute('time') || '0.6s')\n\n this.innerHTML = `<canvas\n class=\"blurry\"\n width=${this.getAttribute('width')}\n height=${this.getAttribute('height')}\n ></canvas>\n <img class=\"blurry\"\n ${srcset ? `srcset=\"${srcset}\"` : ''}\n alt=\"${this.getAttribute('alt')}\"\n content-visibility=\"${this.getAttribute('content-visibility') || 'auto'}\"\n decoding=\"${this.getAttribute('decoding') || 'async'}\"\n loading=\"${this.getAttribute('loading') || 'lazy'}\"\n class=\"image-element blurry\"\n src=\"${this.getAttribute('src')}\"\n />\n `\n }\n\n connectedCallback () {\n const width = parseInt(this.getAttribute('width') ?? '')\n const height = parseInt(this.getAttribute('height') ?? '')\n const placeholder = this.getAttribute('placeholder')\n if (!placeholder || !width || !height) {\n throw new Error('Missing attributes')\n }\n\n const pixels = decode(placeholder, width, height)\n const canvas = this.querySelector('canvas') as HTMLCanvasElement\n const ctx = canvas.getContext('2d')!\n const imageData = ctx.createImageData(width, height)\n imageData.data.set(pixels)\n ctx.putImageData(imageData, 0, 0)\n\n const img = this.querySelector('img')!\n\n img.addEventListener('load', () => {\n debug('loaded')\n canvas.style.display = 'none'\n img.classList.remove('blurry')\n img.classList.add('sharp')\n })\n\n debug('the image', img)\n }\n}\n\ncustomElements.define('blur-hash', BlurHash)\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAuB;AACvB,mBAA4B;AAC5B,MAAM,YAAQ,0BAAY;AASnB,MAAM,iBAAiB,YAAY;AAAA,EAX1C,OAW0C;AAAA;AAAA;AAAA,EACtC,cAAe;AACX,UAAM;AACN,UAAM,SAAS,KAAK,aAAa,QAAQ;AACzC,UAAM,cAAc,KAAK,aAAa,aAAa;AACnD,QAAI,CAAC,YAAa,OAAM,IAAI,MAAM,iBAAiB;AAEnD,aAAS,KAAK,MAAM;AAAA,MAAY;AAAA,MAC5B,KAAK,aAAa,MAAM,KAAK;AAAA,IAAM;AAEvC,SAAK,YAAY;AAAA;AAAA,oBAEL,KAAK,aAAa,OAAO,CAAC;AAAA,qBACzB,KAAK,aAAa,QAAQ,CAAC;AAAA;AAAA;AAAA,cAGlC,SAAS,WAAW,MAAM,MAAM,EAAE;AAAA,mBAC7B,KAAK,aAAa,KAAK,CAAC;AAAA,kCACT,KAAK,aAAa,oBAAoB,KAAK,MAAM;AAAA,wBAC3D,KAAK,aAAa,UAAU,KAAK,OAAO;AAAA,uBACzC,KAAK,aAAa,SAAS,KAAK,MAAM;AAAA;AAAA,mBAE1C,KAAK,aAAa,KAAK,CAAC;AAAA;AAAA;AAAA,EAGvC;AAAA,EAEA,oBAAqB;AACjB,UAAM,QAAQ,SAAS,KAAK,aAAa,OAAO,KAAK,EAAE;AACvD,UAAM,SAAS,SAAS,KAAK,aAAa,QAAQ,KAAK,EAAE;AACzD,UAAM,cAAc,KAAK,aAAa,aAAa;AACnD,QAAI,CAAC,eAAe,CAAC,SAAS,CAAC,QAAQ;AACnC,YAAM,IAAI,MAAM,oBAAoB;AAAA,IACxC;AAEA,UAAM,aAAS,wBAAO,aAAa,OAAO,MAAM;AAChD,UAAM,SAAS,KAAK,cAAc,QAAQ;AAC1C,UAAM,MAAM,OAAO,WAAW,IAAI;AAClC,UAAM,YAAY,IAAI,gBAAgB,OAAO,MAAM;AACnD,cAAU,KAAK,IAAI,MAAM;AACzB,QAAI,aAAa,WAAW,GAAG,CAAC;AAEhC,UAAM,MAAM,KAAK,cAAc,KAAK;AAEpC,QAAI,iBAAiB,QAAQ,MAAM;AAC/B,YAAM,QAAQ;AACd,aAAO,MAAM,UAAU;AACvB,UAAI,UAAU,OAAO,QAAQ;AAC7B,UAAI,UAAU,IAAI,OAAO;AAAA,IAC7B,CAAC;AAED,UAAM,aAAa,GAAG;AAAA,EAC1B;AACJ;AAEA,eAAe,OAAO,aAAa,QAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,qBAAqB;QAC3B,WAAW,EAAE,QAAQ,CAAA;KACxB;CACJ;AAED,qBAAa,QAAS,SAAQ,WAAW;;IA2BrC,iBAAiB;CA0BpB"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import { decode } from "blurhash";
|
|
4
|
+
import { createDebug } from "@bicycle-codes/debug";
|
|
5
|
+
const debug = createDebug();
|
|
6
|
+
class BlurHash extends HTMLElement {
|
|
7
|
+
static {
|
|
8
|
+
__name(this, "BlurHash");
|
|
9
|
+
}
|
|
10
|
+
constructor() {
|
|
11
|
+
super();
|
|
12
|
+
const srcset = this.getAttribute("srcset");
|
|
13
|
+
const placeholder = this.getAttribute("placeholder");
|
|
14
|
+
if (!placeholder) throw new Error("not placeholder");
|
|
15
|
+
document.body.style.setProperty(
|
|
16
|
+
"--blur-hash-time",
|
|
17
|
+
this.getAttribute("time") || "0.6s"
|
|
18
|
+
);
|
|
19
|
+
this.innerHTML = `<canvas
|
|
20
|
+
class="blurry"
|
|
21
|
+
width=${this.getAttribute("width")}
|
|
22
|
+
height=${this.getAttribute("height")}
|
|
23
|
+
></canvas>
|
|
24
|
+
<img class="blurry"
|
|
25
|
+
${srcset ? `srcset="${srcset}"` : ""}
|
|
26
|
+
alt="${this.getAttribute("alt")}"
|
|
27
|
+
content-visibility="${this.getAttribute("content-visibility") || "auto"}"
|
|
28
|
+
decoding="${this.getAttribute("decoding") || "async"}"
|
|
29
|
+
loading="${this.getAttribute("loading") || "lazy"}"
|
|
30
|
+
class="image-element blurry"
|
|
31
|
+
src="${this.getAttribute("src")}"
|
|
32
|
+
/>
|
|
33
|
+
`;
|
|
34
|
+
}
|
|
35
|
+
connectedCallback() {
|
|
36
|
+
const width = parseInt(this.getAttribute("width") ?? "");
|
|
37
|
+
const height = parseInt(this.getAttribute("height") ?? "");
|
|
38
|
+
const placeholder = this.getAttribute("placeholder");
|
|
39
|
+
if (!placeholder || !width || !height) {
|
|
40
|
+
throw new Error("Missing attributes");
|
|
41
|
+
}
|
|
42
|
+
const pixels = decode(placeholder, width, height);
|
|
43
|
+
const canvas = this.querySelector("canvas");
|
|
44
|
+
const ctx = canvas.getContext("2d");
|
|
45
|
+
const imageData = ctx.createImageData(width, height);
|
|
46
|
+
imageData.data.set(pixels);
|
|
47
|
+
ctx.putImageData(imageData, 0, 0);
|
|
48
|
+
const img = this.querySelector("img");
|
|
49
|
+
img.addEventListener("load", () => {
|
|
50
|
+
debug("loaded");
|
|
51
|
+
canvas.style.display = "none";
|
|
52
|
+
img.classList.remove("blurry");
|
|
53
|
+
img.classList.add("sharp");
|
|
54
|
+
});
|
|
55
|
+
debug("the image", img);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
customElements.define("blur-hash", BlurHash);
|
|
59
|
+
export {
|
|
60
|
+
BlurHash
|
|
61
|
+
};
|
|
62
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/index.ts"],
|
|
4
|
+
"sourcesContent": ["import { decode } from 'blurhash'\nimport { createDebug } from '@bicycle-codes/debug'\nconst debug = createDebug()\n\n// for docuement.querySelector\ndeclare global {\n interface HTMLElementTagNameMap {\n 'blur-hash': BlurHash\n }\n}\n\nexport class BlurHash extends HTMLElement {\n constructor () {\n super()\n const srcset = this.getAttribute('srcset')\n const placeholder = this.getAttribute('placeholder')\n if (!placeholder) throw new Error('not placeholder')\n\n document.body.style.setProperty('--blur-hash-time',\n this.getAttribute('time') || '0.6s')\n\n this.innerHTML = `<canvas\n class=\"blurry\"\n width=${this.getAttribute('width')}\n height=${this.getAttribute('height')}\n ></canvas>\n <img class=\"blurry\"\n ${srcset ? `srcset=\"${srcset}\"` : ''}\n alt=\"${this.getAttribute('alt')}\"\n content-visibility=\"${this.getAttribute('content-visibility') || 'auto'}\"\n decoding=\"${this.getAttribute('decoding') || 'async'}\"\n loading=\"${this.getAttribute('loading') || 'lazy'}\"\n class=\"image-element blurry\"\n src=\"${this.getAttribute('src')}\"\n />\n `\n }\n\n connectedCallback () {\n const width = parseInt(this.getAttribute('width') ?? '')\n const height = parseInt(this.getAttribute('height') ?? '')\n const placeholder = this.getAttribute('placeholder')\n if (!placeholder || !width || !height) {\n throw new Error('Missing attributes')\n }\n\n const pixels = decode(placeholder, width, height)\n const canvas = this.querySelector('canvas') as HTMLCanvasElement\n const ctx = canvas.getContext('2d')!\n const imageData = ctx.createImageData(width, height)\n imageData.data.set(pixels)\n ctx.putImageData(imageData, 0, 0)\n\n const img = this.querySelector('img')!\n\n img.addEventListener('load', () => {\n debug('loaded')\n canvas.style.display = 'none'\n img.classList.remove('blurry')\n img.classList.add('sharp')\n })\n\n debug('the image', img)\n }\n}\n\ncustomElements.define('blur-hash', BlurHash)\n"],
|
|
5
|
+
"mappings": ";;AAAA,SAAS,cAAc;AACvB,SAAS,mBAAmB;AAC5B,MAAM,QAAQ,YAAY;AASnB,MAAM,iBAAiB,YAAY;AAAA,EAX1C,OAW0C;AAAA;AAAA;AAAA,EACtC,cAAe;AACX,UAAM;AACN,UAAM,SAAS,KAAK,aAAa,QAAQ;AACzC,UAAM,cAAc,KAAK,aAAa,aAAa;AACnD,QAAI,CAAC,YAAa,OAAM,IAAI,MAAM,iBAAiB;AAEnD,aAAS,KAAK,MAAM;AAAA,MAAY;AAAA,MAC5B,KAAK,aAAa,MAAM,KAAK;AAAA,IAAM;AAEvC,SAAK,YAAY;AAAA;AAAA,oBAEL,KAAK,aAAa,OAAO,CAAC;AAAA,qBACzB,KAAK,aAAa,QAAQ,CAAC;AAAA;AAAA;AAAA,cAGlC,SAAS,WAAW,MAAM,MAAM,EAAE;AAAA,mBAC7B,KAAK,aAAa,KAAK,CAAC;AAAA,kCACT,KAAK,aAAa,oBAAoB,KAAK,MAAM;AAAA,wBAC3D,KAAK,aAAa,UAAU,KAAK,OAAO;AAAA,uBACzC,KAAK,aAAa,SAAS,KAAK,MAAM;AAAA;AAAA,mBAE1C,KAAK,aAAa,KAAK,CAAC;AAAA;AAAA;AAAA,EAGvC;AAAA,EAEA,oBAAqB;AACjB,UAAM,QAAQ,SAAS,KAAK,aAAa,OAAO,KAAK,EAAE;AACvD,UAAM,SAAS,SAAS,KAAK,aAAa,QAAQ,KAAK,EAAE;AACzD,UAAM,cAAc,KAAK,aAAa,aAAa;AACnD,QAAI,CAAC,eAAe,CAAC,SAAS,CAAC,QAAQ;AACnC,YAAM,IAAI,MAAM,oBAAoB;AAAA,IACxC;AAEA,UAAM,SAAS,OAAO,aAAa,OAAO,MAAM;AAChD,UAAM,SAAS,KAAK,cAAc,QAAQ;AAC1C,UAAM,MAAM,OAAO,WAAW,IAAI;AAClC,UAAM,YAAY,IAAI,gBAAgB,OAAO,MAAM;AACnD,cAAU,KAAK,IAAI,MAAM;AACzB,QAAI,aAAa,WAAW,GAAG,CAAC;AAEhC,UAAM,MAAM,KAAK,cAAc,KAAK;AAEpC,QAAI,iBAAiB,QAAQ,MAAM;AAC/B,YAAM,QAAQ;AACd,aAAO,MAAM,UAAU;AACvB,UAAI,UAAU,OAAO,QAAQ;AAC7B,UAAI,UAAU,IAAI,OAAO;AAAA,IAC7B,CAAC;AAED,UAAM,aAAa,GAAG;AAAA,EAC1B;AACJ;AAEA,eAAe,OAAO,aAAa,QAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
var W=Object.create;var w=Object.defineProperty;var K=Object.getOwnPropertyDescriptor;var Q=Object.getOwnPropertyNames;var X=Object.getPrototypeOf,Y=Object.prototype.hasOwnProperty;var a=(e,t)=>w(e,"name",{value:t,configurable:!0});var ee=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var te=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Q(t))!Y.call(e,o)&&o!==r&&w(e,o,{get:()=>t[o],enumerable:!(n=K(t,o))||n.enumerable});return e};var re=(e,t,r)=>(r=e!=null?W(X(e)):{},te(t||!e||!e.__esModule?w(r,"default",{value:e,enumerable:!0}):r,e));var H=ee((De,G)=>{"use strict";var d=1e3,g=d*60,p=g*60,C=p*24,le=C*7,ue=C*365.25;G.exports=function(e,t){t=t||{};var r=typeof e;if(r==="string"&&e.length>0)return he(e);if(r==="number"&&isFinite(e))return t.long?fe(e):me(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function he(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var r=parseFloat(t[1]),n=(t[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*ue;case"weeks":case"week":case"w":return r*le;case"days":case"day":case"d":return r*C;case"hours":case"hour":case"hrs":case"hr":case"h":return r*p;case"minutes":case"minute":case"mins":case"min":case"m":return r*g;case"seconds":case"second":case"secs":case"sec":case"s":return r*d;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}a(he,"parse");function me(e){var t=Math.abs(e);return t>=C?Math.round(e/C)+"d":t>=p?Math.round(e/p)+"h":t>=g?Math.round(e/g)+"m":t>=d?Math.round(e/d)+"s":e+"ms"}a(me,"fmtShort");function fe(e){var t=Math.abs(e);return t>=C?v(e,t,C,"day"):t>=p?v(e,t,p,"hour"):t>=g?v(e,t,g,"minute"):t>=d?v(e,t,d,"second"):e+" ms"}a(fe,"fmtLong");function v(e,t,r,n){var o=t>=r*1.5;return Math.round(e/r)+" "+n+(o?"s":"")}a(v,"plural")});var ne=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","#","$","%","*","+",",","-",".",":",";","=","?","@","[","]","^","_","{","|","}","~"],F=a(e=>{let t=0;for(let r=0;r<e.length;r++){let n=e[r],o=ne.indexOf(n);t=t*83+o}return t},"x");var x=a(e=>{let t=e/255;return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)},"f"),A=a(e=>{let t=Math.max(0,Math.min(1,e));return t<=.0031308?Math.trunc(t*12.92*255+.5):Math.trunc((1.055*Math.pow(t,.4166666666666667)-.055)*255+.5)},"h"),ae=a(e=>e<0?-1:1,"F"),D=a((e,t)=>ae(e)*Math.pow(Math.abs(e),t),"M"),B=class extends Error{static{a(this,"d")}constructor(e){super(e),this.name="ValidationError",this.message=e}},oe=a(e=>{if(!e||e.length<6)throw new B("The blurhash string must be at least 6 characters");let t=F(e[0]),r=Math.floor(t/9)+1,n=t%9+1;if(e.length!==4+2*n*r)throw new B(`blurhash length mismatch: length is ${e.length} but it should be ${4+2*n*r}`)},"C");var se=a(e=>{let t=e>>16,r=e>>8&255,n=e&255;return[x(t),x(r),x(n)]},"z"),ie=a((e,t)=>{let r=Math.floor(e/361),n=Math.floor(e/19)%19,o=e%19;return[D((r-9)/9,2)*t,D((n-9)/9,2)*t,D((o-9)/9,2)*t]},"L"),ce=a((e,t,r,n)=>{oe(e),n=n|1;let o=F(e[0]),l=Math.floor(o/9)+1,h=o%9+1,u=(F(e[1])+1)/166,i=new Array(h*l);for(let s=0;s<i.length;s++)if(s===0){let c=F(e.substring(2,6));i[s]=se(c)}else{let c=F(e.substring(4+s*2,6+s*2));i[s]=ie(c,u*n)}let m=t*4,f=new Uint8ClampedArray(m*r);for(let s=0;s<r;s++)for(let c=0;c<t;c++){let T=0,_=0,O=0;for(let M=0;M<l;M++)for(let b=0;b<h;b++){let y=Math.cos(Math.PI*c*b/t)*Math.cos(Math.PI*s*M/r),E=i[b+M*h];T+=E[0]*y,_+=E[1]*y,O+=E[2]*y}let J=A(T),j=A(_),Z=A(O);f[4*c+0+s*m]=J,f[4*c+1+s*m]=j,f[4*c+2+s*m]=Z,f[4*c+3+s*m]=255}return f},"U"),U=ce;function N(e){return e instanceof Error?e.stack||e.message:String(e)}a(N,"coerce");function P(e,t){let r=0;for(let n=0;n<e.length;n++)r=(r<<5)-r+e.charCodeAt(n),r|=0;return t[Math.abs(r)%t.length]}a(P,"selectColor");function R(e){return e.split(/[\s,]+/).filter(Boolean).map(n=>n.replace(/\*/g,".*?")).map(n=>new RegExp("^"+n+"$"))}a(R,"createRegexFromEnvVar");function k(e=6){return Math.random().toString(20).substring(2,e)}a(k,"generateRandomString");var z=re(H(),1);var Ce=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],de=console.log||(()=>{}),V="",L=a(e=>(...t)=>{},"createDebug"),I=import.meta?.env?.VITE_DEBUG_MODE||"",$=[];I&&($=(I&&I.split(",")).map(e=>e.trim())||[]);(import.meta?.env?.DEV||import.meta?.env?.VITE_DEBUG||$.length&&$.includes(import.meta.env.MODE))&&(L=a(function(t){let r=Number(new Date);V||(V=k(10));let n=P(t||V,Ce);return a(function(...l){if(ge(t))return Fe(t||"DEV",l,{prevTime:r,color:n})},"debug")},"createDebug"));function ge(e){return e===void 0&&(import.meta&&import.meta.env?.DEV||import.meta.env?.VITE_DEBUG_MODE&&import.meta&&import.meta.env&&import.meta.env.MODE===import.meta.env.VITE_DEBUG_MODE)?!0:!e||!import.meta.env||!import.meta.env.VITE_DEBUG?!1:R(import.meta.env?.VITE_DEBUG).some(r=>r.test(e))}a(ge,"isEnabled");function pe(){return{j:a(function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+String(t)}},"j")}}a(pe,"createFormatters");function Fe(e,t,{prevTime:r,color:n}){let o=Number(new Date),l=o-(r||o);r=o,t[0]=N(t[0]);let h=pe();typeof t[0]!="string"&&t.unshift("%O");let u=0;t[0]=t[0].replace(/%([a-zA-Z%])/g,(m,f)=>{if(m==="%%")return"%";u++;let s=h[f];if(typeof s=="function"){let c=t[u];m=s.call(self,c),t.splice(u,1),u--}return m});let i=be({diff:l,color:n,useColors:Me(),namespace:e},t);de(...i)}a(Fe,"logger");function Me(){return typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:!!(typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.webkitAppearance||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}a(Me,"shouldUseColors");function be({diff:e,color:t,namespace:r,useColors:n},o){if(o[0]=(n?"%c":"")+r+(n?" %c":" ")+o[0]+(n?"%c ":" ")+"+"+(0,z.default)(e),!n)return;let l="color: "+t;o.splice(1,0,l,"color: inherit");let h=0,u=0;return o[0].replace(/%[a-zA-Z%]/g,i=>{i!=="%%"&&(h++,i==="%c"&&(u=h))}),o.splice(u,0,l),o}a(be,"formatArgs");var q=L(),S=class extends HTMLElement{static{a(this,"BlurHash")}constructor(){super();let t=this.getAttribute("srcset");if(!this.getAttribute("placeholder"))throw new Error("not placeholder");document.body.style.setProperty("--blur-hash-time",this.getAttribute("time")||"0.6s"),this.innerHTML=`<canvas
|
|
2
|
+
class="blurry"
|
|
3
|
+
width=${this.getAttribute("width")}
|
|
4
|
+
height=${this.getAttribute("height")}
|
|
5
|
+
></canvas>
|
|
6
|
+
<img class="blurry"
|
|
7
|
+
${t?`srcset="${t}"`:""}
|
|
8
|
+
alt="${this.getAttribute("alt")}"
|
|
9
|
+
content-visibility="${this.getAttribute("content-visibility")||"auto"}"
|
|
10
|
+
decoding="${this.getAttribute("decoding")||"async"}"
|
|
11
|
+
loading="${this.getAttribute("loading")||"lazy"}"
|
|
12
|
+
class="image-element blurry"
|
|
13
|
+
src="${this.getAttribute("src")}"
|
|
14
|
+
/>
|
|
15
|
+
`}connectedCallback(){let t=parseInt(this.getAttribute("width")??""),r=parseInt(this.getAttribute("height")??""),n=this.getAttribute("placeholder");if(!n||!t||!r)throw new Error("Missing attributes");let o=U(n,t,r),l=this.querySelector("canvas"),h=l.getContext("2d"),u=h.createImageData(t,r);u.data.set(o),h.putImageData(u,0,0);let i=this.querySelector("img");i.addEventListener("load",()=>{q("loaded"),l.style.display="none",i.classList.remove("blurry"),i.classList.add("sharp")}),q("the image",i)}};customElements.define("blur-hash",S);export{S as BlurHash};
|
|
16
|
+
//# sourceMappingURL=index.min.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../node_modules/ms/index.js", "../node_modules/blurhash/src/base83.ts", "../node_modules/blurhash/src/utils.ts", "../node_modules/blurhash/src/error.ts", "../node_modules/blurhash/src/decode.ts", "../node_modules/blurhash/src/encode.ts", "../node_modules/@bicycle-codes/debug/src/common.ts", "../node_modules/@bicycle-codes/debug/src/browser.ts", "../src/index.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Helpers.\n */\n\nvar s = 1000;\nvar m = s * 60;\nvar h = m * 60;\nvar d = h * 24;\nvar w = d * 7;\nvar y = d * 365.25;\n\n/**\n * Parse or format the given `val`.\n *\n * Options:\n *\n * - `long` verbose formatting [false]\n *\n * @param {String|Number} val\n * @param {Object} [options]\n * @throws {Error} throw an error if val is not a non-empty string or a number\n * @return {String|Number}\n * @api public\n */\n\nmodule.exports = function (val, options) {\n options = options || {};\n var type = typeof val;\n if (type === 'string' && val.length > 0) {\n return parse(val);\n } else if (type === 'number' && isFinite(val)) {\n return options.long ? fmtLong(val) : fmtShort(val);\n }\n throw new Error(\n 'val is not a non-empty string or a valid number. val=' +\n JSON.stringify(val)\n );\n};\n\n/**\n * Parse the given `str` and return milliseconds.\n *\n * @param {String} str\n * @return {Number}\n * @api private\n */\n\nfunction parse(str) {\n str = String(str);\n if (str.length > 100) {\n return;\n }\n var match = /^(-?(?:\\d+)?\\.?\\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(\n str\n );\n if (!match) {\n return;\n }\n var n = parseFloat(match[1]);\n var type = (match[2] || 'ms').toLowerCase();\n switch (type) {\n case 'years':\n case 'year':\n case 'yrs':\n case 'yr':\n case 'y':\n return n * y;\n case 'weeks':\n case 'week':\n case 'w':\n return n * w;\n case 'days':\n case 'day':\n case 'd':\n return n * d;\n case 'hours':\n case 'hour':\n case 'hrs':\n case 'hr':\n case 'h':\n return n * h;\n case 'minutes':\n case 'minute':\n case 'mins':\n case 'min':\n case 'm':\n return n * m;\n case 'seconds':\n case 'second':\n case 'secs':\n case 'sec':\n case 's':\n return n * s;\n case 'milliseconds':\n case 'millisecond':\n case 'msecs':\n case 'msec':\n case 'ms':\n return n;\n default:\n return undefined;\n }\n}\n\n/**\n * Short format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction fmtShort(ms) {\n var msAbs = Math.abs(ms);\n if (msAbs >= d) {\n return Math.round(ms / d) + 'd';\n }\n if (msAbs >= h) {\n return Math.round(ms / h) + 'h';\n }\n if (msAbs >= m) {\n return Math.round(ms / m) + 'm';\n }\n if (msAbs >= s) {\n return Math.round(ms / s) + 's';\n }\n return ms + 'ms';\n}\n\n/**\n * Long format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction fmtLong(ms) {\n var msAbs = Math.abs(ms);\n if (msAbs >= d) {\n return plural(ms, msAbs, d, 'day');\n }\n if (msAbs >= h) {\n return plural(ms, msAbs, h, 'hour');\n }\n if (msAbs >= m) {\n return plural(ms, msAbs, m, 'minute');\n }\n if (msAbs >= s) {\n return plural(ms, msAbs, s, 'second');\n }\n return ms + ' ms';\n}\n\n/**\n * Pluralization helper.\n */\n\nfunction plural(ms, msAbs, n, name) {\n var isPlural = msAbs >= n * 1.5;\n return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');\n}\n", "const digitCharacters = [\n \"0\",\n \"1\",\n \"2\",\n \"3\",\n \"4\",\n \"5\",\n \"6\",\n \"7\",\n \"8\",\n \"9\",\n \"A\",\n \"B\",\n \"C\",\n \"D\",\n \"E\",\n \"F\",\n \"G\",\n \"H\",\n \"I\",\n \"J\",\n \"K\",\n \"L\",\n \"M\",\n \"N\",\n \"O\",\n \"P\",\n \"Q\",\n \"R\",\n \"S\",\n \"T\",\n \"U\",\n \"V\",\n \"W\",\n \"X\",\n \"Y\",\n \"Z\",\n \"a\",\n \"b\",\n \"c\",\n \"d\",\n \"e\",\n \"f\",\n \"g\",\n \"h\",\n \"i\",\n \"j\",\n \"k\",\n \"l\",\n \"m\",\n \"n\",\n \"o\",\n \"p\",\n \"q\",\n \"r\",\n \"s\",\n \"t\",\n \"u\",\n \"v\",\n \"w\",\n \"x\",\n \"y\",\n \"z\",\n \"#\",\n \"$\",\n \"%\",\n \"*\",\n \"+\",\n \",\",\n \"-\",\n \".\",\n \":\",\n \";\",\n \"=\",\n \"?\",\n \"@\",\n \"[\",\n \"]\",\n \"^\",\n \"_\",\n \"{\",\n \"|\",\n \"}\",\n \"~\",\n];\n\nexport const decode83 = (str: String) => {\n let value = 0;\n for (let i = 0; i < str.length; i++) {\n const c = str[i];\n const digit = digitCharacters.indexOf(c);\n value = value * 83 + digit;\n }\n return value;\n};\n\nexport const encode83 = (n: number, length: number): string => {\n var result = \"\";\n for (let i = 1; i <= length; i++) {\n let digit = (Math.floor(n) / Math.pow(83, length - i)) % 83;\n result += digitCharacters[Math.floor(digit)];\n }\n return result;\n};\n", "export const sRGBToLinear = (value: number) => {\n let v = value / 255;\n if (v <= 0.04045) {\n return v / 12.92;\n } else {\n return Math.pow((v + 0.055) / 1.055, 2.4);\n }\n};\n\nexport const linearTosRGB = (value: number) => {\n let v = Math.max(0, Math.min(1, value));\n if (v <= 0.0031308) {\n return Math.trunc(v * 12.92 * 255 + 0.5);\n } else {\n return Math.trunc((1.055 * Math.pow(v, 1 / 2.4) - 0.055) * 255 + 0.5);\n }\n};\n\nexport const sign = (n: number) => (n < 0 ? -1 : 1);\n\nexport const signPow = (val: number, exp: number) =>\n sign(val) * Math.pow(Math.abs(val), exp);\n", "export class ValidationError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"ValidationError\";\n this.message = message;\n }\n}\n", "import { decode83 } from \"./base83\";\nimport { sRGBToLinear, signPow, linearTosRGB } from \"./utils\";\nimport { ValidationError } from \"./error\";\n\n/**\n * Returns an error message if invalid or undefined if valid\n * @param blurhash\n */\nconst validateBlurhash = (blurhash: string) => {\n if (!blurhash || blurhash.length < 6) {\n throw new ValidationError(\n \"The blurhash string must be at least 6 characters\"\n );\n }\n\n const sizeFlag = decode83(blurhash[0]);\n const numY = Math.floor(sizeFlag / 9) + 1;\n const numX = (sizeFlag % 9) + 1;\n\n if (blurhash.length !== 4 + 2 * numX * numY) {\n throw new ValidationError(\n `blurhash length mismatch: length is ${\n blurhash.length\n } but it should be ${4 + 2 * numX * numY}`\n );\n }\n};\n\nexport const isBlurhashValid = (\n blurhash: string\n): { result: boolean; errorReason?: string } => {\n try {\n validateBlurhash(blurhash);\n } catch (error) {\n return { result: false, errorReason: error.message };\n }\n\n return { result: true };\n};\n\nconst decodeDC = (value: number) => {\n const intR = value >> 16;\n const intG = (value >> 8) & 255;\n const intB = value & 255;\n return [sRGBToLinear(intR), sRGBToLinear(intG), sRGBToLinear(intB)];\n};\n\nconst decodeAC = (value: number, maximumValue: number) => {\n const quantR = Math.floor(value / (19 * 19));\n const quantG = Math.floor(value / 19) % 19;\n const quantB = value % 19;\n\n const rgb = [\n signPow((quantR - 9) / 9, 2.0) * maximumValue,\n signPow((quantG - 9) / 9, 2.0) * maximumValue,\n signPow((quantB - 9) / 9, 2.0) * maximumValue,\n ];\n\n return rgb;\n};\n\nconst decode = (\n blurhash: string,\n width: number,\n height: number,\n punch?: number\n) => {\n validateBlurhash(blurhash);\n\n punch = punch | 1;\n\n const sizeFlag = decode83(blurhash[0]);\n const numY = Math.floor(sizeFlag / 9) + 1;\n const numX = (sizeFlag % 9) + 1;\n\n const quantisedMaximumValue = decode83(blurhash[1]);\n const maximumValue = (quantisedMaximumValue + 1) / 166;\n\n const colors = new Array(numX * numY);\n\n for (let i = 0; i < colors.length; i++) {\n if (i === 0) {\n const value = decode83(blurhash.substring(2, 6));\n colors[i] = decodeDC(value);\n } else {\n const value = decode83(blurhash.substring(4 + i * 2, 6 + i * 2));\n colors[i] = decodeAC(value, maximumValue * punch);\n }\n }\n\n const bytesPerRow = width * 4;\n const pixels = new Uint8ClampedArray(bytesPerRow * height);\n\n for (let y = 0; y < height; y++) {\n for (let x = 0; x < width; x++) {\n let r = 0;\n let g = 0;\n let b = 0;\n\n for (let j = 0; j < numY; j++) {\n for (let i = 0; i < numX; i++) {\n const basis =\n Math.cos((Math.PI * x * i) / width) *\n Math.cos((Math.PI * y * j) / height);\n let color = colors[i + j * numX];\n r += color[0] * basis;\n g += color[1] * basis;\n b += color[2] * basis;\n }\n }\n\n let intR = linearTosRGB(r);\n let intG = linearTosRGB(g);\n let intB = linearTosRGB(b);\n\n pixels[4 * x + 0 + y * bytesPerRow] = intR;\n pixels[4 * x + 1 + y * bytesPerRow] = intG;\n pixels[4 * x + 2 + y * bytesPerRow] = intB;\n pixels[4 * x + 3 + y * bytesPerRow] = 255; // alpha\n }\n }\n return pixels;\n};\n\nexport default decode;\n", "import { encode83 } from \"./base83\";\nimport { sRGBToLinear, signPow, linearTosRGB } from \"./utils\";\nimport { ValidationError } from \"./error\";\n\ntype NumberTriplet = [number, number, number];\n\nconst bytesPerPixel = 4;\n\nconst multiplyBasisFunction = (\n pixels: Uint8ClampedArray,\n width: number,\n height: number,\n basisFunction: (i: number, j: number) => number\n): NumberTriplet => {\n let r = 0;\n let g = 0;\n let b = 0;\n const bytesPerRow = width * bytesPerPixel;\n\n for (let x = 0; x < width; x++) {\n const bytesPerPixelX = bytesPerPixel * x;\n\n for (let y = 0; y < height; y++) {\n const basePixelIndex = bytesPerPixelX + y * bytesPerRow;\n const basis = basisFunction(x, y);\n r +=\n basis * sRGBToLinear(pixels[basePixelIndex]);\n g +=\n basis * sRGBToLinear(pixels[basePixelIndex + 1]);\n b +=\n basis * sRGBToLinear(pixels[basePixelIndex + 2]);\n }\n }\n\n let scale = 1 / (width * height);\n\n return [r * scale, g * scale, b * scale];\n};\n\nconst encodeDC = (value: NumberTriplet): number => {\n const roundedR = linearTosRGB(value[0]);\n const roundedG = linearTosRGB(value[1]);\n const roundedB = linearTosRGB(value[2]);\n return (roundedR << 16) + (roundedG << 8) + roundedB;\n};\n\nconst encodeAC = (value: NumberTriplet, maximumValue: number): number => {\n let quantR = Math.floor(\n Math.max(\n 0,\n Math.min(18, Math.floor(signPow(value[0] / maximumValue, 0.5) * 9 + 9.5))\n )\n );\n let quantG = Math.floor(\n Math.max(\n 0,\n Math.min(18, Math.floor(signPow(value[1] / maximumValue, 0.5) * 9 + 9.5))\n )\n );\n let quantB = Math.floor(\n Math.max(\n 0,\n Math.min(18, Math.floor(signPow(value[2] / maximumValue, 0.5) * 9 + 9.5))\n )\n );\n\n return quantR * 19 * 19 + quantG * 19 + quantB;\n};\n\nconst encode = (\n pixels: Uint8ClampedArray,\n width: number,\n height: number,\n componentX: number,\n componentY: number\n): string => {\n if (componentX < 1 || componentX > 9 || componentY < 1 || componentY > 9) {\n throw new ValidationError(\"BlurHash must have between 1 and 9 components\");\n }\n if (width * height * 4 !== pixels.length) {\n throw new ValidationError(\"Width and height must match the pixels array\");\n }\n\n let factors: Array<[number, number, number]> = [];\n for (let y = 0; y < componentY; y++) {\n for (let x = 0; x < componentX; x++) {\n const normalisation = x == 0 && y == 0 ? 1 : 2;\n const factor = multiplyBasisFunction(\n pixels,\n width,\n height,\n (i: number, j: number) =>\n normalisation *\n Math.cos((Math.PI * x * i) / width) *\n Math.cos((Math.PI * y * j) / height)\n );\n factors.push(factor);\n }\n }\n\n const dc = factors[0];\n const ac = factors.slice(1);\n\n let hash = \"\";\n\n let sizeFlag = componentX - 1 + (componentY - 1) * 9;\n hash += encode83(sizeFlag, 1);\n\n let maximumValue: number;\n if (ac.length > 0) {\n let actualMaximumValue = Math.max(...ac.map((val) => Math.max(...val)));\n let quantisedMaximumValue = Math.floor(\n Math.max(0, Math.min(82, Math.floor(actualMaximumValue * 166 - 0.5)))\n );\n maximumValue = (quantisedMaximumValue + 1) / 166;\n hash += encode83(quantisedMaximumValue, 1);\n } else {\n maximumValue = 1;\n hash += encode83(0, 1);\n }\n\n hash += encode83(encodeDC(dc), 4);\n\n ac.forEach((factor) => {\n hash += encode83(encodeAC(factor, maximumValue), 2);\n });\n\n return hash;\n};\n\nexport default encode;\n", null, null, "import { decode } from 'blurhash'\nimport { createDebug } from '@bicycle-codes/debug'\nconst debug = createDebug()\n\n// for docuement.querySelector\ndeclare global {\n interface HTMLElementTagNameMap {\n 'blur-hash': BlurHash\n }\n}\n\nexport class BlurHash extends HTMLElement {\n constructor () {\n super()\n const srcset = this.getAttribute('srcset')\n const placeholder = this.getAttribute('placeholder')\n if (!placeholder) throw new Error('not placeholder')\n\n document.body.style.setProperty('--blur-hash-time',\n this.getAttribute('time') || '0.6s')\n\n this.innerHTML = `<canvas\n class=\"blurry\"\n width=${this.getAttribute('width')}\n height=${this.getAttribute('height')}\n ></canvas>\n <img class=\"blurry\"\n ${srcset ? `srcset=\"${srcset}\"` : ''}\n alt=\"${this.getAttribute('alt')}\"\n content-visibility=\"${this.getAttribute('content-visibility') || 'auto'}\"\n decoding=\"${this.getAttribute('decoding') || 'async'}\"\n loading=\"${this.getAttribute('loading') || 'lazy'}\"\n class=\"image-element blurry\"\n src=\"${this.getAttribute('src')}\"\n />\n `\n }\n\n connectedCallback () {\n const width = parseInt(this.getAttribute('width') ?? '')\n const height = parseInt(this.getAttribute('height') ?? '')\n const placeholder = this.getAttribute('placeholder')\n if (!placeholder || !width || !height) {\n throw new Error('Missing attributes')\n }\n\n const pixels = decode(placeholder, width, height)\n const canvas = this.querySelector('canvas') as HTMLCanvasElement\n const ctx = canvas.getContext('2d')!\n const imageData = ctx.createImageData(width, height)\n imageData.data.set(pixels)\n ctx.putImageData(imageData, 0, 0)\n\n const img = this.querySelector('img')!\n\n img.addEventListener('load', () => {\n debug('loaded')\n canvas.style.display = 'none'\n img.classList.remove('blurry')\n img.classList.add('sharp')\n })\n\n debug('the image', img)\n }\n}\n\ncustomElements.define('blur-hash', BlurHash)\n"],
|
|
5
|
+
"mappings": "gkBAAA,IAAAA,EAAAC,GAAA,CAAAC,GAAAC,IAAA,cAIA,IAAIC,EAAI,IACJC,EAAID,EAAI,GACRE,EAAID,EAAI,GACRE,EAAID,EAAI,GACRE,GAAID,EAAI,EACRE,GAAIF,EAAI,OAgBZJ,EAAO,QAAU,SAAUO,EAAKC,EAAS,CACvCA,EAAUA,GAAW,CAAC,EACtB,IAAIC,EAAO,OAAOF,EAClB,GAAIE,IAAS,UAAYF,EAAI,OAAS,EACpC,OAAOG,GAAMH,CAAG,EACX,GAAIE,IAAS,UAAY,SAASF,CAAG,EAC1C,OAAOC,EAAQ,KAAOG,GAAQJ,CAAG,EAAIK,GAASL,CAAG,EAEnD,MAAM,IAAI,MACR,wDACE,KAAK,UAAUA,CAAG,CACtB,CACF,EAUA,SAASG,GAAMG,EAAK,CAElB,GADAA,EAAM,OAAOA,CAAG,EACZ,EAAAA,EAAI,OAAS,KAGjB,KAAIC,EAAQ,mIAAmI,KAC7ID,CACF,EACA,GAAKC,EAGL,KAAIC,EAAI,WAAWD,EAAM,CAAC,C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O;AAAA,uBACzC,KAAK,aAAa,SAAS,GAAK,MAAM;AAAA;AAAA,mBAE1C,KAAK,aAAa,KAAK,CAAC;AAAA;AAAA,SAGvC,CAEA,mBAAqB,CACjB,IAAMC,EAAQ,SAAS,KAAK,aAAa,OAAO,GAAK,EAAE,EACjDC,EAAS,SAAS,KAAK,aAAa,QAAQ,GAAK,EAAE,EACnDC,EAAc,KAAK,aAAa,aAAa,EACnD,GAAI,CAACA,GAAe,CAACF,GAAS,CAACC,EAC3B,MAAM,IAAI,MAAM,oBAAoB,EAGxC,IAAME,EAASC,EAAOF,EAAaF,EAAOC,CAAM,EAC1CI,EAAS,KAAK,cAAc,QAAQ,EACpCC,EAAMD,EAAO,WAAW,IAAI,EAC5BE,EAAYD,EAAI,gBAAgBN,EAAOC,CAAM,EACnDM,EAAU,KAAK,IAAIJ,CAAM,EACzBG,EAAI,aAAaC,EAAW,EAAG,CAAC,EAEhC,IAAMC,EAAM,KAAK,cAAc,KAAK,EAEpCA,EAAI,iBAAiB,OAAQ,IAAM,CAC/Bb,EAAM,QAAQ,EACdU,EAAO,MAAM,QAAU,OACvBG,EAAI,UAAU,OAAO,QAAQ,EAC7BA,EAAI,UAAU,IAAI,OAAO,CAC7B,CAAC,EAEDb,EAAM,YAAaa,CAAG,CAC1B,CACJ,EAEA,eAAe,OAAO,YAAaX,CAAQ",
|
|
6
|
+
"names": ["require_ms", "__commonJSMin", "exports", "module", "s", "m", "h", "d", "w", "y", "val", "options", "type", "parse", "fmtLong", "fmtShort", "str", "match", "n", "__name", "ms", "msAbs", "plural", "name", "isPlural", "q", "x", "__name", "t", "e", "l", "f", "__name", "t", "e", "h", "F", "M", "d", "C", "x", "z", "__name", "t", "e", "f", "L", "l", "M", "U", "C", "x", "m", "b", "i", "u", "o", "a", "c", "s", "y", "B", "R", "w", "P", "G", "T", "V", "h", "I", "E", "j", "coerce", "val", "__name", "selectColor", "namespace", "colors", "hash", "i", "createRegexFromEnvVar", "names", "word", "r", "generateRandomString", "length", "import_ms", "colors", "log", "randomNamespace", "createDebug", "__name", "_", "_args", "modeVar", "modes", "mode", "namespace", "prevTime", "generateRandomString", "color", "selectColor", "args", "isEnabled", "logger", "isEnabled", "namespace", "createRegexFromEnvVar", "regex", "__name", "createFormatters", "v", "error", "logger", "args", "prevTime", "color", "curr", "diff", "coerce", "formatters", "index", "match", "format", "formatter", "val", "_args", "formatArgs", "shouldUseColors", "log", "useColors", "humanize", "c", "lastC", "debug", "createDebug", "BlurHash", "__name", "srcset", "width", "height", "placeholder", "pixels", "j", "canvas", "ctx", "imageData", "img"]
|
|
7
|
+
}
|
package/dist/meta.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"inputs": {
|
|
3
|
+
"src/index.ts": {
|
|
4
|
+
"bytes": 2226,
|
|
5
|
+
"imports": [],
|
|
6
|
+
"format": "esm"
|
|
7
|
+
}
|
|
8
|
+
},
|
|
9
|
+
"outputs": {
|
|
10
|
+
"dist/index.js.map": {
|
|
11
|
+
"imports": [],
|
|
12
|
+
"exports": [],
|
|
13
|
+
"inputs": {},
|
|
14
|
+
"bytes": 3699
|
|
15
|
+
},
|
|
16
|
+
"dist/index.js": {
|
|
17
|
+
"imports": [
|
|
18
|
+
{
|
|
19
|
+
"path": "blurhash",
|
|
20
|
+
"kind": "import-statement",
|
|
21
|
+
"external": true
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"path": "@bicycle-codes/debug",
|
|
25
|
+
"kind": "import-statement",
|
|
26
|
+
"external": true
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
"exports": [
|
|
30
|
+
"BlurHash"
|
|
31
|
+
],
|
|
32
|
+
"entryPoint": "src/index.ts",
|
|
33
|
+
"inputs": {
|
|
34
|
+
"src/index.ts": {
|
|
35
|
+
"bytesInOutput": 2016
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"bytes": 2202
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
package/dist/style.css
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
blur-hash {
|
|
2
|
+
overflow: hidden;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
blur-hash canvas {
|
|
6
|
+
opacity: 0.6;
|
|
7
|
+
filter: blur(30px);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
blur-hash img {
|
|
11
|
+
transition: opacity 0.6s;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
blur-hash img.blurry {
|
|
15
|
+
opacity: 0.6;
|
|
16
|
+
filter: blur(30px);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
blur-hash img.sharp {
|
|
20
|
+
opacity: 1;
|
|
21
|
+
animation: sharpen 0.8s both;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@keyframes sharpen {
|
|
25
|
+
from {
|
|
26
|
+
filter: blur(30px);
|
|
27
|
+
}
|
|
28
|
+
to {
|
|
29
|
+
filter: blur(0px)
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy9pbmRleC5jc3MiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7SUFDSSxnQkFBZ0I7QUFvQnBCOztBQWxCSTtRQUNJLFlBQVk7UUFDWixrQkFBa0I7SUFDdEI7O0FBRUE7UUFDSSx3QkFBd0I7SUFXNUI7O0FBVEk7WUFDSSxZQUFZO1lBQ1osa0JBQWtCO1FBQ3RCOztBQUVBO1lBQ0ksVUFBVTtZQUNWLDRCQUE0QjtRQUNoQzs7QUFJUjtJQUNJO1FBQ0ksa0JBQWtCO0lBQ3RCO0lBQ0E7UUFDSTtJQUNKO0FBQ0oiLCJmaWxlIjoic3JjL2luZGV4LmNzcyIsInNvdXJjZXNDb250ZW50IjpbImJsdXItaGFzaCB7XG4gICAgb3ZlcmZsb3c6IGhpZGRlbjtcblxuICAgICYgY2FudmFzIHtcbiAgICAgICAgb3BhY2l0eTogMC42O1xuICAgICAgICBmaWx0ZXI6IGJsdXIoMzBweCk7XG4gICAgfVxuXG4gICAgJiBpbWcge1xuICAgICAgICB0cmFuc2l0aW9uOiBvcGFjaXR5IDAuNnM7XG5cbiAgICAgICAgJi5ibHVycnkge1xuICAgICAgICAgICAgb3BhY2l0eTogMC42O1xuICAgICAgICAgICAgZmlsdGVyOiBibHVyKDMwcHgpO1xuICAgICAgICB9XG5cbiAgICAgICAgJi5zaGFycCB7XG4gICAgICAgICAgICBvcGFjaXR5OiAxO1xuICAgICAgICAgICAgYW5pbWF0aW9uOiBzaGFycGVuIDAuOHMgYm90aDtcbiAgICAgICAgfVxuICAgIH1cbn1cblxuQGtleWZyYW1lcyBzaGFycGVuIHtcbiAgICBmcm9tIHtcbiAgICAgICAgZmlsdGVyOiBibHVyKDMwcHgpO1xuICAgIH1cbiAgICB0byB7XG4gICAgICAgIGZpbHRlcjogYmx1cigwcHgpXG4gICAgfVxufVxuIl19 */
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
blur-hash{overflow:hidden}blur-hash canvas{filter:blur(30px);opacity:.6}blur-hash img{transition:opacity .6s}blur-hash img.blurry{filter:blur(30px);opacity:.6}blur-hash img.sharp{animation:sharpen .8s both;opacity:1}@keyframes sharpen{0%{filter:blur(30px)}to{filter:blur(0)}}
|
|
2
|
+
/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy9pbmRleC5jc3MiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsVUFDSSxlQW9CSixDQWxCSSxpQkFFSSxpQkFBa0IsQ0FEbEIsVUFFSixDQUVBLGNBQ0ksc0JBV0osQ0FUSSxxQkFFSSxpQkFBa0IsQ0FEbEIsVUFFSixDQUVBLG9CQUVJLDBCQUE0QixDQUQ1QixTQUVKLENBSVIsbUJBQ0ksR0FDSSxpQkFDSixDQUNBLEdBQ0ksY0FDSixDQUNKIiwiZmlsZSI6InNyYy9pbmRleC5jc3MiLCJzb3VyY2VzQ29udGVudCI6WyJibHVyLWhhc2gge1xuICAgIG92ZXJmbG93OiBoaWRkZW47XG5cbiAgICAmIGNhbnZhcyB7XG4gICAgICAgIG9wYWNpdHk6IDAuNjtcbiAgICAgICAgZmlsdGVyOiBibHVyKDMwcHgpO1xuICAgIH1cblxuICAgICYgaW1nIHtcbiAgICAgICAgdHJhbnNpdGlvbjogb3BhY2l0eSAwLjZzO1xuXG4gICAgICAgICYuYmx1cnJ5IHtcbiAgICAgICAgICAgIG9wYWNpdHk6IDAuNjtcbiAgICAgICAgICAgIGZpbHRlcjogYmx1cigzMHB4KTtcbiAgICAgICAgfVxuXG4gICAgICAgICYuc2hhcnAge1xuICAgICAgICAgICAgb3BhY2l0eTogMTtcbiAgICAgICAgICAgIGFuaW1hdGlvbjogc2hhcnBlbiAwLjhzIGJvdGg7XG4gICAgICAgIH1cbiAgICB9XG59XG5cbkBrZXlmcmFtZXMgc2hhcnBlbiB7XG4gICAgZnJvbSB7XG4gICAgICAgIGZpbHRlcjogYmx1cigzMHB4KTtcbiAgICB9XG4gICAgdG8ge1xuICAgICAgICBmaWx0ZXI6IGJsdXIoMHB4KVxuICAgIH1cbn1cbiJdfQ== */
|
package/package.json
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@substrate-system/blur-hash",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "A blurry placeholder image web component",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"blur": "dist/bin/index.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"./dist/*"
|
|
12
|
+
],
|
|
13
|
+
"scripts": {
|
|
14
|
+
"lint": "eslint \"./**/*.{ts,js}\"",
|
|
15
|
+
"build-tests": "esbuild test/index.ts --target=es2020 --bundle --keep-names > test/test-bundle.js",
|
|
16
|
+
"test": "npm run lint && npm run build && npm run build-tests && npm run test-tape-run && npm run test-bin",
|
|
17
|
+
"test-bin": "npm run build-bin && esbuild ./test/bin.ts > ./test/bin.js && node ./test/bin.js | tap-spec",
|
|
18
|
+
"test-tape-run": "cat test/index.html | tape-run --input=html --static=test | tap-spec",
|
|
19
|
+
"build-css": "postcss src/index.css --use postcss-nesting > dist/style.css",
|
|
20
|
+
"build-css:min": "postcss src/index.css --use cssnano postcss-nesting > dist/style.min.css",
|
|
21
|
+
"build-cjs": "esbuild src/*.ts --format=cjs --keep-names --tsconfig=tsconfig.build.json --outdir=./dist --out-extension:.js=.cjs --sourcemap",
|
|
22
|
+
"build-esm": "esbuild src/*.ts --format=esm --metafile=dist/meta.json --keep-names --tsconfig=tsconfig.build.json --outdir=./dist --sourcemap && tsc --emitDeclarationOnly --project tsconfig.build.json --outDir dist",
|
|
23
|
+
"build-esm:min": "esbuild ./src/*.ts --format=esm --keep-names --bundle --tsconfig=tsconfig.build.json --minify --out-extension:.js=.min.js --outdir=./dist --sourcemap",
|
|
24
|
+
"build-example": "mkdir -p ./public && rm -rf ./public/* && vite --base=\"/blur-hash\" build",
|
|
25
|
+
"build-docs": "typedoc --tsconfig tsconfig.build.json ./src/index.ts",
|
|
26
|
+
"build": "mkdir -p ./dist && rm -rf ./dist/* && npm run build-cjs && npm run build-esm && npm run build-esm:min && npm run build-css && npm run build-css:min",
|
|
27
|
+
"build-bin": "mkdir -p dist/bin && esbuild ./bin/index.ts > ./dist/bin/index.js",
|
|
28
|
+
"start": "vite",
|
|
29
|
+
"preversion": "npm run lint",
|
|
30
|
+
"version": "auto-changelog -p --template keepachangelog --breaking-pattern 'BREAKING CHANGE:' && git add CHANGELOG.md",
|
|
31
|
+
"postversion": "git push --follow-tags && npm publish",
|
|
32
|
+
"prepublishOnly": "npm run build"
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"blurhash": "^2.0.5",
|
|
36
|
+
"image-size": "^1.1.1",
|
|
37
|
+
"yargs": "^17.7.2"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@bicycle-codes/debug": "^0.6.13",
|
|
41
|
+
"@bicycle-codes/dom": "^0.0.23",
|
|
42
|
+
"@bicycle-codes/tapzero": "^0.10.0",
|
|
43
|
+
"@typescript-eslint/eslint-plugin": "^7.9.0",
|
|
44
|
+
"@typescript-eslint/parser": "^7.9.0",
|
|
45
|
+
"auto-changelog": "^2.4.0",
|
|
46
|
+
"cssnano": "^7.0.3",
|
|
47
|
+
"esbuild": "^0.23.0",
|
|
48
|
+
"eslint": "^8.57.0",
|
|
49
|
+
"eslint-config-standard": "^17.1.0",
|
|
50
|
+
"inkjet": "^3.0.0",
|
|
51
|
+
"postcss": "^8.4.38",
|
|
52
|
+
"postcss-cli": "^11.0.0",
|
|
53
|
+
"postcss-nesting": "^12.1.5",
|
|
54
|
+
"tap-spec": "^5.0.0",
|
|
55
|
+
"tape-run": "^11.0.0",
|
|
56
|
+
"typedoc": "^0.26.2",
|
|
57
|
+
"typescript": "^5.4.5",
|
|
58
|
+
"vite": "^5.2.11"
|
|
59
|
+
},
|
|
60
|
+
"exports": {
|
|
61
|
+
".": {
|
|
62
|
+
"import": "./dist/index.js",
|
|
63
|
+
"require": "./dist/index.cjs"
|
|
64
|
+
},
|
|
65
|
+
"./*": {
|
|
66
|
+
"import": [
|
|
67
|
+
"./dist/*.js",
|
|
68
|
+
"./dist/*"
|
|
69
|
+
],
|
|
70
|
+
"require": [
|
|
71
|
+
"./dist/*.cjs",
|
|
72
|
+
"./dist/*"
|
|
73
|
+
]
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
"author": "nichoth <nichoth@nichoth.com> (https://nichoth.com)",
|
|
77
|
+
"license": "MIT",
|
|
78
|
+
"types": "./dist/index.d.ts",
|
|
79
|
+
"directories": {
|
|
80
|
+
"example": "example",
|
|
81
|
+
"test": "test"
|
|
82
|
+
},
|
|
83
|
+
"repository": {
|
|
84
|
+
"type": "git",
|
|
85
|
+
"url": "git+https://github.com/substrate-system/blur-hash.git"
|
|
86
|
+
},
|
|
87
|
+
"keywords": [
|
|
88
|
+
"blurhash",
|
|
89
|
+
"blur",
|
|
90
|
+
"up",
|
|
91
|
+
"image",
|
|
92
|
+
"component"
|
|
93
|
+
],
|
|
94
|
+
"bugs": {
|
|
95
|
+
"url": "https://github.com/substrate-system/blur-hash/issues"
|
|
96
|
+
},
|
|
97
|
+
"homepage": "https://github.com/substrate-system/blur-hash#readme"
|
|
98
|
+
}
|