poe-svelte-ui-lib 1.9.14 → 1.9.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.
@@ -87,7 +87,6 @@
87
87
  array,
88
88
  }
89
89
 
90
- // commandItems = Array.from(container[containerIndex ?? 0]?.querySelectorAll('[id^="item-"]') || [])
91
90
  commandItems = Array.from(container.querySelectorAll(`[id^="${elementsId}-"]`) || [])
92
91
 
93
92
  e.preventDefault()
@@ -160,11 +159,18 @@
160
159
 
161
160
  <div
162
161
  id={crypto.randomUUID()}
163
- class={twMerge("cursor-move size-8 [&_svg]:h-full [&_svg]:max-h-full [&_svg]:w-full [&_svg]:max-w-full", wrapperClass)}
162
+ class={twMerge(
163
+ `size-8 [&_svg]:h-full [&_svg]:max-h-full [&_svg]:w-full [&_svg]:max-w-full ${array.length == 1 ? "opacity-50 cursor-not-allowed" : "cursor-move"} `,
164
+ wrapperClass,
165
+ )}
164
166
  role="button"
165
167
  tabindex={0}
166
168
  onkeydown={null}
167
- onmousedown={(e) => startDrag(e)}
169
+ onmousedown={(e) => {
170
+ if (array.length !== 1) {
171
+ startDrag(e)
172
+ }
173
+ }}
168
174
  >
169
175
  <MoveVerticalIcon />
170
176
  </div>
@@ -82,7 +82,7 @@
82
82
  {/if}
83
83
 
84
84
  <div class="relative flex w-full items-center {type === 'text-area' ? 'h-full' : ''}">
85
- {#if type === "text" || type === "password" || type === "number"}
85
+ {#if type !== "text-area"}
86
86
  <input
87
87
  bind:value
88
88
  class={twMerge(
@@ -109,7 +109,7 @@
109
109
  step={number?.step}
110
110
  {readonly}
111
111
  />
112
- {:else if type === "text-area"}
112
+ {:else}
113
113
  <textarea
114
114
  bind:value
115
115
  class={twMerge(
@@ -194,7 +194,7 @@
194
194
  </button>
195
195
  {/if}
196
196
 
197
- {#if type === "number" && !readonly && !disabled}
197
+ {#if (type === "number" || type === "bitMode") && !readonly && !disabled}
198
198
  <div class="absolute right-0 flex h-full w-8 flex-col items-center justify-center rounded-r-2xl border-l border-(--border-color)">
199
199
  <button
200
200
  class="flex h-1/2 w-full items-center rounded-tr-2xl border-b border-(--border-color) pl-2 transition-colors duration-150 hover:bg-(--gray-color)/30 active:bg-(--gray-color)/10"
@@ -133,11 +133,21 @@
133
133
  {#snippet InputType()}
134
134
  <UI.Select
135
135
  label={{ name: $t("constructor.props.type") }}
136
- options={$optionsStore.INPUT_TYPE_OPTIONS.map((o) => (component.properties.bitMode && o.value != "number" ? { ...o, disabled: true } : o))}
136
+ options={$optionsStore.INPUT_TYPE_OPTIONS}
137
137
  type="buttons"
138
138
  value={$optionsStore.INPUT_TYPE_OPTIONS.find((opt) => opt.value === (component.properties.type || "text"))}
139
139
  onUpdate={(option) => {
140
140
  if ((option as IOption<string>).value == "password" && component.properties.help.copyButton) updateProperty("help.copyButton", false)
141
+ if ((option as IOption<string>).value === "bitMode") {
142
+ updateProperty("type", "number")
143
+ updateProperty("number.minNum", 0)
144
+ updateProperty("number.maxNum", Math.pow(2, component.properties.range.end - component.properties.range.start + 1) - 1)
145
+ updateProperty("number.step", 1)
146
+ updateProperty("help.info", `${$t("constructor.props.maxnum")}: ${component.properties.number.maxNum}`)
147
+ } else {
148
+ updateProperty("help.info", "")
149
+ }
150
+
141
151
  updateProperty("type", (option as UI.IOption).value as string)
142
152
  }}
143
153
  />
@@ -194,7 +204,7 @@
194
204
  {#if component.properties.type === "text" || component.properties.type === "text-area"}
195
205
  <UI.Select
196
206
  label={{ name: $t("constructor.props.align.content") }}
197
- options={$optionsStore.TEXT_ALIGN_OPTIONS.map((o) => (component.properties.bitMode && o.value != "number" ? { ...o, disabled: true } : o))}
207
+ options={$optionsStore.TEXT_ALIGN_OPTIONS}
198
208
  type="buttons"
199
209
  value={$optionsStore.TEXT_ALIGN_OPTIONS.find(
200
210
  (opt) => opt.value === (component.properties.componentClass.split(" ").find((cl: string) => cl.startsWith("text-")) || "text-center"),
@@ -204,13 +214,12 @@
204
214
  }}
205
215
  />
206
216
  {/if}
207
- {:else if !component.properties.bitMode && component.properties.type === "number" && !component.properties.readonly && !component.properties.disabled}
217
+ {:else if component.properties.type === "number" && !component.properties.readonly && !component.properties.disabled}
208
218
  <div class="flex">
209
219
  <UI.Input
210
220
  label={{ name: $t("constructor.props.min") }}
211
221
  value={component.properties.number.minNum as number}
212
222
  type="number"
213
- readonly={component.properties.bitMode}
214
223
  onUpdate={(value) => {
215
224
  updateProperty("number.minNum", Number(value))
216
225
  }}
@@ -219,7 +228,6 @@
219
228
  label={{ name: $t("constructor.props.max") }}
220
229
  value={component.properties.number.maxNum as number}
221
230
  type="number"
222
- readonly={component.properties.bitMode}
223
231
  onUpdate={(value) => {
224
232
  updateProperty("number.maxNum", Number(value))
225
233
  }}
@@ -228,10 +236,26 @@
228
236
  label={{ name: $t("constructor.props.step") }}
229
237
  value={component.properties.number.step as number}
230
238
  type="number"
231
- readonly={component.properties.bitMode}
232
239
  onUpdate={(value) => updateProperty("number.step", Number(value))}
233
240
  />
234
241
  </div>
242
+ {:else if component.properties.type === "bitMode"}
243
+ <UI.Slider
244
+ label={{ name: $t("constructor.props.range") }}
245
+ type="range"
246
+ number={{ minNum: 0, maxNum: 31, step: 1 }}
247
+ value={[component.properties.range.start, component.properties.range.end]}
248
+ onUpdate={(value) => {
249
+ if (Array.isArray(value)) {
250
+ updateProperty("range.start", value[0] as number)
251
+ updateProperty("range.end", value[1] as number)
252
+ updateProperty("number.minNum", 0)
253
+ updateProperty("number.maxNum", Math.pow(2, component.properties.range.end - component.properties.range.start + 1) - 1)
254
+ updateProperty("number.step", 1)
255
+ updateProperty("help.info", `${$t("constructor.props.maxnum")}: ${component.properties.number.maxNum}`)
256
+ }
257
+ }}
258
+ />
235
259
  {/if}
236
260
  {/snippet}
237
261
 
@@ -252,46 +276,37 @@
252
276
  {/snippet}
253
277
 
254
278
  {#snippet InputSettings()}
255
- <UI.Select
256
- wrapperClass="mt-5"
257
- options={$optionsStore.INPUT_SETTING_OPTIONS.map((o) => {
258
- if (component.properties.type === "number" && o.value === "bitMode") return { ...o, disabled: false }
259
- else if (component.properties.type === "password" && o.value == "help.copyButton") return { ...o, disabled: true }
260
- else return o
261
- })}
262
- type="buttons"
263
- multiSelect={true}
264
- value={$optionsStore.INPUT_SETTING_OPTIONS.filter((opt) => {
265
- if (opt.value.split(".").reduce((o, key) => o?.[key], component.properties)) return opt
266
- })}
267
- onUpdate={(value) => {
268
- const currentActiveValues = $optionsStore.INPUT_SETTING_OPTIONS.filter((opt) => {
269
- if (!opt?.value) return false
270
- return opt.value.split(".").reduce((o, key) => o?.[key], component.properties)
271
- }).map((opt) => opt.value)
272
- if (Array.isArray(value)) {
273
- value.forEach((opt) => {
274
- updateProperty(opt.value ?? "", true)
275
- if (opt.value === "bitMode") {
276
- updateProperty("type", "number")
277
- updateProperty("number.minNum", 0)
278
- updateProperty("number.maxNum", Math.pow(2, component.properties.range.end - component.properties.range.start + 1) - 1)
279
- updateProperty("number.step", 1)
280
- updateProperty("help.info", `${$t("constructor.props.maxnum")}: ${component.properties.number.maxNum}`)
281
- }
282
- })
283
-
284
- currentActiveValues.forEach((activeValue) => {
285
- if (!value.some((opt) => opt?.value === activeValue)) {
286
- updateProperty(activeValue, false)
287
- if (activeValue === "bitMode") {
288
- updateProperty("help.info", "")
279
+ {#if component.properties.type !== "bitMode"}
280
+ <UI.Select
281
+ wrapperClass="mt-5"
282
+ options={$optionsStore.INPUT_SETTING_OPTIONS.map((o) => {
283
+ if (component.properties.type === "password" && o.value == "help.copyButton") return { ...o, disabled: true }
284
+ else return o
285
+ })}
286
+ type="buttons"
287
+ multiSelect={true}
288
+ value={$optionsStore.INPUT_SETTING_OPTIONS.filter((opt) => {
289
+ if (opt.value.split(".").reduce((o, key) => o?.[key], component.properties)) return opt
290
+ })}
291
+ onUpdate={(value) => {
292
+ const currentActiveValues = $optionsStore.INPUT_SETTING_OPTIONS.filter((opt) => {
293
+ if (!opt?.value) return false
294
+ return opt.value.split(".").reduce((o, key) => o?.[key], component.properties)
295
+ }).map((opt) => opt.value)
296
+ if (Array.isArray(value)) {
297
+ value.forEach((opt) => {
298
+ updateProperty(opt.value ?? "", true)
299
+ })
300
+
301
+ currentActiveValues.forEach((activeValue) => {
302
+ if (!value.some((opt) => opt?.value === activeValue)) {
303
+ updateProperty(activeValue, false)
289
304
  }
290
- }
291
- })
292
- }
293
- }}
294
- />
305
+ })
306
+ }
307
+ }}
308
+ />
309
+ {/if}
295
310
  {/snippet}
296
311
 
297
312
  {#snippet InputAutocomplete()}
@@ -355,27 +370,6 @@
355
370
  />
356
371
  {/snippet}
357
372
 
358
- {#snippet InputBitmode()}
359
- {#if component.properties.bitMode}
360
- <UI.Slider
361
- label={{ name: $t("constructor.props.range") }}
362
- type="range"
363
- number={{ minNum: 0, maxNum: 31, step: 1 }}
364
- value={[component.properties.range.start, component.properties.range.end]}
365
- onUpdate={(value) => {
366
- if (Array.isArray(value)) {
367
- updateProperty("range.start", value[0] as number)
368
- updateProperty("range.end", value[1] as number)
369
- updateProperty("number.minNum", 0)
370
- updateProperty("number.maxNum", Math.pow(2, component.properties.range.end - component.properties.range.start + 1) - 1)
371
- updateProperty("number.step", 1)
372
- updateProperty("help.info", `${$t("constructor.props.maxnum")}: ${component.properties.number.maxNum}`)
373
- }
374
- }}
375
- />
376
- {/if}
377
- {/snippet}
378
-
379
373
  {#if forConstructor}
380
374
  <div class="relative flex flex-row items-start justify-center">
381
375
  <div class="flex w-1/3 flex-col px-2">
@@ -387,7 +381,6 @@
387
381
  {@render InputPlaceholder()}
388
382
  {@render InputInfo()}
389
383
  {@render InputSettings()}
390
- {@render InputBitmode()}
391
384
  </div>
392
385
  <div class="flex w-1/3 flex-col px-2">
393
386
  {@render InputLabel()}
@@ -416,10 +409,7 @@
416
409
  {@render InputInfo()}
417
410
  {@render InputAutocomplete()}
418
411
  {@render InputSettings()}
419
- <div class="flex">
420
- {@render InputDisabled()}
421
- {@render InputBitmode()}
422
- </div>
412
+ {@render InputDisabled()}
423
413
  </div>
424
414
  </div>
425
415
  {/if}
@@ -447,18 +447,16 @@
447
447
  >
448
448
  {#if text?.modal}
449
449
  <button
450
- class={twMerge("w-fit cursor-pointer text-left", text.class)}
450
+ class="w-fit cursor-pointer text-left"
451
451
  onclick={(e) => {
452
452
  e.stopPropagation()
453
- showModal(data, text?.formatting)
453
+ showModal(data.replace(/<[^>]*>/g, ""), text?.formatting)
454
454
  }}
455
455
  >
456
- {data}
456
+ {@html data}
457
457
  </button>
458
458
  {:else}
459
- <span class={text.class}>
460
- {data}
461
- </span>
459
+ {@html data}
462
460
  {/if}
463
461
  </div>
464
462
 
@@ -467,7 +465,7 @@
467
465
  class="mx-2 flex cursor-pointer border-none bg-transparent text-2xl"
468
466
  onclick={(e) => {
469
467
  e.preventDefault()
470
- navigator.clipboard.writeText(row[text?.key ?? ""])
468
+ navigator.clipboard.writeText(row[text?.key ?? ""].replace(/<[^>]*>/g, ""))
471
469
  copiedCell = { x: j, y: i }
472
470
  setTimeout(() => (copiedCell = null), 1000)
473
471
  }}
@@ -514,7 +512,7 @@
514
512
  transition:fly={{ y: 10, duration: 200 }}
515
513
  role="tooltip"
516
514
  >
517
- {@html tooltip.text}
515
+ {@html tooltip.text.replace(/<[^>]*>/g, "")}
518
516
  </div>
519
517
  {/if}
520
518
  <!-- Нижнее поле для сводной информации -->
@@ -60,7 +60,6 @@
60
60
  )}
61
61
  onUpdate={(option) => {
62
62
  updateProperty("icons.class", twMerge(component.properties.icons.class, (option as UI.IOption<string>).value), component, onPropertyChange)
63
- console.log(component.properties)
64
63
  }}
65
64
  />
66
65
  {/snippet}
@@ -31,6 +31,7 @@ const translations = {
31
31
  "constructor.props.type.password": "Пароль",
32
32
  "constructor.props.type.number": "Число",
33
33
  "constructor.props.type.textarea": "Область ",
34
+ "constructor.props.type.bitMode": "Битовый ",
34
35
  "constructor.props.type.single": "Простой",
35
36
  "constructor.props.type.range": "Диапазон",
36
37
  "constructor.props.type.small": "XS",
package/dist/options.d.ts CHANGED
@@ -135,17 +135,11 @@ export declare const optionsStore: import("svelte/store").Readable<{
135
135
  value: string;
136
136
  name: string;
137
137
  }[];
138
- INPUT_SETTING_OPTIONS: ({
138
+ INPUT_SETTING_OPTIONS: {
139
139
  id: string;
140
140
  value: string;
141
141
  name: string;
142
- disabled?: undefined;
143
- } | {
144
- id: string;
145
- value: string;
146
- name: string;
147
- disabled: boolean;
148
- })[];
142
+ }[];
149
143
  BUFFER_SIZE_OPTIONS: {
150
144
  id: string;
151
145
  value: number;
package/dist/options.js CHANGED
@@ -32,6 +32,7 @@ export const optionsStore = derived(t, ($t) => {
32
32
  { id: id(), value: "password", name: $t("constructor.props.type.password") },
33
33
  { id: id(), value: "number", name: $t("constructor.props.type.number") },
34
34
  { id: id(), value: "text-area", name: $t("constructor.props.type.textarea") },
35
+ { id: id(), value: "bitMode", name: $t("constructor.props.type.bitMode") },
35
36
  ],
36
37
  SELECT_TYPE_OPTIONS: [
37
38
  { id: id(), value: "select", name: $t("constructor.props.type.select") },
@@ -181,7 +182,6 @@ export const optionsStore = derived(t, ($t) => {
181
182
  INPUT_SETTING_OPTIONS: [
182
183
  { id: id(), value: "readonly", name: $t("constructor.props.readonly") },
183
184
  { id: id(), value: "help.copyButton", name: $t("constructor.props.copy") },
184
- { id: id(), value: "bitMode", name: $t("constructor.props.bitMode"), disabled: true },
185
185
  ],
186
186
  BUFFER_SIZE_OPTIONS: [
187
187
  { id: id(), value: 10, name: "10" },
package/dist/types.d.ts CHANGED
@@ -150,7 +150,7 @@ export interface IGraphProps {
150
150
  }
151
151
  export interface IInputProps {
152
152
  id?: string;
153
- type?: "text" | "password" | "number" | "text-area";
153
+ type?: "text" | "password" | "number" | "text-area" | "bitMode";
154
154
  wrapperClass?: string;
155
155
  label?: {
156
156
  name?: string;
@@ -160,7 +160,6 @@ export interface IInputProps {
160
160
  disabled?: boolean;
161
161
  readonly?: boolean;
162
162
  value?: string | number;
163
- bitMode?: boolean;
164
163
  range?: {
165
164
  start: number;
166
165
  end: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "poe-svelte-ui-lib",
3
- "version": "1.9.14",
3
+ "version": "1.9.16",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -37,18 +37,18 @@
37
37
  },
38
38
  "devDependencies": {
39
39
  "@sveltejs/adapter-static": "^3.0.10",
40
- "@sveltejs/kit": "^2.58.0",
40
+ "@sveltejs/kit": "^2.59.1",
41
41
  "@sveltejs/package": "^2.5.7",
42
- "@sveltejs/vite-plugin-svelte": "^7.0.0",
42
+ "@sveltejs/vite-plugin-svelte": "^7.1.1",
43
43
  "@tailwindcss/vite": "^4.2.4",
44
44
  "@types/maplibre-gl": "^1.14.0",
45
45
  "@types/node": "^25.6.0",
46
- "dompurify": "^3.4.1",
47
- "marked": "^18.0.2",
46
+ "dompurify": "^3.4.2",
47
+ "marked": "^18.0.3",
48
48
  "prettier": "^3.8.3",
49
49
  "prettier-plugin-svelte": "^3.5.1",
50
50
  "prettier-plugin-tailwindcss": "^0.8.0",
51
- "publint": "^0.3.18",
51
+ "publint": "^0.3.19",
52
52
  "svelte": "^5.55.5",
53
53
  "tailwindcss": "^4.2.4",
54
54
  "tsx": "^4.21.0",