@bluepic/embed 0.6.43 → 0.6.45
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/dist/bluepic-embed.iife.js +108 -108
- package/dist/bluepic-embed.umd.js +108 -108
- package/dist/components/BxStepper.vue.d.ts +7 -1
- package/dist/components/FieldStatusMark.vue.d.ts +6 -0
- package/dist/components/TemplateEditor/BxTemplateEditor.vue.d.ts +11 -0
- package/dist/components/TemplateEditor/ExportPopoup.vue.d.ts +8 -1
- package/dist/components/fields/Group.vue.d.ts +2 -0
- package/dist/embed/embed.d.ts +12 -0
- package/dist/main.cjs +49 -49
- package/dist/main.d.ts +2 -0
- package/dist/main.mjs +4717 -4485
- package/dist/style.css +1 -1
- package/dist/util/export.d.ts +10 -1
- package/dist/util/fieldStatus.d.ts +84 -0
- package/package.json +3 -2
package/dist/util/export.d.ts
CHANGED
|
@@ -130,7 +130,16 @@ svgLoadWaitDelay?: Ref<number | undefined>,
|
|
|
130
130
|
*/
|
|
131
131
|
canvases?: Ref<EditorCanvas[] | undefined>,
|
|
132
132
|
/** Hidden live renderers of the sibling canvases (see CanvasSiblings). */
|
|
133
|
-
siblings?: Ref<CanvasSiblingsApi | undefined
|
|
133
|
+
siblings?: Ref<CanvasSiblingsApi | undefined>,
|
|
134
|
+
/**
|
|
135
|
+
* Field status (see useFieldStatus): with text or picture fields still on the
|
|
136
|
+
* template's value, the export popup says so (or a message, when there is
|
|
137
|
+
* no popup). `review` takes the user back to the first of them.
|
|
138
|
+
*/
|
|
139
|
+
pendingFields?: {
|
|
140
|
+
pendingCount: Ref<number>;
|
|
141
|
+
review: () => void;
|
|
142
|
+
}): {
|
|
134
143
|
triggerExport: () => Promise<void>;
|
|
135
144
|
consumeOutputFor: (rowData: {
|
|
136
145
|
[k: string]: unknown;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { type InjectionKey, type Ref } from 'vue';
|
|
2
|
+
import type { BluepicField } from '@bluepic/types';
|
|
3
|
+
/**
|
|
4
|
+
* Whether a field still asks for the user's attention.
|
|
5
|
+
*
|
|
6
|
+
* done: customised, prefilled by the host, or a choice field (a choice
|
|
7
|
+
* always holds a valid answer, so it never nags).
|
|
8
|
+
* pending: a free-input field (text, picture) that still shows the value the
|
|
9
|
+
* template was designed with.
|
|
10
|
+
* none: nothing to report (an instruction, a group without fields).
|
|
11
|
+
*/
|
|
12
|
+
export type FieldStatus = 'done' | 'pending' | 'none';
|
|
13
|
+
export declare function isFreeInputField(field: BluepicField): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* The data keys whose value decides a field's status. For the deprecated
|
|
16
|
+
* ImageAdjust model (`image` + `pos` + `scale`) only the picture counts:
|
|
17
|
+
* nudging the stock photo is not replacing it.
|
|
18
|
+
*/
|
|
19
|
+
export declare function fieldStatusKeys(field: BluepicField): string[];
|
|
20
|
+
/**
|
|
21
|
+
* Does `value` still equal the template's own `defaultValue`?
|
|
22
|
+
*
|
|
23
|
+
* Pictures compare by `src` only: cropping, mirroring or cutting out the
|
|
24
|
+
* template's stock photo leaves it the stock photo. Everything else compares
|
|
25
|
+
* deeply (key order does not matter).
|
|
26
|
+
*/
|
|
27
|
+
export declare function isDefaultValue(value: unknown, defaultValue: unknown): boolean;
|
|
28
|
+
export type FieldStatusContext = {
|
|
29
|
+
/** Current values (the editor's data). */
|
|
30
|
+
data: {
|
|
31
|
+
[k: string]: unknown;
|
|
32
|
+
};
|
|
33
|
+
/** The template's own values (`serial.bindings`). */
|
|
34
|
+
defaults: {
|
|
35
|
+
[k: string]: unknown;
|
|
36
|
+
};
|
|
37
|
+
/** Keys the host filled in (URL, pre-populated row, LinkedIn …): always done. */
|
|
38
|
+
prefilled: ReadonlySet<string>;
|
|
39
|
+
};
|
|
40
|
+
/** Combine several statuses: pending wins, then done; none only if all are none. */
|
|
41
|
+
export declare function combineFieldStatus(statuses: FieldStatus[]): FieldStatus;
|
|
42
|
+
/** The status of one field. A group combines the fields inside it. */
|
|
43
|
+
export declare function fieldStatusOf(field: BluepicField, ctx: FieldStatusContext): FieldStatus;
|
|
44
|
+
/**
|
|
45
|
+
* Every pending free-input field below `fields`, in panel order. Groups are
|
|
46
|
+
* walked, collections are not (their entries are a list, not a placeholder).
|
|
47
|
+
*/
|
|
48
|
+
export declare function pendingFieldsOf(fields: BluepicField[], ctx: FieldStatusContext): BluepicField[];
|
|
49
|
+
export type FieldStatusApi = {
|
|
50
|
+
/** Status of one field (a group combines its fields). */
|
|
51
|
+
statusOf(field: BluepicField): FieldStatus;
|
|
52
|
+
/** Combined status of several fields (a mobile slide). */
|
|
53
|
+
statusOfAll(fields: BluepicField[]): FieldStatus;
|
|
54
|
+
/** Free-input fields that still show the template's value, in panel order. */
|
|
55
|
+
pendingFields: Readonly<Ref<BluepicField[]>>;
|
|
56
|
+
pendingCount: Readonly<Ref<number>>;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* The single place that decides which fields are done.
|
|
60
|
+
*
|
|
61
|
+
* `prefilledKeys`: data keys the host supplied (query string, pre-populated
|
|
62
|
+
* row, LinkedIn, …). They count as done whatever their value, even when it
|
|
63
|
+
* happens to equal the template's own.
|
|
64
|
+
*/
|
|
65
|
+
export declare function useFieldStatus(options: {
|
|
66
|
+
fields: Ref<BluepicField[] | undefined>;
|
|
67
|
+
data: Ref<{
|
|
68
|
+
[k: string]: unknown;
|
|
69
|
+
}>;
|
|
70
|
+
defaults: Ref<{
|
|
71
|
+
[k: string]: unknown;
|
|
72
|
+
} | undefined>;
|
|
73
|
+
prefilledKeys?: Ref<readonly string[] | undefined>;
|
|
74
|
+
/** Off: every field reports `none` and nothing is pending. */
|
|
75
|
+
enabled?: Ref<boolean>;
|
|
76
|
+
}): FieldStatusApi;
|
|
77
|
+
export declare const FIELD_STATUS_KEY: InjectionKey<FieldStatusApi>;
|
|
78
|
+
export declare function provideFieldStatus(api: FieldStatusApi): void;
|
|
79
|
+
/** Absent unless the editor turned field status on; the panel then shows no marks. */
|
|
80
|
+
export declare function injectFieldStatus(): FieldStatusApi | undefined;
|
|
81
|
+
/** Accessible name of a status mark. */
|
|
82
|
+
export declare const FIELD_STATUS_LABELS: Record<Exclude<FieldStatus, 'none'>, string>;
|
|
83
|
+
/** "2 fields still show their default value." */
|
|
84
|
+
export declare function pendingFieldsMessage(count: number): string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bluepic/embed",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.45",
|
|
4
4
|
"description": "Bluepic embed sdk",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -45,7 +45,8 @@
|
|
|
45
45
|
"test:clone": "tsx src/util/cloneDeep.test.ts",
|
|
46
46
|
"test:imagestates": "tsx src/util/imageStates/imageStates.test.ts",
|
|
47
47
|
"test:imageaspect": "tsx src/util/imageAspect/imageAspect.test.ts",
|
|
48
|
-
"test:blankdata": "tsx src/util/blankData.test.ts"
|
|
48
|
+
"test:blankdata": "tsx src/util/blankData.test.ts",
|
|
49
|
+
"test:fieldstatus": "tsx src/util/fieldStatus.test.ts"
|
|
49
50
|
},
|
|
50
51
|
"peerDependencies": {
|
|
51
52
|
"vue": "^3.5.23"
|