Skip to content

Commit 35810cd

Browse files
committed
refactor(core): own edit protocol contract
1 parent 55b2233 commit 35810cd

12 files changed

Lines changed: 219 additions & 17 deletions

File tree

.fallowrc.jsonc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,12 @@
9090
"packages/cli/src/cloud/_gen/**",
9191
],
9292
"ignoreExports": [
93+
// Public player-state types are consumed by package users outside this
94+
// workspace. Keep the barrel stable even when no in-repo import needs it.
95+
{
96+
"file": "packages/studio/src/player/index.ts",
97+
"exports": ["ZoomMode"],
98+
},
9399
// drawElementService is the bottom of the fast-capture Graphite stack
94100
// (#1917): its consumers (frameCapture in #1919) land two PRs upstack, so
95101
// a per-PR audit diffing against the merge base sees these exports as

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,12 @@
2424
"changelog:weekly": "tsx scripts/changelog-weekly.ts",
2525
"sync-schemas": "tsx scripts/sync-schemas.ts",
2626
"sync-schemas:check": "tsx scripts/sync-schemas.ts --check",
27-
"lint": "bun run check:tracked-artifacts && bun run check:workspace-contracts && oxlint . && tsx scripts/lint-skills.ts",
27+
"lint": "bun run check:tracked-artifacts && bun run check:workspace-contracts && bun run check:package-cycles && oxlint . && tsx scripts/lint-skills.ts",
2828
"lint:skills": "tsx scripts/lint-skills.ts",
2929
"lint:fix": "oxlint --fix .",
3030
"check:tracked-artifacts": "node scripts/check-tracked-artifacts.mjs",
3131
"check:workspace-contracts": "node scripts/check-workspace-contracts.mjs",
32+
"check:package-cycles": "node scripts/check-package-cycles.mjs",
3233
"format": "oxfmt .",
3334
"test": "bun run test:unit",
3435
"test:unit": "bun run --filter '*' test",
@@ -41,7 +42,7 @@
4142
"player:perf": "bun run --filter @hyperframes/player perf",
4243
"format:check": "oxfmt --check .",
4344
"knip": "knip",
44-
"test:scripts": "node --import tsx --test scripts/check-tracked-artifacts.test.mjs scripts/check-workspace-contracts.test.mjs scripts/validate-release-channel.test.mjs scripts/draft-changelog.test.ts scripts/set-version.test.ts scripts/release-prepare.test.ts scripts/cli-options.test.ts scripts/changelog-weekly.test.ts scripts/claude-plugin-compression.test.ts scripts/studio-runtime-smoke.test.mjs scripts/verify-packed-manifests.test.mjs",
45+
"test:scripts": "node --import tsx --test scripts/check-tracked-artifacts.test.mjs scripts/check-workspace-contracts.test.mjs scripts/check-package-cycles.test.mjs scripts/validate-release-channel.test.mjs scripts/draft-changelog.test.ts scripts/set-version.test.ts scripts/release-prepare.test.ts scripts/cli-options.test.ts scripts/changelog-weekly.test.ts scripts/claude-plugin-compression.test.ts scripts/studio-runtime-smoke.test.mjs scripts/verify-packed-manifests.test.mjs",
4546
"test:skills": "node --test 'skills/**/*.test.mjs'",
4647
"generate:previews": "tsx scripts/generate-template-previews.ts",
4748
"generate:catalog-previews": "tsx scripts/generate-catalog-previews.ts",

packages/core/package.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@
5252
"import": "./src/editing/affordances.ts",
5353
"types": "./src/editing/affordances.ts"
5454
},
55+
"./editing/draft-markers": {
56+
"bun": "./src/editing/draftMarkers.ts",
57+
"node": "./dist/editing/draftMarkers.js",
58+
"import": "./src/editing/draftMarkers.ts",
59+
"types": "./src/editing/draftMarkers.ts"
60+
},
5561
"./variables": {
5662
"bun": "./src/variables.ts",
5763
"node": "./dist/variables.js",
@@ -278,6 +284,10 @@
278284
"import": "./dist/editing/affordances.js",
279285
"types": "./dist/editing/affordances.d.ts"
280286
},
287+
"./editing/draft-markers": {
288+
"import": "./dist/editing/draftMarkers.js",
289+
"types": "./dist/editing/draftMarkers.d.ts"
290+
},
281291
"./figma": {
282292
"import": "./dist/figma/index.js",
283293
"types": "./dist/figma/index.d.ts"
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/**
2+
* Browser-safe wire constants shared by the runtime, Studio, and studio-server.
3+
*
4+
* Keep this module dependency-free. These names are part of the edit protocol,
5+
* not server implementation details, so browser code must be able to import
6+
* them without pulling the studio-server package into its graph.
7+
*/
8+
export const STUDIO_OFFSET_X_PROP = "--hf-studio-offset-x";
9+
export const STUDIO_OFFSET_Y_PROP = "--hf-studio-offset-y";
10+
export const STUDIO_WIDTH_PROP = "--hf-studio-width";
11+
export const STUDIO_HEIGHT_PROP = "--hf-studio-height";
12+
export const STUDIO_MANUAL_EDIT_GESTURE_ATTR = "data-hf-studio-manual-edit-gesture";

packages/core/src/runtime/captionOverrides.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* 2. `wordIndex` — fallback, DOM traversal order across .caption-group > span
1111
*/
1212

13-
export interface CaptionOverride {
13+
interface CaptionOverride {
1414
wordId?: string;
1515
wordIndex?: number;
1616
x?: number;

packages/core/src/runtime/init.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ import { createColorGradingRuntime, type RuntimeColorGradingApi } from "./colorG
3535
import { TransportClock } from "./clock";
3636
import { WebAudioTransport } from "./webAudioTransport";
3737
import { quantizeTimeToFrame } from "../inline-scripts/parityContract";
38-
import { STUDIO_MANUAL_EDIT_GESTURE_ATTR } from "../studio-api/helpers/draftMarkers";
38+
import { STUDIO_MANUAL_EDIT_GESTURE_ATTR } from "../editing/draftMarkers";
3939
import type {
4040
RuntimeDeterministicAdapter,
4141
RuntimeJson,
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
/** @deprecated Import from @hyperframes/studio-server/draft-markers */
2-
export * from "@hyperframes/studio-server/draft-markers";
1+
/** @deprecated Import from @hyperframes/core/editing/draft-markers. */
2+
export * from "../../editing/draftMarkers.js";
Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
/**
2-
* Draft-marker constants shared between core's PreviewAdapter and Studio's
3-
* manual-edits code. CSS custom properties written during a drag gesture, plus
4-
* the gesture marker attribute. Exported from @hyperframes/core/studio-api/draft-markers.
2+
* Compatibility export for server consumers. The edit-protocol constants are
3+
* owned by core's dependency-free browser contract.
54
*/
6-
export const STUDIO_OFFSET_X_PROP = "--hf-studio-offset-x";
7-
export const STUDIO_OFFSET_Y_PROP = "--hf-studio-offset-y";
8-
export const STUDIO_WIDTH_PROP = "--hf-studio-width";
9-
export const STUDIO_HEIGHT_PROP = "--hf-studio-height";
10-
export const STUDIO_MANUAL_EDIT_GESTURE_ATTR = "data-hf-studio-manual-edit-gesture";
5+
export * from "@hyperframes/core/editing/draft-markers";

packages/studio/src/components/editor/manualEditsTypes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export {
55
STUDIO_WIDTH_PROP,
66
STUDIO_HEIGHT_PROP,
77
STUDIO_MANUAL_EDIT_GESTURE_ATTR,
8-
} from "@hyperframes/studio-server/draft-markers";
8+
} from "@hyperframes/core/editing/draft-markers";
99
export const STUDIO_ROTATION_PROP = "--hf-studio-rotation";
1010

1111
/* ── Internal DOM attribute names ─────────────────────────────────── */

packages/studio/src/player/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ export { resolveIframe } from "./lib/timelineDOM";
1111

1212
// Store
1313
export { usePlayerStore, liveTime } from "./store/playerStore";
14-
// Public library surface; external consumers are invisible to the workspace analyzer.
15-
// fallow-ignore-next-line unused-exports
1614
export type { TimelineElement, ZoomMode } from "./store/playerStore";
1715

1816
// Utils

0 commit comments

Comments
 (0)