@lumen-design/icon 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.
@@ -0,0 +1,43 @@
1
+ <script lang="ts">
2
+ import type { IconNode } from 'lucide'
3
+
4
+ interface IconProps {
5
+ icon: IconNode
6
+ size?: number | string
7
+ color?: string
8
+ strokeWidth?: number
9
+ class?: string
10
+ }
11
+
12
+ let { icon, size = 24, color = 'currentColor', strokeWidth = 2, class: cls = '', ...attrs }: IconProps = $props()
13
+
14
+ const sizeValue = $derived(typeof size === 'number' ? `${size}px` : size)
15
+
16
+ const classes = $derived(cls ? `lm-icon ${cls}` : 'lm-icon')
17
+
18
+ // 归一化图标节点:使用 $derived,基于 icon 变更计算,避免非反应式更新
19
+ type IconTuple = [string, Record<string, any>]
20
+ const normalized = $derived.by(() => {
21
+ const tuples = icon.filter((item: unknown) => Array.isArray(item)).map(([tag, nodeAttrs]: any) => [tag as string, Object.freeze({ ...nodeAttrs })]) as IconTuple[]
22
+ return Object.freeze(tuples) as ReadonlyArray<IconTuple>
23
+ })
24
+ </script>
25
+
26
+ <svg
27
+ {...attrs}
28
+ class={classes}
29
+ xmlns="http://www.w3.org/2000/svg"
30
+ width={sizeValue}
31
+ height={sizeValue}
32
+ viewBox="0 0 24 24"
33
+ fill="none"
34
+ stroke={color}
35
+ stroke-width={strokeWidth}
36
+ stroke-linecap="round"
37
+ stroke-linejoin="round"
38
+ >
39
+ {#each normalized as item}
40
+ {@const [tag, attrs] = item}
41
+ <svelte:element this={tag} {...attrs} />
42
+ {/each}
43
+ </svg>
@@ -0,0 +1,12 @@
1
+ import type { IconNode } from 'lucide';
2
+ interface IconProps {
3
+ icon: IconNode;
4
+ size?: number | string;
5
+ color?: string;
6
+ strokeWidth?: number;
7
+ class?: string;
8
+ }
9
+ declare const Icon: import("svelte").Component<IconProps, {}, "">;
10
+ type Icon = ReturnType<typeof Icon>;
11
+ export default Icon;
12
+ //# sourceMappingURL=Icon.svelte.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Icon.svelte.d.ts","sourceRoot":"","sources":["Icon.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAGnC,UAAU,SAAS;IACf,IAAI,EAAE,QAAQ,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACtB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,KAAK,CAAC,EAAE,MAAM,CAAA;CACjB;AA6BL,QAAA,MAAM,IAAI,+CAAwC,CAAC;AACnD,KAAK,IAAI,GAAG,UAAU,CAAC,OAAO,IAAI,CAAC,CAAC;AACpC,eAAe,IAAI,CAAC"}
@@ -0,0 +1,5 @@
1
+ export { default } from './Icon.svelte';
2
+ export { default as Icon } from './Icon.svelte';
3
+ export type { IconProps } from './types';
4
+ export type { IconNode } from 'lucide';
5
+ export { Check, X, Plus, Minus, Edit, Trash2, Copy, Download, Upload, Save, Search, Filter, Settings, RefreshCw, MoreVertical, MoreHorizontal, ChevronLeft, ChevronRight, ChevronUp, ChevronDown, ArrowLeft, ArrowRight, ArrowUp, ArrowDown, AlertCircle, AlertTriangle, CheckCircle, Info, XCircle, HelpCircle, Eye, EyeOff, Heart, Star, Home, Menu, Bell, User, Mail, Lock, Calendar, Clock, File, Folder, FileText, Image, Play, Pause, Volume2, VolumeX, } from 'lucide';
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,eAAe,CAAA;AAC/C,YAAY,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AACxC,YAAY,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAEtC,OAAO,EAEH,KAAK,EACL,CAAC,EACD,IAAI,EACJ,KAAK,EACL,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,MAAM,EACN,MAAM,EACN,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,cAAc,EAGd,WAAW,EACX,YAAY,EACZ,SAAS,EACT,WAAW,EACX,SAAS,EACT,UAAU,EACV,OAAO,EACP,SAAS,EAGT,WAAW,EACX,aAAa,EACb,WAAW,EACX,IAAI,EACJ,OAAO,EACP,UAAU,EAGV,GAAG,EACH,MAAM,EACN,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,QAAQ,EACR,KAAK,EAGL,IAAI,EACJ,MAAM,EACN,QAAQ,EACR,KAAK,EAGL,IAAI,EACJ,KAAK,EACL,OAAO,EACP,OAAO,GACV,MAAM,QAAQ,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,15 @@
1
+ export { default } from './Icon.svelte';
2
+ export { default as Icon } from './Icon.svelte';
3
+ export {
4
+ // Actions
5
+ Check, X, Plus, Minus, Edit, Trash2, Copy, Download, Upload, Save, Search, Filter, Settings, RefreshCw, MoreVertical, MoreHorizontal,
6
+ // Arrows
7
+ ChevronLeft, ChevronRight, ChevronUp, ChevronDown, ArrowLeft, ArrowRight, ArrowUp, ArrowDown,
8
+ // Status
9
+ AlertCircle, AlertTriangle, CheckCircle, Info, XCircle, HelpCircle,
10
+ // UI
11
+ Eye, EyeOff, Heart, Star, Home, Menu, Bell, User, Mail, Lock, Calendar, Clock,
12
+ // Files
13
+ File, Folder, FileText, Image,
14
+ // Media
15
+ Play, Pause, Volume2, VolumeX, } from 'lucide';
@@ -0,0 +1,14 @@
1
+ import type { IconNode } from 'lucide';
2
+ /** Icon 属性 */
3
+ export interface IconProps {
4
+ /** 图标 */
5
+ icon: IconNode;
6
+ /** 尺寸 */
7
+ size?: number | string;
8
+ /** 颜色 */
9
+ color?: string;
10
+ /** 描边宽度 */
11
+ strokeWidth?: number;
12
+ /** 自定义类名 */
13
+ class?: string;
14
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAEtC,cAAc;AACd,MAAM,WAAW,SAAS;IACtB,SAAS;IACT,IAAI,EAAE,QAAQ,CAAA;IACd,SAAS;IACT,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACtB,SAAS;IACT,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW;IACX,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,YAAY;IACZ,KAAK,CAAC,EAAE,MAAM,CAAA;CACjB"}
package/dist/types.js ADDED
@@ -0,0 +1 @@
1
+ export {};
package/package.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "@lumen-design/icon",
3
+ "version": "0.0.2",
4
+ "type": "module",
5
+ "main": "./dist/index.js",
6
+ "types": "./dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "svelte": "./dist/index.js",
11
+ "default": "./dist/index.js"
12
+ }
13
+ },
14
+ "files": ["dist"],
15
+ "scripts": {
16
+ "build": "svelte-package -i src -o dist --types",
17
+ "postbuild": "cp -f src/*.d.ts dist/ 2>/dev/null || true",
18
+ "check": "svelte-check --tsconfig ./tsconfig.json"
19
+ },
20
+ "peerDependencies": {
21
+ "svelte": "^5.0.0"
22
+ },
23
+ "dependencies": {
24
+ "lucide": "^0.563.0"
25
+ }
26
+ }