legacy.css 0.1.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Moises Duarte
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.
package/README.md ADDED
@@ -0,0 +1,242 @@
1
+ # legacy.css
2
+
3
+ [![Unit coverage](https://codecov.io/gh/moisesduartem/legacy.css/branch/main/graph/badge.svg?flag=unit)](https://codecov.io/gh/moisesduartem/legacy.css)
4
+
5
+ `legacy.css` is a classless CSS framework for administrative and corporate interfaces. It is inspired by the visual language of classic business, public-sector, and back-office web systems from the 2000s.
6
+
7
+ The project is not trying to compete with Bootstrap, Tailwind CSS, or component libraries. Its goal is to provide a dependable default stylesheet for semantic HTML.
8
+
9
+ ## Philosophy
10
+
11
+ - Semantic HTML first.
12
+ - As few CSS classes as possible.
13
+ - Native elements should look usable by default.
14
+ - Classes exist only for patterns that HTML does not represent naturally, such as `.panel`, `.alert`, and `.container`.
15
+
16
+ For example, a plain `<button>`, `<table>`, `<input>`, `<select>`, `<textarea>`, `<fieldset>`, `<legend>`, and `<details>` should already produce a consistent administrative interface.
17
+
18
+ ## Why Not Bootstrap?
19
+
20
+ Bootstrap is a complete component framework with a large API, layout system, JavaScript behaviors, and many utility classes.
21
+
22
+ `legacy.css` has a narrower purpose: it styles ordinary HTML so internal tools, prototypes, CRUD screens, documentation pages, and small administrative systems can start with a consistent baseline without adopting a full design system.
23
+
24
+ ## Installation
25
+
26
+ Install from npm:
27
+
28
+ ```sh
29
+ npm install legacy.css
30
+ ```
31
+
32
+ Or with pnpm:
33
+
34
+ ```sh
35
+ pnpm add legacy.css
36
+ ```
37
+
38
+ Import the built CSS:
39
+
40
+ ```html
41
+ <link rel="stylesheet" href="./node_modules/legacy.css/dist/legacy.css">
42
+ ```
43
+
44
+ Or import the source entry point in a bundler:
45
+
46
+ ```css
47
+ @import "legacy.css/src/legacy.css";
48
+ ```
49
+
50
+ For interactive components such as tabs, popovers, modal dialogs, toast notifications, multiselect controls, and drag/drop boards, include the browser script:
51
+
52
+ ```html
53
+ <script src="./node_modules/legacy.css/dist/legacy.min.js" defer></script>
54
+ ```
55
+
56
+ The script exposes `window.LegacyCss` and has no runtime dependency. If jQuery is already present on the page, it also registers small `modal`, `toast`, `tabs`, `popover`, `multiselect`, and `dragdrop` bridges.
57
+
58
+ ## CDN
59
+
60
+ TODO: publish package and document CDN usage.
61
+
62
+ ## Usage
63
+
64
+ Write semantic HTML and let the stylesheet provide the baseline:
65
+
66
+ ```html
67
+ <main>
68
+ <h1>Cadastro de fornecedor</h1>
69
+
70
+ <form>
71
+ <fieldset>
72
+ <legend>Dados cadastrais</legend>
73
+
74
+ <label for="name">Nome</label>
75
+ <input id="name" name="name" type="text">
76
+
77
+ <label for="status">Status</label>
78
+ <select id="status" name="status">
79
+ <option>Ativo</option>
80
+ <option>Inativo</option>
81
+ </select>
82
+ </fieldset>
83
+
84
+ <button type="submit">Salvar</button>
85
+ </form>
86
+ </main>
87
+ ```
88
+
89
+ Set a global color theme on the document element when you need a dark interface:
90
+
91
+ ```html
92
+ <html lang="en" data-legacy-theme="dark">
93
+ ```
94
+
95
+ Use `data-legacy-theme="light"` or omit the attribute for the default light theme. With the browser script, use `LegacyCss.theme.set("dark")` or `LegacyCss.theme.set("light")` to update the document theme and store the preference. If jQuery is present before the script runs, use `$.theme("dark")`, `$.theme("light")`, or `$.theme()` to read the current theme.
96
+
97
+ ## Project Structure
98
+
99
+ ```text
100
+ src/
101
+ legacy.css
102
+ variables.css
103
+ base.css
104
+ typography.css
105
+ forms.css
106
+ multiselect.css
107
+ buttons.css
108
+ toolbars.css
109
+ tables.css
110
+ lists.css
111
+ navigation.css
112
+ pagination.css
113
+ panels.css
114
+ modal.css
115
+ popover.css
116
+ tabs.css
117
+ dragdrop.css
118
+ progress.css
119
+ alerts.css
120
+ toast.css
121
+ badges.css
122
+ utilities.css
123
+ legacy.ts
124
+ dist/
125
+ docs/
126
+ ```
127
+
128
+ `src/legacy.css` is the main entry point and imports the other files in order.
129
+ `src/legacy.ts` contains browser behavior for tabs, popovers, modal dialogs, toast notifications, multiselect controls, drag/drop boards, and pagination.
130
+
131
+ ## Scripts
132
+
133
+ ```sh
134
+ pnpm run lint
135
+ pnpm run build
136
+ pnpm run build:min
137
+ pnpm run build:js
138
+ pnpm run build:all
139
+ pnpm run build:docs
140
+ pnpm run watch
141
+ pnpm run mcp
142
+ ```
143
+
144
+ The CSS build uses Lightning CSS to bundle `src/legacy.css` into `dist/legacy.css` and generate `dist/legacy.min.css`. The JavaScript build keeps a readable `dist/legacy.js` copy and uses Vite to generate `dist/legacy.min.js`.
145
+
146
+ ## MCP Server
147
+
148
+ This package includes a small stdio MCP server for agents that need project-aware access to `legacy.css` source files, built CSS, design tokens, and semantic HTML examples.
149
+
150
+ Run it from the repository:
151
+
152
+ ```sh
153
+ pnpm run mcp
154
+ ```
155
+
156
+ Or, after installing the package, use the executable:
157
+
158
+ ```sh
159
+ legacy-css-mcp
160
+ ```
161
+
162
+ The server exposes resources for the README, source CSS entry point, bundled CSS, and every CSS module under `src/`. It also exposes tools to list modules, read a module, inspect design tokens, search CSS source, and return small usage snippets.
163
+
164
+ ### Configure an MCP Client
165
+
166
+ Point your MCP client at the server command. From a local checkout, use:
167
+
168
+ ```json
169
+ {
170
+ "mcpServers": {
171
+ "legacy-css": {
172
+ "command": "pnpm",
173
+ "args": ["run", "mcp"],
174
+ "cwd": "/absolute/path/to/legacy.css"
175
+ }
176
+ }
177
+ }
178
+ ```
179
+
180
+ After installing the package globally or inside a project, use the binary instead:
181
+
182
+ ```json
183
+ {
184
+ "mcpServers": {
185
+ "legacy-css": {
186
+ "command": "legacy-css-mcp"
187
+ }
188
+ }
189
+ }
190
+ ```
191
+
192
+ Use the first form while developing this repository. Use the binary form when another project wants to consume the published package.
193
+
194
+ ### Build Pages Quickly With MCP
195
+
196
+ Once the server is connected, ask your agent to use the `legacy-css` MCP server before writing markup. Good prompts are specific about the page type, data fields, and components:
197
+
198
+ ```text
199
+ Use the legacy-css MCP server to build a supplier registration page.
200
+ Include a toolbar, two fieldsets, status badges, a table of recent suppliers,
201
+ and an alert area for validation messages.
202
+ ```
203
+
204
+ ```text
205
+ Use legacy-css resources and snippets to scaffold an admin dashboard page.
206
+ Keep the HTML semantic, prefer native forms and tables, and include the
207
+ legacy.css stylesheet and legacy.min.js script.
208
+ ```
209
+
210
+ The MCP server helps agents inspect the available CSS modules, find selectors and custom properties, and reuse semantic snippets for forms, tables, panels, alerts, badges, toasts, popovers, and tabs. For interactive tabs, popovers, modals, toasts, multiselect controls, drag/drop boards, and pagination, include:
211
+
212
+ ```html
213
+ <link rel="stylesheet" href="./node_modules/legacy.css/dist/legacy.css">
214
+ <script src="./node_modules/legacy.css/dist/legacy.min.js" defer></script>
215
+ ```
216
+
217
+ When reviewing generated pages, keep the project philosophy in mind: start with semantic HTML, rely on native elements first, and use classes only for patterns such as `.container`, `.panel`, `.alert`, `.toast`, `.popover`, `.badge`, `.toolbar`, `.tabs`, `.modal`, `.multiselect`, `.dragdrop`, `.pagination`, and `.progress`.
218
+
219
+ ## Roadmap
220
+
221
+ - Expand coverage for semantic elements such as `details`, `summary`, `dialog`, and `meter`.
222
+ - Refine form layouts without requiring classes.
223
+ - Add print styles for administrative reports.
224
+ - Add accessibility-focused states for validation and interaction.
225
+ - Publish the package to npm.
226
+ - Document CDN usage after publication.
227
+ - Add visual regression pages.
228
+
229
+ ## Contributing
230
+
231
+ Contributions are welcome. Keep the project focused on semantic HTML, conservative defaults, and small class APIs for patterns that HTML does not cover.
232
+
233
+ Before opening a pull request, run:
234
+
235
+ ```sh
236
+ pnpm run lint
237
+ pnpm run build:all
238
+ ```
239
+
240
+ ## License
241
+
242
+ MIT