@jedd-icons/core 0.0.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.
Files changed (36) hide show
  1. package/LICENSE +21 -0
  2. package/dist/createElement.cjs +28 -0
  3. package/dist/createElement.d.cts +24 -0
  4. package/dist/createElement.d.mts +24 -0
  5. package/dist/createElement.mjs +28 -0
  6. package/dist/createIcons.cjs +39 -0
  7. package/dist/createIcons.d.cts +18 -0
  8. package/dist/createIcons.d.mts +18 -0
  9. package/dist/createIcons.mjs +39 -0
  10. package/dist/fill.cjs +4 -0
  11. package/dist/fill.d.cts +2 -0
  12. package/dist/fill.d.mts +2 -0
  13. package/dist/fill.mjs +2 -0
  14. package/dist/icons/arrow-down-left.cjs +4 -0
  15. package/dist/icons/arrow-down-left.d.cts +6 -0
  16. package/dist/icons/arrow-down-left.d.mts +6 -0
  17. package/dist/icons/arrow-down-left.mjs +4 -0
  18. package/dist/icons-fill/arrow-down-left.cjs +4 -0
  19. package/dist/icons-fill/arrow-down-left.d.cts +6 -0
  20. package/dist/icons-fill/arrow-down-left.d.mts +6 -0
  21. package/dist/icons-fill/arrow-down-left.mjs +4 -0
  22. package/dist/index.cjs +13 -0
  23. package/dist/index.d.cts +7 -0
  24. package/dist/index.d.mts +7 -0
  25. package/dist/index.mjs +6 -0
  26. package/dist/shared/dist/defaultAttributes.cjs +34 -0
  27. package/dist/shared/dist/defaultAttributes.d.cts +17 -0
  28. package/dist/shared/dist/defaultAttributes.d.mts +17 -0
  29. package/dist/shared/dist/defaultAttributes.mjs +33 -0
  30. package/dist/shared/dist/resolveStrokeWidth.cjs +6 -0
  31. package/dist/shared/dist/resolveStrokeWidth.d.cts +5 -0
  32. package/dist/shared/dist/resolveStrokeWidth.d.mts +5 -0
  33. package/dist/shared/dist/resolveStrokeWidth.mjs +6 -0
  34. package/dist/shared/dist/types.d.cts +6 -0
  35. package/dist/shared/dist/types.d.mts +6 -0
  36. package/package.json +74 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 jedd-labs
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,28 @@
1
+ const require_defaultAttributes = require("./shared/dist/defaultAttributes.cjs");
2
+ const require_resolveStrokeWidth = require("./shared/dist/resolveStrokeWidth.cjs");
3
+ //#region src/createElement.ts
4
+ const SVG_NS = "http://www.w3.org/2000/svg";
5
+ function createElement(iconNode, { variant = "stroke", size = 24, color = "currentColor", strokeWidth = 2, absoluteStrokeWidth = false, class: className, attrs: extraAttrs } = {}) {
6
+ const svg = document.createElementNS(SVG_NS, "svg");
7
+ const defaults = require_defaultAttributes.variantDefaults[variant];
8
+ for (const [key, value] of Object.entries(defaults)) svg.setAttribute(key, String(value));
9
+ svg.setAttribute("width", String(size));
10
+ svg.setAttribute("height", String(size));
11
+ if (variant === "stroke") {
12
+ const resolved = require_resolveStrokeWidth.resolveStrokeWidth(strokeWidth, size, absoluteStrokeWidth);
13
+ svg.setAttribute("stroke", color);
14
+ svg.setAttribute("stroke-width", String(resolved));
15
+ } else svg.setAttribute("fill", color);
16
+ if (className) svg.setAttribute("class", className);
17
+ if (extraAttrs) for (const [k, v] of Object.entries(extraAttrs)) svg.setAttribute(k, String(v));
18
+ function buildNode([tag, attrs, children]) {
19
+ const el = document.createElementNS(SVG_NS, tag);
20
+ for (const [k, v] of Object.entries(attrs)) el.setAttribute(k, String(v));
21
+ if (children) for (const child of children) el.appendChild(buildNode(child));
22
+ return el;
23
+ }
24
+ for (const child of iconNode) svg.appendChild(buildNode(child));
25
+ return svg;
26
+ }
27
+ //#endregion
28
+ exports.createElement = createElement;
@@ -0,0 +1,24 @@
1
+ import { Variant } from "./shared/dist/defaultAttributes.cjs";
2
+ import { IconNode } from "./shared/dist/types.cjs";
3
+
4
+ //#region src/createElement.d.ts
5
+ interface CreateElementOptions {
6
+ absoluteStrokeWidth?: boolean;
7
+ attrs?: Record<string, string | number>;
8
+ class?: string;
9
+ color?: string;
10
+ size?: number | string;
11
+ strokeWidth?: number | string;
12
+ variant?: Variant;
13
+ }
14
+ declare function createElement(iconNode: IconNode, {
15
+ variant,
16
+ size,
17
+ color,
18
+ strokeWidth,
19
+ absoluteStrokeWidth,
20
+ class: className,
21
+ attrs: extraAttrs
22
+ }?: CreateElementOptions): SVGSVGElement;
23
+ //#endregion
24
+ export { CreateElementOptions, createElement };
@@ -0,0 +1,24 @@
1
+ import { Variant } from "./shared/dist/defaultAttributes.mjs";
2
+ import { IconNode } from "./shared/dist/types.mjs";
3
+
4
+ //#region src/createElement.d.ts
5
+ interface CreateElementOptions {
6
+ absoluteStrokeWidth?: boolean;
7
+ attrs?: Record<string, string | number>;
8
+ class?: string;
9
+ color?: string;
10
+ size?: number | string;
11
+ strokeWidth?: number | string;
12
+ variant?: Variant;
13
+ }
14
+ declare function createElement(iconNode: IconNode, {
15
+ variant,
16
+ size,
17
+ color,
18
+ strokeWidth,
19
+ absoluteStrokeWidth,
20
+ class: className,
21
+ attrs: extraAttrs
22
+ }?: CreateElementOptions): SVGSVGElement;
23
+ //#endregion
24
+ export { CreateElementOptions, createElement };
@@ -0,0 +1,28 @@
1
+ import { variantDefaults } from "./shared/dist/defaultAttributes.mjs";
2
+ import { resolveStrokeWidth } from "./shared/dist/resolveStrokeWidth.mjs";
3
+ //#region src/createElement.ts
4
+ const SVG_NS = "http://www.w3.org/2000/svg";
5
+ function createElement(iconNode, { variant = "stroke", size = 24, color = "currentColor", strokeWidth = 2, absoluteStrokeWidth = false, class: className, attrs: extraAttrs } = {}) {
6
+ const svg = document.createElementNS(SVG_NS, "svg");
7
+ const defaults = variantDefaults[variant];
8
+ for (const [key, value] of Object.entries(defaults)) svg.setAttribute(key, String(value));
9
+ svg.setAttribute("width", String(size));
10
+ svg.setAttribute("height", String(size));
11
+ if (variant === "stroke") {
12
+ const resolved = resolveStrokeWidth(strokeWidth, size, absoluteStrokeWidth);
13
+ svg.setAttribute("stroke", color);
14
+ svg.setAttribute("stroke-width", String(resolved));
15
+ } else svg.setAttribute("fill", color);
16
+ if (className) svg.setAttribute("class", className);
17
+ if (extraAttrs) for (const [k, v] of Object.entries(extraAttrs)) svg.setAttribute(k, String(v));
18
+ function buildNode([tag, attrs, children]) {
19
+ const el = document.createElementNS(SVG_NS, tag);
20
+ for (const [k, v] of Object.entries(attrs)) el.setAttribute(k, String(v));
21
+ if (children) for (const child of children) el.appendChild(buildNode(child));
22
+ return el;
23
+ }
24
+ for (const child of iconNode) svg.appendChild(buildNode(child));
25
+ return svg;
26
+ }
27
+ //#endregion
28
+ export { createElement };
@@ -0,0 +1,39 @@
1
+ const require_createElement = require("./createElement.cjs");
2
+ //#region src/createIcons.ts
3
+ function createIcons({ icons = {}, attrs = {}, nameAttr = "data-jedd", watch = false } = {}) {
4
+ const replace = (root = document) => {
5
+ const elements = root.querySelectorAll(`[${nameAttr}]`);
6
+ for (const el of elements) {
7
+ const name = el.getAttribute(nameAttr);
8
+ if (!name) continue;
9
+ const iconNode = icons[name];
10
+ if (!iconNode) {
11
+ console.warn(`[jedd-icons] Unknown icon: "${name}"`);
12
+ continue;
13
+ }
14
+ const elAttrs = { ...attrs };
15
+ if (el.dataset.jeddSize) elAttrs.size = el.dataset.jeddSize;
16
+ if (el.dataset.jeddColor) elAttrs.color = el.dataset.jeddColor;
17
+ if (el.dataset.jeddStrokeWidth) elAttrs.strokeWidth = el.dataset.jeddStrokeWidth;
18
+ const svg = require_createElement.createElement(iconNode, {
19
+ ...elAttrs,
20
+ class: [
21
+ "jedd",
22
+ `jedd-${name}`,
23
+ el.getAttribute("class")
24
+ ].filter(Boolean).join(" ")
25
+ });
26
+ el.replaceWith(svg);
27
+ }
28
+ };
29
+ replace();
30
+ if (watch && typeof MutationObserver !== "undefined") new MutationObserver((mutations) => {
31
+ for (const mutation of mutations) for (const node of mutation.addedNodes) if (node instanceof HTMLElement) if (node.hasAttribute(nameAttr)) replace(node.parentNode ?? document);
32
+ else replace(node);
33
+ }).observe(document.body, {
34
+ childList: true,
35
+ subtree: true
36
+ });
37
+ }
38
+ //#endregion
39
+ exports.createIcons = createIcons;
@@ -0,0 +1,18 @@
1
+ import { IconNode } from "./shared/dist/types.cjs";
2
+ import { CreateElementOptions } from "./createElement.cjs";
3
+
4
+ //#region src/createIcons.d.ts
5
+ interface CreateIconsOptions {
6
+ attrs?: CreateElementOptions;
7
+ icons?: Record<string, IconNode>;
8
+ nameAttr?: string;
9
+ watch?: boolean;
10
+ }
11
+ declare function createIcons({
12
+ icons,
13
+ attrs,
14
+ nameAttr,
15
+ watch
16
+ }?: CreateIconsOptions): void;
17
+ //#endregion
18
+ export { CreateIconsOptions, createIcons };
@@ -0,0 +1,18 @@
1
+ import { IconNode } from "./shared/dist/types.mjs";
2
+ import { CreateElementOptions } from "./createElement.mjs";
3
+
4
+ //#region src/createIcons.d.ts
5
+ interface CreateIconsOptions {
6
+ attrs?: CreateElementOptions;
7
+ icons?: Record<string, IconNode>;
8
+ nameAttr?: string;
9
+ watch?: boolean;
10
+ }
11
+ declare function createIcons({
12
+ icons,
13
+ attrs,
14
+ nameAttr,
15
+ watch
16
+ }?: CreateIconsOptions): void;
17
+ //#endregion
18
+ export { CreateIconsOptions, createIcons };
@@ -0,0 +1,39 @@
1
+ import { createElement } from "./createElement.mjs";
2
+ //#region src/createIcons.ts
3
+ function createIcons({ icons = {}, attrs = {}, nameAttr = "data-jedd", watch = false } = {}) {
4
+ const replace = (root = document) => {
5
+ const elements = root.querySelectorAll(`[${nameAttr}]`);
6
+ for (const el of elements) {
7
+ const name = el.getAttribute(nameAttr);
8
+ if (!name) continue;
9
+ const iconNode = icons[name];
10
+ if (!iconNode) {
11
+ console.warn(`[jedd-icons] Unknown icon: "${name}"`);
12
+ continue;
13
+ }
14
+ const elAttrs = { ...attrs };
15
+ if (el.dataset.jeddSize) elAttrs.size = el.dataset.jeddSize;
16
+ if (el.dataset.jeddColor) elAttrs.color = el.dataset.jeddColor;
17
+ if (el.dataset.jeddStrokeWidth) elAttrs.strokeWidth = el.dataset.jeddStrokeWidth;
18
+ const svg = createElement(iconNode, {
19
+ ...elAttrs,
20
+ class: [
21
+ "jedd",
22
+ `jedd-${name}`,
23
+ el.getAttribute("class")
24
+ ].filter(Boolean).join(" ")
25
+ });
26
+ el.replaceWith(svg);
27
+ }
28
+ };
29
+ replace();
30
+ if (watch && typeof MutationObserver !== "undefined") new MutationObserver((mutations) => {
31
+ for (const mutation of mutations) for (const node of mutation.addedNodes) if (node instanceof HTMLElement) if (node.hasAttribute(nameAttr)) replace(node.parentNode ?? document);
32
+ else replace(node);
33
+ }).observe(document.body, {
34
+ childList: true,
35
+ subtree: true
36
+ });
37
+ }
38
+ //#endregion
39
+ export { createIcons };
package/dist/fill.cjs ADDED
@@ -0,0 +1,4 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_arrow_down_left = require("./icons-fill/arrow-down-left.cjs");
3
+ exports.ArrowDownLeft = require_arrow_down_left.default;
4
+ exports.ArrowDownLeftNode = require_arrow_down_left.default;
@@ -0,0 +1,2 @@
1
+ import { ArrowDownLeft } from "./icons-fill/arrow-down-left.cjs";
2
+ export { ArrowDownLeft, ArrowDownLeft as ArrowDownLeftNode };
@@ -0,0 +1,2 @@
1
+ import { ArrowDownLeft } from "./icons-fill/arrow-down-left.mjs";
2
+ export { ArrowDownLeft, ArrowDownLeft as ArrowDownLeftNode };
package/dist/fill.mjs ADDED
@@ -0,0 +1,2 @@
1
+ import ArrowDownLeft from "./icons-fill/arrow-down-left.mjs";
2
+ export { ArrowDownLeft, ArrowDownLeft as ArrowDownLeftNode };
@@ -0,0 +1,4 @@
1
+ //#region src/icons/arrow-down-left.ts
2
+ const ArrowDownLeft = [["path", { "d": "M17 7L7 17M17 17H7V7" }]];
3
+ //#endregion
4
+ exports.default = ArrowDownLeft;
@@ -0,0 +1,6 @@
1
+ import { IconNode } from "../shared/dist/types.cjs";
2
+
3
+ //#region src/icons/arrow-down-left.d.ts
4
+ declare const ArrowDownLeft: IconNode;
5
+ //#endregion
6
+ export { ArrowDownLeft };
@@ -0,0 +1,6 @@
1
+ import { IconNode } from "../shared/dist/types.mjs";
2
+
3
+ //#region src/icons/arrow-down-left.d.ts
4
+ declare const ArrowDownLeft: IconNode;
5
+ //#endregion
6
+ export { ArrowDownLeft };
@@ -0,0 +1,4 @@
1
+ //#region src/icons/arrow-down-left.ts
2
+ const ArrowDownLeft = [["path", { "d": "M17 7L7 17M17 17H7V7" }]];
3
+ //#endregion
4
+ export { ArrowDownLeft as default };
@@ -0,0 +1,4 @@
1
+ //#region src/icons-fill/arrow-down-left.ts
2
+ const ArrowDownLeft = [["path", { "d": "M18 7.41406L12.207 13.207L17 18H6V7L10.793 11.793L16.5859 6L18 7.41406Z" }]];
3
+ //#endregion
4
+ exports.default = ArrowDownLeft;
@@ -0,0 +1,6 @@
1
+ import { IconNode } from "../shared/dist/types.cjs";
2
+
3
+ //#region src/icons-fill/arrow-down-left.d.ts
4
+ declare const ArrowDownLeft: IconNode;
5
+ //#endregion
6
+ export { ArrowDownLeft };
@@ -0,0 +1,6 @@
1
+ import { IconNode } from "../shared/dist/types.mjs";
2
+
3
+ //#region src/icons-fill/arrow-down-left.d.ts
4
+ declare const ArrowDownLeft: IconNode;
5
+ //#endregion
6
+ export { ArrowDownLeft };
@@ -0,0 +1,4 @@
1
+ //#region src/icons-fill/arrow-down-left.ts
2
+ const ArrowDownLeft = [["path", { "d": "M18 7.41406L12.207 13.207L17 18H6V7L10.793 11.793L16.5859 6L18 7.41406Z" }]];
3
+ //#endregion
4
+ export { ArrowDownLeft as default };
package/dist/index.cjs ADDED
@@ -0,0 +1,13 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_defaultAttributes = require("./shared/dist/defaultAttributes.cjs");
3
+ const require_resolveStrokeWidth = require("./shared/dist/resolveStrokeWidth.cjs");
4
+ const require_createElement = require("./createElement.cjs");
5
+ const require_createIcons = require("./createIcons.cjs");
6
+ const require_arrow_down_left = require("./icons/arrow-down-left.cjs");
7
+ exports.ArrowDownLeft = require_arrow_down_left.default;
8
+ exports.ArrowDownLeftNode = require_arrow_down_left.default;
9
+ exports.createElement = require_createElement.createElement;
10
+ exports.createIcons = require_createIcons.createIcons;
11
+ exports.defaultAttributes = require_defaultAttributes.defaultAttributes;
12
+ exports.resolveStrokeWidth = require_resolveStrokeWidth.resolveStrokeWidth;
13
+ exports.variantDefaults = require_defaultAttributes.variantDefaults;
@@ -0,0 +1,7 @@
1
+ import { Variant, defaultAttributes, variantDefaults } from "./shared/dist/defaultAttributes.cjs";
2
+ import { resolveStrokeWidth } from "./shared/dist/resolveStrokeWidth.cjs";
3
+ import { IconNode } from "./shared/dist/types.cjs";
4
+ import { CreateElementOptions, createElement } from "./createElement.cjs";
5
+ import { CreateIconsOptions, createIcons } from "./createIcons.cjs";
6
+ import { ArrowDownLeft } from "./icons/arrow-down-left.cjs";
7
+ export { ArrowDownLeft, ArrowDownLeft as ArrowDownLeftNode, type CreateElementOptions, type CreateIconsOptions, type IconNode, type Variant, createElement, createIcons, defaultAttributes, resolveStrokeWidth, variantDefaults };
@@ -0,0 +1,7 @@
1
+ import { Variant, defaultAttributes, variantDefaults } from "./shared/dist/defaultAttributes.mjs";
2
+ import { resolveStrokeWidth } from "./shared/dist/resolveStrokeWidth.mjs";
3
+ import { IconNode } from "./shared/dist/types.mjs";
4
+ import { CreateElementOptions, createElement } from "./createElement.mjs";
5
+ import { CreateIconsOptions, createIcons } from "./createIcons.mjs";
6
+ import { ArrowDownLeft } from "./icons/arrow-down-left.mjs";
7
+ export { ArrowDownLeft, ArrowDownLeft as ArrowDownLeftNode, type CreateElementOptions, type CreateIconsOptions, type IconNode, type Variant, createElement, createIcons, defaultAttributes, resolveStrokeWidth, variantDefaults };
package/dist/index.mjs ADDED
@@ -0,0 +1,6 @@
1
+ import { defaultAttributes, variantDefaults } from "./shared/dist/defaultAttributes.mjs";
2
+ import { resolveStrokeWidth } from "./shared/dist/resolveStrokeWidth.mjs";
3
+ import { createElement } from "./createElement.mjs";
4
+ import { createIcons } from "./createIcons.mjs";
5
+ import ArrowDownLeft from "./icons/arrow-down-left.mjs";
6
+ export { ArrowDownLeft, ArrowDownLeft as ArrowDownLeftNode, createElement, createIcons, defaultAttributes, resolveStrokeWidth, variantDefaults };
@@ -0,0 +1,34 @@
1
+ //#region ../shared/dist/defaultAttributes.mjs
2
+ const kebabToCamel = (s) => s.replace(/-([a-z])/g, (_, c) => c.toUpperCase());
3
+ function toCamel(attrs) {
4
+ return Object.fromEntries(Object.entries(attrs).map(([k, v]) => [kebabToCamel(k), v]));
5
+ }
6
+ const strokeDefaults = {
7
+ xmlns: "http://www.w3.org/2000/svg",
8
+ width: 24,
9
+ height: 24,
10
+ viewBox: "0 0 24 24",
11
+ fill: "none",
12
+ stroke: "currentColor",
13
+ "stroke-width": 2,
14
+ "stroke-linecap": "butt",
15
+ "stroke-linejoin": "miter"
16
+ };
17
+ toCamel(strokeDefaults);
18
+ const fillDefaults = {
19
+ xmlns: "http://www.w3.org/2000/svg",
20
+ width: 24,
21
+ height: 24,
22
+ viewBox: "0 0 24 24",
23
+ fill: "currentColor",
24
+ stroke: "none"
25
+ };
26
+ toCamel(fillDefaults);
27
+ const variantDefaults = {
28
+ stroke: strokeDefaults,
29
+ fill: fillDefaults
30
+ };
31
+ const defaultAttributes = strokeDefaults;
32
+ //#endregion
33
+ exports.defaultAttributes = defaultAttributes;
34
+ exports.variantDefaults = variantDefaults;
@@ -0,0 +1,17 @@
1
+ //#region ../shared/dist/defaultAttributes.d.mts
2
+ //#region src/defaultAttributes.d.ts
3
+ type Variant = "stroke" | "fill";
4
+ declare const variantDefaults: Record<Variant, Record<string, string | number>>;
5
+ declare const defaultAttributes: {
6
+ readonly xmlns: "http://www.w3.org/2000/svg";
7
+ readonly width: 24;
8
+ readonly height: 24;
9
+ readonly viewBox: "0 0 24 24";
10
+ readonly fill: "none";
11
+ readonly stroke: "currentColor";
12
+ readonly "stroke-width": 2;
13
+ readonly "stroke-linecap": "butt";
14
+ readonly "stroke-linejoin": "miter";
15
+ };
16
+ //#endregion
17
+ export { Variant, defaultAttributes, variantDefaults };
@@ -0,0 +1,17 @@
1
+ //#region ../shared/dist/defaultAttributes.d.mts
2
+ //#region src/defaultAttributes.d.ts
3
+ type Variant = "stroke" | "fill";
4
+ declare const variantDefaults: Record<Variant, Record<string, string | number>>;
5
+ declare const defaultAttributes: {
6
+ readonly xmlns: "http://www.w3.org/2000/svg";
7
+ readonly width: 24;
8
+ readonly height: 24;
9
+ readonly viewBox: "0 0 24 24";
10
+ readonly fill: "none";
11
+ readonly stroke: "currentColor";
12
+ readonly "stroke-width": 2;
13
+ readonly "stroke-linecap": "butt";
14
+ readonly "stroke-linejoin": "miter";
15
+ };
16
+ //#endregion
17
+ export { Variant, defaultAttributes, variantDefaults };
@@ -0,0 +1,33 @@
1
+ //#region ../shared/dist/defaultAttributes.mjs
2
+ const kebabToCamel = (s) => s.replace(/-([a-z])/g, (_, c) => c.toUpperCase());
3
+ function toCamel(attrs) {
4
+ return Object.fromEntries(Object.entries(attrs).map(([k, v]) => [kebabToCamel(k), v]));
5
+ }
6
+ const strokeDefaults = {
7
+ xmlns: "http://www.w3.org/2000/svg",
8
+ width: 24,
9
+ height: 24,
10
+ viewBox: "0 0 24 24",
11
+ fill: "none",
12
+ stroke: "currentColor",
13
+ "stroke-width": 2,
14
+ "stroke-linecap": "butt",
15
+ "stroke-linejoin": "miter"
16
+ };
17
+ toCamel(strokeDefaults);
18
+ const fillDefaults = {
19
+ xmlns: "http://www.w3.org/2000/svg",
20
+ width: 24,
21
+ height: 24,
22
+ viewBox: "0 0 24 24",
23
+ fill: "currentColor",
24
+ stroke: "none"
25
+ };
26
+ toCamel(fillDefaults);
27
+ const variantDefaults = {
28
+ stroke: strokeDefaults,
29
+ fill: fillDefaults
30
+ };
31
+ const defaultAttributes = strokeDefaults;
32
+ //#endregion
33
+ export { defaultAttributes, variantDefaults };
@@ -0,0 +1,6 @@
1
+ //#region ../shared/dist/resolveStrokeWidth.mjs
2
+ function resolveStrokeWidth(strokeWidth, size, absolute) {
3
+ return absolute ? Number(strokeWidth) * 24 / Number(size) : strokeWidth;
4
+ }
5
+ //#endregion
6
+ exports.resolveStrokeWidth = resolveStrokeWidth;
@@ -0,0 +1,5 @@
1
+ //#region ../shared/dist/resolveStrokeWidth.d.mts
2
+ //#region src/resolveStrokeWidth.d.ts
3
+ declare function resolveStrokeWidth(strokeWidth: number | string, size: number | string, absolute: boolean): number | string; //#endregion
4
+ //#endregion
5
+ export { resolveStrokeWidth };
@@ -0,0 +1,5 @@
1
+ //#region ../shared/dist/resolveStrokeWidth.d.mts
2
+ //#region src/resolveStrokeWidth.d.ts
3
+ declare function resolveStrokeWidth(strokeWidth: number | string, size: number | string, absolute: boolean): number | string; //#endregion
4
+ //#endregion
5
+ export { resolveStrokeWidth };
@@ -0,0 +1,6 @@
1
+ //#region ../shared/dist/resolveStrokeWidth.mjs
2
+ function resolveStrokeWidth(strokeWidth, size, absolute) {
3
+ return absolute ? Number(strokeWidth) * 24 / Number(size) : strokeWidth;
4
+ }
5
+ //#endregion
6
+ export { resolveStrokeWidth };
@@ -0,0 +1,6 @@
1
+ //#region ../shared/dist/types.d.mts
2
+ //#region src/types.d.ts
3
+ type IconNodeChild = [tag: string, attrs: Record<string, string | number>, children?: IconNodeChild[]];
4
+ type IconNode = IconNodeChild[]; //#endregion
5
+ //#endregion
6
+ export { IconNode };
@@ -0,0 +1,6 @@
1
+ //#region ../shared/dist/types.d.mts
2
+ //#region src/types.d.ts
3
+ type IconNodeChild = [tag: string, attrs: Record<string, string | number>, children?: IconNodeChild[]];
4
+ type IconNode = IconNodeChild[]; //#endregion
5
+ //#endregion
6
+ export { IconNode };
package/package.json ADDED
@@ -0,0 +1,74 @@
1
+ {
2
+ "name": "@jedd-icons/core",
3
+ "version": "0.0.2",
4
+ "description": "Jedd icons for vanilla JavaScript.",
5
+ "license": "MIT",
6
+ "author": "Marcello Novelli",
7
+ "homepage": "https://jeddicons.com/",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/jedd-labs/jedd-icons.git",
11
+ "directory": "packages/core"
12
+ },
13
+ "bugs": {
14
+ "url": "https://github.com/jedd-labs/jedd-icons/issues"
15
+ },
16
+ "keywords": [
17
+ "jedd",
18
+ "jedd-icons",
19
+ "icons",
20
+ "icon",
21
+ "svg",
22
+ "vanilla",
23
+ "javascript",
24
+ "dom"
25
+ ],
26
+ "type": "module",
27
+ "sideEffects": false,
28
+ "publishConfig": {
29
+ "access": "public"
30
+ },
31
+ "main": "./dist/index.cjs",
32
+ "module": "./dist/index.mjs",
33
+ "types": "./dist/index.d.mts",
34
+ "exports": {
35
+ ".": {
36
+ "types": {
37
+ "import": "./dist/index.d.mts",
38
+ "require": "./dist/index.d.cts"
39
+ },
40
+ "import": "./dist/index.mjs",
41
+ "require": "./dist/index.cjs"
42
+ },
43
+ "./fill": {
44
+ "types": {
45
+ "import": "./dist/fill.d.mts",
46
+ "require": "./dist/fill.d.cts"
47
+ },
48
+ "import": "./dist/fill.mjs",
49
+ "require": "./dist/fill.cjs"
50
+ }
51
+ },
52
+ "typesVersions": {
53
+ "*": {
54
+ "fill": [
55
+ "./dist/fill.d.mts"
56
+ ]
57
+ }
58
+ },
59
+ "files": [
60
+ "dist"
61
+ ],
62
+ "devDependencies": {
63
+ "tsdown": "^0.22.1",
64
+ "tsx": "^4.19.2",
65
+ "typescript": "^6.0.3",
66
+ "@jedd-icons/shared": "0.0.1"
67
+ },
68
+ "scripts": {
69
+ "gen": "tsx ../../tools/build-icons/build.ts --target vanilla",
70
+ "build": "pnpm gen && tsdown --config-loader tsx",
71
+ "dev": "pnpm gen && tsdown --config-loader tsx --watch",
72
+ "typecheck": "tsc --noEmit"
73
+ }
74
+ }