@feedmepos/mf-media 0.0.7 → 0.0.8

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.
@@ -0,0 +1,64 @@
1
+ import { type StudioRatio, type StudioStyle } from "@/api/generation";
2
+ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<import("vue").ExtractPropTypes<{
3
+ prompt: {
4
+ required: true;
5
+ type: import("vue").PropType<string>;
6
+ };
7
+ style: {
8
+ required: true;
9
+ type: import("vue").PropType<StudioStyle>;
10
+ };
11
+ ratio: {
12
+ required: true;
13
+ type: import("vue").PropType<StudioRatio>;
14
+ };
15
+ count: {
16
+ required: true;
17
+ type: import("vue").PropType<number>;
18
+ };
19
+ busy: {
20
+ type: import("vue").PropType<boolean>;
21
+ required: true;
22
+ };
23
+ hasRef: {
24
+ type: import("vue").PropType<boolean>;
25
+ required: true;
26
+ };
27
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
28
+ generate: () => void;
29
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
30
+ prompt: {
31
+ required: true;
32
+ type: import("vue").PropType<string>;
33
+ };
34
+ style: {
35
+ required: true;
36
+ type: import("vue").PropType<StudioStyle>;
37
+ };
38
+ ratio: {
39
+ required: true;
40
+ type: import("vue").PropType<StudioRatio>;
41
+ };
42
+ count: {
43
+ required: true;
44
+ type: import("vue").PropType<number>;
45
+ };
46
+ busy: {
47
+ type: import("vue").PropType<boolean>;
48
+ required: true;
49
+ };
50
+ hasRef: {
51
+ type: import("vue").PropType<boolean>;
52
+ required: true;
53
+ };
54
+ }>> & Readonly<{
55
+ onGenerate?: (() => any) | undefined;
56
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, {
57
+ default?(_: {}): any;
58
+ }>;
59
+ export default _default;
60
+ type __VLS_WithTemplateSlots<T, S> = T & {
61
+ new (): {
62
+ $slots: S;
63
+ };
64
+ };
@@ -0,0 +1,39 @@
1
+ import type { StudioItem } from "@/composables/generationState";
2
+ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
3
+ item: {
4
+ type: import("vue").PropType<StudioItem>;
5
+ required: true;
6
+ };
7
+ ratio: {
8
+ type: import("vue").PropType<string>;
9
+ required: true;
10
+ };
11
+ fromRef: {
12
+ type: import("vue").PropType<boolean>;
13
+ required: true;
14
+ };
15
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
16
+ preview: () => void;
17
+ variant: () => void;
18
+ discard: () => void;
19
+ save: () => void;
20
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
21
+ item: {
22
+ type: import("vue").PropType<StudioItem>;
23
+ required: true;
24
+ };
25
+ ratio: {
26
+ type: import("vue").PropType<string>;
27
+ required: true;
28
+ };
29
+ fromRef: {
30
+ type: import("vue").PropType<boolean>;
31
+ required: true;
32
+ };
33
+ }>> & Readonly<{
34
+ onPreview?: (() => any) | undefined;
35
+ onVariant?: (() => any) | undefined;
36
+ onDiscard?: (() => any) | undefined;
37
+ onSave?: (() => any) | undefined;
38
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
39
+ export default _default;
@@ -0,0 +1,29 @@
1
+ import type { StudioItem } from "@/composables/generationState";
2
+ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
3
+ item: {
4
+ type: import("vue").PropType<StudioItem | null>;
5
+ required: true;
6
+ };
7
+ prompt: {
8
+ type: import("vue").PropType<string>;
9
+ required: true;
10
+ };
11
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
12
+ close: () => void;
13
+ variant: () => void;
14
+ save: () => void;
15
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
16
+ item: {
17
+ type: import("vue").PropType<StudioItem | null>;
18
+ required: true;
19
+ };
20
+ prompt: {
21
+ type: import("vue").PropType<string>;
22
+ required: true;
23
+ };
24
+ }>> & Readonly<{
25
+ onClose?: (() => any) | undefined;
26
+ onVariant?: (() => any) | undefined;
27
+ onSave?: (() => any) | undefined;
28
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
29
+ export default _default;
@@ -0,0 +1,40 @@
1
+ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
2
+ strength: {
3
+ required: true;
4
+ type: import("vue").PropType<number>;
5
+ };
6
+ businessId: {
7
+ type: import("vue").PropType<string>;
8
+ required: true;
9
+ };
10
+ restaurantId: {
11
+ type: import("vue").PropType<string>;
12
+ };
13
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
14
+ change: (ref: {
15
+ refAssetId?: string | undefined;
16
+ refRatio?: string | undefined;
17
+ refTmpToken?: string | undefined;
18
+ label?: string | undefined;
19
+ } | null) => void;
20
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
21
+ strength: {
22
+ required: true;
23
+ type: import("vue").PropType<number>;
24
+ };
25
+ businessId: {
26
+ type: import("vue").PropType<string>;
27
+ required: true;
28
+ };
29
+ restaurantId: {
30
+ type: import("vue").PropType<string>;
31
+ };
32
+ }>> & Readonly<{
33
+ onChange?: ((ref: {
34
+ refAssetId?: string | undefined;
35
+ refRatio?: string | undefined;
36
+ refTmpToken?: string | undefined;
37
+ label?: string | undefined;
38
+ } | null) => any) | undefined;
39
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
40
+ export default _default;
@@ -0,0 +1,64 @@
1
+ import type { BatchItem, ComposeRequest, GenerationStatus, StudioRatio, StudioStyle } from "../api/generation";
2
+ /** The refType every composed asset carries. Mirrors model.ComposeRefType. */
3
+ export declare const COMPOSE_REF_TYPE = "ai";
4
+ /** Permanent provenance, never removed. Mirrors model.TagAIGenerated. */
5
+ export declare const TAG_AI_GENERATED = "ai-generated";
6
+ export interface ComposeParams {
7
+ prompt: string;
8
+ style: StudioStyle;
9
+ ratio: StudioRatio;
10
+ count: number;
11
+ refAssetId?: string;
12
+ refRatio?: string;
13
+ refTmpToken?: string;
14
+ refStrength?: number;
15
+ /** For the batch header only — never sent. */
16
+ refLabel?: string;
17
+ restaurantId?: string;
18
+ }
19
+ export interface StudioItem {
20
+ taskId: string;
21
+ assetId: string;
22
+ imageId: string;
23
+ status: GenerationStatus;
24
+ attempts: number;
25
+ error?: string;
26
+ url?: string;
27
+ width?: number;
28
+ height?: number;
29
+ fileSizeBytes?: number;
30
+ /** Local only: the merchant has confirmed this one, so ai-draft is off. */
31
+ saved: boolean;
32
+ }
33
+ export interface StudioBatch {
34
+ batchId: string;
35
+ /** What this batch ran with, so regenerate and variantOf can reproduce it. */
36
+ params: ComposeParams;
37
+ items: StudioItem[];
38
+ }
39
+ export declare function isTerminal(status: GenerationStatus): boolean;
40
+ /**
41
+ * Whether a batch still has work outstanding.
42
+ *
43
+ * A failed item counts as finished, not running — otherwise one permanently failed image
44
+ * would keep the poll loop alive for the life of the page.
45
+ */
46
+ export declare function batchIsRunning(items: StudioItem[]): boolean;
47
+ /**
48
+ * Folds a poll's results into what is already on screen.
49
+ *
50
+ * `saved` is carried over because it is local state the server knows nothing about: without
51
+ * that, a poll landing just after a save flips the button back to "save".
52
+ *
53
+ * An item the server did not mention is left untouched rather than dropped, so a partial
54
+ * response cannot make tiles vanish.
55
+ */
56
+ export declare function mergeBatchItems(existing: StudioItem[], fresh: BatchItem[]): StudioItem[];
57
+ /**
58
+ * Maps the form's params onto the request body.
59
+ *
60
+ * Two things it does deliberately: drops `refLabel`, which exists only for the batch header,
61
+ * and omits `refStrength` when nothing is being referenced — sending it would describe a
62
+ * control the request does not have.
63
+ */
64
+ export declare function toComposeRequest(params: ComposeParams): ComposeRequest;
@@ -0,0 +1,41 @@
1
+ import { type Ref } from "vue";
2
+ import { type ComposeParams, type StudioBatch, type StudioItem } from "@/composables/generationState";
3
+ /**
4
+ * How often a running batch is polled.
5
+ *
6
+ * The worker drains at most 3 tasks per 10-second tick, so a batch of four takes two ticks at
7
+ * minimum. Three seconds is frequent enough to feel live without hammering a route that hits
8
+ * Mongo on every call.
9
+ */
10
+ export declare const POLL_INTERVAL_MS = 3000;
11
+ export declare const useGenerationStore: import("pinia").StoreDefinition<"mediaGeneration", import("pinia")._UnwrapAll<Pick<{
12
+ batches: Ref<StudioBatch[], StudioBatch[]>;
13
+ busy: import("vue").ComputedRef<boolean>;
14
+ compose: (businessID: string, params: ComposeParams) => Promise<void>;
15
+ regenerate: (businessID: string, batch: StudioBatch) => Promise<void>;
16
+ variantOf: (businessID: string, batch: StudioBatch) => Promise<void>;
17
+ save: (businessID: string, batch: StudioBatch, item: StudioItem) => Promise<void>;
18
+ discard: (businessID: string, batch: StudioBatch, item: StudioItem) => Promise<void>;
19
+ resume: (businessID: string) => void;
20
+ reset: () => void;
21
+ }, "batches">>, Pick<{
22
+ batches: Ref<StudioBatch[], StudioBatch[]>;
23
+ busy: import("vue").ComputedRef<boolean>;
24
+ compose: (businessID: string, params: ComposeParams) => Promise<void>;
25
+ regenerate: (businessID: string, batch: StudioBatch) => Promise<void>;
26
+ variantOf: (businessID: string, batch: StudioBatch) => Promise<void>;
27
+ save: (businessID: string, batch: StudioBatch, item: StudioItem) => Promise<void>;
28
+ discard: (businessID: string, batch: StudioBatch, item: StudioItem) => Promise<void>;
29
+ resume: (businessID: string) => void;
30
+ reset: () => void;
31
+ }, "busy">, Pick<{
32
+ batches: Ref<StudioBatch[], StudioBatch[]>;
33
+ busy: import("vue").ComputedRef<boolean>;
34
+ compose: (businessID: string, params: ComposeParams) => Promise<void>;
35
+ regenerate: (businessID: string, batch: StudioBatch) => Promise<void>;
36
+ variantOf: (businessID: string, batch: StudioBatch) => Promise<void>;
37
+ save: (businessID: string, batch: StudioBatch, item: StudioItem) => Promise<void>;
38
+ discard: (businessID: string, batch: StudioBatch, item: StudioItem) => Promise<void>;
39
+ resume: (businessID: string) => void;
40
+ reset: () => void;
41
+ }, "reset" | "discard" | "save" | "regenerate" | "compose" | "variantOf" | "resume">>;
@@ -0,0 +1,2 @@
1
+ declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ export default _default;
package/dist/style.css CHANGED
@@ -1 +1 @@
1
- .fm-dialog:has(> .fm-dialog--content.asset-preview-dialog-content)>.fm-dialog--header{display:none}.fm-dialog:has(> .fm-dialog--content.asset-preview-dialog-content){overflow:hidden}
1
+ .fm-dialog:has(> .fm-dialog--content:is(.asset-preview-dialog-content,.studio-preview-dialog-content))>.fm-dialog--header{display:none}.fm-dialog:has(> .fm-dialog--content:is(.asset-preview-dialog-content,.studio-preview-dialog-content)){overflow:hidden}