@fluxion-ui/compiler-dom 0.0.3
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/LICENSE +21 -0
- package/dist/compiler-dom.cjs +2 -0
- package/dist/compiler-dom.cjs.map +1 -0
- package/dist/compiler-dom.d.ts +196 -0
- package/dist/compiler-dom.d.ts.map +1 -0
- package/dist/compiler-dom.js +2 -0
- package/dist/compiler-dom.js.map +1 -0
- package/package.json +34 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026-present, Fluxion Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var e=require("@fluxion-ui/compiler-core"),t=require("@fluxion-ui/shared");const r=new Set(["html","body","base","head","link","meta","style","title","address","article","aside","footer","header","h1","h2","h3","h4","h5","h6","hgroup","nav","section","div","dd","dl","dt","figcaption","figure","hr","img","li","main","ol","p","pre","ul","a","b","abbr","bdi","bdo","br","cite","code","data","dfn","em","i","kbd","mark","q","rp","rt","ruby","s","samp","small","span","strong","sub","sup","time","u","var","wbr","area","audio","map","track","video","embed","object","param","source","canvas","script","noscript","del","ins","caption","col","colgroup","table","thead","tbody","tfoot","td","th","tr","button","datalist","fieldset","form","input","label","legend","meter","optgroup","option","output","progress","select","textarea","details","dialog","menu","summary","template","blockquote","iframe","tfoot"]),n=new Set(["svg","animate","animateMotion","animateTransform","circle","clipPath","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","foreignObject","g","image","line","linearGradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialGradient","rect","set","stop","switch","symbol","text","textPath","tspan","use","view"]),o=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function i(e){return r.has(e)}function s(e){return n.has(e)}function a(e){return i(e)||s(e)}function u(e){return!a(e)&&(/^[A-Z]/.test(e)||e.includes("-"))}var c=(e=>(e.CREATE_ELEMENT_VNODE="h",e.CREATE_TEXT_VNODE="createTextVNode",e.NORMALIZE_CLASS="normalizeClass",e.NORMALIZE_STYLE="normalizeStyle",e.NORMALIZE_PROPS="normalizeProps",e.WITH_MODIFIERS="withModifiers",e.WITH_KEYS="withKeys",e))(c||{});const p={CREATE_ELEMENT_VNODE:Symbol("h"),CREATE_TEXT_VNODE:Symbol("createTextVNode"),NORMALIZE_CLASS:Symbol("normalizeClass"),NORMALIZE_STYLE:Symbol("normalizeStyle"),NORMALIZE_PROPS:Symbol("normalizeProps"),WITH_MODIFIERS:Symbol("withModifiers"),WITH_KEYS:Symbol("withKeys")};const l={stop:"stop",prevent:"prevent",capture:"capture",self:"self",once:"once",passive:"passive",native:"native",middle:"middle",right:"right",left:"left"},f={enter:"enter",tab:"tab",esc:"esc",space:"space",up:"up",down:"down",left:"left",right:"right",delete:"delete",backspace:"backspace",insert:"insert",ctrl:"ctrl",alt:"alt",shift:"shift",meta:"meta"};function d(e){return e in l}function m(e){return e in f}function b(e){return d(e)?"event":m(e)?"key":"unknown"}const y=new Set(["value","checked","selected","multiple","muted","disabled","readOnly","contentEditable","spellcheck","draggable","autofocus","required","indeterminate","defaultChecked","defaultValue","innerHTML","textContent","innerText"]),g=new Set(["checked","selected","multiple","muted","disabled","readOnly","contentEditable","spellcheck","draggable","autofocus","required","indeterminate"]);function x(e){return y.has(e)}function E(t,r){if(e.isElementNode(t))return()=>{!function(t,r){const{tag:n}=t,o=s(n),i=u(n);r.helper(e.runtimeHelpers.CREATE_ELEMENT_VNODE);const a=function(t,r,n){const{tag:o,props:i,children:s}=t,{isSVG:a,isComponent:u}=n,c=[];u?(c.push(o),r.components.add(o)):c.push(`"${o}"`);const l=function(t,r,n){if(0===t.length)return null;const{isSVG:o,isComponent:i}=n,s=[];let a=null,u=null,c=null,l=null;for(const n of t)if(n.type===e.NodeTypes.ATTRIBUTE)"class"===n.name?a=n.value?n.value.content:"":"style"===n.name?c=n.value?n.value.content:"":s.push({key:n.name,value:n.value?`"${n.value.content}"`:"true"});else if(n.type===e.NodeTypes.DIRECTIVE)if("bind"===n.name){if(n.arg){const e=n.arg.content;if("class"===e)u={key:"class",value:O(n.exp?.content||"")};else if("style"===e)l={key:"style",value:O(n.exp?.content||"")};else{const e=h(n,{isSVG:o,isComponent:i});e&&s.push(e)}}}else{const e=T(n,r);e&&s.push(e)}(a||u)&&s.push(function(e,t,r){if(e&&t)return r.helper(p.NORMALIZE_CLASS),{key:"class",value:`normalizeClass(["${e}", ${t.value}])`};if(e)return{key:"class",value:`"${e}"`};if(t)return{key:"class",value:t.value};return{key:"class",value:'""'}}(a,u,r));(c||l)&&s.push(function(e,t,r){if(e&&t)return r.helper(p.NORMALIZE_STYLE),{key:"style",value:`normalizeStyle({"${e.replace(/:/g,'":"').replace(/;/g,'","')}"}, ${t.value})`};if(e)return{key:"style",value:`"${e}"`};if(t)return{key:"style",value:t.value};return{key:"style",value:'""'}}(c,l,r));if(0===s.length)return null;return e.createObjectExpression(s)}(i,r,{isSVG:a,isComponent:u});(l||s.length>0)&&c.push(l||"null");if(s.length>0){const t=function(t){if(0===t.length)return null;if(1===t.length){const r=t[0];if(r.type===e.NodeTypes.TEXT)return`"${r.content}"`;if(r.type===e.NodeTypes.INTERPOLATION)return O(r.content.content);if(r.type===e.NodeTypes.ELEMENT&&r.codegenNode)return r.codegenNode}const r=[];for(const n of t)n.type===e.NodeTypes.TEXT?r.push(`"${n.content}"`):n.type===e.NodeTypes.INTERPOLATION?r.push(O(n.content.content)):n.type===e.NodeTypes.ELEMENT||n.type===e.NodeTypes.IF?n.codegenNode&&r.push(n.codegenNode):n.type===e.NodeTypes.FOR&&n.codegenNode&&r.push(n.codegenNode);return e.createArrayExpression(r)}(s);c.push(t)}return e.createCallExpression(e.runtimeHelpers.CREATE_ELEMENT_VNODE,c)}(t,r,{isSVG:o,isComponent:i});a&&(t.codegenNode=a)}(t,r)}}function T(e,t){const{name:r,exp:n,modifiers:o}=e;let i=n?n.content:"() => {}";const s=[],a=[];for(const e of o){const t=b(e);"event"===t?s.push(e):"key"===t&&a.push(e)}return s.length>0&&(t.helper(p.WITH_MODIFIERS),i=`withModifiers(${i}, ["${s.join('", "')}"])`),a.length>0&&(t.helper(p.WITH_KEYS),i=`withKeys(${i}, ["${a.join('", "')}"])`),{key:`on${u=r,u.charAt(0).toUpperCase()+u.slice(1)}`,value:i};var u}function h(e,r){const{arg:n,exp:o}=e,{isSVG:i,isComponent:s}=r;if(!n)return t.warn("transformElement: v-bind 指令缺少参数"),null;const a=n.content,u=O(o?.content||"");return!s&&x(a),{key:a,value:u}}function O(e){return e?/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(e)&&!e.includes("(")?`${e}()`:e:""}function N(){return[e.transformIf,e.transformFor,E,e.transformText]}Object.defineProperty(exports,"ElementTypes",{enumerable:!0,get:function(){return e.ElementTypes}}),Object.defineProperty(exports,"ErrorCodes",{enumerable:!0,get:function(){return e.ErrorCodes}}),Object.defineProperty(exports,"NodeTypes",{enumerable:!0,get:function(){return e.NodeTypes}}),Object.defineProperty(exports,"cloneNode",{enumerable:!0,get:function(){return e.cloneNode}}),Object.defineProperty(exports,"createArrayExpression",{enumerable:!0,get:function(){return e.createArrayExpression}}),Object.defineProperty(exports,"createAttributeNode",{enumerable:!0,get:function(){return e.createAttributeNode}}),Object.defineProperty(exports,"createCallExpression",{enumerable:!0,get:function(){return e.createCallExpression}}),Object.defineProperty(exports,"createCompoundExpression",{enumerable:!0,get:function(){return e.createCompoundExpression}}),Object.defineProperty(exports,"createConditionalExpression",{enumerable:!0,get:function(){return e.createConditionalExpression}}),Object.defineProperty(exports,"createDirectiveNode",{enumerable:!0,get:function(){return e.createDirectiveNode}}),Object.defineProperty(exports,"createElementNode",{enumerable:!0,get:function(){return e.createElementNode}}),Object.defineProperty(exports,"createForNode",{enumerable:!0,get:function(){return e.createForNode}}),Object.defineProperty(exports,"createFunctionExpression",{enumerable:!0,get:function(){return e.createFunctionExpression}}),Object.defineProperty(exports,"createIfBranchNode",{enumerable:!0,get:function(){return e.createIfBranchNode}}),Object.defineProperty(exports,"createIfNode",{enumerable:!0,get:function(){return e.createIfNode}}),Object.defineProperty(exports,"createInterpolationNode",{enumerable:!0,get:function(){return e.createInterpolationNode}}),Object.defineProperty(exports,"createObjectExpression",{enumerable:!0,get:function(){return e.createObjectExpression}}),Object.defineProperty(exports,"createPosition",{enumerable:!0,get:function(){return e.createPosition}}),Object.defineProperty(exports,"createRoot",{enumerable:!0,get:function(){return e.createRoot}}),Object.defineProperty(exports,"createSimpleExpression",{enumerable:!0,get:function(){return e.createSimpleExpression}}),Object.defineProperty(exports,"createSourceLocation",{enumerable:!0,get:function(){return e.createSourceLocation}}),Object.defineProperty(exports,"createTextNode",{enumerable:!0,get:function(){return e.createTextNode}}),Object.defineProperty(exports,"createTransform",{enumerable:!0,get:function(){return e.createTransform}}),Object.defineProperty(exports,"createTransformContext",{enumerable:!0,get:function(){return e.createTransformContext}}),Object.defineProperty(exports,"generate",{enumerable:!0,get:function(){return e.generate}}),Object.defineProperty(exports,"getDefaultTransforms",{enumerable:!0,get:function(){return e.getDefaultTransforms}}),Object.defineProperty(exports,"getIfBranchType",{enumerable:!0,get:function(){return e.getIfBranchType}}),Object.defineProperty(exports,"getNodeChildren",{enumerable:!0,get:function(){return e.getNodeChildren}}),Object.defineProperty(exports,"getRuntimeHelperName",{enumerable:!0,get:function(){return e.getRuntimeHelperName}}),Object.defineProperty(exports,"hasTextChildren",{enumerable:!0,get:function(){return e.hasTextChildren}}),Object.defineProperty(exports,"isCompoundExpressionNode",{enumerable:!0,get:function(){return e.isCompoundExpressionNode}}),Object.defineProperty(exports,"isElementNode",{enumerable:!0,get:function(){return e.isElementNode}}),Object.defineProperty(exports,"isForNode",{enumerable:!0,get:function(){return e.isForNode}}),Object.defineProperty(exports,"isIfNode",{enumerable:!0,get:function(){return e.isIfNode}}),Object.defineProperty(exports,"isInterpolationNode",{enumerable:!0,get:function(){return e.isInterpolationNode}}),Object.defineProperty(exports,"isRuntimeHelper",{enumerable:!0,get:function(){return e.isRuntimeHelper}}),Object.defineProperty(exports,"isSimpleExpressionNode",{enumerable:!0,get:function(){return e.isSimpleExpressionNode}}),Object.defineProperty(exports,"isTextNode",{enumerable:!0,get:function(){return e.isTextNode}}),Object.defineProperty(exports,"isValidForNode",{enumerable:!0,get:function(){return e.isValidForNode}}),Object.defineProperty(exports,"isValidIfBranch",{enumerable:!0,get:function(){return e.isValidIfBranch}}),Object.defineProperty(exports,"normalizeTextContent",{enumerable:!0,get:function(){return e.normalizeTextContent}}),Object.defineProperty(exports,"parseForExpression",{enumerable:!0,get:function(){return e.parseForExpression}}),Object.defineProperty(exports,"runtimeHelpers",{enumerable:!0,get:function(){return e.runtimeHelpers}}),Object.defineProperty(exports,"transform",{enumerable:!0,get:function(){return e.transform}}),Object.defineProperty(exports,"transformFor",{enumerable:!0,get:function(){return e.transformFor}}),Object.defineProperty(exports,"transformIf",{enumerable:!0,get:function(){return e.transformIf}}),Object.defineProperty(exports,"transformText",{enumerable:!0,get:function(){return e.transformText}}),Object.defineProperty(exports,"traverseChildren",{enumerable:!0,get:function(){return e.traverseChildren}}),Object.defineProperty(exports,"traverseNode",{enumerable:!0,get:function(){return e.traverseNode}}),exports.DOMRuntimeHelperNames=c,exports.DOM_RUNTIME_HELPERS=p,exports.EVENT_MODIFIERS=l,exports.HTML_TAGS=r,exports.KEY_MODIFIERS=f,exports.SVG_TAGS=n,exports.VOID_TAGS=o,exports.compile=function(t,r={}){const n=r.nodeTransforms||N();return e.transform(t,{...r,nodeTransforms:n}),e.generate(t)},exports.createDOMTransformContext=function(t,r={}){return e.createTransformContext(t,{...r,nodeTransforms:r.nodeTransforms||N()})},exports.getDOMRuntimeHelperName=function(e){for(const[t,r]of Object.entries(p))if(r===e)return c[t];return""},exports.getDefaultDOMTransforms=N,exports.getModifierType=b,exports.getTagType=function(e){return s(e)?"svg":i(e)?"html":"component"},exports.isBooleanDOMProperty=function(e){return g.has(e)},exports.isComponentTag=u,exports.isDOMProperty=x,exports.isDOMRuntimeHelper=function(e){return"symbol"==typeof e&&Object.values(p).includes(e)},exports.isEventModifier=d,exports.isHTMLTag=i,exports.isKeyModifier=m,exports.isNativeTag=a,exports.isSVGTag=s,exports.isVoidTag=function(e){return o.has(e)},exports.transformElement=E;
|
|
2
|
+
//# sourceMappingURL=compiler-dom.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compiler-dom.cjs","sources":["../src/tagConfig.ts","../src/runtimeHelpers.ts","../src/transforms/transformElement.ts","../src/index.ts"],"sourcesContent":["/**\n * DOM 标签配置\n * 定义 HTML/SVG 标签列表,提供标签判断函数\n */\n\n/**\n * HTML 标签集合\n */\nexport const HTML_TAGS = new Set([\n\t'html', 'body', 'base', 'head', 'link', 'meta', 'style', 'title',\n\t'address', 'article', 'aside', 'footer', 'header', 'h1', 'h2', 'h3',\n\t'h4', 'h5', 'h6', 'hgroup', 'nav', 'section', 'div', 'dd', 'dl', 'dt',\n\t'figcaption', 'figure', 'hr', 'img', 'li', 'main', 'ol', 'p', 'pre', 'ul',\n\t'a', 'b', 'abbr', 'bdi', 'bdo', 'br', 'cite', 'code', 'data', 'dfn', 'em',\n\t'i', 'kbd', 'mark', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'small', 'span',\n\t'strong', 'sub', 'sup', 'time', 'u', 'var', 'wbr', 'area', 'audio', 'map',\n\t'track', 'video', 'embed', 'object', 'param', 'source', 'canvas', 'script',\n\t'noscript', 'del', 'ins', 'caption', 'col', 'colgroup', 'table', 'thead',\n\t'tbody', 'tfoot', 'td', 'th', 'tr', 'button', 'datalist', 'fieldset',\n\t'form', 'input', 'label', 'legend', 'meter', 'optgroup', 'option', 'output',\n\t'progress', 'select', 'textarea', 'details', 'dialog', 'menu', 'summary',\n\t'template', 'blockquote', 'iframe', 'tfoot'\n])\n\n/**\n * SVG 标签集合\n */\nexport const SVG_TAGS = new Set([\n\t'svg', 'animate', 'animateMotion', 'animateTransform', 'circle', 'clipPath',\n\t'defs', 'desc', 'ellipse', 'feBlend', 'feColorMatrix', 'feComponentTransfer',\n\t'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap',\n\t'feDistantLight', 'feDropShadow', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG',\n\t'feFuncR', 'feGaussianBlur', 'feImage', 'feMerge', 'feMergeNode', 'feMorphology',\n\t'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile',\n\t'feTurbulence', 'filter', 'foreignObject', 'g', 'image', 'line', 'linearGradient',\n\t'marker', 'mask', 'metadata', 'mpath', 'path', 'pattern', 'polygon', 'polyline',\n\t'radialGradient', 'rect', 'set', 'stop', 'switch', 'symbol', 'text', 'textPath',\n\t'tspan', 'use', 'view'\n])\n\n/**\n * 自闭合(void)标签集合\n * 这些标签不需要闭合标签\n */\nexport const VOID_TAGS = new Set([\n\t'area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'link', 'meta',\n\t'param', 'source', 'track', 'wbr'\n])\n\n/**\n * 判断是否为 HTML 标签\n * @param tag 标签名\n */\nexport function isHTMLTag(tag: string): boolean {\n\treturn HTML_TAGS.has(tag)\n}\n\n/**\n * 判断是否为 SVG 标签\n * @param tag 标签名\n */\nexport function isSVGTag(tag: string): boolean {\n\treturn SVG_TAGS.has(tag)\n}\n\n/**\n * 判断是否为自闭合标签\n * @param tag 标签名\n */\nexport function isVoidTag(tag: string): boolean {\n\treturn VOID_TAGS.has(tag)\n}\n\n/**\n * 获取标签类型\n * @param tag 标签名\n * @returns 'html' | 'svg' | 'component'\n */\nexport function getTagType(tag: string): 'html' | 'svg' | 'component' {\n\t// 先检查 SVG(因为 SVG 标签也可能是有效的 HTML)\n\tif (isSVGTag(tag)) {\n\t\treturn 'svg'\n\t}\n\n\t// 再检查 HTML\n\tif (isHTMLTag(tag)) {\n\t\treturn 'html'\n\t}\n\n\t// 否则认为是组件\n\treturn 'component'\n}\n\n/**\n * 判断是否为原生标签(HTML 或 SVG)\n * @param tag 标签名\n */\nexport function isNativeTag(tag: string): boolean {\n\treturn isHTMLTag(tag) || isSVGTag(tag)\n}\n\n/**\n * 判断是否为组件标签\n * 组件标签以大写字母开头或包含连字符\n * @param tag 标签名\n */\nexport function isComponentTag(tag: string): boolean {\n\t// 如果是原生标签,不是组件\n\tif (isNativeTag(tag)) {\n\t\treturn false\n\t}\n\n\t// 以大写字母开头或包含连字符的是组件\n\treturn /^[A-Z]/.test(tag) || tag.includes('-')\n}","/**\n * DOM 运行时辅助函数\n * 定义 DOM 特定的运行时辅助函数符号\n */\n\n/**\n * DOM 运行时辅助函数名称枚举\n */\nexport const enum DOMRuntimeHelperNames {\n\t// VNode 创建\n\tCREATE_ELEMENT_VNODE = 'h',\n\tCREATE_TEXT_VNODE = 'createTextVNode',\n\n\t// 工具函数\n\tNORMALIZE_CLASS = 'normalizeClass',\n\tNORMALIZE_STYLE = 'normalizeStyle',\n\tNORMALIZE_PROPS = 'normalizeProps',\n\n\t// 事件处理\n\tWITH_MODIFIERS = 'withModifiers',\n\tWITH_KEYS = 'withKeys'\n}\n\n/**\n * DOM 运行时辅助函数符号\n */\nexport const DOM_RUNTIME_HELPERS = {\n\t// VNode 创建\n\tCREATE_ELEMENT_VNODE: Symbol(DOMRuntimeHelperNames.CREATE_ELEMENT_VNODE),\n\tCREATE_TEXT_VNODE: Symbol(DOMRuntimeHelperNames.CREATE_TEXT_VNODE),\n\n\t// 工具函数\n\tNORMALIZE_CLASS: Symbol(DOMRuntimeHelperNames.NORMALIZE_CLASS),\n\tNORMALIZE_STYLE: Symbol(DOMRuntimeHelperNames.NORMALIZE_STYLE),\n\tNORMALIZE_PROPS: Symbol(DOMRuntimeHelperNames.NORMALIZE_PROPS),\n\n\t// 事件处理\n\tWITH_MODIFIERS: Symbol(DOMRuntimeHelperNames.WITH_MODIFIERS),\n\tWITH_KEYS: Symbol(DOMRuntimeHelperNames.WITH_KEYS)\n} as const\n\n/**\n * 获取 DOM 运行时辅助函数名称\n * @param symbol 辅助函数符号\n */\nexport function getDOMRuntimeHelperName(symbol: symbol): string {\n\tfor (const [key, value] of Object.entries(DOM_RUNTIME_HELPERS)) {\n\t\tif (value === symbol) {\n\t\t\treturn DOMRuntimeHelperNames[key as keyof typeof DOMRuntimeHelperNames]\n\t\t}\n\t}\n\treturn ''\n}\n\n/**\n * 判断是否为 DOM 运行时辅助函数\n * @param value 要判断的值\n */\nexport function isDOMRuntimeHelper(value: unknown): value is symbol {\n\treturn typeof value === 'symbol' && Object.values(DOM_RUNTIME_HELPERS).includes(value)\n}\n\n/**\n * 事件修饰符列表\n */\nexport const EVENT_MODIFIERS = {\n\t// 事件修饰符\n\tstop: 'stop',\n\tprevent: 'prevent',\n\tcapture: 'capture',\n\tself: 'self',\n\tonce: 'once',\n\tpassive: 'passive',\n\tnative: 'native',\n\n\t// 鼠标按钮修饰符\n\tmiddle: 'middle',\n\tright: 'right',\n\tleft: 'left'\n} as const\n\n/**\n * 按键修饰符列表\n */\nexport const KEY_MODIFIERS = {\n\t// 按键别名\n\tenter: 'enter',\n\ttab: 'tab',\n\tesc: 'esc',\n\tspace: 'space',\n\tup: 'up',\n\tdown: 'down',\n\tleft: 'left',\n\tright: 'right',\n\tdelete: 'delete',\n\tbackspace: 'backspace',\n\tinsert: 'insert',\n\n\t// 系统修饰键\n\tctrl: 'ctrl',\n\talt: 'alt',\n\tshift: 'shift',\n\tmeta: 'meta'\n} as const\n\n/**\n * 判断是否为事件修饰符\n * @param modifier 修饰符名称\n */\nexport function isEventModifier(modifier: string): boolean {\n\treturn modifier in EVENT_MODIFIERS\n}\n\n/**\n * 判断是否为按键修饰符\n * @param modifier 修饰符名称\n */\nexport function isKeyModifier(modifier: string): boolean {\n\treturn modifier in KEY_MODIFIERS\n}\n\n/**\n * 获取修饰符类型\n * @param modifier 修饰符名称\n */\nexport function getModifierType(modifier: string): 'event' | 'key' | 'unknown' {\n\tif (isEventModifier(modifier)) {\n\t\treturn 'event'\n\t}\n\tif (isKeyModifier(modifier)) {\n\t\treturn 'key'\n\t}\n\treturn 'unknown'\n}","/**\n * DOM 元素转换插件\n * 扩展 compiler-core 的 transformElement,添加 DOM 特定处理\n */\n\nimport {\n\tNodeTypes,\n\tElementNode,\n\tTemplateChildNode,\n\tTransformContext,\n\tJSCallExpression,\n\tJSObjectExpression,\n\tDirectiveNode,\n\tAttributeNode\n} from '@fluxion-ui/compiler-core'\nimport {\n\tcreateCallExpression,\n\tcreateObjectExpression,\n\tcreateSimpleExpression,\n\tcreateArrayExpression,\n\tisElementNode\n} from '@fluxion-ui/compiler-core'\nimport { runtimeHelpers } from '@fluxion-ui/compiler-core'\nimport { warn } from '@fluxion-ui/shared'\nimport { isHTMLTag, isSVGTag, isComponentTag } from '../tagConfig'\nimport {\n\tDOM_RUNTIME_HELPERS,\n\tgetModifierType\n} from '../runtimeHelpers'\n\n/**\n * DOM 特定的属性\n * 这些属性需要直接设置到 DOM 元素上,而不是作为 HTML 属性\n */\nconst DOM_PROPERTIES = new Set([\n\t'value', 'checked', 'selected', 'multiple',\n\t'muted', 'disabled', 'readOnly', 'contentEditable',\n\t'spellcheck', 'draggable', 'autofocus', 'required',\n\t'indeterminate', 'defaultChecked', 'defaultValue',\n\t'innerHTML', 'textContent', 'innerText'\n])\n\n/**\n * 布尔值 DOM 属性\n * 这些属性值为布尔类型\n */\nconst BOOLEAN_DOM_PROPERTIES = new Set([\n\t'checked', 'selected', 'multiple', 'muted', 'disabled',\n\t'readOnly', 'contentEditable', 'spellcheck', 'draggable',\n\t'autofocus', 'required', 'indeterminate'\n])\n\n/**\n * 判断是否为 DOM 属性\n * @param name 属性名\n */\nexport function isDOMProperty(name: string): boolean {\n\treturn DOM_PROPERTIES.has(name)\n}\n\n/**\n * 判断是否为布尔值 DOM 属性\n * @param name 属性名\n */\nexport function isBooleanDOMProperty(name: string): boolean {\n\treturn BOOLEAN_DOM_PROPERTIES.has(name)\n}\n\n/**\n * DOM 元素转换插件\n *\n * 扩展 compiler-core 的 transformElement,添加:\n * - 事件修饰符处理\n * - class/style 绑定合并\n * - SVG 元素识别\n * - DOM 属性处理\n */\nexport function transformElement(node: TemplateChildNode, context: TransformContext) {\n\tif (!isElementNode(node)) {\n\t\treturn\n\t}\n\n\t// 返回退出函数,在子节点处理完成后执行\n\treturn () => {\n\t\tprocessElement(node, context)\n\t}\n}\n\n/**\n * 处理元素节点\n */\nfunction processElement(node: ElementNode, context: TransformContext) {\n\tconst { tag } = node\n\n\t// 判断元素类型\n\tconst isSVG = isSVGTag(tag)\n\tconst isComponent = isComponentTag(tag)\n\n\t// 添加运行时辅助函数\n\tcontext.helper(runtimeHelpers.CREATE_ELEMENT_VNODE)\n\n\t// 创建代码生成节点\n\tconst codegenNode = createElementCodegen(node, context, { isSVG, isComponent })\n\n\tif (codegenNode) {\n\t\tnode.codegenNode = codegenNode\n\t}\n}\n\n/**\n * 创建元素的代码生成节点\n */\nfunction createElementCodegen(\n\tnode: ElementNode,\n\tcontext: TransformContext,\n\toptions: { isSVG: boolean; isComponent: boolean }\n): JSCallExpression {\n\tconst { tag, props, children } = node\n\tconst { isSVG, isComponent } = options\n\n\t// 创建参数\n\tconst args: (string | JSCallExpression | JSObjectExpression)[] = []\n\n\t// 第一个参数:标签名或组件\n\tif (isComponent) {\n\t\targs.push(tag)\n\t\tcontext.components.add(tag)\n\t} else {\n\t\targs.push(`\"${tag}\"`)\n\t}\n\n\t// 第二个参数:props 对象\n\tconst propsObj = createPropsObject(props, context, { isSVG, isComponent })\n\tif (propsObj || children.length > 0) {\n\t\tif (propsObj) {\n\t\t\targs.push(propsObj)\n\t\t} else {\n\t\t\targs.push('null' as any)\n\t\t}\n\t}\n\n\t// 第三个参数:children\n\tif (children.length > 0) {\n\t\tconst childrenArg = createChildrenArg(children)\n\t\targs.push(childrenArg as any)\n\t}\n\n\treturn createCallExpression(\n\t\truntimeHelpers.CREATE_ELEMENT_VNODE,\n\t\targs\n\t)\n}\n\n/**\n * 创建 props 对象\n */\nfunction createPropsObject(\n\tprops: Array<AttributeNode | DirectiveNode>,\n\tcontext: TransformContext,\n\toptions: { isSVG: boolean; isComponent: boolean }\n): JSObjectExpression | null {\n\tif (props.length === 0) {\n\t\treturn null\n\t}\n\n\tconst { isSVG, isComponent } = options\n\tconst properties: Array<{ key: string; value: any }> = []\n\n\t// 收集 class 和 style,用于合并\n\tlet staticClass: string | null = null\n\tlet dynamicClass: { key: string; value: any } | null = null\n\tlet staticStyle: string | null = null\n\tlet dynamicStyle: { key: string; value: any } | null = null\n\n\tfor (const prop of props) {\n\t\tif (prop.type === NodeTypes.ATTRIBUTE) {\n\t\t\t// 普通属性\n\t\t\tif (prop.name === 'class') {\n\t\t\t\tstaticClass = prop.value ? prop.value.content : ''\n\t\t\t} else if (prop.name === 'style') {\n\t\t\t\tstaticStyle = prop.value ? prop.value.content : ''\n\t\t\t} else {\n\t\t\t\tproperties.push({\n\t\t\t\t\tkey: prop.name,\n\t\t\t\t\tvalue: prop.value ? `\"${prop.value.content}\"` : 'true'\n\t\t\t\t})\n\t\t\t}\n\t\t} else if (prop.type === NodeTypes.DIRECTIVE) {\n\t\t\t// 指令\n\t\t\tif (prop.name === 'bind') {\n\t\t\t\t// 动态绑定\n\t\t\t\tif (prop.arg) {\n\t\t\t\t\tconst argName = prop.arg.content\n\n\t\t\t\t\tif (argName === 'class') {\n\t\t\t\t\t\tdynamicClass = {\n\t\t\t\t\t\t\tkey: 'class',\n\t\t\t\t\t\t\tvalue: wrapSignalCall(prop.exp?.content || '')\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (argName === 'style') {\n\t\t\t\t\t\tdynamicStyle = {\n\t\t\t\t\t\t\tkey: 'style',\n\t\t\t\t\t\t\tvalue: wrapSignalCall(prop.exp?.content || '')\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst directiveProp = processBindDirective(prop, { isSVG, isComponent })\n\t\t\t\t\t\tif (directiveProp) {\n\t\t\t\t\t\t\tproperties.push(directiveProp)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// 事件指令或其他指令\n\t\t\t\tconst directiveProp = processDirective(prop, context)\n\t\t\t\tif (directiveProp) {\n\t\t\t\t\tproperties.push(directiveProp)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// 处理 class 合并\n\tif (staticClass || dynamicClass) {\n\t\tproperties.push(processClassBinding(staticClass, dynamicClass, context))\n\t}\n\n\t// 处理 style 合并\n\tif (staticStyle || dynamicStyle) {\n\t\tproperties.push(processStyleBinding(staticStyle, dynamicStyle, context))\n\t}\n\n\tif (properties.length === 0) {\n\t\treturn null\n\t}\n\n\treturn createObjectExpression(properties)\n}\n\n/**\n * 处理事件指令\n * @click -> onClick\n * @click.stop -> withModifiers(handler, ['stop'])\n */\nfunction processDirective(\n\tdirective: DirectiveNode,\n\tcontext: TransformContext\n): { key: string; value: any } | null {\n\tconst { name, exp, modifiers } = directive\n\n\t// 构建事件处理器\n\tlet handlerValue = exp ? exp.content : '() => {}'\n\n\t// 处理修饰符\n\tconst eventModifiers: string[] = []\n\tconst keyModifiers: string[] = []\n\n\tfor (const modifier of modifiers) {\n\t\tconst type = getModifierType(modifier)\n\t\tif (type === 'event') {\n\t\t\teventModifiers.push(modifier)\n\t\t} else if (type === 'key') {\n\t\t\tkeyModifiers.push(modifier)\n\t\t}\n\t}\n\n\t// 包装事件修饰符\n\tif (eventModifiers.length > 0) {\n\t\tcontext.helper(DOM_RUNTIME_HELPERS.WITH_MODIFIERS)\n\t\thandlerValue = `withModifiers(${handlerValue}, [\"${eventModifiers.join('\", \"')}\"])`\n\t}\n\n\t// 包装按键修饰符\n\tif (keyModifiers.length > 0) {\n\t\tcontext.helper(DOM_RUNTIME_HELPERS.WITH_KEYS)\n\t\thandlerValue = `withKeys(${handlerValue}, [\"${keyModifiers.join('\", \"')}\"])`\n\t}\n\n\treturn {\n\t\tkey: `on${capitalize(name)}`,\n\t\tvalue: handlerValue\n\t}\n}\n\n/**\n * 处理 bind 指令\n */\nfunction processBindDirective(\n\tdirective: DirectiveNode,\n\toptions: { isSVG: boolean; isComponent: boolean }\n): { key: string; value: any } | null {\n\tconst { arg, exp } = directive\n\tconst { isSVG, isComponent } = options\n\n\tif (!arg) {\n\t\twarn('transformElement: v-bind 指令缺少参数')\n\t\treturn null\n\t}\n\n\tconst argName = arg.content\n\tconst value = wrapSignalCall(exp?.content || '')\n\n\t// DOM 属性处理\n\tif (!isComponent && isDOMProperty(argName)) {\n\t\t// 对于 DOM 属性,直接设置\n\t\treturn {\n\t\t\tkey: argName,\n\t\t\tvalue\n\t\t}\n\t}\n\n\t// SVG 属性处理\n\tif (isSVG) {\n\t\t// SVG 元素的属性需要特殊处理\n\t\treturn {\n\t\t\tkey: argName,\n\t\t\tvalue\n\t\t}\n\t}\n\n\treturn {\n\t\tkey: argName,\n\t\tvalue\n\t}\n}\n\n/**\n * 处理 class 绑定\n * 合并静态 class 和动态 :class\n */\nfunction processClassBinding(\n\tstaticClass: string | null,\n\tdynamicClass: { key: string; value: any } | null,\n\tcontext: TransformContext\n): { key: string; value: any } {\n\tif (staticClass && dynamicClass) {\n\t\t// 需要合并\n\t\tcontext.helper(DOM_RUNTIME_HELPERS.NORMALIZE_CLASS)\n\t\treturn {\n\t\t\tkey: 'class',\n\t\t\tvalue: `normalizeClass([\"${staticClass}\", ${dynamicClass.value}])`\n\t\t}\n\t} else if (staticClass) {\n\t\treturn {\n\t\t\tkey: 'class',\n\t\t\tvalue: `\"${staticClass}\"`\n\t\t}\n\t} else if (dynamicClass) {\n\t\treturn {\n\t\t\tkey: 'class',\n\t\t\tvalue: dynamicClass.value\n\t\t}\n\t}\n\n\treturn {\n\t\tkey: 'class',\n\t\tvalue: '\"\"'\n\t}\n}\n\n/**\n * 处理 style 绑定\n * 合并静态 style 和动态 :style\n */\nfunction processStyleBinding(\n\tstaticStyle: string | null,\n\tdynamicStyle: { key: string; value: any } | null,\n\tcontext: TransformContext\n): { key: string; value: any } {\n\tif (staticStyle && dynamicStyle) {\n\t\t// 需要合并\n\t\tcontext.helper(DOM_RUNTIME_HELPERS.NORMALIZE_STYLE)\n\t\treturn {\n\t\t\tkey: 'style',\n\t\t\tvalue: `normalizeStyle({\"${staticStyle.replace(/:/g, '\":\"').replace(/;/g, '\",\"')}\"}, ${dynamicStyle.value})`\n\t\t}\n\t} else if (staticStyle) {\n\t\treturn {\n\t\t\tkey: 'style',\n\t\t\tvalue: `\"${staticStyle}\"`\n\t\t}\n\t} else if (dynamicStyle) {\n\t\treturn {\n\t\t\tkey: 'style',\n\t\t\tvalue: dynamicStyle.value\n\t\t}\n\t}\n\n\treturn {\n\t\tkey: 'style',\n\t\tvalue: '\"\"'\n\t}\n}\n\n/**\n * 创建 children 参数\n */\nfunction createChildrenArg(\n\tchildren: TemplateChildNode[]\n): JSCallExpression | any {\n\tif (children.length === 0) {\n\t\treturn null\n\t}\n\n\t// 单个文本节点\n\tif (children.length === 1) {\n\t\tconst child = children[0]\n\t\tif (child.type === NodeTypes.TEXT) {\n\t\t\treturn `\"${child.content}\"`\n\t\t}\n\t\tif (child.type === NodeTypes.INTERPOLATION) {\n\t\t\treturn wrapSignalCall((child.content as any).content)\n\t\t}\n\t\tif (child.type === NodeTypes.ELEMENT && (child as any).codegenNode) {\n\t\t\treturn (child as any).codegenNode\n\t\t}\n\t}\n\n\t// 多个子节点,创建数组\n\tconst elements: any[] = []\n\tfor (const child of children) {\n\t\tif (child.type === NodeTypes.TEXT) {\n\t\t\telements.push(`\"${child.content}\"`)\n\t\t} else if (child.type === NodeTypes.INTERPOLATION) {\n\t\t\telements.push(wrapSignalCall((child.content as any).content))\n\t\t} else if (child.type === NodeTypes.ELEMENT) {\n\t\t\tif ((child as any).codegenNode) {\n\t\t\t\telements.push((child as any).codegenNode)\n\t\t\t}\n\t\t} else if (child.type === NodeTypes.IF) {\n\t\t\tif ((child as any).codegenNode) {\n\t\t\t\telements.push((child as any).codegenNode)\n\t\t\t}\n\t\t} else if (child.type === NodeTypes.FOR) {\n\t\t\tif ((child as any).codegenNode) {\n\t\t\t\telements.push((child as any).codegenNode)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn createArrayExpression(elements)\n}\n\n/**\n * 首字母大写\n */\nfunction capitalize(str: string): string {\n\treturn str.charAt(0).toUpperCase() + str.slice(1)\n}\n\n/**\n * 包装 signal 调用\n */\nfunction wrapSignalCall(content: string): string {\n\tif (!content) return ''\n\t// 简单的标识符,可能是 signal\n\tif (/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(content)) {\n\t\tif (!content.includes('(')) {\n\t\t\treturn `${content}()`\n\t\t}\n\t}\n\treturn content\n}","/**\n * compiler-dom\n * DOM 平台特定的编译功能\n */\n\n// 从 compiler-core 重新导出类型和工具\nexport {\n\t// 类型\n\tNodeTypes,\n\tElementTypes,\n\tErrorCodes,\n\ttype RootNode,\n\ttype ElementNode,\n\ttype TextNode,\n\ttype InterpolationNode,\n\ttype IfNode,\n\ttype IfBranchNode,\n\ttype ForNode,\n\ttype AttributeNode,\n\ttype DirectiveNode,\n\ttype SimpleExpressionNode,\n\ttype CompoundExpressionNode,\n\ttype ExpressionNode,\n\ttype TemplateChildNode,\n\ttype TransformContext,\n\ttype TransformFn,\n\ttype CompilerOptions,\n\ttype CompilerError,\n\ttype CodegenResult,\n\ttype SourceLocation,\n\ttype Position,\n\ttype JSChildNode,\n\ttype JSCallExpression,\n\ttype JSObjectExpression,\n\ttype JSArrayExpression,\n\ttype JSFunctionExpression,\n\ttype JSConditionalExpression,\n\n\t// AST 工具\n\tcreateRoot,\n\tcreateElementNode,\n\tcreateTextNode,\n\tcreateInterpolationNode,\n\tcreateAttributeNode,\n\tcreateDirectiveNode,\n\tcreateIfNode,\n\tcreateIfBranchNode,\n\tcreateForNode,\n\tcreateSimpleExpression,\n\tcreateCompoundExpression,\n\tcreateCallExpression,\n\tcreateObjectExpression,\n\tcreateArrayExpression,\n\tcreateFunctionExpression,\n\tcreateConditionalExpression,\n\tcreatePosition,\n\tcreateSourceLocation,\n\tisElementNode,\n\tisTextNode,\n\tisInterpolationNode,\n\tisIfNode,\n\tisForNode,\n\tisSimpleExpressionNode,\n\tisCompoundExpressionNode,\n\tgetNodeChildren,\n\tcloneNode,\n\n\t// 转换\n\ttransform,\n\ttraverseNode,\n\ttraverseChildren,\n\tcreateTransformContext,\n\tcreateTransform,\n\n\t// 转换插件(compiler-core)\n\ttransformIf,\n\ttransformFor,\n\ttransformText,\n\tgetDefaultTransforms,\n\tisValidIfBranch,\n\tgetIfBranchType,\n\tisValidForNode,\n\tparseForExpression,\n\thasTextChildren,\n\tnormalizeTextContent,\n\n\t// 代码生成\n\tgenerate,\n\n\t// 运行时辅助\n\truntimeHelpers,\n\tgetRuntimeHelperName,\n\tisRuntimeHelper\n} from '@fluxion-ui/compiler-core'\n\n// 标签配置\nexport {\n\tHTML_TAGS,\n\tSVG_TAGS,\n\tVOID_TAGS,\n\tisHTMLTag,\n\tisSVGTag,\n\tisVoidTag,\n\tgetTagType,\n\tisNativeTag,\n\tisComponentTag\n} from './tagConfig'\n\n// DOM 运行时辅助\nexport {\n\tDOM_RUNTIME_HELPERS,\n\tDOMRuntimeHelperNames,\n\tgetDOMRuntimeHelperName,\n\tisDOMRuntimeHelper,\n\tEVENT_MODIFIERS,\n\tKEY_MODIFIERS,\n\tisEventModifier,\n\tisKeyModifier,\n\tgetModifierType\n} from './runtimeHelpers'\n\n// DOM 转换插件\nexport {\n\ttransformElement,\n\tisDOMProperty,\n\tisBooleanDOMProperty\n} from './transforms'\n\n// ==================== 编译功能 ====================\n\nimport {\n\tRootNode,\n\tCompilerOptions,\n\tCodegenResult,\n\ttransform,\n\tgenerate,\n\tTransformFn,\n\tcreateTransformContext\n} from '@fluxion-ui/compiler-core'\nimport { warn } from '@fluxion-ui/shared'\nimport { transformElement } from './transforms'\nimport { transformIf, transformFor, transformText } from '@fluxion-ui/compiler-core'\n\n/**\n * DOM 编译器选项\n */\nexport interface DOMCompilerOptions extends CompilerOptions {\n\t/** 自定义元素判断函数 */\n\tisCustomElement?: (tag: string) => boolean\n\t/** 空白处理策略 */\n\twhitespace?: 'condense' | 'preserve'\n}\n\n/**\n * 获取 DOM 默认转换插件\n */\nexport function getDefaultDOMTransforms(): TransformFn[] {\n\treturn [\n\t\ttransformIf,\n\t\ttransformFor,\n\t\ttransformElement,\n\t\ttransformText\n\t]\n}\n\n/**\n * 编译 AST 为渲染函数代码\n * @param ast AST 根节点\n * @param options 编译选项\n */\nexport function compile(ast: RootNode, options: DOMCompilerOptions = {}): CodegenResult {\n\t// 合并默认转换插件\n\tconst transforms = options.nodeTransforms || getDefaultDOMTransforms()\n\n\t// 执行转换\n\ttransform(ast, {\n\t\t...options,\n\t\tnodeTransforms: transforms\n\t})\n\n\t// 生成代码\n\treturn generate(ast)\n}\n\n/**\n * 创建 DOM 转换上下文\n */\nexport function createDOMTransformContext(\n\troot: RootNode,\n\toptions: DOMCompilerOptions = {}\n) {\n\treturn createTransformContext(root, {\n\t\t...options,\n\t\tnodeTransforms: options.nodeTransforms || getDefaultDOMTransforms()\n\t})\n}"],"names":["HTML_TAGS","Set","SVG_TAGS","VOID_TAGS","isHTMLTag","tag","has","isSVGTag","isNativeTag","isComponentTag","test","includes","DOMRuntimeHelperNames","DOM_RUNTIME_HELPERS","CREATE_ELEMENT_VNODE","Symbol","CREATE_TEXT_VNODE","NORMALIZE_CLASS","NORMALIZE_STYLE","NORMALIZE_PROPS","WITH_MODIFIERS","WITH_KEYS","EVENT_MODIFIERS","stop","prevent","capture","self","once","passive","native","middle","right","left","KEY_MODIFIERS","enter","tab","esc","space","up","down","delete","backspace","insert","ctrl","alt","shift","meta","isEventModifier","modifier","isKeyModifier","getModifierType","DOM_PROPERTIES","BOOLEAN_DOM_PROPERTIES","isDOMProperty","name","transformElement","node","context","isElementNode","isSVG","isComponent","helper","runtimeHelpers","codegenNode","options","props","children","args","push","components","add","propsObj","length","properties","staticClass","dynamicClass","staticStyle","dynamicStyle","prop","type","NodeTypes","ATTRIBUTE","value","content","key","DIRECTIVE","arg","argName","wrapSignalCall","exp","directiveProp","processBindDirective","processDirective","processClassBinding","replace","processStyleBinding","createObjectExpression","createPropsObject","childrenArg","child","TEXT","INTERPOLATION","ELEMENT","elements","IF","FOR","createArrayExpression","createChildrenArg","createCallExpression","createElementCodegen","processElement","directive","modifiers","handlerValue","eventModifiers","keyModifiers","join","str","charAt","toUpperCase","slice","warn","getDefaultDOMTransforms","transformIf","transformFor","transformText","ast","transforms","nodeTransforms","transform","generate","root","createTransformContext","symbol","Object","entries","values"],"mappings":"wFAQO,MAAMA,MAAgBC,IAAI,CAChC,OAAQ,OAAQ,OAAQ,OAAQ,OAAQ,OAAQ,QAAS,QACzD,UAAW,UAAW,QAAS,SAAU,SAAU,KAAM,KAAM,KAC/D,KAAM,KAAM,KAAM,SAAU,MAAO,UAAW,MAAO,KAAM,KAAM,KACjE,aAAc,SAAU,KAAM,MAAO,KAAM,OAAQ,KAAM,IAAK,MAAO,KACrE,IAAK,IAAK,OAAQ,MAAO,MAAO,KAAM,OAAQ,OAAQ,OAAQ,MAAO,KACrE,IAAK,MAAO,OAAQ,IAAK,KAAM,KAAM,OAAQ,IAAK,OAAQ,QAAS,OACnE,SAAU,MAAO,MAAO,OAAQ,IAAK,MAAO,MAAO,OAAQ,QAAS,MACpE,QAAS,QAAS,QAAS,SAAU,QAAS,SAAU,SAAU,SAClE,WAAY,MAAO,MAAO,UAAW,MAAO,WAAY,QAAS,QACjE,QAAS,QAAS,KAAM,KAAM,KAAM,SAAU,WAAY,WAC1D,OAAQ,QAAS,QAAS,SAAU,QAAS,WAAY,SAAU,SACnE,WAAY,SAAU,WAAY,UAAW,SAAU,OAAQ,UAC/D,WAAY,aAAc,SAAU,UAMxBC,MAAeD,IAAI,CAC/B,MAAO,UAAW,gBAAiB,mBAAoB,SAAU,WACjE,OAAQ,OAAQ,UAAW,UAAW,gBAAiB,sBACvD,cAAe,mBAAoB,oBAAqB,oBACxD,iBAAkB,eAAgB,UAAW,UAAW,UAAW,UACnE,UAAW,iBAAkB,UAAW,UAAW,cAAe,eAClE,WAAY,eAAgB,qBAAsB,cAAe,SACjE,eAAgB,SAAU,gBAAiB,IAAK,QAAS,OAAQ,iBACjE,SAAU,OAAQ,WAAY,QAAS,OAAQ,UAAW,UAAW,WACrE,iBAAkB,OAAQ,MA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d,GAAGwE,MAGLA,EAPc,EAQtB,CCjTO,SAASuC,IACf,MAAO,CACNC,EAAAA,YACAC,EAAAA,aACArE,EACAsE,EAAAA,cAEF,s2KAOO,SAAiBC,EAAe9D,EAA8B,IAEpE,MAAM+D,EAAa/D,EAAQgE,gBAAkBN,IAS7C,OANAO,EAAAA,UAAUH,EAAK,IACX9D,EACHgE,eAAgBD,IAIVG,EAAAA,SAASJ,EACjB,oCAKO,SACNK,EACAnE,EAA8B,IAE9B,OAAOoE,EAAAA,uBAAuBD,EAAM,IAChCnE,EACHgE,eAAgBhE,EAAQgE,gBAAkBN,KAE5C,kCFtJO,SAAiCW,GACvC,IAAA,MAAYjD,EAAKF,KAAUoD,OAAOC,QAAQ1H,GACzC,GAAIqE,IAAUmD,EACb,OAAOzH,EAAsBwE,GAG/B,MAAO,EACR,iFD0BO,SAAoB/E,GAE1B,OAAIE,EAASF,GACL,MAIJD,EAAUC,GACN,OAID,WACR,+BE3BO,SAA8BiD,GACpC,OAAOF,EAAuB9C,IAAIgD,EACnC,8EDRO,SAA4B4B,GAClC,MAAwB,iBAAVA,GAAsBoD,OAAOE,OAAO3H,GAAqBF,SAASuE,EACjF,mIDSO,SAAmB7E,GACzB,OAAOF,EAAUG,IAAID,EACtB"}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import * as _fluxion_ui_compiler_core from '@fluxion-ui/compiler-core';
|
|
2
|
+
import { TemplateChildNode, TransformContext, CompilerOptions, RootNode, CodegenResult, TransformFn } from '@fluxion-ui/compiler-core';
|
|
3
|
+
export { AttributeNode, CodegenResult, CompilerError, CompilerOptions, CompoundExpressionNode, DirectiveNode, ElementNode, ElementTypes, ErrorCodes, ExpressionNode, ForNode, IfBranchNode, IfNode, InterpolationNode, JSArrayExpression, JSCallExpression, JSChildNode, JSConditionalExpression, JSFunctionExpression, JSObjectExpression, NodeTypes, Position, RootNode, SimpleExpressionNode, SourceLocation, TemplateChildNode, TextNode, TransformContext, TransformFn, cloneNode, createArrayExpression, createAttributeNode, createCallExpression, createCompoundExpression, createConditionalExpression, createDirectiveNode, createElementNode, createForNode, createFunctionExpression, createIfBranchNode, createIfNode, createInterpolationNode, createObjectExpression, createPosition, createRoot, createSimpleExpression, createSourceLocation, createTextNode, createTransform, createTransformContext, generate, getDefaultTransforms, getIfBranchType, getNodeChildren, getRuntimeHelperName, hasTextChildren, isCompoundExpressionNode, isElementNode, isForNode, isIfNode, isInterpolationNode, isRuntimeHelper, isSimpleExpressionNode, isTextNode, isValidForNode, isValidIfBranch, normalizeTextContent, parseForExpression, runtimeHelpers, transform, transformFor, transformIf, transformText, traverseChildren, traverseNode } from '@fluxion-ui/compiler-core';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* DOM 标签配置
|
|
7
|
+
* 定义 HTML/SVG 标签列表,提供标签判断函数
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* HTML 标签集合
|
|
11
|
+
*/
|
|
12
|
+
declare const HTML_TAGS: Set<string>;
|
|
13
|
+
/**
|
|
14
|
+
* SVG 标签集合
|
|
15
|
+
*/
|
|
16
|
+
declare const SVG_TAGS: Set<string>;
|
|
17
|
+
/**
|
|
18
|
+
* 自闭合(void)标签集合
|
|
19
|
+
* 这些标签不需要闭合标签
|
|
20
|
+
*/
|
|
21
|
+
declare const VOID_TAGS: Set<string>;
|
|
22
|
+
/**
|
|
23
|
+
* 判断是否为 HTML 标签
|
|
24
|
+
* @param tag 标签名
|
|
25
|
+
*/
|
|
26
|
+
declare function isHTMLTag(tag: string): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* 判断是否为 SVG 标签
|
|
29
|
+
* @param tag 标签名
|
|
30
|
+
*/
|
|
31
|
+
declare function isSVGTag(tag: string): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* 判断是否为自闭合标签
|
|
34
|
+
* @param tag 标签名
|
|
35
|
+
*/
|
|
36
|
+
declare function isVoidTag(tag: string): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* 获取标签类型
|
|
39
|
+
* @param tag 标签名
|
|
40
|
+
* @returns 'html' | 'svg' | 'component'
|
|
41
|
+
*/
|
|
42
|
+
declare function getTagType(tag: string): 'html' | 'svg' | 'component';
|
|
43
|
+
/**
|
|
44
|
+
* 判断是否为原生标签(HTML 或 SVG)
|
|
45
|
+
* @param tag 标签名
|
|
46
|
+
*/
|
|
47
|
+
declare function isNativeTag(tag: string): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* 判断是否为组件标签
|
|
50
|
+
* 组件标签以大写字母开头或包含连字符
|
|
51
|
+
* @param tag 标签名
|
|
52
|
+
*/
|
|
53
|
+
declare function isComponentTag(tag: string): boolean;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* DOM 运行时辅助函数
|
|
57
|
+
* 定义 DOM 特定的运行时辅助函数符号
|
|
58
|
+
*/
|
|
59
|
+
/**
|
|
60
|
+
* DOM 运行时辅助函数名称枚举
|
|
61
|
+
*/
|
|
62
|
+
declare const enum DOMRuntimeHelperNames {
|
|
63
|
+
CREATE_ELEMENT_VNODE = "h",
|
|
64
|
+
CREATE_TEXT_VNODE = "createTextVNode",
|
|
65
|
+
NORMALIZE_CLASS = "normalizeClass",
|
|
66
|
+
NORMALIZE_STYLE = "normalizeStyle",
|
|
67
|
+
NORMALIZE_PROPS = "normalizeProps",
|
|
68
|
+
WITH_MODIFIERS = "withModifiers",
|
|
69
|
+
WITH_KEYS = "withKeys"
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* DOM 运行时辅助函数符号
|
|
73
|
+
*/
|
|
74
|
+
declare const DOM_RUNTIME_HELPERS: {
|
|
75
|
+
readonly CREATE_ELEMENT_VNODE: symbol;
|
|
76
|
+
readonly CREATE_TEXT_VNODE: symbol;
|
|
77
|
+
readonly NORMALIZE_CLASS: symbol;
|
|
78
|
+
readonly NORMALIZE_STYLE: symbol;
|
|
79
|
+
readonly NORMALIZE_PROPS: symbol;
|
|
80
|
+
readonly WITH_MODIFIERS: symbol;
|
|
81
|
+
readonly WITH_KEYS: symbol;
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* 获取 DOM 运行时辅助函数名称
|
|
85
|
+
* @param symbol 辅助函数符号
|
|
86
|
+
*/
|
|
87
|
+
declare function getDOMRuntimeHelperName(symbol: symbol): string;
|
|
88
|
+
/**
|
|
89
|
+
* 判断是否为 DOM 运行时辅助函数
|
|
90
|
+
* @param value 要判断的值
|
|
91
|
+
*/
|
|
92
|
+
declare function isDOMRuntimeHelper(value: unknown): value is symbol;
|
|
93
|
+
/**
|
|
94
|
+
* 事件修饰符列表
|
|
95
|
+
*/
|
|
96
|
+
declare const EVENT_MODIFIERS: {
|
|
97
|
+
readonly stop: "stop";
|
|
98
|
+
readonly prevent: "prevent";
|
|
99
|
+
readonly capture: "capture";
|
|
100
|
+
readonly self: "self";
|
|
101
|
+
readonly once: "once";
|
|
102
|
+
readonly passive: "passive";
|
|
103
|
+
readonly native: "native";
|
|
104
|
+
readonly middle: "middle";
|
|
105
|
+
readonly right: "right";
|
|
106
|
+
readonly left: "left";
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* 按键修饰符列表
|
|
110
|
+
*/
|
|
111
|
+
declare const KEY_MODIFIERS: {
|
|
112
|
+
readonly enter: "enter";
|
|
113
|
+
readonly tab: "tab";
|
|
114
|
+
readonly esc: "esc";
|
|
115
|
+
readonly space: "space";
|
|
116
|
+
readonly up: "up";
|
|
117
|
+
readonly down: "down";
|
|
118
|
+
readonly left: "left";
|
|
119
|
+
readonly right: "right";
|
|
120
|
+
readonly delete: "delete";
|
|
121
|
+
readonly backspace: "backspace";
|
|
122
|
+
readonly insert: "insert";
|
|
123
|
+
readonly ctrl: "ctrl";
|
|
124
|
+
readonly alt: "alt";
|
|
125
|
+
readonly shift: "shift";
|
|
126
|
+
readonly meta: "meta";
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* 判断是否为事件修饰符
|
|
130
|
+
* @param modifier 修饰符名称
|
|
131
|
+
*/
|
|
132
|
+
declare function isEventModifier(modifier: string): boolean;
|
|
133
|
+
/**
|
|
134
|
+
* 判断是否为按键修饰符
|
|
135
|
+
* @param modifier 修饰符名称
|
|
136
|
+
*/
|
|
137
|
+
declare function isKeyModifier(modifier: string): boolean;
|
|
138
|
+
/**
|
|
139
|
+
* 获取修饰符类型
|
|
140
|
+
* @param modifier 修饰符名称
|
|
141
|
+
*/
|
|
142
|
+
declare function getModifierType(modifier: string): 'event' | 'key' | 'unknown';
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* DOM 元素转换插件
|
|
146
|
+
* 扩展 compiler-core 的 transformElement,添加 DOM 特定处理
|
|
147
|
+
*/
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* 判断是否为 DOM 属性
|
|
151
|
+
* @param name 属性名
|
|
152
|
+
*/
|
|
153
|
+
declare function isDOMProperty(name: string): boolean;
|
|
154
|
+
/**
|
|
155
|
+
* 判断是否为布尔值 DOM 属性
|
|
156
|
+
* @param name 属性名
|
|
157
|
+
*/
|
|
158
|
+
declare function isBooleanDOMProperty(name: string): boolean;
|
|
159
|
+
/**
|
|
160
|
+
* DOM 元素转换插件
|
|
161
|
+
*
|
|
162
|
+
* 扩展 compiler-core 的 transformElement,添加:
|
|
163
|
+
* - 事件修饰符处理
|
|
164
|
+
* - class/style 绑定合并
|
|
165
|
+
* - SVG 元素识别
|
|
166
|
+
* - DOM 属性处理
|
|
167
|
+
*/
|
|
168
|
+
declare function transformElement(node: TemplateChildNode, context: TransformContext): (() => void) | undefined;
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* DOM 编译器选项
|
|
172
|
+
*/
|
|
173
|
+
interface DOMCompilerOptions extends CompilerOptions {
|
|
174
|
+
/** 自定义元素判断函数 */
|
|
175
|
+
isCustomElement?: (tag: string) => boolean;
|
|
176
|
+
/** 空白处理策略 */
|
|
177
|
+
whitespace?: 'condense' | 'preserve';
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* 获取 DOM 默认转换插件
|
|
181
|
+
*/
|
|
182
|
+
declare function getDefaultDOMTransforms(): TransformFn[];
|
|
183
|
+
/**
|
|
184
|
+
* 编译 AST 为渲染函数代码
|
|
185
|
+
* @param ast AST 根节点
|
|
186
|
+
* @param options 编译选项
|
|
187
|
+
*/
|
|
188
|
+
declare function compile(ast: RootNode, options?: DOMCompilerOptions): CodegenResult;
|
|
189
|
+
/**
|
|
190
|
+
* 创建 DOM 转换上下文
|
|
191
|
+
*/
|
|
192
|
+
declare function createDOMTransformContext(root: RootNode, options?: DOMCompilerOptions): _fluxion_ui_compiler_core.TransformContext;
|
|
193
|
+
|
|
194
|
+
export { DOMRuntimeHelperNames, DOM_RUNTIME_HELPERS, EVENT_MODIFIERS, HTML_TAGS, KEY_MODIFIERS, SVG_TAGS, VOID_TAGS, compile, createDOMTransformContext, getDOMRuntimeHelperName, getDefaultDOMTransforms, getModifierType, getTagType, isBooleanDOMProperty, isComponentTag, isDOMProperty, isDOMRuntimeHelper, isEventModifier, isHTMLTag, isKeyModifier, isNativeTag, isSVGTag, isVoidTag, transformElement };
|
|
195
|
+
export type { DOMCompilerOptions };
|
|
196
|
+
//# sourceMappingURL=compiler-dom.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compiler-dom.d.ts","sources":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{isElementNode as e,runtimeHelpers as t,createCallExpression as n,NodeTypes as r,createObjectExpression as o,createArrayExpression as i,transform as s,generate as a,createTransformContext as l,transformIf as c,transformFor as u,transformText as f}from"@fluxion-ui/compiler-core";export{ElementTypes,ErrorCodes,NodeTypes,cloneNode,createArrayExpression,createAttributeNode,createCallExpression,createCompoundExpression,createConditionalExpression,createDirectiveNode,createElementNode,createForNode,createFunctionExpression,createIfBranchNode,createIfNode,createInterpolationNode,createObjectExpression,createPosition,createRoot,createSimpleExpression,createSourceLocation,createTextNode,createTransform,createTransformContext,generate,getDefaultTransforms,getIfBranchType,getNodeChildren,getRuntimeHelperName,hasTextChildren,isCompoundExpressionNode,isElementNode,isForNode,isIfNode,isInterpolationNode,isRuntimeHelper,isSimpleExpressionNode,isTextNode,isValidForNode,isValidIfBranch,normalizeTextContent,parseForExpression,runtimeHelpers,transform,transformFor,transformIf,transformText,traverseChildren,traverseNode}from"@fluxion-ui/compiler-core";import{warn as p}from"@fluxion-ui/shared";const d=new Set(["html","body","base","head","link","meta","style","title","address","article","aside","footer","header","h1","h2","h3","h4","h5","h6","hgroup","nav","section","div","dd","dl","dt","figcaption","figure","hr","img","li","main","ol","p","pre","ul","a","b","abbr","bdi","bdo","br","cite","code","data","dfn","em","i","kbd","mark","q","rp","rt","ruby","s","samp","small","span","strong","sub","sup","time","u","var","wbr","area","audio","map","track","video","embed","object","param","source","canvas","script","noscript","del","ins","caption","col","colgroup","table","thead","tbody","tfoot","td","th","tr","button","datalist","fieldset","form","input","label","legend","meter","optgroup","option","output","progress","select","textarea","details","dialog","menu","summary","template","blockquote","iframe","tfoot"]),m=new Set(["svg","animate","animateMotion","animateTransform","circle","clipPath","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","foreignObject","g","image","line","linearGradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialGradient","rect","set","stop","switch","symbol","text","textPath","tspan","use","view"]),h=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function E(e){return d.has(e)}function g(e){return m.has(e)}function y(e){return h.has(e)}function T(e){return g(e)?"svg":E(e)?"html":"component"}function N(e){return E(e)||g(e)}function b(e){return!N(e)&&(/^[A-Z]/.test(e)||e.includes("-"))}var v=(e=>(e.CREATE_ELEMENT_VNODE="h",e.CREATE_TEXT_VNODE="createTextVNode",e.NORMALIZE_CLASS="normalizeClass",e.NORMALIZE_STYLE="normalizeStyle",e.NORMALIZE_PROPS="normalizeProps",e.WITH_MODIFIERS="withModifiers",e.WITH_KEYS="withKeys",e))(v||{});const S={CREATE_ELEMENT_VNODE:Symbol("h"),CREATE_TEXT_VNODE:Symbol("createTextVNode"),NORMALIZE_CLASS:Symbol("normalizeClass"),NORMALIZE_STYLE:Symbol("normalizeStyle"),NORMALIZE_PROPS:Symbol("normalizeProps"),WITH_MODIFIERS:Symbol("withModifiers"),WITH_KEYS:Symbol("withKeys")};function I(e){for(const[t,n]of Object.entries(S))if(n===e)return v[t];return""}function C(e){return"symbol"==typeof e&&Object.values(S).includes(e)}const x={stop:"stop",prevent:"prevent",capture:"capture",self:"self",once:"once",passive:"passive",native:"native",middle:"middle",right:"right",left:"left"},k={enter:"enter",tab:"tab",esc:"esc",space:"space",up:"up",down:"down",left:"left",right:"right",delete:"delete",backspace:"backspace",insert:"insert",ctrl:"ctrl",alt:"alt",shift:"shift",meta:"meta"};function O(e){return e in x}function L(e){return e in k}function M(e){return O(e)?"event":L(e)?"key":"unknown"}const R=new Set(["value","checked","selected","multiple","muted","disabled","readOnly","contentEditable","spellcheck","draggable","autofocus","required","indeterminate","defaultChecked","defaultValue","innerHTML","textContent","innerText"]),_=new Set(["checked","selected","multiple","muted","disabled","readOnly","contentEditable","spellcheck","draggable","autofocus","required","indeterminate"]);function A(e){return R.has(e)}function w(e){return _.has(e)}function $(s,a){if(e(s))return()=>{!function(e,s){const{tag:a}=e,l=g(a),c=b(a);s.helper(t.CREATE_ELEMENT_VNODE);const u=function(e,s,a){const{tag:l,props:c,children:u}=e,{isSVG:f,isComponent:p}=a,d=[];p?(d.push(l),s.components.add(l)):d.push(`"${l}"`);const m=function(e,t,n){if(0===e.length)return null;const{isSVG:i,isComponent:s}=n,a=[];let l=null,c=null,u=null,f=null;for(const n of e)if(n.type===r.ATTRIBUTE)"class"===n.name?l=n.value?n.value.content:"":"style"===n.name?u=n.value?n.value.content:"":a.push({key:n.name,value:n.value?`"${n.value.content}"`:"true"});else if(n.type===r.DIRECTIVE)if("bind"===n.name){if(n.arg){const e=n.arg.content;if("class"===e)c={key:"class",value:F(n.exp?.content||"")};else if("style"===e)f={key:"style",value:F(n.exp?.content||"")};else{const e=D(n,{isSVG:i,isComponent:s});e&&a.push(e)}}}else{const e=V(n,t);e&&a.push(e)}(l||c)&&a.push(function(e,t,n){if(e&&t)return n.helper(S.NORMALIZE_CLASS),{key:"class",value:`normalizeClass(["${e}", ${t.value}])`};if(e)return{key:"class",value:`"${e}"`};if(t)return{key:"class",value:t.value};return{key:"class",value:'""'}}(l,c,t));(u||f)&&a.push(function(e,t,n){if(e&&t)return n.helper(S.NORMALIZE_STYLE),{key:"style",value:`normalizeStyle({"${e.replace(/:/g,'":"').replace(/;/g,'","')}"}, ${t.value})`};if(e)return{key:"style",value:`"${e}"`};if(t)return{key:"style",value:t.value};return{key:"style",value:'""'}}(u,f,t));if(0===a.length)return null;return o(a)}(c,s,{isSVG:f,isComponent:p});(m||u.length>0)&&d.push(m||"null");if(u.length>0){const e=function(e){if(0===e.length)return null;if(1===e.length){const t=e[0];if(t.type===r.TEXT)return`"${t.content}"`;if(t.type===r.INTERPOLATION)return F(t.content.content);if(t.type===r.ELEMENT&&t.codegenNode)return t.codegenNode}const t=[];for(const n of e)n.type===r.TEXT?t.push(`"${n.content}"`):n.type===r.INTERPOLATION?t.push(F(n.content.content)):n.type===r.ELEMENT||n.type===r.IF?n.codegenNode&&t.push(n.codegenNode):n.type===r.FOR&&n.codegenNode&&t.push(n.codegenNode);return i(t)}(u);d.push(e)}return n(t.CREATE_ELEMENT_VNODE,d)}(e,s,{isSVG:l,isComponent:c});u&&(e.codegenNode=u)}(s,a)}}function V(e,t){const{name:n,exp:r,modifiers:o}=e;let i=r?r.content:"() => {}";const s=[],a=[];for(const e of o){const t=M(e);"event"===t?s.push(e):"key"===t&&a.push(e)}return s.length>0&&(t.helper(S.WITH_MODIFIERS),i=`withModifiers(${i}, ["${s.join('", "')}"])`),a.length>0&&(t.helper(S.WITH_KEYS),i=`withKeys(${i}, ["${a.join('", "')}"])`),{key:`on${l=n,l.charAt(0).toUpperCase()+l.slice(1)}`,value:i};var l}function D(e,t){const{arg:n,exp:r}=e,{isSVG:o,isComponent:i}=t;if(!n)return p("transformElement: v-bind 指令缺少参数"),null;const s=n.content,a=F(r?.content||"");return!i&&A(s),{key:s,value:a}}function F(e){return e?/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(e)&&!e.includes("(")?`${e}()`:e:""}function P(){return[c,u,$,f]}function z(e,t={}){const n=t.nodeTransforms||P();return s(e,{...t,nodeTransforms:n}),a(e)}function Z(e,t={}){return l(e,{...t,nodeTransforms:t.nodeTransforms||P()})}export{v as DOMRuntimeHelperNames,S as DOM_RUNTIME_HELPERS,x as EVENT_MODIFIERS,d as HTML_TAGS,k as KEY_MODIFIERS,m as SVG_TAGS,h as VOID_TAGS,z as compile,Z as createDOMTransformContext,I as getDOMRuntimeHelperName,P as getDefaultDOMTransforms,M as getModifierType,T as getTagType,w as isBooleanDOMProperty,b as isComponentTag,A as isDOMProperty,C as isDOMRuntimeHelper,O as isEventModifier,E as isHTMLTag,L as isKeyModifier,N as isNativeTag,g as isSVGTag,y as isVoidTag,$ as transformElement};
|
|
2
|
+
//# sourceMappingURL=compiler-dom.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compiler-dom.js","sources":["../src/tagConfig.ts","../src/runtimeHelpers.ts","../src/transforms/transformElement.ts","../src/index.ts"],"sourcesContent":["/**\n * DOM 标签配置\n * 定义 HTML/SVG 标签列表,提供标签判断函数\n */\n\n/**\n * HTML 标签集合\n */\nexport const HTML_TAGS = new Set([\n\t'html', 'body', 'base', 'head', 'link', 'meta', 'style', 'title',\n\t'address', 'article', 'aside', 'footer', 'header', 'h1', 'h2', 'h3',\n\t'h4', 'h5', 'h6', 'hgroup', 'nav', 'section', 'div', 'dd', 'dl', 'dt',\n\t'figcaption', 'figure', 'hr', 'img', 'li', 'main', 'ol', 'p', 'pre', 'ul',\n\t'a', 'b', 'abbr', 'bdi', 'bdo', 'br', 'cite', 'code', 'data', 'dfn', 'em',\n\t'i', 'kbd', 'mark', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'small', 'span',\n\t'strong', 'sub', 'sup', 'time', 'u', 'var', 'wbr', 'area', 'audio', 'map',\n\t'track', 'video', 'embed', 'object', 'param', 'source', 'canvas', 'script',\n\t'noscript', 'del', 'ins', 'caption', 'col', 'colgroup', 'table', 'thead',\n\t'tbody', 'tfoot', 'td', 'th', 'tr', 'button', 'datalist', 'fieldset',\n\t'form', 'input', 'label', 'legend', 'meter', 'optgroup', 'option', 'output',\n\t'progress', 'select', 'textarea', 'details', 'dialog', 'menu', 'summary',\n\t'template', 'blockquote', 'iframe', 'tfoot'\n])\n\n/**\n * SVG 标签集合\n */\nexport const SVG_TAGS = new Set([\n\t'svg', 'animate', 'animateMotion', 'animateTransform', 'circle', 'clipPath',\n\t'defs', 'desc', 'ellipse', 'feBlend', 'feColorMatrix', 'feComponentTransfer',\n\t'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap',\n\t'feDistantLight', 'feDropShadow', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG',\n\t'feFuncR', 'feGaussianBlur', 'feImage', 'feMerge', 'feMergeNode', 'feMorphology',\n\t'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile',\n\t'feTurbulence', 'filter', 'foreignObject', 'g', 'image', 'line', 'linearGradient',\n\t'marker', 'mask', 'metadata', 'mpath', 'path', 'pattern', 'polygon', 'polyline',\n\t'radialGradient', 'rect', 'set', 'stop', 'switch', 'symbol', 'text', 'textPath',\n\t'tspan', 'use', 'view'\n])\n\n/**\n * 自闭合(void)标签集合\n * 这些标签不需要闭合标签\n */\nexport const VOID_TAGS = new Set([\n\t'area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'link', 'meta',\n\t'param', 'source', 'track', 'wbr'\n])\n\n/**\n * 判断是否为 HTML 标签\n * @param tag 标签名\n */\nexport function isHTMLTag(tag: string): boolean {\n\treturn HTML_TAGS.has(tag)\n}\n\n/**\n * 判断是否为 SVG 标签\n * @param tag 标签名\n */\nexport function isSVGTag(tag: string): boolean {\n\treturn SVG_TAGS.has(tag)\n}\n\n/**\n * 判断是否为自闭合标签\n * @param tag 标签名\n */\nexport function isVoidTag(tag: string): boolean {\n\treturn VOID_TAGS.has(tag)\n}\n\n/**\n * 获取标签类型\n * @param tag 标签名\n * @returns 'html' | 'svg' | 'component'\n */\nexport function getTagType(tag: string): 'html' | 'svg' | 'component' {\n\t// 先检查 SVG(因为 SVG 标签也可能是有效的 HTML)\n\tif (isSVGTag(tag)) {\n\t\treturn 'svg'\n\t}\n\n\t// 再检查 HTML\n\tif (isHTMLTag(tag)) {\n\t\treturn 'html'\n\t}\n\n\t// 否则认为是组件\n\treturn 'component'\n}\n\n/**\n * 判断是否为原生标签(HTML 或 SVG)\n * @param tag 标签名\n */\nexport function isNativeTag(tag: string): boolean {\n\treturn isHTMLTag(tag) || isSVGTag(tag)\n}\n\n/**\n * 判断是否为组件标签\n * 组件标签以大写字母开头或包含连字符\n * @param tag 标签名\n */\nexport function isComponentTag(tag: string): boolean {\n\t// 如果是原生标签,不是组件\n\tif (isNativeTag(tag)) {\n\t\treturn false\n\t}\n\n\t// 以大写字母开头或包含连字符的是组件\n\treturn /^[A-Z]/.test(tag) || tag.includes('-')\n}","/**\n * DOM 运行时辅助函数\n * 定义 DOM 特定的运行时辅助函数符号\n */\n\n/**\n * DOM 运行时辅助函数名称枚举\n */\nexport const enum DOMRuntimeHelperNames {\n\t// VNode 创建\n\tCREATE_ELEMENT_VNODE = 'h',\n\tCREATE_TEXT_VNODE = 'createTextVNode',\n\n\t// 工具函数\n\tNORMALIZE_CLASS = 'normalizeClass',\n\tNORMALIZE_STYLE = 'normalizeStyle',\n\tNORMALIZE_PROPS = 'normalizeProps',\n\n\t// 事件处理\n\tWITH_MODIFIERS = 'withModifiers',\n\tWITH_KEYS = 'withKeys'\n}\n\n/**\n * DOM 运行时辅助函数符号\n */\nexport const DOM_RUNTIME_HELPERS = {\n\t// VNode 创建\n\tCREATE_ELEMENT_VNODE: Symbol(DOMRuntimeHelperNames.CREATE_ELEMENT_VNODE),\n\tCREATE_TEXT_VNODE: Symbol(DOMRuntimeHelperNames.CREATE_TEXT_VNODE),\n\n\t// 工具函数\n\tNORMALIZE_CLASS: Symbol(DOMRuntimeHelperNames.NORMALIZE_CLASS),\n\tNORMALIZE_STYLE: Symbol(DOMRuntimeHelperNames.NORMALIZE_STYLE),\n\tNORMALIZE_PROPS: Symbol(DOMRuntimeHelperNames.NORMALIZE_PROPS),\n\n\t// 事件处理\n\tWITH_MODIFIERS: Symbol(DOMRuntimeHelperNames.WITH_MODIFIERS),\n\tWITH_KEYS: Symbol(DOMRuntimeHelperNames.WITH_KEYS)\n} as const\n\n/**\n * 获取 DOM 运行时辅助函数名称\n * @param symbol 辅助函数符号\n */\nexport function getDOMRuntimeHelperName(symbol: symbol): string {\n\tfor (const [key, value] of Object.entries(DOM_RUNTIME_HELPERS)) {\n\t\tif (value === symbol) {\n\t\t\treturn DOMRuntimeHelperNames[key as keyof typeof DOMRuntimeHelperNames]\n\t\t}\n\t}\n\treturn ''\n}\n\n/**\n * 判断是否为 DOM 运行时辅助函数\n * @param value 要判断的值\n */\nexport function isDOMRuntimeHelper(value: unknown): value is symbol {\n\treturn typeof value === 'symbol' && Object.values(DOM_RUNTIME_HELPERS).includes(value)\n}\n\n/**\n * 事件修饰符列表\n */\nexport const EVENT_MODIFIERS = {\n\t// 事件修饰符\n\tstop: 'stop',\n\tprevent: 'prevent',\n\tcapture: 'capture',\n\tself: 'self',\n\tonce: 'once',\n\tpassive: 'passive',\n\tnative: 'native',\n\n\t// 鼠标按钮修饰符\n\tmiddle: 'middle',\n\tright: 'right',\n\tleft: 'left'\n} as const\n\n/**\n * 按键修饰符列表\n */\nexport const KEY_MODIFIERS = {\n\t// 按键别名\n\tenter: 'enter',\n\ttab: 'tab',\n\tesc: 'esc',\n\tspace: 'space',\n\tup: 'up',\n\tdown: 'down',\n\tleft: 'left',\n\tright: 'right',\n\tdelete: 'delete',\n\tbackspace: 'backspace',\n\tinsert: 'insert',\n\n\t// 系统修饰键\n\tctrl: 'ctrl',\n\talt: 'alt',\n\tshift: 'shift',\n\tmeta: 'meta'\n} as const\n\n/**\n * 判断是否为事件修饰符\n * @param modifier 修饰符名称\n */\nexport function isEventModifier(modifier: string): boolean {\n\treturn modifier in EVENT_MODIFIERS\n}\n\n/**\n * 判断是否为按键修饰符\n * @param modifier 修饰符名称\n */\nexport function isKeyModifier(modifier: string): boolean {\n\treturn modifier in KEY_MODIFIERS\n}\n\n/**\n * 获取修饰符类型\n * @param modifier 修饰符名称\n */\nexport function getModifierType(modifier: string): 'event' | 'key' | 'unknown' {\n\tif (isEventModifier(modifier)) {\n\t\treturn 'event'\n\t}\n\tif (isKeyModifier(modifier)) {\n\t\treturn 'key'\n\t}\n\treturn 'unknown'\n}","/**\n * DOM 元素转换插件\n * 扩展 compiler-core 的 transformElement,添加 DOM 特定处理\n */\n\nimport {\n\tNodeTypes,\n\tElementNode,\n\tTemplateChildNode,\n\tTransformContext,\n\tJSCallExpression,\n\tJSObjectExpression,\n\tDirectiveNode,\n\tAttributeNode\n} from '@fluxion-ui/compiler-core'\nimport {\n\tcreateCallExpression,\n\tcreateObjectExpression,\n\tcreateSimpleExpression,\n\tcreateArrayExpression,\n\tisElementNode\n} from '@fluxion-ui/compiler-core'\nimport { runtimeHelpers } from '@fluxion-ui/compiler-core'\nimport { warn } from '@fluxion-ui/shared'\nimport { isHTMLTag, isSVGTag, isComponentTag } from '../tagConfig'\nimport {\n\tDOM_RUNTIME_HELPERS,\n\tgetModifierType\n} from '../runtimeHelpers'\n\n/**\n * DOM 特定的属性\n * 这些属性需要直接设置到 DOM 元素上,而不是作为 HTML 属性\n */\nconst DOM_PROPERTIES = new Set([\n\t'value', 'checked', 'selected', 'multiple',\n\t'muted', 'disabled', 'readOnly', 'contentEditable',\n\t'spellcheck', 'draggable', 'autofocus', 'required',\n\t'indeterminate', 'defaultChecked', 'defaultValue',\n\t'innerHTML', 'textContent', 'innerText'\n])\n\n/**\n * 布尔值 DOM 属性\n * 这些属性值为布尔类型\n */\nconst BOOLEAN_DOM_PROPERTIES = new Set([\n\t'checked', 'selected', 'multiple', 'muted', 'disabled',\n\t'readOnly', 'contentEditable', 'spellcheck', 'draggable',\n\t'autofocus', 'required', 'indeterminate'\n])\n\n/**\n * 判断是否为 DOM 属性\n * @param name 属性名\n */\nexport function isDOMProperty(name: string): boolean {\n\treturn DOM_PROPERTIES.has(name)\n}\n\n/**\n * 判断是否为布尔值 DOM 属性\n * @param name 属性名\n */\nexport function isBooleanDOMProperty(name: string): boolean {\n\treturn BOOLEAN_DOM_PROPERTIES.has(name)\n}\n\n/**\n * DOM 元素转换插件\n *\n * 扩展 compiler-core 的 transformElement,添加:\n * - 事件修饰符处理\n * - class/style 绑定合并\n * - SVG 元素识别\n * - DOM 属性处理\n */\nexport function transformElement(node: TemplateChildNode, context: TransformContext) {\n\tif (!isElementNode(node)) {\n\t\treturn\n\t}\n\n\t// 返回退出函数,在子节点处理完成后执行\n\treturn () => {\n\t\tprocessElement(node, context)\n\t}\n}\n\n/**\n * 处理元素节点\n */\nfunction processElement(node: ElementNode, context: TransformContext) {\n\tconst { tag } = node\n\n\t// 判断元素类型\n\tconst isSVG = isSVGTag(tag)\n\tconst isComponent = isComponentTag(tag)\n\n\t// 添加运行时辅助函数\n\tcontext.helper(runtimeHelpers.CREATE_ELEMENT_VNODE)\n\n\t// 创建代码生成节点\n\tconst codegenNode = createElementCodegen(node, context, { isSVG, isComponent })\n\n\tif (codegenNode) {\n\t\tnode.codegenNode = codegenNode\n\t}\n}\n\n/**\n * 创建元素的代码生成节点\n */\nfunction createElementCodegen(\n\tnode: ElementNode,\n\tcontext: TransformContext,\n\toptions: { isSVG: boolean; isComponent: boolean }\n): JSCallExpression {\n\tconst { tag, props, children } = node\n\tconst { isSVG, isComponent } = options\n\n\t// 创建参数\n\tconst args: (string | JSCallExpression | JSObjectExpression)[] = []\n\n\t// 第一个参数:标签名或组件\n\tif (isComponent) {\n\t\targs.push(tag)\n\t\tcontext.components.add(tag)\n\t} else {\n\t\targs.push(`\"${tag}\"`)\n\t}\n\n\t// 第二个参数:props 对象\n\tconst propsObj = createPropsObject(props, context, { isSVG, isComponent })\n\tif (propsObj || children.length > 0) {\n\t\tif (propsObj) {\n\t\t\targs.push(propsObj)\n\t\t} else {\n\t\t\targs.push('null' as any)\n\t\t}\n\t}\n\n\t// 第三个参数:children\n\tif (children.length > 0) {\n\t\tconst childrenArg = createChildrenArg(children)\n\t\targs.push(childrenArg as any)\n\t}\n\n\treturn createCallExpression(\n\t\truntimeHelpers.CREATE_ELEMENT_VNODE,\n\t\targs\n\t)\n}\n\n/**\n * 创建 props 对象\n */\nfunction createPropsObject(\n\tprops: Array<AttributeNode | DirectiveNode>,\n\tcontext: TransformContext,\n\toptions: { isSVG: boolean; isComponent: boolean }\n): JSObjectExpression | null {\n\tif (props.length === 0) {\n\t\treturn null\n\t}\n\n\tconst { isSVG, isComponent } = options\n\tconst properties: Array<{ key: string; value: any }> = []\n\n\t// 收集 class 和 style,用于合并\n\tlet staticClass: string | null = null\n\tlet dynamicClass: { key: string; value: any } | null = null\n\tlet staticStyle: string | null = null\n\tlet dynamicStyle: { key: string; value: any } | null = null\n\n\tfor (const prop of props) {\n\t\tif (prop.type === NodeTypes.ATTRIBUTE) {\n\t\t\t// 普通属性\n\t\t\tif (prop.name === 'class') {\n\t\t\t\tstaticClass = prop.value ? prop.value.content : ''\n\t\t\t} else if (prop.name === 'style') {\n\t\t\t\tstaticStyle = prop.value ? prop.value.content : ''\n\t\t\t} else {\n\t\t\t\tproperties.push({\n\t\t\t\t\tkey: prop.name,\n\t\t\t\t\tvalue: prop.value ? `\"${prop.value.content}\"` : 'true'\n\t\t\t\t})\n\t\t\t}\n\t\t} else if (prop.type === NodeTypes.DIRECTIVE) {\n\t\t\t// 指令\n\t\t\tif (prop.name === 'bind') {\n\t\t\t\t// 动态绑定\n\t\t\t\tif (prop.arg) {\n\t\t\t\t\tconst argName = prop.arg.content\n\n\t\t\t\t\tif (argName === 'class') {\n\t\t\t\t\t\tdynamicClass = {\n\t\t\t\t\t\t\tkey: 'class',\n\t\t\t\t\t\t\tvalue: wrapSignalCall(prop.exp?.content || '')\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (argName === 'style') {\n\t\t\t\t\t\tdynamicStyle = {\n\t\t\t\t\t\t\tkey: 'style',\n\t\t\t\t\t\t\tvalue: wrapSignalCall(prop.exp?.content || '')\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst directiveProp = processBindDirective(prop, { isSVG, isComponent })\n\t\t\t\t\t\tif (directiveProp) {\n\t\t\t\t\t\t\tproperties.push(directiveProp)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// 事件指令或其他指令\n\t\t\t\tconst directiveProp = processDirective(prop, context)\n\t\t\t\tif (directiveProp) {\n\t\t\t\t\tproperties.push(directiveProp)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// 处理 class 合并\n\tif (staticClass || dynamicClass) {\n\t\tproperties.push(processClassBinding(staticClass, dynamicClass, context))\n\t}\n\n\t// 处理 style 合并\n\tif (staticStyle || dynamicStyle) {\n\t\tproperties.push(processStyleBinding(staticStyle, dynamicStyle, context))\n\t}\n\n\tif (properties.length === 0) {\n\t\treturn null\n\t}\n\n\treturn createObjectExpression(properties)\n}\n\n/**\n * 处理事件指令\n * @click -> onClick\n * @click.stop -> withModifiers(handler, ['stop'])\n */\nfunction processDirective(\n\tdirective: DirectiveNode,\n\tcontext: TransformContext\n): { key: string; value: any } | null {\n\tconst { name, exp, modifiers } = directive\n\n\t// 构建事件处理器\n\tlet handlerValue = exp ? exp.content : '() => {}'\n\n\t// 处理修饰符\n\tconst eventModifiers: string[] = []\n\tconst keyModifiers: string[] = []\n\n\tfor (const modifier of modifiers) {\n\t\tconst type = getModifierType(modifier)\n\t\tif (type === 'event') {\n\t\t\teventModifiers.push(modifier)\n\t\t} else if (type === 'key') {\n\t\t\tkeyModifiers.push(modifier)\n\t\t}\n\t}\n\n\t// 包装事件修饰符\n\tif (eventModifiers.length > 0) {\n\t\tcontext.helper(DOM_RUNTIME_HELPERS.WITH_MODIFIERS)\n\t\thandlerValue = `withModifiers(${handlerValue}, [\"${eventModifiers.join('\", \"')}\"])`\n\t}\n\n\t// 包装按键修饰符\n\tif (keyModifiers.length > 0) {\n\t\tcontext.helper(DOM_RUNTIME_HELPERS.WITH_KEYS)\n\t\thandlerValue = `withKeys(${handlerValue}, [\"${keyModifiers.join('\", \"')}\"])`\n\t}\n\n\treturn {\n\t\tkey: `on${capitalize(name)}`,\n\t\tvalue: handlerValue\n\t}\n}\n\n/**\n * 处理 bind 指令\n */\nfunction processBindDirective(\n\tdirective: DirectiveNode,\n\toptions: { isSVG: boolean; isComponent: boolean }\n): { key: string; value: any } | null {\n\tconst { arg, exp } = directive\n\tconst { isSVG, isComponent } = options\n\n\tif (!arg) {\n\t\twarn('transformElement: v-bind 指令缺少参数')\n\t\treturn null\n\t}\n\n\tconst argName = arg.content\n\tconst value = wrapSignalCall(exp?.content || '')\n\n\t// DOM 属性处理\n\tif (!isComponent && isDOMProperty(argName)) {\n\t\t// 对于 DOM 属性,直接设置\n\t\treturn {\n\t\t\tkey: argName,\n\t\t\tvalue\n\t\t}\n\t}\n\n\t// SVG 属性处理\n\tif (isSVG) {\n\t\t// SVG 元素的属性需要特殊处理\n\t\treturn {\n\t\t\tkey: argName,\n\t\t\tvalue\n\t\t}\n\t}\n\n\treturn {\n\t\tkey: argName,\n\t\tvalue\n\t}\n}\n\n/**\n * 处理 class 绑定\n * 合并静态 class 和动态 :class\n */\nfunction processClassBinding(\n\tstaticClass: string | null,\n\tdynamicClass: { key: string; value: any } | null,\n\tcontext: TransformContext\n): { key: string; value: any } {\n\tif (staticClass && dynamicClass) {\n\t\t// 需要合并\n\t\tcontext.helper(DOM_RUNTIME_HELPERS.NORMALIZE_CLASS)\n\t\treturn {\n\t\t\tkey: 'class',\n\t\t\tvalue: `normalizeClass([\"${staticClass}\", ${dynamicClass.value}])`\n\t\t}\n\t} else if (staticClass) {\n\t\treturn {\n\t\t\tkey: 'class',\n\t\t\tvalue: `\"${staticClass}\"`\n\t\t}\n\t} else if (dynamicClass) {\n\t\treturn {\n\t\t\tkey: 'class',\n\t\t\tvalue: dynamicClass.value\n\t\t}\n\t}\n\n\treturn {\n\t\tkey: 'class',\n\t\tvalue: '\"\"'\n\t}\n}\n\n/**\n * 处理 style 绑定\n * 合并静态 style 和动态 :style\n */\nfunction processStyleBinding(\n\tstaticStyle: string | null,\n\tdynamicStyle: { key: string; value: any } | null,\n\tcontext: TransformContext\n): { key: string; value: any } {\n\tif (staticStyle && dynamicStyle) {\n\t\t// 需要合并\n\t\tcontext.helper(DOM_RUNTIME_HELPERS.NORMALIZE_STYLE)\n\t\treturn {\n\t\t\tkey: 'style',\n\t\t\tvalue: `normalizeStyle({\"${staticStyle.replace(/:/g, '\":\"').replace(/;/g, '\",\"')}\"}, ${dynamicStyle.value})`\n\t\t}\n\t} else if (staticStyle) {\n\t\treturn {\n\t\t\tkey: 'style',\n\t\t\tvalue: `\"${staticStyle}\"`\n\t\t}\n\t} else if (dynamicStyle) {\n\t\treturn {\n\t\t\tkey: 'style',\n\t\t\tvalue: dynamicStyle.value\n\t\t}\n\t}\n\n\treturn {\n\t\tkey: 'style',\n\t\tvalue: '\"\"'\n\t}\n}\n\n/**\n * 创建 children 参数\n */\nfunction createChildrenArg(\n\tchildren: TemplateChildNode[]\n): JSCallExpression | any {\n\tif (children.length === 0) {\n\t\treturn null\n\t}\n\n\t// 单个文本节点\n\tif (children.length === 1) {\n\t\tconst child = children[0]\n\t\tif (child.type === NodeTypes.TEXT) {\n\t\t\treturn `\"${child.content}\"`\n\t\t}\n\t\tif (child.type === NodeTypes.INTERPOLATION) {\n\t\t\treturn wrapSignalCall((child.content as any).content)\n\t\t}\n\t\tif (child.type === NodeTypes.ELEMENT && (child as any).codegenNode) {\n\t\t\treturn (child as any).codegenNode\n\t\t}\n\t}\n\n\t// 多个子节点,创建数组\n\tconst elements: any[] = []\n\tfor (const child of children) {\n\t\tif (child.type === NodeTypes.TEXT) {\n\t\t\telements.push(`\"${child.content}\"`)\n\t\t} else if (child.type === NodeTypes.INTERPOLATION) {\n\t\t\telements.push(wrapSignalCall((child.content as any).content))\n\t\t} else if (child.type === NodeTypes.ELEMENT) {\n\t\t\tif ((child as any).codegenNode) {\n\t\t\t\telements.push((child as any).codegenNode)\n\t\t\t}\n\t\t} else if (child.type === NodeTypes.IF) {\n\t\t\tif ((child as any).codegenNode) {\n\t\t\t\telements.push((child as any).codegenNode)\n\t\t\t}\n\t\t} else if (child.type === NodeTypes.FOR) {\n\t\t\tif ((child as any).codegenNode) {\n\t\t\t\telements.push((child as any).codegenNode)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn createArrayExpression(elements)\n}\n\n/**\n * 首字母大写\n */\nfunction capitalize(str: string): string {\n\treturn str.charAt(0).toUpperCase() + str.slice(1)\n}\n\n/**\n * 包装 signal 调用\n */\nfunction wrapSignalCall(content: string): string {\n\tif (!content) return ''\n\t// 简单的标识符,可能是 signal\n\tif (/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(content)) {\n\t\tif (!content.includes('(')) {\n\t\t\treturn `${content}()`\n\t\t}\n\t}\n\treturn content\n}","/**\n * compiler-dom\n * DOM 平台特定的编译功能\n */\n\n// 从 compiler-core 重新导出类型和工具\nexport {\n\t// 类型\n\tNodeTypes,\n\tElementTypes,\n\tErrorCodes,\n\ttype RootNode,\n\ttype ElementNode,\n\ttype TextNode,\n\ttype InterpolationNode,\n\ttype IfNode,\n\ttype IfBranchNode,\n\ttype ForNode,\n\ttype AttributeNode,\n\ttype DirectiveNode,\n\ttype SimpleExpressionNode,\n\ttype CompoundExpressionNode,\n\ttype ExpressionNode,\n\ttype TemplateChildNode,\n\ttype TransformContext,\n\ttype TransformFn,\n\ttype CompilerOptions,\n\ttype CompilerError,\n\ttype CodegenResult,\n\ttype SourceLocation,\n\ttype Position,\n\ttype JSChildNode,\n\ttype JSCallExpression,\n\ttype JSObjectExpression,\n\ttype JSArrayExpression,\n\ttype JSFunctionExpression,\n\ttype JSConditionalExpression,\n\n\t// AST 工具\n\tcreateRoot,\n\tcreateElementNode,\n\tcreateTextNode,\n\tcreateInterpolationNode,\n\tcreateAttributeNode,\n\tcreateDirectiveNode,\n\tcreateIfNode,\n\tcreateIfBranchNode,\n\tcreateForNode,\n\tcreateSimpleExpression,\n\tcreateCompoundExpression,\n\tcreateCallExpression,\n\tcreateObjectExpression,\n\tcreateArrayExpression,\n\tcreateFunctionExpression,\n\tcreateConditionalExpression,\n\tcreatePosition,\n\tcreateSourceLocation,\n\tisElementNode,\n\tisTextNode,\n\tisInterpolationNode,\n\tisIfNode,\n\tisForNode,\n\tisSimpleExpressionNode,\n\tisCompoundExpressionNode,\n\tgetNodeChildren,\n\tcloneNode,\n\n\t// 转换\n\ttransform,\n\ttraverseNode,\n\ttraverseChildren,\n\tcreateTransformContext,\n\tcreateTransform,\n\n\t// 转换插件(compiler-core)\n\ttransformIf,\n\ttransformFor,\n\ttransformText,\n\tgetDefaultTransforms,\n\tisValidIfBranch,\n\tgetIfBranchType,\n\tisValidForNode,\n\tparseForExpression,\n\thasTextChildren,\n\tnormalizeTextContent,\n\n\t// 代码生成\n\tgenerate,\n\n\t// 运行时辅助\n\truntimeHelpers,\n\tgetRuntimeHelperName,\n\tisRuntimeHelper\n} from '@fluxion-ui/compiler-core'\n\n// 标签配置\nexport {\n\tHTML_TAGS,\n\tSVG_TAGS,\n\tVOID_TAGS,\n\tisHTMLTag,\n\tisSVGTag,\n\tisVoidTag,\n\tgetTagType,\n\tisNativeTag,\n\tisComponentTag\n} from './tagConfig'\n\n// DOM 运行时辅助\nexport {\n\tDOM_RUNTIME_HELPERS,\n\tDOMRuntimeHelperNames,\n\tgetDOMRuntimeHelperName,\n\tisDOMRuntimeHelper,\n\tEVENT_MODIFIERS,\n\tKEY_MODIFIERS,\n\tisEventModifier,\n\tisKeyModifier,\n\tgetModifierType\n} from './runtimeHelpers'\n\n// DOM 转换插件\nexport {\n\ttransformElement,\n\tisDOMProperty,\n\tisBooleanDOMProperty\n} from './transforms'\n\n// ==================== 编译功能 ====================\n\nimport {\n\tRootNode,\n\tCompilerOptions,\n\tCodegenResult,\n\ttransform,\n\tgenerate,\n\tTransformFn,\n\tcreateTransformContext\n} from '@fluxion-ui/compiler-core'\nimport { warn } from '@fluxion-ui/shared'\nimport { transformElement } from './transforms'\nimport { transformIf, transformFor, transformText } from '@fluxion-ui/compiler-core'\n\n/**\n * DOM 编译器选项\n */\nexport interface DOMCompilerOptions extends CompilerOptions {\n\t/** 自定义元素判断函数 */\n\tisCustomElement?: (tag: string) => boolean\n\t/** 空白处理策略 */\n\twhitespace?: 'condense' | 'preserve'\n}\n\n/**\n * 获取 DOM 默认转换插件\n */\nexport function getDefaultDOMTransforms(): TransformFn[] {\n\treturn [\n\t\ttransformIf,\n\t\ttransformFor,\n\t\ttransformElement,\n\t\ttransformText\n\t]\n}\n\n/**\n * 编译 AST 为渲染函数代码\n * @param ast AST 根节点\n * @param options 编译选项\n */\nexport function compile(ast: RootNode, options: DOMCompilerOptions = {}): CodegenResult {\n\t// 合并默认转换插件\n\tconst transforms = options.nodeTransforms || getDefaultDOMTransforms()\n\n\t// 执行转换\n\ttransform(ast, {\n\t\t...options,\n\t\tnodeTransforms: transforms\n\t})\n\n\t// 生成代码\n\treturn generate(ast)\n}\n\n/**\n * 创建 DOM 转换上下文\n */\nexport function createDOMTransformContext(\n\troot: RootNode,\n\toptions: DOMCompilerOptions = {}\n) {\n\treturn createTransformContext(root, {\n\t\t...options,\n\t\tnodeTransforms: options.nodeTransforms || getDefaultDOMTransforms()\n\t})\n}"],"names":["HTML_TAGS","Set","SVG_TAGS","VOID_TAGS","isHTMLTag","tag","has","isSVGTag","isVoidTag","getTagType","isNativeTag","isComponentTag","test","includes","DOMRuntimeHelperNames","DOM_RUNTIME_HELPERS","CREATE_ELEMENT_VNODE","Symbol","CREATE_TEXT_VNODE","NORMALIZE_CLASS","NORMALIZE_STYLE","NORMALIZE_PROPS","WITH_MODIFIERS","WITH_KEYS","getDOMRuntimeHelperName","symbol","key","value","Object","entries","isDOMRuntimeHelper","values","EVENT_MODIFIERS","stop","prevent","capture","self","once","passive","native","middle","right","left","KEY_MODIFIERS","enter","tab","esc","space","up","down","delete","backspace","insert","ctrl","alt","shift","meta","isEventModifier","modifier","isKeyModifier","getModifierType","DOM_PROPERTIES","BOOLEAN_DOM_PROPERTIES","isDOMProperty","name","isBooleanDOMProperty","transformElement","node","context","isElementNode","isSVG","isComponent","helper","runtimeHelpers","codegenNode","options","props","children","args","push","components","add","propsObj","length","properties","staticClass","dynamicClass","staticStyle","dynamicStyle","prop","type","NodeTypes","ATTRIBUTE","content","DIRECTIVE","arg","argName","wrapSignalCall","exp","directiveProp","processBindDirective","processDirective","processClassBinding","replace","processStyleBinding","createObjectExpression","createPropsObject","childrenArg","child","TEXT","INTERPOLATION","ELEMENT","elements","IF","FOR","createArrayExpression","createChildrenArg","createCallExpression","createElementCodegen","processElement","directive","modifiers","handlerValue","eventModifiers","keyModifiers","join","str","charAt","toUpperCase","slice","warn","getDefaultDOMTransforms","transformIf","transformFor","transformText","compile","ast","transforms","nodeTransforms","transform","generate","createDOMTransformContext","root","createTransformContext"],"mappings":"8qCAQO,MAAMA,MAAgBC,IAAI,CAChC,OAAQ,OAAQ,OAAQ,OAAQ,OAAQ,OAAQ,QAAS,QACzD,UAAW,UAAW,QAAS,SAAU,SAAU,KAAM,KAAM,KAC/D,KAAM,KAAM,KAAM,SAAU,MAAO,UAAW,MAAO,KAAM,KAAM,KACjE,aAAc,SAAU,KAAM,MAAO,KAAM,OAAQ,KAAM,IAAK,MAAO,KACrE,IAAK,IAAK,OAAQ,MAAO,MAAO,KAAM,OAAQ,OAAQ,OAAQ,MAAO,KACrE,IAAK,MAAO,OAAQ,IAAK,KAAM,KAAM,OAAQ,IAAK,OAAQ,QAAS,OACnE,SAAU,MAAO,MAAO,OAAQ,IAAK,MAAO,MAAO,OAAQ,QAAS,MACpE,QAAS,QAAS,QAAS,SAAU,QAAS,SAAU,SAAU,SAClE,WAAY,MAAO,MAAO,UAAW,MAAO,WAAY,QAAS,QACjE,QAAS,QAAS,KAAM,KAAM,KAAM,SAAU,WAAY,WAC1D,OAAQ,QAAS,QAAS,SAAU,QAAS,WAAY,SAAU,SACnE,WAAY,SAAU,WAAY,UAAW,SAAU,OAAQ,UAC/D,WAAY,aAAc,SAAU,UAMxBC,MAAeD,IAAI,CAC/B,MAAO,UAAW,gBAAiB,mBAAoB,SAAU,WACjE,OAAQ,OAAQ,UAAW,UAAW,gBAAiB,sBACvD,cAAe,mBAAoB,oBAAqB,oBACxD,iBAAkB,eAAgB,UAAW,UAAW,UAAW,UACnE,UAAW,iBAAkB,UAAW,UAAW,cAAe,eAClE,WAAY,eAAgB,qBAAsB,cAAe,SACjE,eAAgB,SAAU,gBAAiB,IAAK,QAAS,OAAQ,iBACjE,SAAU,OAAQ,WAAY,QAAS,OAAQ,UAAW,UAAW,WACrE,iBAAkB,OAAQ,MAAO,OAA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EAAAC,YAAOA,GAAgBI,EAE/B,IAAKoB,EAEJ,OADAmC,EAAK,mCACE,KAGR,MAAMlC,EAAUD,EAAIF,QACdlE,EAAQsE,EAAeC,GAAKL,SAAW,IAG7C,OAAKtB,GAAeR,EAAciC,GAE1B,CACNtE,IAAKsE,EACLrE,QAiBH,CAiIA,SAASsE,EAAeJ,GACvB,OAAKA,EAED,6BAA6BjF,KAAKiF,KAChCA,EAAQhF,SAAS,KACd,GAAGgF,MAGLA,EAPc,EAQtB,CCjTO,SAASsC,IACf,MAAO,CACNC,EACAC,EACAnE,EACAoE,EAEF,CAOO,SAASC,EAAQC,EAAe7D,EAA8B,IAEpE,MAAM8D,EAAa9D,EAAQ+D,gBAAkBP,IAS7C,OANAQ,EAAUH,EAAK,IACX7D,EACH+D,eAAgBD,IAIVG,EAASJ,EACjB,CAKO,SAASK,EACfC,EACAnE,EAA8B,IAE9B,OAAOoE,EAAuBD,EAAM,IAChCnE,EACH+D,eAAgB/D,EAAQ+D,gBAAkBP,KAE5C"}
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@fluxion-ui/compiler-dom",
|
|
3
|
+
"version": "0.0.3",
|
|
4
|
+
"description": "Fluxion compiler for DOM - DOM-specific compilation transforms",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/compiler-dom.cjs",
|
|
7
|
+
"module": "./dist/compiler-dom.js",
|
|
8
|
+
"types": "./dist/compiler-dom.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": "./dist/compiler-dom.js",
|
|
12
|
+
"require": "./dist/compiler-dom.cjs",
|
|
13
|
+
"types": "./dist/compiler-dom.d.ts"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "https://github.com/AiFu-o/fluxion"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [
|
|
24
|
+
"fluxion",
|
|
25
|
+
"compiler",
|
|
26
|
+
"dom"
|
|
27
|
+
],
|
|
28
|
+
"author": "Fluxion Team",
|
|
29
|
+
"license": "MIT",
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@fluxion-ui/compiler-core": "0.0.3",
|
|
32
|
+
"@fluxion-ui/shared": "0.0.3"
|
|
33
|
+
}
|
|
34
|
+
}
|