feat(vue): add custom elements bundle (#23458)

This commit is contained in:
Liam DeBeasi
2021-06-17 14:10:50 -04:00
committed by GitHub
parent bccb8ad5fb
commit dc48a9f1a2
37 changed files with 468 additions and 373 deletions

View File

@@ -26,6 +26,10 @@ html:not(.hydrated) body {
display: none;
}
html.ion-ce body {
display: block;
}
html.plt-pwa {
height: 100vh;
}

View File

@@ -1,4 +1,4 @@
import { getMode, setMode } from '@stencil/core';
import { getMode, setMode, setPlatformHelpers } from '@stencil/core';
import { IonicConfig, Mode } from '../interface';
import { isPlatform, setupPlatforms } from '../utils/platform';
@@ -24,6 +24,18 @@ export const initialize = (userConfig: IonicConfig = {}) => {
// Setup platforms
setupPlatforms(win);
const platformHelpers: any = {};
if (userConfig._ael) {
platformHelpers.ael = userConfig._ael;
}
if (userConfig._rel) {
platformHelpers.rel = userConfig._rel;
}
if (userConfig._ce) {
platformHelpers.ce = userConfig._ce;
}
setPlatformHelpers(platformHelpers);
// create the Ionic.config from raw config object (if it exists)
// and convert Ionic.config into a ConfigApi that has a get() fn
const configObj = {

View File

@@ -190,6 +190,7 @@ export interface IonicConfig {
_zoneGate?: (h: () => any) => any;
_ael?: (el: any, name: string, cb: any, opts: any) => any;
_rel?: (el: any, name: string, cb: any, opts: any) => any;
_ce?: (eventName: string, opts: any) => any;
}
export const setupConfig = (config: IonicConfig) => {

View File

@@ -109,13 +109,13 @@ const isElectron = (win: Window): boolean =>
testUserAgent(win, /electron/i);
const isPWA = (win: Window): boolean =>
!!(win.matchMedia('(display-mode: standalone)').matches || (win.navigator as any).standalone);
!!((win.matchMedia && win.matchMedia('(display-mode: standalone)').matches) || (win.navigator as any).standalone);
export const testUserAgent = (win: Window, expr: RegExp) =>
expr.test(win.navigator.userAgent);
const matchMedia = (win: Window, query: string): boolean =>
win.matchMedia(query).matches;
win.matchMedia && win.matchMedia(query).matches;
const PLATFORMS_MAP = {
'ipad': isIpad,