@pixerate/editor 0.174.1 → 0.176.0

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 (36) hide show
  1. package/dist/{chunk-OVYQAYGH.cjs → chunk-UHMSMUHK.cjs} +75 -66
  2. package/dist/{chunk-BDIM6NVW.js → chunk-Y46OMERN.js} +10 -1
  3. package/dist/effects/fake.d.cts +1 -1
  4. package/dist/effects/fake.d.ts +1 -1
  5. package/dist/effects/index.cjs +36 -22
  6. package/dist/effects/index.js +19 -5
  7. package/dist/effects/types.d.cts +6 -0
  8. package/dist/effects/types.d.ts +6 -0
  9. package/dist/effects/ui.d.cts +0 -6
  10. package/dist/effects/ui.d.ts +0 -6
  11. package/dist/image-editor/controller.d.cts +28 -5
  12. package/dist/image-editor/controller.d.ts +28 -5
  13. package/dist/image-editor/effect-layers.d.cts +40 -0
  14. package/dist/image-editor/effect-layers.d.ts +40 -0
  15. package/dist/image-editor/index.cjs +931 -812
  16. package/dist/image-editor/index.d.cts +1 -0
  17. package/dist/image-editor/index.d.ts +1 -0
  18. package/dist/image-editor/index.js +152 -33
  19. package/dist/image-editor/layers/model.d.cts +15 -1
  20. package/dist/image-editor/layers/model.d.ts +15 -1
  21. package/dist/image-editor/layers/panel.d.cts +6 -2
  22. package/dist/image-editor/layers/panel.d.ts +6 -2
  23. package/dist/image-editor/provider-effect-tools.d.cts +2 -1
  24. package/dist/image-editor/provider-effect-tools.d.ts +2 -1
  25. package/dist/paint-editor/index.cjs +6 -6
  26. package/dist/paint-editor/index.js +1 -1
  27. package/dist/parameters/index.cjs +33 -1
  28. package/dist/parameters/index.d.cts +2 -0
  29. package/dist/parameters/index.d.ts +2 -0
  30. package/dist/parameters/index.js +32 -0
  31. package/dist/parameters/options.d.cts +7 -0
  32. package/dist/parameters/options.d.ts +7 -0
  33. package/dist/parameters/theme.d.cts +30 -0
  34. package/dist/parameters/theme.d.ts +30 -0
  35. package/package.json +1 -1
  36. package/skills/pixerate-image-editor/SKILL.md +2 -1
@@ -1358,6 +1358,35 @@ function createParametersEditorDocument(controller) {
1358
1358
  }
1359
1359
  });
1360
1360
  }
1361
+
1362
+ // src/parameters/theme.ts
1363
+ var parameterThemeStyles = {
1364
+ input: {
1365
+ backgroundColor: "var(--pixerate-parameter-input-bg, var(--background, transparent))",
1366
+ color: "var(--pixerate-parameter-input-fg, var(--foreground, currentColor))",
1367
+ borderColor: "var(--pixerate-parameter-border, var(--input, var(--border, currentColor)))"
1368
+ },
1369
+ select: {
1370
+ backgroundColor: "var(--pixerate-parameter-select-bg, var(--pixerate-parameter-input-bg, var(--background, transparent)))",
1371
+ color: "var(--pixerate-parameter-select-fg, var(--pixerate-parameter-input-fg, var(--foreground, currentColor)))",
1372
+ borderColor: "var(--pixerate-parameter-border, var(--input, var(--border, currentColor)))"
1373
+ },
1374
+ button: {
1375
+ color: "var(--pixerate-parameter-button-fg, var(--foreground, currentColor))",
1376
+ borderColor: "var(--pixerate-parameter-border, var(--input, var(--border, currentColor)))"
1377
+ },
1378
+ range: {
1379
+ accentColor: "var(--pixerate-parameter-accent, var(--primary, currentColor))"
1380
+ }
1381
+ };
1382
+ function parameterThemeStyleText(part) {
1383
+ return Object.entries(parameterThemeStyles[part]).map(([key, value]) => `${key.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`)}: ${value};`).join(" ");
1384
+ }
1385
+
1386
+ // src/parameters/options.ts
1387
+ function matchParameterOptionValue(options, value) {
1388
+ return options.find((o) => o.value === value)?.value ?? options.find((o) => String(o.value) === String(value))?.value ?? value;
1389
+ }
1361
1390
  export {
1362
1391
  PARAMETER_KEY_TOLERANCE,
1363
1392
  ParameterSchemaError,
@@ -1387,6 +1416,7 @@ export {
1387
1416
  isParameterGroup,
1388
1417
  isSliderField,
1389
1418
  mapRange,
1419
+ matchParameterOptionValue,
1390
1420
  normalizeHexColor,
1391
1421
  parameterDecimals,
1392
1422
  parameterFieldFromShaderControl,
@@ -1395,6 +1425,8 @@ export {
1395
1425
  parameterSchemaFromShaderControls,
1396
1426
  parameterSchemaToJsonSchema,
1397
1427
  parameterStep,
1428
+ parameterThemeStyleText,
1429
+ parameterThemeStyles,
1398
1430
  parameterValueFromShaderControl,
1399
1431
  parameterValuesEqual,
1400
1432
  parseParameterNumberInput,
@@ -0,0 +1,7 @@
1
+ /**
2
+ * The option value a select reported: the option whose value is `value`, else the one whose
3
+ * string form is (a string-only host select turns `2` into `"2"`), else `value` itself.
4
+ */
5
+ export declare function matchParameterOptionValue(options: readonly {
6
+ value: string | number;
7
+ }[], value: string | number): string | number;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * The option value a select reported: the option whose value is `value`, else the one whose
3
+ * string form is (a string-only host select turns `2` into `"2"`), else `value` itself.
4
+ */
5
+ export declare function matchParameterOptionValue(options: readonly {
6
+ value: string | number;
7
+ }[], value: string | number): string | number;
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Theme tokens for the parameter controls in `@pixerate/editor-react` and `@pixerate/editor-svelte`.
3
+ * Each `--pixerate-parameter-*` property falls back to the common host tokens (`--background`,
4
+ * `--foreground`, `--input`, `--border`, `--primary`) and then to the browser default. The values
5
+ * are CSS declarations keyed by camelCase property, applied as inline styles by both bindings.
6
+ *
7
+ * Buttons set no background so their `hover:` classes keep working.
8
+ */
9
+ export declare const parameterThemeStyles: {
10
+ readonly input: {
11
+ readonly backgroundColor: "var(--pixerate-parameter-input-bg, var(--background, transparent))";
12
+ readonly color: "var(--pixerate-parameter-input-fg, var(--foreground, currentColor))";
13
+ readonly borderColor: "var(--pixerate-parameter-border, var(--input, var(--border, currentColor)))";
14
+ };
15
+ readonly select: {
16
+ readonly backgroundColor: "var(--pixerate-parameter-select-bg, var(--pixerate-parameter-input-bg, var(--background, transparent)))";
17
+ readonly color: "var(--pixerate-parameter-select-fg, var(--pixerate-parameter-input-fg, var(--foreground, currentColor)))";
18
+ readonly borderColor: "var(--pixerate-parameter-border, var(--input, var(--border, currentColor)))";
19
+ };
20
+ readonly button: {
21
+ readonly color: "var(--pixerate-parameter-button-fg, var(--foreground, currentColor))";
22
+ readonly borderColor: "var(--pixerate-parameter-border, var(--input, var(--border, currentColor)))";
23
+ };
24
+ readonly range: {
25
+ readonly accentColor: "var(--pixerate-parameter-accent, var(--primary, currentColor))";
26
+ };
27
+ };
28
+ export type ParameterThemePart = keyof typeof parameterThemeStyles;
29
+ /** One part's declarations as an inline `style` string (`background-color: …; color: …`). */
30
+ export declare function parameterThemeStyleText(part: ParameterThemePart): string;
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Theme tokens for the parameter controls in `@pixerate/editor-react` and `@pixerate/editor-svelte`.
3
+ * Each `--pixerate-parameter-*` property falls back to the common host tokens (`--background`,
4
+ * `--foreground`, `--input`, `--border`, `--primary`) and then to the browser default. The values
5
+ * are CSS declarations keyed by camelCase property, applied as inline styles by both bindings.
6
+ *
7
+ * Buttons set no background so their `hover:` classes keep working.
8
+ */
9
+ export declare const parameterThemeStyles: {
10
+ readonly input: {
11
+ readonly backgroundColor: "var(--pixerate-parameter-input-bg, var(--background, transparent))";
12
+ readonly color: "var(--pixerate-parameter-input-fg, var(--foreground, currentColor))";
13
+ readonly borderColor: "var(--pixerate-parameter-border, var(--input, var(--border, currentColor)))";
14
+ };
15
+ readonly select: {
16
+ readonly backgroundColor: "var(--pixerate-parameter-select-bg, var(--pixerate-parameter-input-bg, var(--background, transparent)))";
17
+ readonly color: "var(--pixerate-parameter-select-fg, var(--pixerate-parameter-input-fg, var(--foreground, currentColor)))";
18
+ readonly borderColor: "var(--pixerate-parameter-border, var(--input, var(--border, currentColor)))";
19
+ };
20
+ readonly button: {
21
+ readonly color: "var(--pixerate-parameter-button-fg, var(--foreground, currentColor))";
22
+ readonly borderColor: "var(--pixerate-parameter-border, var(--input, var(--border, currentColor)))";
23
+ };
24
+ readonly range: {
25
+ readonly accentColor: "var(--pixerate-parameter-accent, var(--primary, currentColor))";
26
+ };
27
+ };
28
+ export type ParameterThemePart = keyof typeof parameterThemeStyles;
29
+ /** One part's declarations as an inline `style` string (`background-color: …; color: …`). */
30
+ export declare function parameterThemeStyleText(part: ParameterThemePart): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pixerate/editor",
3
- "version": "0.174.1",
3
+ "version": "0.176.0",
4
4
  "description": "UI-agnostic rich text and media editing core library",
5
5
  "author": "Pixerate",
6
6
  "license": "MIT",
@@ -390,7 +390,8 @@ in the source frame at the document's bit depth, colour mode and profile. Read
390
390
  | `apply_effect` | Run a provider filter effect on a layer as a smart filter (`target`, `effect`, `values`, `index`, `enabled`, `opacity`); a pixel, shape or type layer becomes a smart object in the same undo step (`converted`). Returns the filter id. |
391
391
  | `update_effect` | Change an effect smart filter (`values` merged, `null` resets; `enabled`, `opacity`, `index`) or redraw an effect layer (`effect: "generator"`, values only). |
392
392
  | `remove_effect` | Remove an effect smart filter, or (`generator`) keep an effect layer's pixels as a plain layer. |
393
- | `add_effect_layer` | Add a layer drawn by a generator, overlay or title effect at the document's size and bit depth (`values`, `time`, `name`, `aboveId` / `belowId`, `opacity`, `blend`). Returns the layer id. |
393
+ | `add_effect_layer` | Add a layer drawn by a generator, overlay or title effect at the document's size and bit depth (`values`, `time`, `animate`, `name`, `aboveId` / `belowId`, `opacity`, `blend`). An effect with its own background (`backgroundOpacity` in `describe_effect`) starts with it transparent when there are layers below. Returns the layer id. |
394
+ | `set_effect_layer` | Change an effect layer: swap its `effect` (its defaults plus `values`), pick the still frame (`time`, ms), or make it play in an animation (`animate: { duration }`; `null` for a still frame). The longest animating layer sets the animation's length. |
394
395
  | `apply_selection_as_mask` | Mask a layer with the current selection: pass `layerId` to mask an existing layer, or `kind` (plus optional `params`) to create a new masked layer in one step. `density` 0..1 and `feather` px soften the mask non-destructively. Returns `layerId`, kind, mask info and the selection summary. |
395
396
 
396
397
  ### Save and open