@web-atoms/web-controls 2.6.5 → 2.6.6

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 (177) hide show
  1. package/dist/tsconfig.tsbuildinfo +1 -1
  2. package/dist-esm/ArrayLike.js +14 -12
  3. package/dist-esm/DataAttributes.js +18 -19
  4. package/dist-esm/Focusable.js +10 -11
  5. package/dist-esm/ModuleFiles.js +43 -42
  6. package/dist-esm/NumberFormats.js +60 -56
  7. package/dist-esm/PageNavigator.js +28 -30
  8. package/dist-esm/animations/Animations.js +36 -33
  9. package/dist-esm/basic/AtomChips.js +312 -305
  10. package/dist-esm/basic/AtomRepeater.js +1070 -1035
  11. package/dist-esm/basic/AtomSuggestions.js +97 -107
  12. package/dist-esm/basic/AttachedPopup.js +0 -1
  13. package/dist-esm/basic/Button.js +45 -19
  14. package/dist-esm/basic/ButtonBar.js +84 -64
  15. package/dist-esm/basic/Calendar.js +211 -203
  16. package/dist-esm/basic/CheckBoxList.js +90 -70
  17. package/dist-esm/basic/Checkbox.js +16 -8
  18. package/dist-esm/basic/Chip.js +36 -12
  19. package/dist-esm/basic/ComboBox.js +47 -51
  20. package/dist-esm/basic/DataGrid.js +258 -252
  21. package/dist-esm/basic/DateField.js +149 -127
  22. package/dist-esm/basic/DropDown.js +91 -103
  23. package/dist-esm/basic/DropDownInput.js +78 -106
  24. package/dist-esm/basic/Editable.js +82 -77
  25. package/dist-esm/basic/Expander.js +104 -86
  26. package/dist-esm/basic/FilesDragDrop.js +84 -80
  27. package/dist-esm/basic/Form.js +80 -52
  28. package/dist-esm/basic/FormField.js +164 -106
  29. package/dist-esm/basic/IElement.js +1 -2
  30. package/dist-esm/basic/InlinePopup.js +263 -234
  31. package/dist-esm/basic/InlinePopupButton.js +99 -88
  32. package/dist-esm/basic/InlinePopupControl.js +24 -23
  33. package/dist-esm/basic/ItemPath.js +59 -60
  34. package/dist-esm/basic/LimitedText.js +49 -38
  35. package/dist-esm/basic/ListRepeater.js +13 -14
  36. package/dist-esm/basic/MaskedInput.js +37 -29
  37. package/dist-esm/basic/MaskedInputDiv.js +55 -48
  38. package/dist-esm/basic/MergeNode.js +64 -35
  39. package/dist-esm/basic/PasswordBox.js +32 -17
  40. package/dist-esm/basic/PinchZoomView.js +221 -199
  41. package/dist-esm/basic/PopupButton.js +39 -16
  42. package/dist-esm/basic/PopupMenu.js +3 -4
  43. package/dist-esm/basic/RadioButtonList.js +35 -25
  44. package/dist-esm/basic/RefreshLock.js +41 -42
  45. package/dist-esm/basic/Resizable.js +43 -33
  46. package/dist-esm/basic/Select.js +72 -65
  47. package/dist-esm/basic/SortByButton.js +41 -31
  48. package/dist-esm/basic/Swipe.js +91 -84
  49. package/dist-esm/basic/Switch.js +22 -8
  50. package/dist-esm/basic/TableRepeater.js +29 -33
  51. package/dist-esm/basic/TimeEditor.js +97 -52
  52. package/dist-esm/basic/TitleEditor.js +115 -95
  53. package/dist-esm/basic/ToggleButtonBar.js +21 -22
  54. package/dist-esm/basic/Tooltip.js +49 -47
  55. package/dist-esm/basic/TypeWriter.js +45 -42
  56. package/dist-esm/basic/UploadEvent.js +211 -178
  57. package/dist-esm/basic/ZoomView.js +229 -198
  58. package/dist-esm/basic/combineClasses.js +2 -3
  59. package/dist-esm/basic/elements/AtomPopover.js +270 -253
  60. package/dist-esm/basic/elements/getContainingBlock.js +34 -35
  61. package/dist-esm/basic/elements/relativeRect.js +40 -21
  62. package/dist-esm/desktop-app/DesktopApp.js +65 -80
  63. package/dist-esm/desktop-app/MobileDesktopApp.js +20 -23
  64. package/dist-esm/html-editor/AtomHtmlEditor.js +243 -268
  65. package/dist-esm/html-editor/HtmlEditorCommands.js +6 -4
  66. package/dist-esm/html-editor/InlineHtmlEditor.js +174 -166
  67. package/dist-esm/html-editor/RangeEditor.js +49 -51
  68. package/dist-esm/html-editor/commands/AddImage.js +40 -35
  69. package/dist-esm/html-editor/commands/AddLink.js +56 -54
  70. package/dist-esm/html-editor/commands/Align.js +24 -7
  71. package/dist-esm/html-editor/commands/AttachFile.js +23 -13
  72. package/dist-esm/html-editor/commands/AttachImage.js +35 -25
  73. package/dist-esm/html-editor/commands/Bold.js +10 -11
  74. package/dist-esm/html-editor/commands/ChangeColor.js +31 -107
  75. package/dist-esm/html-editor/commands/ChangeFont.js +42 -42
  76. package/dist-esm/html-editor/commands/ChangeFontSize.js +15 -5
  77. package/dist-esm/html-editor/commands/Command.js +34 -16
  78. package/dist-esm/html-editor/commands/CommandButton.js +51 -32
  79. package/dist-esm/html-editor/commands/Headings.js +25 -9
  80. package/dist-esm/html-editor/commands/HorizontalRule.js +9 -10
  81. package/dist-esm/html-editor/commands/HtmlCommands.js +160 -65
  82. package/dist-esm/html-editor/commands/IndentLess.js +10 -11
  83. package/dist-esm/html-editor/commands/IndentMore.js +10 -11
  84. package/dist-esm/html-editor/commands/Italic.js +10 -11
  85. package/dist-esm/html-editor/commands/NumberedList.js +10 -11
  86. package/dist-esm/html-editor/commands/Quote.js +10 -11
  87. package/dist-esm/html-editor/commands/RemoveFormat.js +10 -11
  88. package/dist-esm/html-editor/commands/Separator.js +5 -4
  89. package/dist-esm/html-editor/commands/Source.js +29 -25
  90. package/dist-esm/html-editor/commands/StrikeThrough.js +10 -11
  91. package/dist-esm/html-editor/commands/Toolbar.js +6 -4
  92. package/dist-esm/html-editor/commands/Underline.js +10 -11
  93. package/dist-esm/html-editor/commands/Unlink.js +10 -9
  94. package/dist-esm/html-editor/commands/UnorderedList.js +10 -11
  95. package/dist-esm/mobile-app/BottomPopup.js +137 -148
  96. package/dist-esm/mobile-app/MasterDetailPage.js +153 -152
  97. package/dist-esm/mobile-app/MobileApp.js +577 -569
  98. package/dist-esm/player/AtomVideoPlayer.js +316 -270
  99. package/dist-esm/player/TrackProgress.js +11 -7
  100. package/dist-esm/player/input-range-style.js +97 -98
  101. package/dist-esm/tests/app-test/AppTestApp.js +12 -15
  102. package/dist-esm/tests/app-test/AppTestApp.pack.js +54 -0
  103. package/dist-esm/tests/app-test/commands/AppCommands.js +14 -11
  104. package/dist-esm/tests/app-test/drawer/AppDrawer.js +4 -6
  105. package/dist-esm/tests/app-test/model/model.js +1 -2
  106. package/dist-esm/tests/app-test/pages/detail/DetailPage.js +21 -15
  107. package/dist-esm/tests/app-test/pages/home/HomePage.js +7 -8
  108. package/dist-esm/tests/app-test/pages/list/ListPage.js +79 -62
  109. package/dist-esm/tests/basic/PopupTest.js +9 -7
  110. package/dist-esm/tests/basic/TimeEditorTest.js +5 -9
  111. package/dist-esm/tests/basic/TimeEditorTest.pack.js +39 -0
  112. package/dist-esm/tests/basic/TimerTest.js +27 -37
  113. package/dist-esm/tests/basic/TimerTest.pack.js +40 -0
  114. package/dist-esm/tests/basic/basic-form/BasicForm.js +47 -27
  115. package/dist-esm/tests/basic/basic-form/BasicForm.pack.js +44 -0
  116. package/dist-esm/tests/basic/calendar/BasicCalendarTest.js +5 -9
  117. package/dist-esm/tests/basic/calendar/BasicCalendarTest.pack.js +53 -0
  118. package/dist-esm/tests/basic/chips/ChipsTest.js +25 -15
  119. package/dist-esm/tests/basic/chips/ChipsTest.pack.js +56 -0
  120. package/dist-esm/tests/basic/data-grid/DataGridTest.js +55 -60
  121. package/dist-esm/tests/basic/data-grid/DataGridTest.pack.js +58 -0
  122. package/dist-esm/tests/basic/date/DateFieldTest.js +21 -96
  123. package/dist-esm/tests/basic/date/DateFieldTest.pack.js +57 -0
  124. package/dist-esm/tests/basic/drop-down/DropDownTest.js +25 -19
  125. package/dist-esm/tests/basic/drop-down/DropDownTest.pack.js +52 -0
  126. package/dist-esm/tests/basic/drop-down-input/DropDownTest.js +32 -32
  127. package/dist-esm/tests/basic/drop-down-input/DropDownTest.pack.js +54 -0
  128. package/dist-esm/tests/basic/expander/ExpanderMenuTest.js +20 -14
  129. package/dist-esm/tests/basic/expander/ExpanderMenuTest.pack.js +38 -0
  130. package/dist-esm/tests/basic/expander/ExpanderTest.js +11 -12
  131. package/dist-esm/tests/basic/expander/ExpanderTest.pack.js +38 -0
  132. package/dist-esm/tests/basic/form2/Form2Test.js +26 -24
  133. package/dist-esm/tests/basic/form2/Form2Test.pack.js +46 -0
  134. package/dist-esm/tests/basic/limited-text/LimitedTextTest.js +14 -11
  135. package/dist-esm/tests/basic/limited-text/LimitedTextTest.pack.js +38 -0
  136. package/dist-esm/tests/basic/pinch-zoom/PinchZoomViewTest.js +14 -14
  137. package/dist-esm/tests/basic/pinch-zoom/PinchZoomViewTest.pack.js +38 -0
  138. package/dist-esm/tests/basic/repeater/DragDropRepater.js +30 -12
  139. package/dist-esm/tests/basic/repeater/DragDropRepater.pack.js +51 -0
  140. package/dist-esm/tests/basic/repeater/RepeaterTest.js +45 -35
  141. package/dist-esm/tests/basic/repeater/RepeaterTest.pack.js +52 -0
  142. package/dist-esm/tests/basic/swipe/SwipeTest.js +13 -13
  143. package/dist-esm/tests/basic/swipe/SwipeTest.pack.js +52 -0
  144. package/dist-esm/tests/basic/switch-test/SwitchTest.js +8 -10
  145. package/dist-esm/tests/basic/switch-test/SwitchTest.pack.js +38 -0
  146. package/dist-esm/tests/basic/title-editor/TitleEditorTest.js +8 -9
  147. package/dist-esm/tests/basic/title-editor/TitleEditorTest.pack.js +38 -0
  148. package/dist-esm/tests/basic/tooltip/TooltipTest.js +30 -24
  149. package/dist-esm/tests/basic/tooltip/TooltipTest.pack.js +52 -0
  150. package/dist-esm/tests/basic/typewriter/TypeWriter.js +10 -9
  151. package/dist-esm/tests/basic/typewriter/TypeWriter.pack.js +39 -0
  152. package/dist-esm/tests/basic/video/AtomVideoTest.js +13 -10
  153. package/dist-esm/tests/basic/video/AtomVideoTest.pack.js +38 -0
  154. package/dist-esm/tests/basic/zoom/ZoomViewTest.js +13 -13
  155. package/dist-esm/tests/basic/zoom/ZoomViewTest.pack.js +38 -0
  156. package/dist-esm/tests/check-box-list/CheckBoxListSample.js +13 -12
  157. package/dist-esm/tests/check-box-list/CheckBoxListSample.pack.js +52 -0
  158. package/dist-esm/tests/data-grid/GridTestViewModel.js +203 -227
  159. package/dist-esm/tests/form/CustomHelp.js +6 -9
  160. package/dist-esm/tests/form/FormViewModel.js +21 -28
  161. package/dist-esm/tests/html-editor/HtmlEditorTest.js +7 -37
  162. package/dist-esm/tests/html-editor/HtmlEditorTest.pack.js +83 -0
  163. package/dist-esm/tests/html-editor/InlineHtmlEdiorTest.js +9 -38
  164. package/dist-esm/tests/html-editor/InlineHtmlEdiorTest.pack.js +85 -0
  165. package/dist-esm/tests/mask/MaskedInputTest.js +11 -12
  166. package/dist-esm/tests/mask/MaskedInputTest.pack.js +38 -0
  167. package/dist-esm/tests/mobile-app/DesktopAppTest.js +8 -9
  168. package/dist-esm/tests/mobile-app/DesktopAppTest.pack.js +60 -0
  169. package/dist-esm/tests/mobile-app/MobileAppTest.js +64 -53
  170. package/dist-esm/tests/mobile-app/MobileAppTest.pack.js +55 -0
  171. package/dist-esm/tests/pop-over/PopOverTest.js +37 -77
  172. package/dist-esm/tests/switch/SwitchTest.js +9 -8
  173. package/dist-esm/tests/toggle-view/ToggleViewTest.js +15 -22
  174. package/dist-esm/tests/toggle-view/ToggleViewTest.pack.js +45 -0
  175. package/dist-esm/toggle-view/AtomToggleView.js +77 -73
  176. package/dist-esm/tsconfig.esm.tsbuildinfo +1 -1
  177. package/package.json +3 -3
@@ -6,64 +6,66 @@ import PopupService, { PopupWindow } from "@web-atoms/core/dist/web/services/Pop
6
6
  import FormField from "../../basic/FormField.js";
7
7
  import CommandButton from "./CommandButton.js";
8
8
  import HtmlCommands from "./HtmlCommands.js";
9
- import "./AddLink.local.css";
9
+ ESMPack.installStyleSheet(import.meta.resolve("./AddLink.local.css"));
10
10
  import ButtonBar from "../../basic/ButtonBar.js";
11
- const linkTypes = [
12
- {
13
- label: "Web Page",
14
- value: "web-page"
15
- },
16
- {
17
- label: "Email",
18
- value: "email"
19
- },
20
- {
21
- label: "Anchor",
22
- value: "anchor"
23
- },
24
- {
25
- label: "Phone",
26
- value: "phone"
27
- }
28
- ];
11
+ const linkTypes = [{
12
+ label: "Web Page",
13
+ value: "web-page"
14
+ }, {
15
+ label: "Email",
16
+ value: "email"
17
+ }, {
18
+ label: "Anchor",
19
+ value: "anchor"
20
+ }, {
21
+ label: "Phone",
22
+ value: "phone"
23
+ }];
29
24
  const linkDialogCss = "html-editor-commands-add-link";
30
25
  class LinkDialog extends PopupWindow {
31
- create() {
32
- this.type = "web-page";
33
- this.title = "Create Link";
34
- this.render(XNode.create("div", { class: linkDialogCss },
35
- XNode.create(FormField, { label: "Type" },
36
- XNode.create(ButtonBar, { items: linkTypes, value: Bind.twoWays(() => this.type) })),
37
- XNode.create(FormField, { label: "Link", required: true },
38
- XNode.create("input", { placeholder: "https://...", value: Bind.twoWaysImmediate(() => this.link) })),
39
- XNode.create("div", { class: "command-bar" },
40
- XNode.create("button", { text: "Add", eventClick: Bind.event(() => this.close(this.toLink(this.link))) }))));
41
- }
42
- toLink(link) {
43
- switch (this.type) {
44
- case "web-page":
45
- return /^(http|https)\:\/\//.test(link) ? link : `http://${link}`;
46
- }
26
+ create() {
27
+ this.type = "web-page";
28
+ this.title = "Create Link";
29
+ this.render(XNode.create("div", {
30
+ class: linkDialogCss
31
+ }, XNode.create(FormField, {
32
+ label: "Type"
33
+ }, XNode.create(ButtonBar, {
34
+ items: linkTypes,
35
+ value: Bind.twoWays(() => this.type)
36
+ })), XNode.create(FormField, {
37
+ label: "Link",
38
+ required: true
39
+ }, XNode.create("input", {
40
+ placeholder: "https://...",
41
+ value: Bind.twoWaysImmediate(() => this.link)
42
+ })), XNode.create("div", {
43
+ class: "command-bar"
44
+ }, XNode.create("button", {
45
+ text: "Add",
46
+ eventClick: Bind.event(() => this.close(this.toLink(this.link)))
47
+ }))));
48
+ }
49
+ toLink(link) {
50
+ switch (this.type) {
51
+ case "web-page":
52
+ return /^(http|https)\:\/\//.test(link) ? link : `http://${link}`;
47
53
  }
54
+ }
48
55
  }
49
- __decorate([
50
- BindableProperty,
51
- __metadata("design:type", String)
52
- ], LinkDialog.prototype, "link", void 0);
53
- __decorate([
54
- BindableProperty,
55
- __metadata("design:type", String)
56
- ], LinkDialog.prototype, "type", void 0);
56
+ __decorate([BindableProperty, __metadata("design:type", String)], LinkDialog.prototype, "link", void 0);
57
+ __decorate([BindableProperty, __metadata("design:type", String)], LinkDialog.prototype, "type", void 0);
57
58
  function showDialog(s, e) {
58
- return PopupService.showWindow(s.element, LinkDialog);
59
- }
60
- export default function AddLink({ insertCommand = HtmlCommands.createLink }) {
61
- return CommandButton({
62
- icon: "ri-link-m",
63
- insertCommand,
64
- disabled: false,
65
- eventInsertHtml: showDialog,
66
- title: "Create Hyper Link"
67
- });
59
+ return PopupService.showWindow(s.element, LinkDialog);
68
60
  }
69
- //# sourceMappingURL=AddLink.js.map
61
+ export default function AddLink({
62
+ insertCommand = HtmlCommands.createLink
63
+ }) {
64
+ return CommandButton({
65
+ icon: "ri-link-m",
66
+ insertCommand,
67
+ disabled: false,
68
+ eventInsertHtml: showDialog,
69
+ title: "Create Hyper Link"
70
+ });
71
+ }
@@ -2,10 +2,27 @@ import Bind from "@web-atoms/core/dist/core/Bind.js";
2
2
  import XNode from "@web-atoms/core/dist/core/XNode.js";
3
3
  import PopupButton, { MenuItem } from "../../basic/PopupButton.js";
4
4
  export default function Align(a) {
5
- return XNode.create(PopupButton, { class: "command", "data-layout": "toolbar-button", icon: "ri-align-left", title: "Change Alignment", ...a },
6
- XNode.create(MenuItem, { icon: "ri-align-left", title: "Align Left", eventClick: Bind.event((e) => e.executeCommand("justifyLeft")) }),
7
- XNode.create(MenuItem, { icon: "ri-align-center", title: "Align Center", eventClick: Bind.event((e) => e.executeCommand("justifyCenter")) }),
8
- XNode.create(MenuItem, { icon: "ri-align-right", title: "Align Right", eventClick: Bind.event((e) => e.executeCommand("justifyRight")) }),
9
- XNode.create(MenuItem, { icon: "ri-align-justify", title: "Justify", eventClick: Bind.event((e) => e.executeCommand("justifyFull")) }));
10
- }
11
- //# sourceMappingURL=Align.js.map
5
+ return XNode.create(PopupButton, {
6
+ class: "command",
7
+ "data-layout": "toolbar-button",
8
+ icon: "ri-align-left",
9
+ title: "Change Alignment",
10
+ ...a
11
+ }, XNode.create(MenuItem, {
12
+ icon: "ri-align-left",
13
+ title: "Align Left",
14
+ eventClick: Bind.event(e => e.executeCommand("justifyLeft"))
15
+ }), XNode.create(MenuItem, {
16
+ icon: "ri-align-center",
17
+ title: "Align Center",
18
+ eventClick: Bind.event(e => e.executeCommand("justifyCenter"))
19
+ }), XNode.create(MenuItem, {
20
+ icon: "ri-align-right",
21
+ title: "Align Right",
22
+ eventClick: Bind.event(e => e.executeCommand("justifyRight"))
23
+ }), XNode.create(MenuItem, {
24
+ icon: "ri-align-justify",
25
+ title: "Justify",
26
+ eventClick: Bind.event(e => e.executeCommand("justifyFull"))
27
+ }));
28
+ }
@@ -1,15 +1,25 @@
1
1
  import XNode from "@web-atoms/core/dist/core/XNode.js";
2
2
  import UploadEvent from "../../basic/UploadEvent.js";
3
- export default function AttachFile({ accept = "image/*", maxSize = 1024 * 1024 * 5, authorize = true, capture = null, ariaLabel = "upload" }) {
4
- return XNode.create("button", { title: "Insert Image", class: "command", ...UploadEvent.AttachUploadAction({
5
- accept,
6
- forceType: true,
7
- maxSize,
8
- authorize,
9
- capture,
10
- multiple: false,
11
- ariaLabel
12
- }) },
13
- XNode.create("i", { class: "ri-attachment-2" }));
14
- }
15
- //# sourceMappingURL=AttachFile.js.map
3
+ export default function AttachFile({
4
+ accept = "image/*",
5
+ maxSize = 1024 * 1024 * 5,
6
+ authorize = true,
7
+ capture = null,
8
+ ariaLabel = "upload"
9
+ }) {
10
+ return XNode.create("button", {
11
+ title: "Insert Image",
12
+ class: "command",
13
+ ...UploadEvent.AttachUploadAction({
14
+ accept,
15
+ forceType: true,
16
+ maxSize,
17
+ authorize,
18
+ capture,
19
+ multiple: false,
20
+ ariaLabel
21
+ })
22
+ }, XNode.create("i", {
23
+ class: "ri-attachment-2"
24
+ }));
25
+ }
@@ -1,29 +1,39 @@
1
1
  import XNode from "@web-atoms/core/dist/core/XNode.js";
2
2
  import UploadEvent from "../../basic/UploadEvent.js";
3
3
  import { AtomControl } from "@web-atoms/core/dist/web/controls/AtomControl.js";
4
- const onAttachImage = async (ce) => {
5
- const c = AtomControl.from(ce.target);
6
- if (!ce.detail?.files?.length) {
7
- return;
8
- }
9
- const file = ce.detail.files[0];
10
- const fr = new FileReader();
11
- fr.onload = () => {
12
- c.executeCommand("insertHTML", void 0, `<div><img data-content="data-url" src="${fr.result}" style='max-height: 700px;'/></div>`);
13
- };
14
- fr.readAsDataURL(file);
4
+ const onAttachImage = async ce => {
5
+ const c = AtomControl.from(ce.target);
6
+ if (!ce.detail?.files?.length) {
7
+ return;
8
+ }
9
+ const file = ce.detail.files[0];
10
+ const fr = new FileReader();
11
+ fr.onload = () => {
12
+ c.executeCommand("insertHTML", void 0, `<div><img data-content="data-url" src="${fr.result}" style='max-height: 700px;'/></div>`);
13
+ };
14
+ fr.readAsDataURL(file);
15
15
  };
16
- export default function AttachImage({ accept = "image/*", maxSize = 1024 * 1024 * 5, authorize = true, capture = null, ariaLabel = "upload" }) {
17
- return XNode.create("button", { title: "Insert Image", class: "command", ...UploadEvent.AttachUploadAction({
18
- accept,
19
- forceType: true,
20
- maxSize,
21
- authorize,
22
- capture,
23
- multiple: false,
24
- ariaLabel,
25
- "event-files-available": onAttachImage
26
- }) },
27
- XNode.create("i", { class: "ri-image-add-fill" }));
28
- }
29
- //# sourceMappingURL=AttachImage.js.map
16
+ export default function AttachImage({
17
+ accept = "image/*",
18
+ maxSize = 1024 * 1024 * 5,
19
+ authorize = true,
20
+ capture = null,
21
+ ariaLabel = "upload"
22
+ }) {
23
+ return XNode.create("button", {
24
+ title: "Insert Image",
25
+ class: "command",
26
+ ...UploadEvent.AttachUploadAction({
27
+ accept,
28
+ forceType: true,
29
+ maxSize,
30
+ authorize,
31
+ capture,
32
+ multiple: false,
33
+ ariaLabel,
34
+ "event-files-available": onAttachImage
35
+ })
36
+ }, XNode.create("i", {
37
+ class: "ri-image-add-fill"
38
+ }));
39
+ }
@@ -1,13 +1,12 @@
1
1
  import Command from "./Command.js";
2
2
  export default function Bold(cmd) {
3
- return Command({
4
- icon: "ri-bold",
5
- queryState: "bold",
6
- title: "Bold",
7
- ...cmd,
8
- command(editor) {
9
- editor.executeCommand("bold");
10
- }
11
- });
12
- }
13
- //# sourceMappingURL=Bold.js.map
3
+ return Command({
4
+ icon: "ri-bold",
5
+ queryState: "bold",
6
+ title: "Bold",
7
+ ...cmd,
8
+ command(editor) {
9
+ editor.executeCommand("bold");
10
+ }
11
+ });
12
+ }
@@ -1,116 +1,40 @@
1
1
  import Bind from "@web-atoms/core/dist/core/Bind.js";
2
2
  import XNode from "@web-atoms/core/dist/core/XNode.js";
3
3
  import PopupButton from "../../basic/PopupButton.js";
4
- import "./ChangeColor.local.css";
5
- const gray = [
6
- "rgb(0,0,0)",
7
- "rgb(68,68,68)",
8
- "rgb(102,102,102)",
9
- "rgb(153,153,153)",
10
- "rgb(204,204,204)",
11
- "rgb(238,238,238)",
12
- "rgb(243,243,243)",
13
- "rgb(255,255,255)"
14
- ];
15
- const primary = [
16
- "rgb(255,0,0)",
17
- "rgb(255,153,0)",
18
- "rgb(255,255,0)",
19
- "rgb(0,255,0)",
20
- "rgb(0,255,255)",
21
- "rgb(0,0,255)",
22
- "rgb(153,0,255)",
23
- "rgb(255,0,255)"
24
- ];
25
- const all = [
26
- [
27
- "rgb(244,204,204)",
28
- "rgb(252,229,205)",
29
- "rgb(255,242,204)",
30
- "rgb(217,234,211)",
31
- "rgb(208,224,227)",
32
- "rgb(207,226,243)",
33
- "rgb(217,210,233)",
34
- "rgb(234,209,220)"
35
- ],
36
- [
37
- "rgb(234,153,153)",
38
- "rgb(249,203,156)",
39
- "rgb(255,229,153)",
40
- "rgb(182,215,168)",
41
- "rgb(162,196,201)",
42
- "rgb(159,197,232)",
43
- "rgb(180,167,214)",
44
- "rgb(213,166,189)"
45
- ],
46
- [
47
- "rgb(224,102,102)",
48
- "rgb(246,178,107)",
49
- "rgb(255,217,102)",
50
- "rgb(147,196,125)",
51
- "rgb(118,165,175)",
52
- "rgb(111,168,220)",
53
- "rgb(142,124,195)",
54
- "rgb(194,123,160)"
55
- ],
56
- [
57
- "rgb(204,0,0)",
58
- "rgb(230,145,56)",
59
- "rgb(241,194,50)",
60
- "rgb(106,168,79)",
61
- "rgb(69,129,142)",
62
- "rgb(61,133,198)",
63
- "rgb(103,78,167)",
64
- "rgb(166,77,121)"
65
- ],
66
- [
67
- "rgb(153,0,0)",
68
- "rgb(180,95,6)",
69
- "rgb(191,144,0)",
70
- "rgb(56,118,29)",
71
- "rgb(19,79,92)",
72
- "rgb(11,83,148)",
73
- "rgb(53,28,117)",
74
- "rgb(116,27,71)"
75
- ],
76
- [
77
- "rgb(102,0,0)",
78
- "rgb(120,63,4)",
79
- "rgb(127,96,0)",
80
- "rgb(39,78,19)",
81
- "rgb(12,52,61)",
82
- "rgb(7,55,99)",
83
- "rgb(32,18,77)",
84
- "rgb(76,17,48)"
85
- ]
86
- ];
4
+ ESMPack.installStyleSheet(import.meta.resolve("./ChangeColor.local.css"));
5
+ const gray = ["rgb(0,0,0)", "rgb(68,68,68)", "rgb(102,102,102)", "rgb(153,153,153)", "rgb(204,204,204)", "rgb(238,238,238)", "rgb(243,243,243)", "rgb(255,255,255)"];
6
+ const primary = ["rgb(255,0,0)", "rgb(255,153,0)", "rgb(255,255,0)", "rgb(0,255,0)", "rgb(0,255,255)", "rgb(0,0,255)", "rgb(153,0,255)", "rgb(255,0,255)"];
7
+ const all = [["rgb(244,204,204)", "rgb(252,229,205)", "rgb(255,242,204)", "rgb(217,234,211)", "rgb(208,224,227)", "rgb(207,226,243)", "rgb(217,210,233)", "rgb(234,209,220)"], ["rgb(234,153,153)", "rgb(249,203,156)", "rgb(255,229,153)", "rgb(182,215,168)", "rgb(162,196,201)", "rgb(159,197,232)", "rgb(180,167,214)", "rgb(213,166,189)"], ["rgb(224,102,102)", "rgb(246,178,107)", "rgb(255,217,102)", "rgb(147,196,125)", "rgb(118,165,175)", "rgb(111,168,220)", "rgb(142,124,195)", "rgb(194,123,160)"], ["rgb(204,0,0)", "rgb(230,145,56)", "rgb(241,194,50)", "rgb(106,168,79)", "rgb(69,129,142)", "rgb(61,133,198)", "rgb(103,78,167)", "rgb(166,77,121)"], ["rgb(153,0,0)", "rgb(180,95,6)", "rgb(191,144,0)", "rgb(56,118,29)", "rgb(19,79,92)", "rgb(11,83,148)", "rgb(53,28,117)", "rgb(116,27,71)"], ["rgb(102,0,0)", "rgb(120,63,4)", "rgb(127,96,0)", "rgb(39,78,19)", "rgb(12,52,61)", "rgb(7,55,99)", "rgb(32,18,77)", "rgb(76,17,48)"]];
87
8
  const colorSelectorCss = "web-controls-html-editor-change-color";
88
9
  function TextColor(color) {
89
- return XNode.create("div", { class: "color-button", eventClick: Bind.event((e) => e.executeCommand("foreColor", false, color)), styleBackgroundColor: color.toLowerCase(), title: color });
10
+ return XNode.create("div", {
11
+ class: "color-button",
12
+ eventClick: Bind.event(e => e.executeCommand("foreColor", false, color)),
13
+ styleBackgroundColor: color.toLowerCase(),
14
+ title: color
15
+ });
90
16
  }
91
17
  function BackgroundColor(color) {
92
- return XNode.create("div", { class: "color-button", eventClick: Bind.event((e) => e.executeCommand("hiliteColor", false, color)), styleBackgroundColor: color.toLowerCase(), title: color });
18
+ return XNode.create("div", {
19
+ class: "color-button",
20
+ eventClick: Bind.event(e => e.executeCommand("hiliteColor", false, color)),
21
+ styleBackgroundColor: color.toLowerCase(),
22
+ title: color
23
+ });
93
24
  }
94
25
  export default function ChangeColor() {
95
- return XNode.create(PopupButton, { title: "Change Color", class: "command", icon: "ri-font-color", "data-layout": "toolbar-button" },
96
- XNode.create("div", { class: colorSelectorCss },
97
- XNode.create("table", null,
98
- XNode.create("thead", null,
99
- XNode.create("tr", null,
100
- XNode.create("th", { colSpan: 8 }, "Text Color"))),
101
- XNode.create("thead", null,
102
- XNode.create("tr", null, ...gray.map(TextColor))),
103
- XNode.create("thead", null,
104
- XNode.create("tr", null, ...primary.map(TextColor))),
105
- XNode.create("tbody", null, ...all.map((row) => XNode.create("tr", null, ...row.map(TextColor))))),
106
- XNode.create("table", { class: "background-color" },
107
- XNode.create("thead", null,
108
- XNode.create("tr", null,
109
- XNode.create("th", { colSpan: 8 }, "Background Color"))),
110
- XNode.create("thead", null,
111
- XNode.create("tr", null, ...gray.map(BackgroundColor))),
112
- XNode.create("thead", null,
113
- XNode.create("tr", null, ...primary.map(BackgroundColor))),
114
- XNode.create("tbody", null, ...all.map((row) => XNode.create("tr", null, ...row.map(BackgroundColor)))))));
115
- }
116
- //# sourceMappingURL=ChangeColor.js.map
26
+ return XNode.create(PopupButton, {
27
+ title: "Change Color",
28
+ class: "command",
29
+ icon: "ri-font-color",
30
+ "data-layout": "toolbar-button"
31
+ }, XNode.create("div", {
32
+ class: colorSelectorCss
33
+ }, XNode.create("table", null, XNode.create("thead", null, XNode.create("tr", null, XNode.create("th", {
34
+ colSpan: 8
35
+ }, "Text Color"))), XNode.create("thead", null, XNode.create("tr", null, ...gray.map(TextColor))), XNode.create("thead", null, XNode.create("tr", null, ...primary.map(TextColor))), XNode.create("tbody", null, ...all.map(row => XNode.create("tr", null, ...row.map(TextColor))))), XNode.create("table", {
36
+ class: "background-color"
37
+ }, XNode.create("thead", null, XNode.create("tr", null, XNode.create("th", {
38
+ colSpan: 8
39
+ }, "Background Color"))), XNode.create("thead", null, XNode.create("tr", null, ...gray.map(BackgroundColor))), XNode.create("thead", null, XNode.create("tr", null, ...primary.map(BackgroundColor))), XNode.create("tbody", null, ...all.map(row => XNode.create("tr", null, ...row.map(BackgroundColor)))))));
40
+ }
@@ -1,51 +1,51 @@
1
1
  import Bind from "@web-atoms/core/dist/core/Bind.js";
2
2
  import XNode from "@web-atoms/core/dist/core/XNode.js";
3
3
  import PopupButton, { MenuItem } from "../../basic/PopupButton.js";
4
- import "./ChangeFont.local.css";
4
+ ESMPack.installStyleSheet(import.meta.resolve("./ChangeFont.local.css"));
5
5
  const fontMenuCSS = "web-controls-html-editor-change-font";
6
- const fonts = [
7
- ["Sans Serif", ["arial", "sans-serif"]],
8
- ["Serif", [`"times new roman"`, "serif"]],
9
- ["Fixed Width", ["monospace"]],
10
- ["Wide", [`"arial black"`, "sans-serif"]],
11
- ["Narrow", [`"arial narrow"`, "sans-serif"]],
12
- ["Comic Sans MS", [`"comic sans ms"`, "sans-serif"]],
13
- ["Garamond", ["garamond", `"times new roman"`, "serif"]],
14
- ["Georgia", ["georgia"]],
15
- ["Tahoma", ["tahoma"]],
16
- ["Trebuchet MS", [`"trebuchet ms"`]],
17
- ["Verdana", ["verdana"]]
18
- ];
19
- export function FontMenu({ name, value }) {
20
- const cssName = value.join(" ");
21
- return XNode.create("div", { class: "menu", eventClick: Bind.event((e) => e.executeCommand("fontName", false, cssName)) },
22
- XNode.create("i", { class: Bind.oneWay((e) => ({
23
- "ri-check-line": 1,
24
- "selected": e.getStyle("fontFamily", e.version)
25
- .toLowerCase()
26
- .indexOf(value[0].toLowerCase()) !== -1
27
- })) }),
28
- XNode.create("label", { styleFontFamily: name }, name));
6
+ const fonts = [["Sans Serif", ["arial", "sans-serif"]], ["Serif", [`"times new roman"`, "serif"]], ["Fixed Width", ["monospace"]], ["Wide", [`"arial black"`, "sans-serif"]], ["Narrow", [`"arial narrow"`, "sans-serif"]], ["Comic Sans MS", [`"comic sans ms"`, "sans-serif"]], ["Garamond", ["garamond", `"times new roman"`, "serif"]], ["Georgia", ["georgia"]], ["Tahoma", ["tahoma"]], ["Trebuchet MS", [`"trebuchet ms"`]], ["Verdana", ["verdana"]]];
7
+ export function FontMenu({
8
+ name,
9
+ value
10
+ }) {
11
+ const cssName = value.join(" ");
12
+ return XNode.create("div", {
13
+ class: "menu",
14
+ eventClick: Bind.event(e => e.executeCommand("fontName", false, cssName))
15
+ }, XNode.create("i", {
16
+ class: Bind.oneWay(e => ({
17
+ "ri-check-line": 1,
18
+ "selected": e.getStyle("fontFamily", e.version).toLowerCase().indexOf(value[0].toLowerCase()) !== -1
19
+ }))
20
+ }), XNode.create("label", {
21
+ styleFontFamily: name
22
+ }, name));
29
23
  }
30
24
  function selectFont(name) {
31
- if (name === null || name === void 0) {
32
- return "Font";
33
- }
34
- for (const [display, value] of fonts) {
35
- for (const iterator of value) {
36
- if (name.indexOf(iterator) !== -1) {
37
- return display;
38
- }
39
- }
40
- }
25
+ if (name === null || name === void 0) {
41
26
  return "Font";
27
+ }
28
+ for (const [display, value] of fonts) {
29
+ for (const iterator of value) {
30
+ if (name.indexOf(iterator) !== -1) {
31
+ return display;
32
+ }
33
+ }
34
+ }
35
+ return "Font";
42
36
  }
43
37
  export default function ChangeFont() {
44
- return XNode.create(PopupButton, { class: "command", "data-layout": "toolbar-button", text: Bind.oneWay((e) => selectFont(e.getStyle("fontFamily", e.version))), title: "Change Font" },
45
- XNode.create("div", { class: fontMenuCSS }, ...fonts.map(([name, value]) => XNode.create(MenuItem, { "style-font-family": name, icon: Bind.oneWay((e) => selectFont(e.getStyle("fontFamily", e.version))
46
- .toLowerCase()
47
- .indexOf(value[0].toLowerCase()) !== -1
48
- ? "ri-check-line selected"
49
- : ""), label: name, eventClick: Bind.event((e) => e.executeCommand("fontName", false, value.join(" "))) }))));
50
- }
51
- //# sourceMappingURL=ChangeFont.js.map
38
+ return XNode.create(PopupButton, {
39
+ class: "command",
40
+ "data-layout": "toolbar-button",
41
+ text: Bind.oneWay(e => selectFont(e.getStyle("fontFamily", e.version))),
42
+ title: "Change Font"
43
+ }, XNode.create("div", {
44
+ class: fontMenuCSS
45
+ }, ...fonts.map(([name, value]) => XNode.create(MenuItem, {
46
+ "style-font-family": name,
47
+ icon: Bind.oneWay(e => selectFont(e.getStyle("fontFamily", e.version)).toLowerCase().indexOf(value[0].toLowerCase()) !== -1 ? "ri-check-line selected" : ""),
48
+ label: name,
49
+ eventClick: Bind.event(e => e.executeCommand("fontName", false, value.join(" ")))
50
+ }))));
51
+ }
@@ -2,8 +2,18 @@ import Bind from "@web-atoms/core/dist/core/Bind.js";
2
2
  import XNode from "@web-atoms/core/dist/core/XNode.js";
3
3
  import PopupButton, { MenuItem } from "../../basic/PopupButton.js";
4
4
  export default function ChangeFontSize(cmd) {
5
- return XNode.create(PopupButton, { class: "command", "data-layout": "toolbar-button", icon: "ri-font-size-2", title: "Change Font Size" },
6
- XNode.create(MenuItem, { icon: "ri-add-line", label: "Increase", eventClick: Bind.event((e) => e.executeCommand("increaseFontSize")) }),
7
- XNode.create(MenuItem, { icon: "ri-subtract-line", label: "Decrease", eventClick: Bind.event((e) => e.executeCommand("decreaseFontSize")) }));
8
- }
9
- //# sourceMappingURL=ChangeFontSize.js.map
5
+ return XNode.create(PopupButton, {
6
+ class: "command",
7
+ "data-layout": "toolbar-button",
8
+ icon: "ri-font-size-2",
9
+ title: "Change Font Size"
10
+ }, XNode.create(MenuItem, {
11
+ icon: "ri-add-line",
12
+ label: "Increase",
13
+ eventClick: Bind.event(e => e.executeCommand("increaseFontSize"))
14
+ }), XNode.create(MenuItem, {
15
+ icon: "ri-subtract-line",
16
+ label: "Decrease",
17
+ eventClick: Bind.event(e => e.executeCommand("decreaseFontSize"))
18
+ }));
19
+ }
@@ -1,18 +1,36 @@
1
1
  import Bind from "@web-atoms/core/dist/core/Bind.js";
2
2
  import XNode from "@web-atoms/core/dist/core/XNode.js";
3
- export default function Command({ icon, label, command, queryState = "none", query, ...others }) {
4
- if (label) {
5
- return XNode.create("div", { eventClick: Bind.event((e) => command(e)), styleClass: Bind.oneWay((e) => ({
6
- command: e.version,
7
- pressed: !e.queryCommandState(queryState)
8
- })), ...others },
9
- XNode.create("i", { class: icon }),
10
- XNode.create("label", { class: "label", text: label }));
11
- }
12
- return XNode.create("div", { eventClick: Bind.event((e) => command(e)), styleClass: Bind.oneWay((e) => ({
13
- command: e.version,
14
- pressed: e.queryCommandState(queryState)
15
- })), ...others },
16
- XNode.create("i", { class: icon }));
17
- }
18
- //# sourceMappingURL=Command.js.map
3
+ export default function Command({
4
+ icon,
5
+ label,
6
+ command,
7
+ queryState = "none",
8
+ query,
9
+ ...others
10
+ }) {
11
+ if (label) {
12
+ return XNode.create("div", {
13
+ eventClick: Bind.event(e => command(e)),
14
+ styleClass: Bind.oneWay(e => ({
15
+ command: e.version,
16
+ pressed: !e.queryCommandState(queryState)
17
+ })),
18
+ ...others
19
+ }, XNode.create("i", {
20
+ class: icon
21
+ }), XNode.create("label", {
22
+ class: "label",
23
+ text: label
24
+ }));
25
+ }
26
+ return XNode.create("div", {
27
+ eventClick: Bind.event(e => command(e)),
28
+ styleClass: Bind.oneWay(e => ({
29
+ command: e.version,
30
+ pressed: e.queryCommandState(queryState)
31
+ })),
32
+ ...others
33
+ }, XNode.create("i", {
34
+ class: icon
35
+ }));
36
+ }