hyperframes 0.6.97 → 0.6.99

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.
Files changed (77) hide show
  1. package/dist/beat-analyzer.global.js +326 -0
  2. package/dist/cli.js +12428 -4680
  3. package/dist/commands/layout-audit.browser.js +86 -0
  4. package/dist/hyperframe-runtime.js +22 -22
  5. package/dist/hyperframe.manifest.json +1 -1
  6. package/dist/hyperframe.runtime.iife.js +22 -22
  7. package/dist/skills/hyperframes-cli/SKILL.md +67 -103
  8. package/dist/skills/hyperframes-cli/references/doctor-browser.md +45 -0
  9. package/dist/skills/hyperframes-cli/references/init-and-scaffold.md +51 -0
  10. package/dist/skills/hyperframes-cli/references/lambda.md +132 -0
  11. package/dist/skills/hyperframes-cli/references/lint-validate-inspect.md +93 -0
  12. package/dist/skills/hyperframes-cli/references/preview-render.md +107 -0
  13. package/dist/skills/hyperframes-cli/references/upgrade-info-misc.md +75 -0
  14. package/dist/studio/assets/hyperframes-player-DgsMQSvV.js +418 -0
  15. package/dist/studio/assets/index-B62bDCQv.css +1 -0
  16. package/dist/studio/assets/{index-HveJ0MuV.js → index-C52IT_lp.js} +1 -1
  17. package/dist/studio/assets/index-DOh7E1uj.js +1 -0
  18. package/dist/studio/assets/index-DrwSRbsl.js +252 -0
  19. package/dist/studio/index.html +2 -2
  20. package/dist/templates/_shared/AGENTS.md +46 -21
  21. package/dist/templates/_shared/CLAUDE.md +16 -14
  22. package/package.json +3 -2
  23. package/dist/pngDecodeBlitWorker.js +0 -239
  24. package/dist/skills/gsap/SKILL.md +0 -240
  25. package/dist/skills/gsap/references/effects.md +0 -297
  26. package/dist/skills/gsap/scripts/extract-audio-data.py +0 -188
  27. package/dist/skills/hyperframes/SKILL.md +0 -491
  28. package/dist/skills/hyperframes/data-in-motion.md +0 -19
  29. package/dist/skills/hyperframes/house-style.md +0 -73
  30. package/dist/skills/hyperframes/palettes/bold-energetic.md +0 -14
  31. package/dist/skills/hyperframes/palettes/clean-corporate.md +0 -14
  32. package/dist/skills/hyperframes/palettes/dark-premium.md +0 -14
  33. package/dist/skills/hyperframes/palettes/jewel-rich.md +0 -14
  34. package/dist/skills/hyperframes/palettes/monochrome.md +0 -14
  35. package/dist/skills/hyperframes/palettes/nature-earth.md +0 -14
  36. package/dist/skills/hyperframes/palettes/neon-electric.md +0 -14
  37. package/dist/skills/hyperframes/palettes/pastel-soft.md +0 -14
  38. package/dist/skills/hyperframes/palettes/warm-editorial.md +0 -14
  39. package/dist/skills/hyperframes/patterns.md +0 -191
  40. package/dist/skills/hyperframes/references/audio-reactive.md +0 -76
  41. package/dist/skills/hyperframes/references/beat-direction.md +0 -171
  42. package/dist/skills/hyperframes/references/captions.md +0 -163
  43. package/dist/skills/hyperframes/references/css-patterns.md +0 -373
  44. package/dist/skills/hyperframes/references/design-picker.md +0 -117
  45. package/dist/skills/hyperframes/references/dynamic-techniques.md +0 -102
  46. package/dist/skills/hyperframes/references/html-in-canvas-patterns.md +0 -507
  47. package/dist/skills/hyperframes/references/motion-principles.md +0 -150
  48. package/dist/skills/hyperframes/references/narration.md +0 -92
  49. package/dist/skills/hyperframes/references/prompt-expansion.md +0 -68
  50. package/dist/skills/hyperframes/references/techniques.md +0 -525
  51. package/dist/skills/hyperframes/references/text-effects.md +0 -64
  52. package/dist/skills/hyperframes/references/transcript-guide.md +0 -107
  53. package/dist/skills/hyperframes/references/transitions/catalog.md +0 -117
  54. package/dist/skills/hyperframes/references/transitions/css-3d.md +0 -12
  55. package/dist/skills/hyperframes/references/transitions/css-blur.md +0 -51
  56. package/dist/skills/hyperframes/references/transitions/css-cover.md +0 -43
  57. package/dist/skills/hyperframes/references/transitions/css-destruction.md +0 -95
  58. package/dist/skills/hyperframes/references/transitions/css-dissolve.md +0 -66
  59. package/dist/skills/hyperframes/references/transitions/css-distortion.md +0 -45
  60. package/dist/skills/hyperframes/references/transitions/css-grid.md +0 -10
  61. package/dist/skills/hyperframes/references/transitions/css-light.md +0 -49
  62. package/dist/skills/hyperframes/references/transitions/css-mechanical.md +0 -30
  63. package/dist/skills/hyperframes/references/transitions/css-other.md +0 -25
  64. package/dist/skills/hyperframes/references/transitions/css-push.md +0 -41
  65. package/dist/skills/hyperframes/references/transitions/css-radial.md +0 -37
  66. package/dist/skills/hyperframes/references/transitions/css-scale.md +0 -24
  67. package/dist/skills/hyperframes/references/transitions.md +0 -138
  68. package/dist/skills/hyperframes/references/typography.md +0 -175
  69. package/dist/skills/hyperframes/references/video-composition.md +0 -62
  70. package/dist/skills/hyperframes/scripts/animation-map.mjs +0 -601
  71. package/dist/skills/hyperframes/scripts/contrast-report.mjs +0 -348
  72. package/dist/skills/hyperframes/scripts/package-loader.mjs +0 -269
  73. package/dist/skills/hyperframes/templates/design-picker.html +0 -1432
  74. package/dist/skills/hyperframes/visual-styles.md +0 -443
  75. package/dist/studio/assets/hyperframes-player-Daj5djxa.js +0 -418
  76. package/dist/studio/assets/index-B0twsRu0.css +0 -1
  77. package/dist/studio/assets/index-Cfye9xzo.js +0 -251
@@ -0,0 +1,326 @@
1
+ (() => {
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __commonJS = (cb, mod) => function __require() {
9
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+
28
+ // ../../node_modules/.bun/bpm-detective@2.0.5/node_modules/bpm-detective/lib/detect.js
29
+ var require_detect = __commonJS({
30
+ "../../node_modules/.bun/bpm-detective@2.0.5/node_modules/bpm-detective/lib/detect.js"(exports) {
31
+ "use strict";
32
+ Object.defineProperty(exports, "__esModule", {
33
+ value: true
34
+ });
35
+ exports.default = detect;
36
+ var OfflineContext = window.OfflineAudioContext || window.webkitOfflineAudioContext;
37
+ function detect(buffer) {
38
+ var source = getLowPassSource(buffer);
39
+ source.start(0);
40
+ return [findPeaks, identifyIntervals, groupByTempo(buffer.sampleRate), getTopCandidate].reduce(function(state, fn) {
41
+ return fn(state);
42
+ }, source.buffer.getChannelData(0));
43
+ }
44
+ function getTopCandidate(candidates) {
45
+ return candidates.sort(function(a, b) {
46
+ return b.count - a.count;
47
+ }).splice(0, 5)[0].tempo;
48
+ }
49
+ function getLowPassSource(buffer) {
50
+ var length = buffer.length, numberOfChannels = buffer.numberOfChannels, sampleRate = buffer.sampleRate;
51
+ var context = new OfflineContext(numberOfChannels, length, sampleRate);
52
+ var source = context.createBufferSource();
53
+ source.buffer = buffer;
54
+ var filter = context.createBiquadFilter();
55
+ filter.type = "lowpass";
56
+ source.connect(filter);
57
+ filter.connect(context.destination);
58
+ return source;
59
+ }
60
+ function findPeaks(data) {
61
+ var peaks = [];
62
+ var threshold = 0.9;
63
+ var minThresold = 0.3;
64
+ var minPeaks = 15;
65
+ while (peaks.length < minPeaks && threshold >= minThresold) {
66
+ peaks = findPeaksAtThreshold(data, threshold);
67
+ threshold -= 0.05;
68
+ }
69
+ if (peaks.length < minPeaks) {
70
+ throw new Error("Could not find enough samples for a reliable detection.");
71
+ }
72
+ return peaks;
73
+ }
74
+ function findPeaksAtThreshold(data, threshold) {
75
+ var peaks = [];
76
+ for (var i = 0, l = data.length; i < l; i += 1) {
77
+ if (data[i] > threshold) {
78
+ peaks.push(i);
79
+ i += 1e4;
80
+ }
81
+ }
82
+ return peaks;
83
+ }
84
+ function identifyIntervals(peaks) {
85
+ var intervals = [];
86
+ peaks.forEach(function(peak, index) {
87
+ var _loop = function _loop2(i2) {
88
+ var interval = peaks[index + i2] - peak;
89
+ var foundInterval = intervals.some(function(intervalCount) {
90
+ if (intervalCount.interval === interval) {
91
+ return intervalCount.count += 1;
92
+ }
93
+ });
94
+ if (!foundInterval) {
95
+ intervals.push({
96
+ interval,
97
+ count: 1
98
+ });
99
+ }
100
+ };
101
+ for (var i = 0; i < 10; i += 1) {
102
+ _loop(i);
103
+ }
104
+ });
105
+ return intervals;
106
+ }
107
+ function groupByTempo(sampleRate) {
108
+ return function(intervalCounts) {
109
+ var tempoCounts = [];
110
+ intervalCounts.forEach(function(intervalCount) {
111
+ if (intervalCount.interval !== 0) {
112
+ var theoreticalTempo = 60 / (intervalCount.interval / sampleRate);
113
+ while (theoreticalTempo < 90) {
114
+ theoreticalTempo *= 2;
115
+ }
116
+ while (theoreticalTempo > 180) {
117
+ theoreticalTempo /= 2;
118
+ }
119
+ theoreticalTempo = Math.round(theoreticalTempo);
120
+ var foundTempo = tempoCounts.some(function(tempoCount) {
121
+ if (tempoCount.tempo === theoreticalTempo) {
122
+ return tempoCount.count += intervalCount.count;
123
+ }
124
+ });
125
+ if (!foundTempo) {
126
+ tempoCounts.push({
127
+ tempo: theoreticalTempo,
128
+ count: intervalCount.count
129
+ });
130
+ }
131
+ }
132
+ });
133
+ return tempoCounts;
134
+ };
135
+ }
136
+ }
137
+ });
138
+
139
+ // ../../node_modules/.bun/bpm-detective@2.0.5/node_modules/bpm-detective/lib/index.js
140
+ var require_lib = __commonJS({
141
+ "../../node_modules/.bun/bpm-detective@2.0.5/node_modules/bpm-detective/lib/index.js"(exports, module) {
142
+ module.exports = require_detect().default;
143
+ }
144
+ });
145
+
146
+ // ../core/src/beats/beatDetection.ts
147
+ var bpmDetectivePromise = null;
148
+ function loadBpmDetective() {
149
+ if (!bpmDetectivePromise) {
150
+ bpmDetectivePromise = Promise.resolve().then(() => __toESM(require_lib(), 1)).then((m) => (m.default ?? m) || null).catch(() => null);
151
+ }
152
+ return bpmDetectivePromise;
153
+ }
154
+ var WINDOW_SIZE = 1024;
155
+ var HOP_SIZE = 512;
156
+ var STRENGTH_WINDOW_S = 0.05;
157
+ function computeRmsAt(channelData, sampleRate, time) {
158
+ const halfWindow = Math.floor(sampleRate * STRENGTH_WINDOW_S);
159
+ const center = Math.floor(time * sampleRate);
160
+ const start = Math.max(0, center - halfWindow);
161
+ const end = Math.min(channelData.length, center + halfWindow);
162
+ let sum = 0;
163
+ for (let i = start; i < end; i++) {
164
+ const s = channelData[i] ?? 0;
165
+ sum += s * s;
166
+ }
167
+ return Math.sqrt(sum / Math.max(end - start, 1));
168
+ }
169
+ async function detectBeats(audioBuffer) {
170
+ const channelData = audioBuffer.getChannelData(0);
171
+ const sampleRate = audioBuffer.sampleRate;
172
+ const energies = [];
173
+ for (let i = 0; i < channelData.length - WINDOW_SIZE; i += HOP_SIZE) {
174
+ let sum = 0;
175
+ for (let j = 0; j < WINDOW_SIZE; j++) {
176
+ const sample = channelData[i + j];
177
+ sum += sample * sample;
178
+ }
179
+ energies.push(sum / WINDOW_SIZE);
180
+ }
181
+ const beats = [];
182
+ const localWindowSize = 20;
183
+ for (let i = localWindowSize; i < energies.length - localWindowSize; i++) {
184
+ let localMean = 0;
185
+ for (let j = i - localWindowSize; j < i + localWindowSize; j++) {
186
+ localMean += energies[j];
187
+ }
188
+ localMean /= localWindowSize * 2;
189
+ const threshold = localMean * 1.5;
190
+ const current = energies[i];
191
+ if (current > threshold && current > (energies[i - 1] ?? 0) && current > (energies[i + 1] ?? 0)) {
192
+ const timeInSeconds = i * HOP_SIZE / sampleRate;
193
+ if (beats.length === 0 || timeInSeconds - beats[beats.length - 1] > 0.1) {
194
+ beats.push(Math.round(timeInSeconds * 1e3) / 1e3);
195
+ }
196
+ }
197
+ }
198
+ return beats;
199
+ }
200
+ function computeBpmFromBeats(beatTimes) {
201
+ if (beatTimes.length < 4) return null;
202
+ const iois = [];
203
+ for (let i = 1; i < beatTimes.length; i++) {
204
+ iois.push(beatTimes[i] - beatTimes[i - 1]);
205
+ }
206
+ const sorted = [...iois].sort((a, b) => a - b);
207
+ const mid = Math.floor(sorted.length / 2);
208
+ const medianIoi = sorted.length % 2 === 0 ? (sorted[mid - 1] + sorted[mid]) / 2 : sorted[mid];
209
+ if (medianIoi <= 0) return null;
210
+ return Math.round(60 / medianIoi * 10) / 10;
211
+ }
212
+ function canonicalizeBpm(bpm) {
213
+ let b = bpm;
214
+ while (b > 120) b /= 2;
215
+ while (b < 60) b *= 2;
216
+ return b;
217
+ }
218
+ function octaveAlignBpm(bpm, reference) {
219
+ const candidates = [bpm / 2, bpm, bpm * 2];
220
+ let best = bpm;
221
+ let bestDist = Number.POSITIVE_INFINITY;
222
+ for (const c of candidates) {
223
+ if (c <= 0) continue;
224
+ const dist = Math.abs(c - reference);
225
+ if (dist < bestDist) {
226
+ bestDist = dist;
227
+ best = c;
228
+ }
229
+ }
230
+ return best;
231
+ }
232
+ function regularizeBeats(rawBeats, bpm, duration) {
233
+ if (rawBeats.length === 0 || bpm <= 0 || duration <= 0) return rawBeats;
234
+ const beatInterval = 60 / bpm;
235
+ if (beatInterval < 0.125) return rawBeats;
236
+ const threshold = beatInterval * 0.25;
237
+ let bestOffset = 0;
238
+ let bestScore = -1;
239
+ for (const anchor of rawBeats.slice(0, 10)) {
240
+ const offset = (anchor % beatInterval + beatInterval) % beatInterval;
241
+ let score = 0;
242
+ for (const rb of rawBeats) {
243
+ const phase = (rb % beatInterval + beatInterval) % beatInterval;
244
+ const dist = Math.min(Math.abs(phase - offset), beatInterval - Math.abs(phase - offset));
245
+ if (dist < threshold) score++;
246
+ }
247
+ if (score > bestScore) {
248
+ bestScore = score;
249
+ bestOffset = offset;
250
+ }
251
+ }
252
+ const beats = [];
253
+ for (let t = bestOffset; t <= duration + 1e-3; t += beatInterval) {
254
+ beats.push(Math.round(t * 1e3) / 1e3);
255
+ }
256
+ return beats;
257
+ }
258
+ function gateBeatsBySilence(beats, channelData, sampleRate) {
259
+ if (beats.length === 0) return { times: beats, strengths: [], peak: 1e-6 };
260
+ const energies = beats.map((t) => computeRmsAt(channelData, sampleRate, t));
261
+ const peak = Math.max(...energies, 1e-6);
262
+ const threshold = peak * 0.12;
263
+ const times = [];
264
+ const strengths = [];
265
+ for (let i = 0; i < beats.length; i++) {
266
+ if (energies[i] >= threshold) {
267
+ times.push(beats[i]);
268
+ strengths.push(Math.min(1, energies[i] / peak));
269
+ }
270
+ }
271
+ return { times, strengths, peak };
272
+ }
273
+ async function analyzeMusicFromBuffer(audioBuffer) {
274
+ const channelData = audioBuffer.getChannelData(0);
275
+ const sampleRate = audioBuffer.sampleRate;
276
+ const duration = audioBuffer.duration;
277
+ const rawBeats = await detectBeats(audioBuffer);
278
+ const onsetBpm = computeBpmFromBeats(rawBeats);
279
+ let detectiveBpm = null;
280
+ try {
281
+ const detect = await loadBpmDetective();
282
+ if (detect) detectiveBpm = detect(audioBuffer);
283
+ } catch {
284
+ }
285
+ let bpm = onsetBpm;
286
+ let confidence = "uncertain";
287
+ let regularizeBpm = null;
288
+ if (onsetBpm !== null && detectiveBpm !== null) {
289
+ const pctDiff = Math.abs(canonicalizeBpm(onsetBpm) - canonicalizeBpm(detectiveBpm)) / canonicalizeBpm(detectiveBpm);
290
+ if (pctDiff < 0.05) {
291
+ bpm = octaveAlignBpm(detectiveBpm, onsetBpm);
292
+ confidence = "high";
293
+ regularizeBpm = bpm;
294
+ } else if (pctDiff < 0.1) {
295
+ bpm = Math.round((onsetBpm + detectiveBpm) / 2);
296
+ confidence = "low";
297
+ regularizeBpm = bpm;
298
+ } else {
299
+ bpm = onsetBpm;
300
+ confidence = "uncertain";
301
+ }
302
+ } else if (onsetBpm !== null) {
303
+ bpm = onsetBpm;
304
+ confidence = "low";
305
+ regularizeBpm = onsetBpm;
306
+ } else if (detectiveBpm !== null) {
307
+ bpm = detectiveBpm;
308
+ confidence = "low";
309
+ regularizeBpm = detectiveBpm;
310
+ }
311
+ const gridBeats = regularizeBpm !== null ? regularizeBeats(rawBeats, regularizeBpm, duration) : rawBeats;
312
+ const gated = gateBeatsBySilence(gridBeats, channelData, sampleRate);
313
+ return {
314
+ beatTimes: gated.times,
315
+ beatStrengths: gated.strengths,
316
+ bpm,
317
+ bpmConfidence: confidence,
318
+ channelData,
319
+ sampleRate,
320
+ peak: gated.peak
321
+ };
322
+ }
323
+
324
+ // <stdin>
325
+ globalThis.__hfAnalyze = analyzeMusicFromBuffer;
326
+ })();