/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import { DOCUMENT, isPlatformServer, ɵgetDOM as getDOM } from '@angular/common'; import { APP_ID, CSP_NONCE, Inject, Injectable, InjectionToken, NgZone, PLATFORM_ID, RendererStyleFlags2, ViewEncapsulation, ɵRuntimeError as RuntimeError } from '@angular/core'; import { EventManager } from './events/event_manager'; import { SharedStylesHost } from './shared_styles_host'; import * as i0 from "@angular/core"; import * as i1 from "./events/event_manager"; import * as i2 from "./shared_styles_host"; export const NAMESPACE_URIS = { 'svg': 'http://www.w3.org/2000/svg', 'xhtml': 'http://www.w3.org/1999/xhtml', 'xlink': 'http://www.w3.org/1999/xlink', 'xml': 'http://www.w3.org/XML/1998/namespace', 'xmlns': 'http://www.w3.org/2000/xmlns/', 'math': 'http://www.w3.org/1998/MathML/', }; const COMPONENT_REGEX = /%COMP%/g; export const COMPONENT_VARIABLE = '%COMP%'; export const HOST_ATTR = `_nghost-${COMPONENT_VARIABLE}`; export const CONTENT_ATTR = `_ngcontent-${COMPONENT_VARIABLE}`; /** * The default value for the `REMOVE_STYLES_ON_COMPONENT_DESTROY` DI token. */ const REMOVE_STYLES_ON_COMPONENT_DESTROY_DEFAULT = false; /** * A [DI token](guide/glossary#di-token "DI token definition") that indicates whether styles * of destroyed components should be removed from DOM. * * By default, the value is set to `false`. This will be changed in the next major version. * @publicApi */ export const REMOVE_STYLES_ON_COMPONENT_DESTROY = new InjectionToken('RemoveStylesOnCompDestroy', { providedIn: 'root', factory: () => REMOVE_STYLES_ON_COMPONENT_DESTROY_DEFAULT, }); export function shimContentAttribute(componentShortId) { return CONTENT_ATTR.replace(COMPONENT_REGEX, componentShortId); } export function shimHostAttribute(componentShortId) { return HOST_ATTR.replace(COMPONENT_REGEX, componentShortId); } export function shimStylesContent(compId, styles) { return styles.map(s => s.replace(COMPONENT_REGEX, compId)); } export class DomRendererFactory2 { constructor(eventManager, sharedStylesHost, appId, removeStylesOnCompDestroy, doc, platformId, ngZone, nonce = null) { this.eventManager = eventManager; this.sharedStylesHost = sharedStylesHost; this.appId = appId; this.removeStylesOnCompDestroy = removeStylesOnCompDestroy; this.doc = doc; this.platformId = platformId; this.ngZone = ngZone; this.nonce = nonce; this.rendererByCompId = new Map(); this.platformIsServer = isPlatformServer(platformId); this.defaultRenderer = new DefaultDomRenderer2(eventManager, doc, ngZone, this.platformIsServer); } createRenderer(element, type) { if (!element || !type) { return this.defaultRenderer; } if (this.platformIsServer && type.encapsulation === ViewEncapsulation.ShadowDom) { // Domino does not support shadow DOM. type = { ...type, encapsulation: ViewEncapsulation.Emulated }; } const renderer = this.getOrCreateRenderer(element, type); // Renderers have different logic due to different encapsulation behaviours. // Ex: for emulated, an attribute is added to the element. if (renderer instanceof EmulatedEncapsulationDomRenderer2) { renderer.applyToHost(element); } else if (renderer instanceof NoneEncapsulationDomRenderer) { renderer.applyStyles(); } return renderer; } getOrCreateRenderer(element, type) { const rendererByCompId = this.rendererByCompId; let renderer = rendererByCompId.get(type.id); if (!renderer) { const doc = this.doc; const ngZone = this.ngZone; const eventManager = this.eventManager; const sharedStylesHost = this.sharedStylesHost; const removeStylesOnCompDestroy = this.removeStylesOnCompDestroy; const platformIsServer = this.platformIsServer; switch (type.encapsulation) { case ViewEncapsulation.Emulated: renderer = new EmulatedEncapsulationDomRenderer2(eventManager, sharedStylesHost, type, this.appId, removeStylesOnCompDestroy, doc, ngZone, platformIsServer); break; case ViewEncapsulation.ShadowDom: return new ShadowDomRenderer(eventManager, sharedStylesHost, element, type, doc, ngZone, this.nonce, platformIsServer); default: renderer = new NoneEncapsulationDomRenderer(eventManager, sharedStylesHost, type, removeStylesOnCompDestroy, doc, ngZone, platformIsServer); break; } rendererByCompId.set(type.id, renderer); } return renderer; } ngOnDestroy() { this.rendererByCompId.clear(); } static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DomRendererFactory2, deps: [{ token: i1.EventManager }, { token: i2.SharedStylesHost }, { token: APP_ID }, { token: REMOVE_STYLES_ON_COMPONENT_DESTROY }, { token: DOCUMENT }, { token: PLATFORM_ID }, { token: i0.NgZone }, { token: CSP_NONCE }], target: i0.ɵɵFactoryTarget.Injectable }); } static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DomRendererFactory2 }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DomRendererFactory2, decorators: [{ type: Injectable }], ctorParameters: function () { return [{ type: i1.EventManager }, { type: i2.SharedStylesHost }, { type: undefined, decorators: [{ type: Inject, args: [APP_ID] }] }, { type: undefined, decorators: [{ type: Inject, args: [REMOVE_STYLES_ON_COMPONENT_DESTROY] }] }, { type: Document, decorators: [{ type: Inject, args: [DOCUMENT] }] }, { type: Object, decorators: [{ type: Inject, args: [PLATFORM_ID] }] }, { type: i0.NgZone }, { type: undefined, decorators: [{ type: Inject, args: [CSP_NONCE] }] }]; } }); class DefaultDomRenderer2 { constructor(eventManager, doc, ngZone, platformIsServer) { this.eventManager = eventManager; this.doc = doc; this.ngZone = ngZone; this.platformIsServer = platformIsServer; this.data = Object.create(null); this.destroyNode = null; } destroy() { } createElement(name, namespace) { if (namespace) { // TODO: `|| namespace` was added in // https://github.com/angular/angular/commit/2b9cc8503d48173492c29f5a271b61126104fbdb to // support how Ivy passed around the namespace URI rather than short name at the time. It did // not, however extend the support to other parts of the system (setAttribute, setAttribute, // and the ServerRenderer). We should decide what exactly the semantics for dealing with // namespaces should be and make it consistent. // Related issues: // https://github.com/angular/angular/issues/44028 // https://github.com/angular/angular/issues/44883 return this.doc.createElementNS(NAMESPACE_URIS[namespace] || namespace, name); } return this.doc.createElement(name); } createComment(value) { return this.doc.createComment(value); } createText(value) { return this.doc.createTextNode(value); } appendChild(parent, newChild) { const targetParent = isTemplateNode(parent) ? parent.content : parent; targetParent.appendChild(newChild); } insertBefore(parent, newChild, refChild) { if (parent) { const targetParent = isTemplateNode(parent) ? parent.content : parent; targetParent.insertBefore(newChild, refChild); } } removeChild(parent, oldChild) { if (parent) { parent.removeChild(oldChild); } } selectRootElement(selectorOrNode, preserveContent) { let el = typeof selectorOrNode === 'string' ? this.doc.querySelector(selectorOrNode) : selectorOrNode; if (!el) { throw new RuntimeError(-5104 /* RuntimeErrorCode.ROOT_NODE_NOT_FOUND */, (typeof ngDevMode === 'undefined' || ngDevMode) && `The selector "${selectorOrNode}" did not match any elements`); } if (!preserveContent) { el.textContent = ''; } return el; } parentNode(node) { return node.parentNode; } nextSibling(node) { return node.nextSibling; } setAttribute(el, name, value, namespace) { if (namespace) { name = namespace + ':' + name; const namespaceUri = NAMESPACE_URIS[namespace]; if (namespaceUri) { el.setAttributeNS(namespaceUri, name, value); } else { el.setAttribute(name, value); } } else { el.setAttribute(name, value); } } removeAttribute(el, name, namespace) { if (namespace) { const namespaceUri = NAMESPACE_URIS[namespace]; if (namespaceUri) { el.removeAttributeNS(namespaceUri, name); } else { el.removeAttribute(`${namespace}:${name}`); } } else { el.removeAttribute(name); } } addClass(el, name) { el.classList.add(name); } removeClass(el, name) { el.classList.remove(name); } setStyle(el, style, value, flags) { if (flags & (RendererStyleFlags2.DashCase | RendererStyleFlags2.Important)) { el.style.setProperty(style, value, flags & RendererStyleFlags2.Important ? 'important' : ''); } else { el.style[style] = value; } } removeStyle(el, style, flags) { if (flags & RendererStyleFlags2.DashCase) { // removeProperty has no effect when used on camelCased properties. el.style.removeProperty(style); } else { el.style[style] = ''; } } setProperty(el, name, value) { (typeof ngDevMode === 'undefined' || ngDevMode) && checkNoSyntheticProp(name, 'property'); el[name] = value; } setValue(node, value) { node.nodeValue = value; } listen(target, event, callback) { (typeof ngDevMode === 'undefined' || ngDevMode) && checkNoSyntheticProp(event, 'listener'); if (typeof target === 'string') { target = getDOM().getGlobalEventTarget(this.doc, target); if (!target) { throw new Error(`Unsupported event target ${target} for event ${event}`); } } return this.eventManager.addEventListener(target, event, this.decoratePreventDefault(callback)); } decoratePreventDefault(eventHandler) { // `DebugNode.triggerEventHandler` needs to know if the listener was created with // decoratePreventDefault or is a listener added outside the Angular context so it can handle // the two differently. In the first case, the special '__ngUnwrap__' token is passed to the // unwrap the listener (see below). return (event) => { // Ivy uses '__ngUnwrap__' as a special token that allows us to unwrap the function // so that it can be invoked programmatically by `DebugNode.triggerEventHandler`. The // debug_node can inspect the listener toString contents for the existence of this special // token. Because the token is a string literal, it is ensured to not be modified by compiled // code. if (event === '__ngUnwrap__') { return eventHandler; } // Run the event handler inside the ngZone because event handlers are not patched // by Zone on the server. This is required only for tests. const allowDefaultBehavior = this.platformIsServer ? this.ngZone.runGuarded(() => eventHandler(event)) : eventHandler(event); if (allowDefaultBehavior === false) { event.preventDefault(); } return undefined; }; } } const AT_CHARCODE = (() => '@'.charCodeAt(0))(); function checkNoSyntheticProp(name, nameKind) { if (name.charCodeAt(0) === AT_CHARCODE) { throw new RuntimeError(5105 /* RuntimeErrorCode.UNEXPECTED_SYNTHETIC_PROPERTY */, `Unexpected synthetic ${nameKind} ${name} found. Please make sure that: - Either \`BrowserAnimationsModule\` or \`NoopAnimationsModule\` are imported in your application. - There is corresponding configuration for the animation named \`${name}\` defined in the \`animations\` field of the \`@Component\` decorator (see https://angular.io/api/core/Component#animations).`); } } function isTemplateNode(node) { return node.tagName === 'TEMPLATE' && node.content !== undefined; } class ShadowDomRenderer extends DefaultDomRenderer2 { constructor(eventManager, sharedStylesHost, hostEl, component, doc, ngZone, nonce, platformIsServer) { super(eventManager, doc, ngZone, platformIsServer); this.sharedStylesHost = sharedStylesHost; this.hostEl = hostEl; this.shadowRoot = hostEl.attachShadow({ mode: 'open' }); this.sharedStylesHost.addHost(this.shadowRoot); const styles = shimStylesContent(component.id, component.styles); for (const style of styles) { const styleEl = document.createElement('style'); if (nonce) { styleEl.setAttribute('nonce', nonce); } styleEl.textContent = style; this.shadowRoot.appendChild(styleEl); } } nodeOrShadowRoot(node) { return node === this.hostEl ? this.shadowRoot : node; } appendChild(parent, newChild) { return super.appendChild(this.nodeOrShadowRoot(parent), newChild); } insertBefore(parent, newChild, refChild) { return super.insertBefore(this.nodeOrShadowRoot(parent), newChild, refChild); } removeChild(parent, oldChild) { return super.removeChild(this.nodeOrShadowRoot(parent), oldChild); } parentNode(node) { return this.nodeOrShadowRoot(super.parentNode(this.nodeOrShadowRoot(node))); } destroy() { this.sharedStylesHost.removeHost(this.shadowRoot); } } class NoneEncapsulationDomRenderer extends DefaultDomRenderer2 { constructor(eventManager, sharedStylesHost, component, removeStylesOnCompDestroy, doc, ngZone, platformIsServer, compId) { super(eventManager, doc, ngZone, platformIsServer); this.sharedStylesHost = sharedStylesHost; this.removeStylesOnCompDestroy = removeStylesOnCompDestroy; this.styles = compId ? shimStylesContent(compId, component.styles) : component.styles; } applyStyles() { this.sharedStylesHost.addStyles(this.styles); } destroy() { if (!this.removeStylesOnCompDestroy) { return; } this.sharedStylesHost.removeStyles(this.styles); } } class EmulatedEncapsulationDomRenderer2 extends NoneEncapsulationDomRenderer { constructor(eventManager, sharedStylesHost, component, appId, removeStylesOnCompDestroy, doc, ngZone, platformIsServer) { const compId = appId + '-' + component.id; super(eventManager, sharedStylesHost, component, removeStylesOnCompDestroy, doc, ngZone, platformIsServer, compId); this.contentAttr = shimContentAttribute(compId); this.hostAttr = shimHostAttribute(compId); } applyToHost(element) { this.applyStyles(); this.setAttribute(element, this.hostAttr, ''); } createElement(parent, name) { const el = super.createElement(parent, name); super.setAttribute(el, this.contentAttr, ''); return el; } } //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZG9tX3JlbmRlcmVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvcGxhdGZvcm0tYnJvd3Nlci9zcmMvZG9tL2RvbV9yZW5kZXJlci50cyJdLCJuYW1lcyI6W10sIm1hcH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