vadivam-solid 0.0.81 → 0.0.82
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 +1 -1
- package/dist/IconBase.js +6 -5
- package/dist/solid/IconBase.js +6 -5
- package/dist/solid/source/IconBase.jsx +4 -3
- package/dist/source/IconBase.jsx +4 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ Tree-shakeable 24px outline and solid SVG icons for Solid.
|
|
|
8
8
|
[](https://www.npmjs.com/package/vadivam-solid)
|
|
9
9
|
[](https://github.com/praveenjuge/vadivam/blob/main/LICENSE)
|
|
10
10
|
|
|
11
|
-

|
|
12
12
|
|
|
13
13
|
```sh
|
|
14
14
|
npm install vadivam-solid
|
package/dist/IconBase.js
CHANGED
|
@@ -6,7 +6,7 @@ import { createComponent as _$createComponent } from "solid-js/web";
|
|
|
6
6
|
import { memo as _$memo } from "solid-js/web";
|
|
7
7
|
import { escape as _$escape } from "solid-js/web";
|
|
8
8
|
var _tmpl$ = ["<title", ">", "</title>"];
|
|
9
|
-
import { For, splitProps } from "solid-js";
|
|
9
|
+
import { createMemo, For, splitProps } from "solid-js";
|
|
10
10
|
import { Dynamic } from "solid-js/web";
|
|
11
11
|
import defaultAttributes from "./defaultAttributes.js";
|
|
12
12
|
import { sanitizePaint, sanitizeRootAttributes } from "./runtimePolicy.js";
|
|
@@ -23,12 +23,13 @@ function scaledStrokeWidth(strokeWidth, size, absolute) {
|
|
|
23
23
|
return absolute && Number.isFinite(numericSize) && numericSize !== 0 && Number.isFinite(numericStroke) ? numericStroke * 24 / numericSize : strokeWidth;
|
|
24
24
|
}
|
|
25
25
|
// Renders nodes as given: built-in icons pass nodes checked when the package is
|
|
26
|
-
// built, and Icon passes caller nodes after sanitizing them.
|
|
26
|
+
// built, and Icon passes caller nodes after sanitizing them. The root
|
|
27
|
+
// attributes are sanitized in a memo, so props that start out undefined still apply.
|
|
27
28
|
export function IconBase(props) {
|
|
28
29
|
const [local, rest] = splitProps(props, ["color", "size", "strokeWidth", "absoluteStrokeWidth", "children", "iconNode", "name", "title", "class"]);
|
|
29
30
|
const context = useVadivamContext();
|
|
30
31
|
const resolvedSize = () => local.size ?? context.size ?? 24;
|
|
31
|
-
const safeRest = sanitizeRootAttributes(rest, true);
|
|
32
|
+
const safeRest = createMemo(() => sanitizeRootAttributes(rest, true));
|
|
32
33
|
return _$ssrElement("svg", _$mergeProps(defaultAttributes, {
|
|
33
34
|
get width() {
|
|
34
35
|
return resolvedSize();
|
|
@@ -46,10 +47,10 @@ export function IconBase(props) {
|
|
|
46
47
|
return mergeClasses("vadivam", local.name && "vadivam-" + local.name, context.class, local.class);
|
|
47
48
|
},
|
|
48
49
|
get ["aria-hidden"]() {
|
|
49
|
-
return isLabelled(local.title, Object.keys(safeRest)) ? undefined : "true";
|
|
50
|
+
return isLabelled(local.title, Object.keys(safeRest())) ? undefined : "true";
|
|
50
51
|
},
|
|
51
52
|
get role() {
|
|
52
|
-
return local.title ? "img" : safeRest.role;
|
|
53
|
+
return local.title ? "img" : safeRest().role;
|
|
53
54
|
}
|
|
54
55
|
}, safeRest), () => ["<!--$-->", local.title ? _$ssr(_tmpl$, _$ssrHydrationKey(), _$escape(local.title)) : _$escape(null), "<!--/-->", "<!--$-->", _$escape(_$createComponent(For, {
|
|
55
56
|
get each() {
|
package/dist/solid/IconBase.js
CHANGED
|
@@ -6,7 +6,7 @@ import { createComponent as _$createComponent } from "solid-js/web";
|
|
|
6
6
|
import { memo as _$memo } from "solid-js/web";
|
|
7
7
|
import { escape as _$escape } from "solid-js/web";
|
|
8
8
|
var _tmpl$ = ["<title", ">", "</title>"];
|
|
9
|
-
import { For, splitProps } from "solid-js";
|
|
9
|
+
import { createMemo, For, splitProps } from "solid-js";
|
|
10
10
|
import { Dynamic } from "solid-js/web";
|
|
11
11
|
import defaultAttributes from "./defaultAttributes.js";
|
|
12
12
|
import { sanitizePaint, sanitizeRootAttributes } from "../runtimePolicy.js";
|
|
@@ -18,12 +18,13 @@ function isLabelled(title, attributeNames) {
|
|
|
18
18
|
return Boolean(title) || attributeNames.some(name => name.startsWith("aria-") || name === "role" || name === "title");
|
|
19
19
|
}
|
|
20
20
|
// Renders nodes as given: built-in icons pass nodes checked when the package is
|
|
21
|
-
// built, and Icon passes caller nodes after sanitizing them.
|
|
21
|
+
// built, and Icon passes caller nodes after sanitizing them. The root
|
|
22
|
+
// attributes are sanitized in a memo, so props that start out undefined still apply.
|
|
22
23
|
export function IconBase(props) {
|
|
23
24
|
const [local, rest] = splitProps(props, ["color", "size", "strokeWidth", "absoluteStrokeWidth", "children", "iconNode", "name", "title", "class"]);
|
|
24
25
|
const context = useVadivamContext();
|
|
25
26
|
const resolvedSize = () => local.size ?? context.size ?? 24;
|
|
26
|
-
const safeRest = sanitizeRootAttributes(rest, true);
|
|
27
|
+
const safeRest = createMemo(() => sanitizeRootAttributes(rest, true));
|
|
27
28
|
return _$ssrElement("svg", _$mergeProps(defaultAttributes, {
|
|
28
29
|
get width() {
|
|
29
30
|
return resolvedSize();
|
|
@@ -38,10 +39,10 @@ export function IconBase(props) {
|
|
|
38
39
|
return mergeClasses("vadivam", local.name && "vadivam-" + local.name, context.class, local.class);
|
|
39
40
|
},
|
|
40
41
|
get ["aria-hidden"]() {
|
|
41
|
-
return isLabelled(local.title, Object.keys(safeRest)) ? undefined : "true";
|
|
42
|
+
return isLabelled(local.title, Object.keys(safeRest())) ? undefined : "true";
|
|
42
43
|
},
|
|
43
44
|
get role() {
|
|
44
|
-
return local.title ? "img" : safeRest.role;
|
|
45
|
+
return local.title ? "img" : safeRest().role;
|
|
45
46
|
}
|
|
46
47
|
}, safeRest), () => ["<!--$-->", local.title ? _$ssr(_tmpl$, _$ssrHydrationKey(), _$escape(local.title)) : _$escape(null), "<!--/-->", "<!--$-->", _$escape(_$createComponent(For, {
|
|
47
48
|
get each() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { For, splitProps } from "solid-js";
|
|
1
|
+
import { createMemo, For, splitProps } from "solid-js";
|
|
2
2
|
import { Dynamic } from "solid-js/web";
|
|
3
3
|
import defaultAttributes from "./defaultAttributes.js";
|
|
4
4
|
import { sanitizePaint, sanitizeRootAttributes } from "../../runtimePolicy.js";
|
|
@@ -6,5 +6,6 @@ import { useVadivamContext } from "../../source/context.jsx";
|
|
|
6
6
|
function mergeClasses(...values) { return values.flatMap((value) => typeof value === "string" ? value.split(/\s+/) : []).filter((value, index, all) => value && all.indexOf(value) === index).join(" "); }
|
|
7
7
|
function isLabelled(title, attributeNames) { return Boolean(title) || attributeNames.some((name) => name.startsWith("aria-") || name === "role" || name === "title"); }
|
|
8
8
|
// Renders nodes as given: built-in icons pass nodes checked when the package is
|
|
9
|
-
// built, and Icon passes caller nodes after sanitizing them.
|
|
10
|
-
|
|
9
|
+
// built, and Icon passes caller nodes after sanitizing them. The root
|
|
10
|
+
// attributes are sanitized in a memo, so props that start out undefined still apply.
|
|
11
|
+
export function IconBase(props) { const [local, rest] = splitProps(props, ["color", "size", "strokeWidth", "absoluteStrokeWidth", "children", "iconNode", "name", "title", "class"]); const context = useVadivamContext(); const resolvedSize = () => local.size ?? context.size ?? 24; const safeRest = createMemo(() => sanitizeRootAttributes(rest, true)); return <svg {...defaultAttributes} width={resolvedSize()} height={resolvedSize()} fill={sanitizePaint(local.color ?? context.color)} class={mergeClasses("vadivam", local.name && "vadivam-" + local.name, context.class, local.class)} aria-hidden={isLabelled(local.title, Object.keys(safeRest())) ? undefined : "true"} role={local.title ? "img" : safeRest().role} {...safeRest()}>{local.title ? <title>{local.title}</title> : null}<For each={local.iconNode ?? []}>{([tag, attrs]) => <Dynamic component={tag} {...attrs} />}</For>{local.children}</svg>; }
|
package/dist/source/IconBase.jsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { For, splitProps } from "solid-js";
|
|
1
|
+
import { createMemo, For, splitProps } from "solid-js";
|
|
2
2
|
import { Dynamic } from "solid-js/web";
|
|
3
3
|
import defaultAttributes from "./defaultAttributes.js";
|
|
4
4
|
import { sanitizePaint, sanitizeRootAttributes } from "./runtimePolicy.js";
|
|
@@ -7,5 +7,6 @@ function mergeClasses(...values) { return values.flatMap((value) => typeof value
|
|
|
7
7
|
function isLabelled(title, attributeNames) { return Boolean(title) || attributeNames.some((name) => name.startsWith("aria-") || name === "role" || name === "title"); }
|
|
8
8
|
function scaledStrokeWidth(strokeWidth, size, absolute) { const numericSize = Number(size); const numericStroke = Number(strokeWidth); return absolute && Number.isFinite(numericSize) && numericSize !== 0 && Number.isFinite(numericStroke) ? numericStroke * 24 / numericSize : strokeWidth; }
|
|
9
9
|
// Renders nodes as given: built-in icons pass nodes checked when the package is
|
|
10
|
-
// built, and Icon passes caller nodes after sanitizing them.
|
|
11
|
-
|
|
10
|
+
// built, and Icon passes caller nodes after sanitizing them. The root
|
|
11
|
+
// attributes are sanitized in a memo, so props that start out undefined still apply.
|
|
12
|
+
export function IconBase(props) { const [local, rest] = splitProps(props, ["color", "size", "strokeWidth", "absoluteStrokeWidth", "children", "iconNode", "name", "title", "class"]); const context = useVadivamContext(); const resolvedSize = () => local.size ?? context.size ?? 24; const safeRest = createMemo(() => sanitizeRootAttributes(rest, true)); return <svg {...defaultAttributes} width={resolvedSize()} height={resolvedSize()} stroke={sanitizePaint(local.color ?? context.color)} stroke-width={scaledStrokeWidth(local.strokeWidth ?? context.strokeWidth ?? 2, resolvedSize(), local.absoluteStrokeWidth ?? context.absoluteStrokeWidth ?? false)} class={mergeClasses("vadivam", local.name && "vadivam-" + local.name, context.class, local.class)} aria-hidden={isLabelled(local.title, Object.keys(safeRest())) ? undefined : "true"} role={local.title ? "img" : safeRest().role} {...safeRest()}>{local.title ? <title>{local.title}</title> : null}<For each={local.iconNode ?? []}>{([tag, attrs]) => <Dynamic component={tag} {...attrs} />}</For>{local.children}</svg>; }
|