motion-v 0.5.1 → 0.6.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/dist/cjs/index.js +322 -201
- package/dist/es/components/LayoutGroup.vue.mjs +10 -4
- package/dist/es/components/Motion.vue.mjs +40 -30
- package/dist/es/components/{AnimatePresence.vue.mjs → animate-presence/AnimatePresence.vue.mjs} +38 -18
- package/dist/es/components/{use-pop-layout.mjs → animate-presence/use-pop-layout.mjs} +5 -0
- package/dist/es/components/context.mjs +1 -9
- package/dist/es/components/group.mjs +5 -2
- package/dist/es/components/motion-config/MotionConfig.vue.mjs +30 -0
- package/dist/es/components/motion-config/MotionConfig.vue2.mjs +4 -0
- package/dist/es/components/motion-config/context.mjs +17 -0
- package/dist/es/components/presence.mjs +0 -2
- package/dist/es/components/use-layout-group.mjs +8 -6
- package/dist/es/components/utils.mjs +7 -0
- package/dist/es/constants/index.mjs +4 -2
- package/dist/es/features/layout/layout.mjs +19 -12
- package/dist/es/features/layout/projection.mjs +33 -1
- package/dist/es/index.mjs +12 -7
- package/dist/es/state/animate-variants-children.mjs +6 -4
- package/dist/es/state/motion-state.mjs +53 -24
- package/dist/es/state/schedule.mjs +2 -26
- package/dist/es/state/utils.mjs +0 -9
- package/dist/src/components/LayoutGroup.d.ts +4 -1
- package/dist/src/components/Motion.d.ts +1 -0
- package/dist/src/components/{AnimatePresence.d.ts → animate-presence/AnimatePresence.d.ts} +1 -1
- package/dist/src/components/animate-presence/index.d.ts +2 -0
- package/dist/src/components/{type.d.ts → animate-presence/types.d.ts} +2 -0
- package/dist/src/components/{use-pop-layout.d.ts → animate-presence/use-pop-layout.d.ts} +2 -2
- package/dist/src/components/animate-presence/use-presence.d.ts +2 -0
- package/dist/src/components/context.d.ts +1 -3
- package/dist/src/components/group.d.ts +1 -0
- package/dist/src/components/hooks/use-motion-elm.d.ts +13 -0
- package/dist/src/components/index.d.ts +2 -0
- package/dist/src/components/motion-config/MotionConfig.d.ts +39 -0
- package/dist/src/components/motion-config/context.d.ts +11 -0
- package/dist/src/components/motion-config/index.d.ts +2 -0
- package/dist/src/components/motion-config/types.d.ts +14 -0
- package/dist/src/components/presence.d.ts +3 -5
- package/dist/src/components/use-layout-group.d.ts +4 -1
- package/dist/src/components/use-slot-change-index.d.ts +1 -0
- package/dist/src/components/utils.d.ts +7 -0
- package/dist/src/features/gestures/drag/types.d.ts +5 -3
- package/dist/src/features/gestures/types.d.ts +0 -5
- package/dist/src/features/layout/projection.d.ts +1 -0
- package/dist/src/features/layout/types.d.ts +1 -0
- package/dist/src/index.d.ts +2 -2
- package/dist/src/state/animate-variants-children.d.ts +1 -1
- package/dist/src/state/event.d.ts +1 -1
- package/dist/src/state/motion-state.d.ts +10 -7
- package/dist/src/types/state.d.ts +8 -2
- package/package.json +3 -2
- /package/dist/es/components/{AnimatePresence.vue2.mjs → animate-presence/AnimatePresence.vue2.mjs} +0 -0
package/dist/cjs/index.js
CHANGED
|
@@ -18,11 +18,11 @@ if (process.env.NODE_ENV !== "production") {
|
|
|
18
18
|
}
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
|
-
function addUniqueItem
|
|
21
|
+
function addUniqueItem(arr, item) {
|
|
22
22
|
if (arr.indexOf(item) === -1)
|
|
23
23
|
arr.push(item);
|
|
24
24
|
}
|
|
25
|
-
function removeItem
|
|
25
|
+
function removeItem(arr, item) {
|
|
26
26
|
const index = arr.indexOf(item);
|
|
27
27
|
if (index > -1)
|
|
28
28
|
arr.splice(index, 1);
|
|
@@ -32,8 +32,8 @@ class SubscriptionManager {
|
|
|
32
32
|
this.subscriptions = [];
|
|
33
33
|
}
|
|
34
34
|
add(handler) {
|
|
35
|
-
addUniqueItem
|
|
36
|
-
return () => removeItem
|
|
35
|
+
addUniqueItem(this.subscriptions, handler);
|
|
36
|
+
return () => removeItem(this.subscriptions, handler);
|
|
37
37
|
}
|
|
38
38
|
notify(a, b, c) {
|
|
39
39
|
const numSubscriptions = this.subscriptions.length;
|
|
@@ -876,7 +876,7 @@ function eraseKeyframes(sequence, startTime, endTime) {
|
|
|
876
876
|
for (let i = 0; i < sequence.length; i++) {
|
|
877
877
|
const keyframe = sequence[i];
|
|
878
878
|
if (keyframe.at > startTime && keyframe.at < endTime) {
|
|
879
|
-
removeItem
|
|
879
|
+
removeItem(sequence, keyframe);
|
|
880
880
|
i--;
|
|
881
881
|
}
|
|
882
882
|
}
|
|
@@ -4811,12 +4811,6 @@ function getContextWindow({ current }) {
|
|
|
4811
4811
|
}
|
|
4812
4812
|
const [injectMotion, provideMotion] = createContext("Motion");
|
|
4813
4813
|
const [injectLayoutGroup, provideLayoutGroup] = createContext("LayoutGroup");
|
|
4814
|
-
function shouldInheritGroup(inherit) {
|
|
4815
|
-
return inherit === true;
|
|
4816
|
-
}
|
|
4817
|
-
function shouldInheritId(inherit) {
|
|
4818
|
-
return shouldInheritGroup(inherit === true) || inherit === "id";
|
|
4819
|
-
}
|
|
4820
4814
|
function resolveVariant(definition, variants, custom) {
|
|
4821
4815
|
if (typeof definition === "object") {
|
|
4822
4816
|
return definition;
|
|
@@ -4842,13 +4836,6 @@ function shallowCompare(next, prev) {
|
|
|
4842
4836
|
}
|
|
4843
4837
|
return true;
|
|
4844
4838
|
}
|
|
4845
|
-
function addUniqueItem(array, item) {
|
|
4846
|
-
!array.includes(item) && array.push(item);
|
|
4847
|
-
}
|
|
4848
|
-
function removeItem(array, item) {
|
|
4849
|
-
const index = array.indexOf(item);
|
|
4850
|
-
index !== -1 && array.splice(index, 1);
|
|
4851
|
-
}
|
|
4852
4839
|
function getOptions(options, key) {
|
|
4853
4840
|
return options[key] ? { ...options, ...options[key] } : { ...options };
|
|
4854
4841
|
}
|
|
@@ -5650,7 +5637,6 @@ function measurePageBox(element, rootProjectionNode2, transformPagePoint) {
|
|
|
5650
5637
|
return viewportBox;
|
|
5651
5638
|
}
|
|
5652
5639
|
const doneCallbacks = /* @__PURE__ */ new WeakMap();
|
|
5653
|
-
vue.ref(/* @__PURE__ */ new WeakMap());
|
|
5654
5640
|
function removeDoneCallback(element) {
|
|
5655
5641
|
const prevDoneCallback = doneCallbacks.get(element);
|
|
5656
5642
|
if (prevDoneCallback) {
|
|
@@ -6208,13 +6194,11 @@ class LayoutFeature extends Feature {
|
|
|
6208
6194
|
addScaleCorrector(defaultScaleCorrector);
|
|
6209
6195
|
}
|
|
6210
6196
|
beforeUpdate() {
|
|
6211
|
-
|
|
6212
|
-
(_a = this.state.visualElement.projection) == null ? void 0 : _a.willUpdate();
|
|
6197
|
+
this.state.willUpdate("beforeUpdate");
|
|
6213
6198
|
}
|
|
6214
6199
|
update() {
|
|
6215
|
-
var _a
|
|
6216
|
-
(_a = this.state.visualElement.projection) == null ? void 0 : _a.
|
|
6217
|
-
(_b = this.state.visualElement.projection) == null ? void 0 : _b.root.didUpdate();
|
|
6200
|
+
var _a;
|
|
6201
|
+
(_a = this.state.visualElement.projection) == null ? void 0 : _a.root.didUpdate();
|
|
6218
6202
|
}
|
|
6219
6203
|
beforeMount() {
|
|
6220
6204
|
}
|
|
@@ -6232,16 +6216,25 @@ class LayoutFeature extends Feature {
|
|
|
6232
6216
|
}
|
|
6233
6217
|
}
|
|
6234
6218
|
beforeUnmount() {
|
|
6235
|
-
|
|
6236
|
-
|
|
6219
|
+
const projection = this.state.visualElement.projection;
|
|
6220
|
+
if (projection) {
|
|
6221
|
+
this.state.willUpdate("beforeUnmount");
|
|
6222
|
+
if (this.state.options.layoutId) {
|
|
6223
|
+
projection.isPresent = false;
|
|
6224
|
+
projection.relegate();
|
|
6225
|
+
} else if (this.state.options.layout) {
|
|
6226
|
+
this.state.isSafeToRemove = true;
|
|
6227
|
+
}
|
|
6237
6228
|
}
|
|
6238
6229
|
}
|
|
6239
6230
|
unmount() {
|
|
6240
|
-
|
|
6241
|
-
|
|
6242
|
-
|
|
6243
|
-
|
|
6244
|
-
|
|
6231
|
+
var _a, _b;
|
|
6232
|
+
const layoutGroup = this.state.options.layoutGroup;
|
|
6233
|
+
const projection = this.state.visualElement.projection;
|
|
6234
|
+
if ((layoutGroup == null ? void 0 : layoutGroup.group) && projection)
|
|
6235
|
+
layoutGroup.group.remove(projection);
|
|
6236
|
+
if (this.state.options.layoutId || this.state.options.layout) {
|
|
6237
|
+
(_b = (_a = this.state.visualElement.projection) == null ? void 0 : _a.root) == null ? void 0 : _b.didUpdate();
|
|
6245
6238
|
}
|
|
6246
6239
|
}
|
|
6247
6240
|
}
|
|
@@ -6474,11 +6467,11 @@ class NodeStack {
|
|
|
6474
6467
|
this.members = [];
|
|
6475
6468
|
}
|
|
6476
6469
|
add(node) {
|
|
6477
|
-
addUniqueItem
|
|
6470
|
+
addUniqueItem(this.members, node);
|
|
6478
6471
|
node.scheduleRender();
|
|
6479
6472
|
}
|
|
6480
6473
|
remove(node) {
|
|
6481
|
-
removeItem
|
|
6474
|
+
removeItem(this.members, node);
|
|
6482
6475
|
if (node === this.prevLead) {
|
|
6483
6476
|
this.prevLead = void 0;
|
|
6484
6477
|
}
|
|
@@ -6595,22 +6588,22 @@ function buildProjectionTransform(delta, treeScale, latestTransform) {
|
|
|
6595
6588
|
function eachAxis(callback) {
|
|
6596
6589
|
return [callback("x"), callback("y")];
|
|
6597
6590
|
}
|
|
6598
|
-
const compareByDepth
|
|
6591
|
+
const compareByDepth = (a, b) => a.depth - b.depth;
|
|
6599
6592
|
class FlatTree {
|
|
6600
6593
|
constructor() {
|
|
6601
6594
|
this.children = [];
|
|
6602
6595
|
this.isDirty = false;
|
|
6603
6596
|
}
|
|
6604
6597
|
add(child) {
|
|
6605
|
-
addUniqueItem
|
|
6598
|
+
addUniqueItem(this.children, child);
|
|
6606
6599
|
this.isDirty = true;
|
|
6607
6600
|
}
|
|
6608
6601
|
remove(child) {
|
|
6609
|
-
removeItem
|
|
6602
|
+
removeItem(this.children, child);
|
|
6610
6603
|
this.isDirty = true;
|
|
6611
6604
|
}
|
|
6612
6605
|
forEach(callback) {
|
|
6613
|
-
this.isDirty && this.children.sort(compareByDepth
|
|
6606
|
+
this.isDirty && this.children.sort(compareByDepth);
|
|
6614
6607
|
this.isDirty = false;
|
|
6615
6608
|
this.children.forEach(callback);
|
|
6616
6609
|
}
|
|
@@ -7721,6 +7714,7 @@ class ProjectionFeature extends Feature {
|
|
|
7721
7714
|
this.state.visualElement.latestValues,
|
|
7722
7715
|
options["data-framer-portal-id"] ? void 0 : getClosestProjectingNode(this.state.visualElement.parent)
|
|
7723
7716
|
);
|
|
7717
|
+
this.state.visualElement.projection.isPresent = true;
|
|
7724
7718
|
this.state.visualElement.projection.setOptions({
|
|
7725
7719
|
layout: options.layout,
|
|
7726
7720
|
layoutId: options.layoutId,
|
|
@@ -7730,12 +7724,42 @@ class ProjectionFeature extends Feature {
|
|
|
7730
7724
|
animationType: typeof options.layout === "string" ? options.layout : "both",
|
|
7731
7725
|
// initialPromotionConfig
|
|
7732
7726
|
layoutRoot: options.layoutRoot,
|
|
7733
|
-
layoutScroll: options.layoutScroll
|
|
7727
|
+
layoutScroll: options.layoutScroll,
|
|
7728
|
+
crossfade: options.crossfade,
|
|
7729
|
+
onExitComplete: () => {
|
|
7730
|
+
var _a;
|
|
7731
|
+
if (!((_a = this.state.visualElement.projection) == null ? void 0 : _a.isPresent)) {
|
|
7732
|
+
const done = doneCallbacks.get(this.state.element);
|
|
7733
|
+
this.state.isSafeToRemove = true;
|
|
7734
|
+
if (done) {
|
|
7735
|
+
done({
|
|
7736
|
+
detail: {
|
|
7737
|
+
isExit: true
|
|
7738
|
+
}
|
|
7739
|
+
}, true);
|
|
7740
|
+
}
|
|
7741
|
+
}
|
|
7742
|
+
}
|
|
7734
7743
|
});
|
|
7735
7744
|
}
|
|
7736
7745
|
beforeMount() {
|
|
7737
7746
|
this.initProjection();
|
|
7738
7747
|
}
|
|
7748
|
+
update() {
|
|
7749
|
+
const options = this.state.options;
|
|
7750
|
+
this.state.visualElement.projection.setOptions({
|
|
7751
|
+
layout: options.layout,
|
|
7752
|
+
layoutId: options.layoutId,
|
|
7753
|
+
// TODO: drag
|
|
7754
|
+
alwaysMeasureLayout: false,
|
|
7755
|
+
visualElement: this.state.visualElement,
|
|
7756
|
+
animationType: typeof options.layout === "string" ? options.layout : "both",
|
|
7757
|
+
// initialPromotionConfig
|
|
7758
|
+
layoutRoot: options.layoutRoot,
|
|
7759
|
+
layoutScroll: options.layoutScroll,
|
|
7760
|
+
crossfade: options.crossfade
|
|
7761
|
+
});
|
|
7762
|
+
}
|
|
7739
7763
|
mount() {
|
|
7740
7764
|
var _a;
|
|
7741
7765
|
(_a = this.state.visualElement.projection) == null ? void 0 : _a.mount(this.state.element);
|
|
@@ -7780,30 +7804,8 @@ class FeatureManager {
|
|
|
7780
7804
|
this.features.forEach((feature) => feature.beforeUnmount());
|
|
7781
7805
|
}
|
|
7782
7806
|
}
|
|
7783
|
-
let scheduled;
|
|
7784
|
-
const fireNext = (iterator) => iterator.next();
|
|
7785
|
-
const fireAnimateUpdates = (state2) => state2.animateUpdates();
|
|
7786
|
-
function processScheduledAnimations() {
|
|
7787
|
-
if (!scheduled)
|
|
7788
|
-
return;
|
|
7789
|
-
const generators2 = scheduled.sort(compareByDepth).map(fireAnimateUpdates);
|
|
7790
|
-
generators2.forEach(fireNext);
|
|
7791
|
-
generators2.forEach(fireNext);
|
|
7792
|
-
scheduled = void 0;
|
|
7793
|
-
}
|
|
7794
7807
|
function scheduleAnimation(state2) {
|
|
7795
|
-
|
|
7796
|
-
scheduled = [state2];
|
|
7797
|
-
requestAnimationFrame(processScheduledAnimations);
|
|
7798
|
-
} else {
|
|
7799
|
-
addUniqueItem(scheduled, state2);
|
|
7800
|
-
}
|
|
7801
|
-
}
|
|
7802
|
-
function unscheduleAnimation(state2) {
|
|
7803
|
-
scheduled && removeItem(scheduled, state2);
|
|
7804
|
-
}
|
|
7805
|
-
function compareByDepth(a, b) {
|
|
7806
|
-
return a.depth - b.depth;
|
|
7808
|
+
state2.animateUpdates();
|
|
7807
7809
|
}
|
|
7808
7810
|
function motionEvent(name, target, isExit) {
|
|
7809
7811
|
return new CustomEvent(name, { detail: { target, isExit } });
|
|
@@ -7811,7 +7813,7 @@ function motionEvent(name, target, isExit) {
|
|
|
7811
7813
|
function createVisualElement(Component, options) {
|
|
7812
7814
|
return isSVGElement$1(Component) ? new SVGVisualElement(options) : new HTMLVisualElement(options);
|
|
7813
7815
|
}
|
|
7814
|
-
function animateVariantsChildren(state2, activeState) {
|
|
7816
|
+
function animateVariantsChildren(state2, activeState, isFirstAnimate = false) {
|
|
7815
7817
|
const variantChildren = state2.visualElement.variantChildren;
|
|
7816
7818
|
if (!(variantChildren == null ? void 0 : variantChildren.size)) {
|
|
7817
7819
|
return {
|
|
@@ -7822,13 +7824,15 @@ function animateVariantsChildren(state2, activeState) {
|
|
|
7822
7824
|
const animationFactories = [];
|
|
7823
7825
|
Array.from(variantChildren).forEach((child, index) => {
|
|
7824
7826
|
var _a;
|
|
7825
|
-
const prevTarget = child.state.target;
|
|
7827
|
+
const prevTarget = isFirstAnimate ? child.state.baseTarget : child.state.target;
|
|
7826
7828
|
const childState = child.state;
|
|
7827
7829
|
childState.target = {};
|
|
7828
7830
|
for (const name in activeState) {
|
|
7829
|
-
|
|
7831
|
+
if (name === "initial" && !isFirstAnimate) {
|
|
7832
|
+
continue;
|
|
7833
|
+
}
|
|
7830
7834
|
const { definition, transition } = activeState[name];
|
|
7831
|
-
const { staggerChildren = 0, staggerDirection = 1, delayChildren = 0 } = transition;
|
|
7835
|
+
const { staggerChildren = 0, staggerDirection = 1, delayChildren = 0 } = transition || {};
|
|
7832
7836
|
const maxStaggerDuration = (variantChildren.size - 1) * staggerChildren;
|
|
7833
7837
|
const generateStaggerDuration = staggerDirection === 1 ? (i = 0) => i * staggerChildren : (i = 0) => maxStaggerDuration - i * staggerChildren;
|
|
7834
7838
|
const variant = resolveVariant(
|
|
@@ -7877,20 +7881,25 @@ function animateVariantsChildren(state2, activeState) {
|
|
|
7877
7881
|
};
|
|
7878
7882
|
}
|
|
7879
7883
|
const STATE_TYPES = ["initial", "animate", "inView", "hover", "press", "whileDrag", "exit"];
|
|
7880
|
-
const mountedStates = /* @__PURE__ */ new
|
|
7884
|
+
const mountedStates = /* @__PURE__ */ new Map();
|
|
7881
7885
|
let id = 0;
|
|
7882
7886
|
class MotionState {
|
|
7883
7887
|
constructor(options, parent) {
|
|
7888
|
+
var _a;
|
|
7884
7889
|
this.element = null;
|
|
7890
|
+
this.isSafeToRemove = false;
|
|
7885
7891
|
this.isFirstAnimate = true;
|
|
7892
|
+
this.children = /* @__PURE__ */ new Set();
|
|
7886
7893
|
this.activeStates = {
|
|
7887
|
-
initial: true,
|
|
7894
|
+
// initial: true,
|
|
7888
7895
|
animate: true
|
|
7889
7896
|
};
|
|
7890
7897
|
this._context = null;
|
|
7891
7898
|
this.id = `motion-state-${id++}`;
|
|
7899
|
+
mountedStates.set(this.id, this);
|
|
7892
7900
|
this.options = options;
|
|
7893
7901
|
this.parent = parent;
|
|
7902
|
+
(_a = parent == null ? void 0 : parent.children) == null ? void 0 : _a.add(this);
|
|
7894
7903
|
this.depth = (parent == null ? void 0 : parent.depth) + 1 || 0;
|
|
7895
7904
|
this.visualElement = createVisualElement(this.options.as, {
|
|
7896
7905
|
presenceContext: null,
|
|
@@ -7910,11 +7919,12 @@ class MotionState {
|
|
|
7910
7919
|
attrs: {}
|
|
7911
7920
|
},
|
|
7912
7921
|
latestValues: {}
|
|
7913
|
-
}
|
|
7922
|
+
},
|
|
7923
|
+
reducedMotionConfig: options.motionConfig.reduceMotion
|
|
7914
7924
|
});
|
|
7915
7925
|
const initialVariantSource = options.initial === false ? "animate" : "initial";
|
|
7916
|
-
this.featureManager = new FeatureManager(this);
|
|
7917
7926
|
this.initTarget(initialVariantSource);
|
|
7927
|
+
this.featureManager = new FeatureManager(this);
|
|
7918
7928
|
}
|
|
7919
7929
|
get context() {
|
|
7920
7930
|
if (!this._context) {
|
|
@@ -7930,7 +7940,7 @@ class MotionState {
|
|
|
7930
7940
|
}
|
|
7931
7941
|
initTarget(initialVariantSource) {
|
|
7932
7942
|
this.baseTarget = resolveVariant(this.options[initialVariantSource] || this.context[initialVariantSource], this.options.variants) || {};
|
|
7933
|
-
this.target = {
|
|
7943
|
+
this.target = {};
|
|
7934
7944
|
}
|
|
7935
7945
|
get initial() {
|
|
7936
7946
|
return isDef(this.options.initial) ? this.options.initial : this.context.initial;
|
|
@@ -7940,7 +7950,8 @@ class MotionState {
|
|
|
7940
7950
|
...this.options,
|
|
7941
7951
|
whileHover: this.options.hover,
|
|
7942
7952
|
whileTap: this.options.press,
|
|
7943
|
-
whileInView: this.options.inView
|
|
7953
|
+
whileInView: this.options.inView,
|
|
7954
|
+
reducedMotionConfig: this.options.motionConfig.reduceMotion
|
|
7944
7955
|
}, {
|
|
7945
7956
|
isPresent: !doneCallbacks.has(this.element)
|
|
7946
7957
|
});
|
|
@@ -7948,7 +7959,7 @@ class MotionState {
|
|
|
7948
7959
|
beforeMount() {
|
|
7949
7960
|
this.featureManager.beforeMount();
|
|
7950
7961
|
}
|
|
7951
|
-
mount(element, options) {
|
|
7962
|
+
mount(element, options, notAnimate = false) {
|
|
7952
7963
|
heyListen.invariant(
|
|
7953
7964
|
Boolean(element),
|
|
7954
7965
|
"Animation state must be mounted with valid Element"
|
|
@@ -7972,38 +7983,57 @@ class MotionState {
|
|
|
7972
7983
|
}
|
|
7973
7984
|
}
|
|
7974
7985
|
this.featureManager.mount();
|
|
7975
|
-
|
|
7986
|
+
if (!notAnimate) {
|
|
7987
|
+
this.animateUpdates(true);
|
|
7988
|
+
}
|
|
7976
7989
|
}
|
|
7977
7990
|
beforeUnmount() {
|
|
7978
7991
|
this.featureManager.beforeUnmount();
|
|
7979
7992
|
}
|
|
7980
|
-
unmount() {
|
|
7981
|
-
var _a;
|
|
7993
|
+
unmount(unMountChildren = false) {
|
|
7994
|
+
var _a, _b;
|
|
7982
7995
|
mountedStates.delete(this.element);
|
|
7983
|
-
|
|
7984
|
-
(_a = visualElementStore.get(this.element)) == null ? void 0 : _a.unmount();
|
|
7996
|
+
mountedStates.delete(this.id);
|
|
7985
7997
|
this.featureManager.unmount();
|
|
7998
|
+
(_a = this.visualElement) == null ? void 0 : _a.unmount();
|
|
7999
|
+
if (unMountChildren) {
|
|
8000
|
+
const unmountChild = (child) => {
|
|
8001
|
+
var _a2;
|
|
8002
|
+
child.unmount(true);
|
|
8003
|
+
(_a2 = child.children) == null ? void 0 : _a2.forEach(unmountChild);
|
|
8004
|
+
};
|
|
8005
|
+
(_b = this.children) == null ? void 0 : _b.forEach(unmountChild);
|
|
8006
|
+
}
|
|
7986
8007
|
}
|
|
7987
8008
|
beforeUpdate() {
|
|
7988
8009
|
this.featureManager.beforeUpdate();
|
|
7989
8010
|
}
|
|
7990
|
-
update(options) {
|
|
8011
|
+
update(options, notAnimate = false) {
|
|
8012
|
+
const prevAnimate = JSON.stringify(this.options.animate);
|
|
7991
8013
|
this.options = options;
|
|
8014
|
+
let hasAnimateChange = false;
|
|
8015
|
+
if (prevAnimate !== JSON.stringify(options.animate)) {
|
|
8016
|
+
hasAnimateChange = true;
|
|
8017
|
+
}
|
|
7992
8018
|
this.updateOptions();
|
|
7993
8019
|
this.featureManager.update();
|
|
7994
|
-
|
|
8020
|
+
if (hasAnimateChange && !notAnimate) {
|
|
8021
|
+
scheduleAnimation(this);
|
|
8022
|
+
}
|
|
7995
8023
|
}
|
|
7996
|
-
setActive(name, isActive) {
|
|
8024
|
+
setActive(name, isActive, isAnimate = true) {
|
|
7997
8025
|
var _a;
|
|
7998
8026
|
if (!this.element || this.activeStates[name] === isActive)
|
|
7999
8027
|
return;
|
|
8000
8028
|
this.activeStates[name] = isActive;
|
|
8001
8029
|
(_a = this.visualElement.variantChildren) == null ? void 0 : _a.forEach((child) => {
|
|
8002
|
-
child.state.setActive(name, isActive);
|
|
8030
|
+
child.state.setActive(name, isActive, false);
|
|
8003
8031
|
});
|
|
8004
|
-
|
|
8032
|
+
if (isAnimate) {
|
|
8033
|
+
scheduleAnimation(this);
|
|
8034
|
+
}
|
|
8005
8035
|
}
|
|
8006
|
-
|
|
8036
|
+
animateUpdates(isInitial = false) {
|
|
8007
8037
|
const prevTarget = this.target;
|
|
8008
8038
|
this.target = {};
|
|
8009
8039
|
const activeState = {};
|
|
@@ -8011,13 +8041,13 @@ class MotionState {
|
|
|
8011
8041
|
let transition;
|
|
8012
8042
|
for (const name of STATE_TYPES) {
|
|
8013
8043
|
if (name === "initial") {
|
|
8014
|
-
if (!
|
|
8044
|
+
if (!isInitial) {
|
|
8015
8045
|
continue;
|
|
8016
8046
|
}
|
|
8017
|
-
this.isFirstAnimate = false;
|
|
8018
8047
|
}
|
|
8019
|
-
if (!this.activeStates[name])
|
|
8048
|
+
if (!this.activeStates[name] && name !== "initial") {
|
|
8020
8049
|
continue;
|
|
8050
|
+
}
|
|
8021
8051
|
const definition = isDef(this.options[name]) ? this.options[name] : this.context[name];
|
|
8022
8052
|
const variant = resolveVariant(
|
|
8023
8053
|
definition,
|
|
@@ -8073,11 +8103,10 @@ class MotionState {
|
|
|
8073
8103
|
let getChildAnimations = () => Promise.resolve();
|
|
8074
8104
|
let childAnimations = [];
|
|
8075
8105
|
if (Object.keys(activeState).length) {
|
|
8076
|
-
const { getAnimations, animations: animations2 } = animateVariantsChildren(this, activeState);
|
|
8106
|
+
const { getAnimations, animations: animations2 } = animateVariantsChildren(this, activeState, isInitial);
|
|
8077
8107
|
getChildAnimations = getAnimations;
|
|
8078
8108
|
childAnimations = animations2;
|
|
8079
8109
|
}
|
|
8080
|
-
yield;
|
|
8081
8110
|
let animations;
|
|
8082
8111
|
const getAnimation = () => {
|
|
8083
8112
|
animations = animationFactories.map((factory) => factory()).filter(Boolean);
|
|
@@ -8115,13 +8144,32 @@ class MotionState {
|
|
|
8115
8144
|
getOptions() {
|
|
8116
8145
|
return this.options;
|
|
8117
8146
|
}
|
|
8147
|
+
willUpdate(label) {
|
|
8148
|
+
var _a;
|
|
8149
|
+
(_a = this.visualElement.projection) == null ? void 0 : _a.willUpdate();
|
|
8150
|
+
}
|
|
8118
8151
|
}
|
|
8119
8152
|
function getMotionElement(el) {
|
|
8120
8153
|
if ((el == null ? void 0 : el.nodeType) === 3 || (el == null ? void 0 : el.nodeType) === 8)
|
|
8121
8154
|
return getMotionElement(el.nextSibling);
|
|
8122
8155
|
return el;
|
|
8123
8156
|
}
|
|
8124
|
-
|
|
8157
|
+
function checkMotionIsHidden(instance) {
|
|
8158
|
+
var _a;
|
|
8159
|
+
const isHidden = ((_a = getMotionElement(instance.$el)) == null ? void 0 : _a.style.display) === "none";
|
|
8160
|
+
const hasTransition = instance.$.vnode.transition;
|
|
8161
|
+
return hasTransition && isHidden;
|
|
8162
|
+
}
|
|
8163
|
+
const defaultConfig = {
|
|
8164
|
+
reduceMotion: "never",
|
|
8165
|
+
transition: void 0,
|
|
8166
|
+
nonce: void 0
|
|
8167
|
+
};
|
|
8168
|
+
const [injectMotionConfig, provideMotionConfig] = createContext("MotionConfig");
|
|
8169
|
+
function useMotionConfig() {
|
|
8170
|
+
return injectMotionConfig(vue.computed(() => defaultConfig));
|
|
8171
|
+
}
|
|
8172
|
+
const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
|
|
8125
8173
|
...{
|
|
8126
8174
|
name: "Motion",
|
|
8127
8175
|
inheritAttrs: false
|
|
@@ -8130,6 +8178,7 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
|
8130
8178
|
props: /* @__PURE__ */ vue.mergeDefaults({
|
|
8131
8179
|
as: {},
|
|
8132
8180
|
asChild: { type: Boolean },
|
|
8181
|
+
whileDrag: {},
|
|
8133
8182
|
custom: {},
|
|
8134
8183
|
initial: { type: [String, Object, Boolean] },
|
|
8135
8184
|
animate: {},
|
|
@@ -8139,11 +8188,15 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
|
8139
8188
|
transformTemplate: { type: Function },
|
|
8140
8189
|
transition: {},
|
|
8141
8190
|
layoutGroup: {},
|
|
8191
|
+
motionConfig: {},
|
|
8192
|
+
onAnimationComplete: { type: Function },
|
|
8193
|
+
onUpdate: { type: Function },
|
|
8142
8194
|
layout: { type: [Boolean, String] },
|
|
8143
8195
|
layoutId: {},
|
|
8144
8196
|
layoutScroll: { type: Boolean },
|
|
8145
8197
|
layoutRoot: { type: Boolean },
|
|
8146
8198
|
"data-framer-portal-id": {},
|
|
8199
|
+
crossfade: { type: Boolean },
|
|
8147
8200
|
globalPressTarget: { type: Boolean },
|
|
8148
8201
|
press: {},
|
|
8149
8202
|
onPressStart: { type: Function },
|
|
@@ -8189,20 +8242,35 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
|
8189
8242
|
layoutRoot: false,
|
|
8190
8243
|
dragListener: true,
|
|
8191
8244
|
dragElastic: 0.2,
|
|
8192
|
-
dragMomentum: true
|
|
8245
|
+
dragMomentum: true,
|
|
8246
|
+
whileDrag: void 0,
|
|
8247
|
+
crossfade: true
|
|
8193
8248
|
}),
|
|
8194
8249
|
setup(__props) {
|
|
8195
8250
|
const props = __props;
|
|
8196
|
-
const
|
|
8251
|
+
const animatePresenceContext = injectAnimatePresence({});
|
|
8197
8252
|
const parentState = injectMotion(null);
|
|
8198
8253
|
const attrs = vue.useAttrs();
|
|
8199
8254
|
const layoutGroup = injectLayoutGroup({});
|
|
8200
|
-
const
|
|
8201
|
-
|
|
8255
|
+
const config = useMotionConfig();
|
|
8256
|
+
function getLayoutId() {
|
|
8257
|
+
if (layoutGroup.id && props.layoutId)
|
|
8258
|
+
return `${layoutGroup.id}-${props.layoutId}`;
|
|
8259
|
+
return props.layoutId || void 0;
|
|
8260
|
+
}
|
|
8261
|
+
function getMotionProps() {
|
|
8262
|
+
return {
|
|
8202
8263
|
...attrs,
|
|
8203
8264
|
...props,
|
|
8204
|
-
|
|
8205
|
-
|
|
8265
|
+
layoutId: getLayoutId(),
|
|
8266
|
+
transition: props.transition ?? config.value.transition,
|
|
8267
|
+
layoutGroup,
|
|
8268
|
+
motionConfig: config.value,
|
|
8269
|
+
initial: animatePresenceContext.initial === false ? animatePresenceContext.initial : props.initial === true ? void 0 : props.initial
|
|
8270
|
+
};
|
|
8271
|
+
}
|
|
8272
|
+
const state2 = new MotionState(
|
|
8273
|
+
getMotionProps(),
|
|
8206
8274
|
parentState
|
|
8207
8275
|
);
|
|
8208
8276
|
provideMotion(state2);
|
|
@@ -8211,29 +8279,20 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
|
8211
8279
|
state2.beforeMount();
|
|
8212
8280
|
});
|
|
8213
8281
|
vue.onMounted(() => {
|
|
8214
|
-
state2.mount(getMotionElement(instance.$el),
|
|
8215
|
-
...attrs,
|
|
8216
|
-
...props,
|
|
8217
|
-
layoutGroup,
|
|
8218
|
-
initial: presenceInitial.value === false ? presenceInitial.value : props.initial === true ? void 0 : props.initial
|
|
8219
|
-
});
|
|
8220
|
-
});
|
|
8221
|
-
vue.onBeforeUnmount(() => {
|
|
8222
|
-
state2.beforeUnmount();
|
|
8282
|
+
state2.mount(getMotionElement(instance.$el), getMotionProps(), checkMotionIsHidden(instance));
|
|
8223
8283
|
});
|
|
8284
|
+
vue.onBeforeUnmount(() => state2.beforeUnmount());
|
|
8224
8285
|
vue.onUnmounted(() => {
|
|
8225
|
-
|
|
8286
|
+
const el = getMotionElement(instance.$el);
|
|
8287
|
+
if (!(el == null ? void 0 : el.isConnected)) {
|
|
8226
8288
|
state2.unmount();
|
|
8289
|
+
}
|
|
8227
8290
|
});
|
|
8228
8291
|
vue.onBeforeUpdate(() => {
|
|
8229
8292
|
state2.beforeUpdate();
|
|
8230
8293
|
});
|
|
8231
8294
|
vue.onUpdated(() => {
|
|
8232
|
-
state2.update(
|
|
8233
|
-
...attrs,
|
|
8234
|
-
...props,
|
|
8235
|
-
initial: presenceInitial.value === false ? presenceInitial.value : props.initial === true ? void 0 : props.initial
|
|
8236
|
-
});
|
|
8295
|
+
state2.update(getMotionProps());
|
|
8237
8296
|
});
|
|
8238
8297
|
function getProps() {
|
|
8239
8298
|
const isSVG = state2.visualElement.type === "svg";
|
|
@@ -8252,7 +8311,7 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
|
8252
8311
|
Object.assign(styleProps, style2);
|
|
8253
8312
|
}
|
|
8254
8313
|
if (!state2.isMounted()) {
|
|
8255
|
-
Object.assign(styleProps, state2.
|
|
8314
|
+
Object.assign(styleProps, state2.baseTarget);
|
|
8256
8315
|
}
|
|
8257
8316
|
if (props.drag && props.dragListener !== false) {
|
|
8258
8317
|
Object.assign(styleProps, {
|
|
@@ -8270,84 +8329,22 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
|
8270
8329
|
return attrsProps;
|
|
8271
8330
|
}
|
|
8272
8331
|
return (_ctx, _cache) => {
|
|
8273
|
-
|
|
8274
|
-
return vue.openBlock(), vue.createBlock(vue.unref(Primitive), vue.mergeProps({
|
|
8332
|
+
return vue.openBlock(), vue.createBlock(vue.unref(Primitive), vue.mergeProps(getProps(), {
|
|
8275
8333
|
as: _ctx.as,
|
|
8276
|
-
"as-child": _ctx.asChild
|
|
8277
|
-
|
|
8278
|
-
"data-layout-group-key": (_b = (_a = vue.unref(layoutGroup)) == null ? void 0 : _a.key) == null ? void 0 : _b.value
|
|
8334
|
+
"as-child": _ctx.asChild,
|
|
8335
|
+
"data-motion-id": vue.unref(state2).id
|
|
8279
8336
|
}), {
|
|
8280
8337
|
default: vue.withCtx(() => [
|
|
8281
8338
|
vue.renderSlot(_ctx.$slots, "default")
|
|
8282
8339
|
]),
|
|
8283
8340
|
_: 3
|
|
8284
|
-
}, 16, ["as", "as-child", "data-
|
|
8341
|
+
}, 16, ["as", "as-child", "data-motion-id"]);
|
|
8285
8342
|
};
|
|
8286
8343
|
}
|
|
8287
8344
|
});
|
|
8288
|
-
function useForceUpdate() {
|
|
8289
|
-
const key = vue.ref(0);
|
|
8290
|
-
function forceUpdate() {
|
|
8291
|
-
key.value++;
|
|
8292
|
-
}
|
|
8293
|
-
return [forceUpdate, key];
|
|
8294
|
-
}
|
|
8295
|
-
function notify(node) {
|
|
8296
|
-
return !node.isLayoutDirty && node.willUpdate(false);
|
|
8297
|
-
}
|
|
8298
|
-
function nodeGroup() {
|
|
8299
|
-
const nodes = /* @__PURE__ */ new Set();
|
|
8300
|
-
const subscriptions = /* @__PURE__ */ new WeakMap();
|
|
8301
|
-
const dirtyAll = () => nodes.forEach(notify);
|
|
8302
|
-
return {
|
|
8303
|
-
add: (node) => {
|
|
8304
|
-
nodes.add(node);
|
|
8305
|
-
subscriptions.set(
|
|
8306
|
-
node,
|
|
8307
|
-
node.addEventListener("willUpdate", dirtyAll)
|
|
8308
|
-
);
|
|
8309
|
-
},
|
|
8310
|
-
remove: (node) => {
|
|
8311
|
-
nodes.delete(node);
|
|
8312
|
-
const unsubscribe = subscriptions.get(node);
|
|
8313
|
-
if (unsubscribe) {
|
|
8314
|
-
unsubscribe();
|
|
8315
|
-
subscriptions.delete(node);
|
|
8316
|
-
}
|
|
8317
|
-
dirtyAll();
|
|
8318
|
-
},
|
|
8319
|
-
dirty: dirtyAll
|
|
8320
|
-
};
|
|
8321
|
-
}
|
|
8322
|
-
function useLayoutGroup(props) {
|
|
8323
|
-
const parentGroup = injectLayoutGroup(null);
|
|
8324
|
-
const [forceRender, key] = useForceUpdate();
|
|
8325
|
-
const context = {
|
|
8326
|
-
id: getGroupId(props, parentGroup),
|
|
8327
|
-
group: getGroup(props, parentGroup),
|
|
8328
|
-
forceRender,
|
|
8329
|
-
key
|
|
8330
|
-
};
|
|
8331
|
-
vue.watch(key, () => {
|
|
8332
|
-
context.id = getGroupId(props, parentGroup);
|
|
8333
|
-
});
|
|
8334
|
-
provideLayoutGroup(context);
|
|
8335
|
-
return context;
|
|
8336
|
-
}
|
|
8337
|
-
function getGroupId(props, parentGroup) {
|
|
8338
|
-
const shouldInherit = props.inherit === true || props.inherit === "id";
|
|
8339
|
-
const parentId = parentGroup == null ? void 0 : parentGroup.id;
|
|
8340
|
-
if (shouldInherit && parentId) {
|
|
8341
|
-
return props.id ? `${parentId}-${props.id}` : parentId;
|
|
8342
|
-
}
|
|
8343
|
-
return props.id;
|
|
8344
|
-
}
|
|
8345
|
-
function getGroup(props, parentGroup) {
|
|
8346
|
-
const shouldInherit = props.inherit === true || props.inherit === "group";
|
|
8347
|
-
return shouldInherit ? (parentGroup == null ? void 0 : parentGroup.group) || nodeGroup() : nodeGroup();
|
|
8348
|
-
}
|
|
8349
8345
|
function usePopLayout(props) {
|
|
8350
8346
|
const styles = /* @__PURE__ */ new WeakMap();
|
|
8347
|
+
const config = useMotionConfig();
|
|
8351
8348
|
function addPopStyle(state2) {
|
|
8352
8349
|
if (props.mode !== "popLayout")
|
|
8353
8350
|
return;
|
|
@@ -8359,6 +8356,9 @@ function usePopLayout(props) {
|
|
|
8359
8356
|
};
|
|
8360
8357
|
state2.element.dataset.motionPopId = state2.id;
|
|
8361
8358
|
const style2 = document.createElement("style");
|
|
8359
|
+
if (config.value.nonce) {
|
|
8360
|
+
style2.nonce = config.value.nonce;
|
|
8361
|
+
}
|
|
8362
8362
|
styles.set(state2, style2);
|
|
8363
8363
|
document.head.appendChild(style2);
|
|
8364
8364
|
style2.textContent = `
|
|
@@ -8390,7 +8390,7 @@ function usePopLayout(props) {
|
|
|
8390
8390
|
removePopStyle
|
|
8391
8391
|
};
|
|
8392
8392
|
}
|
|
8393
|
-
const _sfc_main$
|
|
8393
|
+
const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
8394
8394
|
...{
|
|
8395
8395
|
name: "AnimatePresence",
|
|
8396
8396
|
inheritAttrs: true
|
|
@@ -8400,44 +8400,64 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
|
8400
8400
|
mode: { default: "sync" },
|
|
8401
8401
|
initial: { type: Boolean, default: true },
|
|
8402
8402
|
multiple: { type: Boolean, default: false },
|
|
8403
|
-
as: {}
|
|
8403
|
+
as: {},
|
|
8404
|
+
custom: {},
|
|
8405
|
+
onExitComplete: {}
|
|
8404
8406
|
},
|
|
8405
8407
|
setup(__props) {
|
|
8406
8408
|
const props = __props;
|
|
8407
|
-
const
|
|
8408
|
-
|
|
8409
|
-
|
|
8410
|
-
|
|
8411
|
-
|
|
8412
|
-
|
|
8409
|
+
const presenceContext = {
|
|
8410
|
+
initial: props.initial,
|
|
8411
|
+
custom: props.custom
|
|
8412
|
+
};
|
|
8413
|
+
provideAnimatePresence(presenceContext);
|
|
8414
|
+
vue.onMounted(() => {
|
|
8415
|
+
presenceContext.initial = void 0;
|
|
8413
8416
|
});
|
|
8414
8417
|
function enter(el) {
|
|
8415
8418
|
const state2 = mountedStates.get(el);
|
|
8419
|
+
const motionStateId = el.dataset.motionId;
|
|
8420
|
+
const motionState = mountedStates.get(motionStateId);
|
|
8421
|
+
if (motionState) {
|
|
8422
|
+
const baseStyle = createStyles(motionState.baseTarget);
|
|
8423
|
+
Object.assign(el.style, baseStyle);
|
|
8424
|
+
}
|
|
8416
8425
|
if (!state2) {
|
|
8417
8426
|
return;
|
|
8418
8427
|
}
|
|
8419
8428
|
removeDoneCallback(el);
|
|
8420
8429
|
state2.setActive("exit", false);
|
|
8421
8430
|
}
|
|
8422
|
-
const layoutGroup = useLayoutGroup(props);
|
|
8423
8431
|
const { addPopStyle, removePopStyle } = usePopLayout(props);
|
|
8432
|
+
const exitDom = /* @__PURE__ */ new Map();
|
|
8433
|
+
vue.onUnmounted(() => {
|
|
8434
|
+
exitDom.clear();
|
|
8435
|
+
});
|
|
8424
8436
|
function exit(el, done) {
|
|
8425
8437
|
const state2 = mountedStates.get(el);
|
|
8426
8438
|
if (!state2) {
|
|
8427
8439
|
return done();
|
|
8428
8440
|
}
|
|
8441
|
+
exitDom.set(el, true);
|
|
8429
8442
|
removeDoneCallback(el);
|
|
8430
8443
|
addPopStyle(state2);
|
|
8431
8444
|
function doneCallback(e) {
|
|
8432
|
-
var _a, _b
|
|
8433
|
-
removePopStyle(state2);
|
|
8445
|
+
var _a, _b;
|
|
8434
8446
|
if ((_a = e == null ? void 0 : e.detail) == null ? void 0 : _a.isExit) {
|
|
8447
|
+
const projection = state2.visualElement.projection;
|
|
8448
|
+
if ((projection == null ? void 0 : projection.animationProgress) > 0 && !state2.isSafeToRemove) {
|
|
8449
|
+
return;
|
|
8450
|
+
}
|
|
8451
|
+
state2.willUpdate("done");
|
|
8452
|
+
removePopStyle(state2);
|
|
8435
8453
|
removeDoneCallback(el);
|
|
8436
|
-
|
|
8437
|
-
(
|
|
8454
|
+
exitDom.delete(el);
|
|
8455
|
+
if (exitDom.size === 0) {
|
|
8456
|
+
(_b = props.onExitComplete) == null ? void 0 : _b.call(props);
|
|
8457
|
+
}
|
|
8438
8458
|
done();
|
|
8439
|
-
if (!el.isConnected) {
|
|
8440
|
-
state2.unmount();
|
|
8459
|
+
if (!(el == null ? void 0 : el.isConnected)) {
|
|
8460
|
+
state2.unmount(true);
|
|
8441
8461
|
}
|
|
8442
8462
|
}
|
|
8443
8463
|
}
|
|
@@ -8461,6 +8481,97 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
|
8461
8481
|
};
|
|
8462
8482
|
}
|
|
8463
8483
|
});
|
|
8484
|
+
const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
8485
|
+
...{
|
|
8486
|
+
name: "MotionConfig",
|
|
8487
|
+
inheritAttrs: false
|
|
8488
|
+
},
|
|
8489
|
+
__name: "MotionConfig",
|
|
8490
|
+
props: {
|
|
8491
|
+
transition: {},
|
|
8492
|
+
reduceMotion: { default: defaultConfig.reduceMotion },
|
|
8493
|
+
nonce: {}
|
|
8494
|
+
},
|
|
8495
|
+
setup(__props) {
|
|
8496
|
+
const props = __props;
|
|
8497
|
+
const parentConfig = useMotionConfig();
|
|
8498
|
+
const config = vue.computed(() => ({
|
|
8499
|
+
transition: props.transition ?? parentConfig.value.transition,
|
|
8500
|
+
reduceMotion: props.reduceMotion ?? parentConfig.value.reduceMotion,
|
|
8501
|
+
nonce: props.nonce ?? parentConfig.value.nonce
|
|
8502
|
+
}));
|
|
8503
|
+
provideMotionConfig(config);
|
|
8504
|
+
return (_ctx, _cache) => {
|
|
8505
|
+
return vue.renderSlot(_ctx.$slots, "default");
|
|
8506
|
+
};
|
|
8507
|
+
}
|
|
8508
|
+
});
|
|
8509
|
+
function useForceUpdate() {
|
|
8510
|
+
const key = vue.ref(0);
|
|
8511
|
+
function forceUpdate() {
|
|
8512
|
+
key.value++;
|
|
8513
|
+
}
|
|
8514
|
+
return [forceUpdate, key];
|
|
8515
|
+
}
|
|
8516
|
+
function notify(node) {
|
|
8517
|
+
return !node.isLayoutDirty && node.willUpdate(false);
|
|
8518
|
+
}
|
|
8519
|
+
function nodeGroup() {
|
|
8520
|
+
const nodes = /* @__PURE__ */ new Set();
|
|
8521
|
+
const subscriptions = /* @__PURE__ */ new WeakMap();
|
|
8522
|
+
const dirtyAll = () => nodes.forEach(notify);
|
|
8523
|
+
return {
|
|
8524
|
+
add: (node) => {
|
|
8525
|
+
nodes.add(node);
|
|
8526
|
+
subscriptions.set(
|
|
8527
|
+
node,
|
|
8528
|
+
node.addEventListener("willUpdate", dirtyAll)
|
|
8529
|
+
);
|
|
8530
|
+
},
|
|
8531
|
+
remove: (node) => {
|
|
8532
|
+
nodes.delete(node);
|
|
8533
|
+
const unsubscribe = subscriptions.get(node);
|
|
8534
|
+
if (unsubscribe) {
|
|
8535
|
+
unsubscribe();
|
|
8536
|
+
subscriptions.delete(node);
|
|
8537
|
+
}
|
|
8538
|
+
},
|
|
8539
|
+
dirty: dirtyAll,
|
|
8540
|
+
didUpdate: () => {
|
|
8541
|
+
var _a;
|
|
8542
|
+
(_a = nodes[0]) == null ? void 0 : _a.didUpdate();
|
|
8543
|
+
}
|
|
8544
|
+
};
|
|
8545
|
+
}
|
|
8546
|
+
function useLayoutGroupProvider(props) {
|
|
8547
|
+
const parentGroup = injectLayoutGroup(null);
|
|
8548
|
+
const [forceRender, key] = useForceUpdate();
|
|
8549
|
+
const context = {
|
|
8550
|
+
id: getGroupId(props, parentGroup),
|
|
8551
|
+
group: getGroup(props, parentGroup),
|
|
8552
|
+
forceRender,
|
|
8553
|
+
key
|
|
8554
|
+
};
|
|
8555
|
+
provideLayoutGroup(context);
|
|
8556
|
+
return context;
|
|
8557
|
+
}
|
|
8558
|
+
function useLayoutGroup() {
|
|
8559
|
+
const { forceRender } = injectLayoutGroup({ forceRender: () => {
|
|
8560
|
+
} });
|
|
8561
|
+
return { forceRender };
|
|
8562
|
+
}
|
|
8563
|
+
function getGroupId(props, parentGroup) {
|
|
8564
|
+
const shouldInherit = props.inherit === true || props.inherit === "id";
|
|
8565
|
+
const parentId = parentGroup == null ? void 0 : parentGroup.id;
|
|
8566
|
+
if (shouldInherit && parentId) {
|
|
8567
|
+
return props.id ? `${parentId}-${props.id}` : parentId;
|
|
8568
|
+
}
|
|
8569
|
+
return props.id;
|
|
8570
|
+
}
|
|
8571
|
+
function getGroup(props, parentGroup) {
|
|
8572
|
+
const shouldInherit = props.inherit === true || props.inherit === "group";
|
|
8573
|
+
return shouldInherit ? (parentGroup == null ? void 0 : parentGroup.group) || nodeGroup() : nodeGroup();
|
|
8574
|
+
}
|
|
8464
8575
|
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
8465
8576
|
__name: "LayoutGroup",
|
|
8466
8577
|
props: {
|
|
@@ -8469,9 +8580,15 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
8469
8580
|
},
|
|
8470
8581
|
setup(__props) {
|
|
8471
8582
|
const props = __props;
|
|
8472
|
-
|
|
8583
|
+
const { forceRender, key, group } = useLayoutGroupProvider(props);
|
|
8584
|
+
vue.onBeforeUpdate(() => {
|
|
8585
|
+
group.dirty();
|
|
8586
|
+
});
|
|
8473
8587
|
return (_ctx, _cache) => {
|
|
8474
|
-
return vue.renderSlot(_ctx.$slots, "default"
|
|
8588
|
+
return vue.renderSlot(_ctx.$slots, "default", {
|
|
8589
|
+
renderKey: vue.unref(key),
|
|
8590
|
+
forceRender: vue.unref(forceRender)
|
|
8591
|
+
});
|
|
8475
8592
|
};
|
|
8476
8593
|
}
|
|
8477
8594
|
});
|
|
@@ -8679,7 +8796,8 @@ const components = {
|
|
|
8679
8796
|
motion: [
|
|
8680
8797
|
"Motion",
|
|
8681
8798
|
"AnimatePresence",
|
|
8682
|
-
"LayoutGroup"
|
|
8799
|
+
"LayoutGroup",
|
|
8800
|
+
"MotionConfig"
|
|
8683
8801
|
]
|
|
8684
8802
|
};
|
|
8685
8803
|
const utilities = {
|
|
@@ -8694,7 +8812,8 @@ const utilities = {
|
|
|
8694
8812
|
"useAnimate",
|
|
8695
8813
|
"useInView",
|
|
8696
8814
|
"useAnimationFrame",
|
|
8697
|
-
"useMotionValueEvent"
|
|
8815
|
+
"useMotionValueEvent",
|
|
8816
|
+
"useLayoutGroup"
|
|
8698
8817
|
]
|
|
8699
8818
|
};
|
|
8700
8819
|
function useAnimate() {
|
|
@@ -8727,9 +8846,10 @@ Object.defineProperty(exports, "isDragActive", {
|
|
|
8727
8846
|
enumerable: true,
|
|
8728
8847
|
get: () => motionDom.isDragActive
|
|
8729
8848
|
});
|
|
8730
|
-
exports.AnimatePresence = _sfc_main$
|
|
8849
|
+
exports.AnimatePresence = _sfc_main$2;
|
|
8731
8850
|
exports.LayoutGroup = _sfc_main;
|
|
8732
|
-
exports.Motion = _sfc_main$
|
|
8851
|
+
exports.Motion = _sfc_main$3;
|
|
8852
|
+
exports.MotionConfig = _sfc_main$1;
|
|
8733
8853
|
exports.MotionValue = MotionValue;
|
|
8734
8854
|
exports.animate = animate;
|
|
8735
8855
|
exports.animateMini = animateMini;
|
|
@@ -8773,12 +8893,11 @@ exports.pipe = pipe;
|
|
|
8773
8893
|
exports.progress = progress$1;
|
|
8774
8894
|
exports.provideLayoutGroup = provideLayoutGroup;
|
|
8775
8895
|
exports.provideMotion = provideMotion;
|
|
8896
|
+
exports.provideMotionConfig = provideMotionConfig;
|
|
8776
8897
|
exports.reverseEasing = reverseEasing;
|
|
8777
8898
|
exports.scroll = scroll;
|
|
8778
8899
|
exports.scrollInfo = scrollInfo;
|
|
8779
8900
|
exports.secondsToMilliseconds = secondsToMilliseconds;
|
|
8780
|
-
exports.shouldInheritGroup = shouldInheritGroup;
|
|
8781
|
-
exports.shouldInheritId = shouldInheritId;
|
|
8782
8901
|
exports.spring = spring;
|
|
8783
8902
|
exports.stagger = stagger;
|
|
8784
8903
|
exports.steps = steps;
|
|
@@ -8790,6 +8909,8 @@ exports.useAnimationFrame = useAnimationFrame;
|
|
|
8790
8909
|
exports.useCombineMotionValues = useCombineMotionValues;
|
|
8791
8910
|
exports.useComputed = useComputed;
|
|
8792
8911
|
exports.useInView = useInView;
|
|
8912
|
+
exports.useLayoutGroup = useLayoutGroup;
|
|
8913
|
+
exports.useMotionConfig = useMotionConfig;
|
|
8793
8914
|
exports.useMotionTemplate = useMotionTemplate;
|
|
8794
8915
|
exports.useMotionValue = motionValue;
|
|
8795
8916
|
exports.useMotionValueEvent = useMotionValueEvent;
|