coveragebook_components 0.16.0 → 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/build/coco/coco.css +1 -3
  3. data/app/assets/build/coco/coco.js +11199 -10947
  4. data/app/assets/build/coco/tailwind.preset.js +7 -6
  5. data/app/assets/css/base/setup.css +0 -32
  6. data/app/assets/css/coco.css +33 -2
  7. data/app/assets/js/base/tippy/plugins/hide_on_esc.js +3 -1
  8. data/app/assets/js/coco/coco.js +0 -9
  9. data/app/assets/js/coco.js +5 -0
  10. data/app/assets/js/helpers/index.js +10 -2
  11. data/app/components/coco/buttons/layout_picker_button/layout_picker_button.html.erb +5 -1
  12. data/app/components/coco/buttons/layout_picker_button/layout_picker_button.rb +2 -2
  13. data/app/components/coco/component.rb +1 -1
  14. data/app/components/coco/concerns/acts_as_field_with_options.rb +0 -1
  15. data/app/components/coco/fields/button_component.rb +1 -1
  16. data/app/components/coco/fields/submit_component.rb +1 -1
  17. data/app/helpers/coco/components_helper.rb +253 -3
  18. data/app/helpers/coco/integration_helper.rb +6 -6
  19. data/config/locales/coco.en.yml +0 -18
  20. data/config/tailwind.preset.js +7 -6
  21. data/lib/coco/engine.rb +0 -4
  22. data/lib/coco.rb +1 -1
  23. metadata +2 -65
  24. data/app/assets/build/coco/app.css +0 -9619
  25. data/app/assets/build/coco/app.js +0 -25150
  26. data/app/assets/build/coco/book.css +0 -7453
  27. data/app/assets/build/coco/book.js +0 -16552
  28. data/app/assets/css/app.css +0 -3
  29. data/app/assets/css/book.css +0 -3
  30. data/app/assets/js/app.js +0 -11
  31. data/app/assets/js/book.js +0 -9
  32. data/app/assets/js/helpers/screenshot.js +0 -42
  33. data/app/assets/js/helpers/turbo_events.js +0 -13
  34. data/app/components/coco/app/application_layout/application_layout.css +0 -122
  35. data/app/components/coco/app/application_layout/application_layout.html.erb +0 -32
  36. data/app/components/coco/app/application_layout/application_layout.js +0 -36
  37. data/app/components/coco/app/application_layout/application_layout.rb +0 -16
  38. data/app/components/coco/app/contact_callout/contact_callout.css +0 -119
  39. data/app/components/coco/app/contact_callout/contact_callout.html.erb +0 -28
  40. data/app/components/coco/app/contact_callout/contact_callout.rb +0 -21
  41. data/app/components/coco/app/faqs/faqs.css +0 -38
  42. data/app/components/coco/app/faqs/faqs.html.erb +0 -12
  43. data/app/components/coco/app/faqs/faqs.rb +0 -14
  44. data/app/components/coco/app/header/header.css +0 -47
  45. data/app/components/coco/app/header/header.html.erb +0 -30
  46. data/app/components/coco/app/header/header.js +0 -11
  47. data/app/components/coco/app/header/header.rb +0 -33
  48. data/app/components/coco/app/nav_drawer/nav_drawer.css +0 -58
  49. data/app/components/coco/app/nav_drawer/nav_drawer.html.erb +0 -16
  50. data/app/components/coco/app/nav_drawer/nav_drawer.js +0 -24
  51. data/app/components/coco/app/nav_drawer/nav_drawer.rb +0 -32
  52. data/app/components/coco/app/plan_card/plan_card.css +0 -132
  53. data/app/components/coco/app/plan_card/plan_card.html.erb +0 -36
  54. data/app/components/coco/app/plan_card/plan_card.rb +0 -66
  55. data/app/components/coco/app/plan_confirmation/plan_confirmation.css +0 -53
  56. data/app/components/coco/app/plan_confirmation/plan_confirmation.html.erb +0 -16
  57. data/app/components/coco/app/plan_confirmation/plan_confirmation.rb +0 -18
  58. data/app/components/coco/app/plan_picker/plan_picker.css +0 -128
  59. data/app/components/coco/app/plan_picker/plan_picker.html.erb +0 -69
  60. data/app/components/coco/app/plan_picker/plan_picker.js +0 -56
  61. data/app/components/coco/app/plan_picker/plan_picker.rb +0 -25
  62. data/app/components/coco/app/sidebar_nav/item/item.css +0 -121
  63. data/app/components/coco/app/sidebar_nav/item/item.html.erb +0 -9
  64. data/app/components/coco/app/sidebar_nav/item/item.js +0 -80
  65. data/app/components/coco/app/sidebar_nav/item/item.rb +0 -48
  66. data/app/components/coco/app/sidebar_nav/menu/menu.css +0 -138
  67. data/app/components/coco/app/sidebar_nav/menu/menu.html.erb +0 -24
  68. data/app/components/coco/app/sidebar_nav/menu/menu.js +0 -12
  69. data/app/components/coco/app/sidebar_nav/menu/menu.rb +0 -46
  70. data/app/components/coco/app/sidebar_nav/navbar/navbar.css +0 -75
  71. data/app/components/coco/app/sidebar_nav/navbar/navbar.html.erb +0 -29
  72. data/app/components/coco/app/sidebar_nav/navbar/navbar.js +0 -28
  73. data/app/components/coco/app/sidebar_nav/navbar/navbar.rb +0 -50
  74. data/app/components/coco/app/slide_editor/slide_editor.css +0 -149
  75. data/app/components/coco/app/slide_editor/slide_editor.html.erb +0 -302
  76. data/app/components/coco/app/slide_editor/slide_editor.js +0 -269
  77. data/app/components/coco/app/slide_editor/slide_editor.rb +0 -114
  78. data/app/components/coco/book/editable_slide/editable_slide.css +0 -332
  79. data/app/components/coco/book/editable_slide/editable_slide.html.erb +0 -48
  80. data/app/components/coco/book/editable_slide/editable_slide.rb +0 -72
  81. data/app/components/coco/book/media_slide/media_slide.css +0 -7
  82. data/app/components/coco/book/media_slide/media_slide.html.erb +0 -3
  83. data/app/components/coco/book/media_slide/media_slide.rb +0 -12
  84. data/app/helpers/coco/app_components_helper.rb +0 -39
  85. data/app/helpers/coco/book_components_helper.rb +0 -11
  86. data/app/helpers/coco/core_components_helper.rb +0 -257
@@ -1,50 +0,0 @@
1
- module Coco
2
- module App
3
- module SidebarNav
4
- class Navbar < Coco::Component
5
- include Coco::AppComponentsHelper
6
-
7
- tag_name :nav
8
- component_name :app_sidebar_nav
9
-
10
- renders_many :actions, ->(label, href, icon:, **kwargs) do
11
- actions_data << {label: label, href: href, icon: icon, **kwargs}
12
- end
13
-
14
- renders_many :items, types: {
15
- link: ->(label, href, show_on_mobile: true, **kwargs, &block) do
16
- nav_item(mobile: show_on_mobile) do
17
- render Coco::App::SidebarNav::Item.new(label: label, href: href, **kwargs), &block
18
- end
19
- end,
20
- menu: ->(label, show_on_mobile: true, **kwargs, &block) do
21
- nav_item(mobile: show_on_mobile) do
22
- render Coco::App::SidebarNav::Item.new(label: label, **kwargs) do |item|
23
- item.with_menu(&block)
24
- end
25
- end
26
- end
27
- }
28
-
29
- attr_reader :actions_data
30
-
31
- def initialize(**)
32
- @actions_data = []
33
- @menus_data = {}
34
- end
35
-
36
- def nav_item(mobile: true, &block)
37
- tag.div(class: "nav-item", data: {show_on_mobile: mobile.to_s}, &block)
38
- end
39
-
40
- def with_link(...)
41
- with_item_link(...)
42
- end
43
-
44
- def with_menu(...)
45
- with_item_menu(...)
46
- end
47
- end
48
- end
49
- end
50
- end
@@ -1,149 +0,0 @@
1
- @layer components {
2
- [data-coco][data-component="app-slide-editor"] {
3
- .editor-inputs {
4
- @apply hidden;
5
- }
6
-
7
- .editor-toolbar {
8
- @apply mb-4 xl:mb-6;
9
- }
10
-
11
- .editor-form form {
12
- @apply hidden;
13
- }
14
-
15
- .slide-media {
16
- @apply relative;
17
- }
18
-
19
- .editor-slide {
20
- @apply shadow-md;
21
-
22
- textarea {
23
- @apply flex-none w-full;
24
- }
25
- }
26
-
27
- .editor-foreground-image-uploader {
28
- @apply h-full w-full relative;
29
-
30
- .editor-foreground-image {
31
- @apply h-full w-full relative transition-[outline-color] duration-100;
32
-
33
- &:hover {
34
- @apply outline outline-1 outline-transparent outline-offset-0;
35
- }
36
-
37
- img {
38
- @apply w-full h-full object-contain;
39
- }
40
- }
41
-
42
- .editor-image-upload-placeholder {
43
- @apply inset-0 flex flex-col items-center justify-center text-center aspect-[4/3] @slide-fluid:aspect-auto @slide-fluid:absolute;
44
- @apply outline outline-1 outline-transparent outline-offset-0;
45
- background-color: rgba(255, 255, 255, 0.1);
46
-
47
- .coco-icon {
48
- @apply text-current;
49
- width: 3em;
50
- height: 3em;
51
- margin-bottom: 0.6em;
52
- }
53
-
54
- .coco-icon,
55
- .editor-image-upload-placeholder-text {
56
- @apply opacity-50;
57
- }
58
- }
59
-
60
- .editor-image-upload-toolbar {
61
- @apply absolute left-1/2 top-0 -translate-x-1/2 -translate-y-1/2 opacity-0 transition-opacity duration-100;
62
- }
63
-
64
- &:hover .editor-image-upload-toolbar {
65
- @apply opacity-100;
66
- }
67
- }
68
-
69
- .coco-button.editor-saving {
70
- @apply cursor-not-allowed;
71
- }
72
-
73
- .editor-thumbnail-wrapper {
74
- @apply w-0 overflow-hidden relative;
75
- }
76
-
77
- .editor-thumbnail {
78
- @apply absolute w-[780px] top-0 z-[-1000] pointer-events-none;
79
- }
80
-
81
- .editor-thumbnail-image {
82
- @apply w-full h-full bg-contain bg-no-repeat bg-center;
83
- }
84
-
85
- .editor-icon-bg-color {
86
- @apply stroke-content-dark-1 fill-current;
87
- stroke-width: 2px;
88
- }
89
-
90
- .slide-title,
91
- .slide-text {
92
- @apply outline outline-1 outline-transparent outline-offset-0 transition-[outline-color] duration-100;
93
-
94
- textarea::placeholder {
95
- @apply italic;
96
- }
97
- }
98
-
99
- .slide-bg-light {
100
- .editor-foreground-image,
101
- .editor-image-upload-placeholder {
102
- outline-color: rgba(0, 0, 0, 0.3) !important;
103
- }
104
-
105
- .editor-image-upload-placeholder {
106
- @apply text-content-dark-1;
107
- }
108
-
109
- .slide-title,
110
- .slide-text {
111
- &:hover,
112
- &:focus {
113
- outline-color: rgba(0, 0, 0, 0.3);
114
- }
115
- }
116
-
117
- &[data-placeholders~="title"] [data-role="title"],
118
- &[data-placeholders~="text1"] [data-role="text-primary"],
119
- &[data-placeholders~="text2"] [data-role="text-secondary"] {
120
- outline-color: rgba(0, 0, 0, 0.3) !important;
121
- }
122
- }
123
-
124
- .slide-bg-dark {
125
- .editor-foreground-image,
126
- .editor-image-upload-placeholder {
127
- outline-color: rgba(255, 255, 255, 0.3) !important;
128
- }
129
-
130
- .editor-image-upload-placeholder {
131
- @apply text-content-light-1;
132
- }
133
-
134
- .slide-title,
135
- .slide-text {
136
- &:hover,
137
- &:focus {
138
- outline-color: rgba(255, 255, 255, 0.3);
139
- }
140
- }
141
-
142
- &[data-placeholders~="title"] [data-role="title"],
143
- &[data-placeholders~="text1"] [data-role="text-primary"],
144
- &[data-placeholders~="text2"] [data-role="text-secondary"] {
145
- outline-color: rgba(255, 255, 255, 0.3) !important;
146
- }
147
- }
148
- }
149
- }
@@ -1,302 +0,0 @@
1
- <%= render component_tag(x: {
2
- data: x_data("appSlideEditor", alpine_props),
3
- ":class": "{ready}",
4
- "undo": true
5
- }) do %>
6
- <div class="editor-toolbar">
7
- <%= coco_toolbar do |toolbar| %>
8
- <% toolbar.with_section do |section| %>
9
- <% if layout? %>
10
- <% section.with_layout_picker_button(
11
- icon: :layout_template,
12
- selected: current_layout,
13
- wrapper: {
14
- data: {
15
- role: "layout-picker"
16
- },
17
- x: {
18
- modelable: "selectedLayout",
19
- model: "layout"
20
- }
21
- }
22
- ) do |button| %>
23
- <% button.with_layout(name: "one-col-title", thumbnail: "slides/one-col-title-layout") %>
24
- <% button.with_layout(name: "two-col-mixed", thumbnail: "slides/two-col-mixed-layout") %>
25
- <% button.with_layout(name: "one-col-media", thumbnail: "slides/one-col-media-layout") %>
26
- <% button.with_layout(name: "two-col-media", thumbnail: "slides/two-col-media-layout") %>
27
- <% button.with_layout(name: "one-col-text", thumbnail: "slides/one-col-text-layout") %>
28
- <% button.with_layout(name: "two-col-text", thumbnail: "slides/two-col-text-layout") %>
29
-
30
- <%= tt("layout_picker.label") %>
31
- <% end %>
32
- <% end %>
33
-
34
- <% if bg_color? %>
35
- <% section.with_color_picker_button(
36
- **@bg_color_options.to_h,
37
- wrapper: {
38
- data: {
39
- role: "bg-color-picker"
40
- },
41
- x: {
42
- modelable: "selectedColor",
43
- model: "bgColor",
44
- "@color-picker:change": "bgColor = $event.detail.color"
45
- }
46
- }
47
- ) do |button| %>
48
- <% button.with_picker %>
49
- <% button.with_text { tt("bg_color_picker.label") } %>
50
- <% button.with_icon do %>
51
- <svg viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg" class="editor-icon-bg-color">
52
- <path d="M12 22a7 7 0 0 0 7-7c0-2-1-3.9-3-5.5s-3.5-4-4-6.5c-.5 2.5-2 4.9-4 6.5C6 11.1 5 13 5 15a7 7 0 0 0 7 7z"></path>
53
- </svg>
54
- <% end %>
55
- <% end %>
56
- <% end %>
57
-
58
- <% if bg_image? %>
59
- <% section.with_image_picker_button(
60
- icon: :image_plus,
61
- src: bg_image_src,
62
- wrapper: {
63
- data: {
64
- role: "bg-image-picker"
65
- },
66
- x: {
67
- "@image-picker:change": "bgImage = $event.detail.image",
68
- modelable: "selectedImage",
69
- model: "bgImage"
70
- }
71
- }
72
- ) do |button| %>
73
- <% button.with_picker do |picker| %>
74
- <% picker.with_blank_state_text { tt("bg_image_picker.blank_state") } %>
75
- <% end %>
76
-
77
- <%= tt("bg_image_picker.label") %>
78
- <% end %>
79
- <% end %>
80
-
81
- <% if text_color? %>
82
- <% section.with_color_picker_button(
83
- **@text_color_options.to_h,
84
- wrapper: {
85
- data: {
86
- role: "text-color-picker"
87
- },
88
- x: {
89
- "@color-picker:change": "textColor = $event.detail.color",
90
- modelable: "selectedColor",
91
- model: "textColor"
92
- }
93
- }
94
- ) do |button| %>
95
- <% button.with_picker %>
96
- <% button.with_text { tt("text_color_picker.label") } %>
97
- <% button.with_icon do %>
98
- <svg viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
99
- <path d="M4.99994 13.3333L9.99994 3.33334L14.9999 13.3333" stroke="#111827" stroke-width="1.66667" stroke-linecap="round" stroke-linejoin="round"/>
100
- <path d="M6.66656 10H13.3332" stroke="#111827" stroke-width="1.66667" stroke-linecap="round" stroke-linejoin="round"/>
101
- <rect x="2.25" y="15.25" width="15.5" height="2.5" rx="1.25" fill="currentColor" stroke="#111827" stroke-width="0.5"/>
102
- </svg>
103
- <% end %>
104
- <% end %>
105
- <% end %>
106
- <% end %>
107
-
108
- <% toolbar.with_section do |section| %>
109
- <% section.with_button(
110
- icon: :undo_2,
111
- click: "history.undo",
112
- tooltip: tt("undo_button.tooltip"),
113
- theme: :text_secondary,
114
- disabled: true,
115
- x: { "effect": "disabled = saving || !history.undoable" },
116
- data: {
117
- role: "undo"
118
- }
119
- ) %>
120
-
121
- <% section.with_button(
122
- icon: :redo_2,
123
- click: "history.redo",
124
- tooltip: tt("redo_button.tooltip"),
125
- theme: :text_secondary,
126
- disabled: true,
127
- x: { "effect": "disabled = saving || !history.redoable" },
128
- data: {
129
- role: "redo"
130
- }
131
- ) %>
132
-
133
- <% section.with_button(
134
- theme: :positive,
135
- icon: :check,
136
- collapsible: false,
137
- disabled: true,
138
- data: {
139
- role: "save"
140
- },
141
- x: {
142
- "@click.stop.prevent": "if(!saving) save()",
143
- "effect": "loading = saving; disabled = !history.undoable",
144
- ":class": "{'editor-saving': saving}"
145
- }
146
- ) do |button| %>
147
- <% button.with_state(:loading, text: tt("save_button.saving_label")) %>
148
- <%= tt("save_button.label") %>
149
- <% end %>
150
- <% end %>
151
- <% end %>
152
- </div>
153
-
154
- <%# Editable slide %>
155
- <div
156
- class="editor-slide"
157
- x-ref="slide"
158
- @dragenter.stop.prevent="dragging = true"
159
- @dragover.stop.prevent="dragging = true"
160
- @dragleave.stop.prevent="dragging = false"
161
- @drop.stop.prevent="handleImageDrop($event)"
162
- @click="handleSlideClick">
163
- <%= coco_editable_slide(
164
- **slide_args,
165
- data: {
166
- role: "slide"
167
- },
168
- x: {
169
- bind: "slide",
170
- ":data-placeholders": "blankTextAreasList",
171
- }
172
- ) do |slide| %>
173
- <% if title? %>
174
- <% slide.with_title do %>
175
- <%= title %>
176
- <% end %>
177
- <% end %>
178
-
179
- <% if text_1? %>
180
- <% slide.with_text_1 do %>
181
- <%= text_1 %>
182
- <% end %>
183
- <% end %>
184
-
185
- <% if text_2? %>
186
- <% slide.with_text_2 do %>
187
- <%= text_2 %>
188
- <% end %>
189
- <% end %>
190
-
191
- <% if image_1? %>
192
- <% slide.with_image_1 do %>
193
- <%= render Coco::ImageUploader.new(
194
- class: "editor-foreground-image-uploader",
195
- x: {
196
- "@image-uploader:load": "image1 = $event.detail.file"
197
- }
198
- ) do %>
199
- <div class="editor-foreground-image" x-show="hasImage1">
200
- <%= coco_button_group(
201
- theme: :toolbar,
202
- floating: true,
203
- class: "editor-image-upload-toolbar"
204
- ) do |group| %>
205
- <% group.with_button(icon: :trash_2, tooltip: "remove image", x: {"@click.stop": "image1 = {}; clear();"}) %>
206
- <% end %>
207
- <img :src="image1.data">
208
- </div>
209
- <div class="editor-image-upload-placeholder" x-show="!hasImage1">
210
- <%= coco_icon(:image_plus) %>
211
- <div class="editor-image-upload-placeholder-text">Add image</div>
212
- </div>
213
- <% end %>
214
- <% end %>
215
- <% end %>
216
-
217
- <% if image_2? %>
218
- <% slide.with_image_2 do %>
219
- <%= render Coco::ImageUploader.new(
220
- class: "editor-foreground-image-uploader",
221
- x: {
222
- "@image-uploader:load": "image2 = $event.detail.file"
223
- }
224
- ) do %>
225
- <div class="editor-foreground-image" x-show="hasImage2">
226
- <%= coco_button_group(
227
- theme: :toolbar,
228
- floating: true,
229
- class: "editor-image-upload-toolbar"
230
- ) do |group| %>
231
- <% group.with_button(icon: :trash_2, tooltip: "remove image", x: {"@click.stop": "image2 = {}; clear();"}) %>
232
- <% end %>
233
- <img :src="image2.data">
234
- </div>
235
- <div class="editor-image-upload-placeholder" x-show="!hasImage2">
236
- <%= coco_icon(:image_plus) %>
237
- <div class="editor-image-upload-placeholder-text">Add image</div>
238
- </div>
239
- <% end %>
240
- <% end %>
241
- <% end %>
242
- <% end %>
243
- </div>
244
-
245
- <% if generate_thumbnail? %>
246
- <%# Slide used for thumbnail generation %>
247
- <div class="editor-thumbnail-wrapper">
248
- <div x-ref="thumbnail" class="editor-thumbnail">
249
- <%= coco_editable_slide(
250
- **slide_args,
251
- data: {
252
- role: "slide-thumbnail"
253
- },
254
- x: {
255
- bind: "slide"
256
- }
257
- ) do |slide| %>
258
- <% if title? %>
259
- <% slide.with_title do %>
260
- <span x-text="title"></span>
261
- <% end %>
262
- <% end %>
263
-
264
- <% if text_1? %>
265
- <% slide.with_text_1 do %>
266
- <span x-html="text1.replace(/\n/g, '<br>')"></span>
267
- <% end %>
268
- <% end %>
269
-
270
- <% if text_2? %>
271
- <% slide.with_text_2 do %>
272
- <span x-html="text2.replace(/\n/g, '<br>')"></span>
273
- <% end %>
274
- <% end %>
275
-
276
- <% if image_1? %>
277
- <% slide.with_image_1 do %>
278
- <div class="editor-thumbnail-image" :style="image1.data && `background-image: url('${image1.data}')`"></div>
279
- <% end %>
280
- <% end %>
281
-
282
- <% if image_2? %>
283
- <% slide.with_image_2 do %>
284
- <div class="editor-thumbnail-image" :style="image2.data && `background-image: url('${image2.data}')`"></div>
285
- <% end %>
286
- <% end %>
287
- <% end %>
288
- </div>
289
- </div>
290
- <% end %>
291
-
292
- <% if content %>
293
- <div
294
- class="editor-form"
295
- x-ref="form"
296
- @turbo:submit-end="submitEnd"
297
- @turbo:fetch-request-error="submitError"
298
- @direct-upload:error="directUploadError">
299
- <%= content %>
300
- </div>
301
- <% end %>
302
- <% end %>