@fluffjs/fluff 0.0.8 → 0.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/bundle.min.js +1 -0
- package/decorators/Component.d.ts +0 -1
- package/decorators/Component.js +0 -3
- package/decorators/HostBinding.d.ts +4 -0
- package/decorators/HostBinding.js +3 -10
- package/decorators/HostListener.d.ts +4 -0
- package/decorators/HostListener.js +3 -10
- package/decorators/Input.d.ts +1 -1
- package/decorators/Input.js +2 -16
- package/decorators/InputOutputHelper.d.ts +1 -0
- package/decorators/InputOutputHelper.js +18 -0
- package/decorators/MetadataArrayHelper.d.ts +4 -0
- package/decorators/MetadataArrayHelper.js +14 -0
- package/decorators/Output.d.ts +1 -1
- package/decorators/Output.js +2 -16
- package/decorators/ViewChild.d.ts +4 -0
- package/decorators/ViewChild.js +3 -10
- package/index.d.ts +2 -0
- package/index.js +2 -0
- package/interfaces/BreakMarkerConfig.d.ts +3 -0
- package/interfaces/BreakMarkerConfig.js +1 -0
- package/interfaces/FluffHostElement.d.ts +5 -0
- package/interfaces/FluffHostElement.js +1 -0
- package/interfaces/ForMarkerConfig.d.ts +8 -0
- package/interfaces/ForMarkerConfig.js +1 -0
- package/interfaces/IfMarkerConfig.d.ts +7 -0
- package/interfaces/IfMarkerConfig.js +1 -0
- package/interfaces/MarkerConfig.d.ts +6 -0
- package/interfaces/MarkerConfig.js +1 -0
- package/interfaces/PropertyChain.d.ts +1 -0
- package/interfaces/PropertyChain.js +1 -0
- package/interfaces/RenderContext.d.ts +3 -0
- package/interfaces/RenderContext.js +1 -0
- package/interfaces/SwitchMarkerConfig.d.ts +10 -0
- package/interfaces/SwitchMarkerConfig.js +1 -0
- package/interfaces/TextMarkerConfig.d.ts +9 -0
- package/interfaces/TextMarkerConfig.js +1 -0
- package/package.json +1 -1
- package/runtime/BreakController.d.ts +8 -0
- package/runtime/BreakController.js +13 -0
- package/runtime/FluffBase.d.ts +40 -0
- package/runtime/FluffBase.js +271 -0
- package/runtime/FluffElement.d.ts +5 -39
- package/runtime/FluffElement.js +3 -272
- package/runtime/FluffElementImpl.d.ts +49 -0
- package/runtime/FluffElementImpl.js +315 -0
- package/runtime/FluffMarkers.d.ts +8 -0
- package/runtime/FluffMarkers.js +8 -0
- package/runtime/ForController.d.ts +10 -0
- package/runtime/ForController.js +43 -0
- package/runtime/IfController.d.ts +10 -0
- package/runtime/IfController.js +46 -0
- package/runtime/MarkerConfigGuards.d.ts +15 -0
- package/runtime/MarkerConfigGuards.js +20 -0
- package/runtime/MarkerController.d.ts +46 -0
- package/runtime/MarkerController.js +235 -0
- package/runtime/MarkerManager.d.ts +16 -0
- package/runtime/MarkerManager.js +136 -0
- package/runtime/MarkerManagerInterface.d.ts +4 -0
- package/runtime/MarkerManagerInterface.js +1 -0
- package/runtime/ScopeRegistry.d.ts +9 -0
- package/runtime/ScopeRegistry.js +13 -0
- package/runtime/SwitchController.d.ts +9 -0
- package/runtime/SwitchController.js +42 -0
- package/runtime/TextController.d.ts +10 -0
- package/runtime/TextController.js +53 -0
- package/runtime/tests/DirectOutputChild.d.ts +10 -0
- package/runtime/tests/DirectOutputChild.js +14 -0
- package/runtime/tests/DirectOutputParent.d.ts +9 -0
- package/runtime/tests/DirectOutputParent.js +17 -0
- package/runtime/tests/TaskStats.d.ts +9 -0
- package/runtime/tests/TaskStats.js +1 -0
- package/runtime/tests/TestChildTasksListComponent.d.ts +8 -0
- package/runtime/tests/TestChildTasksListComponent.js +28 -0
- package/runtime/tests/TestForChildComponent.d.ts +6 -0
- package/runtime/tests/TestForChildComponent.js +10 -0
- package/runtime/tests/TestForComponent.d.ts +6 -0
- package/runtime/tests/TestForComponent.js +21 -0
- package/runtime/tests/TestForReinsertBindsInputParentComponent.d.ts +12 -0
- package/runtime/tests/TestForReinsertBindsInputParentComponent.js +57 -0
- package/runtime/tests/TestForTextMarkerCollisionNoTrackParentComponent.d.ts +8 -0
- package/runtime/tests/TestForTextMarkerCollisionNoTrackParentComponent.js +29 -0
- package/runtime/tests/TestForTextMarkerCollisionParentComponent.d.ts +9 -0
- package/runtime/tests/TestForTextMarkerCollisionParentComponent.js +46 -0
- package/runtime/tests/TestForUnsubscribeNestedParentComponent.d.ts +8 -0
- package/runtime/tests/TestForUnsubscribeNestedParentComponent.js +35 -0
- package/runtime/tests/TestGetterReactivityComponent.d.ts +9 -0
- package/runtime/tests/TestGetterReactivityComponent.js +27 -0
- package/runtime/tests/TestIfReinsertBindsInputChildComponent.d.ts +9 -0
- package/runtime/tests/TestIfReinsertBindsInputChildComponent.js +39 -0
- package/runtime/tests/TestIfReinsertBindsInputParentComponent.d.ts +12 -0
- package/runtime/tests/TestIfReinsertBindsInputParentComponent.js +54 -0
- package/runtime/tests/TestIfUnsubscribeNestedParentComponent.d.ts +8 -0
- package/runtime/tests/TestIfUnsubscribeNestedParentComponent.js +32 -0
- package/runtime/tests/TestLateDefineForChildComponent.d.ts +6 -0
- package/runtime/tests/TestLateDefineForChildComponent.js +10 -0
- package/runtime/tests/TestLateDefineForComponent.d.ts +9 -0
- package/runtime/tests/TestLateDefineForComponent.js +25 -0
- package/runtime/tests/TestNullInputTextComponent.d.ts +14 -0
- package/runtime/tests/TestNullInputTextComponent.js +37 -0
- package/runtime/tests/TestOutputBindingChildComponent.d.ts +10 -0
- package/runtime/tests/TestOutputBindingChildComponent.js +20 -0
- package/runtime/tests/TestOutputBindingParentComponent.d.ts +13 -0
- package/runtime/tests/TestOutputBindingParentComponent.js +38 -0
- package/runtime/tests/TestParentBindsTasksComponent.d.ts +7 -0
- package/runtime/tests/TestParentBindsTasksComponent.js +22 -0
- package/runtime/tests/TestSwitchReinsertBindsInputChildComponent.d.ts +9 -0
- package/runtime/tests/TestSwitchReinsertBindsInputChildComponent.js +39 -0
- package/runtime/tests/TestSwitchReinsertBindsInputParentComponent.d.ts +12 -0
- package/runtime/tests/TestSwitchReinsertBindsInputParentComponent.js +65 -0
- package/runtime/tests/TestSwitchUnsubscribeNestedParentComponent.d.ts +8 -0
- package/runtime/tests/TestSwitchUnsubscribeNestedParentComponent.js +42 -0
- package/runtime/tests/TestTemplateNestedMarkersComponent.d.ts +11 -0
- package/runtime/tests/TestTemplateNestedMarkersComponent.js +39 -0
- package/runtime/tests/TestUnsubscribeNestedChildComponent.d.ts +11 -0
- package/runtime/tests/TestUnsubscribeNestedChildComponent.js +43 -0
- package/runtime/tests/TestUnsubscribeNestedGrandchildComponent.d.ts +9 -0
- package/runtime/tests/TestUnsubscribeNestedGrandchildComponent.js +39 -0
- package/runtime/tests/TestUnsubscribeNestedParentBaseComponent.d.ts +8 -0
- package/runtime/tests/TestUnsubscribeNestedParentBaseComponent.js +33 -0
- package/utils/DomUtils.d.ts +3 -0
- package/utils/DomUtils.js +6 -0
- package/utils/Property.d.ts +8 -3
- package/utils/Property.js +26 -20
- package/utils/Publisher.d.ts +2 -1
- package/utils/Publisher.js +16 -1
package/bundle.min.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var A=new Map;function N(i){return function(t){let e={...i,inputs:new Map,outputs:new Map};if(A.set(t,e),i.pipes&&i.pipes.length>0){let n={};for(let r of i.pipes){let s=r.__pipeName;if(s){let o=new r;n[s]=(c,...a)=>o.transform(c,...a)}}Reflect.set(t.prototype,"__pipes",n)}return t}}function v(i){return A.get(i)}var b=class{static getOrCreateArray(t,e){let n=Reflect.get(t,e);if(this.isTypedArray(n))return n;let r=[];return Reflect.set(t,e,r),r}static isTypedArray(t){return Array.isArray(t)}};function $(i){return function(t,e){let n=t.constructor;b.getOrCreateArray(n,"__hostBindings").push({property:String(e),hostProperty:i})}}function H(i){return function(t,e,n){let r=t.constructor;return b.getOrCreateArray(r,"__hostListeners").push({method:String(e),event:i}),n}}function W(i){return typeof i=="function"}function M(i){return function(t){return function(e,n){let{constructor:r}=e;if(!W(r))return;let s=v(r);if(s){let o=t??String(n);s[i].set(String(n),o)}}}}var V=M("inputs");var D=M("outputs");function z(i){return function(t){return t.__pipeName=i,t}}function j(){return(i,t)=>{}}function J(i){return function(t,e){let n=t.constructor;b.getOrCreateArray(n,"__viewChildren").push({property:String(e),selector:i})}}function q(...i){return function(t,e,n){let r=n.value;return typeof r=="function"&&Reflect.set(t,`__watch_${String(e)}`,r),n}}var m=class{static isCustomElement(t){let e=t.tagName.toLowerCase();return customElements.get(e)!==void 0}};var _;(function(i){i[i.Any=0]="Any",i[i.Inbound=1]="Inbound",i[i.Outbound=2]="Outbound"})(_||(_={}));var h=class{callbacks=new Set;async emit(t){for(let e of this.callbacks)try{await e(t)}catch(n){console.error(n)}}subscribe(t){return this.callbacks.add(t),{unsubscribe:()=>{this.callbacks.delete(t)}}}subscribeOnce(t){let e=async n=>{this.callbacks.delete(e),await t(n)};return this.callbacks.add(e),{unsubscribe:()=>{this.callbacks.delete(e)}}}};function F(i){let t=new WeakSet;return JSON.stringify(i,(e,n)=>{if(typeof n=="object"&&n!==null){if(t.has(n))return"[Circular]";t.add(n)}return n})}var l=class{onChange=new h;onInboundChange=new h;onOutboundChange=new h;value;committed=!0;_isChanging=!1;_propName;constructor(t){this.isOptionsObject(t)?(t.initialValue!==void 0&&(this.value=t.initialValue),t.propertyName!==void 0&&(this._propName=t.propertyName)):this.value=t}setValue(t,e=!1,n=!0){if(this._isChanging){console.error((this._propName?this._propName+": ":"")+"Binding loop detected: setValue called while change is in progress");return}if(t!==this.value&&F(t)!==F(this.value)){this._isChanging=!0;try{this.value=t,this.onChange.emit(t).catch(s=>{console.error(s)}),n||(this.committed=!1),e?(this.committed=!0,this.onInboundChange.emit(t).catch(s=>{console.error(s)})):(n||!this.committed)&&(this.committed=!0,this.value!==void 0&&this.onOutboundChange.emit(this.value).catch(s=>{console.error(s)}))}finally{this._isChanging=!1}}}async triggerChange(t=_.Any){this.value!==void 0&&(await this.onChange.emit(this.value),t==_.Outbound&&await this.onOutboundChange.emit(this.value),t==_.Inbound&&await this.onOutboundChange.emit(this.value))}subscribe(t,e){return t==_.Inbound?this.onInboundChange.subscribe(n=>{e(n)}):t==_.Outbound?this.onOutboundChange.subscribe(n=>{e(n)}):this.onChange.subscribe(n=>{e(n)})}getValue(){return this.value===void 0?null:this.value}isOptionsObject(t){return typeof t=="object"&&t!==null&&"initialValue"in t}};var C=class i extends HTMLElement{static __e=[];static __h=[];static __bindings={};__parentScope;__loopContext={};__baseSubscriptions=[];__getScope(){return{host:this,locals:this.__loopContext,parent:this.__parentScope}}__processBindingsOnElement(t,e,n){let r=t.getAttribute("data-lid");if(!r)return;let s=this.__getBindingsForLid(r);if(!(!s||s.length===0))for(let o of s)this.__applyBindingWithScope(t,o,e,n)}__getBindingsForLid(t){let e=this.constructor;if(typeof e=="function"){let n=Reflect.get(e,"__bindings");if(this.__isBindingsMap(n))return n[t]}}__isBindingsMap(t){return!(!t||typeof t!="object")}__applyBindingWithScope(t,e,n,r){switch(e.binding){case"property":this.__applyPropertyBindingWithScope(t,e,n,r);break;case"event":this.__applyEventBindingWithScope(t,e,n);break;case"two-way":this.__applyTwoWayBindingWithScope(t,e,n,r);break;case"class":this.__applyClassBindingWithScope(t,e,n,r);break;case"style":this.__applyStyleBindingWithScope(t,e,n,r);break;case"ref":break}}__getCompiledExprFn(t){let e=i.__e[t];if(typeof e!="function")throw new Error(`Missing compiled expression function for exprId ${t}`);return e}__getCompiledHandlerFn(t){let e=i.__h[t];if(typeof e!="function")throw new Error(`Missing compiled handler function for handlerId ${t}`);return e}__subscribeToExpressionInScope(t,e,n,r){if(t)for(let s of t){let o=Array.isArray(s)?s[0]:s,c=this.__getReactivePropFromScope(o,e);if(c){let a=c.onChange.subscribe(n);r?r.push(a):this.__baseSubscriptions.push(a)}}}__getReactivePropFromScope(t,e){if(t in e.locals)return;let n=`__${t}`;if(n in e.host){let r=Reflect.get(e.host,n);if(r instanceof l)return r}if(e.parent)return this.__getReactivePropFromScope(t,e.parent)}__setChildProperty(t,e,n){let r=Reflect.get(t,e);if(r instanceof l)r.setValue(n,!0);else if(m.isCustomElement(t)){let s=t.tagName.toLowerCase();customElements.whenDefined(s).then(()=>{t instanceof i&&Reflect.set(t,e,n)}).catch(console.error)}else e in t?Reflect.set(t,e,n):t.setAttribute(e,String(n))}__applyPropertyBindingWithScope(t,e,n,r){let s=t.tagName.toLowerCase(),o=customElements.get(s)!==void 0,c=()=>{try{if(typeof e.exprId!="number")throw new Error(`Binding for ${e.name} is missing exprId`);let p=this.__getCompiledExprFn(e.exprId)(this,n.locals);this.__setChildProperty(t,e.name,p)}catch(a){console.error("Property binding error:",a)}};this.__subscribeToExpressionInScope(e.deps,n,c,r),e.subscribe&&this.__subscribeToExpressionInScope([e.subscribe],n,c,r),o?(t instanceof i||customElements.upgrade(t),t instanceof i?c():customElements.whenDefined(s).then(()=>{t instanceof i&&c()}).catch(console.error)):c()}__applyEventBindingWithScope(t,e,n){if(typeof e.handlerId!="number")throw new Error(`Event binding for ${e.name} is missing handlerId`);let r=this.__getCompiledHandlerFn(e.handlerId);t.hasAttribute("x-fluff-component")?this.__applyOutputBinding(t,e.name,r,n):t.addEventListener(e.name,s=>{try{r(this,n.locals,s)}catch(o){console.error("Event binding error:",o)}})}__applyOutputBinding(t,e,n,r){let s=()=>{let c=Reflect.get(t,e);if(c instanceof h){let a=c.subscribe(p=>{try{n(this,r.locals,p)}catch(g){console.error("Output binding error:",g)}});return this.__baseSubscriptions.push(a),!0}return!1};if(s())return;let o=t.tagName.toLowerCase();customElements.whenDefined(o).then(()=>{customElements.upgrade(t),s()}).catch(console.error)}__applyTwoWayBindingWithScope(t,e,n,r){if(this.__applyPropertyBindingWithScope(t,e,n,r),typeof e.targetProp!="string"||e.targetProp.length===0)throw new Error(`Two-way binding for ${e.name} is missing targetProp`);let s=this.__getReactivePropFromScope(e.targetProp,n),o=Reflect.get(t,e.name);if(s&&o instanceof l){let c=o.onChange.subscribe(a=>{s.setValue(a,!0)});r?r.push(c):this.__baseSubscriptions.push(c)}}__applyClassBindingWithScope(t,e,n,r){let s=()=>{try{if(typeof e.exprId!="number")throw new Error(`Class binding for ${e.name} is missing exprId`);this.__getCompiledExprFn(e.exprId)(this,n.locals)?t.classList.add(e.name):t.classList.remove(e.name)}catch(o){console.error("Class binding error:",o)}};this.__subscribeToExpressionInScope(e.deps,n,s,r),s()}__applyStyleBindingWithScope(t,e,n,r){let s=()=>{try{if(typeof e.exprId!="number")throw new Error(`Style binding for ${e.name} is missing exprId`);let c=this.__getCompiledExprFn(e.exprId)(this,n.locals);t.style.setProperty(e.name,String(c))}catch(o){console.error("Style binding error:",o)}};this.__subscribeToExpressionInScope(e.deps,n,s,r),s()}};var L=new Map,G=0;function B(i){let t=`scope_${G++}`;return L.set(t,i),t}function O(i){return L.get(i)}var x=class extends C{__pipes={};_shadowRoot;_subscriptions=[];_initialized=!1;_markerManager=null;_markerConfigJson=null;constructor(){super(),this._shadowRoot=this.attachShadow({mode:"open"})}connectedCallback(){if(!this._initialized){let t=this.getAttribute("data-fluff-scope-id");t&&!this.__parentScope&&(this.__parentScope=O(t),this.__parentScope&&(this.__loopContext=this.__parentScope.locals));let e=this.getAttribute("data-fluff-loop-context");if(e&&Object.keys(this.__loopContext).length===0)try{this.__loopContext=JSON.parse(e)}catch{}this.__applyPendingProps(),this.__render(),this.__setupBindings(),this.getAttribute("data-fluff-scope-id")&&this.__processBindings(),this._initialized=!0,"onInit"in this&&typeof this.onInit=="function"&&this.onInit()}}disconnectedCallback(){"onDestroy"in this&&typeof this.onDestroy=="function"&&this.onDestroy(),this._markerManager&&(this._markerManager.cleanup(),this._markerManager=null);for(let t of this._subscriptions)t.unsubscribe();this._subscriptions=[];for(let t of this.__baseSubscriptions)t.unsubscribe();this.__baseSubscriptions=[]}$watch=(t,e)=>(e(),{unsubscribe:()=>{}});__processBindingsOnElementPublic(t,e,n){this.__processBindingsOnElement(t,e,n)}__addSubscription(t){this._subscriptions.push(t)}__pipe(t,e,...n){let r=this.__pipes[t];return r?r(e,...n):(console.warn(`Pipe "${t}" not found`),e)}__getShadowRoot(){return this._shadowRoot}__setMarkerConfigs(t){this._markerConfigJson=t}__initializeMarkers(t){this._markerConfigJson&&(this._markerManager=new t(this,this._shadowRoot),this._markerManager.initializeFromConfig(this._markerConfigJson))}__getElement(t){return this._shadowRoot.querySelector(`[data-lid="${t}"]`)}__setText(t,e){let n=this.__getElement(t);n&&(n.textContent=e)}__bindText(t,e){let n=this.__getElement(t);if(!n)return;let r=n.getAttribute("data-text-bind")??"",s=/this\.([a-zA-Z_][a-zA-Z0-9_]*)/.exec(r),o=()=>{try{n.textContent=e()}catch{n.textContent=""}};if(s){let[,c]=s,a=this.__getReactiveProp(c);a&&this.__bindPropertyChange(a,o)}o()}__setProperty(t,e,n){let r=this.__getElement(t);this.isHTMLElement(r)&&(e in r?Reflect.set(r,e,n):r.setAttribute(e,String(n)))}__addClass(t,e){let n=this.__getElement(t);this.isHTMLElement(n)&&n.classList.add(e)}__removeClass(t,e){let n=this.__getElement(t);this.isHTMLElement(n)&&n.classList.remove(e)}__bindEvent(t,e,n){let r=this.__getElement(t);r&&r.addEventListener(e,n)}__bindPropertyChange(t,e){let n=t.onChange.subscribe(e);this._subscriptions.push(n);let r=t.getValue();r!==null&&e(r)}__connectProperties(t,e){let n=t.onChange.subscribe(s=>{e.setValue(s,!0)});this._subscriptions.push(n);let r=t.getValue();r!==null&&e.setValue(r,!0)}__connectOutput(t,e){let n=t.subscribe(e);this._subscriptions.push(n)}__bindOutput(t,e,n){let r=this.__getElement(t);r&&this.__bindOutputOnElement(r,e,n)}__setChildProperty(t,e,n){if(t instanceof HTMLElement&&t.hasAttribute("x-fluff-component")){let s=t.tagName.toLowerCase();if(customElements.get(s)===void 0){customElements.whenDefined(s).then(()=>{customElements.upgrade(t),this.__setChildProperty(t,e,n)}).catch(console.error);return}}let r=Reflect.get(t,e);r instanceof l?r.setValue(n,!0):e in t?Reflect.set(t,e,n):t.setAttribute(e,String(n))}__bindToChild(t,e,n){let r=this.__getElement(t);r&&this.__setChildPropertyDeferred(r,e,n)}__setChildPropertyDeferred(t,e,n){if(Reflect.get(t,e)!==void 0){this.__setChildProperty(t,e,n);return}if(m.isCustomElement(t)){let r=t.tagName.toLowerCase();customElements.whenDefined(r).then(()=>{this.__setChildProperty(t,e,n)}).catch(s=>{console.error(s)})}else this.__setChildProperty(t,e,n)}__bindOutputOnElement(t,e,n){let r=Reflect.get(t,e);if(r instanceof h){this.__connectOutput(r,n);return}if(m.isCustomElement(t)){let s=t.tagName.toLowerCase();customElements.whenDefined(s).then(()=>{let o=Reflect.get(t,e);o instanceof h?this.__connectOutput(o,n):t.addEventListener(e,n)}).catch(o=>{console.error(o)})}else t.addEventListener(e,n)}__getReactivePropFromScope(t,e){let n=`__${t}`;if(n in e.host){let r=Reflect.get(e.host,n);if(r instanceof l)return r}if(e.parent)return this.__getReactivePropFromScope(t,e.parent)}__processBindings(){let t=this._shadowRoot.querySelectorAll("[data-lid]"),e=this.__getScope();for(let n of Array.from(t))if(!n.closest("[x-fluff-component]")&&n instanceof HTMLElement){let r=n.tagName.toLowerCase();if(customElements.get(r))continue;this.__processBindingsOnElement(n,e)}}__applyPendingProps(){let t=Reflect.get(this,"__pendingProps");if(this.isRecord(t)){for(let[e,n]of Object.entries(t)){console.log("apply-pending-prop",{propName:e,value:n,el:this.tagName});let r=`__${e}`;if(r in this){let s=Reflect.get(this,r);s instanceof l&&s.setValue(n,!0)}else e in this&&Reflect.set(this,e,n)}Reflect.deleteProperty(this,"__pendingProps")}}isHTMLElement(t){return t!==null}isRecord(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}__getReactiveProp(t){let e=`__${t}`;if(e in this){let n=Reflect.get(this,e);if(n instanceof l)return n}}};var d=class{static isFluffHostElement(t){return"__getReactiveProp"in t}static isIfConfig(t){return t.type==="if"}static isForConfig(t){return t.type==="for"}static isSwitchConfig(t){return t.type==="switch"}static isTextConfig(t){return t.type==="text"}static isBreakConfig(t){return t.type==="break"}};var f=class{id;startMarker;endMarker;subscriptions=[];host;shadowRoot;parentScope;loopContext={};markerManager;constructor(t,e,n,r,s){this.id=t,this.startMarker=e,this.endMarker=n,this.host=r,this.shadowRoot=s}setParentScope(t){this.parentScope=t}setLoopContext(t){this.loopContext=t}setMarkerManager(t){this.markerManager=t}cleanup(){for(let t of this.subscriptions)t.unsubscribe();this.subscriptions.length=0}updateRenderContext(t){}evaluateExpr(t){let e=this.getScope(),n=this.collectLocalsFromScope(e),r=this.getCompiledExprFn(t);try{return r(e.host,n)}catch{return}}getCompiledExprFn(t){let e=C.__e[t];if(typeof e!="function")throw new Error(`Missing compiled expression function for exprId ${t}`);return e}getScope(){if(this.parentScope)return this.parentScope;let t=this.__getFluffElementHost();return t?t.__getScope():{host:this.host,locals:this.loopContext,parent:void 0}}collectLocalsFromScope(t){let e={};return t.parent&&Object.assign(e,this.collectLocalsFromScope(t.parent)),Object.assign(e,t.locals),e}subscribeTo(t,e){let n=this.getScope();for(let r of t){let s=Array.isArray(r)?r[0]:r;if(s.startsWith("["))continue;let o=this.getReactivePropFromScope(s,n);if(o){let c=o.onChange.subscribe(e);this.subscriptions.push(c)}}}getReactivePropFromScope(t,e){if(!(t in e.locals)){if(e.parent)return this.getReactivePropFromScope(t,e.parent);if(d.isFluffHostElement(e.host)&&e.host.__getReactiveProp){let n=e.host.__getReactiveProp(t);if(n instanceof l)return n}}}createChildScope(t){return{host:this.host,locals:t,parent:this.parentScope}}clearContentBetweenMarkersWithCleanup(t){for(let r of t)r.unsubscribe();if(t.length=0,!this.endMarker)return;let e=this.startMarker.parentNode;if(!e)return;let n=this.startMarker.nextSibling;for(;n&&n!==this.endMarker;){let r=n.nextSibling;if(n instanceof Comment){let s=/^fluff:(if|for|switch|text|break):(\d+)$/.exec(n.data);if(s&&this.markerManager?.cleanupController){let o=parseInt(s[2],10);this.markerManager.cleanupController(o,n)}}n instanceof HTMLTemplateElement||e.removeChild(n),n=r}}insertBeforeEndMarker(t){if(!this.endMarker)return;let e=this.endMarker.parentNode;e&&e.insertBefore(t,this.endMarker)}processBindingsOnElement(t,e){let n=this.__getFluffElementHost();n&&n.__processBindingsOnElementPublic(t,e)}processBindingsOnElementWithSubscriptions(t,e,n){let r=this.__getFluffElementHost();r&&r.__processBindingsOnElementPublic(t,e,n)}__getFluffElementHost(){return this.host instanceof x?this.host:null}setScopeOnChildren(t,e,n,r,s){if(t instanceof Comment){let o=/^fluff:(if|for|switch|text|break):(\d+)$/.exec(t.data);if(o&&r){let[,c,a]=o,p=parseInt(a,10),g=`/fluff:${c}:${p}`,u=r.getController(p,t),R=u===void 0;if(!u&&r.ensureController){let T=null,y=t.nextSibling;for(;y;){if(y instanceof Comment&&y.data===g){T=y;break}y=y.nextSibling}u=r.ensureController(p,c,t,T)}u&&(u.setParentScope(e),u.setLoopContext(e.locals),u.updateRenderContext(n),R&&u.initialize())}}else if(t instanceof x)t.__loopContext=e.locals,t.__parentScope=e,this.processBindingsOnNode(t,e,s);else if(t instanceof HTMLElement&&m.isCustomElement(t)){let o=B(e);t.setAttribute("data-fluff-scope-id",o),this.processBindingsOnNode(t,e,s)}else t instanceof HTMLElement&&t.hasAttribute("data-lid")&&this.processBindingsOnNode(t,e,s);for(let o of Array.from(t.childNodes))this.setScopeOnChildren(o,e,n,r,s)}insertAndScopeTemplateContent(t,e,n,r,s,o){this.insertBeforeEndMarker(t);for(let c of e)this.setScopeOnChildren(c,n,r,s,o)}cloneAndInsertTemplate(t,e,n,r){let s=t.content.cloneNode(!0);if(!(s instanceof DocumentFragment))throw new Error("Expected DocumentFragment from template clone");let o=Array.from(s.childNodes),c=this.createChildScope(e);this.insertAndScopeTemplateContent(s,o,c,n,this.markerManager,r)}processBindingsOnNode(t,e,n){n?this.processBindingsOnElementWithSubscriptions(t,e,n):this.processBindingsOnElement(t,e)}};var S=class extends f{constructor(t,e,n,r,s,o){super(t,e,n,r,s)}initialize(){}updateRenderContext(t){t&&(t.shouldBreak=!0)}};var w=class extends f{config;itemTemplate=null;emptyTemplate=null;bindingsSubscriptions=[];constructor(t,e,n,r,s,o){super(t,e,n,r,s),this.config=o}initialize(){let e=`${this.host.tagName.toLowerCase()}-${this.id}`;this.itemTemplate=this.shadowRoot.querySelector(`template[data-fluff-tpl="${e}"]`),this.emptyTemplate=this.shadowRoot.querySelector(`template[data-fluff-empty="${e}"]`);let n=this.config.deps??[],r=()=>{this.clearContentBetweenMarkersWithCleanup(this.bindingsSubscriptions);let s=this.evaluateExpr(this.config.iterableExprId);if(!Array.isArray(s)||s.length===0){this.emptyTemplate&&this.cloneAndInsertTemplate(this.emptyTemplate,this.loopContext,void 0,this.bindingsSubscriptions);return}if(!this.itemTemplate)return;let o={shouldBreak:!1};for(let c=0;c<s.length&&!o.shouldBreak;c++){let a={...this.loopContext,[this.config.iterator]:s[c],$index:c};this.cloneAndInsertTemplate(this.itemTemplate,a,o,this.bindingsSubscriptions)}};this.subscribeTo(n,r),r()}};var E=class extends f{config;templates=[];currentBranchIndex=-1;bindingsSubscriptions=[];constructor(t,e,n,r,s,o){super(t,e,n,r,s),this.config=o}initialize(){let e=`${this.host.tagName.toLowerCase()}-${this.id}-`;this.templates=Array.from(this.shadowRoot.querySelectorAll(`template[data-fluff-branch^="${e}"]`));let n=[];for(let s of this.config.branches)s.deps&&n.push(...s.deps);let r=()=>{let s=-1;for(let o=0;o<this.config.branches.length;o++){let c=this.config.branches[o];if(c.exprId===void 0){s=o;break}if(this.evaluateExpr(c.exprId)){s=o;break}}s!==this.currentBranchIndex&&(this.clearContentBetweenMarkersWithCleanup(this.bindingsSubscriptions),this.currentBranchIndex=s,s>=0&&s<this.templates.length&&this.cloneAndInsertTemplate(this.templates[s],this.loopContext,void 0,this.bindingsSubscriptions))};this.subscribeTo(n,r),r()}};var k=class extends f{config;templates=[];bindingsSubscriptions=[];constructor(t,e,n,r,s,o){super(t,e,n,r,s),this.config=o}initialize(){let e=`${this.host.tagName.toLowerCase()}-${this.id}-`;this.templates=Array.from(this.shadowRoot.querySelectorAll(`template[data-fluff-case^="${e}"]`));let n=this.config.deps??[],r=()=>{this.clearContentBetweenMarkersWithCleanup(this.bindingsSubscriptions);let s=this.evaluateExpr(this.config.expressionExprId),o=!1,c=!1,a={shouldBreak:!1};for(let p=0;p<this.config.cases.length&&!a.shouldBreak;p++){let g=this.config.cases[p],u=this.templates[p];if(!u)continue;let R=g.isDefault||g.valueExprId!==void 0&&this.evaluateExpr(g.valueExprId)===s;(c||!o&&R)&&(o=!0,this.cloneAndInsertTemplate(u,this.loopContext,a,this.bindingsSubscriptions),c=g.fallthrough)}};this.subscribeTo(n,r),r()}};var P=class extends f{config;textNode=null;constructor(t,e,n,r,s,o){super(t,e,n,r,s),this.config=o}initialize(){this.textNode=document.createTextNode(""),this.insertBeforeEndMarker(this.textNode);let t=this.config.deps??[],e=this.config.pipes??[],n=()=>{let r=this.evaluateExpr(this.config.exprId);for(let s of e)r=this.applyPipe(s.name,r,s.argExprIds);this.textNode&&(this.textNode.textContent=this.formatValue(r))};this.subscribeTo(t,n),n()}formatValue(t){return t==null?"":typeof t=="object"?JSON.stringify(t):typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"?String(t):""}applyPipe(t,e,n){let r=this.host.__pipes;if(!r)return e;let s=r[t];if(!s)return console.warn(`Pipe "${t}" not found`),e;let o=n.map(c=>this.evaluateExpr(c));return s(e,...o)}};var I=class{controllers=new Map;configs=new Map;host;shadowRoot;constructor(t,e){this.host=t,this.shadowRoot=e}initializeFromConfig(t){let e=JSON.parse(t);this.configs.clear();for(let[r,s]of e)this.configs.set(r,s);for(let[r,s]of e){let{startMarker:o,endMarker:c}=this.findMarkers(r,s.type);if(!o)continue;let a=this.createController(r,o,c,s);a&&(a.setMarkerManager(this),this.registerController(r,o,a))}let n=[];for(let r of this.controllers.values())n.push(...r.values());for(let r of n)r.initialize()}ensureController(t,e,n,r){let s=this.getController(t,n);if(s)return s;let o=this.configs.get(t);if(o?.type!==e)return;let c=this.createController(t,n,r,o);if(c)return c.setMarkerManager(this),this.registerController(t,n,c),c}getController(t,e){return this.controllers.get(t)?.get(e)}cleanupController(t,e){let n=this.controllers.get(t);if(n){if(e){let r=n.get(e);if(!r)return;r.cleanup(),n.delete(e),n.size===0&&this.controllers.delete(t);return}for(let r of n.values())r.cleanup();this.controllers.delete(t)}}cleanup(){for(let t of this.controllers.values())for(let e of t.values())e.cleanup();this.controllers.clear()}registerController(t,e,n){let r=this.controllers.get(t);r||(r=new Map,this.controllers.set(t,r)),r.set(e,n)}findMarkers(t,e){let n=`fluff:${e}:${t}`,r=`/fluff:${e}:${t}`,s=null,o=null,c=document.createTreeWalker(this.shadowRoot,NodeFilter.SHOW_COMMENT,null),a=c.nextNode();for(;a;)a instanceof Comment&&(a.data===n?s=a:a.data===r&&(o=a)),a=c.nextNode();return{startMarker:s,endMarker:o}}createController(t,e,n,r){return d.isIfConfig(r)?new E(t,e,n,this.host,this.shadowRoot,r):d.isForConfig(r)?new w(t,e,n,this.host,this.shadowRoot,r):d.isSwitchConfig(r)?new k(t,e,n,this.host,this.shadowRoot,r):d.isTextConfig(r)?new P(t,e,n,this.host,this.shadowRoot,r):d.isBreakConfig(r)?new S(t,e,n,this.host,this.shadowRoot,r):null}};export{N as Component,_ as Direction,C as FluffBase,x as FluffElement,$ as HostBinding,H as HostListener,V as Input,I as MarkerManager,D as Output,z as Pipe,l as Property,h as Publisher,j as Reactive,J as ViewChild,q as Watch};
|
|
@@ -20,5 +20,4 @@ export interface ComponentMetadata extends ComponentConfig {
|
|
|
20
20
|
}
|
|
21
21
|
export declare function Component(config: ComponentConfig): <T extends Constructor>(target: T) => T;
|
|
22
22
|
export declare function getComponentMetadata(target: Constructor): ComponentMetadata | undefined;
|
|
23
|
-
export declare function getAllComponents(): Map<Constructor, ComponentMetadata>;
|
|
24
23
|
export {};
|
package/decorators/Component.js
CHANGED
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
return Array.isArray(val);
|
|
3
|
-
}
|
|
1
|
+
import { MetadataArrayHelper } from './MetadataArrayHelper.js';
|
|
4
2
|
export function HostBinding(hostProperty) {
|
|
5
3
|
return function (target, propertyKey) {
|
|
6
4
|
const ctor = target.constructor;
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
const bindings = isHostBindingArray(existing) ? existing : [];
|
|
10
|
-
if (!isHostBindingArray(existing)) {
|
|
11
|
-
Reflect.set(ctor, '__hostBindings', bindings);
|
|
12
|
-
}
|
|
13
|
-
bindings.push({ property: key, hostProperty });
|
|
5
|
+
const bindings = MetadataArrayHelper.getOrCreateArray(ctor, '__hostBindings');
|
|
6
|
+
bindings.push({ property: String(propertyKey), hostProperty });
|
|
14
7
|
};
|
|
15
8
|
}
|
|
@@ -1,16 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
return Array.isArray(val);
|
|
3
|
-
}
|
|
1
|
+
import { MetadataArrayHelper } from './MetadataArrayHelper.js';
|
|
4
2
|
export function HostListener(eventName) {
|
|
5
3
|
return function (target, propertyKey, descriptor) {
|
|
6
4
|
const ctor = target.constructor;
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
const listeners = isHostListenerArray(existing) ? existing : [];
|
|
10
|
-
if (!isHostListenerArray(existing)) {
|
|
11
|
-
Reflect.set(ctor, '__hostListeners', listeners);
|
|
12
|
-
}
|
|
13
|
-
listeners.push({ method: key, event: eventName });
|
|
5
|
+
const listeners = MetadataArrayHelper.getOrCreateArray(ctor, '__hostListeners');
|
|
6
|
+
listeners.push({ method: String(propertyKey), event: eventName });
|
|
14
7
|
return descriptor;
|
|
15
8
|
};
|
|
16
9
|
}
|
package/decorators/Input.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare
|
|
1
|
+
export declare const Input: (bindingName?: string) => PropertyDecorator;
|
package/decorators/Input.js
CHANGED
|
@@ -1,16 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
return typeof val === 'function';
|
|
4
|
-
}
|
|
5
|
-
export function Input(bindingName) {
|
|
6
|
-
return function (target, propertyKey) {
|
|
7
|
-
const { constructor } = target;
|
|
8
|
-
if (!isConstructor(constructor))
|
|
9
|
-
return;
|
|
10
|
-
const metadata = getComponentMetadata(constructor);
|
|
11
|
-
if (metadata) {
|
|
12
|
-
const name = bindingName ?? String(propertyKey);
|
|
13
|
-
metadata.inputs.set(String(propertyKey), name);
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
}
|
|
1
|
+
import { createInputOutputDecorator } from './InputOutputHelper.js';
|
|
2
|
+
export const Input = createInputOutputDecorator('inputs');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function createInputOutputDecorator(type: 'inputs' | 'outputs'): (bindingName?: string) => PropertyDecorator;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { getComponentMetadata } from './Component.js';
|
|
2
|
+
function isConstructor(val) {
|
|
3
|
+
return typeof val === 'function';
|
|
4
|
+
}
|
|
5
|
+
export function createInputOutputDecorator(type) {
|
|
6
|
+
return function (bindingName) {
|
|
7
|
+
return function (target, propertyKey) {
|
|
8
|
+
const { constructor } = target;
|
|
9
|
+
if (!isConstructor(constructor))
|
|
10
|
+
return;
|
|
11
|
+
const metadata = getComponentMetadata(constructor);
|
|
12
|
+
if (metadata) {
|
|
13
|
+
const name = bindingName ?? String(propertyKey);
|
|
14
|
+
metadata[type].set(String(propertyKey), name);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export class MetadataArrayHelper {
|
|
2
|
+
static getOrCreateArray(ctor, metadataKey) {
|
|
3
|
+
const existing = Reflect.get(ctor, metadataKey);
|
|
4
|
+
if (this.isTypedArray(existing)) {
|
|
5
|
+
return existing;
|
|
6
|
+
}
|
|
7
|
+
const arr = [];
|
|
8
|
+
Reflect.set(ctor, metadataKey, arr);
|
|
9
|
+
return arr;
|
|
10
|
+
}
|
|
11
|
+
static isTypedArray(value) {
|
|
12
|
+
return Array.isArray(value);
|
|
13
|
+
}
|
|
14
|
+
}
|
package/decorators/Output.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare
|
|
1
|
+
export declare const Output: (bindingName?: string) => PropertyDecorator;
|
package/decorators/Output.js
CHANGED
|
@@ -1,16 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
return typeof val === 'function';
|
|
4
|
-
}
|
|
5
|
-
export function Output(bindingName) {
|
|
6
|
-
return function (target, propertyKey) {
|
|
7
|
-
const { constructor } = target;
|
|
8
|
-
if (!isConstructor(constructor))
|
|
9
|
-
return;
|
|
10
|
-
const metadata = getComponentMetadata(constructor);
|
|
11
|
-
if (metadata) {
|
|
12
|
-
const name = bindingName ?? String(propertyKey);
|
|
13
|
-
metadata.outputs.set(String(propertyKey), name);
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
}
|
|
1
|
+
import { createInputOutputDecorator } from './InputOutputHelper.js';
|
|
2
|
+
export const Output = createInputOutputDecorator('outputs');
|
package/decorators/ViewChild.js
CHANGED
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
return Array.isArray(val);
|
|
3
|
-
}
|
|
1
|
+
import { MetadataArrayHelper } from './MetadataArrayHelper.js';
|
|
4
2
|
export function ViewChild(refOrSelector) {
|
|
5
3
|
return function (target, propertyKey) {
|
|
6
4
|
const ctor = target.constructor;
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
const children = isViewChildArray(existing) ? existing : [];
|
|
10
|
-
if (!isViewChildArray(existing)) {
|
|
11
|
-
Reflect.set(ctor, '__viewChildren', children);
|
|
12
|
-
}
|
|
13
|
-
children.push({ property: key, selector: refOrSelector });
|
|
5
|
+
const children = MetadataArrayHelper.getOrCreateArray(ctor, '__viewChildren');
|
|
6
|
+
children.push({ property: String(propertyKey), selector: refOrSelector });
|
|
14
7
|
};
|
|
15
8
|
}
|
package/index.d.ts
CHANGED
|
@@ -9,7 +9,9 @@ export type { PipeTransform } from './decorators/Pipe.js';
|
|
|
9
9
|
export { Reactive } from './decorators/Reactive.js';
|
|
10
10
|
export { ViewChild } from './decorators/ViewChild.js';
|
|
11
11
|
export { Watch } from './decorators/Watch.js';
|
|
12
|
+
export { FluffBase } from './runtime/FluffElement.js';
|
|
12
13
|
export { FluffElement } from './runtime/FluffElement.js';
|
|
14
|
+
export { MarkerManager } from './runtime/FluffMarkers.js';
|
|
13
15
|
export { Property } from './utils/Property.js';
|
|
14
16
|
export { Publisher } from './utils/Publisher.js';
|
|
15
17
|
export { Direction } from './enums/Direction.js';
|
package/index.js
CHANGED
|
@@ -7,7 +7,9 @@ export { Pipe } from './decorators/Pipe.js';
|
|
|
7
7
|
export { Reactive } from './decorators/Reactive.js';
|
|
8
8
|
export { ViewChild } from './decorators/ViewChild.js';
|
|
9
9
|
export { Watch } from './decorators/Watch.js';
|
|
10
|
+
export { FluffBase } from './runtime/FluffElement.js';
|
|
10
11
|
export { FluffElement } from './runtime/FluffElement.js';
|
|
12
|
+
export { MarkerManager } from './runtime/FluffMarkers.js';
|
|
11
13
|
export { Property } from './utils/Property.js';
|
|
12
14
|
export { Publisher } from './utils/Publisher.js';
|
|
13
15
|
export { Direction } from './enums/Direction.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { BreakMarkerConfig } from './BreakMarkerConfig.js';
|
|
2
|
+
import type { ForMarkerConfig } from './ForMarkerConfig.js';
|
|
3
|
+
import type { IfMarkerConfig } from './IfMarkerConfig.js';
|
|
4
|
+
import type { SwitchMarkerConfig } from './SwitchMarkerConfig.js';
|
|
5
|
+
import type { TextMarkerConfig } from './TextMarkerConfig.js';
|
|
6
|
+
export type MarkerConfig = IfMarkerConfig | ForMarkerConfig | SwitchMarkerConfig | TextMarkerConfig | BreakMarkerConfig;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type PropertyChain = string | string[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { BreakMarkerConfig } from '../interfaces/BreakMarkerConfig.js';
|
|
2
|
+
import type { RenderContext } from '../interfaces/RenderContext.js';
|
|
3
|
+
import { MarkerController } from './MarkerController.js';
|
|
4
|
+
export declare class BreakController extends MarkerController {
|
|
5
|
+
constructor(id: number, startMarker: Comment, endMarker: Comment | null, host: HTMLElement, shadowRoot: ShadowRoot, _config: BreakMarkerConfig);
|
|
6
|
+
initialize(): void;
|
|
7
|
+
updateRenderContext(renderContext?: RenderContext): void;
|
|
8
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { MarkerController } from './MarkerController.js';
|
|
2
|
+
export class BreakController extends MarkerController {
|
|
3
|
+
constructor(id, startMarker, endMarker, host, shadowRoot, _config) {
|
|
4
|
+
super(id, startMarker, endMarker, host, shadowRoot);
|
|
5
|
+
}
|
|
6
|
+
initialize() {
|
|
7
|
+
}
|
|
8
|
+
updateRenderContext(renderContext) {
|
|
9
|
+
if (renderContext) {
|
|
10
|
+
renderContext.shouldBreak = true;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { PropertyChain } from '../interfaces/PropertyChain.js';
|
|
2
|
+
import type { Subscription } from '../interfaces/Subscription.js';
|
|
3
|
+
import { Property } from '../utils/Property.js';
|
|
4
|
+
import type { Scope } from './ScopeRegistry.js';
|
|
5
|
+
export type ExpressionFn = (t: unknown, l: Record<string, unknown>) => unknown;
|
|
6
|
+
export type HandlerFn = (t: unknown, l: Record<string, unknown>, e: unknown) => void;
|
|
7
|
+
export interface BindingInfo {
|
|
8
|
+
n: string;
|
|
9
|
+
b: 'property' | 'event' | 'two-way' | 'class' | 'style' | 'ref';
|
|
10
|
+
e?: number;
|
|
11
|
+
h?: number;
|
|
12
|
+
t?: string;
|
|
13
|
+
d?: PropertyChain[];
|
|
14
|
+
s?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare abstract class FluffBase extends HTMLElement {
|
|
17
|
+
static __e: ExpressionFn[];
|
|
18
|
+
static __h: HandlerFn[];
|
|
19
|
+
static __bindings: Record<string, BindingInfo[]>;
|
|
20
|
+
__parentScope?: Scope;
|
|
21
|
+
__loopContext: Record<string, unknown>;
|
|
22
|
+
protected __baseSubscriptions: Subscription[];
|
|
23
|
+
__getScope(): Scope;
|
|
24
|
+
protected __processBindingsOnElement(el: HTMLElement, scope: Scope, subscriptions?: Subscription[]): void;
|
|
25
|
+
private __getBindingsForLid;
|
|
26
|
+
private __isBindingsMap;
|
|
27
|
+
protected __applyBindingWithScope(el: HTMLElement, binding: BindingInfo, scope: Scope, subscriptions?: Subscription[]): void;
|
|
28
|
+
protected __getCompiledExprFn(exprId: number): ExpressionFn;
|
|
29
|
+
protected __getCompiledHandlerFn(handlerId: number): HandlerFn;
|
|
30
|
+
protected __subscribeToExpressionInScope(deps: PropertyChain[] | undefined, scope: Scope, callback: () => void, subscriptions?: Subscription[]): void;
|
|
31
|
+
protected __getReactivePropFromScope(propName: string, scope: Scope): Property<unknown> | undefined;
|
|
32
|
+
protected __setChildProperty(el: Element, propName: string, value: unknown): void;
|
|
33
|
+
private __applyPropertyBindingWithScope;
|
|
34
|
+
private __applyEventBindingWithScope;
|
|
35
|
+
private __applyOutputBinding;
|
|
36
|
+
protected __whenDefined(tagName: string, callback: () => void): void;
|
|
37
|
+
private __applyTwoWayBindingWithScope;
|
|
38
|
+
private __applyClassBindingWithScope;
|
|
39
|
+
private __applyStyleBindingWithScope;
|
|
40
|
+
}
|