lime-elements-vue 1.0.7 → 1.0.10
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 +156 -0
- package/dist/index.cjs.js +22 -20
- package/dist/index.d.ts +9 -0
- package/dist/index.js +7 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
# lime-elements-vue
|
|
2
|
+
|
|
3
|
+
Vue 3 wrapper for [@limetech/lime-elements](https://github.com/Lundalogik/lime-elements) web components.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install lime-elements-vue
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
### 1. Configure Vite (Required)
|
|
14
|
+
|
|
15
|
+
Add this to your `vite.config.ts`:
|
|
16
|
+
|
|
17
|
+
```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 ESM files to assets folder
|
|
33
|
+
viteStaticCopy({
|
|
34
|
+
targets: [
|
|
35
|
+
{
|
|
36
|
+
src: 'node_modules/@limetech/lime-elements/dist/esm/*',
|
|
37
|
+
dest: 'assets/'
|
|
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
|
+
})
|
|
47
|
+
```
|
|
48
|
+
|
|
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
|
+
**Important:** Set `resourcesUrl` to match where you copied the files in your Vite config.
|
|
58
|
+
|
|
59
|
+
```typescript
|
|
60
|
+
import { createApp } from 'vue'
|
|
61
|
+
import { LimeElementsVue } from 'lime-elements-vue'
|
|
62
|
+
import App from './App.vue'
|
|
63
|
+
|
|
64
|
+
const app = createApp(App)
|
|
65
|
+
|
|
66
|
+
// Match this to your viteStaticCopy dest path
|
|
67
|
+
app.use(LimeElementsVue, {
|
|
68
|
+
resourcesUrl: '/assets/' // Must match the 'dest' in viteStaticCopy config
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
app.mount('#app')
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### 3. Use components in your templates
|
|
75
|
+
|
|
76
|
+
```vue
|
|
77
|
+
<template>
|
|
78
|
+
<div>
|
|
79
|
+
<limel-button label="Click me" @click="handleClick" />
|
|
80
|
+
<limel-input-field v-model="value" label="Enter text" />
|
|
81
|
+
</div>
|
|
82
|
+
</template>
|
|
83
|
+
|
|
84
|
+
<script setup lang="ts">
|
|
85
|
+
import { ref } from 'vue'
|
|
86
|
+
|
|
87
|
+
const value = ref('')
|
|
88
|
+
|
|
89
|
+
const handleClick = () => {
|
|
90
|
+
console.log('Button clicked!')
|
|
91
|
+
}
|
|
92
|
+
</script>
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Configuration Options
|
|
96
|
+
|
|
97
|
+
### Development vs Production
|
|
98
|
+
|
|
99
|
+
- **Development**: The default `resourcesUrl` points to `/node_modules/@limetech/lime-elements/dist/` which works with Vite's dev server
|
|
100
|
+
- **Production**: You **must** configure `resourcesUrl` to match where you copy the assets using `vite-plugin-static-copy`
|
|
101
|
+
|
|
102
|
+
### Alternative: Copy to different location
|
|
103
|
+
|
|
104
|
+
If you prefer a different location:
|
|
105
|
+
|
|
106
|
+
```typescript
|
|
107
|
+
// In vite.config.ts
|
|
108
|
+
viteStaticCopy({
|
|
109
|
+
targets: [
|
|
110
|
+
{
|
|
111
|
+
src: 'node_modules/@limetech/lime-elements/dist/esm/*',
|
|
112
|
+
dest: 'lime-elements/' // Custom destination
|
|
113
|
+
}
|
|
114
|
+
]
|
|
115
|
+
})
|
|
116
|
+
|
|
117
|
+
// In your app
|
|
118
|
+
app.use(LimeElementsVue, {
|
|
119
|
+
resourcesUrl: '/lime-elements/' // Must match!
|
|
120
|
+
})
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Using a CDN
|
|
124
|
+
|
|
125
|
+
```typescript
|
|
126
|
+
app.use(LimeElementsVue, {
|
|
127
|
+
resourcesUrl: 'https://your-cdn.com/lime-elements/'
|
|
128
|
+
})
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Available Components
|
|
132
|
+
|
|
133
|
+
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/).
|
|
134
|
+
|
|
135
|
+
## Troubleshooting
|
|
136
|
+
|
|
137
|
+
### 404 errors for component files
|
|
138
|
+
|
|
139
|
+
If you see 404 errors like `GET http://localhost:xxxx/limel-checkbox.entry.js 404 (Not Found)`:
|
|
140
|
+
|
|
141
|
+
1. **Check your `resourcesUrl`** - It must match the `dest` path in `viteStaticCopy` config
|
|
142
|
+
2. **Ensure you're copying the right files** - Use `dist/esm/*` not just `dist`
|
|
143
|
+
3. **Include trailing slash** - `resourcesUrl: '/assets/'` not `/assets`
|
|
144
|
+
4. **Configure Vite properly**:
|
|
145
|
+
- `optimizeDeps.exclude: ['@limetech/lime-elements']`
|
|
146
|
+
- `isCustomElement: (tag) => tag.includes('-')`
|
|
147
|
+
|
|
148
|
+
### Development mode 404 errors
|
|
149
|
+
|
|
150
|
+
For development, either:
|
|
151
|
+
- Use the default (no resourcesUrl option) which points to `/node_modules/@limetech/lime-elements/dist/`
|
|
152
|
+
- Or configure Vite's server to serve node_modules
|
|
153
|
+
|
|
154
|
+
## License
|
|
155
|
+
|
|
156
|
+
MIT
|
package/dist/index.cjs.js
CHANGED
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
2
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
get: function () { return components_1[key]; }
|
|
12
|
-
});
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
const loader_1 = require("@limetech/lime-elements/loader");
|
|
16
|
-
|
|
17
|
-
exports.LimeElementsVue = {
|
|
18
|
-
async install() {
|
|
19
|
-
loader_1.applyPolyfills().then(() => {
|
|
20
|
-
loader_1.defineCustomElements();
|
|
21
|
-
});
|
|
22
|
-
}
|
|
17
|
+
__exportStar(require("./components"), exports);
|
|
18
|
+
const loader_1 = require("@limetech/lime-elements/dist/loader");
|
|
19
|
+
exports.default = {
|
|
20
|
+
install(app) {
|
|
21
|
+
(0, loader_1.applyPolyfills)().then(() => {
|
|
22
|
+
(0, loader_1.defineCustomElements)(window);
|
|
23
|
+
});
|
|
24
|
+
},
|
|
23
25
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
1
|
export * from './components';
|
|
2
2
|
import type { Plugin } from 'vue';
|
|
3
|
+
export interface LimeElementsVueOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Custom URL for lime-elements resources.
|
|
6
|
+
* Default: '/node_modules/@limetech/lime-elements/dist/' (works in dev mode)
|
|
7
|
+
* For production, set this to match where you copy the assets
|
|
8
|
+
* Example: '/assets/' if you copy dist/esm/* to assets/
|
|
9
|
+
*/
|
|
10
|
+
resourcesUrl?: string;
|
|
11
|
+
}
|
|
3
12
|
export declare const LimeElementsVue: Plugin;
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
export * from './components';
|
|
2
2
|
import { applyPolyfills, defineCustomElements } from '@limetech/lime-elements/dist/loader';
|
|
3
3
|
export const LimeElementsVue = {
|
|
4
|
-
async install() {
|
|
4
|
+
async install(_app, options) {
|
|
5
5
|
applyPolyfills().then(() => {
|
|
6
|
-
|
|
6
|
+
// Default works for dev mode with Vite
|
|
7
|
+
// For production, users should set resourcesUrl to match their build config
|
|
8
|
+
const resourcesUrl = options?.resourcesUrl ?? '/node_modules/@limetech/lime-elements/dist/';
|
|
9
|
+
defineCustomElements(window, {
|
|
10
|
+
resourcesUrl
|
|
11
|
+
});
|
|
7
12
|
});
|
|
8
13
|
},
|
|
9
14
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lime-elements-vue",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.10",
|
|
4
4
|
"description": "Vue 3 wrapper for @limetech/lime-elements web components",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"lime-elements",
|
|
24
24
|
"stencil"
|
|
25
25
|
],
|
|
26
|
-
"author": "
|
|
26
|
+
"author": "Piotr Adamczyk <piotr.adamczyk@lundalogik.com>",
|
|
27
27
|
"license": "MIT",
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@limetech/lime-elements": "^38.28.0",
|