From f41bc3269ea9b5f10138450b106544e41e00a8aa Mon Sep 17 00:00:00 2001 From: Moein Akbarof Date: Fri, 24 Jun 2022 10:05:32 +0200 Subject: [PATCH 1/3] [core-v2.3.1-alpha.3]: Feature - Allow defining container element for account center --- packages/core/src/constants.ts | 1 + packages/core/src/index.ts | 8 +++++++- packages/core/src/types.ts | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/core/src/constants.ts b/packages/core/src/constants.ts index 32bed8402..f85fd01c7 100644 --- a/packages/core/src/constants.ts +++ b/packages/core/src/constants.ts @@ -9,6 +9,7 @@ export const APP_INITIAL_STATE: AppState = { enabled: true, position: 'topRight', expanded: false, + containerElement: 'body', minimal: configuration.device.type === 'mobile' }, notify: { diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index bf9c0a384..84730bc5e 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -237,7 +237,13 @@ function mountApp() { ` - document.body.appendChild(onboard) + const containerElementQuery = state.get().accountCenter.containerElement || 'body' + const containerElement = document.querySelector(containerElementQuery) + if (!containerElement) { + throw new Error(`Element with query ${state.get().accountCenter} does not exist.`) + } + + containerElement.appendChild(onboard) const app = new App({ target diff --git a/packages/core/src/types.ts b/packages/core/src/types.ts index 8a883db33..ea56e1607 100644 --- a/packages/core/src/types.ts +++ b/packages/core/src/types.ts @@ -144,6 +144,7 @@ export type AccountCenterPosition = export type AccountCenter = { enabled: boolean position?: AccountCenterPosition + containerElement?: string expanded?: boolean minimal?: boolean } From 85e10c84337e017c9f08acd0e45121591416473c Mon Sep 17 00:00:00 2001 From: Moein Akbarof Date: Fri, 24 Jun 2022 10:07:46 +0200 Subject: [PATCH 2/3] [core-v2.3.1-alpha.3]: Feature - Allow defining container element for account center --- packages/core/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/package.json b/packages/core/package.json index e05644887..570fabb2e 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/core", - "version": "2.3.1-alpha.2", + "version": "2.3.1-alpha.3", "scripts": { "build": "rollup -c", "dev": "rollup -c -w", From 78786e637758bd225ee0824e5f7b7ad3ae5d7ffe Mon Sep 17 00:00:00 2001 From: Taylor Dawson Date: Fri, 8 Jul 2022 11:51:11 -0230 Subject: [PATCH 3/3] Version bumps + validation --- packages/core/package.json | 2 +- packages/core/src/validation.ts | 6 ++++-- packages/demo/package.json | 2 +- packages/react/package.json | 4 ++-- packages/vue/package.json | 4 ++-- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/packages/core/package.json b/packages/core/package.json index 0e83f4147..f39f894a6 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/core", - "version": "2.4.0-alpha.6", + "version": "2.4.0-alpha.7", "repository": "blocknative/web3-onboard", "scripts": { "build": "rollup -c", diff --git a/packages/core/src/validation.ts b/packages/core/src/validation.ts index b4dc2688c..dd5223365 100644 --- a/packages/core/src/validation.ts +++ b/packages/core/src/validation.ts @@ -159,12 +159,14 @@ const initOptions = Joi.object({ desktop: Joi.object({ enabled: Joi.boolean(), minimal: Joi.boolean(), - position: commonPositions + position: commonPositions, + containerElement: Joi.string() }), mobile: Joi.object({ enabled: Joi.boolean(), minimal: Joi.boolean(), - position: commonPositions + position: commonPositions, + containerElement: Joi.string() }) }), notify: [notifyOptions, notify] diff --git a/packages/demo/package.json b/packages/demo/package.json index b7ed47c7c..d115bd15d 100644 --- a/packages/demo/package.json +++ b/packages/demo/package.json @@ -23,7 +23,7 @@ }, "dependencies": { "@web3-onboard/coinbase": "^2.0.7", - "@web3-onboard/core": "^2.4.0-alpha.6", + "@web3-onboard/core": "^2.4.0-alpha.7", "@web3-onboard/dcent": "^2.0.4", "@web3-onboard/fortmatic": "^2.0.6", "@web3-onboard/gnosis": "^2.0.5", diff --git a/packages/react/package.json b/packages/react/package.json index 4090c49a4..5682fcd6a 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/react", - "version": "2.2.3-alpha.4", + "version": "2.2.3-alpha.5", "description": "Collection of React Hooks for web3-onboard", "repository": "blocknative/web3-onboard", "module": "dist/index.js", @@ -24,7 +24,7 @@ "typescript": "^4.5.5" }, "dependencies": { - "@web3-onboard/core": "^2.4.0-alpha.6", + "@web3-onboard/core": "^2.4.0-alpha.7", "@web3-onboard/common": "^2.1.4", "use-sync-external-store": "1.0.0" }, diff --git a/packages/vue/package.json b/packages/vue/package.json index 68231e8ac..9b2c334aa 100644 --- a/packages/vue/package.json +++ b/packages/vue/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/vue", - "version": "2.1.3-alpha.4", + "version": "2.1.3-alpha.5", "description": "Vue Composable for web3-onboard", "repository": "blocknative/web3-onboard", "module": "dist/index.js", @@ -25,7 +25,7 @@ "@vueuse/core": "^8.4.2", "@vueuse/rxjs": "^8.2.0", "@web3-onboard/common": "^2.1.4", - "@web3-onboard/core": "^2.4.0-alpha.6", + "@web3-onboard/core": "^2.4.0-alpha.7", "vue-demi": "^0.12.4" }, "peerDependencies": {