@nova-design-system/nova-vue 3.0.0-beta.17
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/LICENSE.MD +157 -0
- package/README.md +92 -0
- package/dist/generated/components.d.ts +24 -0
- package/dist/generated/components.js +276 -0
- package/dist/generated/vue-component-lib/utils.d.ts +16 -0
- package/dist/generated/vue-component-lib/utils.js +188 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/plugin.d.ts +16 -0
- package/dist/plugin.js +51 -0
- package/package.json +50 -0
package/LICENSE.MD
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
# End-User License Agreement: Nova Design System
|
|
2
|
+
|
|
3
|
+
This End-User License Agreement ("Agreement") is entered into between:
|
|
4
|
+
|
|
5
|
+
1. **Elia Group NV**
|
|
6
|
+
|
|
7
|
+
Located at Keizerslaan 20, 1000 Brussel, registered at the Crossroads Bank for Enterprises in Belgium under number 0476.388.378 (hereafter: “Licensor”, “Elia”, “We”, “Our” or “Us”), and
|
|
8
|
+
|
|
9
|
+
2. **Subsidiaries, Partners, or Affiliates**
|
|
10
|
+
|
|
11
|
+
Collectively referred to as the "Licensee".
|
|
12
|
+
|
|
13
|
+
**Licensor** and **Licensee** may both be referred to as a “Party” and jointly as the “Parties”.
|
|
14
|
+
|
|
15
|
+
This Agreement can only be entered into by a party which qualifies as the “Licensee”. Any attempt by Third Parties to claim rights or licenses under this Agreement shall be considered null and void, as the Agreement is strictly limited to the Licensee, as defined herein.
|
|
16
|
+
|
|
17
|
+
## Article 1: Definitions
|
|
18
|
+
|
|
19
|
+
### 1.1 Affiliate
|
|
20
|
+
|
|
21
|
+
A business entity related to Elia through ownership, control, or shared interests, as per Article 1:15 of the Belgian Code of Companies and Associations.
|
|
22
|
+
|
|
23
|
+
### 1.2 Effective Date
|
|
24
|
+
|
|
25
|
+
The date from which the Licensee accesses and downloads the Works.
|
|
26
|
+
|
|
27
|
+
### 1.3 Elia Projects
|
|
28
|
+
|
|
29
|
+
Initiatives, projects, or tasks directly relating to Elia’s business operations or those of Subsidiaries, Affiliates, or Partners, including development, execution, or management of services or products.
|
|
30
|
+
|
|
31
|
+
### 1.4 Intellectual Property Rights
|
|
32
|
+
|
|
33
|
+
Any intellectual property rights, including copyrights, trademarks, patents, and related rights worldwide.
|
|
34
|
+
|
|
35
|
+
### 1.5 License
|
|
36
|
+
|
|
37
|
+
As described in Article 2.1.
|
|
38
|
+
|
|
39
|
+
### 1.6 Partner
|
|
40
|
+
|
|
41
|
+
A business partner, subcontractor, or service provider of Elia engaged in Elia Projects.
|
|
42
|
+
|
|
43
|
+
### 1.7 Subsidiary
|
|
44
|
+
|
|
45
|
+
An entity directly or indirectly controlled by the Licensee, per Article 1:14 of the Belgian Code of Companies and Associations.
|
|
46
|
+
|
|
47
|
+
### 1.8 Territory
|
|
48
|
+
|
|
49
|
+
The entire world.
|
|
50
|
+
|
|
51
|
+
### 1.9 Third Party
|
|
52
|
+
|
|
53
|
+
A person or entity not defined as a Party, Subsidiary, Affiliate, or Partner of the Licensor.
|
|
54
|
+
|
|
55
|
+
### 1.10 Works
|
|
56
|
+
|
|
57
|
+
All elements and visuals in the UI library of the "Nova Design System", including source code and associated materials.
|
|
58
|
+
|
|
59
|
+
## Article 2: Grant of License
|
|
60
|
+
|
|
61
|
+
### 2.1 License Grant
|
|
62
|
+
|
|
63
|
+
The **Licensor** grants the **Licensee** a non-exclusive, revocable, sublicensable, and non-transferable right to use the Works worldwide solely for Elia Projects.
|
|
64
|
+
|
|
65
|
+
### 2.2 Usage Rights
|
|
66
|
+
|
|
67
|
+
The usage rights include reproduction, translation, and public communication, provided the Licensee complies with the Agreement.
|
|
68
|
+
|
|
69
|
+
### 2.3 Reporting Infringements
|
|
70
|
+
|
|
71
|
+
Licensee must inform Licensor of any Intellectual Property infringement.
|
|
72
|
+
|
|
73
|
+
## Article 3: Ownership of Intellectual Property Rights
|
|
74
|
+
|
|
75
|
+
### 3.1 Ownership Retained
|
|
76
|
+
|
|
77
|
+
The **Licensor** retains all ownership rights to the Intellectual Property related to the Works.
|
|
78
|
+
|
|
79
|
+
### 3.2 Updates
|
|
80
|
+
|
|
81
|
+
Updates may be implemented by the Licensor without prior notice. Licensee may choose whether to implement updates.
|
|
82
|
+
|
|
83
|
+
## Article 4: Permitted Use and Restrictions
|
|
84
|
+
|
|
85
|
+
### 4.1 Permitted Use
|
|
86
|
+
|
|
87
|
+
- The Works may only be used by employees or contractors of the Licensee in Elia Projects.
|
|
88
|
+
|
|
89
|
+
- Installation is restricted to devices owned or controlled by the Licensee.
|
|
90
|
+
|
|
91
|
+
### 4.2 Restrictions
|
|
92
|
+
|
|
93
|
+
The Works must not be:
|
|
94
|
+
|
|
95
|
+
- Shared, sublicensed, or otherwise transferred to Third Parties.
|
|
96
|
+
|
|
97
|
+
- Reverse-engineered, decompiled, or disassembled.
|
|
98
|
+
|
|
99
|
+
## Article 5: Liability and Disclaimer of Warranties
|
|
100
|
+
|
|
101
|
+
### 5.1 Disclaimer
|
|
102
|
+
|
|
103
|
+
The Works are provided "as is", without warranty of any kind. The **Licensor** disclaims all implied warranties.
|
|
104
|
+
|
|
105
|
+
### 5.2 Limitation of Liability
|
|
106
|
+
|
|
107
|
+
The **Licensor** limits its liability to €1,000. The Licensee assumes all risks related to the use of the Works.
|
|
108
|
+
|
|
109
|
+
## Article 6: Term and Termination
|
|
110
|
+
|
|
111
|
+
### 6.1 Initial Term
|
|
112
|
+
|
|
113
|
+
The Agreement is effective indefinitely from the Effective Date unless terminated.
|
|
114
|
+
|
|
115
|
+
### 6.2 Termination by Notice
|
|
116
|
+
|
|
117
|
+
Either Party may terminate with one month's written notice.
|
|
118
|
+
|
|
119
|
+
### 6.3 Automatic Termination
|
|
120
|
+
|
|
121
|
+
Termination occurs automatically upon:
|
|
122
|
+
|
|
123
|
+
- Changes in control, ownership, or project participation.
|
|
124
|
+
|
|
125
|
+
- Breach of material terms by the Licensee, following written notice.
|
|
126
|
+
|
|
127
|
+
### 6.4 Post-Termination Obligations
|
|
128
|
+
|
|
129
|
+
Upon termination, the **Licensee** must cease using and destroy all copies of the Works.
|
|
130
|
+
|
|
131
|
+
## Article 7: Miscellaneous
|
|
132
|
+
|
|
133
|
+
### 7.1 Waiver
|
|
134
|
+
|
|
135
|
+
Waivers must be in writing and do not constitute ongoing waivers of similar rights.
|
|
136
|
+
|
|
137
|
+
### 7.2 Costs
|
|
138
|
+
|
|
139
|
+
Each Party bears its own implementation costs.
|
|
140
|
+
|
|
141
|
+
### 7.3 Assignment
|
|
142
|
+
|
|
143
|
+
The Agreement may not be assigned without prior consent from the **Licensor**.
|
|
144
|
+
|
|
145
|
+
### 7.4 Severability
|
|
146
|
+
|
|
147
|
+
Invalid provisions will not affect the remainder of the Agreement.
|
|
148
|
+
|
|
149
|
+
## Article 8: Governing Law and Jurisdiction
|
|
150
|
+
|
|
151
|
+
### 8.1 Governing Law
|
|
152
|
+
|
|
153
|
+
This Agreement is governed by Belgian law.
|
|
154
|
+
|
|
155
|
+
### 8.2 Jurisdiction
|
|
156
|
+
|
|
157
|
+
The Dutch-speaking courts of Brussels have exclusive jurisdiction for disputes.
|
package/README.md
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# Nova Components Vue
|
|
2
|
+
|
|
3
|
+
**Nova Components Vue** is a Vue.js wrapper that allows you to seamlessly integrate Nova's native UI elements into your Vue applications. This package provides Vue-compatible components, making it easy to build modern and consistent user interfaces with Nova UI components in a Vue environment.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
To begin, install the necessary Nova packages using your package manager:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @nova-design-system/nova-webcomponents @nova-design-system/nova-base @nova-design-system/nova-vue
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
or
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
yarn add @nova-design-system/nova-webcomponents @nova-design-system/nova-base @nova-design-system/nova-vue
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Setup
|
|
20
|
+
|
|
21
|
+
After installing the packages, you'll need to include the Nova UI CSS and register the Nova Components Vue plugin in your `main.ts` file:
|
|
22
|
+
|
|
23
|
+
```typescript
|
|
24
|
+
import { createApp } from 'vue';
|
|
25
|
+
import App from './App.vue';
|
|
26
|
+
|
|
27
|
+
import '@nova-design-system/nova-base/dist/css/nova-utils.css';
|
|
28
|
+
import '@nova-design-system/nova-base/assets/nova-fonts.css';
|
|
29
|
+
import '@nova-design-system/nova-base/dist/css/spark.css'; // or ocean.css
|
|
30
|
+
import { NovaComponents } from '@nova-design-system/nova-vue/plugin';
|
|
31
|
+
|
|
32
|
+
createApp(App).use(NovaComponents).mount('#app');
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
This setup makes Nova's web components available throughout your Vue application.
|
|
36
|
+
|
|
37
|
+
## Nova Font Pro Integration
|
|
38
|
+
|
|
39
|
+
To use Nova fonts in your Vue application, you'll need to contact the Nova team via Teams, email, or check the [Nova Wiki](https://dev.azure.com/elia-digitization/Nova/_wiki/wikis/Nova.wiki/30245/Nova-Font-Pro) to obtain the full CDN URL. Once you have the URL, you can integrate it using any of these methods:
|
|
40
|
+
|
|
41
|
+
### Option 1: Import in Main Entry (Recommended)
|
|
42
|
+
In your `main.ts` or `main.js`:
|
|
43
|
+
|
|
44
|
+
```typescript
|
|
45
|
+
import { createApp } from 'vue';
|
|
46
|
+
import App from './App.vue';
|
|
47
|
+
import '@nova-design-system/nova-base/dist/css/nova-utils.css';
|
|
48
|
+
import '@nova-design-system/nova-base/dist/css/spark.css';
|
|
49
|
+
import 'https://novaassets.azureedge.net/fonts/nova-fonts-pro.css';
|
|
50
|
+
|
|
51
|
+
createApp(App).mount('#app');
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Option 2: HTML Integration
|
|
55
|
+
In your `index.html`:
|
|
56
|
+
|
|
57
|
+
```html
|
|
58
|
+
<!DOCTYPE html>
|
|
59
|
+
<html>
|
|
60
|
+
<head>
|
|
61
|
+
<link rel="stylesheet" href="https://novaassets.azureedge.net/fonts/nova-fonts-pro.css">
|
|
62
|
+
</head>
|
|
63
|
+
<body>
|
|
64
|
+
<div id="app"></div>
|
|
65
|
+
</body>
|
|
66
|
+
</html>
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
The `nova-fonts-pro.css` file includes both font definitions and the `font-family` rule for the `body`, automatically applying the fonts across your Vue application.
|
|
70
|
+
|
|
71
|
+
## Usage
|
|
72
|
+
|
|
73
|
+
With the setup complete, you can now use Nova components in your Vue components. Here's a quick example:
|
|
74
|
+
|
|
75
|
+
```vue
|
|
76
|
+
<script setup lang="ts">
|
|
77
|
+
import { ref } from 'vue';
|
|
78
|
+
import { NvButton } from '@nova-design-system/nova-vue';
|
|
79
|
+
|
|
80
|
+
const count = ref(0);
|
|
81
|
+
</script>
|
|
82
|
+
|
|
83
|
+
<template>
|
|
84
|
+
<NvButton danger @click="count++">count is {{ count }}</NvButton>
|
|
85
|
+
</template>
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
In this example, the `NvButton` component is imported and used within a Vue component. The `danger` prop is passed to style the button, and the `@click` event handler is used to increment the `count` variable.
|
|
89
|
+
|
|
90
|
+
## Conclusion
|
|
91
|
+
|
|
92
|
+
Nova Components Vue provides a convenient way to integrate Nova's native web components into your Vue.js projects. By following the simple setup steps, you can start using these powerful UI components in your Vue applications right away. For more detailed documentation and examples, refer to the official Nova documentation.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { JSX } from '@nova-design-system/nova-webcomponents';
|
|
2
|
+
export declare const NvAlert: import("vue").DefineSetupFnComponent<JSX.NvAlert & import("./vue-component-lib/utils").InputProps<boolean>, {}, {}, JSX.NvAlert & import("./vue-component-lib/utils").InputProps<boolean> & {}, import("vue").PublicProps>;
|
|
3
|
+
export declare const NvAvatar: import("vue").DefineSetupFnComponent<JSX.NvAvatar & import("./vue-component-lib/utils").InputProps<string | number | boolean>, {}, {}, JSX.NvAvatar & import("./vue-component-lib/utils").InputProps<string | number | boolean> & {}, import("vue").PublicProps>;
|
|
4
|
+
export declare const NvBadge: import("vue").DefineSetupFnComponent<JSX.NvBadge & import("./vue-component-lib/utils").InputProps<string | number | boolean>, {}, {}, JSX.NvBadge & import("./vue-component-lib/utils").InputProps<string | number | boolean> & {}, import("vue").PublicProps>;
|
|
5
|
+
export declare const NvBase: import("vue").DefineSetupFnComponent<JSX.NvBase & import("./vue-component-lib/utils").InputProps<string | number | boolean>, {}, {}, JSX.NvBase & import("./vue-component-lib/utils").InputProps<string | number | boolean> & {}, import("vue").PublicProps>;
|
|
6
|
+
export declare const NvButton: import("vue").DefineSetupFnComponent<JSX.NvButton & import("./vue-component-lib/utils").InputProps<string | number | boolean>, {}, {}, JSX.NvButton & import("./vue-component-lib/utils").InputProps<string | number | boolean> & {}, import("vue").PublicProps>;
|
|
7
|
+
export declare const NvCol: import("vue").DefineSetupFnComponent<JSX.NvCol & import("./vue-component-lib/utils").InputProps<string | number | boolean>, {}, {}, JSX.NvCol & import("./vue-component-lib/utils").InputProps<string | number | boolean> & {}, import("vue").PublicProps>;
|
|
8
|
+
export declare const NvFieldcheckbox: import("vue").DefineSetupFnComponent<JSX.NvFieldcheckbox & import("./vue-component-lib/utils").InputProps<boolean>, {}, {}, JSX.NvFieldcheckbox & import("./vue-component-lib/utils").InputProps<boolean> & {}, import("vue").PublicProps>;
|
|
9
|
+
export declare const NvFieldnumber: import("vue").DefineSetupFnComponent<JSX.NvFieldnumber & import("./vue-component-lib/utils").InputProps<number>, {}, {}, JSX.NvFieldnumber & import("./vue-component-lib/utils").InputProps<number> & {}, import("vue").PublicProps>;
|
|
10
|
+
export declare const NvFieldpassword: import("vue").DefineSetupFnComponent<JSX.NvFieldpassword & import("./vue-component-lib/utils").InputProps<string>, {}, {}, JSX.NvFieldpassword & import("./vue-component-lib/utils").InputProps<string> & {}, import("vue").PublicProps>;
|
|
11
|
+
export declare const NvFieldradio: import("vue").DefineSetupFnComponent<JSX.NvFieldradio & import("./vue-component-lib/utils").InputProps<boolean>, {}, {}, JSX.NvFieldradio & import("./vue-component-lib/utils").InputProps<boolean> & {}, import("vue").PublicProps>;
|
|
12
|
+
export declare const NvFieldselect: import("vue").DefineSetupFnComponent<JSX.NvFieldselect & import("./vue-component-lib/utils").InputProps<string>, {}, {}, JSX.NvFieldselect & import("./vue-component-lib/utils").InputProps<string> & {}, import("vue").PublicProps>;
|
|
13
|
+
export declare const NvFieldtext: import("vue").DefineSetupFnComponent<JSX.NvFieldtext & import("./vue-component-lib/utils").InputProps<string>, {}, {}, JSX.NvFieldtext & import("./vue-component-lib/utils").InputProps<string> & {}, import("vue").PublicProps>;
|
|
14
|
+
export declare const NvFieldtextarea: import("vue").DefineSetupFnComponent<JSX.NvFieldtextarea & import("./vue-component-lib/utils").InputProps<string>, {}, {}, JSX.NvFieldtextarea & import("./vue-component-lib/utils").InputProps<string> & {}, import("vue").PublicProps>;
|
|
15
|
+
export declare const NvFieldtoggle: import("vue").DefineSetupFnComponent<JSX.NvFieldtoggle & import("./vue-component-lib/utils").InputProps<boolean>, {}, {}, JSX.NvFieldtoggle & import("./vue-component-lib/utils").InputProps<boolean> & {}, import("vue").PublicProps>;
|
|
16
|
+
export declare const NvIcon: import("vue").DefineSetupFnComponent<JSX.NvIcon & import("./vue-component-lib/utils").InputProps<string | number | boolean>, {}, {}, JSX.NvIcon & import("./vue-component-lib/utils").InputProps<string | number | boolean> & {}, import("vue").PublicProps>;
|
|
17
|
+
export declare const NvIconbutton: import("vue").DefineSetupFnComponent<JSX.NvIconbutton & import("./vue-component-lib/utils").InputProps<string | number | boolean>, {}, {}, JSX.NvIconbutton & import("./vue-component-lib/utils").InputProps<string | number | boolean> & {}, import("vue").PublicProps>;
|
|
18
|
+
export declare const NvLoader: import("vue").DefineSetupFnComponent<JSX.NvLoader & import("./vue-component-lib/utils").InputProps<string | number | boolean>, {}, {}, JSX.NvLoader & import("./vue-component-lib/utils").InputProps<string | number | boolean> & {}, import("vue").PublicProps>;
|
|
19
|
+
export declare const NvMenu: import("vue").DefineSetupFnComponent<JSX.NvMenu & import("./vue-component-lib/utils").InputProps<string | number | boolean>, {}, {}, JSX.NvMenu & import("./vue-component-lib/utils").InputProps<string | number | boolean> & {}, import("vue").PublicProps>;
|
|
20
|
+
export declare const NvMenuitem: import("vue").DefineSetupFnComponent<JSX.NvMenuitem & import("./vue-component-lib/utils").InputProps<string | number | boolean>, {}, {}, JSX.NvMenuitem & import("./vue-component-lib/utils").InputProps<string | number | boolean> & {}, import("vue").PublicProps>;
|
|
21
|
+
export declare const NvPopover: import("vue").DefineSetupFnComponent<JSX.NvPopover & import("./vue-component-lib/utils").InputProps<boolean>, {}, {}, JSX.NvPopover & import("./vue-component-lib/utils").InputProps<boolean> & {}, import("vue").PublicProps>;
|
|
22
|
+
export declare const NvRow: import("vue").DefineSetupFnComponent<JSX.NvRow & import("./vue-component-lib/utils").InputProps<string | number | boolean>, {}, {}, JSX.NvRow & import("./vue-component-lib/utils").InputProps<string | number | boolean> & {}, import("vue").PublicProps>;
|
|
23
|
+
export declare const NvStack: import("vue").DefineSetupFnComponent<JSX.NvStack & import("./vue-component-lib/utils").InputProps<string | number | boolean>, {}, {}, JSX.NvStack & import("./vue-component-lib/utils").InputProps<string | number | boolean> & {}, import("vue").PublicProps>;
|
|
24
|
+
export declare const NvTooltip: import("vue").DefineSetupFnComponent<JSX.NvTooltip & import("./vue-component-lib/utils").InputProps<string | number | boolean>, {}, {}, JSX.NvTooltip & import("./vue-component-lib/utils").InputProps<string | number | boolean> & {}, import("vue").PublicProps>;
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* auto-generated vue proxies */
|
|
4
|
+
import { defineContainer } from './vue-component-lib/utils';
|
|
5
|
+
export const NvAlert = /*@__PURE__*/ defineContainer('nv-alert', undefined, [
|
|
6
|
+
'color',
|
|
7
|
+
'feedback',
|
|
8
|
+
'message',
|
|
9
|
+
'heading',
|
|
10
|
+
'icon',
|
|
11
|
+
'dismissible',
|
|
12
|
+
'preventAutoClose',
|
|
13
|
+
'hidden',
|
|
14
|
+
'hiddenChanged',
|
|
15
|
+
'hiddenChangedComplete',
|
|
16
|
+
'closeClicked'
|
|
17
|
+
], 'hidden', 'hidden-changed');
|
|
18
|
+
export const NvAvatar = /*@__PURE__*/ defineContainer('nv-avatar', undefined, [
|
|
19
|
+
'xsmall',
|
|
20
|
+
'small',
|
|
21
|
+
'medium',
|
|
22
|
+
'large',
|
|
23
|
+
'xlarge',
|
|
24
|
+
'text',
|
|
25
|
+
'url',
|
|
26
|
+
'alt',
|
|
27
|
+
'src',
|
|
28
|
+
'initials',
|
|
29
|
+
'size',
|
|
30
|
+
'color'
|
|
31
|
+
]);
|
|
32
|
+
export const NvBadge = /*@__PURE__*/ defineContainer('nv-badge', undefined, [
|
|
33
|
+
'dismissal',
|
|
34
|
+
'icon',
|
|
35
|
+
'iconLocation',
|
|
36
|
+
'color',
|
|
37
|
+
'label',
|
|
38
|
+
'leadIcon',
|
|
39
|
+
'dismissible',
|
|
40
|
+
'hidden',
|
|
41
|
+
'preventAutoClose',
|
|
42
|
+
'closeClicked',
|
|
43
|
+
'hiddenChanged',
|
|
44
|
+
'hiddenChangedComplete'
|
|
45
|
+
]);
|
|
46
|
+
export const NvBase = /*@__PURE__*/ defineContainer('nv-base', undefined);
|
|
47
|
+
export const NvButton = /*@__PURE__*/ defineContainer('nv-button', undefined, [
|
|
48
|
+
'size',
|
|
49
|
+
'emphasis',
|
|
50
|
+
'danger',
|
|
51
|
+
'loading',
|
|
52
|
+
'disabled',
|
|
53
|
+
'fluid',
|
|
54
|
+
'type'
|
|
55
|
+
]);
|
|
56
|
+
export const NvCol = /*@__PURE__*/ defineContainer('nv-col', undefined, [
|
|
57
|
+
'size'
|
|
58
|
+
]);
|
|
59
|
+
export const NvFieldcheckbox = /*@__PURE__*/ defineContainer('nv-fieldcheckbox', undefined, [
|
|
60
|
+
'message',
|
|
61
|
+
'validation',
|
|
62
|
+
'labelBefore',
|
|
63
|
+
'inputId',
|
|
64
|
+
'name',
|
|
65
|
+
'value',
|
|
66
|
+
'label',
|
|
67
|
+
'labelPlacement',
|
|
68
|
+
'hideLabel',
|
|
69
|
+
'description',
|
|
70
|
+
'error',
|
|
71
|
+
'errorDescription',
|
|
72
|
+
'checked',
|
|
73
|
+
'indeterminate',
|
|
74
|
+
'disabled',
|
|
75
|
+
'readonly',
|
|
76
|
+
'required',
|
|
77
|
+
'checkedChanged'
|
|
78
|
+
], 'checked', 'checked-changed');
|
|
79
|
+
export const NvFieldnumber = /*@__PURE__*/ defineContainer('nv-fieldnumber', undefined, [
|
|
80
|
+
'message',
|
|
81
|
+
'validation',
|
|
82
|
+
'inputId',
|
|
83
|
+
'label',
|
|
84
|
+
'description',
|
|
85
|
+
'placeholder',
|
|
86
|
+
'name',
|
|
87
|
+
'disabled',
|
|
88
|
+
'readonly',
|
|
89
|
+
'required',
|
|
90
|
+
'error',
|
|
91
|
+
'errorDescription',
|
|
92
|
+
'success',
|
|
93
|
+
'max',
|
|
94
|
+
'min',
|
|
95
|
+
'step',
|
|
96
|
+
'value',
|
|
97
|
+
'valueChanged'
|
|
98
|
+
], 'value', 'value-changed');
|
|
99
|
+
export const NvFieldpassword = /*@__PURE__*/ defineContainer('nv-fieldpassword', undefined, [
|
|
100
|
+
'inputId',
|
|
101
|
+
'label',
|
|
102
|
+
'description',
|
|
103
|
+
'placeholder',
|
|
104
|
+
'name',
|
|
105
|
+
'value',
|
|
106
|
+
'disabled',
|
|
107
|
+
'readonly',
|
|
108
|
+
'required',
|
|
109
|
+
'error',
|
|
110
|
+
'errorDescription',
|
|
111
|
+
'success',
|
|
112
|
+
'maxlength',
|
|
113
|
+
'minlength',
|
|
114
|
+
'pattern',
|
|
115
|
+
'mode',
|
|
116
|
+
'autocomplete',
|
|
117
|
+
'hidePasswordIcon',
|
|
118
|
+
'showPassword',
|
|
119
|
+
'valueChanged'
|
|
120
|
+
], 'value', 'value-changed');
|
|
121
|
+
export const NvFieldradio = /*@__PURE__*/ defineContainer('nv-fieldradio', undefined, [
|
|
122
|
+
'message',
|
|
123
|
+
'labelBefore',
|
|
124
|
+
'inputId',
|
|
125
|
+
'name',
|
|
126
|
+
'value',
|
|
127
|
+
'label',
|
|
128
|
+
'labelPlacement',
|
|
129
|
+
'description',
|
|
130
|
+
'error',
|
|
131
|
+
'errorDescription',
|
|
132
|
+
'checked',
|
|
133
|
+
'disabled',
|
|
134
|
+
'checkedChanged'
|
|
135
|
+
], 'checked', 'checked-changed');
|
|
136
|
+
export const NvFieldselect = /*@__PURE__*/ defineContainer('nv-fieldselect', undefined, [
|
|
137
|
+
'message',
|
|
138
|
+
'validation',
|
|
139
|
+
'selectId',
|
|
140
|
+
'label',
|
|
141
|
+
'description',
|
|
142
|
+
'name',
|
|
143
|
+
'disabled',
|
|
144
|
+
'readonly',
|
|
145
|
+
'required',
|
|
146
|
+
'error',
|
|
147
|
+
'errorDescription',
|
|
148
|
+
'success',
|
|
149
|
+
'multiple',
|
|
150
|
+
'value',
|
|
151
|
+
'displayValue',
|
|
152
|
+
'valueChanged'
|
|
153
|
+
], 'value', 'value-changed');
|
|
154
|
+
export const NvFieldtext = /*@__PURE__*/ defineContainer('nv-fieldtext', undefined, [
|
|
155
|
+
'message',
|
|
156
|
+
'validation',
|
|
157
|
+
'textInputType',
|
|
158
|
+
'inputId',
|
|
159
|
+
'label',
|
|
160
|
+
'description',
|
|
161
|
+
'placeholder',
|
|
162
|
+
'name',
|
|
163
|
+
'value',
|
|
164
|
+
'type',
|
|
165
|
+
'disabled',
|
|
166
|
+
'readonly',
|
|
167
|
+
'required',
|
|
168
|
+
'error',
|
|
169
|
+
'errorDescription',
|
|
170
|
+
'success',
|
|
171
|
+
'maxlength',
|
|
172
|
+
'minlength',
|
|
173
|
+
'pattern',
|
|
174
|
+
'autocomplete',
|
|
175
|
+
'multiple',
|
|
176
|
+
'valueChanged'
|
|
177
|
+
], 'value', 'value-changed');
|
|
178
|
+
export const NvFieldtextarea = /*@__PURE__*/ defineContainer('nv-fieldtextarea', undefined, [
|
|
179
|
+
'message',
|
|
180
|
+
'validation',
|
|
181
|
+
'textareaId',
|
|
182
|
+
'label',
|
|
183
|
+
'description',
|
|
184
|
+
'placeholder',
|
|
185
|
+
'name',
|
|
186
|
+
'value',
|
|
187
|
+
'disabled',
|
|
188
|
+
'readonly',
|
|
189
|
+
'required',
|
|
190
|
+
'error',
|
|
191
|
+
'errorDescription',
|
|
192
|
+
'success',
|
|
193
|
+
'maxlength',
|
|
194
|
+
'minlength',
|
|
195
|
+
'rows',
|
|
196
|
+
'resize',
|
|
197
|
+
'autosize',
|
|
198
|
+
'valueChanged'
|
|
199
|
+
], 'value', 'value-changed');
|
|
200
|
+
export const NvFieldtoggle = /*@__PURE__*/ defineContainer('nv-fieldtoggle', undefined, [
|
|
201
|
+
'inputId',
|
|
202
|
+
'name',
|
|
203
|
+
'value',
|
|
204
|
+
'label',
|
|
205
|
+
'labelPlacement',
|
|
206
|
+
'hideLabel',
|
|
207
|
+
'description',
|
|
208
|
+
'checked',
|
|
209
|
+
'disabled',
|
|
210
|
+
'readonly',
|
|
211
|
+
'checkedChanged'
|
|
212
|
+
], 'checked', 'checked-changed');
|
|
213
|
+
export const NvIcon = /*@__PURE__*/ defineContainer('nv-icon', undefined, [
|
|
214
|
+
'xsmall',
|
|
215
|
+
'small',
|
|
216
|
+
'medium',
|
|
217
|
+
'large',
|
|
218
|
+
'xlarge',
|
|
219
|
+
'color',
|
|
220
|
+
'name',
|
|
221
|
+
'size'
|
|
222
|
+
]);
|
|
223
|
+
export const NvIconbutton = /*@__PURE__*/ defineContainer('nv-iconbutton', undefined, [
|
|
224
|
+
'size',
|
|
225
|
+
'emphasis',
|
|
226
|
+
'loading',
|
|
227
|
+
'disabled',
|
|
228
|
+
'active',
|
|
229
|
+
'name',
|
|
230
|
+
'type',
|
|
231
|
+
'shape'
|
|
232
|
+
]);
|
|
233
|
+
export const NvLoader = /*@__PURE__*/ defineContainer('nv-loader', undefined, [
|
|
234
|
+
'size',
|
|
235
|
+
'color'
|
|
236
|
+
]);
|
|
237
|
+
export const NvMenu = /*@__PURE__*/ defineContainer('nv-menu', undefined, [
|
|
238
|
+
'open',
|
|
239
|
+
'nested',
|
|
240
|
+
'disableCloseOnSelect',
|
|
241
|
+
'placement',
|
|
242
|
+
'menuitemSelected'
|
|
243
|
+
]);
|
|
244
|
+
export const NvMenuitem = /*@__PURE__*/ defineContainer('nv-menuitem', undefined, [
|
|
245
|
+
'icon',
|
|
246
|
+
'disabled',
|
|
247
|
+
'shortcut',
|
|
248
|
+
'hasSubmenu'
|
|
249
|
+
]);
|
|
250
|
+
export const NvPopover = /*@__PURE__*/ defineContainer('nv-popover', undefined, [
|
|
251
|
+
'triggerElement',
|
|
252
|
+
'open',
|
|
253
|
+
'triggerMode',
|
|
254
|
+
'placement',
|
|
255
|
+
'groupName',
|
|
256
|
+
'offset',
|
|
257
|
+
'hasArrow',
|
|
258
|
+
'disableFlip',
|
|
259
|
+
'shiftPadding',
|
|
260
|
+
'enterDelay',
|
|
261
|
+
'nested',
|
|
262
|
+
'openChanged'
|
|
263
|
+
], 'open', 'open-changed');
|
|
264
|
+
export const NvRow = /*@__PURE__*/ defineContainer('nv-row', undefined);
|
|
265
|
+
export const NvStack = /*@__PURE__*/ defineContainer('nv-stack', undefined, [
|
|
266
|
+
'gutter',
|
|
267
|
+
'fill',
|
|
268
|
+
'flex',
|
|
269
|
+
'full',
|
|
270
|
+
'vertical'
|
|
271
|
+
]);
|
|
272
|
+
export const NvTooltip = /*@__PURE__*/ defineContainer('nv-tooltip', undefined, [
|
|
273
|
+
'message',
|
|
274
|
+
'placement',
|
|
275
|
+
'enterDelay'
|
|
276
|
+
]);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface InputProps<T> {
|
|
2
|
+
modelValue?: T;
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* Create a callback to define a Vue component wrapper around a Web Component.
|
|
6
|
+
*
|
|
7
|
+
* @prop name - The component tag name (i.e. `ion-button`)
|
|
8
|
+
* @prop componentProps - An array of properties on the
|
|
9
|
+
* component. These usually match up with the @Prop definitions
|
|
10
|
+
* in each component's TSX file.
|
|
11
|
+
* @prop customElement - An option custom element instance to pass
|
|
12
|
+
* to customElements.define. Only set if `includeImportCustomElements: true` in your config.
|
|
13
|
+
* @prop modelProp - The prop that v-model binds to (i.e. value)
|
|
14
|
+
* @prop modelUpdateEvent - The event that is fired from your Web Component when the value changes (i.e. ionChange)
|
|
15
|
+
*/
|
|
16
|
+
export declare const defineContainer: <Props, VModelType = string | number | boolean>(name: string, defineCustomElement: any, componentProps?: string[], modelProp?: string, modelUpdateEvent?: string) => import("vue").DefineSetupFnComponent<Props & InputProps<VModelType>, {}, {}, Props & InputProps<VModelType> & {}, import("vue").PublicProps>;
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
// It's easier and safer for Volar to disable typechecking and let the return type inference do its job.
|
|
3
|
+
import { defineComponent, getCurrentInstance, h, inject, ref, withDirectives } from 'vue';
|
|
4
|
+
const UPDATE_VALUE_EVENT = 'update:modelValue';
|
|
5
|
+
const MODEL_VALUE = 'modelValue';
|
|
6
|
+
const ROUTER_LINK_VALUE = 'routerLink';
|
|
7
|
+
const NAV_MANAGER = 'navManager';
|
|
8
|
+
const ROUTER_PROP_PREFIX = 'router';
|
|
9
|
+
const ARIA_PROP_PREFIX = 'aria';
|
|
10
|
+
/**
|
|
11
|
+
* Starting in Vue 3.1.0, all properties are
|
|
12
|
+
* added as keys to the props object, even if
|
|
13
|
+
* they are not being used. In order to correctly
|
|
14
|
+
* account for both value props and v-model props,
|
|
15
|
+
* we need to check if the key exists for Vue <3.1.0
|
|
16
|
+
* and then check if it is not undefined for Vue >= 3.1.0.
|
|
17
|
+
* See https://github.com/vuejs/vue-next/issues/3889
|
|
18
|
+
*/
|
|
19
|
+
const EMPTY_PROP = Symbol();
|
|
20
|
+
const DEFAULT_EMPTY_PROP = { default: EMPTY_PROP };
|
|
21
|
+
const getComponentClasses = (classes) => {
|
|
22
|
+
return (classes === null || classes === void 0 ? void 0 : classes.split(' ')) || [];
|
|
23
|
+
};
|
|
24
|
+
const getElementClasses = (ref, componentClasses, defaultClasses = []) => {
|
|
25
|
+
var _a;
|
|
26
|
+
return [...Array.from(((_a = ref.value) === null || _a === void 0 ? void 0 : _a.classList) || []), ...defaultClasses].filter((c, i, self) => !componentClasses.has(c) && self.indexOf(c) === i);
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Create a callback to define a Vue component wrapper around a Web Component.
|
|
30
|
+
*
|
|
31
|
+
* @prop name - The component tag name (i.e. `ion-button`)
|
|
32
|
+
* @prop componentProps - An array of properties on the
|
|
33
|
+
* component. These usually match up with the @Prop definitions
|
|
34
|
+
* in each component's TSX file.
|
|
35
|
+
* @prop customElement - An option custom element instance to pass
|
|
36
|
+
* to customElements.define. Only set if `includeImportCustomElements: true` in your config.
|
|
37
|
+
* @prop modelProp - The prop that v-model binds to (i.e. value)
|
|
38
|
+
* @prop modelUpdateEvent - The event that is fired from your Web Component when the value changes (i.e. ionChange)
|
|
39
|
+
*/
|
|
40
|
+
export const defineContainer = (name, defineCustomElement, componentProps = [], modelProp, modelUpdateEvent) => {
|
|
41
|
+
/**
|
|
42
|
+
* Create a Vue component wrapper around a Web Component.
|
|
43
|
+
* Note: The `props` here are not all properties on a component.
|
|
44
|
+
* They refer to whatever properties are set on an instance of a component.
|
|
45
|
+
*/
|
|
46
|
+
if (defineCustomElement !== undefined) {
|
|
47
|
+
defineCustomElement();
|
|
48
|
+
}
|
|
49
|
+
const Container = defineComponent((props, { attrs, slots, emit }) => {
|
|
50
|
+
var _a;
|
|
51
|
+
let modelPropValue = props[modelProp];
|
|
52
|
+
const containerRef = ref();
|
|
53
|
+
const classes = new Set(getComponentClasses(attrs.class));
|
|
54
|
+
/**
|
|
55
|
+
* This directive is responsible for updating any reactive
|
|
56
|
+
* reference associated with v-model on the component.
|
|
57
|
+
* This code must be run inside of the "created" callback.
|
|
58
|
+
* Since the following listener callbacks as well as any potential
|
|
59
|
+
* event callback defined in the developer's app are set on
|
|
60
|
+
* the same element, we need to make sure the following callbacks
|
|
61
|
+
* are set first so they fire first. If the developer's callback fires first
|
|
62
|
+
* then the reactive reference will not have been updated yet.
|
|
63
|
+
*/
|
|
64
|
+
const vModelDirective = {
|
|
65
|
+
created: (el) => {
|
|
66
|
+
const eventsNames = Array.isArray(modelUpdateEvent) ? modelUpdateEvent : [modelUpdateEvent];
|
|
67
|
+
eventsNames.forEach((eventName) => {
|
|
68
|
+
el.addEventListener(eventName.toLowerCase(), (e) => {
|
|
69
|
+
/**
|
|
70
|
+
* Only update the v-model binding if the event's target is the element we are
|
|
71
|
+
* listening on. For example, Component A could emit ionChange, but it could also
|
|
72
|
+
* have a descendant Component B that also emits ionChange. We only want to update
|
|
73
|
+
* the v-model for Component A when ionChange originates from that element and not
|
|
74
|
+
* when ionChange bubbles up from Component B.
|
|
75
|
+
*/
|
|
76
|
+
if (e.target.tagName === el.tagName) {
|
|
77
|
+
modelPropValue = (e === null || e === void 0 ? void 0 : e.target)[modelProp];
|
|
78
|
+
emit(UPDATE_VALUE_EVENT, modelPropValue);
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
const currentInstance = getCurrentInstance();
|
|
85
|
+
const hasRouter = (_a = currentInstance === null || currentInstance === void 0 ? void 0 : currentInstance.appContext) === null || _a === void 0 ? void 0 : _a.provides[NAV_MANAGER];
|
|
86
|
+
const navManager = hasRouter ? inject(NAV_MANAGER) : undefined;
|
|
87
|
+
const handleRouterLink = (ev) => {
|
|
88
|
+
const { routerLink } = props;
|
|
89
|
+
if (routerLink === EMPTY_PROP)
|
|
90
|
+
return;
|
|
91
|
+
if (navManager !== undefined) {
|
|
92
|
+
/**
|
|
93
|
+
* This prevents the browser from
|
|
94
|
+
* performing a page reload when pressing
|
|
95
|
+
* an Ionic component with routerLink.
|
|
96
|
+
* The page reload interferes with routing
|
|
97
|
+
* and causes ion-back-button to disappear
|
|
98
|
+
* since the local history is wiped on reload.
|
|
99
|
+
*/
|
|
100
|
+
ev.preventDefault();
|
|
101
|
+
let navigationPayload = { event: ev };
|
|
102
|
+
for (const key in props) {
|
|
103
|
+
const value = props[key];
|
|
104
|
+
if (props.hasOwnProperty(key) && key.startsWith(ROUTER_PROP_PREFIX) && value !== EMPTY_PROP) {
|
|
105
|
+
navigationPayload[key] = value;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
navManager.navigate(navigationPayload);
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
console.warn('Tried to navigate, but no router was found. Make sure you have mounted Vue Router.');
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
return () => {
|
|
115
|
+
modelPropValue = props[modelProp];
|
|
116
|
+
getComponentClasses(attrs.class).forEach((value) => {
|
|
117
|
+
classes.add(value);
|
|
118
|
+
});
|
|
119
|
+
const oldClick = props.onClick;
|
|
120
|
+
const handleClick = (ev) => {
|
|
121
|
+
if (oldClick !== undefined) {
|
|
122
|
+
oldClick(ev);
|
|
123
|
+
}
|
|
124
|
+
if (!ev.defaultPrevented) {
|
|
125
|
+
handleRouterLink(ev);
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
let propsToAdd = {
|
|
129
|
+
ref: containerRef,
|
|
130
|
+
class: getElementClasses(containerRef, classes),
|
|
131
|
+
onClick: handleClick,
|
|
132
|
+
};
|
|
133
|
+
/**
|
|
134
|
+
* We can use Object.entries here
|
|
135
|
+
* to avoid the hasOwnProperty check,
|
|
136
|
+
* but that would require 2 iterations
|
|
137
|
+
* where as this only requires 1.
|
|
138
|
+
*/
|
|
139
|
+
for (const key in props) {
|
|
140
|
+
const value = props[key];
|
|
141
|
+
if ((props.hasOwnProperty(key) && value !== EMPTY_PROP) || key.startsWith(ARIA_PROP_PREFIX)) {
|
|
142
|
+
propsToAdd[key] = value;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
if (modelProp) {
|
|
146
|
+
/**
|
|
147
|
+
* If form value property was set using v-model
|
|
148
|
+
* then we should use that value.
|
|
149
|
+
* Otherwise, check to see if form value property
|
|
150
|
+
* was set as a static value (i.e. no v-model).
|
|
151
|
+
*/
|
|
152
|
+
if (props[MODEL_VALUE] !== EMPTY_PROP) {
|
|
153
|
+
propsToAdd = Object.assign(Object.assign({}, propsToAdd), { [modelProp]: props[MODEL_VALUE] });
|
|
154
|
+
}
|
|
155
|
+
else if (modelPropValue !== EMPTY_PROP) {
|
|
156
|
+
propsToAdd = Object.assign(Object.assign({}, propsToAdd), { [modelProp]: modelPropValue });
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
// If router link is defined, add href to props
|
|
160
|
+
// in order to properly render an anchor tag inside
|
|
161
|
+
// of components that should become activatable and
|
|
162
|
+
// focusable with router link.
|
|
163
|
+
if (props[ROUTER_LINK_VALUE] !== EMPTY_PROP) {
|
|
164
|
+
propsToAdd = Object.assign(Object.assign({}, propsToAdd), { href: props[ROUTER_LINK_VALUE] });
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* vModelDirective is only needed on components that support v-model.
|
|
168
|
+
* As a result, we conditionally call withDirectives with v-model components.
|
|
169
|
+
*/
|
|
170
|
+
const node = h(name, propsToAdd, slots.default && slots.default());
|
|
171
|
+
return modelProp === undefined ? node : withDirectives(node, [[vModelDirective]]);
|
|
172
|
+
};
|
|
173
|
+
});
|
|
174
|
+
if (typeof Container !== 'function') {
|
|
175
|
+
Container.name = name;
|
|
176
|
+
Container.props = {
|
|
177
|
+
[ROUTER_LINK_VALUE]: DEFAULT_EMPTY_PROP,
|
|
178
|
+
};
|
|
179
|
+
componentProps.forEach((componentProp) => {
|
|
180
|
+
Container.props[componentProp] = DEFAULT_EMPTY_PROP;
|
|
181
|
+
});
|
|
182
|
+
if (modelProp) {
|
|
183
|
+
Container.props[MODEL_VALUE] = DEFAULT_EMPTY_PROP;
|
|
184
|
+
Container.emits = [UPDATE_VALUE_EVENT];
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
return Container;
|
|
188
|
+
};
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
package/dist/plugin.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview This plugin does two main things:
|
|
3
|
+
* 1. Loads the Stencil components using defineCustomElements
|
|
4
|
+
* 2. Sets up custom event handling to bridge the naming convention difference
|
|
5
|
+
* between Stencil (camelCase) and Vue (kebab-case)
|
|
6
|
+
*
|
|
7
|
+
* The ael, rel, and ce functions are used by Stencil to handle events.
|
|
8
|
+
* By providing custom implementations, we ensure that event names are
|
|
9
|
+
* properly transformed, allowing Stencil components to work seamlessly in Vue.
|
|
10
|
+
*/
|
|
11
|
+
import { Plugin } from 'vue';
|
|
12
|
+
/**
|
|
13
|
+
* This is the Vue plugin that is used to define the custom elements and event
|
|
14
|
+
* handlers.
|
|
15
|
+
*/
|
|
16
|
+
export declare const NovaComponents: Plugin;
|
package/dist/plugin.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview This plugin does two main things:
|
|
3
|
+
* 1. Loads the Stencil components using defineCustomElements
|
|
4
|
+
* 2. Sets up custom event handling to bridge the naming convention difference
|
|
5
|
+
* between Stencil (camelCase) and Vue (kebab-case)
|
|
6
|
+
*
|
|
7
|
+
* The ael, rel, and ce functions are used by Stencil to handle events.
|
|
8
|
+
* By providing custom implementations, we ensure that event names are
|
|
9
|
+
* properly transformed, allowing Stencil components to work seamlessly in Vue.
|
|
10
|
+
*/
|
|
11
|
+
import { defineCustomElements } from '@nova-design-system/nova-webcomponents/loader';
|
|
12
|
+
import * as stringUtils from 'nova-utils/lib/string.utils';
|
|
13
|
+
/**
|
|
14
|
+
* Transforms the event name to kebab-case.
|
|
15
|
+
* @param {string} eventName - The name of the event.
|
|
16
|
+
* @returns {string} The transformed event name.
|
|
17
|
+
*/
|
|
18
|
+
const transformEventName = (eventName) => {
|
|
19
|
+
return stringUtils.toKebabCase(eventName);
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Custom add event listener function that transforms the event name
|
|
23
|
+
* @param {HTMLElement} el - The element to attach the event listener to.
|
|
24
|
+
* @param {string} eventName - The name of the event.
|
|
25
|
+
* @param {Function} cb - The callback function to be executed when the event is triggered.
|
|
26
|
+
* @param {object} opts - The options for the event listener.
|
|
27
|
+
* @returns {void} Nothing.
|
|
28
|
+
*/
|
|
29
|
+
const ael = (el, eventName, cb, opts) => el.addEventListener(transformEventName(eventName), cb, opts);
|
|
30
|
+
/**
|
|
31
|
+
* Custom remove event listener function that transforms the event name.
|
|
32
|
+
* @param {HTMLElement} el - The element to remove the event listener from.
|
|
33
|
+
* @param {string} eventName - The name of the event.
|
|
34
|
+
* @param {Function} cb - The callback function to be removed.
|
|
35
|
+
* @param {object} opts - The options for the event listener.
|
|
36
|
+
* @returns {void} Nothing.
|
|
37
|
+
*/
|
|
38
|
+
const rel = (el, eventName, cb, opts) => el.removeEventListener(transformEventName(eventName), cb, opts);
|
|
39
|
+
/**
|
|
40
|
+
* This is the Vue plugin that is used to define the custom elements and event
|
|
41
|
+
* handlers.
|
|
42
|
+
*/
|
|
43
|
+
export const NovaComponents = {
|
|
44
|
+
async install() {
|
|
45
|
+
defineCustomElements(window, {
|
|
46
|
+
ce: (eventName, opts) => new CustomEvent(transformEventName(eventName), opts),
|
|
47
|
+
ael,
|
|
48
|
+
rel,
|
|
49
|
+
});
|
|
50
|
+
},
|
|
51
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nova-design-system/nova-vue",
|
|
3
|
+
"version": "3.0.0-beta.17",
|
|
4
|
+
"description": "Nova is a design system created by Elia Group to empower creators to efficiently build solutions that people love to use.",
|
|
5
|
+
"author": "Elia Group",
|
|
6
|
+
"homepage": "https://nova.eliagroup.io",
|
|
7
|
+
"license": "SEE LICENSE IN LICENSE.MD",
|
|
8
|
+
"main": "dist/index.js",
|
|
9
|
+
"module": "dist/index.js",
|
|
10
|
+
"types": "dist/index.d.ts",
|
|
11
|
+
"directories": {
|
|
12
|
+
"lib": "lib",
|
|
13
|
+
"stories": "stories"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"publishConfig": {
|
|
19
|
+
"registry": "http://registry.npmjs.org/",
|
|
20
|
+
"access": "public"
|
|
21
|
+
},
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"import": "./dist/index.js",
|
|
25
|
+
"types": "./dist/index.d.ts"
|
|
26
|
+
},
|
|
27
|
+
"./plugin": {
|
|
28
|
+
"import": "./dist/plugin.js",
|
|
29
|
+
"types": "./dist/plugin.d.ts"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"scripts": {
|
|
33
|
+
"build": "npm run tsc",
|
|
34
|
+
"tsc": "tsc -p . --outDir ./dist",
|
|
35
|
+
"storybook": "storybook dev -p 6008",
|
|
36
|
+
"storybook.build": "storybook build -o ../../storybook-static/vue",
|
|
37
|
+
"clean": "rimraf dist lib/generated lib/stories",
|
|
38
|
+
"typecheck": "tsc --emitDeclarationOnly false --noEmit"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"vue": "3.4.36",
|
|
42
|
+
"@storybook/vue3": "8.2.8",
|
|
43
|
+
"@storybook/vue3-vite": "8.2.8",
|
|
44
|
+
"nova-storybook-utils": "*",
|
|
45
|
+
"@nova-design-system/nova-webcomponents": "*"
|
|
46
|
+
},
|
|
47
|
+
"peerDependencies": {
|
|
48
|
+
"@nova-design-system/nova-webcomponents": ">=3.0.0-beta.0"
|
|
49
|
+
}
|
|
50
|
+
}
|