@valbuild/shared 0.105.1 → 0.107.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.
|
@@ -82,6 +82,60 @@ export type ValCanvasPageMessage = {
|
|
|
82
82
|
type: "clicked";
|
|
83
83
|
/** The paths on the element that was clicked. */
|
|
84
84
|
paths: SourcePath[];
|
|
85
|
+
} | {
|
|
86
|
+
/**
|
|
87
|
+
* A two-finger gesture on the page.
|
|
88
|
+
*
|
|
89
|
+
* The page is a frame, and a frame keeps its own touches: nothing the
|
|
90
|
+
* studio listens for ever sees a finger that landed on the page. So the
|
|
91
|
+
* canvas cannot zoom by pinch unless the page says a pinch happened,
|
|
92
|
+
* which is what this is.
|
|
93
|
+
*
|
|
94
|
+
* Two fingers rather than one, and that is the whole division of labour:
|
|
95
|
+
* one finger belongs to the page — it scrolls it, taps its links, drags
|
|
96
|
+
* its carousels — and two belong to the window around it. Nothing has to
|
|
97
|
+
* be moded, and neither gesture can be mistaken for the other.
|
|
98
|
+
*/
|
|
99
|
+
val: typeof VAL_CANVAS_MESSAGE;
|
|
100
|
+
type: "pinch";
|
|
101
|
+
phase: "start" | "move" | "end";
|
|
102
|
+
/**
|
|
103
|
+
* Distance between the two touches, in the page's own CSS px.
|
|
104
|
+
*
|
|
105
|
+
* A span rather than a scale: the page has no idea what the studio is
|
|
106
|
+
* showing it at, so the only honest thing it can report is how far apart
|
|
107
|
+
* the fingers are. The studio turns the ratio against the span at
|
|
108
|
+
* `start` into a zoom.
|
|
109
|
+
*/
|
|
110
|
+
span: number;
|
|
111
|
+
/**
|
|
112
|
+
* Midpoint of the two touches, in the page's own coordinates.
|
|
113
|
+
*
|
|
114
|
+
* The same frame of reference as `ValCanvasElement.rect`, so the studio
|
|
115
|
+
* can map it into the window without knowing anything about the page.
|
|
116
|
+
*/
|
|
117
|
+
center: {
|
|
118
|
+
x: number;
|
|
119
|
+
y: number;
|
|
120
|
+
};
|
|
121
|
+
} | {
|
|
122
|
+
/**
|
|
123
|
+
* A zoom asked for by the pointer — ctrl/cmd + wheel, which is what a
|
|
124
|
+
* trackpad pinch reports as.
|
|
125
|
+
*
|
|
126
|
+
* Separate from `pinch` because it is a different kind of event and not
|
|
127
|
+
* a degenerate one: there are no fingers and therefore no span, only a
|
|
128
|
+
* step, and there is no start and end to hold an anchor across.
|
|
129
|
+
*/
|
|
130
|
+
val: typeof VAL_CANVAS_MESSAGE;
|
|
131
|
+
type: "zoom";
|
|
132
|
+
/** Multiply the current scale by this. */
|
|
133
|
+
factor: number;
|
|
134
|
+
/** Where the pointer was, in the page's own coordinates. */
|
|
135
|
+
center: {
|
|
136
|
+
x: number;
|
|
137
|
+
y: number;
|
|
138
|
+
};
|
|
85
139
|
} | {
|
|
86
140
|
val: typeof VAL_CANVAS_MESSAGE;
|
|
87
141
|
type: "refreshing";
|
|
@@ -3373,7 +3373,7 @@ function isValCanvasPageMessage(data) {
|
|
|
3373
3373
|
if (_typeof(data) !== "object" || data === null) return false;
|
|
3374
3374
|
var message = data;
|
|
3375
3375
|
if (message.val !== VAL_CANVAS_MESSAGE) return false;
|
|
3376
|
-
return message.type === "ready" || message.type === "elements" || message.type === "clicked" || message.type === "refreshing";
|
|
3376
|
+
return message.type === "ready" || message.type === "elements" || message.type === "clicked" || message.type === "pinch" || message.type === "zoom" || message.type === "refreshing";
|
|
3377
3377
|
}
|
|
3378
3378
|
|
|
3379
3379
|
/** Narrow an unknown `event.data` to a message from the studio. */
|
|
@@ -3373,7 +3373,7 @@ function isValCanvasPageMessage(data) {
|
|
|
3373
3373
|
if (_typeof(data) !== "object" || data === null) return false;
|
|
3374
3374
|
var message = data;
|
|
3375
3375
|
if (message.val !== VAL_CANVAS_MESSAGE) return false;
|
|
3376
|
-
return message.type === "ready" || message.type === "elements" || message.type === "clicked" || message.type === "refreshing";
|
|
3376
|
+
return message.type === "ready" || message.type === "elements" || message.type === "clicked" || message.type === "pinch" || message.type === "zoom" || message.type === "refreshing";
|
|
3377
3377
|
}
|
|
3378
3378
|
|
|
3379
3379
|
/** Narrow an unknown `event.data` to a message from the studio. */
|
|
@@ -3369,7 +3369,7 @@ function isValCanvasPageMessage(data) {
|
|
|
3369
3369
|
if (_typeof(data) !== "object" || data === null) return false;
|
|
3370
3370
|
var message = data;
|
|
3371
3371
|
if (message.val !== VAL_CANVAS_MESSAGE) return false;
|
|
3372
|
-
return message.type === "ready" || message.type === "elements" || message.type === "clicked" || message.type === "refreshing";
|
|
3372
|
+
return message.type === "ready" || message.type === "elements" || message.type === "clicked" || message.type === "pinch" || message.type === "zoom" || message.type === "refreshing";
|
|
3373
3373
|
}
|
|
3374
3374
|
|
|
3375
3375
|
/** Narrow an unknown `event.data` to a message from the studio. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@valbuild/shared",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.107.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Val shared types and utilities",
|
|
6
6
|
"repository": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"zod": "^4.3.5",
|
|
33
33
|
"zod-validation-error": "^5.0.0",
|
|
34
|
-
"@valbuild/core": "0.
|
|
34
|
+
"@valbuild/core": "0.106.0"
|
|
35
35
|
},
|
|
36
36
|
"files": [
|
|
37
37
|
"dist",
|