logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe git clone https://anongit.hacktivis.me/git/pleroma-fe.git/

shadow_control.vue (7750B)


  1. <template>
  2. <div
  3. class="ShadowControl label shadow-control"
  4. :class="{ disabled: disabled || !present, '-no-preview': noPreview, '-compact': compact }"
  5. >
  6. <ComponentPreview
  7. v-if="!noPreview"
  8. :invalid="invalid"
  9. class="shadow-preview"
  10. :shadow-control="true"
  11. :shadow="selected"
  12. :preview-style="style"
  13. :disabled="disabled || !present"
  14. @update:shadow="({ axis, value }) => updateProperty(axis, value)"
  15. />
  16. <div class="shadow-switcher">
  17. <Select
  18. id="shadow-list"
  19. v-model="selectedId"
  20. class="shadow-list"
  21. size="4"
  22. :disabled="disabled || shadowsAreNull"
  23. >
  24. <option
  25. v-for="(shadow, index) in cValue"
  26. :key="index"
  27. :value="index"
  28. :class="{ '-active': index === Number(selectedId) }"
  29. >
  30. {{ getSubshadowLabel(shadow, index) }}
  31. </option>
  32. </Select>
  33. <SelectMotion
  34. v-model="cValue"
  35. :selected-id="selectedId"
  36. :get-add-value="getNewSubshadow"
  37. :disabled="disabled"
  38. @update:selectedId="onSelectChange"
  39. />
  40. </div>
  41. <div class="shadow-tweak">
  42. <Select
  43. v-model="selectedType"
  44. :disabled="disabled || !present"
  45. >
  46. <option value="object">
  47. {{ $t('settings.style.shadows.raw') }}
  48. </option>
  49. <option value="string">
  50. {{ $t('settings.style.shadows.expression') }}
  51. </option>
  52. </Select>
  53. <template v-if="selectedType === 'string'">
  54. <textarea
  55. v-model="selected"
  56. class="input shadow-expression"
  57. :disabled="disabled || shadowsAreNull"
  58. :class="{disabled: disabled || shadowsAreNull}"
  59. />
  60. </template>
  61. <template v-else-if="selectedType === 'object'">
  62. <div
  63. :class="{ disabled: disabled || !present }"
  64. class="name-control style-control"
  65. >
  66. <label
  67. for="name"
  68. class="label"
  69. :class="{ faint: disabled || !present }"
  70. >
  71. {{ $t('settings.style.shadows.name') }}
  72. </label>
  73. <input
  74. id="name"
  75. :value="selected?.name"
  76. :disabled="disabled || !present"
  77. :class="{ disabled: disabled || !present }"
  78. name="name"
  79. class="input input-string"
  80. @input="e => updateProperty('name', e.target.value)"
  81. >
  82. </div>
  83. <div
  84. :disabled="disabled || !present"
  85. class="inset-control style-control"
  86. >
  87. <Checkbox
  88. id="inset"
  89. :value="selected?.inset"
  90. :disabled="disabled || !present"
  91. name="inset"
  92. class="input-inset input-boolean"
  93. @input="e => updateProperty('inset', e.target.checked)"
  94. >
  95. <template #before>
  96. {{ $t('settings.style.shadows.inset') }}
  97. </template>
  98. </Checkbox>
  99. </div>
  100. <div
  101. :disabled="disabled || !present"
  102. :class="{ disabled: disabled || !present }"
  103. class="blur-control style-control"
  104. >
  105. <label
  106. for="blur"
  107. class="label"
  108. :class="{ faint: disabled || !present }"
  109. >
  110. {{ $t('settings.style.shadows.blur') }}
  111. </label>
  112. <input
  113. id="blur"
  114. :value="selected?.blur"
  115. :disabled="disabled || !present"
  116. :class="{ disabled: disabled || !present }"
  117. name="blur"
  118. class="input input-range"
  119. type="range"
  120. max="20"
  121. min="0"
  122. @input="e => updateProperty('blur', e.target.value)"
  123. >
  124. <input
  125. :value="selected?.blur"
  126. class="input input-number -small"
  127. :disabled="disabled || !present"
  128. :class="{ disabled: disabled || !present }"
  129. type="number"
  130. min="0"
  131. @input="e => updateProperty('blur', e.target.value)"
  132. >
  133. </div>
  134. <div
  135. class="spread-control style-control"
  136. :class="{ disabled: disabled || !present || (separateInset && !selected?.inset) }"
  137. >
  138. <label
  139. for="spread"
  140. class="label"
  141. :class="{ faint: disabled || !present || (separateInset && !selected?.inset) }"
  142. >
  143. {{ $t('settings.style.shadows.spread') }}
  144. </label>
  145. <input
  146. id="spread"
  147. :value="selected?.spread"
  148. :class="{ disabled: disabled || !present || (separateInset && !selected?.inset) }"
  149. :disabled="disabled || !present || (separateInset && !selected?.inset)"
  150. name="spread"
  151. class="input input-range"
  152. type="range"
  153. max="20"
  154. min="-20"
  155. @input="e => updateProperty('spread', e.target.value)"
  156. >
  157. <input
  158. :value="selected?.spread"
  159. class="input input-number -small"
  160. :class="{ disabled: disabled || !present || (separateInset && !selected?.inset) }"
  161. :disabled="disabled || !present || (separateInset && !selected?.inset)"
  162. type="number"
  163. @input="e => updateProperty('spread', e.target.value)"
  164. >
  165. </div>
  166. <ColorInput
  167. :model-value="selected?.color"
  168. :disabled="disabled || !present"
  169. :label="$t('settings.style.common.color')"
  170. :fallback="getColorFallback"
  171. :show-optional-checkbox="false"
  172. name="shadow"
  173. @update:modelValue="e => updateProperty('color', e)"
  174. />
  175. <OpacityInput
  176. :model-value="selected?.alpha"
  177. :disabled="disabled || !present"
  178. @update:modelValue="e => updateProperty('alpha', e)"
  179. />
  180. <i18n-t
  181. scope="global"
  182. keypath="settings.style.shadows.hintV3"
  183. :class="{ faint: disabled || !present }"
  184. tag="p"
  185. >
  186. <code>--variable,mod</code>
  187. </i18n-t>
  188. <Popover
  189. v-if="separateInset"
  190. trigger="hover"
  191. >
  192. <template #trigger>
  193. <div
  194. class="inset-alert alert warning"
  195. >
  196. <FAIcon icon="exclamation-triangle" />
  197. &nbsp;
  198. {{ $t('settings.style.shadows.filter_hint.avatar_inset_short') }}
  199. </div>
  200. </template>
  201. <template #content>
  202. <div class="inset-tooltip tooltip">
  203. <i18n-t
  204. scope="global"
  205. keypath="settings.style.shadows.filter_hint.always_drop_shadow"
  206. tag="p"
  207. >
  208. <code>filter: drop-shadow()</code>
  209. </i18n-t>
  210. <p>{{ $t('settings.style.shadows.filter_hint.avatar_inset') }}</p>
  211. <i18n-t
  212. scope="global"
  213. keypath="settings.style.shadows.filter_hint.drop_shadow_syntax"
  214. tag="p"
  215. >
  216. <code>drop-shadow</code>
  217. <code>spread-radius</code>
  218. <code>inset</code>
  219. </i18n-t>
  220. <i18n-t
  221. scope="global"
  222. keypath="settings.style.shadows.filter_hint.inset_classic"
  223. tag="p"
  224. >
  225. <code>box-shadow</code>
  226. </i18n-t>
  227. <p>{{ $t('settings.style.shadows.filter_hint.spread_zero') }}</p>
  228. </div>
  229. </template>
  230. </Popover>
  231. </template>
  232. </div>
  233. </div>
  234. </template>
  235. <script src="./shadow_control.js"></script>
  236. <style src="./shadow_control.scss" lang="scss"></style>