trestle 0.9.9 → 0.10.0.pre2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (339) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/release.yml +26 -0
  3. data/.github/workflows/rspec.yml +37 -5
  4. data/.gitignore +3 -0
  5. data/Gemfile +14 -1
  6. data/README.md +2 -1
  7. data/app/assets/bundle/trestle/admin.css +23 -0
  8. data/app/assets/bundle/trestle/admin.js +83 -0
  9. data/app/assets/bundle/trestle/fa-brands-400.ttf +0 -0
  10. data/app/assets/bundle/trestle/fa-brands-400.woff2 +0 -0
  11. data/app/assets/bundle/trestle/fa-regular-400.ttf +0 -0
  12. data/app/assets/bundle/trestle/fa-regular-400.woff2 +0 -0
  13. data/app/assets/bundle/trestle/fa-solid-900.ttf +0 -0
  14. data/app/assets/bundle/trestle/fa-solid-900.woff2 +0 -0
  15. data/app/assets/bundle/trestle/locale/cs.js +110 -0
  16. data/app/assets/bundle/trestle/locale/de.js +116 -0
  17. data/app/assets/bundle/trestle/locale/en.js +329 -0
  18. data/app/assets/bundle/trestle/locale/es-MX.js +109 -0
  19. data/app/assets/bundle/trestle/locale/es.js +109 -0
  20. data/app/assets/bundle/trestle/locale/fr.js +111 -0
  21. data/app/assets/bundle/trestle/locale/ko.js +111 -0
  22. data/app/assets/bundle/trestle/locale/lv.js +109 -0
  23. data/app/assets/bundle/trestle/locale/nl.js +96 -0
  24. data/app/assets/bundle/trestle/locale/pl.js +99 -0
  25. data/app/assets/bundle/trestle/locale/pt-BR.js +98 -0
  26. data/app/assets/bundle/trestle/locale/vi.js +116 -0
  27. data/app/assets/bundle/trestle/locale/zh-CN.js +109 -0
  28. data/app/assets/bundle/trestle/photoswipe-7aa1aec9c3c1fd65c382.digested.js +6 -0
  29. data/app/assets/sprockets/trestle/custom.css +1 -0
  30. data/app/assets/sprockets/trestle/icons/font-awesome.css.erb +32 -0
  31. data/app/assets/sprockets/trestle/manifest.js +4 -0
  32. data/app/assets/stylesheets/trestle/custom.css +6 -1
  33. data/app/controllers/concerns/trestle/controller/helpers.rb +2 -0
  34. data/app/controllers/concerns/trestle/controller/location.rb +1 -6
  35. data/app/controllers/concerns/trestle/controller/modal.rb +23 -0
  36. data/app/controllers/concerns/trestle/controller/turbo_stream.rb +12 -0
  37. data/app/controllers/concerns/trestle/resource/controller/actions.rb +39 -28
  38. data/app/controllers/concerns/trestle/resource/controller/redirection.rb +5 -5
  39. data/app/controllers/trestle/application_controller.rb +2 -1
  40. data/app/helpers/trestle/flash_helper.rb +10 -0
  41. data/app/helpers/trestle/form_helper.rb +3 -2
  42. data/app/helpers/trestle/format_helper.rb +2 -1
  43. data/app/helpers/trestle/i18n_helper.rb +46 -7
  44. data/app/helpers/trestle/modal_helper.rb +29 -0
  45. data/app/helpers/trestle/tab_helper.rb +1 -1
  46. data/app/helpers/trestle/turbo/frame_helper.rb +29 -0
  47. data/app/helpers/trestle/turbo/stream_helper.rb +9 -0
  48. data/app/helpers/trestle/turbo/tag_builder.rb +21 -0
  49. data/app/helpers/trestle/url_helper.rb +7 -4
  50. data/app/views/layouts/trestle/admin.html.erb +16 -18
  51. data/app/views/layouts/trestle/admin.turbo_stream.erb +4 -0
  52. data/app/views/layouts/trestle/modal.html.erb +5 -0
  53. data/app/views/trestle/_i18n.html.erb +12 -0
  54. data/app/views/trestle/_theme.html.erb +15 -0
  55. data/app/views/trestle/application/_header.html.erb +12 -10
  56. data/app/views/trestle/application/_layout.html.erb +6 -3
  57. data/app/views/trestle/application/_modal.html.erb +36 -0
  58. data/app/views/trestle/application/_tabs.html.erb +4 -4
  59. data/app/views/trestle/flash/_alert.html.erb +1 -1
  60. data/app/views/trestle/flash/_debug.html.erb +1 -1
  61. data/app/views/trestle/resource/_form.html.erb +5 -0
  62. data/app/views/trestle/resource/create.turbo_stream.erb +1 -0
  63. data/app/views/trestle/resource/destroy.turbo_stream.erb +1 -0
  64. data/app/views/trestle/resource/edit.html.erb +6 -2
  65. data/app/views/trestle/resource/index.html.erb +17 -10
  66. data/app/views/trestle/resource/new.html.erb +9 -2
  67. data/app/views/trestle/resource/show.html.erb +6 -2
  68. data/app/views/trestle/resource/update.turbo_stream.erb +1 -0
  69. data/app/views/trestle/shared/_sidebar.html.erb +10 -10
  70. data/frontend/css/components/_alerts.scss +41 -37
  71. data/frontend/css/components/_avatar.scss +12 -12
  72. data/frontend/css/components/_background.scss +8 -36
  73. data/frontend/css/components/_badges.scss +31 -0
  74. data/frontend/css/components/_breadcrumbs.scss +9 -30
  75. data/frontend/css/components/_buttons.scss +8 -7
  76. data/frontend/css/components/_datepicker.scss +15 -11
  77. data/frontend/css/components/_dropdown.scss +21 -9
  78. data/frontend/css/components/{_fields.scss → _forms.scss} +18 -5
  79. data/frontend/css/components/_grid.scss +29 -0
  80. data/frontend/css/components/_media-grid.scss +52 -44
  81. data/frontend/css/components/_modal.scss +37 -8
  82. data/frontend/css/components/_pagination.scss +5 -9
  83. data/frontend/css/components/_photoswipe.scss +8 -0
  84. data/frontend/css/components/_popover.scss +2 -1
  85. data/frontend/css/components/_scopes.scss +5 -11
  86. data/frontend/css/components/_select.scss +160 -31
  87. data/frontend/css/components/_sort.scss +1 -1
  88. data/frontend/css/components/_table.scss +61 -66
  89. data/frontend/css/components/_tabs.scss +20 -20
  90. data/frontend/css/components/_tags.scss +80 -15
  91. data/frontend/css/components/_toolbars.scss +18 -13
  92. data/frontend/css/components/_turbo.scss +3 -0
  93. data/frontend/css/core/_bootstrap.scss +46 -0
  94. data/frontend/css/core/_dependencies.scss +4 -3
  95. data/frontend/css/core/_functions.scss +31 -0
  96. data/frontend/css/core/_mixins.scss +2 -36
  97. data/frontend/css/core/_theme.scss +261 -0
  98. data/frontend/css/core/_typography.scss +16 -14
  99. data/frontend/css/icons/_fontawesome.scss +3 -15
  100. data/frontend/css/index.scss +15 -7
  101. data/frontend/css/layout/_base.scss +6 -4
  102. data/frontend/css/layout/_content-header.scss +71 -0
  103. data/frontend/css/layout/_footer.scss +5 -7
  104. data/frontend/css/layout/_header.scss +5 -3
  105. data/frontend/css/layout/_main-content.scss +107 -0
  106. data/frontend/css/layout/_navigation.scss +112 -50
  107. data/frontend/css/layout/_sidebar.scss +70 -36
  108. data/frontend/css/support/_sprockets.scss +2 -0
  109. data/frontend/css/support/_webpack.scss +2 -0
  110. data/frontend/css/variables/_bootstrap.scss +158 -55
  111. data/frontend/css/variables/_maps.scss +15 -0
  112. data/frontend/css/variables/_trestle.scss +68 -39
  113. data/frontend/js/controllers/application_controller.js +17 -0
  114. data/frontend/js/controllers/batch_action_controller.js +59 -0
  115. data/frontend/js/controllers/checkbox_select_controller.js +46 -0
  116. data/frontend/js/controllers/confirm_controller.js +115 -0
  117. data/frontend/js/controllers/confirm_delete_controller.js +11 -0
  118. data/frontend/js/controllers/datepicker_controller.js +12 -0
  119. data/frontend/js/controllers/datetimepicker_controller.js +13 -0
  120. data/frontend/js/controllers/deprecated/init_controller.js +9 -0
  121. data/frontend/js/controllers/flatpickr_controller.js +50 -0
  122. data/frontend/js/controllers/follow_url_controller.js +36 -0
  123. data/frontend/js/controllers/form_error_controller.js +24 -0
  124. data/frontend/js/controllers/form_loading_controller.js +50 -0
  125. data/frontend/js/controllers/gallery_controller.js +10 -0
  126. data/frontend/js/controllers/index.js +19 -0
  127. data/frontend/js/controllers/keyboard_submit_controller.js +25 -0
  128. data/frontend/js/controllers/lightbox_controller.js +160 -0
  129. data/frontend/js/controllers/mobile_sidebar_controller.js +30 -0
  130. data/frontend/js/controllers/modal_controller.js +36 -0
  131. data/frontend/js/controllers/modal_frame_controller.js +11 -0
  132. data/frontend/js/controllers/modal_trigger_controller.js +74 -0
  133. data/frontend/js/{components/navigation.js → controllers/navigation_controller.js} +14 -10
  134. data/frontend/js/controllers/navigation_tooltip_controller.js +32 -0
  135. data/frontend/js/controllers/popover_controller.js +87 -0
  136. data/frontend/js/controllers/reloadable_controller.js +34 -0
  137. data/frontend/js/controllers/select_controller.js +49 -0
  138. data/frontend/js/controllers/sidebar_controller.js +33 -0
  139. data/frontend/js/controllers/tab_errors_controller.js +45 -0
  140. data/frontend/js/controllers/tabs_controller.js +45 -0
  141. data/frontend/js/controllers/timepicker_controller.js +14 -0
  142. data/frontend/js/controllers/toggle_attr_controller.js +27 -0
  143. data/frontend/js/controllers/toggle_class_controller.js +27 -0
  144. data/frontend/js/controllers/tooltip_controller.js +13 -0
  145. data/frontend/js/controllers/wrapper_controller.js +43 -0
  146. data/frontend/js/core/backdrop.js +100 -0
  147. data/frontend/js/core/error_modal.js +65 -0
  148. data/frontend/js/core/fetch.js +32 -0
  149. data/frontend/js/core/i18n.js +24 -10
  150. data/frontend/js/core/modal.js +52 -0
  151. data/frontend/js/core/stream_actions.js +56 -0
  152. data/frontend/js/core/turbo_errors.js +9 -0
  153. data/frontend/js/{core → deprecated}/events.js +1 -8
  154. data/frontend/js/deprecated/tooltip.js +8 -0
  155. data/frontend/js/index.js +28 -40
  156. data/frontend/js/mixins/index.js +5 -0
  157. data/frontend/js/mixins/photoswipe.js +10 -0
  158. data/frontend/js/util/bootstrap.js +93 -0
  159. data/i18n/config.yml +14 -0
  160. data/i18n/environment.rb +8 -0
  161. data/i18n/export +3 -0
  162. data/i18n/template.erb +1 -0
  163. data/lib/generators/trestle/install/install_generator.rb +3 -8
  164. data/lib/generators/trestle/install/templates/trestle.rb.erb +5 -5
  165. data/lib/trestle/color.rb +113 -0
  166. data/lib/trestle/configuration.rb +16 -8
  167. data/lib/trestle/engine.rb +28 -20
  168. data/lib/trestle/form/fields/check_box_helpers.rb +7 -18
  169. data/lib/trestle/form/fields/collection_select.rb +1 -1
  170. data/lib/trestle/form/fields/color_field.rb +4 -0
  171. data/lib/trestle/form/fields/date_field.rb +4 -0
  172. data/lib/trestle/form/fields/date_picker.rb +10 -4
  173. data/lib/trestle/form/fields/date_select.rb +1 -1
  174. data/lib/trestle/form/fields/datetime_field.rb +4 -0
  175. data/lib/trestle/form/fields/datetime_select.rb +1 -1
  176. data/lib/trestle/form/fields/file_field.rb +3 -28
  177. data/lib/trestle/form/fields/form_control.rb +2 -2
  178. data/lib/trestle/form/fields/form_group.rb +1 -1
  179. data/lib/trestle/form/fields/grouped_collection_select.rb +1 -1
  180. data/lib/trestle/form/fields/radio_button_helpers.rb +5 -17
  181. data/lib/trestle/form/fields/range_field.rb +1 -5
  182. data/lib/trestle/form/fields/select.rb +17 -1
  183. data/lib/trestle/form/fields/time_field.rb +4 -0
  184. data/lib/trestle/form/fields/time_select.rb +1 -1
  185. data/lib/trestle/form/fields/time_zone_select.rb +1 -1
  186. data/lib/trestle/form/renderer.rb +3 -0
  187. data/lib/trestle/form.rb +16 -1
  188. data/lib/trestle/resource/toolbar.rb +18 -8
  189. data/lib/trestle/sprockets_compressor.rb +16 -0
  190. data/lib/trestle/table/actions_column.rb +2 -2
  191. data/lib/trestle/table/row.rb +2 -1
  192. data/lib/trestle/table/select_column.rb +3 -6
  193. data/lib/trestle/table.rb +6 -1
  194. data/lib/trestle/toolbar/context.rb +7 -4
  195. data/lib/trestle/toolbar/item.rb +1 -1
  196. data/lib/trestle/toolbar/menu.rb +11 -11
  197. data/lib/trestle/version.rb +1 -1
  198. data/lib/trestle.rb +2 -23
  199. data/package.json +31 -27
  200. data/trestle.gemspec +6 -11
  201. data/webpack.config.js +10 -10
  202. data/yarn.lock +1480 -1233
  203. metadata +175 -208
  204. data/app/assets/bundle/trestle/bundle.css +0 -12
  205. data/app/assets/bundle/trestle/bundle.js +0 -89
  206. data/app/assets/bundle/trestle/fa-brands-400.eot +0 -0
  207. data/app/assets/bundle/trestle/fa-brands-400.svg +0 -3717
  208. data/app/assets/bundle/trestle/fa-brands-400.woff +0 -0
  209. data/app/assets/bundle/trestle/fa-regular-400.eot +0 -0
  210. data/app/assets/bundle/trestle/fa-regular-400.svg +0 -801
  211. data/app/assets/bundle/trestle/fa-regular-400.woff +0 -0
  212. data/app/assets/bundle/trestle/fa-solid-900.eot +0 -0
  213. data/app/assets/bundle/trestle/fa-solid-900.svg +0 -5034
  214. data/app/assets/bundle/trestle/fa-solid-900.woff +0 -0
  215. data/app/assets/javascripts/trestle/admin.js +0 -3
  216. data/app/assets/javascripts/trestle/i18n.js.erb +0 -8
  217. data/app/assets/stylesheets/trestle/admin.css +0 -2
  218. data/app/assets/stylesheets/trestle/icons/_font-awesome.css.erb +0 -40
  219. data/app/controllers/concerns/trestle/controller/dialog.rb +0 -16
  220. data/app/views/trestle/application/_dialog.html.erb +0 -34
  221. data/frontend/css/components/_color-vars.scss +0 -10
  222. data/frontend/css/components/_custom-forms.scss +0 -35
  223. data/frontend/css/components/_magnific-popup.scss +0 -36
  224. data/frontend/css/components/_turbolinks.scss +0 -3
  225. data/frontend/css/layout/_content.scss +0 -169
  226. data/frontend/js/components/confirmation.js +0 -32
  227. data/frontend/js/components/datepicker.js +0 -69
  228. data/frontend/js/components/dialog.js +0 -149
  229. data/frontend/js/components/file.js +0 -7
  230. data/frontend/js/components/form.js +0 -100
  231. data/frontend/js/components/gallery.js +0 -33
  232. data/frontend/js/components/pagination.js +0 -51
  233. data/frontend/js/components/select.js +0 -18
  234. data/frontend/js/components/sidebar.js +0 -75
  235. data/frontend/js/components/table.js +0 -61
  236. data/frontend/js/components/tabs.js +0 -59
  237. data/frontend/js/components/tooltips.js +0 -25
  238. data/frontend/js/core/contexts.js +0 -17
  239. data/frontend/js/core/turbolinks.js +0 -3
  240. data/frontend/js/core/visit.js +0 -16
  241. data/frontend/theme/trestle/_theme.scss +0 -4
  242. data/frontend/theme/trestle/_variables.scss +0 -4
  243. data/frontend/theme/trestle/theme/_defaults.scss +0 -152
  244. data/frontend/theme/trestle/theme/_functions.scss +0 -44
  245. data/frontend/theme/trestle/theme/_variables.scss +0 -15
  246. data/frontend/theme/trestle/theme/bootstrap/_alert.scss +0 -19
  247. data/frontend/theme/trestle/theme/bootstrap/_badge.scss +0 -25
  248. data/frontend/theme/trestle/theme/bootstrap/_buttons.scss +0 -93
  249. data/frontend/theme/trestle/theme/bootstrap/_color-vars.scss +0 -11
  250. data/frontend/theme/trestle/theme/bootstrap/_custom-forms.scss +0 -93
  251. data/frontend/theme/trestle/theme/bootstrap/_dropdown.scss +0 -6
  252. data/frontend/theme/trestle/theme/bootstrap/_forms.scss +0 -6
  253. data/frontend/theme/trestle/theme/bootstrap/_links.scss +0 -7
  254. data/frontend/theme/trestle/theme/bootstrap/_list-group.scss +0 -31
  255. data/frontend/theme/trestle/theme/bootstrap/_nav.scss +0 -6
  256. data/frontend/theme/trestle/theme/bootstrap/_pagination.scss +0 -18
  257. data/frontend/theme/trestle/theme/bootstrap/_progress.scss +0 -3
  258. data/frontend/theme/trestle/theme/bootstrap/_tables.scss +0 -41
  259. data/frontend/theme/trestle/theme/bootstrap/_utilities.scss +0 -3
  260. data/frontend/theme/trestle/theme/bootstrap/utilities/_background.scss +0 -17
  261. data/frontend/theme/trestle/theme/bootstrap/utilities/_borders.scss +0 -5
  262. data/frontend/theme/trestle/theme/bootstrap/utilities/_text.scss +0 -18
  263. data/frontend/theme/trestle/theme/trestle/_background.scss +0 -61
  264. data/frontend/theme/trestle/theme/trestle/_datepicker.scss +0 -58
  265. data/frontend/theme/trestle/theme/trestle/_headers.scss +0 -4
  266. data/frontend/theme/trestle/theme/trestle/_navbar.scss +0 -15
  267. data/frontend/theme/trestle/theme/trestle/_navigation.scss +0 -5
  268. data/frontend/theme/trestle/theme/trestle/_select2.scss +0 -22
  269. data/frontend/theme/trestle/theme/trestle/_tags.scss +0 -12
  270. data/frontend/theme/trestle/theme/trestle/_turbolinks.scss +0 -3
  271. data/frontend/theme/trestle/theme.scss +0 -29
  272. data/lib/generators/trestle/install/templates/_theme.scss +0 -13
  273. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/ar-dz.js +0 -0
  274. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/ar.js +0 -0
  275. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/at.js +0 -0
  276. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/az.js +0 -0
  277. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/be.js +0 -0
  278. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/bg.js +0 -0
  279. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/bn.js +0 -0
  280. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/bs.js +0 -0
  281. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/cat.js +0 -0
  282. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/ckb.js +0 -0
  283. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/cs.js +0 -0
  284. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/cy.js +0 -0
  285. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/da.js +0 -0
  286. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/de.js +0 -0
  287. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/default.js +0 -0
  288. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/eo.js +0 -0
  289. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/es.js +0 -0
  290. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/et.js +0 -0
  291. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/fa.js +0 -0
  292. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/fi.js +0 -0
  293. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/fo.js +0 -0
  294. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/fr.js +0 -0
  295. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/ga.js +0 -0
  296. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/gr.js +0 -0
  297. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/he.js +0 -0
  298. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/hi.js +0 -0
  299. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/hr.js +0 -0
  300. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/hu.js +0 -0
  301. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/hy.js +0 -0
  302. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/id.js +0 -0
  303. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/is.js +0 -0
  304. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/it.js +0 -0
  305. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/ja.js +0 -0
  306. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/ka.js +0 -0
  307. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/km.js +0 -0
  308. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/ko.js +0 -0
  309. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/kz.js +0 -0
  310. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/lt.js +0 -0
  311. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/lv.js +0 -0
  312. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/mk.js +0 -0
  313. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/mn.js +0 -0
  314. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/ms.js +0 -0
  315. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/my.js +0 -0
  316. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/nl.js +0 -0
  317. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/nn.js +0 -0
  318. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/no.js +0 -0
  319. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/pa.js +0 -0
  320. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/pl.js +0 -0
  321. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/pt.js +0 -0
  322. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/ro.js +0 -0
  323. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/ru.js +0 -0
  324. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/si.js +0 -0
  325. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/sk.js +0 -0
  326. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/sl.js +0 -0
  327. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/sq.js +0 -0
  328. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/sr-cyr.js +0 -0
  329. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/sr.js +0 -0
  330. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/sv.js +0 -0
  331. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/th.js +0 -0
  332. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/tr.js +0 -0
  333. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/uk.js +0 -0
  334. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/uz.js +0 -0
  335. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/uz_latn.js +0 -0
  336. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/vn.js +0 -0
  337. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/zh-tw.js +0 -0
  338. /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/zh.js +0 -0
  339. /data/app/assets/{stylesheets → sprockets}/trestle/_custom.css +0 -0
@@ -1,100 +0,0 @@
1
- /* global history */
2
-
3
- import $ from 'jquery'
4
-
5
- import { init, triggerInit } from '../core/events'
6
- import { refreshMainContext } from '../core/contexts'
7
-
8
- import { focusActiveTab } from './tabs'
9
- import { showError } from './dialog'
10
-
11
- const FORM_SELECTOR = 'form[data-behavior="trestle-form"]'
12
-
13
- // Prevent enter key from submitting the form
14
- $(document).on('keypress', `${FORM_SELECTOR} :input:not(textarea):not([type=submit])`, function (e) {
15
- if (e.keyCode === 13) {
16
- e.preventDefault()
17
- }
18
- })
19
-
20
- init(function (root) {
21
- const $form = $(root).find(FORM_SELECTOR)
22
-
23
- $form
24
- .on('ajax:send', function (e) {
25
- // Only run when triggered directly on form
26
- if (e.target !== this) return
27
-
28
- // Disable submit buttons
29
- $(this).find(':submit').prop('disabled', true)
30
-
31
- // Set loading status on button that triggered submission
32
- const button = $(this).data('trestle:submitButton')
33
- if (button) { $(button).addClass('loading') }
34
- })
35
- .on('ajax:complete', function (e) {
36
- // Only run when triggered directly on form
37
- if (e.target !== this) return
38
-
39
- const xhr = e.detail[0]
40
-
41
- // Reset submit buttons
42
- $(this).find(':submit').prop('disabled', false).removeClass('loading')
43
- $(this).removeData('trestle:submitButton')
44
-
45
- const contentType = (xhr.getResponseHeader('Content-Type') || '').split(';')[0]
46
-
47
- if (contentType === 'text/html') {
48
- if (/<html/i.test(xhr.responseText)) {
49
- // Response is a full HTML page, likely an error page. Render within an iframe.
50
- const $context = $(this).closest('[data-context]')
51
- const iframe = $('<iframe>').addClass('error-iframe').get(0)
52
- $context.html(iframe)
53
-
54
- iframe.contentWindow.document.documentElement.innerHTML = xhr.responseText
55
- } else {
56
- // Find the parent context and replace content
57
- const $context = $(this).closest('[data-context]')
58
- $context.html(xhr.responseText)
59
-
60
- // Initialize replaced elements within the context
61
- triggerInit($context)
62
-
63
- // Focus the correct tab
64
- focusActiveTab()
65
- }
66
- } else if (contentType === 'text/plain') {
67
- // Assume an error response
68
- const title = `${xhr.status} (${xhr.statusText})`
69
- showError(title, xhr.responseText)
70
- }
71
- })
72
- .on('ajax:success', function (e) {
73
- // Only run when triggered directly on form
74
- if (e.target !== this) return
75
-
76
- const xhr = e.detail[2]
77
-
78
- const $context = $(this).closest('[data-context]')
79
- let location = xhr.getResponseHeader('X-Trestle-Location')
80
-
81
- if (location) {
82
- // Retain current active tab
83
- location = location + document.location.hash
84
-
85
- // Update the URL in the browser and context
86
- history.replaceState({}, '', location)
87
- $context.data('context', location)
88
- }
89
-
90
- // Refresh the main context
91
- if (!$context.hasClass('app-main')) {
92
- refreshMainContext()
93
- }
94
- })
95
-
96
- $form.find(':submit').click(function () {
97
- // Save this as the button that triggered the form
98
- $(this).closest('form').data('trestle:submitButton', this)
99
- })
100
- })
@@ -1,33 +0,0 @@
1
- import $ from 'jquery'
2
-
3
- import { init } from '../core/events'
4
-
5
- init(function (root) {
6
- $(root).find('[data-behavior~="zoom"]').magnificPopup({
7
- type: 'image',
8
- closeOnContentClick: false,
9
- closeBtnInside: false,
10
- mainClass: 'mfp-with-zoom mfp-img-mobile',
11
- zoom: {
12
- enabled: true,
13
- duration: 150
14
- }
15
- })
16
-
17
- $(root).find('[data-behavior~="gallery"]').each(function () {
18
- $(this).magnificPopup({
19
- delegate: 'a',
20
- type: 'image',
21
- closeOnContentClick: false,
22
- closeBtnInside: false,
23
- mainClass: 'mfp-with-zoom mfp-img-mobile',
24
- gallery: {
25
- enabled: true
26
- },
27
- zoom: {
28
- enabled: true,
29
- duration: 150
30
- }
31
- })
32
- })
33
- })
@@ -1,51 +0,0 @@
1
- /* global history */
2
-
3
- import $ from 'jquery'
4
-
5
- import { triggerInit } from '../core/events'
6
-
7
- const REMOTE_PAGINATION_SELECTOR = '.page-link[data-remote]'
8
-
9
- $(document)
10
- .on('ajax:send', function (e) {
11
- const $context = $(e.target).closest('[data-context]')
12
- const $table = $context.find('.table-container')
13
- $table.addClass('loading')
14
- })
15
-
16
- .on('ajax:complete', function (e) {
17
- const $context = $(e.target).closest('[data-context]')
18
- const $table = $context.find('.table-container')
19
- $table.removeClass('loading')
20
- })
21
-
22
- .on('ajax:success', REMOTE_PAGINATION_SELECTOR, function (e) {
23
- const $link = $(e.target)
24
- const $context = $link.closest('[data-context]')
25
-
26
- // Update table and pagination
27
- const $doc = $(e.detail[0])
28
-
29
- const $table = $doc.find('.table-container')
30
- $context.find('.table-container').replaceWith($table)
31
-
32
- triggerInit($table)
33
-
34
- const $pagination = $doc.find('.pagination-container')
35
- $context.find('.pagination-container').replaceWith($pagination)
36
-
37
- // Update the URL in the browser and context
38
- const location = $link.attr('href')
39
-
40
- if (location) {
41
- // TODO: Implement URL updating with back button support
42
- // if ($context.hasClass('app-main')) {
43
- // history.pushState({}, '', location)
44
- // }
45
-
46
- $context.data('context', location)
47
- }
48
-
49
- // Scroll to top of table
50
- $table[0].scrollIntoView(true)
51
- })
@@ -1,18 +0,0 @@
1
- import $ from 'jquery'
2
-
3
- import { init } from '../core/events'
4
-
5
- // Use Bootstrap theme
6
- $.fn.select2.defaults.set('theme', 'bootstrap')
7
-
8
- // Copy all classes from select tag to replacement select field (.select2-selection)
9
- $.fn.select2.defaults.set('containerCssClass', ':all:')
10
-
11
- // Copy all classes excluding 'form-control'/'form-control-*' from select tag to dropdown container (.select2-dropdown)
12
- $.fn.select2.defaults.set('dropdownCssClass', function (el) {
13
- return el[0].className.replace(/\s*form-control(-\w+)?\s*/g, '')
14
- })
15
-
16
- init(function (root) {
17
- $(root).find('select[data-enable-select2]').select2()
18
- })
@@ -1,75 +0,0 @@
1
- import $ from 'jquery'
2
-
3
- import { ready } from '../core/events'
4
- import cookie from '../core/cookie'
5
-
6
- import Navigation from './navigation'
7
-
8
- ready(function () {
9
- const $body = $('body')
10
- const $wrapper = $('.app-wrapper')
11
- const $sidebar = $('.app-sidebar')
12
-
13
- // Toggle mobile navigation using menu button
14
-
15
- $sidebar.find('.navbar-toggler').on('click', function (e) {
16
- e.preventDefault()
17
-
18
- $wrapper.addClass('animate')
19
- $body.toggleClass('mobile-nav-expanded')
20
- })
21
-
22
- $wrapper.on('transitionend webkitTransitionEnd', function () {
23
- $(this).removeClass('animate')
24
- })
25
-
26
- // Interacting outside of the sidebar closes the navigation
27
-
28
- $wrapper.on('click touchstart', function (e) {
29
- const navExpanded = $('body').hasClass('mobile-nav-expanded')
30
-
31
- const clickInHeader = $(e.target).closest('.app-header').length
32
- const clickInSidebar = $(e.target).closest('.app-sidebar').length
33
-
34
- if (navExpanded && !clickInHeader && !clickInSidebar) {
35
- e.stopPropagation()
36
- e.preventDefault()
37
-
38
- $wrapper.addClass('animate')
39
- $body.removeClass('mobile-nav-expanded')
40
- }
41
- })
42
-
43
- // Toggle sidebar expand/collapse
44
-
45
- $sidebar.find('.toggle-sidebar').on('click', function (e) {
46
- e.preventDefault()
47
-
48
- if ($body.hasClass('sidebar-expanded') || $body.hasClass('sidebar-collapsed')) {
49
- $body.removeClass('sidebar-expanded').removeClass('sidebar-collapsed')
50
- cookie.delete('trestle:sidebar')
51
- } else if ($(document).width() >= 1200) {
52
- $body.addClass('sidebar-collapsed')
53
- cookie.set('trestle:sidebar', 'collapsed')
54
- } else if ($(document).width() >= 768) {
55
- $body.addClass('sidebar-expanded')
56
- cookie.set('trestle:sidebar', 'expanded')
57
- }
58
- })
59
-
60
- // Toggle navigation groups
61
-
62
- $sidebar.find('.nav-header a').on('click', function (e) {
63
- e.preventDefault()
64
-
65
- const list = $(this).closest('ul')
66
- Navigation.toggle(list)
67
- })
68
-
69
- // Scroll sidebar to active item
70
-
71
- const $active = $sidebar.find('.active')
72
- if ($active.length) {
73
- $sidebar.find('.app-sidebar-inner').scrollTop($active.offset().top - 100)
74
- }
75
- })
@@ -1,61 +0,0 @@
1
- import $ from 'jquery'
2
-
3
- import visit from '../core/visit'
4
-
5
- // Allow clicking on any part of a table row to follow either the table's data-url
6
- // or the first link within the row (that is not in the actions column).
7
- $(document).on('click', 'tr[data-url]:not([data-behavior="dialog"])', function (e) {
8
- const row = $(e.currentTarget)
9
-
10
- let url
11
-
12
- if (row.data('url') === 'auto') {
13
- url = row.find('td:not(.actions) a:first').attr('href')
14
- } else {
15
- url = row.data('url')
16
- }
17
-
18
- if (url) {
19
- if (e.metaKey || e.ctrlKey) {
20
- window.open(url, '_blank')
21
- } else {
22
- visit(url)
23
- }
24
- }
25
- })
26
-
27
- // Ignore the above event handler when clicking directly on a link or input element
28
- $(document).on('click', 'tr[data-url] a, tr[data-url] input, .select-row', function (e) {
29
- e.stopPropagation()
30
- })
31
-
32
- // Handle clicking on select all checkbox in table header
33
- $(document).on('click', 'th.select-row input', function (e) {
34
- const table = $(this).closest('table')
35
- const checked = $(this).is(':checked')
36
-
37
- table.find('td.select-row input').prop('checked', checked)
38
- })
39
-
40
- // Handle single row selection to update header row status
41
- $(document).on('click', 'td.select-row input', function (e) {
42
- const table = $(this).closest('table')
43
-
44
- const checkboxes = table.find('td.select-row input')
45
- const selectedCheckboxes = checkboxes.filter(':checked')
46
-
47
- const header = table.find('th.select-row input')
48
-
49
- if (checkboxes.length === selectedCheckboxes.length) {
50
- // All checked
51
- header.prop('indeterminate', false)
52
- header.prop('checked', true)
53
- } else if (selectedCheckboxes.length === 0) {
54
- // None checked
55
- header.prop('indeterminate', false)
56
- header.prop('checked', false)
57
- } else {
58
- // Some checked
59
- header.prop('indeterminate', true)
60
- }
61
- })
@@ -1,59 +0,0 @@
1
- /* global history, location */
2
-
3
- import $ from 'jquery'
4
-
5
- import { init } from '../core/events'
6
-
7
- const TAB_SELECTOR = 'a[data-toggle="tab"]'
8
- const TAB_PANE_SELECTOR = '.tab-pane'
9
- const ERROR_SELECTOR = '.has-error'
10
-
11
- // Save active tab to URL hash
12
- init(function (root) {
13
- $(root).find(TAB_SELECTOR).on('shown.bs.tab', function (e) {
14
- const hash = $(this).attr('href')
15
- const withinModal = $(this).closest('.modal').length > 0
16
-
17
- if (hash.substr(0, 1) === '#' && !withinModal) {
18
- history.replaceState({ turbolinks: {} }, '', '#!' + hash.substr(1))
19
- }
20
- })
21
- })
22
-
23
- // Restore active tab when loading
24
- init(function () {
25
- focusActiveTab()
26
- })
27
-
28
- // Add error count to tabs
29
- init(function (root) {
30
- $(root).find(TAB_PANE_SELECTOR).each(function () {
31
- const errorCount = $(this).find(ERROR_SELECTOR).length
32
-
33
- if (errorCount > 0) {
34
- const badge = $('<span>').addClass('badge badge-danger badge-pill').text(errorCount)
35
- const id = $(this).attr('id')
36
- const selector = `${TAB_SELECTOR}[href='#${id}']`
37
-
38
- $(selector).append(badge)
39
- }
40
- })
41
- })
42
-
43
- export function focusTab (id) {
44
- const selector = `${TAB_SELECTOR}[href='#${id}']`
45
- $(selector).tab('show')
46
- }
47
-
48
- export function focusActiveTab () {
49
- if (location.hash.substr(0, 2) === '#!') {
50
- // Focus on active tab from URL
51
- focusTab(location.hash.substr(2))
52
- } else {
53
- const $errorTabs = $(`${TAB_PANE_SELECTOR}:has(${ERROR_SELECTOR})`)
54
-
55
- if ($errorTabs.length) {
56
- focusTab($errorTabs.first().attr('id'))
57
- }
58
- }
59
- }
@@ -1,25 +0,0 @@
1
- import $ from 'jquery'
2
-
3
- import { init, ready } from '../core/events'
4
-
5
- // Enable general tooltips and popovers
6
- init(function (root) {
7
- $(root).find('[data-toggle="tooltip"]').tooltip()
8
- $(root).find('[data-toggle="popover"]').popover()
9
- })
10
-
11
- // Enable navigation tooltips for non-touch devices
12
- if (!('ontouchstart' in window)) {
13
- ready(function () {
14
- $(document).tooltip({
15
- selector: '.app-nav a',
16
- trigger: 'hover',
17
- placement: 'right',
18
- boundary: 'window',
19
- template: '<div class="tooltip nav-tooltip" role="tooltip"><div class="arrow"></div><div class="tooltip-inner"></div></div>',
20
- title: function () {
21
- return $(this).find('.nav-label').text()
22
- }
23
- })
24
- })
25
- };
@@ -1,17 +0,0 @@
1
- import $ from 'jquery'
2
-
3
- import { triggerInit } from './events'
4
-
5
- export function refreshContext ($context) {
6
- const url = $context.data('context')
7
-
8
- $.get(url, function (data) {
9
- $context.html(data)
10
- triggerInit($context)
11
- })
12
- }
13
-
14
- export function refreshMainContext () {
15
- const $context = $('.app-main[data-context]')
16
- refreshContext($context)
17
- }
@@ -1,3 +0,0 @@
1
- /* global Turbolinks */
2
-
3
- export default typeof Turbolinks !== 'undefined' && Turbolinks.supported
@@ -1,16 +0,0 @@
1
- /* global Turbolinks */
2
-
3
- import turbolinks from './turbolinks'
4
-
5
- // The visit function is used to direct the user to the given URL. It is provided as an abstraction as the redirection
6
- // is handled differently depending on whether or not Turbolinks is enabled.
7
- //
8
- // Trestle.visit("/admin/pages");
9
- //
10
- export default function (url) {
11
- if (turbolinks) {
12
- Turbolinks.visit(url)
13
- } else {
14
- document.location = url
15
- }
16
- }
@@ -1,4 +0,0 @@
1
- // This file is left as an extension point for user configuration.
2
- //
3
- // It will be overridden by the similarly named file within
4
- // the app/assets folder of the Rails application.
@@ -1,4 +0,0 @@
1
- // This file is left as a (deprecated) extension point for user configuration.
2
- //
3
- // It will be overridden by the similarly named file within
4
- // the app/assets folder of the Rails application.
@@ -1,152 +0,0 @@
1
- // Theme colors to override
2
-
3
- $theme-colors: (
4
- "primary": #4d6bb2
5
- ) !default;
6
-
7
- // Set a specific jump point for requesting color jumps
8
- $theme-color-interval: 8% !default;
9
-
10
- // The yiq lightness value that determines when the lightness of color changes from "dark" to "light". Acceptable values are between 0 and 255.
11
- $yiq-contrasted-threshold: 175 !default;
12
-
13
- // Customize the light and dark text colors for use in our YIQ color contrast function.
14
- $yiq-text-dark: #212529 !default;
15
- $yiq-text-light: #ffffff !default;
16
-
17
-
18
- // Links
19
-
20
- $link-color: theme-color("primary") !default;
21
- $link-hover-color: darken($link-color, 15%) !default;
22
-
23
- // Darken percentage for links with `.text-*` class (e.g. `.text-success`)
24
- $emphasized-link-hover-darken-percentage: 15% !default;
25
-
26
-
27
- // Components
28
-
29
- $component-active-bg: theme-color("primary") !default;
30
-
31
-
32
- // Tables
33
-
34
- $table-bg-level: -11 !default;
35
- $table-border-level: -7 !default;
36
-
37
-
38
- // Buttons + Forms
39
-
40
- $input-btn-focus-width: .2rem !default;
41
- $input-btn-focus-color: rgba($component-active-bg, 0.25) !default;
42
- $input-btn-focus-box-shadow: 0 0 0 $input-btn-focus-width $input-btn-focus-color !default;
43
-
44
- $btn-focus-width: $input-btn-focus-width !default;
45
-
46
-
47
- // Forms
48
-
49
- $input-focus-border-color: lighten($component-active-bg, 25%) !default;
50
- $input-focus-width: $input-btn-focus-width !default;
51
- $input-focus-box-shadow: $input-btn-focus-box-shadow !default;
52
-
53
- $custom-control-indicator-checked-bg: $component-active-bg !default;
54
- $custom-control-indicator-checked-disabled-bg: rgba(theme-color("primary"), 0.5) !default;
55
- $custom-control-indicator-checked-border-color: $custom-control-indicator-checked-bg !default;
56
-
57
- $custom-control-indicator-focus-box-shadow: $input-focus-box-shadow !default;
58
- $custom-control-indicator-focus-border-color: $input-focus-border-color !default;
59
-
60
- $custom-control-indicator-active-bg: lighten($component-active-bg, 35%) !default;
61
- $custom-control-indicator-active-border-color: $custom-control-indicator-active-bg !default;
62
-
63
- $custom-checkbox-indicator-indeterminate-bg: $component-active-bg !default;
64
- $custom-checkbox-indicator-indeterminate-border-color: $custom-checkbox-indicator-indeterminate-bg !default;
65
-
66
- $custom-select-focus-border-color: $input-focus-border-color !default;
67
- $custom-select-focus-width: $input-focus-width !default;
68
- $custom-select-focus-box-shadow: 0 0 0 $custom-select-focus-width $input-btn-focus-color !default;
69
-
70
- $custom-range-thumb-bg: $component-active-bg !default;
71
- $custom-range-thumb-active-bg: lighten($component-active-bg, 35%) !default;
72
-
73
- $custom-file-focus-border-color: $input-focus-border-color !default;
74
- $custom-file-focus-box-shadow: $input-focus-box-shadow !default;
75
-
76
-
77
- // Navs
78
-
79
- $nav-pills-link-active-bg: $component-active-bg !default;
80
-
81
-
82
- // Navbar
83
-
84
- $sidebar-mobile-toggle-bg: transparent !default;
85
- $sidebar-mobile-toggle-color: white !default;
86
- $sidebar-mobile-toggle-border: 1px solid rgba($sidebar-mobile-toggle-color, 0.15) !default;
87
-
88
- $sidebar-mobile-toggle-active-bg: rgba($sidebar-mobile-toggle-color, 0.1) !default;
89
- $sidebar-mobile-toggle-active-border: $sidebar-mobile-toggle-border !default;
90
-
91
- $sidebar-mobile-toggle-icon-bg: str-replace(url("data:image/svg+xml,%3csvg viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3e%3cpath stroke='#{$sidebar-mobile-toggle-color}' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e"), "#", "%23") !default;
92
-
93
-
94
- // Dropdowns
95
-
96
- $dropdown-link-active-bg: $component-active-bg !default;
97
-
98
-
99
- // Pagination
100
-
101
- $pagination-color: $link-color !default;
102
-
103
- $pagination-focus-box-shadow: $input-btn-focus-box-shadow !default;
104
-
105
- $pagination-hover-color: $link-hover-color !default;
106
-
107
- $pagination-active-bg: $component-active-bg !default;
108
- $pagination-active-border-color: $pagination-active-bg !default;
109
-
110
-
111
- // Badges
112
-
113
- $badge-focus-width: $input-btn-focus-width !default;
114
-
115
-
116
- // Alerts
117
-
118
- $alert-bg-level: 2 !default;
119
- $alert-border-level: 3 !default;
120
- $alert-color-level: -12 !default;
121
-
122
-
123
- // Progress bars
124
-
125
- $progress-bar-bg: theme-color("primary") !default;
126
-
127
-
128
- // List group
129
-
130
- $list-group-active-bg: $component-active-bg !default;
131
- $list-group-active-border-color: $list-group-active-bg !default;
132
-
133
-
134
- // Select2
135
-
136
- $s2bs-input-border-focus: $input-focus-border-color !default;
137
- $s2bs-form-control-focus-box-shadow: $input-focus-box-shadow !default;
138
- $s2bs-dropdown-link-active-bg: $dropdown-link-active-bg !default;
139
-
140
-
141
- // Trestle
142
-
143
- $theme-bg: null !default;
144
- $theme-bg-color: darken(theme-color("primary"), 15%) !default;
145
-
146
- $sidebar-active-border-color: theme-color("primary") !default;
147
-
148
- $tag-bg: lighten(theme-color("primary"), 10%) !default;
149
- $tag-border: theme-color("primary") !default;
150
-
151
- $tag-hover-bg: theme-color("primary") !default;
152
- $tag-hover-border: darken(theme-color("primary"), 10%) !default;
@@ -1,44 +0,0 @@
1
- // Replace `$search` with `$replace` in `$string`
2
- @function str-replace($string, $search, $replace: "") {
3
- $index: str-index($string, $search);
4
-
5
- @if $index {
6
- @return str-slice($string, 1, $index - 1) + $replace + str-replace(str-slice($string, $index + str-length($search)), $search, $replace);
7
- }
8
-
9
- @return $string;
10
- }
11
-
12
- // Color contrast
13
- @function color-yiq($color, $dark: $yiq-text-dark, $light: $yiq-text-light) {
14
- $r: red($color);
15
- $g: green($color);
16
- $b: blue($color);
17
-
18
- $yiq: (($r * 299) + ($g * 587) + ($b * 114)) / 1000;
19
-
20
- @if ($yiq >= $yiq-contrasted-threshold) {
21
- @return $dark;
22
- } @else {
23
- @return $light;
24
- }
25
- }
26
-
27
- // Retrieve color Sass maps
28
- @function theme-color($key: "primary") {
29
- @return map-get($theme-colors, $key);
30
- }
31
-
32
- // Request a theme color level
33
- @function theme-color-level($color-name: "primary", $level: 0) {
34
- $color: theme-color($color-name);
35
- $color-base: if($level > 0, black, white);
36
- $level: abs($level);
37
-
38
- @return mix($color-base, $color, $level * $theme-color-interval);
39
- }
40
-
41
- @function gradient-mask($color, $alpha) {
42
- $mask: rgba($color, $alpha);
43
- @return linear-gradient($mask, $mask);
44
- }