@easy-editor/materials-dashboard-image 0.0.2

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.
Files changed (45) hide show
  1. package/.vite/plugins/vite-plugin-external-deps.ts +224 -0
  2. package/.vite/plugins/vite-plugin-material-dev.ts +218 -0
  3. package/CHANGELOG.md +7 -0
  4. package/LICENSE +9 -0
  5. package/dist/component.esm.js +105 -0
  6. package/dist/component.esm.js.map +1 -0
  7. package/dist/component.js +114 -0
  8. package/dist/component.js.map +1 -0
  9. package/dist/component.min.js +2 -0
  10. package/dist/component.min.js.map +1 -0
  11. package/dist/index.cjs +427 -0
  12. package/dist/index.cjs.map +1 -0
  13. package/dist/index.esm.js +424 -0
  14. package/dist/index.esm.js.map +1 -0
  15. package/dist/index.js +432 -0
  16. package/dist/index.js.map +1 -0
  17. package/dist/index.min.js +2 -0
  18. package/dist/index.min.js.map +1 -0
  19. package/dist/meta.esm.js +323 -0
  20. package/dist/meta.esm.js.map +1 -0
  21. package/dist/meta.js +334 -0
  22. package/dist/meta.js.map +1 -0
  23. package/dist/meta.min.js +2 -0
  24. package/dist/meta.min.js.map +1 -0
  25. package/dist/src/component.d.ts +31 -0
  26. package/dist/src/configure.d.ts +7 -0
  27. package/dist/src/constants.d.ts +16 -0
  28. package/dist/src/index.d.ts +6 -0
  29. package/dist/src/meta.d.ts +7 -0
  30. package/dist/src/snippets.d.ts +7 -0
  31. package/package.json +67 -0
  32. package/rollup.config.js +222 -0
  33. package/src/assets/default.png +0 -0
  34. package/src/component.module.css +122 -0
  35. package/src/component.tsx +99 -0
  36. package/src/configure.ts +285 -0
  37. package/src/constants.ts +18 -0
  38. package/src/index.tsx +7 -0
  39. package/src/meta.ts +28 -0
  40. package/src/snippets.ts +49 -0
  41. package/src/type.d.ts +13 -0
  42. package/tsconfig.build.json +12 -0
  43. package/tsconfig.json +9 -0
  44. package/tsconfig.test.json +7 -0
  45. package/vite.config.ts +54 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"meta.js","sources":["../../../../shared/src/index.ts","../src/constants.ts","../src/configure.ts","../src/snippets.ts","../src/meta.ts"],"sourcesContent":["/**\n * Shared types, components and utilities for EasyEditor materials\n * @package @easy-editor/materials-shared\n */\n\n// 物料分组常量\nexport const MaterialGroup = {\n /** 内置 */\n INNER: 'inner',\n /** 基础 */\n BASIC: 'basic',\n /** 图表 */\n CHART: 'chart',\n /** 数据展示 */\n DISPLAY: 'display',\n /** 媒体 */\n MEDIA: 'media',\n /** 交互 */\n INTERACTION: 'interaction',\n /** 地图 */\n MAP: 'map',\n} as const\n\nexport type MaterialGroup = (typeof MaterialGroup)[keyof typeof MaterialGroup]\n\n// 工具函数\nexport { cn } from './lib/utils'\n\nexport * from './types'\n","/**\n * 物料常量配置\n * 统一管理全局变量名等配置,确保 meta.ts 和 rollup.config.js 使用相同的值\n */\n\n/**\n * UMD 全局变量基础名称\n * 用于构建:\n * - 元数据:${GLOBAL_NAME}Meta (例如: EasyEditorMaterialsImageMeta)\n * - 组件:${GLOBAL_NAME}Component (例如: EasyEditorMaterialsImageComponent)\n * - 完整构建:${GLOBAL_NAME} (例如: EasyEditorMaterialsImage)\n */\nexport const COMPONENT_NAME = 'EasyEditorMaterialsImage'\n\n/**\n * 包名\n */\nexport const PACKAGE_NAME = '@easy-editor/materials-dashboard-image'\n","/**\n * Image Configure\n * 图片组件配置\n */\n\nimport type { Configure } from '@easy-editor/core'\nimport type { UploadValue } from '@easy-editor/materials-shared'\n\nexport const configure: Configure = {\n props: [\n {\n type: 'group',\n title: '属性',\n setter: 'TabSetter',\n items: [\n {\n type: 'group',\n key: 'config',\n title: '配置',\n setter: {\n componentName: 'CollapseSetter',\n props: {\n icon: false,\n },\n },\n items: [\n // 基础配置\n {\n name: 'id',\n title: 'ID',\n setter: 'NodeIdSetter',\n extraProps: {\n // @ts-expect-error label is not a valid extra prop\n label: false,\n },\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 {\n type: 'group',\n title: '内容',\n setter: {\n componentName: 'CollapseSetter',\n props: {\n icon: false,\n },\n },\n items: [\n {\n name: '__upload',\n title: '上传',\n setter: {\n componentName: 'UploadSetter',\n props: {\n accept: '.jpg,.jpeg,.png,.gif,.svg',\n },\n },\n extraProps: {\n setValue(target, value: UploadValue) {\n if (value) {\n const { base64, raw } = value\n if (base64) {\n target.parent.setPropValue('src', base64)\n }\n if (raw?.width) {\n target.parent.setExtraPropValue('$dashboard.rect.width', raw.width)\n }\n if (raw?.height) {\n target.parent.setExtraPropValue('$dashboard.rect.height', raw.height)\n }\n } else {\n target.parent.clearPropValue('src')\n }\n },\n },\n },\n {\n name: 'src',\n title: '图片地址',\n setter: 'StringSetter',\n },\n {\n name: 'alt',\n title: '替代文本',\n setter: 'StringSetter',\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: 'lazyLoad',\n title: '懒加载',\n setter: 'SwitchSetter',\n extraProps: {\n defaultValue: false,\n },\n },\n {\n name: 'lazyLoadThreshold',\n title: '懒加载阈值',\n setter: {\n componentName: 'SliderSetter',\n props: {\n min: 0,\n max: 500,\n step: 50,\n suffix: 'px',\n },\n },\n extraProps: {\n defaultValue: 100,\n },\n },\n {\n name: 'placeholder',\n title: '占位图',\n setter: 'StringSetter',\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: 'objectFit',\n title: '填充方式',\n setter: {\n componentName: 'SelectSetter',\n props: {\n options: [\n { label: '覆盖', value: 'cover' },\n { label: '包含', value: 'contain' },\n { label: '填充', value: 'fill' },\n { label: '无', value: 'none' },\n ],\n },\n },\n extraProps: {\n defaultValue: 'cover',\n },\n },\n {\n name: 'borderRadius',\n title: '圆角',\n setter: 'NumberSetter',\n extraProps: {\n defaultValue: 0,\n },\n },\n {\n name: 'borderStyle',\n title: '边框样式',\n setter: {\n componentName: 'SelectSetter',\n props: {\n options: [\n { label: '无', value: 'none' },\n { label: '霓虹', value: 'neon' },\n { label: '渐变', value: 'gradient' },\n { label: '科技感', value: 'tech' },\n ],\n },\n },\n extraProps: {\n defaultValue: 'none',\n },\n },\n {\n name: 'borderColor',\n title: '边框颜色',\n setter: 'ColorSetter',\n extraProps: {\n defaultValue: '#00d4ff',\n },\n },\n {\n name: 'shadow',\n title: '启用阴影',\n setter: 'SwitchSetter',\n extraProps: {\n defaultValue: false,\n },\n },\n {\n name: 'shadowColor',\n title: '阴影颜色',\n setter: 'ColorSetter',\n extraProps: {\n defaultValue: 'rgba(0, 212, 255, 0.3)',\n },\n },\n ],\n },\n ],\n },\n {\n type: 'group',\n key: 'data',\n title: '数据',\n items: [\n {\n name: 'dataBinding',\n title: '数据绑定',\n setter: 'DataBindingSetter',\n },\n ],\n },\n {\n type: 'group',\n key: 'advanced',\n title: '高级',\n items: [\n {\n name: 'condition',\n title: '显隐控制',\n setter: 'SwitchSetter',\n extraProps: {\n defaultValue: true,\n supportVariable: true,\n },\n },\n ],\n },\n ],\n },\n ],\n component: {},\n supports: {},\n advanced: {},\n}\n\nexport default configure\n","/**\n * Image Snippets\n * 图片组件代码片段\n */\n\nimport type { Snippet } from '@easy-editor/core'\nimport { COMPONENT_NAME } from './constants'\n\nexport const snippets: Snippet[] = [\n {\n title: '普通图片',\n screenshot: '',\n schema: {\n componentName: COMPONENT_NAME,\n props: {\n alt: '图片',\n objectFit: 'contain',\n borderRadius: 0,\n },\n $dashboard: {\n rect: {\n width: 200,\n height: 180,\n },\n },\n },\n },\n {\n title: '圆角图片',\n screenshot: '',\n schema: {\n componentName: COMPONENT_NAME,\n props: {\n alt: '圆角图片',\n objectFit: 'contain',\n borderRadius: 100,\n borderStyle: 'tech',\n },\n $dashboard: {\n rect: {\n width: 200,\n height: 200,\n },\n },\n },\n },\n]\n\nexport default snippets\n","/**\n * Image Meta\n * 图片组件元数据\n */\n\nimport 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'\nimport pkg from '../package.json'\n\nexport const meta: ComponentMetadata = {\n componentName: COMPONENT_NAME,\n title: '图片',\n group: MaterialGroup.MEDIA,\n devMode: 'proCode',\n npm: {\n package: PACKAGE_NAME,\n version: pkg.version,\n globalName: COMPONENT_NAME,\n componentName: COMPONENT_NAME,\n },\n snippets,\n configure,\n}\n\nexport default meta\n"],"names":["MaterialGroup","INNER","MEDIA","COMPONENT_NAME","PACKAGE_NAME","configure","props","type","title","setter","items","key","componentName","icon","name","extraProps","label","getValue","target","getExtraPropValue","setValue","value","setExtraPropValue","accept","base64","raw","parent","setPropValue","width","height","clearPropValue","defaultValue","min","max","step","suffix","options","supportVariable","component","supports","advanced","snippets","screenshot","schema","alt","objectFit","borderRadius","$dashboard","rect","borderStyle","meta","group","devMode","npm","package","version","pkg","globalName"],"mappings":";;;;;;;EAMO,MAAMA,aAAa,GAAG;EAE3BC,EAQAC,KAAK,EAAE,OAKT,CAAU;;ECTH,MAAMC,cAAc,GAAG,0BAA0B;EAKjD,MAAMC,YAAY,GAAG,wCAAwC;;ECT7D,MAAMC,SAAoB,GAAG;EAClCC,EAAAA,KAAK,EAAE,CACL;EACEC,IAAAA,IAAI,EAAE,OAAO;EACbC,IAAAA,KAAK,EAAE,IAAI;EACX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,OAAO,EAAElD,YAAY;MACrBmD,OAAO,EAAEC,GAAG,CAACD,OAAO;EACpBE,IAAAA,UAAU,EAAEtD,cAAc;EAC1BS,IAAAA,aAAa,EAAET;KAChB;IACDsC,QAAQ;EACRpC,EAAAA;EACF;;;;;;;;;;;"}
@@ -0,0 +1,2 @@
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).EasyEditorMaterialsImageMeta={})}(this,function(e){"use strict";const t="EasyEditorMaterialsImage";const a={componentName:t,title:"图片",group:"media",devMode:"proCode",npm:{package:"@easy-editor/materials-dashboard-image",version:"0.0.1",globalName:t,componentName:t},snippets:[{title:"普通图片",screenshot:"",schema:{componentName:t,props:{alt:"图片",objectFit:"contain",borderRadius:0},$dashboard:{rect:{width:200,height:180}}}},{title:"圆角图片",screenshot:"",schema:{componentName:t,props:{alt:"圆角图片",objectFit:"contain",borderRadius:100,borderStyle:"tech"},$dashboard:{rect:{width:200,height:200}}}}],configure:{props:[{type:"group",title:"属性",setter:"TabSetter",items:[{type:"group",key:"config",title:"配置",setter:{componentName:"CollapseSetter",props:{icon:!1}},items:[{name:"id",title:"ID",setter:"NodeIdSetter",extraProps:{label:!1}},{name:"title",title:"标题",setter:"StringSetter",extraProps:{getValue:e=>e.getExtraPropValue("title"),setValue(e,t){e.setExtraPropValue("title",t)}}},{type:"group",title:"基础属性",setter:{componentName:"CollapseSetter",props:{icon:!1}},items:[{name:"rect",title:"位置尺寸",setter:"RectSetter",extraProps:{getValue:e=>e.getExtraPropValue("$dashboard.rect"),setValue(e,t){e.setExtraPropValue("$dashboard.rect",t)}}}]},{type:"group",title:"内容",setter:{componentName:"CollapseSetter",props:{icon:!1}},items:[{name:"__upload",title:"上传",setter:{componentName:"UploadSetter",props:{accept:".jpg,.jpeg,.png,.gif,.svg"}},extraProps:{setValue(e,t){if(t){const{base64:a,raw:r}=t;a&&e.parent.setPropValue("src",a),r?.width&&e.parent.setExtraPropValue("$dashboard.rect.width",r.width),r?.height&&e.parent.setExtraPropValue("$dashboard.rect.height",r.height)}else e.parent.clearPropValue("src")}}},{name:"src",title:"图片地址",setter:"StringSetter"},{name:"alt",title:"替代文本",setter:"StringSetter"}]},{type:"group",title:"加载",setter:{componentName:"CollapseSetter",props:{icon:!1}},items:[{name:"lazyLoad",title:"懒加载",setter:"SwitchSetter",extraProps:{defaultValue:!1}},{name:"lazyLoadThreshold",title:"懒加载阈值",setter:{componentName:"SliderSetter",props:{min:0,max:500,step:50,suffix:"px"}},extraProps:{defaultValue:100}},{name:"placeholder",title:"占位图",setter:"StringSetter"}]},{type:"group",title:"样式",setter:{componentName:"CollapseSetter",props:{icon:!1}},items:[{name:"objectFit",title:"填充方式",setter:{componentName:"SelectSetter",props:{options:[{label:"覆盖",value:"cover"},{label:"包含",value:"contain"},{label:"填充",value:"fill"},{label:"无",value:"none"}]}},extraProps:{defaultValue:"cover"}},{name:"borderRadius",title:"圆角",setter:"NumberSetter",extraProps:{defaultValue:0}},{name:"borderStyle",title:"边框样式",setter:{componentName:"SelectSetter",props:{options:[{label:"无",value:"none"},{label:"霓虹",value:"neon"},{label:"渐变",value:"gradient"},{label:"科技感",value:"tech"}]}},extraProps:{defaultValue:"none"}},{name:"borderColor",title:"边框颜色",setter:"ColorSetter",extraProps:{defaultValue:"#00d4ff"}},{name:"shadow",title:"启用阴影",setter:"SwitchSetter",extraProps:{defaultValue:!1}},{name:"shadowColor",title:"阴影颜色",setter:"ColorSetter",extraProps:{defaultValue:"rgba(0, 212, 255, 0.3)"}}]}]},{type:"group",key:"data",title:"数据",items:[{name:"dataBinding",title:"数据绑定",setter:"DataBindingSetter"}]},{type:"group",key:"advanced",title:"高级",items:[{name:"condition",title:"显隐控制",setter:"SwitchSetter",extraProps:{defaultValue:!0,supportVariable:!0}}]}]}],component:{},supports:{},advanced:{}}};e.default=a,e.meta=a,Object.defineProperty(e,"__esModule",{value:!0})});
2
+ //# sourceMappingURL=meta.min.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"meta.min.js","sources":["../../../../shared/src/index.ts","../src/constants.ts","../src/meta.ts","../src/snippets.ts","../src/configure.ts"],"sourcesContent":["/**\n * Shared types, components and utilities for EasyEditor materials\n * @package @easy-editor/materials-shared\n */\n\n// 物料分组常量\nexport const MaterialGroup = {\n /** 内置 */\n INNER: 'inner',\n /** 基础 */\n BASIC: 'basic',\n /** 图表 */\n CHART: 'chart',\n /** 数据展示 */\n DISPLAY: 'display',\n /** 媒体 */\n MEDIA: 'media',\n /** 交互 */\n INTERACTION: 'interaction',\n /** 地图 */\n MAP: 'map',\n} as const\n\nexport type MaterialGroup = (typeof MaterialGroup)[keyof typeof MaterialGroup]\n\n// 工具函数\nexport { cn } from './lib/utils'\n\nexport * from './types'\n","/**\n * 物料常量配置\n * 统一管理全局变量名等配置,确保 meta.ts 和 rollup.config.js 使用相同的值\n */\n\n/**\n * UMD 全局变量基础名称\n * 用于构建:\n * - 元数据:${GLOBAL_NAME}Meta (例如: EasyEditorMaterialsImageMeta)\n * - 组件:${GLOBAL_NAME}Component (例如: EasyEditorMaterialsImageComponent)\n * - 完整构建:${GLOBAL_NAME} (例如: EasyEditorMaterialsImage)\n */\nexport const COMPONENT_NAME = 'EasyEditorMaterialsImage'\n\n/**\n * 包名\n */\nexport const PACKAGE_NAME = '@easy-editor/materials-dashboard-image'\n","/**\n * Image Meta\n * 图片组件元数据\n */\n\nimport 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'\nimport pkg from '../package.json'\n\nexport const meta: ComponentMetadata = {\n componentName: COMPONENT_NAME,\n title: '图片',\n group: MaterialGroup.MEDIA,\n devMode: 'proCode',\n npm: {\n package: PACKAGE_NAME,\n version: pkg.version,\n globalName: COMPONENT_NAME,\n componentName: COMPONENT_NAME,\n },\n snippets,\n configure,\n}\n\nexport default meta\n","/**\n * Image Snippets\n * 图片组件代码片段\n */\n\nimport type { Snippet } from '@easy-editor/core'\nimport { COMPONENT_NAME } from './constants'\n\nexport const snippets: Snippet[] = [\n {\n title: '普通图片',\n screenshot: '',\n schema: {\n componentName: COMPONENT_NAME,\n props: {\n alt: '图片',\n objectFit: 'contain',\n borderRadius: 0,\n },\n $dashboard: {\n rect: {\n width: 200,\n height: 180,\n },\n },\n },\n },\n {\n title: '圆角图片',\n screenshot: '',\n schema: {\n componentName: COMPONENT_NAME,\n props: {\n alt: '圆角图片',\n objectFit: 'contain',\n borderRadius: 100,\n borderStyle: 'tech',\n },\n $dashboard: {\n rect: {\n width: 200,\n height: 200,\n },\n },\n },\n },\n]\n\nexport default snippets\n","/**\n * Image Configure\n * 图片组件配置\n */\n\nimport type { Configure } from '@easy-editor/core'\nimport type { UploadValue } from '@easy-editor/materials-shared'\n\nexport const configure: Configure = {\n props: [\n {\n type: 'group',\n title: '属性',\n setter: 'TabSetter',\n items: [\n {\n type: 'group',\n key: 'config',\n title: '配置',\n setter: {\n componentName: 'CollapseSetter',\n props: {\n icon: false,\n },\n },\n items: [\n // 基础配置\n {\n name: 'id',\n title: 'ID',\n setter: 'NodeIdSetter',\n extraProps: {\n // @ts-expect-error label is not a valid extra prop\n label: false,\n },\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 {\n type: 'group',\n title: '内容',\n setter: {\n componentName: 'CollapseSetter',\n props: {\n icon: false,\n },\n },\n items: [\n {\n name: '__upload',\n title: '上传',\n setter: {\n componentName: 'UploadSetter',\n props: {\n accept: '.jpg,.jpeg,.png,.gif,.svg',\n },\n },\n extraProps: {\n setValue(target, value: UploadValue) {\n if (value) {\n const { base64, raw } = value\n if (base64) {\n target.parent.setPropValue('src', base64)\n }\n if (raw?.width) {\n target.parent.setExtraPropValue('$dashboard.rect.width', raw.width)\n }\n if (raw?.height) {\n target.parent.setExtraPropValue('$dashboard.rect.height', raw.height)\n }\n } else {\n target.parent.clearPropValue('src')\n }\n },\n },\n },\n {\n name: 'src',\n title: '图片地址',\n setter: 'StringSetter',\n },\n {\n name: 'alt',\n title: '替代文本',\n setter: 'StringSetter',\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: 'lazyLoad',\n title: '懒加载',\n setter: 'SwitchSetter',\n extraProps: {\n defaultValue: false,\n },\n },\n {\n name: 'lazyLoadThreshold',\n title: '懒加载阈值',\n setter: {\n componentName: 'SliderSetter',\n props: {\n min: 0,\n max: 500,\n step: 50,\n suffix: 'px',\n },\n },\n extraProps: {\n defaultValue: 100,\n },\n },\n {\n name: 'placeholder',\n title: '占位图',\n setter: 'StringSetter',\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: 'objectFit',\n title: '填充方式',\n setter: {\n componentName: 'SelectSetter',\n props: {\n options: [\n { label: '覆盖', value: 'cover' },\n { label: '包含', value: 'contain' },\n { label: '填充', value: 'fill' },\n { label: '无', value: 'none' },\n ],\n },\n },\n extraProps: {\n defaultValue: 'cover',\n },\n },\n {\n name: 'borderRadius',\n title: '圆角',\n setter: 'NumberSetter',\n extraProps: {\n defaultValue: 0,\n },\n },\n {\n name: 'borderStyle',\n title: '边框样式',\n setter: {\n componentName: 'SelectSetter',\n props: {\n options: [\n { label: '无', value: 'none' },\n { label: '霓虹', value: 'neon' },\n { label: '渐变', value: 'gradient' },\n { label: '科技感', value: 'tech' },\n ],\n },\n },\n extraProps: {\n defaultValue: 'none',\n },\n },\n {\n name: 'borderColor',\n title: '边框颜色',\n setter: 'ColorSetter',\n extraProps: {\n defaultValue: '#00d4ff',\n },\n },\n {\n name: 'shadow',\n title: '启用阴影',\n setter: 'SwitchSetter',\n extraProps: {\n defaultValue: false,\n },\n },\n {\n name: 'shadowColor',\n title: '阴影颜色',\n setter: 'ColorSetter',\n extraProps: {\n defaultValue: 'rgba(0, 212, 255, 0.3)',\n },\n },\n ],\n },\n ],\n },\n {\n type: 'group',\n key: 'data',\n title: '数据',\n items: [\n {\n name: 'dataBinding',\n title: '数据绑定',\n setter: 'DataBindingSetter',\n },\n ],\n },\n {\n type: 'group',\n key: 'advanced',\n title: '高级',\n items: [\n {\n name: 'condition',\n title: '显隐控制',\n setter: 'SwitchSetter',\n extraProps: {\n defaultValue: true,\n supportVariable: true,\n },\n },\n ],\n },\n ],\n },\n ],\n component: {},\n supports: {},\n advanced: {},\n}\n\nexport default configure\n"],"names":["COMPONENT_NAME","meta","componentName","title","group","devMode","npm","package","version","globalName","snippets","screenshot","schema","props","alt","objectFit","borderRadius","$dashboard","rect","width","height","borderStyle","configure","type","setter","items","key","icon","name","extraProps","label","getValue","target","getExtraPropValue","setValue","value","setExtraPropValue","accept","base64","raw","parent","setPropValue","clearPropValue","defaultValue","min","max","step","suffix","options","supportVariable","component","supports","advanced"],"mappings":"mQAMO,MCMMA,EAAiB,2BCAvB,MAAMC,EAA0B,CACrCC,cAAeF,EACfG,MAAO,KACPC,MFCO,QEAPC,QAAS,UACTC,IAAK,CACHC,QDDwB,yCCExBC,gBACAC,WAAYT,EACZE,cAAeF,GAEjBU,SCfiC,CACjC,CACEP,MAAO,OACPQ,WAAY,GACZC,OAAQ,CACNV,cAAeF,EACfa,MAAO,CACLC,IAAK,KACLC,UAAW,U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EL,MAAO,MAAOK,MAAO,WAI7BN,WAAY,CACVc,aAAc,SAGlB,CACEf,KAAM,cACNzB,MAAO,OACPqB,OAAQ,cACRK,WAAY,CACVc,aAAc,YAGlB,CACEf,KAAM,SACNzB,MAAO,OACPqB,OAAQ,eACRK,WAAY,CACVc,cAAc,IAGlB,CACEf,KAAM,cACNzB,MAAO,OACPqB,OAAQ,cACRK,WAAY,CACVc,aAAc,+BAO1B,CACEpB,KAAM,QACNG,IAAK,OACLvB,MAAO,KACPsB,MAAO,CACL,CACEG,KAAM,cACNzB,MAAO,OACPqB,OAAQ,uBAId,CACED,KAAM,QACNG,IAAK,WACLvB,MAAO,KACPsB,MAAO,CACL,CACEG,KAAM,YACNzB,MAAO,OACPqB,OAAQ,eACRK,WAAY,CACVc,cAAc,EACdM,iBAAiB,SAQ/BC,UAAW,CAAA,EACXC,SAAU,CAAA,EACVC,SAAU,CAAA"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Image Component
3
+ * 图片/图标/边框装饰组件
4
+ */
5
+ import type { CSSProperties, Ref } from 'react';
6
+ export type ObjectFit = 'cover' | 'contain' | 'fill' | 'none';
7
+ export type BorderStyle = 'none' | 'neon' | 'gradient' | 'tech';
8
+ export type DisplayMode = 'image' | 'icon';
9
+ export interface ImageProps {
10
+ ref?: Ref<HTMLDivElement>;
11
+ /** 图片地址 */
12
+ src?: string;
13
+ /** 图片描述 */
14
+ alt?: string;
15
+ /** 图片填充方式 */
16
+ objectFit?: ObjectFit;
17
+ /** 圆角 */
18
+ borderRadius?: number;
19
+ /** 边框样式 */
20
+ borderStyle?: BorderStyle;
21
+ /** 边框颜色(霓虹/科技感边框) */
22
+ borderColor?: string;
23
+ /** 阴影 */
24
+ shadow?: boolean;
25
+ /** 阴影颜色 */
26
+ shadowColor?: string;
27
+ /** 外部样式 */
28
+ style?: CSSProperties;
29
+ }
30
+ export declare const Image: React.FC<ImageProps>;
31
+ export default Image;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Image Configure
3
+ * 图片组件配置
4
+ */
5
+ import type { Configure } from '@easy-editor/core';
6
+ export declare const configure: Configure;
7
+ export default configure;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * 物料常量配置
3
+ * 统一管理全局变量名等配置,确保 meta.ts 和 rollup.config.js 使用相同的值
4
+ */
5
+ /**
6
+ * UMD 全局变量基础名称
7
+ * 用于构建:
8
+ * - 元数据:${GLOBAL_NAME}Meta (例如: EasyEditorMaterialsImageMeta)
9
+ * - 组件:${GLOBAL_NAME}Component (例如: EasyEditorMaterialsImageComponent)
10
+ * - 完整构建:${GLOBAL_NAME} (例如: EasyEditorMaterialsImage)
11
+ */
12
+ export declare const COMPONENT_NAME = "EasyEditorMaterialsImage";
13
+ /**
14
+ * 包名
15
+ */
16
+ export declare const PACKAGE_NAME = "@easy-editor/materials-dashboard-image";
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Image Entry
3
+ * 图片组件入口
4
+ */
5
+ export { Image as component } from './component';
6
+ export { default as meta } from './meta';
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Image Meta
3
+ * 图片组件元数据
4
+ */
5
+ import type { ComponentMetadata } from '@easy-editor/core';
6
+ export declare const meta: ComponentMetadata;
7
+ export default meta;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Image Snippets
3
+ * 图片组件代码片段
4
+ */
5
+ import type { Snippet } from '@easy-editor/core';
6
+ export declare const snippets: Snippet[];
7
+ export default snippets;
package/package.json ADDED
@@ -0,0 +1,67 @@
1
+ {
2
+ "name": "@easy-editor/materials-dashboard-image",
3
+ "version": "0.0.2",
4
+ "description": "Image component for EasyEditor dashboard",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.esm.js",
12
+ "require": "./dist/index.cjs"
13
+ }
14
+ },
15
+ "publishConfig": {
16
+ "access": "public",
17
+ "jsdelivr": "dist/index.min.js",
18
+ "registry": "https://registry.npmjs.org/"
19
+ },
20
+ "homepage": "https://github.com/Easy-Editor/EasyMaterials",
21
+ "license": "MIT",
22
+ "author": "JinSo <kimjinso@qq.com>",
23
+ "keywords": [
24
+ "@easy-editor",
25
+ "easyeditor",
26
+ "low-code",
27
+ "dashboard",
28
+ "image",
29
+ "icon",
30
+ "border",
31
+ "component",
32
+ "react"
33
+ ],
34
+ "repository": {
35
+ "type": "git",
36
+ "url": "https://github.com/Easy-Editor/EasyMaterials",
37
+ "directory": "packages/dashboard/media/image"
38
+ },
39
+ "bugs": {
40
+ "url": "https://github.com/Easy-Editor/EasyMaterials/issues"
41
+ },
42
+ "peerDependencies": {
43
+ "@easy-editor/core": "*",
44
+ "react": "^18 || ^19",
45
+ "react-dom": "^18 || ^19",
46
+ "@types/react": "^18 || ^19",
47
+ "@types/react-dom": "^18 || ^19"
48
+ },
49
+ "dependencies": {
50
+ "lucide-react": "^0.513.0",
51
+ "@easy-editor/materials-shared": "0.0.0"
52
+ },
53
+ "scripts": {
54
+ "dev": "vite",
55
+ "format": "biome format --write .",
56
+ "lint": "biome check .",
57
+ "build": "npm-run-all -nl build:*",
58
+ "build:clean": "rimraf dist/",
59
+ "build:js": "rollup -c",
60
+ "build:types": "pnpm types",
61
+ "types": "npm-run-all -nl types:*",
62
+ "types:src": "tsc --project tsconfig.build.json",
63
+ "test-types": "tsc --project tsconfig.test.json"
64
+ },
65
+ "module": "dist/index.esm.js",
66
+ "unpkg": "dist/index.min.js"
67
+ }
@@ -0,0 +1,222 @@
1
+ import babel from '@rollup/plugin-babel'
2
+ import commonjs from '@rollup/plugin-commonjs'
3
+ import nodeResolve from '@rollup/plugin-node-resolve'
4
+ import json from '@rollup/plugin-json'
5
+ import { terser } from 'rollup-plugin-terser'
6
+ import cleanup from 'rollup-plugin-cleanup'
7
+ import postcss from 'rollup-plugin-postcss'
8
+ import pkg from './package.json' with { type: 'json' }
9
+
10
+ const GLOBAL_NAME = 'EasyEditorMaterialsImage'
11
+
12
+ // 外部依赖(不打包进组件)
13
+ const external = ['react', 'react-dom', 'react/jsx-runtime', '@easy-editor/core']
14
+
15
+ const globals = {
16
+ react: 'React',
17
+ 'react-dom': 'ReactDOM',
18
+ 'react/jsx-runtime': 'jsxRuntime',
19
+ '@easy-editor/core': 'EasyEditorCore',
20
+ }
21
+
22
+ const plugins = [
23
+ nodeResolve({
24
+ extensions: ['.js', '.ts', '.jsx', '.tsx'],
25
+ }),
26
+ commonjs(),
27
+ json(),
28
+ postcss({
29
+ modules: {
30
+ generateScopedName: '[name]__[local]___[hash:base64:5]',
31
+ },
32
+ autoModules: true,
33
+ minimize: true,
34
+ inject: true,
35
+ }),
36
+ babel({
37
+ extensions: ['.js', '.ts', '.jsx', '.tsx'],
38
+ exclude: 'node_modules/**',
39
+ babelrc: false,
40
+ babelHelpers: 'bundled',
41
+ presets: [
42
+ ['@babel/preset-react', { runtime: 'automatic' }],
43
+ [
44
+ '@babel/preset-typescript',
45
+ {
46
+ allowDeclareFields: true,
47
+ },
48
+ ],
49
+ ],
50
+ }),
51
+ cleanup({
52
+ comments: ['some', /PURE/],
53
+ extensions: ['.js', '.ts'],
54
+ }),
55
+ ]
56
+
57
+ export default [
58
+ /* ---------------------------------- 元数据构建 --------------------------------- */
59
+ // 元数据 ESM 构建(用于动态 import)
60
+ {
61
+ input: 'src/meta.ts',
62
+ output: [
63
+ {
64
+ file: 'dist/meta.esm.js',
65
+ format: 'esm',
66
+ sourcemap: true,
67
+ banner: `/* @easy-editor/materials-dashboard-image v${pkg.version} (meta, esm) */`,
68
+ exports: 'named',
69
+ },
70
+ ],
71
+ plugins,
72
+ external,
73
+ },
74
+ // 元数据 UMD 构建(备用方案)
75
+ {
76
+ input: 'src/meta.ts',
77
+ output: [
78
+ {
79
+ file: 'dist/meta.js',
80
+ format: 'umd',
81
+ name: `${GLOBAL_NAME}Meta`,
82
+ globals,
83
+ sourcemap: true,
84
+ banner: `/* @easy-editor/materials-dashboard-image v${pkg.version} (meta) */`,
85
+ exports: 'named',
86
+ },
87
+ ],
88
+ plugins,
89
+ external,
90
+ },
91
+ // 元数据压缩版本(UMD,备用方案)
92
+ {
93
+ input: 'src/meta.ts',
94
+ output: [
95
+ {
96
+ file: 'dist/meta.min.js',
97
+ format: 'umd',
98
+ name: `${GLOBAL_NAME}Meta`,
99
+ globals,
100
+ sourcemap: true,
101
+ banner: `/* @easy-editor/materials-dashboard-image v${pkg.version} (meta, minified) */`,
102
+ exports: 'named',
103
+ },
104
+ ],
105
+ plugins: [...plugins, terser()],
106
+ external,
107
+ },
108
+
109
+ /* ---------------------------------- 组件构建 ---------------------------------- */
110
+ // 组件 ESM 构建(用于动态 import)
111
+ {
112
+ input: 'src/component.tsx',
113
+ output: [
114
+ {
115
+ file: 'dist/component.esm.js',
116
+ format: 'esm',
117
+ sourcemap: true,
118
+ banner: `/* @easy-editor/materials-dashboard-image v${pkg.version} (component, esm) */`,
119
+ exports: 'named',
120
+ },
121
+ ],
122
+ plugins,
123
+ external,
124
+ },
125
+ // 组件 UMD 构建(备用方案)
126
+ {
127
+ input: 'src/component.tsx',
128
+ output: [
129
+ {
130
+ file: 'dist/component.js',
131
+ format: 'umd',
132
+ name: `${GLOBAL_NAME}Component`,
133
+ globals,
134
+ sourcemap: true,
135
+ banner: `/* @easy-editor/materials-dashboard-image v${pkg.version} (component) */`,
136
+ exports: 'named',
137
+ },
138
+ ],
139
+ plugins,
140
+ external,
141
+ },
142
+ // 组件压缩版本(UMD,备用方案)
143
+ {
144
+ input: 'src/component.tsx',
145
+ output: [
146
+ {
147
+ file: 'dist/component.min.js',
148
+ format: 'umd',
149
+ name: `${GLOBAL_NAME}Component`,
150
+ globals,
151
+ sourcemap: true,
152
+ banner: `/* @easy-editor/materials-dashboard-image v${pkg.version} (component, minified) */`,
153
+ exports: 'named',
154
+ },
155
+ ],
156
+ plugins: [...plugins, terser()],
157
+ external,
158
+ },
159
+
160
+ /* ---------------------------------- 完整构建 ---------------------------------- */
161
+ // UMD 构建(用于 CDN 和浏览器)
162
+ {
163
+ input: 'src/index.tsx',
164
+ output: [
165
+ {
166
+ file: 'dist/index.js',
167
+ format: 'umd',
168
+ name: GLOBAL_NAME,
169
+ globals,
170
+ sourcemap: true,
171
+ banner: `/* @easy-editor/materials-dashboard-image v${pkg.version} */`,
172
+ exports: 'named',
173
+ },
174
+ ],
175
+ plugins,
176
+ external,
177
+ },
178
+ // ESM 构建(用于现代打包工具)
179
+ {
180
+ input: 'src/index.tsx',
181
+ output: [
182
+ {
183
+ file: 'dist/index.esm.js',
184
+ format: 'esm',
185
+ sourcemap: true,
186
+ },
187
+ ],
188
+ plugins,
189
+ external,
190
+ },
191
+ // CJS 构建(用于 Node.js)
192
+ {
193
+ input: 'src/index.tsx',
194
+ output: [
195
+ {
196
+ file: 'dist/index.cjs',
197
+ format: 'cjs',
198
+ sourcemap: true,
199
+ exports: 'named',
200
+ },
201
+ ],
202
+ plugins,
203
+ external,
204
+ },
205
+ // 压缩版本(用于生产环境)
206
+ {
207
+ input: 'src/index.tsx',
208
+ output: [
209
+ {
210
+ file: 'dist/index.min.js',
211
+ format: 'umd',
212
+ name: GLOBAL_NAME,
213
+ globals,
214
+ sourcemap: true,
215
+ banner: `/* @easy-editor/materials-dashboard-image v${pkg.version} (minified) */`,
216
+ exports: 'named',
217
+ },
218
+ ],
219
+ plugins: [...plugins, terser()],
220
+ external,
221
+ },
222
+ ]
Binary file
@@ -0,0 +1,122 @@
1
+ /**
2
+ * Image Component Styles
3
+ * 图片组件样式
4
+ */
5
+
6
+ .container {
7
+ position: relative;
8
+ display: flex;
9
+ align-items: center;
10
+ justify-content: center;
11
+ width: 100%;
12
+ height: 100%;
13
+ overflow: hidden;
14
+ }
15
+
16
+ .image {
17
+ display: block;
18
+ max-width: 100%;
19
+ max-height: 100%;
20
+ }
21
+
22
+ .imageCover {
23
+ width: 100%;
24
+ height: 100%;
25
+ object-fit: cover;
26
+ }
27
+
28
+ .imageContain {
29
+ width: 100%;
30
+ height: 100%;
31
+ object-fit: contain;
32
+ }
33
+
34
+ .imageFill {
35
+ width: 100%;
36
+ height: 100%;
37
+ object-fit: fill;
38
+ }
39
+
40
+ /* 图标模式 */
41
+ .iconWrapper {
42
+ display: flex;
43
+ align-items: center;
44
+ justify-content: center;
45
+ }
46
+
47
+ /* 边框装饰效果 */
48
+ .borderNeon {
49
+ border: 2px solid transparent;
50
+ animation: neonPulse 2s ease-in-out infinite;
51
+ }
52
+
53
+ @keyframes neonPulse {
54
+ 0%,
55
+ 100% {
56
+ box-shadow:
57
+ 0 0 5px currentColor,
58
+ 0 0 10px currentColor,
59
+ 0 0 20px currentColor;
60
+ }
61
+ 50% {
62
+ box-shadow:
63
+ 0 0 10px currentColor,
64
+ 0 0 20px currentColor,
65
+ 0 0 40px currentColor;
66
+ }
67
+ }
68
+
69
+ .borderGradient {
70
+ border: 2px solid transparent;
71
+ background-clip: padding-box;
72
+ position: relative;
73
+ }
74
+
75
+ .borderGradient::before {
76
+ content: "";
77
+ position: absolute;
78
+ inset: -2px;
79
+ border-radius: inherit;
80
+ padding: 2px;
81
+ background: linear-gradient(
82
+ 135deg,
83
+ var(--border-color-1),
84
+ var(--border-color-2)
85
+ );
86
+ -webkit-mask:
87
+ linear-gradient(#fff 0 0) content-box,
88
+ linear-gradient(#fff 0 0);
89
+ mask:
90
+ linear-gradient(#fff 0 0) content-box,
91
+ linear-gradient(#fff 0 0);
92
+ -webkit-mask-composite: xor;
93
+ mask-composite: exclude;
94
+ }
95
+
96
+ .borderTech {
97
+ border: 1px solid rgba(0, 200, 255, 0.3);
98
+ position: relative;
99
+ }
100
+
101
+ .borderTech::before,
102
+ .borderTech::after {
103
+ content: "";
104
+ position: absolute;
105
+ width: 20px;
106
+ height: 20px;
107
+ border: 2px solid #00d4ff;
108
+ }
109
+
110
+ .borderTech::before {
111
+ top: -2px;
112
+ left: -2px;
113
+ border-right: none;
114
+ border-bottom: none;
115
+ }
116
+
117
+ .borderTech::after {
118
+ bottom: -2px;
119
+ right: -2px;
120
+ border-left: none;
121
+ border-top: none;
122
+ }