tramway 3.0.4.1 → 3.1

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 (45) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +22 -11
  3. data/app/assets/javascripts/tramway/ui_checkbox_controller.js +36 -0
  4. data/app/components/tailwind_component.rb +21 -24
  5. data/app/components/tramway/button_component.rb +33 -21
  6. data/app/components/tramway/chat_component.html.haml +6 -6
  7. data/app/components/tramway/chats/message_component.html.haml +2 -2
  8. data/app/components/tramway/chats/message_component.rb +2 -2
  9. data/app/components/tramway/chats/messages/container_component.html.haml +3 -3
  10. data/app/components/tramway/chats/messages/container_component.rb +4 -9
  11. data/app/components/tramway/chats/messages/table_component.html.haml +1 -1
  12. data/app/components/tramway/colors_methods.rb +3 -3
  13. data/app/components/tramway/containers/main_component.rb +1 -1
  14. data/app/components/tramway/containers/narrow_component.rb +2 -2
  15. data/app/components/tramway/flash_component.html.haml +0 -1
  16. data/app/components/tramway/flash_component.rb +25 -10
  17. data/app/components/tramway/form/builder.rb +1 -1
  18. data/app/components/tramway/form/checkbox_component.html.haml +26 -4
  19. data/app/components/tramway/form/checkbox_component.rb +32 -1
  20. data/app/components/tramway/form/label_component.html.haml +1 -1
  21. data/app/components/tramway/form/label_component.rb +2 -3
  22. data/app/components/tramway/form/tramway_select/dropdown_container_component.rb +2 -5
  23. data/app/components/tramway/form/tramway_select/item_container_component.rb +1 -3
  24. data/app/components/tramway/form/tramway_select/select_as_input_component.rb +1 -4
  25. data/app/components/tramway/form/tramway_select/selected_item_template_component.rb +4 -4
  26. data/app/components/tramway/nav/item_component.rb +2 -5
  27. data/app/components/tramway/navbar_component.html.haml +6 -6
  28. data/app/components/tramway/navbar_component.rb +19 -15
  29. data/app/components/tramway/pagination/base.rb +6 -6
  30. data/app/components/tramway/pagination/gap_component.rb +1 -3
  31. data/app/components/tramway/pagination/page_component.rb +2 -3
  32. data/app/components/tramway/table/cell_component.rb +1 -3
  33. data/app/components/tramway/table/header_component.html.haml +1 -1
  34. data/app/components/tramway/table/header_component.rb +2 -4
  35. data/app/components/tramway/table/row_component.html.haml +1 -1
  36. data/app/components/tramway/table/row_component.rb +7 -12
  37. data/app/components/tramway/table_component.rb +1 -3
  38. data/app/views/tramway/entities/_form.html.haml +1 -2
  39. data/app/views/tramway/layouts/application.html.haml +1 -1
  40. data/config/tailwind.config.js +278 -70
  41. data/docs/AGENTS.md +1 -1
  42. data/lib/generators/tramway/install/install_generator.rb +59 -81
  43. data/lib/tramway/engine.rb +1 -1
  44. data/lib/tramway/version.rb +1 -1
  45. metadata +2 -1
@@ -1,3 +1,5 @@
1
+ const defaultTheme = require("tailwindcss/defaultTheme")
2
+
1
3
  module.exports = {
2
4
  safelist: [
3
5
  // === Navbar ===
@@ -24,6 +26,69 @@ module.exports = {
24
26
  'md:justify-between',
25
27
  'pt-16',
26
28
  'min-h-8',
29
+ 'bg-zinc-950',
30
+ 'bg-zinc-950/95',
31
+ 'bg-zinc-950/80',
32
+ 'bg-zinc-900',
33
+ 'bg-zinc-800',
34
+ 'bg-zinc-900/80',
35
+ 'border-zinc-800',
36
+ 'text-zinc-50',
37
+ 'text-zinc-100',
38
+ 'text-zinc-200',
39
+ 'text-zinc-400',
40
+ 'text-zinc-500',
41
+ 'placeholder:text-zinc-500',
42
+ 'hover:bg-zinc-800',
43
+ 'hover:bg-zinc-900',
44
+ 'hover:text-zinc-50',
45
+ 'focus-visible:ring-zinc-300',
46
+ 'focus-visible:ring-zinc-400',
47
+ 'focus-visible:ring-offset-zinc-950',
48
+ 'ring-zinc-800',
49
+ 'peer-disabled:cursor-not-allowed',
50
+ 'peer-disabled:opacity-70',
51
+ 'supports-[backdrop-filter]:bg-zinc-950/80',
52
+ 'backdrop-blur',
53
+ 'shadow-lg',
54
+ 'shadow-sm',
55
+ 'w-fit',
56
+ 'text-base',
57
+ 'text-sm',
58
+ 'rounded-md',
59
+ 'rounded-sm',
60
+ 'border-b',
61
+ 'border-r',
62
+ 'border-t',
63
+ 'border',
64
+ 'gap-4',
65
+ 'gap-1',
66
+ 'gap-2',
67
+ 'grid-cols-1',
68
+ 'grid',
69
+ 'px-4',
70
+ 'py-3',
71
+ 'py-4',
72
+ 'py-6',
73
+ 'p-2',
74
+ 'inset-0',
75
+ 'top-4',
76
+ 'right-4',
77
+ 'flex-col',
78
+ 'items-center',
79
+ 'justify-between',
80
+ 'justify-center',
81
+ 'transition-colors',
82
+ 'rounded-md',
83
+ 'truncate',
84
+ 'rounded-b-none',
85
+ 'overflow-x-hidden',
86
+ 'cursor-not-allowed',
87
+ 'mx-auto',
88
+ 'my-4',
89
+ 'h-8',
90
+ 'w-8',
91
+ 'disabled:cursor-not-allowed',
27
92
 
28
93
  // === Entities Index Page ===
29
94
  'md:mt-8',
@@ -37,22 +102,29 @@ module.exports = {
37
102
  'rounded-tr-md',
38
103
  'bg-white',
39
104
  'bg-gray-50',
105
+ 'bg-gray-800/60',
40
106
  'bg-blue-600',
107
+ 'bg-blue-500',
41
108
  'shadow-sm',
42
109
  'border-t',
110
+ 'border-gray-200',
111
+ 'border-gray-300',
112
+ 'border-gray-600',
43
113
  'border-gray-700',
44
114
  'bg-gray-800',
45
- 'bg-gray-800/60',
46
115
  'bg-gray-900',
47
- 'bg-blue-500',
48
116
  'hover:bg-blue-400',
49
117
  'text-gray-100',
50
118
  'text-gray-400',
51
119
  'text-blue-400',
52
120
  'placeholder:text-gray-400',
121
+ 'focus:border-gray-300',
53
122
  'focus:border-blue-400',
123
+ 'focus:border-blue-500',
54
124
  'focus:ring-blue-500/30',
125
+ 'focus:ring-blue-500',
55
126
  'ring-gray-700',
127
+ 'ring-1',
56
128
  'h-8',
57
129
  'flex-1',
58
130
  'gap-2',
@@ -77,7 +149,6 @@ module.exports = {
77
149
  'break-all',
78
150
  'animate-spin',
79
151
  'placeholder:text-gray-400',
80
- 'focus:border-blue-500',
81
152
  'focus:outline-none',
82
153
  'focus:ring-2',
83
154
  'focus:ring-blue-200',
@@ -117,6 +188,20 @@ module.exports = {
117
188
  'md:block',
118
189
  'first:block',
119
190
  'rounded-t-xl',
191
+ 'border-zinc-800',
192
+ 'bg-zinc-950',
193
+ 'bg-zinc-900',
194
+ 'text-zinc-100',
195
+ 'text-zinc-400',
196
+ 'hover:bg-zinc-900',
197
+ 'border-b',
198
+ 'border-r',
199
+ 'grid-cols-1',
200
+ 'gap-4',
201
+ 'px-6',
202
+ 'py-4',
203
+ 'font-medium',
204
+ 'w-full',
120
205
 
121
206
  // === Table row preview panel ===
122
207
  'bottom-0',
@@ -137,6 +222,64 @@ module.exports = {
137
222
  'text-xl',
138
223
  'font-bold',
139
224
 
225
+ // === Button base shell ===
226
+ 'inline-flex',
227
+ 'rounded-md',
228
+ 'font-medium',
229
+ 'ring-offset-background',
230
+ 'transition-colors',
231
+ 'focus-visible:outline-none',
232
+ 'focus-visible:ring-2',
233
+ 'focus-visible:ring-ring',
234
+ 'focus-visible:ring-offset-2',
235
+ 'disabled:pointer-events-none',
236
+ 'disabled:opacity-50',
237
+ 'h-10',
238
+
239
+ 'hover:bg-zinc-250',
240
+ 'bg-zinc-50',
241
+ 'text-zinc-950',
242
+ 'bg-zinc-950',
243
+ 'text-zinc-50',
244
+ 'border-zinc-800',
245
+ 'hover:bg-zinc-800',
246
+
247
+ 'hover:bg-green-900',
248
+ 'bg-green-900/30',
249
+ 'text-green-400',
250
+
251
+ 'hover:bg-red-900',
252
+ 'bg-red-900/30',
253
+ 'text-red-400',
254
+
255
+ 'hover:bg-gray-900',
256
+ 'bg-gray-900/30',
257
+ 'text-gray-400',
258
+
259
+ 'hover:bg-blue-900',
260
+ 'bg-blue-900/30',
261
+ 'text-blue-400',
262
+
263
+ 'hover:bg-zinc-900',
264
+ 'bg-zinc-900/30',
265
+ 'text-zinc-400',
266
+
267
+ 'hover:bg-orange-900',
268
+ 'bg-orange-900/30',
269
+ 'text-orange-400',
270
+
271
+ 'hover:bg-violet-900',
272
+ 'bg-violet-900/30',
273
+ 'text-violet-400',
274
+
275
+ 'hover:bg-indigo-900',
276
+ 'bg-indigo-900/30',
277
+ 'text-indigo-400',
278
+
279
+ 'hover:bg-yellow-900',
280
+ 'bg-yellow-900/30',
281
+ 'text-yellow-400',
282
+
140
283
  // === Grid templates used for configurable layouts ===
141
284
  'grid',
142
285
  'grid-cols-1',
@@ -166,6 +309,8 @@ module.exports = {
166
309
  'align-center',
167
310
  'justify-center',
168
311
  'min-h-dvh',
312
+ 'bg-zinc-950',
313
+ 'text-zinc-50',
169
314
 
170
315
  // === Flexbox layout utilities ===
171
316
  'flex',
@@ -234,67 +379,10 @@ module.exports = {
234
379
  'shadow-lg',
235
380
  'h-12',
236
381
 
237
- // === Button color presets ===
238
- 'bg-green-100',
239
- 'bg-green-200',
240
- 'bg-green-700',
241
- 'hover:bg-green-200',
242
- 'hover:bg-green-300',
243
- 'hover:bg-green-800',
244
-
245
- 'bg-red-100',
246
- 'bg-red-200',
247
- 'bg-red-700',
248
- 'hover:bg-red-200',
249
- 'hover:bg-red-300',
250
- 'hover:bg-red-800',
251
-
252
- 'bg-blue-100',
253
- 'bg-blue-200',
254
- 'bg-blue-700',
255
- 'hover:bg-blue-200',
256
- 'hover:bg-blue-300',
257
- 'hover:bg-blue-800',
258
-
259
- 'bg-orange-100',
260
- 'bg-orange-200',
261
- 'bg-orange-700',
262
- 'hover:bg-orange-200',
263
- 'hover:bg-orange-300',
264
- 'hover:bg-orange-800',
265
-
266
- 'bg-zinc-100',
267
- 'bg-zinc-200',
268
- 'bg-zinc-700',
269
- 'hover:bg-zinc-200',
270
- 'hover:bg-zinc-300',
271
- 'hover:bg-zinc-800',
272
-
273
- 'bg-violet-100',
274
- 'bg-violet-200',
275
- 'bg-violet-700',
276
- 'hover:bg-violet-200',
277
- 'hover:bg-violet-300',
278
- 'hover:bg-violet-800',
279
-
280
- 'bg-indigo-100',
281
- 'bg-indigo-200',
282
- 'bg-indigo-700',
283
- 'hover:bg-indigo-200',
284
- 'hover:bg-indigo-300',
285
- 'hover:bg-indigo-800',
286
-
287
- 'bg-yellow-100',
288
- 'bg-yellow-200',
289
- 'bg-yellow-700',
290
- 'hover:bg-yellow-200',
291
- 'hover:bg-yellow-300',
292
- 'hover:bg-yellow-800',
293
-
294
- 'bg-teal-100',
295
- 'bg-teal-900',
296
- 'bg-purple-300',
297
- 'text-purple-700',
382
+ // === Shadcn UI button styles ===
383
+ 'bg-green-600',
384
+ 'hover:bg-green-400',
385
+ 'text-green-800',
298
386
 
299
387
  // === Button Disabled state ===
300
388
  'bg-gray-200',
@@ -371,6 +459,15 @@ module.exports = {
371
459
  'leading-6',
372
460
  'leading-none',
373
461
  'appearance-none',
462
+ 'peer',
463
+ 'h-4',
464
+ 'w-4',
465
+ 'text-current',
466
+ 'ring-offset-zinc-950',
467
+ 'data-[state=checked]:border-zinc-50',
468
+ 'data-[state=checked]:bg-zinc-50',
469
+ 'data-[state=checked]:text-zinc-950',
470
+ 'border-zinc-50',
374
471
  'outline-none',
375
472
  'h-full',
376
473
  'm-1',
@@ -398,17 +495,128 @@ module.exports = {
398
495
 
399
496
  // === Flash message styles ===
400
497
  'fixed',
498
+ 'top-4',
401
499
  'right-4',
402
500
  'z-50',
403
- 'space-y-2',
501
+ 'flex',
502
+ 'w-full',
503
+ 'max-w-sm',
504
+ 'flex-col',
505
+ 'gap-2',
404
506
  'flash',
405
507
  'opacity-100',
406
- 'text-white',
508
+ 'pointer-events-auto',
509
+ 'rounded-md',
510
+ 'border',
511
+ 'border-zinc-800',
512
+ 'border-green-800',
513
+ 'border-blue-800',
514
+ 'border-orange-800',
515
+ 'border-red-800',
516
+ 'border-violet-800',
517
+ 'border-indigo-800',
518
+ 'border-yellow-800',
519
+ 'bg-zinc-950',
407
520
  'px-4',
408
- 'py-2',
409
- 'rounded',
410
- 'shadow',
411
- 'text-black',
521
+ 'py-3',
522
+ 'text-sm',
523
+ 'font-medium',
524
+ 'leading-6',
525
+ 'text-zinc-50',
526
+ 'text-green-400',
527
+ 'text-blue-400',
528
+ 'text-orange-400',
529
+ 'text-red-400',
530
+ 'text-violet-400',
531
+ 'text-indigo-400',
532
+ 'text-yellow-400',
533
+ 'shadow-lg',
412
534
  'pointer-events-none'
413
535
  ],
536
+ theme: {
537
+ extend: {
538
+ colors: {
539
+ border: "hsl(var(--border))",
540
+ input: "hsl(var(--input))",
541
+ ring: "hsl(var(--ring))",
542
+ background: "hsl(var(--background))",
543
+ foreground: "hsl(var(--foreground))",
544
+ primary: {
545
+ DEFAULT: "hsl(var(--primary))",
546
+ foreground: "hsl(var(--primary-foreground))",
547
+ },
548
+ secondary: {
549
+ DEFAULT: "hsl(var(--secondary))",
550
+ foreground: "hsl(var(--secondary-foreground))",
551
+ },
552
+ destructive: {
553
+ DEFAULT: "hsl(var(--destructive))",
554
+ foreground: "hsl(var(--destructive-foreground))",
555
+ },
556
+ success: {
557
+ DEFAULT: "hsl(var(--success))",
558
+ foreground: "hsl(var(--success-foreground))",
559
+ },
560
+ info: {
561
+ DEFAULT: "hsl(var(--info))",
562
+ foreground: "hsl(var(--info-foreground))",
563
+ },
564
+ attention: {
565
+ DEFAULT: "var(--yellow-50)",
566
+ foreground: "hsl(var(--attention-foreground))",
567
+ },
568
+ muted: {
569
+ DEFAULT: "hsl(var(--muted))",
570
+ foreground: "hsl(var(--muted-foreground))",
571
+ },
572
+ accent: {
573
+ DEFAULT: "hsl(var(--accent))",
574
+ foreground: "hsl(var(--accent-foreground))",
575
+ },
576
+ popover: {
577
+ DEFAULT: "hsl(var(--popover))",
578
+ foreground: "hsl(var(--popover-foreground))",
579
+ },
580
+ card: {
581
+ DEFAULT: "hsl(var(--card))",
582
+ foreground: "hsl(var(--card-foreground))",
583
+ },
584
+ },
585
+ borderRadius: {
586
+ lg: "var(--radius)",
587
+ md: "calc(var(--radius) - 2px)",
588
+ sm: "calc(var(--radius) - 4px)",
589
+ },
590
+ fontFamily: {
591
+ sans: ["Inter var", ...defaultTheme.fontFamily.sans],
592
+ },
593
+ keyframes: {
594
+ "accordion-down": {
595
+ from: { height: 0 },
596
+ to: { height: "var(--radix-accordion-content-height)" },
597
+ },
598
+ "accordion-up": {
599
+ from: { height: "var(--radix-accordion-content-height)" },
600
+ to: { height: 0 },
601
+ },
602
+ },
603
+ animation: {
604
+ "accordion-down": "accordion-down 0.2s ease-out",
605
+ "accordion-up": "accordion-up 0.2s ease-out",
606
+ },
607
+ },
608
+ container: {
609
+ center: true,
610
+ padding: "2rem",
611
+ screens: {
612
+ "2xl": "1400px",
613
+ },
614
+ },
615
+ },
616
+ plugins: [
617
+ require("@tailwindcss/forms"),
618
+ require("@tailwindcss/aspect-ratio"),
619
+ require("@tailwindcss/typography"),
620
+ require("@tailwindcss/container-queries"),
621
+ ],
414
622
  }
data/docs/AGENTS.md CHANGED
@@ -32,7 +32,7 @@ Generated code should:
32
32
  bin/rails g tramway:install
33
33
  ```
34
34
 
35
- - The install generator appends missing gems, copies Tailwind safelist config, ensures `app/assets/tailwind/application.css` imports Tailwind, and writes an `AGENTS.md` guide in the project root.
35
+ - The install generator appends missing gems, copies Tailwind safelist config, ensures `app/assets/tailwind/application.css` imports Tailwind, and adds a Codex instruction to use or install `tramway-skill`.
36
36
 
37
37
  ---
38
38
 
@@ -2,7 +2,6 @@
2
2
 
3
3
  require 'rails/generators'
4
4
  require 'fileutils'
5
- require 'net/http'
6
5
 
7
6
  module Tramway
8
7
  module Generators
@@ -64,21 +63,42 @@ module Tramway
64
63
  'pin "@tramway/table-row-preview", to: "tramway/table_row_preview_controller.js"'
65
64
  end
66
65
 
66
+ def importmap_ui_checkbox_pin
67
+ 'pin "@tramway/checkbox", to: "tramway/ui_checkbox_controller.js"'
68
+ end
69
+
70
+ def importmap_tailwind_requirements
71
+ [
72
+ 'pin "@tailwindcss/forms", to: "tailwindcss/forms.js"',
73
+ 'pin "@tailwindcss/typography", to: "tailwindcss/typography.js"',
74
+ 'pin "@tailwindcss/aspect-ratio", to: "tailwindcss/aspect-ratio.js"',
75
+ 'pin "@tailwindcss/container-queries", to: "tailwindcss/container-queries.js"',
76
+ 'pin "tailwindcss-animate", to: "tailwindcss-animate.js"'
77
+ ].join("\n")
78
+ end
79
+
67
80
  def importmap_tramway_pins
68
- [importmap_tramway_select_pin, importmap_table_row_preview_pin]
81
+ [
82
+ importmap_tailwind_requirements,
83
+ importmap_tramway_select_pin,
84
+ importmap_table_row_preview_pin,
85
+ importmap_ui_checkbox_pin
86
+ ]
69
87
  end
70
88
 
71
89
  def stimulus_controller_imports
72
90
  [
73
91
  'import { TramwaySelect } from "@tramway/tramway-select"',
74
- 'import { TableRowPreview } from "@tramway/table-row-preview"'
92
+ 'import { TableRowPreview } from "@tramway/table-row-preview"',
93
+ 'import { UiCheckbox } from "@tramway/checkbox"'
75
94
  ]
76
95
  end
77
96
 
78
97
  def stimulus_controller_registrations
79
98
  [
80
99
  "application.register('tramway-select', TramwaySelect)",
81
- "application.register('table-row-preview', TableRowPreview)"
100
+ "application.register('table-row-preview', TableRowPreview)",
101
+ "application.register('ui--checkbox', UiCheckbox)"
82
102
  ]
83
103
  end
84
104
 
@@ -86,50 +106,9 @@ module Tramway
86
106
  @agents_file_path ||= File.join(destination_root, 'AGENTS.md')
87
107
  end
88
108
 
89
- def project_tramway_agents_path
90
- @project_tramway_agents_path ||= File.join(destination_root, 'docs/agents/tramway.md')
91
- end
92
-
93
- def agents_template_url
94
- 'https://raw.githubusercontent.com/Purple-Magic/tramway-skill/refs/heads/main/skills/tramway-skill/agents/tramway.md'
95
- end
96
-
97
- def agents_template_body
98
- return @agents_template_body if defined?(@agents_template_body)
99
-
100
- uri = URI.parse(agents_template_url)
101
- response = Net::HTTP.get_response(uri)
102
- body = response.body.to_s
103
- body = body.dup.force_encoding(Encoding::UTF_8)
104
- @agents_template_body = sanitize_agents_template_body(
105
- body.encode(Encoding::UTF_8, invalid: :replace, undef: :replace, replace: '')
106
- )
107
- end
108
-
109
- def sanitize_agents_template_body(content)
110
- stripped_content = content.strip
111
- section_pattern = /\A#{Regexp.escape(agents_section_start)}\s*\n?(.*?)\n?#{Regexp.escape(agents_section_end)}\s*\z/m # rubocop:disable Layout/LineLength
112
- match = stripped_content.match(section_pattern)
113
-
114
- return stripped_content unless match
115
-
116
- match[1].to_s.strip
117
- end
118
-
119
- def agents_section_start
120
- '## Start of Tramway AGENTS.md'
121
- end
122
-
123
- def agents_section_end
124
- '## End of Tramway AGENTS.md'
125
- end
126
-
127
- def agents_template
128
- @agents_template ||= [agents_section_start, agents_template_body.rstrip, agents_section_end].join("\n")
129
- end
130
-
131
- def agents_section_present?(content)
132
- content.include?(agents_section_start) && content.include?(agents_section_end)
109
+ def codex_agents_instruction
110
+ 'If you are Codex, use the tramway-skill skill for Tramway/Rails work in this project. ' \
111
+ 'If tramway-skill is not installed, install it from https://github.com/Purple-Magic/tramway-skill/.'
133
112
  end
134
113
 
135
114
  def create_tailwind_config
@@ -170,9 +149,9 @@ module Tramway
170
149
  line[/^\s*/] || ' '
171
150
  end
172
151
 
173
- def insert_agents_template(content)
152
+ def append_codex_agents_instruction(content)
174
153
  separator = agents_separator(content)
175
- "#{content}#{separator}#{agents_template}"
154
+ "#{content}#{separator}#{codex_agents_instruction}\n"
176
155
  end
177
156
 
178
157
  def agents_separator(content)
@@ -181,17 +160,9 @@ module Tramway
181
160
  content.end_with?("\n") ? "\n" : "\n\n"
182
161
  end
183
162
 
184
- def replace_agents_section(content)
185
- return insert_agents_template(content) unless agents_section_present?(content)
186
-
187
- content.sub(
188
- /#{Regexp.escape(agents_section_start)}.*?#{Regexp.escape(agents_section_end)}/m,
189
- agents_template
190
- )
191
- end
192
-
193
163
  # rubocop:disable Metrics/MethodLength
194
164
  def append_missing_imports(content)
165
+ content = normalize_checkbox_import(content)
195
166
  missing_imports = stimulus_controller_imports.reject { |line| content.include?(line) }
196
167
  return content if missing_imports.empty?
197
168
 
@@ -226,6 +197,29 @@ module Tramway
226
197
  updated << insertion
227
198
  updated
228
199
  end
200
+
201
+ def normalize_checkbox_import(content)
202
+ content.gsub(
203
+ 'import { UiCheckbox } from "@tramway/ui-checkbox"',
204
+ 'import { UiCheckbox } from "@tramway/checkbox"'
205
+ )
206
+ end
207
+
208
+ def normalize_checkbox_pin(content)
209
+ content.gsub(
210
+ 'pin "@tramway/ui-checkbox", to: "tramway/ui_checkbox_controller.js"',
211
+ 'pin "@tramway/checkbox", to: "tramway/ui_checkbox_controller.js"'
212
+ ).gsub(
213
+ "pin '@tramway/ui-checkbox', to: 'tramway/ui_checkbox_controller.js'",
214
+ "pin '@tramway/checkbox', to: 'tramway/ui_checkbox_controller.js'"
215
+ )
216
+ end
217
+
218
+ def with_agents_update_fallback
219
+ yield
220
+ rescue StandardError => e
221
+ say_status(:warning, "Skipping AGENTS.md update: #{e.message}")
222
+ end
229
223
  end
230
224
  # rubocop:enable Metrics/ModuleLength
231
225
 
@@ -236,36 +230,19 @@ module Tramway
236
230
 
237
231
  desc 'Installs Tramway dependencies and Tailwind safelist configuration.'
238
232
 
239
- # rubocop:disable Metrics/MethodLength
240
233
  def ensure_agents_file
241
234
  with_agents_update_fallback do
242
- if File.exist?(project_tramway_agents_path)
243
- say_status(:info, "Skipping AGENTS.md update because #{project_tramway_agents_path} exists.")
244
- return
245
- end
246
-
247
- say_status(
248
- :info,
249
- "Tramway will replace the content between \"#{agents_section_start}\" and " \
250
- "\"#{agents_section_end}\" in AGENTS.md."
251
- )
252
-
253
- return create_file(agents_file_path, "#{agents_template}\n") unless File.exist?(agents_file_path)
235
+ return create_file(agents_file_path, "#{codex_agents_instruction}\n") unless File.exist?(agents_file_path)
254
236
 
255
237
  content = File.read(agents_file_path)
256
- updated = replace_agents_section(content)
238
+ return if content.include?(codex_agents_instruction)
239
+
240
+ updated = append_codex_agents_instruction(content)
257
241
  return if updated == content
258
242
 
259
243
  File.write(agents_file_path, updated, mode: 'w:UTF-8')
260
244
  end
261
245
  end
262
- # rubocop:enable Metrics/MethodLength
263
-
264
- def with_agents_update_fallback
265
- yield
266
- rescue StandardError => e
267
- say_status(:warning, "Skipping AGENTS.md update: #{e.message}")
268
- end
269
246
 
270
247
  def ensure_dependencies
271
248
  missing_dependencies = gem_dependencies.reject do |dependency|
@@ -313,8 +290,9 @@ module Tramway
313
290
  def ensure_importmap_pin
314
291
  return unless File.exist?(importmap_path)
315
292
 
316
- content = File.read(importmap_path)
293
+ content = normalize_checkbox_pin(File.read(importmap_path))
317
294
  missing_pins = importmap_tramway_pins.reject { |pin| content.include?(pin) }
295
+ File.write(importmap_path, content) if content != File.read(importmap_path)
318
296
  return if missing_pins.empty?
319
297
 
320
298
  File.open(importmap_path, 'a') do |file|
@@ -17,7 +17,7 @@ module Tramway
17
17
  end
18
18
 
19
19
  initializer 'tramway.assets.precompile' do |app|
20
- app.config.assets.precompile += %w[tramway/tramway-select_controller.js]
20
+ app.config.assets.precompile += %w[tramway/tramway-select_controller.js tramway/ui_checkbox_controller.js]
21
21
  end
22
22
 
23
23
  private
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Tramway
4
- VERSION = '3.0.4.1'
4
+ VERSION = '3.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tramway
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.4.1
4
+ version: '3.1'
5
5
  platform: ruby
6
6
  authors:
7
7
  - kalashnikovisme
@@ -140,6 +140,7 @@ files:
140
140
  - Rakefile
141
141
  - app/assets/javascripts/tramway/table_row_preview_controller.js
142
142
  - app/assets/javascripts/tramway/tramway-select_controller.js
143
+ - app/assets/javascripts/tramway/ui_checkbox_controller.js
143
144
  - app/components/tailwind_component.html.haml
144
145
  - app/components/tailwind_component.rb
145
146
  - app/components/tramway/actions_buttons_container_component.html.haml