@cueframe/kernel 0.2.49 → 0.2.51
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/_members/composition/validators/composition.d.ts +49 -0
- package/dist/_members/composition/validators/render.d.ts +24 -0
- package/dist/_members/composition-ops/index.d.ts +12 -0
- package/dist/_members/primitives/captions/placement.d.ts +6 -1
- package/dist/authoring/build-tools.js +5 -5
- package/dist/authoring/context.js +4 -4
- package/dist/authoring/tools.js +4 -4
- package/dist/authoring.js +12 -12
- package/dist/{chunk-AOIY7NGF.js → chunk-2LUAUF46.js} +56 -0
- package/dist/{chunk-4QMRY7KU.js → chunk-4CNJGY7P.js} +46 -9
- package/dist/{chunk-CFIQY4OE.js → chunk-4WBSXHQA.js} +8 -4
- package/dist/{chunk-XSBVOXSB.js → chunk-FSA3UBVR.js} +1 -1
- package/dist/{chunk-4FKNPTLX.js → chunk-IHWC75AN.js} +1 -1
- package/dist/{chunk-BBNF4QLD.js → chunk-KY3QBG7O.js} +4 -4
- package/dist/{chunk-AG7HKF2U.js → chunk-LO3DH776.js} +1 -1
- package/dist/{chunk-ID5QY7V6.js → chunk-LZEX2GAY.js} +8 -0
- package/dist/{chunk-DJRKEUK3.js → chunk-M665ZQYB.js} +3 -3
- package/dist/{chunk-FYS2XUKJ.js → chunk-MOUWO53S.js} +1 -1
- package/dist/{chunk-VEQTURKN.js → chunk-NLXQ7WTH.js} +1 -1
- package/dist/{chunk-SLUTOUWI.js → chunk-OVV35ZS2.js} +1 -1
- package/dist/{chunk-E3FYYVCG.js → chunk-YKXOAGY3.js} +9 -9
- package/dist/compose.js +3 -3
- package/dist/composition/graphics-plan.js +7 -7
- package/dist/composition/ops.js +3 -3
- package/dist/composition/projection.js +1 -1
- package/dist/composition/validators.js +4 -2
- package/dist/composition-ops.js +10 -6
- package/dist/composition.js +80 -78
- package/dist/{context-YNR73FNI.js → context-AIUJG7R4.js} +4 -4
- package/dist/core/render.js +6 -2
- package/dist/core.js +6 -2
- package/dist/mcp/adapter.js +3 -3
- package/dist/mcp/core.js +1 -1
- package/dist/mcp/curation.js +1 -1
- package/dist/mcp/scene-shot.js +2 -2
- package/dist/mcp/server.js +15 -11
- package/dist/mcp.js +15 -11
- package/dist/primitives/captions.js +34 -12
- package/dist/render-harness.js +6 -2
- package/package.json +10 -10
|
@@ -93,7 +93,20 @@ function assignTimeline(raw, lingerMs) {
|
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
// ../execution/primitives/src/captions/placement.ts
|
|
96
|
-
|
|
96
|
+
var percent = (fraction) => `${Number((fraction * 100).toFixed(4))}%`;
|
|
97
|
+
function resolveCaptionPlacement(position, region, authoredRegion) {
|
|
98
|
+
if (authoredRegion) {
|
|
99
|
+
return {
|
|
100
|
+
position: "absolute",
|
|
101
|
+
left: percent(authoredRegion.x),
|
|
102
|
+
top: percent(authoredRegion.y),
|
|
103
|
+
width: percent(authoredRegion.w),
|
|
104
|
+
height: percent(authoredRegion.h),
|
|
105
|
+
display: "flex",
|
|
106
|
+
justifyContent: "flex-start",
|
|
107
|
+
alignItems: "flex-start"
|
|
108
|
+
};
|
|
109
|
+
}
|
|
97
110
|
const vertical = position === "top" ? { top: "8%" } : position === "center" ? { top: "50%", transform: "translateY(-50%)" } : position === "bottom" ? { bottom: "10%" } : region ? { bottom: `${Math.max(0, (1 - (region.y + region.h)) * 100)}%` } : { bottom: "10%" };
|
|
98
111
|
return {
|
|
99
112
|
position: "absolute",
|
|
@@ -153,16 +166,16 @@ function addTokenToBox(box, token, fontFamily, fontSize, fontWeight, emphasis) {
|
|
|
153
166
|
fontWeight: String(tokenWeight)
|
|
154
167
|
});
|
|
155
168
|
}
|
|
156
|
-
function makeBoxFactory(maxWidth, fontFamily, fontSize, fontWeight, emphasis) {
|
|
169
|
+
function makeBoxFactory(maxWidth, maxLines, fontFamily, fontSize, fontWeight, emphasis) {
|
|
157
170
|
return () => {
|
|
158
|
-
const box = fillTextBox({ maxBoxWidth: maxWidth, maxLines
|
|
171
|
+
const box = fillTextBox({ maxBoxWidth: maxWidth, maxLines });
|
|
159
172
|
return {
|
|
160
173
|
add: (token) => !addTokenToBox(box, token, fontFamily, fontSize, fontWeight, emphasis).exceedsBox
|
|
161
174
|
};
|
|
162
175
|
};
|
|
163
176
|
}
|
|
164
|
-
function layoutTokensIntoLines(tokens, maxWidth, fontFamily, fontSize, fontWeight, emphasis) {
|
|
165
|
-
const box = fillTextBox({ maxBoxWidth: maxWidth, maxLines
|
|
177
|
+
function layoutTokensIntoLines(tokens, maxWidth, maxLines, fontFamily, fontSize, fontWeight, emphasis) {
|
|
178
|
+
const box = fillTextBox({ maxBoxWidth: maxWidth, maxLines });
|
|
166
179
|
const lines = [[]];
|
|
167
180
|
for (const token of tokens) {
|
|
168
181
|
const result = addTokenToBox(box, token, fontFamily, fontSize, fontWeight, emphasis);
|
|
@@ -211,7 +224,15 @@ function Captions({
|
|
|
211
224
|
const maxWidthPercent = style.maxWidthPercent ?? 80;
|
|
212
225
|
const plateStyle = plateStyleFor(style.plate ?? "glass", style.backgroundColor);
|
|
213
226
|
const fontSize = Math.round(height * (style.fontSize / 100));
|
|
214
|
-
const
|
|
227
|
+
const authoredRegion = userStyle?.region;
|
|
228
|
+
const regionWidth = authoredRegion ? width * authoredRegion.w : width;
|
|
229
|
+
const maxTextWidth = authoredRegion ? Math.min(width * (maxWidthPercent / 100), regionWidth - fontSize * 1.6) : width * (maxWidthPercent / 100);
|
|
230
|
+
const availableHeight = authoredRegion ? height * authoredRegion.h - fontSize * 0.8 : Infinity;
|
|
231
|
+
const lineHeight = fontSize * Math.max(1, emphasisScale) * 1.2;
|
|
232
|
+
const maxLines = authoredRegion ? Math.min(3, Math.floor((availableHeight + fontSize * 0.25) / (lineHeight + fontSize * 0.25))) : 3;
|
|
233
|
+
if (authoredRegion && (maxTextWidth <= 0 || maxLines < 1)) {
|
|
234
|
+
throw new Error("Caption style.region is too small for one caption line at the authored font size");
|
|
235
|
+
}
|
|
215
236
|
const { emphasisStartMs, annotateKind } = useMemo(() => {
|
|
216
237
|
const emph = /* @__PURE__ */ new Set();
|
|
217
238
|
const ann = /* @__PURE__ */ new Map();
|
|
@@ -228,10 +249,10 @@ function Captions({
|
|
|
228
249
|
const pages = useMemo(
|
|
229
250
|
() => paginateCaptionSegments(segments, {
|
|
230
251
|
combineMs: COMBINE_TOKENS_MS,
|
|
231
|
-
makeBox: makeBoxFactory(maxTextWidth, style.fontFamily, fontSize, style.fontWeight, emphasisLayout),
|
|
252
|
+
makeBox: makeBoxFactory(maxTextWidth, maxLines, style.fontFamily, fontSize, style.fontWeight, emphasisLayout),
|
|
232
253
|
lingerMs: CAPTION_LINGER_MS
|
|
233
254
|
}),
|
|
234
|
-
[segments, maxTextWidth, fontSize, style.fontFamily, style.fontWeight, emphasisLayout]
|
|
255
|
+
[segments, maxTextWidth, maxLines, fontSize, style.fontFamily, style.fontWeight, emphasisLayout]
|
|
235
256
|
);
|
|
236
257
|
if (pages.length === 0) return null;
|
|
237
258
|
const currentTimeMs = frame / fps * 1e3;
|
|
@@ -259,12 +280,13 @@ function Captions({
|
|
|
259
280
|
const lines = layoutTokensIntoLines(
|
|
260
281
|
currentPage.tokens,
|
|
261
282
|
maxTextWidth,
|
|
283
|
+
maxLines,
|
|
262
284
|
style.fontFamily,
|
|
263
285
|
fontSize,
|
|
264
286
|
style.fontWeight,
|
|
265
287
|
emphasisLayout
|
|
266
288
|
);
|
|
267
|
-
const wrapperStyle = resolveCaptionPlacement(userStyle?.position, region);
|
|
289
|
+
const wrapperStyle = resolveCaptionPlacement(userStyle?.position, region, authoredRegion);
|
|
268
290
|
return /* @__PURE__ */ React.createElement(AbsoluteFill, { style: { pointerEvents: "none" } }, /* @__PURE__ */ React.createElement("div", { style: wrapperStyle }, /* @__PURE__ */ React.createElement(
|
|
269
291
|
"div",
|
|
270
292
|
{
|
|
@@ -272,12 +294,12 @@ function Captions({
|
|
|
272
294
|
opacity: groupOpacity,
|
|
273
295
|
display: "flex",
|
|
274
296
|
flexDirection: "column",
|
|
275
|
-
alignItems: "center",
|
|
297
|
+
alignItems: authoredRegion ? "flex-start" : "center",
|
|
276
298
|
gap: `${fontSize * 0.25}px`,
|
|
277
299
|
padding: `${fontSize * 0.4}px ${fontSize * 0.8}px`,
|
|
278
300
|
borderRadius: fontSize * 0.5,
|
|
279
301
|
...plateStyle,
|
|
280
|
-
maxWidth: `${maxWidthPercent}%`,
|
|
302
|
+
maxWidth: authoredRegion ? "100%" : `${maxWidthPercent}%`,
|
|
281
303
|
boxSizing: "border-box"
|
|
282
304
|
}
|
|
283
305
|
},
|
|
@@ -317,7 +339,7 @@ function Captions({
|
|
|
317
339
|
if (emphasisPlate && e && last && last.emph) last.tokens.push(t);
|
|
318
340
|
else segs.push({ tokens: [t], emph: e });
|
|
319
341
|
}
|
|
320
|
-
return /* @__PURE__ */ React.createElement("div", { key: lineIdx, style: { display: "flex", justifyContent: "center", alignItems: "baseline", gap: `${fontSize * 0.35}px` } }, segs.map((seg, si) => {
|
|
342
|
+
return /* @__PURE__ */ React.createElement("div", { key: lineIdx, style: { display: "flex", justifyContent: authoredRegion ? "flex-start" : "center", alignItems: "baseline", gap: `${fontSize * 0.35}px` } }, segs.map((seg, si) => {
|
|
321
343
|
const first = seg.tokens[0];
|
|
322
344
|
const { opacity, scale, y } = entranceOf(first, seg.emph);
|
|
323
345
|
const entranceTransform = `translateY(${y}px) scale(${scale})`;
|
package/dist/render-harness.js
CHANGED
|
@@ -46,18 +46,22 @@ import {
|
|
|
46
46
|
parseSceneComponentCaptureIntentV1,
|
|
47
47
|
prepareSceneShotRenderInput,
|
|
48
48
|
readSceneShotManifest
|
|
49
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-4CNJGY7P.js";
|
|
50
50
|
import "./chunk-QH3YI3ND.js";
|
|
51
|
+
import "./chunk-JPMVNMF3.js";
|
|
51
52
|
import "./chunk-IMIUHG2E.js";
|
|
52
53
|
import "./chunk-VZ7TYX6Z.js";
|
|
53
|
-
import "./chunk-JPMVNMF3.js";
|
|
54
54
|
import "./chunk-T56BK7NS.js";
|
|
55
55
|
import "./chunk-KYRDKK2D.js";
|
|
56
|
+
import "./chunk-6WQHVYJD.js";
|
|
57
|
+
import "./chunk-Z6NY6MCL.js";
|
|
56
58
|
import "./chunk-WREYUH2E.js";
|
|
59
|
+
import "./chunk-ILO4NEZ3.js";
|
|
57
60
|
import {
|
|
58
61
|
CueframeError
|
|
59
62
|
} from "./chunk-E63UEO5C.js";
|
|
60
63
|
import "./chunk-7PA7FGLD.js";
|
|
64
|
+
import "./chunk-VG2ND6PX.js";
|
|
61
65
|
import {
|
|
62
66
|
evaluateScene,
|
|
63
67
|
parseSceneShotSpecV2,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cueframe/kernel",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.51",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Publish-only aggregate of CueFrame's isomorphic kernel packages — composition, primitives, authoring, MCP, and friends shipped as one npm artifact. Members remain separate workspace packages; this only changes what ships.",
|
|
6
6
|
"files": [
|
|
@@ -16,24 +16,24 @@
|
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"tsup": "^8.3.5",
|
|
18
18
|
"typescript": "^5.9.3",
|
|
19
|
-
"@cueframe/account-model": "0.1.0",
|
|
20
19
|
"@cueframe/animate": "0.1.0",
|
|
20
|
+
"@cueframe/cloud-import": "0.1.0",
|
|
21
21
|
"@cueframe/authoring": "0.1.0",
|
|
22
|
+
"@cueframe/component-runtime": "0.1.0",
|
|
22
23
|
"@cueframe/brand-derivation": "0.1.0",
|
|
23
|
-
"@cueframe/compose": "0.1.0",
|
|
24
|
-
"@cueframe/cloud-import": "0.1.0",
|
|
25
24
|
"@cueframe/composition": "0.1.0",
|
|
26
25
|
"@cueframe/composition-ops": "0.1.0",
|
|
27
|
-
"@cueframe/component-runtime": "0.1.0",
|
|
28
|
-
"@cueframe/core": "0.1.0",
|
|
29
|
-
"@cueframe/director": "0.1.0",
|
|
30
|
-
"@cueframe/errors": "0.1.0",
|
|
31
26
|
"@cueframe/foundation": "0.1.0",
|
|
32
|
-
"@cueframe/
|
|
27
|
+
"@cueframe/errors": "0.1.0",
|
|
33
28
|
"@cueframe/media-model": "0.1.0",
|
|
29
|
+
"@cueframe/compose": "0.1.0",
|
|
30
|
+
"@cueframe/core": "0.1.0",
|
|
31
|
+
"@cueframe/account-model": "0.1.0",
|
|
32
|
+
"@cueframe/director": "0.1.0",
|
|
33
|
+
"@cueframe/plane": "0.1.0",
|
|
34
34
|
"@cueframe/nle-export": "0.1.0",
|
|
35
|
+
"@cueframe/mcp": "0.1.0",
|
|
35
36
|
"@cueframe/perception": "0.1.0",
|
|
36
|
-
"@cueframe/plane": "0.1.0",
|
|
37
37
|
"@cueframe/primitives": "0.1.0",
|
|
38
38
|
"@cueframe/render-harness": "0.1.0"
|
|
39
39
|
},
|