coveragebook_components 0.7.1 → 0.7.2
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.js +136 -309
- data/app/assets/build/coco/book.js +143 -185
- data/app/assets/js/coco.js +2 -30
- data/app/assets/js/{base/mixins → libs/alpine/directives}/undo.js +12 -13
- data/app/assets/js/libs/alpine/index.js +15 -13
- data/app/components/coco/app/blocks/slide_editor/slide_editor.html.erb +2 -1
- data/app/components/coco/app/blocks/slide_editor/slide_editor.js +0 -3
- data/app/components/coco/app/elements/color_picker/color_picker.js +0 -2
- data/app/components/coco/app/elements/image_picker/image_picker.js +0 -2
- data/app/components/coco/app/elements/seamless_textarea/seamless_textarea.html.erb +2 -1
- data/app/components/coco/app/elements/seamless_textarea/seamless_textarea.js +1 -7
- data/app/components/coco/app/elements/snackbar/snackbar.js +0 -2
- data/app/components/coco/app/elements/toast/toast.js +0 -2
- data/app/components/coco/base/button/button.js +0 -2
- data/app/components/coco/base/dropdown/dropdown.js +1 -3
- data/app/helpers/coco/base_helper.rb +2 -2
- data/app/helpers/coco/url_helper.rb +2 -2
- data/lib/coco.rb +1 -1
- metadata +9 -18
- data/app/assets/js/app/mixins/dropdown.js +0 -18
- data/app/assets/js/app/mixins/index.js +0 -3
- data/app/assets/js/base/mixins/attr-observer.js +0 -54
- data/app/assets/js/base/mixins/attrs.js +0 -58
- data/app/assets/js/base/mixins/dropdown.js +0 -69
- data/app/assets/js/base/mixins/index.js +0 -17
- data/app/assets/js/base/mixins/options.js +0 -76
- data/app/assets/js/base/mixins/size-observer.js +0 -34
- data/app/assets/js/base/mixins/tooltip.js +0 -81
- /data/app/assets/js/libs/alpine/{plugins → directives}/destroy.js +0 -0
- /data/app/assets/js/libs/alpine/{plugins → directives}/dimensions.js +0 -0
- /data/app/assets/js/libs/alpine/{plugins → directives}/dropdown.js +0 -0
- /data/app/assets/js/libs/alpine/{plugins → directives}/notification.js +0 -0
- /data/app/assets/js/libs/alpine/{plugins → directives}/options.js +0 -0
- /data/app/assets/js/libs/alpine/{plugins → directives}/tooltip.js +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 56e96bf21cb8437a062de0f41591fa2368d9ac92ff5e9dbf04f43601807f298c
|
4
|
+
data.tar.gz: 7e7cf02e0e22797765a93794e8ec6f6530b6796ba912b8c12c3c9338c995cc2b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d83add134a2d60eb2ce75818286274a2241f8fa63b384c85c3c50c8e8c0d4b9d25bedeacbe8225190680da26ec48f1200d6b0bc6fbda03f8f08487b11be877b
|
7
|
+
data.tar.gz: 89075553adbaefe4f6c4e620507791b54adcaff30f8038a3d4f06d03d7b14d7e5c725085f8f06e844b8463855fdd243ba4b9f811b98a168bc9f38367f51e488e
|
@@ -4591,7 +4591,7 @@
|
|
4591
4591
|
}
|
4592
4592
|
return baseRandom(lower, upper);
|
4593
4593
|
}
|
4594
|
-
var
|
4594
|
+
var camelCase5 = createCompounder(function(result2, word, index) {
|
4595
4595
|
word = word.toLowerCase();
|
4596
4596
|
return result2 + (index ? capitalize2(word) : word);
|
4597
4597
|
});
|
@@ -4619,7 +4619,7 @@
|
|
4619
4619
|
string = toString(string);
|
4620
4620
|
return string && reHasRegExpChar.test(string) ? string.replace(reRegExpChar, "\\$&") : string;
|
4621
4621
|
}
|
4622
|
-
var
|
4622
|
+
var kebabCase4 = createCompounder(function(result2, word, index) {
|
4623
4623
|
return result2 + (index ? "-" : "") + word.toLowerCase();
|
4624
4624
|
});
|
4625
4625
|
var lowerCase = createCompounder(function(result2, word, index) {
|
@@ -5203,7 +5203,7 @@
|
|
5203
5203
|
mixin(lodash, lodash);
|
5204
5204
|
lodash.add = add2;
|
5205
5205
|
lodash.attempt = attempt;
|
5206
|
-
lodash.camelCase =
|
5206
|
+
lodash.camelCase = camelCase5;
|
5207
5207
|
lodash.capitalize = capitalize2;
|
5208
5208
|
lodash.ceil = ceil;
|
5209
5209
|
lodash.clamp = clamp2;
|
@@ -5282,7 +5282,7 @@
|
|
5282
5282
|
lodash.isWeakMap = isWeakMap;
|
5283
5283
|
lodash.isWeakSet = isWeakSet;
|
5284
5284
|
lodash.join = join;
|
5285
|
-
lodash.kebabCase =
|
5285
|
+
lodash.kebabCase = kebabCase4;
|
5286
5286
|
lodash.last = last;
|
5287
5287
|
lodash.lastIndexOf = lastIndexOf;
|
5288
5288
|
lodash.lowerCase = lowerCase;
|
@@ -14032,7 +14032,7 @@
|
|
14032
14032
|
var package_default = {
|
14033
14033
|
name: "coveragebook-components",
|
14034
14034
|
type: "module",
|
14035
|
-
version: "0.7.
|
14035
|
+
version: "0.7.2",
|
14036
14036
|
main: "index.js",
|
14037
14037
|
repository: "git@github.com:coveragebook/coco.git",
|
14038
14038
|
author: "Mark Perkins <mark@coveragebook.com>",
|
@@ -20064,8 +20064,36 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
|
|
20064
20064
|
}
|
20065
20065
|
var M2 = l2;
|
20066
20066
|
|
20067
|
-
//
|
20068
|
-
|
20067
|
+
// helpers/alpine.js
|
20068
|
+
function registerComponents(components) {
|
20069
|
+
document.addEventListener("alpine:init", () => {
|
20070
|
+
components.forEach((module) => {
|
20071
|
+
if (module.default && module.default.component === true) {
|
20072
|
+
Alpine.data(module.default.name, module.default);
|
20073
|
+
}
|
20074
|
+
});
|
20075
|
+
});
|
20076
|
+
return components;
|
20077
|
+
}
|
20078
|
+
function getComponent(el, throwOnError = false) {
|
20079
|
+
try {
|
20080
|
+
return Alpine.$data(el);
|
20081
|
+
} catch (error2) {
|
20082
|
+
if (throwOnError) {
|
20083
|
+
throw error2;
|
20084
|
+
} else {
|
20085
|
+
return null;
|
20086
|
+
}
|
20087
|
+
}
|
20088
|
+
}
|
20089
|
+
function getData(el) {
|
20090
|
+
const root = Alpine.closestRoot(el);
|
20091
|
+
return root ? Alpine.$data(root) : null;
|
20092
|
+
}
|
20093
|
+
function setData(el, newData) {
|
20094
|
+
const data2 = getData(el);
|
20095
|
+
return data2 ? Object.assign(data2, newData) : null;
|
20096
|
+
}
|
20069
20097
|
|
20070
20098
|
// helpers/lang.js
|
20071
20099
|
function nameFunction(name, body) {
|
@@ -20106,6 +20134,79 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
|
|
20106
20134
|
return bytes;
|
20107
20135
|
}
|
20108
20136
|
|
20137
|
+
// libs/alpine/directives/undo.js
|
20138
|
+
function undo_default(Alpine3) {
|
20139
|
+
const maxHistorySize = 100;
|
20140
|
+
Alpine3.directive("undo", (el, { expression }, { evaluate: evaluate2 }) => {
|
20141
|
+
const data2 = getData(el);
|
20142
|
+
const history = Alpine3.reactive({
|
20143
|
+
stack: [],
|
20144
|
+
stackPos: -1,
|
20145
|
+
adding: false,
|
20146
|
+
clear() {
|
20147
|
+
history.stack.length = 0;
|
20148
|
+
history.stackPos = -1;
|
20149
|
+
},
|
20150
|
+
add(name, newValue, oldValue) {
|
20151
|
+
if (!history.adding && newValue !== oldValue) {
|
20152
|
+
if (history.stackPos < history.stackSize - 1) {
|
20153
|
+
const stack = Alpine3.raw(history.stack);
|
20154
|
+
history.stack = stack.slice(0, history.stackPos + 1);
|
20155
|
+
}
|
20156
|
+
history.stack.push({ name, newValue, oldValue });
|
20157
|
+
if (history.stackSize > maxHistorySize) {
|
20158
|
+
history.stack.pop();
|
20159
|
+
} else {
|
20160
|
+
history.stackPos++;
|
20161
|
+
}
|
20162
|
+
}
|
20163
|
+
},
|
20164
|
+
undo() {
|
20165
|
+
if (!data2.undo) {
|
20166
|
+
console.error("Missing `undo` method");
|
20167
|
+
return;
|
20168
|
+
}
|
20169
|
+
if (history.undoable) {
|
20170
|
+
history.adding = true;
|
20171
|
+
const entry = history.stack[history.stackPos];
|
20172
|
+
data2.undo(entry.name, entry.oldValue);
|
20173
|
+
history.stackPos--;
|
20174
|
+
this.$nextTick(() => history.adding = false);
|
20175
|
+
}
|
20176
|
+
},
|
20177
|
+
redo() {
|
20178
|
+
if (!data2.redo) {
|
20179
|
+
console.error("Missing `redo` method");
|
20180
|
+
return;
|
20181
|
+
}
|
20182
|
+
if (history.redoable) {
|
20183
|
+
history.adding = true;
|
20184
|
+
history.stackPos++;
|
20185
|
+
const entry = history.stack[history.stackPos];
|
20186
|
+
data2.redo(entry.name, entry.newValue);
|
20187
|
+
this.$nextTick(() => history.adding = false);
|
20188
|
+
}
|
20189
|
+
},
|
20190
|
+
get undoable() {
|
20191
|
+
return history.stackPos >= 0;
|
20192
|
+
},
|
20193
|
+
get redoable() {
|
20194
|
+
return history.stackPos < history.stackSize - 1;
|
20195
|
+
},
|
20196
|
+
get stackSize() {
|
20197
|
+
return history.stack.length;
|
20198
|
+
},
|
20199
|
+
get stackMemoryUsage() {
|
20200
|
+
return roughSizeOfObject(history.stack);
|
20201
|
+
}
|
20202
|
+
});
|
20203
|
+
setData(el, { history });
|
20204
|
+
});
|
20205
|
+
}
|
20206
|
+
|
20207
|
+
// libs/alpine/directives/options.js
|
20208
|
+
var import_lodash = __toESM(require_lodash(), 1);
|
20209
|
+
|
20109
20210
|
// helpers/dom.js
|
20110
20211
|
function getHiddenElementDimensions(el, display = "block") {
|
20111
20212
|
let size2;
|
@@ -20134,38 +20235,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
|
|
20134
20235
|
return typeof Node === "object" ? o3 instanceof Node : o3 && typeof o3 === "object" && typeof o3.nodeType === "number" && typeof o3.nodeName === "string";
|
20135
20236
|
}
|
20136
20237
|
|
20137
|
-
//
|
20138
|
-
function registerComponents(components) {
|
20139
|
-
document.addEventListener("alpine:init", () => {
|
20140
|
-
components.forEach((module) => {
|
20141
|
-
if (module.default && module.default.component === true) {
|
20142
|
-
Alpine.data(module.default.name, module.default);
|
20143
|
-
}
|
20144
|
-
});
|
20145
|
-
});
|
20146
|
-
return components;
|
20147
|
-
}
|
20148
|
-
function getComponent(el, throwOnError = false) {
|
20149
|
-
try {
|
20150
|
-
return Alpine.$data(el);
|
20151
|
-
} catch (error2) {
|
20152
|
-
if (throwOnError) {
|
20153
|
-
throw error2;
|
20154
|
-
} else {
|
20155
|
-
return null;
|
20156
|
-
}
|
20157
|
-
}
|
20158
|
-
}
|
20159
|
-
function getData(el) {
|
20160
|
-
const root = Alpine.closestRoot(el);
|
20161
|
-
return root ? Alpine.$data(root) : null;
|
20162
|
-
}
|
20163
|
-
function setData(el, newData) {
|
20164
|
-
const data2 = getData(el);
|
20165
|
-
return data2 ? Object.assign(data2, newData) : null;
|
20166
|
-
}
|
20167
|
-
|
20168
|
-
// libs/alpine/plugins/options.js
|
20238
|
+
// libs/alpine/directives/options.js
|
20169
20239
|
function options_default(Alpine3) {
|
20170
20240
|
Alpine3.directive(
|
20171
20241
|
"options",
|
@@ -23337,7 +23407,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
|
|
23337
23407
|
return config;
|
23338
23408
|
}
|
23339
23409
|
|
23340
|
-
// libs/alpine/
|
23410
|
+
// libs/alpine/directives/tooltip.js
|
23341
23411
|
function tooltip_default(Alpine3) {
|
23342
23412
|
Alpine3.directive(
|
23343
23413
|
"tooltip",
|
@@ -23393,7 +23463,18 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
|
|
23393
23463
|
).before("bind");
|
23394
23464
|
}
|
23395
23465
|
|
23396
|
-
// libs/alpine/
|
23466
|
+
// libs/alpine/directives/destroy.js
|
23467
|
+
function destroy_default(Alpine3) {
|
23468
|
+
Alpine3.directive(
|
23469
|
+
"destroy",
|
23470
|
+
(el, { expression }, { evaluateLater: evaluateLater2, cleanup: cleanup2 }) => {
|
23471
|
+
const clean2 = evaluateLater2(expression);
|
23472
|
+
cleanup2(() => clean2());
|
23473
|
+
}
|
23474
|
+
);
|
23475
|
+
}
|
23476
|
+
|
23477
|
+
// libs/alpine/directives/dropdown.js
|
23397
23478
|
function dropdown_default(Alpine3) {
|
23398
23479
|
Alpine3.directive(
|
23399
23480
|
"dropdown",
|
@@ -23453,18 +23534,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
|
|
23453
23534
|
).before("bind");
|
23454
23535
|
}
|
23455
23536
|
|
23456
|
-
// libs/alpine/
|
23457
|
-
function destroy_default(Alpine3) {
|
23458
|
-
Alpine3.directive(
|
23459
|
-
"destroy",
|
23460
|
-
(el, { expression }, { evaluateLater: evaluateLater2, cleanup: cleanup2 }) => {
|
23461
|
-
const clean2 = evaluateLater2(expression);
|
23462
|
-
cleanup2(() => clean2());
|
23463
|
-
}
|
23464
|
-
);
|
23465
|
-
}
|
23466
|
-
|
23467
|
-
// libs/alpine/plugins/dimensions.js
|
23537
|
+
// libs/alpine/directives/dimensions.js
|
23468
23538
|
function dimensions_default(Alpine3) {
|
23469
23539
|
Alpine3.directive(
|
23470
23540
|
"dimensions",
|
@@ -23501,7 +23571,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
|
|
23501
23571
|
);
|
23502
23572
|
}
|
23503
23573
|
|
23504
|
-
// libs/alpine/
|
23574
|
+
// libs/alpine/directives/notification.js
|
23505
23575
|
function notification_default(Alpine3) {
|
23506
23576
|
let notificationId = 0;
|
23507
23577
|
let queuePosition = 0;
|
@@ -23577,19 +23647,20 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
|
|
23577
23647
|
}
|
23578
23648
|
|
23579
23649
|
// libs/alpine/index.js
|
23580
|
-
module_default
|
23650
|
+
window.Alpine = module_default;
|
23651
|
+
module_default.plugin(M2);
|
23581
23652
|
module_default.plugin(module_default5);
|
23653
|
+
module_default.plugin(module_default6);
|
23654
|
+
module_default.plugin(module_default2);
|
23582
23655
|
module_default.plugin(module_default3);
|
23583
23656
|
module_default.plugin(module_default4);
|
23584
|
-
module_default.plugin(
|
23585
|
-
module_default.plugin(M2);
|
23657
|
+
module_default.plugin(undo_default);
|
23586
23658
|
module_default.plugin(options_default);
|
23587
23659
|
module_default.plugin(tooltip_default);
|
23588
|
-
module_default.plugin(dropdown_default);
|
23589
23660
|
module_default.plugin(destroy_default);
|
23661
|
+
module_default.plugin(dropdown_default);
|
23590
23662
|
module_default.plugin(dimensions_default);
|
23591
23663
|
module_default.plugin(notification_default);
|
23592
|
-
window.Alpine = module_default;
|
23593
23664
|
var alpine_default2 = module_default;
|
23594
23665
|
|
23595
23666
|
// ../../components/coco/base/button/button.js
|
@@ -23598,218 +23669,6 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
|
|
23598
23669
|
default: () => button_default
|
23599
23670
|
});
|
23600
23671
|
|
23601
|
-
// base/mixins/attrs.js
|
23602
|
-
function withAttrs(props = {}) {
|
23603
|
-
return function(component) {
|
23604
|
-
return Object.assign(
|
23605
|
-
component,
|
23606
|
-
Alpine.reactive({
|
23607
|
-
getAttr(name) {
|
23608
|
-
return this.$root.getAttribute(name);
|
23609
|
-
},
|
23610
|
-
setAttr(name, value) {
|
23611
|
-
this.$root.setAttribute(name, value);
|
23612
|
-
return this;
|
23613
|
-
},
|
23614
|
-
hasAttr(name) {
|
23615
|
-
return this.$root.hasAttribute(name);
|
23616
|
-
},
|
23617
|
-
removeAttr(name) {
|
23618
|
-
component.$root.removeAttribute(name);
|
23619
|
-
return this;
|
23620
|
-
},
|
23621
|
-
assertAttr(name, testValue) {
|
23622
|
-
return this.$root.getAttribute(name) === String(testValue);
|
23623
|
-
},
|
23624
|
-
refuteAttr(name, testValue) {
|
23625
|
-
return !this.assertAttr(name, testValue);
|
23626
|
-
},
|
23627
|
-
getData(name) {
|
23628
|
-
return this.getAttr(`data-${name}`);
|
23629
|
-
},
|
23630
|
-
setData(name, value) {
|
23631
|
-
return this.setAttr(`data-${name}`, value);
|
23632
|
-
},
|
23633
|
-
hasData(name) {
|
23634
|
-
return this.hasAttr(`data-${name}`);
|
23635
|
-
},
|
23636
|
-
removeData(name) {
|
23637
|
-
return this.removeAttr(`data-${name}`);
|
23638
|
-
},
|
23639
|
-
assertData(name, testValue) {
|
23640
|
-
return this.assertAttr(`data-${name}`, testValue);
|
23641
|
-
},
|
23642
|
-
refuteData(name, testValue) {
|
23643
|
-
return !this.assertData(name, testValue);
|
23644
|
-
}
|
23645
|
-
})
|
23646
|
-
);
|
23647
|
-
};
|
23648
|
-
}
|
23649
|
-
|
23650
|
-
// base/mixins/options.js
|
23651
|
-
var import_lodash2 = __toESM(require_lodash(), 1);
|
23652
|
-
function withOptions(props = {}) {
|
23653
|
-
return function(component) {
|
23654
|
-
if (!component.options) {
|
23655
|
-
return component;
|
23656
|
-
}
|
23657
|
-
const el = component.$root;
|
23658
|
-
const oldDestroy = component.destroy;
|
23659
|
-
const optionsProps = component.options || {};
|
23660
|
-
const optionsAttrs = Object.keys(optionsProps).map(
|
23661
|
-
(name) => `data-${(0, import_lodash2.kebabCase)(name)}`
|
23662
|
-
);
|
23663
|
-
Object.keys(optionsProps).forEach((name) => {
|
23664
|
-
const attrName = `data-${(0, import_lodash2.kebabCase)(name)}`;
|
23665
|
-
if (el.hasAttribute(attrName)) {
|
23666
|
-
component.options[name] = el.getAttribute(attrName);
|
23667
|
-
}
|
23668
|
-
});
|
23669
|
-
let attrObserver = new MutationObserver((mutationsList) => {
|
23670
|
-
for (const mutation of mutationsList) {
|
23671
|
-
if (mutation.type !== "attributes" || !optionsAttrs.includes(mutation.attributeName)) {
|
23672
|
-
return;
|
23673
|
-
}
|
23674
|
-
const propName = (0, import_lodash2.camelCase)(mutation.attributeName.replace("data-", ""));
|
23675
|
-
let value = mutation.target.getAttribute(mutation.attributeName);
|
23676
|
-
switch (value) {
|
23677
|
-
case "true":
|
23678
|
-
value = true;
|
23679
|
-
break;
|
23680
|
-
case "false":
|
23681
|
-
value = false;
|
23682
|
-
break;
|
23683
|
-
}
|
23684
|
-
component.options[propName] = value;
|
23685
|
-
}
|
23686
|
-
});
|
23687
|
-
Object.assign(
|
23688
|
-
component,
|
23689
|
-
Alpine.reactive({
|
23690
|
-
destroy() {
|
23691
|
-
attrObserver.disconnect();
|
23692
|
-
attrObserver = null;
|
23693
|
-
if (oldDestroy) {
|
23694
|
-
oldDestroy.call(this);
|
23695
|
-
}
|
23696
|
-
}
|
23697
|
-
})
|
23698
|
-
);
|
23699
|
-
attrObserver.observe(el, { attributes: true });
|
23700
|
-
component.$watch("options", (options, oldOptions) => {
|
23701
|
-
for (const [key, value] of Object.entries(options)) {
|
23702
|
-
el.setAttribute(`data-${(0, import_lodash2.kebabCase)(key)}`, value);
|
23703
|
-
if (component.onOptionChange) {
|
23704
|
-
component.onOptionChange(key, value);
|
23705
|
-
}
|
23706
|
-
}
|
23707
|
-
});
|
23708
|
-
return component;
|
23709
|
-
};
|
23710
|
-
}
|
23711
|
-
|
23712
|
-
// base/mixins/size-observer.js
|
23713
|
-
function withSizeObserver(props = {}) {
|
23714
|
-
return function(component) {
|
23715
|
-
const resizeTarget = props.target || component.$root;
|
23716
|
-
const oldDestroy = component.destroy;
|
23717
|
-
const sizeObserver = Alpine.reactive({
|
23718
|
-
observer: null,
|
23719
|
-
handler(target) {
|
23720
|
-
if (component.onResize) {
|
23721
|
-
component.onResize(target.contentRect, target);
|
23722
|
-
}
|
23723
|
-
}
|
23724
|
-
});
|
23725
|
-
sizeObserver.observer = new ResizeObserver(
|
23726
|
-
(entries) => sizeObserver.handler(entries[0])
|
23727
|
-
);
|
23728
|
-
Object.assign(component, {
|
23729
|
-
destroy() {
|
23730
|
-
sizeObserver.observer.disconnect();
|
23731
|
-
sizeObserver.observer = null;
|
23732
|
-
if (oldDestroy) {
|
23733
|
-
oldDestroy.call(this);
|
23734
|
-
}
|
23735
|
-
}
|
23736
|
-
});
|
23737
|
-
sizeObserver.observer.observe(resizeTarget);
|
23738
|
-
return component;
|
23739
|
-
};
|
23740
|
-
}
|
23741
|
-
|
23742
|
-
// base/mixins/undo.js
|
23743
|
-
function withUndo(props = {}) {
|
23744
|
-
function withUndoMixin(component) {
|
23745
|
-
const maxHistorySize = props.maxEntries || 100;
|
23746
|
-
const history = Alpine.reactive({
|
23747
|
-
stack: [],
|
23748
|
-
stackPos: -1,
|
23749
|
-
adding: false,
|
23750
|
-
clear() {
|
23751
|
-
history.stack.length = 0;
|
23752
|
-
history.stackPos = -1;
|
23753
|
-
},
|
23754
|
-
add(name, newValue, oldValue) {
|
23755
|
-
if (!history.adding && newValue !== oldValue) {
|
23756
|
-
if (history.stackPos < history.stackSize - 1) {
|
23757
|
-
const stack = Alpine.raw(history.stack);
|
23758
|
-
history.stack = stack.slice(0, history.stackPos + 1);
|
23759
|
-
}
|
23760
|
-
history.stack.push({ name, newValue, oldValue });
|
23761
|
-
if (history.stackSize > maxHistorySize) {
|
23762
|
-
history.stack.pop();
|
23763
|
-
} else {
|
23764
|
-
history.stackPos++;
|
23765
|
-
}
|
23766
|
-
}
|
23767
|
-
},
|
23768
|
-
undo() {
|
23769
|
-
if (!component.undo) {
|
23770
|
-
console.error("Missing `undo` method");
|
23771
|
-
return;
|
23772
|
-
}
|
23773
|
-
if (history.undoable) {
|
23774
|
-
history.adding = true;
|
23775
|
-
const entry = history.stack[history.stackPos];
|
23776
|
-
component.undo(entry.name, entry.oldValue);
|
23777
|
-
history.stackPos--;
|
23778
|
-
this.$nextTick(() => history.adding = false);
|
23779
|
-
}
|
23780
|
-
},
|
23781
|
-
redo() {
|
23782
|
-
if (!component.redo) {
|
23783
|
-
console.error("Missing `redo` method");
|
23784
|
-
return;
|
23785
|
-
}
|
23786
|
-
if (history.redoable) {
|
23787
|
-
history.adding = true;
|
23788
|
-
history.stackPos++;
|
23789
|
-
const entry = history.stack[history.stackPos];
|
23790
|
-
component.redo(entry.name, entry.newValue);
|
23791
|
-
this.$nextTick(() => history.adding = false);
|
23792
|
-
}
|
23793
|
-
},
|
23794
|
-
get undoable() {
|
23795
|
-
return history.stackPos >= 0;
|
23796
|
-
},
|
23797
|
-
get redoable() {
|
23798
|
-
return history.stackPos < history.stackSize - 1;
|
23799
|
-
},
|
23800
|
-
get stackSize() {
|
23801
|
-
return history.stack.length;
|
23802
|
-
},
|
23803
|
-
get stackMemoryUsage() {
|
23804
|
-
return roughSizeOfObject(history.stack);
|
23805
|
-
}
|
23806
|
-
});
|
23807
|
-
return Object.assign(component, { history });
|
23808
|
-
}
|
23809
|
-
withUndoMixin.props = ["history"];
|
23810
|
-
return withUndoMixin;
|
23811
|
-
}
|
23812
|
-
|
23813
23672
|
// coco.js
|
23814
23673
|
function CocoComponent(name, fn3) {
|
23815
23674
|
const func = nameFunction(name, (...args) => {
|
@@ -23822,37 +23681,16 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
|
|
23822
23681
|
}
|
23823
23682
|
});
|
23824
23683
|
data2.$options = {};
|
23825
|
-
|
23826
|
-
return data2;
|
23827
|
-
const originalInit = data2.init;
|
23828
|
-
const mixins = [withAttrs(), withOptions(), ...data2.use || []];
|
23829
|
-
mixins.forEach((mixin) => {
|
23830
|
-
if (mixin.props) {
|
23831
|
-
mixin.props.forEach((prop) => {
|
23832
|
-
if (!data2[prop]) {
|
23833
|
-
data2[prop] = null;
|
23834
|
-
}
|
23835
|
-
});
|
23836
|
-
}
|
23837
|
-
});
|
23838
|
-
return Object.assign(data2, {
|
23839
|
-
init() {
|
23840
|
-
mixins.forEach((mixin) => mixin(this));
|
23841
|
-
if (originalInit) {
|
23842
|
-
originalInit.call(this);
|
23843
|
-
}
|
23844
|
-
}
|
23845
|
-
});
|
23684
|
+
return data2;
|
23846
23685
|
});
|
23847
23686
|
func.component = true;
|
23848
23687
|
return func;
|
23849
23688
|
}
|
23850
23689
|
|
23851
23690
|
// ../../components/coco/base/button/button.js
|
23852
|
-
var
|
23691
|
+
var import_lodash2 = __toESM(require_lodash(), 1);
|
23853
23692
|
var button_default = CocoComponent("button", (data2 = {}) => {
|
23854
23693
|
return __spreadProps(__spreadValues({
|
23855
|
-
use: false,
|
23856
23694
|
options: ["state", "confirm", "size", "disabled", "collapsible"],
|
23857
23695
|
isCollapsed: false,
|
23858
23696
|
approving: false,
|
@@ -23950,7 +23788,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
|
|
23950
23788
|
},
|
23951
23789
|
setState(name) {
|
23952
23790
|
this.lastState = this.state;
|
23953
|
-
this.$options.state = (0,
|
23791
|
+
this.$options.state = (0, import_lodash2.camelCase)(name);
|
23954
23792
|
},
|
23955
23793
|
resetState() {
|
23956
23794
|
this.$options.state = this.lastState || "default";
|
@@ -24004,9 +23842,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
|
|
24004
23842
|
default: () => dropdown_default2
|
24005
23843
|
});
|
24006
23844
|
var dropdown_default2 = CocoComponent("dropdown", () => {
|
24007
|
-
return {
|
24008
|
-
use: false
|
24009
|
-
};
|
23845
|
+
return {};
|
24010
23846
|
});
|
24011
23847
|
|
24012
23848
|
// ../../components/coco/base/icon/icon.js
|
@@ -24359,9 +24195,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
|
|
24359
24195
|
data: data2.image2
|
24360
24196
|
}
|
24361
24197
|
};
|
24362
|
-
return __spreadProps(__spreadValues({
|
24363
|
-
use: [withUndo()]
|
24364
|
-
}, initialData), {
|
24198
|
+
return __spreadProps(__spreadValues({}, initialData), {
|
24365
24199
|
saved: __spreadValues({}, initialData),
|
24366
24200
|
saving: false,
|
24367
24201
|
ready: false,
|
@@ -26379,7 +26213,6 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
|
|
26379
26213
|
// ../../components/coco/app/elements/color_picker/color_picker.js
|
26380
26214
|
var color_picker_default = CocoComponent("appColorPicker", ({ selected }) => {
|
26381
26215
|
return {
|
26382
|
-
use: false,
|
26383
26216
|
selectedColor: selected,
|
26384
26217
|
display: selected,
|
26385
26218
|
updating: false,
|
@@ -26500,7 +26333,6 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
|
|
26500
26333
|
});
|
26501
26334
|
var image_picker_default = CocoComponent("appImagePicker", ({ src }) => {
|
26502
26335
|
return {
|
26503
|
-
use: [],
|
26504
26336
|
image: {
|
26505
26337
|
name: basename(src),
|
26506
26338
|
file: null,
|
@@ -26639,7 +26471,6 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
|
|
26639
26471
|
});
|
26640
26472
|
var seamless_textarea_default = CocoComponent("appSeamlessTextarea", () => {
|
26641
26473
|
return {
|
26642
|
-
use: [withSizeObserver()],
|
26643
26474
|
height: null,
|
26644
26475
|
observer: null,
|
26645
26476
|
value: null,
|
@@ -26657,10 +26488,8 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
|
|
26657
26488
|
onResize() {
|
26658
26489
|
const textarea = this.$refs.textarea;
|
26659
26490
|
if (textarea) {
|
26660
|
-
const styles = window.getComputedStyle(textarea);
|
26661
|
-
const fontSize = styles.getPropertyValue("font-size");
|
26662
26491
|
textarea.style.height = "4px";
|
26663
|
-
|
26492
|
+
const newHeight = textarea.scrollHeight;
|
26664
26493
|
textarea.style.height = `${newHeight}px`;
|
26665
26494
|
if (this.height !== newHeight) {
|
26666
26495
|
this.height = newHeight;
|
@@ -26677,7 +26506,6 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
|
|
26677
26506
|
});
|
26678
26507
|
var snackbar_default = CocoComponent("appSnackbar", () => {
|
26679
26508
|
return {
|
26680
|
-
use: false,
|
26681
26509
|
notificationType: "snackbar",
|
26682
26510
|
options: ["show", "dismiss", "showDelay", "dismissDelay", "position"],
|
26683
26511
|
root: {
|
@@ -26713,7 +26541,6 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
|
|
26713
26541
|
});
|
26714
26542
|
var toast_default = CocoComponent("appToast", () => {
|
26715
26543
|
return {
|
26716
|
-
use: false,
|
26717
26544
|
notificationType: "toast",
|
26718
26545
|
options: ["show", "dismiss", "showDelay", "dismissDelay", "position"],
|
26719
26546
|
root: {
|