ide-assi 0.557.0 → 0.559.0

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.
@@ -202994,11 +202994,11 @@ class IdeLoadingTips extends HTMLElement {
202994
202994
  this.#currentTipIndex = Math.floor(Math.random() * this.#tips.length);
202995
202995
  this.stopTips(); // Stop any existing intervals before starting new ones
202996
202996
 
202997
- this.showCurrentTip(); // Display the first tip immediately
202997
+ this.showRandomTip(); // Display the first tip immediately
202998
202998
 
202999
202999
  // Start interval for cycling through tips
203000
203000
  this.#tipIntervalId = setInterval(() => {
203001
- this.showNextTip();
203001
+ this.showRandomTip();
203002
203002
  }, this.#tipDisplayDuration);
203003
203003
 
203004
203004
  //this.loadingAnimation.style.display = 'block'; // Show the loading spinner
@@ -203031,48 +203031,69 @@ class IdeLoadingTips extends HTMLElement {
203031
203031
  }
203032
203032
 
203033
203033
  /**
203034
- * Advances to the next tip and calls showCurrentTip() to display it.
203034
+ * Displays the current tip's text and manages its associated images.
203035
203035
  */
203036
- showNextTip() {
203037
- this.#currentTipIndex = (this.#currentTipIndex + 1) % this.#tips.length;
203038
- this.showCurrentTip();
203039
- }
203036
+ // aiLoadingTips.js (showCurrentTip 메서드 내부)
203040
203037
 
203041
203038
  /**
203042
- * Displays the current tip's text and manages its associated images.
203039
+ * Displays a randomly selected tip (excluding the currently displayed one if possible)
203040
+ * and manages its associated images.
203043
203041
  */
203044
- showCurrentTip() {
203042
+ showRandomTip() {
203043
+ if (this.#tips.length === 0) {
203044
+ this.tipElement.textContent = "";
203045
+ this.tipImageElement.style.display = 'none';
203046
+ this.tipImageContainer.style.display = 'none';
203047
+ return;
203048
+ }
203049
+
203050
+ let nextIndex = this.#currentTipIndex; // 초기값을 현재 인덱스로 설정
203051
+ const maxAttempts = 3; // 최대 시도 횟수
203052
+
203053
+ // 팁이 1개 초과인 경우에만 다른 팁을 찾으려고 시도합니다.
203054
+ // 팁이 하나뿐이거나 없으면 아래 루프에 들어가지 않으므로,
203055
+ // nextIndex는 초기값인 currentTipIndex (0이 될 가능성 높음)를 유지합니다.
203056
+ if (this.#tips.length > 1) {
203057
+ for (let i = 0; i < maxAttempts; i++) {
203058
+ const potentialNextIndex = Math.floor(Math.random() * this.#tips.length);
203059
+ if (potentialNextIndex !== this.#currentTipIndex) {
203060
+ nextIndex = potentialNextIndex;
203061
+ break; // 다른 팁을 찾으면 루프 종료
203062
+ }
203063
+ }
203064
+ }
203065
+ // 이전에 있던 'else { nextIndex = 0; }' 블록이 제거되었습니다.
203066
+ // 팁이 1개일 경우, if (this.#tips.length > 1) 조건에 걸리지 않고
203067
+ // nextIndex는 그대로 this.#currentTipIndex (대부분 0)를 유지하게 됩니다.
203068
+
203069
+ this.#currentTipIndex = nextIndex; // 최종 결정된 인덱스를 currentTipIndex에 할당
203070
+
203045
203071
  const currentTip = this.#tips[this.#currentTipIndex];
203046
203072
 
203047
203073
  if (this.tipElement && currentTip) {
203048
- //this.tipElement.textContent = currentTip.text;
203049
203074
  this.tipElement.innerHTML = currentTip.text;
203050
203075
 
203051
- // Clear any existing image cycling interval for the previous tip
203052
203076
  if (this.#imageIntervalId) {
203053
203077
  clearInterval(this.#imageIntervalId);
203054
203078
  this.#imageIntervalId = null;
203055
203079
  }
203056
203080
 
203057
- // Image handling logic
203058
203081
  if (currentTip.images && currentTip.images.length > 0) {
203059
- this.#currentImageIndex = 0; // Reset image index for the new tip
203082
+ this.#currentImageIndex = 0;
203060
203083
  this.showCurrentImage(currentTip.images[this.#currentImageIndex]);
203061
- this.tipImageElement.style.display = 'block'; // Show the image
203062
- this.tipImageContainer.style.display = 'flex'; // Show the image container
203084
+ this.tipImageElement.style.display = 'block';
203085
+ this.tipImageContainer.style.display = 'flex';
203063
203086
 
203064
203087
  if (currentTip.images.length > 1) {
203065
- // If there's more than one image, start cycling through them
203066
203088
  this.#imageIntervalId = setInterval(() => {
203067
203089
  this.#currentImageIndex = (this.#currentImageIndex + 1) % currentTip.images.length;
203068
203090
  this.showCurrentImage(currentTip.images[this.#currentImageIndex]);
203069
203091
  }, this.#imageDisplayDuration);
203070
203092
  }
203071
203093
  } else {
203072
- // If no images are provided for this tip, hide the image elements
203073
203094
  this.tipImageElement.style.display = 'none';
203074
203095
  this.tipImageContainer.style.display = 'none';
203075
- this.tipImageElement.src = ''; // Clear image source
203096
+ this.tipImageElement.src = '';
203076
203097
  }
203077
203098
  }
203078
203099
  }
@@ -202990,11 +202990,11 @@ class IdeLoadingTips extends HTMLElement {
202990
202990
  this.#currentTipIndex = Math.floor(Math.random() * this.#tips.length);
202991
202991
  this.stopTips(); // Stop any existing intervals before starting new ones
202992
202992
 
202993
- this.showCurrentTip(); // Display the first tip immediately
202993
+ this.showRandomTip(); // Display the first tip immediately
202994
202994
 
202995
202995
  // Start interval for cycling through tips
202996
202996
  this.#tipIntervalId = setInterval(() => {
202997
- this.showNextTip();
202997
+ this.showRandomTip();
202998
202998
  }, this.#tipDisplayDuration);
202999
202999
 
203000
203000
  //this.loadingAnimation.style.display = 'block'; // Show the loading spinner
@@ -203027,48 +203027,69 @@ class IdeLoadingTips extends HTMLElement {
203027
203027
  }
203028
203028
 
203029
203029
  /**
203030
- * Advances to the next tip and calls showCurrentTip() to display it.
203030
+ * Displays the current tip's text and manages its associated images.
203031
203031
  */
203032
- showNextTip() {
203033
- this.#currentTipIndex = (this.#currentTipIndex + 1) % this.#tips.length;
203034
- this.showCurrentTip();
203035
- }
203032
+ // aiLoadingTips.js (showCurrentTip 메서드 내부)
203036
203033
 
203037
203034
  /**
203038
- * Displays the current tip's text and manages its associated images.
203035
+ * Displays a randomly selected tip (excluding the currently displayed one if possible)
203036
+ * and manages its associated images.
203039
203037
  */
203040
- showCurrentTip() {
203038
+ showRandomTip() {
203039
+ if (this.#tips.length === 0) {
203040
+ this.tipElement.textContent = "";
203041
+ this.tipImageElement.style.display = 'none';
203042
+ this.tipImageContainer.style.display = 'none';
203043
+ return;
203044
+ }
203045
+
203046
+ let nextIndex = this.#currentTipIndex; // 초기값을 현재 인덱스로 설정
203047
+ const maxAttempts = 3; // 최대 시도 횟수
203048
+
203049
+ // 팁이 1개 초과인 경우에만 다른 팁을 찾으려고 시도합니다.
203050
+ // 팁이 하나뿐이거나 없으면 아래 루프에 들어가지 않으므로,
203051
+ // nextIndex는 초기값인 currentTipIndex (0이 될 가능성 높음)를 유지합니다.
203052
+ if (this.#tips.length > 1) {
203053
+ for (let i = 0; i < maxAttempts; i++) {
203054
+ const potentialNextIndex = Math.floor(Math.random() * this.#tips.length);
203055
+ if (potentialNextIndex !== this.#currentTipIndex) {
203056
+ nextIndex = potentialNextIndex;
203057
+ break; // 다른 팁을 찾으면 루프 종료
203058
+ }
203059
+ }
203060
+ }
203061
+ // 이전에 있던 'else { nextIndex = 0; }' 블록이 제거되었습니다.
203062
+ // 팁이 1개일 경우, if (this.#tips.length > 1) 조건에 걸리지 않고
203063
+ // nextIndex는 그대로 this.#currentTipIndex (대부분 0)를 유지하게 됩니다.
203064
+
203065
+ this.#currentTipIndex = nextIndex; // 최종 결정된 인덱스를 currentTipIndex에 할당
203066
+
203041
203067
  const currentTip = this.#tips[this.#currentTipIndex];
203042
203068
 
203043
203069
  if (this.tipElement && currentTip) {
203044
- //this.tipElement.textContent = currentTip.text;
203045
203070
  this.tipElement.innerHTML = currentTip.text;
203046
203071
 
203047
- // Clear any existing image cycling interval for the previous tip
203048
203072
  if (this.#imageIntervalId) {
203049
203073
  clearInterval(this.#imageIntervalId);
203050
203074
  this.#imageIntervalId = null;
203051
203075
  }
203052
203076
 
203053
- // Image handling logic
203054
203077
  if (currentTip.images && currentTip.images.length > 0) {
203055
- this.#currentImageIndex = 0; // Reset image index for the new tip
203078
+ this.#currentImageIndex = 0;
203056
203079
  this.showCurrentImage(currentTip.images[this.#currentImageIndex]);
203057
- this.tipImageElement.style.display = 'block'; // Show the image
203058
- this.tipImageContainer.style.display = 'flex'; // Show the image container
203080
+ this.tipImageElement.style.display = 'block';
203081
+ this.tipImageContainer.style.display = 'flex';
203059
203082
 
203060
203083
  if (currentTip.images.length > 1) {
203061
- // If there's more than one image, start cycling through them
203062
203084
  this.#imageIntervalId = setInterval(() => {
203063
203085
  this.#currentImageIndex = (this.#currentImageIndex + 1) % currentTip.images.length;
203064
203086
  this.showCurrentImage(currentTip.images[this.#currentImageIndex]);
203065
203087
  }, this.#imageDisplayDuration);
203066
203088
  }
203067
203089
  } else {
203068
- // If no images are provided for this tip, hide the image elements
203069
203090
  this.tipImageElement.style.display = 'none';
203070
203091
  this.tipImageContainer.style.display = 'none';
203071
- this.tipImageElement.src = ''; // Clear image source
203092
+ this.tipImageElement.src = '';
203072
203093
  }
203073
203094
  }
203074
203095
  }
@@ -99,11 +99,11 @@ class IdeLoadingTips extends HTMLElement {
99
99
  this.#currentTipIndex = Math.floor(Math.random() * this.#tips.length);
100
100
  this.stopTips(); // Stop any existing intervals before starting new ones
101
101
 
102
- this.showCurrentTip(); // Display the first tip immediately
102
+ this.showRandomTip(); // Display the first tip immediately
103
103
 
104
104
  // Start interval for cycling through tips
105
105
  this.#tipIntervalId = setInterval(() => {
106
- this.showNextTip();
106
+ this.showRandomTip();
107
107
  }, this.#tipDisplayDuration);
108
108
 
109
109
  //this.loadingAnimation.style.display = 'block'; // Show the loading spinner
@@ -136,48 +136,69 @@ class IdeLoadingTips extends HTMLElement {
136
136
  }
137
137
 
138
138
  /**
139
- * Advances to the next tip and calls showCurrentTip() to display it.
139
+ * Displays the current tip's text and manages its associated images.
140
140
  */
141
- showNextTip() {
142
- this.#currentTipIndex = (this.#currentTipIndex + 1) % this.#tips.length;
143
- this.showCurrentTip();
144
- }
141
+ // aiLoadingTips.js (showCurrentTip 메서드 내부)
145
142
 
146
143
  /**
147
- * Displays the current tip's text and manages its associated images.
144
+ * Displays a randomly selected tip (excluding the currently displayed one if possible)
145
+ * and manages its associated images.
148
146
  */
149
- showCurrentTip() {
147
+ showRandomTip() {
148
+ if (this.#tips.length === 0) {
149
+ this.tipElement.textContent = "";
150
+ this.tipImageElement.style.display = 'none';
151
+ this.tipImageContainer.style.display = 'none';
152
+ return;
153
+ }
154
+
155
+ let nextIndex = this.#currentTipIndex; // 초기값을 현재 인덱스로 설정
156
+ const maxAttempts = 3; // 최대 시도 횟수
157
+
158
+ // 팁이 1개 초과인 경우에만 다른 팁을 찾으려고 시도합니다.
159
+ // 팁이 하나뿐이거나 없으면 아래 루프에 들어가지 않으므로,
160
+ // nextIndex는 초기값인 currentTipIndex (0이 될 가능성 높음)를 유지합니다.
161
+ if (this.#tips.length > 1) {
162
+ for (let i = 0; i < maxAttempts; i++) {
163
+ const potentialNextIndex = Math.floor(Math.random() * this.#tips.length);
164
+ if (potentialNextIndex !== this.#currentTipIndex) {
165
+ nextIndex = potentialNextIndex;
166
+ break; // 다른 팁을 찾으면 루프 종료
167
+ }
168
+ }
169
+ }
170
+ // 이전에 있던 'else { nextIndex = 0; }' 블록이 제거되었습니다.
171
+ // 팁이 1개일 경우, if (this.#tips.length > 1) 조건에 걸리지 않고
172
+ // nextIndex는 그대로 this.#currentTipIndex (대부분 0)를 유지하게 됩니다.
173
+
174
+ this.#currentTipIndex = nextIndex; // 최종 결정된 인덱스를 currentTipIndex에 할당
175
+
150
176
  const currentTip = this.#tips[this.#currentTipIndex];
151
177
 
152
178
  if (this.tipElement && currentTip) {
153
- //this.tipElement.textContent = currentTip.text;
154
179
  this.tipElement.innerHTML = currentTip.text;
155
180
 
156
- // Clear any existing image cycling interval for the previous tip
157
181
  if (this.#imageIntervalId) {
158
182
  clearInterval(this.#imageIntervalId);
159
183
  this.#imageIntervalId = null;
160
184
  }
161
185
 
162
- // Image handling logic
163
186
  if (currentTip.images && currentTip.images.length > 0) {
164
- this.#currentImageIndex = 0; // Reset image index for the new tip
187
+ this.#currentImageIndex = 0;
165
188
  this.showCurrentImage(currentTip.images[this.#currentImageIndex]);
166
- this.tipImageElement.style.display = 'block'; // Show the image
167
- this.tipImageContainer.style.display = 'flex'; // Show the image container
189
+ this.tipImageElement.style.display = 'block';
190
+ this.tipImageContainer.style.display = 'flex';
168
191
 
169
192
  if (currentTip.images.length > 1) {
170
- // If there's more than one image, start cycling through them
171
193
  this.#imageIntervalId = setInterval(() => {
172
194
  this.#currentImageIndex = (this.#currentImageIndex + 1) % currentTip.images.length;
173
195
  this.showCurrentImage(currentTip.images[this.#currentImageIndex]);
174
196
  }, this.#imageDisplayDuration);
175
197
  }
176
198
  } else {
177
- // If no images are provided for this tip, hide the image elements
178
199
  this.tipImageElement.style.display = 'none';
179
200
  this.tipImageContainer.style.display = 'none';
180
- this.tipImageElement.src = ''; // Clear image source
201
+ this.tipImageElement.src = '';
181
202
  }
182
203
  }
183
204
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ide-assi",
3
3
  "type": "module",
4
- "version": "0.557.0",
4
+ "version": "0.559.0",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {
@@ -99,11 +99,11 @@ class IdeLoadingTips extends HTMLElement {
99
99
  this.#currentTipIndex = Math.floor(Math.random() * this.#tips.length);
100
100
  this.stopTips(); // Stop any existing intervals before starting new ones
101
101
 
102
- this.showCurrentTip(); // Display the first tip immediately
102
+ this.showRandomTip(); // Display the first tip immediately
103
103
 
104
104
  // Start interval for cycling through tips
105
105
  this.#tipIntervalId = setInterval(() => {
106
- this.showNextTip();
106
+ this.showRandomTip();
107
107
  }, this.#tipDisplayDuration);
108
108
 
109
109
  //this.loadingAnimation.style.display = 'block'; // Show the loading spinner
@@ -136,48 +136,69 @@ class IdeLoadingTips extends HTMLElement {
136
136
  }
137
137
 
138
138
  /**
139
- * Advances to the next tip and calls showCurrentTip() to display it.
139
+ * Displays the current tip's text and manages its associated images.
140
140
  */
141
- showNextTip() {
142
- this.#currentTipIndex = (this.#currentTipIndex + 1) % this.#tips.length;
143
- this.showCurrentTip();
144
- }
141
+ // aiLoadingTips.js (showCurrentTip 메서드 내부)
145
142
 
146
143
  /**
147
- * Displays the current tip's text and manages its associated images.
144
+ * Displays a randomly selected tip (excluding the currently displayed one if possible)
145
+ * and manages its associated images.
148
146
  */
149
- showCurrentTip() {
147
+ showRandomTip() {
148
+ if (this.#tips.length === 0) {
149
+ this.tipElement.textContent = "";
150
+ this.tipImageElement.style.display = 'none';
151
+ this.tipImageContainer.style.display = 'none';
152
+ return;
153
+ }
154
+
155
+ let nextIndex = this.#currentTipIndex; // 초기값을 현재 인덱스로 설정
156
+ const maxAttempts = 3; // 최대 시도 횟수
157
+
158
+ // 팁이 1개 초과인 경우에만 다른 팁을 찾으려고 시도합니다.
159
+ // 팁이 하나뿐이거나 없으면 아래 루프에 들어가지 않으므로,
160
+ // nextIndex는 초기값인 currentTipIndex (0이 될 가능성 높음)를 유지합니다.
161
+ if (this.#tips.length > 1) {
162
+ for (let i = 0; i < maxAttempts; i++) {
163
+ const potentialNextIndex = Math.floor(Math.random() * this.#tips.length);
164
+ if (potentialNextIndex !== this.#currentTipIndex) {
165
+ nextIndex = potentialNextIndex;
166
+ break; // 다른 팁을 찾으면 루프 종료
167
+ }
168
+ }
169
+ }
170
+ // 이전에 있던 'else { nextIndex = 0; }' 블록이 제거되었습니다.
171
+ // 팁이 1개일 경우, if (this.#tips.length > 1) 조건에 걸리지 않고
172
+ // nextIndex는 그대로 this.#currentTipIndex (대부분 0)를 유지하게 됩니다.
173
+
174
+ this.#currentTipIndex = nextIndex; // 최종 결정된 인덱스를 currentTipIndex에 할당
175
+
150
176
  const currentTip = this.#tips[this.#currentTipIndex];
151
177
 
152
178
  if (this.tipElement && currentTip) {
153
- //this.tipElement.textContent = currentTip.text;
154
179
  this.tipElement.innerHTML = currentTip.text;
155
180
 
156
- // Clear any existing image cycling interval for the previous tip
157
181
  if (this.#imageIntervalId) {
158
182
  clearInterval(this.#imageIntervalId);
159
183
  this.#imageIntervalId = null;
160
184
  }
161
185
 
162
- // Image handling logic
163
186
  if (currentTip.images && currentTip.images.length > 0) {
164
- this.#currentImageIndex = 0; // Reset image index for the new tip
187
+ this.#currentImageIndex = 0;
165
188
  this.showCurrentImage(currentTip.images[this.#currentImageIndex]);
166
- this.tipImageElement.style.display = 'block'; // Show the image
167
- this.tipImageContainer.style.display = 'flex'; // Show the image container
189
+ this.tipImageElement.style.display = 'block';
190
+ this.tipImageContainer.style.display = 'flex';
168
191
 
169
192
  if (currentTip.images.length > 1) {
170
- // If there's more than one image, start cycling through them
171
193
  this.#imageIntervalId = setInterval(() => {
172
194
  this.#currentImageIndex = (this.#currentImageIndex + 1) % currentTip.images.length;
173
195
  this.showCurrentImage(currentTip.images[this.#currentImageIndex]);
174
196
  }, this.#imageDisplayDuration);
175
197
  }
176
198
  } else {
177
- // If no images are provided for this tip, hide the image elements
178
199
  this.tipImageElement.style.display = 'none';
179
200
  this.tipImageContainer.style.display = 'none';
180
- this.tipImageElement.src = ''; // Clear image source
201
+ this.tipImageElement.src = '';
181
202
  }
182
203
  }
183
204
  }