@neta-art/cohub 11.4.0 → 11.5.1
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/editor/clipboard.js +1 -1
- package/dist/board/editor/creation.js +1 -1
- package/dist/board/editor/editor.js +2 -2
- package/dist/board/editor/selection.js +1 -1
- package/dist/board/export/index.js +1 -1
- package/dist/board/export/node/scripts.js +1 -1
- package/dist/board/export/scene.js +1 -1
- package/dist/board/model/index.js +15 -15
- package/dist/board/model/items/create.js +1 -1
- package/dist/board/model/sampling.js +1 -1
- package/dist/board/render/media-interaction.js +1 -1
- package/dist/board/render/renderers/arrow-card-renderer.js +1 -1
- package/dist/board/render/renderers/audio-card-renderer.js +1 -1
- package/dist/board/render/renderers/base-card-renderer.js +2 -5
- package/dist/board/render/renderers/custom-card-renderer.js +2 -1
- package/dist/board/render/renderers/draw-card-renderer.js +1 -1
- package/dist/board/render/renderers/file-card-renderer.js +2 -2
- package/dist/board/render/renderers/model-card-renderer.js +3 -3
- package/dist/board/render/renderers/text-card-renderer.js +1 -1
- package/dist/board/render/renderers/video-card-renderer.js +1 -1
- package/dist/board/render/script-export.js +1 -1
- package/dist/board/render/script-host.js +1 -1
- package/dist/board/render/text-resolution.d.ts +4 -1
- package/dist/board/render/text-resolution.js +10 -5
- package/dist/board/stage/assets.js +1 -1
- package/dist/board/stage/display-density.d.ts +4 -0
- package/dist/board/stage/display-density.js +25 -0
- package/dist/board/stage/stage.js +32 -16
- package/dist/chunks/environment.d.ts +137 -13
- package/dist/chunks/http.d.ts +7 -3
- package/dist/chunks/websocket.d.ts +1 -1
- package/dist/http.d.ts +1 -1
- package/dist/index.d.ts +2 -79
- package/dist/index.js +60 -27
- package/dist/protocol/dist/board-patch.js +1 -1
- package/dist/protocol/dist/model/session.d.ts +1 -0
- package/dist/protocol/dist/realtime/types.d.ts +1 -0
- package/dist/protocol/dist/runtime/harnesses.d.ts +1 -0
- package/dist/protocol/dist/runtime/index.d.ts +2 -0
- package/dist/protocol/dist/runtime/projection.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { parseBoardItem } from "../../protocol/dist/board-model.js";
|
|
2
|
-
import { BOARD_CLIPBOARD_KIND, BOARD_CLIPBOARD_MIME } from "../../protocol/dist/board.js";
|
|
3
2
|
import { arrowBindings, isArrowBinding } from "../../protocol/dist/board-layout.js";
|
|
3
|
+
import { BOARD_CLIPBOARD_KIND, BOARD_CLIPBOARD_MIME } from "../../protocol/dist/board.js";
|
|
4
4
|
import { createBoardItemId } from "../model/items/id.js";
|
|
5
5
|
//#region src/board/editor/clipboard.ts
|
|
6
6
|
/** How far a duplicate or repeated paste lands from its source. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IDENTITY_MATRIX, applyMatrix, invertMatrix } from "../../protocol/dist/board-layout.js";
|
|
2
|
-
import { buildBoardScene } from "../model/scene.js";
|
|
3
2
|
import { rectCenter } from "../model/geometry.js";
|
|
3
|
+
import { buildBoardScene } from "../model/scene.js";
|
|
4
4
|
import { isShapeKind } from "../model/shape-types.js";
|
|
5
5
|
import { createBoardItemId } from "../model/items/id.js";
|
|
6
6
|
import { createAppBoardItem, createArrowBoardItem, createDrawBoardItem, createFileNodeForPath, createFrameBoardItem, createMediaBoardItem, createShapeBoardItem, createTaskBoardItem, createTextBoardItem } from "../model/items/create.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { clampBoardStrokeSize } from "../../protocol/dist/board-constants.js";
|
|
2
|
-
import {
|
|
2
|
+
import { hasBoardScripts } from "../model/script-index.js";
|
|
3
3
|
import { normalizeViewport } from "../model/geometry.js";
|
|
4
|
+
import { buildBoardScene } from "../model/scene.js";
|
|
4
5
|
import { isBoardColorId } from "../model/palette.js";
|
|
5
|
-
import { hasBoardScripts } from "../model/script-index.js";
|
|
6
6
|
import { isShapeKind } from "../model/shape-types.js";
|
|
7
7
|
import { createBoardToolStyles } from "../model/tool-styles.js";
|
|
8
8
|
import { titleForBoardItem } from "../model/items/create.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { sceneItemToItem } from "../model/scene.js";
|
|
2
1
|
import { selectionBounds } from "../model/geometry.js";
|
|
2
|
+
import { sceneItemToItem } from "../model/scene.js";
|
|
3
3
|
import { alignFrames, distributeFrames } from "./align.js";
|
|
4
4
|
import { resolveSelectionTransform } from "./selection-transform.js";
|
|
5
5
|
import { memo } from "./state.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { buildBoardScene } from "../model/scene.js";
|
|
2
2
|
import { resolveBoardAnimationCamera } from "../model/sampling.js";
|
|
3
|
+
import { normalizeBoardDocument, planBoardExport } from "../model/export-plan.js";
|
|
3
4
|
import { parseBoardCssColor } from "../render/css-color.js";
|
|
4
5
|
import { defaultBoardPalette } from "../render/palette.js";
|
|
5
6
|
import { createBoardRenderSampler } from "../render/sampling.js";
|
|
6
|
-
import { normalizeBoardDocument, planBoardExport } from "../model/export-plan.js";
|
|
7
7
|
import { ensureBoardTextMeasurement } from "../render/text-measurement.js";
|
|
8
8
|
import { createBoardExportScene } from "./scene.js";
|
|
9
9
|
import { Rectangle, RendererType } from "pixi.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { buildBoardScene } from "../../model/scene.js";
|
|
2
1
|
import { boardScriptScope, composeBoardScriptItems } from "../../model/script-scene.js";
|
|
2
|
+
import { buildBoardScene } from "../../model/scene.js";
|
|
3
3
|
import { createBoardScriptModuleReader, loadBoardScriptSources } from "../../../protocol/dist/board-script-modules.js";
|
|
4
4
|
import { createScriptRuntime } from "../../render/script-runtime.js";
|
|
5
5
|
import { initializeBoardFonts } from "./fonts.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { buildFallbackShapeColors } from "../model/palette.js";
|
|
2
|
+
import { imageAssetKey } from "../model/image-key.js";
|
|
2
3
|
import { defaultBoardPalette } from "../render/palette.js";
|
|
3
4
|
import { clippingAncestor, isClippingFrame, syncClipGroup } from "../render/clip.js";
|
|
4
5
|
import { DEFAULT_BOARD_RENDER_LABELS, getBoardCardRenderer } from "../render/renderers/board-renderer-registry.js";
|
|
5
6
|
import { resolveBoardRenderStyle } from "../render/style.js";
|
|
6
|
-
import { imageAssetKey } from "../model/image-key.js";
|
|
7
7
|
import { Container, Graphics, Sprite, TilingSprite } from "pixi.js";
|
|
8
8
|
//#region src/board/export/scene.ts
|
|
9
9
|
function buildContext(input) {
|
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
import { BOARD_STROKE_MAX_SIZE, BOARD_STROKE_MIN_SIZE, clampBoardStrokeSize } from "../../protocol/dist/board-constants.js";
|
|
2
2
|
import { isPublicBoardRemoteAddress, normalizeBoardRemoteUrl } from "../../protocol/dist/board-url.js";
|
|
3
3
|
import { BOARD_ANCHOR_SIDES, BOARD_ARROW_ROUTES, BOARD_CAMERA_TARGET, BOARD_COLOR_TOKENS, BOARD_DASHES, BOARD_DERIVED_SIZE_TYPES, BOARD_EFFECT_KINDS, BOARD_EFFECT_KIND_INFO, BOARD_ENTER_PRESETS, BOARD_EXTENSION_TYPE_PATTERN, BOARD_GRID_DEFAULT_SIZE, BOARD_GRID_MAX_SIZE, BOARD_GRID_MIN_SIZE, BOARD_ID_MAX_LENGTH, BOARD_ITEM_SCHEMAS, BOARD_ITEM_TYPES, BOARD_PLAY_MODES, BOARD_SHAPE_GEOMETRIES, BOARD_TASK_ARTIFACT_LIMIT, BOARD_TEXT_ALIGNS, BoardAnimationHeaderSchema, BoardAnimationSchema, BoardArrowAnchorSchema, BoardArrowBindingSchema, BoardArrowEndSchema, BoardArrowItemSchema, BoardAudioItemSchema, BoardBackgroundSchema, BoardColorSchema, BoardCropSchema, BoardCustomItemSchema, BoardDrawItemSchema, BoardDrawPointSchema, BoardEaseSchema, BoardEffectItemSchema, BoardExtensionItemSchema, BoardFileItemSchema, BoardFrameItemSchema, BoardIdSchema, BoardImageItemSchema, BoardKeySchema, BoardKeyframeSchema, BoardMarkerSchema, BoardMediaOriginSchema, BoardMediaSnapshotSchema, BoardMediaSourceSchema, BoardPatchSchema, BoardScriptSchema, BoardSettingsSchema, BoardShapeItemSchema, BoardSizeSchema, BoardStyleSchema, BoardTaskArtifactSchema, BoardTaskItemSchema, BoardTaskSnapshotSchema, BoardTextItemSchema, BoardTrackSchema, BoardVec2Schema, BoardVideoItemSchema, boardItemSchema, emptyBoardDocument, hasAuthoredSize, isBoardColorString, isBoardEase, isBuiltinItem, isBuiltinItemType, isEmptyBoardDelta, isFileBackedItem, isMediaItem, isSafeBoardSourcePath, parseBoardItem, parseBoardMediaSource } from "../../protocol/dist/board-model.js";
|
|
4
|
-
import { isBoardPath, parseBoardManifest, serializeBoardManifest } from "../../protocol/dist/board.js";
|
|
5
4
|
import { IDENTITY_MATRIX, anchorPoint, applyMatrix, arrowBindings, autoAnchorSide, bendControl, clampBoardFontSize, createBoardLayout, createDocumentLayout, drawPointsBounds, drawSampleRadius, estimateTextWidth, framePoint, invertMatrix, isArrowBinding, layoutBoardText, multiplyMatrix, pointsRect, rotateAround, scaleVector, setBoardTextMeasurer, sideAnchor } from "../../protocol/dist/board-layout.js";
|
|
6
5
|
import { applyBoardDelta, applyBoardPatch, applyBoardPatchToDocument, boardPatchTouches, createDocumentState, diffBoardDocuments, diffMergePatch, isEmptyBoardPatch, listBoardProperties, mergePatch, parseBoardDocument, pruneBoardTrack, resolveBoardProperty, trackReferences } from "../../protocol/dist/board-patch.js";
|
|
6
|
+
import { isBoardPath, parseBoardManifest, serializeBoardManifest } from "../../protocol/dist/board.js";
|
|
7
7
|
import { BOARD_SCHEMA_TARGETS, boardJsonSchema, boardSchemaOverview } from "../../protocol/dist/board-schema.js";
|
|
8
8
|
import { BOARD_TASK_SOURCE_PREFIX, boardTaskSource, featuredTaskArtifact, rankedTaskArtifacts, taskArtifactPreviewUrl, taskArtifacts, taskRunArtifacts, taskRunToBoardTaskSnapshot, withObservedArtifactFacts } from "../../protocol/dist/board-task.js";
|
|
9
|
-
import {
|
|
10
|
-
import { buildBoardScene, orderBoardItems, placeItem, refreshBoardScene, sceneItemToItem, sceneItemsToRecord, toSceneItem } from "./scene.js";
|
|
11
|
-
import { CORNER_RESIZE_HANDLES, CORNER_ROTATION_ZONE_WIDTH, EDGE_RESIZE_HANDLES, FIT_PADDING, HANDLE_DIRECTION, HANDLE_HIT_RADIUS, MAX_BOARD_ZOOM, MIN_BOARD_ZOOM, MIN_ITEM_SIZE, RESIZE_HANDLES, ROTATION_HANDLE_OFFSET, VIEWPORT_MARGIN_RATIO, angleFromCenter, cameraForFocus, cameraForRect, cameraForState, clamp, clampZoom, degToRad, expandRect, fitToContent, frameContainsPoint, frameCornerRotationHandleAt, frameCorners, frameEdgeHandleAt, frameHandlePosition, frameRayIntersection, frameRect, handlePosition, itemBounds, normalizeRotation, normalizeViewport, normalizedPoint, panBy, pointToWorld, pointsBounds, radToDeg, rectCenter, rectContainsPoint, rectForCameraFocus, rectsIntersect, resizeFrame, resizeFrameToSize, rotateFrames, rotatePointAround, rotationHandleAnchor, rotationHandlePosition, scaleFrames, screenOffset, screenPoint, screenToWorld, selectionBounds, stableCullRect, unionRects, visibleWorldRect, worldOffset, worldPoint, worldRect, worldToScreen, zoomAround } from "./geometry.js";
|
|
12
|
-
import { createBoardAnimationSampler, resolveBoardAnimationCamera } from "./sampling.js";
|
|
13
|
-
import { BOARD_COLORS, DEFAULT_BOARD_COLOR, boardColorCssVar, buildFallbackShapeColors, isBoardColorId, pickBoardColor, resolveBoardColor, resolveItemColor } from "./palette.js";
|
|
14
|
-
import { ARROW_BINDING_GAP, arrowHitRadius, arrowPathBounds, distanceToArrow, pathMidpoint, pathPointAt, resolveAnchor, resolveArrow, resolveSceneArrow } from "./arrow-geometry.js";
|
|
15
|
-
import { BOARD_EXPORT_DEFAULT_PADDING, BOARD_EXPORT_DEFAULT_SCALE, BOARD_EXPORT_ITEM_WARN_THRESHOLD, BOARD_EXPORT_MAX_EDGE, BOARD_EXPORT_MAX_PIXELS, exportItemBounds, normalizeBoardDocument, planBoardExport } from "./export-plan.js";
|
|
16
|
-
import { TEXT_FONT_FAMILY, TEXT_FONT_SIZE, TEXT_LINE_HEIGHT, TEXT_MAX_FONT_SIZE, TEXT_MIN_FONT_SIZE, boardFontFamily } from "./text-metrics.js";
|
|
17
|
-
import { boardModelFormat, getMediaExtension, getMediaResourceTitle, inferBoardMediaKind, isBoardModelItem } from "./media.js";
|
|
18
|
-
import { FILE_EXCERPT_MAX_BYTES, FILE_EXCERPT_MAX_CHARS, buildCodeExcerpt, buildFileExcerpt, buildFileSnapshot, fileBaseName, fileCategory, fileStem, readCoverFromFrontmatter, readFrontmatterScalars, readTitleFromFrontmatter, resolveCoverRef, resolveFileTitle, resolveSpacePath, shouldFetchFileExcerpt, splitFrontmatter } from "./file-snapshot.js";
|
|
19
|
-
import { availabilityFromError, fileCategoryAccent, fileMetaLine, filePreviewKind, filePreviewMemoKey, filePreviewScope, fileTypeLabel, formatFileSize, isFileSnapshotFresh, mergeFileSnapshot } from "./file-preview.js";
|
|
20
|
-
import { buildStrokeOutline, buildStrokeRibbonGeometry, computeDrawBounds, createStrokeRibbonBuilder, distanceToStroke, isStrokeCorner, sampleRadius, simplifyDrawIndices, trimDrawPoints } from "./draw-geometry.js";
|
|
9
|
+
import { placeBoardOverlay } from "./overlay-placement.js";
|
|
21
10
|
import { boardScriptItems, hasBoardScripts } from "./script-index.js";
|
|
11
|
+
import { CORNER_RESIZE_HANDLES, CORNER_ROTATION_ZONE_WIDTH, EDGE_RESIZE_HANDLES, FIT_PADDING, HANDLE_DIRECTION, HANDLE_HIT_RADIUS, MAX_BOARD_ZOOM, MIN_BOARD_ZOOM, MIN_ITEM_SIZE, RESIZE_HANDLES, ROTATION_HANDLE_OFFSET, VIEWPORT_MARGIN_RATIO, angleFromCenter, cameraForFocus, cameraForRect, cameraForState, clamp, clampZoom, degToRad, expandRect, fitToContent, frameContainsPoint, frameCornerRotationHandleAt, frameCorners, frameEdgeHandleAt, frameHandlePosition, frameRayIntersection, frameRect, handlePosition, itemBounds, normalizeRotation, normalizeViewport, normalizedPoint, panBy, pointToWorld, pointsBounds, radToDeg, rectCenter, rectContainsPoint, rectForCameraFocus, rectsIntersect, resizeFrame, resizeFrameToSize, rotateFrames, rotatePointAround, rotationHandleAnchor, rotationHandlePosition, scaleFrames, screenOffset, screenPoint, screenToWorld, selectionBounds, stableCullRect, unionRects, visibleWorldRect, worldOffset, worldPoint, worldRect, worldToScreen, zoomAround } from "./geometry.js";
|
|
22
12
|
import { boardScriptScope, composeBoardScriptItems, prepareBoardScriptOutput, scriptTemporaryPrefix, validateBoardScriptCommit, validateBoardScriptOutput } from "./script-scene.js";
|
|
23
13
|
import { boardScriptHitVisible, boardScriptTarget, resolveBoardScriptHit } from "./script-hit.js";
|
|
24
|
-
import { boardImageKeySource, imageAssetKey } from "./image-key.js";
|
|
25
|
-
import { placeBoardOverlay } from "./overlay-placement.js";
|
|
26
14
|
import { BOARD_SCRIPT_API } from "./script-api.js";
|
|
27
15
|
import { BOARD_SCRIPT_DRAWING_EXAMPLE } from "./script-example.js";
|
|
16
|
+
import { applyBoardEvaluation, boardAnimationTime, boardDocumentAt, boardEase, compileBoardAnimations, evaluateBoardAnimations, parseHexColor, sampleBoardTrack } from "./animation.js";
|
|
17
|
+
import { buildBoardScene, orderBoardItems, placeItem, refreshBoardScene, sceneItemToItem, sceneItemsToRecord, toSceneItem } from "./scene.js";
|
|
18
|
+
import { createBoardAnimationSampler, resolveBoardAnimationCamera } from "./sampling.js";
|
|
28
19
|
import { boardPathTrack, boardSequence, boardSequencePatch } from "./authoring.js";
|
|
29
20
|
import { BOARD_PRESET_NAMES, boardNestedAnimation, boardNestedAnimationTrack, boardPresetTracks, isBoardPresetName, listBoardPresets } from "./presets.js";
|
|
21
|
+
import { ARROW_BINDING_GAP, arrowHitRadius, arrowPathBounds, distanceToArrow, pathMidpoint, pathPointAt, resolveAnchor, resolveArrow, resolveSceneArrow } from "./arrow-geometry.js";
|
|
22
|
+
import { buildStrokeOutline, buildStrokeRibbonGeometry, computeDrawBounds, createStrokeRibbonBuilder, distanceToStroke, isStrokeCorner, sampleRadius, simplifyDrawIndices, trimDrawPoints } from "./draw-geometry.js";
|
|
30
23
|
import { appendBoardDrawSamples, quantizeDrawCoordinate } from "./draw-input.js";
|
|
31
24
|
import { BOARD_EXPORT_MAX_TEXTURES, selectBoardExportAssets } from "./export-assets.js";
|
|
25
|
+
import { BOARD_EXPORT_DEFAULT_PADDING, BOARD_EXPORT_DEFAULT_SCALE, BOARD_EXPORT_ITEM_WARN_THRESHOLD, BOARD_EXPORT_MAX_EDGE, BOARD_EXPORT_MAX_PIXELS, exportItemBounds, normalizeBoardDocument, planBoardExport } from "./export-plan.js";
|
|
26
|
+
import { boardModelFormat, getMediaExtension, getMediaResourceTitle, inferBoardMediaKind, isBoardModelItem } from "./media.js";
|
|
27
|
+
import { FILE_EXCERPT_MAX_BYTES, FILE_EXCERPT_MAX_CHARS, buildCodeExcerpt, buildFileExcerpt, buildFileSnapshot, fileBaseName, fileCategory, fileStem, readCoverFromFrontmatter, readFrontmatterScalars, readTitleFromFrontmatter, resolveCoverRef, resolveFileTitle, resolveSpacePath, shouldFetchFileExcerpt, splitFrontmatter } from "./file-snapshot.js";
|
|
28
|
+
import { availabilityFromError, fileCategoryAccent, fileMetaLine, filePreviewKind, filePreviewMemoKey, filePreviewScope, fileTypeLabel, formatFileSize, isFileSnapshotFresh, mergeFileSnapshot } from "./file-preview.js";
|
|
29
|
+
import { BOARD_COLORS, DEFAULT_BOARD_COLOR, boardColorCssVar, buildFallbackShapeColors, isBoardColorId, pickBoardColor, resolveBoardColor, resolveItemColor } from "./palette.js";
|
|
32
30
|
import { SHAPE_KINDS, isShapeKind } from "./shape-types.js";
|
|
31
|
+
import { TEXT_FONT_FAMILY, TEXT_FONT_SIZE, TEXT_LINE_HEIGHT, TEXT_MAX_FONT_SIZE, TEXT_MIN_FONT_SIZE, boardFontFamily } from "./text-metrics.js";
|
|
33
32
|
import { DEFAULT_BOARD_TOOL_STYLES, createBoardToolStyles } from "./tool-styles.js";
|
|
33
|
+
import { boardImageKeySource, imageAssetKey } from "./image-key.js";
|
|
34
34
|
import { FULL_CAPABILITIES, defineBoardItem } from "./items/definition.js";
|
|
35
35
|
import { builtinBoardItems } from "./items/builtin.js";
|
|
36
36
|
import { createBoardEntityId, createBoardItemId } from "./items/id.js";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { BoardMediaOriginSchema, parseBoardItem } from "../../../protocol/dist/board-model.js";
|
|
2
2
|
import { pointsRect } from "../../../protocol/dist/board-layout.js";
|
|
3
3
|
import { featuredTaskArtifact } from "../../../protocol/dist/board-task.js";
|
|
4
|
+
import { quantizeDrawCoordinate } from "../draw-input.js";
|
|
4
5
|
import { boardModelFormat, getMediaResourceTitle, inferBoardMediaKind } from "../media.js";
|
|
5
6
|
import { fileStem } from "../file-snapshot.js";
|
|
6
7
|
import { filePreviewKind } from "../file-preview.js";
|
|
7
|
-
import { quantizeDrawCoordinate } from "../draw-input.js";
|
|
8
8
|
import { DEFAULT_BOARD_TOOL_STYLES } from "../tool-styles.js";
|
|
9
9
|
import { createBoardItemId } from "./id.js";
|
|
10
10
|
//#region src/board/model/items/create.ts
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { arrowBindings } from "../../protocol/dist/board-layout.js";
|
|
2
|
+
import { cameraForFocus, cameraForState } from "./geometry.js";
|
|
2
3
|
import { applyBoardEvaluation, boardAnimationTime, compileBoardAnimations, evaluateBoardAnimations } from "./animation.js";
|
|
3
4
|
import { buildBoardScene } from "./scene.js";
|
|
4
|
-
import { cameraForFocus, cameraForState } from "./geometry.js";
|
|
5
5
|
//#region src/board/model/sampling.ts
|
|
6
6
|
function createBoardAnimationSampler(document, animation, options = {}) {
|
|
7
7
|
const selected = animation ? document.animations[animation] : void 0;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { featuredTaskArtifact } from "../../protocol/dist/board-task.js";
|
|
2
2
|
import { degToRad, rotatePointAround, worldPoint } from "../model/geometry.js";
|
|
3
|
-
import { boardCardDetailed } from "./text-resolution.js";
|
|
4
3
|
import { isBoardModelItem } from "../model/media.js";
|
|
4
|
+
import { boardCardDetailed } from "./text-resolution.js";
|
|
5
5
|
import { audioKeyCenter } from "./renderers/audio-card-renderer.js";
|
|
6
6
|
import { modelKeyCenter } from "./renderers/model-card-renderer.js";
|
|
7
7
|
//#region src/board/render/media-interaction.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BOARD_FONT_STACK } from "../../../protocol/dist/board-constants.js";
|
|
2
|
-
import { itemAlpha, itemColor } from "../palette.js";
|
|
3
2
|
import { pathPointAt, resolveSceneArrow } from "../../model/arrow-geometry.js";
|
|
3
|
+
import { itemAlpha, itemColor } from "../palette.js";
|
|
4
4
|
import { syncTextResolution, textResolutionForZoom } from "../text-resolution.js";
|
|
5
5
|
import { dashPattern, endAngle, traceArrowhead, tracePolyline, trimPolyline } from "../stroke.js";
|
|
6
6
|
import { drawCardSurface } from "../surface.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { getMediaResourceTitle } from "../../model/media.js";
|
|
1
2
|
import { fitTextToWidth } from "../text-fit.js";
|
|
2
3
|
import { boardCardDetailed, syncTextResolution, textResolutionForZoom } from "../text-resolution.js";
|
|
3
4
|
import { formatBoardDuration } from "../card-tag.js";
|
|
4
|
-
import { getMediaResourceTitle } from "../../model/media.js";
|
|
5
5
|
import { drawAudioWaveform } from "../audio-waveform.js";
|
|
6
6
|
import { cardElevation, drawCardSurface } from "../surface.js";
|
|
7
7
|
import { positionShell } from "./base-card-renderer.js";
|
|
@@ -2,13 +2,10 @@ import { BOARD_FONT_STACK } from "../../../protocol/dist/board-constants.js";
|
|
|
2
2
|
import { getBoardResolution } from "../text-resolution.js";
|
|
3
3
|
import { Text } from "pixi.js";
|
|
4
4
|
//#region src/board/render/renderers/base-card-renderer.ts
|
|
5
|
-
const TEXT_OPTIONS = {
|
|
6
|
-
resolution: getBoardResolution(),
|
|
7
|
-
roundPixels: true
|
|
8
|
-
};
|
|
9
5
|
function createLabel(text, style) {
|
|
10
6
|
return new Text({
|
|
11
|
-
|
|
7
|
+
resolution: getBoardResolution(),
|
|
8
|
+
roundPixels: true,
|
|
12
9
|
text,
|
|
13
10
|
style: {
|
|
14
11
|
fontFamily: BOARD_FONT_STACK,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BOARD_MONO_FONT_STACK } from "../../../protocol/dist/board-constants.js";
|
|
2
|
-
import { getBoardResolution } from "../text-resolution.js";
|
|
2
|
+
import { getBoardResolution, syncTextResolution } from "../text-resolution.js";
|
|
3
3
|
import { positionShell } from "./base-card-renderer.js";
|
|
4
4
|
import { drawFarPlate } from "./far-plate.js";
|
|
5
5
|
import { Container, Graphics, Sprite, Text, Texture } from "pixi.js";
|
|
@@ -13,6 +13,7 @@ function sync(container, item, context) {
|
|
|
13
13
|
parts.id = item.id;
|
|
14
14
|
}
|
|
15
15
|
positionShell(parts.root, item);
|
|
16
|
+
syncTextResolution(parts.label, parts.label, context.zoom);
|
|
16
17
|
const { width, height } = item.frame;
|
|
17
18
|
const resolution = Math.min(4, Math.max(.25, context.zoom * getBoardResolution()));
|
|
18
19
|
const texture = context.scripts?.frame(item, context.time, resolution) ?? null;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { applyMatrix } from "../../../protocol/dist/board-layout.js";
|
|
2
|
+
import { computeDrawBounds, createStrokeRibbonBuilder, trimDrawPoints } from "../../model/draw-geometry.js";
|
|
2
3
|
import { itemAlpha, itemColor } from "../palette.js";
|
|
3
4
|
import { positionShell } from "./base-card-renderer.js";
|
|
4
5
|
import { drawFarStroke, farStrokeSamples } from "./far-plate.js";
|
|
5
|
-
import { computeDrawBounds, createStrokeRibbonBuilder, trimDrawPoints } from "../../model/draw-geometry.js";
|
|
6
6
|
import { Container, Graphics, Mesh, MeshGeometry, Texture } from "pixi.js";
|
|
7
7
|
//#region src/board/render/renderers/draw-card-renderer.ts
|
|
8
8
|
const partsByContainer = /* @__PURE__ */ new WeakMap();
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { BOARD_FONT_STACK, BOARD_MONO_FONT_STACK } from "../../../protocol/dist/board-constants.js";
|
|
2
|
+
import { fileCategory, fileStem } from "../../model/file-snapshot.js";
|
|
3
|
+
import { fileCategoryAccent, fileMetaLine, filePreviewKind, fileTypeLabel } from "../../model/file-preview.js";
|
|
2
4
|
import { fitTextToLines } from "../text-fit.js";
|
|
3
5
|
import { boardCardDetailed, syncTextResolution } from "../text-resolution.js";
|
|
4
6
|
import { createCardTag, syncCardTag, zoomCardTag } from "../card-tag.js";
|
|
5
7
|
import { cardElevation, containRect, drawCardSurface, traceCardOutline } from "../surface.js";
|
|
6
8
|
import { positionShell } from "./base-card-renderer.js";
|
|
7
9
|
import { drawFarPlate } from "./far-plate.js";
|
|
8
|
-
import { fileCategory, fileStem } from "../../model/file-snapshot.js";
|
|
9
|
-
import { fileCategoryAccent, fileMetaLine, filePreviewKind, fileTypeLabel } from "../../model/file-preview.js";
|
|
10
10
|
import { Container, Graphics, Sprite, Text, Texture } from "pixi.js";
|
|
11
11
|
//#region src/board/render/renderers/file-card-renderer.ts
|
|
12
12
|
const PADDING = 10;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
import { isBoardModelItem } from "../../model/media.js";
|
|
2
|
+
import { fileStem } from "../../model/file-snapshot.js";
|
|
3
|
+
import { fileMetaLine } from "../../model/file-preview.js";
|
|
1
4
|
import { boardCardDetailed } from "../text-resolution.js";
|
|
2
5
|
import { createCardTag, syncCardTag, traceCube, zoomCardTag } from "../card-tag.js";
|
|
3
|
-
import { isBoardModelItem } from "../../model/media.js";
|
|
4
6
|
import { cardElevation, containRect, drawCardSurface } from "../surface.js";
|
|
5
7
|
import { positionShell } from "./base-card-renderer.js";
|
|
6
8
|
import { drawFarPlate } from "./far-plate.js";
|
|
7
9
|
import { drawModelKey } from "./media-key.js";
|
|
8
|
-
import { fileStem } from "../../model/file-snapshot.js";
|
|
9
|
-
import { fileMetaLine } from "../../model/file-preview.js";
|
|
10
10
|
import { Container, Graphics, Sprite, Texture } from "pixi.js";
|
|
11
11
|
//#region src/board/render/renderers/model-card-renderer.ts
|
|
12
12
|
const partsByContainer = /* @__PURE__ */ new WeakMap();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { layoutBoardText } from "../../../protocol/dist/board-layout.js";
|
|
2
|
-
import { itemAlpha, itemColor } from "../palette.js";
|
|
3
2
|
import { boardFontFamily } from "../../model/text-metrics.js";
|
|
3
|
+
import { itemAlpha, itemColor } from "../palette.js";
|
|
4
4
|
import { BOARD_FONT_STACKS } from "../text-measurement.js";
|
|
5
5
|
import { syncTextResolution, textResolutionForZoom } from "../text-resolution.js";
|
|
6
6
|
import { positionShell } from "./base-card-renderer.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { getMediaResourceTitle } from "../../model/media.js";
|
|
1
2
|
import { boardCardDetailed } from "../text-resolution.js";
|
|
2
3
|
import { createCardTag, formatBoardDuration, syncCardTag, zoomCardTag } from "../card-tag.js";
|
|
3
|
-
import { getMediaResourceTitle } from "../../model/media.js";
|
|
4
4
|
import { cardElevation, containRect, drawCardSurface, traceCardOutline } from "../surface.js";
|
|
5
5
|
import { positionShell } from "./base-card-renderer.js";
|
|
6
6
|
import { drawFarPlate } from "./far-plate.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { buildBoardScene } from "../model/scene.js";
|
|
2
1
|
import { composeBoardScriptItems } from "../model/script-scene.js";
|
|
2
|
+
import { buildBoardScene } from "../model/scene.js";
|
|
3
3
|
import { createBoardScriptHost } from "./script-host.js";
|
|
4
4
|
//#region src/board/render/script-export.ts
|
|
5
5
|
async function prepareBrowserBoardScripts(document, time, readModule, snapshots) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { BoardScriptTexture } from "./script-texture.js";
|
|
2
1
|
import { boardScriptItems } from "../model/script-index.js";
|
|
3
2
|
import { boardScriptScope } from "../model/script-scene.js";
|
|
4
3
|
import { boardScriptHitVisible, resolveBoardScriptHit } from "../model/script-hit.js";
|
|
4
|
+
import { BoardScriptTexture } from "./script-texture.js";
|
|
5
5
|
import { createBoardScriptModuleReader, loadBoardScriptSources } from "../../protocol/dist/board-script-modules.js";
|
|
6
6
|
import { boardScriptFrameSource } from "./script-sandbox.js";
|
|
7
7
|
//#region src/board/render/script-host.ts
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { Text } from "pixi.js";
|
|
2
2
|
//#region src/board/render/text-resolution.d.ts
|
|
3
|
-
declare function getBoardResolution(
|
|
3
|
+
declare function getBoardResolution(size?: {
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
}, devicePixelRatio?: number): number;
|
|
4
7
|
declare function textZoomBucket(zoom: number): number;
|
|
5
8
|
declare function boardCardDetailed(zoom: number): boolean;
|
|
6
9
|
/** Effective text resolution for a given camera zoom. */
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
//#region src/board/render/text-resolution.ts
|
|
2
|
-
const MAX_BOARD_RESOLUTION =
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
const MAX_BOARD_RESOLUTION = 3;
|
|
3
|
+
const MAX_BOARD_PIXELS = 8e6;
|
|
4
|
+
const MAX_TEXT_RESOLUTION = 6;
|
|
5
|
+
function getBoardResolution(size, devicePixelRatio = globalThis.devicePixelRatio) {
|
|
6
|
+
const density = Number.isFinite(devicePixelRatio) && devicePixelRatio > 0 ? devicePixelRatio : 1;
|
|
7
|
+
const pixels = size ? size.width * size.height : 0;
|
|
8
|
+
const budget = pixels > 0 ? Math.sqrt(MAX_BOARD_PIXELS / pixels) : MAX_BOARD_RESOLUTION;
|
|
9
|
+
return Math.min(density, MAX_BOARD_RESOLUTION, budget);
|
|
5
10
|
}
|
|
6
11
|
/**
|
|
7
12
|
* Zoom buckets for text re-rasterisation. Pixi Text is a bitmap: at high zoom it
|
|
@@ -27,12 +32,12 @@ function boardCardDetailed(zoom) {
|
|
|
27
32
|
/** Effective text resolution for a given camera zoom. */
|
|
28
33
|
function textResolutionForZoom(zoom) {
|
|
29
34
|
const bucket = textZoomBucket(zoom);
|
|
30
|
-
return Math.min(getBoardResolution() * Math.max(1, bucket),
|
|
35
|
+
return Math.min(getBoardResolution() * Math.max(1, bucket), MAX_TEXT_RESOLUTION);
|
|
31
36
|
}
|
|
32
37
|
/** Update a Pixi text texture only when zoom crosses a resolution bucket. */
|
|
33
38
|
function syncTextResolution(text, state, zoom) {
|
|
34
39
|
const resolution = textResolutionForZoom(zoom);
|
|
35
|
-
if (resolution === state.resolution) return;
|
|
40
|
+
if (resolution === state.resolution && resolution === text.resolution) return;
|
|
36
41
|
text.resolution = resolution;
|
|
37
42
|
state.resolution = resolution;
|
|
38
43
|
}
|
|
@@ -2,8 +2,8 @@ import { mediaPreviewCandidates } from "../../media.js";
|
|
|
2
2
|
import { parseBoardMediaSource } from "../../protocol/dist/board-model.js";
|
|
3
3
|
import { featuredTaskArtifact } from "../../protocol/dist/board-task.js";
|
|
4
4
|
import { boardModelFormat, isBoardModelItem } from "../model/media.js";
|
|
5
|
-
import { loadVideoThumbnailTexture, videoTextureNaturalSize } from "../render/video-thumbnail.js";
|
|
6
5
|
import { boardImageKeySource, imageAssetKey } from "../model/image-key.js";
|
|
6
|
+
import { loadVideoThumbnailTexture, videoTextureNaturalSize } from "../render/video-thumbnail.js";
|
|
7
7
|
import { DEFAULT_LRU_BUDGET, selectLruEvictions } from "./lru.js";
|
|
8
8
|
import { boardImageTexturePool, loadBoardImageTexture, unloadBoardImageTexture } from "./texture-pool.js";
|
|
9
9
|
import { Texture } from "pixi.js";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
//#region src/board/stage/display-density.ts
|
|
2
|
+
function observeDisplayDensity(window, onChange) {
|
|
3
|
+
let query;
|
|
4
|
+
let density = window.devicePixelRatio || 1;
|
|
5
|
+
function watch() {
|
|
6
|
+
query = window.matchMedia(`(resolution: ${density}dppx)`);
|
|
7
|
+
query.addEventListener("change", changed);
|
|
8
|
+
}
|
|
9
|
+
function changed() {
|
|
10
|
+
const next = window.devicePixelRatio || 1;
|
|
11
|
+
if (density === next) return;
|
|
12
|
+
density = next;
|
|
13
|
+
query.removeEventListener("change", changed);
|
|
14
|
+
watch();
|
|
15
|
+
onChange();
|
|
16
|
+
}
|
|
17
|
+
watch();
|
|
18
|
+
window.addEventListener("resize", changed);
|
|
19
|
+
return () => {
|
|
20
|
+
query.removeEventListener("change", changed);
|
|
21
|
+
window.removeEventListener("resize", changed);
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { observeDisplayDensity };
|
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
import { applyMatrix, invertMatrix } from "../../protocol/dist/board-layout.js";
|
|
2
2
|
import { featuredTaskArtifact } from "../../protocol/dist/board-task.js";
|
|
3
3
|
import { screenPoint, screenToWorld, stableCullRect, visibleWorldRect, worldPoint } from "../model/geometry.js";
|
|
4
|
+
import { boardScriptScope, composeBoardScriptItems, prepareBoardScriptOutput, validateBoardScriptCommit } from "../model/script-scene.js";
|
|
5
|
+
import { boardScriptTarget } from "../model/script-hit.js";
|
|
4
6
|
import { createBoardAnimationSampler, resolveBoardAnimationCamera } from "../model/sampling.js";
|
|
7
|
+
import { resolveSceneArrow } from "../model/arrow-geometry.js";
|
|
5
8
|
import { buildFallbackShapeColors, pickBoardColor, resolveItemColor } from "../model/palette.js";
|
|
9
|
+
import { isCreationBoardTool } from "../editor/tool.js";
|
|
10
|
+
import { resizeCursorForHandle } from "../editor/selection-transform.js";
|
|
6
11
|
import { parseBoardCssColor } from "../render/css-color.js";
|
|
7
12
|
import { defaultBoardPalette, itemAlpha } from "../render/palette.js";
|
|
8
|
-
import { resolveSceneArrow } from "../model/arrow-geometry.js";
|
|
9
13
|
import { createBoardBackground, updateBoardBackground } from "../render/board-background.js";
|
|
10
14
|
import { getBoardResolution, textZoomBucket } from "../render/text-resolution.js";
|
|
11
15
|
import { DEFAULT_BOARD_RENDER_LABELS, getBoardCardRenderer } from "../render/renderers/board-renderer-registry.js";
|
|
12
|
-
import { boardScriptScope, composeBoardScriptItems, prepareBoardScriptOutput, validateBoardScriptCommit } from "../model/script-scene.js";
|
|
13
|
-
import { boardScriptTarget } from "../model/script-hit.js";
|
|
14
16
|
import { createBoardScriptHost } from "../render/script-host.js";
|
|
15
17
|
import { defaultBoardRenderStyle } from "../render/style.js";
|
|
16
|
-
import { isCreationBoardTool } from "../editor/tool.js";
|
|
17
|
-
import { resizeCursorForHandle } from "../editor/selection-transform.js";
|
|
18
|
-
import { createBoardPlayer } from "../player/index.js";
|
|
19
18
|
import { createBoardScriptObservers } from "../model/script-observers.js";
|
|
19
|
+
import { createBoardPlayer } from "../player/index.js";
|
|
20
|
+
import { observeDisplayDensity } from "./display-density.js";
|
|
20
21
|
import { toBoardPointerEvent } from "./pointer.js";
|
|
21
22
|
import { createBoardPointerGestures } from "./pointer-gestures.js";
|
|
22
23
|
import { createBoardScene } from "./scene.js";
|
|
@@ -96,6 +97,7 @@ function mountBoardStage(host, options) {
|
|
|
96
97
|
let scriptHover = null;
|
|
97
98
|
const scriptPointers = createBoardScriptPointerRouter();
|
|
98
99
|
let stopMaintenance = null;
|
|
100
|
+
let stopDensity = null;
|
|
99
101
|
let active = true;
|
|
100
102
|
let disposed = false;
|
|
101
103
|
let renderFrame = 0;
|
|
@@ -595,7 +597,8 @@ function mountBoardStage(host, options) {
|
|
|
595
597
|
assetVersion,
|
|
596
598
|
cardEpoch,
|
|
597
599
|
current.key,
|
|
598
|
-
textZoomBucket(camera.zoom)
|
|
600
|
+
textZoomBucket(camera.zoom),
|
|
601
|
+
getBoardResolution()
|
|
599
602
|
].join("|"),
|
|
600
603
|
staleIds,
|
|
601
604
|
structureVersion: editor.structureVersion,
|
|
@@ -621,14 +624,20 @@ function mountBoardStage(host, options) {
|
|
|
621
624
|
function resize() {
|
|
622
625
|
cancelAnimationFrame(resizeFrame);
|
|
623
626
|
resizeFrame = requestAnimationFrame(() => {
|
|
624
|
-
if (!app) return;
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
height: app.screen.height
|
|
627
|
+
if (!app || !active) return;
|
|
628
|
+
const size = {
|
|
629
|
+
width: host.clientWidth,
|
|
630
|
+
height: host.clientHeight
|
|
629
631
|
};
|
|
630
|
-
|
|
631
|
-
|
|
632
|
+
if (size.width <= 0 || size.height <= 0) return;
|
|
633
|
+
const resolution = getBoardResolution(size);
|
|
634
|
+
const sizeChanged = size.width !== surface.width || size.height !== surface.height;
|
|
635
|
+
if (sizeChanged || app.renderer.resolution !== resolution) app.renderer.resize(size.width, size.height, resolution);
|
|
636
|
+
if (sizeChanged) {
|
|
637
|
+
surface = size;
|
|
638
|
+
editor.surfaceSize = surface;
|
|
639
|
+
options.onSurfaceChange?.(surface);
|
|
640
|
+
}
|
|
632
641
|
sync();
|
|
633
642
|
});
|
|
634
643
|
}
|
|
@@ -788,8 +797,12 @@ function mountBoardStage(host, options) {
|
|
|
788
797
|
antialias: true,
|
|
789
798
|
autoDensity: true,
|
|
790
799
|
backgroundAlpha: 0,
|
|
791
|
-
|
|
792
|
-
|
|
800
|
+
width: host.clientWidth,
|
|
801
|
+
height: host.clientHeight,
|
|
802
|
+
resolution: getBoardResolution({
|
|
803
|
+
width: host.clientWidth,
|
|
804
|
+
height: host.clientHeight
|
|
805
|
+
}),
|
|
793
806
|
autoStart: false
|
|
794
807
|
});
|
|
795
808
|
} catch (error) {
|
|
@@ -829,6 +842,8 @@ function mountBoardStage(host, options) {
|
|
|
829
842
|
});
|
|
830
843
|
for (const [type, listener, listenerOptions] of listeners) host.addEventListener(type, listener, listenerOptions);
|
|
831
844
|
resizeObserver.observe(host);
|
|
845
|
+
const window = host.ownerDocument.defaultView;
|
|
846
|
+
if (window) stopDensity = observeDisplayDensity(window, resize);
|
|
832
847
|
resize();
|
|
833
848
|
return true;
|
|
834
849
|
})(),
|
|
@@ -914,6 +929,7 @@ function mountBoardStage(host, options) {
|
|
|
914
929
|
scriptObservers.clear();
|
|
915
930
|
scriptListeners.clear();
|
|
916
931
|
stopMaintenance?.();
|
|
932
|
+
stopDensity?.();
|
|
917
933
|
stopEditor();
|
|
918
934
|
stopAssets();
|
|
919
935
|
resizeObserver.disconnect();
|