@fangzhongya/page 0.0.24 → 0.0.25

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.
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const vue = require("vue");
4
4
  const lineToLargeHump = require("@fangzhongya/utils/name/lineToLargeHump");
5
+ const shared = require("../utils/shared.cjs");
5
6
  const humpToLine = require("@fangzhongya/utils/name/humpToLine");
6
7
  const isObject = require("@fangzhongya/utils/basic/object/isObject");
7
8
  const render = require("../utils/render.cjs");
@@ -28,20 +29,18 @@ function setComponString(name, attarObj, obj = {}, compons = {}) {
28
29
  if (name === "Template") {
29
30
  return vue.h(vue.Fragment, null, setSlots(obj).default?.());
30
31
  }
31
- const rs = vue.resolveComponent(name);
32
- if (typeof rs === "string") {
33
- compons = vue.inject("components", compons);
34
- const tcom = humpToLine.humpToLine(name);
35
- const cms = Object.keys(compons);
36
- if (cms.includes(name)) {
37
- return vue.h(compons[name], attarObj, setSlots(obj));
38
- } else if (cms.includes(tcom)) {
39
- return vue.h(compons[tcom], attarObj, setSlots(obj));
40
- }
32
+ compons = vue.inject("components", compons);
33
+ const tcom = humpToLine.humpToLine(name);
34
+ const cms = Object.keys(compons);
35
+ if (cms.includes(name)) {
36
+ return vue.h(compons[name], attarObj, setSlots(obj));
37
+ } else if (cms.includes(tcom)) {
38
+ return vue.h(compons[tcom], attarObj, setSlots(obj));
39
+ }
40
+ if (shared.isHTMLTag(tcom) || shared.isSVGTag(tcom)) {
41
41
  return vue.h(tcom, attarObj, setSlots(obj).default?.());
42
- } else {
43
- return vue.h(rs, attarObj, setSlots(obj));
44
42
  }
43
+ return vue.h(vue.resolveComponent(name), attarObj, setSlots(obj));
45
44
  }
46
45
  function useGetCompon(name, attarObj, obj = {}, compons) {
47
46
  if (typeof name == "string") {
@@ -1,5 +1,6 @@
1
- import { isVNode, h, Fragment, resolveComponent, inject } from "vue";
1
+ import { isVNode, h, Fragment, inject, resolveComponent } from "vue";
2
2
  import { lineToLargeHump } from "@fangzhongya/utils/name/lineToLargeHump";
3
+ import { isHTMLTag, isSVGTag } from "../utils/shared.js";
3
4
  import { humpToLine } from "@fangzhongya/utils/name/humpToLine";
4
5
  import { isObject } from "@fangzhongya/utils/basic/object/isObject";
5
6
  import { getRenderSlots, getClassId } from "../utils/render.js";
@@ -26,20 +27,18 @@ function setComponString(name, attarObj, obj = {}, compons = {}) {
26
27
  if (name === "Template") {
27
28
  return h(Fragment, null, setSlots(obj).default?.());
28
29
  }
29
- const rs = resolveComponent(name);
30
- if (typeof rs === "string") {
31
- compons = inject("components", compons);
32
- const tcom = humpToLine(name);
33
- const cms = Object.keys(compons);
34
- if (cms.includes(name)) {
35
- return h(compons[name], attarObj, setSlots(obj));
36
- } else if (cms.includes(tcom)) {
37
- return h(compons[tcom], attarObj, setSlots(obj));
38
- }
30
+ compons = inject("components", compons);
31
+ const tcom = humpToLine(name);
32
+ const cms = Object.keys(compons);
33
+ if (cms.includes(name)) {
34
+ return h(compons[name], attarObj, setSlots(obj));
35
+ } else if (cms.includes(tcom)) {
36
+ return h(compons[tcom], attarObj, setSlots(obj));
37
+ }
38
+ if (isHTMLTag(tcom) || isSVGTag(tcom)) {
39
39
  return h(tcom, attarObj, setSlots(obj).default?.());
40
- } else {
41
- return h(rs, attarObj, setSlots(obj));
42
40
  }
41
+ return h(resolveComponent(name), attarObj, setSlots(obj));
43
42
  }
44
43
  function useGetCompon(name, attarObj, obj = {}, compons) {
45
44
  if (typeof name == "string") {
@@ -26,7 +26,7 @@ function createRender(obj, imports = {}, callback = (id) => id, components = {})
26
26
  props,
27
27
  emits: obj.emits || [],
28
28
  expose: obj.expose || [],
29
- components: coms,
29
+ // components: coms,
30
30
  setup(prs, ctx) {
31
31
  vue.provide("components", coms);
32
32
  const temps = [];
@@ -24,7 +24,7 @@ function createRender(obj, imports = {}, callback = (id) => id, components = {})
24
24
  props,
25
25
  emits: obj.emits || [],
26
26
  expose: obj.expose || [],
27
- components: coms,
27
+ // components: coms,
28
28
  setup(prs, ctx) {
29
29
  provide("components", coms);
30
30
  const temps = [];
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ function makeMap(str) {
4
+ const map = /* @__PURE__ */ Object.create(null);
5
+ for (const key of str.split(",")) map[key] = 1;
6
+ return (val) => val in map;
7
+ }
8
+ const HTML_TAGS = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,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,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";
9
+ const SVG_TAGS = "svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,defs,desc,discard,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,hatch,hatchpath,image,line,linearGradient,marker,mask,mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,text,textPath,title,tspan,unknown,use,view";
10
+ const MATH_TAGS = "annotation,annotation-xml,maction,maligngroup,malignmark,math,menclose,merror,mfenced,mfrac,mfraction,mglyph,mi,mlabeledtr,mlongdiv,mmultiscripts,mn,mo,mover,mpadded,mphantom,mprescripts,mroot,mrow,ms,mscarries,mscarry,msgroup,msline,mspace,msqrt,msrow,mstack,mstyle,msub,msubsup,msup,mtable,mtd,mtext,mtr,munder,munderover,none,semantics";
11
+ const VOID_TAGS = "area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr";
12
+ const isHTMLTag = makeMap(HTML_TAGS);
13
+ const isSVGTag = makeMap(SVG_TAGS);
14
+ const isMathMLTag = makeMap(MATH_TAGS);
15
+ const isVoidTag = makeMap(VOID_TAGS);
16
+ exports.isHTMLTag = isHTMLTag;
17
+ exports.isMathMLTag = isMathMLTag;
18
+ exports.isSVGTag = isSVGTag;
19
+ exports.isVoidTag = isVoidTag;
@@ -0,0 +1,19 @@
1
+ function makeMap(str) {
2
+ const map = /* @__PURE__ */ Object.create(null);
3
+ for (const key of str.split(",")) map[key] = 1;
4
+ return (val) => val in map;
5
+ }
6
+ const HTML_TAGS = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,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,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";
7
+ const SVG_TAGS = "svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,defs,desc,discard,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,hatch,hatchpath,image,line,linearGradient,marker,mask,mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,text,textPath,title,tspan,unknown,use,view";
8
+ const MATH_TAGS = "annotation,annotation-xml,maction,maligngroup,malignmark,math,menclose,merror,mfenced,mfrac,mfraction,mglyph,mi,mlabeledtr,mlongdiv,mmultiscripts,mn,mo,mover,mpadded,mphantom,mprescripts,mroot,mrow,ms,mscarries,mscarry,msgroup,msline,mspace,msqrt,msrow,mstack,mstyle,msub,msubsup,msup,mtable,mtd,mtext,mtr,munder,munderover,none,semantics";
9
+ const VOID_TAGS = "area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr";
10
+ const isHTMLTag = makeMap(HTML_TAGS);
11
+ const isSVGTag = makeMap(SVG_TAGS);
12
+ const isMathMLTag = makeMap(MATH_TAGS);
13
+ const isVoidTag = makeMap(VOID_TAGS);
14
+ export {
15
+ isHTMLTag,
16
+ isMathMLTag,
17
+ isSVGTag,
18
+ isVoidTag
19
+ };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@fangzhongya/page",
3
3
  "private": false,
4
4
  "type": "module",
5
- "version": "0.0.24",
5
+ "version": "0.0.25",
6
6
  "description ": "个人组件设计",
7
7
  "author": "fangzhongya ",
8
8
  "license": "MIT",