pptx-angular-viewer 4.6.0 → 4.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/fesm2022/{pptx-angular-viewer-chart-3d-view-scene-BvVx5_I3.mjs → pptx-angular-viewer-chart-3d-view-scene-CFWKnfML.mjs} +2 -2
- package/fesm2022/{pptx-angular-viewer-chart-3d-view-scene-BvVx5_I3.mjs.map → pptx-angular-viewer-chart-3d-view-scene-CFWKnfML.mjs.map} +1 -1
- package/fesm2022/{pptx-angular-viewer-chat-history-idb-NpaCpp0C.mjs → pptx-angular-viewer-chat-history-idb-D_SZnX0q.mjs} +2 -2
- package/fesm2022/{pptx-angular-viewer-chat-history-idb-NpaCpp0C.mjs.map → pptx-angular-viewer-chat-history-idb-D_SZnX0q.mjs.map} +1 -1
- package/fesm2022/{pptx-angular-viewer-pptx-angular-viewer-C2z1kMFI.mjs → pptx-angular-viewer-pptx-angular-viewer-D3TADvW3.mjs} +7350 -1412
- package/fesm2022/{pptx-angular-viewer-pptx-angular-viewer-C2z1kMFI.mjs.map → pptx-angular-viewer-pptx-angular-viewer-D3TADvW3.mjs.map} +1 -1
- package/fesm2022/pptx-angular-viewer.mjs +1 -1
- package/i18n/de.cjs +70 -21
- package/i18n/de.mjs +70 -21
- package/i18n/es.cjs +70 -21
- package/i18n/es.mjs +70 -21
- package/i18n/fr.cjs +70 -21
- package/i18n/fr.mjs +70 -21
- package/i18n/zh-CN.cjs +48 -4
- package/i18n/zh-CN.mjs +48 -4
- package/package.json +2 -2
- package/types/pptx-angular-viewer.d.ts +267 -40
- package/types/pptx-angular-viewer.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,25 @@ A release listed with no entries carried no Conventional Commit in this package'
|
|
|
7
7
|
scope: scripts/release-plan.mjs re-releases a package whenever any of its files
|
|
8
8
|
change, not only on conventional ones.
|
|
9
9
|
|
|
10
|
+
## [4.6.0](https://github.com/ChristopherVR/pptx-viewer/releases/tag/pptx-angular-viewer@4.6.0) - 2026-09-25
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
- **shared:** Add a framework-neutral ui customization model (by @ChristopherVR) ([7e67dbd](https://github.com/ChristopherVR/pptx-viewer/commit/7e67dbdd859aef4a71c697c0ee5f607ce8cdc731))
|
|
15
|
+
- **angular:** Expose the ui customization model (by @ChristopherVR) ([5a6e448](https://github.com/ChristopherVR/pptx-viewer/commit/5a6e44878b6c84c47a554b36dedb376a6e49873d))
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
- **vue,angular,svelte:** Keep rotation and opacity on chart text labels (by @ChristopherVR) ([174039d](https://github.com/ChristopherVR/pptx-viewer/commit/174039d91b3de3ee9d1ce229c1dd4abec0ae9771))
|
|
20
|
+
- **shared,react,vue,angular,svelte,vanilla:** Leave Tab on chrome controls to focus navigation (by @ChristopherVR) ([6561c8d](https://github.com/ChristopherVR/pptx-viewer/commit/6561c8dd0ecf506b6e97cf1991616e40a2204e41))
|
|
21
|
+
- **react,angular:** Keep right-click menus inside the viewport (by @ChristopherVR) ([39642d7](https://github.com/ChristopherVR/pptx-viewer/commit/39642d7955daec7c48543aae3c135d729f70a177))
|
|
22
|
+
- **shared,vue,angular,svelte,vanilla:** Target the canvas node, not a thumbnail's (by @ChristopherVR) ([84df4fa](https://github.com/ChristopherVR/pptx-viewer/commit/84df4fafa2f8a04669b9f527af3e6ec9142cdfc0))
|
|
23
|
+
|
|
24
|
+
### Testing
|
|
25
|
+
|
|
26
|
+
- **shared:** Compare the customization reference ignoring table padding (by @ChristopherVR) ([8695b36](https://github.com/ChristopherVR/pptx-viewer/commit/8695b362ab25a3a35a9683a67ed9bce30afc40b2))
|
|
27
|
+
- **angular:** Parent the customisation test injector on TestBed (by @ChristopherVR) ([2bfc13d](https://github.com/ChristopherVR/pptx-viewer/commit/2bfc13d8c26bdcf58c38b42cb9962b02263aef38))
|
|
28
|
+
|
|
10
29
|
## [4.5.0](https://github.com/ChristopherVR/pptx-viewer/releases/tag/pptx-angular-viewer@4.5.0) - 2026-09-24
|
|
11
30
|
|
|
12
31
|
### Features
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { s as shade, c as createSvgEl, r as renderChartLineSvg, a as renderChartTextSvg, b as appendChartLegendSvg, d as dragAnchorViewY, e as advanceChartValueDrag, f as buildBarChart3DHoverTooltip, i as isChartInteractionArmed, g as beginChartValueDrag, C as CHART_3D_DRAG_THRESHOLD_PX, h as createSurfaceChart3DScene, j as createPieChart3DScene, k as createAreaChart3DScene, l as createLineChart3DScene, m as createBarChart3DScene } from './pptx-angular-viewer-pptx-angular-viewer-
|
|
1
|
+
import { s as shade, c as createSvgEl, r as renderChartLineSvg, a as renderChartTextSvg, b as appendChartLegendSvg, d as dragAnchorViewY, e as advanceChartValueDrag, f as buildBarChart3DHoverTooltip, i as isChartInteractionArmed, g as beginChartValueDrag, C as CHART_3D_DRAG_THRESHOLD_PX, h as createSurfaceChart3DScene, j as createPieChart3DScene, k as createAreaChart3DScene, l as createLineChart3DScene, m as createBarChart3DScene } from './pptx-angular-viewer-pptx-angular-viewer-D3TADvW3.mjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* chart-3d-shading.ts: PowerPoint's flat chart-space shading for a 3D chart's
|
|
@@ -467,4 +467,4 @@ async function mountChart3DView(spec, ctx) {
|
|
|
467
467
|
}
|
|
468
468
|
|
|
469
469
|
export { buildObliqueCamera, mountChart3DView };
|
|
470
|
-
//# sourceMappingURL=pptx-angular-viewer-chart-3d-view-scene-
|
|
470
|
+
//# sourceMappingURL=pptx-angular-viewer-chart-3d-view-scene-CFWKnfML.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pptx-angular-viewer-chart-3d-view-scene-BvVx5_I3.mjs","sources":["../../src/internal/shared-src/render/chart-3d-shading.ts","../../src/internal/shared-src/render/chart-3d-bar-mesh.ts","../../src/internal/shared-src/render/chart-3d-chrome-overlay.ts","../../src/internal/shared-src/render/chart-3d-oblique-interaction.ts","../../src/internal/shared-src/render/chart-3d-view-scene.ts"],"sourcesContent":["/**\n * chart-3d-shading.ts: PowerPoint's flat chart-space shading for a 3D chart's\n * box faces, as one colour multiplier per named face.\n *\n * PowerPoint's 3D charts (bar3D, pie3D, line3D ribbons, area3D slabs, surface\n * bands) are flat-shaded in \"chart space\": every face of a given orientation\n * gets the SAME multiplier applied to the mark's base colour, regardless of\n * the chart's `c:view3D` tilt. Measured directly off the pixels of\n * `gt/chart-01.webp` (a 3-D Clustered Column, series 1 = theme accent1\n * `#156082`): the front (camera-facing) rect samples the base colour exactly\n * (`front = base`), the top face samples ~0.75x, and the visible side face\n * ~0.64x. `back`/`left` (mirrors of `right`) and `bottom` (rarely visible)\n * are not independently measured; `back`/`left` reuse the measured side\n * multiplier and `bottom` is a reasonable approximation between side and a\n * fully unlit face.\n *\n * @module chart-3d-shading\n */\nimport { shade } from './chart-palette';\n\n/** A box mesh's six face orientations, in the chart's own (unrotated) local frame. */\nexport type Chart3DFace = 'front' | 'back' | 'top' | 'bottom' | 'left' | 'right';\n\n/**\n * Darken amount (0-1, `chart-palette.ts#shade`'s `amount`) per face,\n * derived from the measured multipliers: `amount = 1 - multiplier`.\n */\nconst FACE_SHADE_AMOUNT: Record<Chart3DFace, number> = {\n\tfront: 0,\n\ttop: 0.25,\n\tright: 0.36,\n\tleft: 0.36,\n\tback: 0.36,\n\tbottom: 0.5,\n};\n\n/** Apply PowerPoint's measured per-face flat shading to a mark's base colour. */\nexport function shadeChart3DFace(baseColor: string, face: Chart3DFace): string {\n\tconst amount = FACE_SHADE_AMOUNT[face];\n\treturn amount === 0 ? baseColor : shade(baseColor, amount);\n}\n\n/**\n * The six face colours for a box mesh, in the order three.js `BoxGeometry`\n * expects its `material` array (`[+x, -x, +y, -y, +z, -z]`): right, left,\n * top, bottom, front, back. `front`/`back` name whichever world axis the\n * scene treats as the camera-facing depth axis; the caller picks that\n * mapping (see `chart-3d-view-scene.ts`).\n */\nexport function buildChart3DBoxFaceColors(\n\tbaseColor: string,\n): readonly [string, string, string, string, string, string] {\n\treturn [\n\t\tshadeChart3DFace(baseColor, 'right'),\n\t\tshadeChart3DFace(baseColor, 'left'),\n\t\tshadeChart3DFace(baseColor, 'top'),\n\t\tshadeChart3DFace(baseColor, 'bottom'),\n\t\tshadeChart3DFace(baseColor, 'front'),\n\t\tshadeChart3DFace(baseColor, 'back'),\n\t];\n}\n","/**\n * Build the real WebGL box meshes for a `bar3D` chart's `Chart3DBarGeometry`\n * (see `chart-3d-spec.ts`). Split out of `chart-3d-view-scene.ts` to keep\n * that file within the repo's ~300-LOC limit.\n *\n * Every box is positioned so its FRONT face (world Z=0) sits exactly where\n * the flat 2D fallback's front-face rectangle would be drawn, in \"1 world\n * unit = 1 authored chart px\" coordinates matching `chart-3d-chrome-overlay.ts`'s\n * overlay `<svg>` viewBox. The box then extrudes backward (negative Z) by its\n * own depth, so the oblique camera's shear (`chart-3d-view-scene.ts`) shifts\n * only the BACK face, reproducing the same silhouette the flat 2D depth pass\n * draws as a hand-built parallelogram (`chart-3d-depth.ts#barExtrusion`).\n *\n * Only `PptxBar3DShape === 'box'` reaches this module today\n * (`chart-3d-spec.ts#isSupportedBoxShape` gates everything else out at the\n * spec level), so every box gets flat, per-face-group `MeshBasicMaterial`s\n * (no lights involved: PowerPoint's box faces are flat-shaded in chart\n * space, not lit) built from `chart-3d-shading.ts`'s measured multipliers.\n *\n * @module chart-3d-bar-mesh\n */\nimport type * as THREE from 'three';\n\nimport { buildChart3DBoxFaceColors } from './chart-3d-shading';\nimport type { Chart3DBarBox } from './chart-3d-spec';\n\ntype ThreeModule = typeof THREE;\n\nexport interface Chart3DBarMeshResult {\n\tgroup: THREE.Group;\n\t/** One mesh per box, same order as `boxes`; carries `{ seriesIndex, categoryIndex }` in `userData`. */\n\tmeshes: THREE.Mesh[];\n\tdispose: () => void;\n}\n\n/**\n * Build one `THREE.Mesh` per box and add them to a new `THREE.Group`. World\n * coordinates: X/Y centred on the chart's own `svgWidth`/`svgHeight` (X\n * right, Y UP - the SVG Y-down front rect is flipped here), Z=0 at the\n * front face, extending negative (away from the camera) by the box's own\n * depth.\n */\nexport function buildChart3DBarMeshes(\n\tthree: ThreeModule,\n\tboxes: ReadonlyArray<Chart3DBarBox>,\n\tsvgWidth: number,\n\tsvgHeight: number,\n): Chart3DBarMeshResult {\n\tconst group = new three.Group();\n\tconst meshes: THREE.Mesh[] = [];\n\tconst geometries: THREE.BufferGeometry[] = [];\n\tconst materials: THREE.Material[] = [];\n\tconst halfW = svgWidth / 2;\n\tconst halfH = svgHeight / 2;\n\n\tfor (const box of boxes) {\n\t\tconst geometry = new three.BoxGeometry(1, 1, 1);\n\t\tgeometries.push(geometry);\n\t\tconst faceMaterials = buildChart3DBoxFaceColors(box.color).map(\n\t\t\t(color) => new three.MeshBasicMaterial({ color }),\n\t\t);\n\t\tmaterials.push(...faceMaterials);\n\n\t\tconst mesh = new three.Mesh(geometry, faceMaterials);\n\t\tconst zDepth = box.depthMagnitude;\n\t\tmesh.position.set(box.x + box.w / 2 - halfW, halfH - (box.y + box.h / 2), -zDepth / 2);\n\t\tmesh.scale.set(box.w, box.h, zDepth);\n\t\tmesh.userData = { seriesIndex: box.seriesIndex, categoryIndex: box.categoryIndex };\n\t\tgroup.add(mesh);\n\t\tmeshes.push(mesh);\n\t}\n\n\treturn {\n\t\tgroup,\n\t\tmeshes,\n\t\tdispose: () => {\n\t\t\tfor (const geometry of geometries) {\n\t\t\t\tgeometry.dispose();\n\t\t\t}\n\t\t\tfor (const material of materials) {\n\t\t\t\tmaterial.dispose();\n\t\t\t}\n\t\t},\n\t};\n}\n","/**\n * chart-3d-chrome-overlay.ts: the SVG \"chrome\" (chart-area fill/border,\n * title, legend, value-axis gridlines/ticks, category labels) a 3D chart\n * scene draws OVER its WebGL canvas via `ctx.overlay`.\n *\n * PowerPoint's own 3D charts always show this chrome exactly like the 2D\n * chart does (see the parity brief's \"hybrid rendering\" requirement); for a\n * chart in the oblique (`rAngAx=1`) projection family this chrome is\n * ALREADY pixel-correct in the flat 2D `ChartViewModel` (verified against\n * `gt/chart-01.webp`: axes/gridlines/title/legend sit exactly where a plain\n * 2D chart would put them, perfectly undistorted), so this module reuses the\n * SAME `chart-view-model-dom.ts` piece-renderers the 2D/vanilla projector\n * uses, just WITHOUT `vm.primitives`/`vm.dataLabels` (the flat oblique\n * bars/extrusion polygons, replaced by real WebGL geometry).\n *\n * @module chart-3d-chrome-overlay\n */\nimport {\n\tappendChartLegendSvg,\n\trenderChartLineSvg,\n\trenderChartTextSvg,\n} from './chart-view-model-dom';\nimport { createSvgEl } from './chart-view-model-dom-helpers';\nimport type { ChartViewModel } from './chart-view-model-types';\n\n/**\n * Render a `ChartViewModel`'s chrome (everything except data marks) to an\n * `<svg>` sized to `vm.svgWidth` x `vm.svgHeight`, matching the WebGL\n * scene's own world-unit convention (1 world unit = 1 authored chart px) so\n * an element positioned from the same view-model's rects lines up exactly.\n */\nexport function renderChart3DChromeOverlaySvg(doc: Document, vm: ChartViewModel): SVGSVGElement {\n\tconst svg = createSvgEl(doc, 'svg', {\n\t\tclass: 'pptxv-chart-3d-chrome',\n\t\tviewBox: `0 0 ${vm.svgWidth} ${vm.svgHeight}`,\n\t\tpreserveAspectRatio: 'none',\n\t});\n\tsvg.style.setProperty('width', '100%');\n\tsvg.style.setProperty('height', '100%');\n\tsvg.style.setProperty('display', 'block');\n\tsvg.style.setProperty('position', 'absolute');\n\tsvg.style.setProperty('inset', '0');\n\t// The WebGL canvas paints the marks; this overlay only adds chrome on top\n\t// of them, so pointer events must fall through to the canvas underneath.\n\tsvg.style.setProperty('pointer-events', 'none');\n\n\tif (vm.areaFill) {\n\t\tsvg.appendChild(\n\t\t\tcreateSvgEl(doc, 'rect', {\n\t\t\t\tx: 0,\n\t\t\t\ty: 0,\n\t\t\t\twidth: vm.svgWidth,\n\t\t\t\theight: vm.svgHeight,\n\t\t\t\trx: vm.areaRadius,\n\t\t\t\tfill: vm.areaFill,\n\t\t\t}),\n\t\t);\n\t}\n\n\tif (vm.title) {\n\t\tconst title = createSvgEl(doc, 'text', {\n\t\t\tx: vm.titleX,\n\t\t\ty: vm.titleY,\n\t\t\t'text-anchor': 'middle',\n\t\t\t'font-size': vm.titleStyle?.fontSize ?? 12,\n\t\t\t'font-weight': vm.titleStyle?.fontWeight ?? 600,\n\t\t\t'font-family': vm.titleStyle?.fontFamily,\n\t\t\tfill: vm.titleStyle?.fill ?? '#1e293b',\n\t\t\t'data-chart-part': 'title',\n\t\t});\n\t\tif (vm.titleRunSpans && vm.titleRunSpans.length > 0) {\n\t\t\tfor (const run of vm.titleRunSpans) {\n\t\t\t\tconst tspan = createSvgEl(doc, 'tspan', {\n\t\t\t\t\t'font-size': run.fontSize,\n\t\t\t\t\t'font-weight': run.fontWeight,\n\t\t\t\t\t'font-style': run.fontStyle,\n\t\t\t\t\t'font-family': run.fontFamily,\n\t\t\t\t\tfill: run.fill,\n\t\t\t\t});\n\t\t\t\ttspan.textContent = run.text;\n\t\t\t\ttitle.appendChild(tspan);\n\t\t\t}\n\t\t} else {\n\t\t\ttitle.textContent = vm.title;\n\t\t}\n\t\tsvg.appendChild(title);\n\t}\n\n\tfor (const gl of vm.gridlines) {\n\t\tsvg.appendChild(renderChartLineSvg(doc, gl));\n\t}\n\tfor (const gl of vm.secondaryGridlines ?? []) {\n\t\tsvg.appendChild(renderChartLineSvg(doc, gl));\n\t}\n\tfor (const lbl of vm.axisLabels) {\n\t\tsvg.appendChild(renderChartTextSvg(doc, lbl));\n\t}\n\tfor (const lbl of vm.secondaryAxisLabels ?? []) {\n\t\tsvg.appendChild(renderChartTextSvg(doc, lbl));\n\t}\n\tif (vm.zeroLine) {\n\t\tsvg.appendChild(renderChartLineSvg(doc, vm.zeroLine));\n\t}\n\tfor (const lbl of vm.categoryLabels) {\n\t\tsvg.appendChild(renderChartTextSvg(doc, lbl));\n\t}\n\n\tappendChartLegendSvg(doc, svg, vm);\n\treturn svg;\n}\n","import type { PptxChartData } from 'pptx-viewer-core';\n/**\n * Pointer interaction for the oblique `bar3D` scene (`chart-3d-view-scene.ts`):\n * hover tooltip, click-to-select and drag-to-value on the WebGL boxes.\n *\n * The oblique scene draws each box's FRONT face exactly where the flat 2D\n * chart draws the bar (1 world unit = 1 authored chart px), so a value drag\n * reuses the 2D engine's own drag maths unchanged: `beginChartValueDrag` /\n * `advanceChartValueDrag` from `chart-canvas-drag.ts`, driven by the view\n * model the spec was built from. That keeps a 3D bar's drag identical to the\n * 2D bar's (same rounding, same axis range, same \"stacked marks are not\n * value-draggable\" rule).\n *\n * Picking casts its own ray instead of `Raycaster.setFromCamera`: the camera\n * carries a hand-inserted shear in its projection matrix, which\n * `setFromCamera`'s orthographic branch ignores (it always casts straight\n * down the camera's -Z). Unprojecting the near and far NDC points through the\n * full inverse projection gives the correctly sheared ray.\n *\n * @module chart-3d-oblique-interaction\n */\nimport type * as THREE from 'three';\n\nimport type { ThreeViewContext } from '../three-view/types';\nimport { buildBarChart3DHoverTooltip } from './bar-chart-3d-hit-test';\nimport { CHART_3D_DRAG_THRESHOLD_PX } from './chart-3d-interaction';\nimport type { Chart3DBarBox } from './chart-3d-spec';\nimport {\n\tadvanceChartValueDrag,\n\tbeginChartValueDrag,\n\tisChartInteractionArmed,\n} from './chart-canvas-drag';\nimport type { ChartValueDragState } from './chart-canvas-drag';\nimport { dragAnchorViewY } from './chart-interaction';\nimport type { ChartPartRef } from './chart-view-model';\nimport type { ChartViewModel } from './chart-view-model-types';\n\n/** Colour of the selected box's outline (matches the 2D selected-mark accent). */\nconst SELECTED_OUTLINE_COLOR = 0x2563eb;\n\nexport interface ObliqueBarInteractionOptions {\n\tctx: ThreeViewContext;\n\tcamera: THREE.Camera;\n\tmeshes: ReadonlyArray<THREE.Mesh>;\n\tboxes: ReadonlyArray<Chart3DBarBox>;\n\tvm: ChartViewModel;\n\tchartData: PptxChartData;\n\tcategoryLabels: ReadonlyArray<string>;\n\tseriesNames: ReadonlyArray<string>;\n\t/** Scene the selection outline is added to. */\n\tscene: THREE.Object3D;\n}\n\nexport interface ObliqueBarInteraction {\n\tsetInteractive: (on: boolean) => void;\n\tsetSelectedPart: (part: ChartPartRef | null) => void;\n\tdispose: () => void;\n}\n\ninterface PressState {\n\tpart: ChartPartRef | null;\n\tdrag: ChartValueDragState | null;\n\tstartX: number;\n\tstartY: number;\n\tlastValue: number | null;\n}\n\n/** Front-face rect of a box after a live drag to `value` (the bar's baseline edge stays put). */\nfunction draggedRect(\n\tbox: Chart3DBarBox,\n\tstate: ChartValueDragState,\n\tstartValue: number,\n\tvalue: number,\n): { y: number; h: number } {\n\tconst startY = dragAnchorViewY(startValue, state.drag, state.part.seriesIndex);\n\tconst base =\n\t\tMath.abs(startY - box.y) <= Math.abs(startY - (box.y + box.h)) ? box.y + box.h : box.y;\n\tconst valueY = dragAnchorViewY(value, state.drag, state.part.seriesIndex);\n\treturn { y: Math.min(base, valueY), h: Math.abs(base - valueY) };\n}\n\n/** Attach hover/select/drag to an oblique bar scene's boxes. */\nexport function attachObliqueBarInteraction(\n\toptions: ObliqueBarInteractionOptions,\n): ObliqueBarInteraction {\n\tconst { ctx, camera, meshes, boxes, vm, chartData } = options;\n\tconst three = ctx.three;\n\tconst target = ctx.eventTarget;\n\tconst raycaster = new three.Raycaster();\n\tconst far = new three.Vector3();\n\tlet interactive = ctx.interactive;\n\tlet press: PressState | null = null;\n\tlet hoveredTooltip: string | undefined;\n\n\tconst outline = new three.LineSegments(\n\t\tnew three.EdgesGeometry(new three.BoxGeometry(1, 1, 1)),\n\t\tnew three.LineBasicMaterial({ color: SELECTED_OUTLINE_COLOR }),\n\t);\n\toutline.visible = false;\n\toptions.scene.add(outline);\n\n\tfunction hitAt(clientX: number, clientY: number): THREE.Intersection | undefined {\n\t\tconst rect = target.getBoundingClientRect();\n\t\tif (rect.width <= 0 || rect.height <= 0) {\n\t\t\treturn undefined;\n\t\t}\n\t\t// World matrices are otherwise only refreshed by a render; a pointer\n\t\t// event can arrive before the first frame.\n\t\toptions.scene.updateMatrixWorld();\n\t\tcamera.updateMatrixWorld();\n\t\tconst x = ((clientX - rect.left) / rect.width) * 2 - 1;\n\t\tconst y = -((clientY - rect.top) / rect.height) * 2 + 1;\n\t\traycaster.ray.origin.set(x, y, -1).unproject(camera);\n\t\tfar.set(x, y, 1).unproject(camera);\n\t\traycaster.ray.direction.copy(far).sub(raycaster.ray.origin).normalize();\n\t\treturn raycaster.intersectObjects(meshes as THREE.Mesh[], false)[0];\n\t}\n\n\tfunction partOf(hit: THREE.Intersection | undefined): ChartPartRef | null {\n\t\tconst data = hit?.object.userData as\n\t\t\t| { seriesIndex?: number; categoryIndex?: number }\n\t\t\t| undefined;\n\t\tif (data?.seriesIndex === undefined || data.categoryIndex === undefined) {\n\t\t\treturn null;\n\t\t}\n\t\treturn { role: 'dataPoint', seriesIndex: data.seriesIndex, pointIndex: data.categoryIndex };\n\t}\n\n\tfunction indexOf(part: ChartPartRef | null): number {\n\t\tif (!part || part.role !== 'dataPoint') {\n\t\t\treturn -1;\n\t\t}\n\t\treturn boxes.findIndex(\n\t\t\t(b) => b.seriesIndex === part.seriesIndex && b.categoryIndex === part.pointIndex,\n\t\t);\n\t}\n\n\tfunction setSelectedPart(part: ChartPartRef | null): void {\n\t\tconst i = indexOf(part);\n\t\toutline.visible = i >= 0;\n\t\tif (i >= 0) {\n\t\t\toutline.position.copy(meshes[i].position);\n\t\t\toutline.scale.copy(meshes[i].scale);\n\t\t}\n\t\tctx.requestRender();\n\t}\n\n\t/** Resize box `i`'s mesh to a new front-face rect (live drag preview). */\n\tfunction applyRect(i: number, rect: { y: number; h: number }): void {\n\t\tconst mesh = meshes[i];\n\t\tconst h = Math.max(rect.h, 0.001);\n\t\tmesh.position.y = vm.svgHeight / 2 - (rect.y + rect.h / 2);\n\t\tmesh.scale.y = h;\n\t\tif (outline.visible) {\n\t\t\toutline.position.copy(mesh.position);\n\t\t\toutline.scale.copy(mesh.scale);\n\t\t}\n\t\tctx.requestRender();\n\t}\n\n\tconst onPointerMove = (event: PointerEvent): void => {\n\t\tif (press?.drag) {\n\t\t\tconst step = advanceChartValueDrag(\n\t\t\t\tpress.drag,\n\t\t\t\tevent.clientY,\n\t\t\t\ttarget.getBoundingClientRect().height,\n\t\t\t);\n\t\t\tif (step) {\n\t\t\t\tconst i = indexOf(press.drag.part);\n\t\t\t\tconst start = boxes[i]?.value ?? 0;\n\t\t\t\tif (i >= 0) {\n\t\t\t\t\tapplyRect(i, draggedRect(boxes[i], press.drag, start, step.value));\n\t\t\t\t}\n\t\t\t\tpress.lastValue = step.value;\n\t\t\t\tctx.emit({\n\t\t\t\t\ttype: 'drag',\n\t\t\t\t\tdetail: { part: press.drag.part, value: step.value, phase: 'move' },\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tconst hit = hitAt(event.clientX, event.clientY);\n\t\tconst data = hit?.object.userData as { seriesIndex: number; categoryIndex: number } | undefined;\n\t\tconst box = data ? boxes[indexOf(partOf(hit))] : undefined;\n\t\tconst tooltip = box\n\t\t\t? buildBarChart3DHoverTooltip(\n\t\t\t\t\t{ seriesIndex: box.seriesIndex, categoryIndex: box.categoryIndex, value: box.value },\n\t\t\t\t\t{\n\t\t\t\t\t\tcategoryLabels: options.categoryLabels,\n\t\t\t\t\t\tseriesNames: options.seriesNames,\n\t\t\t\t\t\tnumberFormats: chartData.series.map((s) => s.numberFormat),\n\t\t\t\t\t},\n\t\t\t\t)\n\t\t\t: undefined;\n\t\tif (tooltip !== hoveredTooltip) {\n\t\t\thoveredTooltip = tooltip;\n\t\t\ttarget.title = tooltip ?? '';\n\t\t}\n\t};\n\n\tconst onPointerDown = (event: PointerEvent): void => {\n\t\tif (!interactive) {\n\t\t\treturn;\n\t\t}\n\t\tconst part = partOf(hitAt(event.clientX, event.clientY));\n\t\tconst armed = part !== null && isChartInteractionArmed(target);\n\t\tif (armed) {\n\t\t\tevent.stopPropagation();\n\t\t}\n\t\tconst drag =\n\t\t\tarmed && part\n\t\t\t\t? beginChartValueDrag({ part, viewModel: vm, chartData, clientY: event.clientY })\n\t\t\t\t: null;\n\t\tif (drag) {\n\t\t\tevent.preventDefault();\n\t\t\t(target as { setPointerCapture?: (id: number) => void }).setPointerCapture?.(event.pointerId);\n\t\t}\n\t\tpress = { part, drag, startX: event.clientX, startY: event.clientY, lastValue: null };\n\t};\n\n\tconst onPointerUp = (event: PointerEvent): void => {\n\t\tconst current = press;\n\t\tpress = null;\n\t\tif (!current || !interactive) {\n\t\t\treturn;\n\t\t}\n\t\tif (current.drag?.moved && current.lastValue !== null) {\n\t\t\tctx.emit({\n\t\t\t\ttype: 'drag',\n\t\t\t\tdetail: { part: current.drag.part, value: current.lastValue, phase: 'commit' },\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tconst travel = Math.hypot(event.clientX - current.startX, event.clientY - current.startY);\n\t\tif (travel < CHART_3D_DRAG_THRESHOLD_PX) {\n\t\t\tctx.emit({ type: 'select', part: current.part });\n\t\t}\n\t};\n\n\tconst onPointerLeave = (): void => {\n\t\tif (hoveredTooltip !== undefined) {\n\t\t\thoveredTooltip = undefined;\n\t\t\ttarget.title = '';\n\t\t}\n\t};\n\n\ttarget.addEventListener('pointermove', onPointerMove);\n\ttarget.addEventListener('pointerdown', onPointerDown);\n\ttarget.addEventListener('pointerup', onPointerUp);\n\ttarget.addEventListener('pointerleave', onPointerLeave);\n\n\treturn {\n\t\tsetInteractive(on) {\n\t\t\tinteractive = on;\n\t\t\tif (!on) {\n\t\t\t\tpress = null;\n\t\t\t}\n\t\t},\n\t\tsetSelectedPart,\n\t\tdispose() {\n\t\t\ttarget.removeEventListener('pointermove', onPointerMove);\n\t\t\ttarget.removeEventListener('pointerdown', onPointerDown);\n\t\t\ttarget.removeEventListener('pointerup', onPointerUp);\n\t\t\ttarget.removeEventListener('pointerleave', onPointerLeave);\n\t\t\toutline.geometry.dispose();\n\t\t\t(outline.material as THREE.Material).dispose();\n\t\t\toutline.removeFromParent();\n\t\t},\n\t};\n}\n","import type { ChartPptxElement } from 'pptx-viewer-core';\n/**\n * `<pptx-three-view>` scene module for 3D charts.\n *\n * The oblique-projection family (`c:view3D/@rAngAx=1`, `bar3D`'s own\n * default; verified against `gt/chart-01.webp`) is drawn here. Everything\n * else (line3D/area3D/pie3D/surface3D, and bar3D's `standard` grouping, a\n * horizontal `c:barDir val=\"bar\"` or round shapes) has `geometry: null` and\n * mounts the matching perspective scene from `spec.perspective` (the\n * pre-`<pptx-three-view>` scenes, hosted on the shared renderer). Those are\n * not yet at PowerPoint parity; see `demos/demo-three-parity/README.md`.\n *\n * The oblique projection is built as a plain `OrthographicCamera` (1 world\n * unit = 1 authored chart px, matching `chart-3d-chrome-overlay.ts`'s\n * overlay `<svg>` viewBox exactly) with a SHEAR term hand-inserted into its\n * projection matrix, rather than tilting the camera or shearing the scene\n * graph: this keeps a future `OrbitControls` well-defined, since only the camera moves, and keeps every box's world\n * position/size meaningful on its own instead of encoding the illusion into\n * mesh transforms.\n *\n * @module chart-3d-view-scene\n */\nimport type * as THREE from 'three';\n\nimport type { ThreeViewContext, ThreeViewScene } from '../three-view/types';\nimport { createAreaChart3DScene } from './area-chart-3d-scene';\nimport { createBarChart3DScene } from './bar-chart-3d-scene';\nimport { buildChart3DBarMeshes } from './chart-3d-bar-mesh';\nimport { renderChart3DChromeOverlaySvg } from './chart-3d-chrome-overlay';\nimport { attachObliqueBarInteraction } from './chart-3d-oblique-interaction';\nimport type { Chart3DPerspectiveScene, Chart3DSpec } from './chart-3d-spec';\nimport { createLineChart3DScene } from './line-chart-3d-scene';\nimport { createPieChart3DScene } from './pie-chart-3d-scene';\nimport { createSurfaceChart3DScene } from './surface-chart-3d-scene';\n\n/**\n * The oblique chart camera. Camera distance is chosen so `NEAR`/`FAR` stay\n * tight around the scene's own (tiny) depth extent. Exported for tests.\n */\nexport function buildObliqueCamera(\n\tthree: ThreeModule,\n\tsvgWidth: number,\n\tsvgHeight: number,\n\tshearX: number,\n\tshearY: number,\n): THREE.OrthographicCamera {\n\tconst halfW = svgWidth / 2;\n\tconst halfH = svgHeight / 2;\n\tconst distance = halfW + halfH + 500;\n\tconst camera = new three.OrthographicCamera(-halfW, halfW, halfH, -halfH, 1, distance + 2000);\n\tcamera.position.set(0, 0, distance);\n\tcamera.lookAt(0, 0, 0);\n\tcamera.updateProjectionMatrix();\n\n\t// Hand-insert the oblique shear: clip_x += kX * ndcScaleX * world_z,\n\t// clip_y += kY * ndcScaleY * world_z (see the module doc + the chart\n\t// track's progress log for the sign derivation between the flat 2D\n\t// fallback's SVG-Y-down depth vector and this scene's world-Y-up frame:\n\t// X needs no flip (kX = -shearX), Y does (kY = +shearY)).\n\tconst m = camera.projectionMatrix.elements;\n\tconst ndcScaleX = m[0];\n\tconst ndcScaleY = m[5];\n\tm[8] = -shearX * ndcScaleX;\n\tm[9] = shearY * ndcScaleY;\n\t// The shear multiplies VIEW-space z, which is `-distance` at the chart's\n\t// front plane (world z = 0). Offset it so the front plane is unsheared\n\t// and lands exactly on the 2D layout; only depth behind it shifts.\n\tm[12] += m[8] * distance;\n\tm[13] += m[9] * distance;\n\tcamera.projectionMatrixInverse.copy(camera.projectionMatrix).invert();\n\treturn camera;\n}\n\ntype ThreeModule = typeof THREE;\n\n/** The hosted perspective scene for a spec whose oblique geometry is `null`. */\nfunction mountPerspectiveScene(\n\tperspective: Chart3DPerspectiveScene,\n\tctx: ThreeViewContext,\n): ThreeViewScene {\n\tswitch (perspective.kind) {\n\t\tcase 'bar':\n\t\t\treturn createBarChart3DScene(ctx, perspective.options);\n\t\tcase 'line':\n\t\t\treturn createLineChart3DScene(ctx, perspective.options);\n\t\tcase 'area':\n\t\t\treturn createAreaChart3DScene(ctx, perspective.options);\n\t\tcase 'pie':\n\t\t\treturn createPieChart3DScene(ctx, perspective.options);\n\t\tcase 'surface':\n\t\t\treturn createSurfaceChart3DScene(ctx, perspective.options);\n\t\tdefault: {\n\t\t\tconst exhaustive: never = perspective;\n\t\t\treturn exhaustive;\n\t\t}\n\t}\n}\n\nexport async function mountChart3DView(\n\tspec: Chart3DSpec,\n\tctx: ThreeViewContext,\n): Promise<ThreeViewScene> {\n\tif (spec.projection.mode !== 'oblique' || spec.geometry?.kind !== 'bar') {\n\t\tif (spec.perspective) {\n\t\t\treturn mountPerspectiveScene(spec.perspective, ctx);\n\t\t}\n\t\tthrow new Error(`no 3D chart scene for chartType=${spec.chartType}`);\n\t}\n\tconst three = ctx.three;\n\tconst { vm, geometry } = spec;\n\tconst chartData = (spec.element as ChartPptxElement).chartData;\n\tif (!chartData) {\n\t\tthrow new Error('3D chart spec without chart data');\n\t}\n\n\tconst camera = buildObliqueCamera(\n\t\tthree,\n\t\tvm.svgWidth,\n\t\tvm.svgHeight,\n\t\tspec.projection.shearX,\n\t\tspec.projection.shearY,\n\t);\n\n\tconst scene = new three.Scene();\n\tconst bars = buildChart3DBarMeshes(three, geometry.boxes, vm.svgWidth, vm.svgHeight);\n\tscene.add(bars.group);\n\n\tconst overlay = renderChart3DChromeOverlaySvg(ctx.document, vm);\n\tctx.overlay.appendChild(overlay);\n\n\tconst interaction = attachObliqueBarInteraction({\n\t\tctx,\n\t\tcamera,\n\t\tmeshes: bars.meshes,\n\t\tboxes: geometry.boxes,\n\t\tvm,\n\t\tchartData,\n\t\tcategoryLabels: spec.categoryLabels,\n\t\tseriesNames: chartData.series.map((series) => series.name),\n\t\tscene,\n\t});\n\n\tlet disposed = false;\n\treturn {\n\t\trender(renderer: THREE.WebGLRenderer) {\n\t\t\trenderer.render(scene, camera);\n\t\t},\n\t\tresize() {\n\t\t\t// The orthographic frustum is fixed in authored chart-px units\n\t\t\t// (svgWidth/svgHeight), independent of the element's on-screen CSS\n\t\t\t// size, so nothing needs recomputing here.\n\t\t},\n\t\tisAnimating: () => false,\n\t\tsetInteractive: (on) => interaction.setInteractive(on),\n\t\tsetSelectedPart: (part) => interaction.setSelectedPart(part),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,KAAK,CAAC;IAErB,MAAM,OAAO,GAAG,6BAA6B,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC;AAC/D,IAAA,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC;IAEhC,MAAM,WAAW,GAAG,2BAA2B,CAAC;QAC/C,GAAG;QACH,MAAM;QACN,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,KAAK,EAAE,QAAQ,CAAC,KAAK;QACrB,EAAE;QACF,SAAS;QACT,cAAc,EAAE,IAAI,CAAC,cAAc;AACnC,QAAA,WAAW,EAAE,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,IAAI,CAAC;QAC1D,KAAK;AACL,KAAA,CAAC;IAEF,IAAI,QAAQ,GAAG,KAAK;IACpB,OAAO;AACN,QAAA,MAAM,CAAC,QAA6B,EAAA;AACnC,YAAA,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC;QAC/B,CAAC;QACD,MAAM,GAAA;;;;QAIN,CAAC;AACD,QAAA,WAAW,EAAE,MAAM,KAAK;QACxB,cAAc,EAAE,CAAC,EAAE,KAAK,WAAW,CAAC,cAAc,CAAC,EAAE,CAAC;QACtD,eAAe,EAAE,CAAC,IAAI,KAAK,WAAW,CAAC,eAAe,CAAC,IAAI,CAAC;QAC5D,OAAO,GAAA;YACN,IAAI,QAAQ,EAAE;gBACb;YACD;YACA,QAAQ,GAAG,IAAI;YACf,WAAW,CAAC,OAAO,EAAE;YACrB,IAAI,CAAC,OAAO,EAAE;YACd,OAAO,CAAC,MAAM,EAAE;QACjB,CAAC;KACD;AACF;;"}
|
|
1
|
+
{"version":3,"file":"pptx-angular-viewer-chart-3d-view-scene-CFWKnfML.mjs","sources":["../../src/internal/shared-src/render/chart-3d-shading.ts","../../src/internal/shared-src/render/chart-3d-bar-mesh.ts","../../src/internal/shared-src/render/chart-3d-chrome-overlay.ts","../../src/internal/shared-src/render/chart-3d-oblique-interaction.ts","../../src/internal/shared-src/render/chart-3d-view-scene.ts"],"sourcesContent":["/**\n * chart-3d-shading.ts: PowerPoint's flat chart-space shading for a 3D chart's\n * box faces, as one colour multiplier per named face.\n *\n * PowerPoint's 3D charts (bar3D, pie3D, line3D ribbons, area3D slabs, surface\n * bands) are flat-shaded in \"chart space\": every face of a given orientation\n * gets the SAME multiplier applied to the mark's base colour, regardless of\n * the chart's `c:view3D` tilt. Measured directly off the pixels of\n * `gt/chart-01.webp` (a 3-D Clustered Column, series 1 = theme accent1\n * `#156082`): the front (camera-facing) rect samples the base colour exactly\n * (`front = base`), the top face samples ~0.75x, and the visible side face\n * ~0.64x. `back`/`left` (mirrors of `right`) and `bottom` (rarely visible)\n * are not independently measured; `back`/`left` reuse the measured side\n * multiplier and `bottom` is a reasonable approximation between side and a\n * fully unlit face.\n *\n * @module chart-3d-shading\n */\nimport { shade } from './chart-palette';\n\n/** A box mesh's six face orientations, in the chart's own (unrotated) local frame. */\nexport type Chart3DFace = 'front' | 'back' | 'top' | 'bottom' | 'left' | 'right';\n\n/**\n * Darken amount (0-1, `chart-palette.ts#shade`'s `amount`) per face,\n * derived from the measured multipliers: `amount = 1 - multiplier`.\n */\nconst FACE_SHADE_AMOUNT: Record<Chart3DFace, number> = {\n\tfront: 0,\n\ttop: 0.25,\n\tright: 0.36,\n\tleft: 0.36,\n\tback: 0.36,\n\tbottom: 0.5,\n};\n\n/** Apply PowerPoint's measured per-face flat shading to a mark's base colour. */\nexport function shadeChart3DFace(baseColor: string, face: Chart3DFace): string {\n\tconst amount = FACE_SHADE_AMOUNT[face];\n\treturn amount === 0 ? baseColor : shade(baseColor, amount);\n}\n\n/**\n * The six face colours for a box mesh, in the order three.js `BoxGeometry`\n * expects its `material` array (`[+x, -x, +y, -y, +z, -z]`): right, left,\n * top, bottom, front, back. `front`/`back` name whichever world axis the\n * scene treats as the camera-facing depth axis; the caller picks that\n * mapping (see `chart-3d-view-scene.ts`).\n */\nexport function buildChart3DBoxFaceColors(\n\tbaseColor: string,\n): readonly [string, string, string, string, string, string] {\n\treturn [\n\t\tshadeChart3DFace(baseColor, 'right'),\n\t\tshadeChart3DFace(baseColor, 'left'),\n\t\tshadeChart3DFace(baseColor, 'top'),\n\t\tshadeChart3DFace(baseColor, 'bottom'),\n\t\tshadeChart3DFace(baseColor, 'front'),\n\t\tshadeChart3DFace(baseColor, 'back'),\n\t];\n}\n","/**\n * Build the real WebGL box meshes for a `bar3D` chart's `Chart3DBarGeometry`\n * (see `chart-3d-spec.ts`). Split out of `chart-3d-view-scene.ts` to keep\n * that file within the repo's ~300-LOC limit.\n *\n * Every box is positioned so its FRONT face (world Z=0) sits exactly where\n * the flat 2D fallback's front-face rectangle would be drawn, in \"1 world\n * unit = 1 authored chart px\" coordinates matching `chart-3d-chrome-overlay.ts`'s\n * overlay `<svg>` viewBox. The box then extrudes backward (negative Z) by its\n * own depth, so the oblique camera's shear (`chart-3d-view-scene.ts`) shifts\n * only the BACK face, reproducing the same silhouette the flat 2D depth pass\n * draws as a hand-built parallelogram (`chart-3d-depth.ts#barExtrusion`).\n *\n * Only `PptxBar3DShape === 'box'` reaches this module today\n * (`chart-3d-spec.ts#isSupportedBoxShape` gates everything else out at the\n * spec level), so every box gets flat, per-face-group `MeshBasicMaterial`s\n * (no lights involved: PowerPoint's box faces are flat-shaded in chart\n * space, not lit) built from `chart-3d-shading.ts`'s measured multipliers.\n *\n * @module chart-3d-bar-mesh\n */\nimport type * as THREE from 'three';\n\nimport { buildChart3DBoxFaceColors } from './chart-3d-shading';\nimport type { Chart3DBarBox } from './chart-3d-spec';\n\ntype ThreeModule = typeof THREE;\n\nexport interface Chart3DBarMeshResult {\n\tgroup: THREE.Group;\n\t/** One mesh per box, same order as `boxes`; carries `{ seriesIndex, categoryIndex }` in `userData`. */\n\tmeshes: THREE.Mesh[];\n\tdispose: () => void;\n}\n\n/**\n * Build one `THREE.Mesh` per box and add them to a new `THREE.Group`. World\n * coordinates: X/Y centred on the chart's own `svgWidth`/`svgHeight` (X\n * right, Y UP - the SVG Y-down front rect is flipped here), Z=0 at the\n * front face, extending negative (away from the camera) by the box's own\n * depth.\n */\nexport function buildChart3DBarMeshes(\n\tthree: ThreeModule,\n\tboxes: ReadonlyArray<Chart3DBarBox>,\n\tsvgWidth: number,\n\tsvgHeight: number,\n): Chart3DBarMeshResult {\n\tconst group = new three.Group();\n\tconst meshes: THREE.Mesh[] = [];\n\tconst geometries: THREE.BufferGeometry[] = [];\n\tconst materials: THREE.Material[] = [];\n\tconst halfW = svgWidth / 2;\n\tconst halfH = svgHeight / 2;\n\n\tfor (const box of boxes) {\n\t\tconst geometry = new three.BoxGeometry(1, 1, 1);\n\t\tgeometries.push(geometry);\n\t\tconst faceMaterials = buildChart3DBoxFaceColors(box.color).map(\n\t\t\t(color) => new three.MeshBasicMaterial({ color }),\n\t\t);\n\t\tmaterials.push(...faceMaterials);\n\n\t\tconst mesh = new three.Mesh(geometry, faceMaterials);\n\t\tconst zDepth = box.depthMagnitude;\n\t\tmesh.position.set(box.x + box.w / 2 - halfW, halfH - (box.y + box.h / 2), -zDepth / 2);\n\t\tmesh.scale.set(box.w, box.h, zDepth);\n\t\tmesh.userData = { seriesIndex: box.seriesIndex, categoryIndex: box.categoryIndex };\n\t\tgroup.add(mesh);\n\t\tmeshes.push(mesh);\n\t}\n\n\treturn {\n\t\tgroup,\n\t\tmeshes,\n\t\tdispose: () => {\n\t\t\tfor (const geometry of geometries) {\n\t\t\t\tgeometry.dispose();\n\t\t\t}\n\t\t\tfor (const material of materials) {\n\t\t\t\tmaterial.dispose();\n\t\t\t}\n\t\t},\n\t};\n}\n","/**\n * chart-3d-chrome-overlay.ts: the SVG \"chrome\" (chart-area fill/border,\n * title, legend, value-axis gridlines/ticks, category labels) a 3D chart\n * scene draws OVER its WebGL canvas via `ctx.overlay`.\n *\n * PowerPoint's own 3D charts always show this chrome exactly like the 2D\n * chart does (see the parity brief's \"hybrid rendering\" requirement); for a\n * chart in the oblique (`rAngAx=1`) projection family this chrome is\n * ALREADY pixel-correct in the flat 2D `ChartViewModel` (verified against\n * `gt/chart-01.webp`: axes/gridlines/title/legend sit exactly where a plain\n * 2D chart would put them, perfectly undistorted), so this module reuses the\n * SAME `chart-view-model-dom.ts` piece-renderers the 2D/vanilla projector\n * uses, just WITHOUT `vm.primitives`/`vm.dataLabels` (the flat oblique\n * bars/extrusion polygons, replaced by real WebGL geometry).\n *\n * @module chart-3d-chrome-overlay\n */\nimport {\n\tappendChartLegendSvg,\n\trenderChartLineSvg,\n\trenderChartTextSvg,\n} from './chart-view-model-dom';\nimport { createSvgEl } from './chart-view-model-dom-helpers';\nimport type { ChartViewModel } from './chart-view-model-types';\n\n/**\n * Render a `ChartViewModel`'s chrome (everything except data marks) to an\n * `<svg>` sized to `vm.svgWidth` x `vm.svgHeight`, matching the WebGL\n * scene's own world-unit convention (1 world unit = 1 authored chart px) so\n * an element positioned from the same view-model's rects lines up exactly.\n */\nexport function renderChart3DChromeOverlaySvg(doc: Document, vm: ChartViewModel): SVGSVGElement {\n\tconst svg = createSvgEl(doc, 'svg', {\n\t\tclass: 'pptxv-chart-3d-chrome',\n\t\tviewBox: `0 0 ${vm.svgWidth} ${vm.svgHeight}`,\n\t\tpreserveAspectRatio: 'none',\n\t});\n\tsvg.style.setProperty('width', '100%');\n\tsvg.style.setProperty('height', '100%');\n\tsvg.style.setProperty('display', 'block');\n\tsvg.style.setProperty('position', 'absolute');\n\tsvg.style.setProperty('inset', '0');\n\t// The WebGL canvas paints the marks; this overlay only adds chrome on top\n\t// of them, so pointer events must fall through to the canvas underneath.\n\tsvg.style.setProperty('pointer-events', 'none');\n\n\tif (vm.areaFill) {\n\t\tsvg.appendChild(\n\t\t\tcreateSvgEl(doc, 'rect', {\n\t\t\t\tx: 0,\n\t\t\t\ty: 0,\n\t\t\t\twidth: vm.svgWidth,\n\t\t\t\theight: vm.svgHeight,\n\t\t\t\trx: vm.areaRadius,\n\t\t\t\tfill: vm.areaFill,\n\t\t\t}),\n\t\t);\n\t}\n\n\tif (vm.title) {\n\t\tconst title = createSvgEl(doc, 'text', {\n\t\t\tx: vm.titleX,\n\t\t\ty: vm.titleY,\n\t\t\t'text-anchor': 'middle',\n\t\t\t'font-size': vm.titleStyle?.fontSize ?? 12,\n\t\t\t'font-weight': vm.titleStyle?.fontWeight ?? 600,\n\t\t\t'font-family': vm.titleStyle?.fontFamily,\n\t\t\tfill: vm.titleStyle?.fill ?? '#1e293b',\n\t\t\t'data-chart-part': 'title',\n\t\t});\n\t\tif (vm.titleRunSpans && vm.titleRunSpans.length > 0) {\n\t\t\tfor (const run of vm.titleRunSpans) {\n\t\t\t\tconst tspan = createSvgEl(doc, 'tspan', {\n\t\t\t\t\t'font-size': run.fontSize,\n\t\t\t\t\t'font-weight': run.fontWeight,\n\t\t\t\t\t'font-style': run.fontStyle,\n\t\t\t\t\t'font-family': run.fontFamily,\n\t\t\t\t\tfill: run.fill,\n\t\t\t\t});\n\t\t\t\ttspan.textContent = run.text;\n\t\t\t\ttitle.appendChild(tspan);\n\t\t\t}\n\t\t} else {\n\t\t\ttitle.textContent = vm.title;\n\t\t}\n\t\tsvg.appendChild(title);\n\t}\n\n\tfor (const gl of vm.gridlines) {\n\t\tsvg.appendChild(renderChartLineSvg(doc, gl));\n\t}\n\tfor (const gl of vm.secondaryGridlines ?? []) {\n\t\tsvg.appendChild(renderChartLineSvg(doc, gl));\n\t}\n\tfor (const lbl of vm.axisLabels) {\n\t\tsvg.appendChild(renderChartTextSvg(doc, lbl));\n\t}\n\tfor (const lbl of vm.secondaryAxisLabels ?? []) {\n\t\tsvg.appendChild(renderChartTextSvg(doc, lbl));\n\t}\n\tif (vm.zeroLine) {\n\t\tsvg.appendChild(renderChartLineSvg(doc, vm.zeroLine));\n\t}\n\tfor (const lbl of vm.categoryLabels) {\n\t\tsvg.appendChild(renderChartTextSvg(doc, lbl));\n\t}\n\n\tappendChartLegendSvg(doc, svg, vm);\n\treturn svg;\n}\n","import type { PptxChartData } from 'pptx-viewer-core';\n/**\n * Pointer interaction for the oblique `bar3D` scene (`chart-3d-view-scene.ts`):\n * hover tooltip, click-to-select and drag-to-value on the WebGL boxes.\n *\n * The oblique scene draws each box's FRONT face exactly where the flat 2D\n * chart draws the bar (1 world unit = 1 authored chart px), so a value drag\n * reuses the 2D engine's own drag maths unchanged: `beginChartValueDrag` /\n * `advanceChartValueDrag` from `chart-canvas-drag.ts`, driven by the view\n * model the spec was built from. That keeps a 3D bar's drag identical to the\n * 2D bar's (same rounding, same axis range, same \"stacked marks are not\n * value-draggable\" rule).\n *\n * Picking casts its own ray instead of `Raycaster.setFromCamera`: the camera\n * carries a hand-inserted shear in its projection matrix, which\n * `setFromCamera`'s orthographic branch ignores (it always casts straight\n * down the camera's -Z). Unprojecting the near and far NDC points through the\n * full inverse projection gives the correctly sheared ray.\n *\n * @module chart-3d-oblique-interaction\n */\nimport type * as THREE from 'three';\n\nimport type { ThreeViewContext } from '../three-view/types';\nimport { buildBarChart3DHoverTooltip } from './bar-chart-3d-hit-test';\nimport { CHART_3D_DRAG_THRESHOLD_PX } from './chart-3d-interaction';\nimport type { Chart3DBarBox } from './chart-3d-spec';\nimport {\n\tadvanceChartValueDrag,\n\tbeginChartValueDrag,\n\tisChartInteractionArmed,\n} from './chart-canvas-drag';\nimport type { ChartValueDragState } from './chart-canvas-drag';\nimport { dragAnchorViewY } from './chart-interaction';\nimport type { ChartPartRef } from './chart-view-model';\nimport type { ChartViewModel } from './chart-view-model-types';\n\n/** Colour of the selected box's outline (matches the 2D selected-mark accent). */\nconst SELECTED_OUTLINE_COLOR = 0x2563eb;\n\nexport interface ObliqueBarInteractionOptions {\n\tctx: ThreeViewContext;\n\tcamera: THREE.Camera;\n\tmeshes: ReadonlyArray<THREE.Mesh>;\n\tboxes: ReadonlyArray<Chart3DBarBox>;\n\tvm: ChartViewModel;\n\tchartData: PptxChartData;\n\tcategoryLabels: ReadonlyArray<string>;\n\tseriesNames: ReadonlyArray<string>;\n\t/** Scene the selection outline is added to. */\n\tscene: THREE.Object3D;\n}\n\nexport interface ObliqueBarInteraction {\n\tsetInteractive: (on: boolean) => void;\n\tsetSelectedPart: (part: ChartPartRef | null) => void;\n\tdispose: () => void;\n}\n\ninterface PressState {\n\tpart: ChartPartRef | null;\n\tdrag: ChartValueDragState | null;\n\tstartX: number;\n\tstartY: number;\n\tlastValue: number | null;\n}\n\n/** Front-face rect of a box after a live drag to `value` (the bar's baseline edge stays put). */\nfunction draggedRect(\n\tbox: Chart3DBarBox,\n\tstate: ChartValueDragState,\n\tstartValue: number,\n\tvalue: number,\n): { y: number; h: number } {\n\tconst startY = dragAnchorViewY(startValue, state.drag, state.part.seriesIndex);\n\tconst base =\n\t\tMath.abs(startY - box.y) <= Math.abs(startY - (box.y + box.h)) ? box.y + box.h : box.y;\n\tconst valueY = dragAnchorViewY(value, state.drag, state.part.seriesIndex);\n\treturn { y: Math.min(base, valueY), h: Math.abs(base - valueY) };\n}\n\n/** Attach hover/select/drag to an oblique bar scene's boxes. */\nexport function attachObliqueBarInteraction(\n\toptions: ObliqueBarInteractionOptions,\n): ObliqueBarInteraction {\n\tconst { ctx, camera, meshes, boxes, vm, chartData } = options;\n\tconst three = ctx.three;\n\tconst target = ctx.eventTarget;\n\tconst raycaster = new three.Raycaster();\n\tconst far = new three.Vector3();\n\tlet interactive = ctx.interactive;\n\tlet press: PressState | null = null;\n\tlet hoveredTooltip: string | undefined;\n\n\tconst outline = new three.LineSegments(\n\t\tnew three.EdgesGeometry(new three.BoxGeometry(1, 1, 1)),\n\t\tnew three.LineBasicMaterial({ color: SELECTED_OUTLINE_COLOR }),\n\t);\n\toutline.visible = false;\n\toptions.scene.add(outline);\n\n\tfunction hitAt(clientX: number, clientY: number): THREE.Intersection | undefined {\n\t\tconst rect = target.getBoundingClientRect();\n\t\tif (rect.width <= 0 || rect.height <= 0) {\n\t\t\treturn undefined;\n\t\t}\n\t\t// World matrices are otherwise only refreshed by a render; a pointer\n\t\t// event can arrive before the first frame.\n\t\toptions.scene.updateMatrixWorld();\n\t\tcamera.updateMatrixWorld();\n\t\tconst x = ((clientX - rect.left) / rect.width) * 2 - 1;\n\t\tconst y = -((clientY - rect.top) / rect.height) * 2 + 1;\n\t\traycaster.ray.origin.set(x, y, -1).unproject(camera);\n\t\tfar.set(x, y, 1).unproject(camera);\n\t\traycaster.ray.direction.copy(far).sub(raycaster.ray.origin).normalize();\n\t\treturn raycaster.intersectObjects(meshes as THREE.Mesh[], false)[0];\n\t}\n\n\tfunction partOf(hit: THREE.Intersection | undefined): ChartPartRef | null {\n\t\tconst data = hit?.object.userData as\n\t\t\t| { seriesIndex?: number; categoryIndex?: number }\n\t\t\t| undefined;\n\t\tif (data?.seriesIndex === undefined || data.categoryIndex === undefined) {\n\t\t\treturn null;\n\t\t}\n\t\treturn { role: 'dataPoint', seriesIndex: data.seriesIndex, pointIndex: data.categoryIndex };\n\t}\n\n\tfunction indexOf(part: ChartPartRef | null): number {\n\t\tif (!part || part.role !== 'dataPoint') {\n\t\t\treturn -1;\n\t\t}\n\t\treturn boxes.findIndex(\n\t\t\t(b) => b.seriesIndex === part.seriesIndex && b.categoryIndex === part.pointIndex,\n\t\t);\n\t}\n\n\tfunction setSelectedPart(part: ChartPartRef | null): void {\n\t\tconst i = indexOf(part);\n\t\toutline.visible = i >= 0;\n\t\tif (i >= 0) {\n\t\t\toutline.position.copy(meshes[i].position);\n\t\t\toutline.scale.copy(meshes[i].scale);\n\t\t}\n\t\tctx.requestRender();\n\t}\n\n\t/** Resize box `i`'s mesh to a new front-face rect (live drag preview). */\n\tfunction applyRect(i: number, rect: { y: number; h: number }): void {\n\t\tconst mesh = meshes[i];\n\t\tconst h = Math.max(rect.h, 0.001);\n\t\tmesh.position.y = vm.svgHeight / 2 - (rect.y + rect.h / 2);\n\t\tmesh.scale.y = h;\n\t\tif (outline.visible) {\n\t\t\toutline.position.copy(mesh.position);\n\t\t\toutline.scale.copy(mesh.scale);\n\t\t}\n\t\tctx.requestRender();\n\t}\n\n\tconst onPointerMove = (event: PointerEvent): void => {\n\t\tif (press?.drag) {\n\t\t\tconst step = advanceChartValueDrag(\n\t\t\t\tpress.drag,\n\t\t\t\tevent.clientY,\n\t\t\t\ttarget.getBoundingClientRect().height,\n\t\t\t);\n\t\t\tif (step) {\n\t\t\t\tconst i = indexOf(press.drag.part);\n\t\t\t\tconst start = boxes[i]?.value ?? 0;\n\t\t\t\tif (i >= 0) {\n\t\t\t\t\tapplyRect(i, draggedRect(boxes[i], press.drag, start, step.value));\n\t\t\t\t}\n\t\t\t\tpress.lastValue = step.value;\n\t\t\t\tctx.emit({\n\t\t\t\t\ttype: 'drag',\n\t\t\t\t\tdetail: { part: press.drag.part, value: step.value, phase: 'move' },\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tconst hit = hitAt(event.clientX, event.clientY);\n\t\tconst data = hit?.object.userData as { seriesIndex: number; categoryIndex: number } | undefined;\n\t\tconst box = data ? boxes[indexOf(partOf(hit))] : undefined;\n\t\tconst tooltip = box\n\t\t\t? buildBarChart3DHoverTooltip(\n\t\t\t\t\t{ seriesIndex: box.seriesIndex, categoryIndex: box.categoryIndex, value: box.value },\n\t\t\t\t\t{\n\t\t\t\t\t\tcategoryLabels: options.categoryLabels,\n\t\t\t\t\t\tseriesNames: options.seriesNames,\n\t\t\t\t\t\tnumberFormats: chartData.series.map((s) => s.numberFormat),\n\t\t\t\t\t},\n\t\t\t\t)\n\t\t\t: undefined;\n\t\tif (tooltip !== hoveredTooltip) {\n\t\t\thoveredTooltip = tooltip;\n\t\t\ttarget.title = tooltip ?? '';\n\t\t}\n\t};\n\n\tconst onPointerDown = (event: PointerEvent): void => {\n\t\tif (!interactive) {\n\t\t\treturn;\n\t\t}\n\t\tconst part = partOf(hitAt(event.clientX, event.clientY));\n\t\tconst armed = part !== null && isChartInteractionArmed(target);\n\t\tif (armed) {\n\t\t\tevent.stopPropagation();\n\t\t}\n\t\tconst drag =\n\t\t\tarmed && part\n\t\t\t\t? beginChartValueDrag({ part, viewModel: vm, chartData, clientY: event.clientY })\n\t\t\t\t: null;\n\t\tif (drag) {\n\t\t\tevent.preventDefault();\n\t\t\t(target as { setPointerCapture?: (id: number) => void }).setPointerCapture?.(event.pointerId);\n\t\t}\n\t\tpress = { part, drag, startX: event.clientX, startY: event.clientY, lastValue: null };\n\t};\n\n\tconst onPointerUp = (event: PointerEvent): void => {\n\t\tconst current = press;\n\t\tpress = null;\n\t\tif (!current || !interactive) {\n\t\t\treturn;\n\t\t}\n\t\tif (current.drag?.moved && current.lastValue !== null) {\n\t\t\tctx.emit({\n\t\t\t\ttype: 'drag',\n\t\t\t\tdetail: { part: current.drag.part, value: current.lastValue, phase: 'commit' },\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tconst travel = Math.hypot(event.clientX - current.startX, event.clientY - current.startY);\n\t\tif (travel < CHART_3D_DRAG_THRESHOLD_PX) {\n\t\t\tctx.emit({ type: 'select', part: current.part });\n\t\t}\n\t};\n\n\tconst onPointerLeave = (): void => {\n\t\tif (hoveredTooltip !== undefined) {\n\t\t\thoveredTooltip = undefined;\n\t\t\ttarget.title = '';\n\t\t}\n\t};\n\n\ttarget.addEventListener('pointermove', onPointerMove);\n\ttarget.addEventListener('pointerdown', onPointerDown);\n\ttarget.addEventListener('pointerup', onPointerUp);\n\ttarget.addEventListener('pointerleave', onPointerLeave);\n\n\treturn {\n\t\tsetInteractive(on) {\n\t\t\tinteractive = on;\n\t\t\tif (!on) {\n\t\t\t\tpress = null;\n\t\t\t}\n\t\t},\n\t\tsetSelectedPart,\n\t\tdispose() {\n\t\t\ttarget.removeEventListener('pointermove', onPointerMove);\n\t\t\ttarget.removeEventListener('pointerdown', onPointerDown);\n\t\t\ttarget.removeEventListener('pointerup', onPointerUp);\n\t\t\ttarget.removeEventListener('pointerleave', onPointerLeave);\n\t\t\toutline.geometry.dispose();\n\t\t\t(outline.material as THREE.Material).dispose();\n\t\t\toutline.removeFromParent();\n\t\t},\n\t};\n}\n","import type { ChartPptxElement } from 'pptx-viewer-core';\n/**\n * `<pptx-three-view>` scene module for 3D charts.\n *\n * The oblique-projection family (`c:view3D/@rAngAx=1`, `bar3D`'s own\n * default; verified against `gt/chart-01.webp`) is drawn here. Everything\n * else (line3D/area3D/pie3D/surface3D, and bar3D's `standard` grouping, a\n * horizontal `c:barDir val=\"bar\"` or round shapes) has `geometry: null` and\n * mounts the matching perspective scene from `spec.perspective` (the\n * pre-`<pptx-three-view>` scenes, hosted on the shared renderer). Those are\n * not yet at PowerPoint parity; see `demos/demo-three-parity/README.md`.\n *\n * The oblique projection is built as a plain `OrthographicCamera` (1 world\n * unit = 1 authored chart px, matching `chart-3d-chrome-overlay.ts`'s\n * overlay `<svg>` viewBox exactly) with a SHEAR term hand-inserted into its\n * projection matrix, rather than tilting the camera or shearing the scene\n * graph: this keeps a future `OrbitControls` well-defined, since only the camera moves, and keeps every box's world\n * position/size meaningful on its own instead of encoding the illusion into\n * mesh transforms.\n *\n * @module chart-3d-view-scene\n */\nimport type * as THREE from 'three';\n\nimport type { ThreeViewContext, ThreeViewScene } from '../three-view/types';\nimport { createAreaChart3DScene } from './area-chart-3d-scene';\nimport { createBarChart3DScene } from './bar-chart-3d-scene';\nimport { buildChart3DBarMeshes } from './chart-3d-bar-mesh';\nimport { renderChart3DChromeOverlaySvg } from './chart-3d-chrome-overlay';\nimport { attachObliqueBarInteraction } from './chart-3d-oblique-interaction';\nimport type { Chart3DPerspectiveScene, Chart3DSpec } from './chart-3d-spec';\nimport { createLineChart3DScene } from './line-chart-3d-scene';\nimport { createPieChart3DScene } from './pie-chart-3d-scene';\nimport { createSurfaceChart3DScene } from './surface-chart-3d-scene';\n\n/**\n * The oblique chart camera. Camera distance is chosen so `NEAR`/`FAR` stay\n * tight around the scene's own (tiny) depth extent. Exported for tests.\n */\nexport function buildObliqueCamera(\n\tthree: ThreeModule,\n\tsvgWidth: number,\n\tsvgHeight: number,\n\tshearX: number,\n\tshearY: number,\n): THREE.OrthographicCamera {\n\tconst halfW = svgWidth / 2;\n\tconst halfH = svgHeight / 2;\n\tconst distance = halfW + halfH + 500;\n\tconst camera = new three.OrthographicCamera(-halfW, halfW, halfH, -halfH, 1, distance + 2000);\n\tcamera.position.set(0, 0, distance);\n\tcamera.lookAt(0, 0, 0);\n\tcamera.updateProjectionMatrix();\n\n\t// Hand-insert the oblique shear: clip_x += kX * ndcScaleX * world_z,\n\t// clip_y += kY * ndcScaleY * world_z (see the module doc + the chart\n\t// track's progress log for the sign derivation between the flat 2D\n\t// fallback's SVG-Y-down depth vector and this scene's world-Y-up frame:\n\t// X needs no flip (kX = -shearX), Y does (kY = +shearY)).\n\tconst m = camera.projectionMatrix.elements;\n\tconst ndcScaleX = m[0];\n\tconst ndcScaleY = m[5];\n\tm[8] = -shearX * ndcScaleX;\n\tm[9] = shearY * ndcScaleY;\n\t// The shear multiplies VIEW-space z, which is `-distance` at the chart's\n\t// front plane (world z = 0). Offset it so the front plane is unsheared\n\t// and lands exactly on the 2D layout; only depth behind it shifts.\n\tm[12] += m[8] * distance;\n\tm[13] += m[9] * distance;\n\tcamera.projectionMatrixInverse.copy(camera.projectionMatrix).invert();\n\treturn camera;\n}\n\ntype ThreeModule = typeof THREE;\n\n/** The hosted perspective scene for a spec whose oblique geometry is `null`. */\nfunction mountPerspectiveScene(\n\tperspective: Chart3DPerspectiveScene,\n\tctx: ThreeViewContext,\n): ThreeViewScene {\n\tswitch (perspective.kind) {\n\t\tcase 'bar':\n\t\t\treturn createBarChart3DScene(ctx, perspective.options);\n\t\tcase 'line':\n\t\t\treturn createLineChart3DScene(ctx, perspective.options);\n\t\tcase 'area':\n\t\t\treturn createAreaChart3DScene(ctx, perspective.options);\n\t\tcase 'pie':\n\t\t\treturn createPieChart3DScene(ctx, perspective.options);\n\t\tcase 'surface':\n\t\t\treturn createSurfaceChart3DScene(ctx, perspective.options);\n\t\tdefault: {\n\t\t\tconst exhaustive: never = perspective;\n\t\t\treturn exhaustive;\n\t\t}\n\t}\n}\n\nexport async function mountChart3DView(\n\tspec: Chart3DSpec,\n\tctx: ThreeViewContext,\n): Promise<ThreeViewScene> {\n\tif (spec.projection.mode !== 'oblique' || spec.geometry?.kind !== 'bar') {\n\t\tif (spec.perspective) {\n\t\t\treturn mountPerspectiveScene(spec.perspective, ctx);\n\t\t}\n\t\tthrow new Error(`no 3D chart scene for chartType=${spec.chartType}`);\n\t}\n\tconst three = ctx.three;\n\tconst { vm, geometry } = spec;\n\tconst chartData = (spec.element as ChartPptxElement).chartData;\n\tif (!chartData) {\n\t\tthrow new Error('3D chart spec without chart data');\n\t}\n\n\tconst camera = buildObliqueCamera(\n\t\tthree,\n\t\tvm.svgWidth,\n\t\tvm.svgHeight,\n\t\tspec.projection.shearX,\n\t\tspec.projection.shearY,\n\t);\n\n\tconst scene = new three.Scene();\n\tconst bars = buildChart3DBarMeshes(three, geometry.boxes, vm.svgWidth, vm.svgHeight);\n\tscene.add(bars.group);\n\n\tconst overlay = renderChart3DChromeOverlaySvg(ctx.document, vm);\n\tctx.overlay.appendChild(overlay);\n\n\tconst interaction = attachObliqueBarInteraction({\n\t\tctx,\n\t\tcamera,\n\t\tmeshes: bars.meshes,\n\t\tboxes: geometry.boxes,\n\t\tvm,\n\t\tchartData,\n\t\tcategoryLabels: spec.categoryLabels,\n\t\tseriesNames: chartData.series.map((series) => series.name),\n\t\tscene,\n\t});\n\n\tlet disposed = false;\n\treturn {\n\t\trender(renderer: THREE.WebGLRenderer) {\n\t\t\trenderer.render(scene, camera);\n\t\t},\n\t\tresize() {\n\t\t\t// The orthographic frustum is fixed in authored chart-px units\n\t\t\t// (svgWidth/svgHeight), independent of the element's on-screen CSS\n\t\t\t// size, so nothing needs recomputing here.\n\t\t},\n\t\tisAnimating: () => false,\n\t\tsetInteractive: (on) => interaction.setInteractive(on),\n\t\tsetSelectedPart: (part) => interaction.setSelectedPart(part),\n\t\tdispose() {\n\t\t\tif (disposed) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tdisposed =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AE,EAAE,CAAC;AAC/D,IAAA,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC;IAEhC,MAAM,WAAW,GAAG,2BAA2B,CAAC;QAC/C,GAAG;QACH,MAAM;QACN,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,KAAK,EAAE,QAAQ,CAAC,KAAK;QACrB,EAAE;QACF,SAAS;QACT,cAAc,EAAE,IAAI,CAAC,cAAc;AACnC,QAAA,WAAW,EAAE,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,IAAI,CAAC;QAC1D,KAAK;AACL,KAAA,CAAC;IAEF,IAAI,QAAQ,GAAG,KAAK;IACpB,OAAO;AACN,QAAA,MAAM,CAAC,QAA6B,EAAA;AACnC,YAAA,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC;QAC/B,CAAC;QACD,MAAM,GAAA;;;;QAIN,CAAC;AACD,QAAA,WAAW,EAAE,MAAM,KAAK;QACxB,cAAc,EAAE,CAAC,EAAE,KAAK,WAAW,CAAC,cAAc,CAAC,EAAE,CAAC;QACtD,eAAe,EAAE,CAAC,IAAI,KAAK,WAAW,CAAC,eAAe,CAAC,IAAI,CAAC;QAC5D,OAAO,GAAA;YACN,IAAI,QAAQ,EAAE;gBACb;YACD;YACA,QAAQ,GAAG,IAAI;YACf,WAAW,CAAC,OAAO,EAAE;YACrB,IAAI,CAAC,OAAO,EAAE;YACd,OAAO,CAAC,MAAM,EAAE;QACjB,CAAC;KACD;AACF;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as toChatSummary } from './pptx-angular-viewer-pptx-angular-viewer-
|
|
1
|
+
import { t as toChatSummary } from './pptx-angular-viewer-pptx-angular-viewer-D3TADvW3.mjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* IndexedDB backend for {@link createChatHistoryStore}. Kept in its own module
|
|
@@ -103,4 +103,4 @@ function createIdbBackend(db) {
|
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
export { CHAT_STORE, createIdbBackend, openChatDb };
|
|
106
|
-
//# sourceMappingURL=pptx-angular-viewer-chat-history-idb-
|
|
106
|
+
//# sourceMappingURL=pptx-angular-viewer-chat-history-idb-D_SZnX0q.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pptx-angular-viewer-chat-history-idb-
|
|
1
|
+
{"version":3,"file":"pptx-angular-viewer-chat-history-idb-D_SZnX0q.mjs","sources":["../../src/internal/shared-src/ai/chat-history-idb.ts"],"sourcesContent":["/**\n * IndexedDB backend for {@link createChatHistoryStore}. Kept in its own module\n * so the localStorage fallback and the public factory stay within the per-file\n * size budget. Uses the raw IndexedDB API with tiny promise wrappers so no new\n * runtime dependency is pulled in.\n *\n * Every browser global is touched lazily from inside a function, never at module\n * load, so importing this file in a non-DOM environment (Node, SSR) never throws.\n */\n\nimport type { ChatBackend, PptxAiChatSummary, PptxAiStoredChat } from './chat-history-store';\nimport { toChatSummary } from './chat-history-store';\n\n/** Object store holding one record per chat, keyed by `id`. */\nexport const CHAT_STORE = 'chats';\n/** Index over the optional `deckId` key path, used for per-deck filtering. */\nconst DECK_INDEX = 'deckId';\n\n/** Resolve an `IDBRequest` to a promise. */\nfunction requestToPromise<T>(request: IDBRequest<T>): Promise<T> {\n\treturn new Promise<T>((resolve, reject) => {\n\t\trequest.onsuccess = () => resolve(request.result);\n\t\trequest.onerror = () => reject(request.error ?? new Error('IndexedDB request failed.'));\n\t});\n}\n\n/** Resolve when a transaction commits (or reject on error/abort). */\nfunction transactionDone(tx: IDBTransaction): Promise<void> {\n\treturn new Promise<void>((resolve, reject) => {\n\t\ttx.oncomplete = () => resolve();\n\t\ttx.onerror = () => reject(tx.error ?? new Error('IndexedDB transaction failed.'));\n\t\ttx.onabort = () => reject(tx.error ?? new Error('IndexedDB transaction aborted.'));\n\t});\n}\n\n/**\n * Open (and if needed create/upgrade) the chat database. Throws when there is no\n * `indexedDB` global so the caller can transparently fall back to localStorage.\n */\nexport function openChatDb(dbName: string): Promise<IDBDatabase> {\n\tconst idb = typeof indexedDB !== 'undefined' ? indexedDB : undefined;\n\tif (!idb) {\n\t\tthrow new Error('IndexedDB is not available in this environment.');\n\t}\n\treturn new Promise<IDBDatabase>((resolve, reject) => {\n\t\tconst open = idb.open(dbName, 1);\n\t\topen.onupgradeneeded = () => {\n\t\t\tconst db = open.result;\n\t\t\tif (!db.objectStoreNames.contains(CHAT_STORE)) {\n\t\t\t\tconst store = db.createObjectStore(CHAT_STORE, { keyPath: 'id' });\n\t\t\t\tstore.createIndex(DECK_INDEX, 'deckId', { unique: false });\n\t\t\t}\n\t\t};\n\t\topen.onsuccess = () => resolve(open.result);\n\t\topen.onerror = () => reject(open.error ?? new Error('Failed to open IndexedDB.'));\n\t\topen.onblocked = () => reject(new Error('IndexedDB open blocked by another connection.'));\n\t});\n}\n\n/** Read every stored chat (newest-first ordering is applied by the caller). */\nasync function readAll(db: IDBDatabase, deckId: string | undefined): Promise<PptxAiStoredChat[]> {\n\tconst tx = db.transaction(CHAT_STORE, 'readonly');\n\tconst store = tx.objectStore(CHAT_STORE);\n\tconst source =\n\t\tdeckId === undefined\n\t\t\t? store.getAll()\n\t\t\t: store.index(DECK_INDEX).getAll(IDBKeyRange.only(deckId));\n\tconst rows = await requestToPromise<PptxAiStoredChat[]>(source);\n\tawait transactionDone(tx);\n\treturn rows;\n}\n\n/** Create an IndexedDB-backed {@link ChatBackend}. */\nexport function createIdbBackend(db: IDBDatabase): ChatBackend {\n\treturn {\n\t\tasync list(deckId: string | undefined): Promise<PptxAiChatSummary[]> {\n\t\t\tconst rows = await readAll(db, deckId);\n\t\t\treturn rows.map(toChatSummary).sort((a, b) => b.updatedAt - a.updatedAt);\n\t\t},\n\t\tasync load(id: string): Promise<PptxAiStoredChat | null> {\n\t\t\tconst tx = db.transaction(CHAT_STORE, 'readonly');\n\t\t\tconst row = await requestToPromise<PptxAiStoredChat | undefined>(\n\t\t\t\ttx.objectStore(CHAT_STORE).get(id),\n\t\t\t);\n\t\t\tawait transactionDone(tx);\n\t\t\treturn row ?? null;\n\t\t},\n\t\tasync save(chat: PptxAiStoredChat): Promise<void> {\n\t\t\tconst tx = db.transaction(CHAT_STORE, 'readwrite');\n\t\t\ttx.objectStore(CHAT_STORE).put(chat);\n\t\t\tawait transactionDone(tx);\n\t\t},\n\t\tasync remove(id: string): Promise<void> {\n\t\t\tconst tx = db.transaction(CHAT_STORE, 'readwrite');\n\t\t\ttx.objectStore(CHAT_STORE).delete(id);\n\t\t\tawait transactionDone(tx);\n\t\t},\n\t\tasync clear(deckId: string | undefined): Promise<void> {\n\t\t\tconst tx = db.transaction(CHAT_STORE, 'readwrite');\n\t\t\tconst store = tx.objectStore(CHAT_STORE);\n\t\t\tif (deckId === undefined) {\n\t\t\t\tstore.clear();\n\t\t\t} else {\n\t\t\t\tconst ids = await requestToPromise<IDBValidKey[]>(\n\t\t\t\t\tstore.index(DECK_INDEX).getAllKeys(IDBKeyRange.only(deckId)),\n\t\t\t\t);\n\t\t\t\tfor (const id of ids) {\n\t\t\t\t\tstore.delete(id);\n\t\t\t\t}\n\t\t\t}\n\t\t\tawait transactionDone(tx);\n\t\t},\n\t};\n}\n"],"names":[],"mappings":";;AAAA;;;;;;;;AAQG;AAKH;AACO,MAAM,UAAU,GAAG;AAC1B;AACA,MAAM,UAAU,GAAG,QAAQ;AAE3B;AACA,SAAS,gBAAgB,CAAI,OAAsB,EAAA;IAClD,OAAO,IAAI,OAAO,CAAI,CAAC,OAAO,EAAE,MAAM,KAAI;AACzC,QAAA,OAAO,CAAC,SAAS,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC;AACjD,QAAA,OAAO,CAAC,OAAO,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,KAAK,IAAI,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;AACxF,IAAA,CAAC,CAAC;AACH;AAEA;AACA,SAAS,eAAe,CA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