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