locusing 0.1.2 → 0.1.3
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/dist/chunk-OGXUFTN5.mjs +73 -0
- package/dist/chunk-P4AQB2F4.mjs +636 -0
- package/dist/chunk-VPKI3XSA.mjs +497 -0
- package/dist/diagram-Cp-wb_P8.d.mts +1954 -0
- package/dist/diagram-Cp-wb_P8.d.ts +1954 -0
- package/dist/export.d.mts +1 -1
- package/dist/export.d.ts +1 -1
- package/dist/export.mjs +4 -6
- package/dist/index.d.mts +371 -29
- package/dist/index.d.ts +371 -29
- package/dist/index.global.js +5701 -576
- package/dist/index.js +2449 -1084
- package/dist/index.mjs +2102 -174
- package/dist/mp4-muxer-BX5P3WHC.mjs +1926 -0
- package/dist/transform-CEUZFTMM.mjs +22 -0
- package/package.json +9 -2
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
+
var __spreadValues = (a, b) => {
|
|
13
|
+
for (var prop in b || (b = {}))
|
|
14
|
+
if (__hasOwnProp.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
if (__getOwnPropSymbols)
|
|
17
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
+
if (__propIsEnum.call(b, prop))
|
|
19
|
+
__defNormalProp(a, prop, b[prop]);
|
|
20
|
+
}
|
|
21
|
+
return a;
|
|
22
|
+
};
|
|
23
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
|
+
var __objRest = (source, exclude) => {
|
|
25
|
+
var target = {};
|
|
26
|
+
for (var prop in source)
|
|
27
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
28
|
+
target[prop] = source[prop];
|
|
29
|
+
if (source != null && __getOwnPropSymbols)
|
|
30
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
31
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
32
|
+
target[prop] = source[prop];
|
|
33
|
+
}
|
|
34
|
+
return target;
|
|
35
|
+
};
|
|
36
|
+
var __esm = (fn, res) => function __init() {
|
|
37
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
38
|
+
};
|
|
39
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
40
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
41
|
+
};
|
|
42
|
+
var __export = (target, all) => {
|
|
43
|
+
for (var name in all)
|
|
44
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
45
|
+
};
|
|
46
|
+
var __copyProps = (to, from, except, desc) => {
|
|
47
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
48
|
+
for (let key of __getOwnPropNames(from))
|
|
49
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
50
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
51
|
+
}
|
|
52
|
+
return to;
|
|
53
|
+
};
|
|
54
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
55
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
56
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
57
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
58
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
59
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
60
|
+
mod
|
|
61
|
+
));
|
|
62
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
63
|
+
|
|
64
|
+
export {
|
|
65
|
+
__spreadValues,
|
|
66
|
+
__spreadProps,
|
|
67
|
+
__objRest,
|
|
68
|
+
__esm,
|
|
69
|
+
__commonJS,
|
|
70
|
+
__export,
|
|
71
|
+
__toESM,
|
|
72
|
+
__toCommonJS
|
|
73
|
+
};
|
|
@@ -0,0 +1,636 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
+
var __spreadValues = (a, b) => {
|
|
11
|
+
for (var prop in b || (b = {}))
|
|
12
|
+
if (__hasOwnProp.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
if (__getOwnPropSymbols)
|
|
15
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
16
|
+
if (__propIsEnum.call(b, prop))
|
|
17
|
+
__defNormalProp(a, prop, b[prop]);
|
|
18
|
+
}
|
|
19
|
+
return a;
|
|
20
|
+
};
|
|
21
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
22
|
+
var __objRest = (source, exclude) => {
|
|
23
|
+
var target = {};
|
|
24
|
+
for (var prop in source)
|
|
25
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
26
|
+
target[prop] = source[prop];
|
|
27
|
+
if (source != null && __getOwnPropSymbols)
|
|
28
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
29
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
30
|
+
target[prop] = source[prop];
|
|
31
|
+
}
|
|
32
|
+
return target;
|
|
33
|
+
};
|
|
34
|
+
var __esm = (fn, res) => function __init() {
|
|
35
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
36
|
+
};
|
|
37
|
+
var __export = (target, all) => {
|
|
38
|
+
for (var name in all)
|
|
39
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
40
|
+
};
|
|
41
|
+
var __copyProps = (to, from, except, desc) => {
|
|
42
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
43
|
+
for (let key of __getOwnPropNames(from))
|
|
44
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
45
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
46
|
+
}
|
|
47
|
+
return to;
|
|
48
|
+
};
|
|
49
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
50
|
+
|
|
51
|
+
// src/animate/timeline.ts
|
|
52
|
+
import { gsap } from "gsap";
|
|
53
|
+
function createTimeline(options) {
|
|
54
|
+
return new Timeline(options);
|
|
55
|
+
}
|
|
56
|
+
function getGSAPEasing(easing) {
|
|
57
|
+
return easingMap[easing] || easing;
|
|
58
|
+
}
|
|
59
|
+
var Timeline, easingMap;
|
|
60
|
+
var init_timeline = __esm({
|
|
61
|
+
"src/animate/timeline.ts"() {
|
|
62
|
+
"use strict";
|
|
63
|
+
Timeline = class {
|
|
64
|
+
constructor(options = {}) {
|
|
65
|
+
this._status = "pending";
|
|
66
|
+
this.timeline = gsap.timeline({
|
|
67
|
+
paused: true,
|
|
68
|
+
onStart: () => {
|
|
69
|
+
var _a;
|
|
70
|
+
this._status = "running";
|
|
71
|
+
(_a = options.onStart) == null ? void 0 : _a.call(options);
|
|
72
|
+
},
|
|
73
|
+
onComplete: () => {
|
|
74
|
+
var _a;
|
|
75
|
+
this._status = "completed";
|
|
76
|
+
(_a = options.onComplete) == null ? void 0 : _a.call(options);
|
|
77
|
+
},
|
|
78
|
+
onUpdate: () => {
|
|
79
|
+
var _a;
|
|
80
|
+
(_a = options.onUpdate) == null ? void 0 : _a.call(options, this.progress);
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
/** 当前状态 */
|
|
85
|
+
get status() {
|
|
86
|
+
return this._status;
|
|
87
|
+
}
|
|
88
|
+
/** 当前进度 (0-1) */
|
|
89
|
+
get progress() {
|
|
90
|
+
return this.timeline.progress();
|
|
91
|
+
}
|
|
92
|
+
/** 总时长 */
|
|
93
|
+
get duration() {
|
|
94
|
+
return this.timeline.duration();
|
|
95
|
+
}
|
|
96
|
+
/** 当前时间 */
|
|
97
|
+
get time() {
|
|
98
|
+
return this.timeline.time();
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* 添加动画到时间线
|
|
102
|
+
*/
|
|
103
|
+
add(target, vars, position) {
|
|
104
|
+
this.timeline.to(target, vars, position);
|
|
105
|
+
return this;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* 添加回调函数
|
|
109
|
+
*/
|
|
110
|
+
call(callback, position) {
|
|
111
|
+
this.timeline.call(callback, void 0, position);
|
|
112
|
+
return this;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* 添加延迟
|
|
116
|
+
*/
|
|
117
|
+
delay(seconds, position) {
|
|
118
|
+
this.timeline.to({}, { duration: seconds }, position);
|
|
119
|
+
return this;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* 添加标签
|
|
123
|
+
*/
|
|
124
|
+
label(name, position) {
|
|
125
|
+
this.timeline.addLabel(name, position);
|
|
126
|
+
return this;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* 播放
|
|
130
|
+
*/
|
|
131
|
+
play() {
|
|
132
|
+
this._status = "running";
|
|
133
|
+
this.timeline.play();
|
|
134
|
+
return this;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* 暂停
|
|
138
|
+
*/
|
|
139
|
+
pause() {
|
|
140
|
+
this._status = "paused";
|
|
141
|
+
this.timeline.pause();
|
|
142
|
+
return this;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* 恢复
|
|
146
|
+
*/
|
|
147
|
+
resume() {
|
|
148
|
+
this._status = "running";
|
|
149
|
+
this.timeline.resume();
|
|
150
|
+
return this;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* 停止并重置
|
|
154
|
+
*/
|
|
155
|
+
restart() {
|
|
156
|
+
this._status = "pending";
|
|
157
|
+
this.timeline.restart();
|
|
158
|
+
return this;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* 跳转到指定时间
|
|
162
|
+
*/
|
|
163
|
+
seek(time) {
|
|
164
|
+
this.timeline.seek(time);
|
|
165
|
+
return this;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* 设置进度
|
|
169
|
+
*/
|
|
170
|
+
setProgress(progress) {
|
|
171
|
+
this.timeline.progress(progress);
|
|
172
|
+
return this;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* 设置速度
|
|
176
|
+
*/
|
|
177
|
+
setSpeed(speed) {
|
|
178
|
+
this.timeline.timeScale(speed);
|
|
179
|
+
return this;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* 反向播放
|
|
183
|
+
*/
|
|
184
|
+
reverse() {
|
|
185
|
+
this.timeline.reverse();
|
|
186
|
+
return this;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* 销毁
|
|
190
|
+
*/
|
|
191
|
+
kill() {
|
|
192
|
+
this.timeline.kill();
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* 等待完成
|
|
196
|
+
*/
|
|
197
|
+
async finished() {
|
|
198
|
+
return new Promise((resolve) => {
|
|
199
|
+
this.timeline.eventCallback("onComplete", resolve);
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
easingMap = {
|
|
204
|
+
linear: "none",
|
|
205
|
+
easeIn: "power2.in",
|
|
206
|
+
easeOut: "power2.out",
|
|
207
|
+
easeInOut: "power2.inOut",
|
|
208
|
+
easeInQuad: "power1.in",
|
|
209
|
+
easeOutQuad: "power1.out",
|
|
210
|
+
easeInOutQuad: "power1.inOut",
|
|
211
|
+
easeInCubic: "power2.in",
|
|
212
|
+
easeOutCubic: "power2.out",
|
|
213
|
+
easeInOutCubic: "power2.inOut",
|
|
214
|
+
easeInQuart: "power3.in",
|
|
215
|
+
easeOutQuart: "power3.out",
|
|
216
|
+
easeInOutQuart: "power3.inOut",
|
|
217
|
+
easeInQuint: "power4.in",
|
|
218
|
+
easeOutQuint: "power4.out",
|
|
219
|
+
easeInOutQuint: "power4.inOut",
|
|
220
|
+
easeInSine: "sine.in",
|
|
221
|
+
easeOutSine: "sine.out",
|
|
222
|
+
easeInOutSine: "sine.inOut",
|
|
223
|
+
easeInExpo: "expo.in",
|
|
224
|
+
easeOutExpo: "expo.out",
|
|
225
|
+
easeInOutExpo: "expo.inOut",
|
|
226
|
+
easeInCirc: "circ.in",
|
|
227
|
+
easeOutCirc: "circ.out",
|
|
228
|
+
easeInOutCirc: "circ.inOut",
|
|
229
|
+
easeInBack: "back.in",
|
|
230
|
+
easeOutBack: "back.out",
|
|
231
|
+
easeInOutBack: "back.inOut",
|
|
232
|
+
easeInElastic: "elastic.in",
|
|
233
|
+
easeOutElastic: "elastic.out",
|
|
234
|
+
easeInOutElastic: "elastic.inOut",
|
|
235
|
+
easeInBounce: "bounce.in",
|
|
236
|
+
easeOutBounce: "bounce.out",
|
|
237
|
+
easeInOutBounce: "bounce.inOut"
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
// src/animate/animations/transform.ts
|
|
243
|
+
init_timeline();
|
|
244
|
+
import { gsap as gsap2 } from "gsap";
|
|
245
|
+
|
|
246
|
+
// src/animate/animations/utils.ts
|
|
247
|
+
function querySelectorAllIncludingSelf(element, selector) {
|
|
248
|
+
const results = Array.from(element.querySelectorAll(selector));
|
|
249
|
+
if (element.matches(selector)) {
|
|
250
|
+
results.unshift(element);
|
|
251
|
+
}
|
|
252
|
+
return results;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// src/animate/animations/transform.ts
|
|
256
|
+
function Transform(source, target, options = {}) {
|
|
257
|
+
const { duration = 1, easing = "easeInOut", delay = 0 } = options;
|
|
258
|
+
return {
|
|
259
|
+
duration,
|
|
260
|
+
target: source,
|
|
261
|
+
execute(scene, timeline, startTime) {
|
|
262
|
+
var _a, _b;
|
|
263
|
+
const sourceElement = scene.getElement(source);
|
|
264
|
+
const targetElement = scene.getOrCreateElement(target);
|
|
265
|
+
if (!sourceElement || !targetElement) return;
|
|
266
|
+
gsap2.set(targetElement, { opacity: 0 });
|
|
267
|
+
const sourceBBox = ((_a = sourceElement.getBBox) == null ? void 0 : _a.call(sourceElement)) || { x: 0, y: 0, width: 0, height: 0 };
|
|
268
|
+
const targetBBox = ((_b = targetElement.getBBox) == null ? void 0 : _b.call(targetElement)) || { x: 0, y: 0, width: 0, height: 0 };
|
|
269
|
+
const scaleX = targetBBox.width / (sourceBBox.width || 1);
|
|
270
|
+
const scaleY = targetBBox.height / (sourceBBox.height || 1);
|
|
271
|
+
const translateX = targetBBox.x + targetBBox.width / 2 - (sourceBBox.x + sourceBBox.width / 2);
|
|
272
|
+
const translateY = targetBBox.y + targetBBox.height / 2 - (sourceBBox.y + sourceBBox.height / 2);
|
|
273
|
+
const originX = sourceBBox.x + sourceBBox.width / 2;
|
|
274
|
+
const originY = sourceBBox.y + sourceBBox.height / 2;
|
|
275
|
+
gsap2.set(sourceElement, {
|
|
276
|
+
transformOrigin: `${originX}px ${originY}px`
|
|
277
|
+
});
|
|
278
|
+
timeline.add(sourceElement, {
|
|
279
|
+
scaleX,
|
|
280
|
+
scaleY,
|
|
281
|
+
x: translateX,
|
|
282
|
+
y: translateY,
|
|
283
|
+
duration,
|
|
284
|
+
ease: getGSAPEasing(easing),
|
|
285
|
+
delay,
|
|
286
|
+
onComplete: () => {
|
|
287
|
+
sourceElement.remove();
|
|
288
|
+
gsap2.set(targetElement, { opacity: 1 });
|
|
289
|
+
}
|
|
290
|
+
}, startTime);
|
|
291
|
+
}
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
function ReplacementTransform(source, target, options = {}) {
|
|
295
|
+
const { duration = 1, easing = "easeInOut", delay = 0, replace = true } = options;
|
|
296
|
+
return {
|
|
297
|
+
duration,
|
|
298
|
+
target: source,
|
|
299
|
+
execute(scene, timeline, startTime) {
|
|
300
|
+
var _a, _b;
|
|
301
|
+
const sourceElement = scene.getElement(source);
|
|
302
|
+
const targetElement = scene.getOrCreateElement(target);
|
|
303
|
+
if (!sourceElement || !targetElement) return;
|
|
304
|
+
gsap2.set(targetElement, { opacity: 0, visibility: "hidden" });
|
|
305
|
+
const sourceBBox = ((_a = sourceElement.getBBox) == null ? void 0 : _a.call(sourceElement)) || { x: 0, y: 0, width: 0, height: 0 };
|
|
306
|
+
const targetBBox = ((_b = targetElement.getBBox) == null ? void 0 : _b.call(targetElement)) || { x: 0, y: 0, width: 0, height: 0 };
|
|
307
|
+
const scaleX = targetBBox.width / (sourceBBox.width || 1);
|
|
308
|
+
const scaleY = targetBBox.height / (sourceBBox.height || 1);
|
|
309
|
+
const sourceCenterX = sourceBBox.x + sourceBBox.width / 2;
|
|
310
|
+
const sourceCenterY = sourceBBox.y + sourceBBox.height / 2;
|
|
311
|
+
const targetCenterX = targetBBox.x + targetBBox.width / 2;
|
|
312
|
+
const targetCenterY = targetBBox.y + targetBBox.height / 2;
|
|
313
|
+
timeline.add(sourceElement, {
|
|
314
|
+
transformOrigin: `${sourceCenterX}px ${sourceCenterY}px`,
|
|
315
|
+
scaleX,
|
|
316
|
+
scaleY,
|
|
317
|
+
x: targetCenterX - sourceCenterX,
|
|
318
|
+
y: targetCenterY - sourceCenterY,
|
|
319
|
+
opacity: 0,
|
|
320
|
+
duration,
|
|
321
|
+
ease: getGSAPEasing(easing),
|
|
322
|
+
delay,
|
|
323
|
+
onComplete: () => {
|
|
324
|
+
if (replace) {
|
|
325
|
+
sourceElement.remove();
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}, startTime);
|
|
329
|
+
timeline.add(targetElement, {
|
|
330
|
+
visibility: "visible",
|
|
331
|
+
opacity: 1,
|
|
332
|
+
duration: duration * 0.5,
|
|
333
|
+
ease: "power2.out",
|
|
334
|
+
delay: delay + duration * 0.5
|
|
335
|
+
}, startTime);
|
|
336
|
+
}
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
function MoveToTarget(target, options = {}) {
|
|
340
|
+
const { duration = 1, easing = "easeInOut", delay = 0 } = options;
|
|
341
|
+
return {
|
|
342
|
+
duration,
|
|
343
|
+
target,
|
|
344
|
+
execute(scene, timeline, startTime) {
|
|
345
|
+
const element = scene.getElement(target);
|
|
346
|
+
if (!element) return;
|
|
347
|
+
const targetState = target._targetState;
|
|
348
|
+
if (targetState) {
|
|
349
|
+
timeline.add(element, __spreadProps(__spreadValues({}, targetState), {
|
|
350
|
+
duration,
|
|
351
|
+
ease: getGSAPEasing(easing),
|
|
352
|
+
delay
|
|
353
|
+
}), startTime);
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
function Morphing(source, target, options = {}) {
|
|
359
|
+
const { duration = 1, easing = "easeInOut", delay = 0 } = options;
|
|
360
|
+
return {
|
|
361
|
+
duration,
|
|
362
|
+
target: source,
|
|
363
|
+
execute(scene, timeline, startTime) {
|
|
364
|
+
var _a;
|
|
365
|
+
const sourceElement = scene.getElement(source);
|
|
366
|
+
const targetElement = scene.getOrCreateElement(target);
|
|
367
|
+
if (!sourceElement || !targetElement) return;
|
|
368
|
+
const sourcePath = sourceElement.querySelector("path") || sourceElement;
|
|
369
|
+
const targetPath = targetElement.querySelector("path") || targetElement;
|
|
370
|
+
gsap2.set(targetElement, { opacity: 0 });
|
|
371
|
+
if ((_a = gsap2.plugins) == null ? void 0 : _a.morphSVG) {
|
|
372
|
+
const targetD = targetPath.getAttribute("d");
|
|
373
|
+
if (targetD) {
|
|
374
|
+
timeline.add(sourcePath, {
|
|
375
|
+
morphSVG: targetD,
|
|
376
|
+
duration,
|
|
377
|
+
ease: getGSAPEasing(easing),
|
|
378
|
+
delay,
|
|
379
|
+
onComplete: () => {
|
|
380
|
+
sourceElement.remove();
|
|
381
|
+
gsap2.set(targetElement, { opacity: 1 });
|
|
382
|
+
}
|
|
383
|
+
}, startTime);
|
|
384
|
+
}
|
|
385
|
+
} else {
|
|
386
|
+
Transform(source, target, options).execute(scene, timeline, startTime);
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
};
|
|
390
|
+
}
|
|
391
|
+
function TransformMatchingShapes(source, target, options = {}) {
|
|
392
|
+
const { duration = 1, easing = "easeInOut", delay = 0 } = options;
|
|
393
|
+
return {
|
|
394
|
+
duration,
|
|
395
|
+
target: source,
|
|
396
|
+
execute(scene, timeline, startTime) {
|
|
397
|
+
var _a, _b;
|
|
398
|
+
const sourceElement = scene.getElement(source);
|
|
399
|
+
const targetElement = scene.getOrCreateElement(target);
|
|
400
|
+
if (!sourceElement || !targetElement) return;
|
|
401
|
+
const sourceChildren = Array.from(sourceElement.children);
|
|
402
|
+
const targetChildren = Array.from(targetElement.children);
|
|
403
|
+
gsap2.set(targetElement, { opacity: 0 });
|
|
404
|
+
const pairs = Math.min(sourceChildren.length, targetChildren.length);
|
|
405
|
+
for (let i = 0; i < pairs; i++) {
|
|
406
|
+
const sourceChild = sourceChildren[i];
|
|
407
|
+
const targetChild = targetChildren[i];
|
|
408
|
+
const sourceBBox = ((_a = sourceChild.getBBox) == null ? void 0 : _a.call(sourceChild)) || { x: 0, y: 0, width: 0, height: 0 };
|
|
409
|
+
const targetBBox = ((_b = targetChild.getBBox) == null ? void 0 : _b.call(targetChild)) || { x: 0, y: 0, width: 0, height: 0 };
|
|
410
|
+
const scaleX = targetBBox.width / (sourceBBox.width || 1);
|
|
411
|
+
const scaleY = targetBBox.height / (sourceBBox.height || 1);
|
|
412
|
+
const translateX = targetBBox.x - sourceBBox.x;
|
|
413
|
+
const translateY = targetBBox.y - sourceBBox.y;
|
|
414
|
+
timeline.add(sourceChild, {
|
|
415
|
+
scaleX,
|
|
416
|
+
scaleY,
|
|
417
|
+
x: translateX,
|
|
418
|
+
y: translateY,
|
|
419
|
+
duration,
|
|
420
|
+
ease: getGSAPEasing(easing),
|
|
421
|
+
delay
|
|
422
|
+
}, startTime);
|
|
423
|
+
}
|
|
424
|
+
for (let i = pairs; i < sourceChildren.length; i++) {
|
|
425
|
+
const child = sourceChildren[i];
|
|
426
|
+
if (child) {
|
|
427
|
+
timeline.add(child, {
|
|
428
|
+
opacity: 0,
|
|
429
|
+
duration: duration * 0.5,
|
|
430
|
+
ease: "power2.in"
|
|
431
|
+
}, startTime);
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
timeline.call(() => {
|
|
435
|
+
sourceElement.remove();
|
|
436
|
+
gsap2.set(targetElement, { opacity: 1 });
|
|
437
|
+
}, startTime + duration);
|
|
438
|
+
}
|
|
439
|
+
};
|
|
440
|
+
}
|
|
441
|
+
function TransformMatchingTex(source, target, options = {}) {
|
|
442
|
+
const { duration = 1, easing = "easeInOut", delay = 0 } = options;
|
|
443
|
+
return {
|
|
444
|
+
duration,
|
|
445
|
+
target: source,
|
|
446
|
+
execute(scene, timeline, startTime) {
|
|
447
|
+
var _a, _b;
|
|
448
|
+
const sourceElement = scene.getElement(source);
|
|
449
|
+
const targetElement = scene.getOrCreateElement(target);
|
|
450
|
+
if (!sourceElement || !targetElement) return;
|
|
451
|
+
gsap2.set(targetElement, { opacity: 0 });
|
|
452
|
+
const sourceTexParts = querySelectorAllIncludingSelf(sourceElement, "path, use, text");
|
|
453
|
+
const targetTexParts = querySelectorAllIncludingSelf(targetElement, "path, use, text");
|
|
454
|
+
const pairs = Math.min(sourceTexParts.length, targetTexParts.length);
|
|
455
|
+
for (let i = 0; i < pairs; i++) {
|
|
456
|
+
const sourcePart = sourceTexParts[i];
|
|
457
|
+
const targetPart = targetTexParts[i];
|
|
458
|
+
const sourceBBox = ((_a = sourcePart.getBBox) == null ? void 0 : _a.call(sourcePart)) || { x: 0, y: 0, width: 0, height: 0 };
|
|
459
|
+
const targetBBox = ((_b = targetPart.getBBox) == null ? void 0 : _b.call(targetPart)) || { x: 0, y: 0, width: 0, height: 0 };
|
|
460
|
+
const scaleX = targetBBox.width / (sourceBBox.width || 1);
|
|
461
|
+
const scaleY = targetBBox.height / (sourceBBox.height || 1);
|
|
462
|
+
const translateX = targetBBox.x + targetBBox.width / 2 - (sourceBBox.x + sourceBBox.width / 2);
|
|
463
|
+
const translateY = targetBBox.y + targetBBox.height / 2 - (sourceBBox.y + sourceBBox.height / 2);
|
|
464
|
+
timeline.add(sourcePart, {
|
|
465
|
+
scaleX: isFinite(scaleX) ? scaleX : 1,
|
|
466
|
+
scaleY: isFinite(scaleY) ? scaleY : 1,
|
|
467
|
+
x: translateX,
|
|
468
|
+
y: translateY,
|
|
469
|
+
duration,
|
|
470
|
+
ease: getGSAPEasing(easing),
|
|
471
|
+
delay
|
|
472
|
+
}, startTime);
|
|
473
|
+
}
|
|
474
|
+
for (let i = pairs; i < sourceTexParts.length; i++) {
|
|
475
|
+
const part = sourceTexParts[i];
|
|
476
|
+
if (part) {
|
|
477
|
+
timeline.add(part, {
|
|
478
|
+
opacity: 0,
|
|
479
|
+
duration: duration * 0.5,
|
|
480
|
+
ease: "power2.in"
|
|
481
|
+
}, startTime);
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
timeline.call(() => {
|
|
485
|
+
sourceElement.remove();
|
|
486
|
+
gsap2.set(targetElement, { opacity: 1 });
|
|
487
|
+
}, startTime + duration);
|
|
488
|
+
}
|
|
489
|
+
};
|
|
490
|
+
}
|
|
491
|
+
function ClockwiseTransform(source, target, options = {}) {
|
|
492
|
+
const { duration = 1, easing = "easeInOut", delay = 0 } = options;
|
|
493
|
+
return {
|
|
494
|
+
duration,
|
|
495
|
+
target: source,
|
|
496
|
+
execute(scene, timeline, startTime) {
|
|
497
|
+
var _a, _b;
|
|
498
|
+
const sourceElement = scene.getElement(source);
|
|
499
|
+
const targetElement = scene.getOrCreateElement(target);
|
|
500
|
+
if (!sourceElement || !targetElement) return;
|
|
501
|
+
gsap2.set(targetElement, { opacity: 0 });
|
|
502
|
+
const sourceBBox = ((_a = sourceElement.getBBox) == null ? void 0 : _a.call(sourceElement)) || { x: 0, y: 0, width: 0, height: 0 };
|
|
503
|
+
const targetBBox = ((_b = targetElement.getBBox) == null ? void 0 : _b.call(targetElement)) || { x: 0, y: 0, width: 0, height: 0 };
|
|
504
|
+
const sourceCenterX = sourceBBox.x + sourceBBox.width / 2;
|
|
505
|
+
const sourceCenterY = sourceBBox.y + sourceBBox.height / 2;
|
|
506
|
+
const targetCenterX = targetBBox.x + targetBBox.width / 2;
|
|
507
|
+
const targetCenterY = targetBBox.y + targetBBox.height / 2;
|
|
508
|
+
const scaleX = targetBBox.width / (sourceBBox.width || 1);
|
|
509
|
+
const scaleY = targetBBox.height / (sourceBBox.height || 1);
|
|
510
|
+
gsap2.set(sourceElement, {
|
|
511
|
+
transformOrigin: `${sourceCenterX}px ${sourceCenterY}px`
|
|
512
|
+
});
|
|
513
|
+
timeline.add(sourceElement, {
|
|
514
|
+
rotation: 180,
|
|
515
|
+
scaleX: isFinite(scaleX) ? scaleX : 1,
|
|
516
|
+
scaleY: isFinite(scaleY) ? scaleY : 1,
|
|
517
|
+
x: targetCenterX - sourceCenterX,
|
|
518
|
+
y: targetCenterY - sourceCenterY,
|
|
519
|
+
opacity: 0,
|
|
520
|
+
duration,
|
|
521
|
+
ease: getGSAPEasing(easing),
|
|
522
|
+
delay,
|
|
523
|
+
onComplete: () => {
|
|
524
|
+
sourceElement.remove();
|
|
525
|
+
gsap2.set(targetElement, { opacity: 1 });
|
|
526
|
+
}
|
|
527
|
+
}, startTime);
|
|
528
|
+
}
|
|
529
|
+
};
|
|
530
|
+
}
|
|
531
|
+
function CounterclockwiseTransform(source, target, options = {}) {
|
|
532
|
+
const { duration = 1, easing = "easeInOut", delay = 0 } = options;
|
|
533
|
+
return {
|
|
534
|
+
duration,
|
|
535
|
+
target: source,
|
|
536
|
+
execute(scene, timeline, startTime) {
|
|
537
|
+
var _a, _b;
|
|
538
|
+
const sourceElement = scene.getElement(source);
|
|
539
|
+
const targetElement = scene.getOrCreateElement(target);
|
|
540
|
+
if (!sourceElement || !targetElement) return;
|
|
541
|
+
gsap2.set(targetElement, { opacity: 0 });
|
|
542
|
+
const sourceBBox = ((_a = sourceElement.getBBox) == null ? void 0 : _a.call(sourceElement)) || { x: 0, y: 0, width: 0, height: 0 };
|
|
543
|
+
const targetBBox = ((_b = targetElement.getBBox) == null ? void 0 : _b.call(targetElement)) || { x: 0, y: 0, width: 0, height: 0 };
|
|
544
|
+
const sourceCenterX = sourceBBox.x + sourceBBox.width / 2;
|
|
545
|
+
const sourceCenterY = sourceBBox.y + sourceBBox.height / 2;
|
|
546
|
+
const targetCenterX = targetBBox.x + targetBBox.width / 2;
|
|
547
|
+
const targetCenterY = targetBBox.y + targetBBox.height / 2;
|
|
548
|
+
const scaleX = targetBBox.width / (sourceBBox.width || 1);
|
|
549
|
+
const scaleY = targetBBox.height / (sourceBBox.height || 1);
|
|
550
|
+
gsap2.set(sourceElement, {
|
|
551
|
+
transformOrigin: `${sourceCenterX}px ${sourceCenterY}px`
|
|
552
|
+
});
|
|
553
|
+
timeline.add(sourceElement, {
|
|
554
|
+
rotation: -180,
|
|
555
|
+
scaleX: isFinite(scaleX) ? scaleX : 1,
|
|
556
|
+
scaleY: isFinite(scaleY) ? scaleY : 1,
|
|
557
|
+
x: targetCenterX - sourceCenterX,
|
|
558
|
+
y: targetCenterY - sourceCenterY,
|
|
559
|
+
opacity: 0,
|
|
560
|
+
duration,
|
|
561
|
+
ease: getGSAPEasing(easing),
|
|
562
|
+
delay,
|
|
563
|
+
onComplete: () => {
|
|
564
|
+
sourceElement.remove();
|
|
565
|
+
gsap2.set(targetElement, { opacity: 1 });
|
|
566
|
+
}
|
|
567
|
+
}, startTime);
|
|
568
|
+
}
|
|
569
|
+
};
|
|
570
|
+
}
|
|
571
|
+
function TransformFromCopy(source, target, options = {}) {
|
|
572
|
+
const { duration = 1, easing = "easeInOut", delay = 0 } = options;
|
|
573
|
+
return {
|
|
574
|
+
duration,
|
|
575
|
+
target: source,
|
|
576
|
+
execute(scene, timeline, startTime) {
|
|
577
|
+
var _a, _b, _c;
|
|
578
|
+
const sourceElement = scene.getElement(source);
|
|
579
|
+
const targetElement = scene.getOrCreateElement(target);
|
|
580
|
+
if (!sourceElement || !targetElement) return;
|
|
581
|
+
gsap2.set(targetElement, { opacity: 0 });
|
|
582
|
+
const copyElement = sourceElement.cloneNode(true);
|
|
583
|
+
copyElement.setAttribute("id", `${sourceElement.id}-copy-${Date.now()}`);
|
|
584
|
+
(_a = sourceElement.parentNode) == null ? void 0 : _a.appendChild(copyElement);
|
|
585
|
+
const sourceBBox = ((_b = sourceElement.getBBox) == null ? void 0 : _b.call(sourceElement)) || { x: 0, y: 0, width: 0, height: 0 };
|
|
586
|
+
const targetBBox = ((_c = targetElement.getBBox) == null ? void 0 : _c.call(targetElement)) || { x: 0, y: 0, width: 0, height: 0 };
|
|
587
|
+
const sourceCenterX = sourceBBox.x + sourceBBox.width / 2;
|
|
588
|
+
const sourceCenterY = sourceBBox.y + sourceBBox.height / 2;
|
|
589
|
+
const targetCenterX = targetBBox.x + targetBBox.width / 2;
|
|
590
|
+
const targetCenterY = targetBBox.y + targetBBox.height / 2;
|
|
591
|
+
const scaleX = targetBBox.width / (sourceBBox.width || 1);
|
|
592
|
+
const scaleY = targetBBox.height / (sourceBBox.height || 1);
|
|
593
|
+
gsap2.set(copyElement, {
|
|
594
|
+
transformOrigin: `${sourceCenterX}px ${sourceCenterY}px`
|
|
595
|
+
});
|
|
596
|
+
timeline.add(copyElement, {
|
|
597
|
+
scaleX: isFinite(scaleX) ? scaleX : 1,
|
|
598
|
+
scaleY: isFinite(scaleY) ? scaleY : 1,
|
|
599
|
+
x: targetCenterX - sourceCenterX,
|
|
600
|
+
y: targetCenterY - sourceCenterY,
|
|
601
|
+
opacity: 0,
|
|
602
|
+
duration,
|
|
603
|
+
ease: getGSAPEasing(easing),
|
|
604
|
+
delay,
|
|
605
|
+
onComplete: () => {
|
|
606
|
+
copyElement.remove();
|
|
607
|
+
gsap2.set(targetElement, { opacity: 1 });
|
|
608
|
+
}
|
|
609
|
+
}, startTime);
|
|
610
|
+
}
|
|
611
|
+
};
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
export {
|
|
615
|
+
__spreadValues,
|
|
616
|
+
__spreadProps,
|
|
617
|
+
__objRest,
|
|
618
|
+
__esm,
|
|
619
|
+
__export,
|
|
620
|
+
__toCommonJS,
|
|
621
|
+
Timeline,
|
|
622
|
+
createTimeline,
|
|
623
|
+
easingMap,
|
|
624
|
+
getGSAPEasing,
|
|
625
|
+
init_timeline,
|
|
626
|
+
querySelectorAllIncludingSelf,
|
|
627
|
+
Transform,
|
|
628
|
+
ReplacementTransform,
|
|
629
|
+
MoveToTarget,
|
|
630
|
+
Morphing,
|
|
631
|
+
TransformMatchingShapes,
|
|
632
|
+
TransformMatchingTex,
|
|
633
|
+
ClockwiseTransform,
|
|
634
|
+
CounterclockwiseTransform,
|
|
635
|
+
TransformFromCopy
|
|
636
|
+
};
|