@twinfinity/printing 5.0.3-ci.28538-beta
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/README.md +208 -0
- package/dist/BuildInfo.d.ts +25 -0
- package/dist/BuildInfo.d.ts.map +1 -0
- package/dist/BuildInfo.js +15 -0
- package/dist/BuildInfo.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/layout/analyzeTemplate.d.ts +29 -0
- package/dist/layout/analyzeTemplate.d.ts.map +1 -0
- package/dist/layout/analyzeTemplate.js +168 -0
- package/dist/layout/analyzeTemplate.js.map +1 -0
- package/dist/layout/clipUtils.d.ts +18 -0
- package/dist/layout/clipUtils.d.ts.map +1 -0
- package/dist/layout/clipUtils.js +165 -0
- package/dist/layout/clipUtils.js.map +1 -0
- package/dist/layout/colorConstants.d.ts +11 -0
- package/dist/layout/colorConstants.d.ts.map +1 -0
- package/dist/layout/colorConstants.js +14 -0
- package/dist/layout/colorConstants.js.map +1 -0
- package/dist/layout/elementKinds.d.ts +21 -0
- package/dist/layout/elementKinds.d.ts.map +1 -0
- package/dist/layout/elementKinds.js +17 -0
- package/dist/layout/elementKinds.js.map +1 -0
- package/dist/layout/exportDrawing.d.ts +143 -0
- package/dist/layout/exportDrawing.d.ts.map +1 -0
- package/dist/layout/exportDrawing.js +146 -0
- package/dist/layout/exportDrawing.js.map +1 -0
- package/dist/layout/filters.d.ts +33 -0
- package/dist/layout/filters.d.ts.map +1 -0
- package/dist/layout/filters.js +77 -0
- package/dist/layout/filters.js.map +1 -0
- package/dist/layout/geometryConstants.d.ts +8 -0
- package/dist/layout/geometryConstants.d.ts.map +1 -0
- package/dist/layout/geometryConstants.js +10 -0
- package/dist/layout/geometryConstants.js.map +1 -0
- package/dist/layout/index.d.ts +86 -0
- package/dist/layout/index.d.ts.map +1 -0
- package/dist/layout/index.js +363 -0
- package/dist/layout/index.js.map +1 -0
- package/dist/layout/itemBuilders.d.ts +29 -0
- package/dist/layout/itemBuilders.d.ts.map +1 -0
- package/dist/layout/itemBuilders.js +135 -0
- package/dist/layout/itemBuilders.js.map +1 -0
- package/dist/layout/labelsRender.d.ts +29 -0
- package/dist/layout/labelsRender.d.ts.map +1 -0
- package/dist/layout/labelsRender.js +109 -0
- package/dist/layout/labelsRender.js.map +1 -0
- package/dist/layout/legendConstants.d.ts +12 -0
- package/dist/layout/legendConstants.d.ts.map +1 -0
- package/dist/layout/legendConstants.js +12 -0
- package/dist/layout/legendConstants.js.map +1 -0
- package/dist/layout/legendRender.d.ts +13 -0
- package/dist/layout/legendRender.d.ts.map +1 -0
- package/dist/layout/legendRender.js +424 -0
- package/dist/layout/legendRender.js.map +1 -0
- package/dist/layout/legendRows.d.ts +26 -0
- package/dist/layout/legendRows.d.ts.map +1 -0
- package/dist/layout/legendRows.js +45 -0
- package/dist/layout/legendRows.js.map +1 -0
- package/dist/layout/legendUtils.d.ts +21 -0
- package/dist/layout/legendUtils.d.ts.map +1 -0
- package/dist/layout/legendUtils.js +110 -0
- package/dist/layout/legendUtils.js.map +1 -0
- package/dist/layout/metadata.d.ts +43 -0
- package/dist/layout/metadata.d.ts.map +1 -0
- package/dist/layout/metadata.js +191 -0
- package/dist/layout/metadata.js.map +1 -0
- package/dist/layout/model.d.ts +15 -0
- package/dist/layout/model.d.ts.map +1 -0
- package/dist/layout/model.js +310 -0
- package/dist/layout/model.js.map +1 -0
- package/dist/layout/options.d.ts +17 -0
- package/dist/layout/options.d.ts.map +1 -0
- package/dist/layout/options.js +2 -0
- package/dist/layout/options.js.map +1 -0
- package/dist/layout/presets.d.ts +23 -0
- package/dist/layout/presets.d.ts.map +1 -0
- package/dist/layout/presets.js +41 -0
- package/dist/layout/presets.js.map +1 -0
- package/dist/layout/qrRender.d.ts +13 -0
- package/dist/layout/qrRender.d.ts.map +1 -0
- package/dist/layout/qrRender.js +97 -0
- package/dist/layout/qrRender.js.map +1 -0
- package/dist/layout/renderDrawing.d.ts +62 -0
- package/dist/layout/renderDrawing.d.ts.map +1 -0
- package/dist/layout/renderDrawing.js +555 -0
- package/dist/layout/renderDrawing.js.map +1 -0
- package/dist/layout/renderUtils.d.ts +36 -0
- package/dist/layout/renderUtils.d.ts.map +1 -0
- package/dist/layout/renderUtils.js +117 -0
- package/dist/layout/renderUtils.js.map +1 -0
- package/dist/layout/sectionValidation.d.ts +3 -0
- package/dist/layout/sectionValidation.d.ts.map +1 -0
- package/dist/layout/sectionValidation.js +2 -0
- package/dist/layout/sectionValidation.js.map +1 -0
- package/dist/layout/templateVariables.d.ts +137 -0
- package/dist/layout/templateVariables.d.ts.map +1 -0
- package/dist/layout/templateVariables.js +295 -0
- package/dist/layout/templateVariables.js.map +1 -0
- package/dist/layout/typeGuards.d.ts +5 -0
- package/dist/layout/typeGuards.d.ts.map +1 -0
- package/dist/layout/typeGuards.js +9 -0
- package/dist/layout/typeGuards.js.map +1 -0
- package/dist/layout/types.d.ts +816 -0
- package/dist/layout/types.d.ts.map +1 -0
- package/dist/layout/types.js +2 -0
- package/dist/layout/types.js.map +1 -0
- package/dist/layout/utils.d.ts +9 -0
- package/dist/layout/utils.d.ts.map +1 -0
- package/dist/layout/utils.js +84 -0
- package/dist/layout/utils.js.map +1 -0
- package/dist/layout/validation.d.ts +7 -0
- package/dist/layout/validation.d.ts.map +1 -0
- package/dist/layout/validation.js +352 -0
- package/dist/layout/validation.js.map +1 -0
- package/dist/layout/validationHelpers.d.ts +15 -0
- package/dist/layout/validationHelpers.d.ts.map +1 -0
- package/dist/layout/validationHelpers.js +43 -0
- package/dist/layout/validationHelpers.js.map +1 -0
- package/dist/layout/validationUtils.d.ts +5 -0
- package/dist/layout/validationUtils.d.ts.map +1 -0
- package/dist/layout/validationUtils.js +5 -0
- package/dist/layout/validationUtils.js.map +1 -0
- package/dist/layout/viewportPrep.d.ts +47 -0
- package/dist/layout/viewportPrep.d.ts.map +1 -0
- package/dist/layout/viewportPrep.js +275 -0
- package/dist/layout/viewportPrep.js.map +1 -0
- package/dist/layout/viewportRender.d.ts +42 -0
- package/dist/layout/viewportRender.d.ts.map +1 -0
- package/dist/layout/viewportRender.js +337 -0
- package/dist/layout/viewportRender.js.map +1 -0
- package/dist/layout/viewportUtils.d.ts +9 -0
- package/dist/layout/viewportUtils.d.ts.map +1 -0
- package/dist/layout/viewportUtils.js +40 -0
- package/dist/layout/viewportUtils.js.map +1 -0
- package/dist/layout/warnings.d.ts +2 -0
- package/dist/layout/warnings.d.ts.map +1 -0
- package/dist/layout/warnings.js +4 -0
- package/dist/layout/warnings.js.map +1 -0
- package/dist/printToPdf.d.ts +38 -0
- package/dist/printToPdf.d.ts.map +1 -0
- package/dist/printToPdf.js +79 -0
- package/dist/printToPdf.js.map +1 -0
- package/dist/printToSvg.d.ts +11 -0
- package/dist/printToSvg.d.ts.map +1 -0
- package/dist/printToSvg.js +168 -0
- package/dist/printToSvg.js.map +1 -0
- package/dist/sections.d.ts +118 -0
- package/dist/sections.d.ts.map +1 -0
- package/dist/sections.js +839 -0
- package/dist/sections.js.map +1 -0
- package/dist/templates/default-template.json +137 -0
- package/dist/types.d.ts +54 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +11 -0
- package/dist/types.js.map +1 -0
- package/package.json +47 -0
- package/src/BuildInfo.ts +41 -0
- package/src/index.ts +10 -0
- package/src/layout/analyzeTemplate.ts +218 -0
- package/src/layout/clipUtils.ts +193 -0
- package/src/layout/colorConstants.ts +16 -0
- package/src/layout/elementKinds.ts +35 -0
- package/src/layout/exportDrawing.ts +206 -0
- package/src/layout/filters.ts +80 -0
- package/src/layout/geometryConstants.ts +11 -0
- package/src/layout/index.ts +671 -0
- package/src/layout/itemBuilders.ts +159 -0
- package/src/layout/labelsRender.ts +170 -0
- package/src/layout/legendConstants.ts +11 -0
- package/src/layout/legendRender.ts +543 -0
- package/src/layout/legendRows.ts +62 -0
- package/src/layout/legendUtils.ts +144 -0
- package/src/layout/metadata.ts +210 -0
- package/src/layout/model.ts +372 -0
- package/src/layout/options.ts +17 -0
- package/src/layout/presets.ts +51 -0
- package/src/layout/qrRender.ts +126 -0
- package/src/layout/qrcode.d.ts +2 -0
- package/src/layout/renderDrawing.ts +710 -0
- package/src/layout/renderUtils.ts +138 -0
- package/src/layout/sectionValidation.ts +2 -0
- package/src/layout/templateVariables.ts +317 -0
- package/src/layout/typeGuards.ts +9 -0
- package/src/layout/types.ts +835 -0
- package/src/layout/utils.ts +85 -0
- package/src/layout/validation.ts +392 -0
- package/src/layout/validationHelpers.ts +59 -0
- package/src/layout/validationUtils.ts +6 -0
- package/src/layout/viewportPrep.ts +351 -0
- package/src/layout/viewportRender.ts +442 -0
- package/src/layout/viewportUtils.ts +50 -0
- package/src/layout/warnings.ts +3 -0
- package/src/printToPdf.ts +108 -0
- package/src/printToSvg.ts +188 -0
- package/src/sections.ts +1019 -0
- package/src/templates/default-template.json +137 -0
- package/src/types.ts +49 -0
- package/templates/default-a0-landscape.json +209 -0
- package/templates/default-a0-portrait.json +195 -0
- package/templates/default-a1-landscape.json +167 -0
- package/templates/default-a1-portrait.json +153 -0
- package/templates/default-a3-landscape.json +111 -0
- package/templates/default-a3-portrait.json +125 -0
- package/templates/default-a4-landscape.json +97 -0
- package/templates/default-a4-portrait.json +97 -0
- package/templates/template-schema.json +1395 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["layout/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEtE,MAAM,MAAM,aAAa,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAC/C,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG,WAAW,CAAC;AAEvD,MAAM,WAAW,QAAQ;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CA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
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"/","sources":["layout/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { SectionPath, SectionLabel } from '@twinfinity/geometry';\r\n\r\nexport type PagePresetKey = 'a1' | 'a3' | 'a4';\r\nexport type PageOrientation = 'portrait' | 'landscape';\r\n\r\nexport interface PageSpec {\r\n widthMm: number;\r\n heightMm: number;\r\n marginMm?: number;\r\n backgroundColor?: string;\r\n}\r\n\r\nexport interface TextStyle {\r\n fontFamily: string;\r\n fontSizeMm: number;\r\n fontWeight?: 'normal' | 'bold' | 'lighter' | 'bolder' | string;\r\n color?: string;\r\n letterSpacingMm?: number;\r\n lineHeightMm?: number;\r\n}\r\n\r\nexport interface StyleMap {\r\n [styleName: string]: TextStyle;\r\n}\r\n\r\nexport interface AssetSpec {\r\n id: string;\r\n src?: string;\r\n content?: string;\r\n}\r\n\r\nexport type WhereCondition = Record<string, string | number | boolean | Array<string | number>>;\r\n\r\nexport interface ClipConfig {\r\n class?: string | string[];\r\n where: WhereCondition;\r\n expandByM?: number;\r\n clipLabels?: boolean;\r\n stroke?: string;\r\n strokeWidthMm?: number;\r\n strokeOpacity?: number;\r\n fill?: string;\r\n fillOpacity?: number;\r\n}\r\n\r\n/**\r\n * Template-driven fill rule for a viewport.\r\n *\r\n * Fill rules control which products get filled polygons in the drawing.\r\n * When no `fills` array is present on a viewport, no fills are rendered.\r\n *\r\n * Example:\r\n * ```json\r\n * { \"class\": \"space\", \"fill\": \"sample\", \"fillOpacity\": 0.35 }\r\n * { \"class\": \"walls\", \"fill\": \"#cccccc\", \"fillOpacity\": 0.5 }\r\n * ```\r\n */\r\nexport interface FillRule {\r\n /** IFC class filter (e.g. \"space\", \"walls\"). Matches ifcClass or ifcClassId. */\r\n class?: string | string[];\r\n /** Property-based filter (same as highlight/clip `where`). */\r\n where?: WhereCondition;\r\n /** Fill color: CSS hex (e.g. \"#80c8b4\"), \"sample\" to read from 3D model material, or \"legend\" to use colors assigned by legend. */\r\n fill: string;\r\n /** Fill opacity (0–1). Default: 0.35. */\r\n fillOpacity?: number;\r\n /** When true, only apply fill to items whose centroid is spatially inside the clip polygon.\r\n * Useful when expandByM reveals adjacent spaces that shouldn't be filled.\r\n * @default false */\r\n matchClipFilter?: boolean;\r\n}\r\n\r\nexport interface HighlightConfig {\r\n class?: string | string[];\r\n where: WhereCondition;\r\n /** Only highlight items that also appear in the referenced viewport (i.e., intersect both planes). */\r\n intersectsViewport?: string;\r\n stroke?: string;\r\n strokeWidthMm?: number;\r\n strokeOpacity?: number;\r\n fill?: string;\r\n fillOpacity?: number;\r\n}\r\n\r\nexport type LayoutElement =\r\n | ViewportElement\r\n | TextElement\r\n | ImageElement\r\n | LineElement\r\n | RectElement\r\n | CircleElement\r\n | PolylineElement\r\n | PolygonElement\r\n | ScaleBarElement\r\n | QrElement\r\n | LabelsElement\r\n | LegendElement\r\n | GroupElement;\r\n\r\nexport interface BaseElement {\r\n kind: LayoutElement['kind'];\r\n id: string;\r\n zIndex?: number;\r\n}\r\n\r\n/** Style for a single line category in a viewport. */\r\nexport interface ViewportLineStyle {\r\n /** Line width in mm. */\r\n widthMm?: number;\r\n /** Line color (CSS color string). */\r\n color?: string;\r\n /** SVG dash array (e.g. \"4 2\"). */\r\n dash?: string;\r\n /** Whether this category is rendered. Default: true. */\r\n enabled?: boolean;\r\n}\r\n\r\n/**\r\n * Per-category line styles for a viewport.\r\n *\r\n * Resolution order: category-specific → `default` → built-in defaults.\r\n *\r\n * Example:\r\n * ```json\r\n * {\r\n * \"default\": { \"widthMm\": 0.01, \"color\": \"#1f2937\" },\r\n * \"cutLines\": { \"widthMm\": 0.02, \"color\": \"#000000\" },\r\n * \"hiddenLines\": { \"widthMm\": 0.005, \"color\": \"#9ca3af\", \"dash\": \"4 2\" }\r\n * }\r\n * ```\r\n */\r\nexport interface ViewportLineStyles {\r\n /** Fallback style for any category not explicitly listed. */\r\n default?: ViewportLineStyle;\r\n cutLines?: ViewportLineStyle;\r\n visibleLines?: ViewportLineStyle;\r\n hiddenLines?: ViewportLineStyle;\r\n silhouettes?: ViewportLineStyle;\r\n featureEdges?: ViewportLineStyle;\r\n stairArrows?: ViewportLineStyle;\r\n outlineVisible?: ViewportLineStyle;\r\n outlineHidden?: ViewportLineStyle;\r\n}\r\n\r\n/**\r\n * Include filter for viewport geometry.\r\n *\r\n * Can be:\r\n * - String or string array: class names only\r\n * - Object with class + where: property-based filtering\r\n * - Preset reference: { preset: \"presetName\" }\r\n *\r\n * Examples:\r\n * ```json\r\n * \"includeClasses\": [\"space\", \"walls\"]\r\n * \"includeClasses\": [{ \"class\": \"space\", \"where\": { \"BIP.spacetype\": \"ROOM\" } }]\r\n * \"includeClasses\": { \"preset\": \"defaultBuilding\" }\r\n * ```\r\n */\r\nexport type IncludeClassesFilter =\r\n | string\r\n | string[]\r\n | { class?: string | string[]; where?: WhereCondition }\r\n | { preset: string };\r\n\r\n/**\r\n * Resolved include filter (after preset expansion).\r\n * Either a simple class name or a class+where filter.\r\n */\r\nexport type ResolvedIncludeFilter = string | { class?: string | string[]; where: WhereCondition };\r\n\r\nexport interface ViewportElement extends BaseElement {\r\n kind: 'viewport';\r\n xMm: number;\r\n yMm: number;\r\n widthMm: number;\r\n heightMm: number;\r\n scaleMode?: 'fit' | 'fitAndRound' | 'fixed';\r\n fixedScaleDenom?: number;\r\n preferredScales?: number[];\r\n scalePreset?: string;\r\n align?: 'center' | 'topLeft';\r\n rotationDeg?: number;\r\n includeClasses?: IncludeClassesFilter | IncludeClassesFilter[];\r\n /**\r\n * Per-category line styles. When set, overrides `lineWidthMm`/`lineColor`.\r\n * Use `lineStyles.default` for a single style across all categories,\r\n * or specify individual categories (cutLines, hiddenLines, etc.).\r\n */\r\n lineStyles?: ViewportLineStyles;\r\n /** Simple shorthand: default line width for all categories. Overridden by `lineStyles`. */\r\n lineWidthMm?: number;\r\n /** Simple shorthand: default line color for all categories. Overridden by `lineStyles`. */\r\n lineColor?: string;\r\n /**\r\n * Fill rules controlling which products get filled polygons.\r\n * When absent, no fills are rendered (default: no fill).\r\n */\r\n fills?: FillRule[];\r\n northArrow?: { assetId: string; sizeMm?: number; offsetXMm?: number; offsetYMm?: number; rotationDeg?: number };\r\n border?: { stroke?: string; strokeWidthMm?: number; dashed?: boolean };\r\n clip?: ClipConfig;\r\n highlight?: HighlightConfig;\r\n\r\n // Section configuration (overrides app defaults if specified)\r\n /**\r\n * Override cutting plane height for horizontal plans (Y coordinate).\r\n * If omitted, uses app default. Shorthand for planeNormal=[0,1,0], planePosition=cutHeight.\r\n */\r\n cutHeight?: number;\r\n /**\r\n * Override depth above/below cutting plane. If omitted, uses app default.\r\n * Only applicable for SLAB mode (PLANE mode doesn't use depth).\r\n */\r\n depth?: { above?: number; below?: number };\r\n /**\r\n * Plane normal vector [x, y, z]. Automatically normalized.\r\n * Takes precedence over cutHeight if both are specified.\r\n * Examples:\r\n * - [1, 0, 0] = vertical section perpendicular to X axis\r\n * - [0, 1, 0] = horizontal plan (same as using cutHeight)\r\n * - [0, 0, 1] = vertical section perpendicular to Z axis\r\n * - [1, 0, 1] = diagonal section (will be normalized)\r\n */\r\n planeNormal?: [number, number, number];\r\n /**\r\n * Distance from origin along the (normalized) plane normal.\r\n * Used with planeNormal to define the cutting plane.\r\n * The plane passes through the point: normalize(planeNormal) * planePosition.\r\n */\r\n planePosition?: number;\r\n /**\r\n * Section computation mode: 'slab' or 'plane'.\r\n * - 'slab': Optimized for horizontal floor plans. Uses depth above/below to include geometry.\r\n * - 'plane': Arbitrary plane cuts (vertical sections, diagonal sections). Computes exact intersection.\r\n *\r\n * If omitted, mode is auto-detected from plane orientation:\r\n * - Horizontal planes (planeNormal ≈ Y-axis) → 'slab'\r\n * - Vertical or diagonal planes → 'plane'\r\n */\r\n mode?: 'slab' | 'plane';\r\n}\r\n\r\nexport interface TextElement extends BaseElement {\r\n kind: 'text';\r\n xMm: number;\r\n yMm: number;\r\n textStyle?: string;\r\n text: string;\r\n maxWidthMm?: number;\r\n align?: 'left' | 'center' | 'right';\r\n}\r\n\r\nexport interface ImageElement extends BaseElement {\r\n kind: 'image';\r\n xMm: number;\r\n yMm: number;\r\n widthMm: number;\r\n heightMm: number;\r\n assetId: string;\r\n fit?: 'contain' | 'cover' | 'stretch';\r\n}\r\n\r\nexport interface LineElement extends BaseElement {\r\n kind: 'line';\r\n x1Mm: number;\r\n y1Mm: number;\r\n x2Mm: number;\r\n y2Mm: number;\r\n stroke?: string;\r\n strokeWidthMm?: number;\r\n dashed?: boolean;\r\n}\r\n\r\nexport interface RectElement extends BaseElement {\r\n kind: 'rect';\r\n xMm: number;\r\n yMm: number;\r\n widthMm: number;\r\n heightMm: number;\r\n stroke?: string;\r\n strokeWidthMm?: number;\r\n fill?: string;\r\n dashed?: boolean;\r\n}\r\n\r\nexport interface CircleElement extends BaseElement {\r\n kind: 'circle';\r\n cxMm: number;\r\n cyMm: number;\r\n rMm: number;\r\n stroke?: string;\r\n strokeWidthMm?: number;\r\n fill?: string;\r\n dashed?: boolean;\r\n}\r\n\r\nexport interface PointMm {\r\n xMm: number;\r\n yMm: number;\r\n}\r\n\r\nexport interface PolylineElement extends BaseElement {\r\n kind: 'polyline';\r\n points: PointMm[];\r\n stroke: string;\r\n strokeWidthMm: number;\r\n dashed?: boolean;\r\n}\r\n\r\nexport interface PolygonElement extends BaseElement {\r\n kind: 'polygon';\r\n points: PointMm[];\r\n stroke?: string;\r\n strokeWidthMm?: number;\r\n fill?: string;\r\n dashed?: boolean;\r\n}\r\n\r\nexport interface ScaleBarElement extends BaseElement {\r\n kind: 'scaleBar';\r\n xMm: number;\r\n yMm: number;\r\n maxLengthMm: number;\r\n unit?: string;\r\n segments?: number;\r\n labelEvery?: number;\r\n stroke?: string;\r\n strokeWidthMm?: number;\r\n textStyle?: string;\r\n viewport?: string;\r\n}\r\n\r\nexport interface QrElement extends BaseElement {\r\n kind: 'qr';\r\n xMm: number;\r\n yMm: number;\r\n sizeMm: number;\r\n role?: 'main' | 'anchor' | 'custom';\r\n anchorCorner?: 'bottom-left' | 'bottom-right' | 'top-left' | 'top-right';\r\n viewport?: string;\r\n dataTemplate?: string;\r\n}\r\n\r\nexport interface LabelsElement extends BaseElement {\r\n kind: 'labels';\r\n viewport: string;\r\n class?: string | string[];\r\n where?: WhereCondition;\r\n text: string;\r\n textStyle?: string;\r\n align?: 'left' | 'center' | 'right';\r\n maxWidthMm?: number;\r\n /** When true, only show labels for items whose position is spatially inside the clip polygon.\r\n * @default false */\r\n matchClipFilter?: boolean;\r\n}\r\n\r\nexport type LegendAnchor = 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left';\r\n\r\nexport interface LegendColumn {\r\n id: string;\r\n label: string;\r\n property: string;\r\n format?: { digits?: number; prefix?: string; suffix?: string };\r\n align?: 'left' | 'center' | 'right';\r\n minWidthMm?: number;\r\n maxWidthMm?: number;\r\n /**\r\n * Enable summary (total) calculation for this column.\r\n * When true, the summary row will show the sum of all values in this column.\r\n * Only works for numerical columns.\r\n * @default false\r\n */\r\n summary?: boolean;\r\n}\r\n\r\nexport interface LegendElement extends BaseElement {\r\n kind: 'legend';\r\n viewport: string;\r\n class?: string | string[];\r\n where?: WhereCondition;\r\n clipToViewport?: boolean;\r\n anchor?: LegendAnchor;\r\n anchorPositionMm?: { xMm: number; yMm: number };\r\n marginMm?: number;\r\n textStyle?: string;\r\n showColorColumn?: boolean;\r\n colorColumnWidthMm?: number;\r\n cellPaddingMm?: number;\r\n borderStrokeWidthMm?: number;\r\n borderStrokeColor?: string;\r\n gridStrokeWidthMm?: number;\r\n gridStrokeColor?: string;\r\n headerStrokeWidthMm?: number;\r\n headerStrokeColor?: string;\r\n columns: LegendColumn[];\r\n /**\r\n * Summary row configuration.\r\n * Displays a totals row at the bottom of the legend.\r\n * Columns with `summary: true` will show their sum in the summary row.\r\n *\r\n * @example\r\n * ```json\r\n * {\r\n * \"summary\": {\r\n * \"enabled\": true,\r\n * \"label\": \"Total\"\r\n * },\r\n * \"columns\": [\r\n * { \"id\": \"name\", \"label\": \"Room\", \"property\": \"BIP.spacename\" },\r\n * { \"id\": \"area\", \"label\": \"Area\", \"property\": \"BIP.area\", \"summary\": true }\r\n * ]\r\n * }\r\n * ```\r\n */\r\n summary?: {\r\n /** Enable summary row. */\r\n enabled: boolean;\r\n /** Label for first column in summary row. Defaults to \"Total\". */\r\n label?: string;\r\n };\r\n /**\r\n * Group legend rows by a specific column property.\r\n * When enabled, rows with identical values in the groupBy column are consolidated into a single row.\r\n * Numerical columns are summed across grouped rows; non-numerical columns take the first value.\r\n *\r\n * @example\r\n * ```json\r\n * {\r\n * \"groupBy\": \"BIP.spacename\",\r\n * \"columns\": [\r\n * { \"id\": \"name\", \"label\": \"Room\", \"property\": \"BIP.spacename\" },\r\n * { \"id\": \"area\", \"label\": \"Area\", \"property\": \"BIP.area\", \"format\": { \"digits\": 2 } }\r\n * ]\r\n * }\r\n * ```\r\n * This groups all rooms with the same name and sums their areas.\r\n */\r\n groupBy?: string;\r\n /**\r\n * Assign colors to legend rows and apply them to the referenced viewport.\r\n * When enabled, generates colors for each legend row (or group if groupBy is used).\r\n * The viewport can use these colors by setting fill: \"legend\" in its fill rules.\r\n *\r\n * @example\r\n * ```json\r\n * {\r\n * \"assignColors\": {\r\n * \"enabled\": true,\r\n * \"palette\": \"auto\"\r\n * },\r\n * \"groupBy\": \"BIP.spacename\"\r\n * }\r\n * ```\r\n * Generates distinct colors for each room type, applied to matching spaces in viewport.\r\n */\r\n assignColors?: {\r\n /** Enable color assignment to viewport items. */\r\n enabled: boolean;\r\n /** Color palette: \"auto\" for auto-generated colors, or array of hex colors. */\r\n palette?: 'auto' | string[];\r\n };\r\n}\r\n\r\nexport interface GroupTransform {\r\n translateXMm?: number;\r\n translateYMm?: number;\r\n rotateDeg?: number;\r\n scaleX?: number;\r\n scaleY?: number;\r\n}\r\n\r\nexport interface GroupClipRect {\r\n type: 'rect';\r\n xMm: number;\r\n yMm: number;\r\n widthMm: number;\r\n heightMm: number;\r\n}\r\n\r\nexport interface GroupElement extends BaseElement {\r\n kind: 'group';\r\n opacity?: number;\r\n transform?: GroupTransform;\r\n clip?: GroupClipRect;\r\n children: LayoutElement[];\r\n}\r\n\r\n/**\r\n * Template variable definition.\r\n *\r\n * Variables allow templates to be parameterized and reused with different values.\r\n * All variables MUST have a default value to ensure templates work without user input.\r\n *\r\n * Variables are referenced in templates using {{vars.variableName}} syntax.\r\n *\r\n * Example:\r\n * ```json\r\n * {\r\n * \"variables\": {\r\n * \"hyresobjektsnummer\": {\r\n * \"type\": \"string\",\r\n * \"default\": \"2022-F2008\",\r\n * \"label\": \"Hyresobjekt Number\",\r\n * \"description\": \"The rental object identifier\"\r\n * }\r\n * },\r\n * \"elements\": [\r\n * {\r\n * \"kind\": \"text\",\r\n * \"text\": \"Hyresobjekt: {{vars.hyresobjektsnummer}}\"\r\n * }\r\n * ]\r\n * }\r\n * ```\r\n */\r\nexport interface TemplateVariableDef {\r\n /** Variable type. Determines validation and UI control type. */\r\n type: 'string' | 'number' | 'boolean' | 'array';\r\n\r\n /**\r\n * Default value for this variable.\r\n * REQUIRED - ensures template always works even without user input.\r\n * Must match the specified type.\r\n */\r\n default: any;\r\n\r\n /** Human-readable label for UI generation. Defaults to variable name. */\r\n label?: string;\r\n\r\n /** Description/help text for UI generation. */\r\n description?: string;\r\n\r\n /**\r\n * Semantic format hint for UI generation.\r\n * Provides additional context for rendering appropriate controls.\r\n *\r\n * - `color`: Renders color picker (for type: 'string')\r\n * - `email`: Renders email input with validation (for type: 'string')\r\n * - `url`: Renders URL input with validation (for type: 'string')\r\n * - `date`: Renders date picker (for type: 'string')\r\n *\r\n * @example\r\n * ```json\r\n * {\r\n * \"lineColor\": {\r\n * \"type\": \"string\",\r\n * \"format\": \"color\",\r\n * \"default\": \"#1f2937\"\r\n * }\r\n * }\r\n * ```\r\n */\r\n format?: 'color' | 'email' | 'url' | 'date';\r\n\r\n // String validation\r\n /** Minimum string length (for type: 'string'). */\r\n minLength?: number;\r\n /** Maximum string length (for type: 'string'). */\r\n maxLength?: number;\r\n /** Regex pattern for validation (for type: 'string'). */\r\n pattern?: string;\r\n /** Allowed values (dropdown options). */\r\n enum?: string[];\r\n\r\n // Number validation\r\n /** Minimum value (for type: 'number'). */\r\n min?: number;\r\n /** Maximum value (for type: 'number'). */\r\n max?: number;\r\n /** Step size for UI controls (for type: 'number'). */\r\n step?: number;\r\n\r\n // Array validation\r\n /** Array item specification (for type: 'array'). */\r\n items?: {\r\n type: 'string' | 'number';\r\n enum?: any[];\r\n };\r\n}\r\n\r\n/**\r\n * Variable information extracted from template for UI generation.\r\n */\r\nexport interface TemplateVariableInfo {\r\n name: string;\r\n type: 'string' | 'number' | 'boolean' | 'array';\r\n default: any;\r\n label: string;\r\n description?: string;\r\n format?: 'color' | 'email' | 'url' | 'date';\r\n min?: number;\r\n max?: number;\r\n step?: number;\r\n minLength?: number;\r\n maxLength?: number;\r\n pattern?: string;\r\n enum?: any[];\r\n items?: {\r\n type: 'string' | 'number';\r\n enum?: any[];\r\n };\r\n}\r\n\r\nexport interface LayoutTemplate {\r\n /** JSON Schema reference for editor autocompletion. Ignored at runtime. */\r\n $schema?: string;\r\n id?: string;\r\n\r\n /**\r\n * Template variables for parameterization.\r\n *\r\n * Variables allow templates to be reused with different values.\r\n * All variables MUST have defaults - templates work without user input.\r\n * Reference variables in template using {{vars.variableName}} syntax.\r\n *\r\n * Optional - templates without variables work as before (backward compatible).\r\n */\r\n variables?: Record<string, TemplateVariableDef>;\r\n\r\n page: PageSpec;\r\n styles?: StyleMap;\r\n assets?: AssetSpec[];\r\n elements: LayoutElement[];\r\n presets?: {\r\n includeClasses?: Record<string, string[]>;\r\n scales?: Record<string, { preferredScales?: number[] }>;\r\n };\r\n /** Allow fetching remote assets (images, fonts). Default: false. */\r\n allowRemoteAssets?: boolean;\r\n}\r\n\r\nexport interface ModelMetadataEntry {\r\n productId?: string;\r\n ifcClass?: string;\r\n properties?: any;\r\n [key: string]: any;\r\n}\r\n\r\nexport type ModelMetadata = Record<string, ModelMetadataEntry>;\r\n\r\nexport interface ProductFieldPaths {\r\n idPath?: string;\r\n namePath?: string;\r\n areaPath?: string;\r\n classPath?: string;\r\n}\r\n\r\nexport interface NormalizedProductItem {\r\n gid?: string;\r\n /** IfcClassType category (e.g. \"space\", \"walls\"). Used for template class filters. */\r\n ifcClass?: string | null;\r\n /** PredefinedIfcClassId (e.g. \"IfcSpace\", \"IfcWall\"). Used as fallback for class matching. */\r\n ifcClassId?: string | null;\r\n propertySets: Record<string, Record<string, { value: any; unit?: string; type?: string }>>;\r\n productId: string;\r\n productName: string;\r\n area: number | null;\r\n x?: number | null;\r\n z?: number | null;\r\n polylines?: Array<{ points?: Array<{ x: number; z: number }> }>;\r\n [key: string]: any;\r\n}\r\n\r\nexport type SectionStateValidationResult =\r\n | { ok: true }\r\n | {\r\n ok: false;\r\n errors: string[];\r\n };\r\n\r\nexport interface LabelStyle {\r\n /** Text fill color. Default: \"#374151\" */\r\n fill?: string;\r\n /** Font family. Default: '\"Segoe UI\", \"Helvetica Neue\", Arial, sans-serif' */\r\n fontFamily?: string;\r\n /** Font weight. Default: \"300\" */\r\n fontWeight?: string;\r\n}\r\n\r\nexport interface SvgModelView {\r\n groupSvg: string;\r\n widthModel: number;\r\n heightModel: number;\r\n geometryTransform?: string;\r\n transform?: {\r\n viewMinX: number;\r\n viewMaxX: number;\r\n viewMinZ: number;\r\n viewMaxZ: number;\r\n viewWidth: number;\r\n viewHeight: number;\r\n };\r\n rawPaths?: SectionPath[];\r\n rawLabels?: SectionLabel[];\r\n labelStyle?: LabelStyle;\r\n}\r\n\r\nexport type ModelContext = Record<string, SvgModelView>;\r\nexport type LayoutData = Record<string, any>;\r\nexport type ViewportItemsMap = Record<string, { items: NormalizedProductItem[] }>;\r\nexport type LayoutDataViewports = { viewports: ViewportItemsMap } & Record<string, any>;\r\n\r\nexport interface ValidationOptions {\r\n allowRemoteAssets?: boolean;\r\n allowDataUrls?: boolean;\r\n maxViewports?: number;\r\n}\r\n\r\nexport interface ValidationIssue {\r\n path: string;\r\n message: string;\r\n}\r\n\r\nexport type ValidationResult = { ok: true; template: any } | { ok: false; errors: ValidationIssue[] };\r\n\r\nexport interface ComputedViewportScale {\r\n denom: number;\r\n mmPerModelUnit: number;\r\n fits: boolean;\r\n}\r\n\r\nexport interface SectionResult {\r\n perProduct: Array<{\r\n product: any;\r\n segments: Array<[any, any]>;\r\n polylines: Array<{ points: any[]; closed: boolean }>;\r\n }>;\r\n}\r\n\r\nexport interface RenderDrawingInput {\r\n template: LayoutTemplate;\r\n /**\r\n * Section geometry to render.\r\n *\r\n * - Pass a single `SectionResult` to use the same geometry for every viewport.\r\n * - Pass a `Record<string, SectionResult>` keyed by viewport ID for per-viewport control.\r\n *\r\n * Either `sections` or `models` must be provided. When `models` is provided,\r\n * `sections` is ignored and the pre-built SvgModelViews are used directly.\r\n */\r\n sections?: SectionResult | Record<string, SectionResult>;\r\n /**\r\n * Pre-built model views keyed by viewport ID.\r\n *\r\n * Use this when geometry comes from a source other than `computePlaneSection`\r\n * (e.g. SlabSection). The caller is responsible for producing `SvgModelView`\r\n * objects; `renderDrawing` will pass them straight to `renderLayout`.\r\n */\r\n models?: ModelContext;\r\n options?: {\r\n allowRemoteAssets?: boolean;\r\n qrContext?: {\r\n host?: string | null;\r\n containerName?: string | null;\r\n floorName?: string | null;\r\n planeHeight?: number | null;\r\n };\r\n /**\r\n * Embed room labels directly in the section SVG.\r\n *\r\n * Only use this when the template does NOT have its own `labels` elements,\r\n * otherwise you will get duplicate labels. When omitted, renderDrawing\r\n * auto-detects template `labels` elements and skips embedding.\r\n */\r\n roomLabels?: {\r\n /** Dot-separated path to the label text under product.properties.data. */\r\n labelPath: string;\r\n /** IFC class name filter (e.g. \"space\"). If omitted, all entries are included. */\r\n classFilter?: string;\r\n };\r\n /**\r\n * Raw per-product entries for automatic item building when using `models`.\r\n *\r\n * Each entry needs a `product` (BIM object with gid, name, class, properties)\r\n * and `polylines` (for centroid computation and fill polygon rendering).\r\n *\r\n * When provided, renderDrawing builds NormalizedProductItems per viewport,\r\n * resolving fill colors from each viewport's fill rules. This replaces\r\n * manual item construction in consumer code.\r\n *\r\n * Ignored when `viewportItems` is also provided (explicit items take priority).\r\n */\r\n productEntries?: Array<{\r\n product: unknown;\r\n polylines: Array<{ points: Array<{ x: number; z: number }> }>;\r\n }>;\r\n /**\r\n * Pre-built product items when `models` is provided directly.\r\n * Keyed by viewport ID, each containing an array of NormalizedProductItems.\r\n * Used for legends, labels, and other template elements that need item data.\r\n *\r\n * Takes priority over `productEntries` when both are provided.\r\n */\r\n viewportItems?: Record<string, { items: NormalizedProductItem[] }>;\r\n /**\r\n * App default section settings. Used as fallback when viewports don't specify\r\n * their own cutHeight/depth configuration.\r\n */\r\n sectionDefaults?: {\r\n cutHeight?: number;\r\n depth?: { above?: number; below?: number };\r\n };\r\n /**\r\n * Template variable values.\r\n *\r\n * When template defines `variables`, provide values here to customize the output.\r\n * Missing values automatically use defaults from template (fail-safe).\r\n * Invalid values fall back to defaults with warnings.\r\n *\r\n * Optional - if not provided, all template defaults are used.\r\n *\r\n * @example\r\n * ```typescript\r\n * await renderDrawing({\r\n * template,\r\n * models,\r\n * options: {\r\n * variables: {\r\n * hyresobjektsnummer: '2022-F2009',\r\n * showLegend: true\r\n * }\r\n * }\r\n * });\r\n * ```\r\n */\r\n variables?: Record<string, any>;\r\n };\r\n}\r\n\r\nexport interface RenderDrawingResult {\r\n svg: string;\r\n warnings: string[];\r\n}\r\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { SectionPath } from '@twinfinity/geometry';
|
|
2
|
+
export declare const uniquePositiveDenoms: (input?: readonly number[]) => number[];
|
|
3
|
+
export declare const computeLabelFontSize: (templateFontSize: number, sectionScale: number) => number;
|
|
4
|
+
export declare const colorFromString: (value: string) => [number, number, number, number];
|
|
5
|
+
export declare const applyLineStyleToPaths: (paths: SectionPath[], style: {
|
|
6
|
+
stroke?: string;
|
|
7
|
+
strokeWidth?: number;
|
|
8
|
+
}) => SectionPath[];
|
|
9
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"/","sources":["layout/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAGxD,eAAO,MAAM,oBAAoB,GAAI,QAAQ,SAAS,MAAM,EAAE,KAAG,MAAM,EAWtE,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,kBAAkB,MAAM,EAAE,cAAc,MAAM,KAAG,MAIrF,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,OAAO,MAAM,KAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAmC9E,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAC9B,OAAO,WAAW,EAAE,EACpB,OAAO;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,KACjD,WAAW,EAsBb,CAAC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { RGB_MAX } from './colorConstants';
|
|
2
|
+
export const uniquePositiveDenoms = (input) => {
|
|
3
|
+
const values = Array.isArray(input) && input.length ? input : [];
|
|
4
|
+
const seen = new Set();
|
|
5
|
+
const filtered = [];
|
|
6
|
+
values.forEach((d) => {
|
|
7
|
+
if (typeof d === 'number' && Number.isFinite(d) && d > 0 && !seen.has(d)) {
|
|
8
|
+
seen.add(d);
|
|
9
|
+
filtered.push(d);
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
return filtered.sort((a, b) => a - b);
|
|
13
|
+
};
|
|
14
|
+
export const computeLabelFontSize = (templateFontSize, sectionScale) => {
|
|
15
|
+
const base = typeof templateFontSize === 'number' && Number.isFinite(templateFontSize) ? templateFontSize : 5;
|
|
16
|
+
if (!Number.isFinite(sectionScale) || sectionScale <= 0)
|
|
17
|
+
return base;
|
|
18
|
+
return base / sectionScale;
|
|
19
|
+
};
|
|
20
|
+
export const colorFromString = (value) => {
|
|
21
|
+
let hash = 0;
|
|
22
|
+
for (let i = 0; i < value.length; i++) {
|
|
23
|
+
hash = (hash << 5) - hash + value.charCodeAt(i);
|
|
24
|
+
hash |= 0;
|
|
25
|
+
}
|
|
26
|
+
const hue = Math.abs(hash) % 360;
|
|
27
|
+
const sat = 60;
|
|
28
|
+
const light = 65;
|
|
29
|
+
const c = (1 - Math.abs((2 * light) / 100 - 1)) * (sat / 100);
|
|
30
|
+
const x = c * (1 - Math.abs(((hue / 60) % 2) - 1));
|
|
31
|
+
const m = light / 100 - c / 2;
|
|
32
|
+
let r = 0;
|
|
33
|
+
let g = 0;
|
|
34
|
+
let b = 0;
|
|
35
|
+
if (hue < 60) {
|
|
36
|
+
r = c;
|
|
37
|
+
g = x;
|
|
38
|
+
}
|
|
39
|
+
else if (hue < 120) {
|
|
40
|
+
r = x;
|
|
41
|
+
g = c;
|
|
42
|
+
}
|
|
43
|
+
else if (hue < 180) {
|
|
44
|
+
g = c;
|
|
45
|
+
b = x;
|
|
46
|
+
}
|
|
47
|
+
else if (hue < 240) {
|
|
48
|
+
g = x;
|
|
49
|
+
b = c;
|
|
50
|
+
}
|
|
51
|
+
else if (hue < 300) {
|
|
52
|
+
r = x;
|
|
53
|
+
b = c;
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
r = c;
|
|
57
|
+
b = x;
|
|
58
|
+
}
|
|
59
|
+
return [Math.round((r + m) * RGB_MAX), Math.round((g + m) * RGB_MAX), Math.round((b + m) * RGB_MAX), RGB_MAX];
|
|
60
|
+
};
|
|
61
|
+
export const applyLineStyleToPaths = (paths, style) => {
|
|
62
|
+
if (!Array.isArray(paths) || !paths.length) {
|
|
63
|
+
return paths ?? [];
|
|
64
|
+
}
|
|
65
|
+
const stroke = typeof style.stroke === 'string' && style.stroke.trim().length ? style.stroke.trim() : undefined;
|
|
66
|
+
const strokeWidth = typeof style.strokeWidth === 'number' ? style.strokeWidth : undefined;
|
|
67
|
+
if (!stroke && strokeWidth === undefined) {
|
|
68
|
+
return paths;
|
|
69
|
+
}
|
|
70
|
+
return paths.map((path) => {
|
|
71
|
+
if (!path || !path.stroke || path.stroke === 'none') {
|
|
72
|
+
return path;
|
|
73
|
+
}
|
|
74
|
+
const next = { ...path };
|
|
75
|
+
if (stroke) {
|
|
76
|
+
next.stroke = stroke;
|
|
77
|
+
}
|
|
78
|
+
if (strokeWidth !== undefined) {
|
|
79
|
+
next.strokeWidth = strokeWidth;
|
|
80
|
+
}
|
|
81
|
+
return next;
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"/","sources":["layout/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,KAAyB,EAAY,EAAE;IACxE,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;IACjE,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;QACjB,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;YACvE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YACZ,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACrB,CAAC;IACL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uniquePositiveDenoms = (input?: readonly number[]): number[] => {\r\n const values = Array.isArray(input) && input.length ? input : [];\r\n const seen = new Set<number>();\r\n const filtered: number[] = [];\r\n values.forEach((d) => {\r\n if (typeof d === 'number' && Number.isFinite(d) && d > 0 && !seen.has(d)) {\r\n seen.add(d);\r\n filtered.push(d);\r\n }\r\n });\r\n return filtered.sort((a, b) => a - b);\r\n};\r\n\r\nexport const computeLabelFontSize = (templateFontSize: number, sectionScale: number): number => {\r\n const base = typeof templateFontSize === 'number' && Number.isFinite(templateFontSize) ? templateFontSize : 5;\r\n if (!Number.isFinite(sectionScale) || sectionScale <= 0) return base;\r\n return base / sectionScale;\r\n};\r\n\r\nexport const colorFromString = (value: string): [number, number, number, number] => {\r\n let hash = 0;\r\n for (let i = 0; i < value.length; i++) {\r\n hash = (hash << 5) - hash + value.charCodeAt(i);\r\n hash |= 0;\r\n }\r\n const hue = Math.abs(hash) % 360;\r\n const sat = 60;\r\n const light = 65;\r\n const c = (1 - Math.abs((2 * light) / 100 - 1)) * (sat / 100);\r\n const x = c * (1 - Math.abs(((hue / 60) % 2) - 1));\r\n const m = light / 100 - c / 2;\r\n let r = 0;\r\n let g = 0;\r\n let b = 0;\r\n if (hue < 60) {\r\n r = c;\r\n g = x;\r\n } else if (hue < 120) {\r\n r = x;\r\n g = c;\r\n } else if (hue < 180) {\r\n g = c;\r\n b = x;\r\n } else if (hue < 240) {\r\n g = x;\r\n b = c;\r\n } else if (hue < 300) {\r\n r = x;\r\n b = c;\r\n } else {\r\n r = c;\r\n b = x;\r\n }\r\n return [Math.round((r + m) * RGB_MAX), Math.round((g + m) * RGB_MAX), Math.round((b + m) * RGB_MAX), RGB_MAX];\r\n};\r\n\r\nexport const applyLineStyleToPaths = (\r\n paths: SectionPath[],\r\n style: { stroke?: string; strokeWidth?: number }\r\n): SectionPath[] => {\r\n if (!Array.isArray(paths) || !paths.length) {\r\n return paths ?? [];\r\n }\r\n const stroke = typeof style.stroke === 'string' && style.stroke.trim().length ? style.stroke.trim() : undefined;\r\n const strokeWidth = typeof style.strokeWidth === 'number' ? style.strokeWidth : undefined;\r\n if (!stroke && strokeWidth === undefined) {\r\n return paths;\r\n }\r\n return paths.map((path) => {\r\n if (!path || !path.stroke || path.stroke === 'none') {\r\n return path;\r\n }\r\n const next: SectionPath = { ...path };\r\n if (stroke) {\r\n next.stroke = stroke;\r\n }\r\n if (strokeWidth !== undefined) {\r\n next.strokeWidth = strokeWidth;\r\n }\r\n return next;\r\n });\r\n};\r\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ValidationOptions, ValidationIssue, ValidationResult } from './types';
|
|
2
|
+
export type { ValidationOptions, ValidationIssue, ValidationResult };
|
|
3
|
+
/**
|
|
4
|
+
* Lightweight template validation (structure only) for v2 schema.
|
|
5
|
+
*/
|
|
6
|
+
export declare function validateLayoutTemplate(template: unknown, options?: ValidationOptions): ValidationResult;
|
|
7
|
+
//# sourceMappingURL=validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"/","sources":["layout/validation.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AACpF,YAAY,EAAE,iBAAiB,EAAE,eAAe,EAAE,gBAAgB,EAAE,CAAC;AAErE;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,gBAAgB,CAkXvG"}
|
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
import { isNonEmptyString, isPositiveNumber, isRemoteUrl, isDataUrl } from './validationUtils';
|
|
2
|
+
import { isRecord, getProp } from './validationHelpers';
|
|
3
|
+
import { ELEMENT_KIND_VIEWPORT, ELEMENT_KIND_TEXT, ELEMENT_KIND_IMAGE, ELEMENT_KIND_LINE, ELEMENT_KIND_RECT, ELEMENT_KIND_SCALE_BAR, ELEMENT_KIND_QR, ELEMENT_KIND_LABELS, ELEMENT_KIND_LEGEND, ELEMENT_KIND_GROUP } from './elementKinds';
|
|
4
|
+
/**
|
|
5
|
+
* Lightweight template validation (structure only) for v2 schema.
|
|
6
|
+
*/
|
|
7
|
+
export function validateLayoutTemplate(template, options) {
|
|
8
|
+
const allowRemoteAssets = options?.allowRemoteAssets ?? true;
|
|
9
|
+
const allowDataUrls = options?.allowDataUrls ?? true;
|
|
10
|
+
const maxViewports = options?.maxViewports ?? 3;
|
|
11
|
+
const errors = [];
|
|
12
|
+
if (!isRecord(template)) {
|
|
13
|
+
return { ok: false, errors: [{ path: '', message: 'Template must be an object.' }] };
|
|
14
|
+
}
|
|
15
|
+
const t = template;
|
|
16
|
+
const page = getProp(t, 'page');
|
|
17
|
+
if (!isRecord(page)) {
|
|
18
|
+
errors.push({ path: 'page', message: 'Page definition is required.' });
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
if (!isPositiveNumber(getProp(page, 'widthMm')))
|
|
22
|
+
errors.push({ path: 'page.widthMm', message: 'widthMm must be > 0.' });
|
|
23
|
+
if (!isPositiveNumber(getProp(page, 'heightMm')))
|
|
24
|
+
errors.push({ path: 'page.heightMm', message: 'heightMm must be > 0.' });
|
|
25
|
+
const marginMm = getProp(page, 'marginMm');
|
|
26
|
+
if (marginMm !== undefined && typeof marginMm !== 'number') {
|
|
27
|
+
errors.push({ path: 'page.marginMm', message: 'marginMm must be a number when provided.' });
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
const assetIds = new Set();
|
|
31
|
+
const assets = getProp(t, 'assets');
|
|
32
|
+
if (Array.isArray(assets)) {
|
|
33
|
+
assets.forEach((asset, index) => {
|
|
34
|
+
if (!isRecord(asset)) {
|
|
35
|
+
errors.push({ path: `assets[${index}]`, message: 'Asset must be an object.' });
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const id = getProp(asset, 'id');
|
|
39
|
+
if (!isNonEmptyString(id)) {
|
|
40
|
+
errors.push({ path: `assets[${index}].id`, message: 'Asset id is required.' });
|
|
41
|
+
}
|
|
42
|
+
else if (assetIds.has(id)) {
|
|
43
|
+
errors.push({ path: `assets[${index}].id`, message: 'Duplicate asset id.' });
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
assetIds.add(id);
|
|
47
|
+
}
|
|
48
|
+
const src = getProp(asset, 'src');
|
|
49
|
+
const content = getProp(asset, 'content');
|
|
50
|
+
if (!isNonEmptyString(src) && !isNonEmptyString(content)) {
|
|
51
|
+
errors.push({ path: `assets[${index}]`, message: 'Asset must have either src or content.' });
|
|
52
|
+
}
|
|
53
|
+
if (isNonEmptyString(src)) {
|
|
54
|
+
if (isRemoteUrl(src) && !allowRemoteAssets) {
|
|
55
|
+
errors.push({ path: `assets[${index}].src`, message: 'Remote URLs are not allowed for assets.' });
|
|
56
|
+
}
|
|
57
|
+
else if (isDataUrl(src) && !allowDataUrls) {
|
|
58
|
+
errors.push({ path: `assets[${index}].src`, message: 'Data URLs are not allowed for assets.' });
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
else if (assets !== undefined) {
|
|
64
|
+
errors.push({ path: 'assets', message: 'Assets must be an array when provided.' });
|
|
65
|
+
}
|
|
66
|
+
const styleNames = new Set();
|
|
67
|
+
const styles = getProp(t, 'styles');
|
|
68
|
+
if (styles !== undefined) {
|
|
69
|
+
if (!isRecord(styles)) {
|
|
70
|
+
errors.push({ path: 'styles', message: 'Styles must be an object map.' });
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
Object.entries(styles).forEach(([name, style]) => {
|
|
74
|
+
styleNames.add(name);
|
|
75
|
+
if (!isRecord(style)) {
|
|
76
|
+
errors.push({ path: `styles.${name}`, message: 'Style must be an object.' });
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
if (!isNonEmptyString(getProp(style, 'fontFamily'))) {
|
|
80
|
+
errors.push({ path: `styles.${name}.fontFamily`, message: 'fontFamily is required.' });
|
|
81
|
+
}
|
|
82
|
+
if (!isPositiveNumber(getProp(style, 'fontSizeMm'))) {
|
|
83
|
+
errors.push({ path: `styles.${name}.fontSizeMm`, message: 'fontSizeMm must be > 0.' });
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
let viewportCount = 0;
|
|
89
|
+
const validateElement = (el, path) => {
|
|
90
|
+
if (!isRecord(el)) {
|
|
91
|
+
errors.push({ path, message: 'Element must be an object.' });
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
const kind = getProp(el, 'kind');
|
|
95
|
+
if (!kind || typeof kind !== 'string') {
|
|
96
|
+
errors.push({ path: `${path}.kind`, message: 'Element kind is required.' });
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
const ensure = (condition, subPath, message) => {
|
|
100
|
+
if (!condition)
|
|
101
|
+
errors.push({ path: subPath, message });
|
|
102
|
+
};
|
|
103
|
+
ensure(isNonEmptyString(getProp(el, 'id')), `${path}.id`, 'Element id is required.');
|
|
104
|
+
if (kind === ELEMENT_KIND_VIEWPORT) {
|
|
105
|
+
viewportCount++;
|
|
106
|
+
if (viewportCount > maxViewports) {
|
|
107
|
+
errors.push({ path, message: 'Too many viewports.' });
|
|
108
|
+
}
|
|
109
|
+
ensure(isPositiveNumber(getProp(el, 'widthMm')), `${path}.widthMm`, 'widthMm must be > 0.');
|
|
110
|
+
ensure(isPositiveNumber(getProp(el, 'heightMm')), `${path}.heightMm`, 'heightMm must be > 0.');
|
|
111
|
+
const xMm = getProp(el, 'xMm');
|
|
112
|
+
const yMm = getProp(el, 'yMm');
|
|
113
|
+
ensure(isPositiveNumber(xMm) || xMm === 0, `${path}.xMm`, 'xMm is required.');
|
|
114
|
+
ensure(isPositiveNumber(yMm) || yMm === 0, `${path}.yMm`, 'yMm is required.');
|
|
115
|
+
const border = getProp(el, 'border');
|
|
116
|
+
if (border) {
|
|
117
|
+
// border.stroke and border.strokeWidthMm are optional in v2
|
|
118
|
+
}
|
|
119
|
+
const clip = getProp(el, 'clip');
|
|
120
|
+
if (clip && isRecord(clip)) {
|
|
121
|
+
const where = getProp(clip, 'where');
|
|
122
|
+
if (!isRecord(where)) {
|
|
123
|
+
errors.push({
|
|
124
|
+
path: `${path}.clip.where`,
|
|
125
|
+
message: 'clip.where is required and must be an object.'
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
const highlight = getProp(el, 'highlight');
|
|
130
|
+
if (highlight && isRecord(highlight)) {
|
|
131
|
+
const where = getProp(highlight, 'where');
|
|
132
|
+
if (!isRecord(where)) {
|
|
133
|
+
errors.push({
|
|
134
|
+
path: `${path}.highlight.where`,
|
|
135
|
+
message: 'highlight.where is required and must be an object.'
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
else if (kind === ELEMENT_KIND_TEXT) {
|
|
141
|
+
const xMm = getProp(el, 'xMm');
|
|
142
|
+
const yMm = getProp(el, 'yMm');
|
|
143
|
+
ensure(isPositiveNumber(xMm) || xMm === 0, `${path}.xMm`, 'xMm is required.');
|
|
144
|
+
ensure(isPositiveNumber(yMm) || yMm === 0, `${path}.yMm`, 'yMm is required.');
|
|
145
|
+
const textStyle = getProp(el, 'textStyle');
|
|
146
|
+
if (textStyle !== undefined) {
|
|
147
|
+
if (typeof textStyle === 'string' && styleNames.size > 0 && !styleNames.has(textStyle)) {
|
|
148
|
+
errors.push({
|
|
149
|
+
path: `${path}.textStyle`,
|
|
150
|
+
message: `Style '${textStyle}' is not defined in styles.`
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
ensure(isNonEmptyString(getProp(el, 'text')), `${path}.text`, 'text is required.');
|
|
155
|
+
}
|
|
156
|
+
else if (kind === ELEMENT_KIND_IMAGE) {
|
|
157
|
+
ensure(isPositiveNumber(getProp(el, 'widthMm')), `${path}.widthMm`, 'widthMm must be > 0.');
|
|
158
|
+
ensure(isPositiveNumber(getProp(el, 'heightMm')), `${path}.heightMm`, 'heightMm must be > 0.');
|
|
159
|
+
ensure(isNonEmptyString(getProp(el, 'assetId')), `${path}.assetId`, 'assetId is required.');
|
|
160
|
+
}
|
|
161
|
+
else if (kind === ELEMENT_KIND_LINE) {
|
|
162
|
+
// stroke and strokeWidthMm optional in v2
|
|
163
|
+
}
|
|
164
|
+
else if (kind === ELEMENT_KIND_RECT) {
|
|
165
|
+
ensure(isPositiveNumber(getProp(el, 'widthMm')), `${path}.widthMm`, 'widthMm must be > 0.');
|
|
166
|
+
ensure(isPositiveNumber(getProp(el, 'heightMm')), `${path}.heightMm`, 'heightMm must be > 0.');
|
|
167
|
+
}
|
|
168
|
+
else if (kind === ELEMENT_KIND_SCALE_BAR) {
|
|
169
|
+
ensure(isPositiveNumber(getProp(el, 'maxLengthMm')), `${path}.maxLengthMm`, 'maxLengthMm must be > 0.');
|
|
170
|
+
const textStyle = getProp(el, 'textStyle');
|
|
171
|
+
if (textStyle !== undefined) {
|
|
172
|
+
if (typeof textStyle === 'string' && styleNames.size > 0 && !styleNames.has(textStyle)) {
|
|
173
|
+
errors.push({
|
|
174
|
+
path: `${path}.textStyle`,
|
|
175
|
+
message: `Style '${textStyle}' is not defined in styles.`
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
else if (kind === ELEMENT_KIND_QR) {
|
|
181
|
+
ensure(isPositiveNumber(getProp(el, 'sizeMm')), `${path}.sizeMm`, 'sizeMm must be > 0.');
|
|
182
|
+
const xMm = getProp(el, 'xMm');
|
|
183
|
+
const yMm = getProp(el, 'yMm');
|
|
184
|
+
ensure(isPositiveNumber(xMm) || xMm === 0, `${path}.xMm`, 'xMm is required.');
|
|
185
|
+
ensure(isPositiveNumber(yMm) || yMm === 0, `${path}.yMm`, 'yMm is required.');
|
|
186
|
+
}
|
|
187
|
+
else if (kind === ELEMENT_KIND_LABELS) {
|
|
188
|
+
ensure(isNonEmptyString(getProp(el, 'viewport')), `${path}.viewport`, 'viewport is required.');
|
|
189
|
+
ensure(isNonEmptyString(getProp(el, 'text')), `${path}.text`, 'text is required.');
|
|
190
|
+
const textStyle = getProp(el, 'textStyle');
|
|
191
|
+
if (textStyle !== undefined) {
|
|
192
|
+
if (typeof textStyle === 'string' && styleNames.size > 0 && !styleNames.has(textStyle)) {
|
|
193
|
+
errors.push({
|
|
194
|
+
path: `${path}.textStyle`,
|
|
195
|
+
message: `Style '${textStyle}' is not defined in styles.`
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
else if (kind === ELEMENT_KIND_LEGEND) {
|
|
201
|
+
ensure(isNonEmptyString(getProp(el, 'viewport')), `${path}.viewport`, 'viewport is required.');
|
|
202
|
+
const columns = getProp(el, 'columns');
|
|
203
|
+
if (!Array.isArray(columns) || !columns.length) {
|
|
204
|
+
errors.push({ path: `${path}.columns`, message: 'columns is required and must be a non-empty array.' });
|
|
205
|
+
}
|
|
206
|
+
else {
|
|
207
|
+
columns.forEach((col, idx) => {
|
|
208
|
+
if (!isRecord(col)) {
|
|
209
|
+
errors.push({ path: `${path}.columns[${idx}]`, message: 'Column must be an object.' });
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
ensure(isNonEmptyString(getProp(col, 'id')), `${path}.columns[${idx}].id`, 'Column id is required.');
|
|
213
|
+
ensure(isNonEmptyString(getProp(col, 'label')), `${path}.columns[${idx}].label`, 'Column label is required.');
|
|
214
|
+
ensure(isNonEmptyString(getProp(col, 'property')), `${path}.columns[${idx}].property`, 'Column property is required.');
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
const textStyle = getProp(el, 'textStyle');
|
|
218
|
+
if (textStyle !== undefined) {
|
|
219
|
+
if (typeof textStyle === 'string' && styleNames.size > 0 && !styleNames.has(textStyle)) {
|
|
220
|
+
errors.push({
|
|
221
|
+
path: `${path}.textStyle`,
|
|
222
|
+
message: `Style '${textStyle}' is not defined in styles.`
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
const clipToViewport = getProp(el, 'clipToViewport');
|
|
227
|
+
if (clipToViewport !== undefined && typeof clipToViewport !== 'boolean') {
|
|
228
|
+
errors.push({
|
|
229
|
+
path: `${path}.clipToViewport`,
|
|
230
|
+
message: 'clipToViewport must be a boolean when provided.'
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
else if (kind === ELEMENT_KIND_GROUP) {
|
|
235
|
+
const opacity = getProp(el, 'opacity');
|
|
236
|
+
if (opacity !== undefined) {
|
|
237
|
+
ensure(typeof opacity === 'number' && opacity >= 0 && opacity <= 1, `${path}.opacity`, 'opacity must be between 0 and 1.');
|
|
238
|
+
}
|
|
239
|
+
const transform = getProp(el, 'transform');
|
|
240
|
+
if (transform) {
|
|
241
|
+
const scaleX = getProp(transform, 'scaleX');
|
|
242
|
+
const scaleY = getProp(transform, 'scaleY');
|
|
243
|
+
ensure(scaleX === undefined || typeof scaleX === 'number', `${path}.transform.scaleX`, 'scaleX must be a number');
|
|
244
|
+
ensure(scaleY === undefined || typeof scaleY === 'number', `${path}.transform.scaleY`, 'scaleY must be a number');
|
|
245
|
+
}
|
|
246
|
+
const clip = getProp(el, 'clip');
|
|
247
|
+
if (clip) {
|
|
248
|
+
ensure(getProp(clip, 'type') === 'rect', `${path}.clip.type`, "clip.type must be 'rect'.");
|
|
249
|
+
ensure(isPositiveNumber(getProp(clip, 'widthMm')), `${path}.clip.widthMm`, 'clip.widthMm must be > 0.');
|
|
250
|
+
ensure(isPositiveNumber(getProp(clip, 'heightMm')), `${path}.clip.heightMm`, 'clip.heightMm must be > 0.');
|
|
251
|
+
const clipXMm = getProp(clip, 'xMm');
|
|
252
|
+
const clipYMm = getProp(clip, 'yMm');
|
|
253
|
+
ensure(isPositiveNumber(clipXMm) || clipXMm === 0, `${path}.clip.xMm`, 'clip.xMm is required.');
|
|
254
|
+
ensure(isPositiveNumber(clipYMm) || clipYMm === 0, `${path}.clip.yMm`, 'clip.yMm is required.');
|
|
255
|
+
}
|
|
256
|
+
const children = getProp(el, 'children');
|
|
257
|
+
if (Array.isArray(children)) {
|
|
258
|
+
children.forEach((child, childIdx) => validateElement(child, `${path}.children[${childIdx}]`));
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
else {
|
|
262
|
+
errors.push({ path, message: `Unknown element kind '${kind}'.` });
|
|
263
|
+
}
|
|
264
|
+
};
|
|
265
|
+
const elements = getProp(t, 'elements');
|
|
266
|
+
if (Array.isArray(elements)) {
|
|
267
|
+
elements.forEach((el, index) => validateElement(el, `elements[${index}]`));
|
|
268
|
+
}
|
|
269
|
+
else if (elements !== undefined) {
|
|
270
|
+
errors.push({ path: 'elements', message: 'Elements must be an array.' });
|
|
271
|
+
}
|
|
272
|
+
// Validate template variables (if present)
|
|
273
|
+
const variables = getProp(t, 'variables');
|
|
274
|
+
if (variables !== undefined) {
|
|
275
|
+
if (!isRecord(variables)) {
|
|
276
|
+
errors.push({ path: 'variables', message: 'Variables must be an object.' });
|
|
277
|
+
}
|
|
278
|
+
else {
|
|
279
|
+
// Validate each variable definition
|
|
280
|
+
for (const [varName, varDef] of Object.entries(variables)) {
|
|
281
|
+
const varPath = `variables.${varName}`;
|
|
282
|
+
if (!isRecord(varDef)) {
|
|
283
|
+
errors.push({ path: varPath, message: 'Variable definition must be an object.' });
|
|
284
|
+
continue;
|
|
285
|
+
}
|
|
286
|
+
// Validate type
|
|
287
|
+
const varType = getProp(varDef, 'type');
|
|
288
|
+
if (!['string', 'number', 'boolean', 'array'].includes(varType)) {
|
|
289
|
+
errors.push({
|
|
290
|
+
path: `${varPath}.type`,
|
|
291
|
+
message: `Type must be 'string', 'number', 'boolean', or 'array' (got '${varType}').`
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
// Enforce default value (CRITICAL for fail-safe operation)
|
|
295
|
+
const defaultValue = getProp(varDef, 'default');
|
|
296
|
+
if (defaultValue === undefined || defaultValue === null) {
|
|
297
|
+
errors.push({
|
|
298
|
+
path: `${varPath}.default`,
|
|
299
|
+
message: 'Variable must have a default value (required for fail-safe operation).'
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
else {
|
|
303
|
+
// Validate default value matches declared type
|
|
304
|
+
const actualType = Array.isArray(defaultValue) ? 'array' : typeof defaultValue;
|
|
305
|
+
if (varType === 'number' && actualType !== 'number') {
|
|
306
|
+
errors.push({
|
|
307
|
+
path: `${varPath}.default`,
|
|
308
|
+
message: `Default value must be a number (got ${actualType}).`
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
else if (varType === 'string' && actualType !== 'string') {
|
|
312
|
+
errors.push({
|
|
313
|
+
path: `${varPath}.default`,
|
|
314
|
+
message: `Default value must be a string (got ${actualType}).`
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
else if (varType === 'boolean' && actualType !== 'boolean') {
|
|
318
|
+
errors.push({
|
|
319
|
+
path: `${varPath}.default`,
|
|
320
|
+
message: `Default value must be a boolean (got ${actualType}).`
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
else if (varType === 'array' && actualType !== 'array') {
|
|
324
|
+
errors.push({
|
|
325
|
+
path: `${varPath}.default`,
|
|
326
|
+
message: `Default value must be an array (got ${actualType}).`
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
// Validate numeric constraints (if present)
|
|
331
|
+
if (varType === 'number') {
|
|
332
|
+
const min = getProp(varDef, 'min');
|
|
333
|
+
const max = getProp(varDef, 'max');
|
|
334
|
+
if (min !== undefined && typeof min !== 'number') {
|
|
335
|
+
errors.push({ path: `${varPath}.min`, message: 'min must be a number.' });
|
|
336
|
+
}
|
|
337
|
+
if (max !== undefined && typeof max !== 'number') {
|
|
338
|
+
errors.push({ path: `${varPath}.max`, message: 'max must be a number.' });
|
|
339
|
+
}
|
|
340
|
+
if (typeof min === 'number' && typeof max === 'number' && min > max) {
|
|
341
|
+
errors.push({ path: `${varPath}`, message: 'min cannot be greater than max.' });
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
if (errors.length) {
|
|
348
|
+
return { ok: false, errors };
|
|
349
|
+
}
|
|
350
|
+
return { ok: true, template };
|
|
351
|
+
}
|
|
352
|
+
//# sourceMappingURL=validation.js.map
|