lime-elements-vue 1.0.8 → 1.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/README.md CHANGED
@@ -1,129 +1,134 @@
1
- # lime-elements-vue
1
+ # Lime Elements Vue
2
2
 
3
- Vue 3 wrapper for [@limetech/lime-elements](https://github.com/Lundalogik/lime-elements) web components.
3
+ Vue 3 wrapper for [Lime Elements](https://github.com/Lundalogik/lime-elements) web components.
4
4
 
5
5
  ## Installation
6
6
 
7
7
  ```bash
8
- npm install lime-elements-vue
8
+ npm install @limetech/lime-elements-vue
9
9
  ```
10
10
 
11
11
  ## Usage
12
12
 
13
- ### 1. Configure Vite (Required)
14
-
15
- Add this to your `vite.config.ts`:
16
-
17
13
  ```typescript
18
- import { defineConfig } from 'vite'
19
- import vue from '@vitejs/plugin-vue'
20
- import { viteStaticCopy } from 'vite-plugin-static-copy'
21
-
22
- export default defineConfig({
23
- plugins: [
24
- vue({
25
- template: {
26
- compilerOptions: {
27
- // Tell Vue that all tags with a hyphen are custom elements
28
- isCustomElement: (tag) => tag.includes('-')
29
- }
30
- }
31
- }),
32
- // Copy lime-elements assets to your public folder
33
- viteStaticCopy({
34
- targets: [
35
- {
36
- src: 'node_modules/@limetech/lime-elements/dist',
37
- dest: 'lime-elements'
38
- }
39
- ]
40
- })
41
- ],
42
- optimizeDeps: {
43
- // Don't pre-bundle lime-elements to allow dynamic imports to work
44
- exclude: ['@limetech/lime-elements']
45
- }
46
- })
14
+ // main.ts
15
+ import { createApp } from 'vue';
16
+ import App from './App.vue';
17
+ import { LimeElementsVue } from '@limetech/lime-elements-vue';
18
+ import '@limetech/lime-elements-vue/css/lime-elements.css';
19
+
20
+ const app = createApp(App);
21
+ app.use(LimeElementsVue);
22
+ app.mount('#app');
47
23
  ```
48
24
 
49
- **Install the required plugin:**
50
-
51
- ```bash
52
- npm install -D vite-plugin-static-copy
53
- ```
54
-
55
- ### 2. Register the plugin globally
56
-
57
- ```typescript
58
- import { createApp } from 'vue'
59
- import { LimeElementsVue } from 'lime-elements-vue'
60
- import App from './App.vue'
61
-
62
- const app = createApp(App)
63
- // Point to the copied assets
64
- app.use(LimeElementsVue, {
65
- resourcesUrl: '/lime-elements/dist/'
66
- })
67
- app.mount('#app')
68
- ```
69
-
70
- ### 3. Use components in your templates
25
+ Then in your components:
71
26
 
72
27
  ```vue
73
28
  <template>
74
- <div>
75
- <limel-button label="Click me" @click="handleClick" />
76
- <limel-input-field v-model="value" label="Enter text" />
77
- </div>
29
+ <limel-button label="Click me" :primary="true" @click="handleClick" />
30
+ <limel-checkbox label="Check me" :checked="checked" @change="handleChange" />
78
31
  </template>
32
+ ```
79
33
 
80
- <script setup lang="ts">
81
- import { ref } from 'vue'
34
+ ### Vite Configuration
82
35
 
83
- const value = ref('')
36
+ Add custom elements support to your Vite config:
84
37
 
85
- const handleClick = () => {
86
- console.log('Button clicked!')
87
- }
88
- </script>
38
+ ```typescript
39
+ // vite.config.ts
40
+ import vue from '@vitejs/plugin-vue';
41
+
42
+ export default defineConfig({
43
+ plugins: [
44
+ vue({
45
+ template: {
46
+ compilerOptions: {
47
+ isCustomElement: (tag) => tag.startsWith('limel-'),
48
+ },
49
+ },
50
+ }),
51
+ ],
52
+ });
89
53
  ```
90
54
 
91
- ## Development vs Production
55
+ ## Development
92
56
 
93
- The default `resourcesUrl` is set to `/node_modules/@limetech/lime-elements/dist/` which works in **development mode only**.
57
+ ### Prerequisites
94
58
 
95
- For production builds, you **must** use `vite-plugin-static-copy` as shown above to copy the assets and configure the `resourcesUrl` option.
59
+ - Node.js 18+
60
+ - npm 8+
61
+ - Python 3.8+ (for orchestration script)
96
62
 
97
- ## Advanced Configuration
63
+ ### Setup
98
64
 
99
- ### Custom Resource URL
65
+ ```bash
66
+ # Clone with submodules
67
+ git clone --recurse-submodules https://github.com/Lundalogik/lime-elements-vue.git
68
+ cd lime-elements-vue
100
69
 
101
- If you're serving from a CDN:
70
+ # Or if already cloned
71
+ git submodule update --init --recursive
102
72
 
103
- ```typescript
104
- app.use(LimeElementsVue, {
105
- resourcesUrl: 'https://your-cdn.com/lime-elements/dist/'
106
- })
73
+ # Install dependencies
74
+ npm install
75
+ cd demo && npm install && cd ..
107
76
  ```
108
77
 
109
- ## Available Components
78
+ ### Build
110
79
 
111
- This package provides Vue 3 wrappers for all lime-elements components. For detailed documentation on each component, please refer to the [lime-elements documentation](https://lundalogik.github.io/lime-elements/).
80
+ ```bash
81
+ # Full build
82
+ ./build.sh
112
83
 
113
- ## Troubleshooting
84
+ # Or using Python orchestrator
85
+ python run.py build
86
+ ```
114
87
 
115
- ### 404 errors for component files in development
88
+ ### Development
116
89
 
117
- If you see 404 errors like `GET http://localhost:xxxx/limel-checkbox.entry.js 404 (Not Found)` in development:
90
+ ```bash
91
+ # Start demo app
92
+ python run.py dev
93
+
94
+ # Or manually
95
+ cd demo && npm run dev
96
+ ```
118
97
 
119
- 1. The default resourcesUrl should work with Vite's dev server
120
- 2. Ensure `optimizeDeps.exclude: ['@limetech/lime-elements']` is set
121
- 3. Make sure `isCustomElement: (tag) => tag.includes('-')` is configured
98
+ ### Commands (run.py)
122
99
 
123
- ### 404 errors in production build
100
+ | Command | Description |
101
+ | --------- | ------------------------------------------ |
102
+ | `setup` | Install all dependencies |
103
+ | `build` | Full build process |
104
+ | `dev` | Start demo in dev mode |
105
+ | `clean` | Clean all build artifacts |
106
+ | `publish` | Publish to NPM (dry-run) |
107
+ | `all` | Setup + Build |
108
+ | `test` | Build and start demo |
124
109
 
125
- You must copy the assets using `vite-plugin-static-copy` and configure the `resourcesUrl` option when installing the plugin.
110
+ ## Project Structure
111
+
112
+ ```
113
+ lime-elements-vue-transpiled/
114
+ ├── lime-elements/ # Git submodule (source components)
115
+ ├── src/
116
+ │ ├── index.ts # Main entry point
117
+ │ └── components.ts # Generated Vue proxies
118
+ ├── config/
119
+ │ └── stencil.config.vue.ts
120
+ ├── scripts/
121
+ │ └── post-process.js
122
+ ├── dist/ # Build output
123
+ │ ├── index.esm.js
124
+ │ ├── index.cjs.js
125
+ │ └── css/
126
+ ├── demo/ # Vue 3 demo app
127
+ ├── build.sh
128
+ ├── run.py
129
+ └── package.json
130
+ ```
126
131
 
127
132
  ## License
128
133
 
129
- MIT
134
+ Apache-2.0