@weasel-js/diagram-formats 1.12.0 → 1.13.0-rc.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/index.d.ts +1 -1
- package/dist/index.js +6 -9
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -179,7 +179,7 @@ type PageExportScene = Scene<unknown, string, RectPose>;
|
|
|
179
179
|
* that derives its path (a connector) is drawn along that path, and anything
|
|
180
180
|
* else is written by `svgLeafFromKit`.
|
|
181
181
|
*/
|
|
182
|
-
declare function pageSvgNodes(
|
|
182
|
+
declare function pageSvgNodes(live: PageExportScene, page: PageRect): SvgNode[];
|
|
183
183
|
|
|
184
184
|
/** Options for {@link exportPageSvg}. */
|
|
185
185
|
interface ExportPageSvgOptions extends Pick<SerializeOptions, 'title' | 'onWarn' | 'pretty'> {
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { diagramThemeFrom, DIAGRAM_THEME_KEY, diagramLabelOf, offPageSplits, diagramScene, themeDocValue, diagramShape, markShape, documentBoundsOf, dataNodeStyle, dataEdgeStyle, diagramEdgeOf, diagramContainerOf, NODE_STROKE_WIDTH, dataRegionStyle, poolAxisOf, titleIdOf, layoutOwnsRoute, EDGE_STROKE_WIDTH, diagramThemeOf, edgeIdOf, layoutOwnsPort, DEFAULT_PORTS, LANE_STROKE_WIDTH } from '@weasel-js/diagram';
|
|
2
|
-
import { placedPagesOf, layoutPages, PAGES_DOC_KEY, isAnnotationLayer, boundsOfPath, layoutTextPose, warmRender, renderSceneToPixels, planPixelRender, viewToMat3, createRasterSession, pageHolding, effectivePose, derivedDepOf, pageName, derivedPartsOf, INHERIT, resolvePartPaint, createScene, mat3 } from '@weasel-js/core';
|
|
2
|
+
import { placedPagesOf, layoutPages, PAGES_DOC_KEY, documentOf, isAnnotationLayer, boundsOfPath, layoutTextPose, warmRender, renderSceneToPixels, planPixelRender, viewToMat3, createRasterSession, pageHolding, effectivePose, derivedDepOf, pageName, derivedPartsOf, INHERIT, resolvePartPaint, createScene, mat3 } from '@weasel-js/core';
|
|
3
3
|
import { svgNodesFromKit, svgLeafFromKit, warmSvg, serializeSvg, escapeAttr, svgPaintFromKit, svgStrokeFromKit } from '@weasel-js/svg';
|
|
4
4
|
import { writePdf, registryFontSource } from '@weasel-js/pdf';
|
|
5
5
|
|
|
@@ -2985,7 +2985,8 @@ function derivedNodes(path, data) {
|
|
|
2985
2985
|
) ?? []);
|
|
2986
2986
|
}
|
|
2987
2987
|
var one = (nodes) => nodes.length === 0 ? null : nodes.length === 1 ? nodes[0] : { kind: "group", children: nodes };
|
|
2988
|
-
function pageSvgNodes(
|
|
2988
|
+
function pageSvgNodes(live, page) {
|
|
2989
|
+
const scene = documentOf(live);
|
|
2989
2990
|
const painters = [diagramShape(), markShape()];
|
|
2990
2991
|
const shown = new Set(scene.layers.filter((l) => l.visible && !isAnnotationLayer(l)).map((l) => l.id));
|
|
2991
2992
|
const poseCache = /* @__PURE__ */ new Map();
|
|
@@ -2994,7 +2995,7 @@ function pageSvgNodes(scene, page) {
|
|
|
2994
2995
|
if (p === void 0) poseCache.set(node.id, p = effectivePose(scene, node));
|
|
2995
2996
|
return p;
|
|
2996
2997
|
};
|
|
2997
|
-
const pathOf = (node) => node.kind === "
|
|
2998
|
+
const pathOf = (node) => node.kind === "mark" ? derivedDepOf(scene, node.id)?.path ?? null : null;
|
|
2998
2999
|
const tree = {
|
|
2999
3000
|
roots: scene.layers.flatMap((l) => scene.roots.filter((id) => scene.get(id)?.layer === l.id)),
|
|
3000
3001
|
childrenOf: (id) => scene.childrenOf(id),
|
|
@@ -3006,7 +3007,8 @@ function pageSvgNodes(scene, page) {
|
|
|
3006
3007
|
data: node.data,
|
|
3007
3008
|
pose: poseOf(pose(node)),
|
|
3008
3009
|
...node.hidden ? { hidden: true } : {},
|
|
3009
|
-
...node.
|
|
3010
|
+
...node.clip ? { clip: node.clip } : {},
|
|
3011
|
+
...node.copiesFromPose ? { copiesFromPose: node.copiesFromPose } : {}
|
|
3010
3012
|
};
|
|
3011
3013
|
}
|
|
3012
3014
|
};
|
|
@@ -3023,11 +3025,6 @@ function pageSvgNodes(scene, page) {
|
|
|
3023
3025
|
if (path) return one(derivedNodes(path, kit.data));
|
|
3024
3026
|
const painted = diagramPainted(painters, node, pose(node));
|
|
3025
3027
|
return painted ? one(painted) : svgLeafFromKit(kit.data, kit.pose);
|
|
3026
|
-
},
|
|
3027
|
-
group(id, g) {
|
|
3028
|
-
const node = scene.get(id);
|
|
3029
|
-
const outline = diagramPainted(painters, node, pose(node));
|
|
3030
|
-
return outline ? { ...g, children: [...outline, ...g.children] } : g;
|
|
3031
3028
|
}
|
|
3032
3029
|
});
|
|
3033
3030
|
}
|