coveragebook_components 0.6.2 → 0.6.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/build/coco/app.css +252 -212
  3. data/app/assets/build/coco/app.js +19 -2
  4. data/app/assets/build/coco/book.css +466 -218
  5. data/app/assets/build/coco/icons/custom/eye-off-red.svg +17 -0
  6. data/app/assets/build/coco/icons/custom/google-sso.svg +9 -0
  7. data/app/assets/build/coco/icons/custom/layout-overlay.svg +7 -0
  8. data/app/assets/build/coco/icons/custom/layout-split.svg +8 -0
  9. data/app/assets/build/coco/icons/custom/layout-stacked.svg +7 -0
  10. data/app/assets/build/coco/icons/custom/microsoft-sso.svg +11 -0
  11. data/app/assets/build/coco/icons/custom/montage.svg +10 -0
  12. data/app/assets/css/base/utils/icons.css +6 -5
  13. data/app/assets/css/book.css +1 -0
  14. data/app/assets/custom_icons/other/eye-off-red.svg +17 -0
  15. data/app/assets/custom_icons/other/google-sso.svg +9 -0
  16. data/app/assets/custom_icons/other/layout-overlay.svg +7 -0
  17. data/app/assets/custom_icons/other/layout-split.svg +8 -0
  18. data/app/assets/custom_icons/other/layout-stacked.svg +7 -0
  19. data/app/assets/custom_icons/other/microsoft-sso.svg +11 -0
  20. data/app/assets/custom_icons/other/montage.svg +10 -0
  21. data/app/components/coco/app/blocks/slide_editor/slide_editor.css +27 -18
  22. data/app/components/coco/app/blocks/slide_editor/slide_editor.html.erb +5 -3
  23. data/app/components/coco/app/blocks/slide_editor/slide_editor.js +23 -0
  24. data/app/components/coco/app/elements/seamless_textarea/seamless_textarea.js +1 -1
  25. data/app/components/coco/base/icon/icon.css +6 -2
  26. data/app/components/coco/base/icon/icon.html.erb +1 -1
  27. data/app/components/coco/base/icon/icon.rb +32 -9
  28. data/app/components/coco/book/blocks/slides/editable_slide/editable_slide.css +156 -140
  29. data/app/components/coco/book/blocks/slides/editable_slide/editable_slide.html.erb +25 -21
  30. data/lib/coco.rb +1 -1
  31. metadata +16 -2
@@ -0,0 +1,17 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
2
+ <defs>
3
+ <path d="M8.9 4.5c-.1-.6.2-1.1.8-1.2.7-.2 1.5-.3 2.3-.3 7.5 0 11.7 8.2 11.9 8.6.1.3.1.6 0 .9-.6 1.2-1.4 2.3-2.3 3.4-.2.2-.5.4-.8.4-.2 0-.5-.1-.6-.2-.4-.4-.5-1-.1-1.4.7-.8 1.3-1.6 1.8-2.5-.9-1.6-4.5-7-9.9-7-.6 0-1.3.1-1.9.2-.5-.1-1-.4-1.2-.9Zm14.8 19.2c-.2.2-.4.3-.7.3-.3 0-.5-.1-.7-.3l-4.5-4.5C16.1 20.4 14.1 21 12 21 4.5 21 .3 12.8.1 12.4c-.1-.3-.1-.6 0-.9 1.1-2.1 2.7-4 4.5-5.5L.3 1.7C-.1 1.3-.1.7.3.3c.4-.4 1-.4 1.4 0l22 22c.4.4.4 1 0 1.4ZM9.9 12.1c0 .5.2 1 .6 1.4.6.5 1.3.6 2 .4L10 11.4c0 .3-.1.5-.1.7Zm6.5 5.7L14 15.5c-.6.4-1.4.6-2.1.6-1 0-2-.4-2.7-1.1-.8-.7-1.2-1.7-1.3-2.8 0-.8.2-1.6.6-2.3L6 7.4C4.5 8.7 3.2 10.2 2.1 12c.9 1.6 4.5 7 9.9 7 1.5 0 3-.4 4.4-1.2Z" id="a"/>
4
+ </defs>
5
+ <g fill="none" fill-rule="evenodd">
6
+ <g transform="translate(1 1)">
7
+ <mask id="b" fill="#fff">
8
+ <use xlink:href="#a"/>
9
+ </mask>
10
+ <use fill="#000" fill-rule="nonzero" xlink:href="#a"/>
11
+ <g mask="url(#b)" fill="#000">
12
+ <path d="M0 0h24v24H0z"/>
13
+ </g>
14
+ </g>
15
+ <path stroke="#DF5861" stroke-width="2" stroke-linecap="round" d="m1.5 1.5 23 23"/>
16
+ </g>
17
+ </svg>
@@ -0,0 +1,9 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
2
+ <mask id="a" width="24" height="24" x="0" y="0" maskUnits="userSpaceOnUse" style="mask-type:luminance">
3
+ <path fill="#fff" d="M23.182 9.818H12v4.636h6.436c-.6 2.946-3.109 4.637-6.436 4.637A7.077 7.077 0 0 1 4.91 12 7.077 7.077 0 0 1 12 4.91c1.69 0 3.218.6 4.418 1.58L19.91 3C17.782 1.145 15.055 0 12 0 5.345 0 0 5.345 0 12c0 6.654 5.345 12 12 12 6 0 11.454-4.364 11.454-12 0-.71-.108-1.473-.272-2.182Z"/></mask>
4
+ <g mask="url(#a)">
5
+ <path fill="#FBBC05" d="M-1.09 19.09V4.91L8.181 12l-9.273 7.09Z"/>
6
+ </g>
7
+ <mask id="b" width="24" height="24" x="0" y="0" maskUnits="userSpaceOnUse" style="mask-type:luminance">
8
+ <path fill="#fff" d="M23.182 9.818H12v4.636h6.436c-.6 2.946-3.109 4.637-6.436 4.637A7.077 7.077 0 0 1 4.91 12 7.077 7.077 0 0 1 12 4.91c1.69 0 3.218.6 4.418 1.58L19.91 3C17.782 1.145 15.055 0 12 0 5.345 0 0 5.345 0 12c0 6.654 5.345 12 12 12 6 0 11.454-4.364 11.454-12 0-.71-.108-1.473-.272-2.182Z"/></mask><g mask="url(#b)"><path fill="#EA4335" d="M-1.09 4.91 8.181 12 12 8.673l13.09-2.128V-1.09H-1.09v6Z"/></g><mask id="c" width="24" height="24" x="0" y="0" maskUnits="userSpaceOnUse" style="mask-type:luminance"><path fill="#fff" d="M23.182 9.818H12v4.636h6.436c-.6 2.946-3.109 4.637-6.436 4.637A7.077 7.077 0 0 1 4.91 12 7.077 7.077 0 0 1 12 4.91c1.69 0 3.218.6 4.418 1.58L19.91 3C17.782 1.145 15.055 0 12 0 5.345 0 0 5.345 0 12c0 6.654 5.345 12 12 12 6 0 11.454-4.364 11.454-12 0-.71-.108-1.473-.272-2.182Z"/></mask><g mask="url(#c)"><path fill="#34A853" d="M-1.09 19.09 15.272 6.546l4.309.546 5.509-8.182v26.182H-1.091v-6Z"/></g><mask id="d" width="24" height="24" x="0" y="0" maskUnits="userSpaceOnUse" style="mask-type:luminance"><path fill="#fff" d="M23.182 9.818H12v4.636h6.436c-.6 2.946-3.109 4.637-6.436 4.637A7.077 7.077 0 0 1 4.91 12 7.077 7.077 0 0 1 12 4.91c1.69 0 3.218.6 4.418 1.58L19.91 3C17.782 1.145 15.055 0 12 0 5.345 0 0 5.345 0 12c0 6.654 5.345 12 12 12 6 0 11.454-4.364 11.454-12 0-.71-.108-1.473-.272-2.182Z"/></mask><g mask="url(#d)"><path fill="#4285F4" d="M25.09 25.09 8.183 12 6 10.364l19.09-5.455v20.182Z"/></g>
9
+ </svg>
@@ -0,0 +1,7 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
2
+ <g fill-rule="nonzero" fill="none">
3
+ <rect stroke="#028871" stroke-width="2" fill="#EBF7F5" x="1" y="1" width="22" height="22" rx="4"/>
4
+ <rect fill="#028871" x="4" y="9" width="8" height="2" rx="1"/>
5
+ <rect fill="#028871" x="4" y="13" width="6" height="2" rx="1"/>
6
+ </g>
7
+ </svg>
@@ -0,0 +1,8 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
2
+ <g fill-rule="nonzero" fill="none">
3
+ <rect stroke="#028871" stroke-width="2" fill="#FAFAFA" x="1" y="1" width="22" height="22" rx="4"/>
4
+ <rect fill="#028871" opacity=".4" x="12" y="7" width="8" height="10" rx="2"/>
5
+ <rect fill="#028871" x="4" y="9" width="6" height="2" rx="1"/>
6
+ <rect fill="#028871" x="4" y="13" width="5" height="2" rx="1"/>
7
+ </g>
8
+ </svg>
@@ -0,0 +1,7 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
2
+ <g fill-rule="nonzero" fill="none">
3
+ <rect stroke="#028871" stroke-width="2" fill="#FAFAFA" x="1" y="1" width="22" height="22" rx="4"/>
4
+ <rect fill="#028871" x="4.94" y="5.174" width="14" height="2" rx="1"/>
5
+ <rect fill="#028871" opacity=".4" x="4" y="10" width="16" height="10" rx="2"/>
6
+ </g>
7
+ </svg>
@@ -0,0 +1,11 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
2
+ <g clip-path="url(#a)">
3
+ <path fill="#F35325" d="M0 0h11.429v11.429H0V0Z"/>
4
+ <path fill="#81BC06" d="M12.571 0H24v11.429H12.571V0Z"/>
5
+ <path fill="#05A6F0" d="M0 12.571h11.429V24H0V12.571Z"/>
6
+ <path fill="#FFBA08" d="M12.571 12.571H24V24H12.571V12.571Z"/>
7
+ </g>
8
+ <defs>
9
+ <clipPath id="a"><path fill="#fff" d="M0 0h24v24H0z"/></clipPath>
10
+ </defs>
11
+ </svg>
@@ -0,0 +1,10 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
2
+ <g fill-rule="nonzero" fill="none">
3
+ <path d="M0 0h24v24H0z"/>
4
+ <g transform="translate(2 2)" stroke="currentColor" stroke-width="2">
5
+ <rect x="12" y="3" width="7" height="12" rx="2.105"/>
6
+ <rect x="1" y="1" width="7" height="7" rx="2.105"/>
7
+ <rect x="1" y="12" width="7" height="7" rx="2.105"/>
8
+ </g>
9
+ </g>
10
+ </svg>
@@ -1,15 +1,16 @@
1
1
  @layer utilities {
2
2
  .icon {
3
- @apply text-current;
4
- stroke-linecap: round;
5
- stroke-linejoin: round;
6
3
  }
7
4
 
8
5
  .icon-stroke {
9
- @apply fill-none stroke-2 stroke-current;
6
+ @apply fill-none stroke-2 stroke-current text-current;
7
+ stroke-linecap: round;
8
+ stroke-linejoin: round;
10
9
  }
11
10
 
12
11
  .icon-fill {
13
- @apply fill-current;
12
+ @apply fill-current text-current;
13
+ stroke-linecap: round;
14
+ stroke-linejoin: round;
14
15
  }
15
16
  }
@@ -1,4 +1,5 @@
1
1
  @import "./book/config";
2
2
  @import "./base/base";
3
3
 
4
+ @import-glob "@baseComponents/**/*.css";
4
5
  @import-glob "@bookComponents/**/*.css";
@@ -0,0 +1,17 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
2
+ <defs>
3
+ <path d="M8.9 4.5c-.1-.6.2-1.1.8-1.2.7-.2 1.5-.3 2.3-.3 7.5 0 11.7 8.2 11.9 8.6.1.3.1.6 0 .9-.6 1.2-1.4 2.3-2.3 3.4-.2.2-.5.4-.8.4-.2 0-.5-.1-.6-.2-.4-.4-.5-1-.1-1.4.7-.8 1.3-1.6 1.8-2.5-.9-1.6-4.5-7-9.9-7-.6 0-1.3.1-1.9.2-.5-.1-1-.4-1.2-.9Zm14.8 19.2c-.2.2-.4.3-.7.3-.3 0-.5-.1-.7-.3l-4.5-4.5C16.1 20.4 14.1 21 12 21 4.5 21 .3 12.8.1 12.4c-.1-.3-.1-.6 0-.9 1.1-2.1 2.7-4 4.5-5.5L.3 1.7C-.1 1.3-.1.7.3.3c.4-.4 1-.4 1.4 0l22 22c.4.4.4 1 0 1.4ZM9.9 12.1c0 .5.2 1 .6 1.4.6.5 1.3.6 2 .4L10 11.4c0 .3-.1.5-.1.7Zm6.5 5.7L14 15.5c-.6.4-1.4.6-2.1.6-1 0-2-.4-2.7-1.1-.8-.7-1.2-1.7-1.3-2.8 0-.8.2-1.6.6-2.3L6 7.4C4.5 8.7 3.2 10.2 2.1 12c.9 1.6 4.5 7 9.9 7 1.5 0 3-.4 4.4-1.2Z" id="a"/>
4
+ </defs>
5
+ <g fill="none" fill-rule="evenodd">
6
+ <g transform="translate(1 1)">
7
+ <mask id="b" fill="#fff">
8
+ <use xlink:href="#a"/>
9
+ </mask>
10
+ <use fill="#000" fill-rule="nonzero" xlink:href="#a"/>
11
+ <g mask="url(#b)" fill="#000">
12
+ <path d="M0 0h24v24H0z"/>
13
+ </g>
14
+ </g>
15
+ <path stroke="#DF5861" stroke-width="2" stroke-linecap="round" d="m1.5 1.5 23 23"/>
16
+ </g>
17
+ </svg>
@@ -0,0 +1,9 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
2
+ <mask id="a" width="24" height="24" x="0" y="0" maskUnits="userSpaceOnUse" style="mask-type:luminance">
3
+ <path fill="#fff" d="M23.182 9.818H12v4.636h6.436c-.6 2.946-3.109 4.637-6.436 4.637A7.077 7.077 0 0 1 4.91 12 7.077 7.077 0 0 1 12 4.91c1.69 0 3.218.6 4.418 1.58L19.91 3C17.782 1.145 15.055 0 12 0 5.345 0 0 5.345 0 12c0 6.654 5.345 12 12 12 6 0 11.454-4.364 11.454-12 0-.71-.108-1.473-.272-2.182Z"/></mask>
4
+ <g mask="url(#a)">
5
+ <path fill="#FBBC05" d="M-1.09 19.09V4.91L8.181 12l-9.273 7.09Z"/>
6
+ </g>
7
+ <mask id="b" width="24" height="24" x="0" y="0" maskUnits="userSpaceOnUse" style="mask-type:luminance">
8
+ <path fill="#fff" d="M23.182 9.818H12v4.636h6.436c-.6 2.946-3.109 4.637-6.436 4.637A7.077 7.077 0 0 1 4.91 12 7.077 7.077 0 0 1 12 4.91c1.69 0 3.218.6 4.418 1.58L19.91 3C17.782 1.145 15.055 0 12 0 5.345 0 0 5.345 0 12c0 6.654 5.345 12 12 12 6 0 11.454-4.364 11.454-12 0-.71-.108-1.473-.272-2.182Z"/></mask><g mask="url(#b)"><path fill="#EA4335" d="M-1.09 4.91 8.181 12 12 8.673l13.09-2.128V-1.09H-1.09v6Z"/></g><mask id="c" width="24" height="24" x="0" y="0" maskUnits="userSpaceOnUse" style="mask-type:luminance"><path fill="#fff" d="M23.182 9.818H12v4.636h6.436c-.6 2.946-3.109 4.637-6.436 4.637A7.077 7.077 0 0 1 4.91 12 7.077 7.077 0 0 1 12 4.91c1.69 0 3.218.6 4.418 1.58L19.91 3C17.782 1.145 15.055 0 12 0 5.345 0 0 5.345 0 12c0 6.654 5.345 12 12 12 6 0 11.454-4.364 11.454-12 0-.71-.108-1.473-.272-2.182Z"/></mask><g mask="url(#c)"><path fill="#34A853" d="M-1.09 19.09 15.272 6.546l4.309.546 5.509-8.182v26.182H-1.091v-6Z"/></g><mask id="d" width="24" height="24" x="0" y="0" maskUnits="userSpaceOnUse" style="mask-type:luminance"><path fill="#fff" d="M23.182 9.818H12v4.636h6.436c-.6 2.946-3.109 4.637-6.436 4.637A7.077 7.077 0 0 1 4.91 12 7.077 7.077 0 0 1 12 4.91c1.69 0 3.218.6 4.418 1.58L19.91 3C17.782 1.145 15.055 0 12 0 5.345 0 0 5.345 0 12c0 6.654 5.345 12 12 12 6 0 11.454-4.364 11.454-12 0-.71-.108-1.473-.272-2.182Z"/></mask><g mask="url(#d)"><path fill="#4285F4" d="M25.09 25.09 8.183 12 6 10.364l19.09-5.455v20.182Z"/></g>
9
+ </svg>
@@ -0,0 +1,7 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
2
+ <g fill-rule="nonzero" fill="none">
3
+ <rect stroke="#028871" stroke-width="2" fill="#EBF7F5" x="1" y="1" width="22" height="22" rx="4"/>
4
+ <rect fill="#028871" x="4" y="9" width="8" height="2" rx="1"/>
5
+ <rect fill="#028871" x="4" y="13" width="6" height="2" rx="1"/>
6
+ </g>
7
+ </svg>
@@ -0,0 +1,8 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
2
+ <g fill-rule="nonzero" fill="none">
3
+ <rect stroke="#028871" stroke-width="2" fill="#FAFAFA" x="1" y="1" width="22" height="22" rx="4"/>
4
+ <rect fill="#028871" opacity=".4" x="12" y="7" width="8" height="10" rx="2"/>
5
+ <rect fill="#028871" x="4" y="9" width="6" height="2" rx="1"/>
6
+ <rect fill="#028871" x="4" y="13" width="5" height="2" rx="1"/>
7
+ </g>
8
+ </svg>
@@ -0,0 +1,7 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
2
+ <g fill-rule="nonzero" fill="none">
3
+ <rect stroke="#028871" stroke-width="2" fill="#FAFAFA" x="1" y="1" width="22" height="22" rx="4"/>
4
+ <rect fill="#028871" x="4.94" y="5.174" width="14" height="2" rx="1"/>
5
+ <rect fill="#028871" opacity=".4" x="4" y="10" width="16" height="10" rx="2"/>
6
+ </g>
7
+ </svg>
@@ -0,0 +1,11 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
2
+ <g clip-path="url(#a)">
3
+ <path fill="#F35325" d="M0 0h11.429v11.429H0V0Z"/>
4
+ <path fill="#81BC06" d="M12.571 0H24v11.429H12.571V0Z"/>
5
+ <path fill="#05A6F0" d="M0 12.571h11.429V24H0V12.571Z"/>
6
+ <path fill="#FFBA08" d="M12.571 12.571H24V24H12.571V12.571Z"/>
7
+ </g>
8
+ <defs>
9
+ <clipPath id="a"><path fill="#fff" d="M0 0h24v24H0z"/></clipPath>
10
+ </defs>
11
+ </svg>
@@ -0,0 +1,10 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
2
+ <g fill-rule="nonzero" fill="none">
3
+ <path d="M0 0h24v24H0z"/>
4
+ <g transform="translate(2 2)" stroke="currentColor" stroke-width="2">
5
+ <rect x="12" y="3" width="7" height="12" rx="2.105"/>
6
+ <rect x="1" y="1" width="7" height="7" rx="2.105"/>
7
+ <rect x="1" y="12" width="7" height="7" rx="2.105"/>
8
+ </g>
9
+ </g>
10
+ </svg>
@@ -87,13 +87,12 @@
87
87
  stroke-width: 2px;
88
88
  }
89
89
 
90
- [data-component="app-seamless-textarea"] {
91
- textarea {
92
- @apply outline outline-1 outline-transparent outline-offset-0 transition-[outline-color] duration-100;
90
+ .slide-title,
91
+ .slide-text {
92
+ @apply outline outline-1 outline-transparent outline-offset-0 transition-[outline-color] duration-100;
93
93
 
94
- &::placeholder {
95
- @apply italic;
96
- }
94
+ textarea::placeholder {
95
+ @apply italic;
97
96
  }
98
97
  }
99
98
 
@@ -107,14 +106,19 @@
107
106
  @apply text-content-dark-1;
108
107
  }
109
108
 
110
- [data-component="app-seamless-textarea"] {
111
- textarea {
112
- &:hover,
113
- &:focus {
114
- outline-color: rgba(0, 0, 0, 0.3);
115
- }
109
+ .slide-title,
110
+ .slide-text {
111
+ &:hover,
112
+ &:focus {
113
+ outline-color: rgba(0, 0, 0, 0.3);
116
114
  }
117
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
+ }
118
122
  }
119
123
 
120
124
  .slide-bg-dark {
@@ -127,14 +131,19 @@
127
131
  @apply text-content-light-1;
128
132
  }
129
133
 
130
- [data-component="app-seamless-textarea"] {
131
- textarea {
132
- &:hover,
133
- &:focus {
134
- outline-color: rgba(255, 255, 255, 0.3);
135
- }
134
+ .slide-title,
135
+ .slide-text {
136
+ &:hover,
137
+ &:focus {
138
+ outline-color: rgba(255, 255, 255, 0.3);
136
139
  }
137
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
+ }
138
147
  }
139
148
  }
140
149
  }
@@ -156,14 +156,16 @@
156
156
  @dragenter.stop.prevent="dragging = true"
157
157
  @dragover.stop.prevent="dragging = true"
158
158
  @dragleave.stop.prevent="dragging = false"
159
- @drop.stop.prevent="handleImageDrop($event)">
159
+ @drop.stop.prevent="handleImageDrop($event)"
160
+ @click="handleSlideClick">
160
161
  <%= coco_editable_slide(
161
162
  **slide_args,
162
163
  data: {
163
164
  role: "slide"
164
165
  },
165
166
  x: {
166
- bind: "slide"
167
+ bind: "slide",
168
+ ":data-placeholders": "blankTextAreasList",
167
169
  }
168
170
  ) do |slide| %>
169
171
  <% if title? %>
@@ -271,7 +273,7 @@
271
273
 
272
274
  <% if image_1? %>
273
275
  <% slide.with_image_1 do %>
274
- <div class="editor-thumbnail-image" :style="image2.data && `background-image: url('${image1.data}')`"></div>
276
+ <div class="editor-thumbnail-image" :style="image1.data && `background-image: url('${image1.data}')`"></div>
275
277
  <% end %>
276
278
  <% end %>
277
279
 
@@ -64,6 +64,16 @@ export default CocoComponent("appSlideEditor", (data) => {
64
64
 
65
65
  this.ready = true;
66
66
  });
67
+
68
+ this.$watch("history.undoable", (undoable) => {
69
+ if (undoable) {
70
+ window.onbeforeunload = () => {
71
+ return true;
72
+ };
73
+ } else {
74
+ window.onbeforeunload = null;
75
+ }
76
+ });
67
77
  },
68
78
 
69
79
  undo(name, value) {
@@ -170,6 +180,19 @@ export default CocoComponent("appSlideEditor", (data) => {
170
180
  input.files = dataTransfer.files;
171
181
  },
172
182
 
183
+ handleSlideClick(event) {
184
+ if (Array.from(event.target.classList).includes("slide-text")) {
185
+ event.target.querySelector("textarea").focus();
186
+ }
187
+ },
188
+
189
+ get blankTextAreasList() {
190
+ return ["title", "text1", "text2"]
191
+ .map((textareaName) => (this[textareaName] === "" ? textareaName : ""))
192
+ .join(" ")
193
+ .trim();
194
+ },
195
+
173
196
  get hasBgImage() {
174
197
  return !!(this.bgImage && this.bgImage.data);
175
198
  },
@@ -31,7 +31,7 @@ export default CocoComponent("appSeamlessTextarea", () => {
31
31
  const fontSize = styles.getPropertyValue("font-size");
32
32
 
33
33
  textarea.style.height = "4px";
34
- let newHeight = textarea.scrollHeight - parseInt(fontSize, 10) * 0.16;
34
+ let newHeight = textarea.scrollHeight;
35
35
  textarea.style.height = `${newHeight}px`;
36
36
 
37
37
  if (this.height !== newHeight) {
@@ -1,6 +1,6 @@
1
1
  @layer components {
2
2
  [data-coco][data-component="icon"] {
3
- @apply inline-flex flex-none w-6 h-6 text-current;
3
+ @apply inline-flex flex-none w-6 h-6 text-current overflow-hidden;
4
4
 
5
5
  svg {
6
6
  @apply icon w-full h-full;
@@ -8,7 +8,7 @@
8
8
 
9
9
  /* Styles */
10
10
 
11
- &[data-icon]:not([data-style="fill"]) svg {
11
+ &[data-icon]:not([data-style="fill"]):not([data-style="custom"]) svg {
12
12
  @apply icon-stroke;
13
13
  }
14
14
 
@@ -18,6 +18,10 @@
18
18
 
19
19
  /* Sizes */
20
20
 
21
+ &[data-size="xs"] {
22
+ @apply w-3 h-3;
23
+ }
24
+
21
25
  &[data-size="sm"] {
22
26
  @apply w-4 h-4;
23
27
  }
@@ -4,5 +4,5 @@
4
4
  data: "icon",
5
5
  bind: "root"
6
6
  }) do %>
7
- <%= content || svg %>
7
+ <%= svg %>
8
8
  <% end %>
@@ -6,13 +6,19 @@ module Coco
6
6
 
7
7
  InvalidIconError = Class.new(StandardError)
8
8
 
9
- accepts_option :size, from: %i[sm md lg xl xxl]
9
+ accepts_option :size, from: %i[xs sm md lg xl xxl]
10
10
  accepts_option :spin, from: [true, false]
11
- accepts_option :style, from: [:line, :fill]
11
+ accepts_option :style, from: [:line, :fill, :custom]
12
+
13
+ before_render do
14
+ if name
15
+ set_tag_data_attr(:icon, name)
16
+ set_option_value(:style, :custom) if icon_data[:custom]
17
+ end
18
+ end
12
19
 
13
20
  def initialize(name: nil, **kwargs)
14
21
  @icon_name = name&.to_s&.tr("_", "-")
15
- set_tag_data_attr(:icon, name) if name
16
22
  end
17
23
 
18
24
  def name
@@ -20,19 +26,36 @@ module Coco
20
26
  end
21
27
 
22
28
  def svg
23
- ICON_CACHE[name] ||= read_svg
29
+ content || icon_data[:svg]
30
+ end
31
+
32
+ def icon_data
33
+ ICON_CACHE[name] ||= {
34
+ custom: custom?,
35
+ svg: read_svg
36
+ }
37
+ end
38
+
39
+ def custom?
40
+ @_custom ||= File.exist?(custom_icon_path)
24
41
  end
25
42
 
26
43
  def read_svg
27
- File.read(svg_path).html_safe
28
- rescue
29
- if Rails.env.development? || Rails.env.test?
44
+ if custom?
45
+ File.read(custom_icon_path).html_safe
46
+ elsif File.exist?(icon_path)
47
+ File.read(icon_path).html_safe
48
+ elsif Rails.env.development? || Rails.env.test?
30
49
  raise InvalidIconError, "`#{name}` is not a valid icon name"
31
50
  end
32
51
  end
33
52
 
34
- def svg_path
35
- Coco::Engine.root.join("app/assets/build/coco/icons/#{name}.svg")
53
+ def icon_path
54
+ @_icon_path ||= Coco::Engine.root.join("app/assets/build/coco/icons/#{name}.svg")
55
+ end
56
+
57
+ def custom_icon_path
58
+ @_custom_icon_path ||= Coco::Engine.root.join("app/assets/build/coco/icons/custom/#{name}.svg")
36
59
  end
37
60
  end
38
61
  end