Skip to content

Commit

Permalink
fix(Beeq Vue): remove applyPolyfills function
Browse files Browse the repository at this point in the history
BEEQ integration with Vue.js is broken, 'cuz the latest Stencil version no longer copy polyfills to the dist OT unless building es5.
  • Loading branch information
dgonzalezr committed May 15, 2024
1 parent 1ef177c commit 4502ae3
Showing 1 changed file with 16 additions and 18 deletions.
34 changes: 16 additions & 18 deletions packages/beeq-vue/src/plugin.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
import { Plugin } from 'vue';
import { applyPolyfills, defineCustomElements } from '@beeq/core/dist/loader';
import { defineCustomElements } from '@beeq/core/dist/loader';

export const BeeqVue: Plugin = {
async install() {
applyPolyfills().then(() => {
// @stencil/vue-output-target does not support camelCase event names
// so we are attaching a custom event listener to map camelCase to kebab-case event names
const camelCaseToKebab = (str: string) => {
return str
.split(/(?=[A-Z])/)
.join('-')
.toLowerCase();
};
defineCustomElements(window, {
ael: (el: any, eventName: string, cb: any, opts: any) =>
el.addEventListener(camelCaseToKebab(eventName), cb, opts),
rel: (el: any, eventName: string, cb: any, opts: any) =>
el.removeEventListener(camelCaseToKebab(eventName), cb, opts),
ce: (eventName: string, opts: any) => new CustomEvent(camelCaseToKebab(eventName), opts),
} as any);
});
// @stencil/vue-output-target does not support camelCase event names
// so we are attaching a custom event listener to map camelCase to kebab-case event names
const camelCaseToKebab = (str: string) => {
return str
.split(/(?=[A-Z])/)
.join('-')
.toLowerCase();
};
defineCustomElements(window, {
ael: (el: any, eventName: string, cb: any, opts: any) =>
el.addEventListener(camelCaseToKebab(eventName), cb, opts),
rel: (el: any, eventName: string, cb: any, opts: any) =>
el.removeEventListener(camelCaseToKebab(eventName), cb, opts),
ce: (eventName: string, opts: any) => new CustomEvent(camelCaseToKebab(eventName), opts),
} as any);
},
};

0 comments on commit 4502ae3

Please sign in to comment.