This repository is a monorepo for the Dile Components library. It contains multiple packages under the packages/ directory, each focused on a different area of the component ecosystem.
packages/ui— UI components for graphical interfaces, published as@dile/uipackages/utils— utility components, published as@dile/utilspackages/crud— CRUD-related components, published as@dile/crudpackages/editor— rich text / editor components, published as@dile/editorpackages/icons— icon assets and helpers, published as@dile/iconspackages/iconlib— icon library web component implementationspackages/lib— shared library helpers and app-oriented abstractions
The documentation site project is located in the docs/ directory. This is the source for the Eleventy-based documentation website.
Component doc pages (docs/components/*.md) contain html:preview code blocks that render live demos. These blocks share the same page/global scope (window), so a component's <script type="module">import '@dile/ui/components/<name>/<name>.js';</script> only needs to appear once per page — customElements.define registers the element on window and every later html:preview block on that page can use the tag without importing it again. Only import again if a later block introduces a different component not yet registered.
Interactive demos are stored in the demos/ directory.
- UI component demos go in
demos/ui/ - Utils component demos go in
demos/utils/ - CRUD component demos go in
demos/crud/
When implementing a new component, follow these conventions:
- Create the component in the appropriate package folder under
packages/. - Create a demo file in the matching demos folder:
- UI components:
demos/ui/ - Utils components:
demos/utils/ - CRUD components:
demos/crud/
- UI components:
- Create documentation for the component:
- UI components:
docs/components/ - CRUD components:
docs/crud/
- UI components:
- Add the demo to the corresponding demo index file:
- CRUD components:
demos/crud/index.html - Other components:
demos/index.html - Keep the demo list in alphabetical order.
- CRUD components:
- Use the existing component documentation files as a base for style and structure.
- Follow the naming and file organization patterns already used by existing components in the repository.
- Keep the documentation concise, practical, and aligned with the existing docs format.
- Use the existing component folders and files as reference points before creating new ones.
- Prefer small, focused components that follow the conventions already used in this repository.
- Keep demos and documentation in sync with the implementation.
- When adding a new component, make sure it is easy to discover through its demo and its documentation page.
There is no requirement to have tests for every component in the catalog. Instead, tests are added incrementally: whenever you create or update a UI/utils/crud component, add or update its component test as part of that change.
- Tests run in a real Chromium browser via Vitest's browser mode (
@vitest/browser-playwright), configured invitest.config.jsat the repo root. This is needed because these are Lit web components that rely on shadow DOM, slots, and custom element registration, which jsdom cannot fully emulate. - Co-locate the test file next to the component's public entry point, using the
.spec.jssuffix, e.g.packages/ui/components/button/button.spec.jstestspackages/ui/components/button/button.js. - Import the component's registration file (e.g.
./button.js), append markup todocument.body, awaitel.updateComplete, then assert againstel.shadowRootand dispatched events. Clean updocument.bodyinafterEach. - Focus tests on the component's public contract: rendered output, reactive properties/attributes, dispatched custom events, and slotted content — not implementation details.
- Plain unit tests for framework-agnostic helper functions (e.g.
packages/crud/lib/image/*.test.js,packages/ui/lib/otp/*.test.js) continue to use Node's built-innode:testrunner and are unaffected by this setup. - Run component tests with
npm run test:components(ornpm run test:components:watchwhile iterating). Seepackages/ui/components/button/button.spec.jsfor a reference example.