Skip to content

Commit

Permalink
feat(core): remove apply polyfills for old browsers and update depend…
Browse files Browse the repository at this point in the history
…encies (#485)
  • Loading branch information
felipefialho authored Jul 2, 2024
1 parent c2d9796 commit 8d9cc6f
Show file tree
Hide file tree
Showing 11 changed files with 1,691 additions and 985 deletions.
2,587 changes: 1,653 additions & 934 deletions package-lock.json

Large diffs are not rendered by default.

36 changes: 18 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
},
"dependencies": {
"@ionic/core": "^7.8.6",
"@stencil/core": "^4.17.2"
"@stencil/core": "^4.19.2"
},
"devDependencies": {
"@babel/core": "^7.24.7",
Expand All @@ -41,7 +41,7 @@
"@commitlint/cli": "^19.3.0",
"@commitlint/config-conventional": "^19.2.2",
"@juntossomosmais/linters": "^0.19.0",
"@nrwl/workspace": "19.2.0",
"@nrwl/workspace": "19.3.2",
"@rollup/plugin-typescript": "^11.1.6",
"@stencil/react-output-target": "^0.5.3",
"@stencil/sass": "^3.0.12",
Expand All @@ -60,13 +60,13 @@
"@vitejs/plugin-vue": "^5.0.5",
"@storybook/web-components": "^7.6.17",
"@storybook/web-components-webpack5": "^7.6.17",
"@testing-library/jest-dom": "^6.4.5",
"@testing-library/jest-dom": "^6.4.6",
"@types/jest": "^27.0.3",
"@types/node": "^20.14.2",
"@types/node": "^20.14.9",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@typescript-eslint/eslint-plugin": "^7.12.0",
"@typescript-eslint/parser": "^7.12.0",
"@typescript-eslint/eslint-plugin": "^7.15.0",
"@typescript-eslint/parser": "^7.15.0",
"autoprefixer": "^10.4.19",
"babel-loader": "^9.1.3",
"babel-plugin-transform-scss": "^1.2.0",
Expand All @@ -79,32 +79,32 @@
"husky": "^9.0.11",
"jest": "^27.0.3",
"jest-cli": "^27.0.3",
"lint-staged": "^15.2.5",
"lint-staged": "^15.2.7",
"lit": "^3.1.4",
"nx": "19.2.0",
"postcss": "^8.4.38",
"nx": "19.3.2",
"postcss": "^8.4.39",
"postcss-scss": "^4.0.9",
"prettier": "3.3.1",
"prettier": "3.3.2",
"prop-types": "^15.8.1",
"puppeteer": "^22.10.0",
"puppeteer": "^22.12.1",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"rollup": "^4.18.0",
"rollup-plugin-postcss": "^4.0.2",
"rupture-sass": "^1.0.0",
"sass": "^1.77.4",
"sass": "^1.77.6",
"sass-loader": "^14.2.1",
"storybook": "^7.6.17",
"stylelint": "^16.6.1",
"stylelint-config-recommended": "^14.0.0",
"stylelint-config-recommended": "^14.0.1",
"stylelint-order": "^6.0.4",
"stylelint-scss": "^6.3.1",
"ts-jest": "^29.1.4",
"stylelint-scss": "^6.3.2",
"ts-jest": "^29.1.5",
"ts-node": "^10.9.2",
"tslib": "^2.6.3",
"typescript": "^5.4.5",
"vite": "^5.2.12",
"vue": "^3.4.27"
"typescript": "^5.5.3",
"vite": "^5.3.2",
"vue": "^3.4.31"
},
"lint-staged": {
"*.{js,jsx,ts,tsx}": [
Expand Down
7 changes: 2 additions & 5 deletions packages/core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,9 @@ npm i @juntossomosmais/atomium
```jsx
import '@juntossomosmais/atomium/core.css'

import {
applyPolyfills,
defineCustomElements,
} from '@juntossomosmais/atomium/loader'
import { defineCustomElements } from '@juntossomosmais/atomium/loader'

applyPolyfills().then(() => defineCustomElements(window))
defineCustomElements(window)

<atom-button>Click me</atom-button>
```
Expand Down
4 changes: 1 addition & 3 deletions packages/core/loader/cdn.js
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@

module.exports = require('../dist/cjs/loader.cjs.js');
module.exports.applyPolyfills = function() { return Promise.resolve() };
module.exports = require('../dist/cjs/loader.cjs.js');
4 changes: 1 addition & 3 deletions packages/core/loader/index.cjs.js
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@

module.exports = require('../dist/cjs/loader.cjs.js');
module.exports.applyPolyfills = function() { return Promise.resolve() };
module.exports = require('../dist/cjs/loader.cjs.js');
3 changes: 3 additions & 0 deletions packages/core/loader/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ export interface CustomElementsDefineOptions {
rel?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
}
export declare function defineCustomElements(win?: Window, opts?: CustomElementsDefineOptions): void;
/**
* @deprecated
*/
export declare function applyPolyfills(): Promise<void>;

/**
Expand Down
4 changes: 1 addition & 3 deletions packages/core/loader/index.es2017.js
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@

export * from '../dist/esm/polyfills/index.js';
export * from '../dist/esm/loader.js';
export * from '../dist/esm/loader.js';
4 changes: 1 addition & 3 deletions packages/core/loader/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/core/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
import { HTMLStencilElement, JSXBase } from "@stencil/core/internal";
import { IconProps } from "./icons";
import { Color, Mode, TextFieldTypes } from "@ionic/core";
import { IonTypes } from "@ionic/core/dist/types/components";
import { LocalJSX as IonTypes } from "@ionic/core/dist/types/components";
export { IconProps } from "./icons";
export { Color, Mode, TextFieldTypes } from "@ionic/core";
export { IonTypes } from "@ionic/core/dist/types/components";
export { LocalJSX as IonTypes } from "@ionic/core/dist/types/components";
export namespace Components {
interface AtomAlert {
"actionText"?: string;
Expand Down
2 changes: 1 addition & 1 deletion packages/core/stencil.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export const config: Config = {
componentCorePackage: '@juntossomosmais/atomium',
proxiesFile: '../react/src/components/index.ts',
includeDefineCustomElements: true,
includePolyfills: true,
includePolyfills: false,
excludeComponents,
}),
reactBooleanFixOutputTarget({
Expand Down
21 changes: 8 additions & 13 deletions packages/vue/src/plugin.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import {
applyPolyfills,
defineCustomElements,
} from '@juntossomosmais/atomium/loader'
import { defineCustomElements } from '@juntossomosmais/atomium/loader'
import { Plugin } from 'vue'

function toKebabCase(str: string) {
Expand All @@ -10,14 +7,12 @@ function toKebabCase(str: string) {

export const ComponentLibrary: Plugin = {
async install() {
applyPolyfills().then(() => {
defineCustomElements(window, {
ce: (eventName: string, opts: any) =>
new CustomEvent(
eventName.startsWith('atom') ? toKebabCase(eventName) : eventName,
opts
),
} as any)
})
defineCustomElements(window, {
ce: (eventName: string, opts: any) =>
new CustomEvent(
eventName.startsWith('atom') ? toKebabCase(eventName) : eventName,
opts
),
} as any)
},
}

0 comments on commit 8d9cc6f

Please sign in to comment.