@widgetic/editor 4.1.13 → 4.1.15
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/components/PreviewChromeControls.svelte +15 -21
- package/dist/components/WidgetPreview.svelte +136 -105
- package/dist/components/color-select/ColorSelect.svelte +203 -224
- package/dist/components/color-select/constants.d.ts +4 -2
- package/dist/components/color-select/constants.js +4 -2
- package/dist/components/color-select/render.js +10 -9
- package/dist/components/editors/CompositionEditorApp.svelte +55 -40
- package/dist/components/editors/EditLeaseNotice.svelte +44 -33
- package/dist/components/editors/EmbedEditor.svelte +133 -259
- package/dist/components/editors/PropsEditor.svelte +426 -1333
- package/dist/components/editors/props-editor.css +5 -68
- package/dist/components/ic/AngleInputController.svelte +202 -277
- package/dist/components/ic/BrowserInputController.svelte +813 -803
- package/dist/components/ic/CheckboxInputController.svelte +92 -169
- package/dist/components/ic/CheckboxInputController.svelte.d.ts +2 -8
- package/dist/components/ic/ColorPickerInputController.svelte +1589 -1587
- package/dist/components/ic/ColorPickerInputController.svelte.d.ts +3 -3
- package/dist/components/ic/DateFieldInputController.svelte +455 -465
- package/dist/components/ic/DatePickerInputController.svelte +355 -368
- package/dist/components/ic/DatePickerInputController.svelte.d.ts +1 -1
- package/dist/components/ic/DropdownInputController.svelte +130 -200
- package/dist/components/ic/FixedPositionInputController.svelte +255 -276
- package/dist/components/ic/FixedPositionInputController.svelte.d.ts +5 -1
- package/dist/components/ic/FontInputController.svelte +2110 -2231
- package/dist/components/ic/FontInputController.svelte.d.ts +11 -11
- package/dist/components/ic/InputControllerHeader.svelte +141 -147
- package/dist/components/ic/InputControllerRenderer.svelte +5 -1
- package/dist/components/ic/InputControllerRenderer.svelte.d.ts +2 -1
- package/dist/components/ic/InputControllerRow.svelte +74 -0
- package/dist/components/ic/InputControllerRow.svelte.d.ts +14 -0
- package/dist/components/ic/KnowledgeDocumentsInputController.svelte +401 -0
- package/dist/components/ic/KnowledgeDocumentsInputController.svelte.d.ts +11 -0
- package/dist/components/ic/KnowledgeTextForm.svelte +109 -0
- package/dist/components/ic/KnowledgeTextForm.svelte.d.ts +15 -0
- package/dist/components/ic/NumberControls.svelte +303 -269
- package/dist/components/ic/NumberControls.svelte.d.ts +4 -1
- package/dist/components/ic/NumberInputController.svelte +361 -301
- package/dist/components/ic/NumberInputController.svelte.d.ts +2 -0
- package/dist/components/ic/PositionInputController.svelte +253 -176
- package/dist/components/ic/PositionInputController.svelte.d.ts +2 -0
- package/dist/components/ic/RadioGroupInputController.svelte +71 -137
- package/dist/components/ic/RadioGroupInputController.svelte.d.ts +2 -8
- package/dist/components/ic/RangeCalendarInputController.svelte +233 -270
- package/dist/components/ic/RangeCalendarInputController.svelte.d.ts +2 -2
- package/dist/components/ic/RoundedCornersInputController.svelte +412 -435
- package/dist/components/ic/RoundedCornersInputController.svelte.d.ts +2 -0
- package/dist/components/ic/SliderInputController.svelte +263 -332
- package/dist/components/ic/SliderInputController.svelte.d.ts +1 -1
- package/dist/components/ic/SliderRangeInputController.svelte +140 -144
- package/dist/components/ic/SliderRangeInputController.svelte.d.ts +3 -3
- package/dist/components/ic/SwitchInputController.svelte +47 -109
- package/dist/components/ic/TagsInputController.svelte +95 -110
- package/dist/components/ic/TextAreaInputController.svelte +1794 -1935
- package/dist/components/ic/TextAreaPreviewInputController.svelte +436 -438
- package/dist/components/ic/TextAreaPreviewInputController.svelte.d.ts +2 -2
- package/dist/components/ic/TextInputController.svelte +65 -75
- package/dist/components/ic/TextInputController.svelte.d.ts +2 -0
- package/dist/components/ic/TimeInputController.svelte +433 -431
- package/dist/components/ic/VectorInputController.svelte +1833 -1831
- package/dist/components/ic/VectorInputController.svelte.d.ts +10 -10
- package/dist/components/ic/index.d.ts +2 -0
- package/dist/components/ic/index.js +2 -0
- package/dist/components/ic/shared/CategoryTabs.svelte +28 -35
- package/dist/components/ic/shared/ItemGrid.svelte +145 -179
- package/dist/components/ic/shared/RecentItemsSection.svelte +208 -271
- package/dist/components/ic/shared/RecentItemsSection.svelte.d.ts +1 -1
- package/dist/components/ui/arrows/OpacitySliderArrows.svelte +23 -38
- package/dist/components/ui/arrows/OpacitySliderArrows.svelte.d.ts +1 -4
- package/dist/components/ui/calendar-editor-fit/EditorCalendarStyles.svelte +45 -0
- package/dist/components/ui/calendar-editor-fit/EditorCalendarStyles.svelte.d.ts +26 -0
- package/dist/components/ui/checkerboard-background/CheckerboardBackground.svelte +20 -12
- package/dist/components/ui/shadow-picker-host/ShadowPickerHost.svelte +39 -0
- package/dist/components/ui/shadow-picker-host/ShadowPickerHost.svelte.d.ts +10 -0
- package/dist/composition/compositionApi.d.ts +21 -1
- package/dist/composition/compositionApi.js +64 -5
- package/dist/composition/knowledgeDocuments.d.ts +90 -0
- package/dist/composition/knowledgeDocuments.js +94 -0
- package/dist/composition/knowledgeDocumentsPanel.d.ts +152 -0
- package/dist/composition/knowledgeDocumentsPanel.js +443 -0
- package/dist/i18n/language.d.ts +86 -36
- package/dist/i18n/messages.d.ts +97 -34
- package/dist/i18n/messages.js +104 -34
- package/dist/i18n/translate.d.ts +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/knowledgeDocumentsContext.d.ts +10 -0
- package/dist/knowledgeDocumentsContext.js +31 -0
- package/dist/utils.d.ts +7 -0
- package/dist/utils.js +26 -2
- package/package.json +4 -4
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { InputControllerConfig } from './index';
|
|
2
|
+
/** Declared props contract — export lets below are annotated from it so the
|
|
3
|
+
* interface cannot drift from what the component actually reads. */
|
|
2
4
|
/** Declared props contract — export lets below are annotated from it so the
|
|
3
5
|
* interface cannot drift from what the component actually reads. */
|
|
4
6
|
export interface NumberInputControllerProps {
|
|
@@ -18,31 +18,41 @@
|
|
|
18
18
|
-->
|
|
19
19
|
|
|
20
20
|
<script module lang="ts">
|
|
21
|
+
/** Declared props contract — export lets below are annotated from it so the
|
|
22
|
+
* interface cannot drift from what the component actually reads. */
|
|
21
23
|
/** Declared props contract — export lets below are annotated from it so the
|
|
22
24
|
* interface cannot drift from what the component actually reads. */
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
export interface PositionInputControllerProps {
|
|
26
|
+
value?: { x: number; y: number };
|
|
27
|
+
onChange: (newValue: { x: number; y: number }) => void;
|
|
28
|
+
onFocus?: () => void;
|
|
29
|
+
maskThumb?: boolean;
|
|
30
|
+
onDragStateChange?: (isDragging: boolean) => void;
|
|
31
|
+
}
|
|
30
32
|
</script>
|
|
31
33
|
|
|
32
34
|
<script lang="ts">
|
|
33
|
-
|
|
34
|
-
|
|
35
|
+
// Svelte imports
|
|
36
|
+
import { onMount, onDestroy } from 'svelte';
|
|
35
37
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
+
// Component config
|
|
39
|
+
import type { InputControllerConfig } from './index';
|
|
38
40
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
41
|
+
// The cursor of a drag is shown on the module's element, not on the body of the customer's page
|
|
42
|
+
import { lockPointerStyle } from '../../utils/shadowDom';
|
|
43
|
+
import { useEditorLanguage } from '../../i18n/language';
|
|
42
44
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
45
|
+
// The words of the editor in the language of the page.
|
|
46
|
+
const { t } = useEditorLanguage();
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Core state and configuration props
|
|
50
|
+
* value: Current position coordinates
|
|
51
|
+
* onChange: Callback for position updates
|
|
52
|
+
* config: Additional configuration options
|
|
53
|
+
* onFocus: Focus event handler
|
|
54
|
+
* onDragStateChange: Callback for dragging state changes
|
|
55
|
+
*/
|
|
46
56
|
/**
|
|
47
57
|
* Core state and configuration props
|
|
48
58
|
* value: Current position coordinates
|
|
@@ -51,45 +61,58 @@
|
|
|
51
61
|
* onFocus: Focus event handler
|
|
52
62
|
* onDragStateChange: Callback for dragging state changes
|
|
53
63
|
*/
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
64
|
+
export let value: PositionInputControllerProps['value'] = undefined;
|
|
65
|
+
export let onChange: PositionInputControllerProps['onChange'];
|
|
66
|
+
export let onFocus: PositionInputControllerProps['onFocus'] = () => {};
|
|
67
|
+
export let maskThumb: PositionInputControllerProps['maskThumb'] = true;
|
|
68
|
+
export let onDragStateChange: PositionInputControllerProps['onDragStateChange'] = () => {};
|
|
59
69
|
|
|
70
|
+
/**
|
|
71
|
+
* DOM references and state
|
|
72
|
+
* Used for position calculations and drag handling
|
|
73
|
+
*/
|
|
60
74
|
/**
|
|
61
75
|
* DOM references and state
|
|
62
76
|
* Used for position calculations and drag handling
|
|
63
77
|
*/
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
78
|
+
let joystickContainer: HTMLDivElement;
|
|
79
|
+
let joystickHandle: HTMLDivElement;
|
|
80
|
+
let isDragging = false;
|
|
81
|
+
let isHovering = false;
|
|
82
|
+
// Puts back the cursor the page had before the drag (does nothing when no drag is going on)
|
|
83
|
+
let releasePointerStyle: () => void = () => {};
|
|
70
84
|
|
|
85
|
+
/**
|
|
86
|
+
* Reactive position state
|
|
87
|
+
* Defaults to center (50,50) if no value provided
|
|
88
|
+
*/
|
|
71
89
|
/**
|
|
72
90
|
* Reactive position state
|
|
73
91
|
* Defaults to center (50,50) if no value provided
|
|
74
92
|
*/
|
|
75
|
-
|
|
93
|
+
$: position = value || { x: 50, y: 50 };
|
|
76
94
|
|
|
95
|
+
/**
|
|
96
|
+
* Formatted display values with fixed precision
|
|
97
|
+
* Handles null/undefined gracefully
|
|
98
|
+
*/
|
|
77
99
|
/**
|
|
78
100
|
* Formatted display values with fixed precision
|
|
79
101
|
* Handles null/undefined gracefully
|
|
80
102
|
*/
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Reactive indicator position
|
|
86
|
-
* Moves indicators to top when thumb is in lower half
|
|
87
|
-
*/
|
|
88
|
-
$: shouldShowAtTop = position.y > 50;
|
|
103
|
+
$: formattedX = (position?.x ?? 0).toFixed(0);
|
|
104
|
+
$: formattedY = (position?.y ?? 0).toFixed(0);
|
|
89
105
|
|
|
90
|
-
|
|
91
|
-
|
|
106
|
+
// Compute whether to mask the thumb based on interaction state
|
|
107
|
+
$: shouldMaskThumb = maskThumb && !isDragging && !isHovering;
|
|
92
108
|
|
|
109
|
+
/**
|
|
110
|
+
* Updates position based on cursor/touch coordinates
|
|
111
|
+
* Converts screen coordinates to percentage values
|
|
112
|
+
* Enforces boundaries (0-100%)
|
|
113
|
+
* @param clientX - Screen X coordinate
|
|
114
|
+
* @param clientY - Screen Y coordinate
|
|
115
|
+
*/
|
|
93
116
|
/**
|
|
94
117
|
* Updates position based on cursor/touch coordinates
|
|
95
118
|
* Converts screen coordinates to percentage values
|
|
@@ -97,176 +120,230 @@
|
|
|
97
120
|
* @param clientX - Screen X coordinate
|
|
98
121
|
* @param clientY - Screen Y coordinate
|
|
99
122
|
*/
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
// Clamp values to valid range
|
|
110
|
-
x = Math.max(0, Math.min(100, x));
|
|
111
|
-
y = Math.max(0, Math.min(100, y));
|
|
112
|
-
|
|
113
|
-
position = { x, y };
|
|
114
|
-
onChange(position);
|
|
115
|
-
}
|
|
123
|
+
function updatePosition(clientX: number, clientY: number) {
|
|
124
|
+
if (!joystickContainer) return;
|
|
125
|
+
|
|
126
|
+
const rect = joystickContainer.getBoundingClientRect();
|
|
127
|
+
|
|
128
|
+
// Convert pixel coordinates to percentages
|
|
129
|
+
let x = ((clientX - rect.left) / rect.width) * 100;
|
|
130
|
+
let y = ((clientY - rect.top) / rect.height) * 100;
|
|
116
131
|
|
|
132
|
+
// Clamp values to valid range
|
|
133
|
+
x = Math.max(0, Math.min(100, x));
|
|
134
|
+
y = Math.max(0, Math.min(100, y));
|
|
135
|
+
|
|
136
|
+
position = { x, y };
|
|
137
|
+
onChange(position);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Mouse event handlers
|
|
142
|
+
* Manages dragging state and cursor appearance
|
|
143
|
+
* Prevents text selection during drag
|
|
144
|
+
*/
|
|
117
145
|
/**
|
|
118
146
|
* Mouse event handlers
|
|
119
147
|
* Manages dragging state and cursor appearance
|
|
120
148
|
* Prevents text selection during drag
|
|
121
149
|
*/
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
150
|
+
function handleMouseEnter() {
|
|
151
|
+
isHovering = true;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function handleMouseLeave() {
|
|
155
|
+
isHovering = false;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function handleMouseDown(event: MouseEvent) {
|
|
159
|
+
isDragging = true;
|
|
160
|
+
onDragStateChange(true);
|
|
161
|
+
onFocus();
|
|
162
|
+
updatePosition(event.clientX, event.clientY);
|
|
163
|
+
document.addEventListener('mousemove', handleMouseMove);
|
|
164
|
+
document.addEventListener('mouseup', handleMouseUp);
|
|
165
|
+
// A second press before the first one was let go must not leave the first lock behind
|
|
166
|
+
// Only undoes what this drag did (it used to clear the cursor and the text selection of the whole page)
|
|
137
167
|
// A second press before the first one was let go must not leave the first lock behind
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
function handleMouseUp() {
|
|
148
|
-
isDragging = false;
|
|
149
|
-
onDragStateChange(false);
|
|
150
|
-
document.removeEventListener('mousemove', handleMouseMove);
|
|
151
|
-
document.removeEventListener('mouseup', handleMouseUp);
|
|
152
|
-
releasePointerStyle();
|
|
153
|
-
}
|
|
168
|
+
releasePointerStyle();
|
|
169
|
+
releasePointerStyle = lockPointerStyle(joystickContainer, 'grabbing');
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function handleMouseMove(event: MouseEvent) {
|
|
173
|
+
if (!isDragging) return;
|
|
174
|
+
updatePosition(event.clientX, event.clientY);
|
|
175
|
+
}
|
|
154
176
|
|
|
177
|
+
function handleMouseUp() {
|
|
178
|
+
isDragging = false;
|
|
179
|
+
onDragStateChange(false);
|
|
180
|
+
document.removeEventListener('mousemove', handleMouseMove);
|
|
181
|
+
document.removeEventListener('mouseup', handleMouseUp);
|
|
182
|
+
releasePointerStyle();
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Touch event handlers
|
|
187
|
+
* Provides touch support with similar behavior to mouse events
|
|
188
|
+
*/
|
|
155
189
|
/**
|
|
156
190
|
* Touch event handlers
|
|
157
191
|
* Provides touch support with similar behavior to mouse events
|
|
158
192
|
*/
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
193
|
+
function handleTouchStart(event: TouchEvent) {
|
|
194
|
+
isDragging = true;
|
|
195
|
+
onDragStateChange(true);
|
|
196
|
+
onFocus();
|
|
197
|
+
updatePosition(event.touches[0].clientX, event.touches[0].clientY);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
function handleTouchMove(event: TouchEvent) {
|
|
201
|
+
if (!isDragging) return;
|
|
202
|
+
updatePosition(event.touches[0].clientX, event.touches[0].clientY);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
function handleTouchEnd() {
|
|
206
|
+
isDragging = false;
|
|
207
|
+
onDragStateChange(false);
|
|
208
|
+
}
|
|
175
209
|
|
|
210
|
+
/**
|
|
211
|
+
* Lifecycle hooks
|
|
212
|
+
* Setup and cleanup of event listeners
|
|
213
|
+
*/
|
|
176
214
|
/**
|
|
177
215
|
* Lifecycle hooks
|
|
178
216
|
* Setup and cleanup of event listeners
|
|
179
217
|
*/
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
218
|
+
onMount(() => {
|
|
219
|
+
return () => {
|
|
220
|
+
document.removeEventListener('mousemove', handleMouseMove);
|
|
221
|
+
document.removeEventListener('mouseup', handleMouseUp);
|
|
222
|
+
};
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
onDestroy(() => {
|
|
226
|
+
// Only undoes what this drag did (it used to clear the cursor and the text selection of the whole page)
|
|
227
|
+
releasePointerStyle();
|
|
228
|
+
});
|
|
191
229
|
</script>
|
|
192
230
|
|
|
193
|
-
|
|
231
|
+
<!-- Percentage display with dynamic positioning -->
|
|
232
|
+
<!-- Position indicator thumb -->
|
|
233
|
+
<!-- svelte-ignore element_invalid_self_closing_tag -->
|
|
194
234
|
<!-- Joystick UI -->
|
|
195
235
|
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
236
|
+
<div class="position-input-controller" class:position-input-controller-dragging={isDragging}>
|
|
237
|
+
<!-- Joystick UI -->
|
|
238
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
239
|
+
<div
|
|
240
|
+
bind:this={joystickContainer}
|
|
241
|
+
dir="ltr"
|
|
242
|
+
class="joystick-container relative h-[185px] w-full max-w-editor-control rounded-lg bg-accent transition-colors duration-fast hover:bg-accent-hover focus-within:outline-hidden focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2 focus-within:ring-offset-background"
|
|
243
|
+
class:overflow-hidden={shouldMaskThumb}
|
|
244
|
+
on:mouseenter={handleMouseEnter}
|
|
245
|
+
on:mouseleave={handleMouseLeave}
|
|
246
|
+
on:mousedown={handleMouseDown}
|
|
247
|
+
on:touchstart={handleTouchStart}
|
|
248
|
+
on:touchmove={handleTouchMove}
|
|
249
|
+
on:touchend={handleTouchEnd}
|
|
250
|
+
>
|
|
251
|
+
<!-- Grid lines -->
|
|
208
252
|
<!-- Grid lines -->
|
|
209
|
-
|
|
253
|
+
<div class="absolute inset-0 grid-background"></div>
|
|
210
254
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
255
|
+
<!-- Position indicator thumb -->
|
|
256
|
+
<!-- svelte-ignore element_invalid_self_closing_tag -->
|
|
257
|
+
<div
|
|
258
|
+
bind:this={joystickHandle}
|
|
259
|
+
class="absolute z-10 size-5 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-primary bg-background transition-transform duration-fast {isDragging
|
|
260
|
+
? 'scale-110'
|
|
261
|
+
: 'hover:scale-110'}"
|
|
262
|
+
style="left: {position.x}%; top: {position.y}%; /* rtl-ok: x counts from the left edge of the pad, which is a left to right island */"
|
|
263
|
+
/>
|
|
218
264
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
<span class="caption text-grey7 w-[12px]">{$t('editor.position.x')}</span>
|
|
228
|
-
<span class="subtext text-grey7 w-[32px]">{formattedX}%</span>
|
|
229
|
-
</div>
|
|
230
|
-
<div class="flex items-center gap-2 w-[50px]">
|
|
231
|
-
<span class="caption text-grey7 w-[12px]">{$t('editor.position.y')}</span>
|
|
232
|
-
<span class="subtext text-grey7 w-[32px]">{formattedY}%</span>
|
|
233
|
-
</div>
|
|
234
|
-
</div>
|
|
235
|
-
</div>
|
|
265
|
+
<!-- Figma readout: y=56, 185×20, centred above the thumb at default position (not on the thumb). -->
|
|
266
|
+
<p
|
|
267
|
+
class="position-readout pointer-events-none absolute inset-x-0 top-14 z-[5] h-5 text-center text-body text-foreground transition-opacity duration-fast"
|
|
268
|
+
style="opacity: {isDragging ? 0.5 : 1}"
|
|
269
|
+
>
|
|
270
|
+
{$t('editor.position.readout', { x: formattedX, y: formattedY })}
|
|
271
|
+
</p>
|
|
272
|
+
</div>
|
|
236
273
|
</div>
|
|
237
274
|
|
|
238
275
|
<style>
|
|
276
|
+
/* While dragging, everything inside the controller shows the grabbing cursor (this used to be a class on the page's body) */
|
|
239
277
|
/* While dragging, everything inside the controller shows the grabbing cursor (this used to be a class on the page's body) */
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
278
|
+
.position-input-controller-dragging :global(*) {
|
|
279
|
+
cursor: grabbing !important;
|
|
280
|
+
user-select: none !important;
|
|
281
|
+
-webkit-user-select: none !important;
|
|
282
|
+
-moz-user-select: none !important;
|
|
283
|
+
-ms-user-select: none !important;
|
|
284
|
+
}
|
|
247
285
|
|
|
286
|
+
/* Add pointer cursor for interactive areas */
|
|
248
287
|
/* Add pointer cursor for interactive areas */
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
288
|
+
.joystick-container {
|
|
289
|
+
cursor: grab !important;
|
|
290
|
+
}
|
|
252
291
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
292
|
+
.joystick-container:active {
|
|
293
|
+
cursor: grabbing !important;
|
|
294
|
+
}
|
|
256
295
|
|
|
296
|
+
/* Remove default focus outline */
|
|
257
297
|
/* Remove default focus outline */
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
298
|
+
.joystick-container:focus {
|
|
299
|
+
outline: none !important;
|
|
300
|
+
}
|
|
261
301
|
|
|
302
|
+
/* Grid lines at x/y 46, 93, 139 px on the 185px pad (Figma IC Position). */
|
|
262
303
|
/* Grid background using gradients */
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
304
|
+
.grid-background {
|
|
305
|
+
background-image:
|
|
306
|
+
linear-gradient(
|
|
307
|
+
to right,
|
|
308
|
+
transparent calc(46px - 0.01px),
|
|
309
|
+
var(--brand-subtle) 46px,
|
|
310
|
+
var(--brand-subtle) calc(46px + 1px),
|
|
311
|
+
transparent calc(46px + 1px)
|
|
312
|
+
),
|
|
313
|
+
linear-gradient(
|
|
314
|
+
to right,
|
|
315
|
+
transparent calc(93px - 0.01px),
|
|
316
|
+
var(--brand-subtle) 93px,
|
|
317
|
+
var(--brand-subtle) calc(93px + 1px),
|
|
318
|
+
transparent calc(93px + 1px)
|
|
319
|
+
),
|
|
320
|
+
linear-gradient(
|
|
321
|
+
to right,
|
|
322
|
+
transparent calc(139px - 0.01px),
|
|
323
|
+
var(--brand-subtle) 139px,
|
|
324
|
+
var(--brand-subtle) calc(139px + 1px),
|
|
325
|
+
transparent calc(139px + 1px)
|
|
326
|
+
),
|
|
327
|
+
linear-gradient(
|
|
328
|
+
to bottom,
|
|
329
|
+
transparent calc(46px - 0.01px),
|
|
330
|
+
var(--brand-subtle) 46px,
|
|
331
|
+
var(--brand-subtle) calc(46px + 1px),
|
|
332
|
+
transparent calc(46px + 1px)
|
|
333
|
+
),
|
|
334
|
+
linear-gradient(
|
|
335
|
+
to bottom,
|
|
336
|
+
transparent calc(93px - 0.01px),
|
|
337
|
+
var(--brand-subtle) 93px,
|
|
338
|
+
var(--brand-subtle) calc(93px + 1px),
|
|
339
|
+
transparent calc(93px + 1px)
|
|
340
|
+
),
|
|
341
|
+
linear-gradient(
|
|
342
|
+
to bottom,
|
|
343
|
+
transparent calc(139px - 0.01px),
|
|
344
|
+
var(--brand-subtle) 139px,
|
|
345
|
+
var(--brand-subtle) calc(139px + 1px),
|
|
346
|
+
transparent calc(139px + 1px)
|
|
347
|
+
);
|
|
348
|
+
}
|
|
272
349
|
</style>
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/** Declared props contract — export lets below are annotated from it so the
|
|
2
|
+
* interface cannot drift from what the component actually reads. */
|
|
1
3
|
/** Declared props contract — export lets below are annotated from it so the
|
|
2
4
|
* interface cannot drift from what the component actually reads. */
|
|
3
5
|
export interface PositionInputControllerProps {
|