poe-svelte-ui-lib 1.9.2 → 1.9.4

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.
Files changed (41) hide show
  1. package/dist/Button/ButtonProps.svelte +8 -22
  2. package/dist/ColorPicker/ColorPickerProps.svelte +3 -3
  3. package/dist/CommonSnippets.svelte +35 -1
  4. package/dist/CommonSnippets.svelte.d.ts +1 -1
  5. package/dist/ComponentExample.svelte +73 -48
  6. package/dist/ComponentExample.svelte.d.ts +1 -0
  7. package/dist/IconsCatalog/battery/battery1.svg +1 -0
  8. package/dist/IconsCatalog/battery/battery2.svg +1 -0
  9. package/dist/IconsCatalog/battery/battery3.svg +1 -0
  10. package/dist/IconsCatalog/battery/battery4.svg +1 -0
  11. package/dist/IconsCatalog/battery/battery5.svg +1 -0
  12. package/dist/IconsCatalog/bulb/bulb1.svg +1 -1
  13. package/dist/IconsCatalog/common.binocular.svg +1 -0
  14. package/dist/IconsCatalog/info.sinewave.svg +1 -0
  15. package/dist/IconsCatalog/media.display.svg +1 -0
  16. package/dist/IconsCatalog/media.soundwaves.svg +1 -0
  17. package/dist/IconsCatalog/periphery.magneticfield.svg +1 -0
  18. package/dist/IconsCatalog/power.flash.svg +1 -0
  19. package/dist/IconsCatalog/power.onoff.svg +1 -0
  20. package/dist/IconsCatalog/scenarios.airplane.svg +1 -0
  21. package/dist/IconsCatalog/scenarios.circlecompass.svg +1 -0
  22. package/dist/IconsCatalog/scenarios.compass.svg +1 -0
  23. package/dist/IconsCatalog/scenarios.engine.svg +1 -0
  24. package/dist/Input/InputProps.svelte +0 -1
  25. package/dist/Joystick/Joystick.svelte +50 -39
  26. package/dist/Joystick/JoystickProps.svelte +1 -1
  27. package/dist/ProgressBar/ProgressBarProps.svelte +47 -37
  28. package/dist/Select/Select.svelte +51 -81
  29. package/dist/Select/SelectProps.svelte +17 -5
  30. package/dist/Slider/SliderProps.svelte +24 -28
  31. package/dist/Table/Table.svelte +52 -53
  32. package/dist/Table/TableProps.svelte +6 -14
  33. package/dist/Tabs/Tabs.svelte +6 -16
  34. package/dist/Tabs/TabsProps.svelte +17 -5
  35. package/dist/Widget/Widget.svelte +12 -16
  36. package/dist/Widget/WidgetProps.svelte +26 -38
  37. package/dist/icons.js +21 -3
  38. package/dist/locales/translations.js +4 -1
  39. package/dist/types.d.ts +0 -1
  40. package/package.json +1 -1
  41. /package/dist/IconsCatalog/{common.battery.svg → power.battery.svg} +0 -0
@@ -21,12 +21,7 @@
21
21
  let hasValue: boolean = $derived(component.eventHandler.Value)
22
22
 
23
23
  let Header: IOption = $derived(
24
- $optionsStore.HEADER_OPTIONS.find((h) => h.value === component.eventHandler.Header) ?? {
25
- id: "",
26
- name: "",
27
- value: "",
28
- class: "!w-1/4",
29
- },
24
+ $optionsStore.HEADER_OPTIONS.find((h) => h.value === component.eventHandler.Header) ?? { id: "", name: "", value: "", class: "!w-1/4" },
30
25
  )
31
26
 
32
27
  const initialColor = $derived(
@@ -48,10 +43,7 @@
48
43
  type="buttons"
49
44
  value={Header}
50
45
  options={$optionsStore.HEADER_OPTIONS}
51
- onUpdate={(option) => {
52
- Header = { ...(option as IOption<string>) }
53
- onPropertyChange({ eventHandler: { Header: Header.value as string } })
54
- }}
46
+ onUpdate={(option) => onPropertyChange({ eventHandler: { Header: (option as IOption<string>).value as string } })}
55
47
  />
56
48
  {#if Header.value === "SET"}
57
49
  <UI.Select
@@ -60,9 +52,7 @@
60
52
  value={$optionsStore.FULL_ARGUMENT_OPTION.find((h) => h.value === component.eventHandler.Argument) ??
61
53
  $optionsStore.FULL_ARGUMENT_OPTION.find((h) => h.value === "")}
62
54
  options={$optionsStore.FULL_ARGUMENT_OPTION}
63
- onUpdate={(option) => {
64
- onPropertyChange({ eventHandler: { Argument: (option as IOption<string>).value as string } })
65
- }}
55
+ onUpdate={(option) => onPropertyChange({ eventHandler: { Argument: (option as IOption<string>).value as string } })}
66
56
  />
67
57
  {/if}
68
58
  <UI.Input
@@ -74,6 +64,9 @@
74
64
  help={{ info: $t("constructor.props.argument.info"), autocomplete: "on", regExp: /^[a-zA-Z0-9\-_]{0,32}$/ }}
75
65
  onUpdate={(value) => onPropertyChange({ eventHandler: { Argument: value as string } })}
76
66
  />
67
+ {/snippet}
68
+
69
+ {#snippet ButtonVariables()}
77
70
  {#if (component.eventHandler.Argument !== "Save" && component.eventHandler.Argument !== "NoSave") || Header.value === "SET"}
78
71
  <UI.Input
79
72
  label={{ name: $t("constructor.props.value") }}
@@ -83,20 +76,13 @@
83
76
  onUpdate={(value) => onPropertyChange({ eventHandler: { Value: value as string } })}
84
77
  />
85
78
  {/if}
86
- {/snippet}
87
-
88
- {#snippet ButtonVariables()}
89
79
  <UI.Input
90
80
  label={{ name: $t("constructor.props.variables") }}
91
81
  disabled={hasValue}
92
82
  value={component.eventHandler.Variables.join(" ")}
93
83
  help={{ info: $t("constructor.props.variables.info"), autocomplete: "on", regExp: /^[a-zA-Z0-9.\-_ ":{}]{0,500}$/ }}
94
84
  maxlength={500}
95
- onUpdate={(value) => {
96
- const parts = (value as string).trim().split(/\s+/)
97
-
98
- onPropertyChange({ eventHandler: { Variables: parts } })
99
- }}
85
+ onUpdate={(value) => onPropertyChange({ eventHandler: { Variables: (value as string).trim().split(/\s+/) } })}
100
86
  />
101
87
  {/snippet}
102
88
 
@@ -161,11 +147,11 @@
161
147
  <div class="relative flex flex-row items-start justify-center">
162
148
  <!-- Сообщение для отправки в ws по нажатию кнопки -->
163
149
  <div class="flex w-1/3 flex-col px-2">
150
+ <CommonSnippets snippet="Access" {component} {onPropertyChange} />
164
151
  {@render ButtonHeaderArgument()}
165
152
  </div>
166
153
  <div class="flex w-1/3 flex-col px-2">
167
154
  {@render ButtonVariables()}
168
- <CommonSnippets snippet="Access" {component} {onPropertyChange} />
169
155
  <CommonSnippets
170
156
  snippet="IconsLib"
171
157
  initialValue={{
@@ -60,11 +60,11 @@
60
60
  {#if forConstructor}
61
61
  <div class="relative flex flex-row items-start justify-center">
62
62
  <div class="flex w-1/3 flex-col px-2">
63
- <CommonSnippets snippet="Variable" {VARIABLE_OPTIONS} {component} {onPropertyChange} />
64
- <CommonSnippets snippet="EventHandlerArgument" {component} {onPropertyChange} />
63
+ <CommonSnippets snippet="Access" {component} {onPropertyChange} />
65
64
  </div>
66
65
  <div class="flex w-1/3 flex-col px-2">
67
- <CommonSnippets snippet="Access" {component} {onPropertyChange} />
66
+ <CommonSnippets snippet="Variable" {VARIABLE_OPTIONS} {component} {onPropertyChange} />
67
+ <CommonSnippets snippet="EventHandlerArgument" {component} {onPropertyChange} />
68
68
  </div>
69
69
  <div class="flex w-1/3 flex-col px-2">
70
70
  <CommonSnippets snippet="Label" {component} {onPropertyChange} />
@@ -1,7 +1,6 @@
1
1
  <script lang="ts">
2
2
  import * as UI from "./"
3
3
  import { t } from "./locales/i18n"
4
- import { ICONS } from "./icons"
5
4
  import CrossIcon from "./libIcons/CrossIcon.svelte"
6
5
  import { optionsStore } from "./options"
7
6
  import { updateProperty } from "./types"
@@ -34,6 +33,7 @@
34
33
  | "EventHandlerArgument"
35
34
  | "IconsLib"
36
35
  | "Readonly"
36
+ | "MinMaxStep"
37
37
  | ""
38
38
 
39
39
  let showIconLib: boolean = $state(false)
@@ -204,6 +204,38 @@
204
204
  />
205
205
  {/snippet}
206
206
 
207
+ {#snippet MinMaxStep(initialValue: {
208
+ number: { minNum: number; maxNum: number; step: number }
209
+ bitMode: boolean
210
+ updateProperty: (value: number, property: string) => {}
211
+ })}
212
+ <div class="flex">
213
+ <UI.Input
214
+ label={{ name: $t("constructor.props.min") }}
215
+ value={initialValue.number.minNum}
216
+ type="number"
217
+ readonly={initialValue.bitMode}
218
+ onUpdate={(value) => initialValue.updateProperty(value as number, "number.minNum")}
219
+ />
220
+ <UI.Input
221
+ label={{ name: $t("constructor.props.max") }}
222
+ value={initialValue.number.maxNum}
223
+ type="number"
224
+ readonly={initialValue.bitMode}
225
+ onUpdate={(value) => initialValue.updateProperty(value as number, "number.maxNum")}
226
+ />
227
+ {#if component.type !== "ProgressBar"}
228
+ <UI.Input
229
+ label={{ name: $t("constructor.props.step") }}
230
+ value={initialValue.number.step}
231
+ type="number"
232
+ readonly={initialValue.bitMode}
233
+ onUpdate={(value) => initialValue.updateProperty(value as number, "number.step")}
234
+ />
235
+ {/if}
236
+ </div>
237
+ {/snippet}
238
+
207
239
  {#snippet IconsLib(initialValue: {
208
240
  name: string
209
241
  icons: { array: [string, string[]][]; selectArray?: false }
@@ -271,4 +303,6 @@
271
303
  {@render Readonly()}
272
304
  {:else if snippet === "IconsLib"}
273
305
  {@render IconsLib(initialValue)}
306
+ {:else if snippet === "MinMaxStep"}
307
+ {@render MinMaxStep(initialValue)}
274
308
  {/if}
@@ -1,5 +1,5 @@
1
1
  import * as UI from "./";
2
- type snippetNames = "Variable" | "Access" | "Colors" | "Label" | "LabelAlign" | "LabelClass" | "Identificator" | "WrapperClass" | "Disabled" | "EventHandlerArgument" | "IconsLib" | "Readonly" | "";
2
+ type snippetNames = "Variable" | "Access" | "Colors" | "Label" | "LabelAlign" | "LabelClass" | "Identificator" | "WrapperClass" | "Disabled" | "EventHandlerArgument" | "IconsLib" | "Readonly" | "MinMaxStep" | "";
3
3
  type $$ComponentProps = {
4
4
  snippet: snippetNames;
5
5
  component: UI.UIComponent;
@@ -1,65 +1,90 @@
1
1
  <script lang="ts">
2
- import { Switch, t } from "./"
2
+ import { Select, Switch, t, type IOption } from "./"
3
3
  import type { Snippet } from "svelte"
4
4
  import { fade } from "svelte/transition"
5
5
 
6
6
  let {
7
7
  component,
8
8
  componentProps,
9
+ examples,
9
10
  codeText,
10
11
  forConstructor = $bindable(),
11
- }: { component: Snippet; componentProps: Snippet; codeText: string; forConstructor: boolean } = $props()
12
+ }: { component: Snippet; componentProps: Snippet; examples?: Snippet; codeText: string; forConstructor: boolean } = $props()
12
13
 
13
14
  let isCopied = $state(false)
15
+ let snippetOptions = [
16
+ { id: crypto.randomUUID(), value: "overview", name: $t("library.overview") },
17
+ { id: crypto.randomUUID(), value: "examples", name: $t("library.examples") },
18
+ ]
19
+
20
+ let mainSnippet: string | undefined = $state("overview")
21
+
22
+ const renderCurrentSnippet = () => {
23
+ if (mainSnippet === "examples" && examples) return examples
24
+ else return overview
25
+ }
14
26
  </script>
15
27
 
16
- <div class="flex h-[calc(100vh-9rem)] flex-col">
17
- <div class="flex-1">
18
- {@render component()}
19
- </div>
20
- <Switch
21
- wrapperClass="w-60 self-end p-2"
22
- label={{ name: $t("library.for_constructor") }}
23
- value={forConstructor ? 1 : 0}
24
- options={[{ id: crypto.randomUUID(), value: 0, class: "" }]}
25
- onChange={(value) => (forConstructor = value == 0 ? false : true)}
28
+ {#if examples}
29
+ <Select
30
+ wrapperClass="w-1/2 mx-auto mb-3"
31
+ type="buttons"
32
+ options={snippetOptions}
33
+ value={snippetOptions.find((o) => o.value == mainSnippet)}
34
+ onUpdate={(value) => (mainSnippet = (value as IOption<string>).value)}
26
35
  />
27
- <div class="border-t border-gray-500"></div>
28
- <div class="max-h-[70%]" transition:fade={{ duration: 200 }}>
29
- {@render componentProps()}
30
- <div class="relative mt-3">
31
- <button
32
- class="absolute top-2 right-3 flex cursor-pointer border-none bg-transparent"
33
- onclick={(e) => {
34
- e.preventDefault()
35
- navigator.clipboard.writeText(codeText)
36
- isCopied = true
37
- setTimeout(() => (isCopied = false), 1000)
38
- }}
39
- aria-label="Копировать текст"
40
- >
41
- <div class=" size-6 text-sm [&_svg]:h-full [&_svg]:max-h-full [&_svg]:w-full [&_svg]:max-w-full">
42
- {#if isCopied}
43
- <div
44
- class="right-1..5 absolute top-1/2 -translate-y-1/2 transform rounded-md bg-(--green-color) px-1.5 py-1 shadow-lg"
45
- transition:fade={{ duration: 200 }}
46
- >
47
-
48
- </div>
49
- {:else}
50
- <svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24">
51
- <g fill="none" stroke="currentColor" stroke-width="1.5">
52
- <path
53
- d="M6 11c0-2.828 0-4.243.879-5.121C7.757 5 9.172 5 12 5h3c2.828 0 4.243 0 5.121.879C21 6.757 21 8.172 21 11v5c0 2.828 0 4.243-.879 5.121C19.243 22 17.828 22 15 22h-3c-2.828 0-4.243 0-5.121-.879C6 20.243 6 18.828 6 16z"
54
- />
55
- <path d="M6 19a3 3 0 0 1-3-3v-6c0-3.771 0-5.657 1.172-6.828S7.229 2 11 2h4a3 3 0 0 1 3 3" />
56
- </g>
57
- </svg>
58
- {/if}
59
- </div>
60
- </button>
61
- <pre class="overflow-x-auto">{codeText}
36
+ {/if}
37
+ {@render renderCurrentSnippet()()}
38
+
39
+ {#snippet overview()}
40
+ <div class="flex w-full h-[calc(100vh-9rem)] flex-col">
41
+ <div class="flex-1">
42
+ {@render component()}
43
+ </div>
44
+ <Switch
45
+ wrapperClass="w-60 self-end p-2"
46
+ label={{ name: $t("library.for_constructor") }}
47
+ value={forConstructor ? 1 : 0}
48
+ options={[{ id: crypto.randomUUID(), value: 0 }]}
49
+ onChange={(value) => (forConstructor = value == 0 ? false : true)}
50
+ />
51
+ <div class="border-t border-gray-500"></div>
52
+ <div class="max-h-[70%]" transition:fade={{ duration: 200 }}>
53
+ {@render componentProps()}
54
+ <div class="relative mt-3">
55
+ <button
56
+ class="absolute top-2 right-3 flex cursor-pointer border-none bg-transparent"
57
+ onclick={(e) => {
58
+ e.preventDefault()
59
+ navigator.clipboard.writeText(codeText)
60
+ isCopied = true
61
+ setTimeout(() => (isCopied = false), 1000)
62
+ }}
63
+ aria-label="Копировать текст"
64
+ >
65
+ <div class=" size-6 text-sm [&_svg]:h-full [&_svg]:max-h-full [&_svg]:w-full [&_svg]:max-w-full">
66
+ {#if isCopied}
67
+ <div
68
+ class="right-1..5 absolute top-1/2 -translate-y-1/2 transform rounded-md bg-(--green-color) px-1.5 py-1 shadow-lg"
69
+ transition:fade={{ duration: 200 }}
70
+ >
71
+
72
+ </div>
73
+ {:else}
74
+ <svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24">
75
+ <g fill="none" stroke="currentColor" stroke-width="1.5">
76
+ <path
77
+ d="M6 11c0-2.828 0-4.243.879-5.121C7.757 5 9.172 5 12 5h3c2.828 0 4.243 0 5.121.879C21 6.757 21 8.172 21 11v5c0 2.828 0 4.243-.879 5.121C19.243 22 17.828 22 15 22h-3c-2.828 0-4.243 0-5.121-.879C6 20.243 6 18.828 6 16z"
78
+ />
79
+ <path d="M6 19a3 3 0 0 1-3-3v-6c0-3.771 0-5.657 1.172-6.828S7.229 2 11 2h4a3 3 0 0 1 3 3" />
80
+ </g>
81
+ </svg>
82
+ {/if}
83
+ </div>
84
+ </button>
85
+ <pre class="overflow-x-auto">{codeText}
62
86
  </pre>
87
+ </div>
63
88
  </div>
64
89
  </div>
65
- </div>
90
+ {/snippet}
@@ -2,6 +2,7 @@ import type { Snippet } from "svelte";
2
2
  type $$ComponentProps = {
3
3
  component: Snippet;
4
4
  componentProps: Snippet;
5
+ examples?: Snippet;
5
6
  codeText: string;
6
7
  forConstructor: boolean;
7
8
  };
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><!-- Icon from Material Symbols by Google - https://github.com/google/material-design-icons/blob/master/LICENSE --><path fill="currentColor" d="M4 18q-1.25 0-2.125-.875T1 15V9q0-1.25.875-2.125T4 6h13.5q1.25 0 2.125.875T20.5 9v6q0 1.25-.875 2.125T17.5 18zm0-2h13.5q.425 0 .713-.288T18.5 15V9q0-.425-.288-.712T17.5 8H4q-.425 0-.712.288T3 9v6q0 .425.288.713T4 16m17.5-1.5v-5h.5q.425 0 .713.288T23 10.5v3q0 .425-.288.713T22 14.5zM3 16V8z"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><!-- Icon from Material Symbols by Google - https://github.com/google/material-design-icons/blob/master/LICENSE --><path fill="currentColor" d="M4 18q-1.25 0-2.125-.875T1 15V9q0-1.25.875-2.125T4 6h13.5q1.25 0 2.125.875T20.5 9v6q0 1.25-.875 2.125T17.5 18zm0-2h13.5q.425 0 .713-.288T18.5 15V9q0-.425-.288-.712T17.5 8H4q-.425 0-.712.288T3 9v6q0 .425.288.713T4 16m17.5-1.5v-5h.5q.425 0 .713.288T23 10.5v3q0 .425-.288.713T22 14.5zM5 15q-.425 0-.712-.288T4 14v-4q0-.425.288-.712T5 9t.713.288T6 10v4q0 .425-.288.713T5 15"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><!-- Icon from Material Symbols by Google - https://github.com/google/material-design-icons/blob/master/LICENSE --><path fill="currentColor" d="M4 18q-1.25 0-2.125-.875T1 15V9q0-1.25.875-2.125T4 6h13.5q1.25 0 2.125.875T20.5 9v6q0 1.25-.875 2.125T17.5 18zm0-2h13.5q.425 0 .713-.288T18.5 15V9q0-.425-.288-.712T17.5 8H4q-.425 0-.712.288T3 9v6q0 .425.288.713T4 16m17.5-1.5v-5h.5q.425 0 .713.288T23 10.5v3q0 .425-.288.713T22 14.5zM4 14v-4q0-.425.288-.712T5 9h4q.425 0 .713.288T10 10v4q0 .425-.288.713T9 15H5q-.425 0-.712-.288T4 14"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><!-- Icon from Material Symbols by Google - https://github.com/google/material-design-icons/blob/master/LICENSE --><path fill="currentColor" d="M4 18q-1.25 0-2.125-.875T1 15V9q0-1.25.875-2.125T4 6h13.5q1.25 0 2.125.875T20.5 9v6q0 1.25-.875 2.125T17.5 18zm0-2h13.5q.425 0 .713-.288T18.5 15V9q0-.425-.288-.712T17.5 8H4q-.425 0-.712.288T3 9v6q0 .425.288.713T4 16m17.5-1.5v-5h.5q.425 0 .713.288T23 10.5v3q0 .425-.288.713T22 14.5zM4 14v-4q0-.425.288-.712T5 9h8q.425 0 .713.288T14 10v4q0 .425-.288.713T13 15H5q-.425 0-.712-.288T4 14"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><!-- Icon from Material Symbols by Google - https://github.com/google/material-design-icons/blob/master/LICENSE --><path fill="currentColor" d="M4 18q-1.25 0-2.125-.875T1 15V9q0-1.25.875-2.125T4 6h13.5q1.25 0 2.125.875T20.5 9v6q0 1.25-.875 2.125T17.5 18zm0-2h13.5q.425 0 .713-.288T18.5 15V9q0-.425-.288-.712T17.5 8H4q-.425 0-.712.288T3 9v6q0 .425.288.713T4 16m17.5-1.5v-5h.5q.425 0 .713.288T23 10.5v3q0 .425-.288.713T22 14.5zM4 14v-4q0-.425.288-.712T5 9h11.5q.425 0 .713.288T17.5 10v4q0 .425-.288.713T16.5 15H5q-.425 0-.712-.288T4 14"/></svg>
@@ -1 +1 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><path fill="currentColor" d="M1 11h3v2H1zm18.1-7.5L17 5.6L18.4 7l2.1-2.1zM11 1h2v3h-2zM4.9 3.5L3.5 4.9L5.6 7L7 5.6zM10 22c0 .6.4 1 1 1h2c.6 0 1-.4 1-1v-1h-4zm2-16c-3.3 0-6 2.7-6 6c0 2.2 1.2 4.2 3 5.2V19c0 .6.4 1 1 1h4c.6 0 1-.4 1-1v-1.8c1.8-1 3-3 3-5.2c0-3.3-2.7-6-6-6m1 9.9V17h-2v-1.1c-1.7-.4-3-2-3-3.9c0-2.2 1.8-4 4-4s4 1.8 4 4c0 1.9-1.3 3.4-3 3.9m7-4.9h3v2h-3z"/></svg>
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><path fill="currentColor" d="M20 11h3v2h-3zM1 11h3v2H1zM13 1v3h-2V1zM4.92 3.5l2.13 2.14l-1.42 1.41L3.5 4.93zm12.03 2.13l2.12-2.13l1.43 1.43l-2.13 2.12zM12 6a6 6 0 0 1 6 6c0 2.22-1.21 4.16-3 5.2V19a1 1 0 0 1-1 1h-4a1 1 0 0 1-1-1v-1.8c-1.79-1.04-3-2.98-3-5.2a6 6 0 0 1 6-6m2 15v1a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1v-1zm-3-3h2v-2.13c1.73-.44 3-2.01 3-3.87a4 4 0 0 0-4-4a4 4 0 0 0-4 4c0 1.86 1.27 3.43 3 3.87z"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"><path d="M.75 18a4.5 4.5 0 1 0 9 0a4.5 4.5 0 0 0-9 0"/><path d="M9.75 18V4.125a2.625 2.625 0 0 0-5.156-.7L.911 16.805M14.25 18a4.501 4.501 0 0 0 8.658 1.722a4.501 4.501 0 0 0-8.316-3.444A4.5 4.5 0 0 0 14.25 18"/><path d="M14.25 18V4.125a2.625 2.625 0 0 1 5.156-.7l3.683 13.377"/><path d="M9.75 9h4.5v3h-4.5z"/></g></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M3 12c0-3.857 1.286-9 3.857-9c3.857 0 6.429 18 10.286 18C19.714 21 21 15.857 21 12M3 12h2m14 0h2m-5.5 0h1m-9 0h1"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 16 16"><path fill="currentColor" d="M0 4s0-2 2-2h12s2 0 2 2v6s0 2-2 2h-4q0 1 .25 1.5H11a.5.5 0 0 1 0 1H5a.5.5 0 0 1 0-1h.75Q6 13 6 12H2s-2 0-2-2zm1.398-.855a.76.76 0 0 0-.254.302A1.5 1.5 0 0 0 1 4.01V10c0 .325.078.502.145.602q.105.156.302.254a1.5 1.5 0 0 0 .538.143L2.01 11H14c.325 0 .502-.078.602-.145a.76.76 0 0 0 .254-.302a1.5 1.5 0 0 0 .143-.538L15 9.99V4c0-.325-.078-.502-.145-.602a.76.76 0 0 0-.302-.254A1.5 1.5 0 0 0 13.99 3H2c-.325 0-.502.078-.602.145"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M2.75 9.938v4.124m3.7-7.217v10.31m3.7-13.918v17.526m3.7-13.631v9.736m3.7-7.302v4.868m3.7-3.465v2.062"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"><path d="M12 3v18m6-14c-.633-1.255-1.538-2-2.5-2c-1.933 0-3.5 3.134-3.5 7s1.567 7 3.5 7s3.5-3.134 3.5-7v-1M6 7c.633-1.255 1.538-2 2.5-2c1.933 0 3.5 3.134 3.5 7s-1.567 7-3.5 7S5 15.866 5 12v-1"/><path d="m3 13l2-2l2 2m10 0l2-2l2 2"/></g></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 14 14"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" d="M8 .5v5h3.5l-5.5 8v-5H2.5L8 .5z"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><path fill="currentColor" d="M12 3c-.55 0-1 .45-1 1v8c0 .55.45 1 1 1s1-.45 1-1V4c0-.55-.45-1-1-1m5.14 2.86a.99.99 0 0 0-.01 1.39c1.13 1.2 1.83 2.8 1.87 4.57c.09 3.83-3.08 7.13-6.91 7.17A6.98 6.98 0 0 1 5 12c0-1.84.71-3.51 1.87-4.76c.37-.39.37-1-.01-1.38a.993.993 0 0 0-1.43.02A8.92 8.92 0 0 0 3 11.74c-.14 4.88 3.83 9.1 8.71 9.25c5.1.16 9.29-3.93 9.29-9c0-2.37-.92-4.51-2.42-6.11c-.38-.41-1.04-.42-1.44-.02"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 16 16"><path fill="currentColor" d="M8 0c-.787 0-1.292.592-1.572 1.151A4.35 4.35 0 0 0 6 3v3.691l-2 1V7.5a.5.5 0 0 0-.5-.5h-1a.5.5 0 0 0-.5.5v1.191l-1.17.585A1.5 1.5 0 0 0 0 10.618V12a.5.5 0 0 0 .582.493l1.631-.272l.313.937a.5.5 0 0 0 .948 0l.405-1.214l2.21-.369l.375 2.253l-1.318 1.318A.5.5 0 0 0 5.5 16h5a.5.5 0 0 0 .354-.854l-1.318-1.318l.375-2.253l2.21.369l.405 1.214a.5.5 0 0 0 .948 0l.313-.937l1.63.272A.5.5 0 0 0 16 12v-1.382a1.5 1.5 0 0 0-.83-1.342L14 8.691V7.5a.5.5 0 0 0-.5-.5h-1a.5.5 0 0 0-.5.5v.191l-2-1V3c0-.568-.14-1.271-.428-1.849C9.292.591 8.787 0 8 0M7 3c0-.432.11-.979.322-1.401C7.542 1.159 7.787 1 8 1s.458.158.678.599C8.889 2.02 9 2.569 9 3v4a.5.5 0 0 0 .276.447l5.448 2.724a.5.5 0 0 1 .276.447v.792l-5.418-.903a.5.5 0 0 0-.575.41l-.5 3a.5.5 0 0 0 .14.437l.646.646H6.707l.647-.646a.5.5 0 0 0 .14-.436l-.5-3a.5.5 0 0 0-.576-.411L1 11.41v-.792a.5.5 0 0 1 .276-.447l5.448-2.724A.5.5 0 0 0 7 7z"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-width="1.5"><path stroke-linecap="round" stroke-linejoin="round" d="M10 10L5 22m9-12l5 12M12 4V2"/><circle cx="12" cy="7" r="3"/><path stroke-linecap="round" d="M3 13c1.99 3.024 5.28 5 9 5s7.01-1.976 9-5"/><path stroke-linecap="round" stroke-linejoin="round" d="M12 17v2"/></g></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" viewBox="0 0 512 512"><path fill="none" stroke="currentColor" stroke-miterlimit="10" stroke-width="32" d="M448 256c0-106-86-192-192-192S64 150 64 256s86 192 192 192s192-86 192-192Z"/><path fill="currentColor" d="m350.67 150.93l-117.2 46.88a64 64 0 0 0-35.66 35.66l-46.88 117.2a8 8 0 0 0 10.4 10.4l117.2-46.88a64 64 0 0 0 35.66-35.66l46.88-117.2a8 8 0 0 0-10.4-10.4M256 280a24 24 0 1 1 24-24a24 24 0 0 1-24 24"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 256 256"><path fill="currentColor" d="M240 104h-12.69L192 68.69A15.86 15.86 0 0 0 180.69 64H140V40h24a8 8 0 0 0 0-16h-64a8 8 0 0 0 0 16h24v24H64a16 16 0 0 0-16 16v52H24v-24a8 8 0 0 0-16 0v64a8 8 0 0 0 16 0v-24h24v20.69A15.86 15.86 0 0 0 52.69 180L92 219.31a15.86 15.86 0 0 0 11.31 4.69h77.38a15.86 15.86 0 0 0 11.31-4.69L227.31 184H240a16 16 0 0 0 16-16v-48a16 16 0 0 0-16-16m0 64h-16a8 8 0 0 0-5.66 2.34L180.69 208h-77.38L64 168.69V80h116.69l37.65 37.66A8 8 0 0 0 224 120h16Z"/></svg>
@@ -5,7 +5,6 @@
5
5
  import * as UI from ".."
6
6
  import { optionsStore } from "../options"
7
7
  import { twMerge } from "tailwind-merge"
8
- import CommonSnippets from "../CommonSnippets.svelte"
9
8
 
10
9
  const {
11
10
  component,
@@ -134,21 +134,26 @@
134
134
  <!-- Основные кнопки (оси pitch и yaw) -->
135
135
  <div class="absolute h-full w-full overflow-hidden rounded-full">
136
136
  {#each directions as direction, index}
137
- <button class="pointer-events-none absolute top-1/2 left-1/2 block w-1/2 -translate-y-1/2 cursor-pointer" onclick={direction.onClick} title="">
137
+ <button
138
+ class="btn-segment pointer-events-none absolute top-1/2 left-1/2 block w-1/2 -translate-y-1/2 cursor-pointer"
139
+ onclick={direction.onClick}
140
+ title=""
141
+ >
138
142
  <span
139
- class="relative flex w-full origin-left items-center justify-center pl-[60%] pointer-events-auto active:scale-98 transition duration-200
140
- {direction.mainButton ? 'bg-(--bg-color)' : ''}
141
- "
142
- style=" height: {direction.mainButton
143
- ? 2 * 5 * Math.sin((Math.PI * 65) / 360)
144
- : 2 * 5 * Math.sin((Math.PI * 25) / 360)}rem; transform: rotate({angle *
145
- index}deg); clip-path: polygon(100% 0, {clipPos}% 0, 0 50%, {clipPos}% 100%, 100% 100%)
146
- "
143
+ class="relative flex w-full origin-left items-center justify-center pl-[60%] pointer-events-auto
144
+ {direction.mainButton ? 'bg-(--bg-color)' : ''}"
145
+ style=" height: {direction.mainButton ? 2 * 5 * Math.sin((Math.PI * 65) / 360) : 2 * 5 * Math.sin((Math.PI * 25) / 360)}rem;
146
+ transform: rotate({angle * index}deg); clip-path: polygon(100% 0, {clipPos}% 0, 0 50%, {clipPos}% 100%, 100% 100%)"
147
147
  role="application"
148
148
  onmouseenter={(e) => (e.currentTarget.style.backgroundColor = "color-mix(in srgb, var(--bg-color), var(--shadow-color) 20%)")}
149
149
  onmouseleave={(e) => (e.currentTarget.style.backgroundColor = "var(--bg-color)")}
150
150
  >
151
- <svg xmlns="http://www.w3.org/2000/svg" width={direction.mainButton ? 32 : 16} height={direction.mainButton ? 32 : 16} viewBox="0 0 24 24"
151
+ <svg
152
+ xmlns="http://www.w3.org/2000/svg"
153
+ class="segment-icon"
154
+ width={direction.mainButton ? 32 : 16}
155
+ height={direction.mainButton ? 32 : 16}
156
+ viewBox="0 0 24 24"
152
157
  ><path
153
158
  fill="currentColor"
154
159
  d="M12.6 12L8.7 8.1q-.275-.275-.275-.7t.275-.7t.7-.275t.7.275l4.6 4.6q.15.15.213.325t.062.375t-.062.375t-.213.325l-4.6 4.6q-.275.275-.7.275t-.7-.275t-.275-.7t.275-.7z"
@@ -171,13 +176,11 @@
171
176
  {/each}
172
177
  </div>
173
178
  <!-- Кнопка по центру -->
174
- <div class="z-20 flex size-20 items-center justify-center rounded-full bg-(--bg-color) shadow-[0_0_15px_rgb(0_0_0_/0.25)] transition hover:scale-103">
179
+ <div class="btn-segment z-20 flex size-20 items-center justify-center rounded-full bg-(--bg-color) shadow-[0_0_15px_rgb(0_0_0_/0.25)]">
175
180
  <button
176
181
  class="flex size-18 cursor-pointer items-center justify-center rounded-full p-3.5 [&_svg]:h-full [&_svg]:max-h-full [&_svg]:w-full [&_svg]:max-w-full"
177
182
  style="background: {value[3] == 1 ? 'color-mix(in srgb, var(--bg-color), var(--shadow-color) 10%)' : 'var(--bg-color)'}"
178
- onclick={() => {
179
- value[3] = value[3] == 0 ? 1 : 0
180
- }}
183
+ onclick={() => (value[3] = value[3] == 0 ? 1 : 0)}
181
184
  >
182
185
  {#if buttonIcon}
183
186
  {#if typeof buttonIcon === "string"}
@@ -187,7 +190,7 @@
187
190
  <IconComponent />
188
191
  {/if}
189
192
  {:else}
190
- <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"
193
+ <svg xmlns="http://www.w3.org/2000/svg" class="segment-icon" width="32" height="32" viewBox="0 0 24 24"
191
194
  ><path
192
195
  fill="currentColor"
193
196
  d="M6 19h3v-5q0-.425.288-.712T10 13h4q.425 0 .713.288T15 14v5h3v-9l-6-4.5L6 10zm-2 0v-9q0-.475.213-.9t.587-.7l6-4.5q.525-.4 1.2-.4t1.2.4l6 4.5q.375.275.588.7T20 10v9q0 .825-.588 1.413T18 21h-4q-.425 0-.712-.288T13 20v-5h-2v5q0 .425-.288.713T10 21H6q-.825 0-1.412-.587T4 19m8-6.75"
@@ -204,7 +207,7 @@
204
207
  style="background: color-mix(in srgb, var(--bg-color), var(--shadow-color) 10%)"
205
208
  >
206
209
  <button
207
- class="h-full cursor-pointer rounded-l-full px-3.5 active:scale-98 transition duration-200"
210
+ class="btn-segment h-full cursor-pointer rounded-l-full px-3.5"
208
211
  title=""
209
212
  onclick={() => {
210
213
  if (value[0] - sensitivity <= (axes[0].minNum ?? -360)) {
@@ -218,19 +221,17 @@
218
221
  onmouseenter={(e) => (e.currentTarget.style.backgroundColor = "color-mix(in srgb, var(--bg-color), var(--shadow-color) 30%)")}
219
222
  onmouseleave={(e) => (e.currentTarget.style.backgroundColor = "background: color-mix(in srgb, var(--bg-color), var(--shadow-color) 10%)")}
220
223
  >
221
- <div class="rotate-270">
222
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"
223
- ><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-width="1.5"
224
- ><path
225
- stroke-miterlimit="10"
226
- d="M6.395 7.705A7.9 7.9 0 0 1 12 5.382a7.93 7.93 0 0 1 7.929 7.929A7.94 7.94 0 0 1 12 21.25a7.94 7.94 0 0 1-7.929-7.94"
227
- /><path stroke-linejoin="round" d="m7.12 2.75l-.95 3.858a1.33 1.33 0 0 0 .97 1.609l3.869.948" /></g
228
- ></svg
229
- >
230
- </div></button
231
- >
224
+ <svg xmlns="http://www.w3.org/2000/svg" class="segment-icon rotate-270" width="24" height="24" viewBox="0 0 24 24"
225
+ ><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-width="1.5"
226
+ ><path
227
+ stroke-miterlimit="10"
228
+ d="M6.395 7.705A7.9 7.9 0 0 1 12 5.382a7.93 7.93 0 0 1 7.929 7.929A7.94 7.94 0 0 1 12 21.25a7.94 7.94 0 0 1-7.929-7.94"
229
+ /><path stroke-linejoin="round" d="m7.12 2.75l-.95 3.858a1.33 1.33 0 0 0 .97 1.609l3.869.948" /></g
230
+ ></svg
231
+ >
232
+ </button>
232
233
  <button
233
- class="h-full cursor-pointer rounded-r-full px-3.5 active:scale-97 transition duration-200"
234
+ class="btn-segment h-full cursor-pointer rounded-r-full px-3.5"
234
235
  title=""
235
236
  onclick={() => {
236
237
  if (value[0] + sensitivity >= (axes[0].maxNum ?? 360)) {
@@ -244,17 +245,15 @@
244
245
  onmouseenter={(e) => (e.currentTarget.style.backgroundColor = "color-mix(in srgb, var(--bg-color), var(--shadow-color) 30%)")}
245
246
  onmouseleave={(e) => (e.currentTarget.style.backgroundColor = "vabackground: color-mix(in srgb, var(--bg-color), var(--shadow-color) 10%)")}
246
247
  >
247
- <div class="rotate-90">
248
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"
249
- ><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-width="1.5"
250
- ><path
251
- stroke-miterlimit="10"
252
- d="M17.605 7.705A7.9 7.9 0 0 0 12 5.382a7.93 7.93 0 0 0-7.929 7.929A7.94 7.94 0 0 0 12 21.25a7.94 7.94 0 0 0 7.929-7.94"
253
- /><path stroke-linejoin="round" d="m16.88 2.75l.95 3.858a1.33 1.33 0 0 1-.97 1.609l-3.869.948" /></g
254
- ></svg
255
- >
256
- </div></button
257
- >
248
+ <svg xmlns="http://www.w3.org/2000/svg" class="segment-icon rotate-90" width="24" height="24" viewBox="0 0 24 24"
249
+ ><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-width="1.5"
250
+ ><path
251
+ stroke-miterlimit="10"
252
+ d="M17.605 7.705A7.9 7.9 0 0 0 12 5.382a7.93 7.93 0 0 0-7.929 7.929A7.94 7.94 0 0 0 12 21.25a7.94 7.94 0 0 0 7.929-7.94"
253
+ /><path stroke-linejoin="round" d="m16.88 2.75l.95 3.858a1.33 1.33 0 0 1-.97 1.609l-3.869.948" /></g
254
+ ></svg
255
+ >
256
+ </button>
258
257
  </div>
259
258
  {/if}
260
259
  </div>
@@ -312,3 +311,15 @@
312
311
  </div>
313
312
  </div>
314
313
  </div>
314
+
315
+ <style>
316
+ .segment-icon {
317
+ transition: transform 0.2s ease;
318
+ transform-origin: center;
319
+ display: block;
320
+ }
321
+
322
+ .btn-segment:active .segment-icon {
323
+ transform: scale(0.8);
324
+ }
325
+ </style>
@@ -102,9 +102,9 @@
102
102
  <div class="flex w-1/3 flex-col px-2">
103
103
  <CommonSnippets snippet="Variable" {VARIABLE_OPTIONS} {component} {onPropertyChange} />
104
104
  <CommonSnippets snippet="EventHandlerArgument" {component} {onPropertyChange} />
105
+ <CommonSnippets snippet="Access" {component} {onPropertyChange} />
105
106
  </div>
106
107
  <div class="flex w-1/3 flex-col px-2">
107
- <CommonSnippets snippet="Access" {component} {onPropertyChange} />
108
108
  <CommonSnippets snippet="Label" {component} {onPropertyChange} />
109
109
  <CommonSnippets snippet="LabelAlign" initialValue={initialAlign} {component} {onPropertyChange} />
110
110
  </div>