@skyservice-developers/vue-dev-kit 1.5.10 → 1.5.12

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skyservice-developers/vue-dev-kit",
3
- "version": "1.5.10",
3
+ "version": "1.5.12",
4
4
  "description": "Vue 2 and Vue 3 developer toolkit - components and helpers",
5
5
  "type": "module",
6
6
  "main": "./dist/vue3/vue-dev-kit.cjs",
@@ -78,3 +78,7 @@ export function getParentStoreValue(key) {
78
78
  export function getParentWindowValue(key) {
79
79
  return requestFromParent('window', key)
80
80
  }
81
+
82
+ export function setParentLocalStorage(key, value) {
83
+ sendToParent({ type: 'setLocalStorage', key, value })
84
+ }
@@ -71,7 +71,7 @@
71
71
 
72
72
  <script>
73
73
  import { isInIframe } from '../../shared/utils/webviewCheck'
74
- import { getParentLocalStorage, sendToParent, setSenderId, getSenderId } from '../../shared/utils/parentBridge'
74
+ import { getParentLocalStorage, setParentLocalStorage, sendToParent, setSenderId, getSenderId } from '../../shared/utils/parentBridge'
75
75
 
76
76
  export default {
77
77
  name: 'Header',
@@ -150,8 +150,12 @@ export default {
150
150
  }
151
151
 
152
152
  // Set rocketMode
153
- getParentLocalStorage('rocketMode').then((value) => {
153
+ getParentLocalStorage('rocketMode').then(async (value) => {
154
154
  this.previousRocketMode = value
155
+ const existingFallback = await getParentLocalStorage('fallbackRocketMode')
156
+ if (existingFallback === null) {
157
+ setParentLocalStorage('fallbackRocketMode', value === true || value === 'true' ? 'true' : 'false')
158
+ }
155
159
  sendToParent({ type: 'setRocketMode', value: true })
156
160
  })
157
161
 
@@ -80,7 +80,7 @@
80
80
  <script setup>
81
81
  import { ref, computed, onMounted, onUnmounted } from 'vue'
82
82
  import { isInIframe } from '../../shared/utils/webviewCheck'
83
- import { getParentLocalStorage, getParentWindowValue, sendToParent, setSenderId, getSenderId } from '../../shared/utils/parentBridge'
83
+ import { getParentLocalStorage, getParentWindowValue, setParentLocalStorage, sendToParent, setSenderId, getSenderId } from '../../shared/utils/parentBridge'
84
84
 
85
85
  const props = defineProps({
86
86
  title: {
@@ -153,8 +153,12 @@ if (isInIframe() && props.trackPageName) {
153
153
  const previousRocketMode = ref(null)
154
154
 
155
155
  if (isInIframe()) {
156
- getParentLocalStorage('rocketMode').then((value) => {
156
+ getParentLocalStorage('rocketMode').then(async (value) => {
157
157
  previousRocketMode.value = value
158
+ const existingFallback = await getParentLocalStorage('fallbackRocketMode')
159
+ if (existingFallback === null) {
160
+ setParentLocalStorage('fallbackRocketMode', value === true || value === 'true' ? 'true' : 'false')
161
+ }
158
162
  sendToParent({ type: 'setRocketMode', value: true })
159
163
  })
160
164
  }
@@ -3,7 +3,7 @@
3
3
  <div
4
4
  v-if="modelValue"
5
5
  class="sky-modal-overlay"
6
- @click.self="handleOverlayClick"
6
+ @mousedown.self="handleOverlayClick"
7
7
  >
8
8
  <div class="sky-modal" :style="modalStyle">
9
9
  <div class="sky-modal-header">
@@ -21,94 +21,34 @@
21
21
  >
22
22
  {{ selectedOption ? selectedOption.label : placeholder }}
23
23
  </span>
24
- <svg
25
- class="sky-select-chevron"
26
- viewBox="0 0 16 16"
27
- fill="none"
28
- aria-hidden="true"
29
- >
30
- <path
31
- d="M4 6l4 4 4-4"
32
- stroke="currentColor"
33
- stroke-width="1.5"
34
- stroke-linecap="round"
35
- stroke-linejoin="round"
36
- />
24
+ <svg class="sky-select-chevron" viewBox="0 0 16 16" fill="none" aria-hidden="true">
25
+ <path d="M4 6l4 4 4-4" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
37
26
  </svg>
38
27
  </button>
39
28
 
40
- <template v-if="open">
41
- <Teleport v-if="teleport" to="body">
42
- <div
43
- class="sky-select-dropdown sky-select-dropdown-teleported"
44
- :style="dropdownStyle"
45
- >
46
- <div
47
- v-for="(option, idx) in normalizedOptions"
48
- :key="option.value"
49
- class="sky-select-option"
50
- :class="{
51
- 'sky-select-option-selected': option.value === modelValue,
52
- 'sky-select-option-focused': idx === focusedIdx,
53
- }"
54
- @click="select(option)"
55
- @mouseenter="focusedIdx = idx"
56
- >
57
- <span>{{ option.label }}</span>
58
- <svg
59
- v-if="option.value === modelValue"
60
- class="sky-select-check"
61
- viewBox="0 0 16 16"
62
- fill="none"
63
- aria-hidden="true"
64
- >
65
- <path
66
- d="M3 8l4 4 6-6"
67
- stroke="currentColor"
68
- stroke-width="1.5"
69
- stroke-linecap="round"
70
- stroke-linejoin="round"
71
- />
72
- </svg>
73
- </div>
74
- </div>
75
- </Teleport>
76
- <div v-else class="sky-select-dropdown">
77
- <div
78
- v-for="(option, idx) in normalizedOptions"
79
- :key="option.value"
80
- class="sky-select-option"
81
- :class="{
82
- 'sky-select-option-selected': option.value === modelValue,
83
- 'sky-select-option-focused': idx === focusedIdx,
84
- }"
85
- @click="select(option)"
86
- @mouseenter="focusedIdx = idx"
87
- >
88
- <span>{{ option.label }}</span>
89
- <svg
90
- v-if="option.value === modelValue"
91
- class="sky-select-check"
92
- viewBox="0 0 16 16"
93
- fill="none"
94
- aria-hidden="true"
95
- >
96
- <path
97
- d="M3 8l4 4 6-6"
98
- stroke="currentColor"
99
- stroke-width="1.5"
100
- stroke-linecap="round"
101
- stroke-linejoin="round"
102
- />
103
- </svg>
104
- </div>
29
+ <div v-if="open" class="sky-select-dropdown">
30
+ <div
31
+ v-for="(option, idx) in normalizedOptions"
32
+ :key="option.value"
33
+ class="sky-select-option"
34
+ :class="{
35
+ 'sky-select-option-selected': option.value === modelValue,
36
+ 'sky-select-option-focused': idx === focusedIdx,
37
+ }"
38
+ @click="select(option)"
39
+ @mouseenter="focusedIdx = idx"
40
+ >
41
+ <span>{{ option.label }}</span>
42
+ <svg v-if="option.value === modelValue" class="sky-select-check" viewBox="0 0 16 16" fill="none" aria-hidden="true">
43
+ <path d="M3 8l4 4 6-6" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
44
+ </svg>
105
45
  </div>
106
- </template>
46
+ </div>
107
47
  </div>
108
48
  </template>
109
49
 
110
50
  <script setup>
111
- import { ref, computed, onBeforeUnmount } from "vue";
51
+ import { ref, computed, onBeforeUnmount } from 'vue';
112
52
 
113
53
  const props = defineProps({
114
54
  modelValue: {
@@ -120,7 +60,7 @@ const props = defineProps({
120
60
  },
121
61
  placeholder: {
122
62
  type: String,
123
- default: "",
63
+ default: '',
124
64
  },
125
65
  disabled: {
126
66
  type: Boolean,
@@ -130,42 +70,24 @@ const props = defineProps({
130
70
  type: Boolean,
131
71
  default: false,
132
72
  },
133
- teleport: {
134
- type: Boolean,
135
- default: false,
136
- },
137
73
  });
138
74
 
139
- const emit = defineEmits(["update:modelValue"]);
75
+ const emit = defineEmits(['update:modelValue']);
140
76
 
141
77
  const root = ref(null);
142
78
  const open = ref(false);
143
79
  const focusedIdx = ref(-1);
144
- const dropdownStyle = ref({});
145
80
 
146
81
  const normalizedOptions = computed(() =>
147
82
  props.options.map((opt) =>
148
- typeof opt === "string" ? { label: opt, value: opt } : opt,
149
- ),
83
+ typeof opt === 'string' ? { label: opt, value: opt } : opt
84
+ )
150
85
  );
151
86
 
152
- const selectedOption = computed(
153
- () =>
154
- normalizedOptions.value.find((o) => o.value === props.modelValue) ?? null,
87
+ const selectedOption = computed(() =>
88
+ normalizedOptions.value.find((o) => o.value === props.modelValue) ?? null
155
89
  );
156
90
 
157
- function calcDropdownStyle() {
158
- if (!props.teleport || !root.value) return;
159
- const rect = root.value.getBoundingClientRect();
160
- dropdownStyle.value = {
161
- position: "fixed",
162
- top: `${rect.bottom + 4}px`,
163
- left: `${rect.left}px`,
164
- width: `${rect.width}px`,
165
- zIndex: "var(--sky-select-dropdown-z-index, 9999)",
166
- };
167
- }
168
-
169
91
  function toggle() {
170
92
  if (props.disabled) return;
171
93
  open.value ? close() : openDropdown();
@@ -173,26 +95,17 @@ function toggle() {
173
95
 
174
96
  function openDropdown() {
175
97
  open.value = true;
176
- focusedIdx.value = normalizedOptions.value.findIndex(
177
- (o) => o.value === props.modelValue,
178
- );
179
- calcDropdownStyle();
180
- document.addEventListener("mousedown", onOutsideClick);
181
- if (props.teleport) {
182
- window.addEventListener("scroll", onScrollOrResize, true);
183
- window.addEventListener("resize", onScrollOrResize);
184
- }
98
+ focusedIdx.value = normalizedOptions.value.findIndex((o) => o.value === props.modelValue);
99
+ document.addEventListener('mousedown', onOutsideClick);
185
100
  }
186
101
 
187
102
  function close() {
188
103
  open.value = false;
189
- document.removeEventListener("mousedown", onOutsideClick);
190
- window.removeEventListener("scroll", onScrollOrResize, true);
191
- window.removeEventListener("resize", onScrollOrResize);
104
+ document.removeEventListener('mousedown', onOutsideClick);
192
105
  }
193
106
 
194
107
  function select(option) {
195
- emit("update:modelValue", option.value);
108
+ emit('update:modelValue', option.value);
196
109
  close();
197
110
  }
198
111
 
@@ -200,40 +113,30 @@ function onOutsideClick(e) {
200
113
  if (!root.value?.contains(e.target)) close();
201
114
  }
202
115
 
203
- function onScrollOrResize() {
204
- calcDropdownStyle();
205
- }
206
-
207
116
  function onKeydown(e) {
208
117
  if (!open.value) {
209
- if (e.key === "Enter" || e.key === " ") {
118
+ if (e.key === 'Enter' || e.key === ' ') {
210
119
  e.preventDefault();
211
120
  openDropdown();
212
121
  }
213
122
  return;
214
123
  }
215
- if (e.key === "Escape") {
124
+ if (e.key === 'Escape') {
216
125
  close();
217
- } else if (e.key === "ArrowDown") {
126
+ } else if (e.key === 'ArrowDown') {
218
127
  e.preventDefault();
219
- focusedIdx.value = Math.min(
220
- focusedIdx.value + 1,
221
- normalizedOptions.value.length - 1,
222
- );
223
- } else if (e.key === "ArrowUp") {
128
+ focusedIdx.value = Math.min(focusedIdx.value + 1, normalizedOptions.value.length - 1);
129
+ } else if (e.key === 'ArrowUp') {
224
130
  e.preventDefault();
225
131
  focusedIdx.value = Math.max(focusedIdx.value - 1, 0);
226
- } else if (e.key === "Enter") {
132
+ } else if (e.key === 'Enter') {
227
133
  e.preventDefault();
228
- if (focusedIdx.value >= 0)
229
- select(normalizedOptions.value[focusedIdx.value]);
134
+ if (focusedIdx.value >= 0) select(normalizedOptions.value[focusedIdx.value]);
230
135
  }
231
136
  }
232
137
 
233
138
  onBeforeUnmount(() => {
234
- document.removeEventListener("mousedown", onOutsideClick);
235
- window.removeEventListener("scroll", onScrollOrResize, true);
236
- window.removeEventListener("resize", onScrollOrResize);
139
+ document.removeEventListener('mousedown', onOutsideClick);
237
140
  });
238
141
  </script>
239
142
 
@@ -333,17 +236,6 @@ onBeforeUnmount(() => {
333
236
  padding: 4px;
334
237
  }
335
238
 
336
- .sky-select-dropdown-teleported {
337
- position: fixed;
338
- background: var(--sky-select-dropdown-bg, #fff);
339
- border: var(--sky-select-dropdown-border, 1px solid #d1d5db);
340
- border-radius: var(--sky-select-dropdown-radius, 6px);
341
- box-shadow: var(--sky-select-dropdown-shadow, 0 4px 12px rgba(0, 0, 0, 0.1));
342
- max-height: var(--sky-select-dropdown-max-height, 220px);
343
- overflow-y: auto;
344
- padding: 4px;
345
- }
346
-
347
239
  /* Option */
348
240
  .sky-select-option {
349
241
  display: flex;