dsh-drawai 0.4.1 → 0.4.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.
- package/README.md +95 -253
- package/lib/client.js +28 -7
- package/lib/index.js +7719 -7400
- package/lib/motion/asset-pack.js +394 -335
- package/lib/motion/demo-assets-lock.js +10 -0
- package/lib/motion/mgstyles/vendor/README.md +28 -0
- package/lib/motion/mgstyles/vendor/modules/d3/LICENSE +13 -0
- package/lib/motion/mgstyles/vendor/modules/d3/dist/d3.min.js +2 -0
- package/lib/motion/mgstyles/vendor/modules/opentype.js/LICENSE +20 -0
- package/lib/motion/mgstyles/vendor/modules/opentype.js/dist/opentype.mjs +14460 -0
- package/lib/motion/mgstyles/vendor/modules/simplex-noise/LICENSE +21 -0
- package/lib/motion/mgstyles/vendor/modules/simplex-noise/dist/esm/simplex-noise.js +466 -0
- package/lib/motion/mgstyles/vendor/modules/topojson-client/LICENSE +13 -0
- package/lib/motion/mgstyles/vendor/modules/topojson-client/dist/topojson-client.min.js +2 -0
- package/lib/motion/preview.js +10 -3
- package/lib/motion/render.js +179 -161
- package/lib/motion/style-frames.js +306 -271
- package/lib/motion/sync.js +214 -214
- package/lib/motion-project.js +105 -86
- package/lib/motion-render-worker.js +174 -152
- package/lib/routing/router.js +222 -211
- package/lib/routing/vendor/README.md +96 -96
- package/lib/routing/vendor/libavoid-routing.js +753 -753
- package/lib/routing/vendor/libavoid.min.js +59 -59
- package/lib/style-kernel.js +16 -6
- package/package.json +1 -1
package/lib/style-kernel.js
CHANGED
|
@@ -152,9 +152,16 @@ var DASH_PRESETS = {
|
|
|
152
152
|
/** 线型枚举顺序。 */
|
|
153
153
|
var DASH_KINDS = ['solid', 'dashed', 'dotted']
|
|
154
154
|
|
|
155
|
-
/**
|
|
155
|
+
/**
|
|
156
|
+
* 箭头枚举 → style 键。
|
|
157
|
+
*
|
|
158
|
+
* `none` 必须**显式写 `endArrow=none`**:drawio 的 defaultEdge 自带
|
|
159
|
+
* `endArrow=classic`(`mxStylesheet.createDefaultEdgeStyle`),删键只会让这条边
|
|
160
|
+
* 回落到缺省,箭头反而又长出来。`=none` 才是在合并后的样式里把这个键删掉
|
|
161
|
+
* (`mxStylesheet.getCellStyle`:value 为 `none` 时 delete),从而真的不画。
|
|
162
|
+
*/
|
|
156
163
|
var ARROW_PRESETS = {
|
|
157
|
-
none:
|
|
164
|
+
none: { endArrow: 'none' },
|
|
158
165
|
end: { endArrow: 'classic' },
|
|
159
166
|
both: { endArrow: 'classic', startArrow: 'classic' },
|
|
160
167
|
start: { startArrow: 'classic' },
|
|
@@ -655,7 +662,10 @@ function arrowValueIsSet(value) {
|
|
|
655
662
|
|
|
656
663
|
/** style → 箭头枚举。 */
|
|
657
664
|
function arrowFromStyle(style) {
|
|
658
|
-
|
|
665
|
+
// 按 drawio 的**有效样式**算:mxStylesheet.getCellStyle 会先把 defaultEdge 合进来,
|
|
666
|
+
// 而 defaultEdge 自带 endArrow=classic —— 所以缺键不是"没有箭头",是有 classic。
|
|
667
|
+
// startArrow 不在 defaultEdge 里,缺键才是真的没有。
|
|
668
|
+
var end = arrowValueIsSet(styleGet(style, 'endArrow', 'classic'))
|
|
659
669
|
var start = arrowValueIsSet(styleGet(style, 'startArrow', null))
|
|
660
670
|
if (end && start) return 'both'
|
|
661
671
|
if (end) return 'end'
|
|
@@ -663,12 +673,12 @@ function arrowFromStyle(style) {
|
|
|
663
673
|
return 'none'
|
|
664
674
|
}
|
|
665
675
|
|
|
666
|
-
/** 箭头枚举 → style。none
|
|
676
|
+
/** 箭头枚举 → style。none 写 `endArrow=none`;null/undefined 才是"删键回落到 drawio 缺省"。 */
|
|
667
677
|
function styleWithArrow(style, kind) {
|
|
668
678
|
var cleared = stylePatch(style, { endArrow: null, startArrow: null })
|
|
669
|
-
if (kind === null || kind === undefined
|
|
679
|
+
if (kind === null || kind === undefined) return cleared
|
|
670
680
|
var preset = ARROW_PRESETS[kind]
|
|
671
|
-
if (preset === undefined
|
|
681
|
+
if (preset === undefined) return cleared
|
|
672
682
|
return stylePatch(cleared, preset)
|
|
673
683
|
}
|
|
674
684
|
|