Skip to content

Commit 750723f

Browse files
feat: add @unlazy/solid package
1 parent 0e65a85 commit 750723f

File tree

17 files changed

+374
-15
lines changed

17 files changed

+374
-15
lines changed

packages/react/playground/App.tsx

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,13 @@ import { LazyImage } from '../src'
22

33
function App() {
44
return (
5-
<>
6-
<div>
7-
<LazyImage
8-
blurhash="LKO2:N%2Tw=w]~RBVZRi};RPxuwH"
9-
autoSizes={true}
10-
data-srcset="image-320w.jpg 320w, image-640w.jpg 640w"
11-
width="640"
12-
height="640"
13-
/>
14-
</div>
15-
</>
5+
<LazyImage
6+
blurhash="LKO2:N%2Tw=w]~RBVZRi};RPxuwH"
7+
autoSizes={true}
8+
data-srcset="image-320w.jpg 320w, image-640w.jpg 640w"
9+
width="640"
10+
height="640"
11+
/>
1612
)
1713
}
1814

packages/react/playground/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<title>@unlazy/react</title>
77
</head>
88
<body>
9-
<div id="root"></div>
9+
<div id="app"></div>
1010
<script type="module" src="/main.tsx"></script>
1111
</body>
1212
</html>

packages/react/playground/main.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ import React from 'react'
22
import ReactDOM from 'react-dom/client'
33
import App from './App.tsx'
44

5-
ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
5+
const app = document.getElementById('app')!
6+
7+
ReactDOM.createRoot(app).render(
68
<React.StrictMode>
79
<App />
810
</React.StrictMode>,

packages/react/playground/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"type": "module",
3-
"version": "0.4.4",
43
"private": true,
54
"scripts": {
65
"dev": "vite",

packages/solid/build.config.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { defineBuildConfig } from 'unbuild'
2+
3+
export default defineBuildConfig({
4+
entries: ['src/index'],
5+
clean: true,
6+
declaration: true,
7+
externals: ['react', 'react-dom'],
8+
rollup: {
9+
emitCJS: true,
10+
inlineDependencies: true,
11+
resolve: {
12+
extensions: ['.ts', '.tsx'],
13+
},
14+
},
15+
})

packages/solid/package.json

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{
2+
"name": "@unlazy/solid",
3+
"version": "0.4.4",
4+
"packageManager": "pnpm@8.3.0",
5+
"description": "Solid lazy loading library for placeholder images",
6+
"author": "Johann Schopplich <pkg@johannschopplich.com>",
7+
"license": "MIT",
8+
"homepage": "https://unlazy.byjohann.dev",
9+
"repository": {
10+
"type": "git",
11+
"url": "git+https://github.com/johannschopplich/unlazy.git",
12+
"directory": "packages/solid"
13+
},
14+
"bugs": {
15+
"url": "https://github.com/johannschopplich/unlazy/issues"
16+
},
17+
"keywords": [
18+
"async",
19+
"image",
20+
"intersection",
21+
"lazy",
22+
"loading",
23+
"lozad",
24+
"native",
25+
"observer",
26+
"responsive",
27+
"react"
28+
],
29+
"sideEffects": false,
30+
"exports": {
31+
".": {
32+
"types": "./dist/index.d.ts",
33+
"require": "./dist/index.cjs",
34+
"import": "./dist/index.mjs"
35+
}
36+
},
37+
"main": "./dist/index.cjs",
38+
"module": "./dist/index.mjs",
39+
"types": "./dist/index.d.ts",
40+
"files": [
41+
"dist"
42+
],
43+
"scripts": {
44+
"build": "unbuild",
45+
"dev": "pnpm -C playground run dev",
46+
"dev:build": "pnpm -C playground run build",
47+
"test:types": "tsc --noEmit"
48+
},
49+
"peerDependencies": {
50+
"fast-blurhash": "^1.1.2",
51+
"solid-js": "^1.7.3"
52+
},
53+
"dependencies": {
54+
"unlazy": "workspace:*"
55+
},
56+
"devDependencies": {
57+
"@types/node": "^18.15.12",
58+
"fast-blurhash": "^1.1.2",
59+
"solid-js": "^1.7.3",
60+
"vite-plugin-solid": "^2.7.0"
61+
}
62+
}

packages/solid/playground/App.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/* @refresh granular */
2+
import { LazyImage } from '../src'
3+
4+
function App() {
5+
return (
6+
<LazyImage
7+
blurhash="LKO2:N%2Tw=w]~RBVZRi};RPxuwH"
8+
autoSizes={true}
9+
data-srcset="image-320w.jpg 320w, image-640w.jpg 640w"
10+
width="640"
11+
height="640"
12+
/>
13+
)
14+
}
15+
16+
export default App
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<title>@unlazy/solid</title>
7+
</head>
8+
<body>
9+
<div id="app"></div>
10+
<script type="module" src="/main.tsx"></script>
11+
</body>
12+
</html>

packages/solid/playground/main.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { render } from 'solid-js/web'
2+
import App from './App'
3+
4+
const app = document.getElementById('app')
5+
6+
if (app)
7+
render(() => <App />, app)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"type": "module",
3+
"private": true,
4+
"scripts": {
5+
"dev": "vite",
6+
"build": "vite build",
7+
"preview": "vite preview"
8+
}
9+
}

0 commit comments

Comments
 (0)