@substrate-system/blur-hash 0.0.0 → 0.0.1
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/README.md +38 -18
- package/package.json +3 -2
- package/README.example.md +0 -84
package/README.md
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
[](README.md)
|
|
4
4
|
[](README.md)
|
|
5
5
|
[](https://semver.org/)
|
|
6
|
-
[](package.json)
|
|
7
6
|
[](LICENSE)
|
|
8
7
|
|
|
9
8
|
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).
|
|
@@ -13,6 +12,23 @@ This is the ["blur-up" image loading technique](https://css-tricks.com/the-blur-
|
|
|
13
12
|
> [!TIP]
|
|
14
13
|
> Throttle the internet speed with the dev tools.
|
|
15
14
|
|
|
15
|
+
<!-- toc -->
|
|
16
|
+
|
|
17
|
+
- [install](#install)
|
|
18
|
+
- [API](#api)
|
|
19
|
+
* [ESM](#esm)
|
|
20
|
+
* [Common JS](#common-js)
|
|
21
|
+
* [attributes](#attributes)
|
|
22
|
+
- [CSS](#css)
|
|
23
|
+
* [Import CSS](#import-css)
|
|
24
|
+
- [use](#use)
|
|
25
|
+
* [Bundler](#bundler)
|
|
26
|
+
* [pre-built JS](#pre-built-js)
|
|
27
|
+
- [Create the string](#create-the-string)
|
|
28
|
+
* [Print to system clipboard](#print-to-system-clipboard)
|
|
29
|
+
|
|
30
|
+
<!-- tocstop -->
|
|
31
|
+
|
|
16
32
|
## install
|
|
17
33
|
|
|
18
34
|
```sh
|
|
@@ -33,6 +49,20 @@ import '@substrate-system/blur-hash'
|
|
|
33
49
|
require('@substrate-system/blur-hash')
|
|
34
50
|
```
|
|
35
51
|
|
|
52
|
+
### attributes
|
|
53
|
+
Takes the following attributes
|
|
54
|
+
|
|
55
|
+
#### time
|
|
56
|
+
The time for css transitions and animation. This is set as a CSS variable.
|
|
57
|
+
|
|
58
|
+
#### placeholder
|
|
59
|
+
The string created by the blurhash algorithm. See [node example](#create-the-string).
|
|
60
|
+
|
|
61
|
+
#### width & height
|
|
62
|
+
The dimensions of the image
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
36
66
|
## CSS
|
|
37
67
|
|
|
38
68
|
### Import CSS
|
|
@@ -50,12 +80,14 @@ import '@substrate-system/blur-hash/css/min'
|
|
|
50
80
|
This calls the global function `customElements.define`. Just import, then use
|
|
51
81
|
the tag in your HTML.
|
|
52
82
|
|
|
53
|
-
###
|
|
83
|
+
### Bundler
|
|
84
|
+
|
|
85
|
+
#### JS
|
|
54
86
|
```js
|
|
55
87
|
import '@substrate-system/blur-hash'
|
|
56
88
|
```
|
|
57
89
|
|
|
58
|
-
|
|
90
|
+
#### HTML
|
|
59
91
|
```html
|
|
60
92
|
<div>
|
|
61
93
|
<blur-hash
|
|
@@ -69,28 +101,16 @@ import '@substrate-system/blur-hash'
|
|
|
69
101
|
</div>
|
|
70
102
|
```
|
|
71
103
|
|
|
72
|
-
###
|
|
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
|
|
104
|
+
### pre-built JS
|
|
85
105
|
This package exposes minified JS files too. Copy them to a location that is
|
|
86
106
|
accessible to your web server, then link to them in HTML.
|
|
87
107
|
|
|
88
|
-
|
|
108
|
+
#### copy
|
|
89
109
|
```sh
|
|
90
110
|
cp ./node_modules/@substrate-system/blur-hash/dist/blur-hash.min.js ./public
|
|
91
111
|
```
|
|
92
112
|
|
|
93
|
-
|
|
113
|
+
#### HTML
|
|
94
114
|
```html
|
|
95
115
|
<script type="module" src="./blur-hash.min.js"></script>
|
|
96
116
|
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@substrate-system/blur-hash",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.1",
|
|
4
4
|
"description": "A blurry placeholder image web component",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"build-bin": "mkdir -p dist/bin && esbuild ./bin/index.ts > ./dist/bin/index.js",
|
|
28
28
|
"start": "vite",
|
|
29
29
|
"preversion": "npm run lint",
|
|
30
|
-
"version": "auto-changelog -p --template keepachangelog --breaking-pattern 'BREAKING CHANGE:' && git add CHANGELOG.md",
|
|
30
|
+
"version": "markdown-toc --maxdepth 3 -i README.md && auto-changelog -p --template keepachangelog --breaking-pattern 'BREAKING CHANGE:' && git add CHANGELOG.md README.md",
|
|
31
31
|
"postversion": "git push --follow-tags && npm publish",
|
|
32
32
|
"prepublishOnly": "npm run build"
|
|
33
33
|
},
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
"eslint": "^8.57.0",
|
|
49
49
|
"eslint-config-standard": "^17.1.0",
|
|
50
50
|
"inkjet": "^3.0.0",
|
|
51
|
+
"markdown-toc": "^1.2.0",
|
|
51
52
|
"postcss": "^8.4.38",
|
|
52
53
|
"postcss-cli": "^11.0.0",
|
|
53
54
|
"postcss-nesting": "^12.1.5",
|
package/README.example.md
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
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
|
-
```
|