@pixerate/editor-react 0.15.0 → 0.17.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.
- package/README.md +6 -2
- package/dist/canvas/index.cjs +484 -119
- package/dist/canvas/index.cjs.map +1 -1
- package/dist/canvas/index.d.cts +122 -3
- package/dist/canvas/index.d.ts +122 -3
- package/dist/canvas/index.js +380 -0
- package/dist/canvas/index.js.map +1 -1
- package/dist/chunk-I3E4KSA2.js +515 -0
- package/dist/chunk-I3E4KSA2.js.map +1 -0
- package/dist/chunk-JR5ZBDR7.js +2012 -0
- package/dist/chunk-JR5ZBDR7.js.map +1 -0
- package/dist/chunk-XWFU2CSG.js +167 -0
- package/dist/chunk-XWFU2CSG.js.map +1 -0
- package/dist/chunk-ZU54BMDC.js +2128 -0
- package/dist/chunk-ZU54BMDC.js.map +1 -0
- package/dist/generation/index.cjs +525 -0
- package/dist/generation/index.cjs.map +1 -0
- package/dist/generation/index.d.cts +124 -0
- package/dist/generation/index.d.ts +124 -0
- package/dist/generation/index.js +19 -0
- package/dist/generation/index.js.map +1 -0
- package/dist/image-editor/index.cjs +988 -337
- package/dist/image-editor/index.cjs.map +1 -1
- package/dist/image-editor/index.d.cts +92 -2
- package/dist/image-editor/index.d.ts +92 -2
- package/dist/image-editor/index.js +17 -3
- package/dist/index.cjs +3628 -754
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +226 -5
- package/dist/index.d.ts +226 -5
- package/dist/index.js +868 -77
- package/dist/index.js.map +1 -1
- package/dist/persistence/index.cjs +191 -0
- package/dist/persistence/index.cjs.map +1 -0
- package/dist/persistence/index.d.cts +77 -0
- package/dist/persistence/index.d.ts +77 -0
- package/dist/persistence/index.js +9 -0
- package/dist/persistence/index.js.map +1 -0
- package/dist/spreadsheet/index.cjs +949 -111
- package/dist/spreadsheet/index.cjs.map +1 -1
- package/dist/spreadsheet/index.d.cts +121 -7
- package/dist/spreadsheet/index.d.ts +121 -7
- package/dist/spreadsheet/index.js +11 -1
- package/dist/tokens/index.cjs +395 -0
- package/dist/tokens/index.cjs.map +1 -0
- package/dist/tokens/index.d.cts +54 -0
- package/dist/tokens/index.d.ts +54 -0
- package/dist/tokens/index.js +375 -0
- package/dist/tokens/index.js.map +1 -0
- package/package.json +26 -2
- package/dist/chunk-LPFZMZ3L.js +0 -1461
- package/dist/chunk-LPFZMZ3L.js.map +0 -1
- package/dist/chunk-QVQYYHJ5.js +0 -1161
- package/dist/chunk-QVQYYHJ5.js.map +0 -1
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { GenerationRequest, ModelCapabilities, PlanOptions, GenerationPlan, JobProgressEstimate, PlanStrategy, ReferenceRole, GenerationReference, AssetInfo, AssetRoleOption, AssetMentionChip, GenerationRecord, RecreateOptions, AssetLookup, RecreateMode, RecreateResult, GenerationRecordStore, GenerationRecordFilter } from '@pixerate/editor/generation';
|
|
2
|
+
import React__default from 'react';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Plans `request` against `capabilities` (see `planGenerationRequest`) and
|
|
6
|
+
* returns the adjusted request, adjustments and errors. Recomputed only when
|
|
7
|
+
* the request, capabilities or options change by value, so inline objects are fine.
|
|
8
|
+
*/
|
|
9
|
+
declare function useGenerationPlan(request: GenerationRequest, capabilities: ModelCapabilities, options?: PlanOptions): GenerationPlan;
|
|
10
|
+
interface UseJobProgressOptions {
|
|
11
|
+
startedAt: number | Date | string;
|
|
12
|
+
expectedMs?: number;
|
|
13
|
+
done?: boolean;
|
|
14
|
+
/** Fixed current time (disables ticking; useful for SSR and tests). */
|
|
15
|
+
now?: number | Date | string;
|
|
16
|
+
/** Re-render interval while running in ms (default 1000). */
|
|
17
|
+
intervalMs?: number;
|
|
18
|
+
}
|
|
19
|
+
/** Ticking `estimateJobProgress` for a running job; stops ticking when `done`. */
|
|
20
|
+
declare function useJobProgress(options: UseJobProgressOptions): JobProgressEstimate;
|
|
21
|
+
|
|
22
|
+
interface GenerationSettingsProps {
|
|
23
|
+
capabilities: ModelCapabilities;
|
|
24
|
+
/** The request being edited (controlled). */
|
|
25
|
+
value: GenerationRequest;
|
|
26
|
+
onChange: (next: GenerationRequest) => void;
|
|
27
|
+
/** A plan computed elsewhere; otherwise one is computed with `strategy`. */
|
|
28
|
+
plan?: GenerationPlan;
|
|
29
|
+
/** Strategy for the built-in plan (default `nearest`). */
|
|
30
|
+
strategy?: PlanStrategy;
|
|
31
|
+
/** List plan adjustments and errors under the controls (default `true`). */
|
|
32
|
+
showAdjustments?: boolean;
|
|
33
|
+
/** Shows an "Add" button per reference role; you pick the asset and call `onChange`. */
|
|
34
|
+
onAddReference?: (role: ReferenceRole) => void;
|
|
35
|
+
/** Custom rendering of a reference chip (default: its id). */
|
|
36
|
+
renderReference?: (reference: GenerationReference) => React__default.ReactNode;
|
|
37
|
+
className?: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Headless-styled settings form generated from a model's capabilities:
|
|
41
|
+
* selects for choices, sliders/number inputs for ranges, text areas for
|
|
42
|
+
* negative/system prompts, checkboxes for boolean params, reference slots by
|
|
43
|
+
* role, and the plan's adjustments and errors. Controlled via `value` / `onChange`.
|
|
44
|
+
*/
|
|
45
|
+
declare const GenerationSettings: React__default.FC<GenerationSettingsProps>;
|
|
46
|
+
|
|
47
|
+
interface JobProgressProps extends UseJobProgressOptions {
|
|
48
|
+
/** Text shown before the time label, e.g. the model name. */
|
|
49
|
+
title?: string;
|
|
50
|
+
/** Extra classes for the root. */
|
|
51
|
+
className?: string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Headless-styled progress bar for a generation job that reports no progress
|
|
55
|
+
* of its own: time-based percent (held at 95% until `done`) with a
|
|
56
|
+
* "~2m left" / "Almost done…" label. Exposes `role="progressbar"`.
|
|
57
|
+
*/
|
|
58
|
+
declare const JobProgress: React__default.FC<JobProgressProps>;
|
|
59
|
+
|
|
60
|
+
interface AssetMentionChipsProps {
|
|
61
|
+
/** Prompt text containing `@asset` / `@asset:role` mentions. */
|
|
62
|
+
content: string;
|
|
63
|
+
/** Called with the text after a role is picked (`@fox` → `@fox:style_ref`). */
|
|
64
|
+
onChange: (next: string) => void;
|
|
65
|
+
/** Mentionable assets; mentions that match none (by id or label) are not shown. */
|
|
66
|
+
assets: readonly AssetInfo[];
|
|
67
|
+
/** The selected model: its roles are offered and mentions are checked against it. */
|
|
68
|
+
capabilities?: ModelCapabilities;
|
|
69
|
+
/** Role options (default: the model's roles, else the built-in roles). */
|
|
70
|
+
roles?: readonly AssetRoleOption[];
|
|
71
|
+
/** Custom chip content (default: the asset label). */
|
|
72
|
+
renderAsset?: (chip: AssetMentionChip) => React__default.ReactNode;
|
|
73
|
+
className?: string;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* The asset mentions of a prompt as chips with role badges. Clicking a chip
|
|
77
|
+
* opens a role picker popover; picking a role rewrites the mention's `:role`
|
|
78
|
+
* suffix in the text. Chips with problems for the model (unsupported role,
|
|
79
|
+
* wrong media type, too many for the role) are flagged.
|
|
80
|
+
*/
|
|
81
|
+
declare const AssetMentionChips: React__default.FC<AssetMentionChipsProps>;
|
|
82
|
+
|
|
83
|
+
type Template = NonNullable<RecreateOptions['templates']>[number];
|
|
84
|
+
interface UseGenerationRecordsResult {
|
|
85
|
+
records: GenerationRecord[];
|
|
86
|
+
loading: boolean;
|
|
87
|
+
error: unknown;
|
|
88
|
+
refresh: () => Promise<void>;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Loads records from a `GenerationRecordStore` (newest first) and reloads
|
|
92
|
+
* whenever the store changes. `filter` is compared by value.
|
|
93
|
+
*/
|
|
94
|
+
declare function useGenerationRecords(store: GenerationRecordStore | null | undefined, filter?: GenerationRecordFilter): UseGenerationRecordsResult;
|
|
95
|
+
interface GenerationHistoryProps {
|
|
96
|
+
records: readonly GenerationRecord[];
|
|
97
|
+
/** Current templates (drift detection, and resolution in `latest` mode). */
|
|
98
|
+
templates?: readonly Template[];
|
|
99
|
+
/** Current models (capability drift and re-planning). */
|
|
100
|
+
capabilities?: ModelCapabilities | readonly ModelCapabilities[];
|
|
101
|
+
/** Current assets (missing / changed asset drift). */
|
|
102
|
+
assets?: AssetLookup;
|
|
103
|
+
/** Recreate mode (controlled); otherwise a toggle starting at `exact`. */
|
|
104
|
+
mode?: RecreateMode;
|
|
105
|
+
onModeChange?: (mode: RecreateMode) => void;
|
|
106
|
+
/** "Recreate": receives the rebuilt request and drift report. */
|
|
107
|
+
onRecreate?: (result: RecreateResult, record: GenerationRecord) => void;
|
|
108
|
+
/** "Variation": same request with a new seed. */
|
|
109
|
+
onVariation?: (result: RecreateResult, record: GenerationRecord) => void;
|
|
110
|
+
onRemove?: (record: GenerationRecord) => void;
|
|
111
|
+
/** Extra content per record (e.g. output thumbnails). */
|
|
112
|
+
renderPreview?: (record: GenerationRecord) => React__default.ReactNode;
|
|
113
|
+
emptyText?: string;
|
|
114
|
+
className?: string;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Generation history: one entry per record with its model, prompt, asset
|
|
118
|
+
* role badges and the drift since it was made (templates edited, model
|
|
119
|
+
* capabilities changed, settings no longer supported, assets missing), plus
|
|
120
|
+
* Recreate and Variation buttons. Recreate is disabled when drift blocks it.
|
|
121
|
+
*/
|
|
122
|
+
declare const GenerationHistory: React__default.FC<GenerationHistoryProps>;
|
|
123
|
+
|
|
124
|
+
export { AssetMentionChips, type AssetMentionChipsProps, GenerationHistory, type GenerationHistoryProps, GenerationSettings, type GenerationSettingsProps, JobProgress, type JobProgressProps, type UseGenerationRecordsResult, type UseJobProgressOptions, useGenerationPlan, useGenerationRecords, useJobProgress };
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { GenerationRequest, ModelCapabilities, PlanOptions, GenerationPlan, JobProgressEstimate, PlanStrategy, ReferenceRole, GenerationReference, AssetInfo, AssetRoleOption, AssetMentionChip, GenerationRecord, RecreateOptions, AssetLookup, RecreateMode, RecreateResult, GenerationRecordStore, GenerationRecordFilter } from '@pixerate/editor/generation';
|
|
2
|
+
import React__default from 'react';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Plans `request` against `capabilities` (see `planGenerationRequest`) and
|
|
6
|
+
* returns the adjusted request, adjustments and errors. Recomputed only when
|
|
7
|
+
* the request, capabilities or options change by value, so inline objects are fine.
|
|
8
|
+
*/
|
|
9
|
+
declare function useGenerationPlan(request: GenerationRequest, capabilities: ModelCapabilities, options?: PlanOptions): GenerationPlan;
|
|
10
|
+
interface UseJobProgressOptions {
|
|
11
|
+
startedAt: number | Date | string;
|
|
12
|
+
expectedMs?: number;
|
|
13
|
+
done?: boolean;
|
|
14
|
+
/** Fixed current time (disables ticking; useful for SSR and tests). */
|
|
15
|
+
now?: number | Date | string;
|
|
16
|
+
/** Re-render interval while running in ms (default 1000). */
|
|
17
|
+
intervalMs?: number;
|
|
18
|
+
}
|
|
19
|
+
/** Ticking `estimateJobProgress` for a running job; stops ticking when `done`. */
|
|
20
|
+
declare function useJobProgress(options: UseJobProgressOptions): JobProgressEstimate;
|
|
21
|
+
|
|
22
|
+
interface GenerationSettingsProps {
|
|
23
|
+
capabilities: ModelCapabilities;
|
|
24
|
+
/** The request being edited (controlled). */
|
|
25
|
+
value: GenerationRequest;
|
|
26
|
+
onChange: (next: GenerationRequest) => void;
|
|
27
|
+
/** A plan computed elsewhere; otherwise one is computed with `strategy`. */
|
|
28
|
+
plan?: GenerationPlan;
|
|
29
|
+
/** Strategy for the built-in plan (default `nearest`). */
|
|
30
|
+
strategy?: PlanStrategy;
|
|
31
|
+
/** List plan adjustments and errors under the controls (default `true`). */
|
|
32
|
+
showAdjustments?: boolean;
|
|
33
|
+
/** Shows an "Add" button per reference role; you pick the asset and call `onChange`. */
|
|
34
|
+
onAddReference?: (role: ReferenceRole) => void;
|
|
35
|
+
/** Custom rendering of a reference chip (default: its id). */
|
|
36
|
+
renderReference?: (reference: GenerationReference) => React__default.ReactNode;
|
|
37
|
+
className?: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Headless-styled settings form generated from a model's capabilities:
|
|
41
|
+
* selects for choices, sliders/number inputs for ranges, text areas for
|
|
42
|
+
* negative/system prompts, checkboxes for boolean params, reference slots by
|
|
43
|
+
* role, and the plan's adjustments and errors. Controlled via `value` / `onChange`.
|
|
44
|
+
*/
|
|
45
|
+
declare const GenerationSettings: React__default.FC<GenerationSettingsProps>;
|
|
46
|
+
|
|
47
|
+
interface JobProgressProps extends UseJobProgressOptions {
|
|
48
|
+
/** Text shown before the time label, e.g. the model name. */
|
|
49
|
+
title?: string;
|
|
50
|
+
/** Extra classes for the root. */
|
|
51
|
+
className?: string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Headless-styled progress bar for a generation job that reports no progress
|
|
55
|
+
* of its own: time-based percent (held at 95% until `done`) with a
|
|
56
|
+
* "~2m left" / "Almost done…" label. Exposes `role="progressbar"`.
|
|
57
|
+
*/
|
|
58
|
+
declare const JobProgress: React__default.FC<JobProgressProps>;
|
|
59
|
+
|
|
60
|
+
interface AssetMentionChipsProps {
|
|
61
|
+
/** Prompt text containing `@asset` / `@asset:role` mentions. */
|
|
62
|
+
content: string;
|
|
63
|
+
/** Called with the text after a role is picked (`@fox` → `@fox:style_ref`). */
|
|
64
|
+
onChange: (next: string) => void;
|
|
65
|
+
/** Mentionable assets; mentions that match none (by id or label) are not shown. */
|
|
66
|
+
assets: readonly AssetInfo[];
|
|
67
|
+
/** The selected model: its roles are offered and mentions are checked against it. */
|
|
68
|
+
capabilities?: ModelCapabilities;
|
|
69
|
+
/** Role options (default: the model's roles, else the built-in roles). */
|
|
70
|
+
roles?: readonly AssetRoleOption[];
|
|
71
|
+
/** Custom chip content (default: the asset label). */
|
|
72
|
+
renderAsset?: (chip: AssetMentionChip) => React__default.ReactNode;
|
|
73
|
+
className?: string;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* The asset mentions of a prompt as chips with role badges. Clicking a chip
|
|
77
|
+
* opens a role picker popover; picking a role rewrites the mention's `:role`
|
|
78
|
+
* suffix in the text. Chips with problems for the model (unsupported role,
|
|
79
|
+
* wrong media type, too many for the role) are flagged.
|
|
80
|
+
*/
|
|
81
|
+
declare const AssetMentionChips: React__default.FC<AssetMentionChipsProps>;
|
|
82
|
+
|
|
83
|
+
type Template = NonNullable<RecreateOptions['templates']>[number];
|
|
84
|
+
interface UseGenerationRecordsResult {
|
|
85
|
+
records: GenerationRecord[];
|
|
86
|
+
loading: boolean;
|
|
87
|
+
error: unknown;
|
|
88
|
+
refresh: () => Promise<void>;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Loads records from a `GenerationRecordStore` (newest first) and reloads
|
|
92
|
+
* whenever the store changes. `filter` is compared by value.
|
|
93
|
+
*/
|
|
94
|
+
declare function useGenerationRecords(store: GenerationRecordStore | null | undefined, filter?: GenerationRecordFilter): UseGenerationRecordsResult;
|
|
95
|
+
interface GenerationHistoryProps {
|
|
96
|
+
records: readonly GenerationRecord[];
|
|
97
|
+
/** Current templates (drift detection, and resolution in `latest` mode). */
|
|
98
|
+
templates?: readonly Template[];
|
|
99
|
+
/** Current models (capability drift and re-planning). */
|
|
100
|
+
capabilities?: ModelCapabilities | readonly ModelCapabilities[];
|
|
101
|
+
/** Current assets (missing / changed asset drift). */
|
|
102
|
+
assets?: AssetLookup;
|
|
103
|
+
/** Recreate mode (controlled); otherwise a toggle starting at `exact`. */
|
|
104
|
+
mode?: RecreateMode;
|
|
105
|
+
onModeChange?: (mode: RecreateMode) => void;
|
|
106
|
+
/** "Recreate": receives the rebuilt request and drift report. */
|
|
107
|
+
onRecreate?: (result: RecreateResult, record: GenerationRecord) => void;
|
|
108
|
+
/** "Variation": same request with a new seed. */
|
|
109
|
+
onVariation?: (result: RecreateResult, record: GenerationRecord) => void;
|
|
110
|
+
onRemove?: (record: GenerationRecord) => void;
|
|
111
|
+
/** Extra content per record (e.g. output thumbnails). */
|
|
112
|
+
renderPreview?: (record: GenerationRecord) => React__default.ReactNode;
|
|
113
|
+
emptyText?: string;
|
|
114
|
+
className?: string;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Generation history: one entry per record with its model, prompt, asset
|
|
118
|
+
* role badges and the drift since it was made (templates edited, model
|
|
119
|
+
* capabilities changed, settings no longer supported, assets missing), plus
|
|
120
|
+
* Recreate and Variation buttons. Recreate is disabled when drift blocks it.
|
|
121
|
+
*/
|
|
122
|
+
declare const GenerationHistory: React__default.FC<GenerationHistoryProps>;
|
|
123
|
+
|
|
124
|
+
export { AssetMentionChips, type AssetMentionChipsProps, GenerationHistory, type GenerationHistoryProps, GenerationSettings, type GenerationSettingsProps, JobProgress, type JobProgressProps, type UseGenerationRecordsResult, type UseJobProgressOptions, useGenerationPlan, useGenerationRecords, useJobProgress };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AssetMentionChips,
|
|
3
|
+
GenerationHistory,
|
|
4
|
+
GenerationSettings,
|
|
5
|
+
JobProgress,
|
|
6
|
+
useGenerationPlan,
|
|
7
|
+
useGenerationRecords,
|
|
8
|
+
useJobProgress
|
|
9
|
+
} from "../chunk-I3E4KSA2.js";
|
|
10
|
+
export {
|
|
11
|
+
AssetMentionChips,
|
|
12
|
+
GenerationHistory,
|
|
13
|
+
GenerationSettings,
|
|
14
|
+
JobProgress,
|
|
15
|
+
useGenerationPlan,
|
|
16
|
+
useGenerationRecords,
|
|
17
|
+
useJobProgress
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|