@joewinke/jatui 0.1.9 → 0.1.10

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@joewinke/jatui",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "private": false,
5
5
  "description": "Shared Svelte 5 component library for JAT projects",
6
6
  "type": "module",
@@ -0,0 +1,54 @@
1
+ <script lang="ts">
2
+ /**
3
+ * Stroke icon for a task issue_type value.
4
+ * Replaces the emoji returned by `typeIcon()`.
5
+ *
6
+ * Usage:
7
+ * <TaskTypeIcon type={task.issue_type} />
8
+ * <TaskTypeIcon type="bug" size={14} class="text-base-content/60" />
9
+ */
10
+
11
+ interface Props {
12
+ type: string | null | undefined
13
+ size?: number
14
+ class?: string
15
+ title?: string
16
+ }
17
+
18
+ let { type, size = 14, class: className = "", title }: Props = $props()
19
+
20
+ // Path data per type. Single-path lucide-style strokes so they inherit
21
+ // currentColor and size cleanly inside dense tables.
22
+ const paths: Record<string, string> = {
23
+ // Bug: body + antennae/legs
24
+ bug: "M12 4v2M8 6l1 2M16 6l-1 2M6 12H4M20 12h-2M6 16l-2 1M18 16l2 1M9 9h6v5a3 3 0 11-6 0V9z",
25
+ // Feature (spark): 4-point star
26
+ feature: "M12 3v4M12 17v4M3 12h4M17 12h4M5.5 5.5l2.5 2.5M16 16l2.5 2.5M5.5 18.5L8 16M16 8l2.5-2.5",
27
+ // Task: checklist
28
+ task: "M9 4h9a1 1 0 011 1v14a1 1 0 01-1 1H6a1 1 0 01-1-1V5a1 1 0 011-1h1M9 3h6v2H9zM8.5 11.5l1.5 1.5 3-3M8.5 16.5l1.5 1.5 3-3",
29
+ // Epic: mountain peaks
30
+ epic: "M3 19l5-8 4 6 3-4 6 6H3z",
31
+ // Default: document
32
+ document: "M13 3H6a1 1 0 00-1 1v16a1 1 0 001 1h12a1 1 0 001-1V9l-6-6zM13 3v6h6",
33
+ }
34
+
35
+ const d = $derived(paths[type ?? ""] ?? paths.document)
36
+ const label = $derived(title ?? (type ? `${type[0].toUpperCase()}${type.slice(1)}` : "Document"))
37
+ </script>
38
+
39
+ <svg
40
+ viewBox="0 0 24 24"
41
+ fill="none"
42
+ stroke="currentColor"
43
+ stroke-width="2"
44
+ stroke-linecap="round"
45
+ stroke-linejoin="round"
46
+ width={size}
47
+ height={size}
48
+ class={className}
49
+ role="img"
50
+ aria-label={label}
51
+ >
52
+ <title>{label}</title>
53
+ <path d={d} />
54
+ </svg>
package/src/lib/index.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  // Components — Universal
2
2
  export { default as UserAvatar } from './components/UserAvatar.svelte';
3
3
  export { default as SidebarUserFooter } from './components/SidebarUserFooter.svelte';
4
+ export { default as TaskTypeIcon } from './components/TaskTypeIcon.svelte';
4
5
 
5
6
  // Components — from JAT IDE
6
7
  export { default as SearchDropdown } from './components/SearchDropdown.svelte';
@@ -37,7 +37,9 @@ export function priorityColor(priority: string | null | undefined): string {
37
37
  }
38
38
 
39
39
  /**
40
- * Emoji icon for a task issue_type value.
40
+ * @deprecated Prefer the `<TaskTypeIcon type={…} />` component — it renders a
41
+ * stroke SVG that inherits `currentColor`, scales precisely, and avoids
42
+ * cross-OS emoji rendering drift. Kept only for backwards compatibility.
41
43
  * Usage: {typeIcon(task.issue_type)} {task.title}
42
44
  */
43
45
  export function typeIcon(type: string): string {