coveragebook_components 0.15.0 → 0.17.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.
- checksums.yaml +4 -4
- data/app/assets/build/coco/{book.css → coco.css} +1158 -1796
- data/app/assets/build/coco/coco.js +11206 -10950
- data/app/assets/build/coco/tailwind.preset.js +2760 -0
- data/app/assets/css/base/setup.css +0 -43
- data/app/assets/css/base/tippy.css +40 -43
- data/app/assets/css/base/utils/text.css +0 -210
- data/app/assets/css/coco.css +34 -0
- data/app/assets/css/plugins/aspect.js +27 -0
- data/app/assets/css/plugins/colors.js +30 -0
- data/app/assets/css/plugins/icons.js +17 -0
- data/app/assets/css/plugins/layout.js +15 -0
- data/app/assets/css/plugins/text.js +183 -0
- data/app/assets/js/base/tippy/plugins/hide_on_esc.js +3 -1
- data/app/assets/js/coco/coco.js +0 -9
- data/app/assets/js/coco.js +5 -0
- data/app/assets/js/helpers/index.js +10 -2
- data/app/components/coco/buttons/button/button.css +5 -5
- data/app/components/coco/buttons/button_group/button_group.css +1 -1
- data/app/components/coco/buttons/color_picker_button/color_picker_button.css +1 -1
- data/app/components/coco/buttons/layout_picker_button/layout_picker_button.html.erb +5 -1
- data/app/components/coco/buttons/layout_picker_button/layout_picker_button.rb +2 -2
- data/app/components/coco/buttons/menu/menu.css +1 -1
- data/app/components/coco/buttons/menu_items/user_profile/user_profile.css +1 -1
- data/app/components/coco/component.rb +1 -1
- data/app/components/coco/concerns/acts_as_field_with_options.rb +0 -1
- data/app/components/coco/fields/button_component.rb +1 -1
- data/app/components/coco/fields/submit_component.rb +1 -1
- data/app/components/coco/indicators/badge/badge.css +1 -1
- data/app/components/coco/layout/panel/panel.css +1 -1
- data/app/components/coco/modals/modal/modal.css +1 -1
- data/app/components/coco/modals/modal_dialog/modal_dialog.css +1 -1
- data/app/components/coco/utilities/placeholder/placeholder.css +1 -1
- data/app/helpers/coco/components_helper.rb +253 -3
- data/app/helpers/coco/integration_helper.rb +26 -4
- data/config/exports.js +0 -0
- data/config/locales/coco.en.yml +0 -18
- data/config/tailwind.config.js +1 -83
- data/config/tailwind.preset.js +67 -0
- data/config/tokens.js +25 -21
- data/lib/coco/engine.rb +0 -4
- data/lib/coco.rb +1 -1
- metadata +12 -68
- data/app/assets/build/coco/app.css +0 -9711
- data/app/assets/build/coco/app.js +0 -25142
- data/app/assets/build/coco/book.js +0 -16548
- data/app/assets/css/app.css +0 -3
- data/app/assets/css/base/utils/colors.css +0 -30
- data/app/assets/css/base/utils/icons.css +0 -16
- data/app/assets/css/base/utils/layout.css +0 -13
- data/app/assets/css/book.css +0 -3
- data/app/assets/js/app.js +0 -11
- data/app/assets/js/book.js +0 -9
- data/app/assets/js/helpers/screenshot.js +0 -42
- data/app/assets/js/helpers/turbo_events.js +0 -13
- data/app/components/coco/app/application_layout/application_layout.css +0 -122
- data/app/components/coco/app/application_layout/application_layout.html.erb +0 -32
- data/app/components/coco/app/application_layout/application_layout.js +0 -36
- data/app/components/coco/app/application_layout/application_layout.rb +0 -16
- data/app/components/coco/app/contact_callout/contact_callout.css +0 -119
- data/app/components/coco/app/contact_callout/contact_callout.html.erb +0 -28
- data/app/components/coco/app/contact_callout/contact_callout.rb +0 -21
- data/app/components/coco/app/faqs/faqs.css +0 -38
- data/app/components/coco/app/faqs/faqs.html.erb +0 -12
- data/app/components/coco/app/faqs/faqs.rb +0 -14
- data/app/components/coco/app/header/header.css +0 -47
- data/app/components/coco/app/header/header.html.erb +0 -30
- data/app/components/coco/app/header/header.js +0 -11
- data/app/components/coco/app/header/header.rb +0 -33
- data/app/components/coco/app/nav_drawer/nav_drawer.css +0 -58
- data/app/components/coco/app/nav_drawer/nav_drawer.html.erb +0 -16
- data/app/components/coco/app/nav_drawer/nav_drawer.js +0 -24
- data/app/components/coco/app/nav_drawer/nav_drawer.rb +0 -32
- data/app/components/coco/app/plan_card/plan_card.css +0 -132
- data/app/components/coco/app/plan_card/plan_card.html.erb +0 -36
- data/app/components/coco/app/plan_card/plan_card.rb +0 -66
- data/app/components/coco/app/plan_confirmation/plan_confirmation.css +0 -53
- data/app/components/coco/app/plan_confirmation/plan_confirmation.html.erb +0 -16
- data/app/components/coco/app/plan_confirmation/plan_confirmation.rb +0 -18
- data/app/components/coco/app/plan_picker/plan_picker.css +0 -128
- data/app/components/coco/app/plan_picker/plan_picker.html.erb +0 -69
- data/app/components/coco/app/plan_picker/plan_picker.js +0 -56
- data/app/components/coco/app/plan_picker/plan_picker.rb +0 -25
- data/app/components/coco/app/sidebar_nav/item/item.css +0 -121
- data/app/components/coco/app/sidebar_nav/item/item.html.erb +0 -9
- data/app/components/coco/app/sidebar_nav/item/item.js +0 -80
- data/app/components/coco/app/sidebar_nav/item/item.rb +0 -48
- data/app/components/coco/app/sidebar_nav/menu/menu.css +0 -138
- data/app/components/coco/app/sidebar_nav/menu/menu.html.erb +0 -24
- data/app/components/coco/app/sidebar_nav/menu/menu.js +0 -12
- data/app/components/coco/app/sidebar_nav/menu/menu.rb +0 -46
- data/app/components/coco/app/sidebar_nav/navbar/navbar.css +0 -75
- data/app/components/coco/app/sidebar_nav/navbar/navbar.html.erb +0 -29
- data/app/components/coco/app/sidebar_nav/navbar/navbar.js +0 -28
- data/app/components/coco/app/sidebar_nav/navbar/navbar.rb +0 -50
- data/app/components/coco/app/slide_editor/slide_editor.css +0 -149
- data/app/components/coco/app/slide_editor/slide_editor.html.erb +0 -302
- data/app/components/coco/app/slide_editor/slide_editor.js +0 -269
- data/app/components/coco/app/slide_editor/slide_editor.rb +0 -114
- data/app/components/coco/book/editable_slide/editable_slide.css +0 -332
- data/app/components/coco/book/editable_slide/editable_slide.html.erb +0 -48
- data/app/components/coco/book/editable_slide/editable_slide.rb +0 -72
- data/app/components/coco/book/media_slide/media_slide.css +0 -7
- data/app/components/coco/book/media_slide/media_slide.html.erb +0 -3
- data/app/components/coco/book/media_slide/media_slide.rb +0 -12
- data/app/helpers/coco/app_components_helper.rb +0 -39
- data/app/helpers/coco/book_components_helper.rb +0 -11
- data/app/helpers/coco/core_components_helper.rb +0 -257
data/app/assets/js/coco.js
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import "./base/polyfills";
|
|
2
|
+
import helpers from "@helpers/index";
|
|
3
|
+
import tippy from "./base/tippy";
|
|
2
4
|
import Coco from "./coco/coco";
|
|
5
|
+
import CocoComponent from "./coco/component";
|
|
6
|
+
import tokens from "@config/tokens.js";
|
|
3
7
|
import components from "./base/components";
|
|
4
8
|
|
|
5
9
|
Coco.registerComponents(components);
|
|
6
10
|
|
|
7
11
|
export default Coco;
|
|
12
|
+
export { Coco, CocoComponent, tippy, helpers, tokens };
|
|
@@ -1,7 +1,15 @@
|
|
|
1
|
+
import * as alpine from "./alpine";
|
|
1
2
|
import * as color from "./color";
|
|
2
3
|
import * as dom from "./dom";
|
|
3
4
|
import * as lang from "./lang";
|
|
4
5
|
import * as location from "./location";
|
|
5
|
-
import * as
|
|
6
|
+
import * as path from "./path";
|
|
6
7
|
|
|
7
|
-
export {
|
|
8
|
+
export default {
|
|
9
|
+
...alpine,
|
|
10
|
+
...color,
|
|
11
|
+
...dom,
|
|
12
|
+
...lang,
|
|
13
|
+
...location,
|
|
14
|
+
...path,
|
|
15
|
+
};
|
|
@@ -154,10 +154,10 @@
|
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
&[data-theme="toolbar-floating"] {
|
|
157
|
-
@apply bg-white hover:bg-gray-100 active:bg-gray-200 border-gray-300;
|
|
157
|
+
@apply bg-white hover:bg-coco-gray-100 active:bg-coco-gray-200 border-coco-gray-300;
|
|
158
158
|
|
|
159
159
|
&[data-state="active"] {
|
|
160
|
-
@apply bg-gray-200;
|
|
160
|
+
@apply bg-coco-gray-200;
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
163
|
|
|
@@ -303,18 +303,18 @@
|
|
|
303
303
|
}
|
|
304
304
|
|
|
305
305
|
&[data-theme="neutral-dark"] {
|
|
306
|
-
@apply bg-background-dark-1 text-content-light-1 hover:bg-gray-700 active:bg-gray-600 antialiased;
|
|
306
|
+
@apply bg-background-dark-1 text-content-light-1 hover:bg-coco-gray-700 active:bg-coco-gray-600 antialiased;
|
|
307
307
|
|
|
308
308
|
&[data-state="loading"] {
|
|
309
309
|
@apply bg-background-dark-1;
|
|
310
310
|
}
|
|
311
311
|
|
|
312
312
|
&[data-state="active"] {
|
|
313
|
-
@apply bg-gray-600;
|
|
313
|
+
@apply bg-coco-gray-600;
|
|
314
314
|
}
|
|
315
315
|
|
|
316
316
|
&[data-disabled="true"] {
|
|
317
|
-
@apply bg-gray-300;
|
|
317
|
+
@apply bg-coco-gray-300;
|
|
318
318
|
}
|
|
319
319
|
}
|
|
320
320
|
|
|
@@ -16,7 +16,11 @@
|
|
|
16
16
|
class="layout-picker-option"
|
|
17
17
|
:class="{'layout-picker-option-current': typeof selectedLayout !== 'undefined' && selectedLayout === '<%= options[:name] %>'}"
|
|
18
18
|
aria-label="<%= options[:name] %>">
|
|
19
|
-
|
|
19
|
+
<% if options[:thumbnail] %>
|
|
20
|
+
<%= coco_svg(options[:thumbnail]) %>
|
|
21
|
+
<% else %>
|
|
22
|
+
<%= options[:icon] %>
|
|
23
|
+
<% end %>
|
|
20
24
|
</button>
|
|
21
25
|
<% end %>
|
|
22
26
|
</div>
|
|
@@ -9,8 +9,8 @@ module Coco
|
|
|
9
9
|
Coco::Button.new(**args)
|
|
10
10
|
end
|
|
11
11
|
|
|
12
|
-
renders_many :layouts, ->(name:, thumbnail
|
|
13
|
-
@layout_options << {name: name, thumbnail: thumbnail, **layout_options}
|
|
12
|
+
renders_many :layouts, ->(name:, thumbnail: nil, **layout_options, &block) do
|
|
13
|
+
@layout_options << {name: name, thumbnail: thumbnail, **layout_options, icon: block&.call}
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
attr_reader :layout_options, :size, :resize
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
/* Only style Coco panels that are not rendered inside legacy panel components */
|
|
10
10
|
&:not([data-component="panel"] [data-component="panel"]) {
|
|
11
|
-
@apply block bg-content-light-1 border border-gray-300 shadow-md rounded-xl;
|
|
11
|
+
@apply block bg-content-light-1 border border-coco-gray-300 shadow-md rounded-xl;
|
|
12
12
|
|
|
13
13
|
.panel-content {
|
|
14
14
|
@apply block;
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
.modal-dialog-header {
|
|
11
11
|
@apply relative flex items-center;
|
|
12
|
-
@apply px-4 sm:px-8 h-14 sm:h-16 border-b border-gray-300 rounded-t-xl bg-white;
|
|
12
|
+
@apply px-4 sm:px-8 h-14 sm:h-16 border-b border-coco-gray-300 rounded-t-xl bg-white;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
.modal-dialog-title {
|
|
@@ -1,7 +1,257 @@
|
|
|
1
1
|
module Coco
|
|
2
2
|
module ComponentsHelper
|
|
3
|
-
include
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
include ActionView::Helpers::UrlHelper
|
|
4
|
+
|
|
5
|
+
# Buttons
|
|
6
|
+
|
|
7
|
+
def coco_button(*args, **kwargs, &block)
|
|
8
|
+
href, content = if block
|
|
9
|
+
[args.first, nil]
|
|
10
|
+
else
|
|
11
|
+
(args.size == 1) ? [nil, args.first] : args[0..2].reverse!
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
button = if kwargs.key?(:action) || kwargs.key?(:method) || kwargs.key?(:params)
|
|
15
|
+
"Coco::ButtonTo"
|
|
16
|
+
else
|
|
17
|
+
"Coco::Button"
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
component = button.constantize.new(href: href, **kwargs)
|
|
21
|
+
component = component.with_content(content) if !block && content.present?
|
|
22
|
+
|
|
23
|
+
render(component, &block)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def coco_button_group(**, &block)
|
|
27
|
+
render Coco::ButtonGroup.new(**), &block
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def coco_menu_button(**, &block)
|
|
31
|
+
render Coco::MenuButton.new(**), &block
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def coco_menu_item(type, **, &block)
|
|
35
|
+
render coco_component("menu_items/#{type}", **), &block
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def coco_confirm_button(href = nil, **, &block)
|
|
39
|
+
render Coco::ConfirmButton.new(href: href, **), &block
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def coco_color_picker_button(**, &block)
|
|
43
|
+
render Coco::ColorPickerButton.new(**), &block
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def coco_image_picker_button(**, &block)
|
|
47
|
+
render Coco::ImagePickerButton.new(**), &block
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def coco_layout_picker_button(**, &block)
|
|
51
|
+
render Coco::LayoutPickerButton.new(**), &block
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def coco_toolbar(**, &block)
|
|
55
|
+
render Coco::Toolbar.new(**), &block
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def coco_option_bar(**, &block)
|
|
59
|
+
render Coco::OptionBar.new(**), &block
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# Embeds
|
|
63
|
+
|
|
64
|
+
def coco_embed(platform, url = nil, **)
|
|
65
|
+
case platform
|
|
66
|
+
when :youtube
|
|
67
|
+
render Coco::YoutubeEmbed.new(url: url, **)
|
|
68
|
+
else
|
|
69
|
+
raise ArgumentError, "`#{platform}` is not a valid embed type"
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# Forms (WIP)
|
|
74
|
+
|
|
75
|
+
def coco_form_with(**, &block)
|
|
76
|
+
form_with(**, builder: Coco::AppFormBuilder, &block)
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def coco_form_for(*, **, &block)
|
|
80
|
+
form_for(*, **, builder: Coco::AppFormBuilder, &block)
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def coco_fields(**, &block)
|
|
84
|
+
fields(**, builder: Coco::AppFormBuilder, &block)
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
# Images
|
|
88
|
+
|
|
89
|
+
def coco_svg(path = nil, **)
|
|
90
|
+
render Coco::Svg.new(path: path, **)
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def coco_image(src = nil, **)
|
|
94
|
+
render Coco::Image.new(src: src, **)
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
def coco_avatar(src, name = nil, **)
|
|
98
|
+
render Coco::Avatar.new(src: src, name: name, **)
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
def coco_icon(icon_name = nil, **, &block)
|
|
102
|
+
render Coco::Icon.new(name: icon_name, **), &block
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
# Indicators
|
|
106
|
+
|
|
107
|
+
def coco_stamp(type = nil, **)
|
|
108
|
+
props = case type
|
|
109
|
+
when :success, :positive
|
|
110
|
+
{icon: :check_circle, theme: :positive}
|
|
111
|
+
when :error, :negative
|
|
112
|
+
{icon: :alert_circle, theme: :negative}
|
|
113
|
+
when :warning
|
|
114
|
+
{icon: :alert_triangle, theme: :warning}
|
|
115
|
+
when :info
|
|
116
|
+
{icon: :info, theme: :info}
|
|
117
|
+
else
|
|
118
|
+
{}
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
render Coco::Stamp.new(**props, **)
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
def coco_badge(text, **)
|
|
125
|
+
render Coco::Badge.new(**).with_content(text)
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
# Layout
|
|
129
|
+
|
|
130
|
+
def coco_spacer(size = Coco::Spacer::DEFAULT, **)
|
|
131
|
+
render Coco::Spacer.new(size:, **)
|
|
132
|
+
end
|
|
133
|
+
alias_method :space, :coco_spacer
|
|
134
|
+
|
|
135
|
+
def coco_stack(spacing: Coco::Spacer::DEFAULT, **, &block)
|
|
136
|
+
render Coco::Stack.new(spacing:, **), &block
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
def coco_panel(**, &block)
|
|
140
|
+
render Coco::Panel.new(**), &block
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
def coco_page(id, **, &block)
|
|
144
|
+
render Coco::Page.new(id: id, **), &block
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
# Messaging
|
|
148
|
+
|
|
149
|
+
def coco_notice(**, &block)
|
|
150
|
+
render Coco::Notice.new(**), &block
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
def coco_snackbar(**, &block)
|
|
154
|
+
render Coco::Snackbar.new(**), &block
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
def coco_toast(**, &block)
|
|
158
|
+
render Coco::Toast.new(**), &block
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
def coco_system_banner(**, &block)
|
|
162
|
+
render Coco::SystemBanner.new(**), &block
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
# Modals
|
|
166
|
+
|
|
167
|
+
def coco_modal(name = "default", **, &block)
|
|
168
|
+
render(Coco::Modal.new(name: name, **), &block)
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
def coco_modal_dialog(name = "default", **, &block)
|
|
172
|
+
render(Coco::Modal.new(name: name, **)) do |modal|
|
|
173
|
+
modal.with_container_dialog(&block)
|
|
174
|
+
end
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
def coco_modal_lightbox(name = "default", scroll_top: nil, **, &block)
|
|
178
|
+
render(Coco::Modal.new(name: name, scroll_top: scroll_top, **)) do |modal|
|
|
179
|
+
modal.with_container_lightbox(&block)
|
|
180
|
+
end
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
# Navigation
|
|
184
|
+
|
|
185
|
+
def coco_link(*args, **, &block)
|
|
186
|
+
href, content = if block
|
|
187
|
+
[args.first, nil]
|
|
188
|
+
else
|
|
189
|
+
(args.size == 1) ? [nil, args.first] : args[0..2].reverse!
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
link = Coco::Link.new(href: href, **)
|
|
193
|
+
link = link.with_content(content) if !block && content.present?
|
|
194
|
+
|
|
195
|
+
render(link, &block)
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
def coco_link_to(name = nil, options = nil, html_options = nil, &block)
|
|
199
|
+
html_options, options, name = options, name, block if block
|
|
200
|
+
options ||= {}
|
|
201
|
+
html_options = Coco::ActionViewHelper.convert_options_to_data_attributes(options, html_options)
|
|
202
|
+
|
|
203
|
+
href = Coco::ActionViewHelper.url_target(name, options)
|
|
204
|
+
|
|
205
|
+
if block
|
|
206
|
+
coco_link(href, **html_options.symbolize_keys!, &block)
|
|
207
|
+
else
|
|
208
|
+
coco_link(name, href, **html_options.symbolize_keys!)
|
|
209
|
+
end
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
def coco_button_to(name = nil, options = nil, html_options = nil, &block)
|
|
213
|
+
html_options, options = options, name if block
|
|
214
|
+
options ||= {}
|
|
215
|
+
html_options ||= {}
|
|
216
|
+
html_options.symbolize_keys!
|
|
217
|
+
|
|
218
|
+
button = Coco::ButtonTo.new(action: options, type: :submit, **html_options)
|
|
219
|
+
button = button.with_content(name) unless block
|
|
220
|
+
render(button, &block)
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
def coco_pager_button(direction, **, &block)
|
|
224
|
+
render Coco::PagerButton.new(direction:, **), &block
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
# Typography
|
|
228
|
+
|
|
229
|
+
def coco_prose(**, &block)
|
|
230
|
+
render Coco::Prose.new(**), &block
|
|
231
|
+
end
|
|
232
|
+
|
|
233
|
+
def coco_seamless_textarea(**, &block)
|
|
234
|
+
render Coco::SeamlessTextarea.new(**), &block
|
|
235
|
+
end
|
|
236
|
+
|
|
237
|
+
# Utilties (internal)
|
|
238
|
+
|
|
239
|
+
def coco_placeholder(text_content = nil, **, &block)
|
|
240
|
+
render Coco::Placeholder.new(text_content:, **), &block
|
|
241
|
+
end
|
|
242
|
+
|
|
243
|
+
# General
|
|
244
|
+
|
|
245
|
+
def coco_tag(*, **, &block)
|
|
246
|
+
render Coco::Tag.new(*, **), &block
|
|
247
|
+
end
|
|
248
|
+
|
|
249
|
+
def coco_component(name, *, **)
|
|
250
|
+
resolve_component("coco/#{name}", *, **)
|
|
251
|
+
end
|
|
252
|
+
|
|
253
|
+
def resolve_component(...)
|
|
254
|
+
Coco::ComponentResolver.new(...)
|
|
255
|
+
end
|
|
6
256
|
end
|
|
7
257
|
end
|
|
@@ -1,11 +1,33 @@
|
|
|
1
1
|
module Coco
|
|
2
2
|
module IntegrationHelper
|
|
3
|
-
def coco_stylesheet_tag(
|
|
4
|
-
stylesheet_link_tag("coco#{"/dev" if dev}
|
|
3
|
+
def coco_stylesheet_tag(dev: ENV["COCO_PATH"], **)
|
|
4
|
+
stylesheet_link_tag("coco#{"/dev" if dev}/coco", **)
|
|
5
5
|
end
|
|
6
6
|
|
|
7
|
-
def coco_stylesheet_file_path(
|
|
8
|
-
|
|
7
|
+
def coco_stylesheet_file_path(...)
|
|
8
|
+
IntegrationHelper.stylesheet_file_path(...)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def coco_javascript_file_path(...)
|
|
12
|
+
IntegrationHelper.javascript_file_path(...)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def coco_tailwind_preset_path(...)
|
|
16
|
+
IntegrationHelper.tailwind_preset_path(...)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
class << self
|
|
20
|
+
def stylesheet_file_path(dev: ENV["COCO_PATH"], **opts)
|
|
21
|
+
File.join(Coco::Engine.root, "app/assets/build/coco#{"/dev" if dev}/coco.css")
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def javascript_file_path(dev: ENV["COCO_PATH"], **opts)
|
|
25
|
+
File.join(Coco::Engine.root, "app/assets/build/coco#{"/dev" if dev}/coco.js")
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def tailwind_preset_path
|
|
29
|
+
File.join(Coco::Engine.root, "app/assets/build/coco/tailwind.preset.js")
|
|
30
|
+
end
|
|
9
31
|
end
|
|
10
32
|
end
|
|
11
33
|
end
|
data/config/exports.js
ADDED
|
File without changes
|
data/config/locales/coco.en.yml
CHANGED
|
@@ -1,23 +1,5 @@
|
|
|
1
1
|
en:
|
|
2
2
|
coco:
|
|
3
|
-
app:
|
|
4
|
-
slide_editor:
|
|
5
|
-
bg_color_picker:
|
|
6
|
-
label: "Background colour"
|
|
7
|
-
bg_image_picker:
|
|
8
|
-
label: "Background image"
|
|
9
|
-
blank_state: "Drag a jpg, png or gif onto the slide area or..."
|
|
10
|
-
text_color_picker:
|
|
11
|
-
label: "Text colour"
|
|
12
|
-
layout_picker:
|
|
13
|
-
label: "Layout"
|
|
14
|
-
undo_button:
|
|
15
|
-
tooltip: "Undo"
|
|
16
|
-
redo_button:
|
|
17
|
-
tooltip: "Redo"
|
|
18
|
-
save_button:
|
|
19
|
-
label: "Save"
|
|
20
|
-
saving_label: "Saving..."
|
|
21
3
|
test:
|
|
22
4
|
translatable:
|
|
23
5
|
greeting: "Hello"
|
data/config/tailwind.config.js
CHANGED
|
@@ -1,94 +1,12 @@
|
|
|
1
1
|
/** @type {import('tailwindcss').Config} */
|
|
2
2
|
|
|
3
|
-
const defaultTheme = require("tailwindcss/defaultTheme");
|
|
4
3
|
const { cocoPath } = require("./utils.js");
|
|
5
|
-
const { fontSize, fontFamily, colors, screens } = require("./tokens.js");
|
|
6
4
|
|
|
7
5
|
module.exports = {
|
|
6
|
+
presets: [require("./tailwind.preset.js")],
|
|
8
7
|
content: [
|
|
9
8
|
cocoPath("@components/**/*.{erb,rb,js}", true),
|
|
10
9
|
cocoPath("@assets/**/*.{erb,rb}", true),
|
|
11
|
-
cocoPath("@previews/**/*.{erb,rb}", true),
|
|
12
|
-
],
|
|
13
|
-
safelist: [
|
|
14
|
-
{
|
|
15
|
-
pattern: /tippy-.+/,
|
|
16
|
-
},
|
|
17
10
|
],
|
|
18
11
|
blocklist: ["container"],
|
|
19
|
-
theme: {
|
|
20
|
-
colors,
|
|
21
|
-
screens,
|
|
22
|
-
fontFamily: {
|
|
23
|
-
display: [fontFamily.displaySans, ...defaultTheme.fontFamily.sans],
|
|
24
|
-
body: [fontFamily.bodySans, ...defaultTheme.fontFamily.sans],
|
|
25
|
-
branded: [fontFamily.displaySerif, ...defaultTheme.fontFamily.serif],
|
|
26
|
-
},
|
|
27
|
-
extend: {
|
|
28
|
-
fontSize,
|
|
29
|
-
containers: {
|
|
30
|
-
"slide-fluid": "700px",
|
|
31
|
-
},
|
|
32
|
-
aspectRatio: {
|
|
33
|
-
slide: "16 / 10",
|
|
34
|
-
},
|
|
35
|
-
animation: {
|
|
36
|
-
spin: "spin 1.5s linear infinite",
|
|
37
|
-
"spin-reverse": "spin 1.5s linear infinite reverse",
|
|
38
|
-
},
|
|
39
|
-
spacing: {
|
|
40
|
-
13: "3.25rem",
|
|
41
|
-
15: "3.75rem",
|
|
42
|
-
18: "4.5rem",
|
|
43
|
-
},
|
|
44
|
-
customForms: () => ({
|
|
45
|
-
DEFAULT: {
|
|
46
|
-
checkbox: {
|
|
47
|
-
"&:indeterminate": {
|
|
48
|
-
background:
|
|
49
|
-
"url(\"data:image/svg+xml,%3Csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='8' height='2' x='4' y='7' rx='1'/%3E%3C/svg%3E\");",
|
|
50
|
-
borderColor: "transparent",
|
|
51
|
-
backgroundColor: "currentColor",
|
|
52
|
-
backgroundSize: "100% 100%",
|
|
53
|
-
backgroundPosition: "center",
|
|
54
|
-
backgroundRepeat: "no-repeat",
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
}),
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
corePlugins: {
|
|
62
|
-
aspectRatio: false,
|
|
63
|
-
},
|
|
64
|
-
plugins: [
|
|
65
|
-
require("@tailwindcss/forms"),
|
|
66
|
-
require("@tailwindcss/container-queries"),
|
|
67
|
-
|
|
68
|
-
({ matchUtilities, theme }) => {
|
|
69
|
-
// Safari 14-compatible aspect ratio
|
|
70
|
-
matchUtilities(
|
|
71
|
-
{
|
|
72
|
-
aspect: (value) => ({
|
|
73
|
-
"@supports (aspect-ratio: 1 / 1)": {
|
|
74
|
-
aspectRatio: value,
|
|
75
|
-
},
|
|
76
|
-
"@supports not (aspect-ratio: 1 / 1)": {
|
|
77
|
-
"&::before": {
|
|
78
|
-
content: '""',
|
|
79
|
-
float: "left",
|
|
80
|
-
paddingTop: `calc(100% / (${value}))`,
|
|
81
|
-
},
|
|
82
|
-
"&::after": {
|
|
83
|
-
clear: "left",
|
|
84
|
-
content: '""',
|
|
85
|
-
display: "block",
|
|
86
|
-
},
|
|
87
|
-
},
|
|
88
|
-
}),
|
|
89
|
-
},
|
|
90
|
-
{ values: theme("aspectRatio") }
|
|
91
|
-
);
|
|
92
|
-
},
|
|
93
|
-
],
|
|
94
12
|
};
|