@fleox/agentphoto 0.0.0-stage → 0.1.1
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/LICENSE +143 -0
- package/README.md +334 -2
- package/changelog.json +35 -0
- package/dist/agent/agentphoto.mjs +3354 -0
- package/dist/agent/chunks/assets-BZVUUHjg.mjs +151 -0
- package/dist/agent/chunks/catalog-DIZ5dnH5.mjs +953 -0
- package/dist/agent/chunks/context-CNpRboiC.mjs +75 -0
- package/dist/agent/chunks/doc-D_v_yE07.mjs +512 -0
- package/dist/agent/chunks/export-aNJcPNbJ.mjs +140 -0
- package/dist/agent/chunks/geometry-BKIhUO9x.mjs +315 -0
- package/dist/agent/chunks/ids-DAmiNwd9.mjs +28 -0
- package/dist/agent/chunks/imageInfo-QxAfu8R6.mjs +173 -0
- package/dist/agent/chunks/jsonPath-B7vAPXsi.mjs +155 -0
- package/dist/agent/chunks/library-C_EXiphj.mjs +16 -0
- package/dist/agent/chunks/models-CxrjmA0W.mjs +387 -0
- package/dist/agent/chunks/output-3F12IR9O.mjs +130 -0
- package/dist/agent/chunks/package-Cu1GyvKL.mjs +71 -0
- package/dist/agent/chunks/project-o1DH2nOw.mjs +200 -0
- package/dist/agent/chunks/rolldown-runtime-CMQPkI6i.mjs +18 -0
- package/dist/agent/chunks/server-I0trf5tM.mjs +241 -0
- package/dist/agent/chunks/templates-BJ2me4XZ.mjs +61 -0
- package/dist/agent/chunks/tools-DKaAPEV5.mjs +1419 -0
- package/dist/agent/chunks/tree-D8qZKPAb.mjs +127 -0
- package/dist/agent/chunks/types-DOK7tAAu.mjs +30 -0
- package/dist/agent/chunks/validate-CXPFB-i6.mjs +936 -0
- package/dist/engine/agentphoto-engine.js +2833 -0
- package/dist/engine/chunks/transformers.web-D5Vsg6-A.js +18494 -0
- package/dist/engine/ort/ort-wasm-simd-threaded.asyncify.mjs +124 -0
- package/dist/engine/ort/ort-wasm-simd-threaded.asyncify.wasm +0 -0
- package/dist/studio/assets/index-CmOzzoXv.css +1 -0
- package/dist/studio/assets/index-D3Iw5q8v.js +28 -0
- package/dist/studio/assets/transformers.web-osEqoMhg.js +38 -0
- package/dist/studio/index.html +15 -0
- package/dist/studio/library/LICENSES.md +57 -0
- package/dist/studio/library/fonts/OFL.txt +90 -0
- package/dist/studio/library/fonts/anton/anton-latin-400-normal.woff2 +0 -0
- package/dist/studio/library/fonts/anton/anton-latin-ext-400-normal.woff2 +0 -0
- package/dist/studio/library/fonts/archivo-black/archivo-black-latin-400-normal.woff2 +0 -0
- package/dist/studio/library/fonts/archivo-black/archivo-black-latin-ext-400-normal.woff2 +0 -0
- package/dist/studio/library/fonts/bebas-neue/bebas-neue-latin-400-normal.woff2 +0 -0
- package/dist/studio/library/fonts/bebas-neue/bebas-neue-latin-ext-400-normal.woff2 +0 -0
- package/dist/studio/library/fonts/caveat/caveat-latin-400-normal.woff2 +0 -0
- package/dist/studio/library/fonts/caveat/caveat-latin-700-normal.woff2 +0 -0
- package/dist/studio/library/fonts/caveat/caveat-latin-ext-400-normal.woff2 +0 -0
- package/dist/studio/library/fonts/caveat/caveat-latin-ext-700-normal.woff2 +0 -0
- package/dist/studio/library/fonts/dm-serif/dm-serif-display-latin-400-normal.woff2 +0 -0
- package/dist/studio/library/fonts/dm-serif/dm-serif-display-latin-ext-400-normal.woff2 +0 -0
- package/dist/studio/library/fonts/inter/inter-latin-400-normal.woff2 +0 -0
- package/dist/studio/library/fonts/inter/inter-latin-600-normal.woff2 +0 -0
- package/dist/studio/library/fonts/inter/inter-latin-700-normal.woff2 +0 -0
- package/dist/studio/library/fonts/inter/inter-latin-800-normal.woff2 +0 -0
- package/dist/studio/library/fonts/inter/inter-latin-ext-400-normal.woff2 +0 -0
- package/dist/studio/library/fonts/inter/inter-latin-ext-600-normal.woff2 +0 -0
- package/dist/studio/library/fonts/inter/inter-latin-ext-700-normal.woff2 +0 -0
- package/dist/studio/library/fonts/inter/inter-latin-ext-800-normal.woff2 +0 -0
- package/dist/studio/library/fonts/jetbrains-mono/jetbrains-mono-latin-400-normal.woff2 +0 -0
- package/dist/studio/library/fonts/jetbrains-mono/jetbrains-mono-latin-700-normal.woff2 +0 -0
- package/dist/studio/library/fonts/jetbrains-mono/jetbrains-mono-latin-ext-400-normal.woff2 +0 -0
- package/dist/studio/library/fonts/jetbrains-mono/jetbrains-mono-latin-ext-700-normal.woff2 +0 -0
- package/dist/studio/library/fonts/lobster/lobster-latin-400-normal.woff2 +0 -0
- package/dist/studio/library/fonts/lobster/lobster-latin-ext-400-normal.woff2 +0 -0
- package/dist/studio/library/fonts/montserrat/montserrat-latin-400-normal.woff2 +0 -0
- package/dist/studio/library/fonts/montserrat/montserrat-latin-700-normal.woff2 +0 -0
- package/dist/studio/library/fonts/montserrat/montserrat-latin-800-normal.woff2 +0 -0
- package/dist/studio/library/fonts/montserrat/montserrat-latin-ext-400-normal.woff2 +0 -0
- package/dist/studio/library/fonts/montserrat/montserrat-latin-ext-700-normal.woff2 +0 -0
- package/dist/studio/library/fonts/montserrat/montserrat-latin-ext-800-normal.woff2 +0 -0
- package/dist/studio/library/fonts/oswald/oswald-latin-400-normal.woff2 +0 -0
- package/dist/studio/library/fonts/oswald/oswald-latin-600-normal.woff2 +0 -0
- package/dist/studio/library/fonts/oswald/oswald-latin-ext-400-normal.woff2 +0 -0
- package/dist/studio/library/fonts/oswald/oswald-latin-ext-600-normal.woff2 +0 -0
- package/dist/studio/library/fonts/pacifico/pacifico-latin-400-normal.woff2 +0 -0
- package/dist/studio/library/fonts/pacifico/pacifico-latin-ext-400-normal.woff2 +0 -0
- package/dist/studio/library/fonts/playfair/playfair-display-latin-400-italic.woff2 +0 -0
- package/dist/studio/library/fonts/playfair/playfair-display-latin-400-normal.woff2 +0 -0
- package/dist/studio/library/fonts/playfair/playfair-display-latin-700-normal.woff2 +0 -0
- package/dist/studio/library/fonts/playfair/playfair-display-latin-ext-400-italic.woff2 +0 -0
- package/dist/studio/library/fonts/playfair/playfair-display-latin-ext-400-normal.woff2 +0 -0
- package/dist/studio/library/fonts/playfair/playfair-display-latin-ext-700-normal.woff2 +0 -0
- package/dist/studio/library/fonts/poppins/poppins-latin-400-normal.woff2 +0 -0
- package/dist/studio/library/fonts/poppins/poppins-latin-600-normal.woff2 +0 -0
- package/dist/studio/library/fonts/poppins/poppins-latin-700-normal.woff2 +0 -0
- package/dist/studio/library/fonts/poppins/poppins-latin-ext-400-normal.woff2 +0 -0
- package/dist/studio/library/fonts/poppins/poppins-latin-ext-600-normal.woff2 +0 -0
- package/dist/studio/library/fonts/poppins/poppins-latin-ext-700-normal.woff2 +0 -0
- package/dist/studio/library/fonts/roboto-slab/LICENSE.txt +202 -0
- package/dist/studio/library/fonts/roboto-slab/roboto-slab-latin-400-normal.woff2 +0 -0
- package/dist/studio/library/fonts/roboto-slab/roboto-slab-latin-700-normal.woff2 +0 -0
- package/dist/studio/library/fonts/roboto-slab/roboto-slab-latin-ext-400-normal.woff2 +0 -0
- package/dist/studio/library/fonts/roboto-slab/roboto-slab-latin-ext-700-normal.woff2 +0 -0
- package/dist/studio/library/fonts/space-grotesk/space-grotesk-latin-500-normal.woff2 +0 -0
- package/dist/studio/library/fonts/space-grotesk/space-grotesk-latin-700-normal.woff2 +0 -0
- package/dist/studio/library/fonts/space-grotesk/space-grotesk-latin-ext-500-normal.woff2 +0 -0
- package/dist/studio/library/fonts/space-grotesk/space-grotesk-latin-ext-700-normal.woff2 +0 -0
- package/dist/studio/library/images/city.jpg +0 -0
- package/dist/studio/library/images/food.jpg +0 -0
- package/dist/studio/library/images/landscape.jpg +0 -0
- package/dist/studio/library/images/pet.jpg +0 -0
- package/dist/studio/library/images/portrait.jpg +0 -0
- package/dist/studio/library/images/product.jpg +0 -0
- package/dist/studio/library/index.json +752 -0
- package/dist/studio/templates/avatar-pro/assets/masks/photo-cutout.png +0 -0
- package/dist/studio/templates/avatar-pro/photo.json +13 -0
- package/dist/studio/templates/avatar-pro/preview.jpg +0 -0
- package/dist/studio/templates/avatar-pro/template.json +1 -0
- package/dist/studio/templates/index.json +1 -0
- package/dist/studio/templates/og-article/photo.json +13 -0
- package/dist/studio/templates/og-article/preview.jpg +0 -0
- package/dist/studio/templates/og-article/template.json +1 -0
- package/dist/studio/templates/polaroid/photo.json +13 -0
- package/dist/studio/templates/polaroid/preview.jpg +0 -0
- package/dist/studio/templates/polaroid/template.json +1 -0
- package/dist/studio/templates/product-white/assets/masks/photo-cutout.png +0 -0
- package/dist/studio/templates/product-white/photo.json +72 -0
- package/dist/studio/templates/product-white/preview.jpg +0 -0
- package/dist/studio/templates/product-white/template.json +1 -0
- package/dist/studio/templates/sale-banner/photo.json +125 -0
- package/dist/studio/templates/sale-banner/preview.jpg +0 -0
- package/dist/studio/templates/sale-banner/template.json +1 -0
- package/dist/studio/templates/social-quote/photo.json +13 -0
- package/dist/studio/templates/social-quote/preview.jpg +0 -0
- package/dist/studio/templates/social-quote/template.json +1 -0
- package/dist/studio/templates/story-promo/photo.json +13 -0
- package/dist/studio/templates/story-promo/preview.jpg +0 -0
- package/dist/studio/templates/story-promo/template.json +1 -0
- package/dist/studio/templates/youtube-thumbnail/photo.json +12 -0
- package/dist/studio/templates/youtube-thumbnail/preview.jpg +0 -0
- package/dist/studio/templates/youtube-thumbnail/template.json +1 -0
- package/library/LICENSES.md +57 -0
- package/library/fonts/OFL.txt +90 -0
- package/library/fonts/anton/anton-latin-400-normal.woff2 +0 -0
- package/library/fonts/anton/anton-latin-ext-400-normal.woff2 +0 -0
- package/library/fonts/archivo-black/archivo-black-latin-400-normal.woff2 +0 -0
- package/library/fonts/archivo-black/archivo-black-latin-ext-400-normal.woff2 +0 -0
- package/library/fonts/bebas-neue/bebas-neue-latin-400-normal.woff2 +0 -0
- package/library/fonts/bebas-neue/bebas-neue-latin-ext-400-normal.woff2 +0 -0
- package/library/fonts/caveat/caveat-latin-400-normal.woff2 +0 -0
- package/library/fonts/caveat/caveat-latin-700-normal.woff2 +0 -0
- package/library/fonts/caveat/caveat-latin-ext-400-normal.woff2 +0 -0
- package/library/fonts/caveat/caveat-latin-ext-700-normal.woff2 +0 -0
- package/library/fonts/dm-serif/dm-serif-display-latin-400-normal.woff2 +0 -0
- package/library/fonts/dm-serif/dm-serif-display-latin-ext-400-normal.woff2 +0 -0
- package/library/fonts/inter/inter-latin-400-normal.woff2 +0 -0
- package/library/fonts/inter/inter-latin-600-normal.woff2 +0 -0
- package/library/fonts/inter/inter-latin-700-normal.woff2 +0 -0
- package/library/fonts/inter/inter-latin-800-normal.woff2 +0 -0
- package/library/fonts/inter/inter-latin-ext-400-normal.woff2 +0 -0
- package/library/fonts/inter/inter-latin-ext-600-normal.woff2 +0 -0
- package/library/fonts/inter/inter-latin-ext-700-normal.woff2 +0 -0
- package/library/fonts/inter/inter-latin-ext-800-normal.woff2 +0 -0
- package/library/fonts/jetbrains-mono/jetbrains-mono-latin-400-normal.woff2 +0 -0
- package/library/fonts/jetbrains-mono/jetbrains-mono-latin-700-normal.woff2 +0 -0
- package/library/fonts/jetbrains-mono/jetbrains-mono-latin-ext-400-normal.woff2 +0 -0
- package/library/fonts/jetbrains-mono/jetbrains-mono-latin-ext-700-normal.woff2 +0 -0
- package/library/fonts/lobster/lobster-latin-400-normal.woff2 +0 -0
- package/library/fonts/lobster/lobster-latin-ext-400-normal.woff2 +0 -0
- package/library/fonts/montserrat/montserrat-latin-400-normal.woff2 +0 -0
- package/library/fonts/montserrat/montserrat-latin-700-normal.woff2 +0 -0
- package/library/fonts/montserrat/montserrat-latin-800-normal.woff2 +0 -0
- package/library/fonts/montserrat/montserrat-latin-ext-400-normal.woff2 +0 -0
- package/library/fonts/montserrat/montserrat-latin-ext-700-normal.woff2 +0 -0
- package/library/fonts/montserrat/montserrat-latin-ext-800-normal.woff2 +0 -0
- package/library/fonts/oswald/oswald-latin-400-normal.woff2 +0 -0
- package/library/fonts/oswald/oswald-latin-600-normal.woff2 +0 -0
- package/library/fonts/oswald/oswald-latin-ext-400-normal.woff2 +0 -0
- package/library/fonts/oswald/oswald-latin-ext-600-normal.woff2 +0 -0
- package/library/fonts/pacifico/pacifico-latin-400-normal.woff2 +0 -0
- package/library/fonts/pacifico/pacifico-latin-ext-400-normal.woff2 +0 -0
- package/library/fonts/playfair/playfair-display-latin-400-italic.woff2 +0 -0
- package/library/fonts/playfair/playfair-display-latin-400-normal.woff2 +0 -0
- package/library/fonts/playfair/playfair-display-latin-700-normal.woff2 +0 -0
- package/library/fonts/playfair/playfair-display-latin-ext-400-italic.woff2 +0 -0
- package/library/fonts/playfair/playfair-display-latin-ext-400-normal.woff2 +0 -0
- package/library/fonts/playfair/playfair-display-latin-ext-700-normal.woff2 +0 -0
- package/library/fonts/poppins/poppins-latin-400-normal.woff2 +0 -0
- package/library/fonts/poppins/poppins-latin-600-normal.woff2 +0 -0
- package/library/fonts/poppins/poppins-latin-700-normal.woff2 +0 -0
- package/library/fonts/poppins/poppins-latin-ext-400-normal.woff2 +0 -0
- package/library/fonts/poppins/poppins-latin-ext-600-normal.woff2 +0 -0
- package/library/fonts/poppins/poppins-latin-ext-700-normal.woff2 +0 -0
- package/library/fonts/roboto-slab/LICENSE.txt +202 -0
- package/library/fonts/roboto-slab/roboto-slab-latin-400-normal.woff2 +0 -0
- package/library/fonts/roboto-slab/roboto-slab-latin-700-normal.woff2 +0 -0
- package/library/fonts/roboto-slab/roboto-slab-latin-ext-400-normal.woff2 +0 -0
- package/library/fonts/roboto-slab/roboto-slab-latin-ext-700-normal.woff2 +0 -0
- package/library/fonts/space-grotesk/space-grotesk-latin-500-normal.woff2 +0 -0
- package/library/fonts/space-grotesk/space-grotesk-latin-700-normal.woff2 +0 -0
- package/library/fonts/space-grotesk/space-grotesk-latin-ext-500-normal.woff2 +0 -0
- package/library/fonts/space-grotesk/space-grotesk-latin-ext-700-normal.woff2 +0 -0
- package/library/images/city.jpg +0 -0
- package/library/images/food.jpg +0 -0
- package/library/images/landscape.jpg +0 -0
- package/library/images/pet.jpg +0 -0
- package/library/images/portrait.jpg +0 -0
- package/library/images/product.jpg +0 -0
- package/library/index.json +752 -0
- package/package.json +65 -4
- package/plugin/.claude-plugin/plugin.json +19 -0
- package/plugin/skills/agentphoto-cutout/SKILL.md +137 -0
- package/plugin/skills/agentphoto-design/SKILL.md +104 -0
- package/plugin/skills/agentphoto-design/references/layouts.md +60 -0
- package/plugin/skills/agentphoto-publish/SKILL.md +79 -0
- package/plugin/skills/agentphoto-retouch/SKILL.md +144 -0
- package/plugin/skills/agentphoto-retouch/references/filters.md +51 -0
- package/plugin/skills/agentphoto-retouch/references/patch-ops.md +67 -0
- package/plugin/skills/agentphoto-retouch/references/recipes.md +129 -0
- package/templates/avatar-pro/assets/masks/photo-cutout.png +0 -0
- package/templates/avatar-pro/photo.json +13 -0
- package/templates/avatar-pro/preview.jpg +0 -0
- package/templates/avatar-pro/template.json +1 -0
- package/templates/og-article/photo.json +13 -0
- package/templates/og-article/preview.jpg +0 -0
- package/templates/og-article/template.json +1 -0
- package/templates/polaroid/photo.json +13 -0
- package/templates/polaroid/preview.jpg +0 -0
- package/templates/polaroid/template.json +1 -0
- package/templates/product-white/assets/masks/photo-cutout.png +0 -0
- package/templates/product-white/photo.json +72 -0
- package/templates/product-white/preview.jpg +0 -0
- package/templates/product-white/template.json +1 -0
- package/templates/sale-banner/photo.json +125 -0
- package/templates/sale-banner/preview.jpg +0 -0
- package/templates/sale-banner/template.json +1 -0
- package/templates/social-quote/photo.json +13 -0
- package/templates/social-quote/preview.jpg +0 -0
- package/templates/social-quote/template.json +1 -0
- package/templates/story-promo/photo.json +13 -0
- package/templates/story-promo/preview.jpg +0 -0
- package/templates/story-promo/template.json +1 -0
- package/templates/youtube-thumbnail/photo.json +12 -0
- package/templates/youtube-thumbnail/preview.jpg +0 -0
- package/templates/youtube-thumbnail/template.json +1 -0
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { createRequire as __apRequire } from "node:module";
|
|
2
|
+
import { fileURLToPath as __apPath } from "node:url";
|
|
3
|
+
import { dirname as __apDirname } from "node:path";
|
|
4
|
+
__apRequire(import.meta.url);
|
|
5
|
+
const __filename = __apPath(import.meta.url);
|
|
6
|
+
__apDirname(__filename);
|
|
7
|
+
import { t as __exportAll } from "./rolldown-runtime-CMQPkI6i.mjs";
|
|
8
|
+
import { a as isShapeMask, i as isImageMask, n as hasBox, r as isGradientMask } from "./types-DOK7tAAu.mjs";
|
|
9
|
+
// src/ops/tree.ts
|
|
10
|
+
var tree_exports = /* @__PURE__ */ __exportAll({
|
|
11
|
+
allLayerIds: () => allLayerIds,
|
|
12
|
+
findLayer: () => findLayer
|
|
13
|
+
});
|
|
14
|
+
function findLayer(layers, id, parent = null, depth = 0) {
|
|
15
|
+
if (!Array.isArray(layers)) return null;
|
|
16
|
+
for (let i = 0; i < layers.length; i++) {
|
|
17
|
+
const l = layers[i];
|
|
18
|
+
if (l && l.id === id) return {
|
|
19
|
+
layer: l,
|
|
20
|
+
parent,
|
|
21
|
+
container: layers,
|
|
22
|
+
index: i,
|
|
23
|
+
depth
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
for (const l of layers) {
|
|
27
|
+
const found = l && l.type === "group" && Array.isArray(l.children) ? findLayer(l.children, id, l, depth + 1) : null;
|
|
28
|
+
if (found) return found;
|
|
29
|
+
}
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
function walkLayers(layers, fn, parent = null, depth = 0) {
|
|
33
|
+
if (!Array.isArray(layers)) return;
|
|
34
|
+
for (const l of layers) {
|
|
35
|
+
if (!l || typeof l !== "object") continue;
|
|
36
|
+
if (fn(l, parent, depth) === false) continue;
|
|
37
|
+
if (l.type === "group") walkLayers(l.children, fn, l, depth + 1);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function allLayerIds(doc) {
|
|
41
|
+
const ids = [];
|
|
42
|
+
walkLayers(doc.layers, (l) => void ids.push(l.id));
|
|
43
|
+
return ids;
|
|
44
|
+
}
|
|
45
|
+
function isDescendant(ancestor, id) {
|
|
46
|
+
return ancestor.type === "group" && !!findLayer(ancestor.children, id);
|
|
47
|
+
}
|
|
48
|
+
var short = (s, n = 40) => s.length > n ? `${s.slice(0, n - 1)}…` : s;
|
|
49
|
+
function layerDetail(l) {
|
|
50
|
+
switch (l.type) {
|
|
51
|
+
case "image": return `${l.src}${l.fit && l.fit !== "fill" ? ` (${l.fit})` : ""}`;
|
|
52
|
+
case "text": return `${JSON.stringify(short(String(l.text ?? "")))} (${l.font ?? "inter"} ${l.size ?? 64})`;
|
|
53
|
+
case "shape": return `${l.shape}${typeof l.fill === "string" ? ` ${l.fill}` : l.fill ? " gradient" : ""}`;
|
|
54
|
+
case "fill": return typeof l.fill === "string" ? l.fill : `${l.fill?.type ?? "?"} gradient`;
|
|
55
|
+
case "adjustment": return l.filters?.length ? "filters the layers below" : "(empty)";
|
|
56
|
+
case "group": return `${l.children?.length ?? 0} layers`;
|
|
57
|
+
default: return "";
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function maskKind(l) {
|
|
61
|
+
const m = l.mask;
|
|
62
|
+
if (!m) return void 0;
|
|
63
|
+
return isImageMask(m) ? "image" : isShapeMask(m) ? "shape" : isGradientMask(m) ? "gradient" : void 0;
|
|
64
|
+
}
|
|
65
|
+
function flatLayer(l, parent, depth, index) {
|
|
66
|
+
const out = {
|
|
67
|
+
id: l.id,
|
|
68
|
+
type: l.type,
|
|
69
|
+
detail: layerDetail(l),
|
|
70
|
+
parent: parent?.id ?? null,
|
|
71
|
+
depth,
|
|
72
|
+
index
|
|
73
|
+
};
|
|
74
|
+
if (l.name) out.name = l.name;
|
|
75
|
+
if (hasBox(l)) {
|
|
76
|
+
out.box = [
|
|
77
|
+
l.x ?? 0,
|
|
78
|
+
l.y ?? 0,
|
|
79
|
+
l.width ?? null,
|
|
80
|
+
l.height ?? null
|
|
81
|
+
];
|
|
82
|
+
if (l.rotation) out.rotation = l.rotation;
|
|
83
|
+
}
|
|
84
|
+
if (l.opacity !== void 0 && l.opacity !== 1) out.opacity = l.opacity;
|
|
85
|
+
if (l.blend && l.blend !== "normal") out.blend = l.blend;
|
|
86
|
+
if (l.visible === false) out.hidden = true;
|
|
87
|
+
if (l.locked) out.locked = true;
|
|
88
|
+
if (l.clip) out.clip = true;
|
|
89
|
+
const mk = maskKind(l);
|
|
90
|
+
if (mk) out.mask = l.mask && l.mask.enabled === false ? `${mk} (disabled)` : mk;
|
|
91
|
+
if (l.filters?.length) out.filters = l.filters.map((f) => (f.type === "look" ? `look:${String(f.look)}` : f.type) + (f.enabled === false ? " (off)" : ""));
|
|
92
|
+
if (l.effects) {
|
|
93
|
+
const fx = Object.entries(l.effects).filter(([, v]) => v).map(([k]) => k);
|
|
94
|
+
if (fx.length) out.effects = fx;
|
|
95
|
+
}
|
|
96
|
+
return out;
|
|
97
|
+
}
|
|
98
|
+
function flattenLayers(doc) {
|
|
99
|
+
const out = [];
|
|
100
|
+
const visit = (layers, parent, depth) => {
|
|
101
|
+
for (let i = layers.length - 1; i >= 0; i--) {
|
|
102
|
+
const l = layers[i];
|
|
103
|
+
if (!l || typeof l !== "object") continue;
|
|
104
|
+
out.push(flatLayer(l, parent, depth, i));
|
|
105
|
+
if (l.type === "group" && Array.isArray(l.children)) visit(l.children, l, depth + 1);
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
visit(Array.isArray(doc.layers) ? doc.layers : [], null, 0);
|
|
109
|
+
return out;
|
|
110
|
+
}
|
|
111
|
+
function referencedFiles(doc) {
|
|
112
|
+
const out = [];
|
|
113
|
+
walkLayers(doc.layers, (l) => {
|
|
114
|
+
if (l.type === "image" && typeof l.src === "string") out.push({
|
|
115
|
+
path: l.src,
|
|
116
|
+
by: l.id,
|
|
117
|
+
role: "src"
|
|
118
|
+
});
|
|
119
|
+
if (l.mask && isImageMask(l.mask) && typeof l.mask.src === "string") out.push({
|
|
120
|
+
path: l.mask.src,
|
|
121
|
+
by: l.id,
|
|
122
|
+
role: "mask"
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
return out;
|
|
126
|
+
}
|
|
127
|
+
export { layerDetail as a, tree_exports as c, isDescendant as i, walkLayers as l, findLayer as n, maskKind as o, flattenLayers as r, referencedFiles as s, allLayerIds as t };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { createRequire as __apRequire } from "node:module";
|
|
2
|
+
import { fileURLToPath as __apPath } from "node:url";
|
|
3
|
+
import { dirname as __apDirname } from "node:path";
|
|
4
|
+
__apRequire(import.meta.url);
|
|
5
|
+
const __filename = __apPath(import.meta.url);
|
|
6
|
+
__apDirname(__filename);
|
|
7
|
+
// src/core/types.ts
|
|
8
|
+
var BLEND_MODES = [
|
|
9
|
+
"normal",
|
|
10
|
+
"multiply",
|
|
11
|
+
"screen",
|
|
12
|
+
"overlay",
|
|
13
|
+
"darken",
|
|
14
|
+
"lighten",
|
|
15
|
+
"color-dodge",
|
|
16
|
+
"color-burn",
|
|
17
|
+
"hard-light",
|
|
18
|
+
"soft-light",
|
|
19
|
+
"difference",
|
|
20
|
+
"exclusion",
|
|
21
|
+
"hue",
|
|
22
|
+
"saturation",
|
|
23
|
+
"color",
|
|
24
|
+
"luminosity"
|
|
25
|
+
];
|
|
26
|
+
var hasBox = (l) => l.type === "image" || l.type === "text" || l.type === "shape";
|
|
27
|
+
var isImageMask = (m) => typeof m.src === "string";
|
|
28
|
+
var isShapeMask = (m) => typeof m.shape === "string";
|
|
29
|
+
var isGradientMask = (m) => !!m.gradient;
|
|
30
|
+
export { isShapeMask as a, isImageMask as i, hasBox as n, isGradientMask as r, BLEND_MODES as t };
|