🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@mpkit/types

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mpkit/types - npm Package Compare versions

Comparing version
1.0.6
to
1.0.10
+22
-13
dist/index.cjs.js
/*!
* MpKit v1.0.6
* MpKit v1.0.9
* (c) 2020-2020 imingyu<mingyuhisoft@163.com>

@@ -51,15 +51,24 @@ * Released under the MIT License.

(function (MpElementType) {
MpElementType["node"] = "node";
MpElementType["text"] = "text";
MpElementType["comment"] = "comment";
})(exports.MpElementType || (exports.MpElementType = {}));
(function (MpWhereType) {
MpWhereType["if"] = "if";
MpWhereType["elseif"] = "elseif";
MpWhereType["else"] = "else";
})(exports.MpWhereType || (exports.MpWhereType = {}));
(function (MpElementContentType) {
MpElementContentType["number"] = "number";
MpElementContentType["boolean"] = "boolean";
MpElementContentType["string"] = "string";
MpElementContentType["null"] = "null";
MpElementContentType["dynamic"] = "dynamic";
})(exports.MpElementContentType || (exports.MpElementContentType = {}));
(function (MpXmlContentType) {
MpXmlContentType["static"] = "static";
MpXmlContentType["dynamic"] = "dynamic";
})(exports.MpXmlContentType || (exports.MpXmlContentType = {}));
(function (MkValidateMessagePosition) {
MkValidateMessagePosition["tag"] = "tag";
MkValidateMessagePosition["attr"] = "attr";
MkValidateMessagePosition["content"] = "content";
})(exports.MkValidateMessagePosition || (exports.MkValidateMessagePosition = {}));
(function (MkXmlElementType) {
MkXmlElementType["node"] = "node";
MkXmlElementType["text"] = "text";
MkXmlElementType["comment"] = "comment";
})(exports.MkXmlElementType || (exports.MkXmlElementType = {}));
//# sourceMappingURL=index.cjs.js.map

@@ -1,1 +0,1 @@

{"version":3,"file":"index.cjs.js","sources":["../api.ts","../platform.ts","../ebus.ts","../view.ts","../view-parser.ts"],"sourcesContent":["export interface MpApiCallback {\n (res?: any);\n}\nexport interface MpApiMethodArg {\n success: MpApiCallback;\n fail: MpApiCallback;\n complete: MpApiCallback;\n [prop: string]: any;\n}\nexport interface MpApiMethod {\n (options?: MpApiMethodArg | any): any;\n}\n\nexport interface MpApiVar {\n [prop: string]: MpApiMethod;\n}\nexport enum MpRequestOptionsMethod {\n OPTIONS = \"OPTIONS\",\n GET = \"GET\",\n POST = \"POST\",\n HEAD = \"HEAD\",\n PUT = \"PUT\",\n DELETE = \"DELETE\",\n TRACE = \"TRACE\",\n CONNECT = \"CONNECT\",\n}\nexport interface MpRequestOptions extends MpApiMethodArg {\n url: string;\n method: MpRequestOptionsMethod;\n headers?: {\n [prop: string]: string | number;\n };\n}\nexport interface MpRequestTask {\n abort: Function;\n}\nexport interface MpApiRequestMethod {\n (options: MpRequestOptions): MpRequestTask;\n}\n","export enum MpPlatform {\n wechat = \"wechat\",\n alipay = \"alipay\",\n smart = \"smart\",\n tiktok = \"tiktok\",\n unknown = \"unknown\",\n}\n","export interface EventData {\n type: string;\n ts: number;\n data?: any;\n}\nexport interface EventHandler {\n (eventData: EventData, ...args: any[]);\n}\nexport interface EBus {\n on(type: string, handler: EventHandler);\n off(type: string, handler?: EventHandler);\n emit(type: string, data: any);\n}\nexport enum EventType {\n All = \"All\",\n Error = \"Error\",\n ViewInitLife = \"ViewInitLife\",\n ViewInitMount = \"ViewInitMount\",\n ViewMethodStart = \"ViewMethodStart\",\n ViewMethodEnd = \"ViewMethodEnd\",\n UIEvent = \"UIEvent\",\n ApiMethodStart = \"ApiMethodStart\",\n ApiMethodEnd = \"ApiMethodEnd\",\n ApiMethodComplete = \"ApiMethodComplete\",\n RequestStart = \"RequestStart\",\n RequestEnd = \"RequestEnd\",\n}\n","import { MkEnumMap } from \"./util\";\nimport { MkSetData } from \"./set-data\";\nexport interface MpAppLaunchOptions {}\nexport interface MpViewInitLife<V, T> {\n (this: V, options: T): void;\n}\nexport interface MpViewLife<V> {\n (this: V): void;\n}\nexport type MpViewInitLifes = \"onLaunch\" | \"onLoad\" | \"created\" | \"onInit\";\nexport type MpViewMountLifes = \"onShow\" | \"attached\" | \"didMount\";\n// 小程序App实例\nexport interface MpViewApp extends MpViewAppSpec, MpView {}\n// 小程序App函数接收的配置对象\nexport interface MpViewAppSpec {\n onLaunch: MpViewInitLife<MpViewApp, MpAppLaunchOptions>;\n onShow: MpViewInitLife<MpViewApp, MpAppLaunchOptions>;\n onHide: MpViewLife<MpViewApp>;\n onError: MpViewLife<MpViewApp>;\n [prop: string]: any;\n}\nexport interface MpAlipayViewApp extends MpViewApp, MpAlipayViewAppSpec {}\nexport interface MpAlipayViewAppSpec extends MpViewAppSpec {\n onShareAppMessage: MpViewLife<MpAlipayViewApp>;\n}\n\nexport interface MpViewFactory {\n (spec: MpViewAppSpec | MpViewPageSpec | MpViewComponentSpec | any): void;\n}\nexport enum MpViewType {\n App = \"App\",\n Page = \"Page\",\n Component = \"Component\",\n}\nexport interface MpViewSpec {\n data: any;\n}\nexport interface MpViewComponetPropSpec {\n type: Function;\n default?: any;\n observer?: Function;\n}\nexport interface MpViewPageSpec extends MpViewSpec {\n [prop: string]: any;\n}\nexport type MpViewComponentLifes =\n | \"created\"\n | \"attached\"\n | \"ready\"\n | \"moved\"\n | \"detached\"\n | \"error\";\nexport type MpViewComponentPageLifes = \"show\" | \"hide\" | \"resize\";\nexport interface MpViewComponentSpec extends MpViewSpec {\n properties?: {\n [prop: string]: Function | MpViewComponetPropSpec;\n };\n lifetimes?: MkEnumMap<MpViewComponentLifes, Function | string>;\n pageLifetimes?: MkEnumMap<MpViewComponentPageLifes, Function | string>;\n methods: {\n [prop: string]: Function;\n };\n [prop: string]: any;\n}\nexport interface MpView {\n $mkSpec: MpViewSpec;\n $mkType: MpViewType;\n $mkKey: string;\n $mkKeyIsDefine?: boolean | string;\n $mkNativeSetData: MpSetDataHandler;\n $mkSetData: MkSetData;\n $mkSetDataIsBind?: boolean;\n $mkReadyData: any;\n data: any;\n setData: MpSetDataHandler;\n}\nexport interface MpWechatSelectOwnerComponent {\n (): void | MpView;\n}\nexport interface MpWechatView extends MpView {\n __wxExparserNodeId__: string;\n __wxWebviewId__: number;\n is: string;\n selectOwnerComponent: MpWechatSelectOwnerComponent;\n}\nexport interface MpWechatPageView extends MpWechatView {\n route: string;\n}\nexport interface MpTiktokView extends MpView {\n __webviewId__: number;\n __nodeId__: number;\n is: string;\n}\nexport interface MpComponentPropObserver {\n (this: MpView, oldValue: any, newVal: any): void;\n}\n\nexport interface MpComponentPropSpec {\n type: Function;\n default: any;\n observer: MpComponentPropObserver;\n}\n\nexport interface MpAlipayView extends MpView {\n $id: number;\n}\n\nexport interface MpAlipayViewPage extends MpAlipayView {\n $viewId: string;\n route: string;\n}\nexport interface MpAlipayViewComponent extends MpAlipayView {\n $page: MpAlipayViewPage;\n is: string;\n props: {\n [prop: string]: any;\n __tag: string;\n };\n}\nexport interface MpSmartViewPage extends MpView {\n route: string;\n}\nexport interface MpSmartViewComponent extends MpView {\n componentName: string;\n nodeId: string;\n pageinstance: MpSmartViewPage;\n is: string;\n}\nexport interface MpSetDataHandler {\n (data: any, callback?: Function): void;\n}\n","export interface MpViewParserOptions {}\nexport interface MpElement {\n tag?: string;\n type: MpElementType;\n attrs?: MpElementAttr[];\n children?: MpElementContent[] | MpElement[];\n selfCloseing?: boolean;\n}\nexport enum MpElementType {\n node = \"node\",\n text = \"text\",\n comment = \"comment\",\n}\nexport interface MpElementAttr {\n name: string;\n value?: MpElementContent;\n}\n\nexport enum MpElementContentType {\n number = \"number\",\n boolean = \"boolean\",\n string = \"string\",\n null = \"null\",\n dynamic = \"dynamic\",\n}\nexport interface MpElementContent {\n type: MpElementContentType;\n value: string | number | boolean | null | MpDynamicValue;\n}\nexport interface MpDynamicValue {\n source: string;\n ast: any;\n}\n"],"names":["MpRequestOptionsMethod","MpPlatform","EventType","MpViewType","MpElementType","MpElementContentType"],"mappings":";;;;;;;;;;AAgBA,WAAYA;AACRA,EAAAA,iCAAA,YAAA;AACAA,EAAAA,6BAAA,QAAA;AACAA,EAAAA,8BAAA,SAAA;AACAA,EAAAA,8BAAA,SAAA;AACAA,EAAAA,6BAAA,QAAA;AACAA,EAAAA,gCAAA,WAAA;AACAA,EAAAA,+BAAA,UAAA;AACAA,EAAAA,iCAAA,YAAA;AACH,CATD,EAAYA,8BAAsB,KAAtBA,8BAAsB,KAAA,CAAlC;;AChBA,WAAYC;AACRA,EAAAA,oBAAA,WAAA;AACAA,EAAAA,oBAAA,WAAA;AACAA,EAAAA,mBAAA,UAAA;AACAA,EAAAA,oBAAA,WAAA;AACAA,EAAAA,qBAAA,YAAA;AACH,CAND,EAAYA,kBAAU,KAAVA,kBAAU,KAAA,CAAtB;;ACaA,WAAYC;AACRA,EAAAA,gBAAA,QAAA;AACAA,EAAAA,kBAAA,UAAA;AACAA,EAAAA,yBAAA,iBAAA;AACAA,EAAAA,0BAAA,kBAAA;AACAA,EAAAA,4BAAA,oBAAA;AACAA,EAAAA,0BAAA,kBAAA;AACAA,EAAAA,oBAAA,YAAA;AACAA,EAAAA,2BAAA,mBAAA;AACAA,EAAAA,yBAAA,iBAAA;AACAA,EAAAA,8BAAA,sBAAA;AACAA,EAAAA,yBAAA,iBAAA;AACAA,EAAAA,uBAAA,eAAA;AACH,CAbD,EAAYA,iBAAS,KAATA,iBAAS,KAAA,CAArB;;ACgBA,WAAYC;AACRA,EAAAA,iBAAA,QAAA;AACAA,EAAAA,kBAAA,SAAA;AACAA,EAAAA,uBAAA,cAAA;AACH,CAJD,EAAYA,kBAAU,KAAVA,kBAAU,KAAA,CAAtB;;ACrBA,WAAYC;AACRA,EAAAA,qBAAA,SAAA;AACAA,EAAAA,qBAAA,SAAA;AACAA,EAAAA,wBAAA,YAAA;AACH,CAJD,EAAYA,qBAAa,KAAbA,qBAAa,KAAA,CAAzB;;AAUA,WAAYC;AACRA,EAAAA,8BAAA,WAAA;AACAA,EAAAA,+BAAA,YAAA;AACAA,EAAAA,8BAAA,WAAA;AACAA,EAAAA,4BAAA,SAAA;AACAA,EAAAA,+BAAA,YAAA;AACH,CAND,EAAYA,4BAAoB,KAApBA,4BAAoB,KAAA,CAAhC"}
{"version":3,"file":"index.cjs.js","sources":["../api.ts","../platform.ts","../ebus.ts","../view.ts","../view-parser.ts"],"sourcesContent":["export interface MpApiCallback {\n (res?: any);\n}\nexport interface MpApiMethodArg {\n success: MpApiCallback;\n fail: MpApiCallback;\n complete: MpApiCallback;\n [prop: string]: any;\n}\nexport interface MpApiMethod {\n (options?: MpApiMethodArg | any): any;\n}\n\nexport interface MpApiVar {\n [prop: string]: MpApiMethod;\n}\nexport enum MpRequestOptionsMethod {\n OPTIONS = \"OPTIONS\",\n GET = \"GET\",\n POST = \"POST\",\n HEAD = \"HEAD\",\n PUT = \"PUT\",\n DELETE = \"DELETE\",\n TRACE = \"TRACE\",\n CONNECT = \"CONNECT\",\n}\nexport interface MpRequestOptions extends MpApiMethodArg {\n url: string;\n method: MpRequestOptionsMethod;\n headers?: {\n [prop: string]: string | number;\n };\n}\nexport interface MpRequestTask {\n abort: Function;\n}\nexport interface MpApiRequestMethod {\n (options: MpRequestOptions): MpRequestTask;\n}\n","export enum MpPlatform {\n wechat = \"wechat\",\n alipay = \"alipay\",\n smart = \"smart\",\n tiktok = \"tiktok\",\n unknown = \"unknown\",\n}\n","export interface EventData {\n type: string;\n ts: number;\n data?: any;\n}\nexport interface EventHandler {\n (eventData: EventData, ...args: any[]);\n}\nexport interface EBus {\n on(type: string, handler: EventHandler);\n off(type: string, handler?: EventHandler);\n emit(type: string, data: any);\n}\nexport enum EventType {\n All = \"All\",\n Error = \"Error\",\n ViewInitLife = \"ViewInitLife\",\n ViewInitMount = \"ViewInitMount\",\n ViewMethodStart = \"ViewMethodStart\",\n ViewMethodEnd = \"ViewMethodEnd\",\n UIEvent = \"UIEvent\",\n ApiMethodStart = \"ApiMethodStart\",\n ApiMethodEnd = \"ApiMethodEnd\",\n ApiMethodComplete = \"ApiMethodComplete\",\n RequestStart = \"RequestStart\",\n RequestEnd = \"RequestEnd\",\n}\n","import { MkEnumMap } from \"./util\";\nimport { MkSetData } from \"./set-data\";\nexport interface MpAppLaunchOptions {}\nexport interface MpViewInitLife<V, T> {\n (this: V, options: T): void;\n}\nexport interface MpViewLife<V> {\n (this: V): void;\n}\nexport type MpViewInitLifes = \"onLaunch\" | \"onLoad\" | \"created\" | \"onInit\";\nexport type MpViewMountLifes = \"onShow\" | \"attached\" | \"didMount\";\n// 小程序App实例\nexport interface MpViewApp extends MpViewAppSpec, MpView {}\n// 小程序App函数接收的配置对象\nexport interface MpViewAppSpec {\n onLaunch: MpViewInitLife<MpViewApp, MpAppLaunchOptions>;\n onShow: MpViewInitLife<MpViewApp, MpAppLaunchOptions>;\n onHide: MpViewLife<MpViewApp>;\n onError: MpViewLife<MpViewApp>;\n [prop: string]: any;\n}\nexport interface MpAlipayViewApp extends MpViewApp, MpAlipayViewAppSpec {}\nexport interface MpAlipayViewAppSpec extends MpViewAppSpec {\n onShareAppMessage: MpViewLife<MpAlipayViewApp>;\n}\n\nexport interface MpViewFactory {\n (spec: MpViewAppSpec | MpViewPageSpec | MpViewComponentSpec | any): void;\n}\nexport enum MpViewType {\n App = \"App\",\n Page = \"Page\",\n Component = \"Component\",\n}\nexport interface MpViewSpec {\n data: any;\n}\nexport interface MpViewComponetPropSpec {\n type: Function;\n default?: any;\n observer?: Function;\n}\nexport interface MpViewPageSpec extends MpViewSpec {\n [prop: string]: any;\n}\nexport type MpViewComponentLifes =\n | \"created\"\n | \"attached\"\n | \"ready\"\n | \"moved\"\n | \"detached\"\n | \"error\";\nexport type MpViewComponentPageLifes = \"show\" | \"hide\" | \"resize\";\nexport interface MpViewComponentSpec extends MpViewSpec {\n properties?: {\n [prop: string]: Function | MpViewComponetPropSpec;\n };\n lifetimes?: MkEnumMap<MpViewComponentLifes, Function | string>;\n pageLifetimes?: MkEnumMap<MpViewComponentPageLifes, Function | string>;\n methods: {\n [prop: string]: Function;\n };\n [prop: string]: any;\n}\nexport interface MpView {\n $mkSpec: MpViewSpec;\n $mkType: MpViewType;\n $mkKey: string;\n $mkKeyIsDefine?: boolean | string;\n $mkNativeSetData: MpSetDataHandler;\n $mkSetData: MkSetData;\n $mkSetDataIsBind?: boolean;\n $mkReadyData: any;\n data: any;\n setData: MpSetDataHandler;\n}\nexport interface MpWechatSelectOwnerComponent {\n (): void | MpView;\n}\nexport interface MpWechatView extends MpView {\n __wxExparserNodeId__: string;\n __wxWebviewId__: number;\n is: string;\n selectOwnerComponent: MpWechatSelectOwnerComponent;\n}\nexport interface MpWechatPageView extends MpWechatView {\n route: string;\n}\nexport interface MpTiktokView extends MpView {\n __webviewId__: number;\n __nodeId__: number;\n is: string;\n}\nexport interface MpComponentPropObserver {\n (this: MpView, oldValue: any, newVal: any): void;\n}\n\nexport interface MpComponentPropSpec {\n type: Function;\n default: any;\n observer: MpComponentPropObserver;\n}\n\nexport interface MpAlipayView extends MpView {\n $id: number;\n}\n\nexport interface MpAlipayViewPage extends MpAlipayView {\n $viewId: string;\n route: string;\n}\nexport interface MpAlipayViewComponent extends MpAlipayView {\n $page: MpAlipayViewPage;\n is: string;\n props: {\n [prop: string]: any;\n __tag: string;\n };\n}\nexport interface MpSmartViewPage extends MpView {\n route: string;\n}\nexport interface MpSmartViewComponent extends MpView {\n componentName: string;\n nodeId: string;\n pageinstance: MpSmartViewPage;\n is: string;\n}\nexport interface MpSetDataHandler {\n (data: any, callback?: Function): void;\n}\n","import { MkOmit, MkMap, MkEnumMap } from \"./util\";\nimport { MpPlatform } from \".\";\nexport interface MpSpec {\n [prop: string]: MkEnumMap<MpPlatform, MpViewSyntaxSpec>;\n}\nexport interface MpViewSyntaxSpec {\n namespace: string;\n for: string;\n forItem: string;\n forIndex: string;\n key: string;\n if: string;\n elseif: string;\n else: string;\n forAndWhereAttrNeedBracket: boolean;\n}\nexport enum MpWhereType {\n if = \"if\",\n elseif = \"elseif\",\n else = \"else\",\n}\nexport interface MpXmlContent {\n type: MpXmlContentType;\n value: string;\n}\nexport interface MpForAttrContent extends MpXmlContent {\n type: MpXmlContentType;\n value: string;\n featureList?: string;\n featureItem?: string;\n featureIndex?: string;\n featureKey?: string;\n}\nexport interface ParseElementAdapterArg {\n currentElement: MkXmlElement;\n currentElementIndex: number;\n brotherElements: MkXmlElement[];\n allElements: MkXmlElement[];\n orgXml: string;\n}\nexport interface IParseElementAdapter {\n attrAdapters: MkMap<IParseAttrAdapter>;\n contentAdapter: IParseContentAdapter;\n parse(data: ParseElementAdapterArg): MpXmlElement;\n}\nexport interface ParseAttrAdapterArg {\n currentElement: MkXmlElement;\n currentElementIndex: number;\n brotherElements: MkXmlElement[];\n allElements: MkXmlElement[];\n orgXml: string;\n currentAttr: MkXmlElementAttr;\n allAttrs: MkXmlElementAttr[];\n prevParseAttr?: MpXmlElementAttr;\n}\nexport interface IParseAttrAdapter {\n parse(data: ParseAttrAdapterArg): MpXmlElementAttr;\n}\nexport interface IMpParseAttrAdapter\n extends IMpParseAdapter,\n IParseAttrAdapter {}\nexport interface IMpParseAdapter {\n mpPlatform: MpPlatform;\n}\nexport interface IParseContentAdapter {\n parse(content: string): MpXmlContent[];\n}\n\nexport enum MpXmlContentType {\n static = \"static\",\n dynamic = \"dynamic\",\n}\nexport interface MpXmlParseResult extends MkOmit<MkXmlParseResult, \"elements\"> {\n elements?: MpXmlElement[];\n}\nexport interface MpXmlParseResultJSON\n extends MkOmit<MkXmlParseResult, \"elements\" | \"xml\" | \"xmlRows\"> {\n xml?: string;\n xmlRows?: string;\n elements?: MpXmlElementJSON[];\n}\nexport interface MpXmlElementJSON\n extends MkOmit<\n MkXmlElement,\n \"attrs\" | \"children\" | \"content\" | \"sourceLocationInfo\"\n > {\n attrs?: MpXmlElementAttrJSON[];\n children?: MpXmlElementJSON[];\n content?: MpXmlContent[];\n sourceLocationInfo?: MkXmlSourceLocationInfo;\n}\nexport interface MpXmlElementAttrJSON\n extends MkOmit<MkXmlElementAttr, \"content\" | \"sourceLocationInfo\"> {\n content?: MpXmlContent[];\n sourceLocationInfo?: MkXmlSourceLocationInfo;\n}\nexport interface MpXmlElementAttr extends MpXmlElementAttrJSON {\n sourceLocationInfo: MkXmlSourceLocationInfo;\n}\nexport interface MpXmlElement\n extends MkOmit<MpXmlElementJSON, \"attrs\" | \"children\"> {\n parent?: MpXmlElement;\n attrs?: MpXmlElementAttr[];\n children?: MpXmlElement[];\n sourceLocationInfo: MkXmlSourceLocationInfo;\n}\nexport interface MkXmlSourceLocation {\n startLine: number;\n endLine: number;\n startCol: number;\n endCol: number;\n startOffset: number;\n endOffset: number;\n}\nexport interface MkXmlSourceLocationInfo extends MkXmlSourceLocation {\n startTag?: MkXmlSourceLocation;\n endTag?: MkXmlSourceLocation;\n attrs?: {\n [prop: string]: MkXmlSourceLocation;\n };\n}\nexport interface MkXmlElement {\n tag?: string;\n type: MkXmlElementType;\n attrs?: MkXmlElementAttr[];\n children?: MkXmlElement[];\n selfCloseing?: boolean;\n content?: string;\n sourceLocationInfo: MkXmlSourceLocationInfo;\n}\nexport interface MkXmlParseResult {\n elements?: MkXmlElement[];\n error: MkValidateMessage;\n xml: string;\n xmlRows: string[];\n}\nexport enum MkValidateMessagePosition {\n tag = \"tag\",\n attr = \"attr\",\n content = \"content\",\n}\nexport interface MkValidateMessage {\n position?: MkValidateMessagePosition;\n target?:\n | MkXmlElement\n | MkXmlElementAttr\n | MpXmlContent\n | MpXmlElement\n | MpXmlElementAttr;\n message: string;\n fragment?: string;\n}\nexport interface MkXmlTextElement extends MkXmlElement {\n type: MkXmlElementType.text;\n content: string;\n}\nexport interface MkXmlCommentElement extends MkXmlElement {\n type: MkXmlElementType.comment;\n content: string;\n}\nexport enum MkXmlElementType {\n node = \"node\",\n text = \"text\",\n comment = \"comment\",\n}\nexport interface MkXmlElementAttr {\n name: string;\n content?: string;\n sourceLocationInfo: MkXmlSourceLocation;\n}\n"],"names":["MpRequestOptionsMethod","MpPlatform","EventType","MpViewType","MpWhereType","MpXmlContentType","MkValidateMessagePosition","MkXmlElementType"],"mappings":";;;;;;;;;;AAgBA,WAAYA;AACRA,EAAAA,iCAAA,YAAA;AACAA,EAAAA,6BAAA,QAAA;AACAA,EAAAA,8BAAA,SAAA;AACAA,EAAAA,8BAAA,SAAA;AACAA,EAAAA,6BAAA,QAAA;AACAA,EAAAA,gCAAA,WAAA;AACAA,EAAAA,+BAAA,UAAA;AACAA,EAAAA,iCAAA,YAAA;AACH,CATD,EAAYA,8BAAsB,KAAtBA,8BAAsB,KAAA,CAAlC;;AChBA,WAAYC;AACRA,EAAAA,oBAAA,WAAA;AACAA,EAAAA,oBAAA,WAAA;AACAA,EAAAA,mBAAA,UAAA;AACAA,EAAAA,oBAAA,WAAA;AACAA,EAAAA,qBAAA,YAAA;AACH,CAND,EAAYA,kBAAU,KAAVA,kBAAU,KAAA,CAAtB;;ACaA,WAAYC;AACRA,EAAAA,gBAAA,QAAA;AACAA,EAAAA,kBAAA,UAAA;AACAA,EAAAA,yBAAA,iBAAA;AACAA,EAAAA,0BAAA,kBAAA;AACAA,EAAAA,4BAAA,oBAAA;AACAA,EAAAA,0BAAA,kBAAA;AACAA,EAAAA,oBAAA,YAAA;AACAA,EAAAA,2BAAA,mBAAA;AACAA,EAAAA,yBAAA,iBAAA;AACAA,EAAAA,8BAAA,sBAAA;AACAA,EAAAA,yBAAA,iBAAA;AACAA,EAAAA,uBAAA,eAAA;AACH,CAbD,EAAYA,iBAAS,KAATA,iBAAS,KAAA,CAArB;;ACgBA,WAAYC;AACRA,EAAAA,iBAAA,QAAA;AACAA,EAAAA,kBAAA,SAAA;AACAA,EAAAA,uBAAA,cAAA;AACH,CAJD,EAAYA,kBAAU,KAAVA,kBAAU,KAAA,CAAtB;;ACbA,WAAYC;AACRA,EAAAA,iBAAA,OAAA;AACAA,EAAAA,qBAAA,WAAA;AACAA,EAAAA,mBAAA,SAAA;AACH,CAJD,EAAYA,mBAAW,KAAXA,mBAAW,KAAA,CAAvB;;AAoDA,WAAYC;AACRA,EAAAA,0BAAA,WAAA;AACAA,EAAAA,2BAAA,YAAA;AACH,CAHD,EAAYA,wBAAgB,KAAhBA,wBAAgB,KAAA,CAA5B;;AAoEA,WAAYC;AACRA,EAAAA,gCAAA,QAAA;AACAA,EAAAA,iCAAA,SAAA;AACAA,EAAAA,oCAAA,YAAA;AACH,CAJD,EAAYA,iCAAyB,KAAzBA,iCAAyB,KAAA,CAArC;;AAwBA,WAAYC;AACRA,EAAAA,wBAAA,SAAA;AACAA,EAAAA,wBAAA,SAAA;AACAA,EAAAA,2BAAA,YAAA;AACH,CAJD,EAAYA,wBAAgB,KAAhBA,wBAAgB,KAAA,CAA5B"}
/*!
* MpKit v1.0.6
* MpKit v1.0.9
* (c) 2020-2020 imingyu<mingyuhisoft@163.com>

@@ -55,21 +55,34 @@ * Released under the MIT License.

var MpElementType;
var MpWhereType;
(function (MpElementType) {
MpElementType["node"] = "node";
MpElementType["text"] = "text";
MpElementType["comment"] = "comment";
})(MpElementType || (MpElementType = {}));
(function (MpWhereType) {
MpWhereType["if"] = "if";
MpWhereType["elseif"] = "elseif";
MpWhereType["else"] = "else";
})(MpWhereType || (MpWhereType = {}));
var MpElementContentType;
var MpXmlContentType;
(function (MpElementContentType) {
MpElementContentType["number"] = "number";
MpElementContentType["boolean"] = "boolean";
MpElementContentType["string"] = "string";
MpElementContentType["null"] = "null";
MpElementContentType["dynamic"] = "dynamic";
})(MpElementContentType || (MpElementContentType = {}));
(function (MpXmlContentType) {
MpXmlContentType["static"] = "static";
MpXmlContentType["dynamic"] = "dynamic";
})(MpXmlContentType || (MpXmlContentType = {}));
export { EventType, MpElementContentType, MpElementType, MpPlatform, MpRequestOptionsMethod, MpViewType };
var MkValidateMessagePosition;
(function (MkValidateMessagePosition) {
MkValidateMessagePosition["tag"] = "tag";
MkValidateMessagePosition["attr"] = "attr";
MkValidateMessagePosition["content"] = "content";
})(MkValidateMessagePosition || (MkValidateMessagePosition = {}));
var MkXmlElementType;
(function (MkXmlElementType) {
MkXmlElementType["node"] = "node";
MkXmlElementType["text"] = "text";
MkXmlElementType["comment"] = "comment";
})(MkXmlElementType || (MkXmlElementType = {}));
export { EventType, MkValidateMessagePosition, MkXmlElementType, MpPlatform, MpRequestOptionsMethod, MpViewType, MpWhereType, MpXmlContentType };
//# sourceMappingURL=index.esm.js.map

@@ -1,1 +0,1 @@

{"version":3,"file":"index.esm.js","sources":["../api.ts","../platform.ts","../ebus.ts","../view.ts","../view-parser.ts"],"sourcesContent":["export interface MpApiCallback {\n (res?: any);\n}\nexport interface MpApiMethodArg {\n success: MpApiCallback;\n fail: MpApiCallback;\n complete: MpApiCallback;\n [prop: string]: any;\n}\nexport interface MpApiMethod {\n (options?: MpApiMethodArg | any): any;\n}\n\nexport interface MpApiVar {\n [prop: string]: MpApiMethod;\n}\nexport enum MpRequestOptionsMethod {\n OPTIONS = \"OPTIONS\",\n GET = \"GET\",\n POST = \"POST\",\n HEAD = \"HEAD\",\n PUT = \"PUT\",\n DELETE = \"DELETE\",\n TRACE = \"TRACE\",\n CONNECT = \"CONNECT\",\n}\nexport interface MpRequestOptions extends MpApiMethodArg {\n url: string;\n method: MpRequestOptionsMethod;\n headers?: {\n [prop: string]: string | number;\n };\n}\nexport interface MpRequestTask {\n abort: Function;\n}\nexport interface MpApiRequestMethod {\n (options: MpRequestOptions): MpRequestTask;\n}\n","export enum MpPlatform {\n wechat = \"wechat\",\n alipay = \"alipay\",\n smart = \"smart\",\n tiktok = \"tiktok\",\n unknown = \"unknown\",\n}\n","export interface EventData {\n type: string;\n ts: number;\n data?: any;\n}\nexport interface EventHandler {\n (eventData: EventData, ...args: any[]);\n}\nexport interface EBus {\n on(type: string, handler: EventHandler);\n off(type: string, handler?: EventHandler);\n emit(type: string, data: any);\n}\nexport enum EventType {\n All = \"All\",\n Error = \"Error\",\n ViewInitLife = \"ViewInitLife\",\n ViewInitMount = \"ViewInitMount\",\n ViewMethodStart = \"ViewMethodStart\",\n ViewMethodEnd = \"ViewMethodEnd\",\n UIEvent = \"UIEvent\",\n ApiMethodStart = \"ApiMethodStart\",\n ApiMethodEnd = \"ApiMethodEnd\",\n ApiMethodComplete = \"ApiMethodComplete\",\n RequestStart = \"RequestStart\",\n RequestEnd = \"RequestEnd\",\n}\n","import { MkEnumMap } from \"./util\";\nimport { MkSetData } from \"./set-data\";\nexport interface MpAppLaunchOptions {}\nexport interface MpViewInitLife<V, T> {\n (this: V, options: T): void;\n}\nexport interface MpViewLife<V> {\n (this: V): void;\n}\nexport type MpViewInitLifes = \"onLaunch\" | \"onLoad\" | \"created\" | \"onInit\";\nexport type MpViewMountLifes = \"onShow\" | \"attached\" | \"didMount\";\n// 小程序App实例\nexport interface MpViewApp extends MpViewAppSpec, MpView {}\n// 小程序App函数接收的配置对象\nexport interface MpViewAppSpec {\n onLaunch: MpViewInitLife<MpViewApp, MpAppLaunchOptions>;\n onShow: MpViewInitLife<MpViewApp, MpAppLaunchOptions>;\n onHide: MpViewLife<MpViewApp>;\n onError: MpViewLife<MpViewApp>;\n [prop: string]: any;\n}\nexport interface MpAlipayViewApp extends MpViewApp, MpAlipayViewAppSpec {}\nexport interface MpAlipayViewAppSpec extends MpViewAppSpec {\n onShareAppMessage: MpViewLife<MpAlipayViewApp>;\n}\n\nexport interface MpViewFactory {\n (spec: MpViewAppSpec | MpViewPageSpec | MpViewComponentSpec | any): void;\n}\nexport enum MpViewType {\n App = \"App\",\n Page = \"Page\",\n Component = \"Component\",\n}\nexport interface MpViewSpec {\n data: any;\n}\nexport interface MpViewComponetPropSpec {\n type: Function;\n default?: any;\n observer?: Function;\n}\nexport interface MpViewPageSpec extends MpViewSpec {\n [prop: string]: any;\n}\nexport type MpViewComponentLifes =\n | \"created\"\n | \"attached\"\n | \"ready\"\n | \"moved\"\n | \"detached\"\n | \"error\";\nexport type MpViewComponentPageLifes = \"show\" | \"hide\" | \"resize\";\nexport interface MpViewComponentSpec extends MpViewSpec {\n properties?: {\n [prop: string]: Function | MpViewComponetPropSpec;\n };\n lifetimes?: MkEnumMap<MpViewComponentLifes, Function | string>;\n pageLifetimes?: MkEnumMap<MpViewComponentPageLifes, Function | string>;\n methods: {\n [prop: string]: Function;\n };\n [prop: string]: any;\n}\nexport interface MpView {\n $mkSpec: MpViewSpec;\n $mkType: MpViewType;\n $mkKey: string;\n $mkKeyIsDefine?: boolean | string;\n $mkNativeSetData: MpSetDataHandler;\n $mkSetData: MkSetData;\n $mkSetDataIsBind?: boolean;\n $mkReadyData: any;\n data: any;\n setData: MpSetDataHandler;\n}\nexport interface MpWechatSelectOwnerComponent {\n (): void | MpView;\n}\nexport interface MpWechatView extends MpView {\n __wxExparserNodeId__: string;\n __wxWebviewId__: number;\n is: string;\n selectOwnerComponent: MpWechatSelectOwnerComponent;\n}\nexport interface MpWechatPageView extends MpWechatView {\n route: string;\n}\nexport interface MpTiktokView extends MpView {\n __webviewId__: number;\n __nodeId__: number;\n is: string;\n}\nexport interface MpComponentPropObserver {\n (this: MpView, oldValue: any, newVal: any): void;\n}\n\nexport interface MpComponentPropSpec {\n type: Function;\n default: any;\n observer: MpComponentPropObserver;\n}\n\nexport interface MpAlipayView extends MpView {\n $id: number;\n}\n\nexport interface MpAlipayViewPage extends MpAlipayView {\n $viewId: string;\n route: string;\n}\nexport interface MpAlipayViewComponent extends MpAlipayView {\n $page: MpAlipayViewPage;\n is: string;\n props: {\n [prop: string]: any;\n __tag: string;\n };\n}\nexport interface MpSmartViewPage extends MpView {\n route: string;\n}\nexport interface MpSmartViewComponent extends MpView {\n componentName: string;\n nodeId: string;\n pageinstance: MpSmartViewPage;\n is: string;\n}\nexport interface MpSetDataHandler {\n (data: any, callback?: Function): void;\n}\n","export interface MpViewParserOptions {}\nexport interface MpElement {\n tag?: string;\n type: MpElementType;\n attrs?: MpElementAttr[];\n children?: MpElementContent[] | MpElement[];\n selfCloseing?: boolean;\n}\nexport enum MpElementType {\n node = \"node\",\n text = \"text\",\n comment = \"comment\",\n}\nexport interface MpElementAttr {\n name: string;\n value?: MpElementContent;\n}\n\nexport enum MpElementContentType {\n number = \"number\",\n boolean = \"boolean\",\n string = \"string\",\n null = \"null\",\n dynamic = \"dynamic\",\n}\nexport interface MpElementContent {\n type: MpElementContentType;\n value: string | number | boolean | null | MpDynamicValue;\n}\nexport interface MpDynamicValue {\n source: string;\n ast: any;\n}\n"],"names":["MpRequestOptionsMethod","MpPlatform","EventType","MpViewType","MpElementType","MpElementContentType"],"mappings":";;;;;;IAgBYA;;AAAZ,WAAYA;AACRA,EAAAA,iCAAA,YAAA;AACAA,EAAAA,6BAAA,QAAA;AACAA,EAAAA,8BAAA,SAAA;AACAA,EAAAA,8BAAA,SAAA;AACAA,EAAAA,6BAAA,QAAA;AACAA,EAAAA,gCAAA,WAAA;AACAA,EAAAA,+BAAA,UAAA;AACAA,EAAAA,iCAAA,YAAA;AACH,CATD,EAAYA,sBAAsB,KAAtBA,sBAAsB,KAAA,CAAlC;;IChBYC;;AAAZ,WAAYA;AACRA,EAAAA,oBAAA,WAAA;AACAA,EAAAA,oBAAA,WAAA;AACAA,EAAAA,mBAAA,UAAA;AACAA,EAAAA,oBAAA,WAAA;AACAA,EAAAA,qBAAA,YAAA;AACH,CAND,EAAYA,UAAU,KAAVA,UAAU,KAAA,CAAtB;;ICaYC;;AAAZ,WAAYA;AACRA,EAAAA,gBAAA,QAAA;AACAA,EAAAA,kBAAA,UAAA;AACAA,EAAAA,yBAAA,iBAAA;AACAA,EAAAA,0BAAA,kBAAA;AACAA,EAAAA,4BAAA,oBAAA;AACAA,EAAAA,0BAAA,kBAAA;AACAA,EAAAA,oBAAA,YAAA;AACAA,EAAAA,2BAAA,mBAAA;AACAA,EAAAA,yBAAA,iBAAA;AACAA,EAAAA,8BAAA,sBAAA;AACAA,EAAAA,yBAAA,iBAAA;AACAA,EAAAA,uBAAA,eAAA;AACH,CAbD,EAAYA,SAAS,KAATA,SAAS,KAAA,CAArB;;ICgBYC;;AAAZ,WAAYA;AACRA,EAAAA,iBAAA,QAAA;AACAA,EAAAA,kBAAA,SAAA;AACAA,EAAAA,uBAAA,cAAA;AACH,CAJD,EAAYA,UAAU,KAAVA,UAAU,KAAA,CAAtB;;ICrBYC;;AAAZ,WAAYA;AACRA,EAAAA,qBAAA,SAAA;AACAA,EAAAA,qBAAA,SAAA;AACAA,EAAAA,wBAAA,YAAA;AACH,CAJD,EAAYA,aAAa,KAAbA,aAAa,KAAA,CAAzB;;IAUYC;;AAAZ,WAAYA;AACRA,EAAAA,8BAAA,WAAA;AACAA,EAAAA,+BAAA,YAAA;AACAA,EAAAA,8BAAA,WAAA;AACAA,EAAAA,4BAAA,SAAA;AACAA,EAAAA,+BAAA,YAAA;AACH,CAND,EAAYA,oBAAoB,KAApBA,oBAAoB,KAAA,CAAhC;;;;"}
{"version":3,"file":"index.esm.js","sources":["../api.ts","../platform.ts","../ebus.ts","../view.ts","../view-parser.ts"],"sourcesContent":["export interface MpApiCallback {\n (res?: any);\n}\nexport interface MpApiMethodArg {\n success: MpApiCallback;\n fail: MpApiCallback;\n complete: MpApiCallback;\n [prop: string]: any;\n}\nexport interface MpApiMethod {\n (options?: MpApiMethodArg | any): any;\n}\n\nexport interface MpApiVar {\n [prop: string]: MpApiMethod;\n}\nexport enum MpRequestOptionsMethod {\n OPTIONS = \"OPTIONS\",\n GET = \"GET\",\n POST = \"POST\",\n HEAD = \"HEAD\",\n PUT = \"PUT\",\n DELETE = \"DELETE\",\n TRACE = \"TRACE\",\n CONNECT = \"CONNECT\",\n}\nexport interface MpRequestOptions extends MpApiMethodArg {\n url: string;\n method: MpRequestOptionsMethod;\n headers?: {\n [prop: string]: string | number;\n };\n}\nexport interface MpRequestTask {\n abort: Function;\n}\nexport interface MpApiRequestMethod {\n (options: MpRequestOptions): MpRequestTask;\n}\n","export enum MpPlatform {\n wechat = \"wechat\",\n alipay = \"alipay\",\n smart = \"smart\",\n tiktok = \"tiktok\",\n unknown = \"unknown\",\n}\n","export interface EventData {\n type: string;\n ts: number;\n data?: any;\n}\nexport interface EventHandler {\n (eventData: EventData, ...args: any[]);\n}\nexport interface EBus {\n on(type: string, handler: EventHandler);\n off(type: string, handler?: EventHandler);\n emit(type: string, data: any);\n}\nexport enum EventType {\n All = \"All\",\n Error = \"Error\",\n ViewInitLife = \"ViewInitLife\",\n ViewInitMount = \"ViewInitMount\",\n ViewMethodStart = \"ViewMethodStart\",\n ViewMethodEnd = \"ViewMethodEnd\",\n UIEvent = \"UIEvent\",\n ApiMethodStart = \"ApiMethodStart\",\n ApiMethodEnd = \"ApiMethodEnd\",\n ApiMethodComplete = \"ApiMethodComplete\",\n RequestStart = \"RequestStart\",\n RequestEnd = \"RequestEnd\",\n}\n","import { MkEnumMap } from \"./util\";\nimport { MkSetData } from \"./set-data\";\nexport interface MpAppLaunchOptions {}\nexport interface MpViewInitLife<V, T> {\n (this: V, options: T): void;\n}\nexport interface MpViewLife<V> {\n (this: V): void;\n}\nexport type MpViewInitLifes = \"onLaunch\" | \"onLoad\" | \"created\" | \"onInit\";\nexport type MpViewMountLifes = \"onShow\" | \"attached\" | \"didMount\";\n// 小程序App实例\nexport interface MpViewApp extends MpViewAppSpec, MpView {}\n// 小程序App函数接收的配置对象\nexport interface MpViewAppSpec {\n onLaunch: MpViewInitLife<MpViewApp, MpAppLaunchOptions>;\n onShow: MpViewInitLife<MpViewApp, MpAppLaunchOptions>;\n onHide: MpViewLife<MpViewApp>;\n onError: MpViewLife<MpViewApp>;\n [prop: string]: any;\n}\nexport interface MpAlipayViewApp extends MpViewApp, MpAlipayViewAppSpec {}\nexport interface MpAlipayViewAppSpec extends MpViewAppSpec {\n onShareAppMessage: MpViewLife<MpAlipayViewApp>;\n}\n\nexport interface MpViewFactory {\n (spec: MpViewAppSpec | MpViewPageSpec | MpViewComponentSpec | any): void;\n}\nexport enum MpViewType {\n App = \"App\",\n Page = \"Page\",\n Component = \"Component\",\n}\nexport interface MpViewSpec {\n data: any;\n}\nexport interface MpViewComponetPropSpec {\n type: Function;\n default?: any;\n observer?: Function;\n}\nexport interface MpViewPageSpec extends MpViewSpec {\n [prop: string]: any;\n}\nexport type MpViewComponentLifes =\n | \"created\"\n | \"attached\"\n | \"ready\"\n | \"moved\"\n | \"detached\"\n | \"error\";\nexport type MpViewComponentPageLifes = \"show\" | \"hide\" | \"resize\";\nexport interface MpViewComponentSpec extends MpViewSpec {\n properties?: {\n [prop: string]: Function | MpViewComponetPropSpec;\n };\n lifetimes?: MkEnumMap<MpViewComponentLifes, Function | string>;\n pageLifetimes?: MkEnumMap<MpViewComponentPageLifes, Function | string>;\n methods: {\n [prop: string]: Function;\n };\n [prop: string]: any;\n}\nexport interface MpView {\n $mkSpec: MpViewSpec;\n $mkType: MpViewType;\n $mkKey: string;\n $mkKeyIsDefine?: boolean | string;\n $mkNativeSetData: MpSetDataHandler;\n $mkSetData: MkSetData;\n $mkSetDataIsBind?: boolean;\n $mkReadyData: any;\n data: any;\n setData: MpSetDataHandler;\n}\nexport interface MpWechatSelectOwnerComponent {\n (): void | MpView;\n}\nexport interface MpWechatView extends MpView {\n __wxExparserNodeId__: string;\n __wxWebviewId__: number;\n is: string;\n selectOwnerComponent: MpWechatSelectOwnerComponent;\n}\nexport interface MpWechatPageView extends MpWechatView {\n route: string;\n}\nexport interface MpTiktokView extends MpView {\n __webviewId__: number;\n __nodeId__: number;\n is: string;\n}\nexport interface MpComponentPropObserver {\n (this: MpView, oldValue: any, newVal: any): void;\n}\n\nexport interface MpComponentPropSpec {\n type: Function;\n default: any;\n observer: MpComponentPropObserver;\n}\n\nexport interface MpAlipayView extends MpView {\n $id: number;\n}\n\nexport interface MpAlipayViewPage extends MpAlipayView {\n $viewId: string;\n route: string;\n}\nexport interface MpAlipayViewComponent extends MpAlipayView {\n $page: MpAlipayViewPage;\n is: string;\n props: {\n [prop: string]: any;\n __tag: string;\n };\n}\nexport interface MpSmartViewPage extends MpView {\n route: string;\n}\nexport interface MpSmartViewComponent extends MpView {\n componentName: string;\n nodeId: string;\n pageinstance: MpSmartViewPage;\n is: string;\n}\nexport interface MpSetDataHandler {\n (data: any, callback?: Function): void;\n}\n","import { MkOmit, MkMap, MkEnumMap } from \"./util\";\nimport { MpPlatform } from \".\";\nexport interface MpSpec {\n [prop: string]: MkEnumMap<MpPlatform, MpViewSyntaxSpec>;\n}\nexport interface MpViewSyntaxSpec {\n namespace: string;\n for: string;\n forItem: string;\n forIndex: string;\n key: string;\n if: string;\n elseif: string;\n else: string;\n forAndWhereAttrNeedBracket: boolean;\n}\nexport enum MpWhereType {\n if = \"if\",\n elseif = \"elseif\",\n else = \"else\",\n}\nexport interface MpXmlContent {\n type: MpXmlContentType;\n value: string;\n}\nexport interface MpForAttrContent extends MpXmlContent {\n type: MpXmlContentType;\n value: string;\n featureList?: string;\n featureItem?: string;\n featureIndex?: string;\n featureKey?: string;\n}\nexport interface ParseElementAdapterArg {\n currentElement: MkXmlElement;\n currentElementIndex: number;\n brotherElements: MkXmlElement[];\n allElements: MkXmlElement[];\n orgXml: string;\n}\nexport interface IParseElementAdapter {\n attrAdapters: MkMap<IParseAttrAdapter>;\n contentAdapter: IParseContentAdapter;\n parse(data: ParseElementAdapterArg): MpXmlElement;\n}\nexport interface ParseAttrAdapterArg {\n currentElement: MkXmlElement;\n currentElementIndex: number;\n brotherElements: MkXmlElement[];\n allElements: MkXmlElement[];\n orgXml: string;\n currentAttr: MkXmlElementAttr;\n allAttrs: MkXmlElementAttr[];\n prevParseAttr?: MpXmlElementAttr;\n}\nexport interface IParseAttrAdapter {\n parse(data: ParseAttrAdapterArg): MpXmlElementAttr;\n}\nexport interface IMpParseAttrAdapter\n extends IMpParseAdapter,\n IParseAttrAdapter {}\nexport interface IMpParseAdapter {\n mpPlatform: MpPlatform;\n}\nexport interface IParseContentAdapter {\n parse(content: string): MpXmlContent[];\n}\n\nexport enum MpXmlContentType {\n static = \"static\",\n dynamic = \"dynamic\",\n}\nexport interface MpXmlParseResult extends MkOmit<MkXmlParseResult, \"elements\"> {\n elements?: MpXmlElement[];\n}\nexport interface MpXmlParseResultJSON\n extends MkOmit<MkXmlParseResult, \"elements\" | \"xml\" | \"xmlRows\"> {\n xml?: string;\n xmlRows?: string;\n elements?: MpXmlElementJSON[];\n}\nexport interface MpXmlElementJSON\n extends MkOmit<\n MkXmlElement,\n \"attrs\" | \"children\" | \"content\" | \"sourceLocationInfo\"\n > {\n attrs?: MpXmlElementAttrJSON[];\n children?: MpXmlElementJSON[];\n content?: MpXmlContent[];\n sourceLocationInfo?: MkXmlSourceLocationInfo;\n}\nexport interface MpXmlElementAttrJSON\n extends MkOmit<MkXmlElementAttr, \"content\" | \"sourceLocationInfo\"> {\n content?: MpXmlContent[];\n sourceLocationInfo?: MkXmlSourceLocationInfo;\n}\nexport interface MpXmlElementAttr extends MpXmlElementAttrJSON {\n sourceLocationInfo: MkXmlSourceLocationInfo;\n}\nexport interface MpXmlElement\n extends MkOmit<MpXmlElementJSON, \"attrs\" | \"children\"> {\n parent?: MpXmlElement;\n attrs?: MpXmlElementAttr[];\n children?: MpXmlElement[];\n sourceLocationInfo: MkXmlSourceLocationInfo;\n}\nexport interface MkXmlSourceLocation {\n startLine: number;\n endLine: number;\n startCol: number;\n endCol: number;\n startOffset: number;\n endOffset: number;\n}\nexport interface MkXmlSourceLocationInfo extends MkXmlSourceLocation {\n startTag?: MkXmlSourceLocation;\n endTag?: MkXmlSourceLocation;\n attrs?: {\n [prop: string]: MkXmlSourceLocation;\n };\n}\nexport interface MkXmlElement {\n tag?: string;\n type: MkXmlElementType;\n attrs?: MkXmlElementAttr[];\n children?: MkXmlElement[];\n selfCloseing?: boolean;\n content?: string;\n sourceLocationInfo: MkXmlSourceLocationInfo;\n}\nexport interface MkXmlParseResult {\n elements?: MkXmlElement[];\n error: MkValidateMessage;\n xml: string;\n xmlRows: string[];\n}\nexport enum MkValidateMessagePosition {\n tag = \"tag\",\n attr = \"attr\",\n content = \"content\",\n}\nexport interface MkValidateMessage {\n position?: MkValidateMessagePosition;\n target?:\n | MkXmlElement\n | MkXmlElementAttr\n | MpXmlContent\n | MpXmlElement\n | MpXmlElementAttr;\n message: string;\n fragment?: string;\n}\nexport interface MkXmlTextElement extends MkXmlElement {\n type: MkXmlElementType.text;\n content: string;\n}\nexport interface MkXmlCommentElement extends MkXmlElement {\n type: MkXmlElementType.comment;\n content: string;\n}\nexport enum MkXmlElementType {\n node = \"node\",\n text = \"text\",\n comment = \"comment\",\n}\nexport interface MkXmlElementAttr {\n name: string;\n content?: string;\n sourceLocationInfo: MkXmlSourceLocation;\n}\n"],"names":["MpRequestOptionsMethod","MpPlatform","EventType","MpViewType","MpWhereType","MpXmlContentType","MkValidateMessagePosition","MkXmlElementType"],"mappings":";;;;;;IAgBYA;;AAAZ,WAAYA;AACRA,EAAAA,iCAAA,YAAA;AACAA,EAAAA,6BAAA,QAAA;AACAA,EAAAA,8BAAA,SAAA;AACAA,EAAAA,8BAAA,SAAA;AACAA,EAAAA,6BAAA,QAAA;AACAA,EAAAA,gCAAA,WAAA;AACAA,EAAAA,+BAAA,UAAA;AACAA,EAAAA,iCAAA,YAAA;AACH,CATD,EAAYA,sBAAsB,KAAtBA,sBAAsB,KAAA,CAAlC;;IChBYC;;AAAZ,WAAYA;AACRA,EAAAA,oBAAA,WAAA;AACAA,EAAAA,oBAAA,WAAA;AACAA,EAAAA,mBAAA,UAAA;AACAA,EAAAA,oBAAA,WAAA;AACAA,EAAAA,qBAAA,YAAA;AACH,CAND,EAAYA,UAAU,KAAVA,UAAU,KAAA,CAAtB;;ICaYC;;AAAZ,WAAYA;AACRA,EAAAA,gBAAA,QAAA;AACAA,EAAAA,kBAAA,UAAA;AACAA,EAAAA,yBAAA,iBAAA;AACAA,EAAAA,0BAAA,kBAAA;AACAA,EAAAA,4BAAA,oBAAA;AACAA,EAAAA,0BAAA,kBAAA;AACAA,EAAAA,oBAAA,YAAA;AACAA,EAAAA,2BAAA,mBAAA;AACAA,EAAAA,yBAAA,iBAAA;AACAA,EAAAA,8BAAA,sBAAA;AACAA,EAAAA,yBAAA,iBAAA;AACAA,EAAAA,uBAAA,eAAA;AACH,CAbD,EAAYA,SAAS,KAATA,SAAS,KAAA,CAArB;;ICgBYC;;AAAZ,WAAYA;AACRA,EAAAA,iBAAA,QAAA;AACAA,EAAAA,kBAAA,SAAA;AACAA,EAAAA,uBAAA,cAAA;AACH,CAJD,EAAYA,UAAU,KAAVA,UAAU,KAAA,CAAtB;;ICbYC;;AAAZ,WAAYA;AACRA,EAAAA,iBAAA,OAAA;AACAA,EAAAA,qBAAA,WAAA;AACAA,EAAAA,mBAAA,SAAA;AACH,CAJD,EAAYA,WAAW,KAAXA,WAAW,KAAA,CAAvB;;IAoDYC;;AAAZ,WAAYA;AACRA,EAAAA,0BAAA,WAAA;AACAA,EAAAA,2BAAA,YAAA;AACH,CAHD,EAAYA,gBAAgB,KAAhBA,gBAAgB,KAAA,CAA5B;;IAoEYC;;AAAZ,WAAYA;AACRA,EAAAA,gCAAA,QAAA;AACAA,EAAAA,iCAAA,SAAA;AACAA,EAAAA,oCAAA,YAAA;AACH,CAJD,EAAYA,yBAAyB,KAAzBA,yBAAyB,KAAA,CAArC;;IAwBYC;;AAAZ,WAAYA;AACRA,EAAAA,wBAAA,SAAA;AACAA,EAAAA,wBAAA,SAAA;AACAA,EAAAA,2BAAA,YAAA;AACH,CAJD,EAAYA,gBAAgB,KAAhBA,gBAAgB,KAAA,CAA5B;;;;"}
{
"name": "@mpkit/types",
"version": "1.0.6",
"version": "1.0.10",
"description": "mpkit包相关typescript类型",

@@ -10,3 +10,3 @@ "author": "imingyu <mingyuhisoft@163.com>",

"module": "dist/index.esm.js",
"types": "spec/index.d.ts",
"types": "index.ts",
"repository": {

@@ -32,3 +32,3 @@ "type": "git",

},
"gitHead": "366dd076cb9c060c8c7b9d79169de0c6ac013ed8"
"gitHead": "75727e8c4e33f0e521e7148e69b42e0e6daae42f"
}

@@ -7,2 +7,7 @@ export declare type MkMap<T> = {

};
export declare type MkPick<T, K extends keyof T> = {
[P in K]: T[P];
};
export declare type MkExclude<T, U> = T extends U ? never : T;
export declare type MkOmit<T, K extends keyof any> = MkPick<T, MkExclude<keyof T, K>>;
export declare type MkMaybe<T> = T | undefined;

@@ -1,11 +0,148 @@

export interface MpViewParserOptions {
import { MkOmit, MkMap, MkEnumMap } from "./util";
import { MpPlatform } from ".";
export interface MpSpec {
[prop: string]: MkEnumMap<MpPlatform, MpViewSyntaxSpec>;
}
export interface MpElement {
export interface MpViewSyntaxSpec {
namespace: string;
for: string;
forItem: string;
forIndex: string;
key: string;
if: string;
elseif: string;
else: string;
forAndWhereAttrNeedBracket: boolean;
}
export declare enum MpWhereType {
if = "if",
elseif = "elseif",
else = "else"
}
export interface MpXmlContent {
type: MpXmlContentType;
value: string;
}
export interface MpForAttrContent extends MpXmlContent {
type: MpXmlContentType;
value: string;
featureList?: string;
featureItem?: string;
featureIndex?: string;
featureKey?: string;
}
export interface ParseElementAdapterArg {
currentElement: MkXmlElement;
currentElementIndex: number;
brotherElements: MkXmlElement[];
allElements: MkXmlElement[];
orgXml: string;
}
export interface IParseElementAdapter {
attrAdapters: MkMap<IParseAttrAdapter>;
contentAdapter: IParseContentAdapter;
parse(data: ParseElementAdapterArg): MpXmlElement;
}
export interface ParseAttrAdapterArg {
currentElement: MkXmlElement;
currentElementIndex: number;
brotherElements: MkXmlElement[];
allElements: MkXmlElement[];
orgXml: string;
currentAttr: MkXmlElementAttr;
allAttrs: MkXmlElementAttr[];
prevParseAttr?: MpXmlElementAttr;
}
export interface IParseAttrAdapter {
parse(data: ParseAttrAdapterArg): MpXmlElementAttr;
}
export interface IMpParseAttrAdapter extends IMpParseAdapter, IParseAttrAdapter {
}
export interface IMpParseAdapter {
mpPlatform: MpPlatform;
}
export interface IParseContentAdapter {
parse(content: string): MpXmlContent[];
}
export declare enum MpXmlContentType {
static = "static",
dynamic = "dynamic"
}
export interface MpXmlParseResult extends MkOmit<MkXmlParseResult, "elements"> {
elements?: MpXmlElement[];
}
export interface MpXmlParseResultJSON extends MkOmit<MkXmlParseResult, "elements" | "xml" | "xmlRows"> {
xml?: string;
xmlRows?: string;
elements?: MpXmlElementJSON[];
}
export interface MpXmlElementJSON extends MkOmit<MkXmlElement, "attrs" | "children" | "content" | "sourceLocationInfo"> {
attrs?: MpXmlElementAttrJSON[];
children?: MpXmlElementJSON[];
content?: MpXmlContent[];
sourceLocationInfo?: MkXmlSourceLocationInfo;
}
export interface MpXmlElementAttrJSON extends MkOmit<MkXmlElementAttr, "content" | "sourceLocationInfo"> {
content?: MpXmlContent[];
sourceLocationInfo?: MkXmlSourceLocationInfo;
}
export interface MpXmlElementAttr extends MpXmlElementAttrJSON {
sourceLocationInfo: MkXmlSourceLocationInfo;
}
export interface MpXmlElement extends MkOmit<MpXmlElementJSON, "attrs" | "children"> {
parent?: MpXmlElement;
attrs?: MpXmlElementAttr[];
children?: MpXmlElement[];
sourceLocationInfo: MkXmlSourceLocationInfo;
}
export interface MkXmlSourceLocation {
startLine: number;
endLine: number;
startCol: number;
endCol: number;
startOffset: number;
endOffset: number;
}
export interface MkXmlSourceLocationInfo extends MkXmlSourceLocation {
startTag?: MkXmlSourceLocation;
endTag?: MkXmlSourceLocation;
attrs?: {
[prop: string]: MkXmlSourceLocation;
};
}
export interface MkXmlElement {
tag?: string;
type: MpElementType;
attrs?: MpElementAttr[];
children?: MpElementContent[] | MpElement[];
type: MkXmlElementType;
attrs?: MkXmlElementAttr[];
children?: MkXmlElement[];
selfCloseing?: boolean;
content?: string;
sourceLocationInfo: MkXmlSourceLocationInfo;
}
export declare enum MpElementType {
export interface MkXmlParseResult {
elements?: MkXmlElement[];
error: MkValidateMessage;
xml: string;
xmlRows: string[];
}
export declare enum MkValidateMessagePosition {
tag = "tag",
attr = "attr",
content = "content"
}
export interface MkValidateMessage {
position?: MkValidateMessagePosition;
target?: MkXmlElement | MkXmlElementAttr | MpXmlContent | MpXmlElement | MpXmlElementAttr;
message: string;
fragment?: string;
}
export interface MkXmlTextElement extends MkXmlElement {
type: MkXmlElementType.text;
content: string;
}
export interface MkXmlCommentElement extends MkXmlElement {
type: MkXmlElementType.comment;
content: string;
}
export declare enum MkXmlElementType {
node = "node",

@@ -15,20 +152,6 @@ text = "text",

}
export interface MpElementAttr {
export interface MkXmlElementAttr {
name: string;
value?: MpElementContent;
content?: string;
sourceLocationInfo: MkXmlSourceLocation;
}
export declare enum MpElementContentType {
number = "number",
boolean = "boolean",
string = "string",
null = "null",
dynamic = "dynamic"
}
export interface MpElementContent {
type: MpElementContentType;
value: string | number | boolean | null | MpDynamicValue;
}
export interface MpDynamicValue {
source: string;
ast: any;
}

@@ -7,3 +7,7 @@ export type MkMap<T> = {

};
export type MkPick<T, K extends keyof T> = {
[P in K]: T[P];
};
export type MkExclude<T, U> = T extends U ? never : T;
export type MkOmit<T, K extends keyof any> = MkPick<T, MkExclude<keyof T, K>>;
export type MkMaybe<T> = T | undefined;

@@ -1,10 +0,162 @@

export interface MpViewParserOptions {}
export interface MpElement {
import { MkOmit, MkMap, MkEnumMap } from "./util";
import { MpPlatform } from ".";
export interface MpSpec {
[prop: string]: MkEnumMap<MpPlatform, MpViewSyntaxSpec>;
}
export interface MpViewSyntaxSpec {
namespace: string;
for: string;
forItem: string;
forIndex: string;
key: string;
if: string;
elseif: string;
else: string;
forAndWhereAttrNeedBracket: boolean;
}
export enum MpWhereType {
if = "if",
elseif = "elseif",
else = "else",
}
export interface MpXmlContent {
type: MpXmlContentType;
value: string;
}
export interface MpForAttrContent extends MpXmlContent {
type: MpXmlContentType;
value: string;
featureList?: string;
featureItem?: string;
featureIndex?: string;
featureKey?: string;
}
export interface ParseElementAdapterArg {
currentElement: MkXmlElement;
currentElementIndex: number;
brotherElements: MkXmlElement[];
allElements: MkXmlElement[];
orgXml: string;
}
export interface IParseElementAdapter {
attrAdapters: MkMap<IParseAttrAdapter>;
contentAdapter: IParseContentAdapter;
parse(data: ParseElementAdapterArg): MpXmlElement;
}
export interface ParseAttrAdapterArg {
currentElement: MkXmlElement;
currentElementIndex: number;
brotherElements: MkXmlElement[];
allElements: MkXmlElement[];
orgXml: string;
currentAttr: MkXmlElementAttr;
allAttrs: MkXmlElementAttr[];
prevParseAttr?: MpXmlElementAttr;
}
export interface IParseAttrAdapter {
parse(data: ParseAttrAdapterArg): MpXmlElementAttr;
}
export interface IMpParseAttrAdapter
extends IMpParseAdapter,
IParseAttrAdapter {}
export interface IMpParseAdapter {
mpPlatform: MpPlatform;
}
export interface IParseContentAdapter {
parse(content: string): MpXmlContent[];
}
export enum MpXmlContentType {
static = "static",
dynamic = "dynamic",
}
export interface MpXmlParseResult extends MkOmit<MkXmlParseResult, "elements"> {
elements?: MpXmlElement[];
}
export interface MpXmlParseResultJSON
extends MkOmit<MkXmlParseResult, "elements" | "xml" | "xmlRows"> {
xml?: string;
xmlRows?: string;
elements?: MpXmlElementJSON[];
}
export interface MpXmlElementJSON
extends MkOmit<
MkXmlElement,
"attrs" | "children" | "content" | "sourceLocationInfo"
> {
attrs?: MpXmlElementAttrJSON[];
children?: MpXmlElementJSON[];
content?: MpXmlContent[];
sourceLocationInfo?: MkXmlSourceLocationInfo;
}
export interface MpXmlElementAttrJSON
extends MkOmit<MkXmlElementAttr, "content" | "sourceLocationInfo"> {
content?: MpXmlContent[];
sourceLocationInfo?: MkXmlSourceLocationInfo;
}
export interface MpXmlElementAttr extends MpXmlElementAttrJSON {
sourceLocationInfo: MkXmlSourceLocationInfo;
}
export interface MpXmlElement
extends MkOmit<MpXmlElementJSON, "attrs" | "children"> {
parent?: MpXmlElement;
attrs?: MpXmlElementAttr[];
children?: MpXmlElement[];
sourceLocationInfo: MkXmlSourceLocationInfo;
}
export interface MkXmlSourceLocation {
startLine: number;
endLine: number;
startCol: number;
endCol: number;
startOffset: number;
endOffset: number;
}
export interface MkXmlSourceLocationInfo extends MkXmlSourceLocation {
startTag?: MkXmlSourceLocation;
endTag?: MkXmlSourceLocation;
attrs?: {
[prop: string]: MkXmlSourceLocation;
};
}
export interface MkXmlElement {
tag?: string;
type: MpElementType;
attrs?: MpElementAttr[];
children?: MpElementContent[] | MpElement[];
type: MkXmlElementType;
attrs?: MkXmlElementAttr[];
children?: MkXmlElement[];
selfCloseing?: boolean;
content?: string;
sourceLocationInfo: MkXmlSourceLocationInfo;
}
export enum MpElementType {
export interface MkXmlParseResult {
elements?: MkXmlElement[];
error: MkValidateMessage;
xml: string;
xmlRows: string[];
}
export enum MkValidateMessagePosition {
tag = "tag",
attr = "attr",
content = "content",
}
export interface MkValidateMessage {
position?: MkValidateMessagePosition;
target?:
| MkXmlElement
| MkXmlElementAttr
| MpXmlContent
| MpXmlElement
| MpXmlElementAttr;
message: string;
fragment?: string;
}
export interface MkXmlTextElement extends MkXmlElement {
type: MkXmlElementType.text;
content: string;
}
export interface MkXmlCommentElement extends MkXmlElement {
type: MkXmlElementType.comment;
content: string;
}
export enum MkXmlElementType {
node = "node",

@@ -14,21 +166,6 @@ text = "text",

}
export interface MpElementAttr {
export interface MkXmlElementAttr {
name: string;
value?: MpElementContent;
content?: string;
sourceLocationInfo: MkXmlSourceLocation;
}
export enum MpElementContentType {
number = "number",
boolean = "boolean",
string = "string",
null = "null",
dynamic = "dynamic",
}
export interface MpElementContent {
type: MpElementContentType;
value: string | number | boolean | null | MpDynamicValue;
}
export interface MpDynamicValue {
source: string;
ast: any;
}