@globalbrain/sefirot 0.72.0 → 2.0.0-draft.4

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.
Files changed (175) hide show
  1. package/CHANGELOG.md +8 -808
  2. package/README.md +1 -1
  3. package/lib/assets/styles/bootstrap.css +1 -2
  4. package/lib/assets/styles/variables.css +14 -47
  5. package/lib/components/SAvatar.vue +9 -18
  6. package/lib/components/SButton.vue +35 -48
  7. package/lib/components/SDialog.vue +16 -34
  8. package/lib/components/SDropdown.vue +36 -55
  9. package/lib/components/SDropdownItem.vue +27 -39
  10. package/lib/components/SDropdownItemText.vue +4 -9
  11. package/lib/components/SDropdownItemUser.vue +4 -12
  12. package/lib/components/SInputBase.vue +33 -45
  13. package/lib/components/SInputCheckbox.vue +17 -37
  14. package/lib/components/SInputDropdown.vue +109 -171
  15. package/lib/components/SInputDropdownItem.vue +26 -32
  16. package/lib/components/SInputDropdownItemText.vue +6 -11
  17. package/lib/components/SInputDropdownItemTextTag.vue +10 -17
  18. package/lib/components/SInputDropdownItemUser.vue +5 -13
  19. package/lib/components/SInputDropdownItemUserTag.vue +9 -16
  20. package/lib/components/SInputFile.vue +38 -53
  21. package/lib/components/SInputHMS.vue +91 -114
  22. package/lib/components/SInputNumber.vue +27 -106
  23. package/lib/components/SInputRadio.vue +21 -34
  24. package/lib/components/SInputRadios.vue +36 -46
  25. package/lib/components/SInputText.vue +72 -628
  26. package/lib/components/SInputTextarea.vue +54 -113
  27. package/lib/components/SInputYMD.vue +94 -105
  28. package/lib/components/SLink.vue +16 -52
  29. package/lib/components/SModal.vue +39 -98
  30. package/lib/components/SPortalModals.vue +37 -54
  31. package/lib/components/SPortalSnackbars.vue +9 -24
  32. package/lib/components/SSheet.vue +73 -28
  33. package/lib/components/SSheetFooter.vue +5 -3
  34. package/lib/components/SSheetFooterAction.vue +10 -15
  35. package/lib/components/SSheetFooterActions.vue +2 -4
  36. package/lib/components/SSheetMedium.vue +14 -22
  37. package/lib/components/SSheetTitle.vue +20 -0
  38. package/lib/components/SSnackbar.vue +18 -28
  39. package/lib/composables/Dialog.ts +9 -17
  40. package/lib/composables/Dropdown.ts +2 -2
  41. package/lib/composables/{Menu.ts → Flyout.ts} +11 -4
  42. package/lib/composables/Form.ts +42 -44
  43. package/lib/composables/Modal.ts +11 -19
  44. package/lib/composables/Snackbar.ts +18 -0
  45. package/lib/composables/Validation.ts +28 -0
  46. package/lib/mixins/Sheet.ts +5 -7
  47. package/lib/store/Sefirot.ts +8 -13
  48. package/lib/store/dialog/index.ts +20 -10
  49. package/lib/store/modal/index.ts +11 -18
  50. package/lib/store/snackbars/index.ts +3 -4
  51. package/lib/support/{Util.ts → Utils.ts} +0 -2
  52. package/lib/types/Utils.ts +0 -7
  53. package/lib/types/vue-shims.d.ts +7 -0
  54. package/lib/validation/rules/checked.ts +6 -10
  55. package/lib/validation/rules/fileExtension.ts +9 -9
  56. package/lib/validation/rules/hms.ts +9 -9
  57. package/lib/validation/rules/index.ts +10 -74
  58. package/lib/validation/rules/maxLength.ts +10 -9
  59. package/lib/validation/rules/minLength.ts +12 -0
  60. package/lib/validation/rules/required.ts +2 -10
  61. package/lib/validation/rules/requiredHms.ts +11 -0
  62. package/lib/validation/rules/requiredIf.ts +3 -11
  63. package/lib/validation/rules/requiredYmd.ts +11 -0
  64. package/lib/validation/rules/ymd.ts +11 -0
  65. package/lib/validation/validators/checked.ts +1 -1
  66. package/lib/validation/validators/fileExtension.ts +1 -1
  67. package/lib/validation/validators/hms.ts +5 -5
  68. package/lib/validation/validators/requiredHms.ts +17 -0
  69. package/lib/validation/validators/requiredYmd.ts +7 -0
  70. package/lib/validation/validators/ymd.ts +41 -0
  71. package/package.json +45 -50
  72. package/lib/components/SAction.vue +0 -37
  73. package/lib/components/SActionAvatar.vue +0 -25
  74. package/lib/components/SActionButton.vue +0 -40
  75. package/lib/components/SActionPill.vue +0 -35
  76. package/lib/components/SActionSwitch.vue +0 -37
  77. package/lib/components/SAlert.vue +0 -145
  78. package/lib/components/SButtonGroup.vue +0 -160
  79. package/lib/components/SCard.vue +0 -111
  80. package/lib/components/SCardFooter.vue +0 -74
  81. package/lib/components/SCardHeader.vue +0 -213
  82. package/lib/components/SGrid.vue +0 -237
  83. package/lib/components/SGridActionLink.vue +0 -53
  84. package/lib/components/SGridActionMulti.vue +0 -139
  85. package/lib/components/SGridActionSingle.vue +0 -64
  86. package/lib/components/SHeader.vue +0 -180
  87. package/lib/components/SInputCheckboxes.vue +0 -87
  88. package/lib/components/SInputDate.vue +0 -192
  89. package/lib/components/SInputDay.vue +0 -87
  90. package/lib/components/SInputMonth.vue +0 -86
  91. package/lib/components/SInputSelect.vue +0 -298
  92. package/lib/components/SInputSwitch.vue +0 -212
  93. package/lib/components/SInputSwitches.vue +0 -108
  94. package/lib/components/SInputTime.vue +0 -255
  95. package/lib/components/SInputYear.vue +0 -60
  96. package/lib/components/SMarkdown.vue +0 -56
  97. package/lib/components/SPlaceholderBlank.vue +0 -113
  98. package/lib/components/SPlaceholderImage.vue +0 -83
  99. package/lib/components/SPortalScreens.vue +0 -62
  100. package/lib/components/SProgressBar.vue +0 -89
  101. package/lib/components/SResponsive.vue +0 -46
  102. package/lib/components/SScreen.vue +0 -81
  103. package/lib/components/SSheetHeader.vue +0 -75
  104. package/lib/components/SSheetHeaderTitle.vue +0 -17
  105. package/lib/components/SStep.vue +0 -107
  106. package/lib/components/SSteps.vue +0 -75
  107. package/lib/components/STag.vue +0 -67
  108. package/lib/components/STooltip.vue +0 -134
  109. package/lib/components/SWindow.vue +0 -158
  110. package/lib/components/icons/SIconCopy.vue +0 -6
  111. package/lib/composables/Action.ts +0 -141
  112. package/lib/composables/Alert.ts +0 -50
  113. package/lib/composables/Card.ts +0 -46
  114. package/lib/composables/FormValidation.ts +0 -150
  115. package/lib/composables/Header.ts +0 -72
  116. package/lib/composables/InputDropdown.ts +0 -6
  117. package/lib/composables/Markdown.ts +0 -138
  118. package/lib/composables/Router.ts +0 -20
  119. package/lib/composables/Step.ts +0 -7
  120. package/lib/composables/Store.ts +0 -9
  121. package/lib/composables/Tag.ts +0 -32
  122. package/lib/composables/Tooltip.ts +0 -91
  123. package/lib/composables/Utils.ts +0 -115
  124. package/lib/composables/markdown/LinkPlugin.ts +0 -45
  125. package/lib/compositions/useForm.ts +0 -17
  126. package/lib/compositions/useResizeObserver.ts +0 -25
  127. package/lib/compositions/useTime.ts +0 -26
  128. package/lib/store/alert/index.ts +0 -32
  129. package/lib/store/screen/index.ts +0 -46
  130. package/lib/types/v-calendar.d.ts +0 -5
  131. package/lib/validation/Validation.ts +0 -151
  132. package/lib/validation/rules/day.ts +0 -11
  133. package/lib/validation/rules/email.ts +0 -11
  134. package/lib/validation/rules/every.ts +0 -38
  135. package/lib/validation/rules/include.ts +0 -11
  136. package/lib/validation/rules/includeSome.ts +0 -11
  137. package/lib/validation/rules/integer.ts +0 -11
  138. package/lib/validation/rules/maxValue.ts +0 -11
  139. package/lib/validation/rules/minValue.ts +0 -11
  140. package/lib/validation/rules/month.ts +0 -11
  141. package/lib/validation/rules/not.ts +0 -10
  142. package/lib/validation/rules/regex.ts +0 -11
  143. package/lib/validation/rules/requiredHMS.ts +0 -11
  144. package/lib/validation/rules/requiredMonthDate.ts +0 -11
  145. package/lib/validation/rules/requiredYearMonth.ts +0 -11
  146. package/lib/validation/rules/requiredYearMonthDate.ts +0 -11
  147. package/lib/validation/rules/rule.ts +0 -5
  148. package/lib/validation/rules/sameAs.ts +0 -11
  149. package/lib/validation/rules/url.ts +0 -11
  150. package/lib/validation/rules/validateIf.ts +0 -27
  151. package/lib/validation/rules/year.ts +0 -11
  152. package/lib/validation/rules/yearMonth.ts +0 -11
  153. package/lib/validation/rules/yearMonthDate.ts +0 -11
  154. package/lib/validation/validators/day.ts +0 -29
  155. package/lib/validation/validators/email.ts +0 -5
  156. package/lib/validation/validators/include.ts +0 -5
  157. package/lib/validation/validators/includeSome.ts +0 -5
  158. package/lib/validation/validators/index.ts +0 -51
  159. package/lib/validation/validators/integer.ts +0 -6
  160. package/lib/validation/validators/maxLength.ts +0 -3
  161. package/lib/validation/validators/maxValue.ts +0 -3
  162. package/lib/validation/validators/minValue.ts +0 -3
  163. package/lib/validation/validators/month.ts +0 -3
  164. package/lib/validation/validators/monthDate.ts +0 -20
  165. package/lib/validation/validators/regex.ts +0 -3
  166. package/lib/validation/validators/required.ts +0 -27
  167. package/lib/validation/validators/requiredHMS.ts +0 -17
  168. package/lib/validation/validators/requiredMonthDate.ts +0 -8
  169. package/lib/validation/validators/requiredYearMonth.ts +0 -8
  170. package/lib/validation/validators/requiredYearMonthDate.ts +0 -9
  171. package/lib/validation/validators/sameAs.ts +0 -5
  172. package/lib/validation/validators/url.ts +0 -5
  173. package/lib/validation/validators/year.ts +0 -3
  174. package/lib/validation/validators/yearMonth.ts +0 -20
  175. package/lib/validation/validators/yearMonthDate.ts +0 -21
@@ -1,255 +0,0 @@
1
- <template>
2
- <SInputBase
3
- class="SInputTime"
4
- :name="name"
5
- :label="label"
6
- :note="note"
7
- :help="help"
8
- :validation="validation"
9
- >
10
- <div class="box">
11
- <input
12
- :id="name"
13
- ref="input"
14
- class="input"
15
- :value="value"
16
- placeholder="HH:MM"
17
- @click.stop
18
- @blur="handleBlur"
19
- @focus="openSelector"
20
- >
21
-
22
- <transition name="fade">
23
- <div v-if="on" class="selectors" @click.stop>
24
- <div class="selector hours">
25
- <div class="title">HOUR</div>
26
- <div class="values">
27
- <button
28
- v-for="hour in hours"
29
- :key="hour"
30
- class="value"
31
- :class="{ active: hValue === hour }"
32
- @click="setHour(hour)"
33
- >
34
- {{ hour }}
35
- </button>
36
- </div>
37
- </div>
38
-
39
- <div class="selector minutes">
40
- <div class="title">MIN</div>
41
- <div class="values">
42
- <button
43
- v-for="minute in minutes"
44
- :key="minute"
45
- class="value"
46
- :class="{ active: mValue === minute }"
47
- @click="setMin(minute)"
48
- >
49
- {{ minute }}
50
- </button>
51
- </div>
52
- </div>
53
- </div>
54
- </transition>
55
- </div>
56
- </SInputBase>
57
- </template>
58
-
59
- <script lang="ts">
60
- import { defineComponent, ref, computed, onMounted, onUnmounted, PropType } from '@vue/composition-api'
61
- import useTime from '../compositions/useTime'
62
- import { SyntheticInputEvent } from '../types/Utils'
63
- import { Validation } from '../validation/Validation'
64
- import SInputBase from './SInputBase.vue'
65
-
66
- export default defineComponent({
67
- components: {
68
- SInputBase
69
- },
70
-
71
- model: {
72
- prop: 'value',
73
- event: 'change'
74
- },
75
-
76
- props: {
77
- name: { type: String, default: null },
78
- label: { type: String, default: null },
79
- note: { type: String, default: null },
80
- help: { type: String, default: null },
81
- value: { type: String, default: null },
82
- validation: { type: Object as PropType<Validation>, default: null }
83
- },
84
-
85
- setup(props, { emit }) {
86
- const input = ref<HTMLInputElement | null>(null)
87
-
88
- const on = ref(false)
89
-
90
- const { hours, minutes } = useTime()
91
-
92
- const values = computed(() => props.value ? props.value.split(':') : '00:00'.split(':'))
93
- const hValue = computed(() => values.value[0])
94
- const mValue = computed(() => values.value[1])
95
-
96
- onMounted(() => {
97
- window.addEventListener('click', closeSelector)
98
- })
99
-
100
- onUnmounted(() => {
101
- window.removeEventListener('click', closeSelector)
102
- })
103
-
104
- function openSelector(): void {
105
- on.value = true
106
- }
107
-
108
- function closeSelector(): void {
109
- on.value = false
110
- }
111
-
112
- function handleBlur(e: SyntheticInputEvent): void {
113
- let value: string | null = e.target.value
114
-
115
- if (!value) {
116
- value = null
117
- } else if (!value.match(/^[0-2][0-3]:[0-5][0-9]$/)) {
118
- value = [hValue.value, mValue.value].join(':')
119
- }
120
-
121
- emit('change', value)
122
- updateInput(value ?? '')
123
- }
124
-
125
- function updateInput(value: string): void {
126
- (input.value as HTMLInputElement).value = value
127
- }
128
-
129
- function setHour(hour: string): void {
130
- emit('change', [hour, mValue.value].join(':'))
131
- }
132
-
133
- function setMin(minute: string): void {
134
- emit('change', [hValue.value, minute].join(':'))
135
- }
136
-
137
- return {
138
- input,
139
- on,
140
- hours,
141
- minutes,
142
- hValue,
143
- mValue,
144
- openSelector,
145
- handleBlur,
146
- setHour,
147
- setMin
148
- }
149
- }
150
- })
151
- </script>
152
-
153
- <style lang="postcss" scoped>
154
- @import "@/assets/styles/variables";
155
-
156
- .SInputTime.has-error {
157
- .input {
158
- border-color: var(--c-danger);
159
-
160
- &:focus {
161
- border-color: var(--c-danger);
162
- }
163
- }
164
- }
165
-
166
- .box {
167
- position: relative;
168
-
169
- &:hover .input {
170
- border-color: var(--c-gray);
171
- }
172
- }
173
-
174
- .input {
175
- display: block;
176
- border: 1px solid transparent;
177
- border-radius: 4px;
178
- padding: 11px 16px;
179
- width: 100%;
180
- line-height: 24px;
181
- font-size: 16px;
182
- background-color: var(--c-white-mute);
183
- transition: border-color .25s, background-color .25s;
184
-
185
- &::placeholder {
186
- color: var(--c-text-light-2);
187
- }
188
-
189
- &:focus {
190
- border-color: var(--c-black);
191
- background-color: var(--c-white);
192
- }
193
- }
194
-
195
- .selectors {
196
- position: absolute;
197
- top: 56px;
198
- left: 0;
199
- z-index: var(--z-index-screen);
200
- display: flex;
201
- border-radius: 4px;
202
- padding: 12px;
203
- background-color: var(--c-black-elevated);
204
- box-shadow: var(--shadow-depth-3);
205
- transition: opacity .25s, transform .25s;
206
- }
207
-
208
- .selectors.fade-enter,
209
- .selectors.fade-leave-to {
210
- opacity: 0;
211
- transform: translateY(-4px);
212
- }
213
-
214
- .selector {
215
- width: 56px;
216
- text-align: center;
217
- }
218
-
219
- .selector + .selector {
220
- margin-left: 4px;
221
- }
222
-
223
- .title {
224
- padding-bottom: 4px;
225
- font-size: 12px;
226
- font-weight: 500;
227
- color: var(--c-text-dark-2);
228
- }
229
-
230
- .values {
231
- height: 178px;
232
- overflow: hidden;
233
- overflow-y: auto;
234
- }
235
-
236
- .value {
237
- display: block;
238
- border-radius: 2px;
239
- width: 100%;
240
- line-height: 32px;
241
- font-size: 14px;
242
- font-weight: 500;
243
- color: var(--c-text-dark-2);
244
- transition: background-color .25s;
245
- cursor: pointer;
246
-
247
- &:hover {
248
- background-color: var(--c-black-elevated-mute);
249
- }
250
-
251
- &.active {
252
- color: var(--c-text-dark-1);
253
- }
254
- }
255
- </style>
@@ -1,60 +0,0 @@
1
- <template>
2
- <SInputNumber
3
- class="SInputYear"
4
- :size="size"
5
- :mode="mode"
6
- :name="name"
7
- :label="label"
8
- :note="note"
9
- :help="help"
10
- :placeholder="placeholder"
11
- :action="action"
12
- :text="text"
13
- :text-after="textAfter"
14
- :disabled="disabled"
15
- :value="value"
16
- :validation="validation"
17
- @action="$emit('action')"
18
- @input="v => $emit('input', v)"
19
- @enter="v => $emit('enter', v)"
20
- @blur="v => $emit('blur', v)"
21
- />
22
- </template>
23
-
24
- <script lang="ts">
25
- import { PropType, defineComponent } from '@vue/composition-api'
26
- import { Validation } from '../validation/Validation'
27
- import SInputNumber from './SInputNumber.vue'
28
-
29
- type Size = 'medium' | 'mini'
30
- type Mode = 'filled' | 'outlined'
31
-
32
- interface Action {
33
- type?: 'button' | 'select'
34
- icon?: any
35
- text?: string
36
- clickable?: boolean
37
- }
38
-
39
- export default defineComponent({
40
- components: {
41
- SInputNumber
42
- },
43
-
44
- props: {
45
- size: { type: String as PropType<Size>, default: 'medium' },
46
- mode: { type: String as PropType<Mode>, default: 'filled' },
47
- name: { type: String, default: null },
48
- label: { type: String, default: null },
49
- note: { type: String, default: null },
50
- help: { type: String, default: null },
51
- placeholder: { type: String, default: null },
52
- action: { type: Object as PropType<Action>, default: null },
53
- text: { type: String, default: null },
54
- textAfter: { type: String, default: null },
55
- disabled: { type: Boolean, default: false },
56
- value: { type: [String, Number], default: null },
57
- validation: { type: Object as PropType<Validation>, default: null }
58
- }
59
- })
60
- </script>
@@ -1,56 +0,0 @@
1
- <template>
2
- <component
3
- :is="tag"
4
- v-if="$scopedSlots.default"
5
- ref="container"
6
- class="SMarkdown-container"
7
- >
8
- <slot v-bind="{ rendered }" />
9
- </component>
10
- <component
11
- :is="tag"
12
- v-else
13
- ref="container"
14
- class="SMarkdown-container"
15
- v-html="rendered"
16
- />
17
- </template>
18
-
19
- <script lang="ts">
20
- import { computed, defineComponent, nextTick, PropType, ref, watch } from '@vue/composition-api'
21
- import { useMarkdown, useLink, LinkCallback } from '../composables/Markdown'
22
-
23
- export default defineComponent({
24
- props: {
25
- content: { type: String, required: true },
26
- callbacks: { type: Array as PropType<LinkCallback[]>, default: () => [] },
27
- inline: { type: Boolean, default: false },
28
- tag: { type: String, default: 'div' }
29
- },
30
-
31
- setup(props, { emit }) {
32
- const container = ref<Element | null>(null)
33
-
34
- const { addListeners, subscribe } = useLink({
35
- container,
36
- callbacks: props.callbacks
37
- })
38
-
39
- const markdown = useMarkdown()
40
- const rendered = computed(() => markdown(props.content, props.inline))
41
-
42
- watch(
43
- rendered,
44
- () => nextTick(() => addListeners()),
45
- { immediate: true }
46
- )
47
-
48
- subscribe(payload => emit('clicked', payload))
49
-
50
- return {
51
- container,
52
- rendered
53
- }
54
- }
55
- })
56
- </script>
@@ -1,113 +0,0 @@
1
- <template>
2
- <div class="SPlaceholderBlank" :class="classes">
3
- <transition name="fade">
4
- <div v-if="!loaded" class="loader">
5
- <div class="icon">
6
- <SIconPreloaderDark class="icon-svg" />
7
- </div>
8
- </div>
9
- </transition>
10
-
11
- <div class="content">
12
- <slot />
13
- </div>
14
- </div>
15
- </template>
16
-
17
- <script lang="ts">
18
- import { computed, defineComponent } from '@vue/composition-api'
19
- import SIconPreloaderDark from './icons/SIconPreloaderDark.vue'
20
-
21
- export default defineComponent({
22
- components: {
23
- SIconPreloaderDark
24
- },
25
-
26
- props: {
27
- loaded: { type: Boolean, required: true },
28
- loaderPosition: { type: String, default: 'left' }
29
- },
30
-
31
- setup(props) {
32
- const classes = computed(() => ({
33
- loaded: props.loaded,
34
- left: props.loaderPosition === 'left',
35
- center: props.loaderPosition === 'center',
36
- right: props.loaderPosition === 'right'
37
- }))
38
-
39
- return {
40
- classes
41
- }
42
- }
43
- })
44
- </script>
45
-
46
- <style lang="postcss" scoped>
47
- @import "@/assets/styles/variables";
48
-
49
- .SPlaceholderBlank {
50
- position: relative;
51
- width: 100%;
52
- min-height: 48px;
53
- }
54
-
55
- .SPlaceholderBlank.loaded {
56
- .content {
57
- opacity: 1;
58
- }
59
- }
60
-
61
- .SPlaceholderBlank.left .icon {
62
- top: 0;
63
- left: 0;
64
- }
65
-
66
- .SPlaceholderBlank.center .icon {
67
- top: 0;
68
- left: 50%;
69
- transform: translateX(-50%);
70
- }
71
-
72
- .SPlaceholderBlank.right .icon {
73
- top: 0;
74
- right: 0;
75
- }
76
-
77
- .loader {
78
- position: absolute;
79
- top: 0;
80
- right: 0;
81
- bottom: 0;
82
- left: 0;
83
- display: flex;
84
- justify-content: flex-start;
85
- align-items: flex-start;
86
- width: 100%;
87
- height: 100%;
88
- transition: opacity .5s;
89
- }
90
-
91
- .loader.fade-enter,
92
- .loader.fade-leave-to {
93
- opacity: 0;
94
- }
95
-
96
- .icon {
97
- position: absolute;
98
- display: block;
99
- width: 48px;
100
- height: 48px;
101
- }
102
-
103
- .icon-svg {
104
- display: block;
105
- width: 48px;
106
- height: 48px;
107
- }
108
-
109
- .content {
110
- opacity: 0;
111
- transition: opacity .25s;
112
- }
113
- </style>
@@ -1,83 +0,0 @@
1
- <template>
2
- <SPlaceholderBlank class="SPlaceholderImage" :loaded="isLoaded">
3
- <div class="placeholder" :style="styles" />
4
-
5
- <div class="img">
6
- <img class="img-src" :src="img" :alt="alt" @load="handleLoad">
7
- </div>
8
- </SPlaceholderBlank>
9
- </template>
10
-
11
- <script lang="ts">
12
- import { computed, ref, defineComponent } from '@vue/composition-api'
13
- import SPlaceholderBlank from './SPlaceholderBlank.vue'
14
-
15
- export default defineComponent({
16
- components: {
17
- SPlaceholderBlank
18
- },
19
-
20
- props: {
21
- img: { type: String, required: true },
22
- alt: { type: String, default: '' },
23
- width: { type: Number, required: true },
24
- height: { type: Number, required: true },
25
- delay: { type: Number, default: 0 }
26
- },
27
-
28
- setup(props, { emit }) {
29
- const isLoaded = ref(false)
30
-
31
- const styles = computed(() => ({
32
- paddingBottom: `calc((${props.height} / ${props.width}) * 100%)`
33
- }))
34
-
35
- function handleLoad(): void {
36
- setTimeout(() => {
37
- isLoaded.value = true
38
-
39
- emit('load')
40
- }, props.delay)
41
- }
42
-
43
- return {
44
- isLoaded,
45
- styles,
46
- handleLoad
47
- }
48
- }
49
- })
50
- </script>
51
-
52
- <style lang="postcss" scoped>
53
- @import "@/assets/styles/variables";
54
-
55
- .SPlaceholderImage {
56
- position: relative;
57
- width: 100%;
58
- }
59
-
60
- .SPlaceholderImage.loaded {
61
- .img {
62
- opacity: 1;
63
- }
64
- }
65
-
66
- .SPlaceholderImage >>> .loader {
67
- justify-content: center;
68
- align-items: center;
69
- border: 1px solid var(--c-divider-light);
70
- }
71
-
72
- .img {
73
- position: absolute;
74
- top: 0;
75
- right: 0;
76
- bottom: 0;
77
- left: 0;
78
- width: 100%;
79
- height: 100%;
80
- opacity: 0;
81
- transition: opacity .5s;
82
- }
83
- </style>
@@ -1,62 +0,0 @@
1
- <template>
2
- <div class="SPortalScreens">
3
- <portal-target name="screen" />
4
- </div>
5
- </template>
6
-
7
- <script lang="ts">
8
- import { computed, defineComponent, watch } from '@vue/composition-api'
9
- import { useRoute } from '../composables/Router'
10
- import { useStore } from '../composables/Store'
11
-
12
- type Styles = Record<'paddingRight' | 'top' | 'position', string | null>
13
-
14
- export default defineComponent({
15
- setup() {
16
- const store = useStore()
17
- const route = useRoute()
18
-
19
- const screenName = computed(() => store.state.screen.name)
20
-
21
- watch(screenName, (value) => { value === null ? close() : open() })
22
-
23
- watch(route, () => { store.dispatch('screen/close') })
24
-
25
- function close(): void {
26
- setTimeout(() => {
27
- const scrollY = document.body.style.top
28
-
29
- setBodyStyles({
30
- paddingRight: null,
31
- top: null,
32
- position: null
33
- })
34
-
35
- window.scrollTo(0, parseInt(scrollY || '0') * -1)
36
- }, 300)
37
- }
38
-
39
- function open(): void {
40
- const scrollBarWidth = getScrollbarWidth()
41
-
42
- setBodyStyles({
43
- paddingRight: `${scrollBarWidth}px`,
44
- top: `-${window.scrollY}px`,
45
- position: 'fixed'
46
- })
47
- }
48
-
49
- function setBodyStyles(styles: Styles): void {
50
- Object.assign(document.body.style, styles)
51
- }
52
-
53
- function getScrollbarWidth(): number {
54
- return window.innerWidth - document.documentElement.clientWidth
55
- }
56
-
57
- return {
58
- screenName
59
- }
60
- }
61
- })
62
- </script>
@@ -1,89 +0,0 @@
1
- <template>
2
- <div class="SProgressBar">
3
- <div class="bar">
4
- <div class="bar-bg">
5
- <div class="bar-line" :style="styles" />
6
- </div>
7
- </div>
8
-
9
- <p class="number">
10
- {{ progressForNumber }}<span class="number-unit">%</span>
11
- </p>
12
- </div>
13
- </template>
14
-
15
- <script lang="ts">
16
- import { computed, defineComponent } from '@vue/composition-api'
17
-
18
- export default defineComponent({
19
- props: {
20
- now: { type: Number, required: true },
21
- max: { type: Number, required: true }
22
- },
23
-
24
- setup(props) {
25
- const progress = computed(() => {
26
- const value = props.now / props.max
27
- const pow = 10 ** 4
28
-
29
- return Math.round(value * pow) / pow
30
- })
31
-
32
- const progressForNumber = computed(() => (progress.value * 100).toFixed(2))
33
-
34
- const styles = computed<Partial<CSSStyleDeclaration>>(() => ({
35
- transform: `scaleX(${progress.value})`
36
- }))
37
-
38
- return {
39
- styles,
40
- progressForNumber
41
- }
42
- }
43
- })
44
- </script>
45
-
46
- <style lang="postcss" scoped>
47
- @import "@/assets/styles/variables";
48
-
49
- .SProgressBar {
50
- display: flex;
51
- width: 100%;
52
- }
53
-
54
- .bar {
55
- flex-grow: 1;
56
- }
57
-
58
- .bar-bg {
59
- border-radius: 2px;
60
- width: 100%;
61
- height: 16px;
62
- background-color: var(--c-white-mute);
63
- overflow: hidden;
64
- }
65
-
66
- .bar-line {
67
- border-radius: 2px;
68
- height: 16px;
69
- background-color: var(--c-black);
70
- transform-origin: 0 50%;
71
- transition: transform .25s;
72
- }
73
-
74
- .number {
75
- flex-shrink: 0;
76
- width: 64px;
77
- text-align: right;
78
- line-height: 16px;
79
- font-family: var(--font-family-number);
80
- font-size: 14px;
81
- }
82
-
83
- .number-unit {
84
- display: inline-block;
85
- margin-left: 2px;
86
- font-size: 12px;
87
- color: var(--c-gray);
88
- }
89
- </style>