trek 0.1.21 → 0.1.23

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 (65) hide show
  1. checksums.yaml +4 -4
  2. data/.npmignore +3 -0
  3. data/Gemfile.lock +76 -74
  4. data/README.md +8 -0
  5. data/app/assets/stylesheets/trek/_colors.css +181 -0
  6. data/app/components/trek/button_component.rb +9 -3
  7. data/app/components/trek/form/actions_component/actions_component.css +6 -0
  8. data/app/components/trek/form/image_field_component/image_field_component.css +1 -1
  9. data/app/components/trek/form/switch_box_component.rb +1 -0
  10. data/app/components/trek/icon/sprite_component.rb +54 -8
  11. data/app/components/trek/tabs_component/tabs_component.css +1 -0
  12. data/app/controllers/concerns/trek/model.rb +4 -1
  13. data/config/locales/trek.en.yml +2 -0
  14. data/docs/.vitepress/config.mjs +133 -0
  15. data/docs/.vitepress/theme/index.js +17 -0
  16. data/docs/.vitepress/theme/style.css +139 -0
  17. data/docs/customize.md +63 -7
  18. data/docs/getting-started.md +160 -0
  19. data/docs/index.md +39 -0
  20. data/docs/public/logo.svg +1 -0
  21. data/docs/reference/components.md +40 -0
  22. data/docs/reference/concerns/contentable.md +28 -0
  23. data/docs/reference/concerns/formattable.md +24 -0
  24. data/docs/reference/concerns/fragmentable.md +33 -0
  25. data/docs/reference/concerns/keyable.md +18 -0
  26. data/docs/reference/concerns/orderable.md +26 -0
  27. data/docs/reference/concerns/pageable.md +35 -0
  28. data/docs/reference/concerns/pathable.md +28 -0
  29. data/docs/reference/concerns/phonable.md +28 -0
  30. data/docs/reference/concerns/search-engine-optimizable.md +19 -0
  31. data/docs/reference/concerns/searchable.md +22 -0
  32. data/docs/reference/concerns/sectionable.md +24 -0
  33. data/docs/reference/concerns/sluggable.md +21 -0
  34. data/docs/reference/concerns/taggable.md +20 -0
  35. data/docs/reference/concerns/translatable.md +35 -0
  36. data/docs/reference/concerns/versionable.md +27 -0
  37. data/docs/reference/controllers.md +23 -0
  38. data/docs/reference/environment-variables.md +9 -0
  39. data/docs/reference/formatters.md +30 -0
  40. data/docs/reference/forms.md +21 -0
  41. data/docs/reference/generators/admin-user.md +17 -0
  42. data/docs/reference/generators/install.md +42 -0
  43. data/docs/reference/generators/scaffold.md +37 -0
  44. data/docs/reference/generators/taxonomies.md +21 -0
  45. data/docs/reference/icons.md +11 -0
  46. data/docs/reference/index.md +47 -0
  47. data/docs/reference/models/current.md +11 -0
  48. data/docs/reference/models/external-link.md +16 -0
  49. data/docs/reference/models/fragment.md +28 -0
  50. data/docs/reference/models/menu-node.md +30 -0
  51. data/docs/reference/models/page-path.md +19 -0
  52. data/docs/reference/models/page-version.md +30 -0
  53. data/docs/reference/models/page.md +48 -0
  54. data/docs/reference/models/tag.md +41 -0
  55. data/docs/reference/models/user.md +65 -0
  56. data/docs/reference/policies.md +30 -0
  57. data/docs/reference/uploaders.md +19 -0
  58. data/docs/what-is-trek.md +37 -0
  59. data/esbuild.config.js +10 -7
  60. data/lib/trek/version.rb +1 -1
  61. data/netlify.toml +4 -0
  62. data/package.json +10 -5
  63. data/renovate.json +4 -0
  64. data/yarn.lock +2015 -235
  65. metadata +48 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5cea2a831c71a33aa66c06d9c482aaa195a32eab3d15036892d42b7ad780d896
4
- data.tar.gz: 8589d77eec5df070bea04c13fea05a46e7b516533e3a044f5bbf10a1551dda27
3
+ metadata.gz: c441a015bd63b8e650c1f39c225b2a40f6a6beebeff6db95d295a84a2c22eae2
4
+ data.tar.gz: 2f7543789a5cb718fdb9a69e6c6f4b9143164a525ea7d5620c5b8816e9d35e01
5
5
  SHA512:
6
- metadata.gz: 0d9a672bbf54060d276ae97b2897b5fb5769d15ab3a64ad8cda2fedfe7875395d89a04bc0116100ee667b195197d1ba610a2e3ff5180492a7743ff8294877d44
7
- data.tar.gz: df786a478a60fa19944403b15bf41d2c2c9eef5f25e1d5ed638ae2a8be7a8bcf8d33482cec0a1c68254a6424668ad0ac3afc472b49da85882cb2250cd70a7a90
6
+ metadata.gz: 1086f69da18c67aa88915c9556c511bca3f30eb981d768078d7f962f8ebf340769be08b0b131f8e873544cd4a152b715a28d7baacabaf19993a685e1c090083c
7
+ data.tar.gz: 8507af27451b4ed7445fe1748e00a246392631d20c2804f213826356fa898a8b29aaf77a716a64233470022e7817209fbd103fbaa98b8482335f59b1279a0f33
data/.npmignore CHANGED
@@ -1,6 +1,9 @@
1
+ .claude
2
+ .yarn
1
3
  app/**/*.{rb,slim}
2
4
  bin
3
5
  config
4
6
  docs
5
7
  lib
8
+ pkg
6
9
  spec
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- trek (0.1.21)
4
+ trek (0.1.23)
5
5
  action_policy (~> 0.6)
6
6
  actioncable
7
7
  acts_as_list (~> 1.1)
@@ -37,31 +37,31 @@ GEM
37
37
  specs:
38
38
  action_policy (0.7.5)
39
39
  ruby-next-core (>= 1.0)
40
- action_text-trix (2.1.17)
40
+ action_text-trix (2.1.18)
41
41
  railties
42
- actioncable (8.1.1)
43
- actionpack (= 8.1.1)
44
- activesupport (= 8.1.1)
42
+ actioncable (8.1.3)
43
+ actionpack (= 8.1.3)
44
+ activesupport (= 8.1.3)
45
45
  nio4r (~> 2.0)
46
46
  websocket-driver (>= 0.6.1)
47
47
  zeitwerk (~> 2.6)
48
- actionmailbox (8.1.1)
49
- actionpack (= 8.1.1)
50
- activejob (= 8.1.1)
51
- activerecord (= 8.1.1)
52
- activestorage (= 8.1.1)
53
- activesupport (= 8.1.1)
48
+ actionmailbox (8.1.3)
49
+ actionpack (= 8.1.3)
50
+ activejob (= 8.1.3)
51
+ activerecord (= 8.1.3)
52
+ activestorage (= 8.1.3)
53
+ activesupport (= 8.1.3)
54
54
  mail (>= 2.8.0)
55
- actionmailer (8.1.1)
56
- actionpack (= 8.1.1)
57
- actionview (= 8.1.1)
58
- activejob (= 8.1.1)
59
- activesupport (= 8.1.1)
55
+ actionmailer (8.1.3)
56
+ actionpack (= 8.1.3)
57
+ actionview (= 8.1.3)
58
+ activejob (= 8.1.3)
59
+ activesupport (= 8.1.3)
60
60
  mail (>= 2.8.0)
61
61
  rails-dom-testing (~> 2.2)
62
- actionpack (8.1.1)
63
- actionview (= 8.1.1)
64
- activesupport (= 8.1.1)
62
+ actionpack (8.1.3)
63
+ actionview (= 8.1.3)
64
+ activesupport (= 8.1.3)
65
65
  nokogiri (>= 1.8.5)
66
66
  rack (>= 2.2.4)
67
67
  rack-session (>= 1.0.1)
@@ -69,36 +69,36 @@ GEM
69
69
  rails-dom-testing (~> 2.2)
70
70
  rails-html-sanitizer (~> 1.6)
71
71
  useragent (~> 0.16)
72
- actiontext (8.1.1)
72
+ actiontext (8.1.3)
73
73
  action_text-trix (~> 2.1.15)
74
- actionpack (= 8.1.1)
75
- activerecord (= 8.1.1)
76
- activestorage (= 8.1.1)
77
- activesupport (= 8.1.1)
74
+ actionpack (= 8.1.3)
75
+ activerecord (= 8.1.3)
76
+ activestorage (= 8.1.3)
77
+ activesupport (= 8.1.3)
78
78
  globalid (>= 0.6.0)
79
79
  nokogiri (>= 1.8.5)
80
- actionview (8.1.1)
81
- activesupport (= 8.1.1)
80
+ actionview (8.1.3)
81
+ activesupport (= 8.1.3)
82
82
  builder (~> 3.1)
83
83
  erubi (~> 1.11)
84
84
  rails-dom-testing (~> 2.2)
85
85
  rails-html-sanitizer (~> 1.6)
86
- activejob (8.1.1)
87
- activesupport (= 8.1.1)
86
+ activejob (8.1.3)
87
+ activesupport (= 8.1.3)
88
88
  globalid (>= 0.3.6)
89
- activemodel (8.1.1)
90
- activesupport (= 8.1.1)
91
- activerecord (8.1.1)
92
- activemodel (= 8.1.1)
93
- activesupport (= 8.1.1)
89
+ activemodel (8.1.3)
90
+ activesupport (= 8.1.3)
91
+ activerecord (8.1.3)
92
+ activemodel (= 8.1.3)
93
+ activesupport (= 8.1.3)
94
94
  timeout (>= 0.4.0)
95
- activestorage (8.1.1)
96
- actionpack (= 8.1.1)
97
- activejob (= 8.1.1)
98
- activerecord (= 8.1.1)
99
- activesupport (= 8.1.1)
95
+ activestorage (8.1.3)
96
+ actionpack (= 8.1.3)
97
+ activejob (= 8.1.3)
98
+ activerecord (= 8.1.3)
99
+ activesupport (= 8.1.3)
100
100
  marcel (~> 1.0)
101
- activesupport (8.1.1)
101
+ activesupport (8.1.3)
102
102
  base64
103
103
  bigdecimal
104
104
  concurrent-ruby (~> 1.0, >= 1.3.1)
@@ -114,7 +114,7 @@ GEM
114
114
  acts_as_list (1.2.6)
115
115
  activerecord (>= 6.1)
116
116
  activesupport (>= 6.1)
117
- addressable (2.8.8)
117
+ addressable (2.9.0)
118
118
  public_suffix (>= 2.0.2, < 8.0)
119
119
  ast (2.4.3)
120
120
  aws-eventstream (1.4.0)
@@ -137,7 +137,7 @@ GEM
137
137
  aws-sigv4 (1.12.1)
138
138
  aws-eventstream (~> 1, >= 1.0.2)
139
139
  base64 (0.3.0)
140
- bigdecimal (3.3.1)
140
+ bigdecimal (4.1.2)
141
141
  blurhash (0.1.8)
142
142
  brakeman (7.1.2)
143
143
  racc
@@ -162,8 +162,9 @@ GEM
162
162
  connection_pool (3.0.2)
163
163
  content_disposition (1.0.0)
164
164
  crass (1.0.6)
165
- css_parser (1.21.1)
165
+ css_parser (3.0.0)
166
166
  addressable
167
+ ssrf_filter (~> 1.5)
167
168
  date (3.5.1)
168
169
  deepl-rb (3.6.1)
169
170
  diff-lcs (1.6.2)
@@ -193,14 +194,14 @@ GEM
193
194
  dry-logic (~> 1.5)
194
195
  dry-types (~> 1.8)
195
196
  zeitwerk (~> 2.6)
196
- dry-types (1.8.3)
197
- bigdecimal (~> 3.0)
197
+ dry-types (1.9.1)
198
+ bigdecimal (>= 3.0)
198
199
  concurrent-ruby (~> 1.0)
199
200
  dry-core (~> 1.0)
200
201
  dry-inflector (~> 1.0)
201
202
  dry-logic (~> 1.4)
202
203
  zeitwerk (~> 2.6)
203
- erb (6.0.2)
204
+ erb (6.0.4)
204
205
  erubi (1.13.1)
205
206
  fastimage (2.4.0)
206
207
  ffi (1.17.3-arm64-darwin)
@@ -236,7 +237,7 @@ GEM
236
237
  rdoc (>= 4.0.0)
237
238
  reline (>= 0.4.2)
238
239
  jmespath (1.6.2)
239
- json (2.19.2)
240
+ json (2.19.5)
240
241
  kaminari (1.2.2)
241
242
  activesupport (>= 4.1.0)
242
243
  kaminari-actionview (= 1.2.2)
@@ -281,13 +282,13 @@ GEM
281
282
  mini_magick (5.3.1)
282
283
  logger
283
284
  mini_mime (1.1.5)
284
- minitest (6.0.2)
285
+ minitest (6.0.6)
285
286
  drb (~> 2.0)
286
287
  prism (~> 1.5)
287
288
  mobility (1.3.2)
288
289
  i18n (>= 0.6.10, < 2)
289
290
  request_store (~> 1.0)
290
- net-imap (0.6.2)
291
+ net-imap (0.6.4.1)
291
292
  date
292
293
  net-protocol
293
294
  net-pop (0.1.2)
@@ -297,9 +298,9 @@ GEM
297
298
  net-smtp (0.5.1)
298
299
  net-protocol
299
300
  nio4r (2.7.5)
300
- nokogiri (1.19.2-arm64-darwin)
301
+ nokogiri (1.19.3-arm64-darwin)
301
302
  racc (~> 1.4)
302
- nokogiri (1.19.2-x86_64-darwin)
303
+ nokogiri (1.19.3-x86_64-darwin)
303
304
  racc (~> 1.4)
304
305
  parallel (1.27.0)
305
306
  parser (3.3.10.0)
@@ -320,30 +321,30 @@ GEM
320
321
  psych (5.3.1)
321
322
  date
322
323
  stringio
323
- public_suffix (7.0.2)
324
+ public_suffix (7.0.5)
324
325
  racc (1.8.1)
325
- rack (3.2.5)
326
- rack-session (2.1.1)
326
+ rack (3.2.6)
327
+ rack-session (2.1.2)
327
328
  base64 (>= 0.1.0)
328
329
  rack (>= 3.0.0)
329
330
  rack-test (2.2.0)
330
331
  rack (>= 1.3)
331
332
  rackup (2.3.1)
332
333
  rack (>= 3)
333
- rails (8.1.1)
334
- actioncable (= 8.1.1)
335
- actionmailbox (= 8.1.1)
336
- actionmailer (= 8.1.1)
337
- actionpack (= 8.1.1)
338
- actiontext (= 8.1.1)
339
- actionview (= 8.1.1)
340
- activejob (= 8.1.1)
341
- activemodel (= 8.1.1)
342
- activerecord (= 8.1.1)
343
- activestorage (= 8.1.1)
344
- activesupport (= 8.1.1)
334
+ rails (8.1.3)
335
+ actioncable (= 8.1.3)
336
+ actionmailbox (= 8.1.3)
337
+ actionmailer (= 8.1.3)
338
+ actionpack (= 8.1.3)
339
+ actiontext (= 8.1.3)
340
+ actionview (= 8.1.3)
341
+ activejob (= 8.1.3)
342
+ activemodel (= 8.1.3)
343
+ activerecord (= 8.1.3)
344
+ activestorage (= 8.1.3)
345
+ activesupport (= 8.1.3)
345
346
  bundler (>= 1.15.0)
346
- railties (= 8.1.1)
347
+ railties (= 8.1.3)
347
348
  rails-dom-testing (2.3.0)
348
349
  activesupport (>= 5.0.0)
349
350
  minitest
@@ -357,9 +358,9 @@ GEM
357
358
  rails-i18n (8.1.0)
358
359
  i18n (>= 0.7, < 2)
359
360
  railties (>= 8.0.0, < 9)
360
- railties (8.1.1)
361
- actionpack (= 8.1.1)
362
- activesupport (= 8.1.1)
361
+ railties (8.1.3)
362
+ actionpack (= 8.1.3)
363
+ activesupport (= 8.1.3)
363
364
  irb (~> 1.13)
364
365
  rackup (>= 1.0.0)
365
366
  rake (>= 12.2)
@@ -479,6 +480,7 @@ GEM
479
480
  rexml (~> 3.2)
480
481
  rubocop (>= 1.0, < 2.0)
481
482
  slim (>= 3.0, < 6.0)
483
+ ssrf_filter (1.5.0)
482
484
  stringio (3.2.0)
483
485
  strip_attributes (2.0.1)
484
486
  activemodel (>= 3.0, < 9.0)
@@ -487,7 +489,7 @@ GEM
487
489
  unicode-display_width (>= 1.1.1, < 4)
488
490
  thor (1.5.0)
489
491
  tilt (2.6.1)
490
- timeout (0.6.0)
492
+ timeout (0.6.1)
491
493
  tsort (0.2.0)
492
494
  tzinfo (2.0.6)
493
495
  concurrent-ruby (~> 1.0)
@@ -496,9 +498,9 @@ GEM
496
498
  unicode-emoji (4.2.0)
497
499
  uri (1.1.1)
498
500
  useragent (0.16.11)
499
- view_component (4.1.1)
500
- actionview (>= 7.1.0, < 8.2)
501
- activesupport (>= 7.1.0, < 8.2)
501
+ view_component (4.10.0)
502
+ actionview (>= 7.1.0)
503
+ activesupport (>= 7.1.0)
502
504
  concurrent-ruby (~> 1)
503
505
  view_component-form (0.3.0)
504
506
  actionview (>= 7.2.0, < 8.2)
@@ -514,7 +516,7 @@ GEM
514
516
  zeitwerk (>= 2.7)
515
517
  xpath (3.2.0)
516
518
  nokogiri (~> 1.8)
517
- yard (0.9.38)
519
+ yard (0.9.43)
518
520
  zeitwerk (2.7.5)
519
521
 
520
522
  PLATFORMS
data/README.md CHANGED
@@ -210,6 +210,14 @@ When you're done, disable the local package:
210
210
 
211
211
  yarn unlink ~/projects/trek
212
212
 
213
+ ### Working on documentation
214
+
215
+ The docs, based on [VitePress](https://vitepress.dev), are embedded in the `/docs` folder.
216
+
217
+ - Launch dev mode: `yarn docs:dev`
218
+ - Build the docs: `yarn docs:build`
219
+ - Open the built docs: `yarn docs:preview`
220
+
213
221
  ### Publishing a new version
214
222
 
215
223
  make release
@@ -41,3 +41,184 @@
41
41
  --accent-11: var(--cyan-11);
42
42
  --accent-12: var(--cyan-12);
43
43
  }
44
+
45
+ /* Define the accent color overrides */
46
+ [data-accent-color="amber"] {
47
+ --accent-1: var(--amber-1);
48
+ --accent-2: var(--amber-2);
49
+ --accent-3: var(--amber-3);
50
+ --accent-4: var(--amber-4);
51
+ --accent-5: var(--amber-5);
52
+ --accent-6: var(--amber-6);
53
+ --accent-7: var(--amber-7);
54
+ --accent-8: var(--amber-8);
55
+ --accent-9: var(--amber-9);
56
+ --accent-10: var(--amber-10);
57
+ --accent-11: var(--amber-11);
58
+ --accent-12: var(--amber-12);
59
+ }
60
+
61
+ [data-accent-color="blue"] {
62
+ --accent-1: var(--blue-1);
63
+ --accent-2: var(--blue-2);
64
+ --accent-3: var(--blue-3);
65
+ --accent-4: var(--blue-4);
66
+ --accent-5: var(--blue-5);
67
+ --accent-6: var(--blue-6);
68
+ --accent-7: var(--blue-7);
69
+ --accent-8: var(--blue-8);
70
+ --accent-9: var(--blue-9);
71
+ --accent-10: var(--blue-10);
72
+ --accent-11: var(--blue-11);
73
+ --accent-12: var(--blue-12);
74
+ }
75
+
76
+ [data-accent-color="cyan"] {
77
+ --accent-1: var(--cyan-1);
78
+ --accent-2: var(--cyan-2);
79
+ --accent-3: var(--cyan-3);
80
+ --accent-4: var(--cyan-4);
81
+ --accent-5: var(--cyan-5);
82
+ --accent-6: var(--cyan-6);
83
+ --accent-7: var(--cyan-7);
84
+ --accent-8: var(--cyan-8);
85
+ --accent-9: var(--cyan-9);
86
+ --accent-10: var(--cyan-10);
87
+ --accent-11: var(--cyan-11);
88
+ --accent-12: var(--cyan-12);
89
+ }
90
+
91
+ [data-accent-color="grass"] {
92
+ --accent-1: var(--grass-1);
93
+ --accent-2: var(--grass-2);
94
+ --accent-3: var(--grass-3);
95
+ --accent-4: var(--grass-4);
96
+ --accent-5: var(--grass-5);
97
+ --accent-6: var(--grass-6);
98
+ --accent-7: var(--grass-7);
99
+ --accent-8: var(--grass-8);
100
+ --accent-9: var(--grass-9);
101
+ --accent-10: var(--grass-10);
102
+ --accent-11: var(--grass-11);
103
+ --accent-12: var(--grass-12);
104
+ }
105
+
106
+ [data-accent-color="lime"] {
107
+ --accent-1: var(--lime-1);
108
+ --accent-2: var(--lime-2);
109
+ --accent-3: var(--lime-3);
110
+ --accent-4: var(--lime-4);
111
+ --accent-5: var(--lime-5);
112
+ --accent-6: var(--lime-6);
113
+ --accent-7: var(--lime-7);
114
+ --accent-8: var(--lime-8);
115
+ --accent-9: var(--lime-9);
116
+ --accent-10: var(--lime-10);
117
+ --accent-11: var(--lime-11);
118
+ --accent-12: var(--lime-12);
119
+ }
120
+
121
+ [data-accent-color="mint"] {
122
+ --accent-1: var(--mint-1);
123
+ --accent-2: var(--mint-2);
124
+ --accent-3: var(--mint-3);
125
+ --accent-4: var(--mint-4);
126
+ --accent-5: var(--mint-5);
127
+ --accent-6: var(--mint-6);
128
+ --accent-7: var(--mint-7);
129
+ --accent-8: var(--mint-8);
130
+ --accent-9: var(--mint-9);
131
+ --accent-10: var(--mint-10);
132
+ --accent-11: var(--mint-11);
133
+ --accent-12: var(--mint-12);
134
+ }
135
+
136
+ [data-accent-color="purple"] {
137
+ --accent-1: var(--purple-1);
138
+ --accent-2: var(--purple-2);
139
+ --accent-3: var(--purple-3);
140
+ --accent-4: var(--purple-4);
141
+ --accent-5: var(--purple-5);
142
+ --accent-6: var(--purple-6);
143
+ --accent-7: var(--purple-7);
144
+ --accent-8: var(--purple-8);
145
+ --accent-9: var(--purple-9);
146
+ --accent-10: var(--purple-10);
147
+ --accent-11: var(--purple-11);
148
+ --accent-12: var(--purple-12);
149
+ }
150
+
151
+ [data-accent-color="sky"] {
152
+ --accent-1: var(--sky-1);
153
+ --accent-2: var(--sky-2);
154
+ --accent-3: var(--sky-3);
155
+ --accent-4: var(--sky-4);
156
+ --accent-5: var(--sky-5);
157
+ --accent-6: var(--sky-6);
158
+ --accent-7: var(--sky-7);
159
+ --accent-8: var(--sky-8);
160
+ --accent-9: var(--sky-9);
161
+ --accent-10: var(--sky-10);
162
+ --accent-11: var(--sky-11);
163
+ --accent-12: var(--sky-12);
164
+ }
165
+
166
+ [data-accent-color="slate"] {
167
+ --accent-1: var(--slate-1);
168
+ --accent-2: var(--slate-2);
169
+ --accent-3: var(--slate-3);
170
+ --accent-4: var(--slate-4);
171
+ --accent-5: var(--slate-5);
172
+ --accent-6: var(--slate-6);
173
+ --accent-7: var(--slate-7);
174
+ --accent-8: var(--slate-8);
175
+ --accent-9: var(--slate-9);
176
+ --accent-10: var(--slate-10);
177
+ --accent-11: var(--slate-11);
178
+ --accent-12: var(--slate-12);
179
+ }
180
+
181
+ [data-accent-color="teal"] {
182
+ --accent-1: var(--teal-1);
183
+ --accent-2: var(--teal-2);
184
+ --accent-3: var(--teal-3);
185
+ --accent-4: var(--teal-4);
186
+ --accent-5: var(--teal-5);
187
+ --accent-6: var(--teal-6);
188
+ --accent-7: var(--teal-7);
189
+ --accent-8: var(--teal-8);
190
+ --accent-9: var(--teal-9);
191
+ --accent-10: var(--teal-10);
192
+ --accent-11: var(--teal-11);
193
+ --accent-12: var(--teal-12);
194
+ }
195
+
196
+ [data-accent-color="tomato"] {
197
+ --accent-1: var(--tomato-1);
198
+ --accent-2: var(--tomato-2);
199
+ --accent-3: var(--tomato-3);
200
+ --accent-4: var(--tomato-4);
201
+ --accent-5: var(--tomato-5);
202
+ --accent-6: var(--tomato-6);
203
+ --accent-7: var(--tomato-7);
204
+ --accent-8: var(--tomato-8);
205
+ --accent-9: var(--tomato-9);
206
+ --accent-10: var(--tomato-10);
207
+ --accent-11: var(--tomato-11);
208
+ --accent-12: var(--tomato-12);
209
+ }
210
+
211
+ [data-accent-color="violet"] {
212
+ --accent-1: var(--violet-1);
213
+ --accent-2: var(--violet-2);
214
+ --accent-3: var(--violet-3);
215
+ --accent-4: var(--violet-4);
216
+ --accent-5: var(--violet-5);
217
+ --accent-6: var(--violet-6);
218
+ --accent-7: var(--violet-7);
219
+ --accent-8: var(--violet-8);
220
+ --accent-9: var(--violet-9);
221
+ --accent-10: var(--violet-10);
222
+ --accent-11: var(--violet-11);
223
+ --accent-12: var(--violet-12);
224
+ }
@@ -35,6 +35,12 @@ module Trek
35
35
  )
36
36
  end
37
37
 
38
+ def data_attributes
39
+ attributes = {}
40
+ attributes["accent-color"] = color if color
41
+ attributes.merge(data)
42
+ end
43
+
38
44
  def rendered_content
39
45
  safe_join([
40
46
  icon,
@@ -48,7 +54,7 @@ module Trek
48
54
  link_to rendered_content,
49
55
  href,
50
56
  class: classes,
51
- data: data,
57
+ data: data_attributes,
52
58
  rel: rel,
53
59
  target: target,
54
60
  title: title
@@ -57,7 +63,7 @@ module Trek
57
63
  link_to rendered_content,
58
64
  to,
59
65
  class: classes,
60
- data: data.merge(turbo_method: method),
66
+ data: data_attributes.merge(turbo_method: method),
61
67
  form: form,
62
68
  form_class: form_class,
63
69
  params: params
@@ -65,7 +71,7 @@ module Trek
65
71
  content_tag tag,
66
72
  rendered_content,
67
73
  class: classes,
68
- data:,
74
+ data: data_attributes,
69
75
  form:,
70
76
  type:,
71
77
  value:
@@ -2,8 +2,14 @@
2
2
 
3
3
  .root {
4
4
  align-items: center;
5
+ background-color: var(--accent-1);
6
+ bottom: 0;
5
7
  display: flex;
6
8
  max-width: 120rem;
9
+ padding: 4rem 0;
10
+ position: fixed;
11
+ width: 100%;
12
+ z-index: 1;
7
13
  }
8
14
 
9
15
  .buttons {
@@ -9,11 +9,11 @@
9
9
 
10
10
  align-items: center;
11
11
  background-color: var(--slate-4);
12
- flex-shrink: 0;
13
12
  border: 1px solid var(--slate-a6);
14
13
  border-radius: 0.2rem;
15
14
  color: var(--slate-8);
16
15
  display: flex;
16
+ flex-shrink: 0;
17
17
  height: 11.5rem;
18
18
  justify-content: center;
19
19
  margin-right: 2rem;
@@ -53,6 +53,7 @@ module Trek
53
53
  end
54
54
 
55
55
  def label_text
56
+ content ||= options[:label]
56
57
  content ||= ActionView::Helpers::Tags::Translator.new(object, object_name, method_name, scope: "helpers.label").translate
57
58
  content ||= method_name.humanize
58
59
  content
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "rails-html-sanitizer"
4
+
3
5
  module Trek
4
6
  module Icon
5
7
  class SpriteComponent < Trek::Component
@@ -43,6 +45,56 @@ module Trek
43
45
 
44
46
  private
45
47
 
48
+
49
+ # rubocop:disable Rails/OutputSafety
50
+ def sanitized_svg(key, svg_string)
51
+ sanitizer = Rails::Html::SafeListSanitizer.new
52
+
53
+ # First pass: sanitize svg element with only symbol attributes
54
+ svg_sanitized = sanitizer.sanitize(
55
+ svg_string,
56
+ tags: %w[svg],
57
+ attributes: allowed_symbol_attributes
58
+ )
59
+
60
+ # Second pass: sanitize children with child attributes
61
+ children_sanitized = sanitizer.sanitize(
62
+ svg_string,
63
+ tags: allowed_child_tags,
64
+ attributes: allowed_child_attributes
65
+ )
66
+
67
+ # Extract inner content (children) from the second pass
68
+ inner_content = children_sanitized.sub(/<svg[^>]*>/, "").sub("</svg>", "")
69
+
70
+ # Combine: symbol element from first pass + children from second pass
71
+ svg_sanitized
72
+ .sub("<svg", "<symbol id=\"c-icon-#{key}\"")
73
+ .gsub(/#0{3,6}/, "currentColor")
74
+ .sub(">", ">#{inner_content}")
75
+ .sub("</svg>", "</symbol>")
76
+ .gsub(/[\r\n]+/, "")
77
+ .strip
78
+ .html_safe
79
+ end
80
+ # rubocop:enable Rails/OutputSafety
81
+
82
+ def allowed_child_tags
83
+ %w[path circle rect line polyline polygon ellipse g defs use]
84
+ end
85
+
86
+ def allowed_symbol_attributes
87
+ %w[viewbox fill stroke stroke-width stroke-linecap stroke-linejoin stroke-miterlimit]
88
+ end
89
+
90
+ def allowed_child_attributes
91
+ %w[
92
+ x x1 x2 y y1 y2 cx cy r rx ry d fill stroke stroke-width height width
93
+ stroke-linecap stroke-linejoin stroke-miterlimit transform
94
+ ]
95
+ end
96
+
97
+ #
46
98
  # rubocop:disable Rails/OutputSafety
47
99
  # rubocop:disable Metrics/MethodLength
48
100
  def svg_as_symbol(key)
@@ -51,14 +103,8 @@ module Trek
51
103
  return if icon_files.empty?
52
104
 
53
105
  file = File.open(icon_files.last, "rb")
54
- file
55
- .read
56
- .gsub("<svg ", "<symbol id=\"c-icon-#{key}\" ")
57
- .gsub("</svg", "</symbol")
58
- .gsub(/#0{3,6}/, "currentColor")
59
- .gsub(/ ?(height|width|version|xmlns)="([^"]+)"/, "")
60
- .gsub("xmlns=\"http://www.w3.org/2000/svg\"", "")
61
- .html_safe
106
+
107
+ sanitized_svg(key, file.read)
62
108
  end
63
109
  # rubocop:enable Metrics/MethodLength
64
110
  # rubocop:enable Rails/OutputSafety
@@ -1,6 +1,7 @@
1
1
  /* Use component-local class names and add them to HTML via #class_for(name) helper */
2
2
 
3
3
  .root {
4
+ margin-bottom: 10rem;
4
5
  max-width: 64rem;
5
6
  }
6
7