coveragebook_components 0.5.0 → 0.5.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.
- checksums.yaml +4 -4
- data/app/assets/build/coco/app.css +7 -5
- data/app/assets/build/coco/app.js +95 -48
- data/app/assets/build/coco/book.css +3 -0
- data/app/assets/build/coco/book.js +2 -2
- data/app/assets/js/helpers/path.js +9 -1
- data/app/components/coco/app/blocks/slide_editor/slide_editor.css +4 -0
- data/app/components/coco/app/blocks/slide_editor/slide_editor.html.erb +145 -190
- data/app/components/coco/app/blocks/slide_editor/slide_editor.js +70 -17
- data/app/components/coco/app/blocks/slide_editor/slide_editor.rb +37 -86
- data/app/components/coco/app/elements/alert/alert.css +1 -1
- data/app/components/coco/app/elements/color_picker_button/color_picker_button.html.erb +17 -16
- data/app/components/coco/app/elements/color_picker_button/color_picker_button.js +0 -8
- data/app/components/coco/app/elements/color_picker_button/color_picker_button.rb +2 -15
- data/app/components/coco/app/elements/image_picker/image_picker.html.erb +4 -4
- data/app/components/coco/app/elements/image_picker/image_picker.js +18 -6
- data/app/components/coco/app/elements/image_picker/image_picker.rb +2 -11
- data/app/components/coco/app/elements/image_picker_button/image_picker_button.html.erb +9 -8
- data/app/components/coco/app/elements/image_picker_button/image_picker_button.js +10 -23
- data/app/components/coco/app/elements/image_picker_button/image_picker_button.rb +19 -35
- data/app/components/coco/app/elements/seamless_textarea/seamless_textarea.html.erb +7 -4
- data/app/components/coco/app/elements/seamless_textarea/seamless_textarea.js +9 -3
- data/app/components/coco/app/elements/seamless_textarea/seamless_textarea.rb +5 -20
- data/app/components/coco/base/image_uploader/image_uploader.html.erb +3 -2
- data/app/components/coco/base/image_uploader/image_uploader.rb +2 -12
- data/app/components/coco/book/blocks/slides/media_slide/media_slide.css +1 -1
- data/lib/coco.rb +1 -1
- metadata +2 -6
- data/app/assets/build/coco/app.dev.css +0 -3427
- data/app/assets/build/coco/app.dev.js +0 -24891
- data/app/assets/build/coco/book.dev.css +0 -992
- data/app/assets/build/coco/book.dev.js +0 -19840
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca789167f2fc08234f31ced3e398aca21017d7f1ade9e98ee6e50f0538f415f5
|
4
|
+
data.tar.gz: d0a3d173a36a8ba61c1763946dee9156a67ff6f7c20326611bf0f5fbd1dc2a4a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e7881aee94a056a450875ae8d4982cdd78b529501b88295f94efcb91f383ede55dcc5fc7e1e8ac78a6614f2f20e93bb154bb4b1f3fc3c4e0a5ef134655618072
|
7
|
+
data.tar.gz: 8237eeb07c6d3ebc9756ce07afd1d5502502c6a0acc80bdc667f91d5c5f1b6f56c97431cc05e5582d3e67bd4fae38c2f95e029d609ef8a6451c786900ea725e7
|
@@ -1104,6 +1104,8 @@ select{
|
|
1104
1104
|
|
1105
1105
|
[data-coco][data-component="app-slide-editor"] .editor-toolbar{
|
1106
1106
|
margin-bottom: 1.5rem}}
|
1107
|
+
[data-coco][data-component="app-slide-editor"] .editor-form form{
|
1108
|
+
display: none}
|
1107
1109
|
[data-coco][data-component="app-slide-editor"] .editor-slide{
|
1108
1110
|
--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
|
1109
1111
|
--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);
|
@@ -1113,9 +1115,6 @@ select{
|
|
1113
1115
|
flex: none}
|
1114
1116
|
[data-coco][data-component="app-slide-editor"] .coco-button.editor-saving{
|
1115
1117
|
cursor: not-allowed}
|
1116
|
-
[data-coco][data-component="app-slide-editor"] .editor-thumbnail-file{
|
1117
|
-
pointer-events: none;
|
1118
|
-
display: none}
|
1119
1118
|
[data-coco][data-component="app-slide-editor"] .editor-screenshot-wrapper{
|
1120
1119
|
position: relative;
|
1121
1120
|
width: 0px;
|
@@ -1184,7 +1183,7 @@ select{
|
|
1184
1183
|
line-height: 24px}
|
1185
1184
|
[data-coco][data-component="app-alert"] .alert-message a{
|
1186
1185
|
color: currentColor}
|
1187
|
-
[data-coco][data-component="app-alert"]
|
1186
|
+
[data-coco][data-component="app-alert"].with-title .alert-message{
|
1188
1187
|
margin-top: 0.25rem}
|
1189
1188
|
[data-coco][data-component="app-alert"] .alert-actions{
|
1190
1189
|
display: flex;
|
@@ -3150,8 +3149,11 @@ select{
|
|
3150
3149
|
line-height: 1.4;
|
3151
3150
|
font-size: var(--text-font-size)}
|
3152
3151
|
[data-coco][data-component="book-media-slide"] img{
|
3152
|
+
height: 100%;
|
3153
3153
|
width: 100%;
|
3154
|
-
border-radius: 0.375rem
|
3154
|
+
border-radius: 0.375rem;
|
3155
|
+
-o-object-fit: contain;
|
3156
|
+
object-fit: contain}
|
3155
3157
|
.static{
|
3156
3158
|
position: static}
|
3157
3159
|
.fixed{
|
@@ -21587,14 +21587,14 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
|
|
21587
21587
|
};
|
21588
21588
|
});
|
21589
21589
|
|
21590
|
-
// import-glob:/
|
21590
|
+
// import-glob:/Users/mark/Projects/coveragebook/coco/app/assets/js/base|@baseComponents/**/*.js
|
21591
21591
|
var modules = [button_exports, dropdown_exports, icon_exports, image_uploader_exports];
|
21592
21592
|
var __default = modules;
|
21593
21593
|
|
21594
21594
|
// base/components.js
|
21595
21595
|
var components_default = registerComponents(__default);
|
21596
21596
|
|
21597
|
-
// import-glob:/
|
21597
|
+
// import-glob:/Users/mark/Projects/coveragebook/coco/app/assets/js/book|@bookComponents/**/*.js
|
21598
21598
|
var modules2 = [];
|
21599
21599
|
var __default2 = modules2;
|
21600
21600
|
|
@@ -22425,6 +22425,9 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
|
|
22425
22425
|
function stripExtension(filename) {
|
22426
22426
|
return filename.substring(0, filename.lastIndexOf(".")) || filename;
|
22427
22427
|
}
|
22428
|
+
function basename(path) {
|
22429
|
+
return path ? path.replace(/.*\//, "") : path;
|
22430
|
+
}
|
22428
22431
|
|
22429
22432
|
// helpers/file.js
|
22430
22433
|
function blobToFile(blob, fileName, type) {
|
@@ -22498,10 +22501,21 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
|
|
22498
22501
|
pixelRatio: 1
|
22499
22502
|
};
|
22500
22503
|
var slide_editor_default = CocoComponent("appSlideEditor", (data2) => {
|
22504
|
+
const initialData = {
|
22505
|
+
layout: data2.layout,
|
22506
|
+
title: data2.title,
|
22507
|
+
text1: data2.text1,
|
22508
|
+
bgColor: data2.bgColor,
|
22509
|
+
textColor: data2.textColor,
|
22510
|
+
bgImage: {
|
22511
|
+
name: data2.bgImage,
|
22512
|
+
data: data2.bgImage
|
22513
|
+
}
|
22514
|
+
};
|
22501
22515
|
return __spreadProps(__spreadValues({
|
22502
22516
|
use: [withUndo()]
|
22503
|
-
},
|
22504
|
-
saved: __spreadValues({},
|
22517
|
+
}, initialData), {
|
22518
|
+
saved: __spreadValues({}, initialData),
|
22505
22519
|
saving: false,
|
22506
22520
|
ready: false,
|
22507
22521
|
dragging: false,
|
@@ -22511,17 +22525,19 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
|
|
22511
22525
|
return getData(this.$root.querySelector("[data-role='bg-image-picker']"));
|
22512
22526
|
},
|
22513
22527
|
init() {
|
22514
|
-
this._fields.forEach((name) => {
|
22515
|
-
this.$watch(
|
22516
|
-
name,
|
22517
|
-
(value, oldValue) => this.history.add(name, value, oldValue)
|
22518
|
-
);
|
22519
|
-
});
|
22520
22528
|
this.$watch("thumbnailFile", () => this._syncThumbnailField());
|
22521
22529
|
this.$watch("errors", (errors) => {
|
22522
22530
|
errors.forEach((error2) => console.error(error2.message));
|
22523
22531
|
});
|
22524
|
-
this.$nextTick(() =>
|
22532
|
+
this.$nextTick(() => {
|
22533
|
+
this._fields.forEach((name) => {
|
22534
|
+
this.$watch(
|
22535
|
+
name,
|
22536
|
+
(value, oldValue) => this.history.add(name, value, oldValue)
|
22537
|
+
);
|
22538
|
+
});
|
22539
|
+
this.ready = true;
|
22540
|
+
});
|
22525
22541
|
},
|
22526
22542
|
undo(name, value) {
|
22527
22543
|
this[name] = value;
|
@@ -22550,7 +22566,11 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
|
|
22550
22566
|
return;
|
22551
22567
|
}
|
22552
22568
|
}
|
22553
|
-
this.$refs.form
|
22569
|
+
if (this.$refs.form) {
|
22570
|
+
this.$refs.form.querySelector("form").requestSubmit();
|
22571
|
+
} else {
|
22572
|
+
this.submitSuccess();
|
22573
|
+
}
|
22554
22574
|
},
|
22555
22575
|
submitEnd(event) {
|
22556
22576
|
handler = wasSuccessful(event) ? "submitSuccess" : "submitError";
|
@@ -22571,11 +22591,36 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
|
|
22571
22591
|
$event.preventDefault();
|
22572
22592
|
this._handleSaveError($event.detail.error, { event: $event });
|
22573
22593
|
},
|
22594
|
+
syncImageField(el, image) {
|
22595
|
+
const dataTransfer = new DataTransfer();
|
22596
|
+
if (image.file && image.file instanceof File) {
|
22597
|
+
dataTransfer.items.add(image.file);
|
22598
|
+
}
|
22599
|
+
el.files = dataTransfer.files;
|
22600
|
+
},
|
22601
|
+
input: {
|
22602
|
+
layout: { "x-model.fill": "layout" },
|
22603
|
+
title: { "x-model.fill": "title" },
|
22604
|
+
text1: { "x-model.fill": "text1" },
|
22605
|
+
bgColor: { "x-model.fill": "bgColorHex" },
|
22606
|
+
textColor: { "x-model.fill": "textColorHex" },
|
22607
|
+
bgImage: { "x-effect": "syncImageField($el, bgImage)" },
|
22608
|
+
bgImagePurge: { ":checked": "!hasBgImage" }
|
22609
|
+
},
|
22610
|
+
get hasBgImage() {
|
22611
|
+
return !!(this.bgImage && this.bgImage.data);
|
22612
|
+
},
|
22613
|
+
get bgColorHex() {
|
22614
|
+
return this.bgColor.replace("#", "");
|
22615
|
+
},
|
22616
|
+
get textColorHex() {
|
22617
|
+
return this.textColor.replace("#", "");
|
22618
|
+
},
|
22574
22619
|
get slideStyles() {
|
22575
22620
|
return {
|
22576
22621
|
backgroundColor: this.bgColor,
|
22577
22622
|
color: this.textColor,
|
22578
|
-
backgroundImage: this.
|
22623
|
+
backgroundImage: this.hasBgImage ? `url('${this.bgImage.data}')` : "none"
|
22579
22624
|
};
|
22580
22625
|
},
|
22581
22626
|
get slideClasses() {
|
@@ -22585,13 +22630,13 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
|
|
22585
22630
|
};
|
22586
22631
|
},
|
22587
22632
|
get isDarkBg() {
|
22588
|
-
return this.
|
22633
|
+
return this.hasBgImage || this.bgColor ? isDark(this.bgColor) : false;
|
22589
22634
|
},
|
22590
22635
|
get shouldGenerateThumbnail() {
|
22591
22636
|
return !!this.$refs.thumbnail;
|
22592
22637
|
},
|
22593
22638
|
get _fields() {
|
22594
|
-
return Object.keys(
|
22639
|
+
return Object.keys(initialData);
|
22595
22640
|
},
|
22596
22641
|
async _generateThumbnail() {
|
22597
22642
|
const screenshotSlide = this.$refs.screenshot.firstElementChild;
|
@@ -22620,6 +22665,9 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
|
|
22620
22665
|
},
|
22621
22666
|
_handleSaveError(message2 = "Error saving slide", context = {}) {
|
22622
22667
|
this.errors.push({ message: message2, context });
|
22668
|
+
this.errors.forEach((err) => {
|
22669
|
+
console.log(err.message);
|
22670
|
+
});
|
22623
22671
|
this.saving = false;
|
22624
22672
|
this.$dispatch("slide:save-end", { success: false });
|
22625
22673
|
}
|
@@ -24542,12 +24590,6 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
|
|
24542
24590
|
this.$root.querySelector("[data-role='color-picker']").firstElementChild
|
24543
24591
|
);
|
24544
24592
|
},
|
24545
|
-
get selectedColorHex() {
|
24546
|
-
return this.selectedColor && this.selectedColor.replace("#", "");
|
24547
|
-
},
|
24548
|
-
set selectedColorHex(value) {
|
24549
|
-
this.selectedColor == "#" + value.replace("#", "");
|
24550
|
-
},
|
24551
24593
|
onDropdownMount() {
|
24552
24594
|
this.getPicker().setSelectedColor(this.selectedColor);
|
24553
24595
|
}
|
@@ -24575,15 +24617,19 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
|
|
24575
24617
|
__export(image_picker_exports, {
|
24576
24618
|
default: () => image_picker_default
|
24577
24619
|
});
|
24578
|
-
var image_picker_default = CocoComponent("appImagePicker", ({
|
24620
|
+
var image_picker_default = CocoComponent("appImagePicker", ({ src }) => {
|
24579
24621
|
return {
|
24580
24622
|
use: [],
|
24581
|
-
image:
|
24623
|
+
image: {
|
24624
|
+
name: basename(src),
|
24625
|
+
file: null,
|
24626
|
+
data: src
|
24627
|
+
},
|
24582
24628
|
get name() {
|
24583
|
-
return this.image
|
24629
|
+
return this.image.name;
|
24584
24630
|
},
|
24585
24631
|
get src() {
|
24586
|
-
return this.image
|
24632
|
+
return this.image.data;
|
24587
24633
|
},
|
24588
24634
|
get hasImage() {
|
24589
24635
|
return !!this.src;
|
@@ -24592,7 +24638,11 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
|
|
24592
24638
|
return getComponent(this.$refs.uploader.firstElementChild);
|
24593
24639
|
},
|
24594
24640
|
setImage(file, silent = false) {
|
24595
|
-
this.image =
|
24641
|
+
this.image = {
|
24642
|
+
file: file.file,
|
24643
|
+
name: file.name,
|
24644
|
+
data: file.data
|
24645
|
+
};
|
24596
24646
|
this.uploader.setFile(file);
|
24597
24647
|
if (silent === false) {
|
24598
24648
|
this.$dispatch("image-picker:select", { image: this.image });
|
@@ -24600,7 +24650,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
|
|
24600
24650
|
},
|
24601
24651
|
clearImage(silent = false) {
|
24602
24652
|
this.uploader.clear();
|
24603
|
-
this.image = null;
|
24653
|
+
this.image = { name: null, data: null, file: null };
|
24604
24654
|
if (silent === false) {
|
24605
24655
|
this.$dispatch("image-picker:clear");
|
24606
24656
|
}
|
@@ -24619,21 +24669,12 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
|
|
24619
24669
|
__export(image_picker_button_exports, {
|
24620
24670
|
default: () => image_picker_button_default
|
24621
24671
|
});
|
24622
|
-
var image_picker_button_default = CocoComponent("appImagePickerButton", ({
|
24672
|
+
var image_picker_button_default = CocoComponent("appImagePickerButton", ({ src }) => {
|
24623
24673
|
return {
|
24624
|
-
selectedImage:
|
24625
|
-
|
24626
|
-
|
24627
|
-
|
24628
|
-
const dataTransfer = new DataTransfer();
|
24629
|
-
if (file && file.file instanceof File) {
|
24630
|
-
dataTransfer.items.add(file.file);
|
24631
|
-
}
|
24632
|
-
this.$refs.fileInput.files = dataTransfer.files;
|
24633
|
-
if (this.dropdown) {
|
24634
|
-
this.dropdown.hide();
|
24635
|
-
}
|
24636
|
-
});
|
24674
|
+
selectedImage: {
|
24675
|
+
name: basename(src),
|
24676
|
+
file: null,
|
24677
|
+
data: src
|
24637
24678
|
},
|
24638
24679
|
getPicker() {
|
24639
24680
|
return getData(
|
@@ -24651,16 +24692,17 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
|
|
24651
24692
|
file,
|
24652
24693
|
data: reader.result
|
24653
24694
|
};
|
24695
|
+
this.dropdown.hide();
|
24654
24696
|
});
|
24655
24697
|
reader.readAsDataURL(file);
|
24656
24698
|
},
|
24657
24699
|
clearSelectedImage() {
|
24658
24700
|
this.dropdown.hide();
|
24659
|
-
this.selectedImage = null;
|
24701
|
+
this.selectedImage = { name: null, data: null, file: null };
|
24660
24702
|
},
|
24661
|
-
setSelectedImage(
|
24703
|
+
setSelectedImage(image) {
|
24662
24704
|
this.dropdown.hide();
|
24663
|
-
this.selectedImage =
|
24705
|
+
this.selectedImage = image;
|
24664
24706
|
},
|
24665
24707
|
onDropdownMount({ detail }) {
|
24666
24708
|
this.dropdown = detail.dropdown;
|
@@ -24698,11 +24740,16 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
|
|
24698
24740
|
height: null,
|
24699
24741
|
observer: null,
|
24700
24742
|
value: null,
|
24701
|
-
|
24702
|
-
return this.assertData("multiline", "false");
|
24703
|
-
},
|
24743
|
+
options: ["multiline", "focus"],
|
24704
24744
|
init() {
|
24705
24745
|
this.value = this.$refs.textarea.value;
|
24746
|
+
this.$nextTick(() => {
|
24747
|
+
this.onResize();
|
24748
|
+
if (this.$options.focus) {
|
24749
|
+
this.$refs.textarea.focus();
|
24750
|
+
this.$refs.textarea.selectionStart = this.$refs.textarea.value.length;
|
24751
|
+
}
|
24752
|
+
});
|
24706
24753
|
},
|
24707
24754
|
onResize() {
|
24708
24755
|
const textarea = this.$refs.textarea;
|
@@ -24827,7 +24874,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
|
|
24827
24874
|
};
|
24828
24875
|
});
|
24829
24876
|
|
24830
|
-
// import-glob:/
|
24877
|
+
// import-glob:/Users/mark/Projects/coveragebook/coco/app/assets/js/app|@appComponents/**/*.js
|
24831
24878
|
var modules3 = [nav_bar_exports, nav_drawer_exports, slide_editor_exports, alert_exports, button_group_exports, color_picker_exports, color_picker_button_exports, confirm_panel_exports, image_picker_exports, image_picker_button_exports, menu_button_exports, notice_exports, seamless_textarea_exports, snackbar_exports, system_banner_exports, toast_exports, toolbar_exports];
|
24832
24879
|
var __default3 = modules3;
|
24833
24880
|
|
@@ -893,8 +893,11 @@ select {
|
|
893
893
|
font-size: var(--text-font-size);
|
894
894
|
}
|
895
895
|
[data-coco][data-component="book-media-slide"] img {
|
896
|
+
height: 100%;
|
896
897
|
width: 100%;
|
897
898
|
border-radius: 0.375rem;
|
899
|
+
-o-object-fit: contain;
|
900
|
+
object-fit: contain;
|
898
901
|
}
|
899
902
|
.static {
|
900
903
|
position: static;
|
@@ -19802,14 +19802,14 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
|
|
19802
19802
|
};
|
19803
19803
|
});
|
19804
19804
|
|
19805
|
-
// import-glob:/
|
19805
|
+
// import-glob:/Users/mark/Projects/coveragebook/coco/app/assets/js/base|@baseComponents/**/*.js
|
19806
19806
|
var modules = [button_exports, dropdown_exports, icon_exports, image_uploader_exports];
|
19807
19807
|
var __default = modules;
|
19808
19808
|
|
19809
19809
|
// base/components.js
|
19810
19810
|
var components_default = registerComponents(__default);
|
19811
19811
|
|
19812
|
-
// import-glob:/
|
19812
|
+
// import-glob:/Users/mark/Projects/coveragebook/coco/app/assets/js/book|@bookComponents/**/*.js
|
19813
19813
|
var modules2 = [];
|
19814
19814
|
var __default2 = modules2;
|
19815
19815
|
|
@@ -2,4 +2,12 @@ function stripExtension(filename) {
|
|
2
2
|
return filename.substring(0, filename.lastIndexOf(".")) || filename;
|
3
3
|
}
|
4
4
|
|
5
|
-
|
5
|
+
function dirname(path) {
|
6
|
+
return path ? path.match(/.*\//) : path;
|
7
|
+
}
|
8
|
+
|
9
|
+
function basename(path) {
|
10
|
+
return path ? path.replace(/.*\//, "") : path;
|
11
|
+
}
|
12
|
+
|
13
|
+
export { stripExtension, dirname, basename };
|