@bluepic/embed 0.4.0-next.142 → 0.4.0-next.144
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 +159 -159
- package/dist/bluepic-embed.umd.js +159 -159
- package/dist/components/BxAudioPlayButton.vue.d.ts +1 -1
- package/dist/components/TemplateEditor/BxTemplateEditor.vue.d.ts +41 -15
- package/dist/components/TemplateEditor/FieldHintsLayer.vue.d.ts +34 -0
- package/dist/components/TemplateEditor/TemplateView.vue.d.ts +11 -2
- package/dist/embed/embed.d.ts +96 -24
- package/dist/main.cjs +85 -85
- package/dist/main.mjs +21288 -20642
- package/dist/style.css +1 -1
- package/dist/util/fieldHints/fieldFocus.d.ts +70 -0
- package/dist/util/fieldHints/index.d.ts +7 -0
- package/dist/util/fieldHints/interact.d.ts +21 -0
- package/dist/util/fieldHints/useHintReveal.d.ts +9 -0
- package/package.json +2 -2
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { type InjectionKey } from 'vue';
|
|
2
|
+
import type { BluepicField } from '@bluepic/types';
|
|
3
|
+
/**
|
|
4
|
+
* Opens a field's own primary editing flow — for an image field, the "Select
|
|
5
|
+
* image" popup (or the device file picker, when that's all it offers).
|
|
6
|
+
*
|
|
7
|
+
* Registered BY the field component, because only it knows that flow. An
|
|
8
|
+
* `interact` hint reproducing it would mean duplicating image libraries,
|
|
9
|
+
* cropping, background removal and auto-crop on the overlay, and then watching
|
|
10
|
+
* the two copies drift.
|
|
11
|
+
*/
|
|
12
|
+
export type FieldActivator = () => void;
|
|
13
|
+
/**
|
|
14
|
+
* Connects a hint on the preview to the field control that drives it.
|
|
15
|
+
*
|
|
16
|
+
* The two halves live far apart — the hint renders inside zoompinch's matrix
|
|
17
|
+
* slot, the control somewhere down a recursive `FieldsList` — so this is
|
|
18
|
+
* provided by `BxTemplateEditor` and injected at both ends rather than threaded
|
|
19
|
+
* through props.
|
|
20
|
+
*
|
|
21
|
+
* DESKTOP registers elements here and focuses them directly. MOBILE does not:
|
|
22
|
+
* one field slide is on screen at a time, so "focus" there means swiping the
|
|
23
|
+
* swiper to the right slide, which only `BxTemplateEditor` can do. That
|
|
24
|
+
* asymmetry is why `focus()` is a controller method and not just a lookup.
|
|
25
|
+
*/
|
|
26
|
+
export type FieldFocusController = {
|
|
27
|
+
/** Desktop only; mobile slides are addressed by index, not by element. */
|
|
28
|
+
register(field: BluepicField, el: HTMLElement | null): void;
|
|
29
|
+
focus(field: BluepicField): void;
|
|
30
|
+
/** Field components self-register; pass `null` on unmount. */
|
|
31
|
+
registerActivator(field: BluepicField, activate: FieldActivator | null): void;
|
|
32
|
+
/**
|
|
33
|
+
* Runs the field's own flow. Returns false when the field never registered
|
|
34
|
+
* one, so the caller can fall back to plain focus instead of doing nothing.
|
|
35
|
+
*/
|
|
36
|
+
activate(field: BluepicField): boolean;
|
|
37
|
+
};
|
|
38
|
+
export declare const FIELD_FOCUS_KEY: InjectionKey<FieldFocusController>;
|
|
39
|
+
export declare function provideFieldFocus(controller: FieldFocusController): void;
|
|
40
|
+
/** Absent whenever the fields tree is rendered outside `BxTemplateEditor`. */
|
|
41
|
+
export declare function useFieldFocus(): FieldFocusController | undefined;
|
|
42
|
+
/** Marks the focused field for a moment so the eye can follow the jump. */
|
|
43
|
+
export declare const FIELD_FOCUS_FLASH_CLASS = "bx-field-hint-target";
|
|
44
|
+
/**
|
|
45
|
+
* Scroll a field's control into view, flash it, and focus the first thing in it
|
|
46
|
+
* that can take focus.
|
|
47
|
+
*
|
|
48
|
+
* `block: 'nearest'` rather than 'center': the fields panel is a scroll
|
|
49
|
+
* container, and centering yanks the whole list even when the target was
|
|
50
|
+
* already comfortably visible.
|
|
51
|
+
*/
|
|
52
|
+
export declare function revealFieldElement(el: HTMLElement | null | undefined): void;
|
|
53
|
+
/**
|
|
54
|
+
* Creates the desktop half: a registry keyed by the field object itself.
|
|
55
|
+
*
|
|
56
|
+
* A WeakMap (not a Map) because fields are plain objects off the serial — when
|
|
57
|
+
* the serial is swapped the old field objects should simply be collectable,
|
|
58
|
+
* with no unregister bookkeeping to get wrong.
|
|
59
|
+
*/
|
|
60
|
+
export declare function createFieldElementRegistry(): {
|
|
61
|
+
register(field: BluepicField, el: HTMLElement | null): void;
|
|
62
|
+
get(field: BluepicField): HTMLElement | undefined;
|
|
63
|
+
registerActivator(field: BluepicField, activate: FieldActivator | null): void;
|
|
64
|
+
activate(field: BluepicField): boolean;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Registers a field component's own editing flow for the lifetime of that
|
|
68
|
+
* component. A no-op outside `BxTemplateEditor`, where no controller is provided.
|
|
69
|
+
*/
|
|
70
|
+
export declare function useFieldActivator(field: () => BluepicField | undefined, activate: FieldActivator): void;
|
|
@@ -6,3 +6,10 @@ export { frameIndexOfPoint, hintPriorityClass, orderHitboxes, quadAABB, quadArea
|
|
|
6
6
|
export type { OrderableHitbox } from './geometry';
|
|
7
7
|
export { useFieldHitboxes } from './useFieldHitboxes';
|
|
8
8
|
export type { FieldHitbox } from './useFieldHitboxes';
|
|
9
|
+
export { useHintReveal } from './useHintReveal';
|
|
10
|
+
export { createFieldElementRegistry, provideFieldFocus, revealFieldElement, useFieldFocus, FIELD_FOCUS_KEY, FIELD_FOCUS_FLASH_CLASS, } from './fieldFocus';
|
|
11
|
+
export type { FieldFocusController } from './fieldFocus';
|
|
12
|
+
export { interactModeFor, inlineTextBinding, readFieldProp } from './interact';
|
|
13
|
+
export type { InteractMode } from './interact';
|
|
14
|
+
export { useFieldActivator } from './fieldFocus';
|
|
15
|
+
export type { FieldActivator } from './fieldFocus';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { BluepicField } from '@bluepic/types';
|
|
2
|
+
/**
|
|
3
|
+
* What an `interact` hint does when clicked.
|
|
4
|
+
*
|
|
5
|
+
* - `inline-text` — expand into a text input on the overlay, editing the value
|
|
6
|
+
* in place. Only for plain-text fields: a richtext field's value is a run
|
|
7
|
+
* array with its own toolbar, and a bare input would silently flatten it.
|
|
8
|
+
* - `activate` — run the field's own flow (image picker / upload dialog),
|
|
9
|
+
* via the activator the field component registered.
|
|
10
|
+
* - `focus` — nothing better available; jump to the control in the panel.
|
|
11
|
+
*/
|
|
12
|
+
export type InteractMode = 'inline-text' | 'activate' | 'focus';
|
|
13
|
+
/**
|
|
14
|
+
* `field.props` entries may be author expressions (functions) rather than
|
|
15
|
+
* literals, so a prop can only be read through the host's evaluator — the same
|
|
16
|
+
* `wrapFieldProps` treatment `FieldsList` gives every field component.
|
|
17
|
+
*/
|
|
18
|
+
export declare function readFieldProp<T>(value: T | (() => T), evaluate?: (fn: Function) => unknown): T | undefined;
|
|
19
|
+
export declare function interactModeFor(field: BluepicField, evaluate?: (fn: Function) => unknown): InteractMode;
|
|
20
|
+
/** The binding an inline text editor reads and writes. */
|
|
21
|
+
export declare function inlineTextBinding(field: BluepicField): string | undefined;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type Ref } from 'vue';
|
|
2
|
+
export declare function useHintReveal(enabled: Ref<boolean>): {
|
|
3
|
+
revealed: Ref<boolean, boolean>;
|
|
4
|
+
hide: () => void;
|
|
5
|
+
onPointerEnter: (event: PointerEvent) => void;
|
|
6
|
+
onPointerLeave: (event: PointerEvent) => void;
|
|
7
|
+
onPointerDown: (event: PointerEvent) => void;
|
|
8
|
+
onPointerUp: (event: PointerEvent) => void;
|
|
9
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bluepic/embed",
|
|
3
|
-
"version": "0.4.0-next.
|
|
3
|
+
"version": "0.4.0-next.144",
|
|
4
4
|
"description": "Bluepic embed sdk",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@auth0/auth0-vue": "^2.4.0",
|
|
48
|
-
"@bluepic/types": "^0.6.
|
|
48
|
+
"@bluepic/types": "^0.6.497",
|
|
49
49
|
"@hono/zod-openapi": "^1.1.4",
|
|
50
50
|
"@types/css": "^0.0.38",
|
|
51
51
|
"@types/downloadjs": "^1.4.6",
|