@themarioga/grid-editor 6.0.0-beta.5 → 7.0.0

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.
Files changed (147) hide show
  1. package/AUTO_SAVE.md +2 -2
  2. package/BUILDING.md +45 -29
  3. package/CHANGELOG.md +54 -0
  4. package/README.md +140 -89
  5. package/UPGRADING.md +146 -2
  6. package/dist/grideditor.bundle.min.js +14 -0
  7. package/dist/grideditor.d.ts +335 -0
  8. package/dist/grideditor.esm.js +3977 -0
  9. package/dist/grideditor.jquery.js +253 -0
  10. package/dist/grideditor.jquery.min.js +1 -0
  11. package/dist/grideditor.jquery.min.js.map +7 -0
  12. package/dist/grideditor.js +3983 -0
  13. package/dist/grideditor.min.js +6 -0
  14. package/dist/grideditor.min.js.map +7 -0
  15. package/dist/locales/grideditor.es.esm.js +158 -0
  16. package/dist/locales/grideditor.es.js +164 -170
  17. package/dist/locales/grideditor.es.min.js +6 -2
  18. package/dist/locales/grideditor.es.min.js.map +7 -1
  19. package/dist/plugins/grideditor.accordion.esm.js +294 -0
  20. package/dist/plugins/grideditor.accordion.js +286 -180
  21. package/dist/plugins/grideditor.accordion.min.js +1 -2
  22. package/dist/plugins/grideditor.accordion.min.js.map +7 -1
  23. package/dist/plugins/grideditor.alignment.esm.js +55 -0
  24. package/dist/plugins/grideditor.alignment.js +58 -77
  25. package/dist/plugins/grideditor.alignment.min.js +1 -2
  26. package/dist/plugins/grideditor.alignment.min.js.map +7 -1
  27. package/dist/plugins/grideditor.card.esm.js +73 -0
  28. package/dist/plugins/grideditor.card.js +74 -64
  29. package/dist/plugins/grideditor.card.min.js +1 -2
  30. package/dist/plugins/grideditor.card.min.js.map +7 -1
  31. package/dist/plugins/grideditor.ckeditor.esm.js +500 -0
  32. package/dist/plugins/grideditor.ckeditor.js +482 -493
  33. package/dist/plugins/grideditor.ckeditor.min.js +1 -2
  34. package/dist/plugins/grideditor.ckeditor.min.js.map +7 -1
  35. package/dist/plugins/grideditor.clipboard.esm.js +326 -0
  36. package/dist/plugins/grideditor.clipboard.js +298 -235
  37. package/dist/plugins/grideditor.clipboard.min.js +1 -2
  38. package/dist/plugins/grideditor.clipboard.min.js.map +7 -1
  39. package/dist/plugins/grideditor.codemirror-inline.esm.js +205 -0
  40. package/dist/plugins/grideditor.codemirror-inline.js +188 -168
  41. package/dist/plugins/grideditor.codemirror-inline.min.js +1 -2
  42. package/dist/plugins/grideditor.codemirror-inline.min.js.map +7 -1
  43. package/dist/plugins/grideditor.codemirror.esm.js +63 -0
  44. package/dist/plugins/grideditor.codemirror.js +60 -71
  45. package/dist/plugins/grideditor.codemirror.min.js +1 -2
  46. package/dist/plugins/grideditor.codemirror.min.js.map +7 -1
  47. package/dist/plugins/grideditor.elements.esm.js +271 -0
  48. package/dist/plugins/grideditor.elements.js +256 -149
  49. package/dist/plugins/grideditor.elements.min.js +1 -2
  50. package/dist/plugins/grideditor.elements.min.js.map +7 -1
  51. package/dist/plugins/grideditor.float.esm.js +34 -0
  52. package/dist/plugins/grideditor.float.js +37 -52
  53. package/dist/plugins/grideditor.float.min.js +1 -2
  54. package/dist/plugins/grideditor.float.min.js.map +7 -1
  55. package/dist/plugins/grideditor.gutters.esm.js +143 -0
  56. package/dist/plugins/grideditor.gutters.js +134 -131
  57. package/dist/plugins/grideditor.gutters.min.js +1 -2
  58. package/dist/plugins/grideditor.gutters.min.js.map +7 -1
  59. package/dist/plugins/grideditor.order.esm.js +189 -0
  60. package/dist/plugins/grideditor.order.js +170 -182
  61. package/dist/plugins/grideditor.order.min.js +1 -2
  62. package/dist/plugins/grideditor.order.min.js.map +7 -1
  63. package/dist/plugins/grideditor.popup.esm.js +187 -0
  64. package/dist/plugins/grideditor.popup.js +183 -134
  65. package/dist/plugins/grideditor.popup.min.js +1 -2
  66. package/dist/plugins/grideditor.popup.min.js.map +7 -1
  67. package/dist/plugins/grideditor.sections.esm.js +271 -0
  68. package/dist/plugins/grideditor.sections.js +250 -173
  69. package/dist/plugins/grideditor.sections.min.js +1 -2
  70. package/dist/plugins/grideditor.sections.min.js.map +7 -1
  71. package/dist/plugins/grideditor.spacing.esm.js +318 -0
  72. package/dist/plugins/grideditor.spacing.js +296 -272
  73. package/dist/plugins/grideditor.spacing.min.js +1 -2
  74. package/dist/plugins/grideditor.spacing.min.js.map +7 -1
  75. package/dist/plugins/grideditor.summernote.esm.js +509 -0
  76. package/dist/plugins/grideditor.summernote.js +491 -471
  77. package/dist/plugins/grideditor.summernote.min.js +1 -2
  78. package/dist/plugins/grideditor.summernote.min.js.map +7 -1
  79. package/dist/plugins/grideditor.tabs.esm.js +237 -0
  80. package/dist/plugins/grideditor.tabs.js +233 -139
  81. package/dist/plugins/grideditor.tabs.min.js +1 -2
  82. package/dist/plugins/grideditor.tabs.min.js.map +7 -1
  83. package/dist/plugins/grideditor.textalign.esm.js +40 -0
  84. package/dist/plugins/grideditor.textalign.js +43 -56
  85. package/dist/plugins/grideditor.textalign.min.js +1 -2
  86. package/dist/plugins/grideditor.textalign.min.js.map +7 -1
  87. package/dist/plugins/grideditor.tinymce.esm.js +519 -0
  88. package/dist/plugins/grideditor.tinymce.js +500 -534
  89. package/dist/plugins/grideditor.tinymce.min.js +1 -2
  90. package/dist/plugins/grideditor.tinymce.min.js.map +7 -1
  91. package/dist/plugins/grideditor.visibility.esm.js +158 -0
  92. package/dist/plugins/grideditor.visibility.js +140 -149
  93. package/dist/plugins/grideditor.visibility.min.js +1 -2
  94. package/dist/plugins/grideditor.visibility.min.js.map +7 -1
  95. package/docs/events.md +47 -21
  96. package/docs/locale-keys.md +7 -4
  97. package/docs/plugins.md +49 -27
  98. package/example/adapter.html +112 -0
  99. package/example/attributes.html +85 -61
  100. package/example/autocols.html +9 -9
  101. package/example/autosave.html +13 -14
  102. package/example/basic.html +4 -5
  103. package/example/breakpoints.html +5 -6
  104. package/example/ckeditor.html +4 -5
  105. package/example/clipboard.html +11 -10
  106. package/example/codemirror.html +9 -7
  107. package/example/containers.html +7 -8
  108. package/example/custom_editor.html +53 -34
  109. package/example/elements.html +10 -11
  110. package/example/index.html +16 -2
  111. package/example/locale.html +6 -7
  112. package/example/plugins.html +44 -29
  113. package/example/summernote.html +6 -5
  114. package/example/utilities.html +17 -13
  115. package/example/wrap_content.html +9 -9
  116. package/package.json +43 -12
  117. package/src/js/dom.js +401 -0
  118. package/src/js/grideditor.classic.js +16 -0
  119. package/src/js/grideditor.jquery.js +325 -0
  120. package/src/js/{jquery.grideditor.js → grideditor.js} +1284 -1124
  121. package/src/js/locales/grideditor.es.js +163 -158
  122. package/src/js/plugins/grideditor.accordion.js +97 -77
  123. package/src/js/plugins/grideditor.alignment.js +5 -7
  124. package/src/js/plugins/grideditor.card.js +23 -23
  125. package/src/js/plugins/grideditor.ckeditor.js +107 -106
  126. package/src/js/plugins/grideditor.clipboard.js +49 -37
  127. package/src/js/plugins/grideditor.codemirror-inline.js +50 -37
  128. package/src/js/plugins/grideditor.codemirror.js +9 -10
  129. package/src/js/plugins/grideditor.elements.js +57 -33
  130. package/src/js/plugins/grideditor.float.js +4 -6
  131. package/src/js/plugins/grideditor.gutters.js +20 -15
  132. package/src/js/plugins/grideditor.order.js +28 -25
  133. package/src/js/plugins/grideditor.popup.js +63 -51
  134. package/src/js/plugins/grideditor.sections.js +39 -32
  135. package/src/js/plugins/grideditor.spacing.js +42 -45
  136. package/src/js/plugins/grideditor.summernote.js +112 -76
  137. package/src/js/plugins/grideditor.tabs.js +65 -57
  138. package/src/js/plugins/grideditor.textalign.js +4 -6
  139. package/src/js/plugins/grideditor.tinymce.js +147 -139
  140. package/src/js/plugins/grideditor.visibility.js +24 -25
  141. package/src/js/register.js +18 -0
  142. package/src/js/text/grideditor.text.js +81 -106
  143. package/types/grideditor.d.ts +335 -0
  144. package/dist/jquery.grideditor.bundle.min.js +0 -10
  145. package/dist/jquery.grideditor.js +0 -4927
  146. package/dist/jquery.grideditor.min.js +0 -2
  147. package/dist/jquery.grideditor.min.js.map +0 -1
@@ -0,0 +1,55 @@
1
+ // src/js/plugins/grideditor.alignment.js
2
+ import { GridEditor } from "../grideditor.esm.js";
3
+ Object.assign(GridEditor.locales.en, {
4
+ "utility.justify_content": "Justify columns",
5
+ "utility.align_items": "Align columns",
6
+ "utility.align_self": "Align self"
7
+ });
8
+ var FLEX = {
9
+ start: "flex-start",
10
+ end: "flex-end",
11
+ center: "center",
12
+ between: "space-between",
13
+ around: "space-around",
14
+ evenly: "space-evenly",
15
+ baseline: "baseline",
16
+ stretch: "stretch",
17
+ auto: "auto"
18
+ };
19
+ function family(definition) {
20
+ return Object.assign({
21
+ prefix: definition.name,
22
+ preview: function(value) {
23
+ var styles = {};
24
+ styles[definition.name] = value === null ? definition.none : FLEX[value];
25
+ return styles;
26
+ }
27
+ }, definition);
28
+ }
29
+ GridEditor.utilities.alignment = function() {
30
+ return {
31
+ families: [
32
+ family({
33
+ name: "justify-content",
34
+ labelKey: "utility.justify_content",
35
+ values: ["start", "center", "end", "between", "around", "evenly"],
36
+ appliesTo: ["row"],
37
+ none: "normal"
38
+ }),
39
+ family({
40
+ name: "align-items",
41
+ labelKey: "utility.align_items",
42
+ values: ["start", "center", "end", "baseline", "stretch"],
43
+ appliesTo: ["row"],
44
+ none: "normal"
45
+ }),
46
+ family({
47
+ name: "align-self",
48
+ labelKey: "utility.align_self",
49
+ values: ["auto", "start", "center", "end", "baseline", "stretch"],
50
+ appliesTo: ["column"],
51
+ none: "auto"
52
+ })
53
+ ]
54
+ };
55
+ };
@@ -1,81 +1,62 @@
1
- /**
2
- * Alignment for grid-editor.
3
- *
4
- * A utility plugin: load this file after the editor and a row's columns can be
5
- * justified and aligned per breakpoint, and a column can align itself, with
6
- * Bootstrap's justify-content-{breakpoint}-*, align-items-{breakpoint}-* and
7
- * align-self-{breakpoint}-* classes. What it can ask the editor for is the
8
- * handle its factory is called with, described in docs/plugins.md.
9
- *
10
- * <script src="dist/jquery.grideditor.min.js"></script>
11
- * <script src="dist/plugins/grideditor.alignment.min.js"></script>
12
- *
13
- * Fields only, in the settings panels: alignment is set now and then, not
14
- * clicked through, and a drawer is short of room.
15
- */
16
- (function($) {
1
+ (() => {
2
+ // src/js/register.js
3
+ var GridEditor = window.GridEditor;
4
+ if (!GridEditor || typeof GridEditor.get !== "function") {
5
+ throw new Error("grid-editor: load grideditor.js (or grideditor.bundle.min.js) before its plugins, its locales and grideditor.jquery.js");
6
+ }
17
7
 
18
- $.extend($.fn.gridEditor.locales.en, {
19
- 'utility.justify_content': 'Justify columns',
20
- 'utility.align_items': 'Align columns',
21
- 'utility.align_self': 'Align self',
22
- });
23
-
24
- /** What Bootstrap's value names come to in css. */
25
- var FLEX = {
26
- start: 'flex-start',
27
- end: 'flex-end',
28
- center: 'center',
29
- between: 'space-between',
30
- around: 'space-around',
31
- evenly: 'space-evenly',
32
- baseline: 'baseline',
33
- stretch: 'stretch',
34
- auto: 'auto',
35
- };
36
-
37
- /**
38
- * A family whose preview is its one css property. `none` is what the
39
- * property is when no class says anything, which a view has to show over a
40
- * wider breakpoint's class that is live in a wide window.
41
- */
42
- function family(definition) {
43
- return $.extend({
44
- prefix: definition.name,
45
- preview: function(value) {
46
- var styles = {};
47
- styles[definition.name] = value === null ? definition.none : FLEX[value];
48
- return styles;
49
- },
8
+ // src/js/plugins/grideditor.alignment.js
9
+ Object.assign(GridEditor.locales.en, {
10
+ "utility.justify_content": "Justify columns",
11
+ "utility.align_items": "Align columns",
12
+ "utility.align_self": "Align self"
13
+ });
14
+ var FLEX = {
15
+ start: "flex-start",
16
+ end: "flex-end",
17
+ center: "center",
18
+ between: "space-between",
19
+ around: "space-around",
20
+ evenly: "space-evenly",
21
+ baseline: "baseline",
22
+ stretch: "stretch",
23
+ auto: "auto"
24
+ };
25
+ function family(definition) {
26
+ return Object.assign({
27
+ prefix: definition.name,
28
+ preview: function(value) {
29
+ var styles = {};
30
+ styles[definition.name] = value === null ? definition.none : FLEX[value];
31
+ return styles;
32
+ }
50
33
  }, definition);
51
- }
52
-
53
- $.fn.gridEditor.utilities.alignment = function() {
34
+ }
35
+ GridEditor.utilities.alignment = function() {
54
36
  return {
55
- families: [
56
- family({
57
- name: 'justify-content',
58
- labelKey: 'utility.justify_content',
59
- values: ['start', 'center', 'end', 'between', 'around', 'evenly'],
60
- appliesTo: ['row'],
61
- none: 'normal',
62
- }),
63
- family({
64
- name: 'align-items',
65
- labelKey: 'utility.align_items',
66
- values: ['start', 'center', 'end', 'baseline', 'stretch'],
67
- appliesTo: ['row'],
68
- none: 'normal',
69
- }),
70
- family({
71
- name: 'align-self',
72
- labelKey: 'utility.align_self',
73
- values: ['auto', 'start', 'center', 'end', 'baseline', 'stretch'],
74
- appliesTo: ['column'],
75
- none: 'auto',
76
- }),
77
- ],
37
+ families: [
38
+ family({
39
+ name: "justify-content",
40
+ labelKey: "utility.justify_content",
41
+ values: ["start", "center", "end", "between", "around", "evenly"],
42
+ appliesTo: ["row"],
43
+ none: "normal"
44
+ }),
45
+ family({
46
+ name: "align-items",
47
+ labelKey: "utility.align_items",
48
+ values: ["start", "center", "end", "baseline", "stretch"],
49
+ appliesTo: ["row"],
50
+ none: "normal"
51
+ }),
52
+ family({
53
+ name: "align-self",
54
+ labelKey: "utility.align_self",
55
+ values: ["auto", "start", "center", "end", "baseline", "stretch"],
56
+ appliesTo: ["column"],
57
+ none: "auto"
58
+ })
59
+ ]
78
60
  };
79
- };
80
-
81
- })(jQuery);
61
+ };
62
+ })();
@@ -1,2 +1 @@
1
- (e=>{e.extend(e.fn.gridEditor.locales.en,{"utility.justify_content":"Justify columns","utility.align_items":"Align columns","utility.align_self":"Align self"});var l={start:"flex-start",end:"flex-end",center:"center",between:"space-between",around:"space-around",evenly:"space-evenly",baseline:"baseline",stretch:"stretch",auto:"auto"};function n(t){return e.extend({prefix:t.name,preview:function(e){var n={};return n[t.name]=null===e?t.none:l[e],n}},t)}e.fn.gridEditor.utilities.alignment=function(){return{families:[n({name:"justify-content",labelKey:"utility.justify_content",values:["start","center","end","between","around","evenly"],appliesTo:["row"],none:"normal"}),n({name:"align-items",labelKey:"utility.align_items",values:["start","center","end","baseline","stretch"],appliesTo:["row"],none:"normal"}),n({name:"align-self",labelKey:"utility.align_self",values:["auto","start","center","end","baseline","stretch"],appliesTo:["column"],none:"auto"})]}}})(jQuery);
2
- //# sourceMappingURL=grideditor.alignment.min.js.map
1
+ (()=>{var e=window.GridEditor;if(!e||typeof e.get!="function")throw new Error("grid-editor: load grideditor.js (or grideditor.bundle.min.js) before its plugins, its locales and grideditor.jquery.js");Object.assign(e.locales.en,{"utility.justify_content":"Justify columns","utility.align_items":"Align columns","utility.align_self":"Align self"});var r={start:"flex-start",end:"flex-end",center:"center",between:"space-between",around:"space-around",evenly:"space-evenly",baseline:"baseline",stretch:"stretch",auto:"auto"};function n(t){return Object.assign({prefix:t.name,preview:function(i){var l={};return l[t.name]=i===null?t.none:r[i],l}},t)}e.utilities.alignment=function(){return{families:[n({name:"justify-content",labelKey:"utility.justify_content",values:["start","center","end","between","around","evenly"],appliesTo:["row"],none:"normal"}),n({name:"align-items",labelKey:"utility.align_items",values:["start","center","end","baseline","stretch"],appliesTo:["row"],none:"normal"}),n({name:"align-self",labelKey:"utility.align_self",values:["auto","start","center","end","baseline","stretch"],appliesTo:["column"],none:"auto"})]}};})();
@@ -1 +1,7 @@
1
- {"version":3,"file":"grideditor.alignment.min.js","sources":["../../src/js/plugins/grideditor.alignment.js"],"names":["$","extend","fn","gridEditor","locales","en","utility.justify_content","utility.align_items","utility.align_self","FLEX","start","end","center","between","around","evenly","baseline","stretch","auto","family","definition","prefix","name","preview","value","styles","none","utilities","alignment","families","labelKey","values","appliesTo","jQuery"],"mappings":"CAeUA,IAEVA,EAAEC,OAAOD,EAAEE,GAAGC,WAAWC,QAAQC,GAAI,CACjCC,0BAA2B,kBAC3BC,sBAAuB,gBACvBC,qBAAsB,YAC1B,CAAC,EAGD,IAAIC,EAAO,CACPC,MAAO,aACPC,IAAK,WACLC,OAAQ,SACRC,QAAS,gBACTC,OAAQ,eACRC,OAAQ,eACRC,SAAU,WACVC,QAAS,UACTC,KAAM,MACV,EAOA,SAASC,EAAOC,GACZ,OAAOpB,EAAEC,OAAO,CACZoB,OAAQD,EAAWE,KACnBC,QAAS,SAASC,GACd,IAAIC,EAAS,GAEb,OADAA,EAAOL,EAAWE,MAAkB,OAAVE,EAAiBJ,EAAWM,KAAOjB,EAAKe,GAC3DC,CACX,CACJ,EAAGL,CAAU,CACjB,CAEApB,EAAEE,GAAGC,WAAWwB,UAAUC,UAAY,WAClC,MAAO,CACHC,SAAU,CACNV,EAAO,CACHG,KAAM,kBACNQ,SAAU,0BACVC,OAAQ,CAAC,QAAS,SAAU,MAAO,UAAW,SAAU,UACxDC,UAAW,CAAC,OACZN,KAAM,QACV,CAAC,EACDP,EAAO,CACHG,KAAM,cACNQ,SAAU,sBACVC,OAAQ,CAAC,QAAS,SAAU,MAAO,WAAY,WAC/CC,UAAW,CAAC,OACZN,KAAM,QACV,CAAC,EACDP,EAAO,CACHG,KAAM,aACNQ,SAAU,qBACVC,OAAQ,CAAC,OAAQ,QAAS,SAAU,MAAO,WAAY,WACvDC,UAAW,CAAC,UACZN,KAAM,MACV,CAAC,EAET,CACJ,CAEC,GAAEO,MAAM"}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/js/register.js", "../../src/js/plugins/grideditor.alignment.js"],
4
+ "sourcesContent": ["/**\n * What a plugin's or a locale's classic script imports in place of the\n * editor: the GridEditor the page already loaded.\n *\n * The build points `import { GridEditor } from '../grideditor.js'` here for\n * the classic scripts, so each registers on the editor the page has rather\n * than bringing its own. Loaded before the editor there is nothing to\n * register on, and saying so is better than a TypeError three calls later.\n */\nvar GridEditor = window.GridEditor;\n\nif (!GridEditor || typeof GridEditor.get !== 'function') {\n throw new Error('grid-editor: load grideditor.js (or grideditor.bundle.min.js) before its plugins, ' +\n 'its locales and grideditor.jquery.js');\n}\n\nexport { GridEditor };\nexport default GridEditor;\n", "/**\n * Alignment for grid-editor.\n *\n * A utility plugin: load this file after the editor and a row's columns can be\n * justified and aligned per breakpoint, and a column can align itself, with\n * Bootstrap's justify-content-{breakpoint}-*, align-items-{breakpoint}-* and\n * align-self-{breakpoint}-* classes. What it can ask the editor for is the\n * handle its factory is called with, described in docs/plugins.md.\n *\n * <script src=\"dist/grideditor.min.js\"></script>\n * <script src=\"dist/plugins/grideditor.alignment.min.js\"></script>\n *\n * Fields only, in the settings panels: alignment is set now and then, not\n * clicked through, and a drawer is short of room.\n */\nimport { GridEditor } from '../grideditor.js';\n\nObject.assign(GridEditor.locales.en, {\n 'utility.justify_content': 'Justify columns',\n 'utility.align_items': 'Align columns',\n 'utility.align_self': 'Align self',\n});\n\n/** What Bootstrap's value names come to in css. */\nvar FLEX = {\n start: 'flex-start',\n end: 'flex-end',\n center: 'center',\n between: 'space-between',\n around: 'space-around',\n evenly: 'space-evenly',\n baseline: 'baseline',\n stretch: 'stretch',\n auto: 'auto',\n};\n\n/**\n * A family whose preview is its one css property. `none` is what the\n * property is when no class says anything, which a view has to show over a\n * wider breakpoint's class that is live in a wide window.\n */\nfunction family(definition) {\n return Object.assign({\n prefix: definition.name,\n preview: function(value) {\n var styles = {};\n styles[definition.name] = value === null ? definition.none : FLEX[value];\n return styles;\n },\n }, definition);\n}\n\nGridEditor.utilities.alignment = function() {\n return {\n families: [\n family({\n name: 'justify-content',\n labelKey: 'utility.justify_content',\n values: ['start', 'center', 'end', 'between', 'around', 'evenly'],\n appliesTo: ['row'],\n none: 'normal',\n }),\n family({\n name: 'align-items',\n labelKey: 'utility.align_items',\n values: ['start', 'center', 'end', 'baseline', 'stretch'],\n appliesTo: ['row'],\n none: 'normal',\n }),\n family({\n name: 'align-self',\n labelKey: 'utility.align_self',\n values: ['auto', 'start', 'center', 'end', 'baseline', 'stretch'],\n appliesTo: ['column'],\n none: 'auto',\n }),\n ],\n };\n};\n"],
5
+ "mappings": "MASA,IAAIA,EAAa,OAAO,WAExB,GAAI,CAACA,GAAc,OAAOA,EAAW,KAAQ,WACzC,MAAM,IAAI,MAAM,wHAC0B,ECI9C,OAAO,OAAOC,EAAW,QAAQ,GAAI,CACjC,0BAA2B,kBAC3B,sBAAuB,gBACvB,qBAAsB,YAC1B,CAAC,EAGD,IAAIC,EAAO,CACP,MAAO,aACP,IAAK,WACL,OAAQ,SACR,QAAS,gBACT,OAAQ,eACR,OAAQ,eACR,SAAU,WACV,QAAS,UACT,KAAM,MACV,EAOA,SAASC,EAAOC,EAAY,CACxB,OAAO,OAAO,OAAO,CACjB,OAAQA,EAAW,KACnB,QAAS,SAASC,EAAO,CACrB,IAAIC,EAAS,CAAC,EACd,OAAAA,EAAOF,EAAW,IAAI,EAAIC,IAAU,KAAOD,EAAW,KAAOF,EAAKG,CAAK,EAChEC,CACX,CACJ,EAAGF,CAAU,CACjB,CAEAH,EAAW,UAAU,UAAY,UAAW,CACxC,MAAO,CACH,SAAU,CACNE,EAAO,CACH,KAAM,kBACN,SAAU,0BACV,OAAQ,CAAC,QAAS,SAAU,MAAO,UAAW,SAAU,QAAQ,EAChE,UAAW,CAAC,KAAK,EACjB,KAAM,QACV,CAAC,EACDA,EAAO,CACH,KAAM,cACN,SAAU,sBACV,OAAQ,CAAC,QAAS,SAAU,MAAO,WAAY,SAAS,EACxD,UAAW,CAAC,KAAK,EACjB,KAAM,QACV,CAAC,EACDA,EAAO,CACH,KAAM,aACN,SAAU,qBACV,OAAQ,CAAC,OAAQ,QAAS,SAAU,MAAO,WAAY,SAAS,EAChE,UAAW,CAAC,QAAQ,EACpB,KAAM,MACV,CAAC,CACL,CACJ,CACJ",
6
+ "names": ["GridEditor", "GridEditor", "FLEX", "family", "definition", "value", "styles"]
7
+ }
@@ -0,0 +1,73 @@
1
+ // src/js/plugins/grideditor.card.js
2
+ import { GridEditor } from "../grideditor.esm.js";
3
+
4
+ // src/js/dom.js
5
+ function one(root, selector) {
6
+ return root ? root.querySelector(selector) : null;
7
+ }
8
+ function element(tag, attributes, text) {
9
+ var node = document.createElement(tag);
10
+ Object.keys(attributes || {}).forEach(function(name) {
11
+ var value = attributes[name];
12
+ if (value !== null && value !== void 0 && value !== false) {
13
+ node.setAttribute(name, value);
14
+ }
15
+ });
16
+ if (text !== void 0 && text !== null) {
17
+ node.textContent = text;
18
+ }
19
+ return node;
20
+ }
21
+
22
+ // src/js/plugins/grideditor.card.js
23
+ Object.assign(GridEditor.locales.en, {
24
+ "container.add_card": "Card",
25
+ "container.card_title": "Card title",
26
+ "container.card_footer": "Card footer"
27
+ });
28
+ GridEditor.containers.card = function(ge) {
29
+ function editable(part) {
30
+ if (part) {
31
+ ge.makeLabelEditable(ge.labelIn(part));
32
+ }
33
+ }
34
+ return {
35
+ labelKey: "container.add_card",
36
+ /**
37
+ * A card is a header, a body and an optional footer. `header: false`
38
+ * leaves the title out, `footer: true` or a string adds one; both are
39
+ * plain text the editor makes editable, not regions, so a card holds
40
+ * exactly one region and nests like any other container.
41
+ */
42
+ create: function(options) {
43
+ var card = element("div", { "class": "card" });
44
+ if (options.header !== false) {
45
+ var header = card.appendChild(element("div", { "class": "card-header" }));
46
+ header.appendChild(element(
47
+ "span",
48
+ { "class": "ge-pane-label" },
49
+ options.title || ge.t("container.card_title")
50
+ ));
51
+ }
52
+ card.appendChild(element("div", { "class": "card-body" })).appendChild(ge.defaultRegion());
53
+ if (options.footer) {
54
+ var footer = card.appendChild(element("div", { "class": "card-footer text-body-secondary" }));
55
+ footer.appendChild(element(
56
+ "span",
57
+ { "class": "ge-pane-label" },
58
+ typeof options.footer === "string" ? options.footer : ge.t("container.card_footer")
59
+ ));
60
+ }
61
+ var container = element("div", { "data-ge-container": "card" });
62
+ container.appendChild(card);
63
+ return container;
64
+ },
65
+ mark: function(container) {
66
+ editable(one(container, ":scope > .card > .card-header"));
67
+ editable(one(container, ":scope > .card > .card-footer"));
68
+ },
69
+ unmark: function(container) {
70
+ ge.unwrapLabels(container);
71
+ }
72
+ };
73
+ };
@@ -1,68 +1,78 @@
1
- /**
2
- * Cards for grid-editor.
3
- *
4
- * A container plugin: load this file after the editor and the toolbar offers
5
- * a card, a bootstrap card whose body is an editable region. What it can ask
6
- * the editor for is the handle its factory is called with, described in
7
- * docs/plugins.md.
8
- *
9
- * <script src="dist/jquery.grideditor.min.js"></script>
10
- * <script src="dist/plugins/grideditor.card.min.js"></script>
11
- */
12
- (function($) {
1
+ (() => {
2
+ // src/js/register.js
3
+ var GridEditor = window.GridEditor;
4
+ if (!GridEditor || typeof GridEditor.get !== "function") {
5
+ throw new Error("grid-editor: load grideditor.js (or grideditor.bundle.min.js) before its plugins, its locales and grideditor.jquery.js");
6
+ }
13
7
 
14
- $.extend($.fn.gridEditor.locales.en, {
15
- 'container.add_card': 'Card',
16
- 'container.card_title': 'Card title',
17
- 'container.card_footer': 'Card footer',
18
- });
19
-
20
- $.fn.gridEditor.containers.card = function(ge) {
8
+ // src/js/dom.js
9
+ function one(root, selector) {
10
+ return root ? root.querySelector(selector) : null;
11
+ }
12
+ function element(tag, attributes, text) {
13
+ var node = document.createElement(tag);
14
+ Object.keys(attributes || {}).forEach(function(name) {
15
+ var value = attributes[name];
16
+ if (value !== null && value !== void 0 && value !== false) {
17
+ node.setAttribute(name, value);
18
+ }
19
+ });
20
+ if (text !== void 0 && text !== null) {
21
+ node.textContent = text;
22
+ }
23
+ return node;
24
+ }
21
25
 
26
+ // src/js/plugins/grideditor.card.js
27
+ Object.assign(GridEditor.locales.en, {
28
+ "container.add_card": "Card",
29
+ "container.card_title": "Card title",
30
+ "container.card_footer": "Card footer"
31
+ });
32
+ GridEditor.containers.card = function(ge) {
33
+ function editable(part) {
34
+ if (part) {
35
+ ge.makeLabelEditable(ge.labelIn(part));
36
+ }
37
+ }
22
38
  return {
23
- labelKey: 'container.add_card',
24
-
25
- /**
26
- * A card is a header, a body and an optional footer. `header: false`
27
- * leaves the title out, `footer: true` or a string adds one; both are
28
- * plain text the editor makes editable, not regions, so a card holds
29
- * exactly one region and nests like any other container.
30
- */
31
- create: function(options) {
32
- var card = $('<div class="card" />');
33
-
34
- if (options.header !== false) {
35
- $('<div class="card-header" />')
36
- .append($('<span class="ge-pane-label" />')
37
- .text(options.title || ge.t('container.card_title')))
38
- .appendTo(card)
39
- ;
40
- }
41
-
42
- $('<div class="card-body" />').append(ge.defaultRegion()).appendTo(card);
43
-
44
- if (options.footer) {
45
- $('<div class="card-footer text-body-secondary" />')
46
- .append($('<span class="ge-pane-label" />')
47
- .text(typeof options.footer === 'string'
48
- ? options.footer
49
- : ge.t('container.card_footer')))
50
- .appendTo(card)
51
- ;
52
- }
53
-
54
- return $('<div />').attr('data-ge-container', 'card').append(card);
55
- },
56
-
57
- mark: function(container) {
58
- ge.makeLabelEditable(ge.labelIn(container.find('> .card > .card-header')));
59
- ge.makeLabelEditable(ge.labelIn(container.find('> .card > .card-footer')));
60
- },
61
-
62
- unmark: function(container) {
63
- ge.unwrapLabels(container);
64
- },
39
+ labelKey: "container.add_card",
40
+ /**
41
+ * A card is a header, a body and an optional footer. `header: false`
42
+ * leaves the title out, `footer: true` or a string adds one; both are
43
+ * plain text the editor makes editable, not regions, so a card holds
44
+ * exactly one region and nests like any other container.
45
+ */
46
+ create: function(options) {
47
+ var card = element("div", { "class": "card" });
48
+ if (options.header !== false) {
49
+ var header = card.appendChild(element("div", { "class": "card-header" }));
50
+ header.appendChild(element(
51
+ "span",
52
+ { "class": "ge-pane-label" },
53
+ options.title || ge.t("container.card_title")
54
+ ));
55
+ }
56
+ card.appendChild(element("div", { "class": "card-body" })).appendChild(ge.defaultRegion());
57
+ if (options.footer) {
58
+ var footer = card.appendChild(element("div", { "class": "card-footer text-body-secondary" }));
59
+ footer.appendChild(element(
60
+ "span",
61
+ { "class": "ge-pane-label" },
62
+ typeof options.footer === "string" ? options.footer : ge.t("container.card_footer")
63
+ ));
64
+ }
65
+ var container = element("div", { "data-ge-container": "card" });
66
+ container.appendChild(card);
67
+ return container;
68
+ },
69
+ mark: function(container) {
70
+ editable(one(container, ":scope > .card > .card-header"));
71
+ editable(one(container, ":scope > .card > .card-footer"));
72
+ },
73
+ unmark: function(container) {
74
+ ge.unwrapLabels(container);
75
+ }
65
76
  };
66
- };
67
-
68
- })(jQuery);
77
+ };
78
+ })();
@@ -1,2 +1 @@
1
- (d=>{d.extend(d.fn.gridEditor.locales.en,{"container.add_card":"Card","container.card_title":"Card title","container.card_footer":"Card footer"}),d.fn.gridEditor.containers.card=function(r){return{labelKey:"container.add_card",create:function(a){var e=d('<div class="card" />');return!1!==a.header&&d('<div class="card-header" />').append(d('<span class="ge-pane-label" />').text(a.title||r.t("container.card_title"))).appendTo(e),d('<div class="card-body" />').append(r.defaultRegion()).appendTo(e),a.footer&&d('<div class="card-footer text-body-secondary" />').append(d('<span class="ge-pane-label" />').text("string"==typeof a.footer?a.footer:r.t("container.card_footer"))).appendTo(e),d("<div />").attr("data-ge-container","card").append(e)},mark:function(a){r.makeLabelEditable(r.labelIn(a.find("> .card > .card-header"))),r.makeLabelEditable(r.labelIn(a.find("> .card > .card-footer")))},unmark:function(a){r.unwrapLabels(a)}}}})(jQuery);
2
- //# sourceMappingURL=grideditor.card.min.js.map
1
+ (()=>{var a=window.GridEditor;if(!a||typeof a.get!="function")throw new Error("grid-editor: load grideditor.js (or grideditor.bundle.min.js) before its plugins, its locales and grideditor.jquery.js");function l(t,i){return t?t.querySelector(i):null}function r(t,i,e){var n=document.createElement(t);return Object.keys(i||{}).forEach(function(u){var o=i[u];o!=null&&o!==!1&&n.setAttribute(u,o)}),e!=null&&(n.textContent=e),n}Object.assign(a.locales.en,{"container.add_card":"Card","container.card_title":"Card title","container.card_footer":"Card footer"});a.containers.card=function(t){function i(e){e&&t.makeLabelEditable(t.labelIn(e))}return{labelKey:"container.add_card",create:function(e){var n=r("div",{class:"card"});if(e.header!==!1){var u=n.appendChild(r("div",{class:"card-header"}));u.appendChild(r("span",{class:"ge-pane-label"},e.title||t.t("container.card_title")))}if(n.appendChild(r("div",{class:"card-body"})).appendChild(t.defaultRegion()),e.footer){var o=n.appendChild(r("div",{class:"card-footer text-body-secondary"}));o.appendChild(r("span",{class:"ge-pane-label"},typeof e.footer=="string"?e.footer:t.t("container.card_footer")))}var f=r("div",{"data-ge-container":"card"});return f.appendChild(n),f},mark:function(e){i(l(e,":scope > .card > .card-header")),i(l(e,":scope > .card > .card-footer"))},unmark:function(e){t.unwrapLabels(e)}}};})();
@@ -1 +1,7 @@
1
- {"version":3,"file":"grideditor.card.min.js","sources":["../../src/js/plugins/grideditor.card.js"],"names":["$","extend","fn","gridEditor","locales","en","container.add_card","container.card_title","container.card_footer","containers","card","ge","labelKey","create","options","header","append","text","title","t","appendTo","defaultRegion","footer","attr","mark","container","makeLabelEditable","labelIn","find","unmark","unwrapLabels","jQuery"],"mappings":"CAWUA,IAEVA,EAAEC,OAAOD,EAAEE,GAAGC,WAAWC,QAAQC,GAAI,CACjCC,qBAAsB,OACtBC,uBAAwB,aACxBC,wBAAyB,aAC7B,CAAC,EAEDR,EAAEE,GAAGC,WAAWM,WAAWC,KAAO,SAASC,GAEvC,MAAO,CACHC,SAAU,qBAQVC,OAAQ,SAASC,GACb,IAAIJ,EAAOV,EAAE,sBAAsB,EAsBnC,MApBuB,CAAA,IAAnBc,EAAQC,QACRf,EAAE,6BAA6B,EAC1BgB,OAAOhB,EAAE,gCAAgC,EACrCiB,KAAKH,EAAQI,OAASP,EAAGQ,EAAE,sBAAsB,CAAC,CAAC,EACvDC,SAASV,CAAI,EAItBV,EAAE,2BAA2B,EAAEgB,OAAOL,EAAGU,cAAc,CAAC,EAAED,SAASV,CAAI,EAEnEI,EAAQQ,QACRtB,EAAE,iDAAiD,EAC9CgB,OAAOhB,EAAE,gCAAgC,EACrCiB,KAA+B,UAA1B,OAAOH,EAAQQ,OACfR,EAAQQ,OACRX,EAAGQ,EAAE,uBAAuB,CAAC,CAAC,EACvCC,SAASV,CAAI,EAIfV,EAAE,SAAS,EAAEuB,KAAK,oBAAqB,MAAM,EAAEP,OAAON,CAAI,CACrE,EAEAc,KAAM,SAASC,GACXd,EAAGe,kBAAkBf,EAAGgB,QAAQF,EAAUG,KAAK,wBAAwB,CAAC,CAAC,EACzEjB,EAAGe,kBAAkBf,EAAGgB,QAAQF,EAAUG,KAAK,wBAAwB,CAAC,CAAC,CAC7E,EAEAC,OAAQ,SAASJ,GACbd,EAAGmB,aAAaL,CAAS,CAC7B,CACJ,CACJ,CAEC,GAAEM,MAAM"}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/js/register.js", "../../src/js/dom.js", "../../src/js/plugins/grideditor.card.js"],
4
+ "sourcesContent": ["/**\n * What a plugin's or a locale's classic script imports in place of the\n * editor: the GridEditor the page already loaded.\n *\n * The build points `import { GridEditor } from '../grideditor.js'` here for\n * the classic scripts, so each registers on the editor the page has rather\n * than bringing its own. Loaded before the editor there is nothing to\n * register on, and saying so is better than a TypeError three calls later.\n */\nvar GridEditor = window.GridEditor;\n\nif (!GridEditor || typeof GridEditor.get !== 'function') {\n throw new Error('grid-editor: load grideditor.js (or grideditor.bundle.min.js) before its plugins, ' +\n 'its locales and grideditor.jquery.js');\n}\n\nexport { GridEditor };\nexport default GridEditor;\n", "/**\n * The DOM, the way grid-editor uses it.\n *\n * Small helpers over the browser's own API, for the core and the shipped\n * plugins. Not a public API: a plugin of a host's own is free to write its\n * DOM code however it likes, and this file makes no promise to it.\n *\n * Stateless on purpose. The build puts a copy of this file in each plugin's\n * classic script, so anything kept here would be kept once per copy; a\n * module that needs to remember something about a node keeps its own\n * WeakMap.\n */\n\n/** Every element under `root` matching `selector`, as an array. */\nexport function all(root, selector) {\n return root ? Array.prototype.slice.call(root.querySelectorAll(selector)) : [];\n}\n\n/** The first element under `root` matching `selector`, or null. */\nexport function one(root, selector) {\n return root ? root.querySelector(selector) : null;\n}\n\n/** `root` itself when it matches, then every element under it that does. */\nexport function selfAndAll(root, selector) {\n if (!root) { return []; }\n\n var found = all(root, selector);\n if (root.nodeType === 1 && root.matches(selector)) { found.unshift(root); }\n return found;\n}\n\n/** The element children of `node`, those matching `selector` if one is given. */\nexport function children(node, selector) {\n if (!node) { return []; }\n\n return Array.prototype.filter.call(node.children, function(each) {\n return !selector || each.matches(selector);\n });\n}\n\n/** The first element child matching `selector`, or null. */\nexport function child(node, selector) {\n return children(node, selector)[0] || null;\n}\n\n/** The nearest ancestor-or-self matching `selector` below `stopAt`, or null. */\nexport function closest(node, selector, stopAt) {\n var found = node && node.nodeType === 1 ? node.closest(selector) : null;\n\n if (found && stopAt && found !== stopAt && !stopAt.contains(found)) { return null; }\n return found;\n}\n\n/** Whether `node` is an element matching `selector`. */\nexport function is(node, selector) {\n return !!node && node.nodeType === 1 && node.matches(selector);\n}\n\n/** Whether `node` is in the document. */\nexport function attached(node) {\n return !!node && document.documentElement.contains(node);\n}\n\n/** The element siblings after `node` that match `selector`. */\nexport function nextAll(node, selector) {\n var found = [];\n\n for (var next = node.nextElementSibling; next; next = next.nextElementSibling) {\n if (!selector || next.matches(selector)) { found.push(next); }\n }\n return found;\n}\n\n/** The ancestors of `node` up to, and not including, `stop`, nearest first. */\nexport function parentsUntil(node, stop) {\n var found = [];\n\n for (var parent = node.parentElement; parent && parent !== stop; parent = parent.parentElement) {\n found.push(parent);\n }\n return found;\n}\n\n/**\n * The nodes the html parses into, detached. Parsed the way innerHTML parses,\n * so a <script> in it never runs, here or once it is in the page.\n */\nexport function parse(html) {\n var template = document.createElement('template');\n template.innerHTML = html;\n return Array.prototype.slice.call(template.content.childNodes);\n}\n\n/** The one element the html is, detached. */\nexport function create(html) {\n var nodes = parse(html.trim());\n\n for (var i = 0; i < nodes.length; i++) {\n if (nodes[i].nodeType === 1) { return nodes[i]; }\n }\n return null;\n}\n\n/** An element of `tag`, with `attributes` and `text`. */\nexport function element(tag, attributes, text) {\n var node = document.createElement(tag);\n\n Object.keys(attributes || {}).forEach(function(name) {\n var value = attributes[name];\n if (value !== null && value !== undefined && value !== false) { node.setAttribute(name, value); }\n });\n if (text !== undefined && text !== null) { node.textContent = text; }\n\n return node;\n}\n\n/** Replace what `node` holds with `html`. A <script> in it does not run. */\nexport function setHtml(node, html) {\n node.innerHTML = html === undefined || html === null ? '' : String(html);\n return node;\n}\n\n/** Add one or several space separated classes. */\nexport function addClass(node, names) {\n split(names).forEach(function(name) { node.classList.add(name); });\n return node;\n}\n\nexport function removeClass(node, names) {\n split(names).forEach(function(name) { node.classList.remove(name); });\n return node;\n}\n\n/** Each class on, or off, or flipped when `on` is not given. */\nexport function toggleClass(node, names, state) {\n split(names).forEach(function(name) {\n if (state === undefined) {\n node.classList.toggle(name);\n } else {\n node.classList.toggle(name, !!state);\n }\n });\n return node;\n}\n\nexport function hasClass(node, name) {\n return !!node && node.nodeType === 1 && node.classList.contains(name);\n}\n\nfunction split(names) {\n return String(names || '').split(/\\s+/).filter(Boolean);\n}\n\n/** Take the class attribute off when there is nothing left in it. */\nexport function dropEmptyClass(node) {\n if (!node.getAttribute('class')) { node.removeAttribute('class'); }\n return node;\n}\n\n/** Take the style attribute off when there is nothing left in it. */\nexport function dropEmptyStyle(node) {\n if (!node.getAttribute('style')) { node.removeAttribute('style'); }\n return node;\n}\n\n/** Set attributes; a null or undefined value takes the attribute off. */\nexport function attr(node, attributes) {\n Object.keys(attributes).forEach(function(name) {\n var value = attributes[name];\n\n if (value === null || value === undefined) {\n node.removeAttribute(name);\n } else {\n node.setAttribute(name, value);\n }\n });\n return node;\n}\n\n/**\n * Inline styles, by css property name. A number is pixels for the properties\n * that take a length, as jQuery had it; an empty string takes one off.\n */\nexport function css(node, styles) {\n Object.keys(styles).forEach(function(property) {\n var value = styles[property];\n\n if (typeof value === 'number' && !UNITLESS[property]) { value = value + 'px'; }\n node.style.setProperty(property, value === null || value === undefined ? '' : String(value));\n });\n return node;\n}\n\nvar UNITLESS = { opacity: true, 'z-index': true, 'flex-grow': true, 'flex-shrink': true, order: true };\n\n/** What an element of this tag shows as when nothing hides it. */\nvar defaultDisplays = {};\n\nfunction defaultDisplay(node) {\n var tag = node.nodeName;\n\n if (!defaultDisplays[tag]) {\n var probe = document.body.appendChild(document.createElement(tag));\n defaultDisplays[tag] = getComputedStyle(probe).display;\n probe.remove();\n if (defaultDisplays[tag] === 'none') { defaultDisplays[tag] = 'block'; }\n }\n return defaultDisplays[tag];\n}\n\n/** Show a node: its inline display:none off, and a display of its own if a stylesheet hides it. */\nexport function show(node) {\n node.style.removeProperty('display');\n if (getComputedStyle(node).display === 'none') { node.style.display = defaultDisplay(node); }\n return node;\n}\n\nexport function hide(node) {\n node.style.display = 'none';\n return node;\n}\n\n/** Show or hide; flip when `on` is not given. */\nexport function toggle(node, state) {\n if (state === undefined) { state = !visible(node); }\n return state ? show(node) : hide(node);\n}\n\n/** Whether a node takes up room: what jQuery's :visible meant. */\nexport function visible(node) {\n return !!(node.offsetWidth || node.offsetHeight || node.getClientRects().length);\n}\n\n/** The border box's width, fractions included. */\nexport function outerWidth(node) {\n return node.getBoundingClientRect().width;\n}\n\nexport function outerHeight(node) {\n return node.getBoundingClientRect().height;\n}\n\n/** The content box's height, which is what jQuery's height() gave. */\nexport function contentHeight(node) {\n var style = getComputedStyle(node);\n return node.clientHeight - parseFloat(style.paddingTop) - parseFloat(style.paddingBottom);\n}\n\n/** Where a node is on the page, not in the window. */\nexport function offset(node) {\n var box = node.getBoundingClientRect();\n return { top: box.top + window.pageYOffset, left: box.left + window.pageXOffset };\n}\n\n/** Its index among its parent's element children, those matching `selector` if given. */\nexport function indexIn(node, selector) {\n return children(node.parentElement, selector).indexOf(node);\n}\n\n/** Put `node` right after `reference`. */\nexport function insertAfter(node, reference) {\n reference.parentNode.insertBefore(node, reference.nextSibling);\n return node;\n}\n\n/** Replace `node` with what it holds. */\nexport function unwrap(node) {\n var parent = node.parentNode;\n\n while (node.firstChild) { parent.insertBefore(node.firstChild, node); }\n node.remove();\n}\n\n/** Put `node` inside `wrapper`, where `node` was. */\nexport function wrap(node, wrapper) {\n node.parentNode.insertBefore(wrapper, node);\n wrapper.appendChild(node);\n return wrapper;\n}\n\n/**\n * Listen on `root` for `types` (space separated) on descendants that match\n * `selector`, with `this` the matched element, as jQuery's delegated\n * handlers had it. Hands back the listener, for removeEventListener; a\n * signal in `options` removes it too.\n */\nexport function delegate(root, types, selector, handler, options) {\n var listener = function(event) {\n var match = closest(event.target, selector, root);\n if (match && root.contains(match)) { return handler.call(match, event); }\n return undefined;\n };\n\n split(types).forEach(function(type) { root.addEventListener(type, listener, options); });\n return listener;\n}\n\n/** Listen for several space separated event types with one handler. */\nexport function on(target, types, handler, options) {\n split(types).forEach(function(type) { target.addEventListener(type, handler, options); });\n return handler;\n}\n\nexport function off(target, types, handler, options) {\n split(types).forEach(function(type) { target.removeEventListener(type, handler, options); });\n}\n\n/** A mouse event of `type` sent to `node`, the way a pointer would. */\nexport function fire(node, type) {\n node.dispatchEvent(new MouseEvent(type, { bubbles: type !== 'mouseenter' && type !== 'mouseleave' }));\n}\n\n/* ------------------------------------------------------------------\n * Taking a node away, visibly.\n *\n * The durations are the ones 6.x had through jQuery: 400 ms unless the\n * caller says otherwise. `done` runs once the node is out of sight, which is\n * when the caller removes it; a node that is already out of sight is done at\n * once, on the next task, as jQuery had it.\n * ------------------------------------------------------------------ */\n\nvar DEFAULT_DURATION = 400;\n\nfunction animateAway(node, frames, duration, done) {\n duration = duration === undefined ? DEFAULT_DURATION : duration;\n\n var finish = function() {\n hide(node);\n if (done) { done(); }\n };\n\n if (!visible(node) || !node.animate || duration <= 0) {\n window.setTimeout(finish, 0);\n return;\n }\n\n var animation = node.animate(frames(getComputedStyle(node)), {\n duration: duration,\n easing: 'ease-in-out',\n });\n var called = false;\n var once = function() {\n if (called) { return; }\n called = true;\n finish();\n };\n\n animation.onfinish = once;\n animation.oncancel = once;\n}\n\n/** Fold a node up to nothing, then hide it. */\nexport function slideUp(node, duration, done) {\n if (typeof duration === 'function') {\n done = duration;\n duration = undefined;\n }\n\n node.style.overflow = 'hidden';\n animateAway(node, function(style) {\n return [\n {\n height: style.height,\n paddingTop: style.paddingTop,\n paddingBottom: style.paddingBottom,\n marginTop: style.marginTop,\n marginBottom: style.marginBottom,\n },\n { height: '0px', paddingTop: '0px', paddingBottom: '0px', marginTop: '0px', marginBottom: '0px' },\n ];\n }, duration, function() {\n node.style.removeProperty('overflow');\n if (done) { done(); }\n });\n}\n\n/** Fade a node out, then hide it. */\nexport function fadeOut(node, duration, done) {\n animateAway(node, function(style) {\n return [{ opacity: style.opacity }, { opacity: 0 }];\n }, duration, done);\n}\n\n/** Fade and fold a node, in height and, with `width`, sideways too, then hide it. */\nexport function shrinkAway(node, duration, done, width) {\n node.style.overflow = 'hidden';\n animateAway(node, function(style) {\n var from = { opacity: style.opacity, height: style.height };\n var to = { opacity: 0, height: '0px' };\n\n if (width) {\n from.width = style.width;\n to.width = '0px';\n }\n return [from, to];\n }, duration, function() {\n node.style.removeProperty('overflow');\n if (done) { done(); }\n });\n}\n", "/**\n * Cards for grid-editor.\n *\n * A container plugin: load this file after the editor and the toolbar offers\n * a card, a bootstrap card whose body is an editable region. What it can ask\n * the editor for is the handle its factory is called with, described in\n * docs/plugins.md.\n *\n * <script src=\"dist/grideditor.min.js\"></script>\n * <script src=\"dist/plugins/grideditor.card.min.js\"></script>\n */\nimport { GridEditor } from '../grideditor.js';\nimport * as dom from '../dom.js';\n\nObject.assign(GridEditor.locales.en, {\n 'container.add_card': 'Card',\n 'container.card_title': 'Card title',\n 'container.card_footer': 'Card footer',\n});\n\nGridEditor.containers.card = function(ge) {\n\n /** A header's or a footer's text, editable in place, when the card has one. */\n function editable(part) {\n if (part) { ge.makeLabelEditable(ge.labelIn(part)); }\n }\n\n return {\n labelKey: 'container.add_card',\n\n /**\n * A card is a header, a body and an optional footer. `header: false`\n * leaves the title out, `footer: true` or a string adds one; both are\n * plain text the editor makes editable, not regions, so a card holds\n * exactly one region and nests like any other container.\n */\n create: function(options) {\n var card = dom.element('div', { 'class': 'card' });\n\n if (options.header !== false) {\n var header = card.appendChild(dom.element('div', { 'class': 'card-header' }));\n header.appendChild(dom.element('span', { 'class': 'ge-pane-label' },\n options.title || ge.t('container.card_title')));\n }\n\n card.appendChild(dom.element('div', { 'class': 'card-body' })).appendChild(ge.defaultRegion());\n\n if (options.footer) {\n var footer = card.appendChild(dom.element('div', { 'class': 'card-footer text-body-secondary' }));\n footer.appendChild(dom.element('span', { 'class': 'ge-pane-label' },\n typeof options.footer === 'string' ? options.footer : ge.t('container.card_footer')));\n }\n\n var container = dom.element('div', { 'data-ge-container': 'card' });\n container.appendChild(card);\n return container;\n },\n\n mark: function(container) {\n editable(dom.one(container, ':scope > .card > .card-header'));\n editable(dom.one(container, ':scope > .card > .card-footer'));\n },\n\n unmark: function(container) {\n ge.unwrapLabels(container);\n },\n };\n};\n"],
5
+ "mappings": "MASA,IAAIA,EAAa,OAAO,WAExB,GAAI,CAACA,GAAc,OAAOA,EAAW,KAAQ,WACzC,MAAM,IAAI,MAAM,wHAC0B,ECMvC,SAASC,EAAIC,EAAMC,EAAU,CAChC,OAAOD,EAAOA,EAAK,cAAcC,CAAQ,EAAI,IACjD,CAoFO,SAASC,EAAQC,EAAKC,EAAYC,EAAM,CAC3C,IAAIC,EAAO,SAAS,cAAcH,CAAG,EAErC,cAAO,KAAKC,GAAc,CAAC,CAAC,EAAE,QAAQ,SAASG,EAAM,CACjD,IAAIC,EAAQJ,EAAWG,CAAI,EACvBC,GAAU,MAA+BA,IAAU,IAASF,EAAK,aAAaC,EAAMC,CAAK,CACjG,CAAC,EACyBH,GAAS,OAAQC,EAAK,YAAcD,GAEvDC,CACX,CCrGA,OAAO,OAAOG,EAAW,QAAQ,GAAI,CACjC,qBAAsB,OACtB,uBAAwB,aACxB,wBAAyB,aAC7B,CAAC,EAEDA,EAAW,WAAW,KAAO,SAASC,EAAI,CAGtC,SAASC,EAASC,EAAM,CAChBA,GAAQF,EAAG,kBAAkBA,EAAG,QAAQE,CAAI,CAAC,CACrD,CAEA,MAAO,CACH,SAAU,qBAQV,OAAQ,SAASC,EAAS,CACtB,IAAIC,EAAWC,EAAQ,MAAO,CAAE,MAAS,MAAO,CAAC,EAEjD,GAAIF,EAAQ,SAAW,GAAO,CAC1B,IAAIG,EAASF,EAAK,YAAgBC,EAAQ,MAAO,CAAE,MAAS,aAAc,CAAC,CAAC,EAC5EC,EAAO,YAAgBD,EAAQ,OAAQ,CAAE,MAAS,eAAgB,EAC9DF,EAAQ,OAASH,EAAG,EAAE,sBAAsB,CAAC,CAAC,CACtD,CAIA,GAFAI,EAAK,YAAgBC,EAAQ,MAAO,CAAE,MAAS,WAAY,CAAC,CAAC,EAAE,YAAYL,EAAG,cAAc,CAAC,EAEzFG,EAAQ,OAAQ,CAChB,IAAII,EAASH,EAAK,YAAgBC,EAAQ,MAAO,CAAE,MAAS,iCAAkC,CAAC,CAAC,EAChGE,EAAO,YAAgBF,EAAQ,OAAQ,CAAE,MAAS,eAAgB,EAC9D,OAAOF,EAAQ,QAAW,SAAWA,EAAQ,OAASH,EAAG,EAAE,uBAAuB,CAAC,CAAC,CAC5F,CAEA,IAAIQ,EAAgBH,EAAQ,MAAO,CAAE,oBAAqB,MAAO,CAAC,EAClE,OAAAG,EAAU,YAAYJ,CAAI,EACnBI,CACX,EAEA,KAAM,SAASA,EAAW,CACtBP,EAAaQ,EAAID,EAAW,+BAA+B,CAAC,EAC5DP,EAAaQ,EAAID,EAAW,+BAA+B,CAAC,CAChE,EAEA,OAAQ,SAASA,EAAW,CACxBR,EAAG,aAAaQ,CAAS,CAC7B,CACJ,CACJ",
6
+ "names": ["GridEditor", "one", "root", "selector", "element", "tag", "attributes", "text", "node", "name", "value", "GridEditor", "ge", "editable", "part", "options", "card", "element", "header", "footer", "container", "one"]
7
+ }