@retikz/core 0.2.0-alpha.1 → 0.2.0-alpha.2
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/es/compile/compile.d.ts.map +1 -1
- package/dist/es/compile/compile.js +7 -5
- package/dist/es/compile/node.d.ts +2 -2
- package/dist/es/compile/node.d.ts.map +1 -1
- package/dist/es/compile/node.js +7 -7
- package/dist/es/compile/path/index.js +1 -1
- package/dist/es/compile/path/label.d.ts +1 -1
- package/dist/es/compile/path/label.d.ts.map +1 -1
- package/dist/es/compile/path/label.js +17 -4
- package/dist/es/compile/style.d.ts +46 -0
- package/dist/es/compile/style.d.ts.map +1 -0
- package/dist/es/compile/style.js +259 -0
- package/dist/es/index.d.ts +2 -2
- package/dist/es/index.d.ts.map +1 -1
- package/dist/es/index.js +2 -2
- package/dist/es/ir/node.d.ts +5 -2
- package/dist/es/ir/node.d.ts.map +1 -1
- package/dist/es/ir/node.js +1 -0
- package/dist/es/ir/path/path.d.ts +531 -0
- package/dist/es/ir/path/path.d.ts.map +1 -1
- package/dist/es/ir/path/path.js +1 -0
- package/dist/es/ir/path/step.d.ts +834 -0
- package/dist/es/ir/path/step.d.ts.map +1 -1
- package/dist/es/ir/path/step.js +5 -1
- package/dist/es/ir/scope.d.ts +3503 -3
- package/dist/es/ir/scope.d.ts.map +1 -1
- package/dist/es/ir/scope.js +64 -4
- package/dist/lib/compile/compile.cjs +7 -5
- package/dist/lib/compile/compile.d.ts.map +1 -1
- package/dist/lib/compile/node.cjs +7 -7
- package/dist/lib/compile/node.d.ts +2 -2
- package/dist/lib/compile/node.d.ts.map +1 -1
- package/dist/lib/compile/path/index.cjs +1 -1
- package/dist/lib/compile/path/label.cjs +17 -4
- package/dist/lib/compile/path/label.d.ts +1 -1
- package/dist/lib/compile/path/label.d.ts.map +1 -1
- package/dist/lib/compile/style.cjs +262 -0
- package/dist/lib/compile/style.d.ts +46 -0
- package/dist/lib/compile/style.d.ts.map +1 -0
- package/dist/lib/index.cjs +4 -0
- package/dist/lib/index.d.ts +2 -2
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/ir/node.cjs +1 -0
- package/dist/lib/ir/node.d.ts +5 -2
- package/dist/lib/ir/node.d.ts.map +1 -1
- package/dist/lib/ir/path/path.cjs +1 -0
- package/dist/lib/ir/path/path.d.ts +531 -0
- package/dist/lib/ir/path/path.d.ts.map +1 -1
- package/dist/lib/ir/path/step.cjs +5 -1
- package/dist/lib/ir/path/step.d.ts +834 -0
- package/dist/lib/ir/path/step.d.ts.map +1 -1
- package/dist/lib/ir/scope.cjs +67 -3
- package/dist/lib/ir/scope.d.ts +3503 -3
- package/dist/lib/ir/scope.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"step.d.ts","sourceRoot":"","sources":["../../../../src/ir/path/step.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"step.d.ts","sourceRoot":"","sources":["../../../../src/ir/path/step.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB;;;GAGG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgDzB,CAAC;AAEJ,gBAAgB;AAChB,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAE1D,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQyC,CAAC;AAErE,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAS4C,CAAC;AAExE,eA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.cjs");
|
|
3
|
+
const require_path = require("./path/path.cjs");
|
|
4
|
+
const require_node = require("./node.cjs");
|
|
1
5
|
const require_transform = require("./transform.cjs");
|
|
2
6
|
let zod = require("zod");
|
|
3
7
|
//#region src/ir/scope.ts
|
|
8
|
+
/**
|
|
9
|
+
* every node 默认样式 schema
|
|
10
|
+
* @description 从 NodeSchema 派生,排除实例专属字段(type / id / position / text / label);
|
|
11
|
+
* 含形状 / 间距 / scale / rotate / color 等所有可作默认的 node 样式字段
|
|
12
|
+
*/
|
|
13
|
+
var NodeDefaultSchema = require_node.NodeSchema.omit({
|
|
14
|
+
type: true,
|
|
15
|
+
id: true,
|
|
16
|
+
position: true,
|
|
17
|
+
text: true,
|
|
18
|
+
label: true
|
|
19
|
+
}).strict();
|
|
20
|
+
/**
|
|
21
|
+
* every path 默认样式 schema
|
|
22
|
+
* @description 从 PathSchema 派生,排除 type / children / arrow / arrowDetail(arrow 走独立 arrowDefault 通道,免双入口)
|
|
23
|
+
*/
|
|
24
|
+
var PathDefaultSchema = require_path.PathSchema.omit({
|
|
25
|
+
type: true,
|
|
26
|
+
children: true,
|
|
27
|
+
arrow: true,
|
|
28
|
+
arrowDetail: true
|
|
29
|
+
}).strict();
|
|
30
|
+
/**
|
|
31
|
+
* every label 默认样式 schema(node label 与 step label 共享)
|
|
32
|
+
* @description 单通道双宿主:node-label 跟 node.color、step-label 跟 path.color;本 schema 只定义可继承的 label 样式字段
|
|
33
|
+
*/
|
|
34
|
+
var LabelDefaultSchema = zod.z.object({
|
|
35
|
+
color: zod.z.string().optional().describe("Master color for labels in this scope; textColor falls back to it."),
|
|
36
|
+
textColor: zod.z.string().optional().describe("Default text color for node labels and step labels in this scope."),
|
|
37
|
+
opacity: zod.z.number().min(0).max(1).optional().describe("Default label opacity 0..1."),
|
|
38
|
+
font: require_font.FontSchema.optional().describe("Default label font (family / size / weight / style); per-field fallback.")
|
|
39
|
+
}).strict().describe("Default style applied to every label (node label + step label) in this scope (TikZ `every label`). All fields optional; unknown keys are rejected.");
|
|
40
|
+
/**
|
|
41
|
+
* every arrow 默认样式 schema
|
|
42
|
+
* @description 直接复用 ArrowDetailSchema(shape / scale / length / width / color / fill / opacity / lineWidth + start / end)
|
|
43
|
+
*/
|
|
44
|
+
var ArrowDefaultSchema = require_arrow.ArrowDetailSchema;
|
|
4
45
|
/** schema 注册顺序:scene.ts import 时由 __registerChildSchema 一次性回灌;之后只读 */
|
|
5
46
|
var childSchemaRef = null;
|
|
6
47
|
/**
|
|
@@ -11,20 +52,43 @@ var __registerChildSchema = (schema) => {
|
|
|
11
52
|
childSchemaRef = schema;
|
|
12
53
|
};
|
|
13
54
|
/**
|
|
14
|
-
* Scope schema
|
|
55
|
+
* Scope schema:容器 + 局部 transform + 样式默认挂点
|
|
15
56
|
* @description 直接 `z.object` 让 ChildSchema discriminatedUnion 能识别 `type` 鉴别字段;
|
|
16
|
-
* children 字段内部用 z.lazy 引用 ChildSchema 实现递归,避免直接 `z.lazy(() => z.object(...))` 让外层 union 拒识 type
|
|
57
|
+
* children 字段内部用 z.lazy 引用 ChildSchema 实现递归,避免直接 `z.lazy(() => z.object(...))` 让外层 union 拒识 type。
|
|
58
|
+
* alpha.2 加:① 级联 graphic state(color + stroke / fill / strokeWidth / opacity / fillOpacity / drawOpacity);
|
|
59
|
+
* ② 四通道 every-X 默认(nodeDefault / pathDefault / labelDefault / arrowDefault);③ resetStyle 继承屏障。
|
|
17
60
|
*/
|
|
18
61
|
var ScopeSchema = zod.z.object({
|
|
19
62
|
type: zod.z.literal("scope").describe("Discriminator marking this child as a scope container."),
|
|
20
63
|
id: zod.z.string().min(1).optional().describe("Optional reference id; when set, the scope registers a synthetic rectangle bbox node in the **parent** namespace frame so paths / positions can target the scope as a whole. scope.id always registers in the parent frame, regardless of `localNamespace` (it is the external handle)."),
|
|
21
64
|
localNamespace: zod.z.boolean().optional().describe("When true, the scope creates a local namespace boundary — child node / coordinate / nested-scope ids registered inside do NOT propagate to the parent namespace; external lookups cannot see them. Default false (matches TikZ pgf default: child ids flow up to global). scope.id itself always registers in the parent frame regardless of this flag."),
|
|
22
65
|
transforms: zod.z.array(require_transform.TransformSchema).optional().describe("Local transforms applied to all scope children; array order = application order (first element applied innermost, matching Scene `GroupPrim.transforms` / SVG transform list). Supports 6 variants; the 4 translate variants are lowered to Cartesian translate at compile time."),
|
|
66
|
+
color: zod.z.string().optional().describe("Cascading master color for all elements in this scope (TikZ scope `color=`). Stroke / fill / text of inner elements default to it unless individually overridden; cascades into edge labels and arrows."),
|
|
67
|
+
stroke: zod.z.string().optional().describe("Cascading default stroke color for inner nodes and paths; overrides the cascading master color for the stroke channel."),
|
|
68
|
+
fill: zod.z.string().optional().describe("Cascading default fill color for inner nodes and paths."),
|
|
69
|
+
strokeWidth: zod.z.number().optional().describe("Cascading default stroke width (user units) for inner nodes and paths."),
|
|
70
|
+
opacity: zod.z.number().min(0).max(1).optional().describe("Cascading default whole-element opacity 0..1. Replaces (does NOT compound across nested scopes — TikZ default)."),
|
|
71
|
+
fillOpacity: zod.z.number().min(0).max(1).optional().describe("Cascading default fill opacity 0..1 for inner nodes and paths."),
|
|
72
|
+
drawOpacity: zod.z.number().min(0).max(1).optional().describe("Cascading default stroke opacity 0..1 (TikZ `draw opacity`) for inner nodes and paths."),
|
|
73
|
+
nodeDefault: NodeDefaultSchema.optional().describe("Default style applied to every node in this scope (TikZ `every node`). Flat channel, independent from the other defaults."),
|
|
74
|
+
pathDefault: PathDefaultSchema.optional().describe("Default style applied to every path in this scope (TikZ `every path`); arrows use the separate arrowDefault channel."),
|
|
75
|
+
labelDefault: LabelDefaultSchema.optional().describe("Default style applied to every label (node label + step label) in this scope (TikZ `every label`)."),
|
|
76
|
+
arrowDefault: ArrowDefaultSchema.optional().describe("Default style applied to every arrow in this scope (TikZ `every arrow`)."),
|
|
77
|
+
resetStyle: zod.z.union([zod.z.boolean(), zod.z.array(zod.z.enum([
|
|
78
|
+
"node",
|
|
79
|
+
"path",
|
|
80
|
+
"label",
|
|
81
|
+
"arrow"
|
|
82
|
+
]))]).optional().describe("Inheritance barrier: drop the outer scope cascade + every-X defaults for the listed channels (or all when true), falling back to the built-in baseline. Only cuts the scope-inheritance axis; labels / arrows still follow their host path / node resolved color (structural relation, not scope inheritance)."),
|
|
23
83
|
children: zod.z.array(zod.z.lazy(() => {
|
|
24
84
|
if (!childSchemaRef) throw new Error("ScopeSchema: ChildSchema not registered yet; ensure scene.ts loaded");
|
|
25
85
|
return childSchemaRef;
|
|
26
86
|
})).describe("Scope children: nested nodes / paths / coordinates / scopes. Recursive via the parent ChildSchema (registered late to break the IRChild <-> IRScope cycle).")
|
|
27
|
-
}).describe("Scope container: groups child IR elements
|
|
87
|
+
}).describe("Scope container: groups child IR elements, applies local transforms, and acts as a style-default anchor (cascading graphic state + every-X defaults + resetStyle barrier). Corresponds to TikZ `\\begin{scope}`.");
|
|
28
88
|
//#endregion
|
|
89
|
+
exports.ArrowDefaultSchema = ArrowDefaultSchema;
|
|
90
|
+
exports.LabelDefaultSchema = LabelDefaultSchema;
|
|
91
|
+
exports.NodeDefaultSchema = NodeDefaultSchema;
|
|
92
|
+
exports.PathDefaultSchema = PathDefaultSchema;
|
|
29
93
|
exports.ScopeSchema = ScopeSchema;
|
|
30
94
|
exports.__registerChildSchema = __registerChildSchema;
|