@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,92 @@
1
+ /**
2
+ * @Author : TanRui
3
+ * @WeChat : Tan578853789
4
+ * @File : index.ts
5
+ * @Date : 2025/04/29
6
+ * @Desc. : 工具类
7
+ */
8
+ /**
9
+ * 数字生成器
10
+ * @param {*} start 起始值
11
+ * @param {*} end 结束值
12
+ * @param {*} shouldLoop 是否无限循环
13
+ * @returns
14
+ */
15
+ export function* numberLoopGenerator(start, end, shouldLoop = false) {
16
+ let current = start;
17
+ while (true) {
18
+ // 使用无限循环
19
+ if (current > end) {
20
+ if (!shouldLoop) {
21
+ return;
22
+ }
23
+ else {
24
+ current = start;
25
+ }
26
+ }
27
+ yield current++;
28
+ }
29
+ }
30
+ /**
31
+ * 在 n 秒内把变量从值 x 线性递增到 y
32
+ * @param {*} x 初始值
33
+ * @param {*} y 结束值
34
+ * @param {*} n 递增时长
35
+ * @param {*} rate 帧率(别低于100否则进度条动画来不及显示)
36
+ * @param {*} callback 回调函数
37
+ * @returns
38
+ */
39
+ export const linearIncrease = (x = 0, y = 100, n = 3, rate = 300, callback) => {
40
+ if (!callback) {
41
+ return false;
42
+ }
43
+ return new Promise((resolve) => {
44
+ // if (x >= y) {
45
+ // resolve()
46
+ // return
47
+ // }
48
+ const start = x;
49
+ const target = y;
50
+ let elapsed = 0;
51
+ const duration = n * 1000;
52
+ const interval = setInterval(() => {
53
+ elapsed += rate;
54
+ // 计算进度 [0 ~ 1]
55
+ const progress = Math.min(elapsed / duration, 1);
56
+ // 线性插值
57
+ const currentValue = start + (target - start) * progress;
58
+ callback(currentValue.toFixed(2));
59
+ // 如果动画完成
60
+ if (progress === 1) {
61
+ clearInterval(interval);
62
+ resolve;
63
+ }
64
+ }, rate);
65
+ });
66
+ };
67
+ /**
68
+ * 根据百分比数字转换为像素,或者根据像素转换为百分比
69
+ * @param {number} val - 百分比数字(范围 0 ~ 1),或者像素数字
70
+ * @param {number} size - 尺寸,用于计算百分比
71
+ * @param {number} [precision=3] - 保留的小数位数,默认为 3
72
+ * @param {boolean} [getPercent=false] - 是否返回百分比,默认为 false
73
+ * @returns {number} 转换后的像素值
74
+ */
75
+ export function transPercentAndPixel(val, size, precision = 3, getPercent) {
76
+ if (val === undefined || size === undefined) {
77
+ return 0;
78
+ }
79
+ if (getPercent) {
80
+ return size > 0 ? Number((val / size).toFixed(3)) : 0;
81
+ }
82
+ return Number((size * val).toFixed(precision));
83
+ }
84
+ // 百分比转换小数
85
+ export function transFraction(val, size) {
86
+ if (val === undefined || size === undefined)
87
+ return 0;
88
+ if (size > 0) {
89
+ return Number((val / size).toFixed(3));
90
+ }
91
+ return val;
92
+ }
@@ -1,4 +1,4 @@
1
- import { ICase, IScene, ILayer } from '../types';
1
+ import type { ICase, IScene, ILayer } from '@/types';
2
2
  /**
3
3
  * 校验 IScene
4
4
  */
@@ -0,0 +1,105 @@
1
+ /**
2
+ * 校验 IScene
3
+ */
4
+ function isIScene(scene) {
5
+ if (!scene || typeof scene !== 'object')
6
+ return false;
7
+ // 校验 width 和 height
8
+ if (typeof scene.width !== 'number' || typeof scene.height !== 'number') {
9
+ console.error('isIScene: width must be a number');
10
+ return false;
11
+ }
12
+ // 校验 zoomType
13
+ const validZoomType = scene.zoomType === 'fit' || typeof scene.zoomType === 'number';
14
+ if (!validZoomType) {
15
+ console.error('isIScene: zoomType must be "fit" or a number');
16
+ return false;
17
+ }
18
+ // 校验 fill
19
+ if (scene.fill) {
20
+ const f = scene.fill;
21
+ if (typeof f !== 'object')
22
+ return false;
23
+ const validTypes = ['solid', 'linear', 'radial', 'image'];
24
+ if (!validTypes.includes(f.type))
25
+ return false;
26
+ if (typeof f.color !== 'string')
27
+ return false;
28
+ if (typeof f.opacity !== 'number')
29
+ return false;
30
+ if (f.stops && !Array.isArray(f.stops))
31
+ return false;
32
+ }
33
+ if (scene.stroke && typeof scene.stroke !== 'object') {
34
+ console.error('isIScene: stroke must be an object');
35
+ return false;
36
+ }
37
+ return true;
38
+ }
39
+ /**
40
+ * 校验 ILayer
41
+ */
42
+ function isILayer(layer) {
43
+ if (!layer || typeof layer !== 'object')
44
+ return false;
45
+ if (typeof layer.uuid !== 'string') {
46
+ console.error('isILayer: uuid must be a string');
47
+ return false;
48
+ }
49
+ if (typeof layer.className !== 'string') {
50
+ console.error('isILayer: className must be a string');
51
+ return false;
52
+ }
53
+ // 递归检查 children
54
+ if (layer.children) {
55
+ if (!Array.isArray(layer.children))
56
+ return false;
57
+ // 这里直接调用 isValidLayer,因为是 function 声明,顺序无所谓
58
+ if (!layer.children.every((child) => isILayer(child)))
59
+ return false;
60
+ }
61
+ if (layer.fill && typeof layer.fill !== 'object')
62
+ return false;
63
+ if (layer.selected !== undefined && typeof layer.selected !== 'boolean')
64
+ return false;
65
+ return true;
66
+ }
67
+ /**
68
+ * 校验 ICase
69
+ */
70
+ function isICase(item) {
71
+ if (!item || typeof item !== 'object')
72
+ return false;
73
+ if (typeof item.uuid !== 'string') {
74
+ console.error('isICase: uuid must be a string');
75
+ return false;
76
+ }
77
+ if (typeof item.title !== 'string') {
78
+ console.error('isICase: title must be a string');
79
+ return false;
80
+ }
81
+ if (typeof item.isActive !== 'boolean') {
82
+ console.error('isICase: isActive must be a boolean');
83
+ return false;
84
+ }
85
+ if (!Array.isArray(item.layers))
86
+ return false;
87
+ // 调用辅助函数
88
+ if (!item.layers.every((layer) => isILayer(layer)))
89
+ return false;
90
+ if (!isIScene(item.scene))
91
+ return false;
92
+ return true;
93
+ }
94
+ /**
95
+ * 顶层数组守卫
96
+ */
97
+ function isICaseArray(data) {
98
+ if (!Array.isArray(data)) {
99
+ console.error('isICaseArray: data must be an array');
100
+ return false;
101
+ }
102
+ return data.every((item) => isICase(item));
103
+ }
104
+ // 统一导出
105
+ export { isICase, isICaseArray, isILayer, isIScene };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jnrs/lingshu-smart",
3
- "version": "2.2.6",
3
+ "version": "2.2.8",
4
4
  "description": "LingShu Smart 2D Digital Twin System.",
5
5
  "keywords": [
6
6
  "jnrs",
@@ -45,7 +45,7 @@
45
45
  "pinia-plugin-persistedstate": "^4.7.1",
46
46
  "vue": "^3.5.22",
47
47
  "vue-i18n": "^9.14.5",
48
- "@jnrs/shared": "1.1.18"
48
+ "@jnrs/shared": "1.1.23"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@types/lodash-es": "^4.17.12",