m0saic 0.3.0 → 0.3.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/browseE2e.js +1 -1
- package/dist/connectionsFromEnv.js +1 -1
- package/dist/e2eTemplateVariants.js +1 -1
- package/dist/frontDoor.js +1 -1
- package/dist/index.js +1 -1
- package/dist/inlineDsl.js +1 -1
- package/dist/mcp/bridgeClient.js +1 -1
- package/dist/mcp/server.js +1 -1
- package/dist/mcp/tools.js +1 -1
- package/dist/mosaicxRunner.js +1 -1
- package/dist/outputPattern.js +1 -1
- package/dist/showcaseFeed.js +1 -1
- package/dist/templateDoctor.js +1 -1
- package/dist/utils/checkFeasibility.js +1 -1
- package/dist/utils/collectRenderErrors.js +1 -1
- package/dist/utils/enrichImageAlphaFromDoc.js +1 -1
- package/dist/utils/ensureFfmpeg.js +1 -1
- package/dist/utils/extractLayoutMeta.js +1 -1
- package/dist/utils/failureHints.js +1 -1
- package/dist/utils/ffmpegProbe.js +1 -1
- package/dist/utils/formatM0saicForCli.js +1 -1
- package/dist/utils/hashFile.js +1 -1
- package/dist/utils/helpGroups.js +1 -1
- package/dist/utils/installContext.js +1 -1
- package/dist/utils/invocation.js +1 -1
- package/dist/utils/licenseActivation.js +1 -1
- package/dist/utils/licenseActivationWorker.js +1 -1
- package/dist/utils/mosaicSpinner.js +1 -1
- package/dist/utils/parseDimensions.js +1 -1
- package/dist/utils/pathInfo.js +1 -1
- package/dist/utils/readJsonArg.js +1 -1
- package/dist/utils/renderOutcome.js +1 -1
- package/dist/utils/renderReport.js +1 -1
- package/dist/utils/renderSignals.js +1 -1
- package/dist/utils/renderWorkspace.js +1 -1
- package/dist/utils/reportOutputFormat.js +1 -1
- package/dist/utils/setupFfmpeg.js +1 -1
- package/dist/utils/telemetry.js +1 -1
- package/dist/utils/telemetryFlushWorker.js +1 -1
- package/dist/utils/telemetryUpstream.js +1 -1
- package/dist/utils/telemetryUsage.js +1 -1
- package/dist/utils/toolchainConfig.js +1 -1
- package/dist/utils/tutorialDuration.js +1 -1
- package/dist/utils/updateCheck.js +1 -1
- package/dist/utils/updateCheckWorker.js +1 -1
- package/dist/utils/validateSourceCounts.js +1 -1
- package/dist/utils/versions.js +1 -1
- package/dist/webCustomizeLink.js +1 -1
- package/node_modules/@m0saic/community-m/release.json +2 -2
- package/node_modules/@m0saic/core/dist/core/buildChildMosaicSource.js +1 -1
- package/node_modules/@m0saic/core/dist/core/buildChunkCommands.js +1 -1
- package/node_modules/@m0saic/core/dist/core/buildEncodeCommands.js +1 -1
- package/node_modules/@m0saic/core/dist/core/buildLavfiSource.js +1 -1
- package/node_modules/@m0saic/core/dist/core/buildMediaSource.js +1 -1
- package/node_modules/@m0saic/core/dist/core/buildMosaicNode.js +1 -1
- package/node_modules/@m0saic/core/dist/core/buildMosaicPlanFromFile.js +1 -1
- package/node_modules/@m0saic/core/dist/core/buildSvgTextSource.js +1 -1
- package/node_modules/@m0saic/core/dist/core/buildTextRenderCommand.js +1 -1
- package/node_modules/@m0saic/core/dist/core/collectRefTargets.js +1 -1
- package/node_modules/@m0saic/core/dist/core/index.js +1 -1
- package/node_modules/@m0saic/core/dist/core/maskCacheDir.js +1 -1
- package/node_modules/@m0saic/core/dist/core/maskWorkerBridge.js +1 -1
- package/node_modules/@m0saic/core/dist/core/playbackPlaySpeed.js +1 -1
- package/node_modules/@m0saic/core/dist/core/prepareProps.js +1 -1
- package/node_modules/@m0saic/core/dist/core/primaryOutput.js +1 -1
- package/node_modules/@m0saic/core/dist/core/rasterizeMaskPng.js +1 -1
- package/node_modules/@m0saic/core/dist/core/rasterizeSvgMediaPng.js +1 -1
- package/node_modules/@m0saic/core/dist/core/refTargetTap.js +1 -1
- package/node_modules/@m0saic/core/dist/core/resolveMasks.js +1 -1
- package/node_modules/@m0saic/core/dist/core/resolveMasksSync.js +1 -1
- package/node_modules/@m0saic/core/dist/core/resolveStrokeRingsSync.js +1 -1
- package/node_modules/@m0saic/core/dist/core/roundedRectMask.js +1 -1
- package/node_modules/@m0saic/core/dist/core/strokeRing.js +1 -1
- package/node_modules/@m0saic/core/dist/core/svgRaster.js +1 -1
- package/node_modules/@m0saic/core/dist/defaults.js +1 -1
- package/node_modules/@m0saic/core/dist/ffmpeg/backgroundImageInput.js +1 -1
- package/node_modules/@m0saic/core/dist/ffmpeg/bufferGuard.js +1 -1
- package/node_modules/@m0saic/core/dist/ffmpeg/ffmpegCommands.js +1 -1
- package/node_modules/@m0saic/core/dist/ffmpeg/filters/applyBackdropBlur.js +1 -1
- package/node_modules/@m0saic/core/dist/ffmpeg/filters/applyBlur.js +1 -1
- package/node_modules/@m0saic/core/dist/ffmpeg/filters/applyBorderRadius.js +1 -1
- package/node_modules/@m0saic/core/dist/ffmpeg/filters/applyCamera.js +1 -1
- package/node_modules/@m0saic/core/dist/ffmpeg/filters/applyChromaKey.js +1 -1
- package/node_modules/@m0saic/core/dist/ffmpeg/filters/applyFade.js +1 -1
- package/node_modules/@m0saic/core/dist/ffmpeg/filters/applyGrade.js +1 -1
- package/node_modules/@m0saic/core/dist/ffmpeg/filters/applyMask.js +1 -1
- package/node_modules/@m0saic/core/dist/ffmpeg/filters/applyNoise.js +1 -1
- package/node_modules/@m0saic/core/dist/ffmpeg/filters/applyPixelize.js +1 -1
- package/node_modules/@m0saic/core/dist/ffmpeg/filters/applyRotate.js +1 -1
- package/node_modules/@m0saic/core/dist/ffmpeg/filters/applyStroke.js +1 -1
- package/node_modules/@m0saic/core/dist/ffmpeg/filters/applyTileEffects.js +1 -1
- package/node_modules/@m0saic/core/dist/ffmpeg/filters/coverCrop.js +1 -1
- package/node_modules/@m0saic/core/dist/ffmpeg/filters/index.js +1 -1
- package/node_modules/@m0saic/core/dist/ffmpeg/filters/sourceRectCrop.js +1 -1
- package/node_modules/@m0saic/core/dist/ffmpeg/gridLowering.js +1 -1
- package/node_modules/@m0saic/core/dist/ffmpeg/index.js +1 -1
- package/node_modules/@m0saic/core/dist/ffmpeg/splitAvMux.js +1 -1
- package/node_modules/@m0saic/core/dist/ffmpeg/threadGuard.js +1 -1
- package/node_modules/@m0saic/core/dist/flatten/index.js +1 -1
- package/node_modules/@m0saic/core/dist/fs/index.js +1 -1
- package/node_modules/@m0saic/core/dist/fs/tempWorkspace.js +1 -1
- package/node_modules/@m0saic/core/dist/index.js +1 -1
- package/node_modules/@m0saic/core/dist/media/buildAssetManifestFromInputs.js +1 -1
- package/node_modules/@m0saic/core/dist/media/buildMediaRegistryFromInput.js +1 -1
- package/node_modules/@m0saic/core/dist/media/collectMediaInputsFromInvocationProps.js +1 -1
- package/node_modules/@m0saic/core/dist/media/collectMediaInputsFromMosaicRenderableFile.js +1 -1
- package/node_modules/@m0saic/core/dist/media/collectMediaInputsFromProps.js +1 -1
- package/node_modules/@m0saic/core/dist/media/index.js +1 -1
- package/node_modules/@m0saic/core/dist/media/internalMintAsset.js +1 -1
- package/node_modules/@m0saic/core/dist/media/remoteUrl.js +1 -1
- package/node_modules/@m0saic/core/dist/media/stageUnsafeFilenames.js +1 -1
- package/node_modules/@m0saic/core/dist/media/types.js +1 -1
- package/node_modules/@m0saic/core/dist/output/index.js +1 -1
- package/node_modules/@m0saic/core/dist/output/resolveOutputFormat.js +1 -1
- package/node_modules/@m0saic/core/dist/output/types.js +1 -1
- package/node_modules/@m0saic/core/dist/probe/cellLuminanceProbe.js +1 -1
- package/node_modules/@m0saic/core/dist/probe/extractSubtitleCues.js +1 -1
- package/node_modules/@m0saic/core/dist/probe/helpers.js +1 -1
- package/node_modules/@m0saic/core/dist/probe/index.js +1 -1
- package/node_modules/@m0saic/core/dist/probe/luminanceProbe.js +1 -1
- package/node_modules/@m0saic/core/dist/probe/probeMedia.js +1 -1
- package/node_modules/@m0saic/core/dist/probe/runFFprobe.js +1 -1
- package/node_modules/@m0saic/core/dist/probe/types.js +1 -1
- package/node_modules/@m0saic/core/dist/runtime/engineRedaction.js +1 -1
- package/node_modules/@m0saic/core/dist/runtime/ffmpegFailure.js +1 -1
- package/node_modules/@m0saic/core/dist/runtime/filterPreflight.js +1 -1
- package/node_modules/@m0saic/core/dist/runtime/hashFile.js +1 -1
- package/node_modules/@m0saic/core/dist/runtime/index.js +1 -1
- package/node_modules/@m0saic/core/dist/runtime/pathInfo.js +1 -1
- package/node_modules/@m0saic/core/dist/runtime/perfHeatmap.js +1 -1
- package/node_modules/@m0saic/core/dist/runtime/perfReport.js +1 -1
- package/node_modules/@m0saic/core/dist/runtime/pipelineM0p.js +1 -1
- package/node_modules/@m0saic/core/dist/runtime/renderCostModel.constants.js +1 -1
- package/node_modules/@m0saic/core/dist/runtime/renderCostModel.js +1 -1
- package/node_modules/@m0saic/core/dist/runtime/renderReport.js +1 -1
- package/node_modules/@m0saic/core/dist/runtime/renderSidecars.js +1 -1
- package/node_modules/@m0saic/core/dist/runtime/resolveMosaicx.js +1 -1
- package/node_modules/@m0saic/core/dist/runtime/runPlan.js +1 -1
- package/node_modules/@m0saic/core/dist/runtime/types.js +1 -1
- package/node_modules/@m0saic/core/dist/runtime/upstream.js +1 -1
- package/node_modules/@m0saic/core/dist/runtime/writeSidecars.js +1 -1
- package/node_modules/@m0saic/core/dist/types/chunk.js +1 -1
- package/node_modules/@m0saic/core/dist/types/index.js +1 -1
- package/node_modules/@m0saic/core/dist/types/mosaic-plan.js +1 -1
- package/node_modules/@m0saic/core/dist/utils/assertTiming.js +1 -1
- package/node_modules/@m0saic/core/dist/utils/command.js +1 -1
- package/node_modules/@m0saic/core/dist/utils/createEngineContext.js +1 -1
- package/node_modules/@m0saic/core/dist/utils/createTemplateRenderCache.js +1 -1
- package/node_modules/@m0saic/core/dist/utils/ffmpegColor.js +1 -1
- package/node_modules/@m0saic/core/dist/utils/formatDuration.js +1 -1
- package/node_modules/@m0saic/core/dist/utils/fsSafeId.js +1 -1
- package/node_modules/@m0saic/core/dist/utils/index.js +1 -1
- package/node_modules/@m0saic/core/dist/utils/lowerRenderableToMosaicDocument.js +1 -1
- package/node_modules/@m0saic/core/dist/utils/movSafeCodec.js +1 -1
- package/node_modules/@m0saic/core/dist/utils/resolveBoxFrac.js +1 -1
- package/node_modules/@m0saic/core/dist/validate/index.js +1 -1
- package/node_modules/@m0saic/core/scripts/mask-rasterize-core.js +1 -1
- package/node_modules/@m0saic/core/scripts/mask-rasterize-worker.js +1 -1
- package/node_modules/@m0saic/core/scripts/mask-worker-thread.js +1 -1
- package/node_modules/@m0saic/dictionary/package.json +1 -1
- package/node_modules/@m0saic/knowledge/docs/runtime/README.md +8 -1
- package/node_modules/@m0saic/knowledge/docs/runtime/agent-at-the-canvas.md +108 -0
- package/node_modules/@m0saic/knowledge/docs/runtime/cli-usage.md +35 -7
- package/node_modules/@m0saic/knowledge/docs/templates/output-resolution-tree.md +8 -0
- package/node_modules/@m0saic/knowledge/docs/templates/reference/prop-bindings.md +24 -10
- package/node_modules/@m0saic/knowledge/docs/templates/reference/template-flags.md +18 -6
- package/node_modules/@m0saic/knowledge/docs/templates/standalone-pack-authoring.md +20 -10
- package/node_modules/@m0saic/knowledge/package.json +1 -1
- package/node_modules/@m0saic/platform/dist/cjs/index.js +1 -1
- package/node_modules/@m0saic/platform/dist/cjs/mosaic/propBindings/index.js +1 -1
- package/node_modules/@m0saic/platform/dist/cjs/mosaic/propBindings/propBindings.js +1 -1
- package/node_modules/@m0saic/platform/dist/cjs/template-repos/index.js +1 -1
- package/node_modules/@m0saic/platform/dist/cjs/template-repos/loadTemplateRepoFromPath.js +4 -4
- package/node_modules/@m0saic/platform/dist/cjs/template-repos/templateCatalogSidecars.js +2 -0
- package/node_modules/@m0saic/platform/dist/cjs/templateCatalog/index.js +1 -0
- package/node_modules/@m0saic/platform/dist/cjs/templateCatalog/templateCatalog.js +1 -0
- package/node_modules/@m0saic/platform/package.json +1 -1
- package/node_modules/@m0saic/product/dist/communityRelease.js +1 -1
- package/node_modules/@m0saic/product/dist/freeTierLicense.js +1 -1
- package/node_modules/@m0saic/product/dist/index.js +1 -1
- package/node_modules/@m0saic/product/dist/licenseActivationNotice.js +1 -1
- package/node_modules/@m0saic/product/dist/licenseFile.js +1 -1
- package/node_modules/@m0saic/product/dist/licenseToken.js +1 -1
- package/node_modules/@m0saic/product/dist/makeScratchPath.js +1 -1
- package/node_modules/@m0saic/product/dist/postRenderWrapper.js +1 -1
- package/node_modules/@m0saic/product/dist/publicKeys.js +1 -1
- package/node_modules/@m0saic/product/dist/revokedKeys.js +1 -1
- package/node_modules/@m0saic/product/dist/upstreamDefaults.js +1 -1
- package/node_modules/@m0saic/product/dist/workspaceScaffold.js +1 -1
- package/node_modules/@m0saic/template-utils/dist/brand/hello-world/helloWorld.js +1 -1
- package/node_modules/@m0saic/template-utils/dist/geometry-contract/frameResolution.js +1 -1
- package/node_modules/@m0saic/template-utils/dist/geometry-contract/layoutConstraint.js +1 -1
- package/node_modules/@m0saic/template-utils/dist/template/auditRenderedTemplate.js +5 -5
- package/node_modules/@m0saic/template-utils/dist/template/auditSchemaConventions.js +1 -1
- package/node_modules/@m0saic/template-utils/dist/template/defineMosaicTemplate.js +1 -1
- package/node_modules/@m0saic/template-utils/dist/template/resolveTemplateOutputHints.js +1 -1
- package/node_modules/@m0saic/template-utils/dist/template/templateCatalogStore.js +1 -0
- package/node_modules/@m0saic/template-utils/dist/template/templateConventions.js +4 -4
- package/node_modules/@m0saic/template-utils/dist/template/templateRegistry.js +3 -3
- package/node_modules/@m0saic/template-utils/package.json +1 -1
- package/node_modules/@m0saic/templates/dist/catalog.js +1 -0
- package/node_modules/@m0saic/templates/dist/freeze.js +8 -8
- package/node_modules/@m0saic/templates/dist/index.js +1 -1
- package/node_modules/@m0saic/templates/dist/m0saic/_shared/canvas-handles.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/_shared/stand-in.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/agents/commit-feed/index.js +1 -1
- package/node_modules/@m0saic/templates/dist/m0saic/agents/commit-feed/v2/commit-feed.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/agents/commit-feed/v2/index.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/agents/trace-timeline/index.js +1 -1
- package/node_modules/@m0saic/templates/dist/m0saic/agents/trace-timeline/v2/index.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/agents/trace-timeline/v2/trace-timeline.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/alpine/_shared/alpine-conventions.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/alpine/bar-graph/v2/bar-graph.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/alpine/bar-graph/v2/index.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/alpine/commit-feed/v3/commit-feed.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/alpine/commit-feed/v3/index.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/alpine/contributor-table/v2/contributor-table.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/alpine/contributor-table/v2/index.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/alpine/donut/v4/donut.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/alpine/donut/v4/index.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/alpine/heatmap/v3/heatmap.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/alpine/heatmap/v3/index.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/alpine/index.js +1 -1
- package/node_modules/@m0saic/templates/dist/m0saic/alpine/kpi-card/v3/index.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/alpine/kpi-card/v3/kpi-card.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/alpine/leaderboard/v2/index.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/alpine/leaderboard/v2/leaderboard.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/alpine/line-chart/v3/index.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/alpine/line-chart/v3/line-chart.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/alpine/progress-card/v2/index.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/alpine/progress-card/v2/progress-card.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/alpine/stat-card/v2/index.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/alpine/stat-card/v2/stat-card.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/alpine/timeline/v3/index.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/alpine/timeline/v3/timeline.js +4 -0
- package/node_modules/@m0saic/templates/dist/m0saic/alpine/treemap/v3/index.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/alpine/treemap/v3/treemap.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/benchmark/index.js +1 -1
- package/node_modules/@m0saic/templates/dist/m0saic/benchmark/report/v2/index.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/benchmark/report/v2/report.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/brand/business-card/v2/business-card.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/brand/business-card/v2/index.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/brand/index.js +1 -1
- package/node_modules/@m0saic/templates/dist/m0saic/brand/logo/v4/index.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/brand/logo/v4/logo_runner.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/charts/bar-graph/v3/bar-graph.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/charts/bar-graph/v3/index.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/charts/donut/v5/donut.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/charts/donut/v5/index.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/charts/index.js +1 -1
- package/node_modules/@m0saic/templates/dist/m0saic/charts/line-chart/v2/index.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/charts/line-chart/v2/line-chart.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/charts/stat-card/v2/index.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/charts/stat-card/v2/stat-card.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/code/index.js +1 -1
- package/node_modules/@m0saic/templates/dist/m0saic/code/snippet-morph/v2/snippet-morph.js +3 -0
- package/node_modules/@m0saic/templates/dist/m0saic/collage/image-collage/v2/image-collage.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/collage/image-collage/v2/index.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/collage/index.js +1 -1
- package/node_modules/@m0saic/templates/dist/m0saic/dsl-tutorial/index.js +1 -1
- package/node_modules/@m0saic/templates/dist/m0saic/dsl-tutorial/v2/dsl-tutorial.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/dsl-tutorial/v2/index.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/github/year-card/index.js +1 -1
- package/node_modules/@m0saic/templates/dist/m0saic/github/year-card/v2/index.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/github/year-card/v2/year-card.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/hero/ffmpeg-pulse/index.js +1 -1
- package/node_modules/@m0saic/templates/dist/m0saic/hero/ffmpeg-pulse/runner/v2/index.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/hero/ffmpeg-pulse/runner/v2/runner.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/media/barcode/v2/barcode.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/media/barcode/v2/index.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/media/blur-regions/index.js +1 -1
- package/node_modules/@m0saic/templates/dist/m0saic/media/blur-regions/v2/blur-regions.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/media/blur-regions/v2/index.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/media/highlights/index.js +1 -1
- package/node_modules/@m0saic/templates/dist/m0saic/media/highlights/v2/highlights.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/media/highlights/v2/index.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/media/index.js +1 -1
- package/node_modules/@m0saic/templates/dist/m0saic/media/logo-animate/index.js +1 -1
- package/node_modules/@m0saic/templates/dist/m0saic/media/logo-animate/v2/index.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/media/logo-animate/v2/logo-animate.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/media/metadata-stamp/index.js +1 -1
- package/node_modules/@m0saic/templates/dist/m0saic/media/metadata-stamp/v2/index.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/media/metadata-stamp/v2/metadata-stamp.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/media/qr/code/v2/index.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/media/qr/code/v2/qr-code.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/media/qr/index.js +1 -1
- package/node_modules/@m0saic/templates/dist/m0saic/media/qr/stamp/v2/qr-stamp-custom.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/media/screencap_grid/index.js +1 -1
- package/node_modules/@m0saic/templates/dist/m0saic/media/screencap_grid/v3/index.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/media/screencap_grid/v3/screencap-grid.js +4 -0
- package/node_modules/@m0saic/templates/dist/m0saic/media/screencap_grid_aspect_safe/index.js +1 -1
- package/node_modules/@m0saic/templates/dist/m0saic/media/screencap_grid_aspect_safe/v2/index.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/media/screencap_grid_aspect_safe/v2/screencap-grid-aspect-safe.js +3 -0
- package/node_modules/@m0saic/templates/dist/m0saic/media/scroll_wall/index.js +1 -1
- package/node_modules/@m0saic/templates/dist/m0saic/media/scroll_wall/v2/index.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/media/scroll_wall/v2/scroll-wall.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/media/subtitle-burn/index.js +1 -1
- package/node_modules/@m0saic/templates/dist/m0saic/media/subtitle-burn/v2/index.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/media/subtitle-burn/v2/subtitle-burn.js +4 -0
- package/node_modules/@m0saic/templates/dist/m0saic/media/trickplay/index.js +1 -1
- package/node_modules/@m0saic/templates/dist/m0saic/media/trickplay/v2/index.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/media/trickplay/v2/trickplay.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/media/video_to_png_sequence/index.js +1 -1
- package/node_modules/@m0saic/templates/dist/m0saic/media/video_to_png_sequence/v2/index.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/media/video_to_png_sequence/v2/video-to-png-sequence.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/media/watermark/index.js +1 -1
- package/node_modules/@m0saic/templates/dist/m0saic/media/watermark/v2/index.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/media/watermark/v2/watermark.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/primitives/grid/index.js +1 -1
- package/node_modules/@m0saic/templates/dist/m0saic/primitives/grid/v3/grid.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/social/quote-card/index.js +1 -1
- package/node_modules/@m0saic/templates/dist/m0saic/social/quote-card/v2/index.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/social/quote-card/v2/quote-card.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/story/index.js +1 -1
- package/node_modules/@m0saic/templates/dist/m0saic/story/narrated-chapters/index.js +1 -1
- package/node_modules/@m0saic/templates/dist/m0saic/story/narrated-chapters/v2/index.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/story/narrated-chapters/v2/narrated-chapters.js +4 -0
- package/node_modules/@m0saic/templates/dist/m0saic/story/scrapbook/v2/index.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/story/scrapbook/v2/props.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/story/scrapbook/v2/scrapbook.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/theming/index.js +1 -1
- package/node_modules/@m0saic/templates/dist/m0saic/theming/v2/index.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/theming/v2/theming.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/web/index.js +1 -1
- package/node_modules/@m0saic/templates/dist/m0saic/web/page-skeleton/v2/index.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/web/page-skeleton/v2/page-skeleton.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/wireframe/base/v3/index.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/wireframe/base/v3/wireframe.js +1 -0
- package/node_modules/@m0saic/templates/dist/m0saic/wireframe/index.js +1 -1
- package/node_modules/@m0saic/templates/dist/repo.js +1 -1
- package/node_modules/@m0saic/templates/dist/template-catalog.json +5429 -0
- package/node_modules/@m0saic/templates/dist/template-registry.js +1 -1
- package/node_modules/@m0saic/templates/dist/web.js +1 -1
- package/node_modules/@m0saic/templates/package.json +1 -1
- package/node_modules/@m0saic/templates/template-catalog.json +5429 -0
- package/node_modules/@m0saic/templates/template-manifest.json +1030 -286
- package/node_modules/@m0saic/templates/web-template-ids.json +38 -0
- package/node_modules/@m0saic/text/package.json +1 -1
- package/node_modules/@m0saic/types/dist/template/template.js +1 -1
- package/node_modules/@m0saic/types/package.json +1 -1
- package/node_modules/@m0saic/types-internal/dist/analytics/featureKeys.js +1 -1
- package/package.json +8 -8
- package/resources/starter-base/starter-base.json +5 -5
- package/resources/starter-base/starter-base.tgz +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var V=Object.defineProperty;var c=(e,n)=>V(e,"name",{value:n,configurable:!0});Object.defineProperty(exports,"__esModule",{value:!0}),exports.textEmUnits=textEmUnits,exports.fitEmUnits=fitEmUnits,exports.tag=tag,exports.bindProp=bindProp,exports.withBindingHint=withBindingHint,exports.bindPropRange=bindPropRange,exports.bindProps=bindProps,exports.stripPropBindings=stripPropBindings,exports.bindPropRect=bindPropRect,exports.bindPropPath=bindPropPath,exports.checkLayout=checkLayout;const platform_1=require("@m0saic/platform"),frameResolution_1=require("./frameResolution"),checkDocGeometry_1=require("./checkDocGeometry"),latticeRelations_1=require("./latticeRelations");function resolveInsetFrac(e){var n,i,t,r,l,a;if(e==null)return null;if(typeof e=="number")return e?{top:e,right:e,bottom:e,left:e}:null;if(typeof e!="object")return null;const f=e,F=(n=f.x)!==null&&n!==void 0?n:0,g=(i=f.y)!==null&&i!==void 0?i:0,d={top:(t=f.top)!==null&&t!==void 0?t:g,right:(r=f.right)!==null&&r!==void 0?r:F,bottom:(l=f.bottom)!==null&&l!==void 0?l:g,left:(a=f.left)!==null&&a!==void 0?a:F};return d.top||d.right||d.bottom||d.left?d:null}c(resolveInsetFrac,"resolveInsetFrac");function textEmUnits(e){var n;let i=0;for(const t of e){const r=(n=t.codePointAt(0))!==null&&n!==void 0?n:0;r>=11904||r>=4352&&r<=4607?i+=1.6:r>=1024&&r<=1327?i+=1.55:i+=1}return i}c(textEmUnits,"textEmUnits");function fitEmUnits(e,n){if(textEmUnits(e)<=n)return e;let i="",t=1;for(const r of e){const l=textEmUnits(r);if(t+l>n)break;i+=r,t+=l}return`${i}\u2026`}c(fitEmUnits,"fitEmUnits");function tag(e,n){return e.editor={...e.editor,label:n},e}c(tag,"tag");function bindProp(e,n,i,t){if(!n)throw new Error("bindProp: propKey must be a non-empty dotted path");if(i!==void 0&&(!Number.isInteger(i)||i<0))throw new Error(`bindProp: index must be a non-negative integer (got ${String(i)})`);const r=checkHint("bindProp",t?.hint);return e.editor={...e.editor,binding:{propKey:n,...i!==void 0?{index:i}:{},...r?{hint:r}:{}}},e}c(bindProp,"bindProp");function checkHint(e,n){if(n!==void 0){if(typeof n!="string"||!n.trim())throw new Error(`${e}: hint must be a non-empty string`);return n.trim()}}c(checkHint,"checkHint");function withBindingHint(e,n){var i;const t=checkHint("withBindingHint",n);if(!t)throw new Error("withBindingHint: hint must be a non-empty string");const r=e.editor;if(!((i=r?.bindings)===null||i===void 0)&&i.length)return r.bindings=r.bindings.map((l,a)=>a===0?{...l,hint:t}:l),e;if(r?.binding)return e.editor={...r,binding:{...r.binding,hint:t}},e;throw new Error("withBindingHint: bind the source first (bindProp / bindProps / bindPropPath / bindPropRect)")}c(withBindingHint,"withBindingHint");function bindPropRange(e,n,i,t,r){if(!n)throw new Error("bindPropRange: propKey must be a non-empty dotted path");if(i!==void 0&&(!Number.isInteger(i)||i<0))throw new Error(`bindPropRange: index must be a non-negative integer (got ${String(i)})`);const l=c((a,f)=>{if(!Number.isInteger(a.start)||!Number.isInteger(a.end)||a.start<0||a.end<a.start)throw new Error(`bindPropRange: ${f} must be integers with 0 <= start <= end (got ${a.start}..${a.end})`)},"span");if(l(t,"range"),r&&(l(r,"focus"),r.start<t.start||r.end>t.end))throw new Error(`bindPropRange: focus ${r.start}..${r.end} must lie inside range ${t.start}..${t.end}`);return e.editor={...e.editor,binding:{propKey:n,...i!==void 0?{index:i}:{},range:{start:t.start,end:t.end},...r?{focus:{start:r.start,end:r.end}}:{}}},e}c(bindPropRange,"bindPropRange");function checkCompanion(e,n,i,t){if(n!==void 0){if(n!==!0)throw new Error(`${e}: companion must be true when set (got ${String(n)})`);if(i===void 0)throw new Error(`${e}: a companion needs a seedDraft \u2014 it is the value the media drop writes`);if(t==="media"||t==="rect")throw new Error(`${e}: a "${t}" leaf cannot be a companion (it is the drop / the move itself)`)}}c(checkCompanion,"checkCompanion");function checkSeedDraft(e,n,i){if(n!==void 0){if(typeof n!="string"||n.trim()==="")throw new Error(`${e}: seedDraft must be a non-blank string (got ${JSON.stringify(n)})`);if(i==="number"&&!Number.isFinite(Number(n.trim())))throw new Error(`${e}: seedDraft ${JSON.stringify(n)} is not a number (kind "number")`);if(i==="rect"||i==="media")throw new Error(`${e}: seedDraft has no meaning on a "${i}" leaf (a rect / a file path is never typed)`)}}c(checkSeedDraft,"checkSeedDraft");function checkOnClear(e,n,i){if(n!==void 0){if(n!=="remove-element"&&n!=="unset-leaf")throw new Error(`${e}: onClear must be "remove-element" | "unset-leaf" (got ${String(n)})`);if(n==="remove-element"&&typeof i[0]!="number")throw new Error(`${e}: onClear "remove-element" needs an element \u2014 an index or a numeric first path segment`);if(n==="unset-leaf"&&i.length>0&&typeof i[i.length-1]!="string")throw new Error(`${e}: onClear "unset-leaf" needs a keyed leaf \u2014 an array element has no key to unset (use "remove-element")`)}}c(checkOnClear,"checkOnClear");function bindProps(e,n){if(!n.length)throw new Error("bindProps: at least one entry");const i=n.map(t=>{var r,l,a,f;if(!t.propKey)throw new Error("bindProps: propKey must be a non-empty dotted path");if(t.index!==void 0&&(!Number.isInteger(t.index)||t.index<0))throw new Error(`bindProps: bad index ${String(t.index)}`);for(const g of(r=t.path)!==null&&r!==void 0?r:[])if(!(typeof g=="number"?Number.isInteger(g)&&g>=0:typeof g=="string"&&g.length>0))throw new Error(`bindProps: bad path segment ${JSON.stringify(g)}`);if(t.kind!==void 0&&t.kind!=="string"&&t.kind!=="number"&&t.kind!=="color"&&t.kind!=="rect"&&t.kind!=="media")throw new Error(`bindProps: bad kind ${String(t.kind)}`);if(t.kind==="rect"&&(!((l=t.path)===null||l===void 0)&&l.length))throw new Error("bindProps: a rect binding names the whole prop or ONE element by index \u2014 never a path");if(t.layer!==void 0&&(!Number.isInteger(t.layer)||t.layer<0))throw new Error(`bindProps: bad layer ${String(t.layer)}`);checkOnClear("bindProps",t.onClear,t.index!==void 0?[t.index,...(a=t.path)!==null&&a!==void 0?a:[]]:(f=t.path)!==null&&f!==void 0?f:[]),checkSeedDraft("bindProps",t.seedDraft,t.kind),checkCompanion("bindProps",t.companion,t.seedDraft,t.kind);const F=checkHint("bindProps",t.hint);return{propKey:t.propKey,...t.index!==void 0?{index:t.index}:{},...t.path?{path:[...t.path]}:{},...t.kind?{kind:t.kind}:{},...t.layer!==void 0?{layer:t.layer}:{},...F?{hint:F}:{},...t.onClear?{onClear:t.onClear}:{},...t.seedDraft!==void 0?{seedDraft:t.seedDraft}:{},...t.companion?{companion:!0}:{}}});return e.editor={...e.editor,bindings:i},e}c(bindProps,"bindProps");function stripPropBindings(e){var n,i;for(const t of(n=e.sources)!==null&&n!==void 0?n:[]){const r=t.editor;r&&(delete r.binding,delete r.bindings)}for(const t of Object.values((i=e.children)!==null&&i!==void 0?i:{}))t&&typeof t=="object"&&stripPropBindings(t);return e}c(stripPropBindings,"stripPropBindings");function bindPropRect(e,n,i){if(!n)throw new Error("bindPropRect: propKey must be a non-empty dotted path");if(i!==void 0&&(!Number.isInteger(i)||i<0))throw new Error(`bindPropRect: index must be a non-negative integer (got ${String(i)})`);return e.editor={...e.editor,binding:i===void 0?{propKey:n,kind:"rect"}:{propKey:n,index:i,kind:"rect"}},e}c(bindPropRect,"bindPropRect");function bindPropPath(e,n,i,t,r){if(!n)throw new Error("bindPropPath: propKey must be a non-empty dotted path");if(!i.length)throw new Error("bindPropPath: path must name a leaf inside the prop value");for(const l of i)if(!(typeof l=="number"?Number.isInteger(l)&&l>=0:typeof l=="string"&&l.length>0))throw new Error(`bindPropPath: bad path segment ${JSON.stringify(l)}`);if(t!=="string"&&t!=="number"&&t!=="color"&&t!=="media")throw new Error(`bindPropPath: kind must be "string" | "number" | "color" | "media" (got ${String(t)})`);return checkOnClear("bindPropPath",r?.onClear,i),checkSeedDraft("bindPropPath",r?.seedDraft,t),e.editor={...e.editor,binding:{propKey:n,path:[...i],kind:t,...r?.onClear?{onClear:r.onClear}:{},...r?.seedDraft!==void 0?{seedDraft:r.seedDraft}:{}}},e}c(bindPropPath,"bindPropPath");const EPS=1e-9,round3=c(e=>Math.round(e*1e3)/1e3,"round3");function checkOne(e,n,i,t,r,l,a){var f,F,g;const d=c((s,m,w,I)=>{a.push({label:e.label,rule:s,expected:m,actual:round3(w),stableKey:r,sourceIndex:l,realized:{...n},detail:I})},"push"),b=c(s=>`${(s*100).toFixed(1)}%`,"pct");if(e.aspect!=null){const s=(f=e.aspectTolerance)!==null&&f!==void 0?f:.02,m=n.w/Math.max(1,n.h);Math.abs(m-e.aspect)>s&&d("aspect",e.aspect,m,`"${e.label}" aspect ${m.toFixed(3)} \u2260 ${e.aspect} (\xB1${s}) [${n.w}\xD7${n.h}].`)}const v=n.w/i,h=n.h/t;if(e.minWidthFrac!=null&&v<e.minWidthFrac-EPS&&d("min-width-frac",e.minWidthFrac,v,`"${e.label}" width ${b(v)} < min ${b(e.minWidthFrac)} of canvas.`),e.maxWidthFrac!=null&&v>e.maxWidthFrac+EPS&&d("max-width-frac",e.maxWidthFrac,v,`"${e.label}" width ${b(v)} > max ${b(e.maxWidthFrac)} of canvas.`),e.minHeightFrac!=null&&h<e.minHeightFrac-EPS&&d("min-height-frac",e.minHeightFrac,h,`"${e.label}" height ${b(h)} < min ${b(e.minHeightFrac)} of canvas.`),e.maxHeightFrac!=null&&h>e.maxHeightFrac+EPS&&d("max-height-frac",e.maxHeightFrac,h,`"${e.label}" height ${b(h)} > max ${b(e.maxHeightFrac)} of canvas.`),!((F=e.within)===null||F===void 0)&&F.xFrac){const[s,m]=e.within.xFrac,w=n.x/i,I=(n.x+n.w)/i;(w<s-EPS||I>m+EPS)&&d("within-x",`[${s},${m}]`,w<s?w:I,`"${e.label}" x-extent [${w.toFixed(3)},${I.toFixed(3)}] escapes [${s},${m}].`)}if(!((g=e.within)===null||g===void 0)&&g.yFrac){const[s,m]=e.within.yFrac,w=n.y/t,I=(n.y+n.h)/t;(w<s-EPS||I>m+EPS)&&d("within-y",`[${s},${m}]`,w<s?w:I,`"${e.label}" y-extent [${w.toFixed(3)},${I.toFixed(3)}] escapes [${s},${m}].`)}}c(checkOne,"checkOne");const relLabel=c(e=>Array.isArray(e.label)?e.label.join("+"):e.label,"relLabel");function checkEqual(e,n,i){var t,r;const l=(t=e.tolerance)!==null&&t!==void 0?t:.02,a=(r=e.tolerancePx)!==null&&r!==void 0?r:0,f=e.equal==="size"?["width","height"]:[e.equal],F=c((d,b)=>b==="width"?d.w:b==="height"?d.h:d.w/Math.max(1,d.h),"metric"),g=c(d=>d==="width"?"equal-width":d==="height"?"equal-height":"equal-aspect","rule");for(const d of f){const b=n.map(w=>F(w,d)),v=Math.min(...b),h=Math.max(...b),s=h>0?(h-v)/h:0,m=d!=="aspect"&&a>0&&h-v<=a;s>l&&!m&&i.push({label:relLabel(e),rule:g(d),expected:l,actual:round3(s),detail:`"${relLabel(e)}" ${d} not uniform: spread ${(s*100).toFixed(1)}% > ${(l*100).toFixed(1)}%${a>0?` (and ${(h-v).toFixed(1)}px > ${a}px)`:""} (min ${v.toFixed(0)}, max ${h.toFixed(0)}).`})}}c(checkEqual,"checkEqual");function checkGutter(e,n,i,t,r){var l;const a=e.gutter,f=(l=a.tolerance)!==null&&l!==void 0?l:.01,F=a.axis==="x"?i:t,g=[...n].sort((h,s)=>a.axis==="x"?h.x-s.x:h.y-s.y),d=[];for(let h=1;h<g.length;h++){const s=g[h-1],m=g[h],w=a.axis==="x"?m.x-(s.x+s.w):m.y-(s.y+s.h);d.push(w/F)}if(d.length===0)return;const b=Math.min(...d),v=Math.max(...d);if(v-b>f&&r.push({label:relLabel(e),rule:"gutter-uniform",expected:f,actual:round3(v-b),detail:`"${relLabel(e)}" ${a.axis}-gutters not uniform: gaps ${(b*100).toFixed(1)}%\u2026${(v*100).toFixed(1)}% (\u0394 ${((v-b)*100).toFixed(1)}% > ${(f*100).toFixed(1)}%).`}),a.target!=null){const h=d.find(s=>Math.abs(s-a.target)>f);h!=null&&r.push({label:relLabel(e),rule:"gutter-target",expected:a.target,actual:round3(h),detail:`"${relLabel(e)}" ${a.axis}-gutter ${(h*100).toFixed(1)}% \u2260 target ${(a.target*100).toFixed(1)}% (\xB1${(f*100).toFixed(1)}%).`})}}c(checkGutter,"checkGutter");function checkLayout(e,n){var i,t,r,l,a,f,F,g,d,b,v,h,s,m,w,I,W,L,z,A;const H=Math.max(1,Math.round(n.canvasW)),D=Math.max(1,Math.round(n.canvasH));let B=e;const U=!!(e.children&&Object.keys(e.children).length>0);if((i=n.flatten)!==null&&i!==void 0?i:U){const o=(0,platform_1.flattenMosaicDocument)({file:e,width:H,height:D,resolveRef:c(()=>null,"resolveRef")});if(!o.ok){const S=`layout collapsed at ${H}\xD7${D} (flatten failed \u2014 SPLIT_EXCEEDS_AXIS / nested precision drop)`,_=[...((t=n.constraints)!==null&&t!==void 0?t:[]).map(y=>({label:y.label,rule:"missing-label",expected:y.label,actual:0,detail:`${S}; "${y.label}" cannot be present.`})),...((r=n.relations)!==null&&r!==void 0?r:[]).map(y=>({label:relLabel(y),rule:"too-few",expected:2,actual:0,detail:`${S}; "${relLabel(y)}" has no nodes to relate.`}))];return{ok:_.length===0,violations:_,resolved:{},resolvedLabels:{}}}B=o.file}const{framesByLogical:j,labelToIndices:T,resolvedLabels:X}=(0,frameResolution_1.resolveDocFrames)(B,H,D),J=(l=B.sources)!==null&&l!==void 0?l:[],k=[],K={},G=c(o=>{var S,_;const y=j[o],M={x:y.x,y:y.y,w:y.width,h:y.height},C=resolveInsetFrac((_=(S=J[o])===null||S===void 0?void 0:S.placement)===null||_===void 0?void 0:_.inset);return C?(0,checkDocGeometry_1.engineRecover)(M,C):M},"boxAt");for(const o of(a=n.constraints)!==null&&a!==void 0?a:[]){const S=(f=T.get(o.label))!==null&&f!==void 0?f:[];if(S.length===0){k.push({label:o.label,rule:"missing-label",expected:o.label,actual:0,detail:`no source tagged "${o.label}" at ${H}\xD7${D} (label didn't land in this m0).`});continue}const _=[];for(const x of S){const E=G(x),u=String(j[x].meta.stableKey);_.push({stableKey:u,sourceIndex:x,rect:E}),checkOne(o,E,H,D,u,x,k)}K[o.label]=_;const y=(F=o.centerTolerancePx)!==null&&F!==void 0?F:4,M=c((x,E)=>{const u=[..._].sort(($,P)=>E==="x"?$.rect.x-P.rect.x:$.rect.y-P.rect.y);if(u.length!==x.length){k.push({label:o.label,rule:"center-count",expected:x.length,actual:u.length,detail:`"${o.label}" has ${u.length} boxes but ${x.length} expected ${E}-centers.`});return}for(let $=0;$<u.length;$++){const P=u[$].rect,R=E==="x"?P.x+P.w/2:P.y+P.h/2;Math.abs(R-x[$])>y&&k.push({label:o.label,rule:E==="x"?"x-center":"y-center",expected:round3(x[$]),actual:round3(R),stableKey:u[$].stableKey,sourceIndex:u[$].sourceIndex,realized:{...P},detail:`"${o.label}"[${$}] ${E}-center ${R.toFixed(1)} \u2260 ${x[$].toFixed(1)} (\xB1${y}px).`})}},"centerCheck");!((g=o.xCenters)===null||g===void 0)&&g.length&&M(o.xCenters,"x"),!((d=o.yCenters)===null||d===void 0)&&d.length&&M(o.yCenters,"y");const C=(b=o.centerToleranceFrac)!==null&&b!==void 0?b:.015,N=c((x,E)=>{const u=[..._].sort((p,q)=>E==="x"?p.rect.x-q.rect.x:p.rect.y-q.rect.y);if(u.length!==x.length){k.push({label:o.label,rule:"center-count",expected:x.length,actual:u.length,detail:`"${o.label}" has ${u.length} boxes but ${x.length} expected ${E}-center fracs.`});return}if(u.length<2)return;const $=c(p=>E==="x"?p.x+p.w/2:p.y+p.h/2,"centerOf"),P=$(u[0].rect),R=$(u[u.length-1].rect),O=Math.max(1e-6,R-P);for(let p=0;p<u.length;p++){const q=($(u[p].rect)-P)/O;Math.abs(q-x[p])>C&&k.push({label:o.label,rule:E==="x"?"x-center":"y-center",expected:round3(x[p]),actual:round3(q),stableKey:u[p].stableKey,sourceIndex:u[p].sourceIndex,realized:{...u[p].rect},detail:`"${o.label}"[${p}] ${E}-center at span-frac ${q.toFixed(3)} \u2260 ${x[p].toFixed(3)} (\xB1${C}).`})}},"centerFracCheck");if(!((v=o.xCentersFrac)===null||v===void 0)&&v.length&&N(o.xCentersFrac,"x"),!((h=o.yCentersFrac)===null||h===void 0)&&h.length&&N(o.yCentersFrac,"y"),o.textFits){const x=(s=o.textFits.charWidthEm)!==null&&s!==void 0?s:.72,E=(m=o.textFits.padPx)!==null&&m!==void 0?m:2;for(const u of _){const $=J[u.sourceIndex];if($?.type==="text")for(const P of(w=$.layers)!==null&&w!==void 0?w:[]){if(((I=P?.content)===null||I===void 0?void 0:I.kind)!=="literal"||typeof P.content.text!="string")continue;const R=(L=(W=P.style)===null||W===void 0?void 0:W.fontSize)!==null&&L!==void 0?L:0;if(!R)continue;const O=P.content.text.split(`
|
|
1
|
+
"use strict";var V=Object.defineProperty;var c=(e,n)=>V(e,"name",{value:n,configurable:!0});Object.defineProperty(exports,"__esModule",{value:!0}),exports.textEmUnits=textEmUnits,exports.fitEmUnits=fitEmUnits,exports.tag=tag,exports.bindProp=bindProp,exports.withBindingHint=withBindingHint,exports.bindPropRange=bindPropRange,exports.bindProps=bindProps,exports.stripPropBindings=stripPropBindings,exports.bindPropRect=bindPropRect,exports.bindPropPath=bindPropPath,exports.checkLayout=checkLayout;const platform_1=require("@m0saic/platform"),frameResolution_1=require("./frameResolution"),checkDocGeometry_1=require("./checkDocGeometry"),latticeRelations_1=require("./latticeRelations");function resolveInsetFrac(e){var n,r,t,i,l,a;if(e==null)return null;if(typeof e=="number")return e?{top:e,right:e,bottom:e,left:e}:null;if(typeof e!="object")return null;const f=e,F=(n=f.x)!==null&&n!==void 0?n:0,g=(r=f.y)!==null&&r!==void 0?r:0,d={top:(t=f.top)!==null&&t!==void 0?t:g,right:(i=f.right)!==null&&i!==void 0?i:F,bottom:(l=f.bottom)!==null&&l!==void 0?l:g,left:(a=f.left)!==null&&a!==void 0?a:F};return d.top||d.right||d.bottom||d.left?d:null}c(resolveInsetFrac,"resolveInsetFrac");function textEmUnits(e){var n;let r=0;for(const t of e){const i=(n=t.codePointAt(0))!==null&&n!==void 0?n:0;i>=11904||i>=4352&&i<=4607?r+=1.6:i>=1024&&i<=1327?r+=1.55:r+=1}return r}c(textEmUnits,"textEmUnits");function fitEmUnits(e,n){if(textEmUnits(e)<=n)return e;let r="",t=1;for(const i of e){const l=textEmUnits(i);if(t+l>n)break;r+=i,t+=l}return`${r}\u2026`}c(fitEmUnits,"fitEmUnits");function tag(e,n){return e.editor={...e.editor,label:n},e}c(tag,"tag");function bindProp(e,n,r,t){if(!n)throw new Error("bindProp: propKey must be a non-empty dotted path");if(r!==void 0&&(!Number.isInteger(r)||r<0))throw new Error(`bindProp: index must be a non-negative integer (got ${String(r)})`);const i=checkHint("bindProp",t?.hint);return e.editor={...e.editor,binding:{propKey:n,...r!==void 0?{index:r}:{},...i?{hint:i}:{}}},e}c(bindProp,"bindProp");function checkHint(e,n){if(n!==void 0){if(typeof n!="string"||!n.trim())throw new Error(`${e}: hint must be a non-empty string`);return n.trim()}}c(checkHint,"checkHint");function withBindingHint(e,n){var r;const t=checkHint("withBindingHint",n);if(!t)throw new Error("withBindingHint: hint must be a non-empty string");const i=e.editor;if(!((r=i?.bindings)===null||r===void 0)&&r.length)return i.bindings=i.bindings.map((l,a)=>a===0?{...l,hint:t}:l),e;if(i?.binding)return e.editor={...i,binding:{...i.binding,hint:t}},e;throw new Error("withBindingHint: bind the source first (bindProp / bindProps / bindPropPath / bindPropRect)")}c(withBindingHint,"withBindingHint");function bindPropRange(e,n,r,t,i){if(!n)throw new Error("bindPropRange: propKey must be a non-empty dotted path");if(r!==void 0&&(!Number.isInteger(r)||r<0))throw new Error(`bindPropRange: index must be a non-negative integer (got ${String(r)})`);const l=c((a,f)=>{if(!Number.isInteger(a.start)||!Number.isInteger(a.end)||a.start<0||a.end<a.start)throw new Error(`bindPropRange: ${f} must be integers with 0 <= start <= end (got ${a.start}..${a.end})`)},"span");if(l(t,"range"),i&&(l(i,"focus"),i.start<t.start||i.end>t.end))throw new Error(`bindPropRange: focus ${i.start}..${i.end} must lie inside range ${t.start}..${t.end}`);return e.editor={...e.editor,binding:{propKey:n,...r!==void 0?{index:r}:{},range:{start:t.start,end:t.end},...i?{focus:{start:i.start,end:i.end}}:{}}},e}c(bindPropRange,"bindPropRange");function checkCompanion(e,n,r,t){if(n!==void 0){if(n!==!0)throw new Error(`${e}: companion must be true when set (got ${String(n)})`);if(r===void 0)throw new Error(`${e}: a companion needs a seedDraft \u2014 it is the value the media drop writes`);if(t==="media"||t==="rect")throw new Error(`${e}: a "${t}" leaf cannot be a companion (it is the drop / the move itself)`)}}c(checkCompanion,"checkCompanion");function checkSeedDraft(e,n,r){if(n!==void 0){if(typeof n!="string"||n.trim()==="")throw new Error(`${e}: seedDraft must be a non-blank string (got ${JSON.stringify(n)})`);if(r==="number"&&!Number.isFinite(Number(n.trim())))throw new Error(`${e}: seedDraft ${JSON.stringify(n)} is not a number (kind "number")`);if(r==="rect"||r==="media")throw new Error(`${e}: seedDraft has no meaning on a "${r}" leaf (a rect / a file path is never typed)`)}}c(checkSeedDraft,"checkSeedDraft");function checkOnClear(e,n,r){if(n!==void 0){if(n!=="remove-element"&&n!=="unset-leaf")throw new Error(`${e}: onClear must be "remove-element" | "unset-leaf" (got ${String(n)})`);if(n==="remove-element"&&typeof r[0]!="number")throw new Error(`${e}: onClear "remove-element" needs an element \u2014 an index or a numeric first path segment`);if(n==="unset-leaf"&&r.length>0&&typeof r[r.length-1]!="string")throw new Error(`${e}: onClear "unset-leaf" needs a keyed leaf \u2014 an array element has no key to unset (use "remove-element")`)}}c(checkOnClear,"checkOnClear");function bindProps(e,n){if(!n.length)throw new Error("bindProps: at least one entry");const r=n.map(t=>{var i,l,a,f;if(!t.propKey)throw new Error("bindProps: propKey must be a non-empty dotted path");if(t.index!==void 0&&(!Number.isInteger(t.index)||t.index<0))throw new Error(`bindProps: bad index ${String(t.index)}`);for(const g of(i=t.path)!==null&&i!==void 0?i:[])if(!(typeof g=="number"?Number.isInteger(g)&&g>=0:typeof g=="string"&&g.length>0))throw new Error(`bindProps: bad path segment ${JSON.stringify(g)}`);if(t.kind!==void 0&&t.kind!=="string"&&t.kind!=="number"&&t.kind!=="color"&&t.kind!=="choice"&&t.kind!=="rect"&&t.kind!=="media")throw new Error(`bindProps: bad kind ${String(t.kind)}`);if(t.kind==="rect"&&(!((l=t.path)===null||l===void 0)&&l.length))throw new Error("bindProps: a rect binding names the whole prop or ONE element by index \u2014 never a path");if(t.layer!==void 0&&(!Number.isInteger(t.layer)||t.layer<0))throw new Error(`bindProps: bad layer ${String(t.layer)}`);checkOnClear("bindProps",t.onClear,t.index!==void 0?[t.index,...(a=t.path)!==null&&a!==void 0?a:[]]:(f=t.path)!==null&&f!==void 0?f:[]),checkSeedDraft("bindProps",t.seedDraft,t.kind),checkCompanion("bindProps",t.companion,t.seedDraft,t.kind);const F=checkHint("bindProps",t.hint);return{propKey:t.propKey,...t.index!==void 0?{index:t.index}:{},...t.path?{path:[...t.path]}:{},...t.kind?{kind:t.kind}:{},...t.layer!==void 0?{layer:t.layer}:{},...F?{hint:F}:{},...t.onClear?{onClear:t.onClear}:{},...t.seedDraft!==void 0?{seedDraft:t.seedDraft}:{},...t.companion?{companion:!0}:{}}});return e.editor={...e.editor,bindings:r},e}c(bindProps,"bindProps");function stripPropBindings(e){var n,r;for(const t of(n=e.sources)!==null&&n!==void 0?n:[]){const i=t.editor;i&&(delete i.binding,delete i.bindings)}for(const t of Object.values((r=e.children)!==null&&r!==void 0?r:{}))t&&typeof t=="object"&&stripPropBindings(t);return e}c(stripPropBindings,"stripPropBindings");function bindPropRect(e,n,r){if(!n)throw new Error("bindPropRect: propKey must be a non-empty dotted path");if(r!==void 0&&(!Number.isInteger(r)||r<0))throw new Error(`bindPropRect: index must be a non-negative integer (got ${String(r)})`);return e.editor={...e.editor,binding:r===void 0?{propKey:n,kind:"rect"}:{propKey:n,index:r,kind:"rect"}},e}c(bindPropRect,"bindPropRect");function bindPropPath(e,n,r,t,i){if(!n)throw new Error("bindPropPath: propKey must be a non-empty dotted path");if(!r.length)throw new Error("bindPropPath: path must name a leaf inside the prop value");for(const l of r)if(!(typeof l=="number"?Number.isInteger(l)&&l>=0:typeof l=="string"&&l.length>0))throw new Error(`bindPropPath: bad path segment ${JSON.stringify(l)}`);if(t!=="string"&&t!=="number"&&t!=="color"&&t!=="choice"&&t!=="media")throw new Error(`bindPropPath: kind must be "string" | "number" | "color" | "choice" | "media" (got ${String(t)})`);return checkOnClear("bindPropPath",i?.onClear,r),checkSeedDraft("bindPropPath",i?.seedDraft,t),e.editor={...e.editor,binding:{propKey:n,path:[...r],kind:t,...i?.onClear?{onClear:i.onClear}:{},...i?.seedDraft!==void 0?{seedDraft:i.seedDraft}:{}}},e}c(bindPropPath,"bindPropPath");const EPS=1e-9,round3=c(e=>Math.round(e*1e3)/1e3,"round3");function checkOne(e,n,r,t,i,l,a){var f,F,g;const d=c((s,m,w,I)=>{a.push({label:e.label,rule:s,expected:m,actual:round3(w),stableKey:i,sourceIndex:l,realized:{...n},detail:I})},"push"),b=c(s=>`${(s*100).toFixed(1)}%`,"pct");if(e.aspect!=null){const s=(f=e.aspectTolerance)!==null&&f!==void 0?f:.02,m=n.w/Math.max(1,n.h);Math.abs(m-e.aspect)>s&&d("aspect",e.aspect,m,`"${e.label}" aspect ${m.toFixed(3)} \u2260 ${e.aspect} (\xB1${s}) [${n.w}\xD7${n.h}].`)}const v=n.w/r,h=n.h/t;if(e.minWidthFrac!=null&&v<e.minWidthFrac-EPS&&d("min-width-frac",e.minWidthFrac,v,`"${e.label}" width ${b(v)} < min ${b(e.minWidthFrac)} of canvas.`),e.maxWidthFrac!=null&&v>e.maxWidthFrac+EPS&&d("max-width-frac",e.maxWidthFrac,v,`"${e.label}" width ${b(v)} > max ${b(e.maxWidthFrac)} of canvas.`),e.minHeightFrac!=null&&h<e.minHeightFrac-EPS&&d("min-height-frac",e.minHeightFrac,h,`"${e.label}" height ${b(h)} < min ${b(e.minHeightFrac)} of canvas.`),e.maxHeightFrac!=null&&h>e.maxHeightFrac+EPS&&d("max-height-frac",e.maxHeightFrac,h,`"${e.label}" height ${b(h)} > max ${b(e.maxHeightFrac)} of canvas.`),!((F=e.within)===null||F===void 0)&&F.xFrac){const[s,m]=e.within.xFrac,w=n.x/r,I=(n.x+n.w)/r;(w<s-EPS||I>m+EPS)&&d("within-x",`[${s},${m}]`,w<s?w:I,`"${e.label}" x-extent [${w.toFixed(3)},${I.toFixed(3)}] escapes [${s},${m}].`)}if(!((g=e.within)===null||g===void 0)&&g.yFrac){const[s,m]=e.within.yFrac,w=n.y/t,I=(n.y+n.h)/t;(w<s-EPS||I>m+EPS)&&d("within-y",`[${s},${m}]`,w<s?w:I,`"${e.label}" y-extent [${w.toFixed(3)},${I.toFixed(3)}] escapes [${s},${m}].`)}}c(checkOne,"checkOne");const relLabel=c(e=>Array.isArray(e.label)?e.label.join("+"):e.label,"relLabel");function checkEqual(e,n,r){var t,i;const l=(t=e.tolerance)!==null&&t!==void 0?t:.02,a=(i=e.tolerancePx)!==null&&i!==void 0?i:0,f=e.equal==="size"?["width","height"]:[e.equal],F=c((d,b)=>b==="width"?d.w:b==="height"?d.h:d.w/Math.max(1,d.h),"metric"),g=c(d=>d==="width"?"equal-width":d==="height"?"equal-height":"equal-aspect","rule");for(const d of f){const b=n.map(w=>F(w,d)),v=Math.min(...b),h=Math.max(...b),s=h>0?(h-v)/h:0,m=d!=="aspect"&&a>0&&h-v<=a;s>l&&!m&&r.push({label:relLabel(e),rule:g(d),expected:l,actual:round3(s),detail:`"${relLabel(e)}" ${d} not uniform: spread ${(s*100).toFixed(1)}% > ${(l*100).toFixed(1)}%${a>0?` (and ${(h-v).toFixed(1)}px > ${a}px)`:""} (min ${v.toFixed(0)}, max ${h.toFixed(0)}).`})}}c(checkEqual,"checkEqual");function checkGutter(e,n,r,t,i){var l;const a=e.gutter,f=(l=a.tolerance)!==null&&l!==void 0?l:.01,F=a.axis==="x"?r:t,g=[...n].sort((h,s)=>a.axis==="x"?h.x-s.x:h.y-s.y),d=[];for(let h=1;h<g.length;h++){const s=g[h-1],m=g[h],w=a.axis==="x"?m.x-(s.x+s.w):m.y-(s.y+s.h);d.push(w/F)}if(d.length===0)return;const b=Math.min(...d),v=Math.max(...d);if(v-b>f&&i.push({label:relLabel(e),rule:"gutter-uniform",expected:f,actual:round3(v-b),detail:`"${relLabel(e)}" ${a.axis}-gutters not uniform: gaps ${(b*100).toFixed(1)}%\u2026${(v*100).toFixed(1)}% (\u0394 ${((v-b)*100).toFixed(1)}% > ${(f*100).toFixed(1)}%).`}),a.target!=null){const h=d.find(s=>Math.abs(s-a.target)>f);h!=null&&i.push({label:relLabel(e),rule:"gutter-target",expected:a.target,actual:round3(h),detail:`"${relLabel(e)}" ${a.axis}-gutter ${(h*100).toFixed(1)}% \u2260 target ${(a.target*100).toFixed(1)}% (\xB1${(f*100).toFixed(1)}%).`})}}c(checkGutter,"checkGutter");function checkLayout(e,n){var r,t,i,l,a,f,F,g,d,b,v,h,s,m,w,I,W,L,z,A;const H=Math.max(1,Math.round(n.canvasW)),D=Math.max(1,Math.round(n.canvasH));let B=e;const U=!!(e.children&&Object.keys(e.children).length>0);if((r=n.flatten)!==null&&r!==void 0?r:U){const o=(0,platform_1.flattenMosaicDocument)({file:e,width:H,height:D,resolveRef:c(()=>null,"resolveRef")});if(!o.ok){const S=`layout collapsed at ${H}\xD7${D} (flatten failed \u2014 SPLIT_EXCEEDS_AXIS / nested precision drop)`,_=[...((t=n.constraints)!==null&&t!==void 0?t:[]).map(y=>({label:y.label,rule:"missing-label",expected:y.label,actual:0,detail:`${S}; "${y.label}" cannot be present.`})),...((i=n.relations)!==null&&i!==void 0?i:[]).map(y=>({label:relLabel(y),rule:"too-few",expected:2,actual:0,detail:`${S}; "${relLabel(y)}" has no nodes to relate.`}))];return{ok:_.length===0,violations:_,resolved:{},resolvedLabels:{}}}B=o.file}const{framesByLogical:j,labelToIndices:T,resolvedLabels:X}=(0,frameResolution_1.resolveDocFrames)(B,H,D),J=(l=B.sources)!==null&&l!==void 0?l:[],k=[],K={},G=c(o=>{var S,_;const y=j[o],M={x:y.x,y:y.y,w:y.width,h:y.height},C=resolveInsetFrac((_=(S=J[o])===null||S===void 0?void 0:S.placement)===null||_===void 0?void 0:_.inset);return C?(0,checkDocGeometry_1.engineRecover)(M,C):M},"boxAt");for(const o of(a=n.constraints)!==null&&a!==void 0?a:[]){const S=(f=T.get(o.label))!==null&&f!==void 0?f:[];if(S.length===0){k.push({label:o.label,rule:"missing-label",expected:o.label,actual:0,detail:`no source tagged "${o.label}" at ${H}\xD7${D} (label didn't land in this m0).`});continue}const _=[];for(const x of S){const E=G(x),u=String(j[x].meta.stableKey);_.push({stableKey:u,sourceIndex:x,rect:E}),checkOne(o,E,H,D,u,x,k)}K[o.label]=_;const y=(F=o.centerTolerancePx)!==null&&F!==void 0?F:4,M=c((x,E)=>{const u=[..._].sort(($,P)=>E==="x"?$.rect.x-P.rect.x:$.rect.y-P.rect.y);if(u.length!==x.length){k.push({label:o.label,rule:"center-count",expected:x.length,actual:u.length,detail:`"${o.label}" has ${u.length} boxes but ${x.length} expected ${E}-centers.`});return}for(let $=0;$<u.length;$++){const P=u[$].rect,R=E==="x"?P.x+P.w/2:P.y+P.h/2;Math.abs(R-x[$])>y&&k.push({label:o.label,rule:E==="x"?"x-center":"y-center",expected:round3(x[$]),actual:round3(R),stableKey:u[$].stableKey,sourceIndex:u[$].sourceIndex,realized:{...P},detail:`"${o.label}"[${$}] ${E}-center ${R.toFixed(1)} \u2260 ${x[$].toFixed(1)} (\xB1${y}px).`})}},"centerCheck");!((g=o.xCenters)===null||g===void 0)&&g.length&&M(o.xCenters,"x"),!((d=o.yCenters)===null||d===void 0)&&d.length&&M(o.yCenters,"y");const C=(b=o.centerToleranceFrac)!==null&&b!==void 0?b:.015,N=c((x,E)=>{const u=[..._].sort((p,q)=>E==="x"?p.rect.x-q.rect.x:p.rect.y-q.rect.y);if(u.length!==x.length){k.push({label:o.label,rule:"center-count",expected:x.length,actual:u.length,detail:`"${o.label}" has ${u.length} boxes but ${x.length} expected ${E}-center fracs.`});return}if(u.length<2)return;const $=c(p=>E==="x"?p.x+p.w/2:p.y+p.h/2,"centerOf"),P=$(u[0].rect),R=$(u[u.length-1].rect),O=Math.max(1e-6,R-P);for(let p=0;p<u.length;p++){const q=($(u[p].rect)-P)/O;Math.abs(q-x[p])>C&&k.push({label:o.label,rule:E==="x"?"x-center":"y-center",expected:round3(x[p]),actual:round3(q),stableKey:u[p].stableKey,sourceIndex:u[p].sourceIndex,realized:{...u[p].rect},detail:`"${o.label}"[${p}] ${E}-center at span-frac ${q.toFixed(3)} \u2260 ${x[p].toFixed(3)} (\xB1${C}).`})}},"centerFracCheck");if(!((v=o.xCentersFrac)===null||v===void 0)&&v.length&&N(o.xCentersFrac,"x"),!((h=o.yCentersFrac)===null||h===void 0)&&h.length&&N(o.yCentersFrac,"y"),o.textFits){const x=(s=o.textFits.charWidthEm)!==null&&s!==void 0?s:.72,E=(m=o.textFits.padPx)!==null&&m!==void 0?m:2;for(const u of _){const $=J[u.sourceIndex];if($?.type==="text")for(const P of(w=$.layers)!==null&&w!==void 0?w:[]){if(((I=P?.content)===null||I===void 0?void 0:I.kind)!=="literal"||typeof P.content.text!="string")continue;const R=(L=(W=P.style)===null||W===void 0?void 0:W.fontSize)!==null&&L!==void 0?L:0;if(!R)continue;const O=P.content.text.split(`
|
|
2
2
|
`).reduce((q,Q)=>Math.max(q,textEmUnits(Q)),0),p=O*R*x+E;p>u.rect.w&&k.push({label:o.label,rule:"text-fit",expected:round3(u.rect.w),actual:round3(p),stableKey:u.stableKey,sourceIndex:u.sourceIndex,realized:{...u.rect},detail:`"${o.label}" text (${O.toFixed(1)} em-units @ ${R}px, ~${x}em) needs ~${p.toFixed(0)}px but its box is ${u.rect.w}px wide \u2014 clips in the CLI rasterizer.`})}}}}for(const o of(z=n.relations)!==null&&z!==void 0?z:[]){const S=Array.isArray(o.label)?o.label:[o.label];for(const C of S)K[C]||(K[C]=((A=T.get(C))!==null&&A!==void 0?A:[]).map(N=>({stableKey:String(j[N].meta.stableKey),sourceIndex:N,rect:G(N)})));const _=S.flatMap(C=>{var N;return(N=T.get(C))!==null&&N!==void 0?N:[]}),y=o.equal||o.gutter||o.lattice?2:1;if(_.length<y){k.push({label:relLabel(o),rule:"too-few",expected:y,actual:_.length,detail:`"${relLabel(o)}" relation needs \u2265${y} nodes, found ${_.length} at ${H}\xD7${D}.`});continue}const M=_.map(G);o.equal&&checkEqual(o,M,k),o.gutter&&checkGutter(o,M,H,D,k),o.lattice&&(0,latticeRelations_1.checkLatticeGutter)(relLabel(o),o.lattice,M,k),o.coverage&&(0,latticeRelations_1.checkCoverage)(relLabel(o),o.coverage,M,H,D,k)}return{ok:k.length===0,violations:k,resolved:K,resolvedLabels:X}}c(checkLayout,"checkLayout");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";var
|
|
2
|
-
`);return{canvas:{width:
|
|
3
|
-
`)[0]).frameCount)}catch{return"?"}},"frames"),r=c(
|
|
4
|
-
`)[0].slice(0,200)}c(firstLine,"firstLine");function documentsOf(t){const e=t;return!e||typeof e!="object"?[]:e.kind==="mosaic_document"&&Array.isArray(e.sources)?[e]:e.kind==="mosaic_pipeline"&&Array.isArray(e.steps)?e.steps.map(n=>n.file).filter(n=>!!n&&typeof n=="object"&&Array.isArray(n.sources)):[]}c(documentsOf,"documentsOf");function collectM0Strings(t,e=[],n={mosaicx:0,bitmap:0},o=new Set){var i,r;if(o.has(t))return{m0s:e,skipped:n};if(o.add(t),((r=(i=t.engine)===null||i===void 0?void 0:i.lattice)===null||r===void 0?void 0:r.mode)==="bitmap")return n.bitmap++,{m0s:e,skipped:n};typeof t.m0=="string"&&e.push(t.m0);const l=t.children;if(l&&typeof l=="object")for(const f of Object.values(l)){const v=f?.kind;if(typeof v=="string"&&v.startsWith("mosaicx_")){n.mosaicx++;continue}for(const m of documentsOf(f))collectM0Strings(m,e,n,o)}return{m0s:e,skipped:n}}c(collectM0Strings,"collectM0Strings");function drawnTextOf(t){var e,n,o;const i=[];for(const r of(e=t.sources)!==null&&e!==void 0?e:[]){if(!r||r.type!=="text"||!Array.isArray(r.layers))continue;const l=r.rasterizer==="svg",f=(n=r.style)!==null&&n!==void 0?n:{},v=(0,platform_1.sourceBindings)(r.editor).map(m=>m.propKey).filter(m=>typeof m=="string");for(const m of r.layers){const b=m?.content;if(!b||b.kind!=="literal"||typeof b.text!="string")continue;const g={...f,...(o=m.style)!==null&&o!==void 0?o:{}};i.push({text:b.text,svg:l,boundTo:v,family:typeof g.fontFamily=="string"?g.fontFamily:void 0,weight:g.fontWeight,style:g.fontStyle})}}return i}c(drawnTextOf,"drawnTextOf");const CLOSED_OR_PICKED=c(t=>{var e,n;const o=(e=t.meta)===null||e===void 0?void 0:e.constraints,i=(n=t.meta)===null||n===void 0?void 0:n.control;return!!(Array.isArray(o?.oneOf)&&o.oneOf.length>0||o?.isColor||Array.isArray(i?.options)&&i.options.length>0||i?.optionsFrom||i?.optionsFromConnection||i?.colorPicker||i?.picker)},"CLOSED_OR_PICKED");function freeTextProps(t){const e=[];return(0,auditSchemaConventions_1.walkPropDefinitions)(t,(n,o)=>{var i,r,l,f;o.type==="string"&&(!((r=(i=o.meta)===null||i===void 0?void 0:i.ui)===null||r===void 0)&&r.hidden||((f=(l=o.meta)===null||l===void 0?void 0:l.ui)===null||f===void 0?void 0:f.consumer)!=="human"&&(CLOSED_OR_PICKED(o)||e.push(n)))}),e}c(freeTextProps,"freeTextProps");function accountableProps(t){const e=[];return(0,auditSchemaConventions_1.walkPropDefinitions)(t,(n,o)=>{var i,r,l,f,v,m,b,g;if(!((r=(i=o.meta)===null||i===void 0?void 0:i.ui)===null||r===void 0)&&r.hidden||((f=(l=o.meta)===null||l===void 0?void 0:l.ui)===null||f===void 0?void 0:f.consumer)==="human")return;const F=!!(!((m=(v=o.meta)===null||v===void 0?void 0:v.constraints)===null||m===void 0)&&m.isColor||!((g=(b=o.meta)===null||b===void 0?void 0:b.control)===null||g===void 0)&&g.colorPicker);switch(o.type){case"string":F?e.push({key:n,kind:"color"}):CLOSED_OR_PICKED(o)||e.push({key:n,kind:"string"});return;case"number":CLOSED_OR_PICKED(o)||e.push({key:n,kind:"number"});return;case"media":e.push({key:n,kind:"media"});return;case"string[]":e.push({key:n,kind:F?"color element":"string element"});return;case"number[]":e.push({key:n,kind:"number element"});return;case"media[]":e.push({key:n,kind:"media element"});return;case"json":case"list":case"array":e.push({key:n,kind:isRectPicker(o)?"rect":"leaf"});return;default:return}}),e}c(accountableProps,"accountableProps"),exports.NESTED_BG_PROP="useNestedBackgroundColor";function isPlainColorFill(t){var e;return t.overlay||t.mask||t.placement||t.effects?!1:t.type==="lavfi"?typeof t.color=="string":t.type==="text"?typeof((e=t.visual)===null||e===void 0?void 0:e.backgroundColor)!="string"?!1:(Array.isArray(t.layers)?t.layers:[]).every(o=>{const i=o?.content;return!i||i.kind!=="literal"||typeof i.text!="string"||i.text.trim()===""}):!1}c(isPlainColorFill,"isPlainColorFill");function forEachSourceInTree(t,e,n=new Set){var o;for(const i of t){if(!i||typeof i!="object"||n.has(i))continue;n.add(i);for(const l of(o=i.sources)!==null&&o!==void 0?o:[])l&&typeof l=="object"&&e(l);const r=i.children;if(r&&typeof r=="object")for(const l of Object.values(r))forEachSourceInTree(documentsOf(l),e,n)}}c(forEachSourceInTree,"forEachSourceInTree");function backgroundColorsOf(t,e=new Set,n=new Set){if(!t||typeof t!="object"||n.has(t))return e;n.add(t);const o=t.backgroundColor;typeof o=="string"&&o.trim()&&e.add(o.trim().toLowerCase());const i=t.children;if(i&&typeof i=="object")for(const r of Object.values(i))for(const l of documentsOf(r))backgroundColorsOf(l,e,n);return e}c(backgroundColorsOf,"backgroundColorsOf");function isRectPicker(t){var e;const n=(e=t.meta)===null||e===void 0?void 0:e.control;return n?.picker==="regions"}c(isRectPicker,"isRectPicker");function drawnNumberProps(t){const e=[];return(0,auditSchemaConventions_1.walkPropDefinitions)(t,(n,o)=>{var i,r,l,f;o.type==="number"&&(!((r=(i=o.meta)===null||i===void 0?void 0:i.ui)===null||r===void 0)&&r.hidden||((f=(l=o.meta)===null||l===void 0?void 0:l.ui)===null||f===void 0?void 0:f.consumer)!=="human"&&(CLOSED_OR_PICKED(o)||e.push(n)))}),e}c(drawnNumberProps,"drawnNumberProps");function numberSpellings(t){if(!Number.isFinite(t))return[];const e=[String(t),t.toLocaleString("en-US")];return Number.isInteger(t)||e.push(t.toFixed(1),t.toFixed(2)),[...new Set(e)].filter(n=>n.length>=2)}c(numberSpellings,"numberSpellings");const DIGIT=/[0-9]/,digitAt=c((t,e)=>{var n;return DIGIT.test((n=t[e])!==null&&n!==void 0?n:"")},"digitAt");function drawnAsNumber(t,e){let n=t.indexOf(e);for(;n>=0;){const o=n+e.length,i=t[n-1],r=t[o],l=!digitAt(t,n-1)&&!((i==="."||i===",")&&digitAt(t,n-2)),f=!digitAt(t,o)&&!((r==="."||r===",")&&digitAt(t,o+1));if(l&&f)return!0;n=t.indexOf(e,n+1)}return!1}c(drawnAsNumber,"drawnAsNumber");function valueAt(t,e){return e.split(".").reduce((n,o)=>n&&typeof n=="object"?n[o]:void 0,t)}c(valueAt,"valueAt");function fontFor(t){var e,n;try{(0,text_1.registerBundledFonts)();const o=(0,text_1.resolveFontFile)({family:t.family,weight:t.weight,style:t.style});return{path:(e=o?.path)!==null&&e!==void 0?e:(0,text_1.bundledFontPath)(),label:(n=t.family)!==null&&n!==void 0?n:"the bundled font"}}catch{return null}}c(fontFor,"fontFor");function loadFont(t){const e=(0,text_1.getCachedFont)(t);if(e)return e;try{const n=(0,text_1.getOpentype)();if(typeof n.loadSync!="function")return null;const o=n.loadSync(t);return(0,text_1.setCachedFont)(t,o),o}catch{return null}}c(loadFont,"loadFont");async function auditRenderedTemplate(t,e={}){var n,o,i,r,l,f,v,m,b,g,F,T,M,j,q,I,E,C,P;const _=String(t.id),$=(0,resolveTemplateOutputHints_1.resolveTemplateOutputHints)(t,t.defaultProps),k=(n=e.width)!==null&&n!==void 0?n:typeof $.width=="number"?$.width:1280,w=(o=e.height)!==null&&o!==void 0?o:typeof $.height=="number"?$.height:720,K=typeof $.fps=="number"?$.fps:30,V=typeof $.durationMs=="number"?$.durationMs:4e3,W=(i=e.external)!==null&&i!==void 0?i:!1,G=(r=e.record)!==null&&r!==void 0?r:!0,x={templateId:_,canvas:{width:k,height:w},notes:[],findings:[],lagging:[]},L=new Map,y=c((s,d)=>{var u;const p=(u=L.get(s))!==null&&u!==void 0?u:[];p.some(a=>a.key===d.key&&a.detail===d.detail)||p.push(d),L.set(s,p)},"push");if(((l=t.capabilities)===null||l===void 0?void 0:l.tier)==="capability")return x.skipped="capability tier \u2014 needs host handles a bare ctx cannot supply",x;const R=t.propsSchema,H=(f=t.defaultProps)!==null&&f!==void 0?f:{},U=c(()=>({...(0,templateRegistry_1.deepFreezeTemplate)(H)}),"productionDefaults"),N=Object.entries(R??{}).filter(([s,d])=>d?.required&&H[s]===void 0).map(([s])=>s);let z;try{const s=ctxFor(k,w,K,V,(v=e.workspaceDir)!==null&&v!==void 0?v:"/tmp/m0saic-template-audit");z=await t.render(U(),s)}catch(s){if(N.length>0)return x.skipped=`requires inputs with no default: ${N.join(", ")}`,x;y("rendersAtDefaults",{key:"render",detail:`render(defaultProps) at ${k}\xD7${w} threw: ${firstLine(s)}`})}const D=documentsOf(z);for(const s of floorViolations(D,k,w))y("safeMinimumCanvas",s);if(z!==void 0)try{const s=ctxFor(k,w,K,V,(m=e.workspaceDir)!==null&&m!==void 0?m:"/tmp/m0saic-template-audit"),d=await t.render(U(),s),u=JSON.parse(JSON.stringify(z)),p=JSON.parse(JSON.stringify(d)),a=firstDiff(u,p);a&&y("deterministic",{key:a,detail:`two renders of defaultProps at ${k}\xD7${w} differ at ${a} \u2014 a clock, Math.random, an ambient read, or a per-call id is leaking into the document.`})}catch(s){y("deterministic",{key:"render",detail:`the second render of defaultProps threw where the first did not: ${firstLine(s)}`})}for(const s of D){for(const d of textFitViolations(s,k,w,x.notes))y("textFits",d);for(const d of costViolations(s,k,w))y("costBudget",d)}const O=t.lattice,Q=((b=O?.allow)!==null&&b!==void 0?b:[]).filter(s=>s&&Number.isSafeInteger(s.count)&&s.count>0),tt=c((s,d,u)=>{const p={m0s:[],skipped:{mosaicx:0,bitmap:0}};for(const h of s)collectM0Strings(h,p.m0s,p.skipped);p.skipped.mosaicx>0&&x.notes.push(`latticeSmooth: ${p.skipped.mosaicx} mosaicx child(ren) not scanned at ${dims(d)} (invocations, not geometry)`),p.skipped.bitmap>0&&x.notes.push(`latticeSmooth: ${p.skipped.bitmap} bitmap child document(s) skipped at ${dims(d)} (engine.lattice.mode)`);const a=O?.canvas==="physical";for(const h of(0,latticeReport_1.latticeViolations)(p.m0s,{canvas:d,allow:Q.map(S=>S.count),physicalCanvas:a}))y("latticeSmooth",u?{key:`${u}:${h.key}`,detail:`at ${dims(d)}: ${h.detail}`}:h)},"latticeCheck");D.length>0&&(O?.mode==="bitmap"?x.notes.push('latticeSmooth: skipped \u2014 lattice.mode is "bitmap" (a baked raster is never live-composed)'):(Q.length>0&&x.notes.push(`latticeSmooth: allowed content counts ${Q.map(s=>`${s.count} (${s.reason})`).join(", ")}`),O?.canvas==="physical"&&x.notes.push(`latticeSmooth: hinted canvas ${k}\xD7${w} declared physical (lattice.canvas) \u2014 a rough axis is not reported; the counts it explains are charged to it`),tt(D,{width:k,height:w},""))),x.layout=layoutFingerprintOf(D,k,w);for(const s of(g=e.sweepCanvases)!==null&&g!==void 0?g:[])if(!(s.width===k&&s.height===w))try{const d=ctxFor(s.width,s.height,K,V,(F=e.workspaceDir)!==null&&F!==void 0?F:"/tmp/m0saic-template-audit"),u=documentsOf(await t.render(U(),d));for(const p of floorViolations(u,s.width,s.height))y("canvasEnvelope",p);u.length>0&&O?.mode!=="bitmap"&&O?.canvas!=="physical"&&tt(u,{width:s.width,height:s.height},dims(s))}catch(d){x.notes.push(`canvasEnvelope: render at ${dims(s)} threw: ${firstLine(d)}`)}const X=new Set,Y=new Set;for(const s of D){const d=(0,frameResolution_1.resolvePropBindings)(s,k,w,{propsSchema:R});for(const[u,p]of Object.entries(d.byProp))p.some(a=>a.childPath.length===0)&&X.add(u),Y.add(u);for(const u of d.rejected)u.childPath.length>0||y("bindingsSound",{key:u.propKey,detail:`binding on "${u.propKey}" was rejected (${u.reason}) \u2014 ${REJECTION_HINT[u.reason]}`})}if(D.length>0){const s=(M=(T=t.bindings)===null||T===void 0?void 0:T.unbound)!==null&&M!==void 0?M:{},d=accountableProps(R),u=new Set(d.map(a=>a.key)),p=new Set;for(const a of D)backgroundColorsOf(a,p);for(const{key:a,kind:h}of d)if(!Y.has(a)){if(h==="color"){const S=valueAt(H,a);if(typeof S=="string"&&p.has(S.trim().toLowerCase()))continue}Object.prototype.hasOwnProperty.call(s,a)||y("bindingsDeclared",{key:a,detail:`"${a}" can carry a ${h} handle but nothing binds it \u2014 bind the rect that shows it (bindProp(src, "${a}")), or declare why it has none: bindings.unbound = { "${a}": "<reason>" }.`})}for(const[a,h]of Object.entries(s)){if(!u.has(a)){y("bindingsDeclared",{key:a,detail:`bindings.unbound names "${a}", which is not a prop that can carry a canvas handle (unknown, hidden, a closed set, a boolean, a group, an m0 prop or code) \u2014 drop the entry.`});continue}if(Y.has(a)){y("bindingsDeclared",{key:a,detail:`bindings.unbound says "${a}" has no canvas handle, but a source binds it \u2014 drop the entry, the binding is the truth.`});continue}(typeof h!="string"||h.trim().length===0)&&y("bindingsDeclared",{key:a,detail:`bindings.unbound["${a}"] has no reason \u2014 one honest word is the point of the declaration (e.g. "timing", "geometry", "determinism").`})}}if(D.length>0){const s=new Map;(0,auditSchemaConventions_1.walkPropDefinitions)(R,(u,p)=>s.set(u,p));const d=[];forEachSourceInTree(D,u=>{for(const p of(0,platform_1.sourceBindings)(u.editor)){if(p.companion)continue;const a=s.get(p.propKey);if(!a)continue;const h=p.hint;typeof h=="string"&&h.trim()||typeof a.description=="string"&&a.description.trim()||d.includes(p.propKey)||d.push(p.propKey)}});for(const u of d)y("bindingHints",{key:u,detail:`the rect bound to "${u}" shows nothing in context \u2014 a person who double-clicks it sees a label and a value, and nothing says what changing it does. Give the prop a description (propsSchema.${u}.description = "what it does and what it looks like"), or the binding its own line (bindProp(src, "${u}", i, { hint }) / withBindingHint(src, "\u2026")).`})}const Z=(j=t.canvas)===null||j===void 0?void 0:j.baseRect,et=typeof Z=="string"&&Z.trim().length>0;if(typeof Z=="string"&&!et&&y("canvasFill",{key:"canvas.baseRect",detail:'canvas.baseRect is declared with no reason \u2014 say why this template ships a full-canvas rect (e.g. "the lesson IS the full-rect base under two overlays"), or drop the field and use document.backgroundColor.'}),!et&&valueAt(H,exports.NESTED_BG_PROP)!==!0)for(const s of D){const{framesByLogical:d}=(0,frameResolution_1.resolveDocFrames)(s,k,w),u=(q=s.sources)!==null&&q!==void 0?q:[];for(let p=0;p<d.length;p++){const a=d[p],h=u[p];!a||!h||!isPlainColorFill(h)||a.x!==0||a.y!==0||a.width!==k||a.height!==w||y("canvasFill",{key:`source[${p}]`,detail:`source ${p} is a static ${String((I=h.color)!==null&&I!==void 0?I:(E=h.visual)===null||E===void 0?void 0:E.backgroundColor)} fill covering the whole ${k}\xD7${w} canvas \u2014 set document.backgroundColor instead and drop the source. A base rect is a click target over everything: in Make it is selected whenever the pointer is not on a smaller tile. (A template whose SUBJECT is that rect declares it: canvas.baseRect = "<why>". A template that must ship it because it is composed INTO another uses defaultProps.${exports.NESTED_BG_PROP} = true instead.)`})}}if(D.length>0){const s=D.flatMap(drawnTextOf),d=c((a,h,S)=>{if(S.some(A=>A.boundTo.length===0))return`"${a}" (${h}) is drawn as text but no source binds it \u2014 wrap the source that shows it: bindProp(src, "${a}").`;const B=[...new Set(S.flatMap(A=>A.boundTo))].map(A=>`"${A}"`).join(" / ");return`"${a}" (${h}) is drawn as text, but every rect that shows it already binds ${B} \u2014 a composite line. Add this prop to that rect: bindProps(src, [\u2026 , { propKey: "${a}" }]), or split the line so each prop has its own rect.`},"coverage");for(const a of freeTextProps(R)){const h=valueAt(H,a);if(typeof h!="string"||h.trim().length<2||X.has(a))continue;const S=s.filter(B=>B.text.includes(h));S.length!==0&&y("bindingsCover",{key:a,detail:d(a,`default ${JSON.stringify(h.length>40?`${h.slice(0,37)}\u2026`:h)}`,S)})}for(const a of drawnNumberProps(R)){const h=valueAt(H,a);if(typeof h!="number"||X.has(a))continue;let S,B=[];for(const A of numberSpellings(h))if(B=s.filter(J=>drawnAsNumber(J.text,A)),B.length>0){S=A;break}S&&y("bindingsCover",{key:a,detail:d(a,`default ${h}, drawn as ${JSON.stringify(S)}`,B)})}let u=!1;const p=new Set;for(const a of s){if(!a.svg)continue;const h=[...a.text].filter(A=>A.charCodeAt(0)>127&&A!==`
|
|
5
|
-
`);if(
|
|
1
|
+
"use strict";var ie=Object.defineProperty;var c=(e,t)=>ie(e,"name",{value:t,configurable:!0});Object.defineProperty(exports,"__esModule",{value:!0}),exports.CANVAS_FILL_SHAPED_SINCE=exports.NESTED_BG_PROP=exports.COST_BUDGETS=exports.STANDARD_SWEEP_CANVASES=void 0,exports.fingerprintHash=fingerprintHash,exports.layoutFingerprintOf=layoutFingerprintOf,exports.diffLayoutFingerprint=diffLayoutFingerprint,exports.layoutFingerprintFinding=layoutFingerprintFinding,exports.accountableProps=accountableProps,exports.numberSpellings=numberSpellings,exports.drawnAsNumber=drawnAsNumber,exports.auditRenderedTemplate=auditRenderedTemplate,exports.auditCatalogSidecar=auditCatalogSidecar;const resolveTemplateOutputHints_1=require("./resolveTemplateOutputHints"),dsl_1=require("@m0saic/dsl"),text_1=require("@m0saic/text"),platform_1=require("@m0saic/platform"),frameResolution_1=require("../geometry-contract/frameResolution"),latticeReport_1=require("../lattice/latticeReport"),auditSchemaConventions_1=require("./auditSchemaConventions"),templateRegistry_1=require("./templateRegistry"),platform_2=require("@m0saic/platform"),templateConventions_1=require("./templateConventions");exports.STANDARD_SWEEP_CANVASES=[{width:1920,height:1080},{width:1080,height:1920},{width:1080,height:1080}],exports.COST_BUDGETS={frames:400,sources:400,overlayDepth:20,inlineMasks:200};const RENDER_TIME_CONVENTIONS=["rendersAtDefaults","bindingsSound","bindingsCover","bindingsDeclared","bindingHints","canvasFill","svgGlyphCoverage","safeMinimumCanvas","canvasEnvelope","deterministic","textFits","costBudget","latticeSmooth"];function fingerprintHash(e){let t=2166136261,n=-2145608618;for(let o=0;o<e.length;o++){const i=e.charCodeAt(o);t=Math.imul(t^i,16777619)>>>0,n=Math.imul(n^i+o,16777619)>>>0}return t.toString(16).padStart(8,"0")+n.toString(16).padStart(8,"0")}c(fingerprintHash,"fingerprintHash");function layoutFingerprintOf(e,t,n){const o=[];let i=0;for(const s of e){const f=flattenedM0(s,t,n);if(f){o.push(f);try{i+=(0,dsl_1.getComplexityMetricsFast)(f).frameCount}catch{}}}if(o.length===0)return;const r=o.join(`
|
|
2
|
+
`);return{canvas:{width:t,height:n},docs:o,m0:r,hash:fingerprintHash(r),chars:r.length,frames:i}}c(layoutFingerprintOf,"layoutFingerprintOf");function diffLayoutFingerprint(e,t){if(e===t)return{same:!0,detail:""};let n=0;const o=Math.min(e.length,t.length);for(;n<o&&e[n]===t[n];)n++;const i=c(s=>{try{return String((0,dsl_1.getComplexityMetricsFast)(s.split(`
|
|
3
|
+
`)[0]).frameCount)}catch{return"?"}},"frames"),r=c(s=>s.slice(Math.max(0,n-12),n+28).replace(/\n/g,"\u23CE"),"snip");return{same:!1,detail:`flattened layout differs from the committed fingerprint at char ${n} (committed ${e.length} chars / ${i(e)} frames \u2192 now ${t.length} chars / ${i(t)} frames): \u2026${r(e)}\u2026 \u2192 \u2026${r(t)}\u2026`}}c(diffLayoutFingerprint,"diffLayoutFingerprint");function layoutFingerprintFinding(e,t,n,o=!1){const i=diffLayoutFingerprint(t,n);return i.same?null:(0,templateConventions_1.makeTemplateConventionFinding)(e,"layoutFingerprint",[{key:"layout",detail:i.detail}],o)}c(layoutFingerprintFinding,"layoutFingerprintFinding");function costViolations(e,t,n){var o;const i=[],r=flattenedM0(e,t,n);if(!r||!(0,dsl_1.validateM0String)(r).ok)return i;const s=c((b,F,E,O=null)=>{if(F>exports.COST_BUDGETS[b]){const R=O===null?"":` on child document "${O}"`;i.push({key:b,detail:`${b} ${F}${R} exceeds the budget of ${exports.COST_BUDGETS[b]} \u2014 ${E}`})}},"over");let f=0;try{f=(0,dsl_1.getComplexityMetricsFast)(r).frameCount}catch{}s("frames",f,"past a few hundred tiles the planner's per-process budgets bite and the canvas blanks.");const g=(o=e.sources)!==null&&o!==void 0?o:[];s("sources",g.length,"every source is an ffmpeg input or filter; hundreds multiply the graph.");let h={value:0,node:null},v={value:0,node:null};return forEachDocumentNode(e,(b,F)=>{var E,O,R,I;const M=((E=b.sources)!==null&&E!==void 0?E:[]).filter(S=>{var $;return S&&typeof S=="object"&&(($=S.mask)===null||$===void 0?void 0:$.kind)==="inline-mask"}).length;if(M>v.value&&(v={value:M,node:F}),M===0||typeof b.m0!="string")return;const C=b.size;let P=0;try{const S=(0,dsl_1.parseM0StringComplete)(b.m0,(O=C?.width)!==null&&O!==void 0?O:t,(R=C?.height)!==null&&R!==void 0?R:n);if(S.ok)for(const $ of S.ir.editorFrames)P=Math.max(P,Number((I=$.overlayDepth)!==null&&I!==void 0?I:0))}catch{}P>h.value&&(h={value:P,node:F})}),s("overlayDepth",h.value,"the engine drops inline masks past ~25 overlay layers on one node; nest a child document instead.",h.node),s("inlineMasks",v.value,"hundreds of inline masks on one node overflow the mask resolver's argv.",v.node),i}c(costViolations,"costViolations");function forEachDocumentNode(e,t,n=null,o=new Set){var i,r;if(!e||typeof e!="object"||o.has(e)||(o.add(e),((r=(i=e.engine)===null||i===void 0?void 0:i.lattice)===null||r===void 0?void 0:r.mode)==="bitmap"))return;t(e,n);const s=e.children;if(!(!s||typeof s!="object"))for(const[f,g]of Object.entries(s)){const h=g?.kind;if(!(typeof h=="string"&&h.startsWith("mosaicx_")))for(const v of documentsOf(g))forEachDocumentNode(v,t,f,o)}}c(forEachDocumentNode,"forEachDocumentNode");function sides(e){if(typeof e=="number")return{top:e,right:e,bottom:e,left:e};const t=e??{},n=c((r,s)=>typeof t[r]=="number"?t[r]:s,"n"),o=n("x",0),i=n("y",0);return{top:n("top",i),right:n("right",o),bottom:n("bottom",i),left:n("left",o)}}c(sides,"sides");function firstDiff(e,t,n="$"){if(e===t)return null;if(typeof e!=typeof t||e===null||t===null||typeof e!="object"||Array.isArray(e)!==Array.isArray(t))return n;const o=Object.keys(e),i=Object.keys(t);for(const r of new Set([...o,...i])){const s=firstDiff(e[r],t[r],`${n}.${r}`);if(s)return s}return null}c(firstDiff,"firstDiff");function textFitViolations(e,t,n,o){var i;const r=[],{framesByLogical:s}=(0,frameResolution_1.resolveDocFrames)(e,t,n);return((i=e.sources)!==null&&i!==void 0?i:[]).forEach((g,h)=>{var v,b,F,E;if(!g||g.type!=="text"||g.rasterizer!=="svg"||!Array.isArray(g.layers))return;const O=s[h];if(!O)return;const R=(v=g.style)!==null&&v!==void 0?v:{},I=(b=g.placement)!==null&&b!==void 0?b:{};for(const[L,M]of g.layers.entries()){const C=M?.content;if(!C||C.kind!=="literal"||typeof C.text!="string"||!C.text.trim())continue;const P={...R,...(F=M.style)!==null&&F!==void 0?F:{}},S=P.fontSize;if(typeof S!="number"||!(S>0))continue;const $={...I,...(E=M.placement)!==null&&E!==void 0?E:{}},w=sides($.inset),_=sides($.padding),V=O.width*Math.max(0,1-w.left-w.right),K=O.height*Math.max(0,1-w.top-w.bottom),W=c(N=>typeof N=="number"?N:typeof N=="string"&&/^-?\d+(\.\d+)?$/.test(N.trim())?Number(N):0,"px"),H=V*Math.max(0,1-_.left-_.right)-Math.max(0,W($.xExpr)),x=K*Math.max(0,1-_.top-_.bottom)-Math.max(0,W($.yExpr)),G=fontFor({family:typeof P.fontFamily=="string"?P.fontFamily:void 0,weight:P.fontWeight,style:P.fontStyle});let k;try{k=(0,text_1.measureText)(C.text,{fontSize:S,...G?{fontPath:G.path}:{}})}catch(N){o.push(`textFits: could not measure src[${h}] layer ${L}: ${firstLine(N)}`);continue}const B=typeof P.lineHeight=="number"?P.lineHeight:1.25,q=S+Math.max(0,k.lines-1)*S*B,U=Math.max(1,S*.1);if(k.width>H+U||q>x+U){const N=C.text.replace(/\s+/g," ").slice(0,32)+(C.text.length>32?"\u2026":"");r.push({key:`src[${h}]${g.layers.length>1?`.layer[${L}]`:""}`,detail:`"${N}" at ${S}px needs ${Math.round(k.width)}\xD7${Math.round(q)} px but its cell offers ${Math.round(H)}\xD7${Math.round(x)} px at ${t}\xD7${n} \u2014 svg text clips silently.`})}}}),r}c(textFitViolations,"textFitViolations");const dims=c(e=>`${Math.round(e.width)}\xD7${Math.round(e.height)}`,"dims");function flattenedM0(e,t,n){const o=!!e.children&&Object.keys(e.children).length>0;try{const i=(0,platform_1.flattenMosaicDocument)({file:e,width:t,height:n,resolveRef:c(()=>null,"resolveRef")});if(i.ok)return String(i.file.m0)}catch{}return o?null:String(e.m0)}c(flattenedM0,"flattenedM0");function floorViolations(e,t,n){const o=[];for(const i of e){const r=flattenedM0(i,t,n);if(!r)continue;const s=(0,platform_1.checkLayoutFloors)(r,{width:t,height:n});if(!s||!s.below)continue;const f=s.floors;o.push({key:dims({width:t,height:n}),detail:`at ${dims({width:t,height:n})} the layout's safe minimum is ${dims(f.safeMin)} (feasibility ${dims(f.feasibility)}, precision ${dims(f.precision)}) \u2014 `+(s.culls?"cells are culled: content is missing.":"cells are squashed.")})}return o}c(floorViolations,"floorViolations");function ctxFor(e,t,n,o,i){const r={width:e,height:t,fps:n,durationMs:o};return{mode:"render",target:r,output:{...r,workspaceDir:i},media:{}}}c(ctxFor,"ctxFor");function firstLine(e){return(e instanceof Error?e.message:String(e)).split(`
|
|
4
|
+
`)[0].slice(0,200)}c(firstLine,"firstLine");function documentsOf(e){const t=e;return!t||typeof t!="object"?[]:t.kind==="mosaic_document"&&Array.isArray(t.sources)?[t]:t.kind==="mosaic_pipeline"&&Array.isArray(t.steps)?t.steps.map(n=>n.file).filter(n=>!!n&&typeof n=="object"&&Array.isArray(n.sources)):[]}c(documentsOf,"documentsOf");function collectM0Strings(e,t=[],n={mosaicx:0,bitmap:0},o=new Set){var i,r;if(o.has(e))return{m0s:t,skipped:n};if(o.add(e),((r=(i=e.engine)===null||i===void 0?void 0:i.lattice)===null||r===void 0?void 0:r.mode)==="bitmap")return n.bitmap++,{m0s:t,skipped:n};typeof e.m0=="string"&&t.push(e.m0);const s=e.children;if(s&&typeof s=="object")for(const f of Object.values(s)){const g=f?.kind;if(typeof g=="string"&&g.startsWith("mosaicx_")){n.mosaicx++;continue}for(const h of documentsOf(f))collectM0Strings(h,t,n,o)}return{m0s:t,skipped:n}}c(collectM0Strings,"collectM0Strings");function drawnTextOf(e){var t,n,o;const i=[];for(const r of(t=e.sources)!==null&&t!==void 0?t:[]){if(!r||r.type!=="text"||!Array.isArray(r.layers))continue;const s=r.rasterizer==="svg",f=(n=r.style)!==null&&n!==void 0?n:{},g=(0,platform_1.sourceBindings)(r.editor).map(h=>h.propKey).filter(h=>typeof h=="string");for(const h of r.layers){const v=h?.content;if(!v||v.kind!=="literal"||typeof v.text!="string")continue;const b={...f,...(o=h.style)!==null&&o!==void 0?o:{}};i.push({text:v.text,svg:s,boundTo:g,family:typeof b.fontFamily=="string"?b.fontFamily:void 0,weight:b.fontWeight,style:b.fontStyle})}}return i}c(drawnTextOf,"drawnTextOf");const CLOSED_OR_PICKED=c(e=>{var t,n;const o=(t=e.meta)===null||t===void 0?void 0:t.constraints,i=(n=e.meta)===null||n===void 0?void 0:n.control;return!!(Array.isArray(o?.oneOf)&&o.oneOf.length>0||o?.isColor||Array.isArray(i?.options)&&i.options.length>0||i?.optionsFrom||i?.optionsFromConnection||i?.colorPicker||i?.picker)},"CLOSED_OR_PICKED");function freeTextProps(e){const t=[];return(0,auditSchemaConventions_1.walkPropDefinitions)(e,(n,o)=>{var i,r,s,f;o.type==="string"&&(!((r=(i=o.meta)===null||i===void 0?void 0:i.ui)===null||r===void 0)&&r.hidden||((f=(s=o.meta)===null||s===void 0?void 0:s.ui)===null||f===void 0?void 0:f.consumer)!=="human"&&(CLOSED_OR_PICKED(o)||t.push(n)))}),t}c(freeTextProps,"freeTextProps");function accountableProps(e){const t=[];return(0,auditSchemaConventions_1.walkPropDefinitions)(e,(n,o)=>{var i,r,s,f,g,h,v,b;if(!((r=(i=o.meta)===null||i===void 0?void 0:i.ui)===null||r===void 0)&&r.hidden||((f=(s=o.meta)===null||s===void 0?void 0:s.ui)===null||f===void 0?void 0:f.consumer)==="human")return;const F=!!(!((h=(g=o.meta)===null||g===void 0?void 0:g.constraints)===null||h===void 0)&&h.isColor||!((b=(v=o.meta)===null||v===void 0?void 0:v.control)===null||b===void 0)&&b.colorPicker);switch(o.type){case"string":F?t.push({key:n,kind:"color"}):CLOSED_OR_PICKED(o)||t.push({key:n,kind:"string"});return;case"number":CLOSED_OR_PICKED(o)||t.push({key:n,kind:"number"});return;case"media":t.push({key:n,kind:"media"});return;case"string[]":t.push({key:n,kind:F?"color element":"string element"});return;case"number[]":t.push({key:n,kind:"number element"});return;case"media[]":t.push({key:n,kind:"media element"});return;case"json":case"list":case"array":t.push({key:n,kind:isRectPicker(o)?"rect":"leaf"});return;default:return}}),t}c(accountableProps,"accountableProps"),exports.NESTED_BG_PROP="useNestedBackgroundColor",exports.CANVAS_FILL_SHAPED_SINCE="0.3.1";function isStaticOpaqueFill(e){var t;return e.overlay||e.mask||e.placement?!1:e.type==="lavfi"?typeof e.color=="string":e.type==="text"?typeof((t=e.visual)===null||t===void 0?void 0:t.backgroundColor)!="string"?!1:(Array.isArray(e.layers)?e.layers:[]).every(o=>{const i=o?.content;return!i||i.kind!=="literal"||typeof i.text!="string"||i.text.trim()===""}):!1}c(isStaticOpaqueFill,"isStaticOpaqueFill");function forEachSourceInTree(e,t,n=new Set){var o;for(const i of e){if(!i||typeof i!="object"||n.has(i))continue;n.add(i);for(const s of(o=i.sources)!==null&&o!==void 0?o:[])s&&typeof s=="object"&&t(s);const r=i.children;if(r&&typeof r=="object")for(const s of Object.values(r))forEachSourceInTree(documentsOf(s),t,n)}}c(forEachSourceInTree,"forEachSourceInTree");function backgroundColorsOf(e,t=new Set,n=new Set){if(!e||typeof e!="object"||n.has(e))return t;n.add(e);const o=e.backgroundColor;typeof o=="string"&&o.trim()&&t.add(o.trim().toLowerCase());const i=e.children;if(i&&typeof i=="object")for(const r of Object.values(i))for(const s of documentsOf(r))backgroundColorsOf(s,t,n);return t}c(backgroundColorsOf,"backgroundColorsOf");function isRectPicker(e){var t;const n=(t=e.meta)===null||t===void 0?void 0:t.control;return n?.picker==="regions"}c(isRectPicker,"isRectPicker");function drawnNumberProps(e){const t=[];return(0,auditSchemaConventions_1.walkPropDefinitions)(e,(n,o)=>{var i,r,s,f;o.type==="number"&&(!((r=(i=o.meta)===null||i===void 0?void 0:i.ui)===null||r===void 0)&&r.hidden||((f=(s=o.meta)===null||s===void 0?void 0:s.ui)===null||f===void 0?void 0:f.consumer)!=="human"&&(CLOSED_OR_PICKED(o)||t.push(n)))}),t}c(drawnNumberProps,"drawnNumberProps");function numberSpellings(e){if(!Number.isFinite(e))return[];const t=[String(e),e.toLocaleString("en-US")];return Number.isInteger(e)||t.push(e.toFixed(1),e.toFixed(2)),[...new Set(t)].filter(n=>n.length>=2)}c(numberSpellings,"numberSpellings");const DIGIT=/[0-9]/,digitAt=c((e,t)=>{var n;return DIGIT.test((n=e[t])!==null&&n!==void 0?n:"")},"digitAt");function drawnAsNumber(e,t){let n=e.indexOf(t);for(;n>=0;){const o=n+t.length,i=e[n-1],r=e[o],s=!digitAt(e,n-1)&&!((i==="."||i===",")&&digitAt(e,n-2)),f=!digitAt(e,o)&&!((r==="."||r===",")&&digitAt(e,o+1));if(s&&f)return!0;n=e.indexOf(t,n+1)}return!1}c(drawnAsNumber,"drawnAsNumber");function valueAt(e,t){return t.split(".").reduce((n,o)=>n&&typeof n=="object"?n[o]:void 0,e)}c(valueAt,"valueAt");function fontFor(e){var t,n;try{(0,text_1.registerBundledFonts)();const o=(0,text_1.resolveFontFile)({family:e.family,weight:e.weight,style:e.style});return{path:(t=o?.path)!==null&&t!==void 0?t:(0,text_1.bundledFontPath)(),label:(n=e.family)!==null&&n!==void 0?n:"the bundled font"}}catch{return null}}c(fontFor,"fontFor");function loadFont(e){const t=(0,text_1.getCachedFont)(e);if(t)return t;try{const n=(0,text_1.getOpentype)();if(typeof n.loadSync!="function")return null;const o=n.loadSync(e);return(0,text_1.setCachedFont)(e,o),o}catch{return null}}c(loadFont,"loadFont");async function auditRenderedTemplate(e,t={}){var n,o,i;const r=await auditRenderedTemplateCore(e,t),s=String(e.id),f=(0,templateRegistry_1.getTemplate)(s)===e&&(n=(0,templateRegistry_1.getTemplateAsRegistered)(s))!==null&&n!==void 0?n:e,g=auditCatalogSidecar(f),h=(o=t.record)!==null&&o!==void 0?o:!0;if(g.length===0)return h&&(0,templateConventions_1.clearTemplateConventionFinding)(s,"catalogSidecar"),r;const v=(0,templateConventions_1.makeTemplateConventionFinding)(s,"catalogSidecar",g,(i=t.external)!==null&&i!==void 0?i:!1);return(0,templateConventions_1.isConventionBeyond)("catalogSidecar",(0,templateConventions_1.effectiveConventionLine)(t.shippedAt,t.conventionsTarget))?(r.lagging.push(v),h&&(0,templateConventions_1.clearTemplateConventionFinding)(s,"catalogSidecar"),r):(h&&(0,templateConventions_1.recordTemplateConventionFinding)(v),r.findings.push(v),r)}c(auditRenderedTemplate,"auditRenderedTemplate");function auditCatalogSidecar(e){const t=Object.keys((0,platform_2.authoredCatalogFields)(e)).map(o=>({key:o,detail:`"${o}" is declared in the template's code \u2014 since 0.3.1 it lives in the template's catalog sidecar (<name>.catalog.json beside the module): code is immutable once shipped, its description may change.`})),n=(0,platform_2.authoredPropCopy)(e).map(o=>({key:`props.${o}`,detail:`prop presentation "${o}" is declared in propsSchema \u2014 since 0.3.1 it lives in the catalog sidecar under props (what a value IS stays in the schema; how Make presents it does not).`}));return[...t,...n]}c(auditCatalogSidecar,"auditCatalogSidecar");async function auditRenderedTemplateCore(e,t){var n,o,i,r,s,f,g,h,v,b,F,E,O,R,I,L,M,C,P;const S=String(e.id),$=(0,resolveTemplateOutputHints_1.resolveTemplateOutputHints)(e,e.defaultProps),w=(n=t.width)!==null&&n!==void 0?n:typeof $.width=="number"?$.width:1280,_=(o=t.height)!==null&&o!==void 0?o:typeof $.height=="number"?$.height:720,V=typeof $.fps=="number"?$.fps:30,K=typeof $.durationMs=="number"?$.durationMs:4e3,W=(i=t.external)!==null&&i!==void 0?i:!1,H=(r=t.record)!==null&&r!==void 0?r:!0,x={templateId:S,canvas:{width:w,height:_},notes:[],findings:[],lagging:[]},G=new Map,k=c((l,d)=>{var u;const m=(u=G.get(l))!==null&&u!==void 0?u:[];m.some(a=>a.key===d.key&&a.detail===d.detail)||m.push(d),G.set(l,m)},"push");if(((s=e.capabilities)===null||s===void 0?void 0:s.tier)==="capability")return x.skipped="capability tier \u2014 needs host handles a bare ctx cannot supply",x;const B=e.propsSchema,q=(f=e.defaultProps)!==null&&f!==void 0?f:{},U=c(()=>({...(0,templateRegistry_1.deepFreezeTemplate)(q)}),"productionDefaults"),N=Object.entries(B??{}).filter(([l,d])=>d?.required&&q[l]===void 0).map(([l])=>l);let z;try{const l=ctxFor(w,_,V,K,(g=t.workspaceDir)!==null&&g!==void 0?g:"/tmp/m0saic-template-audit");z=await e.render(U(),l)}catch(l){if(N.length>0)return x.skipped=`requires inputs with no default: ${N.join(", ")}`,x;k("rendersAtDefaults",{key:"render",detail:`render(defaultProps) at ${w}\xD7${_} threw: ${firstLine(l)}`})}const D=documentsOf(z);for(const l of floorViolations(D,w,_))k("safeMinimumCanvas",l);if(z!==void 0)try{const l=ctxFor(w,_,V,K,(h=t.workspaceDir)!==null&&h!==void 0?h:"/tmp/m0saic-template-audit"),d=await e.render(U(),l),u=JSON.parse(JSON.stringify(z)),m=JSON.parse(JSON.stringify(d)),a=firstDiff(u,m);a&&k("deterministic",{key:a,detail:`two renders of defaultProps at ${w}\xD7${_} differ at ${a} \u2014 a clock, Math.random, an ambient read, or a per-call id is leaking into the document.`})}catch(l){k("deterministic",{key:"render",detail:`the second render of defaultProps threw where the first did not: ${firstLine(l)}`})}for(const l of D){for(const d of textFitViolations(l,w,_,x.notes))k("textFits",d);for(const d of costViolations(l,w,_))k("costBudget",d)}const A=e.lattice,Q=((v=A?.allow)!==null&&v!==void 0?v:[]).filter(l=>l&&Number.isSafeInteger(l.count)&&l.count>0),ee=c((l,d,u)=>{const m={m0s:[],skipped:{mosaicx:0,bitmap:0}};for(const p of l)collectM0Strings(p,m.m0s,m.skipped);m.skipped.mosaicx>0&&x.notes.push(`latticeSmooth: ${m.skipped.mosaicx} mosaicx child(ren) not scanned at ${dims(d)} (invocations, not geometry)`),m.skipped.bitmap>0&&x.notes.push(`latticeSmooth: ${m.skipped.bitmap} bitmap child document(s) skipped at ${dims(d)} (engine.lattice.mode)`);const a=A?.canvas==="physical";for(const p of(0,latticeReport_1.latticeViolations)(m.m0s,{canvas:d,allow:Q.map(y=>y.count),physicalCanvas:a}))k("latticeSmooth",u?{key:`${u}:${p.key}`,detail:`at ${dims(d)}: ${p.detail}`}:p)},"latticeCheck");D.length>0&&(A?.mode==="bitmap"?x.notes.push('latticeSmooth: skipped \u2014 lattice.mode is "bitmap" (a baked raster is never live-composed)'):(Q.length>0&&x.notes.push(`latticeSmooth: allowed content counts ${Q.map(l=>`${l.count} (${l.reason})`).join(", ")}`),A?.canvas==="physical"&&x.notes.push(`latticeSmooth: hinted canvas ${w}\xD7${_} declared physical (lattice.canvas) \u2014 a rough axis is not reported; the counts it explains are charged to it`),ee(D,{width:w,height:_},""))),x.layout=layoutFingerprintOf(D,w,_);for(const l of(b=t.sweepCanvases)!==null&&b!==void 0?b:[])if(!(l.width===w&&l.height===_))try{const d=ctxFor(l.width,l.height,V,K,(F=t.workspaceDir)!==null&&F!==void 0?F:"/tmp/m0saic-template-audit"),u=documentsOf(await e.render(U(),d));for(const m of floorViolations(u,l.width,l.height))k("canvasEnvelope",m);u.length>0&&A?.mode!=="bitmap"&&A?.canvas!=="physical"&&ee(u,{width:l.width,height:l.height},dims(l))}catch(d){x.notes.push(`canvasEnvelope: render at ${dims(l)} threw: ${firstLine(d)}`)}const X=new Set,Y=new Set;for(const l of D){const d=(0,frameResolution_1.resolvePropBindings)(l,w,_,{propsSchema:B});for(const[u,m]of Object.entries(d.byProp))m.some(a=>a.childPath.length===0)&&X.add(u),Y.add(u);for(const u of d.rejected)u.childPath.length>0||k("bindingsSound",{key:u.propKey,detail:`binding on "${u.propKey}" was rejected (${u.reason}) \u2014 ${REJECTION_HINT[u.reason]}`})}if(D.length>0){const l=(O=(E=e.bindings)===null||E===void 0?void 0:E.unbound)!==null&&O!==void 0?O:{},d=accountableProps(B),u=new Set(d.map(a=>a.key)),m=new Set;for(const a of D)backgroundColorsOf(a,m);for(const{key:a,kind:p}of d)if(!Y.has(a)){if(p==="color"){const y=valueAt(q,a);if(typeof y=="string"&&m.has(y.trim().toLowerCase()))continue}Object.prototype.hasOwnProperty.call(l,a)||k("bindingsDeclared",{key:a,detail:`"${a}" can carry a ${p} handle but nothing binds it \u2014 bind the rect that shows it (bindProp(src, "${a}")), or declare why it has none: bindings.unbound = { "${a}": "<reason>" }.`})}for(const[a,p]of Object.entries(l)){if(!u.has(a)){k("bindingsDeclared",{key:a,detail:`bindings.unbound names "${a}", which is not a prop that can carry a canvas handle (unknown, hidden, a closed set, a boolean, a group, an m0 prop or code) \u2014 drop the entry.`});continue}if(Y.has(a)){k("bindingsDeclared",{key:a,detail:`bindings.unbound says "${a}" has no canvas handle, but a source binds it \u2014 drop the entry, the binding is the truth.`});continue}(typeof p!="string"||p.trim().length===0)&&k("bindingsDeclared",{key:a,detail:`bindings.unbound["${a}"] has no reason \u2014 one honest word is the point of the declaration (e.g. "timing", "geometry", "determinism").`})}}if(D.length>0){const l=new Map;(0,auditSchemaConventions_1.walkPropDefinitions)(B,(u,m)=>l.set(u,m));const d=[];forEachSourceInTree(D,u=>{for(const m of(0,platform_1.sourceBindings)(u.editor)){if(m.companion)continue;const a=l.get(m.propKey);if(!a)continue;const p=m.hint;typeof p=="string"&&p.trim()||typeof a.description=="string"&&a.description.trim()||d.includes(m.propKey)||d.push(m.propKey)}});for(const u of d)k("bindingHints",{key:u,detail:`the rect bound to "${u}" shows nothing in context \u2014 a person who double-clicks it sees a label and a value, and nothing says what changing it does. Give the prop a description (propsSchema.${u}.description = "what it does and what it looks like"), or the binding its own line (bindProp(src, "${u}", i, { hint }) / withBindingHint(src, "\u2026")).`})}const Z=(R=e.canvas)===null||R===void 0?void 0:R.baseRect,te=typeof Z=="string"&&Z.trim().length>0;if(typeof Z=="string"&&!te&&k("canvasFill",{key:"canvas.baseRect",detail:'canvas.baseRect is declared with no reason \u2014 say why this template ships a full-canvas rect (e.g. "the lesson IS the full-rect base under two overlays"), or drop the field and use document.backgroundColor.'}),!te&&valueAt(q,exports.NESTED_BG_PROP)!==!0){const l=(()=>{const d=(0,templateConventions_1.effectiveConventionLine)(t.shippedAt,t.conventionsTarget);return typeof d=="string"&&(0,templateConventions_1.compareConventionVersions)(d,exports.CANVAS_FILL_SHAPED_SINCE)<0})();for(const d of D){const{framesByLogical:u}=(0,frameResolution_1.resolveDocFrames)(d,w,_),m=(I=d.sources)!==null&&I!==void 0?I:[];for(let a=0;a<u.length;a++){const p=u[a],y=m[a];if(!p||!y||!isStaticOpaqueFill(y)||p.x!==0||p.y!==0||p.width!==w||p.height!==_||y.effects&&l||(0,platform_1.sourceBindings)(y.editor).length>0)continue;const j=y.effects?" (rounded or stroked \u2014 its corners do not change what a click on it does)":"";k("canvasFill",{key:`source[${a}]`,detail:`source ${a} is a static ${String((L=y.color)!==null&&L!==void 0?L:(M=y.visual)===null||M===void 0?void 0:M.backgroundColor)} fill covering the whole ${w}\xD7${_} canvas${j} and no prop is bound to it \u2014 set document.backgroundColor instead and drop the source, or make the rect a handle (bindProp(src, "<the prop it should edit>") \u2014 a card bound to the theme preset is where the theme gets changed). A base rect nothing binds is a click target over everything: in Make it is selected whenever the pointer is not on a smaller tile, and the click does nothing. (A template whose SUBJECT is that rect declares it: canvas.baseRect = "<why>". A template that must ship it because it is composed INTO another uses defaultProps.${exports.NESTED_BG_PROP} = true instead.)`})}}}if(D.length>0){const l=D.flatMap(drawnTextOf),d=c((a,p,y)=>{if(y.some(T=>T.boundTo.length===0))return`"${a}" (${p}) is drawn as text but no source binds it \u2014 wrap the source that shows it: bindProp(src, "${a}").`;const j=[...new Set(y.flatMap(T=>T.boundTo))].map(T=>`"${T}"`).join(" / ");return`"${a}" (${p}) is drawn as text, but every rect that shows it already binds ${j} \u2014 a composite line. Add this prop to that rect: bindProps(src, [\u2026 , { propKey: "${a}" }]), or split the line so each prop has its own rect.`},"coverage");for(const a of freeTextProps(B)){const p=valueAt(q,a);if(typeof p!="string"||p.trim().length<2||X.has(a))continue;const y=l.filter(j=>j.text.includes(p));y.length!==0&&k("bindingsCover",{key:a,detail:d(a,`default ${JSON.stringify(p.length>40?`${p.slice(0,37)}\u2026`:p)}`,y)})}for(const a of drawnNumberProps(B)){const p=valueAt(q,a);if(typeof p!="number"||X.has(a))continue;let y,j=[];for(const T of numberSpellings(p))if(j=l.filter(J=>drawnAsNumber(J.text,T)),j.length>0){y=T;break}y&&k("bindingsCover",{key:a,detail:d(a,`default ${p}, drawn as ${JSON.stringify(y)}`,j)})}let u=!1;const m=new Set;for(const a of l){if(!a.svg)continue;const p=[...a.text].filter(T=>T.charCodeAt(0)>127&&T!==`
|
|
5
|
+
`);if(p.length===0)continue;const y=fontFor(a),j=y?loadFont(y.path):null;if(!j){u=!0;continue}for(const T of p){const J=(C=T.codePointAt(0))!==null&&C!==void 0?C:0,ne=`${y.path}:${J}`;m.has(ne)||(m.add(ne),j.charToGlyph(T).index===0&&k("svgGlyphCoverage",{key:`U+${J.toString(16).toUpperCase().padStart(4,"0")}`,detail:`"${T}" (U+${J.toString(16).toUpperCase().padStart(4,"0")}) has no glyph in ${y.label} \u2014 it renders as tofu.`}))}}u&&x.notes.push("svgGlyphCoverage: a font could not be loaded on this host; the rule was not fully checked")}const oe=(0,templateConventions_1.effectiveConventionLine)(t.shippedAt,t.conventionsTarget);for(const l of RENDER_TIME_CONVENTIONS){const d=(P=G.get(l))!==null&&P!==void 0?P:[];if(d.length===0){H&&(0,templateConventions_1.clearTemplateConventionFinding)(S,l);continue}const u=(0,templateConventions_1.makeTemplateConventionFinding)(S,l,d,W);if((0,templateConventions_1.isConventionBeyond)(l,oe)){x.lagging.push(u),H&&(0,templateConventions_1.clearTemplateConventionFinding)(S,l);continue}H&&(0,templateConventions_1.recordTemplateConventionFinding)(u),x.findings.push(u)}return x}c(auditRenderedTemplateCore,"auditRenderedTemplateCore");const REJECTION_HINT={"unknown-prop":'no such prop in propsSchema (check the dotted path; group fields nest as "group.field").',"unsupported-type":'that prop type is not bindable (closed pickers, media, booleans, and whole lists never are; a rect binding fits only a json prop with picker: "regions" and regions.max: 1).',"index-required":"a string[] / number[] prop binds ONE element \u2014 pass the index (bindProp(src, key, i)).","path-required":'a json / list prop binds ONE leaf \u2014 pass its path (bindPropPath(src, key, [i, "field"], kind)).',"kind-required":`a structured binding must declare the leaf's kind ("string" | "number" | "color") \u2014 use bindPropPath.`};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var p=Object.defineProperty;var
|
|
1
|
+
"use strict";var p=Object.defineProperty;var u=(t,o)=>p(t,"name",{value:o,configurable:!0});Object.defineProperty(exports,"__esModule",{value:!0}),exports.walkPropDefinitions=walkPropDefinitions,exports.looksLikeColorProp=looksLikeColorProp,exports.auditColorProps=auditColorProps,exports.isAbsoluteFilesystemPath=isAbsoluteFilesystemPath,exports.auditNoLocalPaths=auditNoLocalPaths,exports.auditBrowseSurface=auditBrowseSurface,exports.auditOutputFormat=auditOutputFormat,exports.auditPropLabels=auditPropLabels,exports.auditDefaultsValidate=auditDefaultsValidate,exports.auditOutputHintsResolve=auditOutputHintsResolve;const validateTemplateProps_1=require("./validateTemplateProps");function walkPropDefinitions(t,o,r=""){for(const[s,e]of Object.entries(t??{})){if(!e||typeof e!="object")continue;const n=r?`${r}.${s}`:s;o(n,e),e.type==="group"&&e.fields&&walkPropDefinitions(e.fields,o,n)}}u(walkPropDefinitions,"walkPropDefinitions");const COLOR_KEY=/color/i,COLOR_DESC=/#rrggbb/i;function looksLikeColorProp(t,o){var r,s;if(o.type!=="string"&&o.type!=="string[]")return!1;const e=(r=t.split(".").pop())!==null&&r!==void 0?r:t;return COLOR_KEY.test(e)||COLOR_DESC.test((s=o.description)!==null&&s!==void 0?s:"")}u(looksLikeColorProp,"looksLikeColorProp");function auditColorProps(t){const o=[];return walkPropDefinitions(t.propsSchema,(r,s)=>{var e,n,i,a;if(!looksLikeColorProp(r,s))return;const d=((n=(e=s.meta)===null||e===void 0?void 0:e.constraints)===null||n===void 0?void 0:n.isColor)===!0,l=((a=(i=s.meta)===null||i===void 0?void 0:i.control)===null||a===void 0?void 0:a.colorPicker)===!0;if(d&&l)return;const c=[d?"":"constraints.isColor",l?"":"control.colorPicker"].filter(Boolean).join(" and ");o.push({key:r,detail:`${s.type} "${r}" reads as a colour but lacks ${c} \u2014 declare both so the editor shows a swatch picker instead of a text box.`})}),o}u(auditColorProps,"auditColorProps");const POSIX_ABS=/^\/(?!\/)/,WIN_ABS=/^[A-Za-z]:[\\/]/,UNC=/^\\\\/;function isAbsoluteFilesystemPath(t){return POSIX_ABS.test(t)||WIN_ABS.test(t)||UNC.test(t)}u(isAbsoluteFilesystemPath,"isAbsoluteFilesystemPath");function auditNoLocalPaths(t){var o;const r=[],s=u((e,n)=>{if(typeof e=="string"){isAbsoluteFilesystemPath(e)&&r.push({key:n,detail:`defaultProps.${n} is an absolute filesystem path (${JSON.stringify(e.length>60?`${e.slice(0,57)}\u2026`:e)}) \u2014 it exists only on the authoring machine. Ship a bundled asset by relative reference, or leave the input empty.`});return}if(Array.isArray(e)){e.forEach((i,a)=>s(i,`${n}[${a}]`));return}if(e&&typeof e=="object")for(const[i,a]of Object.entries(e))s(a,n?`${n}.${i}`:i)},"scan");return s((o=t.defaultProps)!==null&&o!==void 0?o:{},""),r}u(auditNoLocalPaths,"auditNoLocalPaths");function auditBrowseSurface(t){const o=[];return(typeof t.label=="string"?t.label.trim():"")||o.push({key:"label",detail:"label is empty \u2014 pickers, lists and the Templates page name the template by it (declare it in template-catalog.json)."}),(typeof t.description=="string"?t.description.trim():"")||o.push({key:"description",detail:"description is empty \u2014 the Templates page and the manifest show it as the template's one-line summary."}),(Array.isArray(t.tags)?t.tags.filter(n=>typeof n=="string"&&n.trim()):[]).length===0&&o.push({key:"tags",detail:"tags is empty \u2014 the Templates page filters and groups by tag; an untagged template only surfaces through search."}),o}u(auditBrowseSurface,"auditBrowseSurface");function auditOutputFormat(t){var o;if(t.internal===!0||t.deprecated)return[];const r=(o=t.outputHints)===null||o===void 0?void 0:o.format;return r!=null&&typeof r=="object"&&Object.keys(r).length>0?[]:[{key:"outputHints.format",detail:`outputHints.format is not declared \u2014 the CLI defaults the output to out.mp4 (even for a still) and a share link at defaults carries an f= ask. Declare the deliverable: { kind: "video", container: "mp4" } for motion, { kind: "image", container: "png" } for a still (add pixelFormat: "rgba" when it ships alpha); a template with an outputFormat knob declares the knob's DEFAULT.`}]}u(auditOutputFormat,"auditOutputFormat");function auditPropLabels(t){const o=[];return t.internal===!0||walkPropDefinitions(t.propsSchema,(r,s)=>{var e,n,i,a;if(!((n=(e=s.meta)===null||e===void 0?void 0:e.ui)===null||n===void 0)&&n.hidden)return;const d=(a=(i=s.meta)===null||i===void 0?void 0:i.ui)===null||a===void 0?void 0:a.label;typeof d=="string"&&d.trim()||o.push({key:r,detail:`${s.type} "${r}" has no ui.label \u2014 the panel falls back to the raw key.`})}),o}u(auditPropLabels,"auditPropLabels");const INPUT_NOT_DEFAULT_CODES=new Set(["MISSING_REQUIRED_PROP"]);function auditDefaultsValidate(t){var o,r,s;const e=[];let n=[];try{n=(0,validateTemplateProps_1.validateTemplateProps)(t,(o=t.defaultProps)!==null&&o!==void 0?o:{})}catch(i){return e.push({key:"defaultProps",detail:`the schema validator threw on defaultProps: ${i instanceof Error?i.message:String(i)}`}),e}for(const i of n){if(i.severity!=="error"||INPUT_NOT_DEFAULT_CODES.has(String(i.code)))continue;const a=/Prop "([^"]+)"|prop "([^"]+)"/.exec(i.message);e.push({key:(s=(r=a?.[1])!==null&&r!==void 0?r:a?.[2])!==null&&s!==void 0?s:String(i.code),detail:`${i.code}: ${i.message}`})}return e}u(auditDefaultsValidate,"auditDefaultsValidate");function auditOutputHintsResolve(t){var o,r;const s=t.resolveOutputHints;if(typeof s!="function")return[];const e=[],n=(o=t.defaultProps)!==null&&o!==void 0?o:{};let i,a;try{i=s(n),a=s(n)}catch(l){return[{key:"resolveOutputHints",detail:`resolveOutputHints threw at defaultProps (${l instanceof Error?l.message:String(l)}) \u2014 it must never throw; an unknown prop value resolves to the default.`}]}if(!i||typeof i!="object"||Array.isArray(i))return[{key:"resolveOutputHints",detail:`resolveOutputHints must return an object of hints (got ${i===null?"null":typeof i}).`}];JSON.stringify(i)!==JSON.stringify(a)&&e.push({key:"resolveOutputHints",detail:"resolveOutputHints is not deterministic \u2014 two calls at defaultProps disagree."});const d=(r=t.outputHints)!==null&&r!==void 0?r:{};for(const[l,c]of Object.entries(i))c===void 0||!(l in d)||JSON.stringify(c)!==JSON.stringify(d[l])&&e.push({key:`resolveOutputHints.${l}`,detail:`resolveOutputHints(defaultProps).${l} = ${JSON.stringify(c)} disagrees with outputHints.${l} = ${JSON.stringify(d[l])} \u2014 at defaults the resolver must agree with the static hints (they are what the manifest and the cards show).`});return e}u(auditOutputHintsResolve,"auditOutputHintsResolve");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var R=Object.defineProperty;var a=(e,r)=>R(e,"name",{value:r,configurable:!0});Object.defineProperty(exports,"__esModule",{value:!0}),exports.TEMPLATE_WRAPPED_FROM=void 0,exports.isCapabilityDenialTripwire=isCapabilityDenialTripwire,exports.__resetCapabilityDenialWarnings=__resetCapabilityDenialWarnings,exports.unwrapTemplateFunction=unwrapTemplateFunction,exports.defineMosaicTemplate=defineMosaicTemplate;const templateConventions_1=require("./templateConventions"),templateOriginScope_1=require("./templateOriginScope"),types_1=require("@m0saic/types"),assertTiming_1=require("../assertTiming"),stampOutput_1=require("../render/stampOutput"),finalizeRenderable_1=require("../render/finalizeRenderable"),autoCompactRenderable_1=require("../render/autoCompactRenderable"),DEFAULT_FINALIZE_OPTS={defaultRenderableOwner:"user",defaultSourceOwner:"user"},DENIED_CAPABILITY_FIELDS=["secrets","connections"],warnedDeniedCapabilityReads=new Set,DENIAL_TRIPWIRE=Symbol.for("m0saic.capabilityDenialTripwire");function isCapabilityDenialTripwire(e,r){const n=Object.getOwnPropertyDescriptor(e,r);return typeof n?.get=="function"&&n.get[DENIAL_TRIPWIRE]===!0}a(isCapabilityDenialTripwire,"isCapabilityDenialTripwire");function __resetCapabilityDenialWarnings(){warnedDeniedCapabilityReads.clear()}a(__resetCapabilityDenialWarnings,"__resetCapabilityDenialWarnings"),exports.TEMPLATE_WRAPPED_FROM=Symbol.for("m0saic.templateWrappedFrom");function linkWrappedFrom(e,r){return Object.defineProperty(e,exports.TEMPLATE_WRAPPED_FROM,{value:r,enumerable:!1,writable:!1,configurable:!1}),e}a(linkWrappedFrom,"linkWrappedFrom");function unwrapTemplateFunction(e){let r=e;const n=new Set;for(;;){const o=r[exports.TEMPLATE_WRAPPED_FROM];if(typeof o!="function"||n.has(o))return r;n.add(r),r=o}}a(unwrapTemplateFunction,"unwrapTemplateFunction");function deniedCapabilityMessage(e,r,n){return`[m0saic] Template "${e}" read ctx.${r}, but `+(n==="core"?'declares capabilities: { tier: "core" }. ':'declares no "capabilities" block at all (missing \u2192 treated as core). ')+`The Level 1 capability gate withheld the handle, so the read returned undefined \u2014 the host DID supply ctx.${r}; the tier declaration is what denied it. To receive ctx.secrets / ctx.connections, declare capabilities: { tier: "capability", caps: { \u2026 } } (see the capability-tier docs).`}a(deniedCapabilityMessage,"deniedCapabilityMessage");function attachDenialTripwire(e,r,n,o,
|
|
1
|
+
"use strict";var R=Object.defineProperty;var a=(e,r)=>R(e,"name",{value:r,configurable:!0});Object.defineProperty(exports,"__esModule",{value:!0}),exports.TEMPLATE_WRAPPED_FROM=void 0,exports.isCapabilityDenialTripwire=isCapabilityDenialTripwire,exports.__resetCapabilityDenialWarnings=__resetCapabilityDenialWarnings,exports.unwrapTemplateFunction=unwrapTemplateFunction,exports.defineMosaicTemplate=defineMosaicTemplate;const templateConventions_1=require("./templateConventions"),templateOriginScope_1=require("./templateOriginScope"),templateCatalogStore_1=require("./templateCatalogStore"),platform_1=require("@m0saic/platform"),types_1=require("@m0saic/types"),assertTiming_1=require("../assertTiming"),stampOutput_1=require("../render/stampOutput"),finalizeRenderable_1=require("../render/finalizeRenderable"),autoCompactRenderable_1=require("../render/autoCompactRenderable"),DEFAULT_FINALIZE_OPTS={defaultRenderableOwner:"user",defaultSourceOwner:"user"},DENIED_CAPABILITY_FIELDS=["secrets","connections"],warnedDeniedCapabilityReads=new Set,DENIAL_TRIPWIRE=Symbol.for("m0saic.capabilityDenialTripwire");function isCapabilityDenialTripwire(e,r){const n=Object.getOwnPropertyDescriptor(e,r);return typeof n?.get=="function"&&n.get[DENIAL_TRIPWIRE]===!0}a(isCapabilityDenialTripwire,"isCapabilityDenialTripwire");function __resetCapabilityDenialWarnings(){warnedDeniedCapabilityReads.clear()}a(__resetCapabilityDenialWarnings,"__resetCapabilityDenialWarnings"),exports.TEMPLATE_WRAPPED_FROM=Symbol.for("m0saic.templateWrappedFrom");function linkWrappedFrom(e,r){return Object.defineProperty(e,exports.TEMPLATE_WRAPPED_FROM,{value:r,enumerable:!1,writable:!1,configurable:!1}),e}a(linkWrappedFrom,"linkWrappedFrom");function unwrapTemplateFunction(e){let r=e;const n=new Set;for(;;){const o=r[exports.TEMPLATE_WRAPPED_FROM];if(typeof o!="function"||n.has(o))return r;n.add(r),r=o}}a(unwrapTemplateFunction,"unwrapTemplateFunction");function deniedCapabilityMessage(e,r,n){return`[m0saic] Template "${e}" read ctx.${r}, but `+(n==="core"?'declares capabilities: { tier: "core" }. ':'declares no "capabilities" block at all (missing \u2192 treated as core). ')+`The Level 1 capability gate withheld the handle, so the read returned undefined \u2014 the host DID supply ctx.${r}; the tier declaration is what denied it. To receive ctx.secrets / ctx.connections, declare capabilities: { tier: "capability", caps: { \u2026 } } (see the capability-tier docs).`}a(deniedCapabilityMessage,"deniedCapabilityMessage");function attachDenialTripwire(e,r,n,o,c,f){const l=a(()=>{f.has(r)||(f.add(r),(0,types_1.emitTemplateLog)(c,{templateId:n,level:"warn",message:`Denied read of ctx.${r}: template is core tier`,data:{event:"capability_denied_read",field:r,declaredTier:o,requiredTier:"capability"}}));const u=`${n}::${r}`;warnedDeniedCapabilityReads.has(u)||(warnedDeniedCapabilityReads.add(u),console.warn(deniedCapabilityMessage(n,r,o)))},"get");l[DENIAL_TRIPWIRE]=!0,Object.defineProperty(e,r,{enumerable:!1,configurable:!0,get:l})}a(attachDenialTripwire,"attachDenialTripwire");function defineMosaicTemplate(e,r={}){var n,o,c;const f=(n=r.conventions)!==null&&n!==void 0?n:(0,templateOriginScope_1.currentTemplateOrigin)().kind==="external"?"record":"throw",l=(0,templateCatalogStore_1.declaredCatalogEntry)(String(e.id),(0,templateOriginScope_1.currentTemplateOrigin)());l&&(e=(0,platform_1.applyTemplateCatalogEntry)(e,l)),(0,templateConventions_1.enforceTemplateConventions)(e,{mode:f,target:(0,templateCatalogStore_1.declaredConventionsTarget)((0,templateOriginScope_1.currentTemplateOrigin)())});const u=e.render,T=e.renderLite,b=e.renderCover,_=e.renderTutorial,C=(o=e.defaultFinalizeOpts)!==null&&o!==void 0?o:DEFAULT_FINALIZE_OPTS,v=((c=e.capabilities)===null||c===void 0?void 0:c.tier)==="capability",w=e.capabilities===void 0?"unset":"core",g=a(i=>{if(v)return i;const t=i,h=a(s=>{if(isCapabilityDenialTripwire(t,s))return!1;const y=Object.getOwnPropertyDescriptor(t,s);return y?typeof y.get=="function"||y.value!==void 0:t[s]!==void 0},"supplied"),d=DENIED_CAPABILITY_FIELDS.filter(h);if(d.length===0)return i;const p={...t};for(const s of d)delete p[s];const m=new Set;for(const s of d)attachDenialTripwire(p,s,e.id,w,i,m);return p},"gateCapabilityCtx"),E={...e,render:linkWrappedFrom(async function(i,t){const h=await u.call(this,i,g(t)),d=(0,autoCompactRenderable_1.autoCompactRenderable)(h,{width:t.target.width,height:t.target.height},{skip:e.skipAutoCompact===!0}),p={width:t.target.width,height:t.target.height,fps:t.target.fps,durationMs:t.target.durationMs,target:t.output.target,format:t.output.format,audio:t.output.audio,color:t.output.color},m=(0,stampOutput_1.stampRenderableOutput)(d,p),s=(0,finalizeRenderable_1.finalizeRenderable)(m,t,C);return(0,assertTiming_1.assertTiming)(s,t,e.id),s},u),...T?{renderLite:linkWrappedFrom(function(i,t){return T.call(this,i,g(t))},T)}:{},...b?{renderCover:linkWrappedFrom(function(i,t){return b.call(this,i,g(t))},b)}:{},..._?{renderTutorial:linkWrappedFrom(function(i,t){return _.call(this,i,g(t))},_)}:{}},O=e[platform_1.TEMPLATE_CATALOG_AUTHORED_KEY];return O!==void 0&&Object.defineProperty(E,platform_1.TEMPLATE_CATALOG_AUTHORED_KEY,{value:O,enumerable:!1,configurable:!0}),E}a(defineMosaicTemplate,"defineMosaicTemplate");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var w=Object.defineProperty;var d=(o,t)=>w(o,"name",{value:t,configurable:!0});Object.defineProperty(exports,"__esModule",{value:!0}),exports.resolveTemplateOutputHints=resolveTemplateOutputHints,exports.formatFromOutputFormatKnob=formatFromOutputFormatKnob,exports.resolveTemplateHintDims=resolveTemplateHintDims;function resolveTemplateOutputHints(o,t){var r,i;const n={...(r=o.defaultProps)!==null&&r!==void 0?r:{},...t??{}},u={...(i=o.outputHints)!==null&&i!==void 0?i:{}},p=formatFromOutputFormatKnob(n.outputFormat,u.format),m=p?{...u,format:p}:u,a=o.resolveOutputHints;if(typeof a!="function")return m;let f;try{f=a(n)}catch{return m}if(!f||typeof f!="object"||Array.isArray(f))return m;const e=f,c=d(s=>typeof s=="number"&&Number.isFinite(s)&&s>=1?Math.max(2,2*Math.round(s/2)):void 0,"dim"),l=d(s=>typeof s=="number"&&Number.isFinite(s)&&s>0?s:void 0,"pos"),b=c(e.width),h=c(e.height),y=l(e.fps),g=l(e.durationMs),v=typeof e.posterTimeMs=="number"&&Number.isFinite(e.posterTimeMs)&&e.posterTimeMs>=0?e.posterTimeMs:void 0,M=e.format&&typeof e.format=="object"&&!Array.isArray(e.format)?e.format:void 0,T=typeof e.note=="string"?e.note:void 0;return{...m,...b!==void 0?{width:b}:{},...h!==void 0?{height:h}:{},...y!==void 0?{fps:y}:{},...g!==void 0?{durationMs:g}:{},...v!==void 0?{posterTimeMs:v}:{},...M!==void 0?{format:M}:{},...T!==void 0?{note:T}:{}}}d(resolveTemplateOutputHints,"resolveTemplateOutputHints");const IMAGE_CONTAINERS=new Set(["png","jpeg","webp"]),VIDEO_CONTAINERS=new Set(["mp4","mov","webm","mkv"]);function formatFromOutputFormatKnob(o,t){var r;if(typeof o!="string")return;const i=o.trim().toLowerCase(),n=i==="jpg"?"jpeg":i,u=IMAGE_CONTAINERS.has(n)?"image":VIDEO_CONTAINERS.has(n)?"video":null;if(u&&!(t&&t.container===n&&((r=t.kind)!==null&&r!==void 0?r:u)===u))return{kind:u,container:n}}d(formatFromOutputFormatKnob,"formatFromOutputFormatKnob");function resolveTemplateHintDims(o,t){const r=resolveTemplateOutputHints(o,t),i=r.width,n=r.height;return typeof i=="number"&&i>0&&typeof n=="number"&&n>0?{w:i,h:n}:null}d(resolveTemplateHintDims,"resolveTemplateHintDims");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var o=Object.defineProperty;var t=(e,r)=>o(e,"name",{value:r,configurable:!0});Object.defineProperty(exports,"__esModule",{value:!0}),exports.templateConventionTargets=exports.templateCatalogEntries=void 0,exports.templateOriginKey=templateOriginKey,exports.declaredConventionsTarget=declaredConventionsTarget,exports.declaredCatalogEntry=declaredCatalogEntry;const processRegistry_1=require("../processRegistry");exports.templateCatalogEntries=(0,processRegistry_1.processRegistry)("templateCatalogEntries");function templateOriginKey(e){return e.kind==="external"?`external:${e.source}`:"first-party"}t(templateOriginKey,"templateOriginKey"),exports.templateConventionTargets=(0,processRegistry_1.processRegistry)("templateConventionTargets");function declaredConventionsTarget(e){return exports.templateConventionTargets.get(templateOriginKey(e))}t(declaredConventionsTarget,"declaredConventionsTarget");function declaredCatalogEntry(e,r){const n=exports.templateCatalogEntries.get(e);return n&&n.origin===templateOriginKey(r)?n.entry:void 0}t(declaredCatalogEntry,"declaredCatalogEntry");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";var h=Object.defineProperty;var o=(e,n)=>h(e,"name",{value:n,configurable:!0});Object.defineProperty(exports,"__esModule",{value:!0}),exports.TemplateConventionError=exports.TEMPLATE_CONVENTION_FIX=exports.TEMPLATE_CONVENTION_SINCE=exports.TEMPLATE_CONVENTION_POSTURE=void 0,exports.compareConventionVersions=compareConventionVersions,exports.conventionVersions=conventionVersions,exports.conventionsLevel=conventionsLevel,exports.listTemplateConventionFindings=listTemplateConventionFindings,exports.drainTemplateConventionFindings=drainTemplateConventionFindings,exports.recordTemplateConventionFinding=recordTemplateConventionFinding,exports.clearTemplateConventionFinding=clearTemplateConventionFinding,exports.makeTemplateConventionFinding=makeTemplateConventionFinding,exports.enforceTemplateConventions=enforceTemplateConventions;const auditDefaultProps_1=require("./auditDefaultProps"),auditSchemaConventions_1=require("./auditSchemaConventions");exports.TEMPLATE_CONVENTION_POSTURE={defaultProps:"throw",colorProps:"throw",noLocalPaths:"throw",browseSurface:"throw",propLabels:"record",defaultsValidate:"throw",outputFormat:"record",outputHintsResolve:"throw",repoFrontDoor:"record",rendersAtDefaults:"throw",bindingsSound:"throw",bindingsCover:"record",bindingsDeclared:"throw",bindingHints:"throw",canvasFill:"throw",svgGlyphCoverage:"throw",safeMinimumCanvas:"record",canvasEnvelope:"record",deterministic:"throw",textFits:"throw",costBudget:"record",latticeSmooth:"throw",layoutFingerprint:"throw"},exports.TEMPLATE_CONVENTION_SINCE={defaultProps:"0.2.0",colorProps:"0.2.0",noLocalPaths:"0.2.0",browseSurface:"0.2.0",propLabels:"0.2.0",defaultsValidate:"0.2.0",outputFormat:"0.2.0",outputHintsResolve:"0.2.0",repoFrontDoor:"0.2.0",rendersAtDefaults:"0.2.0",bindingsSound:"0.2.0",bindingsCover:"0.2.0",bindingsDeclared:"0.3.0",bindingHints:"0.3.0",canvasFill:"0.3.0",svgGlyphCoverage:"0.2.0",safeMinimumCanvas:"0.2.0",canvasEnvelope:"0.2.0",deterministic:"0.2.0",textFits:"0.2.0",costBudget:"0.2.0",latticeSmooth:"0.2.0",layoutFingerprint:"0.2.0"};function compareConventionVersions(e,n){const t=o(l=>l.split(".").map(s=>Number.parseInt(s,10)||0),"seg"),[a,r,c]=t(e),[i,d,u]=t(n);return a-i||r-d||c-u}o(compareConventionVersions,"compareConventionVersions");function conventionVersions(){return[...new Set(Object.values(exports.TEMPLATE_CONVENTION_SINCE))].sort(compareConventionVersions)}o(conventionVersions,"conventionVersions");function conventionsLevel(e){var n,t,a;const r=conventionVersions(),c=[...new Set(e.filter(s=>s.severity==="error").map(s=>s.convention))];if(c.length===0)return{meets:(n=r[r.length-1])!==null&&n!==void 0?n:null,behind:[]};const i=new Map;for(const s of c){const p=exports.TEMPLATE_CONVENTION_SINCE[s];i.set(p,[...(t=i.get(p))!==null&&t!==void 0?t:[],s].sort())}const d=[...i.entries()].map(([s,p])=>({since:s,conventions:p})).sort((s,p)=>compareConventionVersions(s.since,p.since)),u=d[0].since,l=r.filter(s=>compareConventionVersions(s,u)<0);return{meets:(a=l[l.length-1])!==null&&a!==void 0?a:null,behind:d}}o(conventionsLevel,"conventionsLevel"),exports.TEMPLATE_CONVENTION_FIX={defaultProps:'"a knob shows what it does": declare the value in defaultProps (booleans / closed sets), or add meta.control.placeholder naming the unset behaviour (plain strings / numbers). A closed set must contain the unset state (add a "none" option and default it) \u2014 never default a real value over "unset".',colorProps:"a colour-valued prop declares BOTH constraints.isColor: true and control.colorPicker: true, so the editor shows a swatch picker instead of a text box.",noLocalPaths:"defaultProps must not contain absolute filesystem paths \u2014 they exist only on the authoring machine. Ship a bundled asset by relative reference, or leave the input empty.",browseSurface:"give the template a non-empty description and at least one tag \u2014 the Templates page and the manifest are built from them.",propLabels:"give every visible prop a meta.ui.label \u2014 the panel otherwise falls back to the raw key (internal templates are exempt: a building block has no panel).",outputFormat:`declare the deliverable in outputHints.format \u2014 { kind: "video", container: "mp4" } for motion, { kind: "image", container: "png" } for a still (pixelFormat: "rgba" when it ships alpha). Without it the CLI defaults the output to out.mp4 and a Make share link at defaults carries an f= ask. A template with an outputFormat knob declares the knob's DEFAULT (the knob still wins at render). Building blocks (internal: true) are exempt.`,outputHintsResolve:"keep resolveOutputHints pure and consistent \u2014 return an object, the same object on every call at defaultProps, and at defaults agree with the static outputHints for every field you return (the static hints are what the manifest and cards show). Never throw: an unknown prop value resolves to the default.",repoFrontDoor:"declare the repo's front door \u2014 repo.helloWorld = the id of the template a newcomer renders first. The canonical card is one call, defineHelloWorldTemplate({ id, subline }) from @m0saic/template-utils; a pack with its own look points the field at its own template. Hosts read the field (m0saic hello-world --template-repo, Make's Start here) and the manifest carries it.",defaultsValidate:"defaultProps must pass the template's own schema: a default outside its oneOf, beyond its min/max, of the wrong type, or over a list bound is a knob that shows one thing and renders another. (A required input with no default is fine \u2014 inputs are not defaults.)",rendersAtDefaults:"render(defaultProps) must succeed on the hinted canvas \u2014 a template whose defaults cannot render shows an error card in Make. (Templates whose required inputs have no default are skipped, not failed.)",bindingsSound:"every editor.binding must resolve against propsSchema: the prop must exist and be bindable, list props need an index, structured (json / list) props need a path AND a kind \u2014 see bindProp / bindPropPath in @m0saic/template-utils.",bindingsCover:`a prop drawn as text should be bound to the rect that shows it (bindProp(src, "<key>")) so Make's double-click edits it in place. Bind the rect that SHOWS the prop, even when its value is empty.`,bindingsDeclared:'every prop that CAN carry a canvas handle is either bound on the rect that shows it (bindProp / bindProps / bindPropPath / bindPropRect) or named in template.bindings.unbound with the reason it has none ({ fps: "timing" }). The accountable props are free-text and colour strings, numbers, media, one element of a basic list, one leaf of json / list / array, and a regions-picker rect; booleans, closed sets, group containers, the m0 family, code and hidden / human props are never canvas things. A declaration naming an unknown prop, or one that is actually bound, is itself a violation \u2014 a stale entry is worse than none. Templates hashed in frozen.manifest.json are exempt.',bindingHints:`every bound rect must show one line in context \u2014 what changing the value does and what it looks like \u2014 because Make puts it under the inline editor, on the tile card and in the handle's tooltip, and a person who double-clicks should not have to open the settings or a manual. It comes from the binding's own hint (bindProp(src, "<key>", i, { hint: "\u2026" }) / withBindingHint(src, "\u2026")) or, for every binding of the prop at once, the prop's description (propsSchema.<key>.description). One plain sentence; never the value itself. A companion leaf (filled only by a media drop) needs none. Templates hashed in frozen.manifest.json are exempt.`,canvasFill:'fill the canvas with document.backgroundColor, never a full-canvas colour rect. A base rect is a click target that covers everything \u2014 it gets selected in Make any time the pointer is not on a smaller tile \u2014 and the document background does the same job with no rect at all. Only a STATIC, fully opaque, unshaped fill counts: a curtain wipe (overlay.enable / window), a scrim (overlay.alpha), a masked shape and a rounded card are all legitimate and never flagged. Two declared exceptions, and they mean different things: canvas.baseRect = "<why>" is the general one (the rect IS the subject \u2014 a lesson about full-rect nodes, a tutorial surface), and defaultProps.useNestedBackgroundColor = true is the narrow one (this template is COMPOSED INTO another, whose slot its own backgroundColor cannot fill). An empty baseRect reason is refused.',svgGlyphCoverage:'every character drawn with rasterizer:"svg" must have a glyph in the font it resolves to; missing glyphs render as tofu. Use an ASCII stand-in ("->" for an arrow) or a font that has the character.',safeMinimumCanvas:"at its own hinted canvas, the template's flattened layout must clear its safe minimum (per-axis max of the feasibility and precision floors) \u2014 below it cells are squashed or culled at the template's DEFAULT size. Bound weightedSplit totals with a precision budget (never scale raw slider values into slots), or raise outputHints to a canvas the layout actually needs.",canvasEnvelope:"the layout should clear its safe minimum on the standard canvases too (1080p landscape / portrait / square); a canvas it cannot clear is one users will pick in Make and get squashed or culled cells. Declare the supported range, or make the geometry ratio-based.",deterministic:"render(defaultProps) must produce the same document twice \u2014 no Math.random, no clock, no ambient state, no per-call ids. Randomness takes a seed prop; identical seeds give identical output.",textFits:"every svg-rasterized text layer must fit the cell it lands on at the hinted canvas (measured with the rasterizer's own font, after inset and padding) \u2014 svg text never wraps or scales on its own. Fit it with fitSvgText / svgLabel, shorten it, or give the cell more room.",costBudget:"keep the rendered document inside the engine's comfort zone (see COST_BUDGETS): frame count, source count, overlay depth and inline-mask count each have a ceiling past which renders slow down quadratically, drop layers, or overflow the process argv \u2014 operations, not string length (a baked-inset m0 is long and cheap). Collapse detail into fewer, larger cells; nest a child document instead of stacking overlays.",latticeSmooth:`every split count above 12 in the rendered layout (root document and every nested child) must be 5-smooth \u2014 2\u1D43\xB73\u1D47\xB75\u1D9C \u2014 so the layout composes: inlining one template into another costs the LCM of their split counts, and one rough factor (7, 11, 121 = 11\xB2) multiplies the whole composition. Cap weighted bands with weightedSplit(\u2026, { precision: 120 }) \u2014 never round each weight to a cap on its own, that sums to 120 \xB1 1 (119/121); place rect soups with placeInsetPieces / placeOptimizedPieces (they pick divisors of the axis); take a self-frame's pitch from the divisors of its side, not round(side / K). Counts \u2264 12 with a rough factor are content fill and pass; a larger content count (53 ISO weeks) is declared as lattice: { allow: [{ count, reason }] }; a baked raster (QR, barcode, logo trace) declares lattice: { mode: "bitmap" }.`,layoutFingerprint:"the flattened layout at the hinted canvas changed from the committed fingerprint (the <slug>.layout.m0 beside the template, or layout-fingerprints/<key>.m0 for ids without a source folder). If the change is intended, re-mint with `npm run fingerprints:update` and commit the new file so the diff is reviewed; if not, a shared helper or a default drifted."};function describe(e){const n=e.violations.length;return`${e.templateId} breaks the "${e.convention}" convention \u2014 ${n} violation${n===1?"":"s"}:
|
|
2
|
-
`+e.violations.map(
|
|
1
|
+
"use strict";var u=Object.defineProperty;var o=(e,t)=>u(e,"name",{value:t,configurable:!0});Object.defineProperty(exports,"__esModule",{value:!0}),exports.TemplateConventionError=exports.TEMPLATE_CONVENTION_FIX=exports.TEMPLATE_CONVENTION_SINCE=exports.TEMPLATE_CONVENTION_POSTURE=void 0,exports.compareConventionVersions=compareConventionVersions,exports.conventionVersions=conventionVersions,exports.effectiveConventionLine=effectiveConventionLine,exports.isConventionBeyond=isConventionBeyond,exports.conventionsLevel=conventionsLevel,exports.listTemplateConventionFindings=listTemplateConventionFindings,exports.drainTemplateConventionFindings=drainTemplateConventionFindings,exports.recordTemplateConventionFinding=recordTemplateConventionFinding,exports.clearTemplateConventionFinding=clearTemplateConventionFinding,exports.makeTemplateConventionFinding=makeTemplateConventionFinding,exports.enforceTemplateConventions=enforceTemplateConventions;const auditDefaultProps_1=require("./auditDefaultProps"),auditSchemaConventions_1=require("./auditSchemaConventions");exports.TEMPLATE_CONVENTION_POSTURE={defaultProps:"throw",colorProps:"throw",noLocalPaths:"throw",browseSurface:"throw",propLabels:"record",defaultsValidate:"throw",outputFormat:"record",outputHintsResolve:"throw",repoFrontDoor:"record",rendersAtDefaults:"throw",bindingsSound:"throw",bindingsCover:"record",bindingsDeclared:"throw",bindingHints:"throw",canvasFill:"throw",catalogSidecar:"throw",svgGlyphCoverage:"throw",safeMinimumCanvas:"record",canvasEnvelope:"record",deterministic:"throw",textFits:"throw",costBudget:"record",latticeSmooth:"throw",layoutFingerprint:"throw"},exports.TEMPLATE_CONVENTION_SINCE={defaultProps:"0.2.0",colorProps:"0.2.0",noLocalPaths:"0.2.0",browseSurface:"0.2.0",propLabels:"0.2.0",defaultsValidate:"0.2.0",outputFormat:"0.2.0",outputHintsResolve:"0.2.0",repoFrontDoor:"0.2.0",rendersAtDefaults:"0.2.0",bindingsSound:"0.2.0",bindingsCover:"0.2.0",bindingsDeclared:"0.3.0",bindingHints:"0.3.0",canvasFill:"0.3.0",catalogSidecar:"0.3.1",svgGlyphCoverage:"0.2.0",safeMinimumCanvas:"0.2.0",canvasEnvelope:"0.2.0",deterministic:"0.2.0",textFits:"0.2.0",costBudget:"0.2.0",latticeSmooth:"0.2.0",layoutFingerprint:"0.2.0"};function compareConventionVersions(e,t){const n=o(h=>h.split(".").map(a=>Number.parseInt(a,10)||0),"seg"),[s,r,p]=n(e),[l,d,c]=n(t);return s-l||r-d||p-c}o(compareConventionVersions,"compareConventionVersions");function conventionVersions(){return[...new Set(Object.values(exports.TEMPLATE_CONVENTION_SINCE))].sort(compareConventionVersions)}o(conventionVersions,"conventionVersions");const LINE_RE=/^\d+\.\d+\.\d+$/;function effectiveConventionLine(...e){const t=e.filter(n=>typeof n=="string"&&LINE_RE.test(n.trim())).map(n=>n.trim());if(t.length!==0)return t.sort(compareConventionVersions)[0]}o(effectiveConventionLine,"effectiveConventionLine");function isConventionBeyond(e,t){return typeof t=="string"&&compareConventionVersions(exports.TEMPLATE_CONVENTION_SINCE[e],t)>0}o(isConventionBeyond,"isConventionBeyond");function conventionsLevel(e){var t,n,s;const r=conventionVersions(),p=[...new Set(e.filter(a=>a.severity==="error").map(a=>a.convention))];if(p.length===0)return{meets:(t=r[r.length-1])!==null&&t!==void 0?t:null,behind:[]};const l=new Map;for(const a of p){const i=exports.TEMPLATE_CONVENTION_SINCE[a];l.set(i,[...(n=l.get(i))!==null&&n!==void 0?n:[],a].sort())}const d=[...l.entries()].map(([a,i])=>({since:a,conventions:i})).sort((a,i)=>compareConventionVersions(a.since,i.since)),c=d[0].since,h=r.filter(a=>compareConventionVersions(a,c)<0);return{meets:(s=h[h.length-1])!==null&&s!==void 0?s:null,behind:d}}o(conventionsLevel,"conventionsLevel"),exports.TEMPLATE_CONVENTION_FIX={defaultProps:'"a knob shows what it does": declare the value in defaultProps (booleans / closed sets), or add meta.control.placeholder naming the unset behaviour (plain strings / numbers). A closed set must contain the unset state (add a "none" option and default it) \u2014 never default a real value over "unset".',colorProps:"a colour-valued prop declares BOTH constraints.isColor: true and control.colorPicker: true, so the editor shows a swatch picker instead of a text box.",noLocalPaths:"defaultProps must not contain absolute filesystem paths \u2014 they exist only on the authoring machine. Ship a bundled asset by relative reference, or leave the input empty.",browseSurface:"give the template a non-empty description and at least one tag \u2014 the Templates page and the manifest are built from them.",propLabels:"give every visible prop a meta.ui.label \u2014 the panel otherwise falls back to the raw key (internal templates are exempt: a building block has no panel).",outputFormat:`declare the deliverable in outputHints.format \u2014 { kind: "video", container: "mp4" } for motion, { kind: "image", container: "png" } for a still (pixelFormat: "rgba" when it ships alpha). Without it the CLI defaults the output to out.mp4 and a Make share link at defaults carries an f= ask. A template with an outputFormat knob declares the knob's DEFAULT (the knob still wins at render). Building blocks (internal: true) are exempt.`,outputHintsResolve:"keep resolveOutputHints pure and consistent \u2014 return an object, the same object on every call at defaultProps, and at defaults agree with the static outputHints for every field you return (the static hints are what the manifest and cards show). Never throw: an unknown prop value resolves to the default.",repoFrontDoor:"declare the repo's front door \u2014 repo.helloWorld = the id of the template a newcomer renders first. The canonical card is one call, defineHelloWorldTemplate({ id, subline }) from @m0saic/template-utils; a pack with its own look points the field at its own template. Hosts read the field (m0saic hello-world --template-repo, Make's Start here) and the manifest carries it.",defaultsValidate:"defaultProps must pass the template's own schema: a default outside its oneOf, beyond its min/max, of the wrong type, or over a list bound is a knob that shows one thing and renders another. (A required input with no default is fine \u2014 inputs are not defaults.)",rendersAtDefaults:"render(defaultProps) must succeed on the hinted canvas \u2014 a template whose defaults cannot render shows an error card in Make. (Templates whose required inputs have no default are skipped, not failed.)",bindingsSound:"every editor.binding must resolve against propsSchema: the prop must exist and be bindable, list props need an index, structured (json / list) props need a path AND a kind \u2014 see bindProp / bindPropPath in @m0saic/template-utils.",bindingsCover:`a prop drawn as text should be bound to the rect that shows it (bindProp(src, "<key>")) so Make's double-click edits it in place. Bind the rect that SHOWS the prop, even when its value is empty.`,bindingsDeclared:'every prop that CAN carry a canvas handle is either bound on the rect that shows it (bindProp / bindProps / bindPropPath / bindPropRect) or named in template.bindings.unbound with the reason it has none ({ fps: "timing" }). The accountable props are free-text and colour strings, numbers, media, one element of a basic list, one leaf of json / list / array, and a regions-picker rect; booleans, closed sets, group containers, the m0 family, code and hidden / human props are never canvas things. A declaration naming an unknown prop, or one that is actually bound, is itself a violation \u2014 a stale entry is worse than none. Templates hashed in frozen.manifest.json are exempt.',bindingHints:`every bound rect must show one line in context \u2014 what changing the value does and what it looks like \u2014 because Make puts it under the inline editor, on the tile card and in the handle's tooltip, and a person who double-clicks should not have to open the settings or a manual. It comes from the binding's own hint (bindProp(src, "<key>", i, { hint: "\u2026" }) / withBindingHint(src, "\u2026")) or, for every binding of the prop at once, the prop's description (propsSchema.<key>.description). One plain sentence; never the value itself. A companion leaf (filled only by a media drop) needs none. Templates hashed in frozen.manifest.json are exempt.`,canvasFill:'fill the canvas with document.backgroundColor, never a full-canvas colour rect that nothing binds. A base rect is a click target that covers everything \u2014 it gets selected in Make any time the pointer is not on a smaller tile \u2014 and if no prop is bound to it that click does nothing; the document background does the same job with no rect at all. Only a STATIC, fully opaque fill counts: a curtain wipe (overlay.enable / window), a scrim (overlay.alpha) and a masked shape are legitimate and never flagged \u2014 a ROUNDED or stroked card is NOT exempt from 0.3.1 on (its corners do not change what a click on it does \u2014 a repo held to 0.3.0 keeps the exemption it shipped under), but a full-canvas rect that CARRIES A HANDLE is (a card bound to the theme preset is where the theme gets changed). Two declared exceptions, and they mean different things: canvas.baseRect = "<why>" is the general one (the rect IS the subject \u2014 a lesson about full-rect nodes, a tutorial surface), and defaultProps.useNestedBackgroundColor = true is the narrow one (this template is COMPOSED INTO another, whose slot its own backgroundColor cannot fill). An empty baseRect reason is refused.',catalogSidecar:`a template's code declares what it IS (id, prop types / constraints / controls, defaults, output, render) \u2014 never how it is described. label, description, tags, platforms, channels, preview, internal, primitive, deprecated, and each prop's presentation (label, description \u2014 the in-context hint \u2014 placeholder, order, primary, collapsedByDefault) live in the template's catalog sidecar: <name>.catalog.json beside the module ({ "schemaVersion": 1, "templateId": "<id>", "label": \u2026, "tags": [\u2026], "props": { "<key>": { "label": \u2026, "description": \u2026 } } }), because they may change after the template ships and shipped code never changes. The repo's build gathers the sidecars into template-catalog.json beside template-manifest.json. Templates shipped before 0.3.1 keep theirs (they lag this rule; a sidecar overrides them).`,svgGlyphCoverage:'every character drawn with rasterizer:"svg" must have a glyph in the font it resolves to; missing glyphs render as tofu. Use an ASCII stand-in ("->" for an arrow) or a font that has the character.',safeMinimumCanvas:"at its own hinted canvas, the template's flattened layout must clear its safe minimum (per-axis max of the feasibility and precision floors) \u2014 below it cells are squashed or culled at the template's DEFAULT size. Bound weightedSplit totals with a precision budget (never scale raw slider values into slots), or raise outputHints to a canvas the layout actually needs.",canvasEnvelope:"the layout should clear its safe minimum on the standard canvases too (1080p landscape / portrait / square); a canvas it cannot clear is one users will pick in Make and get squashed or culled cells. Declare the supported range, or make the geometry ratio-based.",deterministic:"render(defaultProps) must produce the same document twice \u2014 no Math.random, no clock, no ambient state, no per-call ids. Randomness takes a seed prop; identical seeds give identical output.",textFits:"every svg-rasterized text layer must fit the cell it lands on at the hinted canvas (measured with the rasterizer's own font, after inset and padding) \u2014 svg text never wraps or scales on its own. Fit it with fitSvgText / svgLabel, shorten it, or give the cell more room.",costBudget:"keep the rendered document inside the engine's comfort zone (see COST_BUDGETS): frame count, source count, overlay depth and inline-mask count each have a ceiling past which renders slow down quadratically, drop layers, or overflow the process argv \u2014 operations, not string length (a baked-inset m0 is long and cheap). Collapse detail into fewer, larger cells; nest a child document instead of stacking overlays.",latticeSmooth:`every split count above 12 in the rendered layout (root document and every nested child) must be 5-smooth \u2014 2\u1D43\xB73\u1D47\xB75\u1D9C \u2014 so the layout composes: inlining one template into another costs the LCM of their split counts, and one rough factor (7, 11, 121 = 11\xB2) multiplies the whole composition. Cap weighted bands with weightedSplit(\u2026, { precision: 120 }) \u2014 never round each weight to a cap on its own, that sums to 120 \xB1 1 (119/121); place rect soups with placeInsetPieces / placeOptimizedPieces (they pick divisors of the axis); take a self-frame's pitch from the divisors of its side, not round(side / K). Counts \u2264 12 with a rough factor are content fill and pass; a larger content count (53 ISO weeks) is declared as lattice: { allow: [{ count, reason }] }; a baked raster (QR, barcode, logo trace) declares lattice: { mode: "bitmap" }.`,layoutFingerprint:"the flattened layout at the hinted canvas changed from the committed fingerprint (the <slug>.layout.m0 beside the template, or layout-fingerprints/<key>.m0 for ids without a source folder). If the change is intended, re-mint with `npm run fingerprints:update` and commit the new file so the diff is reviewed; if not, a shared helper or a default drifted."};function describe(e){const t=e.violations.length;return`${e.templateId} breaks the "${e.convention}" convention \u2014 ${t} violation${t===1?"":"s"}:
|
|
2
|
+
`+e.violations.map(n=>` \u2022 ${n.detail}`).join(`
|
|
3
3
|
`)+`
|
|
4
|
-
Fix: ${exports.TEMPLATE_CONVENTION_FIX[e.convention]}`}o(describe,"describe");class TemplateConventionError extends Error{static{o(this,"TemplateConventionError")}constructor(
|
|
4
|
+
Fix: ${exports.TEMPLATE_CONVENTION_FIX[e.convention]}`}o(describe,"describe");class TemplateConventionError extends Error{static{o(this,"TemplateConventionError")}constructor(t){const n=Array.isArray(t)?t:[t];if(n.length===0)throw new Error("TemplateConventionError: at least one finding");super(n.map(describe).join(`
|
|
5
5
|
|
|
6
|
-
`)),this.name="TemplateConventionError",this.templateId=
|
|
6
|
+
`)),this.name="TemplateConventionError",this.templateId=n[0].templateId,this.convention=n[0].convention,this.violations=n[0].violations,this.findings=n}}exports.TemplateConventionError=TemplateConventionError;const LOG_KEY="__m0saicTemplateConventionFindings";function log(){const e=globalThis;return Array.isArray(e[LOG_KEY])||(e[LOG_KEY]=[]),e[LOG_KEY]}o(log,"log");function listTemplateConventionFindings(){return log().slice()}o(listTemplateConventionFindings,"listTemplateConventionFindings");function drainTemplateConventionFindings(){const e=log().slice();return log().length=0,e}o(drainTemplateConventionFindings,"drainTemplateConventionFindings");function recordTemplateConventionFinding(e){const t=log(),n=t.findIndex(s=>s.templateId===e.templateId&&s.convention===e.convention);n>=0?t[n]=e:t.push(e)}o(recordTemplateConventionFinding,"recordTemplateConventionFinding");function clearTemplateConventionFinding(e,t){const n=log(),s=n.findIndex(r=>r.templateId===e&&r.convention===t);s>=0&&n.splice(s,1)}o(clearTemplateConventionFinding,"clearTemplateConventionFinding");function makeTemplateConventionFinding(e,t,n,s){return{templateId:e,convention:t,external:s,severity:exports.TEMPLATE_CONVENTION_POSTURE[t]==="throw"?"error":"warning",violations:n}}o(makeTemplateConventionFinding,"makeTemplateConventionFinding");const DEFINITION_TIME_AUDITS=[{convention:"defaultProps",run:o(e=>(0,auditDefaultProps_1.auditDefaultProps)(e),"run")},{convention:"colorProps",run:o(e=>(0,auditSchemaConventions_1.auditColorProps)(e),"run")},{convention:"noLocalPaths",run:o(e=>(0,auditSchemaConventions_1.auditNoLocalPaths)(e),"run")},{convention:"browseSurface",run:o(e=>(0,auditSchemaConventions_1.auditBrowseSurface)(e),"run")},{convention:"propLabels",run:o(e=>(0,auditSchemaConventions_1.auditPropLabels)(e),"run")},{convention:"defaultsValidate",run:o(e=>(0,auditSchemaConventions_1.auditDefaultsValidate)(e),"run")},{convention:"outputFormat",run:o(e=>(0,auditSchemaConventions_1.auditOutputFormat)(e),"run")},{convention:"outputHintsResolve",run:o(e=>(0,auditSchemaConventions_1.auditOutputHintsResolve)(e),"run")}];function enforceTemplateConventions(e,t={}){var n;const s=(n=t.mode)!==null&&n!==void 0?n:"throw",r=effectiveConventionLine(t.target),p=String(e.id),l=[],d=[];for(const c of DEFINITION_TIME_AUDITS){const h=c.run(e);if(h.length===0){clearTemplateConventionFinding(p,c.convention);continue}const a=makeTemplateConventionFinding(p,c.convention,h,s==="record"),i=isConventionBeyond(c.convention,r)?{...a,severity:"warning"}:a;recordTemplateConventionFinding(i),l.push(i),s==="throw"&&i.severity==="error"&&d.push(i)}if(d.length>0)throw new TemplateConventionError(d);return l}o(enforceTemplateConventions,"enforceTemplateConventions");
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";var
|
|
2
|
-
`).slice(1).map(frameFile).find(Boolean);return t??void 0})();function repoRelativeRegistrationPath(e){const t=e.split(/[\\/]+/);for(let
|
|
3
|
-
`).slice(1)){const
|
|
1
|
+
"use strict";var d=Object.defineProperty;var i=(e,t)=>d(e,"name",{value:t,configurable:!0});Object.defineProperty(exports,"__esModule",{value:!0}),exports.TemplateRegistrationError=exports.RESERVED_TEMPLATE_ID_PREFIXES=void 0,exports.isReservedTemplateId=isReservedTemplateId,exports.repoRelativeRegistrationPath=repoRelativeRegistrationPath,exports.deepFreezeTemplate=deepFreezeTemplate,exports.registerTemplate=registerTemplate,exports.declareTemplateCatalog=declareTemplateCatalog,exports.declareTemplateConventions=declareTemplateConventions,exports.getTemplateAsRegistered=getTemplateAsRegistered,exports.withTemplateReloadScope=withTemplateReloadScope,exports.withExternalTemplateOrigin=withExternalTemplateOrigin,exports.getTemplateOrigin=getTemplateOrigin,exports.getTemplateMeta=getTemplateMeta,exports.drainTemplateRegistrationRejections=drainTemplateRegistrationRejections,exports.getTemplate=getTemplate,exports.requireTemplate=requireTemplate,exports.listRegisteredTemplateIds=listRegisteredTemplateIds,exports.__resetTemplateRegistryForTests=__resetTemplateRegistryForTests;const types_1=require("@m0saic/types"),platform_1=require("@m0saic/platform"),templateCatalogStore_1=require("./templateCatalogStore"),defineMosaicTemplate_1=require("./defineMosaicTemplate"),processRegistry_1=require("../processRegistry"),templateOriginScope_1=require("./templateOriginScope"),templateRegistry=(0,processRegistry_1.processRegistry)("templates");exports.RESERVED_TEMPLATE_ID_PREFIXES=["@m0saic/","@m0saic-dev/","@m0saic-community/"];class TemplateRegistrationError extends Error{static{i(this,"TemplateRegistrationError")}constructor(t,n,r){super(`Refused to register "${t}": that id is already registered by first-party ${n??"(unknown file)"}; the second registration came from ${r??"(unknown file)"}. A shipped id has exactly one registering file \u2014 to change behaviour, register a NEW id (vN+1). A hot reload must wrap the re-require in withTemplateReloadScope().`),this.code="TEMPLATE_ID_ALREADY_REGISTERED",this.name="TemplateRegistrationError",this.id=t,this.registeredFrom=n,this.attemptedFrom=r}}exports.TemplateRegistrationError=TemplateRegistrationError;const templateOrigins=(0,processRegistry_1.processRegistry)("templateOrigins"),templateRegisteredFrom=(0,processRegistry_1.processRegistry)("templateRegisteredFrom"),templateAsRegistered=(0,processRegistry_1.processRegistry)("templateAsRegistered"),originKey=templateCatalogStore_1.templateOriginKey;function carriesCatalog(e){return Object.getOwnPropertySymbols(e).includes(platform_1.TEMPLATE_CATALOG_AUTHORED_KEY)}i(carriesCatalog,"carriesCatalog");function asWritten(e,t){const n=(0,platform_1.authoredCatalogFields)(t),r=Object.getOwnPropertyDescriptors(e);r.propsSchema={value:(0,platform_1.authoredPropsSchema)(t),enumerable:!0,writable:!1,configurable:!1};for(const o of types_1.MOSAIC_TEMPLATE_CATALOG_FIELDS)Object.prototype.hasOwnProperty.call(n,o)?r[o]={value:n[o],enumerable:!0,writable:!1,configurable:!1}:delete r[o];return deepFreezeTemplate(Object.create(Object.getPrototypeOf(e),r))}i(asWritten,"asWritten");const registrationState=templateOriginScope_1.templateRegistrationState,FIRST_PARTY=templateOriginScope_1.FIRST_PARTY_TEMPLATE_ORIGIN,currentOrigin=templateOriginScope_1.currentTemplateOrigin;function rejectionLog(){let e=registrationState.get("rejections");return e||(e=[],registrationState.set("rejections",e)),e}i(rejectionLog,"rejectionLog");function isReservedTemplateId(e){const t=String(e??"").toLowerCase();return exports.RESERVED_TEMPLATE_ID_PREFIXES.some(n=>t.startsWith(n))}i(isReservedTemplateId,"isReservedTemplateId");function describeOwner(e){return e.kind==="first-party"?"m0saic (first-party)":`external repo ${e.source}`}i(describeOwner,"describeOwner");function isTrustedNamespaceId(e,t){if(!t?.length)return!1;const n=String(e??"").toLowerCase();return t.some(r=>n.startsWith(r.toLowerCase()))}i(isTrustedNamespaceId,"isTrustedNamespaceId");function screenExternalRegistration(e,t,n){var r;if(isReservedTemplateId(e)&&!isTrustedNamespaceId(e,n))return{code:"TEMPLATE_ID_RESERVED_NAMESPACE",id:e,attemptedBy:t,message:`Refused to register "${e}" from external repo ${t}: the "${exports.RESERVED_TEMPLATE_ID_PREFIXES.join('", "')}" namespace is reserved for templates shipped by m0saic. An external repo registering an official-looking id would run its own code under m0saic's name. Rename the template to your own namespace (e.g. "@your-repo/${e.split("/").slice(1).join("/")||"template/v1"}").`};const o=(r=templateOrigins.get(e))!==null&&r!==void 0?r:templateRegistry.has(e)?FIRST_PARTY:void 0;return o?o.kind==="first-party"?{code:"TEMPLATE_ID_OWNED_BY_FIRST_PARTY",id:e,attemptedBy:t,ownedBy:o,message:`Refused to register "${e}" from external repo ${t}: that id is already registered by ${describeOwner(o)}. The existing template is kept. Rename the template to your own namespace.`}:o.source===t?null:{code:"TEMPLATE_ID_OWNED_BY_OTHER_SOURCE",id:e,attemptedBy:t,ownedBy:o,message:`Refused to register "${e}" from external repo ${t}: that id is already registered by ${describeOwner(o)}. Two external repos claiming one id is a collision, and the first registrant keeps it \u2014 remove one of the sources (a removed source frees its ids on the next restart) or ask the author to rename.`}:null}i(screenExternalRegistration,"screenExternalRegistration");function frameFile(e){var t;const n=(t=/\((.+?):\d+:\d+\)\s*$/.exec(e))!==null&&t!==void 0?t:/\bat\s+(?:async\s+)?(.+?):\d+:\d+\s*$/.exec(e);if(!n)return;let r=n[1];if(r.startsWith("file://"))try{r=decodeURIComponent(r.slice(7))}catch{}if(!(r.startsWith("node:")||r==="<anonymous>"))return r}i(frameFile,"frameFile");const OWN_FILE=(()=>{var e;const t=((e=new Error().stack)!==null&&e!==void 0?e:"").split(`
|
|
2
|
+
`).slice(1).map(frameFile).find(Boolean);return t??void 0})();function repoRelativeRegistrationPath(e){const t=e.split(/[\\/]+/);for(let n=t.length-1;n>=0;n--)if(t[n]==="packages"&&n+2<t.length&&(t[n+2]==="src"||t[n+2]==="dist"))return t.slice(n).join("/");return e}i(repoRelativeRegistrationPath,"repoRelativeRegistrationPath");function captureRegisteredFrom(){const e=new Error().stack;if(e)for(const t of e.split(`
|
|
3
|
+
`).slice(1)){const n=frameFile(t);if(!(!n||n===OWN_FILE))return repoRelativeRegistrationPath(n)}}i(captureRegisteredFrom,"captureRegisteredFrom");function reloadScopeOpen(){return registrationState.get("allowReplace")===!0}i(reloadScopeOpen,"reloadScopeOpen");function isPlainObject(e){if(e===null||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}i(isPlainObject,"isPlainObject");function deepFreezeTemplate(e){const t=new WeakSet,n=i(r=>{if(!(r===null||typeof r!="object")&&!(!Array.isArray(r)&&!isPlainObject(r))&&!t.has(r)){t.add(r);for(const o of Object.keys(r)){const s=Object.getOwnPropertyDescriptor(r,o);s&&"value"in s&&n(s.value)}Object.freeze(r)}},"walk");return n(e),e}i(deepFreezeTemplate,"deepFreezeTemplate");function registerTemplate(e){var t,n;const r=currentOrigin(),o=String((t=e?.id)!==null&&t!==void 0?t:"");if(r.kind==="external"){const p=screenExternalRegistration(o,r.source,r.trustedNamespaces);if(p)return rejectionLog().push(p),{ok:!1,rejection:p}}const s=captureRegisteredFrom();if(r.kind==="first-party"&&templateRegistry.has(o)&&!reloadScopeOpen()&&((n=templateOrigins.get(o))!==null&&n!==void 0?n:FIRST_PARTY).kind==="first-party")throw new TemplateRegistrationError(o,templateRegisteredFrom.get(o),s);const c=(0,templateCatalogStore_1.declaredCatalogEntry)(o,r),l=c?(0,platform_1.applyTemplateCatalogEntry)(e,c):e,a=deepFreezeTemplate((0,defineMosaicTemplate_1.defineMosaicTemplate)(l)),u=carriesCatalog(a);return templateRegistry.set(a.id,a),templateOrigins.set(a.id,r),s===void 0?templateRegisteredFrom.delete(a.id):templateRegisteredFrom.set(a.id,s),u?templateAsRegistered.set(a.id,asWritten(a,a)):templateAsRegistered.delete(a.id),{ok:!0,id:a.id}}i(registerTemplate,"registerTemplate");function declareTemplateCatalog(e){var t,n;const r=originKey(currentOrigin()),o={declared:[],restamped:[]};for(const s of Object.keys(e).sort()){templateCatalogStore_1.templateCatalogEntries.set(s,{entry:e[s],origin:r}),o.declared.push(s);const c=templateRegistry.get(s);if(!c||originKey((t=templateOrigins.get(s))!==null&&t!==void 0?t:FIRST_PARTY)!==r)continue;const l=(n=templateAsRegistered.get(s))!==null&&n!==void 0?n:c,a=deepFreezeTemplate((0,platform_1.applyTemplateCatalogEntry)(l,e[s]));templateRegistry.set(s,a),templateAsRegistered.set(s,asWritten(a,a)),o.restamped.push(s)}return o}i(declareTemplateCatalog,"declareTemplateCatalog");function declareTemplateConventions(e){const t=originKey(currentOrigin());typeof e=="string"&&e.trim()?templateCatalogStore_1.templateConventionTargets.set(t,e.trim()):templateCatalogStore_1.templateConventionTargets.delete(t)}i(declareTemplateConventions,"declareTemplateConventions");function getTemplateAsRegistered(e){var t;return(t=templateAsRegistered.get(e))!==null&&t!==void 0?t:templateRegistry.get(e)}i(getTemplateAsRegistered,"getTemplateAsRegistered");function withTemplateReloadScope(e){const t=registrationState.get("allowReplace"),n=i(()=>{t===void 0?registrationState.delete("allowReplace"):registrationState.set("allowReplace",t)},"restore");registrationState.set("allowReplace",!0);let r;try{r=e()}catch(o){throw n(),o}return isThenable(r)?r.then(o=>(n(),o),o=>{throw n(),o}):(n(),r)}i(withTemplateReloadScope,"withTemplateReloadScope");function isThenable(e){return typeof e=="object"&&e!==null&&typeof e.then=="function"}i(isThenable,"isThenable");function withExternalTemplateOrigin(e,t,n){var r;const o=registrationState.get("origin"),s=i(()=>{o===void 0?registrationState.delete("origin"):registrationState.set("origin",o)},"restore"),c=!((r=n?.trustedNamespaces)===null||r===void 0)&&r.length?{kind:"external",source:e,trustedNamespaces:n.trustedNamespaces}:{kind:"external",source:e};registrationState.set("origin",c);let l;try{l=t()}catch(a){throw s(),a}return isThenable(l)?l.then(a=>(s(),a),a=>{throw s(),a}):(s(),l)}i(withExternalTemplateOrigin,"withExternalTemplateOrigin");function getTemplateOrigin(e){return templateOrigins.get(e)}i(getTemplateOrigin,"getTemplateOrigin");function getTemplateMeta(e){var t;if(templateRegistry.has(e))return{id:e,origin:(t=templateOrigins.get(e))!==null&&t!==void 0?t:FIRST_PARTY,registeredFrom:templateRegisteredFrom.get(e)}}i(getTemplateMeta,"getTemplateMeta");function drainTemplateRegistrationRejections(){const e=rejectionLog(),t=e.slice();return e.length=0,t}i(drainTemplateRegistrationRejections,"drainTemplateRegistrationRejections");function getTemplate(e){return templateRegistry.get(e)}i(getTemplate,"getTemplate");function requireTemplate(e){const t=getTemplate(e);if(!t)throw new Error(`Template with id "${e}" is not registered`);return t}i(requireTemplate,"requireTemplate");function listRegisteredTemplateIds(){return Array.from(templateRegistry.keys()).sort()}i(listRegisteredTemplateIds,"listRegisteredTemplateIds");function __resetTemplateRegistryForTests(){templateRegistry.clear(),templateOrigins.clear(),templateRegisteredFrom.clear(),templateAsRegistered.clear(),templateCatalogStore_1.templateCatalogEntries.clear(),templateCatalogStore_1.templateConventionTargets.clear(),registrationState.clear()}i(__resetTemplateRegistryForTests,"__resetTemplateRegistryForTests");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var o=Object.defineProperty;var t=(e,r)=>o(e,"name",{value:r,configurable:!0});var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.TEMPLATE_CATALOG_PROBLEMS=exports.TEMPLATE_CATALOG=exports.TEMPLATE_CATALOG_FILE=void 0;const platform_1=require("@m0saic/platform"),template_utils_1=require("@m0saic/template-utils"),repo_1=require("./repo"),template_catalog_json_1=__importDefault(require("./template-catalog.json"));var platform_2=require("@m0saic/platform");Object.defineProperty(exports,"TEMPLATE_CATALOG_FILE",{enumerable:!0,get:t(function(){return platform_2.TEMPLATE_CATALOG_FILE},"get")});const parsed=(0,platform_1.parseTemplateCatalogFile)(template_catalog_json_1.default);exports.TEMPLATE_CATALOG=parsed.file,exports.TEMPLATE_CATALOG_PROBLEMS=parsed.problems,(0,template_utils_1.declareTemplateCatalog)(exports.TEMPLATE_CATALOG.templates),(0,template_utils_1.declareTemplateConventions)(repo_1.TEMPLATE_REPO.conventions);
|