@elyracode/mini-lit 0.9.4

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 (142) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +22 -0
  3. package/dist/Alert.d.ts +12 -0
  4. package/dist/Alert.d.ts.map +1 -0
  5. package/dist/Alert.js +35 -0
  6. package/dist/Alert.js.map +1 -0
  7. package/dist/Badge.d.ts +8 -0
  8. package/dist/Badge.d.ts.map +1 -0
  9. package/dist/Badge.js +19 -0
  10. package/dist/Badge.js.map +1 -0
  11. package/dist/Button.d.ts +14 -0
  12. package/dist/Button.d.ts.map +1 -0
  13. package/dist/Button.js +60 -0
  14. package/dist/Button.js.map +1 -0
  15. package/dist/Card.d.ts +19 -0
  16. package/dist/Card.d.ts.map +1 -0
  17. package/dist/Card.js +76 -0
  18. package/dist/Card.js.map +1 -0
  19. package/dist/Checkbox.d.ts +15 -0
  20. package/dist/Checkbox.d.ts.map +1 -0
  21. package/dist/Checkbox.js +49 -0
  22. package/dist/Checkbox.js.map +1 -0
  23. package/dist/CodeBlock.d.ts +11 -0
  24. package/dist/CodeBlock.d.ts.map +1 -0
  25. package/dist/CodeBlock.js +90 -0
  26. package/dist/CodeBlock.js.map +1 -0
  27. package/dist/CopyButton.d.ts +11 -0
  28. package/dist/CopyButton.d.ts.map +1 -0
  29. package/dist/CopyButton.js +65 -0
  30. package/dist/CopyButton.js.map +1 -0
  31. package/dist/Dialog.d.ts +24 -0
  32. package/dist/Dialog.d.ts.map +1 -0
  33. package/dist/Dialog.js +72 -0
  34. package/dist/Dialog.js.map +1 -0
  35. package/dist/DialogBase.d.ts +13 -0
  36. package/dist/DialogBase.d.ts.map +1 -0
  37. package/dist/DialogBase.js +48 -0
  38. package/dist/DialogBase.js.map +1 -0
  39. package/dist/Diff.d.ts +8 -0
  40. package/dist/Diff.d.ts.map +1 -0
  41. package/dist/Diff.js +47 -0
  42. package/dist/Diff.js.map +1 -0
  43. package/dist/DownloadButton.d.ts +16 -0
  44. package/dist/DownloadButton.d.ts.map +1 -0
  45. package/dist/DownloadButton.js +53 -0
  46. package/dist/DownloadButton.js.map +1 -0
  47. package/dist/FileButton.d.ts +9 -0
  48. package/dist/FileButton.d.ts.map +1 -0
  49. package/dist/FileButton.js +53 -0
  50. package/dist/FileButton.js.map +1 -0
  51. package/dist/Input.d.ts +28 -0
  52. package/dist/Input.d.ts.map +1 -0
  53. package/dist/Input.js +58 -0
  54. package/dist/Input.js.map +1 -0
  55. package/dist/Label.d.ts +9 -0
  56. package/dist/Label.d.ts.map +1 -0
  57. package/dist/Label.js +17 -0
  58. package/dist/Label.js.map +1 -0
  59. package/dist/LanguageSelector.d.ts +14 -0
  60. package/dist/LanguageSelector.d.ts.map +1 -0
  61. package/dist/LanguageSelector.js +92 -0
  62. package/dist/LanguageSelector.js.map +1 -0
  63. package/dist/MarkdownBlock.d.ts +10 -0
  64. package/dist/MarkdownBlock.d.ts.map +1 -0
  65. package/dist/MarkdownBlock.js +257 -0
  66. package/dist/MarkdownBlock.js.map +1 -0
  67. package/dist/ModeToggle.d.ts +14 -0
  68. package/dist/ModeToggle.d.ts.map +1 -0
  69. package/dist/ModeToggle.js +59 -0
  70. package/dist/ModeToggle.js.map +1 -0
  71. package/dist/PreviewCode.d.ts +12 -0
  72. package/dist/PreviewCode.d.ts.map +1 -0
  73. package/dist/PreviewCode.js +80 -0
  74. package/dist/PreviewCode.js.map +1 -0
  75. package/dist/PreviewCodeToggle.d.ts +15 -0
  76. package/dist/PreviewCodeToggle.d.ts.map +1 -0
  77. package/dist/PreviewCodeToggle.js +55 -0
  78. package/dist/PreviewCodeToggle.js.map +1 -0
  79. package/dist/Progress.d.ts +10 -0
  80. package/dist/Progress.d.ts.map +1 -0
  81. package/dist/Progress.js +27 -0
  82. package/dist/Progress.js.map +1 -0
  83. package/dist/PromptDialog.d.ts +20 -0
  84. package/dist/PromptDialog.d.ts.map +1 -0
  85. package/dist/PromptDialog.js +114 -0
  86. package/dist/PromptDialog.js.map +1 -0
  87. package/dist/Select.d.ts +25 -0
  88. package/dist/Select.d.ts.map +1 -0
  89. package/dist/Select.js +335 -0
  90. package/dist/Select.js.map +1 -0
  91. package/dist/Separator.d.ts +10 -0
  92. package/dist/Separator.d.ts.map +1 -0
  93. package/dist/Separator.js +19 -0
  94. package/dist/Separator.js.map +1 -0
  95. package/dist/Sidebar.d.ts +27 -0
  96. package/dist/Sidebar.d.ts.map +1 -0
  97. package/dist/Sidebar.js +151 -0
  98. package/dist/Sidebar.js.map +1 -0
  99. package/dist/SplitPanel.d.ts +40 -0
  100. package/dist/SplitPanel.d.ts.map +1 -0
  101. package/dist/SplitPanel.js +275 -0
  102. package/dist/SplitPanel.js.map +1 -0
  103. package/dist/Switch.d.ts +13 -0
  104. package/dist/Switch.d.ts.map +1 -0
  105. package/dist/Switch.js +48 -0
  106. package/dist/Switch.js.map +1 -0
  107. package/dist/Textarea.d.ts +21 -0
  108. package/dist/Textarea.d.ts.map +1 -0
  109. package/dist/Textarea.js +67 -0
  110. package/dist/Textarea.js.map +1 -0
  111. package/dist/ThemeToggle.d.ts +11 -0
  112. package/dist/ThemeToggle.d.ts.map +1 -0
  113. package/dist/ThemeToggle.js +91 -0
  114. package/dist/ThemeToggle.js.map +1 -0
  115. package/dist/component.d.ts +190 -0
  116. package/dist/component.d.ts.map +1 -0
  117. package/dist/component.js +241 -0
  118. package/dist/component.js.map +1 -0
  119. package/dist/i18n.d.ts +73 -0
  120. package/dist/i18n.d.ts.map +1 -0
  121. package/dist/i18n.js +146 -0
  122. package/dist/i18n.js.map +1 -0
  123. package/dist/icons.d.ts +7 -0
  124. package/dist/icons.d.ts.map +1 -0
  125. package/dist/icons.js +21 -0
  126. package/dist/icons.js.map +1 -0
  127. package/dist/index.d.ts +4 -0
  128. package/dist/index.d.ts.map +1 -0
  129. package/dist/index.js +8 -0
  130. package/dist/index.js.map +1 -0
  131. package/dist/mini.d.ts +19 -0
  132. package/dist/mini.d.ts.map +1 -0
  133. package/dist/mini.js +29 -0
  134. package/dist/mini.js.map +1 -0
  135. package/llms.txt +681 -0
  136. package/package.json +69 -0
  137. package/src/styles/base.css +63 -0
  138. package/src/styles/themes/claude.css +155 -0
  139. package/src/styles/themes/default.css +102 -0
  140. package/src/styles/utils/markdown.css +104 -0
  141. package/src/styles/utils/math.css +7 -0
  142. package/src/styles/utils/syntax-highlighting.css +134 -0
package/llms.txt ADDED
@@ -0,0 +1,681 @@
1
+ # mini-lit Package Reference
2
+
3
+ Lightweight Lit components with shadcn-inspired theming and Tailwind CSS v4 integration.
4
+ Live demo: https://minilit.mariozechner.at
5
+
6
+ ## Important: How to Use This Documentation with LLMs
7
+
8
+ **Before using any component, instruct your LLM to read the source files** to fully understand:
9
+ - The exact props interface and TypeScript types
10
+ - How components handle different prop combinations
11
+ - Available variants, sizes, and options
12
+ - Internal implementation and rendering logic
13
+ - Function overloads and shorthand syntaxes
14
+
15
+ ### Files to Read for Component Implementation:
16
+
17
+ **Functional Components** (stateless, return TemplateResult):
18
+ - `src/Alert.ts` - Alert with title and description
19
+ - `src/Badge.ts` - Status indicators with variants
20
+ - `src/Button.ts` - Buttons with loading, variants, sizes
21
+ - `src/Card.ts` - Cards with header, content, footer sections
22
+ - `src/Checkbox.ts` - Checkbox with label and indeterminate state
23
+ - `src/Dialog.ts` - Modal dialogs with header/footer
24
+ - `src/Input.ts` - Text inputs with validation
25
+ - `src/Label.ts` - Form labels with required indicator
26
+ - `src/Progress.ts` - Progress bars
27
+ - `src/Select.ts` - Dropdowns with groups and icons
28
+ - `src/Separator.ts` - Visual dividers
29
+ - `src/Switch.ts` - Toggle switches
30
+ - `src/Textarea.ts` - Multi-line text input
31
+ - `src/Diff.ts` - Code difference viewer
32
+ - `src/FileButton.ts` - File upload button
33
+ - `src/CopyButton.ts` - Copy to clipboard button
34
+ - `src/DownloadButton.ts` - Download file button
35
+
36
+ **Custom Elements** (stateful LitElement classes):
37
+ - `src/CodeBlock.ts` - Syntax highlighted code (`<code-block>`)
38
+ - `src/MarkdownBlock.ts` - Markdown with math (`<markdown-block>`)
39
+ - `src/ThemeToggle.ts` - Dark/light switcher (`<theme-toggle>`)
40
+ - `src/LanguageSelector.ts` - i18n language picker (`<language-selector>`)
41
+ - `src/SplitPanel.ts` - Resizable panels (`<split-panel>`)
42
+ - `src/ModeToggle.ts` - Mode switcher (`<mode-toggle>`)
43
+ - `src/PreviewCode.ts` - Preview/code toggle (`<preview-code>`)
44
+ - `src/Sidebar.ts` - Collapsible sidebar (`<sidebar>`)
45
+
46
+ **Core Systems**:
47
+ - `src/mini.ts` - Core utilities (fc, createState, refs, types)
48
+ - `src/i18n.ts` - Internationalization system
49
+ - `src/icons.ts` - Icon rendering utilities
50
+ - `src/index.ts` - Main exports
51
+
52
+ ## Quick Setup
53
+
54
+ ```bash
55
+ npm install lit @mariozechner/mini-lit
56
+ ```
57
+
58
+ Configure Tailwind CSS v4:
59
+ ```css
60
+ /* src/app.css */
61
+ @import "@mariozechner/mini-lit/styles/themes/default.css";
62
+ @source "../node_modules/@mariozechner/mini-lit/dist";
63
+ @import "tailwindcss";
64
+ ```
65
+
66
+ **Available theme files:**
67
+ - `@mariozechner/mini-lit/styles/themes/default.css` - Clean modern theme
68
+ - `@mariozechner/mini-lit/styles/themes/claude.css` - Claude-inspired theme
69
+
70
+ ## Component Architecture
71
+
72
+ mini-lit provides two component types:
73
+
74
+ 1. **Functional Components**: Stateless, return TemplateResult
75
+ - Alert, Badge, Button, Card, Checkbox, Dialog, Input, Label, Progress, Select, Separator, Switch, Textarea
76
+
77
+ 2. **Custom Elements**: Stateful LitElement classes with HTML tags
78
+ - `<code-block>`, `<markdown-block>`, `<theme-toggle>`, `<language-selector>`, `<split-panel>`, `<mode-toggle>`, `<preview-code>`
79
+
80
+ ## Core Components Usage
81
+ ## Tree-Shaking & Bundle Optimization
82
+
83
+ **CRITICAL**: The root index (`@mariozechner/mini-lit`) now **ONLY** exports core utilities (component system, i18n, and icons). Individual components are **NOT** exported from the root to enforce optimal tree-shaking.
84
+
85
+ ### What's Exported from Root Index
86
+ ```typescript
87
+ // ✅ Core utilities available from root
88
+ import {
89
+ // Component system
90
+ ComponentLitBase, createComponent, defineComponent, styleComponent,
91
+ // i18n system
92
+ i18n, setTranslations, setLanguage, getCurrentLanguage,
93
+ defaultEnglish, defaultGerman,
94
+ // Icons
95
+ icon
96
+ } from "@mariozechner/mini-lit";
97
+ ```
98
+
99
+ ### Component Imports (Required)
100
+ ```typescript
101
+ // ✅ MUST import components from their individual files
102
+ import { Button } from "@mariozechner/mini-lit/dist/Button.js";
103
+ import { Card } from "@mariozechner/mini-lit/dist/Card.js";
104
+ import { Input } from "@mariozechner/mini-lit/dist/Input.js";
105
+ import "@mariozechner/mini-lit/dist/ThemeToggle.js";
106
+
107
+ // ❌ Components are NOT exported from root
108
+ import { Button, Card } from "@mariozechner/mini-lit"; // Won't work!
109
+ ```
110
+
111
+ **Bundle Size**:
112
+ - Direct component imports: ~50-100KB (only what you use)
113
+ - Core utilities from root: ~20KB
114
+
115
+ **Available Paths**:
116
+ - Functional components: `/dist/Button.js`, `/dist/Card.js`, `/dist/Input.js`, `/dist/Select.js`, `/dist/Checkbox.js`, `/dist/Switch.js`, `/dist/Textarea.js`, `/dist/Label.js`, `/dist/Badge.js`, `/dist/Alert.js`, `/dist/Progress.js`, `/dist/Separator.js`, `/dist/Dialog.js`, `/dist/CopyButton.js`, `/dist/DownloadButton.js`, `/dist/FileButton.js`, `/dist/Diff.js`
117
+ - Custom elements: `/dist/ThemeToggle.js`, `/dist/CodeBlock.js`, `/dist/MarkdownBlock.js`, `/dist/LanguageSelector.js`, `/dist/SplitPanel.js`, `/dist/ModeToggle.js`, `/dist/PreviewCode.js`, `/dist/Sidebar.js`
118
+ - Core utilities: `/dist/mini.js` (fc, createState, refs), `/dist/i18n.js`, `/dist/icons.js`
119
+
120
+
121
+
122
+ ### Button
123
+ ```typescript
124
+ import { Button } from "@mariozechner/mini-lit/dist/Button.js";
125
+
126
+ // Object syntax
127
+ Button({
128
+ variant: "default", // "default" | "destructive" | "outline" | "secondary" | "ghost" | "link"
129
+ size: "md", // "sm" | "md" | "lg" | "icon"
130
+ disabled: false,
131
+ loading: false,
132
+ onClick: (e) => console.log("clicked"),
133
+ children: "Click me"
134
+ })
135
+
136
+ // Shorthand syntax
137
+ Button("Click me", "primary", "sm")
138
+ ```
139
+
140
+ ### Card
141
+ ```typescript
142
+ import { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter } from "@mariozechner/mini-lit/dist/Card.js";
143
+
144
+ Card({
145
+ hoverable: true,
146
+ children: html`
147
+ ${CardHeader(html`
148
+ ${CardTitle("Card Title")}
149
+ ${CardDescription("Card description")}
150
+ `)}
151
+ ${CardContent("Main content here")}
152
+ ${CardFooter("Footer content")}
153
+ `
154
+ })
155
+ ```
156
+
157
+ ### Input
158
+ ```typescript
159
+ import { Input } from "@mariozechner/mini-lit/dist/Input.js";
160
+
161
+ Input({
162
+ type: "text", // "text" | "email" | "password" | "number" | "url" | "tel" | "search" | "date"
163
+ size: "md", // "sm" | "md" | "lg"
164
+ value: "",
165
+ placeholder: "Enter text",
166
+ label: "Name",
167
+ error: "",
168
+ disabled: false,
169
+ required: true,
170
+ onInput: (e) => console.log(e.target.value),
171
+ onChange: (e) => console.log("changed")
172
+ })
173
+ ```
174
+
175
+ ### Select
176
+ ```typescript
177
+ import { Select } from "@mariozechner/mini-lit/dist/Select.js";
178
+
179
+ Select({
180
+ value: "option1",
181
+ placeholder: "Select an option",
182
+ options: [
183
+ { value: "option1", label: "Option 1" },
184
+ { value: "option2", label: "Option 2", disabled: true },
185
+ { value: "option3", label: "Option 3", icon: icon(Star) }
186
+ ],
187
+ // Or grouped options:
188
+ options: [
189
+ {
190
+ label: "Group 1",
191
+ options: [
192
+ { value: "a", label: "Item A" },
193
+ { value: "b", label: "Item B" }
194
+ ]
195
+ }
196
+ ],
197
+ onChange: (value) => console.log(value),
198
+ size: "md", // "sm" | "md" | "lg"
199
+ variant: "default", // "default" | "ghost" | "outline"
200
+ fitContent: false, // Auto-width to content
201
+ width: "180px"
202
+ })
203
+ ```
204
+
205
+ ### Checkbox & Switch
206
+ ```typescript
207
+ import { Checkbox } from "@mariozechner/mini-lit/dist/Checkbox.js";
208
+ import { Switch } from "@mariozechner/mini-lit/dist/Switch.js";
209
+
210
+ Checkbox({
211
+ checked: false,
212
+ indeterminate: false,
213
+ label: "Accept terms",
214
+ disabled: false,
215
+ onChange: (checked) => console.log(checked)
216
+ })
217
+
218
+ Switch({
219
+ checked: false,
220
+ label: "Enable notifications",
221
+ onChange: (checked) => console.log(checked)
222
+ })
223
+ ```
224
+
225
+ ### Dialog
226
+ ```typescript
227
+ import { Dialog, DialogContent, DialogHeader, DialogFooter } from "@mariozechner/mini-lit/dist/Dialog.js";
228
+
229
+ Dialog({
230
+ isOpen: true,
231
+ onClose: () => console.log("closed"),
232
+ width: "600px",
233
+ height: "auto",
234
+ children: html`
235
+ ${DialogContent(html`
236
+ ${DialogHeader({
237
+ title: "Dialog Title",
238
+ description: "Dialog description"
239
+ })}
240
+ <div>Main content</div>
241
+ ${DialogFooter(html`
242
+ ${Button({ children: "Cancel" })}
243
+ ${Button({ variant: "primary", children: "Confirm" })}
244
+ `)}
245
+ `)}
246
+ `
247
+ })
248
+ ```
249
+
250
+ ### Alert & Badge
251
+ ```typescript
252
+ import { Alert, AlertTitle, AlertDescription } from "@mariozechner/mini-lit/dist/Alert.js";
253
+ import { Badge } from "@mariozechner/mini-lit/dist/Badge.js";
254
+
255
+ Alert({
256
+ variant: "default", // "default" | "destructive"
257
+ children: html`
258
+ ${AlertTitle("Alert Title")}
259
+ ${AlertDescription("Alert message here")}
260
+ `
261
+ })
262
+
263
+ Badge({
264
+ variant: "default", // "default" | "secondary" | "destructive" | "outline"
265
+ children: "New"
266
+ })
267
+ ```
268
+
269
+ ### Progress
270
+ ```typescript
271
+ import { Progress } from "@mariozechner/mini-lit/dist/Progress.js";
272
+
273
+ Progress({
274
+ value: 50,
275
+ max: 100,
276
+ className: "w-full"
277
+ })
278
+ ```
279
+
280
+ ### Separator
281
+ ```typescript
282
+ import { Separator } from "@mariozechner/mini-lit/dist/Separator.js";
283
+
284
+ Separator({
285
+ orientation: "horizontal", // "horizontal" | "vertical"
286
+ decorative: true
287
+ })
288
+ ```
289
+
290
+ ## Custom Elements
291
+
292
+ ### CodeBlock
293
+ ```html
294
+ <code-block
295
+ language="typescript"
296
+ code="${btoa('const greeting = "Hello";')}"
297
+ showLineNumbers="${true}"
298
+ showCopyButton="${true}">
299
+ </code-block>
300
+ ```
301
+
302
+ ### MarkdownBlock
303
+ ```html
304
+ <markdown-block
305
+ content="# Heading\nSupports **markdown** with $LaTeX$ math"
306
+ isThinking="${false}"
307
+ escapeHtml="${true}">
308
+ </markdown-block>
309
+ ```
310
+
311
+ ### ThemeToggle
312
+ ```html
313
+ <!-- Automatic dark/light mode switcher -->
314
+ <theme-toggle></theme-toggle>
315
+ ```
316
+
317
+ ### LanguageSelector
318
+ ```html
319
+ <!-- Dropdown for language switching -->
320
+ <language-selector></language-selector>
321
+ ```
322
+
323
+ ### SplitPanel
324
+ ```html
325
+ <split-panel
326
+ .leftPanel=${html`<div>Left content</div>`}
327
+ .rightPanel=${html`<div>Right content</div>`}
328
+ initialSplit="50"
329
+ minSize="200"
330
+ hideRight="${false}"
331
+ vertical="${false}">
332
+ </split-panel>
333
+ ```
334
+
335
+ ### ModeToggle
336
+ ```html
337
+ <mode-toggle
338
+ .modes=${["Preview", "Code"]}
339
+ selectedIndex="0"
340
+ @mode-change=${(e) => console.log(e.detail)}>
341
+ </mode-toggle>
342
+ ```
343
+
344
+ ## Icons
345
+
346
+ ```typescript
347
+ import { icon } from "@mariozechner/mini-lit/dist/icons.js";
348
+ import { Send, Settings, User } from "lucide";
349
+
350
+ // Render icon with size
351
+ icon(Send) // Default size
352
+ icon(Send, "sm") // 16px
353
+ icon(Send, "md") // 20px
354
+ icon(Send, "lg") // 24px
355
+ icon(Send, "xl") // 28px
356
+
357
+ // In component
358
+ Button({
359
+ children: html`${icon(Send, "sm")} Send Message`
360
+ })
361
+ ```
362
+
363
+ ## Internationalization (i18n)
364
+
365
+ **Read `src/i18n.ts` for complete implementation details.**
366
+
367
+ The i18n system provides:
368
+ - Type-safe message keys with TypeScript
369
+ - Support for parameterized messages (functions)
370
+ - Browser language detection
371
+ - localStorage persistence
372
+ - Default English and German translations
373
+
374
+ ### Setup TypeScript Interface
375
+ ```typescript
376
+ // Extend with your messages
377
+ declare module "@mariozechner/mini-lit" {
378
+ interface i18nMessages extends MiniLitRequiredMessages {
379
+ Welcome: string;
380
+ Settings: string;
381
+ itemCount: (count: number) => string;
382
+ greeting: (name: string, time: string) => string;
383
+ }
384
+ }
385
+ ```
386
+
387
+ ### Configure Translations
388
+ ```typescript
389
+ import { setTranslations, defaultEnglish, defaultGerman } from "@mariozechner/mini-lit";
390
+
391
+ setTranslations({
392
+ en: {
393
+ ...defaultEnglish, // Required mini-lit messages
394
+ Welcome: "Welcome",
395
+ Settings: "Settings",
396
+ itemCount: (count) => count === 1 ? "1 item" : `${count} items`,
397
+ greeting: (name, time) => `Good ${time}, ${name}!`
398
+ },
399
+ de: {
400
+ ...defaultGerman,
401
+ Welcome: "Willkommen",
402
+ Settings: "Einstellungen",
403
+ itemCount: (count) => count === 1 ? "1 Artikel" : `${count} Artikel`,
404
+ greeting: (name, time) => `Guten ${time}, ${name}!`
405
+ }
406
+ });
407
+ ```
408
+
409
+ ### Use in Components
410
+ ```typescript
411
+ import { i18n, getCurrentLanguage, setLanguage } from "@mariozechner/mini-lit";
412
+
413
+ // Simple strings
414
+ ${i18n("Welcome")}
415
+
416
+ // Functions with parameters
417
+ ${i18n("itemCount")(5)} // "5 items"
418
+ ${i18n("greeting")("Alice", "morning")} // "Good morning, Alice!"
419
+
420
+ // Language management
421
+ getCurrentLanguage() // Returns current language code
422
+ setLanguage("de") // Switch language and reload page
423
+ ```
424
+
425
+ ## Utility Components
426
+
427
+ ### FileButton
428
+ ```typescript
429
+ import { FileButton } from "@mariozechner/mini-lit/dist/FileButton.js";
430
+
431
+ FileButton({
432
+ accept: ".pdf,.doc",
433
+ multiple: true,
434
+ maxFileSize: 5 * 1024 * 1024, // 5MB
435
+ onFilesSelected: (files) => console.log(files),
436
+ children: "Upload Files"
437
+ })
438
+ ```
439
+
440
+ ### CopyButton
441
+ ```typescript
442
+ import { CopyButton } from "@mariozechner/mini-lit/dist/CopyButton.js";
443
+
444
+ CopyButton({
445
+ text: "Text to copy",
446
+ onCopy: () => console.log("Copied!"),
447
+ children: "Copy"
448
+ })
449
+ ```
450
+
451
+ ### DownloadButton
452
+ ```typescript
453
+ import { DownloadButton } from "@mariozechner/mini-lit/dist/DownloadButton.js";
454
+
455
+ DownloadButton({
456
+ data: "File content here",
457
+ filename: "output.txt",
458
+ mimeType: "text/plain",
459
+ children: "Download"
460
+ })
461
+ ```
462
+
463
+ ### Diff Viewer
464
+ ```typescript
465
+ import { Diff } from "@mariozechner/mini-lit/dist/Diff.js";
466
+
467
+ Diff({
468
+ oldText: "Original text",
469
+ newText: "Modified text",
470
+ title: "Changes"
471
+ })
472
+ ```
473
+
474
+ ## mini.ts Core Utilities
475
+
476
+ ### Functional Component Helper
477
+ ```typescript
478
+ import { fc, html, type TemplateResult } from "@mariozechner/mini-lit/dist/mini.js";
479
+
480
+ const MyComponent = fc<{ text: string }>(({ text }) => {
481
+ return html`<div>${text}</div>`;
482
+ });
483
+ ```
484
+
485
+ ### Reactive State
486
+ ```typescript
487
+ import { createState } from "@mariozechner/mini-lit/dist/mini.js";
488
+
489
+ const state = createState({
490
+ count: 0,
491
+ name: ""
492
+ });
493
+
494
+ // Subscribe to changes
495
+ const unsubscribe = state.__subscribe(() => {
496
+ console.log("State changed");
497
+ });
498
+
499
+ // Update state (triggers subscribers)
500
+ state.count++;
501
+ ```
502
+
503
+ ### Refs
504
+ ```typescript
505
+ import { createRef, ref } from "@mariozechner/mini-lit/dist/mini.js";
506
+
507
+ const inputRef = createRef<HTMLInputElement>();
508
+
509
+ html`
510
+ <input ${ref(inputRef)} />
511
+ <button @click=${() => console.log(inputRef.value?.value)}>
512
+ Log Value
513
+ </button>
514
+ `
515
+ ```
516
+
517
+ ## Theming
518
+
519
+ ### Available Themes
520
+ - `default.css` - Clean modern theme
521
+ - `claude.css` - Claude-inspired theme
522
+
523
+ ### Dark Mode
524
+ ```javascript
525
+ // Toggle programmatically
526
+ document.documentElement.classList.toggle("dark");
527
+
528
+ // Or use built-in component
529
+ <theme-toggle></theme-toggle>
530
+ ```
531
+
532
+ ### Custom Themes
533
+ Create custom themes using CSS variables:
534
+ ```css
535
+ :root {
536
+ --background: 0 0% 100%;
537
+ --foreground: 222.2 84% 4.9%;
538
+ --primary: 221.2 83.2% 53.3%;
539
+ --primary-foreground: 210 40% 98%;
540
+ /* ... other variables */
541
+ }
542
+
543
+ .dark {
544
+ --background: 222.2 84% 4.9%;
545
+ --foreground: 210 40% 98%;
546
+ /* ... dark mode overrides */
547
+ }
548
+ ```
549
+
550
+ ## Component Props Interface
551
+
552
+ ### BaseComponentProps
553
+ All components accept:
554
+ - `className?: string` - Additional CSS classes
555
+ - `children?: TemplateResult | string | number`
556
+
557
+ ### ComponentPropsWithoutChildren
558
+ For components without children:
559
+ - `className?: string`
560
+
561
+ ## Complete Example
562
+
563
+ ```typescript
564
+ import { html, render } from "lit";
565
+ import { Button } from "@mariozechner/mini-lit/dist/Button.js";
566
+ import { Card, CardContent } from "@mariozechner/mini-lit/dist/Card.js";
567
+ import { Input } from "@mariozechner/mini-lit/dist/Input.js";
568
+ import { Select } from "@mariozechner/mini-lit/dist/Select.js";
569
+ import { Switch } from "@mariozechner/mini-lit/dist/Switch.js";
570
+ import { icon, i18n, setTranslations, defaultEnglish } from "@mariozechner/mini-lit";
571
+ import "@mariozechner/mini-lit/dist/ThemeToggle.js";
572
+ import { Send } from "lucide";
573
+ import "./app.css";
574
+
575
+ // Setup i18n
576
+ setTranslations({
577
+ en: {
578
+ ...defaultEnglish,
579
+ Welcome: "Welcome to mini-lit"
580
+ }
581
+ });
582
+
583
+ // State management
584
+ const state = {
585
+ name: "",
586
+ theme: "light",
587
+ notifications: true
588
+ };
589
+
590
+ const App = () => html`
591
+ <div class="p-8 bg-background min-h-screen">
592
+ <theme-toggle class="fixed top-4 right-4"></theme-toggle>
593
+
594
+ ${Card({
595
+ children: html`
596
+ ${CardContent(html`
597
+ <h1 class="text-2xl font-bold mb-4">${i18n("Welcome")}</h1>
598
+
599
+ ${Input({
600
+ label: "Name",
601
+ value: state.name,
602
+ onInput: (e) => state.name = e.target.value
603
+ })}
604
+
605
+ ${Select({
606
+ value: state.theme,
607
+ options: [
608
+ { value: "light", label: "Light Theme" },
609
+ { value: "dark", label: "Dark Theme" }
610
+ ],
611
+ onChange: (value) => state.theme = value
612
+ })}
613
+
614
+ ${Switch({
615
+ checked: state.notifications,
616
+ label: "Enable notifications",
617
+ onChange: (checked) => state.notifications = checked
618
+ })}
619
+
620
+ ${Button({
621
+ variant: "primary",
622
+ children: html`${icon(Send, "sm")} Submit`,
623
+ onClick: () => console.log(state)
624
+ })}
625
+ `)}
626
+ `
627
+ })}
628
+ </div>
629
+ `;
630
+
631
+ render(App(), document.body);
632
+ ```
633
+
634
+ ## TypeScript Support
635
+
636
+ All components are fully typed. Import types:
637
+ ```typescript
638
+ import type {
639
+ ButtonProps, ButtonVariant, ButtonSize,
640
+ InputProps, InputType, InputSize,
641
+ SelectOption, SelectGroup,
642
+ AlertProps, AlertVariant,
643
+ BaseComponentProps,
644
+ TemplateResult
645
+ } from "@mariozechner/mini-lit";
646
+ ```
647
+
648
+ ## Package Exports
649
+
650
+ - Main: `@mariozechner/mini-lit`
651
+ - Styles: `@mariozechner/mini-lit/styles/*`
652
+ - Components: Imported from main export
653
+
654
+ ## Performance Tips
655
+
656
+ 1. Use functional components for stateless UI
657
+ 2. Use custom elements only when internal state is needed
658
+ 3. Batch DOM updates with Lit's rendering system
659
+ 4. Leverage reactive state for efficient updates
660
+ 5. Use refs sparingly for direct DOM access
661
+
662
+ ## Browser Support
663
+
664
+ Requires modern browsers with:
665
+ - ES2020+ support
666
+ - Web Components support
667
+ - CSS custom properties
668
+ - CSS grid and flexbox
669
+
670
+ ## Dependencies
671
+
672
+ - lit: ^3.3.1 (peer dependency)
673
+ - highlight.js: Code syntax highlighting
674
+ - marked: Markdown parsing
675
+ - katex: LaTeX math rendering
676
+ - lucide: Icon library
677
+ - diff: Text diffing
678
+
679
+ ## License
680
+
681
+ MIT