Skip to content

Commit

Permalink
fix: change size=number to string for Icon.svelte, run format and lib…
Browse files Browse the repository at this point in the history
…-helpers
  • Loading branch information
shinokada committed May 18, 2024
1 parent ccb8792 commit 8839d06
Show file tree
Hide file tree
Showing 338 changed files with 33,666 additions and 16,708 deletions.
6 changes: 1 addition & 5 deletions .changeset/pre.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,5 @@
"initialVersions": {
"svelte-heros-v2": "2.0.0-next.1"
},
"changesets": [
"long-cobras-hide",
"moody-grapes-move",
"seven-queens-cough"
]
"changesets": ["long-cobras-hide", "moody-grapes-move", "seven-queens-cough"]
}
5 changes: 5 additions & 0 deletions .changeset/spotty-beers-hope.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"svelte-heros-v2": patch
---

fix: change size=number to string for Icon.svelte, run format and lib-helpers
6 changes: 3 additions & 3 deletions src/app.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<!DOCTYPE html>
<!doctype html>
<html class="dark" lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
<meta name="viewport" content="width=device-width" />

%sveltekit.head%
</head>
<body data-sveltekit-preload-data="hover" class="bg-white dark_bg_theme">
<body data-sveltekit-preload-data="hover" class="dark_bg_theme bg-white">
<div style="display: contents">%sveltekit.body%</div>
</body>
</html>
12 changes: 6 additions & 6 deletions src/app.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -34,31 +34,31 @@
ul,
li,
table {
@apply dark:text-white tracking-wide;
@apply tracking-wide dark:text-white;
}

h1 {
@apply text-3xl my-8 text-primary-800 dark:text-primary-400;
@apply my-8 text-3xl text-primary-800 dark:text-primary-400;
}

h2 {
@apply text-2xl my-6;
@apply my-6 text-2xl;
}

h3 {
@apply text-xl my-5;
@apply my-5 text-xl;
}

p {
@apply text-lg my-3;
@apply my-3 text-lg;
}

code {
@apply text-primary-700 dark:text-primary-400;
}

#mainContent > pre {
@apply text-sm rounded-xl overflow-auto w-full my-4 mx-auto bg-gradient-to-r text-gray-600 dark:text-gray-400 bg-gray-50 dark:bg-gray-900 border border-gray-200 dark:border-gray-700 p-2 sm:p-6;
@apply mx-auto my-4 w-full overflow-auto rounded-xl border border-gray-200 bg-gray-50 bg-gradient-to-r p-2 text-sm text-gray-600 sm:p-6 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-400;
}
}

Expand Down
173 changes: 119 additions & 54 deletions src/lib/AcademicCap.svelte

Large diffs are not rendered by default.

305 changes: 251 additions & 54 deletions src/lib/AdjustmentsHorizontal.svelte

Large diffs are not rendered by default.

305 changes: 251 additions & 54 deletions src/lib/AdjustmentsVertical.svelte

Large diffs are not rendered by default.

173 changes: 119 additions & 54 deletions src/lib/ArchiveBox.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,69 +5,68 @@
id?: string;
title?: string;
};
type DescType = {
id?: string;
desc?: string;
};
interface BaseProps {
size?: string;
role?: string;
color?: string;
variation?: "solid" | "outline" | "mini" | "micro";
variation?: 'solid' | 'outline' | 'mini' | 'micro';
strokeWidth?: string;
withEvents?: boolean;
onclick?: (event: MouseEvent) => void;
onkeydown?: (event: KeyboardEvent) => void;
onkeyup?: (event: KeyboardEvent) => void;
class?: string;
}
interface CtxType extends BaseProps {}
interface Props extends BaseProps{
interface Props extends BaseProps {
title?: TitleType;
desc?: DescType;
ariaLabel?: string;
}
const ctx: CtxType = getContext('iconCtx') ?? {};
let {
size = ctx.size || '24',
role = ctx.role || 'img',
color = ctx.color || 'currentColor',
variation = ctx.variation || "outline",
let {
size = ctx.size || '24',
role = ctx.role || 'img',
color = ctx.color || 'currentColor',
variation = ctx.variation || 'outline',
strokeWidth = ctx.strokeWidth || '1.5',
withEvents = ctx.withEvents || false,
title,
desc,
class: classname,
ariaLabel = "archive box",
onclick,
onkeydown,
withEvents = ctx.withEvents || false,
title,
desc,
class: classname,
ariaLabel = 'archive box',
onclick,
onkeydown,
onkeyup,
...restProps
...restProps
}: Props = $props();
let ariaDescribedby = `${title?.id || ''} ${desc?.id || ''}`;
const hasDescription = $derived(!!(title?.id || desc?.id));
let viewBox: string = $state('');
let viewBox: string = $state('');
$effect(() => {
if (variation === 'mini') {
size = size || "20";
size = size || '20';
viewBox = '0 0 20 20';
} else if (variation === 'micro'){
size = size || "16";
} else if (variation === 'micro') {
size = size || '16';
viewBox = '0 0 16 16';
} else {
size = size || "24";
size = size || '24';
viewBox = '0 0 24 24';
}
})
});
</script>

{#if withEvents}
Expand All @@ -83,25 +82,58 @@
aria-describedby={hasDescription ? ariaDescribedby : undefined}
{viewBox}
stroke-width={strokeWidth}
onclick={onclick}
onkeydown={onkeydown}
onkeyup={onkeyup}
{onclick}
{onkeydown}
{onkeyup}
>
{#if title?.id && title.title}
<title id="{title.id}">{title.title}</title>
<title id={title.id}>{title.title}</title>
{/if}
{#if desc?.id && desc.desc}
<desc id="{desc.id}">{desc.desc}</desc>
<desc id={desc.id}>{desc.desc}</desc>
{/if}
{#if variation === 'outline'}
<path
d="M20.25 7.5L19.6246 18.1321C19.5546 19.3214 18.5698 20.25 17.3785 20.25H6.62154C5.43022 20.25 4.44538 19.3214 4.37542 18.1321L3.75 7.5M9.99976 11.25H13.9998M3.375 7.5H20.625C21.2463 7.5 21.75 6.99632 21.75 6.375V4.875C21.75 4.25368 21.2463 3.75 20.625 3.75H3.375C2.75368 3.75 2.25 4.25368 2.25 4.875V6.375C2.25 6.99632 2.75368 7.5 3.375 7.5Z"
stroke={color}
stroke-width={strokeWidth}
stroke-linecap="round"
stroke-linejoin="round"
/>
{:else if variation === 'mini'}
<path
d="M2 3C1.44772 3 1 3.44772 1 4V5C1 5.55228 1.44772 6 2 6H18C18.5523 6 19 5.55228 19 5V4C19 3.44772 18.5523 3 18 3H2Z"
fill={color}
/>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M2 7.5H18L17.1885 15.2094C17.0813 16.2273 16.223 17 15.1995 17H4.80052C3.77701 17 2.91866 16.2273 2.81151 15.2094L2 7.5ZM7 11C7 10.4477 7.44772 10 8 10H12C12.5523 10 13 10.4477 13 11C13 11.5523 12.5523 12 12 12H8C7.44772 12 7 11.5523 7 11Z"
fill={color}
/>
{:else if variation === 'micro'}
<path
d="M3 2C2.44772 2 2 2.44772 2 3V4C2 4.55228 2.44772 5 3 5H13C13.5523 5 14 4.55228 14 4V3C14 2.44772 13.5523 2 13 2H3Z"
fill={color}
/>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M3 6H13V12C13 13.1046 12.1046 14 11 14H5C3.89543 14 3 13.1046 3 12V6ZM6 8.75C6 8.33579 6.33579 8 6.75 8H9.25C9.66421 8 10 8.33579 10 8.75C10 9.16421 9.66421 9.5 9.25 9.5H6.75C6.33579 9.5 6 9.16421 6 8.75Z"
fill={color}
/>
{:else}
<path
d="M3.375 3C2.33947 3 1.5 3.83947 1.5 4.875V5.625C1.5 6.66053 2.33947 7.5 3.375 7.5H20.625C21.6605 7.5 22.5 6.66053 22.5 5.625V4.875C22.5 3.83947 21.6605 3 20.625 3H3.375Z"
fill={color}
/>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M3.08679 9L3.62657 18.1762C3.71984 19.7619 5.03296 21 6.62139 21H17.3783C18.9667 21 20.2799 19.7619 20.3731 18.1762L20.9129 9H3.08679ZM9.24976 12.75C9.24976 12.3358 9.58554 12 9.99976 12H13.9998C14.414 12 14.7498 12.3358 14.7498 12.75C14.7498 13.1642 14.414 13.5 13.9998 13.5H9.99976C9.58554 13.5 9.24976 13.1642 9.24976 12.75Z"
fill={color}
/>
{/if}
{#if variation === 'outline'}
<path d="M20.25 7.5L19.6246 18.1321C19.5546 19.3214 18.5698 20.25 17.3785 20.25H6.62154C5.43022 20.25 4.44538 19.3214 4.37542 18.1321L3.75 7.5M9.99976 11.25H13.9998M3.375 7.5H20.625C21.2463 7.5 21.75 6.99632 21.75 6.375V4.875C21.75 4.25368 21.2463 3.75 20.625 3.75H3.375C2.75368 3.75 2.25 4.25368 2.25 4.875V6.375C2.25 6.99632 2.75368 7.5 3.375 7.5Z" stroke="{color}" stroke-width="{strokeWidth}" stroke-linecap="round" stroke-linejoin="round"/>
{:else if variation === 'mini'}
<path d="M2 3C1.44772 3 1 3.44772 1 4V5C1 5.55228 1.44772 6 2 6H18C18.5523 6 19 5.55228 19 5V4C19 3.44772 18.5523 3 18 3H2Z" fill="{color}"/> <path fill-rule="evenodd" clip-rule="evenodd" d="M2 7.5H18L17.1885 15.2094C17.0813 16.2273 16.223 17 15.1995 17H4.80052C3.77701 17 2.91866 16.2273 2.81151 15.2094L2 7.5ZM7 11C7 10.4477 7.44772 10 8 10H12C12.5523 10 13 10.4477 13 11C13 11.5523 12.5523 12 12 12H8C7.44772 12 7 11.5523 7 11Z" fill="{color}"/>
{:else if variation === 'micro'}
<path d="M3 2C2.44772 2 2 2.44772 2 3V4C2 4.55228 2.44772 5 3 5H13C13.5523 5 14 4.55228 14 4V3C14 2.44772 13.5523 2 13 2H3Z" fill="{color}"/> <path fill-rule="evenodd" clip-rule="evenodd" d="M3 6H13V12C13 13.1046 12.1046 14 11 14H5C3.89543 14 3 13.1046 3 12V6ZM6 8.75C6 8.33579 6.33579 8 6.75 8H9.25C9.66421 8 10 8.33579 10 8.75C10 9.16421 9.66421 9.5 9.25 9.5H6.75C6.33579 9.5 6 9.16421 6 8.75Z" fill="{color}"/>
{:else}
<path d="M3.375 3C2.33947 3 1.5 3.83947 1.5 4.875V5.625C1.5 6.66053 2.33947 7.5 3.375 7.5H20.625C21.6605 7.5 22.5 6.66053 22.5 5.625V4.875C22.5 3.83947 21.6605 3 20.625 3H3.375Z" fill="{color}"/> <path fill-rule="evenodd" clip-rule="evenodd" d="M3.08679 9L3.62657 18.1762C3.71984 19.7619 5.03296 21 6.62139 21H17.3783C18.9667 21 20.2799 19.7619 20.3731 18.1762L20.9129 9H3.08679ZM9.24976 12.75C9.24976 12.3358 9.58554 12 9.99976 12H13.9998C14.414 12 14.7498 12.3358 14.7498 12.75C14.7498 13.1642 14.414 13.5 13.9998 13.5H9.99976C9.58554 13.5 9.24976 13.1642 9.24976 12.75Z" fill="{color}"/>
{/if}
</svg>
{:else}
<svg
Expand All @@ -118,20 +150,53 @@
stroke-width={strokeWidth}
>
{#if title?.id && title.title}
<title id="{title.id}">{title.title}</title>
<title id={title.id}>{title.title}</title>
{/if}
{#if desc?.id && desc.desc}
<desc id="{desc.id}">{desc.desc}</desc>
<desc id={desc.id}>{desc.desc}</desc>
{/if}
{#if variation === 'outline'}
<path
d="M20.25 7.5L19.6246 18.1321C19.5546 19.3214 18.5698 20.25 17.3785 20.25H6.62154C5.43022 20.25 4.44538 19.3214 4.37542 18.1321L3.75 7.5M9.99976 11.25H13.9998M3.375 7.5H20.625C21.2463 7.5 21.75 6.99632 21.75 6.375V4.875C21.75 4.25368 21.2463 3.75 20.625 3.75H3.375C2.75368 3.75 2.25 4.25368 2.25 4.875V6.375C2.25 6.99632 2.75368 7.5 3.375 7.5Z"
stroke={color}
stroke-width={strokeWidth}
stroke-linecap="round"
stroke-linejoin="round"
/>
{:else if variation === 'mini'}
<path
d="M2 3C1.44772 3 1 3.44772 1 4V5C1 5.55228 1.44772 6 2 6H18C18.5523 6 19 5.55228 19 5V4C19 3.44772 18.5523 3 18 3H2Z"
fill={color}
/>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M2 7.5H18L17.1885 15.2094C17.0813 16.2273 16.223 17 15.1995 17H4.80052C3.77701 17 2.91866 16.2273 2.81151 15.2094L2 7.5ZM7 11C7 10.4477 7.44772 10 8 10H12C12.5523 10 13 10.4477 13 11C13 11.5523 12.5523 12 12 12H8C7.44772 12 7 11.5523 7 11Z"
fill={color}
/>
{:else if variation === 'micro'}
<path
d="M3 2C2.44772 2 2 2.44772 2 3V4C2 4.55228 2.44772 5 3 5H13C13.5523 5 14 4.55228 14 4V3C14 2.44772 13.5523 2 13 2H3Z"
fill={color}
/>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M3 6H13V12C13 13.1046 12.1046 14 11 14H5C3.89543 14 3 13.1046 3 12V6ZM6 8.75C6 8.33579 6.33579 8 6.75 8H9.25C9.66421 8 10 8.33579 10 8.75C10 9.16421 9.66421 9.5 9.25 9.5H6.75C6.33579 9.5 6 9.16421 6 8.75Z"
fill={color}
/>
{:else}
<path
d="M3.375 3C2.33947 3 1.5 3.83947 1.5 4.875V5.625C1.5 6.66053 2.33947 7.5 3.375 7.5H20.625C21.6605 7.5 22.5 6.66053 22.5 5.625V4.875C22.5 3.83947 21.6605 3 20.625 3H3.375Z"
fill={color}
/>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M3.08679 9L3.62657 18.1762C3.71984 19.7619 5.03296 21 6.62139 21H17.3783C18.9667 21 20.2799 19.7619 20.3731 18.1762L20.9129 9H3.08679ZM9.24976 12.75C9.24976 12.3358 9.58554 12 9.99976 12H13.9998C14.414 12 14.7498 12.3358 14.7498 12.75C14.7498 13.1642 14.414 13.5 13.9998 13.5H9.99976C9.58554 13.5 9.24976 13.1642 9.24976 12.75Z"
fill={color}
/>
{/if}
{#if variation === 'outline'}
<path d="M20.25 7.5L19.6246 18.1321C19.5546 19.3214 18.5698 20.25 17.3785 20.25H6.62154C5.43022 20.25 4.44538 19.3214 4.37542 18.1321L3.75 7.5M9.99976 11.25H13.9998M3.375 7.5H20.625C21.2463 7.5 21.75 6.99632 21.75 6.375V4.875C21.75 4.25368 21.2463 3.75 20.625 3.75H3.375C2.75368 3.75 2.25 4.25368 2.25 4.875V6.375C2.25 6.99632 2.75368 7.5 3.375 7.5Z" stroke="{color}" stroke-width="{strokeWidth}" stroke-linecap="round" stroke-linejoin="round"/>
{:else if variation === 'mini'}
<path d="M2 3C1.44772 3 1 3.44772 1 4V5C1 5.55228 1.44772 6 2 6H18C18.5523 6 19 5.55228 19 5V4C19 3.44772 18.5523 3 18 3H2Z" fill="{color}"/> <path fill-rule="evenodd" clip-rule="evenodd" d="M2 7.5H18L17.1885 15.2094C17.0813 16.2273 16.223 17 15.1995 17H4.80052C3.77701 17 2.91866 16.2273 2.81151 15.2094L2 7.5ZM7 11C7 10.4477 7.44772 10 8 10H12C12.5523 10 13 10.4477 13 11C13 11.5523 12.5523 12 12 12H8C7.44772 12 7 11.5523 7 11Z" fill="{color}"/>
{:else if variation === 'micro'}
<path d="M3 2C2.44772 2 2 2.44772 2 3V4C2 4.55228 2.44772 5 3 5H13C13.5523 5 14 4.55228 14 4V3C14 2.44772 13.5523 2 13 2H3Z" fill="{color}"/> <path fill-rule="evenodd" clip-rule="evenodd" d="M3 6H13V12C13 13.1046 12.1046 14 11 14H5C3.89543 14 3 13.1046 3 12V6ZM6 8.75C6 8.33579 6.33579 8 6.75 8H9.25C9.66421 8 10 8.33579 10 8.75C10 9.16421 9.66421 9.5 9.25 9.5H6.75C6.33579 9.5 6 9.16421 6 8.75Z" fill="{color}"/>
{:else}
<path d="M3.375 3C2.33947 3 1.5 3.83947 1.5 4.875V5.625C1.5 6.66053 2.33947 7.5 3.375 7.5H20.625C21.6605 7.5 22.5 6.66053 22.5 5.625V4.875C22.5 3.83947 21.6605 3 20.625 3H3.375Z" fill="{color}"/> <path fill-rule="evenodd" clip-rule="evenodd" d="M3.08679 9L3.62657 18.1762C3.71984 19.7619 5.03296 21 6.62139 21H17.3783C18.9667 21 20.2799 19.7619 20.3731 18.1762L20.9129 9H3.08679ZM9.24976 12.75C9.24976 12.3358 9.58554 12 9.99976 12H13.9998C14.414 12 14.7498 12.3358 14.7498 12.75C14.7498 13.1642 14.414 13.5 13.9998 13.5H9.99976C9.58554 13.5 9.24976 13.1642 9.24976 12.75Z" fill="{color}"/>
{/if}
</svg>
{/if}

Expand All @@ -142,13 +207,13 @@
@prop size = ctx.size || '24'
@prop role = ctx.role || 'img'
@prop color = ctx.color || 'currentColor'
@prop variation = ctx.variation || "outline"
@prop variation = ctx.variation || 'outline'
@prop strokeWidth = ctx.strokeWidth || '1.5'
@prop withEvents = ctx.withEvents || false
@prop title
@prop desc
@prop class: classname
@prop ariaLabel = "archive box"
@prop ariaLabel = 'archive box'
@prop onclick
@prop onkeydown
@prop onkeyup
Expand Down
Loading

0 comments on commit 8839d06

Please sign in to comment.