From e5bae1b8b73d87a6d0ee050c7b9696c81cc9d702 Mon Sep 17 00:00:00 2001 From: "Manu Mtz.-Almeida" Date: Thu, 27 Jun 2019 19:25:40 +0200 Subject: [PATCH] fix(): update ComponentInterface definition --- src/compiler/app-core/reserved-properties.ts | 241 ------------------- src/declarations/component-interfaces.ts | 21 +- src/declarations/runtime.ts | 2 +- src/index.ts | 2 +- src/testing/core.ts | 4 +- 5 files changed, 8 insertions(+), 262 deletions(-) delete mode 100644 src/compiler/app-core/reserved-properties.ts diff --git a/src/compiler/app-core/reserved-properties.ts b/src/compiler/app-core/reserved-properties.ts deleted file mode 100644 index d8aec12526d..00000000000 --- a/src/compiler/app-core/reserved-properties.ts +++ /dev/null @@ -1,241 +0,0 @@ - -/** - * Properties which must not be property renamed during minification - */ -export const RESERVED_PROPERTIES: string[] = [ - 'addListener', - 'applyPolyfill', - 'attribute', - 'color', - 'Context', - 'dom', - 'emit', - 'enableListener', - 'eventNameFn', - 'h', - 'initialized', - 'isClient', - 'isPrerender', - 'isBrowser', - 'key', - 'loaded', - 'mode', - 'namespace', - 'onReady', - 'Promise', - 'publicPath', - 'queue', - 'ael', - 'rel', - 'raf', - 'asyncQueue', - 'read', - 'ref', - 'resourcesUrl', - 'tick', - 'write', - - - /** - * App Global - window.App - * Properties which get added to the app's global - */ - 'components', - 'loadBundle', - 'loadStyles', - - - /** - * Host Element - * Properties set on the host element - */ - '$', - 'componentOnReady', - - - /** - * Component Constructor static properties - */ - 'attr', - 'capture', - 'connect', - 'context', - 'disabled', - 'elementRef', - 'encapsulation', - 'events', - 'host', - 'is', - 'listeners', - 'meta', - 'method', - 'mutable', - 'passive', - 'properties', - 'reflect', - 'reflectToAttr', - 'scoped', - 'state', - 'style', - 'styleMode', - 'type', - 'watchCallbacks', - - /** - * Component Instance - * Methods set on the user's component - */ - 'componentWillLoad', - 'componentDidLoad', - 'componentWillUpdate', - 'componentDidUpdate', - 'componentDidUnload', - 'forceUpdate', - 'hostData', - 'render', - - - /** - * Functional Component Util - */ - 'getTag', - 'getChildren', - 'getText', - 'getAttributes', - 'replaceAttributes', - - - /** - * Web Standards / DOM - */ - 'add', - 'addEventListener', - 'appendChild', - 'async', - 'attachShadow', - 'attributeChangedCallback', - 'body', - 'bubbles', - 'cancelable', - 'capture', - 'characterData', - 'charset', - 'childNodes', - 'children', - 'class', - 'classList', - 'className', - 'clearMarks', - 'clearMeasures', - 'cloneNode', - 'closest', - 'composed', - 'configurable', - 'connectedCallback', - 'content', - 'createComment', - 'createElement', - 'createElementNS', - 'createEvent', - 'createTextNode', - 'CSS', - 'currentScript', - 'customElements', - 'CustomEvent', - 'data', - 'defaultView', - 'define', - 'detail', - 'didTimeout', - 'disconnect', - 'disconnectedCallback', - 'dispatchEvent', - 'document', - 'documentElement', - 'Element', - 'error', - 'Event', - 'fetch', - 'firstChild', - 'firstElementChild', - 'getAttribute', - 'getAttributeNS', - 'getRootNode', - 'getStyle', - 'hasAttribute', - 'head', - 'hidden', - 'host', - 'hostname', - 'href', - 'id', - 'initCustomEvent', - 'innerHTML', - 'insertBefore', - 'location', - 'log', - 'keyCode', - 'mark', - 'measure', - 'match', - 'matches', - 'matchesSelector', - 'matchMedia', - 'mozMatchesSelector', - 'msMatchesSelector', - 'navigator', - 'nextSibling', - 'nodeName', - 'nodeType', - 'now', - 'observe', - 'observedAttributes', - 'onerror', - 'onload', - 'onmessage', - 'ownerDocument', - 'ownerSVGElement', - 'parentElement', - 'parentNode', - 'passive', - 'pathname', - 'performance', - 'postMessage', - 'previousSibling', - 'querySelector', - 'querySelectorAll', - 'remove', - 'removeAttribute', - 'removeAttributeNS', - 'removeChild', - 'removeEventListener', - 'removeProperty', - 'requestAnimationFrame', - 'requestIdleCallback', - 'search', - 'setAttribute', - 'setAttributeNS', - 'setProperty', - 'shadowRoot', - 'src', - 'style', - 'supports', - 'tagName', - 'text', - 'textContent', - 'timeRemaining', - 'type', - 'value', - 'warn', - 'webkitMatchesSelector', - 'window', - 'HTMLElement', - - /** CSS Vars Shim */ - 'createHostStyle', - '__stencil_cssshim', - 'initShim', - 'removeHost', - 'updateGlobal', - 'updateHost', -]; diff --git a/src/declarations/component-interfaces.ts b/src/declarations/component-interfaces.ts index 89dc2cf9d5c..786606885e9 100644 --- a/src/declarations/component-interfaces.ts +++ b/src/declarations/component-interfaces.ts @@ -61,10 +61,13 @@ export interface ComponentDidUnload { componentDidUnload: () => void; } -export interface ComponentInstance { +export interface ComponentInterface { connectedCallback?: () => void; disconnectedCallback?: () => void; + componentWillRender?: () => Promise | void; + componentDidRender?: () => void; + /** * The component is about to load and it has not * rendered yet. @@ -107,24 +110,8 @@ export interface ComponentInstance { */ componentDidUpdate?: () => void; - /** - * The component did unload and the element - * will be destroyed. - */ - componentDidUnload?: () => void; - render?: () => any; - /** - * Used to dynamically set host element attributes. - * Should be placed directly above render() - */ - hostData?: () => { - class?: {[className: string]: boolean}; - style?: any; - [attrName: string]: any; - }; - [memberName: string]: any; } diff --git a/src/declarations/runtime.ts b/src/declarations/runtime.ts index 0a943477287..fa2c7fd1f40 100644 --- a/src/declarations/runtime.ts +++ b/src/declarations/runtime.ts @@ -88,7 +88,7 @@ export interface HostRef { $flags$: number; $hostElement$?: d.HostElement; $instanceValues$?: Map; - $lazyInstance$?: d.ComponentInstance; + $lazyInstance$?: d.ComponentInterface; $onReadyPromise$?: Promise; $onReadyResolve$?: (elm: any) => void; $vnode$?: d.VNode; diff --git a/src/index.ts b/src/index.ts index 82edcf4a1b0..a5b3de68396 100644 --- a/src/index.ts +++ b/src/index.ts @@ -6,7 +6,7 @@ export { ComponentDidUpdate, ComponentWillLoad, ComponentWillUpdate, - ComponentInstance as ComponentInterface, + ComponentInterface, StencilConfig as Config, EventEmitter, FunctionalComponent, diff --git a/src/testing/core.ts b/src/testing/core.ts index aec11e8ad09..2e82c90fcbc 100644 --- a/src/testing/core.ts +++ b/src/testing/core.ts @@ -7,12 +7,12 @@ export { ComponentDidUpdate, ComponentWillLoad, ComponentWillUpdate, - ComponentInstance as ComponentInterface, + ComponentInterface, StencilConfig as Config, EventEmitter, FunctionalComponent, QueueApi, - JSXBase, + JSX } from '../declarations'; /**