UNPKG

@osaedasia/oresume

Version:

A user-friendly library for generating complete Single Page Applications (SPAs)

2 lines (1 loc) 905 B
import{APatternService as t}from"./APatternService.js";import{DomHelper as e}from"../../helpers/DomHelper.js";import{ParserAttributes as r}from"../../../domain/attributes/ParserAttributes.js";class n extends t{type="function";_excludedAttrsFromMatch=[r.PATTERN];_attrFunctionIndices;constructor(){super(),this._attrFunctionIndices=new Set}getAttributeValueRegex(){return e.createAttributeValuePattern(this.getPatternRegex())}createPatternObject(t,e){return"function"==typeof e?{type:"function",index:t,marker:this.createPatternMarker(t),handler:e}:null}handleAttributeMatch(t,e){const[n,a,i]=t,s=Number(i);return this._attrFunctionIndices.add(s),this._excludedAttrsFromMatch.includes(a)?n:(e.eventType=a.startsWith("on")?a.slice(2):a,`${r.PATTERN}="${e.marker}"`)}handleContentMatch(t,e){const[r,n]=t,a=Number(n);return this._attrFunctionIndices.has(a)?r:e.handler()}}export{n as FunctionPatternService};