How teacat/tocas works
Project type and purpose
• Tocas UI is a front-end design system / component library (an open-source UI toolkit) that delivers modular CSS and JavaScript to build websites and progressive web apps quickly and intuitively.
• Evidence:
• Hundreds of individual *.css files (buttons, menus, modals, etc.) and a small JS set under src/scripts/.
• A dist/ folder with compiled tocas.css and tocas.js for distribution.
• README describes usage via CDN or NPM.
File structure
Top-level:
• src/ – source modules (one CSS file per component + src/scripts/ for interactive behavior).
• dist/ – build outputs: minified CSS and JS, plus assets (flags, fonts).
• package.json – metadata, build commands (if any), dependencies.
• README.md & LICENSE.
Patterns:
• Single‐repository, modular component approach
• Build pipeline (likely bundling & minification) produces a unified CSS and JS.
Insights from README
• Core deliverable: tocas.min.css and tocas.min.js via CDN/NPM.
• No backend or runtime server: purely front-end assets.
Main components of the system
A. Source Layer (developer view)
1. CSS Modules (e.g. accordion.css, button.css, …)
2. Script Modules (src/scripts/tocas.*.js)
3. Build/Tooling Config (e.g. .prettierrc, package.json scripts)
B. Build / Bundling Pipeline
• Transforms & merges all CSS modules → dist/tocas.css
• Transforms & bundles all JS modules → dist/tocas.js
• Copies assets (flags, fonts) into dist/flags and dist/fonts
C. Distribution Layer
1. NPM Package
2. CDN Artifacts (cdnjs links)
3. Documentation Site (tocas-ui.com)
D. Consumers
• Web applications import CSS/JS via <link> / <script> tags.
• Uses dependencies: Google Fonts (Noto Sans TC), optional Font Awesome, floating-ui.
Architectural patterns & design principles
• Modular component pattern (one file per UI element)
• Layered architecture (source → build → distribution → consumption)
• Dependency inclusion vs. peer dependencies (some assets are bundled, others loaded externally)
Important details to capture
• The per-component modular breakdown in src/
• The build step that aggregates everything into two core files
• The publishing targets (NPM, CDN) and their usage by client apps