@neta-art/cohub 8.11.0 → 8.12.0
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/board/animation.js +14 -2
- package/dist/board/core/file-preview.d.ts +2 -2
- package/dist/board/core/file-preview.js +2 -2
- package/dist/board/index.d.ts +2 -1
- package/dist/board/index.js +2 -1
- package/dist/board/mutation.js +2 -1
- package/dist/board/render/board-background.d.ts +16 -0
- package/dist/board/render/{themes/clean-theme.js → board-background.js} +28 -35
- package/dist/board/render/index.d.ts +3 -3
- package/dist/board/render/index.js +2 -2
- package/dist/board/render/renderers/file-card-renderer.js +3 -32
- package/dist/board/replay.d.ts +52 -0
- package/dist/board/replay.js +261 -0
- package/dist/board/semantic-document.d.ts +9 -2
- package/dist/board/semantic-document.js +1 -3
- package/dist/chunks/environment.d.ts +272 -7
- package/dist/chunks/environment.js +1 -0
- package/dist/chunks/http.d.ts +76 -5
- package/dist/chunks/http.js +47 -10
- package/dist/chunks/websocket.d.ts +1 -1
- package/dist/http.d.ts +3 -3
- package/dist/index.d.ts +9 -4
- package/dist/index.js +167 -46
- package/dist/protocol/dist/board-animation.d.ts +1 -0
- package/dist/protocol/dist/board-animation.js +34 -0
- package/dist/protocol/dist/board-authoring.d.ts +2 -1
- package/dist/protocol/dist/board-capability-registry.js +53 -3
- package/dist/protocol/dist/board-codec.js +149 -2
- package/dist/protocol/dist/board-constants.js +29 -7
- package/dist/protocol/dist/board-document.d.ts +30 -16
- package/dist/protocol/dist/board-document.js +15 -12
- package/dist/protocol/dist/board-effect.d.ts +4 -2
- package/dist/protocol/dist/board-effect.js +3 -2
- package/dist/protocol/dist/board.d.ts +148 -3
- package/dist/protocol/dist/board.js +7 -0
- package/dist/protocol/dist/index.d.ts +4 -2
- package/dist/protocol/dist/provenance.d.ts +21 -0
- package/dist/types.d.ts +1 -1
- package/docs/app-runtime-guide.md +7 -4
- package/package.json +1 -1
- package/dist/board/render/themes/board-theme-registry.d.ts +0 -22
- package/dist/board/render/themes/board-theme-registry.js +0 -13
- package/dist/board/render/themes/clean-theme.d.ts +0 -5
package/dist/board/animation.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BOARD_BUILTIN_CAPABILITIES, DEFAULT_BOARD_RENDER_LIMITS } from "../protocol/dist/board-constants.js";
|
|
2
2
|
import { BOARD_ANIMATION_CHANNELS, BoardCompositionSchema, BoardProceduralClipSchema, BoardTrackSchema } from "../protocol/dist/board-composition.js";
|
|
3
|
-
import { estimateBuiltinBoardClipCost, validateBuiltinBoardClip } from "../protocol/dist/board-capability-registry.js";
|
|
3
|
+
import { estimateBuiltinBoardClipCost, estimateBuiltinBoardEffectCost, validateBuiltinBoardClip, validateBuiltinBoardEffect } from "../protocol/dist/board-capability-registry.js";
|
|
4
4
|
//#region src/board/animation.ts
|
|
5
5
|
function track(input) {
|
|
6
6
|
return BoardTrackSchema.parse(input);
|
|
@@ -180,6 +180,15 @@ var BoardExtensionRegistry = class {
|
|
|
180
180
|
const diagnostics = [];
|
|
181
181
|
const composition = parsed.data;
|
|
182
182
|
const cost = { ...ZERO_COST };
|
|
183
|
+
for (const effect of input.effects ?? []) {
|
|
184
|
+
diagnostics.push(...validateBuiltinBoardEffect(effect, `effects.${effect.id}`));
|
|
185
|
+
if (!this.#extensions.has(`effect:${effect.kind}@${effect.kindVersion}`)) diagnostics.push({
|
|
186
|
+
severity: "warning",
|
|
187
|
+
code: "UNKNOWN_EFFECT",
|
|
188
|
+
message: `No renderer is registered for ${effect.kind}@${effect.kindVersion}`,
|
|
189
|
+
path: `effects.${effect.id}`
|
|
190
|
+
});
|
|
191
|
+
}
|
|
183
192
|
const events = [];
|
|
184
193
|
for (const clip of composition.timeline.clips) {
|
|
185
194
|
const definition = this.#extensions.get(`clip:${clip.kind}@${clip.kindVersion}`);
|
|
@@ -213,7 +222,10 @@ var BoardExtensionRegistry = class {
|
|
|
213
222
|
active[key] += event.cost[key] * event.direction;
|
|
214
223
|
cost[key] = Math.max(cost[key], active[key]);
|
|
215
224
|
}
|
|
216
|
-
for (const effect of input.effects ?? [])
|
|
225
|
+
for (const effect of input.effects ?? []) {
|
|
226
|
+
const estimate = estimateBuiltinBoardEffectCost(effect);
|
|
227
|
+
for (const key of Object.keys(cost)) cost[key] += estimate[key] ?? 0;
|
|
228
|
+
}
|
|
217
229
|
const limits = input.limits ?? DEFAULT_BOARD_LIMITS;
|
|
218
230
|
for (const key of Object.keys(cost)) if (cost[key] > limits[key]) diagnostics.push({
|
|
219
231
|
severity: "warning",
|
|
@@ -7,9 +7,9 @@ type FilePreviewKind = "cover" | "text" | "blank";
|
|
|
7
7
|
* sync with them.
|
|
8
8
|
*/
|
|
9
9
|
declare function filePreviewKind(snapshot: BoardFileSnapshotFacts | undefined): FilePreviewKind;
|
|
10
|
-
/** Short uppercase type label for
|
|
10
|
+
/** Short uppercase type label for a file card (`MD`, `JSON`, `FILE`). */
|
|
11
11
|
declare function fileTypeLabel(path: string): string;
|
|
12
|
-
/** Human-readable byte size for
|
|
12
|
+
/** Human-readable byte size. Kept as a public helper for custom card renderers. */
|
|
13
13
|
declare function formatFileSize(bytes: number | undefined): string;
|
|
14
14
|
/** `MD · 12 KB` — empty when neither fact is available. */
|
|
15
15
|
declare function fileMetaLine(path: string, size: number | undefined): string;
|
|
@@ -11,14 +11,14 @@ function filePreviewKind(snapshot) {
|
|
|
11
11
|
if (snapshot.excerpt) return "text";
|
|
12
12
|
return "blank";
|
|
13
13
|
}
|
|
14
|
-
/** Short uppercase type label for
|
|
14
|
+
/** Short uppercase type label for a file card (`MD`, `JSON`, `FILE`). */
|
|
15
15
|
function fileTypeLabel(path) {
|
|
16
16
|
const name = path.split("/").filter(Boolean).pop() ?? path;
|
|
17
17
|
const dot = name.lastIndexOf(".");
|
|
18
18
|
if (dot <= 0) return (name.replace(/^\./, "") || "file").toUpperCase();
|
|
19
19
|
return name.slice(dot + 1).toUpperCase();
|
|
20
20
|
}
|
|
21
|
-
/** Human-readable byte size for
|
|
21
|
+
/** Human-readable byte size. Kept as a public helper for custom card renderers. */
|
|
22
22
|
function formatFileSize(bytes) {
|
|
23
23
|
if (bytes === void 0 || !Number.isFinite(bytes) || bytes < 0) return "";
|
|
24
24
|
if (bytes < 1024) return `${bytes} B`;
|
package/dist/board/index.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ import { DEFAULT_BOARD_APPEARANCE, applyBoardAuthoringSnapshot, boardAuthoringIt
|
|
|
26
26
|
import { BoardMediaKind, getMediaExtension, getMediaResourceTitle, inferBoardMediaKind } from "./media.js";
|
|
27
27
|
import { BoardAssetSource, BoardPlayableMedia, playableBoardMedia, playableBoardMediaList, resetBoardPlaybackUrlCache } from "./media-playback.js";
|
|
28
28
|
import { patchBoardAppearance } from "./mutation.js";
|
|
29
|
+
import { BoardReplayActorKind, BoardReplayEntry, BoardReplayPlayer, boardReplayActorKind, createBoardReplayPlayer } from "./replay.js";
|
|
29
30
|
import { applyBoardSemanticCommands, boardDocumentToSemanticCommands } from "./semantic-mutation.js";
|
|
30
31
|
import { featuredTaskArtifact, rankedTaskArtifacts, taskArtifactPreviewUrl, taskArtifacts, taskRunToBoardTaskSnapshot } from "./task.js";
|
|
31
|
-
export { AUTO_BOARD_CONNECTION_ANCHOR, type ArrowShapeProps, type AudioShapeProps, BOARD_CHANNELS, BOARD_COLORS, BOARD_CONNECTION_DIRECTIONS, BOARD_CONNECTION_LINES, BOARD_CONNECTION_ROUTINGS, BOARD_CONNECTION_SIDES, BOARD_DOCUMENT_KIND, BOARD_EXPORT_DEFAULT_PADDING, BOARD_EXPORT_DEFAULT_SCALE, BOARD_EXPORT_ITEM_WARN_THRESHOLD, BOARD_EXPORT_MAX_EDGE, BOARD_EXPORT_MAX_PIXELS, BOARD_EXPORT_MAX_TEXTURES, BOARD_EXTENSION, BOARD_REMOTE_URL_MAX_LENGTH, BOARD_STROKE_MAX_SIZE, BOARD_STROKE_MIN_SIZE, BOARD_TASK_ARTIFACT_LIMIT, BoardAppearance, BoardAppearanceSchema, BoardArrowItem, BoardArrowItemSchema, BoardAssetSource, BoardAudioItem, BoardAudioItemSchema, type BoardCameraFocus, type BoardCameraFocusParams, BoardCameraFocusParamsSchema, BoardCameraFocusSchema, type BoardCameraState, BoardCameraStateSchema, BoardColorEntry, type BoardColorId, BoardColorValue, BoardConnection, BoardConnectionAnchor, BoardConnectionAnchorSchema, BoardConnectionDirection, BoardConnectionEndpoint, BoardConnectionEndpointSchema, BoardConnectionInput, BoardConnectionLine, BoardConnectionPatch, BoardConnectionPatchSchema, BoardConnectionRecord, BoardConnectionRouting, BoardConnectionRoutingConfig, BoardConnectionRoutingSchema, BoardConnectionSchema, BoardConnectionSide, BoardConnectionStyle, BoardConnectionStyleSchema, BoardConnectionWaypointSchema, BoardDocument, BoardDocumentSchema, BoardDrawItem, BoardDrawItemSchema, BoardExportAssetSelection, BoardExportPlan, BoardExportPlanInput, BoardExportRegion, BoardExtensionDefinition, BoardExtensionRegistry, BoardFileItem, BoardFileItemSchema, BoardFileSnapshot, type BoardFileSnapshotFacts, BoardFileSnapshotSchema, BoardFrame, BoardFrameItem, BoardFrameItemSchema, BoardFrameSchema, BoardGeoItem, BoardGeoItemSchema, BoardImageItem, BoardImageItemSchema, BoardItem, BoardItemSchema, BoardItemStyle, BoardItemStyleSchema, BoardKnownItem, BoardMediaKind, BoardMediaSnapshot, BoardMediaSnapshotSchema, BoardNormalizedPoint, BoardPlayableMedia, BoardPoint, BoardPointSchema, BoardPresetDefinition, BoardRelationSchema, BoardRemoteUrlSchema, BoardScreenOffset, BoardScreenPoint, BoardShapeColors, BoardStyledToolId, BoardTaskArtifact, BoardTaskArtifactSchema, BoardTaskItem, BoardTaskItemSchema, BoardTaskSnapshot, BoardTaskSnapshotSchema, BoardTextItem, BoardTextItemSchema, BoardToolStyleMap, BoardToolStylePatch, type BoardTrackInterpolation, BoardUnknownItem, BoardVideoItem, BoardVideoItemSchema, BoardViewport, BoardViewportSchema, BoardWorldOffset, BoardWorldPoint, BoardWorldRect, type BuildSnapshotInput, CONNECTION_ENDPOINT_GAP, CORNER_RESIZE_HANDLES, CORNER_ROTATION_ZONE_WIDTH, CompositionInput, ConnectionIndex, CornerResizeHandle, DEFAULT_BOARD_APPEARANCE, DEFAULT_BOARD_COLOR, DEFAULT_BOARD_CONNECTION_ROUTING, DEFAULT_BOARD_CONNECTION_STYLE, DEFAULT_BOARD_LIMITS, DEFAULT_BOARD_RELATION, DEFAULT_BOARD_TOOL_STYLES, DrawPoint, DrawPointSchema, type DrawShapeProps, EDGE_RESIZE_HANDLES, FILE_EXCERPT_MAX_BYTES, FILE_EXCERPT_MAX_CHARS, FIT_PADDING, FULL_CAPABILITIES, FileAvailability, type FileCategory, FilePreviewKind, FrameLookup, GEO_KINDS, type GeoKind, type GeoShapeProps, HANDLE_DIRECTION, HANDLE_HIT_RADIUS, type HandleDragResult, type ImageShapeProps, KNOWN_BOARD_ITEM_TYPES, KnownBoardItemType, MAX_BOARD_ZOOM, MIN_BOARD_ZOOM, MIN_ITEM_SIZE, Point, ProceduralClipInput, QualityProfile, RESIZE_HANDLES, ROTATION_HANDLE_OFFSET, Rect, RenderBounds, ResizeHandle, ResolvedArrow, ResolvedConnection, ResolvedConnectionEndpoint, type ResolvedCover, SampledTrack, ScreenPoint, type ShapeCapabilities, ShapeDefinition, type ShapeGeometry, type ShapeHandle, type ShapeHandleId, type ShapeResizeMode, Size, SpaceFileRef, SpaceFileRefSchema, StrokeRibbonGeometry, TEXT_FONT_FAMILY, TEXT_FONT_SIZE, TEXT_LINE_HEIGHT, TEXT_MAX_FONT_SIZE, TEXT_MIN_FONT_SIZE, type TextShapeProps, TrackInput, UNKNOWN_BOARD_ITEM_TYPE, VIEWPORT_MARGIN_RATIO, type VideoShapeProps, WorldPoint, anchorPointOnFrame, anchorToWorld, angleFromCenter, applyBoardAuthoringSnapshot, applyBoardSemanticCommands, arrowBounds, arrowFrame, autoConnectionSide, availabilityFromError, boardAuthoringItemToDocumentItem, boardAuthoringSnapshotToDocument, boardColorCssVar, boardDocumentToSemanticCommands, boardFrameLookup, boardImageKeySource, boardItemToAuthoringItem, boardTextLineHeight, buildCodeExcerpt, buildFallbackShapeColors, buildFileExcerpt, buildFileSnapshot, buildStrokeOutline, buildStrokeRibbonGeometry, cameraForFocus, cameraForRect, cameraForState, clamp, clampBoardStrokeSize, clampBoardTextFontSize, clampZoom, compileComposition, composition, boardArrowFrame as computeArrowFrame, computeDrawBounds, connectionArrowheads, connectionBounds, connectionHitTest, connectionItemIds, connectionOtherItemId, connectionTouchesItem, createBoardConnection, createBoardExtensionRegistry, createBoardToolStyles, createConnectionIndex, definitionForItem, degToRad, distanceToArrow, distanceToConnection, distanceToStroke, expandRect, exportConnectionBounds, exportItemBounds, featuredTaskArtifact, fileBaseName, fileCategory, fileCategoryAccent, fileMetaLine, filePreviewKind, filePreviewMemoKey, filePreviewScope, fileStem, fileTypeLabel, fitToContent, flipBoardConnection, formatFileSize, frameContainsPoint, frameCornerRotationHandleAt, frameCorners, frameEdgeHandleAt, frameHandlePosition, frameRayIntersection, frameRect, getMediaExtension, getMediaResourceTitle, getShapeDefinition, handlePosition, imageAssetKey, inferBoardMediaKind, isBoardColorId, isBoardPath, isFileBackedItem, isFileSnapshotFresh, isGeoKind, isMediaItem, isPublicBoardRemoteAddress, isStrokeCorner, isUnknownItem, itemBounds, measureBoardText, mergeFileSnapshot, normalizeBoardConnectionStyle, normalizeBoardDocument, normalizeBoardRemoteUrl, normalizeRotation, normalizeViewport, normalizedPoint, panBy, parseBoardDocument, parseBoardItemLoose, parseBoardManifest, patchBoardAppearance, pathMidpoint, pickBoardColor, planBoardExport, playableBoardMedia, playableBoardMediaList, pointToWorld, pointsBounds, proceduralClip, radToDeg, rankedTaskArtifacts, readCoverFromFrontmatter, readFrontmatterScalars, readTitleFromFrontmatter, rectCenter, rectContainsPoint, rectForCameraFocus, rectsIntersect, registerShapeDefinition, resetBoardPlaybackUrlCache, resizeFrame, resizeFrameToSize, resizeModeForCapabilities, resolveArrow, resolveBoardColor, resolveConnection, resolveCoverRef, resolveFileTitle, resolveSpacePath, rotateFrames, rotatePointAround, rotationHandleAnchor, rotationHandlePosition, sampleArrow, sampleCompositionTracks, sampleEasing, sampleRadius, sampleTrack, scaleFrames, screenOffset, screenPoint, screenToWorld, selectBoardExportAssets, selectionBounds, serializeBoardManifest, setBoardTextMeasurer, shapeBounds, shapeCapabilities, shapeHandles, shapeHitTest, shapeResizeMode, shouldFetchFileExcerpt, simplifyDrawIndices, splitFrontmatter, taskArtifactPreviewUrl, taskArtifacts, taskRunToBoardTaskSnapshot, track, translateArrow, unionRects, unknownRealType, unknownShapeDefinition, visibleWorldRect, withResolvedConnections, worldOffset, worldPoint, worldRect, worldToAnchor, worldToScreen, zoomAround };
|
|
32
|
+
export { AUTO_BOARD_CONNECTION_ANCHOR, type ArrowShapeProps, type AudioShapeProps, BOARD_CHANNELS, BOARD_COLORS, BOARD_CONNECTION_DIRECTIONS, BOARD_CONNECTION_LINES, BOARD_CONNECTION_ROUTINGS, BOARD_CONNECTION_SIDES, BOARD_DOCUMENT_KIND, BOARD_EXPORT_DEFAULT_PADDING, BOARD_EXPORT_DEFAULT_SCALE, BOARD_EXPORT_ITEM_WARN_THRESHOLD, BOARD_EXPORT_MAX_EDGE, BOARD_EXPORT_MAX_PIXELS, BOARD_EXPORT_MAX_TEXTURES, BOARD_EXTENSION, BOARD_REMOTE_URL_MAX_LENGTH, BOARD_STROKE_MAX_SIZE, BOARD_STROKE_MIN_SIZE, BOARD_TASK_ARTIFACT_LIMIT, BoardAppearance, BoardAppearanceSchema, BoardArrowItem, BoardArrowItemSchema, BoardAssetSource, BoardAudioItem, BoardAudioItemSchema, type BoardCameraFocus, type BoardCameraFocusParams, BoardCameraFocusParamsSchema, BoardCameraFocusSchema, type BoardCameraState, BoardCameraStateSchema, BoardColorEntry, type BoardColorId, BoardColorValue, BoardConnection, BoardConnectionAnchor, BoardConnectionAnchorSchema, BoardConnectionDirection, BoardConnectionEndpoint, BoardConnectionEndpointSchema, BoardConnectionInput, BoardConnectionLine, BoardConnectionPatch, BoardConnectionPatchSchema, BoardConnectionRecord, BoardConnectionRouting, BoardConnectionRoutingConfig, BoardConnectionRoutingSchema, BoardConnectionSchema, BoardConnectionSide, BoardConnectionStyle, BoardConnectionStyleSchema, BoardConnectionWaypointSchema, BoardDocument, BoardDocumentSchema, BoardDrawItem, BoardDrawItemSchema, BoardExportAssetSelection, BoardExportPlan, BoardExportPlanInput, BoardExportRegion, BoardExtensionDefinition, BoardExtensionRegistry, BoardFileItem, BoardFileItemSchema, BoardFileSnapshot, type BoardFileSnapshotFacts, BoardFileSnapshotSchema, BoardFrame, BoardFrameItem, BoardFrameItemSchema, BoardFrameSchema, BoardGeoItem, BoardGeoItemSchema, BoardImageItem, BoardImageItemSchema, BoardItem, BoardItemSchema, BoardItemStyle, BoardItemStyleSchema, BoardKnownItem, BoardMediaKind, BoardMediaSnapshot, BoardMediaSnapshotSchema, BoardNormalizedPoint, BoardPlayableMedia, BoardPoint, BoardPointSchema, BoardPresetDefinition, BoardRelationSchema, BoardRemoteUrlSchema, BoardReplayActorKind, BoardReplayEntry, BoardReplayPlayer, BoardScreenOffset, BoardScreenPoint, BoardShapeColors, BoardStyledToolId, BoardTaskArtifact, BoardTaskArtifactSchema, BoardTaskItem, BoardTaskItemSchema, BoardTaskSnapshot, BoardTaskSnapshotSchema, BoardTextItem, BoardTextItemSchema, BoardToolStyleMap, BoardToolStylePatch, type BoardTrackInterpolation, BoardUnknownItem, BoardVideoItem, BoardVideoItemSchema, BoardViewport, BoardViewportSchema, BoardWorldOffset, BoardWorldPoint, BoardWorldRect, type BuildSnapshotInput, CONNECTION_ENDPOINT_GAP, CORNER_RESIZE_HANDLES, CORNER_ROTATION_ZONE_WIDTH, CompositionInput, ConnectionIndex, CornerResizeHandle, DEFAULT_BOARD_APPEARANCE, DEFAULT_BOARD_COLOR, DEFAULT_BOARD_CONNECTION_ROUTING, DEFAULT_BOARD_CONNECTION_STYLE, DEFAULT_BOARD_LIMITS, DEFAULT_BOARD_RELATION, DEFAULT_BOARD_TOOL_STYLES, DrawPoint, DrawPointSchema, type DrawShapeProps, EDGE_RESIZE_HANDLES, FILE_EXCERPT_MAX_BYTES, FILE_EXCERPT_MAX_CHARS, FIT_PADDING, FULL_CAPABILITIES, FileAvailability, type FileCategory, FilePreviewKind, FrameLookup, GEO_KINDS, type GeoKind, type GeoShapeProps, HANDLE_DIRECTION, HANDLE_HIT_RADIUS, type HandleDragResult, type ImageShapeProps, KNOWN_BOARD_ITEM_TYPES, KnownBoardItemType, MAX_BOARD_ZOOM, MIN_BOARD_ZOOM, MIN_ITEM_SIZE, Point, ProceduralClipInput, QualityProfile, RESIZE_HANDLES, ROTATION_HANDLE_OFFSET, Rect, RenderBounds, ResizeHandle, ResolvedArrow, ResolvedConnection, ResolvedConnectionEndpoint, type ResolvedCover, SampledTrack, ScreenPoint, type ShapeCapabilities, ShapeDefinition, type ShapeGeometry, type ShapeHandle, type ShapeHandleId, type ShapeResizeMode, Size, SpaceFileRef, SpaceFileRefSchema, StrokeRibbonGeometry, TEXT_FONT_FAMILY, TEXT_FONT_SIZE, TEXT_LINE_HEIGHT, TEXT_MAX_FONT_SIZE, TEXT_MIN_FONT_SIZE, type TextShapeProps, TrackInput, UNKNOWN_BOARD_ITEM_TYPE, VIEWPORT_MARGIN_RATIO, type VideoShapeProps, WorldPoint, anchorPointOnFrame, anchorToWorld, angleFromCenter, applyBoardAuthoringSnapshot, applyBoardSemanticCommands, arrowBounds, arrowFrame, autoConnectionSide, availabilityFromError, boardAuthoringItemToDocumentItem, boardAuthoringSnapshotToDocument, boardColorCssVar, boardDocumentToSemanticCommands, boardFrameLookup, boardImageKeySource, boardItemToAuthoringItem, boardReplayActorKind, boardTextLineHeight, buildCodeExcerpt, buildFallbackShapeColors, buildFileExcerpt, buildFileSnapshot, buildStrokeOutline, buildStrokeRibbonGeometry, cameraForFocus, cameraForRect, cameraForState, clamp, clampBoardStrokeSize, clampBoardTextFontSize, clampZoom, compileComposition, composition, boardArrowFrame as computeArrowFrame, computeDrawBounds, connectionArrowheads, connectionBounds, connectionHitTest, connectionItemIds, connectionOtherItemId, connectionTouchesItem, createBoardConnection, createBoardExtensionRegistry, createBoardReplayPlayer, createBoardToolStyles, createConnectionIndex, definitionForItem, degToRad, distanceToArrow, distanceToConnection, distanceToStroke, expandRect, exportConnectionBounds, exportItemBounds, featuredTaskArtifact, fileBaseName, fileCategory, fileCategoryAccent, fileMetaLine, filePreviewKind, filePreviewMemoKey, filePreviewScope, fileStem, fileTypeLabel, fitToContent, flipBoardConnection, formatFileSize, frameContainsPoint, frameCornerRotationHandleAt, frameCorners, frameEdgeHandleAt, frameHandlePosition, frameRayIntersection, frameRect, getMediaExtension, getMediaResourceTitle, getShapeDefinition, handlePosition, imageAssetKey, inferBoardMediaKind, isBoardColorId, isBoardPath, isFileBackedItem, isFileSnapshotFresh, isGeoKind, isMediaItem, isPublicBoardRemoteAddress, isStrokeCorner, isUnknownItem, itemBounds, measureBoardText, mergeFileSnapshot, normalizeBoardConnectionStyle, normalizeBoardDocument, normalizeBoardRemoteUrl, normalizeRotation, normalizeViewport, normalizedPoint, panBy, parseBoardDocument, parseBoardItemLoose, parseBoardManifest, patchBoardAppearance, pathMidpoint, pickBoardColor, planBoardExport, playableBoardMedia, playableBoardMediaList, pointToWorld, pointsBounds, proceduralClip, radToDeg, rankedTaskArtifacts, readCoverFromFrontmatter, readFrontmatterScalars, readTitleFromFrontmatter, rectCenter, rectContainsPoint, rectForCameraFocus, rectsIntersect, registerShapeDefinition, resetBoardPlaybackUrlCache, resizeFrame, resizeFrameToSize, resizeModeForCapabilities, resolveArrow, resolveBoardColor, resolveConnection, resolveCoverRef, resolveFileTitle, resolveSpacePath, rotateFrames, rotatePointAround, rotationHandleAnchor, rotationHandlePosition, sampleArrow, sampleCompositionTracks, sampleEasing, sampleRadius, sampleTrack, scaleFrames, screenOffset, screenPoint, screenToWorld, selectBoardExportAssets, selectionBounds, serializeBoardManifest, setBoardTextMeasurer, shapeBounds, shapeCapabilities, shapeHandles, shapeHitTest, shapeResizeMode, shouldFetchFileExcerpt, simplifyDrawIndices, splitFrontmatter, taskArtifactPreviewUrl, taskArtifacts, taskRunToBoardTaskSnapshot, track, translateArrow, unionRects, unknownRealType, unknownShapeDefinition, visibleWorldRect, withResolvedConnections, worldOffset, worldPoint, worldRect, worldToAnchor, worldToScreen, zoomAround };
|
package/dist/board/index.js
CHANGED
|
@@ -24,5 +24,6 @@ import { DEFAULT_BOARD_TOOL_STYLES, createBoardToolStyles } from "./core/tool-st
|
|
|
24
24
|
import { getMediaExtension, getMediaResourceTitle, inferBoardMediaKind } from "./media.js";
|
|
25
25
|
import { playableBoardMedia, playableBoardMediaList, resetBoardPlaybackUrlCache } from "./media-playback.js";
|
|
26
26
|
import { patchBoardAppearance } from "./mutation.js";
|
|
27
|
+
import { boardReplayActorKind, createBoardReplayPlayer } from "./replay.js";
|
|
27
28
|
import { applyBoardSemanticCommands, boardDocumentToSemanticCommands } from "./semantic-mutation.js";
|
|
28
|
-
export { AUTO_BOARD_CONNECTION_ANCHOR, BOARD_CHANNELS, BOARD_COLORS, BOARD_CONNECTION_DIRECTIONS, BOARD_CONNECTION_LINES, BOARD_CONNECTION_ROUTINGS, BOARD_CONNECTION_SIDES, BOARD_DOCUMENT_KIND, BOARD_EXPORT_DEFAULT_PADDING, BOARD_EXPORT_DEFAULT_SCALE, BOARD_EXPORT_ITEM_WARN_THRESHOLD, BOARD_EXPORT_MAX_EDGE, BOARD_EXPORT_MAX_PIXELS, BOARD_EXPORT_MAX_TEXTURES, BOARD_EXTENSION, BOARD_REMOTE_URL_MAX_LENGTH, BOARD_STROKE_MAX_SIZE, BOARD_STROKE_MIN_SIZE, BOARD_TASK_ARTIFACT_LIMIT, BoardAppearanceSchema, BoardArrowItemSchema, BoardAudioItemSchema, BoardCameraFocusParamsSchema, BoardCameraFocusSchema, BoardCameraStateSchema, BoardConnectionAnchorSchema, BoardConnectionEndpointSchema, BoardConnectionPatchSchema, BoardConnectionRoutingSchema, BoardConnectionSchema, BoardConnectionStyleSchema, BoardConnectionWaypointSchema, BoardDocumentSchema, BoardDrawItemSchema, BoardExtensionRegistry, BoardFileItemSchema, BoardFileSnapshotSchema, BoardFrameItemSchema, BoardFrameSchema, BoardGeoItemSchema, BoardImageItemSchema, BoardItemSchema, BoardItemStyleSchema, BoardMediaSnapshotSchema, BoardPointSchema, BoardRelationSchema, BoardRemoteUrlSchema, BoardTaskArtifactSchema, BoardTaskItemSchema, BoardTaskSnapshotSchema, BoardTextItemSchema, BoardVideoItemSchema, BoardViewportSchema, CONNECTION_ENDPOINT_GAP, CORNER_RESIZE_HANDLES, CORNER_ROTATION_ZONE_WIDTH, DEFAULT_BOARD_APPEARANCE, DEFAULT_BOARD_COLOR, DEFAULT_BOARD_CONNECTION_ROUTING, DEFAULT_BOARD_CONNECTION_STYLE, DEFAULT_BOARD_LIMITS, DEFAULT_BOARD_RELATION, DEFAULT_BOARD_TOOL_STYLES, DrawPointSchema, EDGE_RESIZE_HANDLES, FILE_EXCERPT_MAX_BYTES, FILE_EXCERPT_MAX_CHARS, FIT_PADDING, FULL_CAPABILITIES, GEO_KINDS, HANDLE_DIRECTION, HANDLE_HIT_RADIUS, KNOWN_BOARD_ITEM_TYPES, MAX_BOARD_ZOOM, MIN_BOARD_ZOOM, MIN_ITEM_SIZE, RESIZE_HANDLES, ROTATION_HANDLE_OFFSET, SpaceFileRefSchema, TEXT_FONT_FAMILY, TEXT_FONT_SIZE, TEXT_LINE_HEIGHT, TEXT_MAX_FONT_SIZE, TEXT_MIN_FONT_SIZE, UNKNOWN_BOARD_ITEM_TYPE, VIEWPORT_MARGIN_RATIO, anchorPointOnFrame, anchorToWorld, angleFromCenter, applyBoardAuthoringSnapshot, applyBoardSemanticCommands, arrowBounds, arrowFrame, autoConnectionSide, availabilityFromError, boardAuthoringItemToDocumentItem, boardAuthoringSnapshotToDocument, boardColorCssVar, boardDocumentToSemanticCommands, boardFrameLookup, boardImageKeySource, boardItemToAuthoringItem, boardTextLineHeight, buildCodeExcerpt, buildFallbackShapeColors, buildFileExcerpt, buildFileSnapshot, buildStrokeOutline, buildStrokeRibbonGeometry, cameraForFocus, cameraForRect, cameraForState, clamp, clampBoardStrokeSize, clampBoardTextFontSize, clampZoom, compileComposition, composition, boardArrowFrame as computeArrowFrame, computeDrawBounds, connectionArrowheads, connectionBounds, connectionHitTest, connectionItemIds, connectionOtherItemId, connectionTouchesItem, createBoardConnection, createBoardExtensionRegistry, createBoardToolStyles, createConnectionIndex, definitionForItem, degToRad, distanceToArrow, distanceToConnection, distanceToStroke, expandRect, exportConnectionBounds, exportItemBounds, featuredTaskArtifact, fileBaseName, fileCategory, fileCategoryAccent, fileMetaLine, filePreviewKind, filePreviewMemoKey, filePreviewScope, fileStem, fileTypeLabel, fitToContent, flipBoardConnection, formatFileSize, frameContainsPoint, frameCornerRotationHandleAt, frameCorners, frameEdgeHandleAt, frameHandlePosition, frameRayIntersection, frameRect, getMediaExtension, getMediaResourceTitle, getShapeDefinition, handlePosition, imageAssetKey, inferBoardMediaKind, isBoardColorId, isBoardPath, isFileBackedItem, isFileSnapshotFresh, isGeoKind, isMediaItem, isPublicBoardRemoteAddress, isStrokeCorner, isUnknownItem, itemBounds, measureBoardText, mergeFileSnapshot, normalizeBoardConnectionStyle, normalizeBoardDocument, normalizeBoardRemoteUrl, normalizeRotation, normalizeViewport, normalizedPoint, panBy, parseBoardDocument, parseBoardItemLoose, parseBoardManifest, patchBoardAppearance, pathMidpoint, pickBoardColor, planBoardExport, playableBoardMedia, playableBoardMediaList, pointToWorld, pointsBounds, proceduralClip, radToDeg, rankedTaskArtifacts, readCoverFromFrontmatter, readFrontmatterScalars, readTitleFromFrontmatter, rectCenter, rectContainsPoint, rectForCameraFocus, rectsIntersect, registerShapeDefinition, resetBoardPlaybackUrlCache, resizeFrame, resizeFrameToSize, resizeModeForCapabilities, resolveArrow, resolveBoardColor, resolveConnection, resolveCoverRef, resolveFileTitle, resolveSpacePath, rotateFrames, rotatePointAround, rotationHandleAnchor, rotationHandlePosition, sampleArrow, sampleCompositionTracks, sampleEasing, sampleRadius, sampleTrack, scaleFrames, screenOffset, screenPoint, screenToWorld, selectBoardExportAssets, selectionBounds, serializeBoardManifest, setBoardTextMeasurer, shapeBounds, shapeCapabilities, shapeHandles, shapeHitTest, shapeResizeMode, shouldFetchFileExcerpt, simplifyDrawIndices, splitFrontmatter, taskArtifactPreviewUrl, taskArtifacts, taskRunToBoardTaskSnapshot, track, translateArrow, unionRects, unknownRealType, unknownShapeDefinition, visibleWorldRect, withResolvedConnections, worldOffset, worldPoint, worldRect, worldToAnchor, worldToScreen, zoomAround };
|
|
29
|
+
export { AUTO_BOARD_CONNECTION_ANCHOR, BOARD_CHANNELS, BOARD_COLORS, BOARD_CONNECTION_DIRECTIONS, BOARD_CONNECTION_LINES, BOARD_CONNECTION_ROUTINGS, BOARD_CONNECTION_SIDES, BOARD_DOCUMENT_KIND, BOARD_EXPORT_DEFAULT_PADDING, BOARD_EXPORT_DEFAULT_SCALE, BOARD_EXPORT_ITEM_WARN_THRESHOLD, BOARD_EXPORT_MAX_EDGE, BOARD_EXPORT_MAX_PIXELS, BOARD_EXPORT_MAX_TEXTURES, BOARD_EXTENSION, BOARD_REMOTE_URL_MAX_LENGTH, BOARD_STROKE_MAX_SIZE, BOARD_STROKE_MIN_SIZE, BOARD_TASK_ARTIFACT_LIMIT, BoardAppearanceSchema, BoardArrowItemSchema, BoardAudioItemSchema, BoardCameraFocusParamsSchema, BoardCameraFocusSchema, BoardCameraStateSchema, BoardConnectionAnchorSchema, BoardConnectionEndpointSchema, BoardConnectionPatchSchema, BoardConnectionRoutingSchema, BoardConnectionSchema, BoardConnectionStyleSchema, BoardConnectionWaypointSchema, BoardDocumentSchema, BoardDrawItemSchema, BoardExtensionRegistry, BoardFileItemSchema, BoardFileSnapshotSchema, BoardFrameItemSchema, BoardFrameSchema, BoardGeoItemSchema, BoardImageItemSchema, BoardItemSchema, BoardItemStyleSchema, BoardMediaSnapshotSchema, BoardPointSchema, BoardRelationSchema, BoardRemoteUrlSchema, BoardTaskArtifactSchema, BoardTaskItemSchema, BoardTaskSnapshotSchema, BoardTextItemSchema, BoardVideoItemSchema, BoardViewportSchema, CONNECTION_ENDPOINT_GAP, CORNER_RESIZE_HANDLES, CORNER_ROTATION_ZONE_WIDTH, DEFAULT_BOARD_APPEARANCE, DEFAULT_BOARD_COLOR, DEFAULT_BOARD_CONNECTION_ROUTING, DEFAULT_BOARD_CONNECTION_STYLE, DEFAULT_BOARD_LIMITS, DEFAULT_BOARD_RELATION, DEFAULT_BOARD_TOOL_STYLES, DrawPointSchema, EDGE_RESIZE_HANDLES, FILE_EXCERPT_MAX_BYTES, FILE_EXCERPT_MAX_CHARS, FIT_PADDING, FULL_CAPABILITIES, GEO_KINDS, HANDLE_DIRECTION, HANDLE_HIT_RADIUS, KNOWN_BOARD_ITEM_TYPES, MAX_BOARD_ZOOM, MIN_BOARD_ZOOM, MIN_ITEM_SIZE, RESIZE_HANDLES, ROTATION_HANDLE_OFFSET, SpaceFileRefSchema, TEXT_FONT_FAMILY, TEXT_FONT_SIZE, TEXT_LINE_HEIGHT, TEXT_MAX_FONT_SIZE, TEXT_MIN_FONT_SIZE, UNKNOWN_BOARD_ITEM_TYPE, VIEWPORT_MARGIN_RATIO, anchorPointOnFrame, anchorToWorld, angleFromCenter, applyBoardAuthoringSnapshot, applyBoardSemanticCommands, arrowBounds, arrowFrame, autoConnectionSide, availabilityFromError, boardAuthoringItemToDocumentItem, boardAuthoringSnapshotToDocument, boardColorCssVar, boardDocumentToSemanticCommands, boardFrameLookup, boardImageKeySource, boardItemToAuthoringItem, boardReplayActorKind, boardTextLineHeight, buildCodeExcerpt, buildFallbackShapeColors, buildFileExcerpt, buildFileSnapshot, buildStrokeOutline, buildStrokeRibbonGeometry, cameraForFocus, cameraForRect, cameraForState, clamp, clampBoardStrokeSize, clampBoardTextFontSize, clampZoom, compileComposition, composition, boardArrowFrame as computeArrowFrame, computeDrawBounds, connectionArrowheads, connectionBounds, connectionHitTest, connectionItemIds, connectionOtherItemId, connectionTouchesItem, createBoardConnection, createBoardExtensionRegistry, createBoardReplayPlayer, createBoardToolStyles, createConnectionIndex, definitionForItem, degToRad, distanceToArrow, distanceToConnection, distanceToStroke, expandRect, exportConnectionBounds, exportItemBounds, featuredTaskArtifact, fileBaseName, fileCategory, fileCategoryAccent, fileMetaLine, filePreviewKind, filePreviewMemoKey, filePreviewScope, fileStem, fileTypeLabel, fitToContent, flipBoardConnection, formatFileSize, frameContainsPoint, frameCornerRotationHandleAt, frameCorners, frameEdgeHandleAt, frameHandlePosition, frameRayIntersection, frameRect, getMediaExtension, getMediaResourceTitle, getShapeDefinition, handlePosition, imageAssetKey, inferBoardMediaKind, isBoardColorId, isBoardPath, isFileBackedItem, isFileSnapshotFresh, isGeoKind, isMediaItem, isPublicBoardRemoteAddress, isStrokeCorner, isUnknownItem, itemBounds, measureBoardText, mergeFileSnapshot, normalizeBoardConnectionStyle, normalizeBoardDocument, normalizeBoardRemoteUrl, normalizeRotation, normalizeViewport, normalizedPoint, panBy, parseBoardDocument, parseBoardItemLoose, parseBoardManifest, patchBoardAppearance, pathMidpoint, pickBoardColor, planBoardExport, playableBoardMedia, playableBoardMediaList, pointToWorld, pointsBounds, proceduralClip, radToDeg, rankedTaskArtifacts, readCoverFromFrontmatter, readFrontmatterScalars, readTitleFromFrontmatter, rectCenter, rectContainsPoint, rectForCameraFocus, rectsIntersect, registerShapeDefinition, resetBoardPlaybackUrlCache, resizeFrame, resizeFrameToSize, resizeModeForCapabilities, resolveArrow, resolveBoardColor, resolveConnection, resolveCoverRef, resolveFileTitle, resolveSpacePath, rotateFrames, rotatePointAround, rotationHandleAnchor, rotationHandlePosition, sampleArrow, sampleCompositionTracks, sampleEasing, sampleRadius, sampleTrack, scaleFrames, screenOffset, screenPoint, screenToWorld, selectBoardExportAssets, selectionBounds, serializeBoardManifest, setBoardTextMeasurer, shapeBounds, shapeCapabilities, shapeHandles, shapeHitTest, shapeResizeMode, shouldFetchFileExcerpt, simplifyDrawIndices, splitFrontmatter, taskArtifactPreviewUrl, taskArtifacts, taskRunToBoardTaskSnapshot, track, translateArrow, unionRects, unknownRealType, unknownShapeDefinition, visibleWorldRect, withResolvedConnections, worldOffset, worldPoint, worldRect, worldToAnchor, worldToScreen, zoomAround };
|
package/dist/board/mutation.js
CHANGED
|
@@ -6,7 +6,8 @@ function patchBoardAppearance(current, patch) {
|
|
|
6
6
|
...current,
|
|
7
7
|
...patch,
|
|
8
8
|
background: patch.background ?? current.background,
|
|
9
|
-
grid: patch.grid ?? current.grid
|
|
9
|
+
grid: patch.grid ?? current.grid,
|
|
10
|
+
...Object.hasOwn(patch, "motion") ? { motion: patch.motion } : current.motion ? { motion: current.motion } : {}
|
|
10
11
|
});
|
|
11
12
|
}
|
|
12
13
|
//#endregion
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BoardDocument, BoardViewport } from "../../protocol/dist/board-document.js";
|
|
2
|
+
import { BoardRenderPalette } from "./renderers/board-renderer-registry.js";
|
|
3
|
+
import { Application, Container } from "pixi.js";
|
|
4
|
+
//#region src/board/render/board-background.d.ts
|
|
5
|
+
type BoardBackgroundContext = {
|
|
6
|
+
app: Application;
|
|
7
|
+
document: BoardDocument;
|
|
8
|
+
viewport: BoardViewport;
|
|
9
|
+
palette: BoardRenderPalette;
|
|
10
|
+
/** The host renders an image backdrop below the transparent Pixi canvas. */
|
|
11
|
+
hasImageBackground?: boolean;
|
|
12
|
+
};
|
|
13
|
+
declare function createBoardBackground(context: BoardBackgroundContext): Container;
|
|
14
|
+
declare function updateBoardBackground(container: Container, context: BoardBackgroundContext): void;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { BoardBackgroundContext, createBoardBackground, updateBoardBackground };
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { parseBoardCssColor } from "
|
|
1
|
+
import { parseBoardCssColor } from "./css-color.js";
|
|
2
2
|
import { Container, Graphics, RenderTexture, TilingSprite } from "pixi.js";
|
|
3
|
-
//#region src/board/render/
|
|
3
|
+
//#region src/board/render/board-background.ts
|
|
4
4
|
const partsByContainer = /* @__PURE__ */ new WeakMap();
|
|
5
|
-
/** Positive modulo so tile offsets stay valid for negative viewport offsets. */
|
|
6
5
|
function wrap(value, period) {
|
|
7
6
|
return (value % period + period) % period;
|
|
8
7
|
}
|
|
9
|
-
function buildGridTexture(context, size, color, opacity, kind
|
|
8
|
+
function buildGridTexture(context, size, color, opacity, kind) {
|
|
10
9
|
const graphics = new Graphics();
|
|
11
10
|
if (kind === "grid") graphics.moveTo(0, .5).lineTo(size, .5).moveTo(.5, 0).lineTo(.5, size).stroke({
|
|
12
11
|
color,
|
|
@@ -46,11 +45,10 @@ function sync(parts, context) {
|
|
|
46
45
|
parts.lastBg = bgColor;
|
|
47
46
|
parts.lastBgAlpha = bgAlpha;
|
|
48
47
|
}
|
|
49
|
-
const
|
|
50
|
-
const
|
|
51
|
-
const
|
|
52
|
-
const
|
|
53
|
-
const kind = appearance.background?.kind === "grid" ? "grid" : "dots";
|
|
48
|
+
const visible = document.appearance.grid?.visible === true;
|
|
49
|
+
const size = Math.max(4, document.appearance.grid?.size ?? 24);
|
|
50
|
+
const opacity = document.appearance.grid?.opacity ?? .12;
|
|
51
|
+
const kind = document.appearance.background?.kind === "grid" ? "grid" : "dots";
|
|
54
52
|
const key = `${kind}|${size}|${palette.border}|${opacity}`;
|
|
55
53
|
if (!visible) {
|
|
56
54
|
if (parts.sprite) parts.sprite.visible = false;
|
|
@@ -80,30 +78,25 @@ function sync(parts, context) {
|
|
|
80
78
|
sprite.tileScale.set(viewport.zoom);
|
|
81
79
|
sprite.tilePosition.set(wrap(viewport.x, step), wrap(viewport.y, step));
|
|
82
80
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
updateBackground: (container, context) => {
|
|
104
|
-
const parts = partsByContainer.get(container);
|
|
105
|
-
if (parts) sync(parts, context);
|
|
106
|
-
}
|
|
107
|
-
};
|
|
81
|
+
function createBoardBackground(context) {
|
|
82
|
+
const container = new Container({ label: "board-background" });
|
|
83
|
+
const fill = new Graphics();
|
|
84
|
+
container.addChild(fill);
|
|
85
|
+
partsByContainer.set(container, {
|
|
86
|
+
fill,
|
|
87
|
+
sprite: null,
|
|
88
|
+
textureKey: "",
|
|
89
|
+
lastWidth: -1,
|
|
90
|
+
lastHeight: -1,
|
|
91
|
+
lastBg: NaN,
|
|
92
|
+
lastBgAlpha: NaN
|
|
93
|
+
});
|
|
94
|
+
sync(partsByContainer.get(container), context);
|
|
95
|
+
return container;
|
|
96
|
+
}
|
|
97
|
+
function updateBoardBackground(container, context) {
|
|
98
|
+
const parts = partsByContainer.get(container);
|
|
99
|
+
if (parts) sync(parts, context);
|
|
100
|
+
}
|
|
108
101
|
//#endregion
|
|
109
|
-
export {
|
|
102
|
+
export { createBoardBackground, updateBoardBackground };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import { BoardCardRenderer, BoardRenderContext, BoardRenderPalette, boardCardRenderersForTest, getBoardCardRenderer, registerBoardCardRenderer } from "./renderers/board-renderer-registry.js";
|
|
2
|
+
import { BoardBackgroundContext, createBoardBackground, updateBoardBackground } from "./board-background.js";
|
|
1
3
|
import { ConnectionLayer, ConnectionRenderInput, createConnectionLayer, framesFromItems } from "./connection-layer.js";
|
|
2
4
|
import { parseBoardCssColor } from "./css-color.js";
|
|
3
5
|
import { BoardMediaAction, boardMediaActionAt, mediaPlayBadgeHit, mediaPlayBadgeVisible } from "./media-interaction.js";
|
|
4
|
-
import { BoardCardRenderer, BoardRenderContext, BoardRenderPalette, boardCardRenderersForTest, getBoardCardRenderer, registerBoardCardRenderer } from "./renderers/board-renderer-registry.js";
|
|
5
6
|
import { defaultBoardPalette } from "./palette.js";
|
|
6
7
|
import { TASK_CARD_FULL_DETAIL_ZOOM } from "./renderers/task-card-renderer.js";
|
|
7
8
|
import { ensureBoardTextMeasurement, installBoardTextMeasurement } from "./text-measurement.js";
|
|
8
9
|
import { getBoardResolution, syncTextResolution, syncTextWrapWidth, textResolutionForZoom, textZoomBucket } from "./text-resolution.js";
|
|
9
|
-
import { BoardThemeContext, BoardThemeRenderer, getBoardThemeRenderer, registerBoardThemeRenderer } from "./themes/board-theme-registry.js";
|
|
10
10
|
import { VIDEO_THUMBNAIL_MAX_EDGE, VideoNaturalSize, loadVideoThumbnailTexture, videoTextureNaturalSize, videoThumbnailSize } from "./video-thumbnail.js";
|
|
11
|
-
export { BoardCardRenderer, BoardMediaAction, BoardRenderContext, BoardRenderPalette,
|
|
11
|
+
export { BoardBackgroundContext, BoardCardRenderer, BoardMediaAction, BoardRenderContext, BoardRenderPalette, ConnectionLayer, ConnectionRenderInput, TASK_CARD_FULL_DETAIL_ZOOM, VIDEO_THUMBNAIL_MAX_EDGE, VideoNaturalSize, boardCardRenderersForTest, boardMediaActionAt, createBoardBackground, createConnectionLayer, defaultBoardPalette, ensureBoardTextMeasurement, framesFromItems, getBoardCardRenderer, getBoardResolution, installBoardTextMeasurement, loadVideoThumbnailTexture, mediaPlayBadgeHit, mediaPlayBadgeVisible, parseBoardCssColor, registerBoardCardRenderer, syncTextResolution, syncTextWrapWidth, textResolutionForZoom, textZoomBucket, updateBoardBackground, videoTextureNaturalSize, videoThumbnailSize };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { parseBoardCssColor } from "./css-color.js";
|
|
2
|
+
import { createBoardBackground, updateBoardBackground } from "./board-background.js";
|
|
2
3
|
import { getBoardResolution, syncTextResolution, syncTextWrapWidth, textResolutionForZoom, textZoomBucket } from "./text-resolution.js";
|
|
3
4
|
import { createConnectionLayer, framesFromItems } from "./connection-layer.js";
|
|
4
5
|
import { TASK_CARD_FULL_DETAIL_ZOOM } from "./renderers/task-card-renderer.js";
|
|
@@ -6,6 +7,5 @@ import { boardMediaActionAt, mediaPlayBadgeHit, mediaPlayBadgeVisible } from "./
|
|
|
6
7
|
import { defaultBoardPalette } from "./palette.js";
|
|
7
8
|
import { ensureBoardTextMeasurement, installBoardTextMeasurement } from "./text-measurement.js";
|
|
8
9
|
import { boardCardRenderersForTest, getBoardCardRenderer, registerBoardCardRenderer } from "./renderers/board-renderer-registry.js";
|
|
9
|
-
import { getBoardThemeRenderer, registerBoardThemeRenderer } from "./themes/board-theme-registry.js";
|
|
10
10
|
import { VIDEO_THUMBNAIL_MAX_EDGE, loadVideoThumbnailTexture, videoTextureNaturalSize, videoThumbnailSize } from "./video-thumbnail.js";
|
|
11
|
-
export { TASK_CARD_FULL_DETAIL_ZOOM, VIDEO_THUMBNAIL_MAX_EDGE, boardCardRenderersForTest, boardMediaActionAt, createConnectionLayer, defaultBoardPalette, ensureBoardTextMeasurement, framesFromItems, getBoardCardRenderer, getBoardResolution,
|
|
11
|
+
export { TASK_CARD_FULL_DETAIL_ZOOM, VIDEO_THUMBNAIL_MAX_EDGE, boardCardRenderersForTest, boardMediaActionAt, createBoardBackground, createConnectionLayer, defaultBoardPalette, ensureBoardTextMeasurement, framesFromItems, getBoardCardRenderer, getBoardResolution, installBoardTextMeasurement, loadVideoThumbnailTexture, mediaPlayBadgeHit, mediaPlayBadgeVisible, parseBoardCssColor, registerBoardCardRenderer, syncTextResolution, syncTextWrapWidth, textResolutionForZoom, textZoomBucket, updateBoardBackground, videoTextureNaturalSize, videoThumbnailSize };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BOARD_FONT_STACK, BOARD_MONO_FONT_STACK } from "../../../protocol/dist/board-constants.js";
|
|
2
2
|
import { fileCategory, fileStem } from "../../core/file-snapshot.js";
|
|
3
|
-
import { fileCategoryAccent,
|
|
3
|
+
import { fileCategoryAccent, filePreviewKind, fileTypeLabel } from "../../core/file-preview.js";
|
|
4
4
|
import { syncTextResolution } from "../text-resolution.js";
|
|
5
5
|
import { positionShell } from "./base-card-renderer.js";
|
|
6
6
|
import { drawFarPlate } from "./far-plate.js";
|
|
@@ -33,8 +33,6 @@ const TITLE_MAX_LINES = 2;
|
|
|
33
33
|
const EXCERPT_SIZE = 11;
|
|
34
34
|
const EXCERPT_LINE = EXCERPT_SIZE * 1.45;
|
|
35
35
|
const EXCERPT_MAX_LINES = 3;
|
|
36
|
-
const META_SIZE = 10;
|
|
37
|
-
const META_LINE = 14;
|
|
38
36
|
const TYPE_MARK_SIZE = 28;
|
|
39
37
|
const GAP = 4;
|
|
40
38
|
const STRIPE = 2;
|
|
@@ -178,7 +176,6 @@ function sync(container, item, context) {
|
|
|
178
176
|
const accent = fileCategoryAccent(category, context.palette);
|
|
179
177
|
syncTextResolution(parts.title, parts.titleRes, context.zoom);
|
|
180
178
|
syncTextResolution(parts.excerpt, parts.excerptRes, context.zoom);
|
|
181
|
-
syncTextResolution(parts.meta, parts.metaRes, context.zoom);
|
|
182
179
|
syncTextResolution(parts.typeMark, parts.typeMarkRes, context.zoom);
|
|
183
180
|
const visualSig = [
|
|
184
181
|
key ?? "",
|
|
@@ -237,24 +234,20 @@ function sync(container, item, context) {
|
|
|
237
234
|
});
|
|
238
235
|
parts.title.visible = detail !== "plate";
|
|
239
236
|
parts.excerpt.visible = detail === "full";
|
|
240
|
-
parts.meta.visible = detail === "full";
|
|
241
237
|
parts.typeMark.visible = kind === "blank" && detail !== "plate";
|
|
242
238
|
}
|
|
243
239
|
if (detail === "plate") {
|
|
244
240
|
parts.typeMark.visible = false;
|
|
245
|
-
parts.meta.visible = false;
|
|
246
241
|
return;
|
|
247
242
|
}
|
|
248
243
|
const title = item.snapshot?.title || fileStem(item.ref.path);
|
|
249
244
|
const excerpt = item.snapshot?.excerpt ?? "";
|
|
250
|
-
const meta = fileMetaLine(item.ref.path, item.snapshot?.size);
|
|
251
245
|
const mark = fileTypeLabel(item.ref.path);
|
|
252
246
|
const innerWidth = Math.max(1, width - 20);
|
|
253
247
|
const showTypeMark = kind === "blank";
|
|
254
248
|
const textSig = [
|
|
255
249
|
title,
|
|
256
250
|
excerpt,
|
|
257
|
-
meta,
|
|
258
251
|
mark,
|
|
259
252
|
detail,
|
|
260
253
|
innerWidth,
|
|
@@ -268,8 +261,7 @@ function sync(container, item, context) {
|
|
|
268
261
|
if (textSig === parts.textSig) return;
|
|
269
262
|
parts.textSig = textSig;
|
|
270
263
|
const top = band > 0 ? band + PADDING * .8 : PADDING;
|
|
271
|
-
const
|
|
272
|
-
const contentBottom = height - PADDING - metaReserve;
|
|
264
|
+
const contentBottom = height - PADDING;
|
|
273
265
|
let cursor = top;
|
|
274
266
|
if (showTypeMark) {
|
|
275
267
|
const markSize = Math.max(18, Math.min(TYPE_MARK_SIZE, Math.round(height * .22)));
|
|
@@ -288,7 +280,6 @@ function sync(container, item, context) {
|
|
|
288
280
|
parts.title.visible = titleLines > 0;
|
|
289
281
|
if (detail !== "full") {
|
|
290
282
|
parts.excerpt.visible = false;
|
|
291
|
-
parts.meta.visible = false;
|
|
292
283
|
return;
|
|
293
284
|
}
|
|
294
285
|
const excerptTop = cursor + (titleLines > 0 ? parts.title.height + GAP : 0);
|
|
@@ -300,12 +291,6 @@ function sync(container, item, context) {
|
|
|
300
291
|
parts.excerpt.position.set(PADDING, excerptTop);
|
|
301
292
|
}
|
|
302
293
|
parts.excerpt.visible = showExcerpt;
|
|
303
|
-
if (meta) {
|
|
304
|
-
parts.meta.style.fill = context.palette.muted;
|
|
305
|
-
if (parts.meta.text !== meta) parts.meta.text = meta;
|
|
306
|
-
parts.meta.position.set(PADDING, height - PADDING - META_LINE + 2);
|
|
307
|
-
parts.meta.visible = true;
|
|
308
|
-
} else parts.meta.visible = false;
|
|
309
294
|
}
|
|
310
295
|
const fileCardRenderer = {
|
|
311
296
|
id: "file-card",
|
|
@@ -347,18 +332,6 @@ const fileCardRenderer = {
|
|
|
347
332
|
resolution,
|
|
348
333
|
roundPixels: true
|
|
349
334
|
});
|
|
350
|
-
const meta = new Text({
|
|
351
|
-
text: "",
|
|
352
|
-
style: {
|
|
353
|
-
fill: context.palette.muted,
|
|
354
|
-
fontFamily: BOARD_MONO_FONT_STACK,
|
|
355
|
-
fontSize: META_SIZE,
|
|
356
|
-
fontWeight: "500",
|
|
357
|
-
lineHeight: META_LINE
|
|
358
|
-
},
|
|
359
|
-
resolution,
|
|
360
|
-
roundPixels: true
|
|
361
|
-
});
|
|
362
335
|
const typeMark = new Text({
|
|
363
336
|
text: "",
|
|
364
337
|
style: {
|
|
@@ -372,7 +345,7 @@ const fileCardRenderer = {
|
|
|
372
345
|
roundPixels: true
|
|
373
346
|
});
|
|
374
347
|
body.mask = clip;
|
|
375
|
-
body.addChild(cover, coverMask, typeMark, title, excerpt
|
|
348
|
+
body.addChild(cover, coverMask, typeMark, title, excerpt);
|
|
376
349
|
root.addChild(plate, body, clip);
|
|
377
350
|
partsByContainer.set(root, {
|
|
378
351
|
root,
|
|
@@ -384,12 +357,10 @@ const fileCardRenderer = {
|
|
|
384
357
|
typeMark,
|
|
385
358
|
title,
|
|
386
359
|
excerpt,
|
|
387
|
-
meta,
|
|
388
360
|
visualSig: "",
|
|
389
361
|
textSig: "",
|
|
390
362
|
titleRes: { resolution },
|
|
391
363
|
excerptRes: { resolution },
|
|
392
|
-
metaRes: { resolution },
|
|
393
364
|
typeMarkRes: { resolution }
|
|
394
365
|
});
|
|
395
366
|
if (item.type === "file") sync(root, item, context);
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { RequestSource } from "../protocol/dist/provenance.js";
|
|
2
|
+
import { BoardTransactionsPage } from "../protocol/dist/board.js";
|
|
3
|
+
import { BoardDocument } from "../protocol/dist/board-document.js";
|
|
4
|
+
import "../protocol/dist/index.js";
|
|
5
|
+
//#region src/board/replay.d.ts
|
|
6
|
+
type BoardReplayActorKind = "human" | "cli" | "agent";
|
|
7
|
+
/** One step on the replay timeline. */
|
|
8
|
+
type BoardReplayEntry = {
|
|
9
|
+
version: number;
|
|
10
|
+
actorId: string;
|
|
11
|
+
kind: BoardReplayActorKind;
|
|
12
|
+
/** Epoch milliseconds. */
|
|
13
|
+
at: number;
|
|
14
|
+
/** Whether the step changed anything visible in the render document. */
|
|
15
|
+
visual: boolean;
|
|
16
|
+
};
|
|
17
|
+
type BoardReplayPlayer = ReturnType<typeof createBoardReplayPlayer>;
|
|
18
|
+
declare function boardReplayActorKind(source: RequestSource | null): BoardReplayActorKind;
|
|
19
|
+
/**
|
|
20
|
+
* Create a player positioned at the live version described by the first page.
|
|
21
|
+
*
|
|
22
|
+
* `transactions` are newest-first as served; the player keeps them oldest-first.
|
|
23
|
+
* Older pages can be added with `prepend`, and newer transactions that arrive
|
|
24
|
+
* live can be added with `append`, so the timeline grows in both directions
|
|
25
|
+
* without a reset.
|
|
26
|
+
*/
|
|
27
|
+
declare function createBoardReplayPlayer(page: BoardTransactionsPage): {
|
|
28
|
+
/** Oldest version the loaded transactions can rewind to. */
|
|
29
|
+
readonly floor: number;
|
|
30
|
+
/** Newest version known to the player. */
|
|
31
|
+
readonly head: number;
|
|
32
|
+
readonly entries: readonly BoardReplayEntry[];
|
|
33
|
+
/** Current position. */
|
|
34
|
+
readonly version: number;
|
|
35
|
+
seek: (version: number) => number;
|
|
36
|
+
documentAt: (version: number) => BoardDocument;
|
|
37
|
+
/** Item ids touched by the transaction that produced `version`, for camera follow. */
|
|
38
|
+
changedItemIds(version: number): string[];
|
|
39
|
+
/** Add an older page (as served, newest-first). */
|
|
40
|
+
prepend(older: BoardTransactionsPage): void;
|
|
41
|
+
/**
|
|
42
|
+
* Add transactions that landed after the current head. Forward payloads are
|
|
43
|
+
* enough to extend the timeline; the scrub position is untouched.
|
|
44
|
+
*
|
|
45
|
+
* Returns false when the page does not reach back to the head: the chain
|
|
46
|
+
* would have a hole, so nothing is appended and the caller must fetch an
|
|
47
|
+
* older page (`before` = the page's oldest version) and try again.
|
|
48
|
+
*/
|
|
49
|
+
append(latest: BoardTransactionsPage): boolean;
|
|
50
|
+
};
|
|
51
|
+
//#endregion
|
|
52
|
+
export { BoardReplayActorKind, BoardReplayEntry, BoardReplayPlayer, boardReplayActorKind, createBoardReplayPlayer };
|