@odoo/owl 3.0.0-alpha.2 → 3.0.0-alpha.21
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/README.md +100 -110
- package/dist/compile_templates.mjs +2434 -2532
- package/dist/compiler.js +2371 -0
- package/dist/owl-devtools.zip +0 -0
- package/dist/owl.cjs.js +6709 -6616
- package/dist/owl.cjs.runtime.js +4480 -0
- package/dist/owl.es.js +6697 -6600
- package/dist/owl.es.runtime.js +4436 -0
- package/dist/owl.iife.js +6710 -6617
- package/dist/owl.iife.min.js +1 -1
- package/dist/owl.iife.runtime.js +4484 -0
- package/dist/owl.iife.runtime.min.js +1 -0
- package/dist/types/common/owl_error.d.ts +3 -3
- package/dist/types/common/types.d.ts +1 -29
- package/dist/types/common/utils.d.ts +8 -8
- package/dist/types/compiler/code_generator.d.ts +133 -152
- package/dist/types/compiler/index.d.ts +13 -13
- package/dist/types/compiler/inline_expressions.d.ts +41 -59
- package/dist/types/compiler/parser.d.ts +170 -178
- package/dist/types/compiler/standalone/index.d.ts +2 -2
- package/dist/types/compiler/standalone/setup_jsdom.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/owl.d.ts +709 -665
- package/dist/types/runtime/app.d.ts +55 -62
- package/dist/types/runtime/blockdom/attributes.d.ts +8 -6
- package/dist/types/runtime/blockdom/block_compiler.d.ts +21 -21
- package/dist/types/runtime/blockdom/config.d.ts +8 -8
- package/dist/types/runtime/blockdom/event_catcher.d.ts +7 -7
- package/dist/types/runtime/blockdom/events.d.ts +8 -8
- package/dist/types/runtime/blockdom/html.d.ts +17 -17
- package/dist/types/runtime/blockdom/index.d.ts +25 -26
- package/dist/types/runtime/blockdom/list.d.ts +18 -18
- package/dist/types/runtime/blockdom/multi.d.ts +17 -17
- package/dist/types/runtime/blockdom/text.d.ts +26 -26
- package/dist/types/runtime/blockdom/toggler.d.ts +17 -17
- package/dist/types/runtime/component.d.ts +17 -28
- package/dist/types/runtime/component_node.d.ts +59 -83
- package/dist/types/runtime/context.d.ts +36 -0
- package/dist/types/runtime/error_handling.d.ts +13 -13
- package/dist/types/runtime/event_handling.d.ts +1 -1
- package/dist/types/runtime/fibers.d.ts +37 -37
- package/dist/types/runtime/hooks.d.ts +32 -57
- package/dist/types/runtime/index.d.ts +46 -35
- package/dist/types/runtime/lifecycle_hooks.d.ts +10 -12
- package/dist/types/runtime/plugin_hooks.d.ts +6 -0
- package/dist/types/runtime/plugin_manager.d.ts +36 -0
- package/dist/types/runtime/props.d.ts +21 -0
- package/dist/types/runtime/reactivity/computations.d.ts +34 -0
- package/dist/types/runtime/reactivity/computed.d.ts +6 -0
- package/dist/types/runtime/reactivity/effect.d.ts +1 -0
- package/dist/types/runtime/reactivity/proxy.d.ts +47 -0
- package/dist/types/runtime/reactivity/signal.d.ts +31 -0
- package/dist/types/runtime/reactivity.d.ts +57 -46
- package/dist/types/runtime/registry.d.ts +24 -15
- package/dist/types/runtime/rendering/error_handling.d.ts +13 -0
- package/dist/types/runtime/rendering/fibers.d.ts +37 -0
- package/dist/types/runtime/rendering/scheduler.d.ts +21 -0
- package/dist/types/runtime/rendering/template_helpers.d.ts +51 -0
- package/dist/types/runtime/resource.d.ts +18 -0
- package/dist/types/runtime/scheduler.d.ts +21 -21
- package/dist/types/runtime/status.d.ts +11 -10
- package/dist/types/runtime/template_set.d.ts +36 -40
- package/dist/types/runtime/types.d.ts +70 -0
- package/dist/types/runtime/utils.d.ts +24 -25
- package/dist/types/runtime/validation.d.ts +19 -36
- package/dist/types/version.d.ts +1 -1
- package/package.json +45 -19
- package/dist/types/runtime/cancellableContext.d.ts +0 -15
- package/dist/types/runtime/cancellablePromise.d.ts +0 -15
- package/dist/types/runtime/executionContext.d.ts +0 -0
- package/dist/types/runtime/listOperation.d.ts +0 -1
- package/dist/types/runtime/plugins.d.ts +0 -39
- package/dist/types/runtime/relationalModel/discussModel.d.ts +0 -19
- package/dist/types/runtime/relationalModel/discussModelTypes.d.ts +0 -22
- package/dist/types/runtime/relationalModel/field.d.ts +0 -20
- package/dist/types/runtime/relationalModel/model.d.ts +0 -59
- package/dist/types/runtime/relationalModel/modelData.d.ts +0 -18
- package/dist/types/runtime/relationalModel/modelRegistry.d.ts +0 -3
- package/dist/types/runtime/relationalModel/modelUtils.d.ts +0 -4
- package/dist/types/runtime/relationalModel/store.d.ts +0 -16
- package/dist/types/runtime/relationalModel/types.d.ts +0 -83
- package/dist/types/runtime/relationalModel/util.d.ts +0 -1
- package/dist/types/runtime/relationalModel/web/WebDataPoint.d.ts +0 -25
- package/dist/types/runtime/relationalModel/web/WebRecord.d.ts +0 -131
- package/dist/types/runtime/relationalModel/web/WebStaticList.d.ts +0 -63
- package/dist/types/runtime/relationalModel/web/webModel.d.ts +0 -5
- package/dist/types/runtime/relationalModel/web/webModelTypes.d.ts +0 -139
- package/dist/types/runtime/signals.d.ts +0 -17
- package/dist/types/runtime/task.d.ts +0 -12
- package/dist/types/utils/registry.d.ts +0 -15
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(t){"use strict";class e extends Error{cause}let n=[];function o(t){const o=n.at(-1);if(!o)throw new e("No active context");if(t&&t!==o.type)throw new e(`Expected to be in a ${t} context`);return o}function s(t,n){return async function(...o){if(t.status>1)throw new e(`Function called after the end of life of the ${t.type}`);const s=await n.call(this,...o);return t.status>1?new Promise(()=>{}):s}}function i(t){let e=!1;return function(...n){e||(e=!0,queueMicrotask(()=>{e=!1,t(...n)}))}}function r(t){const n=t&&t.ownerDocument;if(n){if(!n.defaultView)throw new e("Cannot mount a component: the target document is not attached to a window (defaultView is missing)");if(t instanceof n.defaultView.HTMLElement||t instanceof ShadowRoot){if(!function(t,e){let n=t;const o=e.defaultView.ShadowRoot;for(;n;){if(n===e)return!0;if(n.parentNode)n=n.parentNode;else{if(!(n instanceof o&&n.host))return!1;n=n.host}}return!1}(t,n))throw new e("Cannot mount a component on a detached dom node");return}}throw new e("Cannot mount component: the target is not a valid DOM element")}class l extends EventTarget{trigger(t,e){this.dispatchEvent(new CustomEvent(t,{detail:e}))}}class a extends String{}function c(t){return t instanceof a?t:void 0===t?u(""):"number"==typeof t?u(String(t)):([["&","&"],["<","<"],[">",">"],["'","'"],['"',"""],["`","`"]].forEach(e=>{t=String(t).replace(new RegExp(e[0],"g"),e[1])}),u(t))}function u(t,...e){if(!Array.isArray(t))return new a(t);const n=t;let o="",s=0;for(;s<e.length;++s)o+=n[s]+c(e[s]);return o+=n[s],new a(o)}var h;!function(t){t[t.EXECUTED=0]="EXECUTED",t[t.STALE=1]="STALE",t[t.PENDING=2]="PENDING"}(h||(h={}));const d=Symbol("Atom");let f,p=[];function m(t,e,n=h.STALE){return{state:n,value:void 0,compute:t,sources:new Set,observers:new Set,isDerived:e}}function g(t){f&&(f.sources.add(t),t.observers.add(f))}function y(t){for(const e of t.observers)e.state===h.EXECUTED&&(e.isDerived?_(e):p.push(e)),e.state=h.STALE;v()}const v=i(function(){for(let t=0;t<p.length;t++)N(p[t]);p.length=0});function b(){return f}function w(t){f=t}function N(t){const e=t.state;if(e===h.EXECUTED)return;if(e===h.PENDING){for(const e of t.sources)"compute"in e&&N(e);if(t.state!==h.STALE)return void(t.state=h.EXECUTED)}E(t);const n=f;f=t,t.value=t.compute(),t.state=h.EXECUTED,f=n}function E(t){const e=t.sources;for(const n of e){n.observers.delete(t)}e.clear()}function x(t){for(const e of t.sources)e.observers.delete(t),"compute"in e&&e.isDerived&&0===e.observers.size&&x(e);t.sources.clear(),t.state=h.STALE}function _(t){const e=[t];let n;for(;n=e.pop();)for(const t of n.observers)t.state||(t.state=h.PENDING,t.isDerived?e.push(t):p.push(t))}function D(t){const e=f;let n;f=void 0;try{n=t()}finally{f=e}return n}const k=new WeakMap,T=new WeakMap;function O(t,n){try{t.destroy()}catch(t){}return Object.assign(new e("[Owl] Unhandled error. Destroying the root component"),{cause:n})}function C(t,e){if(!t)return!1;const n=t.fiber;n&&k.set(n,e);const o=T.get(t);if(o){let n=!1;const s=()=>O(t.app,e);for(let t=o.length-1;t>=0;t--)try{o[t](e,s),n=!0;break}catch(t){e=t}if(n)return!0}return C(t.parent,e)}function I(t){let{error:e}=t;const n="node"in t?t.node:t.fiber.node,o="fiber"in t?t.fiber:n.fiber;if(o){let t=o;do{t.node.fiber=t,k.set(t,e),t=t.parent}while(t);k.set(o.root,e)}if(!C(n,e))throw O(n.app,e)}function S(t){t=t.slice();const e=[];let n;for(;(n=t[0])&&"string"==typeof n;)e.push(t.shift());return{modifiers:e,data:t}}const R={shouldNormalizeDom:!0,mainEventHandler:(t,e,n)=>("function"==typeof t?t(e):Array.isArray(t)&&(t=S(t).data)[0](t[1],e),!1)},P=document.createTextNode("");class M{key;child;parentEl;constructor(t,e){this.key=t,this.child=e}mount(t,e){this.parentEl=t,this.child.mount(t,e)}moveBeforeDOMNode(t,e){this.child.moveBeforeDOMNode(t,e)}moveBeforeVNode(t,e){this.moveBeforeDOMNode(t&&t.firstNode()||e)}patch(t,e){if(this===t)return;let n=this.child,o=t.child;if(this.key===t.key)n.patch(o,e);else{const s=n.firstNode();s.parentElement.insertBefore(P,s),e&&n.beforeRemove(),n.remove(),o.mount(this.parentEl,P),this.child=o,this.key=t.key}}beforeRemove(){this.child.beforeRemove()}remove(){this.child.remove()}firstNode(){return this.child.firstNode()}toString(){return this.child.toString()}}function A(t,e){return new M(t,e)}let j,B,$,L;if("undefined"!=typeof Element){({setAttribute:j,removeAttribute:B}=Element.prototype);const t=DOMTokenList.prototype;$=t.add,L=t.remove}const V=Array.isArray,{split:W,trim:F}=String.prototype,U=/\s+/;function q(t,e){switch(e){case!1:case void 0:B.call(this,t);break;case!0:j.call(this,t,"");break;default:j.call(this,t,e)}}function K(t){return function(e){q.call(this,t,e)}}function H(t){if(V(t))"class"===t[0]?G.call(this,t[1]):"style"===t[0]?tt.call(this,t[1]):q.call(this,t[0],t[1]);else for(let e in t)"class"===e?G.call(this,t[e]):"style"===e?tt.call(this,t[e]):q.call(this,e,t[e])}function X(t,e){if(V(t)){const n=t[0],o=t[1];if(n===e[0]){if(o===e[1])return;"class"===n?Z.call(this,o,e[1]):"style"===n?et.call(this,o,e[1]):q.call(this,n,o)}else B.call(this,e[0]),q.call(this,n,o)}else{for(let n in e)n in t||("class"===n?Z.call(this,"",e[n]):"style"===n?et.call(this,"",e[n]):B.call(this,n));for(let n in t){const o=t[n];o!==e[n]&&("class"===n?Z.call(this,o,e[n]):"style"===n?et.call(this,o,e[n]):q.call(this,n,o))}}}function z(t){const e={};switch(typeof t){case"string":const n=F.call(t);if(!n)return{};let o=W.call(n,U);for(let t=0,n=o.length;t<n;t++)e[o[t]]=!0;return e;case"object":for(let n in t){const o=t[n];if(o){if(n=F.call(n),!n)continue;const t=W.call(n,U);for(let n of t)e[n]=o}}return e;case"undefined":return{};case"number":return{[t]:!0};default:return{[t]:!0}}}function G(t){t=""===t?{}:z(t);const e=this.classList;for(let n in t)$.call(e,n)}function Z(t,e){e=""===e?{}:z(e),t=""===t?{}:z(t);const n=this.classList;for(let o in e)o in t||L.call(n,o);for(let o in t)o in e||$.call(n,o)}const J={};function Q(t){if(t in J)return J[t];const e=t.replace(/[A-Z]/g,t=>"-"+t.toLowerCase());return J[t]=e,e}function Y(t){const e={};switch(typeof t){case"string":{const n=F.call(t);if(!n)return{};const o=n.split(";");for(let t of o){if(t=F.call(t),!t)continue;const n=t.indexOf(":");if(-1===n)continue;const o=F.call(t.slice(0,n)),s=F.call(t.slice(n+1));o&&s&&(e[o]=s)}return e}case"object":for(let n in t){const o=t[n];(o||0===o)&&(e[Q(n)]=String(o))}return e;default:return{}}}function tt(t){t=""===t?{}:Y(t);const e=this.style;for(let n in t)e.setProperty(n,t[n])}function et(t,e){e=""===e?{}:Y(e),t=""===t?{}:Y(t);const n=this.style;for(let o in e)o in t||n.removeProperty(o);for(let o in t)t[o]!==e[o]&&n.setProperty(o,t[o])}function nt(t){const e=t.split(".")[0],n=t.includes(".capture"),o=t.includes(".passive");return t.includes(".synthetic")?function(t,e=!1,n=!1){let o=`__event__synthetic_${t}`;e&&(o=`${o}_capture`);!function(t,e,n=!1,o=!1){if(it[e])return;document.addEventListener(t,t=>function(t,e){let n=e.target;for(;null!==n;){const o=n[t];if(o)for(const t of Object.values(o)){if(R.mainEventHandler(t,e,n))return}n=n.parentNode}}(e,t),{capture:n,passive:o}),it[e]=!0}(t,o,e,n);const s=st++;function i(t){const e=this[o]||{};e[s]=t,this[o]=e}function r(){delete this[o]}return{setup:i,update:i,remove:r}}(e,n,o):function(t,e=!1,n=!1){let o=`__event__${t}_${ot++}`;e&&(o=`${o}_capture`);function s(t){const e=t.currentTarget;if(!e||!function(t){if(!t)return!1;if(t.ownerDocument.contains(t))return!0;const e=t.getRootNode();return e instanceof ShadowRoot&&t.ownerDocument.contains(e.host)}(e))return;const n=e[o];n&&R.mainEventHandler(n,t,e)}const i={capture:e,passive:n};function r(e){this[o]=e,this.addEventListener(t,s,i)}function l(){delete this[o],this.removeEventListener(t,s,i)}function a(t){this[o]=t}return{setup:r,update:a,remove:l}}(e,n,o)}let ot=1;let st=1;const it={};let rt,lt,at;if("undefined"!=typeof Node){const t=Node.prototype;rt=t.insertBefore,lt=(ct=t,ut="textContent",Object.getOwnPropertyDescriptor(ct,ut)).set,at=t.removeChild}var ct,ut;class ht{children;anchors;parentEl;isOnlyChild;constructor(t){this.children=t}mount(t,e){const n=this.children,o=n.length,s=new Array(o);for(let i=0;i<o;i++){let o=n[i];if(o)o.mount(t,e);else{const n=document.createTextNode("");s[i]=n,rt.call(t,n,e)}}this.anchors=s,this.parentEl=t}moveBeforeDOMNode(t,e=this.parentEl){this.parentEl=e;const n=this.children,o=this.anchors;for(let s=0,i=n.length;s<i;s++){let i=n[s];if(i)i.moveBeforeDOMNode(t,e);else{const n=o[s];rt.call(e,n,t)}}}moveBeforeVNode(t,e){if(t){const n=t.children[0];e=(n?n.firstNode():t.anchors[0])||null}const n=this.children,o=this.parentEl,s=this.anchors;for(let t=0,i=n.length;t<i;t++){let i=n[t];if(i)i.moveBeforeVNode(null,e);else{const n=s[t];rt.call(o,n,e)}}}patch(t,e){if(this===t)return;const n=this.children,o=t.children,s=this.anchors,i=this.parentEl;for(let t=0,r=n.length;t<r;t++){const r=n[t],l=o[t];if(r)if(l)r.patch(l,e);else{const o=r.firstNode(),l=document.createTextNode("");s[t]=l,rt.call(i,l,o),e&&r.beforeRemove(),r.remove(),n[t]=void 0}else if(l){n[t]=l;const e=s[t];l.mount(i,e),at.call(i,e)}}}beforeRemove(){const t=this.children;for(let e=0,n=t.length;e<n;e++){const n=t[e];n&&n.beforeRemove()}}remove(){const t=this.parentEl;if(this.isOnlyChild)lt.call(t,"");else{const e=this.children,n=this.anchors;for(let o=0,s=e.length;o<s;o++){const s=e[o];s?s.remove():at.call(t,n[o])}}}firstNode(){const t=this.children[0];return t?t.firstNode():this.anchors[0]}toString(){return this.children.map(t=>t?t.toString():"").join("")}}function dt(t){return new ht(t)}let ft,pt,mt;if("undefined"!=typeof Node){const t=Node.prototype;ft=t.insertBefore,mt=t.removeChild,pt=((t,e)=>Object.getOwnPropertyDescriptor(t,e))(CharacterData.prototype,"data").set}class gt{text;parentEl;el;constructor(t){this.text=t}mountNode(t,e,n){this.parentEl=e,ft.call(e,t,n),this.el=t}moveBeforeDOMNode(t,e=this.parentEl){this.parentEl=e,ft.call(e,this.el,t)}moveBeforeVNode(t,e){ft.call(this.parentEl,this.el,t?t.el:e)}beforeRemove(){}remove(){mt.call(this.parentEl,this.el)}firstNode(){return this.el}toString(){return this.text}}class yt extends gt{mount(t,e){this.mountNode(document.createTextNode(Nt(this.text)),t,e)}patch(t){const e=t.text;this.text!==e&&(pt.call(this.el,Nt(e)),this.text=e)}}class vt extends gt{mount(t,e){this.mountNode(document.createComment(Nt(this.text)),t,e)}patch(){}}function bt(t){return new yt(t)}function wt(t){return new vt(t)}function Nt(t){switch(typeof t){case"string":return t;case"number":return String(t);case"boolean":return t?"true":"false";default:return t||""}}const Et=(t,e)=>Object.getOwnPropertyDescriptor(t,e);let xt,_t,Dt,kt,Tt;"undefined"!=typeof Node&&(xt=Node.prototype,_t=Element.prototype,Dt=Et(CharacterData.prototype,"data").set,kt=Et(xt,"firstChild").get,Tt=Et(xt,"nextSibling").get);const Ot=()=>{};function Ct(t){return function(e){this[t]=0===e?0:e?e.valueOf():""}}const It={};function St(t){if(t in It)return It[t];const e=(new DOMParser).parseFromString(`<t>${t}</t>`,"text/xml").firstChild.firstChild;R.shouldNormalizeDom&&Rt(e);const n=Pt(e),o=jt(n),s=function(t,e){let n=function(t,e){const{refN:n,collectors:o,children:s,locations:i,cbRefs:r}=e;i.sort((t,e)=>t.idx-e.idx);const l=i.length,a=s.length,c=n>0,u=i.map(t=>t.refIdx),h=i.map(t=>t.setData),d=i.map(t=>t.updateData),f=[Tt,kt],p=o.length,m=o.map(t=>32767&t.idx|(32767&t.prevIdx)<<15|(t.getVal===kt?1:0)<<30),g=s.map(t=>32767&t.parentRefIdx|(t.isOnlyChild?1:0)<<15|(32767&(t.afterRefIdx??0))<<16),y=xt.cloneNode,v=xt.insertBefore,b=_t.remove;class w{el;parentEl;data;children;refs;constructor(t){this.data=t}beforeRemove(){}remove(){b.call(this.el)}firstNode(){return this.el}moveBeforeDOMNode(t,e=this.parentEl){this.parentEl=e,v.call(e,this.el,t)}moveBeforeVNode(t,e){v.call(this.parentEl,this.el,t?t.el:e)}toString(){const t=document.createElement("div");return this.mount(t,null),t.innerHTML}mount(e,n){const o=y.call(t,!0);v.call(e,o,n),this.el=o,this.parentEl=e}patch(t,e){}}c&&(w.prototype.mount=function(e,o){const s=y.call(t,!0),i=new Array(n);this.refs=i,i[0]=s;for(let t=0;t<p;t++){const e=m[t];i[32767&e]=f[e>>30&1].call(i[e>>15&32767])}if(l){const t=this.data;for(let e=0;e<l;e++)h[e].call(i[u[e]],t[e])}if(a){const t=this.children;for(let e=0;e<a;e++){const n=t[e];if(n){const t=g[e],o=t>>16&32767,s=o?i[o]:null;n.isOnlyChild=!!(32768&t),n.mount(i[32767&t],s)}}}if(v.call(e,s,o),this.el=s,this.parentEl=e,r.length){const t=this.data,e=this.refs;for(let n of r){(0,t[n])(e[u[n]],null)}}},w.prototype.patch=function(t,e){if(this===t)return;const n=this.refs;if(l){const e=this.data,o=t.data;for(let t=0;t<l;t++){const s=e[t],i=o[t];s!==i&&d[t].call(n[u[t]],i,s)}this.data=o}if(a){let o=this.children;const s=t.children;for(let t=0;t<a;t++){const i=o[t],r=s[t];if(i)r?i.patch(r,e):(e&&i.beforeRemove(),i.remove(),o[t]=void 0);else if(r){const e=g[t],s=e>>16&32767,i=s?n[s]:null;r.mount(n[32767&e],i),o[t]=r}}}},w.prototype.remove=function(){if(r.length){const t=this.data,e=this.refs;for(let n of r){(0,t[n])(null,e[u[n]])}}b.call(this.el)});return w}(t,e);if(e.children.length)return n=class extends n{children;constructor(t,e){super(t),this.children=e}},n.prototype.beforeRemove=ht.prototype.beforeRemove,(t,e=[])=>new n(t,e);return t=>new n(t)}(n.el,o);return It[t]=s,s}function Rt(t){if(t.nodeType!==Node.TEXT_NODE||/\S/.test(t.textContent)){if(t.nodeType!==Node.ELEMENT_NODE||"pre"!==t.tagName)for(let e=t.childNodes.length-1;e>=0;--e)Rt(t.childNodes.item(e))}else t.remove()}function Pt(t,n=null,o=null){switch(t.nodeType){case Node.ELEMENT_NODE:{let e=o&&o.currentNS;const s=t.tagName;let i;const r=[];if(s.startsWith("block-text-")){const t=parseInt(s.slice(11),10);r.push({type:"text",idx:t}),i=document.createTextNode("")}if(s.startsWith("block-child-")){o.isRef||Mt(o);const t=parseInt(s.slice(12),10);r.push({type:"child",idx:t}),i=document.createTextNode("")}if(e||=t.namespaceURI,i||(i=e?document.createElementNS(e,s):document.createElement(s)),i instanceof Element){if(!o){document.createElement("template").content.appendChild(i)}const e=t.attributes;for(let t=0;t<e.length;t++){const n=e[t].name,o=e[t].value;if(n.startsWith("block-handler-")){const t=parseInt(n.slice(14),10);r.push({type:"handler",idx:t,event:o})}else if(n.startsWith("block-attribute-")){const t=parseInt(n.slice(16),10);r.push({type:"attribute",idx:t,name:o,tag:s})}else if(n.startsWith("block-property-")){const t=parseInt(n.slice(15),10);r.push({type:"property",idx:t,name:o,tag:s})}else"block-attributes"===n?r.push({type:"attributes",idx:parseInt(o,10)}):"block-ref"===n?r.push({type:"ref",idx:parseInt(o,10)}):i.setAttribute(e[t].name,o)}}const l={parent:n,firstChild:null,nextSibling:null,el:i,info:r,refN:0,currentNS:e};if(t.firstChild){const e=t.childNodes[0];if(1===t.childNodes.length&&e.nodeType===Node.ELEMENT_NODE&&e.tagName.startsWith("block-child-")){const t=e.tagName,n=parseInt(t.slice(12),10);r.push({idx:n,type:"child",isOnlyChild:!0})}else{l.firstChild=Pt(t.firstChild,l,l),i.appendChild(l.firstChild.el);let e=t.firstChild,n=l.firstChild;for(;e=e.nextSibling;)n.nextSibling=Pt(e,n,l),i.appendChild(n.nextSibling.el),n=n.nextSibling}}return l.info.length&&Mt(l),l}case Node.TEXT_NODE:case Node.COMMENT_NODE:return{parent:n,firstChild:null,nextSibling:null,el:t.nodeType===Node.TEXT_NODE?document.createTextNode(t.textContent):document.createComment(t.textContent),info:[],refN:0,currentNS:null}}throw new e("boom")}function Mt(t){t.isRef=!0;do{t.refN++}while(t=t.parent)}function At(t){let e=t.parent;for(;e&&e.nextSibling===t;)t=e,e=e.parent;return e}function jt(t,e,n){if(!e){e={collectors:[],locations:[],children:new Array(t.info.filter(t=>"child"===t.type).length),cbRefs:[],refN:t.refN},n=0}if(t.refN){const o=n,s=t.isRef,i=t.firstChild?t.firstChild.refN:0,r=t.nextSibling?t.nextSibling.refN:0;if(s){for(let e of t.info)e.refIdx=o;t.refIdx=o,function(t,e){for(let n of e.info)switch(n.type){case"text":t.locations.push({idx:n.idx,refIdx:n.refIdx,setData:Bt,updateData:Bt});break;case"child":n.isOnlyChild?t.children[n.idx]={parentRefIdx:n.refIdx,isOnlyChild:!0}:t.children[n.idx]={parentRefIdx:At(e).refIdx,afterRefIdx:n.refIdx};break;case"property":{const e=n.refIdx,o=Ct(n.name);t.locations.push({idx:n.idx,refIdx:e,setData:o,updateData:o});break}case"attribute":{const e=n.refIdx;let o,s;"class"===n.name?(s=G,o=Z):"style"===n.name?(s=tt,o=et):(s=K(n.name),o=s),t.locations.push({idx:n.idx,refIdx:e,setData:s,updateData:o});break}case"attributes":t.locations.push({idx:n.idx,refIdx:n.refIdx,setData:H,updateData:X});break;case"handler":{const{setup:e,update:o}=nt(n.event);t.locations.push({idx:n.idx,refIdx:n.refIdx,setData:e,updateData:o});break}case"ref":t.locations.push({idx:n.idx,refIdx:n.refIdx,setData:Ot,updateData:Ot}),t.cbRefs.push(n.idx)}}(e,t),n++}if(r){const s=n+i;e.collectors.push({idx:s,prevIdx:o,getVal:Tt}),jt(t.nextSibling,e,s)}i&&(e.collectors.push({idx:n,prevIdx:o,getVal:kt}),jt(t.firstChild,e,n))}return e}function Bt(t){Dt.call(this,Nt(t))}let $t,Lt,Vt,Wt,Ft,Ut;if("undefined"!=typeof Node){const t=Node.prototype;$t=t.insertBefore,Lt=t.appendChild,Vt=t.removeChild,Wt=((t,e)=>Object.getOwnPropertyDescriptor(t,e))(t,"textContent").set}class qt{children;anchor;parentEl;isOnlyChild;constructor(t){this.children=t}mount(t,e){const n=this.children,o=document.createTextNode("");this.anchor=o,$t.call(t,o,e);const s=n.length;if(s){const e=n[0].mount;for(let i=0;i<s;i++)e.call(n[i],t,o)}this.parentEl=t}moveBeforeDOMNode(t,e=this.parentEl){this.parentEl=e;const n=this.children;for(let o=0,s=n.length;o<s;o++)n[o].moveBeforeDOMNode(t,e);e.insertBefore(this.anchor,t)}moveBeforeVNode(t,e){if(t){const n=t.children[0];e=(n?n.firstNode():t.anchor)||null}const n=this.children;for(let t=0,o=n.length;t<o;t++)n[t].moveBeforeVNode(null,e);this.parentEl.insertBefore(this.anchor,e)}patch(t,e){if(this===t)return;const n=this.children,o=t.children;if(0===o.length&&0===n.length)return;this.children=o;const s=o[0]||n[0],{mount:i,patch:r,remove:l,beforeRemove:a,moveBeforeVNode:c,firstNode:u}=s,h=this.anchor,d=this.isOnlyChild,f=this.parentEl;if(0===o.length&&d){if(e)for(let t=0,e=n.length;t<e;t++)a.call(n[t]);return Wt.call(f,""),void Lt.call(f,h)}let p,m=0,g=0,y=n[0],v=o[0],b=n.length-1,w=o.length-1,N=n[b],E=o[w];for(;m<=b&&g<=w;){if(null===y){y=n[++m];continue}if(null===N){N=n[--b];continue}let t=y.key,s=v.key;if(t===s){r.call(y,v,e),o[g]=y,y=n[++m],v=o[++g];continue}let l=N.key,a=E.key;if(l===a){r.call(N,E,e),o[w]=N,N=n[--b],E=o[--w];continue}if(t===a){r.call(y,E,e),o[w]=y;const t=o[w+1];c.call(y,t,h),y=n[++m],E=o[--w];continue}if(l===s){r.call(N,v,e),o[g]=N;const t=n[m];c.call(N,t,h),N=n[--b],v=o[++g];continue}p=p||Ht(n,m,b);let d=p[s];if(void 0===d)i.call(v,f,u.call(y)||null);else{const t=n[d];c.call(t,y,null),r.call(t,v,e),o[g]=t,n[d]=null}v=o[++g]}if(m<=b||g<=w)if(m>b){const t=o[w+1],e=t?u.call(t)||null:h;for(let t=g;t<=w;t++)i.call(o[t],f,e)}else for(let t=m;t<=b;t++){let o=n[t];o&&(e&&a.call(o),l.call(o))}}beforeRemove(){const t=this.children,e=t.length;if(e){const n=t[0].beforeRemove;for(let o=0;o<e;o++)n.call(t[o])}}remove(){const{parentEl:t,anchor:e}=this;if(this.isOnlyChild)Wt.call(t,"");else{const n=this.children,o=n.length;if(o){const t=n[0].remove;for(let e=0;e<o;e++)t.call(n[e])}Vt.call(t,e)}}firstNode(){const t=this.children[0];return t?t.firstNode():void 0}toString(){return this.children.map(t=>t.toString()).join("")}}function Kt(t){return new qt(t)}function Ht(t,e,n){let o={};for(let s=e;s<=n;s++)o[t[s].key]=s;return o}if("undefined"!=typeof Node){const t=Node.prototype;Ft=t.insertBefore,Ut=t.removeChild}class Xt{html;parentEl;content=[];constructor(t){this.html=t}mount(t,e){this.parentEl=t;const n=document.createElement("template");n.innerHTML=this.html,this.content=[...n.content.childNodes];for(let n of this.content)Ft.call(t,n,e);if(!this.content.length){const n=document.createTextNode("");this.content.push(n),Ft.call(t,n,e)}}moveBeforeDOMNode(t,e=this.parentEl){this.parentEl=e;for(let n of this.content)Ft.call(e,n,t)}moveBeforeVNode(t,e){const n=t?t.content[0]:e;this.moveBeforeDOMNode(n)}patch(t){if(this===t)return;const e=t.html;if(this.html!==e){const n=this.parentEl,o=this.content[0],s=document.createElement("template");s.innerHTML=e;const i=[...s.content.childNodes];for(let t of i)Ft.call(n,t,o);if(!i.length){const t=document.createTextNode("");i.push(t),Ft.call(n,t,o)}this.remove(),this.content=i,this.html=t.html}}beforeRemove(){}remove(){const t=this.parentEl;for(let e of this.content)Ut.call(t,e)}firstNode(){return this.content[0]}toString(){return this.html}}function zt(t){return new Xt(t)}function Gt(t,e,n=null){t.mount(e,n)}function Zt(){throw new e("Attempted to render cancelled fiber")}function Jt(t){let e=0;for(let n of t){let t=n.node;n.render=Zt,0===t.status&&t.cancel(),t.fiber=null,n.bdom?t.forceNextRender=!0:e++,e+=Jt(n.children)}return e}class Qt{node;bdom=null;root;parent;children=[];appliedToDom=!1;deep=!1;childrenMap={};constructor(t,e){if(this.node=t,this.parent=e,e){this.deep=e.deep;const t=e.root;t.setCounter(t.counter+1),this.root=t,e.children.push(this)}else this.root=this}render(){let t=this.root.node,e=t.app.scheduler,n=t.parent;for(;n;){if(n.fiber){let o=n.fiber.root;if(0!==o.counter||!(t.parentKey in n.fiber.childrenMap))return void e.delayedRenders.push(this);n=o.node}t=n,n=n.parent}this._render()}_render(){const t=this.node,e=this.root;if(e){const n=b();E(t.signalComputation),w(t.signalComputation);try{this.bdom=!0,this.bdom=t.renderFn()}catch(e){t.app.handleError({node:t,error:e})}w(n),e.setCounter(e.counter-1)}}}class Yt extends Qt{counter=1;willPatch=[];patched=[];mounted=[];locked=!1;complete(){const t=this.node;let e;this.locked=!0;let n=this.mounted;try{for(e of this.willPatch){let t=e.node;if(t.fiber===e){const e=t.component;for(let n of t.willPatch)n.call(e)}}for(e=void 0,t._patch(),this.locked=!1;e=n.pop();)if(e.appliedToDom)for(let t of e.node.mounted)t();let o=this.patched;for(;e=o.pop();)if(e.appliedToDom)for(let t of e.node.patched)t()}catch(o){for(let t of n)t.node.willUnmount=[];this.locked=!1,t.app.handleError({fiber:e||this,error:o})}}setCounter(t){this.counter=t,0===t&&this.node.app.scheduler.flush()}}class te extends Yt{target;position;constructor(t,e,n={}){super(t,null),this.target=e,this.position=n.position||"last-child"}complete(){let t=this;try{const e=this.node;if(e.children=this.childrenMap,e.app.constructor.validateTarget(this.target),e.bdom)e.updateDom();else if(e.bdom=this.bdom,"last-child"===this.position||0===this.target.childNodes.length)Gt(e.bdom,this.target);else{const t=this.target.childNodes[0];Gt(e.bdom,this.target,t)}e.fiber=null,e.status=1,this.appliedToDom=!0;let n=this.mounted;for(;t=n.pop();)if(t.appliedToDom)for(let e of t.node.mounted)e()}catch(e){this.node.app.handleError({fiber:t,error:e})}}}class ee{el;app;fiber=null;component;bdom=null;status=0;forceNextRender=!1;parentKey;props;defaultProps={};renderFn;parent;children=Object.create(null);willStart=[];willUpdateProps=[];willUnmount=[];mounted=[];willPatch=[];patched=[];willDestroy=[];signalComputation;computations=[];pluginManager;constructor(t,e,o,s,i){this.app=o,this.parent=s,this.parentKey=i,this.pluginManager=s?s.pluginManager:o.pluginManager,this.signalComputation=m(()=>this.render(!1),!1,h.EXECUTED),this.props=e,n.push({type:"component",app:o,componentName:t.name,node:this,get status(){return this.node.status}});const r=b();w(void 0),this.component=new t(this);const l={this:this.component,__owl__:this};this.renderFn=o.getTemplate(t.template).bind(this.component,l,this),this.component.setup(),w(r),n.length=0}mountComponent(t,e){const n=new te(this,t,e);this.app.scheduler.addFiber(n);let o=b();this.initiateRender(n),w(o)}async initiateRender(t){this.fiber=t,this.mounted.length&&t.root.mounted.push(t);const e=this.component;let n=b();w(void 0);try{let t=this.willStart.map(t=>t.call(e));w(n),await Promise.all(t)}catch(t){return void this.app.handleError({node:this,error:t})}0===this.status&&this.fiber===t&&t.render()}async render(t){if(this.status>=2)return;let e=this.fiber;if(e&&(e.root.locked||!0===e.bdom)&&(await Promise.resolve(),e=this.fiber),e){if(!e.bdom&&!k.has(e))return void(t&&(e.deep=t));t=t||e.deep}else if(!this.bdom)return;const n=function(t){let e=t.fiber;if(e){let t=e.root;return t.locked=!0,t.setCounter(t.counter+1-Jt(e.children)),t.locked=!1,e.children=[],e.childrenMap={},e.bdom=null,k.has(e)&&(k.delete(e),k.delete(t),e.appliedToDom=!1,e instanceof Yt&&(e.mounted=e instanceof te?[e]:[])),e}const n=new Yt(t,null);return t.willPatch.length&&n.willPatch.push(n),t.patched.length&&n.patched.push(n),n}(this);n.deep=t,this.fiber=n,this.app.scheduler.addFiber(n),await Promise.resolve(),this.status>=2||this.fiber!==n||!e&&n.parent||n.render()}cancel(){this._cancel(),delete this.parent.children[this.parentKey],this.app.scheduler.scheduleDestroy(this)}_cancel(){this.status=2;const t=this.children;for(let e in t)t[e]._cancel()}destroy(){let t=1===this.status;this._destroy(),t&&this.bdom.remove()}_destroy(){const t=this.component;if(1===this.status)for(let e of this.willUnmount)e.call(t);for(let t in this.children)this.children[t]._destroy();if(this.willDestroy.length)try{for(let e of this.willDestroy)e.call(t)}catch(t){this.app.handleError({error:t,node:this})}for(const t of this.computations)x(t);x(this.signalComputation),this.status=3}async updateAndRender(t,e){t=Object.assign({},t);for(const e in this.defaultProps)void 0===t[e]&&(t[e]=this.defaultProps[e]);const n=function(t,e){let n=t.fiber;return n&&(Jt(n.children),n.root=null),new Qt(t,e)}(this,e);this.fiber=n;const o=this.component;let s=b();w(void 0);let i=this.willUpdateProps.map(e=>e.call(o,t));if(w(s),await Promise.all(i),n!==this.fiber)return;this.props=t,n.render();const r=e.root;this.willPatch.length&&r.willPatch.push(n),this.patched.length&&r.patched.push(n)}updateDom(){if(this.fiber)if(this.bdom===this.fiber.bdom)for(let t in this.children){this.children[t].updateDom()}else this.bdom.patch(this.fiber.bdom,!1),this.fiber.appliedToDom=!0,this.fiber=null}firstNode(){const t=this.bdom;return t?t.firstNode():void 0}mount(t,e){const n=this.fiber.bdom;this.bdom=n,n.mount(t,e),this.status=1,this.fiber.appliedToDom=!0,this.children=this.fiber.childrenMap,this.fiber=null}moveBeforeDOMNode(t,e){this.bdom.moveBeforeDOMNode(t,e)}moveBeforeVNode(t,e){this.bdom.moveBeforeVNode(t?t.bdom:null,e)}patch(){this.fiber&&this.fiber.parent&&this._patch()}_patch(){let t=!1;for(let e in this.children){t=!0;break}const e=this.fiber;this.children=e.childrenMap,this.bdom.patch(e.bdom,t),e.appliedToDom=!0,this.fiber=null}beforeRemove(){this._destroy()}remove(){this.bdom.remove()}}function ne(t){const e=m(()=>(w(void 0),oe(e),w(e),t()),!1);return b()?.observers.add(e),N(e),function(){const t=b();w(void 0),oe(e),w(t)}}function oe(t){E(t),function(t){const e=t.value;e&&"function"==typeof e&&(e(),t.value=void 0)}(t);for(const e of t.observers)e.state=h.EXECUTED,E(e),oe(e);t.observers.clear()}class se{static _shadowId;static get id(){return this._shadowId??this.name}static set id(t){this._shadowId=t}__owl__;constructor(t){this.__owl__=t}setup(){}}class ie{app;config;onDestroyCb=[];computations=[];plugins;status=0;constructor(t,e={}){if(this.app=t,this.config=e.config??{},e.parent){const t=e.parent;t.onDestroyCb.push(()=>this.destroy()),this.plugins=Object.create(t.plugins)}else this.plugins={}}destroy(){const t=this.onDestroyCb;for(;t.length;)t.pop()();for(const t of this.computations)x(t);this.status=3}getPluginById(t){return this.plugins[t]||null}getPlugin(t){return this.getPluginById(t.id)}startPlugin(t){if(!t.id)throw new e(`Plugin "${t.name}" has no id`);if(this.plugins.hasOwnProperty(t.id)){const n=this.getPluginById(t.id).constructor;if(n!==t)throw new e(`Trying to start a plugin with the same id as an other plugin (id: '${t.id}', existing plugin: '${n.name}', starting plugin: '${t.name}')`);return null}const n=new t(this);return this.plugins[t.id]=n,n.setup(),n}startPlugins(t){n.push({type:"plugin",app:this.app,manager:this,get status(){return this.manager.status}});try{for(const e of t)this.startPlugin(e)}finally{n.pop()}this.status=1}}function re(t,e){Array.isArray(e)?t.startPlugins(e):t.onDestroyCb.push(ne(()=>{const n=e.items();D(()=>t.startPlugins(n))}))}const le=Symbol("Key changes"),ae=Object.prototype.toString,ce=Object.prototype.hasOwnProperty;function ue(t){if("object"!=typeof t||null===t)return!1;const e=pe(t);return!!(Array.isArray(e)||e instanceof Set||e instanceof Map||e instanceof WeakMap)||"[object Object]"===ae.call(e)}function he(t,e){return!e&&ue(t)?Ne(t):t}const de=new WeakSet;function fe(t){return de.add(t),t}function pe(t){return ve.has(t)?ve.get(t):t}const me=new WeakMap;function ge(t,e,n){g(n??function(t,e){let n=me.get(t);n||(n=new Map,me.set(t,n));let o=n.get(e);return o||(o={value:void 0,observers:new Set},n.set(e,o)),o}(t,e))}function ye(t,e,n){if(!n){const o=me.get(t);if(!o)return;if(!o.has(e))return;n=o.get(e)}y(n)}const ve=new WeakMap,be=new WeakMap;function we(t,n){if(!ue(t))throw new e("Cannot make the given value reactive");if(de.has(t))return t;if(ve.has(t))return t;const o=be.get(t);if(o)return o;let s;s=t instanceof Map?Ce(t,"Map",n):t instanceof Set?Ce(t,"Set",n):t instanceof WeakMap?Ce(t,"WeakMap",n):Ee(n);const i=new Proxy(t,s);return be.set(t,i),ve.set(i,t),i}function Ne(t){return we(t,null)}function Ee(t){return{get(e,n,o){ge(e,n,t);const s=Reflect.get(e,n,o);if(t||"object"!=typeof s||null===s)return s;if(!ue(s))return s;const i=Object.getOwnPropertyDescriptor(e,n);return!i||i.writable||i.configurable?we(s,null):s},set(e,n,o,s){const i=ce.call(e,n),r=Reflect.get(e,n,s),l=Reflect.set(e,n,pe(o),s);return!i&&ce.call(e,n)&&ye(e,le,t),(r!==Reflect.get(e,n,s)||"length"===n&&Array.isArray(e))&&ye(e,n,t),l},deleteProperty(e,n){const o=Reflect.deleteProperty(e,n);return ye(e,le,t),ye(e,n,t),o},ownKeys:e=>(ge(e,le,t),Reflect.ownKeys(e)),has:(e,n)=>(ge(e,le,t),Reflect.has(e,n))}}function xe(t,e,n){return o=>(o=pe(o),ge(e,o,n),he(e[t](o),n))}function _e(t,e,n){return function*(){ge(e,le,n);const o=e.keys();for(const s of e[t]()){const t=o.next().value;ge(e,t,n),yield he(s,n)}}}function De(t,e){return function(n,o){ge(t,le,e),t.forEach(function(s,i,r){ge(t,i,e),n.call(o,he(s,e),he(i,e),he(r,e))},o)}}function ke(t,e,n,o){return(s,i)=>{s=pe(s);const r=n.has(s),l=n[e](s),a=n[t](s,i);return r!==n.has(s)&&ye(n,le,o),l!==n[e](s)&&ye(n,s,o),a}}function Te(t,e){return()=>{const n=[...t.keys()];t.clear(),ye(t,le,e);for(const o of n)ye(t,o,e)}}const Oe={Set:(t,e)=>({has:xe("has",t,e),add:ke("add","has",t,e),delete:ke("delete","has",t,e),keys:_e("keys",t,e),values:_e("values",t,e),entries:_e("entries",t,e),[Symbol.iterator]:_e(Symbol.iterator,t,e),forEach:De(t,e),clear:Te(t,e),get size(){return ge(t,le,e),t.size}}),Map:(t,e)=>({has:xe("has",t,e),get:xe("get",t,e),set:ke("set","get",t,e),delete:ke("delete","has",t,e),keys:_e("keys",t,e),values:_e("values",t,e),entries:_e("entries",t,e),[Symbol.iterator]:_e(Symbol.iterator,t,e),forEach:De(t,e),clear:Te(t,e),get size(){return ge(t,le,e),t.size}}),WeakMap:(t,e)=>({has:xe("has",t,e),get:xe("get",t,e),set:ke("set","get",t,e),delete:ke("delete","has",t,e)})};function Ce(t,e,n){const o=Oe[e](t,n);return Object.assign(Ee(n),{get:(t,e)=>ce.call(o,e)?o[e]:(ge(t,e,n),he(t[e],n))})}let Ie;"undefined"!=typeof window&&(Ie=window.requestAnimationFrame.bind(window));class Se{static requestAnimationFrame=Ie;tasks=new Set;requestAnimationFrame;frame=0;delayedRenders=[];cancelledNodes=new Set;processing=!1;constructor(){this.requestAnimationFrame=Se.requestAnimationFrame}addFiber(t){this.tasks.add(t.root)}scheduleDestroy(t){this.cancelledNodes.add(t),0===this.frame&&(this.frame=this.requestAnimationFrame(()=>this.processTasks()))}flush(){if(this.delayedRenders.length){let t=this.delayedRenders;this.delayedRenders=[];for(let e of t)e.root&&3!==e.node.status&&e.node.fiber===e&&e.render()}0===this.frame&&(this.frame=this.requestAnimationFrame(()=>this.processTasks()))}processTasks(){if(!this.processing){this.processing=!0,this.frame=0;for(let t of this.cancelledNodes)t._destroy();this.cancelledNodes.clear();for(let t of this.tasks)this.processFiber(t);for(let t of this.tasks)3===t.node.status&&this.tasks.delete(t);this.processing=!1}}processFiber(t){if(t.root!==t)return void this.tasks.delete(t);const e=k.has(t);e&&0!==t.counter?this.tasks.delete(t):3!==t.node.status?0===t.counter&&(e||t.complete(),t.appliedToDom&&this.tasks.delete(t)):this.tasks.delete(t)}}class Re{static template="";__owl__;constructor(t){this.__owl__=t}setup(){}}const Pe=Object.create;class Me{fn;ctx;component;node;key;constructor(t,e,n,o,s){this.fn=t,this.ctx=e,this.component=n,this.node=o,this.key=s}evaluate(){return this.fn.call(this.component,this.ctx,this.node,this.key)}toString(){return this.evaluate().toString()}}const Ae={withDefault:function(t,e){return null==t||!1===t?e:t},zero:Symbol("zero"),callSlot:function(t,e,n,o,s,i,r){n=n+"__slot_"+o;const l=t.__owl__.props.slots||{},{__render:a,__ctx:c,__scope:u}=l[o]||{},h=Pe(c||{});u&&(h[u]=i);const d=a?a(h,e,n):null;if(r){let i,l;return d?i=s?A(o,d):d:l=r(t,e,n),dt([i,l])}return d||bt("")},withKey:function(t,e){return t.key=e,t},prepareList:function(t){let n,o;if(Array.isArray(t))n=t,o=t;else if(t instanceof Map)n=[...t.keys()],o=[...t.values()];else if(Symbol.iterator in Object(t))n=[...t],o=n;else{if(!t||"object"!=typeof t)throw new e(`Invalid loop expression: "${t}" is not iterable`);o=Object.values(t),n=Object.keys(t)}const s=o.length;return[n,o,s,new Array(s)]},shallowEqual:function(t,e){for(let n=0,o=t.length;n<o;n++)if(t[n]!==e[n])return!1;return!0},toNumber:function(t){const e=parseFloat(t);return isNaN(e)?t:e},LazyValue:Me,safeOutput:function(t,e){if(null==t)return e?A("default",e):A("undefined",bt(""));let n,o;return t instanceof a?(n="string_safe",o=zt(t)):t instanceof Me?(n="lazy_value",o=t.evaluate()):(n="string_unsafe",o=bt(t)),A(n,o)},createCatcher:function(t){const e=Object.keys(t).length;class n{child;handlerData;handlerFns=[];parentEl;afterNode=null;constructor(t,e){this.child=t,this.handlerData=e}mount(e,n){this.parentEl=e,this.child.mount(e,n),this.afterNode=document.createTextNode(""),e.insertBefore(this.afterNode,n),this.wrapHandlerData();for(let n in t){const o=t[n],s=nt(n);this.handlerFns[o]=s,s.setup.call(e,this.handlerData[o])}}wrapHandlerData(){for(let t=0;t<e;t++){let e=this.handlerData[t],n=e.length-2,o=e[n];const s=this;e[n]=function(t,e){const n=e.target;let i=s.child.firstNode();const r=s.afterNode;for(;i&&i!==r;){if(i.contains(n))return o(t,e);i=i.nextSibling}}}}moveBeforeDOMNode(t,e=this.parentEl){this.parentEl=e,this.child.moveBeforeDOMNode(t,e),e.insertBefore(this.afterNode,t)}moveBeforeVNode(t,e){t&&(e=t.firstNode()||e),this.child.moveBeforeVNode(t?t.child:null,e),this.parentEl.insertBefore(this.afterNode,e)}patch(t,n){if(this!==t){this.handlerData=t.handlerData,this.wrapHandlerData();for(let t=0;t<e;t++)this.handlerFns[t].update.call(this.parentEl,this.handlerData[t]);this.child.patch(t.child,n)}}beforeRemove(){this.child.beforeRemove()}remove(){for(let t=0;t<e;t++)this.handlerFns[t].remove.call(this.parentEl);this.child.remove(),this.afterNode.remove()}firstNode(){return this.child.firstNode()}toString(){return this.child.toString()}}return function(t,e){return new n(t,e)}},markRaw:fe,OwlError:e,createRef:function(t){if(!t)throw new e("Ref is undefined or null");let n,o;if(t.add&&t.delete)n=t.add.bind(t),o=t.delete.bind(t);else{if(!t.set)throw new e("Ref should implement either a 'set' function or 'add' and 'delete' functions");n=t.set.bind(t),o=()=>t.set(null)}return(t,e)=>{e&&o(e),t&&n(t)}},modelExpr:function(t){if("function"!=typeof t||"function"!=typeof t.set)throw new e("Invalid t-model expression: expression should evaluate to a function with a 'set' method defined on it");return t},createComponent:function(t,n,o,s,i,r){const l=!o;let a;const c=0===r.length;a=s?(t,e)=>!0:i?function(t,e){for(let n in t)if(t[n]!==e[n])return!0;return Object.keys(t).length!==Object.keys(e).length}:c?(t,e)=>!1:function(t,e){for(let n of r)if(t[n]!==e[n])return!0;return!1};const u=ee.prototype.updateAndRender,h=ee.prototype.initiateRender;return(s,i,r,c,d)=>{let f=r.children,p=f[i];l&&p&&p.component.constructor!==d&&(p=void 0);const m=r.fiber;if(p)(a(p.props,s)||m.deep||p.forceNextRender)&&(p.forceNextRender=!1,u.call(p,s,m));else{if(o){const t=c.constructor.components;if(!t)throw new e(`Cannot find the definition of component "${n}", missing static components key in parent`);if(!(d=t[n]))throw new e(`Cannot find the definition of component "${n}"`);if(!(d.prototype instanceof Re))throw new e(`"${n}" is not a Component. It must inherit from the Component class`)}p=new ee(d,s,t,r,i),f[i]=p,h.call(p,new Qt(p,m))}return m.childrenMap[i]=p,p}},callTemplate:function(t,e,n,o,s,i){return A(t,n.getTemplate(t).call(e,o,s,i+t))},callHandler:function(t,n,o){if("function"!=typeof t)throw new e(`Invalid handler expression: the \`t-on\` expression should evaluate to a function, but got '${typeof t}'. Did you mean to use an arrow function? (e.g. \`t-on-click="() => expr"\`)`);t.call(n.this,o)}},je={text:bt,createBlock:St,list:Kt,multi:dt,html:zt,toggler:A,comment:wt};class Be{static registerTemplate(t,e){$e[t]=e}dev;rawTemplates=Object.create($e);templates={};getRawTemplate;translateFn;translatableAttributes;customDirectives;runtimeUtils;hasGlobalValues;constructor(t={}){if(this.dev=t.dev||!1,this.translateFn=t.translateFn,this.translatableAttributes=t.translatableAttributes,t.templates)if(t.templates instanceof Document||"string"==typeof t.templates)this.addTemplates(t.templates);else for(const e in t.templates)this.addTemplate(e,t.templates[e]);this.getRawTemplate=t.getTemplate,this.customDirectives=t.customDirectives||{},this.runtimeUtils={...Ae,__globals__:t.globalValues||{}},this.hasGlobalValues=Boolean(t.globalValues&&Object.keys(t.globalValues).length)}addTemplate(t,n){if(t in this.rawTemplates){if(!this.dev)return;const o=this.rawTemplates[t];if(("string"==typeof o?o:o instanceof Element?o.outerHTML:o.toString())===("string"==typeof n?n:n.outerHTML))return;throw new e(`Template ${t} already defined with different content`)}this.rawTemplates[t]=n}addTemplates(t){if(t){t=t instanceof Document?t:function(t){const n=(new DOMParser).parseFromString(t,"text/xml");if(n.getElementsByTagName("parsererror").length){let o="Invalid XML in template.";const s=n.getElementsByTagName("parsererror")[0].textContent;if(s){o+="\nThe parser has produced the following error message:\n"+s;const e=/\d+/g,n=e.exec(s);if(n){const i=Number(n[0]),r=t.split("\n")[i-1],l=e.exec(s);if(r&&l){const t=Number(l[0])-1;r[t]&&(o+=`\nThe error might be located at xml line ${i} column ${t}\n${r}\n${"-".repeat(t-1)}^`)}}}throw new e(o)}return n}(t);for(const e of t.querySelectorAll("[t-name]")){const t=e.getAttribute("t-name");this.addTemplate(t,e)}}}getTemplate(t){const n=t;if(!(n in this.templates)){const s=this.getRawTemplate?.(t)||this.rawTemplates[t];if(void 0===s){let n="";try{const{componentName:t}=o("component");n=` (for component "${t}")`}catch{}throw new e(`Missing template: "${t}"${n}`)}const i="function"==typeof s&&!(s instanceof Element)?s:this._compileTemplate(t,s),r=this.templates;this.templates[n]=function(t,e){return r[n].call(this,t,e)};const l=i(this,je,this.runtimeUtils);this.templates[n]=l}return this.templates[n]}_compileTemplate(t,n){throw new e("Unable to compile a template. Please use owl full build instead")}}const $e={};function Le(...t){const e="__template__"+Le.nextId++,n=String.raw(...t);return $e[e]=n,e}Le.nextId=1;let Ve=!1;const We=new Set;"undefined"!=typeof window&&(window.__OWL_DEVTOOLS__||={apps:We,Fiber:Qt,RootFiber:Yt,toRaw:pe,proxy:Ne});class Fe extends Be{static validateTarget=r;static apps=We;static version="3.0.0-alpha.21";name;scheduler=new Se;roots=new Set;pluginManager;constructor(t={}){super(t),this.name=t.name||"",We.add(this),this.pluginManager=new ie(this,{config:t.config}),t.plugins&&re(this.pluginManager,t.plugins),t.test&&(this.dev=!0),!this.dev||t.test||Ve||(console.info("Owl is running in 'dev' mode."),Ve=!0)}createRoot(t,e={}){const o=e.props||{};let s,i;const r=new Promise((t,e)=>{s=t,i=e}),l=function(){const t=n.slice();return()=>{n=t}}();let a,c=null;try{a=new ee(t,o,this,null,null)}catch(t){c=t,i(t)}finally{l()}const u={node:a,promise:r,mount:(t,e)=>(c||(Fe.validateTarget(t),this.mountNode(a,t,s,i,e)),r),destroy:()=>{this.roots.delete(u),a.destroy(),this.scheduler.processTasks()}};return this.roots.add(u),u}mountNode(t,e,n,o,s){let i=T.get(t);i||(i=[],T.set(t,i)),i.unshift((t,e)=>{const n=e();o(n)}),t.mounted.push(()=>{n(t.component),i.shift()}),t.mountComponent(e,s)}destroy(){for(let t of this.roots)t.destroy();this.pluginManager.destroy(),this.scheduler.processTasks(),We.delete(this)}handleError(...t){return I(...t)}}function Ue(t,e,n){const o=e.bind(t.component);if(t.app.dev){const t=e.name?` <${e.name}>`:"";Reflect.defineProperty(o,"name",{value:n+t})}return o}function qe(t){const e=o();"component"===e.type?e.node.willDestroy.unshift(Ue(e.node,t,"onWillDestroy")):e.manager.onDestroyCb.push(t)}function Ke(t,e={}){const o=m(()=>{const e=t();return Object.is(o.value,e)||y(o),e},!0);function s(){return o.state!==h.EXECUTED&&N(o),g(o),o.value}s[d]=o,s.set=e.set??(()=>{});const i=n.at(-1);return i&&("component"===i.type?i.node.computations.push(o):"plugin"===i.type&&i.manager.computations.push(o)),s}function He(t,e){const n={type:"signal",value:t,observers:new Set};let o=e(n);const s=()=>(g(n),o);return s[d]=n,s.set=function(t){Object.is(n.value,t)||(n.value=t,o=e(n),y(n))},s}function Xe(t){return He(t,t=>t.value)}function ze(t,n,o="Value does not match the type"){const s=Ze(t,n);if(s.length){const t=JSON.stringify(s,(t,e)=>"function"==typeof e?e.name:e,2);throw new e(`${o}\n${t}`)}}function Ge(t,e,n,o){return{issueDepth:0,path:n,value:e,get isValid(){return!t.length},addIssue(e){t.push({received:this.value,path:this.path,...e})},mergeIssues(e){t.push(...e)},validate(t){t(this),!this.isValid&&o&&(o.issueDepth=this.issueDepth+1)},withIssues(t){return Ge(t,this.value,this.path,this)},withKey(e){return Ge(t,this.value[e],this.path.concat(e),this)}}}function Ze(t,e){const n=[];return e(Ge(n,t,[])),n}Xe.invalidate=function(t){if("function"!=typeof t||"signal"!==t[d]?.type)throw new e(`Value is not a signal (${t})`);y(t[d])},Xe.Array=function(t){return He(t,t=>we(t.value,t))},Xe.Map=function(t){return He(t,t=>we(t.value,t))},Xe.Object=function(t){return He(t,t=>we(t.value,t))},Xe.Set=function(t){return He(t,t=>we(t.value,t))};function Je(t){return function(e){e.value instanceof t||e.addIssue({message:`value is not an instance of '${t.name}'`})}}function Qe(t){return function(e){e.value!==t&&e.addIssue({message:`value is not equal to ${"string"==typeof t?`'${t}'`:t}`})}}function Ye(t,e,n){if("object"!=typeof t.value||Array.isArray(t.value)||null===t.value)return void t.addIssue({message:"value is not an object"});if(!e)return;const o=!Array.isArray(e);let s=e;if(Array.isArray(e)){s={};for(const t of e)s[t]=null}const i=[];for(const e in s){const n=e.endsWith("?")?e.slice(0,-1):e;void 0!==t.value[n]?o&&t.withKey(n).validate(s[e]):e.endsWith("?")||i.push(n)}if(i.length&&t.addIssue({message:"object value has missing keys",missingKeys:i}),n){const e=[];for(const n in t.value)n in s||`${n}?`in s||e.push(n);e.length&&t.addIssue({message:"object value has unknown keys",unknownKeys:e})}}function tn(t){return function(e){let n=0;const o=[];for(const s of t){const t=e.withIssues(o);if(t.validate(s),o.length===n||t.issueDepth>0)return void e.mergeIssues(o.slice(n));n=o.length}e.addIssue({message:"value does not match union type",subIssues:o})}}const en={and:function(t){return function(e){for(const n of t)e.validate(n)}},any:function(){},array:function(t){return function(e){if(Array.isArray(e.value)){if(t)for(let n=0;n<e.value.length;n++)e.withKey(n).validate(t)}else e.addIssue({message:"value is not an array"})}},boolean:function(t){"boolean"!=typeof t.value&&t.addIssue({message:"value is not a boolean"})},constructor:function(t){return function(e){"function"==typeof e.value&&(e.value===t||e.value.prototype instanceof t)||e.addIssue({message:`value is not '${t.name}' or an extension`})}},customValidator:function(t,e,n="value does not match custom validation"){return function(o){o.validate(t),o.isValid&&(e(o.value)||o.addIssue({message:n}))}},function:function(t=[],e=void 0){return function(t){"function"!=typeof t.value&&t.addIssue({message:"value is not a function"})}},instanceOf:Je,literal:Qe,number:function(t){"number"!=typeof t.value&&t.addIssue({message:"value is not a number"})},object:function(t={}){return function(e){Ye(e,t,!1)}},or:tn,promise:function(t){return function(t){t.value instanceof Promise||t.addIssue({message:"value is not a promise"})}},record:function(t){return function(e){if("object"!=typeof e.value||Array.isArray(e.value)||null===e.value)e.addIssue({message:"value is not an object"});else if(t)for(const n in e.value)e.withKey(n).validate(t)}},ref:function(t){return tn([Qe(null),Je(t)])},selection:function(t){return tn(t.map(Qe))},signal:function(t){return function(t){"function"==typeof t.value&&t.value[d]||t.addIssue({message:"value is not a reactive value"})}},strictObject:function(t){return function(e){Ye(e,t,!0)}},string:function(t){"string"!=typeof t.value&&t.addIssue({message:"value is not a string"})},tuple:function(t){return function(e){if(Array.isArray(e.value))if(e.value.length===t.length)for(let n=0;n<t.length;n++)e.withKey(n).validate(t[n]);else e.addIssue({message:"tuple value does not have the correct length"});else e.addIssue({message:"value is not an array"})}}};function nn(t){qe(ne(t))}R.shouldNormalizeDom=!1,R.mainEventHandler=(t,n,o)=>{const{data:s,modifiers:i}=S(t);t=s;let r=!1;if(i.length){let t=!1;const e=n.target===o;for(const o of i)switch(o){case"self":if(t=!0,e)continue;return r;case"prevent":(t&&e||!t)&&n.preventDefault();continue;case"stop":(t&&e||!t)&&n.stopPropagation(),r=!0;continue}}if(Object.hasOwnProperty.call(t,0)){const o=t[0];if("function"!=typeof o)throw new e(`Invalid handler (expected a function, received: '${o}')`);let s=t[1]?t[1].__owl__:null;s&&1!==s.status||o(t[1],n)}return r};const on={config:R,mount:Gt,patch:function(t,e,n=!1){t.patch(e,n)},remove:function(t,e=!1){e&&t.beforeRemove(),t.remove()},list:Kt,multi:dt,text:bt,toggler:A,createBlock:St,html:zt,comment:wt},sn={version:Fe.version};t.App=Fe,t.Component=Re,t.EventBus=l,t.OwlError=e,t.Plugin=se,t.Registry=class{_map=Xe.Object(Object.create(null));_name;_validation;constructor(t={}){this._name=t.name||"registry",this._validation=t.validation}entries=Ke(()=>Object.entries(this._map()).sort((t,e)=>t[1][0]-e[1][0]).map(([t,e])=>[t,e[1]]));items=Ke(()=>this.entries().map(t=>t[1]));addById(t,n={}){if(!t.id)throw new e(`Item should have an id key (registry '${this._name}')`);return this.add(t.id,t,{sequence:n.sequence??50})}add(t,e,n={}){if(this._validation){const n=this._name?` (registry '${this._name}', key: '${t}')`:` (key: '${t}')`;ze(e,this._validation,`Registry entry does not match the type${n}`)}return this._map()[t]=[n.sequence??50,e],this}get(t,e){const n=t in this._map();if(!n&&arguments.length<2)throw new Error(`KeyNotFoundError: Cannot find key "${t}" (registry '${this._name}')`);return n?this._map()[t][1]:e}delete(t){delete this._map()[t]}has(t){return t in this._map()}},t.Resource=class{_items=Xe.Array([]);_name;_validation;constructor(t={}){this._name=t.name,this._validation=t.validation}items=Ke(()=>this._items().sort((t,e)=>t[0]-e[0]).map(t=>t[1]));add(t,e={}){if(this._validation){const e=this._name?` (resource '${this._name}')`:"";ze(t,this._validation,`Resource item does not match the type${e}`)}return this._items().push([e.sequence??50,t]),this}delete(t){const e=this._items().filter(([e,n])=>n!==t);return this._items.set(e),this}has(t){return this._items().some(([e,n])=>n===t)}},t.__info__=sn,t.assertType=ze,t.batched=i,t.blockDom=on,t.computed=Ke,t.config=function(t,e){const{app:n,manager:s}=o("plugin");return n.dev&&e&&ze(s.config,en.object({[t]:e}),"Config does not match the type"),s.config[t.endsWith("?")?t.slice(0,-1):t]},t.effect=ne,t.htmlEscape=c,t.markRaw=fe,t.markup=u,t.mount=async function(t,e,n={}){return new Fe(n).createRoot(t,n).mount(e,n)},t.onError=function(t){const{node:e}=o("component");let n=T.get(e);n||(n=[],T.set(e,n)),n.push(t.bind(e.component))},t.onMounted=function(t){const{node:e}=o("component");e.mounted.push(Ue(e,t,"onMounted"))},t.onPatched=function(t){const{node:e}=o("component");e.patched.push(Ue(e,t,"onPatched"))},t.onWillDestroy=qe,t.onWillPatch=function(t){const{node:e}=o("component");e.willPatch.unshift(Ue(e,t,"onWillPatch"))},t.onWillStart=function(t){const{node:e}=o("component");e.willStart.push(Ue(e,t,"onWillStart"))},t.onWillUnmount=function(t){const{node:e}=o("component");e.willUnmount.unshift(Ue(e,t,"onWillUnmount"))},t.onWillUpdateProps=function(t){const{node:e}=o("component");e.willUpdateProps.push(Ue(e,t,"onWillUpdateProps"))},t.plugin=function(t){const n=o(),s="component"===n.type?n.node.pluginManager:n.manager;let i=s.getPluginById(t.id);if(!i){if("plugin"!==n.type)throw new e(`Unknown plugin "${t.id}"`);i=s.startPlugin(t)}return i},t.props=function(t,e){const{node:n,app:s,componentName:i}=o("component");function r(t){return void 0===n.props[t]&&e?e[t]:n.props[t]}Object.assign(n.defaultProps,e);const l=Object.create(null);function a(t){for(const e of t)Reflect.defineProperty(l,e,{enumerable:!0,get:r.bind(null,e)})}if(t){if(a((Array.isArray(t)?t:Object.keys(t)).map(t=>t.endsWith("?")?t.slice(0,-1):t)),s.dev){const o=e?function(t,e){const n=(Array.isArray(t)?t:Object.keys(t)).filter(t=>!t.endsWith("?")&&t in e);return e=>{n.length&&e.addIssue({message:"props have default values on mandatory keys",keys:n}),e.validate(en.object(t))}}(t,e):en.object(t);ze(n.props,o,`Invalid component props (${i})`),n.willUpdateProps.push(t=>{ze(t,o,`Invalid component props (${i})`)})}}else{const t=t=>{const n=[];for(const e in t)1!==e.charCodeAt(0)&&n.push(e);if(e)for(const o in e)o in t||n.push(o);return n};let o=t(n.props);a(o),n.willUpdateProps.push(e=>{for(const t of o)Reflect.deleteProperty(l,t);o=t(e),a(o)})}return l},t.providePlugins=function(t,e){const{node:n}=o("component"),s=new ie(n.app,{parent:n.pluginManager,config:e});n.pluginManager=s,qe(()=>s.destroy()),re(s,t)},t.proxy=Ne,t.signal=Xe,t.status=function(t){switch(t.__owl__.status){case 0:return"new";case 2:return"cancelled";case 1:return t instanceof se?"started":"mounted";case 3:return"destroyed"}},t.toRaw=pe,t.types=en,t.untrack=D,t.useApp=function(){return o().app},t.useContext=function(){const t=n.at(-1);return{run(e){if(t){let o;n.push(t);try{o=e()}finally{n.pop()}return o}return e()},protectAsync:e=>(t&&(e=s(t,e)),e),runWithAsyncProtection:e=>(t&&(e=s(t,e)),e())}},t.useEffect=nn,t.useListener=function(t,e,n,o){"function"==typeof t?nn(()=>{const s=t();if(s)return s.addEventListener(e,n,o),()=>s.removeEventListener(e,n,o)}):(t.addEventListener(e,n,o),qe(()=>t.removeEventListener(e,n,o)))},t.useResource=function(t,e){for(let n of e)t.add(n);qe(()=>{for(let n of e)t.delete(n)})},t.validateType=Ze,t.whenReady=function(t){return new Promise(function(t){"loading"!==document.readyState?t(!0):document.addEventListener("DOMContentLoaded",t,!1)}).then(t||function(){})},t.xml=Le,sn.date="2026-04-02T10:48:47.408Z",sn.hash="d172095",sn.url="https://github.com/odoo/owl"}(this.owl=this.owl||{});
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare class OwlError extends Error {
|
|
2
|
-
cause?: any;
|
|
3
|
-
}
|
|
1
|
+
export declare class OwlError extends Error {
|
|
2
|
+
cause?: any;
|
|
3
|
+
}
|
|
@@ -1,29 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
export declare enum ComputationState {
|
|
3
|
-
EXECUTED = 0,
|
|
4
|
-
STALE = 1,
|
|
5
|
-
PENDING = 2
|
|
6
|
-
}
|
|
7
|
-
export declare type Computation<T = any> = {
|
|
8
|
-
compute?: () => T;
|
|
9
|
-
state: ComputationState;
|
|
10
|
-
sources: Set<Atom | Derived<any, any>>;
|
|
11
|
-
isEager?: boolean;
|
|
12
|
-
isDerived?: boolean;
|
|
13
|
-
value: T;
|
|
14
|
-
childrenEffect?: Computation[];
|
|
15
|
-
} & Opts;
|
|
16
|
-
export declare type Opts = {
|
|
17
|
-
name?: string;
|
|
18
|
-
};
|
|
19
|
-
export declare type Atom<T = any> = {
|
|
20
|
-
value: T;
|
|
21
|
-
observers: Set<Computation>;
|
|
22
|
-
} & Opts;
|
|
23
|
-
export interface Derived<Prev, Next = Prev> extends Atom<Next>, Computation<Next> {
|
|
24
|
-
}
|
|
25
|
-
export declare type OldValue = any;
|
|
26
|
-
export declare type Getter<V> = () => V | null;
|
|
27
|
-
export declare type Setter<T, V> = (this: T, value: V) => void;
|
|
28
|
-
export declare type MakeGetSetReturn<T, V> = readonly [Getter<V>] | readonly [Getter<V>, Setter<T, V>];
|
|
29
|
-
export declare type MakeGetSet<T, V> = (obj: T) => MakeGetSetReturn<T, V>;
|
|
1
|
+
export type customDirectives = Record<string, (node: Element, value: string, modifier: string[]) => void>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Parses an XML string into an XML document, throwing errors on parser errors
|
|
3
|
-
* instead of returning an XML document containing the parseerror.
|
|
4
|
-
*
|
|
5
|
-
* @param xml the string to parse
|
|
6
|
-
* @returns an XML document corresponding to the content of the string
|
|
7
|
-
*/
|
|
8
|
-
export declare function parseXML(xml: string): XMLDocument;
|
|
1
|
+
/**
|
|
2
|
+
* Parses an XML string into an XML document, throwing errors on parser errors
|
|
3
|
+
* instead of returning an XML document containing the parseerror.
|
|
4
|
+
*
|
|
5
|
+
* @param xml the string to parse
|
|
6
|
+
* @returns an XML document corresponding to the content of the string
|
|
7
|
+
*/
|
|
8
|
+
export declare function parseXML(xml: string): XMLDocument;
|
|
@@ -1,152 +1,133 @@
|
|
|
1
|
-
import { AST, ASTComment, ASTComponent, ASTDebug, ASTDomNode, ASTLog, ASTMulti,
|
|
2
|
-
|
|
3
|
-
export interface Config {
|
|
4
|
-
translateFn?: (s: string, translationCtx: string) => string;
|
|
5
|
-
translatableAttributes?: string[];
|
|
6
|
-
dev?: boolean;
|
|
7
|
-
}
|
|
8
|
-
export interface CodeGenOptions extends Config {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
* "onClick.bind" "onClick" "onClick: bind(ctx, ctx['onClick'])"
|
|
135
|
-
*/
|
|
136
|
-
formatProp(name: string, value: string, attrsTranslationCtx: {
|
|
137
|
-
[name: string]: string;
|
|
138
|
-
} | null, translationCtx: string): string;
|
|
139
|
-
formatPropObject(obj: {
|
|
140
|
-
[prop: string]: any;
|
|
141
|
-
}, attrsTranslationCtx: {
|
|
142
|
-
[name: string]: string;
|
|
143
|
-
} | null, translationCtx: string): string[];
|
|
144
|
-
getPropString(props: string[], dynProps: string | null): string;
|
|
145
|
-
compileComponent(ast: ASTComponent, ctx: Context): string;
|
|
146
|
-
wrapWithEventCatcher(expr: string, on: EventHandlers): string;
|
|
147
|
-
compileTSlot(ast: ASTSlot, ctx: Context): string;
|
|
148
|
-
compileTTranslation(ast: ASTTranslation, ctx: Context): string | null;
|
|
149
|
-
compileTTranslationContext(ast: ASTTranslationContext, ctx: Context): string | null;
|
|
150
|
-
compileTPortal(ast: ASTTPortal, ctx: Context): string;
|
|
151
|
-
}
|
|
152
|
-
export {};
|
|
1
|
+
import { AST, ASTComment, ASTComponent, ASTDebug, ASTDomNode, ASTLog, ASTMulti, ASTTCall, ASTTCallBlock, ASTTCallSlot, ASTText, ASTTForEach, ASTTif, ASTTKey, ASTTOut, ASTTranslation, ASTTranslationContext, ASTTSet, EventHandlers } from "./parser";
|
|
2
|
+
type BlockType = "block" | "text" | "multi" | "list" | "html" | "comment";
|
|
3
|
+
export interface Config {
|
|
4
|
+
translateFn?: (s: string, translationCtx: string) => string;
|
|
5
|
+
translatableAttributes?: string[];
|
|
6
|
+
dev?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface CodeGenOptions extends Config {
|
|
9
|
+
name?: string;
|
|
10
|
+
hasGlobalValues: boolean;
|
|
11
|
+
}
|
|
12
|
+
declare class BlockDescription {
|
|
13
|
+
static nextBlockId: number;
|
|
14
|
+
varName: string;
|
|
15
|
+
blockName: string;
|
|
16
|
+
dynamicTagName: string | null;
|
|
17
|
+
isRoot: boolean;
|
|
18
|
+
hasDynamicChildren: boolean;
|
|
19
|
+
children: BlockDescription[];
|
|
20
|
+
data: string[];
|
|
21
|
+
dom?: Node;
|
|
22
|
+
currentDom?: Element;
|
|
23
|
+
childNumber: number;
|
|
24
|
+
target: CodeTarget;
|
|
25
|
+
type: BlockType;
|
|
26
|
+
parentVar: string;
|
|
27
|
+
id: number;
|
|
28
|
+
constructor(target: CodeTarget, type: BlockType);
|
|
29
|
+
insertData(str: string, prefix?: string): number;
|
|
30
|
+
insert(dom: Node): void;
|
|
31
|
+
generateExpr(expr: string): string;
|
|
32
|
+
asXmlString(): string;
|
|
33
|
+
}
|
|
34
|
+
interface Context {
|
|
35
|
+
block: BlockDescription | null;
|
|
36
|
+
index: number | string;
|
|
37
|
+
forceNewBlock: boolean;
|
|
38
|
+
translate: boolean;
|
|
39
|
+
translationCtx: string;
|
|
40
|
+
tKeyExpr: string | null;
|
|
41
|
+
nameSpace?: string;
|
|
42
|
+
tModelSelectedExpr?: string;
|
|
43
|
+
inPreTag?: boolean;
|
|
44
|
+
}
|
|
45
|
+
declare class CodeTarget {
|
|
46
|
+
name: string;
|
|
47
|
+
indentLevel: number;
|
|
48
|
+
loopLevel: number;
|
|
49
|
+
loopCtxVars: string[];
|
|
50
|
+
tSetVars: Map<string, number>;
|
|
51
|
+
code: string[];
|
|
52
|
+
hasRoot: boolean;
|
|
53
|
+
needsScopeProtection: boolean;
|
|
54
|
+
on: EventHandlers | null;
|
|
55
|
+
constructor(name: string, on?: EventHandlers | null);
|
|
56
|
+
addLine(line: string, idx?: number): void;
|
|
57
|
+
generateCode(): string;
|
|
58
|
+
currentKey(ctx: Context): string;
|
|
59
|
+
}
|
|
60
|
+
export declare class CodeGenerator {
|
|
61
|
+
blocks: BlockDescription[];
|
|
62
|
+
nextBlockId: number;
|
|
63
|
+
isDebug: boolean;
|
|
64
|
+
targets: CodeTarget[];
|
|
65
|
+
target: CodeTarget;
|
|
66
|
+
templateName?: string;
|
|
67
|
+
dev: boolean;
|
|
68
|
+
translateFn: (s: string, translationCtx: string) => string;
|
|
69
|
+
translatableAttributes: string[];
|
|
70
|
+
ast: AST;
|
|
71
|
+
staticDefs: {
|
|
72
|
+
id: string;
|
|
73
|
+
expr: string;
|
|
74
|
+
}[];
|
|
75
|
+
slotNames: Set<String | Symbol>;
|
|
76
|
+
helpers: Set<string>;
|
|
77
|
+
constructor(ast: AST, options: CodeGenOptions);
|
|
78
|
+
generateCode(): string;
|
|
79
|
+
compileInNewTarget(prefix: string, ast: AST, ctx: Context, on?: EventHandlers | null): string;
|
|
80
|
+
addLine(line: string, idx?: number): void;
|
|
81
|
+
define(varName: string, expr: string): void;
|
|
82
|
+
insertAnchor(block: BlockDescription, index?: number): void;
|
|
83
|
+
createBlock(parentBlock: BlockDescription | null, type: BlockType, ctx: Context): BlockDescription;
|
|
84
|
+
insertBlock(expression: string, block: BlockDescription, ctx: Context): void;
|
|
85
|
+
translate(str: string, translationCtx: string): string;
|
|
86
|
+
/**
|
|
87
|
+
* @returns the newly created block name, if any
|
|
88
|
+
*/
|
|
89
|
+
compileAST(ast: AST, ctx: Context): string | null;
|
|
90
|
+
compileDebug(ast: ASTDebug, ctx: Context): string | null;
|
|
91
|
+
compileLog(ast: ASTLog, ctx: Context): string | null;
|
|
92
|
+
compileComment(ast: ASTComment, ctx: Context): string;
|
|
93
|
+
compileText(ast: ASTText, ctx: Context): string;
|
|
94
|
+
generateHandlerCode(rawEvent: string, handler: string): string;
|
|
95
|
+
compileTDomNode(ast: ASTDomNode, ctx: Context): string;
|
|
96
|
+
compileZero(): string;
|
|
97
|
+
compileTOut(ast: ASTTOut, ctx: Context): string;
|
|
98
|
+
compileTIfBranch(content: AST, block: BlockDescription, ctx: Context): void;
|
|
99
|
+
compileTIf(ast: ASTTif, ctx: Context, nextNode?: ASTDomNode): string;
|
|
100
|
+
compileTForeach(ast: ASTTForEach, ctx: Context): string;
|
|
101
|
+
compileTKey(ast: ASTTKey, ctx: Context): string | null;
|
|
102
|
+
compileMulti(ast: ASTMulti, ctx: Context): string | null;
|
|
103
|
+
compileTCall(ast: ASTTCall, ctx: Context): string;
|
|
104
|
+
compileTCallBlock(ast: ASTTCallBlock, ctx: Context): string;
|
|
105
|
+
compileTSet(ast: ASTTSet, ctx: Context): null;
|
|
106
|
+
generateComponentKey(currentKey?: string): string;
|
|
107
|
+
/**
|
|
108
|
+
* Formats a prop name and value into a string suitable to be inserted in the
|
|
109
|
+
* generated code. For example:
|
|
110
|
+
*
|
|
111
|
+
* Name Value Result
|
|
112
|
+
* ---------------------------------------------------------
|
|
113
|
+
* "number" "state" "number: ctx['state']"
|
|
114
|
+
* "something" "" "something: undefined"
|
|
115
|
+
* "some-prop" "state" "'some-prop': ctx['state']"
|
|
116
|
+
* "onClick.bind" "onClick" "onClick: bind(ctx, ctx['onClick'])"
|
|
117
|
+
*/
|
|
118
|
+
formatProp(name: string, value: string, attrsTranslationCtx: {
|
|
119
|
+
[name: string]: string;
|
|
120
|
+
} | null, translationCtx: string): string;
|
|
121
|
+
formatPropObject(obj: {
|
|
122
|
+
[prop: string]: any;
|
|
123
|
+
}, attrsTranslationCtx: {
|
|
124
|
+
[name: string]: string;
|
|
125
|
+
} | null, translationCtx: string): string[];
|
|
126
|
+
getPropString(props: string[], dynProps: string | null): string;
|
|
127
|
+
compileComponent(ast: ASTComponent, ctx: Context): string;
|
|
128
|
+
wrapWithEventCatcher(expr: string, on: EventHandlers): string;
|
|
129
|
+
compileTCallSlot(ast: ASTTCallSlot, ctx: Context): string;
|
|
130
|
+
compileTTranslation(ast: ASTTranslation, ctx: Context): string | null;
|
|
131
|
+
compileTTranslationContext(ast: ASTTranslationContext, ctx: Context): string | null;
|
|
132
|
+
}
|
|
133
|
+
export {};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { TemplateSet } from "../runtime/template_set";
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
interface CompileOptions extends Config {
|
|
8
|
-
name?: string;
|
|
9
|
-
customDirectives?:
|
|
10
|
-
hasGlobalValues: boolean;
|
|
11
|
-
}
|
|
12
|
-
export declare function compile(template: string | Element, options?: CompileOptions): TemplateFunction;
|
|
13
|
-
export {};
|
|
1
|
+
import type { BDom } from "../runtime/blockdom";
|
|
2
|
+
import type { TemplateSet } from "../runtime/template_set";
|
|
3
|
+
import { Config } from "./code_generator";
|
|
4
|
+
export type CustomDirectives = Record<string, (node: Element, value: string, modifier: string[]) => void>;
|
|
5
|
+
export type Template = (context: any, vnode: any, key?: string) => BDom;
|
|
6
|
+
export type TemplateFunction = (app: TemplateSet, bdom: any, helpers: any) => Template;
|
|
7
|
+
interface CompileOptions extends Config {
|
|
8
|
+
name?: string;
|
|
9
|
+
customDirectives?: CustomDirectives;
|
|
10
|
+
hasGlobalValues: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare function compile(template: string | Element, options?: CompileOptions): TemplateFunction;
|
|
13
|
+
export {};
|
|
@@ -1,59 +1,41 @@
|
|
|
1
|
-
export interface QWebVar {
|
|
2
|
-
id: string;
|
|
3
|
-
expr: string;
|
|
4
|
-
value?: string;
|
|
5
|
-
hasBody?: boolean;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
interface Token {
|
|
9
|
-
type: TKind;
|
|
10
|
-
value: string;
|
|
11
|
-
originalValue?: string;
|
|
12
|
-
size?: number;
|
|
13
|
-
varName?: string;
|
|
14
|
-
replace?: Function;
|
|
15
|
-
isLocal?: boolean;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Convert a javascript expression (as a string) into a list of tokens. For
|
|
19
|
-
* example: `tokenize("1 + b")` will return:
|
|
20
|
-
* ```js
|
|
21
|
-
* [
|
|
22
|
-
* {type: "VALUE", value: "1"},
|
|
23
|
-
* {type: "OPERATOR", value: "+"},
|
|
24
|
-
* {type: "SYMBOL", value: "b"}
|
|
25
|
-
* ]
|
|
26
|
-
* ```
|
|
27
|
-
*/
|
|
28
|
-
export declare function tokenize(expr: string): Token[];
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
*
|
|
43
|
-
* Here is the heuristic used by this method to determine if a token is a
|
|
44
|
-
* variable:
|
|
45
|
-
* - by default, all symbols are considered a variable
|
|
46
|
-
* - unless the previous token is a dot (in that case, this is a property: `a.b`)
|
|
47
|
-
* - or if the previous token is a left brace or a comma, and the next token is
|
|
48
|
-
* a colon (in that case, this is an object key: `{a: b}`)
|
|
49
|
-
*
|
|
50
|
-
* Some specific code is also required to support arrow functions. If we detect
|
|
51
|
-
* the arrow operator, then we add the current (or some previous tokens) token to
|
|
52
|
-
* the list of variables so it does not get replaced by a lookup in the context
|
|
53
|
-
*/
|
|
54
|
-
export declare function compileExprToArray(expr: string): Token[];
|
|
55
|
-
export declare function compileExpr(expr: string): string;
|
|
56
|
-
export declare const INTERP_REGEXP: RegExp;
|
|
57
|
-
export declare function replaceDynamicParts(s: string, replacer: (s: string) => string): string;
|
|
58
|
-
export declare function interpolate(s: string): string;
|
|
59
|
-
export {};
|
|
1
|
+
export interface QWebVar {
|
|
2
|
+
id: string;
|
|
3
|
+
expr: string;
|
|
4
|
+
value?: string;
|
|
5
|
+
hasBody?: boolean;
|
|
6
|
+
}
|
|
7
|
+
type TKind = "LEFT_BRACE" | "RIGHT_BRACE" | "LEFT_BRACKET" | "RIGHT_BRACKET" | "LEFT_PAREN" | "RIGHT_PAREN" | "COMMA" | "VALUE" | "TEMPLATE_STRING" | "SYMBOL" | "OPERATOR" | "COLON";
|
|
8
|
+
interface Token {
|
|
9
|
+
type: TKind;
|
|
10
|
+
value: string;
|
|
11
|
+
originalValue?: string;
|
|
12
|
+
size?: number;
|
|
13
|
+
varName?: string;
|
|
14
|
+
replace?: Function;
|
|
15
|
+
isLocal?: boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Convert a javascript expression (as a string) into a list of tokens. For
|
|
19
|
+
* example: `tokenize("1 + b")` will return:
|
|
20
|
+
* ```js
|
|
21
|
+
* [
|
|
22
|
+
* {type: "VALUE", value: "1"},
|
|
23
|
+
* {type: "OPERATOR", value: "+"},
|
|
24
|
+
* {type: "SYMBOL", value: "b"}
|
|
25
|
+
* ]
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare function tokenize(expr: string): Token[];
|
|
29
|
+
interface ProcessedExpr {
|
|
30
|
+
expr: string;
|
|
31
|
+
freeVariables: string[] | null;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Processes a javascript expression: compiles variable lookups and detects
|
|
35
|
+
* top-level arrow functions with their free variables, all in a single pass.
|
|
36
|
+
*/
|
|
37
|
+
export declare function processExpr(expr: string): ProcessedExpr;
|
|
38
|
+
export declare function compileExpr(expr: string): string;
|
|
39
|
+
export declare const INTERP_REGEXP: RegExp;
|
|
40
|
+
export declare function interpolate(s: string): string;
|
|
41
|
+
export {};
|