Skip to content

Commit

Permalink
feat(react): add custom elements bundle (#23896)
Browse files Browse the repository at this point in the history
  • Loading branch information
liamdebeasi committed Sep 13, 2021
1 parent d1763fc commit c50d895
Show file tree
Hide file tree
Showing 57 changed files with 321 additions and 565 deletions.
24 changes: 0 additions & 24 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -377,28 +377,6 @@ jobs:
command: npm run test.spec
working_directory: /tmp/workspace/packages/react

test-react-router-spec:
<<: *defaults
steps:
- checkout
- attach_workspace:
at: /tmp/workspace
- run:
command: sudo npm link
working_directory: /tmp/workspace/core
- run:
command: sudo npm link @ionic/core
working_directory: /tmp/workspace/packages/react
- run:
command: sudo npm link
working_directory: /tmp/workspace/packages/react
- run:
command: sudo npm link @ionic/react
working_directory: /tmp/workspace/packages/react-router
- run:
command: npm run test.spec
working_directory: /tmp/workspace/packages/react-router

install-react-test-app:
<<: *defaults
steps:
Expand Down Expand Up @@ -537,8 +515,6 @@ workflows:
requires: [build-react-router]
- test-react-spec:
requires: [build-react]
- test-react-router-spec:
requires: [build-react-router]
- install-react-test-app:
requires: [build-core]
- test-react-e2e:
Expand Down
14 changes: 7 additions & 7 deletions core/package-lock.json

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

2 changes: 1 addition & 1 deletion core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"@jest/core": "^26.6.3",
"@rollup/plugin-node-resolve": "^8.4.0",
"@rollup/plugin-virtual": "^2.0.3",
"@stencil/react-output-target": "^0.0.12",
"@stencil/react-output-target": "^0.1.0-2",
"@stencil/sass": "1.3.2",
"@stencil/vue-output-target": "^0.5.1",
"@types/jest": "^26.0.20",
Expand Down
6 changes: 6 additions & 0 deletions core/src/components/menu/menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,12 @@ export class Menu implements ComponentInterface, MenuI {
@Event() protected ionMenuChange!: EventEmitter<MenuChangeEventDetail>;

async connectedCallback() {
// TODO: connectedCallback is fired in CE build
// before WC is defined. This needs to be fixed in Stencil.
if (typeof (customElements as any) !== 'undefined') {
await customElements.whenDefined('ion-menu');
}

if (this.type === undefined) {
this.type = config.get('menuType', 'overlay');
}
Expand Down
7 changes: 6 additions & 1 deletion core/src/components/split-pane/split-pane.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,12 @@ export class SplitPane implements ComponentInterface {
this.ionSplitPaneVisible.emit(detail);
}

connectedCallback() {
async connectedCallback() {
// TODO: connectedCallback is fired in CE build
// before WC is defined. This needs to be fixed in Stencil.
if (typeof (customElements as any) !== 'undefined') {
await customElements.whenDefined('ion-split-pane');
}
this.styleChildren();
this.updateState();
}
Expand Down
1 change: 1 addition & 0 deletions core/stencil.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export const config: Config = {
outputTargets: [
reactOutputTarget({
componentCorePackage: '@ionic/core',
includeImportCustomElements: true,
includePolyfills: false,
includeDefineCustomElements: false,
proxiesFile: '../packages/react/src/components/proxies.ts',
Expand Down
32 changes: 1 addition & 31 deletions packages/react-router/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
"release": "np --any-branch --no-cleanup",
"lint": "tslint --project .",
"lint.fix": "tslint --project . --fix",
"tsc": "tsc -p .",
"test.spec": "jest --ci"
"tsc": "tsc -p ."
},
"main": "dist/index.js",
"module": "dist/index.esm.js",
Expand All @@ -49,16 +48,11 @@
"@ionic/core": "6.0.0-beta.5",
"@ionic/react": "6.0.0-beta.5",
"@rollup/plugin-node-resolve": "^8.1.0",
"@testing-library/jest-dom": "^5.11.6",
"@testing-library/react": "^11.2.2",
"@testing-library/user-event": "^12.0.11",
"@types/jest": "^26.0.15",
"@types/node": "^14.0.14",
"@types/react": "16.14.0",
"@types/react-dom": "^16.9.0",
"@types/react-router": "^5.0.3",
"@types/react-router-dom": "^5.1.5",
"jest": "^26.6.3",
"np": "^6.4.0",
"prettier": "^2.2.0",
"react": "^16.9.0",
Expand All @@ -68,33 +62,9 @@
"rimraf": "^3.0.2",
"rollup": "^2.26.4",
"rollup-plugin-sourcemaps": "^0.6.2",
"ts-jest": "^26.4.4",
"tslint": "^6.1.2",
"tslint-ionic-rules": "0.0.21",
"tslint-react": "^5.0.0",
"typescript": "^3.9.5"
},
"jest": {
"preset": "ts-jest",
"setupFilesAfterEnv": [
"<rootDir>/setupTests.ts"
],
"testPathIgnorePatterns": [
"node_modules",
"dist-transpiled",
"dist",
"<rootDir>/test-app"
],
"globals": {
"ts-jest": {
"diagnostics": false
}
},
"modulePaths": [
"<rootDir>"
],
"moduleNameMapper": {
"\\.(css|jpg|png|svg)$": "<rootDir>/empty-module.js"
}
}
}
11 changes: 0 additions & 11 deletions packages/react-router/setupTests.ts

This file was deleted.

73 changes: 0 additions & 73 deletions packages/react-router/src/__tests__/Router.spec.tsx

This file was deleted.

28 changes: 14 additions & 14 deletions packages/react-router/test-app/package-lock.json

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

3 changes: 2 additions & 1 deletion packages/react-router/test-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"@capacitor/ios": "^2.2.0",
"@ionic/react": "5.6.3",
"@ionic/react-router": "^5.6.3",
"@stencil/core": "^2.8.0",
"@svgr/webpack": "4.3.3",
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.4.0",
Expand Down Expand Up @@ -72,7 +73,7 @@
"style-loader": "0.23.1",
"terser-webpack-plugin": "2.3.4",
"ts-pnp": "1.1.5",
"typescript": "^3.9.5",
"typescript": "^4.4.2",
"url-loader": "2.3.0",
"wait-on": "^5.3.0",
"webpack": "4.41.5",
Expand Down
8 changes: 4 additions & 4 deletions packages/react-router/test-app/scripts/sync.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ rm -rf node_modules/@ionic/react-router/dist
cp -a ../dist node_modules/@ionic/react-router/dist
cp -a ../package.json node_modules/@ionic/react-router/package.json

# Copy core dist
rm -rf node_modules/@ionic/core/dist node_modules/@ionic/core/loader
cp -a ../../../core/dist node_modules/@ionic/core/dist
cp -a ../../../core/loader node_modules/@ionic/core/loader
# Copy core dist and components
rm -rf node_modules/@ionic/core/dist node_modules/@ionic/core/components
cp -a ../../../core/package.json node_modules/@ionic/core/package.json
cp -a ../../../core/dist node_modules/@ionic/core/dist
cp -a ../../../core/components node_modules/@ionic/core/components

# Copy ionicons
rm -rf node_modules/ionicons
Expand Down
1 change: 0 additions & 1 deletion packages/react-router/test-app/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ import Refs from './pages/refs/Refs';
import DynamicIonpageClassnames from './pages/dynamic-ionpage-classnames/DynamicIonpageClassnames';
import Tabs from './pages/tabs/Tabs';
import TabsSecondary from './pages/tabs/TabsSecondary';
debugger;
const App: React.FC = () => {
return (
<IonApp>
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/components/CreateAnimation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
AnimationKeyFrames,
AnimationLifecycle,
createAnimation,
} from '@ionic/core';
} from '@ionic/core/components';
import React from 'react';

interface PartialPropertyValue {
Expand Down
5 changes: 3 additions & 2 deletions packages/react/src/components/IonActionSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import {
ActionSheetButton as ActionSheetButtonCore,
ActionSheetOptions as ActionSheetOptionsCore,
actionSheetController as actionSheetControllerCore,
} from '@ionic/core';
} from '@ionic/core/components';
import { IonActionSheet as IonActionSheetCmp } from '@ionic/core/components/ion-action-sheet.js';

import { createOverlayComponent } from './createOverlayComponent';

Expand All @@ -29,4 +30,4 @@ const actionSheetController = {
export const IonActionSheet = /*@__PURE__*/ createOverlayComponent<
ActionSheetOptions,
HTMLIonActionSheetElement
>('IonActionSheet', actionSheetController);
>('ion-action-sheet', actionSheetController, IonActionSheetCmp);
Loading

0 comments on commit c50d895

Please sign in to comment.