iconly 3.0.0-dev.2 → 3.0.1-rc.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/CHANGELOG.md +45 -0
- package/README.md +8 -1
- package/package.json +4 -2
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
## 3.0.0
|
|
6
|
+
|
|
7
|
+
### Breaking changes
|
|
8
|
+
|
|
9
|
+
- **API changed**: `new Iconly()` was replaced by `createIconly()`.
|
|
10
|
+
- **Init contract changed**: `init()` no longer throws and no longer returns `void`. It now returns a `Result<void>` that must be checked via `result.ok`.
|
|
11
|
+
- **DOM anchor changed**: the injected sprite wrapper is now a `<div data-iconly="iconset" aria-hidden="true">...</div>` inside the configured `container` (previously `id="iconset"`).
|
|
12
|
+
- **Storage is configurable**: caching can use `'indexeddb' | 'memory' | 'session'` or a custom storage implementation.
|
|
13
|
+
|
|
14
|
+
### Migration guide
|
|
15
|
+
|
|
16
|
+
#### 1) Constructor → factory
|
|
17
|
+
|
|
18
|
+
Before:
|
|
19
|
+
|
|
20
|
+
```js
|
|
21
|
+
import Iconly from 'iconly';
|
|
22
|
+
const iconly = new Iconly({ file: './sprite.svg' });
|
|
23
|
+
await iconly.init();
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
After:
|
|
27
|
+
|
|
28
|
+
```js
|
|
29
|
+
import { createIconly } from 'iconly';
|
|
30
|
+
const iconly = createIconly({ file: './sprite.svg' });
|
|
31
|
+
const result = await iconly.init();
|
|
32
|
+
if (!result.ok) console.error(result.error);
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
#### 2) DOM anchor
|
|
36
|
+
|
|
37
|
+
Before:
|
|
38
|
+
```html
|
|
39
|
+
#iconset
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
After (created inside `container`):
|
|
43
|
+
```html
|
|
44
|
+
[data-iconly="iconset"]
|
|
45
|
+
```
|
package/README.md
CHANGED
|
@@ -28,6 +28,14 @@ import { createIconly } from 'iconly';
|
|
|
28
28
|
```
|
|
29
29
|
<br>
|
|
30
30
|
|
|
31
|
+
# Upgrading to v3
|
|
32
|
+
- The API is now factory-based: use `createIconly()` instead of `new Iconly()`.
|
|
33
|
+
- `init()` returns a `Result<void>` and never throws.
|
|
34
|
+
- The injected sprite wrapper is now `[data-iconly="iconset"]` inside `container` (instead of `#iconset`).
|
|
35
|
+
|
|
36
|
+
See `CHANGELOG.md` for details.
|
|
37
|
+
<br>
|
|
38
|
+
|
|
31
39
|
# Usage
|
|
32
40
|
```javascript
|
|
33
41
|
const iconLoader = createIconly({
|
|
@@ -85,5 +93,4 @@ After `init()`, the SVG sprite is injected into the `container` inside `<div dat
|
|
|
85
93
|
- You can cancel a fetch by calling `iconLoader.abort()`, which results in a `fetch_aborted` error code.
|
|
86
94
|
|
|
87
95
|
# License
|
|
88
|
-
|
|
89
96
|
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iconly",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.1-rc.1",
|
|
4
4
|
"description": "Iconly is designed to load and cache SVG icons in the browser, using IndexedDB to store the data. It retrieves the icons from a given SVG file, stores them in IndexedDB, and inserts them into the DOM for easy access and use.",
|
|
5
5
|
"author": "ux-ui.pro",
|
|
6
6
|
"license": "MIT",
|
|
@@ -26,7 +26,8 @@
|
|
|
26
26
|
"format": "biome format --write src tests",
|
|
27
27
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
28
28
|
"test": "vitest run",
|
|
29
|
-
"test:watch": "vitest"
|
|
29
|
+
"test:watch": "vitest",
|
|
30
|
+
"prepublishOnly": "yarn clean && yarn build && yarn verify"
|
|
30
31
|
},
|
|
31
32
|
"source": "src/index.ts",
|
|
32
33
|
"main": "dist/index.cjs.js",
|
|
@@ -43,6 +44,7 @@
|
|
|
43
44
|
},
|
|
44
45
|
"files": [
|
|
45
46
|
"dist",
|
|
47
|
+
"CHANGELOG.md",
|
|
46
48
|
"README.md",
|
|
47
49
|
"LICENSE"
|
|
48
50
|
],
|