@stnd/icon 0.2.0 → 0.2.2
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 +15 -0
- package/Icon.svelte +16 -5
- package/README.md +10 -3
- package/package.json +3 -3
- package/tokens.js +8 -0
package/CHANGELOG.md
ADDED
package/Icon.svelte
CHANGED
|
@@ -25,6 +25,18 @@
|
|
|
25
25
|
return `/icons/${prefix}/${name}.svg`;
|
|
26
26
|
});
|
|
27
27
|
|
|
28
|
+
function formatDimension(dim) {
|
|
29
|
+
if (dim == null) return "1em";
|
|
30
|
+
const s = String(dim).trim();
|
|
31
|
+
if (/^\d+(\.\d+)?$/.test(s)) {
|
|
32
|
+
return `${s}px`;
|
|
33
|
+
}
|
|
34
|
+
return s;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
let formattedWidth = $derived(formatDimension(width));
|
|
38
|
+
let formattedHeight = $derived(formatDimension(height));
|
|
39
|
+
|
|
28
40
|
let svgContent = $state(null);
|
|
29
41
|
|
|
30
42
|
$effect(() => {
|
|
@@ -74,7 +86,7 @@
|
|
|
74
86
|
{#if svgContent}
|
|
75
87
|
<span
|
|
76
88
|
class="stnd-icon {className}"
|
|
77
|
-
style="display: inline-flex; width:{
|
|
89
|
+
style="display: inline-flex; width:{formattedWidth}; height:{formattedHeight}; align-items: center; justify-content: center;"
|
|
78
90
|
role="img"
|
|
79
91
|
aria-hidden="true"
|
|
80
92
|
{...props}
|
|
@@ -84,7 +96,7 @@
|
|
|
84
96
|
{:else if src}
|
|
85
97
|
<img
|
|
86
98
|
{src}
|
|
87
|
-
style="width:{
|
|
99
|
+
style="width:{formattedWidth};height:{formattedHeight};"
|
|
88
100
|
class="stnd-icon {className}"
|
|
89
101
|
aria-hidden="true"
|
|
90
102
|
alt=""
|
|
@@ -92,13 +104,12 @@
|
|
|
92
104
|
/>
|
|
93
105
|
{/if}
|
|
94
106
|
|
|
95
|
-
|
|
107
|
+
<style>
|
|
96
108
|
span.stnd-icon :global(svg) {
|
|
97
109
|
width: 100%;
|
|
98
110
|
height: 100%;
|
|
99
111
|
max-width: 100%;
|
|
100
112
|
max-height: 100%;
|
|
101
|
-
fill: currentColor;
|
|
102
113
|
display: block;
|
|
103
114
|
}
|
|
104
|
-
</style
|
|
115
|
+
</style>
|
package/README.md
CHANGED
|
@@ -2,21 +2,24 @@
|
|
|
2
2
|
title: "@stnd/icon"
|
|
3
3
|
aliases: []
|
|
4
4
|
created: 2026-07-05 07:53
|
|
5
|
-
modified: 2026-
|
|
5
|
+
modified: 2026-09-16T17:28:46.190Z
|
|
6
6
|
last_audited: 2026-07-14
|
|
7
7
|
audit_interval_days: 90
|
|
8
8
|
next_audit: 2026-10-12
|
|
9
9
|
audit_priority: 3
|
|
10
10
|
maturity: sprout
|
|
11
11
|
mode: read
|
|
12
|
-
publish:
|
|
12
|
+
publish: true
|
|
13
13
|
status: active
|
|
14
14
|
tags:
|
|
15
15
|
- package
|
|
16
16
|
- stnd
|
|
17
17
|
theme: kernel
|
|
18
18
|
type: package
|
|
19
|
-
visibility:
|
|
19
|
+
visibility: public
|
|
20
|
+
garden-url: https://standard.garden/@francis/readme
|
|
21
|
+
garden-short: https://stnd.gd/wAgx4e
|
|
22
|
+
permalink: readme
|
|
20
23
|
---
|
|
21
24
|
|
|
22
25
|
# @[stnd](../README)/icon
|
|
@@ -62,6 +65,10 @@ import Icon from "@stnd/icon/Icon.astro";
|
|
|
62
65
|
2. Live fetch from `api.iconify.design` (no installed-package step exists —
|
|
63
66
|
the resolver goes straight from local file to network).
|
|
64
67
|
|
|
68
|
+
## Cheatsheet
|
|
69
|
+
|
|
70
|
+
::widget IconShowcase
|
|
71
|
+
|
|
65
72
|
## Usage
|
|
66
73
|
|
|
67
74
|
### In Astro
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stnd/icon",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./normalize.js",
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@iconify/utils": "^3.1.3",
|
|
20
|
-
"wrangler": "^4.
|
|
21
|
-
"@stnd/log": "0.5.
|
|
20
|
+
"wrangler": "^4.129.0",
|
|
21
|
+
"@stnd/log": "0.5.1"
|
|
22
22
|
},
|
|
23
23
|
"optionalDependencies": {
|
|
24
24
|
"@iconify-json/bx": "^1.2.3",
|
package/tokens.js
CHANGED
|
@@ -26,6 +26,14 @@ export const tokens = {
|
|
|
26
26
|
|
|
27
27
|
users: "ph:users",
|
|
28
28
|
|
|
29
|
+
// ── Garden & Launcher ───────────────────────────────────────
|
|
30
|
+
mycelium: "ph:graph",
|
|
31
|
+
daily: "ph:calendar",
|
|
32
|
+
random: "ph:shuffle",
|
|
33
|
+
standard: "ph:scroll",
|
|
34
|
+
documentations: "ph:books",
|
|
35
|
+
highlight: "ph:highlighter",
|
|
36
|
+
|
|
29
37
|
// ── Items ─────────────────────────────────────────────────
|
|
30
38
|
book: "ph:book",
|
|
31
39
|
"book-open": "ph:book-open",
|