@hyperframes/studio 0.8.130 → 0.8.131
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-Cm1Cj3TU.js → hyperframes-player-BpOOAOcm.js} +1 -1
- package/dist/assets/{index-DDsV6l9T.js → index-BEcHKkGY.js} +64 -64
- package/dist/assets/{index-DAp0QmWa.js → index-DASBNWML.js} +1 -1
- package/dist/assets/{index--Z5JgizA.js → index-DbSXe5_2.js} +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.html +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
- package/src/hooks/usePersistentEditHistory.test.ts +25 -1
- package/src/hooks/usePersistentEditHistory.ts +4 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as P}from"./index-
|
|
1
|
+
import{g as P}from"./index-BEcHKkGY.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.d.ts
CHANGED
|
@@ -2865,6 +2865,7 @@ declare function usePersistentEditHistory({ projectId }: UsePersistentEditHistor
|
|
|
2865
2865
|
}[];
|
|
2866
2866
|
};
|
|
2867
2867
|
recordEdit: ({ label, coalesceKey, coalesceMs, files, created }: RecordEditInput$5) => Promise<void>;
|
|
2868
|
+
claimKey: (key: string) => string;
|
|
2868
2869
|
undo: (callbacks: ApplyCallbacks) => Promise<ApplyResult>;
|
|
2869
2870
|
redo: (callbacks: ApplyCallbacks) => Promise<ApplyResult>;
|
|
2870
2871
|
predict: (direction: "undo" | "redo") => {
|
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-BEcHKkGY.js"></script>
|
|
18
18
|
<link rel="stylesheet" crossorigin href="/assets/index-D11atkBt.css">
|
|
19
19
|
</head>
|
|
20
20
|
<body>
|
package/dist/index.js
CHANGED
|
@@ -73774,6 +73774,7 @@ function usePersistentEditHistory({ projectId }) {
|
|
|
73774
73774
|
projectIdRef.current = projectId;
|
|
73775
73775
|
const [own] = useState111(createOwnHistory);
|
|
73776
73776
|
const [pageKeyScope] = useState111(generateId);
|
|
73777
|
+
const claimKey = useCallback100((key2) => `${pageKeyScope}:${key2}`, [pageKeyScope]);
|
|
73777
73778
|
const refresh2 = useCallback100(async () => {
|
|
73778
73779
|
if (!projectId) return;
|
|
73779
73780
|
const seen = own.changes();
|
|
@@ -73805,7 +73806,7 @@ function usePersistentEditHistory({ projectId }) {
|
|
|
73805
73806
|
paths,
|
|
73806
73807
|
overwrote: await overwroteVersions(files),
|
|
73807
73808
|
...coalesceKey && {
|
|
73808
|
-
coalesceKey:
|
|
73809
|
+
coalesceKey: claimKey(coalesceKey),
|
|
73809
73810
|
idleMs: coalesceMs ?? DEFAULT_COALESCE_MS
|
|
73810
73811
|
}
|
|
73811
73812
|
});
|
|
@@ -73817,7 +73818,7 @@ function usePersistentEditHistory({ projectId }) {
|
|
|
73817
73818
|
heldClaimRef.current = claimed && coalesceKey ? { paths, at: Date.now() } : null;
|
|
73818
73819
|
await refresh2();
|
|
73819
73820
|
},
|
|
73820
|
-
[projectId, refresh2, own,
|
|
73821
|
+
[projectId, refresh2, own, claimKey]
|
|
73821
73822
|
);
|
|
73822
73823
|
const step = useCallback100(
|
|
73823
73824
|
async (direction, callbacks) => {
|
|
@@ -73891,6 +73892,7 @@ function usePersistentEditHistory({ projectId }) {
|
|
|
73891
73892
|
redoPaths: view.forward?.paths ?? [],
|
|
73892
73893
|
state,
|
|
73893
73894
|
recordEdit,
|
|
73895
|
+
claimKey,
|
|
73894
73896
|
undo,
|
|
73895
73897
|
redo,
|
|
73896
73898
|
predict: own.predict,
|