svelte-comp 1.1.4 → 1.1.5

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.
@@ -170,7 +170,7 @@
170
170
  </div>
171
171
  {/if}
172
172
 
173
- <div class="flex font-mono {TEXT[sz]} {LINE_HEIGHT[sz]}">
173
+ <div class={cx("flex font-mono", TEXT[sz], LINE_HEIGHT[sz])}>
174
174
  {#if showLineNumbers}
175
175
  <div
176
176
  bind:this={gutterEl}
@@ -189,7 +189,7 @@
189
189
  <div class="relative flex-1 min-h-[180px] max-h-[480px]">
190
190
  <div
191
191
  bind:this={highlightEl}
192
- class="cv-highlight cv-layer {TEXT[sz]} {LINE_HEIGHT[sz]}"
192
+ class={cx("cv-highlight cv-layer", TEXT[sz], LINE_HEIGHT[sz])}
193
193
  class:cv-active-line={activeLine && editable}
194
194
  style={activeLine && editable
195
195
  ? `--cv-line-height: ${lineHeightPx}px; --cv-active-line-top: ${padTopPx + activeLineIndex * lineHeightPx - highlightScroll}px;`
@@ -211,7 +211,7 @@
211
211
  onfocus={editable ? updateActiveLine : undefined}
212
212
  spellcheck="false"
213
213
  readonly={!editable}
214
- class="cv-input cv-layer {TEXT[sz]} {LINE_HEIGHT[sz]}"
214
+ class={cx("cv-input cv-layer", TEXT[sz], LINE_HEIGHT[sz])}
215
215
  ></textarea>
216
216
  </div>
217
217
  </div>
@@ -151,8 +151,11 @@
151
151
  return compact ? (compactMap[size] ?? "md") : size;
152
152
  }
153
153
 
154
- let formInstanceCounter = 0;
155
- const instanceId = $state(formInstanceCounter++);
154
+ const globalFormInstanceCounter = globalThis as unknown as {
155
+ __svelteCompFormInstanceCounter?: number;
156
+ };
157
+ globalFormInstanceCounter.__svelteCompFormInstanceCounter ??= 0;
158
+ const instanceId = $state(globalFormInstanceCounter.__svelteCompFormInstanceCounter++);
156
159
 
157
160
  const baseFormId = $derived.by(() => {
158
161
  if (formId && formId.trim()) return formId.trim();
@@ -71,9 +71,15 @@
71
71
 
72
72
  $effect(() => {
73
73
  if (!mounted) {
74
- const saved = localStorage.getItem("primary");
75
- if (isPrimaryKey(saved)) {
76
- selected = saved;
74
+ try {
75
+ if (typeof window !== "undefined") {
76
+ const saved = localStorage.getItem("primary");
77
+ if (isPrimaryKey(saved)) {
78
+ selected = saved;
79
+ }
80
+ }
81
+ } catch {
82
+ // ignore unavailable storage/environment
77
83
  }
78
84
  mounted = true;
79
85
  }
@@ -81,8 +87,16 @@
81
87
 
82
88
  $effect(() => {
83
89
  if (mounted) {
84
- document.documentElement.setAttribute("data-primary", selected);
85
- localStorage.setItem("primary", selected);
90
+ try {
91
+ if (typeof document !== "undefined") {
92
+ document.documentElement.setAttribute("data-primary", selected);
93
+ }
94
+ if (typeof window !== "undefined") {
95
+ localStorage.setItem("primary", selected);
96
+ }
97
+ } catch {
98
+ // ignore unavailable storage/environment
99
+ }
86
100
  }
87
101
  });
88
102
  </script>
@@ -104,7 +104,7 @@
104
104
  {...rest}
105
105
  >
106
106
  {#if label}
107
- <span class="text-[var(--color-text-muted)] select-none {TEXT[sz]}">
107
+ <span class={cx("text-[var(--color-text-muted)] select-none", TEXT[sz])}>
108
108
  {label}
109
109
  </span>
110
110
  {/if}
@@ -94,7 +94,7 @@
94
94
  {...rest}
95
95
  >
96
96
  {#if label}
97
- <span class="text-[var(--color-text-muted)] select-none {TEXT[sz]}">
97
+ <span class={cx("text-[var(--color-text-muted)] select-none", TEXT[sz])}>
98
98
  {label}
99
99
  </span>
100
100
  {/if}
@@ -143,9 +143,10 @@
143
143
 
144
144
  {#if !indeterminate}
145
145
  <div
146
- class="absolute inset-0 flex items-center justify-center text-[var(--color-text-muted)] font-medium select-none {TEXT[
147
- sz
148
- ]}"
146
+ class={cx(
147
+ "absolute inset-0 flex items-center justify-center text-[var(--color-text-muted)] font-medium select-none",
148
+ TEXT[sz]
149
+ )}
149
150
  >
150
151
  {pctText}%
151
152
  </div>
@@ -384,6 +384,7 @@
384
384
  <div class={rootClass}>
385
385
  {#if label}
386
386
  <label
387
+ id={`${fieldId}-hidden-label`}
387
388
  for={`${fieldId}-hidden`}
388
389
  class={cx(TEXT[sz], "font-medium [color:var(--color-text-muted)]")}
389
390
  >
@@ -209,6 +209,8 @@
209
209
  bind:this={wrap}
210
210
  class={rootClass}
211
211
  onclick={onTrackClick}
212
+ onfocusin={(e) => (rest as unknown as { onfocus?: (e: FocusEvent) => void }).onfocus?.(e as FocusEvent)}
213
+ onfocusout={(e) => (rest as unknown as { onblur?: (e: FocusEvent) => void }).onblur?.(e as FocusEvent)}
212
214
  data-disabled={disabled ? "true" : undefined}
213
215
  {...rest}
214
216
  >
@@ -1,4 +1,4 @@
1
- <!-- src/lib/TimePicker.svelte -->
1
+ <!-- src/lib/TimePicker.svelte -->
2
2
  <script lang="ts">
3
3
  /**
4
4
  * @component TimePicker
@@ -266,4 +266,4 @@
266
266
  {/if}
267
267
  </p>
268
268
  </div>
269
- </div>
269
+ </div>
@@ -51,9 +51,9 @@ export declare const TEXTS: {
51
51
  readonly ru: {
52
52
  readonly components: {
53
53
  readonly colorPicker: {
54
- readonly text: "Выберете цвет";
54
+ readonly text: "Выбрать цвет";
55
55
  readonly color: "Цвет";
56
- readonly clear: "Сбросить";
56
+ readonly clear: "Очистить";
57
57
  readonly placeholder: "Цвет не выбран";
58
58
  readonly selectedColor: "Выбранный цвет";
59
59
  };
@@ -61,7 +61,7 @@ export declare const TEXTS: {
61
61
  readonly text: "Выбрать дату";
62
62
  readonly placeholder: "Дата не выбрана";
63
63
  readonly date: "Дата";
64
- readonly clear: "Сбросить";
64
+ readonly clear: "Очистить";
65
65
  readonly selectedDate: "Выбранная дата";
66
66
  };
67
67
  readonly dialog: {
@@ -70,7 +70,7 @@ export declare const TEXTS: {
70
70
  };
71
71
  readonly filePicker: {
72
72
  readonly text: "Выбрать файлы";
73
- readonly clear: "Сбросить";
73
+ readonly clear: "Очистить";
74
74
  readonly dragDrop: "Перетащите файлы сюда или нажмите, чтобы выбрать";
75
75
  readonly accepted: "Допустимые форматы";
76
76
  readonly selectedFiles: "Выбранные файлы";
@@ -79,7 +79,7 @@ export declare const TEXTS: {
79
79
  readonly totalSize: "Общий размер";
80
80
  };
81
81
  readonly menu: {
82
- readonly subtitle: "Меню с опциями размеров";
82
+ readonly subtitle: "Меню с вариантами размеров";
83
83
  };
84
84
  readonly primaryColorSelect: {
85
85
  readonly text: "Основной цвет";
@@ -88,8 +88,8 @@ export declare const TEXTS: {
88
88
  readonly text: "Выбрать время";
89
89
  readonly placeholder: "Время не выбрано";
90
90
  readonly clear: "Очистить";
91
- readonly hour: "Часы";
92
- readonly minute: "Минуты";
91
+ readonly hour: "Час";
92
+ readonly minute: "Минута";
93
93
  readonly period: "Период";
94
94
  readonly selectedTime: "Выбранное время";
95
95
  readonly switchTo12h: "12ч";
package/dist/lib/lang.js CHANGED
@@ -47,9 +47,9 @@ var enTexts = {
47
47
  var ruTexts = {
48
48
  components: {
49
49
  colorPicker: {
50
- text: "Выберете цвет",
50
+ text: "Выбрать цвет",
51
51
  color: "Цвет",
52
- clear: "Сбросить",
52
+ clear: "Очистить",
53
53
  placeholder: "Цвет не выбран",
54
54
  selectedColor: "Выбранный цвет",
55
55
  },
@@ -57,7 +57,7 @@ var ruTexts = {
57
57
  text: "Выбрать дату",
58
58
  placeholder: "Дата не выбрана",
59
59
  date: "Дата",
60
- clear: "Сбросить",
60
+ clear: "Очистить",
61
61
  selectedDate: "Выбранная дата",
62
62
  },
63
63
  dialog: {
@@ -66,7 +66,7 @@ var ruTexts = {
66
66
  },
67
67
  filePicker: {
68
68
  text: "Выбрать файлы",
69
- clear: "Сбросить",
69
+ clear: "Очистить",
70
70
  dragDrop: "Перетащите файлы сюда или нажмите, чтобы выбрать",
71
71
  accepted: "Допустимые форматы",
72
72
  selectedFiles: "Выбранные файлы",
@@ -74,14 +74,14 @@ var ruTexts = {
74
74
  fileCount: "{n} файл(ов) выбрано",
75
75
  totalSize: "Общий размер",
76
76
  },
77
- menu: { subtitle: "Меню с опциями размеров" },
77
+ menu: { subtitle: "Меню с вариантами размеров" },
78
78
  primaryColorSelect: { text: "Основной цвет" },
79
79
  timePicker: {
80
80
  text: "Выбрать время",
81
81
  placeholder: "Время не выбрано",
82
82
  clear: "Очистить",
83
- hour: "Часы",
84
- minute: "Минуты",
83
+ hour: "Час",
84
+ minute: "Минута",
85
85
  period: "Период",
86
86
  selectedTime: "Выбранное время",
87
87
  switchTo12h: "12ч",
package/package.json CHANGED
@@ -47,5 +47,5 @@
47
47
  "svelte": "./dist/lib/index.js",
48
48
  "type": "module",
49
49
  "types": "./dist/lib/index.d.ts",
50
- "version": "1.1.4"
50
+ "version": "1.1.5"
51
51
  }