@meonode/canvas 1.6.0 → 1.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/dist/cjs/canvas/canvas.helper.d.ts +20 -1
- package/dist/cjs/canvas/canvas.helper.d.ts.map +1 -1
- package/dist/cjs/canvas/canvas.helper.js +230 -0
- package/dist/cjs/canvas/canvas.helper.js.map +1 -1
- package/dist/cjs/canvas/canvas.type.d.ts +19 -8
- package/dist/cjs/canvas/canvas.type.d.ts.map +1 -1
- package/dist/cjs/canvas/chart.canvas.util.d.ts +2 -2
- package/dist/cjs/canvas/chart.canvas.util.d.ts.map +1 -1
- package/dist/cjs/canvas/chart.canvas.util.js +101 -26
- package/dist/cjs/canvas/chart.canvas.util.js.map +1 -1
- package/dist/cjs/canvas/grid.canvas.util.d.ts +3 -3
- package/dist/cjs/canvas/grid.canvas.util.d.ts.map +1 -1
- package/dist/cjs/canvas/grid.canvas.util.js.map +1 -1
- package/dist/cjs/canvas/image.canvas.util.d.ts +2 -2
- package/dist/cjs/canvas/image.canvas.util.d.ts.map +1 -1
- package/dist/cjs/canvas/image.canvas.util.js.map +1 -1
- package/dist/cjs/canvas/layout.canvas.util.d.ts +4 -4
- package/dist/cjs/canvas/layout.canvas.util.d.ts.map +1 -1
- package/dist/cjs/canvas/layout.canvas.util.js +1 -1
- package/dist/cjs/canvas/layout.canvas.util.js.map +1 -1
- package/dist/cjs/canvas/root.canvas.util.d.ts +3 -3
- package/dist/cjs/canvas/root.canvas.util.d.ts.map +1 -1
- package/dist/cjs/canvas/root.canvas.util.js +6 -4
- package/dist/cjs/canvas/root.canvas.util.js.map +1 -1
- package/dist/cjs/canvas/text.canvas.util.d.ts +2 -2
- package/dist/cjs/canvas/text.canvas.util.d.ts.map +1 -1
- package/dist/cjs/canvas/text.canvas.util.js +0 -1
- package/dist/cjs/canvas/text.canvas.util.js.map +1 -1
- package/dist/esm/canvas/canvas.helper.d.ts +20 -1
- package/dist/esm/canvas/canvas.helper.d.ts.map +1 -1
- package/dist/esm/canvas/canvas.helper.js +230 -1
- package/dist/esm/canvas/canvas.type.d.ts +19 -8
- package/dist/esm/canvas/canvas.type.d.ts.map +1 -1
- package/dist/esm/canvas/chart.canvas.util.d.ts +2 -2
- package/dist/esm/canvas/chart.canvas.util.d.ts.map +1 -1
- package/dist/esm/canvas/chart.canvas.util.js +102 -27
- package/dist/esm/canvas/grid.canvas.util.d.ts +3 -3
- package/dist/esm/canvas/grid.canvas.util.d.ts.map +1 -1
- package/dist/esm/canvas/image.canvas.util.d.ts +2 -2
- package/dist/esm/canvas/image.canvas.util.d.ts.map +1 -1
- package/dist/esm/canvas/layout.canvas.util.d.ts +4 -4
- package/dist/esm/canvas/layout.canvas.util.d.ts.map +1 -1
- package/dist/esm/canvas/layout.canvas.util.js +1 -1
- package/dist/esm/canvas/root.canvas.util.d.ts +3 -3
- package/dist/esm/canvas/root.canvas.util.d.ts.map +1 -1
- package/dist/esm/canvas/root.canvas.util.js +6 -4
- package/dist/esm/canvas/text.canvas.util.d.ts +2 -2
- package/dist/esm/canvas/text.canvas.util.d.ts.map +1 -1
- package/dist/esm/canvas/text.canvas.util.js +0 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.canvas.util.js","sources":["../../../../src/canvas/layout.canvas.util.ts"],"sourcesContent":["import { Canvas, type CanvasRenderingContext2D } from 'skia-canvas'\nimport { drawBorders, drawRoundedRectPath, parseBorderRadius, parsePercentage } from '@/canvas/canvas.helper.js'\nimport type { BaseProps, BoxProps, BoxShadowProps, NodeDescriptor } from '@/canvas/canvas.type.js'\nimport { omit } from 'lodash-es'\nimport tinycolor from 'tinycolor2'\nimport Yoga, { Style, Node } from '@/constant/common.const.js'\n\n/**\n * @class BoxNode\n * @classdesc Base node class for rendering rectangular boxes with layout, styling, and children.\n * It uses the Yoga layout engine for positioning and sizing.\n */\nexport class BoxNode {\n /**\n * @property {Partial<BoxProps>} initialProps - Original props passed to the constructor before any modifications.\n */\n initialProps: Partial<BoxProps>\n\n /**\n * @property {Node} node - The Yoga layout engine node.\n */\n node: Node\n\n /**\n * @property {BoxNode[]} children - Child nodes.\n */\n children: BoxNode[]\n\n /**\n * @property {BoxProps & BaseProps} props - Current props including defaults and inherited values.\n */\n props: BoxProps & BaseProps\n\n /**\n * @property {string} name - Node type name.\n */\n readonly name?: string\n\n /**\n * @property {string} key - Unique node identifier.\n */\n key?: string\n\n /**\n * Creates a new BoxNode instance\n * @param props Initial box properties and styling\n */\n constructor(props: BoxProps & BaseProps = {}) {\n const children = (Array.isArray(props?.children) ? props.children : [props.children]).filter(child => child)\n this.initialProps = { ...props, children }\n this.node = Yoga.Node.create()\n this.children = []\n\n this.props = {\n key: this.key,\n borderColor: 'black',\n borderStyle: Style.Border.Solid,\n boxSizing: Style.BoxSizing.BorderBox,\n opacity: 1,\n flexShrink: 1,\n ...this.initialProps,\n }\n this.name = this.props.name || 'Box'\n this.key = this.props.key || `${this.name}-0`\n\n this.setLayout(this.props)\n }\n\n /**\n * Processes and appends any children passed in the initial props.\n */\n public processInitialChildren() {\n if (this.props.children) {\n const childrenToAdd = Array.isArray(this.props.children) ? this.props.children : [this.props.children]\n childrenToAdd.forEach((child, index) => {\n if (child) {\n this.appendChild(child as BoxNode, index)\n }\n })\n }\n }\n\n /**\n * Inherits styles from the parent node.\n * @param {BoxProps & BaseProps} parentProps Parent node properties to inherit from.\n */\n protected resolveInheritedStyles(parentProps: BoxProps & BaseProps) {\n if (parentProps.key) {\n this.key = `${parentProps.key}-${this.key}`\n this.props.key = this.key\n }\n\n const inheritableKeys = [\n 'fontSize',\n 'fontFamily',\n 'fontWeight',\n 'fontStyle',\n 'color',\n 'textAlign',\n 'verticalAlign',\n 'lineHeight',\n 'lineGap',\n 'letterSpacing',\n 'wordSpacing',\n 'textDecoration',\n 'maxLines',\n 'fontVariant',\n ]\n\n for (const key of inheritableKeys) {\n if (this.initialProps[key] === undefined && parentProps[key] !== undefined) {\n this.props[key] = parentProps[key]\n }\n }\n\n if (!this.node.isDirty()) {\n this.node.markDirty()\n }\n }\n\n /**\n * Applies node type-specific default values after inheritance.\n */\n protected applyDefaults(): void {\n // Base implementation does nothing; subclasses can override.\n }\n\n /**\n * Appends a child node at the specified index.\n * @param {BoxNode} child Child node to append.\n * @param index Index to insert child at\n */\n protected appendChild(child: BoxNode, index: number) {\n if (!child || !child.node) {\n console.warn('Attempted to append an invalid child node.', child)\n return\n }\n\n child.resolveInheritedStyles(omit(this.props, 'children'))\n child.applyDefaults()\n this.children.push(child)\n this.node.insertChild(child.node, index)\n child.processInitialChildren()\n }\n\n /**\n * Performs final layout adjustments recursively after the main layout calculation.\n * @returns {boolean} Whether any node was marked as dirty during finalization.\n */\n public finalizeLayout(): boolean {\n let wasDirty = false\n this.updateLayoutBasedOnComputedSize()\n if (this.node.isDirty()) {\n wasDirty = true\n }\n\n for (const child of this.children) {\n child.finalizeLayout()\n if (child.node.isDirty()) {\n wasDirty = true\n }\n }\n\n return wasDirty\n }\n\n /**\n * Hook for subclasses to update layout based on computed size.\n */\n protected updateLayoutBasedOnComputedSize() {\n // Base implementation does nothing; subclasses can override.\n }\n\n /**\n * Applies layout properties to the Yoga node.\n * @param props Box properties containing layout values\n */\n protected setLayout(props: BoxProps) {\n // --- Yoga layout property application ---\n // (This entire block remains unchanged as it interacts with Yoga, not the canvas library)\n const {\n width,\n height,\n minWidth,\n minHeight,\n maxWidth,\n maxHeight,\n flexDirection,\n justifyContent,\n alignItems,\n alignSelf,\n alignContent,\n flexGrow,\n flexShrink,\n flexBasis,\n positionType,\n position,\n gap,\n margin,\n padding,\n border,\n aspectRatio,\n overflow,\n display,\n boxSizing = Style.BoxSizing.BorderBox,\n direction = Style.Direction.LTR,\n flexWrap,\n } = props\n\n if (width !== undefined) this.node.setWidth(width)\n if (height !== undefined) this.node.setHeight(height)\n if (minWidth !== undefined) this.node.setMinWidth(minWidth)\n if (minHeight !== undefined) this.node.setMinHeight(minHeight)\n if (maxWidth !== undefined) this.node.setMaxWidth(maxWidth)\n if (maxHeight !== undefined) this.node.setMaxHeight(maxHeight)\n if (flexDirection !== undefined) this.node.setFlexDirection(flexDirection)\n if (justifyContent !== undefined) this.node.setJustifyContent(justifyContent)\n if (alignItems !== undefined) this.node.setAlignItems(alignItems)\n if (alignSelf !== undefined) this.node.setAlignSelf(alignSelf)\n if (alignContent !== undefined) this.node.setAlignContent(alignContent)\n if (flexGrow !== undefined) this.node.setFlexGrow(flexGrow)\n if (flexShrink !== undefined) this.node.setFlexShrink(flexShrink)\n if (positionType !== undefined) this.node.setPositionType(positionType)\n if (flexBasis !== undefined) this.node.setFlexBasis(flexBasis)\n if (position) {\n if (typeof position === 'number') {\n this.node.setPosition(Style.Edge.All, position)\n } else if (typeof position === 'string' && position.endsWith('%')) {\n this.node.setPositionPercent(Style.Edge.All, parseFloat(position))\n } else {\n for (const [edge, value] of Object.entries(position)) {\n if (edge in Style.Edge) {\n if (typeof value === 'string' && value.endsWith('%')) {\n this.node.setPositionPercent(Style.Edge[edge], parseFloat(value))\n } else {\n this.node.setPosition(Style.Edge[edge], value as number)\n }\n }\n }\n }\n }\n if (gap) {\n if (typeof gap === 'number') {\n this.node.setGap(Style.Gutter.All, gap)\n } else if (typeof gap === 'string' && gap.endsWith('%')) {\n this.node.setGapPercent(Style.Gutter.All, parseFloat(gap))\n } else {\n for (const [gutter, value] of Object.entries(gap)) {\n if (gutter in Style.Gutter) {\n if (typeof value === 'string' && value.endsWith('%')) {\n this.node.setGapPercent(Style.Gutter[gutter], parseFloat(value))\n } else {\n this.node.setGap(Style.Gutter[gutter], value as number)\n }\n }\n }\n }\n }\n if (margin) {\n if (typeof margin === 'number' || margin === 'auto') {\n this.node.setMargin(Style.Edge.All, margin)\n } else if (typeof margin === 'string' && margin.endsWith('%')) {\n this.node.setMarginPercent(Style.Edge.All, parseFloat(margin))\n } else {\n for (const [edge, value] of Object.entries(margin)) {\n if (edge in Style.Edge) {\n if (typeof value === 'string' && value.endsWith('%')) {\n this.node.setMarginPercent(Style.Edge[edge], parseFloat(value))\n } else {\n this.node.setMargin(Style.Edge[edge], value as number)\n }\n }\n }\n }\n }\n if (padding) {\n if (typeof padding === 'number') {\n this.node.setPadding(Style.Edge.All, padding)\n } else if (typeof padding === 'string' && padding.endsWith('%')) {\n this.node.setPaddingPercent(Style.Edge.All, parseFloat(padding))\n } else {\n for (const [edge, value] of Object.entries(padding)) {\n if (edge in Style.Edge) {\n if (typeof value === 'string' && value.endsWith('%')) {\n this.node.setPaddingPercent(Style.Edge[edge], parseFloat(value))\n } else {\n this.node.setPadding(Style.Edge[edge], value as number)\n }\n }\n }\n }\n }\n if (border) {\n if (typeof border === 'number') {\n this.node.setBorder(Style.Edge.All, border)\n } else {\n for (const [edge, value] of Object.entries(border)) {\n if (edge in Style.Edge) this.node.setBorder(Style.Edge[edge], value)\n }\n }\n }\n if (aspectRatio !== undefined) this.node.setAspectRatio(aspectRatio)\n if (overflow !== undefined) this.node.setOverflow(overflow)\n if (display !== undefined) this.node.setDisplay(display)\n if (boxSizing !== undefined) this.node.setBoxSizing(boxSizing)\n if (direction !== undefined) this.node.setDirection(direction)\n if (flexWrap !== undefined) this.node.setFlexWrap(flexWrap)\n // --- End Yoga layout property application ---\n }\n\n /**\n * Renders the node and its children to the canvas.\n * @param {CanvasRenderingContext2D} ctx Canvas rendering context (from skia-canvas).\n * @param {number} offsetX X offset for rendering.\n * @param {number} offsetY Y offset for rendering.\n */\n render(ctx: CanvasRenderingContext2D, offsetX: number = 0, offsetY: number = 0) {\n const layout = this.node.getComputedLayout()\n const x = layout.left + offsetX\n const y = layout.top + offsetY\n const width = layout.width\n const height = layout.height\n\n // Exit early if the node is invisible or has no dimensions.\n if (width <= 0 || height <= 0 || this.props.display === Style.Display.None) {\n return\n }\n\n // --- Opacity Setup ---\n const desiredOpacity = Math.max(0, Math.min(1, this.props.opacity ?? 1))\n let originalAlpha: number | undefined = undefined\n let appliedOpacity = false\n if (desiredOpacity < 1) {\n originalAlpha = ctx.globalAlpha\n ctx.globalAlpha = originalAlpha * desiredOpacity\n appliedOpacity = true\n }\n // --- End Opacity Setup ---\n\n try {\n // --- Transformation Setup ---\n const transform = this.props.transform\n const needsTransform =\n transform && (transform.translateX || transform.translateY || transform.rotate || transform.scale || transform.scaleX || transform.scaleY)\n\n let savedContextForTransform = false\n if (needsTransform) {\n ctx.save()\n savedContextForTransform = true\n const originXRaw = transform.originX ?? '50%'\n const originYRaw = transform.originY ?? '50%'\n const originOffsetX = parsePercentage(originXRaw, width)\n const originOffsetY = parsePercentage(originYRaw, height)\n const originAbsX = x + originOffsetX\n const originAbsY = y + originOffsetY\n ctx.translate(originAbsX, originAbsY)\n if (transform.translateX || transform.translateY) {\n const tx = parsePercentage(transform.translateX, width)\n const ty = parsePercentage(transform.translateY, height)\n if (tx !== 0 || ty !== 0) ctx.translate(tx, ty)\n }\n if (transform.rotate) {\n ctx.rotate((transform.rotate * Math.PI) / 180)\n }\n if (transform.scale || transform.scaleX || transform.scaleY) {\n const scaleX = transform.scaleX ?? transform.scale ?? 1\n const scaleY = transform.scaleY ?? transform.scale ?? 1\n if (scaleX !== 1 || scaleY !== 1) ctx.scale(scaleX, scaleY)\n }\n ctx.translate(-originAbsX, -originAbsY)\n }\n // --- End Transformation Setup ---\n\n // --- Step 1: Render Parent Background/Borders/Content ---\n // This renders the current node's own visual appearance first.\n this._renderContent(ctx, x, y, width, height)\n\n // --- Step 2: Prepare Children for Stacking ---\n const positionedChildren: { node: BoxNode; zIndex: number; originalIndex: number }[] = []\n const inFlowChildren: BoxNode[] = []\n\n this.children.forEach((child, index) => {\n // Check if child participates in zIndex stacking\n if (child.props.positionType === Style.PositionType.Absolute && child.props.zIndex !== undefined) {\n positionedChildren.push({\n node: child,\n zIndex: child.props.zIndex,\n originalIndex: index, // Keep original order for tie-breaking\n })\n } else {\n inFlowChildren.push(child)\n }\n })\n\n // Sort positioned children by zIndex, then by original order\n positionedChildren.sort((a, b) => {\n return a.zIndex - b.zIndex || a.originalIndex - b.originalIndex\n })\n\n // --- Step 3: Handle Clipping (Applies before drawing children) ---\n let savedContextForClip = false\n if (this.props.overflow === Style.Overflow.Hidden && (width > 0 || height > 0)) {\n ctx.save()\n savedContextForClip = true\n const borderLeft = this.node.getComputedBorder(Style.Edge.Left)\n const borderTop = this.node.getComputedBorder(Style.Edge.Top)\n const borderRight = this.node.getComputedBorder(Style.Edge.Right)\n const borderBottom = this.node.getComputedBorder(Style.Edge.Bottom)\n const innerX = x + borderLeft\n const innerY = y + borderTop\n const innerWidth = Math.max(0, width - borderLeft - borderRight)\n const innerHeight = Math.max(0, height - borderTop - borderBottom)\n const outerRadii = parseBorderRadius(this.props.borderRadius)\n const innerRadii = {\n TopLeft: Math.max(0, outerRadii.TopLeft - Math.max(borderLeft, borderTop)),\n TopRight: Math.max(0, outerRadii.TopRight - Math.max(borderRight, borderTop)),\n BottomRight: Math.max(0, outerRadii.BottomRight - Math.max(borderRight, borderBottom)),\n BottomLeft: Math.max(0, outerRadii.BottomLeft - Math.max(borderLeft, borderBottom)),\n }\n if (innerWidth > 0 && innerHeight > 0) {\n drawRoundedRectPath(ctx, innerX, innerY, innerWidth, innerHeight, innerRadii)\n ctx.clip()\n } else {\n ctx.beginPath()\n ctx.rect(innerX, innerY, 0, 0)\n ctx.clip()\n }\n }\n // --- End Clipping Setup ---\n\n // --- Step 4: Render Children in Stacking Order ---\n\n // 4a: Render positioned children with negative zIndex\n for (const item of positionedChildren) {\n if (item.zIndex < 0) {\n // Pass parent's layout origin (x, y) as offset\n item.node.render(ctx, x, y)\n }\n }\n\n // 4b: Render in-flow children (recursively)\n for (const child of inFlowChildren) {\n // Pass parent's layout origin (x, y) as offset\n child.render(ctx, x, y)\n }\n\n // 4c: Render positioned children with zero or positive zIndex\n for (const item of positionedChildren) {\n if (item.zIndex >= 0) {\n // Pass parent's layout origin (x, y) as offset\n item.node.render(ctx, x, y)\n }\n }\n // --- End Child Rendering ---\n\n // --- Step 5: Restore Clipping Context ---\n if (savedContextForClip) {\n ctx.restore()\n }\n // --- End Clipping Restoration ---\n\n // --- Step 6: Restore Transformation Context ---\n if (savedContextForTransform) {\n ctx.restore()\n }\n // --- End Transformation Restoration ---\n } finally {\n // --- Opacity Restoration ---\n if (appliedOpacity && originalAlpha !== undefined) {\n ctx.globalAlpha = originalAlpha\n }\n // --- End Opacity Restoration ---\n }\n }\n\n /**\n * Renders the node's visual content including background fills, shadows, and borders.\n * This is an internal method used by the render() pipeline.\n * @param ctx The skia-canvas 2D rendering context to draw into\n * @param x The absolute x-coordinate where drawing should begin\n * @param y The absolute y-coordinate where drawing should begin\n * @param width The width of the content area to render\n * @param height The height of the content area to render\n */\n protected _renderContent(ctx: CanvasRenderingContext2D, x: number, y: number, width: number, height: number) {\n // Calculate border radius values for all corners\n const radii = { TopLeft: 0, TopRight: 0, BottomRight: 0, BottomLeft: 0 }\n if (this.props.borderRadius) {\n // Handle both number and object border radius specifications\n if (typeof this.props.borderRadius === 'number') {\n radii.TopLeft = radii.TopRight = radii.BottomRight = radii.BottomLeft = this.props.borderRadius\n } else {\n // Extract individual corner radii, defaulting to 0 if not specified\n radii.TopLeft = this.props.borderRadius.TopLeft ?? 0\n radii.TopRight = this.props.borderRadius.TopRight ?? 0\n radii.BottomRight = this.props.borderRadius.BottomRight ?? 0\n radii.BottomLeft = this.props.borderRadius.BottomLeft ?? 0\n }\n // Ensure all radii are non-negative\n radii.TopLeft = Math.max(0, radii.TopLeft)\n radii.TopRight = Math.max(0, radii.TopRight)\n radii.BottomRight = Math.max(0, radii.BottomRight)\n radii.BottomLeft = Math.max(0, radii.BottomLeft)\n }\n\n // Process shadow configurations\n let shadows: BoxShadowProps[] = []\n if (this.props.boxShadow) {\n shadows = Array.isArray(this.props.boxShadow) ? this.props.boxShadow : [this.props.boxShadow]\n }\n // Split shadows into outset (normal) and inset types\n const outsetShadows = shadows.filter(s => !s.inset)\n const insetShadows = shadows.filter(s => s.inset)\n\n // Determine if background is fully opaque for shadow optimization\n const backgroundColor = this.props.backgroundColor\n let isOpaque = false\n if (backgroundColor && !this.props.gradient) {\n const rgba = tinycolor(backgroundColor).toRgb()\n isOpaque = rgba && rgba.a === 1\n }\n\n // Render outset shadows if present\n if (outsetShadows.length > 0) {\n const subtractOffset = 0.75\n if (isOpaque) {\n // Optimized rendering path for opaque backgrounds\n ctx.save()\n ctx.fillStyle = 'black' // Shadow source color\n for (const shadow of outsetShadows) {\n ctx.shadowColor = shadow.color ?? 'black'\n ctx.shadowOffsetX = shadow.offsetX ?? 0\n ctx.shadowOffsetY = shadow.offsetY ?? 0\n ctx.shadowBlur = shadow.blur ?? Math.max(shadow.offsetX ?? 0, shadow.offsetY ?? 0)\n drawRoundedRectPath(ctx, x + subtractOffset / 2, y + subtractOffset / 2, width - subtractOffset, height - subtractOffset, radii)\n ctx.fill()\n }\n ctx.restore()\n } else {\n // Complex shadow rendering for transparent/gradient backgrounds\n let maxBlur = 0\n let maxOffsetX = 0\n let maxOffsetY = 0\n\n // Calculate maximum shadow extents\n for (const shadow of outsetShadows) {\n const currentOffsetX = shadow.offsetX ?? 0\n const currentOffsetY = shadow.offsetY ?? 0\n const currentBlur = shadow.blur ?? Math.max(currentOffsetX, currentOffsetY)\n maxBlur = Math.max(maxBlur, currentBlur)\n maxOffsetX = Math.max(maxOffsetX, Math.abs(currentOffsetX))\n maxOffsetY = Math.max(maxOffsetY, Math.abs(currentOffsetY))\n }\n\n // Calculate offscreen canvas size with padding for shadows\n const blurPaddingMultiplier = 2\n const shadowPadding = Math.ceil(maxBlur * blurPaddingMultiplier + Math.max(maxOffsetX, maxOffsetY))\n const offscreenWidth = Math.ceil(width + shadowPadding * 2)\n const offscreenHeight = Math.ceil(height + shadowPadding * 2)\n\n if (offscreenWidth > 0 && offscreenHeight > 0) {\n // Create temporary canvas for shadow composition\n const offscreenCanvas = new Canvas(offscreenWidth, offscreenHeight)\n const offCtx = offscreenCanvas.getContext('2d')\n offCtx.imageSmoothingEnabled = true\n offCtx.imageSmoothingQuality = 'high'\n const shapeOffsetX = shadowPadding\n const shapeOffsetY = shadowPadding\n\n // Render each shadow individually onto offscreen canvas\n for (const shadow of outsetShadows) {\n offCtx.save()\n const shadowOffsetX = shadow.offsetX ?? 0\n const shadowOffsetY = shadow.offsetY ?? 0\n const blur = shadow.blur ?? Math.max(shadowOffsetX, shadowOffsetY)\n offCtx.shadowColor = shadow.color ?? 'black'\n offCtx.shadowOffsetX = shadowOffsetX\n offCtx.shadowOffsetY = shadowOffsetY\n offCtx.shadowBlur = Math.max(0, blur)\n drawRoundedRectPath(\n offCtx,\n shapeOffsetX + subtractOffset / 2,\n shapeOffsetY + subtractOffset / 2,\n width - subtractOffset,\n height - subtractOffset,\n radii,\n )\n offCtx.fillStyle = 'rgba(0,0,0,1)'\n offCtx.fill()\n offCtx.restore()\n }\n\n // Cut out the shape from accumulated shadows\n offCtx.save()\n offCtx.globalCompositeOperation = 'destination-out'\n drawRoundedRectPath(offCtx, shapeOffsetX, shapeOffsetY, width, height, radii)\n offCtx.fillStyle = 'rgba(0,0,0,1)'\n offCtx.fill()\n offCtx.restore()\n\n // Composite shadow result onto main canvas\n ctx.drawImage(offscreenCanvas, x - shadowPadding, y - shadowPadding)\n }\n }\n }\n\n // Render background fill (solid color or gradient)\n // This logic uses standard context methods and remains unchanged.\n const hasFill = this.props.gradient || this.props.backgroundColor\n if (hasFill) {\n let fillStyle: string | CanvasGradient = this.props.backgroundColor || 'transparent'\n if (this.props.gradient) {\n const { type = 'linear', colors, direction = 'to-bottom' } = this.props.gradient\n let grad: CanvasGradient | null = null\n if (colors && colors.length > 0 && width > 0 && height > 0) {\n if (type === 'linear') {\n let x0 = 0,\n y0 = 0,\n x1 = 0,\n y1 = 0\n let directionIsValid = false\n if (Array.isArray(direction) && direction.length === 4) {\n ;[x0, y0, x1, y1] = direction\n directionIsValid = true\n } else if (typeof direction === 'string') {\n switch (direction.toLowerCase()) {\n case 'to-right':\n x0 = 0\n y0 = 0\n x1 = width\n y1 = 0\n directionIsValid = true\n break\n case 'to-left':\n x0 = width\n y0 = 0\n x1 = 0\n y1 = 0\n directionIsValid = true\n break\n case 'to-bottom':\n x0 = 0\n y0 = 0\n x1 = 0\n y1 = height\n directionIsValid = true\n break\n case 'to-top':\n x0 = 0\n y0 = height\n x1 = 0\n y1 = 0\n directionIsValid = true\n break\n case 'to-top-right':\n x0 = 0\n y0 = height\n x1 = width\n y1 = 0\n directionIsValid = true\n break\n case 'to-top-left':\n x0 = width\n y0 = height\n x1 = 0\n y1 = 0\n directionIsValid = true\n break\n case 'to-bottom-right':\n x0 = 0\n y0 = 0\n x1 = width\n y1 = height\n directionIsValid = true\n break\n case 'to-bottom-left':\n x0 = width\n y0 = 0\n x1 = 0\n y1 = height\n directionIsValid = true\n break\n }\n }\n if (directionIsValid) {\n grad = ctx.createLinearGradient(x + x0, y + y0, x + x1, y + y1)\n } else {\n console.warn(`[BoxNode ${this.key}] Invalid linear gradient direction:`, direction)\n }\n } else if (type === 'radial') {\n const centerX = x + width / 2\n const centerY = y + height / 2\n const r0 = 0\n const r1 = 0.5 * Math.sqrt(width * width + height * height)\n if (r1 > 0) {\n grad = ctx.createRadialGradient(centerX, centerY, r0, centerX, centerY, r1)\n }\n }\n if (grad) {\n colors.forEach((color, i) => {\n const stop = colors.length > 1 ? Math.max(0, Math.min(1, i / (colors.length - 1))) : 0.5\n grad!.addColorStop(stop, color)\n })\n fillStyle = grad\n } else {\n console.warn(`[BoxNode ${this.key}] Could not create ${type} gradient. Falling back to backgroundColor.`)\n }\n } else {\n if (!colors?.length) {\n console.warn(`[BoxNode ${this.key}] Gradient specified but no colors provided. Falling back to backgroundColor.`)\n } else {\n console.warn(`[BoxNode ${this.key}] Cannot draw gradient with zero width/height.`)\n }\n }\n }\n if (fillStyle && fillStyle !== 'transparent') {\n ctx.fillStyle = fillStyle\n drawRoundedRectPath(ctx, x, y, width, height, radii)\n ctx.fill()\n }\n }\n\n // Render inset shadows\n // This logic uses standard context methods and remains unchanged.\n if (insetShadows.length > 0) {\n for (const shadow of insetShadows) {\n ctx.save()\n const color = shadow.color ?? 'black'\n const shadowOffsetX = shadow.offsetX ?? 0\n const shadowOffsetY = shadow.offsetY ?? 0\n const blur = shadow.blur ?? Math.max(shadowOffsetX, shadowOffsetY)\n drawRoundedRectPath(ctx, x, y, width, height, radii)\n ctx.clip()\n ctx.shadowColor = color\n ctx.shadowOffsetX = shadowOffsetX\n ctx.shadowOffsetY = shadowOffsetY\n ctx.shadowBlur = blur\n ctx.lineWidth = 1 // Minimal line width for the stroke.\n ctx.strokeStyle = 'transparent' // Stroke color doesn't matter; only the shadow does.\n // Draw a slightly offset path *inside* the clip to generate the inset shadow.\n drawRoundedRectPath(ctx, x - shadowOffsetX, y - shadowOffsetY, width, height, radii)\n ctx.stroke() // The stroke generates the shadow inside the clipped area.\n ctx.restore()\n }\n }\n\n // Render border strokes\n // (This logic uses standard context methods via drawBorders helper and remains unchanged)\n drawBorders({\n ctx,\n node: this.node,\n x,\n y,\n width,\n height,\n radii,\n borderColor: this.props.borderColor,\n borderStyle: this.props.borderStyle,\n })\n }\n}\n\n/**\n * Normalizes children into a flat NodeDescriptor array, filtering falsy values.\n */\nfunction normalizeDescriptorChildren(children: BoxProps['children']): NodeDescriptor[] | undefined {\n if (children === undefined || children === null || children === false) return undefined\n const arr = (Array.isArray(children) ? children : [children]).filter(Boolean) as NodeDescriptor[]\n return arr.length > 0 ? arr : undefined\n}\n\n/**\n * Creates a new BoxNode instance.\n * @param {BoxProps} props Box properties and configuration.\n * @returns {BoxNode} New BoxNode instance.\n */\nexport const Box = ({ children, ...rest }: BoxProps): NodeDescriptor => ({\n __type: 'Box',\n props: rest,\n children: normalizeDescriptorChildren(children),\n})\n\n/**\n * @class ColumnNode\n * Node class for vertical column layout\n */\nexport class ColumnNode extends BoxNode {\n constructor(props: BoxProps & BaseProps = {}) {\n super({\n display: Style.Display.Flex,\n flexDirection: Style.FlexDirection.Column,\n flexShrink: 1,\n flexBasis: props.flexGrow === 1 ? 0 : undefined,\n ...props,\n })\n }\n}\n\n/**\n * Creates a new ColumnNode instance.\n * @param {BoxProps} props Column properties and configuration.\n * @returns {ColumnNode} New ColumnNode instance.\n */\nexport const Column = ({ children, ...rest }: BoxProps): NodeDescriptor => ({\n __type: 'Column',\n props: rest,\n children: normalizeDescriptorChildren(children),\n})\n\n/**\n * @class RowNode\n * @classdesc Node class for horizontal row layout.\n */\nexport class RowNode extends BoxNode {\n constructor(props: BoxProps & BaseProps = {}) {\n super({\n name: 'Row',\n display: Style.Display.Flex,\n flexDirection: Style.FlexDirection.Row,\n flexShrink: 1, // Default shrink for rows\n ...props,\n })\n }\n}\n\n/**\n * Creates a new RowNode instance.\n * @param {BoxProps} props Row properties and configuration.\n * @returns {RowNode} New RowNode instance.\n */\nexport const Row = ({ children, ...rest }: BoxProps): NodeDescriptor => ({\n __type: 'Row',\n props: rest,\n children: normalizeDescriptorChildren(children),\n})\n"],"names":["Yoga","Style","omit","parsePercentage","parseBorderRadius","drawRoundedRectPath","Canvas","drawBorders"],"mappings":";;;;;;;;;AAOA;;;;AAIG;MACU,OAAO,CAAA;AAClB;;AAEG;AACH,IAAA,YAAY;AAEZ;;AAEG;AACH,IAAA,IAAI;AAEJ;;AAEG;AACH,IAAA,QAAQ;AAER;;AAEG;AACH,IAAA,KAAK;AAEL;;AAEG;AACM,IAAA,IAAI;AAEb;;AAEG;AACH,IAAA,GAAG;AAEH;;;AAGG;AACH,IAAA,WAAA,CAAY,QAA8B,EAAE,EAAA;AAC1C,QAAA,MAAM,QAAQ,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,KAAK,CAAC,QAAQ,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,KAAK,IAAI,KAAK,CAAC;QAC5G,IAAI,CAAC,YAAY,GAAG,EAAE,GAAG,KAAK,EAAE,QAAQ,EAAE;QAC1C,IAAI,CAAC,IAAI,GAAGA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AAK,EAAE,IAAI;AACX,IAAA,QAAQ,EAAE,2BAA2B,CAAC,QAAQ,CAAC;AAChD,CAAA;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"layout.canvas.util.js","sources":["../../../../src/canvas/layout.canvas.util.ts"],"sourcesContent":["import { Canvas, type CanvasRenderingContext2D } from 'skia-canvas'\nimport { drawBorders, drawRoundedRectPath, parseBorderRadius, parsePercentage } from '@/canvas/canvas.helper.js'\nimport type { BaseProps, BoxProps, BoxShadowProps, CanvasElement } from '@/canvas/canvas.type.js'\nimport { omit } from 'lodash-es'\nimport tinycolor from 'tinycolor2'\nimport Yoga, { Style, Node } from '@/constant/common.const.js'\n\n/**\n * @class BoxNode\n * @classdesc Base node class for rendering rectangular boxes with layout, styling, and children.\n * It uses the Yoga layout engine for positioning and sizing.\n */\nexport class BoxNode {\n /**\n * @property {Partial<BoxProps>} initialProps - Original props passed to the constructor before any modifications.\n */\n initialProps: Partial<BoxProps>\n\n /**\n * @property {Node} node - The Yoga layout engine node.\n */\n node: Node\n\n /**\n * @property {BoxNode[]} children - Child nodes.\n */\n children: BoxNode[]\n\n /**\n * @property {BoxProps & BaseProps} props - Current props including defaults and inherited values.\n */\n props: BoxProps & BaseProps\n\n /**\n * @property {string} name - Node type name.\n */\n readonly name?: string\n\n /**\n * @property {string} key - Unique node identifier.\n */\n key?: string\n\n /**\n * Creates a new BoxNode instance\n * @param props Initial box properties and styling\n */\n constructor(props: BoxProps & BaseProps = {}) {\n const children = (Array.isArray(props?.children) ? props.children : [props.children]).filter(child => child)\n this.initialProps = { ...props, children }\n this.node = Yoga.Node.create()\n this.children = []\n\n this.props = {\n key: this.key,\n borderColor: 'black',\n borderStyle: Style.Border.Solid,\n boxSizing: Style.BoxSizing.BorderBox,\n opacity: 1,\n flexShrink: 1,\n ...this.initialProps,\n }\n this.name = this.props.name || 'Box'\n this.key = this.props.key || `${this.name}-0`\n\n this.setLayout(this.props)\n }\n\n /**\n * Processes and appends any children passed in the initial props.\n */\n public processInitialChildren() {\n if (this.props.children) {\n const childrenToAdd = Array.isArray(this.props.children) ? this.props.children : [this.props.children]\n childrenToAdd.forEach((child, index) => {\n if (child) {\n this.appendChild(child as BoxNode, index)\n }\n })\n }\n }\n\n /**\n * Inherits styles from the parent node.\n * @param {BoxProps & BaseProps} parentProps Parent node properties to inherit from.\n */\n protected resolveInheritedStyles(parentProps: BoxProps & BaseProps) {\n if (parentProps.key) {\n this.key = `${parentProps.key}-${this.key}`\n this.props.key = this.key\n }\n\n const inheritableKeys = [\n 'fontSize',\n 'fontFamily',\n 'fontWeight',\n 'fontStyle',\n 'color',\n 'textAlign',\n 'verticalAlign',\n 'lineHeight',\n 'lineGap',\n 'letterSpacing',\n 'wordSpacing',\n 'textDecoration',\n 'maxLines',\n 'fontVariant',\n ]\n\n for (const key of inheritableKeys) {\n if (this.initialProps[key] === undefined && parentProps[key] !== undefined) {\n this.props[key] = parentProps[key]\n }\n }\n\n if (!this.node.isDirty()) {\n this.node.markDirty()\n }\n }\n\n /**\n * Applies node type-specific default values after inheritance.\n */\n protected applyDefaults(): void {\n // Base implementation does nothing; subclasses can override.\n }\n\n /**\n * Appends a child node at the specified index.\n * @param {BoxNode} child Child node to append.\n * @param index Index to insert child at\n */\n protected appendChild(child: BoxNode, index: number) {\n if (!child || !child.node) {\n console.warn('Attempted to append an invalid child node.', child)\n return\n }\n\n child.resolveInheritedStyles(omit(this.props, 'children'))\n child.applyDefaults()\n this.children.push(child)\n this.node.insertChild(child.node, index)\n child.processInitialChildren()\n }\n\n /**\n * Performs final layout adjustments recursively after the main layout calculation.\n * @returns {boolean} Whether any node was marked as dirty during finalization.\n */\n public finalizeLayout(): boolean {\n let wasDirty = false\n this.updateLayoutBasedOnComputedSize()\n if (this.node.isDirty()) {\n wasDirty = true\n }\n\n for (const child of this.children) {\n child.finalizeLayout()\n if (child.node.isDirty()) {\n wasDirty = true\n }\n }\n\n return wasDirty\n }\n\n /**\n * Hook for subclasses to update layout based on computed size.\n */\n protected updateLayoutBasedOnComputedSize() {\n // Base implementation does nothing; subclasses can override.\n }\n\n /**\n * Applies layout properties to the Yoga node.\n * @param props Box properties containing layout values\n */\n protected setLayout(props: BoxProps) {\n // --- Yoga layout property application ---\n // (This entire block remains unchanged as it interacts with Yoga, not the canvas library)\n const {\n width,\n height,\n minWidth,\n minHeight,\n maxWidth,\n maxHeight,\n flexDirection,\n justifyContent,\n alignItems,\n alignSelf,\n alignContent,\n flexGrow,\n flexShrink,\n flexBasis,\n positionType,\n position,\n gap,\n margin,\n padding,\n border,\n aspectRatio,\n overflow,\n display,\n boxSizing = Style.BoxSizing.BorderBox,\n direction = Style.Direction.LTR,\n flexWrap,\n } = props\n\n if (width !== undefined) this.node.setWidth(width)\n if (height !== undefined) this.node.setHeight(height)\n if (minWidth !== undefined) this.node.setMinWidth(minWidth)\n if (minHeight !== undefined) this.node.setMinHeight(minHeight)\n if (maxWidth !== undefined) this.node.setMaxWidth(maxWidth)\n if (maxHeight !== undefined) this.node.setMaxHeight(maxHeight)\n if (flexDirection !== undefined) this.node.setFlexDirection(flexDirection)\n if (justifyContent !== undefined) this.node.setJustifyContent(justifyContent)\n if (alignItems !== undefined) this.node.setAlignItems(alignItems)\n if (alignSelf !== undefined) this.node.setAlignSelf(alignSelf)\n if (alignContent !== undefined) this.node.setAlignContent(alignContent)\n if (flexGrow !== undefined) this.node.setFlexGrow(flexGrow)\n if (flexShrink !== undefined) this.node.setFlexShrink(flexShrink)\n if (positionType !== undefined) this.node.setPositionType(positionType)\n if (flexBasis !== undefined) this.node.setFlexBasis(flexBasis)\n if (position) {\n if (typeof position === 'number') {\n this.node.setPosition(Style.Edge.All, position)\n } else if (typeof position === 'string' && position.endsWith('%')) {\n this.node.setPositionPercent(Style.Edge.All, parseFloat(position))\n } else {\n for (const [edge, value] of Object.entries(position)) {\n if (edge in Style.Edge) {\n if (typeof value === 'string' && value.endsWith('%')) {\n this.node.setPositionPercent(Style.Edge[edge], parseFloat(value))\n } else {\n this.node.setPosition(Style.Edge[edge], value as number)\n }\n }\n }\n }\n }\n if (gap) {\n if (typeof gap === 'number') {\n this.node.setGap(Style.Gutter.All, gap)\n } else if (typeof gap === 'string' && gap.endsWith('%')) {\n this.node.setGapPercent(Style.Gutter.All, parseFloat(gap))\n } else {\n for (const [gutter, value] of Object.entries(gap)) {\n if (gutter in Style.Gutter) {\n if (typeof value === 'string' && value.endsWith('%')) {\n this.node.setGapPercent(Style.Gutter[gutter], parseFloat(value))\n } else {\n this.node.setGap(Style.Gutter[gutter], value as number)\n }\n }\n }\n }\n }\n if (margin) {\n if (typeof margin === 'number' || margin === 'auto') {\n this.node.setMargin(Style.Edge.All, margin)\n } else if (typeof margin === 'string' && margin.endsWith('%')) {\n this.node.setMarginPercent(Style.Edge.All, parseFloat(margin))\n } else {\n for (const [edge, value] of Object.entries(margin)) {\n if (edge in Style.Edge) {\n if (typeof value === 'string' && value.endsWith('%')) {\n this.node.setMarginPercent(Style.Edge[edge], parseFloat(value))\n } else {\n this.node.setMargin(Style.Edge[edge], value as number)\n }\n }\n }\n }\n }\n if (padding) {\n if (typeof padding === 'number') {\n this.node.setPadding(Style.Edge.All, padding)\n } else if (typeof padding === 'string' && padding.endsWith('%')) {\n this.node.setPaddingPercent(Style.Edge.All, parseFloat(padding))\n } else {\n for (const [edge, value] of Object.entries(padding)) {\n if (edge in Style.Edge) {\n if (typeof value === 'string' && value.endsWith('%')) {\n this.node.setPaddingPercent(Style.Edge[edge], parseFloat(value))\n } else {\n this.node.setPadding(Style.Edge[edge], value as number)\n }\n }\n }\n }\n }\n if (border) {\n if (typeof border === 'number') {\n this.node.setBorder(Style.Edge.All, border)\n } else {\n for (const [edge, value] of Object.entries(border)) {\n if (edge in Style.Edge) this.node.setBorder(Style.Edge[edge], value)\n }\n }\n }\n if (aspectRatio !== undefined) this.node.setAspectRatio(aspectRatio)\n if (overflow !== undefined) this.node.setOverflow(overflow)\n if (display !== undefined) this.node.setDisplay(display)\n if (boxSizing !== undefined) this.node.setBoxSizing(boxSizing)\n if (direction !== undefined) this.node.setDirection(direction)\n if (flexWrap !== undefined) this.node.setFlexWrap(flexWrap)\n // --- End Yoga layout property application ---\n }\n\n /**\n * Renders the node and its children to the canvas.\n * @param {CanvasRenderingContext2D} ctx Canvas rendering context (from skia-canvas).\n * @param {number} offsetX X offset for rendering.\n * @param {number} offsetY Y offset for rendering.\n */\n render(ctx: CanvasRenderingContext2D, offsetX: number = 0, offsetY: number = 0) {\n const layout = this.node.getComputedLayout()\n const x = layout.left + offsetX\n const y = layout.top + offsetY\n const width = layout.width\n const height = layout.height\n\n // Exit early if the node is invisible or has no dimensions.\n if (width <= 0 || height <= 0 || this.props.display === Style.Display.None) {\n return\n }\n\n // --- Opacity Setup ---\n const desiredOpacity = Math.max(0, Math.min(1, this.props.opacity ?? 1))\n let originalAlpha: number | undefined = undefined\n let appliedOpacity = false\n if (desiredOpacity < 1) {\n originalAlpha = ctx.globalAlpha\n ctx.globalAlpha = originalAlpha * desiredOpacity\n appliedOpacity = true\n }\n // --- End Opacity Setup ---\n\n try {\n // --- Transformation Setup ---\n const transform = this.props.transform\n const needsTransform =\n transform && (transform.translateX || transform.translateY || transform.rotate || transform.scale || transform.scaleX || transform.scaleY)\n\n let savedContextForTransform = false\n if (needsTransform) {\n ctx.save()\n savedContextForTransform = true\n const originXRaw = transform.originX ?? '50%'\n const originYRaw = transform.originY ?? '50%'\n const originOffsetX = parsePercentage(originXRaw, width)\n const originOffsetY = parsePercentage(originYRaw, height)\n const originAbsX = x + originOffsetX\n const originAbsY = y + originOffsetY\n ctx.translate(originAbsX, originAbsY)\n if (transform.translateX || transform.translateY) {\n const tx = parsePercentage(transform.translateX, width)\n const ty = parsePercentage(transform.translateY, height)\n if (tx !== 0 || ty !== 0) ctx.translate(tx, ty)\n }\n if (transform.rotate) {\n ctx.rotate((transform.rotate * Math.PI) / 180)\n }\n if (transform.scale || transform.scaleX || transform.scaleY) {\n const scaleX = transform.scaleX ?? transform.scale ?? 1\n const scaleY = transform.scaleY ?? transform.scale ?? 1\n if (scaleX !== 1 || scaleY !== 1) ctx.scale(scaleX, scaleY)\n }\n ctx.translate(-originAbsX, -originAbsY)\n }\n // --- End Transformation Setup ---\n\n // --- Step 1: Render Parent Background/Borders/Content ---\n // This renders the current node's own visual appearance first.\n this._renderContent(ctx, x, y, width, height)\n\n // --- Step 2: Prepare Children for Stacking ---\n const positionedChildren: { node: BoxNode; zIndex: number; originalIndex: number }[] = []\n const inFlowChildren: BoxNode[] = []\n\n this.children.forEach((child, index) => {\n // Check if child participates in zIndex stacking\n if (child.props.positionType === Style.PositionType.Absolute && child.props.zIndex !== undefined) {\n positionedChildren.push({\n node: child,\n zIndex: child.props.zIndex,\n originalIndex: index, // Keep original order for tie-breaking\n })\n } else {\n inFlowChildren.push(child)\n }\n })\n\n // Sort positioned children by zIndex, then by original order\n positionedChildren.sort((a, b) => {\n return a.zIndex - b.zIndex || a.originalIndex - b.originalIndex\n })\n\n // --- Step 3: Handle Clipping (Applies before drawing children) ---\n let savedContextForClip = false\n if (this.props.overflow === Style.Overflow.Hidden && (width > 0 || height > 0)) {\n ctx.save()\n savedContextForClip = true\n const borderLeft = this.node.getComputedBorder(Style.Edge.Left)\n const borderTop = this.node.getComputedBorder(Style.Edge.Top)\n const borderRight = this.node.getComputedBorder(Style.Edge.Right)\n const borderBottom = this.node.getComputedBorder(Style.Edge.Bottom)\n const innerX = x + borderLeft\n const innerY = y + borderTop\n const innerWidth = Math.max(0, width - borderLeft - borderRight)\n const innerHeight = Math.max(0, height - borderTop - borderBottom)\n const outerRadii = parseBorderRadius(this.props.borderRadius)\n const innerRadii = {\n TopLeft: Math.max(0, outerRadii.TopLeft - Math.max(borderLeft, borderTop)),\n TopRight: Math.max(0, outerRadii.TopRight - Math.max(borderRight, borderTop)),\n BottomRight: Math.max(0, outerRadii.BottomRight - Math.max(borderRight, borderBottom)),\n BottomLeft: Math.max(0, outerRadii.BottomLeft - Math.max(borderLeft, borderBottom)),\n }\n if (innerWidth > 0 && innerHeight > 0) {\n drawRoundedRectPath(ctx, innerX, innerY, innerWidth, innerHeight, innerRadii)\n ctx.clip()\n } else {\n ctx.beginPath()\n ctx.rect(innerX, innerY, 0, 0)\n ctx.clip()\n }\n }\n // --- End Clipping Setup ---\n\n // --- Step 4: Render Children in Stacking Order ---\n\n // 4a: Render positioned children with negative zIndex\n for (const item of positionedChildren) {\n if (item.zIndex < 0) {\n // Pass parent's layout origin (x, y) as offset\n item.node.render(ctx, x, y)\n }\n }\n\n // 4b: Render in-flow children (recursively)\n for (const child of inFlowChildren) {\n // Pass parent's layout origin (x, y) as offset\n child.render(ctx, x, y)\n }\n\n // 4c: Render positioned children with zero or positive zIndex\n for (const item of positionedChildren) {\n if (item.zIndex >= 0) {\n // Pass parent's layout origin (x, y) as offset\n item.node.render(ctx, x, y)\n }\n }\n // --- End Child Rendering ---\n\n // --- Step 5: Restore Clipping Context ---\n if (savedContextForClip) {\n ctx.restore()\n }\n // --- End Clipping Restoration ---\n\n // --- Step 6: Restore Transformation Context ---\n if (savedContextForTransform) {\n ctx.restore()\n }\n // --- End Transformation Restoration ---\n } finally {\n // --- Opacity Restoration ---\n if (appliedOpacity && originalAlpha !== undefined) {\n ctx.globalAlpha = originalAlpha\n }\n // --- End Opacity Restoration ---\n }\n }\n\n /**\n * Renders the node's visual content including background fills, shadows, and borders.\n * This is an internal method used by the render() pipeline.\n * @param ctx The skia-canvas 2D rendering context to draw into\n * @param x The absolute x-coordinate where drawing should begin\n * @param y The absolute y-coordinate where drawing should begin\n * @param width The width of the content area to render\n * @param height The height of the content area to render\n */\n protected _renderContent(ctx: CanvasRenderingContext2D, x: number, y: number, width: number, height: number) {\n // Calculate border radius values for all corners\n const radii = { TopLeft: 0, TopRight: 0, BottomRight: 0, BottomLeft: 0 }\n if (this.props.borderRadius) {\n // Handle both number and object border radius specifications\n if (typeof this.props.borderRadius === 'number') {\n radii.TopLeft = radii.TopRight = radii.BottomRight = radii.BottomLeft = this.props.borderRadius\n } else {\n // Extract individual corner radii, defaulting to 0 if not specified\n radii.TopLeft = this.props.borderRadius.TopLeft ?? 0\n radii.TopRight = this.props.borderRadius.TopRight ?? 0\n radii.BottomRight = this.props.borderRadius.BottomRight ?? 0\n radii.BottomLeft = this.props.borderRadius.BottomLeft ?? 0\n }\n // Ensure all radii are non-negative\n radii.TopLeft = Math.max(0, radii.TopLeft)\n radii.TopRight = Math.max(0, radii.TopRight)\n radii.BottomRight = Math.max(0, radii.BottomRight)\n radii.BottomLeft = Math.max(0, radii.BottomLeft)\n }\n\n // Process shadow configurations\n let shadows: BoxShadowProps[] = []\n if (this.props.boxShadow) {\n shadows = Array.isArray(this.props.boxShadow) ? this.props.boxShadow : [this.props.boxShadow]\n }\n // Split shadows into outset (normal) and inset types\n const outsetShadows = shadows.filter(s => !s.inset)\n const insetShadows = shadows.filter(s => s.inset)\n\n // Determine if background is fully opaque for shadow optimization\n const backgroundColor = this.props.backgroundColor\n let isOpaque = false\n if (backgroundColor && !this.props.gradient) {\n const rgba = tinycolor(backgroundColor).toRgb()\n isOpaque = rgba && rgba.a === 1\n }\n\n // Render outset shadows if present\n if (outsetShadows.length > 0) {\n const subtractOffset = 0.75\n if (isOpaque) {\n // Optimized rendering path for opaque backgrounds\n ctx.save()\n ctx.fillStyle = 'black' // Shadow source color\n for (const shadow of outsetShadows) {\n ctx.shadowColor = shadow.color ?? 'black'\n ctx.shadowOffsetX = shadow.offsetX ?? 0\n ctx.shadowOffsetY = shadow.offsetY ?? 0\n ctx.shadowBlur = shadow.blur ?? Math.max(shadow.offsetX ?? 0, shadow.offsetY ?? 0)\n drawRoundedRectPath(ctx, x + subtractOffset / 2, y + subtractOffset / 2, width - subtractOffset, height - subtractOffset, radii)\n ctx.fill()\n }\n ctx.restore()\n } else {\n // Complex shadow rendering for transparent/gradient backgrounds\n let maxBlur = 0\n let maxOffsetX = 0\n let maxOffsetY = 0\n\n // Calculate maximum shadow extents\n for (const shadow of outsetShadows) {\n const currentOffsetX = shadow.offsetX ?? 0\n const currentOffsetY = shadow.offsetY ?? 0\n const currentBlur = shadow.blur ?? Math.max(currentOffsetX, currentOffsetY)\n maxBlur = Math.max(maxBlur, currentBlur)\n maxOffsetX = Math.max(maxOffsetX, Math.abs(currentOffsetX))\n maxOffsetY = Math.max(maxOffsetY, Math.abs(currentOffsetY))\n }\n\n // Calculate offscreen canvas size with padding for shadows\n const blurPaddingMultiplier = 2\n const shadowPadding = Math.ceil(maxBlur * blurPaddingMultiplier + Math.max(maxOffsetX, maxOffsetY))\n const offscreenWidth = Math.ceil(width + shadowPadding * 2)\n const offscreenHeight = Math.ceil(height + shadowPadding * 2)\n\n if (offscreenWidth > 0 && offscreenHeight > 0) {\n // Create temporary canvas for shadow composition\n const offscreenCanvas = new Canvas(offscreenWidth, offscreenHeight)\n const offCtx = offscreenCanvas.getContext('2d')\n offCtx.imageSmoothingEnabled = true\n offCtx.imageSmoothingQuality = 'high'\n const shapeOffsetX = shadowPadding\n const shapeOffsetY = shadowPadding\n\n // Render each shadow individually onto offscreen canvas\n for (const shadow of outsetShadows) {\n offCtx.save()\n const shadowOffsetX = shadow.offsetX ?? 0\n const shadowOffsetY = shadow.offsetY ?? 0\n const blur = shadow.blur ?? Math.max(shadowOffsetX, shadowOffsetY)\n offCtx.shadowColor = shadow.color ?? 'black'\n offCtx.shadowOffsetX = shadowOffsetX\n offCtx.shadowOffsetY = shadowOffsetY\n offCtx.shadowBlur = Math.max(0, blur)\n drawRoundedRectPath(\n offCtx,\n shapeOffsetX + subtractOffset / 2,\n shapeOffsetY + subtractOffset / 2,\n width - subtractOffset,\n height - subtractOffset,\n radii,\n )\n offCtx.fillStyle = 'rgba(0,0,0,1)'\n offCtx.fill()\n offCtx.restore()\n }\n\n // Cut out the shape from accumulated shadows\n offCtx.save()\n offCtx.globalCompositeOperation = 'destination-out'\n drawRoundedRectPath(offCtx, shapeOffsetX, shapeOffsetY, width, height, radii)\n offCtx.fillStyle = 'rgba(0,0,0,1)'\n offCtx.fill()\n offCtx.restore()\n\n // Composite shadow result onto main canvas\n ctx.drawImage(offscreenCanvas, x - shadowPadding, y - shadowPadding)\n }\n }\n }\n\n // Render background fill (solid color or gradient)\n // This logic uses standard context methods and remains unchanged.\n const hasFill = this.props.gradient || this.props.backgroundColor\n if (hasFill) {\n let fillStyle: string | CanvasGradient = this.props.backgroundColor || 'transparent'\n if (this.props.gradient) {\n const { type = 'linear', colors, direction = 'to-bottom' } = this.props.gradient\n let grad: CanvasGradient | null = null\n if (colors && colors.length > 0 && width > 0 && height > 0) {\n if (type === 'linear') {\n let x0 = 0,\n y0 = 0,\n x1 = 0,\n y1 = 0\n let directionIsValid = false\n if (Array.isArray(direction) && direction.length === 4) {\n ;[x0, y0, x1, y1] = direction\n directionIsValid = true\n } else if (typeof direction === 'string') {\n switch (direction.toLowerCase()) {\n case 'to-right':\n x0 = 0\n y0 = 0\n x1 = width\n y1 = 0\n directionIsValid = true\n break\n case 'to-left':\n x0 = width\n y0 = 0\n x1 = 0\n y1 = 0\n directionIsValid = true\n break\n case 'to-bottom':\n x0 = 0\n y0 = 0\n x1 = 0\n y1 = height\n directionIsValid = true\n break\n case 'to-top':\n x0 = 0\n y0 = height\n x1 = 0\n y1 = 0\n directionIsValid = true\n break\n case 'to-top-right':\n x0 = 0\n y0 = height\n x1 = width\n y1 = 0\n directionIsValid = true\n break\n case 'to-top-left':\n x0 = width\n y0 = height\n x1 = 0\n y1 = 0\n directionIsValid = true\n break\n case 'to-bottom-right':\n x0 = 0\n y0 = 0\n x1 = width\n y1 = height\n directionIsValid = true\n break\n case 'to-bottom-left':\n x0 = width\n y0 = 0\n x1 = 0\n y1 = height\n directionIsValid = true\n break\n }\n }\n if (directionIsValid) {\n grad = ctx.createLinearGradient(x + x0, y + y0, x + x1, y + y1)\n } else {\n console.warn(`[BoxNode ${this.key}] Invalid linear gradient direction:`, direction)\n }\n } else if (type === 'radial') {\n const centerX = x + width / 2\n const centerY = y + height / 2\n const r0 = 0\n const r1 = 0.5 * Math.sqrt(width * width + height * height)\n if (r1 > 0) {\n grad = ctx.createRadialGradient(centerX, centerY, r0, centerX, centerY, r1)\n }\n }\n if (grad) {\n colors.forEach((color, i) => {\n const stop = colors.length > 1 ? Math.max(0, Math.min(1, i / (colors.length - 1))) : 0.5\n grad!.addColorStop(stop, color)\n })\n fillStyle = grad\n } else {\n console.warn(`[BoxNode ${this.key}] Could not create ${type} gradient. Falling back to backgroundColor.`)\n }\n } else {\n if (!colors?.length) {\n console.warn(`[BoxNode ${this.key}] Gradient specified but no colors provided. Falling back to backgroundColor.`)\n } else {\n console.warn(`[BoxNode ${this.key}] Cannot draw gradient with zero width/height.`)\n }\n }\n }\n if (fillStyle && fillStyle !== 'transparent') {\n ctx.fillStyle = fillStyle\n drawRoundedRectPath(ctx, x, y, width, height, radii)\n ctx.fill()\n }\n }\n\n // Render inset shadows\n // This logic uses standard context methods and remains unchanged.\n if (insetShadows.length > 0) {\n for (const shadow of insetShadows) {\n ctx.save()\n const color = shadow.color ?? 'black'\n const shadowOffsetX = shadow.offsetX ?? 0\n const shadowOffsetY = shadow.offsetY ?? 0\n const blur = shadow.blur ?? Math.max(shadowOffsetX, shadowOffsetY)\n drawRoundedRectPath(ctx, x, y, width, height, radii)\n ctx.clip()\n ctx.shadowColor = color\n ctx.shadowOffsetX = shadowOffsetX\n ctx.shadowOffsetY = shadowOffsetY\n ctx.shadowBlur = blur\n ctx.lineWidth = 1 // Minimal line width for the stroke.\n ctx.strokeStyle = 'transparent' // Stroke color doesn't matter; only the shadow does.\n // Draw a slightly offset path *inside* the clip to generate the inset shadow.\n drawRoundedRectPath(ctx, x - shadowOffsetX, y - shadowOffsetY, width, height, radii)\n ctx.stroke() // The stroke generates the shadow inside the clipped area.\n ctx.restore()\n }\n }\n\n // Render border strokes\n // (This logic uses standard context methods via drawBorders helper and remains unchanged)\n drawBorders({\n ctx,\n node: this.node,\n x,\n y,\n width,\n height,\n radii,\n borderColor: this.props.borderColor,\n borderStyle: this.props.borderStyle,\n })\n }\n}\n\n/**\n * Normalizes children into a flat CanvasElement array, filtering falsy values.\n */\nfunction normalizeDescriptorChildren(children: BoxProps['children']): CanvasElement[] | undefined {\n if (children === undefined || children === null || children === false) return undefined\n const arr = (Array.isArray(children) ? children : [children]).filter(Boolean) as CanvasElement[]\n return arr.length > 0 ? arr : undefined\n}\n\n/**\n * Creates a new BoxNode instance.\n * @param {BoxProps} props Box properties and configuration.\n * @returns {BoxNode} New BoxNode instance.\n */\nexport const Box = ({ children, ...rest }: BoxProps): CanvasElement => ({\n __type: 'Box',\n props: rest,\n children: normalizeDescriptorChildren(children),\n})\n\n/**\n * @class ColumnNode\n * Node class for vertical column layout\n */\nexport class ColumnNode extends BoxNode {\n constructor(props: BoxProps & BaseProps = {}) {\n super({\n display: Style.Display.Flex,\n flexDirection: Style.FlexDirection.Column,\n flexShrink: 1,\n flexBasis: props.flexGrow === 1 ? 0 : undefined,\n ...props,\n })\n }\n}\n\n/**\n * Creates a new ColumnNode instance.\n * @param {BoxProps} props Column properties and configuration.\n * @returns {ColumnNode} New ColumnNode instance.\n */\nexport const Column = ({ children, ...rest }: BoxProps): CanvasElement => ({\n __type: 'Column',\n props: rest,\n children: normalizeDescriptorChildren(children),\n})\n\n/**\n * @class RowNode\n * @classdesc Node class for horizontal row layout.\n */\nexport class RowNode extends BoxNode {\n constructor(props: BoxProps & BaseProps = {}) {\n super({\n name: 'Row',\n display: Style.Display.Flex,\n flexDirection: Style.FlexDirection.Row,\n flexShrink: 1, // Default shrink for rows\n ...props,\n })\n }\n}\n\n/**\n * Creates a new RowNode instance.\n * @param {BoxProps} props Row properties and configuration.\n * @returns {RowNode} New RowNode instance.\n */\nexport const Row = ({ children, ...rest }: BoxProps): CanvasElement => ({\n __type: 'Row',\n props: rest,\n children: normalizeDescriptorChildren(children),\n})\n"],"names":["Yoga","Style","omit","parsePercentage","parseBorderRadius","drawRoundedRectPath","Canvas","drawBorders"],"mappings":";;;;;;;;;AAOA;;;;AAIG;MACU,OAAO,C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AAI;AACX,IAAA,QAAQ,EAAE,2BAA2B,CAAC,QAAQ,CAAC;AAChD,CAAA;AAED;;;AAGG;AACG,MAAO,OAAQ,SAAQ,OAAO,CAAA;AAClC,IAAA,WAAA,CAAY,QAA8B,EAAE,EAAA;AAC1C,QAAA,KAAK,CAAC;AACJ,YAAA,IAAI,EAAE,KAAK;AACX,YAAA,OAAO,EAAEA,kBAAK,CAAC,OAAO,CAAC,IAAI;AAC3B,YAAA,aAAa,EAAEA,kBAAK,CAAC,aAAa,CAAC,GAAG;YACtC,UAAU,EAAE,CAAC;AACb,YAAA,GAAG,KAAK;AACT,SAAA,CAAC;IACJ;AACD;AAED;;;;AAIG;AACI,MAAM,GAAG,GAAG,CAAC,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAY,MAAqB;AACtE,IAAA,MAAM,EAAE,KAAK;AACb,IAAA,KAAK,EAAE,IAAI;AACX,IAAA,QAAQ,EAAE,2BAA2B,CAAC,QAAQ,CAAC;AAChD,CAAA;;;;;;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Canvas } from 'skia-canvas';
|
|
2
2
|
import { ColumnNode, BoxNode } from '../canvas/layout.canvas.util.js';
|
|
3
|
-
import type { BaseProps, RootProps,
|
|
3
|
+
import type { BaseProps, RootProps, CanvasElement } from '../canvas/canvas.type.js';
|
|
4
4
|
export declare const _clearRegisteredFonts: () => void;
|
|
5
5
|
export interface CanvasEngineConfig {
|
|
6
6
|
/** Run rendering in worker threads to avoid blocking the event loop (default: true) */
|
|
@@ -14,11 +14,11 @@ export interface CanvasEngineConfig {
|
|
|
14
14
|
*/
|
|
15
15
|
export declare function configure(options: CanvasEngineConfig): void;
|
|
16
16
|
/**
|
|
17
|
-
* Converts a
|
|
17
|
+
* Converts a CanvasElement tree into actual BoxNode instances.
|
|
18
18
|
* Used both for non-worker rendering (inline tree building) and inside
|
|
19
19
|
* the render worker (reconstructing the tree from serialized descriptors).
|
|
20
20
|
*/
|
|
21
|
-
export declare function buildTree(descriptor:
|
|
21
|
+
export declare function buildTree(descriptor: CanvasElement): BoxNode;
|
|
22
22
|
/**
|
|
23
23
|
* Root node that manages the canvas rendering context and coordinates overall layout and drawing.
|
|
24
24
|
* Inherits from ColumnNode to provide vertical layout capabilities.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"root.canvas.util.d.ts","sourceRoot":"","sources":["../../../src/canvas/root.canvas.util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAA8C,MAAM,aAAa,CAAA;AAEhF,OAAO,EAAE,UAAU,EAAE,OAAO,EAAW,MAAM,gCAAgC,CAAA;AAC7E,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"root.canvas.util.d.ts","sourceRoot":"","sources":["../../../src/canvas/root.canvas.util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAA8C,MAAM,aAAa,CAAA;AAEhF,OAAO,EAAE,UAAU,EAAE,OAAO,EAAW,MAAM,gCAAgC,CAAA;AAC7E,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAkBlF,eAAO,MAAM,qBAAqB,YAEjC,CAAA;AAOD,MAAM,WAAW,kBAAkB;IACjC,uFAAuF;IACvF,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,2EAA2E;IAC3E,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,kBAAkB,QAMpD;AA4LD;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,UAAU,EAAE,aAAa,GAAG,OAAO,CAmB5D;AAED;;;GAGG;AACH,qBAAa,QAAS,SAAQ,UAAU;IACtC,6CAA6C;IAC7C,OAAO,CAAC,MAAM,CAAoB;IAClC,8CAA8C;IAC9C,OAAO,CAAC,GAAG,CAAwC;IACnD,4CAA4C;IAC5C,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAQ;IACpC,6CAA6C;IAC7C,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAQ;IACrC,4DAA4D;IAC5D,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAQ;IAE9B;;;;OAIG;gBACS,KAAK,EAAE,SAAS,GAAG,SAAS;IAoDxC;;;OAGG;IACH,OAAO,CAAC,iBAAiB;IAazB;;;;OAIG;IACG,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC;CA6ChC;AAED;;;;;;GAMG;AACH,eAAO,MAAM,IAAI,GAAU,OAAO,SAAS,KAAG,OAAO,CAAC,MAAM,CAS3D,CAAA"}
|
|
@@ -7,6 +7,7 @@ var text_canvas_util = require('./text.canvas.util.js');
|
|
|
7
7
|
var chart_canvas_util = require('./chart.canvas.util.js');
|
|
8
8
|
var grid_canvas_util = require('./grid.canvas.util.js');
|
|
9
9
|
var common_const = require('../constant/common.const.js');
|
|
10
|
+
var canvas_helper = require('./canvas.helper.js');
|
|
10
11
|
var path = require('node:path');
|
|
11
12
|
var fs = require('node:fs');
|
|
12
13
|
var node_os = require('node:os');
|
|
@@ -173,16 +174,17 @@ class WorkerPool {
|
|
|
173
174
|
}
|
|
174
175
|
}
|
|
175
176
|
render(props) {
|
|
177
|
+
const sanitizedProps = canvas_helper.WorkerPreProcessor.process(props);
|
|
176
178
|
return new Promise((resolve, reject) => {
|
|
177
179
|
const id = this.nextId++;
|
|
178
180
|
this.pending.set(id, { resolve: resolve, reject });
|
|
179
181
|
if (this.idle.length > 0) {
|
|
180
182
|
const worker = this.idle.pop();
|
|
181
|
-
const request = { type: 'render', taskId: id, props };
|
|
183
|
+
const request = { type: 'render', taskId: id, props: sanitizedProps };
|
|
182
184
|
worker.postMessage(request);
|
|
183
185
|
}
|
|
184
186
|
else {
|
|
185
|
-
this.queue.push({ id, props });
|
|
187
|
+
this.queue.push({ id, props: sanitizedProps });
|
|
186
188
|
}
|
|
187
189
|
});
|
|
188
190
|
}
|
|
@@ -203,7 +205,7 @@ class WorkerPool {
|
|
|
203
205
|
}
|
|
204
206
|
}
|
|
205
207
|
/**
|
|
206
|
-
* Converts a
|
|
208
|
+
* Converts a CanvasElement tree into actual BoxNode instances.
|
|
207
209
|
* Used both for non-worker rendering (inline tree building) and inside
|
|
208
210
|
* the render worker (reconstructing the tree from serialized descriptors).
|
|
209
211
|
*/
|
|
@@ -276,7 +278,7 @@ class RootNode extends layout_canvas_util.ColumnNode {
|
|
|
276
278
|
this.targetWidth = props.width;
|
|
277
279
|
this.targetHeight = props.height;
|
|
278
280
|
this.node.setWidth(this.targetWidth);
|
|
279
|
-
// Convert any
|
|
281
|
+
// Convert any CanvasElement children to actual BoxNode instances
|
|
280
282
|
if (this.props.children) {
|
|
281
283
|
const childArray = Array.isArray(this.props.children) ? this.props.children : [this.props.children];
|
|
282
284
|
this.props.children = childArray.map(child => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"root.canvas.util.js","sources":["../../../../src/canvas/root.canvas.util.ts"],"sourcesContent":["import { Canvas, FontLibrary, type CanvasRenderingContext2D } from 'skia-canvas'\nimport type { ExportFormat, ExportOptions, SaveOptions, RenderOptions } from 'skia-canvas'\nimport { ColumnNode, BoxNode, RowNode } from '@/canvas/layout.canvas.util.js'\nimport type { BaseProps, RootProps, NodeDescriptor } from '@/canvas/canvas.type.js'\nimport type { CanvasCallMethod, CallArgs, CallResult, WorkerCallRequest, WorkerResponse, WorkerRequest } from '@/canvas/worker.types.js'\nimport { ImageNode, type RenderImageCache } from '@/canvas/image.canvas.util.js'\nimport { TextNode } from '@/canvas/text.canvas.util.js'\nimport { ChartNode } from '@/canvas/chart.canvas.util.js'\nimport { GridNode, GridItemNode } from '@/canvas/grid.canvas.util.js'\nimport { Style } from '@/constant/common.const.js'\nimport * as path from 'node:path'\nimport * as fs from 'node:fs'\nimport { cpus } from 'node:os'\nimport { Worker } from 'node:worker_threads'\nimport { fileURLToPath } from 'node:url'\n\n/** Registry to track fonts that have already been loaded */\nconst registeredFonts = new Map<string, Set<string>>()\n\n// Exported for testing purposes only\nexport const _clearRegisteredFonts = () => {\n registeredFonts.clear()\n}\n\n/** Engine configuration */\nlet _workerMode = true\nlet _workerPoolSize = Math.max(1, cpus().length - 1)\nlet _workerPool: WorkerPool | null = null\n\nexport interface CanvasEngineConfig {\n /** Run rendering in worker threads to avoid blocking the event loop (default: true) */\n workerMode?: boolean\n /** Number of worker threads in the pool (default: os.cpus().length - 1) */\n workers?: number\n}\n\n/**\n * Configure the canvas rendering engine.\n * Call this once at application startup before rendering.\n */\nexport function configure(options: CanvasEngineConfig) {\n if (options.workerMode !== undefined) _workerMode = options.workerMode\n if (options.workers !== undefined) _workerPoolSize = options.workers\n if (_workerMode) {\n _workerPool = new WorkerPool(_workerPoolSize)\n }\n}\n\ninterface PendingTask {\n resolve: (value: unknown) => void\n reject: (err: Error) => void\n}\n\ninterface PoolRenderResult {\n buffer: Buffer\n canvasId: number\n workerIdx: number\n width: number\n height: number\n}\n\n/**\n * Proxies all skia-canvas Canvas APIs to a Canvas instance living inside a worker thread.\n * Sync methods (toBufferSync, toURLSync) return from a pre-encoded PNG buffer.\n * Async methods (toBuffer, toURL, toFile, getters) delegate to the worker.\n */\nclass WorkerCanvas {\n readonly width: number\n readonly height: number\n private readonly _buffer: Buffer // pre-encoded PNG for sync use\n private readonly _pool: WorkerPool\n private readonly _workerIdx: number\n private readonly _canvasId: number\n\n constructor(opts: PoolRenderResult & { pool: WorkerPool }) {\n this._buffer = opts.buffer\n this.width = opts.width\n this.height = opts.height\n this._pool = opts.pool\n this._workerIdx = opts.workerIdx\n this._canvasId = opts.canvasId\n }\n\n private _call<M extends CanvasCallMethod>(method: M, ...args: CallArgs<M>): Promise<CallResult<M>> {\n return this._pool.callOnCanvas(this._workerIdx, this._canvasId, method, args)\n }\n\n // --- Sync methods: return from pre-encoded PNG buffer ---\n\n toBufferSync(_format?: ExportFormat, _options?: ExportOptions): Buffer {\n return this._buffer\n }\n\n toURLSync(_format?: ExportFormat, _options?: ExportOptions): string {\n return `data:image/png;base64,${this._buffer.toString('base64')}`\n }\n\n // --- Async methods: delegate to worker ---\n\n toBuffer(format: ExportFormat, options?: ExportOptions): Promise<Buffer> {\n return this._call('toBuffer', format, options)\n }\n\n toURL(format: ExportFormat, options?: ExportOptions): Promise<string> {\n return this._call('toURL', format, options)\n }\n\n toFile(filename: string, options?: SaveOptions): Promise<void> {\n return this._call('toFile', filename, options)\n }\n\n /** Returns a Buffer (Sharp instance cannot be transferred across threads) */\n toSharp(options?: RenderOptions): Promise<Buffer> {\n return this._call('toSharp', options)\n }\n\n toSharpSync(_options?: RenderOptions): never {\n throw new Error('[canvas] toSharpSync() is not available in worker mode — use toSharp() instead')\n }\n\n // --- Async convenience getters ---\n\n get png(): Promise<Buffer> {\n return this._call('toBuffer', 'png')\n }\n get webp(): Promise<Buffer> {\n return this._call('toBuffer', 'webp')\n }\n get jpg(): Promise<Buffer> {\n return this._call('toBuffer', 'jpg')\n }\n get svg(): Promise<Buffer> {\n return this._call('toBuffer', 'svg')\n }\n get pdf(): Promise<Buffer> {\n return this._call('toBuffer', 'pdf')\n }\n get raw(): Promise<Buffer> {\n return this._call('toBuffer', 'raw')\n }\n\n /** Release the Canvas from worker memory. Call when done with this object. */\n release(): void {\n this._pool.releaseCanvas(this._workerIdx, this._canvasId)\n }\n}\n\n/** Worker thread pool — routes render and canvas-call messages */\nclass WorkerPool {\n private workers: Worker[] = []\n private idle: Worker[] = []\n private queue: Array<{ id: number; props: RootProps }> = []\n private pending = new Map<number, PendingTask>()\n private nextId = 0\n\n constructor(size: number) {\n this.init(size)\n }\n\n private init(size: number) {\n const workerFile = path.join(path.dirname(fileURLToPath(import.meta.url)), '../render.worker.js')\n\n for (let i = 0; i < size; i++) {\n const workerIdx = i\n const worker = new Worker(workerFile)\n worker.on('message', (msg: WorkerResponse) => {\n const task = this.pending.get(msg.taskId)\n if (!task) return\n this.pending.delete(msg.taskId)\n\n if ('error' in msg) {\n task.reject(new Error(msg.error))\n return\n }\n\n if ('canvasId' in msg) {\n // Render complete — put worker back to idle\n this.idle.push(worker)\n this.drain()\n const result: PoolRenderResult = { buffer: msg.buffer, canvasId: msg.canvasId, workerIdx, width: msg.width, height: msg.height }\n task.resolve(result)\n } else {\n // Canvas method call complete\n task.resolve(msg.result)\n }\n })\n this.workers.push(worker)\n this.idle.push(worker)\n }\n }\n\n private drain() {\n while (this.queue.length > 0 && this.idle.length > 0) {\n const task = this.queue.shift()!\n const worker = this.idle.pop()!\n const request: WorkerRequest = { type: 'render', taskId: task.id, props: task.props }\n worker.postMessage(request)\n }\n }\n\n render(props: RootProps): Promise<PoolRenderResult> {\n return new Promise<PoolRenderResult>((resolve, reject) => {\n const id = this.nextId++\n this.pending.set(id, { resolve: resolve as (v: unknown) => void, reject })\n if (this.idle.length > 0) {\n const worker = this.idle.pop()!\n const request: WorkerRequest = { type: 'render', taskId: id, props }\n worker.postMessage(request)\n } else {\n this.queue.push({ id, props })\n }\n })\n }\n\n callOnCanvas<M extends CanvasCallMethod>(workerIdx: number, canvasId: number, method: M, args: CallArgs<M>): Promise<CallResult<M>> {\n return new Promise<CallResult<M>>((resolve, reject) => {\n const id = this.nextId++\n this.pending.set(id, { resolve: resolve as (v: unknown) => void, reject })\n const request = { type: 'call' as const, taskId: id, canvasId, method, args } as WorkerCallRequest\n this.workers[workerIdx].postMessage(request)\n })\n }\n\n releaseCanvas(workerIdx: number, canvasId: number): void {\n const request: WorkerRequest = { type: 'release', canvasId }\n this.workers[workerIdx]?.postMessage(request)\n }\n\n terminate() {\n this.workers.forEach(w => w.terminate())\n }\n}\n\n/**\n * Converts a NodeDescriptor tree into actual BoxNode instances.\n * Used both for non-worker rendering (inline tree building) and inside\n * the render worker (reconstructing the tree from serialized descriptors).\n */\nexport function buildTree(descriptor: NodeDescriptor): BoxNode {\n switch (descriptor.__type) {\n case 'Box':\n return new BoxNode({ ...descriptor.props, children: descriptor.children?.map(buildTree) })\n case 'Column':\n return new ColumnNode({ ...descriptor.props, children: descriptor.children?.map(buildTree) })\n case 'Row':\n return new RowNode({ ...descriptor.props, children: descriptor.children?.map(buildTree) })\n case 'Grid':\n return new GridNode({ ...descriptor.props, children: descriptor.children?.map(buildTree) as any })\n case 'GridItem':\n return new GridItemNode({ ...descriptor.props, children: descriptor.children?.map(buildTree) as any })\n case 'Image':\n return new ImageNode(descriptor.props as any)\n case 'Text':\n return new TextNode(descriptor.text, descriptor.props)\n case 'Chart':\n return new ChartNode(descriptor.props as any)\n }\n}\n\n/**\n * Root node that manages the canvas rendering context and coordinates overall layout and drawing.\n * Inherits from ColumnNode to provide vertical layout capabilities.\n */\nexport class RootNode extends ColumnNode {\n /** The canvas instance used for rendering */\n private canvas: Canvas | undefined\n /** The 2D rendering context for the canvas */\n private ctx: CanvasRenderingContext2D | null = null\n /** Target width for the canvas in pixels */\n private readonly targetWidth: number\n /** Target height for the canvas in pixels */\n private readonly targetHeight: number\n /** Scale factor for rendering (e.g. 2 for 2x resolution) */\n private readonly scale: number\n\n /**\n * Creates a new root node for canvas rendering\n * @param props Configuration properties for the root node\n * @throws Error if width property is not provided\n */\n constructor(props: RootProps & BaseProps) {\n // Call the parent constructor with root name and props\n super({ name: 'Root', ...props })\n\n this.props = props\n\n // Validate the required width property\n if (!props.width) {\n throw new Error('Width and height are required for Root')\n }\n\n // Register provided fonts with caching\n if (props.fonts?.length) {\n for (const font of props.fonts) {\n const family = font.family\n const paths = font.paths.map(p => path.resolve(p))\n\n if (!registeredFonts.has(family)) {\n registeredFonts.set(family, new Set())\n }\n\n const cachedPaths = registeredFonts.get(family)!\n const newPaths = paths.filter(p => !cachedPaths.has(p) && fs.existsSync(p))\n\n if (newPaths.length > 0) {\n FontLibrary.use({ [family]: newPaths })\n newPaths.forEach(p => cachedPaths.add(p))\n }\n }\n }\n\n // Set up scale and width\n this.scale = props.scale || 1\n this.targetWidth = props.width\n this.targetHeight = props.height\n this.node.setWidth(this.targetWidth)\n\n // Convert any NodeDescriptor children to actual BoxNode instances\n if (this.props.children) {\n const childArray = Array.isArray(this.props.children) ? this.props.children : [this.props.children]\n this.props.children = childArray.map(child => {\n if (child && typeof child === 'object' && '__type' in child) {\n return buildTree(child as NodeDescriptor)\n }\n return child\n }) as any\n }\n\n // Initialize children nodes\n this.processInitialChildren()\n }\n\n /**\n * Traverses the node tree to find all ImageNode instances using breadth-first search\n * @returns Array of all ImageNode instances found in the tree\n */\n private findAllImageNodes(): ImageNode[] {\n const imageNodes: ImageNode[] = []\n const queue: BoxNode[] = [this]\n while (queue.length > 0) {\n const node = queue.shift()!\n if (node instanceof ImageNode) {\n imageNodes.push(node)\n }\n queue.push(...node.children)\n }\n return imageNodes\n }\n\n /**\n * Renders the entire node tree to a canvas, handling image loading, layout calculation,\n * and final drawing\n * @returns Promise resolving to the rendered Canvas instance\n */\n async render(): Promise<Canvas> {\n // Step 1: Load all images with a concurrency limit to avoid overwhelming remote sources.\n // A per-render cache deduplicates identical src+color combinations within this render pass.\n const imageNodes = this.findAllImageNodes()\n if (imageNodes.length > 0) {\n const imageCache: RenderImageCache = new Map()\n const CONCURRENCY = 5\n const queue = [...imageNodes]\n const workers = Array.from({ length: Math.min(CONCURRENCY, queue.length) }, async () => {\n while (queue.length > 0) {\n const node = queue.shift()!\n await node.load(imageCache)\n }\n })\n await Promise.allSettled(workers)\n }\n\n // Step 2: Calculate initial layout\n this.node.calculateLayout(this.targetWidth, undefined, Style.Direction.LTR)\n\n // Step 3: Allow nodes to finalize their layout\n const needRecalculate = this.finalizeLayout()\n if (needRecalculate) {\n this.node.calculateLayout(this.targetWidth, undefined, Style.Direction.LTR)\n }\n\n // Step 4: Create a canvas with calculated dimensions\n const calculatedContentHeight = this.node.getComputedHeight()\n const finalCanvasWidth = Math.ceil(this.targetWidth * this.scale)\n const finalCanvasHeight = this.targetHeight ? Math.ceil(this.targetHeight * this.scale) : Math.max(1, Math.ceil(calculatedContentHeight * this.scale))\n\n // Step 5: Set up canvas context\n this.canvas = new Canvas(finalCanvasWidth, finalCanvasHeight)\n this.ctx = this.canvas.getContext('2d')\n this.ctx.scale(this.scale, this.scale)\n\n // Step 6: Render content\n super.render(this.ctx, 0, 0)\n\n if (!this.canvas) {\n throw new Error('Canvas not initialized')\n }\n\n return this.canvas\n }\n}\n\n/**\n * Creates and renders a new root node with the given properties.\n * When worker mode is enabled via configure(), rendering runs in a worker thread\n * and the returned object implements the same toBuffer/toBufferSync interface.\n * @param props Configuration properties for the root node\n * @returns Promise resolving to the rendered Canvas (or WorkerCanvas in worker mode)\n */\nexport const Root = async (props: RootProps): Promise<Canvas> => {\n if (_workerMode) {\n if (!_workerPool) {\n _workerPool = new WorkerPool(_workerPoolSize)\n }\n const result = await _workerPool.render(props)\n return new WorkerCanvas({ ...result, pool: _workerPool }) as unknown as Canvas\n }\n return new RootNode(props).render()\n}\n"],"names":["cpus","path","fileURLToPath","Worker","BoxNode","ColumnNode","RowNode","GridNode","GridItemNode","ImageNode","TextNode","ChartNode","fs","FontLibrary","Style","Canvas"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA;AACA,MAAM,eAAe,GAAG,IAAI,GAAG,EAAuB;AAOtD;AACA,IAAI,WAAW,GAAG,IAAI;AACtB,IAAI,eAAe,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAEA,YAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC;AACpD,IAAI,WAAW,GAAsB,IAAI;AASzC;;;AAGG;AACG,SAAU,SAAS,CAAC,OAA2B,EAAA;AACnD,IAAA,IAAI,OAAO,CAAC,UAAU,KAAK,SAAS;AAAE,QAAA,WAAW,GAAG,OAAO,CAAC,UAAU;AACtE,IAAA,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS;AAAE,QAAA,eAAe,GAAG,OAAO,CAAC,OAAO;IACpE,IAAI,WAAW,EAAE;AACf,QAAA,WAAW,GAAG,IAAI,UAAU,CAAC,eAAe,CAAC;IAC/C;AACF;AAeA;;;;AAIG;AACH,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U,CAAC,IAAI,CAAC;AACvC,QAAA,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC;;QAGtC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;AAE5B,QAAA,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;AAChB,YAAA,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC;QAC3C;QAEA,OAAO,IAAI,CAAC,MAAM;IACpB;AACD;AAED;;;;;;AAMG;MACU,IAAI,GAAG,OAAO,KAAgB,KAAqB;IAC9D,IAAI,WAAW,EAAE;QACf,IAAI,CAAC,WAAW,EAAE;AAChB,YAAA,WAAW,GAAG,IAAI,UAAU,CAAC,eAAe,CAAC;QAC/C;QACA,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC;AAC9C,QAAA,OAAO,IAAI,YAAY,CAAC,EAAE,GAAG,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,CAAsB;IAChF;IACA,OAAO,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE;AACrC;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"root.canvas.util.js","sources":["../../../../src/canvas/root.canvas.util.ts"],"sourcesContent":["import { Canvas, FontLibrary, type CanvasRenderingContext2D } from 'skia-canvas'\nimport type { ExportFormat, ExportOptions, SaveOptions, RenderOptions } from 'skia-canvas'\nimport { ColumnNode, BoxNode, RowNode } from '@/canvas/layout.canvas.util.js'\nimport type { BaseProps, RootProps, CanvasElement } from '@/canvas/canvas.type.js'\nimport type { CanvasCallMethod, CallArgs, CallResult, WorkerCallRequest, WorkerResponse, WorkerRequest } from '@/canvas/worker.types.js'\nimport { ImageNode, type RenderImageCache } from '@/canvas/image.canvas.util.js'\nimport { TextNode } from '@/canvas/text.canvas.util.js'\nimport { ChartNode } from '@/canvas/chart.canvas.util.js'\nimport { GridNode, GridItemNode } from '@/canvas/grid.canvas.util.js'\nimport { Style } from '@/constant/common.const.js'\nimport { WorkerPreProcessor } from '@/canvas/canvas.helper.js'\nimport * as path from 'node:path'\nimport * as fs from 'node:fs'\nimport { cpus } from 'node:os'\nimport { Worker } from 'node:worker_threads'\nimport { fileURLToPath } from 'node:url'\n\n/** Registry to track fonts that have already been loaded */\nconst registeredFonts = new Map<string, Set<string>>()\n\n// Exported for testing purposes only\nexport const _clearRegisteredFonts = () => {\n registeredFonts.clear()\n}\n\n/** Engine configuration */\nlet _workerMode = true\nlet _workerPoolSize = Math.max(1, cpus().length - 1)\nlet _workerPool: WorkerPool | null = null\n\nexport interface CanvasEngineConfig {\n /** Run rendering in worker threads to avoid blocking the event loop (default: true) */\n workerMode?: boolean\n /** Number of worker threads in the pool (default: os.cpus().length - 1) */\n workers?: number\n}\n\n/**\n * Configure the canvas rendering engine.\n * Call this once at application startup before rendering.\n */\nexport function configure(options: CanvasEngineConfig) {\n if (options.workerMode !== undefined) _workerMode = options.workerMode\n if (options.workers !== undefined) _workerPoolSize = options.workers\n if (_workerMode) {\n _workerPool = new WorkerPool(_workerPoolSize)\n }\n}\n\ninterface PendingTask {\n resolve: (value: unknown) => void\n reject: (err: Error) => void\n}\n\ninterface PoolRenderResult {\n buffer: Buffer\n canvasId: number\n workerIdx: number\n width: number\n height: number\n}\n\n/**\n * Proxies all skia-canvas Canvas APIs to a Canvas instance living inside a worker thread.\n * Sync methods (toBufferSync, toURLSync) return from a pre-encoded PNG buffer.\n * Async methods (toBuffer, toURL, toFile, getters) delegate to the worker.\n */\nclass WorkerCanvas {\n readonly width: number\n readonly height: number\n private readonly _buffer: Buffer // pre-encoded PNG for sync use\n private readonly _pool: WorkerPool\n private readonly _workerIdx: number\n private readonly _canvasId: number\n\n constructor(opts: PoolRenderResult & { pool: WorkerPool }) {\n this._buffer = opts.buffer\n this.width = opts.width\n this.height = opts.height\n this._pool = opts.pool\n this._workerIdx = opts.workerIdx\n this._canvasId = opts.canvasId\n }\n\n private _call<M extends CanvasCallMethod>(method: M, ...args: CallArgs<M>): Promise<CallResult<M>> {\n return this._pool.callOnCanvas(this._workerIdx, this._canvasId, method, args)\n }\n\n // --- Sync methods: return from pre-encoded PNG buffer ---\n\n toBufferSync(_format?: ExportFormat, _options?: ExportOptions): Buffer {\n return this._buffer\n }\n\n toURLSync(_format?: ExportFormat, _options?: ExportOptions): string {\n return `data:image/png;base64,${this._buffer.toString('base64')}`\n }\n\n // --- Async methods: delegate to worker ---\n\n toBuffer(format: ExportFormat, options?: ExportOptions): Promise<Buffer> {\n return this._call('toBuffer', format, options)\n }\n\n toURL(format: ExportFormat, options?: ExportOptions): Promise<string> {\n return this._call('toURL', format, options)\n }\n\n toFile(filename: string, options?: SaveOptions): Promise<void> {\n return this._call('toFile', filename, options)\n }\n\n /** Returns a Buffer (Sharp instance cannot be transferred across threads) */\n toSharp(options?: RenderOptions): Promise<Buffer> {\n return this._call('toSharp', options)\n }\n\n toSharpSync(_options?: RenderOptions): never {\n throw new Error('[canvas] toSharpSync() is not available in worker mode — use toSharp() instead')\n }\n\n // --- Async convenience getters ---\n\n get png(): Promise<Buffer> {\n return this._call('toBuffer', 'png')\n }\n get webp(): Promise<Buffer> {\n return this._call('toBuffer', 'webp')\n }\n get jpg(): Promise<Buffer> {\n return this._call('toBuffer', 'jpg')\n }\n get svg(): Promise<Buffer> {\n return this._call('toBuffer', 'svg')\n }\n get pdf(): Promise<Buffer> {\n return this._call('toBuffer', 'pdf')\n }\n get raw(): Promise<Buffer> {\n return this._call('toBuffer', 'raw')\n }\n\n /** Release the Canvas from worker memory. Call when done with this object. */\n release(): void {\n this._pool.releaseCanvas(this._workerIdx, this._canvasId)\n }\n}\n\n/** Worker thread pool — routes render and canvas-call messages */\nclass WorkerPool {\n private workers: Worker[] = []\n private idle: Worker[] = []\n private queue: Array<{ id: number; props: RootProps }> = []\n private pending = new Map<number, PendingTask>()\n private nextId = 0\n\n constructor(size: number) {\n this.init(size)\n }\n\n private init(size: number) {\n const workerFile = path.join(path.dirname(fileURLToPath(import.meta.url)), '../render.worker.js')\n\n for (let i = 0; i < size; i++) {\n const workerIdx = i\n const worker = new Worker(workerFile)\n worker.on('message', (msg: WorkerResponse) => {\n const task = this.pending.get(msg.taskId)\n if (!task) return\n this.pending.delete(msg.taskId)\n\n if ('error' in msg) {\n task.reject(new Error(msg.error))\n return\n }\n\n if ('canvasId' in msg) {\n // Render complete — put worker back to idle\n this.idle.push(worker)\n this.drain()\n const result: PoolRenderResult = { buffer: msg.buffer, canvasId: msg.canvasId, workerIdx, width: msg.width, height: msg.height }\n task.resolve(result)\n } else {\n // Canvas method call complete\n task.resolve(msg.result)\n }\n })\n this.workers.push(worker)\n this.idle.push(worker)\n }\n }\n\n private drain() {\n while (this.queue.length > 0 && this.idle.length > 0) {\n const task = this.queue.shift()!\n const worker = this.idle.pop()!\n const request: WorkerRequest = { type: 'render', taskId: task.id, props: task.props }\n worker.postMessage(request)\n }\n }\n\n render(props: RootProps): Promise<PoolRenderResult> {\n const sanitizedProps = WorkerPreProcessor.process(props)\n return new Promise<PoolRenderResult>((resolve, reject) => {\n const id = this.nextId++\n this.pending.set(id, { resolve: resolve as (v: unknown) => void, reject })\n if (this.idle.length > 0) {\n const worker = this.idle.pop()!\n const request: WorkerRequest = { type: 'render', taskId: id, props: sanitizedProps }\n worker.postMessage(request)\n } else {\n this.queue.push({ id, props: sanitizedProps })\n }\n })\n }\n\n callOnCanvas<M extends CanvasCallMethod>(workerIdx: number, canvasId: number, method: M, args: CallArgs<M>): Promise<CallResult<M>> {\n return new Promise<CallResult<M>>((resolve, reject) => {\n const id = this.nextId++\n this.pending.set(id, { resolve: resolve as (v: unknown) => void, reject })\n const request = { type: 'call' as const, taskId: id, canvasId, method, args } as WorkerCallRequest\n this.workers[workerIdx].postMessage(request)\n })\n }\n\n releaseCanvas(workerIdx: number, canvasId: number): void {\n const request: WorkerRequest = { type: 'release', canvasId }\n this.workers[workerIdx]?.postMessage(request)\n }\n\n terminate() {\n this.workers.forEach(w => w.terminate())\n }\n}\n\n/**\n * Converts a CanvasElement tree into actual BoxNode instances.\n * Used both for non-worker rendering (inline tree building) and inside\n * the render worker (reconstructing the tree from serialized descriptors).\n */\nexport function buildTree(descriptor: CanvasElement): BoxNode {\n switch (descriptor.__type) {\n case 'Box':\n return new BoxNode({ ...descriptor.props, children: descriptor.children?.map(buildTree) })\n case 'Column':\n return new ColumnNode({ ...descriptor.props, children: descriptor.children?.map(buildTree) })\n case 'Row':\n return new RowNode({ ...descriptor.props, children: descriptor.children?.map(buildTree) })\n case 'Grid':\n return new GridNode({ ...descriptor.props, children: descriptor.children?.map(buildTree) as any })\n case 'GridItem':\n return new GridItemNode({ ...descriptor.props, children: descriptor.children?.map(buildTree) as any })\n case 'Image':\n return new ImageNode(descriptor.props as any)\n case 'Text':\n return new TextNode(descriptor.text, descriptor.props)\n case 'Chart':\n return new ChartNode(descriptor.props as any)\n }\n}\n\n/**\n * Root node that manages the canvas rendering context and coordinates overall layout and drawing.\n * Inherits from ColumnNode to provide vertical layout capabilities.\n */\nexport class RootNode extends ColumnNode {\n /** The canvas instance used for rendering */\n private canvas: Canvas | undefined\n /** The 2D rendering context for the canvas */\n private ctx: CanvasRenderingContext2D | null = null\n /** Target width for the canvas in pixels */\n private readonly targetWidth: number\n /** Target height for the canvas in pixels */\n private readonly targetHeight: number\n /** Scale factor for rendering (e.g. 2 for 2x resolution) */\n private readonly scale: number\n\n /**\n * Creates a new root node for canvas rendering\n * @param props Configuration properties for the root node\n * @throws Error if width property is not provided\n */\n constructor(props: RootProps & BaseProps) {\n // Call the parent constructor with root name and props\n super({ name: 'Root', ...props })\n\n this.props = props\n\n // Validate the required width property\n if (!props.width) {\n throw new Error('Width and height are required for Root')\n }\n\n // Register provided fonts with caching\n if (props.fonts?.length) {\n for (const font of props.fonts) {\n const family = font.family\n const paths = font.paths.map(p => path.resolve(p))\n\n if (!registeredFonts.has(family)) {\n registeredFonts.set(family, new Set())\n }\n\n const cachedPaths = registeredFonts.get(family)!\n const newPaths = paths.filter(p => !cachedPaths.has(p) && fs.existsSync(p))\n\n if (newPaths.length > 0) {\n FontLibrary.use({ [family]: newPaths })\n newPaths.forEach(p => cachedPaths.add(p))\n }\n }\n }\n\n // Set up scale and width\n this.scale = props.scale || 1\n this.targetWidth = props.width\n this.targetHeight = props.height\n this.node.setWidth(this.targetWidth)\n\n // Convert any CanvasElement children to actual BoxNode instances\n if (this.props.children) {\n const childArray = Array.isArray(this.props.children) ? this.props.children : [this.props.children]\n this.props.children = childArray.map(child => {\n if (child && typeof child === 'object' && '__type' in child) {\n return buildTree(child as CanvasElement)\n }\n return child\n }) as any\n }\n\n // Initialize children nodes\n this.processInitialChildren()\n }\n\n /**\n * Traverses the node tree to find all ImageNode instances using breadth-first search\n * @returns Array of all ImageNode instances found in the tree\n */\n private findAllImageNodes(): ImageNode[] {\n const imageNodes: ImageNode[] = []\n const queue: BoxNode[] = [this]\n while (queue.length > 0) {\n const node = queue.shift()!\n if (node instanceof ImageNode) {\n imageNodes.push(node)\n }\n queue.push(...node.children)\n }\n return imageNodes\n }\n\n /**\n * Renders the entire node tree to a canvas, handling image loading, layout calculation,\n * and final drawing\n * @returns Promise resolving to the rendered Canvas instance\n */\n async render(): Promise<Canvas> {\n // Step 1: Load all images with a concurrency limit to avoid overwhelming remote sources.\n // A per-render cache deduplicates identical src+color combinations within this render pass.\n const imageNodes = this.findAllImageNodes()\n if (imageNodes.length > 0) {\n const imageCache: RenderImageCache = new Map()\n const CONCURRENCY = 5\n const queue = [...imageNodes]\n const workers = Array.from({ length: Math.min(CONCURRENCY, queue.length) }, async () => {\n while (queue.length > 0) {\n const node = queue.shift()!\n await node.load(imageCache)\n }\n })\n await Promise.allSettled(workers)\n }\n\n // Step 2: Calculate initial layout\n this.node.calculateLayout(this.targetWidth, undefined, Style.Direction.LTR)\n\n // Step 3: Allow nodes to finalize their layout\n const needRecalculate = this.finalizeLayout()\n if (needRecalculate) {\n this.node.calculateLayout(this.targetWidth, undefined, Style.Direction.LTR)\n }\n\n // Step 4: Create a canvas with calculated dimensions\n const calculatedContentHeight = this.node.getComputedHeight()\n const finalCanvasWidth = Math.ceil(this.targetWidth * this.scale)\n const finalCanvasHeight = this.targetHeight ? Math.ceil(this.targetHeight * this.scale) : Math.max(1, Math.ceil(calculatedContentHeight * this.scale))\n\n // Step 5: Set up canvas context\n this.canvas = new Canvas(finalCanvasWidth, finalCanvasHeight)\n this.ctx = this.canvas.getContext('2d')\n this.ctx.scale(this.scale, this.scale)\n\n // Step 6: Render content\n super.render(this.ctx, 0, 0)\n\n if (!this.canvas) {\n throw new Error('Canvas not initialized')\n }\n\n return this.canvas\n }\n}\n\n/**\n * Creates and renders a new root node with the given properties.\n * When worker mode is enabled via configure(), rendering runs in a worker thread\n * and the returned object implements the same toBuffer/toBufferSync interface.\n * @param props Configuration properties for the root node\n * @returns Promise resolving to the rendered Canvas (or WorkerCanvas in worker mode)\n */\nexport const Root = async (props: RootProps): Promise<Canvas> => {\n if (_workerMode) {\n if (!_workerPool) {\n _workerPool = new WorkerPool(_workerPoolSize)\n }\n const result = await _workerPool.render(props)\n return new WorkerCanvas({ ...result, pool: _workerPool }) as unknown as Canvas\n }\n return new RootNode(props).render()\n}\n"],"names":["cpus","path","fileURLToPath","Worker","WorkerPreProcessor","BoxNode","ColumnNode","RowNode","GridNode","GridItemNode","ImageNode","TextNode","ChartNode","fs","FontLibrary","Style","Canvas"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBA;AACA,MAAM,eAAe,GAAG,IAAI,GAAG,EAAuB;AAOtD;AACA,IAAI,WAAW,GAAG,IAAI;AACtB,IAAI,eAAe,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAEA,YAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC;AACpD,IAAI,WAAW,GAAsB,IAAI;AASzC;;;AAGG;AACG,SAAU,SAAS,CAAC,OAA2B,EAAA;AACn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
|
|
2
2
|
import { type CanvasRenderingContext2D } from 'skia-canvas';
|
|
3
3
|
import { BoxNode } from '../canvas/layout.canvas.util.js';
|
|
4
4
|
/**
|
|
@@ -161,5 +161,5 @@ export declare class TextNode extends BoxNode {
|
|
|
161
161
|
/**
|
|
162
162
|
* Creates a new TextNode instance with rich text support
|
|
163
163
|
*/
|
|
164
|
-
export declare const Text: (text: number | string, props?: TextProps) =>
|
|
164
|
+
export declare const Text: (text: number | string, props?: TextProps) => CanvasElement;
|
|
165
165
|
//# sourceMappingURL=text.canvas.util.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.canvas.util.d.ts","sourceRoot":"","sources":["../../../src/canvas/text.canvas.util.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"text.canvas.util.d.ts","sourceRoot":"","sources":["../../../src/canvas/text.canvas.util.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAe,aAAa,EAAE,MAAM,yBAAyB,CAAA;AACpF,OAAO,EAAU,KAAK,wBAAwB,EAA2B,MAAM,aAAa,CAAA;AAC5F,OAAO,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAA;AAGxD;;;GAGG;AACH,qBAAa,QAAS,SAAQ,OAAO;IACnC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAoB;IAC7C,OAAO,CAAC,KAAK,CAAsB;IACnC,OAAO,CAAC,MAAM,CAAC,kBAAkB,CAAwC;IACzE,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAU;IACxC,OAAO,CAAC,WAAW,CAAe;IAClC,OAAO,CAAC,WAAW,CAAe;IAClC,OAAO,CAAC,kBAAkB,CAAe;IAEjC,KAAK,EAAE,SAAS,GAAG;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAA;gBAElC,IAAI,GAAE,MAAM,GAAG,MAAW,EAAE,KAAK,GAAE,SAAc;IAuB7D;;;;;;;;OAQG;WACW,gBAAgB,CAC5B,GAAG,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
|
@@ -4,7 +4,6 @@ var skiaCanvas = require('skia-canvas');
|
|
|
4
4
|
var layout_canvas_util = require('./layout.canvas.util.js');
|
|
5
5
|
var common_const = require('../constant/common.const.js');
|
|
6
6
|
|
|
7
|
-
// TODO: Add comprehensive unit tests for this file.
|
|
8
7
|
/**
|
|
9
8
|
* Node for rendering text content with rich text styling support
|
|
10
9
|
* Supports color and weight variations through HTML-like tags
|