@twinfinity/printing 6.1.0-beta → 6.1.2-ci.30738-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/dist/BuildInfo.js +3 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/layout/analyzeTemplate.d.ts +4 -4
- package/dist/layout/analyzeTemplate.d.ts.map +1 -1
- package/dist/layout/analyzeTemplate.js +18 -16
- package/dist/layout/analyzeTemplate.js.map +1 -1
- package/dist/layout/classClosure.d.ts +41 -0
- package/dist/layout/classClosure.d.ts.map +1 -0
- package/dist/layout/classClosure.js +143 -0
- package/dist/layout/classClosure.js.map +1 -0
- package/dist/layout/clipUtils.d.ts +11 -0
- package/dist/layout/clipUtils.d.ts.map +1 -1
- package/dist/layout/clipUtils.js +67 -6
- package/dist/layout/clipUtils.js.map +1 -1
- package/dist/layout/filters.d.ts +14 -8
- package/dist/layout/filters.d.ts.map +1 -1
- package/dist/layout/filters.js +28 -3
- package/dist/layout/filters.js.map +1 -1
- package/dist/layout/index.d.ts +24 -57
- package/dist/layout/index.d.ts.map +1 -1
- package/dist/layout/index.js +20 -337
- package/dist/layout/index.js.map +1 -1
- package/dist/layout/itemBuilders.d.ts +11 -0
- package/dist/layout/itemBuilders.d.ts.map +1 -1
- package/dist/layout/itemBuilders.js +17 -3
- package/dist/layout/itemBuilders.js.map +1 -1
- package/dist/layout/labelsRender.d.ts.map +1 -1
- package/dist/layout/labelsRender.js +15 -27
- package/dist/layout/labelsRender.js.map +1 -1
- package/dist/layout/legendRender.d.ts +18 -6
- package/dist/layout/legendRender.d.ts.map +1 -1
- package/dist/layout/legendRender.js +49 -79
- package/dist/layout/legendRender.js.map +1 -1
- package/dist/layout/metadata.d.ts.map +1 -1
- package/dist/layout/metadata.js +26 -5
- package/dist/layout/metadata.js.map +1 -1
- package/dist/layout/model.d.ts +4 -3
- package/dist/layout/model.d.ts.map +1 -1
- package/dist/layout/model.js +17 -57
- package/dist/layout/model.js.map +1 -1
- package/dist/layout/options.d.ts +1 -2
- package/dist/layout/options.d.ts.map +1 -1
- package/dist/layout/options.js.map +1 -1
- package/dist/layout/preflight.d.ts +32 -0
- package/dist/layout/preflight.d.ts.map +1 -0
- package/dist/layout/preflight.js +69 -0
- package/dist/layout/preflight.js.map +1 -0
- package/dist/layout/qrRender.d.ts.map +1 -1
- package/dist/layout/qrRender.js +11 -10
- package/dist/layout/qrRender.js.map +1 -1
- package/dist/layout/renderDrawing.d.ts +28 -17
- package/dist/layout/renderDrawing.d.ts.map +1 -1
- package/dist/layout/renderDrawing.js +107 -88
- package/dist/layout/renderDrawing.js.map +1 -1
- package/dist/layout/renderLayout.d.ts +25 -0
- package/dist/layout/renderLayout.d.ts.map +1 -0
- package/dist/layout/renderLayout.js +315 -0
- package/dist/layout/renderLayout.js.map +1 -0
- package/dist/layout/renderTemplateSheet.d.ts +99 -0
- package/dist/layout/renderTemplateSheet.d.ts.map +1 -0
- package/dist/layout/renderTemplateSheet.js +296 -0
- package/dist/layout/renderTemplateSheet.js.map +1 -0
- package/dist/layout/renderUtils.d.ts +19 -0
- package/dist/layout/renderUtils.d.ts.map +1 -1
- package/dist/layout/renderUtils.js +47 -4
- package/dist/layout/renderUtils.js.map +1 -1
- package/dist/layout/sectionDefs.d.ts +65 -0
- package/dist/layout/sectionDefs.d.ts.map +1 -0
- package/dist/layout/sectionDefs.js +88 -0
- package/dist/layout/sectionDefs.js.map +1 -0
- package/dist/layout/slabModelView.d.ts +34 -0
- package/dist/layout/slabModelView.d.ts.map +1 -0
- package/dist/layout/slabModelView.js +175 -0
- package/dist/layout/slabModelView.js.map +1 -0
- package/dist/layout/templateVariables.d.ts +1 -1
- package/dist/layout/templateVariables.d.ts.map +1 -1
- package/dist/layout/templateVariables.js +21 -9
- package/dist/layout/templateVariables.js.map +1 -1
- package/dist/layout/types.d.ts +164 -83
- package/dist/layout/types.d.ts.map +1 -1
- package/dist/layout/types.js.map +1 -1
- package/dist/layout/validation.d.ts.map +1 -1
- package/dist/layout/validation.js +78 -33
- package/dist/layout/validation.js.map +1 -1
- package/dist/layout/viewportPrep.d.ts +8 -6
- package/dist/layout/viewportPrep.d.ts.map +1 -1
- package/dist/layout/viewportPrep.js +35 -23
- package/dist/layout/viewportPrep.js.map +1 -1
- package/dist/layout/viewportRender.d.ts +9 -7
- package/dist/layout/viewportRender.d.ts.map +1 -1
- package/dist/layout/viewportRender.js +93 -126
- package/dist/layout/viewportRender.js.map +1 -1
- package/dist/layout/viewportUtils.d.ts +20 -0
- package/dist/layout/viewportUtils.d.ts.map +1 -1
- package/dist/layout/viewportUtils.js +107 -4
- package/dist/layout/viewportUtils.js.map +1 -1
- package/dist/printToPdf.d.ts +7 -1
- package/dist/printToPdf.d.ts.map +1 -1
- package/dist/printToPdf.js +81 -14
- package/dist/printToPdf.js.map +1 -1
- package/dist/printToSvg.d.ts.map +1 -1
- package/dist/printToSvg.js +7 -3
- package/dist/printToSvg.js.map +1 -1
- package/dist/schemaUtils.d.ts +9 -0
- package/dist/schemaUtils.d.ts.map +1 -0
- package/dist/schemaUtils.js +14 -0
- package/dist/schemaUtils.js.map +1 -0
- package/dist/templates/default-template.json +30 -8
- package/dist/types.d.ts +2 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +10 -1
- package/dist/types.js.map +1 -1
- package/package.json +8 -3
- package/src/index.ts +4 -0
- package/src/layout/analyzeTemplate.ts +21 -19
- package/src/layout/classClosure.ts +142 -0
- package/src/layout/clipUtils.ts +65 -6
- package/src/layout/filters.ts +31 -3
- package/src/layout/index.ts +61 -571
- package/src/layout/itemBuilders.ts +20 -5
- package/src/layout/labelsRender.ts +23 -40
- package/src/layout/legendRender.ts +64 -84
- package/src/layout/metadata.ts +26 -5
- package/src/layout/model.ts +21 -66
- package/src/layout/options.ts +1 -2
- package/src/layout/preflight.ts +96 -0
- package/src/layout/qrRender.ts +11 -10
- package/src/layout/renderDrawing.ts +132 -110
- package/src/layout/renderLayout.ts +483 -0
- package/src/layout/renderTemplateSheet.ts +435 -0
- package/src/layout/renderUtils.ts +53 -4
- package/src/layout/sectionDefs.ts +131 -0
- package/src/layout/slabModelView.ts +196 -0
- package/src/layout/templateVariables.ts +25 -9
- package/src/layout/types.ts +160 -70
- package/src/layout/validation.ts +98 -32
- package/src/layout/viewportPrep.ts +47 -29
- package/src/layout/viewportRender.ts +114 -141
- package/src/layout/viewportUtils.ts +118 -5
- package/src/printToPdf.ts +84 -15
- package/src/printToSvg.ts +7 -3
- package/src/schemaUtils.ts +13 -0
- package/src/templates/default-template.json +30 -8
- package/src/types.ts +12 -2
- package/templates/default-a0-landscape.json +171 -66
- package/templates/default-a0-portrait.json +159 -60
- package/templates/default-a1-landscape.json +135 -48
- package/templates/default-a1-portrait.json +123 -42
- package/templates/default-a3-landscape.json +87 -24
- package/templates/default-a3-portrait.json +99 -30
- package/templates/default-a4-landscape.json +75 -18
- package/templates/default-a4-portrait.json +75 -18
- package/templates/llm-authoring-guide.md +247 -0
- package/templates/template-schema.json +295 -120
package/dist/layout/model.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.js","sourceRoot":"/","sources":["layout/model.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAEzD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAEjD,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACjC,QAAmC,EACnC,SAAqC,EACrC,SAAgD,EAChD,iBAA0B,EAC1B,UAAuB,EACJ,EAAE;IACrB,IAAI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CAAC,GAAG,EAAE,CAAC,gBAAgB,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IACpE,CAAC,CAAC,CAAC;IAEH,wBAAwB;IACxB,iBAAiB,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,GAAG,EAAE,EAAE;QAC3C,MAAM,UAAU,GAAG,gBAAgB,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAClD,IAAI,UAAU,GAAG,WAAW,EAAE,CAAC;YAC3B,QAAQ,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,WAAW,GAAG,UAAU,gBAAgB,EAAE,CAAC,CAAC;QAC/E,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,IACI,CAAC,YAAY;QACb,aAAa,CAAC,MAAM,KAAK,KAAK,CAAC,QAAQ,CAAC,MAAM;QAC9C,cAAc,CAAC,MAAM,KAAK,CAAC,KAAK,CAAC,SAAS,EAAE,MAAM,IAAI,CAAC,CAAC,EAC1D,CAAC;QACC,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,MAAM,OAAO,GAAG,qBAAqB,CACjC,aAAa,EACb,cAAc,EACd,KAAK,CAAC,SAAS,EACf,KAAK,CAAC,iBAAiB,EACvB,KAAK,CAAC,UAAU,CACnB,CAAC;IACF,OAAO,OAAO,IAAI,KAAK,CAAC;AAC5B,CAAC,CAAC","sourcesContent":["import type { SectionPath, SectionLabel } from '@twinfinity/geometry';\nimport type { SvgModelView, ViewportElement, LabelStyle, ResolvedIncludeFilter } from './types';\nimport type { ModelMetadata } from './metadata';\nimport { resolveIncludeClasses, resolveMeta } from './metadata';\nimport { normalizeClass, matchesWhere } from './filters';\nimport { escapeAttr, escapeText } from './renderUtils';\nimport { BUILTIN_LABEL_DEFAULTS } from './renderDrawing';\n\nimport { getProp, isRecord } from './typeGuards';\n\nexport const buildModelViewFromRaw = (\n rawPaths: SectionPath[] | undefined,\n rawLabels: SectionLabel[] | undefined,\n transform: SvgModelView['transform'] | undefined,\n geometryTransform?: string,\n labelStyle?: LabelStyle\n): SvgModelView | null => {\n if (!rawPaths || !transform || !geometryTransform) {\n return null;\n }\n const labelFill = labelStyle?.fill ?? BUILTIN_LABEL_DEFAULTS.fill;\n const labelFontFamily = labelStyle?.fontFamily ?? BUILTIN_LABEL_DEFAULTS.fontFamily;\n const labelFontWeight = labelStyle?.fontWeight ?? BUILTIN_LABEL_DEFAULTS.fontWeight;\n const escapedFontFamily = escapeAttr(labelFontFamily);\n\n const parts: string[] = [];\n parts.push(`<g transform=\"${escapeAttr(geometryTransform)}\">`);\n rawPaths.forEach((path) => {\n parts.push(\n `<path d=\"${escapeAttr(path.d)}\"` +\n (path.fill ? ` fill=\"${escapeAttr(path.fill)}\"` : ' fill=\"none\"') +\n (path.fillOpacity !== undefined ? ` fill-opacity=\"${path.fillOpacity}\"` : '') +\n (path.stroke ? ` stroke=\"${escapeAttr(path.stroke)}\"` : '') +\n (path.strokeWidth ? ` stroke-width=\"${path.strokeWidth}\"` : '') +\n (path.strokeOpacity !== undefined ? ` stroke-opacity=\"${path.strokeOpacity}\"` : '') +\n (path.fillRule ? ` fill-rule=\"${escapeAttr(path.fillRule)}\"` : '') +\n ` stroke-linejoin=\"round\" stroke-linecap=\"round\"` +\n ` />`\n );\n });\n parts.push(`</g>`);\n if (rawLabels && rawLabels.length) {\n parts.push(`<g pointer-events=\"none\">`);\n rawLabels.forEach((label) => {\n const viewX = label.x - transform.viewMinX;\n const viewY = transform.viewMaxZ - label.z;\n if (!Number.isFinite(viewX) || !Number.isFinite(viewY)) {\n return;\n }\n parts.push(\n `<text x=\"${viewX}\" y=\"${viewY}\" font-size=\"${label.fontSize}\" text-anchor=\"middle\" dominant-baseline=\"middle\" fill=\"${escapeAttr(labelFill)}\" font-family=\"${escapedFontFamily}\" font-weight=\"${labelFontWeight}\">${escapeText(label.text)}</text>`\n );\n });\n parts.push(`</g>`);\n }\n const svg = `<g>${parts.join('')}</g>`;\n return {\n groupSvg: svg,\n widthModel: transform.viewWidth,\n heightModel: transform.viewHeight,\n transform,\n geometryTransform,\n rawPaths,\n rawLabels,\n labelStyle\n };\n};\n\n/**\n * Check whether a path's resolved class matches any of the filter classes.\n * Used to determine which SVG paths are subject to GID-based include/exclude.\n */\nconst matchesFilterClass = (\n cls: string | null,\n clsId: unknown,\n clsFromMap: string | null,\n filterClasses: Set<string>\n): boolean => {\n if (!filterClasses.size) return false;\n if (cls && filterClasses.has(cls)) return true;\n if (clsFromMap && filterClasses.has(clsFromMap)) return true;\n if (clsId && typeof clsId === 'string') {\n const normalized = normalizeClass(clsId);\n if (normalized && filterClasses.has(normalized)) return true;\n }\n return false;\n};\n\n/**\n * Check if an item matches any of the include filters.\n *\n * @param includeFilters - Array of filters (strings or class+where objects)\n * @param cls - Normalized IFC class name\n * @param clsId - Predefined IFC class ID\n * @param meta - Item metadata (for property matching)\n * @returns true if the item matches any filter, false otherwise\n */\nconst matchesIncludeFilter = (\n includeFilters: ResolvedIncludeFilter[],\n cls: string | null,\n clsId: unknown,\n meta: unknown\n): boolean => {\n for (const filter of includeFilters) {\n // String filter: class name only\n if (typeof filter === 'string') {\n const normalizedFilter = normalizeClass(filter);\n if (cls && normalizedFilter === cls) return true;\n if (clsId && typeof clsId === 'string') {\n const normalizedId = normalizeClass(clsId);\n if (normalizedId === normalizedFilter) return true;\n }\n continue;\n }\n\n // Object filter: class + where\n if (isRecord(filter)) {\n const filterClass = filter.class;\n const filterWhere = filter.where;\n\n // Check class match (if specified)\n let classMatches = true;\n if (filterClass !== undefined) {\n const classes = Array.isArray(filterClass) ? filterClass : [filterClass];\n classMatches = false;\n for (const c of classes) {\n const normalizedC = normalizeClass(c);\n if (normalizedC && cls === normalizedC) {\n classMatches = true;\n break;\n }\n if (clsId && typeof clsId === 'string') {\n const normalizedId = normalizeClass(clsId);\n if (normalizedId === normalizedC) {\n classMatches = true;\n break;\n }\n }\n }\n }\n\n // Check where condition (if specified)\n let whereMatches = true;\n if (filterWhere && Object.keys(filterWhere).length > 0) {\n whereMatches = matchesWhere(meta, filterWhere);\n }\n\n if (classMatches && whereMatches) return true;\n }\n }\n\n return false;\n};\n\nexport const filterModelForViewport = (\n model: SvgModelView,\n vp: ViewportElement,\n metadataById?: ModelMetadata,\n includePresets?: Record<string, string[]>,\n allowedGids?: Set<string> | null,\n highlight?: {\n gids: Set<string> | null;\n styles?: {\n stroke?: string;\n strokeWidthMm?: number;\n strokeOpacity?: number;\n fill?: string;\n fillOpacity?: number;\n };\n },\n filterClasses?: Set<string> | null\n): SvgModelView => {\n const resolvedIncludeClasses = resolveIncludeClasses(vp.includeClasses as unknown, includePresets ?? {});\n const includeFilters = resolvedIncludeClasses ?? null;\n // Classes subject to GID-based filtering (highlight/clip include/exclude).\n // Derived from template highlight.class and clip.class by the caller.\n const effectiveFilterClasses = filterClasses ?? new Set<string>();\n let styleMutated = false;\n if (!model.rawPaths || !model.geometryTransform || !model.transform) {\n return model;\n }\n const filteredPaths: SectionPath[] = [];\n model.rawPaths.forEach((p: SectionPath) => {\n const rawMeta = getProp(p, 'meta');\n const meta = resolveMeta(rawMeta, metadataById);\n const metaFromMap = (() => {\n const pid =\n getProp(meta, 'productId') ??\n getProp(meta, 'gid') ??\n getProp(meta, 'id') ??\n getProp(rawMeta, 'gid') ??\n getProp(rawMeta, 'id');\n return pid && metadataById ? metadataById[String(pid)] : null;\n })();\n const productIdForMeta =\n getProp(meta, 'productId') ??\n getProp(meta, 'gid') ??\n getProp(meta, 'id') ??\n getProp(rawMeta, 'gid') ??\n getProp(rawMeta, 'id') ??\n metaFromMap?.productId ??\n metaFromMap?.gid ??\n null;\n const pid = productIdForMeta ? String(productIdForMeta) : null;\n const cls = normalizeClass(getProp(meta, 'ifcClass') ?? getProp(rawMeta, 'ifcClass') ?? metaFromMap?.ifcClass);\n const clsId = getProp(meta, 'ifcClassId') ?? getProp(rawMeta, 'ifcClassId') ?? metaFromMap?.ifcClassId ?? null;\n const clsFromMap = normalizeClass(metaFromMap?.ifcClass);\n const isFilterable = matchesFilterClass(cls, clsId, clsFromMap, effectiveFilterClasses);\n const shouldHighlight = !!highlight?.gids && highlight.gids.size > 0 && !!pid && highlight.gids.has(pid);\n if (includeFilters && includeFilters.length > 0) {\n if (isFilterable) {\n // Highlight/clip class: only check includeClasses if no GID filtering will be applied\n const hasGidFiltering =\n (highlight?.gids && highlight.gids.size > 0) || (allowedGids && allowedGids.size > 0);\n if (!hasGidFiltering) {\n // No GID filtering active, so apply includeClasses filter\n const matches = matchesIncludeFilter(includeFilters, cls, clsId, meta);\n if (!matches) {\n return;\n }\n }\n } else {\n // Not a highlight/clip class: always apply includeClasses filter\n const matches = matchesIncludeFilter(includeFilters, cls, clsId, meta);\n if (!matches) {\n return;\n }\n }\n }\n if (isFilterable) {\n if (highlight?.gids && highlight.gids.size > 0) {\n if (!pid || !highlight.gids.has(pid)) {\n return;\n }\n }\n // Clip filtering logic: null means no filtering, empty Set means filtering active but no matches\n const allowed =\n !allowedGids || (allowedGids.size > 0 && !!(pid && allowedGids.has(pid))) || shouldHighlight;\n if (!allowed) return;\n }\n // CRITICAL: Exclude space fills from model - buildFillSvg will handle them with matchClipFilter support\n // Only keep space segments (outlines) in the model\n // EXCEPT: Keep highlighted space fills so they can be styled with highlight colors\n const isFill = getProp(meta, 'isFill') ?? getProp(rawMeta, 'isFill');\n if (isFilterable && isFill && !shouldHighlight) {\n return;\n }\n // Apply highlight styling when requested\n if (shouldHighlight) {\n const styledPath: SectionPath = { ...p };\n if (highlight?.styles?.stroke !== undefined) {\n styledPath.stroke = highlight.styles.stroke;\n }\n if (highlight?.styles?.strokeWidthMm !== undefined) {\n styledPath.strokeWidth = highlight.styles.strokeWidthMm;\n }\n if (highlight?.styles?.strokeOpacity !== undefined) {\n styledPath.strokeOpacity = highlight.styles.strokeOpacity;\n }\n if (highlight?.styles?.fill !== undefined) {\n styledPath.fill = highlight.styles.fill;\n }\n if (highlight?.styles?.fillOpacity !== undefined) {\n styledPath.fillOpacity = highlight.styles.fillOpacity;\n }\n styleMutated = true;\n filteredPaths.push(styledPath);\n } else {\n filteredPaths.push(p);\n }\n });\n\n const filteredLabels: SectionLabel[] = [];\n (model.rawLabels ?? []).forEach((l: SectionLabel) => {\n const rawMeta = getProp(l, 'meta');\n const meta = resolveMeta(rawMeta, metadataById);\n const cls = normalizeClass(getProp(meta, 'ifcClass'));\n const clsId = getProp(meta, 'ifcClassId') ?? getProp(rawMeta, 'ifcClassId') ?? null;\n const productIdForMeta =\n getProp(meta, 'productId') ??\n getProp(meta, 'gid') ??\n getProp(meta, 'id') ??\n getProp(rawMeta, 'gid') ??\n getProp(rawMeta, 'id') ??\n null;\n if (includeFilters && includeFilters.length > 0) {\n if (!matchesIncludeFilter(includeFilters, cls, clsId, meta)) {\n return;\n }\n }\n if (matchesFilterClass(cls, clsId, null, effectiveFilterClasses)) {\n const pid = productIdForMeta ? String(productIdForMeta) : null;\n if (highlight?.gids && highlight.gids.size > 0) {\n if (!pid || !highlight.gids.has(pid)) {\n return;\n }\n }\n if (allowedGids && allowedGids.size > 0) {\n if (!pid || !allowedGids.has(pid)) {\n return;\n }\n }\n }\n filteredLabels.push(l);\n });\n\n // Count paths by IFC class before and after filtering\n const classCountsBefore = new Map<string, number>();\n const classCountsAfter = new Map<string, number>();\n const excluded: Array<{ cls: string | null; clsId: unknown }> = [];\n\n model.rawPaths.forEach((p: SectionPath) => {\n const rawMeta = getProp(p, 'meta');\n const meta = resolveMeta(rawMeta, metadataById);\n const metaFromMap = (() => {\n const pid =\n getProp(meta, 'productId') ??\n getProp(meta, 'gid') ??\n getProp(meta, 'id') ??\n getProp(rawMeta, 'gid') ??\n getProp(rawMeta, 'id');\n return pid && metadataById ? metadataById[String(pid)] : null;\n })();\n const cls = normalizeClass(getProp(meta, 'ifcClass') ?? getProp(rawMeta, 'ifcClass') ?? metaFromMap?.ifcClass);\n const clsId = getProp(meta, 'ifcClassId') ?? getProp(rawMeta, 'ifcClassId') ?? metaFromMap?.ifcClassId ?? null;\n const key = cls ?? String(clsId) ?? 'unknown';\n classCountsBefore.set(key, (classCountsBefore.get(key) ?? 0) + 1);\n });\n\n filteredPaths.forEach((p: SectionPath) => {\n const rawMeta = getProp(p, 'meta');\n const meta = resolveMeta(rawMeta, metadataById);\n const metaFromMap = (() => {\n const pid =\n getProp(meta, 'productId') ??\n getProp(meta, 'gid') ??\n getProp(meta, 'id') ??\n getProp(rawMeta, 'gid') ??\n getProp(rawMeta, 'id');\n return pid && metadataById ? metadataById[String(pid)] : null;\n })();\n const cls = normalizeClass(getProp(meta, 'ifcClass') ?? getProp(rawMeta, 'ifcClass') ?? metaFromMap?.ifcClass);\n const clsId = getProp(meta, 'ifcClassId') ?? getProp(rawMeta, 'ifcClassId') ?? metaFromMap?.ifcClassId ?? null;\n const key = cls ?? String(clsId) ?? 'unknown';\n classCountsAfter.set(key, (classCountsAfter.get(key) ?? 0) + 1);\n });\n\n // Find excluded classes\n classCountsBefore.forEach((countBefore, cls) => {\n const countAfter = classCountsAfter.get(cls) ?? 0;\n if (countAfter < countBefore) {\n excluded.push({ cls, clsId: `${countBefore - countAfter} paths removed` });\n }\n });\n\n if (\n !styleMutated &&\n filteredPaths.length === model.rawPaths.length &&\n filteredLabels.length === (model.rawLabels?.length ?? 0)\n ) {\n return model;\n }\n\n const rebuilt = buildModelViewFromRaw(\n filteredPaths,\n filteredLabels,\n model.transform,\n model.geometryTransform,\n model.labelStyle\n );\n return rebuilt ?? model;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"model.js","sourceRoot":"/","sources":["layout/model.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,sBAAsB,EAAE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CAAC,EAAE,CAAC;YAC/D,MAAM,GAAG,GAAG,gBAAgB,CAAC,CAAC,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;YAC/D,IAAI,SAAS,EAAE,IAAI,IAAI,SAAS,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;gBAC7C,IAAI,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;oBACnC,OAAO;gBACX,CAAC;YACL,CAAC;YACD,IAAI,WAAW,IAAI,WAAW,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;gBACtC,IAAI,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;oBAChC,OAAO;gBACX,CAAC;YACL,CAAC;QACL,CAAC;QACD,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC3B,CAAC,CAAC,CAAC;IAEH,IACI,CAAC,YAAY;QACb,aAAa,CAAC,MAAM,KAAK,KAAK,CAAC,QAAQ,CAAC,MAAM;QAC9C,cAAc,CAAC,MAAM,KAAK,CAAC,KAAK,CAAC,SAAS,EAAE,MAAM,IAAI,CAAC,CAAC,EAC1D,CAAC;QACC,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,MAAM,OAAO,GAAG,qBAAqB,CACjC,aAAa,EACb,cAAc,EACd,KAAK,CAAC,SAAS,EACf,KAAK,CAAC,iBAAiB,EACvB,KAAK,CAAC,UAAU,CACnB,CAAC;IACF,OAAO,OAAO,IAAI,KAAK,CAAC;AAC5B,CAAC,CAAC","sourcesContent":["import type { SectionPath, SectionLabel } from '@twinfinity/geometry';\nimport type { SvgModelView, ViewportElement, LabelStyle, ResolvedIncludeFilter } from './types';\nimport type { ModelMetadata } from './metadata';\nimport { resolveIncludeClasses, resolveMeta } from './metadata';\nimport { normalizeClass, classEquals, matchesWhere } from './filters';\nimport { escapeAttr, escapeText } from './renderUtils';\nimport { BUILTIN_LABEL_DEFAULTS } from './renderDrawing';\n\nimport { getProp, isRecord } from './typeGuards';\n\nexport const buildModelViewFromRaw = (\n rawPaths: SectionPath[] | undefined,\n rawLabels: SectionLabel[] | undefined,\n transform: SvgModelView['transform'] | undefined,\n geometryTransform?: string,\n labelStyle?: LabelStyle\n): SvgModelView | null => {\n if (!rawPaths || !transform || !geometryTransform) {\n return null;\n }\n const labelFill = labelStyle?.fill ?? BUILTIN_LABEL_DEFAULTS.fill;\n const labelFontFamily = labelStyle?.fontFamily ?? BUILTIN_LABEL_DEFAULTS.fontFamily;\n const labelFontWeight = labelStyle?.fontWeight ?? BUILTIN_LABEL_DEFAULTS.fontWeight;\n const escapedFontFamily = escapeAttr(labelFontFamily);\n\n const parts: string[] = [];\n parts.push(`<g transform=\"${escapeAttr(geometryTransform)}\">`);\n rawPaths.forEach((path) => {\n parts.push(\n `<path d=\"${escapeAttr(path.d)}\"` +\n (path.fill ? ` fill=\"${escapeAttr(path.fill)}\"` : ' fill=\"none\"') +\n (path.fillOpacity !== undefined ? ` fill-opacity=\"${path.fillOpacity}\"` : '') +\n (path.stroke ? ` stroke=\"${escapeAttr(path.stroke)}\"` : '') +\n (path.strokeWidth ? ` stroke-width=\"${path.strokeWidth}\"` : '') +\n (path.strokeOpacity !== undefined ? ` stroke-opacity=\"${path.strokeOpacity}\"` : '') +\n (path.dash ? ` stroke-dasharray=\"${escapeAttr(path.dash)}\"` : '') +\n (path.fillRule ? ` fill-rule=\"${escapeAttr(path.fillRule)}\"` : '') +\n ` stroke-linejoin=\"round\" stroke-linecap=\"round\"` +\n ` />`\n );\n });\n parts.push(`</g>`);\n if (rawLabels && rawLabels.length) {\n parts.push(`<g pointer-events=\"none\">`);\n rawLabels.forEach((label) => {\n const viewX = label.x - transform.viewMinX;\n const viewY = transform.viewMaxZ - label.z;\n if (!Number.isFinite(viewX) || !Number.isFinite(viewY)) {\n return;\n }\n parts.push(\n `<text x=\"${viewX}\" y=\"${viewY}\" font-size=\"${label.fontSize}\" text-anchor=\"middle\" dominant-baseline=\"middle\" fill=\"${escapeAttr(labelFill)}\" font-family=\"${escapedFontFamily}\" font-weight=\"${labelFontWeight}\">${escapeText(label.text)}</text>`\n );\n });\n parts.push(`</g>`);\n }\n const svg = `<g>${parts.join('')}</g>`;\n return {\n groupSvg: svg,\n widthModel: transform.viewWidth,\n heightModel: transform.viewHeight,\n transform,\n geometryTransform,\n rawPaths,\n rawLabels,\n labelStyle\n };\n};\n\n/**\n * Check whether a path's resolved class matches any of the filter classes.\n * Used to determine which SVG paths are subject to GID-based include/exclude.\n */\nconst matchesFilterClass = (\n cls: string | null,\n clsId: unknown,\n clsFromMap: string | null,\n filterClasses: Set<string>\n): boolean => {\n if (!filterClasses.size) return false;\n if (cls && filterClasses.has(cls)) return true;\n if (clsFromMap && filterClasses.has(clsFromMap)) return true;\n if (clsId && typeof clsId === 'string') {\n const normalized = normalizeClass(clsId);\n if (normalized && filterClasses.has(normalized)) return true;\n }\n return false;\n};\n\n/**\n * Check if an item matches any of the include filters.\n *\n * @param includeFilters - Array of filters (strings or class+where objects)\n * @param cls - Normalized IFC class name\n * @param clsId - Predefined IFC class ID\n * @param meta - Item metadata (for property matching)\n * @returns true if the item matches any filter, false otherwise\n */\nconst matchesIncludeFilter = (\n includeFilters: ResolvedIncludeFilter[],\n cls: string | null,\n clsId: unknown,\n meta: unknown\n): boolean => {\n for (const filter of includeFilters) {\n // String filter: class name only. classEquals treats the Ifc prefix\n // as optional — same rule as every other class filter in the format.\n if (typeof filter === 'string') {\n const normalizedFilter = normalizeClass(filter);\n if (cls && classEquals(normalizedFilter, cls)) return true;\n if (clsId && typeof clsId === 'string') {\n if (classEquals(normalizeClass(clsId), normalizedFilter)) return true;\n }\n continue;\n }\n\n // Object filter: class + where\n if (isRecord(filter)) {\n const filterClass = filter.class;\n const filterWhere = filter.where;\n\n // Check class match (if specified)\n let classMatches = true;\n if (filterClass !== undefined) {\n const classes = Array.isArray(filterClass) ? filterClass : [filterClass];\n classMatches = false;\n for (const c of classes) {\n const normalizedC = normalizeClass(c);\n if (normalizedC && classEquals(cls, normalizedC)) {\n classMatches = true;\n break;\n }\n if (clsId && typeof clsId === 'string') {\n if (classEquals(normalizeClass(clsId), normalizedC)) {\n classMatches = true;\n break;\n }\n }\n }\n }\n\n // Check where condition (if specified)\n let whereMatches = true;\n if (filterWhere && Object.keys(filterWhere).length > 0) {\n whereMatches = matchesWhere(meta, filterWhere);\n }\n\n if (classMatches && whereMatches) return true;\n }\n }\n\n return false;\n};\n\nexport const filterModelForViewport = (\n model: SvgModelView,\n vp: ViewportElement,\n metadataById?: ModelMetadata,\n includePresets?: Record<string, string[]>,\n allowedGids?: Set<string> | null,\n highlight?: {\n gids: Set<string> | null;\n styles?: {\n color?: string;\n widthMm?: number;\n opacity?: number;\n dash?: string;\n fill?: string;\n fillOpacity?: number;\n };\n },\n filterClasses?: Set<string> | null\n): SvgModelView => {\n const resolvedIncludeClasses = resolveIncludeClasses(vp.includeClasses as unknown, includePresets ?? {});\n const includeFilters = resolvedIncludeClasses ?? null;\n // Classes subject to GID-based filtering (highlight/clip include/exclude).\n // Derived from template highlight.class and clip.class by the caller.\n const effectiveFilterClasses = filterClasses ?? new Set<string>();\n let styleMutated = false;\n if (!model.rawPaths || !model.geometryTransform || !model.transform) {\n return model;\n }\n const filteredPaths: SectionPath[] = [];\n model.rawPaths.forEach((p: SectionPath) => {\n const rawMeta = getProp(p, 'meta');\n const meta = resolveMeta(rawMeta, metadataById);\n const metaFromMap = (() => {\n const pid =\n getProp(meta, 'productId') ??\n getProp(meta, 'gid') ??\n getProp(meta, 'id') ??\n getProp(rawMeta, 'gid') ??\n getProp(rawMeta, 'id');\n return pid && metadataById ? metadataById[String(pid)] : null;\n })();\n const productIdForMeta =\n getProp(meta, 'productId') ??\n getProp(meta, 'gid') ??\n getProp(meta, 'id') ??\n getProp(rawMeta, 'gid') ??\n getProp(rawMeta, 'id') ??\n metaFromMap?.productId ??\n metaFromMap?.gid ??\n null;\n const pid = productIdForMeta ? String(productIdForMeta) : null;\n const cls = normalizeClass(getProp(meta, 'ifcClass') ?? getProp(rawMeta, 'ifcClass') ?? metaFromMap?.ifcClass);\n const clsId = getProp(meta, 'ifcClassId') ?? getProp(rawMeta, 'ifcClassId') ?? metaFromMap?.ifcClassId ?? null;\n const clsFromMap = normalizeClass(metaFromMap?.ifcClass);\n const isFilterable = matchesFilterClass(cls, clsId, clsFromMap, effectiveFilterClasses);\n const shouldHighlight = !!highlight?.gids && highlight.gids.size > 0 && !!pid && highlight.gids.has(pid);\n if (includeFilters && includeFilters.length > 0) {\n if (isFilterable) {\n // Highlight/clip class: only check includeClasses if no GID filtering will be applied\n const hasGidFiltering =\n (highlight?.gids && highlight.gids.size > 0) || (allowedGids && allowedGids.size > 0);\n if (!hasGidFiltering) {\n // No GID filtering active, so apply includeClasses filter\n const matches = matchesIncludeFilter(includeFilters, cls, clsId, meta);\n if (!matches) {\n return;\n }\n }\n } else {\n // Not a highlight/clip class: always apply includeClasses filter\n const matches = matchesIncludeFilter(includeFilters, cls, clsId, meta);\n if (!matches) {\n return;\n }\n }\n }\n if (isFilterable) {\n if (highlight?.gids && highlight.gids.size > 0) {\n if (!pid || !highlight.gids.has(pid)) {\n return;\n }\n }\n // Clip filtering logic: null means no filtering, empty Set means filtering active but no matches\n const allowed =\n !allowedGids || (allowedGids.size > 0 && !!(pid && allowedGids.has(pid))) || shouldHighlight;\n if (!allowed) return;\n }\n // CRITICAL: Exclude space fills from model - buildFillSvg will handle them with matchClipFilter support\n // Only keep space segments (outlines) in the model\n // EXCEPT: Keep highlighted space fills so they can be styled with highlight colors\n const isFill = getProp(meta, 'isFill') ?? getProp(rawMeta, 'isFill');\n if (isFilterable && isFill && !shouldHighlight) {\n return;\n }\n // Apply highlight styling when requested\n if (shouldHighlight) {\n const styledPath: SectionPath = { ...p };\n if (highlight?.styles?.color !== undefined) {\n styledPath.stroke = highlight.styles.color;\n }\n if (highlight?.styles?.widthMm !== undefined) {\n styledPath.strokeWidth = highlight.styles.widthMm;\n }\n if (highlight?.styles?.opacity !== undefined) {\n styledPath.strokeOpacity = highlight.styles.opacity;\n }\n if (highlight?.styles?.dash !== undefined) {\n styledPath.dash = highlight.styles.dash;\n }\n if (highlight?.styles?.fill !== undefined) {\n styledPath.fill = highlight.styles.fill;\n }\n if (highlight?.styles?.fillOpacity !== undefined) {\n styledPath.fillOpacity = highlight.styles.fillOpacity;\n }\n styleMutated = true;\n filteredPaths.push(styledPath);\n } else {\n filteredPaths.push(p);\n }\n });\n\n const filteredLabels: SectionLabel[] = [];\n (model.rawLabels ?? []).forEach((l: SectionLabel) => {\n const rawMeta = getProp(l, 'meta');\n const meta = resolveMeta(rawMeta, metadataById);\n const cls = normalizeClass(getProp(meta, 'ifcClass'));\n const clsId = getProp(meta, 'ifcClassId') ?? getProp(rawMeta, 'ifcClassId') ?? null;\n const productIdForMeta =\n getProp(meta, 'productId') ??\n getProp(meta, 'gid') ??\n getProp(meta, 'id') ??\n getProp(rawMeta, 'gid') ??\n getProp(rawMeta, 'id') ??\n null;\n if (includeFilters && includeFilters.length > 0) {\n if (!matchesIncludeFilter(includeFilters, cls, clsId, meta)) {\n return;\n }\n }\n if (matchesFilterClass(cls, clsId, null, effectiveFilterClasses)) {\n const pid = productIdForMeta ? String(productIdForMeta) : null;\n if (highlight?.gids && highlight.gids.size > 0) {\n if (!pid || !highlight.gids.has(pid)) {\n return;\n }\n }\n if (allowedGids && allowedGids.size > 0) {\n if (!pid || !allowedGids.has(pid)) {\n return;\n }\n }\n }\n filteredLabels.push(l);\n });\n\n if (\n !styleMutated &&\n filteredPaths.length === model.rawPaths.length &&\n filteredLabels.length === (model.rawLabels?.length ?? 0)\n ) {\n return model;\n }\n\n const rebuilt = buildModelViewFromRaw(\n filteredPaths,\n filteredLabels,\n model.transform,\n model.geometryTransform,\n model.labelStyle\n );\n return rebuilt ?? model;\n};\n"]}
|
package/dist/layout/options.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { ModelMetadata } from './metadata';
|
|
|
2
2
|
export interface RenderLayoutOptions {
|
|
3
3
|
scaleDenominators?: number[];
|
|
4
4
|
maxViewports?: number;
|
|
5
|
-
|
|
5
|
+
allowRemoteResources?: boolean;
|
|
6
6
|
allowDataUrls?: boolean;
|
|
7
7
|
qrContext?: {
|
|
8
8
|
host?: string | null;
|
|
@@ -10,7 +10,6 @@ export interface RenderLayoutOptions {
|
|
|
10
10
|
floorName?: string | null;
|
|
11
11
|
planeHeight?: number | null;
|
|
12
12
|
};
|
|
13
|
-
legendSources?: Record<string, any[]>;
|
|
14
13
|
/** Optional metadata map keyed by productId referenced from path/label meta */
|
|
15
14
|
metadataById?: ModelMetadata;
|
|
16
15
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.d.ts","sourceRoot":"/","sources":["layout/options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,MAAM,WAAW,mBAAmB;IAChC,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"/","sources":["layout/options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,MAAM,WAAW,mBAAmB;IAChC,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,SAAS,CAAC,EAAE;QACR,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACrB,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAC9B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAC1B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KAC/B,CAAC;IACF,+EAA+E;IAC/E,YAAY,CAAC,EAAE,aAAa,CAAC;CAChC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.js","sourceRoot":"/","sources":["layout/options.ts"],"names":[],"mappings":"","sourcesContent":["import { ModelMetadata } from './metadata';\n\nexport interface RenderLayoutOptions {\n scaleDenominators?: number[];\n maxViewports?: number;\n
|
|
1
|
+
{"version":3,"file":"options.js","sourceRoot":"/","sources":["layout/options.ts"],"names":[],"mappings":"","sourcesContent":["import { ModelMetadata } from './metadata';\n\nexport interface RenderLayoutOptions {\n scaleDenominators?: number[];\n maxViewports?: number;\n allowRemoteResources?: boolean;\n allowDataUrls?: boolean;\n qrContext?: {\n host?: string | null;\n containerName?: string | null;\n floorName?: string | null;\n planeHeight?: number | null;\n };\n /** Optional metadata map keyed by productId referenced from path/label meta */\n metadataById?: ModelMetadata;\n}\n"]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { SectionRenderState } from '@twinfinity/geometry';
|
|
2
|
+
import type { LayoutTemplate, ValidationIssue, ValidationOptions } from './types';
|
|
3
|
+
export type LayoutDataValidationResult = {
|
|
4
|
+
ok: true;
|
|
5
|
+
} | {
|
|
6
|
+
ok: false;
|
|
7
|
+
errors: string[];
|
|
8
|
+
};
|
|
9
|
+
export type PreflightResult = {
|
|
10
|
+
ok: true;
|
|
11
|
+
} | {
|
|
12
|
+
ok: false;
|
|
13
|
+
templateErrors?: ValidationIssue[];
|
|
14
|
+
dataErrors?: string[];
|
|
15
|
+
sectionErrors?: string[];
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Validate template, layout data, and section state in a single call.
|
|
19
|
+
* Combines `validateLayoutTemplate`, `validateLayoutData`, and `validateSectionState`.
|
|
20
|
+
*/
|
|
21
|
+
export declare const preflight: (template: LayoutTemplate, data: unknown, expectedViewportIds: string[], sectionState?: SectionRenderState,
|
|
22
|
+
/**
|
|
23
|
+
* Forwarded to `validateLayoutTemplate`. Without it preflight always judged the template under
|
|
24
|
+
* default policy, so a caller that permits remote resources or data URLs was told its template
|
|
25
|
+
* was invalid by the very check meant to predict whether rendering would succeed.
|
|
26
|
+
*/
|
|
27
|
+
options?: ValidationOptions) => PreflightResult;
|
|
28
|
+
/**
|
|
29
|
+
* Validate layout data before rendering to catch missing propertySets or items arrays.
|
|
30
|
+
*/
|
|
31
|
+
export declare const validateLayoutData: (data: unknown, expectedViewportIds: string[]) => LayoutDataValidationResult;
|
|
32
|
+
//# sourceMappingURL=preflight.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preflight.d.ts","sourceRoot":"/","sources":["layout/preflight.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAI/D,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAElF,MAAM,MAAM,0BAA0B,GAChC;IAAE,EAAE,EAAE,IAAI,CAAA;CAAE,GACZ;IACI,EAAE,EAAE,KAAK,CAAC;IACV,MAAM,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC;AAER,MAAM,MAAM,eAAe,GACrB;IAAE,EAAE,EAAE,IAAI,CAAA;CAAE,GACZ;IACI,EAAE,EAAE,KAAK,CAAC;IACV,cAAc,CAAC,EAAE,eAAe,EAAE,CAAC;IACnC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CAC5B,CAAC;AAER;;;GAGG;AACH,eAAO,MAAM,SAAS,GAClB,UAAU,cAAc,EACxB,MAAM,OAAO,EACb,qBAAqB,MAAM,EAAE,EAC7B,eAAe,kBAAkB;AACjC;;;;GAIG;AACH,UAAU,iBAAiB,KAC5B,eAcF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAAI,MAAM,OAAO,EAAE,qBAAqB,MAAM,EAAE,KAAG,0BAuCjF,CAAC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { validateLayoutTemplate } from './validation';
|
|
2
|
+
import { validateSectionState } from './sectionValidation';
|
|
3
|
+
import { isRecord, getProp } from './typeGuards';
|
|
4
|
+
/**
|
|
5
|
+
* Validate template, layout data, and section state in a single call.
|
|
6
|
+
* Combines `validateLayoutTemplate`, `validateLayoutData`, and `validateSectionState`.
|
|
7
|
+
*/
|
|
8
|
+
export const preflight = (template, data, expectedViewportIds, sectionState,
|
|
9
|
+
/**
|
|
10
|
+
* Forwarded to `validateLayoutTemplate`. Without it preflight always judged the template under
|
|
11
|
+
* default policy, so a caller that permits remote resources or data URLs was told its template
|
|
12
|
+
* was invalid by the very check meant to predict whether rendering would succeed.
|
|
13
|
+
*/
|
|
14
|
+
options) => {
|
|
15
|
+
const templateValidation = validateLayoutTemplate(template, options);
|
|
16
|
+
const dataValidation = validateLayoutData(data, expectedViewportIds);
|
|
17
|
+
const sectionValidation = sectionState ? validateSectionState(sectionState) : { ok: true };
|
|
18
|
+
const ok = templateValidation.ok && dataValidation.ok && sectionValidation.ok;
|
|
19
|
+
if (ok)
|
|
20
|
+
return { ok: true };
|
|
21
|
+
return {
|
|
22
|
+
ok: false,
|
|
23
|
+
templateErrors: templateValidation.ok ? undefined : templateValidation.errors,
|
|
24
|
+
dataErrors: dataValidation.ok ? undefined : dataValidation.errors,
|
|
25
|
+
sectionErrors: sectionValidation.ok ? undefined : sectionValidation.errors
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Validate layout data before rendering to catch missing propertySets or items arrays.
|
|
30
|
+
*/
|
|
31
|
+
export const validateLayoutData = (data, expectedViewportIds) => {
|
|
32
|
+
const errors = [];
|
|
33
|
+
if (!isRecord(data)) {
|
|
34
|
+
return { ok: false, errors: ['layout data must be an object'] };
|
|
35
|
+
}
|
|
36
|
+
expectedViewportIds.forEach((vpId) => {
|
|
37
|
+
const viewports = getProp(data, 'viewports');
|
|
38
|
+
const viewport = isRecord(viewports) ? getProp(viewports, vpId) : undefined;
|
|
39
|
+
const items = getProp(viewport, 'items');
|
|
40
|
+
if (!Array.isArray(items)) {
|
|
41
|
+
errors.push(`viewports.${vpId}.items is required and must be an array.`);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
items.forEach((it, idx) => {
|
|
45
|
+
if (!isRecord(it)) {
|
|
46
|
+
errors.push(`viewports.${vpId}.items[${idx}] must be an object.`);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const sets = getProp(it, 'propertySets');
|
|
50
|
+
if (!isRecord(sets)) {
|
|
51
|
+
errors.push(`viewports.${vpId}.items[${idx}] is missing propertySets.<Set>.<Prop>.value.`);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
Object.entries(sets).forEach(([setName, props]) => {
|
|
55
|
+
if (!isRecord(props)) {
|
|
56
|
+
errors.push(`viewports.${vpId}.items[${idx}].propertySets.${setName} must be an object.`);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
Object.entries(props).forEach(([propName, payload]) => {
|
|
60
|
+
if (!isRecord(payload) || !('value' in payload)) {
|
|
61
|
+
errors.push(`viewports.${vpId}.items[${idx}].propertySets.${setName}.${propName} must include a value (propertySets.<Set>.<Prop>.value).`);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
return errors.length ? { ok: false, errors } : { ok: true };
|
|
68
|
+
};
|
|
69
|
+
//# sourceMappingURL=preflight.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preflight.js","sourceRoot":"/","sources":["layout/preflight.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EA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,OAAO;gBACX,CAAC;gBACD,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAE,EAAE;oBAClD,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,IAAI,OAAO,CAAC,EAAE,CAAC;wBAC9C,MAAM,CAAC,IAAI,CACP,aAAa,IAAI,UAAU,GAAG,kBAAkB,OAAO,IAAI,QAAQ,0DAA0D,CAChI,CAAC;oBACN,CAAC;gBACL,CAAC,CAAC,CAAC;YACP,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IACH,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;AAChE,CAAC,CAAC","sourcesContent":["import type { SectionRenderState } from '@twinfinity/geometry';\nimport { validateLayoutTemplate } from './validation';\nimport { validateSectionState } from './sectionValidation';\nimport { isRecord, getProp } from './typeGuards';\nimport type { LayoutTemplate, ValidationIssue, ValidationOptions } from './types';\n\nexport type LayoutDataValidationResult =\n | { ok: true }\n | {\n ok: false;\n errors: string[];\n };\n\nexport type PreflightResult =\n | { ok: true }\n | {\n ok: false;\n templateErrors?: ValidationIssue[];\n dataErrors?: string[];\n sectionErrors?: string[];\n };\n\n/**\n * Validate template, layout data, and section state in a single call.\n * Combines `validateLayoutTemplate`, `validateLayoutData`, and `validateSectionState`.\n */\nexport const preflight = (\n template: LayoutTemplate,\n data: unknown,\n expectedViewportIds: string[],\n sectionState?: SectionRenderState,\n /**\n * Forwarded to `validateLayoutTemplate`. Without it preflight always judged the template under\n * default policy, so a caller that permits remote resources or data URLs was told its template\n * was invalid by the very check meant to predict whether rendering would succeed.\n */\n options?: ValidationOptions\n): PreflightResult => {\n const templateValidation = validateLayoutTemplate(template, options);\n const dataValidation = validateLayoutData(data, expectedViewportIds);\n const sectionValidation = sectionState ? validateSectionState(sectionState) : { ok: true as const };\n\n const ok = templateValidation.ok && dataValidation.ok && sectionValidation.ok;\n if (ok) return { ok: true };\n\n return {\n ok: false,\n templateErrors: templateValidation.ok ? undefined : templateValidation.errors,\n dataErrors: dataValidation.ok ? undefined : dataValidation.errors,\n sectionErrors: sectionValidation.ok ? undefined : sectionValidation.errors\n };\n};\n\n/**\n * Validate layout data before rendering to catch missing propertySets or items arrays.\n */\nexport const validateLayoutData = (data: unknown, expectedViewportIds: string[]): LayoutDataValidationResult => {\n const errors: string[] = [];\n if (!isRecord(data)) {\n return { ok: false, errors: ['layout data must be an object'] };\n }\n expectedViewportIds.forEach((vpId) => {\n const viewports = getProp(data, 'viewports');\n const viewport = isRecord(viewports) ? getProp(viewports, vpId) : undefined;\n const items = getProp(viewport, 'items');\n if (!Array.isArray(items)) {\n errors.push(`viewports.${vpId}.items is required and must be an array.`);\n return;\n }\n items.forEach((it: unknown, idx: number) => {\n if (!isRecord(it)) {\n errors.push(`viewports.${vpId}.items[${idx}] must be an object.`);\n return;\n }\n const sets = getProp(it, 'propertySets');\n if (!isRecord(sets)) {\n errors.push(`viewports.${vpId}.items[${idx}] is missing propertySets.<Set>.<Prop>.value.`);\n return;\n }\n Object.entries(sets).forEach(([setName, props]) => {\n if (!isRecord(props)) {\n errors.push(`viewports.${vpId}.items[${idx}].propertySets.${setName} must be an object.`);\n return;\n }\n Object.entries(props).forEach(([propName, payload]) => {\n if (!isRecord(payload) || !('value' in payload)) {\n errors.push(\n `viewports.${vpId}.items[${idx}].propertySets.${setName}.${propName} must include a value (propertySets.<Set>.<Prop>.value).`\n );\n }\n });\n });\n });\n });\n return errors.length ? { ok: false, errors } : { ok: true };\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"qrRender.d.ts","sourceRoot":"/","sources":["layout/qrRender.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"qrRender.d.ts","sourceRoot":"/","sources":["layout/qrRender.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAUlD,MAAM,WAAW,SAAS;IACtB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AAED,eAAO,MAAM,gBAAgB,GACzB,YAAY,SAAS,EAAE,EACvB,WAAW,GAAG,EAAE,EAChB,gBAAgB,MAAM,CAAC,MAAM,EAAE;IAAE,cAAc,EAAE,MAAM,CAAA;CAAE,CAAC,EAC1D,QAAQ,MAAM,CAAC,MAAM,EAAE,YAAY,GAAG,SAAS,CAAC,EAChD,SAAS;IAAE,SAAS,CAAC,EAAE,SAAS,CAAA;CAAE,EAClC,kBAAkB,GAAG,EACrB,UAAU,MAAM,EAAE,KACnB,OAAO,CAAC,MAAM,EAAE,CAkGlB,CAAC"}
|
package/dist/layout/qrRender.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { escapeAttr } from './renderUtils';
|
|
2
|
-
import { interpolate } from './renderUtils';
|
|
2
|
+
import { interpolate, formatNumber } from './renderUtils';
|
|
3
|
+
import { resolveViewportSection } from './sectionDefs';
|
|
3
4
|
async function getQRCode() {
|
|
4
5
|
try {
|
|
5
6
|
return await import('qrcode');
|
|
@@ -34,12 +35,17 @@ export const renderQrElements = async (qrElements, viewports, viewportScales, mo
|
|
|
34
35
|
const t = boundModel.transform;
|
|
35
36
|
const worldX = t.viewMinX + modelX;
|
|
36
37
|
const worldZ = t.viewMaxZ - modelY;
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
// Height: explicit qrContext wins; otherwise the bound viewport's
|
|
39
|
+
// own section definition (the template already knows its cut).
|
|
40
|
+
const sectionDef = resolveViewportSection(boundViewportDef);
|
|
41
|
+
const planeHeight = options?.qrContext?.planeHeight ?? (sectionDef?.plan ? sectionDef.position : 0);
|
|
42
|
+
coordinate = { x: formatNumber(worldX), y: formatNumber(planeHeight), z: formatNumber(worldZ) };
|
|
39
43
|
}
|
|
40
44
|
let payload = qr.dataTemplate ? interpolate(qr.dataTemplate, dataWithViewport) : null;
|
|
45
|
+
// Schema default: a QR with no role and no dataTemplate is role "main".
|
|
46
|
+
const role = qr.role ?? (qr.dataTemplate ? 'custom' : 'main');
|
|
41
47
|
if (!payload || typeof payload === 'string') {
|
|
42
|
-
if (
|
|
48
|
+
if (role === 'anchor' && coordinate) {
|
|
43
49
|
const corner = qr.anchorCorner === 'bottom-left'
|
|
44
50
|
? 'bl'
|
|
45
51
|
: qr.anchorCorner === 'bottom-right'
|
|
@@ -51,7 +57,7 @@ export const renderQrElements = async (qrElements, viewports, viewportScales, mo
|
|
|
51
57
|
: 'na';
|
|
52
58
|
payload = { v: 1, c: corner, p: coordinate };
|
|
53
59
|
}
|
|
54
|
-
else if (
|
|
60
|
+
else if (role === 'main') {
|
|
55
61
|
const cornerShort = qr.anchorCorner === 'bottom-left'
|
|
56
62
|
? 'bl'
|
|
57
63
|
: qr.anchorCorner === 'bottom-right'
|
|
@@ -89,9 +95,4 @@ export const renderQrElements = async (qrElements, viewports, viewportScales, mo
|
|
|
89
95
|
}
|
|
90
96
|
return parts;
|
|
91
97
|
};
|
|
92
|
-
const formatNumber = (value) => {
|
|
93
|
-
if (!Number.isFinite(value))
|
|
94
|
-
return 0;
|
|
95
|
-
return Number.parseFloat(value.toFixed(3));
|
|
96
|
-
};
|
|
97
98
|
//# sourceMappingURL=qrRender.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"qrRender.js","sourceRoot":"/","sources":["layout/qrRender.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAA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OAAO,CAAC,CAAC;IACtC,OAAO,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;AAC/C,CAAC,CAAC","sourcesContent":["import { escapeAttr } from './renderUtils';\nimport { interpolate } from './renderUtils';\nimport { QrElement, SvgModelView } from './types';\n\nasync function getQRCode(): Promise<typeof import('qrcode')> {\n try {\n return await import('qrcode');\n } catch {\n throw new Error('qrcode is required for QR code rendering. Install it: bun add qrcode');\n }\n}\n\nexport interface QrContext {\n host?: string | null;\n containerName?: string | null;\n floorName?: string | null;\n planeHeight?: number | null;\n}\n\nexport const renderQrElements = async (\n qrElements: QrElement[],\n viewports: any[],\n viewportScales: Record<string, { mmPerModelUnit: number }>,\n models: Record<string, SvgModelView | undefined>,\n options: { qrContext?: QrContext },\n dataWithViewport: any,\n warnings: string[]\n): Promise<string[]> => {\n const parts: string[] = [];\n\n for (const qr of qrElements) {\n const boundViewportId = qr.viewport ?? viewports[0]?.id ?? null;\n const viewportScale = boundViewportId ? viewportScales[boundViewportId] : null;\n const boundViewportDef = boundViewportId ? viewports.find((v) => v.id === boundViewportId) : null;\n // In v2, viewport id IS the model key\n const boundModel = boundViewportDef ? (models[boundViewportDef.id] ?? null) : null;\n\n let coordinate: { x: number; y: number; z: number } | null = null;\n if (boundViewportDef && viewportScale && boundModel?.transform && (boundViewportDef.rotationDeg ?? 0) === 0) {\n const mmPerModel = viewportScale.mmPerModelUnit;\n const contentWidthMm = boundModel.widthModel * mmPerModel;\n const contentHeightMm = boundModel.heightModel * mmPerModel;\n const centerX =\n boundViewportDef.align === 'topLeft'\n ? boundViewportDef.xMm + contentWidthMm * 0.5\n : boundViewportDef.xMm + boundViewportDef.widthMm * 0.5;\n const centerY =\n boundViewportDef.align === 'topLeft'\n ? boundViewportDef.yMm + contentHeightMm * 0.5\n : boundViewportDef.yMm + boundViewportDef.heightMm * 0.5;\n\n const pointMmX = qr.xMm + qr.sizeMm * 0.5;\n const pointMmY = qr.yMm + qr.sizeMm * 0.5;\n\n const modelX = (pointMmX - centerX) / mmPerModel + boundModel.widthModel * 0.5;\n const modelY = (pointMmY - centerY) / mmPerModel + boundModel.heightModel * 0.5;\n\n const t = boundModel.transform;\n const worldX = t.viewMinX + modelX;\n const worldZ = t.viewMaxZ - modelY;\n const planeHeight = options?.qrContext?.planeHeight ?? 0;\n coordinate = { x: formatNumber(worldX), y: formatNumber(planeHeight ?? 0), z: formatNumber(worldZ) };\n }\n\n let payload: unknown = qr.dataTemplate ? interpolate(qr.dataTemplate, dataWithViewport) : null;\n if (!payload || typeof payload === 'string') {\n if (qr.role === 'anchor' && coordinate) {\n const corner =\n qr.anchorCorner === 'bottom-left'\n ? 'bl'\n : qr.anchorCorner === 'bottom-right'\n ? 'br'\n : qr.anchorCorner === 'top-left'\n ? 'tl'\n : qr.anchorCorner === 'top-right'\n ? 'tr'\n : 'na';\n payload = { v: 1, c: corner, p: coordinate };\n } else if (qr.role === 'main') {\n const cornerShort =\n qr.anchorCorner === 'bottom-left'\n ? 'bl'\n : qr.anchorCorner === 'bottom-right'\n ? 'br'\n : qr.anchorCorner === 'top-left'\n ? 'tl'\n : qr.anchorCorner === 'top-right'\n ? 'tr'\n : 'bl';\n payload = {\n v: 1,\n c: cornerShort,\n h: options?.qrContext?.host ?? null,\n a: options?.qrContext?.containerName ?? null,\n fn: options?.qrContext?.floorName ?? null,\n p: coordinate\n };\n }\n }\n\n if (!payload) {\n warnings.push(`QR '${qr.id}' has no payload.`);\n continue;\n }\n\n try {\n const QRCode = await getQRCode();\n const dataUrl = await QRCode.toDataURL(typeof payload === 'string' ? payload : JSON.stringify(payload), {\n margin: 0,\n errorCorrectionLevel: 'M'\n });\n parts.push(\n `<image href=\"${escapeAttr(dataUrl)}\" x=\"${qr.xMm}\" y=\"${qr.yMm}\" width=\"${qr.sizeMm}\" height=\"${qr.sizeMm}\" />`\n );\n } catch (error) {\n warnings.push(`Failed to generate QR '${qr.id}': ${(error as Error).message}`);\n }\n }\n\n return parts;\n};\n\nconst formatNumber = (value: number): number => {\n if (!Number.isFinite(value)) return 0;\n return Number.parseFloat(value.toFixed(3));\n};\n"]}
|
|
1
|
+
{"version":3,"file":"qrRender.js","sourceRoot":"/","sources":["layout/qrRender.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAGvD,KAAK,UAAU,SAAS;IACpB,IAAI,CAAC;QACD,OAAO,MAAM,MAAM,CAAC,QAAQ,CAAC,CAAC;IAClC,CAAC;IAAC,MAAM,CAAC;QACL,MAAM,IAAI,KAAK,CAAC,sEAAsE,CAAC,CAAC;IAC5F,CAAC;AACL,CAAC;AASD,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,EACjC,UAAuB,EACvB,SAAgB,EAChB,cAA0D,EAC1D,MAAgD,EAChD,OAAkC,EAClC,gBAAqB,EACrB,QAAkB,EACD,EAAE;IACnB,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,KAAK,MAAM,EAAE,IAAI,UAAU,EAAE,CAAC;QAC1B,MAAM,eAAe,GAAG,EAAE,CAAC,QAAQ,IAAI,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,IAAI,IAAI,CAAC;QAChE,MAAM,aAAa,GAAG,eAAe,CAAC,CAAC,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAC/E,MAAM,gBAAgB,GAAG,eAAe,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,eAAe,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAClG,sCAAsC;QACtC,MAAM,UAAU,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,gBAA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AAC,OAAO,CAAC,EAAE;gBACpG,MAAM,EAAE,CAAC;gBACT,oBAAoB,EAAE,GAAG;aAC5B,CAAC,CAAC;YACH,KAAK,CAAC,IAAI,CACN,gBAAgB,UAAU,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,GAAG,QAAQ,EAAE,CAAC,GAAG,YAAY,EAAE,CAAC,MAAM,aAAa,EAAE,CAAC,MAAM,MAAM,CACnH,CAAC;QACN,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,QAAQ,CAAC,IAAI,CAAC,0BAA0B,EAAE,CAAC,EAAE,MAAO,KAAe,CAAC,OAAO,EAAE,CAAC,CAAC;QACnF,CAAC;IACL,CAAC;IAED,OAAO,KAAK,CAAC;AACjB,CAAC,CAAC","sourcesContent":["import { escapeAttr } from './renderUtils';\nimport { interpolate, formatNumber } from './renderUtils';\nimport { resolveViewportSection } from './sectionDefs';\nimport { QrElement, SvgModelView } from './types';\n\nasync function getQRCode(): Promise<typeof import('qrcode')> {\n try {\n return await import('qrcode');\n } catch {\n throw new Error('qrcode is required for QR code rendering. Install it: bun add qrcode');\n }\n}\n\nexport interface QrContext {\n host?: string | null;\n containerName?: string | null;\n floorName?: string | null;\n planeHeight?: number | null;\n}\n\nexport const renderQrElements = async (\n qrElements: QrElement[],\n viewports: any[],\n viewportScales: Record<string, { mmPerModelUnit: number }>,\n models: Record<string, SvgModelView | undefined>,\n options: { qrContext?: QrContext },\n dataWithViewport: any,\n warnings: string[]\n): Promise<string[]> => {\n const parts: string[] = [];\n\n for (const qr of qrElements) {\n const boundViewportId = qr.viewport ?? viewports[0]?.id ?? null;\n const viewportScale = boundViewportId ? viewportScales[boundViewportId] : null;\n const boundViewportDef = boundViewportId ? viewports.find((v) => v.id === boundViewportId) : null;\n // In v2, viewport id IS the model key\n const boundModel = boundViewportDef ? (models[boundViewportDef.id] ?? null) : null;\n\n let coordinate: { x: number; y: number; z: number } | null = null;\n if (boundViewportDef && viewportScale && boundModel?.transform && (boundViewportDef.rotationDeg ?? 0) === 0) {\n const mmPerModel = viewportScale.mmPerModelUnit;\n const contentWidthMm = boundModel.widthModel * mmPerModel;\n const contentHeightMm = boundModel.heightModel * mmPerModel;\n const centerX =\n boundViewportDef.align === 'topLeft'\n ? boundViewportDef.xMm + contentWidthMm * 0.5\n : boundViewportDef.xMm + boundViewportDef.widthMm * 0.5;\n const centerY =\n boundViewportDef.align === 'topLeft'\n ? boundViewportDef.yMm + contentHeightMm * 0.5\n : boundViewportDef.yMm + boundViewportDef.heightMm * 0.5;\n\n const pointMmX = qr.xMm + qr.sizeMm * 0.5;\n const pointMmY = qr.yMm + qr.sizeMm * 0.5;\n\n const modelX = (pointMmX - centerX) / mmPerModel + boundModel.widthModel * 0.5;\n const modelY = (pointMmY - centerY) / mmPerModel + boundModel.heightModel * 0.5;\n\n const t = boundModel.transform;\n const worldX = t.viewMinX + modelX;\n const worldZ = t.viewMaxZ - modelY;\n // Height: explicit qrContext wins; otherwise the bound viewport's\n // own section definition (the template already knows its cut).\n const sectionDef = resolveViewportSection(boundViewportDef);\n const planeHeight = options?.qrContext?.planeHeight ?? (sectionDef?.plan ? sectionDef.position : 0);\n coordinate = { x: formatNumber(worldX), y: formatNumber(planeHeight), z: formatNumber(worldZ) };\n }\n\n let payload: unknown = qr.dataTemplate ? interpolate(qr.dataTemplate, dataWithViewport) : null;\n // Schema default: a QR with no role and no dataTemplate is role \"main\".\n const role = qr.role ?? (qr.dataTemplate ? 'custom' : 'main');\n if (!payload || typeof payload === 'string') {\n if (role === 'anchor' && coordinate) {\n const corner =\n qr.anchorCorner === 'bottom-left'\n ? 'bl'\n : qr.anchorCorner === 'bottom-right'\n ? 'br'\n : qr.anchorCorner === 'top-left'\n ? 'tl'\n : qr.anchorCorner === 'top-right'\n ? 'tr'\n : 'na';\n payload = { v: 1, c: corner, p: coordinate };\n } else if (role === 'main') {\n const cornerShort =\n qr.anchorCorner === 'bottom-left'\n ? 'bl'\n : qr.anchorCorner === 'bottom-right'\n ? 'br'\n : qr.anchorCorner === 'top-left'\n ? 'tl'\n : qr.anchorCorner === 'top-right'\n ? 'tr'\n : 'bl';\n payload = {\n v: 1,\n c: cornerShort,\n h: options?.qrContext?.host ?? null,\n a: options?.qrContext?.containerName ?? null,\n fn: options?.qrContext?.floorName ?? null,\n p: coordinate\n };\n }\n }\n\n if (!payload) {\n warnings.push(`QR '${qr.id}' has no payload.`);\n continue;\n }\n\n try {\n const QRCode = await getQRCode();\n const dataUrl = await QRCode.toDataURL(typeof payload === 'string' ? payload : JSON.stringify(payload), {\n margin: 0,\n errorCorrectionLevel: 'M'\n });\n parts.push(\n `<image href=\"${escapeAttr(dataUrl)}\" x=\"${qr.xMm}\" y=\"${qr.yMm}\" width=\"${qr.sizeMm}\" height=\"${qr.sizeMm}\" />`\n );\n } catch (error) {\n warnings.push(`Failed to generate QR '${qr.id}': ${(error as Error).message}`);\n }\n }\n\n return parts;\n};\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ViewportLineStyle, ViewportLineStyles, FillRule, RenderDrawingInput, RenderDrawingResult, NormalizedProductItem } from './types';
|
|
2
2
|
interface SampledColor {
|
|
3
3
|
color: {
|
|
4
4
|
r: number;
|
|
@@ -7,20 +7,23 @@ interface SampledColor {
|
|
|
7
7
|
};
|
|
8
8
|
alpha: number;
|
|
9
9
|
}
|
|
10
|
-
declare let _renderLayout: ((template: LayoutTemplate, data: any, models: Record<string, SvgModelView>, options?: any) => Promise<{
|
|
11
|
-
svg: string;
|
|
12
|
-
viewportScales: any;
|
|
13
|
-
warnings: string[];
|
|
14
|
-
}>) | null;
|
|
15
|
-
/** Called by index.ts to register renderLayout without a circular import. */
|
|
16
|
-
export declare function setRenderLayoutBinding(fn: NonNullable<typeof _renderLayout>): void;
|
|
17
10
|
/**
|
|
18
|
-
* High-level entry point that
|
|
19
|
-
*
|
|
11
|
+
* High-level entry point that renders a layout template to a ready-to-print
|
|
12
|
+
* SVG string.
|
|
20
13
|
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
14
|
+
* The inputs form a 2×2 matrix — geometry × item data, each either raw or
|
|
15
|
+
* pre-built:
|
|
16
|
+
*
|
|
17
|
+
* | input | what it is |
|
|
18
|
+
* |---------------------------|--------------------------------------------------|
|
|
19
|
+
* | `sections` | RAW geometry: plane-section results (one shared or per viewport id). |
|
|
20
|
+
* | `models` | PRE-BUILT geometry: `SvgModelView`s per viewport id (e.g. from `slabSectionToModelView`). Needs `rawPaths` with `meta.gid` for highlight/clip/includeClasses. |
|
|
21
|
+
* | `options.productEntries` | RAW item data: per-product world-x/z polylines (`slabPerProductToEntries`); one flat list shared by all viewports or a per-viewport record. Feeds labels/legend/clip/highlight items. |
|
|
22
|
+
* | `options.viewportItems` | PRE-BUILT item data per viewport id (overrides `productEntries`). |
|
|
23
|
+
*
|
|
24
|
+
* Prerequisite: products must have property sets loaded
|
|
25
|
+
* (`await api.ifc.loadPropertySets()` on core BIM objects) — without them
|
|
26
|
+
* every `where` filter matches nothing.
|
|
24
27
|
*
|
|
25
28
|
* ```ts
|
|
26
29
|
* const section = computePlaneSectionsForProducts(products, plane, { includeInvisible: true });
|
|
@@ -28,9 +31,8 @@ export declare function setRenderLayoutBinding(fn: NonNullable<typeof _renderLay
|
|
|
28
31
|
* template,
|
|
29
32
|
* sections: { main: section },
|
|
30
33
|
* options: {
|
|
31
|
-
*
|
|
32
|
-
* qrContext: { host, containerName
|
|
33
|
-
* productFields: { idPath: "propertySets.BIP.spacenumber.value", ... },
|
|
34
|
+
* allowRemoteResources: true,
|
|
35
|
+
* qrContext: { host, containerName },
|
|
34
36
|
* roomLabels: { labelPath: "BIP.spacename", classFilter: "space" },
|
|
35
37
|
* },
|
|
36
38
|
* });
|
|
@@ -46,9 +48,18 @@ export declare const BUILTIN_LABEL_DEFAULTS: {
|
|
|
46
48
|
/** Built-in defaults when neither lineStyles nor lineWidthMm/lineColor are set. */
|
|
47
49
|
export declare const BUILTIN_LINE_DEFAULTS: Required<ViewportLineStyle>;
|
|
48
50
|
export declare const BUILTIN_HIDDEN_DEFAULTS: Required<ViewportLineStyle>;
|
|
49
|
-
type LineCategory = 'cutLines' | 'visibleLines' | 'hiddenLines' | '
|
|
51
|
+
export type LineCategory = 'cutLines' | 'visibleLines' | 'hiddenLines' | 'silhouettesVisible' | 'silhouettesHidden' | 'featureEdges' | 'stairArrows' | 'outlineVisible' | 'outlineHidden';
|
|
50
52
|
/** Category-specific built-in defaults (merged over the global default). */
|
|
51
53
|
export declare const CATEGORY_BUILTIN_OVERRIDES: Partial<Record<LineCategory, Partial<ViewportLineStyle>>>;
|
|
54
|
+
/**
|
|
55
|
+
* Resolve the effective line style for one category — the single source of
|
|
56
|
+
* truth used by both the slab plan path (slabModelView) and the drawing path.
|
|
57
|
+
*
|
|
58
|
+
* Cascade, weakest first: built-in defaults → `default` → built-in category
|
|
59
|
+
* defaults → `defaultVisibleLines`/`defaultHiddenLines` (the category's
|
|
60
|
+
* visibility group) → the category's own key.
|
|
61
|
+
*/
|
|
62
|
+
export declare function resolveCategoryLineStyle(category: LineCategory, lineStyles?: ViewportLineStyles): Required<ViewportLineStyle>;
|
|
52
63
|
export interface ResolvedLineStyles {
|
|
53
64
|
default: Required<ViewportLineStyle>;
|
|
54
65
|
byCategory: Record<LineCategory, Required<ViewportLineStyle>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderDrawing.d.ts","sourceRoot":"/","sources":["layout/renderDrawing.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"renderDrawing.d.ts","sourceRoot":"/","sources":["layout/renderDrawing.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAGR,iBAAiB,EACjB,kBAAkB,EAClB,QAAQ,EAGR,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EAGxB,MAAM,SAAS,CAAC;AASjB,UAAU,YAAY;IAClB,KAAK,EAAE;QAAE,CAAC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