@quartzds/core-vue 1.0.0-beta.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.
package/README.md ADDED
@@ -0,0 +1,76 @@
1
+ <!--
2
+ SPDX-FileCopyrightText: © 2023 Schneider Electric
3
+
4
+ SPDX-License-Identifier: LGPL-2.1-only
5
+ -->
6
+
7
+ # `@quartzds/core-vue`
8
+
9
+ [![NPM Package][npm-badge]][npm-link]
10
+ [![License][license-badge]][license]
11
+
12
+ Vue wrapper for [Quartz design system][] web components.
13
+
14
+ ## 💿 Installation
15
+
16
+ ```bash
17
+ npm install @quartzds/core-vue vue
18
+ ```
19
+
20
+ ## 📖 Usage
21
+
22
+ ### Importing Components
23
+
24
+ Every Quartz core component is available to import as a Vue component. Note
25
+ that we're importing the `<QdsButton>` _Vue component_ instead of the
26
+ `<qds-button>` _custom element_ in the example below:
27
+
28
+ ```vue
29
+ <template>
30
+ <QdsButton importance="emphasized" text="Click me"></QdsButton>
31
+ </template>
32
+
33
+ <script setup>
34
+ import { QdsButton } from '@quartzds/core-vue'
35
+ </script>
36
+ ```
37
+
38
+ ### Event Handling
39
+
40
+ Many Quartz core components emit [custom events][]. For example, the
41
+ [input component][] emits the `qdsInput` event when it receives input. In Vue,
42
+ you can listen to the event using `@qdsInput`.
43
+
44
+ Here's how you can bind the input's value to a state variable:
45
+
46
+ ```vue
47
+ <template>
48
+ <QdsInput
49
+ value="{value}"
50
+ @qdsInput="
51
+ (event) => {
52
+ value = event.target.value
53
+ }
54
+ "
55
+ />
56
+ </template>
57
+
58
+ <script setup>
59
+ import { ref } from 'vue'
60
+ import { QdsInput } from '@quartzds/core-vue'
61
+
62
+ const value = ref('')
63
+ </script>
64
+ ```
65
+
66
+ ## ⚖️ License
67
+
68
+ See the [LICENSE][] file for license rights and limitations.
69
+
70
+ [npm-badge]: https://img.shields.io/npm/v/@quartzds/core-vue?logo=npm
71
+ [npm-link]: https://www.npmjs.com/package/@quartzds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1LjU0NSAwIDAgMC0uMDIzLjA3NWwtLjAwNS4wMmEuNTI0LjUyNCAwIDAgMC0uMDEuMDkydi4wMDhjMCAyLjI4IDEuODYgNC4xNCA0LjE0IDQuMTQgMi4yOCAwIDQuMTQtMS44NiA0LjE0LTQuMTRhLjUyOC41MjggMCAwIDAtLjEyLS4zMzJ6IiBmaWxsPSIjZmZmIj48L3BhdGg+PC9zdmc+
73
+ [license]: /LICENSE
74
+ [quartz design system]: https://github.com/quartzds
75
+ [custom events]: https://developer.mozilla.org/docs/Web/API/CustomEvent
76
+ [input component]: /packages/core/src/components/input/
@@ -0,0 +1,13 @@
1
+ import type { JSX } from '@quartzds/core/components';
2
+ export declare const QdsButton: (props: JSX.QdsButton & import("./vue-component-lib/utils").InputProps<string | number | boolean> & {}) => any;
3
+ export declare const QdsCheckbox: (props: JSX.QdsCheckbox & import("./vue-component-lib/utils").InputProps<boolean> & {}) => any;
4
+ export declare const QdsDropdown: (props: JSX.QdsDropdown & import("./vue-component-lib/utils").InputProps<string | number | boolean> & {}) => any;
5
+ export declare const QdsIcon: (props: JSX.QdsIcon & import("./vue-component-lib/utils").InputProps<string | number | boolean> & {}) => any;
6
+ export declare const QdsInlineLink: (props: JSX.QdsInlineLink & import("./vue-component-lib/utils").InputProps<string | number | boolean> & {}) => any;
7
+ export declare const QdsInput: (props: JSX.QdsInput & import("./vue-component-lib/utils").InputProps<import("@quartzds/core/components").InputValue> & {}) => any;
8
+ export declare const QdsLabel: (props: JSX.QdsLabel & import("./vue-component-lib/utils").InputProps<string | number | boolean> & {}) => any;
9
+ export declare const QdsRadio: (props: JSX.QdsRadio & import("./vue-component-lib/utils").InputProps<string | number | boolean> & {}) => any;
10
+ export declare const QdsSwitch: (props: JSX.QdsSwitch & import("./vue-component-lib/utils").InputProps<string | number | boolean> & {}) => any;
11
+ export declare const QdsTitle: (props: JSX.QdsTitle & import("./vue-component-lib/utils").InputProps<string | number | boolean> & {}) => any;
12
+ export declare const QdsTooltip: (props: JSX.QdsTooltip & import("./vue-component-lib/utils").InputProps<string | number | boolean> & {}) => any;
13
+ //# sourceMappingURL=proxies.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proxies.d.ts","sourceRoot":"","sources":["../../src/generated/proxies.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,2BAA2B,CAAC;AAerD,eAAO,MAAM,SAAS,gHAoBpB,CAAC;AAGH,eAAO,MAAM,WAAW,gGAgBD,CAAC;AAGxB,eAAO,MAAM,WAAW,kHAatB,CAAC;AAGH,eAAO,MAAM,OAAO,8GAKlB,CAAC;AAGH,eAAO,MAAM,aAAa,oHAUxB,CAAC;AAGH,eAAO,MAAM,QAAQ,oIA6BA,CAAC;AAGtB,eAAO,MAAM,QAAQ,+GAKnB,CAAC;AAGH,eAAO,MAAM,QAAQ,+GAanB,CAAC;AAGH,eAAO,MAAM,SAAS,gHAkBpB,CAAC;AAGH,eAAO,MAAM,QAAQ,+GAQnB,CAAC;AAGH,eAAO,MAAM,UAAU,iHAYrB,CAAC"}
@@ -0,0 +1,174 @@
1
+ /* eslint-disable */
2
+ /* tslint:disable */
3
+ /* auto-generated vue proxies */
4
+ import { defineContainer } from './vue-component-lib/utils';
5
+ import { defineCustomElement as defineQdsButton } from '@quartzds/core/components/qds-button.js';
6
+ import { defineCustomElement as defineQdsCheckbox } from '@quartzds/core/components/qds-checkbox.js';
7
+ import { defineCustomElement as defineQdsDropdown } from '@quartzds/core/components/qds-dropdown.js';
8
+ import { defineCustomElement as defineQdsIcon } from '@quartzds/core/components/qds-icon.js';
9
+ import { defineCustomElement as defineQdsInlineLink } from '@quartzds/core/components/qds-inline-link.js';
10
+ import { defineCustomElement as defineQdsInput } from '@quartzds/core/components/qds-input.js';
11
+ import { defineCustomElement as defineQdsLabel } from '@quartzds/core/components/qds-label.js';
12
+ import { defineCustomElement as defineQdsRadio } from '@quartzds/core/components/qds-radio.js';
13
+ import { defineCustomElement as defineQdsSwitch } from '@quartzds/core/components/qds-switch.js';
14
+ import { defineCustomElement as defineQdsTitle } from '@quartzds/core/components/qds-title.js';
15
+ import { defineCustomElement as defineQdsTooltip } from '@quartzds/core/components/qds-tooltip.js';
16
+ export const QdsButton = /*@__PURE__*/ defineContainer('qds-button', defineQdsButton, [
17
+ 'iconName',
18
+ 'iconLibrary',
19
+ 'importance',
20
+ 'size',
21
+ 'text',
22
+ 'disabled',
23
+ 'download',
24
+ 'form',
25
+ 'formAction',
26
+ 'formMethod',
27
+ 'formNoValidate',
28
+ 'formTarget',
29
+ 'href',
30
+ 'name',
31
+ 'target',
32
+ 'type',
33
+ 'value',
34
+ 'qdsBlur',
35
+ 'qdsFocus'
36
+ ]);
37
+ export const QdsCheckbox = /*@__PURE__*/ defineContainer('qds-checkbox', defineQdsCheckbox, [
38
+ 'inline',
39
+ 'size',
40
+ 'text',
41
+ 'autoFocus',
42
+ 'checked',
43
+ 'disabled',
44
+ 'form',
45
+ 'indeterminate',
46
+ 'name',
47
+ 'required',
48
+ 'value',
49
+ 'qdsBlur',
50
+ 'qdsChange',
51
+ 'qdsFocus'
52
+ ], 'checked', 'qdsChange');
53
+ export const QdsDropdown = /*@__PURE__*/ defineContainer('qds-dropdown', defineQdsDropdown, [
54
+ 'autoUpdateOptions',
55
+ 'disabled',
56
+ 'flipOptions',
57
+ 'noFlip',
58
+ 'noShift',
59
+ 'offsetOptions',
60
+ 'placement',
61
+ 'shiftOptions',
62
+ 'strategy',
63
+ 'target',
64
+ 'qdsCancel',
65
+ 'qdsClose'
66
+ ]);
67
+ export const QdsIcon = /*@__PURE__*/ defineContainer('qds-icon', defineQdsIcon, [
68
+ 'name',
69
+ 'library',
70
+ 'qdsLoad',
71
+ 'qdsError'
72
+ ]);
73
+ export const QdsInlineLink = /*@__PURE__*/ defineContainer('qds-inline-link', defineQdsInlineLink, [
74
+ 'disabled',
75
+ 'download',
76
+ 'href',
77
+ 'hreflang',
78
+ 'referrerPolicy',
79
+ 'rel',
80
+ 'target',
81
+ 'qdsBlur',
82
+ 'qdsFocus'
83
+ ]);
84
+ export const QdsInput = /*@__PURE__*/ defineContainer('qds-input', defineQdsInput, [
85
+ 'invalid',
86
+ 'size',
87
+ 'autoCapitalize',
88
+ 'autoComplete',
89
+ 'autoFocus',
90
+ 'disabled',
91
+ 'enterkeyhint',
92
+ 'form',
93
+ 'inputmode',
94
+ 'max',
95
+ 'maxLength',
96
+ 'min',
97
+ 'minLength',
98
+ 'multiple',
99
+ 'name',
100
+ 'pattern',
101
+ 'placeholder',
102
+ 'readOnly',
103
+ 'required',
104
+ 'spellCheck',
105
+ 'step',
106
+ 'type',
107
+ 'value',
108
+ 'qdsBlur',
109
+ 'qdsChange',
110
+ 'qdsFocus',
111
+ 'qdsInput'
112
+ ], 'value', 'qdsChange');
113
+ export const QdsLabel = /*@__PURE__*/ defineContainer('qds-label', defineQdsLabel, [
114
+ 'inline',
115
+ 'required',
116
+ 'size',
117
+ 'text'
118
+ ]);
119
+ export const QdsRadio = /*@__PURE__*/ defineContainer('qds-radio', defineQdsRadio, [
120
+ 'inline',
121
+ 'size',
122
+ 'text',
123
+ 'checked',
124
+ 'disabled',
125
+ 'form',
126
+ 'name',
127
+ 'required',
128
+ 'value',
129
+ 'qdsBlur',
130
+ 'qdsChange',
131
+ 'qdsFocus'
132
+ ]);
133
+ export const QdsSwitch = /*@__PURE__*/ defineContainer('qds-switch', defineQdsSwitch, [
134
+ 'inline',
135
+ 'iconCheckedName',
136
+ 'iconCheckedLibrary',
137
+ 'iconUncheckedName',
138
+ 'iconUncheckedLibrary',
139
+ 'size',
140
+ 'textChecked',
141
+ 'textUnchecked',
142
+ 'autoFocus',
143
+ 'checked',
144
+ 'disabled',
145
+ 'form',
146
+ 'name',
147
+ 'value',
148
+ 'qdsBlur',
149
+ 'qdsChange',
150
+ 'qdsFocus'
151
+ ]);
152
+ export const QdsTitle = /*@__PURE__*/ defineContainer('qds-title', defineQdsTitle, [
153
+ 'iconName',
154
+ 'iconLibrary',
155
+ 'kicker',
156
+ 'layer',
157
+ 'level',
158
+ 'subtitle',
159
+ 'tag'
160
+ ]);
161
+ export const QdsTooltip = /*@__PURE__*/ defineContainer('qds-tooltip', defineQdsTooltip, [
162
+ 'autoUpdateOptions',
163
+ 'disabled',
164
+ 'flipOptions',
165
+ 'noFlip',
166
+ 'noShift',
167
+ 'offsetOptions',
168
+ 'placement',
169
+ 'shiftOptions',
170
+ 'strategy',
171
+ 'target',
172
+ 'qdsClose'
173
+ ]);
174
+ //# sourceMappingURL=proxies.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proxies.js","sourceRoot":"","sources":["../../src/generated/proxies.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,oBAAoB;AACpB,gCAAgC;AAChC,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAI5D,OAAO,EAAE,mBAAmB,IAAI,eAAe,EAAE,MAAM,yCAAyC,CAAC;AACjG,OAAO,EAAE,mBAAmB,IAAI,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AACrG,OAAO,EAAE,mBAAmB,IAAI,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AACrG,OAAO,EAAE,mBAAmB,IAAI,aAAa,EAAE,MAAM,uCAAuC,CAAC;AAC7F,OAAO,EAAE,mBAAmB,IAAI,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AAC1G,OAAO,EAAE,mBAAmB,IAAI,cAAc,EAAE,MAAM,wCAAwC,CAAC;AAC/F,OAAO,EAAE,mBAAmB,IAAI,cAAc,EAAE,MAAM,wCAAwC,CAAC;AAC/F,OAAO,EAAE,mBAAmB,IAAI,cAAc,EAAE,MAAM,wCAAwC,CAAC;AAC/F,OAAO,EAAE,mBAAmB,IAAI,eAAe,EAAE,MAAM,yCAAyC,CAAC;AACjG,OAAO,EAAE,mBAAmB,IAAI,cAAc,EAAE,MAAM,wCAAwC,CAAC;AAC/F,OAAO,EAAE,mBAAmB,IAAI,gBAAgB,EAAE,MAA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O;IACP,OAAO;IACP,UAAU;IACV,KAAK;CACN,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,UAAU,GAAG,aAAa,CAAC,eAAe,CAAiB,aAAa,EAAE,gBAAgB,EAAE;IACvG,mBAAmB;IACnB,UAAU;IACV,aAAa;IACb,QAAQ;IACR,SAAS;IACT,eAAe;IACf,WAAW;IACX,cAAc;IACd,UAAU;IACV,QAAQ;IACR,UAAU;CACX,CAAC,CAAC"}
@@ -0,0 +1,19 @@
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
+ * @prop externalModelUpdateEvent - The external event to fire from your Vue component when modelUpdateEvent fires. This is used for ensuring that v-model references have been
16
+ * correctly updated when a user's event callback fires.
17
+ */
18
+ export declare const defineContainer: <Props, VModelType = string | number | boolean>(name: string, defineCustomElement: any, componentProps?: string[], modelProp?: string, modelUpdateEvent?: string, externalModelUpdateEvent?: string) => (props: Props & InputProps<VModelType> & {}) => any;
19
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/generated/vue-component-lib/utils.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,UAAU,CAAC,CAAC;IAC3B,UAAU,CAAC,EAAE,CAAC,CAAC;CAChB;AAsCD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,eAAe,wDACpB,MAAM,uBACS,GAAG,mBACR,MAAM,EAAE,cACZ,MAAM,qBACC,MAAM,6BACE,MAAM,wDA8IlC,CAAC"}
@@ -0,0 +1,168 @@
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 } 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?.split(' ') || [];
23
+ };
24
+ const getElementClasses = (ref, componentClasses, defaultClasses = []) => {
25
+ return [...Array.from(ref.value?.classList || []), ...defaultClasses].filter((c, i, self) => !componentClasses.has(c) && self.indexOf(c) === i);
26
+ };
27
+ /**
28
+ * Create a callback to define a Vue component wrapper around a Web Component.
29
+ *
30
+ * @prop name - The component tag name (i.e. `ion-button`)
31
+ * @prop componentProps - An array of properties on the
32
+ * component. These usually match up with the @Prop definitions
33
+ * in each component's TSX file.
34
+ * @prop customElement - An option custom element instance to pass
35
+ * to customElements.define. Only set if `includeImportCustomElements: true` in your config.
36
+ * @prop modelProp - The prop that v-model binds to (i.e. value)
37
+ * @prop modelUpdateEvent - The event that is fired from your Web Component when the value changes (i.e. ionChange)
38
+ * @prop externalModelUpdateEvent - The external event to fire from your Vue component when modelUpdateEvent fires. This is used for ensuring that v-model references have been
39
+ * correctly updated when a user's event callback fires.
40
+ */
41
+ export const defineContainer = (name, defineCustomElement, componentProps = [], modelProp, modelUpdateEvent, externalModelUpdateEvent) => {
42
+ /**
43
+ * Create a Vue component wrapper around a Web Component.
44
+ * Note: The `props` here are not all properties on a component.
45
+ * They refer to whatever properties are set on an instance of a component.
46
+ */
47
+ if (defineCustomElement !== undefined) {
48
+ defineCustomElement();
49
+ }
50
+ const Container = defineComponent((props, { attrs, slots, emit }) => {
51
+ let modelPropValue = props[modelProp];
52
+ const containerRef = ref();
53
+ const classes = new Set(getComponentClasses(attrs.class));
54
+ const onVnodeBeforeMount = (vnode) => {
55
+ // Add a listener to tell Vue to update the v-model
56
+ if (vnode.el) {
57
+ const eventsNames = Array.isArray(modelUpdateEvent) ? modelUpdateEvent : [modelUpdateEvent];
58
+ eventsNames.forEach((eventName) => {
59
+ vnode.el.addEventListener(eventName.toLowerCase(), (e) => {
60
+ modelPropValue = (e?.target)[modelProp];
61
+ emit(UPDATE_VALUE_EVENT, modelPropValue);
62
+ /**
63
+ * We need to emit the change event here
64
+ * rather than on the web component to ensure
65
+ * that any v-model bindings have been updated.
66
+ * Otherwise, the developer will listen on the
67
+ * native web component, but the v-model will
68
+ * not have been updated yet.
69
+ */
70
+ if (externalModelUpdateEvent) {
71
+ emit(externalModelUpdateEvent, e);
72
+ }
73
+ });
74
+ });
75
+ }
76
+ };
77
+ const currentInstance = getCurrentInstance();
78
+ const hasRouter = currentInstance?.appContext?.provides[NAV_MANAGER];
79
+ const navManager = hasRouter ? inject(NAV_MANAGER) : undefined;
80
+ const handleRouterLink = (ev) => {
81
+ const { routerLink } = props;
82
+ if (routerLink === EMPTY_PROP)
83
+ return;
84
+ if (navManager !== undefined) {
85
+ let navigationPayload = { event: ev };
86
+ for (const key in props) {
87
+ const value = props[key];
88
+ if (props.hasOwnProperty(key) && key.startsWith(ROUTER_PROP_PREFIX) && value !== EMPTY_PROP) {
89
+ navigationPayload[key] = value;
90
+ }
91
+ }
92
+ navManager.navigate(navigationPayload);
93
+ }
94
+ else {
95
+ console.warn('Tried to navigate, but no router was found. Make sure you have mounted Vue Router.');
96
+ }
97
+ };
98
+ return () => {
99
+ modelPropValue = props[modelProp];
100
+ getComponentClasses(attrs.class).forEach((value) => {
101
+ classes.add(value);
102
+ });
103
+ const oldClick = props.onClick;
104
+ const handleClick = (ev) => {
105
+ if (oldClick !== undefined) {
106
+ oldClick(ev);
107
+ }
108
+ if (!ev.defaultPrevented) {
109
+ handleRouterLink(ev);
110
+ }
111
+ };
112
+ let propsToAdd = {
113
+ ref: containerRef,
114
+ class: getElementClasses(containerRef, classes),
115
+ onClick: handleClick,
116
+ onVnodeBeforeMount: modelUpdateEvent ? onVnodeBeforeMount : undefined,
117
+ };
118
+ /**
119
+ * We can use Object.entries here
120
+ * to avoid the hasOwnProperty check,
121
+ * but that would require 2 iterations
122
+ * where as this only requires 1.
123
+ */
124
+ for (const key in props) {
125
+ const value = props[key];
126
+ if ((props.hasOwnProperty(key) && value !== EMPTY_PROP) || key.startsWith(ARIA_PROP_PREFIX)) {
127
+ propsToAdd[key] = value;
128
+ }
129
+ }
130
+ if (modelProp) {
131
+ /**
132
+ * If form value property was set using v-model
133
+ * then we should use that value.
134
+ * Otherwise, check to see if form value property
135
+ * was set as a static value (i.e. no v-model).
136
+ */
137
+ if (props[MODEL_VALUE] !== EMPTY_PROP) {
138
+ propsToAdd = {
139
+ ...propsToAdd,
140
+ [modelProp]: props[MODEL_VALUE],
141
+ };
142
+ }
143
+ else if (modelPropValue !== EMPTY_PROP) {
144
+ propsToAdd = {
145
+ ...propsToAdd,
146
+ [modelProp]: modelPropValue,
147
+ };
148
+ }
149
+ }
150
+ return h(name, propsToAdd, slots.default && slots.default());
151
+ };
152
+ });
153
+ if (typeof Container !== 'function') {
154
+ Container.name = name;
155
+ Container.props = {
156
+ [ROUTER_LINK_VALUE]: DEFAULT_EMPTY_PROP,
157
+ };
158
+ componentProps.forEach((componentProp) => {
159
+ Container.props[componentProp] = DEFAULT_EMPTY_PROP;
160
+ });
161
+ if (modelProp) {
162
+ Container.props[MODEL_VALUE] = DEFAULT_EMPTY_PROP;
163
+ Container.emits = [UPDATE_VALUE_EVENT, externalModelUpdateEvent];
164
+ }
165
+ }
166
+ return Container;
167
+ };
168
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/generated/vue-component-lib/utils.ts"],"names":[],"mappings":"AAAA,cAAc;AACd,wGAAwG;AACxG,OAAO,EAAS,eAAe,EAAE,kBAAkB,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,EAAO,MAAM,KAAK,CAAC;AAMtF,MAAM,kBAAkB,GAAG,mBAAmB,CAAC;AAC/C,MAAM,WAAW,GAAG,YAAY,CAAC;AACjC,MAAM,iBAAiB,GAAG,YAAY,CAAC;AACvC,MAAM,WAAW,GAAG,YAAY,CAAC;AACjC,MAAM,kBAAkB,GAAG,QAAQ,CAAC;AACpC,MAAM,gBAAgB,GAAG,MAAM,CAAC;AAChC;;;;;;;;GAQG;AACH,MAAM,UAAU,GAAG,MAAM,EAAE,CAAC;AAC5B,MAAM,kBAAkB,GAAG,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC;AAMnD,MAAM,mBAAmB,GAAG,CAAC,OAAgB,EAAE,EAAE;IAC/C,OAAQ,OAAkB,EAAE,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;AAC/C,CAAC,CAAC;AAEF,MAAM,iBAAiB,GAAG,CACxB,GAAiC,EACjC,gBAA6B,EAC7B,iBAA2B,EAAE,EAC7B,EAAE;IACF,OAAO,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,CAAC,EAAE,GAAG,cAAc,CAAC,CAAC,MAAM,CAC1E,CAAC,CAAS,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC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O,EAAE,CAAC,CAAC;QAC/D,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,IAAI,OAAO,SAAS,KAAK,UAAU,EAAE;QACnC,SAAS,CAAC,IAAI,GAAG,IAAI,CAAC;QAEtB,SAAS,CAAC,KAAK,GAAG;YAChB,CAAC,iBAAiB,CAAC,EAAE,kBAAkB;SACxC,CAAC;QAEF,cAAc,CAAC,OAAO,CAAC,CAAC,aAAa,EAAE,EAAE;YACvC,SAAS,CAAC,KAAK,CAAC,aAAa,CAAC,GAAG,kBAAkB,CAAC;QACtD,CAAC,CAAC,CAAC;QAEH,IAAI,SAAS,EAAE;YACb,SAAS,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,kBAAkB,CAAC;YAClD,SAAS,CAAC,KAAK,GAAG,CAAC,kBAAkB,EAAE,wBAAwB,CAAC,CAAC;SAClE;KACF;IAED,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC"}
package/lib/index.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export * from './generated/proxies';
2
+ export { getPlatform, getTheme, type IconLibrary, type IconLibraryResolver, registerIconLibrary, setAssetPath, setNonce, setPlatform, setTheme, unregisterIconLibrary, } from '@quartzds/core';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,qBAAqB,CAAA;AACnC,OAAO,EACL,WAAW,EACX,QAAQ,EACR,KAAK,WAAW,EAChB,KAAK,mBAAmB,EACxB,mBAAmB,EACnB,YAAY,EACZ,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,qBAAqB,GACtB,MAAM,gBAAgB,CAAA"}
package/lib/index.js ADDED
@@ -0,0 +1,6 @@
1
+ // SPDX-FileCopyrightText: © 2023 Schneider Electric
2
+ //
3
+ // SPDX-License-Identifier: LGPL-2.1-only
4
+ export * from './generated/proxies';
5
+ export { getPlatform, getTheme, registerIconLibrary, setAssetPath, setNonce, setPlatform, setTheme, unregisterIconLibrary, } from '@quartzds/core';
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,EAAE;AACF,yCAAyC;AAEzC,cAAc,qBAAqB,CAAA;AACnC,OAAO,EACL,WAAW,EACX,QAAQ,EAGR,mBAAmB,EACnB,YAAY,EACZ,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,qBAAqB,GACtB,MAAM,gBAAgB,CAAA"}
package/package.json ADDED
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "@quartzds/core-vue",
3
+ "version": "1.0.0-beta.1",
4
+ "description": "Vue wrapper for @quartzds/core",
5
+ "homepage": "https://github.com/quartzds/core-foundations/tree/main/packages/vue",
6
+ "bugs": {
7
+ "url": "https://github.com/quartzds/core-foundations/issues"
8
+ },
9
+ "repository": "https://github.com/quartzds/core-foundations",
10
+ "license": "LGPL-2.1-only",
11
+ "exports": {
12
+ ".": {
13
+ "types": "./lib/index.d.ts",
14
+ "import": "./lib/index.js"
15
+ },
16
+ "./package.json": "./package.json"
17
+ },
18
+ "main": "./lib/index.js",
19
+ "types": "./lib/index.d.ts",
20
+ "files": [
21
+ "lib/**"
22
+ ],
23
+ "scripts": {
24
+ "clean": "rimraf lib/"
25
+ },
26
+ "dependencies": {
27
+ "@quartzds/core": "1.0.0-beta.1"
28
+ },
29
+ "devDependencies": {
30
+ "rimraf": "5.0.1",
31
+ "vue": "3.3.4"
32
+ },
33
+ "peerDependencies": {
34
+ "vue": ">=3.0.0"
35
+ },
36
+ "engines": {
37
+ "node": "^14.20.0 || ^16.13.0 || >=18.10.0"
38
+ },
39
+ "publishConfig": {
40
+ "access": "public"
41
+ }
42
+ }