@azphalt/importer-cube 0.1.0 → 0.1.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.
Files changed (2) hide show
  1. package/dist/index.js +22 -2
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -8,6 +8,16 @@ import { writeAzp } from "@azphalt/azp";
8
8
  import { parseCube } from "./parse-cube.js";
9
9
  /** Manifest/format version this importer targets. */
10
10
  const FORMAT = "0.1";
11
+ /** In-package path for the canonical dry/wet control panel. */
12
+ const PANEL_PATH = "ui/lut.json";
13
+ /**
14
+ * The canonical `lut` control: one `strength` slider bound to the well-known `strength` key
15
+ * (spec/extension-manifest.md § Canonical `lut` panel), so the dry/wet blend renders identically
16
+ * on every host.
17
+ */
18
+ const STRENGTH_PANEL = {
19
+ controls: [{ type: "slider", key: "strength", label: "Strength", min: 0, max: 1, step: 0.01, default: 1 }],
20
+ };
11
21
  /** Parse `cubeText`, then package it as a `.azp` with `licenseText` as the LICENSE. */
12
22
  export function importCube(cubeText, licenseText, opts) {
13
23
  const lut = parseCube(cubeText);
@@ -26,8 +36,13 @@ export function importCube(cubeText, licenseText, opts) {
26
36
  {
27
37
  type: "lut",
28
38
  path: assetPath,
39
+ // A single `strength` slider bound to the well-known key, so every imported LUT ships a
40
+ // portable dry/wet control (spec/extension-manifest.md § Canonical `lut` panel).
41
+ ui: PANEL_PATH,
29
42
  params: {
30
43
  format: "cube",
44
+ // Normative dry/wet blend: `1` = full grade. See package-format.md § LUT application.
45
+ strength: 1,
31
46
  dimensions: lut.dimensions,
32
47
  size: lut.size,
33
48
  domainMin: lut.domainMin,
@@ -39,13 +54,18 @@ export function importCube(cubeText, licenseText, opts) {
39
54
  };
40
55
  const result = writeAzp({
41
56
  manifest,
42
- payload: { [assetPath]: new TextEncoder().encode(cubeText) },
57
+ payload: {
58
+ [assetPath]: new TextEncoder().encode(cubeText),
59
+ [PANEL_PATH]: new TextEncoder().encode(JSON.stringify(STRENGTH_PANEL)),
60
+ },
43
61
  license: licenseText,
44
62
  });
45
63
  return { ...result, lut };
46
64
  }
47
65
  /** Filesystem-safe stem: lowercase, runs of non-alphanumerics to single hyphens. */
48
66
  function slug(s) {
49
- return s.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || "lut";
67
+ // The prior collapse leaves at most one leading/trailing hyphen, so trim a single one — `/^-+/`,
68
+ // `/-+$/` would backtrack polynomially on a crafted run (CodeQL js/polynomial-redos).
69
+ return s.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-/, "").replace(/-$/, "") || "lut";
50
70
  }
51
71
  export { parseCube } from "./parse-cube.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azphalt/importer-cube",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -23,13 +23,13 @@
23
23
  "dist"
24
24
  ],
25
25
  "dependencies": {
26
- "@azphalt/azp": "0.1.0",
27
- "@azphalt/sdk": "0.1.0"
26
+ "@azphalt/azdk": "0.2.0",
27
+ "@azphalt/azp": "0.2.0"
28
28
  },
29
29
  "devDependencies": {
30
- "typescript": "^5.6.0",
31
- "vitest": "^3.2.6",
32
- "@types/node": "^22.0.0"
30
+ "@types/node": "^22.20.1",
31
+ "typescript": "^5.9.3",
32
+ "vitest": "^3.2.7"
33
33
  },
34
34
  "sideEffects": false,
35
35
  "scripts": {