partforge 0.138.1 → 0.138.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/package.json
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// The per-params asset DECLARATIONS a part makes — `fonts`, `images`, `vectors`, each
|
|
2
|
+
// a plain { name: source } map or a function of the resolved params (the second form
|
|
3
|
+
// is what lets a font/image/vector control drive the source). Resolving the
|
|
4
|
+
// declaration needs `p`, which is why this is its own step, separate from loading
|
|
5
|
+
// the sources (resolveFonts / ensureImages / ensureVectors).
|
|
6
|
+
//
|
|
7
|
+
// A leaf with no imports on purpose: the pose probe folds these declarations into
|
|
8
|
+
// its hash on the host page's main thread, and reaching them through vectors.js
|
|
9
|
+
// pulled in vector-format → contour-ops → paper, which builds a canvas at import
|
|
10
|
+
// (see test/mount-no-paper.test.js). fonts.js, images.js and vectors.js re-export
|
|
11
|
+
// these, so their importers are unchanged.
|
|
12
|
+
const declFor = (decl, p) => (typeof decl === "function" ? decl(p) : decl);
|
|
13
|
+
|
|
14
|
+
export function fontsFor(part, p) { return declFor(part?.fonts, p); }
|
|
15
|
+
export function imagesFor(part, p) { return declFor(part?.images, p); }
|
|
16
|
+
export function vectorsFor(part, p) { return declFor(part?.vectors, p); }
|
package/src/framework/fonts.js
CHANGED
|
@@ -17,10 +17,7 @@ const resolveOne = makeAssetResolver(
|
|
|
17
17
|
// params — the second form is what lets a `type: "font"` control drive the
|
|
18
18
|
// typeface. Resolving it needs `p`, which is why this is a separate step from
|
|
19
19
|
// resolveFonts rather than folded into it.
|
|
20
|
-
export
|
|
21
|
-
const decl = part?.fonts;
|
|
22
|
-
return typeof decl === "function" ? decl(p) : decl;
|
|
23
|
-
}
|
|
20
|
+
export { fontsFor } from "./asset-decls.js";
|
|
24
21
|
|
|
25
22
|
export async function resolveFonts(fontsDecl) {
|
|
26
23
|
// A function reaching here means a caller passed `part.fonts` raw. It cannot
|
package/src/framework/images.js
CHANGED
|
@@ -38,10 +38,7 @@ const resolveOne = makeAssetResolver(
|
|
|
38
38
|
// `images` may be a plain { name: source } map or a function of the resolved
|
|
39
39
|
// params — the second form is what lets a `type: "image"` control drive the
|
|
40
40
|
// source. Mirrors fontsFor.
|
|
41
|
-
export
|
|
42
|
-
const decl = part?.images;
|
|
43
|
-
return typeof decl === "function" ? decl(p) : decl;
|
|
44
|
-
}
|
|
41
|
+
export { imagesFor } from "./asset-decls.js";
|
|
45
42
|
|
|
46
43
|
export async function resolveImages(imagesDecl) {
|
|
47
44
|
// A function reaching here means a caller passed `part.images` raw. It
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
// without dragging in the part-model/jobs layer (purity).
|
|
5
5
|
import { probeSubPartPose } from "./pose-probe-core.js";
|
|
6
6
|
import { viewSubParts, resolveParams } from "./part-model.js";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
import { vectorsFor } from "./
|
|
7
|
+
// From the import-free leaf, never fonts/images/vectors.js: vectors.js reaches paper
|
|
8
|
+
// (test/mount-no-paper.test.js).
|
|
9
|
+
import { fontsFor, imagesFor, vectorsFor } from "./asset-decls.js";
|
|
10
10
|
import { h, byteAwareReplacer } from "./geometry/solid-hash.js";
|
|
11
11
|
|
|
12
12
|
// The sources behind every NAMED asset a build can reach. A build says
|
package/src/framework/vectors.js
CHANGED
|
@@ -88,10 +88,7 @@ const resolveOne = makeAssetResolver(
|
|
|
88
88
|
// params — the second form is what lets a `type: "vector"` control drive the
|
|
89
89
|
// artwork. Resolving it needs `p`, which is why this is a separate step from
|
|
90
90
|
// resolveVectors rather than folded into it. Mirrors fontsFor/imagesFor.
|
|
91
|
-
export
|
|
92
|
-
const decl = part?.vectors;
|
|
93
|
-
return typeof decl === "function" ? decl(p) : decl;
|
|
94
|
-
}
|
|
91
|
+
export { vectorsFor } from "./asset-decls.js";
|
|
95
92
|
|
|
96
93
|
export async function resolveVectors(vectorsDecl) {
|
|
97
94
|
// A function reaching here means a caller passed `part.vectors` raw, the way
|