rails_modal_manager 1.0.13 → 1.0.14

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3aef02a89c60f4390647bdb318057751ef19caea49b2849ab1af859412267d54
4
- data.tar.gz: aafa0a2b8165398b4f91dcb5ea3e3b013433550b227a0c6e0a5df9c6f2840b15
3
+ metadata.gz: b5a9a0c23b9c295ce794dca604668be79268eab2b0ef9aa3a72bce9f31642d37
4
+ data.tar.gz: f341afe4a3bcf1661a80a60fbbd8ad2c34b187f6fe15d04df16c57f9273bafdc
5
5
  SHA512:
6
- metadata.gz: f5e26d4b12715b984126fa2a4262a56e9f23a238fdc68c5c89c7179c159b7abb36fe93cb789be1f834ba51d720ace3bf66f24aa4a65266433ab166f8b30f68ad
7
- data.tar.gz: af75896852ef1fc10956a6b8d305da635e074655dff95082234999de0b43ff379b58c22e5d39190007e28858af0e14819f57a67177de7841a34200c779491d5c
6
+ metadata.gz: 4213097d0638e6e1656a3bab74608e7ab6adcc1aa521532fefbb0fc74e8d248d0e6a5a672f60f9d7a1b0a7a3dd345acdf6f5112ec74ea8a7a97fc3762cc8f913
7
+ data.tar.gz: 5c9bd6533b30f62eae37e28d6ae6532ed7942f74cb45d8d62db8dc6d31c35797322fb83db2e9c258599ef0b78c8ee16f565ae827bc2080a329019719c2a30e56
@@ -1109,6 +1109,7 @@
1109
1109
  white-space: nowrap;
1110
1110
  cursor: pointer;
1111
1111
  transition: background-color 0.15s;
1112
+ user-select: none;
1112
1113
  }
1113
1114
 
1114
1115
  .rmm-taskbar-item:hover {
@@ -502,6 +502,10 @@ export default class extends Controller {
502
502
  if (!config || config.isMaximized) return
503
503
 
504
504
  modalStore.bringToFront(this.effectiveModalId)
505
+ // 히스토리 스택 순서도 동기화
506
+ if (this.enableHistoryStackValue) {
507
+ historyStackManager.moveToTop('modal', this.effectiveModalId)
508
+ }
505
509
  this.isDragging = true
506
510
 
507
511
  const clientX = e.type.includes('touch') ? e.touches[0].clientX : e.clientX
@@ -565,6 +569,10 @@ export default class extends Controller {
565
569
  if (!config || config.isMaximized) return
566
570
 
567
571
  modalStore.bringToFront(this.effectiveModalId)
572
+ // 히스토리 스택 순서도 동기화
573
+ if (this.enableHistoryStackValue) {
574
+ historyStackManager.moveToTop('modal', this.effectiveModalId)
575
+ }
568
576
  this.isResizing = true
569
577
  this.resizeDirection = direction
570
578
 
@@ -798,6 +806,10 @@ export default class extends Controller {
798
806
 
799
807
  handleClick() {
800
808
  modalStore.bringToFront(this.effectiveModalId)
809
+ // 히스토리 스택 순서도 동기화 (뒤로가기 시 현재 최상위 모달이 닫히도록)
810
+ if (this.enableHistoryStackValue) {
811
+ historyStackManager.moveToTop('modal', this.effectiveModalId)
812
+ }
801
813
  }
802
814
 
803
815
  // ============================================
@@ -31,6 +31,11 @@ export default class extends Controller {
31
31
  connect() {
32
32
  this.currentItemId = null
33
33
 
34
+ // 모바일 사이즈(768px 미만)에서는 기본적으로 사이드바를 닫힌 상태로 시작
35
+ if (window.innerWidth < 768) {
36
+ this.collapsedValue = true
37
+ }
38
+
34
39
  if (this.collapsedValue) {
35
40
  this.element.classList.add('rmm-sidebar-collapsed')
36
41
  }
@@ -285,6 +285,37 @@ function hasHisData(type, id) {
285
285
  return hisData.some((item) => item.type === type && item.id === id);
286
286
  }
287
287
 
288
+ /**
289
+ * Move specific item to the top of the history stack
290
+ * - Used when a modal is brought to front (clicked/focused)
291
+ * - Does not affect browser history, only reorders the internal stack
292
+ *
293
+ * @param {string} type - Target type
294
+ * @param {string} id - Target's unique ID
295
+ * @returns {boolean} Whether move was successful
296
+ */
297
+ function moveToTop(type, id) {
298
+ if (typeof window === 'undefined') return false;
299
+ if (!isEnabledForDevice(type)) return false;
300
+
301
+ const hisData = loadHisData();
302
+ const index = hisData.findIndex(
303
+ (item) => item.type === type && item.id === id
304
+ );
305
+
306
+ if (index === -1) return false;
307
+
308
+ // Already at top
309
+ if (index === hisData.length - 1) return true;
310
+
311
+ // Remove item from current position and add to end
312
+ const [item] = hisData.splice(index, 1);
313
+ hisData.push(item);
314
+ saveHisData(hisData);
315
+
316
+ return true;
317
+ }
318
+
288
319
  /**
289
320
  * Return current stack size
290
321
  * @returns {number} Stack size
@@ -362,6 +393,7 @@ const historyStackManager = {
362
393
  removeMultipleHisData,
363
394
  silentRemoveHisData,
364
395
  popHisData,
396
+ moveToTop,
365
397
 
366
398
  // Utilities
367
399
  hasHisData,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsModalManager
4
- VERSION = "1.0.13"
4
+ VERSION = "1.0.14"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_modal_manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.13
4
+ version: 1.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - reshacs