@themarioga/grid-editor 7.3.0 → 8.0.0-beta.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.
- package/CHANGELOG.md +60 -0
- package/README.md +27 -30
- package/UPGRADING.md +55 -0
- package/dist/grideditor.bundle.min.js +3 -3
- package/dist/grideditor.css +47 -6
- package/dist/grideditor.d.ts +3 -3
- package/dist/grideditor.esm.js +7 -58
- package/dist/grideditor.jquery.js +0 -13
- package/dist/grideditor.jquery.min.js +1 -1
- package/dist/grideditor.jquery.min.js.map +3 -3
- package/dist/grideditor.js +7 -58
- package/dist/grideditor.min.css +1 -1
- package/dist/grideditor.min.css.map +1 -1
- package/dist/grideditor.min.js +2 -2
- package/dist/grideditor.min.js.map +3 -3
- package/dist/locales/grideditor.es.esm.js +13 -6
- package/dist/locales/grideditor.es.js +13 -6
- package/dist/locales/grideditor.es.min.js +1 -1
- package/dist/locales/grideditor.es.min.js.map +2 -2
- package/dist/plugins/grideditor.accordion.min.js.map +2 -2
- package/dist/plugins/grideditor.alignment.esm.js +11 -38
- package/dist/plugins/grideditor.alignment.js +11 -38
- package/dist/plugins/grideditor.alignment.min.js +1 -1
- package/dist/plugins/grideditor.alignment.min.js.map +3 -3
- package/dist/plugins/grideditor.card.min.js.map +1 -1
- package/dist/plugins/grideditor.ckeditor.esm.js +0 -5
- package/dist/plugins/grideditor.ckeditor.js +0 -5
- package/dist/plugins/grideditor.ckeditor.min.js +1 -1
- package/dist/plugins/grideditor.ckeditor.min.js.map +3 -3
- package/dist/plugins/grideditor.clipboard.min.js.map +1 -1
- package/dist/plugins/grideditor.codemirror-inline.min.js.map +1 -1
- package/dist/plugins/grideditor.codemirror.min.js.map +1 -1
- package/dist/plugins/grideditor.elements.min.js.map +2 -2
- package/dist/plugins/grideditor.gutters.min.js.map +1 -1
- package/dist/plugins/grideditor.order.min.js.map +1 -1
- package/dist/plugins/grideditor.popup.min.js.map +1 -1
- package/dist/plugins/grideditor.sections.min.js.map +2 -2
- package/dist/plugins/grideditor.style.esm.js +393 -60
- package/dist/plugins/grideditor.style.js +387 -56
- package/dist/plugins/grideditor.style.min.js +4 -2
- package/dist/plugins/grideditor.style.min.js.map +4 -4
- package/dist/plugins/grideditor.summernote.min.js.map +2 -2
- package/dist/plugins/grideditor.tabs.min.js.map +2 -2
- package/dist/plugins/grideditor.tinymce.esm.js +1 -8
- package/dist/plugins/grideditor.tinymce.js +1 -8
- package/dist/plugins/grideditor.tinymce.min.js +1 -1
- package/dist/plugins/grideditor.tinymce.min.js.map +3 -3
- package/docs/events.md +4 -6
- package/docs/locale-keys.md +18 -13
- package/docs/plugins.md +15 -35
- package/example/ckeditor.html +0 -5
- package/example/index.html +5 -4
- package/example/style.html +16 -4
- package/example/utilities.html +12 -11
- package/package.json +1 -1
- package/src/js/dom.js +1 -2
- package/src/js/grideditor.jquery.js +7 -28
- package/src/js/grideditor.js +12 -81
- package/src/js/locales/grideditor.es.js +13 -6
- package/src/js/plugins/grideditor.alignment.js +21 -50
- package/src/js/plugins/grideditor.ckeditor.js +10 -23
- package/src/js/plugins/grideditor.style.js +18 -12
- package/src/js/plugins/grideditor.summernote.js +4 -5
- package/src/js/plugins/grideditor.tinymce.js +4 -17
- package/src/js/style/accordion.js +14 -3
- package/src/js/style/display.js +229 -0
- package/src/js/style/drawerflow.js +118 -0
- package/src/js/style/flex.js +156 -0
- package/src/js/style/float.js +2 -4
- package/src/js/style/options.js +5 -20
- package/src/js/style/sections.js +42 -15
- package/src/js/style/spacing.js +2 -4
- package/src/js/style/sticky.js +39 -0
- package/src/js/style/textalign.js +2 -4
- package/src/js/text/grideditor.text.js +1 -1
- package/src/less/grideditor.less +40 -10
- package/types/grideditor.d.ts +3 -3
- package/dist/plugins/grideditor.float.esm.js +0 -43
- package/dist/plugins/grideditor.float.js +0 -47
- package/dist/plugins/grideditor.float.min.js +0 -1
- package/dist/plugins/grideditor.float.min.js.map +0 -7
- package/dist/plugins/grideditor.spacing.esm.js +0 -327
- package/dist/plugins/grideditor.spacing.js +0 -329
- package/dist/plugins/grideditor.spacing.min.js +0 -1
- package/dist/plugins/grideditor.spacing.min.js.map +0 -7
- package/dist/plugins/grideditor.textalign.esm.js +0 -49
- package/dist/plugins/grideditor.textalign.js +0 -53
- package/dist/plugins/grideditor.textalign.min.js +0 -1
- package/dist/plugins/grideditor.textalign.min.js.map +0 -7
- package/dist/plugins/grideditor.visibility.esm.js +0 -167
- package/dist/plugins/grideditor.visibility.js +0 -169
- package/dist/plugins/grideditor.visibility.min.js +0 -1
- package/dist/plugins/grideditor.visibility.min.js.map +0 -7
- package/src/js/plugins/grideditor.float.js +0 -29
- package/src/js/plugins/grideditor.spacing.js +0 -31
- package/src/js/plugins/grideditor.textalign.js +0 -27
- package/src/js/plugins/grideditor.visibility.js +0 -32
- package/src/js/style/visibility.js +0 -160
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/js/plugins/grideditor.style.js
|
|
2
|
-
import { GridEditor as
|
|
2
|
+
import { GridEditor as GridEditor7 } from "../grideditor.esm.js";
|
|
3
3
|
|
|
4
4
|
// src/js/style/spacing.js
|
|
5
5
|
import { GridEditor } from "../grideditor.esm.js";
|
|
@@ -277,9 +277,9 @@ function spacingPart(ge, given) {
|
|
|
277
277
|
box.appendChild(field);
|
|
278
278
|
return box;
|
|
279
279
|
}
|
|
280
|
-
var
|
|
280
|
+
var NODES3 = ".row, .column, .ge-element, [data-ge-container]";
|
|
281
281
|
function mark2(scope) {
|
|
282
|
-
selfAndAll(scope,
|
|
282
|
+
selfAndAll(scope, NODES3).forEach(function(node) {
|
|
283
283
|
var drawer = child(node, ".ge-tools-drawer");
|
|
284
284
|
if (!drawer || !applies(node, ge.kindOf(node))) {
|
|
285
285
|
return;
|
|
@@ -395,28 +395,39 @@ function textalignPart(ge) {
|
|
|
395
395
|
};
|
|
396
396
|
}
|
|
397
397
|
|
|
398
|
-
// src/js/style/
|
|
398
|
+
// src/js/style/display.js
|
|
399
399
|
import { GridEditor as GridEditor3 } from "../grideditor.esm.js";
|
|
400
400
|
Object.assign(GridEditor3.locales.en, {
|
|
401
|
-
"utility.
|
|
401
|
+
"utility.display": "Display",
|
|
402
402
|
"utility.visibility_hidden": "Hidden",
|
|
403
|
-
"utility.visibility_shown": "Shown",
|
|
404
403
|
"tool.hide_in_view": "Hide in this view",
|
|
405
404
|
"tool.show_in_view": "Show in this view",
|
|
406
405
|
"badge.hidden_in": "Hidden at {breakpoints}"
|
|
407
406
|
});
|
|
408
|
-
var
|
|
407
|
+
var VALUES2 = ["none", "inline", "inline-block", "block", "grid", "inline-grid", "flex", "inline-flex"];
|
|
408
|
+
var CLASS_PATTERN = new RegExp("(?:^|\\s)d-(?:(?:sm|md|lg|xl|xxl)-)?(?:" + VALUES2.join("|") + ")(?:\\s|$)");
|
|
409
|
+
var NONE_PATTERN = /^d-(?:(?:sm|md|lg|xl|xxl)-)?none$/;
|
|
409
410
|
var NODES = ".row, .column, .ge-content, .ge-element, [data-ge-container]";
|
|
410
|
-
|
|
411
|
+
var SHOWN_ATTR = "data-ge-display";
|
|
412
|
+
function displayPart(ge, given) {
|
|
411
413
|
var options = Object.assign({ drawer: true }, given);
|
|
412
|
-
function
|
|
414
|
+
function choices(kind) {
|
|
415
|
+
if (kind === "row") {
|
|
416
|
+
return ["none", "flex"];
|
|
417
|
+
}
|
|
418
|
+
if (kind === "text" || kind === "plain") {
|
|
419
|
+
return ["none", "block"];
|
|
420
|
+
}
|
|
421
|
+
return VALUES2;
|
|
422
|
+
}
|
|
423
|
+
function shownByDefault(kind) {
|
|
413
424
|
return kind === "row" ? "flex" : "block";
|
|
414
425
|
}
|
|
415
426
|
function applies(node, kind) {
|
|
416
427
|
return kind === "row" || kind === "column" || kind === "element" || kind === "text" || kind === "plain" || is(node, "[data-ge-container]");
|
|
417
428
|
}
|
|
418
429
|
function hiddenAt(node, view) {
|
|
419
|
-
return ge.getUtility(node, "
|
|
430
|
+
return ge.getUtility(node, "display", view) === "none";
|
|
420
431
|
}
|
|
421
432
|
function hiddenTiers(node) {
|
|
422
433
|
return ge.breakpoints.filter(function(key) {
|
|
@@ -430,6 +441,18 @@ function visibilityPart(ge, given) {
|
|
|
430
441
|
var index = ge.breakpoints.indexOf(ge.view());
|
|
431
442
|
return index > 0 && hiddenAt(node, ge.breakpoints[index - 1]);
|
|
432
443
|
}
|
|
444
|
+
function shownBelow(node, view) {
|
|
445
|
+
for (var i = ge.breakpoints.indexOf(view) - 1; i >= 0; i--) {
|
|
446
|
+
var value = ge.getUtility(node, "display", ge.breakpoints[i]);
|
|
447
|
+
if (value === null) {
|
|
448
|
+
return null;
|
|
449
|
+
}
|
|
450
|
+
if (value !== "none") {
|
|
451
|
+
return value;
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
return null;
|
|
455
|
+
}
|
|
433
456
|
function toggle2(node, kind) {
|
|
434
457
|
var hide2 = !hiddenHere(node);
|
|
435
458
|
var value;
|
|
@@ -438,9 +461,18 @@ function visibilityPart(ge, given) {
|
|
|
438
461
|
} else if (hide2) {
|
|
439
462
|
value = hiddenBelow(node) ? null : "none";
|
|
440
463
|
} else {
|
|
441
|
-
value = hiddenBelow(node) ?
|
|
464
|
+
value = hiddenBelow(node) ? shownBelow(node, ge.view()) || shownByDefault(kind) : null;
|
|
442
465
|
}
|
|
443
|
-
ge.setUtility(node, "
|
|
466
|
+
ge.setUtility(node, "display", value, { source: "tool" });
|
|
467
|
+
}
|
|
468
|
+
function shownAs(node) {
|
|
469
|
+
var original = node.getAttribute("class");
|
|
470
|
+
node.setAttribute("class", original.split(/\s+/).filter(function(name) {
|
|
471
|
+
return !NONE_PATTERN.test(name);
|
|
472
|
+
}).join(" "));
|
|
473
|
+
var display = getComputedStyle(node).display;
|
|
474
|
+
node.setAttribute("class", original);
|
|
475
|
+
return display !== "none" && VALUES2.indexOf(display) !== -1 ? display : "block";
|
|
444
476
|
}
|
|
445
477
|
function mark2(scope) {
|
|
446
478
|
selfAndAll(scope, NODES).forEach(function(node) {
|
|
@@ -449,7 +481,10 @@ function visibilityPart(ge, given) {
|
|
|
449
481
|
var tiers = carries ? hiddenTiers(node) : [];
|
|
450
482
|
var here = carries && hiddenHere(node);
|
|
451
483
|
var partly = carries && ge.view() === "all" && tiers.length > 0 && !here;
|
|
452
|
-
|
|
484
|
+
node.removeAttribute(SHOWN_ATTR);
|
|
485
|
+
if (carries && getComputedStyle(node).display === "none") {
|
|
486
|
+
node.setAttribute(SHOWN_ATTR, shownAs(node));
|
|
487
|
+
}
|
|
453
488
|
toggleClass(node, "ge-hidden-in-view", here);
|
|
454
489
|
if (partly) {
|
|
455
490
|
node.setAttribute("data-ge-hidden-in", ge.t("badge.hidden_in", { breakpoints: tiers.join(", ") }));
|
|
@@ -467,25 +502,37 @@ function visibilityPart(ge, given) {
|
|
|
467
502
|
});
|
|
468
503
|
}
|
|
469
504
|
function unmark() {
|
|
470
|
-
all(ge.canvas, ".ge-
|
|
471
|
-
removeClass(node, "ge-
|
|
505
|
+
all(ge.canvas, ".ge-hidden-in-view, [data-ge-hidden-in], [" + SHOWN_ATTR + "]").forEach(function(node) {
|
|
506
|
+
removeClass(node, "ge-hidden-in-view");
|
|
472
507
|
node.removeAttribute("data-ge-hidden-in");
|
|
508
|
+
node.removeAttribute(SHOWN_ATTR);
|
|
473
509
|
dropEmptyClass(node);
|
|
474
510
|
});
|
|
475
511
|
}
|
|
476
512
|
return {
|
|
477
513
|
families: [{
|
|
478
|
-
name: "
|
|
514
|
+
name: "display",
|
|
479
515
|
prefix: "d",
|
|
480
|
-
values:
|
|
516
|
+
values: VALUES2,
|
|
481
517
|
appliesTo: ["row", "column", "text", "element", "container"],
|
|
482
|
-
labelKey: "utility.
|
|
483
|
-
/** Hidden, or shown the way this kind of node is shown. */
|
|
518
|
+
labelKey: "utility.display",
|
|
484
519
|
choices: function(node, kind) {
|
|
485
|
-
return
|
|
520
|
+
return choices(kind);
|
|
486
521
|
},
|
|
487
522
|
label: function(value) {
|
|
488
|
-
return value === "none" ? ge.t("utility.visibility_hidden") :
|
|
523
|
+
return value === "none" ? ge.t("utility.visibility_hidden") : value;
|
|
524
|
+
},
|
|
525
|
+
/**
|
|
526
|
+
* What the view being edited displays the node as. Hidden is
|
|
527
|
+
* shown the way the breakpoints below show it, since the canvas
|
|
528
|
+
* keeps a hidden node, faded; with no class applying, it is what
|
|
529
|
+
* the node is without any.
|
|
530
|
+
*/
|
|
531
|
+
preview: function(value, node) {
|
|
532
|
+
if (value === "none") {
|
|
533
|
+
value = shownBelow(node, ge.view());
|
|
534
|
+
}
|
|
535
|
+
return { display: value === null ? ge.bareStyle(node, "display", "display") : value };
|
|
489
536
|
}
|
|
490
537
|
}],
|
|
491
538
|
drawerTools: function(drawer, node, kind) {
|
|
@@ -501,9 +548,145 @@ function visibilityPart(ge, given) {
|
|
|
501
548
|
};
|
|
502
549
|
}
|
|
503
550
|
|
|
504
|
-
// src/js/style/
|
|
551
|
+
// src/js/style/flex.js
|
|
505
552
|
import { GridEditor as GridEditor4 } from "../grideditor.esm.js";
|
|
506
553
|
Object.assign(GridEditor4.locales.en, {
|
|
554
|
+
"utility.flex_direction": "Direction",
|
|
555
|
+
"utility.flex_wrap": "Wrap",
|
|
556
|
+
"utility.justify_content": "Justify columns",
|
|
557
|
+
"utility.align_items": "Align columns",
|
|
558
|
+
"utility.align_content": "Align lines",
|
|
559
|
+
"utility.gap": "Gap",
|
|
560
|
+
"utility.row_gap": "Row gap",
|
|
561
|
+
"utility.column_gap": "Column gap",
|
|
562
|
+
"utility.flex_fill": "Fill",
|
|
563
|
+
"utility.flex_grow": "Grow",
|
|
564
|
+
"utility.flex_shrink": "Shrink"
|
|
565
|
+
});
|
|
566
|
+
var FLEX = {
|
|
567
|
+
start: "flex-start",
|
|
568
|
+
end: "flex-end",
|
|
569
|
+
center: "center",
|
|
570
|
+
between: "space-between",
|
|
571
|
+
around: "space-around",
|
|
572
|
+
evenly: "space-evenly",
|
|
573
|
+
baseline: "baseline",
|
|
574
|
+
stretch: "stretch"
|
|
575
|
+
};
|
|
576
|
+
var GAPS = ["0", "1", "2", "3", "4", "5"];
|
|
577
|
+
var SCALE2 = ["0", ".25rem", ".5rem", "1rem", "1.5rem", "3rem"];
|
|
578
|
+
var CONTAINERS = ["row", "column", "element", "container"];
|
|
579
|
+
var ITEMS = ["column", "element", "container"];
|
|
580
|
+
function flexPart(ge, spacing2) {
|
|
581
|
+
var scale = spacing2 && spacing2.scale || SCALE2;
|
|
582
|
+
function family(definition) {
|
|
583
|
+
var property = definition.property || definition.name;
|
|
584
|
+
return Object.assign({
|
|
585
|
+
prefix: definition.name,
|
|
586
|
+
panel: false,
|
|
587
|
+
preview: function(value, node) {
|
|
588
|
+
var styles = {};
|
|
589
|
+
styles[property] = value === null ? ge.bareStyle(node, definition.name, property) : definition.css(value);
|
|
590
|
+
return styles;
|
|
591
|
+
}
|
|
592
|
+
}, definition);
|
|
593
|
+
}
|
|
594
|
+
function alignment(definition) {
|
|
595
|
+
return family(Object.assign({
|
|
596
|
+
appliesTo: CONTAINERS,
|
|
597
|
+
preview: function(value) {
|
|
598
|
+
var styles = {};
|
|
599
|
+
styles[definition.name] = value === null ? "normal" : FLEX[value];
|
|
600
|
+
return styles;
|
|
601
|
+
}
|
|
602
|
+
}, definition));
|
|
603
|
+
}
|
|
604
|
+
function gap(definition) {
|
|
605
|
+
return family(Object.assign({
|
|
606
|
+
values: GAPS,
|
|
607
|
+
appliesTo: ITEMS,
|
|
608
|
+
css: function(value) {
|
|
609
|
+
return scale[value];
|
|
610
|
+
}
|
|
611
|
+
}, definition));
|
|
612
|
+
}
|
|
613
|
+
function same(value) {
|
|
614
|
+
return value;
|
|
615
|
+
}
|
|
616
|
+
return {
|
|
617
|
+
families: [
|
|
618
|
+
family({
|
|
619
|
+
name: "flex-direction",
|
|
620
|
+
prefix: "flex",
|
|
621
|
+
labelKey: "utility.flex_direction",
|
|
622
|
+
values: ["row", "row-reverse", "column", "column-reverse"],
|
|
623
|
+
appliesTo: CONTAINERS,
|
|
624
|
+
css: same
|
|
625
|
+
}),
|
|
626
|
+
family({
|
|
627
|
+
name: "flex-wrap",
|
|
628
|
+
prefix: "flex",
|
|
629
|
+
labelKey: "utility.flex_wrap",
|
|
630
|
+
values: ["wrap", "nowrap", "wrap-reverse"],
|
|
631
|
+
appliesTo: CONTAINERS,
|
|
632
|
+
css: same
|
|
633
|
+
}),
|
|
634
|
+
alignment({
|
|
635
|
+
name: "justify-content",
|
|
636
|
+
labelKey: "utility.justify_content",
|
|
637
|
+
values: ["start", "center", "end", "between", "around", "evenly"]
|
|
638
|
+
}),
|
|
639
|
+
alignment({
|
|
640
|
+
name: "align-items",
|
|
641
|
+
labelKey: "utility.align_items",
|
|
642
|
+
values: ["start", "center", "end", "baseline", "stretch"]
|
|
643
|
+
}),
|
|
644
|
+
alignment({
|
|
645
|
+
name: "align-content",
|
|
646
|
+
labelKey: "utility.align_content",
|
|
647
|
+
values: ["start", "center", "end", "between", "around", "stretch"]
|
|
648
|
+
}),
|
|
649
|
+
gap({ name: "gap", labelKey: "utility.gap" }),
|
|
650
|
+
gap({ name: "row-gap", labelKey: "utility.row_gap" }),
|
|
651
|
+
gap({ name: "column-gap", labelKey: "utility.column_gap" }),
|
|
652
|
+
family({
|
|
653
|
+
name: "flex-fill",
|
|
654
|
+
prefix: "flex",
|
|
655
|
+
property: "flex",
|
|
656
|
+
labelKey: "utility.flex_fill",
|
|
657
|
+
values: ["fill"],
|
|
658
|
+
appliesTo: ITEMS,
|
|
659
|
+
css: function() {
|
|
660
|
+
return "1 1 auto";
|
|
661
|
+
}
|
|
662
|
+
}),
|
|
663
|
+
family({
|
|
664
|
+
name: "flex-grow",
|
|
665
|
+
prefix: "flex",
|
|
666
|
+
labelKey: "utility.flex_grow",
|
|
667
|
+
values: ["grow-0", "grow-1"],
|
|
668
|
+
appliesTo: ITEMS,
|
|
669
|
+
css: function(value) {
|
|
670
|
+
return value.slice(-1);
|
|
671
|
+
}
|
|
672
|
+
}),
|
|
673
|
+
family({
|
|
674
|
+
name: "flex-shrink",
|
|
675
|
+
prefix: "flex",
|
|
676
|
+
labelKey: "utility.flex_shrink",
|
|
677
|
+
values: ["shrink-0", "shrink-1"],
|
|
678
|
+
appliesTo: ITEMS,
|
|
679
|
+
css: function(value) {
|
|
680
|
+
return value.slice(-1);
|
|
681
|
+
}
|
|
682
|
+
})
|
|
683
|
+
]
|
|
684
|
+
};
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
// src/js/style/float.js
|
|
688
|
+
import { GridEditor as GridEditor5 } from "../grideditor.esm.js";
|
|
689
|
+
Object.assign(GridEditor5.locales.en, {
|
|
507
690
|
"utility.float": "Float",
|
|
508
691
|
"utility.float_start": "Start",
|
|
509
692
|
"utility.float_end": "End",
|
|
@@ -536,16 +719,140 @@ function floatPart(ge) {
|
|
|
536
719
|
};
|
|
537
720
|
}
|
|
538
721
|
|
|
722
|
+
// src/js/style/sticky.js
|
|
723
|
+
import { GridEditor as GridEditor6 } from "../grideditor.esm.js";
|
|
724
|
+
Object.assign(GridEditor6.locales.en, {
|
|
725
|
+
"utility.sticky": "Sticky"
|
|
726
|
+
});
|
|
727
|
+
var STUCK = {
|
|
728
|
+
top: { position: "sticky", top: "0", "z-index": "1020" },
|
|
729
|
+
bottom: { position: "sticky", bottom: "0", "z-index": "1020" }
|
|
730
|
+
};
|
|
731
|
+
function stickyPart(ge) {
|
|
732
|
+
return {
|
|
733
|
+
families: [{
|
|
734
|
+
name: "sticky",
|
|
735
|
+
prefix: "sticky",
|
|
736
|
+
values: ["top", "bottom"],
|
|
737
|
+
appliesTo: ["row", "column", "element", "container"],
|
|
738
|
+
labelKey: "utility.sticky",
|
|
739
|
+
panel: false,
|
|
740
|
+
/** With no class applying here, where the node is without one. */
|
|
741
|
+
preview: function(value, node) {
|
|
742
|
+
if (value !== null) {
|
|
743
|
+
return STUCK[value];
|
|
744
|
+
}
|
|
745
|
+
return { position: ge.bareStyle(node, "sticky", "position") };
|
|
746
|
+
}
|
|
747
|
+
}]
|
|
748
|
+
};
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
// src/js/style/drawerflow.js
|
|
752
|
+
var NODES2 = ".row, .column, .ge-element, [data-ge-container]";
|
|
753
|
+
var OUT_CLASS = "ge-drawer-out";
|
|
754
|
+
var OUT_ATTR = "data-ge-drawer-out";
|
|
755
|
+
var GAP = 5;
|
|
756
|
+
var LAYS_OUT = /^(?:inline-)?(?:flex|grid)$/;
|
|
757
|
+
function drawerflowPart(ge) {
|
|
758
|
+
var sheet = null;
|
|
759
|
+
var heights = {};
|
|
760
|
+
var observer = null;
|
|
761
|
+
function rule(room) {
|
|
762
|
+
if (heights[room]) {
|
|
763
|
+
return;
|
|
764
|
+
}
|
|
765
|
+
heights[room] = true;
|
|
766
|
+
if (!sheet) {
|
|
767
|
+
sheet = document.head.appendChild(element("style", { "data-ge-drawer-flow": "" }));
|
|
768
|
+
}
|
|
769
|
+
var node = ".ge-canvas.ge-editing [" + OUT_ATTR + '="' + room + '"]';
|
|
770
|
+
sheet.appendChild(document.createTextNode(
|
|
771
|
+
node + " { border-top-width: " + room + "px !important; }\n" + node + " > .ge-tools-drawer { top: -" + room + "px; }\n"
|
|
772
|
+
));
|
|
773
|
+
}
|
|
774
|
+
function laysOut(node) {
|
|
775
|
+
var style = getComputedStyle(node);
|
|
776
|
+
if (!LAYS_OUT.test(style.display)) {
|
|
777
|
+
return false;
|
|
778
|
+
}
|
|
779
|
+
return !(hasClass(node, "row") && style.flexDirection === "row" && style.flexWrap === "wrap");
|
|
780
|
+
}
|
|
781
|
+
function measure(node, drawer) {
|
|
782
|
+
var room = Math.ceil(drawer.offsetHeight) + GAP;
|
|
783
|
+
rule(room);
|
|
784
|
+
node.setAttribute(OUT_ATTR, String(room));
|
|
785
|
+
}
|
|
786
|
+
function watch(drawer) {
|
|
787
|
+
if (typeof ResizeObserver === "undefined") {
|
|
788
|
+
return;
|
|
789
|
+
}
|
|
790
|
+
if (!observer) {
|
|
791
|
+
observer = new ResizeObserver(function(entries) {
|
|
792
|
+
entries.forEach(function(entry) {
|
|
793
|
+
var node = entry.target.parentNode;
|
|
794
|
+
if (node && hasClass(node, OUT_CLASS)) {
|
|
795
|
+
measure(node, entry.target);
|
|
796
|
+
}
|
|
797
|
+
});
|
|
798
|
+
});
|
|
799
|
+
}
|
|
800
|
+
observer.observe(drawer);
|
|
801
|
+
}
|
|
802
|
+
function mark2(scope) {
|
|
803
|
+
selfAndAll(scope, NODES2).forEach(function(node) {
|
|
804
|
+
var drawer = child(node, ".ge-tools-drawer");
|
|
805
|
+
if (!drawer) {
|
|
806
|
+
return;
|
|
807
|
+
}
|
|
808
|
+
if (laysOut(node)) {
|
|
809
|
+
addClass(node, OUT_CLASS);
|
|
810
|
+
measure(node, drawer);
|
|
811
|
+
watch(drawer);
|
|
812
|
+
} else if (hasClass(node, OUT_CLASS)) {
|
|
813
|
+
removeClass(node, OUT_CLASS);
|
|
814
|
+
node.removeAttribute(OUT_ATTR);
|
|
815
|
+
dropEmptyClass(node);
|
|
816
|
+
if (observer) {
|
|
817
|
+
observer.unobserve(drawer);
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
});
|
|
821
|
+
}
|
|
822
|
+
function unmark() {
|
|
823
|
+
if (observer) {
|
|
824
|
+
observer.disconnect();
|
|
825
|
+
}
|
|
826
|
+
observer = null;
|
|
827
|
+
all(ge.canvas, "." + OUT_CLASS).forEach(function(node) {
|
|
828
|
+
removeClass(node, OUT_CLASS);
|
|
829
|
+
node.removeAttribute(OUT_ATTR);
|
|
830
|
+
dropEmptyClass(node);
|
|
831
|
+
});
|
|
832
|
+
if (sheet) {
|
|
833
|
+
sheet.remove();
|
|
834
|
+
}
|
|
835
|
+
sheet = null;
|
|
836
|
+
heights = {};
|
|
837
|
+
}
|
|
838
|
+
return {
|
|
839
|
+
families: [],
|
|
840
|
+
onRefresh: mark2,
|
|
841
|
+
onDeinit: unmark
|
|
842
|
+
};
|
|
843
|
+
}
|
|
844
|
+
|
|
539
845
|
// src/js/style/sections.js
|
|
540
846
|
var COLORS = ["primary", "secondary", "success", "danger", "warning", "info", "light", "dark"];
|
|
541
847
|
var SIDES2 = ["top", "end", "bottom", "start"];
|
|
848
|
+
var OPACITIES = ["10", "25", "50", "75", "100"];
|
|
542
849
|
function each(prefix, values, suffix) {
|
|
543
850
|
return values.map(function(value) {
|
|
544
851
|
return prefix + value + (suffix || "");
|
|
545
852
|
});
|
|
546
853
|
}
|
|
547
|
-
function group(classes, exclusive, notOn) {
|
|
548
|
-
return { classes, exclusive: exclusive !== false, notOn: notOn || [] };
|
|
854
|
+
function group(classes, exclusive, notOn, onlyOn) {
|
|
855
|
+
return { classes, exclusive: exclusive !== false, notOn: notOn || [], onlyOn: onlyOn || null };
|
|
549
856
|
}
|
|
550
857
|
function prop(name, options) {
|
|
551
858
|
return {
|
|
@@ -557,6 +864,7 @@ function prop(name, options) {
|
|
|
557
864
|
};
|
|
558
865
|
}
|
|
559
866
|
var NOT_ON_COLUMN = ["column"];
|
|
867
|
+
var ONLY_ON_ELEMENT = ["element"];
|
|
560
868
|
var SECTIONS = [
|
|
561
869
|
{
|
|
562
870
|
key: "size",
|
|
@@ -572,7 +880,9 @@ var SECTIONS = [
|
|
|
572
880
|
catalog: [
|
|
573
881
|
group(each("w-", ["25", "50", "75", "100", "auto"]), true, NOT_ON_COLUMN),
|
|
574
882
|
group(each("h-", ["25", "50", "75", "100", "auto"]), true, NOT_ON_COLUMN),
|
|
575
|
-
group(["mw-100", "mh-100", "vw-100", "vh-100", "min-vw-100", "min-vh-100"], false, NOT_ON_COLUMN)
|
|
883
|
+
group(["mw-100", "mh-100", "vw-100", "vh-100", "min-vw-100", "min-vh-100"], false, NOT_ON_COLUMN),
|
|
884
|
+
group(["img-fluid", "img-thumbnail"], false, [], ONLY_ON_ELEMENT),
|
|
885
|
+
group(each("object-fit-", ["contain", "cover", "fill", "scale", "none"]), true, [], ONLY_ON_ELEMENT)
|
|
576
886
|
],
|
|
577
887
|
parts: []
|
|
578
888
|
},
|
|
@@ -605,7 +915,8 @@ var SECTIONS = [
|
|
|
605
915
|
catalog: [
|
|
606
916
|
group(["border", "border-0"].concat(each("border-", SIDES2), each("border-", SIDES2, "-0")), false),
|
|
607
917
|
group(each("border-", ["1", "2", "3", "4", "5"])),
|
|
608
|
-
group(each("border-", COLORS.concat(["black", "white"]))),
|
|
918
|
+
group(each("border-", COLORS.concat(["black", "white"])).concat(each("border-", COLORS, "-subtle"))),
|
|
919
|
+
group(each("border-opacity-", OPACITIES)),
|
|
609
920
|
group(["rounded"].concat(each("rounded-", ["0", "1", "2", "3", "4", "5", "circle", "pill"]))),
|
|
610
921
|
group(each("rounded-", SIDES2), false),
|
|
611
922
|
group(["shadow-none", "shadow-sm", "shadow", "shadow-lg"])
|
|
@@ -623,8 +934,9 @@ var SECTIONS = [
|
|
|
623
934
|
prop("background-repeat", { labelKey: "style.prop_background_repeat", type: "select", values: ["repeat", "no-repeat", "repeat-x", "repeat-y", "space", "round"] })
|
|
624
935
|
],
|
|
625
936
|
catalog: [
|
|
626
|
-
group(each("bg-", COLORS.concat(["body", "body-secondary", "body-tertiary", "white", "black", "transparent"]))),
|
|
627
|
-
group(["bg-gradient"], false)
|
|
937
|
+
group(each("bg-", COLORS.concat(["body", "body-secondary", "body-tertiary", "white", "black", "transparent"])).concat(each("bg-", COLORS, "-subtle"), each("text-bg-", COLORS))),
|
|
938
|
+
group(["bg-gradient"], false),
|
|
939
|
+
group(each("bg-opacity-", OPACITIES))
|
|
628
940
|
],
|
|
629
941
|
parts: []
|
|
630
942
|
},
|
|
@@ -638,7 +950,8 @@ var SECTIONS = [
|
|
|
638
950
|
prop("text-shadow", { labelKey: "style.prop_text_shadow", type: "shadow" })
|
|
639
951
|
],
|
|
640
952
|
catalog: [
|
|
641
|
-
group(each("text-", COLORS.concat(["body", "body-secondary", "body-tertiary", "white", "black"]))),
|
|
953
|
+
group(each("text-", COLORS.concat(["body", "body-secondary", "body-tertiary", "white", "black"])).concat(each("text-", COLORS, "-emphasis"), ["text-body-emphasis"])),
|
|
954
|
+
group(each("text-opacity-", ["25", "50", "75", "100"])),
|
|
642
955
|
group(each("fs-", ["1", "2", "3", "4", "5", "6"])),
|
|
643
956
|
group(each("text-decoration-", ["none", "underline", "line-through"]))
|
|
644
957
|
],
|
|
@@ -681,7 +994,16 @@ var SECTIONS = [
|
|
|
681
994
|
group(each("overflow-", ["auto", "hidden", "visible", "scroll"])),
|
|
682
995
|
group(["visible", "invisible"])
|
|
683
996
|
],
|
|
684
|
-
parts: ["
|
|
997
|
+
parts: ["display"]
|
|
998
|
+
},
|
|
999
|
+
{
|
|
1000
|
+
key: "flex",
|
|
1001
|
+
labelKey: "style.section_flex",
|
|
1002
|
+
properties: [],
|
|
1003
|
+
catalog: [
|
|
1004
|
+
group(["vstack", "hstack"], true, ["row"])
|
|
1005
|
+
],
|
|
1006
|
+
parts: ["flex"]
|
|
685
1007
|
},
|
|
686
1008
|
{
|
|
687
1009
|
key: "position",
|
|
@@ -701,9 +1023,10 @@ var SECTIONS = [
|
|
|
701
1023
|
group(each("start-", ["0", "50", "100"])),
|
|
702
1024
|
group(each("end-", ["0", "50", "100"])),
|
|
703
1025
|
group(["translate-middle", "translate-middle-x", "translate-middle-y"]),
|
|
704
|
-
group(["z-n1", "z-0", "z-1", "z-2", "z-3"])
|
|
1026
|
+
group(["z-n1", "z-0", "z-1", "z-2", "z-3"]),
|
|
1027
|
+
group(["fixed-top", "fixed-bottom"])
|
|
705
1028
|
],
|
|
706
|
-
parts: ["float"]
|
|
1029
|
+
parts: ["float", "sticky"]
|
|
707
1030
|
},
|
|
708
1031
|
{
|
|
709
1032
|
key: "custom",
|
|
@@ -720,6 +1043,9 @@ function section(key) {
|
|
|
720
1043
|
})[0] || null;
|
|
721
1044
|
}
|
|
722
1045
|
function offeredOn(item, kind) {
|
|
1046
|
+
if (item.onlyOn && item.onlyOn.indexOf(kind) === -1) {
|
|
1047
|
+
return false;
|
|
1048
|
+
}
|
|
723
1049
|
return item.notOn.indexOf(kind) === -1;
|
|
724
1050
|
}
|
|
725
1051
|
var BREAKPOINT = "(?:(?:sm|md|lg|xl|xxl)-)?";
|
|
@@ -728,6 +1054,10 @@ var COLOR = "(?:" + COLORS.join("|") + "|black|white)";
|
|
|
728
1054
|
var BG = "(?:" + COLORS.join("|") + "|body|body-secondary|body-tertiary|white|black|transparent)";
|
|
729
1055
|
var TEXT_COLOR = "(?:" + COLORS.join("|") + "|body|body-secondary|body-tertiary|white|black|muted|black-50|white-50)";
|
|
730
1056
|
var BORDER = "border(?:-(?:top|end|bottom|start))?(?:-0)?";
|
|
1057
|
+
var SUBTLE = "(?:" + COLORS.join("|") + ")-subtle";
|
|
1058
|
+
var EMPHASIS = "(?:" + COLORS.join("|") + "|body)-emphasis";
|
|
1059
|
+
var TEXT_BG = "text-bg-(?:" + COLORS.join("|") + ")";
|
|
1060
|
+
var STICKY = "sticky-" + BREAKPOINT;
|
|
731
1061
|
function spacing(key, side) {
|
|
732
1062
|
var sides = { top: "[ty]?", bottom: "[by]?", left: "[sx]?", right: "[ex]?" }[side];
|
|
733
1063
|
return new RegExp("^" + key + sides + "-" + BREAKPOINT + SPACER + "$");
|
|
@@ -749,12 +1079,12 @@ var SETS = {
|
|
|
749
1079
|
"padding-left": spacing("p", "left"),
|
|
750
1080
|
"border-width": new RegExp("^(?:" + BORDER + "|border-[1-5])$"),
|
|
751
1081
|
"border-style": new RegExp("^" + BORDER + "$"),
|
|
752
|
-
"border-color": new RegExp("^(?:" + BORDER + "|border-" + COLOR + ")$"),
|
|
1082
|
+
"border-color": new RegExp("^(?:" + BORDER + "|border-" + COLOR + "|border-" + SUBTLE + ")$"),
|
|
753
1083
|
"border-radius": /^rounded(?:-(?:[0-5]|circle|pill|top|end|bottom|start))?$/,
|
|
754
1084
|
"box-shadow": /^shadow(?:-(?:none|sm|lg))?$/,
|
|
755
|
-
"background-color": new RegExp("^bg-" + BG + "$"),
|
|
1085
|
+
"background-color": new RegExp("^(?:bg-" + BG + "|bg-" + SUBTLE + "|" + TEXT_BG + ")$"),
|
|
756
1086
|
"background-image": /^bg-gradient$/,
|
|
757
|
-
"color": new RegExp("^text-" + TEXT_COLOR + "$"),
|
|
1087
|
+
"color": new RegExp("^(?:text-" + TEXT_COLOR + "|text-" + EMPHASIS + "|" + TEXT_BG + ")$"),
|
|
758
1088
|
"font-size": /^fs-[1-6]$/,
|
|
759
1089
|
"text-align": new RegExp("^text-" + BREAKPOINT + "(?:start|center|end)$"),
|
|
760
1090
|
"text-decoration": /^text-decoration-(?:none|underline|line-through)$/,
|
|
@@ -763,13 +1093,13 @@ var SETS = {
|
|
|
763
1093
|
"font-style": /^fst-(?:italic|normal)$/,
|
|
764
1094
|
"line-height": /^lh-(?:1|sm|base|lg)$/,
|
|
765
1095
|
"text-transform": /^text-(?:lowercase|uppercase|capitalize)$/,
|
|
766
|
-
"display": new RegExp("^d-" + BREAKPOINT + "(?:none|inline|inline-block|block|grid|inline-grid|table|table-row|table-cell|flex|inline-flex)$"),
|
|
1096
|
+
"display": new RegExp("^(?:d-" + BREAKPOINT + "(?:none|inline|inline-block|block|grid|inline-grid|table|table-row|table-cell|flex|inline-flex)|vstack|hstack)$"),
|
|
767
1097
|
"opacity": /^opacity-(?:0|25|50|75|100)$/,
|
|
768
1098
|
"overflow": /^overflow-(?:auto|hidden|visible|scroll)$/,
|
|
769
1099
|
"visibility": /^(?:visible|invisible)$/,
|
|
770
|
-
"position":
|
|
771
|
-
"top":
|
|
772
|
-
"bottom":
|
|
1100
|
+
"position": new RegExp("^(?:position-(?:static|relative|absolute|fixed|sticky)|fixed-(?:top|bottom)|" + STICKY + "(?:top|bottom))$"),
|
|
1101
|
+
"top": new RegExp("^(?:top-(?:0|50|100)|fixed-top|" + STICKY + "top)$"),
|
|
1102
|
+
"bottom": new RegExp("^(?:bottom-(?:0|50|100)|fixed-bottom|" + STICKY + "bottom)$"),
|
|
773
1103
|
"left": /^start-(?:0|50|100)$/,
|
|
774
1104
|
"right": /^end-(?:0|50|100)$/,
|
|
775
1105
|
"z-index": /^z-(?:n1|[0-3])$/
|
|
@@ -823,23 +1153,12 @@ function resolveSections(ge, given) {
|
|
|
823
1153
|
});
|
|
824
1154
|
return resolved;
|
|
825
1155
|
}
|
|
826
|
-
function partOption(ge, style, name) {
|
|
827
|
-
if (style[name] !== void 0) {
|
|
828
|
-
return style[name];
|
|
829
|
-
}
|
|
830
|
-
var old = (ge.settings.utilities || {})[name];
|
|
831
|
-
if (old !== void 0) {
|
|
832
|
-
ge.warn("utilities." + name + " is deprecated and will be removed in 8.0: use style." + name);
|
|
833
|
-
return old;
|
|
834
|
-
}
|
|
835
|
-
return void 0;
|
|
836
|
-
}
|
|
837
1156
|
function resolveOptions(ge) {
|
|
838
1157
|
var style = ge.settings.style || {};
|
|
839
1158
|
return {
|
|
840
1159
|
sections: resolveSections(ge, style.sections),
|
|
841
|
-
spacing:
|
|
842
|
-
visibility:
|
|
1160
|
+
spacing: style.spacing,
|
|
1161
|
+
visibility: style.visibility
|
|
843
1162
|
};
|
|
844
1163
|
}
|
|
845
1164
|
|
|
@@ -1344,8 +1663,19 @@ function partContent(ge, part, node, kind) {
|
|
|
1344
1663
|
if (part.panel) {
|
|
1345
1664
|
return part.panel(node, kind);
|
|
1346
1665
|
}
|
|
1347
|
-
var
|
|
1348
|
-
|
|
1666
|
+
var fields = part.families.filter(function(family) {
|
|
1667
|
+
return familyApplies(family, node, kind);
|
|
1668
|
+
}).map(function(family) {
|
|
1669
|
+
return ge.utilityField(node, family.name);
|
|
1670
|
+
});
|
|
1671
|
+
if (fields.length < 2) {
|
|
1672
|
+
return fields[0] || null;
|
|
1673
|
+
}
|
|
1674
|
+
var box = element("div", { "class": "ge-style-part-fields" });
|
|
1675
|
+
fields.forEach(function(field) {
|
|
1676
|
+
box.appendChild(field);
|
|
1677
|
+
});
|
|
1678
|
+
return box;
|
|
1349
1679
|
}
|
|
1350
1680
|
function createAccordion(ge, node, kind, context) {
|
|
1351
1681
|
var inline = takesInlineStyle(node, kind);
|
|
@@ -1452,7 +1782,7 @@ function createAccordion(ge, node, kind, context) {
|
|
|
1452
1782
|
}
|
|
1453
1783
|
|
|
1454
1784
|
// src/js/plugins/grideditor.style.js
|
|
1455
|
-
Object.assign(
|
|
1785
|
+
Object.assign(GridEditor7.locales.en, {
|
|
1456
1786
|
"style.section_title": "Style",
|
|
1457
1787
|
"style.dialog_title": "Style: {kind}",
|
|
1458
1788
|
"style.section_size": "Size",
|
|
@@ -1462,6 +1792,7 @@ Object.assign(GridEditor5.locales.en, {
|
|
|
1462
1792
|
"style.section_text": "Text",
|
|
1463
1793
|
"style.section_typography": "Typography",
|
|
1464
1794
|
"style.section_display": "Display",
|
|
1795
|
+
"style.section_flex": "Flex",
|
|
1465
1796
|
"style.section_position": "Position",
|
|
1466
1797
|
"style.section_custom": "Custom css",
|
|
1467
1798
|
"style.all_sizes": "Applies to every size",
|
|
@@ -1521,14 +1852,17 @@ Object.assign(GridEditor5.locales.en, {
|
|
|
1521
1852
|
"style.prop_left": "Left",
|
|
1522
1853
|
"style.prop_z_index": "Z-index"
|
|
1523
1854
|
});
|
|
1524
|
-
var PARTS = ["spacing", "textalign", "
|
|
1525
|
-
|
|
1855
|
+
var PARTS = ["spacing", "textalign", "display", "flex", "float", "sticky", "drawerflow"];
|
|
1856
|
+
GridEditor7.utilities.style = function(ge) {
|
|
1526
1857
|
var options = resolveOptions(ge);
|
|
1527
1858
|
var parts = {
|
|
1528
1859
|
spacing: spacingPart(ge, options.spacing),
|
|
1529
1860
|
textalign: textalignPart(ge),
|
|
1530
|
-
|
|
1531
|
-
|
|
1861
|
+
display: displayPart(ge, options.visibility),
|
|
1862
|
+
flex: flexPart(ge, options.spacing),
|
|
1863
|
+
float: floatPart(ge),
|
|
1864
|
+
sticky: stickyPart(ge),
|
|
1865
|
+
drawerflow: drawerflowPart(ge)
|
|
1532
1866
|
};
|
|
1533
1867
|
var accordions = [];
|
|
1534
1868
|
var context = {
|
|
@@ -1590,4 +1924,3 @@ GridEditor5.utilities.style = function(ge) {
|
|
|
1590
1924
|
}
|
|
1591
1925
|
};
|
|
1592
1926
|
};
|
|
1593
|
-
GridEditor5.utilities.style.replaces = PARTS;
|