@jnrs/lingshu-smart 2.2.6 → 2.2.8

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 (174) hide show
  1. package/dist/App.vue.d.ts +2 -1
  2. package/dist/App.vue.js +30 -0
  3. package/dist/assets/data/editor_default.d.ts +8 -1
  4. package/dist/assets/data/editor_default.js +59 -0
  5. package/dist/assets/data/editor_default_setting.d.ts +16 -0
  6. package/dist/assets/data/editor_default_setting.js +58 -0
  7. package/dist/assets/data/editor_preset.d.ts +8 -1
  8. package/dist/assets/data/editor_preset.js +51 -0
  9. package/dist/assets/data/editor_preset_menu.d.ts +9 -0
  10. package/dist/assets/data/editor_preset_menu.js +290 -0
  11. package/dist/components/editor/ControlBar/CaseManger.vue.d.ts +3 -15
  12. package/dist/components/editor/ControlBar/CaseManger.vue.js +465 -0
  13. package/dist/components/editor/ControlBar/CaseTitleEdit.vue.d.ts +2 -411
  14. package/dist/components/editor/ControlBar/CaseTitleEdit.vue.js +108 -0
  15. package/dist/components/editor/ControlBar/ExportImportDialog.vue.d.ts +3 -2
  16. package/dist/components/editor/ControlBar/ExportImportDialog.vue.js +280 -0
  17. package/dist/components/editor/ControlBar/MainButton.vue.d.ts +3 -2
  18. package/dist/components/editor/ControlBar/MainButton.vue.js +183 -0
  19. package/dist/components/editor/ControlBar/StepButton.vue.d.ts +2 -1
  20. package/dist/components/editor/ControlBar/StepButton.vue.js +147 -0
  21. package/dist/components/editor/ControlBar/StepRecordVisualizer.vue.d.ts +2 -1
  22. package/dist/components/editor/ControlBar/StepRecordVisualizer.vue.js +98 -0
  23. package/dist/components/editor/DrawingBoard.vue.d.ts +2 -1
  24. package/dist/components/editor/DrawingBoard.vue.js +31 -0
  25. package/dist/components/editor/MenuCard/Equipments.vue.d.ts +2 -1
  26. package/dist/components/editor/MenuCard/Equipments.vue.js +129 -0
  27. package/dist/components/editor/MenuCard/Layers.vue.d.ts +2 -1
  28. package/dist/components/editor/MenuCard/Layers.vue.js +201 -0
  29. package/dist/components/editor/MenuCard/index.vue.d.ts +2 -1
  30. package/dist/components/editor/MenuCard/index.vue.js +84 -0
  31. package/dist/components/editor/OptionCard/Equipment/Base.vue.d.ts +2 -1
  32. package/dist/components/editor/OptionCard/Equipment/Base.vue.js +96 -0
  33. package/dist/components/editor/OptionCard/Equipment/Binds.vue.d.ts +3 -0
  34. package/dist/components/editor/OptionCard/Equipment/Binds.vue.js +443 -0
  35. package/dist/components/editor/OptionCard/Equipment/Bot.vue.d.ts +3 -0
  36. package/dist/components/editor/OptionCard/Equipment/Bot.vue.js +81 -0
  37. package/dist/components/editor/OptionCard/Equipment/DataSets.vue.d.ts +2 -1
  38. package/dist/components/editor/OptionCard/Equipment/DataSets.vue.js +304 -0
  39. package/dist/components/editor/OptionCard/Equipment/DockStore.vue.d.ts +3 -0
  40. package/dist/components/editor/OptionCard/Equipment/DockStore.vue.js +597 -0
  41. package/dist/components/editor/OptionCard/Equipment/Interaction.vue.d.ts +2 -1
  42. package/dist/components/editor/OptionCard/Equipment/Interaction.vue.js +287 -0
  43. package/dist/components/editor/OptionCard/Equipment/Position.backup.vue.d.ts +3 -0
  44. package/dist/components/editor/OptionCard/Equipment/Position.backup.vue.js +440 -0
  45. package/dist/components/editor/OptionCard/Equipment/Position.vue.d.ts +2 -1
  46. package/dist/components/editor/OptionCard/Equipment/Position.vue.js +436 -0
  47. package/dist/components/editor/OptionCard/Equipment/StationSlotGroup.vue.d.ts +2 -1
  48. package/dist/components/editor/OptionCard/Equipment/StationSlotGroup.vue.js +1131 -0
  49. package/dist/components/editor/OptionCard/Equipment/Store.vue.d.ts +3 -0
  50. package/dist/components/editor/OptionCard/Equipment/Store.vue.js +453 -0
  51. package/dist/components/editor/OptionCard/Equipment/Trailer.vue.d.ts +3 -0
  52. package/dist/components/editor/OptionCard/Equipment/Trailer.vue.js +1109 -0
  53. package/dist/components/editor/OptionCard/Equipment/index.vue.d.ts +2 -1
  54. package/dist/components/editor/OptionCard/Equipment/index.vue.js +100 -0
  55. package/dist/components/editor/OptionCard/Equipment/models/MachineTool.vue.d.ts +3 -0
  56. package/dist/components/editor/OptionCard/Equipment/models/MachineTool.vue.js +99 -0
  57. package/dist/components/editor/OptionCard/Equipment/models/Rail.vue.d.ts +3 -0
  58. package/dist/components/editor/OptionCard/Equipment/models/Rail.vue.js +225 -0
  59. package/dist/components/editor/OptionCard/Equipment/models/SingleGripperRobot.vue.d.ts +3 -0
  60. package/dist/components/editor/OptionCard/Equipment/models/SingleGripperRobot.vue.js +99 -0
  61. package/dist/components/editor/OptionCard/Scene/Background.vue.d.ts +2 -1
  62. package/dist/components/editor/OptionCard/Scene/Background.vue.js +543 -0
  63. package/dist/components/editor/OptionCard/Scene/index.vue.d.ts +2 -1
  64. package/dist/components/editor/OptionCard/Scene/index.vue.js +200 -0
  65. package/dist/components/editor/OptionCard/index.vue.d.ts +2 -1
  66. package/dist/components/editor/OptionCard/index.vue.js +73 -0
  67. package/dist/components/editor/index.vue.d.ts +4 -13
  68. package/dist/components/editor/index.vue.js +156 -0
  69. package/dist/components/index.d.ts +2 -2
  70. package/dist/components/index.js +4 -25440
  71. package/dist/components/preview/index.vue.d.ts +6 -5
  72. package/dist/components/preview/index.vue.js +104 -0
  73. package/dist/composables/useStepRecord.d.ts +12 -4
  74. package/dist/composables/useStepRecord.js +135 -0
  75. package/dist/constants/options.d.ts +8 -1
  76. package/dist/constants/options.js +55 -0
  77. package/dist/controller/AppController.d.ts +10 -3
  78. package/dist/controller/AppController.js +168 -0
  79. package/dist/controller/EditorController.d.ts +9 -2
  80. package/dist/controller/EditorController.js +173 -0
  81. package/dist/index.js +1 -1
  82. package/dist/locales/en.js +5 -0
  83. package/dist/locales/i18next.d.ts +1 -1
  84. package/dist/locales/i18next.js +6 -0
  85. package/dist/locales/index.d.ts +2 -2
  86. package/dist/locales/index.js +3 -13
  87. package/dist/locales/zhCn.js +5 -0
  88. package/dist/main.d.ts +3 -0
  89. package/dist/main.js +13 -0
  90. package/dist/playground/EditPageDemo.vue.d.ts +2 -1
  91. package/dist/playground/EditPageDemo.vue.js +57 -0
  92. package/dist/playground/ViewPageDemo.vue.d.ts +2 -27
  93. package/dist/playground/ViewPageDemo.vue.js +277 -0
  94. package/dist/stores/index.js +3 -0
  95. package/dist/stores/useAppStore.d.ts +13 -6
  96. package/dist/stores/useAppStore.js +78 -0
  97. package/dist/stores/useDataStore.d.ts +18 -11
  98. package/dist/stores/useDataStore.js +116 -0
  99. package/dist/stores/useEditorStore.d.ts +27 -20
  100. package/dist/stores/useEditorStore.js +263 -0
  101. package/dist/types/app.types.d.ts +1 -1
  102. package/dist/types/app.types.js +2 -0
  103. package/dist/types/base.types.d.ts +4 -2
  104. package/dist/types/base.types.js +1 -0
  105. package/dist/types/components/config.types.d.ts +11 -3
  106. package/dist/types/components/config.types.js +1 -0
  107. package/dist/types/components/operating.types.d.ts +1 -1
  108. package/dist/types/components/operating.types.js +1 -0
  109. package/dist/types/enums.d.ts +5 -2
  110. package/dist/types/enums.js +46 -0
  111. package/dist/types/guards.d.ts +12 -2
  112. package/dist/types/guards.js +28 -0
  113. package/dist/types/index.d.ts +2 -2
  114. package/dist/types/index.js +8 -0
  115. package/dist/types/models/config.types.d.ts +74 -29
  116. package/dist/types/models/config.types.js +1 -0
  117. package/dist/types/models/operating.types.d.ts +83 -17
  118. package/dist/types/models/operating.types.js +1 -0
  119. package/dist/ui/abstract/ComponentAbs.d.ts +9 -2
  120. package/dist/ui/abstract/ComponentAbs.js +64 -0
  121. package/dist/ui/abstract/ModelAbs.d.ts +12 -2
  122. package/dist/ui/abstract/ModelAbs.js +119 -0
  123. package/dist/ui/components/Entrance.d.ts +8 -1
  124. package/dist/ui/components/Entrance.js +83 -0
  125. package/dist/ui/components/Light.d.ts +26 -3
  126. package/dist/ui/components/Light.js +167 -0
  127. package/dist/ui/components/Progress.d.ts +8 -1
  128. package/dist/ui/components/Progress.js +84 -0
  129. package/dist/ui/components/Resource.d.ts +8 -1
  130. package/dist/ui/components/Resource.js +70 -0
  131. package/dist/ui/components/StationSlot.d.ts +24 -2
  132. package/dist/ui/components/StationSlot.js +207 -0
  133. package/dist/ui/components/StationSlotGroup.d.ts +8 -1
  134. package/dist/ui/components/StationSlotGroup.js +110 -0
  135. package/dist/ui/factories/createGlass.d.ts +9 -1
  136. package/dist/ui/factories/createGlass.js +51 -0
  137. package/dist/ui/factories/createModel.d.ts +9 -2
  138. package/dist/ui/factories/createModel.js +35 -0
  139. package/dist/ui/factories/createShadow.d.ts +12 -4
  140. package/dist/ui/factories/createShadow.js +52 -0
  141. package/dist/ui/factories/createText.d.ts +7 -0
  142. package/dist/ui/factories/createText.js +46 -0
  143. package/dist/ui/models/CleaningMachine.d.ts +14 -0
  144. package/dist/ui/models/CleaningMachine.js +141 -0
  145. package/dist/ui/models/DoubleJointRobot.d.ts +23 -0
  146. package/dist/ui/models/DoubleJointRobot.js +545 -0
  147. package/dist/ui/models/LoadingStation.d.ts +16 -0
  148. package/dist/ui/models/LoadingStation.js +167 -0
  149. package/dist/ui/models/MachineTool.d.ts +5 -4
  150. package/dist/ui/models/MachineTool.js +184 -0
  151. package/dist/ui/models/MarkingMachine.d.ts +16 -0
  152. package/dist/ui/models/MarkingMachine.js +148 -0
  153. package/dist/ui/models/Rail.d.ts +15 -0
  154. package/dist/ui/models/Rail.js +117 -0
  155. package/dist/ui/models/ResourceStore.d.ts +12 -0
  156. package/dist/ui/models/ResourceStore.js +101 -0
  157. package/dist/ui/models/SingleBot.d.ts +20 -0
  158. package/dist/ui/models/SingleBot.js +202 -0
  159. package/dist/ui/models/SingleGripperRobot.d.ts +19 -0
  160. package/dist/ui/models/SingleGripperRobot.js +272 -0
  161. package/dist/ui/models/SingleJointRobot.d.ts +22 -0
  162. package/dist/ui/models/SingleJointRobot.js +346 -0
  163. package/dist/ui/shapes/NamePlate.d.ts +10 -1
  164. package/dist/ui/shapes/NamePlate.js +85 -0
  165. package/dist/ui/shapes/ScrewHole.d.ts +8 -1
  166. package/dist/ui/shapes/ScrewHole.js +57 -0
  167. package/dist/ui/shapes/Texture.d.ts +12 -3
  168. package/dist/ui/shapes/Texture.js +51 -0
  169. package/dist/ui/utils/attr.d.ts +10 -3
  170. package/dist/ui/utils/attr.js +50 -0
  171. package/dist/utils/index.js +92 -0
  172. package/dist/utils/type-guards.d.ts +1 -1
  173. package/dist/utils/type-guards.js +105 -0
  174. package/package.json +2 -2
@@ -0,0 +1,12 @@
1
+ import type { IResourceStoreConfig, IResourceStoreOperating } from '@/types';
2
+ import { Box } from 'leafer';
3
+ import { ModelAbs } from '../abstract/ModelAbs';
4
+ /**
5
+ * 资源库
6
+ */
7
+ export declare class ResourceStore extends ModelAbs<IResourceStoreConfig> {
8
+ private light;
9
+ private stationSlotGroup;
10
+ protected createUi(): Box;
11
+ protected operating(data: IResourceStoreOperating): void;
12
+ }
@@ -0,0 +1,101 @@
1
+ import { Box } from 'leafer';
2
+ import { ModelAbs } from '../abstract/ModelAbs';
3
+ import { StationSlotGroup } from '../components/StationSlotGroup';
4
+ import { NamePlate } from '../shapes/NamePlate';
5
+ import { Texture } from '../shapes/Texture';
6
+ import { setCursor } from '../utils/attr';
7
+ import { RectLight } from '../components/Light';
8
+ /**
9
+ * 资源库
10
+ */
11
+ export class ResourceStore extends ModelAbs {
12
+ light = null;
13
+ stationSlotGroup = null;
14
+ createUi() {
15
+ const { uuid, className, nameplate, stationSlotGroup, width, height, x, y, zIndex, rotation, scale, visible, editable, draggable } = this.config;
16
+ const cornerRadius = [20, 20, 4, 4];
17
+ // 设备状态灯
18
+ this.light = new RectLight({
19
+ width: 40,
20
+ height: 6,
21
+ x: this.width_05,
22
+ y: 14,
23
+ color: '#2D313B'
24
+ }).init();
25
+ const main = new Box({
26
+ data: this.config,
27
+ id: uuid,
28
+ className,
29
+ x,
30
+ y,
31
+ width,
32
+ height,
33
+ zIndex,
34
+ rotation,
35
+ scale,
36
+ visible,
37
+ editable,
38
+ draggable,
39
+ origin: 'center',
40
+ around: 'center',
41
+ cornerRadius,
42
+ fill: {
43
+ type: 'linear',
44
+ from: 'left',
45
+ to: 'right',
46
+ stops: [
47
+ { offset: 0, color: 'rgba(150,150,150,1)' },
48
+ { offset: 0.1, color: 'rgba(220,220,220,1)' },
49
+ { offset: 0.9, color: 'rgba(220,220,220,1)' },
50
+ { offset: 1, color: 'rgba(150,150,150,1)' }
51
+ ]
52
+ },
53
+ overflow: 'hide',
54
+ shadow: {
55
+ spread: 1,
56
+ blur: 4,
57
+ color: 'rgba(0,0,0,0.5)'
58
+ },
59
+ children: [
60
+ Texture({
61
+ className: 'ResourceStoreTexture',
62
+ width,
63
+ height,
64
+ effect: 'MatrixGrid',
65
+ scale: 0.015,
66
+ opacity: 0.2,
67
+ cornerRadius
68
+ }),
69
+ this.light.ui
70
+ ]
71
+ });
72
+ if (stationSlotGroup) {
73
+ this.stationSlotGroup = new StationSlotGroup({
74
+ ...stationSlotGroup,
75
+ x: this.width_05,
76
+ y: this.height_05,
77
+ hittable: this.config.hittable
78
+ }, this.config.rotation).init();
79
+ main.add(this.stationSlotGroup.ui);
80
+ }
81
+ if (nameplate) {
82
+ main.add(NamePlate({
83
+ title: nameplate,
84
+ x: this.width_05,
85
+ y: height - 14,
86
+ height: 20
87
+ }));
88
+ }
89
+ setCursor(main, this.config);
90
+ return main;
91
+ }
92
+ // 操作
93
+ operating(data) {
94
+ if (data.light && this.light) {
95
+ this.light.operating(data.light);
96
+ }
97
+ if (data.resource && this.stationSlotGroup) {
98
+ this.stationSlotGroup.operating(data.resource);
99
+ }
100
+ }
101
+ }
@@ -0,0 +1,20 @@
1
+ import type { ISingleJointRobotConfig, ISingleGripperRobotOperating } from '@/types'
2
+ import { Box } from 'leafer'
3
+ import { ModelAbs } from '../abstract/ModelAbs'
4
+ /**
5
+ * 单关节机器人(SingleBot)
6
+ * 基于 ModelAbs 重构,保留 Bot.js 核心运行行为:状态灯、沿 X 移动、手臂旋转、夹具切换。
7
+ */
8
+ export declare class SingleBot extends ModelAbs<ISingleJointRobotConfig> {
9
+ private static readonly DEFAULT_WIDTH
10
+ private static readonly DEFAULT_HEIGHT
11
+ private static readonly DEFAULT_LIGHT_COLOR
12
+ private defaultLightColor
13
+ private armRotation
14
+ protected createUi(): Box
15
+ protected operating(data: ISingleGripperRobotOperating): void
16
+ private handleRotate
17
+ private moveX
18
+ private handleLight
19
+ private switchFixture
20
+ }
@@ -0,0 +1,202 @@
1
+ import { Box } from 'leafer'
2
+ import { ModelAbs } from '../abstract/ModelAbs'
3
+ import { setCursor } from '../utils/attr'
4
+ import { NamePlate } from '../shapes/NamePlate'
5
+ /**
6
+ * 单关节机器人(SingleBot)
7
+ * 基于 ModelAbs 重构,保留 Bot.js 核心运行行为:状态灯、沿 X 移动、手臂旋转、夹具切换。
8
+ */
9
+ export class SingleBot extends ModelAbs {
10
+ static DEFAULT_WIDTH = 90
11
+ static DEFAULT_HEIGHT = 76
12
+ static DEFAULT_LIGHT_COLOR = 'rgba(255,255,255,0.2)'
13
+ defaultLightColor = SingleBot.DEFAULT_LIGHT_COLOR
14
+ armRotation = 0
15
+ createUi() {
16
+ const {
17
+ uuid,
18
+ className,
19
+ nameplate,
20
+ width = SingleBot.DEFAULT_WIDTH,
21
+ height = SingleBot.DEFAULT_HEIGHT,
22
+ x,
23
+ y,
24
+ zIndex,
25
+ rotation,
26
+ scale,
27
+ visible,
28
+ editable,
29
+ draggable,
30
+ currentFixture
31
+ } = this.config
32
+ const main = new Box({
33
+ id: uuid,
34
+ className,
35
+ data: this.config,
36
+ width,
37
+ height,
38
+ x,
39
+ y,
40
+ zIndex,
41
+ rotation,
42
+ scale,
43
+ visible,
44
+ editable,
45
+ draggable,
46
+ cornerRadius: 10,
47
+ fill: '#FF9933',
48
+ origin: 'center',
49
+ around: 'center',
50
+ children: [
51
+ {
52
+ className: 'statusLightTop',
53
+ tag: 'Box',
54
+ width: 30,
55
+ height: 4,
56
+ x: width / 2,
57
+ y: 4,
58
+ fill: this.defaultLightColor,
59
+ around: 'center',
60
+ cornerRadius: 4
61
+ },
62
+ {
63
+ className: 'statusLightBottom',
64
+ tag: 'Box',
65
+ width: 30,
66
+ height: 4,
67
+ x: width / 2,
68
+ y: height - 4,
69
+ fill: this.defaultLightColor,
70
+ around: 'center',
71
+ cornerRadius: 4
72
+ },
73
+ {
74
+ className: 'secondBase',
75
+ tag: 'Box',
76
+ width: 70,
77
+ height: 60,
78
+ x: width / 2,
79
+ y: height / 2 + 8,
80
+ around: 'center',
81
+ cornerRadius: 10,
82
+ fill: {
83
+ type: 'radial',
84
+ stops: [
85
+ { offset: 0.3, color: '#FFcc00' },
86
+ { offset: 1, color: '#FF6600' }
87
+ ]
88
+ },
89
+ children: [
90
+ {
91
+ className: 'bigArm',
92
+ tag: 'Box',
93
+ width: 50,
94
+ height: 30,
95
+ x: 0,
96
+ y: -8,
97
+ around: 'center',
98
+ cornerRadius: [15, 3, 3, 15],
99
+ fill: {
100
+ type: 'radial',
101
+ stops: [
102
+ { offset: 0, color: '#FFcc00' },
103
+ { offset: 1, color: '#FF6600' }
104
+ ]
105
+ }
106
+ },
107
+ {
108
+ className: 'smallArm',
109
+ tag: 'Box',
110
+ width: 36,
111
+ height: 16,
112
+ x: 2,
113
+ y: -8,
114
+ around: 'left',
115
+ cornerRadius: [16, 0, 0, 16],
116
+ fill: {
117
+ type: 'linear',
118
+ stops: ['#FF6600', '#FFbb00', '#FF6600']
119
+ },
120
+ children: [
121
+ {
122
+ className: 'fixturePallet',
123
+ tag: 'Box',
124
+ visible: currentFixture !== 'cutter',
125
+ width: 30,
126
+ height: 16,
127
+ x: 26,
128
+ y: 0,
129
+ around: 'left',
130
+ cornerRadius: [8, 2, 2, 8],
131
+ fill: '#424242'
132
+ },
133
+ {
134
+ className: 'fixtureCutter',
135
+ tag: 'Box',
136
+ visible: currentFixture === 'cutter',
137
+ width: 20,
138
+ height: 8,
139
+ x: 26,
140
+ y: 4,
141
+ around: 'left',
142
+ cornerRadius: 4,
143
+ fill: '#333'
144
+ }
145
+ ]
146
+ }
147
+ ]
148
+ }
149
+ ]
150
+ })
151
+ setCursor(main, this.config)
152
+ if (nameplate) {
153
+ main.add(
154
+ NamePlate({
155
+ title: nameplate,
156
+ x: width / 2,
157
+ y: height - 12,
158
+ height: 16
159
+ })
160
+ )
161
+ }
162
+ return main
163
+ }
164
+ operating(data) {
165
+ if (data.light) this.handleLight(data.light)
166
+ if (typeof data.x === 'number') this.moveX(data.x)
167
+ if (typeof data.r === 'number') this.handleRotate(data.r)
168
+ if (data.currentFixture) this.switchFixture(data.currentFixture)
169
+ }
170
+ // 二级基座与摆臂联动旋转
171
+ handleRotate(r) {
172
+ if (!Number.isFinite(r)) return
173
+ this.armRotation = r
174
+ this.ui.findOne('.bigArm')?.animate({ rotation: -r, duration: 0.5 })
175
+ this.ui.findOne('.smallArm')?.animate({ rotation: r, duration: 0.5 })
176
+ this.ui.findOne('.secondBase')?.animate({ offsetX: Math.abs(r / 9) - 10, duration: 0.5 })
177
+ }
178
+ // 在轨道上沿 X 轴移动
179
+ moveX(x) {
180
+ if (!Number.isFinite(x)) return
181
+ this.ui.animate({ x, duration: 0.5 })
182
+ }
183
+ // 状态灯闪烁
184
+ handleLight(val) {
185
+ if (!val) return
186
+ const lights = [this.ui.findOne('.statusLightTop'), this.ui.findOne('.statusLightBottom')]
187
+ lights.forEach((light) => {
188
+ light?.set({
189
+ animation: {
190
+ keyframes: [{ fill: val.color }, { fill: this.defaultLightColor }, { fill: val.color }],
191
+ duration: 0.5,
192
+ loop: Boolean(val.blinking)
193
+ }
194
+ })
195
+ })
196
+ }
197
+ // 切换夹具显示状态
198
+ switchFixture(type) {
199
+ this.ui.findOne('.fixturePallet')?.set({ visible: type === 'pallet' })
200
+ this.ui.findOne('.fixtureCutter')?.set({ visible: type === 'cutter' })
201
+ }
202
+ }
@@ -0,0 +1,19 @@
1
+ import type { ISingleJointRobotConfig, ISingleGripperRobotOperating } from '@/types'
2
+ import { Box } from 'leafer'
3
+ import { ModelAbs } from '../abstract/ModelAbs'
4
+ /**
5
+ * 单关节机器人(SingleJointRobot)
6
+ * 基于 ModelAbs 重构,保留 Bot.js 核心运行行为:状态灯、沿 X 移动、手臂旋转、夹具切换。
7
+ */
8
+ export declare class SingleJointRobot extends ModelAbs<ISingleJointRobotConfig> {
9
+ private static readonly DEFAULT_WIDTH
10
+ private static readonly DEFAULT_HEIGHT
11
+ private static readonly DEFAULT_LIGHT_COLOR
12
+ private defaultLightColor
13
+ protected createUi(): Box
14
+ protected operating(data: ISingleGripperRobotOperating): void
15
+ private handleRotate
16
+ private moveX
17
+ private handleLight
18
+ private switchFixture
19
+ }
@@ -0,0 +1,272 @@
1
+ import { Box } from 'leafer'
2
+ import { ModelAbs } from '../abstract/ModelAbs'
3
+ import { setCursor } from '../utils/attr'
4
+ /**
5
+ * 单关节机器人(SingleJointRobot)
6
+ * 基于 ModelAbs 重构,保留 Bot.js 核心运行行为:状态灯、沿 X 移动、手臂旋转、夹具切换。
7
+ */
8
+ export class SingleJointRobot extends ModelAbs {
9
+ static DEFAULT_WIDTH = 90
10
+ static DEFAULT_HEIGHT = 76
11
+ static DEFAULT_LIGHT_COLOR = 'rgba(255,255,255,0.2)'
12
+ defaultLightColor = SingleJointRobot.DEFAULT_LIGHT_COLOR
13
+ createUi() {
14
+ const {
15
+ uuid,
16
+ className,
17
+ width = SingleJointRobot.DEFAULT_WIDTH,
18
+ height = SingleJointRobot.DEFAULT_HEIGHT,
19
+ x,
20
+ y,
21
+ zIndex,
22
+ rotation,
23
+ scale,
24
+ visible,
25
+ editable,
26
+ draggable,
27
+ currentFixture
28
+ } = this.config
29
+ const main = new Box({
30
+ id: uuid,
31
+ className,
32
+ data: this.config,
33
+ width,
34
+ height,
35
+ x,
36
+ y,
37
+ zIndex,
38
+ rotation,
39
+ scale,
40
+ visible,
41
+ editable,
42
+ draggable,
43
+ cornerRadius: 10,
44
+ fill: '#FF9933',
45
+ origin: 'center',
46
+ around: 'center',
47
+ children: [
48
+ {
49
+ tag: 'Rect',
50
+ x: 5,
51
+ y: 4,
52
+ width,
53
+ height,
54
+ fill: {
55
+ type: 'linear',
56
+ from: 'left',
57
+ to: 'right',
58
+ stops: [
59
+ { offset: 0, color: '#666' },
60
+ { offset: 1, color: '#555' }
61
+ ]
62
+ },
63
+ cornerRadius: 10,
64
+ zIndex: -1
65
+ },
66
+ {
67
+ tag: 'Rect',
68
+ width,
69
+ height,
70
+ fill: '#FF9933',
71
+ cornerRadius: 10,
72
+ zIndex: -1
73
+ },
74
+ {
75
+ className: 'statusLightTop',
76
+ tag: 'Box',
77
+ width: 30,
78
+ height: 4,
79
+ x: width / 2,
80
+ y: 4,
81
+ fill: this.defaultLightColor,
82
+ around: 'center',
83
+ cornerRadius: 4
84
+ },
85
+ {
86
+ className: 'statusLightBottom',
87
+ tag: 'Box',
88
+ width: 30,
89
+ height: 4,
90
+ x: width / 2,
91
+ y: height - 4,
92
+ fill: this.defaultLightColor,
93
+ around: 'center',
94
+ cornerRadius: 4
95
+ },
96
+ {
97
+ className: 'secondBase',
98
+ tag: 'Box',
99
+ width: 70,
100
+ height: 60,
101
+ x: width / 2,
102
+ y: height / 2 + 8,
103
+ around: 'center',
104
+ cornerRadius: 10,
105
+ fill: {
106
+ type: 'radial',
107
+ stops: [
108
+ { offset: 0.3, color: '#FFcc00' },
109
+ { offset: 1, color: '#FF6600' }
110
+ ]
111
+ },
112
+ children: [
113
+ {
114
+ className: 'bigArm',
115
+ tag: 'Box',
116
+ width: 50,
117
+ height: 30,
118
+ x: 0,
119
+ y: -8,
120
+ around: 'center',
121
+ cornerRadius: [15, 3, 3, 15],
122
+ fill: {
123
+ type: 'radial',
124
+ stops: [
125
+ { offset: 0, color: '#FFcc00' },
126
+ { offset: 1, color: '#FF6600' }
127
+ ]
128
+ }
129
+ },
130
+ {
131
+ className: 'smallArm',
132
+ tag: 'Box',
133
+ width: 36,
134
+ height: 16,
135
+ x: 2,
136
+ y: -8,
137
+ around: 'left',
138
+ cornerRadius: [16, 0, 0, 16],
139
+ fill: {
140
+ type: 'linear',
141
+ stops: ['#FF6600', '#FFbb00', '#FF6600']
142
+ },
143
+ children: [
144
+ {
145
+ tag: 'Rect',
146
+ width: 12,
147
+ height: 16,
148
+ fill: '#424242',
149
+ cornerRadius: [26, 10, 10, 26]
150
+ },
151
+ {
152
+ tag: 'Rect',
153
+ x: 36,
154
+ width: 5,
155
+ height: 16,
156
+ fill: '#424242',
157
+ cornerRadius: [0, 16, 16, 0]
158
+ },
159
+ {
160
+ className: 'fixturePallet',
161
+ tag: 'Box',
162
+ visible: currentFixture !== 'cutter',
163
+ width: 65,
164
+ height: 50,
165
+ x: 26,
166
+ y: -17,
167
+ around: 'left',
168
+ cornerRadius: [15, 0, 0, 15],
169
+ strokeWidth: 4,
170
+ stroke: {
171
+ type: 'linear',
172
+ from: 'left',
173
+ to: 'right',
174
+ stops: [
175
+ { offset: 0, color: '#424242' },
176
+ { offset: 0.9, color: '#000' },
177
+ { offset: 0.9, color: 'rgba(255,0,0,0)' },
178
+ { offset: 1, color: 'rgba(255,0,0,0)' }
179
+ ]
180
+ },
181
+ fill: 'rgba(0,0,0,0)',
182
+ animation: {
183
+ keyframes: [
184
+ { opacity: 0, scaleX: 0 },
185
+ { opacity: 1, scaleX: 1 }
186
+ ],
187
+ duration: 0.3
188
+ }
189
+ },
190
+ {
191
+ className: 'fixtureCutter',
192
+ tag: 'Box',
193
+ visible: currentFixture === 'cutter',
194
+ width: 40,
195
+ height: 12,
196
+ x: 26,
197
+ y: 2,
198
+ around: 'left',
199
+ cornerRadius: 4,
200
+ fill: {
201
+ type: 'linear',
202
+ from: 'left',
203
+ to: 'right',
204
+ stops: [
205
+ { offset: 0, color: '#424242' },
206
+ { offset: 0.75, color: '#666' },
207
+ { offset: 0.75, color: '#333' },
208
+ { offset: 1, color: '#333' }
209
+ ]
210
+ },
211
+ children: [
212
+ {
213
+ tag: 'Box',
214
+ width: 6,
215
+ height: 2,
216
+ x: 34,
217
+ y: 2,
218
+ fill: '#666'
219
+ },
220
+ {
221
+ tag: 'Box',
222
+ width: 6,
223
+ height: 2,
224
+ x: 34,
225
+ y: 8,
226
+ fill: '#666'
227
+ }
228
+ ]
229
+ }
230
+ ]
231
+ }
232
+ ]
233
+ }
234
+ ]
235
+ })
236
+ setCursor(main, this.config)
237
+ return main
238
+ }
239
+ operating(data) {
240
+ if (data.light) this.handleLight(data.light)
241
+ if (typeof data.x === 'number') this.moveX(data.x)
242
+ if (typeof data.r === 'number') this.handleRotate(data.r)
243
+ if (data.currentFixture) this.switchFixture(data.currentFixture)
244
+ }
245
+ handleRotate(r) {
246
+ if (!Number.isFinite(r)) return
247
+ this.ui.findOne('.bigArm')?.animate({ rotation: -r, duration: 0.5 })
248
+ this.ui.findOne('.smallArm')?.animate({ rotation: r, duration: 0.5 })
249
+ this.ui.findOne('.secondBase')?.animate({ offsetX: Math.abs(r / 9) - 10, duration: 0.5 })
250
+ }
251
+ moveX(x) {
252
+ if (!Number.isFinite(x)) return
253
+ this.ui.animate({ x, duration: 0.5 })
254
+ }
255
+ handleLight(val) {
256
+ if (!val) return
257
+ const lights = [this.ui.findOne('.statusLightTop'), this.ui.findOne('.statusLightBottom')]
258
+ lights.forEach((light) => {
259
+ light?.set({
260
+ animation: {
261
+ keyframes: [{ fill: val.color }, { fill: this.defaultLightColor }, { fill: val.color }],
262
+ duration: 0.5,
263
+ loop: Boolean(val.blinking)
264
+ }
265
+ })
266
+ })
267
+ }
268
+ switchFixture(type) {
269
+ this.ui.findOne('.fixturePallet')?.set({ visible: type === 'pallet' })
270
+ this.ui.findOne('.fixtureCutter')?.set({ visible: type === 'cutter' })
271
+ }
272
+ }
@@ -0,0 +1,22 @@
1
+ import { type ISingleJointRobotConfig, type ISingleGripperRobotOperating } from '@/types';
2
+ import { Box } from 'leafer';
3
+ import { ModelAbs } from '../abstract/ModelAbs';
4
+ /**
5
+ * 单关节机器人(SingleGripperRobot)
6
+ * 基于 ModelAbs 重构,保留 Bot.js 核心运行行为:状态灯、沿 X 移动、手臂旋转、夹具切换。
7
+ */
8
+ export declare class SingleJointRobot extends ModelAbs<ISingleJointRobotConfig> {
9
+ private static readonly DEFAULT_WIDTH;
10
+ private static readonly DEFAULT_HEIGHT;
11
+ private static readonly DEFAULT_LIGHT_COLOR;
12
+ private light1;
13
+ private light2;
14
+ private defaultLightColor;
15
+ private palletStationSlot;
16
+ private cutterStationSlot;
17
+ protected createUi(): Box;
18
+ protected operating(data: ISingleGripperRobotOperating): void;
19
+ private handleRotate;
20
+ private moveX;
21
+ private switchFork;
22
+ }