@stnd/icon 0.2.1 → 0.3.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/CHANGELOG.md +12 -0
- package/Icon.svelte +16 -5
- package/icons/ph/obsidian-color.svg +6 -0
- package/icons/ph/obsidian.svg +3 -0
- package/icons/simple-icons/obsidian.svg +3 -0
- package/package.json +1 -1
- package/tokens.js +10 -0
package/CHANGELOG.md
CHANGED
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>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none">
|
|
2
|
+
<path fill="#7C3AED" d="m6.919 14.595c.64-.19 1.673-.484 2.86-.556-.712-1.797-.884-3.37-.746-4.77.16-1.616.73-2.966 1.286-4.114.118-.245.232-.473.342-.692.155-.31.3-.6.436-.895.227-.49.395-.922.48-1.324.084-.395.084-.748-.015-1.087-.099-.339-.31-.704-.71-1.104-.522-.135-1.101-.016-1.535.374L4.18 5.066c-.287.259-.476.61-.534.992l-.444 2.947c.699.618 2.424 2.414 3.473 4.906.094.223.182.45.264.684z"/>
|
|
3
|
+
<path fill="#6D28D9" d="m2.973 10.351c-.024.104-.058.205-.102.303l-2.725 6.073c-.28.624-.15 1.355.325 1.846l4.289 4.416c2.19-3.23 1.87-6.27.87-8.646-.758-1.8-1.908-3.21-2.657-3.992z"/>
|
|
4
|
+
<path fill="#8B5CF6" d="m5.75 23.51c.076.011.152.019.229.021.813.024 2.182.095 3.292.3.905.166 2.7.668 4.178 1.1 1.127.33 2.288-.57 2.452-1.733.119-.848.343-1.808.755-2.687l-.01.003c-.698-1.947-1.586-3.204-2.517-4.007-.929-.8-1.928-1.174-2.894-1.31-1.604-.225-3.075.197-4.001.469.555 2.31.384 5.03-1.484 7.844z"/>
|
|
5
|
+
<path fill="#A78BFA" d="m17.37 19.31c.927-1.398 1.587-2.486 1.936-3.076.174-.295.142-.664-.064-.938-.538-.713-1.567-2.16-2.127-3.502-.577-1.378-.663-3.518-.668-4.561-.002-.396-.127-.783-.372-1.095l-3.331-4.232c-.012.19-.04.38-.08.568-.11.524-.32 1.045-.558 1.56-.14.303-.301.626-.465.953-.108.218-.218.437-.322.652-.538 1.113-1.04 2.32-1.18 3.74-.13 1.314.048 2.844.849 4.67.133.012.267.027.402.046 1.149.161 2.355.611 3.465 1.568.954.823 1.816 2.001 2.515 3.646z"/>
|
|
6
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
|
|
2
|
+
<path d="M19.355 18.538a68.967 68.959 0 0 0 1.858-2.954.81.81 0 0 0-.062-.9c-.516-.685-1.504-2.075-2.042-3.362-.553-1.321-.636-3.375-.64-4.377a1.707 1.707 0 0 0-.358-1.05l-3.198-4.064a3.744 3.744 0 0 1-.076.543c-.106.503-.307 1.004-.536 1.5-.134.29-.29.6-.446.914l-.31.626c-.516 1.068-.997 2.227-1.132 3.59-.124 1.26.046 2.73.815 4.481.128.011.257.025.386.044a6.363 6.363 0 0 1 3.326 1.505c.916.79 1.744 1.922 2.415 3.5zM8.199 22.569c.073.012.146.02.22.02.78.024 2.095.092 3.16.29.87.16 2.593.64 4.01 1.055 1.083.316 2.198-.548 2.355-1.664.114-.814.33-1.735.725-2.58l-.01.005c-.67-1.87-1.522-3.078-2.416-3.849a5.295 5.295 0 0 0-2.778-1.257c-1.54-.216-2.952.19-3.84.45.532 2.218.368 4.829-1.425 7.531zM5.533 9.938c-.023.1-.056.197-.098.29L2.82 16.059a1.602 1.602 0 0 0 .313 1.772l4.116 4.24c2.103-3.101 1.796-6.02.836-8.3-.728-1.73-1.832-3.081-2.55-3.831zM9.32 14.01c.615-.183 1.606-.465 2.745-.534-.683-1.725-.848-3.233-.716-4.577.154-1.552.7-2.847 1.235-3.95.113-.235.223-.454.328-.664.149-.297.288-.577.419-.86.217-.47.379-.885.46-1.27.08-.38.08-.72-.014-1.043-.095-.325-.297-.675-.68-1.06a1.6 1.6 0 0 0-1.475.36l-4.95 4.452a1.602 1.602 0 0 0-.513.952l-.427 2.83c.672.59 2.328 2.316 3.335 4.711.09.21.175.43.253.653z"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
|
|
2
|
+
<path d="M19.355 18.538a68.967 68.959 0 0 0 1.858-2.954.81.81 0 0 0-.062-.9c-.516-.685-1.504-2.075-2.042-3.362-.553-1.321-.636-3.375-.64-4.377a1.707 1.707 0 0 0-.358-1.05l-3.198-4.064a3.744 3.744 0 0 1-.076.543c-.106.503-.307 1.004-.536 1.5-.134.29-.29.6-.446.914l-.31.626c-.516 1.068-.997 2.227-1.132 3.59-.124 1.26.046 2.73.815 4.481.128.011.257.025.386.044a6.363 6.363 0 0 1 3.326 1.505c.916.79 1.744 1.922 2.415 3.5zM8.199 22.569c.073.012.146.02.22.02.78.024 2.095.092 3.16.29.87.16 2.593.64 4.01 1.055 1.083.316 2.198-.548 2.355-1.664.114-.814.33-1.735.725-2.58l-.01.005c-.67-1.87-1.522-3.078-2.416-3.849a5.295 5.295 0 0 0-2.778-1.257c-1.54-.216-2.952.19-3.84.45.532 2.218.368 4.829-1.425 7.531zM5.533 9.938c-.023.1-.056.197-.098.29L2.82 16.059a1.602 1.602 0 0 0 .313 1.772l4.116 4.24c2.103-3.101 1.796-6.02.836-8.3-.728-1.73-1.832-3.081-2.55-3.831zM9.32 14.01c.615-.183 1.606-.465 2.745-.534-.683-1.725-.848-3.233-.716-4.577.154-1.552.7-2.847 1.235-3.95.113-.235.223-.454.328-.664.149-.297.288-.577.419-.86.217-.47.379-.885.46-1.27.08-.38.08-.72-.014-1.043-.095-.325-.297-.675-.68-1.06a1.6 1.6 0 0 0-1.475.36l-4.95 4.452a1.602 1.602 0 0 0-.513.952l-.427 2.83c.672.59 2.328 2.316 3.335 4.711.09.21.175.43.253.653z"/>
|
|
3
|
+
</svg>
|
package/package.json
CHANGED
package/tokens.js
CHANGED
|
@@ -26,6 +26,16 @@ export const tokens = {
|
|
|
26
26
|
|
|
27
27
|
users: "ph:users",
|
|
28
28
|
|
|
29
|
+
// ── Garden & Launcher ───────────────────────────────────────
|
|
30
|
+
obsidian: "ph:obsidian",
|
|
31
|
+
"obsidian-color": "ph:obsidian-color",
|
|
32
|
+
mycelium: "ph:graph",
|
|
33
|
+
daily: "ph:calendar",
|
|
34
|
+
random: "ph:shuffle",
|
|
35
|
+
standard: "ph:scroll",
|
|
36
|
+
documentations: "ph:books",
|
|
37
|
+
highlight: "ph:highlighter",
|
|
38
|
+
|
|
29
39
|
// ── Items ─────────────────────────────────────────────────
|
|
30
40
|
book: "ph:book",
|
|
31
41
|
"book-open": "ph:book-open",
|