@hyperframes/studio 0.8.132 → 0.8.133
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/assets/{hyperframes-player-Cp8e_Zst.js → hyperframes-player-Cjcwveg0.js} +1 -1
- package/dist/assets/{index-DMTt9nTf.js → index-CwgWmfgx.js} +1 -1
- package/dist/assets/{index-oE1pOdAy.js → index-Dj21zXWA.js} +116 -116
- package/dist/assets/{index-CASEBNy2.js → index-ME-Z5jh6.js} +1 -1
- package/dist/index.html +1 -1
- package/dist/index.js +33 -99
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
- package/src/player/components/timelineClipDragCommit.test.ts +22 -0
- package/src/player/components/timelineClipDragCommit.ts +7 -10
- package/src/player/components/timelineStackingSync.test.ts +101 -142
- package/src/player/components/timelineStackingSync.ts +51 -235
- package/src/player/components/useTimelineStackingSync.ts +1 -1
- package/src/timelineStackingSyncExport.test.tsx +3 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as P}from"./index-
|
|
1
|
+
import{g as P}from"./index-Dj21zXWA.js";function j(c,d){for(var s=0;s<d.length;s++){const a=d[s];if(typeof a!="string"&&!Array.isArray(a)){for(const i in a)if(i!=="default"&&!(i in c)){const l=Object.getOwnPropertyDescriptor(a,i);l&&Object.defineProperty(c,i,l.get?l:{enumerable:!0,get:()=>a[i]})}}}return Object.freeze(Object.defineProperty(c,Symbol.toStringTag,{value:"Module"}))}var v={},w;function k(){if(w)return v;w=1,Object.defineProperty(v,"__esModule",{value:!0}),v.default=d;var c=window.OfflineAudioContext||window.webkitOfflineAudioContext;function d(e){var r=a(e);return r.start(0),[i,y,O(e.sampleRate),s].reduce(function(t,o){return o(t)},r.buffer.getChannelData(0))}function s(e){return e.sort(function(r,t){return t.count-r.count}).splice(0,5)[0].tempo}function a(e){var r=e.length,t=e.numberOfChannels,o=e.sampleRate,n=new c(t,r,o),u=n.createBufferSource();u.buffer=e;var f=n.createBiquadFilter();return f.type="lowpass",u.connect(f),f.connect(n.destination),u}function i(e){for(var r=[],t=.9,o=.3,n=15;r.length<n&&t>=o;)r=l(e,t),t-=.05;if(r.length<n)throw new Error("Could not find enough samples for a reliable detection.");return r}function l(e,r){for(var t=[],o=0,n=e.length;o<n;o+=1)e[o]>r&&(t.push(o),o+=1e4);return t}function y(e){var r=[];return e.forEach(function(t,o){for(var n=function(x){var g=e[o+x]-t,_=r.some(function(h){if(h.interval===g)return h.count+=1});_||r.push({interval:g,count:1})},u=0;u<10;u+=1)n(u)}),r}function O(e){return function(r){var t=[];return r.forEach(function(o){if(o.interval!==0){for(var n=60/(o.interval/e);n<90;)n*=2;for(;n>180;)n/=2;n=Math.round(n);var u=t.some(function(f){if(f.tempo===n)return f.count+=o.count});u||t.push({tempo:n,count:o.count})}}),t}}return v}var p,b;function q(){return b||(b=1,p=k().default),p}var m=q();const A=P(m),D=j({__proto__:null,default:A},[m]);export{D as i};
|
package/dist/index.html
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
document.documentElement.dataset.theme = "paper";
|
|
15
15
|
}
|
|
16
16
|
</script>
|
|
17
|
-
<script type="module" crossorigin src="/assets/index-
|
|
17
|
+
<script type="module" crossorigin src="/assets/index-Dj21zXWA.js"></script>
|
|
18
18
|
<link rel="stylesheet" crossorigin href="/assets/index-D11atkBt.css">
|
|
19
19
|
</head>
|
|
20
20
|
<body>
|
package/dist/index.js
CHANGED
|
@@ -9099,100 +9099,37 @@ function paintsAbove(a, b) {
|
|
|
9099
9099
|
if (a.domIndex != null && b.domIndex != null) return a.domIndex > b.domIndex;
|
|
9100
9100
|
return false;
|
|
9101
9101
|
}
|
|
9102
|
-
function
|
|
9103
|
-
|
|
9104
|
-
|
|
9105
|
-
|
|
9106
|
-
|
|
9107
|
-
|
|
9108
|
-
const
|
|
9109
|
-
|
|
9110
|
-
const
|
|
9111
|
-
|
|
9112
|
-
|
|
9113
|
-
|
|
9114
|
-
|
|
9115
|
-
|
|
9116
|
-
|
|
9117
|
-
|
|
9118
|
-
|
|
9119
|
-
const clamped = Math.max(0, target);
|
|
9120
|
-
if (clamped !== edited.zIndex) patchZ(edited, clamped);
|
|
9121
|
-
liftAbove(edited, overlappersOf, patchZ);
|
|
9122
|
-
return true;
|
|
9123
|
-
}
|
|
9124
|
-
function zBetweenNeighbours(maxBelow, minAbove, correctAt) {
|
|
9125
|
-
if (minAbove - maxBelow >= 2) {
|
|
9126
|
-
const mid = Math.floor((maxBelow + minAbove) / 2);
|
|
9127
|
-
return mid > maxBelow && mid < minAbove ? mid : null;
|
|
9128
|
-
}
|
|
9129
|
-
return correctAt(minAbove) ? minAbove : null;
|
|
9130
|
-
}
|
|
9131
|
-
function zBelowOnly(minAbove, correctAt) {
|
|
9132
|
-
const candidate = minAbove - 1;
|
|
9133
|
-
if (candidate >= 0) return candidate;
|
|
9134
|
-
return correctAt(minAbove) ? minAbove : null;
|
|
9135
|
-
}
|
|
9136
|
-
function trySingleZ(edited, below, above) {
|
|
9137
|
-
const maxBelow = boundaryZ(below, (zs) => Math.max(...zs));
|
|
9138
|
-
const minAbove = boundaryZ(above, (zs) => Math.min(...zs));
|
|
9139
|
-
const correctAt = (z) => {
|
|
9140
|
-
const probe2 = { ...edited, zIndex: z };
|
|
9141
|
-
return below.every((b) => paintsAbove(probe2, b)) && above.every((a) => paintsAbove(a, probe2));
|
|
9142
|
-
};
|
|
9143
|
-
if (maxBelow != null && minAbove != null)
|
|
9144
|
-
return zBetweenNeighbours(maxBelow, minAbove, correctAt);
|
|
9145
|
-
if (maxBelow != null) return maxBelow + 1;
|
|
9146
|
-
if (minAbove != null) return zBelowOnly(minAbove, correctAt);
|
|
9147
|
-
return null;
|
|
9148
|
-
}
|
|
9149
|
-
function liftAbove(edited, overlappersOf, patchZ) {
|
|
9150
|
-
const queue2 = [edited];
|
|
9151
|
-
const raiseAbove = (clip, floor) => {
|
|
9152
|
-
if (paintsAbove(clip, floor)) return;
|
|
9153
|
-
patchZ(clip, floor.zIndex + 1);
|
|
9154
|
-
queue2.push(clip);
|
|
9155
|
-
};
|
|
9156
|
-
while (queue2.length > 0) {
|
|
9157
|
-
const floor = queue2.shift();
|
|
9158
|
-
for (const other of overlappersOf(floor)) {
|
|
9159
|
-
if (laneIsAbove(other, floor) && !paintsAbove(other, floor)) raiseAbove(other, floor);
|
|
9160
|
-
}
|
|
9161
|
-
}
|
|
9102
|
+
function raisedZ(clip, overlapping) {
|
|
9103
|
+
const below = overlapping.filter((o) => laneIsAbove(clip, o));
|
|
9104
|
+
if (below.every((o) => paintsAbove(clip, o))) return null;
|
|
9105
|
+
return Math.max(...below.map((o) => o.zIndex)) + 1;
|
|
9106
|
+
}
|
|
9107
|
+
function loweredZ(clip, overlapping) {
|
|
9108
|
+
const above = overlapping.filter((o) => laneIsAbove(o, clip));
|
|
9109
|
+
if (above.every((o) => paintsAbove(o, clip))) return null;
|
|
9110
|
+
const keepOver = overlapping.filter((o) => laneIsAbove(clip, o) && paintsAbove(clip, o));
|
|
9111
|
+
const floor = Math.max(
|
|
9112
|
+
0,
|
|
9113
|
+
...keepOver.map(
|
|
9114
|
+
(o) => paintsAbove({ ...clip, zIndex: o.zIndex }, o) ? o.zIndex : o.zIndex + 1
|
|
9115
|
+
)
|
|
9116
|
+
);
|
|
9117
|
+
const z = Math.max(floor, Math.min(...above.map((o) => o.zIndex)) - 1);
|
|
9118
|
+
return z < clip.zIndex ? z : null;
|
|
9162
9119
|
}
|
|
9163
|
-
function computeStackingPatches(elements, editedKeys) {
|
|
9120
|
+
function computeStackingPatches(elements, editedKeys, direction) {
|
|
9164
9121
|
const editedSet = new Set(editedKeys);
|
|
9165
|
-
|
|
9166
|
-
const
|
|
9167
|
-
const editedScopes = new Set(allResolved.filter((e) => editedSet.has(e.key)).map(paintScopeKey));
|
|
9168
|
-
const resolved2 = allResolved.filter((e) => editedScopes.has(paintScopeKey(e)));
|
|
9169
|
-
const byKey = new Map(resolved2.map((e) => [e.key, { ...e }]));
|
|
9170
|
-
const edited = resolved2.filter((e) => editedSet.has(e.key) && !e.isAudio).map((e) => byKey.get(e.key)).sort((a, b) => b.track - a.track);
|
|
9171
|
-
const changed = /* @__PURE__ */ new Map();
|
|
9172
|
-
const patchZ = (clip, z) => {
|
|
9173
|
-
clip.zIndex = z;
|
|
9174
|
-
changed.set(clip.key, z);
|
|
9175
|
-
};
|
|
9176
|
-
const all = [...byKey.values()];
|
|
9177
|
-
const overlappersOf = (clip) => all.filter(
|
|
9178
|
-
(o) => o.key !== clip.key && !o.isAudio && samePaintScope(clip, o) && overlapsInTime(clip, o)
|
|
9179
|
-
);
|
|
9180
|
-
for (const clip of edited) {
|
|
9181
|
-
resolveEditedZ(clip, overlappersOf(clip), overlappersOf, patchZ);
|
|
9182
|
-
}
|
|
9183
|
-
const emitted = /* @__PURE__ */ new Set();
|
|
9122
|
+
const live = elements.filter((e) => Number.isFinite(e.zIndex) && !e.isAudio).map((e) => ({ ...e }));
|
|
9123
|
+
const edited = live.filter((e) => editedSet.has(e.key)).sort((a, b) => direction === "up" ? b.track - a.track : a.track - b.track);
|
|
9184
9124
|
const patches = [];
|
|
9185
9125
|
for (const clip of edited) {
|
|
9186
|
-
|
|
9187
|
-
|
|
9188
|
-
|
|
9189
|
-
|
|
9190
|
-
|
|
9191
|
-
|
|
9192
|
-
|
|
9193
|
-
patches.push({ key: key2, zIndex });
|
|
9194
|
-
emitted.add(key2);
|
|
9195
|
-
}
|
|
9126
|
+
const overlapping = live.filter(
|
|
9127
|
+
(o) => o.key !== clip.key && overlapsInTime(clip, o) && samePaintScope(clip, o)
|
|
9128
|
+
);
|
|
9129
|
+
const zIndex = direction === "up" ? raisedZ(clip, overlapping) : loweredZ(clip, overlapping);
|
|
9130
|
+
if (zIndex === null) continue;
|
|
9131
|
+
clip.zIndex = zIndex;
|
|
9132
|
+
patches.push({ key: clip.key, zIndex });
|
|
9196
9133
|
}
|
|
9197
9134
|
return patches;
|
|
9198
9135
|
}
|
|
@@ -9841,7 +9778,6 @@ function commitDraggedClipMove(drag, deps) {
|
|
|
9841
9778
|
if (multi?.keys.has(keyOf6(e))) return { ...e, start: multi.movedStart(e) };
|
|
9842
9779
|
return e;
|
|
9843
9780
|
});
|
|
9844
|
-
const multiKeys = multi ? multi.keys : null;
|
|
9845
9781
|
if (!isVertical || !deps.readZIndex || !deps.onStackingPatches) {
|
|
9846
9782
|
void refreshAfterDurableLaneMove(
|
|
9847
9783
|
persistMoveEdits(edits, deps, coalesceKey, "lane-reorder"),
|
|
@@ -9857,7 +9793,6 @@ function commitDraggedClipMove(drag, deps) {
|
|
|
9857
9793
|
dragKey,
|
|
9858
9794
|
drag.element.track,
|
|
9859
9795
|
drag.previewTrack,
|
|
9860
|
-
multiKeys,
|
|
9861
9796
|
deps,
|
|
9862
9797
|
coalesceKey
|
|
9863
9798
|
)
|
|
@@ -9947,7 +9882,6 @@ function commitTrackInsert(drag, deps, multi) {
|
|
|
9947
9882
|
dragKey,
|
|
9948
9883
|
drag.element.track,
|
|
9949
9884
|
drag.insertRow,
|
|
9950
|
-
multi ? multi.keys : null,
|
|
9951
9885
|
deps,
|
|
9952
9886
|
coalesceKey
|
|
9953
9887
|
)
|
|
@@ -9975,7 +9909,7 @@ function commitZMirrorLaneMove(element, move, deps, coalesceKey) {
|
|
|
9975
9909
|
deps
|
|
9976
9910
|
);
|
|
9977
9911
|
}
|
|
9978
|
-
function syncStackingForEdit(candidate, dragKey, currentLane, aimedLane,
|
|
9912
|
+
function syncStackingForEdit(candidate, dragKey, currentLane, aimedLane, deps, coalesceKey) {
|
|
9979
9913
|
const { readZIndex, onStackingPatches } = deps;
|
|
9980
9914
|
if (!readZIndex || !onStackingPatches) return Promise.resolve();
|
|
9981
9915
|
if (aimedLane === currentLane) return Promise.resolve();
|
|
@@ -9990,11 +9924,11 @@ function syncStackingForEdit(candidate, dragKey, currentLane, aimedLane, multiKe
|
|
|
9990
9924
|
domIndex,
|
|
9991
9925
|
stackingContextId: el.stackingContextId ?? null
|
|
9992
9926
|
}));
|
|
9993
|
-
const
|
|
9994
|
-
|
|
9995
|
-
|
|
9996
|
-
|
|
9997
|
-
|
|
9927
|
+
const patches = computeStackingPatches(
|
|
9928
|
+
stackingEls,
|
|
9929
|
+
[dragKey],
|
|
9930
|
+
aimedLane < currentLane ? "up" : "down"
|
|
9931
|
+
);
|
|
9998
9932
|
if (patches.length === 0) return Promise.resolve();
|
|
9999
9933
|
return Promise.resolve(onStackingPatches(patches, coalesceKey)).then(() => void 0);
|
|
10000
9934
|
}
|