@pinepaper.studio/mcp-server 1.6.11 → 1.6.13
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/README.md +219 -0
- package/dist/agent/export-manager.d.ts.map +1 -1
- package/dist/agent/export-manager.js +9 -7
- package/dist/agent/export-manager.js.map +1 -1
- package/dist/assets/repositories/iconify.d.ts +0 -5
- package/dist/assets/repositories/iconify.d.ts.map +1 -1
- package/dist/assets/repositories/iconify.js +17 -5
- package/dist/assets/repositories/iconify.js.map +1 -1
- package/dist/browser/puppeteer-controller.d.ts +16 -0
- package/dist/browser/puppeteer-controller.d.ts.map +1 -1
- package/dist/browser/puppeteer-controller.js +32 -2
- package/dist/browser/puppeteer-controller.js.map +1 -1
- package/dist/design/design-systems.d.ts +27 -2
- package/dist/design/design-systems.d.ts.map +1 -1
- package/dist/design/design-systems.js +20 -0
- package/dist/design/design-systems.js.map +1 -1
- package/dist/tools/compact-descriptions.js +1 -1
- package/dist/tools/compact-descriptions.js.map +1 -1
- package/dist/tools/definitions.d.ts.map +1 -1
- package/dist/tools/definitions.js +175 -52
- package/dist/tools/definitions.js.map +1 -1
- package/dist/tools/engine-methods.d.ts.map +1 -1
- package/dist/tools/engine-methods.js +8 -0
- package/dist/tools/engine-methods.js.map +1 -1
- package/dist/tools/engine-surface.d.ts +1 -1
- package/dist/tools/engine-surface.d.ts.map +1 -1
- package/dist/tools/engine-surface.js +32 -12
- package/dist/tools/engine-surface.js.map +1 -1
- package/dist/tools/handlers.d.ts +13 -2
- package/dist/tools/handlers.d.ts.map +1 -1
- package/dist/tools/handlers.js +219 -13
- package/dist/tools/handlers.js.map +1 -1
- package/dist/tools/minimal-descriptions.js +1 -1
- package/dist/tools/minimal-descriptions.js.map +1 -1
- package/dist/tools/shape-params.d.ts +36 -0
- package/dist/tools/shape-params.d.ts.map +1 -0
- package/dist/tools/shape-params.js +159 -0
- package/dist/tools/shape-params.js.map +1 -0
- package/dist/tools/stick-vocabulary.d.ts +26 -0
- package/dist/tools/stick-vocabulary.d.ts.map +1 -0
- package/dist/tools/stick-vocabulary.js +102 -0
- package/dist/tools/stick-vocabulary.js.map +1 -0
- package/dist/tools/toolkits.d.ts.map +1 -1
- package/dist/tools/toolkits.js +10 -1
- package/dist/tools/toolkits.js.map +1 -1
- package/dist/types/code-generator.d.ts.map +1 -1
- package/dist/types/code-generator.js +865 -122
- package/dist/types/code-generator.js.map +1 -1
- package/dist/types/schemas.d.ts +191 -35
- package/dist/types/schemas.d.ts.map +1 -1
- package/dist/types/schemas.js +32 -16
- package/dist/types/schemas.js.map +1 -1
- package/dist/vendor/design/design-systems-dtcg.d.ts +9 -0
- package/dist/vendor/design/design-systems-dtcg.d.ts.map +1 -1
- package/dist/vendor/design/design-systems-dtcg.js +53 -1
- package/dist/vendor/design/design-systems-dtcg.js.map +1 -1
- package/dist/vendor/design/device-mockup-generator.d.ts +83 -0
- package/dist/vendor/design/device-mockup-generator.d.ts.map +1 -0
- package/dist/vendor/design/device-mockup-generator.js +634 -0
- package/dist/vendor/design/device-mockup-generator.js.map +1 -0
- package/dist/vendor/design/recursive-subdivision-generator.d.ts +79 -0
- package/dist/vendor/design/recursive-subdivision-generator.d.ts.map +1 -0
- package/dist/vendor/design/recursive-subdivision-generator.js +319 -0
- package/dist/vendor/design/recursive-subdivision-generator.js.map +1 -0
- package/dist/vendor/design/textile-weave-generator.d.ts +140 -0
- package/dist/vendor/design/textile-weave-generator.d.ts.map +1 -0
- package/dist/vendor/design/textile-weave-generator.js +568 -0
- package/dist/vendor/design/textile-weave-generator.js.map +1 -0
- package/manifest.json +1 -1
- package/package.json +8 -2
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Recursive Quadtree / Rectangular Subdivision Generative Engine.
|
|
3
|
+
*
|
|
4
|
+
* Procedurally partitions a canvas into asymmetric orthogonal compositions
|
|
5
|
+
* inspired by De Stijl (Piet Mondrian), Bauhaus, and Swiss International Style.
|
|
6
|
+
*
|
|
7
|
+
* Adheres strictly to the generative rules in gen:recursive-quad:
|
|
8
|
+
* 1. "A cell either subdivides or takes a colour — never both."
|
|
9
|
+
* 2. "Depth is bounded; an unbounded recursion is a hang, not a design."
|
|
10
|
+
* 3. "Leave one large cell undivided as a rest for the eye."
|
|
11
|
+
*/
|
|
12
|
+
export interface SubdivisionBounds {
|
|
13
|
+
x?: number;
|
|
14
|
+
y?: number;
|
|
15
|
+
width?: number;
|
|
16
|
+
height?: number;
|
|
17
|
+
}
|
|
18
|
+
export type SubdivisionPreset = "mondrian" | "swiss" | "bauhaus" | "minimal" | "custom";
|
|
19
|
+
export interface SubdivisionPalette {
|
|
20
|
+
ground?: string;
|
|
21
|
+
colors?: string[];
|
|
22
|
+
dividerColor?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface RecursiveSubdivisionOptions {
|
|
25
|
+
bounds?: SubdivisionBounds;
|
|
26
|
+
preset?: SubdivisionPreset;
|
|
27
|
+
minDepth?: number;
|
|
28
|
+
maxDepth?: number;
|
|
29
|
+
splitBias?: [number, number];
|
|
30
|
+
palette?: SubdivisionPalette;
|
|
31
|
+
groundColor?: string;
|
|
32
|
+
accentColors?: string[];
|
|
33
|
+
colorProbability?: number;
|
|
34
|
+
dividerWidth?: number;
|
|
35
|
+
dividerColor?: string;
|
|
36
|
+
cellInset?: number;
|
|
37
|
+
nestedProbability?: number;
|
|
38
|
+
seed?: number;
|
|
39
|
+
idPrefix?: string;
|
|
40
|
+
}
|
|
41
|
+
export interface SubdivisionCell {
|
|
42
|
+
x: number;
|
|
43
|
+
y: number;
|
|
44
|
+
width: number;
|
|
45
|
+
height: number;
|
|
46
|
+
depth: number;
|
|
47
|
+
isLeaf: boolean;
|
|
48
|
+
color?: string;
|
|
49
|
+
hasNested?: boolean;
|
|
50
|
+
nestedColor?: string;
|
|
51
|
+
isRestCell?: boolean;
|
|
52
|
+
}
|
|
53
|
+
export declare const SUBDIVISION_PRESETS: Record<SubdivisionPreset, {
|
|
54
|
+
ground: string;
|
|
55
|
+
colors: string[];
|
|
56
|
+
dividerColor: string;
|
|
57
|
+
dividerWidth: number;
|
|
58
|
+
colorProbability: number;
|
|
59
|
+
nestedProbability: number;
|
|
60
|
+
cellInset: number;
|
|
61
|
+
splitBias: [number, number];
|
|
62
|
+
}>;
|
|
63
|
+
/**
|
|
64
|
+
* Compute the recursive partition tree over the bounding rectangle.
|
|
65
|
+
*/
|
|
66
|
+
export declare function partitionSubdivision(opts?: RecursiveSubdivisionOptions): {
|
|
67
|
+
cells: SubdivisionCell[];
|
|
68
|
+
dividers: Array<{
|
|
69
|
+
x0: number;
|
|
70
|
+
y0: number;
|
|
71
|
+
x1: number;
|
|
72
|
+
y1: number;
|
|
73
|
+
}>;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Generate executable Paper.js vector code for recursive quadtree / rectangular subdivision.
|
|
77
|
+
*/
|
|
78
|
+
export declare function generateRecursiveSubdivisionCode(opts?: RecursiveSubdivisionOptions): string;
|
|
79
|
+
//# sourceMappingURL=recursive-subdivision-generator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recursive-subdivision-generator.d.ts","sourceRoot":"","sources":["../../../src/vendor/design/recursive-subdivision-generator.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;GAUG;AAEH,MAAM,WAAW,iBAAiB;IAChC,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,iBAAiB,GAAG,UAAU,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;AAExF,MAAM,WAAW,kBAAkB;IACjC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;C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,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC7B,CAoDF,CAAC;AAgBF;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,GAAE,2BAAgC,GAAG;IAC5E,KAAK,EAAE,eAAe,EAAE,CAAC;IACzB,QAAQ,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACrE,CA2HA;AAED;;GAEG;AACH,wBAAgB,gCAAgC,CAAC,IAAI,GAAE,2BAAgC,GAAG,MAAM,CA+H/F"}
|
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
/* GENERATED — DO NOT EDIT.
|
|
2
|
+
*
|
|
3
|
+
* Source: mcp-cloud/src/services/recursive-subdivision-generator.ts
|
|
4
|
+
* sha256: f1383a9c42ada6df674ea65790cc61693e8c25dac0bfee68a09c7669fc851a6b
|
|
5
|
+
* Generator: scripts/sync-design-systems.mjs
|
|
6
|
+
*
|
|
7
|
+
* Edit the TypeScript upstream and re-run the generator. A hand edit here is
|
|
8
|
+
* the second copy of the same design vocabulary that the generator exists to
|
|
9
|
+
* prevent, and the provenance test will fail on it.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Recursive Quadtree / Rectangular Subdivision Generative Engine.
|
|
13
|
+
*
|
|
14
|
+
* Procedurally partitions a canvas into asymmetric orthogonal compositions
|
|
15
|
+
* inspired by De Stijl (Piet Mondrian), Bauhaus, and Swiss International Style.
|
|
16
|
+
*
|
|
17
|
+
* Adheres strictly to the generative rules in gen:recursive-quad:
|
|
18
|
+
* 1. "A cell either subdivides or takes a colour — never both."
|
|
19
|
+
* 2. "Depth is bounded; an unbounded recursion is a hang, not a design."
|
|
20
|
+
* 3. "Leave one large cell undivided as a rest for the eye."
|
|
21
|
+
*/
|
|
22
|
+
// Built-in presets tuned for iconic graphic design movements
|
|
23
|
+
export const SUBDIVISION_PRESETS = {
|
|
24
|
+
mondrian: {
|
|
25
|
+
ground: "#ffffff",
|
|
26
|
+
colors: ["#dc2626", "#1d4ed8", "#facc15", "#171717"], // Primary Red, Blue, Yellow, Deep Black
|
|
27
|
+
dividerColor: "#0a0a0a",
|
|
28
|
+
dividerWidth: 8,
|
|
29
|
+
colorProbability: 0.35,
|
|
30
|
+
nestedProbability: 0,
|
|
31
|
+
cellInset: 0,
|
|
32
|
+
splitBias: [0.35, 0.65],
|
|
33
|
+
},
|
|
34
|
+
swiss: {
|
|
35
|
+
ground: "#f8fafc",
|
|
36
|
+
colors: ["#e11d48", "#2563eb", "#059669", "#d97706", "#0f172a"],
|
|
37
|
+
dividerColor: "#cbd5e1",
|
|
38
|
+
dividerWidth: 1.5,
|
|
39
|
+
colorProbability: 0.45,
|
|
40
|
+
nestedProbability: 0.25,
|
|
41
|
+
cellInset: 4,
|
|
42
|
+
splitBias: [0.4, 0.6],
|
|
43
|
+
},
|
|
44
|
+
bauhaus: {
|
|
45
|
+
ground: "#fef3c7", // Warm parchment
|
|
46
|
+
colors: ["#b91c1c", "#1e3a8a", "#d97706", "#047857", "#18181b"],
|
|
47
|
+
dividerColor: "#18181b",
|
|
48
|
+
dividerWidth: 4,
|
|
49
|
+
colorProbability: 0.4,
|
|
50
|
+
nestedProbability: 0.15,
|
|
51
|
+
cellInset: 2,
|
|
52
|
+
splitBias: [0.33, 0.67],
|
|
53
|
+
},
|
|
54
|
+
minimal: {
|
|
55
|
+
ground: "#ffffff",
|
|
56
|
+
colors: ["#18181b", "#52525b", "#a1a1aa"],
|
|
57
|
+
dividerColor: "#e4e4e7",
|
|
58
|
+
dividerWidth: 1,
|
|
59
|
+
colorProbability: 0.25,
|
|
60
|
+
nestedProbability: 0.1,
|
|
61
|
+
cellInset: 6,
|
|
62
|
+
splitBias: [0.4, 0.6],
|
|
63
|
+
},
|
|
64
|
+
custom: {
|
|
65
|
+
ground: "#ffffff",
|
|
66
|
+
colors: ["#dc2626", "#1d4ed8", "#facc15"],
|
|
67
|
+
dividerColor: "#000000",
|
|
68
|
+
dividerWidth: 4,
|
|
69
|
+
colorProbability: 0.35,
|
|
70
|
+
nestedProbability: 0,
|
|
71
|
+
cellInset: 0,
|
|
72
|
+
splitBias: [0.35, 0.65],
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Fast deterministic PRNG (Mulberry32).
|
|
77
|
+
*/
|
|
78
|
+
function mulberry32(seed) {
|
|
79
|
+
let s = Math.floor(seed) || 1;
|
|
80
|
+
return () => {
|
|
81
|
+
s |= 0;
|
|
82
|
+
s = (s + 0x6d2b79f5) | 0;
|
|
83
|
+
let t = Math.imul(s ^ (s >>> 15), 1 | s);
|
|
84
|
+
t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t;
|
|
85
|
+
return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Compute the recursive partition tree over the bounding rectangle.
|
|
90
|
+
*/
|
|
91
|
+
export function partitionSubdivision(opts = {}) {
|
|
92
|
+
const x = opts.bounds?.x ?? 0;
|
|
93
|
+
const y = opts.bounds?.y ?? 0;
|
|
94
|
+
const w = opts.bounds?.width ?? 1280;
|
|
95
|
+
const h = opts.bounds?.height ?? 720;
|
|
96
|
+
const presetName = opts.preset ?? "mondrian";
|
|
97
|
+
const presetConfig = SUBDIVISION_PRESETS[presetName] ?? SUBDIVISION_PRESETS.mondrian;
|
|
98
|
+
const maxDepth = Math.max(1, Math.min(6, opts.maxDepth ?? 4));
|
|
99
|
+
const minDepth = Math.max(1, Math.min(maxDepth, opts.minDepth ?? 2));
|
|
100
|
+
const splitBias = opts.splitBias ?? presetConfig.splitBias;
|
|
101
|
+
const ground = opts.groundColor ?? opts.palette?.ground ?? presetConfig.ground;
|
|
102
|
+
const colors = opts.accentColors ?? opts.palette?.colors ?? presetConfig.colors;
|
|
103
|
+
const colorProb = opts.colorProbability ?? presetConfig.colorProbability;
|
|
104
|
+
const nestedProb = opts.nestedProbability ?? presetConfig.nestedProbability;
|
|
105
|
+
const rng = mulberry32(opts.seed ?? 42);
|
|
106
|
+
const leaves = [];
|
|
107
|
+
const dividers = [];
|
|
108
|
+
let restCellSelected = false;
|
|
109
|
+
function subdivide(cx, cy, cw, ch, depth, allowRestCandidate) {
|
|
110
|
+
const minCellDim = 32;
|
|
111
|
+
const canSubdivide = depth < maxDepth && cw > minCellDim * 2 && ch > minCellDim * 2;
|
|
112
|
+
// Rule: "Leave one large cell undivided as a rest for the eye."
|
|
113
|
+
// At depth 1 or 2, freeze one cell early to create asymmetric negative space.
|
|
114
|
+
if (!restCellSelected && allowRestCandidate && depth >= 1 && depth <= 2 && rng() < 0.45) {
|
|
115
|
+
restCellSelected = true;
|
|
116
|
+
leaves.push({
|
|
117
|
+
x: cx,
|
|
118
|
+
y: cy,
|
|
119
|
+
width: cw,
|
|
120
|
+
height: ch,
|
|
121
|
+
depth,
|
|
122
|
+
isLeaf: true,
|
|
123
|
+
color: ground, // Rest cell remains calm ground color
|
|
124
|
+
isRestCell: true,
|
|
125
|
+
});
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
if (!canSubdivide || (depth >= minDepth && rng() < 0.3)) {
|
|
129
|
+
// Leaf cell - Rule: "A cell either subdivides or takes a colour — never both."
|
|
130
|
+
const receivesColor = rng() < colorProb;
|
|
131
|
+
const color = receivesColor
|
|
132
|
+
? colors[Math.floor(rng() * colors.length)]
|
|
133
|
+
: ground;
|
|
134
|
+
const hasNested = receivesColor && rng() < nestedProb;
|
|
135
|
+
const nestedColor = hasNested
|
|
136
|
+
? colors[Math.floor(rng() * colors.length)]
|
|
137
|
+
: undefined;
|
|
138
|
+
leaves.push({
|
|
139
|
+
x: cx,
|
|
140
|
+
y: cy,
|
|
141
|
+
width: cw,
|
|
142
|
+
height: ch,
|
|
143
|
+
depth,
|
|
144
|
+
isLeaf: true,
|
|
145
|
+
color,
|
|
146
|
+
hasNested,
|
|
147
|
+
nestedColor,
|
|
148
|
+
});
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
// Determine split direction: bias toward splitting the longer axis
|
|
152
|
+
const splitHorizontally = ch > cw * 1.15 ? true : cw > ch * 1.15 ? false : rng() < 0.5;
|
|
153
|
+
const [minB, maxB] = splitBias;
|
|
154
|
+
const ratio = minB + rng() * (maxB - minB);
|
|
155
|
+
if (splitHorizontally) {
|
|
156
|
+
const splitY = cy + Math.round(ch * ratio);
|
|
157
|
+
dividers.push({ x0: cx, y0: splitY, x1: cx + cw, y1: splitY });
|
|
158
|
+
subdivide(cx, cy, cw, splitY - cy, depth + 1, true);
|
|
159
|
+
subdivide(cx, splitY, cw, cy + ch - splitY, depth + 1, false);
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
const splitX = cx + Math.round(cw * ratio);
|
|
163
|
+
dividers.push({ x0: splitX, y0: cy, x1: splitX, y1: cy + ch });
|
|
164
|
+
subdivide(cx, cy, splitX - cx, ch, depth + 1, true);
|
|
165
|
+
subdivide(splitX, cy, cx + cw - splitX, ch, depth + 1, false);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
subdivide(x, y, w, h, 0, false);
|
|
169
|
+
// Fallback guarantee: if rest cell was never picked, mark the largest leaf as the rest cell
|
|
170
|
+
if (!restCellSelected && leaves.length > 0) {
|
|
171
|
+
let largestIdx = 0;
|
|
172
|
+
let maxArea = 0;
|
|
173
|
+
for (let i = 0; i < leaves.length; i++) {
|
|
174
|
+
const leaf = leaves[i];
|
|
175
|
+
if (!leaf)
|
|
176
|
+
continue;
|
|
177
|
+
const area = leaf.width * leaf.height;
|
|
178
|
+
if (area > maxArea) {
|
|
179
|
+
maxArea = area;
|
|
180
|
+
largestIdx = i;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
const target = leaves[largestIdx];
|
|
184
|
+
if (target) {
|
|
185
|
+
target.color = ground;
|
|
186
|
+
target.isRestCell = true;
|
|
187
|
+
target.hasNested = false;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
return { cells: leaves, dividers };
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Generate executable Paper.js vector code for recursive quadtree / rectangular subdivision.
|
|
194
|
+
*/
|
|
195
|
+
export function generateRecursiveSubdivisionCode(opts = {}) {
|
|
196
|
+
const x = opts.bounds?.x ?? 0;
|
|
197
|
+
const y = opts.bounds?.y ?? 0;
|
|
198
|
+
const w = opts.bounds?.width ?? 1280;
|
|
199
|
+
const h = opts.bounds?.height ?? 720;
|
|
200
|
+
const presetName = opts.preset ?? "mondrian";
|
|
201
|
+
const presetConfig = SUBDIVISION_PRESETS[presetName] ?? SUBDIVISION_PRESETS.mondrian;
|
|
202
|
+
const ground = opts.groundColor ?? opts.palette?.ground ?? presetConfig.ground;
|
|
203
|
+
const dividerColor = opts.dividerColor ?? opts.palette?.dividerColor ?? presetConfig.dividerColor;
|
|
204
|
+
const dividerWidth = opts.dividerWidth ?? presetConfig.dividerWidth;
|
|
205
|
+
const cellInset = opts.cellInset ?? presetConfig.cellInset;
|
|
206
|
+
const prefix = opts.idPrefix ?? "subdiv";
|
|
207
|
+
const { cells, dividers } = partitionSubdivision(opts);
|
|
208
|
+
const serializedCells = JSON.stringify(cells);
|
|
209
|
+
const serializedDividers = JSON.stringify(dividers);
|
|
210
|
+
return `// Recursive Quadtree Subdivision Vector Generator (${presetName})
|
|
211
|
+
(function() {
|
|
212
|
+
const items = [];
|
|
213
|
+
const prefix = "${prefix}";
|
|
214
|
+
const cellInset = ${cellInset};
|
|
215
|
+
const dividerWidth = ${dividerWidth};
|
|
216
|
+
const dividerColor = "${dividerColor}";
|
|
217
|
+
const groundColor = "${ground}";
|
|
218
|
+
|
|
219
|
+
// 1. Solid Ground Backdrop
|
|
220
|
+
const bg = new paper.Path.Rectangle({
|
|
221
|
+
point: [${x}, ${y}],
|
|
222
|
+
size: [${w}, ${h}],
|
|
223
|
+
fillColor: groundColor,
|
|
224
|
+
strokeColor: null
|
|
225
|
+
});
|
|
226
|
+
if (typeof app.registerItem === "function") {
|
|
227
|
+
app.registerItem(bg, prefix + "_backdrop", { source: "recursive_subdivision", role: "backdrop" });
|
|
228
|
+
}
|
|
229
|
+
items.push(bg);
|
|
230
|
+
|
|
231
|
+
// 2. Leaf Color Blocks & Nested Accents
|
|
232
|
+
const cells = ${serializedCells};
|
|
233
|
+
for (let i = 0; i < cells.length; i++) {
|
|
234
|
+
const c = cells[i];
|
|
235
|
+
const ix = c.x + cellInset;
|
|
236
|
+
const iy = c.y + cellInset;
|
|
237
|
+
const iw = Math.max(1, c.width - cellInset * 2);
|
|
238
|
+
const ih = Math.max(1, c.height - cellInset * 2);
|
|
239
|
+
|
|
240
|
+
if (c.color && c.color !== groundColor) {
|
|
241
|
+
const rect = new paper.Path.Rectangle({
|
|
242
|
+
point: [ix, iy],
|
|
243
|
+
size: [iw, ih],
|
|
244
|
+
fillColor: c.color,
|
|
245
|
+
strokeColor: null
|
|
246
|
+
});
|
|
247
|
+
const cellId = prefix + "_cell_" + i;
|
|
248
|
+
if (typeof app.registerItem === "function") {
|
|
249
|
+
app.registerItem(rect, cellId, {
|
|
250
|
+
source: "recursive_subdivision",
|
|
251
|
+
depth: c.depth,
|
|
252
|
+
isRestCell: Boolean(c.isRestCell)
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
items.push(rect);
|
|
256
|
+
|
|
257
|
+
// Optional nested accent box
|
|
258
|
+
if (c.hasNested && c.nestedColor && iw > 24 && ih > 24) {
|
|
259
|
+
const nestInset = Math.min(iw, ih) * 0.22;
|
|
260
|
+
const nestRect = new paper.Path.Rectangle({
|
|
261
|
+
point: [ix + nestInset, iy + nestInset],
|
|
262
|
+
size: [iw - nestInset * 2, ih - nestInset * 2],
|
|
263
|
+
fillColor: c.nestedColor,
|
|
264
|
+
strokeColor: null
|
|
265
|
+
});
|
|
266
|
+
const nestId = prefix + "_cell_" + i + "_nested";
|
|
267
|
+
if (typeof app.registerItem === "function") {
|
|
268
|
+
app.registerItem(nestRect, nestId, { source: "recursive_subdivision", role: "nested" });
|
|
269
|
+
}
|
|
270
|
+
items.push(nestRect);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
// 3. Orthogonal Divider Grid Lines
|
|
276
|
+
if (dividerWidth > 0) {
|
|
277
|
+
const dividers = ${serializedDividers};
|
|
278
|
+
for (let j = 0; j < dividers.length; j++) {
|
|
279
|
+
const d = dividers[j];
|
|
280
|
+
const line = new paper.Path.Line({
|
|
281
|
+
from: [d.x0, d.y0],
|
|
282
|
+
to: [d.x1, d.y1],
|
|
283
|
+
strokeColor: dividerColor,
|
|
284
|
+
strokeWidth: dividerWidth,
|
|
285
|
+
strokeCap: "square"
|
|
286
|
+
});
|
|
287
|
+
const divId = prefix + "_divider_" + j;
|
|
288
|
+
if (typeof app.registerItem === "function") {
|
|
289
|
+
app.registerItem(line, divId, { source: "recursive_subdivision", role: "divider" });
|
|
290
|
+
}
|
|
291
|
+
items.push(line);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
// Outer border frame
|
|
295
|
+
const frame = new paper.Path.Rectangle({
|
|
296
|
+
point: [${x}, ${y}],
|
|
297
|
+
size: [${w}, ${h}],
|
|
298
|
+
fillColor: null,
|
|
299
|
+
strokeColor: dividerColor,
|
|
300
|
+
strokeWidth: dividerWidth * 1.5
|
|
301
|
+
});
|
|
302
|
+
if (typeof app.registerItem === "function") {
|
|
303
|
+
app.registerItem(frame, prefix + "_frame", { source: "recursive_subdivision", role: "frame" });
|
|
304
|
+
}
|
|
305
|
+
items.push(frame);
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
const group = new paper.Group(items);
|
|
309
|
+
if (typeof app.registerItem === "function") {
|
|
310
|
+
app.registerItem(group, prefix + "_group", {
|
|
311
|
+
source: "recursive_subdivision",
|
|
312
|
+
cellCount: cells.length,
|
|
313
|
+
preset: "${presetName}"
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
return group;
|
|
317
|
+
})();`;
|
|
318
|
+
}
|
|
319
|
+
//# sourceMappingURL=recursive-subdivision-generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recursive-subdivision-generator.js","sourceRoot":"","sources":["../../../src/vendor/design/recursive-subdivision-generator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH;;;;;;;;;;GAUG;AAgDH,6DAA6D;AAC7D,MAAM,CAAC,MAAM,mBAAmB,GAY5B;IACF,QAAQ,EAAE;QACR,MAAM,EAAE,SAAS;QACjB,MAAM,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC,EAAE,wCAAwC;QAC9F,YAAY,EAAE,SAAS;QACvB,YAAY,EAAE,CAAC;QACf,gBAAgB,EAAE,IAAI;QACtB,iBAAiB,EAAE,CAAC;QACpB,SAAS,EAAE,CAAC;QACZ,SAAS,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC;KACxB;IACD,KAAK,EAAE;QACL,MAAM,EAAE,SAAS;QACjB,MAAM,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC;QAC/D,YAAY,EAAE,SAAS;QACvB,YAAY,EAAE,GAAG;QACjB,gBAAgB,EAAE,IAAI;QACtB,iBAAiB,EAAE,IAAI;QACvB,SAAS,EAAE,CAAC;QACZ,SAAS,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC;KACtB;IACD,OAAO,EAAE;QACP,MAAM,EAAE,SAAS,EAAE,iBAAiB;QACpC,MAAM,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC;QAC/D,YAAY,EAAE,SAAS;QACvB,YAAY,EAAE,CAAC;QACf,gBAAgB,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YAAY,CAAC,YAAY,CAAC;IAClG,MAAM,YAAY,GAAG,IAAI,CAAC,YAAY,IAAI,YAAY,CAAC,YAAY,CAAC;IACpE,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,IAAI,YAAY,CAAC,SAAS,CAAC;IAC3D,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC;IAEzC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,oBAAoB,CAAC,IAAI,CAAC,CAAC;IACvD,MAAM,eAAe,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAC9C,MAAM,kBAAkB,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IAEpD,OAAO,uDAAuD,UAAU;;;oBAGtD,MAAM;sBACJ,SAAS;yBACN,YAAY;0BACX,YAAY;yBACb,MAAM;;;;cAIjB,CAAC,KAAK,CAAC;aACR,CAAC,KAAK,CAAC;;;;;;;;;;kBAUF,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBA6CV,kBAAkB;;;;;;;;;;;;;;;;;;;gBAmBzB,CAAC,KAAK,CAAC;eACR,CAAC,KAAK,CAAC;;;;;;;;;;;;;;;;iBAgBL,UAAU;;;;MAIrB,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vector textile and knot generation engine.
|
|
3
|
+
*
|
|
4
|
+
* Compiles declarative weave topologies (Plain/Tabby, Twill/Herringbone, Basketweave)
|
|
5
|
+
* and three-dimensional embroidered knots (French knots, bullion coils, rosette anchors)
|
|
6
|
+
* into mathematically clean, executable Paper.js vector geometry.
|
|
7
|
+
*/
|
|
8
|
+
export interface WeaveBounds {
|
|
9
|
+
x?: number;
|
|
10
|
+
y?: number;
|
|
11
|
+
width?: number;
|
|
12
|
+
height?: number;
|
|
13
|
+
}
|
|
14
|
+
export interface PlainWeaveOptions {
|
|
15
|
+
bounds?: WeaveBounds;
|
|
16
|
+
warpColor?: string;
|
|
17
|
+
weftColor?: string;
|
|
18
|
+
pitch?: number;
|
|
19
|
+
density?: number;
|
|
20
|
+
threadWidth?: number;
|
|
21
|
+
threadThickness?: number;
|
|
22
|
+
slubJitter?: number;
|
|
23
|
+
opacity?: number;
|
|
24
|
+
idPrefix?: string;
|
|
25
|
+
}
|
|
26
|
+
export interface TwillWeaveOptions {
|
|
27
|
+
bounds?: WeaveBounds;
|
|
28
|
+
warpColor?: string;
|
|
29
|
+
weftColor?: string;
|
|
30
|
+
pitch?: number;
|
|
31
|
+
density?: number;
|
|
32
|
+
threadWidth?: number;
|
|
33
|
+
threadThickness?: number;
|
|
34
|
+
floatRatio?: number;
|
|
35
|
+
herringbone?: boolean;
|
|
36
|
+
twillVariant?: "standard" | "herringbone" | string;
|
|
37
|
+
chevronWidth?: number;
|
|
38
|
+
opacity?: number;
|
|
39
|
+
idPrefix?: string;
|
|
40
|
+
}
|
|
41
|
+
export interface BasketWeaveOptions {
|
|
42
|
+
bounds?: WeaveBounds;
|
|
43
|
+
colorA?: string;
|
|
44
|
+
colorB?: string;
|
|
45
|
+
warpColor?: string;
|
|
46
|
+
weftColor?: string;
|
|
47
|
+
bundleThreads?: number;
|
|
48
|
+
bundleSize?: number;
|
|
49
|
+
bundleGap?: number;
|
|
50
|
+
threadWidth?: number;
|
|
51
|
+
threadThickness?: number;
|
|
52
|
+
pitch?: number;
|
|
53
|
+
density?: number;
|
|
54
|
+
opacity?: number;
|
|
55
|
+
idPrefix?: string;
|
|
56
|
+
}
|
|
57
|
+
export interface KnotItem {
|
|
58
|
+
x: number;
|
|
59
|
+
y: number;
|
|
60
|
+
radius?: number;
|
|
61
|
+
color?: string;
|
|
62
|
+
highlightColor?: string;
|
|
63
|
+
shadowColor?: string;
|
|
64
|
+
length?: number;
|
|
65
|
+
angle?: number;
|
|
66
|
+
}
|
|
67
|
+
export interface KnotOptions {
|
|
68
|
+
knotType?: "french_knot" | "bullion_roll" | "knot_anchor" | string;
|
|
69
|
+
knots?: KnotItem[];
|
|
70
|
+
points?: KnotItem[];
|
|
71
|
+
bounds?: WeaveBounds;
|
|
72
|
+
density?: number;
|
|
73
|
+
defaultRadius?: number;
|
|
74
|
+
threadColor?: string;
|
|
75
|
+
defaultColor?: string;
|
|
76
|
+
highlightColor?: string;
|
|
77
|
+
defaultHighlight?: string;
|
|
78
|
+
shadowColor?: string;
|
|
79
|
+
defaultShadow?: string;
|
|
80
|
+
idPrefix?: string;
|
|
81
|
+
}
|
|
82
|
+
export type WeaveParams = PlainWeaveOptions & TwillWeaveOptions & BasketWeaveOptions & {
|
|
83
|
+
weave?: "plain" | "twill" | "basket" | "herringbone" | string;
|
|
84
|
+
twillVariant?: string;
|
|
85
|
+
variant?: string;
|
|
86
|
+
};
|
|
87
|
+
export type KnotParams = KnotOptions;
|
|
88
|
+
export interface SashikoOptions {
|
|
89
|
+
bounds?: WeaveBounds;
|
|
90
|
+
pattern?: "seigaiha" | "asanoha" | "hishi" | "kaki_no_hana" | string;
|
|
91
|
+
stitchLength?: number;
|
|
92
|
+
gapLength?: number;
|
|
93
|
+
threadWidth?: number;
|
|
94
|
+
threadThickness?: number;
|
|
95
|
+
threadColor?: string;
|
|
96
|
+
groundColor?: string;
|
|
97
|
+
scale?: number;
|
|
98
|
+
gridSize?: number;
|
|
99
|
+
concentricArcs?: number;
|
|
100
|
+
vertexGap?: number;
|
|
101
|
+
opacity?: number;
|
|
102
|
+
idPrefix?: string;
|
|
103
|
+
}
|
|
104
|
+
export type SashikoParams = SashikoOptions;
|
|
105
|
+
export interface TextileOptions {
|
|
106
|
+
type?: "plain" | "twill" | "herringbone" | "basket" | "knots" | "french_knot" | "bullion_roll" | "knot_anchor" | "sashiko" | string;
|
|
107
|
+
weave?: string;
|
|
108
|
+
pattern?: string;
|
|
109
|
+
bounds?: WeaveBounds;
|
|
110
|
+
[key: string]: unknown;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Generate Paper.js code for a Plain (Tabby) Weave.
|
|
114
|
+
* Warp and weft threads alternate over and under using complementary dashArray offsets.
|
|
115
|
+
*/
|
|
116
|
+
export declare function generatePlainWeaveCode(opts?: PlainWeaveOptions): string;
|
|
117
|
+
/**
|
|
118
|
+
* Generate Paper.js code for a Twill / Herringbone Weave.
|
|
119
|
+
* Stepped float ratios produce diagonal ridges with optional chevron direction reversals.
|
|
120
|
+
*/
|
|
121
|
+
export declare function generateTwillWeaveCode(opts?: TwillWeaveOptions): string;
|
|
122
|
+
/**
|
|
123
|
+
* Generate Paper.js code for a Basketweave (Panama) pattern.
|
|
124
|
+
* Groups of parallel threads interlace together as square blocks.
|
|
125
|
+
*/
|
|
126
|
+
export declare function generateBasketWeaveCode(opts?: BasketWeaveOptions): string;
|
|
127
|
+
/**
|
|
128
|
+
* Generate Paper.js code for tactile 3D Embroidered Knots (French knots, bullion coils, knot anchors).
|
|
129
|
+
*/
|
|
130
|
+
export declare function generateKnotCode(opts?: KnotOptions): string;
|
|
131
|
+
/**
|
|
132
|
+
* Generate Paper.js code for Japanese Sashiko geometric folk embroidery.
|
|
133
|
+
* Enforces authentic vertex gaps (running stitches do not collide at intersection nodes).
|
|
134
|
+
*/
|
|
135
|
+
export declare function generateSashikoCode(opts?: SashikoOptions): string;
|
|
136
|
+
/**
|
|
137
|
+
* Master dispatcher for textile and embroidery vector code generation.
|
|
138
|
+
*/
|
|
139
|
+
export declare function generateTextileCode(opts: TextileOptions): string;
|
|
140
|
+
//# sourceMappingURL=textile-weave-generator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"textile-weave-generator.d.ts","sourceRoot":"","sources":["../../../src/vendor/design/textile-weave-generator.ts"],"names":[],"mappings":"AAUA;;;;;;GAMG;AAEH,MAAM,WAAW,WAAW;IAC1B,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM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