ariadne_view_components 0.0.93.2 → 0.0.94

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 (141) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +7 -0
  3. data/README.md +13 -4
  4. data/app/assets/javascripts/ariadne_view_components.js +14 -14
  5. data/app/assets/javascripts/ariadne_view_components.js.br +0 -0
  6. data/app/assets/javascripts/ariadne_view_components.js.gz +0 -0
  7. data/app/assets/javascripts/ariadne_view_components.js.map +1 -1
  8. data/app/assets/stylesheets/ariadne_view_components.css +1 -1
  9. data/app/assets/stylesheets/ariadne_view_components.css.br +0 -0
  10. data/app/assets/stylesheets/ariadne_view_components.css.gz +0 -0
  11. data/app/components/ariadne/base_component.rb +25 -22
  12. data/app/components/ariadne/behaviors/tooltipable.rb +12 -12
  13. data/app/components/ariadne/form/checkbox/component.rb +2 -2
  14. data/app/components/ariadne/form/group/component.rb +1 -1
  15. data/app/components/ariadne/form/radio_button/component.rb +2 -2
  16. data/app/components/ariadne/form/select/component.rb +1 -1
  17. data/app/components/ariadne/form/text_field/component.html.erb +2 -2
  18. data/app/components/ariadne/form/text_field/component.rb +14 -7
  19. data/app/components/ariadne/form/toggle/component.rb +2 -2
  20. data/app/components/ariadne/form/toggle_group/component.rb +1 -1
  21. data/app/components/ariadne/form/toggle_group/option/component.rb +1 -1
  22. data/app/components/ariadne/layout/grid/component.rb +1 -1
  23. data/app/components/ariadne/layout/grid/item/component.rb +2 -2
  24. data/app/components/ariadne/layout/label_block/component.rb +1 -1
  25. data/app/components/ariadne/layout/narrow/component.rb +1 -1
  26. data/app/components/ariadne/ui/accordion/component.rb +3 -1
  27. data/app/components/ariadne/ui/accordion/item/component.html.erb +10 -10
  28. data/app/components/ariadne/ui/accordion/item/component.rb +12 -3
  29. data/app/components/ariadne/ui/avatar/component.html.erb +9 -7
  30. data/app/components/ariadne/ui/avatar/component.rb +55 -7
  31. data/app/components/ariadne/ui/badge/component.rb +35 -16
  32. data/app/components/ariadne/ui/banner/component.html.erb +23 -0
  33. data/app/components/ariadne/ui/banner/component.rb +226 -0
  34. data/app/components/ariadne/ui/banner/component.ts +46 -0
  35. data/app/components/ariadne/ui/blankslate/component.html.erb +2 -2
  36. data/app/components/ariadne/ui/blankslate/component.rb +12 -1
  37. data/app/components/ariadne/ui/button/component.rb +35 -24
  38. data/app/components/ariadne/ui/card/body/component.rb +1 -1
  39. data/app/components/ariadne/ui/card/component.rb +11 -7
  40. data/app/components/ariadne/ui/card/footer/component.rb +1 -1
  41. data/app/components/ariadne/ui/card/header/component.html.erb +2 -2
  42. data/app/components/ariadne/ui/card/header/component.rb +25 -16
  43. data/app/components/ariadne/ui/clipboard_copy/component.html.erb +1 -0
  44. data/app/components/ariadne/ui/clipboard_copy/component.rb +17 -21
  45. data/app/components/ariadne/ui/clipboard_copy/component.ts +15 -0
  46. data/app/components/ariadne/ui/color_dot/component.html.erb +5 -5
  47. data/app/components/ariadne/ui/color_dot/component.rb +19 -4
  48. data/app/components/ariadne/ui/combobox/component.html.erb +1 -1
  49. data/app/components/ariadne/ui/combobox/component.rb +54 -23
  50. data/app/components/ariadne/ui/combobox/component.ts +2 -0
  51. data/app/components/ariadne/ui/dialog/body/component.html.erb +3 -0
  52. data/app/components/ariadne/ui/dialog/body/component.rb +28 -0
  53. data/app/components/ariadne/ui/dialog/component.html.erb +25 -24
  54. data/app/components/ariadne/ui/dialog/component.rb +87 -18
  55. data/app/components/ariadne/ui/dialog/component.ts +5 -1
  56. data/app/components/ariadne/ui/dialog/footer/component.html.erb +3 -0
  57. data/app/components/ariadne/ui/dialog/footer/component.rb +34 -0
  58. data/app/components/ariadne/ui/heroicon/component.rb +21 -21
  59. data/app/components/ariadne/ui/image/component.rb +11 -23
  60. data/app/components/ariadne/ui/link/component.html.erb +1 -3
  61. data/app/components/ariadne/ui/link/component.rb +17 -4
  62. data/app/components/ariadne/ui/list/component.html.erb +5 -9
  63. data/app/components/ariadne/ui/list/component.rb +31 -7
  64. data/app/components/ariadne/ui/list/item/component.rb +6 -5
  65. data/app/components/ariadne/ui/pagination/component.rb +1 -2
  66. data/app/components/ariadne/ui/popover/component.html.erb +1 -1
  67. data/app/components/ariadne/ui/popover/component.rb +31 -26
  68. data/app/components/ariadne/ui/relative_time/component.html.erb +1 -0
  69. data/app/components/ariadne/ui/{time_ago → relative_time}/component.rb +15 -15
  70. data/app/components/ariadne/ui/{time_ago → relative_time}/component.ts +1 -1
  71. data/app/components/ariadne/ui/shortcut/component.html.erb +0 -1
  72. data/app/components/ariadne/ui/shortcut/component.rb +31 -5
  73. data/app/components/ariadne/ui/shortcut/component.ts +1 -1
  74. data/app/components/ariadne/ui/skeleton/component.rb +2 -8
  75. data/app/components/ariadne/ui/stats_panel/component.html.erb +3 -3
  76. data/app/components/ariadne/ui/stats_panel/component.rb +25 -1
  77. data/app/components/ariadne/ui/stats_panel/item/component.html.erb +3 -3
  78. data/app/components/ariadne/ui/stats_panel/item/component.rb +6 -6
  79. data/app/components/ariadne/ui/table/cell/component.rb +1 -1
  80. data/app/components/ariadne/ui/table/row/component.rb +1 -1
  81. data/app/components/ariadne/ui/typography/component.rb +3 -1
  82. data/app/frontend/controllers/tooltip_controller.ts +8 -3
  83. data/app/frontend/stylesheets/ariadne_view_components.css +1 -0
  84. data/app/frontend/stylesheets/theme.css +88 -0
  85. data/app/frontend/utils/createController.ts +9 -0
  86. data/app/helpers/ariadne/color_helper.rb +158 -0
  87. data/app/helpers/ariadne/form_helper.rb +1 -0
  88. data/app/helpers/ariadne/size_helper.rb +7 -0
  89. data/app/lib/ariadne/attributes_helper.rb +4 -4
  90. data/app/lib/ariadne/view_component/style_variants.rb +1 -1
  91. data/app/lib/ariadne/view_helper.rb +0 -6
  92. data/lib/ariadne/accessibility.rb +64 -0
  93. data/lib/ariadne/forms/dsl/form_object.rb +5 -1
  94. data/lib/ariadne/forms/dsl/input.rb +1 -1
  95. data/lib/ariadne/static/generate_arguments.rb +54 -0
  96. data/lib/ariadne/static/generate_audited_at.rb +17 -0
  97. data/lib/ariadne/static/generate_constants.rb +19 -0
  98. data/lib/ariadne/static/generate_previews.rb +53 -0
  99. data/lib/ariadne/static/generate_statuses.rb +17 -0
  100. data/lib/ariadne/static/generate_structure.rb +279 -0
  101. data/lib/ariadne/static.rb +68 -0
  102. data/lib/ariadne/view_components/constants.rb +2 -2
  103. data/lib/ariadne/view_components/version.rb +1 -1
  104. data/lib/ariadne/view_components.rb +0 -51
  105. data/lib/ariadne/yard/component_manifest.rb +81 -81
  106. data/lib/ariadne/yard/component_ref.rb +1 -1
  107. data/lib/ariadne/yard/docs_helper.rb +24 -16
  108. data/lib/ariadne/yard/dry_initializer/common_handler.rb +103 -0
  109. data/lib/ariadne/yard/dry_initializer/option_handler.rb +38 -0
  110. data/lib/ariadne/yard/dry_initializer/param_handler.rb +57 -0
  111. data/lib/ariadne/yard/registry.rb +2 -5
  112. data/lib/ariadne/yard/{info_arch_docs_helper.rb → structure_docs_helper.rb} +5 -5
  113. data/lib/ariadne/yard.rb +20 -8
  114. data/lib/rubocop/config/default.yml +0 -3
  115. metadata +34 -37
  116. data/app/components/ariadne/behaviors/captionable.rb +0 -55
  117. data/app/components/ariadne/turbo/frame/component.html.erb +0 -3
  118. data/app/components/ariadne/turbo/frame/component.rb +0 -16
  119. data/app/components/ariadne/turbo/stream_action/component.html.erb +0 -4
  120. data/app/components/ariadne/turbo/stream_action/component.rb +0 -25
  121. data/app/components/ariadne/ui/data_table/component.html.erb +0 -1
  122. data/app/components/ariadne/ui/data_table/component.rb +0 -11
  123. data/app/components/ariadne/ui/flash/component.html.erb +0 -18
  124. data/app/components/ariadne/ui/flash/component.rb +0 -151
  125. data/app/components/ariadne/ui/flash/component.ts +0 -56
  126. data/app/components/ariadne/ui/overlay/component.html.erb +0 -12
  127. data/app/components/ariadne/ui/overlay/component.rb +0 -54
  128. data/app/components/ariadne/ui/overlay/component.ts +0 -92
  129. data/app/components/ariadne/ui/time_ago/component.html.erb +0 -1
  130. data/lib/ariadne/view_components/commands.rb +0 -90
  131. data/lib/ariadne/view_components/statuses.rb +0 -14
  132. data/lib/ariadne/view_components/upstream.rb +0 -19
  133. data/lib/ariadne/yard/lookbook_pages_backend.rb +0 -235
  134. data/lib/rubocop/cop/ariadne/no_tag_memoize.rb +0 -44
  135. data/static/arguments.yml +0 -879
  136. data/static/assets/view-components.svg +0 -18
  137. data/static/classes.yml +0 -211
  138. data/static/constants.json +0 -743
  139. data/static/statuses.json +0 -58
  140. data/static/tailwindcss.yml +0 -727
  141. /data/app/components/ariadne/ui/{time_ago → relative_time}/en.yml +0 -0
@@ -1,25 +0,0 @@
1
- # typed: false
2
- # frozen_string_literal: true
3
-
4
- module Ariadne
5
- module Turbo
6
- module StreamAction
7
- class Component < Ariadne::BaseComponent
8
- option :component
9
- option :action, default: -> { "update" }
10
-
11
- def target
12
- @target ||= component.component_id
13
- end
14
-
15
- def turbo_action
16
- @turbo_action ||= empty? ? "update" : action
17
- end
18
-
19
- def empty?
20
- action == "drop"
21
- end
22
- end
23
- end
24
- end
25
- end
@@ -1 +0,0 @@
1
- <div>Add Ariadne::UI::DataTable template here</div>
@@ -1,11 +0,0 @@
1
- # typed: false
2
- # frozen_string_literal: true
3
-
4
- module Ariadne
5
- module UI
6
- module DataTable
7
- class Component < Ariadne::BaseComponent
8
- end
9
- end
10
- end
11
- end
@@ -1,18 +0,0 @@
1
- <div class="<%= html_attrs[:class] %>" <%= html_attributes %>>
2
- <div class="ariadne-p-4">
3
- <div class="ariadne-flex ariadne-items-start">
4
- <div class="ariadne-flex-shrink-0 <%= style(:text, type:) %>">
5
- <%= icon %>
6
- </div>
7
- <div class="ariadne-ml-3 ariadne-w-0 ariadne-flex-1 ariadne-pt-0.5 <%= style(:text, type:) %>">
8
- <p class="ariadne-text-sm ariadne-font-semibold" data-flash-target="title"><%= title %></p>
9
- <p class="ariadne-mt-1 ariadne-text-sm" data-flash-target="message"><%= message %></p>
10
- </div>
11
- <div class="ariadne-ml-4 ariadne-flex ariadne-flex-shrink-0 ">
12
- <% if dismissable? %>
13
- <%= render Ariadne::UI::Button::Component.new(theme: :nude, html_attrs: { class: style(:dismissable, type:), aria: { label: "close_label" }, data: { action: "click->#{stimulus_name}#hide" } }).as_icon(icon: "x-mark", variant: :outline) %>
14
- <% end %>
15
- </div>
16
- </div>
17
- </div>
18
- </div>
@@ -1,151 +0,0 @@
1
- # typed: false
2
- # frozen_string_literal: true
3
-
4
- module Ariadne
5
- module UI
6
- module Flash
7
- class Component < Ariadne::BaseComponent
8
- option :type
9
- option :dismissible, default: proc { false }
10
- option :title
11
- option :message
12
- option :persist, default: proc { false }
13
- option :width, default: proc { :base }
14
-
15
- accepts_html_attributes do |html_attrs|
16
- unless persist
17
- html_attrs[:data] = {
18
- controller: "flash",
19
- transition_enter: "ariadne-transform ariadne-ease-out ariadne-duration-300 ariadne-transition-all",
20
- transition_enter_start: "ariadne-translate-y-2 ariadne-opacity-0 sm:ariadne-translate-y-0 sm:ariadne-translate-x-2",
21
- transition_enter_end: "ariadne-translate-y-0 ariadne-opacity-100 sm:ariadne-translate-x-0",
22
- transition_leave: "ariadne-transition-all ariadne-ease-in ariadne-duration-100",
23
- transition_leave_start: "ariadne-opacity-100",
24
- transition_leave_end: "ariadne-opacity-0",
25
- }
26
- end
27
-
28
- html_attrs[:class] = Ariadne::ViewComponents.tailwind_merger.merge([
29
- html_attrs[:class],
30
- style(type:, width:),
31
- ])
32
- end
33
-
34
- renders_one :icon, Ariadne::UI::Heroicon::Component
35
-
36
- def dismissable?
37
- dismissible
38
- end
39
-
40
- style do
41
- base do
42
- [
43
- "ariadne-pointer-events-auto",
44
- "ariadne-overflow-hidden",
45
- "ariadne-rounded-lg",
46
- "ariadne-shadow-lg",
47
- "ariadne-ring-1",
48
- "ariadne-ring-slate-950",
49
- "ariadne-ring-opacity-5",
50
- "ariadne-z-50",
51
- ]
52
- end
53
-
54
- variants do
55
- width do
56
- base do
57
- [
58
- "ariadne-w-full",
59
- "ariadne-max-w-sm",
60
- ]
61
- end
62
-
63
- full do
64
- [
65
- "ariadne-w-full",
66
- ]
67
- end
68
- end
69
-
70
- type do
71
- danger do
72
- [
73
- "ariadne-bg-red-50",
74
- ]
75
- end
76
- warning do
77
- [
78
- "ariadne-bg-yellow-50",
79
- ]
80
- end
81
- info do
82
- [
83
- "ariadne-bg-blue-50",
84
- ]
85
- end
86
- success do
87
- [
88
- "ariadne-bg-green-50",
89
- ]
90
- end
91
- end
92
- end
93
- end
94
-
95
- style(:text) do
96
- variants do
97
- type do
98
- danger do
99
- [
100
- "ariadne-text-red-700",
101
- ]
102
- end
103
- warning do
104
- [
105
- "ariadne-text-yellow-700",
106
- ]
107
- end
108
- info do
109
- [
110
- "ariadne-text-blue-700",
111
- ]
112
- end
113
- success do
114
- [
115
- "ariadne-text-green-700",
116
- ]
117
- end
118
- end
119
- end
120
- end
121
-
122
- style(:dismissable) do
123
- variants do
124
- type do
125
- danger do
126
- [
127
- "ariadne-text-red-700",
128
- ]
129
- end
130
- warning do
131
- [
132
- "ariadne-text-yellow-700",
133
- ]
134
- end
135
- info do
136
- [
137
- "ariadne-text-blue-700",
138
- ]
139
- end
140
- success do
141
- [
142
- "ariadne-text-green-700",
143
- ]
144
- end
145
- end
146
- end
147
- end
148
- end
149
- end
150
- end
151
- end
@@ -1,56 +0,0 @@
1
- import {Controller} from '@hotwired/stimulus'
2
- // @ts-expect-error: this is untyped https://github.com/mmccall10/el-transition/issues/11
3
- import {enter, leave} from 'el-transition'
4
-
5
- export default class FlashController extends Controller {
6
- static classes = ['ariadne-hidden']
7
-
8
- static values = {
9
- timer: {
10
- default: 4000,
11
- type: Number,
12
- },
13
- }
14
- declare readonly hasHiddenClass: boolean
15
-
16
- declare readonly hasTimerValue: boolean
17
- declare readonly hiddenClass: string
18
- declare readonly hiddenClasses: string[]
19
- declare timerValue: number
20
-
21
- async connect(): Promise<void> {
22
- // Start animation as soon as it connects to the dom
23
- await this.show()
24
- const noop = (): void => {}
25
-
26
- // Set a timer for it to be removed from the dom automatically
27
- setTimeout(() => {
28
- this.hide().then(noop).catch(noop)
29
- }, this.timerValue)
30
- }
31
-
32
- async disconnect(): Promise<void> {
33
- await this.hide()
34
- }
35
-
36
- async hide(): Promise<void> {
37
- await leave(this.element)
38
-
39
- if (this.hasHiddenClass) {
40
- this.element.classList.add(this.hiddenClass)
41
- } else {
42
- this.element.classList.add('ariadne-hidden')
43
- }
44
-
45
- this.element.remove()
46
- }
47
-
48
- async show(): Promise<void> {
49
- if (this.hasHiddenClass) {
50
- this.element.classList.remove(this.hiddenClass)
51
- } else {
52
- this.element.classList.remove('ariadne-hidden')
53
- }
54
- await enter(this.element)
55
- }
56
- }
@@ -1,12 +0,0 @@
1
- <details class="ariadne-inline" <%= html_attrs.to_html %>>
2
- <summary class="ariadne-list-none ariadne-rounded" data-<%= stimulus_name %>-target="anchor">
3
- <%= trigger %>
4
- </summary>
5
- <details-menu
6
- class="<%= style(size:) %>"
7
- role="menu"
8
- data-<%= stimulus_name %>-target="popover"
9
- data-action="details-menu-selected->overlay#close">
10
- <%= content %>
11
- </details-menu>
12
- </details>
@@ -1,54 +0,0 @@
1
- # typed: false
2
- # frozen_string_literal: true
3
-
4
- module Ariadne
5
- module UI
6
- module Overlay
7
- class Component < Ariadne::BaseComponent
8
- renders_one :trigger, Ariadne::UI::Button::Component
9
-
10
- accepts_html_attributes do |html_attrs|
11
- html_attrs[:data] = {
12
- controller: [stimulus_name, html_attrs.fetch(:data, {}).fetch(:controller, nil)].compact.join(" "),
13
- "#{stimulus_name}-placement-value": placement,
14
- "#{stimulus_name}-clamped-value": clamped,
15
- }
16
- end
17
- option :size, default: proc { :base }
18
- option :placement, default: proc { "bottom" }
19
-
20
- option :clamped, default: proc { false }
21
-
22
- style do
23
- base do
24
- [
25
- "ariadne-fixed",
26
- "ariadne-max-w-[90vw]",
27
- "ariadne-z-20",
28
-
29
- "ariadne-scroll",
30
- "ariadne-scrollbar-trigger",
31
-
32
- "ariadne-rounded-lg",
33
- "ariadne-shadow-lg",
34
-
35
- "ariadne-bg-foreground",
36
- "dark:ariadne-bg-foreground-dark",
37
- "ariadne-text-content",
38
- "dark:ariadne-text-content-dark",
39
- ]
40
- end
41
-
42
- variants do
43
- size do
44
- sm { "ariadne-w-36" }
45
- md { "ariadne-w-52" }
46
- base { "ariadne-w-64" }
47
- lg { "ariadne-w-96" }
48
- end
49
- end
50
- end
51
- end
52
- end
53
- end
54
- end
@@ -1,92 +0,0 @@
1
- import {type Placement, autoUpdate, computePosition, flip, offset, shift} from '@floating-ui/dom'
2
- import {controllerFactory} from '@utils/createController'
3
- import {useClickOutside, useMutation} from 'stimulus-use'
4
-
5
- export default class OverlayController extends controllerFactory<HTMLDetailsElement>()({
6
- targets: {
7
- anchor: null,
8
- popover: null,
9
- },
10
- values: {
11
- clamped: Boolean,
12
- placement: String,
13
- },
14
- }) {
15
- private changedIds = new Set<string>()
16
- private clickHandlers: Array<() => void> = []
17
- labels: Array<{el: HTMLLabelElement}>
18
- unsubAutoUpdate: (() => void) | undefined
19
-
20
- private setupClickHandlers() {
21
- const cb = () => this.toggle()
22
-
23
- for (const fn of this.clickHandlers) {
24
- fn()
25
- }
26
- this.clickHandlers = []
27
-
28
- for (const el of this.anchorTarget.querySelectorAll('button, [tabindex]:not([tabindex="-1"])')) {
29
- el.addEventListener('click', cb)
30
- this.clickHandlers.push(() => el.removeEventListener('click', cb))
31
- }
32
- }
33
-
34
- checkboxClicked(e: Event) {
35
- const target = e.target as HTMLInputElement
36
- const value = target.value
37
- if (this.changedIds.has(value)) {
38
- this.changedIds.delete(value)
39
- } else {
40
- this.changedIds.add(value)
41
- }
42
- this.dispatch('clicked', {detail: value})
43
- }
44
-
45
- clickOutside() {
46
- this.setupAutoUpdate()
47
- this.close()
48
- }
49
-
50
- close() {
51
- this.element.open = false
52
- }
53
-
54
- connect() {
55
- useClickOutside(this)
56
- useMutation(this, {childList: true, subtree: true})
57
- this.setupAutoUpdate()
58
- this.setupClickHandlers()
59
- }
60
-
61
- disconnect() {
62
- this.unsubAutoUpdate?.()
63
- }
64
-
65
- setupAutoUpdate(): void {
66
- if (!this.element.open) {
67
- this.unsubAutoUpdate?.()
68
- return
69
- }
70
-
71
- const updatePopoverPosition = (): void => {
72
- void computePosition(this.anchorTarget, this.popoverTarget, {
73
- middleware: [offset(6), flip(), shift({padding: 6})],
74
- placement: this.placementValue as Placement,
75
- strategy: 'fixed',
76
- }).then(({x, y}) => {
77
- Object.assign(this.popoverTarget.style, {
78
- left: `${x}px`,
79
- top: `${y}px`,
80
- })
81
- })
82
- }
83
-
84
- updatePopoverPosition()
85
- this.unsubAutoUpdate = autoUpdate(this.anchorTarget, this.popoverTarget, updatePopoverPosition)
86
- }
87
-
88
- toggle(): void {
89
- this.element.open = !this.element.open
90
- this.setupAutoUpdate()
91
- }
92
- }
@@ -1 +0,0 @@
1
- <relative-time <%= html_attributes %>></relative-time>
@@ -1,90 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "upstream"
4
-
5
- module Ariadne
6
- module ViewComponents
7
- # commands related to the upstream Tailwindcss project
8
- module Commands
9
- # raised when the host platform is not supported by upstream tailwindcss's binary releases
10
- class UnsupportedPlatformException < StandardError
11
- end
12
-
13
- # raised when the tailwindcss executable could not be found where we expected it to be
14
- class ExecutableNotFoundException < StandardError
15
- end
16
-
17
- class << self
18
- def platform
19
- [:cpu, :os].map { |m| Gem::Platform.local.send(m) }.join("-")
20
- end
21
-
22
- def executable(
23
- exe_path: File.expand_path(File.join(__dir__, "..", "..", "..", "exe"))
24
- )
25
- if Ariadne::ViewComponents::Upstream::NATIVE_PLATFORMS.keys.none? { |p| Gem::Platform.match(p) }
26
- raise UnsupportedPlatformException, <<~MESSAGE
27
- ariadne_view_components does not support the #{platform} platform
28
- Please install tailwindcss following instructions at https://tailwindcss.com/docs/installation
29
- MESSAGE
30
- end
31
-
32
- exe_path = Dir.glob(File.expand_path(File.join(exe_path, "*", "tailwindcss"))).find do |f|
33
- Gem::Platform.match(File.basename(File.dirname(f)))
34
- end
35
-
36
- if exe_path.nil?
37
- raise ExecutableNotFoundException, <<~MESSAGE
38
- Cannot find the tailwindcss executable for #{platform} in #{exe_path}
39
-
40
- If you're using bundler, please make sure you're on the latest bundler version:
41
-
42
- gem install bundler
43
- bundle update --bundler
44
-
45
- Then make sure your lock file includes this platform by running:
46
-
47
- bundle lock --add-platform #{platform}
48
- bundle install
49
-
50
- See `bundle lock --help` output for details.
51
-
52
- If you're still seeing this message after taking those steps, try running
53
- `bundle config` and ensure `force_ruby_platform` isn't set to `true`. See
54
- https://github.com/rails/tailwindcss-rails#check-bundle_force_ruby_platform
55
- for more details.
56
- MESSAGE
57
- end
58
-
59
- exe_path
60
- end
61
-
62
- def compile_command(debug: false, **kwargs)
63
- [
64
- executable(**kwargs),
65
- "-i",
66
- local_path("app/assets/stylesheets/ariadne_view_components.css"),
67
- "-o",
68
- "app/assets/builds/ariadne_view_components.css",
69
- "-c",
70
- local_path("tailwind.config.js"),
71
- ].tap do |command|
72
- command << "--minify" unless debug
73
- end
74
- end
75
-
76
- def watch_command(poll: false, **kwargs)
77
- compile_command(**kwargs).tap do |command|
78
- command << "-w"
79
- command << "-p" if poll
80
- end
81
- end
82
-
83
- def local_path(path)
84
- root = File.expand_path(File.join(__dir__, "..", "..", ".."))
85
- File.join(root, path)
86
- end
87
- end
88
- end
89
- end
90
- end
@@ -1,14 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "json"
4
-
5
- module Ariadne
6
- # :nodoc:
7
- module ViewComponents
8
- STATUSES = JSON.parse(
9
- File.read(
10
- File.join(File.dirname(__FILE__), "../../../static/statuses.json"),
11
- ),
12
- ).freeze
13
- end
14
- end
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Ariadne
4
- module ViewComponents
5
- # constants describing the upstream tailwindcss project
6
- module Upstream
7
- VERSION = "v3.3.2"
8
-
9
- # rubygems platform name => upstream release filename
10
- NATIVE_PLATFORMS = {
11
- "arm64-darwin" => "tailwindcss-macos-arm64",
12
- "x64-mingw-ucrt" => "tailwindcss-windows-x64.exe",
13
- "x86_64-darwin" => "tailwindcss-macos-x64",
14
- "x86_64-linux" => "tailwindcss-linux-x64",
15
- "aarch64-linux" => "tailwindcss-linux-arm64",
16
- }
17
- end
18
- end
19
- end