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

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,218 @@
1
+ /**
2
+ * Vite Plugin for Material Development
3
+ * 物料开发 Vite 插件 - 提供物料调试所需的 API 和 WebSocket 通知
4
+ */
5
+
6
+ import type { Plugin, ViteDevServer } from 'vite'
7
+ import type { IncomingMessage, ServerResponse } from 'node:http'
8
+ import { WebSocketServer, WebSocket } from 'ws'
9
+
10
+ interface MaterialDevPluginOptions {
11
+ /** 物料入口文件路径 */
12
+ entry?: string
13
+ /** WebSocket 端口(默认与 HTTP 端口相同) */
14
+ wsPort?: number
15
+ }
16
+
17
+ /**
18
+ * 物料开发插件
19
+ * 提供:
20
+ * - /api/health - 健康检查
21
+ * - /api/material - 物料信息
22
+ * - WebSocket 通知 - 文件变更时通知连接的客户端
23
+ */
24
+ export function materialDevPlugin(options: MaterialDevPluginOptions = {}): Plugin {
25
+ const { entry = '/src/index.tsx' } = options
26
+
27
+ let server: ViteDevServer
28
+ let wss: WebSocketServer | null = null
29
+ const clients = new Set<WebSocket>()
30
+
31
+ // 广播消息给所有连接的客户端
32
+ function broadcast(message: object) {
33
+ const data = JSON.stringify(message)
34
+ for (const client of clients) {
35
+ if (client.readyState === WebSocket.OPEN) {
36
+ client.send(data)
37
+ }
38
+ }
39
+ }
40
+
41
+ return {
42
+ name: 'vite-plugin-material-dev',
43
+
44
+ configureServer(_server) {
45
+ server = _server
46
+
47
+ // 创建 WebSocket 服务器,复用 Vite 的 HTTP 服务器
48
+ wss = new WebSocketServer({ noServer: true })
49
+
50
+ // 处理 WebSocket 升级请求
51
+ server.httpServer?.on('upgrade', (request, socket, head) => {
52
+ // 只处理 /ws 路径的 WebSocket 请求,避免与 Vite HMR 冲突
53
+ if (request.url === '/ws' || request.url === '/__material_ws__') {
54
+ wss?.handleUpgrade(request, socket, head, ws => {
55
+ wss?.emit('connection', ws, request)
56
+ })
57
+ }
58
+ })
59
+
60
+ wss.on('connection', ws => {
61
+ console.log('[MaterialDevPlugin] Client connected')
62
+ clients.add(ws)
63
+
64
+ // 发送连接成功消息
65
+ ws.send(
66
+ JSON.stringify({
67
+ type: 'connected',
68
+ message: 'Material dev server connected',
69
+ timestamp: Date.now(),
70
+ }),
71
+ )
72
+
73
+ ws.on('close', () => {
74
+ console.log('[MaterialDevPlugin] Client disconnected')
75
+ clients.delete(ws)
76
+ })
77
+
78
+ ws.on('error', error => {
79
+ console.error('[MaterialDevPlugin] WebSocket error:', error)
80
+ clients.delete(ws)
81
+ })
82
+ })
83
+
84
+ // 处理 CORS 预检请求(需要在其他中间件之前)
85
+ server.middlewares.use((req: IncomingMessage, res: ServerResponse, next: () => void) => {
86
+ if (req.method === 'OPTIONS') {
87
+ res.setHeader('Access-Control-Allow-Origin', '*')
88
+ res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS')
89
+ res.setHeader('Access-Control-Allow-Headers', 'Content-Type')
90
+ res.statusCode = 204
91
+ res.end()
92
+ return
93
+ }
94
+ next()
95
+ })
96
+
97
+ // 健康检查 API
98
+ server.middlewares.use('/api/health', (_req: IncomingMessage, res: ServerResponse) => {
99
+ res.setHeader('Content-Type', 'application/json')
100
+ res.setHeader('Access-Control-Allow-Origin', '*')
101
+ res.end(
102
+ JSON.stringify({
103
+ status: 'ok',
104
+ timestamp: Date.now(),
105
+ server: 'vite',
106
+ wsPath: '/ws',
107
+ }),
108
+ )
109
+ })
110
+
111
+ // 物料信息 API
112
+ server.middlewares.use('/api/material', async (_req: IncomingMessage, res: ServerResponse) => {
113
+ res.setHeader('Content-Type', 'application/json')
114
+ res.setHeader('Access-Control-Allow-Origin', '*')
115
+
116
+ try {
117
+ // 使用 Vite 的 SSR 模块加载能力加载物料模块
118
+ const module = await server.ssrLoadModule(entry)
119
+
120
+ const meta = module.meta || module.default?.meta
121
+ const component = module.component || module.default
122
+
123
+ if (!meta) {
124
+ res.statusCode = 400
125
+ res.end(
126
+ JSON.stringify({
127
+ error: 'Material meta not found. Make sure to export "meta" from the entry file.',
128
+ }),
129
+ )
130
+ return
131
+ }
132
+
133
+ // 返回物料信息
134
+ const materialInfo = {
135
+ // 基本信息
136
+ name: meta.componentName,
137
+ title: meta.title,
138
+ version: meta.npm?.version || '0.0.0-dev',
139
+ group: meta.group,
140
+ category: meta.category,
141
+
142
+ // 入口信息
143
+ entry,
144
+
145
+ // 模块状态
146
+ hasComponent: !!component,
147
+ hasMeta: !!meta,
148
+ hasConfigure: !!meta.configure,
149
+ hasSnippets: Array.isArray(meta.snippets) && meta.snippets.length > 0,
150
+
151
+ // WebSocket 路径
152
+ wsPath: '/ws',
153
+ }
154
+
155
+ res.end(JSON.stringify(materialInfo))
156
+ } catch (error) {
157
+ console.error('[MaterialDevPlugin] Failed to load material:', error)
158
+ res.statusCode = 500
159
+ res.end(
160
+ JSON.stringify({
161
+ error: error instanceof Error ? error.message : String(error),
162
+ }),
163
+ )
164
+ }
165
+ })
166
+
167
+ // 在服务器启动时打印信息
168
+ server.httpServer?.once('listening', () => {
169
+ const address = server.httpServer?.address()
170
+ const port = typeof address === 'object' && address ? address.port : 5001
171
+ const host = server.config.server.host || 'localhost'
172
+
173
+ setTimeout(() => {
174
+ console.log('')
175
+ console.log('\x1b[36m%s\x1b[0m', ' Material Dev Server Ready')
176
+ console.log('')
177
+ console.log(` Health Check: http://${host}:${port}/api/health`)
178
+ console.log(` Material Info: http://${host}:${port}/api/material`)
179
+ console.log(` Module Entry: http://${host}:${port}${entry}`)
180
+ console.log(` WebSocket: ws://${host}:${port}/ws`)
181
+ console.log('')
182
+ console.log('\x1b[33m%s\x1b[0m', ' Connect this URL in EasyEditor to start debugging')
183
+ console.log('')
184
+ }, 100)
185
+ })
186
+ },
187
+
188
+ // 监听 Vite 的 HMR 事件,转发给我们的 WebSocket 客户端
189
+ handleHotUpdate({ file, modules }) {
190
+ console.log(`[MaterialDevPlugin] File changed: ${file}`)
191
+
192
+ // 通知所有连接的客户端
193
+ broadcast({
194
+ type: 'update',
195
+ file,
196
+ timestamp: Date.now(),
197
+ modules: modules.map(m => m.id),
198
+ })
199
+
200
+ // 返回 undefined 让 Vite 继续处理 HMR
201
+ return
202
+ },
203
+
204
+ // 插件关闭时清理
205
+ closeBundle() {
206
+ if (wss) {
207
+ for (const client of clients) {
208
+ client.close()
209
+ }
210
+ clients.clear()
211
+ wss.close()
212
+ wss = null
213
+ }
214
+ },
215
+ }
216
+ }
217
+
218
+ export default materialDevPlugin
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @easy-editor/materials-dashboard-text
2
2
 
3
+ ## 0.0.10
4
+
5
+ ### Patch Changes
6
+
7
+ - fix: configure error
8
+
3
9
  ## 0.0.9
4
10
 
5
11
  ### Patch Changes
@@ -1,4 +1,4 @@
1
- /* @easy-editor/materials-dashboard-text v0.0.8 (component, esm) */
1
+ /* @easy-editor/materials-dashboard-text v0.0.9 (component, esm) */
2
2
  import { jsx } from 'react/jsx-runtime';
3
3
 
4
4
  const Text = props => {
package/dist/component.js CHANGED
@@ -1,4 +1,4 @@
1
- /* @easy-editor/materials-dashboard-text v0.0.8 (component) */
1
+ /* @easy-editor/materials-dashboard-text v0.0.9 (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) :
package/dist/index.cjs CHANGED
@@ -117,51 +117,6 @@ const configure = {
117
117
  extraProps: {
118
118
  defaultValue: '#000000'
119
119
  }
120
- }, {
121
- name: 'fontWeight',
122
- title: '字体粗细',
123
- setter: {
124
- componentName: 'SelectSetter',
125
- props: {
126
- options: [{
127
- label: '正常',
128
- value: 'normal'
129
- }, {
130
- label: '粗体',
131
- value: 'bold'
132
- }, {
133
- label: '100',
134
- value: '100'
135
- }, {
136
- label: '200',
137
- value: '200'
138
- }, {
139
- label: '300',
140
- value: '300'
141
- }, {
142
- label: '400',
143
- value: '400'
144
- }, {
145
- label: '500',
146
- value: '500'
147
- }, {
148
- label: '600',
149
- value: '600'
150
- }, {
151
- label: '700',
152
- value: '700'
153
- }, {
154
- label: '800',
155
- value: '800'
156
- }, {
157
- label: '900',
158
- value: '900'
159
- }]
160
- }
161
- },
162
- extraProps: {
163
- defaultValue: 'normal'
164
- }
165
120
  }, {
166
121
  name: 'lineHeight',
167
122
  title: '行高',
@@ -169,30 +124,6 @@ const configure = {
169
124
  extraProps: {
170
125
  defaultValue: 1.5
171
126
  }
172
- }, {
173
- name: 'textAlign',
174
- title: '文本对齐',
175
- setter: {
176
- componentName: 'RadioGroupSetter',
177
- props: {
178
- options: [{
179
- label: '左对齐',
180
- value: 'left'
181
- }, {
182
- label: '居中',
183
- value: 'center'
184
- }, {
185
- label: '右对齐',
186
- value: 'right'
187
- }, {
188
- label: '两端对齐',
189
- value: 'justify'
190
- }]
191
- }
192
- },
193
- extraProps: {
194
- defaultValue: 'left'
195
- }
196
127
  }]
197
128
  }]
198
129
  }, {
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../../../shared/src/types.ts","../src/constants.ts","../src/component.tsx","../src/configure.ts","../src/snippets.ts","../src/meta.ts"],"sourcesContent":["/**\n * Material Groups\n * 物料分组常量\n */\nexport const MaterialGroup = {\n /** 内置 */\n INNER: 'inner',\n /** 基础 */\n BASIC: 'basic',\n /** 图表 */\n CHART: 'chart',\n /** 数据展示 */\n DATA: 'data',\n /** 交互 */\n INTERACTION: 'interaction',\n} as const\n\n/**\n * Material Group Type\n */\nexport type MaterialGroupType = (typeof MaterialGroup)[keyof typeof MaterialGroup]\n","/**\n * 物料常量配置\n * 统一管理全局变量名等配置,确保 meta.ts 和 rollup.config.js 使用相同的值\n */\n\n/**\n * UMD 全局变量基础名称\n * 用于构建:\n * - 元数据:${GLOBAL_NAME}Meta (例如: EasyEditorMaterialsTextMeta)\n * - 组件:${GLOBAL_NAME}Component (例如: EasyEditorMaterialsTextComponent)\n * - 完整构建:${GLOBAL_NAME} (例如: EasyEditorMaterialsText)\n */\nexport const COMPONENT_NAME = 'EasyEditorMaterialsText'\n\n/**\n * 包名\n */\nexport const PACKAGE_NAME = '@easy-editor/materials-dashboard-text'\n","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","import type { Configure } from '@easy-editor/core'\nimport Text from './component'\n\nconst configure: Configure = {\n props: [\n {\n type: 'group',\n title: '功能',\n setter: 'TabSetter',\n items: [\n {\n type: 'group',\n key: 'basic',\n title: '基本',\n items: [\n {\n name: 'id',\n title: 'ID',\n setter: 'NodeIdSetter',\n },\n {\n name: 'title',\n title: '标题',\n setter: 'StringSetter',\n extraProps: {\n getValue(target) {\n return target.getExtraPropValue('title')\n },\n setValue(target, value) {\n target.setExtraPropValue('title', value)\n },\n },\n },\n {\n type: 'group',\n title: '基础属性',\n setter: {\n componentName: 'CollapseSetter',\n props: {\n icon: false,\n },\n },\n items: [\n {\n name: 'rect',\n title: '位置尺寸',\n setter: 'RectSetter',\n extraProps: {\n getValue(target) {\n return target.getExtraPropValue('$dashboard.rect')\n },\n setValue(target, value) {\n target.setExtraPropValue('$dashboard.rect', value)\n },\n },\n },\n ],\n },\n {\n name: 'text',\n title: '文本内容',\n setter: 'StringSetter',\n },\n {\n type: 'group',\n title: '字体样式',\n setter: {\n componentName: 'CollapseSetter',\n props: {\n icon: false,\n },\n },\n items: [\n {\n name: 'fontSize',\n title: '字体大小',\n setter: 'NumberSetter',\n extraProps: {\n defaultValue: 14,\n },\n },\n {\n name: 'color',\n title: '文字颜色',\n setter: 'ColorSetter',\n extraProps: {\n defaultValue: '#000000',\n },\n },\n {\n name: 'fontWeight',\n title: '字体粗细',\n setter: {\n componentName: 'SelectSetter',\n props: {\n options: [\n { label: '正常', value: 'normal' },\n { label: '粗体', value: 'bold' },\n { label: '100', value: '100' },\n { label: '200', value: '200' },\n { label: '300', value: '300' },\n { label: '400', value: '400' },\n { label: '500', value: '500' },\n { label: '600', value: '600' },\n { label: '700', value: '700' },\n { label: '800', value: '800' },\n { label: '900', value: '900' },\n ],\n },\n },\n extraProps: {\n defaultValue: 'normal',\n },\n },\n {\n name: 'lineHeight',\n title: '行高',\n setter: 'NumberSetter',\n extraProps: {\n defaultValue: 1.5,\n },\n },\n {\n name: 'textAlign',\n title: '文本对齐',\n setter: {\n componentName: 'RadioGroupSetter',\n props: {\n options: [\n { label: '左对齐', value: 'left' },\n { label: '居中', value: 'center' },\n { label: '右对齐', value: 'right' },\n { label: '两端对齐', value: 'justify' },\n ],\n },\n },\n extraProps: {\n defaultValue: 'left',\n },\n },\n ],\n },\n ],\n },\n {\n type: 'group',\n key: 'advanced',\n title: '高级',\n items: [\n {\n type: 'group',\n title: '高级设置',\n setter: {\n componentName: 'CollapseSetter',\n props: {\n icon: false,\n },\n },\n items: [\n {\n title: '显隐',\n setter: 'SwitchSetter',\n extraProps: {\n supportVariable: true,\n getValue(target) {\n return target.getExtraPropValue('condition')\n },\n setValue(target, value: boolean) {\n target.setExtraPropValue('condition', value)\n },\n },\n },\n ],\n },\n ],\n },\n ],\n },\n ],\n component: {},\n supports: {},\n advanced: {\n view: Text,\n },\n}\n\nexport default configure\n","import type { Snippet } from '@easy-editor/core'\nimport { COMPONENT_NAME } from './constants'\n\nconst snippets: Snippet[] = [\n {\n title: 'Text',\n screenshot: 'https://img.alicdn.com/imgextra/i3/O1CN01n5wpxc1bi862KuXFz_!!6000000003498-55-tps-50-50.svg',\n schema: {\n componentName: COMPONENT_NAME,\n props: {\n text: 'Text Text Text',\n fontSize: 14,\n color: '#ffffff',\n textAlign: 'left',\n },\n $dashboard: {\n rect: {\n width: 120,\n height: 40,\n },\n },\n },\n },\n {\n title: 'Heading',\n screenshot: 'https://img.alicdn.com/imgextra/i3/O1CN01n5wpxc1bi862KuXFz_!!6000000003498-55-tps-50-50.svg',\n schema: {\n componentName: COMPONENT_NAME,\n props: {\n text: 'Heading',\n fontSize: 24,\n color: '#ffffff',\n fontWeight: 'bold',\n textAlign: 'center',\n },\n $dashboard: {\n rect: {\n width: 200,\n height: 50,\n },\n },\n },\n },\n]\n\nexport default snippets\n","import type { ComponentMetadata } from '@easy-editor/core'\nimport { MaterialGroup } from '@easy-editor/materials-shared'\nimport { COMPONENT_NAME, PACKAGE_NAME } from './constants'\nimport configure from './configure'\nimport snippets from './snippets'\n\nconst meta: ComponentMetadata = {\n componentName: COMPONENT_NAME,\n title: 'Text',\n group: MaterialGroup.BASIC,\n devMode: 'proCode',\n npm: {\n package: PACKAGE_NAME,\n version: 'latest',\n globalName: COMPONENT_NAME,\n componentName: COMPONENT_NAME,\n },\n snippets,\n configure,\n}\n\nexport default meta\n"],"names":["MaterialGroup","INNER","BASIC","COMPONENT_NAME","PACKAGE_NAME","Text","props","ref","text","fontSize","color","fontWeight","textAlign","lineHeight","className","style","externalStyle","internalStyle","width","height","wordBreak","whiteSpace","mergedStyle","_jsx","children","configure","type","title","setter","items","key","name","extraProps","getValue","target","getExtraPropValue","setValue","value","setExtraPropValue","componentName","icon","defaultValue","options","label","supportVariable","component","supports","advanced","view","snippets","scre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AQ,EAAE,EAAE;AACZC,MAAAA,KAAK,EAAE,SAAS;AAChBE,MAAAA,SAAS,EAAE;KACZ;AACDwC,IAAAA,UAAU,EAAE;AACVC,MAAAA,IAAI,EAAE;AACJnC,QAAAA,KAAK,EAAE,GAAG;AACVC,QAAAA,MAAM,EAAE;AACV;AACF;AACF;AACF,CAAC,EACD;AACEQ,EAAAA,KAAK,EAAE,SAAS;AAChBuB,EAAAA,UAAU,EAAE,6FAA6F;AACzGC,EAAAA,MAAM,EAAE;AACNZ,IAAAA,aAAa,EAAEpC,cAAc;AAC7BG,IAAAA,KAAK,EAAE;AACLE,MAAAA,IAAI,EAAE,SAAS;AACfC,MAAAA,QAAQ,EAAE,EAAE;AACZC,MAAAA,KAAK,EAAE,SAAS;AAChBC,MAAAA,UAAU,EAAE,MAAM;AAClBC,MAAAA,SAAS,EAAE;KACZ;AACDwC,IAAAA,UAAU,EAAE;AACVC,MAAAA,IAAI,EAAE;AACJnC,QAAAA,KAAK,EAAE,GAAG;AACVC,QAAAA,MAAM,EAAE;AACV;AACF;AACF;AACF,CAAC,CACF;;ACrCD,MAAMmC,IAAuB,GAAG;AAC9Bf,EAAAA,aAAa,EAAEpC,cAAc;AAC7BwB,EAAAA,KAAK,EAAE,MAAM;EACb4B,KAAK,EAAEvD,aAAa,CAACE,KAAK;AAC1BsD,EAAAA,OAAO,EAAE,SAAS;AAClBC,EAAAA,GAAG,EAAE;AACHC,IAAAA,OAAO,EAAEtD,YAAY;AACrBuD,IAAAA,OAAO,EAAE,QAAQ;AACjBC,IAAAA,UAAU,EAAEzD,cAAc;AAC1BoC,IAAAA,aAAa,EAAEpC;GAChB;EACD8C,QAAQ;AACRxB,EAAAA;AACF;;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":["../../../shared/src/types.ts","../src/constants.ts","../src/component.tsx","../src/configure.ts","../src/snippets.ts","../src/meta.ts"],"sourcesContent":["/**\n * Material Groups\n * 物料分组常量\n */\nexport const MaterialGroup = {\n /** 内置 */\n INNER: 'inner',\n /** 基础 */\n BASIC: 'basic',\n /** 图表 */\n CHART: 'chart',\n /** 数据展示 */\n DATA: 'data',\n /** 交互 */\n INTERACTION: 'interaction',\n} as const\n\n/**\n * Material Group Type\n */\nexport type MaterialGroupType = (typeof MaterialGroup)[keyof typeof MaterialGroup]\n","/**\n * 物料常量配置\n * 统一管理全局变量名等配置,确保 meta.ts 和 rollup.config.js 使用相同的值\n */\n\n/**\n * UMD 全局变量基础名称\n * 用于构建:\n * - 元数据:${GLOBAL_NAME}Meta (例如: EasyEditorMaterialsTextMeta)\n * - 组件:${GLOBAL_NAME}Component (例如: EasyEditorMaterialsTextComponent)\n * - 完整构建:${GLOBAL_NAME} (例如: EasyEditorMaterialsText)\n */\nexport const COMPONENT_NAME = 'EasyEditorMaterialsText'\n\n/**\n * 包名\n */\nexport const PACKAGE_NAME = '@easy-editor/materials-dashboard-text'\n","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","import type { Configure } from '@easy-editor/core'\nimport Text from './component'\n\nconst configure: Configure = {\n props: [\n {\n type: 'group',\n title: '功能',\n setter: 'TabSetter',\n items: [\n {\n type: 'group',\n key: 'basic',\n title: '基本',\n items: [\n {\n name: 'id',\n title: 'ID',\n setter: 'NodeIdSetter',\n },\n {\n name: 'title',\n title: '标题',\n setter: 'StringSetter',\n extraProps: {\n getValue(target) {\n return target.getExtraPropValue('title')\n },\n setValue(target, value) {\n target.setExtraPropValue('title', value)\n },\n },\n },\n {\n type: 'group',\n title: '基础属性',\n setter: {\n componentName: 'CollapseSetter',\n props: {\n icon: false,\n },\n },\n items: [\n {\n name: 'rect',\n title: '位置尺寸',\n setter: 'RectSetter',\n extraProps: {\n getValue(target) {\n return target.getExtraPropValue('$dashboard.rect')\n },\n setValue(target, value) {\n target.setExtraPropValue('$dashboard.rect', value)\n },\n },\n },\n ],\n },\n {\n name: 'text',\n title: '文本内容',\n setter: 'StringSetter',\n },\n {\n type: 'group',\n title: '字体样式',\n setter: {\n componentName: 'CollapseSetter',\n props: {\n icon: false,\n },\n },\n items: [\n {\n name: 'fontSize',\n title: '字体大小',\n setter: 'NumberSetter',\n extraProps: {\n defaultValue: 14,\n },\n },\n {\n name: 'color',\n title: '文字颜色',\n setter: 'ColorSetter',\n extraProps: {\n defaultValue: '#000000',\n },\n },\n {\n name: 'lineHeight',\n title: '行高',\n setter: 'NumberSetter',\n extraProps: {\n defaultValue: 1.5,\n },\n },\n ],\n },\n ],\n },\n {\n type: 'group',\n key: 'advanced',\n title: '高级',\n items: [\n {\n type: 'group',\n title: '高级设置',\n setter: {\n componentName: 'CollapseSetter',\n props: {\n icon: false,\n },\n },\n items: [\n {\n title: '显隐',\n setter: 'SwitchSetter',\n extraProps: {\n supportVariable: true,\n getValue(target) {\n return target.getExtraPropValue('condition')\n },\n setValue(target, value: boolean) {\n target.setExtraPropValue('condition', value)\n },\n },\n },\n ],\n },\n ],\n },\n ],\n },\n ],\n component: {},\n supports: {},\n advanced: {\n view: Text,\n },\n}\n\nexport default configure\n","import type { Snippet } from '@easy-editor/core'\nimport { COMPONENT_NAME } from './constants'\n\nconst snippets: Snippet[] = [\n {\n title: 'Text',\n screenshot: 'https://img.alicdn.com/imgextra/i3/O1CN01n5wpxc1bi862KuXFz_!!6000000003498-55-tps-50-50.svg',\n schema: {\n componentName: COMPONENT_NAME,\n props: {\n text: 'Text Text Text',\n fontSize: 14,\n color: '#ffffff',\n textAlign: 'left',\n },\n $dashboard: {\n rect: {\n width: 120,\n height: 40,\n },\n },\n },\n },\n {\n title: 'Heading',\n screenshot: 'https://img.alicdn.com/imgextra/i3/O1CN01n5wpxc1bi862KuXFz_!!6000000003498-55-tps-50-50.svg',\n schema: {\n componentName: COMPONENT_NAME,\n props: {\n text: 'Heading',\n fontSize: 24,\n color: '#ffffff',\n fontWeight: 'bold',\n textAlign: 'center',\n },\n $dashboard: {\n rect: {\n width: 200,\n height: 50,\n },\n },\n },\n },\n]\n\nexport default snippets\n","import type { ComponentMetadata } from '@easy-editor/core'\nimport { MaterialGroup } from '@easy-editor/materials-shared'\nimport { COMPONENT_NAME, PACKAGE_NAME } from './constants'\nimport configure from './configure'\nimport snippets from './snippets'\n\nconst meta: ComponentMetadata = {\n componentName: COMPONENT_NAME,\n title: 'Text',\n group: MaterialGroup.BASIC,\n devMode: 'proCode',\n npm: {\n package: PACKAGE_NAME,\n version: 'latest',\n globalName: COMPONENT_NAME,\n componentName: COMPONENT_NAME,\n },\n snippets,\n configure,\n}\n\nexport default meta\n"],"names":["MaterialGroup","INNER","BASIC","COMPONENT_NAME","PACKAGE_NAME","Text","props","ref","text","fontSize","color","fontWeight","textAlign","lineHeight","className","style","externalStyle","internalStyle","width","height","wordBreak","whiteSpace","mergedStyle","_jsx","children","configure","type","title","setter","items","key","name","extraProps","getValue","target","getExtraPropValue","setValue","value","setExtraPropValue","componentName","icon","defaultValue","supportVariable","component","supports","advanced","view","snippets","screenshot","schema","$dashboard","rect","meta","group","devMode","npm","package","version","globalName"],"mappings":";;;;AAIO,MAAMA,aAAa,GAAG;AAE3BC,EAEAC,KAAK,EAAE,OAOT,CAAU;;ACHH,MAAMC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AAG;AACVC,QAAAA,MAAM,EAAE;AACV;AACF;AACF;AACF,CAAC,CACF;;ACrCD,MAAMiC,IAAuB,GAAG;AAC9Bb,EAAAA,aAAa,EAAEpC,cAAc;AAC7BwB,EAAAA,KAAK,EAAE,MAAM;EACb0B,KAAK,EAAErD,aAAa,CAACE,KAAK;AAC1BoD,EAAAA,OAAO,EAAE,SAAS;AAClBC,EAAAA,GAAG,EAAE;AACHC,IAAAA,OAAO,EAAEpD,YAAY;AACrBqD,IAAAA,OAAO,EAAE,QAAQ;AACjBC,IAAAA,UAAU,EAAEvD,cAAc;AAC1BoC,IAAAA,aAAa,EAAEpC;GAChB;EACD4C,QAAQ;AACRtB,EAAAA;AACF;;;;;"}
package/dist/index.esm.js CHANGED
@@ -115,51 +115,6 @@ const configure = {
115
115
  extraProps: {
116
116
  defaultValue: '#000000'
117
117
  }
118
- }, {
119
- name: 'fontWeight',
120
- title: '字体粗细',
121
- setter: {
122
- componentName: 'SelectSetter',
123
- props: {
124
- options: [{
125
- label: '正常',
126
- value: 'normal'
127
- }, {
128
- label: '粗体',
129
- value: 'bold'
130
- }, {
131
- label: '100',
132
- value: '100'
133
- }, {
134
- label: '200',
135
- value: '200'
136
- }, {
137
- label: '300',
138
- value: '300'
139
- }, {
140
- label: '400',
141
- value: '400'
142
- }, {
143
- label: '500',
144
- value: '500'
145
- }, {
146
- label: '600',
147
- value: '600'
148
- }, {
149
- label: '700',
150
- value: '700'
151
- }, {
152
- label: '800',
153
- value: '800'
154
- }, {
155
- label: '900',
156
- value: '900'
157
- }]
158
- }
159
- },
160
- extraProps: {
161
- defaultValue: 'normal'
162
- }
163
118
  }, {
164
119
  name: 'lineHeight',
165
120
  title: '行高',
@@ -167,30 +122,6 @@ const configure = {
167
122
  extraProps: {
168
123
  defaultValue: 1.5
169
124
  }
170
- }, {
171
- name: 'textAlign',
172
- title: '文本对齐',
173
- setter: {
174
- componentName: 'RadioGroupSetter',
175
- props: {
176
- options: [{
177
- label: '左对齐',
178
- value: 'left'
179
- }, {
180
- label: '居中',
181
- value: 'center'
182
- }, {
183
- label: '右对齐',
184
- value: 'right'
185
- }, {
186
- label: '两端对齐',
187
- value: 'justify'
188
- }]
189
- }
190
- },
191
- extraProps: {
192
- defaultValue: 'left'
193
- }
194
125
  }]
195
126
  }]
196
127
  }, {
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":["../../../shared/src/types.ts","../src/constants.ts","../src/component.tsx","../src/configure.ts","../src/snippets.ts","../src/meta.ts"],"sourcesContent":["/**\n * Material Groups\n * 物料分组常量\n */\nexport const MaterialGroup = {\n /** 内置 */\n INNER: 'inner',\n /** 基础 */\n BASIC: 'basic',\n /** 图表 */\n CHART: 'chart',\n /** 数据展示 */\n DATA: 'data',\n /** 交互 */\n INTERACTION: 'interaction',\n} as const\n\n/**\n * Material Group Type\n */\nexport type MaterialGroupType = (typeof MaterialGroup)[keyof typeof MaterialGroup]\n","/**\n * 物料常量配置\n * 统一管理全局变量名等配置,确保 meta.ts 和 rollup.config.js 使用相同的值\n */\n\n/**\n * UMD 全局变量基础名称\n * 用于构建:\n * - 元数据:${GLOBAL_NAME}Meta (例如: EasyEditorMaterialsTextMeta)\n * - 组件:${GLOBAL_NAME}Component (例如: EasyEditorMaterialsTextComponent)\n * - 完整构建:${GLOBAL_NAME} (例如: EasyEditorMaterialsText)\n */\nexport const COMPONENT_NAME = 'EasyEditorMaterialsText'\n\n/**\n * 包名\n */\nexport const PACKAGE_NAME = '@easy-editor/materials-dashboard-text'\n","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","import type { Configure } from '@easy-editor/core'\nimport Text from './component'\n\nconst configure: Configure = {\n props: [\n {\n type: 'group',\n title: '功能',\n setter: 'TabSetter',\n items: [\n {\n type: 'group',\n key: 'basic',\n title: '基本',\n items: [\n {\n name: 'id',\n title: 'ID',\n setter: 'NodeIdSetter',\n },\n {\n name: 'title',\n title: '标题',\n setter: 'StringSetter',\n extraProps: {\n getValue(target) {\n return target.getExtraPropValue('title')\n },\n setValue(target, value) {\n target.setExtraPropValue('title', value)\n },\n },\n },\n {\n type: 'group',\n title: '基础属性',\n setter: {\n componentName: 'CollapseSetter',\n props: {\n icon: false,\n },\n },\n items: [\n {\n name: 'rect',\n title: '位置尺寸',\n setter: 'RectSetter',\n extraProps: {\n getValue(target) {\n return target.getExtraPropValue('$dashboard.rect')\n },\n setValue(target, value) {\n target.setExtraPropValue('$dashboard.rect', value)\n },\n },\n },\n ],\n },\n {\n name: 'text',\n title: '文本内容',\n setter: 'StringSetter',\n },\n {\n type: 'group',\n title: '字体样式',\n setter: {\n componentName: 'CollapseSetter',\n props: {\n icon: false,\n },\n },\n items: [\n {\n name: 'fontSize',\n title: '字体大小',\n setter: 'NumberSetter',\n extraProps: {\n defaultValue: 14,\n },\n },\n {\n name: 'color',\n title: '文字颜色',\n setter: 'ColorSetter',\n extraProps: {\n defaultValue: '#000000',\n },\n },\n {\n name: 'fontWeight',\n title: '字体粗细',\n setter: {\n componentName: 'SelectSetter',\n props: {\n options: [\n { label: '正常', value: 'normal' },\n { label: '粗体', value: 'bold' },\n { label: '100', value: '100' },\n { label: '200', value: '200' },\n { label: '300', value: '300' },\n { label: '400', value: '400' },\n { label: '500', value: '500' },\n { label: '600', value: '600' },\n { label: '700', value: '700' },\n { label: '800', value: '800' },\n { label: '900', value: '900' },\n ],\n },\n },\n extraProps: {\n defaultValue: 'normal',\n },\n },\n {\n name: 'lineHeight',\n title: '行高',\n setter: 'NumberSetter',\n extraProps: {\n defaultValue: 1.5,\n },\n },\n {\n name: 'textAlign',\n title: '文本对齐',\n setter: {\n componentName: 'RadioGroupSetter',\n props: {\n options: [\n { label: '左对齐', value: 'left' },\n { label: '居中', value: 'center' },\n { label: '右对齐', value: 'right' },\n { label: '两端对齐', value: 'justify' },\n ],\n },\n },\n extraProps: {\n defaultValue: 'left',\n },\n },\n ],\n },\n ],\n },\n {\n type: 'group',\n key: 'advanced',\n title: '高级',\n items: [\n {\n type: 'group',\n title: '高级设置',\n setter: {\n componentName: 'CollapseSetter',\n props: {\n icon: false,\n },\n },\n items: [\n {\n title: '显隐',\n setter: 'SwitchSetter',\n extraProps: {\n supportVariable: true,\n getValue(target) {\n return target.getExtraPropValue('condition')\n },\n setValue(target, value: boolean) {\n target.setExtraPropValue('condition', value)\n },\n },\n },\n ],\n },\n ],\n },\n ],\n },\n ],\n component: {},\n supports: {},\n advanced: {\n view: Text,\n },\n}\n\nexport default configure\n","import type { Snippet } from '@easy-editor/core'\nimport { COMPONENT_NAME } from './constants'\n\nconst snippets: Snippet[] = [\n {\n title: 'Text',\n screenshot: 'https://img.alicdn.com/imgextra/i3/O1CN01n5wpxc1bi862KuXFz_!!6000000003498-55-tps-50-50.svg',\n schema: {\n componentName: COMPONENT_NAME,\n props: {\n text: 'Text Text Text',\n fontSize: 14,\n color: '#ffffff',\n textAlign: 'left',\n },\n $dashboard: {\n rect: {\n width: 120,\n height: 40,\n },\n },\n },\n },\n {\n title: 'Heading',\n screenshot: 'https://img.alicdn.com/imgextra/i3/O1CN01n5wpxc1bi862KuXFz_!!6000000003498-55-tps-50-50.svg',\n schema: {\n componentName: COMPONENT_NAME,\n props: {\n text: 'Heading',\n fontSize: 24,\n color: '#ffffff',\n fontWeight: 'bold',\n textAlign: 'center',\n },\n $dashboard: {\n rect: {\n width: 200,\n height: 50,\n },\n },\n },\n },\n]\n\nexport default snippets\n","import type { ComponentMetadata } from '@easy-editor/core'\nimport { MaterialGroup } from '@easy-editor/materials-shared'\nimport { COMPONENT_NAME, PACKAGE_NAME } from './constants'\nimport configure from './configure'\nimport snippets from './snippets'\n\nconst meta: ComponentMetadata = {\n componentName: COMPONENT_NAME,\n title: 'Text',\n group: MaterialGroup.BASIC,\n devMode: 'proCode',\n npm: {\n package: PACKAGE_NAME,\n version: 'latest',\n globalName: COMPONENT_NAME,\n componentName: COMPONENT_NAME,\n },\n snippets,\n configure,\n}\n\nexport default meta\n"],"names":["MaterialGroup","INNER","BASIC","COMPONENT_NAME","PACKAGE_NAME","Text","props","ref","text","fontSize","color","fontWeight","textAlign","lineHeight","className","style","externalStyle","internalStyle","width","height","wordBreak","whiteSpace","mergedStyle","_jsx","children","configure","type","title","setter","items","key","name","extraProps","getValue","target","getExtraPropValue","setValue","value","setExtraPropValue","componentName","icon","defaultValue","options","label","supportVariable","component","supports","advanced","view","snippets","screenshot","schema","$dashboard","rect","meta","group","devMode","npm","package","version","globalName"],"mappings":";;AAIO,MAAMA,aAAa,GAAG;AAE3BC,EAEAC,KAAK,EAAE,OAOT,CAAU;;ACHH,MAAMC,cAAc,GAAG,yBAAyB;AAKhD,MAAMC,YAAY,GAAG,uCAAuC;;ACHnE,MAAMC,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,GAA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AChBC,MAAAA,UAAU,EAAE,MAAM;AAClBC,MAAAA,SAAS,EAAE;KACZ;AACDwC,IAAAA,UAAU,EAAE;AACVC,MAAAA,IAAI,EAAE;AACJnC,QAAAA,KAAK,EAAE,GAAG;AACVC,QAAAA,MAAM,EAAE;AACV;AACF;AACF;AACF,CAAC,CACF;;ACrCD,MAAMmC,IAAuB,GAAG;AAC9Bf,EAAAA,aAAa,EAAEpC,cAAc;AAC7BwB,EAAAA,KAAK,EAAE,MAAM;EACb4B,KAAK,EAAEvD,aAAa,CAACE,KAAK;AAC1BsD,EAAAA,OAAO,EAAE,SAAS;AAClBC,EAAAA,GAAG,EAAE;AACHC,IAAAA,OAAO,EAAEtD,YAAY;AACrBuD,IAAAA,OAAO,EAAE,QAAQ;AACjBC,IAAAA,UAAU,EAAEzD,cAAc;AAC1BoC,IAAAA,aAAa,EAAEpC;GAChB;EACD8C,QAAQ;AACRxB,EAAAA;AACF;;;;"}
1
+ {"version":3,"file":"index.esm.js","sources":["../../../shared/src/types.ts","../src/constants.ts","../src/component.tsx","../src/configure.ts","../src/snippets.ts","../src/meta.ts"],"sourcesContent":["/**\n * Material Groups\n * 物料分组常量\n */\nexport const MaterialGroup = {\n /** 内置 */\n INNER: 'inner',\n /** 基础 */\n BASIC: 'basic',\n /** 图表 */\n CHART: 'chart',\n /** 数据展示 */\n DATA: 'data',\n /** 交互 */\n INTERACTION: 'interaction',\n} as const\n\n/**\n * Material Group Type\n */\nexport type MaterialGroupType = (typeof MaterialGroup)[keyof typeof MaterialGroup]\n","/**\n * 物料常量配置\n * 统一管理全局变量名等配置,确保 meta.ts 和 rollup.config.js 使用相同的值\n */\n\n/**\n * UMD 全局变量基础名称\n * 用于构建:\n * - 元数据:${GLOBAL_NAME}Meta (例如: EasyEditorMaterialsTextMeta)\n * - 组件:${GLOBAL_NAME}Component (例如: EasyEditorMaterialsTextComponent)\n * - 完整构建:${GLOBAL_NAME} (例如: EasyEditorMaterialsText)\n */\nexport const COMPONENT_NAME = 'EasyEditorMaterialsText'\n\n/**\n * 包名\n */\nexport const PACKAGE_NAME = '@easy-editor/materials-dashboard-text'\n","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","import type { Configure } from '@easy-editor/core'\nimport Text from './component'\n\nconst configure: Configure = {\n props: [\n {\n type: 'group',\n title: '功能',\n setter: 'TabSetter',\n items: [\n {\n type: 'group',\n key: 'basic',\n title: '基本',\n items: [\n {\n name: 'id',\n title: 'ID',\n setter: 'NodeIdSetter',\n },\n {\n name: 'title',\n title: '标题',\n setter: 'StringSetter',\n extraProps: {\n getValue(target) {\n return target.getExtraPropValue('title')\n },\n setValue(target, value) {\n target.setExtraPropValue('title', value)\n },\n },\n },\n {\n type: 'group',\n title: '基础属性',\n setter: {\n componentName: 'CollapseSetter',\n props: {\n icon: false,\n },\n },\n items: [\n {\n name: 'rect',\n title: '位置尺寸',\n setter: 'RectSetter',\n extraProps: {\n getValue(target) {\n return target.getExtraPropValue('$dashboard.rect')\n },\n setValue(target, value) {\n target.setExtraPropValue('$dashboard.rect', value)\n },\n },\n },\n ],\n },\n {\n name: 'text',\n title: '文本内容',\n setter: 'StringSetter',\n },\n {\n type: 'group',\n title: '字体样式',\n setter: {\n componentName: 'CollapseSetter',\n props: {\n icon: false,\n },\n },\n items: [\n {\n name: 'fontSize',\n title: '字体大小',\n setter: 'NumberSetter',\n extraProps: {\n defaultValue: 14,\n },\n },\n {\n name: 'color',\n title: '文字颜色',\n setter: 'ColorSetter',\n extraProps: {\n defaultValue: '#000000',\n },\n },\n {\n name: 'lineHeight',\n title: '行高',\n setter: 'NumberSetter',\n extraProps: {\n defaultValue: 1.5,\n },\n },\n ],\n },\n ],\n },\n {\n type: 'group',\n key: 'advanced',\n title: '高级',\n items: [\n {\n type: 'group',\n title: '高级设置',\n setter: {\n componentName: 'CollapseSetter',\n props: {\n icon: false,\n },\n },\n items: [\n {\n title: '显隐',\n setter: 'SwitchSetter',\n extraProps: {\n supportVariable: true,\n getValue(target) {\n return target.getExtraPropValue('condition')\n },\n setValue(target, value: boolean) {\n target.setExtraPropValue('condition', value)\n },\n },\n },\n ],\n },\n ],\n },\n ],\n },\n ],\n component: {},\n supports: {},\n advanced: {\n view: Text,\n },\n}\n\nexport default configure\n","import type { Snippet } from '@easy-editor/core'\nimport { COMPONENT_NAME } from './constants'\n\nconst snippets: Snippet[] = [\n {\n title: 'Text',\n screenshot: 'https://img.alicdn.com/imgextra/i3/O1CN01n5wpxc1bi862KuXFz_!!6000000003498-55-tps-50-50.svg',\n schema: {\n componentName: COMPONENT_NAME,\n props: {\n text: 'Text Text Text',\n fontSize: 14,\n color: '#ffffff',\n textAlign: 'left',\n },\n $dashboard: {\n rect: {\n width: 120,\n height: 40,\n },\n },\n },\n },\n {\n title: 'Heading',\n screenshot: 'https://img.alicdn.com/imgextra/i3/O1CN01n5wpxc1bi862KuXFz_!!6000000003498-55-tps-50-50.svg',\n schema: {\n componentName: COMPONENT_NAME,\n props: {\n text: 'Heading',\n fontSize: 24,\n color: '#ffffff',\n fontWeight: 'bold',\n textAlign: 'center',\n },\n $dashboard: {\n rect: {\n width: 200,\n height: 50,\n },\n },\n },\n },\n]\n\nexport default snippets\n","import type { ComponentMetadata } from '@easy-editor/core'\nimport { MaterialGroup } from '@easy-editor/materials-shared'\nimport { COMPONENT_NAME, PACKAGE_NAME } from './constants'\nimport configure from './configure'\nimport snippets from './snippets'\n\nconst meta: ComponentMetadata = {\n componentName: COMPONENT_NAME,\n title: 'Text',\n group: MaterialGroup.BASIC,\n devMode: 'proCode',\n npm: {\n package: PACKAGE_NAME,\n version: 'latest',\n globalName: COMPONENT_NAME,\n componentName: COMPONENT_NAME,\n },\n snippets,\n configure,\n}\n\nexport default meta\n"],"names":["MaterialGroup","INNER","BASIC","COMPONENT_NAME","PACKAGE_NAME","Text","props","ref","text","fontSize","color","fontWeight","textAlign","lineHeight","className","style","externalStyle","internalStyle","width","height","wordBreak","whiteSpace","mergedStyle","_jsx","children","configure","type","title","setter","items","key","name","extraProps","getValue","target","getExtraPropValue","setValue","value","setExtraPropValue","componentName","icon","defaultValue","supportVariable","component","supports","advanced","view","snippets","screenshot","schema","$dashboard","rect","meta","group","devMode","npm","package","version","globalName"],"mappings":";;AAIO,MAAMA,aAAa,GAAG;AAE3BC,EAEAC,KAAK,EAAE,OAOT,CAAU;;ACHH,MAAMC,cAAc,GAAG,yBAAyB;AAKhD,MAAMC,YAAY,GAAG,uCAAuC;;ACHnE,MAAMC,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,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@@
1
- /* @easy-editor/materials-dashboard-text v0.0.8 */
1
+ /* @easy-editor/materials-dashboard-text v0.0.9 */
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) :
@@ -120,51 +120,6 @@
120
120
  extraProps: {
121
121
  defaultValue: '#000000'
122
122
  }
123
- }, {
124
- name: 'fontWeight',
125
- title: '字体粗细',
126
- setter: {
127
- componentName: 'SelectSetter',
128
- props: {
129
- options: [{
130
- label: '正常',
131
- value: 'normal'
132
- }, {
133
- label: '粗体',
134
- value: 'bold'
135
- }, {
136
- label: '100',
137
- value: '100'
138
- }, {
139
- label: '200',
140
- value: '200'
141
- }, {
142
- label: '300',
143
- value: '300'
144
- }, {
145
- label: '400',
146
- value: '400'
147
- }, {
148
- label: '500',
149
- value: '500'
150
- }, {
151
- label: '600',
152
- value: '600'
153
- }, {
154
- label: '700',
155
- value: '700'
156
- }, {
157
- label: '800',
158
- value: '800'
159
- }, {
160
- label: '900',
161
- value: '900'
162
- }]
163
- }
164
- },
165
- extraProps: {
166
- defaultValue: 'normal'
167
- }
168
123
  }, {
169
124
  name: 'lineHeight',
170
125
  title: '行高',
@@ -172,30 +127,6 @@
172
127
  extraProps: {
173
128
  defaultValue: 1.5
174
129
  }
175
- }, {
176
- name: 'textAlign',
177
- title: '文本对齐',
178
- setter: {
179
- componentName: 'RadioGroupSetter',
180
- props: {
181
- options: [{
182
- label: '左对齐',
183
- value: 'left'
184
- }, {
185
- label: '居中',
186
- value: 'center'
187
- }, {
188
- label: '右对齐',
189
- value: 'right'
190
- }, {
191
- label: '两端对齐',
192
- value: 'justify'
193
- }]
194
- }
195
- },
196
- extraProps: {
197
- defaultValue: 'left'
198
- }
199
130
  }]
200
131
  }]
201
132
  }, {