@widgetic/editor 4.1.22 → 4.1.24
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/README.md +43 -0
- package/dist/components/editors/CompositionEditorApp.svelte +228 -206
- package/dist/components/editors/EmbedAssistantPanel.svelte +270 -48
- package/dist/components/ic/AngleInputController.svelte +18 -3
- package/dist/components/ic/ColorPickerInputController.svelte +81 -49
- package/dist/components/ic/DatePickerInputController.svelte +134 -74
- package/dist/components/ic/DatePickerInputController.svelte.d.ts +2 -2
- package/dist/components/ic/NumberInputController.svelte +16 -2
- package/dist/components/ic/shared/EditorFileBrowserOverlay.svelte +26 -18
- package/dist/composition/compositionApi.d.ts +25 -0
- package/dist/composition/compositionApi.js +34 -4
- package/dist/composition/compositionEditorController.d.ts +63 -3
- package/dist/composition/compositionEditorController.js +207 -10
- package/dist/composition/staleGuard.d.ts +111 -0
- package/dist/composition/staleGuard.js +279 -0
- package/dist/embedAssistant/embedAssistantSuggest.d.ts +20 -0
- package/dist/embedAssistant/embedAssistantSuggest.js +29 -0
- package/dist/embedAssistant/embedAssistantTurns.d.ts +73 -0
- package/dist/embedAssistant/embedAssistantTurns.js +56 -0
- package/dist/embedAssistant/types.d.ts +15 -0
- package/dist/i18n/language.d.ts +19 -3
- package/dist/i18n/messages.d.ts +9 -0
- package/dist/i18n/messages.js +11 -0
- package/dist/i18n/translate.d.ts +1 -1
- package/package.json +8 -3
- package/dist/components/ic/NumberControls.svelte +0 -505
- package/dist/components/ic/NumberControls.svelte.d.ts +0 -37
- package/dist/components/ic/numberControlsSteps.d.ts +0 -17
- package/dist/components/ic/numberControlsSteps.js +0 -23
- package/dist/components/ic/numberControlsValueArea.d.ts +0 -29
- package/dist/components/ic/numberControlsValueArea.js +0 -51
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The arithmetic of the number stepper (`NumberControls.svelte`), kept apart from the component so Node can test it.
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* The value after one press of a stepper button (or one arrow key): `currentValue` moved by `adjustment`, then kept inside
|
|
6
|
-
* the limits, or brought back round for an angle. At a limit the result is `currentValue` itself, which tells the caller
|
|
7
|
-
* that there is nothing to apply (and nothing to repeat).
|
|
8
|
-
*/
|
|
9
|
-
export function steppedNumber(currentValue, adjustment, { min, max, wrapAround = false } = {}) {
|
|
10
|
-
let steppedValue = currentValue + adjustment;
|
|
11
|
-
if (wrapAround) {
|
|
12
|
-
if (steppedValue >= 360)
|
|
13
|
-
steppedValue -= 360;
|
|
14
|
-
if (steppedValue < 0)
|
|
15
|
-
steppedValue += 360;
|
|
16
|
-
return steppedValue;
|
|
17
|
-
}
|
|
18
|
-
if (min !== undefined && steppedValue < min)
|
|
19
|
-
steppedValue = min;
|
|
20
|
-
if (max !== undefined && steppedValue > max)
|
|
21
|
-
steppedValue = max;
|
|
22
|
-
return steppedValue;
|
|
23
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Pointer routing for the number stepper value hit area (`NumberControls.svelte`).
|
|
3
|
-
* Kept pure so Node can test the rules without mounting Svelte.
|
|
4
|
-
*/
|
|
5
|
-
type TextInputElement = HTMLInputElement | {
|
|
6
|
-
value: string;
|
|
7
|
-
setSelectionRange: (s: number, e: number) => void;
|
|
8
|
-
};
|
|
9
|
-
/**
|
|
10
|
-
* True when a mousedown on this target should focus the number input instead of letting the
|
|
11
|
-
* browser move focus to `body` or start a document-level selection in dead space beside the digits.
|
|
12
|
-
*/
|
|
13
|
-
export declare function shouldRoutePointerToNumberInput(target: EventTarget | null, inputId: string): boolean;
|
|
14
|
-
/** Caret placement after routing a press into the field. */
|
|
15
|
-
export declare function selectionAfterValueAreaPress(value: string, extendSelection: boolean): {
|
|
16
|
-
start: number;
|
|
17
|
-
end: number;
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* True when the pointer is in the empty stretch of an auto-sized field after the last digit
|
|
21
|
-
* (HTML `size` / average ch-width used to leave this dead band).
|
|
22
|
-
*/
|
|
23
|
-
export declare function isPointerPastTextEnd(text: string, inputLeft: number, clientX: number, textWidth: number): boolean;
|
|
24
|
-
/** While dragging from empty chrome into the digits, select the whole value for the next key. */
|
|
25
|
-
export declare function selectionWhileDraggingFromValueChrome(valueLength: number, pointerPastTextEnd: boolean, extendSelection: boolean): {
|
|
26
|
-
start: number;
|
|
27
|
-
end: number;
|
|
28
|
-
} | null;
|
|
29
|
-
export type { TextInputElement };
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Pointer routing for the number stepper value hit area (`NumberControls.svelte`).
|
|
3
|
-
* Kept pure so Node can test the rules without mounting Svelte.
|
|
4
|
-
*/
|
|
5
|
-
function hasClosest(target) {
|
|
6
|
-
return (typeof target === 'object' &&
|
|
7
|
-
target !== null &&
|
|
8
|
-
'closest' in target &&
|
|
9
|
-
typeof target.closest === 'function');
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* True when a mousedown on this target should focus the number input instead of letting the
|
|
13
|
-
* browser move focus to `body` or start a document-level selection in dead space beside the digits.
|
|
14
|
-
*/
|
|
15
|
-
export function shouldRoutePointerToNumberInput(target, inputId) {
|
|
16
|
-
if (!hasClosest(target))
|
|
17
|
-
return false;
|
|
18
|
-
if (target.closest('button'))
|
|
19
|
-
return false;
|
|
20
|
-
const input = document.getElementById(inputId);
|
|
21
|
-
if (!input || !('value' in input))
|
|
22
|
-
return false;
|
|
23
|
-
if (target === input)
|
|
24
|
-
return false;
|
|
25
|
-
return Boolean(target.closest('.number-controls-hit-area'));
|
|
26
|
-
}
|
|
27
|
-
/** Caret placement after routing a press into the field. */
|
|
28
|
-
export function selectionAfterValueAreaPress(value, extendSelection) {
|
|
29
|
-
if (extendSelection) {
|
|
30
|
-
return { start: 0, end: value.length };
|
|
31
|
-
}
|
|
32
|
-
const end = value.length;
|
|
33
|
-
return { start: end, end };
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* True when the pointer is in the empty stretch of an auto-sized field after the last digit
|
|
37
|
-
* (HTML `size` / average ch-width used to leave this dead band).
|
|
38
|
-
*/
|
|
39
|
-
export function isPointerPastTextEnd(text, inputLeft, clientX, textWidth) {
|
|
40
|
-
return clientX - inputLeft > textWidth + 0.5;
|
|
41
|
-
}
|
|
42
|
-
/** While dragging from empty chrome into the digits, select the whole value for the next key. */
|
|
43
|
-
export function selectionWhileDraggingFromValueChrome(valueLength, pointerPastTextEnd, extendSelection) {
|
|
44
|
-
if (valueLength === 0)
|
|
45
|
-
return null;
|
|
46
|
-
if (extendSelection)
|
|
47
|
-
return { start: 0, end: valueLength };
|
|
48
|
-
if (pointerPastTextEnd)
|
|
49
|
-
return null;
|
|
50
|
-
return { start: 0, end: valueLength };
|
|
51
|
-
}
|