@widgetic/editor 4.1.14 → 4.1.16
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 +47 -40
- package/dist/components/editors/EditLeaseNotice.svelte +44 -33
- package/dist/components/editors/EmbedEditor.svelte +133 -259
- package/dist/components/editors/PropsEditor.svelte +418 -1338
- 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/InputControllerRow.svelte +74 -0
- package/dist/components/ic/InputControllerRow.svelte.d.ts +14 -0
- package/dist/components/ic/KnowledgeDocumentsInputController.svelte +84 -47
- package/dist/components/ic/KnowledgeTextForm.svelte +35 -33
- 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 +1 -0
- package/dist/components/ic/index.js +1 -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/i18n/language.d.ts +44 -281
- package/dist/i18n/messages.d.ts +41 -34
- package/dist/i18n/messages.js +47 -34
- package/dist/i18n/translate.d.ts +1 -1
- package/dist/utils.d.ts +7 -0
- package/dist/utils.js +26 -2
- package/package.json +5 -5
|
@@ -24,8 +24,8 @@ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> =
|
|
|
24
24
|
}
|
|
25
25
|
declare const TextAreaPreviewInputController: $$__sveltets_2_IsomorphicComponent<{
|
|
26
26
|
/**
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
* Component props
|
|
28
|
+
*/ label?: TextAreaPreviewInputControllerProps["label"];
|
|
29
29
|
value?: TextAreaPreviewInputControllerProps["value"];
|
|
30
30
|
onChange: TextAreaPreviewInputControllerProps["onChange"];
|
|
31
31
|
config?: TextAreaPreviewInputControllerProps["config"];
|
|
@@ -1,101 +1,91 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
6
|
+
export interface TextInputControllerProps {
|
|
7
|
+
label: string;
|
|
8
|
+
value: string;
|
|
9
|
+
onChange: (newValue: string) => void;
|
|
10
|
+
config?: InputControllerConfig;
|
|
11
|
+
type?: 'text' | 'email' | 'url';
|
|
12
|
+
placeholder?: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
onFocus?: () => void;
|
|
15
|
+
}
|
|
14
16
|
</script>
|
|
15
17
|
|
|
16
18
|
<script lang="ts">
|
|
17
19
|
// Import Shadcn UI components from Widgetic design-system package
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
import { Input } from '@widgetic/design-system/components';
|
|
21
|
+
import { useTextDirection } from '@widgetic/design-system/components/textDirection';
|
|
22
|
+
import { directionOfFieldValue } from '../../utils/fieldDirection';
|
|
23
|
+
import InputControllerRow from './InputControllerRow.svelte';
|
|
22
24
|
|
|
23
25
|
// Component props
|
|
24
|
-
|
|
26
|
+
import type { InputControllerConfig } from './index';
|
|
25
27
|
|
|
26
28
|
/**
|
|
27
29
|
* Component props
|
|
28
30
|
*/
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
export let label: TextInputControllerProps['label'];
|
|
32
|
+
export let value: TextInputControllerProps['value'];
|
|
33
|
+
export let onChange: TextInputControllerProps['onChange'];
|
|
34
|
+
export let config: TextInputControllerProps['config'] = {};
|
|
35
|
+
|
|
34
36
|
// Use config values with fallbacks
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
export let type: TextInputControllerProps['type'] = 'text';
|
|
38
|
+
export let placeholder: TextInputControllerProps['placeholder'] = config.placeholder || '';
|
|
39
|
+
export let description: TextInputControllerProps['description'] = undefined;
|
|
40
|
+
export let onFocus: TextInputControllerProps['onFocus'] = () => {};
|
|
39
41
|
|
|
40
42
|
// The way the screen is read. What a visitor types reads by its own first letter on a right to left screen; an address
|
|
41
43
|
// (an email, a link) is read left to right on every screen. A left to right screen is written no attribute, as it always was.
|
|
42
44
|
// (The `type` is the name of the kind of field in the schema, `textInput` for a plain text field: see fieldDirection.ts.)
|
|
43
|
-
|
|
45
|
+
const textDirection = useTextDirection();
|
|
44
46
|
// What is in the field right now: the value the page gave it, then what is typed (only an empty field has no first letter).
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
let typedText = '';
|
|
48
|
+
$: typedText = value ?? '';
|
|
49
|
+
$: hasTypedValue = typedText.length > 0;
|
|
50
|
+
let valueDirection: 'auto' | 'ltr' | undefined;
|
|
49
51
|
// (An empty field takes the direction of the screen, so that its hint and its caret start at the start of the line.)
|
|
50
|
-
|
|
52
|
+
$: valueDirection = directionOfFieldValue(type, $textDirection, hasTypedValue);
|
|
51
53
|
|
|
52
54
|
/**
|
|
53
55
|
* Methods
|
|
54
56
|
*/
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
57
|
+
function validate(value: string): boolean {
|
|
58
|
+
switch (type) {
|
|
59
|
+
case 'email':
|
|
60
|
+
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value);
|
|
61
|
+
case 'url':
|
|
62
|
+
return /^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/.test(value);
|
|
63
|
+
default:
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
65
67
|
</script>
|
|
66
68
|
|
|
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
|
-
class="h-full w-full border-none bg-transparent focus-visible:ring-0 focus-visible:ring-offset-0 subtext text-grey7 placeholder:text-grey3 placeholder:subtext px-4"
|
|
93
|
-
/>
|
|
94
|
-
</div>
|
|
95
|
-
</div>
|
|
96
|
-
</div>
|
|
97
|
-
|
|
98
|
-
{#if description}
|
|
99
|
-
<p class="subtext text-grey5">{description}</p>
|
|
100
|
-
{/if}
|
|
101
|
-
</div>
|
|
69
|
+
<InputControllerRow {label} {description}>
|
|
70
|
+
<div
|
|
71
|
+
class="flex h-9 w-full items-center rounded-lg bg-accent px-3 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"
|
|
72
|
+
onfocusin={onFocus}
|
|
73
|
+
>
|
|
74
|
+
<Input
|
|
75
|
+
id="text-input"
|
|
76
|
+
{type}
|
|
77
|
+
{value}
|
|
78
|
+
{placeholder}
|
|
79
|
+
dir={valueDirection}
|
|
80
|
+
onfocus={onFocus}
|
|
81
|
+
oninput={(e) => {
|
|
82
|
+
const newValue = e.currentTarget.value;
|
|
83
|
+
typedText = newValue;
|
|
84
|
+
if (validate(newValue)) {
|
|
85
|
+
onChange(newValue);
|
|
86
|
+
}
|
|
87
|
+
}}
|
|
88
|
+
class="h-full w-full border-0 bg-transparent px-0 text-body text-foreground shadow-none placeholder:text-muted-foreground focus-visible:ring-0 focus-visible:ring-offset-0"
|
|
89
|
+
/>
|
|
90
|
+
</div>
|
|
91
|
+
</InputControllerRow>
|
|
@@ -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 TextInputControllerProps {
|