trek 2.5.0 → 2.7.0

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 (232) hide show
  1. checksums.yaml +4 -4
  2. data/.node-version +1 -1
  3. data/AGENTS.md +18 -14
  4. data/CHANGELOG.md +88 -0
  5. data/Gemfile +5 -0
  6. data/Gemfile.lock +135 -124
  7. data/Makefile +9 -1
  8. data/README.md +17 -21
  9. data/app/components/trek/dashboard/tile_component/tile_component.css +9 -0
  10. data/app/components/trek/dashboard/tile_component/tile_component.html.slim +4 -2
  11. data/app/components/trek/dashboard/tile_component.rb +12 -2
  12. data/app/components/trek/form/content_editor_component/content_editor_component.css +9 -8
  13. data/app/components/trek/form/content_editor_component/content_editor_component.html.slim +19 -93
  14. data/app/components/trek/form/content_editor_component/content_editor_component.js +94 -251
  15. data/app/components/trek/form/content_editor_component/extensions/block_view.js +40 -0
  16. data/app/components/trek/form/content_editor_component/extensions/image_block.js +28 -26
  17. data/app/components/trek/form/content_editor_component/extensions/prompts_block.js +15 -26
  18. data/app/components/trek/form/content_editor_component/extensions/table_of_contents.js +1 -3
  19. data/app/components/trek/form/content_editor_component.rb +15 -0
  20. data/app/components/trek/form/image_field_component/image_field_component.css +40 -1
  21. data/app/components/trek/form/image_field_component/image_field_component.html.slim +0 -9
  22. data/app/components/trek/form/image_field_component/image_field_component.js +1 -2
  23. data/app/components/trek/form/image_field_component.rb +36 -9
  24. data/app/components/trek/form/password_strength_component/password_strength_component.css +2 -0
  25. data/app/components/trek/form/sound_field_component/sound_field_component.js +1 -2
  26. data/app/components/trek/security_check_component/security_check_component.css +69 -0
  27. data/app/components/trek/security_check_component/security_check_component.html.slim +19 -0
  28. data/app/components/trek/security_check_component/security_check_component.js +15 -0
  29. data/app/components/trek/security_check_component.rb +19 -0
  30. data/app/content/trek/content/cleaner.rb +53 -0
  31. data/app/content/trek/content/document.rb +2 -2
  32. data/app/content/trek/content/list_item.rb +1 -1
  33. data/app/content/trek/content/paragraph.rb +7 -2
  34. data/app/content/trek/content/prompts_block.rb +1 -2
  35. data/app/content/trek/content.rb +6 -0
  36. data/app/controllers/concerns/trek/auditable.rb +5 -2
  37. data/app/controllers/concerns/trek/localization.rb +6 -2
  38. data/app/controllers/concerns/trek/reorderable.rb +24 -6
  39. data/app/controllers/trek/csp_reports_controller.rb +14 -1
  40. data/app/controllers/trek/panels/prompts_controller.rb +1 -1
  41. data/app/controllers/trek/resource_controller.rb +5 -5
  42. data/app/jobs/trek/purge_expired_sessions_job.rb +4 -3
  43. data/app/jobs/trek/purge_expired_sign_in_codes_job.rb +15 -0
  44. data/app/models/concerns/trek/contentable.rb +15 -1
  45. data/app/models/concerns/trek/users/sign_in_code.rb +70 -0
  46. data/app/models/concerns/trek/users/sign_in_lockout.rb +4 -2
  47. data/app/policies/trek/security_check_policy.rb +8 -0
  48. data/app/uploaders/image_uploader.rb +77 -15
  49. data/app/views/trek/panels/links/_form.html.slim +2 -4
  50. data/app/views/trek/panels/prompts/create.turbo_stream.slim +0 -1
  51. data/config/locales/trek.en.yml +97 -11
  52. data/config/locales/trek.fr.yml +97 -11
  53. data/docs/.vitepress/config.mjs +5 -1
  54. data/docs/background-jobs.md +74 -0
  55. data/docs/content-editor.md +219 -0
  56. data/docs/customize.md +2 -0
  57. data/docs/deploy.md +69 -6
  58. data/docs/getting-started.md +16 -18
  59. data/docs/index.md +2 -2
  60. data/docs/personal-data.md +61 -0
  61. data/docs/proxies.md +2 -2
  62. data/docs/reference/components.md +4 -4
  63. data/docs/reference/concerns/contentable.md +10 -4
  64. data/docs/reference/concerns/formattable.md +1 -1
  65. data/docs/reference/concerns/fragmentable.md +12 -6
  66. data/docs/reference/concerns/orderable.md +2 -2
  67. data/docs/reference/concerns/search-engine-optimizable.md +1 -1
  68. data/docs/reference/concerns/searchable.md +14 -1
  69. data/docs/reference/concerns/sectionable.md +7 -3
  70. data/docs/reference/concerns/versionable.md +1 -1
  71. data/docs/reference/controllers.md +33 -1
  72. data/docs/reference/environment-variables.md +3 -2
  73. data/docs/reference/formatters.md +4 -31
  74. data/docs/reference/forms.md +7 -4
  75. data/docs/reference/generators/admin-user.md +1 -1
  76. data/docs/reference/generators/audit-log.md +12 -13
  77. data/docs/reference/generators/install.md +23 -11
  78. data/docs/reference/generators/public-accounts.md +159 -0
  79. data/docs/reference/generators/scaffold.md +28 -9
  80. data/docs/reference/generators/security-headers.md +5 -4
  81. data/docs/reference/generators/taxonomies.md +1 -1
  82. data/docs/reference/icons.md +5 -3
  83. data/docs/reference/index.md +10 -7
  84. data/docs/reference/models/current.md +5 -3
  85. data/docs/reference/models/page-version.md +1 -1
  86. data/docs/reference/models/user.md +7 -8
  87. data/docs/reference/uploaders.md +25 -0
  88. data/docs/reference/validators.md +1 -1
  89. data/docs/security.md +30 -9
  90. data/docs/what-is-trek.md +4 -4
  91. data/lib/generators/trek/USAGE +1 -1
  92. data/lib/generators/trek/audit_log_generator.rb +62 -0
  93. data/lib/generators/trek/helpers.rb +17 -0
  94. data/lib/generators/trek/install/admin/routes_generator.rb +2 -1
  95. data/lib/generators/trek/install/admin/security_check_generator.rb +36 -0
  96. data/lib/generators/trek/install/admin/users_generator.rb +6 -1
  97. data/lib/generators/trek/install/audit_log_generator.rb +9 -45
  98. data/lib/generators/trek/install/ci_generator.rb +19 -0
  99. data/lib/generators/trek/install/good_job_generator.rb +161 -0
  100. data/lib/generators/trek/install/model_specs_generator.rb +3 -3
  101. data/lib/generators/trek/install/postcss_generator.rb +1 -2
  102. data/lib/generators/trek/install/ruby_generator.rb +1 -1
  103. data/lib/generators/trek/install/scalingo_generator.rb +7 -45
  104. data/lib/generators/trek/install/translations_generator.rb +1 -2
  105. data/lib/generators/trek/install_generator.rb +18 -2
  106. data/lib/generators/trek/public_accounts_generator.rb +294 -0
  107. data/lib/generators/trek/scaffold_generator.rb +22 -21
  108. data/lib/generators/trek/scalingo_generator.rb +67 -0
  109. data/lib/generators/trek/templates/.gitlab-ci.yml +10 -1
  110. data/lib/generators/trek/templates/AGENTS.md +2 -2
  111. data/lib/generators/trek/templates/Makefile +1 -0
  112. data/lib/generators/trek/templates/config/i18n-tasks.yml.erb +0 -8
  113. data/lib/generators/trek/templates/controllers/admin/password_renewals_controller.rb +11 -0
  114. data/lib/generators/trek/templates/controllers/admin/security_checks_controller.rb +11 -0
  115. data/lib/generators/trek/templates/controllers/admin/user_sessions_controller.rb +1 -1
  116. data/lib/generators/trek/templates/controllers/admin/users_controller.rb +0 -8
  117. data/lib/generators/trek/templates/controllers/concerns/trek/authentication.rb +13 -4
  118. data/lib/generators/trek/templates/initializers/content_security_policy.rb +3 -2
  119. data/lib/generators/trek/templates/initializers/good_job.rb.tt +40 -0
  120. data/lib/generators/trek/templates/jobs/mail_delivery_job.rb +6 -0
  121. data/lib/generators/trek/templates/layouts/admin.html.slim +10 -0
  122. data/lib/generators/trek/templates/mailers/admin_mailer.rb +4 -2
  123. data/lib/generators/trek/templates/package.json.tt +1 -1
  124. data/lib/generators/trek/templates/policies/security_check.rb +4 -0
  125. data/lib/generators/trek/templates/public_accounts/api/authentication.rb.tt +76 -0
  126. data/lib/generators/trek/templates/public_accounts/api/controllers/accounts_controller.rb.tt +22 -0
  127. data/lib/generators/trek/templates/public_accounts/api/controllers/active_sessions_controller.rb.tt +21 -0
  128. data/lib/generators/trek/templates/public_accounts/api/controllers/base_controller.rb.tt +71 -0
  129. data/lib/generators/trek/templates/public_accounts/api/controllers/email_changes_controller.rb.tt +55 -0
  130. data/lib/generators/trek/templates/public_accounts/api/controllers/email_confirmations_controller.rb.tt +19 -0
  131. data/lib/generators/trek/templates/public_accounts/api/controllers/password_resets_controller.rb.tt +28 -0
  132. data/lib/generators/trek/templates/public_accounts/api/controllers/passwords_controller.rb.tt +17 -0
  133. data/lib/generators/trek/templates/public_accounts/api/controllers/registrations_controller.rb.tt +17 -0
  134. data/lib/generators/trek/templates/public_accounts/api/controllers/sessions_controller.rb.tt +57 -0
  135. data/lib/generators/trek/templates/public_accounts/api/controllers/sign_in_codes_controller.rb.tt +20 -0
  136. data/lib/generators/trek/templates/public_accounts/jobs/sign_in_code_job.rb.tt +23 -0
  137. data/lib/generators/trek/templates/public_accounts/locales/accounts.en.yml.tt +215 -0
  138. data/lib/generators/trek/templates/public_accounts/locales/accounts.fr.yml.tt +215 -0
  139. data/lib/generators/trek/templates/public_accounts/mailers/account_mailer.rb.tt +85 -0
  140. data/lib/generators/trek/templates/public_accounts/migrations/create_accounts.rb.tt +46 -0
  141. data/lib/generators/trek/templates/public_accounts/models/account/session.rb.tt +47 -0
  142. data/lib/generators/trek/templates/public_accounts/models/account/sign_in_code.rb.tt +8 -0
  143. data/lib/generators/trek/templates/public_accounts/models/account.rb.tt +87 -0
  144. data/lib/generators/trek/templates/public_accounts/spec/api/accounts_spec.rb.tt +90 -0
  145. data/lib/generators/trek/templates/public_accounts/spec/api/sign_ins_spec.rb.tt +188 -0
  146. data/lib/generators/trek/templates/public_accounts/spec/models/account/sign_in_code_spec.rb.tt +66 -0
  147. data/lib/generators/trek/templates/public_accounts/spec/models/account_spec.rb.tt +129 -0
  148. data/lib/generators/trek/templates/public_accounts/spec/web/accounts_spec.rb.tt +126 -0
  149. data/lib/generators/trek/templates/public_accounts/spec/web/authentication_spec.rb.tt +43 -0
  150. data/lib/generators/trek/templates/public_accounts/spec/web/sign_ins_spec.rb.tt +237 -0
  151. data/lib/generators/trek/templates/public_accounts/views/mailer/email_change.en.html.slim.tt +10 -0
  152. data/lib/generators/trek/templates/public_accounts/views/mailer/email_change.en.text.erb.tt +8 -0
  153. data/lib/generators/trek/templates/public_accounts/views/mailer/email_change.fr.html.slim.tt +13 -0
  154. data/lib/generators/trek/templates/public_accounts/views/mailer/email_change.fr.text.erb.tt +8 -0
  155. data/lib/generators/trek/templates/public_accounts/views/mailer/email_change_code.en.html.slim.tt +9 -0
  156. data/lib/generators/trek/templates/public_accounts/views/mailer/email_change_code.en.text.erb.tt +11 -0
  157. data/lib/generators/trek/templates/public_accounts/views/mailer/email_change_code.fr.html.slim.tt +11 -0
  158. data/lib/generators/trek/templates/public_accounts/views/mailer/email_change_code.fr.text.erb.tt +11 -0
  159. data/lib/generators/trek/templates/public_accounts/views/mailer/email_confirmation.en.html.slim.tt +10 -0
  160. data/lib/generators/trek/templates/public_accounts/views/mailer/email_confirmation.en.text.erb.tt +8 -0
  161. data/lib/generators/trek/templates/public_accounts/views/mailer/email_confirmation.fr.html.slim.tt +10 -0
  162. data/lib/generators/trek/templates/public_accounts/views/mailer/email_confirmation.fr.text.erb.tt +8 -0
  163. data/lib/generators/trek/templates/public_accounts/views/mailer/password_reset.en.html.slim.tt +10 -0
  164. data/lib/generators/trek/templates/public_accounts/views/mailer/password_reset.en.text.erb.tt +8 -0
  165. data/lib/generators/trek/templates/public_accounts/views/mailer/password_reset.fr.html.slim.tt +13 -0
  166. data/lib/generators/trek/templates/public_accounts/views/mailer/password_reset.fr.text.erb.tt +8 -0
  167. data/lib/generators/trek/templates/public_accounts/views/mailer/sign_in_code.en.html.slim.tt +9 -0
  168. data/lib/generators/trek/templates/public_accounts/views/mailer/sign_in_code.en.text.erb.tt +11 -0
  169. data/lib/generators/trek/templates/public_accounts/views/mailer/sign_in_code.fr.html.slim.tt +9 -0
  170. data/lib/generators/trek/templates/public_accounts/views/mailer/sign_in_code.fr.text.erb.tt +11 -0
  171. data/lib/generators/trek/templates/public_accounts/views/mailer/sign_in_locked.en.html.slim.tt +23 -0
  172. data/lib/generators/trek/templates/public_accounts/views/mailer/sign_in_locked.en.text.erb.tt +14 -0
  173. data/lib/generators/trek/templates/public_accounts/views/mailer/sign_in_locked.fr.html.slim.tt +24 -0
  174. data/lib/generators/trek/templates/public_accounts/views/mailer/sign_in_locked.fr.text.erb.tt +14 -0
  175. data/lib/generators/trek/templates/public_accounts/web/authentication.rb.tt +97 -0
  176. data/lib/generators/trek/templates/public_accounts/web/controllers/accounts_controller.rb.tt +33 -0
  177. data/lib/generators/trek/templates/public_accounts/web/controllers/active_sessions_controller.rb.tt +15 -0
  178. data/lib/generators/trek/templates/public_accounts/web/controllers/base_controller.rb.tt +52 -0
  179. data/lib/generators/trek/templates/public_accounts/web/controllers/email_changes_controller.rb.tt +85 -0
  180. data/lib/generators/trek/templates/public_accounts/web/controllers/email_confirmations_controller.rb.tt +19 -0
  181. data/lib/generators/trek/templates/public_accounts/web/controllers/password_resets_controller.rb.tt +41 -0
  182. data/lib/generators/trek/templates/public_accounts/web/controllers/passwords_controller.rb.tt +23 -0
  183. data/lib/generators/trek/templates/public_accounts/web/controllers/registrations_controller.rb.tt +24 -0
  184. data/lib/generators/trek/templates/public_accounts/web/controllers/sessions_controller.rb.tt +85 -0
  185. data/lib/generators/trek/templates/public_accounts/web/controllers/sign_in_codes_controller.rb.tt +32 -0
  186. data/lib/generators/trek/templates/public_accounts/web/views/_flash.html.slim.tt +5 -0
  187. data/lib/generators/trek/templates/public_accounts/web/views/accounts/show.html.slim.tt +52 -0
  188. data/lib/generators/trek/templates/public_accounts/web/views/email_changes/edit.html.slim.tt +17 -0
  189. data/lib/generators/trek/templates/public_accounts/web/views/email_changes/new.html.slim.tt +15 -0
  190. data/lib/generators/trek/templates/public_accounts/web/views/password_resets/edit.html.slim.tt +29 -0
  191. data/lib/generators/trek/templates/public_accounts/web/views/password_resets/new.html.slim.tt +15 -0
  192. data/lib/generators/trek/templates/public_accounts/web/views/passwords/edit.html.slim.tt +28 -0
  193. data/lib/generators/trek/templates/public_accounts/web/views/registrations/new.html.slim.tt +30 -0
  194. data/lib/generators/trek/templates/public_accounts/web/views/sessions/new.html.slim.tt +40 -0
  195. data/lib/generators/trek/templates/public_accounts/web/views/sign_in_codes/new.html.slim.tt +17 -0
  196. data/lib/generators/trek/templates/spec/jobs/mail_delivery_job_spec.rb +11 -0
  197. data/lib/generators/trek/templates/spec/mailers/admin_mailer_spec.rb +10 -0
  198. data/lib/generators/trek/templates/spec/requests/admin/fragments_spec.rb +1 -1
  199. data/lib/generators/trek/templates/spec/requests/admin/good_job_spec.rb +34 -0
  200. data/lib/generators/trek/templates/spec/requests/admin/pages_spec.rb +12 -1
  201. data/lib/generators/trek/templates/spec/requests/admin/panels_spec.rb +16 -0
  202. data/lib/generators/trek/templates/spec/requests/admin/password_renewal_spec.rb +2 -2
  203. data/lib/generators/trek/templates/spec/requests/admin/security_checks_spec.rb +24 -0
  204. data/lib/generators/trek/templates/spec/requests/admin/sign_in_lockout_spec.rb +1 -1
  205. data/lib/generators/trek/templates/spec/requests/admin/sign_in_notices_spec.rb +33 -0
  206. data/lib/generators/trek/templates/spec/requests/admin/user_sessions_spec.rb +2 -2
  207. data/lib/generators/trek/templates/views/admin/pages/_form.html.slim +1 -1
  208. data/lib/generators/trek/templates/views/admin/security_checks/show.html.slim +9 -0
  209. data/lib/generators/trek/templates/views/admin/user_password_resets/edit.html.slim +6 -1
  210. data/lib/generators/trek/templates/views/admin/user_sessions/new.html.slim +4 -1
  211. data/lib/generators/trek/templates/views/admin/users/index.html.slim +1 -1
  212. data/lib/generators/trek/templates/views/admin_mailer/new_sign_in.en.html.slim +1 -1
  213. data/lib/generators/trek/templates/views/admin_mailer/new_sign_in.en.text.erb +1 -1
  214. data/lib/generators/trek/templates/views/admin_mailer/new_sign_in.fr.html.slim +1 -1
  215. data/lib/generators/trek/templates/views/admin_mailer/new_sign_in.fr.text.erb +1 -1
  216. data/lib/tasks/trek/attachments.rake +12 -0
  217. data/lib/tasks/trek/security.rake +10 -0
  218. data/lib/trek/csp_reports.rb +22 -4
  219. data/lib/trek/disposable_email_domains.rb +9 -20
  220. data/lib/trek/engine.rb +5 -0
  221. data/lib/trek/json_compatibility.rb +20 -0
  222. data/lib/trek/security_check.rb +241 -0
  223. data/lib/trek/stored_image_metadata.rb +88 -0
  224. data/lib/trek/typography_formatter.rb +35 -4
  225. data/lib/trek/version.rb +1 -1
  226. data/lib/trek.rb +2 -1
  227. data/package.json +16 -13
  228. data/postcss.config.js +0 -3
  229. data/trek.gemspec +6 -7
  230. data/vitest.config.mjs +24 -0
  231. data/yarn.lock +1667 -1010
  232. metadata +122 -33
data/Gemfile.lock CHANGED
@@ -1,28 +1,27 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- trek (2.5.0)
4
+ trek (2.7.0)
5
5
  action_policy (~> 0.6)
6
6
  actioncable
7
7
  acts_as_list (~> 1.1)
8
8
  aws-sdk-s3 (~> 1.117)
9
9
  blurhash (~> 0.1)
10
10
  closure_tree (~> 9.0)
11
- deepl-rb (~> 3.0)
12
11
  dry-initializer (~> 3.1)
13
12
  email_validator (~> 2.2)
14
13
  fastimage (~> 2.2)
15
14
  http_accept_language (~> 2.1)
16
15
  i18n-tasks (~> 1.0)
17
16
  image_processing (~> 1.8)
18
- json (< 3)
19
17
  kaminari
20
18
  listen
21
19
  lookbook (>= 2.3.13)
22
20
  mobility (~> 1.3.2)
23
21
  phonelib (~> 0.8)
24
22
  postmark-rails
25
- prosemirror (>= 0.7.1, < 2)
23
+ prism (< 2)
24
+ prosemirror (>= 1.0, < 2)
26
25
  rails (>= 8.0, < 8.2)
27
26
  rails-healthcheck
28
27
  rails-i18n (>= 6.0)
@@ -32,7 +31,7 @@ PATH
32
31
  strip_attributes (~> 2.0)
33
32
  time_for_a_boolean (~> 0.3)
34
33
  turbo-rails (>= 1.0)
35
- valid_email2 (~> 7.1)
34
+ valid_email2 (~> 7.2)
36
35
  view_component (< 5.0)
37
36
  view_component-form (~> 0.3)
38
37
  webauthn (~> 3.4)
@@ -41,33 +40,33 @@ PATH
41
40
  GEM
42
41
  remote: https://rubygems.org/
43
42
  specs:
44
- action_policy (0.7.7)
43
+ action_policy (0.7.8)
45
44
  ruby-next-core (>= 1.0)
46
45
  action_text-trix (2.1.19)
47
46
  railties
48
- actioncable (8.1.4)
49
- actionpack (= 8.1.4)
50
- activesupport (= 8.1.4)
47
+ actioncable (8.1.4.1)
48
+ actionpack (= 8.1.4.1)
49
+ activesupport (= 8.1.4.1)
51
50
  nio4r (~> 2.0)
52
51
  websocket-driver (>= 0.6.1)
53
52
  zeitwerk (~> 2.6)
54
- actionmailbox (8.1.4)
55
- actionpack (= 8.1.4)
56
- activejob (= 8.1.4)
57
- activerecord (= 8.1.4)
58
- activestorage (= 8.1.4)
59
- activesupport (= 8.1.4)
53
+ actionmailbox (8.1.4.1)
54
+ actionpack (= 8.1.4.1)
55
+ activejob (= 8.1.4.1)
56
+ activerecord (= 8.1.4.1)
57
+ activestorage (= 8.1.4.1)
58
+ activesupport (= 8.1.4.1)
60
59
  mail (>= 2.8.0)
61
- actionmailer (8.1.4)
62
- actionpack (= 8.1.4)
63
- actionview (= 8.1.4)
64
- activejob (= 8.1.4)
65
- activesupport (= 8.1.4)
60
+ actionmailer (8.1.4.1)
61
+ actionpack (= 8.1.4.1)
62
+ actionview (= 8.1.4.1)
63
+ activejob (= 8.1.4.1)
64
+ activesupport (= 8.1.4.1)
66
65
  mail (>= 2.8.0)
67
66
  rails-dom-testing (~> 2.2)
68
- actionpack (8.1.4)
69
- actionview (= 8.1.4)
70
- activesupport (= 8.1.4)
67
+ actionpack (8.1.4.1)
68
+ actionview (= 8.1.4.1)
69
+ activesupport (= 8.1.4.1)
71
70
  nokogiri (>= 1.8.5)
72
71
  rack (>= 2.2.4)
73
72
  rack-session (>= 1.0.1)
@@ -75,36 +74,36 @@ GEM
75
74
  rails-dom-testing (~> 2.2)
76
75
  rails-html-sanitizer (~> 1.6)
77
76
  useragent (~> 0.16)
78
- actiontext (8.1.4)
77
+ actiontext (8.1.4.1)
79
78
  action_text-trix (~> 2.1.15)
80
- actionpack (= 8.1.4)
81
- activerecord (= 8.1.4)
82
- activestorage (= 8.1.4)
83
- activesupport (= 8.1.4)
79
+ actionpack (= 8.1.4.1)
80
+ activerecord (= 8.1.4.1)
81
+ activestorage (= 8.1.4.1)
82
+ activesupport (= 8.1.4.1)
84
83
  globalid (>= 0.6.0)
85
84
  nokogiri (>= 1.8.5)
86
- actionview (8.1.4)
87
- activesupport (= 8.1.4)
85
+ actionview (8.1.4.1)
86
+ activesupport (= 8.1.4.1)
88
87
  builder (~> 3.1)
89
88
  erubi (~> 1.11)
90
89
  rails-dom-testing (~> 2.2)
91
- rails-html-sanitizer (~> 1.6)
92
- activejob (8.1.4)
93
- activesupport (= 8.1.4)
90
+ rails-html-sanitizer (~> 1.6, >= 1.7.2)
91
+ activejob (8.1.4.1)
92
+ activesupport (= 8.1.4.1)
94
93
  globalid (>= 0.3.6)
95
- activemodel (8.1.4)
96
- activesupport (= 8.1.4)
97
- activerecord (8.1.4)
98
- activemodel (= 8.1.4)
99
- activesupport (= 8.1.4)
94
+ activemodel (8.1.4.1)
95
+ activesupport (= 8.1.4.1)
96
+ activerecord (8.1.4.1)
97
+ activemodel (= 8.1.4.1)
98
+ activesupport (= 8.1.4.1)
100
99
  timeout (>= 0.4.0)
101
- activestorage (8.1.4)
102
- actionpack (= 8.1.4)
103
- activejob (= 8.1.4)
104
- activerecord (= 8.1.4)
105
- activesupport (= 8.1.4)
100
+ activestorage (8.1.4.1)
101
+ actionpack (= 8.1.4.1)
102
+ activejob (= 8.1.4.1)
103
+ activerecord (= 8.1.4.1)
104
+ activesupport (= 8.1.4.1)
106
105
  marcel (~> 1.0)
107
- activesupport (8.1.4)
106
+ activesupport (8.1.4.1)
108
107
  base64
109
108
  bigdecimal
110
109
  concurrent-ruby (~> 1.0, >= 1.3.1)
@@ -120,14 +119,14 @@ GEM
120
119
  acts_as_list (1.2.6)
121
120
  activerecord (>= 6.1)
122
121
  activesupport (>= 6.1)
123
- addressable (2.9.0)
122
+ addressable (2.9.2)
124
123
  public_suffix (>= 2.0.2, < 8.0)
125
124
  android_key_attestation (0.3.0)
126
125
  ast (2.4.3)
127
- aws-eventstream (1.4.0)
128
- aws-partitions (1.1296.0)
129
- aws-sdk-core (3.258.0)
130
- aws-eventstream (~> 1, >= 1.3.0)
126
+ aws-eventstream (1.4.1)
127
+ aws-partitions (1.1305.0)
128
+ aws-sdk-core (3.268.0)
129
+ aws-eventstream (~> 1, >= 1.4.1)
131
130
  aws-partitions (~> 1, >= 1.992.0)
132
131
  aws-sigv4 (~> 1.9)
133
132
  base64
@@ -135,11 +134,11 @@ GEM
135
134
  jmespath (~> 1, >= 1.6.1)
136
135
  logger
137
136
  rexml (~> 3.4, >= 3.4.2)
138
- aws-sdk-kms (1.133.0)
139
- aws-sdk-core (~> 3, >= 3.258.0)
137
+ aws-sdk-kms (1.143.0)
138
+ aws-sdk-core (~> 3, >= 3.268.0)
140
139
  aws-sigv4 (~> 1.5)
141
- aws-sdk-s3 (1.234.0)
142
- aws-sdk-core (~> 3, >= 3.258.0)
140
+ aws-sdk-s3 (1.242.0)
141
+ aws-sdk-core (~> 3, >= 3.268.0)
143
142
  aws-sdk-kms (~> 1)
144
143
  aws-sigv4 (~> 1.5)
145
144
  aws-sigv4 (1.12.1)
@@ -164,7 +163,7 @@ GEM
164
163
  rack-test (>= 0.6.3)
165
164
  regexp_parser (>= 1.5, < 3.0)
166
165
  xpath (~> 3.2)
167
- cbor (0.5.10.3)
166
+ cbor (0.6.2.2)
168
167
  closure_tree (9.8.0)
169
168
  activerecord (>= 7.2.0)
170
169
  with_advisory_lock (>= 7.6.0)
@@ -172,19 +171,21 @@ GEM
172
171
  concurrent-ruby (1.3.8)
173
172
  connection_pool (3.0.2)
174
173
  content_disposition (1.0.0)
175
- cose (1.3.1)
176
- cbor (~> 0.5.9)
174
+ cose (1.4.0)
175
+ cbor (~> 0.6.2.2)
177
176
  openssl-signature_algorithm (~> 1.0)
178
177
  crass (1.0.8)
179
- css_parser (3.3.0)
178
+ css_parser (3.4.0)
180
179
  addressable
181
180
  base64
182
181
  ssrf_filter (~> 1.5)
182
+ cuprite (0.20.1)
183
+ capybara (~> 3.0)
184
+ ferrum (~> 0.20.1)
183
185
  date (3.6.0)
184
- deepl-rb (3.9.0)
185
186
  diff-lcs (1.6.2)
186
187
  docile (1.4.1)
187
- down (5.6.1)
188
+ down (5.6.2)
188
189
  addressable (~> 2.8)
189
190
  base64 (~> 0.3)
190
191
  drb (2.2.3)
@@ -221,7 +222,12 @@ GEM
221
222
  activemodel
222
223
  erb (6.0.7)
223
224
  erubi (1.13.1)
224
- fastimage (2.4.1)
225
+ fastimage (2.4.3)
226
+ ferrum (0.20.1)
227
+ addressable (~> 2.5)
228
+ base64 (~> 0.2)
229
+ concurrent-ruby (~> 1.1)
230
+ websocket-driver (~> 0.7)
225
231
  ffi (1.17.4-arm64-darwin)
226
232
  ffi (1.17.4-x86_64-darwin)
227
233
  ffi (1.17.4-x86_64-linux-gnu)
@@ -234,14 +240,14 @@ GEM
234
240
  http_accept_language (2.1.1)
235
241
  i18n (1.15.2)
236
242
  concurrent-ruby (~> 1.0)
237
- i18n-tasks (1.1.2)
243
+ i18n-tasks (1.2.1)
238
244
  activesupport (>= 4.0.2)
239
245
  ast (>= 2.1.0)
240
246
  erubi
241
247
  highline (>= 3.0.0)
242
248
  i18n
243
249
  parser (>= 3.2.2.1)
244
- prism
250
+ prism (>= 0.28)
245
251
  rails-i18n
246
252
  rainbow (>= 2.2.2, < 4.0)
247
253
  ruby-progressbar (~> 1.8, >= 1.8.1)
@@ -249,28 +255,28 @@ GEM
249
255
  image_processing (1.14.0)
250
256
  mini_magick (>= 4.9.5, < 6)
251
257
  ruby-vips (>= 2.0.17, < 3)
252
- io-console (0.9.4)
253
- irb (1.18.0)
258
+ io-console (0.9.5)
259
+ irb (1.19.0)
254
260
  pp (>= 0.6.0)
255
261
  prism (>= 1.3.0)
256
262
  rdoc (>= 4.0.0)
257
263
  reline (>= 0.4.2)
258
264
  jmespath (1.6.2)
259
- json (2.21.2)
265
+ json (3.1.0)
260
266
  jwt (3.3.0)
261
267
  base64
262
- kaminari (1.3.0)
268
+ kaminari (1.3.3)
263
269
  activesupport (>= 4.1.0)
264
- kaminari-actionview (= 1.3.0)
265
- kaminari-activerecord (= 1.3.0)
266
- kaminari-core (= 1.3.0)
267
- kaminari-actionview (1.3.0)
270
+ kaminari-actionview (= 1.3.3)
271
+ kaminari-activerecord (= 1.3.3)
272
+ kaminari-core (= 1.3.3)
273
+ kaminari-actionview (1.3.3)
268
274
  actionview
269
- kaminari-core (= 1.3.0)
270
- kaminari-activerecord (1.3.0)
275
+ kaminari-core (= 1.3.3)
276
+ kaminari-activerecord (1.3.3)
271
277
  activerecord
272
- kaminari-core (= 1.3.0)
273
- kaminari-core (1.3.0)
278
+ kaminari-core (= 1.3.3)
279
+ kaminari-core (1.3.3)
274
280
  language_server-protocol (3.17.0.6)
275
281
  lint_roller (1.1.0)
276
282
  listen (3.10.1)
@@ -280,9 +286,9 @@ GEM
280
286
  literal (1.9.0)
281
287
  zeitwerk
282
288
  logger (1.7.0)
283
- loofah (2.25.2)
289
+ loofah (2.25.3)
284
290
  crass (~> 1.0.2)
285
- nokogiri (>= 1.12.0)
291
+ nokogiri (>= 1.19.5)
286
292
  lookbook (2.3.15)
287
293
  activemodel
288
294
  css_parser
@@ -306,9 +312,9 @@ GEM
306
312
  mini_magick (5.4.0)
307
313
  logger
308
314
  mini_mime (1.1.5)
309
- minitest (6.0.6)
315
+ minitest (6.1.0)
310
316
  drb (~> 2.0)
311
- prism (~> 1.5)
317
+ prism (>= 1.5, < 3)
312
318
  mobility (1.3.2)
313
319
  i18n (>= 0.6.10, < 2)
314
320
  request_store (~> 1.0)
@@ -322,18 +328,18 @@ GEM
322
328
  net-smtp (0.5.2)
323
329
  net-protocol
324
330
  nio4r (2.7.5)
325
- nokogiri (1.19.4-arm64-darwin)
331
+ nokogiri (1.19.7-arm64-darwin)
326
332
  racc (~> 1.4)
327
- nokogiri (1.19.4-x86_64-darwin)
333
+ nokogiri (1.19.7-x86_64-darwin)
328
334
  racc (~> 1.4)
329
- nokogiri (1.19.4-x86_64-linux-gnu)
335
+ nokogiri (1.19.7-x86_64-linux-gnu)
330
336
  racc (~> 1.4)
331
337
  oaken (1.0.0)
332
338
  openssl (4.0.2)
333
339
  openssl-signature_algorithm (1.3.0)
334
340
  openssl (> 2.0)
335
341
  parallel (2.3.0)
336
- parser (3.3.12.0)
342
+ parser (3.3.13.0)
337
343
  ast (~> 2.4.1)
338
344
  racc
339
345
  pg (1.7.0-arm64-darwin)
@@ -342,7 +348,7 @@ GEM
342
348
  phlex (2.4.1)
343
349
  refract (~> 1.0)
344
350
  zeitwerk (~> 2.7)
345
- phonelib (0.10.27)
351
+ phonelib (0.11.0)
346
352
  postmark (1.25.1)
347
353
  json
348
354
  postmark-rails (0.22.1)
@@ -352,34 +358,36 @@ GEM
352
358
  prettyprint
353
359
  prettyprint (0.2.1)
354
360
  prism (1.9.0)
355
- prosemirror (0.7.1)
361
+ prosemirror (1.1.0)
356
362
  literal (~> 1.9)
357
363
  phlex (~> 2.4)
358
364
  zeitwerk (~> 2.6)
359
365
  public_suffix (7.0.5)
366
+ puma (8.1.1)
367
+ nio4r (~> 2.0)
360
368
  racc (1.8.1)
361
- rack (3.2.7)
369
+ rack (3.2.8)
362
370
  rack-session (2.1.2)
363
371
  base64 (>= 0.1.0)
364
372
  rack (>= 3.0.0)
365
- rack-test (2.2.0)
373
+ rack-test (2.3.0)
366
374
  rack (>= 1.3)
367
375
  rackup (2.3.1)
368
376
  rack (>= 3)
369
- rails (8.1.4)
370
- actioncable (= 8.1.4)
371
- actionmailbox (= 8.1.4)
372
- actionmailer (= 8.1.4)
373
- actionpack (= 8.1.4)
374
- actiontext (= 8.1.4)
375
- actionview (= 8.1.4)
376
- activejob (= 8.1.4)
377
- activemodel (= 8.1.4)
378
- activerecord (= 8.1.4)
379
- activestorage (= 8.1.4)
380
- activesupport (= 8.1.4)
377
+ rails (8.1.4.1)
378
+ actioncable (= 8.1.4.1)
379
+ actionmailbox (= 8.1.4.1)
380
+ actionmailer (= 8.1.4.1)
381
+ actionpack (= 8.1.4.1)
382
+ actiontext (= 8.1.4.1)
383
+ actionview (= 8.1.4.1)
384
+ activejob (= 8.1.4.1)
385
+ activemodel (= 8.1.4.1)
386
+ activerecord (= 8.1.4.1)
387
+ activestorage (= 8.1.4.1)
388
+ activesupport (= 8.1.4.1)
381
389
  bundler (>= 1.15.0)
382
- railties (= 8.1.4)
390
+ railties (= 8.1.4.1)
383
391
  rails-dom-testing (2.3.0)
384
392
  activesupport (>= 5.0.0)
385
393
  minitest
@@ -387,15 +395,15 @@ GEM
387
395
  rails-healthcheck (1.4.0)
388
396
  actionpack
389
397
  railties
390
- rails-html-sanitizer (1.7.1)
391
- loofah (~> 2.25, >= 2.25.2)
398
+ rails-html-sanitizer (1.7.2)
399
+ loofah (~> 2.25, >= 2.25.3)
392
400
  nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
393
401
  rails-i18n (8.1.0)
394
402
  i18n (>= 0.7, < 2)
395
403
  railties (>= 8.0.0, < 9)
396
- railties (8.1.4)
397
- actionpack (= 8.1.4)
398
- activesupport (= 8.1.4)
404
+ railties (8.1.4.1)
405
+ actionpack (= 8.1.4.1)
406
+ activesupport (= 8.1.4.1)
399
407
  irb (~> 1.13)
400
408
  rackup (>= 1.0.0)
401
409
  rake (>= 12.2)
@@ -438,18 +446,18 @@ GEM
438
446
  rspec-core (~> 3.13.0)
439
447
  rspec-expectations (~> 3.13.0)
440
448
  rspec-mocks (~> 3.13.0)
441
- rspec-core (3.13.6)
449
+ rspec-core (3.13.7)
442
450
  rspec-support (~> 3.13.0)
443
- rspec-expectations (3.13.5)
451
+ rspec-expectations (3.13.6)
444
452
  diff-lcs (>= 1.2.0, < 2.0)
445
453
  rspec-support (~> 3.13.0)
446
454
  rspec-html-matchers (0.10.0)
447
455
  nokogiri (~> 1)
448
456
  rspec (>= 3.0.0.a)
449
- rspec-mocks (3.13.8)
457
+ rspec-mocks (3.13.9)
450
458
  diff-lcs (>= 1.2.0, < 2.0)
451
459
  rspec-support (~> 3.13.0)
452
- rspec-rails (8.0.4)
460
+ rspec-rails (8.1.0)
453
461
  actionpack (>= 7.2)
454
462
  activesupport (>= 7.2)
455
463
  railties (>= 7.2)
@@ -457,10 +465,10 @@ GEM
457
465
  rspec-expectations (>= 3.13.0, < 5.0.0)
458
466
  rspec-mocks (>= 3.13.0, < 5.0.0)
459
467
  rspec-support (>= 3.13.0, < 5.0.0)
460
- rspec-support (3.13.7)
461
- rspec_junit_formatter (0.6.0)
462
- rspec-core (>= 2, < 4, != 2.12.0)
463
- rubocop (1.92.0)
468
+ rspec-support (3.13.8)
469
+ rspec_junit_formatter (0.8.0)
470
+ rspec-core (>= 3.13, < 4)
471
+ rubocop (1.92.2)
464
472
  json (>= 2.3)
465
473
  language_server-protocol (~> 3.17.0.2)
466
474
  lint_roller (~> 1.1.0)
@@ -471,9 +479,9 @@ GEM
471
479
  rubocop-ast (>= 1.49.0, < 2.0)
472
480
  ruby-progressbar (~> 1.7)
473
481
  unicode-display_width (>= 2.4.0, < 4.0)
474
- rubocop-ast (1.50.0)
482
+ rubocop-ast (1.51.0)
475
483
  parser (>= 3.3.7.2)
476
- prism (~> 1.7)
484
+ prism (>= 1.7)
477
485
  rubocop-minitest (0.41.0)
478
486
  lint_roller (~> 1.1)
479
487
  rubocop (>= 1.89.0, < 2.0)
@@ -558,23 +566,23 @@ GEM
558
566
  unicode-emoji (4.3.0)
559
567
  uri (1.1.2)
560
568
  useragent (0.16.11)
561
- valid_email2 (7.1.0)
569
+ valid_email2 (7.2.0)
562
570
  activemodel (>= 6.0)
563
571
  mail (~> 2.5)
564
- view_component (4.16.0)
572
+ view_component (4.24.0)
565
573
  actionview (>= 7.1.0)
566
574
  activesupport (>= 7.1.0)
567
- concurrent-ruby (~> 1)
568
- view_component-form (0.3.1)
569
- actionview (>= 7.2.0)
570
- activesupport (>= 7.2.0)
571
- view_component (>= 2.34.0, < 5.0)
575
+ prism (>= 1.0)
576
+ view_component-form (0.4.0)
577
+ actionview (>= 8.1.0)
578
+ activesupport (>= 8.1.0)
579
+ view_component (>= 4.0.0, < 5.0)
572
580
  zeitwerk (~> 2.5)
573
- webauthn (3.4.3)
581
+ webauthn (3.5.1)
574
582
  android_key_attestation (~> 0.3.0)
575
583
  bindata (~> 2.4)
576
- cbor (~> 0.5.9)
577
- cose (~> 1.1)
584
+ cbor (~> 0.6.2.2)
585
+ cose (~> 1.4)
578
586
  openssl (>= 2.2)
579
587
  safety_net_attestation (~> 0.5.0)
580
588
  tpm-key_attestation (~> 0.14.0)
@@ -603,8 +611,11 @@ DEPENDENCIES
603
611
  brakeman (~> 7.0)
604
612
  bundler-audit (~> 0.9)
605
613
  capybara (~> 3.38)
614
+ cuprite (~> 0.19)
615
+ jwt (~> 3.1)
606
616
  oaken (~> 1.0)
607
617
  pg (~> 1.5)
618
+ puma (~> 8.0)
608
619
  rake (~> 13.0)
609
620
  reek (~> 6.1)
610
621
  rspec-html-matchers (~> 0.10)
data/Makefile CHANGED
@@ -25,7 +25,7 @@ lint-i18n:
25
25
  bundle exec i18n-tasks missing -t diff
26
26
 
27
27
  # One target per tool, as for lint
28
- security: security-brakeman security-bundler-audit
28
+ security: security-brakeman security-bundler-audit security-npm-audit
29
29
 
30
30
  security-brakeman:
31
31
  bundle exec brakeman --no-exit-on-error
@@ -33,6 +33,12 @@ security-brakeman:
33
33
  security-bundler-audit:
34
34
  bundle exec bundle-audit check --update
35
35
 
36
+ # Advisories and deprecations, whatever their severity as bundler-audit, on the npm packages host apps
37
+ # bundle (`dependencies`, with their own), not on the tooling (`devDependencies`). Skipped ones are
38
+ # listed in .yarnrc.yml.
39
+ security-npm-audit:
40
+ yarn npm audit --recursive --environment production
41
+
36
42
  fix:
37
43
  bundle exec rubocop --autocorrect
38
44
  yarn eslint "app/**/*.js" --fix
@@ -51,6 +57,8 @@ i18n-check: i18n-normalize
51
57
  git diff --exit-code config/locales
52
58
 
53
59
  release:
60
+ @# Before bumping anything: with a missing or expired token, npm publish fails with a misleading 404
61
+ @npm whoami >/dev/null 2>&1 || { echo "Not signed in to npm, or the token expired: run npm login first."; exit 1; }
54
62
  @read -p "New version (current: $$(sed -n 's/.*VERSION = "\(.*\)"/\1/p' lib/trek/version.rb)): " version; \
55
63
  if [ -z "$$version" ]; then echo "Version cannot be empty"; exit 1; fi && \
56
64
  sed -i '' "s/VERSION = \".*\"/VERSION = \"$$version\"/" lib/trek/version.rb && \
data/README.md CHANGED
@@ -29,10 +29,10 @@ You don't have to set them up yourself, but you can customize their configuratio
29
29
 
30
30
  ### Prerequisites
31
31
 
32
- Make sure your default Rails version is 7.0+
32
+ Make sure your default Rails version is 8.0+
33
33
 
34
34
  $ rails -v
35
- Rails 8.1.3
35
+ Rails 8.1.4
36
36
 
37
37
  If not, run `gem install rails` to upgrade.
38
38
 
@@ -41,11 +41,16 @@ Make sure your default Yarn version is 4.x
41
41
  $ yarn -v
42
42
  4.17.0
43
43
 
44
- If not, run:
44
+ If not, install it with corepack (Node 25 and later no longer ship it, hence the first command):
45
45
 
46
+ npm install --global corepack
46
47
  corepack enable
47
48
  corepack install --global yarn@4
48
49
 
50
+ Or, if you manage your tools with [mise](https://mise.jdx.dev):
51
+
52
+ mise use --global yarn@4
53
+
49
54
  Create your Rails project (replace `helloworld` with your own project name):
50
55
 
51
56
  export TREK_PROJECT_NAME=helloworld
@@ -71,7 +76,7 @@ Now you're ready to install Trek. This will:
71
76
 
72
77
  Run:
73
78
 
74
- rails g trek:install
79
+ bin/rails g trek:install
75
80
 
76
81
  #### Configure Postmark
77
82
 
@@ -85,16 +90,6 @@ You can also do it manually after running the installer by running:
85
90
 
86
91
  EDITOR="code --wait" bin/rails credentials:edit
87
92
 
88
- #### Configure Deepl
89
-
90
- DeepL can be use to translate locale files automatically when running the scaffold generator.
91
-
92
- To use this feature, specify your DeepL credentials by defining the following ENV variables, prior to running the installer:
93
-
94
- export DEEPL_AUTH_KEY=YOUR_TOKEN
95
-
96
- If the ENV variable is not found, translations won't happen automatically and you will have to manually edit each locale file (except English).
97
-
98
93
  ## Usage
99
94
 
100
95
  ### Customize branding
@@ -124,7 +119,7 @@ en:
124
119
 
125
120
  Customize the credentials with `ADMIN_EMAIL` and `ADMIN_PASSWORD` ENV variables in `.env`
126
121
 
127
- rails g trek:admin:user
122
+ bin/rails g trek:admin:user
128
123
 
129
124
  ## Development
130
125
 
@@ -192,9 +187,10 @@ The docs, based on [VitePress](https://vitepress.dev), are embedded in the `/doc
192
187
 
193
188
  This will:
194
189
 
195
- 1. Prompt for the new version number (showing the current version)
196
- 2. Update the version in `lib/trek/version.rb` and `package.json`
197
- 3. Run `bundle` to update the lockfile
198
- 4. Commit all changes with message "Version X.Y.Z"
199
- 5. Run `bundle exec rake release` (creates git tag, pushes commits/tag, pushes gem to [rubygems.org](https://rubygems.org))
200
- 6. Run `npm publish` (publishes the [npm package](https://www.npmjs.com/package/trek) to npmjs.com). This requires being logged in to npmjs (`npm login`) as a maintainer of the `trek` package.
190
+ 1. Check that you're signed in to npm (`npm whoami`), and stop otherwise: run `npm login` first, as a maintainer of the `trek` package
191
+ 2. Prompt for the new version number (showing the current version)
192
+ 3. Update the version in `lib/trek/version.rb` and `package.json`, and stamp the CHANGELOG's `[Unreleased]` section with it and the date
193
+ 4. Run `bundle` to update the lockfile
194
+ 5. Commit all changes with message "Version X.Y.Z"
195
+ 6. Prompt for a RubyGems OTP code (leave it empty if MFA is off), then run `bundle exec rake release` (creates git tag, pushes commits/tag, pushes gem to [rubygems.org](https://rubygems.org))
196
+ 7. Prompt for an npm OTP code, then run `npm publish` (publishes the [npm package](https://www.npmjs.com/package/trek) to npmjs.com)
@@ -46,6 +46,15 @@
46
46
  transition: transform 0.2s ease-in-out;
47
47
  }
48
48
 
49
+ /* A tile opening in a new tab: the icon follows the text, on its last line */
50
+ .external {
51
+ --icon-size: 1.4rem;
52
+
53
+ display: inline-block;
54
+ margin-left: 0.6rem;
55
+ vertical-align: -0.1rem;
56
+ }
57
+
49
58
  .root.color-amber {
50
59
  --icon-color: var(--amber-11);
51
60
 
@@ -4,9 +4,11 @@
4
4
  span(class=class_for("title")) = title
5
5
  - if icon
6
6
  = render Trek::IconComponent.new(icon, classnames: class_for("icon"))
7
- span(class=class_for("text")) = formatted_text
7
+ span(class=class_for("text"))
8
+ = formatted_text
9
+ = external_icon
8
10
  - else
9
- div(class=classes)
11
+ div(class=classes data-accent-color=color)
10
12
  - if title
11
13
  span(class=class_for("title")) = title
12
14
  - if icon
@@ -31,12 +31,22 @@ module Trek
31
31
  )
32
32
  end
33
33
 
34
+ # The tile's color is the accent (`data-accent-color`) of what it holds, which can use `var(--accent-*)`
34
35
  def link_data
35
- data.merge(turbo_method: method).compact
36
+ { accent_color: color }.merge(data, turbo_method: method).compact
36
37
  end
37
38
 
38
39
  def link_rel
39
- rel || ("noopener" if target == "_blank")
40
+ rel || ("noopener" if new_tab?)
41
+ end
42
+
43
+ def new_tab?
44
+ target == "_blank"
45
+ end
46
+
47
+ # After the text of a link opening in a new tab
48
+ def external_icon
49
+ render Trek::IconComponent.new("trek/external", classnames: class_for("external"), aria_hidden: true) if new_tab?
40
50
  end
41
51
 
42
52
  def formatted_text