@londondynamics/pericles-webcomponent 2.0.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/configurator.cjs +9 -9
- package/dist/configurator.d.cts +7 -4
- package/dist/configurator.d.ts +7 -4
- package/dist/configurator.js +248 -222
- package/package.json +1 -1
package/dist/configurator.cjs
CHANGED
|
@@ -2,21 +2,21 @@
|
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2019 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
-
*/const
|
|
5
|
+
*/const T=globalThis,q=T.ShadowRoot&&(T.ShadyCSS===void 0||T.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,J=Symbol(),F=new WeakMap;let it=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==J)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(q&&t===void 0){const s=e!==void 0&&e.length===1;s&&(t=F.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&F.set(e,t))}return t}toString(){return this.cssText}};const pt=i=>new it(typeof i=="string"?i:i+"",void 0,J),ct=(i,...t)=>{const e=i.length===1?i[0]:t.reduce((s,r,n)=>s+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+i[n+1],i[0]);return new it(e,i,J)},ut=(i,t)=>{if(q)i.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(const e of t){const s=document.createElement("style"),r=T.litNonce;r!==void 0&&s.setAttribute("nonce",r),s.textContent=e.cssText,i.appendChild(s)}},V=q?i=>i:i=>i instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return pt(e)})(i):i;/**
|
|
6
6
|
* @license
|
|
7
7
|
* Copyright 2017 Google LLC
|
|
8
8
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
9
|
-
*/const{is:dt,defineProperty:gt,getOwnPropertyDescriptor:yt,getOwnPropertyNames:ft,getOwnPropertySymbols:_t,getPrototypeOf
|
|
9
|
+
*/const{is:dt,defineProperty:gt,getOwnPropertyDescriptor:yt,getOwnPropertyNames:ft,getOwnPropertySymbols:_t,getPrototypeOf:mt}=Object,m=globalThis,G=m.trustedTypes,$t=G?G.emptyScript:"",j=m.reactiveElementPolyfillSupport,E=(i,t)=>i,H={toAttribute(i,t){switch(t){case Boolean:i=i?$t:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,t){let e=i;switch(t){case Boolean:e=i!==null;break;case Number:e=i===null?null:Number(i);break;case Object:case Array:try{e=JSON.parse(i)}catch{e=null}}return e}},W=(i,t)=>!dt(i,t),K={attribute:!0,type:String,converter:H,reflect:!1,hasChanged:W};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),m.litPropertyMetadata??(m.litPropertyMetadata=new WeakMap);class S extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=K){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){const s=Symbol(),r=this.getPropertyDescriptor(t,s,e);r!==void 0&>(this.prototype,t,r)}}static getPropertyDescriptor(t,e,s){const{get:r,set:n}=yt(this.prototype,t)??{get(){return this[e]},set(o){this[e]=o}};return{get(){return r==null?void 0:r.call(this)},set(o){const p=r==null?void 0:r.call(this);n.call(this,o),this.requestUpdate(t,p,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??K}static _$Ei(){if(this.hasOwnProperty(E("elementProperties")))return;const t=mt(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(E("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(E("properties"))){const e=this.properties,s=[...ft(e),..._t(e)];for(const r of s)this.createProperty(r,e[r])}const t=this[Symbol.metadata];if(t!==null){const e=litPropertyMetadata.get(t);if(e!==void 0)for(const[s,r]of e)this.elementProperties.set(s,r)}this._$Eh=new Map;for(const[e,s]of this.elementProperties){const r=this._$Eu(e,s);r!==void 0&&this._$Eh.set(r,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const r of s)e.unshift(V(r))}else t!==void 0&&e.push(V(t));return e}static _$Eu(t,e){const s=e.attribute;return s===!1?void 0:typeof s=="string"?s:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var t;this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),(t=this.constructor.l)==null||t.forEach(e=>e(this))}addController(t){var e;(this._$EO??(this._$EO=new Set)).add(t),this.renderRoot!==void 0&&this.isConnected&&((e=t.hostConnected)==null||e.call(t))}removeController(t){var e;(e=this._$EO)==null||e.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const s of e.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return ut(t,this.constructor.elementStyles),t}connectedCallback(){var t;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$EO)==null||t.forEach(e=>{var s;return(s=e.hostConnected)==null?void 0:s.call(e)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$EO)==null||t.forEach(e=>{var s;return(s=e.hostDisconnected)==null?void 0:s.call(e)})}attributeChangedCallback(t,e,s){this._$AK(t,s)}_$EC(t,e){var n;const s=this.constructor.elementProperties.get(t),r=this.constructor._$Eu(t,s);if(r!==void 0&&s.reflect===!0){const o=(((n=s.converter)==null?void 0:n.toAttribute)!==void 0?s.converter:H).toAttribute(e,s.type);this._$Em=t,o==null?this.removeAttribute(r):this.setAttribute(r,o),this._$Em=null}}_$AK(t,e){var n;const s=this.constructor,r=s._$Eh.get(t);if(r!==void 0&&this._$Em!==r){const o=s.getPropertyOptions(r),p=typeof o.converter=="function"?{fromAttribute:o.converter}:((n=o.converter)==null?void 0:n.fromAttribute)!==void 0?o.converter:H;this._$Em=r,this[r]=p.fromAttribute(e,o.type),this._$Em=null}}requestUpdate(t,e,s){if(t!==void 0){if(s??(s=this.constructor.getPropertyOptions(t)),!(s.hasChanged??W)(this[t],e))return;this.P(t,e,s)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(t,e,s){this._$AL.has(t)||this._$AL.set(t,e),s.reflect===!0&&this._$Em!==t&&(this._$Ej??(this._$Ej=new Set)).add(t)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var s;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[n,o]of this._$Ep)this[n]=o;this._$Ep=void 0}const r=this.constructor.elementProperties;if(r.size>0)for(const[n,o]of r)o.wrapped!==!0||this._$AL.has(n)||this[n]===void 0||this.P(n,this[n],o)}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),(s=this._$EO)==null||s.forEach(r=>{var n;return(n=r.hostUpdate)==null?void 0:n.call(r)}),this.update(e)):this._$EU()}catch(r){throw t=!1,this._$EU(),r}t&&this._$AE(e)}willUpdate(t){}_$AE(t){var e;(e=this._$EO)==null||e.forEach(s=>{var r;return(r=s.hostUpdated)==null?void 0:r.call(s)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Ej&&(this._$Ej=this._$Ej.forEach(e=>this._$EC(e,this[e]))),this._$EU()}updated(t){}firstUpdated(t){}}S.elementStyles=[],S.shadowRootOptions={mode:"open"},S[E("elementProperties")]=new Map,S[E("finalized")]=new Map,j==null||j({ReactiveElement:S}),(m.reactiveElementVersions??(m.reactiveElementVersions=[])).push("2.0.4");/**
|
|
10
10
|
* @license
|
|
11
11
|
* Copyright 2017 Google LLC
|
|
12
12
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
13
|
-
*/const P=globalThis,I=P.trustedTypes,Q=I?I.createPolicy("lit-html",{createHTML:i=>i}):void 0,ot="$lit$",_=`lit$${Math.random().toFixed(9).slice(2)}$`,nt="?"+_,wt=`<${nt}>`,b=document,U=()=>b.createComment(""),x=i=>i===null||typeof i!="object"&&typeof i!="function",at=Array.isArray,bt=i=>at(i)||typeof(i==null?void 0:i[Symbol.iterator])=="function",
|
|
14
|
-
\f\r]`,C=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Z=/-->/g,X=/>/g
|
|
15
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),Y=/'/g,tt=/"/g,ht=/^(?:script|style|textarea|title)$/i,
|
|
13
|
+
*/const P=globalThis,I=P.trustedTypes,Q=I?I.createPolicy("lit-html",{createHTML:i=>i}):void 0,ot="$lit$",_=`lit$${Math.random().toFixed(9).slice(2)}$`,nt="?"+_,wt=`<${nt}>`,b=document,U=()=>b.createComment(""),x=i=>i===null||typeof i!="object"&&typeof i!="function",at=Array.isArray,bt=i=>at(i)||typeof(i==null?void 0:i[Symbol.iterator])=="function",D=`[
|
|
14
|
+
\f\r]`,C=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Z=/-->/g,X=/>/g,$=RegExp(`>|${D}(?:([^\\s"'>=/]+)(${D}*=${D}*(?:[^
|
|
15
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Y=/'/g,tt=/"/g,ht=/^(?:script|style|textarea|title)$/i,St=i=>(t,...e)=>({_$litType$:i,strings:t,values:e}),et=St(1),A=Symbol.for("lit-noChange"),g=Symbol.for("lit-nothing"),st=new WeakMap,w=b.createTreeWalker(b,129);function lt(i,t){if(!Array.isArray(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return Q!==void 0?Q.createHTML(t):t}const At=(i,t)=>{const e=i.length-1,s=[];let r,n=t===2?"<svg>":"",o=C;for(let p=0;p<e;p++){const a=i[p];let d,u,c=-1,y=0;for(;y<a.length&&(o.lastIndex=y,u=o.exec(a),u!==null);)y=o.lastIndex,o===C?u[1]==="!--"?o=Z:u[1]!==void 0?o=X:u[2]!==void 0?(ht.test(u[2])&&(r=RegExp("</"+u[2],"g")),o=$):u[3]!==void 0&&(o=$):o===$?u[0]===">"?(o=r??C,c=-1):u[1]===void 0?c=-2:(c=o.lastIndex-u[2].length,d=u[1],o=u[3]===void 0?$:u[3]==='"'?tt:Y):o===tt||o===Y?o=$:o===Z||o===X?o=C:(o=$,r=void 0);const f=o===$&&i[p+1].startsWith("/>")?" ":"";n+=o===C?a+wt:c>=0?(s.push(d),a.slice(0,c)+ot+a.slice(c)+_+f):a+_+(c===-2?p:f)}return[lt(i,n+(i[e]||"<?>")+(t===2?"</svg>":"")),s]};class O{constructor({strings:t,_$litType$:e},s){let r;this.parts=[];let n=0,o=0;const p=t.length-1,a=this.parts,[d,u]=At(t,e);if(this.el=O.createElement(d,s),w.currentNode=this.el.content,e===2){const c=this.el.content.firstChild;c.replaceWith(...c.childNodes)}for(;(r=w.nextNode())!==null&&a.length<p;){if(r.nodeType===1){if(r.hasAttributes())for(const c of r.getAttributeNames())if(c.endsWith(ot)){const y=u[o++],f=r.getAttribute(c).split(_),N=/([.?@])?(.*)/.exec(y);a.push({type:1,index:n,name:N[2],strings:f,ctor:N[1]==="."?Ct:N[1]==="?"?Et:N[1]==="@"?Pt:L}),r.removeAttribute(c)}else c.startsWith(_)&&(a.push({type:6,index:n}),r.removeAttribute(c));if(ht.test(r.tagName)){const c=r.textContent.split(_),y=c.length-1;if(y>0){r.textContent=I?I.emptyScript:"";for(let f=0;f<y;f++)r.append(c[f],U()),w.nextNode(),a.push({type:2,index:++n});r.append(c[y],U())}}}else if(r.nodeType===8)if(r.data===nt)a.push({type:2,index:n});else{let c=-1;for(;(c=r.data.indexOf(_,c+1))!==-1;)a.push({type:7,index:n}),c+=_.length-1}n++}}static createElement(t,e){const s=b.createElement("template");return s.innerHTML=t,s}}function v(i,t,e=i,s){var o,p;if(t===A)return t;let r=s!==void 0?(o=e._$Co)==null?void 0:o[s]:e._$Cl;const n=x(t)?void 0:t._$litDirective$;return(r==null?void 0:r.constructor)!==n&&((p=r==null?void 0:r._$AO)==null||p.call(r,!1),n===void 0?r=void 0:(r=new n(i),r._$AT(i,e,s)),s!==void 0?(e._$Co??(e._$Co=[]))[s]=r:e._$Cl=r),r!==void 0&&(t=v(i,r._$AS(i,t.values),r,s)),t}class vt{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:s}=this._$AD,r=((t==null?void 0:t.creationScope)??b).importNode(e,!0);w.currentNode=r;let n=w.nextNode(),o=0,p=0,a=s[0];for(;a!==void 0;){if(o===a.index){let d;a.type===2?d=new R(n,n.nextSibling,this,t):a.type===1?d=new a.ctor(n,a.name,a.strings,this,t):a.type===6&&(d=new Mt(n,this,t)),this._$AV.push(d),a=s[++p]}o!==(a==null?void 0:a.index)&&(n=w.nextNode(),o++)}return w.currentNode=b,r}p(t){let e=0;for(const s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}}class R{get _$AU(){var t;return((t=this._$AM)==null?void 0:t._$AU)??this._$Cv}constructor(t,e,s,r){this.type=2,this._$AH=g,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=r,this._$Cv=(r==null?void 0:r.isConnected)??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return e!==void 0&&(t==null?void 0:t.nodeType)===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=v(this,t,e),x(t)?t===g||t==null||t===""?(this._$AH!==g&&this._$AR(),this._$AH=g):t!==this._$AH&&t!==A&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):bt(t)?this.k(t):this._(t)}S(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.S(t))}_(t){this._$AH!==g&&x(this._$AH)?this._$AA.nextSibling.data=t:this.T(b.createTextNode(t)),this._$AH=t}$(t){var n;const{values:e,_$litType$:s}=t,r=typeof s=="number"?this._$AC(t):(s.el===void 0&&(s.el=O.createElement(lt(s.h,s.h[0]),this.options)),s);if(((n=this._$AH)==null?void 0:n._$AD)===r)this._$AH.p(e);else{const o=new vt(r,this),p=o.u(this.options);o.p(e),this.T(p),this._$AH=o}}_$AC(t){let e=st.get(t.strings);return e===void 0&&st.set(t.strings,e=new O(t)),e}k(t){at(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let s,r=0;for(const n of t)r===e.length?e.push(s=new R(this.S(U()),this.S(U()),this,this.options)):s=e[r],s._$AI(n),r++;r<e.length&&(this._$AR(s&&s._$AB.nextSibling,r),e.length=r)}_$AR(t=this._$AA.nextSibling,e){var s;for((s=this._$AP)==null?void 0:s.call(this,!1,!0,e);t&&t!==this._$AB;){const r=t.nextSibling;t.remove(),t=r}}setConnected(t){var e;this._$AM===void 0&&(this._$Cv=t,(e=this._$AP)==null||e.call(this,t))}}class L{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,r,n){this.type=1,this._$AH=g,this._$AN=void 0,this.element=t,this.name=e,this._$AM=r,this.options=n,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=g}_$AI(t,e=this,s,r){const n=this.strings;let o=!1;if(n===void 0)t=v(this,t,e,0),o=!x(t)||t!==this._$AH&&t!==A,o&&(this._$AH=t);else{const p=t;let a,d;for(t=n[0],a=0;a<n.length-1;a++)d=v(this,p[s+a],e,a),d===A&&(d=this._$AH[a]),o||(o=!x(d)||d!==this._$AH[a]),d===g?t=g:t!==g&&(t+=(d??"")+n[a+1]),this._$AH[a]=d}o&&!r&&this.j(t)}j(t){t===g?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class Ct extends L{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===g?void 0:t}}class Et extends L{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==g)}}class Pt extends L{constructor(t,e,s,r,n){super(t,e,s,r,n),this.type=5}_$AI(t,e=this){if((t=v(this,t,e,0)??g)===A)return;const s=this._$AH,r=t===g&&s!==g||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,n=t!==g&&(s===g||r);r&&this.element.removeEventListener(this.name,this,s),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e;typeof this._$AH=="function"?this._$AH.call(((e=this.options)==null?void 0:e.host)??this.element,t):this._$AH.handleEvent(t)}}class Mt{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){v(this,t)}}const z=P.litHtmlPolyfillSupport;z==null||z(O,R),(P.litHtmlVersions??(P.litHtmlVersions=[])).push("3.1.3");const Ut=(i,t,e)=>{const s=(e==null?void 0:e.renderBefore)??t;let r=s._$litPart$;if(r===void 0){const n=(e==null?void 0:e.renderBefore)??null;s._$litPart$=r=new R(t.insertBefore(U(),n),n,void 0,e??{})}return r._$AI(i),r};/**
|
|
16
16
|
* @license
|
|
17
17
|
* Copyright 2017 Google LLC
|
|
18
18
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
19
|
-
*/class M extends
|
|
19
|
+
*/class M extends S{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e;const t=super.createRenderRoot();return(e=this.renderOptions).renderBefore??(e.renderBefore=t.firstChild),t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Ut(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this._$Do)==null||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._$Do)==null||t.setConnected(!1)}render(){return A}}var rt;M._$litElement$=!0,M.finalized=!0,(rt=globalThis.litElementHydrateSupport)==null||rt.call(globalThis,{LitElement:M});const B=globalThis.litElementPolyfillSupport;B==null||B({LitElement:M});(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.0.5");/**
|
|
20
20
|
* @license
|
|
21
21
|
* Copyright 2017 Google LLC
|
|
22
22
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
* @license
|
|
25
25
|
* Copyright 2017 Google LLC
|
|
26
26
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
27
|
-
*/const Ot={attribute:!0,type:String,converter:H,reflect:!1,hasChanged:
|
|
27
|
+
*/const Ot={attribute:!0,type:String,converter:H,reflect:!1,hasChanged:W},Rt=(i=Ot,t,e)=>{const{kind:s,metadata:r}=e;let n=globalThis.litPropertyMetadata.get(r);if(n===void 0&&globalThis.litPropertyMetadata.set(r,n=new Map),n.set(e.name,i),s==="accessor"){const{name:o}=e;return{set(p){const a=t.get.call(this);t.set.call(this,p),this.requestUpdate(o,a,i)},init(p){return p!==void 0&&this.P(o,void 0,i),p}}}if(s==="setter"){const{name:o}=e;return function(p){const a=this[o];t.call(this,p),this.requestUpdate(o,a,i)}}throw Error("Unsupported decorator location: "+s)};function l(i){return(t,e)=>typeof e=="object"?Rt(i,t,e):((s,r,n)=>{const o=r.hasOwnProperty(n);return r.constructor.createProperty(n,o?{...s,wrapped:!0}:s),o?Object.getOwnPropertyDescriptor(r,n):void 0})(i,t,e)}const Nt=["allow-partial-match","ar-placement","background-color","camera-orbit-sensitivity","camera-transition-duration","disable-retries","disable-scroll-wheel","enable-dark-mode","highlight-color","interaction-prompt-style","lights","list-bullet-alignment","list-bullet-leading-zeros","list-bullet-style","qr-url-pattern","rotation","ruler-unit","shadow-intensity","shadow-softness","show-ar-button","show-ar-button-label","show-configurator","show-contexts","show-configurator-mobile","show-hotspots","show-interaction-prompt","show-light-switch","show-ruler-button","show-pivot-button","show-presets","start-frame","tone-mapping","zoom-type"],kt=i=>i.replace(/([-_]\w)/g,t=>t[1].toUpperCase()),Tt=i=>{const t=kt(i);return t.includes("showAr")?t.replace("showAr","showAR"):t},Ht=i=>{let t=new URLSearchParams;return Nt.forEach(e=>{if(i.hasAttribute(e)){let s=i.getAttribute(e);if(!s)return;s==="yes"&&(s="true"),s==="no"&&(s="false"),t.append(Tt(e),s)}}),t};var It=Object.defineProperty,Lt=Object.getOwnPropertyDescriptor,h=(i,t,e,s)=>{for(var r=s>1?void 0:s?Lt(t,e):t,n=i.length-1,o;n>=0;n--)(o=i[n])&&(r=(s?o(t,e,r):o(r))||r);return s&&r&&It(t,e,r),r};const jt="{host}{viewer}/by_scene_id/{scene_id}",Dt="{host}{viewer}/by_product_id/{customer_id}/{product_id}",zt="{host}{viewer}/by_product_id/{customer_id}/{sku}",Bt="{host}{viewer}/by_hash/{customer_id}/{hash}";function k(i,t){var e=new RegExp(Object.keys(t).join("|"),"gi");return i.replace(e,function(s){return t[s.toLowerCase()]})}exports.Configurator=class extends M{constructor(){super(...arguments),this.customerId=void 0,this.viewer="realtime",this.host="https://configurator.v2.londondynamics.com",this.defaultSelection={},this.getCurrentSelection=t=>this._pingpongPostMessage({type:"currentValues"},t),this._emit=(t,e)=>{this.dispatchEvent(new CustomEvent(t,{detail:e,bubbles:!0,composed:!0}))},this._pingpongPostMessage=(t,e)=>new Promise((s,r)=>{var a,d;const n={...t,messageId:Date.now()},o=u=>{if(u.origin===this.host&&u.data.messageId===n.messageId&&u.data.type===n.type){try{e?e(JSON.parse(u.data.result)):s(JSON.parse(u.data.result))}catch(c){c instanceof Error?e?e({},c.message):r(c.message):e?e({},"Unknown error"):r("Unknown error")}window.removeEventListener("message",o)}},p=(a=this.shadowRoot)==null?void 0:a.querySelector("iframe");p&&(window.addEventListener("message",o),(d=p.contentWindow)==null||d.postMessage(n,"*"))}),this._handleMessage=t=>{var e;if(t.origin===this.host&&(e=t==null?void 0:t.data)!=null&&e.type)switch(t.data.type){case"ready":this._emit("ready",{options:JSON.parse(t.data.options),presets:JSON.parse(t.data.presets),scene:JSON.parse(t.data.scene)});break;case"load":this._emit("load",JSON.parse(t.data.values));break;case"error":this._emit("error",JSON.parse(t.data.values));break;case"change":this._emit("change",JSON.parse(t.data.values));break;case"cameraChange":this._emit("camerachange",JSON.parse(t.data.values));break;case"log":const{logType:s,logData:r}=t.data;this._emit(s,JSON.parse(r));break}}}getCurrentConfiguration(t){return this._pingpongPostMessage({type:"currentConfig"},t)}getCurrentScene(t){return this._pingpongPostMessage({type:"currentScene"},t)}getCurrentHash(t){return this._pingpongPostMessage({type:"currentHash"},t)}getCurrentSource(t){return this._pingpongPostMessage({type:"currentSource"},t)}getCurrentARSource(t){return this._pingpongPostMessage({type:"currentARSource"},t)}getDataURL(t){return this._pingpongPostMessage({type:"dataURL"},t)}getFrame(t,e,s){return this._pingpongPostMessage({type:"getFrame",index:t,options:e},s)}setFeature(t,e){this._postMessage({type:"setFeature",featureId:t,variantId:e,allowPartialMatch:this.allowPartialMatch})}setSelection(t,e){this._postMessage({type:"setSelection",selection:t,resetBeforeUpdate:e,allowPartialMatch:this.allowPartialMatch})}setContext(t){this._postMessage({type:"setPreset",presetId:t})}resetCamera(){this._postMessage({type:"resetCamera"})}toggleLights(t){this._postMessage({type:"toggleLights",value:t})}toggleGroup(t){this._postMessage({type:"toggleGroup",value:t})}toggleHotspot(t){this._postMessage({type:"toggleGroup",groupId:t})}setRotation(t=[0,0,0],e="deg"){this._postMessage({type:"setRotation",rotation:t,angularUnit:e})}setCamera(t={},e={}){this._postMessage({type:"setCamera",...t,...e})}_postMessage(t){var s,r;const e=(s=this.shadowRoot)==null?void 0:s.querySelector("iframe");e&&((r=e.contentWindow)==null||r.postMessage(t,"*"))}connectedCallback(){super.connectedCallback();const t=this.querySelector('script[type="application/json"]');if(t&&t.textContent)try{this.defaultSelection=JSON.parse(t.textContent)}catch(e){typeof e=="object"&&e instanceof Error?console.warn(`Error parsing selection: ${e.message}. Using default selection instead.`):console.warn("Error parsing selection. Using default selection instead.")}window.addEventListener("message",this._handleMessage)}disconnectedCallback(){window.removeEventListener("message",this._handleMessage),super.disconnectedCallback()}render(){let t=null,e=null;if(console.log("this.defaultSelection?",this.defaultSelection),this.host?this.customerId?this.hash?e=k(Bt,{"{viewer}":"","{host}":this.host,"{customer_id}":this.customerId,"{hash}":this.hash}):this.sceneId?e=k(jt,{"{viewer}":this.viewer==="360"?"/360":"","{host}":this.host,"{customer_id}":this.customerId,"{scene_id}":this.sceneId}):this.sku?e=k(zt,{"{viewer}":this.viewer==="360"?"/360":"","{host}":this.host,"{customer_id}":this.customerId,"{sku}":this.sku}):this.productId?e=k(Dt,{"{viewer}":this.viewer==="360"?"/360":"","{host}":this.host,"{customer_id}":this.customerId,"{product_id}":this.productId}):t="Missing property: sku, scene-id, or hash":t="Missing property: customer-id":t="Missing property: host",t)return et`<div>${t}</div>`;let s="";return Object.keys(this.defaultSelection).length>0&&(s+=new URLSearchParams(this.defaultSelection).toString()),this.hasAttributes()&&(Object.keys(this.defaultSelection).length>0&&(s+="&"),s+=Ht(this)),s.length&&(e+="?"+s),et`<iframe
|
|
28
28
|
src="${e}"
|
|
29
29
|
width="100%"
|
|
30
30
|
height="100%"
|
|
@@ -38,10 +38,10 @@
|
|
|
38
38
|
sandbox="allow-pointer-lock allow-same-origin allow-scripts allow-popups allow-popups-to-escape-sandbox allow-downloads"
|
|
39
39
|
>
|
|
40
40
|
Unfortunately, your browser does not support iFrames.
|
|
41
|
-
</iframe>`
|
|
41
|
+
</iframe>`}};exports.Configurator.styles=ct`
|
|
42
42
|
:host {
|
|
43
43
|
display: block;
|
|
44
44
|
width: 100%;
|
|
45
45
|
height: 100%;
|
|
46
46
|
}
|
|
47
|
-
`;h([l({type:String,attribute:"customer-id"})],exports.Configurator.prototype,"customerId",2);h([l({type:String,attribute:"product-id"})],exports.Configurator.prototype,"productId",2);h([l({type:String})],exports.Configurator.prototype,"sku",2);h([l({type:String,attribute:"scene-id"})],exports.Configurator.prototype,"sceneId",2);h([l({type:String})],exports.Configurator.prototype,"hash",2);h([l({type:String})],exports.Configurator.prototype,"viewer",2);h([l({type:String})],exports.Configurator.prototype,"host",2);h([l({type:String,attribute:"allow-partial-match"})],exports.Configurator.prototype,"allowPartialMatch",2);h([l({type:String,attribute:"ar-placement"})],exports.Configurator.prototype,"arPlacement",2);h([l({type:String,attribute:"background-color"})],exports.Configurator.prototype,"backgroundColor",2);h([l({type:String,attribute:"
|
|
47
|
+
`;h([l({type:String,attribute:"customer-id"})],exports.Configurator.prototype,"customerId",2);h([l({type:String,attribute:"product-id"})],exports.Configurator.prototype,"productId",2);h([l({type:String})],exports.Configurator.prototype,"sku",2);h([l({type:String,attribute:"scene-id"})],exports.Configurator.prototype,"sceneId",2);h([l({type:String})],exports.Configurator.prototype,"hash",2);h([l({type:String})],exports.Configurator.prototype,"viewer",2);h([l({type:String})],exports.Configurator.prototype,"host",2);h([l({type:String,attribute:"allow-partial-match"})],exports.Configurator.prototype,"allowPartialMatch",2);h([l({type:String,attribute:"ar-placement"})],exports.Configurator.prototype,"arPlacement",2);h([l({type:String,attribute:"background-color"})],exports.Configurator.prototype,"backgroundColor",2);h([l({type:String,attribute:"disable-retries"})],exports.Configurator.prototype,"disableRetries",2);h([l({type:String,attribute:"disable-scroll-wheel"})],exports.Configurator.prototype,"disableScrollWheel",2);h([l({type:String,attribute:"enable-darkmode"})],exports.Configurator.prototype,"enableDarkMode",2);h([l({type:String,attribute:"interaction-prompt-style"})],exports.Configurator.prototype,"interactionPromptStyle",2);h([l({type:String,attribute:"lights"})],exports.Configurator.prototype,"lights",2);h([l({type:String,attribute:"qr-url-pattern"})],exports.Configurator.prototype,"qrUrlPattern",2);h([l({type:String,attribute:"rotation"})],exports.Configurator.prototype,"rotation",2);h([l({type:String,attribute:"ruler-unit"})],exports.Configurator.prototype,"rulerUnit",2);h([l({type:String,attribute:"shadow-intensity"})],exports.Configurator.prototype,"shadowIntensity",2);h([l({type:String,attribute:"shadow-softness"})],exports.Configurator.prototype,"shadowSoftness",2);h([l({type:String,attribute:"show-ar-button"})],exports.Configurator.prototype,"showARButton",2);h([l({type:String,attribute:"show-ar-button-label"})],exports.Configurator.prototype,"showARButtonLabel",2);h([l({type:String,attribute:"show-configurator"})],exports.Configurator.prototype,"showConfigurator",2);h([l({type:String,attribute:"show-contexts"})],exports.Configurator.prototype,"showContexts",2);h([l({type:String,attribute:"show-hotspots"})],exports.Configurator.prototype,"showHotspots",2);h([l({type:String,attribute:"show-interaction-prompt"})],exports.Configurator.prototype,"showInteractionPrompt",2);h([l({type:String,attribute:"show-light-switch"})],exports.Configurator.prototype,"showLightSwitch",2);h([l({type:String,attribute:"show-ruler-button"})],exports.Configurator.prototype,"showRulerButton",2);h([l({type:String,attribute:"show-pivot-button"})],exports.Configurator.prototype,"showPivotButton",2);h([l({type:String,attribute:"show-presets"})],exports.Configurator.prototype,"showPresets",2);h([l({type:String,attribute:"start-frame"})],exports.Configurator.prototype,"startFrame",2);h([l({type:String,attribute:"tone-mapping"})],exports.Configurator.prototype,"toneMapping",2);h([l({type:String,attribute:"zoom-type"})],exports.Configurator.prototype,"zoomType",2);exports.Configurator=h([xt("ld-configurator")],exports.Configurator);
|
package/dist/configurator.d.cts
CHANGED
|
@@ -25,10 +25,12 @@ export declare class Configurator extends LitElement {
|
|
|
25
25
|
allowPartialMatch?: 'yes' | 'no';
|
|
26
26
|
arPlacement?: 'floor' | 'wall';
|
|
27
27
|
backgroundColor?: string;
|
|
28
|
-
|
|
28
|
+
disableRetries?: 'yes' | 'no';
|
|
29
29
|
disableScrollWheel?: 'yes' | 'no';
|
|
30
|
+
enableDarkMode?: 'yes' | 'no';
|
|
30
31
|
interactionPromptStyle?: 'basic' | 'wiggle';
|
|
31
32
|
lights?: 'yes' | 'no';
|
|
33
|
+
qrUrlPattern?: string;
|
|
32
34
|
rotation?: [x: number, y: number, z: number];
|
|
33
35
|
rulerUnit?: 'mm' | 'cm' | 'm' | 'in' | 'ft' | 'yd';
|
|
34
36
|
shadowIntensity?: number;
|
|
@@ -46,6 +48,7 @@ export declare class Configurator extends LitElement {
|
|
|
46
48
|
startFrame?: number;
|
|
47
49
|
toneMapping?: 'aces' | 'agx' | 'neutral';
|
|
48
50
|
zoomType?: 'full' | 'loupe' | 'none';
|
|
51
|
+
defaultSelection: Selection;
|
|
49
52
|
static styles: import('lit').CSSResult;
|
|
50
53
|
/**
|
|
51
54
|
* Fetches current features and their variants
|
|
@@ -131,11 +134,11 @@ export declare class Configurator extends LitElement {
|
|
|
131
134
|
*/
|
|
132
135
|
setSelection(selection: Selection, resetBeforeUpdate?: boolean): void;
|
|
133
136
|
/**
|
|
134
|
-
* Selects
|
|
135
|
-
* @param {string}
|
|
137
|
+
* Selects context by id
|
|
138
|
+
* @param {string} contextId
|
|
136
139
|
* @returns {void}
|
|
137
140
|
*/
|
|
138
|
-
|
|
141
|
+
setContext(contextId: string): void;
|
|
139
142
|
/**
|
|
140
143
|
* Resets the camera to its initial position.
|
|
141
144
|
* Initial position is determined on first load.
|
package/dist/configurator.d.ts
CHANGED
|
@@ -25,10 +25,12 @@ export declare class Configurator extends LitElement {
|
|
|
25
25
|
allowPartialMatch?: 'yes' | 'no';
|
|
26
26
|
arPlacement?: 'floor' | 'wall';
|
|
27
27
|
backgroundColor?: string;
|
|
28
|
-
|
|
28
|
+
disableRetries?: 'yes' | 'no';
|
|
29
29
|
disableScrollWheel?: 'yes' | 'no';
|
|
30
|
+
enableDarkMode?: 'yes' | 'no';
|
|
30
31
|
interactionPromptStyle?: 'basic' | 'wiggle';
|
|
31
32
|
lights?: 'yes' | 'no';
|
|
33
|
+
qrUrlPattern?: string;
|
|
32
34
|
rotation?: [x: number, y: number, z: number];
|
|
33
35
|
rulerUnit?: 'mm' | 'cm' | 'm' | 'in' | 'ft' | 'yd';
|
|
34
36
|
shadowIntensity?: number;
|
|
@@ -46,6 +48,7 @@ export declare class Configurator extends LitElement {
|
|
|
46
48
|
startFrame?: number;
|
|
47
49
|
toneMapping?: 'aces' | 'agx' | 'neutral';
|
|
48
50
|
zoomType?: 'full' | 'loupe' | 'none';
|
|
51
|
+
defaultSelection: Selection;
|
|
49
52
|
static styles: import('lit').CSSResult;
|
|
50
53
|
/**
|
|
51
54
|
* Fetches current features and their variants
|
|
@@ -131,11 +134,11 @@ export declare class Configurator extends LitElement {
|
|
|
131
134
|
*/
|
|
132
135
|
setSelection(selection: Selection, resetBeforeUpdate?: boolean): void;
|
|
133
136
|
/**
|
|
134
|
-
* Selects
|
|
135
|
-
* @param {string}
|
|
137
|
+
* Selects context by id
|
|
138
|
+
* @param {string} contextId
|
|
136
139
|
* @returns {void}
|
|
137
140
|
*/
|
|
138
|
-
|
|
141
|
+
setContext(contextId: string): void;
|
|
139
142
|
/**
|
|
140
143
|
* Resets the camera to its initial position.
|
|
141
144
|
* Initial position is determined on first load.
|