@flowgram-vue/core 0.2.0
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/LICENSE +22 -0
- package/dist/index.cjs +0 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +0 -0
- package/dist/index.js.map +1 -0
- package/package.json +63 -0
- package/src/common/config-entity.ts +80 -0
- package/src/common/entity-data.ts +171 -0
- package/src/common/entity-manager-contribution.ts +12 -0
- package/src/common/entity-manager.ts +475 -0
- package/src/common/entity.ts +482 -0
- package/src/common/index.ts +22 -0
- package/src/common/playground-context.ts +35 -0
- package/src/common/playground-decorator-helper.ts +113 -0
- package/src/common/playground-decorators.ts +85 -0
- package/src/common/playground-schedule.ts +30 -0
- package/src/common/protect-wheel-area.ts +11 -0
- package/src/common/schema/index.ts +14 -0
- package/src/common/schema/node.ts +15 -0
- package/src/common/schema/opacity-schema.ts +19 -0
- package/src/common/schema/origin-schema.ts +35 -0
- package/src/common/schema/position-schema.ts +35 -0
- package/src/common/schema/rotation-schema.ts +19 -0
- package/src/common/schema/scale-schema.ts +35 -0
- package/src/common/schema/size-schema.ts +42 -0
- package/src/common/schema/skew-schema.ts +35 -0
- package/src/common/schema/transform-schema.ts +613 -0
- package/src/common/utils/bounds.spec.ts +229 -0
- package/src/common/utils/bounds.ts +176 -0
- package/src/common/utils/index.ts +6 -0
- package/src/composables/index.ts +16 -0
- package/src/composables/use-config-entity.ts +31 -0
- package/src/composables/use-entities.ts +26 -0
- package/src/composables/use-entity-data-from-context.ts +34 -0
- package/src/composables/use-entity-from-context.ts +31 -0
- package/src/composables/use-listen-events.ts +22 -0
- package/src/composables/use-playground-container.ts +16 -0
- package/src/composables/use-playground-context.ts +15 -0
- package/src/composables/use-playground-drag.ts +31 -0
- package/src/composables/use-playground.ts +16 -0
- package/src/composables/use-refresh.ts +6 -0
- package/src/composables/use-service.ts +17 -0
- package/src/core/index.ts +8 -0
- package/src/core/layer/config/editor-state-config-entity.ts +180 -0
- package/src/core/layer/config/index.ts +7 -0
- package/src/core/layer/config/playground-config-entity.ts +604 -0
- package/src/core/layer/index.ts +8 -0
- package/src/core/layer/layer.ts +248 -0
- package/src/core/layer/playground-layer.ts +547 -0
- package/src/core/pipeline/index.ts +10 -0
- package/src/core/pipeline/pipeline-entities-selector.ts +200 -0
- package/src/core/pipeline/pipeline-entities.ts +230 -0
- package/src/core/pipeline/pipeline-registry.ts +344 -0
- package/src/core/pipeline/pipeline-renderer.ts +248 -0
- package/src/core/pipeline/pipeline-vue-utils.ts +96 -0
- package/src/core/pipeline/pipeline.ts +28 -0
- package/src/core/utils/index.ts +12 -0
- package/src/core/utils/inject-provider-decorators.ts +27 -0
- package/src/core/utils/lazy-inject-decorators.ts +38 -0
- package/src/core/utils/mouse-touch-event.ts +120 -0
- package/src/core/utils/playground-drag.ts +511 -0
- package/src/core/utils/playground-gesture.spec.ts +135 -0
- package/src/core/utils/playground-gesture.ts +118 -0
- package/src/core/utils/tween.ts +156 -0
- package/src/core/utils/use-gesture/core/Controller.ts +212 -0
- package/src/core/utils/use-gesture/core/EventStore.ts +46 -0
- package/src/core/utils/use-gesture/core/TimeoutStore.ts +28 -0
- package/src/core/utils/use-gesture/core/actions.ts +63 -0
- package/src/core/utils/use-gesture/core/config/commonConfigResolver.ts +86 -0
- package/src/core/utils/use-gesture/core/config/coordinatesConfigResolver.ts +48 -0
- package/src/core/utils/use-gesture/core/config/dragConfigResolver.ts +140 -0
- package/src/core/utils/use-gesture/core/config/hoverConfigResolver.ts +11 -0
- package/src/core/utils/use-gesture/core/config/moveConfigResolver.ts +11 -0
- package/src/core/utils/use-gesture/core/config/pinchConfigResolver.ts +59 -0
- package/src/core/utils/use-gesture/core/config/resolver.ts +70 -0
- package/src/core/utils/use-gesture/core/config/scrollConfigResolver.ts +8 -0
- package/src/core/utils/use-gesture/core/config/sharedConfigResolver.ts +28 -0
- package/src/core/utils/use-gesture/core/config/support.ts +52 -0
- package/src/core/utils/use-gesture/core/config/wheelConfigResolver.ts +8 -0
- package/src/core/utils/use-gesture/core/engines/CoordinatesEngine.ts +78 -0
- package/src/core/utils/use-gesture/core/engines/DragEngine.ts +403 -0
- package/src/core/utils/use-gesture/core/engines/Engine.ts +406 -0
- package/src/core/utils/use-gesture/core/engines/HoverEngine.ts +43 -0
- package/src/core/utils/use-gesture/core/engines/MoveEngine.ts +52 -0
- package/src/core/utils/use-gesture/core/engines/PinchEngine.ts +345 -0
- package/src/core/utils/use-gesture/core/engines/ScrollEngine.ts +42 -0
- package/src/core/utils/use-gesture/core/engines/WheelEngine.ts +48 -0
- package/src/core/utils/use-gesture/core/index.ts +7 -0
- package/src/core/utils/use-gesture/core/parser.ts +92 -0
- package/src/core/utils/use-gesture/core/types/action.ts +19 -0
- package/src/core/utils/use-gesture/core/types/config.ts +255 -0
- package/src/core/utils/use-gesture/core/types/handlers.ts +73 -0
- package/src/core/utils/use-gesture/core/types/index.ts +11 -0
- package/src/core/utils/use-gesture/core/types/internalConfig.ts +80 -0
- package/src/core/utils/use-gesture/core/types/state.ts +275 -0
- package/src/core/utils/use-gesture/core/types/utils.ts +204 -0
- package/src/core/utils/use-gesture/core/types.ts +8 -0
- package/src/core/utils/use-gesture/core/utils/events.ts +158 -0
- package/src/core/utils/use-gesture/core/utils/fn.ts +32 -0
- package/src/core/utils/use-gesture/core/utils/maths.ts +63 -0
- package/src/core/utils/use-gesture/core/utils/state.ts +24 -0
- package/src/core/utils/use-gesture/core/utils.ts +8 -0
- package/src/core/utils/use-gesture/index.ts +6 -0
- package/src/core/utils/use-gesture/vanilla/DragGesture.ts +27 -0
- package/src/core/utils/use-gesture/vanilla/Gesture.ts +45 -0
- package/src/core/utils/use-gesture/vanilla/HoverGesture.ts +27 -0
- package/src/core/utils/use-gesture/vanilla/MoveGesture.ts +27 -0
- package/src/core/utils/use-gesture/vanilla/PinchGesture.ts +27 -0
- package/src/core/utils/use-gesture/vanilla/Recognizer.ts +43 -0
- package/src/core/utils/use-gesture/vanilla/ScrollGesture.ts +27 -0
- package/src/core/utils/use-gesture/vanilla/WheelGesture.ts +27 -0
- package/src/core/utils/use-gesture/vanilla/createGesture.ts +18 -0
- package/src/core/utils/use-gesture/vanilla/index.ts +18 -0
- package/src/env.d.ts +10 -0
- package/src/index.ts +17 -0
- package/src/playground-config.ts +70 -0
- package/src/playground-container.ts +129 -0
- package/src/playground-contribution.ts +81 -0
- package/src/playground-mock-tools.ts +143 -0
- package/src/playground.ts +401 -0
- package/src/plugin/index.ts +6 -0
- package/src/plugin/plugin.ts +226 -0
- package/src/services/clipboard-service.ts +40 -0
- package/src/services/context-menu-service.ts +25 -0
- package/src/services/index.ts +10 -0
- package/src/services/logger-service.ts +49 -0
- package/src/services/selection-service.ts +54 -0
- package/src/services/storage-service.ts +65 -0
- package/src/vue/index.ts +8 -0
- package/src/vue/playground-vue-context.ts +22 -0
- package/src/vue/playground-vue-provider.ts +115 -0
- package/src/vue/playground-vue-renderer.vue +44 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
// ABLES_DECO_KEY,
|
|
8
|
+
ENTITIES_DECO_KEY,
|
|
9
|
+
// HANDLE_DECO_KEY,
|
|
10
|
+
// PAYLOAD_DECO_KEY,
|
|
11
|
+
createRegistryDecorator,
|
|
12
|
+
ENTITIES_BY_DATA_DECO_KEY,
|
|
13
|
+
type RegistryValueGetter,
|
|
14
|
+
} from './playground-decorator-helper';
|
|
15
|
+
// import type { AbleRegistry } from './able';
|
|
16
|
+
import type { Entity, EntityDataRegistry, EntityRegistry } from '.';
|
|
17
|
+
// import type { Layer } from './layer';
|
|
18
|
+
|
|
19
|
+
// export function observeAble(registry: AbleRegistry): any {
|
|
20
|
+
// const getValue: RegistryValueGetter<Entity[]> = (target: any) =>
|
|
21
|
+
// target.observeManager.getEntitiesByAble(registry);
|
|
22
|
+
// return createRegistryDecorator(ABLES_DECO_KEY, [registry], getValue);
|
|
23
|
+
// }
|
|
24
|
+
|
|
25
|
+
// /**
|
|
26
|
+
// * @param andAbles - 多个 able,条件且
|
|
27
|
+
// * @param orAbles - 多个 able,条件或
|
|
28
|
+
// */
|
|
29
|
+
// export function observeAbles(andAbles: AbleRegistry[], orAbles: AbleRegistry[] = []): any {
|
|
30
|
+
// const getValue: RegistryValueGetter<Entity[]> = (target: any) =>
|
|
31
|
+
// target.observeManager.getEntitiesByAbles(andAbles, orAbles);
|
|
32
|
+
// return createRegistryDecorator(ABLES_DECO_KEY, andAbles.concat(orAbles), getValue);
|
|
33
|
+
// }
|
|
34
|
+
export function observeEntity(registry: EntityRegistry): any {
|
|
35
|
+
const getValue: RegistryValueGetter<Entity> = (target: any) =>
|
|
36
|
+
target.observeManager.get(registry)!;
|
|
37
|
+
return createRegistryDecorator(ENTITIES_DECO_KEY, registry, getValue);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* 监听 entity 变化
|
|
42
|
+
* @param registry
|
|
43
|
+
*/
|
|
44
|
+
export function observeEntities(registry: EntityRegistry): any {
|
|
45
|
+
const getValue: RegistryValueGetter<Entity[]> = (target: any) =>
|
|
46
|
+
target.observeManager.getEntities(registry);
|
|
47
|
+
return createRegistryDecorator(ENTITIES_DECO_KEY, registry, getValue);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// export function payload(payloadKey: string | symbol): any {
|
|
51
|
+
// const check = (target: any, method: string) => {
|
|
52
|
+
// if (method !== 'payload')
|
|
53
|
+
// throw new Error(`@payload() should be used by "payload" method but get "${method}".`);
|
|
54
|
+
// };
|
|
55
|
+
// // @ts-ignore
|
|
56
|
+
// return createRegistryDecorator(PAYLOAD_DECO_KEY, payloadKey, undefined, check);
|
|
57
|
+
// }
|
|
58
|
+
|
|
59
|
+
// export function params(...registries: EntityDataRegistry[]): any {
|
|
60
|
+
// const check = (target: any, method: string) => {
|
|
61
|
+
// if (method !== 'handle')
|
|
62
|
+
// throw new Error(`@params() should be used by "handle" method but get "${method}".`);
|
|
63
|
+
// };
|
|
64
|
+
// // @ts-ignore
|
|
65
|
+
// return createRegistryDecorator(HANDLE_DECO_KEY, registries, undefined, check);
|
|
66
|
+
// }
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* 监听 entity 对应的 data 数据变化
|
|
70
|
+
*
|
|
71
|
+
* @param entityRegistry
|
|
72
|
+
* @param dataRegistry
|
|
73
|
+
*/
|
|
74
|
+
export function observeEntityDatas(
|
|
75
|
+
entityRegistry: EntityRegistry,
|
|
76
|
+
dataRegistry: EntityDataRegistry,
|
|
77
|
+
): any {
|
|
78
|
+
const getValue: RegistryValueGetter<Entity[]> = (target: any) =>
|
|
79
|
+
target.observeManager.getEntityDatas(entityRegistry, dataRegistry);
|
|
80
|
+
return createRegistryDecorator(
|
|
81
|
+
ENTITIES_BY_DATA_DECO_KEY,
|
|
82
|
+
{ entity: entityRegistry, data: dataRegistry },
|
|
83
|
+
getValue,
|
|
84
|
+
);
|
|
85
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { throttle } from 'lodash-es';
|
|
7
|
+
import { type Disposable } from '@flowgram-vue/utils';
|
|
8
|
+
|
|
9
|
+
// TODO 先用 throttle 替代
|
|
10
|
+
export class PlaygroundSchedule implements Disposable {
|
|
11
|
+
protected execMap: Map<any, () => void> = new Map();
|
|
12
|
+
|
|
13
|
+
push(key: any, fn: () => void): void {
|
|
14
|
+
const { execMap } = this;
|
|
15
|
+
if (process.env.NODE_ENV === 'test') {
|
|
16
|
+
fn();
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
let schedule = execMap.get(key);
|
|
20
|
+
if (!schedule) {
|
|
21
|
+
schedule = throttle(fn, 0) as () => void;
|
|
22
|
+
execMap.set(key, schedule);
|
|
23
|
+
}
|
|
24
|
+
schedule();
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
dispose(): void {
|
|
28
|
+
this.execMap.clear();
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* 保护区域不被画布劫持滚动事件
|
|
8
|
+
*/
|
|
9
|
+
export const ProtectWheelArea = Symbol('ProtectWheelArea');
|
|
10
|
+
|
|
11
|
+
export type ProtectWheelArea = (dom: Element) => boolean;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export * from './node';
|
|
7
|
+
export * from './origin-schema';
|
|
8
|
+
export * from './opacity-schema';
|
|
9
|
+
export * from './position-schema';
|
|
10
|
+
export * from './rotation-schema';
|
|
11
|
+
export * from './scale-schema';
|
|
12
|
+
export * from './size-schema';
|
|
13
|
+
export * from './skew-schema';
|
|
14
|
+
export * from './transform-schema';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { type TransformSchema } from './transform-schema';
|
|
7
|
+
|
|
8
|
+
export interface NodeSchema {
|
|
9
|
+
id: string;
|
|
10
|
+
name?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface TransformNodeSchema extends NodeSchema {
|
|
14
|
+
transform: TransformSchema;
|
|
15
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { OpacitySchemaDecoration, Schema } from '@flowgram-vue/utils';
|
|
7
|
+
import type { OpacitySchema } from '@flowgram-vue/utils';
|
|
8
|
+
|
|
9
|
+
import { EntityData } from '../entity-data';
|
|
10
|
+
|
|
11
|
+
export { OpacitySchema, OpacitySchemaDecoration };
|
|
12
|
+
|
|
13
|
+
export class OpacityData extends EntityData<OpacitySchema> {
|
|
14
|
+
static type = 'OpacityData';
|
|
15
|
+
|
|
16
|
+
getDefaultData(): OpacitySchema {
|
|
17
|
+
return Schema.createDefault<OpacitySchema>(OpacitySchemaDecoration);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { OriginSchemaDecoration, Schema } from '@flowgram-vue/utils';
|
|
7
|
+
import type { OriginSchema } from '@flowgram-vue/utils';
|
|
8
|
+
|
|
9
|
+
import { EntityData } from '../entity-data';
|
|
10
|
+
|
|
11
|
+
export { OriginSchema, OriginSchemaDecoration };
|
|
12
|
+
|
|
13
|
+
export class OriginData extends EntityData<OriginSchema> implements OriginSchema {
|
|
14
|
+
static type = 'OriginData';
|
|
15
|
+
|
|
16
|
+
getDefaultData(): OriginSchema {
|
|
17
|
+
return Schema.createDefault<OriginSchema>(OriginSchemaDecoration);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
get x(): number {
|
|
21
|
+
return this.data.x;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
get y(): number {
|
|
25
|
+
return this.data.y;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
set x(x: number) {
|
|
29
|
+
this.update('x', x);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
set y(y: number) {
|
|
33
|
+
this.update('y', y);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { PositionSchemaDecoration, Schema } from '@flowgram-vue/utils';
|
|
7
|
+
import type { PositionSchema } from '@flowgram-vue/utils';
|
|
8
|
+
|
|
9
|
+
import { EntityData } from '../entity-data';
|
|
10
|
+
|
|
11
|
+
export { PositionSchema, PositionSchemaDecoration };
|
|
12
|
+
|
|
13
|
+
export class PositionData extends EntityData<PositionSchema> implements PositionSchema {
|
|
14
|
+
static type = 'PositionData';
|
|
15
|
+
|
|
16
|
+
getDefaultData(): PositionSchema {
|
|
17
|
+
return Schema.createDefault<PositionSchema>(PositionSchemaDecoration);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
get x(): number {
|
|
21
|
+
return this.data.x;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
get y(): number {
|
|
25
|
+
return this.data.y;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
set x(x: number) {
|
|
29
|
+
this.update('x', x);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
set y(y: number) {
|
|
33
|
+
this.update('y', y);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { RotationSchemaDecoration, Schema } from '@flowgram-vue/utils';
|
|
7
|
+
import type { RotationSchema } from '@flowgram-vue/utils';
|
|
8
|
+
|
|
9
|
+
import { EntityData } from '../entity-data';
|
|
10
|
+
|
|
11
|
+
export { RotationSchema, RotationSchemaDecoration };
|
|
12
|
+
|
|
13
|
+
export class RotationData extends EntityData<RotationSchema> {
|
|
14
|
+
static type = 'RotationData';
|
|
15
|
+
|
|
16
|
+
getDefaultData(): RotationSchema {
|
|
17
|
+
return Schema.createDefault<RotationSchema>(RotationSchemaDecoration);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { ScaleSchemaDecoration, Schema } from '@flowgram-vue/utils';
|
|
7
|
+
import type { ScaleSchema } from '@flowgram-vue/utils';
|
|
8
|
+
|
|
9
|
+
import { EntityData } from '../entity-data';
|
|
10
|
+
|
|
11
|
+
export { ScaleSchema, ScaleSchemaDecoration };
|
|
12
|
+
|
|
13
|
+
export class ScaleData extends EntityData<ScaleSchema> implements ScaleSchema {
|
|
14
|
+
static type = 'ScaleData';
|
|
15
|
+
|
|
16
|
+
getDefaultData(): ScaleSchema {
|
|
17
|
+
return Schema.createDefault(ScaleSchemaDecoration);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
get x(): number {
|
|
21
|
+
return this.data.x;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
get y(): number {
|
|
25
|
+
return this.data.y;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
set x(x: number) {
|
|
29
|
+
this.update('x', x);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
set y(y: number) {
|
|
33
|
+
this.update('y', y);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { SizeSchema, SizeSchemaDecoration, Schema } from '@flowgram-vue/utils';
|
|
7
|
+
|
|
8
|
+
import { EntityData } from '../entity-data';
|
|
9
|
+
|
|
10
|
+
export { SizeSchema, SizeSchemaDecoration };
|
|
11
|
+
|
|
12
|
+
export class SizeData extends EntityData<SizeSchema> implements SizeSchema {
|
|
13
|
+
static type = 'SizeData';
|
|
14
|
+
|
|
15
|
+
getDefaultData(): SizeSchema {
|
|
16
|
+
return Schema.createDefault<SizeSchema>(SizeSchemaDecoration);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
get width(): number {
|
|
20
|
+
return this.data.width;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
get height(): number {
|
|
24
|
+
return this.data.height;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
set width(width: number) {
|
|
28
|
+
this.update('width', width);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
set height(height: number) {
|
|
32
|
+
this.update('height', height);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
get locked(): boolean {
|
|
36
|
+
return !!this.data.locked;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
set locked(locked: boolean) {
|
|
40
|
+
this.update('locked', locked);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { SkewSchemaDecoration, Schema } from '@flowgram-vue/utils';
|
|
7
|
+
import type { SkewSchema } from '@flowgram-vue/utils';
|
|
8
|
+
|
|
9
|
+
import { EntityData } from '../entity-data';
|
|
10
|
+
|
|
11
|
+
export { SkewSchema, SkewSchemaDecoration };
|
|
12
|
+
|
|
13
|
+
export class SkewData extends EntityData<SkewSchema> implements SkewSchema {
|
|
14
|
+
static type = 'SkewData';
|
|
15
|
+
|
|
16
|
+
getDefaultData(): SkewSchema {
|
|
17
|
+
return Schema.createDefault<SkewSchema>(SkewSchemaDecoration);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
get x(): number {
|
|
21
|
+
return this.data.x;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
get y(): number {
|
|
25
|
+
return this.data.y;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
set x(x: number) {
|
|
29
|
+
this.update('x', x);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
set y(y: number) {
|
|
33
|
+
this.update('y', y);
|
|
34
|
+
}
|
|
35
|
+
}
|