poe-svelte-ui-lib 1.10.0 → 1.10.2

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.
@@ -45,9 +45,10 @@
45
45
  </div>
46
46
  <div class="flex w-1/3 flex-col px-2">
47
47
  <CommonSnippets snippet="Label" {component} {onPropertyChange} />
48
+ <CommonSnippets snippet="LabelAlign" initialValue={initialAlign} {component} {onPropertyChange} />
48
49
  </div>
49
50
  <div class="flex w-1/3 flex-col px-2">
50
- <CommonSnippets snippet="LabelAlign" initialValue={initialAlign} {component} {onPropertyChange} />
51
+ {@render GraphIsTest()}
51
52
  </div>
52
53
  </div>
53
54
  {:else}
@@ -72,7 +72,16 @@
72
72
  const rounded2 = Number(num.toFixed(2))
73
73
  if (Math.abs(rounded2 - num) < 1e-10) return rounded2
74
74
 
75
- return rounded2
75
+ const rounded3 = Number(num.toFixed(3))
76
+ if (Math.abs(rounded3 - num) < 1e-10) return rounded3
77
+
78
+ const rounded4 = Number(num.toFixed(4))
79
+ if (Math.abs(rounded4 - num) < 1e-10) return rounded4
80
+
81
+ const rounded5 = Number(num.toFixed(5))
82
+ if (Math.abs(rounded5 - num) < 1e-10) return rounded5
83
+
84
+ return rounded5
76
85
  }
77
86
  </script>
78
87
 
@@ -129,8 +138,7 @@
129
138
  rows={textareaRows}
130
139
  {placeholder}
131
140
  {readonly}
132
- oninput={(e) => handleInputChange((e.currentTarget as HTMLTextAreaElement).value)}
133
- ></textarea>
141
+ oninput={(e) => handleInputChange((e.currentTarget as HTMLTextAreaElement).value)}></textarea>
134
142
  {/if}
135
143
 
136
144
  {#if type === "password" && !disabled}
@@ -361,6 +361,7 @@
361
361
  {#snippet InputValue()}
362
362
  <UI.Input
363
363
  label={{ name: $T("constructor.props.defaultvalue") }}
364
+ help={{ regExp: component.properties.type === "number" ? /^\d*\.?\d+$/ : /^.*$/ }}
364
365
  value={component.properties.value}
365
366
  onUpdate={(value) => updateProperty("value", value as string)}
366
367
  />
@@ -202,7 +202,8 @@
202
202
  </div>
203
203
  </div>
204
204
 
205
- <div class="absolute top-4 w-55 flex items-center justify-end">
205
+ <!-- Копка 0 -->
206
+ <div class="absolute {label.name ? 'top-4' : 'top-0'} w-55 flex items-center justify-end">
206
207
  <button
207
208
  class="flex shadow-sm hover:shadow-md transition duration-200 justify-center cursor-pointer items-center bg-(--back-color) rounded-full size-10 p-0.5
208
209
  font-semibold text-2xl [&_svg]:h-full [&_svg]:max-h-full [&_svg]:w-full [&_svg]:max-w-full"
@@ -212,26 +213,6 @@
212
213
  >
213
214
  0
214
215
  </button>
215
- <!-- {#each [0, 1] as i}
216
- <button
217
- class="flex shadow-sm hover:shadow-md transition duration-200 justify-center cursor-pointer items-center bg-(--back-color) rounded-full size-10 p-0.5
218
- {i ? 'font-semibold text-2xl' : ''} [&_svg]:h-full [&_svg]:max-h-full [&_svg]:w-full [&_svg]:max-w-full"
219
- style="background: color-mix(in srgb, var(--bg-color), var(--back-color) 70%);"
220
- title=""
221
- onclick={() => (i ? (value = [0, 0, 0, 0]) : {})}
222
- >
223
- {#if i}
224
- 0
225
- {:else}
226
- <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"
227
- ><path
228
- fill="currentColor"
229
- 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"
230
- /></svg
231
- >
232
- {/if}
233
- </button>
234
- {/each} -->
235
216
  </div>
236
217
 
237
218
  <!-- Боковые кнопки (ось roll) -->
@@ -2,7 +2,13 @@
2
2
  import { twMerge } from "tailwind-merge"
3
3
  import type { ITextFieldProps } from "../types"
4
4
 
5
- let { id = crypto.randomUUID(), wrapperClass = "", background = false, content = { name: "", class: "", size: "base" } }: ITextFieldProps = $props()
5
+ let {
6
+ id = crypto.randomUUID(),
7
+ wrapperClass = "",
8
+ background = false,
9
+ underline = false,
10
+ content = { name: "", class: "", size: "base" },
11
+ }: ITextFieldProps = $props()
6
12
 
7
13
  const textSize = {
8
14
  small: "text-sm",
@@ -15,7 +21,10 @@
15
21
 
16
22
  <div
17
23
  id={`${id}-${crypto.randomUUID().slice(0, 6)}`}
18
- class={twMerge(`relative flex w-full flex-col items-center ${background ? "rounded-2xl bg-(--back-color) px-6 py-2" : ""}`, wrapperClass)}
24
+ class={twMerge(
25
+ `relative flex w-full flex-col items-center ${background ? "rounded-2xl bg-(--back-color) px-6 py-2" : ""} ${underline ? "underline" : ""}`,
26
+ wrapperClass,
27
+ )}
19
28
  >
20
29
  <p class={twMerge(`w-full text-center ${textSize[content.size ?? "base"]}`, content.class)}>
21
30
  {content.name}
@@ -70,6 +70,7 @@
70
70
  value={$optionsStore.TEXTFIELD_SETTINGS_OPTIONS.filter((opt) => {
71
71
  if (component.properties.content.class.includes(`${opt.value}`) && !component.properties.content.class.includes(`not-${opt.value}`)) return opt
72
72
  if (opt.value == "background" && component.properties.background) return opt
73
+ if (opt.value == "underline" && component.properties.underline) return opt
73
74
  })}
74
75
  options={$optionsStore.TEXTFIELD_SETTINGS_OPTIONS}
75
76
  onUpdate={(value) => {
@@ -77,31 +78,36 @@
77
78
  if (!opt?.value) return false
78
79
  return (
79
80
  (component.properties.content.class.includes(`${opt.value}`) && !component.properties.content.class.includes(`not-${opt.value}`)) ||
80
- (opt.value == "background" && component.properties.background)
81
+ (opt.value == "background" && component.properties.background) ||
82
+ (opt.value == "underline" && component.properties.underline)
81
83
  )
82
84
  }).map((opt) => opt.value)
83
85
  if (Array.isArray(value)) {
84
86
  value.forEach((opt) => {
85
87
  opt?.value === "background"
86
88
  ? updateProperty("background", true, component, onPropertyChange)
87
- : updateProperty(
88
- "content.class",
89
- twMerge(`${component.properties.content.class} ${opt.value === "bold" ? "font-bold" : "italic"}`),
90
- component,
91
- onPropertyChange,
92
- )
89
+ : opt?.value === "underline"
90
+ ? updateProperty("underline", true, component, onPropertyChange)
91
+ : updateProperty(
92
+ "content.class",
93
+ twMerge(`${component.properties.content.class} ${opt.value === "bold" ? "font-bold" : "italic"}`),
94
+ component,
95
+ onPropertyChange,
96
+ )
93
97
  })
94
98
 
95
99
  currentActiveValues.forEach((activeValue) => {
96
100
  if (!value.some((opt) => opt?.value === activeValue)) {
97
101
  activeValue === "background"
98
102
  ? updateProperty("background", false, component, onPropertyChange)
99
- : updateProperty(
100
- "content.class",
101
- twMerge(`${component.properties.content.class} ${activeValue === "bold" ? "font-normal" : "not-italic"}`),
102
- component,
103
- onPropertyChange,
104
- )
103
+ : activeValue === "underline"
104
+ ? updateProperty("underline", false, component, onPropertyChange)
105
+ : updateProperty(
106
+ "content.class",
107
+ twMerge(`${component.properties.content.class} ${activeValue === "bold" ? "font-normal" : "not-italic"}`),
108
+ component,
109
+ onPropertyChange,
110
+ )
105
111
  }
106
112
  })
107
113
  }
@@ -135,7 +135,7 @@
135
135
  </div>
136
136
  </div>
137
137
 
138
- {#if showSelect}
138
+ {#if sources.length > 1 && showSelect}
139
139
  {@const deviceOptions = sources.map((dev) => {
140
140
  return { id: dev.deviceId, name: dev.label, value: dev.deviceId }
141
141
  })}
package/dist/index.d.ts CHANGED
@@ -32,6 +32,7 @@ export { default as TabsProps } from "./Tabs/TabsProps.svelte";
32
32
  export { default as TextField } from "./TextField/TextField.svelte";
33
33
  export { default as TextFieldProps } from "./TextField/TextFieldProps.svelte";
34
34
  export { default as VideoViewer } from "./VideoViewer/VideoViewer.svelte";
35
+ export { default as VideoViewerProps } from "./VideoViewer/VideoViewerProps.svelte";
35
36
  export { default as Widget } from "./Widget/Widget.svelte";
36
37
  export { default as WidgetProps } from "./Widget/WidgetProps.svelte";
37
38
  export * from "./locales/i18n";
package/dist/index.js CHANGED
@@ -33,7 +33,7 @@ export { default as TabsProps } from "./Tabs/TabsProps.svelte";
33
33
  export { default as TextField } from "./TextField/TextField.svelte";
34
34
  export { default as TextFieldProps } from "./TextField/TextFieldProps.svelte";
35
35
  export { default as VideoViewer } from "./VideoViewer/VideoViewer.svelte";
36
- // export { default as VideoViewerProps } from "./VideoViewer/VideoViewerProps.svelte"
36
+ export { default as VideoViewerProps } from "./VideoViewer/VideoViewerProps.svelte";
37
37
  export { default as Widget } from "./Widget/Widget.svelte";
38
38
  export { default as WidgetProps } from "./Widget/WidgetProps.svelte";
39
39
  export * from "./locales/i18n";
@@ -154,6 +154,7 @@ const translations = {
154
154
  "constructor.props.bold": "Жирный",
155
155
  "constructor.props.italic": "Курсив",
156
156
  "constructor.props.background": "Фон",
157
+ "constructor.props.underline": "Линия",
157
158
  "constructor.props.optionclass": "Стили опции",
158
159
  "constructor.props.optionvalue": "Значение",
159
160
  "constructor.props.optionposition": "Позиция",
package/dist/options.js CHANGED
@@ -55,6 +55,7 @@ export const optionsStore = derived(T, ($T) => {
55
55
  TEXTFIELD_SETTINGS_OPTIONS: [
56
56
  { id: id(), value: "bold", name: $T("constructor.props.bold") },
57
57
  { id: id(), value: "italic", name: $T("constructor.props.italic") },
58
+ { id: id(), value: "underline", name: $T("constructor.props.underline") },
58
59
  { id: id(), value: "background", name: $T("constructor.props.background") },
59
60
  ],
60
61
  COLOR_OPTIONS: [
package/dist/types.d.ts CHANGED
@@ -405,6 +405,7 @@ export interface ITextFieldProps {
405
405
  id?: string;
406
406
  wrapperClass?: string;
407
407
  background?: boolean;
408
+ underline?: boolean;
408
409
  content?: {
409
410
  name?: string;
410
411
  class?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "poe-svelte-ui-lib",
3
- "version": "1.10.0",
3
+ "version": "1.10.2",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "scripts": {