@easy-editor/materials-dashboard-text 0.0.10 → 0.0.11

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.
@@ -1,2 +1,2 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react/jsx-runtime")):"function"==typeof define&&define.amd?define(["exports","react/jsx-runtime"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).EasyEditorMaterialsTextComponent={},e.jsxRuntime)}(this,function(e,t){"use strict";e.default=e=>{const{ref:i,text:n="Text",fontSize:o=14,color:f="#ffffff",fontWeight:r="normal",textAlign:l="left",lineHeight:s=1.5,className:a="",style:d}=e,u={...{width:"100%",height:"100%",fontSize:"number"==typeof o?`${o}px`:o,color:f,fontWeight:r,textAlign:l,lineHeight:s,wordBreak:"break-word",whiteSpace:"pre-wrap"},...d};return t.jsx("div",{className:a,ref:i,style:u,children:n})},Object.defineProperty(e,"__esModule",{value:!0})});
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react/jsx-runtime")):"function"==typeof define&&define.amd?define(["exports","react/jsx-runtime"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).EasyEditorMaterialsTextComponent={},e.jsxRuntime)}(this,function(e,t){"use strict";function n(e){var t,o,i="";if("string"==typeof e||"number"==typeof e)i+=e;else if("object"==typeof e)if(Array.isArray(e)){var l=e.length;for(t=0;t<l;t++)e[t]&&(o=n(e[t]))&&(i&&(i+=" "),i+=o)}else for(o in e)e[o]&&(i&&(i+=" "),i+=o);return i}function o(...e){return function(){for(var e,t,o=0,i="",l=arguments.length;o<l;o++)(e=arguments[o])&&(t=n(e))&&(i&&(i+=" "),i+=t);return i}(e)}var i="component-module__container___VbZSk",l="component-module__text___nFUOn",r="component-module__link___20asF",_="component-module__underline___0oAJz",a="component-module__alignLeft___IOvpO",c="component-module__alignCenter___EIwIC",d="component-module__alignRight___p3ReL",s="component-module__valignTop___-5DmK",m="component-module__valignMiddle___i0are",f="component-module__valignBottom___97zzw";!function(e,t){void 0===t&&(t={});var n=t.insertAt;if("undefined"!=typeof document){var o=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css","top"===n&&o.firstChild?o.insertBefore(i,o.firstChild):o.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}(".component-module__container___VbZSk{display:flex;height:100%;width:100%}.component-module__text___nFUOn{display:inline-block;word-break:break-word}.component-module__link___20asF{cursor:pointer;text-decoration:none;transition:opacity .2s ease}.component-module__link___20asF:hover{opacity:.8}.component-module__underline___0oAJz{text-decoration:underline}.component-module__alignLeft___IOvpO{justify-content:flex-start;text-align:left}.component-module__alignCenter___EIwIC{justify-content:center;text-align:center}.component-module__alignRight___p3ReL{justify-content:flex-end;text-align:right}.component-module__valignTop___-5DmK{align-items:flex-start}.component-module__valignMiddle___i0are{align-items:center}.component-module__valignBottom___97zzw{align-items:flex-end}");const u=({ref:e,content:n="文本内容",fontSize:u=16,fontWeight:p="normal",fontFamily:g="inherit",color:h="#ffffff",textAlign:x="left",verticalAlign:y="middle",lineHeight:v=1.5,letterSpacing:b=0,isLink:j=!1,href:w="",target:k="_blank",underline:C=!1,glowEnable:S=!1,glowColor:T="#00d4ff",glowIntensity:z=1,style:A})=>{const E={fontSize:u,fontWeight:p,fontFamily:g,color:h,lineHeight:v,letterSpacing:b,textShadow:S?`0 0 ${10*z}px ${T}, 0 0 ${20*z}px ${T}, 0 0 ${30*z}px ${T}`:void 0},F=o(i,(e=>{switch(e){case"left":default:return a;case"center":return c;case"right":return d}})(x),(e=>{switch(e){case"top":return s;case"middle":default:return m;case"bottom":return f}})(y)),I=o(l,j&&r,C&&_);if(j&&w){const o="_blank"===k?"noopener noreferrer":"";return t.jsx("div",{className:F,ref:e,style:A,children:t.jsx("a",{className:I,href:w,rel:o,style:E,target:k,children:n})})}return t.jsx("div",{className:F,ref:e,style:A,children:t.jsx("span",{className:I,style:E,children:n})})};e.Text=u,e.default=u,Object.defineProperty(e,"__esModule",{value:!0})});
2
2
  //# sourceMappingURL=component.min.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"component.min.js","sources":["../src/component.tsx"],"sourcesContent":["import type { CSSProperties, Ref } from 'react'\n\ninterface TextProps {\n ref?: Ref<HTMLDivElement>\n text?: string\n fontSize?: number | string\n color?: string\n fontWeight?: string | number\n textAlign?: 'left' | 'center' | 'right' | 'justify'\n lineHeight?: number | string\n className?: string\n style?: CSSProperties\n}\n\nconst Text = (props: TextProps) => {\n const {\n ref,\n text = 'Text',\n fontSize = 14,\n color = '#ffffff',\n fontWeight = 'normal',\n textAlign = 'left',\n lineHeight = 1.5,\n className = '',\n style: externalStyle,\n } = props\n\n const internalStyle: CSSProperties = {\n width: '100%',\n height: '100%',\n fontSize: typeof fontSize === 'number' ? `${fontSize}px` : fontSize,\n color,\n fontWeight,\n textAlign,\n lineHeight,\n wordBreak: 'break-word',\n whiteSpace: 'pre-wrap',\n }\n\n const mergedStyle = { ...internalStyle, ...externalStyle }\n\n return (\n <div className={className} ref={ref} style={mergedStyle}>\n {text}\n </div>\n )\n}\n\nexport default Text\n"],"names":["props","ref","text","fontSize","color","fontWeight","textAlign","lineHeight","className","style","externalStyle","mergedStyle","width","height","wordBreak","whiteSpace","_jsx","children"],"mappings":"iVAccA,IACZ,MAAMC,IACJA,EAAGC,KACHA,EAAO,OAAMC,SACbA,EAAW,GAAEC,MACbA,EAAQ,UAASC,WACjBA,EAAa,SAAQC,UACrBA,EAAY,OAAMC,WAClBA,EAAa,IAAGC,UAChBA,EAAY,GACZC,MAAOC,GACLV,EAcEW,EAAc,IAZiB,CACnCC,MAAO,OACPC,OAAQ,OACRV,SAA8B,iBAAbA,EAAwB,GAAGA,MAAeA,EAC3DC,QACAC,aACAC,YACAC,aACAO,UAAW,aACXC,WAAY,eAG6BL,GAE3C,OACEM,EAAAA,IAAA,MAAA,CAAKR,UAAWA,EAAWP,IAAKA,EAAKQ,MAAOE,EAAYM,SACrDf"}
1
+ {"version":3,"file":"component.min.js","sources":["../../../../../node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs","../../../../shared/src/lib/utils.ts","../../../../../node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.js","../src/component.tsx"],"sourcesContent":["function r(e){var t,f,n=\"\";if(\"string\"==typeof e||\"number\"==typeof e)n+=e;else if(\"object\"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=\" \"),n+=f)}else for(f in e)e[f]&&(n&&(n+=\" \"),n+=f);return n}export function clsx(){for(var e,t,f=0,n=\"\",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=\" \"),n+=t);return n}export default clsx;","import { clsx, type ClassValue } from 'clsx'\n\nexport function cn(...inputs: ClassValue[]) {\n return clsx(inputs)\n}\n","function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n","/**\n * Text Component\n * 文本组件 - 支持普通文本、链接、标题、发光效果\n */\n\nimport type { CSSProperties, Ref } from 'react'\nimport { cn } from '@easy-editor/materials-shared'\nimport styles from './component.module.css'\n\nexport type TextAlign = 'left' | 'center' | 'right'\nexport type VerticalAlign = 'top' | 'middle' | 'bottom'\n\nexport interface TextProps {\n ref?: Ref<HTMLDivElement>\n /** 文本内容 */\n content?: string\n /** 字体大小 */\n fontSize?: number\n /** 字体粗细 */\n fontWeight?: number | 'normal' | 'bold'\n /** 字体家族 */\n fontFamily?: string\n /** 颜色 */\n color?: string\n /** 水平对齐 */\n textAlign?: TextAlign\n /** 垂直对齐 */\n verticalAlign?: VerticalAlign\n /** 行高 */\n lineHeight?: number\n /** 字间距 */\n letterSpacing?: number\n /** 是否为链接 */\n isLink?: boolean\n /** 链接地址 */\n href?: string\n /** 链接打开方式 */\n target?: '_self' | '_blank'\n /** 下划线 */\n underline?: boolean\n /** 发光效果 */\n glowEnable?: boolean\n /** 发光颜色 */\n glowColor?: string\n /** 发光强度 */\n glowIntensity?: number\n /** 显隐控制 */\n condition?: boolean\n /** 外部样式 */\n style?: CSSProperties\n}\n\nconst getAlignClass = (align: TextAlign): string => {\n switch (align) {\n case 'left':\n return styles.alignLeft\n case 'center':\n return styles.alignCenter\n case 'right':\n return styles.alignRight\n default:\n return styles.alignLeft\n }\n}\n\nconst getValignClass = (align: VerticalAlign): string => {\n switch (align) {\n case 'top':\n return styles.valignTop\n case 'middle':\n return styles.valignMiddle\n case 'bottom':\n return styles.valignBottom\n default:\n return styles.valignMiddle\n }\n}\n\nexport const Text: React.FC<TextProps> = ({\n ref,\n content = '文本内容',\n fontSize = 16,\n fontWeight = 'normal',\n fontFamily = 'inherit',\n color = '#ffffff',\n textAlign = 'left',\n verticalAlign = 'middle',\n lineHeight = 1.5,\n letterSpacing = 0,\n isLink = false,\n href = '',\n target = '_blank',\n underline = false,\n glowEnable = false,\n glowColor = '#00d4ff',\n glowIntensity = 1,\n style: externalStyle,\n}) => {\n // 计算发光效果\n const textShadow = glowEnable\n ? `0 0 ${10 * glowIntensity}px ${glowColor}, 0 0 ${20 * glowIntensity}px ${glowColor}, 0 0 ${30 * glowIntensity}px ${glowColor}`\n : undefined\n\n const textStyle: CSSProperties = {\n fontSize,\n fontWeight,\n fontFamily,\n color,\n lineHeight,\n letterSpacing,\n textShadow,\n }\n\n const containerClass = cn(styles.container, getAlignClass(textAlign), getValignClass(verticalAlign))\n\n const textClass = cn(styles.text, isLink && styles.link, underline && styles.underline)\n\n // 链接模式\n if (isLink && href) {\n const relValue = target === '_blank' ? 'noopener noreferrer' : ''\n return (\n <div className={containerClass} ref={ref} style={externalStyle}>\n <a className={textClass} href={href} rel={relValue} style={textStyle} target={target}>\n {content}\n </a>\n </div>\n )\n }\n\n // 普通文本\n return (\n <div className={containerClass} ref={ref} style={externalStyle}>\n <span className={textClass} style={textStyle}>\n {content}\n </span>\n </div>\n )\n}\n\nexport default Text\n"],"names":["r","e","t","f","n","Array","isArray","o","length","cn","inputs","arguments","clsx","css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode","Text","content","fontSize","fontWeight","fontFamily","color","textAlign","verticalAlign","lineHeight","letterSpacing","isLink","href","target","underline","glowEnable","glowColor","glowIntensity","externalStyle","textStyle","textShadow","undefined","containerClass","styles","align","getAlignClass","getValignClass","textClass","relValue","_jsx","className","children","rel"],"mappings":"uUAAA,SAASA,EAAEC,GAAG,IAAIC,EAAEC,EAAEC,EAAE,GAAG,GAAG,iBAAiBH,GAAG,iBAAiBA,EAAEG,GAAGH,OAAO,GAAG,iBAAiBA,EAAE,GAAGI,MAAMC,QAAQL,GAAG,CAAC,IAAIM,EAAEN,EAAEO,OAAO,IAAIN,EAAE,EAAEA,EAAEK,EAAEL,IAAID,EAAEC,KAAKC,EAAEH,EAAEC,EAAEC,OAAOE,IAAIA,GAAG,KAAKA,GAAGD,EAAE,MAAM,IAAIA,KAAKF,EAAEA,EAAEE,KAAKC,IAAIA,GAAG,KAAKA,GAAGD,GAAG,OAAOC,CAAC,CCEzO,SAASK,KAAMC,GACpB,ODHsP,WAAgB,IAAI,IAAIT,EAAEC,EAAEC,EAAE,EAAEC,EAAE,GAAGG,EAAEI,UAAUH,OAAOL,EAAEI,EAAEJ,KAAKF,EAAEU,UAAUR,MAAMD,EAAEF,EAAEC,MAAMG,IAAIA,GAAG,KAAKA,GAAGF,GAAG,OAAOE,CAAC,CCGtWQ,CAAKF,EACd,qZCJA,SAAqBG,EAAKC,QACX,IAARA,IAAiBA,EAAM,CAAA,GAC5B,IAAIC,EAAWD,EAAIC,SAEnB,GAAgC,oBAAbC,SAAnB,CAEA,IAAIC,EAAOD,SAASC,MAAQD,SAASE,qBAAqB,QAAQ,GAC9DC,EAAQH,SAASI,cAAc,SACnCD,EAAME,KAAO,WAEI,QAAbN,GACEE,EAAKK,WACPL,EAAKM,aAAaJ,EAAOF,EAAKK,YAKhCL,EAAKO,YAAYL,GAGfA,EAAMM,WACRN,EAAMM,WAAWC,QAAUb,EAE3BM,EAAMK,YAAYR,SAASW,eAAed,GAnBW,CAqBzD,8wBC2BA,MA0Bae,EAA4BA,EACvCd,MACAe,UAAU,OACVC,WAAW,GACXC,aAAa,SACbC,aAAa,UACbC,QAAQ,UACRC,YAAY,OACZC,gBAAgB,SAChBC,aAAa,IACbC,gBAAgB,EAChBC,UAAS,EACTC,OAAO,GACPC,SAAS,SACTC,aAAY,EACZC,cAAa,EACbC,YAAY,UACZC,gBAAgB,EAChBzB,MAAO0B,MAGP,MAIMC,EAA2B,CAC/BhB,WACAC,aACAC,aACAC,QACAG,aACAC,gBACAU,WAXiBL,EACf,OAAO,GAAKE,OAAmBD,UAAkB,GAAKC,OAAmBD,UAAkB,GAAKC,OAAmBD,SACnHK,GAYEC,EAAiBxC,EAAGyC,EA7DLC,KACrB,OAAQA,GACN,IAAK,OAML,QACE,OAAOD,EALT,IAAK,SACH,OAAOA,EACT,IAAK,QACH,OAAOA,IAsDiCE,CAAclB,GAhDpCiB,KACtB,OAAQA,GACN,IAAK,MACH,OAAOD,EACT,IAAK,SAIL,QACE,OAAOA,EAHT,IAAK,SACH,OAAOA,IAyC2DG,CAAelB,IAE/EmB,EAAY7C,EAAGyC,EAAaZ,GAAUY,EAAaT,GAAaS,GAGtE,GAAIZ,GAAUC,EAAM,CAClB,MAAMgB,EAAsB,WAAXf,EAAsB,sBAAwB,GAC/D,OACEgB,EAAAA,IAAA,MAAA,CAAKC,UAAWR,EAAgBnC,IAAKA,EAAKK,MAAO0B,EAAca,SAC7DF,EAAAA,IAAA,IAAA,CAAGC,UAAWH,EAAWf,KAAMA,EAAMoB,IAAKJ,EAAUpC,MAAO2B,EAAWN,OAAQA,EAAOkB,SAClF7B,KAIT,CAGA,OACE2B,EAAAA,IAAA,MAAA,CAAKC,UAAWR,EAAgBnC,IAAKA,EAAKK,MAAO0B,EAAca,SAC7DF,EAAAA,IAAA,OAAA,CAAMC,UAAWH,EAAWnC,MAAO2B,EAAUY,SAC1C7B","x_google_ignoreList":[0,2]}
package/dist/index.cjs CHANGED
@@ -2,60 +2,161 @@
2
2
 
3
3
  var jsxRuntime = require('react/jsx-runtime');
4
4
 
5
+ function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
6
+
7
+ function cn(...inputs) {
8
+ return clsx(inputs);
9
+ }
10
+
5
11
  const MaterialGroup = {
6
12
  BASIC: 'basic'};
7
13
 
8
- const COMPONENT_NAME = 'EasyEditorMaterialsText';
9
- const PACKAGE_NAME = '@easy-editor/materials-dashboard-text';
14
+ function styleInject(css, ref) {
15
+ if (ref === void 0) ref = {};
16
+ var insertAt = ref.insertAt;
17
+ if (typeof document === 'undefined') {
18
+ return;
19
+ }
20
+ var head = document.head || document.getElementsByTagName('head')[0];
21
+ var style = document.createElement('style');
22
+ style.type = 'text/css';
23
+ if (insertAt === 'top') {
24
+ if (head.firstChild) {
25
+ head.insertBefore(style, head.firstChild);
26
+ } else {
27
+ head.appendChild(style);
28
+ }
29
+ } else {
30
+ head.appendChild(style);
31
+ }
32
+ if (style.styleSheet) {
33
+ style.styleSheet.cssText = css;
34
+ } else {
35
+ style.appendChild(document.createTextNode(css));
36
+ }
37
+ }
10
38
 
11
- const Text = props => {
12
- const {
13
- ref,
14
- text = 'Text',
15
- fontSize = 14,
16
- color = '#ffffff',
17
- fontWeight = 'normal',
18
- textAlign = 'left',
19
- lineHeight = 1.5,
20
- className = '',
21
- style: externalStyle
22
- } = props;
23
- const internalStyle = {
24
- width: '100%',
25
- height: '100%',
26
- fontSize: typeof fontSize === 'number' ? `${fontSize}px` : fontSize,
27
- color,
39
+ var css_248z = ".component-module__container___VbZSk{display:flex;height:100%;width:100%}.component-module__text___nFUOn{display:inline-block;word-break:break-word}.component-module__link___20asF{cursor:pointer;text-decoration:none;transition:opacity .2s ease}.component-module__link___20asF:hover{opacity:.8}.component-module__underline___0oAJz{text-decoration:underline}.component-module__alignLeft___IOvpO{justify-content:flex-start;text-align:left}.component-module__alignCenter___EIwIC{justify-content:center;text-align:center}.component-module__alignRight___p3ReL{justify-content:flex-end;text-align:right}.component-module__valignTop___-5DmK{align-items:flex-start}.component-module__valignMiddle___i0are{align-items:center}.component-module__valignBottom___97zzw{align-items:flex-end}";
40
+ var styles = {"container":"component-module__container___VbZSk","text":"component-module__text___nFUOn","link":"component-module__link___20asF","underline":"component-module__underline___0oAJz","alignLeft":"component-module__alignLeft___IOvpO","alignCenter":"component-module__alignCenter___EIwIC","alignRight":"component-module__alignRight___p3ReL","valignTop":"component-module__valignTop___-5DmK","valignMiddle":"component-module__valignMiddle___i0are","valignBottom":"component-module__valignBottom___97zzw"};
41
+ styleInject(css_248z);
42
+
43
+ /**
44
+ * Text Component
45
+ * 文本组件 - 支持普通文本、链接、标题、发光效果
46
+ */
47
+
48
+ const getAlignClass = align => {
49
+ switch (align) {
50
+ case 'left':
51
+ return styles.alignLeft;
52
+ case 'center':
53
+ return styles.alignCenter;
54
+ case 'right':
55
+ return styles.alignRight;
56
+ default:
57
+ return styles.alignLeft;
58
+ }
59
+ };
60
+ const getValignClass = align => {
61
+ switch (align) {
62
+ case 'top':
63
+ return styles.valignTop;
64
+ case 'middle':
65
+ return styles.valignMiddle;
66
+ case 'bottom':
67
+ return styles.valignBottom;
68
+ default:
69
+ return styles.valignMiddle;
70
+ }
71
+ };
72
+ const Text = ({
73
+ ref,
74
+ content = '文本内容',
75
+ fontSize = 16,
76
+ fontWeight = 'normal',
77
+ fontFamily = 'inherit',
78
+ color = '#ffffff',
79
+ textAlign = 'left',
80
+ verticalAlign = 'middle',
81
+ lineHeight = 1.5,
82
+ letterSpacing = 0,
83
+ isLink = false,
84
+ href = '',
85
+ target = '_blank',
86
+ underline = false,
87
+ glowEnable = false,
88
+ glowColor = '#00d4ff',
89
+ glowIntensity = 1,
90
+ style: externalStyle
91
+ }) => {
92
+ // 计算发光效果
93
+ const textShadow = glowEnable ? `0 0 ${10 * glowIntensity}px ${glowColor}, 0 0 ${20 * glowIntensity}px ${glowColor}, 0 0 ${30 * glowIntensity}px ${glowColor}` : undefined;
94
+ const textStyle = {
95
+ fontSize,
28
96
  fontWeight,
29
- textAlign,
97
+ fontFamily,
98
+ color,
30
99
  lineHeight,
31
- wordBreak: 'break-word',
32
- whiteSpace: 'pre-wrap'
33
- };
34
- const mergedStyle = {
35
- ...internalStyle,
36
- ...externalStyle
100
+ letterSpacing,
101
+ textShadow
37
102
  };
103
+ const containerClass = cn(styles.container, getAlignClass(textAlign), getValignClass(verticalAlign));
104
+ const textClass = cn(styles.text, isLink && styles.link, underline && styles.underline);
105
+
106
+ // 链接模式
107
+ if (isLink && href) {
108
+ const relValue = target === '_blank' ? 'noopener noreferrer' : '';
109
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
110
+ className: containerClass,
111
+ ref: ref,
112
+ style: externalStyle,
113
+ children: /*#__PURE__*/jsxRuntime.jsx("a", {
114
+ className: textClass,
115
+ href: href,
116
+ rel: relValue,
117
+ style: textStyle,
118
+ target: target,
119
+ children: content
120
+ })
121
+ });
122
+ }
123
+
124
+ // 普通文本
38
125
  return /*#__PURE__*/jsxRuntime.jsx("div", {
39
- className: className,
126
+ className: containerClass,
40
127
  ref: ref,
41
- style: mergedStyle,
42
- children: text
128
+ style: externalStyle,
129
+ children: /*#__PURE__*/jsxRuntime.jsx("span", {
130
+ className: textClass,
131
+ style: textStyle,
132
+ children: content
133
+ })
43
134
  });
44
135
  };
45
136
 
46
137
  const configure = {
47
138
  props: [{
48
139
  type: 'group',
49
- title: '功能',
140
+ title: '属性',
50
141
  setter: 'TabSetter',
51
142
  items: [{
52
143
  type: 'group',
53
- key: 'basic',
54
- title: '基本',
55
- items: [{
144
+ key: 'config',
145
+ title: '配置',
146
+ setter: {
147
+ componentName: 'CollapseSetter',
148
+ props: {
149
+ icon: false
150
+ }
151
+ },
152
+ items: [
153
+ {
56
154
  name: 'id',
57
155
  title: 'ID',
58
- setter: 'NodeIdSetter'
156
+ setter: 'NodeIdSetter',
157
+ extraProps: {
158
+ label: false
159
+ }
59
160
  }, {
60
161
  name: 'title',
61
162
  title: '标题',
@@ -90,13 +191,56 @@ const configure = {
90
191
  }
91
192
  }
92
193
  }]
93
- }, {
94
- name: 'text',
95
- title: '文本内容',
96
- setter: 'StringSetter'
194
+ },
195
+ {
196
+ type: 'group',
197
+ title: '内容',
198
+ setter: {
199
+ componentName: 'CollapseSetter',
200
+ props: {
201
+ icon: false
202
+ }
203
+ },
204
+ items: [{
205
+ name: 'content',
206
+ title: '文本内容',
207
+ setter: 'TextAreaSetter',
208
+ extraProps: {
209
+ defaultValue: '文本内容'
210
+ }
211
+ }, {
212
+ name: 'isLink',
213
+ title: '作为链接',
214
+ setter: 'SwitchSetter',
215
+ extraProps: {
216
+ defaultValue: false
217
+ }
218
+ }, {
219
+ name: 'href',
220
+ title: '链接地址',
221
+ setter: 'StringSetter'
222
+ }, {
223
+ name: 'target',
224
+ title: '打开方式',
225
+ setter: {
226
+ componentName: 'SelectSetter',
227
+ props: {
228
+ options: [{
229
+ label: '新窗口',
230
+ value: '_blank'
231
+ }, {
232
+ label: '当前窗口',
233
+ value: '_self'
234
+ }]
235
+ }
236
+ },
237
+ extraProps: {
238
+ defaultValue: '_blank'
239
+ }
240
+ }]
97
241
  }, {
98
242
  type: 'group',
99
- title: '字体样式',
243
+ title: '字体',
100
244
  setter: {
101
245
  componentName: 'CollapseSetter',
102
246
  props: {
@@ -108,14 +252,32 @@ const configure = {
108
252
  title: '字体大小',
109
253
  setter: 'NumberSetter',
110
254
  extraProps: {
111
- defaultValue: 14
255
+ defaultValue: 16
256
+ }
257
+ }, {
258
+ name: 'fontWeight',
259
+ title: '字体粗细',
260
+ setter: {
261
+ componentName: 'SelectSetter',
262
+ props: {
263
+ options: [{
264
+ label: '正常',
265
+ value: 'normal'
266
+ }, {
267
+ label: '粗体',
268
+ value: 'bold'
269
+ }]
270
+ }
271
+ },
272
+ extraProps: {
273
+ defaultValue: 'normal'
112
274
  }
113
275
  }, {
114
276
  name: 'color',
115
- title: '文字颜色',
277
+ title: '颜色',
116
278
  setter: 'ColorSetter',
117
279
  extraProps: {
118
- defaultValue: '#000000'
280
+ defaultValue: '#ffffff'
119
281
  }
120
282
  }, {
121
283
  name: 'lineHeight',
@@ -125,14 +287,9 @@ const configure = {
125
287
  defaultValue: 1.5
126
288
  }
127
289
  }]
128
- }]
129
- }, {
130
- type: 'group',
131
- key: 'advanced',
132
- title: '高级',
133
- items: [{
290
+ }, {
134
291
  type: 'group',
135
- title: '高级设置',
292
+ title: '对齐',
136
293
  setter: {
137
294
  componentName: 'CollapseSetter',
138
295
  props: {
@@ -140,38 +297,121 @@ const configure = {
140
297
  }
141
298
  },
142
299
  items: [{
143
- title: '显隐',
144
- setter: 'SwitchSetter',
300
+ name: 'textAlign',
301
+ title: '水平对齐',
302
+ setter: {
303
+ componentName: 'SegmentedSetter',
304
+ props: {
305
+ options: [{
306
+ label: '左',
307
+ value: 'left'
308
+ }, {
309
+ label: '中',
310
+ value: 'center'
311
+ }, {
312
+ label: '右',
313
+ value: 'right'
314
+ }]
315
+ }
316
+ },
145
317
  extraProps: {
146
- supportVariable: true,
147
- getValue(target) {
148
- return target.getExtraPropValue('condition');
149
- },
150
- setValue(target, value) {
151
- target.setExtraPropValue('condition', value);
318
+ defaultValue: 'left'
319
+ }
320
+ }, {
321
+ name: 'verticalAlign',
322
+ title: '垂直对齐',
323
+ setter: {
324
+ componentName: 'SegmentedSetter',
325
+ props: {
326
+ options: [{
327
+ label: '上',
328
+ value: 'top'
329
+ }, {
330
+ label: '中',
331
+ value: 'middle'
332
+ }, {
333
+ label: '下',
334
+ value: 'bottom'
335
+ }]
152
336
  }
337
+ },
338
+ extraProps: {
339
+ defaultValue: 'middle'
153
340
  }
154
341
  }]
342
+ }, {
343
+ type: 'group',
344
+ title: '效果',
345
+ setter: {
346
+ componentName: 'CollapseSetter',
347
+ props: {
348
+ icon: false
349
+ }
350
+ },
351
+ items: [{
352
+ name: 'underline',
353
+ title: '下划线',
354
+ setter: 'SwitchSetter',
355
+ extraProps: {
356
+ defaultValue: false
357
+ }
358
+ }, {
359
+ name: 'glowEnable',
360
+ title: '发光效果',
361
+ setter: 'SwitchSetter',
362
+ extraProps: {
363
+ defaultValue: false
364
+ }
365
+ }, {
366
+ name: 'glowColor',
367
+ title: '发光颜色',
368
+ setter: 'ColorSetter',
369
+ extraProps: {
370
+ defaultValue: '#00d4ff'
371
+ }
372
+ }]
373
+ }]
374
+ }, {
375
+ type: 'group',
376
+ key: 'data',
377
+ title: '数据',
378
+ items: [{
379
+ name: 'dataBinding',
380
+ title: '数据绑定',
381
+ setter: 'DataBindingSetter'
382
+ }]
383
+ }, {
384
+ type: 'group',
385
+ key: 'advanced',
386
+ title: '高级',
387
+ items: [{
388
+ name: 'condition',
389
+ title: '显隐控制',
390
+ setter: 'SwitchSetter',
391
+ extraProps: {
392
+ defaultValue: true,
393
+ supportVariable: true
394
+ }
155
395
  }]
156
396
  }]
157
397
  }],
158
398
  component: {},
159
399
  supports: {},
160
- advanced: {
161
- view: Text
162
- }
400
+ advanced: {}
163
401
  };
164
402
 
403
+ const COMPONENT_NAME = 'EasyEditorMaterialsText';
404
+ const PACKAGE_NAME = '@easy-editor/materials-dashboard-text';
405
+
165
406
  const snippets = [{
166
- title: 'Text',
167
- screenshot: 'https://img.alicdn.com/imgextra/i3/O1CN01n5wpxc1bi862KuXFz_!!6000000003498-55-tps-50-50.svg',
407
+ title: '普通文本',
408
+ screenshot: '',
168
409
  schema: {
169
410
  componentName: COMPONENT_NAME,
170
411
  props: {
171
- text: 'Text Text Text',
172
- fontSize: 14,
173
- color: '#ffffff',
174
- textAlign: 'left'
412
+ content: '这是一段普通文本',
413
+ fontSize: 16,
414
+ color: '#ffffff'
175
415
  },
176
416
  $dashboard: {
177
417
  rect: {
@@ -181,39 +421,87 @@ const snippets = [{
181
421
  }
182
422
  }
183
423
  }, {
184
- title: 'Heading',
185
- screenshot: 'https://img.alicdn.com/imgextra/i3/O1CN01n5wpxc1bi862KuXFz_!!6000000003498-55-tps-50-50.svg',
424
+ title: '标题文本',
425
+ screenshot: '',
186
426
  schema: {
187
427
  componentName: COMPONENT_NAME,
188
428
  props: {
189
- text: 'Heading',
190
- fontSize: 24,
191
- color: '#ffffff',
429
+ content: '标题文本',
430
+ fontSize: 32,
192
431
  fontWeight: 'bold',
432
+ color: '#ffffff',
193
433
  textAlign: 'center'
194
434
  },
195
435
  $dashboard: {
196
436
  rect: {
197
437
  width: 200,
198
- height: 50
438
+ height: 60
439
+ }
440
+ }
441
+ }
442
+ }, {
443
+ title: '发光标题',
444
+ screenshot: '',
445
+ schema: {
446
+ componentName: COMPONENT_NAME,
447
+ props: {
448
+ content: '发光标题',
449
+ fontSize: 36,
450
+ fontWeight: 'bold',
451
+ color: '#00d4ff',
452
+ textAlign: 'center',
453
+ glowEnable: true,
454
+ glowColor: '#00d4ff',
455
+ glowIntensity: 1.5
456
+ },
457
+ $dashboard: {
458
+ rect: {
459
+ width: 240,
460
+ height: 80
461
+ }
462
+ }
463
+ }
464
+ }, {
465
+ title: '链接文本',
466
+ screenshot: '',
467
+ schema: {
468
+ componentName: COMPONENT_NAME,
469
+ props: {
470
+ content: '点击跳转',
471
+ fontSize: 16,
472
+ color: '#00d4ff',
473
+ isLink: true,
474
+ href: 'https://easy-editor-docs.vercel.app/',
475
+ target: '_blank',
476
+ underline: true
477
+ },
478
+ $dashboard: {
479
+ rect: {
480
+ width: 120,
481
+ height: 40
199
482
  }
200
483
  }
201
484
  }
202
485
  }];
203
486
 
487
+ var version = "0.0.10";
488
+ var pkg = {
489
+ version: version};
490
+
204
491
  const meta = {
205
492
  componentName: COMPONENT_NAME,
206
- title: 'Text',
493
+ title: '文本',
494
+ category: 'dashboard',
207
495
  group: MaterialGroup.BASIC,
208
496
  devMode: 'proCode',
209
497
  npm: {
210
498
  package: PACKAGE_NAME,
211
- version: 'latest',
499
+ version: pkg.version,
212
500
  globalName: COMPONENT_NAME,
213
501
  componentName: COMPONENT_NAME
214
502
  },
215
- snippets,
216
- configure
503
+ configure,
504
+ snippets
217
505
  };
218
506
 
219
507
  exports.component = Text;