diff --git a/.gitignore b/.gitignore index 09d876b..72a1948 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ www/ +dist/ loader/ *~ diff --git a/dist/cjs/index-c19ca355.js b/dist/cjs/index-c19ca355.js deleted file mode 100644 index fbc84c5..0000000 --- a/dist/cjs/index-c19ca355.js +++ /dev/null @@ -1,968 +0,0 @@ -'use strict'; - -function _interopNamespace(e) { - if (e && e.__esModule) return e; - var n = Object.create(null); - if (e) { - Object.keys(e).forEach(function (k) { - if (k !== 'default') { - var d = Object.getOwnPropertyDescriptor(e, k); - Object.defineProperty(n, k, d.get ? d : { - enumerable: true, - get: function () { - return e[k]; - } - }); - } - }); - } - n['default'] = e; - return Object.freeze(n); -} - -const NAMESPACE = 'pdfplayer-stencil'; - -let scopeId; -let hostTagName; -let queuePending = false; -const win = typeof window !== 'undefined' ? window : {}; -const doc = win.document || { head: {} }; -const plt = { - $flags$: 0, - $resourcesUrl$: '', - jmp: (h) => h(), - raf: (h) => requestAnimationFrame(h), - ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts), - rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts), - ce: (eventName, opts) => new CustomEvent(eventName, opts), -}; -const promiseResolve = (v) => Promise.resolve(v); -const supportsConstructableStylesheets = /*@__PURE__*/ (() => { - try { - new CSSStyleSheet(); - return typeof new CSSStyleSheet().replaceSync === 'function'; - } - catch (e) { } - return false; - })() - ; -const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}'; -const createTime = (fnName, tagName = '') => { - { - return () => { - return; - }; - } -}; -const uniqueTime = (key, measureText) => { - { - return () => { - return; - }; - } -}; -const rootAppliedStyles = new WeakMap(); -const registerStyle = (scopeId, cssText, allowCS) => { - let style = styles.get(scopeId); - if (supportsConstructableStylesheets && allowCS) { - style = (style || new CSSStyleSheet()); - if (typeof style === 'string') { - style = cssText; - } - else { - style.replaceSync(cssText); - } - } - else { - style = cssText; - } - styles.set(scopeId, style); -}; -const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => { - let scopeId = getScopeId(cmpMeta); - const style = styles.get(scopeId); - // if an element is NOT connected then getRootNode() will return the wrong root node - // so the fallback is to always use the document for the root node in those cases - styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc; - if (style) { - if (typeof style === 'string') { - styleContainerNode = styleContainerNode.head || styleContainerNode; - let appliedStyles = rootAppliedStyles.get(styleContainerNode); - let styleElm; - if (!appliedStyles) { - rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set())); - } - if (!appliedStyles.has(scopeId)) { - { - { - styleElm = doc.createElement('style'); - styleElm.innerHTML = style; - } - styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link')); - } - if (appliedStyles) { - appliedStyles.add(scopeId); - } - } - } - else if (!styleContainerNode.adoptedStyleSheets.includes(style)) { - styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style]; - } - } - return scopeId; -}; -const attachStyles = (hostRef) => { - const cmpMeta = hostRef.$cmpMeta$; - const elm = hostRef.$hostElement$; - const flags = cmpMeta.$flags$; - const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$); - const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta); - if (flags & 10 /* needsScopedEncapsulation */) { - // only required when we're NOT using native shadow dom (slot) - // or this browser doesn't support native shadow dom - // and this host element was NOT created with SSR - // let's pick out the inner content for slot projection - // create a node to represent where the original - // content was first placed, which is useful later on - // DOM WRITE!! - elm['s-sc'] = scopeId; - elm.classList.add(scopeId + '-h'); - } - endAttachStyles(); -}; -const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$); -const isDef = (v) => v != null; -const isComplexType = (o) => { - // https://jsperf.com/typeof-fn-object/5 - o = typeof o; - return o === 'object' || o === 'function'; -}; -/** - * Production h() function based on Preact by - * Jason Miller (@developit) - * Licensed under the MIT License - * https://github.com/developit/preact/blob/master/LICENSE - * - * Modified for Stencil's compiler and vdom - */ -// const stack: any[] = []; -// export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode; -// export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode; -const h = (nodeName, vnodeData, ...children) => { - let child = null; - let simple = false; - let lastSimple = false; - const vNodeChildren = []; - const walk = (c) => { - for (let i = 0; i < c.length; i++) { - child = c[i]; - if (Array.isArray(child)) { - walk(child); - } - else if (child != null && typeof child !== 'boolean') { - if ((simple = typeof nodeName !== 'function' && !isComplexType(child))) { - child = String(child); - } - if (simple && lastSimple) { - // If the previous child was simple (string), we merge both - vNodeChildren[vNodeChildren.length - 1].$text$ += child; - } - else { - // Append a new vNode, if it's text, we create a text vNode - vNodeChildren.push(simple ? newVNode(null, child) : child); - } - lastSimple = simple; - } - } - }; - walk(children); - const vnode = newVNode(nodeName, null); - vnode.$attrs$ = vnodeData; - if (vNodeChildren.length > 0) { - vnode.$children$ = vNodeChildren; - } - return vnode; -}; -const newVNode = (tag, text) => { - const vnode = { - $flags$: 0, - $tag$: tag, - $text$: text, - $elm$: null, - $children$: null, - }; - return vnode; -}; -const Host = {}; -const isHost = (node) => node && node.$tag$ === Host; -const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => { - // tslint:disable-next-line: prefer-const - const newVNode = newParentVNode.$children$[childIndex]; - let i = 0; - let elm; - let childNode; - if (newVNode.$text$ !== null) { - // create text node - elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$); - } - else { - // create element - elm = newVNode.$elm$ = (doc.createElement(newVNode.$tag$)); - if (isDef(scopeId) && elm['s-si'] !== scopeId) { - // if there is a scopeId and this is the initial render - // then let's add the scopeId as a css class - elm.classList.add((elm['s-si'] = scopeId)); - } - if (newVNode.$children$) { - for (i = 0; i < newVNode.$children$.length; ++i) { - // create the node - childNode = createElm(oldParentVNode, newVNode, i); - // return node could have been null - if (childNode) { - // append our new node - elm.appendChild(childNode); - } - } - } - } - return elm; -}; -const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => { - let containerElm = (parentElm); - let childNode; - if (containerElm.shadowRoot && containerElm.tagName === hostTagName) { - containerElm = containerElm.shadowRoot; - } - for (; startIdx <= endIdx; ++startIdx) { - if (vnodes[startIdx]) { - childNode = createElm(null, parentVNode, startIdx); - if (childNode) { - vnodes[startIdx].$elm$ = childNode; - containerElm.insertBefore(childNode, before); - } - } - } -}; -const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => { - for (; startIdx <= endIdx; ++startIdx) { - if ((vnode = vnodes[startIdx])) { - elm = vnode.$elm$; - // remove the vnode's element from the dom - elm.remove(); - } - } -}; -const updateChildren = (parentElm, oldCh, newVNode, newCh) => { - let oldStartIdx = 0; - let newStartIdx = 0; - let oldEndIdx = oldCh.length - 1; - let oldStartVnode = oldCh[0]; - let oldEndVnode = oldCh[oldEndIdx]; - let newEndIdx = newCh.length - 1; - let newStartVnode = newCh[0]; - let newEndVnode = newCh[newEndIdx]; - let node; - while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) { - if (oldStartVnode == null) { - // Vnode might have been moved left - oldStartVnode = oldCh[++oldStartIdx]; - } - else if (oldEndVnode == null) { - oldEndVnode = oldCh[--oldEndIdx]; - } - else if (newStartVnode == null) { - newStartVnode = newCh[++newStartIdx]; - } - else if (newEndVnode == null) { - newEndVnode = newCh[--newEndIdx]; - } - else if (isSameVnode(oldStartVnode, newStartVnode)) { - patch(oldStartVnode, newStartVnode); - oldStartVnode = oldCh[++oldStartIdx]; - newStartVnode = newCh[++newStartIdx]; - } - else if (isSameVnode(oldEndVnode, newEndVnode)) { - patch(oldEndVnode, newEndVnode); - oldEndVnode = oldCh[--oldEndIdx]; - newEndVnode = newCh[--newEndIdx]; - } - else if (isSameVnode(oldStartVnode, newEndVnode)) { - patch(oldStartVnode, newEndVnode); - parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling); - oldStartVnode = oldCh[++oldStartIdx]; - newEndVnode = newCh[--newEndIdx]; - } - else if (isSameVnode(oldEndVnode, newStartVnode)) { - patch(oldEndVnode, newStartVnode); - parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$); - oldEndVnode = oldCh[--oldEndIdx]; - newStartVnode = newCh[++newStartIdx]; - } - else { - { - // new element - node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx); - newStartVnode = newCh[++newStartIdx]; - } - if (node) { - { - oldStartVnode.$elm$.parentNode.insertBefore(node, oldStartVnode.$elm$); - } - } - } - } - if (oldStartIdx > oldEndIdx) { - addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx); - } - else if (newStartIdx > newEndIdx) { - removeVnodes(oldCh, oldStartIdx, oldEndIdx); - } -}; -const isSameVnode = (vnode1, vnode2) => { - // compare if two vnode to see if they're "technically" the same - // need to have the same element tag, and same key to be the same - if (vnode1.$tag$ === vnode2.$tag$) { - return true; - } - return false; -}; -const patch = (oldVNode, newVNode) => { - const elm = (newVNode.$elm$ = oldVNode.$elm$); - const oldChildren = oldVNode.$children$; - const newChildren = newVNode.$children$; - const text = newVNode.$text$; - if (text === null) { - if (oldChildren !== null && newChildren !== null) { - // looks like there's child vnodes for both the old and new vnodes - updateChildren(elm, oldChildren, newVNode, newChildren); - } - else if (newChildren !== null) { - // no old child vnodes, but there are new child vnodes to add - if (oldVNode.$text$ !== null) { - // the old vnode was text, so be sure to clear it out - elm.textContent = ''; - } - // add the new vnode children - addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1); - } - else if (oldChildren !== null) { - // no new child vnodes, but there are old child vnodes to remove - removeVnodes(oldChildren, 0, oldChildren.length - 1); - } - } - else if (oldVNode.$text$ !== text) { - // update the text content for the text only vnode - // and also only if the text is different than before - elm.data = text; - } -}; -const renderVdom = (hostRef, renderFnResults) => { - const hostElm = hostRef.$hostElement$; - const oldVNode = hostRef.$vnode$ || newVNode(null, null); - const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults); - hostTagName = hostElm.tagName; - rootVnode.$tag$ = null; - rootVnode.$flags$ |= 4 /* isHost */; - hostRef.$vnode$ = rootVnode; - rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm ); - { - scopeId = hostElm['s-sc']; - } - // synchronous patch - patch(oldVNode, rootVnode); -}; -/** - * Helper function to create & dispatch a custom Event on a provided target - * @param elm the target of the Event - * @param name the name to give the custom Event - * @param opts options for configuring a custom Event - * @returns the custom Event - */ -const emitEvent = (elm, name, opts) => { - const ev = plt.ce(name, opts); - elm.dispatchEvent(ev); - return ev; -}; -const attachToAncestor = (hostRef, ancestorComponent) => { - if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) { - ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r))); - } -}; -const scheduleUpdate = (hostRef, isInitialLoad) => { - { - hostRef.$flags$ |= 16 /* isQueuedForUpdate */; - } - if (hostRef.$flags$ & 4 /* isWaitingForChildren */) { - hostRef.$flags$ |= 512 /* needsRerender */; - return; - } - attachToAncestor(hostRef, hostRef.$ancestorComponent$); - // there is no ancestor component or the ancestor component - // has already fired off its lifecycle update then - // fire off the initial update - const dispatch = () => dispatchHooks(hostRef, isInitialLoad); - return writeTask(dispatch) ; -}; -const dispatchHooks = (hostRef, isInitialLoad) => { - const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$); - const instance = hostRef.$lazyInstance$ ; - let promise; - endSchedule(); - return then(promise, () => updateComponent(hostRef, instance, isInitialLoad)); -}; -const updateComponent = async (hostRef, instance, isInitialLoad) => { - // updateComponent - const elm = hostRef.$hostElement$; - const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$); - const rc = elm['s-rc']; - if (isInitialLoad) { - // DOM WRITE! - attachStyles(hostRef); - } - const endRender = createTime('render', hostRef.$cmpMeta$.$tagName$); - { - callRender(hostRef, instance); - } - if (rc) { - // ok, so turns out there are some child host elements - // waiting on this parent element to load - // let's fire off all update callbacks waiting - rc.map((cb) => cb()); - elm['s-rc'] = undefined; - } - endRender(); - endUpdate(); - { - const childrenPromises = elm['s-p']; - const postUpdate = () => postUpdateComponent(hostRef); - if (childrenPromises.length === 0) { - postUpdate(); - } - else { - Promise.all(childrenPromises).then(postUpdate); - hostRef.$flags$ |= 4 /* isWaitingForChildren */; - childrenPromises.length = 0; - } - } -}; -const callRender = (hostRef, instance, elm) => { - try { - instance = instance.render() ; - { - hostRef.$flags$ &= ~16 /* isQueuedForUpdate */; - } - { - hostRef.$flags$ |= 2 /* hasRendered */; - } - { - { - // looks like we've got child nodes to render into this host element - // or we need to update the css class/attrs on the host element - // DOM WRITE! - { - renderVdom(hostRef, instance); - } - } - } - } - catch (e) { - consoleError(e, hostRef.$hostElement$); - } - return null; -}; -const postUpdateComponent = (hostRef) => { - const tagName = hostRef.$cmpMeta$.$tagName$; - const elm = hostRef.$hostElement$; - const endPostUpdate = createTime('postUpdate', tagName); - const ancestorComponent = hostRef.$ancestorComponent$; - if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) { - hostRef.$flags$ |= 64 /* hasLoadedComponent */; - { - // DOM WRITE! - addHydratedFlag(elm); - } - endPostUpdate(); - { - hostRef.$onReadyResolve$(elm); - if (!ancestorComponent) { - appDidLoad(); - } - } - } - else { - endPostUpdate(); - } - // load events fire from bottom to top - // the deepest elements load first then bubbles up - { - if (hostRef.$onRenderResolve$) { - hostRef.$onRenderResolve$(); - hostRef.$onRenderResolve$ = undefined; - } - if (hostRef.$flags$ & 512 /* needsRerender */) { - nextTick(() => scheduleUpdate(hostRef, false)); - } - hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */); - } - // ( •_•) - // ( •_•)>⌐■-■ - // (⌐■_■) -}; -const appDidLoad = (who) => { - // on appload - // we have finish the first big initial render - { - addHydratedFlag(doc.documentElement); - } - nextTick(() => emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } })); -}; -const then = (promise, thenFn) => { - return promise && promise.then ? promise.then(thenFn) : thenFn(); -}; -const addHydratedFlag = (elm) => elm.classList.add('hydrated') - ; -/** - * Parse a new property value for a given property type. - * - * While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned, - * it is not safe to assume that the string returned by evaluating `typeof propValue` matches: - * 1. `any`, the type given to `propValue` in the function signature - * 2. the type stored from `propType`. - * - * This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type. - * - * Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to - * a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is - * based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`. - * ```tsx - * - * ``` - * - * HTML prop values on the other hand, will always a string - * - * @param propValue the new value to coerce to some type - * @param propType the type of the prop, expressed as a binary number - * @returns the parsed/coerced value - */ -const parsePropertyValue = (propValue, propType) => { - // ensure this value is of the correct prop type - if (propValue != null && !isComplexType(propValue)) { - if (propType & 1 /* String */) { - // could have been passed as a number or boolean - // but we still want it as a string - return String(propValue); - } - // redundant return here for better minification - return propValue; - } - // not sure exactly what type we want - // so no need to change to a different type - return propValue; -}; -const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName); -const setValue = (ref, propName, newVal, cmpMeta) => { - // check our new property value against our internal value - const hostRef = getHostRef(ref); - const oldVal = hostRef.$instanceValues$.get(propName); - const flags = hostRef.$flags$; - const instance = hostRef.$lazyInstance$ ; - newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]); - // explicitly check for NaN on both sides, as `NaN === NaN` is always false - const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal); - const didValueChange = newVal !== oldVal && !areBothNaN; - if ((!(flags & 8 /* isConstructingInstance */) || oldVal === undefined) && didValueChange) { - // gadzooks! the property's value has changed!! - // set our new value! - hostRef.$instanceValues$.set(propName, newVal); - if (instance) { - if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) { - // looks like this value actually changed, so we've got work to do! - // but only if we've already rendered, otherwise just chill out - // queue that we need to do an update, but don't worry about queuing - // up millions cuz this function ensures it only runs once - scheduleUpdate(hostRef, false); - } - } - } -}; -const proxyComponent = (Cstr, cmpMeta, flags) => { - if (cmpMeta.$members$) { - // It's better to have a const than two Object.entries() - const members = Object.entries(cmpMeta.$members$); - const prototype = Cstr.prototype; - members.map(([memberName, [memberFlags]]) => { - if ((memberFlags & 31 /* Prop */ || - ((flags & 2 /* proxyState */) && memberFlags & 32 /* State */))) { - // proxyComponent - prop - Object.defineProperty(prototype, memberName, { - get() { - // proxyComponent, get value - return getValue(this, memberName); - }, - set(newValue) { - // proxyComponent, set value - setValue(this, memberName, newValue, cmpMeta); - }, - configurable: true, - enumerable: true, - }); - } - }); - if ((flags & 1 /* isElementConstructor */)) { - const attrNameToPropName = new Map(); - prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) { - plt.jmp(() => { - const propName = attrNameToPropName.get(attrName); - // In a web component lifecycle the attributeChangedCallback runs prior to connectedCallback - // in the case where an attribute was set inline. - // ```html - // - // ``` - // - // There is an edge case where a developer sets the attribute inline on a custom element and then - // programmatically changes it before it has been upgraded as shown below: - // - // ```html - // - // - // - // ``` - // In this case if we do not unshadow here and use the value of the shadowing property, attributeChangedCallback - // will be called with `newValue = "some-value"` and will set the shadowed property (this.someAttribute = "another-value") - // to the value that was set inline i.e. "some-value" from above example. When - // the connectedCallback attempts to unshadow it will use "some-value" as the initial value rather than "another-value" - // - // The case where the attribute was NOT set inline but was not set programmatically shall be handled/unshadowed - // by connectedCallback as this attributeChangedCallback will not fire. - // - // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties - // - // TODO(STENCIL-16) we should think about whether or not we actually want to be reflecting the attributes to - // properties here given that this goes against best practices outlined here - // https://developers.google.com/web/fundamentals/web-components/best-practices#avoid-reentrancy - if (this.hasOwnProperty(propName)) { - newValue = this[propName]; - delete this[propName]; - } - else if (prototype.hasOwnProperty(propName) && - typeof this[propName] === 'number' && - this[propName] == newValue) { - // if the propName exists on the prototype of `Cstr`, this update may be a result of Stencil using native - // APIs to reflect props as attributes. Calls to `setAttribute(someElement, propName)` will result in - // `propName` to be converted to a `DOMString`, which may not be what we want for other primitive props. - return; - } - this[propName] = newValue === null && typeof this[propName] === 'boolean' ? false : newValue; - }); - }; - // create an array of attributes to observe - // and also create a map of html attribute name to js property name - Cstr.observedAttributes = members - .filter(([_, m]) => m[0] & 15 /* HasAttribute */) // filter to only keep props that should match attributes - .map(([propName, m]) => { - const attrName = m[1] || propName; - attrNameToPropName.set(attrName, propName); - return attrName; - }); - } - } - return Cstr; -}; -const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => { - // initializeComponent - if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) { - { - // we haven't initialized this element yet - hostRef.$flags$ |= 32 /* hasInitializedComponent */; - // lazy loaded components - // request the component's implementation to be - // wired up with the host element - Cstr = loadModule(cmpMeta); - if (Cstr.then) { - // Await creates a micro-task avoid if possible - const endLoad = uniqueTime(); - Cstr = await Cstr; - endLoad(); - } - if (!Cstr.isProxied) { - proxyComponent(Cstr, cmpMeta, 2 /* proxyState */); - Cstr.isProxied = true; - } - const endNewInstance = createTime('createInstance', cmpMeta.$tagName$); - // ok, time to construct the instance - // but let's keep track of when we start and stop - // so that the getters/setters don't incorrectly step on data - { - hostRef.$flags$ |= 8 /* isConstructingInstance */; - } - // construct the lazy-loaded component implementation - // passing the hostRef is very important during - // construction in order to directly wire together the - // host element and the lazy-loaded instance - try { - new Cstr(hostRef); - } - catch (e) { - consoleError(e); - } - { - hostRef.$flags$ &= ~8 /* isConstructingInstance */; - } - endNewInstance(); - } - if (Cstr.style) { - // this component has styles but we haven't registered them yet - let style = Cstr.style; - const scopeId = getScopeId(cmpMeta); - if (!styles.has(scopeId)) { - const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$); - registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)); - endRegisterStyles(); - } - } - } - // we've successfully created a lazy instance - const ancestorComponent = hostRef.$ancestorComponent$; - const schedule = () => scheduleUpdate(hostRef, true); - if (ancestorComponent && ancestorComponent['s-rc']) { - // this is the initial load and this component it has an ancestor component - // but the ancestor component has NOT fired its will update lifecycle yet - // so let's just cool our jets and wait for the ancestor to continue first - // this will get fired off when the ancestor component - // finally gets around to rendering its lazy self - // fire off the initial update - ancestorComponent['s-rc'].push(schedule); - } - else { - schedule(); - } -}; -const connectedCallback = (elm) => { - if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) { - const hostRef = getHostRef(elm); - const cmpMeta = hostRef.$cmpMeta$; - const endConnected = createTime('connectedCallback', cmpMeta.$tagName$); - if (!(hostRef.$flags$ & 1 /* hasConnected */)) { - // first time this component has connected - hostRef.$flags$ |= 1 /* hasConnected */; - { - // find the first ancestor component (if there is one) and register - // this component as one of the actively loading child components for its ancestor - let ancestorComponent = elm; - while ((ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)) { - // climb up the ancestors looking for the first - // component that hasn't finished its lifecycle update yet - if (ancestorComponent['s-p']) { - // we found this components first ancestor component - // keep a reference to this component's ancestor component - attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent)); - break; - } - } - } - // Lazy properties - // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties - if (cmpMeta.$members$) { - Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => { - if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) { - const value = elm[memberName]; - delete elm[memberName]; - elm[memberName] = value; - } - }); - } - { - initializeComponent(elm, hostRef, cmpMeta); - } - } - endConnected(); - } -}; -const disconnectedCallback = (elm) => { - if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) { - getHostRef(elm); - } -}; -const bootstrapLazy = (lazyBundles, options = {}) => { - const endBootstrap = createTime(); - const cmpTags = []; - const exclude = options.exclude || []; - const customElements = win.customElements; - const head = doc.head; - const metaCharset = /*@__PURE__*/ head.querySelector('meta[charset]'); - const visibilityStyle = /*@__PURE__*/ doc.createElement('style'); - const deferredConnectedCallbacks = []; - let appLoadFallback; - let isBootstrapping = true; - Object.assign(plt, options); - plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href; - lazyBundles.map((lazyBundle) => { - lazyBundle[1].map((compactMeta) => { - const cmpMeta = { - $flags$: compactMeta[0], - $tagName$: compactMeta[1], - $members$: compactMeta[2], - $listeners$: compactMeta[3], - }; - { - cmpMeta.$members$ = compactMeta[2]; - } - const tagName = cmpMeta.$tagName$; - const HostElement = class extends HTMLElement { - // StencilLazyHost - constructor(self) { - // @ts-ignore - super(self); - self = this; - registerHost(self, cmpMeta); - if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) { - // this component is using shadow dom - // and this browser supports shadow dom - // add the read-only property "shadowRoot" to the host element - // adding the shadow root build conditionals to minimize runtime - { - { - self.attachShadow({ mode: 'open' }); - } - } - } - } - connectedCallback() { - if (appLoadFallback) { - clearTimeout(appLoadFallback); - appLoadFallback = null; - } - if (isBootstrapping) { - // connectedCallback will be processed once all components have been registered - deferredConnectedCallbacks.push(this); - } - else { - plt.jmp(() => connectedCallback(this)); - } - } - disconnectedCallback() { - plt.jmp(() => disconnectedCallback(this)); - } - componentOnReady() { - return getHostRef(this).$onReadyPromise$; - } - }; - cmpMeta.$lazyBundleId$ = lazyBundle[0]; - if (!exclude.includes(tagName) && !customElements.get(tagName)) { - cmpTags.push(tagName); - customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */)); - } - }); - }); - { - visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS; - visibilityStyle.setAttribute('data-styles', ''); - head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild); - } - // Process deferred connectedCallbacks now all components have been registered - isBootstrapping = false; - if (deferredConnectedCallbacks.length) { - deferredConnectedCallbacks.map((host) => host.connectedCallback()); - } - else { - { - plt.jmp(() => (appLoadFallback = setTimeout(appDidLoad, 30))); - } - } - // Fallback appLoad event - endBootstrap(); -}; -const hostRefs = new WeakMap(); -const getHostRef = (ref) => hostRefs.get(ref); -const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef); -const registerHost = (elm, cmpMeta) => { - const hostRef = { - $flags$: 0, - $hostElement$: elm, - $cmpMeta$: cmpMeta, - $instanceValues$: new Map(), - }; - { - hostRef.$onReadyPromise$ = new Promise((r) => (hostRef.$onReadyResolve$ = r)); - elm['s-p'] = []; - elm['s-rc'] = []; - } - return hostRefs.set(elm, hostRef); -}; -const consoleError = (e, el) => (0, console.error)(e, el); -const cmpModules = /*@__PURE__*/ new Map(); -const loadModule = (cmpMeta, hostRef, hmrVersionId) => { - // loadModuleImport - const exportName = cmpMeta.$tagName$.replace(/-/g, '_'); - const bundleId = cmpMeta.$lazyBundleId$; - const module = cmpModules.get(bundleId) ; - if (module) { - return module[exportName]; - } - /*!__STENCIL_STATIC_IMPORT_SWITCH__*/ - return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require( - /* @vite-ignore */ - /* webpackInclude: /\.entry\.js$/ */ - /* webpackExclude: /\.system\.entry\.js$/ */ - /* webpackMode: "lazy" */ - `./${bundleId}.entry.js${''}`)); }).then((importedModule) => { - { - cmpModules.set(bundleId, importedModule); - } - return importedModule[exportName]; - }, consoleError); -}; -const styles = new Map(); -const queueDomReads = []; -const queueDomWrites = []; -const queueTask = (queue, write) => (cb) => { - queue.push(cb); - if (!queuePending) { - queuePending = true; - if (write && plt.$flags$ & 4 /* queueSync */) { - nextTick(flush); - } - else { - plt.raf(flush); - } - } -}; -const consume = (queue) => { - for (let i = 0; i < queue.length; i++) { - try { - queue[i](performance.now()); - } - catch (e) { - consoleError(e); - } - } - queue.length = 0; -}; -const flush = () => { - // always force a bunch of medium callbacks to run, but still have - // a throttle on how many can run in a certain time - // DOM READS!!! - consume(queueDomReads); - // DOM WRITES!!! - { - consume(queueDomWrites); - if ((queuePending = queueDomReads.length > 0)) { - // still more to do yet, but we've run out of time - // let's let this thing cool off and try again in the next tick - plt.raf(flush); - } - } -}; -const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb); -const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true); - -exports.bootstrapLazy = bootstrapLazy; -exports.h = h; -exports.promiseResolve = promiseResolve; -exports.registerInstance = registerInstance; diff --git a/dist/cjs/index.cjs.js b/dist/cjs/index.cjs.js deleted file mode 100644 index eb109ab..0000000 --- a/dist/cjs/index.cjs.js +++ /dev/null @@ -1,2 +0,0 @@ -'use strict'; - diff --git a/dist/cjs/loader.cjs.js b/dist/cjs/loader.cjs.js deleted file mode 100644 index 787f2b5..0000000 --- a/dist/cjs/loader.cjs.js +++ /dev/null @@ -1,21 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -const index = require('./index-c19ca355.js'); - -/* - Stencil Client Patch Esm v2.17.4 | MIT Licensed | https://stenciljs.com - */ -const patchEsm = () => { - return index.promiseResolve(); -}; - -const defineCustomElements = (win, options) => { - if (typeof window === 'undefined') return Promise.resolve(); - return patchEsm().then(() => { - return index.bootstrapLazy([["my-component.cjs",[[1,"my-component",{"first":[1],"middle":[1],"last":[1]}]]]], options); - }); -}; - -exports.defineCustomElements = defineCustomElements; diff --git a/dist/cjs/my-component.cjs.entry.js b/dist/cjs/my-component.cjs.entry.js deleted file mode 100644 index fcbdc04..0000000 --- a/dist/cjs/my-component.cjs.entry.js +++ /dev/null @@ -1,26 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -const index = require('./index-c19ca355.js'); - -function format(first, middle, last) { - return (first || '') + (middle ? ` ${middle}` : '') + (last ? ` ${last}` : ''); -} - -const myComponentCss = ":host{display:block}"; - -const MyComponent = class { - constructor(hostRef) { - index.registerInstance(this, hostRef); - } - getText() { - return format(this.first, this.middle, this.last); - } - render() { - return index.h("div", null, "Hello, World! I'm ", this.getText()); - } -}; -MyComponent.style = myComponentCss; - -exports.my_component = MyComponent; diff --git a/dist/cjs/pdfplayer-stencil.cjs.js b/dist/cjs/pdfplayer-stencil.cjs.js deleted file mode 100644 index 275b22b..0000000 --- a/dist/cjs/pdfplayer-stencil.cjs.js +++ /dev/null @@ -1,19 +0,0 @@ -'use strict'; - -const index = require('./index-c19ca355.js'); - -/* - Stencil Client Patch Browser v2.17.4 | MIT Licensed | https://stenciljs.com - */ -const patchBrowser = () => { - const importMeta = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('pdfplayer-stencil.cjs.js', document.baseURI).href)); - const opts = {}; - if (importMeta !== '') { - opts.resourcesUrl = new URL('.', importMeta).href; - } - return index.promiseResolve(opts); -}; - -patchBrowser().then(options => { - return index.bootstrapLazy([["my-component.cjs",[[1,"my-component",{"first":[1],"middle":[1],"last":[1]}]]]], options); -}); diff --git a/dist/collection/collection-manifest.json b/dist/collection/collection-manifest.json deleted file mode 100644 index 4fbaea6..0000000 --- a/dist/collection/collection-manifest.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "entries": [ - "./components/my-component/my-component.js" - ], - "compiler": { - "name": "@stencil/core", - "version": "2.17.4", - "typescriptVersion": "4.5.4" - }, - "collections": [], - "bundles": [] -} \ No newline at end of file diff --git a/dist/collection/components/my-component/my-component.js b/dist/collection/components/my-component/my-component.js deleted file mode 100644 index e75e7e3..0000000 --- a/dist/collection/components/my-component/my-component.js +++ /dev/null @@ -1,73 +0,0 @@ -import { Component, Prop, h } from '@stencil/core'; -import { format } from '../../utils/utils'; -export class MyComponent { - getText() { - return format(this.first, this.middle, this.last); - } - render() { - return h("div", null, - "Hello, World! I'm ", - this.getText()); - } - static get is() { return "my-component"; } - static get encapsulation() { return "shadow"; } - static get originalStyleUrls() { return { - "$": ["my-component.css"] - }; } - static get styleUrls() { return { - "$": ["my-component.css"] - }; } - static get properties() { return { - "first": { - "type": "string", - "mutable": false, - "complexType": { - "original": "string", - "resolved": "string", - "references": {} - }, - "required": false, - "optional": false, - "docs": { - "tags": [], - "text": "The first name" - }, - "attribute": "first", - "reflect": false - }, - "middle": { - "type": "string", - "mutable": false, - "complexType": { - "original": "string", - "resolved": "string", - "references": {} - }, - "required": false, - "optional": false, - "docs": { - "tags": [], - "text": "The middle name" - }, - "attribute": "middle", - "reflect": false - }, - "last": { - "type": "string", - "mutable": false, - "complexType": { - "original": "string", - "resolved": "string", - "references": {} - }, - "required": false, - "optional": false, - "docs": { - "tags": [], - "text": "The last name" - }, - "attribute": "last", - "reflect": false - } - }; } -} diff --git a/dist/collection/index.js b/dist/collection/index.js deleted file mode 100644 index cb0ff5c..0000000 --- a/dist/collection/index.js +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/dist/collection/utils/utils.js b/dist/collection/utils/utils.js deleted file mode 100644 index eb02d91..0000000 --- a/dist/collection/utils/utils.js +++ /dev/null @@ -1,3 +0,0 @@ -export function format(first, middle, last) { - return (first || '') + (middle ? ` ${middle}` : '') + (last ? ` ${last}` : ''); -} diff --git a/dist/components/index.d.ts b/dist/components/index.d.ts index f704ac9..e31203e 100644 --- a/dist/components/index.d.ts +++ b/dist/components/index.d.ts @@ -1,5 +1,5 @@ /* PdfplayerStencil custom elements */ -export { MyComponent as MyComponent } from '../types/components/my-component/my-component'; +export { TalisPdfViewer as TalisPdfViewer } from '../types/components/talis-pdf-viewer/talis-pdf-viewer'; /** * Used to manually set the base path where assets can be found. diff --git a/dist/components/index.js b/dist/components/index.js deleted file mode 100644 index dafd0c3..0000000 --- a/dist/components/index.js +++ /dev/null @@ -1,2 +0,0 @@ -export { setAssetPath, setPlatformOptions } from '@stencil/core/internal/client'; -export { MyComponent, defineCustomElement as defineCustomElementMyComponent } from './my-component.js'; diff --git a/dist/components/my-component.d.ts b/dist/components/my-component.d.ts deleted file mode 100644 index 7055b91..0000000 --- a/dist/components/my-component.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import type { Components, JSX } from "../types/components"; - -interface MyComponent extends Components.MyComponent, HTMLElement {} -export const MyComponent: { - prototype: MyComponent; - new (): MyComponent; -}; -/** - * Used to define this component and all nested components recursively. - */ -export const defineCustomElement: () => void; diff --git a/dist/components/my-component.js b/dist/components/my-component.js deleted file mode 100644 index 1ad51b3..0000000 --- a/dist/components/my-component.js +++ /dev/null @@ -1,44 +0,0 @@ -import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client'; - -function format(first, middle, last) { - return (first || '') + (middle ? ` ${middle}` : '') + (last ? ` ${last}` : ''); -} - -const myComponentCss = ":host{display:block}"; - -const MyComponent$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement { - constructor() { - super(); - this.__registerHost(); - this.__attachShadow(); - } - getText() { - return format(this.first, this.middle, this.last); - } - render() { - return h("div", null, "Hello, World! I'm ", this.getText()); - } - static get style() { return myComponentCss; } -}, [1, "my-component", { - "first": [1], - "middle": [1], - "last": [1] - }]); -function defineCustomElement$1() { - if (typeof customElements === "undefined") { - return; - } - const components = ["my-component"]; - components.forEach(tagName => { switch (tagName) { - case "my-component": - if (!customElements.get(tagName)) { - customElements.define(tagName, MyComponent$1); - } - break; - } }); -} - -const MyComponent = MyComponent$1; -const defineCustomElement = defineCustomElement$1; - -export { MyComponent, defineCustomElement }; diff --git a/dist/esm/index-ec8392ca.js b/dist/esm/index-ec8392ca.js deleted file mode 100644 index 7f92fdd..0000000 --- a/dist/esm/index-ec8392ca.js +++ /dev/null @@ -1,943 +0,0 @@ -const NAMESPACE = 'pdfplayer-stencil'; - -let scopeId; -let hostTagName; -let queuePending = false; -const win = typeof window !== 'undefined' ? window : {}; -const doc = win.document || { head: {} }; -const plt = { - $flags$: 0, - $resourcesUrl$: '', - jmp: (h) => h(), - raf: (h) => requestAnimationFrame(h), - ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts), - rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts), - ce: (eventName, opts) => new CustomEvent(eventName, opts), -}; -const promiseResolve = (v) => Promise.resolve(v); -const supportsConstructableStylesheets = /*@__PURE__*/ (() => { - try { - new CSSStyleSheet(); - return typeof new CSSStyleSheet().replaceSync === 'function'; - } - catch (e) { } - return false; - })() - ; -const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}'; -const createTime = (fnName, tagName = '') => { - { - return () => { - return; - }; - } -}; -const uniqueTime = (key, measureText) => { - { - return () => { - return; - }; - } -}; -const rootAppliedStyles = new WeakMap(); -const registerStyle = (scopeId, cssText, allowCS) => { - let style = styles.get(scopeId); - if (supportsConstructableStylesheets && allowCS) { - style = (style || new CSSStyleSheet()); - if (typeof style === 'string') { - style = cssText; - } - else { - style.replaceSync(cssText); - } - } - else { - style = cssText; - } - styles.set(scopeId, style); -}; -const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => { - let scopeId = getScopeId(cmpMeta); - const style = styles.get(scopeId); - // if an element is NOT connected then getRootNode() will return the wrong root node - // so the fallback is to always use the document for the root node in those cases - styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc; - if (style) { - if (typeof style === 'string') { - styleContainerNode = styleContainerNode.head || styleContainerNode; - let appliedStyles = rootAppliedStyles.get(styleContainerNode); - let styleElm; - if (!appliedStyles) { - rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set())); - } - if (!appliedStyles.has(scopeId)) { - { - { - styleElm = doc.createElement('style'); - styleElm.innerHTML = style; - } - styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link')); - } - if (appliedStyles) { - appliedStyles.add(scopeId); - } - } - } - else if (!styleContainerNode.adoptedStyleSheets.includes(style)) { - styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style]; - } - } - return scopeId; -}; -const attachStyles = (hostRef) => { - const cmpMeta = hostRef.$cmpMeta$; - const elm = hostRef.$hostElement$; - const flags = cmpMeta.$flags$; - const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$); - const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta); - if (flags & 10 /* needsScopedEncapsulation */) { - // only required when we're NOT using native shadow dom (slot) - // or this browser doesn't support native shadow dom - // and this host element was NOT created with SSR - // let's pick out the inner content for slot projection - // create a node to represent where the original - // content was first placed, which is useful later on - // DOM WRITE!! - elm['s-sc'] = scopeId; - elm.classList.add(scopeId + '-h'); - } - endAttachStyles(); -}; -const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$); -const isDef = (v) => v != null; -const isComplexType = (o) => { - // https://jsperf.com/typeof-fn-object/5 - o = typeof o; - return o === 'object' || o === 'function'; -}; -/** - * Production h() function based on Preact by - * Jason Miller (@developit) - * Licensed under the MIT License - * https://github.com/developit/preact/blob/master/LICENSE - * - * Modified for Stencil's compiler and vdom - */ -// const stack: any[] = []; -// export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode; -// export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode; -const h = (nodeName, vnodeData, ...children) => { - let child = null; - let simple = false; - let lastSimple = false; - const vNodeChildren = []; - const walk = (c) => { - for (let i = 0; i < c.length; i++) { - child = c[i]; - if (Array.isArray(child)) { - walk(child); - } - else if (child != null && typeof child !== 'boolean') { - if ((simple = typeof nodeName !== 'function' && !isComplexType(child))) { - child = String(child); - } - if (simple && lastSimple) { - // If the previous child was simple (string), we merge both - vNodeChildren[vNodeChildren.length - 1].$text$ += child; - } - else { - // Append a new vNode, if it's text, we create a text vNode - vNodeChildren.push(simple ? newVNode(null, child) : child); - } - lastSimple = simple; - } - } - }; - walk(children); - const vnode = newVNode(nodeName, null); - vnode.$attrs$ = vnodeData; - if (vNodeChildren.length > 0) { - vnode.$children$ = vNodeChildren; - } - return vnode; -}; -const newVNode = (tag, text) => { - const vnode = { - $flags$: 0, - $tag$: tag, - $text$: text, - $elm$: null, - $children$: null, - }; - return vnode; -}; -const Host = {}; -const isHost = (node) => node && node.$tag$ === Host; -const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => { - // tslint:disable-next-line: prefer-const - const newVNode = newParentVNode.$children$[childIndex]; - let i = 0; - let elm; - let childNode; - if (newVNode.$text$ !== null) { - // create text node - elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$); - } - else { - // create element - elm = newVNode.$elm$ = (doc.createElement(newVNode.$tag$)); - if (isDef(scopeId) && elm['s-si'] !== scopeId) { - // if there is a scopeId and this is the initial render - // then let's add the scopeId as a css class - elm.classList.add((elm['s-si'] = scopeId)); - } - if (newVNode.$children$) { - for (i = 0; i < newVNode.$children$.length; ++i) { - // create the node - childNode = createElm(oldParentVNode, newVNode, i); - // return node could have been null - if (childNode) { - // append our new node - elm.appendChild(childNode); - } - } - } - } - return elm; -}; -const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => { - let containerElm = (parentElm); - let childNode; - if (containerElm.shadowRoot && containerElm.tagName === hostTagName) { - containerElm = containerElm.shadowRoot; - } - for (; startIdx <= endIdx; ++startIdx) { - if (vnodes[startIdx]) { - childNode = createElm(null, parentVNode, startIdx); - if (childNode) { - vnodes[startIdx].$elm$ = childNode; - containerElm.insertBefore(childNode, before); - } - } - } -}; -const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => { - for (; startIdx <= endIdx; ++startIdx) { - if ((vnode = vnodes[startIdx])) { - elm = vnode.$elm$; - // remove the vnode's element from the dom - elm.remove(); - } - } -}; -const updateChildren = (parentElm, oldCh, newVNode, newCh) => { - let oldStartIdx = 0; - let newStartIdx = 0; - let oldEndIdx = oldCh.length - 1; - let oldStartVnode = oldCh[0]; - let oldEndVnode = oldCh[oldEndIdx]; - let newEndIdx = newCh.length - 1; - let newStartVnode = newCh[0]; - let newEndVnode = newCh[newEndIdx]; - let node; - while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) { - if (oldStartVnode == null) { - // Vnode might have been moved left - oldStartVnode = oldCh[++oldStartIdx]; - } - else if (oldEndVnode == null) { - oldEndVnode = oldCh[--oldEndIdx]; - } - else if (newStartVnode == null) { - newStartVnode = newCh[++newStartIdx]; - } - else if (newEndVnode == null) { - newEndVnode = newCh[--newEndIdx]; - } - else if (isSameVnode(oldStartVnode, newStartVnode)) { - patch(oldStartVnode, newStartVnode); - oldStartVnode = oldCh[++oldStartIdx]; - newStartVnode = newCh[++newStartIdx]; - } - else if (isSameVnode(oldEndVnode, newEndVnode)) { - patch(oldEndVnode, newEndVnode); - oldEndVnode = oldCh[--oldEndIdx]; - newEndVnode = newCh[--newEndIdx]; - } - else if (isSameVnode(oldStartVnode, newEndVnode)) { - patch(oldStartVnode, newEndVnode); - parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling); - oldStartVnode = oldCh[++oldStartIdx]; - newEndVnode = newCh[--newEndIdx]; - } - else if (isSameVnode(oldEndVnode, newStartVnode)) { - patch(oldEndVnode, newStartVnode); - parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$); - oldEndVnode = oldCh[--oldEndIdx]; - newStartVnode = newCh[++newStartIdx]; - } - else { - { - // new element - node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx); - newStartVnode = newCh[++newStartIdx]; - } - if (node) { - { - oldStartVnode.$elm$.parentNode.insertBefore(node, oldStartVnode.$elm$); - } - } - } - } - if (oldStartIdx > oldEndIdx) { - addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx); - } - else if (newStartIdx > newEndIdx) { - removeVnodes(oldCh, oldStartIdx, oldEndIdx); - } -}; -const isSameVnode = (vnode1, vnode2) => { - // compare if two vnode to see if they're "technically" the same - // need to have the same element tag, and same key to be the same - if (vnode1.$tag$ === vnode2.$tag$) { - return true; - } - return false; -}; -const patch = (oldVNode, newVNode) => { - const elm = (newVNode.$elm$ = oldVNode.$elm$); - const oldChildren = oldVNode.$children$; - const newChildren = newVNode.$children$; - const text = newVNode.$text$; - if (text === null) { - if (oldChildren !== null && newChildren !== null) { - // looks like there's child vnodes for both the old and new vnodes - updateChildren(elm, oldChildren, newVNode, newChildren); - } - else if (newChildren !== null) { - // no old child vnodes, but there are new child vnodes to add - if (oldVNode.$text$ !== null) { - // the old vnode was text, so be sure to clear it out - elm.textContent = ''; - } - // add the new vnode children - addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1); - } - else if (oldChildren !== null) { - // no new child vnodes, but there are old child vnodes to remove - removeVnodes(oldChildren, 0, oldChildren.length - 1); - } - } - else if (oldVNode.$text$ !== text) { - // update the text content for the text only vnode - // and also only if the text is different than before - elm.data = text; - } -}; -const renderVdom = (hostRef, renderFnResults) => { - const hostElm = hostRef.$hostElement$; - const oldVNode = hostRef.$vnode$ || newVNode(null, null); - const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults); - hostTagName = hostElm.tagName; - rootVnode.$tag$ = null; - rootVnode.$flags$ |= 4 /* isHost */; - hostRef.$vnode$ = rootVnode; - rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm ); - { - scopeId = hostElm['s-sc']; - } - // synchronous patch - patch(oldVNode, rootVnode); -}; -/** - * Helper function to create & dispatch a custom Event on a provided target - * @param elm the target of the Event - * @param name the name to give the custom Event - * @param opts options for configuring a custom Event - * @returns the custom Event - */ -const emitEvent = (elm, name, opts) => { - const ev = plt.ce(name, opts); - elm.dispatchEvent(ev); - return ev; -}; -const attachToAncestor = (hostRef, ancestorComponent) => { - if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) { - ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r))); - } -}; -const scheduleUpdate = (hostRef, isInitialLoad) => { - { - hostRef.$flags$ |= 16 /* isQueuedForUpdate */; - } - if (hostRef.$flags$ & 4 /* isWaitingForChildren */) { - hostRef.$flags$ |= 512 /* needsRerender */; - return; - } - attachToAncestor(hostRef, hostRef.$ancestorComponent$); - // there is no ancestor component or the ancestor component - // has already fired off its lifecycle update then - // fire off the initial update - const dispatch = () => dispatchHooks(hostRef, isInitialLoad); - return writeTask(dispatch) ; -}; -const dispatchHooks = (hostRef, isInitialLoad) => { - const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$); - const instance = hostRef.$lazyInstance$ ; - let promise; - endSchedule(); - return then(promise, () => updateComponent(hostRef, instance, isInitialLoad)); -}; -const updateComponent = async (hostRef, instance, isInitialLoad) => { - // updateComponent - const elm = hostRef.$hostElement$; - const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$); - const rc = elm['s-rc']; - if (isInitialLoad) { - // DOM WRITE! - attachStyles(hostRef); - } - const endRender = createTime('render', hostRef.$cmpMeta$.$tagName$); - { - callRender(hostRef, instance); - } - if (rc) { - // ok, so turns out there are some child host elements - // waiting on this parent element to load - // let's fire off all update callbacks waiting - rc.map((cb) => cb()); - elm['s-rc'] = undefined; - } - endRender(); - endUpdate(); - { - const childrenPromises = elm['s-p']; - const postUpdate = () => postUpdateComponent(hostRef); - if (childrenPromises.length === 0) { - postUpdate(); - } - else { - Promise.all(childrenPromises).then(postUpdate); - hostRef.$flags$ |= 4 /* isWaitingForChildren */; - childrenPromises.length = 0; - } - } -}; -const callRender = (hostRef, instance, elm) => { - try { - instance = instance.render() ; - { - hostRef.$flags$ &= ~16 /* isQueuedForUpdate */; - } - { - hostRef.$flags$ |= 2 /* hasRendered */; - } - { - { - // looks like we've got child nodes to render into this host element - // or we need to update the css class/attrs on the host element - // DOM WRITE! - { - renderVdom(hostRef, instance); - } - } - } - } - catch (e) { - consoleError(e, hostRef.$hostElement$); - } - return null; -}; -const postUpdateComponent = (hostRef) => { - const tagName = hostRef.$cmpMeta$.$tagName$; - const elm = hostRef.$hostElement$; - const endPostUpdate = createTime('postUpdate', tagName); - const ancestorComponent = hostRef.$ancestorComponent$; - if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) { - hostRef.$flags$ |= 64 /* hasLoadedComponent */; - { - // DOM WRITE! - addHydratedFlag(elm); - } - endPostUpdate(); - { - hostRef.$onReadyResolve$(elm); - if (!ancestorComponent) { - appDidLoad(); - } - } - } - else { - endPostUpdate(); - } - // load events fire from bottom to top - // the deepest elements load first then bubbles up - { - if (hostRef.$onRenderResolve$) { - hostRef.$onRenderResolve$(); - hostRef.$onRenderResolve$ = undefined; - } - if (hostRef.$flags$ & 512 /* needsRerender */) { - nextTick(() => scheduleUpdate(hostRef, false)); - } - hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */); - } - // ( •_•) - // ( •_•)>⌐■-■ - // (⌐■_■) -}; -const appDidLoad = (who) => { - // on appload - // we have finish the first big initial render - { - addHydratedFlag(doc.documentElement); - } - nextTick(() => emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } })); -}; -const then = (promise, thenFn) => { - return promise && promise.then ? promise.then(thenFn) : thenFn(); -}; -const addHydratedFlag = (elm) => elm.classList.add('hydrated') - ; -/** - * Parse a new property value for a given property type. - * - * While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned, - * it is not safe to assume that the string returned by evaluating `typeof propValue` matches: - * 1. `any`, the type given to `propValue` in the function signature - * 2. the type stored from `propType`. - * - * This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type. - * - * Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to - * a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is - * based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`. - * ```tsx - * - * ``` - * - * HTML prop values on the other hand, will always a string - * - * @param propValue the new value to coerce to some type - * @param propType the type of the prop, expressed as a binary number - * @returns the parsed/coerced value - */ -const parsePropertyValue = (propValue, propType) => { - // ensure this value is of the correct prop type - if (propValue != null && !isComplexType(propValue)) { - if (propType & 1 /* String */) { - // could have been passed as a number or boolean - // but we still want it as a string - return String(propValue); - } - // redundant return here for better minification - return propValue; - } - // not sure exactly what type we want - // so no need to change to a different type - return propValue; -}; -const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName); -const setValue = (ref, propName, newVal, cmpMeta) => { - // check our new property value against our internal value - const hostRef = getHostRef(ref); - const oldVal = hostRef.$instanceValues$.get(propName); - const flags = hostRef.$flags$; - const instance = hostRef.$lazyInstance$ ; - newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]); - // explicitly check for NaN on both sides, as `NaN === NaN` is always false - const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal); - const didValueChange = newVal !== oldVal && !areBothNaN; - if ((!(flags & 8 /* isConstructingInstance */) || oldVal === undefined) && didValueChange) { - // gadzooks! the property's value has changed!! - // set our new value! - hostRef.$instanceValues$.set(propName, newVal); - if (instance) { - if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) { - // looks like this value actually changed, so we've got work to do! - // but only if we've already rendered, otherwise just chill out - // queue that we need to do an update, but don't worry about queuing - // up millions cuz this function ensures it only runs once - scheduleUpdate(hostRef, false); - } - } - } -}; -const proxyComponent = (Cstr, cmpMeta, flags) => { - if (cmpMeta.$members$) { - // It's better to have a const than two Object.entries() - const members = Object.entries(cmpMeta.$members$); - const prototype = Cstr.prototype; - members.map(([memberName, [memberFlags]]) => { - if ((memberFlags & 31 /* Prop */ || - ((flags & 2 /* proxyState */) && memberFlags & 32 /* State */))) { - // proxyComponent - prop - Object.defineProperty(prototype, memberName, { - get() { - // proxyComponent, get value - return getValue(this, memberName); - }, - set(newValue) { - // proxyComponent, set value - setValue(this, memberName, newValue, cmpMeta); - }, - configurable: true, - enumerable: true, - }); - } - }); - if ((flags & 1 /* isElementConstructor */)) { - const attrNameToPropName = new Map(); - prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) { - plt.jmp(() => { - const propName = attrNameToPropName.get(attrName); - // In a web component lifecycle the attributeChangedCallback runs prior to connectedCallback - // in the case where an attribute was set inline. - // ```html - // - // ``` - // - // There is an edge case where a developer sets the attribute inline on a custom element and then - // programmatically changes it before it has been upgraded as shown below: - // - // ```html - // - // - // - // ``` - // In this case if we do not unshadow here and use the value of the shadowing property, attributeChangedCallback - // will be called with `newValue = "some-value"` and will set the shadowed property (this.someAttribute = "another-value") - // to the value that was set inline i.e. "some-value" from above example. When - // the connectedCallback attempts to unshadow it will use "some-value" as the initial value rather than "another-value" - // - // The case where the attribute was NOT set inline but was not set programmatically shall be handled/unshadowed - // by connectedCallback as this attributeChangedCallback will not fire. - // - // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties - // - // TODO(STENCIL-16) we should think about whether or not we actually want to be reflecting the attributes to - // properties here given that this goes against best practices outlined here - // https://developers.google.com/web/fundamentals/web-components/best-practices#avoid-reentrancy - if (this.hasOwnProperty(propName)) { - newValue = this[propName]; - delete this[propName]; - } - else if (prototype.hasOwnProperty(propName) && - typeof this[propName] === 'number' && - this[propName] == newValue) { - // if the propName exists on the prototype of `Cstr`, this update may be a result of Stencil using native - // APIs to reflect props as attributes. Calls to `setAttribute(someElement, propName)` will result in - // `propName` to be converted to a `DOMString`, which may not be what we want for other primitive props. - return; - } - this[propName] = newValue === null && typeof this[propName] === 'boolean' ? false : newValue; - }); - }; - // create an array of attributes to observe - // and also create a map of html attribute name to js property name - Cstr.observedAttributes = members - .filter(([_, m]) => m[0] & 15 /* HasAttribute */) // filter to only keep props that should match attributes - .map(([propName, m]) => { - const attrName = m[1] || propName; - attrNameToPropName.set(attrName, propName); - return attrName; - }); - } - } - return Cstr; -}; -const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => { - // initializeComponent - if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) { - { - // we haven't initialized this element yet - hostRef.$flags$ |= 32 /* hasInitializedComponent */; - // lazy loaded components - // request the component's implementation to be - // wired up with the host element - Cstr = loadModule(cmpMeta); - if (Cstr.then) { - // Await creates a micro-task avoid if possible - const endLoad = uniqueTime(); - Cstr = await Cstr; - endLoad(); - } - if (!Cstr.isProxied) { - proxyComponent(Cstr, cmpMeta, 2 /* proxyState */); - Cstr.isProxied = true; - } - const endNewInstance = createTime('createInstance', cmpMeta.$tagName$); - // ok, time to construct the instance - // but let's keep track of when we start and stop - // so that the getters/setters don't incorrectly step on data - { - hostRef.$flags$ |= 8 /* isConstructingInstance */; - } - // construct the lazy-loaded component implementation - // passing the hostRef is very important during - // construction in order to directly wire together the - // host element and the lazy-loaded instance - try { - new Cstr(hostRef); - } - catch (e) { - consoleError(e); - } - { - hostRef.$flags$ &= ~8 /* isConstructingInstance */; - } - endNewInstance(); - } - if (Cstr.style) { - // this component has styles but we haven't registered them yet - let style = Cstr.style; - const scopeId = getScopeId(cmpMeta); - if (!styles.has(scopeId)) { - const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$); - registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)); - endRegisterStyles(); - } - } - } - // we've successfully created a lazy instance - const ancestorComponent = hostRef.$ancestorComponent$; - const schedule = () => scheduleUpdate(hostRef, true); - if (ancestorComponent && ancestorComponent['s-rc']) { - // this is the initial load and this component it has an ancestor component - // but the ancestor component has NOT fired its will update lifecycle yet - // so let's just cool our jets and wait for the ancestor to continue first - // this will get fired off when the ancestor component - // finally gets around to rendering its lazy self - // fire off the initial update - ancestorComponent['s-rc'].push(schedule); - } - else { - schedule(); - } -}; -const connectedCallback = (elm) => { - if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) { - const hostRef = getHostRef(elm); - const cmpMeta = hostRef.$cmpMeta$; - const endConnected = createTime('connectedCallback', cmpMeta.$tagName$); - if (!(hostRef.$flags$ & 1 /* hasConnected */)) { - // first time this component has connected - hostRef.$flags$ |= 1 /* hasConnected */; - { - // find the first ancestor component (if there is one) and register - // this component as one of the actively loading child components for its ancestor - let ancestorComponent = elm; - while ((ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)) { - // climb up the ancestors looking for the first - // component that hasn't finished its lifecycle update yet - if (ancestorComponent['s-p']) { - // we found this components first ancestor component - // keep a reference to this component's ancestor component - attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent)); - break; - } - } - } - // Lazy properties - // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties - if (cmpMeta.$members$) { - Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => { - if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) { - const value = elm[memberName]; - delete elm[memberName]; - elm[memberName] = value; - } - }); - } - { - initializeComponent(elm, hostRef, cmpMeta); - } - } - endConnected(); - } -}; -const disconnectedCallback = (elm) => { - if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) { - getHostRef(elm); - } -}; -const bootstrapLazy = (lazyBundles, options = {}) => { - const endBootstrap = createTime(); - const cmpTags = []; - const exclude = options.exclude || []; - const customElements = win.customElements; - const head = doc.head; - const metaCharset = /*@__PURE__*/ head.querySelector('meta[charset]'); - const visibilityStyle = /*@__PURE__*/ doc.createElement('style'); - const deferredConnectedCallbacks = []; - let appLoadFallback; - let isBootstrapping = true; - Object.assign(plt, options); - plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href; - lazyBundles.map((lazyBundle) => { - lazyBundle[1].map((compactMeta) => { - const cmpMeta = { - $flags$: compactMeta[0], - $tagName$: compactMeta[1], - $members$: compactMeta[2], - $listeners$: compactMeta[3], - }; - { - cmpMeta.$members$ = compactMeta[2]; - } - const tagName = cmpMeta.$tagName$; - const HostElement = class extends HTMLElement { - // StencilLazyHost - constructor(self) { - // @ts-ignore - super(self); - self = this; - registerHost(self, cmpMeta); - if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) { - // this component is using shadow dom - // and this browser supports shadow dom - // add the read-only property "shadowRoot" to the host element - // adding the shadow root build conditionals to minimize runtime - { - { - self.attachShadow({ mode: 'open' }); - } - } - } - } - connectedCallback() { - if (appLoadFallback) { - clearTimeout(appLoadFallback); - appLoadFallback = null; - } - if (isBootstrapping) { - // connectedCallback will be processed once all components have been registered - deferredConnectedCallbacks.push(this); - } - else { - plt.jmp(() => connectedCallback(this)); - } - } - disconnectedCallback() { - plt.jmp(() => disconnectedCallback(this)); - } - componentOnReady() { - return getHostRef(this).$onReadyPromise$; - } - }; - cmpMeta.$lazyBundleId$ = lazyBundle[0]; - if (!exclude.includes(tagName) && !customElements.get(tagName)) { - cmpTags.push(tagName); - customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */)); - } - }); - }); - { - visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS; - visibilityStyle.setAttribute('data-styles', ''); - head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild); - } - // Process deferred connectedCallbacks now all components have been registered - isBootstrapping = false; - if (deferredConnectedCallbacks.length) { - deferredConnectedCallbacks.map((host) => host.connectedCallback()); - } - else { - { - plt.jmp(() => (appLoadFallback = setTimeout(appDidLoad, 30))); - } - } - // Fallback appLoad event - endBootstrap(); -}; -const hostRefs = new WeakMap(); -const getHostRef = (ref) => hostRefs.get(ref); -const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef); -const registerHost = (elm, cmpMeta) => { - const hostRef = { - $flags$: 0, - $hostElement$: elm, - $cmpMeta$: cmpMeta, - $instanceValues$: new Map(), - }; - { - hostRef.$onReadyPromise$ = new Promise((r) => (hostRef.$onReadyResolve$ = r)); - elm['s-p'] = []; - elm['s-rc'] = []; - } - return hostRefs.set(elm, hostRef); -}; -const consoleError = (e, el) => (0, console.error)(e, el); -const cmpModules = /*@__PURE__*/ new Map(); -const loadModule = (cmpMeta, hostRef, hmrVersionId) => { - // loadModuleImport - const exportName = cmpMeta.$tagName$.replace(/-/g, '_'); - const bundleId = cmpMeta.$lazyBundleId$; - const module = cmpModules.get(bundleId) ; - if (module) { - return module[exportName]; - } - /*!__STENCIL_STATIC_IMPORT_SWITCH__*/ - return import( - /* @vite-ignore */ - /* webpackInclude: /\.entry\.js$/ */ - /* webpackExclude: /\.system\.entry\.js$/ */ - /* webpackMode: "lazy" */ - `./${bundleId}.entry.js${''}`).then((importedModule) => { - { - cmpModules.set(bundleId, importedModule); - } - return importedModule[exportName]; - }, consoleError); -}; -const styles = new Map(); -const queueDomReads = []; -const queueDomWrites = []; -const queueTask = (queue, write) => (cb) => { - queue.push(cb); - if (!queuePending) { - queuePending = true; - if (write && plt.$flags$ & 4 /* queueSync */) { - nextTick(flush); - } - else { - plt.raf(flush); - } - } -}; -const consume = (queue) => { - for (let i = 0; i < queue.length; i++) { - try { - queue[i](performance.now()); - } - catch (e) { - consoleError(e); - } - } - queue.length = 0; -}; -const flush = () => { - // always force a bunch of medium callbacks to run, but still have - // a throttle on how many can run in a certain time - // DOM READS!!! - consume(queueDomReads); - // DOM WRITES!!! - { - consume(queueDomWrites); - if ((queuePending = queueDomReads.length > 0)) { - // still more to do yet, but we've run out of time - // let's let this thing cool off and try again in the next tick - plt.raf(flush); - } - } -}; -const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb); -const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true); - -export { bootstrapLazy as b, h, promiseResolve as p, registerInstance as r }; diff --git a/dist/esm/index.js b/dist/esm/index.js deleted file mode 100644 index 8b13789..0000000 --- a/dist/esm/index.js +++ /dev/null @@ -1 +0,0 @@ - diff --git a/dist/esm/loader.js b/dist/esm/loader.js deleted file mode 100644 index bca7436..0000000 --- a/dist/esm/loader.js +++ /dev/null @@ -1,17 +0,0 @@ -import { p as promiseResolve, b as bootstrapLazy } from './index-ec8392ca.js'; - -/* - Stencil Client Patch Esm v2.17.4 | MIT Licensed | https://stenciljs.com - */ -const patchEsm = () => { - return promiseResolve(); -}; - -const defineCustomElements = (win, options) => { - if (typeof window === 'undefined') return Promise.resolve(); - return patchEsm().then(() => { - return bootstrapLazy([["my-component",[[1,"my-component",{"first":[1],"middle":[1],"last":[1]}]]]], options); - }); -}; - -export { defineCustomElements }; diff --git a/dist/esm/my-component.entry.js b/dist/esm/my-component.entry.js deleted file mode 100644 index a468d30..0000000 --- a/dist/esm/my-component.entry.js +++ /dev/null @@ -1,22 +0,0 @@ -import { r as registerInstance, h } from './index-ec8392ca.js'; - -function format(first, middle, last) { - return (first || '') + (middle ? ` ${middle}` : '') + (last ? ` ${last}` : ''); -} - -const myComponentCss = ":host{display:block}"; - -const MyComponent = class { - constructor(hostRef) { - registerInstance(this, hostRef); - } - getText() { - return format(this.first, this.middle, this.last); - } - render() { - return h("div", null, "Hello, World! I'm ", this.getText()); - } -}; -MyComponent.style = myComponentCss; - -export { MyComponent as my_component }; diff --git a/dist/esm/pdfplayer-stencil.js b/dist/esm/pdfplayer-stencil.js deleted file mode 100644 index 836b304..0000000 --- a/dist/esm/pdfplayer-stencil.js +++ /dev/null @@ -1,17 +0,0 @@ -import { p as promiseResolve, b as bootstrapLazy } from './index-ec8392ca.js'; - -/* - Stencil Client Patch Browser v2.17.4 | MIT Licensed | https://stenciljs.com - */ -const patchBrowser = () => { - const importMeta = import.meta.url; - const opts = {}; - if (importMeta !== '') { - opts.resourcesUrl = new URL('.', importMeta).href; - } - return promiseResolve(opts); -}; - -patchBrowser().then(options => { - return bootstrapLazy([["my-component",[[1,"my-component",{"first":[1],"middle":[1],"last":[1]}]]]], options); -}); diff --git a/dist/esm/polyfills/core-js.js b/dist/esm/polyfills/core-js.js deleted file mode 100644 index 7bbc909..0000000 --- a/dist/esm/polyfills/core-js.js +++ /dev/null @@ -1,11 +0,0 @@ -/** - * core-js 3.6.5 - * https://github.com/zloirock/core-js - * License: http://rock.mit-license.org - * © 2019 Denis Pushkarev (zloirock.ru) - */ -!function(t){"use strict";!function(t){var n={};function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:r})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,n){if(1&n&&(t=e(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(e.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var o in t)e.d(r,o,function(n){return t[n]}.bind(null,o));return r},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},e.p="",e(e.s=0)}([function(t,n,e){e(1),e(55),e(62),e(68),e(70),e(71),e(72),e(73),e(75),e(76),e(78),e(87),e(88),e(89),e(98),e(99),e(101),e(102),e(103),e(105),e(106),e(107),e(108),e(110),e(111),e(112),e(113),e(114),e(115),e(116),e(117),e(118),e(127),e(130),e(131),e(133),e(135),e(136),e(137),e(138),e(139),e(141),e(143),e(146),e(148),e(150),e(151),e(153),e(154),e(155),e(156),e(157),e(159),e(160),e(162),e(163),e(164),e(165),e(166),e(167),e(168),e(169),e(170),e(172),e(173),e(183),e(184),e(185),e(189),e(191),e(192),e(193),e(194),e(195),e(196),e(198),e(201),e(202),e(203),e(204),e(208),e(209),e(212),e(213),e(214),e(215),e(216),e(217),e(218),e(219),e(221),e(222),e(223),e(226),e(227),e(228),e(229),e(230),e(231),e(232),e(233),e(234),e(235),e(236),e(237),e(238),e(240),e(241),e(243),e(248),t.exports=e(246)},function(t,n,e){var r=e(2),o=e(6),i=e(45),a=e(14),u=e(46),c=e(39),f=e(47),s=e(48),l=e(52),p=e(49),h=e(53),v=p("isConcatSpreadable"),g=h>=51||!o((function(){var t=[];return t[v]=!1,t.concat()[0]!==t})),d=l("concat"),y=function(t){if(!a(t))return!1;var n=t[v];return void 0!==n?!!n:i(t)};r({target:"Array",proto:!0,forced:!g||!d},{concat:function(t){var n,e,r,o,i,a=u(this),l=s(a,0),p=0;for(n=-1,r=arguments.length;n9007199254740991)throw TypeError("Maximum allowed index exceeded");for(e=0;e=9007199254740991)throw TypeError("Maximum allowed index exceeded");f(l,p++,i)}return l.length=p,l}})},function(t,n,e){var r=e(3),o=e(4).f,i=e(18),a=e(21),u=e(22),c=e(32),f=e(44);t.exports=function(t,n){var e,s,l,p,h,v=t.target,g=t.global,d=t.stat;if(e=g?r:d?r[v]||u(v,{}):(r[v]||{}).prototype)for(s in n){if(p=n[s],l=t.noTargetGet?(h=o(e,s))&&h.value:e[s],!f(g?s:v+(d?".":"#")+s,t.forced)&&void 0!==l){if(typeof p==typeof l)continue;c(p,l)}(t.sham||l&&l.sham)&&i(p,"sham",!0),a(e,s,p,t)}}},function(t,n){var e=function(t){return t&&t.Math==Math&&t};t.exports=e("object"==typeof globalThis&&globalThis)||e("object"==typeof window&&window)||e("object"==typeof self&&self)||e("object"==typeof global&&global)||Function("return this")()},function(t,n,e){var r=e(5),o=e(7),i=e(8),a=e(9),u=e(13),c=e(15),f=e(16),s=Object.getOwnPropertyDescriptor;n.f=r?s:function(t,n){if(t=a(t),n=u(n,!0),f)try{return s(t,n)}catch(t){}if(c(t,n))return i(!o.f.call(t,n),t[n])}},function(t,n,e){var r=e(6);t.exports=!r((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},function(t,n){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,n,e){var r={}.propertyIsEnumerable,o=Object.getOwnPropertyDescriptor,i=o&&!r.call({1:2},1);n.f=i?function(t){var n=o(this,t);return!!n&&n.enumerable}:r},function(t,n){t.exports=function(t,n){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:n}}},function(t,n,e){var r=e(10),o=e(12);t.exports=function(t){return r(o(t))}},function(t,n,e){var r=e(6),o=e(11),i="".split;t.exports=r((function(){return!Object("z").propertyIsEnumerable(0)}))?function(t){return"String"==o(t)?i.call(t,""):Object(t)}:Object},function(t,n){var e={}.toString;t.exports=function(t){return e.call(t).slice(8,-1)}},function(t,n){t.exports=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t}},function(t,n,e){var r=e(14);t.exports=function(t,n){if(!r(t))return t;var e,o;if(n&&"function"==typeof(e=t.toString)&&!r(o=e.call(t)))return o;if("function"==typeof(e=t.valueOf)&&!r(o=e.call(t)))return o;if(!n&&"function"==typeof(e=t.toString)&&!r(o=e.call(t)))return o;throw TypeError("Can't convert object to primitive value")}},function(t,n){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,n){var e={}.hasOwnProperty;t.exports=function(t,n){return e.call(t,n)}},function(t,n,e){var r=e(5),o=e(6),i=e(17);t.exports=!r&&!o((function(){return 7!=Object.defineProperty(i("div"),"a",{get:function(){return 7}}).a}))},function(t,n,e){var r=e(3),o=e(14),i=r.document,a=o(i)&&o(i.createElement);t.exports=function(t){return a?i.createElement(t):{}}},function(t,n,e){var r=e(5),o=e(19),i=e(8);t.exports=r?function(t,n,e){return o.f(t,n,i(1,e))}:function(t,n,e){return t[n]=e,t}},function(t,n,e){var r=e(5),o=e(16),i=e(20),a=e(13),u=Object.defineProperty;n.f=r?u:function(t,n,e){if(i(t),n=a(n,!0),i(e),o)try{return u(t,n,e)}catch(t){}if("get"in e||"set"in e)throw TypeError("Accessors not supported");return"value"in e&&(t[n]=e.value),t}},function(t,n,e){var r=e(14);t.exports=function(t){if(!r(t))throw TypeError(String(t)+" is not an object");return t}},function(t,n,e){var r=e(3),o=e(18),i=e(15),a=e(22),u=e(23),c=e(25),f=c.get,s=c.enforce,l=String(String).split("String");(t.exports=function(t,n,e,u){var c=!!u&&!!u.unsafe,f=!!u&&!!u.enumerable,p=!!u&&!!u.noTargetGet;"function"==typeof e&&("string"!=typeof n||i(e,"name")||o(e,"name",n),s(e).source=l.join("string"==typeof n?n:"")),t!==r?(c?!p&&t[n]&&(f=!0):delete t[n],f?t[n]=e:o(t,n,e)):f?t[n]=e:a(n,e)})(Function.prototype,"toString",(function(){return"function"==typeof this&&f(this).source||u(this)}))},function(t,n,e){var r=e(3),o=e(18);t.exports=function(t,n){try{o(r,t,n)}catch(e){r[t]=n}return n}},function(t,n,e){var r=e(24),o=Function.toString;"function"!=typeof r.inspectSource&&(r.inspectSource=function(t){return o.call(t)}),t.exports=r.inspectSource},function(t,n,e){var r=e(3),o=e(22),i=r["__core-js_shared__"]||o("__core-js_shared__",{});t.exports=i},function(t,n,e){var r,o,i,a=e(26),u=e(3),c=e(14),f=e(18),s=e(15),l=e(27),p=e(31),h=u.WeakMap;if(a){var v=new h,g=v.get,d=v.has,y=v.set;r=function(t,n){return y.call(v,t,n),n},o=function(t){return g.call(v,t)||{}},i=function(t){return d.call(v,t)}}else{var x=l("state");p[x]=!0,r=function(t,n){return f(t,x,n),n},o=function(t){return s(t,x)?t[x]:{}},i=function(t){return s(t,x)}}t.exports={set:r,get:o,has:i,enforce:function(t){return i(t)?o(t):r(t,{})},getterFor:function(t){return function(n){var e;if(!c(n)||(e=o(n)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return e}}}},function(t,n,e){var r=e(3),o=e(23),i=r.WeakMap;t.exports="function"==typeof i&&/native code/.test(o(i))},function(t,n,e){var r=e(28),o=e(30),i=r("keys");t.exports=function(t){return i[t]||(i[t]=o(t))}},function(t,n,e){var r=e(29),o=e(24);(t.exports=function(t,n){return o[t]||(o[t]=void 0!==n?n:{})})("versions",[]).push({version:"3.6.5",mode:r?"pure":"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})},function(t,n){t.exports=!1},function(t,n){var e=0,r=Math.random();t.exports=function(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++e+r).toString(36)}},function(t,n){t.exports={}},function(t,n,e){var r=e(15),o=e(33),i=e(4),a=e(19);t.exports=function(t,n){for(var e=o(n),u=a.f,c=i.f,f=0;fc;)r(u,e=n[c++])&&(~i(f,e)||f.push(e));return f}},function(t,n,e){var r=e(9),o=e(39),i=e(41),a=function(t){return function(n,e,a){var u,c=r(n),f=o(c.length),s=i(a,f);if(t&&e!=e){for(;f>s;)if((u=c[s++])!=u)return!0}else for(;f>s;s++)if((t||s in c)&&c[s]===e)return t||s||0;return!t&&-1}};t.exports={includes:a(!0),indexOf:a(!1)}},function(t,n,e){var r=e(40),o=Math.min;t.exports=function(t){return t>0?o(r(t),9007199254740991):0}},function(t,n){var e=Math.ceil,r=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?r:e)(t)}},function(t,n,e){var r=e(40),o=Math.max,i=Math.min;t.exports=function(t,n){var e=r(t);return e<0?o(e+n,0):i(e,n)}},function(t,n){t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},function(t,n){n.f=Object.getOwnPropertySymbols},function(t,n,e){var r=e(6),o=/#|\.prototype\./,i=function(t,n){var e=u[a(t)];return e==f||e!=c&&("function"==typeof n?r(n):!!n)},a=i.normalize=function(t){return String(t).replace(o,".").toLowerCase()},u=i.data={},c=i.NATIVE="N",f=i.POLYFILL="P";t.exports=i},function(t,n,e){var r=e(11);t.exports=Array.isArray||function(t){return"Array"==r(t)}},function(t,n,e){var r=e(12);t.exports=function(t){return Object(r(t))}},function(t,n,e){var r=e(13),o=e(19),i=e(8);t.exports=function(t,n,e){var a=r(n);a in t?o.f(t,a,i(0,e)):t[a]=e}},function(t,n,e){var r=e(14),o=e(45),i=e(49)("species");t.exports=function(t,n){var e;return o(t)&&("function"!=typeof(e=t.constructor)||e!==Array&&!o(e.prototype)?r(e)&&null===(e=e[i])&&(e=void 0):e=void 0),new(void 0===e?Array:e)(0===n?0:n)}},function(t,n,e){var r=e(3),o=e(28),i=e(15),a=e(30),u=e(50),c=e(51),f=o("wks"),s=r.Symbol,l=c?s:s&&s.withoutSetter||a;t.exports=function(t){return i(f,t)||(u&&i(s,t)?f[t]=s[t]:f[t]=l("Symbol."+t)),f[t]}},function(t,n,e){var r=e(6);t.exports=!!Object.getOwnPropertySymbols&&!r((function(){return!String(Symbol())}))},function(t,n,e){var r=e(50);t.exports=r&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},function(t,n,e){var r=e(6),o=e(49),i=e(53),a=o("species");t.exports=function(t){return i>=51||!r((function(){var n=[];return(n.constructor={})[a]=function(){return{foo:1}},1!==n[t](Boolean).foo}))}},function(t,n,e){var r,o,i=e(3),a=e(54),u=i.process,c=u&&u.versions,f=c&&c.v8;f?o=(r=f.split("."))[0]+r[1]:a&&(!(r=a.match(/Edge\/(\d+)/))||r[1]>=74)&&(r=a.match(/Chrome\/(\d+)/))&&(o=r[1]),t.exports=o&&+o},function(t,n,e){var r=e(34);t.exports=r("navigator","userAgent")||""},function(t,n,e){var r=e(2),o=e(56),i=e(57);r({target:"Array",proto:!0},{copyWithin:o}),i("copyWithin")},function(t,n,e){var r=e(46),o=e(41),i=e(39),a=Math.min;t.exports=[].copyWithin||function(t,n){var e=r(this),u=i(e.length),c=o(t,u),f=o(n,u),s=arguments.length>2?arguments[2]:void 0,l=a((void 0===s?u:o(s,u))-f,u-c),p=1;for(f0;)f in e?e[c]=e[f]:delete e[c],c+=p,f+=p;return e}},function(t,n,e){var r=e(49),o=e(58),i=e(19),a=r("unscopables"),u=Array.prototype;null==u[a]&&i.f(u,a,{configurable:!0,value:o(null)}),t.exports=function(t){u[a][t]=!0}},function(t,n,e){var r,o=e(20),i=e(59),a=e(42),u=e(31),c=e(61),f=e(17),s=e(27),l=s("IE_PROTO"),p=function(){},h=function(t){return" - + diff --git a/tsconfig.json b/tsconfig.json index 09367ce..5971d5d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,10 +4,7 @@ "allowUnreachableCode": false, "declaration": false, "experimentalDecorators": true, - "lib": [ - "dom", - "es2017" - ], + "lib": ["dom", "es2017"], "moduleResolution": "node", "module": "esnext", "target": "es2017", @@ -16,10 +13,6 @@ "jsx": "react", "jsxFactory": "h" }, - "include": [ - "src" - ], - "exclude": [ - "node_modules" - ] + "include": ["src"], + "exclude": ["node_modules"] }