@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,73 +1,10 @@
|
|
|
1
|
-
/* Props Editor
|
|
2
|
-
* Global page rules (body, *, focus) live in app.css (standalone only). */
|
|
1
|
+
/* Props Editor — global hooks used by the standalone app (see app.css). Component rules live in PropsEditor.svelte. */
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
opacity: 1 !important;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
/* When no header exists, show on entire container hover */
|
|
11
|
-
.props-editor-container:not(:has(.header-hover-area)) {
|
|
12
|
-
position: relative;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.props-editor-container:not(:has(.header-hover-area)):hover .drag-handle-container {
|
|
16
|
-
opacity: 1 !important;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.drag-handle-container {
|
|
20
|
-
opacity: 0;
|
|
21
|
-
transition: opacity 0.3s ease;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.widgetic-colors .drag-handle svg {
|
|
25
|
-
color: hsl(var(--grey2)) !important;
|
|
26
|
-
transition: color 0.2s ease !important;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.widgetic-colors .drag-handle:hover svg {
|
|
30
|
-
color: hsl(var(--grey3)) !important;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/* GENERAL WIDGETIC COLORS RULES in all EDITOR */
|
|
34
|
-
/* Ensure buttons don't change background on hover */
|
|
35
|
-
.widgetic-colors button.bg-white:hover {
|
|
36
|
-
background-color: white !important;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/* Ensure proper button text alignment */
|
|
40
|
-
.widgetic-colors button span {
|
|
41
|
-
line-height: 1;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/* Override button hover states in all contexts */
|
|
45
|
-
.widgetic-colors button.bg-white {
|
|
46
|
-
background-color: white !important;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
.widgetic-colors button.bg-white:hover {
|
|
50
|
-
background-color: white !important;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/* General Icons color states */
|
|
54
|
-
.widgetic-colors button svg {
|
|
55
|
-
color: hsl(var(--grey5));
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
.widgetic-colors button:hover svg {
|
|
59
|
-
color: hsl(var(--grey7));
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
.design-tab-content[data-state="active"]{
|
|
63
|
-
display: block;
|
|
64
|
-
margin-top: var(--has-both-schemas, 1rem);
|
|
3
|
+
.design-tab-content[data-state='active'] {
|
|
4
|
+
display: block;
|
|
5
|
+
margin-top: var(--has-both-schemas, 1rem);
|
|
65
6
|
}
|
|
66
7
|
|
|
67
8
|
.props-editor-container:has(.tabs-header) {
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
.content-items-wrapper {
|
|
72
|
-
padding-top: 1rem;
|
|
9
|
+
--has-both-schemas: 1rem;
|
|
73
10
|
}
|
|
@@ -1,290 +1,215 @@
|
|
|
1
|
-
<!--
|
|
1
|
+
<!--
|
|
2
2
|
* AngleInputController
|
|
3
|
-
*
|
|
3
|
+
*
|
|
4
4
|
* Extends NumberInputController to add a visual circular indicator for angle selection.
|
|
5
5
|
* Maintains all number input functionality while adding drag-to-rotate capability.
|
|
6
|
-
*
|
|
7
|
-
* Features:
|
|
8
|
-
* - Visual angle selection via draggable indicator
|
|
9
|
-
* - Full number input functionality from parent
|
|
10
|
-
* - Touch and mouse support
|
|
11
|
-
* - Smooth transitions and visual feedback
|
|
12
6
|
-->
|
|
13
7
|
|
|
14
8
|
<script module lang="ts">
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
9
|
+
import type { InputControllerConfig } from './index';
|
|
10
|
+
|
|
11
|
+
/** Declared props contract — export lets below are annotated from it so the
|
|
12
|
+
* interface cannot drift from what the component actually reads. */
|
|
13
|
+
export interface AngleInputControllerProps {
|
|
14
|
+
label: string;
|
|
15
|
+
value?: number;
|
|
16
|
+
onChange: (newValue: number) => void;
|
|
17
|
+
config?: InputControllerConfig;
|
|
18
|
+
helpText?: string;
|
|
19
|
+
onFocus?: () => void;
|
|
20
|
+
}
|
|
27
21
|
</script>
|
|
28
22
|
|
|
29
23
|
<script lang="ts">
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
if (!isDragging) return;
|
|
174
|
-
event.preventDefault();
|
|
175
|
-
updateAngle(event.clientX, event.clientY);
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
function handleMouseUp() {
|
|
179
|
-
isDragging = false;
|
|
180
|
-
document.removeEventListener('mousemove', handleMouseMove);
|
|
181
|
-
document.removeEventListener('mouseup', handleMouseUp);
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
function handleTouchStart(event: TouchEvent) {
|
|
185
|
-
if (!circleContainer) return;
|
|
186
|
-
|
|
187
|
-
const touch = event.touches[0];
|
|
188
|
-
// First snap to the touched position
|
|
189
|
-
updateAngle(touch.clientX, touch.clientY, true);
|
|
190
|
-
|
|
191
|
-
isDragging = true;
|
|
192
|
-
onFocus();
|
|
193
|
-
event.preventDefault();
|
|
194
|
-
|
|
195
|
-
const rect = circleContainer.getBoundingClientRect();
|
|
196
|
-
const centerX = rect.left + rect.width / 2;
|
|
197
|
-
const centerY = rect.top + rect.height / 2;
|
|
198
|
-
|
|
199
|
-
// Store the starting angle from touch position
|
|
200
|
-
startAngle = calculateAngle(touch.clientX, touch.clientY, centerX, centerY);
|
|
201
|
-
// Store the current value as the starting value
|
|
202
|
-
startValue = value;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
function handleTouchMove(event: TouchEvent) {
|
|
206
|
-
if (!isDragging) return;
|
|
207
|
-
event.preventDefault();
|
|
208
|
-
const touch = event.touches[0];
|
|
209
|
-
updateAngle(touch.clientX, touch.clientY);
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
function handleTouchEnd(event: TouchEvent) {
|
|
213
|
-
event.preventDefault();
|
|
214
|
-
isDragging = false;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
function handleClick(adjustment: number) {
|
|
218
|
-
let newValue = value + adjustment;
|
|
219
|
-
if (newValue >= 360) newValue -= 360;
|
|
220
|
-
if (newValue < 0) newValue += 360;
|
|
221
|
-
value = newValue;
|
|
222
|
-
onChange(newValue);
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
onDestroy(() => {
|
|
226
|
-
document.removeEventListener('mousemove', handleMouseMove);
|
|
227
|
-
document.removeEventListener('mouseup', handleMouseUp);
|
|
228
|
-
});
|
|
24
|
+
import { onDestroy } from 'svelte';
|
|
25
|
+
import InputControllerRow from './InputControllerRow.svelte';
|
|
26
|
+
import NumberControls from './NumberControls.svelte';
|
|
27
|
+
|
|
28
|
+
export let label: AngleInputControllerProps['label'];
|
|
29
|
+
export let value: AngleInputControllerProps['value'] = 0;
|
|
30
|
+
export let onChange: AngleInputControllerProps['onChange'];
|
|
31
|
+
export let config: AngleInputControllerProps['config'] = {};
|
|
32
|
+
export let helpText: AngleInputControllerProps['helpText'] = undefined;
|
|
33
|
+
export let onFocus: AngleInputControllerProps['onFocus'] = () => {};
|
|
34
|
+
|
|
35
|
+
// Circle indicator state
|
|
36
|
+
let isDragging = false;
|
|
37
|
+
let circleContainer: HTMLDivElement;
|
|
38
|
+
let inputValue = value.toString();
|
|
39
|
+
let startAngle = 0;
|
|
40
|
+
let startValue = 0;
|
|
41
|
+
|
|
42
|
+
// Configuration with defaults
|
|
43
|
+
$: min = config.min || 0;
|
|
44
|
+
$: max = config.max || 360;
|
|
45
|
+
$: step = config.step || 1;
|
|
46
|
+
|
|
47
|
+
// Keep input value in sync with value prop
|
|
48
|
+
$: {
|
|
49
|
+
if (value.toString() !== inputValue) {
|
|
50
|
+
inputValue = value.toString();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Calculates the angle between two points relative to a center point
|
|
56
|
+
*/
|
|
57
|
+
function calculateAngle(x: number, y: number, centerX: number, centerY: number): number {
|
|
58
|
+
// Calculate angle and convert to degrees, with 0 pointing up
|
|
59
|
+
const angle = Math.atan2(x - centerX, -(y - centerY)) * (180 / Math.PI);
|
|
60
|
+
// Normalize to 0-360 range
|
|
61
|
+
return (angle + 360) % 360;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Updates angle based on mouse/touch position
|
|
66
|
+
*/
|
|
67
|
+
function updateAngle(clientX: number, clientY: number, shouldSnapToPosition: boolean = false) {
|
|
68
|
+
if (!circleContainer || (!isDragging && !shouldSnapToPosition)) return;
|
|
69
|
+
|
|
70
|
+
const rect = circleContainer.getBoundingClientRect();
|
|
71
|
+
const centerX = rect.left + rect.width / 2;
|
|
72
|
+
const centerY = rect.top + rect.height / 2;
|
|
73
|
+
|
|
74
|
+
const currentAngle = calculateAngle(clientX, clientY, centerX, centerY);
|
|
75
|
+
|
|
76
|
+
if (shouldSnapToPosition) {
|
|
77
|
+
let newValue = Math.round(currentAngle / step) * step;
|
|
78
|
+
if (newValue !== value) {
|
|
79
|
+
value = newValue;
|
|
80
|
+
onChange(newValue);
|
|
81
|
+
startAngle = currentAngle;
|
|
82
|
+
startValue = newValue;
|
|
83
|
+
}
|
|
84
|
+
} else {
|
|
85
|
+
let angleDiff = currentAngle - startAngle;
|
|
86
|
+
if (angleDiff < -180) angleDiff += 360;
|
|
87
|
+
if (angleDiff > 180) angleDiff -= 360;
|
|
88
|
+
|
|
89
|
+
let newValue = startValue + angleDiff;
|
|
90
|
+
if (newValue < 0) newValue += 360;
|
|
91
|
+
if (newValue >= 360) newValue -= 360;
|
|
92
|
+
|
|
93
|
+
newValue = Math.round(newValue / step) * step;
|
|
94
|
+
|
|
95
|
+
if (newValue !== value) {
|
|
96
|
+
value = newValue;
|
|
97
|
+
onChange(newValue);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function handleMouseDown(event: MouseEvent) {
|
|
103
|
+
if (!circleContainer) return;
|
|
104
|
+
|
|
105
|
+
updateAngle(event.clientX, event.clientY, true);
|
|
106
|
+
|
|
107
|
+
isDragging = true;
|
|
108
|
+
onFocus();
|
|
109
|
+
|
|
110
|
+
const rect = circleContainer.getBoundingClientRect();
|
|
111
|
+
const centerX = rect.left + rect.width / 2;
|
|
112
|
+
const centerY = rect.top + rect.height / 2;
|
|
113
|
+
|
|
114
|
+
startAngle = calculateAngle(event.clientX, event.clientY, centerX, centerY);
|
|
115
|
+
startValue = value;
|
|
116
|
+
|
|
117
|
+
document.addEventListener('mousemove', handleMouseMove);
|
|
118
|
+
document.addEventListener('mouseup', handleMouseUp);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function handleMouseMove(event: MouseEvent) {
|
|
122
|
+
if (!isDragging) return;
|
|
123
|
+
event.preventDefault();
|
|
124
|
+
updateAngle(event.clientX, event.clientY);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function handleMouseUp() {
|
|
128
|
+
isDragging = false;
|
|
129
|
+
document.removeEventListener('mousemove', handleMouseMove);
|
|
130
|
+
document.removeEventListener('mouseup', handleMouseUp);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function handleTouchStart(event: TouchEvent) {
|
|
134
|
+
if (!circleContainer) return;
|
|
135
|
+
|
|
136
|
+
const touch = event.touches[0];
|
|
137
|
+
updateAngle(touch.clientX, touch.clientY, true);
|
|
138
|
+
|
|
139
|
+
isDragging = true;
|
|
140
|
+
onFocus();
|
|
141
|
+
event.preventDefault();
|
|
142
|
+
|
|
143
|
+
const rect = circleContainer.getBoundingClientRect();
|
|
144
|
+
const centerX = rect.left + rect.width / 2;
|
|
145
|
+
const centerY = rect.top + rect.height / 2;
|
|
146
|
+
|
|
147
|
+
startAngle = calculateAngle(touch.clientX, touch.clientY, centerX, centerY);
|
|
148
|
+
startValue = value;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function handleTouchMove(event: TouchEvent) {
|
|
152
|
+
if (!isDragging) return;
|
|
153
|
+
event.preventDefault();
|
|
154
|
+
const touch = event.touches[0];
|
|
155
|
+
updateAngle(touch.clientX, touch.clientY);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function handleTouchEnd(event: TouchEvent) {
|
|
159
|
+
event.preventDefault();
|
|
160
|
+
isDragging = false;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
onDestroy(() => {
|
|
164
|
+
document.removeEventListener('mousemove', handleMouseMove);
|
|
165
|
+
document.removeEventListener('mouseup', handleMouseUp);
|
|
166
|
+
});
|
|
229
167
|
</script>
|
|
230
168
|
|
|
231
|
-
<
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
<!-- Number Controls -->
|
|
265
|
-
<NumberControls
|
|
266
|
-
{value}
|
|
267
|
-
{onChange}
|
|
268
|
-
{min}
|
|
269
|
-
{max}
|
|
270
|
-
{step}
|
|
271
|
-
{onFocus}
|
|
272
|
-
wrapAround={true}
|
|
273
|
-
suffix="°"
|
|
274
|
-
width="129px"
|
|
275
|
-
customInputClass="text-center"
|
|
276
|
-
/>
|
|
277
|
-
</div>
|
|
278
|
-
</div>
|
|
279
|
-
</div>
|
|
280
|
-
</div>
|
|
169
|
+
<InputControllerRow {label} {helpText}>
|
|
170
|
+
<div class="flex w-full items-center gap-2">
|
|
171
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
172
|
+
<!-- 36×36 dial; needle 2×14 from centre (IC Angle). -->
|
|
173
|
+
<div
|
|
174
|
+
bind:this={circleContainer}
|
|
175
|
+
class="angle-dial relative flex size-9 shrink-0 cursor-grab items-center justify-center overflow-visible rounded-full bg-accent transition-colors duration-fast hover:bg-accent-hover active:cursor-grabbing"
|
|
176
|
+
on:mousedown={handleMouseDown}
|
|
177
|
+
on:touchstart={handleTouchStart}
|
|
178
|
+
on:touchmove={handleTouchMove}
|
|
179
|
+
on:touchend={handleTouchEnd}
|
|
180
|
+
>
|
|
181
|
+
<!-- Sized in scoped CSS: with only w-0.5 + bg-primary, measure.mjs reported background transparent until width/height are explicit. -->
|
|
182
|
+
<div
|
|
183
|
+
class="angle-dial-needle pointer-events-none absolute top-1/2 start-1/2 origin-bottom bg-primary"
|
|
184
|
+
style="transform: translate(-50%, -100%) rotate({value}deg)"
|
|
185
|
+
></div>
|
|
186
|
+
</div>
|
|
187
|
+
|
|
188
|
+
<NumberControls
|
|
189
|
+
class="min-w-0 flex-1"
|
|
190
|
+
surfacePaddingClass="pe-1.5 ps-3"
|
|
191
|
+
{value}
|
|
192
|
+
{onChange}
|
|
193
|
+
{min}
|
|
194
|
+
{max}
|
|
195
|
+
{step}
|
|
196
|
+
{onFocus}
|
|
197
|
+
wrapAround={true}
|
|
198
|
+
suffix="°"
|
|
199
|
+
/>
|
|
200
|
+
</div>
|
|
201
|
+
</InputControllerRow>
|
|
281
202
|
|
|
282
203
|
<style>
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
204
|
+
.angle-dial-needle {
|
|
205
|
+
z-index: 1;
|
|
206
|
+
width: 2px;
|
|
207
|
+
height: 14px;
|
|
208
|
+
border-radius: 9999px;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.angle-dial {
|
|
212
|
+
user-select: none;
|
|
213
|
+
-webkit-user-select: none;
|
|
214
|
+
}
|
|
215
|
+
</style>
|