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

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.
@@ -0,0 +1,224 @@
1
+ /**
2
+ * Vite Plugin: External Dependencies
3
+ * 外部依赖插件 - 在开发模式下将 React/ReactDOM 外部化
4
+ *
5
+ * 用途:
6
+ * - 防止 Vite 将 React/ReactDOM 打包进开发服务器的模块
7
+ * - 强制使用父应用(dashboard)提供的 React 实例
8
+ * - 解决双 React 实例导致的 "Invalid hook call" 错误
9
+ */
10
+
11
+ import type { Plugin } from 'vite'
12
+
13
+ interface ExternalDepsOptions {
14
+ /** 需要外部化的依赖列表 */
15
+ externals?: string[]
16
+ /** 全局变量映射 */
17
+ globals?: Record<string, string>
18
+ }
19
+
20
+ const DEFAULT_EXTERNALS = ['react', 'react-dom', 'react/jsx-runtime']
21
+
22
+ const DEFAULT_GLOBALS: Record<string, string> = {
23
+ react: 'React',
24
+ 'react-dom': 'ReactDOM',
25
+ 'react/jsx-runtime': 'jsxRuntime',
26
+ }
27
+
28
+ /**
29
+ * 创建外部依赖插件
30
+ */
31
+ export function externalDeps(options: ExternalDepsOptions = {}): Plugin {
32
+ const externals = options.externals || DEFAULT_EXTERNALS
33
+ const globals = { ...DEFAULT_GLOBALS, ...options.globals }
34
+
35
+ // 虚拟模块前缀
36
+ const VIRTUAL_PREFIX = '\0virtual:external:'
37
+
38
+ return {
39
+ name: 'vite-plugin-external-deps',
40
+ enforce: 'pre',
41
+
42
+ // 在开发模式下拦截模块解析
43
+ resolveId(id) {
44
+ // 检查是否是需要外部化的依赖
45
+ if (externals.includes(id)) {
46
+ // 返回虚拟模块 ID(\0 前缀告诉 Vite 这是虚拟模块)
47
+ return VIRTUAL_PREFIX + id
48
+ }
49
+ return null
50
+ },
51
+
52
+ // 加载外部模块的代理代码
53
+ load(id) {
54
+ // 检查是否是虚拟外部模块
55
+ if (!id.startsWith(VIRTUAL_PREFIX)) {
56
+ return null
57
+ }
58
+
59
+ const moduleName = id.slice(VIRTUAL_PREFIX.length)
60
+ const globalName = globals[moduleName]
61
+
62
+ if (!globalName) {
63
+ throw new Error(
64
+ `[vite-plugin-external-deps] No global mapping found for "${moduleName}". ` +
65
+ `Please add it to the globals option.`
66
+ )
67
+ }
68
+
69
+ // 对于 react,导出常用的命名导出
70
+ if (moduleName === 'react') {
71
+ return `
72
+ // External module: react -> window.${globalName}
73
+ const React = window.${globalName};
74
+ if (!React) {
75
+ throw new Error(
76
+ 'External dependency "react" (window.${globalName}) is not available. ' +
77
+ 'Make sure the parent application has loaded it globally.'
78
+ );
79
+ }
80
+
81
+ // 导出默认导出
82
+ export default React;
83
+
84
+ // 导出常用的命名导出
85
+ export const {
86
+ useState,
87
+ useEffect,
88
+ useContext,
89
+ useReducer,
90
+ useCallback,
91
+ useMemo,
92
+ useRef,
93
+ useImperativeHandle,
94
+ useLayoutEffect,
95
+ useDebugValue,
96
+ useDeferredValue,
97
+ useTransition,
98
+ useId,
99
+ useSyncExternalStore,
100
+ Fragment,
101
+ StrictMode,
102
+ Suspense,
103
+ createElement,
104
+ createContext,
105
+ forwardRef,
106
+ lazy,
107
+ memo,
108
+ startTransition,
109
+ Component,
110
+ PureComponent,
111
+ Children,
112
+ cloneElement,
113
+ isValidElement,
114
+ } = React;
115
+ `
116
+ }
117
+
118
+ // 对于 react-dom,导出常用的命名导出
119
+ if (moduleName === 'react-dom') {
120
+ return `
121
+ // External module: react-dom -> window.${globalName}
122
+ const ReactDOM = window.${globalName};
123
+ if (!ReactDOM) {
124
+ throw new Error(
125
+ 'External dependency "react-dom" (window.${globalName}) is not available. ' +
126
+ 'Make sure the parent application has loaded it globally.'
127
+ );
128
+ }
129
+
130
+ // 导出默认导出
131
+ export default ReactDOM;
132
+
133
+ // 导出常用的命名导出
134
+ export const {
135
+ createRoot,
136
+ hydrateRoot,
137
+ render,
138
+ hydrate,
139
+ unmountComponentAtNode,
140
+ findDOMNode,
141
+ flushSync,
142
+ } = ReactDOM;
143
+ `
144
+ }
145
+
146
+ // 对于 react/jsx-runtime
147
+ if (moduleName === 'react/jsx-runtime') {
148
+ return `
149
+ // External module: react/jsx-runtime -> window.${globalName}
150
+ const jsxRuntime = window.${globalName};
151
+ if (!jsxRuntime) {
152
+ throw new Error(
153
+ 'External dependency "react/jsx-runtime" (window.${globalName}) is not available. ' +
154
+ 'Make sure the parent application has loaded it globally.'
155
+ );
156
+ }
157
+
158
+ // 导出 JSX 运行时函数
159
+ export const { jsx, jsxs, Fragment } = jsxRuntime;
160
+ export default jsxRuntime;
161
+ `
162
+ }
163
+
164
+ // 对于 @easy-editor/core
165
+ if (moduleName === '@easy-editor/core') {
166
+ return `
167
+ // External module: @easy-editor/core -> window.${globalName}
168
+ const EasyEditorCore = window.${globalName};
169
+ if (!EasyEditorCore) {
170
+ throw new Error(
171
+ 'External dependency "@easy-editor/core" (window.${globalName}) is not available. ' +
172
+ 'Make sure the parent application has loaded it globally.'
173
+ );
174
+ }
175
+
176
+ // 导出整个模块
177
+ export default EasyEditorCore;
178
+ export * from '\0virtual:external:@easy-editor/core:named';
179
+ `
180
+ }
181
+
182
+ // 处理 @easy-editor/core 的命名导出
183
+ if (id === '\0virtual:external:@easy-editor/core:named') {
184
+ return `
185
+ const EasyEditorCore = window.${globals['@easy-editor/core']};
186
+ // 尝试导出所有属性
187
+ const keys = Object.keys(EasyEditorCore || {});
188
+ const exports = {};
189
+ keys.forEach(key => {
190
+ exports[key] = EasyEditorCore[key];
191
+ });
192
+ export default exports;
193
+ `
194
+ }
195
+
196
+ // 默认情况:简单的全局变量代理
197
+ return `
198
+ // External module: ${moduleName} -> window.${globalName}
199
+ const mod = window.${globalName};
200
+ if (!mod) {
201
+ throw new Error(
202
+ 'External dependency "${moduleName}" (window.${globalName}) is not available. ' +
203
+ 'Make sure the parent application has loaded it globally.'
204
+ );
205
+ }
206
+ export default mod;
207
+ `
208
+ },
209
+
210
+ // 配置 Rollup 外部化(用于构建)
211
+ config(config) {
212
+ return {
213
+ build: {
214
+ rollupOptions: {
215
+ external: externals,
216
+ output: {
217
+ globals,
218
+ },
219
+ },
220
+ },
221
+ }
222
+ },
223
+ }
224
+ }
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @easy-editor/materials-dashboard-text
2
2
 
3
+ ## 0.0.12
4
+
5
+ ### Patch Changes
6
+
7
+ - fix: remove category
8
+
9
+ ## 0.0.11
10
+
11
+ ### Patch Changes
12
+
13
+ - feat: new setters
14
+
3
15
  ## 0.0.10
4
16
 
5
17
  ### Patch Changes
@@ -1,40 +1,134 @@
1
- /* @easy-editor/materials-dashboard-text v0.0.9 (component, esm) */
1
+ /* @easy-editor/materials-dashboard-text v0.0.11 (component, esm) */
2
2
  import { jsx } from 'react/jsx-runtime';
3
3
 
4
- const Text = props => {
5
- const {
6
- ref,
7
- text = 'Text',
8
- fontSize = 14,
9
- color = '#ffffff',
10
- fontWeight = 'normal',
11
- textAlign = 'left',
12
- lineHeight = 1.5,
13
- className = '',
14
- style: externalStyle
15
- } = props;
16
- const internalStyle = {
17
- width: '100%',
18
- height: '100%',
19
- fontSize: typeof fontSize === 'number' ? `${fontSize}px` : fontSize,
20
- color,
4
+ 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}
5
+
6
+ function cn(...inputs) {
7
+ return clsx(inputs);
8
+ }
9
+
10
+ function styleInject(css, ref) {
11
+ if (ref === void 0) ref = {};
12
+ var insertAt = ref.insertAt;
13
+ if (typeof document === 'undefined') {
14
+ return;
15
+ }
16
+ var head = document.head || document.getElementsByTagName('head')[0];
17
+ var style = document.createElement('style');
18
+ style.type = 'text/css';
19
+ if (insertAt === 'top') {
20
+ if (head.firstChild) {
21
+ head.insertBefore(style, head.firstChild);
22
+ } else {
23
+ head.appendChild(style);
24
+ }
25
+ } else {
26
+ head.appendChild(style);
27
+ }
28
+ if (style.styleSheet) {
29
+ style.styleSheet.cssText = css;
30
+ } else {
31
+ style.appendChild(document.createTextNode(css));
32
+ }
33
+ }
34
+
35
+ 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}";
36
+ 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"};
37
+ styleInject(css_248z);
38
+
39
+ /**
40
+ * Text Component
41
+ * 文本组件 - 支持普通文本、链接、标题、发光效果
42
+ */
43
+
44
+ const getAlignClass = align => {
45
+ switch (align) {
46
+ case 'left':
47
+ return styles.alignLeft;
48
+ case 'center':
49
+ return styles.alignCenter;
50
+ case 'right':
51
+ return styles.alignRight;
52
+ default:
53
+ return styles.alignLeft;
54
+ }
55
+ };
56
+ const getValignClass = align => {
57
+ switch (align) {
58
+ case 'top':
59
+ return styles.valignTop;
60
+ case 'middle':
61
+ return styles.valignMiddle;
62
+ case 'bottom':
63
+ return styles.valignBottom;
64
+ default:
65
+ return styles.valignMiddle;
66
+ }
67
+ };
68
+ const Text = ({
69
+ ref,
70
+ content = '文本内容',
71
+ fontSize = 16,
72
+ fontWeight = 'normal',
73
+ fontFamily = 'inherit',
74
+ color = '#ffffff',
75
+ textAlign = 'left',
76
+ verticalAlign = 'middle',
77
+ lineHeight = 1.5,
78
+ letterSpacing = 0,
79
+ isLink = false,
80
+ href = '',
81
+ target = '_blank',
82
+ underline = false,
83
+ glowEnable = false,
84
+ glowColor = '#00d4ff',
85
+ glowIntensity = 1,
86
+ style: externalStyle
87
+ }) => {
88
+ // 计算发光效果
89
+ const textShadow = glowEnable ? `0 0 ${10 * glowIntensity}px ${glowColor}, 0 0 ${20 * glowIntensity}px ${glowColor}, 0 0 ${30 * glowIntensity}px ${glowColor}` : undefined;
90
+ const textStyle = {
91
+ fontSize,
21
92
  fontWeight,
22
- textAlign,
93
+ fontFamily,
94
+ color,
23
95
  lineHeight,
24
- wordBreak: 'break-word',
25
- whiteSpace: 'pre-wrap'
26
- };
27
- const mergedStyle = {
28
- ...internalStyle,
29
- ...externalStyle
96
+ letterSpacing,
97
+ textShadow
30
98
  };
99
+ const containerClass = cn(styles.container, getAlignClass(textAlign), getValignClass(verticalAlign));
100
+ const textClass = cn(styles.text, isLink && styles.link, underline && styles.underline);
101
+
102
+ // 链接模式
103
+ if (isLink && href) {
104
+ const relValue = target === '_blank' ? 'noopener noreferrer' : '';
105
+ return /*#__PURE__*/jsx("div", {
106
+ className: containerClass,
107
+ ref: ref,
108
+ style: externalStyle,
109
+ children: /*#__PURE__*/jsx("a", {
110
+ className: textClass,
111
+ href: href,
112
+ rel: relValue,
113
+ style: textStyle,
114
+ target: target,
115
+ children: content
116
+ })
117
+ });
118
+ }
119
+
120
+ // 普通文本
31
121
  return /*#__PURE__*/jsx("div", {
32
- className: className,
122
+ className: containerClass,
33
123
  ref: ref,
34
- style: mergedStyle,
35
- children: text
124
+ style: externalStyle,
125
+ children: /*#__PURE__*/jsx("span", {
126
+ className: textClass,
127
+ style: textStyle,
128
+ children: content
129
+ })
36
130
  });
37
131
  };
38
132
 
39
- export { Text as default };
133
+ export { Text, Text as default };
40
134
  //# sourceMappingURL=component.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"component.esm.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":["Text","props","ref","text","fontSize","color","fontWeight","textAlign","lineHeight","className","style","externalStyle","internalStyle","width","height","wordBreak","whiteSpace","mergedStyle","_jsx","children"],"mappings":";;;AAcA,MAAMA,IAAI,GAAIC,KAAgB,IAAK;EACjC,MAAM;IACJC,GAAG;AACHC,IAAAA,IAAI,GAAG,MAAM;AACbC,IAAAA,QAAQ,GAAG,EAAE;AACbC,IAAAA,KAAK,GAAG,SAAS;AACjBC,IAAAA,UAAU,GAAG,QAAQ;AACrBC,IAAAA,SAAS,GAAG,MAAM;AAClBC,IAAAA,UAAU,GAAG,GAAG;AAChBC,IAAAA,SAAS,GAAG,EAAE;AACdC,IAAAA,KAAK,EAAEC;AACT,GAAC,GAAGV,KAAK;AAET,EAAA,MAAMW,aAA4B,GAAG;AACnCC,IAAAA,KAAK,EAAE,MAAM;AACbC,IAAAA,MAAM,EAAE,MAAM;IACdV,QAAQ,EAAE,OAAOA,QAAQ,KAAK,QAAQ,GAAG,CAAA,EAAGA,QAAQ,CAAA,EAAA,CAAI,GAAGA,QAAQ;IACnEC,KAAK;IACLC,UAAU;IACVC,SAAS;IACTC,UAAU;AACVO,IAAAA,SAAS,EAAE,YAAY;AACvBC,IAAAA,UAAU,EAAE;GACb;AAED,EAAA,MAAMC,WAAW,GAAG;AAAE,IAAA,GAAGL,aAAa;IAAE,GAAGD;GAAe;AAE1D,EAAA,oBACEO,GAAA,CAAA,KAAA,EAAA;AAAKT,IAAAA,SAAS,EAAEA,SAAU;AAACP,IAAAA,GAAG,EAAEA,GAAI;AAACQ,IAAAA,KAAK,EAAEO,WAAY;AAAAE,IAAAA,QAAA,EACrDhB;AAAI,GACF,CAAC;AAEV;;;;"}
1
+ {"version":3,"file":"component.esm.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":["cn","inputs","clsx","styleInject","css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode","getAlignClass","align","styles","alignLeft","alignCenter","alignRight","getValignClass","valignTop","valignMiddle","valignBottom","Text","content","fontSize","fontWeight","fontFamily","color","textAlign","verticalAlign","lineHeight","letterSpacing","isLink","href","target","underline","glowEnable","glowColor","glowIntensity","externalStyle","textShadow","undefined","textStyle","containerClass","container","textClass","text","link","relValue","_jsx","className","children","rel"],"mappings":";;;AAAA,SAAS,CAAC,CAAC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GACJ,CAAC;AAEV;;;;","x_google_ignoreList":[0,2]}
package/dist/component.js CHANGED
@@ -1,45 +1,140 @@
1
- /* @easy-editor/materials-dashboard-text v0.0.9 (component) */
1
+ /* @easy-editor/materials-dashboard-text v0.0.11 (component) */
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react/jsx-runtime')) :
4
4
  typeof define === 'function' && define.amd ? define(['exports', 'react/jsx-runtime'], factory) :
5
5
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.EasyEditorMaterialsTextComponent = {}, global.jsxRuntime));
6
6
  })(this, (function (exports, jsxRuntime) { 'use strict';
7
7
 
8
- const Text = props => {
9
- const {
10
- ref,
11
- text = 'Text',
12
- fontSize = 14,
13
- color = '#ffffff',
14
- fontWeight = 'normal',
15
- textAlign = 'left',
16
- lineHeight = 1.5,
17
- className = '',
18
- style: externalStyle
19
- } = props;
20
- const internalStyle = {
21
- width: '100%',
22
- height: '100%',
23
- fontSize: typeof fontSize === 'number' ? `${fontSize}px` : fontSize,
24
- color,
8
+ 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}
9
+
10
+ function cn(...inputs) {
11
+ return clsx(inputs);
12
+ }
13
+
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
+ }
38
+
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,
25
96
  fontWeight,
26
- textAlign,
97
+ fontFamily,
98
+ color,
27
99
  lineHeight,
28
- wordBreak: 'break-word',
29
- whiteSpace: 'pre-wrap'
30
- };
31
- const mergedStyle = {
32
- ...internalStyle,
33
- ...externalStyle
100
+ letterSpacing,
101
+ textShadow
34
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
+ // 普通文本
35
125
  return /*#__PURE__*/jsxRuntime.jsx("div", {
36
- className: className,
126
+ className: containerClass,
37
127
  ref: ref,
38
- style: mergedStyle,
39
- children: text
128
+ style: externalStyle,
129
+ children: /*#__PURE__*/jsxRuntime.jsx("span", {
130
+ className: textClass,
131
+ style: textStyle,
132
+ children: content
133
+ })
40
134
  });
41
135
  };
42
136
 
137
+ exports.Text = Text;
43
138
  exports.default = Text;
44
139
 
45
140
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -1 +1 @@
1
- {"version":3,"file":"component.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":["Text","props","ref","text","fontSize","color","fontWeight","textAlign","lineHeight","className","style","externalStyle","internalStyle","width","height","wordBreak","whiteSpace","mergedStyle","_jsx","children"],"mappings":";;;;;;;AAcA,QAAMA,IAAI,GAAIC,KAAgB,IAAK;IACjC,MAAM;MACJC,GAAG;EACHC,IAAAA,IAAI,GAAG,MAAM;EACbC,IAAAA,QAAQ,GAAG,EAAE;EACbC,IAAAA,KAAK,GAAG,SAAS;EACjBC,IAAAA,UAAU,GAAG,QAAQ;EACrBC,IAAAA,SAAS,GAAG,MAAM;EAClBC,IAAAA,UAAU,GAAG,GAAG;EAChBC,IAAAA,SAAS,GAAG,EAAE;EACdC,IAAAA,KAAK,EAAEC;EACT,GAAC,GAAGV,KAAK;EAET,EAAA,MAAMW,aAA4B,GAAG;EACnCC,IAAAA,KAAK,EAAE,MAAM;EACbC,IAAAA,MAAM,EAAE,MAAM;MACdV,QAAQ,EAAE,OAAOA,QAAQ,KAAK,QAAQ,GAAG,CAAA,EAAGA,QAAQ,CAAA,EAAA,CAAI,GAAGA,QAAQ;MACnEC,KAAK;MACLC,UAAU;MACVC,SAAS;MACTC,UAAU;EACVO,IAAAA,SAAS,EAAE,YAAY;EACvBC,IAAAA,UAAU,EAAE;KACb;EAED,EAAA,MAAMC,WAAW,GAAG;EAAE,IAAA,GAAGL,aAAa;MAAE,GAAGD;KAAe;EAE1D,EAAA,oBACEO,cAAA,CAAA,KAAA,EAAA;EAAKT,IAAAA,SAAS,EAAEA,SAAU;EAACP,IAAAA,GAAG,EAAEA,GAAI;EAACQ,IAAAA,KAAK,EAAEO,WAAY;EAAAE,IAAAA,QAAA,EACrDhB;EAAI,GACF,CAAC;EAEV;;;;;;;;;;"}
1
+ {"version":3,"file":"component.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":["cn","inputs","clsx","styleInject","css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode","getAlignClass","align","styles","alignLeft","alignCenter","alignRight","getValignClass","valignTop","valignMiddle","valignBottom","Text","content","fontSize","fontWeight","fontFamily","color","textAlign","verticalAlign","lineHeight","letterSpacing","isLink","href","target","underline","glowEnable","glowColor","glowIntensity","externalStyle","textShadow","undefined","textStyle","containerClass","container","textClass","text","link","relValue","_jsx","className","children","rel"],"mappings":";;;;;;;EAAA,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,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