@canvas-harness/core 0.0.3 → 0.0.5
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.cjs +28 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +28 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -106,7 +106,7 @@ type EdgeStyle = Style & {
|
|
|
106
106
|
* Built-in node types — see ARCHITECTURE.md §3.5.
|
|
107
107
|
* Custom node types are arbitrary strings registered via defineNode.
|
|
108
108
|
*/
|
|
109
|
-
type BuiltInNodeType = 'rect' | 'ellipse' | 'diamond' | 'tag' | 'capsule' | 'thought-cloud' | 'layered-rect' | 'layered-ellipse' | 'layered-diamond' | 'text' | 'image' | 'icon' | 'frame';
|
|
109
|
+
type BuiltInNodeType = 'rect' | 'ellipse' | 'diamond' | 'tag' | 'capsule' | 'thought-cloud' | 'layered-rect' | 'layered-ellipse' | 'layered-diamond' | 'soft-diamond' | 'text' | 'image' | 'icon' | 'frame';
|
|
110
110
|
type NodeType = BuiltInNodeType | (string & {
|
|
111
111
|
readonly __nodeType?: never;
|
|
112
112
|
});
|
|
@@ -2034,7 +2034,7 @@ type AtomicPrimitive = 'rect' | 'ellipse' | 'diamond' | 'tag' | 'thought-cloud';
|
|
|
2034
2034
|
* circle and the rect body reads as two stacked hand-drawn shapes
|
|
2035
2035
|
* (medicine-pill aesthetic), which we want to keep.
|
|
2036
2036
|
*/
|
|
2037
|
-
type CompositePrimitive = 'capsule' | 'layered-rect' | 'layered-ellipse' | 'layered-diamond';
|
|
2037
|
+
type CompositePrimitive = 'capsule' | 'layered-rect' | 'layered-ellipse' | 'layered-diamond' | 'soft-diamond';
|
|
2038
2038
|
type PrimitiveType = AtomicPrimitive | CompositePrimitive;
|
|
2039
2039
|
/** Returns true if `node.type` is one of the built-ins drawShape can render. */
|
|
2040
2040
|
declare const isDrawablePrimitive: (type: string) => type is PrimitiveType;
|
package/dist/index.d.ts
CHANGED
|
@@ -106,7 +106,7 @@ type EdgeStyle = Style & {
|
|
|
106
106
|
* Built-in node types — see ARCHITECTURE.md §3.5.
|
|
107
107
|
* Custom node types are arbitrary strings registered via defineNode.
|
|
108
108
|
*/
|
|
109
|
-
type BuiltInNodeType = 'rect' | 'ellipse' | 'diamond' | 'tag' | 'capsule' | 'thought-cloud' | 'layered-rect' | 'layered-ellipse' | 'layered-diamond' | 'text' | 'image' | 'icon' | 'frame';
|
|
109
|
+
type BuiltInNodeType = 'rect' | 'ellipse' | 'diamond' | 'tag' | 'capsule' | 'thought-cloud' | 'layered-rect' | 'layered-ellipse' | 'layered-diamond' | 'soft-diamond' | 'text' | 'image' | 'icon' | 'frame';
|
|
110
110
|
type NodeType = BuiltInNodeType | (string & {
|
|
111
111
|
readonly __nodeType?: never;
|
|
112
112
|
});
|
|
@@ -2034,7 +2034,7 @@ type AtomicPrimitive = 'rect' | 'ellipse' | 'diamond' | 'tag' | 'thought-cloud';
|
|
|
2034
2034
|
* circle and the rect body reads as two stacked hand-drawn shapes
|
|
2035
2035
|
* (medicine-pill aesthetic), which we want to keep.
|
|
2036
2036
|
*/
|
|
2037
|
-
type CompositePrimitive = 'capsule' | 'layered-rect' | 'layered-ellipse' | 'layered-diamond';
|
|
2037
|
+
type CompositePrimitive = 'capsule' | 'layered-rect' | 'layered-ellipse' | 'layered-diamond' | 'soft-diamond';
|
|
2038
2038
|
type PrimitiveType = AtomicPrimitive | CompositePrimitive;
|
|
2039
2039
|
/** Returns true if `node.type` is one of the built-ins drawShape can render. */
|
|
2040
2040
|
declare const isDrawablePrimitive: (type: string) => type is PrimitiveType;
|
package/dist/index.js
CHANGED
|
@@ -1053,7 +1053,8 @@ var COMPOSITE = /* @__PURE__ */ new Set([
|
|
|
1053
1053
|
"capsule",
|
|
1054
1054
|
"layered-rect",
|
|
1055
1055
|
"layered-ellipse",
|
|
1056
|
-
"layered-diamond"
|
|
1056
|
+
"layered-diamond",
|
|
1057
|
+
"soft-diamond"
|
|
1057
1058
|
]);
|
|
1058
1059
|
var isCompositePrimitive = (type) => COMPOSITE.has(type);
|
|
1059
1060
|
var isDrawablePrimitive = (type) => ATOMIC.has(type) || COMPOSITE.has(type);
|
|
@@ -1159,6 +1160,30 @@ var compositeLayout = (node) => {
|
|
|
1159
1160
|
const front = { atomic, x: 0, y: 0, w, h };
|
|
1160
1161
|
return [back, front];
|
|
1161
1162
|
}
|
|
1163
|
+
case "soft-diamond": {
|
|
1164
|
+
const backScale = 1.08;
|
|
1165
|
+
const frontScale = 0.96;
|
|
1166
|
+
const bw = w * backScale;
|
|
1167
|
+
const bh = h * backScale;
|
|
1168
|
+
const fw = w * frontScale;
|
|
1169
|
+
const fh = h * frontScale;
|
|
1170
|
+
const back = {
|
|
1171
|
+
atomic: "diamond",
|
|
1172
|
+
x: (w - bw) / 2,
|
|
1173
|
+
y: (h - bh) / 2,
|
|
1174
|
+
w: bw,
|
|
1175
|
+
h: bh,
|
|
1176
|
+
style: darkenedStyle(node.style)
|
|
1177
|
+
};
|
|
1178
|
+
const front = {
|
|
1179
|
+
atomic: "diamond",
|
|
1180
|
+
x: (w - fw) / 2,
|
|
1181
|
+
y: (h - fh) / 2,
|
|
1182
|
+
w: fw,
|
|
1183
|
+
h: fh
|
|
1184
|
+
};
|
|
1185
|
+
return [back, front];
|
|
1186
|
+
}
|
|
1162
1187
|
}
|
|
1163
1188
|
return [];
|
|
1164
1189
|
};
|
|
@@ -4547,7 +4572,8 @@ var contentBounds = (node) => {
|
|
|
4547
4572
|
return { x: rectX, y: 0, w: Math.max(0, w - rectX), h };
|
|
4548
4573
|
}
|
|
4549
4574
|
case "diamond":
|
|
4550
|
-
case "layered-diamond":
|
|
4575
|
+
case "layered-diamond":
|
|
4576
|
+
case "soft-diamond": {
|
|
4551
4577
|
const cw = w * SQRT2_INV;
|
|
4552
4578
|
const ch = h * SQRT2_INV;
|
|
4553
4579
|
return { x: (w - cw) / 2, y: (h - ch) / 2, w: cw, h: ch };
|