@bluepic/embed 0.7.0 → 0.7.1

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.
@@ -130,16 +130,7 @@ 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>,
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
- }): {
133
+ siblings?: Ref<CanvasSiblingsApi | undefined>): {
143
134
  triggerExport: () => Promise<void>;
144
135
  consumeOutputFor: (rowData: {
145
136
  [k: string]: unknown;
@@ -44,6 +44,8 @@ export declare function useFieldFocus(): FieldFocusController | undefined;
44
44
  export declare const FIELD_FOCUS_FLASH_CLASS = "bx-field-hint-target";
45
45
  /** Held while the pointer rests on the field's hitbox in the live preview. */
46
46
  export declare const FIELD_HOVER_CLASS = "bx-field-hint-hover";
47
+ /** Was this focus moved there by the editor (`revealFieldElement`), not the user? */
48
+ export declare function isProgrammaticFieldFocus(target: EventTarget | null): boolean;
47
49
  /**
48
50
  * Scroll a field's control into view, flash it, and focus what you type into —
49
51
  * falling back to whatever else in it can take focus.
@@ -3,13 +3,20 @@ import type { BluepicField } from '@bluepic/types';
3
3
  /**
4
4
  * Whether a field still asks for the user's attention.
5
5
  *
6
- * done: customised, prefilled by the host, or a choice field (a choice
7
- * always holds a valid answer, so it never nags).
6
+ * done: customised, prefilled by the host, or a choice field the user
7
+ * has opened or focused at least once.
8
8
  * pending: a free-input field (text, picture) that still shows the value the
9
- * template was designed with.
9
+ * template was designed with, a choice field nobody looked at yet,
10
+ * or a select that shows only its placeholder.
10
11
  * none: nothing to report (an instruction, a group without fields).
11
12
  */
12
13
  export type FieldStatus = 'done' | 'pending' | 'none';
14
+ /**
15
+ * Does a select show only its placeholder? No value at all, or (for the plain
16
+ * selects, whose options are compared the way BxSelect does) a value that is
17
+ * none of the options.
18
+ */
19
+ export declare function isUnpickedSelect(field: BluepicField, value: unknown): boolean;
13
20
  export declare function isFreeInputField(field: BluepicField): boolean;
14
21
  /**
15
22
  * The data keys whose value decides a field's status. For the deprecated
@@ -36,13 +43,15 @@ export type FieldStatusContext = {
36
43
  };
37
44
  /** Keys the host filled in (URL, pre-populated row, LinkedIn …): always done. */
38
45
  prefilled: ReadonlySet<string>;
46
+ /** Keys of choice fields the user has opened or focused. */
47
+ touched?: ReadonlySet<string>;
39
48
  };
40
49
  /** Combine several statuses: pending wins, then done; none only if all are none. */
41
50
  export declare function combineFieldStatus(statuses: FieldStatus[]): FieldStatus;
42
51
  /** The status of one field. A group combines the fields inside it. */
43
52
  export declare function fieldStatusOf(field: BluepicField, ctx: FieldStatusContext): FieldStatus;
44
53
  /**
45
- * Every pending free-input field below `fields`, in panel order. Groups are
54
+ * Every pending field below `fields`, in panel order. Groups are
46
55
  * walked, collections are not (their entries are a list, not a placeholder).
47
56
  */
48
57
  export declare function pendingFieldsOf(fields: BluepicField[], ctx: FieldStatusContext): BluepicField[];
@@ -51,9 +60,11 @@ export type FieldStatusApi = {
51
60
  statusOf(field: BluepicField): FieldStatus;
52
61
  /** Combined status of several fields (a mobile slide). */
53
62
  statusOfAll(fields: BluepicField[]): FieldStatus;
54
- /** Free-input fields that still show the template's value, in panel order. */
63
+ /** Pending fields, in panel order. */
55
64
  pendingFields: Readonly<Ref<BluepicField[]>>;
56
65
  pendingCount: Readonly<Ref<number>>;
66
+ /** The user opened or focused this field: a choice field now counts as done. */
67
+ markTouched(field: BluepicField): void;
57
68
  };
58
69
  /**
59
70
  * The single place that decides which fields are done.
@@ -74,6 +85,15 @@ export declare function useFieldStatus(options: {
74
85
  /** Off: every field reports `none` and nothing is pending. */
75
86
  enabled?: Ref<boolean>;
76
87
  }): FieldStatusApi;
88
+ /**
89
+ * `focusin` / `pointerdown` handler for a field's wrapper element.
90
+ *
91
+ * Counts a focus the user made (tab, click, tap), or a pointer down on one of
92
+ * the field's controls. Not counted: focus the editor moved there itself
93
+ * (`revealFieldElement`, e.g. "Back to editor"), and the help button next to
94
+ * the title.
95
+ */
96
+ export declare function touchFieldOnInteraction(api: FieldStatusApi | undefined, field: BluepicField, event: Event): void;
77
97
  export declare const FIELD_STATUS_KEY: InjectionKey<FieldStatusApi>;
78
98
  export declare function provideFieldStatus(api: FieldStatusApi): void;
79
99
  /** Absent unless the editor turned field status on; the panel then shows no marks. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bluepic/embed",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "Bluepic embed sdk",
5
5
  "type": "module",
6
6
  "sideEffects": false,