odontogram 0.0.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 (47) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +299 -0
  3. package/cdn/components/button/button.d.ts +25 -0
  4. package/cdn/components/button/button.d.ts.map +1 -0
  5. package/cdn/components/button/button.js +598 -0
  6. package/cdn/components/button/button.styles.d.ts +3 -0
  7. package/cdn/components/button/button.styles.d.ts.map +1 -0
  8. package/cdn/components/button/index.d.ts +2 -0
  9. package/cdn/components/button/index.d.ts.map +1 -0
  10. package/cdn/components/button/index.js +2 -0
  11. package/cdn/components/index.d.ts +2 -0
  12. package/cdn/components/index.d.ts.map +1 -0
  13. package/cdn/components/index.js +1 -0
  14. package/cdn/index.d.ts +2 -0
  15. package/cdn/index.d.ts.map +1 -0
  16. package/cdn/index.js +1 -0
  17. package/cdn/loader.js +118 -0
  18. package/custom-elements.json +152 -0
  19. package/dist/components/button/button.d.ts +25 -0
  20. package/dist/components/button/button.d.ts.map +1 -0
  21. package/dist/components/button/button.js +47 -0
  22. package/dist/components/button/button.js.map +1 -0
  23. package/dist/components/button/button.styles.d.ts +3 -0
  24. package/dist/components/button/button.styles.d.ts.map +1 -0
  25. package/dist/components/button/button.styles.js +43 -0
  26. package/dist/components/button/button.styles.js.map +1 -0
  27. package/dist/components/button/index.d.ts +2 -0
  28. package/dist/components/button/index.d.ts.map +1 -0
  29. package/dist/components/button/index.js +3 -0
  30. package/dist/components/button/index.js.map +1 -0
  31. package/dist/components/index.d.ts +2 -0
  32. package/dist/components/index.d.ts.map +1 -0
  33. package/dist/components/index.js +2 -0
  34. package/dist/components/index.js.map +1 -0
  35. package/dist/index.d.ts +2 -0
  36. package/dist/index.d.ts.map +1 -0
  37. package/dist/index.js +2 -0
  38. package/dist/index.js.map +1 -0
  39. package/package.json +120 -0
  40. package/react/MyButton.d.ts +90 -0
  41. package/react/MyButton.js +32 -0
  42. package/react/index.d.ts +1 -0
  43. package/react/index.js +1 -0
  44. package/react/react-utils.js +67 -0
  45. package/types/custom-element-jsx.d.ts +236 -0
  46. package/types/custom-element-svelte.d.ts +70 -0
  47. package/types/custom-element-vuejs.d.ts +40 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Burton Smith
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,299 @@
1
+ # Lit Starter Kit
2
+
3
+ Welcome to the Lit Starter Kit. This is not an official kit for the Lit library, but this is a tool to get a component library up and running quickly.
4
+
5
+ ## Prerequisites
6
+
7
+ Before getting started, make sure you have the following installed:
8
+
9
+ - **Node.js** (v18 or higher recommended)
10
+
11
+ ## Features
12
+
13
+ This repository is designed to be a "batteries included" repo, so you can hit the ground running with what you need to start delivering components. This repo includes:
14
+
15
+ - ✅ Library and component scaffolding
16
+ - ✅ [Storybook](https://storybook.js.org/docs/get-started/frameworks/web-components-vite?renderer=web-components) integration (with [helpers](https://www.npmjs.com/package/wc-storybook-helpers))
17
+ - ✅ CDN build (in `/cdn`)
18
+ - ✅ NPM build (in `/dist`)
19
+ - ✅ Testing
20
+ - ✅ Documentation
21
+ - ✅ [React wrappers](https://wc-toolkit.com/integrations/react/) (in - `/react`)
22
+ - ✅ [JSX integration](https://wc-toolkit.com/integrations/jsx/) - (in `/types`)
23
+ - ✅ [Vue.js integration](https://www.npmjs.-com/package/-custom-element-vuejs-integration) (in `/types`)
24
+ - ✅ [Svelte integration](https://www.npmjs.-com/package/-custom-element-svelte-integration) (in `/types`)
25
+ - ✅ [Linter](https://wc-toolkit.com/integrations/wctools/) (in `/wc.config.js`)
26
+
27
+ ## Getting Started
28
+
29
+ You can choose to fork this repository directly or you can run the following command to create a new project.
30
+
31
+ ```bash
32
+ npm init lit-starter-kit your-project-name
33
+ ```
34
+
35
+ Once created, navigate to your project directory and install dependencies:
36
+
37
+ ```bash
38
+ cd your-project-name
39
+ ```
40
+
41
+ ## Project Structure
42
+
43
+ Understanding the project structure will help you navigate and customize the library:
44
+
45
+ ```text
46
+ ├── src/ # Source code for your components
47
+ │ ├── index.ts # Main entry point
48
+ │ └── components/ # Component definitions
49
+ ├── dist/ # NPM package build output (generated)
50
+ ├── cdn/ # CDN build output (generated)
51
+ ├── react/ # React wrapper components (generated)
52
+ ├── types/ # Framework type definitions (JSX, Vue, Svelte)
53
+ ├── plop-templates/ # Component generator templates
54
+ ├── public/ # Build outputs for CDN, HTML, and React
55
+ └── .storybook/ # Storybook configuration
56
+ ```
57
+
58
+ ## Running the Code
59
+
60
+ The development environment uses [Storybook](https://storybook.js.org/) to showcase and document the components. The documentation files are written in MDX files to increase portability in case you wan to use a different tool for documenting your components.
61
+
62
+ ```bash
63
+ npm run dev
64
+ ```
65
+
66
+ This command will:
67
+ - Build your components
68
+ - Watch for changes and rebuild automatically
69
+ - Start Storybook on http://localhost:6006
70
+
71
+ ### Creating a New Component
72
+
73
+ This project leverages [plop](https://www.npmjs.com/package/plop) to generate new components in your library. You can create a new component by running the following command and following the prompts.
74
+
75
+ ```bash
76
+ npm run new
77
+ ```
78
+
79
+ This will scaffold:
80
+ - Component TypeScript file
81
+ - Styles file
82
+ - Test file
83
+ - Storybook stories
84
+ - MDX documentation
85
+
86
+ ## Linting & Formatting
87
+
88
+ Maintain code quality with built-in linting and formatting tools:
89
+
90
+ ```bash
91
+ # Run all linters
92
+ npm run lint
93
+
94
+ # Run ESLint
95
+ npm run lint:eslint
96
+
97
+ # Run Prettier check
98
+ npm run lint:prettier
99
+
100
+ # Auto-fix issues
101
+ npm run format
102
+ ```
103
+
104
+ ## Building the Project
105
+
106
+ Generating the final build assets will generate the `dist` assets for the NPM package, the content for the CDN located in the `cdn` directory at the root of the project, as well as the meta content for your components like framework integrations like types and react wrappers.
107
+
108
+ ```bash
109
+ npm run build
110
+ ```
111
+
112
+ This generates:
113
+ - **`/dist`** - NPM package distribution files
114
+ - **`/cdn`** - CDN-ready bundles for direct browser usage
115
+ - **`/react`** - React wrapper components
116
+ - **`/types`** - TypeScript definitions and framework integrations
117
+ - **`custom-elements.json`** - Component metadata manifest
118
+
119
+ ### Building for Specific Targets
120
+
121
+ ```bash
122
+ # Build only CDN version
123
+ npm run build:cdn
124
+
125
+ # Build only React wrappers
126
+ npm run build:react
127
+
128
+ # Build static Storybook documentation
129
+ npm run build-storybook
130
+ ```
131
+
132
+ ## Testing the Components
133
+
134
+ Tests are written and executed using [web-test-runner](https://modern-web.dev/docs/test-runner/overview/) which execute your tests in _real_ browsers to validate your APIs are working as expected in the environments you intend to be using them in.
135
+
136
+ Tests can be configured in the `web-test-runner.config.js` file located at the root of the project.
137
+
138
+ Tests can be run using the following command:
139
+
140
+ ```bash
141
+ npm test
142
+ ```
143
+
144
+ ## Using Your Components
145
+
146
+ Once built, your components can be used in multiple ways:
147
+
148
+ ### Via NPM Package
149
+
150
+ ```bash
151
+ npm install your-package-name
152
+ ```
153
+
154
+ ```javascript
155
+ // Import all components
156
+ import 'your-package-name';
157
+
158
+ // Or import specific components
159
+ import 'your-package-name/components/button';
160
+
161
+ // Use in your HTML
162
+ <my-button variant="primary">Click Me</my-button>
163
+ ```
164
+
165
+ ### Via CDN
166
+
167
+ ```html
168
+ <script type="module">
169
+ import 'https://cdn.example.com/your-package/index.js';
170
+ </script>
171
+
172
+ <my-button>Click Me</my-button>
173
+ ```
174
+
175
+ ### With React
176
+
177
+ ```jsx
178
+ import { MyButton } from 'your-package-name/react';
179
+
180
+ function App() {
181
+ return <MyButton variant="primary">Click Me</MyButton>;
182
+ }
183
+ ```
184
+
185
+ ### With TypeScript/JSX
186
+
187
+ TypeScript and JSX support is included via the `/types` directory. Type definitions are automatically recognized by TypeScript when you import the components.
188
+
189
+ ### With Vue.js and Svelte
190
+
191
+ Framework-specific type integrations are provided in the `/types` directory for Vue.js and Svelte to ensure proper type checking and intellisense.
192
+
193
+ ## Publishing Your Library
194
+
195
+ Before publishing, update your package details:
196
+
197
+ 1. **Update package.json:**
198
+ ```json
199
+ {
200
+ "name": "@your-scope/your-package-name",
201
+ "version": "1.0.0",
202
+ "description": "Your component library description",
203
+ "author": "Your Name",
204
+ "repository": {
205
+ "type": "git",
206
+ "url": "https://github.com/your-username/your-repo"
207
+ }
208
+ }
209
+ ```
210
+
211
+ 2. **Build and publish:**
212
+ ```bash
213
+ npm run build
214
+ npm publish
215
+ ```
216
+
217
+ Or use the deploy script:
218
+ ```bash
219
+ npm run deploy
220
+ ```
221
+
222
+ 3. **For scoped packages:**
223
+ ```bash
224
+ npm publish --access public
225
+ ```
226
+
227
+ ## Customization
228
+
229
+ ### Renaming Your Package
230
+
231
+ 1. Update the `name` field in [package.json](package.json)
232
+ 2. Update component prefixes in your source files
233
+ 3. Update import paths throughout the project
234
+
235
+ ### Configuring the Build
236
+
237
+ - **Vite config:** [vite.config.ts](vite.config.ts)
238
+ - **TypeScript:** [tsconfig.json](tsconfig.json)
239
+ - **Custom Elements Manifest:** [custom-elements-manifest.config.js](custom-elements-manifest.config.js)
240
+
241
+ ### Theming & Styling
242
+
243
+ Components use Lit's styling system. Create shared styles in a common file and import them into your components:
244
+
245
+ ```typescript
246
+ import { css } from 'lit';
247
+
248
+ export const sharedStyles = css`
249
+ :host {
250
+ /* Your shared styles */
251
+ }
252
+ `;
253
+ ```
254
+
255
+ ## Deploying Documentation
256
+
257
+ To deploy your Storybook documentation:
258
+
259
+ ```bash
260
+ npm run build-storybook
261
+ ```
262
+
263
+ This creates a static site in `storybook-static/` that can be deployed to:
264
+ - GitHub Pages
265
+ - Netlify
266
+ - Vercel
267
+ - Any static hosting service
268
+
269
+ ## Troubleshooting
270
+
271
+ ### Build Errors
272
+
273
+ - **"Module not found"**: Ensure all dependencies are installed with `pnpm install`
274
+ - **TypeScript errors**: Check [tsconfig.json](tsconfig.json) configuration
275
+ - **Import path issues**: Verify file extensions are included in imports (`.js` for TypeScript files)
276
+
277
+ ### Storybook Issues
278
+
279
+ - **Port already in use**: Storybook runs on port 6006 by default. Stop other processes or change the port in the storybook script
280
+ - **Components not updating**: Clear Storybook cache and rebuild
281
+
282
+ ### Test Failures
283
+
284
+ - **Browser not found**: Run `npx playwright install` to install test browsers
285
+ - **Tests timing out**: Increase timeout in [web-test-runner.config.js](web-test-runner.config.js)
286
+
287
+ ## Contributing
288
+
289
+ Contributions are welcome! This project uses:
290
+ - **Husky** for git hooks
291
+ - **lint-staged** for pre-commit linting
292
+ - **Prettier** for code formatting
293
+ - **ESLint** for code quality
294
+
295
+ Code is automatically formatted and linted on commit.
296
+
297
+ ## License
298
+
299
+ MIT
@@ -0,0 +1,25 @@
1
+ import { LitElement } from 'lit';
2
+ /**
3
+ * An example button component
4
+ *
5
+ * @tag my-button
6
+ *
7
+ * @csspart control - The button element
8
+ *
9
+ * @cssproperty [--button-bg-color=#f0f0f0] - The background color of the button
10
+ * @cssproperty [--button-fg-color=#333] - The text color of the button
11
+ * @cssproperty [--button-border-color=transparent] - The border color of the button
12
+ *
13
+ * @slot - The main content for the button
14
+ *
15
+ */
16
+ export default class MyButton extends LitElement {
17
+ static styles: import('lit').CSSResult;
18
+ /** Changes the display of the button */
19
+ variation?: 'default' | 'primary' | 'hollow' | 'transparent';
20
+ /** Controls the disabled property of the button */
21
+ disabled: boolean;
22
+ render(): import('lit').TemplateResult<1>;
23
+ }
24
+ export { MyButton };
25
+ //# sourceMappingURL=button.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../src/components/button/button.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,UAAU,EAAE,MAAM,KAAK,CAAC;AAIvC;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,UAAU;IAC9C,OAAgB,MAAM,0BAAU;IAEhC,wCAAwC;IAExC,SAAS,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,aAAa,CAAC;IAE7D,mDAAmD;IAEnD,QAAQ,UAAS;IAER,MAAM;CAOhB;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC"}