@joniguerini/lume 0.0.0-stage → 1.9.1

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 (226) hide show
  1. package/LICENSE +25 -0
  2. package/README.md +62 -2
  3. package/base.css +165 -0
  4. package/bin/lumeui.mjs +163 -0
  5. package/components/alert.css +156 -0
  6. package/components/banner.css +98 -0
  7. package/components/button.css +291 -0
  8. package/components/calendar.css +532 -0
  9. package/components/carousel.css +175 -0
  10. package/components/chart.css +813 -0
  11. package/components/chat.css +670 -0
  12. package/components/checkbox.css +212 -0
  13. package/components/chip.css +224 -0
  14. package/components/code.css +36 -0
  15. package/components/color-picker.css +192 -0
  16. package/components/command.css +148 -0
  17. package/components/content.css +211 -0
  18. package/components/editor.css +174 -0
  19. package/components/feedback.css +320 -0
  20. package/components/filters.css +103 -0
  21. package/components/form.css +455 -0
  22. package/components/image-viewer.css +237 -0
  23. package/components/layers.css +138 -0
  24. package/components/link.css +87 -0
  25. package/components/loading.css +260 -0
  26. package/components/menu.css +180 -0
  27. package/components/modal.css +209 -0
  28. package/components/navigation.css +507 -0
  29. package/components/notifications.css +186 -0
  30. package/components/number-field.css +52 -0
  31. package/components/otp.css +119 -0
  32. package/components/panel.css +208 -0
  33. package/components/picker.css +207 -0
  34. package/components/rating.css +143 -0
  35. package/components/resizable.css +173 -0
  36. package/components/scrollbar.css +110 -0
  37. package/components/select.css +477 -0
  38. package/components/shell.css +837 -0
  39. package/components/slider.css +189 -0
  40. package/components/sortable.css +287 -0
  41. package/components/surfaces.css +182 -0
  42. package/components/switch.css +115 -0
  43. package/components/table.css +228 -0
  44. package/components/tabs.css +190 -0
  45. package/components/tags.css +83 -0
  46. package/components/toast.css +164 -0
  47. package/components/toolbar.css +80 -0
  48. package/components/upload.css +181 -0
  49. package/ds.css +48 -0
  50. package/fonts/Geist-LICENSE.txt +92 -0
  51. package/fonts/Geist-Variable.woff2 +0 -0
  52. package/fonts/GeistSerif-Regular.woff2 +0 -0
  53. package/fonts/JetBrainsMono-LICENSE.txt +93 -0
  54. package/fonts/JetBrainsMono-Variable.woff2 +0 -0
  55. package/fonts.css +29 -0
  56. package/icons/icons.d.ts +5 -0
  57. package/icons/icons.js +266 -0
  58. package/js/back-to-top.d.ts +2 -0
  59. package/js/back-to-top.js +62 -0
  60. package/js/banner.js +87 -0
  61. package/js/calendar.d.ts +3 -0
  62. package/js/calendar.js +472 -0
  63. package/js/carousel.d.ts +2 -0
  64. package/js/carousel.js +258 -0
  65. package/js/charts/bar.js +361 -0
  66. package/js/charts/core.js +604 -0
  67. package/js/charts/donut.js +206 -0
  68. package/js/charts/figures.js +97 -0
  69. package/js/charts/heatmap.js +410 -0
  70. package/js/charts/line.js +268 -0
  71. package/js/charts/scatter.js +211 -0
  72. package/js/charts.d.ts +12 -0
  73. package/js/charts.js +27 -0
  74. package/js/code-block.d.ts +3 -0
  75. package/js/code-block.js +32 -0
  76. package/js/color-picker.d.ts +4 -0
  77. package/js/color-picker.js +448 -0
  78. package/js/command-palette.js +233 -0
  79. package/js/composer.js +573 -0
  80. package/js/context-menu.d.ts +2 -0
  81. package/js/context-menu.js +154 -0
  82. package/js/date-picker.d.ts +2 -0
  83. package/js/date-picker.js +430 -0
  84. package/js/drawer.js +48 -0
  85. package/js/editor.d.ts +5 -0
  86. package/js/editor.js +615 -0
  87. package/js/field-support.js +77 -0
  88. package/js/file-upload.d.ts +2 -0
  89. package/js/file-upload.js +230 -0
  90. package/js/filters.js +266 -0
  91. package/js/form.d.ts +2 -0
  92. package/js/form.js +409 -0
  93. package/js/i18n.d.ts +14 -0
  94. package/js/i18n.js +83 -0
  95. package/js/image-viewer.d.ts +4 -0
  96. package/js/image-viewer.js +275 -0
  97. package/js/menu.d.ts +4 -0
  98. package/js/menu.js +237 -0
  99. package/js/messages.js +908 -0
  100. package/js/modal.d.ts +7 -0
  101. package/js/modal.js +183 -0
  102. package/js/notifications.d.ts +4 -0
  103. package/js/notifications.js +204 -0
  104. package/js/number-field.d.ts +2 -0
  105. package/js/number-field.js +175 -0
  106. package/js/otp-field.d.ts +2 -0
  107. package/js/otp-field.js +107 -0
  108. package/js/pagination.d.ts +3 -0
  109. package/js/pagination.js +143 -0
  110. package/js/popover.d.ts +2 -0
  111. package/js/popover.js +155 -0
  112. package/js/progress-ring.js +48 -0
  113. package/js/rating.d.ts +3 -0
  114. package/js/rating.js +130 -0
  115. package/js/resizable.d.ts +2 -0
  116. package/js/resizable.js +311 -0
  117. package/js/scrollbar.d.ts +2 -0
  118. package/js/scrollbar.js +273 -0
  119. package/js/segmented.js +60 -0
  120. package/js/select.d.ts +3 -0
  121. package/js/select.js +784 -0
  122. package/js/shell.d.ts +6 -0
  123. package/js/shell.js +373 -0
  124. package/js/slider.d.ts +2 -0
  125. package/js/slider.js +89 -0
  126. package/js/sortable.d.ts +5 -0
  127. package/js/sortable.js +463 -0
  128. package/js/stepper.d.ts +2 -0
  129. package/js/stepper.js +72 -0
  130. package/js/tabs.js +99 -0
  131. package/js/tag-field.d.ts +2 -0
  132. package/js/tag-field.js +177 -0
  133. package/js/theme.d.ts +9 -0
  134. package/js/theme.js +114 -0
  135. package/js/time-picker.d.ts +2 -0
  136. package/js/time-picker.js +279 -0
  137. package/js/toast.d.ts +17 -0
  138. package/js/toast.js +171 -0
  139. package/js/toolbar.d.ts +2 -0
  140. package/js/toolbar.js +107 -0
  141. package/js/tooltip.d.ts +2 -0
  142. package/js/tooltip.js +208 -0
  143. package/js/tree.d.ts +2 -0
  144. package/js/tree.js +168 -0
  145. package/lume.css +11574 -0
  146. package/lume.d.ts +104 -0
  147. package/lume.js +67 -0
  148. package/package.json +66 -4
  149. package/react/Alert.d.ts +24 -0
  150. package/react/Alert.js +21 -0
  151. package/react/AppShell.d.ts +67 -0
  152. package/react/AppShell.js +94 -0
  153. package/react/Avatar.d.ts +39 -0
  154. package/react/Avatar.js +40 -0
  155. package/react/Badge.d.ts +17 -0
  156. package/react/Badge.js +10 -0
  157. package/react/Button.d.ts +32 -0
  158. package/react/Button.js +17 -0
  159. package/react/Calendar.d.ts +48 -0
  160. package/react/Calendar.js +67 -0
  161. package/react/Carousel.d.ts +30 -0
  162. package/react/Carousel.js +38 -0
  163. package/react/Charts.d.ts +186 -0
  164. package/react/Charts.js +58 -0
  165. package/react/Chip.d.ts +34 -0
  166. package/react/Chip.js +26 -0
  167. package/react/Choice.d.ts +72 -0
  168. package/react/Choice.js +51 -0
  169. package/react/ColorPicker.d.ts +43 -0
  170. package/react/ColorPicker.js +73 -0
  171. package/react/Content.d.ts +58 -0
  172. package/react/Content.js +42 -0
  173. package/react/Controls.d.ts +97 -0
  174. package/react/Controls.js +118 -0
  175. package/react/Editor.d.ts +28 -0
  176. package/react/Editor.js +57 -0
  177. package/react/Field.d.ts +90 -0
  178. package/react/Field.js +65 -0
  179. package/react/Form.d.ts +36 -0
  180. package/react/Form.js +45 -0
  181. package/react/Icon.d.ts +13 -0
  182. package/react/Icon.js +8 -0
  183. package/react/IconButton.d.ts +19 -0
  184. package/react/IconButton.js +12 -0
  185. package/react/ImageViewer.d.ts +20 -0
  186. package/react/ImageViewer.js +22 -0
  187. package/react/InlineAction.d.ts +15 -0
  188. package/react/InlineAction.js +12 -0
  189. package/react/Layers.d.ts +118 -0
  190. package/react/Layers.js +115 -0
  191. package/react/Link.d.ts +32 -0
  192. package/react/Link.js +26 -0
  193. package/react/Loading.d.ts +67 -0
  194. package/react/Loading.js +49 -0
  195. package/react/Navigation.d.ts +181 -0
  196. package/react/Navigation.js +197 -0
  197. package/react/Notices.d.ts +43 -0
  198. package/react/Notices.js +89 -0
  199. package/react/Panel.d.ts +57 -0
  200. package/react/Panel.js +33 -0
  201. package/react/Pickers.d.ts +83 -0
  202. package/react/Pickers.js +70 -0
  203. package/react/Rating.d.ts +39 -0
  204. package/react/Rating.js +41 -0
  205. package/react/Resizable.d.ts +44 -0
  206. package/react/Resizable.js +30 -0
  207. package/react/Select.d.ts +53 -0
  208. package/react/Select.js +79 -0
  209. package/react/Sortable.d.ts +52 -0
  210. package/react/Sortable.js +113 -0
  211. package/react/Table.d.ts +60 -0
  212. package/react/Table.js +34 -0
  213. package/react/Toolbar.d.ts +45 -0
  214. package/react/Toolbar.js +45 -0
  215. package/react/cx.d.ts +2 -0
  216. package/react/cx.js +5 -0
  217. package/react/icon-names.d.ts +1 -0
  218. package/react/icon-names.js +2 -0
  219. package/react/index.d.ts +42 -0
  220. package/react/index.js +52 -0
  221. package/react/useController.d.ts +8 -0
  222. package/react/useController.js +16 -0
  223. package/react/useLocale.d.ts +5 -0
  224. package/react/useLocale.js +15 -0
  225. package/tokens.css +739 -0
  226. package/tokens.js +4911 -0
package/LICENSE ADDED
@@ -0,0 +1,25 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Jonathan Navarro
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.
22
+
23
+ The fonts in ds/fonts/ (Geist, Geist Serif, JetBrains Mono) are not covered by
24
+ this license. They are distributed under the SIL Open Font License 1.1; see the
25
+ license files next to them.
package/README.md CHANGED
@@ -1,3 +1,63 @@
1
- # Temporary Holding Version
1
+ # Lume Design System
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Tokens, typography, 154 custom icons, 60 components, charts, and screen patterns, in light and dark themes. Native HTML, CSS, and JavaScript, with no dependencies, plus React components. Works with any framework, or none.
4
+
5
+ Documentation: https://lumeui.dev · in English, Portuguese, and Spanish.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install @joniguerini/lume
11
+ ```
12
+
13
+ ### HTML, CSS, and JavaScript
14
+
15
+ ```js
16
+ import '@joniguerini/lume/lume.css';
17
+ import { initTheme, createModal, toast } from '@joniguerini/lume';
18
+
19
+ initTheme();
20
+ ```
21
+
22
+ ### React
23
+
24
+ ```tsx
25
+ import '@joniguerini/lume/lume.css';
26
+ import { Button, AppShell } from '@joniguerini/lume/react';
27
+
28
+ export function App() {
29
+ return <Button variant="primary">Save</Button>;
30
+ }
31
+ ```
32
+
33
+ The React components are a thin layer over the same CSS and JavaScript, already compiled and typed. React 18 or newer.
34
+
35
+ ## Or copy it into your project
36
+
37
+ ```bash
38
+ npx @joniguerini/lume init # the whole design system in ./lume
39
+ npx @joniguerini/lume add modal # only one component, with what it needs
40
+ npx @joniguerini/lume list # the names add accepts
41
+ ```
42
+
43
+ The files become yours: edit them as you like.
44
+
45
+ ## Or load it from the web
46
+
47
+ ```html
48
+ <link rel="stylesheet" href="https://lumeui.dev/v/1.9/lume.css">
49
+ <script type="module">
50
+ import { initTheme } from 'https://lumeui.dev/v/1.9/lume.js';
51
+ initTheme();
52
+ </script>
53
+ ```
54
+
55
+ ## Using an AI to build with Lume
56
+
57
+ Point it to https://lumeui.dev/llms.txt. Every page of the documentation is available as Markdown, with rules that keep the AI from inventing classes, icons, or colors.
58
+
59
+ ## License
60
+
61
+ MIT. The fonts (Geist, Geist Serif, JetBrains Mono) are under the SIL Open Font License 1.1; their licenses ship in `fonts/`.
62
+
63
+ Source: https://github.com/JoniGuerini/lume-design-system
package/base.css ADDED
@@ -0,0 +1,165 @@
1
+ /* Lume — base: reset moderno, padrões tipográficos e acessibilidade */
2
+
3
+ *,
4
+ *::before,
5
+ *::after {
6
+ box-sizing: border-box;
7
+ }
8
+
9
+ * {
10
+ margin: 0;
11
+ }
12
+
13
+ html {
14
+ -webkit-text-size-adjust: 100%;
15
+ text-size-adjust: 100%;
16
+ -webkit-font-smoothing: antialiased;
17
+ -moz-osx-font-smoothing: grayscale;
18
+ text-rendering: optimizeLegibility;
19
+ font-feature-settings: "cv11", "calt";
20
+ background: var(--ds-color-bg-app);
21
+ }
22
+
23
+ body {
24
+ min-height: 100dvh;
25
+ font: var(--ds-text-body-md);
26
+ letter-spacing: var(--ds-text-body-md-tracking);
27
+ color: var(--ds-color-fg-default);
28
+ background: var(--ds-color-bg-app);
29
+ }
30
+
31
+ img,
32
+ picture,
33
+ video,
34
+ canvas,
35
+ svg {
36
+ display: block;
37
+ max-width: 100%;
38
+ }
39
+
40
+ input,
41
+ button,
42
+ textarea,
43
+ select {
44
+ font: inherit;
45
+ color: inherit;
46
+ letter-spacing: inherit;
47
+ }
48
+
49
+ button {
50
+ cursor: pointer;
51
+ background: none;
52
+ border: 0;
53
+ padding: 0;
54
+ }
55
+
56
+ /* link solto no texto; peso zero, para links com classe (cards, itens de menu) decidirem a própria cor */
57
+ :where(a) {
58
+ color: var(--ds-color-fg-link);
59
+ text-decoration-thickness: 1px;
60
+ text-underline-offset: 0.2em;
61
+ }
62
+
63
+ :where(a:hover) {
64
+ color: var(--ds-color-fg-link-hover);
65
+ }
66
+
67
+ h1, h2, h3, h4, h5, h6 {
68
+ font-weight: var(--ds-font-weight-semibold);
69
+ text-wrap: balance;
70
+ overflow-wrap: break-word;
71
+ }
72
+
73
+ p {
74
+ text-wrap: pretty;
75
+ overflow-wrap: break-word;
76
+ }
77
+
78
+ /* peso zero (:where): qualquer classe que dê padding ou list-style à lista ganha do reset */
79
+ :where(ul[role="list"], ol[role="list"]) {
80
+ list-style: none;
81
+ padding: 0;
82
+ }
83
+
84
+ code,
85
+ kbd,
86
+ samp,
87
+ pre {
88
+ font-family: var(--ds-font-family-mono);
89
+ }
90
+
91
+ ::selection {
92
+ background: color-mix(in srgb, var(--ds-color-brand-solid) 32%, transparent);
93
+ }
94
+
95
+ /* o estado forçado acompanha o foco real em tudo o que recebe foco */
96
+ :focus-visible,
97
+ :where(a, button, summary, [tabindex])[data-state="focus"] {
98
+ outline: var(--ds-focus-ring-width) solid var(--ds-color-border-focus);
99
+ outline-offset: var(--ds-focus-ring-offset);
100
+ }
101
+
102
+ [hidden] {
103
+ display: none !important;
104
+ }
105
+
106
+ /* Barra nativa fina; com ds/js/scrollbar.js ela some e dá lugar à sobreposta (components/scrollbar.css). */
107
+ * {
108
+ scrollbar-width: thin;
109
+ scrollbar-color: var(--ds-color-border-strong) transparent;
110
+ }
111
+
112
+ /* Ícones */
113
+ ds-icon {
114
+ display: inline-flex;
115
+ flex: none;
116
+ line-height: 0;
117
+ }
118
+
119
+ .ds-icon {
120
+ flex: none;
121
+ }
122
+
123
+ /* Utilitários de acessibilidade */
124
+ .ds-visually-hidden {
125
+ position: absolute !important;
126
+ width: 1px;
127
+ height: 1px;
128
+ padding: 0;
129
+ margin: -1px;
130
+ overflow: hidden;
131
+ clip: rect(0 0 0 0);
132
+ white-space: nowrap;
133
+ border: 0;
134
+ }
135
+
136
+ .ds-skip-link {
137
+ position: fixed;
138
+ top: var(--ds-space-150);
139
+ left: var(--ds-space-150);
140
+ z-index: var(--ds-z-tooltip);
141
+ padding: var(--ds-space-100) var(--ds-space-200);
142
+ border-radius: var(--ds-radius-md);
143
+ background: var(--ds-color-brand-solid);
144
+ color: var(--ds-color-brand-on-solid);
145
+ font: var(--ds-text-label-md);
146
+ text-decoration: none;
147
+ transform: translateY(-200%);
148
+ transition: transform var(--ds-duration-base) var(--ds-easing-standard);
149
+ }
150
+
151
+ .ds-skip-link:focus {
152
+ transform: none;
153
+ color: var(--ds-color-brand-on-solid);
154
+ }
155
+
156
+ @media (prefers-reduced-motion: reduce) {
157
+ *,
158
+ *::before,
159
+ *::after {
160
+ animation-duration: 0.01ms !important;
161
+ animation-iteration-count: 1 !important;
162
+ transition-duration: 0.01ms !important;
163
+ scroll-behavior: auto !important;
164
+ }
165
+ }
package/bin/lumeui.mjs ADDED
@@ -0,0 +1,163 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * lumeui: leva o Lume Design System para dentro do seu projeto, sem dependências.
4
+ *
5
+ * npx <pacote> init [pasta] copia o Lume inteiro (padrão: ./lume) e mostra as linhas para colar
6
+ * npx <pacote> add <nome…> [pasta] copia só o CSS e o JavaScript de um componente, com o que ele precisa
7
+ * npx <pacote> list lista os nomes que o add aceita
8
+ *
9
+ * Opções: --force (sobrescreve arquivos que já existem), --help, --version.
10
+ */
11
+ import { existsSync } from 'node:fs';
12
+ import { cp, mkdir, readFile, readdir, writeFile } from 'node:fs/promises';
13
+ import path from 'node:path';
14
+ import { fileURLToPath } from 'node:url';
15
+
16
+ const PKG = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
17
+ // o nome vem do package.json: trocar o nome do pacote não exige mexer aqui
18
+ const { version, name: NAME } = JSON.parse(await readFile(path.join(PKG, 'package.json'), 'utf8'));
19
+ const args = process.argv.slice(2);
20
+ const flags = new Set(args.filter((a) => a.startsWith('--')));
21
+ const [command, ...rest] = args.filter((a) => !a.startsWith('--'));
22
+ const FORCE = flags.has('--force');
23
+
24
+ // a base que todo componente usa; botão e campo entram junto porque quase todo componente tem um dentro
25
+ const BASE_CSS = ['fonts.css', 'tokens.css', 'base.css', 'components/surfaces.css', 'components/button.css', 'components/form.css'];
26
+ // o CSS que cada módulo JavaScript precisa, quando o nome não bate com o do arquivo
27
+ const CSS_OF = {
28
+ 'back-to-top': ['navigation'], 'code-block': ['content', 'code'], 'command-palette': ['command', 'menu'], composer: ['chat'],
29
+ 'context-menu': ['layers', 'menu'], 'progress-ring': ['loading'], 'date-picker': ['picker'], drawer: ['modal', 'layers'], 'file-upload': ['upload'],
30
+ filters: ['filters', 'menu'], menu: ['menu'], modal: ['modal'], 'number-field': ['number-field'], 'otp-field': ['otp'],
31
+ pagination: ['navigation', 'menu'], popover: ['layers'], segmented: [], select: ['select', 'menu'], stepper: ['navigation'],
32
+ 'tag-field': ['tags'], 'time-picker': ['picker'], toast: ['toast'], tooltip: ['feedback'], tree: ['navigation'],
33
+ charts: ['chart'], calendar: ['calendar'], shell: ['shell'], slider: ['slider'], tabs: ['tabs'], scrollbar: ['scrollbar'],
34
+ };
35
+ const c = (s, code) => (process.stdout.isTTY ? `\x1b[${code}m${s}\x1b[0m` : s);
36
+ const bold = (s) => c(s, 1);
37
+ const dim = (s) => c(s, 2);
38
+
39
+ function help() {
40
+ console.log(`
41
+ ${bold(`Lume Design System ${version}`)} ${dim('· https://lumeui.dev · MIT')}
42
+
43
+ ${bold(`npx ${NAME} init`)} [pasta] copia o Lume inteiro (padrão: ./lume)
44
+ ${bold(`npx ${NAME} add`)} <nome…> [--dir pasta] copia só um componente e o que ele precisa
45
+ ${bold(`npx ${NAME} list`)} lista os nomes que o add aceita
46
+
47
+ Opções: --force sobrescreve arquivos que já existem.
48
+ Prefere importar do pacote? npm install ${NAME}, depois import '${NAME}/lume.css'.
49
+ `);
50
+ }
51
+
52
+ async function components() {
53
+ const css = (await readdir(path.join(PKG, 'components'))).filter((f) => f.endsWith('.css')).map((f) => f.slice(0, -4));
54
+ const js = (await readdir(path.join(PKG, 'js'))).filter((f) => f.endsWith('.js')).map((f) => f.slice(0, -3));
55
+ const internal = new Set(['i18n', 'messages', 'field-support', 'token-export', 'charts']);
56
+ return { css, js: js.filter((n) => !internal.has(n)), names: [...new Set([...css, ...js.filter((n) => !internal.has(n)), 'charts'])].sort() };
57
+ }
58
+
59
+ // copia um arquivo, sem sobrescrever o que a pessoa já tem (a não ser com --force)
60
+ async function copyFile(rel, dest, done) {
61
+ const to = path.join(dest, rel);
62
+ if (done.has(rel)) return;
63
+ done.add(rel);
64
+ if (existsSync(to) && !FORCE) return;
65
+ await mkdir(path.dirname(to), { recursive: true });
66
+ await cp(path.join(PKG, rel), to);
67
+ }
68
+
69
+ // um módulo JavaScript e tudo o que ele importa, de forma recursiva
70
+ async function copyModule(rel, dest, done) {
71
+ if (done.has(rel)) return;
72
+ await copyFile(rel, dest, done);
73
+ const src = await readFile(path.join(PKG, rel), 'utf8');
74
+ for (const m of src.matchAll(/(?:from|import)\s*['"](\.{1,2}\/[^'"]+)['"]/g)) {
75
+ const next = path.posix.join(path.posix.dirname(rel), m[1]);
76
+ if (existsSync(path.join(PKG, next))) await copyModule(next, dest, done);
77
+ }
78
+ }
79
+
80
+ async function init(dir = 'lume') {
81
+ const dest = path.resolve(dir);
82
+ if (existsSync(path.join(dest, 'lume.css')) && !FORCE) {
83
+ console.log(`${bold(dir)} já tem o Lume. Use --force para substituir.`);
84
+ process.exitCode = 1;
85
+ return;
86
+ }
87
+ await mkdir(dest, { recursive: true });
88
+ for (const item of await readdir(PKG)) {
89
+ if (['package.json', 'bin', 'README.md', 'node_modules'].includes(item)) continue;
90
+ await cp(path.join(PKG, item), path.join(dest, item), { recursive: true, force: FORCE });
91
+ }
92
+ const rel = path.relative(process.cwd(), dest).split(path.sep).join('/') || '.';
93
+ console.log(`
94
+ ${bold(`✓ Lume ${version} copiado para ${rel}/`)}
95
+
96
+ No ${bold('<head>')}:
97
+ <link rel="stylesheet" href="/${rel}/lume.css">
98
+
99
+ No JavaScript, só o que a tela usa:
100
+ import { initTheme, createModal, toast } from '/${rel}/lume.js';
101
+
102
+ ${dim('Ajuste o caminho ao jeito que o seu projeto serve arquivos. Documentação: https://lumeui.dev')}
103
+ `);
104
+ }
105
+
106
+ async function add(names) {
107
+ const dirFlag = args.indexOf('--dir');
108
+ const dir = dirFlag >= 0 ? args[dirFlag + 1] : 'lume';
109
+ const wanted = names.filter((n) => n !== dir);
110
+ const all = await components();
111
+ const unknown = wanted.filter((n) => !all.names.includes(n));
112
+ if (!wanted.length || unknown.length) {
113
+ console.log(unknown.length ? `Não conheço: ${unknown.join(', ')}. Veja os nomes com ${bold(`npx ${NAME} list`)}.` : `Diga o componente: ${bold(`npx ${NAME} add modal`)}`);
114
+ process.exitCode = 1;
115
+ return;
116
+ }
117
+ const dest = path.resolve(dir);
118
+ const done = new Set();
119
+ // a base que todo componente usa: fontes, tokens, reset e superfícies
120
+ for (const f of BASE_CSS) await copyFile(f, dest, done);
121
+ for (const f of await readdir(path.join(PKG, 'fonts'))) await copyFile(`fonts/${f}`, dest, done);
122
+ await copyFile('LICENSE', dest, done);
123
+ const cssAdded = [];
124
+ for (const n of wanted) {
125
+ for (const css of new Set([...(all.css.includes(n) ? [n] : []), ...(CSS_OF[n] ?? [])])) {
126
+ const f = `components/${css}.css`;
127
+ if (BASE_CSS.includes(f) || cssAdded.includes(f)) continue;
128
+ await copyFile(f, dest, done);
129
+ cssAdded.push(f);
130
+ }
131
+ if (all.js.includes(n) || n === 'charts') await copyModule(`js/${n}.js`, dest, done);
132
+ }
133
+ if (done.has('icons/icons.js') || wanted.length) await copyModule('icons/icons.js', dest, done);
134
+ // lume.css do projeto: a base e os componentes trazidos até agora
135
+ const entry = path.join(dest, 'lume.css');
136
+ const current = existsSync(entry) ? await readFile(entry, 'utf8') : `/* Lume Design System ${version} · só os componentes trazidos com npx ${NAME} add */\n`;
137
+ const lines = [...BASE_CSS, ...cssAdded].map((f) => `@import url("./${f}");`).filter((l) => !current.includes(l));
138
+ await writeFile(entry, `${current.trimEnd()}\n${lines.join('\n')}\n`);
139
+ const rel = path.relative(process.cwd(), dest).split(path.sep).join('/') || '.';
140
+ console.log(`
141
+ ${bold(`✓ ${wanted.join(', ')} em ${rel}/`)}
142
+ ${dim([...done].sort().map((f) => ` ${f}`).join('\n'))}
143
+
144
+ CSS: ${bold(`${rel}/lume.css`)} já importa o que foi trazido.${[...done].some((f) => f.startsWith('js/')) ? `\n JavaScript: importe de ${bold(`${rel}/js/`)}, por exemplo ${bold(`import { createModal } from '/${rel}/js/modal.js'`)}.` : ''}
145
+ `);
146
+ }
147
+
148
+ async function list() {
149
+ const all = await components();
150
+ console.log(`\n${bold('Componentes que o add aceita')} ${dim('(CSS, JavaScript ou os dois)')}\n`);
151
+ for (const n of all.names) {
152
+ const kinds = [all.css.includes(n) && 'CSS', (all.js.includes(n) || n === 'charts') && 'JS'].filter(Boolean).join(' + ');
153
+ console.log(` ${n.padEnd(18)} ${dim(kinds)}`);
154
+ }
155
+ console.log('');
156
+ }
157
+
158
+ if (flags.has('--version')) console.log(version);
159
+ else if (!command || flags.has('--help') || command === 'help') help();
160
+ else if (command === 'init') await init(rest[0]);
161
+ else if (command === 'add') await add(rest);
162
+ else if (command === 'list') await list();
163
+ else { console.log(`Comando desconhecido: ${command}`); help(); process.exitCode = 1; }
@@ -0,0 +1,156 @@
1
+ /*
2
+ * Alerta — mensagem inline com tom, ícone, título, texto e ações.
3
+ *
4
+ * <div class="ds-alert ds-alert--danger" role="alert">
5
+ * <span class="ds-alert__icon"><ds-icon name="alert-circle"></ds-icon></span>
6
+ * <div class="ds-alert__body">
7
+ * <p class="ds-alert__title">Não conseguimos salvar</p>
8
+ * <p class="ds-alert__text">Suas alterações continuam aqui. Tente de novo em alguns segundos.</p>
9
+ * <ul class="ds-alert__list"><li><a href="#campo">Nome do projeto: preencha este campo.</a></li></ul>
10
+ * <div class="ds-alert__actions"><button class="ds-btn ds-btn--secondary ds-btn--sm">Tentar de novo</button></div>
11
+ * </div>
12
+ * <button class="ds-icon-btn ds-icon-btn--sm ds-icon-btn--muted ds-alert__close" aria-label="Fechar">…</button>
13
+ * </div>
14
+ *
15
+ * Tons: neutro (padrão) · --info · --success · --warning · --danger. O tom nunca vem sozinho:
16
+ * ícone e texto dizem o mesmo que a cor.
17
+ * Variante: --compact (uma linha: título e texto lado a lado, ações à direita).
18
+ * role: "alert" quando aparece depois de uma ação (erro ao salvar); "status" para avisos que não
19
+ * interrompem; nenhum para alertas que já estão na página ao carregar.
20
+ */
21
+
22
+ .ds-alert {
23
+ --_bg: var(--ds-color-bg-surface);
24
+ --_border: var(--ds-color-border-subtle);
25
+ --_icon: var(--ds-color-fg-muted);
26
+ display: flex;
27
+ align-items: flex-start;
28
+ gap: var(--ds-space-150);
29
+ min-width: 0;
30
+ padding: var(--ds-space-200) var(--ds-space-250);
31
+ border-radius: var(--ds-radius-lg);
32
+ background: var(--_bg);
33
+ border: 1px solid var(--_border);
34
+ color: var(--ds-color-fg-default);
35
+ }
36
+
37
+ .ds-alert--info { --_bg: var(--ds-color-info-subtle); --_border: var(--ds-color-info-border); --_icon: var(--ds-color-info-fg); }
38
+ .ds-alert--success { --_bg: var(--ds-color-success-subtle); --_border: var(--ds-color-success-border); --_icon: var(--ds-color-success-fg); }
39
+ .ds-alert--warning { --_bg: var(--ds-color-warning-subtle); --_border: var(--ds-color-warning-border); --_icon: var(--ds-color-warning-fg); }
40
+ .ds-alert--danger { --_bg: var(--ds-color-danger-subtle); --_border: var(--ds-color-danger-border); --_icon: var(--ds-color-danger-fg); }
41
+
42
+ /* Alerta que recebe foco (resumo de erros): o anel aparece só pelo teclado ou pelo foco programático */
43
+ .ds-alert[tabindex="-1"]:focus {
44
+ outline: none;
45
+ }
46
+
47
+ .ds-alert[tabindex="-1"]:focus-visible,
48
+ .ds-alert[data-focus-ring]:focus,
49
+ .ds-alert[tabindex="-1"][data-state="focus"] {
50
+ outline: 2px solid var(--ds-color-border-focus);
51
+ outline-offset: 2px;
52
+ }
53
+
54
+ .ds-alert__icon {
55
+ display: grid;
56
+ flex: none;
57
+ place-items: center;
58
+ height: 22px;
59
+ color: var(--_icon);
60
+ }
61
+
62
+ .ds-alert__body {
63
+ display: flex;
64
+ flex: 1;
65
+ flex-direction: column;
66
+ gap: var(--ds-space-050);
67
+ min-width: 0;
68
+ }
69
+
70
+ .ds-alert__title {
71
+ color: var(--ds-color-fg-default);
72
+ font: var(--ds-text-label-md);
73
+ letter-spacing: var(--ds-text-label-md-tracking);
74
+ line-height: 22px;
75
+ }
76
+
77
+ .ds-alert__text {
78
+ color: var(--ds-color-fg-muted);
79
+ font: var(--ds-text-body-sm);
80
+ letter-spacing: var(--ds-text-body-sm-tracking);
81
+ }
82
+
83
+ .ds-alert__title + .ds-alert__text {
84
+ margin-top: -2px;
85
+ }
86
+
87
+ .ds-alert__list {
88
+ display: flex;
89
+ flex-direction: column;
90
+ gap: var(--ds-space-050);
91
+ margin-top: var(--ds-space-050);
92
+ padding: 0;
93
+ list-style: none;
94
+ }
95
+
96
+ .ds-alert__list li {
97
+ font: var(--ds-text-body-sm);
98
+ letter-spacing: var(--ds-text-body-sm-tracking);
99
+ }
100
+
101
+ .ds-alert__list a {
102
+ color: var(--ds-color-fg-default);
103
+ text-decoration: underline;
104
+ text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
105
+ text-underline-offset: 3px;
106
+ transition: text-decoration-color var(--ds-duration-fast) var(--ds-easing-standard);
107
+ }
108
+
109
+ .ds-alert__list a:hover,
110
+ .ds-alert__list a[data-state="hover"] {
111
+ text-decoration-color: currentColor;
112
+ }
113
+
114
+ .ds-alert__actions {
115
+ display: flex;
116
+ flex-wrap: wrap;
117
+ align-items: center;
118
+ gap: var(--ds-space-100) var(--ds-space-200);
119
+ margin-top: var(--ds-space-100);
120
+ }
121
+
122
+ .ds-alert__meta {
123
+ color: var(--ds-color-fg-subtle);
124
+ font: var(--ds-text-caption);
125
+ }
126
+
127
+ .ds-alert__close {
128
+ flex: none;
129
+ margin: -5px -8px -5px 0;
130
+ }
131
+
132
+ /* Compacto: uma linha, para avisos dentro de painéis e barras */
133
+ .ds-alert--compact {
134
+ align-items: center;
135
+ padding: var(--ds-space-100) var(--ds-space-150) var(--ds-space-100) var(--ds-space-200);
136
+ border-radius: var(--ds-radius-md);
137
+ }
138
+
139
+ .ds-alert--compact .ds-alert__body {
140
+ flex-direction: row;
141
+ flex-wrap: wrap;
142
+ align-items: baseline;
143
+ column-gap: var(--ds-space-100);
144
+ }
145
+
146
+ .ds-alert--compact .ds-alert__title + .ds-alert__text {
147
+ margin-top: 0;
148
+ }
149
+
150
+ .ds-alert--compact .ds-alert__actions {
151
+ margin: 0 0 0 auto;
152
+ }
153
+
154
+ .ds-alert--compact .ds-alert__close {
155
+ margin-block: -4px;
156
+ }
@@ -0,0 +1,98 @@
1
+ /*
2
+ * Banner de anúncio — faixa no topo do app, para um recado que vale para todo mundo.
3
+ *
4
+ * <div class="ds-banner ds-banner--brand" role="region" aria-label="Anúncio">
5
+ * <span class="ds-banner__icon"><ds-icon name="megaphone"></ds-icon></span>
6
+ * <p class="ds-banner__text"><strong>Lume 0.35</strong> Banner e central de notificações. <a class="ds-link" href="/novidades">Ver novidades</a></p>
7
+ * <button type="button" class="ds-icon-btn ds-icon-btn--sm ds-icon-btn--muted ds-banner__close" aria-label="Fechar anúncio">…</button>
8
+ * </div>
9
+ *
10
+ * Tons: neutro (padrão) · --brand · --info · --warning · --danger. Fechar e lembrar: createBanner().
11
+ * Um banner por vez, com uma frase e no máximo um link. Mensagem sobre uma tela só é Alerta, não banner.
12
+ */
13
+ .ds-banner {
14
+ --_bg: var(--ds-color-bg-surface);
15
+ --_border: var(--ds-color-border-default);
16
+ --_icon: var(--ds-color-fg-muted);
17
+ display: flex;
18
+ align-items: center;
19
+ gap: var(--ds-space-150);
20
+ min-width: 0;
21
+ min-height: var(--ds-size-control-md, 40px);
22
+ padding: var(--ds-space-075) var(--ds-space-100) var(--ds-space-075) var(--ds-space-250);
23
+ border-radius: var(--ds-radius-lg);
24
+ background: var(--_bg);
25
+ border: 1px solid var(--_border);
26
+ color: var(--ds-color-fg-default);
27
+ }
28
+
29
+ .ds-banner[hidden] {
30
+ display: none;
31
+ }
32
+
33
+ .ds-banner--brand { --_bg: var(--ds-color-brand-solid); --_border: var(--ds-color-brand-solid); --_icon: var(--ds-color-brand-on-solid); color: var(--ds-color-brand-on-solid); }
34
+
35
+ /* novidade: faixa sólida; o × e o link seguem a cor do texto */
36
+ .ds-banner--brand .ds-banner__close {
37
+ color: inherit;
38
+ }
39
+
40
+ .ds-banner--brand .ds-banner__close:hover,
41
+ .ds-banner--brand .ds-banner__close[data-state="hover"] {
42
+ background: color-mix(in srgb, currentColor 14%, transparent);
43
+ color: inherit;
44
+ }
45
+
46
+ .ds-banner--brand .ds-link:hover,
47
+ .ds-banner--brand .ds-link[data-state="hover"] {
48
+ color: inherit;
49
+ }
50
+ .ds-banner--info { --_bg: var(--ds-color-info-subtle); --_border: var(--ds-color-info-border); --_icon: var(--ds-color-info-fg); }
51
+ .ds-banner--warning { --_bg: var(--ds-color-warning-subtle); --_border: var(--ds-color-warning-border); --_icon: var(--ds-color-warning-fg); }
52
+ .ds-banner--danger { --_bg: var(--ds-color-danger-subtle); --_border: var(--ds-color-danger-border); --_icon: var(--ds-color-danger-fg); }
53
+
54
+ .ds-banner__icon {
55
+ flex: none;
56
+ display: inline-flex;
57
+ color: var(--_icon);
58
+ }
59
+
60
+ .ds-banner__icon svg {
61
+ width: 18px;
62
+ height: 18px;
63
+ }
64
+
65
+ .ds-banner__text {
66
+ flex: 1;
67
+ min-width: 0;
68
+ margin: 0;
69
+ font: var(--ds-text-body-sm);
70
+ letter-spacing: var(--ds-text-body-sm-tracking);
71
+ text-wrap: pretty;
72
+ }
73
+
74
+ .ds-banner__text strong {
75
+ margin-inline-end: var(--ds-space-050);
76
+ font-weight: var(--ds-font-weight-semibold);
77
+ }
78
+
79
+ .ds-banner__text .ds-link {
80
+ color: inherit;
81
+ font-weight: var(--ds-font-weight-medium);
82
+ }
83
+
84
+ .ds-banner__close {
85
+ flex: none;
86
+ margin-inline-start: auto;
87
+ }
88
+
89
+ /* sem botão de fechar, o texto não encosta na borda */
90
+ .ds-banner:not(:has(.ds-banner__close)) {
91
+ padding-inline-end: var(--ds-space-250);
92
+ }
93
+
94
+ /* no topo de tudo, colado nas bordas: só a linha de baixo */
95
+ .ds-banner--flush {
96
+ border-width: 0 0 1px;
97
+ border-radius: 0;
98
+ }